@decaf-ts/for-angular 0.0.35 → 0.0.37
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/decaf-ts-for-angular.mjs +998 -719
- package/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
- package/index.d.ts +1174 -593
- package/package.json +5 -4
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ElementRef, Type, Injector, EnvironmentInjector, ComponentMirror, ViewContainerRef, ComponentRef, TemplateRef, OnChanges, ChangeDetectorRef, Renderer2, EventEmitter, SimpleChanges, OnInit, OnDestroy,
|
|
2
|
+
import { ElementRef, Type, Injector, EnvironmentInjector, ComponentMirror, ViewContainerRef, ComponentRef, TemplateRef, OnChanges, ChangeDetectorRef, Renderer2, EventEmitter, SimpleChanges, AfterViewInit, OnInit, OnDestroy, InjectionToken, Provider, ModuleWithProviders } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/forms';
|
|
4
4
|
import { FormGroup, FormArray, FormControl, ControlValueAccessor, AbstractControl } from '@angular/forms';
|
|
5
|
-
import { Repository, Adapter, OrderDirection, Paginator, Condition } from '@decaf-ts/core';
|
|
5
|
+
import { Repository, Adapter, OrderDirection, EventIds, Paginator, Condition } from '@decaf-ts/core';
|
|
6
6
|
import { IonInput, IonSelect, IonTextarea, IonCheckbox, MenuController, SpinnerTypes, InfiniteScrollCustomEvent, RefresherCustomEvent } from '@ionic/angular';
|
|
7
7
|
import { TextFieldTypes, SelectInterface, AutocompleteTypes, CheckboxCustomEvent, PredefinedColors } from '@ionic/core';
|
|
8
8
|
import { RepositoryFlags, Context, CrudOperations, OperationKeys } from '@decaf-ts/db-decorators';
|
|
@@ -11,15 +11,15 @@ import { Model, Constructor, ModelConstructor } from '@decaf-ts/decorator-valida
|
|
|
11
11
|
import { FieldProperties, CrudOperationKeys, RenderingEngine, FieldDefinition, UIModelMetadata, UIMediaBreakPointsType } from '@decaf-ts/ui-decorators';
|
|
12
12
|
import { LoggedClass, Logger } from '@decaf-ts/logging';
|
|
13
13
|
import { Router } from '@angular/router';
|
|
14
|
+
import * as i1 from '@angular/common';
|
|
15
|
+
import { Location } from '@angular/common';
|
|
14
16
|
import * as i3 from '@ngx-translate/core';
|
|
15
17
|
import { TranslateService, TranslateLoader, TranslationObject, TranslateParser, RootTranslateServiceConfig } from '@ngx-translate/core';
|
|
16
18
|
import { Title, SafeHtml } from '@angular/platform-browser';
|
|
17
19
|
import { IonAccordionGroup, ItemReorderEventDetail } from '@ionic/angular/standalone';
|
|
18
20
|
import { Subscription, Observable } from 'rxjs';
|
|
19
|
-
import { NgxParentComponentDirective as NgxParentComponentDirective$1 } from 'src/lib/engine/NgxParentComponentDirective';
|
|
20
21
|
import { InjectablesRegistry } from '@decaf-ts/injectable-decorators';
|
|
21
22
|
import { HttpClient } from '@angular/common/http';
|
|
22
|
-
import * as i1 from '@angular/common';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @module module:lib/engine/types
|
|
@@ -195,12 +195,10 @@ type FormParentGroup = [FormParent, string];
|
|
|
195
195
|
type I18nResourceConfigType = I18nResourceConfig | I18nResourceConfig[];
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
* @module
|
|
198
|
+
* @module lib/engine/interfaces
|
|
199
199
|
* @description Type and interface definitions used by the Angular rendering engine.
|
|
200
200
|
* @summary Exposes interfaces for component input metadata, rendering outputs, form events,
|
|
201
201
|
* and supporting types used across the engine and components.
|
|
202
|
-
*
|
|
203
|
-
* @link {@link AngularDynamicOutput}
|
|
204
202
|
*/
|
|
205
203
|
|
|
206
204
|
/**
|
|
@@ -327,6 +325,9 @@ interface IComponentInput extends FieldProperties {
|
|
|
327
325
|
formControl?: FormControl;
|
|
328
326
|
model?: Model | string;
|
|
329
327
|
operation?: CrudOperationKeys | undefined;
|
|
328
|
+
pages?: number;
|
|
329
|
+
cols?: number;
|
|
330
|
+
rows?: number;
|
|
330
331
|
}
|
|
331
332
|
/**
|
|
332
333
|
* @description Component configuration structure
|
|
@@ -393,6 +394,7 @@ interface AngularDynamicOutput {
|
|
|
393
394
|
children?: AngularDynamicOutput[];
|
|
394
395
|
instance?: Type<unknown>;
|
|
395
396
|
formGroup?: FormGroup;
|
|
397
|
+
page?: number;
|
|
396
398
|
formControl?: FormControl;
|
|
397
399
|
projectable?: boolean;
|
|
398
400
|
}
|
|
@@ -474,10 +476,13 @@ interface IBaseCustomEvent {
|
|
|
474
476
|
target?: HTMLElement;
|
|
475
477
|
}
|
|
476
478
|
/**
|
|
477
|
-
* Configuration for internationalization (i18n) resource file paths
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
* @
|
|
479
|
+
* @description Configuration for internationalization (i18n) resource file paths
|
|
480
|
+
* @summary Defines the structure for configuring i18n resource file paths with prefix and suffix.
|
|
481
|
+
* Used by the translation system to locate and load language resource files.
|
|
482
|
+
* @interface I18nResourceConfig
|
|
483
|
+
* @property {string} prefix - The prefix to be used for the resource file path
|
|
484
|
+
* @property {string} suffix - The suffix to be appended to the resource file path
|
|
485
|
+
* @memberOf module:engine
|
|
481
486
|
*/
|
|
482
487
|
interface I18nResourceConfig {
|
|
483
488
|
prefix: string;
|
|
@@ -487,8 +492,12 @@ interface I18nResourceConfig {
|
|
|
487
492
|
* @description CRUD form event type
|
|
488
493
|
* @summary Extends IBaseCustomEvent to include optional handlers for CRUD form operations.
|
|
489
494
|
* This event type is used for form-related actions like create, read, update, and delete operations.
|
|
490
|
-
* @
|
|
491
|
-
* @property {Record<string,
|
|
495
|
+
* @interface ICrudFormEvent
|
|
496
|
+
* @property {Record<string, unknown>} [handlers] - Optional handlers for form operations
|
|
497
|
+
* @property {string} name - The name of the event (inherited from IBaseCustomEvent)
|
|
498
|
+
* @property {string} [component] - The component that triggered the event (inherited from IBaseCustomEvent)
|
|
499
|
+
* @property {unknown} [data] - The data associated with the event (inherited from IBaseCustomEvent)
|
|
500
|
+
* @property {HTMLElement} [target] - The target element (inherited from IBaseCustomEvent)
|
|
492
501
|
* @memberOf module:engine
|
|
493
502
|
*/
|
|
494
503
|
interface ICrudFormEvent extends IBaseCustomEvent {
|
|
@@ -499,6 +508,9 @@ interface ICrudFormEvent extends IBaseCustomEvent {
|
|
|
499
508
|
* @summary Event emitted by pagination components to signal page navigation.
|
|
500
509
|
* Extends IBaseCustomEvent and carries a payload with the target page number and navigation direction.
|
|
501
510
|
* @interface IPaginationCustomEvent
|
|
511
|
+
* @property {Object} data - The pagination data payload
|
|
512
|
+
* @property {number} data.page - The target page number
|
|
513
|
+
* @property {'next' | 'previous'} data.direction - The navigation direction
|
|
502
514
|
* @memberOf module:engine
|
|
503
515
|
*/
|
|
504
516
|
interface IPaginationCustomEvent extends IBaseCustomEvent {
|
|
@@ -512,6 +524,11 @@ interface IPaginationCustomEvent extends IBaseCustomEvent {
|
|
|
512
524
|
* @summary Represents a single item in a navigation or contextual menu.
|
|
513
525
|
* Includes the visible label and optional metadata such as accessibility title, target URL, icon, and color.
|
|
514
526
|
* @interface IMenuItem
|
|
527
|
+
* @property {string} label - The visible text label for the menu item
|
|
528
|
+
* @property {string} [title] - Optional accessibility title or tooltip text
|
|
529
|
+
* @property {string} [url] - Optional target URL for navigation
|
|
530
|
+
* @property {string} [icon] - Optional icon identifier to display with the menu item
|
|
531
|
+
* @property {string} [color] - Optional color theme for the menu item
|
|
515
532
|
* @memberOf module:engine
|
|
516
533
|
*/
|
|
517
534
|
interface IMenuItem {
|
|
@@ -521,9 +538,33 @@ interface IMenuItem {
|
|
|
521
538
|
icon?: string;
|
|
522
539
|
color?: string;
|
|
523
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* @description Form reactive submit event data
|
|
543
|
+
* @summary Defines the structure of data emitted when a reactive form is submitted.
|
|
544
|
+
* Contains the processed form data as key-value pairs.
|
|
545
|
+
* @interface IFormReactiveSubmitEvent
|
|
546
|
+
* @property {Record<string, unknown>} data - The form data as key-value pairs
|
|
547
|
+
* @memberOf module:engine
|
|
548
|
+
*/
|
|
524
549
|
interface IFormReactiveSubmitEvent {
|
|
525
550
|
data: Record<string, unknown>;
|
|
526
551
|
}
|
|
552
|
+
/**
|
|
553
|
+
* @description CRUD form options configuration
|
|
554
|
+
* @summary Defines the configuration options for CRUD form buttons including submit and clear buttons.
|
|
555
|
+
* Each button can be customized with text, icon, and icon position.
|
|
556
|
+
* @interface ICrudFormOptions
|
|
557
|
+
* @property {Object} buttons - Configuration for form action buttons
|
|
558
|
+
* @property {Object} buttons.submit - Submit button configuration
|
|
559
|
+
* @property {string} [buttons.submit.icon] - Optional icon for the submit button
|
|
560
|
+
* @property {'start' | 'end'} [buttons.submit.iconSlot] - Position of the icon relative to text
|
|
561
|
+
* @property {string} [buttons.submit.text] - Text label for the submit button
|
|
562
|
+
* @property {Object} [buttons.clear] - Optional clear button configuration
|
|
563
|
+
* @property {string} [buttons.clear.icon] - Optional icon for the clear button
|
|
564
|
+
* @property {'start' | 'end'} [buttons.clear.iconSlot] - Position of the icon relative to text
|
|
565
|
+
* @property {string} [buttons.clear.text] - Text label for the clear button
|
|
566
|
+
* @memberOf module:engine
|
|
567
|
+
*/
|
|
527
568
|
interface ICrudFormOptions {
|
|
528
569
|
buttons: {
|
|
529
570
|
submit: {
|
|
@@ -538,7 +579,20 @@ interface ICrudFormOptions {
|
|
|
538
579
|
};
|
|
539
580
|
};
|
|
540
581
|
}
|
|
541
|
-
|
|
582
|
+
/**
|
|
583
|
+
* @description Empty list display options
|
|
584
|
+
* @summary Defines the configuration for displaying an empty state in list components
|
|
585
|
+
* when no data is available. Includes text, button, icon, and link settings.
|
|
586
|
+
* @interface IListEmptyOptions
|
|
587
|
+
* @property {string} title - Title text or translation key for empty state
|
|
588
|
+
* @property {string} subtitle - Subtitle text or translation key for empty state
|
|
589
|
+
* @property {boolean} showButton - Whether to show an action button in empty state
|
|
590
|
+
* @property {string} buttonText - Button text or translation key
|
|
591
|
+
* @property {string} link - Navigation link for the button
|
|
592
|
+
* @property {string} icon - Icon identifier for the empty state
|
|
593
|
+
* @memberOf module:engine
|
|
594
|
+
*/
|
|
595
|
+
interface IListEmptyOptions {
|
|
542
596
|
title: string;
|
|
543
597
|
subtitle: string;
|
|
544
598
|
showButton: boolean;
|
|
@@ -548,9 +602,11 @@ interface IListEmptyResult {
|
|
|
548
602
|
}
|
|
549
603
|
|
|
550
604
|
/**
|
|
551
|
-
* @description Angular engine key constants
|
|
605
|
+
* @description Angular engine key constants.
|
|
552
606
|
* @summary Contains key strings used by the Angular rendering engine for reflection,
|
|
553
|
-
* dynamic component creation, and other engine operations.
|
|
607
|
+
* dynamic component creation, and other engine operations. These constants provide
|
|
608
|
+
* consistent naming for metadata keys, DOM attributes, and component identification
|
|
609
|
+
* throughout the rendering system.
|
|
554
610
|
* @typedef {Object} AngularEngineKeys
|
|
555
611
|
* @property {string} REFLECT - Prefix for reflection metadata keys
|
|
556
612
|
* @property {string} DYNAMIC - Key for dynamic component identification
|
|
@@ -564,8 +620,10 @@ interface IListEmptyResult {
|
|
|
564
620
|
* @property {string} RENDER - Key for renderable components
|
|
565
621
|
* @property {string} RENDERED_ID - Template for rendered component IDs
|
|
566
622
|
* @property {string} PARENT - Key for comparison decorators and validators
|
|
623
|
+
* @property {string} VALIDATION_PARENT_KEY - Key for validation parent reference
|
|
624
|
+
* @property {string} FLAVOUR - Identifier for the Angular engine flavor
|
|
567
625
|
* @const AngularEngineKeys
|
|
568
|
-
* @memberOf module:engine
|
|
626
|
+
* @memberOf module:lib/engine/constants
|
|
569
627
|
*/
|
|
570
628
|
declare const AngularEngineKeys: {
|
|
571
629
|
REFLECT: string;
|
|
@@ -581,32 +639,40 @@ declare const AngularEngineKeys: {
|
|
|
581
639
|
RENDERED_ID: string;
|
|
582
640
|
PARENT: string;
|
|
583
641
|
VALIDATION_PARENT_KEY: symbol;
|
|
642
|
+
FLAVOUR: string;
|
|
584
643
|
};
|
|
585
644
|
/**
|
|
586
|
-
* @description Form validation state constants
|
|
645
|
+
* @description Form validation state constants.
|
|
587
646
|
* @summary Contains constants representing the possible validation states of a form.
|
|
588
647
|
* These are used to check and handle form validation throughout the application.
|
|
648
|
+
* The VALID state indicates all form controls pass validation, while INVALID
|
|
649
|
+
* indicates one or more validation errors exist.
|
|
589
650
|
* @typedef {Object} FormConstants
|
|
590
651
|
* @property {string} VALID - Constant representing a valid form state
|
|
591
652
|
* @property {string} INVALID - Constant representing an invalid form state
|
|
592
653
|
* @const FormConstants
|
|
593
|
-
* @memberOf module:engine
|
|
654
|
+
* @memberOf module:lib/engine/constants
|
|
594
655
|
*/
|
|
595
656
|
declare const FormConstants: {
|
|
596
657
|
readonly VALID: "VALID";
|
|
597
658
|
readonly INVALID: "INVALID";
|
|
598
659
|
};
|
|
599
660
|
/**
|
|
600
|
-
* @description Event name constants
|
|
601
|
-
* @summary
|
|
602
|
-
* These
|
|
603
|
-
*
|
|
604
|
-
* @
|
|
661
|
+
* @description Event name constants.
|
|
662
|
+
* @summary Contains constants for standardized event names used throughout the application.
|
|
663
|
+
* These constants ensure consistent event naming across components and make it easier to
|
|
664
|
+
* track and handle events. Each constant represents a specific application event type.
|
|
665
|
+
* @typedef {Object} EventConstants
|
|
605
666
|
* @property {string} BACK_BUTTON_NAVIGATION - Event fired when back button navigation ends
|
|
606
|
-
* @property {string}
|
|
607
|
-
* @property {string}
|
|
608
|
-
* @property {string}
|
|
609
|
-
* @
|
|
667
|
+
* @property {string} REFRESH - Event fired when a refresh action occurs
|
|
668
|
+
* @property {string} CLICK - Event fired when a click action occurs
|
|
669
|
+
* @property {string} SUBMIT - Event fired when a form submission occurs
|
|
670
|
+
* @property {string} VALIDATION_ERROR - Event fired when a validation error occurs
|
|
671
|
+
* @property {string} FIELDSET_ADD_GROUP - Event fired when adding a group to a fieldset
|
|
672
|
+
* @property {string} FIELDSET_UPDATE_GROUP - Event fired when updating a fieldset group
|
|
673
|
+
* @property {string} FIELDSET_REMOVE_GROUP - Event fired when removing a fieldset group
|
|
674
|
+
* @const EventConstants
|
|
675
|
+
* @memberOf module:lib/engine/constants
|
|
610
676
|
*/
|
|
611
677
|
declare const EventConstants: {
|
|
612
678
|
readonly BACK_BUTTON_NAVIGATION: "backButtonNavigationEndEvent";
|
|
@@ -619,9 +685,11 @@ declare const EventConstants: {
|
|
|
619
685
|
readonly FIELDSET_REMOVE_GROUP: "fieldsetRemoveGroupEvent";
|
|
620
686
|
};
|
|
621
687
|
/**
|
|
622
|
-
* @description Logger level constants
|
|
623
|
-
* @summary
|
|
624
|
-
* Lower values represent more verbose logging, while higher values represent
|
|
688
|
+
* @description Logger level constants.
|
|
689
|
+
* @summary Defines the logging levels used in the application's logging system.
|
|
690
|
+
* Lower numeric values represent more verbose logging, while higher values represent
|
|
691
|
+
* more critical logs. These levels control which log messages are output based on
|
|
692
|
+
* the configured logging threshold.
|
|
625
693
|
* @enum {number}
|
|
626
694
|
* @readonly
|
|
627
695
|
* @property {number} ALL - Log everything (most verbose)
|
|
@@ -630,7 +698,7 @@ declare const EventConstants: {
|
|
|
630
698
|
* @property {number} WARN - Log warnings
|
|
631
699
|
* @property {number} ERROR - Log errors
|
|
632
700
|
* @property {number} CRITICAL - Log critical errors (least verbose)
|
|
633
|
-
* @memberOf module:engine
|
|
701
|
+
* @memberOf module:lib/engine/constants
|
|
634
702
|
*/
|
|
635
703
|
declare enum LoggerLevels {
|
|
636
704
|
ALL = 0,
|
|
@@ -641,15 +709,16 @@ declare enum LoggerLevels {
|
|
|
641
709
|
CRITICAL = 5
|
|
642
710
|
}
|
|
643
711
|
/**
|
|
644
|
-
* @description Route direction constants
|
|
645
|
-
* @summary
|
|
646
|
-
* Used for controlling navigation flow and animation directions.
|
|
712
|
+
* @description Route direction constants.
|
|
713
|
+
* @summary Defines the possible navigation directions in the application.
|
|
714
|
+
* Used for controlling navigation flow and animation directions during route transitions.
|
|
715
|
+
* These constants help maintain consistent navigation behavior throughout the app.
|
|
647
716
|
* @enum {string}
|
|
648
717
|
* @readonly
|
|
649
718
|
* @property {string} BACK - Navigate back to the previous page
|
|
650
719
|
* @property {string} FORWARD - Navigate forward to the next page
|
|
651
720
|
* @property {string} ROOT - Navigate to the root/home page
|
|
652
|
-
* @memberOf module:engine
|
|
721
|
+
* @memberOf module:lib/engine/constants
|
|
653
722
|
*/
|
|
654
723
|
declare enum RouteDirections {
|
|
655
724
|
BACK = "back",
|
|
@@ -657,15 +726,18 @@ declare enum RouteDirections {
|
|
|
657
726
|
ROOT = "root"
|
|
658
727
|
}
|
|
659
728
|
/**
|
|
660
|
-
* @description Component tag name constants
|
|
661
|
-
* @summary
|
|
662
|
-
* These tag names are used for component
|
|
729
|
+
* @description Component tag name constants.
|
|
730
|
+
* @summary Defines the custom HTML tag names for specialized components used in the application.
|
|
731
|
+
* These tag names are registered with Angular and used for component rendering and identification.
|
|
732
|
+
* Each constant represents the selector for a specific custom component type.
|
|
663
733
|
* @enum {string}
|
|
664
734
|
* @readonly
|
|
665
735
|
* @property {string} LIST_ITEM - Tag name for list item component
|
|
666
736
|
* @property {string} LIST_INFINITE - Tag name for infinite scrolling list component
|
|
667
737
|
* @property {string} LIST_PAGINATED - Tag name for paginated list component
|
|
668
|
-
* @
|
|
738
|
+
* @property {string} CRUD_FIELD - Tag name for CRUD form field component
|
|
739
|
+
* @property {string} LAYOUT_COMPONENT - Tag name for layout container component
|
|
740
|
+
* @memberOf module:lib/engine/constants
|
|
669
741
|
*/
|
|
670
742
|
declare enum ComponentsTagNames {
|
|
671
743
|
LIST_ITEM = "ngx-decaf-list-item",
|
|
@@ -675,13 +747,16 @@ declare enum ComponentsTagNames {
|
|
|
675
747
|
LAYOUT_COMPONENT = "ngx-decaf-layout"
|
|
676
748
|
}
|
|
677
749
|
/**
|
|
678
|
-
* @description Base component property name constants
|
|
679
|
-
* @summary
|
|
680
|
-
* These
|
|
750
|
+
* @description Base component property name constants.
|
|
751
|
+
* @summary Defines the standard property names used by base components throughout the application.
|
|
752
|
+
* These constants ensure consistent property naming across components and facilitate
|
|
753
|
+
* property access, validation, and data binding. Used primarily for component input
|
|
754
|
+
* properties and change detection.
|
|
681
755
|
* @enum {string}
|
|
682
756
|
* @readonly
|
|
683
757
|
* @property {string} MODEL - Property name for the component's data model
|
|
684
758
|
* @property {string} LOCALE - Property name for localization settings
|
|
759
|
+
* @property {string} LOCALE_ROOT - Property name for the locale root identifier
|
|
685
760
|
* @property {string} PK - Property name for primary key
|
|
686
761
|
* @property {string} ITEMS - Property name for collection items
|
|
687
762
|
* @property {string} ROUTE - Property name for routing information
|
|
@@ -690,7 +765,10 @@ declare enum ComponentsTagNames {
|
|
|
690
765
|
* @property {string} TRANSLATABLE - Property name for translation flag
|
|
691
766
|
* @property {string} MAPPER - Property name for property mapper
|
|
692
767
|
* @property {string} INITIALIZED - Property name for initialization state
|
|
693
|
-
* @
|
|
768
|
+
* @property {string} COMPONENT_NAME - Property name for component identifier
|
|
769
|
+
* @property {string} PARENT_COMPONENT - Property name for parent component reference
|
|
770
|
+
* @property {string} FORM_GROUP_COMPONENT_PROPS - Property name for form group component properties
|
|
771
|
+
* @memberOf module:lib/engine/constants
|
|
694
772
|
*/
|
|
695
773
|
declare enum BaseComponentProps {
|
|
696
774
|
MODEL = "model",
|
|
@@ -708,14 +786,65 @@ declare enum BaseComponentProps {
|
|
|
708
786
|
PARENT_COMPONENT = "parentComponent",
|
|
709
787
|
FORM_GROUP_COMPONENT_PROPS = "componentProps"
|
|
710
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* @description List component type constants.
|
|
791
|
+
* @summary Defines the available types for list components, determining their
|
|
792
|
+
* pagination and scrolling behavior. Used to configure list rendering strategies.
|
|
793
|
+
* @enum {string}
|
|
794
|
+
* @readonly
|
|
795
|
+
* @property {string} INFINITE - Infinite scroll list type
|
|
796
|
+
* @property {string} PAGINATED - Paginated list type with page navigation
|
|
797
|
+
* @memberOf module:lib/engine/constants
|
|
798
|
+
*/
|
|
711
799
|
declare enum ListComponentsTypes {
|
|
712
800
|
INFINITE = "infinite",
|
|
713
801
|
PAGINATED = "paginated"
|
|
714
802
|
}
|
|
803
|
+
/**
|
|
804
|
+
* @description CSS class name constants.
|
|
805
|
+
* @summary Contains predefined CSS class names used for consistent styling
|
|
806
|
+
* across components. These constants help maintain a unified visual language
|
|
807
|
+
* and make it easier to apply standard styles.
|
|
808
|
+
* @typedef {Object} CssClasses
|
|
809
|
+
* @property {string} BUTTONS_CONTAINER - CSS class for button container elements
|
|
810
|
+
* @const CssClasses
|
|
811
|
+
* @memberOf module:lib/engine/constants
|
|
812
|
+
*/
|
|
715
813
|
declare const CssClasses: {
|
|
716
814
|
BUTTONS_CONTAINER: string;
|
|
717
815
|
};
|
|
816
|
+
/**
|
|
817
|
+
* @description Default options for reactive CRUD forms.
|
|
818
|
+
* @summary Provides default configuration for form buttons in CRUD operations.
|
|
819
|
+
* Includes default text labels for submit and clear buttons, which can be
|
|
820
|
+
* overridden by individual form implementations.
|
|
821
|
+
* @type {ICrudFormOptions}
|
|
822
|
+
* @property {Object} buttons - Configuration for form action buttons
|
|
823
|
+
* @property {Object} buttons.submit - Submit button configuration
|
|
824
|
+
* @property {string} buttons.submit.text - Default text for submit button
|
|
825
|
+
* @property {Object} buttons.clear - Clear button configuration
|
|
826
|
+
* @property {string} buttons.clear.text - Default text for clear button
|
|
827
|
+
* @const DefaultFormReactiveOptions
|
|
828
|
+
* @memberOf module:lib/engine/constants
|
|
829
|
+
*/
|
|
718
830
|
declare const DefaultFormReactiveOptions: ICrudFormOptions;
|
|
831
|
+
/**
|
|
832
|
+
* @description Default options for empty list state display.
|
|
833
|
+
* @summary Provides default configuration for displaying empty state in list components
|
|
834
|
+
* when no data is available. Includes default text for title and subtitle, icon name,
|
|
835
|
+
* button text and visibility settings. These defaults can be overridden by individual
|
|
836
|
+
* list component implementations to customize the empty state presentation.
|
|
837
|
+
* @type {IListEmptyOptions}
|
|
838
|
+
* @property {string} title - Default translation key for empty list title
|
|
839
|
+
* @property {string} subtitle - Default translation key for empty list subtitle
|
|
840
|
+
* @property {boolean} showButton - Whether to show action button in empty state
|
|
841
|
+
* @property {string} icon - Default Ionic icon name for empty state
|
|
842
|
+
* @property {string} buttonText - Default translation key for button text
|
|
843
|
+
* @property {string} link - Default navigation link (empty string)
|
|
844
|
+
* @const DefaultListEmptyOptions
|
|
845
|
+
* @memberOf module:lib/engine/constants
|
|
846
|
+
*/
|
|
847
|
+
declare const DefaultListEmptyOptions: IListEmptyOptions;
|
|
719
848
|
|
|
720
849
|
/**
|
|
721
850
|
* @description Marks an Angular component as dynamically loadable
|
|
@@ -762,33 +891,30 @@ declare abstract class DynamicModule {
|
|
|
762
891
|
}
|
|
763
892
|
|
|
764
893
|
/**
|
|
765
|
-
* @module
|
|
894
|
+
* @module lib/engine/NgxRenderingEngine
|
|
766
895
|
* @description Angular rendering engine for Decaf model-driven UIs.
|
|
767
896
|
* @summary Implements NgxRenderingEngine which converts model decorator metadata
|
|
768
897
|
* into Angular components, manages component registration, and orchestrates
|
|
769
898
|
* dynamic component creation and input mapping.
|
|
770
|
-
*
|
|
771
899
|
* @link {@link NgxRenderingEngine}
|
|
772
900
|
*/
|
|
773
901
|
|
|
774
902
|
/**
|
|
775
|
-
* @description Angular implementation of the RenderingEngine
|
|
776
|
-
* @summary This class extends the base RenderingEngine to provide Angular-specific rendering capabilities
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
903
|
+
* @description Angular implementation of the RenderingEngine for Decaf components.
|
|
904
|
+
* @summary This class extends the base RenderingEngine to provide Angular-specific rendering capabilities.
|
|
905
|
+
* It handles the conversion of field definitions to Angular components, manages component registration,
|
|
906
|
+
* and provides utilities for component creation and input handling. The engine converts model decorator
|
|
907
|
+
* metadata into dynamically created Angular components with proper input binding and lifecycle management.
|
|
781
908
|
* @template AngularFieldDefinition - Type for Angular-specific field definitions
|
|
782
909
|
* @template AngularDynamicOutput - Type for Angular-specific component output
|
|
783
|
-
*
|
|
784
910
|
* @class NgxRenderingEngine
|
|
911
|
+
* @extends {RenderingEngine<AngularFieldDefinition, AngularDynamicOutput>}
|
|
785
912
|
* @example
|
|
786
913
|
* ```typescript
|
|
787
914
|
* const engine = NgxRenderingEngine.get();
|
|
788
915
|
* engine.initialize();
|
|
789
916
|
* const output = engine.render(myModel, {}, viewContainerRef, injector, templateRef);
|
|
790
917
|
* ```
|
|
791
|
-
*
|
|
792
918
|
* @mermaid
|
|
793
919
|
* sequenceDiagram
|
|
794
920
|
* participant Client
|
|
@@ -804,83 +930,95 @@ declare abstract class DynamicModule {
|
|
|
804
930
|
* Components-->>Engine: component constructor
|
|
805
931
|
* Engine->>Engine: createComponent(component, inputs, metadata, vcr, injector, template)
|
|
806
932
|
* Engine-->>Client: return AngularDynamicOutput
|
|
933
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
807
934
|
*/
|
|
808
935
|
declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefinition, AngularDynamicOutput> {
|
|
809
936
|
/**
|
|
810
|
-
* @description Registry of components available for rendering
|
|
937
|
+
* @description Registry of components available for dynamic rendering.
|
|
811
938
|
* @summary Static registry that stores all registered components indexed by their selector name.
|
|
812
939
|
* Each component entry contains a constructor reference that can be used to instantiate
|
|
813
940
|
* the component during the rendering process. This registry is shared across all instances
|
|
814
941
|
* of the rendering engine and is populated through the registerComponent method.
|
|
815
|
-
*
|
|
816
942
|
* @private
|
|
817
943
|
* @static
|
|
818
944
|
* @type {Record<string, { constructor: Constructor<unknown> }>}
|
|
945
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
819
946
|
*/
|
|
820
947
|
private static _components;
|
|
821
948
|
/**
|
|
822
|
-
* @description Currently active model being rendered
|
|
949
|
+
* @description Currently active model being rendered by the engine.
|
|
823
950
|
* @summary Stores a reference to the model instance that is currently being processed
|
|
824
951
|
* by the rendering engine. This property is set during the render method execution
|
|
825
952
|
* and is used throughout the rendering lifecycle to access model data and metadata.
|
|
826
953
|
* The definite assignment assertion (!) is used because this property is always
|
|
827
954
|
* initialized before use within the render method.
|
|
828
|
-
*
|
|
829
955
|
* @private
|
|
830
956
|
* @type {Model}
|
|
957
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
831
958
|
*/
|
|
832
959
|
private _model;
|
|
833
960
|
/**
|
|
834
|
-
* @description Current operation context for component visibility control
|
|
961
|
+
* @description Current operation context for component visibility control.
|
|
835
962
|
* @summary Static property that stores the current operation being performed,
|
|
836
963
|
* which is used to determine component visibility through the 'hidden' property.
|
|
837
964
|
* Components can specify operations where they should be hidden, and this property
|
|
838
965
|
* provides the context for those visibility checks. The value is typically extracted
|
|
839
966
|
* from the global properties during the rendering process.
|
|
840
|
-
*
|
|
841
967
|
* @private
|
|
842
968
|
* @static
|
|
843
969
|
* @type {string | undefined}
|
|
970
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
844
971
|
*/
|
|
845
972
|
private static _operation;
|
|
846
973
|
/**
|
|
847
|
-
* @description Reference to the currently active component instance
|
|
974
|
+
* @description Reference to the currently active component instance.
|
|
848
975
|
* @summary Static property that maintains a reference to the most recently created
|
|
849
976
|
* component instance. This is used internally for component lifecycle management
|
|
850
977
|
* and can be cleared through the destroy method. The reference allows access to
|
|
851
978
|
* the active component instance for operations that need to interact with the
|
|
852
979
|
* currently rendered component.
|
|
853
|
-
*
|
|
854
980
|
* @private
|
|
855
981
|
* @static
|
|
856
982
|
* @type {Type<unknown> | undefined}
|
|
983
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
857
984
|
*/
|
|
858
985
|
private static _instance;
|
|
986
|
+
/**
|
|
987
|
+
* @description Parent component properties for child component inheritance.
|
|
988
|
+
* @summary Static property that stores parent component properties that should be
|
|
989
|
+
* inherited by child components. This is particularly used for passing page configuration
|
|
990
|
+
* down to child components in multi-page forms. The property is cleared after rendering
|
|
991
|
+
* to prevent property leakage between unrelated component trees.
|
|
992
|
+
* @private
|
|
993
|
+
* @static
|
|
994
|
+
* @type {KeyValue | undefined}
|
|
995
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
996
|
+
*/
|
|
859
997
|
private static _parentProps;
|
|
860
998
|
/**
|
|
861
|
-
* @description Constructs a new NgxRenderingEngine instance
|
|
999
|
+
* @description Constructs a new NgxRenderingEngine instance.
|
|
862
1000
|
* @summary Initializes a new instance of the Angular rendering engine by calling the parent
|
|
863
1001
|
* constructor with the 'angular' engine type identifier. This constructor sets up the base
|
|
864
1002
|
* rendering engine functionality with Angular-specific configurations and prepares the
|
|
865
1003
|
* instance for component registration and rendering operations.
|
|
866
|
-
*
|
|
867
1004
|
* @constructor
|
|
1005
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
868
1006
|
*/
|
|
869
1007
|
constructor();
|
|
870
1008
|
/**
|
|
871
|
-
* @description Converts a field definition to an Angular component output
|
|
1009
|
+
* @description Converts a field definition to an Angular component output.
|
|
872
1010
|
* @summary This private method takes a field definition and creates the corresponding Angular component.
|
|
873
|
-
* It handles component instantiation, input property mapping,
|
|
874
|
-
* The method validates input properties against the component's metadata and processes
|
|
1011
|
+
* It handles component instantiation, input property mapping, child component rendering, and visibility
|
|
1012
|
+
* control. The method validates input properties against the component's metadata and processes
|
|
875
1013
|
* child components recursively.
|
|
876
|
-
*
|
|
877
1014
|
* @param {FieldDefinition<AngularFieldDefinition>} fieldDef - The field definition to convert
|
|
878
1015
|
* @param {ViewContainerRef} vcr - The view container reference for component creation
|
|
879
1016
|
* @param {Injector} injector - The Angular injector for dependency injection
|
|
880
1017
|
* @param {TemplateRef<any>} tpl - The template reference for content projection
|
|
881
1018
|
* @param {string} registryFormId - Form identifier for the component renderer
|
|
1019
|
+
* @param {boolean} createComponent - Whether to create the component instance
|
|
1020
|
+
* @param {FormParent} [formGroup] - Optional form group for form components
|
|
882
1021
|
* @return {AngularDynamicOutput} The Angular component output with component reference and inputs
|
|
883
|
-
*
|
|
884
1022
|
* @mermaid
|
|
885
1023
|
* sequenceDiagram
|
|
886
1024
|
* participant Method as fromFieldDefinition
|
|
@@ -901,14 +1039,15 @@ declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefinition,
|
|
|
901
1039
|
* Method->>Method: Create component instance
|
|
902
1040
|
* end
|
|
903
1041
|
* Method-->>Caller: return AngularDynamicOutput
|
|
1042
|
+
* @private
|
|
1043
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
904
1044
|
*/
|
|
905
1045
|
private fromFieldDefinition;
|
|
906
1046
|
/**
|
|
907
|
-
* @description Creates an Angular component instance
|
|
1047
|
+
* @description Creates an Angular component instance with inputs and template projection.
|
|
908
1048
|
* @summary This static utility method creates an Angular component instance with the specified
|
|
909
1049
|
* inputs and template. It uses Angular's component creation API to instantiate the component
|
|
910
1050
|
* and then sets the input properties using the provided metadata.
|
|
911
|
-
*
|
|
912
1051
|
* @param {Type<unknown>} component - The component type to create
|
|
913
1052
|
* @param {KeyValue} [inputs={}] - The input properties to set on the component
|
|
914
1053
|
* @param {ComponentMirror<unknown>} metadata - The component metadata for input validation
|
|
@@ -916,36 +1055,40 @@ declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefinition,
|
|
|
916
1055
|
* @param {Injector} injector - The Angular injector for dependency injection
|
|
917
1056
|
* @param {Node[]} [template=[]] - The template nodes to project into the component
|
|
918
1057
|
* @return {ComponentRef<unknown>} The created component reference
|
|
1058
|
+
* @static
|
|
1059
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
919
1060
|
*/
|
|
920
1061
|
static createComponent(component: Type<unknown>, inputs: KeyValue | undefined, metadata: ComponentMirror<unknown>, vcr: ViewContainerRef, injector: Injector, template?: Node[]): ComponentRef<unknown>;
|
|
921
1062
|
/**
|
|
922
|
-
* @description Extracts decorator metadata from a model
|
|
1063
|
+
* @description Extracts decorator metadata from a model.
|
|
923
1064
|
* @summary This method provides access to the field definition generated from a model's
|
|
924
1065
|
* decorators. It's a convenience wrapper around the toFieldDefinition method that
|
|
925
1066
|
* converts a model to a field definition based on its decorators and the provided
|
|
926
1067
|
* global properties.
|
|
927
|
-
*
|
|
928
1068
|
* @param {Model} model - The model to extract decorators from
|
|
929
1069
|
* @param {Record<string, unknown>} globalProps - Global properties to include in the field definition
|
|
930
1070
|
* @return {FieldDefinition<AngularFieldDefinition>} The field definition generated from the model
|
|
1071
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
931
1072
|
*/
|
|
932
1073
|
getDecorators(model: Model, globalProps: Record<string, unknown>): FieldDefinition<AngularFieldDefinition>;
|
|
933
1074
|
/**
|
|
934
|
-
* @description Destroys the current engine instance
|
|
935
|
-
* @summary This static method clears the current instance reference,
|
|
936
|
-
* destroying the singleton instance of the rendering engine.
|
|
937
|
-
*
|
|
938
|
-
*
|
|
1075
|
+
* @description Destroys the current engine instance and cleans up resources.
|
|
1076
|
+
* @summary This static method clears the current instance reference and parent props,
|
|
1077
|
+
* effectively destroying the singleton instance of the rendering engine. Optionally
|
|
1078
|
+
* removes the form registry for the specified form ID. This can be used to reset the
|
|
1079
|
+
* engine state or to prepare for a new instance creation.
|
|
1080
|
+
* @param {string} [formId] - Optional form ID to remove from registry
|
|
939
1081
|
* @return {Promise<void>} A promise that resolves when the instance is destroyed
|
|
1082
|
+
* @static
|
|
1083
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
940
1084
|
*/
|
|
941
1085
|
static destroy(formId?: string): Promise<void>;
|
|
942
1086
|
/**
|
|
943
|
-
* @description Renders a model into an Angular component output
|
|
1087
|
+
* @description Renders a model into an Angular component output.
|
|
944
1088
|
* @summary This method takes a model and converts it to an Angular component output.
|
|
945
1089
|
* It first stores a reference to the model, then converts it to a field definition
|
|
946
1090
|
* using the base RenderingEngine's toFieldDefinition method, and finally converts
|
|
947
1091
|
* that field definition to an Angular component output using fromFieldDefinition.
|
|
948
|
-
*
|
|
949
1092
|
* @template M - Type extending Model
|
|
950
1093
|
* @param {M} model - The model to render
|
|
951
1094
|
* @param {Record<string, unknown>} globalProps - Global properties to pass to the component
|
|
@@ -953,7 +1096,6 @@ declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefinition,
|
|
|
953
1096
|
* @param {Injector} injector - The Angular injector for dependency injection
|
|
954
1097
|
* @param {TemplateRef<any>} tpl - The template reference for content projection
|
|
955
1098
|
* @return {AngularDynamicOutput} The Angular component output with component reference and inputs
|
|
956
|
-
*
|
|
957
1099
|
* @mermaid
|
|
958
1100
|
* sequenceDiagram
|
|
959
1101
|
* participant Client as Client Code
|
|
@@ -968,63 +1110,68 @@ declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefinition,
|
|
|
968
1110
|
* Render->>FromField: fromFieldDefinition(fieldDef, vcr, injector, tpl)
|
|
969
1111
|
* FromField-->>Render: AngularDynamicOutput
|
|
970
1112
|
* Render-->>Client: return AngularDynamicOutput
|
|
1113
|
+
* @override
|
|
1114
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
971
1115
|
*/
|
|
972
1116
|
render<M extends Model>(model: M, globalProps: Record<string, unknown>, vcr: ViewContainerRef, injector: Injector, tpl: TemplateRef<unknown>): AngularDynamicOutput;
|
|
973
1117
|
/**
|
|
974
|
-
* @description Initializes the rendering engine
|
|
1118
|
+
* @description Initializes the rendering engine.
|
|
975
1119
|
* @summary This method initializes the rendering engine. It checks if the engine is already initialized
|
|
976
1120
|
* and sets the initialized flag to true. This method is called before the engine is used
|
|
977
1121
|
* to ensure it's properly set up for rendering operations.
|
|
978
|
-
*
|
|
979
1122
|
* @return {Promise<void>} A promise that resolves when initialization is complete
|
|
1123
|
+
* @override
|
|
1124
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
980
1125
|
*/
|
|
981
1126
|
initialize(): Promise<void>;
|
|
982
1127
|
/**
|
|
983
|
-
* @description Registers a component with the rendering engine
|
|
1128
|
+
* @description Registers a component with the rendering engine.
|
|
984
1129
|
* @summary This static method registers a component constructor with the rendering engine
|
|
985
1130
|
* under a specific name. It initializes the components registry if needed and throws
|
|
986
1131
|
* an error if a component is already registered under the same name to prevent
|
|
987
1132
|
* accidental overrides.
|
|
988
|
-
*
|
|
989
1133
|
* @param {string} name - The name to register the component under
|
|
990
1134
|
* @param {Constructor<unknown>} constructor - The component constructor
|
|
991
1135
|
* @return {void}
|
|
1136
|
+
* @static
|
|
1137
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
992
1138
|
*/
|
|
993
1139
|
static registerComponent(name: string, constructor: Constructor<unknown>): void;
|
|
994
1140
|
/**
|
|
995
|
-
* @description Retrieves registered components from the rendering engine
|
|
1141
|
+
* @description Retrieves registered components from the rendering engine.
|
|
996
1142
|
* @summary This static method retrieves either all registered components or a specific component
|
|
997
1143
|
* by its selector. When called without a selector, it returns an array of all registered
|
|
998
1144
|
* components. When called with a selector, it returns the specific component if found,
|
|
999
1145
|
* or throws an error if the component is not registered.
|
|
1000
|
-
*
|
|
1001
1146
|
* @param {string} [selector] - Optional selector to retrieve a specific component
|
|
1002
1147
|
* @return {Object|Array} Either a specific component or an array of all components
|
|
1148
|
+
* @static
|
|
1149
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
1003
1150
|
*/
|
|
1004
1151
|
static components(selector?: string): object | string[];
|
|
1005
1152
|
/**
|
|
1006
|
-
* @description Generates a key for reflection metadata
|
|
1153
|
+
* @description Generates a key for reflection metadata storage.
|
|
1007
1154
|
* @summary This static method generates a key for reflection metadata by prefixing the input key
|
|
1008
1155
|
* with the Angular engine's reflection prefix. This is used for storing and retrieving
|
|
1009
1156
|
* metadata in a namespaced way to avoid conflicts with other metadata.
|
|
1010
|
-
*
|
|
1011
1157
|
* @param {string} key - The base key to prefix
|
|
1012
1158
|
* @return {string} The prefixed key for reflection metadata
|
|
1159
|
+
* @static
|
|
1160
|
+
* @override
|
|
1161
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
1013
1162
|
*/
|
|
1014
1163
|
static key(key: string): string;
|
|
1015
1164
|
/**
|
|
1016
|
-
* @description Sets input properties on a component instance
|
|
1165
|
+
* @description Sets input properties on a component instance.
|
|
1017
1166
|
* @summary This static utility method sets input properties on a component instance
|
|
1018
1167
|
* based on the provided inputs object and component metadata. It handles both simple
|
|
1019
1168
|
* values and nested objects, recursively processing object properties. The method
|
|
1020
1169
|
* validates each input against the component's metadata to ensure only valid inputs
|
|
1021
1170
|
* are set.
|
|
1022
|
-
*
|
|
1023
1171
|
* @param {ComponentRef<unknown>} component - The component reference to set inputs on
|
|
1024
1172
|
* @param {KeyValue} inputs - The input properties to set
|
|
1025
1173
|
* @param {ComponentMirror<unknown>} metadata - The component metadata for input validation
|
|
1026
1174
|
* @return {void}
|
|
1027
|
-
*
|
|
1028
1175
|
* @mermaid
|
|
1029
1176
|
* sequenceDiagram
|
|
1030
1177
|
* participant Caller
|
|
@@ -1044,341 +1191,457 @@ declare class NgxRenderingEngine extends RenderingEngine<AngularFieldDefinition,
|
|
|
1044
1191
|
* SetInputs->>Component: setInput(key, value)
|
|
1045
1192
|
* end
|
|
1046
1193
|
* end
|
|
1194
|
+
* @static
|
|
1195
|
+
* @memberOf module:lib/engine/NgxRenderingEngine
|
|
1047
1196
|
*/
|
|
1048
1197
|
static setInputs(component: ComponentRef<unknown>, inputs: KeyValue, metadata: ComponentMirror<unknown>): void;
|
|
1049
1198
|
}
|
|
1050
1199
|
|
|
1051
1200
|
/**
|
|
1052
|
-
* @module
|
|
1201
|
+
* @module lib/engine/NgxDecafComponentDirective
|
|
1053
1202
|
* @description Base decaf component abstraction providing shared inputs and utilities.
|
|
1054
1203
|
* @summary NgxDecafComponentDirective is the abstract foundation for Decaf components and provides common
|
|
1055
1204
|
* inputs (model, mapper, pk, props), logging, repository resolution, and event dispatch helpers.
|
|
1056
1205
|
* It centralizes shared behavior for child components and simplifies integration with the rendering engine.
|
|
1057
|
-
*
|
|
1058
1206
|
* @link {@link NgxDecafComponentDirective}
|
|
1059
1207
|
*/
|
|
1060
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* @description Base directive for Decaf components in Angular applications.
|
|
1211
|
+
* @summary Abstract base class that provides common functionality for all Decaf components.
|
|
1212
|
+
* This directive establishes a foundation for component development by offering shared inputs
|
|
1213
|
+
* (model, mapper, pk, props), logging infrastructure, repository access, event handling, and
|
|
1214
|
+
* internationalization support. It implements OnChanges to respond to input property changes
|
|
1215
|
+
* and includes utilities for navigation, localization, and dynamic property binding. All Decaf
|
|
1216
|
+
* components should extend this directive to inherit its foundational capabilities.
|
|
1217
|
+
* @class NgxDecafComponentDirective
|
|
1218
|
+
* @extends {LoggedClass}
|
|
1219
|
+
* @implements {OnChanges}
|
|
1220
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1221
|
+
*/
|
|
1061
1222
|
declare abstract class NgxDecafComponentDirective extends LoggedClass implements OnChanges {
|
|
1062
|
-
protected componentName?: string | undefined;
|
|
1063
|
-
protected localeRoot?: string | undefined;
|
|
1064
1223
|
/**
|
|
1065
|
-
* @description Reference to the component's element.
|
|
1224
|
+
* @description Reference to the component's native DOM element.
|
|
1066
1225
|
* @summary Provides direct access to the native DOM element of the component through Angular's
|
|
1067
1226
|
* ViewChild decorator. This reference can be used to manipulate the DOM element directly,
|
|
1068
1227
|
* apply custom styles, or access native element properties and methods. The element is
|
|
1069
1228
|
* identified by the 'component' template reference variable.
|
|
1070
|
-
*
|
|
1071
1229
|
* @type {ElementRef}
|
|
1072
|
-
* @memberOf NgxDecafComponentDirective
|
|
1230
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1073
1231
|
*/
|
|
1074
1232
|
component: ElementRef;
|
|
1233
|
+
/**
|
|
1234
|
+
* @description Name identifier for the component instance.
|
|
1235
|
+
* @summary Provides a string identifier that can be used to name or label the component
|
|
1236
|
+
* instance. This name can be used for debugging purposes, logging, or to identify specific
|
|
1237
|
+
* component instances within a larger application structure. It serves as a human-readable
|
|
1238
|
+
* identifier that helps distinguish between multiple instances of the same component type.
|
|
1239
|
+
* @type {string}
|
|
1240
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1241
|
+
*/
|
|
1075
1242
|
name: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* @description Parent component identifier for hierarchical component relationships.
|
|
1245
|
+
* @summary Specifies the identifier of the parent component in a hierarchical component structure.
|
|
1246
|
+
* This property establishes a parent-child relationship between components, allowing for
|
|
1247
|
+
* proper nesting and organization of components within a layout. It can be used to track
|
|
1248
|
+
* component dependencies and establish component hierarchies for rendering and event propagation.
|
|
1249
|
+
* @type {string | undefined}
|
|
1250
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1251
|
+
*/
|
|
1076
1252
|
childOf: string | undefined;
|
|
1077
1253
|
/**
|
|
1078
|
-
* @description Unique identifier for the
|
|
1079
|
-
* @summary A unique identifier
|
|
1080
|
-
* This is
|
|
1081
|
-
*
|
|
1254
|
+
* @description Unique identifier for the component instance.
|
|
1255
|
+
* @summary A unique identifier automatically generated for each component instance.
|
|
1256
|
+
* This UID is used for DOM element identification, component tracking, and debugging purposes.
|
|
1257
|
+
* By default, it generates a random 16-character value, but it can be explicitly set via input.
|
|
1082
1258
|
* @type {string | number}
|
|
1083
|
-
* @
|
|
1259
|
+
* @default generateRandomValue(16)
|
|
1260
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1084
1261
|
*/
|
|
1085
1262
|
uid: string | number;
|
|
1086
1263
|
/**
|
|
1087
|
-
* @description
|
|
1088
|
-
* @summary The data model
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
* @
|
|
1264
|
+
* @description Data model or model name for component operations.
|
|
1265
|
+
* @summary The data model that this component will use for CRUD operations. This can be provided
|
|
1266
|
+
* as a Model instance, a model constructor, or a string representing the model's registered name.
|
|
1267
|
+
* When set, this property provides the component with access to the model's schema, validation rules,
|
|
1268
|
+
* and metadata needed for rendering and data operations.
|
|
1269
|
+
* @type {Model | string | undefined}
|
|
1270
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1093
1271
|
*/
|
|
1094
1272
|
model: Model | string | undefined;
|
|
1095
1273
|
/**
|
|
1096
|
-
* @description
|
|
1097
|
-
* @summary
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1102
|
-
* @
|
|
1103
|
-
* @memberOf NgxDecafComponentDirective
|
|
1274
|
+
* @description Primary key value of the current model instance.
|
|
1275
|
+
* @summary Specifies the primary key value for the current model record being displayed or
|
|
1276
|
+
* manipulated by the component. This identifier is used for CRUD operations that target
|
|
1277
|
+
* specific records, such as read, update, and delete operations. The value corresponds to
|
|
1278
|
+
* the field designated as the primary key in the model definition.
|
|
1279
|
+
* @type {EventIds}
|
|
1280
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1104
1281
|
*/
|
|
1105
|
-
modelId
|
|
1282
|
+
modelId?: EventIds;
|
|
1106
1283
|
/**
|
|
1107
|
-
* @description Primary key field name for the model.
|
|
1284
|
+
* @description Primary key field name for the data model.
|
|
1108
1285
|
* @summary Specifies which field in the model should be used as the primary key.
|
|
1109
1286
|
* This is typically used for identifying unique records in operations like update and delete.
|
|
1110
|
-
*
|
|
1287
|
+
* If not explicitly set, it defaults to the repository's configured primary key or 'id'.
|
|
1111
1288
|
* @type {string}
|
|
1112
1289
|
* @default 'id'
|
|
1113
|
-
* @memberOf NgxDecafComponentDirective
|
|
1290
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1114
1291
|
*/
|
|
1115
1292
|
pk: string;
|
|
1116
1293
|
/**
|
|
1117
|
-
* @description Field mapping configuration.
|
|
1294
|
+
* @description Field mapping configuration object or function.
|
|
1118
1295
|
* @summary Defines how fields from the data model should be mapped to properties used by the component.
|
|
1119
|
-
* This allows for flexible data binding between the model and the component's display logic.
|
|
1120
|
-
*
|
|
1121
|
-
* @type {Record<string, string>}
|
|
1122
|
-
* @
|
|
1296
|
+
* This allows for flexible data binding between the model and the component's display logic. Can be
|
|
1297
|
+
* provided as a static object mapping or as a function for dynamic mapping transformations.
|
|
1298
|
+
* @type {Record<string, string> | FunctionLike}
|
|
1299
|
+
* @default {}
|
|
1300
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1123
1301
|
*/
|
|
1124
1302
|
mapper: Record<string, string> | FunctionLike;
|
|
1125
1303
|
/**
|
|
1126
|
-
* @description Available CRUD operations for this component.
|
|
1304
|
+
* @description Available CRUD operations for this component instance.
|
|
1127
1305
|
* @summary Defines which CRUD operations (Create, Read, Update, Delete) are available
|
|
1128
|
-
* for this component. This affects which operations can be performed on the data
|
|
1129
|
-
*
|
|
1306
|
+
* for this component. This affects which operations can be performed on the data and
|
|
1307
|
+
* which operation buttons are displayed in the UI. By default, only READ operations are enabled.
|
|
1308
|
+
* @type {CrudOperations[]}
|
|
1130
1309
|
* @default [OperationKeys.READ]
|
|
1131
|
-
* @memberOf NgxDecafComponentDirective
|
|
1310
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1132
1311
|
*/
|
|
1133
1312
|
operations: CrudOperations[];
|
|
1134
1313
|
/**
|
|
1135
|
-
* @description
|
|
1136
|
-
* @summary Specifies which
|
|
1137
|
-
*
|
|
1314
|
+
* @description The CRUD operation type to be performed on the model.
|
|
1315
|
+
* @summary Specifies which operation (Create, Read, Update, Delete) this component instance
|
|
1316
|
+
* should perform. This determines the UI behavior, form configuration, and available actions.
|
|
1317
|
+
* The operation affects form validation, field availability, and the specific repository
|
|
1318
|
+
* method called during data submission.
|
|
1138
1319
|
*
|
|
1320
|
+
* @type {OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE}
|
|
1321
|
+
* @default OperationKeys.READ
|
|
1322
|
+
* @memberOf ModelPage
|
|
1323
|
+
*/
|
|
1324
|
+
operation: OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE;
|
|
1325
|
+
/**
|
|
1326
|
+
* @description Row position in a grid-based layout system.
|
|
1327
|
+
* @summary Specifies the row position of this component when rendered within a grid-based layout.
|
|
1328
|
+
* This property is used for positioning components in multi-row, multi-column layouts and helps
|
|
1329
|
+
* establish the component's vertical placement within the grid structure.
|
|
1139
1330
|
* @type {number}
|
|
1140
1331
|
* @default 1
|
|
1141
|
-
* @memberOf NgxDecafComponentDirective
|
|
1332
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1142
1333
|
*/
|
|
1143
1334
|
row: number;
|
|
1144
1335
|
/**
|
|
1145
|
-
* @description
|
|
1146
|
-
* @summary Specifies
|
|
1147
|
-
* This is
|
|
1148
|
-
*
|
|
1336
|
+
* @description Column position in a grid-based layout system.
|
|
1337
|
+
* @summary Specifies the column position of this component when rendered within a grid-based layout.
|
|
1338
|
+
* This property is used for positioning components in multi-row, multi-column layouts and helps
|
|
1339
|
+
* establish the component's horizontal placement within the grid structure.
|
|
1149
1340
|
* @type {number}
|
|
1150
1341
|
* @default 1
|
|
1151
|
-
* @memberOf NgxDecafComponentDirective
|
|
1342
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1152
1343
|
*/
|
|
1153
1344
|
col: number;
|
|
1154
1345
|
/**
|
|
1155
|
-
* @description Additional CSS class names
|
|
1346
|
+
* @description Additional CSS class names for component styling.
|
|
1156
1347
|
* @summary Allows custom CSS classes to be added to the component's root element.
|
|
1157
1348
|
* These classes are appended to any automatically generated classes based on other
|
|
1158
1349
|
* component properties. Multiple classes can be provided as a space-separated string.
|
|
1159
1350
|
* This provides a way to customize the component's appearance beyond the built-in styling options.
|
|
1160
|
-
*
|
|
1161
1351
|
* @type {string}
|
|
1162
1352
|
* @default ""
|
|
1163
|
-
* @memberOf NgxDecafComponentDirective
|
|
1353
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1164
1354
|
*/
|
|
1165
1355
|
className: string;
|
|
1166
1356
|
/**
|
|
1167
|
-
* @description
|
|
1357
|
+
* @description Repository instance for data layer operations.
|
|
1168
1358
|
* @summary Provides a connection to the data layer for retrieving and manipulating data.
|
|
1169
|
-
* This is an instance of the
|
|
1170
|
-
* which is initialized in the `repository` getter method.
|
|
1171
|
-
*
|
|
1359
|
+
* This is an instance of the DecafRepository class, initialized lazily in the repository getter.
|
|
1172
1360
|
* The repository is used to perform CRUD (Create, Read, Update, Delete) operations on the
|
|
1173
|
-
* data model
|
|
1174
|
-
* items. It also provides methods for querying and filtering data based on specific criteria.
|
|
1175
|
-
*
|
|
1361
|
+
* data model and provides methods for querying and filtering data based on specific criteria.
|
|
1176
1362
|
* @type {DecafRepository<Model>}
|
|
1177
1363
|
* @private
|
|
1178
|
-
* @memberOf NgxDecafComponentDirective
|
|
1364
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1179
1365
|
*/
|
|
1180
1366
|
protected _repository?: DecafRepository<Model>;
|
|
1181
1367
|
/**
|
|
1182
|
-
* @description
|
|
1183
|
-
* @summary
|
|
1184
|
-
*
|
|
1185
|
-
* the application
|
|
1186
|
-
*
|
|
1187
|
-
* @
|
|
1368
|
+
* @description Ionic menu controller service for menu management.
|
|
1369
|
+
* @summary Injected service that provides programmatic control over Ionic menu components.
|
|
1370
|
+
* This service allows the component to open, close, toggle, and manage menu states within
|
|
1371
|
+
* the application. It provides access to menu functionality for implementing navigation
|
|
1372
|
+
* and layout features that require menu interaction.
|
|
1373
|
+
* @protected
|
|
1188
1374
|
* @type {MenuController}
|
|
1189
|
-
* @memberOf NgxDecafComponentDirective
|
|
1375
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1190
1376
|
*/
|
|
1191
1377
|
protected menuController: MenuController;
|
|
1192
1378
|
/**
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
*/
|
|
1379
|
+
* @description Angular change detection service for manual change detection control.
|
|
1380
|
+
* @summary Injected service that provides manual control over change detection cycles.
|
|
1381
|
+
* This is essential for ensuring that programmatic DOM changes (like setting accordion
|
|
1382
|
+
* attributes) are properly reflected in the component's state and trigger appropriate
|
|
1383
|
+
* view updates when modifications occur outside the normal Angular change detection flow.
|
|
1384
|
+
* @protected
|
|
1385
|
+
* @type {ChangeDetectorRef}
|
|
1386
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1387
|
+
*/
|
|
1203
1388
|
protected changeDetectorRef: ChangeDetectorRef;
|
|
1204
1389
|
/**
|
|
1205
|
-
* @description Angular Renderer2 service for
|
|
1390
|
+
* @description Angular Renderer2 service for platform-agnostic DOM manipulation.
|
|
1206
1391
|
* @summary Injected service that provides a safe, platform-agnostic way to manipulate DOM elements.
|
|
1207
1392
|
* This service ensures proper handling of DOM operations across different platforms and environments,
|
|
1208
|
-
* including server-side rendering and web workers.
|
|
1209
|
-
*
|
|
1393
|
+
* including server-side rendering and web workers, without direct DOM access.
|
|
1210
1394
|
* @protected
|
|
1211
1395
|
* @type {Renderer2}
|
|
1212
|
-
* @memberOf
|
|
1396
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1213
1397
|
*/
|
|
1214
1398
|
protected renderer: Renderer2;
|
|
1215
1399
|
/**
|
|
1216
|
-
* @description Translation service for internationalization.
|
|
1400
|
+
* @description Translation service for application internationalization.
|
|
1217
1401
|
* @summary Injected service that provides translation capabilities for UI text.
|
|
1218
|
-
* Used to translate button labels
|
|
1219
|
-
*
|
|
1402
|
+
* Used to translate button labels, validation messages, and other text content based
|
|
1403
|
+
* on the current locale setting, enabling multilingual support throughout the application.
|
|
1220
1404
|
* @protected
|
|
1221
1405
|
* @type {TranslateService}
|
|
1222
|
-
* @memberOf
|
|
1406
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1223
1407
|
*/
|
|
1224
1408
|
protected translateService: TranslateService;
|
|
1225
1409
|
/**
|
|
1226
|
-
* @description Logger instance for
|
|
1410
|
+
* @description Logger instance for structured component logging.
|
|
1227
1411
|
* @summary Provides logging capabilities for the component, allowing for consistent
|
|
1228
|
-
* and structured logging of information, warnings, and errors. This logger is
|
|
1229
|
-
*
|
|
1230
|
-
*
|
|
1412
|
+
* and structured logging of information, warnings, and errors. This logger is inherited
|
|
1413
|
+
* from the LoggedClass and provides access to structured logging functionality.
|
|
1231
1414
|
* The logger is used throughout the component to record important events, debug information,
|
|
1232
|
-
* and potential issues
|
|
1233
|
-
* of operations, and facilitating easier debugging and maintenance.
|
|
1234
|
-
*
|
|
1415
|
+
* and potential issues, facilitating easier debugging and maintenance.
|
|
1235
1416
|
* @type {Logger}
|
|
1236
|
-
* @
|
|
1237
|
-
* @memberOf NgxDecafComponentDirective
|
|
1417
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1238
1418
|
*/
|
|
1239
1419
|
logger: Logger;
|
|
1240
1420
|
/**
|
|
1241
|
-
* @description Event emitter for custom
|
|
1242
|
-
* @summary Emits custom events that occur within child components or the
|
|
1421
|
+
* @description Event emitter for custom component events.
|
|
1422
|
+
* @summary Emits custom events that occur within child components or the component itself.
|
|
1243
1423
|
* This allows parent components to listen for and respond to user interactions or
|
|
1244
|
-
* state changes
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1424
|
+
* state changes. Events are passed up the component hierarchy to enable coordinated
|
|
1425
|
+
* behavior across the application.
|
|
1247
1426
|
* @type {EventEmitter<IBaseCustomEvent>}
|
|
1248
|
-
* @memberOf NgxDecafComponentDirective
|
|
1427
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1249
1428
|
*/
|
|
1250
1429
|
listenEvent: EventEmitter<IBaseCustomEvent>;
|
|
1251
1430
|
/**
|
|
1252
|
-
* @description Angular Router instance for navigation
|
|
1253
|
-
* @summary Injected Router service used for programmatic navigation
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
* @
|
|
1431
|
+
* @description Angular Router instance for programmatic navigation.
|
|
1432
|
+
* @summary Injected Router service used for programmatic navigation between routes
|
|
1433
|
+
* in the application. This service enables navigation to different views and operations,
|
|
1434
|
+
* handles route parameters, and manages the browser's navigation history.
|
|
1435
|
+
* @protected
|
|
1257
1436
|
* @type {Router}
|
|
1258
|
-
* @memberOf NgxDecafComponentDirective
|
|
1437
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1259
1438
|
*/
|
|
1260
1439
|
protected router: Router;
|
|
1261
1440
|
/**
|
|
1262
|
-
* @description
|
|
1263
|
-
* @summary
|
|
1264
|
-
* to
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
1267
|
-
* @type {
|
|
1268
|
-
* @memberOf NgxDecafComponentDirective
|
|
1441
|
+
* @description Current locale identifier for component internationalization.
|
|
1442
|
+
* @summary Specifies the locale code (e.g., 'en-US', 'pt-BR') used for translating UI text
|
|
1443
|
+
* and formatting data according to regional conventions. This property can be set to override
|
|
1444
|
+
* the default application locale for this specific component instance, enabling per-component
|
|
1445
|
+
* localization when needed.
|
|
1446
|
+
* @type {string | undefined}
|
|
1447
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1269
1448
|
*/
|
|
1270
1449
|
locale?: string;
|
|
1271
1450
|
/**
|
|
1272
|
-
* @description Configuration for list item rendering
|
|
1451
|
+
* @description Configuration for list item rendering behavior.
|
|
1273
1452
|
* @summary Defines how list items should be rendered in the component.
|
|
1274
1453
|
* This property holds a configuration object that specifies the tag name
|
|
1275
1454
|
* and other properties needed to render list items correctly. The tag property
|
|
1276
1455
|
* identifies which component should be used to render each item in a list.
|
|
1277
1456
|
* Additional properties can be included to customize the rendering behavior.
|
|
1278
|
-
*
|
|
1279
1457
|
* @type {Record<string, unknown>}
|
|
1280
1458
|
* @default {tag: ""}
|
|
1281
|
-
* @memberOf NgxDecafComponentDirective
|
|
1459
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1282
1460
|
*/
|
|
1283
1461
|
item: Record<string, unknown>;
|
|
1284
1462
|
/**
|
|
1285
|
-
* @description Dynamic properties configuration
|
|
1463
|
+
* @description Dynamic properties configuration for runtime customization.
|
|
1286
1464
|
* @summary Contains key-value pairs of dynamic properties that can be applied to the component
|
|
1287
1465
|
* at runtime. This flexible configuration object allows for dynamic property assignment without
|
|
1288
1466
|
* requiring explicit input bindings for every possible configuration option. Properties from
|
|
1289
1467
|
* this object are parsed and applied to the component instance through the parseProps method,
|
|
1290
1468
|
* enabling customizable component behavior based on external configuration.
|
|
1291
|
-
*
|
|
1292
1469
|
* @type {Record<string, unknown>}
|
|
1293
1470
|
* @default {}
|
|
1294
|
-
* @memberOf NgxDecafComponentDirective
|
|
1471
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1295
1472
|
*/
|
|
1296
1473
|
props: Record<string, unknown>;
|
|
1297
1474
|
/**
|
|
1298
|
-
* @description Base route for navigation
|
|
1475
|
+
* @description Base route path for component navigation.
|
|
1299
1476
|
* @summary Defines the base route path used for navigation actions related to this component.
|
|
1300
|
-
* This is often used as a prefix for constructing navigation URLs
|
|
1301
|
-
*
|
|
1477
|
+
* This is often used as a prefix for constructing navigation URLs when transitioning between
|
|
1478
|
+
* different operations or views. The route helps establish the component's position in the
|
|
1479
|
+
* application's routing hierarchy.
|
|
1302
1480
|
* @type {string}
|
|
1303
|
-
* @memberOf NgxDecafComponentDirective
|
|
1481
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1304
1482
|
*/
|
|
1305
1483
|
route: string;
|
|
1306
1484
|
/**
|
|
1307
|
-
* @description
|
|
1485
|
+
* @description Initialization status flag for the component.
|
|
1308
1486
|
* @summary Tracks whether the component has completed its initialization process.
|
|
1309
1487
|
* This flag is used to prevent duplicate initialization and to determine if
|
|
1310
1488
|
* certain operations that require initialization can be performed.
|
|
1311
|
-
*
|
|
1312
1489
|
* @type {boolean}
|
|
1313
1490
|
* @default false
|
|
1314
|
-
* @memberOf NgxDecafComponentDirective
|
|
1491
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1315
1492
|
*/
|
|
1316
1493
|
initialized: boolean;
|
|
1317
|
-
constructor(componentName?: string | undefined, localeRoot?: string | undefined);
|
|
1318
|
-
get localeContext(): string;
|
|
1319
1494
|
/**
|
|
1320
|
-
* @description
|
|
1321
|
-
* @summary
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
|
|
1495
|
+
* @description Component name identifier for logging and localization contexts.
|
|
1496
|
+
* @summary Stores the component's name which is used as a key for logging contexts
|
|
1497
|
+
* and as a base for locale resolution. Can be injected via the CPTKN token or defaults
|
|
1498
|
+
* to "NgxDecafComponentDirective" if not provided.
|
|
1499
|
+
* @protected
|
|
1500
|
+
* @type {string | undefined}
|
|
1501
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1502
|
+
*/
|
|
1503
|
+
protected componentName?: string;
|
|
1504
|
+
/**
|
|
1505
|
+
* @description Root key for component locale context resolution.
|
|
1506
|
+
* @summary Defines the base key used to resolve localization contexts for this component.
|
|
1507
|
+
* If not explicitly provided, it defaults to the component's name. This key is used to
|
|
1508
|
+
* load appropriate translation resources and locale-specific configurations.
|
|
1509
|
+
* @protected
|
|
1510
|
+
* @type {string | undefined}
|
|
1511
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1512
|
+
*/
|
|
1513
|
+
protected localeRoot?: string;
|
|
1514
|
+
/**
|
|
1515
|
+
* @description Reference to CRUD operation constants for template usage.
|
|
1516
|
+
* @summary Exposes the OperationKeys enum to the component template, enabling
|
|
1517
|
+
* conditional rendering and behavior based on operation types. This protected
|
|
1518
|
+
* readonly property ensures that template logic can access operation constants
|
|
1519
|
+
* while maintaining encapsulation and preventing accidental modification.
|
|
1520
|
+
* @protected
|
|
1521
|
+
* @readonly
|
|
1522
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1523
|
+
*/
|
|
1524
|
+
protected readonly OperationKeys: typeof OperationKeys;
|
|
1525
|
+
/**
|
|
1526
|
+
* @description Angular Location service.
|
|
1527
|
+
* @summary Injected service that provides access to the browser's URL and history.
|
|
1528
|
+
* This service is used for interacting with the browser's history API, allowing
|
|
1529
|
+
* for back navigation and URL manipulation outside of Angular's router.
|
|
1328
1530
|
*
|
|
1329
|
-
* @returns {DecafRepository<Model>} The initialized repository instance.
|
|
1330
1531
|
* @private
|
|
1331
|
-
* @
|
|
1532
|
+
* @type {Location}
|
|
1533
|
+
*/
|
|
1534
|
+
protected location: Location;
|
|
1535
|
+
/**
|
|
1536
|
+
* @description Constructor for NgxDecafComponentDirective.
|
|
1537
|
+
* @summary Initializes the directive by setting up the component name, locale root,
|
|
1538
|
+
* and logger. Calls the parent LoggedClass constructor and configures localization
|
|
1539
|
+
* context. The component name and locale root can be optionally injected via the
|
|
1540
|
+
* CPTKN token, otherwise defaults are used.
|
|
1541
|
+
* @param {string} [componentName] - Optional component name for identification and logging
|
|
1542
|
+
* @param {string} [localeRoot] - Optional locale root key for internationalization
|
|
1543
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1544
|
+
*/
|
|
1545
|
+
constructor(componentName?: string, localeRoot?: string);
|
|
1546
|
+
/**
|
|
1547
|
+
* @description Getter for the current locale context identifier.
|
|
1548
|
+
* @summary Returns the current locale identifier by calling the getLocale method.
|
|
1549
|
+
* This property provides convenient access to the component's active locale setting.
|
|
1550
|
+
* @returns {string} The current locale identifier
|
|
1551
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1552
|
+
*/
|
|
1553
|
+
get localeContext(): string;
|
|
1554
|
+
/**
|
|
1555
|
+
* @description Getter for the data repository instance.
|
|
1556
|
+
* @summary Lazily initializes and returns the DecafRepository instance for the current model.
|
|
1557
|
+
* This getter ensures the repository is created only when needed and reused for subsequent
|
|
1558
|
+
* access. It also automatically sets the primary key field if not explicitly configured.
|
|
1559
|
+
* @protected
|
|
1560
|
+
* @returns {DecafRepository<Model>} The repository instance for the current model
|
|
1561
|
+
* @throws {InternalError} If repository initialization fails
|
|
1562
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1332
1563
|
*/
|
|
1333
1564
|
protected get repository(): DecafRepository<Model>;
|
|
1334
1565
|
/**
|
|
1335
|
-
* @description
|
|
1336
|
-
* @summary
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
* it
|
|
1340
|
-
*
|
|
1341
|
-
* the translation settings.
|
|
1342
|
-
*
|
|
1343
|
-
* @param {SimpleChanges} changes - Object containing changed properties
|
|
1566
|
+
* @description Angular lifecycle hook for handling input property changes.
|
|
1567
|
+
* @summary Responds to changes in component input properties, specifically monitoring changes
|
|
1568
|
+
* to the model, locale root, and component name properties. When the model changes, it triggers
|
|
1569
|
+
* model initialization and locale context updates. When locale-related properties change,
|
|
1570
|
+
* it updates the component's locale setting accordingly.
|
|
1571
|
+
* @param {SimpleChanges} changes - Object containing the changed properties with their previous and current values
|
|
1344
1572
|
* @return {void}
|
|
1573
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1345
1574
|
*/
|
|
1346
1575
|
ngOnChanges(changes: SimpleChanges): void;
|
|
1576
|
+
/**
|
|
1577
|
+
* @description Translates text phrases using the translation service.
|
|
1578
|
+
* @summary Provides a promise-based wrapper around the translation service to translate
|
|
1579
|
+
* UI text based on the current locale. Supports both single phrases and arrays of phrases,
|
|
1580
|
+
* and accepts optional parameters for template interpolation. When a string parameter is
|
|
1581
|
+
* provided, it's automatically converted to an object format for the translation service.
|
|
1582
|
+
* @protected
|
|
1583
|
+
* @param {string | string[]} phrase - The translation key or array of keys to translate
|
|
1584
|
+
* @param {object | string} [params] - Optional parameters for interpolation in translated text
|
|
1585
|
+
* @return {Promise<string>} A promise that resolves to the translated text
|
|
1586
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1587
|
+
*/
|
|
1347
1588
|
protected translate(phrase: string | string[], params?: object | string): Promise<string>;
|
|
1589
|
+
/**
|
|
1590
|
+
* @description Initializes the component asynchronously with custom logic.
|
|
1591
|
+
* @summary Abstract initialization method that can be overridden by child components to perform
|
|
1592
|
+
* custom initialization logic. By default, it simply sets the initialized flag to true.
|
|
1593
|
+
* Child components can extend this method to load data, configure settings, or perform
|
|
1594
|
+
* other setup operations required before the component is fully functional.
|
|
1595
|
+
* @protected
|
|
1596
|
+
* @param {...unknown[]} args - Variable number of arguments that can be used by child implementations
|
|
1597
|
+
* @return {Promise<void>} A promise that resolves when initialization is complete
|
|
1598
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1599
|
+
*/
|
|
1348
1600
|
protected initialize(...args: unknown[]): Promise<void>;
|
|
1601
|
+
/**
|
|
1602
|
+
* @description Retrieves or sets the locale context for the component.
|
|
1603
|
+
* @summary Gets the locale identifier from the locale context system. If a locale parameter
|
|
1604
|
+
* is provided, it updates the localeRoot property and resolves the new locale context.
|
|
1605
|
+
* If no locale is currently set, it initializes it from the localeRoot.
|
|
1606
|
+
* @protected
|
|
1607
|
+
* @param {string} [locale] - Optional locale identifier to set
|
|
1608
|
+
* @return {string} The current locale identifier
|
|
1609
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1610
|
+
*/
|
|
1349
1611
|
protected getLocale(locale?: string): string;
|
|
1350
1612
|
/**
|
|
1351
|
-
* @description
|
|
1352
|
-
* @summary
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1357
|
-
* @
|
|
1613
|
+
* @description Retrieves or generates the route path for the component.
|
|
1614
|
+
* @summary Gets the navigation route associated with this component. If no route is explicitly
|
|
1615
|
+
* set and a model is available, it automatically generates a route based on the model's
|
|
1616
|
+
* class name using the pattern `/model/{ModelName}`. Returns an empty string if neither
|
|
1617
|
+
* a route nor a model is available.
|
|
1618
|
+
* @return {string} The route path for this component
|
|
1619
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1358
1620
|
*/
|
|
1359
1621
|
getRoute(): string;
|
|
1360
1622
|
/**
|
|
1361
|
-
* @description Resolves and
|
|
1362
|
-
* @summary
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
* to
|
|
1366
|
-
*
|
|
1367
|
-
* @param {string | Model} model - The model
|
|
1623
|
+
* @description Resolves and initializes a model from various input formats.
|
|
1624
|
+
* @summary Accepts a model in multiple formats (string name, Model instance, or ModelConstructor)
|
|
1625
|
+
* and resolves it to a Model instance. When a string is provided, it looks up the model
|
|
1626
|
+
* by name in the Model registry. After resolution, it delegates to setModelDefinitions
|
|
1627
|
+
* to complete the model initialization and configuration.
|
|
1628
|
+
* @template M - The model type extending from Model
|
|
1629
|
+
* @param {string | Model | ModelConstructor<M>} model - The model to resolve and initialize
|
|
1368
1630
|
* @return {void}
|
|
1631
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1369
1632
|
*/
|
|
1370
1633
|
getModel<M extends Model>(model: string | Model | ModelConstructor<M>): void;
|
|
1371
1634
|
/**
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1635
|
+
* @description Configures component properties based on model decorators and metadata.
|
|
1636
|
+
* @summary Extracts rendering configuration from the model's decorators using the rendering
|
|
1637
|
+
* engine. This includes props, item configuration, and child component definitions. It sets
|
|
1638
|
+
* up the mapper for field transformations, configures the item renderer with appropriate
|
|
1639
|
+
* properties, and establishes the route for navigation. This method bridges the model's
|
|
1640
|
+
* decorator metadata with the component's runtime configuration.
|
|
1641
|
+
* @param {Model} model - The model instance to extract definitions from
|
|
1642
|
+
* @return {void}
|
|
1643
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1644
|
+
*/
|
|
1382
1645
|
setModelDefinitions(model: Model): void;
|
|
1383
1646
|
/**
|
|
1384
1647
|
* @description Parses and applies properties from the props object to the component instance.
|
|
@@ -1387,61 +1650,169 @@ declare abstract class NgxDecafComponentDirective extends LoggedClass implements
|
|
|
1387
1650
|
* component instance. This allows for dynamic property assignment based on configuration
|
|
1388
1651
|
* stored in the props object, enabling flexible component customization without requiring
|
|
1389
1652
|
* explicit property binding for every possible configuration option.
|
|
1390
|
-
*
|
|
1391
1653
|
* The method performs a safe property assignment by checking if each key from the instance
|
|
1392
1654
|
* exists in the props object before applying it. This prevents accidental property
|
|
1393
1655
|
* overwriting and ensures only intended properties are modified.
|
|
1394
|
-
*
|
|
1395
1656
|
* @param {KeyValue} instance - The component instance object to process
|
|
1657
|
+
* @param {string[]} [skip=[]] - Array of property names to skip during parsing
|
|
1396
1658
|
* @return {void}
|
|
1397
|
-
*
|
|
1398
1659
|
* @mermaid
|
|
1399
1660
|
* sequenceDiagram
|
|
1400
1661
|
* participant C as Component
|
|
1401
|
-
* participant
|
|
1662
|
+
* participant D as NgxDecafComponentDirective
|
|
1402
1663
|
* participant P as Props Object
|
|
1403
1664
|
*
|
|
1404
|
-
* C->>
|
|
1405
|
-
*
|
|
1665
|
+
* C->>D: parseProps(instance, skip)
|
|
1666
|
+
* D->>D: Get Object.keys(instance)
|
|
1406
1667
|
* loop For each key in instance
|
|
1407
|
-
*
|
|
1408
|
-
* alt Key
|
|
1409
|
-
*
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1668
|
+
* D->>D: Check if key in skip array
|
|
1669
|
+
* alt Key not in skip
|
|
1670
|
+
* D->>P: Check if key exists in this.props
|
|
1671
|
+
* alt Key exists in props
|
|
1672
|
+
* D->>D: Set this[key] = this.props[key]
|
|
1673
|
+
* D->>P: delete this.props[key]
|
|
1674
|
+
* else Key not in props
|
|
1675
|
+
* Note over D: Skip this key
|
|
1676
|
+
* end
|
|
1412
1677
|
* end
|
|
1413
1678
|
* end
|
|
1414
|
-
*
|
|
1415
1679
|
* @protected
|
|
1416
|
-
* @memberOf
|
|
1680
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1417
1681
|
*/
|
|
1418
1682
|
protected parseProps(instance: KeyValue, skip?: string[]): void;
|
|
1419
1683
|
/**
|
|
1420
|
-
* @description Tracks items in ngFor loops for optimal change detection.
|
|
1684
|
+
* @description Tracks items in ngFor loops for optimal change detection performance.
|
|
1421
1685
|
* @summary Provides a tracking function for Angular's *ngFor directive to optimize rendering
|
|
1422
1686
|
* performance. This method generates unique identifiers for list items based on their index
|
|
1423
1687
|
* and content, allowing Angular to efficiently track changes and minimize DOM manipulations
|
|
1424
1688
|
* during list updates. The tracking function is essential for maintaining component state
|
|
1425
1689
|
* and preventing unnecessary re-rendering of unchanged items.
|
|
1426
|
-
*
|
|
1690
|
+
* @protected
|
|
1427
1691
|
* @param {number} index - The index of the item in the list
|
|
1428
1692
|
* @param {KeyValue | string | number} item - The item data to track
|
|
1429
|
-
* @
|
|
1430
|
-
* @memberOf NgxDecafComponentDirective
|
|
1693
|
+
* @return {string | number} A unique identifier for the item
|
|
1694
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1431
1695
|
*/
|
|
1432
1696
|
protected trackItemFn(index: number, item: KeyValue | string | number): string | number;
|
|
1697
|
+
/**
|
|
1698
|
+
* @description Handles custom events from child components or DOM elements.
|
|
1699
|
+
* @summary Processes custom events by extracting event handlers and delegating to appropriate
|
|
1700
|
+
* handler classes. Supports both CustomEvent format with detail property and direct event
|
|
1701
|
+
* objects. If specific handlers are defined in the event, it instantiates the handler class
|
|
1702
|
+
* and invokes its handle method. If no handler is found or defined, the event is emitted
|
|
1703
|
+
* up the component hierarchy via the listenEvent output.
|
|
1704
|
+
* @param {IBaseCustomEvent | ICrudFormEvent | CustomEvent} event - The event to handle
|
|
1705
|
+
* @return {Promise<void>} A promise that resolves when event handling is complete
|
|
1706
|
+
* @mermaid
|
|
1707
|
+
* sequenceDiagram
|
|
1708
|
+
* participant C as Child Component
|
|
1709
|
+
* participant D as NgxDecafComponentDirective
|
|
1710
|
+
* participant H as Event Handler
|
|
1711
|
+
* participant P as Parent Component
|
|
1712
|
+
*
|
|
1713
|
+
* C->>D: handleEvent(event)
|
|
1714
|
+
* alt Event is CustomEvent
|
|
1715
|
+
* D->>D: Extract event.detail
|
|
1716
|
+
* end
|
|
1717
|
+
* D->>D: Get event name and handlers
|
|
1718
|
+
* alt Handlers defined
|
|
1719
|
+
* alt Handler exists for event
|
|
1720
|
+
* D->>H: new Handler(router)
|
|
1721
|
+
* D->>H: handle(event)
|
|
1722
|
+
* H-->>D: return result
|
|
1723
|
+
* else No handler found
|
|
1724
|
+
* D->>D: log.debug("No handler found")
|
|
1725
|
+
* end
|
|
1726
|
+
* else No handlers
|
|
1727
|
+
* D->>P: listenEvent.emit(event)
|
|
1728
|
+
* end
|
|
1729
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1730
|
+
*/
|
|
1433
1731
|
handleEvent(event: IBaseCustomEvent | ICrudFormEvent | CustomEvent): Promise<void>;
|
|
1732
|
+
/**
|
|
1733
|
+
* @description Determines if a specific operation is allowed in the current context.
|
|
1734
|
+
* @summary This method checks if an operation is included in the list of available
|
|
1735
|
+
* CRUD operations and if it's not the current operation (unless the current operation
|
|
1736
|
+
* is CREATE). This is used to enable/disable or show/hide operation buttons in the UI.
|
|
1737
|
+
* Returns false if the operations array is undefined or the operation is not in the list.
|
|
1738
|
+
* @param {string} operation - The operation to check
|
|
1739
|
+
* @return {boolean} True if the operation is allowed, false otherwise
|
|
1740
|
+
* @mermaid
|
|
1741
|
+
* sequenceDiagram
|
|
1742
|
+
* participant D as NgxDecafComponentDirective
|
|
1743
|
+
* participant U as UI
|
|
1744
|
+
*
|
|
1745
|
+
* U->>D: isAllowed(operation)
|
|
1746
|
+
* alt operations is undefined
|
|
1747
|
+
* D-->>U: Return false
|
|
1748
|
+
* else
|
|
1749
|
+
* D->>D: Check if operation is in operations
|
|
1750
|
+
* D->>D: Check if operation is not current operation
|
|
1751
|
+
* D-->>U: Return result
|
|
1752
|
+
* end
|
|
1753
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1754
|
+
*/
|
|
1755
|
+
isAllowed(operation: string): boolean;
|
|
1756
|
+
/**
|
|
1757
|
+
* @description Navigates to a different operation for the current model.
|
|
1758
|
+
* @summary This method constructs a navigation URL based on the component's base route,
|
|
1759
|
+
* the requested operation, and optionally a model ID. It then uses the Angular router
|
|
1760
|
+
* service to navigate to the constructed URL. This is typically used when switching
|
|
1761
|
+
* between different CRUD operations (create, read, update, delete) on a model.
|
|
1762
|
+
* The URL format is: {route}/{operation}/{id?}
|
|
1763
|
+
* @param {string} operation - The operation to navigate to (e.g., 'create', 'read', 'update', 'delete')
|
|
1764
|
+
* @param {string} [id] - Optional model ID to include in the navigation URL
|
|
1765
|
+
* @return {Promise<boolean>} A promise that resolves to true if navigation was successful
|
|
1766
|
+
* @mermaid
|
|
1767
|
+
* sequenceDiagram
|
|
1768
|
+
* participant U as UI
|
|
1769
|
+
* participant D as NgxDecafComponentDirective
|
|
1770
|
+
* participant R as Router
|
|
1771
|
+
*
|
|
1772
|
+
* U->>D: Click operation button
|
|
1773
|
+
* D->>D: changeOperation(operation, id)
|
|
1774
|
+
* D->>D: Construct navigation URL
|
|
1775
|
+
* Note over D: URL: {route}/{operation}/{id?}
|
|
1776
|
+
* D->>R: navigateByUrl(page)
|
|
1777
|
+
* R->>R: Navigate to new route
|
|
1778
|
+
* R-->>D: Return navigation result
|
|
1779
|
+
* D-->>U: Display new operation view
|
|
1780
|
+
* @memberOf module:lib/engine/NgxDecafComponentDirective
|
|
1781
|
+
*/
|
|
1782
|
+
changeOperation(operation: string, id?: string): Promise<boolean>;
|
|
1434
1783
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxDecafComponentDirective, never>;
|
|
1435
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxDecafComponentDirective, never, never, { "name": { "alias": "name"; "required": false; }; "childOf": { "alias": "childOf"; "required": false; }; "uid": { "alias": "uid"; "required": false; }; "model": { "alias": "model"; "required": false; }; "modelId": { "alias": "modelId"; "required": false; }; "pk": { "alias": "pk"; "required": false; }; "mapper": { "alias": "mapper"; "required": false; }; "operations": { "alias": "operations"; "required": false; }; "row": { "alias": "row"; "required": false; }; "col": { "alias": "col"; "required": false; }; "className": { "alias": "className"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "item": { "alias": "item"; "required": false; }; "props": { "alias": "props"; "required": false; }; "route": { "alias": "route"; "required": false; }; }, { "listenEvent": "listenEvent"; }, never, never, true, never>;
|
|
1784
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxDecafComponentDirective, never, never, { "name": { "alias": "name"; "required": false; }; "childOf": { "alias": "childOf"; "required": false; }; "uid": { "alias": "uid"; "required": false; }; "model": { "alias": "model"; "required": false; }; "modelId": { "alias": "modelId"; "required": false; }; "pk": { "alias": "pk"; "required": false; }; "mapper": { "alias": "mapper"; "required": false; }; "operations": { "alias": "operations"; "required": false; }; "operation": { "alias": "operation"; "required": false; }; "row": { "alias": "row"; "required": false; }; "col": { "alias": "col"; "required": false; }; "className": { "alias": "className"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "item": { "alias": "item"; "required": false; }; "props": { "alias": "props"; "required": false; }; "route": { "alias": "route"; "required": false; }; }, { "listenEvent": "listenEvent"; }, never, never, true, never>;
|
|
1436
1785
|
}
|
|
1437
1786
|
|
|
1438
1787
|
/**
|
|
1788
|
+
* @description Abstract base directive for CRUD form fields in Angular applications.
|
|
1789
|
+
* @summary Provides the foundation for all form field components in Decaf applications by implementing
|
|
1790
|
+
* Angular's ControlValueAccessor interface and FieldProperties for validation. This directive manages
|
|
1791
|
+
* form control integration, validation state, multi-entry forms (FormArrays), and CRUD operation context.
|
|
1792
|
+
* It handles form group lifecycle, error messaging, change detection, and parent-child form relationships.
|
|
1793
|
+
* Extend this class to create custom form field components that seamlessly integrate with Angular's
|
|
1794
|
+
* reactive forms and Decaf's validation system.
|
|
1439
1795
|
* @class NgxDecafFormFieldDirective
|
|
1440
|
-
* @
|
|
1796
|
+
* @extends {NgxDecafComponentDirective}
|
|
1441
1797
|
* @implements {ControlValueAccessor}
|
|
1442
|
-
* @
|
|
1443
|
-
* @
|
|
1444
|
-
*
|
|
1798
|
+
* @implements {FieldProperties}
|
|
1799
|
+
* @example
|
|
1800
|
+
* ```typescript
|
|
1801
|
+
* @Component({
|
|
1802
|
+
* selector: 'app-text-field',
|
|
1803
|
+
* templateUrl: './text-field.component.html',
|
|
1804
|
+
* providers: [{
|
|
1805
|
+
* provide: NG_VALUE_ACCESSOR,
|
|
1806
|
+
* useExisting: forwardRef(() => TextFieldComponent),
|
|
1807
|
+
* multi: true
|
|
1808
|
+
* }]
|
|
1809
|
+
* })
|
|
1810
|
+
* export class TextFieldComponent extends NgxDecafFormFieldDirective {
|
|
1811
|
+
* constructor() {
|
|
1812
|
+
* super();
|
|
1813
|
+
* }
|
|
1814
|
+
* }
|
|
1815
|
+
* ```
|
|
1445
1816
|
*/
|
|
1446
1817
|
declare abstract class NgxDecafFormFieldDirective extends NgxDecafComponentDirective implements ControlValueAccessor, FieldProperties {
|
|
1447
1818
|
/**
|
|
@@ -1449,68 +1820,197 @@ declare abstract class NgxDecafFormFieldDirective extends NgxDecafComponentDirec
|
|
|
1449
1820
|
* @summary When working with multiple form groups (form arrays), this indicates
|
|
1450
1821
|
* which form group is currently active or being edited. This is used to manage
|
|
1451
1822
|
* focus and data binding in multi-entry scenarios.
|
|
1452
|
-
*
|
|
1453
1823
|
* @type {number}
|
|
1454
1824
|
* @default 0
|
|
1455
|
-
* @
|
|
1825
|
+
* @public
|
|
1456
1826
|
*/
|
|
1457
1827
|
activeFormGroupIndex: number;
|
|
1828
|
+
operation: CrudOperations;
|
|
1458
1829
|
/**
|
|
1459
|
-
* @description
|
|
1460
|
-
* @summary
|
|
1461
|
-
*
|
|
1462
|
-
*
|
|
1463
|
-
*
|
|
1464
|
-
* @type {
|
|
1465
|
-
* @
|
|
1830
|
+
* @description Parent form container for this field.
|
|
1831
|
+
* @summary Reference to the parent FormGroup or FormArray that contains this field.
|
|
1832
|
+
* When this field is part of a multi-entry structure, this contains the FormArray
|
|
1833
|
+
* with all form groups. This enables management of multiple instances of the same
|
|
1834
|
+
* field structure within a single form.
|
|
1835
|
+
* @type {FormParent}
|
|
1836
|
+
* @public
|
|
1466
1837
|
*/
|
|
1467
1838
|
parentComponent: FormParent;
|
|
1468
1839
|
/**
|
|
1469
|
-
* @description Field mapping configuration.
|
|
1840
|
+
* @description Field mapping configuration for options.
|
|
1470
1841
|
* @summary Defines how fields from the data model should be mapped to properties used by the component.
|
|
1471
1842
|
* This allows for flexible data binding between the model and the component's display logic.
|
|
1472
|
-
*
|
|
1843
|
+
* Can be either a key-value mapping object or a function that performs the mapping.
|
|
1473
1844
|
* @type {KeyValue | FunctionLike}
|
|
1474
|
-
* @
|
|
1845
|
+
* @public
|
|
1475
1846
|
*/
|
|
1476
1847
|
optionsMapper: KeyValue | FunctionLike;
|
|
1477
1848
|
/**
|
|
1478
|
-
* @
|
|
1479
|
-
* @
|
|
1849
|
+
* @description Angular FormGroup instance for the field.
|
|
1850
|
+
* @summary The FormGroup that contains this field's FormControl. Used for managing
|
|
1851
|
+
* the field's validation state and value within the reactive forms structure.
|
|
1852
|
+
* @type {FormGroup | undefined}
|
|
1853
|
+
* @public
|
|
1480
1854
|
*/
|
|
1481
|
-
|
|
1855
|
+
formGroup: FormGroup | undefined;
|
|
1482
1856
|
/**
|
|
1483
|
-
* @
|
|
1484
|
-
* @
|
|
1857
|
+
* @description Angular FormControl instance for this field.
|
|
1858
|
+
* @summary The FormControl that manages this field's value, validation state, and user interactions.
|
|
1859
|
+
* @type {FormControl}
|
|
1860
|
+
* @public
|
|
1485
1861
|
*/
|
|
1486
|
-
formGroup: FormGroup | undefined;
|
|
1487
1862
|
formControl: FormControl;
|
|
1863
|
+
/**
|
|
1864
|
+
* @description Dot-separated path to this field in the form structure.
|
|
1865
|
+
* @summary Used to locate this field within nested form structures.
|
|
1866
|
+
* @type {string}
|
|
1867
|
+
* @public
|
|
1868
|
+
*/
|
|
1488
1869
|
path: string;
|
|
1870
|
+
/**
|
|
1871
|
+
* @description The input type of this field.
|
|
1872
|
+
* @summary Determines the HTML input type or component type to render.
|
|
1873
|
+
* @type {PossibleInputTypes}
|
|
1874
|
+
* @public
|
|
1875
|
+
*/
|
|
1489
1876
|
type: PossibleInputTypes;
|
|
1877
|
+
/**
|
|
1878
|
+
* @description Whether the field is disabled.
|
|
1879
|
+
* @summary When true, the field cannot be edited by the user.
|
|
1880
|
+
* @type {boolean}
|
|
1881
|
+
* @public
|
|
1882
|
+
*/
|
|
1490
1883
|
disabled?: boolean;
|
|
1884
|
+
/**
|
|
1885
|
+
* @description Page number for multi-page forms.
|
|
1886
|
+
* @summary Indicates which page this field belongs to in a multi-page form structure.
|
|
1887
|
+
* @type {number}
|
|
1888
|
+
* @public
|
|
1889
|
+
*/
|
|
1491
1890
|
page: number;
|
|
1891
|
+
/**
|
|
1892
|
+
* @description Date/time format string for parsing and display.
|
|
1893
|
+
* @type {string}
|
|
1894
|
+
* @public
|
|
1895
|
+
*/
|
|
1492
1896
|
format?: string;
|
|
1897
|
+
/**
|
|
1898
|
+
* @description Controls field visibility based on CRUD operations.
|
|
1899
|
+
* @summary Can be a boolean or an array of operation keys where the field should be hidden.
|
|
1900
|
+
* @type {boolean | CrudOperationKeys[]}
|
|
1901
|
+
* @public
|
|
1902
|
+
*/
|
|
1493
1903
|
hidden?: boolean | CrudOperationKeys[];
|
|
1904
|
+
/**
|
|
1905
|
+
* @description Maximum value or date allowed.
|
|
1906
|
+
* @type {number | Date}
|
|
1907
|
+
* @public
|
|
1908
|
+
*/
|
|
1494
1909
|
max?: number | Date;
|
|
1910
|
+
/**
|
|
1911
|
+
* @description Maximum length for text input.
|
|
1912
|
+
* @type {number}
|
|
1913
|
+
* @public
|
|
1914
|
+
*/
|
|
1495
1915
|
maxlength?: number;
|
|
1916
|
+
/**
|
|
1917
|
+
* @description Minimum value or date allowed.
|
|
1918
|
+
* @type {number | Date}
|
|
1919
|
+
* @public
|
|
1920
|
+
*/
|
|
1496
1921
|
min?: number | Date;
|
|
1922
|
+
/**
|
|
1923
|
+
* @description Minimum length for text input.
|
|
1924
|
+
* @type {number}
|
|
1925
|
+
* @public
|
|
1926
|
+
*/
|
|
1497
1927
|
minlength?: number;
|
|
1928
|
+
/**
|
|
1929
|
+
* @description Regex pattern for validation.
|
|
1930
|
+
* @type {string | undefined}
|
|
1931
|
+
* @public
|
|
1932
|
+
*/
|
|
1498
1933
|
pattern?: string | undefined;
|
|
1934
|
+
/**
|
|
1935
|
+
* @description Whether the field is read-only.
|
|
1936
|
+
* @type {boolean}
|
|
1937
|
+
* @public
|
|
1938
|
+
*/
|
|
1499
1939
|
readonly?: boolean;
|
|
1940
|
+
/**
|
|
1941
|
+
* @description Whether the field is required.
|
|
1942
|
+
* @type {boolean}
|
|
1943
|
+
* @public
|
|
1944
|
+
*/
|
|
1500
1945
|
required?: boolean;
|
|
1946
|
+
/**
|
|
1947
|
+
* @description Step value for numeric inputs.
|
|
1948
|
+
* @type {number}
|
|
1949
|
+
* @public
|
|
1950
|
+
*/
|
|
1501
1951
|
step?: number;
|
|
1952
|
+
/**
|
|
1953
|
+
* @description Field name that this field's value must equal.
|
|
1954
|
+
* @type {string}
|
|
1955
|
+
* @public
|
|
1956
|
+
*/
|
|
1502
1957
|
equals?: string;
|
|
1958
|
+
/**
|
|
1959
|
+
* @description Field name that this field's value must differ from.
|
|
1960
|
+
* @type {string}
|
|
1961
|
+
* @public
|
|
1962
|
+
*/
|
|
1503
1963
|
different?: string;
|
|
1964
|
+
/**
|
|
1965
|
+
* @description Field name that this field's value must be less than.
|
|
1966
|
+
* @type {string}
|
|
1967
|
+
* @public
|
|
1968
|
+
*/
|
|
1504
1969
|
lessThan?: string;
|
|
1970
|
+
/**
|
|
1971
|
+
* @description Field name that this field's value must be less than or equal to.
|
|
1972
|
+
* @type {string}
|
|
1973
|
+
* @public
|
|
1974
|
+
*/
|
|
1505
1975
|
lessThanOrEqual?: string;
|
|
1976
|
+
/**
|
|
1977
|
+
* @description Field name that this field's value must be greater than.
|
|
1978
|
+
* @type {string}
|
|
1979
|
+
* @public
|
|
1980
|
+
*/
|
|
1506
1981
|
greaterThan?: string;
|
|
1982
|
+
/**
|
|
1983
|
+
* @description Field name that this field's value must be greater than or equal to.
|
|
1984
|
+
* @type {string}
|
|
1985
|
+
* @public
|
|
1986
|
+
*/
|
|
1507
1987
|
greaterThanOrEqual?: string;
|
|
1988
|
+
/**
|
|
1989
|
+
* @description Current value of the field.
|
|
1990
|
+
* @summary Can be a string, number, date, or array of strings for multi-select fields.
|
|
1991
|
+
* @type {string | number | Date | string[]}
|
|
1992
|
+
* @public
|
|
1993
|
+
*/
|
|
1508
1994
|
value: string | number | Date | string[];
|
|
1995
|
+
/**
|
|
1996
|
+
* @description Whether the field supports multiple values.
|
|
1997
|
+
* @summary When true, the field is rendered as part of a FormArray structure.
|
|
1998
|
+
* @type {boolean}
|
|
1999
|
+
* @public
|
|
2000
|
+
*/
|
|
1509
2001
|
multiple: boolean;
|
|
2002
|
+
/**
|
|
2003
|
+
* @description Flag tracking if validation error event has been dispatched.
|
|
2004
|
+
* @summary Prevents duplicate validation error events from being dispatched.
|
|
2005
|
+
* @type {boolean}
|
|
2006
|
+
* @private
|
|
2007
|
+
*/
|
|
1510
2008
|
private validationErrorEventDispatched;
|
|
1511
2009
|
/**
|
|
1512
|
-
* @
|
|
1513
|
-
* @
|
|
2010
|
+
* @description Reference to the parent HTML element.
|
|
2011
|
+
* @summary Used for DOM manipulation and event handling.
|
|
2012
|
+
* @type {HTMLElement}
|
|
2013
|
+
* @protected
|
|
1514
2014
|
*/
|
|
1515
2015
|
protected parent?: HTMLElement;
|
|
1516
2016
|
constructor();
|
|
@@ -1519,75 +2019,131 @@ declare abstract class NgxDecafFormFieldDirective extends NgxDecafComponentDirec
|
|
|
1519
2019
|
* @summary Returns the appropriate FormGroup based on whether this field supports
|
|
1520
2020
|
* multiple values. For single-value fields, returns the main form group.
|
|
1521
2021
|
* For multi-value fields, returns the form group at the active index from the parent FormArray.
|
|
1522
|
-
*
|
|
1523
|
-
* @
|
|
1524
|
-
* @
|
|
2022
|
+
* If no formGroup is set, returns the parent of the formControl.
|
|
2023
|
+
* @return {FormGroup} The currently active FormGroup for this field
|
|
2024
|
+
* @public
|
|
1525
2025
|
*/
|
|
1526
2026
|
get activeFormGroup(): FormGroup;
|
|
1527
2027
|
/**
|
|
1528
|
-
* @
|
|
1529
|
-
* @
|
|
1530
|
-
*
|
|
2028
|
+
* @description String formatting utility function.
|
|
2029
|
+
* @summary Provides access to the sf (string format) function for formatting error messages
|
|
2030
|
+
* and other string templates. Used primarily for localizing and parameterizing validation messages.
|
|
2031
|
+
* @type {function(string, ...string): string}
|
|
2032
|
+
* @public
|
|
1531
2033
|
*/
|
|
1532
2034
|
sf: typeof _decaf_ts_decorator_validation.stringFormat;
|
|
1533
2035
|
/**
|
|
1534
|
-
* @
|
|
1535
|
-
* @
|
|
1536
|
-
*
|
|
2036
|
+
* @description Callback function invoked when the field value changes.
|
|
2037
|
+
* @summary Function registered by Angular's forms system through registerOnChange.
|
|
2038
|
+
* Called automatically when the field's value is updated to notify the form of the change.
|
|
2039
|
+
* @type {function(): unknown}
|
|
2040
|
+
* @public
|
|
1537
2041
|
*/
|
|
1538
2042
|
onChange: () => unknown;
|
|
1539
2043
|
/**
|
|
1540
|
-
* @
|
|
1541
|
-
* @
|
|
1542
|
-
*
|
|
2044
|
+
* @description Callback function invoked when the field is touched.
|
|
2045
|
+
* @summary Function registered by Angular's forms system through registerOnTouched.
|
|
2046
|
+
* Called when the field is blurred or otherwise marked as touched.
|
|
2047
|
+
* @type {function(): unknown}
|
|
2048
|
+
* @public
|
|
1543
2049
|
*/
|
|
1544
2050
|
onTouch: () => unknown;
|
|
1545
2051
|
/**
|
|
1546
|
-
* @
|
|
1547
|
-
* @
|
|
2052
|
+
* @description Writes a value to the form field.
|
|
2053
|
+
* @summary Part of Angular's ControlValueAccessor interface. Sets the field's value
|
|
2054
|
+
* when the form programmatically updates it. This is called by Angular forms when
|
|
2055
|
+
* the model value changes.
|
|
1548
2056
|
* @param {string} obj - The value to be set
|
|
2057
|
+
* @return {void}
|
|
2058
|
+
* @public
|
|
1549
2059
|
*/
|
|
1550
2060
|
writeValue(obj: string): void;
|
|
1551
2061
|
/**
|
|
1552
|
-
* @
|
|
1553
|
-
* @
|
|
2062
|
+
* @description Registers the onChange callback function.
|
|
2063
|
+
* @summary Part of Angular's ControlValueAccessor interface. Stores the function
|
|
2064
|
+
* that Angular forms provides to be called when the field value changes.
|
|
1554
2065
|
* @param {function(): unknown} fn - The function to be called on change
|
|
2066
|
+
* @return {void}
|
|
2067
|
+
* @public
|
|
1555
2068
|
*/
|
|
1556
2069
|
registerOnChange(fn: () => unknown): void;
|
|
1557
2070
|
/**
|
|
1558
|
-
* @
|
|
1559
|
-
* @
|
|
2071
|
+
* @description Registers the onTouched callback function.
|
|
2072
|
+
* @summary Part of Angular's ControlValueAccessor interface. Stores the function
|
|
2073
|
+
* that Angular forms provides to be called when the field is touched/blurred.
|
|
1560
2074
|
* @param {function(): unknown} fn - The function to be called on touch
|
|
2075
|
+
* @return {void}
|
|
2076
|
+
* @public
|
|
1561
2077
|
*/
|
|
1562
2078
|
registerOnTouched(fn: () => unknown): void;
|
|
1563
2079
|
/**
|
|
1564
|
-
* @
|
|
1565
|
-
* @
|
|
2080
|
+
* @description Sets the disabled state of the field.
|
|
2081
|
+
* @summary Part of Angular's ControlValueAccessor interface. Called by Angular forms
|
|
2082
|
+
* when the disabled state of the control changes.
|
|
1566
2083
|
* @param {boolean} isDisabled - Whether the field should be disabled
|
|
2084
|
+
* @return {void}
|
|
2085
|
+
* @public
|
|
1567
2086
|
*/
|
|
1568
2087
|
setDisabledState?(isDisabled: boolean): void;
|
|
1569
2088
|
/**
|
|
1570
|
-
* @
|
|
1571
|
-
* @
|
|
1572
|
-
*
|
|
2089
|
+
* @description Performs setup after the view has been initialized.
|
|
2090
|
+
* @summary Retrieves and returns the parent HTML element based on the current CRUD operation.
|
|
2091
|
+
* For READ and DELETE operations, returns the immediate parent element. For CREATE and UPDATE
|
|
2092
|
+
* operations, finds the parent div element and registers it with the form service.
|
|
2093
|
+
* @return {HTMLElement} The parent element of the field
|
|
2094
|
+
* @throws {RenderingError} If unable to retrieve parent form element for CREATE/UPDATE operations
|
|
2095
|
+
* @throws {InternalError} If the operation is invalid
|
|
2096
|
+
* @public
|
|
1573
2097
|
*/
|
|
1574
2098
|
afterViewInit(): HTMLElement;
|
|
2099
|
+
/**
|
|
2100
|
+
* @description Angular lifecycle hook for detecting input property changes.
|
|
2101
|
+
* @summary Overrides the parent ngOnChanges to handle changes to activeFormGroupIndex and value.
|
|
2102
|
+
* When activeFormGroupIndex changes in a multiple field scenario, updates the active form group
|
|
2103
|
+
* and form control. When value changes, updates the form control value. Delegates to parent
|
|
2104
|
+
* implementation for initial change detection.
|
|
2105
|
+
* @param {SimpleChanges} changes - Object containing the changed properties
|
|
2106
|
+
* @return {void}
|
|
2107
|
+
* @public
|
|
2108
|
+
*/
|
|
1575
2109
|
ngOnChanges(changes: SimpleChanges): void;
|
|
2110
|
+
/**
|
|
2111
|
+
* @description Cleanup logic when the component is destroyed.
|
|
2112
|
+
* @summary Unregisters the form group from the form service to prevent memory leaks
|
|
2113
|
+
* and clean up form references.
|
|
2114
|
+
* @return {void}
|
|
2115
|
+
* @public
|
|
2116
|
+
*/
|
|
1576
2117
|
onDestroy(): void;
|
|
2118
|
+
/**
|
|
2119
|
+
* @description Sets the value of the form control.
|
|
2120
|
+
* @summary Updates the form control's value and triggers validation. This is used
|
|
2121
|
+
* when the value needs to be programmatically updated from outside the form control.
|
|
2122
|
+
* @param {unknown} value - The value to set
|
|
2123
|
+
* @return {void}
|
|
2124
|
+
* @public
|
|
2125
|
+
*/
|
|
1577
2126
|
setValue(value: unknown): void;
|
|
2127
|
+
/**
|
|
2128
|
+
* @description Retrieves validation error messages for the field.
|
|
2129
|
+
* @summary Checks the form control for validation errors and returns formatted error messages.
|
|
2130
|
+
* If errors exist, dispatches a validation error event to parent accordion components.
|
|
2131
|
+
* Error messages are translated and formatted with relevant field properties.
|
|
2132
|
+
* @param {HTMLElement} parent - The parent HTML element used to find accordion components
|
|
2133
|
+
* @return {string | void} Formatted error message string, or void if no errors
|
|
2134
|
+
* @public
|
|
2135
|
+
*/
|
|
1578
2136
|
getErrors(parent: HTMLElement): string | void;
|
|
1579
2137
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxDecafFormFieldDirective, never>;
|
|
1580
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxDecafFormFieldDirective, never, never, { "activeFormGroupIndex": { "alias": "activeFormGroupIndex"; "required": false; }; "parentComponent": { "alias": "parentComponent"; "required": false; }; "optionsMapper": { "alias": "optionsMapper"; "required": false; }; }, {}, never, never, true, never>;
|
|
2138
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxDecafFormFieldDirective, never, never, { "activeFormGroupIndex": { "alias": "activeFormGroupIndex"; "required": false; }; "operation": { "alias": "operation"; "required": true; }; "parentComponent": { "alias": "parentComponent"; "required": false; }; "optionsMapper": { "alias": "optionsMapper"; "required": false; }; }, {}, never, never, true, never>;
|
|
1581
2139
|
}
|
|
1582
2140
|
|
|
1583
2141
|
/**
|
|
1584
|
-
* @module
|
|
2142
|
+
* @module lib/engine/NgxDecafFormService
|
|
1585
2143
|
* @description Utilities to create and manage Angular forms in Decaf components.
|
|
1586
2144
|
* @summary The NgxDecafFormService exposes helpers to build FormGroup/FormArray instances
|
|
1587
2145
|
* from component metadata or UI model definitions, register forms in a registry,
|
|
1588
2146
|
* validate and extract form data, and create controls with appropriate validators.
|
|
1589
|
-
*
|
|
1590
|
-
* @link {@link NgxDecafFormService}
|
|
1591
2147
|
*/
|
|
1592
2148
|
|
|
1593
2149
|
/**
|
|
@@ -1611,7 +2167,6 @@ declare abstract class NgxDecafFormFieldDirective extends NgxDecafComponentDirec
|
|
|
1611
2167
|
*
|
|
1612
2168
|
* // Getting form data
|
|
1613
2169
|
* const formData = NgxDecafFormService.getFormData(form);
|
|
1614
|
-
*
|
|
1615
2170
|
* @mermaid
|
|
1616
2171
|
* sequenceDiagram
|
|
1617
2172
|
* participant C as Component
|
|
@@ -1633,46 +2188,42 @@ declare class NgxDecafFormService {
|
|
|
1633
2188
|
* @description WeakMap that stores control properties for form controls.
|
|
1634
2189
|
* @summary A WeakMap that associates AbstractControl instances with their corresponding FieldProperties.
|
|
1635
2190
|
* This allows the service to track metadata for form controls without creating memory leaks.
|
|
1636
|
-
*
|
|
1637
2191
|
* @type {WeakMap<AbstractControl, FieldProperties>}
|
|
1638
2192
|
* @private
|
|
1639
2193
|
* @static
|
|
1640
|
-
* @memberOf NgxDecafFormService
|
|
1641
2194
|
*/
|
|
1642
2195
|
private static controls;
|
|
1643
2196
|
/**
|
|
1644
2197
|
* @description Registry of form groups indexed by their unique identifiers.
|
|
1645
2198
|
* @summary A Map that stores FormGroup instances with their unique string identifiers.
|
|
1646
2199
|
* This allows global access to registered forms throughout the application.
|
|
1647
|
-
*
|
|
1648
2200
|
* @type {Map<string, FormGroup>}
|
|
1649
2201
|
* @private
|
|
1650
2202
|
* @static
|
|
1651
|
-
* @memberOf NgxDecafFormService
|
|
1652
2203
|
*/
|
|
1653
2204
|
private static formRegistry;
|
|
1654
2205
|
/**
|
|
1655
2206
|
* @description Creates a new form group or form array with the specified identifier.
|
|
1656
|
-
* @summary Generates a FormGroup or FormArray based on the provided
|
|
1657
|
-
*
|
|
1658
|
-
*
|
|
1659
|
-
*
|
|
2207
|
+
* @summary Generates a FormGroup or FormArray based on the provided parameters. If formArray is true,
|
|
2208
|
+
* creates a FormArray; otherwise creates a FormGroup. The form can optionally be registered in the
|
|
2209
|
+
* global form registry for later access throughout the application. If a form with the given id
|
|
2210
|
+
* already exists in the registry, it returns the existing form.
|
|
1660
2211
|
* @param {string} id - Unique identifier for the form
|
|
1661
|
-
* @param {
|
|
2212
|
+
* @param {boolean} [formArray=false] - Whether to create a FormArray instead of a FormGroup
|
|
1662
2213
|
* @param {boolean} [registry=true] - Whether to register the form in the global registry
|
|
1663
|
-
* @return {FormGroup | FormArray} The created form instance
|
|
1664
|
-
*
|
|
2214
|
+
* @return {FormGroup | FormArray} The created or existing form instance
|
|
1665
2215
|
* @mermaid
|
|
1666
2216
|
* sequenceDiagram
|
|
1667
2217
|
* participant C as Component
|
|
1668
2218
|
* participant NFS as NgxDecafFormService
|
|
1669
2219
|
* participant FR as Form Registry
|
|
1670
2220
|
* participant AF as Angular Forms
|
|
1671
|
-
*
|
|
1672
|
-
* C->>NFS: createForm(id, props, registry)
|
|
2221
|
+
* C->>NFS: createForm(id, formArray, registry)
|
|
1673
2222
|
* NFS->>FR: Check if form exists
|
|
1674
|
-
* alt Form
|
|
1675
|
-
*
|
|
2223
|
+
* alt Form exists
|
|
2224
|
+
* FR-->>NFS: Return existing form
|
|
2225
|
+
* else Form doesn't exist
|
|
2226
|
+
* alt formArray is true
|
|
1676
2227
|
* NFS->>AF: new FormArray([])
|
|
1677
2228
|
* else
|
|
1678
2229
|
* NFS->>AF: new FormGroup({})
|
|
@@ -1682,9 +2233,7 @@ declare class NgxDecafFormService {
|
|
|
1682
2233
|
* end
|
|
1683
2234
|
* end
|
|
1684
2235
|
* NFS-->>C: Return FormGroup | FormArray
|
|
1685
|
-
*
|
|
1686
2236
|
* @static
|
|
1687
|
-
* @memberOf NgxDecafFormService
|
|
1688
2237
|
*/
|
|
1689
2238
|
static createForm(id: string, formArray?: boolean, registry?: boolean): FormGroup | FormArray;
|
|
1690
2239
|
/**
|
|
@@ -1692,28 +2241,31 @@ declare class NgxDecafFormService {
|
|
|
1692
2241
|
* @summary Registers a FormGroup or FormArray with a unique identifier for global access throughout
|
|
1693
2242
|
* the application. This allows forms to be retrieved and managed centrally. Throws an error if
|
|
1694
2243
|
* the identifier is already in use to prevent conflicts.
|
|
1695
|
-
*
|
|
1696
2244
|
* @param {string} formId - The unique identifier for the form
|
|
1697
2245
|
* @param {FormParent} formGroup - The FormGroup or FormArray to be registered
|
|
1698
2246
|
* @return {void}
|
|
1699
2247
|
* @throws {Error} If a FormGroup with the given id is already registered
|
|
1700
|
-
*
|
|
1701
2248
|
* @static
|
|
1702
|
-
* @memberOf NgxDecafFormService
|
|
1703
2249
|
*/
|
|
1704
2250
|
static addRegistry(formId: string, formGroup: FormParent): void;
|
|
2251
|
+
/**
|
|
2252
|
+
* @description Retrieves a form from the registry by its identifier.
|
|
2253
|
+
* @summary Gets a FormGroup or FormArray from the registry using its unique identifier.
|
|
2254
|
+
* Returns undefined if the form is not found in the registry. This method provides
|
|
2255
|
+
* safe access to registered forms without throwing errors.
|
|
2256
|
+
* @param {string} [id] - The unique identifier of the form to retrieve
|
|
2257
|
+
* @return {FormParent | undefined} The FormGroup or FormArray if found, undefined otherwise
|
|
2258
|
+
* @static
|
|
2259
|
+
*/
|
|
1705
2260
|
static getOnRegistry(id?: string): FormParent | undefined;
|
|
1706
2261
|
/**
|
|
1707
2262
|
* @description Removes a form from the registry.
|
|
1708
2263
|
* @summary Deletes a FormGroup or FormArray from the registry using its unique identifier.
|
|
1709
2264
|
* This cleans up the registry and allows the identifier to be reused. The form itself
|
|
1710
2265
|
* is not destroyed, only removed from the central registry.
|
|
1711
|
-
*
|
|
1712
2266
|
* @param {string} formId - The unique identifier of the form to be removed
|
|
1713
2267
|
* @return {void}
|
|
1714
|
-
*
|
|
1715
2268
|
* @static
|
|
1716
|
-
* @memberOf NgxDecafFormService
|
|
1717
2269
|
*/
|
|
1718
2270
|
static removeRegistry(formId: string): void;
|
|
1719
2271
|
/**
|
|
@@ -1721,20 +2273,17 @@ declare class NgxDecafFormService {
|
|
|
1721
2273
|
* @summary Traverses the form group structure to find the parent group and control name for a given path.
|
|
1722
2274
|
* Handles complex nested structures including arrays and sub-groups. Creates missing intermediate
|
|
1723
2275
|
* groups as needed and properly configures FormArray controls for multiple value scenarios.
|
|
1724
|
-
*
|
|
1725
2276
|
* @param {FormGroup} formGroup - The root FormGroup to traverse
|
|
1726
2277
|
* @param {string} path - The dot-separated path to the control (e.g., 'user.address.street')
|
|
1727
2278
|
* @param {IComponentInput} componentProps - Properties defining the component configuration
|
|
1728
2279
|
* @param {KeyValue} parentProps - Properties from the parent component for context
|
|
1729
2280
|
* @return {FormParentGroup} A tuple containing the parent FormGroup and the control name
|
|
1730
|
-
*
|
|
1731
2281
|
* @private
|
|
1732
2282
|
* @mermaid
|
|
1733
2283
|
* sequenceDiagram
|
|
1734
2284
|
* participant NFS as NgxDecafFormService
|
|
1735
2285
|
* participant FG as FormGroup
|
|
1736
2286
|
* participant FA as FormArray
|
|
1737
|
-
*
|
|
1738
2287
|
* NFS->>NFS: Split path into parts
|
|
1739
2288
|
* loop For each path part
|
|
1740
2289
|
* alt Control doesn't exist
|
|
@@ -1748,95 +2297,90 @@ declare class NgxDecafFormService {
|
|
|
1748
2297
|
* NFS->>NFS: Navigate to next level
|
|
1749
2298
|
* end
|
|
1750
2299
|
* NFS-->>NFS: Return [parentGroup, controlName]
|
|
1751
|
-
*
|
|
1752
2300
|
* @static
|
|
1753
|
-
* @memberOf NgxDecafFormService
|
|
1754
2301
|
*/
|
|
1755
2302
|
private static resolveParentGroup;
|
|
1756
2303
|
/**
|
|
1757
2304
|
* @description Retrieves component properties from a FormGroup or FormArray.
|
|
1758
2305
|
* @summary Extracts component properties stored in the form group metadata. If a FormGroup is provided
|
|
1759
2306
|
* and groupArrayName is specified, it will look for the FormArray within the form structure.
|
|
1760
|
-
*
|
|
1761
2307
|
* @param {FormGroup | FormArray} formGroup - The form group or form array to extract properties from
|
|
1762
2308
|
* @param {string} [key] - Optional key to retrieve a specific property
|
|
1763
2309
|
* @param {string} [groupArrayName] - Optional name of the group array if formGroup is not a FormArray
|
|
1764
2310
|
* @return {Partial<FieldProperties>} The component properties or a specific property if key is provided
|
|
1765
|
-
*
|
|
1766
2311
|
* @static
|
|
1767
|
-
* @memberOf NgxDecafFormService
|
|
1768
2312
|
*/
|
|
1769
2313
|
static getComponentPropsFromGroupArray(formGroup: FormGroup | FormArray, key?: string, groupArrayName?: string | undefined): Partial<FieldProperties>;
|
|
1770
2314
|
/**
|
|
1771
2315
|
* @description Adds a new group to a parent FormArray.
|
|
1772
2316
|
* @summary Creates and adds a new FormGroup to the specified parent FormArray based on the
|
|
1773
2317
|
* component properties stored in the parent's metadata. This is used for dynamic form arrays
|
|
1774
|
-
* where new groups need to be added at runtime.
|
|
1775
|
-
*
|
|
1776
|
-
* @param {FormParent} parentForm - The
|
|
1777
|
-
* @param {number} index - The index position
|
|
1778
|
-
* @return {
|
|
1779
|
-
*
|
|
2318
|
+
* where new groups need to be added at runtime. Clones the control at the specified index
|
|
2319
|
+
* to maintain the same structure and validators.
|
|
2320
|
+
* @param {FormParent} parentForm - The FormArray or FormGroup containing the parent FormArray
|
|
2321
|
+
* @param {number} [index] - The index position to clone from; defaults to last index if length > 0, otherwise 0
|
|
2322
|
+
* @return {FormArray} The parent FormArray after adding the new group
|
|
1780
2323
|
* @static
|
|
1781
|
-
* @memberOf NgxDecafFormService
|
|
1782
2324
|
*/
|
|
1783
2325
|
static addGroupToParent(parentForm: FormParent, index?: number): FormArray;
|
|
1784
2326
|
/**
|
|
1785
2327
|
* @description Retrieves a FormGroup from a parent FormArray at the specified index.
|
|
1786
2328
|
* @summary Gets a FormGroup from the specified parent FormArray. If the group doesn't exist
|
|
1787
2329
|
* at the given index, it will create a new one using addGroupToParent.
|
|
1788
|
-
*
|
|
1789
|
-
* @param {FormGroup} formGroup - The root form group containing the parent FormArray
|
|
2330
|
+
* @param {FormParent} formGroup - The root form group containing the parent FormArray
|
|
1790
2331
|
* @param {string} parentName - The name of the parent FormArray to retrieve the group from
|
|
1791
2332
|
* @param {number} [index=1] - The index of the group to retrieve
|
|
1792
2333
|
* @return {FormGroup} The FormGroup at the specified index
|
|
1793
|
-
*
|
|
1794
2334
|
* @static
|
|
1795
|
-
* @memberOf NgxDecafFormService
|
|
1796
2335
|
*/
|
|
1797
2336
|
static getGroupFromParent(formGroup: FormParent, parentName: string, index?: number): FormGroup;
|
|
2337
|
+
/**
|
|
2338
|
+
* @description Clones a form control with its validators.
|
|
2339
|
+
* @summary Creates a deep copy of a FormControl, FormGroup, or FormArray, preserving
|
|
2340
|
+
* validators but resetting values and state. This is useful for creating new instances
|
|
2341
|
+
* of form controls with the same validation rules, particularly in dynamic FormArrays
|
|
2342
|
+
* where new groups need to be added with identical structure.
|
|
2343
|
+
* @param {AbstractControl} control - The control to clone (FormControl, FormGroup, or FormArray)
|
|
2344
|
+
* @return {AbstractControl} A new instance of the control with the same validators
|
|
2345
|
+
* @throws {Error} If the control type is not supported
|
|
2346
|
+
* @static
|
|
2347
|
+
*/
|
|
1798
2348
|
static cloneFormControl(control: AbstractControl): AbstractControl;
|
|
1799
2349
|
/**
|
|
1800
2350
|
* @description Checks if a value is unique within a FormArray group.
|
|
1801
2351
|
* @summary Validates that the primary key value in a FormGroup is unique among all groups
|
|
1802
2352
|
* in the parent FormArray. The uniqueness check behavior differs based on the operation type.
|
|
1803
|
-
*
|
|
2353
|
+
* For both CREATE and UPDATE operations, it checks that no other group in the array has the same
|
|
2354
|
+
* primary key value.
|
|
1804
2355
|
* @param {FormGroup} formGroup - The FormGroup to check for uniqueness
|
|
1805
|
-
* @param {number} index - The index of the current group within the FormArray
|
|
1806
2356
|
* @param {OperationKeys} [operation=OperationKeys.CREATE] - The type of operation being performed
|
|
2357
|
+
* @param {number} [index] - The index of the current group within the FormArray
|
|
1807
2358
|
* @return {boolean} True if the value is unique, false otherwise
|
|
1808
|
-
*
|
|
1809
2359
|
* @static
|
|
1810
|
-
* @memberOf NgxDecafFormService
|
|
1811
2360
|
*/
|
|
1812
2361
|
static isUniqueOnGroup(formGroup: FormGroup, operation?: OperationKeys, index?: number): boolean;
|
|
1813
2362
|
/**
|
|
1814
2363
|
* @description Enables all controls within a FormGroup or FormArray.
|
|
1815
2364
|
* @summary Recursively enables all form controls within the provided FormGroup or FormArray.
|
|
1816
2365
|
* This is useful for making all controls interactive after they have been disabled.
|
|
1817
|
-
*
|
|
1818
2366
|
* @param {FormArray | FormGroup} formGroup - The FormGroup or FormArray to enable all controls for
|
|
1819
2367
|
* @return {void}
|
|
1820
|
-
*
|
|
1821
2368
|
* @static
|
|
1822
|
-
* @memberOf NgxDecafFormService
|
|
1823
2369
|
*/
|
|
1824
2370
|
static enableAllGroupControls(formGroup: FormArray | FormGroup): void;
|
|
1825
2371
|
/**
|
|
1826
2372
|
* @description Adds a form control to a form group based on component properties.
|
|
1827
2373
|
* @summary Creates and configures a FormControl within the specified FormGroup using the provided
|
|
1828
2374
|
* component properties. Handles nested paths, multiple controls (FormArrays), and control registration.
|
|
1829
|
-
* This method supports complex form structures with nested groups and arrays.
|
|
1830
|
-
*
|
|
1831
|
-
* @param {
|
|
2375
|
+
* This method supports complex form structures with nested groups and arrays. It also manages
|
|
2376
|
+
* page-based forms and FormArray indexing.
|
|
2377
|
+
* @param {FormParent} formGroup - The form group or form array to add the control to
|
|
1832
2378
|
* @param {IComponentInput} componentProps - The component properties defining the control configuration
|
|
1833
|
-
* @param {
|
|
2379
|
+
* @param {Partial<IComponentInput>} [parentProps={}] - Properties from the parent component for context
|
|
1834
2380
|
* @param {number} [index=0] - The index for multiple controls in FormArrays
|
|
1835
|
-
* @return {
|
|
1836
|
-
*
|
|
2381
|
+
* @return {FormParent} The updated form parent (FormGroup or FormArray)
|
|
1837
2382
|
* @private
|
|
1838
2383
|
* @static
|
|
1839
|
-
* @memberOf NgxDecafFormService
|
|
1840
2384
|
*/
|
|
1841
2385
|
private static addFormControl;
|
|
1842
2386
|
/**
|
|
@@ -1844,18 +2388,15 @@ declare class NgxDecafFormService {
|
|
|
1844
2388
|
* @summary Finds and returns an AbstractControl from a registered form using the form id and optional path.
|
|
1845
2389
|
* This method provides centralized access to form controls across the application by leveraging
|
|
1846
2390
|
* the form registry system.
|
|
1847
|
-
*
|
|
1848
2391
|
* @param {string} formId - The unique identifier of the form in the registry
|
|
1849
2392
|
* @param {string} [path] - The optional dot-separated path to a specific control within the form
|
|
1850
2393
|
* @return {AbstractControl} The requested AbstractControl (FormGroup, FormArray, or FormControl)
|
|
1851
2394
|
* @throws {Error} If the form is not found in the registry or the control is not found in the form
|
|
1852
|
-
*
|
|
1853
2395
|
* @mermaid
|
|
1854
2396
|
* sequenceDiagram
|
|
1855
2397
|
* participant C as Component
|
|
1856
2398
|
* participant NFS as NgxDecafFormService
|
|
1857
2399
|
* participant FR as Form Registry
|
|
1858
|
-
*
|
|
1859
2400
|
* C->>NFS: getControlFromForm(formId, path?)
|
|
1860
2401
|
* NFS->>FR: Get form by formId
|
|
1861
2402
|
* alt Form not found
|
|
@@ -1874,9 +2415,7 @@ declare class NgxDecafFormService {
|
|
|
1874
2415
|
* NFS-->>C: Return form
|
|
1875
2416
|
* end
|
|
1876
2417
|
* end
|
|
1877
|
-
*
|
|
1878
2418
|
* @static
|
|
1879
|
-
* @memberOf NgxDecafFormService
|
|
1880
2419
|
*/
|
|
1881
2420
|
static getControlFromForm(formId: string, path?: string): AbstractControl;
|
|
1882
2421
|
/**
|
|
@@ -1884,18 +2423,15 @@ declare class NgxDecafFormService {
|
|
|
1884
2423
|
* @summary Generates a FormGroup from an array of UIModelMetadata objects, extracting component
|
|
1885
2424
|
* properties and creating appropriate form controls. This method is specifically designed to work
|
|
1886
2425
|
* with the UI decorator system and provides automatic form generation from metadata.
|
|
1887
|
-
*
|
|
1888
2426
|
* @param {string} id - Unique identifier for the form
|
|
1889
2427
|
* @param {boolean} [registry=false] - Whether to register the created form in the global registry
|
|
1890
2428
|
* @param {UIModelMetadata[]} [children] - Array of UI model metadata objects to create controls from
|
|
1891
2429
|
* @return {FormGroup} The created FormGroup with controls for each child metadata
|
|
1892
|
-
*
|
|
1893
2430
|
* @mermaid
|
|
1894
2431
|
* sequenceDiagram
|
|
1895
2432
|
* participant C as Component
|
|
1896
2433
|
* participant NFS as NgxDecafFormService
|
|
1897
2434
|
* participant AF as Angular Forms
|
|
1898
|
-
*
|
|
1899
2435
|
* C->>NFS: createFormFromChildren(id, registry, children)
|
|
1900
2436
|
* NFS->>AF: new FormGroup({})
|
|
1901
2437
|
* loop For each child metadata
|
|
@@ -1906,9 +2442,7 @@ declare class NgxDecafFormService {
|
|
|
1906
2442
|
* NFS->>NFS: addRegistry(id, form)
|
|
1907
2443
|
* end
|
|
1908
2444
|
* NFS-->>C: Return FormGroup
|
|
1909
|
-
*
|
|
1910
2445
|
* @static
|
|
1911
|
-
* @memberOf NgxDecafFormService
|
|
1912
2446
|
*/
|
|
1913
2447
|
static createFormFromChildren(id: string, registry?: boolean, children?: UIModelMetadata[]): FormGroup;
|
|
1914
2448
|
/**
|
|
@@ -1916,18 +2450,15 @@ declare class NgxDecafFormService {
|
|
|
1916
2450
|
* @summary Generates a FormGroup based on an array of component configurations and optionally registers it.
|
|
1917
2451
|
* This method processes component input configurations to create appropriate form controls with
|
|
1918
2452
|
* validation and initial values.
|
|
1919
|
-
*
|
|
1920
2453
|
* @param {string} id - The unique identifier for the form
|
|
1921
2454
|
* @param {IComponentConfig[]} components - An array of component configurations defining the form structure
|
|
1922
2455
|
* @param {boolean} [registry=false] - Whether to register the created form in the global registry
|
|
1923
2456
|
* @return {FormGroup} The created FormGroup with controls for each component configuration
|
|
1924
|
-
*
|
|
1925
2457
|
* @mermaid
|
|
1926
2458
|
* sequenceDiagram
|
|
1927
2459
|
* participant C as Component
|
|
1928
2460
|
* participant NFS as NgxDecafFormService
|
|
1929
2461
|
* participant AF as Angular Forms
|
|
1930
|
-
*
|
|
1931
2462
|
* C->>NFS: createFormFromComponents(id, components, registry)
|
|
1932
2463
|
* NFS->>AF: new FormGroup({})
|
|
1933
2464
|
* loop For each component config
|
|
@@ -1938,42 +2469,39 @@ declare class NgxDecafFormService {
|
|
|
1938
2469
|
* NFS->>NFS: addRegistry(id, form)
|
|
1939
2470
|
* end
|
|
1940
2471
|
* NFS-->>C: Return FormGroup
|
|
1941
|
-
*
|
|
1942
2472
|
* @static
|
|
1943
|
-
* @memberOf NgxDecafFormService
|
|
1944
2473
|
*/
|
|
1945
2474
|
static createFormFromComponents(id: string, components: IComponentConfig[], registry?: boolean): FormGroup;
|
|
1946
2475
|
/**
|
|
1947
2476
|
* @description Adds a control to a form based on component properties.
|
|
1948
2477
|
* @summary Creates and adds a form control to a form (existing or new) based on the provided component properties.
|
|
1949
2478
|
* Handles multi-page forms by managing FormArray structures and proper indexing. This method supports
|
|
1950
|
-
* complex form scenarios including nested controls and page-based form organization.
|
|
1951
|
-
*
|
|
2479
|
+
* complex form scenarios including nested controls and page-based form organization. It automatically
|
|
2480
|
+
* creates FormArrays for forms with multiple pages and manages page indexing.
|
|
1952
2481
|
* @param {string} id - The unique identifier of the form
|
|
1953
2482
|
* @param {FieldProperties} componentProperties - The properties of the component to create the control from
|
|
1954
2483
|
* @param {FieldProperties} [parentProps] - Optional parent properties for context and configuration
|
|
1955
|
-
* @return {
|
|
1956
|
-
*
|
|
2484
|
+
* @return {FormParent} The form or created control (FormGroup or FormArray)
|
|
2485
|
+
* @throws {Error} If page property is required but not provided or is invalid
|
|
1957
2486
|
* @mermaid
|
|
1958
2487
|
* sequenceDiagram
|
|
1959
2488
|
* participant C as Component
|
|
1960
2489
|
* participant NFS as NgxDecafFormService
|
|
1961
2490
|
* participant F as Form
|
|
1962
|
-
*
|
|
1963
2491
|
* C->>NFS: addControlFromProps(id, componentProps, parentProps?)
|
|
1964
|
-
* NFS->>NFS: createForm(id,
|
|
1965
|
-
* alt Multi-page form (parentProps.pages >
|
|
2492
|
+
* NFS->>NFS: createForm(id, formArray, true)
|
|
2493
|
+
* alt Multi-page form (parentProps.pages > 0)
|
|
1966
2494
|
* NFS->>NFS: Calculate page index
|
|
1967
|
-
*
|
|
2495
|
+
* alt Group doesn't exist at index
|
|
2496
|
+
* NFS->>F: Create new FormGroup at index
|
|
2497
|
+
* end
|
|
1968
2498
|
* NFS->>NFS: Set form to page FormGroup
|
|
1969
2499
|
* end
|
|
1970
2500
|
* alt componentProperties has path
|
|
1971
2501
|
* NFS->>NFS: addFormControl(form, componentProperties, parentProps)
|
|
1972
2502
|
* end
|
|
1973
2503
|
* NFS-->>C: Return form/control
|
|
1974
|
-
*
|
|
1975
2504
|
* @static
|
|
1976
|
-
* @memberOf NgxDecafFormService
|
|
1977
2505
|
*/
|
|
1978
2506
|
static addControlFromProps(id: string, componentProperties: FieldProperties, parentProps?: FieldProperties): FormParent;
|
|
1979
2507
|
/**
|
|
@@ -1981,17 +2509,14 @@ declare class NgxDecafFormService {
|
|
|
1981
2509
|
* @summary Extracts and processes the data from a FormGroup, handling different input types and nested form groups.
|
|
1982
2510
|
* Performs type conversion for various HTML5 input types, validates nested controls, and manages
|
|
1983
2511
|
* multiple control scenarios. Automatically enables all group controls after data extraction.
|
|
1984
|
-
*
|
|
1985
2512
|
* @param {FormGroup} formGroup - The FormGroup to extract data from
|
|
1986
2513
|
* @return {Record<string, unknown>} An object containing the processed form data with proper type conversions
|
|
1987
|
-
*
|
|
1988
2514
|
* @mermaid
|
|
1989
2515
|
* sequenceDiagram
|
|
1990
2516
|
* participant C as Component
|
|
1991
2517
|
* participant NFS as NgxDecafFormService
|
|
1992
2518
|
* participant FG as FormGroup
|
|
1993
2519
|
* participant FC as FormControl
|
|
1994
|
-
*
|
|
1995
2520
|
* C->>NFS: getFormData(formGroup)
|
|
1996
2521
|
* loop For each control in formGroup
|
|
1997
2522
|
* alt Control is not FormControl
|
|
@@ -2015,9 +2540,7 @@ declare class NgxDecafFormService {
|
|
|
2015
2540
|
* end
|
|
2016
2541
|
* NFS->>NFS: enableAllGroupControls(formGroup)
|
|
2017
2542
|
* NFS-->>C: Return processed data object
|
|
2018
|
-
*
|
|
2019
2543
|
* @static
|
|
2020
|
-
* @memberOf NgxDecafFormService
|
|
2021
2544
|
*/
|
|
2022
2545
|
static getFormData(formGroup: FormGroup): Record<string, unknown>;
|
|
2023
2546
|
/**
|
|
@@ -2025,13 +2548,11 @@ declare class NgxDecafFormService {
|
|
|
2025
2548
|
* @summary Recursively validates all fields in a form control or form group, marking them as touched and dirty.
|
|
2026
2549
|
* Performs comprehensive validation including uniqueness checks for primary keys in FormArray scenarios.
|
|
2027
2550
|
* This method ensures all validation rules are applied and form state is properly updated.
|
|
2028
|
-
*
|
|
2029
2551
|
* @param {AbstractControl} control - The control or form group to validate
|
|
2030
2552
|
* @param {string} [pk] - Optional primary key field name for uniqueness validation
|
|
2031
2553
|
* @param {string} [path] - The path to the control within the form for error reporting
|
|
2032
2554
|
* @return {boolean} True if all fields are valid, false otherwise
|
|
2033
2555
|
* @throws {Error} If no control is found at the specified path or if the control type is unknown
|
|
2034
|
-
*
|
|
2035
2556
|
* @mermaid
|
|
2036
2557
|
* sequenceDiagram
|
|
2037
2558
|
* participant C as Component
|
|
@@ -2039,7 +2560,6 @@ declare class NgxDecafFormService {
|
|
|
2039
2560
|
* participant FC as FormControl
|
|
2040
2561
|
* participant FG as FormGroup
|
|
2041
2562
|
* participant FA as FormArray
|
|
2042
|
-
*
|
|
2043
2563
|
* C->>NFS: validateFields(control, pk?, path?)
|
|
2044
2564
|
* alt Control is FormControl
|
|
2045
2565
|
* NFS->>FC: markAsTouched()
|
|
@@ -2065,16 +2585,18 @@ declare class NgxDecafFormService {
|
|
|
2065
2585
|
* else Unknown control type
|
|
2066
2586
|
* NFS-->>C: Throw Error
|
|
2067
2587
|
* end
|
|
2068
|
-
*
|
|
2069
2588
|
* @static
|
|
2070
|
-
* @memberOf NgxDecafFormService
|
|
2071
2589
|
*/
|
|
2072
2590
|
static validateFields(control: AbstractControl, pk?: string, path?: string): boolean;
|
|
2073
2591
|
/**
|
|
2074
2592
|
* @description Generates validators from component properties.
|
|
2075
2593
|
* @summary Creates an array of ValidatorFn based on the supported validation keys in the component properties.
|
|
2076
|
-
*
|
|
2077
|
-
*
|
|
2594
|
+
* Maps each validation property to its corresponding Angular validator function using the ValidatorFactory.
|
|
2595
|
+
* Only processes properties that are recognized as validation keys by the Validation utility.
|
|
2596
|
+
* @param {KeyValue} props - The component properties containing validation rules
|
|
2597
|
+
* @return {ValidatorFn[]} An array of validator functions
|
|
2598
|
+
* @private
|
|
2599
|
+
* @static
|
|
2078
2600
|
*/
|
|
2079
2601
|
private static validatorsFromProps;
|
|
2080
2602
|
/**
|
|
@@ -2082,18 +2604,15 @@ declare class NgxDecafFormService {
|
|
|
2082
2604
|
* @summary Generates a FormControl with validators and initial configuration based on the provided
|
|
2083
2605
|
* component properties. Handles different input types, sets initial values, and configures
|
|
2084
2606
|
* validation rules and update modes.
|
|
2085
|
-
*
|
|
2086
2607
|
* @param {FieldProperties} props - The component properties defining the control configuration
|
|
2087
2608
|
* @param {FieldUpdateMode} [updateMode='change'] - The update mode for the control ('change', 'blur', 'submit')
|
|
2088
2609
|
* @return {FormControl} The created FormControl with proper configuration and validators
|
|
2089
|
-
*
|
|
2090
2610
|
* @mermaid
|
|
2091
2611
|
* sequenceDiagram
|
|
2092
2612
|
* participant C as Component
|
|
2093
2613
|
* participant NFS as NgxDecafFormService
|
|
2094
2614
|
* participant VF as ValidatorFactory
|
|
2095
2615
|
* participant AF as Angular Forms
|
|
2096
|
-
*
|
|
2097
2616
|
* C->>NFS: fromProps(props, updateMode?)
|
|
2098
2617
|
* NFS->>NFS: validatorsFromProps(props)
|
|
2099
2618
|
* NFS->>VF: Create validators from props
|
|
@@ -2108,9 +2627,7 @@ declare class NgxDecafFormService {
|
|
|
2108
2627
|
* NFS->>AF: new FormControl(config)
|
|
2109
2628
|
* AF-->>NFS: Return FormControl
|
|
2110
2629
|
* NFS-->>C: Return configured FormControl
|
|
2111
|
-
*
|
|
2112
2630
|
* @static
|
|
2113
|
-
* @memberOf NgxDecafFormService
|
|
2114
2631
|
*/
|
|
2115
2632
|
static fromProps(props: FieldProperties, updateMode?: FieldUpdateMode): FormControl;
|
|
2116
2633
|
/**
|
|
@@ -2118,12 +2635,9 @@ declare class NgxDecafFormService {
|
|
|
2118
2635
|
* @summary Gets the FieldProperties associated with a form control from the internal WeakMap.
|
|
2119
2636
|
* This method provides access to the original component properties that were used to create
|
|
2120
2637
|
* the control, enabling validation, rendering, and behavior configuration.
|
|
2121
|
-
*
|
|
2122
2638
|
* @param {FormControl | FormArray | FormGroup} control - The form control to get properties for
|
|
2123
2639
|
* @return {FieldProperties} The properties associated with the control, or empty object if not found
|
|
2124
|
-
*
|
|
2125
2640
|
* @static
|
|
2126
|
-
* @memberOf NgxDecafFormService
|
|
2127
2641
|
*/
|
|
2128
2642
|
static getPropsFromControl(control: FormControl | FormArray | FormGroup): FieldProperties;
|
|
2129
2643
|
/**
|
|
@@ -2131,18 +2645,15 @@ declare class NgxDecafFormService {
|
|
|
2131
2645
|
* @summary Traverses up the DOM tree to find the nearest parent element with the specified tag name.
|
|
2132
2646
|
* This is useful for finding container elements or specific parent components in the DOM hierarchy.
|
|
2133
2647
|
* The search is case-insensitive for tag name matching.
|
|
2134
|
-
*
|
|
2135
2648
|
* @param {HTMLElement} el - The starting element to traverse from
|
|
2136
2649
|
* @param {string} tag - The tag name to search for (case-insensitive)
|
|
2137
2650
|
* @return {HTMLElement} The found parent element with the specified tag
|
|
2138
2651
|
* @throws {Error} If no parent with the specified tag is found in the DOM tree
|
|
2139
|
-
*
|
|
2140
2652
|
* @mermaid
|
|
2141
2653
|
* sequenceDiagram
|
|
2142
2654
|
* participant C as Component
|
|
2143
2655
|
* participant NFS as NgxDecafFormService
|
|
2144
2656
|
* participant DOM as DOM Tree
|
|
2145
|
-
*
|
|
2146
2657
|
* C->>NFS: getParentEl(element, tagName)
|
|
2147
2658
|
* loop Traverse up DOM tree
|
|
2148
2659
|
* NFS->>DOM: Get parentElement
|
|
@@ -2153,9 +2664,7 @@ declare class NgxDecafFormService {
|
|
|
2153
2664
|
* NFS-->>C: Throw Error
|
|
2154
2665
|
* end
|
|
2155
2666
|
* end
|
|
2156
|
-
*
|
|
2157
2667
|
* @static
|
|
2158
|
-
* @memberOf NgxDecafFormService
|
|
2159
2668
|
*/
|
|
2160
2669
|
static getParentEl(el: HTMLElement, tag: string): HTMLElement;
|
|
2161
2670
|
/**
|
|
@@ -2163,26 +2672,31 @@ declare class NgxDecafFormService {
|
|
|
2163
2672
|
* @summary Associates a form control with its component properties for later retrieval.
|
|
2164
2673
|
* This enables the service to maintain metadata about controls without creating memory leaks,
|
|
2165
2674
|
* as WeakMap automatically cleans up references when controls are garbage collected.
|
|
2166
|
-
*
|
|
2167
2675
|
* @param {AbstractControl} control - The control to register (FormControl, FormGroup, or FormArray)
|
|
2168
2676
|
* @param {FieldProperties} props - The properties to associate with the control
|
|
2169
2677
|
* @return {void}
|
|
2170
|
-
*
|
|
2171
2678
|
* @static
|
|
2172
|
-
* @memberOf NgxDecafFormService
|
|
2173
2679
|
*/
|
|
2174
2680
|
static register(control: AbstractControl, props: FieldProperties): void;
|
|
2175
2681
|
/**
|
|
2176
|
-
* @description Unregisters a control.
|
|
2682
|
+
* @description Unregisters a control from the internal WeakMap.
|
|
2177
2683
|
* @summary Removes a control and its associated properties from the internal WeakMap.
|
|
2178
|
-
*
|
|
2179
|
-
*
|
|
2684
|
+
* This cleans up the metadata tracking for the control and frees up memory. Returns
|
|
2685
|
+
* true if the control was found and removed, false if it was not in the registry.
|
|
2686
|
+
* @param {AbstractControl} control - The control to unregister (FormControl, FormGroup, or FormArray)
|
|
2687
|
+
* @return {boolean} True if the control was successfully unregistered, false otherwise
|
|
2688
|
+
* @static
|
|
2180
2689
|
*/
|
|
2181
2690
|
static unregister(control: AbstractControl): boolean;
|
|
2182
2691
|
/**
|
|
2183
|
-
* @description Resets a form group.
|
|
2184
|
-
* @summary Recursively resets all controls in a form group
|
|
2185
|
-
*
|
|
2692
|
+
* @description Resets a form group or form control.
|
|
2693
|
+
* @summary Recursively resets all controls in a form group or a single form control, clearing values,
|
|
2694
|
+
* errors, and marking them as pristine and untouched. For FormControls, it sets the value to empty
|
|
2695
|
+
* string (except for checkbox types) and clears validation errors. For FormGroups, it recursively
|
|
2696
|
+
* resets all child controls.
|
|
2697
|
+
* @param {FormGroup | FormControl} formGroup - The form group or form control to reset
|
|
2698
|
+
* @return {void}
|
|
2699
|
+
* @static
|
|
2186
2700
|
*/
|
|
2187
2701
|
static reset(formGroup: FormGroup | FormControl): void;
|
|
2188
2702
|
}
|
|
@@ -2200,15 +2714,93 @@ declare abstract class NgxEventHandler<PAYLOAD> extends LoggedClass {
|
|
|
2200
2714
|
abstract handle(evt: IBaseCustomEvent | CustomEvent<PAYLOAD>): Promise<unknown>;
|
|
2201
2715
|
}
|
|
2202
2716
|
|
|
2203
|
-
|
|
2717
|
+
/**
|
|
2718
|
+
* @module lib/engine/NgxPageDirective
|
|
2719
|
+
* @description Base page component for Decaf Angular applications.
|
|
2720
|
+
* @summary Provides a page-level base class (NgxPageDirective) that extends NgxDecafComponentDirective and
|
|
2721
|
+
* offers page-focused utilities such as menu management, title handling and router event hooks.
|
|
2722
|
+
* @link {@link NgxPageDirective}
|
|
2723
|
+
*/
|
|
2724
|
+
|
|
2725
|
+
/**
|
|
2726
|
+
* @description Base directive for page-level components in Decaf Angular applications.
|
|
2727
|
+
* @summary Abstract directive that provides foundational functionality for page components.
|
|
2728
|
+
* Extends NgxDecafComponentDirective to add page-specific features including menu management,
|
|
2729
|
+
* page title handling, and Ionic lifecycle hooks. This directive serves as the base class for
|
|
2730
|
+
* all page-level components, providing consistent behavior for navigation, routing, and UI state.
|
|
2731
|
+
* @class NgxPageDirective
|
|
2732
|
+
* @extends {NgxDecafComponentDirective}
|
|
2733
|
+
* @memberOf module:lib/engine/NgxPageDirective
|
|
2734
|
+
*/
|
|
2735
|
+
declare abstract class NgxPageDirective extends NgxDecafComponentDirective implements AfterViewInit {
|
|
2204
2736
|
protected localeRoot?: string | undefined;
|
|
2205
2737
|
protected hasMenu: boolean;
|
|
2738
|
+
/**
|
|
2739
|
+
* @description Page title text for the current view.
|
|
2740
|
+
* @summary Stores the title text to be displayed for this page. This can be set dynamically
|
|
2741
|
+
* based on the current route or menu configuration and is used to update the browser's
|
|
2742
|
+
* title bar or page header.
|
|
2743
|
+
* @type {string}
|
|
2744
|
+
* @default ''
|
|
2745
|
+
* @memberOf module:lib/engine/NgxPageDirective
|
|
2746
|
+
*/
|
|
2206
2747
|
title: string;
|
|
2748
|
+
/**
|
|
2749
|
+
* @description Menu items array for page navigation.
|
|
2750
|
+
* @summary Contains the collection of menu items available for this page. Each menu item
|
|
2751
|
+
* defines a navigation option with properties like label, URL, icon, and visibility settings.
|
|
2752
|
+
* This array is used to construct the application's navigation menu and can be filtered or
|
|
2753
|
+
* customized per page.
|
|
2754
|
+
* @protected
|
|
2755
|
+
* @type {IMenuItem[]}
|
|
2756
|
+
* @default []
|
|
2757
|
+
* @memberOf module:lib/engine/NgxPageDirective
|
|
2758
|
+
*/
|
|
2207
2759
|
protected menu: IMenuItem[];
|
|
2760
|
+
/**
|
|
2761
|
+
* @description Angular Title service for browser title management.
|
|
2762
|
+
* @summary Injected service that provides control over the browser's document title.
|
|
2763
|
+
* Used to dynamically set the page title based on the current route or active menu item,
|
|
2764
|
+
* improving SEO and user experience.
|
|
2765
|
+
* @protected
|
|
2766
|
+
* @type {Title}
|
|
2767
|
+
* @memberOf module:lib/engine/NgxPageDirective
|
|
2768
|
+
*/
|
|
2208
2769
|
protected titleService: Title;
|
|
2770
|
+
/**
|
|
2771
|
+
* @description Constructor for NgxPageDirective.
|
|
2772
|
+
* @summary Initializes the page directive with optional locale root and menu visibility settings.
|
|
2773
|
+
* Calls the parent NgxDecafComponentDirective constructor to set up base functionality including
|
|
2774
|
+
* logging, localization, and component identification.
|
|
2775
|
+
* @param {string} [localeRoot] - Optional locale root key for internationalization
|
|
2776
|
+
* @param {boolean} [hasMenu=true] - Whether this page should display the menu
|
|
2777
|
+
* @memberOf module:lib/engine/NgxPageDirective
|
|
2778
|
+
*/
|
|
2209
2779
|
constructor(localeRoot?: string | undefined, hasMenu?: boolean);
|
|
2210
|
-
|
|
2211
|
-
|
|
2780
|
+
/**
|
|
2781
|
+
* @description Ionic lifecycle hook called when the page is about to enter view.
|
|
2782
|
+
* @summary This lifecycle hook is triggered just before the page becomes visible to the user.
|
|
2783
|
+
* It enables or disables the application menu based on the hasMenu property, allowing pages
|
|
2784
|
+
* to control whether the menu should be accessible. This is useful for pages like login screens
|
|
2785
|
+
* where the menu should be hidden.
|
|
2786
|
+
* @return {Promise<void>} A promise that resolves when menu state is updated
|
|
2787
|
+
* @memberOf module:lib/engine/NgxPageDirective
|
|
2788
|
+
*/
|
|
2789
|
+
ngAfterViewInit(): Promise<void>;
|
|
2790
|
+
/**
|
|
2791
|
+
* @description Sets the browser page title based on the current route.
|
|
2792
|
+
* @summary Updates the browser's document title by finding the active menu item that matches
|
|
2793
|
+
* the provided route. If a matching menu item is found, it sets the title using the format
|
|
2794
|
+
* "Decaf For Angular - {menu title or label}". This improves SEO and provides clear context
|
|
2795
|
+
* to users about the current page. If a custom menu array is provided, it uses that instead
|
|
2796
|
+
* of the component's default menu.
|
|
2797
|
+
* @protected
|
|
2798
|
+
* @param {string} route - The current route path to match against menu items
|
|
2799
|
+
* @param {IMenuItem[]} [menu] - Optional custom menu array to search (uses this.menu if not provided)
|
|
2800
|
+
* @return {void}
|
|
2801
|
+
* @memberOf module:lib/engine/NgxPageDirective
|
|
2802
|
+
*/
|
|
2803
|
+
protected setPageTitle(route?: string, menu?: IMenuItem[]): void;
|
|
2212
2804
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxPageDirective, never>;
|
|
2213
2805
|
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxPageDirective, never, never, {}, {}, never, never, true, never>;
|
|
2214
2806
|
}
|
|
@@ -3015,18 +3607,6 @@ declare class CrudFieldComponent extends NgxDecafFormFieldDirective implements O
|
|
|
3015
3607
|
ngOnDestroy(): void;
|
|
3016
3608
|
toggleOptionSelection(val: string, event: CheckboxCustomEvent): void;
|
|
3017
3609
|
isOptionChecked(value: string): boolean;
|
|
3018
|
-
/**
|
|
3019
|
-
* @description Handles fieldset group creation events from parent fieldsets.
|
|
3020
|
-
* @summary Processes events triggered when a new group needs to be added to a fieldset.
|
|
3021
|
-
* Validates the current form group, checks for uniqueness if applicable, and either
|
|
3022
|
-
* creates a new group or provides validation feedback. Updates the active form group
|
|
3023
|
-
* and resets the field for new input after successful creation.
|
|
3024
|
-
*
|
|
3025
|
-
* @param {CustomEvent} event - The fieldset create group event containing group details
|
|
3026
|
-
* @returns {void}
|
|
3027
|
-
* @memberOf CrudFieldComponent
|
|
3028
|
-
*/
|
|
3029
|
-
handleFieldsetCreateGroupEvent(event: CustomEvent): void;
|
|
3030
3610
|
/**
|
|
3031
3611
|
* @description Handles fieldset group update events from parent fieldsets.
|
|
3032
3612
|
* @summary Processes events triggered when an existing group needs to be updated.
|
|
@@ -3038,17 +3618,6 @@ declare class CrudFieldComponent extends NgxDecafFormFieldDirective implements O
|
|
|
3038
3618
|
* @memberOf CrudFieldComponent
|
|
3039
3619
|
*/
|
|
3040
3620
|
handleFieldsetUpdateGroupEvent(event: CustomEvent): void;
|
|
3041
|
-
/**
|
|
3042
|
-
* @description Handles fieldset group removal events from parent fieldsets.
|
|
3043
|
-
* @summary Processes events triggered when a group needs to be removed from a fieldset.
|
|
3044
|
-
* Removes the specified group from the form array, updates the active form group index,
|
|
3045
|
-
* and refreshes the form references. Dispatches a confirmation event back to the component.
|
|
3046
|
-
*
|
|
3047
|
-
* @param {CustomEvent} event - The fieldset remove group event containing removal details
|
|
3048
|
-
* @returns {void}
|
|
3049
|
-
* @memberOf CrudFieldComponent
|
|
3050
|
-
*/
|
|
3051
|
-
handleFieldsetRemoveGroupEvent(event: CustomEvent): void;
|
|
3052
3621
|
static ɵfac: i0.ɵɵFactoryDeclaration<CrudFieldComponent, never>;
|
|
3053
3622
|
static ɵcmp: i0.ɵɵComponentDeclaration<CrudFieldComponent, "ngx-decaf-crud-field", never, { "operation": { "alias": "operation"; "required": true; }; "name": { "alias": "name"; "required": true; }; "className": { "alias": "className"; "required": false; }; "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; }; "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; }; "page": { "alias": "page"; "required": false; }; "translatable": { "alias": "translatable"; "required": false; }; }, {}, never, never, true, never>;
|
|
3054
3623
|
}
|
|
@@ -3072,7 +3641,6 @@ declare class CrudFieldComponent extends NgxDecafFormFieldDirective implements O
|
|
|
3072
3641
|
* @class NgxParentComponentDirective
|
|
3073
3642
|
* @extends {NgxParentComponentDirective}
|
|
3074
3643
|
* @implements {OnInit}
|
|
3075
|
-
* @memberOf NgxParentComponentDirective
|
|
3076
3644
|
*/
|
|
3077
3645
|
declare class NgxParentComponentDirective extends NgxDecafComponentDirective implements OnInit {
|
|
3078
3646
|
/**
|
|
@@ -3084,7 +3652,6 @@ declare class NgxParentComponentDirective extends NgxDecafComponentDirective imp
|
|
|
3084
3652
|
*
|
|
3085
3653
|
* @type {string}
|
|
3086
3654
|
* @default 'Child'
|
|
3087
|
-
* @memberOf FieldsetComponent
|
|
3088
3655
|
*/
|
|
3089
3656
|
parentComponent: FormParent;
|
|
3090
3657
|
/**
|
|
@@ -3095,7 +3662,6 @@ declare class NgxParentComponentDirective extends NgxDecafComponentDirective imp
|
|
|
3095
3662
|
* page assignment, and display properties.
|
|
3096
3663
|
*
|
|
3097
3664
|
* @type {UIModelMetadata[]}
|
|
3098
|
-
* @memberOf NgxParentComponentDirective
|
|
3099
3665
|
*/
|
|
3100
3666
|
children: UIModelMetadata[] | KeyValue[];
|
|
3101
3667
|
/**
|
|
@@ -3107,7 +3673,6 @@ declare class NgxParentComponentDirective extends NgxDecafComponentDirective imp
|
|
|
3107
3673
|
*
|
|
3108
3674
|
* @type {(number | string[])}
|
|
3109
3675
|
* @default 1
|
|
3110
|
-
* @memberOf NgxParentComponentDirective
|
|
3111
3676
|
*/
|
|
3112
3677
|
cols: number | string[];
|
|
3113
3678
|
/**
|
|
@@ -3118,7 +3683,6 @@ declare class NgxParentComponentDirective extends NgxDecafComponentDirective imp
|
|
|
3118
3683
|
*
|
|
3119
3684
|
* @type {(number | string[])}
|
|
3120
3685
|
* @default 1
|
|
3121
|
-
* @memberOf NgxParentComponentDirective
|
|
3122
3686
|
*/
|
|
3123
3687
|
rows: number | KeyValue[] | string[];
|
|
3124
3688
|
ngOnInit(model?: Model | string): Promise<void>;
|
|
@@ -3134,7 +3698,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3134
3698
|
* Used for form validation, value management, and integration with Angular's reactive forms.
|
|
3135
3699
|
*
|
|
3136
3700
|
* @type {FormGroup}
|
|
3137
|
-
* @memberOf CrudFormComponent
|
|
3138
3701
|
*/
|
|
3139
3702
|
parentFormId: string;
|
|
3140
3703
|
/**
|
|
@@ -3144,20 +3707,8 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3144
3707
|
* HTML form properties and methods when needed.
|
|
3145
3708
|
*
|
|
3146
3709
|
* @type {ElementRef}
|
|
3147
|
-
* @memberOf CrudFormComponent
|
|
3148
3710
|
*/
|
|
3149
3711
|
component: ElementRef;
|
|
3150
|
-
/**
|
|
3151
|
-
* @description Angular Location service.
|
|
3152
|
-
* @summary Injected service that provides access to the browser's URL and history.
|
|
3153
|
-
* This service is used for interacting with the browser's history API, allowing
|
|
3154
|
-
* for back navigation and URL manipulation outside of Angular's router.
|
|
3155
|
-
*
|
|
3156
|
-
* @private
|
|
3157
|
-
* @type {Location}
|
|
3158
|
-
* @memberOf CrudFormComponent
|
|
3159
|
-
*/
|
|
3160
|
-
private location;
|
|
3161
3712
|
/**
|
|
3162
3713
|
* @description Field update trigger mode for form validation.
|
|
3163
3714
|
* @summary Determines when form field validation should be triggered. Options include
|
|
@@ -3166,7 +3717,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3166
3717
|
*
|
|
3167
3718
|
* @type {FieldUpdateMode}
|
|
3168
3719
|
* @default 'change'
|
|
3169
|
-
* @memberOf CrudFormComponent
|
|
3170
3720
|
*/
|
|
3171
3721
|
updateOn: FieldUpdateMode;
|
|
3172
3722
|
/**
|
|
@@ -3177,7 +3727,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3177
3727
|
*
|
|
3178
3728
|
* @type {HTMLFormTarget}
|
|
3179
3729
|
* @default '_self'
|
|
3180
|
-
* @memberOf CrudFormComponent
|
|
3181
3730
|
*/
|
|
3182
3731
|
target: HTMLFormTarget;
|
|
3183
3732
|
/**
|
|
@@ -3188,7 +3737,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3188
3737
|
*
|
|
3189
3738
|
* @type {'get' | 'post' | 'event'}
|
|
3190
3739
|
* @default 'event'
|
|
3191
|
-
* @memberOf CrudFormComponent
|
|
3192
3740
|
*/
|
|
3193
3741
|
method: 'get' | 'post' | 'event';
|
|
3194
3742
|
/**
|
|
@@ -3198,7 +3746,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3198
3746
|
* during component initialization to customize the form's functionality.
|
|
3199
3747
|
*
|
|
3200
3748
|
* @type {ICrudFormOptions}
|
|
3201
|
-
* @memberOf CrudFormComponent
|
|
3202
3749
|
*/
|
|
3203
3750
|
options: ICrudFormOptions;
|
|
3204
3751
|
/**
|
|
@@ -3208,7 +3755,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3208
3755
|
* distinguish between different types of form submissions within the same component.
|
|
3209
3756
|
*
|
|
3210
3757
|
* @type {string | undefined}
|
|
3211
|
-
* @memberOf CrudFormComponent
|
|
3212
3758
|
*/
|
|
3213
3759
|
action?: string;
|
|
3214
3760
|
/**
|
|
@@ -3219,7 +3765,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3219
3765
|
*
|
|
3220
3766
|
* @type {CrudOperations}
|
|
3221
3767
|
* @required
|
|
3222
|
-
* @memberOf CrudFormComponent
|
|
3223
3768
|
*/
|
|
3224
3769
|
operation: CrudOperations;
|
|
3225
3770
|
/**
|
|
@@ -3229,7 +3774,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3229
3774
|
* custom business logic and can be invoked for various form events and actions.
|
|
3230
3775
|
*
|
|
3231
3776
|
* @type {HandlerLike}
|
|
3232
|
-
* @memberOf CrudFormComponent
|
|
3233
3777
|
*/
|
|
3234
3778
|
handlers: HandlerLike;
|
|
3235
3779
|
/**
|
|
@@ -3239,7 +3783,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3239
3783
|
* controlling form behavior. May be undefined for read-only operations.
|
|
3240
3784
|
*
|
|
3241
3785
|
* @type {FormGroup | undefined}
|
|
3242
|
-
* @memberOf CrudFormComponent
|
|
3243
3786
|
*/
|
|
3244
3787
|
formGroup: FormParent | undefined;
|
|
3245
3788
|
/**
|
|
@@ -3249,7 +3792,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3249
3792
|
* attribute for the form element, enabling DOM queries and form management.
|
|
3250
3793
|
*
|
|
3251
3794
|
* @type {string}
|
|
3252
|
-
* @memberOf CrudFormComponent
|
|
3253
3795
|
*/
|
|
3254
3796
|
rendererId: string;
|
|
3255
3797
|
/**
|
|
@@ -3259,7 +3801,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3259
3801
|
* components. This enables decoupled handling of form submission logic.
|
|
3260
3802
|
*
|
|
3261
3803
|
* @type {EventEmitter<ICrudFormEvent>}
|
|
3262
|
-
* @memberOf CrudFormComponent
|
|
3263
3804
|
*/
|
|
3264
3805
|
submitEvent: EventEmitter<ICrudFormEvent>;
|
|
3265
3806
|
/**
|
|
@@ -3271,21 +3812,8 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3271
3812
|
*
|
|
3272
3813
|
* @type {string}
|
|
3273
3814
|
* @default Randomly generated 12-character string
|
|
3274
|
-
* @memberOf CrudFormComponent
|
|
3275
3815
|
*/
|
|
3276
3816
|
allowClear: boolean;
|
|
3277
|
-
/**
|
|
3278
|
-
* @description Reference to CRUD operation constants for template usage.
|
|
3279
|
-
* @summary Exposes the OperationKeys enum to the component template, enabling
|
|
3280
|
-
* conditional rendering and behavior based on operation types. This protected
|
|
3281
|
-
* readonly property ensures that template logic can access operation constants
|
|
3282
|
-
* while maintaining encapsulation and preventing accidental modification.
|
|
3283
|
-
*
|
|
3284
|
-
* @protected
|
|
3285
|
-
* @readonly
|
|
3286
|
-
* @memberOf CrudFormComponent
|
|
3287
|
-
*/
|
|
3288
|
-
protected readonly OperationKeys: typeof OperationKeys;
|
|
3289
3817
|
protected activeFormGroupIndex: number;
|
|
3290
3818
|
get activeFormGroup(): FormParent;
|
|
3291
3819
|
/**
|
|
@@ -3296,7 +3824,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3296
3824
|
* form input. Configuration options are merged with default settings.
|
|
3297
3825
|
*
|
|
3298
3826
|
* @returns {Promise<void>}
|
|
3299
|
-
* @memberOf CrudFormComponent
|
|
3300
3827
|
*/
|
|
3301
3828
|
ngOnInit(model?: Model | string): Promise<void>;
|
|
3302
3829
|
/**
|
|
@@ -3306,7 +3833,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3306
3833
|
* and ensure proper resource cleanup.
|
|
3307
3834
|
*
|
|
3308
3835
|
* @returns {void}
|
|
3309
|
-
* @memberOf CrudFormComponent
|
|
3310
3836
|
*/
|
|
3311
3837
|
ngOnDestroy(): void;
|
|
3312
3838
|
getFormArrayIndex(index: number): FormParent | undefined;
|
|
@@ -3318,7 +3844,6 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
|
|
|
3318
3844
|
* since these operations don't have modifiable form data to reset.
|
|
3319
3845
|
*
|
|
3320
3846
|
* @returns {void}
|
|
3321
|
-
* @memberOf CrudFormComponent
|
|
3322
3847
|
*/
|
|
3323
3848
|
handleReset(): void;
|
|
3324
3849
|
handleSubmit(event?: SubmitEvent, eventName?: string, componentName?: string): Promise<boolean | void>;
|
|
@@ -3473,7 +3998,7 @@ declare class EmptyStateComponent extends NgxDecafComponentDirective implements
|
|
|
3473
3998
|
* and this value should correspond to an available icon name.
|
|
3474
3999
|
*
|
|
3475
4000
|
* @type {string}
|
|
3476
|
-
* @default "
|
|
4001
|
+
* @default "folder-open-outline"
|
|
3477
4002
|
* @memberOf EmptyStateComponent
|
|
3478
4003
|
*/
|
|
3479
4004
|
icon: string;
|
|
@@ -3560,6 +4085,7 @@ declare class EmptyStateComponent extends NgxDecafComponentDirective implements
|
|
|
3560
4085
|
searchValue: string;
|
|
3561
4086
|
private sanitizer;
|
|
3562
4087
|
searchSubtitle: SafeHtml;
|
|
4088
|
+
enableCreationByModelRoute: boolean;
|
|
3563
4089
|
/**
|
|
3564
4090
|
* @description Creates an instance of EmptyStateComponent.
|
|
3565
4091
|
* @summary Initializes a new EmptyStateComponent by calling the parent class constructor
|
|
@@ -3998,7 +4524,7 @@ declare class FieldsetComponent extends NgxFormDirective implements OnInit, Afte
|
|
|
3998
4524
|
* ```
|
|
3999
4525
|
*/
|
|
4000
4526
|
handleCreateItem(event?: CustomEvent<IFieldSetValidationEvent>): Promise<void>;
|
|
4001
|
-
handleUpdateItem(index: number
|
|
4527
|
+
handleUpdateItem(index: number): void;
|
|
4002
4528
|
/**
|
|
4003
4529
|
* @description Cancels the update mode and resets the UI state.
|
|
4004
4530
|
* @summary Exits the update mode by resetting the button label and clearing the updating item,
|
|
@@ -4114,7 +4640,7 @@ declare class FieldsetComponent extends NgxFormDirective implements OnInit, Afte
|
|
|
4114
4640
|
*/
|
|
4115
4641
|
private getMapper;
|
|
4116
4642
|
static ɵfac: i0.ɵɵFactoryDeclaration<FieldsetComponent, never>;
|
|
4117
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetComponent, "ngx-decaf-fieldset", never, { "formControl": { "alias": "formControl"; "required": false; }; "collapsable": { "alias": "collapsable"; "required": false; }; "page": { "alias": "page"; "required": false; }; "customTypes": { "alias": "customTypes"; "required": false; }; "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "value": { "alias": "value"; "required": false; }; "borders": { "alias": "borders"; "required": false; }; }, {}, never,
|
|
4643
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FieldsetComponent, "ngx-decaf-fieldset", never, { "formControl": { "alias": "formControl"; "required": false; }; "collapsable": { "alias": "collapsable"; "required": false; }; "page": { "alias": "page"; "required": false; }; "customTypes": { "alias": "customTypes"; "required": false; }; "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "value": { "alias": "value"; "required": false; }; "borders": { "alias": "borders"; "required": false; }; }, {}, never, never, true, never>;
|
|
4118
4644
|
}
|
|
4119
4645
|
|
|
4120
4646
|
/**
|
|
@@ -4659,7 +5185,6 @@ declare class FilterComponent extends NgxDecafComponentDirective implements OnIn
|
|
|
4659
5185
|
* @memberOf LayoutComponent
|
|
4660
5186
|
*/
|
|
4661
5187
|
declare class LayoutComponent extends NgxParentComponentDirective implements OnInit {
|
|
4662
|
-
initializeProps: boolean;
|
|
4663
5188
|
/**
|
|
4664
5189
|
* @description Media breakpoint for responsive behavior.
|
|
4665
5190
|
* @summary Determines the responsive breakpoint at which the layout should adapt.
|
|
@@ -4672,7 +5197,6 @@ declare class LayoutComponent extends NgxParentComponentDirective implements OnI
|
|
|
4672
5197
|
* @memberOf LayoutComponent
|
|
4673
5198
|
*/
|
|
4674
5199
|
gap: 'small' | 'medium' | 'large' | 'collapse';
|
|
4675
|
-
match: boolean;
|
|
4676
5200
|
/**
|
|
4677
5201
|
* @description Media breakpoint for responsive behavior.
|
|
4678
5202
|
* @summary Determines the responsive breakpoint at which the layout should adapt.
|
|
@@ -4685,6 +5209,30 @@ declare class LayoutComponent extends NgxParentComponentDirective implements OnI
|
|
|
4685
5209
|
* @memberOf LayoutComponent
|
|
4686
5210
|
*/
|
|
4687
5211
|
breakpoint: UIMediaBreakPointsType | string;
|
|
5212
|
+
/**
|
|
5213
|
+
* @description Media breakpoint for responsive behavior.
|
|
5214
|
+
* @summary Determines the responsive breakpoint at which the layout should adapt.
|
|
5215
|
+
* This affects how the grid behaves on different screen sizes, allowing for
|
|
5216
|
+
* mobile-first or desktop-first responsive design patterns. The breakpoint
|
|
5217
|
+
* is automatically processed to ensure compatibility with the UI framework.
|
|
5218
|
+
*
|
|
5219
|
+
* @type {UIMediaBreakPointsType}
|
|
5220
|
+
* @default 'medium'
|
|
5221
|
+
* @memberOf LayoutComponent
|
|
5222
|
+
*/
|
|
5223
|
+
grid: boolean;
|
|
5224
|
+
/**
|
|
5225
|
+
* @description Media breakpoint for responsive behavior.
|
|
5226
|
+
* @summary Determines the responsive breakpoint at which the layout should adapt.
|
|
5227
|
+
* This affects how the grid behaves on different screen sizes, allowing for
|
|
5228
|
+
* mobile-first or desktop-first responsive design patterns. The breakpoint
|
|
5229
|
+
* is automatically processed to ensure compatibility with the UI framework.
|
|
5230
|
+
*
|
|
5231
|
+
* @type {UIMediaBreakPointsType}
|
|
5232
|
+
* @default 'medium'
|
|
5233
|
+
* @memberOf LayoutComponent
|
|
5234
|
+
*/
|
|
5235
|
+
match: boolean;
|
|
4688
5236
|
/**
|
|
4689
5237
|
* @description Creates an instance of LayoutComponent.
|
|
4690
5238
|
* @summary Initializes a new LayoutComponent with the component name "LayoutComponent".
|
|
@@ -4728,7 +5276,7 @@ declare class LayoutComponent extends NgxParentComponentDirective implements OnI
|
|
|
4728
5276
|
*/
|
|
4729
5277
|
ngOnInit(): Promise<void>;
|
|
4730
5278
|
static ɵfac: i0.ɵɵFactoryDeclaration<LayoutComponent, never>;
|
|
4731
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<LayoutComponent, "ngx-decaf-layout", never, { "
|
|
5279
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LayoutComponent, "ngx-decaf-layout", never, { "gap": { "alias": "gap"; "required": false; }; "breakpoint": { "alias": "breakpoint"; "required": false; }; "grid": { "alias": "grid"; "required": false; }; "match": { "alias": "match"; "required": false; }; }, {}, never, never, true, never>;
|
|
4732
5280
|
}
|
|
4733
5281
|
|
|
4734
5282
|
/**
|
|
@@ -5002,32 +5550,22 @@ declare class ListComponent extends NgxDecafComponentDirective implements OnInit
|
|
|
5002
5550
|
*/
|
|
5003
5551
|
disableSort: StringOrBoolean;
|
|
5004
5552
|
/**
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
* title: 'empty.title',
|
|
5022
|
-
* subtitle: 'empty.subtitle',
|
|
5023
|
-
* showButton: false,
|
|
5024
|
-
* icon: 'alert-circle-outline',
|
|
5025
|
-
* buttonText: 'locale.empty.button',
|
|
5026
|
-
* link: ''
|
|
5027
|
-
* }
|
|
5028
|
-
* @memberOf ListComponent
|
|
5029
|
-
*/
|
|
5030
|
-
empty: Partial<IListEmptyResult>;
|
|
5553
|
+
* @description Configuration for the empty state display.
|
|
5554
|
+
* @summary Customizes how the empty state is displayed when no data is available.
|
|
5555
|
+
* This includes the title, subtitle, button text, icon, and navigation link.
|
|
5556
|
+
*
|
|
5557
|
+
* @type {Partial<IListEmptyOptions>}
|
|
5558
|
+
* @default {
|
|
5559
|
+
* title: 'empty.title',
|
|
5560
|
+
* subtitle: 'empty.subtitle',
|
|
5561
|
+
* showButton: false,
|
|
5562
|
+
* icon: 'alert-circle-outline',
|
|
5563
|
+
* buttonText: 'locale.empty.button',
|
|
5564
|
+
* link: ''
|
|
5565
|
+
* }
|
|
5566
|
+
* @memberOf ListComponent
|
|
5567
|
+
*/
|
|
5568
|
+
empty: Partial<IListEmptyOptions>;
|
|
5031
5569
|
/**
|
|
5032
5570
|
* @description The current page number in paginated mode.
|
|
5033
5571
|
* @summary Tracks which page is currently being displayed when the component
|
|
@@ -5087,6 +5625,7 @@ declare class ListComponent extends NgxDecafComponentDirective implements OnInit
|
|
|
5087
5625
|
* @memberOf ListComponent
|
|
5088
5626
|
*/
|
|
5089
5627
|
searchValue?: string | IFilterQuery | undefined;
|
|
5628
|
+
searching: boolean;
|
|
5090
5629
|
/**
|
|
5091
5630
|
* @description A paginator object for handling pagination operations.
|
|
5092
5631
|
* @summary Provides a paginator object that can be used to retrieve and navigate
|
|
@@ -5567,8 +6106,9 @@ declare class ListComponent extends NgxDecafComponentDirective implements OnInit
|
|
|
5567
6106
|
* @memberOf ListComponent
|
|
5568
6107
|
*/
|
|
5569
6108
|
mapResults(data: KeyValue[]): KeyValue[];
|
|
6109
|
+
parseSearchValue(): string | IFilterQuery;
|
|
5570
6110
|
static ɵfac: i0.ɵɵFactoryDeclaration<ListComponent, never>;
|
|
5571
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ListComponent, "ngx-decaf-list", never, { "type": { "alias": "type"; "required": false; }; "showSearchbar": { "alias": "showSearchbar"; "required": false; }; "data": { "alias": "data"; "required": false; }; "source": { "alias": "source"; "required": false; }; "start": { "alias": "start"; "required": false; }; "limit": { "alias": "limit"; "required": false; }; "loadMoreData": { "alias": "loadMoreData"; "required": false; }; "lines": { "alias": "lines"; "required": false; }; "inset": { "alias": "inset"; "required": false; }; "scrollThreshold": { "alias": "scrollThreshold"; "required": false; }; "scrollPosition": { "alias": "scrollPosition"; "required": false; }; "loadingText": { "alias": "loadingText"; "required": false; }; "showRefresher": { "alias": "showRefresher"; "required": false; }; "loadingSpinner": { "alias": "loadingSpinner"; "required": false; }; "enableFilter": { "alias": "enableFilter"; "required": false; }; "sortDirection": { "alias": "sortDirection"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "disableSort": { "alias": "disableSort"; "required": false; }; "
|
|
6111
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ListComponent, "ngx-decaf-list", never, { "type": { "alias": "type"; "required": false; }; "showSearchbar": { "alias": "showSearchbar"; "required": false; }; "data": { "alias": "data"; "required": false; }; "source": { "alias": "source"; "required": false; }; "start": { "alias": "start"; "required": false; }; "limit": { "alias": "limit"; "required": false; }; "loadMoreData": { "alias": "loadMoreData"; "required": false; }; "lines": { "alias": "lines"; "required": false; }; "inset": { "alias": "inset"; "required": false; }; "scrollThreshold": { "alias": "scrollThreshold"; "required": false; }; "scrollPosition": { "alias": "scrollPosition"; "required": false; }; "loadingText": { "alias": "loadingText"; "required": false; }; "showRefresher": { "alias": "showRefresher"; "required": false; }; "loadingSpinner": { "alias": "loadingSpinner"; "required": false; }; "enableFilter": { "alias": "enableFilter"; "required": false; }; "sortDirection": { "alias": "sortDirection"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "disableSort": { "alias": "disableSort"; "required": false; }; "empty": { "alias": "empty"; "required": false; }; }, { "refreshEvent": "refreshEvent"; "clickEvent": "clickEvent"; }, never, ["*"], true, never>;
|
|
5572
6112
|
}
|
|
5573
6113
|
|
|
5574
6114
|
/**
|
|
@@ -6744,7 +7284,7 @@ declare class SearchbarComponent extends NgxDecafComponentDirective implements O
|
|
|
6744
7284
|
* @link {@link SteppedFormComponent}
|
|
6745
7285
|
*/
|
|
6746
7286
|
|
|
6747
|
-
declare class SteppedFormComponent extends NgxParentComponentDirective
|
|
7287
|
+
declare class SteppedFormComponent extends NgxParentComponentDirective implements OnInit, OnDestroy {
|
|
6748
7288
|
/**
|
|
6749
7289
|
* @description Array of UI model metadata for all form fields.
|
|
6750
7290
|
* @summary Contains the complete collection of UI model metadata that defines
|
|
@@ -6782,7 +7322,10 @@ declare class SteppedFormComponent extends NgxParentComponentDirective$1 impleme
|
|
|
6782
7322
|
* @default 1
|
|
6783
7323
|
* @memberOf SteppedFormComponent
|
|
6784
7324
|
*/
|
|
6785
|
-
pages: number
|
|
7325
|
+
pages: number | {
|
|
7326
|
+
title: string;
|
|
7327
|
+
description: string;
|
|
7328
|
+
}[];
|
|
6786
7329
|
/**
|
|
6787
7330
|
* List of titles and descriptions for each page of the stepped form.
|
|
6788
7331
|
* Each object in the array represents a page, containing a title and a description.
|
|
@@ -6880,17 +7423,6 @@ declare class SteppedFormComponent extends NgxParentComponentDirective$1 impleme
|
|
|
6880
7423
|
* @memberOf SteppedFormComponent
|
|
6881
7424
|
*/
|
|
6882
7425
|
private timerSubscription;
|
|
6883
|
-
/**
|
|
6884
|
-
* @description Angular Location service.
|
|
6885
|
-
* @summary Injected service that provides access to the browser's URL and history.
|
|
6886
|
-
* This service is used for interacting with the browser's history API, allowing
|
|
6887
|
-
* for back navigation and URL manipulation outside of Angular's router.
|
|
6888
|
-
*
|
|
6889
|
-
* @private
|
|
6890
|
-
* @type {Location}
|
|
6891
|
-
* @memberOf CrudFormComponent
|
|
6892
|
-
*/
|
|
6893
|
-
private location;
|
|
6894
7426
|
/**
|
|
6895
7427
|
* @description Event emitter for form submission.
|
|
6896
7428
|
* @summary Emits events when the form is submitted, typically on the last page
|
|
@@ -7237,58 +7769,107 @@ declare function getLocaleLanguage(): string;
|
|
|
7237
7769
|
*/
|
|
7238
7770
|
declare function generateRandomValue(length?: number, onlyNumbers?: boolean): string;
|
|
7239
7771
|
/**
|
|
7240
|
-
* Converts a string representation of a boolean or a boolean value to a boolean type.
|
|
7772
|
+
* @description Converts a string representation of a boolean or a boolean value to a boolean type.
|
|
7773
|
+
* @summary This utility function handles conversion of string-based boolean values ('true', 'false')
|
|
7774
|
+
* to actual boolean types. It performs case-insensitive string comparison and returns the
|
|
7775
|
+
* corresponding boolean value. This is particularly useful when parsing configuration values,
|
|
7776
|
+
* URL parameters, or form inputs that may come as strings but need to be used as booleans.
|
|
7241
7777
|
*
|
|
7242
|
-
* @
|
|
7243
|
-
* @
|
|
7244
|
-
*
|
|
7778
|
+
* @param {'true' | 'false' | boolean} prop - The value to convert. Can be the string 'true', 'false', or a boolean
|
|
7779
|
+
* @returns {boolean} The boolean representation of the input value. Returns true if the input is the string 'true' or boolean true, false otherwise
|
|
7780
|
+
*
|
|
7781
|
+
* @function stringToBoolean
|
|
7782
|
+
* @memberOf module:lib/helpers/utils
|
|
7245
7783
|
*/
|
|
7246
7784
|
declare function stringToBoolean(prop: 'true' | 'false' | boolean): boolean;
|
|
7247
7785
|
/**
|
|
7248
|
-
* Checks if a value is a valid Date object
|
|
7786
|
+
* @description Checks if a value is a valid Date object.
|
|
7787
|
+
* @summary This validation function determines whether a given value represents a valid date.
|
|
7788
|
+
* It handles multiple input types including Date objects, timestamp numbers, and date strings.
|
|
7789
|
+
* For string inputs, it supports ISO 8601 format (YYYY-MM-DD) with or without time components.
|
|
7790
|
+
* The function performs comprehensive validation including regex pattern matching and Date
|
|
7791
|
+
* object creation to ensure the date is not only parseable but also represents a real date.
|
|
7792
|
+
*
|
|
7793
|
+
* @param {string | Date | number} date - The value to check. Can be a Date object, a timestamp number, or a date string
|
|
7794
|
+
* @returns {boolean} Returns true if the value is a valid Date object (not NaN), otherwise false
|
|
7249
7795
|
*
|
|
7250
|
-
* @
|
|
7251
|
-
* @
|
|
7796
|
+
* @function isValidDate
|
|
7797
|
+
* @memberOf module:lib/helpers/utils
|
|
7252
7798
|
*/
|
|
7253
7799
|
declare function isValidDate(date: string | Date | number): boolean;
|
|
7254
7800
|
/**
|
|
7255
|
-
* Formats a date into a localized string representation
|
|
7801
|
+
* @description Formats a date into a localized string representation.
|
|
7802
|
+
* @summary This function converts a date value into a formatted string according to a specified
|
|
7803
|
+
* or system locale. It accepts multiple input formats (Date objects, timestamps, or date strings)
|
|
7804
|
+
* and returns a consistently formatted date string in DD/MM/YYYY format. If the input date is
|
|
7805
|
+
* invalid, the function returns the original input as a string. The function automatically
|
|
7806
|
+
* uses the system locale if none is provided and handles string format conversions by replacing
|
|
7807
|
+
* forward slashes with hyphens for proper Date parsing.
|
|
7256
7808
|
*
|
|
7257
|
-
* @param {
|
|
7809
|
+
* @param {string | Date | number} date - The date to format. Can be a Date object, a timestamp number, or a date string
|
|
7258
7810
|
* @param {string} [locale] - The locale to use for formatting. If not provided, the system's locale will be used
|
|
7259
|
-
* @
|
|
7260
|
-
*
|
|
7811
|
+
* @returns {Date | string} A formatted date string in the format DD/MM/YYYY according to the specified locale,
|
|
7812
|
+
* or the original input as a string if the date is invalid
|
|
7813
|
+
*
|
|
7814
|
+
* @function formatDate
|
|
7815
|
+
* @memberOf module:lib/helpers/utils
|
|
7261
7816
|
*/
|
|
7262
7817
|
declare function formatDate(date: string | Date | number, locale?: string | undefined): Date | string;
|
|
7263
7818
|
/**
|
|
7264
|
-
* Attempts to parse a date string, Date object, or number into a valid Date object
|
|
7819
|
+
* @description Attempts to parse a date string, Date object, or number into a valid Date object.
|
|
7820
|
+
* @summary This function provides robust date parsing functionality that handles the specific
|
|
7821
|
+
* format "DD/MM/YYYY HH:MM:SS:MS". It first validates the input date, and if already valid,
|
|
7822
|
+
* returns it as-is. For string inputs, it parses the date and time components separately,
|
|
7823
|
+
* extracts numeric values, and constructs a new Date object. The function includes validation
|
|
7824
|
+
* to ensure the resulting Date object is valid and logs a warning if parsing fails.
|
|
7825
|
+
* Returns null for invalid or unsupported date formats.
|
|
7826
|
+
*
|
|
7827
|
+
* @param {string | Date | number} date - The date to parse. Can be a Date object, a timestamp number,
|
|
7828
|
+
* or a date string in the format "DD/MM/YYYY HH:MM:SS:MS"
|
|
7829
|
+
* @returns {Date | null} A valid Date object if parsing is successful, or null if the date is invalid
|
|
7830
|
+
* or doesn't match the expected format
|
|
7265
7831
|
*
|
|
7266
|
-
* @
|
|
7267
|
-
*
|
|
7268
|
-
* @return {(Date | null)} A valid Date object if parsing is successful, or null if the date is invalid
|
|
7269
|
-
* or doesn't match the expected format
|
|
7832
|
+
* @function parseToValidDate
|
|
7833
|
+
* @memberOf module:lib/helpers/utils
|
|
7270
7834
|
*/
|
|
7271
7835
|
declare function parseToValidDate(date: string | Date | number): Date | null;
|
|
7272
7836
|
/**
|
|
7273
|
-
* Maps an item object using a provided mapper object and optional additional properties.
|
|
7837
|
+
* @description Maps an item object using a provided mapper object and optional additional properties.
|
|
7838
|
+
* @summary This function transforms a source object into a new object based on mapping rules defined
|
|
7839
|
+
* in the mapper parameter. It supports dot notation for nested property access (e.g., 'user.name.first')
|
|
7840
|
+
* and handles various data types including strings and complex objects. For date values, it automatically
|
|
7841
|
+
* formats them using the formatDate function. The function also allows merging additional properties
|
|
7842
|
+
* into the result. When a mapped value is null or undefined, it uses the original mapper value as
|
|
7843
|
+
* a fallback.
|
|
7274
7844
|
*
|
|
7275
|
-
* @param {KeyValue} item - The source object to be mapped
|
|
7845
|
+
* @param {KeyValue} item - The source object to be mapped
|
|
7276
7846
|
* @param {KeyValue} mapper - An object that defines the mapping rules. Keys represent the new property names,
|
|
7277
|
-
* and values represent the path to the corresponding values in the source object
|
|
7278
|
-
* @param {KeyValue} [props] - Optional additional properties to be included in the mapped object
|
|
7279
|
-
* @returns {KeyValue} A new object with properties mapped according to the mapper object and including any additional properties
|
|
7847
|
+
* and values represent the path to the corresponding values in the source object
|
|
7848
|
+
* @param {KeyValue} [props] - Optional additional properties to be included in the mapped object
|
|
7849
|
+
* @returns {KeyValue} A new object with properties mapped according to the mapper object and including any additional properties
|
|
7850
|
+
*
|
|
7851
|
+
* @function itemMapper
|
|
7852
|
+
* @memberOf module:lib/helpers/utils
|
|
7280
7853
|
*/
|
|
7281
7854
|
declare function itemMapper(item: KeyValue, mapper: KeyValue, props?: KeyValue): KeyValue;
|
|
7282
7855
|
/**
|
|
7283
|
-
* Maps an array of data objects using a provided mapper object.
|
|
7856
|
+
* @description Maps an array of data objects using a provided mapper object.
|
|
7857
|
+
* @summary This function transforms an array of objects by applying mapping rules to each item
|
|
7858
|
+
* using the itemMapper function. It processes each element in the data array and creates
|
|
7859
|
+
* new mapped objects based on the mapper configuration. The function includes validation
|
|
7860
|
+
* to ensure meaningful data: if a mapped item contains only null/undefined values, it
|
|
7861
|
+
* preserves the original item instead. This prevents data loss during transformation.
|
|
7862
|
+
* Returns an empty array if the input data is null, undefined, or empty.
|
|
7284
7863
|
*
|
|
7285
|
-
* @template T - The type of the resulting mapped items
|
|
7286
|
-
* @param {
|
|
7287
|
-
* @param {KeyValue} mapper - An object that defines the mapping rules
|
|
7288
|
-
* @param {KeyValue} [props] - Additional properties to be included in the mapped items
|
|
7864
|
+
* @template T - The type of the resulting mapped items
|
|
7865
|
+
* @param {T[]} data - The array of data objects to be mapped
|
|
7866
|
+
* @param {KeyValue} mapper - An object that defines the mapping rules
|
|
7867
|
+
* @param {KeyValue} [props] - Additional properties to be included in the mapped items
|
|
7868
|
+
* @returns {T[]} The array of mapped items. If an item in the original array does not have any non-null values after mapping,
|
|
7869
|
+
* the original item is returned instead
|
|
7289
7870
|
*
|
|
7290
|
-
* @
|
|
7291
|
-
*
|
|
7871
|
+
* @function dataMapper
|
|
7872
|
+
* @memberOf module:lib/helpers/utils
|
|
7292
7873
|
*/
|
|
7293
7874
|
declare function dataMapper<T>(data: T[], mapper: KeyValue, props?: KeyValue): T[];
|
|
7294
7875
|
/**
|
|
@@ -7444,5 +8025,5 @@ declare class ForAngularCommonModule {
|
|
|
7444
8025
|
static ɵinj: i0.ɵɵInjectorDeclaration<ForAngularCommonModule>;
|
|
7445
8026
|
}
|
|
7446
8027
|
|
|
7447
|
-
export { AngularEngineKeys, BaseComponentProps, CPTKN, CollapsableDirective, ComponentRendererComponent, ComponentsTagNames, CrudFieldComponent, CrudFormComponent, CssClasses, DB_ADAPTER_PROVIDER, DB_ADAPTER_PROVIDER_TOKEN, DefaultFormReactiveOptions, Dynamic, DynamicModule, EmptyStateComponent, EventConstants, FieldsetComponent, FilterComponent, ForAngularCommonModule, ForAngularComponentsModule, FormConstants, I18N_CONFIG_TOKEN, I18nLoader, I18nLoaderFactory, I18nParser, LOCALE_ROOT_TOKEN, LayoutComponent, ListComponent, ListComponentsTypes, ListItemComponent, LoggerLevels, ModelRendererComponent, NgxDecafComponentDirective, NgxDecafFormFieldDirective, NgxDecafFormService, NgxEventHandler, NgxPageDirective, NgxRenderingEngine, PaginationComponent, RouteDirections, SearchbarComponent, SteppedFormComponent, cleanSpaces, dataMapper, formatDate, generateRandomValue, getInjectablesRegistry, getLocaleContext, getLocaleContextByKey, getLocaleFromClassName, getLocaleLanguage, getLogger, getModelRepository, getOnWindow, getOnWindowDocument, getWindow, getWindowDocument, getWindowWidth, isDarkMode, isDevelopmentMode, isNotUndefined, isValidDate, itemMapper, parseToValidDate, provideDbAdapter, provideI18n, provideI18nLoader, removeFocusTrap, setOnWindow, stringToBoolean, windowEventEmitter };
|
|
7448
|
-
export type { AngularDynamicOutput, AngularFieldDefinition, CheckboxOption, ComponentMetadata, CrudFieldOption, DecafRepository, DecafRepositoryAdapter, ElementPositions, ElementSizes, FieldUpdateMode, FlexPositions, FormParent, FormParentGroup, FormServiceControl, FormServiceControls, FunctionLike, HTMLFormTarget, HandlerLike, I18nResourceConfig, I18nResourceConfigType, IBaseCustomEvent, IComponentConfig, IComponentHolder, IComponentInput, ICrudFormEvent, ICrudFormOptions, IFieldSetItem, IFieldSetValidationEvent, IFilterQuery, IFilterQueryItem, IFormElement, IFormReactiveSubmitEvent, IListComponentRefreshEvent,
|
|
8028
|
+
export { AngularEngineKeys, BaseComponentProps, CPTKN, CollapsableDirective, ComponentRendererComponent, ComponentsTagNames, CrudFieldComponent, CrudFormComponent, CssClasses, DB_ADAPTER_PROVIDER, DB_ADAPTER_PROVIDER_TOKEN, DefaultFormReactiveOptions, DefaultListEmptyOptions, Dynamic, DynamicModule, EmptyStateComponent, EventConstants, FieldsetComponent, FilterComponent, ForAngularCommonModule, ForAngularComponentsModule, FormConstants, I18N_CONFIG_TOKEN, I18nLoader, I18nLoaderFactory, I18nParser, LOCALE_ROOT_TOKEN, LayoutComponent, ListComponent, ListComponentsTypes, ListItemComponent, LoggerLevels, ModelRendererComponent, NgxDecafComponentDirective, NgxDecafFormFieldDirective, NgxDecafFormService, NgxEventHandler, NgxPageDirective, NgxRenderingEngine, PaginationComponent, RouteDirections, SearchbarComponent, SteppedFormComponent, cleanSpaces, dataMapper, formatDate, generateRandomValue, getInjectablesRegistry, getLocaleContext, getLocaleContextByKey, getLocaleFromClassName, getLocaleLanguage, getLogger, getModelRepository, getOnWindow, getOnWindowDocument, getWindow, getWindowDocument, getWindowWidth, isDarkMode, isDevelopmentMode, isNotUndefined, isValidDate, itemMapper, parseToValidDate, provideDbAdapter, provideI18n, provideI18nLoader, removeFocusTrap, setOnWindow, stringToBoolean, windowEventEmitter };
|
|
8029
|
+
export type { AngularDynamicOutput, AngularFieldDefinition, CheckboxOption, ComponentMetadata, CrudFieldOption, DecafRepository, DecafRepositoryAdapter, ElementPositions, ElementSizes, FieldUpdateMode, FlexPositions, FormParent, FormParentGroup, FormServiceControl, FormServiceControls, FunctionLike, HTMLFormTarget, HandlerLike, I18nResourceConfig, I18nResourceConfigType, IBaseCustomEvent, IComponentConfig, IComponentHolder, IComponentInput, ICrudFormEvent, ICrudFormOptions, IFieldSetItem, IFieldSetValidationEvent, IFilterQuery, IFilterQueryItem, IFormElement, IFormReactiveSubmitEvent, IListComponentRefreshEvent, IListEmptyOptions, IMenuItem, IPaginationCustomEvent, IRenderedModel, ISortObject, InputOption, KeyValue, ListItemCustomEvent, PossibleInputTypes, RadioOption, RawQuery, SelectOption, StringOrBoolean };
|