mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 04:11:57 +00:00
rename enum and add multiselect
This commit is contained in:
@@ -19,7 +19,7 @@ import { Value } from "./value";
|
||||
|
||||
The idea of a config is that now the form is going to ask for
|
||||
Test: [ ] and the value is going to be checked as a boolean.
|
||||
There are more complex values like enums, lists, and objects. See {@link Value}
|
||||
There are more complex values like selects, lists, and objects. See {@link Value}
|
||||
|
||||
Also, there is the ability to get a validator/parser from this config spec.
|
||||
```ts
|
||||
@@ -81,7 +81,7 @@ import { Value } from "./value";
|
||||
"warning": null,
|
||||
});
|
||||
export const auth = Value.list(authorizationList);
|
||||
export const serialversion = Value.enum({
|
||||
export const serialversion = Value.select({
|
||||
"name": "Serialization Version",
|
||||
"description":
|
||||
"Return raw transaction or block hex with Segwit or non-SegWit serialization.",
|
||||
|
||||
@@ -59,24 +59,6 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
...a,
|
||||
});
|
||||
}
|
||||
static enum<
|
||||
A extends Description &
|
||||
Default<string[]> & {
|
||||
range: string;
|
||||
spec: {
|
||||
values: string[];
|
||||
"value-names": {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
>(a: A) {
|
||||
return new List({
|
||||
type: "list" as const,
|
||||
subtype: "enum" as const,
|
||||
...a,
|
||||
});
|
||||
}
|
||||
static obj<
|
||||
A extends Description &
|
||||
Default<Record<string, unknown>[]> & {
|
||||
|
||||
@@ -95,7 +95,7 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
|
||||
...a,
|
||||
} as ValueSpecNumber);
|
||||
}
|
||||
static enum<
|
||||
static select<
|
||||
A extends Description &
|
||||
Default<string> & {
|
||||
values: readonly string[] | string[];
|
||||
@@ -103,7 +103,7 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
|
||||
}
|
||||
>(a: A) {
|
||||
return new Value({
|
||||
type: "enum" as const,
|
||||
type: "select" as const,
|
||||
...a,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ import { BuilderExtract, IBuilder } from "./builder";
|
||||
import { Config } from ".";
|
||||
|
||||
/**
|
||||
* Used in the the Value.enum { @link './value.ts' }
|
||||
* to indicate the type of enums variants that are available. The key for the record passed in will be the
|
||||
* key to the tag.id in the Value.enum
|
||||
* Used in the the Value.select { @link './value.ts' }
|
||||
* to indicate the type of select variants that are available. The key for the record passed in will be the
|
||||
* key to the tag.id in the Value.select
|
||||
```ts
|
||||
export const pruningSettingsVariants = Variants.of({
|
||||
"disabled": disabled,
|
||||
|
||||
Reference in New Issue
Block a user