formspec 0.1.0-alpha.24 → 0.1.0-alpha.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formspec-alpha.d.ts +119 -479
- package/dist/formspec-beta.d.ts +119 -479
- package/dist/formspec-internal.d.ts +119 -479
- package/dist/formspec.d.ts +119 -479
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +42 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/formspec-alpha.d.ts
CHANGED
|
@@ -59,13 +59,6 @@
|
|
|
59
59
|
*/
|
|
60
60
|
export declare type AnyField = TextField<string> | NumberField<string> | BooleanField<string> | StaticEnumField<string, readonly EnumOptionValue[]> | DynamicEnumField<string, string> | DynamicSchemaField<string> | ArrayField<string, readonly FormElement[]> | ObjectField<string, readonly FormElement[]>;
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Union of all field types.
|
|
64
|
-
*
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
declare type AnyField_2 = TextField_2<string> | NumberField_2<string> | BooleanField_2<string> | StaticEnumField_2<string, readonly EnumOptionValue_2[]> | DynamicEnumField_2<string, string> | DynamicSchemaField_2<string> | ArrayField_2<string, readonly FormElement_2[]> | ObjectField_2<string, readonly FormElement_2[]>;
|
|
68
|
-
|
|
69
62
|
/**
|
|
70
63
|
* An array field containing repeating items.
|
|
71
64
|
*
|
|
@@ -95,35 +88,6 @@ export declare interface ArrayField<N extends string, Items extends readonly For
|
|
|
95
88
|
readonly maxItems?: number;
|
|
96
89
|
}
|
|
97
90
|
|
|
98
|
-
/**
|
|
99
|
-
* An array field containing repeating items.
|
|
100
|
-
*
|
|
101
|
-
* Use this for lists of values (e.g., multiple addresses, line items).
|
|
102
|
-
*
|
|
103
|
-
* @typeParam N - The field name (string literal type)
|
|
104
|
-
* @typeParam Items - The form elements that define each array item
|
|
105
|
-
*
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
declare interface ArrayField_2<N extends string, Items extends readonly FormElement_2[]> {
|
|
109
|
-
/** Type discriminator for form elements */
|
|
110
|
-
readonly _type: "field";
|
|
111
|
-
/** Field type discriminator - identifies this as an array field */
|
|
112
|
-
readonly _field: "array";
|
|
113
|
-
/** Unique field identifier used as the schema key */
|
|
114
|
-
readonly name: N;
|
|
115
|
-
/** Form elements that define the schema for each array item */
|
|
116
|
-
readonly items: Items;
|
|
117
|
-
/** Display label for the field */
|
|
118
|
-
readonly label?: string;
|
|
119
|
-
/** Whether this field is required for form submission */
|
|
120
|
-
readonly required?: boolean;
|
|
121
|
-
/** Minimum number of items required */
|
|
122
|
-
readonly minItems?: number;
|
|
123
|
-
/** Maximum number of items allowed */
|
|
124
|
-
readonly maxItems?: number;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
91
|
/**
|
|
128
92
|
* A boolean checkbox field.
|
|
129
93
|
*
|
|
@@ -144,26 +108,6 @@ export declare interface BooleanField<N extends string> {
|
|
|
144
108
|
readonly required?: boolean;
|
|
145
109
|
}
|
|
146
110
|
|
|
147
|
-
/**
|
|
148
|
-
* A boolean checkbox field.
|
|
149
|
-
*
|
|
150
|
-
* @typeParam N - The field name (string literal type)
|
|
151
|
-
*
|
|
152
|
-
* @public
|
|
153
|
-
*/
|
|
154
|
-
declare interface BooleanField_2<N extends string> {
|
|
155
|
-
/** Type discriminator for form elements */
|
|
156
|
-
readonly _type: "field";
|
|
157
|
-
/** Field type discriminator - identifies this as a boolean field */
|
|
158
|
-
readonly _field: "boolean";
|
|
159
|
-
/** Unique field identifier used as the schema key */
|
|
160
|
-
readonly name: N;
|
|
161
|
-
/** Display label for the field */
|
|
162
|
-
readonly label?: string;
|
|
163
|
-
/** Whether this field is required for form submission */
|
|
164
|
-
readonly required?: boolean;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
111
|
/**
|
|
168
112
|
* Builds both JSON Schema and UI Schema from a FormSpec.
|
|
169
113
|
*
|
|
@@ -206,11 +150,17 @@ export declare type BuildSchema<Fields> = { [N in Fields extends { name: infer K
|
|
|
206
150
|
* @public
|
|
207
151
|
*/
|
|
208
152
|
export declare interface Categorization {
|
|
153
|
+
/** Discriminator identifying a categorization layout. */
|
|
209
154
|
readonly type: "Categorization";
|
|
155
|
+
/** Categories rendered as tabs or steps. */
|
|
210
156
|
readonly elements: Category[];
|
|
157
|
+
/** Optional label for the overall categorization container. */
|
|
211
158
|
readonly label?: string | undefined;
|
|
159
|
+
/** Optional rule controlling visibility or enablement. */
|
|
212
160
|
readonly rule?: Rule | undefined;
|
|
161
|
+
/** Renderer-specific categorization options. */
|
|
213
162
|
readonly options?: Record<string, unknown> | undefined;
|
|
163
|
+
/** Additional renderer-specific extension properties. */
|
|
214
164
|
readonly [k: string]: unknown;
|
|
215
165
|
}
|
|
216
166
|
|
|
@@ -220,11 +170,17 @@ export declare interface Categorization {
|
|
|
220
170
|
* @public
|
|
221
171
|
*/
|
|
222
172
|
export declare interface Category {
|
|
173
|
+
/** Discriminator identifying a category inside a categorization layout. */
|
|
223
174
|
readonly type: "Category";
|
|
175
|
+
/** Category label shown in tabs or step navigation. */
|
|
224
176
|
readonly label: string;
|
|
177
|
+
/** Child elements rendered inside the category. */
|
|
225
178
|
readonly elements: UISchemaElement[];
|
|
179
|
+
/** Optional rule controlling visibility or enablement. */
|
|
226
180
|
readonly rule?: Rule | undefined;
|
|
181
|
+
/** Renderer-specific category options. */
|
|
227
182
|
readonly options?: Record<string, unknown> | undefined;
|
|
183
|
+
/** Additional renderer-specific extension properties. */
|
|
228
184
|
readonly [k: string]: unknown;
|
|
229
185
|
}
|
|
230
186
|
|
|
@@ -248,37 +204,23 @@ export declare interface Conditional<FieldName extends string, Value, Elements e
|
|
|
248
204
|
readonly elements: Elements;
|
|
249
205
|
}
|
|
250
206
|
|
|
251
|
-
/**
|
|
252
|
-
* A conditional wrapper that shows/hides elements based on another field's value.
|
|
253
|
-
*
|
|
254
|
-
* @typeParam FieldName - The field to check
|
|
255
|
-
* @typeParam Value - The value that triggers the condition
|
|
256
|
-
* @typeParam Elements - Tuple of contained form elements
|
|
257
|
-
*
|
|
258
|
-
* @public
|
|
259
|
-
*/
|
|
260
|
-
declare interface Conditional_2<FieldName extends string, Value, Elements extends readonly FormElement_2[]> {
|
|
261
|
-
/** Type discriminator - identifies this as a conditional element */
|
|
262
|
-
readonly _type: "conditional";
|
|
263
|
-
/** Name of the field whose value determines visibility */
|
|
264
|
-
readonly field: FieldName;
|
|
265
|
-
/** Value that triggers the condition (shows nested elements) */
|
|
266
|
-
readonly value: Value;
|
|
267
|
-
/** Form elements shown when condition is met */
|
|
268
|
-
readonly elements: Elements;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
207
|
/**
|
|
272
208
|
* A Control element that binds to a JSON Schema property.
|
|
273
209
|
*
|
|
274
210
|
* @public
|
|
275
211
|
*/
|
|
276
212
|
export declare interface ControlElement {
|
|
213
|
+
/** Discriminator identifying a JSON Forms control element. */
|
|
277
214
|
readonly type: "Control";
|
|
215
|
+
/** JSON Pointer scope that this control binds to. */
|
|
278
216
|
readonly scope: string;
|
|
217
|
+
/** Optional label override, or `false` to suppress the label. */
|
|
279
218
|
readonly label?: string | false | undefined;
|
|
219
|
+
/** Optional rule controlling visibility or enablement. */
|
|
280
220
|
readonly rule?: Rule | undefined;
|
|
221
|
+
/** Renderer-specific control options. */
|
|
281
222
|
readonly options?: Record<string, unknown> | undefined;
|
|
223
|
+
/** Additional renderer-specific extension properties. */
|
|
282
224
|
readonly [k: string]: unknown;
|
|
283
225
|
}
|
|
284
226
|
|
|
@@ -373,31 +315,6 @@ export declare interface DynamicEnumField<N extends string, Source extends strin
|
|
|
373
315
|
readonly params?: readonly string[];
|
|
374
316
|
}
|
|
375
317
|
|
|
376
|
-
/**
|
|
377
|
-
* A field with dynamic enum options (fetched from a data source at runtime).
|
|
378
|
-
*
|
|
379
|
-
* @typeParam N - The field name (string literal type)
|
|
380
|
-
* @typeParam Source - The data source key (from DataSourceRegistry)
|
|
381
|
-
*
|
|
382
|
-
* @public
|
|
383
|
-
*/
|
|
384
|
-
declare interface DynamicEnumField_2<N extends string, Source extends string> {
|
|
385
|
-
/** Type discriminator for form elements */
|
|
386
|
-
readonly _type: "field";
|
|
387
|
-
/** Field type discriminator - identifies this as a dynamic enum field */
|
|
388
|
-
readonly _field: "dynamic_enum";
|
|
389
|
-
/** Unique field identifier used as the schema key */
|
|
390
|
-
readonly name: N;
|
|
391
|
-
/** Data source key for fetching options at runtime */
|
|
392
|
-
readonly source: Source;
|
|
393
|
-
/** Display label for the field */
|
|
394
|
-
readonly label?: string;
|
|
395
|
-
/** Whether this field is required for form submission */
|
|
396
|
-
readonly required?: boolean;
|
|
397
|
-
/** Field names whose values are needed to fetch options */
|
|
398
|
-
readonly params?: readonly string[];
|
|
399
|
-
}
|
|
400
|
-
|
|
401
318
|
/**
|
|
402
319
|
* A field that loads its schema dynamically (e.g., from an extension).
|
|
403
320
|
*
|
|
@@ -422,30 +339,6 @@ export declare interface DynamicSchemaField<N extends string> {
|
|
|
422
339
|
readonly params?: readonly string[];
|
|
423
340
|
}
|
|
424
341
|
|
|
425
|
-
/**
|
|
426
|
-
* A field that loads its schema dynamically (e.g., from an extension).
|
|
427
|
-
*
|
|
428
|
-
* @typeParam N - The field name (string literal type)
|
|
429
|
-
*
|
|
430
|
-
* @public
|
|
431
|
-
*/
|
|
432
|
-
declare interface DynamicSchemaField_2<N extends string> {
|
|
433
|
-
/** Type discriminator for form elements */
|
|
434
|
-
readonly _type: "field";
|
|
435
|
-
/** Field type discriminator - identifies this as a dynamic schema field */
|
|
436
|
-
readonly _field: "dynamic_schema";
|
|
437
|
-
/** Unique field identifier used as the schema key */
|
|
438
|
-
readonly name: N;
|
|
439
|
-
/** Identifier for the schema source */
|
|
440
|
-
readonly schemaSource: string;
|
|
441
|
-
/** Display label for the field */
|
|
442
|
-
readonly label?: string;
|
|
443
|
-
/** Whether this field is required for form submission */
|
|
444
|
-
readonly required?: boolean;
|
|
445
|
-
/** Field names whose values are needed to configure the schema */
|
|
446
|
-
readonly params?: readonly string[];
|
|
447
|
-
}
|
|
448
|
-
|
|
449
342
|
/**
|
|
450
343
|
* An enum option with a separate ID and display label.
|
|
451
344
|
*
|
|
@@ -454,19 +347,9 @@ declare interface DynamicSchemaField_2<N extends string> {
|
|
|
454
347
|
* @public
|
|
455
348
|
*/
|
|
456
349
|
export declare interface EnumOption {
|
|
350
|
+
/** Stored enum value written into submitted data. */
|
|
457
351
|
readonly id: string;
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* An enum option with a separate ID and display label.
|
|
463
|
-
*
|
|
464
|
-
* Use this when the stored value (id) should differ from the display text (label).
|
|
465
|
-
*
|
|
466
|
-
* @public
|
|
467
|
-
*/
|
|
468
|
-
declare interface EnumOption_2 {
|
|
469
|
-
readonly id: string;
|
|
352
|
+
/** Human-readable label shown to end users. */
|
|
470
353
|
readonly label: string;
|
|
471
354
|
}
|
|
472
355
|
|
|
@@ -477,13 +360,6 @@ declare interface EnumOption_2 {
|
|
|
477
360
|
*/
|
|
478
361
|
export declare type EnumOptionValue = string | EnumOption;
|
|
479
362
|
|
|
480
|
-
/**
|
|
481
|
-
* Valid enum option types: either plain strings or objects with id/label.
|
|
482
|
-
*
|
|
483
|
-
* @public
|
|
484
|
-
*/
|
|
485
|
-
declare type EnumOptionValue_2 = string | EnumOption_2;
|
|
486
|
-
|
|
487
363
|
/**
|
|
488
364
|
* Predicate types for conditional logic.
|
|
489
365
|
*
|
|
@@ -582,178 +458,11 @@ export declare interface FetchOptionsResponse<T = unknown> {
|
|
|
582
458
|
}
|
|
583
459
|
|
|
584
460
|
/**
|
|
585
|
-
* Field builder
|
|
586
|
-
*
|
|
587
|
-
* @example
|
|
588
|
-
* ```typescript
|
|
589
|
-
* import { field } from "@formspec/dsl";
|
|
590
|
-
*
|
|
591
|
-
* field.text("name", { label: "Full Name" });
|
|
592
|
-
* field.number("age", { min: 0, max: 150 });
|
|
593
|
-
* field.enum("status", ["draft", "sent", "paid"]);
|
|
594
|
-
* field.dynamicEnum("country", "countries", { label: "Country" });
|
|
595
|
-
* ```
|
|
461
|
+
* Field builder helpers that preserve this package's exported type identities.
|
|
596
462
|
*
|
|
597
463
|
* @public
|
|
598
464
|
*/
|
|
599
|
-
export declare const field:
|
|
600
|
-
/**
|
|
601
|
-
* Creates a text input field.
|
|
602
|
-
*
|
|
603
|
-
* @param name - The field name (used as the schema key)
|
|
604
|
-
* @param config - Optional configuration for label, placeholder, etc.
|
|
605
|
-
* @returns A TextField descriptor
|
|
606
|
-
*/
|
|
607
|
-
text: <const N extends string>(name: N, config?: Omit<TextField_2<N>, "_type" | "_field" | "name">) => TextField_2<N>;
|
|
608
|
-
/**
|
|
609
|
-
* Creates a numeric input field.
|
|
610
|
-
*
|
|
611
|
-
* @param name - The field name (used as the schema key)
|
|
612
|
-
* @param config - Optional configuration for label, min, max, etc.
|
|
613
|
-
* @returns A NumberField descriptor
|
|
614
|
-
*/
|
|
615
|
-
number: <const N extends string>(name: N, config?: Omit<NumberField_2<N>, "_type" | "_field" | "name">) => NumberField_2<N>;
|
|
616
|
-
/**
|
|
617
|
-
* Creates a boolean checkbox field.
|
|
618
|
-
*
|
|
619
|
-
* @param name - The field name (used as the schema key)
|
|
620
|
-
* @param config - Optional configuration for label, etc.
|
|
621
|
-
* @returns A BooleanField descriptor
|
|
622
|
-
*/
|
|
623
|
-
boolean: <const N extends string>(name: N, config?: Omit<BooleanField_2<N>, "_type" | "_field" | "name">) => BooleanField_2<N>;
|
|
624
|
-
/**
|
|
625
|
-
* Creates a field with static enum options (known at compile time).
|
|
626
|
-
*
|
|
627
|
-
* Literal types are automatically inferred - no `as const` needed:
|
|
628
|
-
* ```typescript
|
|
629
|
-
* field.enum("status", ["draft", "sent", "paid"])
|
|
630
|
-
* // Schema type: "draft" | "sent" | "paid"
|
|
631
|
-
* ```
|
|
632
|
-
*
|
|
633
|
-
* Options can be strings or objects with `id` and `label`:
|
|
634
|
-
* ```typescript
|
|
635
|
-
* field.enum("priority", [
|
|
636
|
-
* { id: "low", label: "Low Priority" },
|
|
637
|
-
* { id: "high", label: "High Priority" },
|
|
638
|
-
* ])
|
|
639
|
-
* ```
|
|
640
|
-
*
|
|
641
|
-
* **Note:** All options must be of the same type (all strings OR all objects).
|
|
642
|
-
* Mixing strings and objects will throw a runtime error.
|
|
643
|
-
*
|
|
644
|
-
* @param name - The field name (used as the schema key)
|
|
645
|
-
* @param options - Array of allowed string values or objects with `id` and `label` properties
|
|
646
|
-
* @param config - Optional configuration for label, etc.
|
|
647
|
-
* @returns A StaticEnumField descriptor
|
|
648
|
-
* @throws Error if options array contains mixed types (strings and objects)
|
|
649
|
-
*/
|
|
650
|
-
enum: <const N extends string, const O extends readonly EnumOptionValue_2[]>(name: N, options: O, config?: Omit<StaticEnumField_2<N, O>, "_type" | "_field" | "name" | "options">) => StaticEnumField_2<N, O>;
|
|
651
|
-
/**
|
|
652
|
-
* Creates a field with dynamic enum options (fetched from a data source at runtime).
|
|
653
|
-
*
|
|
654
|
-
* The data source must be registered in DataSourceRegistry via module augmentation:
|
|
655
|
-
* ```typescript
|
|
656
|
-
* declare module "@formspec/core" {
|
|
657
|
-
* interface DataSourceRegistry {
|
|
658
|
-
* countries: { id: string; code: string; name: string };
|
|
659
|
-
* }
|
|
660
|
-
* }
|
|
661
|
-
*
|
|
662
|
-
* field.dynamicEnum("country", "countries", { label: "Country" })
|
|
663
|
-
* ```
|
|
664
|
-
*
|
|
665
|
-
* @param name - The field name (used as the schema key)
|
|
666
|
-
* @param source - The data source key (must be in DataSourceRegistry)
|
|
667
|
-
* @param config - Optional configuration for label, params, etc.
|
|
668
|
-
* @returns A DynamicEnumField descriptor
|
|
669
|
-
*/
|
|
670
|
-
dynamicEnum: <const N extends string, const Source extends string>(name: N, source: Source, config?: Omit<DynamicEnumField_2<N, Source>, "_type" | "_field" | "name" | "source">) => DynamicEnumField_2<N, Source>;
|
|
671
|
-
/**
|
|
672
|
-
* Creates a field that loads its schema dynamically (e.g., from an extension).
|
|
673
|
-
*
|
|
674
|
-
* @param name - The field name (used as the schema key)
|
|
675
|
-
* @param schemaSource - Identifier for the schema source
|
|
676
|
-
* @param config - Optional configuration for label, etc.
|
|
677
|
-
* @returns A DynamicSchemaField descriptor
|
|
678
|
-
*/
|
|
679
|
-
dynamicSchema: <const N extends string>(name: N, schemaSource: string, config?: Omit<DynamicSchemaField_2<N>, "_type" | "_field" | "name" | "schemaSource">) => DynamicSchemaField_2<N>;
|
|
680
|
-
/**
|
|
681
|
-
* Creates an array field containing repeating items.
|
|
682
|
-
*
|
|
683
|
-
* Use this for lists of values (e.g., multiple addresses, line items).
|
|
684
|
-
*
|
|
685
|
-
* @example
|
|
686
|
-
* ```typescript
|
|
687
|
-
* field.array("addresses",
|
|
688
|
-
* field.text("street", { label: "Street" }),
|
|
689
|
-
* field.text("city", { label: "City" }),
|
|
690
|
-
* field.text("zip", { label: "ZIP Code" }),
|
|
691
|
-
* )
|
|
692
|
-
* ```
|
|
693
|
-
*
|
|
694
|
-
* @param name - The field name (used as the schema key)
|
|
695
|
-
* @param items - The form elements that define each array item
|
|
696
|
-
* @returns An ArrayField descriptor
|
|
697
|
-
*/
|
|
698
|
-
array: <const N extends string, const Items extends readonly FormElement_2[]>(name: N, ...items: Items) => ArrayField_2<N, Items>;
|
|
699
|
-
/**
|
|
700
|
-
* Creates an array field with additional configuration options.
|
|
701
|
-
*
|
|
702
|
-
* @example
|
|
703
|
-
* ```typescript
|
|
704
|
-
* field.arrayWithConfig("lineItems", {
|
|
705
|
-
* label: "Line Items",
|
|
706
|
-
* minItems: 1,
|
|
707
|
-
* maxItems: 10,
|
|
708
|
-
* },
|
|
709
|
-
* field.text("description"),
|
|
710
|
-
* field.number("quantity"),
|
|
711
|
-
* )
|
|
712
|
-
* ```
|
|
713
|
-
*
|
|
714
|
-
* @param name - The field name (used as the schema key)
|
|
715
|
-
* @param config - Configuration for label, minItems, maxItems, etc.
|
|
716
|
-
* @param items - The form elements that define each array item
|
|
717
|
-
* @returns An ArrayField descriptor
|
|
718
|
-
*/
|
|
719
|
-
arrayWithConfig: <const N extends string, const Items extends readonly FormElement_2[]>(name: N, config: Omit<ArrayField_2<N, Items>, "_type" | "_field" | "name" | "items">, ...items: Items) => ArrayField_2<N, Items>;
|
|
720
|
-
/**
|
|
721
|
-
* Creates an object field containing nested properties.
|
|
722
|
-
*
|
|
723
|
-
* Use this for grouping related fields under a single key in the schema.
|
|
724
|
-
*
|
|
725
|
-
* @example
|
|
726
|
-
* ```typescript
|
|
727
|
-
* field.object("address",
|
|
728
|
-
* field.text("street", { label: "Street" }),
|
|
729
|
-
* field.text("city", { label: "City" }),
|
|
730
|
-
* field.text("zip", { label: "ZIP Code" }),
|
|
731
|
-
* )
|
|
732
|
-
* ```
|
|
733
|
-
*
|
|
734
|
-
* @param name - The field name (used as the schema key)
|
|
735
|
-
* @param properties - The form elements that define the object's properties
|
|
736
|
-
* @returns An ObjectField descriptor
|
|
737
|
-
*/
|
|
738
|
-
object: <const N extends string, const Properties extends readonly FormElement_2[]>(name: N, ...properties: Properties) => ObjectField_2<N, Properties>;
|
|
739
|
-
/**
|
|
740
|
-
* Creates an object field with additional configuration options.
|
|
741
|
-
*
|
|
742
|
-
* @example
|
|
743
|
-
* ```typescript
|
|
744
|
-
* field.objectWithConfig("billingAddress", { label: "Billing Address", required: true },
|
|
745
|
-
* field.text("street"),
|
|
746
|
-
* field.text("city"),
|
|
747
|
-
* )
|
|
748
|
-
* ```
|
|
749
|
-
*
|
|
750
|
-
* @param name - The field name (used as the schema key)
|
|
751
|
-
* @param config - Configuration for label, required, etc.
|
|
752
|
-
* @param properties - The form elements that define the object's properties
|
|
753
|
-
* @returns An ObjectField descriptor
|
|
754
|
-
*/
|
|
755
|
-
objectWithConfig: <const N extends string, const Properties extends readonly FormElement_2[]>(name: N, config: Omit<ObjectField_2<N, Properties>, "_type" | "_field" | "name" | "properties">, ...properties: Properties) => ObjectField_2<N, Properties>;
|
|
756
|
-
};
|
|
465
|
+
export declare const field: FormSpecFieldBuilder;
|
|
757
466
|
|
|
758
467
|
/**
|
|
759
468
|
* Represents the runtime state of a single form field.
|
|
@@ -789,13 +498,6 @@ export declare type FlattenIntersection<T> = { [K in keyof T]: T[K] } & {};
|
|
|
789
498
|
*/
|
|
790
499
|
export declare type FormElement = AnyField | Group<readonly FormElement[]> | Conditional<string, unknown, readonly FormElement[]>;
|
|
791
500
|
|
|
792
|
-
/**
|
|
793
|
-
* Union of all form element types (fields and structural elements).
|
|
794
|
-
*
|
|
795
|
-
* @public
|
|
796
|
-
*/
|
|
797
|
-
declare type FormElement_2 = AnyField_2 | Group_2<readonly FormElement_2[]> | Conditional_2<string, unknown, readonly FormElement_2[]>;
|
|
798
|
-
|
|
799
501
|
/**
|
|
800
502
|
* A complete form specification.
|
|
801
503
|
*
|
|
@@ -815,6 +517,34 @@ export declare interface FormSpec<Elements extends readonly FormElement[]> {
|
|
|
815
517
|
*/
|
|
816
518
|
export declare function formspec<const Elements extends readonly FormElement[]>(...elements: Elements): FormSpec<Elements>;
|
|
817
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Field builder helpers re-exported by the top-level `formspec` package.
|
|
522
|
+
*
|
|
523
|
+
* @public
|
|
524
|
+
*/
|
|
525
|
+
export declare interface FormSpecFieldBuilder {
|
|
526
|
+
/** Creates a text field. */
|
|
527
|
+
text<const N extends string>(name: N, config?: Omit<TextField<N>, "_field" | "_type" | "name">): TextField<N>;
|
|
528
|
+
/** Creates a number field. */
|
|
529
|
+
number<const N extends string>(name: N, config?: Omit<NumberField<N>, "_field" | "_type" | "name">): NumberField<N>;
|
|
530
|
+
/** Creates a boolean field. */
|
|
531
|
+
boolean<const N extends string>(name: N, config?: Omit<BooleanField<N>, "_field" | "_type" | "name">): BooleanField<N>;
|
|
532
|
+
/** Creates a static enum field from a fixed options list. */
|
|
533
|
+
enum<const N extends string, const O extends readonly EnumOptionValue[]>(name: N, options: O, config?: Omit<StaticEnumField<N, O>, "_field" | "_type" | "name" | "options">): StaticEnumField<N, O>;
|
|
534
|
+
/** Creates a dynamic enum field backed by an external option source. */
|
|
535
|
+
dynamicEnum<const N extends string, const Source extends string>(name: N, source: Source, config?: Omit<DynamicEnumField<N, Source>, "_field" | "_type" | "name" | "source">): DynamicEnumField<N, Source>;
|
|
536
|
+
/** Creates a field whose schema is resolved from an external source at runtime. */
|
|
537
|
+
dynamicSchema<const N extends string>(name: N, schemaSource: string, config?: Omit<DynamicSchemaField<N>, "_field" | "_type" | "name" | "schemaSource">): DynamicSchemaField<N>;
|
|
538
|
+
/** Creates an array field from a list of item elements. */
|
|
539
|
+
array<const N extends string, const Items extends readonly FormElement[]>(name: N, ...items: Items): ArrayField<N, Items>;
|
|
540
|
+
/** Creates an array field with explicit configuration and item elements. */
|
|
541
|
+
arrayWithConfig<const N extends string, const Items extends readonly FormElement[]>(name: N, config: Omit<ArrayField<N, Items>, "_field" | "_type" | "items" | "name">, ...items: Items): ArrayField<N, Items>;
|
|
542
|
+
/** Creates an object field from a list of property elements. */
|
|
543
|
+
object<const N extends string, const Properties extends readonly FormElement[]>(name: N, ...properties: Properties): ObjectField<N, Properties>;
|
|
544
|
+
/** Creates an object field with explicit configuration and property elements. */
|
|
545
|
+
objectWithConfig<const N extends string, const Properties extends readonly FormElement[]>(name: N, config: Omit<ObjectField<N, Properties>, "_field" | "_type" | "name" | "properties">, ...properties: Properties): ObjectField<N, Properties>;
|
|
546
|
+
}
|
|
547
|
+
|
|
818
548
|
/**
|
|
819
549
|
* Options for creating a form specification.
|
|
820
550
|
*
|
|
@@ -915,35 +645,23 @@ export declare interface Group<Elements extends readonly FormElement[]> {
|
|
|
915
645
|
*/
|
|
916
646
|
export declare function group<const Elements extends readonly FormElement[]>(label: string, ...elements: Elements): Group<Elements>;
|
|
917
647
|
|
|
918
|
-
/**
|
|
919
|
-
* A visual grouping of form elements.
|
|
920
|
-
*
|
|
921
|
-
* Groups provide visual organization and can be rendered as fieldsets or sections.
|
|
922
|
-
*
|
|
923
|
-
* @typeParam Elements - Tuple of contained form elements
|
|
924
|
-
*
|
|
925
|
-
* @public
|
|
926
|
-
*/
|
|
927
|
-
declare interface Group_2<Elements extends readonly FormElement_2[]> {
|
|
928
|
-
/** Type discriminator - identifies this as a group element */
|
|
929
|
-
readonly _type: "group";
|
|
930
|
-
/** Display label for the group */
|
|
931
|
-
readonly label: string;
|
|
932
|
-
/** Form elements contained within this group */
|
|
933
|
-
readonly elements: Elements;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
648
|
/**
|
|
937
649
|
* A group element with a label.
|
|
938
650
|
*
|
|
939
651
|
* @public
|
|
940
652
|
*/
|
|
941
653
|
export declare interface GroupLayout {
|
|
654
|
+
/** Discriminator identifying a labeled group container. */
|
|
942
655
|
readonly type: "Group";
|
|
656
|
+
/** Group label shown by compatible renderers. */
|
|
943
657
|
readonly label: string;
|
|
658
|
+
/** Child elements rendered inside the group. */
|
|
944
659
|
readonly elements: UISchemaElement[];
|
|
660
|
+
/** Optional rule controlling visibility or enablement. */
|
|
945
661
|
readonly rule?: Rule | undefined;
|
|
662
|
+
/** Renderer-specific group options. */
|
|
946
663
|
readonly options?: Record<string, unknown> | undefined;
|
|
664
|
+
/** Additional renderer-specific extension properties. */
|
|
947
665
|
readonly [k: string]: unknown;
|
|
948
666
|
}
|
|
949
667
|
|
|
@@ -953,10 +671,15 @@ export declare interface GroupLayout {
|
|
|
953
671
|
* @public
|
|
954
672
|
*/
|
|
955
673
|
export declare interface HorizontalLayout {
|
|
674
|
+
/** Discriminator identifying a horizontal layout container. */
|
|
956
675
|
readonly type: "HorizontalLayout";
|
|
676
|
+
/** Child elements rendered side by side. */
|
|
957
677
|
readonly elements: UISchemaElement[];
|
|
678
|
+
/** Optional rule controlling visibility or enablement. */
|
|
958
679
|
readonly rule?: Rule | undefined;
|
|
680
|
+
/** Renderer-specific layout options. */
|
|
959
681
|
readonly options?: Record<string, unknown> | undefined;
|
|
682
|
+
/** Additional renderer-specific extension properties. */
|
|
960
683
|
readonly [k: string]: unknown;
|
|
961
684
|
}
|
|
962
685
|
|
|
@@ -1074,35 +797,65 @@ export declare function isTextField(element: FormElement): element is TextField<
|
|
|
1074
797
|
* @public
|
|
1075
798
|
*/
|
|
1076
799
|
export declare interface JsonSchema2020 {
|
|
800
|
+
/** Declared JSON Schema dialect URI for the document root. */
|
|
1077
801
|
$schema?: string;
|
|
802
|
+
/** Reference to another schema location. */
|
|
1078
803
|
$ref?: string;
|
|
804
|
+
/** Named reusable schema definitions keyed by definition name. */
|
|
1079
805
|
$defs?: Record<string, JsonSchema2020>;
|
|
806
|
+
/** JSON Schema type keyword for the current node. */
|
|
1080
807
|
type?: string;
|
|
808
|
+
/** Object properties keyed by property name. */
|
|
1081
809
|
properties?: Record<string, JsonSchema2020>;
|
|
810
|
+
/** Property names that must be present on object values. */
|
|
1082
811
|
required?: string[];
|
|
812
|
+
/** Item schema applied to array elements. */
|
|
1083
813
|
items?: JsonSchema2020;
|
|
814
|
+
/** Whether, or how, additional object properties are allowed. */
|
|
1084
815
|
additionalProperties?: boolean | JsonSchema2020;
|
|
816
|
+
/** Closed set of allowed scalar values. */
|
|
1085
817
|
enum?: readonly (string | number)[];
|
|
818
|
+
/** Literal value the instance must equal. */
|
|
1086
819
|
const?: unknown;
|
|
820
|
+
/** Schemas that must all validate successfully. */
|
|
1087
821
|
allOf?: readonly JsonSchema2020[];
|
|
822
|
+
/** Schemas of which exactly one should validate successfully. */
|
|
1088
823
|
oneOf?: readonly JsonSchema2020[];
|
|
824
|
+
/** Schemas of which at least one may validate successfully. */
|
|
1089
825
|
anyOf?: readonly JsonSchema2020[];
|
|
826
|
+
/** Inclusive numeric lower bound. */
|
|
1090
827
|
minimum?: number;
|
|
828
|
+
/** Inclusive numeric upper bound. */
|
|
1091
829
|
maximum?: number;
|
|
830
|
+
/** Exclusive numeric lower bound. */
|
|
1092
831
|
exclusiveMinimum?: number;
|
|
832
|
+
/** Exclusive numeric upper bound. */
|
|
1093
833
|
exclusiveMaximum?: number;
|
|
834
|
+
/** Required numeric step interval. */
|
|
1094
835
|
multipleOf?: number;
|
|
836
|
+
/** Inclusive minimum string length. */
|
|
1095
837
|
minLength?: number;
|
|
838
|
+
/** Inclusive maximum string length. */
|
|
1096
839
|
maxLength?: number;
|
|
840
|
+
/** Inclusive minimum array length. */
|
|
1097
841
|
minItems?: number;
|
|
842
|
+
/** Inclusive maximum array length. */
|
|
1098
843
|
maxItems?: number;
|
|
844
|
+
/** Regular expression pattern applied to string values. */
|
|
1099
845
|
pattern?: string;
|
|
846
|
+
/** Whether array elements must be unique. */
|
|
1100
847
|
uniqueItems?: boolean;
|
|
848
|
+
/** Format hint for downstream validators and tooling. */
|
|
1101
849
|
format?: string;
|
|
850
|
+
/** Human-readable title for the schema node. */
|
|
1102
851
|
title?: string;
|
|
852
|
+
/** Human-readable description for the schema node. */
|
|
1103
853
|
description?: string;
|
|
854
|
+
/** Default value suggested for the schema node. */
|
|
1104
855
|
default?: unknown;
|
|
856
|
+
/** Whether the schema node is deprecated. */
|
|
1105
857
|
deprecated?: boolean;
|
|
858
|
+
/** Additional vendor-prefixed extension keywords. */
|
|
1106
859
|
[key: `x-${string}`]: unknown;
|
|
1107
860
|
}
|
|
1108
861
|
|
|
@@ -1112,10 +865,15 @@ export declare interface JsonSchema2020 {
|
|
|
1112
865
|
* @public
|
|
1113
866
|
*/
|
|
1114
867
|
export declare interface LabelElement {
|
|
868
|
+
/** Discriminator identifying a static text label element. */
|
|
1115
869
|
readonly type: "Label";
|
|
870
|
+
/** Static text content rendered by the label element. */
|
|
1116
871
|
readonly text: string;
|
|
872
|
+
/** Optional rule controlling visibility or enablement. */
|
|
1117
873
|
readonly rule?: Rule | undefined;
|
|
874
|
+
/** Renderer-specific label options. */
|
|
1118
875
|
readonly options?: Record<string, unknown> | undefined;
|
|
876
|
+
/** Additional renderer-specific extension properties. */
|
|
1119
877
|
readonly [k: string]: unknown;
|
|
1120
878
|
}
|
|
1121
879
|
|
|
@@ -1155,32 +913,6 @@ export declare interface NumberField<N extends string> {
|
|
|
1155
913
|
readonly multipleOf?: number;
|
|
1156
914
|
}
|
|
1157
915
|
|
|
1158
|
-
/**
|
|
1159
|
-
* A numeric input field.
|
|
1160
|
-
*
|
|
1161
|
-
* @typeParam N - The field name (string literal type)
|
|
1162
|
-
*
|
|
1163
|
-
* @public
|
|
1164
|
-
*/
|
|
1165
|
-
declare interface NumberField_2<N extends string> {
|
|
1166
|
-
/** Type discriminator for form elements */
|
|
1167
|
-
readonly _type: "field";
|
|
1168
|
-
/** Field type discriminator - identifies this as a number field */
|
|
1169
|
-
readonly _field: "number";
|
|
1170
|
-
/** Unique field identifier used as the schema key */
|
|
1171
|
-
readonly name: N;
|
|
1172
|
-
/** Display label for the field */
|
|
1173
|
-
readonly label?: string;
|
|
1174
|
-
/** Minimum allowed value */
|
|
1175
|
-
readonly min?: number;
|
|
1176
|
-
/** Maximum allowed value */
|
|
1177
|
-
readonly max?: number;
|
|
1178
|
-
/** Whether this field is required for form submission */
|
|
1179
|
-
readonly required?: boolean;
|
|
1180
|
-
/** Value must be a multiple of this number (use 1 for integer semantics) */
|
|
1181
|
-
readonly multipleOf?: number;
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
916
|
/**
|
|
1185
917
|
* An object field containing nested properties.
|
|
1186
918
|
*
|
|
@@ -1206,31 +938,6 @@ export declare interface ObjectField<N extends string, Properties extends readon
|
|
|
1206
938
|
readonly required?: boolean;
|
|
1207
939
|
}
|
|
1208
940
|
|
|
1209
|
-
/**
|
|
1210
|
-
* An object field containing nested properties.
|
|
1211
|
-
*
|
|
1212
|
-
* Use this for grouping related fields under a single key in the schema.
|
|
1213
|
-
*
|
|
1214
|
-
* @typeParam N - The field name (string literal type)
|
|
1215
|
-
* @typeParam Properties - The form elements that define the object's properties
|
|
1216
|
-
*
|
|
1217
|
-
* @public
|
|
1218
|
-
*/
|
|
1219
|
-
declare interface ObjectField_2<N extends string, Properties extends readonly FormElement_2[]> {
|
|
1220
|
-
/** Type discriminator for form elements */
|
|
1221
|
-
readonly _type: "field";
|
|
1222
|
-
/** Field type discriminator - identifies this as an object field */
|
|
1223
|
-
readonly _field: "object";
|
|
1224
|
-
/** Unique field identifier used as the schema key */
|
|
1225
|
-
readonly name: N;
|
|
1226
|
-
/** Form elements that define the properties of this object */
|
|
1227
|
-
readonly properties: Properties;
|
|
1228
|
-
/** Display label for the field */
|
|
1229
|
-
readonly label?: string;
|
|
1230
|
-
/** Whether this field is required for form submission */
|
|
1231
|
-
readonly required?: boolean;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
941
|
/**
|
|
1235
942
|
* Union of all predicate types.
|
|
1236
943
|
*
|
|
@@ -1295,7 +1002,9 @@ export declare type ResolverSourcesForForm<E extends readonly FormElement[]> = E
|
|
|
1295
1002
|
* @public
|
|
1296
1003
|
*/
|
|
1297
1004
|
export declare interface Rule {
|
|
1005
|
+
/** UI effect to apply when the rule condition matches. */
|
|
1298
1006
|
readonly effect: RuleEffect;
|
|
1007
|
+
/** Predicate that controls when the UI effect applies. */
|
|
1299
1008
|
readonly condition: SchemaBasedCondition;
|
|
1300
1009
|
}
|
|
1301
1010
|
|
|
@@ -1305,17 +1014,29 @@ export declare interface Rule {
|
|
|
1305
1014
|
* @public
|
|
1306
1015
|
*/
|
|
1307
1016
|
export declare interface RuleConditionSchema {
|
|
1017
|
+
/** Literal value the condition schema must equal. */
|
|
1308
1018
|
const?: unknown;
|
|
1019
|
+
/** Allowed values for the condition schema. */
|
|
1309
1020
|
enum?: readonly unknown[];
|
|
1021
|
+
/** JSON Schema type required by the condition schema. */
|
|
1310
1022
|
type?: string;
|
|
1023
|
+
/** Negated branch of the condition schema. */
|
|
1311
1024
|
not?: RuleConditionSchema;
|
|
1025
|
+
/** Inclusive numeric lower bound in the condition schema. */
|
|
1312
1026
|
minimum?: number;
|
|
1027
|
+
/** Inclusive numeric upper bound in the condition schema. */
|
|
1313
1028
|
maximum?: number;
|
|
1029
|
+
/** Exclusive numeric lower bound in the condition schema. */
|
|
1314
1030
|
exclusiveMinimum?: number;
|
|
1031
|
+
/** Exclusive numeric upper bound in the condition schema. */
|
|
1315
1032
|
exclusiveMaximum?: number;
|
|
1033
|
+
/** Inclusive minimum string length in the condition schema. */
|
|
1316
1034
|
minLength?: number;
|
|
1035
|
+
/** Nested property conditions keyed by property name. */
|
|
1317
1036
|
properties?: Record<string, RuleConditionSchema>;
|
|
1037
|
+
/** Property names that must be present for the condition to match. */
|
|
1318
1038
|
required?: string[];
|
|
1039
|
+
/** Schemas that must all match for the condition to succeed. */
|
|
1319
1040
|
allOf?: RuleConditionSchema[];
|
|
1320
1041
|
}
|
|
1321
1042
|
|
|
@@ -1340,7 +1061,9 @@ export declare type RuleEffect = "SHOW" | "HIDE" | "ENABLE" | "DISABLE";
|
|
|
1340
1061
|
* @public
|
|
1341
1062
|
*/
|
|
1342
1063
|
export declare interface SchemaBasedCondition {
|
|
1064
|
+
/** JSON Pointer scope the rule evaluates against. */
|
|
1343
1065
|
readonly scope: string;
|
|
1066
|
+
/** JSON Schema fragment evaluated at the scoped location. */
|
|
1344
1067
|
readonly schema: RuleConditionSchema;
|
|
1345
1068
|
}
|
|
1346
1069
|
|
|
@@ -1369,31 +1092,6 @@ export declare interface StaticEnumField<N extends string, O extends readonly En
|
|
|
1369
1092
|
readonly required?: boolean;
|
|
1370
1093
|
}
|
|
1371
1094
|
|
|
1372
|
-
/**
|
|
1373
|
-
* A field with static enum options (known at compile time).
|
|
1374
|
-
*
|
|
1375
|
-
* Options can be plain strings or objects with `id` and `label` properties.
|
|
1376
|
-
*
|
|
1377
|
-
* @typeParam N - The field name (string literal type)
|
|
1378
|
-
* @typeParam O - Tuple of option values (strings or EnumOption objects)
|
|
1379
|
-
*
|
|
1380
|
-
* @public
|
|
1381
|
-
*/
|
|
1382
|
-
declare interface StaticEnumField_2<N extends string, O extends readonly EnumOptionValue_2[]> {
|
|
1383
|
-
/** Type discriminator for form elements */
|
|
1384
|
-
readonly _type: "field";
|
|
1385
|
-
/** Field type discriminator - identifies this as an enum field */
|
|
1386
|
-
readonly _field: "enum";
|
|
1387
|
-
/** Unique field identifier used as the schema key */
|
|
1388
|
-
readonly name: N;
|
|
1389
|
-
/** Array of allowed option values */
|
|
1390
|
-
readonly options: O;
|
|
1391
|
-
/** Display label for the field */
|
|
1392
|
-
readonly label?: string;
|
|
1393
|
-
/** Whether this field is required for form submission */
|
|
1394
|
-
readonly required?: boolean;
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
1095
|
/**
|
|
1398
1096
|
* Form element type definitions.
|
|
1399
1097
|
*
|
|
@@ -1428,40 +1126,6 @@ export declare interface TextField<N extends string> {
|
|
|
1428
1126
|
readonly pattern?: string;
|
|
1429
1127
|
}
|
|
1430
1128
|
|
|
1431
|
-
/**
|
|
1432
|
-
* Form element type definitions.
|
|
1433
|
-
*
|
|
1434
|
-
* These types define the structure of form specifications.
|
|
1435
|
-
* The structure IS the definition - nesting implies layout and conditional logic.
|
|
1436
|
-
*/
|
|
1437
|
-
/**
|
|
1438
|
-
* A text input field.
|
|
1439
|
-
*
|
|
1440
|
-
* @typeParam N - The field name (string literal type)
|
|
1441
|
-
*
|
|
1442
|
-
* @public
|
|
1443
|
-
*/
|
|
1444
|
-
declare interface TextField_2<N extends string> {
|
|
1445
|
-
/** Type discriminator for form elements */
|
|
1446
|
-
readonly _type: "field";
|
|
1447
|
-
/** Field type discriminator - identifies this as a text field */
|
|
1448
|
-
readonly _field: "text";
|
|
1449
|
-
/** Unique field identifier used as the schema key */
|
|
1450
|
-
readonly name: N;
|
|
1451
|
-
/** Display label for the field */
|
|
1452
|
-
readonly label?: string;
|
|
1453
|
-
/** Placeholder text shown when field is empty */
|
|
1454
|
-
readonly placeholder?: string;
|
|
1455
|
-
/** Whether this field is required for form submission */
|
|
1456
|
-
readonly required?: boolean;
|
|
1457
|
-
/** Minimum string length */
|
|
1458
|
-
readonly minLength?: number;
|
|
1459
|
-
/** Maximum string length */
|
|
1460
|
-
readonly maxLength?: number;
|
|
1461
|
-
/** Regular expression pattern the value must match */
|
|
1462
|
-
readonly pattern?: string;
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
1129
|
/**
|
|
1466
1130
|
* Root UI Schema (always a layout — not a Control, Category, or Label).
|
|
1467
1131
|
*
|
|
@@ -1477,40 +1141,11 @@ export declare type UISchema = VerticalLayout | HorizontalLayout | GroupLayout |
|
|
|
1477
1141
|
export declare type UISchemaElement = ControlElement | VerticalLayout | HorizontalLayout | GroupLayout | Categorization | Category | LabelElement;
|
|
1478
1142
|
|
|
1479
1143
|
/**
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
1482
|
-
* @public
|
|
1483
|
-
*/
|
|
1484
|
-
export declare type UISchemaElementType = "Control" | "VerticalLayout" | "HorizontalLayout" | "Group" | "Categorization" | "Category" | "Label";
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* Validates a form specification for common issues.
|
|
1488
|
-
*
|
|
1489
|
-
* Checks for:
|
|
1490
|
-
* - Duplicate field names at the root level (warning)
|
|
1491
|
-
* - References to non-existent fields in conditionals (error)
|
|
1492
|
-
*
|
|
1493
|
-
* @example
|
|
1494
|
-
* ```typescript
|
|
1495
|
-
* const form = formspec(
|
|
1496
|
-
* field.text("name"),
|
|
1497
|
-
* field.text("name"), // Duplicate!
|
|
1498
|
-
* when("nonExistent", "value", // Reference to non-existent field!
|
|
1499
|
-
* field.text("extra"),
|
|
1500
|
-
* ),
|
|
1501
|
-
* );
|
|
1502
|
-
*
|
|
1503
|
-
* const result = validateForm(form.elements);
|
|
1504
|
-
* // result.valid === false
|
|
1505
|
-
* // result.issues contains duplicate and reference errors
|
|
1506
|
-
* ```
|
|
1507
|
-
*
|
|
1508
|
-
* @param elements - The form elements to validate
|
|
1509
|
-
* @returns Validation result with any issues found
|
|
1144
|
+
* Validates a list of form elements for duplicate names and structural issues.
|
|
1510
1145
|
*
|
|
1511
1146
|
* @public
|
|
1512
1147
|
*/
|
|
1513
|
-
export declare function validateForm(elements: readonly
|
|
1148
|
+
export declare function validateForm(elements: readonly FormElement[]): ValidationResult;
|
|
1514
1149
|
|
|
1515
1150
|
/**
|
|
1516
1151
|
* A validation issue found in a form specification.
|
|
@@ -1562,10 +1197,15 @@ export declare type Validity = "valid" | "invalid" | "unknown";
|
|
|
1562
1197
|
* @public
|
|
1563
1198
|
*/
|
|
1564
1199
|
export declare interface VerticalLayout {
|
|
1200
|
+
/** Discriminator identifying a vertical layout container. */
|
|
1565
1201
|
readonly type: "VerticalLayout";
|
|
1202
|
+
/** Child elements rendered in vertical order. */
|
|
1566
1203
|
readonly elements: UISchemaElement[];
|
|
1204
|
+
/** Optional rule controlling visibility or enablement. */
|
|
1567
1205
|
readonly rule?: Rule | undefined;
|
|
1206
|
+
/** Renderer-specific layout options. */
|
|
1568
1207
|
readonly options?: Record<string, unknown> | undefined;
|
|
1208
|
+
/** Additional renderer-specific extension properties. */
|
|
1569
1209
|
readonly [k: string]: unknown;
|
|
1570
1210
|
}
|
|
1571
1211
|
|