@stemy/ngx-dynamic-form 10.1.3 → 10.1.4
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/README.md +27 -27
- package/bundles/stemy-ngx-dynamic-form.umd.js +2247 -2247
- package/bundles/stemy-ngx-dynamic-form.umd.js.map +1 -1
- package/bundles/stemy-ngx-dynamic-form.umd.min.js +2 -2
- package/bundles/stemy-ngx-dynamic-form.umd.min.js.map +1 -1
- package/esm2015/ngx-dynamic-form/common-types.js +591 -591
- package/esm2015/ngx-dynamic-form/components/base/dynamic-form-base.component.js +87 -87
- package/esm2015/ngx-dynamic-form/components/dynamic-form/dynamic-form.component.js +91 -91
- package/esm2015/ngx-dynamic-form/components/dynamic-form-file/dynamic-form-file.component.js +112 -112
- package/esm2015/ngx-dynamic-form/components/dynamic-form-group/dynamic-form-group.component.js +19 -19
- package/esm2015/ngx-dynamic-form/components/dynamic-form-input/dynamic-form-input.component.js +73 -73
- package/esm2015/ngx-dynamic-form/components/dynamic-form-model/dynamic-form-model.component.js +23 -23
- package/esm2015/ngx-dynamic-form/components/dynamic-form-select/dynamic-form-select.component.js +73 -73
- package/esm2015/ngx-dynamic-form/components/dynamic-form-static/dynamic-form-static.component.js +20 -20
- package/esm2015/ngx-dynamic-form/components/dynamic-forms/dynamic-forms.component.js +134 -134
- package/esm2015/ngx-dynamic-form/directives/async-submit.directive.js +89 -89
- package/esm2015/ngx-dynamic-form/directives/dynamic-form-control.directive.js +32 -32
- package/esm2015/ngx-dynamic-form/directives/dynamic-form-group.directive.js +40 -40
- package/esm2015/ngx-dynamic-form/directives/dynamic-form-template.directive.js +38 -38
- package/esm2015/ngx-dynamic-form/ngx-dynamic-form.module.js +85 -85
- package/esm2015/ngx-dynamic-form/services/dynamic-form.service.js +48 -48
- package/esm2015/ngx-dynamic-form/services/form-utilities.js +108 -108
- package/esm2015/ngx-dynamic-form/services/open-api.service.js +130 -130
- package/esm2015/public_api.js +18 -18
- package/esm2015/stemy-ngx-dynamic-form.js +8 -8
- package/fesm2015/stemy-ngx-dynamic-form.js +1690 -1690
- package/fesm2015/stemy-ngx-dynamic-form.js.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +307 -307
- package/ngx-dynamic-form/components/base/dynamic-form-base.component.d.ts +44 -44
- package/ngx-dynamic-form/components/dynamic-form/dynamic-form.component.d.ts +21 -21
- package/ngx-dynamic-form/components/dynamic-form-file/dynamic-form-file.component.d.ts +16 -16
- package/ngx-dynamic-form/components/dynamic-form-group/dynamic-form-group.component.d.ts +6 -6
- package/ngx-dynamic-form/components/dynamic-form-input/dynamic-form-input.component.d.ts +13 -13
- package/ngx-dynamic-form/components/dynamic-form-model/dynamic-form-model.component.d.ts +6 -6
- package/ngx-dynamic-form/components/dynamic-form-select/dynamic-form-select.component.d.ts +9 -9
- package/ngx-dynamic-form/components/dynamic-form-static/dynamic-form-static.component.d.ts +5 -5
- package/ngx-dynamic-form/components/dynamic-forms/dynamic-forms.component.d.ts +26 -26
- package/ngx-dynamic-form/directives/async-submit.directive.d.ts +23 -23
- package/ngx-dynamic-form/directives/dynamic-form-control.directive.d.ts +12 -12
- package/ngx-dynamic-form/directives/dynamic-form-group.directive.d.ts +14 -14
- package/ngx-dynamic-form/directives/dynamic-form-template.directive.d.ts +16 -16
- package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +20 -20
- package/ngx-dynamic-form/services/dynamic-form.service.d.ts +12 -12
- package/ngx-dynamic-form/services/form-utilities.d.ts +19 -19
- package/ngx-dynamic-form/services/open-api.service.d.ts +37 -37
- package/package.json +11 -11
- package/public_api.d.ts +17 -17
- package/stemy-ngx-dynamic-form.d.ts +7 -7
- package/stemy-ngx-dynamic-form.metadata.json +1 -1
|
@@ -1,307 +1,307 @@
|
|
|
1
|
-
import { ChangeDetectorRef, EventEmitter, InjectionToken, Injector, TemplateRef, Type, ValueProvider } from "@angular/core";
|
|
2
|
-
import { FormControl, FormGroup, ValidationErrors } from "@angular/forms";
|
|
3
|
-
import { IResolveFactory, IAsyncMessage, IRequestOptions } from "@stemy/ngx-utils";
|
|
4
|
-
export declare const FORM_GROUP_TYPE: InjectionToken<Type<IFormControlComponent>>;
|
|
5
|
-
export declare const FORM_CONTROL_PROVIDER: InjectionToken<IFormControlProvider>;
|
|
6
|
-
export interface IFormControlComponent {
|
|
7
|
-
control: IDynamicFormControl;
|
|
8
|
-
}
|
|
9
|
-
export interface IFormGroupComponent {
|
|
10
|
-
form: IDynamicForm;
|
|
11
|
-
control: IDynamicFormControl;
|
|
12
|
-
}
|
|
13
|
-
export declare abstract class FormControlComponent<T extends IFormControlData> implements IFormControlComponent {
|
|
14
|
-
control: IDynamicFormControl;
|
|
15
|
-
get form(): IDynamicFormBase;
|
|
16
|
-
get data(): T;
|
|
17
|
-
get value(): any;
|
|
18
|
-
get meta(): any;
|
|
19
|
-
get inputClass(): boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare type IFormControlProviderAcceptor = (control: IDynamicFormControl) => boolean;
|
|
22
|
-
export declare type IFormControlProviderLoader = (control: IDynamicFormControl) => Promise<any>;
|
|
23
|
-
export declare type IFormControlOptions = (control: IDynamicFormControl) => Promise<IFormControlOption[]>;
|
|
24
|
-
export declare type IFormControlSerializer = (id: string, parent: IDynamicFormControl) => Promise<any>;
|
|
25
|
-
export declare type IFormInputMask = string | RegExp;
|
|
26
|
-
export declare type IFormInputMaskFunction = (raw: string) => IFormInputMask[];
|
|
27
|
-
export declare type IFormInputUnMaskFunction = (value: string) => any;
|
|
28
|
-
export interface IFormControlProvider {
|
|
29
|
-
component: Type<IFormControlComponent>;
|
|
30
|
-
priority: number;
|
|
31
|
-
acceptor: IFormControlProviderAcceptor;
|
|
32
|
-
loader: IFormControlProviderLoader;
|
|
33
|
-
}
|
|
34
|
-
export interface IFormSerializer {
|
|
35
|
-
id: string;
|
|
36
|
-
func: IFormControlSerializer;
|
|
37
|
-
}
|
|
38
|
-
export interface IFormSerializers {
|
|
39
|
-
[id: string]: IFormControlSerializer | IResolveFactory | null;
|
|
40
|
-
}
|
|
41
|
-
export declare type DynamicFormState = "VALID" | "INVALID" | "PENDING" | "DISABLED" | "LOADING";
|
|
42
|
-
export declare type DynamicFormUpdateOn = "change" | "blur" | "submit";
|
|
43
|
-
export interface IDynamicFormControl {
|
|
44
|
-
id: string;
|
|
45
|
-
type: string;
|
|
46
|
-
data: IFormControlData;
|
|
47
|
-
visible: boolean;
|
|
48
|
-
meta: any;
|
|
49
|
-
form: IDynamicFormBase;
|
|
50
|
-
injector: Injector;
|
|
51
|
-
label: string;
|
|
52
|
-
provider: IFormControlProvider;
|
|
53
|
-
model: any;
|
|
54
|
-
formId: string;
|
|
55
|
-
errors: ValidationErrors;
|
|
56
|
-
value: any;
|
|
57
|
-
touched: boolean;
|
|
58
|
-
disabled: boolean;
|
|
59
|
-
updateOn: DynamicFormUpdateOn;
|
|
60
|
-
setValue(value: any): void;
|
|
61
|
-
getData<T extends IFormControlData>(): T;
|
|
62
|
-
getControl(id: string): IDynamicFormControl;
|
|
63
|
-
load(): Promise<any>;
|
|
64
|
-
check(): Promise<any>;
|
|
65
|
-
shouldSerialize(): Promise<boolean>;
|
|
66
|
-
shouldValidate(): Promise<boolean>;
|
|
67
|
-
serialize(): Promise<any>;
|
|
68
|
-
onFocus(): void;
|
|
69
|
-
onBlur(): void;
|
|
70
|
-
showErrors(): void;
|
|
71
|
-
}
|
|
72
|
-
export declare class DynamicFormGroup extends FormGroup implements IDynamicFormControl {
|
|
73
|
-
readonly form: IDynamicFormBase;
|
|
74
|
-
get id(): string;
|
|
75
|
-
get type(): string;
|
|
76
|
-
get data(): IFormControlData;
|
|
77
|
-
get visible(): boolean;
|
|
78
|
-
get meta(): any;
|
|
79
|
-
get injector(): Injector;
|
|
80
|
-
get label(): string;
|
|
81
|
-
get provider(): IFormControlProvider;
|
|
82
|
-
get model(): any;
|
|
83
|
-
get formId(): string;
|
|
84
|
-
get formControls(): IDynamicFormControl[];
|
|
85
|
-
get formFields(): IDynamicFormFieldSets;
|
|
86
|
-
get prefix(): string;
|
|
87
|
-
get name(): string;
|
|
88
|
-
get state(): DynamicFormState;
|
|
89
|
-
private helper;
|
|
90
|
-
private mName;
|
|
91
|
-
private mModel;
|
|
92
|
-
private mControls;
|
|
93
|
-
private mSerializers;
|
|
94
|
-
private mFieldSets;
|
|
95
|
-
private initialized;
|
|
96
|
-
private loading;
|
|
97
|
-
private changeTimer;
|
|
98
|
-
private static createFormControls;
|
|
99
|
-
private static createFormSerializers;
|
|
100
|
-
constructor(form: IDynamicFormBase, control?: IFormControl);
|
|
101
|
-
getData<T extends IFormControlData>(): T;
|
|
102
|
-
getControl(id: string): IDynamicFormControl;
|
|
103
|
-
load(): Promise<any>;
|
|
104
|
-
check(): Promise<any>;
|
|
105
|
-
shouldSerialize(): Promise<boolean>;
|
|
106
|
-
shouldValidate(): Promise<boolean>;
|
|
107
|
-
serialize(): Promise<any>;
|
|
108
|
-
onFocus(): void;
|
|
109
|
-
onBlur(): void;
|
|
110
|
-
showErrors(): void;
|
|
111
|
-
reloadControls(): Promise<any>;
|
|
112
|
-
setup(model: any, info: IDynamicFormInfo): void;
|
|
113
|
-
updateModel(control: IDynamicFormControl): void;
|
|
114
|
-
private reloadControlsFrom;
|
|
115
|
-
}
|
|
116
|
-
export declare class DynamicFormControl extends FormControl implements IDynamicFormControl {
|
|
117
|
-
private control;
|
|
118
|
-
readonly group: DynamicFormGroup;
|
|
119
|
-
get id(): string;
|
|
120
|
-
get type(): string;
|
|
121
|
-
get data(): IFormControlData;
|
|
122
|
-
get visible(): boolean;
|
|
123
|
-
get meta(): any;
|
|
124
|
-
get form(): IDynamicFormBase;
|
|
125
|
-
get injector(): Injector;
|
|
126
|
-
get label(): string;
|
|
127
|
-
get provider(): IFormControlProvider;
|
|
128
|
-
get model(): any;
|
|
129
|
-
get formId(): string;
|
|
130
|
-
private helper;
|
|
131
|
-
constructor(control: IFormControl, group: DynamicFormGroup);
|
|
132
|
-
getData<T extends IFormControlData>(): T;
|
|
133
|
-
getControl(id: string): IDynamicFormControl;
|
|
134
|
-
load(): Promise<any>;
|
|
135
|
-
check(): Promise<any>;
|
|
136
|
-
shouldSerialize(): Promise<boolean>;
|
|
137
|
-
shouldValidate(): Promise<boolean>;
|
|
138
|
-
serialize(): Promise<any>;
|
|
139
|
-
onFocus(): void;
|
|
140
|
-
onBlur(): void;
|
|
141
|
-
showErrors(): void;
|
|
142
|
-
}
|
|
143
|
-
export interface IFormControl {
|
|
144
|
-
id: string;
|
|
145
|
-
type: string;
|
|
146
|
-
visible?: boolean;
|
|
147
|
-
data?: IFormControlData;
|
|
148
|
-
}
|
|
149
|
-
export interface IFormControlData {
|
|
150
|
-
label?: string;
|
|
151
|
-
labelAlign?: string;
|
|
152
|
-
fieldSet?: string;
|
|
153
|
-
classes?: string;
|
|
154
|
-
readonly?: FormControlTesterFactory;
|
|
155
|
-
hidden?: FormControlTesterFactory;
|
|
156
|
-
shouldSerialize?: FormControlTesterFactory;
|
|
157
|
-
shouldValidate?: FormControlTesterFactory;
|
|
158
|
-
validator?: FormControlValidatorFactory;
|
|
159
|
-
validators?: FormControlValidatorFactory[];
|
|
160
|
-
updateOn?: DynamicFormUpdateOn;
|
|
161
|
-
reload?: string | string[];
|
|
162
|
-
}
|
|
163
|
-
export interface IFormInputData extends IFormControlData {
|
|
164
|
-
type?: string;
|
|
165
|
-
autocomplete?: string;
|
|
166
|
-
placeholder?: string;
|
|
167
|
-
useLanguage?: boolean;
|
|
168
|
-
mask?: IFormInputMaskFunction | IFormInputMask[];
|
|
169
|
-
unmask?: IFormInputUnMaskFunction;
|
|
170
|
-
step?: number;
|
|
171
|
-
min?: number;
|
|
172
|
-
max?: number;
|
|
173
|
-
}
|
|
174
|
-
export interface IFormSelectData extends IFormControlData {
|
|
175
|
-
options?: IFormControlOptions | IResolveFactory;
|
|
176
|
-
emptyOption?: boolean;
|
|
177
|
-
type?: string;
|
|
178
|
-
multi?: boolean;
|
|
179
|
-
}
|
|
180
|
-
export interface IFormStaticData extends IFormControlData {
|
|
181
|
-
properties?: string[];
|
|
182
|
-
style?: string;
|
|
183
|
-
}
|
|
184
|
-
export interface IFormFileData extends IFormControlData {
|
|
185
|
-
accept?: string;
|
|
186
|
-
multi?: boolean;
|
|
187
|
-
baseUrl?: string;
|
|
188
|
-
asFile?: boolean;
|
|
189
|
-
asDataUrl?: boolean;
|
|
190
|
-
uploadUrl?: string;
|
|
191
|
-
uploadOptions?: IRequestOptions;
|
|
192
|
-
createUploadData?: (file: File) => any;
|
|
193
|
-
}
|
|
194
|
-
export interface IFormModelData extends IFormControlData, IDynamicFormInfo {
|
|
195
|
-
}
|
|
196
|
-
export interface IFormFieldSet {
|
|
197
|
-
id: string;
|
|
198
|
-
classes?: string;
|
|
199
|
-
title?: string;
|
|
200
|
-
titleClasses?: string;
|
|
201
|
-
setClasses?: string;
|
|
202
|
-
controlClasses?: string;
|
|
203
|
-
}
|
|
204
|
-
export interface IFormControlOption {
|
|
205
|
-
id: any;
|
|
206
|
-
label: string;
|
|
207
|
-
selectable?: boolean;
|
|
208
|
-
}
|
|
209
|
-
export interface IDynamicFormTemplates {
|
|
210
|
-
[id: string]: TemplateRef<any>;
|
|
211
|
-
}
|
|
212
|
-
export interface IDynamicFormConfig {
|
|
213
|
-
path?: string | number | Array<string | number>;
|
|
214
|
-
name?: string;
|
|
215
|
-
classes?: string;
|
|
216
|
-
formClasses?: string;
|
|
217
|
-
innerFormClasses?: string;
|
|
218
|
-
id: string;
|
|
219
|
-
}
|
|
220
|
-
export interface IDynamicSingleFormConfig extends IDynamicFormConfig, IDynamicFormInfo {
|
|
221
|
-
data: any;
|
|
222
|
-
controlData?: IFormControlData;
|
|
223
|
-
multi?: false;
|
|
224
|
-
}
|
|
225
|
-
export interface IDynamicMultiFormConfig extends IDynamicFormConfig {
|
|
226
|
-
data: IDynamicFormsConfigs;
|
|
227
|
-
multi: true;
|
|
228
|
-
}
|
|
229
|
-
export declare type IDynamicFormsConfigs = Array<IDynamicSingleFormConfig | IDynamicMultiFormConfig>;
|
|
230
|
-
export interface IDynamicFormBase {
|
|
231
|
-
name?: string;
|
|
232
|
-
readonly?: boolean;
|
|
233
|
-
updateOn?: "change" | "blur" | "submit";
|
|
234
|
-
classes: string;
|
|
235
|
-
parent: IDynamicFormBase;
|
|
236
|
-
wrapperTemplate: TemplateRef<any>;
|
|
237
|
-
fieldSetTemplate: TemplateRef<any>;
|
|
238
|
-
controlTemplate: TemplateRef<any>;
|
|
239
|
-
controlTemplates: IDynamicFormTemplates;
|
|
240
|
-
labelTemplates: IDynamicFormTemplates;
|
|
241
|
-
inputTemplates: IDynamicFormTemplates;
|
|
242
|
-
prefixTemplates: IDynamicFormTemplates;
|
|
243
|
-
suffixTemplates: IDynamicFormTemplates;
|
|
244
|
-
setPrefixTemplates: IDynamicFormTemplates;
|
|
245
|
-
setSuffixTemplates: IDynamicFormTemplates;
|
|
246
|
-
onChange: EventEmitter<IDynamicFormControl>;
|
|
247
|
-
onStatusChange: EventEmitter<IDynamicFormBase>;
|
|
248
|
-
onInit: EventEmitter<IDynamicFormBase>;
|
|
249
|
-
onSubmit: EventEmitter<IDynamicFormBase>;
|
|
250
|
-
root?: IDynamicFormBase;
|
|
251
|
-
status: DynamicFormState;
|
|
252
|
-
injector?: Injector;
|
|
253
|
-
cdr?: ChangeDetectorRef;
|
|
254
|
-
validate(showErrors?: boolean): Promise<any>;
|
|
255
|
-
serialize(validate?: boolean): Promise<any>;
|
|
256
|
-
check(): Promise<any>;
|
|
257
|
-
getControl(id: string): IDynamicFormControl;
|
|
258
|
-
findProvider(control: IDynamicFormControl): IFormControlProvider;
|
|
259
|
-
}
|
|
260
|
-
export declare type AsyncSubmitMethod = (form: IDynamicFormBase) => Promise<IAsyncMessage>;
|
|
261
|
-
export interface IDynamicFormInfo {
|
|
262
|
-
group?: DynamicFormGroup;
|
|
263
|
-
name?: string;
|
|
264
|
-
controls?: IFormControl[];
|
|
265
|
-
serializers?: IFormSerializers;
|
|
266
|
-
fieldSets?: IFormFieldSet[];
|
|
267
|
-
}
|
|
268
|
-
export interface IDynamicForm extends IDynamicFormBase, IDynamicFormInfo {
|
|
269
|
-
data: any;
|
|
270
|
-
}
|
|
271
|
-
export interface IDynamicFormFieldSets {
|
|
272
|
-
[id: string]: IFormFieldSet;
|
|
273
|
-
}
|
|
274
|
-
export declare type FormControlTester = (control: IDynamicFormControl) => Promise<boolean>;
|
|
275
|
-
export declare type FormControlTesterFactory = FormControlTester | IResolveFactory;
|
|
276
|
-
export declare type FormControlValidator = (control: IDynamicFormControl) => Promise<string | ValidationErrors>;
|
|
277
|
-
export declare type FormControlValidatorFactory = FormControlValidator | IResolveFactory;
|
|
278
|
-
export declare function defaultSerializer(id: string, parent: IDynamicFormControl): Promise<any>;
|
|
279
|
-
export declare function FormSerializable(serializer?: IFormControlSerializer | IResolveFactory): PropertyDecorator;
|
|
280
|
-
export declare function FormInput(data?: IFormInputData): PropertyDecorator;
|
|
281
|
-
export declare function FormSelect(data?: IFormSelectData): PropertyDecorator;
|
|
282
|
-
export declare function FormStatic(data?: IFormStaticData): PropertyDecorator;
|
|
283
|
-
export declare function FormModel(data?: IFormModelData): PropertyDecorator;
|
|
284
|
-
export declare function FormFile(data?: IFormFileData): PropertyDecorator;
|
|
285
|
-
export declare function FormFieldSet(data: IFormFieldSet): ClassDecorator;
|
|
286
|
-
export interface FormGroupProvider extends ValueProvider {
|
|
287
|
-
provide: InjectionToken<Type<IFormGroupComponent>>;
|
|
288
|
-
multi?: boolean;
|
|
289
|
-
useValue: Type<IFormGroupComponent>;
|
|
290
|
-
}
|
|
291
|
-
export declare function provideFormGroup(component: Type<IFormGroupComponent>): FormGroupProvider;
|
|
292
|
-
export interface FormControlProvider {
|
|
293
|
-
provide: InjectionToken<IFormControlProvider>;
|
|
294
|
-
multi?: boolean;
|
|
295
|
-
useValue: IFormControlProvider;
|
|
296
|
-
}
|
|
297
|
-
export declare function provideFormControl(component: Type<IFormControlComponent>, acceptor: IFormControlProviderAcceptor, loader: IFormControlProviderLoader, priority?: number): FormControlProvider;
|
|
298
|
-
export declare function defineFormControl(target: any, propertyKey: string, control: IFormControl): void;
|
|
299
|
-
export declare function getFormFieldSets(target: any): IDynamicFormFieldSets;
|
|
300
|
-
export declare function getFormControl(target: any, propertyKey: string): IFormControl;
|
|
301
|
-
export declare function getFormSerializer(target: any, propertyKey: string): IFormControlSerializer | IResolveFactory;
|
|
302
|
-
export declare function createFormControl(id: string, type: string, data?: IFormControlData): IFormControl;
|
|
303
|
-
export declare function createFormInput(id: string, data: IFormInputData, type?: string): IFormControl;
|
|
304
|
-
export declare function createFormSelect(id: string, data: IFormSelectData): IFormControl;
|
|
305
|
-
export declare function createFormStatic(id: string, data: IFormStaticData): IFormControl;
|
|
306
|
-
export declare function createFormModel(id: string, data: IFormModelData): IFormControl;
|
|
307
|
-
export declare function createFormFile(id: string, data: IFormFileData): IFormControl;
|
|
1
|
+
import { ChangeDetectorRef, EventEmitter, InjectionToken, Injector, TemplateRef, Type, ValueProvider } from "@angular/core";
|
|
2
|
+
import { FormControl, FormGroup, ValidationErrors } from "@angular/forms";
|
|
3
|
+
import { IResolveFactory, IAsyncMessage, IRequestOptions } from "@stemy/ngx-utils";
|
|
4
|
+
export declare const FORM_GROUP_TYPE: InjectionToken<Type<IFormControlComponent>>;
|
|
5
|
+
export declare const FORM_CONTROL_PROVIDER: InjectionToken<IFormControlProvider>;
|
|
6
|
+
export interface IFormControlComponent {
|
|
7
|
+
control: IDynamicFormControl;
|
|
8
|
+
}
|
|
9
|
+
export interface IFormGroupComponent {
|
|
10
|
+
form: IDynamicForm;
|
|
11
|
+
control: IDynamicFormControl;
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class FormControlComponent<T extends IFormControlData> implements IFormControlComponent {
|
|
14
|
+
control: IDynamicFormControl;
|
|
15
|
+
get form(): IDynamicFormBase;
|
|
16
|
+
get data(): T;
|
|
17
|
+
get value(): any;
|
|
18
|
+
get meta(): any;
|
|
19
|
+
get inputClass(): boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare type IFormControlProviderAcceptor = (control: IDynamicFormControl) => boolean;
|
|
22
|
+
export declare type IFormControlProviderLoader = (control: IDynamicFormControl) => Promise<any>;
|
|
23
|
+
export declare type IFormControlOptions = (control: IDynamicFormControl) => Promise<IFormControlOption[]>;
|
|
24
|
+
export declare type IFormControlSerializer = (id: string, parent: IDynamicFormControl) => Promise<any>;
|
|
25
|
+
export declare type IFormInputMask = string | RegExp;
|
|
26
|
+
export declare type IFormInputMaskFunction = (raw: string) => IFormInputMask[];
|
|
27
|
+
export declare type IFormInputUnMaskFunction = (value: string) => any;
|
|
28
|
+
export interface IFormControlProvider {
|
|
29
|
+
component: Type<IFormControlComponent>;
|
|
30
|
+
priority: number;
|
|
31
|
+
acceptor: IFormControlProviderAcceptor;
|
|
32
|
+
loader: IFormControlProviderLoader;
|
|
33
|
+
}
|
|
34
|
+
export interface IFormSerializer {
|
|
35
|
+
id: string;
|
|
36
|
+
func: IFormControlSerializer;
|
|
37
|
+
}
|
|
38
|
+
export interface IFormSerializers {
|
|
39
|
+
[id: string]: IFormControlSerializer | IResolveFactory | null;
|
|
40
|
+
}
|
|
41
|
+
export declare type DynamicFormState = "VALID" | "INVALID" | "PENDING" | "DISABLED" | "LOADING";
|
|
42
|
+
export declare type DynamicFormUpdateOn = "change" | "blur" | "submit";
|
|
43
|
+
export interface IDynamicFormControl {
|
|
44
|
+
id: string;
|
|
45
|
+
type: string;
|
|
46
|
+
data: IFormControlData;
|
|
47
|
+
visible: boolean;
|
|
48
|
+
meta: any;
|
|
49
|
+
form: IDynamicFormBase;
|
|
50
|
+
injector: Injector;
|
|
51
|
+
label: string;
|
|
52
|
+
provider: IFormControlProvider;
|
|
53
|
+
model: any;
|
|
54
|
+
formId: string;
|
|
55
|
+
errors: ValidationErrors;
|
|
56
|
+
value: any;
|
|
57
|
+
touched: boolean;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
updateOn: DynamicFormUpdateOn;
|
|
60
|
+
setValue(value: any): void;
|
|
61
|
+
getData<T extends IFormControlData>(): T;
|
|
62
|
+
getControl(id: string): IDynamicFormControl;
|
|
63
|
+
load(): Promise<any>;
|
|
64
|
+
check(): Promise<any>;
|
|
65
|
+
shouldSerialize(): Promise<boolean>;
|
|
66
|
+
shouldValidate(): Promise<boolean>;
|
|
67
|
+
serialize(): Promise<any>;
|
|
68
|
+
onFocus(): void;
|
|
69
|
+
onBlur(): void;
|
|
70
|
+
showErrors(): void;
|
|
71
|
+
}
|
|
72
|
+
export declare class DynamicFormGroup extends FormGroup implements IDynamicFormControl {
|
|
73
|
+
readonly form: IDynamicFormBase;
|
|
74
|
+
get id(): string;
|
|
75
|
+
get type(): string;
|
|
76
|
+
get data(): IFormControlData;
|
|
77
|
+
get visible(): boolean;
|
|
78
|
+
get meta(): any;
|
|
79
|
+
get injector(): Injector;
|
|
80
|
+
get label(): string;
|
|
81
|
+
get provider(): IFormControlProvider;
|
|
82
|
+
get model(): any;
|
|
83
|
+
get formId(): string;
|
|
84
|
+
get formControls(): IDynamicFormControl[];
|
|
85
|
+
get formFields(): IDynamicFormFieldSets;
|
|
86
|
+
get prefix(): string;
|
|
87
|
+
get name(): string;
|
|
88
|
+
get state(): DynamicFormState;
|
|
89
|
+
private helper;
|
|
90
|
+
private mName;
|
|
91
|
+
private mModel;
|
|
92
|
+
private mControls;
|
|
93
|
+
private mSerializers;
|
|
94
|
+
private mFieldSets;
|
|
95
|
+
private initialized;
|
|
96
|
+
private loading;
|
|
97
|
+
private changeTimer;
|
|
98
|
+
private static createFormControls;
|
|
99
|
+
private static createFormSerializers;
|
|
100
|
+
constructor(form: IDynamicFormBase, control?: IFormControl);
|
|
101
|
+
getData<T extends IFormControlData>(): T;
|
|
102
|
+
getControl(id: string): IDynamicFormControl;
|
|
103
|
+
load(): Promise<any>;
|
|
104
|
+
check(): Promise<any>;
|
|
105
|
+
shouldSerialize(): Promise<boolean>;
|
|
106
|
+
shouldValidate(): Promise<boolean>;
|
|
107
|
+
serialize(): Promise<any>;
|
|
108
|
+
onFocus(): void;
|
|
109
|
+
onBlur(): void;
|
|
110
|
+
showErrors(): void;
|
|
111
|
+
reloadControls(): Promise<any>;
|
|
112
|
+
setup(model: any, info: IDynamicFormInfo): void;
|
|
113
|
+
updateModel(control: IDynamicFormControl): void;
|
|
114
|
+
private reloadControlsFrom;
|
|
115
|
+
}
|
|
116
|
+
export declare class DynamicFormControl extends FormControl implements IDynamicFormControl {
|
|
117
|
+
private control;
|
|
118
|
+
readonly group: DynamicFormGroup;
|
|
119
|
+
get id(): string;
|
|
120
|
+
get type(): string;
|
|
121
|
+
get data(): IFormControlData;
|
|
122
|
+
get visible(): boolean;
|
|
123
|
+
get meta(): any;
|
|
124
|
+
get form(): IDynamicFormBase;
|
|
125
|
+
get injector(): Injector;
|
|
126
|
+
get label(): string;
|
|
127
|
+
get provider(): IFormControlProvider;
|
|
128
|
+
get model(): any;
|
|
129
|
+
get formId(): string;
|
|
130
|
+
private helper;
|
|
131
|
+
constructor(control: IFormControl, group: DynamicFormGroup);
|
|
132
|
+
getData<T extends IFormControlData>(): T;
|
|
133
|
+
getControl(id: string): IDynamicFormControl;
|
|
134
|
+
load(): Promise<any>;
|
|
135
|
+
check(): Promise<any>;
|
|
136
|
+
shouldSerialize(): Promise<boolean>;
|
|
137
|
+
shouldValidate(): Promise<boolean>;
|
|
138
|
+
serialize(): Promise<any>;
|
|
139
|
+
onFocus(): void;
|
|
140
|
+
onBlur(): void;
|
|
141
|
+
showErrors(): void;
|
|
142
|
+
}
|
|
143
|
+
export interface IFormControl {
|
|
144
|
+
id: string;
|
|
145
|
+
type: string;
|
|
146
|
+
visible?: boolean;
|
|
147
|
+
data?: IFormControlData;
|
|
148
|
+
}
|
|
149
|
+
export interface IFormControlData {
|
|
150
|
+
label?: string;
|
|
151
|
+
labelAlign?: string;
|
|
152
|
+
fieldSet?: string;
|
|
153
|
+
classes?: string;
|
|
154
|
+
readonly?: FormControlTesterFactory;
|
|
155
|
+
hidden?: FormControlTesterFactory;
|
|
156
|
+
shouldSerialize?: FormControlTesterFactory;
|
|
157
|
+
shouldValidate?: FormControlTesterFactory;
|
|
158
|
+
validator?: FormControlValidatorFactory;
|
|
159
|
+
validators?: FormControlValidatorFactory[];
|
|
160
|
+
updateOn?: DynamicFormUpdateOn;
|
|
161
|
+
reload?: string | string[];
|
|
162
|
+
}
|
|
163
|
+
export interface IFormInputData extends IFormControlData {
|
|
164
|
+
type?: string;
|
|
165
|
+
autocomplete?: string;
|
|
166
|
+
placeholder?: string;
|
|
167
|
+
useLanguage?: boolean;
|
|
168
|
+
mask?: IFormInputMaskFunction | IFormInputMask[];
|
|
169
|
+
unmask?: IFormInputUnMaskFunction;
|
|
170
|
+
step?: number;
|
|
171
|
+
min?: number;
|
|
172
|
+
max?: number;
|
|
173
|
+
}
|
|
174
|
+
export interface IFormSelectData extends IFormControlData {
|
|
175
|
+
options?: IFormControlOptions | IResolveFactory;
|
|
176
|
+
emptyOption?: boolean;
|
|
177
|
+
type?: string;
|
|
178
|
+
multi?: boolean;
|
|
179
|
+
}
|
|
180
|
+
export interface IFormStaticData extends IFormControlData {
|
|
181
|
+
properties?: string[];
|
|
182
|
+
style?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface IFormFileData extends IFormControlData {
|
|
185
|
+
accept?: string;
|
|
186
|
+
multi?: boolean;
|
|
187
|
+
baseUrl?: string;
|
|
188
|
+
asFile?: boolean;
|
|
189
|
+
asDataUrl?: boolean;
|
|
190
|
+
uploadUrl?: string;
|
|
191
|
+
uploadOptions?: IRequestOptions;
|
|
192
|
+
createUploadData?: (file: File) => any;
|
|
193
|
+
}
|
|
194
|
+
export interface IFormModelData extends IFormControlData, IDynamicFormInfo {
|
|
195
|
+
}
|
|
196
|
+
export interface IFormFieldSet {
|
|
197
|
+
id: string;
|
|
198
|
+
classes?: string;
|
|
199
|
+
title?: string;
|
|
200
|
+
titleClasses?: string;
|
|
201
|
+
setClasses?: string;
|
|
202
|
+
controlClasses?: string;
|
|
203
|
+
}
|
|
204
|
+
export interface IFormControlOption {
|
|
205
|
+
id: any;
|
|
206
|
+
label: string;
|
|
207
|
+
selectable?: boolean;
|
|
208
|
+
}
|
|
209
|
+
export interface IDynamicFormTemplates {
|
|
210
|
+
[id: string]: TemplateRef<any>;
|
|
211
|
+
}
|
|
212
|
+
export interface IDynamicFormConfig {
|
|
213
|
+
path?: string | number | Array<string | number>;
|
|
214
|
+
name?: string;
|
|
215
|
+
classes?: string;
|
|
216
|
+
formClasses?: string;
|
|
217
|
+
innerFormClasses?: string;
|
|
218
|
+
id: string;
|
|
219
|
+
}
|
|
220
|
+
export interface IDynamicSingleFormConfig extends IDynamicFormConfig, IDynamicFormInfo {
|
|
221
|
+
data: any;
|
|
222
|
+
controlData?: IFormControlData;
|
|
223
|
+
multi?: false;
|
|
224
|
+
}
|
|
225
|
+
export interface IDynamicMultiFormConfig extends IDynamicFormConfig {
|
|
226
|
+
data: IDynamicFormsConfigs;
|
|
227
|
+
multi: true;
|
|
228
|
+
}
|
|
229
|
+
export declare type IDynamicFormsConfigs = Array<IDynamicSingleFormConfig | IDynamicMultiFormConfig>;
|
|
230
|
+
export interface IDynamicFormBase {
|
|
231
|
+
name?: string;
|
|
232
|
+
readonly?: boolean;
|
|
233
|
+
updateOn?: "change" | "blur" | "submit";
|
|
234
|
+
classes: string;
|
|
235
|
+
parent: IDynamicFormBase;
|
|
236
|
+
wrapperTemplate: TemplateRef<any>;
|
|
237
|
+
fieldSetTemplate: TemplateRef<any>;
|
|
238
|
+
controlTemplate: TemplateRef<any>;
|
|
239
|
+
controlTemplates: IDynamicFormTemplates;
|
|
240
|
+
labelTemplates: IDynamicFormTemplates;
|
|
241
|
+
inputTemplates: IDynamicFormTemplates;
|
|
242
|
+
prefixTemplates: IDynamicFormTemplates;
|
|
243
|
+
suffixTemplates: IDynamicFormTemplates;
|
|
244
|
+
setPrefixTemplates: IDynamicFormTemplates;
|
|
245
|
+
setSuffixTemplates: IDynamicFormTemplates;
|
|
246
|
+
onChange: EventEmitter<IDynamicFormControl>;
|
|
247
|
+
onStatusChange: EventEmitter<IDynamicFormBase>;
|
|
248
|
+
onInit: EventEmitter<IDynamicFormBase>;
|
|
249
|
+
onSubmit: EventEmitter<IDynamicFormBase>;
|
|
250
|
+
root?: IDynamicFormBase;
|
|
251
|
+
status: DynamicFormState;
|
|
252
|
+
injector?: Injector;
|
|
253
|
+
cdr?: ChangeDetectorRef;
|
|
254
|
+
validate(showErrors?: boolean): Promise<any>;
|
|
255
|
+
serialize(validate?: boolean): Promise<any>;
|
|
256
|
+
check(): Promise<any>;
|
|
257
|
+
getControl(id: string): IDynamicFormControl;
|
|
258
|
+
findProvider(control: IDynamicFormControl): IFormControlProvider;
|
|
259
|
+
}
|
|
260
|
+
export declare type AsyncSubmitMethod = (form: IDynamicFormBase) => Promise<IAsyncMessage>;
|
|
261
|
+
export interface IDynamicFormInfo {
|
|
262
|
+
group?: DynamicFormGroup;
|
|
263
|
+
name?: string;
|
|
264
|
+
controls?: IFormControl[];
|
|
265
|
+
serializers?: IFormSerializers;
|
|
266
|
+
fieldSets?: IFormFieldSet[];
|
|
267
|
+
}
|
|
268
|
+
export interface IDynamicForm extends IDynamicFormBase, IDynamicFormInfo {
|
|
269
|
+
data: any;
|
|
270
|
+
}
|
|
271
|
+
export interface IDynamicFormFieldSets {
|
|
272
|
+
[id: string]: IFormFieldSet;
|
|
273
|
+
}
|
|
274
|
+
export declare type FormControlTester = (control: IDynamicFormControl) => Promise<boolean>;
|
|
275
|
+
export declare type FormControlTesterFactory = FormControlTester | IResolveFactory;
|
|
276
|
+
export declare type FormControlValidator = (control: IDynamicFormControl) => Promise<string | ValidationErrors>;
|
|
277
|
+
export declare type FormControlValidatorFactory = FormControlValidator | IResolveFactory;
|
|
278
|
+
export declare function defaultSerializer(id: string, parent: IDynamicFormControl): Promise<any>;
|
|
279
|
+
export declare function FormSerializable(serializer?: IFormControlSerializer | IResolveFactory): PropertyDecorator;
|
|
280
|
+
export declare function FormInput(data?: IFormInputData): PropertyDecorator;
|
|
281
|
+
export declare function FormSelect(data?: IFormSelectData): PropertyDecorator;
|
|
282
|
+
export declare function FormStatic(data?: IFormStaticData): PropertyDecorator;
|
|
283
|
+
export declare function FormModel(data?: IFormModelData): PropertyDecorator;
|
|
284
|
+
export declare function FormFile(data?: IFormFileData): PropertyDecorator;
|
|
285
|
+
export declare function FormFieldSet(data: IFormFieldSet): ClassDecorator;
|
|
286
|
+
export interface FormGroupProvider extends ValueProvider {
|
|
287
|
+
provide: InjectionToken<Type<IFormGroupComponent>>;
|
|
288
|
+
multi?: boolean;
|
|
289
|
+
useValue: Type<IFormGroupComponent>;
|
|
290
|
+
}
|
|
291
|
+
export declare function provideFormGroup(component: Type<IFormGroupComponent>): FormGroupProvider;
|
|
292
|
+
export interface FormControlProvider {
|
|
293
|
+
provide: InjectionToken<IFormControlProvider>;
|
|
294
|
+
multi?: boolean;
|
|
295
|
+
useValue: IFormControlProvider;
|
|
296
|
+
}
|
|
297
|
+
export declare function provideFormControl(component: Type<IFormControlComponent>, acceptor: IFormControlProviderAcceptor, loader: IFormControlProviderLoader, priority?: number): FormControlProvider;
|
|
298
|
+
export declare function defineFormControl(target: any, propertyKey: string, control: IFormControl): void;
|
|
299
|
+
export declare function getFormFieldSets(target: any): IDynamicFormFieldSets;
|
|
300
|
+
export declare function getFormControl(target: any, propertyKey: string): IFormControl;
|
|
301
|
+
export declare function getFormSerializer(target: any, propertyKey: string): IFormControlSerializer | IResolveFactory;
|
|
302
|
+
export declare function createFormControl(id: string, type: string, data?: IFormControlData): IFormControl;
|
|
303
|
+
export declare function createFormInput(id: string, data: IFormInputData, type?: string): IFormControl;
|
|
304
|
+
export declare function createFormSelect(id: string, data: IFormSelectData): IFormControl;
|
|
305
|
+
export declare function createFormStatic(id: string, data: IFormStaticData): IFormControl;
|
|
306
|
+
export declare function createFormModel(id: string, data: IFormModelData): IFormControl;
|
|
307
|
+
export declare function createFormFile(id: string, data: IFormFileData): IFormControl;
|