@olafvv/ngx-dynamic-form 19.0.1 → 20.0.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.
Files changed (43) hide show
  1. package/fesm2022/olafvv-ngx-dynamic-form.mjs +51 -51
  2. package/fesm2022/olafvv-ngx-dynamic-form.mjs.map +1 -1
  3. package/index.d.ts +561 -3
  4. package/package.json +5 -5
  5. package/lib/components/dynamic-form/dynamic-form.component.d.ts +0 -31
  6. package/lib/components/dynamic-form-field/dynamic-form-field.component.d.ts +0 -49
  7. package/lib/controls/button/dynamic-button.component.d.ts +0 -11
  8. package/lib/controls/button/dynamic-button.model.d.ts +0 -26
  9. package/lib/controls/button-toggles/dynamic-button-toggles.component.d.ts +0 -13
  10. package/lib/controls/button-toggles/dynamic-button-toggles.model.d.ts +0 -14
  11. package/lib/controls/checkbox/dynamic-checkbox.component.d.ts +0 -13
  12. package/lib/controls/checkbox/dynamic-checkbox.model.d.ts +0 -15
  13. package/lib/controls/controls.d.ts +0 -9
  14. package/lib/controls/datepicker/dynamic-datepicker.component.d.ts +0 -13
  15. package/lib/controls/datepicker/dynamic-datepicker.model.d.ts +0 -21
  16. package/lib/controls/input/dynamic-input.component.d.ts +0 -19
  17. package/lib/controls/input/dynamic-input.model.d.ts +0 -35
  18. package/lib/controls/radio-group/dynamic-radio-group.component.d.ts +0 -13
  19. package/lib/controls/radio-group/dynamic-radio-group.model.d.ts +0 -14
  20. package/lib/controls/readonly/dynamic-readonly.component.d.ts +0 -10
  21. package/lib/controls/readonly/dynamic-readonly.model.d.ts +0 -9
  22. package/lib/controls/select/dynamic-select.component.d.ts +0 -13
  23. package/lib/controls/select/dynamic-select.model.d.ts +0 -19
  24. package/lib/controls/textarea/dynamic-textarea.component.d.ts +0 -18
  25. package/lib/controls/textarea/dynamic-textarea.model.d.ts +0 -46
  26. package/lib/models/classes/dynamic-form-field-base.d.ts +0 -23
  27. package/lib/models/classes/dynamic-form-field-model.d.ts +0 -26
  28. package/lib/models/classes/dynamic-form-field-option-model.d.ts +0 -41
  29. package/lib/models/classes/dynamic-form-field-value-model.d.ts +0 -33
  30. package/lib/models/classes/dynamic-form-validators.d.ts +0 -48
  31. package/lib/models/constants/dynamic-relations.const.d.ts +0 -15
  32. package/lib/models/index.d.ts +0 -11
  33. package/lib/models/interfaces/dynamic-form-field-config.interface.d.ts +0 -68
  34. package/lib/models/interfaces/dynamic-form-field-event.interface.d.ts +0 -10
  35. package/lib/models/interfaces/dynamic-form-field-relation.interface.d.ts +0 -28
  36. package/lib/models/interfaces/dynamic-form-validator.interface.d.ts +0 -6
  37. package/lib/models/tokens/dynamic-form-field-map-fn.token.d.ts +0 -2
  38. package/lib/models/types/dynamic-form-config.type.d.ts +0 -2
  39. package/lib/models/types/related-form-controls.type.d.ts +0 -4
  40. package/lib/services/dynamic-form-relations.service.d.ts +0 -26
  41. package/lib/services/dynamic-form.service.d.ts +0 -46
  42. package/lib/services/dynamic-validations.service.d.ts +0 -20
  43. package/public-api.d.ts +0 -4
@@ -1,26 +0,0 @@
1
- import { DynamicFormFieldModel } from '../../models/classes/dynamic-form-field-model';
2
- import { DynamicFormFieldConfig } from '../../models/interfaces/dynamic-form-field-config.interface';
3
- export declare const DYNAMIC_FORM_FIELD_BUTTON = "button";
4
- type OmittedProperties = 'hint' | 'validators' | 'updateOn';
5
- /**
6
- * @TODO icon support
7
- */
8
- export interface DynamicButtonConfig extends Omit<DynamicFormFieldConfig, OmittedProperties> {
9
- /**
10
- * Label shown inside the button
11
- */
12
- label: string;
13
- /**
14
- * Function called when the button is clicked.
15
- * Provides no parameters.
16
- * @returns
17
- */
18
- onClick: () => any;
19
- }
20
- export declare class DynamicButton extends DynamicFormFieldModel {
21
- label: string | null;
22
- onClick: () => any;
23
- readonly type = "button";
24
- constructor(config: DynamicButtonConfig);
25
- }
26
- export {};
@@ -1,13 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { MatButtonToggleChange } from '@angular/material/button-toggle';
4
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
5
- import { DynamicButtonToggles } from './dynamic-button-toggles.model';
6
- import * as i0 from "@angular/core";
7
- export declare class DynamicButtonTogglesComponent extends DynamicFormFieldBase {
8
- model: DynamicButtonToggles;
9
- group: UntypedFormGroup;
10
- change: EventEmitter<MatButtonToggleChange>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<DynamicButtonTogglesComponent, never>;
12
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicButtonTogglesComponent, "dynamic-button-toggles", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
13
- }
@@ -1,14 +0,0 @@
1
- import { DynamicFormFieldOptionConfig, DynamicFormFieldOptionModel } from '../../models/classes/dynamic-form-field-option-model';
2
- export declare const DYNAMIC_FORM_FIELD_BUTTON_TOGGLES = "button-toggles";
3
- export interface DynamicButtonTogglesConfig extends Omit<DynamicFormFieldOptionConfig<string | number | null>, 'label'> {
4
- /** Whether to allow multiple options to be selected. Default is false */
5
- multiple?: boolean;
6
- /** Whether the toggle group is vertical. Default is false */
7
- vertical?: boolean;
8
- }
9
- export declare class DynamicButtonToggles extends DynamicFormFieldOptionModel<string | number | null> {
10
- multiple: boolean;
11
- vertical: boolean;
12
- readonly type: string;
13
- constructor(config: DynamicButtonTogglesConfig);
14
- }
@@ -1,13 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { MatCheckboxChange } from '@angular/material/checkbox';
4
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
5
- import { DynamicCheckbox } from './dynamic-checkbox.model';
6
- import * as i0 from "@angular/core";
7
- export declare class DynamicCheckboxComponent extends DynamicFormFieldBase {
8
- model: DynamicCheckbox;
9
- group: UntypedFormGroup;
10
- change: EventEmitter<MatCheckboxChange>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<DynamicCheckboxComponent, never>;
12
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicCheckboxComponent, "dynamic-checkbox", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
13
- }
@@ -1,15 +0,0 @@
1
- import { DynamicFormFieldValueConfig, DynamicFormFieldValueModel } from '../../models/classes/dynamic-form-field-value-model';
2
- export declare const DYNAMIC_FORM_FIELD_CHECKBOX = "checkbox";
3
- export interface DynamicCheckboxConfig extends DynamicFormFieldValueConfig<boolean> {
4
- labelPosition?: 'before' | 'after';
5
- indeterminate?: boolean;
6
- }
7
- export declare class DynamicCheckbox extends DynamicFormFieldValueModel<boolean> {
8
- labelPosition: 'before' | 'after';
9
- indeterminate: boolean;
10
- readonly type: string;
11
- constructor(config: DynamicCheckboxConfig);
12
- get checked(): boolean;
13
- set checked(checked: boolean);
14
- toggle(): void;
15
- }
@@ -1,9 +0,0 @@
1
- export * from './button-toggles/dynamic-button-toggles.model';
2
- export * from './button/dynamic-button.model';
3
- export * from './checkbox/dynamic-checkbox.model';
4
- export * from './datepicker/dynamic-datepicker.model';
5
- export * from './input/dynamic-input.model';
6
- export * from './radio-group/dynamic-radio-group.model';
7
- export * from './readonly/dynamic-readonly.model';
8
- export * from './select/dynamic-select.model';
9
- export * from './textarea/dynamic-textarea.model';
@@ -1,13 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
4
- import { DynamicFormFieldEvent } from '../../models/interfaces/dynamic-form-field-event.interface';
5
- import { DynamicDatepicker } from './dynamic-datepicker.model';
6
- import * as i0 from "@angular/core";
7
- export declare class DynamicDatepickerComponent extends DynamicFormFieldBase {
8
- model: DynamicDatepicker;
9
- group: UntypedFormGroup;
10
- change: EventEmitter<DynamicFormFieldEvent>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<DynamicDatepickerComponent, never>;
12
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicDatepickerComponent, "dynamic-datepicker", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
13
- }
@@ -1,21 +0,0 @@
1
- import { DynamicFormFieldValueConfig, DynamicFormFieldValueModel } from '../../models/classes/dynamic-form-field-value-model';
2
- export declare const DYNAMIC_FORM_FIELD_DATEPICKER = "datepicker";
3
- export type DynamicDatepickerControlValue = Date | object | string | null;
4
- export interface DynamicDatepickerConfig extends DynamicFormFieldValueConfig<DynamicDatepickerControlValue> {
5
- /** Maximum date selectable in the datepicker */
6
- max?: DynamicDatepickerControlValue;
7
- /** Minimum date selectable in the datepicker */
8
- min?: DynamicDatepickerControlValue;
9
- /** The initial date visible inside the datepicker when opening the picker */
10
- startAt?: DynamicDatepickerControlValue;
11
- /** The view the picker is initializing when opening */
12
- startView?: 'month' | 'year' | 'multi-year';
13
- }
14
- export declare class DynamicDatepicker extends DynamicFormFieldValueModel<DynamicDatepickerControlValue> {
15
- max: DynamicDatepickerControlValue | null;
16
- min: DynamicDatepickerControlValue | null;
17
- startAt: DynamicDatepickerControlValue | null;
18
- startView: 'month' | 'year' | 'multi-year';
19
- readonly type = "datepicker";
20
- constructor(config: DynamicDatepickerConfig);
21
- }
@@ -1,19 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { MatInput } from '@angular/material/input';
4
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
5
- import { DynamicFormFieldEvent } from '../../models/interfaces/dynamic-form-field-event.interface';
6
- import { DynamicInput } from './dynamic-input.model';
7
- import * as i0 from "@angular/core";
8
- export declare class DynamicInputComponent extends DynamicFormFieldBase {
9
- input: MatInput;
10
- model: DynamicInput;
11
- group: UntypedFormGroup;
12
- change: EventEmitter<DynamicFormFieldEvent>;
13
- get valueCount(): number;
14
- get maxCountText(): string;
15
- get showClear(): boolean;
16
- onChange(event: Event | DynamicFormFieldEvent): void;
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; }; }, { "change": "change"; }, never, never, true, never>;
19
- }
@@ -1,35 +0,0 @@
1
- import { WritableSignal } from '@angular/core';
2
- import { DynamicFormFieldValueConfig, DynamicFormFieldValueModel } from '../../models/classes/dynamic-form-field-value-model';
3
- export declare const DYNAMIC_FORM_FIELD_INPUT = "input";
4
- export type HtmlInputType = 'text' | 'number' | 'tel' | 'email' | 'password' | 'date' | 'time' | 'color';
5
- export type DynamicInputValue = string | number | Date | null;
6
- export interface DynamicInputConfig extends DynamicFormFieldValueConfig<DynamicInputValue> {
7
- inputType?: HtmlInputType;
8
- placeholder?: string;
9
- max?: number;
10
- min?: number;
11
- maxLength?: number;
12
- minLength?: number;
13
- step?: number;
14
- pattern?: string | RegExp;
15
- autocomplete?: 'on' | 'off';
16
- prefix?: string;
17
- hideClearIcon?: boolean;
18
- showLoader?: WritableSignal<boolean>;
19
- }
20
- export declare class DynamicInput extends DynamicFormFieldValueModel<DynamicInputValue> {
21
- inputType: HtmlInputType;
22
- placeholder: string;
23
- max: number | null;
24
- min: number | null;
25
- maxLength: number | null;
26
- minLength: number | null;
27
- step: number | null;
28
- pattern: string | RegExp;
29
- autocomplete: 'on' | 'off';
30
- prefix: string | null;
31
- hideClearIcon: boolean;
32
- showLoader: WritableSignal<boolean>;
33
- readonly type = "input";
34
- constructor(config: DynamicInputConfig);
35
- }
@@ -1,13 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { MatRadioChange } from '@angular/material/radio';
4
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
5
- import { DynamicRadioGroup } from './dynamic-radio-group.model';
6
- import * as i0 from "@angular/core";
7
- export declare class DymamicRadioGroupComponent extends DynamicFormFieldBase {
8
- model: DynamicRadioGroup;
9
- group: UntypedFormGroup;
10
- change: EventEmitter<MatRadioChange<any>>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<DymamicRadioGroupComponent, never>;
12
- static ɵcmp: i0.ɵɵComponentDeclaration<DymamicRadioGroupComponent, "dynamic-radio-group", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
13
- }
@@ -1,14 +0,0 @@
1
- import { DynamicFormFieldOptionConfig, DynamicFormFieldOptionModel } from '../../models/classes/dynamic-form-field-option-model';
2
- export declare const DYNAMIC_FORM_FIELD_RADIO_GROUP = "radio-group";
3
- export interface DynamicRadioGroupConfig extends DynamicFormFieldOptionConfig<string | number | null> {
4
- /** Placement of the option label. Default is 'before' */
5
- labelPosition?: 'before' | 'after';
6
- /** Whether the options are shown inline (horizontally). Default is false */
7
- inline?: boolean;
8
- }
9
- export declare class DynamicRadioGroup extends DynamicFormFieldOptionModel<string | number | null> {
10
- labelPosition: 'before' | 'after';
11
- inline: boolean;
12
- readonly type: string;
13
- constructor(config: DynamicRadioGroupConfig);
14
- }
@@ -1,10 +0,0 @@
1
- import { UntypedFormGroup } from '@angular/forms';
2
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
3
- import { DynamicReadonly } from './dynamic-readonly.model';
4
- import * as i0 from "@angular/core";
5
- export declare class DynamicReadonlyComponent extends DynamicFormFieldBase {
6
- model: DynamicReadonly;
7
- group: UntypedFormGroup;
8
- static ɵfac: i0.ɵɵFactoryDeclaration<DynamicReadonlyComponent, never>;
9
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicReadonlyComponent, "dynamic-readonly", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, {}, never, never, true, never>;
10
- }
@@ -1,9 +0,0 @@
1
- import { DynamicFormFieldValueConfig, DynamicFormFieldValueModel } from '../../models/classes/dynamic-form-field-value-model';
2
- export declare const DYNAMIC_FORM_FIELD_READONLY = "readonly";
3
- export type DynamicReadonlyValue = string | number | null;
4
- export interface DynamicReadonlyConfig extends Omit<DynamicFormFieldValueConfig<DynamicReadonlyValue>, 'validators' | 'relations' | 'updateOn'> {
5
- }
6
- export declare class DynamicReadonly extends DynamicFormFieldValueModel<DynamicReadonlyValue> {
7
- readonly type = "readonly";
8
- constructor(config: DynamicReadonlyConfig);
9
- }
@@ -1,13 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { MatSelectChange } from '@angular/material/select';
4
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
5
- import { DynamicSelect } from './dynamic-select.model';
6
- import * as i0 from "@angular/core";
7
- export declare class DynamicSelectComponent extends DynamicFormFieldBase {
8
- model: DynamicSelect<string>;
9
- group: UntypedFormGroup;
10
- change: EventEmitter<MatSelectChange<any>>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<DynamicSelectComponent, never>;
12
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicSelectComponent, "dynamic-select", never, { "model": { "alias": "model"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
13
- }
@@ -1,19 +0,0 @@
1
- import { DynamicFormFieldOptionConfig, DynamicFormFieldOptionModel } from '../../models/classes/dynamic-form-field-option-model';
2
- export declare const DYNAMIC_FORM_FIELD_SELECT = "select";
3
- export interface DynamicSelectConfig<T> extends DynamicFormFieldOptionConfig<T> {
4
- /**
5
- * Show the native dropdown instead of the Angular Material styled dropdown
6
- */
7
- native?: boolean;
8
- /**
9
- * Whether it is possible to select multiple options.
10
- * Default value is false
11
- */
12
- multiple?: boolean;
13
- }
14
- export declare class DynamicSelect<T> extends DynamicFormFieldOptionModel<T> {
15
- native: boolean;
16
- multiple: boolean;
17
- readonly type = "select";
18
- constructor(config: DynamicSelectConfig<T>);
19
- }
@@ -1,18 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { UntypedFormGroup } from '@angular/forms';
3
- import { MatInput } from '@angular/material/input';
4
- import { DynamicFormFieldBase } from '../../models/classes/dynamic-form-field-base';
5
- import { DynamicFormFieldEvent } from '../../models/interfaces/dynamic-form-field-event.interface';
6
- import { DynamicTextarea } from './dynamic-textarea.model';
7
- import * as i0 from "@angular/core";
8
- export declare class DynamicTextareaComponent extends DynamicFormFieldBase {
9
- textarea: MatInput;
10
- model: DynamicTextarea;
11
- group: UntypedFormGroup;
12
- change: EventEmitter<DynamicFormFieldEvent>;
13
- get valueCount(): number;
14
- get maxCountText(): string;
15
- onChange(event: Event | DynamicFormFieldEvent): void;
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; }; }, { "change": "change"; }, never, never, true, never>;
18
- }
@@ -1,46 +0,0 @@
1
- import { DynamicFormFieldValueConfig, DynamicFormFieldValueModel } from '../../models/classes/dynamic-form-field-value-model';
2
- export declare const DYNAMIC_FORM_FIELD_TEXTAREA = "textarea";
3
- export type DynamicTextareaValue = string | null;
4
- export interface DynamicTextareaConfig extends DynamicFormFieldValueConfig<DynamicTextareaValue> {
5
- /**
6
- * Placeholder text inside the textarea.
7
- * Only visible when the field is empty and in focus.
8
- */
9
- placeholder?: string;
10
- /**
11
- * Minimum amount of characters needed in the textarea
12
- */
13
- minLength?: number;
14
- /**
15
- * Maximum amount of characters it is possible to fill in the textarea
16
- */
17
- maxLength?: number;
18
- /**
19
- * Enables or disabled the browser natie autocomplete bubble when the control is in focus.
20
- * Default value is 'off'
21
- */
22
- autocomplete?: 'on' | 'off';
23
- /**
24
- * Amount of rows the textarea initializes on
25
- */
26
- rows?: number;
27
- /**
28
- * Whether the textare automatically resizes to fit its content
29
- */
30
- resize?: boolean;
31
- /**
32
- * Maximum amount of rows the textarea show resize to
33
- */
34
- resizeMaxRows?: number;
35
- }
36
- export declare class DynamicTextarea extends DynamicFormFieldValueModel<DynamicTextareaValue> {
37
- placeholder: string;
38
- minLength: number | null;
39
- maxLength: number | null;
40
- autocomplete: 'on' | 'off';
41
- rows: number;
42
- resize: boolean;
43
- resizeMaxRows: number | null;
44
- readonly type = "textarea";
45
- constructor(config: DynamicTextareaConfig);
46
- }
@@ -1,23 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { AbstractControl, UntypedFormGroup } from '@angular/forms';
3
- import { DynamicFormFieldModel } from './dynamic-form-field-model';
4
- export interface DynamicFormField {
5
- group: UntypedFormGroup;
6
- model: DynamicFormFieldModel;
7
- change: EventEmitter<any>;
8
- }
9
- /**
10
- * Base class for the DynamicFormField component classes
11
- */
12
- export declare abstract class DynamicFormFieldBase implements DynamicFormField {
13
- group: UntypedFormGroup;
14
- model: DynamicFormFieldModel;
15
- change: EventEmitter<any>;
16
- get id(): string;
17
- get control(): AbstractControl;
18
- get isValid(): boolean;
19
- get isInvalid(): boolean;
20
- onChange(event: unknown): void;
21
- resetControl(): void;
22
- hasError(name: string): boolean;
23
- }
@@ -1,26 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { DynamicFormFieldConfig } from '../interfaces/dynamic-form-field-config.interface';
3
- import { DynamicFormFieldRelation } from '../interfaces/dynamic-form-field-relation.interface';
4
- import { DynamicFormValidator } from '../interfaces/dynamic-form-validator.interface';
5
- /**
6
- * Base class for all DynamicFormFields
7
- */
8
- export declare abstract class DynamicFormFieldModel {
9
- id: string;
10
- width: number;
11
- label: string | null;
12
- name: string;
13
- hint: string | null;
14
- validators: DynamicFormValidator[];
15
- updateOn: 'submit' | 'blur' | 'change';
16
- relations: DynamicFormFieldRelation[] | null;
17
- disabledChange: Observable<boolean>;
18
- abstract readonly type: string;
19
- private readonly disabled$;
20
- private readonly $hidden;
21
- constructor(config: DynamicFormFieldConfig);
22
- get disabled(): boolean;
23
- set disabled(disable: boolean);
24
- get hidden(): boolean;
25
- set hidden(hidden: boolean);
26
- }
@@ -1,41 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { DynamicFormFieldValueConfig, DynamicFormFieldValueModel } from './dynamic-form-field-value-model';
3
- export type DynamicOptionList<T> = DynamicFormFieldOption<T>[] | Observable<DynamicFormFieldOption<T>[]>;
4
- export type DynamicGroupedOptionList<T> = DynamicFormFieldOptionGroup<T>[] | Observable<DynamicFormFieldOptionGroup<T>[]>;
5
- /**
6
- * Interface for the objects inside a list of options of Dynamic FormField
7
- */
8
- export interface DynamicFormFieldOption<T> {
9
- /** The text shown as label */
10
- label: string;
11
- /** Extra line of text shown as subtitle */
12
- subTitle?: string;
13
- /** The value the option holds */
14
- value: T;
15
- }
16
- /**
17
- * Interface for a group op options inside a Dynamic FormField (optgroup)
18
- */
19
- export interface DynamicFormFieldOptionGroup<T> {
20
- name: string;
21
- options: DynamicFormFieldOption<T>[];
22
- }
23
- /**
24
- * Base interface for any DynamicFormFieldConfig with options (e.g. DynamicSelectConfig or DynamicAutocompleteConfig).
25
- */
26
- export interface DynamicFormFieldOptionConfig<T> extends DynamicFormFieldValueConfig<T> {
27
- options?: DynamicOptionList<T>;
28
- groupedOptions?: DynamicGroupedOptionList<T>;
29
- }
30
- /**
31
- * Base class for any DynamicFormField with options (e.g. DynamicSelect or DynamicAutocomplete)
32
- */
33
- export declare abstract class DynamicFormFieldOptionModel<T> extends DynamicFormFieldValueModel<T> {
34
- options$: Observable<DynamicFormFieldOption<T>[]>;
35
- groupedOptions$: Observable<DynamicFormFieldOptionGroup<T>[]>;
36
- private _options;
37
- private _groupedOptions;
38
- constructor(config: DynamicFormFieldOptionConfig<T>);
39
- private setOptions;
40
- private setGroupedOptions;
41
- }
@@ -1,33 +0,0 @@
1
- import { DynamicFormFieldConfig } from '../interfaces/dynamic-form-field-config.interface';
2
- import { DynamicFormFieldModel } from './dynamic-form-field-model';
3
- export interface DynamicFormFieldValueConfig<T> extends DynamicFormFieldConfig {
4
- /**
5
- * The value of the control.
6
- * This value will change when the control is used.
7
- * @optional
8
- */
9
- value?: T;
10
- /**
11
- * The default value of the control when initializing or resetting the control.
12
- * @optional
13
- */
14
- defaultValue?: T;
15
- /**
16
- * A function that gets called everytime the value of the control changes.
17
- * Passes the value of the control as parameter.
18
- * If you don't want to get an event on every keystroke without delay, use the ReactiveFormsModule `valueChanges` Observable
19
- * @optional
20
- */
21
- valueChanged?: (val: T | null) => any;
22
- }
23
- /**
24
- * Base class for a DynamicFormField with a value
25
- */
26
- export declare abstract class DynamicFormFieldValueModel<T = unknown> extends DynamicFormFieldModel {
27
- defaultValue: T | null;
28
- private _value$;
29
- private _valueChanged;
30
- constructor(config: DynamicFormFieldValueConfig<T>);
31
- get value(): T | null;
32
- set value(val: T | null);
33
- }
@@ -1,48 +0,0 @@
1
- import { DynamicFormValidator } from '../interfaces/dynamic-form-validator.interface';
2
- export declare class DynamicFormValidators {
3
- /**
4
- * Default email validator, the value of the control has to be a valid email address
5
- * @param msg
6
- */
7
- static email(msg?: string): DynamicFormValidator;
8
- /**
9
- * Default min validator, the value has to be greater or equal than the the provided number
10
- * @param min number
11
- * @param msg
12
- */
13
- static min(min: number, msg?: string): DynamicFormValidator;
14
- /**
15
- * Default max validator, the value has to be less or equal than the the provided number
16
- * @param max number
17
- * @param msg
18
- */
19
- static max(max: number, msg?: string): DynamicFormValidator;
20
- /**
21
- * Default minLength validator, the value has to contain a minimum amount of characters
22
- * @param min number
23
- * @param msg
24
- */
25
- static minLength(min: number, msg?: string): DynamicFormValidator;
26
- /**
27
- * Default maxLength validator, the value has to contain a maximum amount of characters
28
- * @param max number
29
- * @param msg
30
- */
31
- static maxLength(max: number, msg?: string): DynamicFormValidator;
32
- /**
33
- * Default pattern validator, the value of the control has to match the provided pattern
34
- * @param pattern: string | RegExp
35
- * @param msg
36
- */
37
- static pattern(pattern: string | RegExp, msg?: string): DynamicFormValidator;
38
- /**
39
- * Default required validator, the control must contain a value
40
- * @param msg
41
- */
42
- static required(msg?: string): DynamicFormValidator;
43
- /**
44
- * Default requiredTrue validator, the value of the control has to be true
45
- * @param msg
46
- */
47
- static requiredTrue(msg?: string): DynamicFormValidator;
48
- }
@@ -1,15 +0,0 @@
1
- import { Injector } from '@angular/core';
2
- import { UntypedFormControl } from '@angular/forms';
3
- import { DynamicFormFieldModel } from '../classes/dynamic-form-field-model';
4
- import { RelationActionType } from '../interfaces/dynamic-form-field-relation.interface';
5
- export interface DynamicRelationAction {
6
- type: RelationActionType;
7
- reversedType?: string;
8
- change(hasMatch: boolean, model: DynamicFormFieldModel, control: UntypedFormControl, injector: Injector): void;
9
- }
10
- /**
11
- * Export all Relation actions so the DynamicFormService can easily access all Relation actions.
12
- * This way if there are any new actions, all you have to do is add them here.
13
- * TODO: This can be potentially be expanded towords an InjectionToken to provide the possibility for custom relationactions.
14
- */
15
- export declare const RELATION_ACTIONS: DynamicRelationAction[];
@@ -1,11 +0,0 @@
1
- export * from './classes/dynamic-form-field-base';
2
- export * from './classes/dynamic-form-field-model';
3
- export * from './classes/dynamic-form-field-option-model';
4
- export * from './classes/dynamic-form-field-value-model';
5
- export * from './classes/dynamic-form-validators';
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';
9
- export * from './interfaces/dynamic-form-validator.interface';
10
- export * from './types/dynamic-form-config.type';
11
- export * from './tokens/dynamic-form-field-map-fn.token';
@@ -1,68 +0,0 @@
1
- import { DynamicFormFieldRelation } from './dynamic-form-field-relation.interface';
2
- import { DynamicFormValidator } from './dynamic-form-validator.interface';
3
- /**
4
- * Base configuration object for each Dynamic Form Field.
5
- * Expects a generic type describing the type of the value the control holds.
6
- */
7
- export interface DynamicFormFieldConfig {
8
- /**
9
- * Name used as FormControlName
10
- * @required
11
- */
12
- name: string;
13
- /**
14
- * Whether the control has to be disabled.
15
- * Default value is false.
16
- * @optional
17
- */
18
- disabled?: boolean;
19
- /**
20
- * Whether the control should be hidden.
21
- * Default value is false
22
- * @optional
23
- */
24
- hidden?: boolean;
25
- /**
26
- * Adds an id attribute to the FormControl.
27
- * When not provided, the required 'name' property is used as id
28
- * @optional
29
- */
30
- id?: string;
31
- /**
32
- * Used as mat-label when provided
33
- * @optional
34
- */
35
- label?: string | null;
36
- /**
37
- * Hint text underneath the FormControl
38
- * @optional
39
- */
40
- hint?: string;
41
- /**
42
- * Array of Dynamic Form Validators
43
- * @optional
44
- */
45
- validators?: DynamicFormValidator[];
46
- /**
47
- * Array of Dynamic Form Relations
48
- * @optional
49
- */
50
- relations?: DynamicFormFieldRelation[];
51
- /**
52
- * Event name for the control to update on.
53
- * This will determine when Angular is checking the validators
54
- * Possible values:
55
- * - `change`: on every change event on the FormControl
56
- * - `blur`: on the blur event of the FormControl
57
- * - `submit`: when the parent form of the FormControl is submitted
58
- *
59
- * Default value is 'blur'.
60
- * @optional
61
- */
62
- updateOn?: 'submit' | 'blur' | 'change';
63
- /**
64
- * Sets the width of the field, based on percentages. Default value is 100.
65
- * @optional
66
- */
67
- width?: number;
68
- }
@@ -1,10 +0,0 @@
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';