mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 04:11:57 +00:00
rename things and add new value spec types
This commit is contained in:
@@ -2,8 +2,8 @@ import { BuilderExtract, IBuilder } from "./builder";
|
||||
import { Config } from "./config";
|
||||
import {
|
||||
InputSpec,
|
||||
ListValueSpecNumber,
|
||||
ListValueSpecString,
|
||||
ListValueSpecText,
|
||||
Pattern,
|
||||
UniqueBy,
|
||||
ValueSpecList,
|
||||
} from "../configTypes";
|
||||
@@ -22,31 +22,33 @@ export const auth = Value.list(authorizationList);
|
||||
```
|
||||
*/
|
||||
export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
static string(
|
||||
static text(
|
||||
a: {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
warning?: string | null;
|
||||
/** Default = [] */
|
||||
default?: string[];
|
||||
/** Default = "(\*,\*)" */
|
||||
range?: string;
|
||||
/** Default = 0 */
|
||||
minLength?: number | null;
|
||||
maxLength?: number | null;
|
||||
},
|
||||
aSpec: {
|
||||
/** Default = false */
|
||||
masked?: boolean;
|
||||
placeholder?: string | null;
|
||||
pattern?: string | null;
|
||||
patternDescription?: string | null;
|
||||
minLength?: number | null;
|
||||
maxLength?: number | null;
|
||||
patterns: Pattern[];
|
||||
/** Default = "text" */
|
||||
inputmode?: ListValueSpecString["inputmode"];
|
||||
inputmode?: ListValueSpecText["inputmode"];
|
||||
},
|
||||
) {
|
||||
const spec = {
|
||||
type: "string" as const,
|
||||
type: "text" as const,
|
||||
placeholder: null,
|
||||
pattern: null,
|
||||
patternDescription: null,
|
||||
minLength: null,
|
||||
maxLength: null,
|
||||
masked: false,
|
||||
inputmode: "text" as const,
|
||||
...aSpec,
|
||||
@@ -56,7 +58,8 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
warning: null,
|
||||
default: [],
|
||||
type: "list" as const,
|
||||
range: "(*,*)",
|
||||
minLength: 0,
|
||||
maxLength: null,
|
||||
...a,
|
||||
spec,
|
||||
});
|
||||
@@ -68,13 +71,15 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
warning?: string | null;
|
||||
/** Default = [] */
|
||||
default?: string[];
|
||||
/** Default = "(\*,\*)" */
|
||||
range?: string;
|
||||
/** Default = 0 */
|
||||
minLength?: number | null;
|
||||
maxLength?: number | null;
|
||||
},
|
||||
aSpec: {
|
||||
integral: boolean;
|
||||
/** Default = "(\*,\*)" */
|
||||
range?: string;
|
||||
integer: boolean;
|
||||
min?: number | null;
|
||||
max?: number | null;
|
||||
step?: string | null;
|
||||
units?: string | null;
|
||||
placeholder?: string | null;
|
||||
},
|
||||
@@ -82,15 +87,17 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
const spec = {
|
||||
type: "number" as const,
|
||||
placeholder: null,
|
||||
range: "(*,*)",
|
||||
min: null,
|
||||
max: null,
|
||||
step: null,
|
||||
units: null,
|
||||
...aSpec,
|
||||
};
|
||||
return new List({
|
||||
description: null,
|
||||
warning: null,
|
||||
units: null,
|
||||
range: "(*,*)",
|
||||
minLength: 0,
|
||||
maxLength: null,
|
||||
default: [],
|
||||
type: "list" as const,
|
||||
...a,
|
||||
@@ -104,8 +111,9 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
warning?: string | null;
|
||||
/** Default [] */
|
||||
default?: [];
|
||||
/** Default = "(\*,\*)" */
|
||||
range?: string;
|
||||
/** Default = 0 */
|
||||
minLength?: number | null;
|
||||
maxLength?: number | null;
|
||||
},
|
||||
aSpec: {
|
||||
spec: Spec;
|
||||
@@ -130,7 +138,8 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
return new List({
|
||||
description: null,
|
||||
warning: null,
|
||||
range: "(*,*)",
|
||||
minLength: 0,
|
||||
maxLength: null,
|
||||
type: "list" as const,
|
||||
...value,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user