@enigmatry/entry-components 1.15.1-preview.21 → 1.15.1-preview.24
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/esm2020/search-filter/search-filter-input/search-filter-input.component.mjs +9 -4
- package/esm2020/validation/entry-form-errors.component.mjs +7 -3
- package/fesm2015/enigmatry-entry-components-search-filter.mjs +8 -3
- package/fesm2015/enigmatry-entry-components-search-filter.mjs.map +1 -1
- package/fesm2015/enigmatry-entry-components-validation.mjs +6 -2
- package/fesm2015/enigmatry-entry-components-validation.mjs.map +1 -1
- package/fesm2020/enigmatry-entry-components-search-filter.mjs +8 -3
- package/fesm2020/enigmatry-entry-components-search-filter.mjs.map +1 -1
- package/fesm2020/enigmatry-entry-components-validation.mjs +6 -2
- package/fesm2020/enigmatry-entry-components-validation.mjs.map +1 -1
- package/package.json +1 -1
- package/search-filter/search-filter-input/search-filter-input.component.d.ts +4 -2
- package/styles/partials/core/components/forms/_general.scss +2 -2
|
@@ -12,14 +12,19 @@ import * as i7 from "../search-filter-config.model";
|
|
|
12
12
|
export class EntrySearchFilterInputComponent {
|
|
13
13
|
constructor(config) {
|
|
14
14
|
this.config = config;
|
|
15
|
-
|
|
15
|
+
}
|
|
16
|
+
get textSearchFilter() {
|
|
17
|
+
return this.searchFilter.controlType === ControlType.text && this.searchFilter;
|
|
18
|
+
}
|
|
19
|
+
get selectSearchFilter() {
|
|
20
|
+
return this.searchFilter.controlType === ControlType.select && this.searchFilter;
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
23
|
EntrySearchFilterInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntrySearchFilterInputComponent, deps: [{ token: ENTRY_SEARCH_FILTER_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
|
|
19
|
-
EntrySearchFilterInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntrySearchFilterInputComponent, selector: "entry-search-filter-input", inputs: { searchFilter: "searchFilter", form: "form" }, ngImport: i0, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <
|
|
24
|
+
EntrySearchFilterInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntrySearchFilterInputComponent, selector: "entry-search-filter-input", inputs: { searchFilter: "searchFilter", form: "form" }, ngImport: i0, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "component", type: i5.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
20
25
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntrySearchFilterInputComponent, decorators: [{
|
|
21
26
|
type: Component,
|
|
22
|
-
args: [{ selector: 'entry-search-filter-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <
|
|
27
|
+
args: [{ selector: 'entry-search-filter-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>" }]
|
|
23
28
|
}], ctorParameters: function () { return [{ type: i7.EntrySearchFilterConfig, decorators: [{
|
|
24
29
|
type: Inject,
|
|
25
30
|
args: [ENTRY_SEARCH_FILTER_CONFIG]
|
|
@@ -28,4 +33,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
28
33
|
}], form: [{
|
|
29
34
|
type: Input
|
|
30
35
|
}] } });
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
36
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VhcmNoLWZpbHRlci1pbnB1dC5jb21wb25lbnQuanMiLCJzb3VyY2V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tYXQtb3B0aW9uICpuZ0Zvcj1cImxldCBvcHRpb24gb2Ygc2VhcmNoRmlsdGVyLm9wdGlvbnMkIHwgYXN5bmNcIlxuICAgICAgICAgIFt2YWx1ZV09XCJvcHRpb24ua2V5XCI+e3tvcHRpb24ubGFiZWx9fTwvbWF0LW9wdGlvbj5cbiAgICAgIDwvZGl2PlxuICAgICAgPG5nLXRlbXBsYXRlICNmaXhlZFNlbGVjdFZhbHVlcz5cbiAgICAgICAgPG1hdC1vcHRpb24gKm5nRm9yPVwibGV0IG9wdGlvbiBvZiBzZWFyY2hGaWx0ZXIub3B0aW9uc1wiIFt2YWx1ZV09XCJvcHRpb24ua2V5XCI+e3tvcHRpb24ubGFiZWx9fTwvbWF0LW9wdGlvbj5cbiAgICAgIDwvbmctdGVtcGxhdGU+XG4gICAgPC9tYXQtc2VsZWN0PlxuICA8L25nLWNvbnRhaW5lcj5cblxuPC9tYXQtZm9ybS1maWVsZD4iXX0=
|
|
@@ -17,7 +17,9 @@ export class EntryFormErrorsComponent {
|
|
|
17
17
|
EntryFormErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryFormErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
18
18
|
EntryFormErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntryFormErrorsComponent, selector: "entry-form-errors", inputs: { form: "form" }, ngImport: i0, template: `
|
|
19
19
|
<div *ngIf="form.errors">
|
|
20
|
-
<mat-error *ngFor="let error of form.errors.general">
|
|
20
|
+
<mat-error *ngFor="let error of form.errors.general">
|
|
21
|
+
<span class="mat-body-2">{{error}}</span>
|
|
22
|
+
</mat-error>
|
|
21
23
|
</div>
|
|
22
24
|
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
23
25
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryFormErrorsComponent, decorators: [{
|
|
@@ -26,7 +28,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
26
28
|
selector: 'entry-form-errors',
|
|
27
29
|
template: `
|
|
28
30
|
<div *ngIf="form.errors">
|
|
29
|
-
<mat-error *ngFor="let error of form.errors.general">
|
|
31
|
+
<mat-error *ngFor="let error of form.errors.general">
|
|
32
|
+
<span class="mat-body-2">{{error}}</span>
|
|
33
|
+
</mat-error>
|
|
30
34
|
</div>
|
|
31
35
|
`,
|
|
32
36
|
changeDetection: ChangeDetectionStrategy.Default
|
|
@@ -34,4 +38,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
34
38
|
}], propDecorators: { form: [{
|
|
35
39
|
type: Input
|
|
36
40
|
}] } });
|
|
37
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW50cnktZm9ybS1lcnJvcnMuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9lbnRyeS1jb21wb25lbnRzL3ZhbGlkYXRpb24vZW50cnktZm9ybS1lcnJvcnMuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLE1BQU0sZUFBZSxDQUFDOzs7O0FBRzFFOzs7Ozs7Oz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G4gICAgICAgIDxzcGFuIGNsYXNzPVwibWF0LWJvZHktMlwiPnt7ZXJyb3J9fTwvc3Bhbj5cbiAgICAgIDwvbWF0LWVycm9yPlxuICAgIDwvZGl2PlxuICBgLFxuICBjaGFuZ2VEZXRlY3Rpb246IENoYW5nZURldGVjdGlvblN0cmF0ZWd5LkRlZmF1bHRcbn0pXG5leHBvcnQgY2xhc3MgRW50cnlGb3JtRXJyb3JzQ29tcG9uZW50IHtcbiAgLyoqIEEgZm9ybSBncm91cCBmb3Igd2hpY2ggdGhlIHZhbGlkYXRpb24gZXJyb3JzIGFyZSBiZWluZyBkaXNwbGF5ZWQuICovXG4gIEBJbnB1dCgpIGZvcm06IFVudHlwZWRGb3JtR3JvdXA7XG59XG4iXX0=
|
|
@@ -35,14 +35,19 @@ ControlType.select = 'select-input';
|
|
|
35
35
|
class EntrySearchFilterInputComponent {
|
|
36
36
|
constructor(config) {
|
|
37
37
|
this.config = config;
|
|
38
|
-
|
|
38
|
+
}
|
|
39
|
+
get textSearchFilter() {
|
|
40
|
+
return this.searchFilter.controlType === ControlType.text && this.searchFilter;
|
|
41
|
+
}
|
|
42
|
+
get selectSearchFilter() {
|
|
43
|
+
return this.searchFilter.controlType === ControlType.select && this.searchFilter;
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
EntrySearchFilterInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntrySearchFilterInputComponent, deps: [{ token: ENTRY_SEARCH_FILTER_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
|
|
42
|
-
EntrySearchFilterInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntrySearchFilterInputComponent, selector: "entry-search-filter-input", inputs: { searchFilter: "searchFilter", form: "form" }, ngImport: i0, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <
|
|
47
|
+
EntrySearchFilterInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntrySearchFilterInputComponent, selector: "entry-search-filter-input", inputs: { searchFilter: "searchFilter", form: "form" }, ngImport: i0, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "component", type: i5.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
43
48
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntrySearchFilterInputComponent, decorators: [{
|
|
44
49
|
type: Component,
|
|
45
|
-
args: [{ selector: 'entry-search-filter-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <
|
|
50
|
+
args: [{ selector: 'entry-search-filter-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>" }]
|
|
46
51
|
}], ctorParameters: function () {
|
|
47
52
|
return [{ type: EntrySearchFilterConfig, decorators: [{
|
|
48
53
|
type: Inject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components-search-filter.mjs","sources":["../../../../libs/entry-components/search-filter/search-filter-config.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/control-type.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.html","../../../../libs/entry-components/search-filter/entry-search-filter.component.ts","../../../../libs/entry-components/search-filter/entry-search-filter.component.html","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-base.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/text-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-filter-option.model.ts","../../../../libs/entry-components/search-filter/entry-search-filter.module.ts","../../../../libs/entry-components/search-filter/enigmatry-entry-components-search-filter.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntrySearchFilterConfig {\n /** Apply search filters button label (default 'Apply') */\n applyButtonText: string;\n /** Label for 'none selected' select filter option */\n noneSelectedOptionText: string;\n\n constructor(config: Partial<EntrySearchFilterConfig> = {}) {\n this.applyButtonText = config.applyButtonText ?? 'Apply';\n this.noneSelectedOptionText = config.noneSelectedOptionText ?? 'None';\n }\n}\nexport const ENTRY_SEARCH_FILTER_CONFIG = new InjectionToken<EntrySearchFilterConfig>(\n 'EntrySearchFilterConfig',\n {\n providedIn: 'root',\n factory: () => new EntrySearchFilterConfig()\n }\n);\n","export class ControlType {\n static text = 'text-input';\n static select = 'select-input';\n}\n","import { ChangeDetectionStrategy, Component, Inject, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\nimport { ControlType } from './control-type.model';\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from '../search-filter-config.model';\nimport { SearchFilterBase } from './search-filter-base.model';\n\n@Component({\n selector: 'entry-search-filter-input',\n templateUrl: './search-filter-input.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntrySearchFilterInputComponent<T> {\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\n @Input() searchFilter: SearchFilterBase<T>;\n /** Form group to which the search-filter input component will be added. */\n @Input() form: UntypedFormGroup;\n\n controlType = ControlType;\n\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\n}\n","<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <div [ngSwitch]=\"searchFilter.controlType\">\n\n <input *ngSwitchCase=\"controlType.text\"\n [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\"\n [type]=\"searchFilter.type\" matInput [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n\n <mat-select *ngSwitchCase=\"controlType.select\"\n [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\" [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n\n </div>\n</mat-form-field>","import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';\r\nimport { UntypedFormGroup } from '@angular/forms';\r\nimport { SearchFilterParams } from './search-filter-params.type';\r\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from './search-filter-config.model';\r\nimport { SearchFilterBase } from './search-filter-input/search-filter-base.model';\r\n\r\n/**\r\n * Entry SearchFilter component.\r\n */\r\n@Component({\r\n selector: 'entry-search-filter',\r\n templateUrl: './entry-search-filter.component.html',\r\n styleUrls: ['./entry-search-filter.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class EntrySearchFilterComponent implements OnInit {\r\n\r\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\r\n @Input() searchFilters: SearchFilterBase<any>[] = [];\r\n /**\r\n * Emits the change in SearchFilterParams so the containing component can apply them and retrieve the filtered results.\r\n */\r\n @Output() searchFilterChange = new EventEmitter<SearchFilterParams>();\r\n\r\n searchFilterForm!: UntypedFormGroup;\r\n\r\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\r\n\r\n ngOnInit() {\r\n this.searchFilterForm = this.toFormGroup(this.searchFilters);\r\n }\r\n\r\n onSubmit() {\r\n const formValue = this.searchFilterForm.value;\r\n this.searchFilterChange.emit(formValue);\r\n }\r\n\r\n toFormGroup(searchFilters: SearchFilterBase<any>[]) {\r\n const group: any = {};\r\n searchFilters.forEach(searchFilter => {\r\n const formControl = searchFilter.toFormControl();\r\n group[searchFilter.key] = formControl;\r\n searchFilter.formControl = formControl;\r\n });\r\n return new UntypedFormGroup(group);\r\n }\r\n}\r\n\r\n","<div class=\"search-form-container\">\r\n <form (ngSubmit)=\"onSubmit()\" [formGroup]=\"searchFilterForm\">\r\n <div class=\"search-form-fields\">\r\n <div *ngFor=\"let searchFilter of searchFilters\" class=\"search-form-field\">\r\n <entry-search-filter-input [searchFilter]=\"searchFilter\" [form]=\"searchFilterForm\">\r\n </entry-search-filter-input>\r\n </div>\r\n <div>\r\n <button type=\"button\" class=\"mat-raised-button mat-accent\" type=\"submit\">\r\n {{config.applyButtonText}}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</div>","import { FormControl } from '@angular/forms';\n\n/**\n * Base Entry search filter input component.\n */\nexport class SearchFilterBase<T> {\n /** Unique search-filter input key */\n key: string;\n /** Default value to be displayed/selected in the input control */\n value: T | undefined;\n /** Label text to be displayed for the search-filter input control */\n label: string;\n /** Placeholder text for search-filter input control */\n placeholder: string;\n /** Type of input control e.g. 'email' */\n type: string;\n /** Control type to be overridden in implementing class, used to render the proper input type e.g. 'text-input' */\n controlType: string;\n /** Max text length to be entered in the input component (default is 256) */\n maxLength: number;\n /** A reference to the form control it represents */\n formControl: FormControl<T>;\n\n constructor(options: Partial<SearchFilterBase<T>> = {}) {\n this.value = options.value;\n this.key = options.key || '';\n this.label = options.label || '';\n this.placeholder = options.placeholder || '';\n this.controlType = options.controlType || '';\n this.type = options.type || '';\n this.maxLength = options.maxLength || 256;\n }\n\n setValue(value: T | undefined) {\n this.value = value;\n if (this.formControl) {\n this.formControl.patchValue(value);\n }\n }\n\n toFormControl(): FormControl<T> {\n return new FormControl<T>(this.value);\n }\n}\n","import { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\n\n/**\n * Search filter text input filed configuration.\n */\nexport class TextSearchFilter extends SearchFilterBase<string> {\n override controlType = ControlType.text;\n}\n","import { Observable } from 'rxjs';\nimport { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\nimport { SelectFilterOption } from './select-filter-option.model';\n\n/**\n * Search filter select input field configuration. Select options can be provided as fixed list (`options`)\n * or observable (dynamic) list (`options$`).\n */\nexport class SelectSearchFilter<T> extends SearchFilterBase<T> {\n override controlType = ControlType.select;\n /** Fixed list of select filter options (default is empty list) */\n options: SelectFilterOption<T>[] = [];\n /** Observable (dynamic) list of select filter options */\n options$: Observable<SelectFilterOption<T>[]> | undefined;\n /**\n * Enables selection of multiple options (default is true).\n * If it is set to false, 'none selected' option becomes available as a first option.\n * */\n multiSelect = true;\n\n constructor(options: Partial<SelectSearchFilter<T>> = {}) {\n super(options);\n this.options = options.options;\n this.options$ = options.options$;\n this.multiSelect = options.multiSelect;\n }\n}\n","/** Model used to populate select filter options. */\nexport class SelectFilterOption<T> {\n constructor(\n /** Key used as a value for selected option */\n public key: T,\n /** String value used as display label of select option */\n public label: string) {}\n}\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatSelectModule } from '@angular/material/select';\r\n\r\nimport { EntrySearchFilterComponent } from './entry-search-filter.component';\r\nimport { EntrySearchFilterInputComponent } from './search-filter-input/search-filter-input.component';\r\n\r\n@NgModule({\r\n declarations: [\r\n EntrySearchFilterComponent,\r\n EntrySearchFilterInputComponent\r\n ],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatButtonModule,\r\n MatSelectModule\r\n ],\r\n exports: [\r\n EntrySearchFilterComponent\r\n ]\r\n})\r\nexport class EntrySearchFilterModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i3.EntrySearchFilterInputComponent"],"mappings":";;;;;;;;;;;;;;AAEA;;AAEG;MACU,uBAAuB,CAAA;IAMhC,WAAY,CAAA,SAA2C,EAAE,EAAA;;QACrD,IAAI,CAAC,eAAe,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,eAAe,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,OAAO,CAAC;QACzD,IAAI,CAAC,sBAAsB,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,sBAAsB,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,MAAM,CAAC;KACzE;AACJ,CAAA;MACY,0BAA0B,GAAG,IAAI,cAAc,CACxD,yBAAyB,EACzB;AACI,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,IAAI,uBAAuB,EAAE;AAC/C,CAAA;;MCrBQ,WAAW,CAAA;;AACb,WAAI,CAAA,IAAA,GAAG,YAAY,CAAC;AACpB,WAAM,CAAA,MAAA,GAAG,cAAc;;MCSrB,+BAA+B,CAAA;AAQ1C,IAAA,WAAA,CAAuD,MAA+B,EAAA;AAA/B,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAyB;AAFtF,QAAA,IAAW,CAAA,WAAA,GAAG,WAAW,CAAC;KAEiE;;AARhF,+BAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,+BAA+B,kBAQtB,0BAA0B,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AARnC,+BAAA,CAAA,IAAA,GAAA,EAAA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AY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;QACf,eAAe,aAGf,0BAA0B,CAAA,EAAA,CAAA,CAAA;AAGjB,uBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAXhC,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;QACf,eAAe,CAAA,EAAA,CAAA,CAAA;2FAMN,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAjBnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,0BAA0B;wBAC1B,+BAA+B;AAChC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;wBACd,eAAe;wBACf,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,0BAA0B;AAC3B,qBAAA;iBACF,CAAA;;;AC1BD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components-search-filter.mjs","sources":["../../../../libs/entry-components/search-filter/search-filter-config.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/control-type.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.html","../../../../libs/entry-components/search-filter/entry-search-filter.component.ts","../../../../libs/entry-components/search-filter/entry-search-filter.component.html","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-base.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/text-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-filter-option.model.ts","../../../../libs/entry-components/search-filter/entry-search-filter.module.ts","../../../../libs/entry-components/search-filter/enigmatry-entry-components-search-filter.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntrySearchFilterConfig {\n /** Apply search filters button label (default 'Apply') */\n applyButtonText: string;\n /** Label for 'none selected' select filter option */\n noneSelectedOptionText: string;\n\n constructor(config: Partial<EntrySearchFilterConfig> = {}) {\n this.applyButtonText = config.applyButtonText ?? 'Apply';\n this.noneSelectedOptionText = config.noneSelectedOptionText ?? 'None';\n }\n}\nexport const ENTRY_SEARCH_FILTER_CONFIG = new InjectionToken<EntrySearchFilterConfig>(\n 'EntrySearchFilterConfig',\n {\n providedIn: 'root',\n factory: () => new EntrySearchFilterConfig()\n }\n);\n","export class ControlType {\n static text = 'text-input';\n static select = 'select-input';\n}\n","import { ChangeDetectionStrategy, Component, Inject, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\nimport { ControlType } from './control-type.model';\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from '../search-filter-config.model';\nimport { SearchFilterBase } from './search-filter-base.model';\nimport { SelectSearchFilter } from './inputs/select-search-filter.model';\nimport { TextSearchFilter } from './inputs/text-search-filter.model';\n\n@Component({\n selector: 'entry-search-filter-input',\n templateUrl: './search-filter-input.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntrySearchFilterInputComponent<T> {\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\n @Input() searchFilter: SearchFilterBase<T>;\n /** Form group to which the search-filter input component will be added. */\n @Input() form: UntypedFormGroup;\n\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\n\n get textSearchFilter(): TextSearchFilter | undefined {\n return this.searchFilter.controlType === ControlType.text && this.searchFilter as TextSearchFilter;\n }\n get selectSearchFilter(): SelectSearchFilter<T> | undefined {\n return this.searchFilter.controlType === ControlType.select && this.searchFilter as SelectSearchFilter<T>;\n }\n}\n","<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>","import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';\r\nimport { UntypedFormGroup } from '@angular/forms';\r\nimport { SearchFilterParams } from './search-filter-params.type';\r\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from './search-filter-config.model';\r\nimport { SearchFilterBase } from './search-filter-input/search-filter-base.model';\r\n\r\n/**\r\n * Entry SearchFilter component.\r\n */\r\n@Component({\r\n selector: 'entry-search-filter',\r\n templateUrl: './entry-search-filter.component.html',\r\n styleUrls: ['./entry-search-filter.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class EntrySearchFilterComponent implements OnInit {\r\n\r\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\r\n @Input() searchFilters: SearchFilterBase<any>[] = [];\r\n /**\r\n * Emits the change in SearchFilterParams so the containing component can apply them and retrieve the filtered results.\r\n */\r\n @Output() searchFilterChange = new EventEmitter<SearchFilterParams>();\r\n\r\n searchFilterForm!: UntypedFormGroup;\r\n\r\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\r\n\r\n ngOnInit() {\r\n this.searchFilterForm = this.toFormGroup(this.searchFilters);\r\n }\r\n\r\n onSubmit() {\r\n const formValue = this.searchFilterForm.value;\r\n this.searchFilterChange.emit(formValue);\r\n }\r\n\r\n toFormGroup(searchFilters: SearchFilterBase<any>[]) {\r\n const group: any = {};\r\n searchFilters.forEach(searchFilter => {\r\n const formControl = searchFilter.toFormControl();\r\n group[searchFilter.key] = formControl;\r\n searchFilter.formControl = formControl;\r\n });\r\n return new UntypedFormGroup(group);\r\n }\r\n}\r\n\r\n","<div class=\"search-form-container\">\r\n <form (ngSubmit)=\"onSubmit()\" [formGroup]=\"searchFilterForm\">\r\n <div class=\"search-form-fields\">\r\n <div *ngFor=\"let searchFilter of searchFilters\" class=\"search-form-field\">\r\n <entry-search-filter-input [searchFilter]=\"searchFilter\" [form]=\"searchFilterForm\">\r\n </entry-search-filter-input>\r\n </div>\r\n <div>\r\n <button type=\"button\" class=\"mat-raised-button mat-accent\" type=\"submit\">\r\n {{config.applyButtonText}}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</div>","import { FormControl } from '@angular/forms';\n\n/**\n * Base Entry search filter input component.\n */\nexport class SearchFilterBase<T> {\n /** Unique search-filter input key */\n key: string;\n /** Default value to be displayed/selected in the input control */\n value: T | undefined;\n /** Label text to be displayed for the search-filter input control */\n label: string;\n /** Placeholder text for search-filter input control */\n placeholder: string;\n /** Type of input control e.g. 'email' */\n type: string;\n /** Control type to be overridden in implementing class, used to render the proper input type e.g. 'text-input' */\n controlType: string;\n /** Max text length to be entered in the input component (default is 256) */\n maxLength: number;\n /** A reference to the form control it represents */\n formControl: FormControl<T>;\n\n constructor(options: Partial<SearchFilterBase<T>> = {}) {\n this.value = options.value;\n this.key = options.key || '';\n this.label = options.label || '';\n this.placeholder = options.placeholder || '';\n this.controlType = options.controlType || '';\n this.type = options.type || '';\n this.maxLength = options.maxLength || 256;\n }\n\n setValue(value: T | undefined) {\n this.value = value;\n if (this.formControl) {\n this.formControl.patchValue(value);\n }\n }\n\n toFormControl(): FormControl<T> {\n return new FormControl<T>(this.value);\n }\n}\n","import { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\n\n/**\n * Search filter text input filed configuration.\n */\nexport class TextSearchFilter extends SearchFilterBase<string> {\n override controlType = ControlType.text;\n}\n","import { Observable } from 'rxjs';\nimport { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\nimport { SelectFilterOption } from './select-filter-option.model';\n\n/**\n * Search filter select input field configuration. Select options can be provided as fixed list (`options`)\n * or observable (dynamic) list (`options$`).\n */\nexport class SelectSearchFilter<T> extends SearchFilterBase<T> {\n override controlType = ControlType.select;\n /** Fixed list of select filter options (default is empty list) */\n options: SelectFilterOption<T>[] = [];\n /** Observable (dynamic) list of select filter options */\n options$: Observable<SelectFilterOption<T>[]> | undefined;\n /**\n * Enables selection of multiple options (default is true).\n * If it is set to false, 'none selected' option becomes available as a first option.\n * */\n multiSelect = true;\n\n constructor(options: Partial<SelectSearchFilter<T>> = {}) {\n super(options);\n this.options = options.options;\n this.options$ = options.options$;\n this.multiSelect = options.multiSelect;\n }\n}\n","/** Model used to populate select filter options. */\nexport class SelectFilterOption<T> {\n constructor(\n /** Key used as a value for selected option */\n public key: T,\n /** String value used as display label of select option */\n public label: string) {}\n}\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatSelectModule } from '@angular/material/select';\r\n\r\nimport { EntrySearchFilterComponent } from './entry-search-filter.component';\r\nimport { EntrySearchFilterInputComponent } from './search-filter-input/search-filter-input.component';\r\n\r\n@NgModule({\r\n declarations: [\r\n EntrySearchFilterComponent,\r\n EntrySearchFilterInputComponent\r\n ],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatButtonModule,\r\n MatSelectModule\r\n ],\r\n exports: [\r\n EntrySearchFilterComponent\r\n ]\r\n})\r\nexport class EntrySearchFilterModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i3.EntrySearchFilterInputComponent"],"mappings":";;;;;;;;;;;;;;AAEA;;AAEG;MACU,uBAAuB,CAAA;IAMhC,WAAY,CAAA,SAA2C,EAAE,EAAA;;QACrD,IAAI,CAAC,eAAe,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,eAAe,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,OAAO,CAAC;QACzD,IAAI,CAAC,sBAAsB,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,sBAAsB,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,MAAM,CAAC;KACzE;AACJ,CAAA;MACY,0BAA0B,GAAG,IAAI,cAAc,CACxD,yBAAyB,EACzB;AACI,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,IAAI,uBAAuB,EAAE;AAC/C,CAAA;;MCrBQ,WAAW,CAAA;;AACb,WAAI,CAAA,IAAA,GAAG,YAAY,CAAC;AACpB,WAAM,CAAA,MAAA,GAAG,cAAc;;MCWrB,+BAA+B,CAAA;AAM1C,IAAA,WAAA,CAAuD,MAA+B,EAAA;AAA/B,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAyB;KAAK;AAE3F,IAAA,IAAI,gBAAgB,GAAA;AAClB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,KAAK,WAAW,CAAC,IAAI,IAAI,IAAI,CAAC,YAAgC,CAAC;KACpG;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CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,iBAfhC,0BAA0B;AAC1B,QAAA,+BAA+B,aAG/B,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;QACf,eAAe,aAGf,0BAA0B,CAAA,EAAA,CAAA,CAAA;AAGjB,uBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAXhC,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;QACf,eAAe,CAAA,EAAA,CAAA,CAAA;2FAMN,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAjBnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,0BAA0B;wBAC1B,+BAA+B;AAChC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;wBACd,eAAe;wBACf,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,0BAA0B;AAC3B,qBAAA;iBACF,CAAA;;;AC1BD;;AAEG;;;;"}
|
|
@@ -21,7 +21,9 @@ class EntryFormErrorsComponent {
|
|
|
21
21
|
EntryFormErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryFormErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
22
22
|
EntryFormErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntryFormErrorsComponent, selector: "entry-form-errors", inputs: { form: "form" }, ngImport: i0, template: `
|
|
23
23
|
<div *ngIf="form.errors">
|
|
24
|
-
<mat-error *ngFor="let error of form.errors.general">
|
|
24
|
+
<mat-error *ngFor="let error of form.errors.general">
|
|
25
|
+
<span class="mat-body-2">{{error}}</span>
|
|
26
|
+
</mat-error>
|
|
25
27
|
</div>
|
|
26
28
|
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
27
29
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryFormErrorsComponent, decorators: [{
|
|
@@ -30,7 +32,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
30
32
|
selector: 'entry-form-errors',
|
|
31
33
|
template: `
|
|
32
34
|
<div *ngIf="form.errors">
|
|
33
|
-
<mat-error *ngFor="let error of form.errors.general">
|
|
35
|
+
<mat-error *ngFor="let error of form.errors.general">
|
|
36
|
+
<span class="mat-body-2">{{error}}</span>
|
|
37
|
+
</mat-error>
|
|
34
38
|
</div>
|
|
35
39
|
`,
|
|
36
40
|
changeDetection: ChangeDetectionStrategy.Default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components-validation.mjs","sources":["../../../../libs/entry-components/validation/entry-form-errors.component.ts","../../../../libs/entry-components/validation/entry-validation-config.model.ts","../../../../libs/entry-components/validation/entry-validation.ts","../../../../libs/entry-components/validation/entry-display-control-validation.directive.ts","../../../../libs/entry-components/validation/entry-validation.module.ts","../../../../libs/entry-components/validation/enigmatry-entry-components-validation.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\n\n/**\n * A component used to display generic (form level) server side validation messages.\n * The messages are displayed as a list, each message in a new row.\n *\n * @example\n * ```html\n * <entry-form-errors [form]=\"myForm\">\n * </entry-form-errors>\n * ```\n */\n@Component({\n selector: 'entry-form-errors',\n template: `\n <div *ngIf=\"form.errors\">\n <mat-error *ngFor=\"let error of form.errors.general\">{{error}}</mat-error>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class EntryFormErrorsComponent {\n /** A form group for which the validation errors are being displayed. */\n @Input() form: UntypedFormGroup;\n}\n","import { InjectionToken } from '@angular/core';\nimport { AbstractControl } from '@angular/forms';\n\n/** Used to configure mapping between validation keys and messages */\nexport interface IEntryValidationMessage {\n /** Validation key (e.g. '_required_', '_minlength_', '_email_', etc.) */\n name: string;\n /**\n * Validation message. Can be static string or expression returning string\n * (when messages need to be resolved dynamically: parametrization, localization, etc.).\n */\n message: string | ((control: AbstractControl) => string);\n}\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntryValidationConfig {\n /**\n * Validation key to message configuration on module level. Used to configure client side validation messages\n * for standard validators (_required_, _minLength_, _email_, etc.).\n *\n * **NOTE:** If using _Formly_ package to render forms, this configuration should not be used.\n * Instead, use `FormlyModule` to configure validation messages.\n *\n * @example\n * ```ts\n * new EntryValidationConfig() {\n * validationMessages: [\n * { name: 'required': message: 'This field is mandatory' },\n * { name: 'minlength', message: (control: AbstractControl) => `Minimal length is ${control.errors.minlength.requiredLength}`}\n * ]\n * }\n * ```\n */\n validationMessages: IEntryValidationMessage[];\n\n constructor(config: Partial<EntryValidationConfig> = {}) {\n this.validationMessages = config.validationMessages ?? [];\n }\n}\n\n/**\n * Entry validation injection token of EntryValidationConfig type containing validation default configurations.\n * Can be updated with custom configuration.\n *\n * Defaults:\n * - validationMessages: []\n */\nexport const ENTRY_VALIDATION_CONFIG = new InjectionToken<EntryValidationConfig>(\n 'EntryValidationConfig',\n {\n providedIn: 'root',\n factory: () => new EntryValidationConfig()\n }\n);\n","import { AbstractControl, FormArray, FormGroup, UntypedFormGroup, ValidationErrors } from '@angular/forms';\nimport { IValidationProblemDetails } from './validation-problem-details.interface';\n\n/** A key used to map server side validation errors on form level */\nconst FORM_ERROR_KEY = 'general';\n/** A key used to map server side validation errors on form field level */\nconst FORM_FIELD_ERROR_KEY = 'fromServer';\n\nconst getFormControl = (formControl: AbstractControl | null | undefined, keys: string[]): AbstractControl | null | undefined => {\n if (keys.length === 0) {\n return formControl;\n }\n if (formControl instanceof FormGroup) {\n return getFormControl(formControl.controls[keys[0].charAt(0).toLowerCase() + keys[0].slice(1)], keys.slice(1));\n }\n if (formControl instanceof FormArray && +keys[0] >= 0) {\n return getFormControl(formControl.controls[+keys[0]], keys.slice(1));\n }\n return null;\n};\n\n/**\n * Applies validation errors received from server side to the form.\n * The errors are applied to multiple levels: form, form group, form array, and form field.\n *\n * @param error Server side validation errors response.\n * @param form Form to apply validation errors to.\n */\nconst setServerSideValidationErrors = (error: IValidationProblemDetails, form: UntypedFormGroup) => {\n form.setErrors(null);\n const validationErrors = error?.errors;\n const formErrors: ValidationErrors = {};\n\n if (validationErrors) {\n // eslint-disable-next-line guard-for-in\n for (const key in validationErrors) {\n const control = getFormControl(form, key.split(/[.[\\]]+/gu));\n\n if (control) {\n const fieldErrors = {} as ValidationErrors;\n fieldErrors[FORM_FIELD_ERROR_KEY] = validationErrors[key];\n control.setErrors(fieldErrors);\n control.markAsTouched();\n } else {\n formErrors[FORM_ERROR_KEY] =\n formErrors[FORM_ERROR_KEY]?.concat(validationErrors[key]) || validationErrors[key];\n }\n }\n } else {\n formErrors[FORM_ERROR_KEY] = [`An error occurred on the server.`];\n }\n\n form.setErrors(formErrors);\n};\n\nexport {\n FORM_FIELD_ERROR_KEY,\n setServerSideValidationErrors\n};\n","import { Directive, ElementRef, Inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { ENTRY_VALIDATION_CONFIG, EntryValidationConfig } from './entry-validation-config.model';\nimport { AbstractControl, FormControlStatus } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { FORM_FIELD_ERROR_KEY } from './entry-validation';\n\n/**\n * A directive that displays configured validation messages or server side validations for given form control.\n * The messages are separated with coma(,) and displayed as _innerHTML_ value of host component.\n *\n * @example\n * ```html\n * <div entryDisplayControlValidation [control]=\"myForm.controls.firstName\">\n * </div\n * ```\n */\n@Directive({\n selector: '[entryDisplayControlValidation]'\n})\nexport class EntryDisplayControlValidationDirective implements OnInit, OnDestroy {\n /** Form control for which the validation messages are displayed for. */\n @Input() control: AbstractControl;\n\n private _controlSubscription: Subscription | undefined;\n\n constructor(\n @Inject(ENTRY_VALIDATION_CONFIG) private readonly _config: EntryValidationConfig,\n private readonly _element: ElementRef) {}\n\n ngOnInit(): void {\n this._controlSubscription = this.control.statusChanges\n .subscribe((controlStatus: FormControlStatus) => {\n if (controlStatus === 'INVALID') {\n this._element.nativeElement.innerText = this.extractValidationMessages();\n }\n });\n }\n\n ngOnDestroy(): void {\n if (this._controlSubscription) {\n this._controlSubscription.unsubscribe();\n }\n }\n\n private extractValidationMessages(): string {\n if (!this.control.errors) {\n return '';\n }\n const errorsString = this._config.validationMessages\n .map(validationMessage => this.control.errors[validationMessage.name]\n ? typeof(validationMessage.message) === 'string'\n ? validationMessage.message : validationMessage.message(this.control)\n : ''\n )\n .filter(message => message !== '')\n .join(', ');\n\n const serverErrors = this.control.errors[FORM_FIELD_ERROR_KEY];\n const serverErrorsString = serverErrors instanceof Array ? serverErrors.join(', ') : '';\n\n return [errorsString, serverErrorsString].filter(x => x !== '').join(', ');\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { EntryFormErrorsComponent } from './entry-form-errors.component';\nimport { MatInputModule } from '@angular/material/input';\nimport { EntryDisplayControlValidationDirective } from './entry-display-control-validation.directive';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\n@NgModule({\n declarations: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule\n ],\n exports: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ]\n})\nexport class EntryValidationModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAGA;;;;;;;;;AASG;MAUU,wBAAwB,CAAA;;qHAAxB,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAxB,wBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,wBAAwB,EAPzB,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,cAAA,EAAA,eAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,IAAA,EAAA,QAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,QAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,OAAA,EAAA,CAAA,CAAA;2FAGU,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBATpC,SAAS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A,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,iBAd9B,wBAAwB;AACxB,QAAA,sCAAsC,aAGtC,YAAY;QACZ,WAAW;QACX,mBAAmB;AACnB,QAAA,cAAc,aAGd,wBAAwB;QACxB,sCAAsC,CAAA,EAAA,CAAA,CAAA;AAG7B,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAV9B,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc,CAAA,EAAA,CAAA,CAAA;2FAOL,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAhBjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;AACf,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;iBACF,CAAA;;;ACtBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components-validation.mjs","sources":["../../../../libs/entry-components/validation/entry-form-errors.component.ts","../../../../libs/entry-components/validation/entry-validation-config.model.ts","../../../../libs/entry-components/validation/entry-validation.ts","../../../../libs/entry-components/validation/entry-display-control-validation.directive.ts","../../../../libs/entry-components/validation/entry-validation.module.ts","../../../../libs/entry-components/validation/enigmatry-entry-components-validation.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\n\n/**\n * A component used to display generic (form level) server side validation messages.\n * The messages are displayed as a list, each message in a new row.\n *\n * @example\n * ```html\n * <entry-form-errors [form]=\"myForm\">\n * </entry-form-errors>\n * ```\n */\n@Component({\n selector: 'entry-form-errors',\n template: `\n <div *ngIf=\"form.errors\">\n <mat-error *ngFor=\"let error of form.errors.general\">\n <span class=\"mat-body-2\">{{error}}</span>\n </mat-error>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class EntryFormErrorsComponent {\n /** A form group for which the validation errors are being displayed. */\n @Input() form: UntypedFormGroup;\n}\n","import { InjectionToken } from '@angular/core';\nimport { AbstractControl } from '@angular/forms';\n\n/** Used to configure mapping between validation keys and messages */\nexport interface IEntryValidationMessage {\n /** Validation key (e.g. '_required_', '_minlength_', '_email_', etc.) */\n name: string;\n /**\n * Validation message. Can be static string or expression returning string\n * (when messages need to be resolved dynamically: parametrization, localization, etc.).\n */\n message: string | ((control: AbstractControl) => string);\n}\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntryValidationConfig {\n /**\n * Validation key to message configuration on module level. Used to configure client side validation messages\n * for standard validators (_required_, _minLength_, _email_, etc.).\n *\n * **NOTE:** If using _Formly_ package to render forms, this configuration should not be used.\n * Instead, use `FormlyModule` to configure validation messages.\n *\n * @example\n * ```ts\n * new EntryValidationConfig() {\n * validationMessages: [\n * { name: 'required': message: 'This field is mandatory' },\n * { name: 'minlength', message: (control: AbstractControl) => `Minimal length is ${control.errors.minlength.requiredLength}`}\n * ]\n * }\n * ```\n */\n validationMessages: IEntryValidationMessage[];\n\n constructor(config: Partial<EntryValidationConfig> = {}) {\n this.validationMessages = config.validationMessages ?? [];\n }\n}\n\n/**\n * Entry validation injection token of EntryValidationConfig type containing validation default configurations.\n * Can be updated with custom configuration.\n *\n * Defaults:\n * - validationMessages: []\n */\nexport const ENTRY_VALIDATION_CONFIG = new InjectionToken<EntryValidationConfig>(\n 'EntryValidationConfig',\n {\n providedIn: 'root',\n factory: () => new EntryValidationConfig()\n }\n);\n","import { AbstractControl, FormArray, FormGroup, UntypedFormGroup, ValidationErrors } from '@angular/forms';\nimport { IValidationProblemDetails } from './validation-problem-details.interface';\n\n/** A key used to map server side validation errors on form level */\nconst FORM_ERROR_KEY = 'general';\n/** A key used to map server side validation errors on form field level */\nconst FORM_FIELD_ERROR_KEY = 'fromServer';\n\nconst getFormControl = (formControl: AbstractControl | null | undefined, keys: string[]): AbstractControl | null | undefined => {\n if (keys.length === 0) {\n return formControl;\n }\n if (formControl instanceof FormGroup) {\n return getFormControl(formControl.controls[keys[0].charAt(0).toLowerCase() + keys[0].slice(1)], keys.slice(1));\n }\n if (formControl instanceof FormArray && +keys[0] >= 0) {\n return getFormControl(formControl.controls[+keys[0]], keys.slice(1));\n }\n return null;\n};\n\n/**\n * Applies validation errors received from server side to the form.\n * The errors are applied to multiple levels: form, form group, form array, and form field.\n *\n * @param error Server side validation errors response.\n * @param form Form to apply validation errors to.\n */\nconst setServerSideValidationErrors = (error: IValidationProblemDetails, form: UntypedFormGroup) => {\n form.setErrors(null);\n const validationErrors = error?.errors;\n const formErrors: ValidationErrors = {};\n\n if (validationErrors) {\n // eslint-disable-next-line guard-for-in\n for (const key in validationErrors) {\n const control = getFormControl(form, key.split(/[.[\\]]+/gu));\n\n if (control) {\n const fieldErrors = {} as ValidationErrors;\n fieldErrors[FORM_FIELD_ERROR_KEY] = validationErrors[key];\n control.setErrors(fieldErrors);\n control.markAsTouched();\n } else {\n formErrors[FORM_ERROR_KEY] =\n formErrors[FORM_ERROR_KEY]?.concat(validationErrors[key]) || validationErrors[key];\n }\n }\n } else {\n formErrors[FORM_ERROR_KEY] = [`An error occurred on the server.`];\n }\n\n form.setErrors(formErrors);\n};\n\nexport {\n FORM_FIELD_ERROR_KEY,\n setServerSideValidationErrors\n};\n","import { Directive, ElementRef, Inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { ENTRY_VALIDATION_CONFIG, EntryValidationConfig } from './entry-validation-config.model';\nimport { AbstractControl, FormControlStatus } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { FORM_FIELD_ERROR_KEY } from './entry-validation';\n\n/**\n * A directive that displays configured validation messages or server side validations for given form control.\n * The messages are separated with coma(,) and displayed as _innerHTML_ value of host component.\n *\n * @example\n * ```html\n * <div entryDisplayControlValidation [control]=\"myForm.controls.firstName\">\n * </div\n * ```\n */\n@Directive({\n selector: '[entryDisplayControlValidation]'\n})\nexport class EntryDisplayControlValidationDirective implements OnInit, OnDestroy {\n /** Form control for which the validation messages are displayed for. */\n @Input() control: AbstractControl;\n\n private _controlSubscription: Subscription | undefined;\n\n constructor(\n @Inject(ENTRY_VALIDATION_CONFIG) private readonly _config: EntryValidationConfig,\n private readonly _element: ElementRef) {}\n\n ngOnInit(): void {\n this._controlSubscription = this.control.statusChanges\n .subscribe((controlStatus: FormControlStatus) => {\n if (controlStatus === 'INVALID') {\n this._element.nativeElement.innerText = this.extractValidationMessages();\n }\n });\n }\n\n ngOnDestroy(): void {\n if (this._controlSubscription) {\n this._controlSubscription.unsubscribe();\n }\n }\n\n private extractValidationMessages(): string {\n if (!this.control.errors) {\n return '';\n }\n const errorsString = this._config.validationMessages\n .map(validationMessage => this.control.errors[validationMessage.name]\n ? typeof(validationMessage.message) === 'string'\n ? validationMessage.message : validationMessage.message(this.control)\n : ''\n )\n .filter(message => message !== '')\n .join(', ');\n\n const serverErrors = this.control.errors[FORM_FIELD_ERROR_KEY];\n const serverErrorsString = serverErrors instanceof Array ? serverErrors.join(', ') : '';\n\n return [errorsString, serverErrorsString].filter(x => x !== '').join(', ');\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { EntryFormErrorsComponent } from './entry-form-errors.component';\nimport { MatInputModule } from '@angular/material/input';\nimport { EntryDisplayControlValidationDirective } from './entry-display-control-validation.directive';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\n@NgModule({\n declarations: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule\n ],\n exports: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ]\n})\nexport class EntryValidationModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAGA;;;;;;;;;AASG;MAYU,wBAAwB,CAAA;;qHAAxB,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAxB,wBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,wBAAwB,EATzB,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;;;AAMT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,cAAA,EAAA,eAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,IAAA,EAAA,QAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,QAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,OAAA,EAAA,CAAA,CAAA;2FAGU,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAXpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAA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AAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,iBAd9B,wBAAwB;AACxB,QAAA,sCAAsC,aAGtC,YAAY;QACZ,WAAW;QACX,mBAAmB;AACnB,QAAA,cAAc,aAGd,wBAAwB;QACxB,sCAAsC,CAAA,EAAA,CAAA,CAAA;AAG7B,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAV9B,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc,CAAA,EAAA,CAAA,CAAA;2FAOL,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAhBjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;AACf,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;iBACF,CAAA;;;ACtBD;;AAEG;;;;"}
|
|
@@ -34,14 +34,19 @@ ControlType.select = 'select-input';
|
|
|
34
34
|
class EntrySearchFilterInputComponent {
|
|
35
35
|
constructor(config) {
|
|
36
36
|
this.config = config;
|
|
37
|
-
|
|
37
|
+
}
|
|
38
|
+
get textSearchFilter() {
|
|
39
|
+
return this.searchFilter.controlType === ControlType.text && this.searchFilter;
|
|
40
|
+
}
|
|
41
|
+
get selectSearchFilter() {
|
|
42
|
+
return this.searchFilter.controlType === ControlType.select && this.searchFilter;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
EntrySearchFilterInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntrySearchFilterInputComponent, deps: [{ token: ENTRY_SEARCH_FILTER_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
|
|
41
|
-
EntrySearchFilterInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntrySearchFilterInputComponent, selector: "entry-search-filter-input", inputs: { searchFilter: "searchFilter", form: "form" }, ngImport: i0, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <
|
|
46
|
+
EntrySearchFilterInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntrySearchFilterInputComponent, selector: "entry-search-filter-input", inputs: { searchFilter: "searchFilter", form: "form" }, ngImport: i0, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "component", type: i5.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
42
47
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntrySearchFilterInputComponent, decorators: [{
|
|
43
48
|
type: Component,
|
|
44
|
-
args: [{ selector: 'entry-search-filter-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <
|
|
49
|
+
args: [{ selector: 'entry-search-filter-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>" }]
|
|
45
50
|
}], ctorParameters: function () { return [{ type: EntrySearchFilterConfig, decorators: [{
|
|
46
51
|
type: Inject,
|
|
47
52
|
args: [ENTRY_SEARCH_FILTER_CONFIG]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components-search-filter.mjs","sources":["../../../../libs/entry-components/search-filter/search-filter-config.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/control-type.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.html","../../../../libs/entry-components/search-filter/entry-search-filter.component.ts","../../../../libs/entry-components/search-filter/entry-search-filter.component.html","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-base.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/text-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-filter-option.model.ts","../../../../libs/entry-components/search-filter/entry-search-filter.module.ts","../../../../libs/entry-components/search-filter/enigmatry-entry-components-search-filter.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntrySearchFilterConfig {\n /** Apply search filters button label (default 'Apply') */\n applyButtonText: string;\n /** Label for 'none selected' select filter option */\n noneSelectedOptionText: string;\n\n constructor(config: Partial<EntrySearchFilterConfig> = {}) {\n this.applyButtonText = config.applyButtonText ?? 'Apply';\n this.noneSelectedOptionText = config.noneSelectedOptionText ?? 'None';\n }\n}\nexport const ENTRY_SEARCH_FILTER_CONFIG = new InjectionToken<EntrySearchFilterConfig>(\n 'EntrySearchFilterConfig',\n {\n providedIn: 'root',\n factory: () => new EntrySearchFilterConfig()\n }\n);\n","export class ControlType {\n static text = 'text-input';\n static select = 'select-input';\n}\n","import { ChangeDetectionStrategy, Component, Inject, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\nimport { ControlType } from './control-type.model';\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from '../search-filter-config.model';\nimport { SearchFilterBase } from './search-filter-base.model';\n\n@Component({\n selector: 'entry-search-filter-input',\n templateUrl: './search-filter-input.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntrySearchFilterInputComponent<T> {\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\n @Input() searchFilter: SearchFilterBase<T>;\n /** Form group to which the search-filter input component will be added. */\n @Input() form: UntypedFormGroup;\n\n controlType = ControlType;\n\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\n}\n","<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <div [ngSwitch]=\"searchFilter.controlType\">\n\n <input *ngSwitchCase=\"controlType.text\"\n [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\"\n [type]=\"searchFilter.type\" matInput [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n\n <mat-select *ngSwitchCase=\"controlType.select\"\n [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\" [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n\n </div>\n</mat-form-field>","import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';\r\nimport { UntypedFormGroup } from '@angular/forms';\r\nimport { SearchFilterParams } from './search-filter-params.type';\r\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from './search-filter-config.model';\r\nimport { SearchFilterBase } from './search-filter-input/search-filter-base.model';\r\n\r\n/**\r\n * Entry SearchFilter component.\r\n */\r\n@Component({\r\n selector: 'entry-search-filter',\r\n templateUrl: './entry-search-filter.component.html',\r\n styleUrls: ['./entry-search-filter.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class EntrySearchFilterComponent implements OnInit {\r\n\r\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\r\n @Input() searchFilters: SearchFilterBase<any>[] = [];\r\n /**\r\n * Emits the change in SearchFilterParams so the containing component can apply them and retrieve the filtered results.\r\n */\r\n @Output() searchFilterChange = new EventEmitter<SearchFilterParams>();\r\n\r\n searchFilterForm!: UntypedFormGroup;\r\n\r\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\r\n\r\n ngOnInit() {\r\n this.searchFilterForm = this.toFormGroup(this.searchFilters);\r\n }\r\n\r\n onSubmit() {\r\n const formValue = this.searchFilterForm.value;\r\n this.searchFilterChange.emit(formValue);\r\n }\r\n\r\n toFormGroup(searchFilters: SearchFilterBase<any>[]) {\r\n const group: any = {};\r\n searchFilters.forEach(searchFilter => {\r\n const formControl = searchFilter.toFormControl();\r\n group[searchFilter.key] = formControl;\r\n searchFilter.formControl = formControl;\r\n });\r\n return new UntypedFormGroup(group);\r\n }\r\n}\r\n\r\n","<div class=\"search-form-container\">\r\n <form (ngSubmit)=\"onSubmit()\" [formGroup]=\"searchFilterForm\">\r\n <div class=\"search-form-fields\">\r\n <div *ngFor=\"let searchFilter of searchFilters\" class=\"search-form-field\">\r\n <entry-search-filter-input [searchFilter]=\"searchFilter\" [form]=\"searchFilterForm\">\r\n </entry-search-filter-input>\r\n </div>\r\n <div>\r\n <button type=\"button\" class=\"mat-raised-button mat-accent\" type=\"submit\">\r\n {{config.applyButtonText}}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</div>","import { FormControl } from '@angular/forms';\n\n/**\n * Base Entry search filter input component.\n */\nexport class SearchFilterBase<T> {\n /** Unique search-filter input key */\n key: string;\n /** Default value to be displayed/selected in the input control */\n value: T | undefined;\n /** Label text to be displayed for the search-filter input control */\n label: string;\n /** Placeholder text for search-filter input control */\n placeholder: string;\n /** Type of input control e.g. 'email' */\n type: string;\n /** Control type to be overridden in implementing class, used to render the proper input type e.g. 'text-input' */\n controlType: string;\n /** Max text length to be entered in the input component (default is 256) */\n maxLength: number;\n /** A reference to the form control it represents */\n formControl: FormControl<T>;\n\n constructor(options: Partial<SearchFilterBase<T>> = {}) {\n this.value = options.value;\n this.key = options.key || '';\n this.label = options.label || '';\n this.placeholder = options.placeholder || '';\n this.controlType = options.controlType || '';\n this.type = options.type || '';\n this.maxLength = options.maxLength || 256;\n }\n\n setValue(value: T | undefined) {\n this.value = value;\n if (this.formControl) {\n this.formControl.patchValue(value);\n }\n }\n\n toFormControl(): FormControl<T> {\n return new FormControl<T>(this.value);\n }\n}\n","import { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\n\n/**\n * Search filter text input filed configuration.\n */\nexport class TextSearchFilter extends SearchFilterBase<string> {\n override controlType = ControlType.text;\n}\n","import { Observable } from 'rxjs';\nimport { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\nimport { SelectFilterOption } from './select-filter-option.model';\n\n/**\n * Search filter select input field configuration. Select options can be provided as fixed list (`options`)\n * or observable (dynamic) list (`options$`).\n */\nexport class SelectSearchFilter<T> extends SearchFilterBase<T> {\n override controlType = ControlType.select;\n /** Fixed list of select filter options (default is empty list) */\n options: SelectFilterOption<T>[] = [];\n /** Observable (dynamic) list of select filter options */\n options$: Observable<SelectFilterOption<T>[]> | undefined;\n /**\n * Enables selection of multiple options (default is true).\n * If it is set to false, 'none selected' option becomes available as a first option.\n * */\n multiSelect = true;\n\n constructor(options: Partial<SelectSearchFilter<T>> = {}) {\n super(options);\n this.options = options.options;\n this.options$ = options.options$;\n this.multiSelect = options.multiSelect;\n }\n}\n","/** Model used to populate select filter options. */\nexport class SelectFilterOption<T> {\n constructor(\n /** Key used as a value for selected option */\n public key: T,\n /** String value used as display label of select option */\n public label: string) {}\n}\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatSelectModule } from '@angular/material/select';\r\n\r\nimport { EntrySearchFilterComponent } from './entry-search-filter.component';\r\nimport { EntrySearchFilterInputComponent } from './search-filter-input/search-filter-input.component';\r\n\r\n@NgModule({\r\n declarations: [\r\n EntrySearchFilterComponent,\r\n EntrySearchFilterInputComponent\r\n ],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatButtonModule,\r\n MatSelectModule\r\n ],\r\n exports: [\r\n EntrySearchFilterComponent\r\n ]\r\n})\r\nexport class EntrySearchFilterModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i3.EntrySearchFilterInputComponent"],"mappings":";;;;;;;;;;;;;;AAEA;;AAEG;MACU,uBAAuB,CAAA;AAMhC,IAAA,WAAA,CAAY,SAA2C,EAAE,EAAA;QACrD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,OAAO,CAAC;QACzD,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,sBAAsB,IAAI,MAAM,CAAC;KACzE;AACJ,CAAA;MACY,0BAA0B,GAAG,IAAI,cAAc,CACxD,yBAAyB,EACzB;AACI,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,IAAI,uBAAuB,EAAE;AAC/C,CAAA;;MCrBQ,WAAW,CAAA;;AACb,WAAI,CAAA,IAAA,GAAG,YAAY,CAAC;AACpB,WAAM,CAAA,MAAA,GAAG,cAAc;;MCSrB,+BAA+B,CAAA;AAQ1C,IAAA,WAAA,CAAuD,MAA+B,EAAA;QAA/B,IAAM,CAAA,MAAA,GAAN,MAAM,CAAyB;QAFtF,IAAW,CAAA,WAAA,GAAG,WAAW,CAAC;KAEiE;;AARhF,+BAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAA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A,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,iBAfhC,0BAA0B;AAC1B,QAAA,+BAA+B,aAG/B,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;AACf,QAAA,eAAe,aAGf,0BAA0B,CAAA,EAAA,CAAA,CAAA;AAGjB,uBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAXhC,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;QACf,eAAe,CAAA,EAAA,CAAA,CAAA;2FAMN,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAjBnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,0BAA0B;wBAC1B,+BAA+B;AAChC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;wBACd,eAAe;wBACf,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,0BAA0B;AAC3B,qBAAA;AACF,iBAAA,CAAA;;;AC1BD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components-search-filter.mjs","sources":["../../../../libs/entry-components/search-filter/search-filter-config.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/control-type.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.ts","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-input.component.html","../../../../libs/entry-components/search-filter/entry-search-filter.component.ts","../../../../libs/entry-components/search-filter/entry-search-filter.component.html","../../../../libs/entry-components/search-filter/search-filter-input/search-filter-base.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/text-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-search-filter.model.ts","../../../../libs/entry-components/search-filter/search-filter-input/inputs/select-filter-option.model.ts","../../../../libs/entry-components/search-filter/entry-search-filter.module.ts","../../../../libs/entry-components/search-filter/enigmatry-entry-components-search-filter.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntrySearchFilterConfig {\n /** Apply search filters button label (default 'Apply') */\n applyButtonText: string;\n /** Label for 'none selected' select filter option */\n noneSelectedOptionText: string;\n\n constructor(config: Partial<EntrySearchFilterConfig> = {}) {\n this.applyButtonText = config.applyButtonText ?? 'Apply';\n this.noneSelectedOptionText = config.noneSelectedOptionText ?? 'None';\n }\n}\nexport const ENTRY_SEARCH_FILTER_CONFIG = new InjectionToken<EntrySearchFilterConfig>(\n 'EntrySearchFilterConfig',\n {\n providedIn: 'root',\n factory: () => new EntrySearchFilterConfig()\n }\n);\n","export class ControlType {\n static text = 'text-input';\n static select = 'select-input';\n}\n","import { ChangeDetectionStrategy, Component, Inject, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\nimport { ControlType } from './control-type.model';\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from '../search-filter-config.model';\nimport { SearchFilterBase } from './search-filter-base.model';\nimport { SelectSearchFilter } from './inputs/select-search-filter.model';\nimport { TextSearchFilter } from './inputs/text-search-filter.model';\n\n@Component({\n selector: 'entry-search-filter-input',\n templateUrl: './search-filter-input.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class EntrySearchFilterInputComponent<T> {\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\n @Input() searchFilter: SearchFilterBase<T>;\n /** Form group to which the search-filter input component will be added. */\n @Input() form: UntypedFormGroup;\n\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\n\n get textSearchFilter(): TextSearchFilter | undefined {\n return this.searchFilter.controlType === ControlType.text && this.searchFilter as TextSearchFilter;\n }\n get selectSearchFilter(): SelectSearchFilter<T> | undefined {\n return this.searchFilter.controlType === ControlType.select && this.searchFilter as SelectSearchFilter<T>;\n }\n}\n","<mat-form-field [formGroup]=\"form\">\n <mat-label [attr.for]=\"searchFilter.key\">{{searchFilter.label}}</mat-label>\n\n <ng-container *ngIf=\"textSearchFilter as searchFilter\">\n <input [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [type]=\"searchFilter.type\" matInput\n [placeholder]=\"searchFilter.placeholder\" [maxlength]=\"searchFilter.maxLength\">\n </ng-container>\n\n <ng-container *ngIf=\"selectSearchFilter as searchFilter\">\n <mat-select [formControlName]=\"searchFilter.key\" [id]=\"searchFilter.key\" [multiple]=\"searchFilter.multiSelect\">\n <mat-option *ngIf=\"!searchFilter.multiSelect\" [value]=\"undefined\">\n {{config.noneSelectedOptionText}}\n </mat-option>\n <div *ngIf=\"searchFilter.options$ !== undefined; else fixedSelectValues\">\n <mat-option *ngFor=\"let option of searchFilter.options$ | async\"\n [value]=\"option.key\">{{option.label}}</mat-option>\n </div>\n <ng-template #fixedSelectValues>\n <mat-option *ngFor=\"let option of searchFilter.options\" [value]=\"option.key\">{{option.label}}</mat-option>\n </ng-template>\n </mat-select>\n </ng-container>\n\n</mat-form-field>","import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';\r\nimport { UntypedFormGroup } from '@angular/forms';\r\nimport { SearchFilterParams } from './search-filter-params.type';\r\nimport { ENTRY_SEARCH_FILTER_CONFIG, EntrySearchFilterConfig } from './search-filter-config.model';\r\nimport { SearchFilterBase } from './search-filter-input/search-filter-base.model';\r\n\r\n/**\r\n * Entry SearchFilter component.\r\n */\r\n@Component({\r\n selector: 'entry-search-filter',\r\n templateUrl: './entry-search-filter.component.html',\r\n styleUrls: ['./entry-search-filter.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class EntrySearchFilterComponent implements OnInit {\r\n\r\n /** Configuration of the search filters inputs that will be displayed in the search-filter component. */\r\n @Input() searchFilters: SearchFilterBase<any>[] = [];\r\n /**\r\n * Emits the change in SearchFilterParams so the containing component can apply them and retrieve the filtered results.\r\n */\r\n @Output() searchFilterChange = new EventEmitter<SearchFilterParams>();\r\n\r\n searchFilterForm!: UntypedFormGroup;\r\n\r\n constructor(@Inject(ENTRY_SEARCH_FILTER_CONFIG) public config: EntrySearchFilterConfig) { }\r\n\r\n ngOnInit() {\r\n this.searchFilterForm = this.toFormGroup(this.searchFilters);\r\n }\r\n\r\n onSubmit() {\r\n const formValue = this.searchFilterForm.value;\r\n this.searchFilterChange.emit(formValue);\r\n }\r\n\r\n toFormGroup(searchFilters: SearchFilterBase<any>[]) {\r\n const group: any = {};\r\n searchFilters.forEach(searchFilter => {\r\n const formControl = searchFilter.toFormControl();\r\n group[searchFilter.key] = formControl;\r\n searchFilter.formControl = formControl;\r\n });\r\n return new UntypedFormGroup(group);\r\n }\r\n}\r\n\r\n","<div class=\"search-form-container\">\r\n <form (ngSubmit)=\"onSubmit()\" [formGroup]=\"searchFilterForm\">\r\n <div class=\"search-form-fields\">\r\n <div *ngFor=\"let searchFilter of searchFilters\" class=\"search-form-field\">\r\n <entry-search-filter-input [searchFilter]=\"searchFilter\" [form]=\"searchFilterForm\">\r\n </entry-search-filter-input>\r\n </div>\r\n <div>\r\n <button type=\"button\" class=\"mat-raised-button mat-accent\" type=\"submit\">\r\n {{config.applyButtonText}}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</div>","import { FormControl } from '@angular/forms';\n\n/**\n * Base Entry search filter input component.\n */\nexport class SearchFilterBase<T> {\n /** Unique search-filter input key */\n key: string;\n /** Default value to be displayed/selected in the input control */\n value: T | undefined;\n /** Label text to be displayed for the search-filter input control */\n label: string;\n /** Placeholder text for search-filter input control */\n placeholder: string;\n /** Type of input control e.g. 'email' */\n type: string;\n /** Control type to be overridden in implementing class, used to render the proper input type e.g. 'text-input' */\n controlType: string;\n /** Max text length to be entered in the input component (default is 256) */\n maxLength: number;\n /** A reference to the form control it represents */\n formControl: FormControl<T>;\n\n constructor(options: Partial<SearchFilterBase<T>> = {}) {\n this.value = options.value;\n this.key = options.key || '';\n this.label = options.label || '';\n this.placeholder = options.placeholder || '';\n this.controlType = options.controlType || '';\n this.type = options.type || '';\n this.maxLength = options.maxLength || 256;\n }\n\n setValue(value: T | undefined) {\n this.value = value;\n if (this.formControl) {\n this.formControl.patchValue(value);\n }\n }\n\n toFormControl(): FormControl<T> {\n return new FormControl<T>(this.value);\n }\n}\n","import { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\n\n/**\n * Search filter text input filed configuration.\n */\nexport class TextSearchFilter extends SearchFilterBase<string> {\n override controlType = ControlType.text;\n}\n","import { Observable } from 'rxjs';\nimport { ControlType } from '../control-type.model';\nimport { SearchFilterBase } from '../search-filter-base.model';\nimport { SelectFilterOption } from './select-filter-option.model';\n\n/**\n * Search filter select input field configuration. Select options can be provided as fixed list (`options`)\n * or observable (dynamic) list (`options$`).\n */\nexport class SelectSearchFilter<T> extends SearchFilterBase<T> {\n override controlType = ControlType.select;\n /** Fixed list of select filter options (default is empty list) */\n options: SelectFilterOption<T>[] = [];\n /** Observable (dynamic) list of select filter options */\n options$: Observable<SelectFilterOption<T>[]> | undefined;\n /**\n * Enables selection of multiple options (default is true).\n * If it is set to false, 'none selected' option becomes available as a first option.\n * */\n multiSelect = true;\n\n constructor(options: Partial<SelectSearchFilter<T>> = {}) {\n super(options);\n this.options = options.options;\n this.options$ = options.options$;\n this.multiSelect = options.multiSelect;\n }\n}\n","/** Model used to populate select filter options. */\nexport class SelectFilterOption<T> {\n constructor(\n /** Key used as a value for selected option */\n public key: T,\n /** String value used as display label of select option */\n public label: string) {}\n}\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatSelectModule } from '@angular/material/select';\r\n\r\nimport { EntrySearchFilterComponent } from './entry-search-filter.component';\r\nimport { EntrySearchFilterInputComponent } from './search-filter-input/search-filter-input.component';\r\n\r\n@NgModule({\r\n declarations: [\r\n EntrySearchFilterComponent,\r\n EntrySearchFilterInputComponent\r\n ],\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatButtonModule,\r\n MatSelectModule\r\n ],\r\n exports: [\r\n EntrySearchFilterComponent\r\n ]\r\n})\r\nexport class EntrySearchFilterModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i3.EntrySearchFilterInputComponent"],"mappings":";;;;;;;;;;;;;;AAEA;;AAEG;MACU,uBAAuB,CAAA;AAMhC,IAAA,WAAA,CAAY,SAA2C,EAAE,EAAA;QACrD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,OAAO,CAAC;QACzD,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,sBAAsB,IAAI,MAAM,CAAC;KACzE;AACJ,CAAA;MACY,0BAA0B,GAAG,IAAI,cAAc,CACxD,yBAAyB,EACzB;AACI,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,IAAI,uBAAuB,EAAE;AAC/C,CAAA;;MCrBQ,WAAW,CAAA;;AACb,WAAI,CAAA,IAAA,GAAG,YAAY,CAAC;AACpB,WAAM,CAAA,MAAA,GAAG,cAAc;;MCWrB,+BAA+B,CAAA;AAM1C,IAAA,WAAA,CAAuD,MAA+B,EAAA;QAA/B,IAAM,CAAA,MAAA,GAAN,MAAM,CAAyB;KAAK;AAE3F,IAAA,IAAI,gBAAgB,GAAA;AAClB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,KAAK,WAAW,CAAC,IAAI,IAAI,IAAI,CAA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BAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,iBAfhC,0BAA0B;AAC1B,QAAA,+BAA+B,aAG/B,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;AACf,QAAA,eAAe,aAGf,0BAA0B,CAAA,EAAA,CAAA,CAAA;AAGjB,uBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAXhC,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc;QACd,eAAe;QACf,eAAe,CAAA,EAAA,CAAA,CAAA;2FAMN,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAjBnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,0BAA0B;wBAC1B,+BAA+B;AAChC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;wBACd,eAAe;wBACf,eAAe;AAChB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,0BAA0B;AAC3B,qBAAA;AACF,iBAAA,CAAA;;;AC1BD;;AAEG;;;;"}
|
|
@@ -21,7 +21,9 @@ class EntryFormErrorsComponent {
|
|
|
21
21
|
EntryFormErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryFormErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
22
22
|
EntryFormErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EntryFormErrorsComponent, selector: "entry-form-errors", inputs: { form: "form" }, ngImport: i0, template: `
|
|
23
23
|
<div *ngIf="form.errors">
|
|
24
|
-
<mat-error *ngFor="let error of form.errors.general">
|
|
24
|
+
<mat-error *ngFor="let error of form.errors.general">
|
|
25
|
+
<span class="mat-body-2">{{error}}</span>
|
|
26
|
+
</mat-error>
|
|
25
27
|
</div>
|
|
26
28
|
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
27
29
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryFormErrorsComponent, decorators: [{
|
|
@@ -30,7 +32,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
30
32
|
selector: 'entry-form-errors',
|
|
31
33
|
template: `
|
|
32
34
|
<div *ngIf="form.errors">
|
|
33
|
-
<mat-error *ngFor="let error of form.errors.general">
|
|
35
|
+
<mat-error *ngFor="let error of form.errors.general">
|
|
36
|
+
<span class="mat-body-2">{{error}}</span>
|
|
37
|
+
</mat-error>
|
|
34
38
|
</div>
|
|
35
39
|
`,
|
|
36
40
|
changeDetection: ChangeDetectionStrategy.Default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components-validation.mjs","sources":["../../../../libs/entry-components/validation/entry-form-errors.component.ts","../../../../libs/entry-components/validation/entry-validation-config.model.ts","../../../../libs/entry-components/validation/entry-validation.ts","../../../../libs/entry-components/validation/entry-display-control-validation.directive.ts","../../../../libs/entry-components/validation/entry-validation.module.ts","../../../../libs/entry-components/validation/enigmatry-entry-components-validation.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\n\n/**\n * A component used to display generic (form level) server side validation messages.\n * The messages are displayed as a list, each message in a new row.\n *\n * @example\n * ```html\n * <entry-form-errors [form]=\"myForm\">\n * </entry-form-errors>\n * ```\n */\n@Component({\n selector: 'entry-form-errors',\n template: `\n <div *ngIf=\"form.errors\">\n <mat-error *ngFor=\"let error of form.errors.general\">{{error}}</mat-error>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class EntryFormErrorsComponent {\n /** A form group for which the validation errors are being displayed. */\n @Input() form: UntypedFormGroup;\n}\n","import { InjectionToken } from '@angular/core';\nimport { AbstractControl } from '@angular/forms';\n\n/** Used to configure mapping between validation keys and messages */\nexport interface IEntryValidationMessage {\n /** Validation key (e.g. '_required_', '_minlength_', '_email_', etc.) */\n name: string;\n /**\n * Validation message. Can be static string or expression returning string\n * (when messages need to be resolved dynamically: parametrization, localization, etc.).\n */\n message: string | ((control: AbstractControl) => string);\n}\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntryValidationConfig {\n /**\n * Validation key to message configuration on module level. Used to configure client side validation messages\n * for standard validators (_required_, _minLength_, _email_, etc.).\n *\n * **NOTE:** If using _Formly_ package to render forms, this configuration should not be used.\n * Instead, use `FormlyModule` to configure validation messages.\n *\n * @example\n * ```ts\n * new EntryValidationConfig() {\n * validationMessages: [\n * { name: 'required': message: 'This field is mandatory' },\n * { name: 'minlength', message: (control: AbstractControl) => `Minimal length is ${control.errors.minlength.requiredLength}`}\n * ]\n * }\n * ```\n */\n validationMessages: IEntryValidationMessage[];\n\n constructor(config: Partial<EntryValidationConfig> = {}) {\n this.validationMessages = config.validationMessages ?? [];\n }\n}\n\n/**\n * Entry validation injection token of EntryValidationConfig type containing validation default configurations.\n * Can be updated with custom configuration.\n *\n * Defaults:\n * - validationMessages: []\n */\nexport const ENTRY_VALIDATION_CONFIG = new InjectionToken<EntryValidationConfig>(\n 'EntryValidationConfig',\n {\n providedIn: 'root',\n factory: () => new EntryValidationConfig()\n }\n);\n","import { AbstractControl, FormArray, FormGroup, UntypedFormGroup, ValidationErrors } from '@angular/forms';\nimport { IValidationProblemDetails } from './validation-problem-details.interface';\n\n/** A key used to map server side validation errors on form level */\nconst FORM_ERROR_KEY = 'general';\n/** A key used to map server side validation errors on form field level */\nconst FORM_FIELD_ERROR_KEY = 'fromServer';\n\nconst getFormControl = (formControl: AbstractControl | null | undefined, keys: string[]): AbstractControl | null | undefined => {\n if (keys.length === 0) {\n return formControl;\n }\n if (formControl instanceof FormGroup) {\n return getFormControl(formControl.controls[keys[0].charAt(0).toLowerCase() + keys[0].slice(1)], keys.slice(1));\n }\n if (formControl instanceof FormArray && +keys[0] >= 0) {\n return getFormControl(formControl.controls[+keys[0]], keys.slice(1));\n }\n return null;\n};\n\n/**\n * Applies validation errors received from server side to the form.\n * The errors are applied to multiple levels: form, form group, form array, and form field.\n *\n * @param error Server side validation errors response.\n * @param form Form to apply validation errors to.\n */\nconst setServerSideValidationErrors = (error: IValidationProblemDetails, form: UntypedFormGroup) => {\n form.setErrors(null);\n const validationErrors = error?.errors;\n const formErrors: ValidationErrors = {};\n\n if (validationErrors) {\n // eslint-disable-next-line guard-for-in\n for (const key in validationErrors) {\n const control = getFormControl(form, key.split(/[.[\\]]+/gu));\n\n if (control) {\n const fieldErrors = {} as ValidationErrors;\n fieldErrors[FORM_FIELD_ERROR_KEY] = validationErrors[key];\n control.setErrors(fieldErrors);\n control.markAsTouched();\n } else {\n formErrors[FORM_ERROR_KEY] =\n formErrors[FORM_ERROR_KEY]?.concat(validationErrors[key]) || validationErrors[key];\n }\n }\n } else {\n formErrors[FORM_ERROR_KEY] = [`An error occurred on the server.`];\n }\n\n form.setErrors(formErrors);\n};\n\nexport {\n FORM_FIELD_ERROR_KEY,\n setServerSideValidationErrors\n};\n","import { Directive, ElementRef, Inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { ENTRY_VALIDATION_CONFIG, EntryValidationConfig } from './entry-validation-config.model';\nimport { AbstractControl, FormControlStatus } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { FORM_FIELD_ERROR_KEY } from './entry-validation';\n\n/**\n * A directive that displays configured validation messages or server side validations for given form control.\n * The messages are separated with coma(,) and displayed as _innerHTML_ value of host component.\n *\n * @example\n * ```html\n * <div entryDisplayControlValidation [control]=\"myForm.controls.firstName\">\n * </div\n * ```\n */\n@Directive({\n selector: '[entryDisplayControlValidation]'\n})\nexport class EntryDisplayControlValidationDirective implements OnInit, OnDestroy {\n /** Form control for which the validation messages are displayed for. */\n @Input() control: AbstractControl;\n\n private _controlSubscription: Subscription | undefined;\n\n constructor(\n @Inject(ENTRY_VALIDATION_CONFIG) private readonly _config: EntryValidationConfig,\n private readonly _element: ElementRef) {}\n\n ngOnInit(): void {\n this._controlSubscription = this.control.statusChanges\n .subscribe((controlStatus: FormControlStatus) => {\n if (controlStatus === 'INVALID') {\n this._element.nativeElement.innerText = this.extractValidationMessages();\n }\n });\n }\n\n ngOnDestroy(): void {\n if (this._controlSubscription) {\n this._controlSubscription.unsubscribe();\n }\n }\n\n private extractValidationMessages(): string {\n if (!this.control.errors) {\n return '';\n }\n const errorsString = this._config.validationMessages\n .map(validationMessage => this.control.errors[validationMessage.name]\n ? typeof(validationMessage.message) === 'string'\n ? validationMessage.message : validationMessage.message(this.control)\n : ''\n )\n .filter(message => message !== '')\n .join(', ');\n\n const serverErrors = this.control.errors[FORM_FIELD_ERROR_KEY];\n const serverErrorsString = serverErrors instanceof Array ? serverErrors.join(', ') : '';\n\n return [errorsString, serverErrorsString].filter(x => x !== '').join(', ');\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { EntryFormErrorsComponent } from './entry-form-errors.component';\nimport { MatInputModule } from '@angular/material/input';\nimport { EntryDisplayControlValidationDirective } from './entry-display-control-validation.directive';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\n@NgModule({\n declarations: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule\n ],\n exports: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ]\n})\nexport class EntryValidationModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAGA;;;;;;;;;AASG;MAUU,wBAAwB,CAAA;;qHAAxB,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAxB,wBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,wBAAwB,EAPzB,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,cAAA,EAAA,eAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,IAAA,EAAA,QAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,QAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,OAAA,EAAA,CAAA,CAAA;2FAGU,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBATpC,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CAAsC,CAAA,EAAA,CAAA,CAAA;AAG7B,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAV9B,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,cAAc,CAAA,EAAA,CAAA,CAAA;2FAOL,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAhBjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;AACf,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;AACF,iBAAA,CAAA;;;ACtBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components-validation.mjs","sources":["../../../../libs/entry-components/validation/entry-form-errors.component.ts","../../../../libs/entry-components/validation/entry-validation-config.model.ts","../../../../libs/entry-components/validation/entry-validation.ts","../../../../libs/entry-components/validation/entry-display-control-validation.directive.ts","../../../../libs/entry-components/validation/entry-validation.module.ts","../../../../libs/entry-components/validation/enigmatry-entry-components-validation.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { UntypedFormGroup } from '@angular/forms';\n\n/**\n * A component used to display generic (form level) server side validation messages.\n * The messages are displayed as a list, each message in a new row.\n *\n * @example\n * ```html\n * <entry-form-errors [form]=\"myForm\">\n * </entry-form-errors>\n * ```\n */\n@Component({\n selector: 'entry-form-errors',\n template: `\n <div *ngIf=\"form.errors\">\n <mat-error *ngFor=\"let error of form.errors.general\">\n <span class=\"mat-body-2\">{{error}}</span>\n </mat-error>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class EntryFormErrorsComponent {\n /** A form group for which the validation errors are being displayed. */\n @Input() form: UntypedFormGroup;\n}\n","import { InjectionToken } from '@angular/core';\nimport { AbstractControl } from '@angular/forms';\n\n/** Used to configure mapping between validation keys and messages */\nexport interface IEntryValidationMessage {\n /** Validation key (e.g. '_required_', '_minlength_', '_email_', etc.) */\n name: string;\n /**\n * Validation message. Can be static string or expression returning string\n * (when messages need to be resolved dynamically: parametrization, localization, etc.).\n */\n message: string | ((control: AbstractControl) => string);\n}\n\n/**\n * Used to provide default configurations on module level.\n */\nexport class EntryValidationConfig {\n /**\n * Validation key to message configuration on module level. Used to configure client side validation messages\n * for standard validators (_required_, _minLength_, _email_, etc.).\n *\n * **NOTE:** If using _Formly_ package to render forms, this configuration should not be used.\n * Instead, use `FormlyModule` to configure validation messages.\n *\n * @example\n * ```ts\n * new EntryValidationConfig() {\n * validationMessages: [\n * { name: 'required': message: 'This field is mandatory' },\n * { name: 'minlength', message: (control: AbstractControl) => `Minimal length is ${control.errors.minlength.requiredLength}`}\n * ]\n * }\n * ```\n */\n validationMessages: IEntryValidationMessage[];\n\n constructor(config: Partial<EntryValidationConfig> = {}) {\n this.validationMessages = config.validationMessages ?? [];\n }\n}\n\n/**\n * Entry validation injection token of EntryValidationConfig type containing validation default configurations.\n * Can be updated with custom configuration.\n *\n * Defaults:\n * - validationMessages: []\n */\nexport const ENTRY_VALIDATION_CONFIG = new InjectionToken<EntryValidationConfig>(\n 'EntryValidationConfig',\n {\n providedIn: 'root',\n factory: () => new EntryValidationConfig()\n }\n);\n","import { AbstractControl, FormArray, FormGroup, UntypedFormGroup, ValidationErrors } from '@angular/forms';\nimport { IValidationProblemDetails } from './validation-problem-details.interface';\n\n/** A key used to map server side validation errors on form level */\nconst FORM_ERROR_KEY = 'general';\n/** A key used to map server side validation errors on form field level */\nconst FORM_FIELD_ERROR_KEY = 'fromServer';\n\nconst getFormControl = (formControl: AbstractControl | null | undefined, keys: string[]): AbstractControl | null | undefined => {\n if (keys.length === 0) {\n return formControl;\n }\n if (formControl instanceof FormGroup) {\n return getFormControl(formControl.controls[keys[0].charAt(0).toLowerCase() + keys[0].slice(1)], keys.slice(1));\n }\n if (formControl instanceof FormArray && +keys[0] >= 0) {\n return getFormControl(formControl.controls[+keys[0]], keys.slice(1));\n }\n return null;\n};\n\n/**\n * Applies validation errors received from server side to the form.\n * The errors are applied to multiple levels: form, form group, form array, and form field.\n *\n * @param error Server side validation errors response.\n * @param form Form to apply validation errors to.\n */\nconst setServerSideValidationErrors = (error: IValidationProblemDetails, form: UntypedFormGroup) => {\n form.setErrors(null);\n const validationErrors = error?.errors;\n const formErrors: ValidationErrors = {};\n\n if (validationErrors) {\n // eslint-disable-next-line guard-for-in\n for (const key in validationErrors) {\n const control = getFormControl(form, key.split(/[.[\\]]+/gu));\n\n if (control) {\n const fieldErrors = {} as ValidationErrors;\n fieldErrors[FORM_FIELD_ERROR_KEY] = validationErrors[key];\n control.setErrors(fieldErrors);\n control.markAsTouched();\n } else {\n formErrors[FORM_ERROR_KEY] =\n formErrors[FORM_ERROR_KEY]?.concat(validationErrors[key]) || validationErrors[key];\n }\n }\n } else {\n formErrors[FORM_ERROR_KEY] = [`An error occurred on the server.`];\n }\n\n form.setErrors(formErrors);\n};\n\nexport {\n FORM_FIELD_ERROR_KEY,\n setServerSideValidationErrors\n};\n","import { Directive, ElementRef, Inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { ENTRY_VALIDATION_CONFIG, EntryValidationConfig } from './entry-validation-config.model';\nimport { AbstractControl, FormControlStatus } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { FORM_FIELD_ERROR_KEY } from './entry-validation';\n\n/**\n * A directive that displays configured validation messages or server side validations for given form control.\n * The messages are separated with coma(,) and displayed as _innerHTML_ value of host component.\n *\n * @example\n * ```html\n * <div entryDisplayControlValidation [control]=\"myForm.controls.firstName\">\n * </div\n * ```\n */\n@Directive({\n selector: '[entryDisplayControlValidation]'\n})\nexport class EntryDisplayControlValidationDirective implements OnInit, OnDestroy {\n /** Form control for which the validation messages are displayed for. */\n @Input() control: AbstractControl;\n\n private _controlSubscription: Subscription | undefined;\n\n constructor(\n @Inject(ENTRY_VALIDATION_CONFIG) private readonly _config: EntryValidationConfig,\n private readonly _element: ElementRef) {}\n\n ngOnInit(): void {\n this._controlSubscription = this.control.statusChanges\n .subscribe((controlStatus: FormControlStatus) => {\n if (controlStatus === 'INVALID') {\n this._element.nativeElement.innerText = this.extractValidationMessages();\n }\n });\n }\n\n ngOnDestroy(): void {\n if (this._controlSubscription) {\n this._controlSubscription.unsubscribe();\n }\n }\n\n private extractValidationMessages(): string {\n if (!this.control.errors) {\n return '';\n }\n const errorsString = this._config.validationMessages\n .map(validationMessage => this.control.errors[validationMessage.name]\n ? typeof(validationMessage.message) === 'string'\n ? validationMessage.message : validationMessage.message(this.control)\n : ''\n )\n .filter(message => message !== '')\n .join(', ');\n\n const serverErrors = this.control.errors[FORM_FIELD_ERROR_KEY];\n const serverErrorsString = serverErrors instanceof Array ? serverErrors.join(', ') : '';\n\n return [errorsString, serverErrorsString].filter(x => x !== '').join(', ');\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { EntryFormErrorsComponent } from './entry-form-errors.component';\nimport { MatInputModule } from '@angular/material/input';\nimport { EntryDisplayControlValidationDirective } from './entry-display-control-validation.directive';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\n@NgModule({\n declarations: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule\n ],\n exports: [\n EntryFormErrorsComponent,\n EntryDisplayControlValidationDirective\n ]\n})\nexport class EntryValidationModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAGA;;;;;;;;;AASG;MAYU,wBAAwB,CAAA;;qHAAxB,wBAAwB,EAAA,IAAA,EAAA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L,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAhBjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,cAAc;AACf,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,wBAAwB;wBACxB,sCAAsC;AACvC,qBAAA;AACF,iBAAA,CAAA;;;ACtBD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmatry/entry-components",
|
|
3
|
-
"version": "1.15.1-preview.
|
|
3
|
+
"version": "1.15.1-preview.24",
|
|
4
4
|
"author": "Enigmatry",
|
|
5
5
|
"description": "Enigmatry entry angular material components",
|
|
6
6
|
"homepage": "https://github.com/enigmatry/entry-angular-building-blocks/tree/master/libs/entry-components#readme",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { UntypedFormGroup } from '@angular/forms';
|
|
2
|
-
import { ControlType } from './control-type.model';
|
|
3
2
|
import { EntrySearchFilterConfig } from '../search-filter-config.model';
|
|
4
3
|
import { SearchFilterBase } from './search-filter-base.model';
|
|
4
|
+
import { SelectSearchFilter } from './inputs/select-search-filter.model';
|
|
5
|
+
import { TextSearchFilter } from './inputs/text-search-filter.model';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export declare class EntrySearchFilterInputComponent<T> {
|
|
7
8
|
config: EntrySearchFilterConfig;
|
|
@@ -9,8 +10,9 @@ export declare class EntrySearchFilterInputComponent<T> {
|
|
|
9
10
|
searchFilter: SearchFilterBase<T>;
|
|
10
11
|
/** Form group to which the search-filter input component will be added. */
|
|
11
12
|
form: UntypedFormGroup;
|
|
12
|
-
controlType: typeof ControlType;
|
|
13
13
|
constructor(config: EntrySearchFilterConfig);
|
|
14
|
+
get textSearchFilter(): TextSearchFilter | undefined;
|
|
15
|
+
get selectSearchFilter(): SelectSearchFilter<T> | undefined;
|
|
14
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntrySearchFilterInputComponent<any>, never>;
|
|
15
17
|
static ɵcmp: i0.ɵɵComponentDeclaration<EntrySearchFilterInputComponent<any>, "entry-search-filter-input", never, { "searchFilter": "searchFilter"; "form": "form"; }, {}, never, never, false, never>;
|
|
16
18
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.entry-form {
|
|
4
4
|
.action-buttons {
|
|
5
|
-
margin-top:
|
|
5
|
+
margin-top: 15px;
|
|
6
6
|
|
|
7
7
|
.mdc-button:not(:first-child) {
|
|
8
8
|
margin-left: 10px;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.mat-mdc-form-field {
|
|
17
|
-
margin-bottom:
|
|
17
|
+
margin-bottom: 15px;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.mdc-form-field {
|