@olafvv/ngx-dynamic-form 0.0.2 → 0.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.
- package/esm2022/lib/components/dynamic-form/dynamic-form.component.mjs +21 -15
- package/esm2022/lib/components/dynamic-form-field/dynamic-form-field.component.mjs +17 -3
- package/esm2022/lib/controls/button/dynamic-button.component.mjs +3 -3
- package/esm2022/lib/controls/button-toggles/dynamic-button-toggles.component.mjs +27 -0
- package/esm2022/lib/controls/button-toggles/dynamic-button-toggles.model.mjs +11 -0
- package/esm2022/lib/controls/checkbox/dynamic-checkbox.component.mjs +5 -11
- package/esm2022/lib/controls/index.mjs +2 -1
- package/esm2022/lib/controls/input/dynamic-input.component.mjs +12 -11
- package/esm2022/lib/controls/input/dynamic-input.model.mjs +2 -1
- package/esm2022/lib/controls/readonly/dynamic-readonly.component.mjs +3 -3
- package/esm2022/lib/controls/select/dynamic-select.component.mjs +5 -11
- package/esm2022/lib/controls/textarea/dynamic-textarea.component.mjs +12 -11
- package/esm2022/lib/models/classes/dynamic-form-field-base.mjs +28 -0
- package/esm2022/lib/models/classes/dynamic-form-field-model.mjs +1 -1
- package/esm2022/lib/models/constants/dynamic-relations.const.mjs +2 -15
- package/esm2022/lib/models/index.mjs +4 -3
- package/esm2022/lib/models/interfaces/dynamic-form-field-config.interface.mjs +1 -1
- package/esm2022/lib/models/interfaces/dynamic-form-field-event.interface.mjs +2 -0
- package/esm2022/lib/models/interfaces/dynamic-form-field-relation.interface.mjs +15 -0
- package/esm2022/lib/services/dynamic-form-relations.service.mjs +3 -2
- package/esm2022/lib/services/dynamic-form.service.mjs +12 -8
- package/fesm2022/olafvv-ngx-dynamic-form.mjs +186 -146
- package/fesm2022/olafvv-ngx-dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic-form/dynamic-form.component.d.ts +15 -9
- package/lib/components/dynamic-form-field/dynamic-form-field.component.d.ts +6 -2
- package/lib/controls/button/dynamic-button.component.d.ts +2 -2
- package/lib/controls/button-toggles/dynamic-button-toggles.component.d.ts +13 -0
- package/lib/controls/button-toggles/dynamic-button-toggles.model.d.ts +12 -0
- package/lib/controls/checkbox/dynamic-checkbox.component.d.ts +3 -5
- package/lib/controls/index.d.ts +1 -0
- package/lib/controls/input/dynamic-input.component.d.ts +6 -6
- package/lib/controls/input/dynamic-input.model.d.ts +2 -0
- package/lib/controls/readonly/dynamic-readonly.component.d.ts +2 -2
- package/lib/controls/select/dynamic-select.component.d.ts +5 -6
- package/lib/controls/textarea/dynamic-textarea.component.d.ts +6 -6
- package/lib/models/classes/{dynamic-form-field-base-component.d.ts → dynamic-form-field-base.d.ts} +2 -8
- package/lib/models/classes/dynamic-form-field-model.d.ts +2 -3
- package/lib/models/constants/dynamic-relations.const.d.ts +1 -29
- package/lib/models/index.d.ts +3 -2
- package/lib/models/interfaces/dynamic-form-field-config.interface.d.ts +4 -5
- package/lib/models/interfaces/dynamic-form-field-event.interface.d.ts +10 -0
- package/lib/models/interfaces/dynamic-form-field-relation.interface.d.ts +29 -0
- package/lib/services/dynamic-form.service.d.ts +12 -8
- package/package.json +1 -1
- package/esm2022/lib/models/classes/dynamic-form-field-base-component.mjs +0 -34
- package/esm2022/lib/models/types/dynamic-form-hook.type.mjs +0 -2
- package/lib/models/types/dynamic-form-hook.type.d.ts +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { UntypedFormGroup } from '@angular/forms';
|
|
3
3
|
import { MatInput } from '@angular/material/input';
|
|
4
|
-
import {
|
|
4
|
+
import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
|
|
5
|
+
import { DynamicFormFieldEvent } from '../../models/interfaces/dynamic-form-field-event.interface';
|
|
5
6
|
import { DynamicInput } from './dynamic-input.model';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class DynamicInputComponent extends
|
|
8
|
+
export declare class DynamicInputComponent extends DynamicFormFieldBase {
|
|
8
9
|
input: MatInput;
|
|
9
10
|
model: DynamicInput;
|
|
10
11
|
group: UntypedFormGroup;
|
|
11
|
-
|
|
12
|
-
change: EventEmitter<any>;
|
|
13
|
-
focus: EventEmitter<any>;
|
|
12
|
+
change: EventEmitter<DynamicFormFieldEvent>;
|
|
14
13
|
get valueCount(): number;
|
|
15
14
|
get maxCountText(): string;
|
|
16
15
|
get showClear(): boolean;
|
|
16
|
+
onChange(event: Event | DynamicFormFieldEvent): void;
|
|
17
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicInputComponent, never>;
|
|
18
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicInputComponent, "dynamic-input", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicInputComponent, "dynamic-input", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
|
|
19
19
|
}
|
|
@@ -11,6 +11,7 @@ export interface DynamicInputConfig extends DynamicFormFieldValueConfig<string |
|
|
|
11
11
|
pattern?: string | RegExp;
|
|
12
12
|
autocomplete?: 'on' | 'off';
|
|
13
13
|
prefix?: string;
|
|
14
|
+
hideClearIcon?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export declare class DynamicInput extends DynamicFormFieldValueModel<string | number | Date | null> {
|
|
16
17
|
inputType: HtmlInputType;
|
|
@@ -22,6 +23,7 @@ export declare class DynamicInput extends DynamicFormFieldValueModel<string | nu
|
|
|
22
23
|
pattern: string | RegExp;
|
|
23
24
|
autocomplete: 'on' | 'off';
|
|
24
25
|
prefix: string | null;
|
|
26
|
+
hideClearIcon: boolean;
|
|
25
27
|
readonly type = "input";
|
|
26
28
|
constructor(config: DynamicInputConfig);
|
|
27
29
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UntypedFormGroup } from '@angular/forms';
|
|
2
|
-
import {
|
|
2
|
+
import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
|
|
3
3
|
import { DynamicReadonly } from './dynamic-readonly.model';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class DynamicReadonlyComponent extends
|
|
5
|
+
export declare class DynamicReadonlyComponent extends DynamicFormFieldBase {
|
|
6
6
|
model: DynamicReadonly;
|
|
7
7
|
group: UntypedFormGroup;
|
|
8
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicReadonlyComponent, never>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { UntypedFormGroup } from '@angular/forms';
|
|
3
|
-
import {
|
|
3
|
+
import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
|
|
4
4
|
import { DynamicFormFieldOption } from '../../models/classes/dynamic-form-field-option-model';
|
|
5
|
+
import { DynamicFormFieldEvent } from '../../models/interfaces/dynamic-form-field-event.interface';
|
|
5
6
|
import { DynamicSelect } from './dynamic-select.model';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class DynamicSelectComponent extends
|
|
8
|
+
export declare class DynamicSelectComponent extends DynamicFormFieldBase {
|
|
8
9
|
model: DynamicSelect<string>;
|
|
9
10
|
group: UntypedFormGroup;
|
|
10
|
-
|
|
11
|
-
change: EventEmitter<any>;
|
|
12
|
-
focus: EventEmitter<any>;
|
|
11
|
+
change: EventEmitter<DynamicFormFieldEvent>;
|
|
13
12
|
trackByFn(index: number, option: DynamicFormFieldOption<unknown>): unknown;
|
|
14
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicSelectComponent, never>;
|
|
15
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicSelectComponent, "dynamic-select", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "
|
|
14
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicSelectComponent, "dynamic-select", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
|
|
16
15
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { UntypedFormGroup } from '@angular/forms';
|
|
3
3
|
import { MatInput } from '@angular/material/input';
|
|
4
|
-
import {
|
|
4
|
+
import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
|
|
5
|
+
import { DynamicFormFieldEvent } from '../../models/interfaces/dynamic-form-field-event.interface';
|
|
5
6
|
import { DynamicTextarea } from './dynamic-textarea.model';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class DynamicTextareaComponent extends
|
|
8
|
+
export declare class DynamicTextareaComponent extends DynamicFormFieldBase {
|
|
8
9
|
textarea: MatInput;
|
|
9
10
|
model: DynamicTextarea;
|
|
10
11
|
group: UntypedFormGroup;
|
|
11
|
-
|
|
12
|
-
change: EventEmitter<any>;
|
|
13
|
-
focus: EventEmitter<any>;
|
|
12
|
+
change: EventEmitter<DynamicFormFieldEvent>;
|
|
14
13
|
get valueCount(): number;
|
|
15
14
|
get maxCountText(): string;
|
|
15
|
+
onChange(event: Event | DynamicFormFieldEvent): void;
|
|
16
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicTextareaComponent, never>;
|
|
17
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicTextareaComponent, "dynamic-textarea", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicTextareaComponent, "dynamic-textarea", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
|
|
18
18
|
}
|
package/lib/models/classes/{dynamic-form-field-base-component.d.ts → dynamic-form-field-base.d.ts}
RENAMED
|
@@ -4,23 +4,17 @@ import { DynamicFormFieldModel } from './dynamic-form-field-model';
|
|
|
4
4
|
export interface DynamicFormField {
|
|
5
5
|
group: UntypedFormGroup;
|
|
6
6
|
model: DynamicFormFieldModel;
|
|
7
|
-
blur: EventEmitter<any>;
|
|
8
7
|
change: EventEmitter<any>;
|
|
9
|
-
focus: EventEmitter<any>;
|
|
10
8
|
}
|
|
11
|
-
export declare abstract class
|
|
9
|
+
export declare abstract class DynamicFormFieldBase implements DynamicFormField {
|
|
12
10
|
group: UntypedFormGroup;
|
|
13
11
|
model: DynamicFormFieldModel;
|
|
14
|
-
blur: EventEmitter<any>;
|
|
15
12
|
change: EventEmitter<any>;
|
|
16
|
-
focus: EventEmitter<any>;
|
|
17
13
|
get id(): string;
|
|
18
14
|
get control(): AbstractControl;
|
|
19
15
|
get isValid(): boolean;
|
|
20
16
|
get isInvalid(): boolean;
|
|
21
|
-
|
|
22
|
-
onChange(ev: any): void;
|
|
23
|
-
onFocus(ev: any): void;
|
|
17
|
+
onChange(event: unknown): void;
|
|
24
18
|
resetControl(): void;
|
|
25
19
|
hasError(name: string): boolean;
|
|
26
20
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { DynamicFormFieldConfig } from '../interfaces/dynamic-form-field-config.interface';
|
|
3
|
-
import { DynamicFormFieldRelation } from '../
|
|
3
|
+
import { DynamicFormFieldRelation } from '../interfaces/dynamic-form-field-relation.interface';
|
|
4
4
|
import { DynamicFormValidator } from '../interfaces/dynamic-form-validator.interface';
|
|
5
|
-
import { DynamicFormHook } from '../types/dynamic-form-hook.type';
|
|
6
5
|
export declare abstract class DynamicFormFieldModel {
|
|
7
6
|
hidden: boolean;
|
|
8
7
|
id: string;
|
|
@@ -11,7 +10,7 @@ export declare abstract class DynamicFormFieldModel {
|
|
|
11
10
|
name: string;
|
|
12
11
|
hint: string | null;
|
|
13
12
|
validators: DynamicFormValidator[];
|
|
14
|
-
updateOn:
|
|
13
|
+
updateOn: 'submit' | 'blur' | 'change';
|
|
15
14
|
relations: DynamicFormFieldRelation[] | null;
|
|
16
15
|
disabledChange: Observable<boolean>;
|
|
17
16
|
abstract readonly type: string;
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UntypedFormControl } from '@angular/forms';
|
|
3
|
-
import { DynamicFormFieldModel } from '../classes/dynamic-form-field-model';
|
|
4
|
-
export declare enum RelationActionType {
|
|
5
|
-
DISABLED = "DISABLED",
|
|
6
|
-
ENABLED = "ENABLED",
|
|
7
|
-
HIDDEN = "HIDDEN",
|
|
8
|
-
VISIBLE = "VISIBLE",
|
|
9
|
-
REQUIRED = "REQUIRED",
|
|
10
|
-
OPTIONAL = "OPTIONAL"
|
|
11
|
-
}
|
|
12
|
-
export declare enum RelationOperator {
|
|
13
|
-
AND = "AND",
|
|
14
|
-
OR = "OR"
|
|
15
|
-
}
|
|
16
|
-
export interface RelationCondition {
|
|
17
|
-
fieldName: string;
|
|
18
|
-
value: (val: any) => boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface DynamicFormFieldRelation {
|
|
21
|
-
actionType: RelationActionType;
|
|
22
|
-
operator?: RelationOperator;
|
|
23
|
-
conditions: RelationCondition[];
|
|
24
|
-
}
|
|
25
|
-
export interface DynamicRelationAction {
|
|
26
|
-
type: RelationActionType;
|
|
27
|
-
reversedType?: string;
|
|
28
|
-
change(hasMatch: boolean, model: DynamicFormFieldModel, control: UntypedFormControl, injector: Injector): void;
|
|
29
|
-
}
|
|
1
|
+
import { DynamicRelationAction } from '../interfaces/dynamic-form-field-relation.interface';
|
|
30
2
|
export declare const RELATION_ACTIONS: DynamicRelationAction[];
|
package/lib/models/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export * from './classes/dynamic-form-field-base
|
|
1
|
+
export * from './classes/dynamic-form-field-base';
|
|
2
2
|
export * from './classes/dynamic-form-field-model';
|
|
3
3
|
export * from './classes/dynamic-form-field-option-model';
|
|
4
4
|
export * from './classes/dynamic-form-field-value-model';
|
|
5
5
|
export * from './classes/dynamic-form-validators';
|
|
6
|
-
export * from './constants/dynamic-relations.const';
|
|
7
6
|
export * from './interfaces/dynamic-form-field-config.interface';
|
|
7
|
+
export * from './interfaces/dynamic-form-field-event.interface';
|
|
8
|
+
export * from './interfaces/dynamic-form-field-relation.interface';
|
|
8
9
|
export * from './interfaces/dynamic-form-validator.interface';
|
|
9
10
|
export * from './types/dynamic-form-config.type';
|
|
10
11
|
export * from './tokens/dynamic-form-field-map-fn.token';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { DynamicFormFieldRelation } from '
|
|
2
|
-
import { DynamicFormHook } from '../types/dynamic-form-hook.type';
|
|
1
|
+
import { DynamicFormFieldRelation } from './dynamic-form-field-relation.interface';
|
|
3
2
|
import { DynamicFormValidator } from './dynamic-form-validator.interface';
|
|
4
3
|
export interface DynamicFormFieldConfig {
|
|
5
4
|
/**
|
|
@@ -52,9 +51,9 @@ export interface DynamicFormFieldConfig {
|
|
|
52
51
|
relations?: DynamicFormFieldRelation[];
|
|
53
52
|
/**
|
|
54
53
|
* Event name for the control to update on.
|
|
55
|
-
* Possible values: '
|
|
56
|
-
* Default values is '
|
|
54
|
+
* Possible values: 'change', 'blur' or 'submit'.
|
|
55
|
+
* Default values is 'blur'
|
|
57
56
|
* @optional
|
|
58
57
|
*/
|
|
59
|
-
updateOn?:
|
|
58
|
+
updateOn?: 'submit' | 'blur' | 'change';
|
|
60
59
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
|
2
|
+
import { DynamicFormFieldModel } from '../classes/dynamic-form-field-model';
|
|
3
|
+
export interface DynamicFormFieldEvent {
|
|
4
|
+
event: unknown;
|
|
5
|
+
control: UntypedFormControl;
|
|
6
|
+
form: UntypedFormGroup;
|
|
7
|
+
model: DynamicFormFieldModel;
|
|
8
|
+
type: DynamicFormFieldEventType;
|
|
9
|
+
}
|
|
10
|
+
export type DynamicFormFieldEventType = 'change' | 'blur' | 'focus';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { UntypedFormControl } from '@angular/forms';
|
|
3
|
+
import { DynamicFormFieldModel } from '../classes/dynamic-form-field-model';
|
|
4
|
+
export declare enum RelationActionType {
|
|
5
|
+
DISABLED = "DISABLED",
|
|
6
|
+
ENABLED = "ENABLED",
|
|
7
|
+
HIDDEN = "HIDDEN",
|
|
8
|
+
VISIBLE = "VISIBLE",
|
|
9
|
+
REQUIRED = "REQUIRED",
|
|
10
|
+
OPTIONAL = "OPTIONAL"
|
|
11
|
+
}
|
|
12
|
+
export declare enum RelationOperator {
|
|
13
|
+
AND = "AND",
|
|
14
|
+
OR = "OR"
|
|
15
|
+
}
|
|
16
|
+
export interface RelationCondition {
|
|
17
|
+
fieldName: string;
|
|
18
|
+
value: (val: any) => boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface DynamicFormFieldRelation {
|
|
21
|
+
actionType: RelationActionType;
|
|
22
|
+
operator?: RelationOperator;
|
|
23
|
+
conditions: RelationCondition[];
|
|
24
|
+
}
|
|
25
|
+
export interface DynamicRelationAction {
|
|
26
|
+
type: RelationActionType;
|
|
27
|
+
reversedType?: string;
|
|
28
|
+
change(hasMatch: boolean, model: DynamicFormFieldModel, control: UntypedFormControl, injector: Injector): void;
|
|
29
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
2
|
import { FormBuilder, UntypedFormGroup } from '@angular/forms';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
-
import { DynamicFormField } from '../models/classes/dynamic-form-field-base
|
|
4
|
+
import { DynamicFormField } from '../models/classes/dynamic-form-field-base';
|
|
5
5
|
import { DynamicFormFieldModel } from '../models/classes/dynamic-form-field-model';
|
|
6
6
|
import { DynamicFormFieldOption } from '../models/classes/dynamic-form-field-option-model';
|
|
7
7
|
import { DynamicFormConfig } from '../models/types/dynamic-form-config.type';
|
|
@@ -22,18 +22,22 @@ export declare class DynamicFormService {
|
|
|
22
22
|
/**
|
|
23
23
|
* Create a FormGroup from the provided form configuration.
|
|
24
24
|
* Returns a FormGroup.
|
|
25
|
-
* @param config
|
|
26
|
-
* @returns
|
|
25
|
+
* @param {DynamicFormConfig} config Configuration object of a form
|
|
26
|
+
* @returns {UntypedFormGroup}
|
|
27
27
|
*/
|
|
28
28
|
createFormGroup(config: DynamicFormConfig): UntypedFormGroup;
|
|
29
29
|
/**
|
|
30
30
|
* Transform any list (Observable) to a list of DynamicFormFieldOption which is used in any Dynamic Form Field with options (e.g. DynamicSelect).
|
|
31
|
+
* Possible to provide the method with Type definitions to define the provided list type and desired option value type:
|
|
32
|
+
*
|
|
33
|
+
* `dynamicFormService.toDynamicOptionList<T, K>(...)`
|
|
34
|
+
*
|
|
31
35
|
* Generic types:
|
|
32
|
-
* T = The type of the items in the provided list
|
|
33
|
-
* K = The type of the value inside an DynamicFormFieldOption
|
|
34
|
-
* @param listObs
|
|
35
|
-
* @param labelCb
|
|
36
|
-
* @param valueCb
|
|
36
|
+
* - T = The type of the items in the provided list
|
|
37
|
+
* - K = The type of the value inside an DynamicFormFieldOption. Default is 'string'
|
|
38
|
+
* @param listObs An Observable of a list of items of type T
|
|
39
|
+
* @param labelCb Callback to define the label of the options in the template
|
|
40
|
+
* @param valueCb Callback to define the value of the options. Must return a value of type K (default string)
|
|
37
41
|
* @returns
|
|
38
42
|
*/
|
|
39
43
|
toDynamicOptionListObs<T, K = string>(listObs: Observable<T[]>, labelCb: (item: T) => string, valueCb: (item: T) => K): Observable<DynamicFormFieldOption<K>[]>;
|
package/package.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export class DynamicFormFieldBaseComponent {
|
|
2
|
-
get id() {
|
|
3
|
-
return this.model.id ?? this.model.name;
|
|
4
|
-
}
|
|
5
|
-
get control() {
|
|
6
|
-
const ctrl = this.group.get(this.model.name);
|
|
7
|
-
if (!ctrl) {
|
|
8
|
-
throw new Error(`Provided FormGroup does not contain a control with the name ${this.model.name}`);
|
|
9
|
-
}
|
|
10
|
-
return ctrl;
|
|
11
|
-
}
|
|
12
|
-
get isValid() {
|
|
13
|
-
return this.control.valid;
|
|
14
|
-
}
|
|
15
|
-
get isInvalid() {
|
|
16
|
-
return this.control.invalid;
|
|
17
|
-
}
|
|
18
|
-
onBlur(ev) {
|
|
19
|
-
this.blur.emit(ev);
|
|
20
|
-
}
|
|
21
|
-
onChange(ev) {
|
|
22
|
-
this.change.emit(ev);
|
|
23
|
-
}
|
|
24
|
-
onFocus(ev) {
|
|
25
|
-
this.focus.emit(ev);
|
|
26
|
-
}
|
|
27
|
-
resetControl() {
|
|
28
|
-
this.group.get(this.model.name)?.reset();
|
|
29
|
-
}
|
|
30
|
-
hasError(name) {
|
|
31
|
-
return this.control.hasError(name);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pYy1mb3JtLWZpZWxkLWJhc2UtY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LWR5bmFtaWMtZm9ybS9zcmMvbGliL21vZGVscy9jbGFzc2VzL2R5bmFtaWMtZm9ybS1maWVsZC1iYXNlLWNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFZQSxNQUFNLE9BQWdCLDZCQUE2QjtJQVFqRCxJQUFJLEVBQUU7UUFDSixPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsRUFBRSxJQUFJLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDO0lBQzFDLENBQUM7SUFFRCxJQUFJLE9BQU87UUFDVCxNQUFNLElBQUksR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxJ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Whvb2sudHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHR5cGUgRHluYW1pY0Zvcm1Ib29rID0gJ3N1Ym1pdCcgfCAnYmx1cicgfCAnY2hhbmdlJztcbiJdfQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type DynamicFormHook = 'submit' | 'blur' | 'change';
|