@ng-forge/dynamic-forms 0.10.0-next.3 → 1.0.0-rc.1
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/fesm2022/{ng-forge-dynamic-forms-array-field.component-D6GEsH72.mjs → ng-forge-dynamic-forms-array-field.component-By12r5Cj.mjs} +49 -27
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-By12r5Cj.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-QJzwEYSj.mjs +2347 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-QJzwEYSj.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-container-field.component-BluTT44A.mjs → ng-forge-dynamic-forms-container-field.component-BGFguOa9.mjs} +23 -14
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-BGFguOa9.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-container-utils-diYAWMa_.mjs → ng-forge-dynamic-forms-container-utils-BZFz6ztF.mjs} +4 -3
- package/fesm2022/ng-forge-dynamic-forms-container-utils-BZFz6ztF.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-css-wrapper.component-CgMQOaG7.mjs → ng-forge-dynamic-forms-css-wrapper.component-AScQAJTQ.mjs} +9 -7
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-AScQAJTQ.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-emit-initialization-CB86IMsQ.mjs → ng-forge-dynamic-forms-emit-initialization-DhHwU6FJ.mjs} +2 -2
- package/fesm2022/ng-forge-dynamic-forms-emit-initialization-DhHwU6FJ.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-group-field.component-2bWHql4u.mjs → ng-forge-dynamic-forms-group-field.component-Bz4GD8Hy.mjs} +43 -24
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-Bz4GD8Hy.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs +130 -85
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs.map +1 -1
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs +3374 -0
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-DTkMZcnb.mjs +5425 -0
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-DTkMZcnb.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-page-field.component-zF-vEv5V.mjs → ng-forge-dynamic-forms-page-field.component-CjCd5Byo.mjs} +27 -16
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-CjCd5Byo.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-row-wrapper.component-CwkYn5yl.mjs → ng-forge-dynamic-forms-row-wrapper.component-BlVa801t.mjs} +6 -5
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-BlVa801t.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-text-field.component-_8_vVeH0.mjs → ng-forge-dynamic-forms-text-field.component-CNCpmf5_.mjs} +19 -12
- package/fesm2022/ng-forge-dynamic-forms-text-field.component-CNCpmf5_.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms.mjs +2 -1
- package/fesm2022/ng-forge-dynamic-forms.mjs.map +1 -1
- package/package.json +17 -4
- package/schematics/collection.json +10 -0
- package/schematics/generators.json +12 -0
- package/schematics/ng-add/index.js +87 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/nx-wrapper.js +5 -0
- package/schematics/ng-add/nx-wrapper.js.map +1 -0
- package/schematics/ng-add/recipes.js +60 -0
- package/schematics/ng-add/recipes.js.map +1 -0
- package/schematics/ng-add/rules/add-packages.js +73 -0
- package/schematics/ng-add/rules/add-packages.js.map +1 -0
- package/schematics/ng-add/rules/add-providers.js +132 -0
- package/schematics/ng-add/rules/add-providers.js.map +1 -0
- package/schematics/ng-add/rules/add-styles.js +123 -0
- package/schematics/ng-add/rules/add-styles.js.map +1 -0
- package/schematics/ng-add/schema.json +48 -0
- package/schematics/package.json +1 -0
- package/schematics/versions.js +33 -0
- package/schematics/versions.js.map +1 -0
- package/types/ng-forge-dynamic-forms-integration.d.ts +4 -2
- package/types/ng-forge-dynamic-forms-internal.d.ts +3508 -0
- package/types/ng-forge-dynamic-forms.d.ts +16 -2734
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-D6GEsH72.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-BluTT44A.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-container-utils-diYAWMa_.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-CgMQOaG7.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-emit-initialization-CB86IMsQ.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-2bWHql4u.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-CPkVjU_N.mjs +0 -10876
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-CPkVjU_N.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-zF-vEv5V.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-CwkYn5yl.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-text-field.component-_8_vVeH0.mjs.map +0 -1
|
@@ -1,1919 +1,14 @@
|
|
|
1
1
|
import * as rxjs from 'rxjs';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
2
|
import * as _angular_core from '@angular/core';
|
|
4
|
-
import {
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** Generic reactive value — a static value, an Angular Signal, or an RxJS Observable. */
|
|
14
|
-
type DynamicValue<T> = T | Signal<T> | Observable<T>;
|
|
15
|
-
|
|
16
|
-
/** Universal addon slot names supported by every adapter. */
|
|
17
|
-
type CommonAddonSlot = 'prefix' | 'suffix';
|
|
18
|
-
/** Module-augmentable registry of adapter-specific addon slot names. */
|
|
19
|
-
interface DynamicFormAddonSlotRegistry {
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Union of every valid addon slot — universal slots plus any registered via
|
|
23
|
-
* {@link DynamicFormAddonSlotRegistry} module augmentation.
|
|
24
|
-
*/
|
|
25
|
-
type AddonSlot = CommonAddonSlot | keyof DynamicFormAddonSlotRegistry;
|
|
26
|
-
|
|
27
|
-
/** Base shape every addon kind extends. */
|
|
28
|
-
interface BaseAddon<TSlot extends AddonSlot = AddonSlot> {
|
|
29
|
-
/** Slot to render this addon in. */
|
|
30
|
-
readonly slot: TSlot;
|
|
31
|
-
/** CSS class applied to the addon host element. */
|
|
32
|
-
readonly className?: string;
|
|
33
|
-
/** Reactive visibility — when `true`, the addon is removed from layout. */
|
|
34
|
-
readonly hidden?: DynamicValue<boolean>;
|
|
35
|
-
/** Reactive disabled state — primarily relevant for interactive kinds. */
|
|
36
|
-
readonly disabled?: DynamicValue<boolean>;
|
|
37
|
-
}
|
|
38
|
-
/** Module-augmentable registry of addon kinds. */
|
|
39
|
-
interface DynamicFormAddonRegistry {
|
|
40
|
-
text: TextAddon;
|
|
41
|
-
template: TemplateAddon;
|
|
42
|
-
component: ComponentAddon;
|
|
43
|
-
}
|
|
44
|
-
/** Union of every registered addon shape. */
|
|
45
|
-
type AnyAddon = DynamicFormAddonRegistry[keyof DynamicFormAddonRegistry];
|
|
46
|
-
/** Renders text content inline. */
|
|
47
|
-
interface TextAddon extends BaseAddon {
|
|
48
|
-
readonly kind: 'text';
|
|
49
|
-
readonly text: DynamicText;
|
|
50
|
-
}
|
|
51
|
-
/** Renders a named `<ng-template>` projected into the host `<df-dynamic-form>`. */
|
|
52
|
-
interface TemplateAddon extends BaseAddon {
|
|
53
|
-
readonly kind: 'template';
|
|
54
|
-
readonly templateKey: string;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Renders an arbitrary Angular component as the addon body.
|
|
58
|
-
*
|
|
59
|
-
* @codeOnly The `component` loader is a function and cannot survive
|
|
60
|
-
* `JSON.stringify`/`parse`. The lenient validator drops this kind when the
|
|
61
|
-
* config originated from JSON (set via `sanitizeFormConfig({ source: 'json' })`).
|
|
62
|
-
*/
|
|
63
|
-
interface ComponentAddon extends BaseAddon {
|
|
64
|
-
readonly kind: 'component';
|
|
65
|
-
readonly component: () => Promise<Type<unknown> | {
|
|
66
|
-
default: Type<unknown>;
|
|
67
|
-
}>;
|
|
68
|
-
readonly inputs?: Record<string, unknown>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type WithInputSignals<T> = {
|
|
72
|
-
readonly [K in keyof T]-?: Signal<T[K]>;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
type Prettify<T> = {
|
|
76
|
-
[K in keyof T]: T[K];
|
|
77
|
-
} & {};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Interface for dynamic forms logger implementations.
|
|
81
|
-
* Allows custom logging integrations (Sentry, DataDog, etc.)
|
|
82
|
-
*/
|
|
83
|
-
interface Logger {
|
|
84
|
-
/**
|
|
85
|
-
* Log a debug message.
|
|
86
|
-
* Use for detailed diagnostic information during development.
|
|
87
|
-
*/
|
|
88
|
-
debug(message: string, ...args: unknown[]): void;
|
|
89
|
-
/**
|
|
90
|
-
* Log an info message.
|
|
91
|
-
* Use for general operational information.
|
|
92
|
-
*/
|
|
93
|
-
info(message: string, ...args: unknown[]): void;
|
|
94
|
-
/**
|
|
95
|
-
* Log a warning message.
|
|
96
|
-
* Use for potentially problematic situations that don't prevent operation.
|
|
97
|
-
*/
|
|
98
|
-
warn(message: string, ...args: unknown[]): void;
|
|
99
|
-
/**
|
|
100
|
-
* Log an error message.
|
|
101
|
-
* Use for error conditions that may affect functionality.
|
|
102
|
-
*/
|
|
103
|
-
error(message: string, ...args: unknown[]): void;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Shared shape for DI-scoped warning trackers that dedupe log output.
|
|
108
|
-
*
|
|
109
|
-
* @internal
|
|
110
|
-
*/
|
|
111
|
-
interface WarningTracker {
|
|
112
|
-
warnedKeys: Set<string>;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/** Represents the state information of a single form field. */
|
|
116
|
-
interface FieldStateInfo {
|
|
117
|
-
readonly touched: boolean;
|
|
118
|
-
readonly dirty: boolean;
|
|
119
|
-
/** Convenience property: equivalent to `!dirty` */
|
|
120
|
-
readonly pristine: boolean;
|
|
121
|
-
readonly valid: boolean;
|
|
122
|
-
readonly invalid: boolean;
|
|
123
|
-
readonly pending: boolean;
|
|
124
|
-
/** Whether the field is currently hidden. */
|
|
125
|
-
readonly hidden: boolean;
|
|
126
|
-
/** Whether the field is currently readonly. */
|
|
127
|
-
readonly readonly: boolean;
|
|
128
|
-
/** Whether the field is currently disabled. */
|
|
129
|
-
readonly disabled: boolean;
|
|
130
|
-
}
|
|
131
|
-
/** Map of field keys to their state information. */
|
|
132
|
-
type FormFieldStateMap = Record<string, FieldStateInfo | undefined>;
|
|
133
|
-
/** Field state context for the current field being evaluated. */
|
|
134
|
-
type FieldStateContext = FieldStateInfo;
|
|
135
|
-
|
|
136
|
-
interface EvaluationContext<TValue = unknown, TFormValue extends Record<string, unknown> = any> {
|
|
137
|
-
/** Current field value */
|
|
138
|
-
fieldValue: TValue;
|
|
139
|
-
/** Form value for the current evaluation scope. */
|
|
140
|
-
formValue: TFormValue;
|
|
141
|
-
/** Field path for relative references */
|
|
142
|
-
fieldPath: string;
|
|
143
|
-
/** Custom evaluation functions */
|
|
144
|
-
customFunctions?: Record<string, (context: EvaluationContext) => unknown>;
|
|
145
|
-
/** Logger for diagnostic output */
|
|
146
|
-
logger: Logger;
|
|
147
|
-
/**
|
|
148
|
-
* Value of the field's nearest parent **group** (or array item, when the
|
|
149
|
-
* field has no inner group above the array boundary).
|
|
150
|
-
*/
|
|
151
|
-
groupValue?: unknown;
|
|
152
|
-
/** Root form value when inside an array context. */
|
|
153
|
-
rootFormValue?: Record<string, unknown>;
|
|
154
|
-
/** Current array index when inside an array derivation. */
|
|
155
|
-
arrayIndex?: number;
|
|
156
|
-
/** Path to the array field when inside an array derivation. */
|
|
157
|
-
arrayPath?: string;
|
|
158
|
-
/** External data signals resolved to their current values. */
|
|
159
|
-
externalData?: Record<string, unknown>;
|
|
160
|
-
/**
|
|
161
|
-
* DI-scoped tracker for deprecation warnings.
|
|
162
|
-
* Used by the condition evaluator to deduplicate deprecation warnings.
|
|
163
|
-
*/
|
|
164
|
-
deprecationTracker?: WarningTracker;
|
|
165
|
-
/** State of the current field being evaluated. */
|
|
166
|
-
fieldState?: FieldStateContext;
|
|
167
|
-
/** State of all fields in the form, keyed by field key. */
|
|
168
|
-
formFieldState?: FormFieldStateMap;
|
|
169
|
-
/** Allow additional properties for flexible expression evaluation */
|
|
170
|
-
[key: string]: unknown;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/** Custom function signature for conditional expressions */
|
|
174
|
-
type CustomFunction<TFormValue extends Record<string, unknown> = any> = (context: EvaluationContext<unknown, TFormValue>) => unknown;
|
|
175
|
-
|
|
176
|
-
/** Async function for derivations — returns any value. */
|
|
177
|
-
type AsyncDerivationFunction<TFormValue extends Record<string, unknown> = any> = (context: EvaluationContext<unknown, TFormValue>) => Promise<unknown> | Observable<unknown>;
|
|
178
|
-
/** Async function for conditions — returns boolean. */
|
|
179
|
-
type AsyncConditionFunction<TFormValue extends Record<string, unknown> = any> = (context: EvaluationContext<unknown, TFormValue>) => Promise<boolean> | Observable<boolean>;
|
|
180
|
-
|
|
181
|
-
/** Configuration for an HTTP request used by declarative HTTP validators, derivations, and conditions. */
|
|
182
|
-
interface HttpRequestConfig {
|
|
183
|
-
/** URL to send the request to */
|
|
184
|
-
url: string;
|
|
185
|
-
/** HTTP method. Defaults to 'GET' */
|
|
186
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
187
|
-
/**
|
|
188
|
-
* URL path parameters. Keys correspond to `:key` placeholders in the URL.
|
|
189
|
-
* Values are expressions evaluated by ExpressionParser against the current EvaluationContext.
|
|
190
|
-
*/
|
|
191
|
-
params?: Record<string, string>;
|
|
192
|
-
/**
|
|
193
|
-
* Query parameters appended to the URL.
|
|
194
|
-
* Values are expressions evaluated by ExpressionParser against the current EvaluationContext.
|
|
195
|
-
*/
|
|
196
|
-
queryParams?: Record<string, string>;
|
|
197
|
-
/** Request body (for POST/PUT/PATCH) */
|
|
198
|
-
body?: Record<string, unknown>;
|
|
199
|
-
/**
|
|
200
|
-
* When true, top-level string values in `body` are treated as expressions
|
|
201
|
-
* and evaluated by ExpressionParser (shallow only — nested objects are passed through as-is).
|
|
202
|
-
*/
|
|
203
|
-
evaluateBodyExpressions?: boolean;
|
|
204
|
-
/** HTTP headers to include in the request */
|
|
205
|
-
headers?: Record<string, string>;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/** Comparison operators for field value and form value conditions. */
|
|
209
|
-
type ComparisonOperator = 'equals' | 'notEquals' | 'greater' | 'less' | 'greaterOrEqual' | 'lessOrEqual' | 'contains' | 'startsWith' | 'endsWith' | 'matches';
|
|
210
|
-
/** Condition that compares a specific field's value against an expected value. */
|
|
211
|
-
interface FieldValueCondition {
|
|
212
|
-
type: 'fieldValue';
|
|
213
|
-
/** Path to the field whose value to compare */
|
|
214
|
-
fieldPath: string;
|
|
215
|
-
/** Comparison operator */
|
|
216
|
-
operator: ComparisonOperator;
|
|
217
|
-
/** Value to compare against */
|
|
218
|
-
value?: unknown;
|
|
219
|
-
}
|
|
220
|
-
/** Condition that invokes a custom function. */
|
|
221
|
-
type CustomCondition = {
|
|
222
|
-
type: 'custom';
|
|
223
|
-
/** Name of the registered custom function to invoke */
|
|
224
|
-
functionName: string;
|
|
225
|
-
/** Inline form is forbidden when `functionName` is set */
|
|
226
|
-
fn?: never;
|
|
227
|
-
} | {
|
|
228
|
-
type: 'custom';
|
|
229
|
-
/** Inline custom function. Mutually exclusive with `functionName`. */
|
|
230
|
-
fn: CustomFunction;
|
|
231
|
-
/** Registered form is forbidden when `fn` is set */
|
|
232
|
-
functionName?: never;
|
|
233
|
-
};
|
|
234
|
-
/** Condition that evaluates a JavaScript expression using the secure AST-based parser. */
|
|
235
|
-
interface JavascriptCondition {
|
|
236
|
-
type: 'javascript';
|
|
237
|
-
/** JavaScript expression string to evaluate */
|
|
238
|
-
expression: string;
|
|
239
|
-
}
|
|
240
|
-
/** Condition that evaluates based on an HTTP response from a remote server. */
|
|
241
|
-
interface HttpCondition {
|
|
242
|
-
type: 'http';
|
|
243
|
-
/** HTTP request configuration */
|
|
244
|
-
http: HttpRequestConfig;
|
|
245
|
-
/**
|
|
246
|
-
* Expression to extract boolean from response (scope: `{ response }`).
|
|
247
|
-
* e.g. `'response.allowed'`, `'response.permissions.canEdit'`
|
|
248
|
-
* When omitted, the entire response is coerced to boolean: `!!response`
|
|
249
|
-
*/
|
|
250
|
-
responseExpression?: string;
|
|
251
|
-
/**
|
|
252
|
-
* Value to return while the HTTP request is in-flight.
|
|
253
|
-
*
|
|
254
|
-
* @default false
|
|
255
|
-
*/
|
|
256
|
-
pendingValue?: boolean;
|
|
257
|
-
/** Cache duration in ms for HTTP responses. @default 30000 */
|
|
258
|
-
cacheDurationMs?: number;
|
|
259
|
-
/**
|
|
260
|
-
* Debounce time in milliseconds for re-evaluation when dependent form values change.
|
|
261
|
-
*
|
|
262
|
-
* @default 300
|
|
263
|
-
*/
|
|
264
|
-
debounceMs?: number;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Shared fields for both branches of {@link AsyncCondition}.
|
|
268
|
-
*
|
|
269
|
-
* @internal
|
|
270
|
-
*/
|
|
271
|
-
interface AsyncConditionBase {
|
|
272
|
-
type: 'async';
|
|
273
|
-
/**
|
|
274
|
-
* Value to return while async resolution is pending.
|
|
275
|
-
*
|
|
276
|
-
* @default false
|
|
277
|
-
*/
|
|
278
|
-
pendingValue?: boolean;
|
|
279
|
-
/**
|
|
280
|
-
* Debounce ms for re-evaluation.
|
|
281
|
-
*
|
|
282
|
-
* @default 300
|
|
283
|
-
*/
|
|
284
|
-
debounceMs?: number;
|
|
285
|
-
}
|
|
286
|
-
/** Condition that resolves asynchronously via a custom function. */
|
|
287
|
-
type AsyncCondition = (AsyncConditionBase & {
|
|
288
|
-
/** Name of the registered async condition function */
|
|
289
|
-
asyncFunctionName: string;
|
|
290
|
-
/** Inline form is forbidden when `asyncFunctionName` is set */
|
|
291
|
-
asyncFn?: never;
|
|
292
|
-
}) | (AsyncConditionBase & {
|
|
293
|
-
/** Inline async condition function. Mutually exclusive with `asyncFunctionName`. */
|
|
294
|
-
asyncFn: AsyncConditionFunction;
|
|
295
|
-
/** Registered form is forbidden when `asyncFn` is set */
|
|
296
|
-
asyncFunctionName?: never;
|
|
297
|
-
});
|
|
298
|
-
/** Logical AND — all sub-conditions must be true. */
|
|
299
|
-
interface AndCondition {
|
|
300
|
-
type: 'and';
|
|
301
|
-
/** Sub-conditions that must all evaluate to true */
|
|
302
|
-
conditions: ConditionalExpression[];
|
|
303
|
-
}
|
|
304
|
-
/** Logical OR — at least one sub-condition must be true. */
|
|
305
|
-
interface OrCondition {
|
|
306
|
-
type: 'or';
|
|
307
|
-
/** Sub-conditions where at least one must evaluate to true */
|
|
308
|
-
conditions: ConditionalExpression[];
|
|
309
|
-
}
|
|
310
|
-
/** Discriminated union of all conditional expression types. */
|
|
311
|
-
type ConditionalExpression = FieldValueCondition | CustomCondition | JavascriptCondition | HttpCondition | AsyncCondition | AndCondition | OrCondition;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Logic configuration for container fields (page, group, row, array).
|
|
315
|
-
* Containers only support the 'hidden' logic type since they are layout containers,
|
|
316
|
-
* not form controls (they can't be readonly, disabled, or required).
|
|
317
|
-
*/
|
|
318
|
-
interface ContainerLogicConfig {
|
|
319
|
-
/** Only 'hidden' is supported for container fields */
|
|
320
|
-
type: 'hidden';
|
|
321
|
-
/**
|
|
322
|
-
* Condition that determines when this container is hidden.
|
|
323
|
-
* Can be a boolean or a conditional expression evaluated against form values.
|
|
324
|
-
*/
|
|
325
|
-
condition: ConditionalExpression | boolean;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Row field interface for creating horizontal layouts.
|
|
330
|
-
* A row is a synthetic field type that resolves to a Container at runtime,
|
|
331
|
-
* with a synthesized `{ type: 'row' }` wrapper applied for layout. The row
|
|
332
|
-
* itself does not hold a value — its children flatten into the parent form.
|
|
333
|
-
*/
|
|
334
|
-
interface RowField<TFields extends readonly RowAllowedChildren[] = readonly RowAllowedChildren[]> extends FieldDef<never> {
|
|
335
|
-
type: 'row';
|
|
336
|
-
/** Child definitions to render within this row */
|
|
337
|
-
readonly fields: TFields;
|
|
338
|
-
/** Row fields do not have a label property * */
|
|
339
|
-
readonly label?: never;
|
|
340
|
-
/** Rows do not support meta - they have no native form element * */
|
|
341
|
-
readonly meta?: never;
|
|
342
|
-
/**
|
|
343
|
-
* Logic configurations for conditional row visibility.
|
|
344
|
-
* Only 'hidden' type logic is supported for rows.
|
|
345
|
-
*/
|
|
346
|
-
readonly logic?: ContainerLogicConfig[];
|
|
347
|
-
}
|
|
348
|
-
/** Type guard for RowField with proper type narrowing */
|
|
349
|
-
declare function isRowField(field: FieldDef<any>): field is RowField;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Group field interface for creating logical field groupings that map to object values
|
|
353
|
-
* Groups create nested form structures where child field values are collected into an object
|
|
354
|
-
* This is a programmatic grouping only - users cannot customize this field type
|
|
355
|
-
*/
|
|
356
|
-
interface GroupField<TFields extends readonly GroupAllowedChildren[] = readonly GroupAllowedChildren[]> extends FieldDef<never> {
|
|
357
|
-
type: 'group';
|
|
358
|
-
readonly fields: TFields;
|
|
359
|
-
/** Groups do not have a label property - they are logical containers only * */
|
|
360
|
-
readonly label?: never;
|
|
361
|
-
/** Groups do not support meta - they have no native form element * */
|
|
362
|
-
readonly meta?: never;
|
|
363
|
-
/**
|
|
364
|
-
* Logic configurations for conditional group visibility.
|
|
365
|
-
* Only 'hidden' type logic is supported for groups.
|
|
366
|
-
*/
|
|
367
|
-
readonly logic?: ContainerLogicConfig[];
|
|
368
|
-
}
|
|
369
|
-
/** Type guard for GroupField with proper type narrowing */
|
|
370
|
-
declare function isGroupField(field: FieldDef<any>): field is GroupField;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Page field interface for creating top-level page layouts
|
|
374
|
-
* This is a special field type that contains other field definitions
|
|
375
|
-
* The page itself doesn't have a value - it's a layout container like row
|
|
376
|
-
* Pages can only be used at the top level and cannot be nested
|
|
377
|
-
* This is a programmatic field type only - users cannot customize this field type
|
|
378
|
-
*/
|
|
379
|
-
interface PageField<TFields extends readonly PageAllowedChildren[] = PageAllowedChildren[]> extends FieldDef<never> {
|
|
380
|
-
type: 'page';
|
|
381
|
-
/** Child field definitions to render within this page */
|
|
382
|
-
readonly fields: TFields;
|
|
383
|
-
/** Page fields do not have a label property * */
|
|
384
|
-
readonly label?: never;
|
|
385
|
-
/** Pages do not support meta - they have no native form element * */
|
|
386
|
-
readonly meta?: never;
|
|
387
|
-
/**
|
|
388
|
-
* Logic configurations for conditional page visibility.
|
|
389
|
-
* Only 'hidden' type logic is supported for pages.
|
|
390
|
-
*/
|
|
391
|
-
readonly logic?: ContainerLogicConfig[];
|
|
392
|
-
}
|
|
393
|
-
/** Type guard for PageField with proper type narrowing */
|
|
394
|
-
declare function isPageField(field: FieldDef<unknown>): field is PageField;
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Helper type to convert union to intersection.
|
|
398
|
-
* Uses `U extends U` to trigger distributive conditional type behavior.
|
|
399
|
-
*/
|
|
400
|
-
type UnionToIntersection<U> = (U extends U ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
401
|
-
/** Depth counter for recursion limiting (prevents infinite type instantiation) */
|
|
402
|
-
type Depth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
403
|
-
/**
|
|
404
|
-
* Widens literal types to their primitive equivalents, recursively for objects and arrays.
|
|
405
|
-
* This prevents `as const` from over-narrowing types like `''` to literal `''` instead of `string`.
|
|
406
|
-
*/
|
|
407
|
-
type Widen<T, D extends number = 5> = [D] extends [never] ? T : T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends readonly (infer U)[] ? Widen<U, Depth[D]>[] : T extends Record<string, unknown> ? {
|
|
408
|
-
-readonly [K in keyof T]: Widen<T[K], Depth[D]>;
|
|
409
|
-
} : T;
|
|
410
|
-
/**
|
|
411
|
-
* Resolves the "underlying" non-null value type for a field, based on its `type`
|
|
412
|
-
* discriminator and (where it matters) its `value` literal. Used when we need a
|
|
413
|
-
* base type independent of whether the literal happens to be `null` — i.e., when
|
|
414
|
-
* computing the nullable widening for `value: null, nullable: true`.
|
|
415
|
-
*/
|
|
416
|
-
type ResolveBaseValueType<T, V> = T extends {
|
|
417
|
-
type: 'slider';
|
|
418
|
-
} ? number : T extends {
|
|
419
|
-
type: 'input';
|
|
420
|
-
props: {
|
|
421
|
-
type: 'number';
|
|
422
|
-
};
|
|
423
|
-
} ? number : T extends {
|
|
424
|
-
type: 'checkbox' | 'toggle';
|
|
425
|
-
} ? boolean : [V] extends [null] ? string : Widen<V>;
|
|
426
|
-
/**
|
|
427
|
-
* Infer value type based on field type, value literal, and the `nullable` flag.
|
|
428
|
-
* - Slider fields: always number
|
|
429
|
-
* - Input fields with props.type: 'number': number
|
|
430
|
-
* - Checkbox / toggle fields: always boolean
|
|
431
|
-
* - Other fields: widen the literal value type (default to string when value is null)
|
|
432
|
-
* - When `nullable: true` is declared, widens the result to `T | null`.
|
|
433
|
-
*/
|
|
434
|
-
type InferValueType<T, V> = T extends {
|
|
435
|
-
nullable: true;
|
|
436
|
-
} ? ResolveBaseValueType<T, V> | null : ResolveBaseValueType<T, V>;
|
|
437
|
-
/**
|
|
438
|
-
* Make type optional if field is not required.
|
|
439
|
-
* Hidden fields are never optional since they require a value property.
|
|
440
|
-
*/
|
|
441
|
-
type MaybeOptional<T, V> = T extends {
|
|
442
|
-
type: 'hidden';
|
|
443
|
-
} ? V : T extends {
|
|
444
|
-
required: true;
|
|
445
|
-
} ? V : V | undefined;
|
|
446
|
-
/**
|
|
447
|
-
* Infers the value type from a single template field (for primitive arrays).
|
|
448
|
-
* Mirrors InferValueType logic: slider → number, input[number] → number,
|
|
449
|
-
* checkbox/toggle → boolean, else widen `value` (string fallback). Widens to
|
|
450
|
-
* `T | null` when `nullable: true` is declared on the template field.
|
|
451
|
-
*/
|
|
452
|
-
type InferSingleTemplateValueBase<T, D extends number> = T extends {
|
|
453
|
-
type: 'slider';
|
|
454
|
-
} ? number : T extends {
|
|
455
|
-
type: 'input';
|
|
456
|
-
props: {
|
|
457
|
-
type: 'number';
|
|
458
|
-
};
|
|
459
|
-
} ? number : T extends {
|
|
460
|
-
type: 'checkbox' | 'toggle';
|
|
461
|
-
} ? boolean : T extends {
|
|
462
|
-
value: infer V;
|
|
463
|
-
} ? [V] extends [null] ? string : Widen<V, Depth[D]> : string;
|
|
464
|
-
type InferSingleTemplateValue<T, D extends number> = T extends {
|
|
465
|
-
nullable: true;
|
|
466
|
-
} ? InferSingleTemplateValueBase<T, D> | null : InferSingleTemplateValueBase<T, D>;
|
|
467
|
-
/**
|
|
468
|
-
* Infers the value type for an array field.
|
|
469
|
-
* Handles four cases:
|
|
470
|
-
* 1. Simplified array with template + value → infer item type from value
|
|
471
|
-
* 2. Simplified array with array template (no value) → infer object type from template fields
|
|
472
|
-
* 3. Simplified array with single-field template (no value) → infer primitive type from template field
|
|
473
|
-
* 4. Full-API array with fields → infer from children
|
|
474
|
-
*/
|
|
475
|
-
type InferArrayValue<T, D extends number> = T extends {
|
|
476
|
-
template: unknown;
|
|
477
|
-
value: readonly (infer Item)[];
|
|
478
|
-
} ? Widen<Item>[] : T extends {
|
|
479
|
-
template: infer TArr;
|
|
480
|
-
} ? TArr extends readonly RegisteredFieldTypes[] ? InferFormValueWithDepth<[...TArr], Depth[D]>[] : InferSingleTemplateValue<TArr, D>[] : T extends {
|
|
481
|
-
fields: infer F;
|
|
482
|
-
} ? F extends RegisteredFieldTypes[] ? InferFormValueWithDepth<F, Depth[D]>[] : unknown[] : unknown[];
|
|
483
|
-
/** Process a single field and determine its contribution to the form value type */
|
|
484
|
-
type ProcessField<T, D extends number = 5> = [D] extends [never] ? Record<string, unknown> : T extends {
|
|
485
|
-
type: 'page' | 'row';
|
|
486
|
-
fields: infer F;
|
|
487
|
-
} ? F extends RegisteredFieldTypes[] ? InferFormValueWithDepth<F, Depth[D]> : never : T extends {
|
|
488
|
-
type: 'group';
|
|
489
|
-
key: infer K;
|
|
490
|
-
fields: infer F;
|
|
491
|
-
} ? K extends string ? F extends RegisteredFieldTypes[] ? {
|
|
492
|
-
[P in K]: InferFormValueWithDepth<F, Depth[D]>;
|
|
493
|
-
} : {
|
|
494
|
-
[P in K]: Record<string, unknown>;
|
|
495
|
-
} : never : T extends {
|
|
496
|
-
type: 'array';
|
|
497
|
-
key: infer K;
|
|
498
|
-
} ? K extends string ? {
|
|
499
|
-
[P in K]: InferArrayValue<T, D>;
|
|
500
|
-
} : never : T extends {
|
|
501
|
-
type: 'text';
|
|
502
|
-
} ? never : T extends {
|
|
503
|
-
type: 'submit' | 'button' | 'next' | 'previous' | 'addArrayItem' | 'removeArrayItem';
|
|
504
|
-
} ? never : T extends {
|
|
505
|
-
key: infer K;
|
|
506
|
-
value: infer V;
|
|
507
|
-
} ? K extends string ? {
|
|
508
|
-
[P in K]: MaybeOptional<T, InferValueType<T, V>>;
|
|
509
|
-
} : never : T extends {
|
|
510
|
-
key: infer K;
|
|
511
|
-
} ? K extends string ? {
|
|
512
|
-
[P in K]: MaybeOptional<T, T extends {
|
|
513
|
-
nullable: true;
|
|
514
|
-
} ? string | null : string>;
|
|
515
|
-
} : never : never;
|
|
516
|
-
/** Internal helper with depth tracking */
|
|
517
|
-
type InferFormValueWithDepth<T extends RegisteredFieldTypes[], D extends number = 5> = UnionToIntersection<ProcessField<T[number], D>>;
|
|
518
|
-
/** Helper to extract fields from either fields array or FormConfig */
|
|
519
|
-
type ExtractFields<T> = T extends {
|
|
520
|
-
fields: infer TFields;
|
|
521
|
-
} ? TFields extends readonly RegisteredFieldTypes[] ? TFields : never : T extends readonly RegisteredFieldTypes[] ? T : never;
|
|
522
|
-
/**
|
|
523
|
-
* Infer form value type from fields array or FormConfig.
|
|
524
|
-
* Recursively processes nested structures and merges the results.
|
|
525
|
-
* Limited to 5 levels of nesting to prevent infinite type instantiation.
|
|
526
|
-
*/
|
|
527
|
-
type InferFormValue$1<T> = ExtractFields<T> extends readonly RegisteredFieldTypes[] ? InferFormValueWithDepth<ExtractFields<T> extends RegisteredFieldTypes[] ? ExtractFields<T> : [...ExtractFields<T>], 5> : never;
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Custom validator function signature using Angular's public FieldContext API
|
|
531
|
-
*
|
|
532
|
-
* @template TValue The type of value stored in the field being validated
|
|
533
|
-
*/
|
|
534
|
-
type CustomValidator<TValue = unknown> = (ctx: FieldContext<TValue>, params?: Record<string, unknown>) => ValidationError$1 | ValidationError$1[] | null;
|
|
535
|
-
/**
|
|
536
|
-
* Async custom validator configuration using Angular's resource-based API
|
|
537
|
-
*
|
|
538
|
-
* @template TValue The type of value stored in the field being validated
|
|
539
|
-
* @template TParams The type of params passed to the resource
|
|
540
|
-
* @template TResult The type of result returned by the resource
|
|
541
|
-
*/
|
|
542
|
-
interface AsyncCustomValidator<TValue = unknown, TParams = unknown, TResult = unknown> {
|
|
543
|
-
/**
|
|
544
|
-
* Function that receives field context and returns resource params.
|
|
545
|
-
* Params will be tracked as a signal and trigger resource reload when changed.
|
|
546
|
-
*/
|
|
547
|
-
readonly params: (ctx: FieldContext<TValue>, config?: Record<string, unknown>) => TParams;
|
|
548
|
-
/**
|
|
549
|
-
* Function that creates a ResourceRef from the params signal.
|
|
550
|
-
* The resource will be automatically managed by Angular's lifecycle.
|
|
551
|
-
*/
|
|
552
|
-
readonly factory: (params: Signal<TParams | undefined>) => ResourceRef<TResult | undefined>;
|
|
553
|
-
/**
|
|
554
|
-
* Optional function to map successful resource result to validation errors.
|
|
555
|
-
* Return null if validation passes, or ValidationError/ValidationError[] if validation fails.
|
|
556
|
-
*/
|
|
557
|
-
readonly onSuccess?: (result: TResult, ctx: FieldContext<TValue>) => TreeValidationResult;
|
|
558
|
-
/**
|
|
559
|
-
* Optional error handler for resource errors (network failures, etc.).
|
|
560
|
-
* Return null to ignore the error, or ValidationError to display it to the user.
|
|
561
|
-
*/
|
|
562
|
-
readonly onError?: (error: unknown, ctx: FieldContext<TValue>) => ValidationError$1 | ValidationError$1[] | null;
|
|
563
|
-
}
|
|
564
|
-
/** HTTP request configuration for validateHttp API */
|
|
565
|
-
interface HttpResourceRequest {
|
|
566
|
-
url: string;
|
|
567
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
568
|
-
body?: unknown;
|
|
569
|
-
headers?: Record<string, string | string[]>;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* HTTP-based validator configuration for Angular's validateHttp API
|
|
573
|
-
*
|
|
574
|
-
* @template TValue The type of value stored in the field being validated
|
|
575
|
-
* @template TResult The type of HTTP response
|
|
576
|
-
*/
|
|
577
|
-
interface HttpCustomValidator<TValue = unknown, TResult = unknown> {
|
|
578
|
-
/**
|
|
579
|
-
* Function that returns the HTTP request configuration.
|
|
580
|
-
* Can return:
|
|
581
|
-
* - `undefined` to skip validation (e.g., if field is empty)
|
|
582
|
-
* - `string` for simple GET requests (just the URL)
|
|
583
|
-
* - `HttpResourceRequest` for full control (method, body, headers)
|
|
584
|
-
*/
|
|
585
|
-
readonly request: (ctx: FieldContext<TValue>, config?: Record<string, unknown>) => string | HttpResourceRequest | undefined;
|
|
586
|
-
/** REQUIRED function to map successful HTTP response to validation errors. */
|
|
587
|
-
readonly onSuccess: (result: TResult, ctx: FieldContext<TValue>) => TreeValidationResult;
|
|
588
|
-
/**
|
|
589
|
-
* Optional error handler for HTTP errors (network failures, 4xx/5xx status codes).
|
|
590
|
-
* Return null to ignore the error, or ValidationError to display it to the user.
|
|
591
|
-
*/
|
|
592
|
-
readonly onError?: (error: unknown, ctx: FieldContext<TValue>) => ValidationError$1 | ValidationError$1[] | null;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
/** Mapping configuration for interpreting HTTP responses as validation results. */
|
|
596
|
-
interface HttpValidationResponseMapping {
|
|
597
|
-
/** Expression evaluated with scope `{ response }`. Must evaluate to `true` (strict boolean) to be valid. */
|
|
598
|
-
validWhen: string;
|
|
599
|
-
/** Error kind returned when validation fails — maps to field-level `validationMessages` */
|
|
600
|
-
errorKind: string;
|
|
601
|
-
/**
|
|
602
|
-
* Parameters to include in the validation error for message interpolation.
|
|
603
|
-
* Map of parameter names to expressions evaluated against `{ response }`.
|
|
604
|
-
*/
|
|
605
|
-
errorParams?: Record<string, string>;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/** Base configuration shared by all validators */
|
|
609
|
-
interface BaseValidatorConfig {
|
|
610
|
-
/** Conditional logic for when validator applies */
|
|
611
|
-
when?: ConditionalExpression;
|
|
612
|
-
}
|
|
613
|
-
/** Built-in validator configuration (required, email, min, max, etc.) */
|
|
614
|
-
interface BuiltInValidatorConfig extends BaseValidatorConfig {
|
|
615
|
-
/** Validator type identifier */
|
|
616
|
-
type: 'required' | 'email' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern';
|
|
617
|
-
/** Static value for the validator (e.g., min value, pattern) */
|
|
618
|
-
value?: number | string | RegExp;
|
|
619
|
-
/** Dynamic value expression that evaluates to validator parameter */
|
|
620
|
-
expression?: string;
|
|
621
|
-
}
|
|
622
|
-
/**
|
|
623
|
-
* Custom validator configuration using Angular's public FieldContext API.
|
|
624
|
-
* Returns ValidationError | ValidationError[] | null synchronously.
|
|
625
|
-
*/
|
|
626
|
-
interface CustomValidatorConfig extends BaseValidatorConfig {
|
|
627
|
-
/** Validator type identifier */
|
|
628
|
-
type: 'custom';
|
|
629
|
-
/** Name of registered validator function (function-based pattern) */
|
|
630
|
-
functionName?: string;
|
|
631
|
-
/**
|
|
632
|
-
* Inline custom validator (code-only authoring).
|
|
633
|
-
* Mutually exclusive with `functionName`. NOT JSON-serializable.
|
|
634
|
-
*/
|
|
635
|
-
fn?: CustomValidator;
|
|
636
|
-
/** Optional parameters to pass to validator function */
|
|
637
|
-
params?: Record<string, unknown>;
|
|
638
|
-
/** JavaScript expression to evaluate (expression-based pattern) */
|
|
639
|
-
expression?: string;
|
|
640
|
-
/** Error kind for expression-based validators - links to validationMessages */
|
|
641
|
-
kind?: string;
|
|
642
|
-
/**
|
|
643
|
-
* Parameters to include in error object for message interpolation (expression-based pattern)
|
|
644
|
-
* Map of parameter names to expressions that will be evaluated in the same context as the validation expression
|
|
645
|
-
*/
|
|
646
|
-
errorParams?: Record<string, string>;
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Shared fields for both branches of {@link AsyncValidatorConfig}.
|
|
650
|
-
*
|
|
651
|
-
* @internal
|
|
652
|
-
*/
|
|
653
|
-
interface AsyncValidatorConfigShared extends BaseValidatorConfig {
|
|
654
|
-
/** Validator type identifier. */
|
|
655
|
-
type: 'async';
|
|
656
|
-
/** Optional parameters to pass to validator function */
|
|
657
|
-
params?: Record<string, unknown>;
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Async custom validator configuration using Angular's `validateAsync` API.
|
|
661
|
-
* Returns Observable<ValidationError | ValidationError[] | null>.
|
|
662
|
-
*/
|
|
663
|
-
type AsyncValidatorConfig = (AsyncValidatorConfigShared & {
|
|
664
|
-
/** Name of registered async validator function */
|
|
665
|
-
functionName: string;
|
|
666
|
-
/** Inline form is forbidden when `functionName` is set */
|
|
667
|
-
fn?: never;
|
|
668
|
-
}) | (AsyncValidatorConfigShared & {
|
|
669
|
-
/** Inline async validator. Mutually exclusive with `functionName`. */
|
|
670
|
-
fn: AsyncCustomValidator;
|
|
671
|
-
/** Registered form is forbidden when `fn` is set */
|
|
672
|
-
functionName?: never;
|
|
673
|
-
});
|
|
674
|
-
/**
|
|
675
|
-
* Shared fields for both branches of {@link FunctionHttpValidatorConfig}.
|
|
676
|
-
*
|
|
677
|
-
* @internal
|
|
678
|
-
*/
|
|
679
|
-
interface FunctionHttpValidatorConfigShared extends BaseValidatorConfig {
|
|
680
|
-
/** Validator type identifier. */
|
|
681
|
-
type: 'http';
|
|
682
|
-
/** Optional parameters to pass to HTTP validator */
|
|
683
|
-
params?: Record<string, unknown>;
|
|
684
|
-
}
|
|
685
|
-
/** Function-based HTTP validator configuration. Uses Angular's `validateHttp` API. */
|
|
686
|
-
type FunctionHttpValidatorConfig = (FunctionHttpValidatorConfigShared & {
|
|
687
|
-
/** Name of registered HTTP validator configuration */
|
|
688
|
-
functionName: string;
|
|
689
|
-
/** Inline form is forbidden when `functionName` is set */
|
|
690
|
-
fn?: never;
|
|
691
|
-
}) | (FunctionHttpValidatorConfigShared & {
|
|
692
|
-
/** Inline HTTP validator. Mutually exclusive with `functionName`. */
|
|
693
|
-
fn: HttpCustomValidator;
|
|
694
|
-
/** Registered form is forbidden when `fn` is set */
|
|
695
|
-
functionName?: never;
|
|
696
|
-
});
|
|
697
|
-
/** Declarative HTTP validator configuration — fully JSON-serializable, no function registration required. */
|
|
698
|
-
interface DeclarativeHttpValidatorConfig extends BaseValidatorConfig {
|
|
699
|
-
/** Validator type identifier */
|
|
700
|
-
type: 'http';
|
|
701
|
-
/** HTTP request configuration with expression-based query params and body */
|
|
702
|
-
http: HttpRequestConfig;
|
|
703
|
-
/** Mapping that interprets the HTTP response as a validation result */
|
|
704
|
-
responseMapping: HttpValidationResponseMapping;
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* Configuration for signal forms validator functions that can be serialized from API.
|
|
708
|
-
* Discriminated union type for type-safe validator configuration.
|
|
709
|
-
*/
|
|
710
|
-
type ValidatorConfig = BuiltInValidatorConfig | CustomValidatorConfig | AsyncValidatorConfig | FunctionHttpValidatorConfig | DeclarativeHttpValidatorConfig;
|
|
711
|
-
|
|
712
|
-
/** Special form-state conditions for button disabled logic. */
|
|
713
|
-
type FormStateCondition =
|
|
714
|
-
/** True when form.valid() === false */
|
|
715
|
-
'formInvalid'
|
|
716
|
-
/** True when form.submitting() === true */
|
|
717
|
-
| 'formSubmitting'
|
|
718
|
-
/** True when fields on the current page are invalid (for paged forms) */
|
|
719
|
-
| 'pageInvalid';
|
|
720
|
-
/** Logic type for controlling field state (hidden, readonly, disabled, required). */
|
|
721
|
-
type StateLogicType = 'hidden' | 'readonly' | 'disabled' | 'required';
|
|
722
|
-
/**
|
|
723
|
-
* Base configuration for conditional field state logic.
|
|
724
|
-
*
|
|
725
|
-
* @internal
|
|
726
|
-
*/
|
|
727
|
-
interface BaseStateLogicConfig {
|
|
728
|
-
/** Logic type identifier for field state. */
|
|
729
|
-
type: StateLogicType;
|
|
730
|
-
/** Condition that determines when this logic applies. */
|
|
731
|
-
condition: ConditionalExpression | boolean | FormStateCondition;
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* State logic that evaluates immediately on change (default).
|
|
735
|
-
*
|
|
736
|
-
* @internal
|
|
737
|
-
*/
|
|
738
|
-
interface ImmediateStateLogicConfig extends BaseStateLogicConfig {
|
|
739
|
-
/**
|
|
740
|
-
* Trigger for immediate evaluation.
|
|
741
|
-
*
|
|
742
|
-
* @default 'onChange'
|
|
743
|
-
*/
|
|
744
|
-
trigger?: 'onChange';
|
|
745
|
-
/** Not allowed for onChange trigger */
|
|
746
|
-
debounceMs?: never;
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* State logic that evaluates after a debounce period.
|
|
750
|
-
*
|
|
751
|
-
* @internal
|
|
752
|
-
*/
|
|
753
|
-
interface DebouncedStateLogicConfig extends BaseStateLogicConfig {
|
|
754
|
-
/**
|
|
755
|
-
* Trigger for debounced evaluation.
|
|
756
|
-
* Evaluates after the value has stabilized for the debounce duration.
|
|
757
|
-
*/
|
|
758
|
-
trigger: 'debounced';
|
|
759
|
-
/**
|
|
760
|
-
* Debounce duration in milliseconds.
|
|
761
|
-
*
|
|
762
|
-
* @default 500
|
|
763
|
-
*/
|
|
764
|
-
debounceMs?: number;
|
|
765
|
-
}
|
|
766
|
-
/** Configuration for conditional field state logic. */
|
|
767
|
-
type StateLogicConfig = ImmediateStateLogicConfig | DebouncedStateLogicConfig;
|
|
768
|
-
/**
|
|
769
|
-
* Shared fields that appear on all derivation logic config variants.
|
|
770
|
-
*
|
|
771
|
-
* @internal
|
|
772
|
-
*/
|
|
773
|
-
interface SharedDerivationFields {
|
|
774
|
-
/** Logic type identifier for value derivation. */
|
|
775
|
-
type: 'derivation';
|
|
776
|
-
/** Target property name for property derivation. */
|
|
777
|
-
targetProperty?: string;
|
|
778
|
-
/** Optional name for this derivation for debugging purposes. */
|
|
779
|
-
debugName?: string;
|
|
780
|
-
/** Condition that determines when this derivation applies. */
|
|
781
|
-
condition?: ConditionalExpression | boolean;
|
|
782
|
-
/**
|
|
783
|
-
* When true, the derivation stops running after the user manually
|
|
784
|
-
* edits the target field.
|
|
785
|
-
*/
|
|
786
|
-
stopOnUserOverride?: boolean;
|
|
787
|
-
/**
|
|
788
|
-
* When true (and `stopOnUserOverride` is also true), clears the
|
|
789
|
-
* user-override flag when any dependency of this derivation changes,
|
|
790
|
-
* allowing the derivation to run again.
|
|
791
|
-
*/
|
|
792
|
-
reEngageOnDependencyChange?: boolean;
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* Trigger variants for derivation timing.
|
|
796
|
-
*
|
|
797
|
-
* @internal
|
|
798
|
-
*/
|
|
799
|
-
type ImmediateDerivationTrigger = {
|
|
800
|
-
trigger?: 'onChange';
|
|
801
|
-
debounceMs?: never;
|
|
802
|
-
};
|
|
803
|
-
type DebouncedDerivationTrigger = {
|
|
804
|
-
trigger: 'debounced';
|
|
805
|
-
debounceMs?: number;
|
|
806
|
-
};
|
|
807
|
-
/**
|
|
808
|
-
* Base for HTTP derivations. `source: 'http'` is required.
|
|
809
|
-
* TypeScript enforces `dependsOn` and `responseExpression` at the type level.
|
|
810
|
-
*
|
|
811
|
-
* @internal
|
|
812
|
-
*/
|
|
813
|
-
interface HttpDerivationBase extends SharedDerivationFields {
|
|
814
|
-
/** Identifies this derivation as HTTP-driven. */
|
|
815
|
-
source: 'http';
|
|
816
|
-
/** Forbidden on HTTP source */
|
|
817
|
-
fn?: never;
|
|
818
|
-
/** Forbidden on HTTP source */
|
|
819
|
-
asyncFn?: never;
|
|
820
|
-
/** HTTP request configuration for server-driven derivations. */
|
|
821
|
-
http: HttpRequestConfig;
|
|
822
|
-
/**
|
|
823
|
-
* Explicit field dependencies. Required for HTTP derivations to prevent
|
|
824
|
-
* wildcard triggering on every keystroke.
|
|
825
|
-
*/
|
|
826
|
-
dependsOn: string[];
|
|
827
|
-
/** Expression to extract the derived value from the HTTP response. */
|
|
828
|
-
responseExpression: string;
|
|
829
|
-
value?: never;
|
|
830
|
-
expression?: never;
|
|
831
|
-
functionName?: never;
|
|
832
|
-
asyncFunctionName?: never;
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Shared fields for both branches of {@link AsyncFunctionDerivationBase}.
|
|
836
|
-
*
|
|
837
|
-
* @internal
|
|
838
|
-
*/
|
|
839
|
-
interface AsyncFunctionDerivationShared extends SharedDerivationFields {
|
|
840
|
-
/** Identifies this derivation as async-function-driven. */
|
|
841
|
-
source: 'asyncFunction';
|
|
842
|
-
/** Forbidden on asyncFunction source */
|
|
843
|
-
fn?: never;
|
|
844
|
-
/**
|
|
845
|
-
* Explicit field dependencies. Required for async derivations to prevent
|
|
846
|
-
* wildcard triggering on every form change.
|
|
847
|
-
*/
|
|
848
|
-
dependsOn: string[];
|
|
849
|
-
value?: never;
|
|
850
|
-
expression?: never;
|
|
851
|
-
functionName?: never;
|
|
852
|
-
http?: never;
|
|
853
|
-
responseExpression?: never;
|
|
854
|
-
}
|
|
855
|
-
/**
|
|
856
|
-
* Base for async function derivations. `source: 'asyncFunction'` is required.
|
|
857
|
-
* TypeScript enforces `dependsOn` at the type level, and `asyncFunctionName` /
|
|
858
|
-
* `asyncFn` are mutually exclusive (XOR).
|
|
859
|
-
*
|
|
860
|
-
* @internal
|
|
861
|
-
*/
|
|
862
|
-
type AsyncFunctionDerivationBase = (AsyncFunctionDerivationShared & {
|
|
863
|
-
/** Name of a registered async derivation function. */
|
|
864
|
-
asyncFunctionName: string;
|
|
865
|
-
/** Inline form is forbidden when `asyncFunctionName` is set */
|
|
866
|
-
asyncFn?: never;
|
|
867
|
-
}) | (AsyncFunctionDerivationShared & {
|
|
868
|
-
/** Inline async derivation function. Mutually exclusive with `asyncFunctionName`. */
|
|
869
|
-
asyncFn: AsyncDerivationFunction;
|
|
870
|
-
/** Registered form is forbidden when `asyncFn` is set */
|
|
871
|
-
asyncFunctionName?: never;
|
|
872
|
-
});
|
|
873
|
-
/**
|
|
874
|
-
* Base for expression derivations.
|
|
875
|
-
*
|
|
876
|
-
* @internal
|
|
877
|
-
*/
|
|
878
|
-
interface ExpressionDerivationBase extends SharedDerivationFields {
|
|
879
|
-
source?: never;
|
|
880
|
-
/** Forbidden on expression mode */
|
|
881
|
-
fn?: never;
|
|
882
|
-
/** Forbidden on expression mode */
|
|
883
|
-
asyncFn?: never;
|
|
884
|
-
/** JavaScript expression to evaluate for the derived value. */
|
|
885
|
-
expression: string;
|
|
886
|
-
/** Explicit field dependencies for expressions. */
|
|
887
|
-
dependsOn?: string[];
|
|
888
|
-
value?: never;
|
|
889
|
-
functionName?: never;
|
|
890
|
-
http?: never;
|
|
891
|
-
asyncFunctionName?: never;
|
|
892
|
-
responseExpression?: never;
|
|
893
|
-
}
|
|
894
|
-
/**
|
|
895
|
-
* Base for value derivations.
|
|
896
|
-
*
|
|
897
|
-
* @internal
|
|
898
|
-
*/
|
|
899
|
-
interface ValueDerivationBase extends SharedDerivationFields {
|
|
900
|
-
source?: never;
|
|
901
|
-
/** Forbidden on value mode */
|
|
902
|
-
fn?: never;
|
|
903
|
-
/** Forbidden on value mode */
|
|
904
|
-
asyncFn?: never;
|
|
905
|
-
/** Static value to set on this field. */
|
|
906
|
-
value: unknown;
|
|
907
|
-
/** Explicit field dependencies for value derivations. */
|
|
908
|
-
dependsOn?: string[];
|
|
909
|
-
expression?: never;
|
|
910
|
-
functionName?: never;
|
|
911
|
-
http?: never;
|
|
912
|
-
asyncFunctionName?: never;
|
|
913
|
-
responseExpression?: never;
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* Shared fields for both branches of {@link FunctionDerivationBase}.
|
|
917
|
-
*
|
|
918
|
-
* @internal
|
|
919
|
-
*/
|
|
920
|
-
interface FunctionDerivationShared extends SharedDerivationFields {
|
|
921
|
-
source?: never;
|
|
922
|
-
/** Forbidden on function-derivation mode */
|
|
923
|
-
asyncFn?: never;
|
|
924
|
-
/** Explicit field dependencies for function derivations. */
|
|
925
|
-
dependsOn?: string[];
|
|
926
|
-
value?: never;
|
|
927
|
-
expression?: never;
|
|
928
|
-
http?: never;
|
|
929
|
-
asyncFunctionName?: never;
|
|
930
|
-
responseExpression?: never;
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* Base for custom sync function derivations. `functionName` and `fn` are
|
|
934
|
-
* mutually exclusive (XOR).
|
|
935
|
-
*
|
|
936
|
-
* @internal
|
|
937
|
-
*/
|
|
938
|
-
type FunctionDerivationBase = (FunctionDerivationShared & {
|
|
939
|
-
/** Name of a registered custom derivation function. */
|
|
940
|
-
functionName: string;
|
|
941
|
-
/** Inline form is forbidden when `functionName` is set */
|
|
942
|
-
fn?: never;
|
|
943
|
-
}) | (FunctionDerivationShared & {
|
|
944
|
-
/** Inline custom derivation function. Mutually exclusive with `functionName`. */
|
|
945
|
-
fn: CustomFunction;
|
|
946
|
-
/** Registered form is forbidden when `fn` is set */
|
|
947
|
-
functionName?: never;
|
|
948
|
-
});
|
|
949
|
-
/**
|
|
950
|
-
* HTTP derivation that evaluates immediately on change (default).
|
|
951
|
-
*
|
|
952
|
-
* @internal
|
|
953
|
-
*/
|
|
954
|
-
type OnChangeHttpDerivationLogicConfig = HttpDerivationBase & ImmediateDerivationTrigger;
|
|
955
|
-
/**
|
|
956
|
-
* HTTP derivation that evaluates after a debounce period.
|
|
957
|
-
*
|
|
958
|
-
* @internal
|
|
959
|
-
*/
|
|
960
|
-
type DebouncedHttpDerivationLogicConfig = HttpDerivationBase & DebouncedDerivationTrigger;
|
|
961
|
-
/**
|
|
962
|
-
* Async function derivation that evaluates immediately on change (default).
|
|
963
|
-
*
|
|
964
|
-
* @internal
|
|
965
|
-
*/
|
|
966
|
-
type OnChangeAsyncFunctionDerivationLogicConfig = AsyncFunctionDerivationBase & ImmediateDerivationTrigger;
|
|
967
|
-
/**
|
|
968
|
-
* Async function derivation that evaluates after a debounce period.
|
|
969
|
-
*
|
|
970
|
-
* @internal
|
|
971
|
-
*/
|
|
972
|
-
type DebouncedAsyncFunctionDerivationLogicConfig = AsyncFunctionDerivationBase & DebouncedDerivationTrigger;
|
|
973
|
-
/**
|
|
974
|
-
* Expression derivation that evaluates immediately on change (default).
|
|
975
|
-
*
|
|
976
|
-
* @internal
|
|
977
|
-
*/
|
|
978
|
-
type OnChangeExpressionDerivationLogicConfig = ExpressionDerivationBase & ImmediateDerivationTrigger;
|
|
979
|
-
/**
|
|
980
|
-
* Expression derivation that evaluates after a debounce period.
|
|
981
|
-
*
|
|
982
|
-
* @internal
|
|
983
|
-
*/
|
|
984
|
-
type DebouncedExpressionDerivationLogicConfig = ExpressionDerivationBase & DebouncedDerivationTrigger;
|
|
985
|
-
/**
|
|
986
|
-
* Value derivation that evaluates immediately on change (default).
|
|
987
|
-
*
|
|
988
|
-
* @internal
|
|
989
|
-
*/
|
|
990
|
-
type OnChangeValueDerivationLogicConfig = ValueDerivationBase & ImmediateDerivationTrigger;
|
|
991
|
-
/**
|
|
992
|
-
* Value derivation that evaluates after a debounce period.
|
|
993
|
-
*
|
|
994
|
-
* @internal
|
|
995
|
-
*/
|
|
996
|
-
type DebouncedValueDerivationLogicConfig = ValueDerivationBase & DebouncedDerivationTrigger;
|
|
997
|
-
/**
|
|
998
|
-
* Function derivation that evaluates immediately on change (default).
|
|
999
|
-
*
|
|
1000
|
-
* @internal
|
|
1001
|
-
*/
|
|
1002
|
-
type OnChangeFunctionDerivationLogicConfig = FunctionDerivationBase & ImmediateDerivationTrigger;
|
|
1003
|
-
/**
|
|
1004
|
-
* Function derivation that evaluates after a debounce period.
|
|
1005
|
-
*
|
|
1006
|
-
* @internal
|
|
1007
|
-
*/
|
|
1008
|
-
type DebouncedFunctionDerivationLogicConfig = FunctionDerivationBase & DebouncedDerivationTrigger;
|
|
1009
|
-
/** Configuration for value derivation logic. */
|
|
1010
|
-
type DerivationLogicConfig = OnChangeHttpDerivationLogicConfig | DebouncedHttpDerivationLogicConfig | OnChangeAsyncFunctionDerivationLogicConfig | DebouncedAsyncFunctionDerivationLogicConfig | OnChangeExpressionDerivationLogicConfig | DebouncedExpressionDerivationLogicConfig | OnChangeValueDerivationLogicConfig | DebouncedValueDerivationLogicConfig | OnChangeFunctionDerivationLogicConfig | DebouncedFunctionDerivationLogicConfig;
|
|
1011
|
-
/** Union type for all logic configurations. */
|
|
1012
|
-
type LogicConfig = StateLogicConfig | DerivationLogicConfig;
|
|
1013
|
-
/** Log level for derivation debug output. */
|
|
1014
|
-
type DerivationLogLevel = 'none' | 'summary' | 'verbose';
|
|
1015
|
-
/**
|
|
1016
|
-
* Type guard to check if a condition is a FormStateCondition.
|
|
1017
|
-
*
|
|
1018
|
-
* @param condition - The condition to check
|
|
1019
|
-
* @returns true if the condition is a FormStateCondition
|
|
1020
|
-
*/
|
|
1021
|
-
declare function isFormStateCondition(condition: StateLogicConfig['condition'] | DerivationLogicConfig['condition']): condition is FormStateCondition;
|
|
1022
|
-
|
|
1023
|
-
/** Configuration for applying predefined schemas */
|
|
1024
|
-
interface SchemaApplicationConfig {
|
|
1025
|
-
/** Schema application type */
|
|
1026
|
-
type: 'apply' | 'applyWhen' | 'applyWhenValue' | 'applyEach';
|
|
1027
|
-
/** Schema identifier or inline schema definition */
|
|
1028
|
-
schema: string | SchemaDefinition;
|
|
1029
|
-
/** Condition for conditional application */
|
|
1030
|
-
condition?: ConditionalExpression;
|
|
1031
|
-
/** Type predicate for applyWhenValue */
|
|
1032
|
-
typePredicate?: string;
|
|
1033
|
-
}
|
|
1034
|
-
/** Reusable schema definition that can be referenced by name */
|
|
1035
|
-
interface SchemaDefinition {
|
|
1036
|
-
/** Unique schema identifier */
|
|
1037
|
-
name: string;
|
|
1038
|
-
/** Schema description */
|
|
1039
|
-
description?: string;
|
|
1040
|
-
/** Field path pattern this schema applies to */
|
|
1041
|
-
pathPattern?: string;
|
|
1042
|
-
/** Validators to apply */
|
|
1043
|
-
validators?: ValidatorConfig[];
|
|
1044
|
-
/** Logic rules to apply */
|
|
1045
|
-
logic?: LogicConfig[];
|
|
1046
|
-
/** Nested schema applications */
|
|
1047
|
-
subSchemas?: SchemaApplicationConfig[];
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
/**
|
|
1051
|
-
* Re-export Angular's ValidationError for consistency
|
|
1052
|
-
* This replaces our custom ValidationError interface
|
|
1053
|
-
*/
|
|
1054
|
-
type ValidationError = ValidationError$1;
|
|
1055
|
-
interface ValidationMessages {
|
|
1056
|
-
required?: DynamicText;
|
|
1057
|
-
email?: DynamicText;
|
|
1058
|
-
min?: DynamicText;
|
|
1059
|
-
max?: DynamicText;
|
|
1060
|
-
minLength?: DynamicText;
|
|
1061
|
-
maxLength?: DynamicText;
|
|
1062
|
-
pattern?: DynamicText;
|
|
1063
|
-
[key: string]: DynamicText | undefined;
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* The result type for submission actions.
|
|
1068
|
-
* Can be either a Promise or an Observable.
|
|
1069
|
-
*/
|
|
1070
|
-
type SubmissionActionResult = Promise<TreeValidationResult> | Observable<TreeValidationResult | unknown>;
|
|
1071
|
-
/**
|
|
1072
|
-
* Configuration for form submission handling.
|
|
1073
|
-
*
|
|
1074
|
-
* @typeParam TValue - The form value type
|
|
1075
|
-
*/
|
|
1076
|
-
interface SubmissionConfig<TValue = unknown> {
|
|
1077
|
-
/**
|
|
1078
|
-
* Action called when the form is submitted.
|
|
1079
|
-
*
|
|
1080
|
-
* @param form - The form's FieldTree instance
|
|
1081
|
-
* @returns Promise or Observable - for errors, return TreeValidationResult
|
|
1082
|
-
*/
|
|
1083
|
-
action: (form: FieldTree<TValue>) => SubmissionActionResult;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* Configuration interface for defining dynamic form structure and behavior.
|
|
1088
|
-
*
|
|
1089
|
-
* @typeParam TFields - Array of registered field types available for this form
|
|
1090
|
-
* @typeParam TValue - The strongly-typed interface for form values
|
|
1091
|
-
* @typeParam TProps - The type for form-level default props (library-specific)
|
|
1092
|
-
*/
|
|
1093
|
-
interface FormConfig<TFields extends NarrowFields | RegisteredFieldTypes[] = RegisteredFieldTypes[], TValue = InferFormValue$1<TFields extends readonly RegisteredFieldTypes[] ? TFields : RegisteredFieldTypes[]>, TProps extends object = Record<string, unknown>, TSchemaValue = unknown> {
|
|
1094
|
-
/** Array of field definitions that define the form structure. */
|
|
1095
|
-
fields: TFields;
|
|
1096
|
-
/** Optional form-level validation schema using Standard Schema spec. */
|
|
1097
|
-
schema?: FormSchema<TSchemaValue>;
|
|
1098
|
-
/**
|
|
1099
|
-
* Global form configuration options.
|
|
1100
|
-
*
|
|
1101
|
-
* @value {}
|
|
1102
|
-
*/
|
|
1103
|
-
options?: FormOptions;
|
|
1104
|
-
/** Global schemas available to all fields. */
|
|
1105
|
-
schemas?: SchemaDefinition[];
|
|
1106
|
-
/** Form-level validation messages that act as fallback for field-level messages. */
|
|
1107
|
-
defaultValidationMessages?: ValidationMessages;
|
|
1108
|
-
/** Signal forms adapter configuration. */
|
|
1109
|
-
customFnConfig?: CustomFnConfig<TValue extends Record<string, unknown> ? TValue : Record<string, unknown>>;
|
|
1110
|
-
/** Form submission configuration. */
|
|
1111
|
-
submission?: SubmissionConfig<TValue>;
|
|
1112
|
-
/** Default props applied to all fields in the form. */
|
|
1113
|
-
defaultProps?: TProps;
|
|
1114
|
-
/** External data signals available to conditional logic and derivations. */
|
|
1115
|
-
externalData?: Record<string, Signal<unknown>>;
|
|
1116
|
-
/** Form-wide default wrappers applied to every field that does not explicitly opt out. */
|
|
1117
|
-
defaultWrappers?: readonly WrapperConfig[];
|
|
1118
|
-
}
|
|
1119
|
-
/** Signal forms adapter configuration for advanced form behavior. */
|
|
1120
|
-
interface CustomFnConfig<TFormValue extends Record<string, unknown> = Record<string, unknown>> {
|
|
1121
|
-
/** Custom evaluation functions for conditional expressions. */
|
|
1122
|
-
customFunctions?: Record<string, CustomFunction<TFormValue>>;
|
|
1123
|
-
/** Custom derivation functions for value derivation logic. */
|
|
1124
|
-
derivations?: Record<string, CustomFunction<TFormValue>>;
|
|
1125
|
-
/** Async derivation functions for asynchronous value derivation logic. */
|
|
1126
|
-
asyncDerivations?: Record<string, AsyncDerivationFunction<TFormValue>>;
|
|
1127
|
-
/** Async condition functions for asynchronous field state logic. */
|
|
1128
|
-
asyncConditions?: Record<string, AsyncConditionFunction<TFormValue>>;
|
|
1129
|
-
/** Custom validators using Angular's public FieldContext API */
|
|
1130
|
-
validators?: Record<string, CustomValidator>;
|
|
1131
|
-
/** Async custom validators using Angular's resource-based validateAsync() API */
|
|
1132
|
-
asyncValidators?: Record<string, AsyncCustomValidator>;
|
|
1133
|
-
/** HTTP validators using Angular's validateHttp() API. */
|
|
1134
|
-
httpValidators?: Record<string, HttpCustomValidator>;
|
|
1135
|
-
}
|
|
1136
|
-
/** Global form configuration options. */
|
|
1137
|
-
interface FormOptions {
|
|
1138
|
-
/**
|
|
1139
|
-
* Disable the entire form.
|
|
1140
|
-
*
|
|
1141
|
-
* @value false
|
|
1142
|
-
*/
|
|
1143
|
-
disabled?: boolean;
|
|
1144
|
-
/**
|
|
1145
|
-
* Prefix scoping every field's DOM `id` (and matching `for` / `data-testid` /
|
|
1146
|
-
* `aria-describedby`) to this form instance, as the outermost id segment:
|
|
1147
|
-
* `{idPrefix}_{group}_{key}_{index}`. Use it when rendering multiple forms
|
|
1148
|
-
* from the same config on one page so their ids don't collide.
|
|
1149
|
-
*
|
|
1150
|
-
* When omitted, a lone form stays unprefixed and a generated prefix (`df-1`,
|
|
1151
|
-
* `df-2`, …) is applied automatically once a second form is mounted. Characters
|
|
1152
|
-
* invalid in an id token (whitespace, punctuation) are replaced with `_`.
|
|
1153
|
-
*
|
|
1154
|
-
* @example
|
|
1155
|
-
* ```typescript
|
|
1156
|
-
* options: { idPrefix: 'billing' } // → id="billing_email-input"
|
|
1157
|
-
* ```
|
|
1158
|
-
*
|
|
1159
|
-
* @default undefined (auto-prefix only when multiple forms are mounted)
|
|
1160
|
-
*/
|
|
1161
|
-
idPrefix?: string;
|
|
1162
|
-
/**
|
|
1163
|
-
* Maximum number of iterations for derivation chain processing.
|
|
1164
|
-
*
|
|
1165
|
-
* @default 10
|
|
1166
|
-
*/
|
|
1167
|
-
maxDerivationIterations?: number;
|
|
1168
|
-
/** Default disabled behavior for submit buttons. */
|
|
1169
|
-
submitButton?: SubmitButtonOptions;
|
|
1170
|
-
/** Default disabled behavior for next page buttons. */
|
|
1171
|
-
nextButton?: NextButtonOptions;
|
|
1172
|
-
/**
|
|
1173
|
-
* Whether to exclude values of hidden fields from submission output.
|
|
1174
|
-
*
|
|
1175
|
-
* @default undefined (uses global setting)
|
|
1176
|
-
*/
|
|
1177
|
-
excludeValueIfHidden?: boolean;
|
|
1178
|
-
/**
|
|
1179
|
-
* Whether to exclude values of disabled fields from submission output.
|
|
1180
|
-
*
|
|
1181
|
-
* @default undefined (uses global setting)
|
|
1182
|
-
*/
|
|
1183
|
-
excludeValueIfDisabled?: boolean;
|
|
1184
|
-
/**
|
|
1185
|
-
* Whether to exclude values of readonly fields from submission output.
|
|
1186
|
-
*
|
|
1187
|
-
* @default undefined (uses global setting)
|
|
1188
|
-
*/
|
|
1189
|
-
excludeValueIfReadonly?: boolean;
|
|
1190
|
-
/**
|
|
1191
|
-
* Whether to run validation when a field is hidden.
|
|
1192
|
-
*
|
|
1193
|
-
* @default undefined (uses global setting, which defaults to `false`)
|
|
1194
|
-
*/
|
|
1195
|
-
validateWhenHidden?: boolean;
|
|
1196
|
-
/**
|
|
1197
|
-
* Whether to attach the current form value to all events dispatched through the EventBus.
|
|
1198
|
-
*
|
|
1199
|
-
* @default undefined (uses global setting)
|
|
1200
|
-
*/
|
|
1201
|
-
emitFormValueOnEvents?: boolean;
|
|
1202
|
-
}
|
|
1203
|
-
/** Options for controlling submit button disabled behavior. */
|
|
1204
|
-
interface SubmitButtonOptions {
|
|
1205
|
-
/**
|
|
1206
|
-
* Disable submit button when the form is invalid.
|
|
1207
|
-
*
|
|
1208
|
-
* @default true
|
|
1209
|
-
*/
|
|
1210
|
-
disableWhenInvalid?: boolean;
|
|
1211
|
-
/**
|
|
1212
|
-
* Disable submit button while the form is submitting.
|
|
1213
|
-
*
|
|
1214
|
-
* @default true
|
|
1215
|
-
*/
|
|
1216
|
-
disableWhileSubmitting?: boolean;
|
|
1217
|
-
}
|
|
1218
|
-
/** Options for controlling next page button disabled behavior. */
|
|
1219
|
-
interface NextButtonOptions {
|
|
1220
|
-
/**
|
|
1221
|
-
* Disable next button when the current page has invalid fields.
|
|
1222
|
-
*
|
|
1223
|
-
* @default true
|
|
1224
|
-
*/
|
|
1225
|
-
disableWhenPageInvalid?: boolean;
|
|
1226
|
-
/**
|
|
1227
|
-
* Disable next button while the form is submitting.
|
|
1228
|
-
*
|
|
1229
|
-
* @default true
|
|
1230
|
-
*/
|
|
1231
|
-
disableWhileSubmitting?: boolean;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
/** Context for resolving button disabled state. */
|
|
1235
|
-
interface ButtonLogicContext {
|
|
1236
|
-
/** The form's FieldTree instance (supports both string and number keys for array indices) */
|
|
1237
|
-
form: FieldTree<unknown, string | number>;
|
|
1238
|
-
/** Form-level options */
|
|
1239
|
-
formOptions?: FormOptions;
|
|
1240
|
-
/** Field-level logic array (if provided) */
|
|
1241
|
-
fieldLogic?: LogicConfig[];
|
|
1242
|
-
/** Explicit disabled state from field definition */
|
|
1243
|
-
explicitlyDisabled?: boolean;
|
|
1244
|
-
/** Current page validity signal (for paged forms) */
|
|
1245
|
-
currentPageValid?: Signal<boolean>;
|
|
1246
|
-
/** Current form value for evaluating conditional expressions */
|
|
1247
|
-
formValue?: unknown;
|
|
1248
|
-
/** Optional logger for diagnostic output. Falls back to no-op logger if not provided. */
|
|
1249
|
-
logger?: Logger;
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Allowed logic types for non-form-bound elements (buttons, text fields, etc.).
|
|
1253
|
-
* These elements only support hidden and disabled states - not readonly or required
|
|
1254
|
-
* since they don't participate in form validation.
|
|
1255
|
-
*/
|
|
1256
|
-
type NonFieldLogicType = 'hidden' | 'disabled';
|
|
1257
|
-
/**
|
|
1258
|
-
* Logic config restricted to types valid for non-form-bound elements.
|
|
1259
|
-
* This is a subset of LogicConfig that only includes hidden and disabled types.
|
|
1260
|
-
*/
|
|
1261
|
-
type NonFieldLogicConfig = LogicConfig & {
|
|
1262
|
-
type: NonFieldLogicType;
|
|
1263
|
-
};
|
|
1264
|
-
/** Context for resolving state (hidden/disabled) for non-form-bound elements. */
|
|
1265
|
-
interface NonFieldLogicContext {
|
|
1266
|
-
/** The form's FieldTree instance (supports both string and number keys for array indices) */
|
|
1267
|
-
form: FieldTree<unknown, string | number>;
|
|
1268
|
-
/**
|
|
1269
|
-
* Field-level logic array containing conditions.
|
|
1270
|
-
* Accepts full LogicConfig[] for compatibility, but only hidden and disabled types are processed.
|
|
1271
|
-
*/
|
|
1272
|
-
fieldLogic?: LogicConfig[];
|
|
1273
|
-
/** Explicit state from field definition (e.g., `hidden: true` or `disabled: true`) */
|
|
1274
|
-
explicitValue?: boolean;
|
|
1275
|
-
/** Current form value for evaluating conditional expressions */
|
|
1276
|
-
formValue?: unknown;
|
|
1277
|
-
/** Optional logger for diagnostic output. Falls back to no-op logger if not provided. */
|
|
1278
|
-
logger?: Logger;
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* Resolves the disabled state for a submit button.
|
|
1282
|
-
*
|
|
1283
|
-
* @param ctx - The button logic context
|
|
1284
|
-
* @returns A computed signal that returns true when the button should be disabled
|
|
1285
|
-
*/
|
|
1286
|
-
declare function resolveSubmitButtonDisabled(ctx: ButtonLogicContext): Signal<boolean>;
|
|
1287
|
-
/**
|
|
1288
|
-
* Resolves the disabled state for a next page button.
|
|
1289
|
-
*
|
|
1290
|
-
* @param ctx - The button logic context
|
|
1291
|
-
* @returns A computed signal that returns true when the button should be disabled
|
|
1292
|
-
*/
|
|
1293
|
-
declare function resolveNextButtonDisabled(ctx: ButtonLogicContext): Signal<boolean>;
|
|
1294
|
-
/**
|
|
1295
|
-
* Evaluates the hidden state for non-form-bound elements synchronously.
|
|
1296
|
-
*
|
|
1297
|
-
* @param ctx - The context containing form, logic array, and explicit hidden state
|
|
1298
|
-
* @returns true when the element should be hidden
|
|
1299
|
-
*/
|
|
1300
|
-
declare function evaluateNonFieldHidden(ctx: NonFieldLogicContext): boolean;
|
|
1301
|
-
/**
|
|
1302
|
-
* Resolves the hidden state for non-form-bound elements as a reactive signal.
|
|
1303
|
-
*
|
|
1304
|
-
* @param ctx - The context containing form, logic array, and explicit hidden state
|
|
1305
|
-
* @returns A computed signal that returns true when the element should be hidden
|
|
1306
|
-
*/
|
|
1307
|
-
declare function resolveNonFieldHidden(ctx: NonFieldLogicContext): Signal<boolean>;
|
|
1308
|
-
/**
|
|
1309
|
-
* Evaluates the disabled state for non-form-bound elements synchronously.
|
|
1310
|
-
*
|
|
1311
|
-
* @param ctx - The context containing form, logic array, and explicit disabled state
|
|
1312
|
-
* @returns true when the element should be disabled
|
|
1313
|
-
*/
|
|
1314
|
-
declare function evaluateNonFieldDisabled(ctx: NonFieldLogicContext): boolean;
|
|
1315
|
-
/**
|
|
1316
|
-
* Resolves the disabled state for non-form-bound elements as a reactive signal.
|
|
1317
|
-
*
|
|
1318
|
-
* @param ctx - The context containing form, logic array, and explicit disabled state
|
|
1319
|
-
* @returns A computed signal that returns true when the element should be disabled
|
|
1320
|
-
*/
|
|
1321
|
-
declare function resolveNonFieldDisabled(ctx: NonFieldLogicContext): Signal<boolean>;
|
|
1322
|
-
|
|
1323
|
-
/** Text element type for rendering different HTML text elements */
|
|
1324
|
-
type TextElementType = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
|
|
1325
|
-
/** Properties for text field configuration */
|
|
1326
|
-
type TextProps = {
|
|
1327
|
-
/** The HTML element type to render */
|
|
1328
|
-
elementType: TextElementType;
|
|
1329
|
-
};
|
|
1330
|
-
/** Text field definition for displaying translatable text content */
|
|
1331
|
-
interface TextField extends FieldDef<TextProps> {
|
|
1332
|
-
type: 'text';
|
|
1333
|
-
/**
|
|
1334
|
-
* Logic rules for conditional visibility.
|
|
1335
|
-
* Text fields only support 'hidden' logic type since they are display-only
|
|
1336
|
-
* and don't participate in form validation (no disabled/readonly/required).
|
|
1337
|
-
*/
|
|
1338
|
-
readonly logic?: NonFieldLogicConfig[];
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
/**
|
|
1342
|
-
* Scalar types supported by hidden fields.
|
|
1343
|
-
* These are the primitive value types that can be stored.
|
|
1344
|
-
*/
|
|
1345
|
-
type HiddenScalar = string | number | boolean;
|
|
1346
|
-
/**
|
|
1347
|
-
* All value types supported by hidden fields.
|
|
1348
|
-
* Supports both scalar values and arrays of scalars for storing
|
|
1349
|
-
* multiple IDs or similar data.
|
|
1350
|
-
*/
|
|
1351
|
-
type HiddenValue = HiddenScalar | HiddenScalar[];
|
|
1352
|
-
/**
|
|
1353
|
-
* Hidden field definition for storing values without rendering UI.
|
|
1354
|
-
*
|
|
1355
|
-
* @typeParam TValue - The type of value stored (must be HiddenValue compatible)
|
|
1356
|
-
*/
|
|
1357
|
-
interface HiddenField<TValue extends HiddenValue = HiddenValue> extends FieldDef<never> {
|
|
1358
|
-
/** Discriminant for hidden field type */
|
|
1359
|
-
type: 'hidden';
|
|
1360
|
-
/**
|
|
1361
|
-
* The value to store in the form.
|
|
1362
|
-
* This is required - a hidden field without a value serves no purpose.
|
|
1363
|
-
*/
|
|
1364
|
-
value: TValue;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
/** Configuration for the built-in 'css' wrapper type. */
|
|
1368
|
-
interface CssWrapper {
|
|
1369
|
-
readonly type: 'css';
|
|
1370
|
-
/** CSS classes to apply to the wrapper */
|
|
1371
|
-
readonly cssClasses?: DynamicText;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
/** Configuration for the built-in 'row' wrapper type. */
|
|
1375
|
-
interface RowWrapper {
|
|
1376
|
-
readonly type: 'row';
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
/** Resolves a wrapper type name to its registered config interface. */
|
|
1380
|
-
type WrapperConfig<TWrappers extends RegisteredWrapperTypes = RegisteredWrapperTypes> = TWrappers extends keyof FieldRegistryWrappers ? FieldRegistryWrappers[TWrappers] : {
|
|
1381
|
-
readonly type: TWrappers;
|
|
1382
|
-
};
|
|
1383
|
-
/**
|
|
1384
|
-
* Signature of a lazy component loader — either a direct component class or
|
|
1385
|
-
* an ES module whose `default` export is the component. Shared by field and
|
|
1386
|
-
* wrapper registrations so the `loadComponent: () => import('./x.component')`
|
|
1387
|
-
* idiom types cleanly in both places.
|
|
1388
|
-
*/
|
|
1389
|
-
type LazyComponentLoader<T = unknown> = () => Promise<Type<T> | {
|
|
1390
|
-
default: Type<T>;
|
|
1391
|
-
}>;
|
|
1392
|
-
/** Configuration interface for registering wrapper types. */
|
|
1393
|
-
interface WrapperTypeDefinition<T extends WrapperConfig = WrapperConfig> {
|
|
1394
|
-
/** Unique identifier for the wrapper type (also serves as discriminant from FieldTypeDefinition) */
|
|
1395
|
-
wrapperName: string;
|
|
1396
|
-
/** Wrapper definition type marker (internal use) */
|
|
1397
|
-
_wrapper?: T;
|
|
1398
|
-
/**
|
|
1399
|
-
* Function to load the wrapper component (supports lazy loading).
|
|
1400
|
-
* Returns a Promise that resolves to the component class or module with default export.
|
|
1401
|
-
*/
|
|
1402
|
-
loadComponent: LazyComponentLoader;
|
|
1403
|
-
/** Field types this wrapper should auto-apply to. */
|
|
1404
|
-
types?: readonly string[];
|
|
1405
|
-
}
|
|
1406
|
-
/** Type guard for WrapperTypeDefinition. */
|
|
1407
|
-
declare function isWrapperTypeDefinition(value: unknown): value is WrapperTypeDefinition;
|
|
1408
|
-
/**
|
|
1409
|
-
* Contract that wrapper components must satisfy.
|
|
1410
|
-
*
|
|
1411
|
-
* @Component({
|
|
1412
|
-
* template: `
|
|
1413
|
-
* <dbx-section [header]="header() ?? ''">
|
|
1414
|
-
* <ng-container #fieldComponent></ng-container>
|
|
1415
|
-
* </dbx-section>
|
|
1416
|
-
* `,
|
|
1417
|
-
* })
|
|
1418
|
-
* export class SectionWrapperComponent implements FieldWrapper {
|
|
1419
|
-
* readonly fieldComponent = viewChild.required('fieldComponent', { read: ViewContainerRef });
|
|
1420
|
-
* readonly header = input<string>();
|
|
1421
|
-
* readonly fieldInputs = input<WrapperFieldInputs>();
|
|
1422
|
-
* }
|
|
1423
|
-
* ```
|
|
1424
|
-
*/
|
|
1425
|
-
interface FieldWrapper {
|
|
1426
|
-
/** ViewContainerRef slot where inner content is rendered */
|
|
1427
|
-
readonly fieldComponent: Signal<ViewContainerRef>;
|
|
1428
|
-
}
|
|
1429
|
-
/** Injection token for the wrapper type registry. */
|
|
1430
|
-
declare const WRAPPER_REGISTRY: InjectionToken<Map<string, WrapperTypeDefinition<RowWrapper | _ng_forge_dynamic_forms.CssWrapper>>>;
|
|
1431
|
-
|
|
1432
|
-
/** Container field interface for wrapping child fields with UI chrome. */
|
|
1433
|
-
interface ContainerField<TFields extends readonly ContainerAllowedChildren[] = readonly ContainerAllowedChildren[], TWrapperConfigs extends readonly WrapperConfig[] = readonly WrapperConfig[]> extends FieldDef<never> {
|
|
1434
|
-
type: 'container';
|
|
1435
|
-
/** Child definitions to render within this container */
|
|
1436
|
-
readonly fields: TFields;
|
|
1437
|
-
/**
|
|
1438
|
-
* Wrapper components to chain around the children.
|
|
1439
|
-
* Applied outermost-first: the first wrapper in the array is the outermost.
|
|
1440
|
-
* Each wrapper component receives the subsequent wrapper (or children) inside
|
|
1441
|
-
* its `#fieldComponent` ViewContainerRef slot.
|
|
1442
|
-
*/
|
|
1443
|
-
readonly wrappers: TWrapperConfigs;
|
|
1444
|
-
/** Container fields do not have a label property */
|
|
1445
|
-
readonly label?: never;
|
|
1446
|
-
/** Containers do not support meta — they have no native form element */
|
|
1447
|
-
readonly meta?: never;
|
|
1448
|
-
/**
|
|
1449
|
-
* Logic configurations for conditional container visibility.
|
|
1450
|
-
* Only 'hidden' type logic is supported for containers.
|
|
1451
|
-
*/
|
|
1452
|
-
readonly logic?: ContainerLogicConfig[];
|
|
1453
|
-
}
|
|
1454
|
-
/** Type guard for ContainerField with proper type narrowing. */
|
|
1455
|
-
declare function isContainerTypedField(field: FieldDef<any>): field is ContainerField;
|
|
1456
|
-
|
|
1457
|
-
/**
|
|
1458
|
-
* Type constraints for field nesting rules
|
|
1459
|
-
* These ensure that container fields can only contain valid child field types
|
|
1460
|
-
*/
|
|
1461
|
-
/**
|
|
1462
|
-
* Fields that are allowed as children of Page fields
|
|
1463
|
-
* Pages can contain: rows, groups, arrays, and leaf fields (but NOT other pages)
|
|
1464
|
-
*/
|
|
1465
|
-
type PageAllowedChildren = LeafFieldTypes | RowField | GroupField | ArrayField | SimplifiedArrayField | ContainerField;
|
|
1466
|
-
/**
|
|
1467
|
-
* Fields that are allowed as children of Group fields
|
|
1468
|
-
* Groups can contain: rows, arrays, and leaf fields (but NOT pages or other groups)
|
|
1469
|
-
*/
|
|
1470
|
-
type GroupAllowedChildren = LeafFieldTypes | RowField | ArrayField | SimplifiedArrayField | ContainerField;
|
|
1471
|
-
/**
|
|
1472
|
-
* Fields that are allowed as children of Array fields
|
|
1473
|
-
* Arrays can contain: rows, groups, and leaf fields (but NOT pages or other arrays)
|
|
1474
|
-
* Groups are used for creating object arrays where each array item is an object
|
|
1475
|
-
*/
|
|
1476
|
-
type ArrayAllowedChildren = LeafFieldTypes | RowField | GroupField | ContainerField;
|
|
1477
|
-
/**
|
|
1478
|
-
* Fields that are allowed as children of Container fields.
|
|
1479
|
-
* Containers are pure layout primitives that flatten their children into the
|
|
1480
|
-
* parent form, so most registered field types may appear inside — including
|
|
1481
|
-
* hidden fields and other containers — but NOT pages.
|
|
1482
|
-
*/
|
|
1483
|
-
type ContainerAllowedChildren = LeafFieldTypes | RowField | GroupField | ArrayField | SimplifiedArrayField | ContainerField;
|
|
1484
|
-
/**
|
|
1485
|
-
* Row is a synthetic field type that resolves to a Container at runtime, so
|
|
1486
|
-
* it accepts the same children as a Container.
|
|
1487
|
-
*/
|
|
1488
|
-
type RowAllowedChildren = ContainerAllowedChildren;
|
|
1489
|
-
|
|
1490
|
-
/**
|
|
1491
|
-
* An array item template is an array of allowed children that defines one OBJECT array item's fields.
|
|
1492
|
-
* Used for object arrays where each item is `{ key1: value1, key2: value2, ... }`.
|
|
1493
|
-
*/
|
|
1494
|
-
type ArrayItemTemplate = readonly ArrayAllowedChildren[];
|
|
1495
|
-
/**
|
|
1496
|
-
* An array item definition can be either:
|
|
1497
|
-
* - A single field (ArrayAllowedChildren) for PRIMITIVE array items - extracts field value directly
|
|
1498
|
-
* - An array of fields (ArrayItemTemplate) for OBJECT array items - merges fields into object
|
|
1499
|
-
*/
|
|
1500
|
-
type ArrayItemDefinition = ArrayAllowedChildren | ArrayItemTemplate;
|
|
1501
|
-
/** Array field interface for creating dynamic field collections that map to array values. */
|
|
1502
|
-
interface ArrayField<TFields extends readonly ArrayItemDefinition[] = readonly ArrayItemDefinition[]> extends FieldDef<never> {
|
|
1503
|
-
type: 'array';
|
|
1504
|
-
/**
|
|
1505
|
-
* Array of item definitions. Each element defines one array item:
|
|
1506
|
-
* - Single FieldDef = primitive item (field's value is extracted directly)
|
|
1507
|
-
* - Array of FieldDefs = object item (fields are merged into an object)
|
|
1508
|
-
* - Empty array `[]` = no initial items (add via buttons with explicit templates)
|
|
1509
|
-
* - Items can have different configurations (heterogeneous arrays supported)
|
|
1510
|
-
* - Initial values are set via `value` property on each field definition
|
|
1511
|
-
*/
|
|
1512
|
-
readonly fields: TFields;
|
|
1513
|
-
/** Array fields do not have a label property * */
|
|
1514
|
-
readonly label?: never;
|
|
1515
|
-
/** Arrays do not support meta - they have no native form element * */
|
|
1516
|
-
readonly meta?: never;
|
|
1517
|
-
/**
|
|
1518
|
-
* Logic configurations for conditional array visibility.
|
|
1519
|
-
* Only 'hidden' type logic is supported for arrays.
|
|
1520
|
-
*/
|
|
1521
|
-
readonly logic?: ContainerLogicConfig[];
|
|
1522
|
-
/**
|
|
1523
|
-
* Minimum number of items required in the array.
|
|
1524
|
-
* Validation fails if the array has fewer items than this value.
|
|
1525
|
-
*/
|
|
1526
|
-
readonly minLength?: number;
|
|
1527
|
-
/**
|
|
1528
|
-
* Maximum number of items allowed in the array.
|
|
1529
|
-
* Validation fails if the array has more items than this value.
|
|
1530
|
-
*/
|
|
1531
|
-
readonly maxLength?: number;
|
|
1532
|
-
}
|
|
1533
|
-
/**
|
|
1534
|
-
* Type guard for ArrayField with proper type narrowing.
|
|
1535
|
-
* Validates that the field is an array type with a fields property that is an array.
|
|
1536
|
-
* Fields can contain either single FieldDefs (primitive items) or arrays of FieldDefs (object items).
|
|
1537
|
-
*/
|
|
1538
|
-
declare function isArrayField(field: FieldDef<any>): field is ArrayField;
|
|
1539
|
-
/** Configuration for auto-generated add/remove buttons in simplified array fields. */
|
|
1540
|
-
interface ArrayButtonConfig {
|
|
1541
|
-
/** Custom label for the button */
|
|
1542
|
-
readonly label?: string;
|
|
1543
|
-
/** Additional properties passed to the button component */
|
|
1544
|
-
readonly props?: Record<string, unknown>;
|
|
1545
|
-
}
|
|
1546
|
-
/** Simplified array field interface for common use cases. */
|
|
1547
|
-
interface SimplifiedArrayField extends FieldDef<never> {
|
|
1548
|
-
type: 'array';
|
|
1549
|
-
/**
|
|
1550
|
-
* Template defining the structure of a single array item.
|
|
1551
|
-
* - Single field (ArrayAllowedChildren) → primitive array (each item is a single value)
|
|
1552
|
-
* - Array of fields (readonly ArrayAllowedChildren[]) → object array (each item is an object)
|
|
1553
|
-
*/
|
|
1554
|
-
readonly template: ArrayAllowedChildren | readonly ArrayAllowedChildren[];
|
|
1555
|
-
/** Initial values for the array. Each element creates one array item. */
|
|
1556
|
-
readonly value?: readonly unknown[];
|
|
1557
|
-
/**
|
|
1558
|
-
* Configuration for the auto-generated "Add" button, or `false` to disable it.
|
|
1559
|
-
* Defaults to a button with label "Add".
|
|
1560
|
-
*/
|
|
1561
|
-
readonly addButton?: ArrayButtonConfig | false;
|
|
1562
|
-
/**
|
|
1563
|
-
* Configuration for the auto-generated "Remove" button on each item, or `false` to disable it.
|
|
1564
|
-
* Defaults to a button with label "Remove".
|
|
1565
|
-
*/
|
|
1566
|
-
readonly removeButton?: ArrayButtonConfig | false;
|
|
1567
|
-
/** Simplified arrays do not support the label property */
|
|
1568
|
-
readonly label?: never;
|
|
1569
|
-
/** Simplified arrays do not support meta */
|
|
1570
|
-
readonly meta?: never;
|
|
1571
|
-
/**
|
|
1572
|
-
* Logic configurations for conditional array visibility.
|
|
1573
|
-
* Only 'hidden' type logic is supported for arrays.
|
|
1574
|
-
*/
|
|
1575
|
-
readonly logic?: ContainerLogicConfig[];
|
|
1576
|
-
/**
|
|
1577
|
-
* Minimum number of items required in the array.
|
|
1578
|
-
* Validation fails if the array has fewer items than this value.
|
|
1579
|
-
*/
|
|
1580
|
-
readonly minLength?: number;
|
|
1581
|
-
/**
|
|
1582
|
-
* Maximum number of items allowed in the array.
|
|
1583
|
-
* Validation fails if the array has more items than this value.
|
|
1584
|
-
*/
|
|
1585
|
-
readonly maxLength?: number;
|
|
1586
|
-
/** Mutually exclusive with `template` — use `fields` for the full API instead */
|
|
1587
|
-
readonly fields?: never;
|
|
1588
|
-
}
|
|
1589
|
-
/**
|
|
1590
|
-
* Type guard for SimplifiedArrayField.
|
|
1591
|
-
* Checks for `type: 'array'` with a `template` property (discriminant from full ArrayField).
|
|
1592
|
-
*/
|
|
1593
|
-
declare function isSimplifiedArrayField(field: FieldDef<any>): field is SimplifiedArrayField;
|
|
1594
|
-
|
|
1595
|
-
/** Container fields registry - augment this interface to add custom container fields */
|
|
1596
|
-
interface FieldRegistryContainers {
|
|
1597
|
-
page: PageField;
|
|
1598
|
-
row: RowField;
|
|
1599
|
-
group: GroupField;
|
|
1600
|
-
array: ArrayField | SimplifiedArrayField;
|
|
1601
|
-
container: ContainerField;
|
|
1602
|
-
}
|
|
1603
|
-
/** Leaf fields registry - augment this interface to add custom leaf fields */
|
|
1604
|
-
interface FieldRegistryLeaves {
|
|
1605
|
-
text: TextField;
|
|
1606
|
-
hidden: HiddenField;
|
|
1607
|
-
}
|
|
1608
|
-
/** Wrapper type registry for module augmentation. */
|
|
1609
|
-
interface FieldRegistryWrappers {
|
|
1610
|
-
css: CssWrapper;
|
|
1611
|
-
row: RowWrapper;
|
|
1612
|
-
}
|
|
1613
|
-
/**
|
|
1614
|
-
* Global interface for dynamic form field definitions with categorization
|
|
1615
|
-
* This interface combines containers and leaves from their respective registries
|
|
1616
|
-
*/
|
|
1617
|
-
interface DynamicFormFieldRegistry {
|
|
1618
|
-
/** Container fields that hold other fields (no value, have children) */
|
|
1619
|
-
containers: FieldRegistryContainers;
|
|
1620
|
-
/** Leaf fields that have values or display content */
|
|
1621
|
-
leaves: FieldRegistryLeaves;
|
|
1622
|
-
/** Field wrappers types */
|
|
1623
|
-
wrappers: FieldRegistryWrappers;
|
|
1624
|
-
}
|
|
1625
|
-
/** Union type of all registered container field definitions */
|
|
1626
|
-
type ContainerFieldTypes = DynamicFormFieldRegistry['containers'][keyof DynamicFormFieldRegistry['containers']];
|
|
1627
|
-
/** Union type of all registered leaf field definitions */
|
|
1628
|
-
type LeafFieldTypes = DynamicFormFieldRegistry['leaves'][keyof DynamicFormFieldRegistry['leaves']];
|
|
1629
|
-
/** Union type of all registered field definitions */
|
|
1630
|
-
type RegisteredFieldTypes = ContainerFieldTypes | LeafFieldTypes;
|
|
1631
|
-
/** Extract field types that are available in the registry */
|
|
1632
|
-
type AvailableFieldTypes = keyof DynamicFormFieldRegistry['containers'] | keyof DynamicFormFieldRegistry['leaves'];
|
|
1633
|
-
/** Extract wrapper types that are available in the registry */
|
|
1634
|
-
type RegisteredWrapperTypes = keyof DynamicFormFieldRegistry['wrappers'];
|
|
1635
|
-
/**
|
|
1636
|
-
* Combined registry mapping type names to field definitions.
|
|
1637
|
-
* This flattens containers and leaves into a single mapping.
|
|
1638
|
-
*/
|
|
1639
|
-
type FieldTypeMap = DynamicFormFieldRegistry['containers'] & DynamicFormFieldRegistry['leaves'];
|
|
1640
|
-
/**
|
|
1641
|
-
* Extract a specific field type from RegisteredFieldTypes based on the `type` discriminant.
|
|
1642
|
-
* This enables proper type narrowing when defining fields.
|
|
1643
|
-
*/
|
|
1644
|
-
type ExtractField<T extends AvailableFieldTypes> = T extends keyof FieldTypeMap ? FieldTypeMap[T] : never;
|
|
1645
|
-
/**
|
|
1646
|
-
* Narrow a field definition based on its `type` property.
|
|
1647
|
-
* Use this to get proper type inference when working with field unions.
|
|
1648
|
-
*/
|
|
1649
|
-
type NarrowField<T> = T extends {
|
|
1650
|
-
type: infer TType;
|
|
1651
|
-
} ? (TType extends AvailableFieldTypes ? ExtractField<TType> : T) : T;
|
|
1652
|
-
/**
|
|
1653
|
-
* Narrow each field in an array based on its `type` property.
|
|
1654
|
-
* Use with `satisfies` to get proper type inference for field arrays.
|
|
1655
|
-
*/
|
|
1656
|
-
type NarrowFields = readonly NarrowField<RegisteredFieldTypes>[];
|
|
1657
|
-
|
|
1658
|
-
/** Base interface for native HTML attributes that can be passed to form field elements. */
|
|
1659
|
-
interface FieldMeta {
|
|
1660
|
-
/** Allows any data-* attribute */
|
|
1661
|
-
[key: `data-${string}`]: string | undefined;
|
|
1662
|
-
/** Allows any aria-* attribute */
|
|
1663
|
-
[key: `aria-${string}`]: string | boolean | undefined;
|
|
1664
|
-
/** Allows additional custom attributes as escape hatch */
|
|
1665
|
-
[key: string]: string | number | boolean | undefined;
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
/**
|
|
1669
|
-
* Base interface for all dynamic form field definitions.
|
|
1670
|
-
*
|
|
1671
|
-
* @typeParam TProps - Field-specific properties interface
|
|
1672
|
-
* @typeParam TMeta - Native HTML attributes interface (extends FieldMeta)
|
|
1673
|
-
*/
|
|
1674
|
-
interface FieldDef<TProps, TMeta extends FieldMeta = FieldMeta> {
|
|
1675
|
-
/** Unique field identifier used for form binding and value tracking. */
|
|
1676
|
-
key: string;
|
|
1677
|
-
/** Field type identifier for component selection. */
|
|
1678
|
-
type: RegisteredFieldTypes['type'] | (string & {});
|
|
1679
|
-
/** Human-readable field label displayed to users. */
|
|
1680
|
-
label?: DynamicText;
|
|
1681
|
-
/** Field-specific properties and configuration options. */
|
|
1682
|
-
props?: TProps;
|
|
1683
|
-
/** Native HTML attributes to pass through to the underlying element. */
|
|
1684
|
-
meta?: TMeta;
|
|
1685
|
-
/** Additional CSS classes for custom styling. */
|
|
1686
|
-
className?: string;
|
|
1687
|
-
/**
|
|
1688
|
-
* Whether the field is disabled and cannot be interacted with.
|
|
1689
|
-
*
|
|
1690
|
-
* @value false
|
|
1691
|
-
*/
|
|
1692
|
-
disabled?: boolean;
|
|
1693
|
-
/**
|
|
1694
|
-
* Whether the field is read-only.
|
|
1695
|
-
*
|
|
1696
|
-
* @value false
|
|
1697
|
-
*/
|
|
1698
|
-
readonly?: boolean;
|
|
1699
|
-
/**
|
|
1700
|
-
* Whether the field is hidden from view.
|
|
1701
|
-
*
|
|
1702
|
-
* @value false
|
|
1703
|
-
*/
|
|
1704
|
-
hidden?: boolean;
|
|
1705
|
-
/** Tab index for keyboard navigation. */
|
|
1706
|
-
tabIndex?: number | undefined;
|
|
1707
|
-
/**
|
|
1708
|
-
* Whether to exclude this field's value from submission output when hidden.
|
|
1709
|
-
*
|
|
1710
|
-
* @default undefined (uses form-level or global setting)
|
|
1711
|
-
*/
|
|
1712
|
-
excludeValueIfHidden?: boolean;
|
|
1713
|
-
/**
|
|
1714
|
-
* Whether to exclude this field's value from submission output when disabled.
|
|
1715
|
-
*
|
|
1716
|
-
* @default undefined (uses form-level or global setting)
|
|
1717
|
-
*/
|
|
1718
|
-
excludeValueIfDisabled?: boolean;
|
|
1719
|
-
/**
|
|
1720
|
-
* Whether to exclude this field's value from submission output when readonly.
|
|
1721
|
-
*
|
|
1722
|
-
* @default undefined (uses form-level or global setting)
|
|
1723
|
-
*/
|
|
1724
|
-
excludeValueIfReadonly?: boolean;
|
|
1725
|
-
/**
|
|
1726
|
-
* Whether to run validation when this field is hidden — statically (`hidden: true`),
|
|
1727
|
-
* via a `hidden` logic rule, or via any hidden ancestor.
|
|
1728
|
-
*
|
|
1729
|
-
* @default undefined — inherits from parent / form / global default (which is `false`)
|
|
1730
|
-
*/
|
|
1731
|
-
validateWhenHidden?: boolean;
|
|
1732
|
-
/**
|
|
1733
|
-
* Column sizing configuration for responsive grid layout.
|
|
1734
|
-
*
|
|
1735
|
-
* @value 12
|
|
1736
|
-
*/
|
|
1737
|
-
col?: number;
|
|
1738
|
-
/** Wrapper components to chain around this field. */
|
|
1739
|
-
wrappers?: readonly WrapperConfig[] | null;
|
|
1740
|
-
/**
|
|
1741
|
-
* Skip the auto-association layer (`WrapperTypeDefinition.types`) while
|
|
1742
|
-
* keeping form-level defaults and any field-level `wrappers`. Use when a
|
|
1743
|
-
* global wrapper auto-applies to this field type but isn't wanted here.
|
|
1744
|
-
*/
|
|
1745
|
-
skipAutoWrappers?: boolean;
|
|
1746
|
-
/**
|
|
1747
|
-
* Skip the form-level `defaultWrappers` layer while keeping auto-associations
|
|
1748
|
-
* and any field-level `wrappers`.
|
|
1749
|
-
*/
|
|
1750
|
-
skipDefaultWrappers?: boolean;
|
|
1751
|
-
/** Addons rendered inside this field's slots (typically `prefix` / `suffix`). */
|
|
1752
|
-
addons?: ReadonlyArray<AnyAddon>;
|
|
1753
|
-
}
|
|
1754
|
-
type IncludedKeys = 'label' | 'className' | 'hidden' | 'tabIndex';
|
|
1755
|
-
/**
|
|
1756
|
-
* Type utility for extracting component input properties from field definitions.
|
|
1757
|
-
*
|
|
1758
|
-
* @Component({...})
|
|
1759
|
-
* export class MyFieldComponent implements FieldComponent<MyFieldDef> {
|
|
1760
|
-
* label = input<string>();
|
|
1761
|
-
* className = input<string>();
|
|
1762
|
-
* hidden = input<boolean>();
|
|
1763
|
-
* tabIndex = input<number>();
|
|
1764
|
-
* }
|
|
1765
|
-
* ```
|
|
1766
|
-
* @typeParam T - Field definition type to extract properties from
|
|
1767
|
-
*/
|
|
1768
|
-
type FieldComponent<T extends FieldDef<unknown, FieldMeta>> = Prettify<WithInputSignals<Pick<T, IncludedKeys>>>;
|
|
1769
|
-
|
|
1770
|
-
/**
|
|
1771
|
-
* Field signal context - the "nervous system" of the dynamic form.
|
|
1772
|
-
* Provided via FIELD_SIGNAL_CONTEXT injection token.
|
|
1773
|
-
*/
|
|
1774
|
-
interface FieldSignalContext<TModel extends Record<string, unknown> = Record<string, unknown>> {
|
|
1775
|
-
injector: Injector;
|
|
1776
|
-
value: WritableSignal<Partial<TModel> | undefined>;
|
|
1777
|
-
defaultValues: () => TModel;
|
|
1778
|
-
form: FieldTree<TModel>;
|
|
1779
|
-
/** Current page validity signal for paged forms. Used by next button to determine disabled state. */
|
|
1780
|
-
currentPageValid?: Signal<boolean>;
|
|
1781
|
-
}
|
|
1782
|
-
/**
|
|
1783
|
-
* Array context for fields rendered within arrays.
|
|
1784
|
-
* Provides position and parent array information for components inside array fields.
|
|
1785
|
-
*/
|
|
1786
|
-
interface ArrayContext {
|
|
1787
|
-
/** The key of the parent array field. */
|
|
1788
|
-
arrayKey: string;
|
|
1789
|
-
/**
|
|
1790
|
-
* The index of this item within the array.
|
|
1791
|
-
* Uses linkedSignal to automatically update when items are added/removed,
|
|
1792
|
-
* allowing index-dependent logic to react without component recreation.
|
|
1793
|
-
*/
|
|
1794
|
-
index: Signal<number>;
|
|
1795
|
-
/** The current form value for token resolution. */
|
|
1796
|
-
formValue: unknown;
|
|
1797
|
-
/** The array field definition. */
|
|
1798
|
-
field: FieldDef<unknown>;
|
|
1799
|
-
}
|
|
1800
|
-
/** Group context for fields rendered inside `group` containers. */
|
|
1801
|
-
interface GroupContext {
|
|
1802
|
-
/** Dot-separated path of group ancestors, including the current group's key (e.g. `'address'` or `'user.address'`). */
|
|
1803
|
-
groupPath: Signal<string>;
|
|
1804
|
-
}
|
|
1805
|
-
/** Mapper function that converts a field definition to component inputs. */
|
|
1806
|
-
type MapperFn<T extends FieldDef<unknown>> = (input: T) => Signal<Record<string, unknown>>;
|
|
1807
|
-
|
|
1808
|
-
/**
|
|
1809
|
-
* Minimal JSON Schema fragment used by the MCP server to surface an addon
|
|
1810
|
-
* kind's shape to AI form generators. Covers the common subset
|
|
1811
|
-
* (`type`/`properties`/`required`/`enum`/etc.) without pulling in a full JSON
|
|
1812
|
-
* Schema dependency. Extra keys are allowed via the `[key: string]` index so
|
|
1813
|
-
* vendor-specific annotations (`x-foo`, `markdownDescription`) still typecheck.
|
|
1814
|
-
*/
|
|
1815
|
-
interface AddonKindSchema {
|
|
1816
|
-
readonly $ref?: string;
|
|
1817
|
-
readonly $schema?: string;
|
|
1818
|
-
readonly title?: string;
|
|
1819
|
-
readonly description?: string;
|
|
1820
|
-
readonly type?: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null' | ReadonlyArray<'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null'>;
|
|
1821
|
-
readonly enum?: ReadonlyArray<unknown>;
|
|
1822
|
-
readonly const?: unknown;
|
|
1823
|
-
readonly properties?: Readonly<Record<string, AddonKindSchema>>;
|
|
1824
|
-
readonly required?: ReadonlyArray<string>;
|
|
1825
|
-
readonly additionalProperties?: boolean | AddonKindSchema;
|
|
1826
|
-
readonly items?: AddonKindSchema | ReadonlyArray<AddonKindSchema>;
|
|
1827
|
-
readonly oneOf?: ReadonlyArray<AddonKindSchema>;
|
|
1828
|
-
readonly anyOf?: ReadonlyArray<AddonKindSchema>;
|
|
1829
|
-
readonly allOf?: ReadonlyArray<AddonKindSchema>;
|
|
1830
|
-
readonly not?: AddonKindSchema;
|
|
1831
|
-
readonly default?: unknown;
|
|
1832
|
-
readonly examples?: ReadonlyArray<unknown>;
|
|
1833
|
-
readonly minimum?: number;
|
|
1834
|
-
readonly maximum?: number;
|
|
1835
|
-
readonly minLength?: number;
|
|
1836
|
-
readonly maxLength?: number;
|
|
1837
|
-
readonly pattern?: string;
|
|
1838
|
-
readonly format?: string;
|
|
1839
|
-
/** Vendor extensions and unrecognised keywords pass through untyped. */
|
|
1840
|
-
readonly [key: string]: unknown;
|
|
1841
|
-
}
|
|
1842
|
-
/**
|
|
1843
|
-
* Optional shape validator a kind ships to enforce its required fields at
|
|
1844
|
-
* runtime. Throws are caught by the validator and converted into lenient
|
|
1845
|
-
* warnings; the offending addon is dropped and the form keeps rendering.
|
|
1846
|
-
*/
|
|
1847
|
-
type AddonShapeValidator<T extends BaseAddon = BaseAddon> = (addon: T, fieldKey: string) => void;
|
|
1848
|
-
/** Per-kind registration metadata. */
|
|
1849
|
-
interface AddonKindDefinition<T extends BaseAddon = BaseAddon> {
|
|
1850
|
-
/** Discriminant matching `addon.kind`. */
|
|
1851
|
-
readonly kind: string;
|
|
1852
|
-
/** Lazy loader for the kind's renderer component. */
|
|
1853
|
-
readonly loadComponent: LazyComponentLoader;
|
|
1854
|
-
/** Optional shape validator — throw `DynamicFormError` to drop the addon with a warning. */
|
|
1855
|
-
readonly validate?: AddonShapeValidator<T>;
|
|
1856
|
-
/** Optional JSON Schema fragment for MCP / pre-flight tooling. */
|
|
1857
|
-
readonly schema?: AddonKindSchema;
|
|
1858
|
-
/**
|
|
1859
|
-
* Whether the kind survives `JSON.stringify` / `JSON.parse`. Kinds whose
|
|
1860
|
-
* shape includes a function payload (e.g., the built-in `'component'`
|
|
1861
|
-
* loader, inline `prime-button` `action` handlers) declare `jsonSafe: false`
|
|
1862
|
-
* so the validator drops them when the config was loaded from a JSON
|
|
1863
|
-
* source (`sanitizeFormConfig(config, { source: 'json' })`). Defaults to
|
|
1864
|
-
* `true` — kinds are JSON-safe unless explicitly opted out.
|
|
1865
|
-
*/
|
|
1866
|
-
readonly jsonSafe?: boolean;
|
|
1867
|
-
}
|
|
1868
|
-
/** Per-field-type addon-support metadata declared at field registration. */
|
|
1869
|
-
interface FieldAddonSupport {
|
|
1870
|
-
/** Slots a field of this type accepts. */
|
|
1871
|
-
readonly slots: readonly AddonSlot[];
|
|
1872
|
-
/** Optional whitelist of allowed addon kinds. Omitted = any registered kind. */
|
|
1873
|
-
readonly allowedKinds?: readonly string[];
|
|
1874
|
-
}
|
|
1875
|
-
/** Global registry of addon kinds. */
|
|
1876
|
-
declare const ADDON_KIND_REGISTRY: InjectionToken<Map<string, AddonKindDefinition<BaseAddon<AddonSlot>>>>;
|
|
1877
|
-
|
|
1878
|
-
/** Defines how a field type handles form values and data collection. */
|
|
1879
|
-
type ValueHandlingMode = 'include' | 'exclude' | 'flatten';
|
|
1880
|
-
/** Semantic grouping of interchangeable field UI alternatives. */
|
|
1881
|
-
type FieldScope = 'boolean' | 'single-select' | 'multi-select' | 'text-input' | 'numeric' | 'date';
|
|
1882
|
-
/** Mapped component inputs that must be available before a field component is instantiated. */
|
|
1883
|
-
type RenderReadyInput = 'field' | (string & {});
|
|
1884
|
-
/**
|
|
1885
|
-
* Configuration interface for registering custom field types.
|
|
1886
|
-
*
|
|
1887
|
-
* @typeParam T - The field definition type this field type handles
|
|
1888
|
-
*/
|
|
1889
|
-
interface FieldTypeDefinition<T extends FieldDef<any> = any> {
|
|
1890
|
-
/** Unique identifier for the field type */
|
|
1891
|
-
name: string;
|
|
1892
|
-
/** Field definition type marker (internal use) */
|
|
1893
|
-
_fieldDef?: T;
|
|
1894
|
-
/**
|
|
1895
|
-
* Function to load the component (supports lazy loading).
|
|
1896
|
-
* Returns a Promise that resolves to the component class or module with default export.
|
|
1897
|
-
*/
|
|
1898
|
-
loadComponent?: LazyComponentLoader;
|
|
1899
|
-
/** Mapper function that converts field definition to component bindings. */
|
|
1900
|
-
mapper?: MapperFn<T>;
|
|
1901
|
-
/** How this field type handles form values and data collection (defaults to 'include') */
|
|
1902
|
-
valueHandling?: ValueHandlingMode;
|
|
1903
|
-
/** List of prop keys to forward to the meta object. */
|
|
1904
|
-
propsToMeta?: string[];
|
|
1905
|
-
/** Semantic scope for tooling to discover interchangeable field alternatives */
|
|
1906
|
-
scope?: FieldScope | FieldScope[];
|
|
1907
|
-
/** Mapped component inputs that must exist before the renderer instantiates the component */
|
|
1908
|
-
renderReadyWhen?: readonly RenderReadyInput[];
|
|
1909
|
-
/**
|
|
1910
|
-
* Declares which addon slots this field accepts and (optionally) the
|
|
1911
|
-
* subset of kinds allowed.
|
|
1912
|
-
*/
|
|
1913
|
-
addons?: FieldAddonSupport;
|
|
1914
|
-
}
|
|
1915
|
-
/** Injection token for the global field type registry. */
|
|
1916
|
-
declare const FIELD_REGISTRY: InjectionToken<Map<string, FieldTypeDefinition<any>>>;
|
|
3
|
+
import { Type, Injector, Signal, EnvironmentInjector, WritableSignal, Provider, EnvironmentProviders, TemplateRef, InjectionToken } from '@angular/core';
|
|
4
|
+
import * as _ng_forge_dynamic_forms_internal from '@ng-forge/dynamic-forms/internal';
|
|
5
|
+
import { FieldDef, FormEvent, RegisteredFieldTypes, InferFormValue as InferFormValue$1, FormConfig, FormOptions, EventBus, LazyComponentLoader, WrapperTypeDefinition, FieldTypeDefinition, DerivationLogLevel, Logger, ValueExclusionConfig, ValidationExecutionConfig, AnyAddon, WrapperFieldInputs, TextAddon, TemplateAddon, ComponentAddon, AddonActionPreset, AddonActionContext, AddonKindDefinition, FieldAddonSupport, BaseAddon, ArrayItemDefinition, NarrowFields, AvailableFieldTypes, ExtractField } from '@ng-forge/dynamic-forms/internal';
|
|
6
|
+
export { ADDON_KIND_REGISTRY, AddonActionContext, AddonActionPreset, AddonKindDefinition, AddonKindSchema, AddonShapeValidator, AddonSlot, AnyAddon, ArrayAllowedChildren, ArrayButtonConfig, ArrayField, ArrayItemTemplate, AsyncCondition, AsyncConditionFunction, AsyncCustomValidator, AsyncDerivationFunction, AsyncValidatorConfig, AvailableFieldTypes, BaseAddon, BaseCheckedField, BaseValidatorConfig, BaseValueField, BuiltInValidatorConfig, ButtonLogicContext, CheckedFieldComponent, CommonAddonActionPreset, CommonAddonSlot, ComponentAddon, ConditionalExpression, ContainerAllowedChildren, ContainerField, ContainerFieldTypes, CssWrapper, CustomFnConfig, CustomFunction, CustomValidator, CustomValidatorConfig, DF_FIELD_TEMPLATES, DeclarativeHttpValidatorConfig, DynamicFormActionRegistry, DynamicFormAddonActionPresetRegistry, DynamicFormAddonRegistry, DynamicFormAddonSlotRegistry, DynamicFormError, DynamicFormFieldRegistry, DynamicFormLogger, DynamicText, DynamicValue, EvaluationContext, ExtractField, FieldAddonSupport, FieldBoundAddonActionContext, FieldComponent, FieldDef, FieldMeta, FieldOption, FieldPathAccess, FieldRegistryContainers, FieldRegistryLeaves, FieldRegistryWrappers, FieldWithValidation, FieldWrapper, FormConfig, FormEvent, FormEventConstructor, FormMode, FormModeDetectionResult, FormOptions, FormStateCondition, GroupAllowedChildren, GroupField, HttpCondition, HttpCustomValidator, HttpRequestConfig, HttpValidationResponseMapping, InferFormValue, LeafFieldTypes, Logger, LogicConfig, NarrowField, NarrowFields, NextButtonOptions, NonFieldLogicConfig, NonFieldLogicContext, NonFieldLogicType, NoopLogger, OrphanAddonActionContext, PageAllowedChildren, PageField, Prettify, RegisteredActionRef, RegisteredFieldTypes, ResolvedValidationExecutionConfig, ResolvedValueExclusionConfig, RowAllowedChildren, RowField, SchemaApplicationConfig, SchemaDefinition, SimplifiedArrayField, StateLogicConfig, SubmissionActionResult, SubmissionConfig, SubmitButtonOptions, TemplateAddon, TextAddon, TextElementType, TextField, TextProps, TokenContext, ValidationError, ValidationExecutionConfig, ValidationMessages, ValidatorConfig, ValueExclusionConfig, ValueFieldComponent, ValueType, WRAPPER_REGISTRY, WithInputSignals, WrapperConfig, WrapperTypeDefinition, evaluateNonFieldDisabled, evaluateNonFieldHidden, hasFormValue, isArrayField, isCheckedField, isContainerField, isContainerTypedField, isDisplayOnlyField, isFieldBoundContext, isFormStateCondition, isGroupField, isLeafField, isPageField, isRowField, isSimplifiedArrayField, isValueBearingField, isValueField, isWrapperTypeDefinition, resolveDynamicValue, resolveNextButtonDisabled, resolveNonFieldDisabled, resolveNonFieldHidden, resolveSubmitButtonDisabled } from '@ng-forge/dynamic-forms/internal';
|
|
7
|
+
import * as _angular_forms_signals from '@angular/forms/signals';
|
|
8
|
+
import { FieldTree } from '@angular/forms/signals';
|
|
9
|
+
import * as _angular_forms from '@angular/forms';
|
|
10
|
+
import * as _ng_forge_dynamic_forms from '@ng-forge/dynamic-forms';
|
|
11
|
+
import { FormSchema } from '@ng-forge/dynamic-forms/schema';
|
|
1917
12
|
|
|
1918
13
|
/** Resolved field ready for rendering with ngComponentOutlet / DfFieldOutlet. */
|
|
1919
14
|
interface ResolvedField {
|
|
@@ -1935,50 +30,12 @@ interface ResolvedField {
|
|
|
1935
30
|
hidden: Signal<boolean>;
|
|
1936
31
|
}
|
|
1937
32
|
|
|
1938
|
-
/** Form mode enumeration distinguishing between paged and non-paged forms */
|
|
1939
|
-
type FormMode = 'paged' | 'non-paged';
|
|
1940
|
-
/** Result of form mode detection with validation details */
|
|
1941
|
-
interface FormModeDetectionResult {
|
|
1942
|
-
/** The detected form mode */
|
|
1943
|
-
mode: FormMode;
|
|
1944
|
-
/** Whether the form configuration is valid for the detected mode */
|
|
1945
|
-
isValid: boolean;
|
|
1946
|
-
/** Array of validation errors if form is invalid */
|
|
1947
|
-
errors: string[];
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
33
|
/** Error from async field component loading. */
|
|
1951
34
|
interface FieldLoadingError {
|
|
1952
35
|
readonly fieldType: string;
|
|
1953
36
|
readonly fieldKey: string;
|
|
1954
|
-
readonly error: Error;
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
/** Base interface for all form events in the dynamic form system. */
|
|
1958
|
-
interface FormEvent {
|
|
1959
|
-
/** Unique identifier for the event type used for filtering and subscriptions */
|
|
1960
|
-
readonly type: string;
|
|
1961
|
-
/**
|
|
1962
|
-
* Optional form value attached to the event when `withEventFormValue()` is enabled
|
|
1963
|
-
* or `options.emitFormValueOnEvents` is set to `true` in the form config.
|
|
1964
|
-
*/
|
|
1965
|
-
readonly formValue?: unknown;
|
|
37
|
+
readonly error: Error;
|
|
1966
38
|
}
|
|
1967
|
-
/**
|
|
1968
|
-
* Type guard to check if a form event has a form value attached.
|
|
1969
|
-
*
|
|
1970
|
-
* @param event - The form event to check
|
|
1971
|
-
* @returns `true` if the event has a form value attached, narrowing the type
|
|
1972
|
-
*/
|
|
1973
|
-
declare function hasFormValue<T extends FormEvent>(event: T): event is T & {
|
|
1974
|
-
formValue: unknown;
|
|
1975
|
-
};
|
|
1976
|
-
/**
|
|
1977
|
-
* Constructor type for form event classes.
|
|
1978
|
-
*
|
|
1979
|
-
* @typeParam T - The form event type being constructed
|
|
1980
|
-
*/
|
|
1981
|
-
type FormEventConstructor<T extends FormEvent = FormEvent> = new (...args: any[]) => T;
|
|
1982
39
|
|
|
1983
40
|
/** Event dispatched when the form should be cleared. */
|
|
1984
41
|
declare class FormClearEvent implements FormEvent {
|
|
@@ -2086,11 +143,11 @@ declare class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFie
|
|
|
2086
143
|
emitFormValueOnEvents?: boolean;
|
|
2087
144
|
}>;
|
|
2088
145
|
/** Field signal context for injection into child components */
|
|
2089
|
-
fieldSignalContext: Signal<
|
|
146
|
+
fieldSignalContext: Signal<_ng_forge_dynamic_forms_internal.FieldSignalContext<TModel>>;
|
|
2090
147
|
/** Default values computed from field definitions */
|
|
2091
148
|
defaultValues: WritableSignal<TModel>;
|
|
2092
149
|
/** The Angular Signal Form instance */
|
|
2093
|
-
form: Signal<FieldTree<TModel, string | number>>;
|
|
150
|
+
form: Signal<FieldTree<TModel, string | number, "writable">>;
|
|
2094
151
|
/** Current form values (reactive) */
|
|
2095
152
|
formValue: Signal<TModel | (TModel extends infer T ? T extends TModel ? T extends _angular_forms.AbstractControl<unknown, infer TValue extends unknown, any> ? TValue : never : never : never)>;
|
|
2096
153
|
/** Whether the form is currently valid */
|
|
@@ -2110,6 +167,7 @@ declare class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFie
|
|
|
2110
167
|
/** Collects errors from async field component loading for error boundary patterns */
|
|
2111
168
|
fieldLoadingErrors: WritableSignal<FieldLoadingError[]>;
|
|
2112
169
|
/** Whether to render the form template */
|
|
170
|
+
private derivationReady;
|
|
2113
171
|
shouldRender: Signal<boolean>;
|
|
2114
172
|
/** Resolved fields ready for rendering */
|
|
2115
173
|
protected resolvedFields: Signal<ResolvedField[]>;
|
|
@@ -2163,63 +221,6 @@ declare class DynamicForm<TFields extends RegisteredFieldTypes[] = RegisteredFie
|
|
|
2163
221
|
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; }; "source": { "alias": "source"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "validityChange": "validityChange"; "dirtyChange": "dirtyChange"; "submitted": "submitted"; "reset": "reset"; "cleared": "cleared"; "events": "events"; "initialized": "initialized"; "onPageChange": "onPageChange"; "onPageNavigationStateChange": "onPageNavigationStateChange"; }, ["_projectedTemplates"], never, true, never>;
|
|
2164
222
|
}
|
|
2165
223
|
|
|
2166
|
-
declare class EventBus {
|
|
2167
|
-
private readonly pipeline$;
|
|
2168
|
-
private readonly globalEmitFormValue;
|
|
2169
|
-
private readonly rootFormRegistry;
|
|
2170
|
-
private readonly formOptions;
|
|
2171
|
-
private readonly logger;
|
|
2172
|
-
events$: Observable<FormEvent>;
|
|
2173
|
-
/**
|
|
2174
|
-
* Dispatches a pre-created event instance directly.
|
|
2175
|
-
*
|
|
2176
|
-
* @param event - A FormEvent instance to dispatch
|
|
2177
|
-
*/
|
|
2178
|
-
dispatch(event: FormEvent): void;
|
|
2179
|
-
/**
|
|
2180
|
-
* Dispatches an event to all subscribers by instantiating the provided constructor.
|
|
2181
|
-
*
|
|
2182
|
-
* @param eventConstructor - Constructor function for the event to dispatch
|
|
2183
|
-
* @param args - Arguments to pass to the event constructor
|
|
2184
|
-
*/
|
|
2185
|
-
dispatch<T extends FormEventConstructor>(eventConstructor: T, ...args: ConstructorParameters<T>): void;
|
|
2186
|
-
/**
|
|
2187
|
-
* Dispatches a pre-created event instance directly.
|
|
2188
|
-
* Used internally by EventDispatcher to forward events into the bus.
|
|
2189
|
-
*
|
|
2190
|
-
* @internal
|
|
2191
|
-
*/
|
|
2192
|
-
emitInstance(event: FormEvent): void;
|
|
2193
|
-
/**
|
|
2194
|
-
* Shared emit path for both dispatch() and emitInstance().
|
|
2195
|
-
* Attaches form value if configured, then pushes to the pipeline.
|
|
2196
|
-
*/
|
|
2197
|
-
private emit;
|
|
2198
|
-
/**
|
|
2199
|
-
* Emits an event through the pipeline. Catches any synchronous exception that escapes
|
|
2200
|
-
* RxJS's own error handling so dispatch() callers are never disrupted by a failing subscriber.
|
|
2201
|
-
*/
|
|
2202
|
-
private safeEmit;
|
|
2203
|
-
/** Determines whether form value should be attached to events. */
|
|
2204
|
-
private shouldEmitFormValue;
|
|
2205
|
-
/**
|
|
2206
|
-
* Subscribes to events of a specific type.
|
|
2207
|
-
*
|
|
2208
|
-
* @param eventType - The type of event to subscribe to
|
|
2209
|
-
* @returns Observable that emits events of the specified type
|
|
2210
|
-
*/
|
|
2211
|
-
on<T extends FormEvent>(eventType: T['type']): Observable<T>;
|
|
2212
|
-
/**
|
|
2213
|
-
* Subscribes to events of multiple types.
|
|
2214
|
-
*
|
|
2215
|
-
* @param eventType - Array of event types to subscribe to
|
|
2216
|
-
* @returns Observable that emits events matching any of the specified types
|
|
2217
|
-
*/
|
|
2218
|
-
on<T extends FormEvent>(eventType: Array<T['type']>): Observable<T>;
|
|
2219
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EventBus, never>;
|
|
2220
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<EventBus>;
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
224
|
/**
|
|
2224
225
|
* Injectable service for dispatching events into a DynamicForm from outside the form.
|
|
2225
226
|
*
|
|
@@ -2326,46 +327,6 @@ type InferWrapperRegistry<T> = T extends WrappersBundle<infer R> ? {
|
|
|
2326
327
|
};
|
|
2327
328
|
} : never;
|
|
2328
329
|
|
|
2329
|
-
/**
|
|
2330
|
-
* Type guard to check if a field is a container field (page, row, group, or array)
|
|
2331
|
-
* Container fields have a 'fields' property and don't contribute values directly.
|
|
2332
|
-
* This overload works with RegisteredFieldTypes for full type narrowing.
|
|
2333
|
-
*/
|
|
2334
|
-
declare function isContainerField(field: RegisteredFieldTypes): field is ContainerFieldTypes;
|
|
2335
|
-
/**
|
|
2336
|
-
* Type guard to check if a field is a container field (page, row, group, or array).
|
|
2337
|
-
* This overload works with any FieldDef for looser type checking.
|
|
2338
|
-
*/
|
|
2339
|
-
declare function isContainerField(field: FieldDef<unknown>): boolean;
|
|
2340
|
-
/**
|
|
2341
|
-
* Type guard to check if a field is a leaf field (value or display field)
|
|
2342
|
-
* Leaf fields don't have children and either contribute values or display content
|
|
2343
|
-
*/
|
|
2344
|
-
declare function isLeafField(field: RegisteredFieldTypes): field is LeafFieldTypes;
|
|
2345
|
-
/**
|
|
2346
|
-
* Type guard to check if a field has a value property (value-bearing field)
|
|
2347
|
-
* These fields contribute to the form value output
|
|
2348
|
-
* Note: Using `unknown` in the Extract condition to match any value type
|
|
2349
|
-
*/
|
|
2350
|
-
declare function isValueBearingField(field: RegisteredFieldTypes): field is Extract<RegisteredFieldTypes, {
|
|
2351
|
-
value: unknown;
|
|
2352
|
-
}>;
|
|
2353
|
-
/**
|
|
2354
|
-
* Type guard to check if a field is excluded from form values (display-only field)
|
|
2355
|
-
* Currently this includes text fields and any other fields without a value property
|
|
2356
|
-
*/
|
|
2357
|
-
declare function isDisplayOnlyField(field: RegisteredFieldTypes): boolean;
|
|
2358
|
-
|
|
2359
|
-
/** Helper types for creating type-safe field configurations with proper nesting constraints */
|
|
2360
|
-
|
|
2361
|
-
/**
|
|
2362
|
-
* Type helper for accessing nested field paths safely
|
|
2363
|
-
* This allows accessing child paths while maintaining some type safety
|
|
2364
|
-
*/
|
|
2365
|
-
type FieldPathAccess<TValue> = {
|
|
2366
|
-
[K in keyof TValue]: SchemaPath<TValue[K]> | SchemaPathTree<TValue[K]>;
|
|
2367
|
-
};
|
|
2368
|
-
|
|
2369
330
|
/** Extract FieldDef type from FieldTypeDefinition */
|
|
2370
331
|
type ExtractFieldDef<T> = T extends FieldTypeDefinition<infer F> ? F : never;
|
|
2371
332
|
/** Union of all FieldDef types from provided field types */
|
|
@@ -2400,142 +361,6 @@ type ExtractFormValue<T> = T extends {
|
|
|
2400
361
|
__formValue?: infer V;
|
|
2401
362
|
} ? V : never;
|
|
2402
363
|
|
|
2403
|
-
/**
|
|
2404
|
-
* Type representing a FieldTree for an array.
|
|
2405
|
-
* Extends FieldTree to add numeric indexing for accessing item FieldTrees.
|
|
2406
|
-
*/
|
|
2407
|
-
type ArrayFieldTree<T> = FieldTree<T[]> & {
|
|
2408
|
-
readonly [index: number]: FieldTree<T> | undefined;
|
|
2409
|
-
};
|
|
2410
|
-
/** Get the length of an array FieldTree. */
|
|
2411
|
-
declare function getArrayLength<T>(arrayFieldTree: ArrayFieldTree<T>): number;
|
|
2412
|
-
/** Read-only view of a single field's observable state. */
|
|
2413
|
-
interface ReadonlyFieldTree<TValue = unknown> {
|
|
2414
|
-
readonly value: Signal<TValue>;
|
|
2415
|
-
readonly valid: Signal<boolean>;
|
|
2416
|
-
readonly invalid: Signal<boolean>;
|
|
2417
|
-
readonly touched: Signal<boolean>;
|
|
2418
|
-
readonly dirty: Signal<boolean>;
|
|
2419
|
-
readonly required: Signal<boolean>;
|
|
2420
|
-
readonly disabled: Signal<boolean>;
|
|
2421
|
-
readonly hidden: Signal<boolean>;
|
|
2422
|
-
readonly errors: Signal<readonly unknown[]>;
|
|
2423
|
-
}
|
|
2424
|
-
/**
|
|
2425
|
-
* Build a `ReadonlyFieldTree` by extracting the whitelisted read signals from a
|
|
2426
|
-
* Signal Forms `FieldTree`. Returns a fresh plain object — no casting, no proxying,
|
|
2427
|
-
* so consumers only see the narrow surface and Angular's `WritableSignal` capability
|
|
2428
|
-
* on `value` is hidden.
|
|
2429
|
-
*/
|
|
2430
|
-
declare function toReadonlyFieldTree<TValue>(field: FieldTree<TValue>): ReadonlyFieldTree<TValue>;
|
|
2431
|
-
/**
|
|
2432
|
-
* Write a value into a FieldTree's underlying signal. Signal Forms stores
|
|
2433
|
-
* `FieldState.value` as a `WritableSignal`; this helper centralises the cast
|
|
2434
|
-
* and warns if that contract ever changes (vs a silent no-op).
|
|
2435
|
-
*/
|
|
2436
|
-
declare function writeToFieldValue<T>(value: Signal<T>, next: T, logger?: {
|
|
2437
|
-
warn: (msg: string) => void;
|
|
2438
|
-
}): boolean;
|
|
2439
|
-
|
|
2440
|
-
/**
|
|
2441
|
-
* Fields every addon-action context carries, regardless of whether the
|
|
2442
|
-
* addon is bound to a host field or rendered orphaned.
|
|
2443
|
-
*/
|
|
2444
|
-
interface AddonActionContextBase<TValue> {
|
|
2445
|
-
/**
|
|
2446
|
-
* Identity of the host field this addon is attached to. Empty strings
|
|
2447
|
-
* indicate the addon is rendered outside an active field context (rare).
|
|
2448
|
-
* Use {@link isFieldBoundContext} or the `form !== null` check to
|
|
2449
|
-
* narrow before relying on field identity.
|
|
2450
|
-
*/
|
|
2451
|
-
readonly field: {
|
|
2452
|
-
readonly key: string;
|
|
2453
|
-
readonly type: string;
|
|
2454
|
-
};
|
|
2455
|
-
/**
|
|
2456
|
-
* Current value of the host field at the time the action fires.
|
|
2457
|
-
* `undefined` when the host field has no value yet (initial render before
|
|
2458
|
-
* defaultValue resolution) or when the addon is rendered outside a field.
|
|
2459
|
-
*/
|
|
2460
|
-
readonly value: TValue | undefined;
|
|
2461
|
-
}
|
|
2462
|
-
/**
|
|
2463
|
-
* Field-bound variant — the addon is attached to a real field and has a
|
|
2464
|
-
* working value-writer. The common case for `pi-button` / `mat-button` /
|
|
2465
|
-
* `bs-button` / `ion-button` inside an adapter input field.
|
|
2466
|
-
*/
|
|
2467
|
-
interface FieldBoundAddonActionContext<TValue = unknown> extends AddonActionContextBase<TValue> {
|
|
2468
|
-
/** Read-only view of the host field's tree — same view wrappers receive. */
|
|
2469
|
-
readonly form: ReadonlyFieldTree<TValue>;
|
|
2470
|
-
/** Push a new value into the host field. */
|
|
2471
|
-
readonly setValue: (next: TValue) => void;
|
|
2472
|
-
}
|
|
2473
|
-
/**
|
|
2474
|
-
* Orphan variant — the addon is rendered outside any field component (rare;
|
|
2475
|
-
* happens when consumers compose `<df-addon-slot>` directly without a host
|
|
2476
|
-
* field). No writer is reachable; reading `value` may also yield `undefined`.
|
|
2477
|
-
*/
|
|
2478
|
-
interface OrphanAddonActionContext<TValue = unknown> extends AddonActionContextBase<TValue> {
|
|
2479
|
-
readonly form: null;
|
|
2480
|
-
/** Always absent in the orphan variant — distinguishes the union members. */
|
|
2481
|
-
readonly setValue?: undefined;
|
|
2482
|
-
}
|
|
2483
|
-
/** Context handed to inline addon actions and registered handler functions. */
|
|
2484
|
-
type AddonActionContext<TValue = unknown> = FieldBoundAddonActionContext<TValue> | OrphanAddonActionContext<TValue>;
|
|
2485
|
-
/** Type guard narrowing {@link AddonActionContext} to its field-bound variant. */
|
|
2486
|
-
declare function isFieldBoundContext<TValue>(ctx: AddonActionContext<TValue>): ctx is FieldBoundAddonActionContext<TValue>;
|
|
2487
|
-
/** Built-in preset actions shared across adapters. */
|
|
2488
|
-
type CommonAddonActionPreset = 'clear' | 'reset' | 'paste' | 'copy' | 'toggle-password-visibility';
|
|
2489
|
-
/** Module-augmentable registry of adapter-specific preset names. */
|
|
2490
|
-
interface DynamicFormAddonActionPresetRegistry {
|
|
2491
|
-
}
|
|
2492
|
-
/**
|
|
2493
|
-
* Union of every preset name an addon may reference — universal presets
|
|
2494
|
-
* plus any contributed via {@link DynamicFormAddonActionPresetRegistry}.
|
|
2495
|
-
*/
|
|
2496
|
-
type AddonActionPreset = CommonAddonActionPreset | keyof DynamicFormAddonActionPresetRegistry | (string & {});
|
|
2497
|
-
/** Module-augmentable registry of user-defined named action handlers. */
|
|
2498
|
-
interface DynamicFormActionRegistry {
|
|
2499
|
-
}
|
|
2500
|
-
/**
|
|
2501
|
-
* Typed string handle to a registered action handler. The empty registry
|
|
2502
|
-
* resolves to `never`; augmenting `DynamicFormActionRegistry` populates the
|
|
2503
|
-
* union and unlocks autocomplete.
|
|
2504
|
-
*/
|
|
2505
|
-
type RegisteredActionRef = keyof DynamicFormActionRegistry;
|
|
2506
|
-
|
|
2507
|
-
/**
|
|
2508
|
-
* Map of named `TemplateRef`s collected by `<df-dynamic-form>` from
|
|
2509
|
-
* `<ng-template dfTemplate="...">` children projected into its content.
|
|
2510
|
-
* The directive selector is `dfTemplate` (see `DfTemplate`); the input
|
|
2511
|
-
* value is the name addons reference via `templateKey`.
|
|
2512
|
-
*/
|
|
2513
|
-
declare const DF_FIELD_TEMPLATES: InjectionToken<Signal<ReadonlyMap<string, TemplateRef<unknown>>>>;
|
|
2514
|
-
|
|
2515
|
-
interface FieldOption<T = unknown> {
|
|
2516
|
-
label: DynamicText;
|
|
2517
|
-
value: T;
|
|
2518
|
-
disabled?: boolean;
|
|
2519
|
-
[key: string]: unknown;
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
/** Injection token for form-level default wrappers. */
|
|
2523
|
-
declare const DEFAULT_WRAPPERS: InjectionToken<Signal<readonly WrapperConfig[] | undefined>>;
|
|
2524
|
-
/** Injection token for providing field signal context to mappers and components. */
|
|
2525
|
-
declare const FIELD_SIGNAL_CONTEXT: InjectionToken<FieldSignalContext<Record<string, unknown>>>;
|
|
2526
|
-
/** Throwing accessor for {@link FIELD_SIGNAL_CONTEXT}. */
|
|
2527
|
-
declare function injectFieldSignalContext<TModel extends Record<string, unknown> = Record<string, unknown>>(): FieldSignalContext<TModel>;
|
|
2528
|
-
/** Injection token for providing array context metadata to mappers and components. */
|
|
2529
|
-
declare const ARRAY_CONTEXT: InjectionToken<ArrayContext>;
|
|
2530
|
-
/** Injection token for providing group ancestry to mappers and components. */
|
|
2531
|
-
declare const GROUP_CONTEXT: InjectionToken<GroupContext>;
|
|
2532
|
-
/** Injection token for form-level default props. */
|
|
2533
|
-
declare const DEFAULT_PROPS: InjectionToken<Signal<Record<string, unknown> | undefined>>;
|
|
2534
|
-
/** Injection token for form-level default validation messages. */
|
|
2535
|
-
declare const DEFAULT_VALIDATION_MESSAGES: InjectionToken<Signal<ValidationMessages | undefined>>;
|
|
2536
|
-
/** Injection token for form-level options. */
|
|
2537
|
-
declare const FORM_OPTIONS: InjectionToken<Signal<FormOptions | undefined>>;
|
|
2538
|
-
|
|
2539
364
|
/** Built-in field types provided by the dynamic form library. */
|
|
2540
365
|
declare const BUILT_IN_FIELDS: FieldTypeDefinition[];
|
|
2541
366
|
|
|
@@ -2562,9 +387,6 @@ interface LoggerConfigOptions {
|
|
|
2562
387
|
*/
|
|
2563
388
|
declare function withLoggerConfig(config?: boolean | (() => boolean) | LoggerConfigOptions): DynamicFormFeature<'logger'>;
|
|
2564
389
|
|
|
2565
|
-
/** Injection token for the dynamic forms logger. */
|
|
2566
|
-
declare const DynamicFormLogger: InjectionToken<Logger>;
|
|
2567
|
-
|
|
2568
390
|
/** Console-based logger implementation. */
|
|
2569
391
|
declare class ConsoleLogger implements Logger {
|
|
2570
392
|
private readonly prefix;
|
|
@@ -2574,17 +396,6 @@ declare class ConsoleLogger implements Logger {
|
|
|
2574
396
|
error(message: string, ...args: unknown[]): void;
|
|
2575
397
|
}
|
|
2576
398
|
|
|
2577
|
-
/**
|
|
2578
|
-
* No-operation logger implementation.
|
|
2579
|
-
* All methods are no-ops - used in production by default.
|
|
2580
|
-
*/
|
|
2581
|
-
declare class NoopLogger implements Logger {
|
|
2582
|
-
debug(): void;
|
|
2583
|
-
info(): void;
|
|
2584
|
-
warn(): void;
|
|
2585
|
-
error(): void;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
399
|
/**
|
|
2589
400
|
* Enables automatic form value attachment to all events dispatched through the EventBus.
|
|
2590
401
|
*
|
|
@@ -2599,30 +410,6 @@ declare class NoopLogger implements Logger {
|
|
|
2599
410
|
*/
|
|
2600
411
|
declare function withEventFormValue(): DynamicFormFeature<'event-form-value'>;
|
|
2601
412
|
|
|
2602
|
-
/**
|
|
2603
|
-
* Configuration for excluding field values from form submission output
|
|
2604
|
-
* based on their reactive state (hidden, disabled, readonly).
|
|
2605
|
-
*/
|
|
2606
|
-
interface ValueExclusionConfig {
|
|
2607
|
-
/**
|
|
2608
|
-
* Whether to exclude the value of hidden fields from submission output.
|
|
2609
|
-
*
|
|
2610
|
-
* @remarks
|
|
2611
|
-
* This does NOT affect HiddenField (`type: 'hidden'`) — those fields
|
|
2612
|
-
* store values without UI and their `hidden()` state is always `false`.
|
|
2613
|
-
*/
|
|
2614
|
-
readonly excludeValueIfHidden?: boolean;
|
|
2615
|
-
/** Whether to exclude the value of disabled fields from submission output. */
|
|
2616
|
-
readonly excludeValueIfDisabled?: boolean;
|
|
2617
|
-
/** Whether to exclude the value of readonly fields from submission output. */
|
|
2618
|
-
readonly excludeValueIfReadonly?: boolean;
|
|
2619
|
-
}
|
|
2620
|
-
/**
|
|
2621
|
-
* Fully resolved exclusion config with all properties required.
|
|
2622
|
-
* Produced by the 3-tier resolution: `field ?? form ?? global`.
|
|
2623
|
-
*/
|
|
2624
|
-
type ResolvedValueExclusionConfig = Required<ValueExclusionConfig>;
|
|
2625
|
-
|
|
2626
413
|
/**
|
|
2627
414
|
* Configures global value exclusion defaults for form submission output.
|
|
2628
415
|
*
|
|
@@ -2637,17 +424,6 @@ type ResolvedValueExclusionConfig = Required<ValueExclusionConfig>;
|
|
|
2637
424
|
*/
|
|
2638
425
|
declare function withValueExclusionDefaults(config?: Partial<ValueExclusionConfig>): DynamicFormFeature<'value-exclusion'>;
|
|
2639
426
|
|
|
2640
|
-
/** Configuration for when validation runs based on a field's reactive state. */
|
|
2641
|
-
interface ValidationExecutionConfig {
|
|
2642
|
-
/**
|
|
2643
|
-
* Whether validators run while a field is hidden (statically, via `hidden`
|
|
2644
|
-
* logic, or because any ancestor is hidden).
|
|
2645
|
-
*/
|
|
2646
|
-
readonly validateWhenHidden?: boolean;
|
|
2647
|
-
}
|
|
2648
|
-
/** Fully resolved validation execution config — every property defined. */
|
|
2649
|
-
type ResolvedValidationExecutionConfig = Required<ValidationExecutionConfig>;
|
|
2650
|
-
|
|
2651
427
|
/**
|
|
2652
428
|
* Configures global validation execution defaults — when validators should run
|
|
2653
429
|
* relative to a field's reactive state.
|
|
@@ -2676,27 +452,6 @@ declare function withLegacyStatusClasses(): DynamicFormFeature<'legacy-status-cl
|
|
|
2676
452
|
/** Zero-cost type carrier used in wrapper registrations. */
|
|
2677
453
|
declare function wrapperProps<T>(): T;
|
|
2678
454
|
|
|
2679
|
-
/** Input shape passed to a wrapper component via the `fieldInputs` input. */
|
|
2680
|
-
interface WrapperFieldInputs {
|
|
2681
|
-
readonly key: string;
|
|
2682
|
-
/** Field-type discriminant (mirrors `FieldDef.type`) — useful for kind-aware addons. */
|
|
2683
|
-
readonly type?: string;
|
|
2684
|
-
readonly label?: string;
|
|
2685
|
-
readonly placeholder?: string;
|
|
2686
|
-
readonly className?: string;
|
|
2687
|
-
readonly props?: Record<string, unknown>;
|
|
2688
|
-
readonly validationMessages?: Record<string, string>;
|
|
2689
|
-
readonly defaultValidationMessages?: Record<string, string>;
|
|
2690
|
-
readonly field?: ReadonlyFieldTree;
|
|
2691
|
-
/**
|
|
2692
|
-
* Write a value into the wrapped field's tree. Provided by `buildFieldInputs`
|
|
2693
|
-
* when a `FieldTree` is present. Addons (e.g., `prime-button` presets) use this
|
|
2694
|
-
* to mutate the host field; wrappers should treat the field as read-only.
|
|
2695
|
-
*/
|
|
2696
|
-
readonly setValue?: (next: unknown) => void;
|
|
2697
|
-
readonly [key: string]: unknown;
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
455
|
/**
|
|
2701
456
|
* Dispatcher component that renders an addon by looking up its `kind` in
|
|
2702
457
|
* `ADDON_KIND_REGISTRY` and instantiating the registered component.
|
|
@@ -2914,9 +669,6 @@ interface FieldAddonSupportEntry {
|
|
|
2914
669
|
*/
|
|
2915
670
|
declare function injectFieldsSupportingAddons(): FieldAddonSupportEntry[];
|
|
2916
671
|
|
|
2917
|
-
/** Normalises a {@link DynamicValue} into a `Signal<T>`. */
|
|
2918
|
-
declare function resolveDynamicValue<T>(value: DynamicValue<T> | undefined, fallback: T, injector?: Injector): Signal<T>;
|
|
2919
|
-
|
|
2920
672
|
/** Register a custom addon kind with the form. */
|
|
2921
673
|
declare function withCustomAddon<T extends BaseAddon>(definition: AddonKindDefinition<T>): DynamicFormFeature<'addons'>;
|
|
2922
674
|
|
|
@@ -3069,69 +821,7 @@ declare function logAddonWarnings(warnings: readonly AddonWarning[], logger?: Lo
|
|
|
3069
821
|
* outside Angular's injector — build-time linters, MCP-side checks, CLI
|
|
3070
822
|
* scripts.
|
|
3071
823
|
*/
|
|
3072
|
-
declare function sanitizeFormConfigPure(config: FormConfig, fieldRegistry: ReadonlyMap<string, FieldTypeDefinition>, kindRegistry: ReadonlyMap<string, AddonKindDefinition>, options?: SanitizeFormConfigOptions): SanitizedFormConfig;
|
|
3073
|
-
|
|
3074
|
-
interface FieldWithValidation {
|
|
3075
|
-
readonly required?: boolean;
|
|
3076
|
-
readonly email?: boolean;
|
|
3077
|
-
readonly min?: number;
|
|
3078
|
-
readonly max?: number;
|
|
3079
|
-
readonly minLength?: number;
|
|
3080
|
-
readonly maxLength?: number;
|
|
3081
|
-
readonly pattern?: string | RegExp;
|
|
3082
|
-
readonly validators?: ValidatorConfig[];
|
|
3083
|
-
readonly validationMessages?: ValidationMessages;
|
|
3084
|
-
readonly logic?: LogicConfig[];
|
|
3085
|
-
/** Shorthand for simple computed/derived fields. */
|
|
3086
|
-
readonly derivation?: string;
|
|
3087
|
-
readonly schemas?: SchemaApplicationConfig[];
|
|
3088
|
-
}
|
|
3089
|
-
|
|
3090
|
-
/**
|
|
3091
|
-
* Supported primitive value types for form fields.
|
|
3092
|
-
* This type represents all possible value types that can be used in form fields.
|
|
3093
|
-
*/
|
|
3094
|
-
type ValueType = string | number | boolean | Date | object | unknown[];
|
|
3095
|
-
interface BaseValueField<TProps, TValue, TMeta extends FieldMeta = FieldMeta, TNullable extends boolean = false> extends FieldDef<TProps, TMeta>, FieldWithValidation {
|
|
3096
|
-
value?: TNullable extends true ? TValue | null : TValue;
|
|
3097
|
-
/**
|
|
3098
|
-
* Placeholder text displayed when the field is empty.
|
|
3099
|
-
* Supports static strings, Observables, and Signals for dynamic content.
|
|
3100
|
-
*/
|
|
3101
|
-
placeholder?: DynamicText;
|
|
3102
|
-
required?: boolean;
|
|
3103
|
-
/**
|
|
3104
|
-
* Whether the field accepts `null` as a valid value.
|
|
3105
|
-
*
|
|
3106
|
-
* @default false
|
|
3107
|
-
*/
|
|
3108
|
-
nullable?: TNullable;
|
|
3109
|
-
}
|
|
3110
|
-
declare function isValueField<TProps, TMeta extends FieldMeta = FieldMeta>(field: FieldDef<TProps, TMeta>): field is BaseValueField<TProps, ValueType, TMeta, boolean>;
|
|
3111
|
-
type ExcludedKeys$1 = 'type' | 'conditionals' | 'value' | 'valueType' | 'nullable' | 'disabled' | 'readonly' | 'hidden' | 'col' | 'minValue' | 'maxValue' | 'step' | 'required' | 'email' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'validators' | 'logic' | 'derivation' | 'schemas' | 'excludeValueIfHidden' | 'excludeValueIfDisabled' | 'excludeValueIfReadonly' | 'validateWhenHidden' | 'wrappers' | 'skipAutoWrappers' | 'skipDefaultWrappers' | 'addons';
|
|
3112
|
-
type ValueFieldComponent<T extends BaseValueField<Record<string, unknown> | unknown, unknown, FieldMeta, boolean>> = Prettify<WithInputSignals<Omit<T, ExcludedKeys$1>>>;
|
|
3113
|
-
|
|
3114
|
-
interface BaseCheckedField<TProps, TMeta extends FieldMeta = FieldMeta, TNullable extends boolean = false> extends FieldDef<TProps, TMeta>, FieldWithValidation {
|
|
3115
|
-
value?: TNullable extends true ? boolean | null : boolean;
|
|
3116
|
-
/**
|
|
3117
|
-
* Placeholder text displayed when the field is empty.
|
|
3118
|
-
* Supports static strings, Observables, and Signals for dynamic content.
|
|
3119
|
-
*/
|
|
3120
|
-
placeholder?: DynamicText;
|
|
3121
|
-
required?: boolean;
|
|
3122
|
-
/**
|
|
3123
|
-
* Whether the field accepts `null` as a valid value.
|
|
3124
|
-
*
|
|
3125
|
-
* @default false
|
|
3126
|
-
*/
|
|
3127
|
-
nullable?: TNullable;
|
|
3128
|
-
}
|
|
3129
|
-
declare function isCheckedField<TProps, TMeta extends FieldMeta = FieldMeta>(field: FieldDef<TProps, TMeta>): field is BaseCheckedField<TProps, TMeta, boolean>;
|
|
3130
|
-
type ExcludedKeys = 'type' | 'conditionals' | 'value' | 'nullable' | 'disabled' | 'readonly' | 'hidden' | 'col' | keyof FieldWithValidation | 'excludeValueIfHidden' | 'excludeValueIfDisabled' | 'excludeValueIfReadonly' | 'validateWhenHidden' | 'wrappers' | 'skipAutoWrappers' | 'skipDefaultWrappers' | 'addons';
|
|
3131
|
-
type CheckedFieldComponent<T extends BaseCheckedField<Record<string, unknown> | unknown, FieldMeta, boolean>> = Prettify<WithInputSignals<Omit<T, ExcludedKeys>>>;
|
|
3132
|
-
|
|
3133
|
-
declare function applyValidator(config: ValidatorConfig, fieldPath: SchemaPath<any> | SchemaPathTree<any>): void;
|
|
3134
|
-
declare function applyValidators(configs: ValidatorConfig[], fieldPath: SchemaPath<any> | SchemaPathTree<any>): void;
|
|
824
|
+
declare function sanitizeFormConfigPure(config: FormConfig, fieldRegistry: ReadonlyMap<string, _ng_forge_dynamic_forms_internal.FieldTypeDefinition>, kindRegistry: ReadonlyMap<string, _ng_forge_dynamic_forms_internal.AddonKindDefinition>, options?: SanitizeFormConfigOptions): SanitizedFormConfig;
|
|
3135
825
|
|
|
3136
826
|
declare class SubmitEvent implements FormEvent {
|
|
3137
827
|
readonly type: "submit";
|
|
@@ -3358,28 +1048,6 @@ declare function arrayEvent(arrayKey: string): {
|
|
|
3358
1048
|
move: (from: number, to: number) => MoveArrayItemEvent;
|
|
3359
1049
|
};
|
|
3360
1050
|
|
|
3361
|
-
/** Context for token resolution in event args */
|
|
3362
|
-
interface TokenContext {
|
|
3363
|
-
/** Current field key */
|
|
3364
|
-
key?: string;
|
|
3365
|
-
/** Array index if field is inside an array */
|
|
3366
|
-
index?: number;
|
|
3367
|
-
/** Parent array field key if field is inside an array */
|
|
3368
|
-
arrayKey?: string;
|
|
3369
|
-
/** Current form value for complex indexing */
|
|
3370
|
-
formValue?: unknown;
|
|
3371
|
-
/** Template for array item creation */
|
|
3372
|
-
template?: unknown;
|
|
3373
|
-
}
|
|
3374
|
-
/**
|
|
3375
|
-
* Resolves special tokens in event arguments to their actual values
|
|
3376
|
-
*
|
|
3377
|
-
* @param args - Array of arguments that may contain tokens
|
|
3378
|
-
* @param context - Context object containing token values
|
|
3379
|
-
* @returns Array with resolved values
|
|
3380
|
-
*/
|
|
3381
|
-
declare function resolveTokens(args: readonly (string | number | boolean | null | undefined)[], context: TokenContext): (string | number | boolean | null | undefined | unknown)[];
|
|
3382
|
-
|
|
3383
1051
|
/**
|
|
3384
1052
|
* Context object for array item operations (add/remove)
|
|
3385
1053
|
* Provides the necessary information to resolve tokens in array item event arguments
|
|
@@ -3419,391 +1087,5 @@ declare function createField<T extends AvailableFieldTypes>(type: T, config: Omi
|
|
|
3419
1087
|
/** Shorthand alias for createField */
|
|
3420
1088
|
declare const field: typeof createField;
|
|
3421
1089
|
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
private static readonly PREFIX;
|
|
3425
|
-
constructor(message: string);
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
/**
|
|
3429
|
-
* Builds base input properties from a field definition.
|
|
3430
|
-
*
|
|
3431
|
-
* @param fieldDef The field definition to extract properties from
|
|
3432
|
-
* @param defaultProps Optional form-level default props to merge with field props
|
|
3433
|
-
* @returns Record of input names to values
|
|
3434
|
-
*/
|
|
3435
|
-
declare function buildBaseInputs(fieldDef: FieldDef<unknown>, defaultProps?: Record<string, unknown>): Record<string, unknown>;
|
|
3436
|
-
/**
|
|
3437
|
-
* Base field mapper that extracts common field properties into component inputs.
|
|
3438
|
-
*
|
|
3439
|
-
* @param fieldDef The field definition to map
|
|
3440
|
-
* @returns Signal containing Record of input names to values
|
|
3441
|
-
*/
|
|
3442
|
-
declare function baseFieldMapper(fieldDef: FieldDef<unknown>): Signal<Record<string, unknown>>;
|
|
3443
|
-
|
|
3444
|
-
/** Maps a row field definition to container component inputs. */
|
|
3445
|
-
declare function rowFieldMapper(fieldDef: RowField): Signal<Record<string, unknown>>;
|
|
3446
|
-
|
|
3447
|
-
/**
|
|
3448
|
-
* Maps a group field definition to component inputs.
|
|
3449
|
-
*
|
|
3450
|
-
* @param fieldDef The group field definition
|
|
3451
|
-
* @returns Signal containing Record of input names to values for ngComponentOutlet
|
|
3452
|
-
*/
|
|
3453
|
-
declare function groupFieldMapper(fieldDef: GroupField): Signal<Record<string, unknown>>;
|
|
3454
|
-
|
|
3455
|
-
/**
|
|
3456
|
-
* Maps an array field definition to component inputs.
|
|
3457
|
-
*
|
|
3458
|
-
* @param fieldDef The array field definition
|
|
3459
|
-
* @returns Signal containing Record of input names to values for ngComponentOutlet
|
|
3460
|
-
*/
|
|
3461
|
-
declare function arrayFieldMapper(fieldDef: ArrayField): Signal<Record<string, unknown>>;
|
|
3462
|
-
|
|
3463
|
-
/**
|
|
3464
|
-
* Maps a page field definition to component inputs.
|
|
3465
|
-
*
|
|
3466
|
-
* @param fieldDef The page field definition
|
|
3467
|
-
* @returns Signal containing Record of input names to values for ngComponentOutlet
|
|
3468
|
-
*/
|
|
3469
|
-
declare function pageFieldMapper(fieldDef: PageField): Signal<Record<string, unknown>>;
|
|
3470
|
-
|
|
3471
|
-
/**
|
|
3472
|
-
* Maps a text field definition to component inputs.
|
|
3473
|
-
*
|
|
3474
|
-
* @param fieldDef The text field definition
|
|
3475
|
-
* @returns Signal containing Record of input names to values for ngComponentOutlet
|
|
3476
|
-
*/
|
|
3477
|
-
declare function textFieldMapper(fieldDef: TextField): Signal<Record<string, unknown>>;
|
|
3478
|
-
|
|
3479
|
-
/**
|
|
3480
|
-
* Maps a container field definition to component inputs.
|
|
3481
|
-
*
|
|
3482
|
-
* @param fieldDef The container field definition
|
|
3483
|
-
* @returns Signal containing Record of input names to values for ngComponentOutlet
|
|
3484
|
-
*/
|
|
3485
|
-
declare function containerFieldMapper(fieldDef: ContainerField): Signal<Record<string, unknown>>;
|
|
3486
|
-
|
|
3487
|
-
/**
|
|
3488
|
-
* Converts DynamicText (string | Observable | Signal) to Observable<string>
|
|
3489
|
-
* Unifies all three types into a consistent Observable stream
|
|
3490
|
-
*
|
|
3491
|
-
* @param value - The dynamic text value to convert
|
|
3492
|
-
* @param injector - Optional injector for signal conversion
|
|
3493
|
-
* @returns Observable<string> - The value as an observable stream
|
|
3494
|
-
*/
|
|
3495
|
-
declare function dynamicTextToObservable(value: DynamicText | undefined, injector?: Injector): Observable<string>;
|
|
3496
|
-
|
|
3497
|
-
/**
|
|
3498
|
-
* Applies meta attributes to a DOM element and tracks which attributes were applied.
|
|
3499
|
-
*
|
|
3500
|
-
* @param element - The DOM element to apply attributes to
|
|
3501
|
-
* @param meta - The meta object containing attributes to apply
|
|
3502
|
-
* @param previouslyApplied - Set of attribute names that were previously applied
|
|
3503
|
-
* @returns A new Set containing the attribute names that were applied
|
|
3504
|
-
*/
|
|
3505
|
-
declare function applyMetaToElement(element: Element, meta: FieldMeta | undefined, previouslyApplied: Set<string>): Set<string>;
|
|
3506
|
-
|
|
3507
|
-
/**
|
|
3508
|
-
* Wraps a `Resource` so that the previous resolved value is preserved while the resource
|
|
3509
|
-
* is loading or reloading. This prevents UI flicker when params change and a new request
|
|
3510
|
-
* is in-flight — the consumer sees the stale value with a `loading`/`reloading` status
|
|
3511
|
-
* instead of `undefined`.
|
|
3512
|
-
*/
|
|
3513
|
-
declare function withPreviousValue<T>(input: Resource<T>): Resource<T>;
|
|
3514
|
-
|
|
3515
|
-
/**
|
|
3516
|
-
* Pipe that handles dynamic text resolution with support for static strings,
|
|
3517
|
-
* Observables, and Signals.
|
|
3518
|
-
*/
|
|
3519
|
-
declare class DynamicTextPipe implements PipeTransform {
|
|
3520
|
-
private readonly injector;
|
|
3521
|
-
/**
|
|
3522
|
-
* Transforms dynamic text input into a resolved string value
|
|
3523
|
-
*
|
|
3524
|
-
* @param value - The dynamic text value to resolve
|
|
3525
|
-
* @returns The resolved string value as an Observable
|
|
3526
|
-
*/
|
|
3527
|
-
transform(value: DynamicText | undefined): Observable<string>;
|
|
3528
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DynamicTextPipe, never>;
|
|
3529
|
-
static ɵpipe: _angular_core.ɵɵPipeDeclaration<DynamicTextPipe, "dynamicText", true>;
|
|
3530
|
-
}
|
|
3531
|
-
|
|
3532
|
-
/** Container component for rendering nested form groups. */
|
|
3533
|
-
declare class GroupFieldComponent<TModel extends Record<string, unknown> = Record<string, unknown>> {
|
|
3534
|
-
private readonly destroyRef;
|
|
3535
|
-
private readonly fieldRegistry;
|
|
3536
|
-
private readonly parentFieldSignalContext;
|
|
3537
|
-
private readonly parentGroupContext;
|
|
3538
|
-
private readonly injector;
|
|
3539
|
-
protected readonly environmentInjector: EnvironmentInjector;
|
|
3540
|
-
private readonly eventBus;
|
|
3541
|
-
private readonly logger;
|
|
3542
|
-
private readonly fieldProcessors;
|
|
3543
|
-
field: _angular_core.InputSignal<GroupField<readonly _ng_forge_dynamic_forms.GroupAllowedChildren[]>>;
|
|
3544
|
-
key: _angular_core.InputSignal<string>;
|
|
3545
|
-
className: _angular_core.InputSignal<string | undefined>;
|
|
3546
|
-
hidden: _angular_core.InputSignal<boolean>;
|
|
3547
|
-
readonly hostClasses: _angular_core.Signal<string>;
|
|
3548
|
-
private readonly rawFieldRegistry;
|
|
3549
|
-
private readonly formSetup;
|
|
3550
|
-
readonly defaultValues: _angular_core.WritableSignal<Record<string, unknown>>;
|
|
3551
|
-
/**
|
|
3552
|
-
* Entity computed from parent value, group key, and defaults.
|
|
3553
|
-
* Uses deep equality check to prevent unnecessary updates when
|
|
3554
|
-
* object spread creates new references with identical values.
|
|
3555
|
-
*/
|
|
3556
|
-
private readonly entity;
|
|
3557
|
-
private readonly form;
|
|
3558
|
-
readonly formValue: _angular_core.Signal<{}>;
|
|
3559
|
-
readonly valid: _angular_core.Signal<boolean>;
|
|
3560
|
-
readonly invalid: _angular_core.Signal<boolean>;
|
|
3561
|
-
readonly dirty: _angular_core.Signal<boolean>;
|
|
3562
|
-
readonly touched: _angular_core.Signal<boolean>;
|
|
3563
|
-
readonly errors: _angular_core.Signal<_angular_forms_signals.ValidationError.WithFieldTree[]>;
|
|
3564
|
-
readonly disabled: _angular_core.Signal<boolean>;
|
|
3565
|
-
private readonly nestedFieldTree;
|
|
3566
|
-
private readonly groupFieldSignalContext;
|
|
3567
|
-
/**
|
|
3568
|
-
* Group context propagated to descendants — carries the dot-separated path of
|
|
3569
|
-
* group ancestors so child fields can scope their DOM IDs (issue #401).
|
|
3570
|
-
* Reactive via `computed()`: a nested group composes its path from the parent
|
|
3571
|
-
* context signal + its own key, so the chain stays consistent if either changes.
|
|
3572
|
-
*/
|
|
3573
|
-
private readonly groupContext;
|
|
3574
|
-
private readonly groupInjector;
|
|
3575
|
-
readonly validityChange: _angular_core.OutputRef<boolean>;
|
|
3576
|
-
readonly dirtyChange: _angular_core.OutputRef<boolean>;
|
|
3577
|
-
readonly submitted: _angular_core.OutputRef<SubmitEvent>;
|
|
3578
|
-
private readonly fieldsSource;
|
|
3579
|
-
protected readonly resolvedFields: _angular_core.Signal<ResolvedField[]>;
|
|
3580
|
-
constructor();
|
|
3581
|
-
private setupEffects;
|
|
3582
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<GroupFieldComponent<any>, never>;
|
|
3583
|
-
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; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; }, { "validityChange": "validityChange"; "dirtyChange": "dirtyChange"; "submitted": "submitted"; }, never, never, true, never>;
|
|
3584
|
-
}
|
|
3585
|
-
|
|
3586
|
-
/** A single field within a resolved array item. */
|
|
3587
|
-
interface ResolvedArrayItemField {
|
|
3588
|
-
/** Field key (used for tracking and test IDs). */
|
|
3589
|
-
key: string;
|
|
3590
|
-
/** Original field definition — used by DfFieldOutlet to resolve wrappers. */
|
|
3591
|
-
fieldDef: FieldDef<unknown>;
|
|
3592
|
-
/** The loaded component type. */
|
|
3593
|
-
component: Type<unknown>;
|
|
3594
|
-
/** Injector providing ARRAY_CONTEXT and FIELD_SIGNAL_CONTEXT. */
|
|
3595
|
-
injector: Injector;
|
|
3596
|
-
/** Inputs signal for DfFieldOutlet — evaluated in template for reactivity. */
|
|
3597
|
-
inputs: Signal<Record<string, unknown>>;
|
|
3598
|
-
/** Whether required mapped inputs are available for safe component instantiation. */
|
|
3599
|
-
renderReady: Signal<boolean>;
|
|
3600
|
-
/**
|
|
3601
|
-
* Whether the array-item field is currently hidden — mirrors `ResolvedField.hidden`
|
|
3602
|
-
* so the same `@if (!field.hidden())` template gate works for top-level and
|
|
3603
|
-
* array-item fields.
|
|
3604
|
-
*/
|
|
3605
|
-
hidden: Signal<boolean>;
|
|
3606
|
-
}
|
|
3607
|
-
/**
|
|
3608
|
-
* Resolved array item ready for declarative rendering with ngComponentOutlet.
|
|
3609
|
-
* Each item has a stable unique ID and a linkedSignal-based index that
|
|
3610
|
-
* automatically updates when items are added/removed.
|
|
3611
|
-
* Supports multiple fields per array item (e.g., name + email without a wrapper).
|
|
3612
|
-
*/
|
|
3613
|
-
interface ResolvedArrayItem {
|
|
3614
|
-
/** Unique identifier for this item (stable across position changes). */
|
|
3615
|
-
id: string;
|
|
3616
|
-
/** All fields to render for this array item. */
|
|
3617
|
-
fields: ResolvedArrayItemField[];
|
|
3618
|
-
}
|
|
3619
|
-
|
|
3620
|
-
/** Container component for rendering dynamic arrays of fields. */
|
|
3621
|
-
declare class ArrayFieldComponent<TModel extends Record<string, unknown> = Record<string, unknown>> {
|
|
3622
|
-
private readonly destroyRef;
|
|
3623
|
-
private readonly fieldRegistry;
|
|
3624
|
-
private readonly parentFieldSignalContext;
|
|
3625
|
-
private readonly parentInjector;
|
|
3626
|
-
protected readonly environmentInjector: EnvironmentInjector;
|
|
3627
|
-
private readonly eventBus;
|
|
3628
|
-
private readonly logger;
|
|
3629
|
-
private readonly arrayItemRegistry;
|
|
3630
|
-
private readonly slot;
|
|
3631
|
-
/** Bound id-generator reference threaded to `resolveArrayItem` so callsites stay terse. */
|
|
3632
|
-
private readonly generateItemId;
|
|
3633
|
-
field: _angular_core.InputSignal<ArrayField<readonly ArrayItemDefinition[]>>;
|
|
3634
|
-
key: _angular_core.InputSignal<string>;
|
|
3635
|
-
className: _angular_core.InputSignal<string | undefined>;
|
|
3636
|
-
hidden: _angular_core.InputSignal<boolean>;
|
|
3637
|
-
readonly hostClasses: Signal<string>;
|
|
3638
|
-
private readonly rawFieldRegistry;
|
|
3639
|
-
/**
|
|
3640
|
-
* Gets the auto-remove button FieldDef from normalization metadata.
|
|
3641
|
-
* Set by simplified array normalization for primitive arrays with remove buttons.
|
|
3642
|
-
* The button is rendered alongside each item without wrapping in a row,
|
|
3643
|
-
* preserving flat primitive form values.
|
|
3644
|
-
*/
|
|
3645
|
-
private readonly autoRemoveButton;
|
|
3646
|
-
/**
|
|
3647
|
-
* For primitive array items, the key of the value field template (e.g., 'value').
|
|
3648
|
-
* Used to wrap the FormControl in the item context so getFieldTree(key) works.
|
|
3649
|
-
* Returns undefined for object arrays (FormGroup items have natural child navigation).
|
|
3650
|
-
*/
|
|
3651
|
-
private readonly primitiveFieldKey;
|
|
3652
|
-
/**
|
|
3653
|
-
* Normalized item templates WITHOUT auto-remove button appended.
|
|
3654
|
-
* Each element is normalized to an array: single FieldDef → [FieldDef], array stays as-is.
|
|
3655
|
-
*/
|
|
3656
|
-
private readonly rawItemTemplates;
|
|
3657
|
-
/**
|
|
3658
|
-
* Resolves the effective fallback template for this array — used when the form
|
|
3659
|
-
* value contains an item with no registered template (i.e., items that were
|
|
3660
|
-
* neither added via event handlers nor covered by a positional entry in `fields`).
|
|
3661
|
-
*/
|
|
3662
|
-
private readonly fallbackTemplate;
|
|
3663
|
-
/**
|
|
3664
|
-
* Gets the item templates (field definitions) for the array.
|
|
3665
|
-
* Each element can be either:
|
|
3666
|
-
* - A single FieldDef (primitive item) - normalized to [FieldDef]
|
|
3667
|
-
* - An array of FieldDefs (object item) - used as-is
|
|
3668
|
-
*/
|
|
3669
|
-
private readonly itemTemplates;
|
|
3670
|
-
private readonly arrayFieldTrees;
|
|
3671
|
-
private readonly resolvedItemsSignal;
|
|
3672
|
-
private readonly fsm;
|
|
3673
|
-
/**
|
|
3674
|
-
* Map of item IDs to their current positions. O(1) lookup vs O(n) indexOf().
|
|
3675
|
-
* Used by child linkedSignals to reactively track their position in the array.
|
|
3676
|
-
*/
|
|
3677
|
-
private readonly itemPositionMap;
|
|
3678
|
-
/** Read-only view of resolved items for template consumption. */
|
|
3679
|
-
readonly resolvedItems: Signal<ResolvedArrayItem[]>;
|
|
3680
|
-
private readonly allResolvedFieldsRenderReady;
|
|
3681
|
-
/**
|
|
3682
|
-
* Whether the array has reached its configured maxLength.
|
|
3683
|
-
* Exposed as a public signal so add-button components can bind [disabled]="atMaxLength()".
|
|
3684
|
-
*/
|
|
3685
|
-
readonly atMaxLength: Signal<boolean>;
|
|
3686
|
-
/**
|
|
3687
|
-
* Caches the result of appending the auto-remove button to template arrays.
|
|
3688
|
-
* Keyed by template array reference — cache hits occur during recreate/resolution
|
|
3689
|
-
* operations where stored template references are reused. Add operations via
|
|
3690
|
-
* handleAddFromEvent always create a fresh `[...template]` copy (line ~277),
|
|
3691
|
-
* so each add is a cache miss by design (the spread is needed for mutability).
|
|
3692
|
-
*/
|
|
3693
|
-
private readonly autoRemoveCache;
|
|
3694
|
-
constructor();
|
|
3695
|
-
private setupEffects;
|
|
3696
|
-
private setupEventHandlers;
|
|
3697
|
-
/**
|
|
3698
|
-
* Handles add operations from events (append, prepend, insert).
|
|
3699
|
-
* Creates resolved items FIRST, then updates form value.
|
|
3700
|
-
* This ensures prepend/insert work correctly - differential update sees "none"
|
|
3701
|
-
* because resolved items count already matches the new array length.
|
|
3702
|
-
*/
|
|
3703
|
-
private handleAddFromEvent;
|
|
3704
|
-
private performDifferentialUpdate;
|
|
3705
|
-
private resolveAllItems;
|
|
3706
|
-
private appendItems;
|
|
3707
|
-
/** Creates an observable that resolves a single array item. */
|
|
3708
|
-
private createResolveItemObservable;
|
|
3709
|
-
/**
|
|
3710
|
-
* Appends the auto-remove button to a templates array for rendering.
|
|
3711
|
-
* The button is added for visual rendering only — it doesn't affect the form schema.
|
|
3712
|
-
* Original templates are stored in templateRegistry WITHOUT the remove button,
|
|
3713
|
-
* so this method is called during resolution to add it dynamically.
|
|
3714
|
-
*/
|
|
3715
|
-
private withAutoRemove;
|
|
3716
|
-
/**
|
|
3717
|
-
* Handles move operations — reorders an existing item without destroying it.
|
|
3718
|
-
* Updates resolvedItems and form value atomically. Since the array length
|
|
3719
|
-
* doesn't change, `determineDifferentialOperation` returns 'none' and no
|
|
3720
|
-
* recreate is triggered. The `@for` loop tracks by `item.id`, so Angular
|
|
3721
|
-
* moves the DOM node instead of destroying/recreating. The `itemPositionMap`
|
|
3722
|
-
* computed auto-recomputes, propagating new indices to child linkedSignals.
|
|
3723
|
-
*/
|
|
3724
|
-
private moveItem;
|
|
3725
|
-
/**
|
|
3726
|
-
* Handles remove operations from events (pop, shift, removeAt).
|
|
3727
|
-
* Updates resolvedItems FIRST, then form value - this ensures differential
|
|
3728
|
-
* update sees "none" (lengths match) and avoids unnecessary recreates.
|
|
3729
|
-
* Remaining items' linkedSignal indices auto-update via itemPositionMap.
|
|
3730
|
-
*/
|
|
3731
|
-
private removeItem;
|
|
3732
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ArrayFieldComponent<any>, never>;
|
|
3733
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ArrayFieldComponent<any>, "array-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "key": { "alias": "key"; "required": true; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3734
|
-
}
|
|
3735
|
-
|
|
3736
|
-
/** Layout container that wraps child fields with UI chrome. */
|
|
3737
|
-
declare class ContainerFieldComponent {
|
|
3738
|
-
private readonly destroyRef;
|
|
3739
|
-
private readonly fieldRegistry;
|
|
3740
|
-
private readonly injector;
|
|
3741
|
-
protected readonly environmentInjector: EnvironmentInjector;
|
|
3742
|
-
private readonly eventBus;
|
|
3743
|
-
private readonly logger;
|
|
3744
|
-
private readonly wrapperAutoAssociations;
|
|
3745
|
-
private readonly defaultWrappersSignal;
|
|
3746
|
-
private readonly childrenTpl;
|
|
3747
|
-
private readonly wrapperContainer;
|
|
3748
|
-
field: _angular_core.InputSignal<ContainerField<readonly _ng_forge_dynamic_forms.ContainerAllowedChildren[], readonly _ng_forge_dynamic_forms.WrapperConfig[]>>;
|
|
3749
|
-
key: _angular_core.InputSignal<string>;
|
|
3750
|
-
className: _angular_core.InputSignal<string | undefined>;
|
|
3751
|
-
hidden: _angular_core.InputSignal<boolean>;
|
|
3752
|
-
readonly hostClasses: _angular_core.Signal<string>;
|
|
3753
|
-
readonly disabled: _angular_core.Signal<boolean>;
|
|
3754
|
-
private readonly rawFieldRegistry;
|
|
3755
|
-
private readonly fieldsSource;
|
|
3756
|
-
protected readonly resolvedFields: _angular_core.Signal<ResolvedField[]>;
|
|
3757
|
-
private readonly wrappers;
|
|
3758
|
-
constructor();
|
|
3759
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContainerFieldComponent, never>;
|
|
3760
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContainerFieldComponent, "div[container-field]", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "key": { "alias": "key"; "required": true; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3761
|
-
}
|
|
3762
|
-
|
|
3763
|
-
/**
|
|
3764
|
-
* Native JavaScript utility functions to replace lodash-es
|
|
3765
|
-
* These are simple implementations for common object manipulation patterns
|
|
3766
|
-
*/
|
|
3767
|
-
/**
|
|
3768
|
-
* Performs a deep equality comparison between two values.
|
|
3769
|
-
*
|
|
3770
|
-
* @param a - First value
|
|
3771
|
-
* @param b - Second value
|
|
3772
|
-
* @returns true if values are deeply equal
|
|
3773
|
-
*/
|
|
3774
|
-
declare function isEqual(a: unknown, b: unknown): boolean;
|
|
3775
|
-
/**
|
|
3776
|
-
* Creates a new object without the specified keys
|
|
3777
|
-
* Native replacement for lodash omit()
|
|
3778
|
-
*
|
|
3779
|
-
* @param obj - Source object
|
|
3780
|
-
* @param keys - Keys to omit
|
|
3781
|
-
* @returns New object without specified keys
|
|
3782
|
-
*/
|
|
3783
|
-
declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
3784
|
-
|
|
3785
|
-
/**
|
|
3786
|
-
* Interpolates {{param}} placeholders in message with error values
|
|
3787
|
-
*
|
|
3788
|
-
* @param message - Message template with {{param}} placeholders
|
|
3789
|
-
* @param error - Validation error containing parameter values
|
|
3790
|
-
* @returns Message with interpolated parameters
|
|
3791
|
-
*/
|
|
3792
|
-
declare function interpolateParams(message: string, error: ValidationError): string;
|
|
3793
|
-
|
|
3794
|
-
/** Registry service that provides access to the root form and its values. */
|
|
3795
|
-
declare class RootFormRegistryService {
|
|
3796
|
-
readonly formValue: Signal<Record<string, unknown>>;
|
|
3797
|
-
readonly rootForm: Signal<FieldTree<Record<string, unknown>> | undefined>;
|
|
3798
|
-
constructor(formValue: Signal<Record<string, unknown>>, rootForm: Signal<FieldTree<Record<string, unknown>> | undefined>);
|
|
3799
|
-
}
|
|
3800
|
-
|
|
3801
|
-
/**
|
|
3802
|
-
* Injection token for configuring the initialization timeout in milliseconds.
|
|
3803
|
-
* Defaults to 10 seconds. When the timeout is reached, a warning is logged
|
|
3804
|
-
* and (initialized) emits true as a best-effort fallback.
|
|
3805
|
-
*/
|
|
3806
|
-
declare const INITIALIZATION_TIMEOUT_MS: InjectionToken<number>;
|
|
3807
|
-
|
|
3808
|
-
export { ADDON_ACTION_HANDLERS, ADDON_ACTION_REGISTRY, ADDON_KIND_COMPONENT_CACHE, ADDON_KIND_DEFINITIONS, ADDON_KIND_REGISTRY, ARRAY_CONTEXT, AppendArrayItemEvent, ArrayFieldComponent, BUILT_IN_FIELDS, ComponentAddonComponent, ConsoleLogger, ContainerFieldComponent, DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES, DEFAULT_WRAPPERS, DF_FIELD_TEMPLATES, DfAddonSlot, DfTemplate, DynamicForm, DynamicFormError, DynamicFormLogger, DynamicTextPipe, EventBus, EventDispatcher, FIELD_REGISTRY, FIELD_SIGNAL_CONTEXT, FORM_OPTIONS, FormClearEvent, FormResetEvent, GROUP_CONTEXT, GroupFieldComponent, INITIALIZATION_TIMEOUT_MS, InsertArrayItemEvent, MoveArrayItemEvent, NextPageEvent, NoopLogger, PageChangeEvent, PopArrayItemEvent, PrependArrayItemEvent, PreviousPageEvent, RemoveAtIndexEvent, RootFormRegistryService, ShiftArrayItemEvent, SubmitEvent, TemplateAddonComponent, TextAddonComponent, WRAPPER_REGISTRY, applyMetaToElement, applyValidator, applyValidators, arrayEvent, arrayFieldMapper, baseFieldMapper, buildBaseInputs, containerFieldMapper, createField, createWrappers, dynamicTextToObservable, evaluateNonFieldDisabled, evaluateNonFieldHidden, field, formConfig, formatAddonWarning, getArrayLength, groupFieldMapper, hasFormValue, injectAddonKindRegistry, injectFieldSignalContext, injectFieldsSupportingAddons, interpolateParams, isArrayField, isCheckedField, isContainerField, isContainerTypedField, isDisplayOnlyField, isEqual, isFieldBoundContext, isFormStateCondition, isGroupField, isLeafField, isPageField, isRowField, isSimplifiedArrayField, isValueBearingField, isValueField, isWrapperTypeDefinition, isWrappersBundle, logAddonWarnings, omit, pageFieldMapper, provideAddonActions, provideDynamicForm, resolveDynamicValue, resolveNextButtonDisabled, resolveNonFieldDisabled, resolveNonFieldHidden, resolveSubmitButtonDisabled, resolveTokens, rowFieldMapper, runPresetAction, sanitizeFormConfig, sanitizeFormConfigPure, textFieldMapper, toReadonlyFieldTree, validateFieldAddons, walkAndValidateAddons, withCustomAddon, withEventFormValue, withLegacyStatusClasses, withLoggerConfig, withPreviousValue, withValidationExecutionDefaults, withValueExclusionDefaults, wrapperProps, writeToFieldValue };
|
|
3809
|
-
export type { AddonActionContext, AddonActionHandler, AddonActionPreset, AddonActionsFeature, AddonKindDefinition, AddonKindSchema, AddonShapeValidator, AddonSlot, AddonWarning, AnyAddon, ArrayAllowedChildren, ArrayButtonConfig, ArrayContext, ArrayField, ArrayFieldTree, ArrayItemContext, ArrayItemDefinitionTemplate, ArrayItemTemplate, AsyncCondition, AsyncConditionFunction, AsyncCustomValidator, AsyncDerivationFunction, AsyncValidatorConfig, AvailableFieldTypes, BaseAddon, BaseCheckedField, BaseValidatorConfig, BaseValueField, BuiltInValidatorConfig, ButtonLogicContext, CheckedFieldComponent, CommonAddonActionPreset, CommonAddonSlot, ComponentAddon, ConditionalExpression, ContainerAllowedChildren, ContainerField, ContainerFieldTypes, CssWrapper, CustomFnConfig, CustomFunction, CustomValidator, CustomValidatorConfig, DeclarativeHttpValidatorConfig, DynamicFormActionRegistry, DynamicFormAddonActionPresetRegistry, DynamicFormAddonRegistry, DynamicFormAddonSlotRegistry, DynamicFormFieldRegistry, DynamicText, DynamicValue, EvaluationContext, ExtractField, ExtractFieldDefs, ExtractFormValue, FieldAddonSupport, FieldAddonSupportEntry, FieldBoundAddonActionContext, FieldComponent, FieldDef, FieldMeta, FieldOption, FieldPathAccess, FieldRegistryContainers, FieldRegistryLeaves, FieldRegistryWrappers, FieldScope, FieldSignalContext, FieldStateContext, FieldStateInfo, FieldTypeDefinition, FieldWithValidation, FieldWrapper, FormConfig, FormEvent, FormEventConstructor, FormFieldStateMap, FormMode, FormModeDetectionResult, FormOptions, FormStateCondition, GroupAllowedChildren, GroupField, HttpCondition, HttpCustomValidator, HttpRequestConfig, HttpResourceRequest, HttpValidationResponseMapping, InferFormValue$1 as InferFormValue, InferWrapperRegistry, LeafFieldTypes, Logger, LogicConfig, MapperFn, NarrowField, NarrowFields, NextButtonOptions, NonFieldLogicConfig, NonFieldLogicContext, NonFieldLogicType, OrphanAddonActionContext, PageAllowedChildren, PageField, PresetCollaborators, Prettify, ReadonlyFieldTree, RegisteredActionRef, RegisteredFieldTypes, ResolvedValidationExecutionConfig, ResolvedValueExclusionConfig, RowAllowedChildren, RowField, SanitizeFormConfigOptions, SanitizedFormConfig, SchemaApplicationConfig, SchemaDefinition, SimplifiedArrayField, StateLogicConfig, SubmissionActionResult, SubmissionConfig, SubmitButtonOptions, TemplateAddon, TextAddon, TextElementType, TextField, TextProps, TokenContext, ValidationError, ValidationExecutionConfig, ValidationMessages, ValidatorConfig, ValueExclusionConfig, ValueFieldComponent, ValueHandlingMode, ValueType, WithInputSignals, WrapperConfig, WrapperFieldInputs, WrapperRegistration, WrapperTypeDefinition, WrappersBundle };
|
|
1090
|
+
export { ADDON_ACTION_HANDLERS, ADDON_ACTION_REGISTRY, ADDON_KIND_COMPONENT_CACHE, ADDON_KIND_DEFINITIONS, AppendArrayItemEvent, BUILT_IN_FIELDS, ComponentAddonComponent, ConsoleLogger, DfAddonSlot, DfTemplate, DynamicForm, EventDispatcher, FormClearEvent, FormResetEvent, InsertArrayItemEvent, MoveArrayItemEvent, NextPageEvent, PageChangeEvent, PopArrayItemEvent, PrependArrayItemEvent, PreviousPageEvent, RemoveAtIndexEvent, ShiftArrayItemEvent, SubmitEvent, TemplateAddonComponent, TextAddonComponent, arrayEvent, createField, createWrappers, field, formConfig, formatAddonWarning, injectAddonKindRegistry, injectFieldsSupportingAddons, isWrappersBundle, logAddonWarnings, provideAddonActions, provideDynamicForm, runPresetAction, sanitizeFormConfig, sanitizeFormConfigPure, validateFieldAddons, walkAndValidateAddons, withCustomAddon, withEventFormValue, withLegacyStatusClasses, withLoggerConfig, withValidationExecutionDefaults, withValueExclusionDefaults, wrapperProps };
|
|
1091
|
+
export type { AddonActionHandler, AddonActionsFeature, AddonWarning, ArrayItemContext, ArrayItemDefinitionTemplate, ExtractFieldDefs, ExtractFormValue, FieldAddonSupportEntry, InferWrapperRegistry, PresetCollaborators, SanitizeFormConfigOptions, SanitizedFormConfig, WrapperRegistration, WrappersBundle };
|