fg-dynamic-component 1.0.1 → 1.1.0
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.
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { InputSignal, ModelSignal, OnDestroy, Type } from '@angular/core';
|
|
1
|
+
import { InputSignal, ModelSignal, OnChanges, OnDestroy, Type } from '@angular/core';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export interface FGDynamicItem {
|
|
5
|
-
type?: string | Type<unknown> | Promise<Type<unknown
|
|
5
|
+
type?: string | Type<unknown> | Promise<Type<unknown>> | (() => Promise<Type<unknown>>);
|
|
6
6
|
inputs?: Record<string, string | unknown>;
|
|
7
7
|
outputs?: Record<string, string | Function>;
|
|
8
8
|
attributes?: Record<string, string | unknown>;
|
|
9
9
|
items?: FGDynamicItem[];
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Declare components to dynamically load in static and/or dynamic way using the FGDynamicService.
|
|
13
|
+
*/
|
|
11
14
|
export declare class FGDynamicService {
|
|
12
15
|
private static _components;
|
|
13
|
-
static registerComponent(name: string, type: Type<unknown> | Promise<Type<unknown>>): void;
|
|
14
|
-
static getComponent(name: string): Type<unknown> | Promise<Type<unknown
|
|
16
|
+
static registerComponent(name: string, type: Type<unknown> | Promise<Type<unknown>> | (() => Promise<Type<unknown>>)): void;
|
|
17
|
+
static getComponent(name: string): Type<unknown> | Promise<Type<unknown>> | (() => Promise<Type<unknown>>);
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Create a standalone signals based dynamic components tree through a JSON configuration with full
|
|
21
|
+
* life-cycle support for inputs, outputs, attributes, reactive forms and expressions binding evaluation.
|
|
22
|
+
*/
|
|
23
|
+
export declare class FGDynamicComponent implements OnChanges, OnDestroy {
|
|
17
24
|
configuration: InputSignal<FGDynamicItem>;
|
|
18
25
|
viewModel: ModelSignal<unknown>;
|
|
19
26
|
formGroup: InputSignal<FormGroup>;
|
|
@@ -25,23 +32,82 @@ export declare class FGDynamicComponent implements OnDestroy {
|
|
|
25
32
|
private _outputsSubscriptions;
|
|
26
33
|
private _formControl;
|
|
27
34
|
private _formControlDirective;
|
|
28
|
-
private
|
|
35
|
+
private _formControlSubscription;
|
|
29
36
|
private _component;
|
|
30
37
|
private _injector;
|
|
38
|
+
/**
|
|
39
|
+
* A callback method that is invoked immediately after the default change
|
|
40
|
+
* detector has checked data-bound properties if at least one has changed,
|
|
41
|
+
* and before the view and content children are checked.
|
|
42
|
+
*/
|
|
31
43
|
ngOnChanges(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* A method to lazy-load a component.
|
|
46
|
+
*/
|
|
32
47
|
private loadComponentAsync;
|
|
48
|
+
/**
|
|
49
|
+
* Instantiates a single component and inserts its host view into this container.
|
|
50
|
+
*/
|
|
33
51
|
private createComponent;
|
|
52
|
+
/**
|
|
53
|
+
* A method to remove the fg-dynamic tag.
|
|
54
|
+
*/
|
|
34
55
|
private removeHostElement;
|
|
56
|
+
/**
|
|
57
|
+
* Register handlers for those events by subscribing to an instance.
|
|
58
|
+
*/
|
|
35
59
|
private handleOutputs;
|
|
60
|
+
/**
|
|
61
|
+
* Construct a FormControl with an initial value.
|
|
62
|
+
*/
|
|
36
63
|
private createFormControl;
|
|
64
|
+
/**
|
|
65
|
+
* Disables/enables the control.
|
|
66
|
+
*/
|
|
37
67
|
private setFormControlStatus;
|
|
68
|
+
/**
|
|
69
|
+
* Add synchronous validators to this control.
|
|
70
|
+
*/
|
|
38
71
|
private setFormControlValidators;
|
|
72
|
+
/**
|
|
73
|
+
* Synchronizes a standalone FormControl instance to a form control element.
|
|
74
|
+
*/
|
|
39
75
|
private attachFormControlDirective;
|
|
76
|
+
/**
|
|
77
|
+
* Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
|
|
78
|
+
* @param model The object.
|
|
79
|
+
* @param property The path.
|
|
80
|
+
* @param defaultValue The resolved value.
|
|
81
|
+
*/
|
|
40
82
|
private getModelPropertyValue;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the value at path of object. If a portion of path doesn't exist, it's created.
|
|
85
|
+
* Arrays are created for missing index properties while objects are created for all other missing properties.
|
|
86
|
+
* This method mutates object.
|
|
87
|
+
* @param model The object.
|
|
88
|
+
* @param property The path.
|
|
89
|
+
* @param value The value.
|
|
90
|
+
*/
|
|
41
91
|
private setModelPropertyValue;
|
|
92
|
+
/**
|
|
93
|
+
* Updates specified input names to new values.
|
|
94
|
+
*/
|
|
42
95
|
private setInputs;
|
|
96
|
+
/**
|
|
97
|
+
* Set attribute values for an element in the DOM.
|
|
98
|
+
*/
|
|
43
99
|
private setAttributes;
|
|
100
|
+
/**
|
|
101
|
+
* Evaluates JavaScript code and executes it.
|
|
102
|
+
* @param value The JavaScript code.
|
|
103
|
+
* @param $vm The view model.
|
|
104
|
+
* @param $event The event.
|
|
105
|
+
* @returns Evaluated expression.
|
|
106
|
+
*/
|
|
44
107
|
private evaluateExpression;
|
|
108
|
+
/**
|
|
109
|
+
* A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.
|
|
110
|
+
*/
|
|
45
111
|
ngOnDestroy(): void;
|
|
46
112
|
static ɵfac: i0.ɵɵFactoryDeclaration<FGDynamicComponent, never>;
|
|
47
113
|
static ɵcmp: i0.ɵɵComponentDeclaration<FGDynamicComponent, "fg-dynamic", never, { "configuration": { "alias": "configuration"; "required": true; "isSignal": true; }; "viewModel": { "alias": "viewModel"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; }, { "viewModel": "viewModelChange"; }, never, never, true, never>;
|