@decaf-ts/for-angular 0.0.23 → 0.0.25

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.
Files changed (36) hide show
  1. package/components/component-renderer/component-renderer.component.d.ts +3 -2
  2. package/components/crud-field/crud-field.component.d.ts +4 -2
  3. package/components/fieldset/fieldset.component.d.ts +10 -1
  4. package/components/for-angular-components.module.d.ts +3 -2
  5. package/components/index.d.ts +1 -0
  6. package/components/layout/layout.component.d.ts +1 -24
  7. package/components/model-renderer/model-renderer.component.d.ts +6 -1
  8. package/components/stepped-form/stepped-form.component.d.ts +255 -0
  9. package/engine/NgxBaseComponent.d.ts +2 -2
  10. package/engine/NgxCrudFormField.d.ts +1 -0
  11. package/engine/NgxFormService.d.ts +381 -48
  12. package/engine/NgxRenderingEngine.d.ts +4 -2
  13. package/engine/interfaces.d.ts +1 -1
  14. package/engine/types.d.ts +4 -3
  15. package/esm2022/components/component-renderer/component-renderer.component.mjs +10 -4
  16. package/esm2022/components/crud-field/crud-field.component.mjs +14 -3
  17. package/esm2022/components/crud-form/crud-form.component.mjs +3 -3
  18. package/esm2022/components/empty-state/empty-state.component.mjs +2 -2
  19. package/esm2022/components/fieldset/fieldset.component.mjs +5 -3
  20. package/esm2022/components/for-angular-components.module.mjs +12 -7
  21. package/esm2022/components/index.mjs +2 -1
  22. package/esm2022/components/layout/layout.component.mjs +4 -29
  23. package/esm2022/components/list/list.component.mjs +3 -3
  24. package/esm2022/components/model-renderer/model-renderer.component.mjs +10 -3
  25. package/esm2022/components/stepped-form/stepped-form.component.mjs +306 -0
  26. package/esm2022/engine/NgxBaseComponent.mjs +10 -4
  27. package/esm2022/engine/NgxCrudFormField.mjs +19 -17
  28. package/esm2022/engine/NgxFormService.mjs +438 -57
  29. package/esm2022/engine/NgxRenderingEngine.mjs +21 -10
  30. package/esm2022/engine/ValidatorFactory.mjs +4 -4
  31. package/esm2022/engine/interfaces.mjs +1 -1
  32. package/esm2022/engine/types.mjs +1 -1
  33. package/esm2022/i18n/data/en.json +5 -0
  34. package/fesm2022/decaf-ts-for-angular.mjs +837 -137
  35. package/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
  36. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { FieldProperties } from '@decaf-ts/ui-decorators';
2
- import { FieldUpdateMode } from './types';
3
- import { IComponentConfig } from './interfaces';
1
+ import { FieldProperties, UIModelMetadata } from '@decaf-ts/ui-decorators';
2
+ import { FieldUpdateMode, FormParent } from './types';
3
+ import { IComponentConfig, IComponentInput } from './interfaces';
4
4
  import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms';
5
5
  import { OperationKeys } from '@decaf-ts/db-decorators';
6
6
  /**
@@ -64,26 +64,106 @@ export declare class NgxFormService {
64
64
  * @memberOf NgxFormService
65
65
  */
66
66
  private static formRegistry;
67
+ private static pageMapper;
68
+ /**
69
+ * @description Creates a new form group or form array with the specified identifier.
70
+ * @summary Generates a FormGroup or FormArray based on the provided properties. If pages are specified
71
+ * and greater than 1, creates a FormArray; otherwise creates a FormGroup. The form can optionally
72
+ * be registered in the global form registry for later access throughout the application.
73
+ *
74
+ * @param {string} id - Unique identifier for the form
75
+ * @param {Partial<IComponentInput>} [props={}] - Configuration properties for the form
76
+ * @param {boolean} [registry=true] - Whether to register the form in the global registry
77
+ * @return {FormGroup | FormArray} The created form instance
78
+ *
79
+ * @mermaid
80
+ * sequenceDiagram
81
+ * participant C as Component
82
+ * participant NFS as NgxFormService
83
+ * participant FR as Form Registry
84
+ * participant AF as Angular Forms
85
+ *
86
+ * C->>NFS: createForm(id, props, registry)
87
+ * NFS->>FR: Check if form exists
88
+ * alt Form doesn't exist
89
+ * alt props.pages > 1
90
+ * NFS->>AF: new FormArray([])
91
+ * else
92
+ * NFS->>AF: new FormGroup({})
93
+ * end
94
+ * alt registry is true
95
+ * NFS->>FR: addRegistry(id, form)
96
+ * end
97
+ * end
98
+ * NFS-->>C: Return FormGroup | FormArray
99
+ *
100
+ * @static
101
+ * @memberOf NgxFormService
102
+ */
103
+ static createForm(id: string, props?: Partial<IComponentInput>, registry?: boolean): FormGroup | FormArray;
67
104
  /**
68
105
  * @description Adds a form to the registry.
69
- * @summary Registers a FormGroup with a unique identifier. Throws an error if the identifier is already in use.
70
- * @param {string} formId - The unique identifier for the form.
71
- * @param {FormGroup} formGroup - The FormGroup to be registered.
72
- * @throws {Error} If a FormGroup with the given id is already registered.
106
+ * @summary Registers a FormGroup or FormArray with a unique identifier for global access throughout
107
+ * the application. This allows forms to be retrieved and managed centrally. Throws an error if
108
+ * the identifier is already in use to prevent conflicts.
109
+ *
110
+ * @param {string} formId - The unique identifier for the form
111
+ * @param {FormParent} formGroup - The FormGroup or FormArray to be registered
112
+ * @return {void}
113
+ * @throws {Error} If a FormGroup with the given id is already registered
114
+ *
115
+ * @static
116
+ * @memberOf NgxFormService
73
117
  */
74
- static addRegistry(formId: string, formGroup: FormGroup): void;
118
+ static addRegistry(formId: string, formGroup: FormParent): void;
75
119
  /**
76
120
  * @description Removes a form from the registry.
77
- * @summary Deletes a FormGroup from the registry using its unique identifier.
78
- * @param {string} formId - The unique identifier of the form to be removed.
121
+ * @summary Deletes a FormGroup or FormArray from the registry using its unique identifier.
122
+ * This cleans up the registry and allows the identifier to be reused. The form itself
123
+ * is not destroyed, only removed from the central registry.
124
+ *
125
+ * @param {string} formId - The unique identifier of the form to be removed
126
+ * @return {void}
127
+ *
128
+ * @static
129
+ * @memberOf NgxFormService
79
130
  */
80
131
  static removeRegistry(formId: string): void;
81
132
  /**
82
133
  * @description Resolves the parent group and control name from a path.
83
134
  * @summary Traverses the form group structure to find the parent group and control name for a given path.
84
- * @param {FormGroup} formGroup - The root FormGroup.
85
- * @param {string} path - The path to the control.
86
- * @return {FormParentGroup} A tuple containing the parent FormGroup and the control name.
135
+ * Handles complex nested structures including arrays and sub-groups. Creates missing intermediate
136
+ * groups as needed and properly configures FormArray controls for multiple value scenarios.
137
+ *
138
+ * @param {FormGroup} formGroup - The root FormGroup to traverse
139
+ * @param {string} path - The dot-separated path to the control (e.g., 'user.address.street')
140
+ * @param {IComponentInput} componentProps - Properties defining the component configuration
141
+ * @param {KeyValue} parentProps - Properties from the parent component for context
142
+ * @return {FormParentGroup} A tuple containing the parent FormGroup and the control name
143
+ *
144
+ * @private
145
+ * @mermaid
146
+ * sequenceDiagram
147
+ * participant NFS as NgxFormService
148
+ * participant FG as FormGroup
149
+ * participant FA as FormArray
150
+ *
151
+ * NFS->>NFS: Split path into parts
152
+ * loop For each path part
153
+ * alt Control doesn't exist
154
+ * alt isMultiple and part is childOf
155
+ * NFS->>FA: new FormArray([new FormGroup({})])
156
+ * else
157
+ * NFS->>FG: new FormGroup({})
158
+ * end
159
+ * NFS->>FG: addControl(part, newControl)
160
+ * end
161
+ * NFS->>NFS: Navigate to next level
162
+ * end
163
+ * NFS-->>NFS: Return [parentGroup, controlName]
164
+ *
165
+ * @static
166
+ * @memberOf NgxFormService
87
167
  */
88
168
  private static resolveParentGroup;
89
169
  /**
@@ -175,43 +255,232 @@ export declare class NgxFormService {
175
255
  /**
176
256
  * @description Retrieves a control from a registered form.
177
257
  * @summary Finds and returns an AbstractControl from a registered form using the form id and optional path.
178
- * @param {string} formId - The unique identifier of the form.
179
- * @param {string} [path] - The path to the control within the form.
180
- * @return {AbstractControl} The requested AbstractControl.
181
- * @throws {Error} If the form is not found in the registry or the control is not found in the form.
258
+ * This method provides centralized access to form controls across the application by leveraging
259
+ * the form registry system.
260
+ *
261
+ * @param {string} formId - The unique identifier of the form in the registry
262
+ * @param {string} [path] - The optional dot-separated path to a specific control within the form
263
+ * @return {AbstractControl} The requested AbstractControl (FormGroup, FormArray, or FormControl)
264
+ * @throws {Error} If the form is not found in the registry or the control is not found in the form
265
+ *
266
+ * @mermaid
267
+ * sequenceDiagram
268
+ * participant C as Component
269
+ * participant NFS as NgxFormService
270
+ * participant FR as Form Registry
271
+ *
272
+ * C->>NFS: getControlFromForm(formId, path?)
273
+ * NFS->>FR: Get form by formId
274
+ * alt Form not found
275
+ * FR-->>NFS: null
276
+ * NFS-->>C: Throw Error
277
+ * else Form found
278
+ * FR-->>NFS: Return form
279
+ * alt path provided
280
+ * NFS->>NFS: form.get(path)
281
+ * alt Control not found
282
+ * NFS-->>C: Throw Error
283
+ * else
284
+ * NFS-->>C: Return control
285
+ * end
286
+ * else
287
+ * NFS-->>C: Return form
288
+ * end
289
+ * end
290
+ *
291
+ * @static
292
+ * @memberOf NgxFormService
182
293
  */
183
294
  static getControlFromForm(formId: string, path?: string): AbstractControl;
295
+ /**
296
+ * @description Creates a form from UI model metadata children.
297
+ * @summary Generates a FormGroup from an array of UIModelMetadata objects, extracting component
298
+ * properties and creating appropriate form controls. This method is specifically designed to work
299
+ * with the UI decorator system and provides automatic form generation from metadata.
300
+ *
301
+ * @param {string} id - Unique identifier for the form
302
+ * @param {boolean} [registry=false] - Whether to register the created form in the global registry
303
+ * @param {UIModelMetadata[]} [children] - Array of UI model metadata objects to create controls from
304
+ * @return {FormGroup} The created FormGroup with controls for each child metadata
305
+ *
306
+ * @mermaid
307
+ * sequenceDiagram
308
+ * participant C as Component
309
+ * participant NFS as NgxFormService
310
+ * participant AF as Angular Forms
311
+ *
312
+ * C->>NFS: createFormFromChildren(id, registry, children)
313
+ * NFS->>AF: new FormGroup({})
314
+ * loop For each child metadata
315
+ * NFS->>NFS: addFormControl(form, child.props)
316
+ * NFS->>AF: Create and add FormControl
317
+ * end
318
+ * alt registry is true
319
+ * NFS->>NFS: addRegistry(id, form)
320
+ * end
321
+ * NFS-->>C: Return FormGroup
322
+ *
323
+ * @static
324
+ * @memberOf NgxFormService
325
+ */
326
+ static createFormFromChildren(id: string, registry?: boolean, children?: UIModelMetadata[]): FormGroup;
184
327
  /**
185
328
  * @description Creates a form from component configurations.
186
329
  * @summary Generates a FormGroup based on an array of component configurations and optionally registers it.
187
- * @param {string} id - The unique identifier for the form.
188
- * @param {IComponentConfig[]} components - An array of component configurations.
189
- * @param {boolean} [registry=false] - Whether to register the created form.
190
- * @return {FormGroup} The created FormGroup.
330
+ * This method processes component input configurations to create appropriate form controls with
331
+ * validation and initial values.
332
+ *
333
+ * @param {string} id - The unique identifier for the form
334
+ * @param {IComponentConfig[]} components - An array of component configurations defining the form structure
335
+ * @param {boolean} [registry=false] - Whether to register the created form in the global registry
336
+ * @return {FormGroup} The created FormGroup with controls for each component configuration
337
+ *
338
+ * @mermaid
339
+ * sequenceDiagram
340
+ * participant C as Component
341
+ * participant NFS as NgxFormService
342
+ * participant AF as Angular Forms
343
+ *
344
+ * C->>NFS: createFormFromComponents(id, components, registry)
345
+ * NFS->>AF: new FormGroup({})
346
+ * loop For each component config
347
+ * NFS->>NFS: addFormControl(form, component.inputs)
348
+ * NFS->>AF: Create and add FormControl
349
+ * end
350
+ * alt registry is true
351
+ * NFS->>NFS: addRegistry(id, form)
352
+ * end
353
+ * NFS-->>C: Return FormGroup
354
+ *
355
+ * @static
356
+ * @memberOf NgxFormService
191
357
  */
192
358
  static createFormFromComponents(id: string, components: IComponentConfig[], registry?: boolean): FormGroup;
193
359
  /**
194
360
  * @description Adds a control to a form based on component properties.
195
361
  * @summary Creates and adds a form control to a form (existing or new) based on the provided component properties.
196
- * @param {string} id - The unique identifier of the form.
197
- * @param {FieldProperties} componentProperties - The properties of the component to create the control from.
198
- * @return {AbstractControl} The form or created control.
362
+ * Handles multi-page forms by managing FormArray structures and proper indexing. This method supports
363
+ * complex form scenarios including nested controls and page-based form organization.
364
+ *
365
+ * @param {string} id - The unique identifier of the form
366
+ * @param {FieldProperties} componentProperties - The properties of the component to create the control from
367
+ * @param {FieldProperties} [parentProps] - Optional parent properties for context and configuration
368
+ * @return {AbstractControl} The form or created control
369
+ *
370
+ * @mermaid
371
+ * sequenceDiagram
372
+ * participant C as Component
373
+ * participant NFS as NgxFormService
374
+ * participant F as Form
375
+ *
376
+ * C->>NFS: addControlFromProps(id, componentProps, parentProps?)
377
+ * NFS->>NFS: createForm(id, parentProps, true)
378
+ * alt Multi-page form (parentProps.pages > 1)
379
+ * NFS->>NFS: Calculate page index
380
+ * NFS->>F: Get or create FormGroup at index
381
+ * NFS->>NFS: Set form to page FormGroup
382
+ * end
383
+ * alt componentProperties has path
384
+ * NFS->>NFS: addFormControl(form, componentProperties, parentProps)
385
+ * end
386
+ * NFS-->>C: Return form/control
387
+ *
388
+ * @static
389
+ * @memberOf NgxFormService
199
390
  */
200
391
  static addControlFromProps(id: string, componentProperties: FieldProperties, parentProps?: FieldProperties): AbstractControl;
201
392
  /**
202
393
  * @description Retrieves form data from a FormGroup.
203
394
  * @summary Extracts and processes the data from a FormGroup, handling different input types and nested form groups.
204
- * @param {FormGroup} formGroup - The FormGroup to extract data from.
205
- * @return {Record<string, unknown>} An object containing the form data.
395
+ * Performs type conversion for various HTML5 input types, validates nested controls, and manages
396
+ * multiple control scenarios. Automatically enables all group controls after data extraction.
397
+ *
398
+ * @param {FormGroup} formGroup - The FormGroup to extract data from
399
+ * @return {Record<string, unknown>} An object containing the processed form data with proper type conversions
400
+ *
401
+ * @mermaid
402
+ * sequenceDiagram
403
+ * participant C as Component
404
+ * participant NFS as NgxFormService
405
+ * participant FG as FormGroup
406
+ * participant FC as FormControl
407
+ *
408
+ * C->>NFS: getFormData(formGroup)
409
+ * loop For each control in formGroup
410
+ * alt Control is not FormControl
411
+ * NFS->>NFS: Recursive getFormData(control)
412
+ * alt parentProps.multiple and !isValid
413
+ * NFS->>NFS: reset(control)
414
+ * end
415
+ * else Control is FormControl
416
+ * NFS->>FC: Get control value
417
+ * NFS->>NFS: Apply type conversion based on props.type
418
+ * alt HTML5CheckTypes
419
+ * NFS->>NFS: Keep boolean value
420
+ * else NUMBER type
421
+ * NFS->>NFS: parseToNumber(value)
422
+ * else DATE/DATETIME types
423
+ * NFS->>NFS: new Date(value)
424
+ * else Other types
425
+ * NFS->>NFS: escapeHtml(value)
426
+ * end
427
+ * end
428
+ * end
429
+ * NFS->>NFS: enableAllGroupControls(formGroup)
430
+ * NFS-->>C: Return processed data object
431
+ *
432
+ * @static
433
+ * @memberOf NgxFormService
206
434
  */
207
435
  static getFormData(formGroup: FormGroup): Record<string, unknown>;
208
436
  /**
209
437
  * @description Validates fields in a form control or form group.
210
438
  * @summary Recursively validates all fields in a form control or form group, marking them as touched and dirty.
211
- * @param {AbstractControl} control - The control or form group to validate.
212
- * @param {string} [path] - The path to the control within the form.
213
- * @return {boolean} True if all fields are valid, false otherwise.
214
- * @throws {Error} If no control is found at the specified path or if the control type is unknown.
439
+ * Performs comprehensive validation including uniqueness checks for primary keys in FormArray scenarios.
440
+ * This method ensures all validation rules are applied and form state is properly updated.
441
+ *
442
+ * @param {AbstractControl} control - The control or form group to validate
443
+ * @param {string} [pk] - Optional primary key field name for uniqueness validation
444
+ * @param {string} [path] - The path to the control within the form for error reporting
445
+ * @return {boolean} True if all fields are valid, false otherwise
446
+ * @throws {Error} If no control is found at the specified path or if the control type is unknown
447
+ *
448
+ * @mermaid
449
+ * sequenceDiagram
450
+ * participant C as Component
451
+ * participant NFS as NgxFormService
452
+ * participant FC as FormControl
453
+ * participant FG as FormGroup
454
+ * participant FA as FormArray
455
+ *
456
+ * C->>NFS: validateFields(control, pk?, path?)
457
+ * alt Control is FormControl
458
+ * NFS->>FC: markAsTouched()
459
+ * NFS->>FC: markAsDirty()
460
+ * NFS->>FC: updateValueAndValidity()
461
+ * alt Is in FormArray group
462
+ * NFS->>NFS: Check uniqueness in group
463
+ * alt Not unique
464
+ * NFS->>FC: setErrors({notUnique: true})
465
+ * end
466
+ * end
467
+ * NFS-->>C: Return control.valid
468
+ * else Control is FormGroup
469
+ * loop For each child control
470
+ * NFS->>NFS: Recursive validateFields(child)
471
+ * end
472
+ * NFS-->>C: Return allValid
473
+ * else Control is FormArray
474
+ * loop For each array control
475
+ * NFS->>NFS: Recursive validateFields(child)
476
+ * end
477
+ * NFS-->>C: Return allValid
478
+ * else Unknown control type
479
+ * NFS-->>C: Throw Error
480
+ * end
481
+ *
482
+ * @static
483
+ * @memberOf NgxFormService
215
484
  */
216
485
  static validateFields(control: AbstractControl, pk?: string, path?: string): boolean;
217
486
  /**
@@ -223,33 +492,97 @@ export declare class NgxFormService {
223
492
  private static validatorsFromProps;
224
493
  /**
225
494
  * @description Creates a FormControl from component properties.
226
- * @summary Generates a FormControl with validators based on the provided component properties.
227
- * @param {FieldProperties} props - The component properties.
228
- * @param {FieldUpdateMode} [updateMode='change'] - The update mode for the control.
229
- * @return {FormControl} The created FormControl.
495
+ * @summary Generates a FormControl with validators and initial configuration based on the provided
496
+ * component properties. Handles different input types, sets initial values, and configures
497
+ * validation rules and update modes.
498
+ *
499
+ * @param {FieldProperties} props - The component properties defining the control configuration
500
+ * @param {FieldUpdateMode} [updateMode='change'] - The update mode for the control ('change', 'blur', 'submit')
501
+ * @return {FormControl} The created FormControl with proper configuration and validators
502
+ *
503
+ * @mermaid
504
+ * sequenceDiagram
505
+ * participant C as Component
506
+ * participant NFS as NgxFormService
507
+ * participant VF as ValidatorFactory
508
+ * participant AF as Angular Forms
509
+ *
510
+ * C->>NFS: fromProps(props, updateMode?)
511
+ * NFS->>NFS: validatorsFromProps(props)
512
+ * NFS->>VF: Create validators from props
513
+ * VF-->>NFS: Return validator array
514
+ * NFS->>NFS: Compose validators
515
+ * alt props.value exists and not checkbox
516
+ * alt props.type is DATE
517
+ * NFS->>NFS: Validate date format
518
+ * end
519
+ * NFS->>NFS: Set initial value
520
+ * end
521
+ * NFS->>AF: new FormControl(config)
522
+ * AF-->>NFS: Return FormControl
523
+ * NFS-->>C: Return configured FormControl
524
+ *
525
+ * @static
526
+ * @memberOf NgxFormService
230
527
  */
231
528
  static fromProps(props: FieldProperties, updateMode?: FieldUpdateMode): FormControl;
232
529
  /**
233
- * @description Retrieves properties from a FormControl.
234
- * @summary Gets the FieldProperties associated with a FormControl from the internal WeakMap.
235
- * @param {FormControl} control - The FormControl to get properties for.
236
- * @return {FieldProperties} The properties associated with the control.
530
+ * @description Retrieves properties from a FormControl, FormArray, or FormGroup.
531
+ * @summary Gets the FieldProperties associated with a form control from the internal WeakMap.
532
+ * This method provides access to the original component properties that were used to create
533
+ * the control, enabling validation, rendering, and behavior configuration.
534
+ *
535
+ * @param {FormControl | FormArray | FormGroup} control - The form control to get properties for
536
+ * @return {FieldProperties} The properties associated with the control, or empty object if not found
537
+ *
538
+ * @static
539
+ * @memberOf NgxFormService
237
540
  */
238
541
  static getPropsFromControl(control: FormControl | FormArray | FormGroup): FieldProperties;
239
542
  /**
240
- * @description Finds a parent element with a specific tag.
241
- * @summary Traverses up the DOM tree to find the nearest parent element with the specified tag.
242
- * @param {HTMLElement} el - The starting element.
243
- * @param {string} tag - The tag name to search for.
244
- * @return {HTMLElement} The found parent element.
245
- * @throws {Error} If no parent with the specified tag is found.
543
+ * @description Finds a parent element with a specific tag in the DOM tree.
544
+ * @summary Traverses up the DOM tree to find the nearest parent element with the specified tag name.
545
+ * This is useful for finding container elements or specific parent components in the DOM hierarchy.
546
+ * The search is case-insensitive for tag name matching.
547
+ *
548
+ * @param {HTMLElement} el - The starting element to traverse from
549
+ * @param {string} tag - The tag name to search for (case-insensitive)
550
+ * @return {HTMLElement} The found parent element with the specified tag
551
+ * @throws {Error} If no parent with the specified tag is found in the DOM tree
552
+ *
553
+ * @mermaid
554
+ * sequenceDiagram
555
+ * participant C as Component
556
+ * participant NFS as NgxFormService
557
+ * participant DOM as DOM Tree
558
+ *
559
+ * C->>NFS: getParentEl(element, tagName)
560
+ * loop Traverse up DOM tree
561
+ * NFS->>DOM: Get parentElement
562
+ * DOM-->>NFS: Return parent or null
563
+ * alt Parent exists and tag matches
564
+ * NFS-->>C: Return parent element
565
+ * else Parent is null
566
+ * NFS-->>C: Throw Error
567
+ * end
568
+ * end
569
+ *
570
+ * @static
571
+ * @memberOf NgxFormService
246
572
  */
247
573
  static getParentEl(el: HTMLElement, tag: string): HTMLElement;
248
574
  /**
249
- * @description Registers a control with its properties.
250
- * @summary Associates a control with its properties in the internal WeakMap.
251
- * @param {AbstractControl} control - The control to register.
252
- * @param {FieldProperties} props - The properties to associate with the control.
575
+ * @description Registers a control with its properties in the internal WeakMap.
576
+ * @summary Associates a form control with its component properties for later retrieval.
577
+ * This enables the service to maintain metadata about controls without creating memory leaks,
578
+ * as WeakMap automatically cleans up references when controls are garbage collected.
579
+ *
580
+ * @param {AbstractControl} control - The control to register (FormControl, FormGroup, or FormArray)
581
+ * @param {FieldProperties} props - The properties to associate with the control
582
+ * @return {void}
583
+ *
584
+ * @static
585
+ * @memberOf NgxFormService
253
586
  */
254
587
  static register(control: AbstractControl, props: FieldProperties): void;
255
588
  /**
@@ -88,6 +88,8 @@ export declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefi
88
88
  * @type {Type<unknown> | undefined}
89
89
  */
90
90
  private static _instance;
91
+ private static _projectable;
92
+ private static _parentProps;
91
93
  /**
92
94
  * @description Constructs a new NgxRenderingEngine instance
93
95
  * @summary Initializes a new instance of the Angular rendering engine by calling the parent
@@ -169,7 +171,7 @@ export declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefi
169
171
  *
170
172
  * @return {Promise<void>} A promise that resolves when the instance is destroyed
171
173
  */
172
- static destroy(): Promise<void>;
174
+ static destroy(formId?: string): Promise<void>;
173
175
  /**
174
176
  * @description Renders a model into an Angular component output
175
177
  * @summary This method takes a model and converts it to an Angular component output.
@@ -200,7 +202,7 @@ export declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefi
200
202
  * FromField-->>Render: AngularDynamicOutput
201
203
  * Render-->>Client: return AngularDynamicOutput
202
204
  */
203
- render<M extends Model>(model: M, globalProps: Record<string, unknown>, vcr: ViewContainerRef, injector: Injector, tpl: TemplateRef<unknown>): AngularDynamicOutput;
205
+ render<M extends Model>(model: M, globalProps: Record<string, unknown>, vcr: ViewContainerRef, injector: Injector, tpl: TemplateRef<unknown>, projectable?: boolean): AngularDynamicOutput;
204
206
  /**
205
207
  * @description Initializes the rendering engine
206
208
  * @summary This method initializes the rendering engine. It checks if the engine is already initialized
@@ -255,7 +255,7 @@ export interface ListItemCustomEvent extends BaseCustomEvent {
255
255
  */
256
256
  export interface BaseCustomEvent {
257
257
  name: string;
258
- component: string;
258
+ component?: string;
259
259
  data?: unknown;
260
260
  target?: HTMLElement;
261
261
  }
package/engine/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IonCheckbox, IonInput, IonSelect, IonTextarea } from '@ionic/angular';
2
2
  import { TextFieldTypes } from '@ionic/core';
3
- import { FormGroup } from '@angular/forms';
3
+ import { FormArray, FormGroup } from '@angular/forms';
4
4
  import { BaseCustomEvent, FormServiceControl, InputOption } from './interfaces';
5
5
  import { Adapter, Repository } from '@decaf-ts/core';
6
6
  import { Context, RepositoryFlags } from '@decaf-ts/db-decorators';
@@ -189,11 +189,12 @@ export type RendererCustomEvent = BaseCustomEvent & KeyValue;
189
189
  export type CrudFormEvent = BaseCustomEvent & {
190
190
  handlers?: Record<string, any>;
191
191
  };
192
+ export type FormParent = FormGroup | FormArray;
192
193
  /**
193
194
  * @description Form parent group tuple
194
195
  * @summary Represents a tuple containing a FormGroup and its associated string identifier.
195
196
  * This is used for managing hierarchical form structures and parent-child relationships.
196
- * @typedef {[FormGroup, string]} FormParentGroup
197
+ * @typedef {[FormParent, string]} FormParentGroup
197
198
  * @memberOf module:engine
198
199
  */
199
- export type FormParentGroup = [FormGroup, string];
200
+ export type FormParentGroup = [FormParent, string];