@decaf-ts/for-angular 0.0.3 → 0.0.5
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/LICENSE.md +659 -21
- package/README.md +37 -242
- package/dist/lib/README.md +92 -0
- package/dist/lib/assets/i18n/en.json +131 -0
- package/dist/lib/assets/images/angular-logo.svg +45 -0
- package/dist/lib/assets/images/decaf-logo-black.svg +22 -0
- package/dist/lib/assets/images/decaf-logo-lw.svg +50 -0
- package/dist/lib/assets/images/decaf-logo-white.svg +22 -0
- package/dist/lib/assets/images/decaf-logo.svg +54 -0
- package/dist/lib/components/component-renderer/component-renderer.component.d.ts +267 -0
- package/dist/lib/components/crud-field/crud-field.component.d.ts +447 -0
- package/dist/lib/components/crud-form/crud-form.component.d.ts +102 -0
- package/dist/lib/components/model-renderer/model-renderer.component.d.ts +97 -0
- package/dist/lib/engine/DynamicModule.d.ts +17 -0
- package/dist/{for-angular → lib}/engine/NgxCrudFormField.d.ts +37 -30
- package/dist/lib/engine/NgxFormService.d.ts +167 -0
- package/dist/lib/engine/NgxRenderingEngine.d.ts +128 -0
- package/dist/lib/engine/NgxRenderingEngine2.d.ts +251 -0
- package/dist/lib/engine/ValidatorFactory.d.ts +15 -0
- package/dist/lib/engine/constants.d.ts +151 -0
- package/dist/lib/engine/decorators.d.ts +25 -0
- package/dist/lib/engine/index.d.ts +15 -0
- package/dist/lib/engine/types.d.ts +293 -0
- package/dist/lib/esm2022/components/component-renderer/component-renderer.component.mjs +309 -0
- package/dist/lib/esm2022/components/crud-field/crud-field.component.mjs +288 -0
- package/dist/lib/esm2022/components/crud-form/constants.mjs +14 -0
- package/dist/lib/esm2022/components/crud-form/crud-form.component.mjs +140 -0
- package/dist/lib/esm2022/components/crud-form/types.mjs +2 -0
- package/dist/lib/esm2022/components/model-renderer/model-renderer.component.mjs +137 -0
- package/dist/lib/esm2022/engine/DynamicModule.mjs +18 -0
- package/dist/lib/esm2022/engine/NgxCrudFormField.mjs +117 -0
- package/dist/lib/esm2022/engine/NgxFormService.mjs +315 -0
- package/dist/lib/esm2022/engine/NgxRenderingEngine.mjs +194 -0
- package/dist/lib/esm2022/engine/NgxRenderingEngine2.mjs +333 -0
- package/dist/lib/esm2022/engine/ValidatorFactory.mjs +102 -0
- package/dist/lib/esm2022/engine/constants.mjs +160 -0
- package/dist/lib/esm2022/engine/decorators.mjs +38 -0
- package/dist/lib/esm2022/engine/index.mjs +16 -0
- package/dist/lib/esm2022/engine/types.mjs +2 -0
- package/dist/lib/esm2022/for-angular.module.mjs +118 -0
- package/dist/lib/esm2022/interfaces.mjs +2 -0
- package/dist/lib/esm2022/public-apis.mjs +13 -0
- package/dist/lib/fesm2022/decaf-ts-for-angular.mjs +2138 -0
- package/dist/lib/fesm2022/decaf-ts-for-angular.mjs.map +1 -0
- package/dist/lib/for-angular.module.d.ts +44 -0
- package/dist/lib/interfaces.d.ts +28 -0
- package/dist/lib/public-apis.d.ts +12 -0
- package/package.json +74 -25
- package/dist/for-angular/README.md +0 -297
- package/dist/for-angular/assets/i18n/en.json +0 -21
- package/dist/for-angular/components/decaf-crud-field/decaf-crud-field.component.d.ts +0 -22
- package/dist/for-angular/components/decaf-crud-form/decaf-crud-form.component.d.ts +0 -28
- package/dist/for-angular/components/decaf-model-renderer/decaf-model-renderer.component.d.ts +0 -20
- package/dist/for-angular/directives/decaf-field.directive.d.ts +0 -8
- package/dist/for-angular/engine/DynamicModule.d.ts +0 -2
- package/dist/for-angular/engine/NgxFormService.d.ts +0 -119
- package/dist/for-angular/engine/NgxRenderingEngine.d.ts +0 -17
- package/dist/for-angular/engine/ValidatorFactory.d.ts +0 -4
- package/dist/for-angular/engine/constants.d.ts +0 -10
- package/dist/for-angular/engine/decorators.d.ts +0 -1
- package/dist/for-angular/engine/index.d.ts +0 -5
- package/dist/for-angular/engine/types.d.ts +0 -32
- package/dist/for-angular/esm2022/components/decaf-crud-field/decaf-crud-field.component.mjs +0 -66
- package/dist/for-angular/esm2022/components/decaf-crud-form/constants.mjs +0 -14
- package/dist/for-angular/esm2022/components/decaf-crud-form/decaf-crud-form.component.mjs +0 -84
- package/dist/for-angular/esm2022/components/decaf-crud-form/types.mjs +0 -2
- package/dist/for-angular/esm2022/components/decaf-model-renderer/decaf-model-renderer.component.mjs +0 -46
- package/dist/for-angular/esm2022/directives/decaf-field.directive.mjs +0 -23
- package/dist/for-angular/esm2022/engine/DynamicModule.mjs +0 -3
- package/dist/for-angular/esm2022/engine/NgxCrudFormField.mjs +0 -118
- package/dist/for-angular/esm2022/engine/NgxFormService.mjs +0 -232
- package/dist/for-angular/esm2022/engine/NgxRenderingEngine.mjs +0 -35
- package/dist/for-angular/esm2022/engine/ValidatorFactory.mjs +0 -48
- package/dist/for-angular/esm2022/engine/constants.mjs +0 -12
- package/dist/for-angular/esm2022/engine/decorators.mjs +0 -17
- package/dist/for-angular/esm2022/engine/index.mjs +0 -6
- package/dist/for-angular/esm2022/engine/types.mjs +0 -2
- package/dist/for-angular/esm2022/interfaces.mjs +0 -2
- package/dist/for-angular/esm2022/public-apis.mjs +0 -5
- package/dist/for-angular/fesm2022/decaf-ts-for-angular.mjs +0 -675
- package/dist/for-angular/fesm2022/decaf-ts-for-angular.mjs.map +0 -1
- package/dist/for-angular/interfaces.d.ts +0 -8
- package/dist/for-angular/public-apis.d.ts +0 -4
- /package/dist/{for-angular/components/decaf-crud-form → lib/components/crud-form}/constants.d.ts +0 -0
- /package/dist/{for-angular/components/decaf-crud-form → lib/components/crud-form}/types.d.ts +0 -0
- /package/dist/{for-angular → lib}/esm2022/decaf-ts-for-angular.mjs +0 -0
- /package/dist/{for-angular → lib}/index.d.ts +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { FieldDefinition, RenderingEngine } from '@decaf-ts/ui-decorators';
|
|
2
|
+
import { AngularDynamicOutput, AngularFieldDefinition, KeyValue } from './types';
|
|
3
|
+
import { Constructor, Model } from '@decaf-ts/decorator-validation';
|
|
4
|
+
import { ComponentMirror, ComponentRef, Injector, TemplateRef, Type, ViewContainerRef } from '@angular/core';
|
|
5
|
+
/**
|
|
6
|
+
* @description Angular implementation of the RenderingEngine with enhanced features
|
|
7
|
+
* @summary This class extends the base RenderingEngine to provide Angular-specific rendering capabilities
|
|
8
|
+
* with additional features compared to NgxRenderingEngine. It handles the conversion of field definitions
|
|
9
|
+
* to Angular components, manages component registration, and provides utilities for component creation
|
|
10
|
+
* and input handling. This implementation uses Angular's newer component APIs.
|
|
11
|
+
*
|
|
12
|
+
* @template AngularFieldDefinition - Type for Angular-specific field definitions
|
|
13
|
+
* @template AngularDynamicOutput - Type for Angular-specific component output
|
|
14
|
+
*
|
|
15
|
+
* @class NgxRenderingEngine2
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const engine = NgxRenderingEngine2.get();
|
|
19
|
+
* engine.initialize();
|
|
20
|
+
* const output = engine.render(myModel, {}, viewContainerRef, injector, templateRef);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @mermaid
|
|
24
|
+
* sequenceDiagram
|
|
25
|
+
* participant Client
|
|
26
|
+
* participant Engine as NgxRenderingEngine2
|
|
27
|
+
* participant Components as RegisteredComponents
|
|
28
|
+
*
|
|
29
|
+
* Client->>Engine: get()
|
|
30
|
+
* Client->>Engine: initialize()
|
|
31
|
+
* Client->>Engine: render(model, props, vcr, injector, tpl)
|
|
32
|
+
* Engine->>Engine: toFieldDefinition(model, props)
|
|
33
|
+
* Engine->>Engine: fromFieldDefinition(fieldDef, vcr, injector, tpl)
|
|
34
|
+
* Engine->>Components: components(fieldDef.tag)
|
|
35
|
+
* Components-->>Engine: component constructor
|
|
36
|
+
* Engine->>Engine: createComponent(component, inputs, metadata, vcr, injector, template)
|
|
37
|
+
* Engine-->>Client: return AngularDynamicOutput
|
|
38
|
+
*/
|
|
39
|
+
export declare class NgxRenderingEngine2 extends RenderingEngine<AngularFieldDefinition, AngularDynamicOutput> {
|
|
40
|
+
/**
|
|
41
|
+
* @description Registry of registered components
|
|
42
|
+
* @summary Static registry that maps component names to their constructors.
|
|
43
|
+
* This allows the engine to look up components by name when rendering.
|
|
44
|
+
* @type {Record<string, { constructor: Constructor<unknown> }>}
|
|
45
|
+
*/
|
|
46
|
+
private static _components;
|
|
47
|
+
/**
|
|
48
|
+
* @description Collection of child component outputs
|
|
49
|
+
* @summary Stores the outputs of child components during rendering.
|
|
50
|
+
* @type {AngularDynamicOutput[]}
|
|
51
|
+
*/
|
|
52
|
+
private _childs;
|
|
53
|
+
/**
|
|
54
|
+
* @description Current model being rendered
|
|
55
|
+
* @summary Reference to the model currently being processed by the rendering engine.
|
|
56
|
+
* @type {Model}
|
|
57
|
+
*/
|
|
58
|
+
private _model;
|
|
59
|
+
/**
|
|
60
|
+
* @description Static reference to the current instance
|
|
61
|
+
* @summary Singleton instance reference for the rendering engine.
|
|
62
|
+
* @type {Type<unknown> | undefined}
|
|
63
|
+
*/
|
|
64
|
+
private static _instance;
|
|
65
|
+
/**
|
|
66
|
+
* @description Creates a new instance of NgxRenderingEngine2
|
|
67
|
+
* @summary Initializes the rendering engine with the 'angular' engine type.
|
|
68
|
+
* This constructor sets up the base configuration needed for Angular-specific rendering.
|
|
69
|
+
*/
|
|
70
|
+
constructor();
|
|
71
|
+
/**
|
|
72
|
+
* @description Converts a field definition to an Angular component output
|
|
73
|
+
* @summary This private method takes a field definition and creates the corresponding Angular component.
|
|
74
|
+
* It handles component instantiation, input property mapping, and child component rendering.
|
|
75
|
+
* The method validates input properties against the component's metadata and processes
|
|
76
|
+
* child components recursively.
|
|
77
|
+
*
|
|
78
|
+
* @param {FieldDefinition<AngularFieldDefinition>} fieldDef - The field definition to convert
|
|
79
|
+
* @param {ViewContainerRef} vcr - The view container reference for component creation
|
|
80
|
+
* @param {Injector} injector - The Angular injector for dependency injection
|
|
81
|
+
* @param {TemplateRef<any>} tpl - The template reference for content projection
|
|
82
|
+
* @param {string} registryFormId - Form identifier for the component renderer
|
|
83
|
+
* @return {AngularDynamicOutput} The Angular component output with component reference and inputs
|
|
84
|
+
*
|
|
85
|
+
* @mermaid
|
|
86
|
+
* sequenceDiagram
|
|
87
|
+
* participant Method as fromFieldDefinition
|
|
88
|
+
* participant Components as NgxRenderingEngine2.components
|
|
89
|
+
* participant Angular as Angular Core
|
|
90
|
+
* participant Process as processChild
|
|
91
|
+
*
|
|
92
|
+
* Method->>Components: components(fieldDef.tag)
|
|
93
|
+
* Components-->>Method: component constructor
|
|
94
|
+
* Method->>Angular: reflectComponentType(component)
|
|
95
|
+
* Angular-->>Method: componentMetadata
|
|
96
|
+
* Method->>Method: Validate input properties
|
|
97
|
+
* Method->>Method: Create result object
|
|
98
|
+
* alt Has children
|
|
99
|
+
* Method->>Process: Process children recursively
|
|
100
|
+
* Process->>Method: Return processed children
|
|
101
|
+
* Method->>Angular: Create embedded view
|
|
102
|
+
* Method->>Method: Create component instance
|
|
103
|
+
* end
|
|
104
|
+
* Method-->>Caller: return AngularDynamicOutput
|
|
105
|
+
*/
|
|
106
|
+
private fromFieldDefinition;
|
|
107
|
+
/**
|
|
108
|
+
* @description Creates an Angular component instance
|
|
109
|
+
* @summary This static utility method creates an Angular component instance with the specified
|
|
110
|
+
* inputs and template. It uses Angular's component creation API to instantiate the component
|
|
111
|
+
* and then sets the input properties using the provided metadata.
|
|
112
|
+
*
|
|
113
|
+
* @param {Type<unknown>} component - The component type to create
|
|
114
|
+
* @param {KeyValue} [inputs={}] - The input properties to set on the component
|
|
115
|
+
* @param {ComponentMirror<unknown>} metadata - The component metadata for input validation
|
|
116
|
+
* @param {ViewContainerRef} vcr - The view container reference for component creation
|
|
117
|
+
* @param {Injector} injector - The Angular injector for dependency injection
|
|
118
|
+
* @param {any} [template=[]] - The template nodes to project into the component
|
|
119
|
+
* @return {ComponentRef<unknown>} The created component reference
|
|
120
|
+
*/
|
|
121
|
+
static createComponent(component: Type<unknown>, inputs: KeyValue | undefined, metadata: ComponentMirror<unknown>, vcr: ViewContainerRef, injector: Injector, template?: any): ComponentRef<unknown>;
|
|
122
|
+
/**
|
|
123
|
+
* @description Extracts decorator metadata from a model
|
|
124
|
+
* @summary This method provides access to the field definition generated from a model's
|
|
125
|
+
* decorators. It's a convenience wrapper around the toFieldDefinition method that
|
|
126
|
+
* converts a model to a field definition based on its decorators and the provided
|
|
127
|
+
* global properties.
|
|
128
|
+
*
|
|
129
|
+
* @param {Model} model - The model to extract decorators from
|
|
130
|
+
* @param {Record<string, unknown>} globalProps - Global properties to include in the field definition
|
|
131
|
+
* @return {FieldDefinition<AngularFieldDefinition>} The field definition generated from the model
|
|
132
|
+
*/
|
|
133
|
+
getDecorators(model: Model, globalProps: Record<string, unknown>): FieldDefinition<AngularFieldDefinition>;
|
|
134
|
+
/**
|
|
135
|
+
* @description Destroys the current engine instance
|
|
136
|
+
* @summary This static method clears the current instance reference, effectively
|
|
137
|
+
* destroying the singleton instance of the rendering engine. This can be used
|
|
138
|
+
* to reset the engine state or to prepare for a new instance creation.
|
|
139
|
+
*
|
|
140
|
+
* @return {Promise<void>} A promise that resolves when the instance is destroyed
|
|
141
|
+
*/
|
|
142
|
+
static destroy(): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* @description Renders a model into an Angular component output
|
|
145
|
+
* @summary This method takes a model and converts it to an Angular component output.
|
|
146
|
+
* It first stores a reference to the model, then converts it to a field definition
|
|
147
|
+
* using the base RenderingEngine's toFieldDefinition method, and finally converts
|
|
148
|
+
* that field definition to an Angular component output using fromFieldDefinition.
|
|
149
|
+
*
|
|
150
|
+
* @template M - Type extending Model
|
|
151
|
+
* @param {M} model - The model to render
|
|
152
|
+
* @param {Record<string, unknown>} globalProps - Global properties to pass to the component
|
|
153
|
+
* @param {ViewContainerRef} vcr - The view container reference for component creation
|
|
154
|
+
* @param {Injector} injector - The Angular injector for dependency injection
|
|
155
|
+
* @param {TemplateRef<any>} tpl - The template reference for content projection
|
|
156
|
+
* @return {AngularDynamicOutput} The Angular component output with component reference and inputs
|
|
157
|
+
*
|
|
158
|
+
* @mermaid
|
|
159
|
+
* sequenceDiagram
|
|
160
|
+
* participant Client as Client Code
|
|
161
|
+
* participant Render as render method
|
|
162
|
+
* participant ToField as toFieldDefinition
|
|
163
|
+
* participant FromField as fromFieldDefinition
|
|
164
|
+
*
|
|
165
|
+
* Client->>Render: render(model, globalProps, vcr, injector, tpl)
|
|
166
|
+
* Render->>Render: Store model reference
|
|
167
|
+
* Render->>ToField: toFieldDefinition(model, globalProps)
|
|
168
|
+
* ToField-->>Render: fieldDef
|
|
169
|
+
* Render->>FromField: fromFieldDefinition(fieldDef, vcr, injector, tpl)
|
|
170
|
+
* FromField-->>Render: AngularDynamicOutput
|
|
171
|
+
* Render-->>Client: return AngularDynamicOutput
|
|
172
|
+
*/
|
|
173
|
+
render<M extends Model>(model: M, globalProps: Record<string, unknown>, vcr: ViewContainerRef, injector: Injector, tpl: TemplateRef<any>): AngularDynamicOutput;
|
|
174
|
+
/**
|
|
175
|
+
* @description Initializes the rendering engine
|
|
176
|
+
* @summary This method initializes the rendering engine. It checks if the engine is already initialized
|
|
177
|
+
* and sets the initialized flag to true. This method is called before the engine is used
|
|
178
|
+
* to ensure it's properly set up for rendering operations.
|
|
179
|
+
*
|
|
180
|
+
* @param {...any[]} args - Initialization arguments
|
|
181
|
+
* @return {Promise<void>} A promise that resolves when initialization is complete
|
|
182
|
+
*/
|
|
183
|
+
initialize(...args: any[]): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* @description Registers a component with the rendering engine
|
|
186
|
+
* @summary This static method registers a component constructor with the rendering engine
|
|
187
|
+
* under a specific name. It initializes the components registry if needed and throws
|
|
188
|
+
* an error if a component is already registered under the same name to prevent
|
|
189
|
+
* accidental overrides.
|
|
190
|
+
*
|
|
191
|
+
* @param {string} name - The name to register the component under
|
|
192
|
+
* @param {Constructor<unknown>} constructor - The component constructor
|
|
193
|
+
* @return {void}
|
|
194
|
+
*/
|
|
195
|
+
static registerComponent(name: string, constructor: Constructor<unknown>): void;
|
|
196
|
+
/**
|
|
197
|
+
* @description Retrieves registered components from the rendering engine
|
|
198
|
+
* @summary This static method retrieves either all registered components or a specific component
|
|
199
|
+
* by its selector. When called without a selector, it returns an array of all registered
|
|
200
|
+
* components. When called with a selector, it returns the specific component if found,
|
|
201
|
+
* or throws an error if the component is not registered.
|
|
202
|
+
*
|
|
203
|
+
* @param {string} [selector] - Optional selector to retrieve a specific component
|
|
204
|
+
* @return {Object|Array} Either a specific component or an array of all components
|
|
205
|
+
*/
|
|
206
|
+
static components(selector?: string): object | any[];
|
|
207
|
+
/**
|
|
208
|
+
* @description Generates a key for reflection metadata
|
|
209
|
+
* @summary This static method generates a key for reflection metadata by prefixing the input key
|
|
210
|
+
* with the Angular engine's reflection prefix. This is used for storing and retrieving
|
|
211
|
+
* metadata in a namespaced way to avoid conflicts with other metadata.
|
|
212
|
+
*
|
|
213
|
+
* @param {string} key - The base key to prefix
|
|
214
|
+
* @return {string} The prefixed key for reflection metadata
|
|
215
|
+
*/
|
|
216
|
+
static key(key: string): string;
|
|
217
|
+
/**
|
|
218
|
+
* @description Sets input properties on a component instance
|
|
219
|
+
* @summary This static utility method sets input properties on a component instance
|
|
220
|
+
* based on the provided inputs object and component metadata. It handles both simple
|
|
221
|
+
* values and nested objects, recursively processing object properties. The method
|
|
222
|
+
* validates each input against the component's metadata to ensure only valid inputs
|
|
223
|
+
* are set.
|
|
224
|
+
*
|
|
225
|
+
* @param {ComponentRef<unknown>} component - The component reference to set inputs on
|
|
226
|
+
* @param {KeyValue} inputs - The input properties to set
|
|
227
|
+
* @param {ComponentMirror<unknown>} metadata - The component metadata for input validation
|
|
228
|
+
* @return {void}
|
|
229
|
+
*
|
|
230
|
+
* @mermaid
|
|
231
|
+
* sequenceDiagram
|
|
232
|
+
* participant Caller
|
|
233
|
+
* participant SetInputs as setInputs
|
|
234
|
+
* participant Parse as parseInputValue
|
|
235
|
+
* participant Component as ComponentRef
|
|
236
|
+
*
|
|
237
|
+
* Caller->>SetInputs: setInputs(component, inputs, metadata)
|
|
238
|
+
* SetInputs->>SetInputs: Iterate through inputs
|
|
239
|
+
* loop For each input
|
|
240
|
+
* SetInputs->>SetInputs: Check if input exists in metadata
|
|
241
|
+
* alt Input is 'props'
|
|
242
|
+
* SetInputs->>Parse: parseInputValue(component, value)
|
|
243
|
+
* Parse->>Parse: Recursively process nested objects
|
|
244
|
+
* Parse->>Component: setInput(key, value)
|
|
245
|
+
* else Input is valid
|
|
246
|
+
* SetInputs->>Component: setInput(key, value)
|
|
247
|
+
* end
|
|
248
|
+
* end
|
|
249
|
+
*/
|
|
250
|
+
static setInputs(component: ComponentRef<unknown>, inputs: KeyValue, metadata: ComponentMirror<unknown>): void;
|
|
251
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AbstractControl, ValidatorFn } from '@angular/forms';
|
|
2
|
+
import { PathProxy } from '@decaf-ts/decorator-validation';
|
|
3
|
+
import { FieldProperties } from '@decaf-ts/ui-decorators';
|
|
4
|
+
export declare class ValidatorFactory {
|
|
5
|
+
static spawn(fieldProps: FieldProperties, key: string): ValidatorFn;
|
|
6
|
+
/**
|
|
7
|
+
* @summary Creates a proxy wrapper for an Angular AbstractControl to assist with custom validation logic.
|
|
8
|
+
* @description Returns a structured proxy object that simulates a hierarchical tree of form values.
|
|
9
|
+
* Enables Validators handling method to access parent and child properties using consistent dot-notation in Angular forms.
|
|
10
|
+
*
|
|
11
|
+
* @param {AbstractControl} control - The control to wrap in a proxy.
|
|
12
|
+
* @returns {PathProxy<any>} A proxy object exposing form values and enabling recursive parent access.
|
|
13
|
+
*/
|
|
14
|
+
static createProxy(control: AbstractControl): PathProxy<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Angular engine key constants
|
|
3
|
+
* @summary Contains key strings used by the Angular rendering engine for reflection,
|
|
4
|
+
* dynamic component creation, and other engine operations.
|
|
5
|
+
* @typedef {Object} AngularEngineKeys
|
|
6
|
+
* @property {string} REFLECT - Prefix for reflection metadata keys
|
|
7
|
+
* @property {string} DYNAMIC - Key for dynamic component identification
|
|
8
|
+
* @property {string} ANNOTATIONS - Key for component annotations
|
|
9
|
+
* @property {string} ECMP - Key for embedded components
|
|
10
|
+
* @property {string} NG_REFLECT - Prefix for Angular reflection attributes
|
|
11
|
+
* @property {string} RENDERED - Prefix for rendered component markers
|
|
12
|
+
* @property {string} MAPPER - Key for property mappers
|
|
13
|
+
* @property {string} CHILDREN - Key for child components
|
|
14
|
+
* @property {string} LISTABLE - Key for listable components
|
|
15
|
+
* @property {string} RENDER - Key for renderable components
|
|
16
|
+
* @property {string} RENDERED_ID - Template for rendered component IDs
|
|
17
|
+
* @property {string} PARENT - Key for comparison decorators and validators
|
|
18
|
+
* @const AngularEngineKeys
|
|
19
|
+
* @memberOf module:engine
|
|
20
|
+
*/
|
|
21
|
+
export declare const AngularEngineKeys: {
|
|
22
|
+
REFLECT: string;
|
|
23
|
+
DYNAMIC: string;
|
|
24
|
+
ANNOTATIONS: string;
|
|
25
|
+
ECMP: string;
|
|
26
|
+
NG_REFLECT: string;
|
|
27
|
+
RENDERED: string;
|
|
28
|
+
MAPPER: string;
|
|
29
|
+
CHILDREN: string;
|
|
30
|
+
LISTABLE: string;
|
|
31
|
+
RENDER: string;
|
|
32
|
+
RENDERED_ID: string;
|
|
33
|
+
PARENT: string;
|
|
34
|
+
VALIDATION_PARENT_KEY: symbol;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @description Form validation state constants
|
|
38
|
+
* @summary Contains constants representing the possible validation states of a form.
|
|
39
|
+
* These are used to check and handle form validation throughout the application.
|
|
40
|
+
* @typedef {Object} FormConstants
|
|
41
|
+
* @property {string} VALID - Constant representing a valid form state
|
|
42
|
+
* @property {string} INVALID - Constant representing an invalid form state
|
|
43
|
+
* @const FormConstants
|
|
44
|
+
* @memberOf module:engine
|
|
45
|
+
*/
|
|
46
|
+
export declare const FormConstants: {
|
|
47
|
+
VALID: string;
|
|
48
|
+
INVALID: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @description Event name constants
|
|
52
|
+
* @summary Enum containing constants for event names used throughout the application.
|
|
53
|
+
* These are used to standardize event naming and handling.
|
|
54
|
+
* @enum {string}
|
|
55
|
+
* @readonly
|
|
56
|
+
* @property {string} BACK_BUTTON_NAVIGATION - Event fired when back button navigation ends
|
|
57
|
+
* @property {string} REFRESH_EVENT - Event fired when a refresh action occurs
|
|
58
|
+
* @property {string} CLICK_EVENT - Event fired when a click action occurs
|
|
59
|
+
* @property {string} SUBMIT_EVENT - Event fired when a form submission occurs
|
|
60
|
+
* @memberOf module:engine
|
|
61
|
+
*/
|
|
62
|
+
export declare enum EventConstants {
|
|
63
|
+
BACK_BUTTON_NAVIGATION = "backButtonNavigationEndEvent",
|
|
64
|
+
REFRESH_EVENT = "RefreshEvent",
|
|
65
|
+
CLICK_EVENT = "ClickEvent",
|
|
66
|
+
SUBMIT_EVENT = "SubmitEvent"
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @description Logger level constants
|
|
70
|
+
* @summary Enum defining the logging levels used in the application's logging system.
|
|
71
|
+
* Lower values represent more verbose logging, while higher values represent more critical logs.
|
|
72
|
+
* @enum {number}
|
|
73
|
+
* @readonly
|
|
74
|
+
* @property {number} ALL - Log everything (most verbose)
|
|
75
|
+
* @property {number} DEBUG - Log debug information
|
|
76
|
+
* @property {number} INFO - Log informational messages
|
|
77
|
+
* @property {number} WARN - Log warnings
|
|
78
|
+
* @property {number} ERROR - Log errors
|
|
79
|
+
* @property {number} CRITICAL - Log critical errors (least verbose)
|
|
80
|
+
* @memberOf module:engine
|
|
81
|
+
*/
|
|
82
|
+
export declare enum LoggerLevels {
|
|
83
|
+
ALL = 0,
|
|
84
|
+
DEBUG = 1,
|
|
85
|
+
INFO = 2,
|
|
86
|
+
WARN = 3,
|
|
87
|
+
ERROR = 4,
|
|
88
|
+
CRITICAL = 5
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @description Route direction constants
|
|
92
|
+
* @summary Enum defining the possible navigation directions in the application.
|
|
93
|
+
* Used for controlling navigation flow and animation directions.
|
|
94
|
+
* @enum {string}
|
|
95
|
+
* @readonly
|
|
96
|
+
* @property {string} BACK - Navigate back to the previous page
|
|
97
|
+
* @property {string} FORWARD - Navigate forward to the next page
|
|
98
|
+
* @property {string} ROOT - Navigate to the root/home page
|
|
99
|
+
* @memberOf module:engine
|
|
100
|
+
*/
|
|
101
|
+
export declare enum RouteDirections {
|
|
102
|
+
BACK = "back",
|
|
103
|
+
FORWARD = "forward",
|
|
104
|
+
ROOT = "root"
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @description Component tag name constants
|
|
108
|
+
* @summary Enum defining the tag names for custom components used in the application.
|
|
109
|
+
* These tag names are used for component registration and rendering.
|
|
110
|
+
* @enum {string}
|
|
111
|
+
* @readonly
|
|
112
|
+
* @property {string} LIST_ITEM - Tag name for list item component
|
|
113
|
+
* @property {string} LIST_INFINITE - Tag name for infinite scrolling list component
|
|
114
|
+
* @property {string} LIST_PAGINATED - Tag name for paginated list component
|
|
115
|
+
* @memberOf module:engine
|
|
116
|
+
*/
|
|
117
|
+
export declare enum ComponentsTagNames {
|
|
118
|
+
LIST_ITEM = "ngx-decaf-list-item",
|
|
119
|
+
LIST_INFINITE = "ngx-decaf-list-infinite",
|
|
120
|
+
LIST_PAGINATED = "ngx-decaf-list-paginated"
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @description Base component property name constants
|
|
124
|
+
* @summary Enum defining the standard property names used by base components in the application.
|
|
125
|
+
* These property names are used for consistent property access across components.
|
|
126
|
+
* @enum {string}
|
|
127
|
+
* @readonly
|
|
128
|
+
* @property {string} MODEL - Property name for the component's data model
|
|
129
|
+
* @property {string} LOCALE - Property name for localization settings
|
|
130
|
+
* @property {string} PK - Property name for primary key
|
|
131
|
+
* @property {string} ITEMS - Property name for collection items
|
|
132
|
+
* @property {string} ROUTE - Property name for routing information
|
|
133
|
+
* @property {string} OPERATIONS - Property name for available operations
|
|
134
|
+
* @property {string} UID - Property name for unique identifier
|
|
135
|
+
* @property {string} TRANSLATABLE - Property name for translation flag
|
|
136
|
+
* @property {string} MAPPER - Property name for property mapper
|
|
137
|
+
* @property {string} INITIALIZED - Property name for initialization state
|
|
138
|
+
* @memberOf module:engine
|
|
139
|
+
*/
|
|
140
|
+
export declare enum BaseComponentProps {
|
|
141
|
+
MODEL = "model",
|
|
142
|
+
LOCALE = "locale",
|
|
143
|
+
PK = "pk",
|
|
144
|
+
ITEMS = "items",
|
|
145
|
+
ROUTE = "route",
|
|
146
|
+
OPERATIONS = "operations",
|
|
147
|
+
UID = "uid",
|
|
148
|
+
TRANSLATABLE = "translatable",
|
|
149
|
+
MAPPER = "mapper",
|
|
150
|
+
INITIALIZED = "initialized"
|
|
151
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Marks an Angular component as dynamically loadable
|
|
3
|
+
* @summary Decorator that registers an Angular component with the NgxRenderingEngine2 for dynamic loading.
|
|
4
|
+
* This decorator must be applied before the @Component decorator to properly extract component metadata.
|
|
5
|
+
* It adds metadata to the component class and registers it with the rendering engine using its selector.
|
|
6
|
+
* @function Dynamic
|
|
7
|
+
* @return {Function} A decorator function that can be applied to Angular component classes
|
|
8
|
+
* @mermaid
|
|
9
|
+
* sequenceDiagram
|
|
10
|
+
* participant C as Component Class
|
|
11
|
+
* participant D as Dynamic Decorator
|
|
12
|
+
* participant R as NgxRenderingEngine2
|
|
13
|
+
* participant M as Angular Metadata
|
|
14
|
+
* C->>D: Apply decorator
|
|
15
|
+
* D->>M: reflectComponentType()
|
|
16
|
+
* M-->>D: Return component metadata
|
|
17
|
+
* alt No metadata found
|
|
18
|
+
* D->>D: Throw InternalError
|
|
19
|
+
* else Metadata found
|
|
20
|
+
* D->>R: registerComponent(selector, constructor)
|
|
21
|
+
* D->>C: Apply metadata
|
|
22
|
+
* end
|
|
23
|
+
* @category Decorators
|
|
24
|
+
*/
|
|
25
|
+
export declare function Dynamic(): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module engine
|
|
3
|
+
* @description Angular rendering engine for Decaf applications
|
|
4
|
+
* @summary The engine module provides core functionality for rendering Angular components
|
|
5
|
+
* in Decaf applications. It includes constants, decorators, rendering engines, and utility types
|
|
6
|
+
* that enable dynamic component creation, property mapping, and component lifecycle management.
|
|
7
|
+
* Key exports include {@link NgxRenderingEngine}, {@link DynamicModule}, and various decorators
|
|
8
|
+
* for component configuration.
|
|
9
|
+
*/
|
|
10
|
+
export * from './constants';
|
|
11
|
+
export * from './decorators';
|
|
12
|
+
export * from './DynamicModule';
|
|
13
|
+
export * from './NgxRenderingEngine';
|
|
14
|
+
export * from './NgxRenderingEngine2';
|
|
15
|
+
export * from './types';
|