mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 20:24:47 +00:00
chore: Add tests and fix tests. Remove validation for types not seeable
This commit is contained in:
@@ -41,7 +41,7 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
maxLength?: number | null;
|
||||
patterns: Pattern[];
|
||||
/** Default = "text" */
|
||||
inputmode?: ListValueSpecText["inputmode"];
|
||||
inputMode?: ListValueSpecText["inputMode"];
|
||||
},
|
||||
) {
|
||||
const spec = {
|
||||
@@ -50,7 +50,7 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
|
||||
minLength: null,
|
||||
maxLength: null,
|
||||
masked: false,
|
||||
inputmode: "text" as const,
|
||||
inputMode: "text" as const,
|
||||
...aSpec,
|
||||
};
|
||||
return new List({
|
||||
|
||||
@@ -65,7 +65,7 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
|
||||
maxLength?: number | null;
|
||||
patterns?: Pattern[];
|
||||
/** Default = 'text' */
|
||||
inputmode?: ValueSpecText["inputmode"];
|
||||
inputMode?: ValueSpecText["inputMode"];
|
||||
}) {
|
||||
return new Value({
|
||||
type: "text" as const,
|
||||
@@ -77,7 +77,7 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
|
||||
minLength: null,
|
||||
maxLength: null,
|
||||
patterns: [],
|
||||
inputmode: "text",
|
||||
inputMode: "text",
|
||||
...a,
|
||||
});
|
||||
}
|
||||
@@ -148,17 +148,17 @@ export class Value<A extends ValueSpec> extends IBuilder<A> {
|
||||
warning?: string | null;
|
||||
required: boolean;
|
||||
/** Default = 'datetime-local' */
|
||||
inputMode?: ValueSpecDatetime['inputMode']
|
||||
min?: string | null
|
||||
max?: string | null
|
||||
step?: string | null
|
||||
inputMode?: ValueSpecDatetime["inputMode"];
|
||||
min?: string | null;
|
||||
max?: string | null;
|
||||
step?: string | null;
|
||||
default?: number | null;
|
||||
}) {
|
||||
return new Value({
|
||||
type: "datetime" as const,
|
||||
description: null,
|
||||
warning: null,
|
||||
inputMode: 'datetime-local',
|
||||
inputMode: "datetime-local",
|
||||
min: null,
|
||||
max: null,
|
||||
step: null,
|
||||
|
||||
@@ -56,17 +56,17 @@ export interface ValueSpecNumber extends ListValueSpecNumber, WithStandalone {
|
||||
default: number | null;
|
||||
}
|
||||
export interface ValueSpecColor extends WithStandalone {
|
||||
type: "color"
|
||||
type: "color";
|
||||
required: boolean;
|
||||
default: string | null;
|
||||
}
|
||||
export interface ValueSpecDatetime extends WithStandalone {
|
||||
type: "datetime"
|
||||
type: "datetime";
|
||||
required: boolean;
|
||||
inputMode: 'date' | 'time' | 'datetime-local'
|
||||
min: string | null
|
||||
max: string | null
|
||||
step: string | null
|
||||
inputMode: "date" | "time" | "datetime-local";
|
||||
min: string | null;
|
||||
max: string | null;
|
||||
step: string | null;
|
||||
default: string | null;
|
||||
}
|
||||
export interface ValueSpecSelect extends SelectBase, WithStandalone {
|
||||
@@ -141,16 +141,16 @@ export interface ValueSpecListOf<T extends ListValueSpecType>
|
||||
| readonly Record<string, unknown>[];
|
||||
}
|
||||
export interface Pattern {
|
||||
regex: string
|
||||
description: string
|
||||
regex: string;
|
||||
description: string;
|
||||
}
|
||||
export interface ListValueSpecText {
|
||||
type: "text";
|
||||
patterns: Pattern[]
|
||||
minLength: number | null
|
||||
maxLength: number | null
|
||||
patterns: Pattern[];
|
||||
minLength: number | null;
|
||||
maxLength: number | null;
|
||||
masked: boolean;
|
||||
inputmode: "text" | "email" | "tel" | "url";
|
||||
inputMode: "text" | "email" | "tel" | "url";
|
||||
placeholder: string | null;
|
||||
}
|
||||
export interface ListValueSpecNumber {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { Config } from "./builder";
|
||||
import {
|
||||
DeepPartial,
|
||||
Dependencies,
|
||||
Effects,
|
||||
ExpectedExports,
|
||||
} from "../types";
|
||||
import { DeepPartial, Dependencies, Effects, ExpectedExports } from "../types";
|
||||
import { InputSpec } from "./configTypes";
|
||||
import { nullIfEmpty } from "../util";
|
||||
import { TypeFromProps } from "../util/propertiesMatcher";
|
||||
|
||||
@@ -109,7 +109,7 @@ export async function specToBuilder(
|
||||
masked: spec?.masked || false,
|
||||
placeholder: spec?.placeholder || null,
|
||||
pattern: spec?.patterns || [],
|
||||
inputMode: spec?.inputmode || 'text',
|
||||
inputMode: spec?.inputMode || "text",
|
||||
})})`;
|
||||
}
|
||||
case "number": {
|
||||
|
||||
Reference in New Issue
Block a user