@ng-forge/dynamic-forms 0.1.0 → 0.1.2
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/README.md +33 -0
- package/fesm2022/{ng-forge-dynamic-forms-ng-forge-dynamic-forms--Qgd-rJE.mjs → ng-forge-dynamic-forms-ng-forge-dynamic-forms-BWj75LVN.mjs} +250 -251
- package/fesm2022/{ng-forge-dynamic-forms-ng-forge-dynamic-forms--Qgd-rJE.mjs.map → ng-forge-dynamic-forms-ng-forge-dynamic-forms-BWj75LVN.mjs.map} +1 -1
- package/fesm2022/{ng-forge-dynamic-forms-page-field.component-DcZh9mv6.mjs → ng-forge-dynamic-forms-page-field.component-ZVrJUMNb.mjs} +29 -20
- package/fesm2022/{ng-forge-dynamic-forms-page-field.component-DcZh9mv6.mjs.map → ng-forge-dynamic-forms-page-field.component-ZVrJUMNb.mjs.map} +1 -1
- package/fesm2022/{ng-forge-dynamic-forms-text-field.component-CnLc464X.mjs → ng-forge-dynamic-forms-text-field.component-BKTbxAKn.mjs} +12 -12
- package/fesm2022/{ng-forge-dynamic-forms-text-field.component-CnLc464X.mjs.map → ng-forge-dynamic-forms-text-field.component-BKTbxAKn.mjs.map} +1 -1
- package/fesm2022/ng-forge-dynamic-forms.mjs +1 -1
- package/package.json +12 -6
- package/types/ng-forge-dynamic-forms.d.ts +165 -142
|
@@ -654,6 +654,57 @@ type RegisteredFieldTypes = ContainerFieldTypes | LeafFieldTypes;
|
|
|
654
654
|
* Extract field types that are available in the registry
|
|
655
655
|
*/
|
|
656
656
|
type AvailableFieldTypes = keyof DynamicFormFieldRegistry['containers'] | keyof DynamicFormFieldRegistry['leaves'];
|
|
657
|
+
/**
|
|
658
|
+
* Combined registry mapping type names to field definitions.
|
|
659
|
+
* This flattens containers and leaves into a single mapping.
|
|
660
|
+
*/
|
|
661
|
+
type FieldTypeMap = DynamicFormFieldRegistry['containers'] & DynamicFormFieldRegistry['leaves'];
|
|
662
|
+
/**
|
|
663
|
+
* Extract a specific field type from RegisteredFieldTypes based on the `type` discriminant.
|
|
664
|
+
* This enables proper type narrowing when defining fields.
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```typescript
|
|
668
|
+
* // Extract a specific field type
|
|
669
|
+
* type MyInputField = ExtractField<'input'>;
|
|
670
|
+
*
|
|
671
|
+
* // Use in field definitions for proper props inference
|
|
672
|
+
* const field: ExtractField<'input'> = {
|
|
673
|
+
* type: 'input',
|
|
674
|
+
* key: 'email',
|
|
675
|
+
* value: '',
|
|
676
|
+
* props: { type: 'email' } // Only input props allowed here
|
|
677
|
+
* };
|
|
678
|
+
* ```
|
|
679
|
+
*/
|
|
680
|
+
type ExtractField<T extends AvailableFieldTypes> = T extends keyof FieldTypeMap ? FieldTypeMap[T] : never;
|
|
681
|
+
/**
|
|
682
|
+
* Narrow a field definition based on its `type` property.
|
|
683
|
+
* Use this to get proper type inference when working with field unions.
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* ```typescript
|
|
687
|
+
* function processField<T extends RegisteredFieldTypes>(field: T): NarrowField<T> {
|
|
688
|
+
* return field as NarrowField<T>;
|
|
689
|
+
* }
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
type NarrowField<T> = T extends {
|
|
693
|
+
type: infer TType;
|
|
694
|
+
} ? (TType extends AvailableFieldTypes ? ExtractField<TType> : T) : T;
|
|
695
|
+
/**
|
|
696
|
+
* Narrow each field in an array based on its `type` property.
|
|
697
|
+
* Use with `satisfies` to get proper type inference for field arrays.
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```typescript
|
|
701
|
+
* const fields = [
|
|
702
|
+
* { type: 'input', key: 'name', value: '', props: { type: 'text' } },
|
|
703
|
+
* { type: 'select', key: 'country', value: 'us', options: [...] },
|
|
704
|
+
* ] as const satisfies NarrowFields;
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
type NarrowFields = readonly NarrowField<RegisteredFieldTypes>[];
|
|
657
708
|
|
|
658
709
|
/**
|
|
659
710
|
* Helper type to convert union to intersection
|
|
@@ -664,27 +715,49 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
|
664
715
|
* Depth counter for recursion limiting (prevents infinite type instantiation)
|
|
665
716
|
*/
|
|
666
717
|
type Depth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
718
|
+
/**
|
|
719
|
+
* Widens literal types to their primitive equivalents.
|
|
720
|
+
* This prevents `as const` from over-narrowing types like `''` to literal `''` instead of `string`.
|
|
721
|
+
*
|
|
722
|
+
* @example
|
|
723
|
+
* ```typescript
|
|
724
|
+
* type A = Widen<''>; // string
|
|
725
|
+
* type B = Widen<false>; // boolean
|
|
726
|
+
* type C = Widen<42>; // number
|
|
727
|
+
* type D = Widen<string[]>; // string[]
|
|
728
|
+
* ```
|
|
729
|
+
*/
|
|
730
|
+
type Widen<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
731
|
+
/**
|
|
732
|
+
* Infer value type based on field type and props.
|
|
733
|
+
* - Slider fields: always number
|
|
734
|
+
* - Input fields with props.type: 'number': number
|
|
735
|
+
* - Other fields: widen the literal value type
|
|
736
|
+
*/
|
|
737
|
+
type InferValueType<T, V> = T extends {
|
|
738
|
+
type: 'slider';
|
|
739
|
+
} ? number : T extends {
|
|
740
|
+
type: 'input';
|
|
741
|
+
props: {
|
|
742
|
+
type: 'number';
|
|
743
|
+
};
|
|
744
|
+
} ? number : Widen<V>;
|
|
745
|
+
/** Make type optional if field is not required */
|
|
746
|
+
type MaybeOptional<T, V> = T extends {
|
|
747
|
+
required: true;
|
|
748
|
+
} ? V : V | undefined;
|
|
667
749
|
/**
|
|
668
750
|
* Process a single field and determine its contribution to the form value type
|
|
669
|
-
* Handles:
|
|
670
|
-
* - Page fields: flatten children (valueHandling: 'flatten')
|
|
671
|
-
* - Row fields: flatten children (valueHandling: 'flatten')
|
|
672
|
-
* - Group fields: nest children under group key (valueHandling: 'include')
|
|
673
|
-
* - Text fields: exclude from values (valueHandling: 'exclude')
|
|
674
|
-
* - Value fields: include with their key and value type
|
|
675
751
|
*/
|
|
676
752
|
type ProcessField<T, D extends number = 5> = [D] extends [never] ? Record<string, unknown> : T extends {
|
|
677
|
-
type: 'page';
|
|
678
|
-
fields: infer
|
|
679
|
-
} ?
|
|
680
|
-
type: 'row';
|
|
681
|
-
fields: infer TFields;
|
|
682
|
-
} ? TFields extends RegisteredFieldTypes[] ? InferFormValueWithDepth<TFields, Depth[D]> : never : T extends {
|
|
753
|
+
type: 'page' | 'row';
|
|
754
|
+
fields: infer F;
|
|
755
|
+
} ? F extends RegisteredFieldTypes[] ? InferFormValueWithDepth<F, Depth[D]> : never : T extends {
|
|
683
756
|
type: 'group';
|
|
684
757
|
key: infer K;
|
|
685
|
-
fields: infer
|
|
686
|
-
} ? K extends string ?
|
|
687
|
-
[P in K]: InferFormValueWithDepth<
|
|
758
|
+
fields: infer F;
|
|
759
|
+
} ? K extends string ? F extends RegisteredFieldTypes[] ? {
|
|
760
|
+
[P in K]: InferFormValueWithDepth<F, Depth[D]>;
|
|
688
761
|
} : {
|
|
689
762
|
[P in K]: Record<string, unknown>;
|
|
690
763
|
} : never : T extends {
|
|
@@ -692,39 +765,46 @@ type ProcessField<T, D extends number = 5> = [D] extends [never] ? Record<string
|
|
|
692
765
|
} ? never : T extends {
|
|
693
766
|
key: infer K;
|
|
694
767
|
value: infer V;
|
|
695
|
-
required: true;
|
|
696
|
-
} ? K extends string ? {
|
|
697
|
-
[P in K]: V;
|
|
698
|
-
} : never : T extends {
|
|
699
|
-
key: infer K;
|
|
700
|
-
value: infer V;
|
|
701
768
|
} ? K extends string ? {
|
|
702
|
-
[P in K]:
|
|
769
|
+
[P in K]: MaybeOptional<T, InferValueType<T, V>>;
|
|
703
770
|
} : never : never;
|
|
704
771
|
/**
|
|
705
772
|
* Internal helper with depth tracking
|
|
706
773
|
*/
|
|
707
774
|
type InferFormValueWithDepth<T extends RegisteredFieldTypes[], D extends number = 5> = UnionToIntersection<ProcessField<T[number], D>>;
|
|
708
775
|
/**
|
|
709
|
-
*
|
|
710
|
-
|
|
711
|
-
|
|
776
|
+
* Helper to extract fields from either fields array or FormConfig
|
|
777
|
+
*/
|
|
778
|
+
type ExtractFields<T> = T extends {
|
|
779
|
+
fields: infer TFields;
|
|
780
|
+
} ? TFields extends readonly RegisteredFieldTypes[] ? TFields : never : T extends readonly RegisteredFieldTypes[] ? T : never;
|
|
781
|
+
/**
|
|
782
|
+
* Infer form value type from fields array or FormConfig.
|
|
783
|
+
* Recursively processes nested structures and merges the results.
|
|
784
|
+
* Limited to 5 levels of nesting to prevent infinite type instantiation.
|
|
712
785
|
*
|
|
713
786
|
* @example
|
|
714
787
|
* ```typescript
|
|
788
|
+
* // From fields array
|
|
715
789
|
* const fields = [
|
|
716
790
|
* { type: 'input', key: 'email', value: '', required: true },
|
|
717
|
-
* { type: '
|
|
718
|
-
* { type: 'input', key: 'street', value: '' },
|
|
719
|
-
* { type: 'input', key: 'city', value: '' }
|
|
720
|
-
* ]}
|
|
791
|
+
* { type: 'input', key: 'name', value: '' }
|
|
721
792
|
* ] as const;
|
|
793
|
+
* type FieldsValue = InferFormValue<typeof fields>;
|
|
794
|
+
*
|
|
795
|
+
* // From FormConfig
|
|
796
|
+
* const config = {
|
|
797
|
+
* fields: [
|
|
798
|
+
* { type: 'input', key: 'email', value: '', required: true },
|
|
799
|
+
* { type: 'input', key: 'name', value: '' }
|
|
800
|
+
* ]
|
|
801
|
+
* } as const satisfies FormConfig;
|
|
802
|
+
* type ConfigValue = InferFormValue<typeof config>;
|
|
722
803
|
*
|
|
723
|
-
*
|
|
724
|
-
* // Result: { email: string; address: { street?: string; city?: string } }
|
|
804
|
+
* // Result: { email: string; name?: string }
|
|
725
805
|
* ```
|
|
726
806
|
*/
|
|
727
|
-
type InferFormValue$1<T extends RegisteredFieldTypes[]
|
|
807
|
+
type InferFormValue$1<T> = ExtractFields<T> extends readonly RegisteredFieldTypes[] ? InferFormValueWithDepth<ExtractFields<T> extends RegisteredFieldTypes[] ? ExtractFields<T> : [...ExtractFields<T>], 5> : never;
|
|
728
808
|
|
|
729
809
|
/**
|
|
730
810
|
* Base configuration shared by all validators
|
|
@@ -1290,19 +1370,18 @@ interface SubmissionConfig<TValue = unknown> {
|
|
|
1290
1370
|
*
|
|
1291
1371
|
* @example
|
|
1292
1372
|
* ```typescript
|
|
1293
|
-
* const formConfig
|
|
1373
|
+
* const formConfig = {
|
|
1294
1374
|
* fields: [
|
|
1295
|
-
* { type: 'input', key: 'email', value: '', label: 'Email', required: true
|
|
1375
|
+
* { type: 'input', key: 'email', value: '', label: 'Email', required: true },
|
|
1296
1376
|
* { type: 'group', key: 'address', label: 'Address', fields: [
|
|
1297
1377
|
* { type: 'input', key: 'street', value: '', label: 'Street' },
|
|
1298
1378
|
* { type: 'input', key: 'city', value: '', label: 'City' }
|
|
1299
1379
|
* ]},
|
|
1300
|
-
* { type: 'button', key: 'submit', label: 'Submit', buttonType: 'submit' }
|
|
1301
1380
|
* ],
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1381
|
+
* } as const satisfies FormConfig;
|
|
1382
|
+
*
|
|
1383
|
+
* // Infer form value type from config
|
|
1384
|
+
* type FormValue = InferFormValue<typeof formConfig>;
|
|
1306
1385
|
* ```
|
|
1307
1386
|
*
|
|
1308
1387
|
* @typeParam TFields - Array of registered field types available for this form
|
|
@@ -1310,7 +1389,7 @@ interface SubmissionConfig<TValue = unknown> {
|
|
|
1310
1389
|
*
|
|
1311
1390
|
* @public
|
|
1312
1391
|
*/
|
|
1313
|
-
interface FormConfig<TFields extends RegisteredFieldTypes[] = RegisteredFieldTypes[], TValue = InferFormValue$1<TFields>> {
|
|
1392
|
+
interface FormConfig<TFields extends NarrowFields | RegisteredFieldTypes[] = RegisteredFieldTypes[], TValue = InferFormValue$1<TFields extends readonly RegisteredFieldTypes[] ? TFields : RegisteredFieldTypes[]>> {
|
|
1314
1393
|
/**
|
|
1315
1394
|
* Array of field definitions that define the form structure.
|
|
1316
1395
|
*
|
|
@@ -2151,11 +2230,6 @@ declare class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFie
|
|
|
2151
2230
|
readonly disabled: Signal<boolean>;
|
|
2152
2231
|
/** Whether the form is currently submitting. */
|
|
2153
2232
|
readonly submitting: Signal<boolean>;
|
|
2154
|
-
/**
|
|
2155
|
-
* Announcement message for screen readers.
|
|
2156
|
-
* Updates when form submission fails due to validation errors.
|
|
2157
|
-
*/
|
|
2158
|
-
readonly errorAnnouncement: _angular_core.WritableSignal<string>;
|
|
2159
2233
|
readonly initialized$: rxjs.Observable<boolean>;
|
|
2160
2234
|
/** Emits when form validity changes. */
|
|
2161
2235
|
readonly validityChange: _angular_core.OutputRef<boolean>;
|
|
@@ -2182,18 +2256,7 @@ declare class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFie
|
|
|
2182
2256
|
/** Emits when page navigation state changes (canGoNext, canGoPrevious, etc.). */
|
|
2183
2257
|
readonly onPageNavigationStateChange: _angular_core.OutputRef<PageNavigationStateChangeEvent>;
|
|
2184
2258
|
protected readonly resolvedFields: Signal<ResolvedField[]>;
|
|
2185
|
-
|
|
2186
|
-
private readonly clearErrorsOnConfigChange;
|
|
2187
|
-
private readonly emitPagedFormInitialized;
|
|
2188
|
-
private readonly emitNonPagedFormInitialized;
|
|
2189
|
-
private readonly handleFormReset;
|
|
2190
|
-
private readonly handleFormClear;
|
|
2191
|
-
/**
|
|
2192
|
-
* Announces form validation errors to screen readers when submission is attempted
|
|
2193
|
-
* on an invalid form.
|
|
2194
|
-
*/
|
|
2195
|
-
private readonly handleErrorAnnouncement;
|
|
2196
|
-
private readonly handleSubmission;
|
|
2259
|
+
constructor();
|
|
2197
2260
|
/**
|
|
2198
2261
|
* Handles native form submission triggered by:
|
|
2199
2262
|
* - Pressing Enter in an input field
|
|
@@ -2206,16 +2269,13 @@ declare class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFie
|
|
|
2206
2269
|
* @param event - The native submit event from the form element
|
|
2207
2270
|
*/
|
|
2208
2271
|
protected onNativeSubmit(event: Event): void;
|
|
2272
|
+
private setupEffects;
|
|
2273
|
+
private setupEventHandlers;
|
|
2209
2274
|
private registerValidatorsFromConfig;
|
|
2210
2275
|
private createFormSetupFromConfig;
|
|
2211
2276
|
private createEmptyFormSetup;
|
|
2212
2277
|
private onFormReset;
|
|
2213
2278
|
private onFormClear;
|
|
2214
|
-
/**
|
|
2215
|
-
* Counts the total number of validation errors across all fields.
|
|
2216
|
-
* Used for screen reader announcements.
|
|
2217
|
-
*/
|
|
2218
|
-
private countErrors;
|
|
2219
2279
|
ngOnDestroy(): void;
|
|
2220
2280
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DynamicForm<any, any>, never>;
|
|
2221
2281
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DynamicForm<any, any>, "form[dynamic-form]", never, { "config": { "alias": "dynamic-form"; "required": true; "isSignal": true; }; "formOptions": { "alias": "formOptions"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "validityChange": "validityChange"; "dirtyChange": "dirtyChange"; "submitted": "submitted"; "reset": "reset"; "cleared": "cleared"; "events": "events"; "initialized": "initialized"; "onPageChange": "onPageChange"; "onPageNavigationStateChange": "onPageNavigationStateChange"; }, never, never, true, never>;
|
|
@@ -2528,51 +2588,48 @@ interface InputProps<T extends InputType = InputType> {
|
|
|
2528
2588
|
type?: T;
|
|
2529
2589
|
placeholder?: DynamicText;
|
|
2530
2590
|
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Input types that produce string values
|
|
2593
|
+
*/
|
|
2594
|
+
type StringInputType = Exclude<InputType, 'number'>;
|
|
2531
2595
|
/**
|
|
2532
2596
|
* Number input field with strict number value type.
|
|
2533
2597
|
* When props.type is 'number', value must be number.
|
|
2598
|
+
* Props is REQUIRED and must include type: 'number'.
|
|
2534
2599
|
*/
|
|
2535
2600
|
interface NumberInputField<TProps extends {
|
|
2536
2601
|
type?: string;
|
|
2537
|
-
} = {
|
|
2602
|
+
} = InputProps> extends BaseValueField<TProps & {
|
|
2538
2603
|
type: 'number';
|
|
2539
|
-
|
|
2540
|
-
}> extends BaseValueField<TProps, number> {
|
|
2604
|
+
}, number> {
|
|
2541
2605
|
type: 'input';
|
|
2542
|
-
props
|
|
2606
|
+
props: TProps & {
|
|
2607
|
+
type: 'number';
|
|
2608
|
+
};
|
|
2543
2609
|
}
|
|
2544
2610
|
/**
|
|
2545
2611
|
* String input field with strict string value type.
|
|
2546
|
-
* When props.type is text/email/etc, value must be string.
|
|
2612
|
+
* When props.type is text/email/etc (or undefined), value must be string.
|
|
2613
|
+
* Props type cannot be 'number'.
|
|
2547
2614
|
*/
|
|
2548
2615
|
interface StringInputField<TProps extends {
|
|
2549
2616
|
type?: string;
|
|
2550
|
-
} = {
|
|
2551
|
-
type
|
|
2552
|
-
|
|
2553
|
-
}> extends BaseValueField<TProps, string> {
|
|
2554
|
-
type: 'input';
|
|
2555
|
-
props?: TProps;
|
|
2556
|
-
}
|
|
2557
|
-
/**
|
|
2558
|
-
* Helper type to extract the input type from props
|
|
2559
|
-
*/
|
|
2560
|
-
type ExtractInputType<TProps> = TProps extends {
|
|
2561
|
-
type?: infer T;
|
|
2562
|
-
} ? T : InputType;
|
|
2563
|
-
/**
|
|
2564
|
-
* Fallback variant when props is undefined - allows both string and number values
|
|
2565
|
-
*/
|
|
2566
|
-
interface UndefinedPropsInputField extends BaseValueField<undefined, string | number> {
|
|
2617
|
+
} = InputProps> extends BaseValueField<TProps & {
|
|
2618
|
+
type?: StringInputType;
|
|
2619
|
+
}, string> {
|
|
2567
2620
|
type: 'input';
|
|
2568
|
-
props?:
|
|
2621
|
+
props?: TProps & {
|
|
2622
|
+
type?: StringInputType;
|
|
2623
|
+
};
|
|
2569
2624
|
}
|
|
2570
2625
|
/**
|
|
2571
|
-
* Builds discriminated union
|
|
2626
|
+
* Builds discriminated union where props.type determines value type.
|
|
2627
|
+
* - If props.type is 'number', only NumberInputField matches (value: number)
|
|
2628
|
+
* - If props.type is undefined/text/email/etc, only StringInputField matches (value: string)
|
|
2572
2629
|
*/
|
|
2573
2630
|
type BuildInputFieldUnion<TProps extends {
|
|
2574
2631
|
type?: string;
|
|
2575
|
-
}> =
|
|
2632
|
+
}> = NumberInputField<TProps> | StringInputField<TProps>;
|
|
2576
2633
|
/**
|
|
2577
2634
|
* Input field with automatic type-safe value inference.
|
|
2578
2635
|
* TypeScript automatically infers the correct value type based on props.type.
|
|
@@ -3104,62 +3161,26 @@ interface ResolvedError {
|
|
|
3104
3161
|
*/
|
|
3105
3162
|
declare function createResolvedErrorsSignal<T>(field: Signal<FieldTree<T>>, validationMessages: Signal<ValidationMessages | undefined>, defaultValidationMessages?: Signal<ValidationMessages | undefined>, injector?: Injector): Signal<ResolvedError[]>;
|
|
3106
3163
|
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
* Used to access:
|
|
3114
|
-
* - `structure.childrenMap()` - Map of child field keys to their FieldTree instances
|
|
3115
|
-
* - `fieldProxy` - The FieldTree proxy for a FieldNode
|
|
3116
|
-
*/
|
|
3164
|
+
interface ChildData {
|
|
3165
|
+
reader: FieldTree<unknown>;
|
|
3166
|
+
}
|
|
3167
|
+
interface ChildrenData {
|
|
3168
|
+
byPropertyKey: Map<string, ChildData>;
|
|
3169
|
+
}
|
|
3117
3170
|
interface FormInternals<T = unknown> {
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
* Present on forms created via `form()` function.
|
|
3121
|
-
*/
|
|
3122
|
-
structure?: {
|
|
3123
|
-
/**
|
|
3124
|
-
* Returns a Map of child field keys to their FieldTree instances.
|
|
3125
|
-
* Keys are strings for object properties or stringified indices for arrays.
|
|
3126
|
-
*/
|
|
3127
|
-
childrenMap?: () => Map<string, FieldTree<unknown>>;
|
|
3171
|
+
structure: {
|
|
3172
|
+
childrenMap: () => ChildrenData;
|
|
3128
3173
|
};
|
|
3129
|
-
/**
|
|
3130
|
-
* The FieldTree proxy for navigating the form graph.
|
|
3131
|
-
* Present on FieldNode instances.
|
|
3132
|
-
*/
|
|
3133
3174
|
fieldProxy?: FieldTree<T>;
|
|
3134
3175
|
}
|
|
3176
|
+
type FormInput = FormInternals | Signal<FormInternals> | unknown;
|
|
3135
3177
|
/**
|
|
3136
|
-
* Type guard
|
|
3137
|
-
*
|
|
3138
|
-
* @param form - The form object to check
|
|
3139
|
-
* @returns True if the form has a structure property with childrenMap
|
|
3140
|
-
*/
|
|
3141
|
-
declare function hasFormStructure(form: unknown): form is FormInternals;
|
|
3142
|
-
/**
|
|
3143
|
-
* Safely retrieves the childrenMap from a form's internal structure.
|
|
3144
|
-
*
|
|
3145
|
-
* @param form - The form object (from `form()` function or FieldTree)
|
|
3146
|
-
* @returns The childrenMap or null if not available
|
|
3147
|
-
*/
|
|
3148
|
-
declare function getChildrenMap(form: unknown): Map<string, FieldTree<unknown>> | null;
|
|
3149
|
-
/**
|
|
3150
|
-
* Safely retrieves the fieldProxy from a form node.
|
|
3151
|
-
*
|
|
3152
|
-
* @param node - The form node (FieldNode or similar)
|
|
3153
|
-
* @returns The fieldProxy FieldTree or null if not available
|
|
3178
|
+
* Type guard that unwraps signals and checks for FormInternals structure.
|
|
3179
|
+
* Use this when the input might be a signal wrapping FormInternals.
|
|
3154
3180
|
*/
|
|
3181
|
+
declare function hasFormStructure(form: FormInput): form is FormInternals | Signal<FormInternals>;
|
|
3182
|
+
declare function getChildrenMap(form: FormInput): Map<string, FieldTree<unknown>> | null;
|
|
3155
3183
|
declare function getFieldProxy<T = unknown>(node: unknown): FieldTree<T> | null;
|
|
3156
|
-
/**
|
|
3157
|
-
* Retrieves a child FieldTree from a form by key.
|
|
3158
|
-
*
|
|
3159
|
-
* @param form - The parent form
|
|
3160
|
-
* @param key - The child field key
|
|
3161
|
-
* @returns The child FieldTree or null if not found
|
|
3162
|
-
*/
|
|
3163
3184
|
declare function getChildFieldTree(form: unknown, key: string): FieldTree<unknown> | null;
|
|
3164
3185
|
|
|
3165
3186
|
/**
|
|
@@ -3216,7 +3237,8 @@ declare class RowFieldComponent {
|
|
|
3216
3237
|
private readonly rawFieldRegistry;
|
|
3217
3238
|
private readonly fieldsSource;
|
|
3218
3239
|
protected readonly resolvedFields: _angular_core.Signal<ResolvedField[]>;
|
|
3219
|
-
|
|
3240
|
+
constructor();
|
|
3241
|
+
private setupEffects;
|
|
3220
3242
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RowFieldComponent, never>;
|
|
3221
3243
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RowFieldComponent, "div[row-field]", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "key": { "alias": "key"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3222
3244
|
}
|
|
@@ -3263,7 +3285,8 @@ declare class GroupFieldComponent<TModel = Record<string, unknown>> {
|
|
|
3263
3285
|
readonly submitted: _angular_core.OutputRef<SubmitEvent>;
|
|
3264
3286
|
private readonly fieldsSource;
|
|
3265
3287
|
protected readonly resolvedFields: _angular_core.Signal<ResolvedField[]>;
|
|
3266
|
-
|
|
3288
|
+
constructor();
|
|
3289
|
+
private setupEffects;
|
|
3267
3290
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<GroupFieldComponent<any>, never>;
|
|
3268
3291
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<GroupFieldComponent<any>, "fieldset[group-field]", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "key": { "alias": "key"; "required": true; "isSignal": true; }; }, { "validityChange": "validityChange"; "dirtyChange": "dirtyChange"; "submitted": "submitted"; }, never, never, true, never>;
|
|
3269
3292
|
}
|
|
@@ -3306,9 +3329,9 @@ declare class ArrayFieldComponent<TModel = Record<string, unknown>> {
|
|
|
3306
3329
|
private readonly updateVersion;
|
|
3307
3330
|
private readonly itemOrderSignal;
|
|
3308
3331
|
readonly resolvedItems: _angular_core.WritableSignal<ResolvedArrayItem[]>;
|
|
3309
|
-
|
|
3310
|
-
private
|
|
3311
|
-
private
|
|
3332
|
+
constructor();
|
|
3333
|
+
private setupEffects;
|
|
3334
|
+
private setupEventHandlers;
|
|
3312
3335
|
private performDifferentialUpdate;
|
|
3313
3336
|
private resolveAllItems;
|
|
3314
3337
|
private appendItems;
|
|
@@ -3459,4 +3482,4 @@ declare function injectFieldRegistry(): {
|
|
|
3459
3482
|
};
|
|
3460
3483
|
|
|
3461
3484
|
export { ARRAY_CONTEXT, AddArrayItemEvent, ArrayFieldComponent, BUILT_IN_FIELDS, DynamicForm, DynamicTextPipe, EventBus, FIELD_REGISTRY, FIELD_SIGNAL_CONTEXT, FormClearEvent, FormResetEvent, GroupFieldComponent, NextPageEvent, PageChangeEvent, PreviousPageEvent, RemoveArrayItemEvent, RowFieldComponent, SubmitEvent, applyValidator, applyValidators, arrayFieldMapper, baseFieldMapper, buildBaseInputs, checkboxFieldMapper, createResolvedErrorsSignal, datepickerFieldMapper, dynamicTextToObservable, getChildFieldTree, getChildrenMap, getFieldProxy, getFieldValueHandling, groupFieldMapper, hasFormStructure, injectFieldRegistry, isArrayField, isCheckedField, isContainerField, isDisplayOnlyField, isFormStateCondition, isGroupField, isLeafField, isPageField, isRowField, isValueBearingField, isValueField, optionsFieldMapper, pageFieldMapper, provideDynamicForm, resolveNextButtonDisabled, resolveSubmitButtonDisabled, resolveTokens, rowFieldMapper, shouldShowErrors, valueFieldMapper };
|
|
3462
|
-
export type { ArrayAllowedChildren, ArrayContext, ArrayField, ArrayItemContext, AsyncCustomValidator, AsyncValidatorConfig, AvailableFieldTypes, BaseCheckedField, BaseValidatorConfig, BaseValueField, BuiltInValidatorConfig, ButtonField, ButtonLogicContext, CheckboxField, CheckedFieldComponent, ConditionalExpression, ContainerFieldTypes, CustomFnConfig, CustomValidator, CustomValidatorConfig, DatepickerField, DatepickerProps, DynamicFormFieldRegistry, DynamicText, EvaluationContext, EventArgs, ExtractFieldDefs, ExtractFormValue, FieldComponent, FieldDef, FieldOption, FieldPathAccess, FieldRegistryContainers, FieldRegistryLeaves, FieldSignalContext, FieldTypeDefinition, FieldWithValidation, FormConfig, FormEvent, FormEventConstructor, FormInternals, FormMode, FormModeDetectionResult, FormOptions, FormStateCondition, GroupAllowedChildren, GroupField, HttpCustomValidator, HttpResourceRequest, HttpValidatorConfig, InferFormValue$1 as InferFormValue, InputField, InputProps, LeafFieldTypes, LogicConfig, MapperFn, MultiCheckboxField, NextButtonOptions, PageAllowedChildren, PageField, Prettify, RadioField, RegisteredFieldTypes, ResolvedError, RowAllowedChildren, RowField, SchemaApplicationConfig, SchemaDefinition, SelectField, SelectProps, SliderField, SubmissionActionResult, SubmissionConfig, SubmitButtonOptions, TextElementType, TextField, TextProps, TextareaField, TextareaProps, ToggleField, TokenContext, ValidationError, ValidationMessages, ValidatorConfig, ValueFieldComponent, ValueHandlingMode, ValueType, WithInputSignals };
|
|
3485
|
+
export type { ArrayAllowedChildren, ArrayContext, ArrayField, ArrayItemContext, AsyncCustomValidator, AsyncValidatorConfig, AvailableFieldTypes, BaseCheckedField, BaseValidatorConfig, BaseValueField, BuiltInValidatorConfig, ButtonField, ButtonLogicContext, CheckboxField, CheckedFieldComponent, ConditionalExpression, ContainerFieldTypes, CustomFnConfig, CustomValidator, CustomValidatorConfig, DatepickerField, DatepickerProps, DynamicFormFieldRegistry, DynamicText, EvaluationContext, EventArgs, ExtractField, ExtractFieldDefs, ExtractFormValue, FieldComponent, FieldDef, FieldOption, FieldPathAccess, FieldRegistryContainers, FieldRegistryLeaves, FieldSignalContext, FieldTypeDefinition, FieldWithValidation, FormConfig, FormEvent, FormEventConstructor, FormInternals, FormMode, FormModeDetectionResult, FormOptions, FormStateCondition, GroupAllowedChildren, GroupField, HttpCustomValidator, HttpResourceRequest, HttpValidatorConfig, InferFormValue$1 as InferFormValue, InputField, InputProps, LeafFieldTypes, LogicConfig, MapperFn, MultiCheckboxField, NarrowField, NarrowFields, NextButtonOptions, PageAllowedChildren, PageField, Prettify, RadioField, RegisteredFieldTypes, ResolvedError, RowAllowedChildren, RowField, SchemaApplicationConfig, SchemaDefinition, SelectField, SelectProps, SliderField, SubmissionActionResult, SubmissionConfig, SubmitButtonOptions, TextElementType, TextField, TextProps, TextareaField, TextareaProps, ToggleField, TokenContext, ValidationError, ValidationMessages, ValidatorConfig, ValueFieldComponent, ValueHandlingMode, ValueType, WithInputSignals };
|