@decaf-ts/for-angular 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/i18n/en.json +9 -69
- package/assets/i18n/pt.json +80 -0
- package/assets/icons/icon-128.webp +0 -0
- package/assets/icons/icon-192.webp +0 -0
- package/assets/icons/icon-256.webp +0 -0
- package/assets/icons/icon-48.webp +0 -0
- package/assets/icons/icon-512.webp +0 -0
- package/assets/icons/icon-72.webp +0 -0
- package/assets/icons/icon-96.webp +0 -0
- package/assets/images/apple-touch-icon.png +0 -0
- package/assets/images/favicon.png +0 -0
- package/assets/images/favicon.svg +29 -0
- package/components/component-renderer/component-renderer.component.d.ts +5 -4
- package/components/crud-field/crud-field.component.d.ts +186 -22
- package/components/crud-form/crud-form.component.d.ts +194 -8
- package/components/empty-state/empty-state.component.d.ts +9 -10
- package/components/fieldset/fieldset.component.d.ts +383 -36
- package/components/filter/filter.component.d.ts +11 -2
- package/components/list/list.component.d.ts +1 -1
- package/components/list-item/list-item.component.d.ts +2 -2
- package/components/model-renderer/model-renderer.component.d.ts +1 -5
- package/directives/collapsable.directive.d.ts +1 -0
- package/engine/NgxBaseComponent.d.ts +43 -43
- package/engine/NgxCrudFormField.d.ts +7 -3
- package/engine/NgxFormService.d.ts +113 -12
- package/engine/NgxRenderingEngine.d.ts +178 -25
- package/engine/constants.d.ts +11 -6
- package/engine/decorators.d.ts +2 -2
- package/engine/index.d.ts +4 -2
- package/engine/interfaces.d.ts +271 -0
- package/engine/types.d.ts +11 -206
- package/esm2022/components/component-renderer/component-renderer.component.mjs +13 -11
- package/esm2022/components/crud-field/crud-field.component.mjs +213 -8
- package/esm2022/components/crud-form/crud-form.component.mjs +133 -13
- package/esm2022/components/empty-state/empty-state.component.mjs +13 -12
- package/esm2022/components/fieldset/fieldset.component.mjs +485 -43
- package/esm2022/components/filter/filter.component.mjs +16 -6
- package/esm2022/components/layout/layout.component.mjs +3 -3
- package/esm2022/components/list/list.component.mjs +4 -5
- package/esm2022/components/list-item/list-item.component.mjs +10 -10
- package/esm2022/components/model-renderer/model-renderer.component.mjs +9 -8
- package/esm2022/components/pagination/pagination.component.mjs +7 -7
- package/esm2022/components/searchbar/searchbar.component.mjs +3 -3
- package/esm2022/directives/collapsable.directive.mjs +3 -2
- package/esm2022/engine/NgxBaseComponent.mjs +64 -63
- package/esm2022/engine/NgxCrudFormField.mjs +14 -4
- package/esm2022/engine/NgxFormService.mjs +239 -27
- package/esm2022/engine/NgxRenderingEngine.mjs +218 -46
- package/esm2022/engine/ValidatorFactory.mjs +6 -4
- package/esm2022/engine/constants.mjs +14 -9
- package/esm2022/engine/decorators.mjs +6 -6
- package/esm2022/engine/index.mjs +5 -3
- package/esm2022/engine/interfaces.mjs +4 -0
- package/esm2022/engine/types.mjs +1 -3
- package/esm2022/helpers/utils.mjs +53 -32
- package/esm2022/i18n/Loader.mjs +82 -0
- package/fesm2022/decaf-ts-for-angular.mjs +3030 -2097
- package/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
- package/helpers/utils.d.ts +42 -16
- package/i18n/Loader.d.ts +48 -0
- package/package.json +11 -1
- package/engine/NgxRenderingEngine2.d.ts +0 -250
- package/esm2022/engine/NgxRenderingEngine2.mjs +0 -332
- package/esm2022/interfaces.mjs +0 -2
- package/interfaces.d.ts +0 -28
package/engine/constants.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare const AngularEngineKeys: {
|
|
|
32
32
|
RENDERED_ID: string;
|
|
33
33
|
PARENT: string;
|
|
34
34
|
VALIDATION_PARENT_KEY: symbol;
|
|
35
|
+
FORM_GROUP_COMPONENT_PROPS: string;
|
|
35
36
|
};
|
|
36
37
|
/**
|
|
37
38
|
* @description Form validation state constants
|
|
@@ -59,12 +60,16 @@ export declare const FormConstants: {
|
|
|
59
60
|
* @property {string} SUBMIT_EVENT - Event fired when a form submission occurs
|
|
60
61
|
* @memberOf module:engine
|
|
61
62
|
*/
|
|
62
|
-
export declare
|
|
63
|
-
BACK_BUTTON_NAVIGATION
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
export declare const EventConstants: {
|
|
64
|
+
BACK_BUTTON_NAVIGATION: string;
|
|
65
|
+
REFRESH: string;
|
|
66
|
+
CLICK: string;
|
|
67
|
+
SUBMIT: string;
|
|
68
|
+
VALIDATION_ERROR: string;
|
|
69
|
+
FIELDSET_ADD_GROUP: string;
|
|
70
|
+
FIELDSET_UPDATE_GROUP: string;
|
|
71
|
+
FIELDSET_REMOVE_GROUP: string;
|
|
72
|
+
};
|
|
68
73
|
/**
|
|
69
74
|
* @description Logger level constants
|
|
70
75
|
* @summary Enum defining the logging levels used in the application's logging system.
|
package/engine/decorators.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description Marks an Angular component as dynamically loadable
|
|
3
|
-
* @summary Decorator that registers an Angular component with the
|
|
3
|
+
* @summary Decorator that registers an Angular component with the NgxRenderingEngine for dynamic loading.
|
|
4
4
|
* This decorator must be applied before the @Component decorator to properly extract component metadata.
|
|
5
5
|
* It adds metadata to the component class and registers it with the rendering engine using its selector.
|
|
6
6
|
* @function Dynamic
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* sequenceDiagram
|
|
10
10
|
* participant C as Component Class
|
|
11
11
|
* participant D as Dynamic Decorator
|
|
12
|
-
* participant R as
|
|
12
|
+
* participant R as NgxRenderingEngine
|
|
13
13
|
* participant M as Angular Metadata
|
|
14
14
|
* C->>D: Apply decorator
|
|
15
15
|
* D->>M: reflectComponentType()
|
package/engine/index.d.ts
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export * from './constants';
|
|
11
11
|
export * from './decorators';
|
|
12
|
+
export * from './types';
|
|
13
|
+
export * from './interfaces';
|
|
12
14
|
export * from './DynamicModule';
|
|
13
15
|
export * from './NgxRenderingEngine';
|
|
14
|
-
export * from './NgxRenderingEngine2';
|
|
15
|
-
export * from './types';
|
|
16
16
|
export * from './NgxBaseComponent';
|
|
17
|
+
export * from './NgxCrudFormField';
|
|
18
|
+
export * from './NgxFormService';
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { FormArray, FormControl, FormGroup } from '@angular/forms';
|
|
2
|
+
import { ElementRef, EnvironmentInjector, Injector, Type } from '@angular/core';
|
|
3
|
+
import { OrderDirection } from '@decaf-ts/core';
|
|
4
|
+
import { AngularFieldDefinition, FieldUpdateMode, KeyValue, StringOrBoolean } from './types';
|
|
5
|
+
import { FieldProperties } from '@decaf-ts/ui-decorators';
|
|
6
|
+
/**
|
|
7
|
+
* @description Interface for components that hold an ElementRef
|
|
8
|
+
* @summary Defines a component holder interface that provides access to the underlying DOM element through ElementRef
|
|
9
|
+
* @interface IComponentHolder
|
|
10
|
+
* @memberOf module:engine
|
|
11
|
+
*/
|
|
12
|
+
export interface IComponentHolder {
|
|
13
|
+
/**
|
|
14
|
+
* @description Reference to the component's DOM element
|
|
15
|
+
* @property {ElementRef} component - The ElementRef instance providing access to the native DOM element
|
|
16
|
+
*/
|
|
17
|
+
component: ElementRef;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @description Interface for form components that hold both an ElementRef and a FormGroup
|
|
21
|
+
* @summary Extends IComponentHolder to include a FormGroup for form handling capabilities
|
|
22
|
+
* @interface IFormElement
|
|
23
|
+
* @memberOf module:engine
|
|
24
|
+
*/
|
|
25
|
+
export interface IFormElement extends IComponentHolder {
|
|
26
|
+
/**
|
|
27
|
+
* @description The Angular FormGroup associated with this form element
|
|
28
|
+
* @property {FormGroup|undefined} formGroup - The form group instance for managing form controls and validation
|
|
29
|
+
*/
|
|
30
|
+
formGroup: FormGroup | undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @description Interface for fieldset item representation in the UI.
|
|
34
|
+
* @summary Defines the structure for items displayed in the reorderable list within the fieldset.
|
|
35
|
+
* Each item represents a value added to the fieldset with display properties for the UI.
|
|
36
|
+
* @memberOf module:engine
|
|
37
|
+
*/
|
|
38
|
+
export interface IFieldSetItem {
|
|
39
|
+
/** @description Sequential index number for ordering items in the list */
|
|
40
|
+
index: number;
|
|
41
|
+
/** @description Primary display text for the item */
|
|
42
|
+
title: string;
|
|
43
|
+
/** @description Optional secondary text providing additional item details */
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @description Interface for fieldset validation event data.
|
|
48
|
+
* @summary Defines the structure of validation events emitted when form validation occurs.
|
|
49
|
+
* Used for communication between form components and the fieldset container.
|
|
50
|
+
* @memberOf module:engine
|
|
51
|
+
*/
|
|
52
|
+
export interface IFieldSetValidationEvent {
|
|
53
|
+
/** @description The FormGroup containing the validated form controls */
|
|
54
|
+
formGroup: FormArray | FormGroup;
|
|
55
|
+
/** @description The current form value being validated */
|
|
56
|
+
value: unknown;
|
|
57
|
+
/** @description Whether the form validation passed or failed */
|
|
58
|
+
isValid: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @description Interface for individual filter query items
|
|
62
|
+
* @summary Defines the structure of a single filter criterion in a filter query.
|
|
63
|
+
* Each item represents one condition to be applied to the data, consisting of
|
|
64
|
+
* an index (field name), a condition (comparison operator), and a value to compare against.
|
|
65
|
+
* @interface IFilterQueryItem
|
|
66
|
+
* @property {string} [index] - Optional field name or index to filter on
|
|
67
|
+
* @property {string} [condition] - Optional comparison condition (e.g., 'Equal', 'Contains', 'Greater Than')
|
|
68
|
+
* @property {string} [value] - Optional value to compare the field against
|
|
69
|
+
* @memberOf module:engine
|
|
70
|
+
*/
|
|
71
|
+
export interface IFilterQueryItem {
|
|
72
|
+
index?: string;
|
|
73
|
+
condition?: string;
|
|
74
|
+
value?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @description Interface for sorting configuration objects
|
|
78
|
+
* @summary Defines the structure for specifying sort criteria including the field
|
|
79
|
+
* to sort by and the direction of the sort (ascending or descending).
|
|
80
|
+
* @interface ISortObject
|
|
81
|
+
* @property {string} value - The field name or property to sort by
|
|
82
|
+
* @property {OrderDirection} direction - The sort direction (ASC or DSC)
|
|
83
|
+
* @memberOf module:engine
|
|
84
|
+
*/
|
|
85
|
+
export interface ISortObject {
|
|
86
|
+
value: string;
|
|
87
|
+
direction: OrderDirection;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @description Interface for complete filter query configuration
|
|
91
|
+
* @summary Defines the complete structure for filter and sort operations.
|
|
92
|
+
* Combines multiple filter criteria with sorting configuration to provide
|
|
93
|
+
* comprehensive data filtering and ordering capabilities.
|
|
94
|
+
* @interface IFilterQuery
|
|
95
|
+
* @property {IFilterQueryItem[] | undefined} query - Array of filter criteria or undefined for no filtering
|
|
96
|
+
* @property {ISortObject} sort - Sorting configuration specifying field and direction
|
|
97
|
+
* @memberOf module:engine
|
|
98
|
+
*/
|
|
99
|
+
export interface IFilterQuery {
|
|
100
|
+
query: IFilterQueryItem[] | undefined;
|
|
101
|
+
sort: ISortObject;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @description Component input properties
|
|
105
|
+
* @summary Extends FieldProperties with additional properties specific to Angular components.
|
|
106
|
+
* Includes update mode for form controls and optional FormGroup and FormControl references.
|
|
107
|
+
* @interface IComponentInput
|
|
108
|
+
* @property {FieldUpdateMode} [updateMode] - When the field value should be updated
|
|
109
|
+
* @property {FormGroup} [formGroup] - Optional FormGroup reference
|
|
110
|
+
* @property {FormControl} [formControl] - Optional FormControl reference
|
|
111
|
+
* @memberOf module:engine
|
|
112
|
+
*/
|
|
113
|
+
export interface IComponentInput extends FieldProperties {
|
|
114
|
+
updateMode?: FieldUpdateMode;
|
|
115
|
+
formGroup?: FormGroup;
|
|
116
|
+
formControl?: FormControl;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @description Component configuration structure
|
|
120
|
+
* @summary Defines the configuration for dynamically creating Angular components.
|
|
121
|
+
* Contains the component name, input properties, injector, and optional child components.
|
|
122
|
+
* @interface IComponentConfig
|
|
123
|
+
* @property {string} component - The name of the component to render
|
|
124
|
+
* @property {IComponentInput} inputs - The input properties for the component
|
|
125
|
+
* @property {EnvironmentInjector | Injector} injector - The Angular injector for dependency injection
|
|
126
|
+
* @property {IComponentConfig[]} [children] - Optional child component configurations
|
|
127
|
+
* @memberOf module:engine
|
|
128
|
+
*/
|
|
129
|
+
export interface IComponentConfig {
|
|
130
|
+
component: string;
|
|
131
|
+
inputs: IComponentInput;
|
|
132
|
+
injector: EnvironmentInjector | Injector;
|
|
133
|
+
children?: IComponentConfig[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @description Metadata structure for Angular components
|
|
137
|
+
* @summary Defines the structure of metadata for Angular components, including
|
|
138
|
+
* change detection strategy, selector, standalone status, imports, template, and styles.
|
|
139
|
+
* This is used for reflection and dynamic component creation.
|
|
140
|
+
* @interface ComponentMetadata
|
|
141
|
+
* @property {number} changeDetection - The change detection strategy number
|
|
142
|
+
* @property {string} selector - The CSS selector for the component
|
|
143
|
+
* @property {boolean} standalone - Whether the component is standalone
|
|
144
|
+
* @property imports - Array of imported modules/components
|
|
145
|
+
* @property {string} template - The HTML template for the component
|
|
146
|
+
* @property {string[]} styles - Array of CSS styles for the component
|
|
147
|
+
* @memberOf module:engine
|
|
148
|
+
*/
|
|
149
|
+
export interface ComponentMetadata {
|
|
150
|
+
changeDetection: number;
|
|
151
|
+
selector: string;
|
|
152
|
+
standalone: boolean;
|
|
153
|
+
imports: (new (...args: unknown[]) => unknown)[];
|
|
154
|
+
template: string;
|
|
155
|
+
styles: string[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @description Output structure from the Angular rendering engine
|
|
159
|
+
* @summary Defines the structure of the output produced by the NgxRenderingEngine
|
|
160
|
+
* when rendering a component. Contains the component type, inputs, injector,
|
|
161
|
+
* content nodes, and child components.
|
|
162
|
+
* @typedef {Object} AngularDynamicOutput
|
|
163
|
+
* @property {Type<unknown>} component - The Angular component type
|
|
164
|
+
* @property {string} [rendererId] - Optional unique ID for the rendered component
|
|
165
|
+
* @property {Record<string, unknown>} [inputs] - Optional input properties for the component
|
|
166
|
+
* @property {Injector} [injector] - Optional Angular injector for dependency injection
|
|
167
|
+
* @property {Node[][]} [content] - Optional content nodes for projection
|
|
168
|
+
* @property {AngularDynamicOutput[]} [children] - Optional child components
|
|
169
|
+
* @property {Type<unknown>} [instance] - Optional component instance
|
|
170
|
+
* @property {FormGroup} [formGroup] - Optional component FormGroup
|
|
171
|
+
* @property {FormControl} [formControl] - Optional component FormControl
|
|
172
|
+
* @memberOf module:engine
|
|
173
|
+
*/
|
|
174
|
+
export interface AngularDynamicOutput {
|
|
175
|
+
component?: Type<unknown>;
|
|
176
|
+
rendererId?: string;
|
|
177
|
+
inputs?: Record<string, unknown>;
|
|
178
|
+
injector?: Injector;
|
|
179
|
+
content?: Node[][];
|
|
180
|
+
children?: AngularDynamicOutput[];
|
|
181
|
+
instance?: Type<unknown>;
|
|
182
|
+
formGroup?: FormGroup;
|
|
183
|
+
formControl?: FormControl;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @description Base option type for input components
|
|
187
|
+
* @summary Defines the common structure for options used in select, radio, and checkbox inputs.
|
|
188
|
+
* Contains properties for the display text, value, disabled state, CSS class, and icon.
|
|
189
|
+
* @interface InputOption
|
|
190
|
+
* @property {string} text - The display text for the option
|
|
191
|
+
* @property {string|number} value - The value associated with the option
|
|
192
|
+
* @property {StringOrBoolean} [disabled] - Whether the option is disabled
|
|
193
|
+
* @property {string} [className] - CSS class name for styling the option
|
|
194
|
+
* @property {string} [icon] - Icon to display with the option
|
|
195
|
+
* @memberOf module:engine
|
|
196
|
+
*/
|
|
197
|
+
export interface InputOption {
|
|
198
|
+
text: string;
|
|
199
|
+
value: string | number;
|
|
200
|
+
disabled?: StringOrBoolean;
|
|
201
|
+
className?: string;
|
|
202
|
+
icon?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* @description Interface for list component refresh events
|
|
206
|
+
* @summary Defines the structure of a refresh event for list components.
|
|
207
|
+
* Contains an array of key-value pairs representing the new data for the list.
|
|
208
|
+
* @interface IListComponentRefreshEvent
|
|
209
|
+
* @property {KeyValue[]} data - Array of key-value pairs representing the new data
|
|
210
|
+
* @memberOf module:engine
|
|
211
|
+
*/
|
|
212
|
+
export interface IListComponentRefreshEvent {
|
|
213
|
+
data: KeyValue[];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* @description Form service control structure
|
|
217
|
+
* @summary Defines the structure for a form control managed by the form service.
|
|
218
|
+
* Contains the FormGroup control and the associated field properties for rendering.
|
|
219
|
+
* @interface FormServiceControl
|
|
220
|
+
* @property {FormGroup} control - The Angular FormGroup for the control
|
|
221
|
+
* @property {AngularFieldDefinition} props - The field properties for rendering the control
|
|
222
|
+
* @memberOf module:engine
|
|
223
|
+
*/
|
|
224
|
+
export interface FormServiceControl {
|
|
225
|
+
control: FormGroup;
|
|
226
|
+
props: AngularFieldDefinition;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* @description Interface for list item custom events
|
|
230
|
+
* @summary Defines the structure of custom events triggered by list items.
|
|
231
|
+
* Extends BaseCustomEvent with additional properties for the action and primary key.
|
|
232
|
+
* @interface ListItemCustomEvent
|
|
233
|
+
* @property {string} action - The action performed on the list item
|
|
234
|
+
* @property {string} [pk] - Optional primary key of the affected item
|
|
235
|
+
* @property {any} data - The data associated with the event (inherited from BaseCustomEvent)
|
|
236
|
+
* @property {HTMLElement} [target] - The target element (inherited from BaseCustomEvent)
|
|
237
|
+
* @property {string} [name] - The name of the event (inherited from BaseCustomEvent)
|
|
238
|
+
* @property {string} component - The component that triggered the event (inherited from BaseCustomEvent)
|
|
239
|
+
* @memberOf module:engine
|
|
240
|
+
*/
|
|
241
|
+
export interface ListItemCustomEvent extends BaseCustomEvent {
|
|
242
|
+
action: string;
|
|
243
|
+
pk?: string;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @description Base interface for custom events
|
|
247
|
+
* @summary Defines the base structure for custom events in the application.
|
|
248
|
+
* Contains properties for the event data, target element, name, and component.
|
|
249
|
+
* @interface BaseCustomEvent
|
|
250
|
+
* @property {any} data - The data associated with the event
|
|
251
|
+
* @property {HTMLElement} [target] - The target element that triggered the event
|
|
252
|
+
* @property {string} [name] - The name of the event
|
|
253
|
+
* @property {string} component - The component that triggered the event
|
|
254
|
+
* @memberOf module:engine
|
|
255
|
+
*/
|
|
256
|
+
export interface BaseCustomEvent {
|
|
257
|
+
name: string;
|
|
258
|
+
component: string;
|
|
259
|
+
data?: unknown;
|
|
260
|
+
target?: HTMLElement;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Configuration for internationalization (i18n) resource file paths.
|
|
264
|
+
*
|
|
265
|
+
* @property prefix - The prefix to be used for the resource file path.
|
|
266
|
+
* @property suffix - The suffix to be appended to the resource file path.
|
|
267
|
+
*/
|
|
268
|
+
export interface I18nResourceConfig {
|
|
269
|
+
prefix: string;
|
|
270
|
+
suffix: string;
|
|
271
|
+
}
|
package/engine/types.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IonCheckbox, IonInput, IonSelect, IonTextarea } from '@ionic/angular';
|
|
2
2
|
import { TextFieldTypes } from '@ionic/core';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { OrderDirection } from '@decaf-ts/core';
|
|
3
|
+
import { FormGroup } from '@angular/forms';
|
|
4
|
+
import { BaseCustomEvent, FormServiceControl, InputOption } from './interfaces';
|
|
5
|
+
export type HandlerLike = Record<string, (...args: unknown[]) => unknown | Promise<unknown>>;
|
|
7
6
|
/**
|
|
8
7
|
* @description Generic key-value pair type
|
|
9
8
|
* @summary Represents a generic object with string keys and any type of values.
|
|
@@ -55,56 +54,6 @@ export type FlexPositions = ElementPositions | 'stretch' | 'middle' | 'around' |
|
|
|
55
54
|
* @memberOf module:engine
|
|
56
55
|
*/
|
|
57
56
|
export type FieldUpdateMode = 'change' | 'blur' | 'submit';
|
|
58
|
-
/**
|
|
59
|
-
* @description Metadata structure for Angular components
|
|
60
|
-
* @summary Defines the structure of metadata for Angular components, including
|
|
61
|
-
* change detection strategy, selector, standalone status, imports, template, and styles.
|
|
62
|
-
* This is used for reflection and dynamic component creation.
|
|
63
|
-
* @interface ComponentMetadata
|
|
64
|
-
* @property {number} changeDetection - The change detection strategy number
|
|
65
|
-
* @property {string} selector - The CSS selector for the component
|
|
66
|
-
* @property {boolean} standalone - Whether the component is standalone
|
|
67
|
-
* @property imports - Array of imported modules/components
|
|
68
|
-
* @property {string} template - The HTML template for the component
|
|
69
|
-
* @property {string[]} styles - Array of CSS styles for the component
|
|
70
|
-
* @memberOf module:engine
|
|
71
|
-
*/
|
|
72
|
-
export interface ComponentMetadata {
|
|
73
|
-
changeDetection: number;
|
|
74
|
-
selector: string;
|
|
75
|
-
standalone: boolean;
|
|
76
|
-
imports: (new (...args: unknown[]) => unknown)[];
|
|
77
|
-
template: string;
|
|
78
|
-
styles: string[];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @description Output structure from the Angular rendering engine
|
|
82
|
-
* @summary Defines the structure of the output produced by the NgxRenderingEngine
|
|
83
|
-
* when rendering a component. Contains the component type, inputs, injector,
|
|
84
|
-
* content nodes, and child components.
|
|
85
|
-
* @typedef {Object} AngularDynamicOutput
|
|
86
|
-
* @property {Type<unknown>} component - The Angular component type
|
|
87
|
-
* @property {string} [rendererId] - Optional unique ID for the rendered component
|
|
88
|
-
* @property {Record<string, unknown>} [inputs] - Optional input properties for the component
|
|
89
|
-
* @property {Injector} [injector] - Optional Angular injector for dependency injection
|
|
90
|
-
* @property {Node[][]} [content] - Optional content nodes for projection
|
|
91
|
-
* @property {AngularDynamicOutput[]} [children] - Optional child components
|
|
92
|
-
* @property {Type<unknown>} [instance] - Optional component instance
|
|
93
|
-
* @property {FormGroup} [formGroup] - Optional component FormGroup
|
|
94
|
-
* @property {FormControl} [formControl] - Optional component FormControl
|
|
95
|
-
* @memberOf module:engine
|
|
96
|
-
*/
|
|
97
|
-
export interface AngularDynamicOutput {
|
|
98
|
-
component: Type<unknown>;
|
|
99
|
-
rendererId?: string;
|
|
100
|
-
inputs?: Record<string, unknown>;
|
|
101
|
-
injector?: Injector;
|
|
102
|
-
content?: Node[][];
|
|
103
|
-
children?: AngularDynamicOutput[];
|
|
104
|
-
instance?: Type<unknown>;
|
|
105
|
-
formGroup?: FormGroup;
|
|
106
|
-
formControl?: FormControl;
|
|
107
|
-
}
|
|
108
57
|
/**
|
|
109
58
|
* @description Interface for models that can be rendered
|
|
110
59
|
* @summary Defines the basic structure for models that can be rendered by the engine.
|
|
@@ -157,6 +106,14 @@ export type AngularFieldDefinition = Omit<IonInput, 'ionInput' | 'ionFocus' | 'i
|
|
|
157
106
|
* @memberOf module:engine
|
|
158
107
|
*/
|
|
159
108
|
export type StringOrBoolean = 'true' | 'false' | boolean;
|
|
109
|
+
/**
|
|
110
|
+
* @description Option type for CRUD field inputs
|
|
111
|
+
* @summary Represents a union type that can be either a SelectOption or RadioOption.
|
|
112
|
+
* This is used for defining options in form fields that support both select and radio input types.
|
|
113
|
+
* @typedef {(SelectOption|RadioOption)} CrudFieldOption
|
|
114
|
+
* @memberOf module:engine
|
|
115
|
+
*/
|
|
116
|
+
export type CrudFieldOption = SelectOption | RadioOption;
|
|
160
117
|
/**
|
|
161
118
|
* @description Option type for select inputs
|
|
162
119
|
* @summary Extends the InputOption interface with a selected property to indicate
|
|
@@ -182,25 +139,6 @@ export type RadioOption = InputOption & {
|
|
|
182
139
|
* @memberOf module:engine
|
|
183
140
|
*/
|
|
184
141
|
export type CheckboxOption = RadioOption;
|
|
185
|
-
/**
|
|
186
|
-
* @description Base option type for input components
|
|
187
|
-
* @summary Defines the common structure for options used in select, radio, and checkbox inputs.
|
|
188
|
-
* Contains properties for the display text, value, disabled state, CSS class, and icon.
|
|
189
|
-
* @interface InputOption
|
|
190
|
-
* @property {string} text - The display text for the option
|
|
191
|
-
* @property {string|number} value - The value associated with the option
|
|
192
|
-
* @property {StringOrBoolean} [disabled] - Whether the option is disabled
|
|
193
|
-
* @property {string} [className] - CSS class name for styling the option
|
|
194
|
-
* @property {string} [icon] - Icon to display with the option
|
|
195
|
-
* @memberOf module:engine
|
|
196
|
-
*/
|
|
197
|
-
export interface InputOption {
|
|
198
|
-
text: string;
|
|
199
|
-
value: string | number;
|
|
200
|
-
disabled?: StringOrBoolean;
|
|
201
|
-
className?: string;
|
|
202
|
-
icon?: string;
|
|
203
|
-
}
|
|
204
142
|
/**
|
|
205
143
|
* @description Target options for HTML forms
|
|
206
144
|
* @summary Defines the possible target values for HTML forms, including standard targets
|
|
@@ -209,30 +147,6 @@ export interface InputOption {
|
|
|
209
147
|
* @memberOf module:engine
|
|
210
148
|
*/
|
|
211
149
|
export type HTMLFormTarget = '_blank' | '_self' | '_parent' | '_top' | string;
|
|
212
|
-
/**
|
|
213
|
-
* @description Interface for list component refresh events
|
|
214
|
-
* @summary Defines the structure of a refresh event for list components.
|
|
215
|
-
* Contains an array of key-value pairs representing the new data for the list.
|
|
216
|
-
* @interface IListComponentRefreshEvent
|
|
217
|
-
* @property {KeyValue[]} data - Array of key-value pairs representing the new data
|
|
218
|
-
* @memberOf module:engine
|
|
219
|
-
*/
|
|
220
|
-
export interface IListComponentRefreshEvent {
|
|
221
|
-
data: KeyValue[];
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @description Form service control structure
|
|
225
|
-
* @summary Defines the structure for a form control managed by the form service.
|
|
226
|
-
* Contains the FormGroup control and the associated field properties for rendering.
|
|
227
|
-
* @interface FormServiceControl
|
|
228
|
-
* @property {FormGroup} control - The Angular FormGroup for the control
|
|
229
|
-
* @property {AngularFieldDefinition} props - The field properties for rendering the control
|
|
230
|
-
* @memberOf module:engine
|
|
231
|
-
*/
|
|
232
|
-
export interface FormServiceControl {
|
|
233
|
-
control: FormGroup;
|
|
234
|
-
props: AngularFieldDefinition;
|
|
235
|
-
}
|
|
236
150
|
/**
|
|
237
151
|
* @description Type for form service controls
|
|
238
152
|
* @summary Defines the structure of form controls managed by the form service.
|
|
@@ -251,40 +165,6 @@ export type FormServiceControls = Record<string, Record<string, FormServiceContr
|
|
|
251
165
|
* @memberOf module:engine
|
|
252
166
|
*/
|
|
253
167
|
export type RendererCustomEvent = BaseCustomEvent & KeyValue;
|
|
254
|
-
/**
|
|
255
|
-
* @description Interface for list item custom events
|
|
256
|
-
* @summary Defines the structure of custom events triggered by list items.
|
|
257
|
-
* Extends BaseCustomEvent with additional properties for the action and primary key.
|
|
258
|
-
* @interface ListItemCustomEvent
|
|
259
|
-
* @property {string} action - The action performed on the list item
|
|
260
|
-
* @property {string} [pk] - Optional primary key of the affected item
|
|
261
|
-
* @property {any} data - The data associated with the event (inherited from BaseCustomEvent)
|
|
262
|
-
* @property {HTMLElement} [target] - The target element (inherited from BaseCustomEvent)
|
|
263
|
-
* @property {string} [name] - The name of the event (inherited from BaseCustomEvent)
|
|
264
|
-
* @property {string} component - The component that triggered the event (inherited from BaseCustomEvent)
|
|
265
|
-
* @memberOf module:engine
|
|
266
|
-
*/
|
|
267
|
-
export interface ListItemCustomEvent extends BaseCustomEvent {
|
|
268
|
-
action: string;
|
|
269
|
-
pk?: string;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* @description Base interface for custom events
|
|
273
|
-
* @summary Defines the base structure for custom events in the application.
|
|
274
|
-
* Contains properties for the event data, target element, name, and component.
|
|
275
|
-
* @interface BaseCustomEvent
|
|
276
|
-
* @property {any} data - The data associated with the event
|
|
277
|
-
* @property {HTMLElement} [target] - The target element that triggered the event
|
|
278
|
-
* @property {string} [name] - The name of the event
|
|
279
|
-
* @property {string} component - The component that triggered the event
|
|
280
|
-
* @memberOf module:engine
|
|
281
|
-
*/
|
|
282
|
-
export interface BaseCustomEvent {
|
|
283
|
-
name: string;
|
|
284
|
-
component: string;
|
|
285
|
-
data?: unknown;
|
|
286
|
-
target?: HTMLElement;
|
|
287
|
-
}
|
|
288
168
|
/**
|
|
289
169
|
* @description CRUD form event type
|
|
290
170
|
* @summary Extends BaseCustomEvent to include optional handlers for CRUD form operations.
|
|
@@ -296,38 +176,6 @@ export interface BaseCustomEvent {
|
|
|
296
176
|
export type CrudFormEvent = BaseCustomEvent & {
|
|
297
177
|
handlers?: Record<string, any>;
|
|
298
178
|
};
|
|
299
|
-
/**
|
|
300
|
-
* @description Component input properties
|
|
301
|
-
* @summary Extends FieldProperties with additional properties specific to Angular components.
|
|
302
|
-
* Includes update mode for form controls and optional FormGroup and FormControl references.
|
|
303
|
-
* @interface ComponentInput
|
|
304
|
-
* @property {FieldUpdateMode} [updateMode] - When the field value should be updated
|
|
305
|
-
* @property {FormGroup} [formGroup] - Optional FormGroup reference
|
|
306
|
-
* @property {FormControl} [formControl] - Optional FormControl reference
|
|
307
|
-
* @memberOf module:engine
|
|
308
|
-
*/
|
|
309
|
-
export interface ComponentInput extends FieldProperties {
|
|
310
|
-
updateMode?: FieldUpdateMode;
|
|
311
|
-
formGroup?: FormGroup;
|
|
312
|
-
formControl?: FormControl;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* @description Component configuration structure
|
|
316
|
-
* @summary Defines the configuration for dynamically creating Angular components.
|
|
317
|
-
* Contains the component name, input properties, injector, and optional child components.
|
|
318
|
-
* @interface ComponentConfig
|
|
319
|
-
* @property {string} component - The name of the component to render
|
|
320
|
-
* @property {ComponentInput} inputs - The input properties for the component
|
|
321
|
-
* @property {EnvironmentInjector | Injector} injector - The Angular injector for dependency injection
|
|
322
|
-
* @property {ComponentConfig[]} [children] - Optional child component configurations
|
|
323
|
-
* @memberOf module:engine
|
|
324
|
-
*/
|
|
325
|
-
export interface ComponentConfig {
|
|
326
|
-
component: string;
|
|
327
|
-
inputs: ComponentInput;
|
|
328
|
-
injector: EnvironmentInjector | Injector;
|
|
329
|
-
children?: ComponentConfig[];
|
|
330
|
-
}
|
|
331
179
|
/**
|
|
332
180
|
* @description Form parent group tuple
|
|
333
181
|
* @summary Represents a tuple containing a FormGroup and its associated string identifier.
|
|
@@ -336,46 +184,3 @@ export interface ComponentConfig {
|
|
|
336
184
|
* @memberOf module:engine
|
|
337
185
|
*/
|
|
338
186
|
export type FormParentGroup = [FormGroup, string];
|
|
339
|
-
/**
|
|
340
|
-
* @description Interface for individual filter query items
|
|
341
|
-
* @summary Defines the structure of a single filter criterion in a filter query.
|
|
342
|
-
* Each item represents one condition to be applied to the data, consisting of
|
|
343
|
-
* an index (field name), a condition (comparison operator), and a value to compare against.
|
|
344
|
-
* @interface IFilterQueryItem
|
|
345
|
-
* @property {string} [index] - Optional field name or index to filter on
|
|
346
|
-
* @property {string} [condition] - Optional comparison condition (e.g., 'Equal', 'Contains', 'Greater Than')
|
|
347
|
-
* @property {string} [value] - Optional value to compare the field against
|
|
348
|
-
* @memberOf module:engine
|
|
349
|
-
*/
|
|
350
|
-
export interface IFilterQueryItem {
|
|
351
|
-
index?: string;
|
|
352
|
-
condition?: string;
|
|
353
|
-
value?: string;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* @description Interface for sorting configuration objects
|
|
357
|
-
* @summary Defines the structure for specifying sort criteria including the field
|
|
358
|
-
* to sort by and the direction of the sort (ascending or descending).
|
|
359
|
-
* @interface ISortObject
|
|
360
|
-
* @property {string} value - The field name or property to sort by
|
|
361
|
-
* @property {OrderDirection} direction - The sort direction (ASC or DSC)
|
|
362
|
-
* @memberOf module:engine
|
|
363
|
-
*/
|
|
364
|
-
export interface ISortObject {
|
|
365
|
-
value: string;
|
|
366
|
-
direction: OrderDirection;
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* @description Interface for complete filter query configuration
|
|
370
|
-
* @summary Defines the complete structure for filter and sort operations.
|
|
371
|
-
* Combines multiple filter criteria with sorting configuration to provide
|
|
372
|
-
* comprehensive data filtering and ordering capabilities.
|
|
373
|
-
* @interface IFilterQuery
|
|
374
|
-
* @property {IFilterQueryItem[] | undefined} query - Array of filter criteria or undefined for no filtering
|
|
375
|
-
* @property {ISortObject} sort - Sorting configuration specifying field and direction
|
|
376
|
-
* @memberOf module:engine
|
|
377
|
-
*/
|
|
378
|
-
export interface IFilterQuery {
|
|
379
|
-
query: IFilterQueryItem[] | undefined;
|
|
380
|
-
sort: ISortObject;
|
|
381
|
-
}
|