ngx-vest-forms 2.3.1 → 2.4.0
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 +5 -0
- package/fesm2022/ngx-vest-forms.mjs +430 -257
- package/fesm2022/ngx-vest-forms.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-vest-forms.d.ts +94 -61
package/package.json
CHANGED
|
@@ -191,8 +191,10 @@ declare class FormErrorDisplayDirective {
|
|
|
191
191
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<FormErrorDisplayDirective, "[formErrorDisplay], [ngxErrorDisplay]", ["formErrorDisplay", "ngxErrorDisplay"], { "errorDisplayMode": { "alias": "errorDisplayMode"; "required": false; "isSignal": true; }; "warningDisplayMode": { "alias": "warningDisplayMode"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof FormControlStateDirective; inputs: {}; outputs: {}; }]>;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
type AriaAssociationMode = 'all-controls' | 'single-control' | 'none';
|
|
195
|
+
|
|
194
196
|
/**
|
|
195
|
-
* Accessible form control wrapper with WCAG 2.2 AA
|
|
197
|
+
* Accessible form control wrapper built with WCAG 2.2 AA considerations.
|
|
196
198
|
*
|
|
197
199
|
* Wrap form fields to automatically display validation errors, warnings, and pending states
|
|
198
200
|
* with proper accessibility attributes.
|
|
@@ -283,7 +285,7 @@ declare class FormErrorDisplayDirective {
|
|
|
283
285
|
* <ngx-control-wrapper>
|
|
284
286
|
* <input name="username" ngModel />
|
|
285
287
|
* </ngx-control-wrapper>
|
|
286
|
-
* /// If async validation is running for >
|
|
288
|
+
* /// If async validation is running for >500ms, a spinner and 'Validating…' will be shown.
|
|
287
289
|
* /// Once shown, the validation message stays visible for minimum 500ms to prevent flashing.
|
|
288
290
|
* /// If Vest warnings are present, they will be shown below errors.
|
|
289
291
|
*
|
|
@@ -292,13 +294,14 @@ declare class FormErrorDisplayDirective {
|
|
|
292
294
|
* import { NGX_ERROR_DISPLAY_MODE_TOKEN } from 'ngx-vest-forms';
|
|
293
295
|
* @Component({
|
|
294
296
|
* providers: [
|
|
295
|
-
* provide(NGX_ERROR_DISPLAY_MODE_TOKEN, { useValue: 'submit' })
|
|
297
|
+
* provide(NGX_ERROR_DISPLAY_MODE_TOKEN, { useValue: 'on-submit' })
|
|
296
298
|
* ]
|
|
297
299
|
* })
|
|
298
300
|
* export class MyComponent {}
|
|
299
301
|
*
|
|
300
302
|
* Best Practices:
|
|
301
|
-
* - Use for
|
|
303
|
+
* - Use for single-control wrappers.
|
|
304
|
+
* - For multi-control/group containers, prefer `ngx-form-group-wrapper`.
|
|
302
305
|
* - Do not manually display errors for individual fields; rely on this wrapper.
|
|
303
306
|
* - Validate with tools like Accessibility Insights and real screen reader testing.
|
|
304
307
|
*
|
|
@@ -323,7 +326,7 @@ declare class ControlWrapperComponent implements AfterContentInit, OnDestroy {
|
|
|
323
326
|
* across multiple child controls.
|
|
324
327
|
* - This does not affect whether messages render; it only affects ARIA wiring.
|
|
325
328
|
*/
|
|
326
|
-
readonly ariaAssociationMode: _angular_core.InputSignal<
|
|
329
|
+
readonly ariaAssociationMode: _angular_core.InputSignal<AriaAssociationMode>;
|
|
327
330
|
protected readonly uniqueId: string;
|
|
328
331
|
protected readonly errorId: string;
|
|
329
332
|
protected readonly warningId: string;
|
|
@@ -357,7 +360,6 @@ declare class ControlWrapperComponent implements AfterContentInit, OnDestroy {
|
|
|
357
360
|
* hint/help text associations.
|
|
358
361
|
*/
|
|
359
362
|
private readonly wrapperOwnedDescribedByIds;
|
|
360
|
-
private mergeAriaDescribedBy;
|
|
361
363
|
constructor();
|
|
362
364
|
ngAfterContentInit(): void;
|
|
363
365
|
ngOnDestroy(): void;
|
|
@@ -400,7 +402,7 @@ declare class FormGroupWrapperComponent {
|
|
|
400
402
|
*/
|
|
401
403
|
readonly describedByIds: _angular_core.Signal<string | null>;
|
|
402
404
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormGroupWrapperComponent, never>;
|
|
403
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormGroupWrapperComponent, "ngx-form-group-wrapper, sc-form-group-wrapper, [ngxFormGroupWrapper], [scFormGroupWrapper]
|
|
405
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormGroupWrapperComponent, "ngx-form-group-wrapper, sc-form-group-wrapper, [ngxFormGroupWrapper], [scFormGroupWrapper]", ["ngxFormGroupWrapper"], { "pendingDebounce": { "alias": "pendingDebounce"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof FormErrorDisplayDirective; inputs: { "errorDisplayMode": "errorDisplayMode"; "warningDisplayMode": "warningDisplayMode"; }; outputs: {}; }]>;
|
|
404
406
|
}
|
|
405
407
|
|
|
406
408
|
/**
|
|
@@ -422,7 +424,7 @@ declare class FormErrorControlDirective implements AfterContentInit, OnDestroy {
|
|
|
422
424
|
* - `single-control`: apply ARIA attributes only when exactly one control is found.
|
|
423
425
|
* - `none`: do not mutate descendant controls.
|
|
424
426
|
*/
|
|
425
|
-
readonly ariaAssociationMode: _angular_core.InputSignal<
|
|
427
|
+
readonly ariaAssociationMode: _angular_core.InputSignal<AriaAssociationMode>;
|
|
426
428
|
/**
|
|
427
429
|
* Unique ID prefix for this instance.
|
|
428
430
|
* Use these IDs to render message regions and to support aria-describedby.
|
|
@@ -441,13 +443,12 @@ declare class FormErrorControlDirective implements AfterContentInit, OnDestroy {
|
|
|
441
443
|
*/
|
|
442
444
|
readonly ariaDescribedBy: _angular_core.Signal<string | null>;
|
|
443
445
|
private readonly ownedDescribedByIds;
|
|
444
|
-
private mergeAriaDescribedBy;
|
|
445
446
|
constructor();
|
|
446
447
|
ngAfterContentInit(): void;
|
|
447
448
|
ngOnDestroy(): void;
|
|
448
449
|
private updateFormControls;
|
|
449
450
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormErrorControlDirective, never>;
|
|
450
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<FormErrorControlDirective, "[formErrorControl], [ngxErrorControl]", ["formErrorControl", "ngxErrorControl"], { "ariaAssociationMode": { "alias": "ariaAssociationMode"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof FormErrorDisplayDirective; inputs: { "errorDisplayMode": "errorDisplayMode"; }; outputs: {}; }]>;
|
|
451
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<FormErrorControlDirective, "[formErrorControl], [ngxErrorControl]", ["formErrorControl", "ngxErrorControl"], { "ariaAssociationMode": { "alias": "ariaAssociationMode"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof FormErrorDisplayDirective; inputs: { "errorDisplayMode": "errorDisplayMode"; "warningDisplayMode": "warningDisplayMode"; }; outputs: {}; }]>;
|
|
451
452
|
}
|
|
452
453
|
|
|
453
454
|
/**
|
|
@@ -461,22 +462,37 @@ type ValidationOptions = {
|
|
|
461
462
|
};
|
|
462
463
|
|
|
463
464
|
/**
|
|
464
|
-
* Hooks into
|
|
465
|
-
*
|
|
465
|
+
* Hooks into `ngModelGroup`/`ngxModelGroup` and runs async group-level validation
|
|
466
|
+
* through the parent `FormDirective` Vest suite bridge.
|
|
466
467
|
*/
|
|
467
468
|
declare class FormModelGroupDirective implements AsyncValidator {
|
|
469
|
+
/**
|
|
470
|
+
* Per-group async validation options.
|
|
471
|
+
*
|
|
472
|
+
* Defaults to no debounce (`{ debounceTime: 0 }`).
|
|
473
|
+
*/
|
|
468
474
|
validationOptions: _angular_core.InputSignal<ValidationOptions>;
|
|
469
475
|
private readonly formDirective;
|
|
476
|
+
/**
|
|
477
|
+
* Runs async validation for the current model-group control.
|
|
478
|
+
*
|
|
479
|
+
* Returns `null` (fail-open) when used outside an `ngxVestForm` context.
|
|
480
|
+
*/
|
|
470
481
|
validate(control: AbstractControl): Observable<ValidationErrors | null>;
|
|
471
482
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormModelGroupDirective, never>;
|
|
472
483
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<FormModelGroupDirective, "[ngModelGroup],[ngxModelGroup]", never, { "validationOptions": { "alias": "validationOptions"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
473
484
|
}
|
|
474
485
|
|
|
475
486
|
/**
|
|
476
|
-
* Hooks into
|
|
477
|
-
*
|
|
487
|
+
* Hooks into `ngModel`/`ngxModel` and runs async field-level validation
|
|
488
|
+
* through the parent `FormDirective` Vest suite bridge.
|
|
478
489
|
*/
|
|
479
490
|
declare class FormModelDirective implements AsyncValidator {
|
|
491
|
+
/**
|
|
492
|
+
* Per-control async validation options.
|
|
493
|
+
*
|
|
494
|
+
* Defaults to no debounce (`{ debounceTime: 0 }`).
|
|
495
|
+
*/
|
|
480
496
|
validationOptions: _angular_core.InputSignal<ValidationOptions>;
|
|
481
497
|
/**
|
|
482
498
|
* Reference to the form that needs to be validated
|
|
@@ -484,6 +500,11 @@ declare class FormModelDirective implements AsyncValidator {
|
|
|
484
500
|
* does not crash the application. In that case, validation becomes a no-op.
|
|
485
501
|
*/
|
|
486
502
|
private readonly formDirective;
|
|
503
|
+
/**
|
|
504
|
+
* Runs field-level async validation for this control.
|
|
505
|
+
*
|
|
506
|
+
* Returns `null` (fail-open) when used outside an `ngxVestForm` context.
|
|
507
|
+
*/
|
|
487
508
|
validate(control: AbstractControl): Observable<ValidationErrors | null>;
|
|
488
509
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormModelDirective, never>;
|
|
489
510
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<FormModelDirective, "[ngModel],[ngxModel]", never, { "validationOptions": { "alias": "validationOptions"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -883,6 +904,7 @@ type NgxFieldKey<T> = Extract<keyof T, string> | (string & {});
|
|
|
883
904
|
* @see {@link https://vestjs.dev/docs/writing_your_suite | Vest Documentation}
|
|
884
905
|
* @see {@link NgxFieldKey} For typed field name hints with arbitrary string support
|
|
885
906
|
*/
|
|
907
|
+
/** @internal Do not use outside ngx-vest-forms. The `any` is architecturally required. */
|
|
886
908
|
type NgxSuiteCallback<T> = {
|
|
887
909
|
bivarianceHack(model: T, field?: any): void;
|
|
888
910
|
}['bivarianceHack'];
|
|
@@ -924,6 +946,7 @@ type NgxVestSuite<T = unknown> = StaticSuite<string, string, NgxSuiteCallback<T>
|
|
|
924
946
|
* @see {@link NgxVestSuite} For the base suite type (accepts any string field)
|
|
925
947
|
* @see {@link FormFieldName} For the field name type with autocomplete
|
|
926
948
|
*/
|
|
949
|
+
/** @internal Do not use outside ngx-vest-forms. */
|
|
927
950
|
type NgxTypedSuiteCallback<T> = {
|
|
928
951
|
bivarianceHack(model: T, field?: FormFieldName<T>): void;
|
|
929
952
|
}['bivarianceHack'];
|
|
@@ -985,6 +1008,16 @@ declare class FormDirective<T extends Record<string, unknown>> {
|
|
|
985
1008
|
* separately when they exist without errors.
|
|
986
1009
|
*/
|
|
987
1010
|
readonly fieldWarnings: _angular_core.WritableSignal<Map<string, readonly string[]>>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Computed signal that returns field paths for all touched (or submitted) leaf controls.
|
|
1013
|
+
* Updates reactively when controls are touched (blur) or when form status changes.
|
|
1014
|
+
*
|
|
1015
|
+
* This enables consumers to determine which fields the user has interacted with,
|
|
1016
|
+
* useful for filtering errors/warnings to match the form's visible validation state.
|
|
1017
|
+
*
|
|
1018
|
+
* @publicApi
|
|
1019
|
+
*/
|
|
1020
|
+
readonly touchedFieldPaths: _angular_core.Signal<string[]>;
|
|
988
1021
|
/**
|
|
989
1022
|
* Computed signal for form state with validity and errors.
|
|
990
1023
|
* Used by templates and tests as vestForm.formState().valid/errors
|
|
@@ -1050,7 +1083,7 @@ declare class FormDirective<T extends Record<string, unknown>> {
|
|
|
1050
1083
|
*
|
|
1051
1084
|
* Cleanup is handled automatically by the directive when it's destroyed.
|
|
1052
1085
|
*/
|
|
1053
|
-
readonly errorsChange: _angular_core.OutputRef<Record<string,
|
|
1086
|
+
readonly errorsChange: _angular_core.OutputRef<Record<string, string[]>>;
|
|
1054
1087
|
/**
|
|
1055
1088
|
* Triggered as soon as the form becomes dirty
|
|
1056
1089
|
*
|
|
@@ -1176,6 +1209,11 @@ declare class FormDirective<T extends Record<string, unknown>> {
|
|
|
1176
1209
|
* ```
|
|
1177
1210
|
*/
|
|
1178
1211
|
markAllAsTouched(): void;
|
|
1212
|
+
/**
|
|
1213
|
+
* Host handler: called whenever any descendant field loses focus.
|
|
1214
|
+
* Used to make touched-path tracking react immediately on blur/tab.
|
|
1215
|
+
*/
|
|
1216
|
+
onFormFocusOut(): void;
|
|
1179
1217
|
/**
|
|
1180
1218
|
* Resets the form to a pristine, untouched state with optional new values.
|
|
1181
1219
|
*
|
|
@@ -1229,15 +1267,15 @@ declare class FormDirective<T extends Record<string, unknown>> {
|
|
|
1229
1267
|
*/
|
|
1230
1268
|
resetForm(value?: T | null): void;
|
|
1231
1269
|
/**
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1270
|
+
* Creates a one-shot async validator function for a specific field path.
|
|
1271
|
+
*
|
|
1272
|
+
* The returned validator:
|
|
1273
|
+
* - snapshots the current form model,
|
|
1274
|
+
* - injects the candidate control value at `field`,
|
|
1275
|
+
* - runs the Vest suite with debouncing,
|
|
1276
|
+
* - maps Vest errors/warnings into Angular `ValidationErrors | null`.
|
|
1277
|
+
*
|
|
1278
|
+
* Warnings are stored in `fieldWarnings` to keep warnings non-blocking when no errors exist.
|
|
1241
1279
|
*/
|
|
1242
1280
|
createAsyncValidator(field: string, validationOptions: ValidationOptions): AsyncValidatorFn;
|
|
1243
1281
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormDirective<any>, never>;
|
|
@@ -1601,7 +1639,7 @@ declare class ValidationConfigBuilder<T> {
|
|
|
1601
1639
|
* /// Result: { password: ['confirmPassword', 'securityScore'] }
|
|
1602
1640
|
* ```
|
|
1603
1641
|
*/
|
|
1604
|
-
whenChanged<K extends FieldPath<T>>(trigger: K, revalidate: FieldPath<T> |
|
|
1642
|
+
whenChanged<K extends FieldPath<T>>(trigger: K, revalidate: FieldPath<T> | ReadonlyArray<FieldPath<T>>): this;
|
|
1605
1643
|
/**
|
|
1606
1644
|
* Add bidirectional dependency: when either field changes, revalidate the other.
|
|
1607
1645
|
*
|
|
@@ -1710,7 +1748,7 @@ declare class ValidationConfigBuilder<T> {
|
|
|
1710
1748
|
* builder.group(['street', 'city', 'state', 'zipCode']);
|
|
1711
1749
|
* ```
|
|
1712
1750
|
*/
|
|
1713
|
-
group<K extends FieldPath<T>>(fields: K[]): this;
|
|
1751
|
+
group<K extends FieldPath<T>>(fields: readonly K[]): this;
|
|
1714
1752
|
/**
|
|
1715
1753
|
* Merge with an existing validation configuration.
|
|
1716
1754
|
*
|
|
@@ -1858,12 +1896,15 @@ declare function createValidationConfig<T>(): ValidationConfigBuilder<T>;
|
|
|
1858
1896
|
* Does not recurse into nested arrays or objects.
|
|
1859
1897
|
* Uses reduce() for optimal single-pass conversion.
|
|
1860
1898
|
*/
|
|
1861
|
-
|
|
1899
|
+
type DeepArrayToObject<T> = T extends ReadonlyArray<infer U> ? Record<number, DeepArrayToObject<U>> : T extends object ? {
|
|
1900
|
+
[K in keyof T]: DeepArrayToObject<T[K]>;
|
|
1901
|
+
} : T;
|
|
1902
|
+
declare function arrayToObject<T>(array: readonly T[]): Record<number, T>;
|
|
1862
1903
|
/**
|
|
1863
1904
|
* Recursively converts arrays to objects with numeric keys, including nested arrays in objects.
|
|
1864
1905
|
* Useful for template-driven forms that require object structure for nested arrays.
|
|
1865
1906
|
*/
|
|
1866
|
-
declare function deepArrayToObject<T>(array: T[]): Record<number,
|
|
1907
|
+
declare function deepArrayToObject<T>(array: readonly T[]): Record<number, DeepArrayToObject<T>>;
|
|
1867
1908
|
/**
|
|
1868
1909
|
* Converts selected numeric-keyed object properties back to arrays.
|
|
1869
1910
|
* Only properties listed in keys will be converted; others remain untouched.
|
|
@@ -1874,7 +1915,7 @@ declare function deepArrayToObject<T>(array: T[]): Record<number, unknown>;
|
|
|
1874
1915
|
* Note: Conversion is explicit (by key) but will cascade inside converted branches
|
|
1875
1916
|
* so nested numeric objects representing arrays become real arrays recursively.
|
|
1876
1917
|
*/
|
|
1877
|
-
declare function objectToArray(object: unknown, keys:
|
|
1918
|
+
declare function objectToArray<const K extends readonly string[]>(object: unknown, keys: K): unknown;
|
|
1878
1919
|
|
|
1879
1920
|
/**
|
|
1880
1921
|
* Utility functions for managing form field state in dynamic forms.
|
|
@@ -1916,7 +1957,7 @@ declare function objectToArray(object: unknown, keys: string[]): unknown;
|
|
|
1916
1957
|
* Uses `Object.entries()` for efficient field clearing without mutation.
|
|
1917
1958
|
* Only processes fields that need to be cleared, preserving other field values.
|
|
1918
1959
|
*
|
|
1919
|
-
* @template T - The form model type, must extend Record<string,
|
|
1960
|
+
* @template T - The form model type, must extend Record<string, unknown>
|
|
1920
1961
|
* @param currentState - The current form state object
|
|
1921
1962
|
* @param conditions - Object mapping field names to boolean conditions (true = clear field)
|
|
1922
1963
|
* @returns New state object with specified fields cleared (set to undefined)
|
|
@@ -1967,7 +2008,7 @@ declare function objectToArray(object: unknown, keys: string[]): unknown;
|
|
|
1967
2008
|
* ```
|
|
1968
2009
|
*
|
|
1969
2010
|
*/
|
|
1970
|
-
declare function clearFieldsWhen<T extends Record<string, unknown>>(currentState: T, conditions: Partial<Record<keyof T, boolean
|
|
2011
|
+
declare function clearFieldsWhen<T extends Record<string, unknown>>(currentState: T, conditions: Readonly<Partial<Record<keyof T, boolean>>>): T;
|
|
1971
2012
|
/**
|
|
1972
2013
|
* Clears multiple fields from form state unconditionally.
|
|
1973
2014
|
*
|
|
@@ -1980,7 +2021,7 @@ declare function clearFieldsWhen<T extends Record<string, unknown>>(currentState
|
|
|
1980
2021
|
* **Note:** Unlike `clearFieldsWhen`, this function always clears the specified fields
|
|
1981
2022
|
* regardless of conditions. Use this when you want unconditional field removal.
|
|
1982
2023
|
*
|
|
1983
|
-
* @template T - The form model type, must extend Record<string,
|
|
2024
|
+
* @template T - The form model type, must extend Record<string, unknown>
|
|
1984
2025
|
* @param currentState - The current form state object
|
|
1985
2026
|
* @param fieldsToClear - Array of field names to clear (set to undefined)
|
|
1986
2027
|
* @returns New state object with specified fields cleared
|
|
@@ -2004,7 +2045,7 @@ declare function clearFieldsWhen<T extends Record<string, unknown>>(currentState
|
|
|
2004
2045
|
* }
|
|
2005
2046
|
* ```
|
|
2006
2047
|
*/
|
|
2007
|
-
declare function clearFields<T extends Record<string, unknown>>(currentState: T, fieldsToClear:
|
|
2048
|
+
declare function clearFields<T extends Record<string, unknown>>(currentState: T, fieldsToClear: ReadonlyArray<keyof T>): T;
|
|
2008
2049
|
/**
|
|
2009
2050
|
* Creates a clean form state containing only fields that meet specified conditions.
|
|
2010
2051
|
*
|
|
@@ -2019,7 +2060,7 @@ declare function clearFields<T extends Record<string, unknown>>(currentState: T,
|
|
|
2019
2060
|
*
|
|
2020
2061
|
* **Returns:** `Partial<T>` because the result may not contain all original fields.
|
|
2021
2062
|
*
|
|
2022
|
-
* @template T - The form model type, must extend Record<string,
|
|
2063
|
+
* @template T - The form model type, must extend Record<string, unknown>
|
|
2023
2064
|
* @param currentState - The current form state object
|
|
2024
2065
|
* @param conditions - Object mapping field names to boolean conditions (true = keep field)
|
|
2025
2066
|
* @returns New state object containing only fields where condition is true
|
|
@@ -2054,26 +2095,8 @@ declare function clearFields<T extends Record<string, unknown>>(currentState: T,
|
|
|
2054
2095
|
*
|
|
2055
2096
|
* @since 1.0.0
|
|
2056
2097
|
*/
|
|
2057
|
-
declare function keepFieldsWhen<T extends Record<string, unknown>>(currentState: T, conditions: Partial<Record<keyof T, boolean
|
|
2098
|
+
declare function keepFieldsWhen<T extends Record<string, unknown>>(currentState: T, conditions: Readonly<Partial<Record<keyof T, boolean>>>): Partial<T>;
|
|
2058
2099
|
|
|
2059
|
-
/**
|
|
2060
|
-
* Utilities for working with field paths in dot/bracket notation and Standard Schema path arrays.
|
|
2061
|
-
*
|
|
2062
|
-
* These utilities help convert between:
|
|
2063
|
-
* - **Dot/bracket notation**: `'addresses[0].street'` (used in Angular forms and Vest)
|
|
2064
|
-
* - **Standard Schema paths**: `['addresses', 0, 'street']` (used in schema validation)
|
|
2065
|
-
*
|
|
2066
|
-
* @example
|
|
2067
|
-
* ```typescript
|
|
2068
|
-
* // Parse string path to array
|
|
2069
|
-
* parseFieldPath('user.addresses[0].street')
|
|
2070
|
-
* // Returns: ['user', 'addresses', 0, 'street']
|
|
2071
|
-
*
|
|
2072
|
-
* // Stringify array path to string
|
|
2073
|
-
* stringifyFieldPath(['user', 'addresses', 0, 'street'])
|
|
2074
|
-
* // Returns: 'user.addresses[0].street'
|
|
2075
|
-
* ```
|
|
2076
|
-
*/
|
|
2077
2100
|
/**
|
|
2078
2101
|
* @internal
|
|
2079
2102
|
* Internal utility for parsing field path strings.
|
|
@@ -2170,8 +2193,11 @@ declare function getFormGroupField(rootForm: FormGroup, control: AbstractControl
|
|
|
2170
2193
|
* to include disabled field values in form submissions. Use Angular's `getRawValue()`
|
|
2171
2194
|
* method on your form if you need to access disabled field values.
|
|
2172
2195
|
*
|
|
2173
|
-
* This
|
|
2196
|
+
* This utility merges the value of the form with the raw value.
|
|
2174
2197
|
* By doing this we can assure that we don't lose values of disabled form fields
|
|
2198
|
+
*
|
|
2199
|
+
* Security: Unsafe prototype-related keys (`__proto__`, `prototype`, `constructor`)
|
|
2200
|
+
* are skipped during recursive merge.
|
|
2175
2201
|
* @param form
|
|
2176
2202
|
*/
|
|
2177
2203
|
declare function mergeValuesAndRawValues<T>(form: FormGroup): T;
|
|
@@ -2186,16 +2212,23 @@ declare function mergeValuesAndRawValues<T>(form: FormGroup): T;
|
|
|
2186
2212
|
*/
|
|
2187
2213
|
declare function cloneDeep<T>(object: T): T;
|
|
2188
2214
|
/**
|
|
2189
|
-
* Sets a value in an object
|
|
2190
|
-
*
|
|
2191
|
-
*
|
|
2192
|
-
*
|
|
2215
|
+
* Sets a value in an object at the provided field path.
|
|
2216
|
+
*
|
|
2217
|
+
* Supports dot and bracket notation via `parseFieldPath()`.
|
|
2218
|
+
* Examples: `user.profile.name`, `addresses[0].street`.
|
|
2219
|
+
*
|
|
2220
|
+
* Security: If any path segment matches an unsafe prototype-related key
|
|
2221
|
+
* (`__proto__`, `prototype`, `constructor`), the write is ignored.
|
|
2222
|
+
*
|
|
2223
|
+
* @param obj - Target object to mutate.
|
|
2224
|
+
* @param path - Dot/bracket field path.
|
|
2225
|
+
* @param value - Value to assign at the resolved path.
|
|
2193
2226
|
*/
|
|
2194
|
-
declare function setValueAtPath(obj: object, path: string, value:
|
|
2227
|
+
declare function setValueAtPath(obj: object, path: string, value: unknown): void;
|
|
2195
2228
|
/**
|
|
2196
2229
|
* @deprecated Use {@link setValueAtPath} instead
|
|
2197
2230
|
*/
|
|
2198
|
-
declare function set(obj: object, path: string, value:
|
|
2231
|
+
declare function set(obj: object, path: string, value: unknown): void;
|
|
2199
2232
|
/**
|
|
2200
2233
|
* @internal
|
|
2201
2234
|
* Internal utility for collecting all form errors by field path.
|
|
@@ -2207,7 +2240,7 @@ declare function set(obj: object, path: string, value: any): void;
|
|
|
2207
2240
|
* Traverses the form and returns the errors by path
|
|
2208
2241
|
* @param form
|
|
2209
2242
|
*/
|
|
2210
|
-
declare function getAllFormErrors(form?: AbstractControl): Record<string,
|
|
2243
|
+
declare function getAllFormErrors(form?: AbstractControl): Record<string, string[]>;
|
|
2211
2244
|
|
|
2212
2245
|
/**
|
|
2213
2246
|
* Options for configuring debounced pending state behavior.
|