@decaf-ts/for-angular 0.0.16 → 0.0.18
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/assets/i18n/en.json +9 -69
- package/assets/i18n/pt.json +80 -0
- package/assets/icons/icon-128.webp +0 -0
- package/assets/icons/icon-192.webp +0 -0
- package/assets/icons/icon-256.webp +0 -0
- package/assets/icons/icon-48.webp +0 -0
- package/assets/icons/icon-512.webp +0 -0
- package/assets/icons/icon-72.webp +0 -0
- package/assets/icons/icon-96.webp +0 -0
- package/assets/images/apple-touch-icon.png +0 -0
- package/assets/images/favicon.png +0 -0
- package/assets/images/favicon.svg +29 -0
- package/components/component-renderer/component-renderer.component.d.ts +5 -4
- package/components/crud-field/crud-field.component.d.ts +186 -22
- package/components/crud-form/crud-form.component.d.ts +194 -8
- package/components/empty-state/empty-state.component.d.ts +9 -10
- package/components/fieldset/fieldset.component.d.ts +383 -36
- package/components/filter/filter.component.d.ts +11 -2
- package/components/list/list.component.d.ts +1 -1
- package/components/list-item/list-item.component.d.ts +2 -2
- package/components/model-renderer/model-renderer.component.d.ts +1 -5
- package/directives/collapsable.directive.d.ts +1 -0
- package/engine/NgxBaseComponent.d.ts +43 -43
- package/engine/NgxCrudFormField.d.ts +7 -3
- package/engine/NgxFormService.d.ts +113 -12
- package/engine/NgxRenderingEngine.d.ts +178 -25
- package/engine/constants.d.ts +11 -6
- package/engine/decorators.d.ts +2 -2
- package/engine/index.d.ts +4 -2
- package/engine/interfaces.d.ts +271 -0
- package/engine/types.d.ts +11 -206
- package/esm2022/components/component-renderer/component-renderer.component.mjs +13 -11
- package/esm2022/components/crud-field/crud-field.component.mjs +213 -8
- package/esm2022/components/crud-form/crud-form.component.mjs +133 -13
- package/esm2022/components/empty-state/empty-state.component.mjs +13 -12
- package/esm2022/components/fieldset/fieldset.component.mjs +485 -43
- package/esm2022/components/filter/filter.component.mjs +16 -6
- package/esm2022/components/layout/layout.component.mjs +3 -3
- package/esm2022/components/list/list.component.mjs +4 -5
- package/esm2022/components/list-item/list-item.component.mjs +10 -10
- package/esm2022/components/model-renderer/model-renderer.component.mjs +9 -8
- package/esm2022/components/pagination/pagination.component.mjs +7 -7
- package/esm2022/components/searchbar/searchbar.component.mjs +3 -3
- package/esm2022/directives/collapsable.directive.mjs +3 -2
- package/esm2022/engine/NgxBaseComponent.mjs +64 -63
- package/esm2022/engine/NgxCrudFormField.mjs +14 -4
- package/esm2022/engine/NgxFormService.mjs +239 -27
- package/esm2022/engine/NgxRenderingEngine.mjs +218 -46
- package/esm2022/engine/ValidatorFactory.mjs +6 -4
- package/esm2022/engine/constants.mjs +14 -9
- package/esm2022/engine/decorators.mjs +6 -6
- package/esm2022/engine/index.mjs +5 -3
- package/esm2022/engine/interfaces.mjs +4 -0
- package/esm2022/engine/types.mjs +1 -3
- package/esm2022/helpers/utils.mjs +53 -32
- package/esm2022/i18n/Loader.mjs +82 -0
- package/fesm2022/decaf-ts-for-angular.mjs +3030 -2097
- package/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
- package/helpers/utils.d.ts +42 -16
- package/i18n/Loader.d.ts +48 -0
- package/package.json +11 -1
- package/engine/NgxRenderingEngine2.d.ts +0 -250
- package/esm2022/engine/NgxRenderingEngine2.mjs +0 -332
- package/esm2022/interfaces.mjs +0 -2
- package/interfaces.d.ts +0 -28
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
|
+
import { FormArray, FormControl, FormGroup } from '@angular/forms';
|
|
3
3
|
import { AutocompleteTypes, SelectInterface } from '@ionic/core';
|
|
4
4
|
import { CrudOperations } from '@decaf-ts/db-decorators';
|
|
5
5
|
import { NgxCrudFormField } from '../../engine/NgxCrudFormField';
|
|
6
|
-
import { FieldUpdateMode, PossibleInputTypes,
|
|
6
|
+
import { CrudFieldOption, FieldUpdateMode, PossibleInputTypes, StringOrBoolean } from '../../engine/types';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
/**
|
|
9
9
|
* @description A dynamic form field component for CRUD operations.
|
|
@@ -86,6 +86,16 @@ export declare class CrudFieldComponent extends NgxCrudFormField implements OnIn
|
|
|
86
86
|
* @type {string}
|
|
87
87
|
* @memberOf CrudFieldComponent
|
|
88
88
|
*/
|
|
89
|
+
/**
|
|
90
|
+
* @description The parent field path for nested field structures.
|
|
91
|
+
* @summary Specifies the full dot-delimited path of the parent field when this field
|
|
92
|
+
* is part of a nested structure. This is used for hierarchical form organization
|
|
93
|
+
* and proper form control resolution in complex form structures.
|
|
94
|
+
*
|
|
95
|
+
* @type {string}
|
|
96
|
+
* @default ''
|
|
97
|
+
* @memberOf CrudFieldComponent
|
|
98
|
+
*/
|
|
89
99
|
childOf: string;
|
|
90
100
|
/**
|
|
91
101
|
* @description The input type of the field.
|
|
@@ -225,38 +235,60 @@ export declare class CrudFieldComponent extends NgxCrudFormField implements OnIn
|
|
|
225
235
|
*/
|
|
226
236
|
step?: number;
|
|
227
237
|
/**
|
|
228
|
-
* @description Field name for
|
|
229
|
-
* @
|
|
238
|
+
* @description Field name for equality validation comparison.
|
|
239
|
+
* @summary Specifies another field name that this field's value must be equal to for validation.
|
|
240
|
+
* This is commonly used for password confirmation fields or other scenarios where
|
|
241
|
+
* two fields must contain the same value.
|
|
242
|
+
*
|
|
243
|
+
* @type {string | undefined}
|
|
230
244
|
* @memberOf CrudFieldComponent
|
|
231
245
|
*/
|
|
232
246
|
equals?: string;
|
|
233
247
|
/**
|
|
234
|
-
* @description Field name for
|
|
235
|
-
* @
|
|
248
|
+
* @description Field name for inequality validation comparison.
|
|
249
|
+
* @summary Specifies another field name that this field's value must be different from for validation.
|
|
250
|
+
* This is used to ensure that two fields do not contain the same value, which might be
|
|
251
|
+
* required for certain business rules or security constraints.
|
|
252
|
+
*
|
|
253
|
+
* @type {string | undefined}
|
|
236
254
|
* @memberOf CrudFieldComponent
|
|
237
255
|
*/
|
|
238
256
|
different?: string;
|
|
239
257
|
/**
|
|
240
|
-
* @description Field name for less
|
|
241
|
-
* @
|
|
258
|
+
* @description Field name for less-than validation comparison.
|
|
259
|
+
* @summary Specifies another field name that this field's value must be less than for validation.
|
|
260
|
+
* This is commonly used for date ranges, numeric ranges, or other scenarios where
|
|
261
|
+
* one field must have a smaller value than another.
|
|
262
|
+
*
|
|
263
|
+
* @type {string | undefined}
|
|
242
264
|
* @memberOf CrudFieldComponent
|
|
243
265
|
*/
|
|
244
266
|
lessThan?: string;
|
|
245
267
|
/**
|
|
246
|
-
* @description Field name for less
|
|
247
|
-
* @
|
|
268
|
+
* @description Field name for less-than-or-equal validation comparison.
|
|
269
|
+
* @summary Specifies another field name that this field's value must be less than or equal to
|
|
270
|
+
* for validation. This provides inclusive upper bound validation for numeric or date comparisons.
|
|
271
|
+
*
|
|
272
|
+
* @type {string | undefined}
|
|
248
273
|
* @memberOf CrudFieldComponent
|
|
249
274
|
*/
|
|
250
275
|
lessThanOrEqual?: string;
|
|
251
276
|
/**
|
|
252
|
-
* @description Field name for greater
|
|
253
|
-
* @
|
|
277
|
+
* @description Field name for greater-than validation comparison.
|
|
278
|
+
* @summary Specifies another field name that this field's value must be greater than for validation.
|
|
279
|
+
* This is commonly used for date ranges, numeric ranges, or other scenarios where
|
|
280
|
+
* one field must have a larger value than another.
|
|
281
|
+
*
|
|
282
|
+
* @type {string | undefined}
|
|
254
283
|
* @memberOf CrudFieldComponent
|
|
255
284
|
*/
|
|
256
285
|
greaterThan?: string;
|
|
257
286
|
/**
|
|
258
|
-
* @description Field name for greater
|
|
259
|
-
* @
|
|
287
|
+
* @description Field name for greater-than-or-equal validation comparison.
|
|
288
|
+
* @summary Specifies another field name that this field's value must be greater than or equal to
|
|
289
|
+
* for validation. This provides inclusive lower bound validation for numeric or date comparisons.
|
|
290
|
+
*
|
|
291
|
+
* @type {string | undefined}
|
|
260
292
|
* @memberOf CrudFieldComponent
|
|
261
293
|
*/
|
|
262
294
|
greaterThanOrEqual?: string;
|
|
@@ -328,10 +360,10 @@ export declare class CrudFieldComponent extends NgxCrudFormField implements OnIn
|
|
|
328
360
|
* @summary Provides the list of options for select or radio inputs. Each option can have a value and a label.
|
|
329
361
|
* This is used to populate the dropdown or radio group with choices.
|
|
330
362
|
*
|
|
331
|
-
* @type {
|
|
363
|
+
* @type {CrudFieldOption[]}
|
|
332
364
|
* @memberOf CrudFieldComponent
|
|
333
365
|
*/
|
|
334
|
-
options:
|
|
366
|
+
options: CrudFieldOption[];
|
|
335
367
|
/**
|
|
336
368
|
* @description Mode of the field.
|
|
337
369
|
* @summary Specifies the visual mode of the field, such as 'ios' or 'md'.
|
|
@@ -418,7 +450,35 @@ export declare class CrudFieldComponent extends NgxCrudFormField implements OnIn
|
|
|
418
450
|
* @memberOf CrudFieldComponent
|
|
419
451
|
*/
|
|
420
452
|
formGroup: FormGroup | undefined;
|
|
453
|
+
/**
|
|
454
|
+
* @description Angular FormControl instance for this field.
|
|
455
|
+
* @summary The specific FormControl instance that manages this field's state, validation,
|
|
456
|
+
* and value. This provides direct access to Angular's reactive forms functionality
|
|
457
|
+
* for this individual field within the broader form structure.
|
|
458
|
+
*
|
|
459
|
+
* @type {FormControl}
|
|
460
|
+
* @memberOf CrudFieldComponent
|
|
461
|
+
*/
|
|
421
462
|
formControl: FormControl;
|
|
463
|
+
/**
|
|
464
|
+
* @description Indicates if this field supports multiple values.
|
|
465
|
+
* @summary When true, this field can handle multiple values, typically used in
|
|
466
|
+
* multi-select scenarios or when the field is part of a form array structure
|
|
467
|
+
* that allows multiple entries of the same field type.
|
|
468
|
+
*
|
|
469
|
+
* @type {boolean}
|
|
470
|
+
* @default false
|
|
471
|
+
* @memberOf CrudFieldComponent
|
|
472
|
+
*/
|
|
473
|
+
multiple: boolean;
|
|
474
|
+
/**
|
|
475
|
+
* @description Unique identifier for the current record.
|
|
476
|
+
* @summary A unique identifier for the current record being displayed or manipulated.
|
|
477
|
+
* This is typically used in conjunction with the primary key for operations on specific records.
|
|
478
|
+
*
|
|
479
|
+
* @type {string | number}
|
|
480
|
+
*/
|
|
481
|
+
uid: string;
|
|
422
482
|
/**
|
|
423
483
|
* @description Translatability of field labels.
|
|
424
484
|
* @summary Indicates whether the field labels should be translated based on the current language settings.
|
|
@@ -430,16 +490,120 @@ export declare class CrudFieldComponent extends NgxCrudFormField implements OnIn
|
|
|
430
490
|
*/
|
|
431
491
|
translatable: StringOrBoolean;
|
|
432
492
|
/**
|
|
433
|
-
* @description
|
|
434
|
-
* @summary
|
|
435
|
-
*
|
|
493
|
+
* @description Index of the currently active form group in a form array.
|
|
494
|
+
* @summary When working with multiple form groups (form arrays), this indicates
|
|
495
|
+
* which form group is currently active or being edited. This is used to manage
|
|
496
|
+
* focus and data binding in multi-entry scenarios.
|
|
436
497
|
*
|
|
437
|
-
* @type {
|
|
498
|
+
* @type {number}
|
|
499
|
+
* @default 0
|
|
500
|
+
* @memberOf CrudFieldComponent
|
|
501
|
+
*/
|
|
502
|
+
activeFormGroup: number;
|
|
503
|
+
/**
|
|
504
|
+
* @description FormArray containing multiple form groups for this field.
|
|
505
|
+
* @summary When this field is part of a multi-entry structure, this FormArray
|
|
506
|
+
* contains all the form groups. This enables management of multiple instances
|
|
507
|
+
* of the same field structure within a single form.
|
|
508
|
+
*
|
|
509
|
+
* @type {FormArray}
|
|
510
|
+
* @memberOf CrudFieldComponent
|
|
511
|
+
*/
|
|
512
|
+
formGroupArray: FormArray;
|
|
513
|
+
/**
|
|
514
|
+
* @description Primary key field name for uniqueness validation.
|
|
515
|
+
* @summary Specifies the field name that serves as the primary key for uniqueness
|
|
516
|
+
* validation within form arrays. This is used to prevent duplicate entries
|
|
517
|
+
* and ensure data integrity in multi-entry forms.
|
|
518
|
+
*
|
|
519
|
+
* @type {string}
|
|
520
|
+
* @memberOf CrudFieldComponent
|
|
521
|
+
*/
|
|
522
|
+
pk: string;
|
|
523
|
+
/**
|
|
524
|
+
* @description Gets the currently active form group based on context.
|
|
525
|
+
* @summary Returns the appropriate FormGroup based on whether this field supports
|
|
526
|
+
* multiple values. For single-value fields, returns the main form group.
|
|
527
|
+
* For multi-value fields, returns the form group at the active index from the parent FormArray.
|
|
528
|
+
*
|
|
529
|
+
* @returns {FormGroup} The currently active FormGroup for this field
|
|
530
|
+
* @memberOf CrudFieldComponent
|
|
531
|
+
*/
|
|
532
|
+
get getActiveFormGroup(): FormGroup;
|
|
533
|
+
/**
|
|
534
|
+
* Returns a list of options for select or radio inputs, with their `text` property
|
|
535
|
+
* localized if it does not already include the word 'options'. The localization key
|
|
536
|
+
* is generated from the component's label, replacing 'label' with 'options'.
|
|
537
|
+
*
|
|
538
|
+
* @returns {CrudFieldOption[]} The array of parsed and localized options.
|
|
539
|
+
* @memberOf CrudFieldComponent
|
|
540
|
+
*/
|
|
541
|
+
get parsedOptions(): CrudFieldOption[];
|
|
542
|
+
/**
|
|
543
|
+
* @description Component initialization lifecycle method.
|
|
544
|
+
* @summary Initializes the field component based on the operation type and field configuration.
|
|
545
|
+
* For READ and DELETE operations, removes the form group to make fields read-only.
|
|
546
|
+
* For other operations, sets up icons, configures multi-value support if needed,
|
|
547
|
+
* and sets default values for radio buttons if no value is provided.
|
|
548
|
+
*
|
|
549
|
+
* @returns {void}
|
|
550
|
+
* @memberOf CrudFieldComponent
|
|
438
551
|
*/
|
|
439
|
-
uid: string | number | undefined;
|
|
440
552
|
ngOnInit(): void;
|
|
553
|
+
/**
|
|
554
|
+
* @description Component after view initialization lifecycle method.
|
|
555
|
+
* @summary Calls the parent afterViewInit method for READ and DELETE operations.
|
|
556
|
+
* This ensures proper initialization of read-only fields that don't require
|
|
557
|
+
* form functionality but still need view setup.
|
|
558
|
+
*
|
|
559
|
+
* @returns {void}
|
|
560
|
+
* @memberOf CrudFieldComponent
|
|
561
|
+
*/
|
|
441
562
|
ngAfterViewInit(): void;
|
|
563
|
+
/**
|
|
564
|
+
* @description Component cleanup lifecycle method.
|
|
565
|
+
* @summary Performs cleanup operations for READ and DELETE operations by calling
|
|
566
|
+
* the parent onDestroy method. This ensures proper resource cleanup for
|
|
567
|
+
* read-only field components.
|
|
568
|
+
*
|
|
569
|
+
* @returns {void}
|
|
570
|
+
* @memberOf CrudFieldComponent
|
|
571
|
+
*/
|
|
442
572
|
ngOnDestroy(): void;
|
|
573
|
+
/**
|
|
574
|
+
* @description Handles fieldset group creation events from parent fieldsets.
|
|
575
|
+
* @summary Processes events triggered when a new group needs to be added to a fieldset.
|
|
576
|
+
* Validates the current form group, checks for uniqueness if applicable, and either
|
|
577
|
+
* creates a new group or provides validation feedback. Updates the active form group
|
|
578
|
+
* and resets the field for new input after successful creation.
|
|
579
|
+
*
|
|
580
|
+
* @param {CustomEvent} event - The fieldset create group event containing group details
|
|
581
|
+
* @returns {void}
|
|
582
|
+
* @memberOf CrudFieldComponent
|
|
583
|
+
*/
|
|
584
|
+
handleFieldsetCreateGroupEvent(event: CustomEvent): void;
|
|
585
|
+
/**
|
|
586
|
+
* @description Handles fieldset group update events from parent fieldsets.
|
|
587
|
+
* @summary Processes events triggered when an existing group needs to be updated.
|
|
588
|
+
* Updates the active form group index and refreshes the form group and form control
|
|
589
|
+
* references to point to the group being edited.
|
|
590
|
+
*
|
|
591
|
+
* @param {CustomEvent} event - The fieldset update group event containing update details
|
|
592
|
+
* @returns {void}
|
|
593
|
+
* @memberOf CrudFieldComponent
|
|
594
|
+
*/
|
|
595
|
+
handleFieldsetUpdateGroupEvent(event: CustomEvent): void;
|
|
596
|
+
/**
|
|
597
|
+
* @description Handles fieldset group removal events from parent fieldsets.
|
|
598
|
+
* @summary Processes events triggered when a group needs to be removed from a fieldset.
|
|
599
|
+
* Removes the specified group from the form array, updates the active form group index,
|
|
600
|
+
* and refreshes the form references. Dispatches a confirmation event back to the component.
|
|
601
|
+
*
|
|
602
|
+
* @param {CustomEvent} event - The fieldset remove group event containing removal details
|
|
603
|
+
* @returns {void}
|
|
604
|
+
* @memberOf CrudFieldComponent
|
|
605
|
+
*/
|
|
606
|
+
handleFieldsetRemoveGroupEvent(event: CustomEvent): void;
|
|
443
607
|
static ɵfac: i0.ɵɵFactoryDeclaration<CrudFieldComponent, never>;
|
|
444
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CrudFieldComponent, "ngx-decaf-crud-field", never, { "operation": { "alias": "operation"; "required": true; }; "name": { "alias": "name"; "required": true; }; "path": { "alias": "path"; "required": true; }; "childOf": { "alias": "childOf"; "required": false; }; "type": { "alias": "type"; "required": true; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "label": { "alias": "label"; "required": true; }; "placeholder": { "alias": "placeholder"; "required": false; }; "format": { "alias": "format"; "required": false; }; "hidden": { "alias": "hidden"; "required": false; }; "max": { "alias": "max"; "required": false; }; "maxlength": { "alias": "maxlength"; "required": false; }; "min": { "alias": "min"; "required": false; }; "minlength": { "alias": "minlength"; "required": false; }; "pattern": { "alias": "pattern"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "required": { "alias": "required"; "required": false; }; "step": { "alias": "step"; "required": false; }; "equals": { "alias": "equals"; "required": false; }; "different": { "alias": "different"; "required": false; }; "lessThan": { "alias": "lessThan"; "required": false; }; "lessThanOrEqual": { "alias": "lessThanOrEqual"; "required": false; }; "greaterThan": { "alias": "greaterThan"; "required": false; }; "greaterThanOrEqual": { "alias": "greaterThanOrEqual"; "required": false; }; "cols": { "alias": "cols"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "alignment": { "alias": "alignment"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "justify": { "alias": "justify"; "required": false; }; "cancelText": { "alias": "cancelText"; "required": false; }; "interface": { "alias": "interface"; "required": false; }; "options": { "alias": "options"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "spellcheck": { "alias": "spellcheck"; "required": false; }; "inputmode": { "alias": "inputmode"; "required": false; }; "autocomplete": { "alias": "autocomplete"; "required": false; }; "fill": { "alias": "fill"; "required": false; }; "labelPlacement": { "alias": "labelPlacement"; "required": false; }; "updateOn": { "alias": "updateOn"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "formControl": { "alias": "formControl"; "required": false; }; "
|
|
608
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CrudFieldComponent, "ngx-decaf-crud-field", never, { "operation": { "alias": "operation"; "required": true; }; "name": { "alias": "name"; "required": true; }; "path": { "alias": "path"; "required": true; }; "childOf": { "alias": "childOf"; "required": false; }; "type": { "alias": "type"; "required": true; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "label": { "alias": "label"; "required": true; }; "placeholder": { "alias": "placeholder"; "required": false; }; "format": { "alias": "format"; "required": false; }; "hidden": { "alias": "hidden"; "required": false; }; "max": { "alias": "max"; "required": false; }; "maxlength": { "alias": "maxlength"; "required": false; }; "min": { "alias": "min"; "required": false; }; "minlength": { "alias": "minlength"; "required": false; }; "pattern": { "alias": "pattern"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "required": { "alias": "required"; "required": false; }; "step": { "alias": "step"; "required": false; }; "equals": { "alias": "equals"; "required": false; }; "different": { "alias": "different"; "required": false; }; "lessThan": { "alias": "lessThan"; "required": false; }; "lessThanOrEqual": { "alias": "lessThanOrEqual"; "required": false; }; "greaterThan": { "alias": "greaterThan"; "required": false; }; "greaterThanOrEqual": { "alias": "greaterThanOrEqual"; "required": false; }; "cols": { "alias": "cols"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "alignment": { "alias": "alignment"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "justify": { "alias": "justify"; "required": false; }; "cancelText": { "alias": "cancelText"; "required": false; }; "interface": { "alias": "interface"; "required": false; }; "options": { "alias": "options"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "spellcheck": { "alias": "spellcheck"; "required": false; }; "inputmode": { "alias": "inputmode"; "required": false; }; "autocomplete": { "alias": "autocomplete"; "required": false; }; "fill": { "alias": "fill"; "required": false; }; "labelPlacement": { "alias": "labelPlacement"; "required": false; }; "updateOn": { "alias": "updateOn"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "formControl": { "alias": "formControl"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "uid": { "alias": "uid"; "required": false; }; "translatable": { "alias": "translatable"; "required": false; }; "activeFormGroup": { "alias": "activeFormGroup"; "required": false; }; "pk": { "alias": "pk"; "required": false; }; }, {}, never, never, true, never>;
|
|
445
609
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import {
|
|
4
|
-
import { CrudFormEvent, FieldUpdateMode, HTMLFormTarget, RenderedModel } from '../../engine';
|
|
3
|
+
import { IFormElement } from '../../engine/interfaces';
|
|
4
|
+
import { CrudFormEvent, FieldUpdateMode, HandlerLike, HTMLFormTarget, RenderedModel } from '../../engine';
|
|
5
5
|
import { CrudFormOptions } from './types';
|
|
6
6
|
import { CrudOperations, OperationKeys } from '@decaf-ts/db-decorators';
|
|
7
7
|
import { Model } from '@decaf-ts/decorator-validation';
|
|
@@ -26,23 +26,120 @@ import * as i0 from "@angular/core";
|
|
|
26
26
|
* @param {string} target - The target
|
|
27
27
|
* @param {string} method - The method
|
|
28
28
|
*/
|
|
29
|
-
export declare class CrudFormComponent implements OnInit,
|
|
29
|
+
export declare class CrudFormComponent implements OnInit, IFormElement, OnDestroy, RenderedModel {
|
|
30
30
|
/**
|
|
31
31
|
* @description Repository model for data operations.
|
|
32
32
|
* @summary The data model repository that this component will use for CRUD operations.
|
|
33
33
|
* This provides a connection to the data layer for retrieving and manipulating data.
|
|
34
34
|
*
|
|
35
35
|
* @type {Model| undefined}
|
|
36
|
+
* @memberOf CrudFormComponent
|
|
36
37
|
*/
|
|
37
38
|
model: Model | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* @description The primary data model used for CRUD operations.
|
|
41
|
+
* @summary This input provides the main Model instance that the form interacts with for
|
|
42
|
+
* creating, reading, updating, or deleting records. It serves as the source of schema
|
|
43
|
+
* and validation rules for the form fields, and is required for most operations except
|
|
44
|
+
* for certain read or delete scenarios.
|
|
45
|
+
*
|
|
46
|
+
* @type {Model | undefined}
|
|
47
|
+
* @memberOf CrudFormComponent
|
|
48
|
+
*/
|
|
49
|
+
modelId: Model | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* @description Field update trigger mode for form validation.
|
|
52
|
+
* @summary Determines when form field validation should be triggered. Options include
|
|
53
|
+
* 'change', 'blur', or 'submit'. This affects the user experience by controlling
|
|
54
|
+
* when validation feedback is shown to the user during form interaction.
|
|
55
|
+
*
|
|
56
|
+
* @type {FieldUpdateMode}
|
|
57
|
+
* @default 'change'
|
|
58
|
+
* @memberOf CrudFormComponent
|
|
59
|
+
*/
|
|
38
60
|
updateOn: FieldUpdateMode;
|
|
61
|
+
/**
|
|
62
|
+
* @description Reference to the reactive form DOM element.
|
|
63
|
+
* @summary ViewChild reference that provides direct access to the form's DOM element.
|
|
64
|
+
* This enables programmatic manipulation of the form element and access to native
|
|
65
|
+
* HTML form properties and methods when needed.
|
|
66
|
+
*
|
|
67
|
+
* @type {ElementRef}
|
|
68
|
+
* @memberOf CrudFormComponent
|
|
69
|
+
*/
|
|
39
70
|
component: ElementRef;
|
|
71
|
+
/**
|
|
72
|
+
* @description Form submission target specification.
|
|
73
|
+
* @summary Specifies where to display the response after form submission, similar
|
|
74
|
+
* to the HTML form target attribute. Options include '_self', '_blank', '_parent',
|
|
75
|
+
* '_top', or a named frame. Controls the browser behavior for form responses.
|
|
76
|
+
*
|
|
77
|
+
* @type {HTMLFormTarget}
|
|
78
|
+
* @default '_self'
|
|
79
|
+
* @memberOf CrudFormComponent
|
|
80
|
+
*/
|
|
40
81
|
target: HTMLFormTarget;
|
|
82
|
+
/**
|
|
83
|
+
* @description HTTP method or submission strategy for the form.
|
|
84
|
+
* @summary Defines how the form should be submitted. 'get' and 'post' correspond
|
|
85
|
+
* to standard HTTP methods for traditional form submission, while 'event' uses
|
|
86
|
+
* Angular event-driven submission for single-page application workflows.
|
|
87
|
+
*
|
|
88
|
+
* @type {'get' | 'post' | 'event'}
|
|
89
|
+
* @default 'event'
|
|
90
|
+
* @memberOf CrudFormComponent
|
|
91
|
+
*/
|
|
41
92
|
method: 'get' | 'post' | 'event';
|
|
93
|
+
/**
|
|
94
|
+
* @description Configuration options for the CRUD form behavior.
|
|
95
|
+
* @summary Contains various configuration settings that control form rendering,
|
|
96
|
+
* validation, and behavior. These options are merged with default settings
|
|
97
|
+
* during component initialization to customize the form's functionality.
|
|
98
|
+
*
|
|
99
|
+
* @type {CrudFormOptions}
|
|
100
|
+
* @memberOf CrudFormComponent
|
|
101
|
+
*/
|
|
42
102
|
options: CrudFormOptions;
|
|
103
|
+
/**
|
|
104
|
+
* @description Optional action identifier for form submission context.
|
|
105
|
+
* @summary Specifies a custom action name that will be included in the submit event.
|
|
106
|
+
* If not provided, defaults to the standard submit event constant. Used to
|
|
107
|
+
* distinguish between different types of form submissions within the same component.
|
|
108
|
+
*
|
|
109
|
+
* @type {string | undefined}
|
|
110
|
+
* @memberOf CrudFormComponent
|
|
111
|
+
*/
|
|
43
112
|
action?: string;
|
|
113
|
+
/**
|
|
114
|
+
* @description The current CRUD operation being performed.
|
|
115
|
+
* @summary Specifies the type of operation this form is handling (CREATE, READ, UPDATE, DELETE).
|
|
116
|
+
* This is a required input that determines form behavior, validation rules, and available actions.
|
|
117
|
+
* The operation affects form state, button visibility, and submission logic.
|
|
118
|
+
*
|
|
119
|
+
* @type {CrudOperations}
|
|
120
|
+
* @required
|
|
121
|
+
* @memberOf CrudFormComponent
|
|
122
|
+
*/
|
|
44
123
|
operation: CrudOperations;
|
|
45
|
-
|
|
124
|
+
/**
|
|
125
|
+
* @description Custom event handlers for form actions.
|
|
126
|
+
* @summary A record of event handler functions keyed by event names that can be
|
|
127
|
+
* triggered during form operations. These handlers provide extensibility for
|
|
128
|
+
* custom business logic and can be invoked for various form events and actions.
|
|
129
|
+
*
|
|
130
|
+
* @type {HandlerLike}
|
|
131
|
+
* @memberOf CrudFormComponent
|
|
132
|
+
*/
|
|
133
|
+
handlers: HandlerLike;
|
|
134
|
+
/**
|
|
135
|
+
* @description Angular reactive FormGroup for form state management.
|
|
136
|
+
* @summary The FormGroup instance that manages all form controls, validation,
|
|
137
|
+
* and form state. This is the main interface for accessing form values and
|
|
138
|
+
* controlling form behavior. May be undefined for read-only operations.
|
|
139
|
+
*
|
|
140
|
+
* @type {FormGroup | undefined}
|
|
141
|
+
* @memberOf CrudFormComponent
|
|
142
|
+
*/
|
|
46
143
|
formGroup: FormGroup | undefined;
|
|
47
144
|
/**
|
|
48
145
|
* @description Path to the parent FormGroup, if nested.
|
|
@@ -52,6 +149,15 @@ export declare class CrudFormComponent implements OnInit, FormElement, OnDestroy
|
|
|
52
149
|
* @memberOf CrudFormComponent
|
|
53
150
|
*/
|
|
54
151
|
childOf?: string;
|
|
152
|
+
/**
|
|
153
|
+
* @description Unique identifier for the form renderer.
|
|
154
|
+
* @summary A unique string identifier used to register and manage this form
|
|
155
|
+
* instance within the NgxFormService. This ID is also used as the HTML id
|
|
156
|
+
* attribute for the form element, enabling DOM queries and form management.
|
|
157
|
+
*
|
|
158
|
+
* @type {string}
|
|
159
|
+
* @memberOf CrudFormComponent
|
|
160
|
+
*/
|
|
55
161
|
rendererId: string;
|
|
56
162
|
/**
|
|
57
163
|
* @description Unique identifier for the current record.
|
|
@@ -59,8 +165,42 @@ export declare class CrudFormComponent implements OnInit, FormElement, OnDestroy
|
|
|
59
165
|
* This is typically used in conjunction with the primary key for operations on specific records.
|
|
60
166
|
*
|
|
61
167
|
* @type {string | number}
|
|
168
|
+
* @memberOf CrudFormComponent
|
|
169
|
+
*/
|
|
170
|
+
uid: string;
|
|
171
|
+
/**
|
|
172
|
+
* @description Unique identifier for the current record instance.
|
|
173
|
+
* @summary This property holds a unique string value that identifies the specific record being managed by the form.
|
|
174
|
+
* It is automatically generated if not provided, ensuring each form instance has a distinct identifier.
|
|
175
|
+
* The uid is used for tracking, referencing, and emitting events related to the current record, and may be used
|
|
176
|
+
* in conjunction with the primary key for CRUD operations.
|
|
177
|
+
*
|
|
178
|
+
* @type {string}
|
|
179
|
+
* @default Randomly generated 12-character string
|
|
180
|
+
* @memberOf CrudFormComponent
|
|
181
|
+
*/
|
|
182
|
+
allowClear: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* @description Reference to CRUD operation constants for template usage.
|
|
185
|
+
* @summary Exposes the OperationKeys enum to the component template, enabling
|
|
186
|
+
* conditional rendering and behavior based on operation types. This protected
|
|
187
|
+
* readonly property ensures that template logic can access operation constants
|
|
188
|
+
* while maintaining encapsulation and preventing accidental modification.
|
|
189
|
+
*
|
|
190
|
+
* @protected
|
|
191
|
+
* @readonly
|
|
192
|
+
* @memberOf CrudFormComponent
|
|
193
|
+
*/
|
|
194
|
+
protected readonly OperationKeys: typeof OperationKeys;
|
|
195
|
+
/**
|
|
196
|
+
* @description Event emitter for form submission events.
|
|
197
|
+
* @summary Emits CrudFormEvent objects when the form is submitted, providing
|
|
198
|
+
* form data, component information, and any associated handlers to parent
|
|
199
|
+
* components. This enables decoupled handling of form submission logic.
|
|
200
|
+
*
|
|
201
|
+
* @type {EventEmitter<CrudFormEvent>}
|
|
202
|
+
* @memberOf CrudFormComponent
|
|
62
203
|
*/
|
|
63
|
-
uid: string | number | undefined;
|
|
64
204
|
submitEvent: EventEmitter<CrudFormEvent>;
|
|
65
205
|
/**
|
|
66
206
|
* @description Logger instance for the component.
|
|
@@ -88,15 +228,61 @@ export declare class CrudFormComponent implements OnInit, FormElement, OnDestroy
|
|
|
88
228
|
* @memberOf CrudFormComponent
|
|
89
229
|
*/
|
|
90
230
|
private location;
|
|
231
|
+
/**
|
|
232
|
+
* @description Component initialization lifecycle method.
|
|
233
|
+
* @summary Initializes the component by setting up the logger, configuring form state
|
|
234
|
+
* based on the operation type, and merging configuration options. For READ and DELETE
|
|
235
|
+
* operations, the formGroup is set to undefined since these operations don't require
|
|
236
|
+
* form input. Configuration options are merged with default settings.
|
|
237
|
+
*
|
|
238
|
+
* @returns {Promise<void>}
|
|
239
|
+
* @memberOf CrudFormComponent
|
|
240
|
+
*/
|
|
91
241
|
ngOnInit(): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* @description Component cleanup lifecycle method.
|
|
244
|
+
* @summary Performs cleanup operations when the component is destroyed.
|
|
245
|
+
* Unregisters the FormGroup from the NgxFormService to prevent memory leaks
|
|
246
|
+
* and ensure proper resource cleanup.
|
|
247
|
+
*
|
|
248
|
+
* @returns {void}
|
|
249
|
+
* @memberOf CrudFormComponent
|
|
250
|
+
*/
|
|
92
251
|
ngOnDestroy(): void;
|
|
93
252
|
/**
|
|
94
|
-
* @
|
|
253
|
+
* @description Handles form submission with validation and event emission.
|
|
254
|
+
* @summary Processes form submission by first preventing default browser behavior,
|
|
255
|
+
* then validating all form fields using NgxFormService. If validation passes,
|
|
256
|
+
* extracts form data and emits a submitEvent with the data, component information,
|
|
257
|
+
* and any associated handlers. Returns false if validation fails.
|
|
258
|
+
*
|
|
259
|
+
* @param {SubmitEvent} event - The browser's native form submit event
|
|
260
|
+
* @returns {Promise<boolean | void>} Returns false if validation fails, void if successful
|
|
261
|
+
* @memberOf CrudFormComponent
|
|
95
262
|
*/
|
|
96
263
|
submit(event: SubmitEvent): Promise<boolean | void>;
|
|
264
|
+
/**
|
|
265
|
+
* @description Handles form reset or navigation back functionality.
|
|
266
|
+
* @summary Provides different reset behavior based on the current operation.
|
|
267
|
+
* For CREATE and UPDATE operations, resets the form to its initial state.
|
|
268
|
+
* For READ and DELETE operations, navigates back in the browser history
|
|
269
|
+
* since these operations don't have modifiable form data to reset.
|
|
270
|
+
*
|
|
271
|
+
* @returns {void}
|
|
272
|
+
* @memberOf CrudFormComponent
|
|
273
|
+
*/
|
|
97
274
|
handleReset(): void;
|
|
275
|
+
/**
|
|
276
|
+
* @description Handles delete operations by emitting delete events.
|
|
277
|
+
* @summary Processes delete requests by emitting a submit event with the
|
|
278
|
+
* record's unique identifier as data. This allows parent components to
|
|
279
|
+
* handle the actual deletion logic while maintaining separation of concerns.
|
|
280
|
+
* The event includes the uid and standard component identification.
|
|
281
|
+
*
|
|
282
|
+
* @returns {void}
|
|
283
|
+
* @memberOf CrudFormComponent
|
|
284
|
+
*/
|
|
98
285
|
handleDelete(): void;
|
|
99
|
-
protected readonly OperationKeys: typeof OperationKeys;
|
|
100
286
|
static ɵfac: i0.ɵɵFactoryDeclaration<CrudFormComponent, never>;
|
|
101
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CrudFormComponent, "ngx-decaf-crud-form", never, { "model": { "alias": "model"; "required": false; }; "updateOn": { "alias": "updateOn"; "required": false; }; "target": { "alias": "target"; "required": false; }; "method": { "alias": "method"; "required": false; }; "options": { "alias": "options"; "required": false; }; "action": { "alias": "action"; "required": false; }; "operation": { "alias": "operation"; "required": true; }; "handlers": { "alias": "handlers"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "childOf": { "alias": "childOf"; "required": false; }; "rendererId": { "alias": "rendererId"; "required": false; }; "uid": { "alias": "uid"; "required": false; }; }, { "submitEvent": "submitEvent"; }, never, ["*"], true, never>;
|
|
287
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CrudFormComponent, "ngx-decaf-crud-form", never, { "model": { "alias": "model"; "required": false; }; "modelId": { "alias": "modelId"; "required": false; }; "updateOn": { "alias": "updateOn"; "required": false; }; "target": { "alias": "target"; "required": false; }; "method": { "alias": "method"; "required": false; }; "options": { "alias": "options"; "required": false; }; "action": { "alias": "action"; "required": false; }; "operation": { "alias": "operation"; "required": true; }; "handlers": { "alias": "handlers"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "childOf": { "alias": "childOf"; "required": false; }; "rendererId": { "alias": "rendererId"; "required": false; }; "uid": { "alias": "uid"; "required": false; }; "allowClear": { "alias": "allowClear"; "required": false; }; }, { "submitEvent": "submitEvent"; }, never, ["*"], true, never>;
|
|
102
288
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
-
import { Color, PredefinedColors } from '@ionic/core';
|
|
3
2
|
import { StringOrBoolean } from '../../engine';
|
|
4
3
|
import { NgxBaseComponent } from '../../engine/NgxBaseComponent';
|
|
5
4
|
import { SafeHtml } from '@angular/platform-browser';
|
|
@@ -23,14 +22,14 @@ import * as i0 from "@angular/core";
|
|
|
23
22
|
* +StringOrBoolean showIcon
|
|
24
23
|
* +string icon
|
|
25
24
|
* +string iconSize
|
|
26
|
-
* +
|
|
25
|
+
* +string iconColor
|
|
27
26
|
* +string|Function buttonLink
|
|
28
27
|
* +string buttonText
|
|
29
28
|
* +string buttonFill
|
|
30
|
-
* +
|
|
29
|
+
* +string buttonColor
|
|
31
30
|
* +string buttonSize
|
|
32
31
|
* +string searchValue
|
|
33
|
-
* -
|
|
32
|
+
* -Router Router
|
|
34
33
|
* +ngOnInit()
|
|
35
34
|
* +handleClick()
|
|
36
35
|
* }
|
|
@@ -125,7 +124,7 @@ export declare class EmptyStateComponent extends NgxBaseComponent implements OnI
|
|
|
125
124
|
* @default 'medium'
|
|
126
125
|
* @memberOf EmptyStateComponent
|
|
127
126
|
*/
|
|
128
|
-
iconColor?:
|
|
127
|
+
iconColor?: string;
|
|
129
128
|
/**
|
|
130
129
|
* @description The navigation target or action for the button.
|
|
131
130
|
* @summary Specifies where the button should navigate to when clicked or what function
|
|
@@ -162,11 +161,11 @@ export declare class EmptyStateComponent extends NgxBaseComponent implements OnI
|
|
|
162
161
|
* @summary Specifies the color for the button using Ionic's color system.
|
|
163
162
|
* This allows the button to match the application's color scheme.
|
|
164
163
|
*
|
|
165
|
-
* @type {
|
|
164
|
+
* @type {string}
|
|
166
165
|
* @default 'primary'
|
|
167
166
|
* @memberOf EmptyStateComponent
|
|
168
167
|
*/
|
|
169
|
-
buttonColor:
|
|
168
|
+
buttonColor: string;
|
|
170
169
|
/**
|
|
171
170
|
* @description The size of the action button.
|
|
172
171
|
* @summary Controls the size of the button shown in the empty state.
|
|
@@ -193,10 +192,10 @@ export declare class EmptyStateComponent extends NgxBaseComponent implements OnI
|
|
|
193
192
|
* This service is used when the buttonLink is a string URL to navigate to that location.
|
|
194
193
|
*
|
|
195
194
|
* @private
|
|
196
|
-
* @type {
|
|
195
|
+
* @type {Router}
|
|
197
196
|
* @memberOf EmptyStateComponent
|
|
198
197
|
*/
|
|
199
|
-
private
|
|
198
|
+
private router;
|
|
200
199
|
private sanitizer;
|
|
201
200
|
private translate;
|
|
202
201
|
searchSubtitle: SafeHtml;
|
|
@@ -249,7 +248,7 @@ export declare class EmptyStateComponent extends NgxBaseComponent implements OnI
|
|
|
249
248
|
* sequenceDiagram
|
|
250
249
|
* participant U as User
|
|
251
250
|
* participant E as EmptyStateComponent
|
|
252
|
-
* participant N as
|
|
251
|
+
* participant N as Router
|
|
253
252
|
*
|
|
254
253
|
* U->>E: Click action button
|
|
255
254
|
* E->>E: handleClick()
|