@klippa/ngx-enhancy-forms 16.7.7 → 16.8.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/elements/value-accessor-base/value-accessor-base.component.mjs +8 -2
- package/esm2022/lib/form/form-element/form-element.component.mjs +4 -3
- package/esm2022/lib/form/form-error/form-error.component.mjs +3 -6
- package/esm2022/lib/form/form-submit-button/form-submit-button.component.mjs +28 -43
- package/esm2022/lib/form/form-validation-error/form-validation-error.mjs +22 -0
- package/esm2022/lib/form/form.component.mjs +23 -4
- package/esm2022/lib/ngx-enhancy-forms.module.mjs +8 -3
- package/esm2022/lib/types.mjs +1 -1
- package/esm2022/lib/util/arrays.mjs +5 -2
- package/esm2022/lib/util/classes.mjs +2 -0
- package/esm2022/lib/withTooltip.component.mjs +65 -0
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/klippa-ngx-enhancy-forms.mjs +151 -52
- package/fesm2022/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +2 -1
- package/lib/form/form-error/form-error.component.d.ts +1 -2
- package/lib/form/form-submit-button/form-submit-button.component.d.ts +5 -6
- package/lib/form/form-validation-error/form-validation-error.d.ts +10 -0
- package/lib/form/form.component.d.ts +1 -0
- package/lib/ngx-enhancy-forms.module.d.ts +7 -6
- package/lib/types.d.ts +1 -1
- package/lib/util/arrays.d.ts +2 -0
- package/lib/util/classes.d.ts +1 -0
- package/lib/withTooltip.component.d.ts +10 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -23,6 +23,7 @@ export declare class ValueAccessorBase<T> implements ControlValueAccessor, OnIni
|
|
|
23
23
|
innerValueChangeInterceptor: (prev: T, cur: T) => Promise<void>;
|
|
24
24
|
formControlName: string;
|
|
25
25
|
formControl: UntypedFormControl;
|
|
26
|
+
inErrorState: boolean;
|
|
26
27
|
onTouch: EventEmitter<void>;
|
|
27
28
|
nativeInputRef: ElementRef;
|
|
28
29
|
private attachedFormControl;
|
|
@@ -39,5 +40,5 @@ export declare class ValueAccessorBase<T> implements ControlValueAccessor, OnIni
|
|
|
39
40
|
hasValidator(validatorName: string): boolean;
|
|
40
41
|
focus: () => void;
|
|
41
42
|
static ɵfac: i0.ɵɵFactoryDeclaration<ValueAccessorBase<any>, [{ optional: true; host: true; }, { optional: true; host: true; }]>;
|
|
42
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ValueAccessorBase<any>, "ng-component", never, { "disabled": { "alias": "disabled"; "required": false; }; "innerValueChangeInterceptor": { "alias": "innerValueChangeInterceptor"; "required": false; }; "formControlName": { "alias": "formControlName"; "required": false; }; "formControl": { "alias": "formControl"; "required": false; }; }, { "onTouch": "onTouch"; }, never, never, false, never>;
|
|
43
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ValueAccessorBase<any>, "ng-component", never, { "disabled": { "alias": "disabled"; "required": false; }; "innerValueChangeInterceptor": { "alias": "innerValueChangeInterceptor"; "required": false; }; "formControlName": { "alias": "formControlName"; "required": false; }; "formControl": { "alias": "formControl"; "required": false; }; "inErrorState": { "alias": "inErrorState"; "required": false; }; }, { "onTouch": "onTouch"; }, never, never, false, never>;
|
|
43
44
|
}
|
|
@@ -5,12 +5,11 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class FormErrorComponent implements OnInit {
|
|
6
6
|
private parent;
|
|
7
7
|
error: ErrorTypes;
|
|
8
|
-
showErrorValueAsMessage: boolean;
|
|
9
8
|
showError: boolean;
|
|
10
9
|
contentRef: ElementRef;
|
|
11
10
|
constructor(parent: FormElementComponent);
|
|
12
11
|
ngOnInit(): void;
|
|
13
12
|
getErrorValueMessage(): string;
|
|
14
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormErrorComponent, [{ optional: true; host: true; }]>;
|
|
15
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FormErrorComponent, "klp-form-error", never, { "error": { "alias": "error"; "required": false; };
|
|
14
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FormErrorComponent, "klp-form-error", never, { "error": { "alias": "error"; "required": false; }; }, {}, never, ["*"], false, never>;
|
|
16
15
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { FormComponent } from '../form.component';
|
|
2
1
|
import { ButtonVariant } from '../../elements/button/button.component';
|
|
3
2
|
import * as i0 from "@angular/core";
|
|
4
3
|
export type SubmitButtonVariant = Extract<ButtonVariant, 'greenFilled' | 'redFilled' | 'greenOutlined' | 'white'>;
|
|
5
4
|
export declare class FormSubmitButtonComponent {
|
|
6
5
|
private parentForm;
|
|
6
|
+
private handleError;
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
fullWidth: boolean;
|
|
9
9
|
variant: SubmitButtonVariant;
|
|
10
|
+
submitCallback: (renderedAndEnabledValues: object, renderedButDisabledValues: object) => Promise<any>;
|
|
10
11
|
before: () => Promise<any>;
|
|
11
12
|
after: () => Promise<any>;
|
|
12
|
-
|
|
13
|
-
get _(): boolean;
|
|
14
|
-
constructor(parentForm: FormComponent);
|
|
13
|
+
private setValidationError;
|
|
15
14
|
submitForm(): Promise<void>;
|
|
16
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FormSubmitButtonComponent,
|
|
17
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FormSubmitButtonComponent, "klp-form-submit-button", never, { "isLoading": { "alias": "isLoading"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormSubmitButtonComponent, never>;
|
|
16
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FormSubmitButtonComponent, "klp-form-submit-button", never, { "isLoading": { "alias": "isLoading"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "submitCallback": { "alias": "submitCallback"; "required": false; }; "before": { "alias": "before"; "required": false; }; "after": { "alias": "after"; "required": false; }; }, {}, never, ["*"], false, never>;
|
|
18
17
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export declare class FormValidationError extends Error {
|
|
3
|
+
readonly name = "FormValidationError";
|
|
4
|
+
readonly path: string;
|
|
5
|
+
constructor(path: string, message: string);
|
|
6
|
+
}
|
|
7
|
+
export type FormValidationErrors = Array<FormValidationError>;
|
|
8
|
+
export type FormErrorHandler = (error: any) => FormValidationErrors;
|
|
9
|
+
export declare const KLP_FORM_ERROR_HANDLER: InjectionToken<FormErrorHandler>;
|
|
10
|
+
export declare const DefaultErrorHandler: FormErrorHandler;
|
|
@@ -31,6 +31,7 @@ export declare class FormComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
31
31
|
private addFormControl;
|
|
32
32
|
private disableInactiveFormControl;
|
|
33
33
|
trySubmit(): Promise<any>;
|
|
34
|
+
private handleSubmission;
|
|
34
35
|
private getRenderedFieldValuesFormGroup;
|
|
35
36
|
private getRenderedFieldValuesFormArray;
|
|
36
37
|
private setDisabledStatesForAllControls;
|
|
@@ -23,13 +23,14 @@ import * as i21 from "./form/form-submit-button/form-submit-button.component";
|
|
|
23
23
|
import * as i22 from "./form/form.component";
|
|
24
24
|
import * as i23 from "./elements/hour-minute-input/hour-minute-input.component";
|
|
25
25
|
import * as i24 from "./elements/radio/radio.component";
|
|
26
|
-
import * as i25 from "
|
|
27
|
-
import * as i26 from "@angular/
|
|
28
|
-
import * as i27 from "@
|
|
29
|
-
import * as i28 from "@
|
|
30
|
-
import * as i29 from "
|
|
26
|
+
import * as i25 from "./withTooltip.component";
|
|
27
|
+
import * as i26 from "@angular/common";
|
|
28
|
+
import * as i27 from "@angular/forms";
|
|
29
|
+
import * as i28 from "@ng-select/ng-select";
|
|
30
|
+
import * as i29 from "@dustfoundation/ngx-sortablejs";
|
|
31
|
+
import * as i30 from "./material.module";
|
|
31
32
|
export declare class NgxEnhancyFormsModule {
|
|
32
33
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxEnhancyFormsModule, never>;
|
|
33
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxEnhancyFormsModule, [typeof i1.ValueAccessorBase, typeof i2.MultipleValueAccessorBase, typeof i3.ButtonComponent, typeof i4.CheckboxComponent, typeof i5.DatePickerComponent, typeof i6.DateTimePickerComponent, typeof i7.EmailInputComponent, typeof i8.LoadingIndicatorComponent, typeof i9.NumberInputComponent, typeof i10.PasswordFieldComponent, typeof i11.SelectComponent, typeof i11.KlpSelectOptionTemplateDirective, typeof i12.SelectFooterComponent, typeof i13.SortableItemsComponent, typeof i14.SortableGroupedItemsComponent, typeof i15.TextInputComponent, typeof i16.ToggleComponent, typeof i17.FileInputComponent, typeof i18.FormCaptionComponent, typeof i19.FormElementComponent, typeof i20.FormErrorComponent, typeof i21.FormSubmitButtonComponent, typeof i22.FormComponent, typeof i22.SubFormDirective, typeof i23.HourMinuteInputComponent, typeof i24.RadioComponent], [typeof
|
|
34
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxEnhancyFormsModule, [typeof i1.ValueAccessorBase, typeof i2.MultipleValueAccessorBase, typeof i3.ButtonComponent, typeof i4.CheckboxComponent, typeof i5.DatePickerComponent, typeof i6.DateTimePickerComponent, typeof i7.EmailInputComponent, typeof i8.LoadingIndicatorComponent, typeof i9.NumberInputComponent, typeof i10.PasswordFieldComponent, typeof i11.SelectComponent, typeof i11.KlpSelectOptionTemplateDirective, typeof i12.SelectFooterComponent, typeof i13.SortableItemsComponent, typeof i14.SortableGroupedItemsComponent, typeof i15.TextInputComponent, typeof i16.ToggleComponent, typeof i17.FileInputComponent, typeof i18.FormCaptionComponent, typeof i19.FormElementComponent, typeof i20.FormErrorComponent, typeof i21.FormSubmitButtonComponent, typeof i22.FormComponent, typeof i22.SubFormDirective, typeof i23.HourMinuteInputComponent, typeof i24.RadioComponent, typeof i25.WithTooltipDirective], [typeof i26.CommonModule, typeof i27.FormsModule, typeof i28.NgSelectModule, typeof i29.SortablejsModule, typeof i30.MaterialModule], [typeof i1.ValueAccessorBase, typeof i2.MultipleValueAccessorBase, typeof i3.ButtonComponent, typeof i5.DatePickerComponent, typeof i6.DateTimePickerComponent, typeof i4.CheckboxComponent, typeof i7.EmailInputComponent, typeof i8.LoadingIndicatorComponent, typeof i9.NumberInputComponent, typeof i10.PasswordFieldComponent, typeof i11.SelectComponent, typeof i11.KlpSelectOptionTemplateDirective, typeof i12.SelectFooterComponent, typeof i13.SortableItemsComponent, typeof i14.SortableGroupedItemsComponent, typeof i15.TextInputComponent, typeof i16.ToggleComponent, typeof i17.FileInputComponent, typeof i18.FormCaptionComponent, typeof i19.FormElementComponent, typeof i20.FormErrorComponent, typeof i21.FormSubmitButtonComponent, typeof i22.FormComponent, typeof i22.SubFormDirective, typeof i23.HourMinuteInputComponent, typeof i24.RadioComponent, typeof i25.WithTooltipDirective]>;
|
|
34
35
|
static ɵinj: i0.ɵɵInjectorDeclaration<NgxEnhancyFormsModule>;
|
|
35
36
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export interface FormErrorMessages {
|
|
|
12
12
|
}
|
|
13
13
|
export type CustomErrorMessages = Record<keyof FormErrorMessages, () => string>;
|
|
14
14
|
export type KlpDateFormats = (format: string) => MatDateFormats;
|
|
15
|
-
export type ErrorTypes = keyof FormErrorMessages | 'message';
|
|
15
|
+
export type ErrorTypes = keyof FormErrorMessages | 'message' | 'async';
|
package/lib/util/arrays.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Newable } from './classes';
|
|
1
2
|
export declare function removeDuplicatesFromArraysWithComparator(comparator: (e1: any, e2: any) => boolean, ...arrays: any[]): any;
|
|
2
3
|
export declare function removeDuplicatesFromArray<T>(array: Array<T>): Array<T>;
|
|
3
4
|
export declare function insertAtIndex(arr: any, index: any, item: any): void;
|
|
4
5
|
export declare function arrayIsSetAndFilled(arr: any): boolean;
|
|
5
6
|
export declare function asArray(value: any): Array<any>;
|
|
6
7
|
export declare function splitArrayByCondition<T>(value: Array<T>, condition: (current: T) => boolean): Array<Array<T>>;
|
|
8
|
+
export declare function isArrayOf<T>(arr: Array<T | any>, kind: Newable<T>): arr is Array<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Newable<T> = new (...args: any[]) => T;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ElementRef } from "@angular/core";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class WithTooltipDirective {
|
|
4
|
+
private div;
|
|
5
|
+
private triangle;
|
|
6
|
+
klpWithTooltip: boolean;
|
|
7
|
+
constructor(el: ElementRef);
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WithTooltipDirective, never>;
|
|
9
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<WithTooltipDirective, "[klpWithTooltip]", never, { "klpWithTooltip": { "alias": "klpWithTooltip"; "required": false; }; }, {}, never, never, false, never>;
|
|
10
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -18,10 +18,12 @@ export * from './lib/elements/file-input/file-input.component';
|
|
|
18
18
|
export * from './lib/elements/hour-minute-input/hour-minute-input.component';
|
|
19
19
|
export * from './lib/elements/value-accessor-base/value-accessor-base.component';
|
|
20
20
|
export * from './lib/elements/value-accessor-base/multiple-value-accessor-base.component';
|
|
21
|
+
export * from './lib/withTooltip.component';
|
|
21
22
|
export * from './lib/form/form.component';
|
|
22
23
|
export * from './lib/form/form-caption/form-caption.component';
|
|
23
24
|
export * from './lib/form/form-element/form-element.component';
|
|
24
25
|
export * from './lib/form/form-error/form-error.component';
|
|
25
26
|
export * from './lib/form/form-submit-button/form-submit-button.component';
|
|
27
|
+
export * from './lib/form/form-validation-error/form-validation-error';
|
|
26
28
|
export * from './lib/validators/dateValidator';
|
|
27
29
|
export * from './lib/types';
|