@yuuvis/client-framework 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/yuuvis-client-framework-forms.mjs +702 -613
- package/fesm2022/yuuvis-client-framework-forms.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-metadata-form-defaults.mjs +4 -3
- package/fesm2022/yuuvis-client-framework-metadata-form-defaults.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-metadata-form.mjs +4 -2
- package/fesm2022/yuuvis-client-framework-metadata-form.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-details.mjs +173 -173
- package/fesm2022/yuuvis-client-framework-object-details.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-form.mjs +9 -5
- package/fesm2022/yuuvis-client-framework-object-form.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-relationship.mjs +1 -1
- package/fesm2022/yuuvis-client-framework-object-relationship.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-summary.mjs +2 -2
- package/fesm2022/yuuvis-client-framework-object-summary.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-renderer.mjs +1 -1
- package/fesm2022/yuuvis-client-framework-renderer.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-sequence-list.mjs +47 -35
- package/fesm2022/yuuvis-client-framework-sequence-list.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-tile-list.mjs +34 -17
- package/fesm2022/yuuvis-client-framework-tile-list.mjs.map +1 -1
- package/lib/assets/i18n/de.json +22 -22
- package/lib/assets/i18n/en.json +12 -12
- package/package.json +6 -6
- package/types/yuuvis-client-framework-forms.d.ts +215 -186
- package/types/yuuvis-client-framework-object-details.d.ts +99 -99
- package/types/yuuvis-client-framework-sequence-list.d.ts +2 -2
- package/types/yuuvis-client-framework-tile-list.d.ts +3 -2
|
@@ -1,36 +1,36 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, DestroyRef, input, signal, effect, untracked, Component, forwardRef, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, computed, linkedSignal, viewChild, output, Input, NgModule } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed, rxResource } from '@angular/core/rxjs-interop';
|
|
4
|
+
import * as i1$1 from '@angular/forms';
|
|
5
|
+
import { FormControl, Validators, ReactiveFormsModule, FormBuilder, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormGroup, FormsModule } from '@angular/forms';
|
|
6
|
+
import { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
+
import * as i1 from '@angular/material/select';
|
|
8
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
9
|
+
import { SystemService, TranslateService, Classification, Situation, TranslatePipe, Operator, OperatorLabel, Utils, CatalogService, LocaleNumberPipe, FileSizePipe, IdmService, UserService, SearchUtils, LocaleDatePipe, ClassificationPrefix } from '@yuuvis/client-core';
|
|
10
|
+
import { AbstractMatFormField, injectNgControl, FormTranslateService, DialogComponent, ScrollButtonsComponent } from '@yuuvis/client-framework/common';
|
|
1
11
|
import * as i1$3 from '@angular/common';
|
|
2
12
|
import { NgClass, CommonModule } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, signal, input, forwardRef, ChangeDetectionStrategy, Component, ChangeDetectorRef, ElementRef, computed, linkedSignal, effect, untracked, DestroyRef, viewChild, output, Input, NgModule } from '@angular/core';
|
|
5
|
-
import * as i1 from '@angular/forms';
|
|
6
|
-
import { FormBuilder, Validators, ReactiveFormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormControl, FormGroup, FormsModule } from '@angular/forms';
|
|
7
13
|
import { MatButtonModule } from '@angular/material/button';
|
|
8
14
|
import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule, MatDialog } from '@angular/material/dialog';
|
|
9
15
|
import * as i2 from '@angular/material/icon';
|
|
10
16
|
import { MatIconModule } from '@angular/material/icon';
|
|
11
|
-
import * as i1$
|
|
17
|
+
import * as i1$2 from '@angular/material/menu';
|
|
12
18
|
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
|
|
13
19
|
import * as i3 from '@angular/material/table';
|
|
14
20
|
import { MatTableModule } from '@angular/material/table';
|
|
15
21
|
import * as i4 from '@angular/material/tooltip';
|
|
16
22
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
17
|
-
import { SystemService, Situation, TranslatePipe, TranslateService, Operator, OperatorLabel, Utils, LocaleNumberPipe, FileSizePipe, Classification, IdmService, UserService, SearchUtils, LocaleDatePipe, ClassificationPrefix } from '@yuuvis/client-core';
|
|
18
23
|
import { YUV_ICONS } from '@yuuvis/client-framework/icons';
|
|
19
24
|
import { MetadataFormFieldComponent, ObjectMetadataElementLabelDirective } from '@yuuvis/client-framework/metadata-form';
|
|
20
25
|
import { RendererDirective } from '@yuuvis/client-framework/renderer';
|
|
21
26
|
import { YmtButtonDirective, YmtIconButtonDirective } from '@yuuvis/material';
|
|
22
27
|
import { map, timer, take, of, forkJoin } from 'rxjs';
|
|
23
|
-
import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
|
|
24
|
-
import { FormTranslateService, DialogComponent, AbstractMatFormField, injectNgControl, ScrollButtonsComponent } from '@yuuvis/client-framework/common';
|
|
25
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
26
28
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
27
29
|
import { MatInputModule } from '@angular/material/input';
|
|
28
30
|
import { TranslateService as TranslateService$1, TranslatePipe as TranslatePipe$1 } from '@ngx-translate/core';
|
|
29
31
|
import * as i2$1 from '@yuuvis/client-framework/datepicker';
|
|
30
32
|
import { DatepickerComponent, YuvDatepickerModule } from '@yuuvis/client-framework/datepicker';
|
|
31
|
-
import * as
|
|
32
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
33
|
-
import * as i3$1 from '@yuuvis/client-framework/autocomplete';
|
|
33
|
+
import * as i2$2 from '@yuuvis/client-framework/autocomplete';
|
|
34
34
|
import { YuvAutocompleteModule } from '@yuuvis/client-framework/autocomplete';
|
|
35
35
|
import { map as map$1, catchError } from 'rxjs/operators';
|
|
36
36
|
import { marker } from '@colsen1991/ngx-translate-extract-marker';
|
|
@@ -38,6 +38,112 @@ import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
|
38
38
|
import * as i1$4 from '@angular/material/chips';
|
|
39
39
|
import { MatChipsModule } from '@angular/material/chips';
|
|
40
40
|
|
|
41
|
+
class FormUtils {
|
|
42
|
+
static getErrorState(control) {
|
|
43
|
+
return control.invalid && (control.dirty || control.touched);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
class CatalogComponent extends AbstractMatFormField {
|
|
48
|
+
constructor() {
|
|
49
|
+
super(...arguments);
|
|
50
|
+
this.#system = inject(SystemService);
|
|
51
|
+
this.#dRef = inject(DestroyRef);
|
|
52
|
+
this.translate = inject(TranslateService);
|
|
53
|
+
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
54
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
55
|
+
this._options = signal([], ...(ngDevMode ? [{ debugName: "_options" }] : /* istanbul ignore next */ []));
|
|
56
|
+
this.options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
57
|
+
this.#optionsEffect = effect(() => {
|
|
58
|
+
untracked(() => {
|
|
59
|
+
this.#setOptions(this.options() || [], false);
|
|
60
|
+
});
|
|
61
|
+
}, ...(ngDevMode ? [{ debugName: "#optionsEffect" }] : /* istanbul ignore next */ []));
|
|
62
|
+
/**
|
|
63
|
+
* Additional semantics for the form element.
|
|
64
|
+
*/
|
|
65
|
+
this.classifications = input([], ...(ngDevMode ? [{ debugName: "classifications" }] : /* istanbul ignore next */ []));
|
|
66
|
+
this.#classificationEffect = effect(() => {
|
|
67
|
+
const cls = this.classifications();
|
|
68
|
+
untracked(() => {
|
|
69
|
+
const ce = this.#system.getClassifications(cls).get(Classification.STRING_CATALOG);
|
|
70
|
+
if (ce && ce.options) {
|
|
71
|
+
this.#setOptions(ce.options, false);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}, ...(ngDevMode ? [{ debugName: "#classificationEffect" }] : /* istanbul ignore next */ []));
|
|
75
|
+
/**
|
|
76
|
+
* Possibles values are `EDIT` (default),`SEARCH`,`CREATE`. In search situation validation of the form element will be turned off, so you are able to enter search terms that do not meet the elements validators.
|
|
77
|
+
*/
|
|
78
|
+
this.situation = input(...(ngDevMode ? [undefined, { debugName: "situation" }] : /* istanbul ignore next */ []));
|
|
79
|
+
this.ngControl = injectNgControl(this);
|
|
80
|
+
this.fc = new FormControl(undefined);
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
82
|
+
this.propagateChange = (_) => { };
|
|
83
|
+
}
|
|
84
|
+
#system;
|
|
85
|
+
#dRef;
|
|
86
|
+
#optionsEffect;
|
|
87
|
+
#classificationEffect;
|
|
88
|
+
#onValueChange(val) {
|
|
89
|
+
this.value = val;
|
|
90
|
+
this.propagateChange(this.value);
|
|
91
|
+
}
|
|
92
|
+
#setOptions(options, translate) {
|
|
93
|
+
if (translate) {
|
|
94
|
+
this._options.set(options.map((o) => ({
|
|
95
|
+
label: this.translate.instant(o),
|
|
96
|
+
value: o
|
|
97
|
+
})));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this._options.set(options.map((o) => ({
|
|
101
|
+
label: o,
|
|
102
|
+
value: o
|
|
103
|
+
})));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
writeValue(value) {
|
|
107
|
+
this.value = value;
|
|
108
|
+
this.fc.setValue(value, { emitEvent: false });
|
|
109
|
+
}
|
|
110
|
+
registerOnChange(fn) {
|
|
111
|
+
this.propagateChange = fn;
|
|
112
|
+
}
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
114
|
+
registerOnTouched(fn) { }
|
|
115
|
+
setDisabledState(isDisabled) {
|
|
116
|
+
if (isDisabled) {
|
|
117
|
+
this.fc.disable();
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
this.fc.enable();
|
|
121
|
+
}
|
|
122
|
+
this.disabled = isDisabled;
|
|
123
|
+
}
|
|
124
|
+
ngOnInit() {
|
|
125
|
+
if (this.required)
|
|
126
|
+
this.fc.setValidators(Validators.required);
|
|
127
|
+
this.fc.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
128
|
+
this.errorState = FormUtils.getErrorState(this.fc);
|
|
129
|
+
if (this.ngControl?.control) {
|
|
130
|
+
this.ngControl.control.setErrors(this.fc.errors);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
this.fc.updateValueAndValidity();
|
|
134
|
+
this.fc.valueChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => this.#onValueChange(v));
|
|
135
|
+
}
|
|
136
|
+
ngOnDestroy() {
|
|
137
|
+
super.onNgOnDestroy();
|
|
138
|
+
}
|
|
139
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CatalogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
140
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CatalogComponent, isStandalone: true, selector: "yuv-catalog", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: CatalogComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
141
|
+
}
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CatalogComponent, decorators: [{
|
|
143
|
+
type: Component,
|
|
144
|
+
args: [{ selector: 'yuv-catalog', imports: [MatSelectModule, ReactiveFormsModule], providers: [{ provide: MatFormFieldControl, useExisting: CatalogComponent }], template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n" }]
|
|
145
|
+
}], propDecorators: { readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }] } });
|
|
146
|
+
|
|
41
147
|
class EditTableDataComponent {
|
|
42
148
|
constructor() {
|
|
43
149
|
this.#fb = inject(FormBuilder);
|
|
@@ -52,7 +158,7 @@ class EditTableDataComponent {
|
|
|
52
158
|
this.columns = (this.formElement['elements'] || []).map((c) => ({
|
|
53
159
|
...c,
|
|
54
160
|
propertyType: c.type,
|
|
55
|
-
_internalType: this.#system.getInternalFormElementType(c.type, c.classifications)
|
|
161
|
+
_internalType: this.#system.getInternalFormElementType(c.type, c.classifications, c.catalog)
|
|
56
162
|
}));
|
|
57
163
|
this.#elementData = this.#dialogData.elementData || {};
|
|
58
164
|
this.situation = this.#dialogData.situation || Situation.EDIT;
|
|
@@ -120,7 +226,7 @@ class EditTableDataComponent {
|
|
|
120
226
|
useExisting: forwardRef(() => EditTableDataComponent),
|
|
121
227
|
multi: true
|
|
122
228
|
}
|
|
123
|
-
], ngImport: i0, template: "<yuv-dialog [headertitle]=\"(adding ? 'yuv.form.element.data.grid.add.headline' : 'yuv.form.element.data.grid.edit.headline') | translate: { headline: header }\">\n <main>\n <div [formGroup]=\"tableForm\">\n <div class=\"fields\">\n @for (element of columns; track $index) {\n <div [attr.data-name]=\"element.name\" class=\"form-field\">\n <yuv-metadata-form-field [field]=\"element\" [formControlName]=\"element.name\" [situation]=\"situation\"></yuv-metadata-form-field>\n </div>\n }\n </div>\n </div>\n </main>\n\n <footer>\n <button ymtButton=\"secondary\" (click)=\"cancel()\">{{ 'yuv.form.element.data.grid.edit.cancel' | translate }}</button>\n <button ymtButton=\"primary\" (click)=\"submit()\" [disabled]=\"!tableForm.dirty || !tableForm.valid\">\n @if (adding) {\n {{ 'yuv.form.element.data.grid.edit.add' | translate }}\n } @else {\n {{ 'yuv.object-metadata.button.save' | translate }}\n }\n </button>\n </footer>\n</yuv-dialog>\n", styles: [":host .fields{padding:var(--ymt-spacing-m)}:host .fields .form-field:not(:last-child){margin-block-end:var(--ymt-spacing-s)}:host .err-msg{font:var(--ymt-font-body-subtle);color:var(--ymt-danger);padding:var(--ymt-spacing-2xs) 0;border:0}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: DialogComponent, selector: "yuv-dialog", inputs: ["headertitle", "headertitel"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: MetadataFormFieldComponent, selector: "yuv-metadata-form-field", inputs: ["formChangedSubject", "field", "situation"] }, { kind: "directive", type: YmtButtonDirective, selector: "button[ymtButton], a[ymtButton]", inputs: ["ymtButton", "disabled", "aria-disabled", "disableRipple", "disabledInteractive", "button-size"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
229
|
+
], ngImport: i0, template: "<yuv-dialog [headertitle]=\"(adding ? 'yuv.form.element.data.grid.add.headline' : 'yuv.form.element.data.grid.edit.headline') | translate: { headline: header }\">\n <main>\n <div [formGroup]=\"tableForm\">\n <div class=\"fields\">\n @for (element of columns; track $index) {\n <div [attr.data-name]=\"element.name\" class=\"form-field\">\n <yuv-metadata-form-field [field]=\"element\" [formControlName]=\"element.name\" [situation]=\"situation\"></yuv-metadata-form-field>\n </div>\n }\n </div>\n </div>\n </main>\n\n <footer>\n <button ymtButton=\"secondary\" (click)=\"cancel()\">{{ 'yuv.form.element.data.grid.edit.cancel' | translate }}</button>\n <button ymtButton=\"primary\" (click)=\"submit()\" [disabled]=\"!tableForm.dirty || !tableForm.valid\">\n @if (adding) {\n {{ 'yuv.form.element.data.grid.edit.add' | translate }}\n } @else {\n {{ 'yuv.object-metadata.button.save' | translate }}\n }\n </button>\n </footer>\n</yuv-dialog>\n", styles: [":host .fields{padding:var(--ymt-spacing-m)}:host .fields .form-field:not(:last-child){margin-block-end:var(--ymt-spacing-s)}:host .err-msg{font:var(--ymt-font-body-subtle);color:var(--ymt-danger);padding:var(--ymt-spacing-2xs) 0;border:0}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: DialogComponent, selector: "yuv-dialog", inputs: ["headertitle", "headertitel"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: MetadataFormFieldComponent, selector: "yuv-metadata-form-field", inputs: ["formChangedSubject", "field", "situation"] }, { kind: "directive", type: YmtButtonDirective, selector: "button[ymtButton], a[ymtButton]", inputs: ["ymtButton", "disabled", "aria-disabled", "disableRipple", "disabledInteractive", "button-size"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
124
230
|
}
|
|
125
231
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: EditTableDataComponent, decorators: [{
|
|
126
232
|
type: Component,
|
|
@@ -294,7 +400,7 @@ class DataGridComponent {
|
|
|
294
400
|
type: el.type,
|
|
295
401
|
cell: (element) => ({
|
|
296
402
|
propertyName: el.name,
|
|
297
|
-
rendererType: this.#systemService.getInternalFormElementType(el.type, el.classifications),
|
|
403
|
+
rendererType: this.#systemService.getInternalFormElementType(el.type, el.classifications, el.catalog),
|
|
298
404
|
value: element[el.name],
|
|
299
405
|
meta: element[el.name]
|
|
300
406
|
})
|
|
@@ -360,7 +466,7 @@ class DataGridComponent {
|
|
|
360
466
|
useExisting: forwardRef(() => DataGridComponent),
|
|
361
467
|
multi: true
|
|
362
468
|
}
|
|
363
|
-
], ngImport: i0, template: "<fieldset [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"isInvalid\">\n <legend class=\"ymt-hide-sr\">\n {{ tableLabel() }}\n @if (isRequired) {\n *\n }\n </legend>\n <header class=\"yuv-data-grid__header\">\n <span\n [yuvObjectMetadataElementLabel]=\"formFieldContext()\"\n class=\"yuv-data-grid__header-title label\"\n [ngClass]=\"{ 'yuv-data-grid__header-title--invalid': isInvalid }\"\n aria-hidden=\"true\"\n >\n {{ tableLabel() }}\n @if (isRequired) {\n *\n }\n </span>\n\n @if (!readonly()) {\n <button ymtIconButton (click)=\"addRow()\" class=\"yuv-data-grid__header-action\" [matTooltip]=\"'yuv.form.element.data.grid.add-row.button.tooltip' | translate\">\n <mat-icon>add</mat-icon>\n </button>\n }\n </header>\n\n @let displayedCol = displayedColumns();\n @let displayedColActions = displayedColumnsWithActions();\n @let data = dataSource();\n\n <div class=\"yuv-data-grid__table\" [ngClass]=\"size()\">\n <table mat-table [dataSource]=\"data\" class=\"mat-elevation-z8\">\n <caption class=\"ymt-hide-sr\">\n {{\n tableLabel()\n }}\n </caption>\n\n @for (column of displayedCol; track column) {\n @if (column.columnDef === 'actions') {\n <!-- <h1>Actions</h1> -->\n <ng-container [matColumnDef]=\"column.columnDef\" stickyEnd>\n <th mat-header-cell *matHeaderCellDef aria-label=\"row actions\"></th>\n <td class=\"yuv-data-grid__cell--editable\" mat-cell *matCellDef=\"let element\">\n <div class=\"yuv-data-grid__table-actions\">\n <!-- Only show the button in the last (empty) row -->\n <button ymtIconButton icon-button-size=\"small\" class=\"table-options-menu-bar-item\" [matMenuTriggerFor]=\"menu\" (click)=\"onMenuTrigger(element)\" [matTooltip]=\"'yuv.form.element.data.grid.row.button.actions.tooltip' | translate\" >\n <mat-icon>more_vert</mat-icon>\n </button>\n </div>\n </td>\n </ng-container>\n } @else {\n <ng-container [matColumnDef]=\"column.columnDef\">\n <th mat-header-cell *matHeaderCellDef [attr.aria-label]=\"column.header\" [title]=\"column.header\">{{ column.header }}</th>\n <td\n [ngClass]=\"{ 'number-cell': column.type === 'integer' || column.type === 'decimal', 'yuv-data-grid__cell--editable': !readonly() }\"\n mat-cell\n *matCellDef=\"let element\"\n >\n <ng-template *yuvRenderer=\"column.cell(element)\"></ng-template>\n </td>\n </ng-container>\n }\n\n <tr class=\"mat-row\" *matNoDataRow>\n <td class=\"mat-cell no-data-cell\" [attr.colspan]=\"column.length\"></td>\n </tr>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColActions; sticky: ['header-1']\"></tr>\n\n <tr (dblclick)=\"editRow(row)\" [class.selected-row]=\"row === selectedRow()\" mat-row *matRowDef=\"let row; columns: displayedColActions\"></tr>\n </table>\n @if (data.length === 0) {\n <span class=\"no-data\">{{ 'yuv.form.element.data.grid.noData' | translate }}</span>\n }\n </div>\n</fieldset>\n<mat-menu #menu=\"matMenu\">\n <button mat-menu-item (click)=\"editRow(selectedRow())\">{{ 'yuv.form.element.data.grid.edit' | translate }}</button>\n <button mat-menu-item (click)=\"removeRow(selectedRow())\">{{ 'yuv.form.element.data.grid.remove' | translate }}</button>\n</mat-menu>\n", styles: [":host{--table-size-small: 200px;--table-size-medium: 400px;--table-size-large: 600px;--table-size-extra-large: 800px;max-width:100%;width:100%;border:1px solid var(--ymt-outline-variant);border-radius:var(--ymt-corner-s);overflow:hidden;position:relative}:host .yuv-data-grid__header{display:flex;justify-content:space-between;align-items:center;padding:var(--ymt-spacing-xs)}:host .yuv-data-grid__header-title{transform:scale(var(--mat-mdc-form-field-floating-label-scale, .75))}:host .yuv-data-grid__header-title--invalid{background-color:var(--ymt-danger-container);color:var(--ymt-on-danger-container);align-self:baseline}:host .yuv-data-grid__cell--editable{-webkit-user-select:none;user-select:none}:host .yuv-data-grid__table{overflow:auto;white-space:nowrap}:host .yuv-data-grid__table.small{height:var(--table-size-small)}:host .yuv-data-grid__table.medium{height:var(--table-size-medium)}:host .yuv-data-grid__table.large{height:var(--table-size-large)}:host .yuv-data-grid__table.extra-large{height:var(--table-size-extra-large)}:host .yuv-data-grid__table .no-data{display:block;width:100%;background-color:var(--ymt-surface);text-align:center;padding:var(--ymt-spacing-s);font:var(--ymt-font-body);color:var(--ymt-text-color-subtle);font-style:italic}:host .yuv-data-grid__table-actions{display:flex;align-items:center;justify-content:flex-end}:host.yuv-data-grid{display:block}:host.yuv-data-grid ::ng-deep tr.cdk-row td.number-cell{text-align:right}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i1$
|
|
469
|
+
], ngImport: i0, template: "<fieldset [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"isInvalid\">\n <legend class=\"ymt-hide-sr\">\n {{ tableLabel() }}\n @if (isRequired) {\n *\n }\n </legend>\n <header class=\"yuv-data-grid__header\">\n <span\n [yuvObjectMetadataElementLabel]=\"formFieldContext()\"\n class=\"yuv-data-grid__header-title label\"\n [ngClass]=\"{ 'yuv-data-grid__header-title--invalid': isInvalid }\"\n aria-hidden=\"true\"\n >\n {{ tableLabel() }}\n @if (isRequired) {\n *\n }\n </span>\n\n @if (!readonly()) {\n <button ymtIconButton (click)=\"addRow()\" class=\"yuv-data-grid__header-action\" [matTooltip]=\"'yuv.form.element.data.grid.add-row.button.tooltip' | translate\">\n <mat-icon>add</mat-icon>\n </button>\n }\n </header>\n\n @let displayedCol = displayedColumns();\n @let displayedColActions = displayedColumnsWithActions();\n @let data = dataSource();\n\n <div class=\"yuv-data-grid__table\" [ngClass]=\"size()\">\n <table mat-table [dataSource]=\"data\" class=\"mat-elevation-z8\">\n <caption class=\"ymt-hide-sr\">\n {{\n tableLabel()\n }}\n </caption>\n\n @for (column of displayedCol; track column) {\n @if (column.columnDef === 'actions') {\n <!-- <h1>Actions</h1> -->\n <ng-container [matColumnDef]=\"column.columnDef\" stickyEnd>\n <th mat-header-cell *matHeaderCellDef aria-label=\"row actions\"></th>\n <td class=\"yuv-data-grid__cell--editable\" mat-cell *matCellDef=\"let element\">\n <div class=\"yuv-data-grid__table-actions\">\n <!-- Only show the button in the last (empty) row -->\n <button ymtIconButton icon-button-size=\"small\" class=\"table-options-menu-bar-item\" [matMenuTriggerFor]=\"menu\" (click)=\"onMenuTrigger(element)\" [matTooltip]=\"'yuv.form.element.data.grid.row.button.actions.tooltip' | translate\" >\n <mat-icon>more_vert</mat-icon>\n </button>\n </div>\n </td>\n </ng-container>\n } @else {\n <ng-container [matColumnDef]=\"column.columnDef\">\n <th mat-header-cell *matHeaderCellDef [attr.aria-label]=\"column.header\" [title]=\"column.header\">{{ column.header }}</th>\n <td\n [ngClass]=\"{ 'number-cell': column.type === 'integer' || column.type === 'decimal', 'yuv-data-grid__cell--editable': !readonly() }\"\n mat-cell\n *matCellDef=\"let element\"\n >\n <ng-template *yuvRenderer=\"column.cell(element)\"></ng-template>\n </td>\n </ng-container>\n }\n\n <tr class=\"mat-row\" *matNoDataRow>\n <td class=\"mat-cell no-data-cell\" [attr.colspan]=\"column.length\"></td>\n </tr>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColActions; sticky: ['header-1']\"></tr>\n\n <tr (dblclick)=\"editRow(row)\" [class.selected-row]=\"row === selectedRow()\" mat-row *matRowDef=\"let row; columns: displayedColActions\"></tr>\n </table>\n @if (data.length === 0) {\n <span class=\"no-data\">{{ 'yuv.form.element.data.grid.noData' | translate }}</span>\n }\n </div>\n</fieldset>\n<mat-menu #menu=\"matMenu\">\n <button mat-menu-item (click)=\"editRow(selectedRow())\">{{ 'yuv.form.element.data.grid.edit' | translate }}</button>\n <button mat-menu-item (click)=\"removeRow(selectedRow())\">{{ 'yuv.form.element.data.grid.remove' | translate }}</button>\n</mat-menu>\n", styles: [":host{--table-size-small: 200px;--table-size-medium: 400px;--table-size-large: 600px;--table-size-extra-large: 800px;max-width:100%;width:100%;border:1px solid var(--ymt-outline-variant);border-radius:var(--ymt-corner-s);overflow:hidden;position:relative}:host .yuv-data-grid__header{display:flex;justify-content:space-between;align-items:center;padding:var(--ymt-spacing-xs)}:host .yuv-data-grid__header-title{transform:scale(var(--mat-mdc-form-field-floating-label-scale, .75))}:host .yuv-data-grid__header-title--invalid{background-color:var(--ymt-danger-container);color:var(--ymt-on-danger-container);align-self:baseline}:host .yuv-data-grid__cell--editable{-webkit-user-select:none;user-select:none}:host .yuv-data-grid__table{overflow:auto;white-space:nowrap}:host .yuv-data-grid__table.small{height:var(--table-size-small)}:host .yuv-data-grid__table.medium{height:var(--table-size-medium)}:host .yuv-data-grid__table.large{height:var(--table-size-large)}:host .yuv-data-grid__table.extra-large{height:var(--table-size-extra-large)}:host .yuv-data-grid__table .no-data{display:block;width:100%;background-color:var(--ymt-surface);text-align:center;padding:var(--ymt-spacing-s);font:var(--ymt-font-body);color:var(--ymt-text-color-subtle);font-style:italic}:host .yuv-data-grid__table-actions{display:flex;align-items:center;justify-content:flex-end}:host.yuv-data-grid{display:block}:host.yuv-data-grid ::ng-deep tr.cdk-row td.number-cell{text-align:right}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i1$2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i1$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i1$2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i3.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i3.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: RendererDirective, selector: "[yuvRenderer]", inputs: ["yuvRenderer"] }, { kind: "directive", type: ObjectMetadataElementLabelDirective, selector: "[yuvObjectMetadataElementLabel]", inputs: ["yuvObjectMetadataElementLabel"] }, { kind: "directive", type: YmtIconButtonDirective, selector: "button[ymtIconButton],button[ymt-icon-button],a[ymtIconButton],a[ymt-icon-button]", inputs: ["disabled", "disableRipple", "aria-disabled", "disabledInteractive", "icon-button-size"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
364
470
|
}
|
|
365
471
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridComponent, decorators: [{
|
|
366
472
|
type: Component,
|
|
@@ -388,12 +494,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
388
494
|
}, template: "<fieldset [attr.aria-required]=\"isRequired\" [attr.aria-invalid]=\"isInvalid\">\n <legend class=\"ymt-hide-sr\">\n {{ tableLabel() }}\n @if (isRequired) {\n *\n }\n </legend>\n <header class=\"yuv-data-grid__header\">\n <span\n [yuvObjectMetadataElementLabel]=\"formFieldContext()\"\n class=\"yuv-data-grid__header-title label\"\n [ngClass]=\"{ 'yuv-data-grid__header-title--invalid': isInvalid }\"\n aria-hidden=\"true\"\n >\n {{ tableLabel() }}\n @if (isRequired) {\n *\n }\n </span>\n\n @if (!readonly()) {\n <button ymtIconButton (click)=\"addRow()\" class=\"yuv-data-grid__header-action\" [matTooltip]=\"'yuv.form.element.data.grid.add-row.button.tooltip' | translate\">\n <mat-icon>add</mat-icon>\n </button>\n }\n </header>\n\n @let displayedCol = displayedColumns();\n @let displayedColActions = displayedColumnsWithActions();\n @let data = dataSource();\n\n <div class=\"yuv-data-grid__table\" [ngClass]=\"size()\">\n <table mat-table [dataSource]=\"data\" class=\"mat-elevation-z8\">\n <caption class=\"ymt-hide-sr\">\n {{\n tableLabel()\n }}\n </caption>\n\n @for (column of displayedCol; track column) {\n @if (column.columnDef === 'actions') {\n <!-- <h1>Actions</h1> -->\n <ng-container [matColumnDef]=\"column.columnDef\" stickyEnd>\n <th mat-header-cell *matHeaderCellDef aria-label=\"row actions\"></th>\n <td class=\"yuv-data-grid__cell--editable\" mat-cell *matCellDef=\"let element\">\n <div class=\"yuv-data-grid__table-actions\">\n <!-- Only show the button in the last (empty) row -->\n <button ymtIconButton icon-button-size=\"small\" class=\"table-options-menu-bar-item\" [matMenuTriggerFor]=\"menu\" (click)=\"onMenuTrigger(element)\" [matTooltip]=\"'yuv.form.element.data.grid.row.button.actions.tooltip' | translate\" >\n <mat-icon>more_vert</mat-icon>\n </button>\n </div>\n </td>\n </ng-container>\n } @else {\n <ng-container [matColumnDef]=\"column.columnDef\">\n <th mat-header-cell *matHeaderCellDef [attr.aria-label]=\"column.header\" [title]=\"column.header\">{{ column.header }}</th>\n <td\n [ngClass]=\"{ 'number-cell': column.type === 'integer' || column.type === 'decimal', 'yuv-data-grid__cell--editable': !readonly() }\"\n mat-cell\n *matCellDef=\"let element\"\n >\n <ng-template *yuvRenderer=\"column.cell(element)\"></ng-template>\n </td>\n </ng-container>\n }\n\n <tr class=\"mat-row\" *matNoDataRow>\n <td class=\"mat-cell no-data-cell\" [attr.colspan]=\"column.length\"></td>\n </tr>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColActions; sticky: ['header-1']\"></tr>\n\n <tr (dblclick)=\"editRow(row)\" [class.selected-row]=\"row === selectedRow()\" mat-row *matRowDef=\"let row; columns: displayedColActions\"></tr>\n </table>\n @if (data.length === 0) {\n <span class=\"no-data\">{{ 'yuv.form.element.data.grid.noData' | translate }}</span>\n }\n </div>\n</fieldset>\n<mat-menu #menu=\"matMenu\">\n <button mat-menu-item (click)=\"editRow(selectedRow())\">{{ 'yuv.form.element.data.grid.edit' | translate }}</button>\n <button mat-menu-item (click)=\"removeRow(selectedRow())\">{{ 'yuv.form.element.data.grid.remove' | translate }}</button>\n</mat-menu>\n", styles: [":host{--table-size-small: 200px;--table-size-medium: 400px;--table-size-large: 600px;--table-size-extra-large: 800px;max-width:100%;width:100%;border:1px solid var(--ymt-outline-variant);border-radius:var(--ymt-corner-s);overflow:hidden;position:relative}:host .yuv-data-grid__header{display:flex;justify-content:space-between;align-items:center;padding:var(--ymt-spacing-xs)}:host .yuv-data-grid__header-title{transform:scale(var(--mat-mdc-form-field-floating-label-scale, .75))}:host .yuv-data-grid__header-title--invalid{background-color:var(--ymt-danger-container);color:var(--ymt-on-danger-container);align-self:baseline}:host .yuv-data-grid__cell--editable{-webkit-user-select:none;user-select:none}:host .yuv-data-grid__table{overflow:auto;white-space:nowrap}:host .yuv-data-grid__table.small{height:var(--table-size-small)}:host .yuv-data-grid__table.medium{height:var(--table-size-medium)}:host .yuv-data-grid__table.large{height:var(--table-size-large)}:host .yuv-data-grid__table.extra-large{height:var(--table-size-extra-large)}:host .yuv-data-grid__table .no-data{display:block;width:100%;background-color:var(--ymt-surface);text-align:center;padding:var(--ymt-spacing-s);font:var(--ymt-font-body);color:var(--ymt-text-color-subtle);font-style:italic}:host .yuv-data-grid__table-actions{display:flex;align-items:center;justify-content:flex-end}:host.yuv-data-grid{display:block}:host.yuv-data-grid ::ng-deep tr.cdk-row td.number-cell{text-align:right}\n"] }]
|
|
389
495
|
}], propDecorators: { situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }], formElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "formElement", required: false }] }], formControl: [{ type: i0.Input, args: [{ isSignal: true, alias: "formControl", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], formFieldContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "formFieldContext", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
390
496
|
|
|
391
|
-
class FormUtils {
|
|
392
|
-
static getErrorState(control) {
|
|
393
|
-
return control.invalid && (control.dirty || control.touched);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
497
|
class DatetimeComponent extends AbstractMatFormField {
|
|
398
498
|
constructor() {
|
|
399
499
|
super(...arguments);
|
|
@@ -502,7 +602,7 @@ class DatetimeComponent extends AbstractMatFormField {
|
|
|
502
602
|
});
|
|
503
603
|
}
|
|
504
604
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DatetimeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
505
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.9", type: DatetimeComponent, isStandalone: true, selector: "yuv-datetime", inputs: { locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, onlyFutureDates: { classPropertyName: "onlyFutureDates", publicName: "onlyFutureDates", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, calendar: { classPropertyName: "calendar", publicName: "calendar", isSignal: true, isRequired: false, transformFunction: null }, withTime: { classPropertyName: "withTime", publicName: "withTime", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: DatetimeComponent }], viewQueries: [{ propertyName: "pickerCmp", first: true, predicate: DatepickerComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<yuv-datepicker\n [calendar]=\"calendar()\"\n [disabled]=\"readonly()\"\n [withTime]=\"withTime()\"\n [locale]=\"_locale()\"\n [labels]=\"labels!\"\n [onlyFutureDates]=\"onlyFutureDates()\"\n [formControl]=\"fc\"\n></yuv-datepicker>\n", styles: [":host{display:flex;overflow-x:auto;--ymt-scrollbar-outer-size: 0px;--ymt-scrollbar-inner-size: 0px}:host yuv-datepicker{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: YuvDatepickerModule }, { kind: "component", type: i2$1.DatepickerComponent, selector: "yuv-datepicker", inputs: ["calendar", "readonly", "hour12", "locale", "labels", "withTime", "onlyFutureDates", "minDate", "maxDate", "disabled"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatDatepickerModule }] }); }
|
|
605
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.9", type: DatetimeComponent, isStandalone: true, selector: "yuv-datetime", inputs: { locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, onlyFutureDates: { classPropertyName: "onlyFutureDates", publicName: "onlyFutureDates", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, calendar: { classPropertyName: "calendar", publicName: "calendar", isSignal: true, isRequired: false, transformFunction: null }, withTime: { classPropertyName: "withTime", publicName: "withTime", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: DatetimeComponent }], viewQueries: [{ propertyName: "pickerCmp", first: true, predicate: DatepickerComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<yuv-datepicker\n [calendar]=\"calendar()\"\n [disabled]=\"readonly()\"\n [withTime]=\"withTime()\"\n [locale]=\"_locale()\"\n [labels]=\"labels!\"\n [onlyFutureDates]=\"onlyFutureDates()\"\n [formControl]=\"fc\"\n></yuv-datepicker>\n", styles: [":host{display:flex;overflow-x:auto;--ymt-scrollbar-outer-size: 0px;--ymt-scrollbar-inner-size: 0px}:host yuv-datepicker{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: YuvDatepickerModule }, { kind: "component", type: i2$1.DatepickerComponent, selector: "yuv-datepicker", inputs: ["calendar", "readonly", "hour12", "locale", "labels", "withTime", "onlyFutureDates", "minDate", "maxDate", "disabled"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatDatepickerModule }] }); }
|
|
506
606
|
}
|
|
507
607
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DatetimeComponent, decorators: [{
|
|
508
608
|
type: Component,
|
|
@@ -666,167 +766,362 @@ class DatetimeRangeComponent extends AbstractMatFormField {
|
|
|
666
766
|
super.onNgOnDestroy();
|
|
667
767
|
}
|
|
668
768
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DatetimeRangeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
669
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DatetimeRangeComponent, isStandalone: true, selector: "yuv-datetime-range", inputs: { withTimeInput: { classPropertyName: "withTimeInput", publicName: "withTime", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: DatetimeRangeComponent }], usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"rangeForm\">\n @if (rangeForm.value.operator === 'gtelte') {\n <yuv-datetime [withTime]=\"withTime()\" formControlName=\"dateValueFrom\"></yuv-datetime>\n }\n\n <mat-select [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\" formControlName=\"operator\" [disabled]=\"readonly()\">\n @for (o of availableSearchOptions; track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n </mat-select>\n\n <yuv-datetime [withTime]=\"withTime()\" formControlName=\"dateValue\"></yuv-datetime>\n</form>\n", styles: [":host form{display:flex;flex-flow:row nowrap;align-items:center;gap:var(--ymt-spacing-s)}:host form yuv-datetime{flex:1 1 auto}:host form mat-select{padding:0;width:calc(2ch + 1em);border-radius:2px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1
|
|
769
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DatetimeRangeComponent, isStandalone: true, selector: "yuv-datetime-range", inputs: { withTimeInput: { classPropertyName: "withTimeInput", publicName: "withTime", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: DatetimeRangeComponent }], usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"rangeForm\">\n @if (rangeForm.value.operator === 'gtelte') {\n <yuv-datetime [withTime]=\"withTime()\" formControlName=\"dateValueFrom\"></yuv-datetime>\n }\n\n <mat-select [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\" formControlName=\"operator\" [disabled]=\"readonly()\">\n @for (o of availableSearchOptions; track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n </mat-select>\n\n <yuv-datetime [withTime]=\"withTime()\" formControlName=\"dateValue\"></yuv-datetime>\n</form>\n", styles: [":host form{display:flex;flex-flow:row nowrap;align-items:center;gap:var(--ymt-spacing-s)}:host form yuv-datetime{flex:1 1 auto}:host form mat-select{padding:0;width:calc(2ch + 1em);border-radius:2px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: DatetimeComponent, selector: "yuv-datetime", inputs: ["locale", "onlyFutureDates", "readonly", "calendar", "withTime"] }] }); }
|
|
670
770
|
}
|
|
671
771
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DatetimeRangeComponent, decorators: [{
|
|
672
772
|
type: Component,
|
|
673
773
|
args: [{ selector: 'yuv-datetime-range', standalone: true, imports: [FormsModule, MatDatepickerModule, MatSelectModule, ReactiveFormsModule, DatetimeComponent], providers: [{ provide: MatFormFieldControl, useExisting: DatetimeRangeComponent }], template: "<form [formGroup]=\"rangeForm\">\n @if (rangeForm.value.operator === 'gtelte') {\n <yuv-datetime [withTime]=\"withTime()\" formControlName=\"dateValueFrom\"></yuv-datetime>\n }\n\n <mat-select [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\" formControlName=\"operator\" [disabled]=\"readonly()\">\n @for (o of availableSearchOptions; track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n </mat-select>\n\n <yuv-datetime [withTime]=\"withTime()\" formControlName=\"dateValue\"></yuv-datetime>\n</form>\n", styles: [":host form{display:flex;flex-flow:row nowrap;align-items:center;gap:var(--ymt-spacing-s)}:host form yuv-datetime{flex:1 1 auto}:host form mat-select{padding:0;width:calc(2ch + 1em);border-radius:2px}\n"] }]
|
|
674
774
|
}], propDecorators: { withTimeInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "withTime", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], operator: [{ type: i0.Input, args: [{ isSignal: true, alias: "operator", required: false }] }], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }] } });
|
|
675
775
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
* @example
|
|
683
|
-
* <yuv-number [scale]="2"></yuv-number>
|
|
684
|
-
*
|
|
685
|
-
*/
|
|
686
|
-
class NumberComponent extends AbstractMatFormField {
|
|
776
|
+
class DynamicCatalogComponent extends AbstractMatFormField {
|
|
777
|
+
#catalogService;
|
|
778
|
+
#dRef;
|
|
779
|
+
#translate;
|
|
780
|
+
#currentLang;
|
|
781
|
+
#optionsResource;
|
|
687
782
|
constructor() {
|
|
688
|
-
super(
|
|
783
|
+
super();
|
|
784
|
+
this.#catalogService = inject(CatalogService);
|
|
689
785
|
this.#dRef = inject(DestroyRef);
|
|
690
|
-
this
|
|
691
|
-
|
|
692
|
-
this.validationErrors = [];
|
|
693
|
-
this.transformPipe = new LocaleNumberPipe(this.translate);
|
|
694
|
-
this.innerCtrl = new FormControl(null);
|
|
695
|
-
this.ngControl = injectNgControl(this);
|
|
696
|
-
/**
|
|
697
|
-
* Number of decimal places
|
|
698
|
-
*/
|
|
699
|
-
this.scale = input(undefined, ...(ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []));
|
|
700
|
-
this.#scale = computed(() => Math.min(this.scale() || 0, 30), ...(ngDevMode ? [{ debugName: "#scale" }] : /* istanbul ignore next */ []));
|
|
701
|
-
/**
|
|
702
|
-
* Overall amount of digits allowed (including decimal places)
|
|
703
|
-
*/
|
|
704
|
-
this.precision = input(undefined, ...(ngDevMode ? [{ debugName: "precision" }] : /* istanbul ignore next */ []));
|
|
705
|
-
this.#precision = computed(() => Math.min(this.precision() || 100, 100), ...(ngDevMode ? [{ debugName: "#precision" }] : /* istanbul ignore next */ []));
|
|
706
|
-
/**
|
|
707
|
-
* Set to true to group number by pattern
|
|
708
|
-
*/
|
|
709
|
-
this.grouping = input(false, ...(ngDevMode ? [{ debugName: "grouping" }] : /* istanbul ignore next */ []));
|
|
710
|
-
this.#grouping = computed(() => this.grouping() ?? true, ...(ngDevMode ? [{ debugName: "#grouping" }] : /* istanbul ignore next */ []));
|
|
711
|
-
/**
|
|
712
|
-
* The pattern to group number value by
|
|
713
|
-
*/
|
|
714
|
-
this.groupPattern = input(undefined, ...(ngDevMode ? [{ debugName: "groupPattern" }] : /* istanbul ignore next */ []));
|
|
715
|
-
/**
|
|
716
|
-
* Will prevent the input from being changed (default: false)
|
|
717
|
-
*/
|
|
786
|
+
this.#translate = inject(TranslateService);
|
|
787
|
+
this.catalog = input.required(...(ngDevMode ? [{ debugName: "catalog" }] : /* istanbul ignore next */ []));
|
|
718
788
|
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
789
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
790
|
+
this.#currentLang = signal(this.#translate.getCurrentLang(), ...(ngDevMode ? [{ debugName: "#currentLang" }] : /* istanbul ignore next */ []));
|
|
791
|
+
this.#optionsResource = rxResource({
|
|
792
|
+
params: computed(() => ({ catalog: this.catalog(), locale: this.#currentLang() })),
|
|
793
|
+
stream: ({ params }) => this.#catalogService.getEntries(params.catalog, { locale: params.locale }).pipe(map((res) => res.entries.map((entry) => ({
|
|
794
|
+
value: entry.name,
|
|
795
|
+
label: this.#resolveLabel(entry, params.locale)
|
|
796
|
+
}))))
|
|
797
|
+
});
|
|
798
|
+
this.options = this.#optionsResource.value;
|
|
719
799
|
/**
|
|
720
|
-
*
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* set maximum input value
|
|
725
|
-
*
|
|
726
|
-
*/
|
|
727
|
-
this.maxValue = input(undefined, ...(ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
728
|
-
/**
|
|
729
|
-
* classification property adds some semantics to the value of this component.
|
|
730
|
-
* If you provide a value of `filesize` numbers typed into the control will be
|
|
731
|
-
* handled like file sizes (calculates differnt units)
|
|
800
|
+
* Possibles values are `EDIT` (default),`SEARCH`,`CREATE`. In search situation
|
|
801
|
+
* validation of the form element will be turned off, so you are able to enter
|
|
802
|
+
* search terms that do not meet the elements validators.
|
|
732
803
|
*/
|
|
733
|
-
this.
|
|
734
|
-
this
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
740
|
-
this.propagateChange = (_) => { };
|
|
741
|
-
}
|
|
742
|
-
#dRef;
|
|
743
|
-
#scale;
|
|
744
|
-
#precision;
|
|
745
|
-
#grouping;
|
|
746
|
-
#classificationsEffect;
|
|
747
|
-
static betweenTwoNumbers(val, minVal, maxVal) {
|
|
748
|
-
const min = !Utils.isEmpty(minVal) ? minVal : -Infinity;
|
|
749
|
-
const max = !Utils.isEmpty(maxVal) ? maxVal : Infinity;
|
|
750
|
-
return val >= min && val <= max;
|
|
804
|
+
this.situation = input(...(ngDevMode ? [undefined, { debugName: "situation" }] : /* istanbul ignore next */ []));
|
|
805
|
+
this.ngControl = injectNgControl(this);
|
|
806
|
+
this.ctrl = new FormControl(undefined);
|
|
807
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/explicit-module-boundary-types
|
|
808
|
+
this.propagateChange = (fnc) => { };
|
|
809
|
+
this.#translate.onLangChange.pipe(takeUntilDestroyed()).subscribe((evt) => this.#currentLang.set(evt.lang));
|
|
751
810
|
}
|
|
752
811
|
writeValue(value) {
|
|
753
|
-
this.value = value
|
|
754
|
-
|
|
755
|
-
this.innerCtrl.setValue(innerValue, { emitEvent: false });
|
|
812
|
+
this.value = value;
|
|
813
|
+
this.ctrl.setValue(value, { emitEvent: false });
|
|
756
814
|
}
|
|
757
|
-
|
|
758
|
-
|
|
815
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
816
|
+
registerOnChange(fnc) {
|
|
817
|
+
this.propagateChange = fnc;
|
|
759
818
|
}
|
|
760
819
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
761
820
|
registerOnTouched() { }
|
|
762
821
|
setDisabledState(isDisabled) {
|
|
763
822
|
if (isDisabled) {
|
|
764
|
-
this.
|
|
823
|
+
this.ctrl.disable();
|
|
765
824
|
}
|
|
766
825
|
else {
|
|
767
|
-
this.
|
|
826
|
+
this.ctrl.enable();
|
|
768
827
|
}
|
|
769
828
|
this.disabled = isDisabled;
|
|
770
829
|
}
|
|
771
|
-
// called when the input looses focus
|
|
772
|
-
format() {
|
|
773
|
-
if (!this.readonly() && typeof this.value === 'number' && this.validationErrors.length === 0) {
|
|
774
|
-
this.innerCtrl.patchValue(this.transformPipe.numberToString(this.value, this.#grouping(), this.groupPattern(), this.#scale()), { emitEvent: false });
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
// called when the input get focus
|
|
778
|
-
unformat() {
|
|
779
|
-
if (!this.readonly() && typeof this.value === 'number' && this.validationErrors.length === 0) {
|
|
780
|
-
this.innerCtrl.patchValue(this.transformPipe.transform(this.value, false), {
|
|
781
|
-
emitEvent: false
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
#getValidator() {
|
|
786
|
-
return (control) => {
|
|
787
|
-
this.validationErrors = [];
|
|
788
|
-
if (Utils.isEmpty(control.value))
|
|
789
|
-
return null;
|
|
790
|
-
const val = this.transformPipe.stringToNumber(control.value);
|
|
791
|
-
// general number validation
|
|
792
|
-
if (isNaN(val) || typeof val !== 'number') {
|
|
793
|
-
this.validationErrors.push({ key: 'number' });
|
|
794
|
-
}
|
|
795
|
-
else {
|
|
796
|
-
const split = control.value.replaceAll(this.transformPipe.separator, '').split(this.transformPipe.decimalSeparator);
|
|
797
|
-
// check precision
|
|
798
|
-
if (this.#precision() !== undefined) {
|
|
799
|
-
const prePointDigits = this.#precision() - this.#scale();
|
|
800
|
-
if (split[0]?.length > prePointDigits) {
|
|
801
|
-
this.validationErrors.push({ key: 'precision', params: { prePointDigits } });
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
// check scale
|
|
805
|
-
if (this.#scale() && split[1]?.length > this.#scale()) {
|
|
806
|
-
this.validationErrors.push({ key: 'scale', params: { scale: this.#scale() } });
|
|
807
|
-
}
|
|
808
|
-
// min max
|
|
809
|
-
if (!_a.betweenTwoNumbers(val, this.minValue(), this.maxValue())) {
|
|
810
|
-
if (Utils.isEmpty(this.minValue())) {
|
|
811
|
-
this.validationErrors.push({ key: 'maxvalue', params: { maxValue: this.maxValue() } });
|
|
812
|
-
}
|
|
813
|
-
else if (Utils.isEmpty(this.maxValue())) {
|
|
814
|
-
this.validationErrors.push({ key: 'minvalue', params: { minValue: this.minValue() } });
|
|
815
|
-
}
|
|
816
|
-
else {
|
|
817
|
-
this.validationErrors.push({ key: 'minmax', params: { minValue: this.minValue(), maxValue: this.maxValue() } });
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
const e = Utils.arrayToObject(this.validationErrors, 'key', (err) => ({ valid: false, ...err }));
|
|
822
|
-
return this.validationErrors.length ? e : null;
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
830
|
ngOnInit() {
|
|
826
|
-
// set up validators once all inputs are set
|
|
827
|
-
const validators = [this.#getValidator()];
|
|
828
831
|
if (this.required)
|
|
829
|
-
|
|
832
|
+
this.ctrl.setValidators(Validators.required);
|
|
833
|
+
this.ctrl.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe(() => {
|
|
834
|
+
this.errorState = FormUtils.getErrorState(this.ctrl);
|
|
835
|
+
if (this.ngControl?.control) {
|
|
836
|
+
this.ngControl.control.setErrors(this.ctrl.errors);
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
this.ctrl.updateValueAndValidity();
|
|
840
|
+
this.ctrl.valueChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((value) => this.#onValueChange(value));
|
|
841
|
+
}
|
|
842
|
+
ngOnDestroy() {
|
|
843
|
+
super.onNgOnDestroy();
|
|
844
|
+
}
|
|
845
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
846
|
+
#onValueChange(val) {
|
|
847
|
+
this.value = val;
|
|
848
|
+
this.propagateChange(this.value);
|
|
849
|
+
}
|
|
850
|
+
#resolveLabel(entry, locale) {
|
|
851
|
+
const locs = entry.localizations;
|
|
852
|
+
return locs.find((loc) => loc.locale === locale)?.label || locs[0]?.label || entry.name;
|
|
853
|
+
}
|
|
854
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DynamicCatalogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
855
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DynamicCatalogComponent, isStandalone: true, selector: "yuv-dynamic-catalog", inputs: { catalog: { classPropertyName: "catalog", publicName: "catalog", isSignal: true, isRequired: true, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: DynamicCatalogComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"ctrl\">\n @for (o of options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
856
|
+
}
|
|
857
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DynamicCatalogComponent, decorators: [{
|
|
858
|
+
type: Component,
|
|
859
|
+
args: [{ selector: 'yuv-dynamic-catalog', imports: [MatSelectModule, ReactiveFormsModule], providers: [{ provide: MatFormFieldControl, useExisting: DynamicCatalogComponent }], template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"ctrl\">\n @for (o of options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n" }]
|
|
860
|
+
}], ctorParameters: () => [], propDecorators: { catalog: [{ type: i0.Input, args: [{ isSignal: true, alias: "catalog", required: true }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }] } });
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Form element for selecting one or multiple i18n catalog values.
|
|
864
|
+
* Having a classification of `i18n:catalog[one, two, three]` configured on the metadata field
|
|
865
|
+
* will automatically populate the options from the catalog. The options will be translated
|
|
866
|
+
* using the catalogs static values adding a prefix, the property name an the value itself.
|
|
867
|
+
* E.g. for property name `status` and option value `open` the label key will be `catalog:status:open_label`.
|
|
868
|
+
*/
|
|
869
|
+
class I18nCatalogComponent extends AbstractMatFormField {
|
|
870
|
+
#system;
|
|
871
|
+
#dRef;
|
|
872
|
+
#optionsEffect;
|
|
873
|
+
#classificationEffect;
|
|
874
|
+
constructor() {
|
|
875
|
+
super();
|
|
876
|
+
this.#system = inject(SystemService);
|
|
877
|
+
this.#dRef = inject(DestroyRef);
|
|
878
|
+
this.translate = inject(TranslateService);
|
|
879
|
+
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
880
|
+
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
881
|
+
this.propertyName = input(undefined, ...(ngDevMode ? [{ debugName: "propertyName" }] : /* istanbul ignore next */ []));
|
|
882
|
+
this._options = signal([], ...(ngDevMode ? [{ debugName: "_options" }] : /* istanbul ignore next */ []));
|
|
883
|
+
this.options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
884
|
+
this.#optionsEffect = effect(() => {
|
|
885
|
+
untracked(() => {
|
|
886
|
+
this.#setOptions(this.options());
|
|
887
|
+
});
|
|
888
|
+
}, ...(ngDevMode ? [{ debugName: "#optionsEffect" }] : /* istanbul ignore next */ []));
|
|
889
|
+
/**
|
|
890
|
+
* Additional semantics for the form element.
|
|
891
|
+
*/
|
|
892
|
+
this.classifications = input([], ...(ngDevMode ? [{ debugName: "classifications" }] : /* istanbul ignore next */ []));
|
|
893
|
+
this.#classificationEffect = effect(() => {
|
|
894
|
+
const cls = this.classifications();
|
|
895
|
+
untracked(() => {
|
|
896
|
+
const ce = this.#system.getClassifications(cls).get(Classification.STRING_CATALOG_I18N);
|
|
897
|
+
if (ce && ce.options) {
|
|
898
|
+
this.#setOptions(ce.options);
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
}, ...(ngDevMode ? [{ debugName: "#classificationEffect" }] : /* istanbul ignore next */ []));
|
|
902
|
+
/**
|
|
903
|
+
* Possibles values are `EDIT` (default),`SEARCH`,`CREATE`. In search situation validation of the form element will be turned off, so you are able to enter search terms that do not meet the elements validators.
|
|
904
|
+
*/
|
|
905
|
+
this.situation = input(...(ngDevMode ? [undefined, { debugName: "situation" }] : /* istanbul ignore next */ []));
|
|
906
|
+
this.ngControl = injectNgControl(this);
|
|
907
|
+
this.fc = new FormControl(undefined);
|
|
908
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
909
|
+
this.propagateChange = (_) => { };
|
|
910
|
+
this.translate.onLangChange.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
911
|
+
// re-apply options to trigger translation
|
|
912
|
+
this.#setOptions(this.options());
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
#onValueChange(val) {
|
|
916
|
+
this.value = val;
|
|
917
|
+
this.propagateChange(this.value);
|
|
918
|
+
}
|
|
919
|
+
#setOptions(options) {
|
|
920
|
+
this._options.set(options.map((o) => ({
|
|
921
|
+
label: this.#translateOption(o),
|
|
922
|
+
value: o
|
|
923
|
+
})));
|
|
924
|
+
}
|
|
925
|
+
#translateOption(option) {
|
|
926
|
+
// labelkey: 'catalog:status:open_label' for option 'open'
|
|
927
|
+
// This will be derived fom a prefix the property name if available and this option itself
|
|
928
|
+
return this.#system.getLocalizedLabel(`catalog:${this.propertyName() || ''}:${option}`) || option;
|
|
929
|
+
}
|
|
930
|
+
writeValue(value) {
|
|
931
|
+
this.value = value;
|
|
932
|
+
this.fc.setValue(value, { emitEvent: false });
|
|
933
|
+
}
|
|
934
|
+
registerOnChange(fn) {
|
|
935
|
+
this.propagateChange = fn;
|
|
936
|
+
}
|
|
937
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
938
|
+
registerOnTouched(fn) { }
|
|
939
|
+
setDisabledState(isDisabled) {
|
|
940
|
+
if (isDisabled) {
|
|
941
|
+
this.fc.disable();
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
this.fc.enable();
|
|
945
|
+
}
|
|
946
|
+
this.disabled = isDisabled;
|
|
947
|
+
}
|
|
948
|
+
ngOnInit() {
|
|
949
|
+
if (this.required)
|
|
950
|
+
this.fc.setValidators(Validators.required);
|
|
951
|
+
this.fc.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
952
|
+
this.errorState = FormUtils.getErrorState(this.fc);
|
|
953
|
+
if (this.ngControl?.control) {
|
|
954
|
+
this.ngControl.control.setErrors(this.fc.errors);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
this.fc.updateValueAndValidity();
|
|
958
|
+
this.fc.valueChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => this.#onValueChange(v));
|
|
959
|
+
}
|
|
960
|
+
ngOnDestroy() {
|
|
961
|
+
super.onNgOnDestroy();
|
|
962
|
+
}
|
|
963
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: I18nCatalogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
964
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: I18nCatalogComponent, isStandalone: true, selector: "yuv-i18n-catalog", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, propertyName: { classPropertyName: "propertyName", publicName: "propertyName", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: I18nCatalogComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>", styles: [""], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
965
|
+
}
|
|
966
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: I18nCatalogComponent, decorators: [{
|
|
967
|
+
type: Component,
|
|
968
|
+
args: [{ selector: 'yuv-i18n-catalog', imports: [MatSelectModule, ReactiveFormsModule], providers: [{ provide: MatFormFieldControl, useExisting: I18nCatalogComponent }], template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>" }]
|
|
969
|
+
}], ctorParameters: () => [], propDecorators: { readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], propertyName: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyName", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }] } });
|
|
970
|
+
|
|
971
|
+
var _a;
|
|
972
|
+
/**
|
|
973
|
+
* Creates form input for number values.
|
|
974
|
+
*
|
|
975
|
+
* Implements `ControlValueAccessor` so it can be used within Angular forms.
|
|
976
|
+
*
|
|
977
|
+
* @example
|
|
978
|
+
* <yuv-number [scale]="2"></yuv-number>
|
|
979
|
+
*
|
|
980
|
+
*/
|
|
981
|
+
class NumberComponent extends AbstractMatFormField {
|
|
982
|
+
constructor() {
|
|
983
|
+
super(...arguments);
|
|
984
|
+
this.#dRef = inject(DestroyRef);
|
|
985
|
+
this.translate = inject(TranslateService);
|
|
986
|
+
// innerValue: string | null = null;
|
|
987
|
+
this.validationErrors = [];
|
|
988
|
+
this.transformPipe = new LocaleNumberPipe(this.translate);
|
|
989
|
+
this.innerCtrl = new FormControl(null);
|
|
990
|
+
this.ngControl = injectNgControl(this);
|
|
991
|
+
/**
|
|
992
|
+
* Number of decimal places
|
|
993
|
+
*/
|
|
994
|
+
this.scale = input(undefined, ...(ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []));
|
|
995
|
+
this.#scale = computed(() => Math.min(this.scale() || 0, 30), ...(ngDevMode ? [{ debugName: "#scale" }] : /* istanbul ignore next */ []));
|
|
996
|
+
/**
|
|
997
|
+
* Overall amount of digits allowed (including decimal places)
|
|
998
|
+
*/
|
|
999
|
+
this.precision = input(undefined, ...(ngDevMode ? [{ debugName: "precision" }] : /* istanbul ignore next */ []));
|
|
1000
|
+
this.#precision = computed(() => Math.min(this.precision() || 100, 100), ...(ngDevMode ? [{ debugName: "#precision" }] : /* istanbul ignore next */ []));
|
|
1001
|
+
/**
|
|
1002
|
+
* Set to true to group number by pattern
|
|
1003
|
+
*/
|
|
1004
|
+
this.grouping = input(false, ...(ngDevMode ? [{ debugName: "grouping" }] : /* istanbul ignore next */ []));
|
|
1005
|
+
this.#grouping = computed(() => this.grouping() ?? true, ...(ngDevMode ? [{ debugName: "#grouping" }] : /* istanbul ignore next */ []));
|
|
1006
|
+
/**
|
|
1007
|
+
* The pattern to group number value by
|
|
1008
|
+
*/
|
|
1009
|
+
this.groupPattern = input(undefined, ...(ngDevMode ? [{ debugName: "groupPattern" }] : /* istanbul ignore next */ []));
|
|
1010
|
+
/**
|
|
1011
|
+
* Will prevent the input from being changed (default: false)
|
|
1012
|
+
*/
|
|
1013
|
+
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1014
|
+
/**
|
|
1015
|
+
* set minimum input value
|
|
1016
|
+
*/
|
|
1017
|
+
this.minValue = input(undefined, ...(ngDevMode ? [{ debugName: "minValue" }] : /* istanbul ignore next */ []));
|
|
1018
|
+
/**
|
|
1019
|
+
* set maximum input value
|
|
1020
|
+
*
|
|
1021
|
+
*/
|
|
1022
|
+
this.maxValue = input(undefined, ...(ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
1023
|
+
/**
|
|
1024
|
+
* classification property adds some semantics to the value of this component.
|
|
1025
|
+
* If you provide a value of `filesize` numbers typed into the control will be
|
|
1026
|
+
* handled like file sizes (calculates differnt units)
|
|
1027
|
+
*/
|
|
1028
|
+
this.classifications = input([], ...(ngDevMode ? [{ debugName: "classifications" }] : /* istanbul ignore next */ []));
|
|
1029
|
+
this.#classificationsEffect = effect(() => {
|
|
1030
|
+
const classifications = this.classifications();
|
|
1031
|
+
this.transformPipe =
|
|
1032
|
+
classifications && classifications.includes(Classification.NUMBER_FILESIZE) ? new FileSizePipe(this.translate) : new LocaleNumberPipe(this.translate);
|
|
1033
|
+
}, ...(ngDevMode ? [{ debugName: "#classificationsEffect" }] : /* istanbul ignore next */ []));
|
|
1034
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
1035
|
+
this.propagateChange = (_) => { };
|
|
1036
|
+
}
|
|
1037
|
+
#dRef;
|
|
1038
|
+
#scale;
|
|
1039
|
+
#precision;
|
|
1040
|
+
#grouping;
|
|
1041
|
+
#classificationsEffect;
|
|
1042
|
+
static betweenTwoNumbers(val, minVal, maxVal) {
|
|
1043
|
+
const min = !Utils.isEmpty(minVal) ? minVal : -Infinity;
|
|
1044
|
+
const max = !Utils.isEmpty(maxVal) ? maxVal : Infinity;
|
|
1045
|
+
return val >= min && val <= max;
|
|
1046
|
+
}
|
|
1047
|
+
writeValue(value) {
|
|
1048
|
+
this.value = value != null ? value : null;
|
|
1049
|
+
const innerValue = value != null ? this.transformPipe.numberToString(value, this.#grouping(), this.groupPattern(), this.#scale()) : null;
|
|
1050
|
+
this.innerCtrl.setValue(innerValue, { emitEvent: false });
|
|
1051
|
+
}
|
|
1052
|
+
registerOnChange(fn) {
|
|
1053
|
+
this.propagateChange = fn;
|
|
1054
|
+
}
|
|
1055
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1056
|
+
registerOnTouched() { }
|
|
1057
|
+
setDisabledState(isDisabled) {
|
|
1058
|
+
if (isDisabled) {
|
|
1059
|
+
this.innerCtrl.disable();
|
|
1060
|
+
}
|
|
1061
|
+
else {
|
|
1062
|
+
this.innerCtrl.enable();
|
|
1063
|
+
}
|
|
1064
|
+
this.disabled = isDisabled;
|
|
1065
|
+
}
|
|
1066
|
+
// called when the input looses focus
|
|
1067
|
+
format() {
|
|
1068
|
+
if (!this.readonly() && typeof this.value === 'number' && this.validationErrors.length === 0) {
|
|
1069
|
+
this.innerCtrl.patchValue(this.transformPipe.numberToString(this.value, this.#grouping(), this.groupPattern(), this.#scale()), { emitEvent: false });
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
// called when the input get focus
|
|
1073
|
+
unformat() {
|
|
1074
|
+
if (!this.readonly() && typeof this.value === 'number' && this.validationErrors.length === 0) {
|
|
1075
|
+
this.innerCtrl.patchValue(this.transformPipe.transform(this.value, false), {
|
|
1076
|
+
emitEvent: false
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
#getValidator() {
|
|
1081
|
+
return (control) => {
|
|
1082
|
+
this.validationErrors = [];
|
|
1083
|
+
if (Utils.isEmpty(control.value))
|
|
1084
|
+
return null;
|
|
1085
|
+
const val = this.transformPipe.stringToNumber(control.value);
|
|
1086
|
+
// general number validation
|
|
1087
|
+
if (isNaN(val) || typeof val !== 'number') {
|
|
1088
|
+
this.validationErrors.push({ key: 'number' });
|
|
1089
|
+
}
|
|
1090
|
+
else {
|
|
1091
|
+
const split = control.value.replaceAll(this.transformPipe.separator, '').split(this.transformPipe.decimalSeparator);
|
|
1092
|
+
// check precision
|
|
1093
|
+
if (this.#precision() !== undefined) {
|
|
1094
|
+
const prePointDigits = this.#precision() - this.#scale();
|
|
1095
|
+
if (split[0]?.length > prePointDigits) {
|
|
1096
|
+
this.validationErrors.push({ key: 'precision', params: { prePointDigits } });
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
// check scale
|
|
1100
|
+
if (this.#scale() && split[1]?.length > this.#scale()) {
|
|
1101
|
+
this.validationErrors.push({ key: 'scale', params: { scale: this.#scale() } });
|
|
1102
|
+
}
|
|
1103
|
+
// min max
|
|
1104
|
+
if (!_a.betweenTwoNumbers(val, this.minValue(), this.maxValue())) {
|
|
1105
|
+
if (Utils.isEmpty(this.minValue())) {
|
|
1106
|
+
this.validationErrors.push({ key: 'maxvalue', params: { maxValue: this.maxValue() } });
|
|
1107
|
+
}
|
|
1108
|
+
else if (Utils.isEmpty(this.maxValue())) {
|
|
1109
|
+
this.validationErrors.push({ key: 'minvalue', params: { minValue: this.minValue() } });
|
|
1110
|
+
}
|
|
1111
|
+
else {
|
|
1112
|
+
this.validationErrors.push({ key: 'minmax', params: { minValue: this.minValue(), maxValue: this.maxValue() } });
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
const e = Utils.arrayToObject(this.validationErrors, 'key', (err) => ({ valid: false, ...err }));
|
|
1117
|
+
return this.validationErrors.length ? e : null;
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
ngOnInit() {
|
|
1121
|
+
// set up validators once all inputs are set
|
|
1122
|
+
const validators = [this.#getValidator()];
|
|
1123
|
+
if (this.required)
|
|
1124
|
+
validators.push(Validators.required);
|
|
830
1125
|
this.innerCtrl.setValidators(validators);
|
|
831
1126
|
this.innerCtrl.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
832
1127
|
this.errorState = FormUtils.getErrorState(this.innerCtrl);
|
|
@@ -854,7 +1149,7 @@ class NumberComponent extends AbstractMatFormField {
|
|
|
854
1149
|
super.onNgOnDestroy();
|
|
855
1150
|
}
|
|
856
1151
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NumberComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
857
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: NumberComponent, isStandalone: true, selector: "yuv-number", inputs: { scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null }, precision: { classPropertyName: "precision", publicName: "precision", isSignal: true, isRequired: false, transformFunction: null }, grouping: { classPropertyName: "grouping", publicName: "grouping", isSignal: true, isRequired: false, transformFunction: null }, groupPattern: { classPropertyName: "groupPattern", publicName: "groupPattern", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: NumberComponent }], usesInheritance: true, ngImport: i0, template: '<input type="string" [formControl]="innerCtrl" (focus)="unformat()" (blur)="format()" [readonly]="readonly()" />', isInline: true, styles: [":host{display:flex}:host input{width:100%;border:0;outline:0;background:transparent}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
1152
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: NumberComponent, isStandalone: true, selector: "yuv-number", inputs: { scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null }, precision: { classPropertyName: "precision", publicName: "precision", isSignal: true, isRequired: false, transformFunction: null }, grouping: { classPropertyName: "grouping", publicName: "grouping", isSignal: true, isRequired: false, transformFunction: null }, groupPattern: { classPropertyName: "groupPattern", publicName: "groupPattern", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: NumberComponent }], usesInheritance: true, ngImport: i0, template: '<input type="string" [formControl]="innerCtrl" (focus)="unformat()" (blur)="format()" [readonly]="readonly()" />', isInline: true, styles: [":host{display:flex}:host input{width:100%;border:0;outline:0;background:transparent}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.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: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
858
1153
|
}
|
|
859
1154
|
_a = NumberComponent;
|
|
860
1155
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NumberComponent, decorators: [{
|
|
@@ -997,74 +1292,230 @@ class NumberRangeComponent extends AbstractMatFormField {
|
|
|
997
1292
|
secondValue: undefined
|
|
998
1293
|
};
|
|
999
1294
|
}
|
|
1000
|
-
this.propagateChange(this.value);
|
|
1295
|
+
this.propagateChange(this.value);
|
|
1296
|
+
}
|
|
1297
|
+
#getValidator() {
|
|
1298
|
+
return (control) => {
|
|
1299
|
+
let err;
|
|
1300
|
+
const operator = control.get('operator')?.value;
|
|
1301
|
+
const firstValue = Number(control.get('numberValueFrom')?.value);
|
|
1302
|
+
const secondValue = Number(control.get('numberValue')?.value);
|
|
1303
|
+
const singleValueOperators = new Set([Operator.EQUAL]);
|
|
1304
|
+
const rangeOperators = new Set([Operator.INTERVAL_INCLUDE_BOTH]);
|
|
1305
|
+
if (this.situation() === Situation.SEARCH)
|
|
1306
|
+
return null;
|
|
1307
|
+
if (singleValueOperators.has(operator)) {
|
|
1308
|
+
return { number: { valid: false } };
|
|
1309
|
+
}
|
|
1310
|
+
else if (rangeOperators.has(operator)) {
|
|
1311
|
+
if (firstValue && secondValue) {
|
|
1312
|
+
// make sure that on ranges, the first value is earlier than the last
|
|
1313
|
+
this.isValid = firstValue < secondValue;
|
|
1314
|
+
if (this.isValid)
|
|
1315
|
+
return null;
|
|
1316
|
+
return { numberrangeorder: { valid: false } };
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
return { numberrange: { valid: false } };
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return null;
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
// returns null when valid else the validation object
|
|
1326
|
+
validate() {
|
|
1327
|
+
let err;
|
|
1328
|
+
const operator = this.rangeForm.value.operator;
|
|
1329
|
+
if (operator === Operator.EQUAL) {
|
|
1330
|
+
err = { number: { valid: false } };
|
|
1331
|
+
}
|
|
1332
|
+
else if (operator === Operator.INTERVAL_INCLUDE_BOTH && this.value?.firstValue && this.value?.secondValue) {
|
|
1333
|
+
// make sure that on ranges, the first value is earlier than the last
|
|
1334
|
+
this.isValid = this.value.firstValue < this.value.secondValue;
|
|
1335
|
+
err = { numberrangeorder: { valid: false } };
|
|
1336
|
+
}
|
|
1337
|
+
else {
|
|
1338
|
+
err = { numberrange: { valid: false } };
|
|
1339
|
+
}
|
|
1340
|
+
return this.isValid ? null : err;
|
|
1341
|
+
}
|
|
1342
|
+
ngOnInit() {
|
|
1343
|
+
this.rangeForm.setValidators(this.#getValidator());
|
|
1344
|
+
this.rangeForm.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
1345
|
+
this.errorState = FormUtils.getErrorState(this.rangeForm);
|
|
1346
|
+
if (this.ngControl?.control) {
|
|
1347
|
+
this.ngControl.control.setErrors(this.rangeForm.errors);
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
this.rangeForm.updateValueAndValidity();
|
|
1351
|
+
this.rangeForm.valueChanges.subscribe(() => this.#onValueChange());
|
|
1352
|
+
}
|
|
1353
|
+
ngOnDestroy() {
|
|
1354
|
+
super.onNgOnDestroy();
|
|
1355
|
+
}
|
|
1356
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NumberRangeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1357
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: NumberRangeComponent, isStandalone: true, selector: "yuv-number-range", inputs: { scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null }, precision: { classPropertyName: "precision", publicName: "precision", isSignal: true, isRequired: false, transformFunction: null }, grouping: { classPropertyName: "grouping", publicName: "grouping", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: NumberRangeComponent }], usesInheritance: true, ngImport: i0, template: "<form class=\"yuv-number-range\" [formGroup]=\"rangeForm\">\n @if (rangeForm.value.operator === 'gtelte') {\n <yuv-number\n class=\"first\"\n [readonly]=\"readonly()\"\n [scale]=\"scale()\"\n [precision]=\"precision()\"\n [grouping]=\"grouping()\"\n [groupPattern]=\"pattern()\"\n formControlName=\"numberValueFrom\"\n [classifications]=\"classifications()\"\n [minValue]=\"minValue()\"\n [maxValue]=\"maxValue()\"\n ></yuv-number>\n }\n\n <mat-select [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\" formControlName=\"operator\" [disabled]=\"readonly()\">\n @for (o of availableSearchOptions; track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n </mat-select>\n\n <yuv-number\n [scale]=\"scale()\"\n [readonly]=\"readonly()\"\n [precision]=\"precision()\"\n [grouping]=\"grouping()\"\n [groupPattern]=\"pattern()\"\n formControlName=\"numberValue\"\n [classifications]=\"classifications()\"\n [minValue]=\"minValue()\"\n [maxValue]=\"maxValue()\"\n >\n </yuv-number>\n</form>\n", styles: [":host>form{display:inline-flex;flex-flow:row nowrap;align-items:center;gap:var(--ymt-spacing-s)}:host>form yuv-number{flex:1 1 auto}:host>form mat-select{padding:0;width:calc(2ch + 1em);border-radius:2px}\n"], dependencies: [{ kind: "component", type: NumberComponent, selector: "yuv-number", inputs: ["scale", "precision", "grouping", "groupPattern", "readonly", "minValue", "maxValue", "classifications"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
|
|
1358
|
+
}
|
|
1359
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NumberRangeComponent, decorators: [{
|
|
1360
|
+
type: Component,
|
|
1361
|
+
args: [{ selector: 'yuv-number-range', standalone: true, imports: [NumberComponent, MatSelectModule, FormsModule, ReactiveFormsModule], providers: [{ provide: MatFormFieldControl, useExisting: NumberRangeComponent }], template: "<form class=\"yuv-number-range\" [formGroup]=\"rangeForm\">\n @if (rangeForm.value.operator === 'gtelte') {\n <yuv-number\n class=\"first\"\n [readonly]=\"readonly()\"\n [scale]=\"scale()\"\n [precision]=\"precision()\"\n [grouping]=\"grouping()\"\n [groupPattern]=\"pattern()\"\n formControlName=\"numberValueFrom\"\n [classifications]=\"classifications()\"\n [minValue]=\"minValue()\"\n [maxValue]=\"maxValue()\"\n ></yuv-number>\n }\n\n <mat-select [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\" formControlName=\"operator\" [disabled]=\"readonly()\">\n @for (o of availableSearchOptions; track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n </mat-select>\n\n <yuv-number\n [scale]=\"scale()\"\n [readonly]=\"readonly()\"\n [precision]=\"precision()\"\n [grouping]=\"grouping()\"\n [groupPattern]=\"pattern()\"\n formControlName=\"numberValue\"\n [classifications]=\"classifications()\"\n [minValue]=\"minValue()\"\n [maxValue]=\"maxValue()\"\n >\n </yuv-number>\n</form>\n", styles: [":host>form{display:inline-flex;flex-flow:row nowrap;align-items:center;gap:var(--ymt-spacing-s)}:host>form yuv-number{flex:1 1 auto}:host>form mat-select{padding:0;width:calc(2ch + 1em);border-radius:2px}\n"] }]
|
|
1362
|
+
}], propDecorators: { scale: [{ type: i0.Input, args: [{ isSignal: true, alias: "scale", required: false }] }], precision: [{ type: i0.Input, args: [{ isSignal: true, alias: "precision", required: false }] }], grouping: [{ type: i0.Input, args: [{ isSignal: true, alias: "grouping", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], minValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "minValue", required: false }] }], maxValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxValue", required: false }] }], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }] } });
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Creates form input for organization set values. An organization set is
|
|
1366
|
+
* either a user or a role. This control will emit a stringified JSON object of
|
|
1367
|
+
* a OrganizationSetEntry object.
|
|
1368
|
+
*
|
|
1369
|
+
* ```json
|
|
1370
|
+
* {
|
|
1371
|
+
* "id:organization:set": [
|
|
1372
|
+
* "{\"id\":\"YUUVIS_AI_PREDICT\",\"title\":\"YUUVIS_AI_PREDICT\",\"type\":\"role\"}"
|
|
1373
|
+
* ]
|
|
1374
|
+
* }
|
|
1375
|
+
* ```
|
|
1376
|
+
*/
|
|
1377
|
+
class OrganizationSetComponent extends AbstractMatFormField {
|
|
1378
|
+
constructor() {
|
|
1379
|
+
super(...arguments);
|
|
1380
|
+
this.#system = inject(SystemService);
|
|
1381
|
+
this.#idmService = inject(IdmService);
|
|
1382
|
+
this.#dRef = inject(DestroyRef);
|
|
1383
|
+
/**
|
|
1384
|
+
* Possibles values are `EDIT` (default),`SEARCH`,`CREATE`. In search situation validation of the form element will be turned off, so you are able to enter search terms that do not meet the elements validators.
|
|
1385
|
+
*/
|
|
1386
|
+
this.situation = input(undefined, ...(ngDevMode ? [{ debugName: "situation" }] : /* istanbul ignore next */ []));
|
|
1387
|
+
/**
|
|
1388
|
+
* Indicator that multiple strings could be inserted, they will be rendered as chips (default: false).
|
|
1389
|
+
*/
|
|
1390
|
+
this.multiselect = input(false, ...(ngDevMode ? [{ debugName: "multiselect" }] : /* istanbul ignore next */ []));
|
|
1391
|
+
/**
|
|
1392
|
+
* Will prevent the input from being changed (default: false)
|
|
1393
|
+
*/
|
|
1394
|
+
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1395
|
+
/**
|
|
1396
|
+
* Whether or not the emitted value should be an object containing id and title
|
|
1397
|
+
* or, if set to false only the ID
|
|
1398
|
+
*/
|
|
1399
|
+
this.withMetadata = input(false, ...(ngDevMode ? [{ debugName: "withMetadata" }] : /* istanbul ignore next */ []));
|
|
1400
|
+
/**
|
|
1401
|
+
* Minimum length of the autocomplete input before a query is sent to the server.
|
|
1402
|
+
*/
|
|
1403
|
+
this.autocompleteMinLength = input(2, ...(ngDevMode ? [{ debugName: "autocompleteMinLength" }] : /* istanbul ignore next */ []));
|
|
1404
|
+
this.classifications = input(undefined, ...(ngDevMode ? [{ debugName: "classifications" }] : /* istanbul ignore next */ []));
|
|
1405
|
+
this.types = input(undefined, ...(ngDevMode ? [{ debugName: "types" }] : /* istanbul ignore next */ []));
|
|
1406
|
+
this.#targetTypes = linkedSignal(() => {
|
|
1407
|
+
const c = this.classifications();
|
|
1408
|
+
const types = this.types();
|
|
1409
|
+
if (c?.length) {
|
|
1410
|
+
const classifications = this.#system.getClassifications(c);
|
|
1411
|
+
return classifications.has(Classification.STRING_ORGANIZATION_SET)
|
|
1412
|
+
? classifications.get(Classification.STRING_ORGANIZATION_SET).options
|
|
1413
|
+
: [];
|
|
1414
|
+
}
|
|
1415
|
+
else if (types) {
|
|
1416
|
+
return types;
|
|
1417
|
+
}
|
|
1418
|
+
return [];
|
|
1419
|
+
}, ...(ngDevMode ? [{ debugName: "#targetTypes" }] : /* istanbul ignore next */ []));
|
|
1420
|
+
this.busy = signal(false, ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
1421
|
+
this.acFormControl = new FormControl(undefined);
|
|
1422
|
+
this.ngControl = injectNgControl(this);
|
|
1423
|
+
this.innerValue = [];
|
|
1424
|
+
this.autocompleteRes = [];
|
|
1425
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1426
|
+
this.propagateChange = (_) => { };
|
|
1427
|
+
}
|
|
1428
|
+
#system;
|
|
1429
|
+
#idmService;
|
|
1430
|
+
#dRef;
|
|
1431
|
+
#targetTypes;
|
|
1432
|
+
writeValue(value) {
|
|
1433
|
+
const val = Array.isArray(value)
|
|
1434
|
+
? value.map((v) => (typeof v === 'string' ? JSON.parse(v) : v))
|
|
1435
|
+
: value
|
|
1436
|
+
? [JSON.parse(value)]
|
|
1437
|
+
: [];
|
|
1438
|
+
this.innerValue = val;
|
|
1439
|
+
this.value = val.map((v) => JSON.stringify(v));
|
|
1440
|
+
if (!this.multiselect) {
|
|
1441
|
+
this.value = this.value[0] || null;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
registerOnChange(fn) {
|
|
1445
|
+
this.propagateChange = fn;
|
|
1446
|
+
}
|
|
1447
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1448
|
+
registerOnTouched(fn) { }
|
|
1449
|
+
setDisabledState(isDisabled) {
|
|
1450
|
+
if (isDisabled) {
|
|
1451
|
+
this.acFormControl.disable();
|
|
1452
|
+
}
|
|
1453
|
+
else {
|
|
1454
|
+
this.acFormControl.enable();
|
|
1455
|
+
}
|
|
1456
|
+
this.disabled = isDisabled;
|
|
1457
|
+
}
|
|
1458
|
+
propagate() {
|
|
1459
|
+
this.value = this.#getPropagateValue();
|
|
1460
|
+
this.propagateChange(this.value);
|
|
1461
|
+
}
|
|
1462
|
+
#getPropagateValue() {
|
|
1463
|
+
if (this.multiselect()) {
|
|
1464
|
+
return this.innerValue.map((v) => JSON.stringify(v));
|
|
1465
|
+
}
|
|
1466
|
+
else if (this.innerValue.length) {
|
|
1467
|
+
return JSON.stringify(this.innerValue[0]);
|
|
1468
|
+
}
|
|
1469
|
+
else
|
|
1470
|
+
return undefined;
|
|
1001
1471
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
else if (rangeOperators.has(operator)) {
|
|
1016
|
-
if (firstValue && secondValue) {
|
|
1017
|
-
// make sure that on ranges, the first value is earlier than the last
|
|
1018
|
-
this.isValid = firstValue < secondValue;
|
|
1019
|
-
if (this.isValid)
|
|
1020
|
-
return null;
|
|
1021
|
-
return { numberrangeorder: { valid: false } };
|
|
1022
|
-
}
|
|
1023
|
-
else {
|
|
1024
|
-
return { numberrange: { valid: false } };
|
|
1472
|
+
autocompleteFn(query) {
|
|
1473
|
+
if (query.length >= this.autocompleteMinLength()) {
|
|
1474
|
+
this.#idmService.queryOrganizationEntity(query, this.#targetTypes()).subscribe({
|
|
1475
|
+
next: (entries) => {
|
|
1476
|
+
this.autocompleteRes = entries
|
|
1477
|
+
.filter((e) => !this.innerValue?.some((value) => value.id === e.id))
|
|
1478
|
+
.map((o) => ({
|
|
1479
|
+
label: o.title,
|
|
1480
|
+
value: o
|
|
1481
|
+
}));
|
|
1482
|
+
},
|
|
1483
|
+
error: (e) => {
|
|
1484
|
+
this.autocompleteRes = [];
|
|
1025
1485
|
}
|
|
1026
|
-
}
|
|
1027
|
-
return null;
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
// returns null when valid else the validation object
|
|
1031
|
-
validate() {
|
|
1032
|
-
let err;
|
|
1033
|
-
const operator = this.rangeForm.value.operator;
|
|
1034
|
-
if (operator === Operator.EQUAL) {
|
|
1035
|
-
err = { number: { valid: false } };
|
|
1036
|
-
}
|
|
1037
|
-
else if (operator === Operator.INTERVAL_INCLUDE_BOTH && this.value?.firstValue && this.value?.secondValue) {
|
|
1038
|
-
// make sure that on ranges, the first value is earlier than the last
|
|
1039
|
-
this.isValid = this.value.firstValue < this.value.secondValue;
|
|
1040
|
-
err = { numberrangeorder: { valid: false } };
|
|
1486
|
+
});
|
|
1041
1487
|
}
|
|
1042
1488
|
else {
|
|
1043
|
-
|
|
1489
|
+
this.autocompleteRes = [];
|
|
1044
1490
|
}
|
|
1045
|
-
return this.isValid ? null : err;
|
|
1046
1491
|
}
|
|
1047
1492
|
ngOnInit() {
|
|
1048
|
-
this.
|
|
1049
|
-
|
|
1050
|
-
|
|
1493
|
+
if (this.required)
|
|
1494
|
+
this.acFormControl.setValidators(Validators.required);
|
|
1495
|
+
this.acFormControl.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
1496
|
+
this.errorState = FormUtils.getErrorState(this.acFormControl);
|
|
1051
1497
|
if (this.ngControl?.control) {
|
|
1052
|
-
this.ngControl.control.setErrors(this.
|
|
1498
|
+
this.ngControl.control.setErrors(this.acFormControl.errors);
|
|
1053
1499
|
}
|
|
1054
1500
|
});
|
|
1055
|
-
this.
|
|
1056
|
-
this.
|
|
1501
|
+
this.acFormControl.updateValueAndValidity();
|
|
1502
|
+
this.acFormControl.valueChanges.subscribe((v) => {
|
|
1503
|
+
if (!Array.isArray(v))
|
|
1504
|
+
v = v ? [v] : [];
|
|
1505
|
+
this.innerValue = v.map((i) => i.value);
|
|
1506
|
+
this.propagate();
|
|
1507
|
+
});
|
|
1057
1508
|
}
|
|
1058
1509
|
ngOnDestroy() {
|
|
1059
1510
|
super.onNgOnDestroy();
|
|
1060
1511
|
}
|
|
1061
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type:
|
|
1062
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OrganizationSetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1513
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: OrganizationSetComponent, isStandalone: true, selector: "yuv-organization-set", inputs: { situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null }, multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, withMetadata: { classPropertyName: "withMetadata", publicName: "withMetadata", isSignal: true, isRequired: false, transformFunction: null }, autocompleteMinLength: { classPropertyName: "autocompleteMinLength", publicName: "autocompleteMinLength", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, types: { classPropertyName: "types", publicName: "types", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: OrganizationSetComponent }], usesInheritance: true, ngImport: i0, template: "<yuv-autocomplete\n [busy]=\"busy()\"\n [formControl]=\"acFormControl\"\n #autocomplete\n [placeholder]=\"placeholder\"\n [disabled]=\"readonly()\"\n [autocompleteValues]=\"autocompleteRes\"\n [forceSelection]=\"true\"\n (autocompleteFnc)=\"autocompleteFn($event)\"\n [multiple]=\"true\"\n [maxItems]=\"multiselect() ? -1 : 1\"\n>\n <!-- template for item inside the dropdown -->\n <ng-template #optionTemplate let-item>\n <span class=\"chip\">{{ item.value.title }}</span>\n </ng-template>\n\n <!-- template for chip -->\n <ng-template #chipTemplate let-item>\n <span class=\"chip\">\n {{ item.value.title || '...' }}\n </span>\n </ng-template>\n</yuv-autocomplete>\n\n<mat-icon class=\"ymt-icon--size-s\" [matTooltip]=\"'yuv.form.element.organization-set.classify.icon.title' | translate\">\n {{ multiselect() ? 'group' : 'person' }}\n</mat-icon>\n", styles: [":host{display:flex;align-items:center}:host yuv-autocomplete{flex:1}:host mat-icon{color:var(--ymt-text-color-subtle)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: YuvAutocompleteModule }, { kind: "component", type: i2$2.AutocompleteComponent, selector: "yuv-autocomplete", inputs: ["ariaLabel", "busy", "multiple", "distinctValues", "addOnBlur", "minLength", "maxItems", "forceSelection", "autocompleteValues"], outputs: ["autocompleteFnc", "acBlur"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: TranslatePipe$1, name: "translate" }] }); }
|
|
1063
1514
|
}
|
|
1064
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type:
|
|
1515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OrganizationSetComponent, decorators: [{
|
|
1065
1516
|
type: Component,
|
|
1066
|
-
args: [{ selector: 'yuv-
|
|
1067
|
-
}], propDecorators: {
|
|
1517
|
+
args: [{ selector: 'yuv-organization-set', imports: [FormsModule, YuvAutocompleteModule, MatTooltipModule, MatIconModule, ReactiveFormsModule, TranslatePipe$1], providers: [{ provide: MatFormFieldControl, useExisting: OrganizationSetComponent }], template: "<yuv-autocomplete\n [busy]=\"busy()\"\n [formControl]=\"acFormControl\"\n #autocomplete\n [placeholder]=\"placeholder\"\n [disabled]=\"readonly()\"\n [autocompleteValues]=\"autocompleteRes\"\n [forceSelection]=\"true\"\n (autocompleteFnc)=\"autocompleteFn($event)\"\n [multiple]=\"true\"\n [maxItems]=\"multiselect() ? -1 : 1\"\n>\n <!-- template for item inside the dropdown -->\n <ng-template #optionTemplate let-item>\n <span class=\"chip\">{{ item.value.title }}</span>\n </ng-template>\n\n <!-- template for chip -->\n <ng-template #chipTemplate let-item>\n <span class=\"chip\">\n {{ item.value.title || '...' }}\n </span>\n </ng-template>\n</yuv-autocomplete>\n\n<mat-icon class=\"ymt-icon--size-s\" [matTooltip]=\"'yuv.form.element.organization-set.classify.icon.title' | translate\">\n {{ multiselect() ? 'group' : 'person' }}\n</mat-icon>\n", styles: [":host{display:flex;align-items:center}:host yuv-autocomplete{flex:1}:host mat-icon{color:var(--ymt-text-color-subtle)}\n"] }]
|
|
1518
|
+
}], propDecorators: { situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }], multiselect: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiselect", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], withMetadata: [{ type: i0.Input, args: [{ isSignal: true, alias: "withMetadata", required: false }] }], autocompleteMinLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocompleteMinLength", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], types: [{ type: i0.Input, args: [{ isSignal: true, alias: "types", required: false }] }] } });
|
|
1068
1519
|
|
|
1069
1520
|
const mapOrganizationNode = (innerValue) => map$1((node) => node
|
|
1070
1521
|
.filter((e) => !innerValue?.some((value) => value?.id === e.id))
|
|
@@ -1246,193 +1697,29 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1246
1697
|
return this.#idmService.queryOrganizationEntity(query, filterRoles).pipe(mapOrganizationNode(this.innerValue), catchError(() => of([])));
|
|
1247
1698
|
}
|
|
1248
1699
|
#getMetadataString(value) {
|
|
1249
|
-
try {
|
|
1250
|
-
if (Array.isArray(value)) {
|
|
1251
|
-
return value.map((v) => JSON.parse(v));
|
|
1252
|
-
}
|
|
1253
|
-
else {
|
|
1254
|
-
return JSON.parse(value);
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
catch (e) {
|
|
1258
|
-
return undefined;
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
autocompleteFn(query) {
|
|
1262
|
-
if (query.length >= this.minLength) {
|
|
1263
|
-
this.busy.set(true);
|
|
1264
|
-
(this.#organizationType() === Classification.STRING_ORGANIZATION
|
|
1265
|
-
? this.#resolveOrganization(query, this.excludeMe(), this.#filterRoles())
|
|
1266
|
-
: this.#resolveOrganizationSet(query, this.#filterRoles())).subscribe({
|
|
1267
|
-
next: (res) => {
|
|
1268
|
-
this.busy.set(false);
|
|
1269
|
-
this.autocompleteRes = res;
|
|
1270
|
-
},
|
|
1271
|
-
error: () => this.busy.set(false)
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
else {
|
|
1275
|
-
this.autocompleteRes = [];
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
ngOnInit() {
|
|
1279
|
-
if (this.required)
|
|
1280
|
-
this.acFormControl.setValidators(Validators.required);
|
|
1281
|
-
this.acFormControl.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
1282
|
-
this.errorState = FormUtils.getErrorState(this.acFormControl);
|
|
1283
|
-
if (this.ngControl?.control) {
|
|
1284
|
-
this.ngControl.control.setErrors(this.acFormControl.errors);
|
|
1285
|
-
}
|
|
1286
|
-
});
|
|
1287
|
-
this.acFormControl.updateValueAndValidity({ emitEvent: false });
|
|
1288
|
-
this.acFormControl.valueChanges.subscribe((v) => {
|
|
1289
|
-
if (!Array.isArray(v))
|
|
1290
|
-
v = v ? [v] : [];
|
|
1291
|
-
this.innerValue = v.map((i) => i.value);
|
|
1292
|
-
this.propagate();
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
ngOnDestroy() {
|
|
1296
|
-
super.onNgOnDestroy();
|
|
1297
|
-
}
|
|
1298
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OrganizationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1299
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: OrganizationComponent, isStandalone: true, selector: "yuv-organization", inputs: { situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null }, multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, excludeMe: { classPropertyName: "excludeMe", publicName: "excludeMe", isSignal: true, isRequired: false, transformFunction: null }, withMetadata: { classPropertyName: "withMetadata", publicName: "withMetadata", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: OrganizationComponent }], usesInheritance: true, ngImport: i0, template: "<yuv-autocomplete\n [required]=\"required\"\n [busy]=\"busy()\"\n [formControl]=\"acFormControl\"\n #autocomplete\n [placeholder]=\"placeholder\"\n [disabled]=\"readonly()\"\n [autocompleteValues]=\"autocompleteRes\"\n [forceSelection]=\"true\"\n [distinctValues]=\"true\"\n (autocompleteFnc)=\"autocompleteFn($event)\"\n [multiple]=\"true\"\n [maxItems]=\"multiselect() ? -1 : 1\"\n>\n <!-- template for item inside the dropdown -->\n <ng-template #optionTemplate let-item>\n @if (item.value) {\n <span class=\"chip\">{{ item.value.title }}</span>\n }\n </ng-template>\n\n <!-- template for chip -->\n <ng-template #chipTemplate let-item>\n @if (item.value) {\n <span class=\"chip\" [ngClass]=\"{ notFound: item.value.notFound }\" [matTooltip]=\"item.value.titleString\">\n {{ item.value.title || '...' }}\n </span>\n }\n </ng-template>\n</yuv-autocomplete>\n\n<mat-icon class=\"ymt-icon--size-s\" [matTooltip]=\"'yuv.form.element.organization.classify.icon.title' | translate\">\n {{ multiselect() ? 'group' : 'person' }}\n</mat-icon>\n", styles: [":host{display:flex;align-items:center}:host .chip.notFound{color:var(--ymt-on-danger-container);text-decoration:line-through}:host .chip.notFound:before{content:\"!\";display:inline-block;background-color:var(--ymt-danger-container);color:#fff;border-radius:2px;padding-inline:.3em;text-decoration:none;margin-inline-end:.75em}:host yuv-autocomplete{flex:1}:host mat-icon{color:var(--ymt-text-color-subtle)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: YuvAutocompleteModule }, { kind: "component", type: i3$1.AutocompleteComponent, selector: "yuv-autocomplete", inputs: ["ariaLabel", "busy", "multiple", "distinctValues", "addOnBlur", "minLength", "maxItems", "forceSelection", "autocompleteValues"], outputs: ["autocompleteFnc", "acBlur"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
1300
|
-
}
|
|
1301
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OrganizationComponent, decorators: [{
|
|
1302
|
-
type: Component,
|
|
1303
|
-
args: [{ selector: 'yuv-organization', standalone: true, imports: [
|
|
1304
|
-
CommonModule,
|
|
1305
|
-
FormsModule,
|
|
1306
|
-
YuvAutocompleteModule,
|
|
1307
|
-
MatTooltipModule,
|
|
1308
|
-
MatIconModule,
|
|
1309
|
-
ReactiveFormsModule,
|
|
1310
|
-
TranslatePipe
|
|
1311
|
-
], providers: [{ provide: MatFormFieldControl, useExisting: OrganizationComponent }], template: "<yuv-autocomplete\n [required]=\"required\"\n [busy]=\"busy()\"\n [formControl]=\"acFormControl\"\n #autocomplete\n [placeholder]=\"placeholder\"\n [disabled]=\"readonly()\"\n [autocompleteValues]=\"autocompleteRes\"\n [forceSelection]=\"true\"\n [distinctValues]=\"true\"\n (autocompleteFnc)=\"autocompleteFn($event)\"\n [multiple]=\"true\"\n [maxItems]=\"multiselect() ? -1 : 1\"\n>\n <!-- template for item inside the dropdown -->\n <ng-template #optionTemplate let-item>\n @if (item.value) {\n <span class=\"chip\">{{ item.value.title }}</span>\n }\n </ng-template>\n\n <!-- template for chip -->\n <ng-template #chipTemplate let-item>\n @if (item.value) {\n <span class=\"chip\" [ngClass]=\"{ notFound: item.value.notFound }\" [matTooltip]=\"item.value.titleString\">\n {{ item.value.title || '...' }}\n </span>\n }\n </ng-template>\n</yuv-autocomplete>\n\n<mat-icon class=\"ymt-icon--size-s\" [matTooltip]=\"'yuv.form.element.organization.classify.icon.title' | translate\">\n {{ multiselect() ? 'group' : 'person' }}\n</mat-icon>\n", styles: [":host{display:flex;align-items:center}:host .chip.notFound{color:var(--ymt-on-danger-container);text-decoration:line-through}:host .chip.notFound:before{content:\"!\";display:inline-block;background-color:var(--ymt-danger-container);color:#fff;border-radius:2px;padding-inline:.3em;text-decoration:none;margin-inline-end:.75em}:host yuv-autocomplete{flex:1}:host mat-icon{color:var(--ymt-text-color-subtle)}\n"] }]
|
|
1312
|
-
}], propDecorators: { situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }], multiselect: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiselect", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], excludeMe: [{ type: i0.Input, args: [{ isSignal: true, alias: "excludeMe", required: false }] }], withMetadata: [{ type: i0.Input, args: [{ isSignal: true, alias: "withMetadata", required: false }] }] } });
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* Creates form input for organization set values. An organization set is
|
|
1316
|
-
* either a user or a role. This control will emit a stringified JSON object of
|
|
1317
|
-
* a OrganizationSetEntry object.
|
|
1318
|
-
*
|
|
1319
|
-
* ```json
|
|
1320
|
-
* {
|
|
1321
|
-
* "id:organization:set": [
|
|
1322
|
-
* "{\"id\":\"YUUVIS_AI_PREDICT\",\"title\":\"YUUVIS_AI_PREDICT\",\"type\":\"role\"}"
|
|
1323
|
-
* ]
|
|
1324
|
-
* }
|
|
1325
|
-
* ```
|
|
1326
|
-
*/
|
|
1327
|
-
class OrganizationSetComponent extends AbstractMatFormField {
|
|
1328
|
-
constructor() {
|
|
1329
|
-
super(...arguments);
|
|
1330
|
-
this.#system = inject(SystemService);
|
|
1331
|
-
this.#idmService = inject(IdmService);
|
|
1332
|
-
this.#dRef = inject(DestroyRef);
|
|
1333
|
-
/**
|
|
1334
|
-
* Possibles values are `EDIT` (default),`SEARCH`,`CREATE`. In search situation validation of the form element will be turned off, so you are able to enter search terms that do not meet the elements validators.
|
|
1335
|
-
*/
|
|
1336
|
-
this.situation = input(undefined, ...(ngDevMode ? [{ debugName: "situation" }] : /* istanbul ignore next */ []));
|
|
1337
|
-
/**
|
|
1338
|
-
* Indicator that multiple strings could be inserted, they will be rendered as chips (default: false).
|
|
1339
|
-
*/
|
|
1340
|
-
this.multiselect = input(false, ...(ngDevMode ? [{ debugName: "multiselect" }] : /* istanbul ignore next */ []));
|
|
1341
|
-
/**
|
|
1342
|
-
* Will prevent the input from being changed (default: false)
|
|
1343
|
-
*/
|
|
1344
|
-
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1345
|
-
/**
|
|
1346
|
-
* Whether or not the emitted value should be an object containing id and title
|
|
1347
|
-
* or, if set to false only the ID
|
|
1348
|
-
*/
|
|
1349
|
-
this.withMetadata = input(false, ...(ngDevMode ? [{ debugName: "withMetadata" }] : /* istanbul ignore next */ []));
|
|
1350
|
-
/**
|
|
1351
|
-
* Minimum length of the autocomplete input before a query is sent to the server.
|
|
1352
|
-
*/
|
|
1353
|
-
this.autocompleteMinLength = input(2, ...(ngDevMode ? [{ debugName: "autocompleteMinLength" }] : /* istanbul ignore next */ []));
|
|
1354
|
-
this.classifications = input(undefined, ...(ngDevMode ? [{ debugName: "classifications" }] : /* istanbul ignore next */ []));
|
|
1355
|
-
this.types = input(undefined, ...(ngDevMode ? [{ debugName: "types" }] : /* istanbul ignore next */ []));
|
|
1356
|
-
this.#targetTypes = linkedSignal(() => {
|
|
1357
|
-
const c = this.classifications();
|
|
1358
|
-
const types = this.types();
|
|
1359
|
-
if (c?.length) {
|
|
1360
|
-
const classifications = this.#system.getClassifications(c);
|
|
1361
|
-
return classifications.has(Classification.STRING_ORGANIZATION_SET)
|
|
1362
|
-
? classifications.get(Classification.STRING_ORGANIZATION_SET).options
|
|
1363
|
-
: [];
|
|
1364
|
-
}
|
|
1365
|
-
else if (types) {
|
|
1366
|
-
return types;
|
|
1367
|
-
}
|
|
1368
|
-
return [];
|
|
1369
|
-
}, ...(ngDevMode ? [{ debugName: "#targetTypes" }] : /* istanbul ignore next */ []));
|
|
1370
|
-
this.busy = signal(false, ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
1371
|
-
this.acFormControl = new FormControl(undefined);
|
|
1372
|
-
this.ngControl = injectNgControl(this);
|
|
1373
|
-
this.innerValue = [];
|
|
1374
|
-
this.autocompleteRes = [];
|
|
1375
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1376
|
-
this.propagateChange = (_) => { };
|
|
1377
|
-
}
|
|
1378
|
-
#system;
|
|
1379
|
-
#idmService;
|
|
1380
|
-
#dRef;
|
|
1381
|
-
#targetTypes;
|
|
1382
|
-
writeValue(value) {
|
|
1383
|
-
const val = Array.isArray(value)
|
|
1384
|
-
? value.map((v) => (typeof v === 'string' ? JSON.parse(v) : v))
|
|
1385
|
-
: value
|
|
1386
|
-
? [JSON.parse(value)]
|
|
1387
|
-
: [];
|
|
1388
|
-
this.innerValue = val;
|
|
1389
|
-
this.value = val.map((v) => JSON.stringify(v));
|
|
1390
|
-
if (!this.multiselect) {
|
|
1391
|
-
this.value = this.value[0] || null;
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
registerOnChange(fn) {
|
|
1395
|
-
this.propagateChange = fn;
|
|
1396
|
-
}
|
|
1397
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1398
|
-
registerOnTouched(fn) { }
|
|
1399
|
-
setDisabledState(isDisabled) {
|
|
1400
|
-
if (isDisabled) {
|
|
1401
|
-
this.acFormControl.disable();
|
|
1402
|
-
}
|
|
1403
|
-
else {
|
|
1404
|
-
this.acFormControl.enable();
|
|
1405
|
-
}
|
|
1406
|
-
this.disabled = isDisabled;
|
|
1407
|
-
}
|
|
1408
|
-
propagate() {
|
|
1409
|
-
this.value = this.#getPropagateValue();
|
|
1410
|
-
this.propagateChange(this.value);
|
|
1411
|
-
}
|
|
1412
|
-
#getPropagateValue() {
|
|
1413
|
-
if (this.multiselect()) {
|
|
1414
|
-
return this.innerValue.map((v) => JSON.stringify(v));
|
|
1415
|
-
}
|
|
1416
|
-
else if (this.innerValue.length) {
|
|
1417
|
-
return JSON.stringify(this.innerValue[0]);
|
|
1700
|
+
try {
|
|
1701
|
+
if (Array.isArray(value)) {
|
|
1702
|
+
return value.map((v) => JSON.parse(v));
|
|
1703
|
+
}
|
|
1704
|
+
else {
|
|
1705
|
+
return JSON.parse(value);
|
|
1706
|
+
}
|
|
1418
1707
|
}
|
|
1419
|
-
|
|
1708
|
+
catch (e) {
|
|
1420
1709
|
return undefined;
|
|
1710
|
+
}
|
|
1421
1711
|
}
|
|
1422
1712
|
autocompleteFn(query) {
|
|
1423
|
-
if (query.length >= this.
|
|
1424
|
-
this
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
}));
|
|
1713
|
+
if (query.length >= this.minLength) {
|
|
1714
|
+
this.busy.set(true);
|
|
1715
|
+
(this.#organizationType() === Classification.STRING_ORGANIZATION
|
|
1716
|
+
? this.#resolveOrganization(query, this.excludeMe(), this.#filterRoles())
|
|
1717
|
+
: this.#resolveOrganizationSet(query, this.#filterRoles())).subscribe({
|
|
1718
|
+
next: (res) => {
|
|
1719
|
+
this.busy.set(false);
|
|
1720
|
+
this.autocompleteRes = res;
|
|
1432
1721
|
},
|
|
1433
|
-
error: (
|
|
1434
|
-
this.autocompleteRes = [];
|
|
1435
|
-
}
|
|
1722
|
+
error: () => this.busy.set(false)
|
|
1436
1723
|
});
|
|
1437
1724
|
}
|
|
1438
1725
|
else {
|
|
@@ -1448,7 +1735,7 @@ class OrganizationSetComponent extends AbstractMatFormField {
|
|
|
1448
1735
|
this.ngControl.control.setErrors(this.acFormControl.errors);
|
|
1449
1736
|
}
|
|
1450
1737
|
});
|
|
1451
|
-
this.acFormControl.updateValueAndValidity();
|
|
1738
|
+
this.acFormControl.updateValueAndValidity({ emitEvent: false });
|
|
1452
1739
|
this.acFormControl.valueChanges.subscribe((v) => {
|
|
1453
1740
|
if (!Array.isArray(v))
|
|
1454
1741
|
v = v ? [v] : [];
|
|
@@ -1459,13 +1746,21 @@ class OrganizationSetComponent extends AbstractMatFormField {
|
|
|
1459
1746
|
ngOnDestroy() {
|
|
1460
1747
|
super.onNgOnDestroy();
|
|
1461
1748
|
}
|
|
1462
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type:
|
|
1463
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1749
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OrganizationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1750
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: OrganizationComponent, isStandalone: true, selector: "yuv-organization", inputs: { situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null }, multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, excludeMe: { classPropertyName: "excludeMe", publicName: "excludeMe", isSignal: true, isRequired: false, transformFunction: null }, withMetadata: { classPropertyName: "withMetadata", publicName: "withMetadata", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: OrganizationComponent }], usesInheritance: true, ngImport: i0, template: "<yuv-autocomplete\n [required]=\"required\"\n [busy]=\"busy()\"\n [formControl]=\"acFormControl\"\n #autocomplete\n [placeholder]=\"placeholder\"\n [disabled]=\"readonly()\"\n [autocompleteValues]=\"autocompleteRes\"\n [forceSelection]=\"true\"\n [distinctValues]=\"true\"\n (autocompleteFnc)=\"autocompleteFn($event)\"\n [multiple]=\"true\"\n [maxItems]=\"multiselect() ? -1 : 1\"\n>\n <!-- template for item inside the dropdown -->\n <ng-template #optionTemplate let-item>\n @if (item.value) {\n <span class=\"chip\">{{ item.value.title }}</span>\n }\n </ng-template>\n\n <!-- template for chip -->\n <ng-template #chipTemplate let-item>\n @if (item.value) {\n <span class=\"chip\" [ngClass]=\"{ notFound: item.value.notFound }\" [matTooltip]=\"item.value.titleString\">\n {{ item.value.title || '...' }}\n </span>\n }\n </ng-template>\n</yuv-autocomplete>\n\n<mat-icon class=\"ymt-icon--size-s\" [matTooltip]=\"'yuv.form.element.organization.classify.icon.title' | translate\">\n {{ multiselect() ? 'group' : 'person' }}\n</mat-icon>\n", styles: [":host{display:flex;align-items:center}:host .chip.notFound{color:var(--ymt-on-danger-container);text-decoration:line-through}:host .chip.notFound:before{content:\"!\";display:inline-block;background-color:var(--ymt-danger-container);color:#fff;border-radius:2px;padding-inline:.3em;text-decoration:none;margin-inline-end:.75em}:host yuv-autocomplete{flex:1}:host mat-icon{color:var(--ymt-text-color-subtle)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: YuvAutocompleteModule }, { kind: "component", type: i2$2.AutocompleteComponent, selector: "yuv-autocomplete", inputs: ["ariaLabel", "busy", "multiple", "distinctValues", "addOnBlur", "minLength", "maxItems", "forceSelection", "autocompleteValues"], outputs: ["autocompleteFnc", "acBlur"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
1464
1751
|
}
|
|
1465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type:
|
|
1752
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OrganizationComponent, decorators: [{
|
|
1466
1753
|
type: Component,
|
|
1467
|
-
args: [{ selector: 'yuv-organization
|
|
1468
|
-
|
|
1754
|
+
args: [{ selector: 'yuv-organization', standalone: true, imports: [
|
|
1755
|
+
CommonModule,
|
|
1756
|
+
FormsModule,
|
|
1757
|
+
YuvAutocompleteModule,
|
|
1758
|
+
MatTooltipModule,
|
|
1759
|
+
MatIconModule,
|
|
1760
|
+
ReactiveFormsModule,
|
|
1761
|
+
TranslatePipe
|
|
1762
|
+
], providers: [{ provide: MatFormFieldControl, useExisting: OrganizationComponent }], template: "<yuv-autocomplete\n [required]=\"required\"\n [busy]=\"busy()\"\n [formControl]=\"acFormControl\"\n #autocomplete\n [placeholder]=\"placeholder\"\n [disabled]=\"readonly()\"\n [autocompleteValues]=\"autocompleteRes\"\n [forceSelection]=\"true\"\n [distinctValues]=\"true\"\n (autocompleteFnc)=\"autocompleteFn($event)\"\n [multiple]=\"true\"\n [maxItems]=\"multiselect() ? -1 : 1\"\n>\n <!-- template for item inside the dropdown -->\n <ng-template #optionTemplate let-item>\n @if (item.value) {\n <span class=\"chip\">{{ item.value.title }}</span>\n }\n </ng-template>\n\n <!-- template for chip -->\n <ng-template #chipTemplate let-item>\n @if (item.value) {\n <span class=\"chip\" [ngClass]=\"{ notFound: item.value.notFound }\" [matTooltip]=\"item.value.titleString\">\n {{ item.value.title || '...' }}\n </span>\n }\n </ng-template>\n</yuv-autocomplete>\n\n<mat-icon class=\"ymt-icon--size-s\" [matTooltip]=\"'yuv.form.element.organization.classify.icon.title' | translate\">\n {{ multiselect() ? 'group' : 'person' }}\n</mat-icon>\n", styles: [":host{display:flex;align-items:center}:host .chip.notFound{color:var(--ymt-on-danger-container);text-decoration:line-through}:host .chip.notFound:before{content:\"!\";display:inline-block;background-color:var(--ymt-danger-container);color:#fff;border-radius:2px;padding-inline:.3em;text-decoration:none;margin-inline-end:.75em}:host yuv-autocomplete{flex:1}:host mat-icon{color:var(--ymt-text-color-subtle)}\n"] }]
|
|
1763
|
+
}], propDecorators: { situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }], multiselect: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiselect", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], excludeMe: [{ type: i0.Input, args: [{ isSignal: true, alias: "excludeMe", required: false }] }], withMetadata: [{ type: i0.Input, args: [{ isSignal: true, alias: "withMetadata", required: false }] }] } });
|
|
1469
1764
|
|
|
1470
1765
|
class DateRangePickerComponent {
|
|
1471
1766
|
constructor() {
|
|
@@ -1495,7 +1790,7 @@ class DateRangePickerComponent {
|
|
|
1495
1790
|
this.#dialogRef.close(this.form.value.range);
|
|
1496
1791
|
}
|
|
1497
1792
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1498
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: DateRangePickerComponent, isStandalone: true, selector: "yuv-date-range-picker", inputs: { range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChange: "rangeChange" }, ngImport: i0, template: "<yuv-dialog [headertitel]=\"'yuv.form.element.range-select-date.custom.overlay.title' | translate\">\n <main>\n <form id=\"date-range-picker-form\" [formGroup]=\"form\" (ngSubmit)=\"apply()\">\n <yuv-datetime-range [withTime]=\"false\" formControlName=\"range\"></yuv-datetime-range>\n </form>\n </main>\n <footer>\n <button form=\"date-range-picker-form\" ymtButton=\"primary\" [disabled]=\"form.invalid\">\n {{ 'yuv.form.element.range-select-date.custom.overlay.button.apply' | translate }}\n </button>\n </footer>\n</yuv-dialog>\n", styles: [":host form{display:grid;grid-template-columns:1fr auto;grid-template-rows:repeat(3,auto);grid-template-areas:\"title title\" \"input input\" \". button\";gap:var(--ymt-spacing-m);padding:var(--ymt-spacing-m)}:host form h2{grid-area:title;margin:0}:host form yuv-datetime-range{grid-area:input;border:1px solid var(--ymt-text-color-subtle);padding:1px 2px;border-radius:2px}:host form button{grid-area:button}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: DatetimeRangeComponent, selector: "yuv-datetime-range", inputs: ["withTime", "readonly", "operator", "situation"] }, { kind: "directive", type: YmtButtonDirective, selector: "button[ymtButton], a[ymtButton]", inputs: ["ymtButton", "disabled", "aria-disabled", "disableRipple", "disabledInteractive", "button-size"] }, { kind: "component", type: DialogComponent, selector: "yuv-dialog", inputs: ["headertitle", "headertitel"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
1793
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: DateRangePickerComponent, isStandalone: true, selector: "yuv-date-range-picker", inputs: { range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rangeChange: "rangeChange" }, ngImport: i0, template: "<yuv-dialog [headertitel]=\"'yuv.form.element.range-select-date.custom.overlay.title' | translate\">\n <main>\n <form id=\"date-range-picker-form\" [formGroup]=\"form\" (ngSubmit)=\"apply()\">\n <yuv-datetime-range [withTime]=\"false\" formControlName=\"range\"></yuv-datetime-range>\n </form>\n </main>\n <footer>\n <button form=\"date-range-picker-form\" ymtButton=\"primary\" [disabled]=\"form.invalid\">\n {{ 'yuv.form.element.range-select-date.custom.overlay.button.apply' | translate }}\n </button>\n </footer>\n</yuv-dialog>\n", styles: [":host form{display:grid;grid-template-columns:1fr auto;grid-template-rows:repeat(3,auto);grid-template-areas:\"title title\" \"input input\" \". button\";gap:var(--ymt-spacing-m);padding:var(--ymt-spacing-m)}:host form h2{grid-area:title;margin:0}:host form yuv-datetime-range{grid-area:input;border:1px solid var(--ymt-text-color-subtle);padding:1px 2px;border-radius:2px}:host form button{grid-area:button}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: DatetimeRangeComponent, selector: "yuv-datetime-range", inputs: ["withTime", "readonly", "operator", "situation"] }, { kind: "directive", type: YmtButtonDirective, selector: "button[ymtButton], a[ymtButton]", inputs: ["ymtButton", "disabled", "aria-disabled", "disableRipple", "disabledInteractive", "button-size"] }, { kind: "component", type: DialogComponent, selector: "yuv-dialog", inputs: ["headertitle", "headertitel"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
1499
1794
|
}
|
|
1500
1795
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DateRangePickerComponent, decorators: [{
|
|
1501
1796
|
type: Component,
|
|
@@ -1666,7 +1961,7 @@ class RangeSelectDateComponent extends AbstractMatFormField {
|
|
|
1666
1961
|
super.onNgOnDestroy();
|
|
1667
1962
|
}
|
|
1668
1963
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RangeSelectDateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1669
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: RangeSelectDateComponent, isStandalone: true, selector: "yuv-range-select-date", inputs: { ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, customRange: { classPropertyName: "customRange", publicName: "customRange", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: RangeSelectDateComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [formControl]=\"fc\" [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\">\n @for (o of options(); track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n", styles: [":host{display:flex}:host mat-select{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1
|
|
1964
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: RangeSelectDateComponent, isStandalone: true, selector: "yuv-range-select-date", inputs: { ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, customRange: { classPropertyName: "customRange", publicName: "customRange", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: RangeSelectDateComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [formControl]=\"fc\" [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\">\n @for (o of options(); track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n", styles: [":host{display:flex}:host mat-select{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
1670
1965
|
}
|
|
1671
1966
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RangeSelectDateComponent, decorators: [{
|
|
1672
1967
|
type: Component,
|
|
@@ -1749,7 +2044,7 @@ class RangeSelectFilesizeComponent extends AbstractMatFormField {
|
|
|
1749
2044
|
super.onNgOnDestroy();
|
|
1750
2045
|
}
|
|
1751
2046
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RangeSelectFilesizeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1752
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: RangeSelectFilesizeComponent, isStandalone: true, selector: "yuv-range-select-filesize", inputs: { ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: RangeSelectFilesizeComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\" [formControl]=\"fc\">\n @for (o of options(); track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n", styles: [":host{display:flex}:host mat-select{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1
|
|
2047
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: RangeSelectFilesizeComponent, isStandalone: true, selector: "yuv-range-select-filesize", inputs: { ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: RangeSelectFilesizeComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [panelWidth]=\"null\" [hideSingleSelectionIndicator]=\"true\" [formControl]=\"fc\">\n @for (o of options(); track $index) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n", styles: [":host{display:flex}:host mat-select{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
1753
2048
|
}
|
|
1754
2049
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RangeSelectFilesizeComponent, decorators: [{
|
|
1755
2050
|
type: Component,
|
|
@@ -2032,7 +2327,7 @@ class StringComponent extends AbstractMatFormField {
|
|
|
2032
2327
|
super.onNgOnDestroy();
|
|
2033
2328
|
}
|
|
2034
2329
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: StringComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2035
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: StringComponent, isStandalone: true, selector: "yuv-string", inputs: { multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: false, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: false, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null }, regex: { classPropertyName: "regex", publicName: "regex", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.readonly": "readonly()" } }, providers: [{ provide: MatFormFieldControl, useExisting: StringComponent }], usesInheritance: true, ngImport: i0, template: "@if ((!rows || rows <= 1) && !multiselect()) {\n <input matInput type=\"text\" (blur)=\"onBlur()\" [readonly]=\"readonly()\" [formControl]=\"fc\" />\n} @else if ((!rows || rows <= 1) && multiselect()) {\n <!-- single line input with multiselect-->\n <yuv-scroll-buttons>\n <mat-chip-grid #chipGrid [formControl]=\"fc\">\n @for (v of value; track v) {\n <mat-chip-row (removed)=\"chipsRemove(v)\" [editable]=\"true\" (edited)=\"chipsEdit(v, $event)\">\n {{ v }}\n <button matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n }\n <input\n [matChipInputFor]=\"chipGrid\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"chipsAdd($event)\"\n />\n </mat-chip-grid>\n </yuv-scroll-buttons>\n} @else if (rows && rows > 1) {\n <!-- multi line text inputs -->\n <textarea matInput class=\"input-textarea\" (blur)=\"onBlur()\" [rows]=\"rows\" [readonly]=\"readonly()\" [formControl]=\"fc\"></textarea>\n}\n\n@if (classify) {\n <div class=\"classify\">\n @if (value && !validationErrors.length && (classify.hrefPrefix !== '' || !multiselect() || value.length <= 1)) {\n <a href=\"{{ classify.hrefPrefix + formatedValue }}\">\n <mat-icon>{{ classify.icon }}</mat-icon>\n </a>\n } @else {\n <mat-icon>{{ classify.icon }}</mat-icon>\n }\n </div>\n}\n", styles: [":host{display:flex;flex-flow:row nowrap;flex:1;align-items:center}:host:has(mat-chip-grid){min-width:0}:host mat-chip-grid{flex:1}:host textarea.input-textarea{width:100%;resize:none;background-color:transparent;border:0;outline:0}:host input{display:flex;flex-wrap:wrap;align-items:center;width:100%;border:0;outline:0;background:transparent}:host.readonly .classify{pointer-events:all}:host .classify a{color:var(--ymt-text-color-subtle);text-decoration:none}\n"], dependencies: [{ kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i1$4.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i1$4.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i1$4.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i1$4.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: ScrollButtonsComponent, selector: "yuv-scroll-buttons", inputs: ["scrollAmount"] }] }); }
|
|
2330
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: StringComponent, isStandalone: true, selector: "yuv-string", inputs: { multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: false, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: false, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null }, regex: { classPropertyName: "regex", publicName: "regex", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.readonly": "readonly()" } }, providers: [{ provide: MatFormFieldControl, useExisting: StringComponent }], usesInheritance: true, ngImport: i0, template: "@if ((!rows || rows <= 1) && !multiselect()) {\n <input matInput type=\"text\" (blur)=\"onBlur()\" [readonly]=\"readonly()\" [formControl]=\"fc\" />\n} @else if ((!rows || rows <= 1) && multiselect()) {\n <!-- single line input with multiselect-->\n <yuv-scroll-buttons>\n <mat-chip-grid #chipGrid [formControl]=\"fc\">\n @for (v of value; track v) {\n <mat-chip-row (removed)=\"chipsRemove(v)\" [editable]=\"true\" (edited)=\"chipsEdit(v, $event)\">\n {{ v }}\n <button matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n }\n <input\n [matChipInputFor]=\"chipGrid\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"chipsAdd($event)\"\n />\n </mat-chip-grid>\n </yuv-scroll-buttons>\n} @else if (rows && rows > 1) {\n <!-- multi line text inputs -->\n <textarea matInput class=\"input-textarea\" (blur)=\"onBlur()\" [rows]=\"rows\" [readonly]=\"readonly()\" [formControl]=\"fc\"></textarea>\n}\n\n@if (classify) {\n <div class=\"classify\">\n @if (value && !validationErrors.length && (classify.hrefPrefix !== '' || !multiselect() || value.length <= 1)) {\n <a href=\"{{ classify.hrefPrefix + formatedValue }}\">\n <mat-icon>{{ classify.icon }}</mat-icon>\n </a>\n } @else {\n <mat-icon>{{ classify.icon }}</mat-icon>\n }\n </div>\n}\n", styles: [":host{display:flex;flex-flow:row nowrap;flex:1;align-items:center}:host:has(mat-chip-grid){min-width:0}:host mat-chip-grid{flex:1}:host textarea.input-textarea{width:100%;resize:none;background-color:transparent;border:0;outline:0}:host input{display:flex;flex-wrap:wrap;align-items:center;width:100%;border:0;outline:0;background:transparent}:host.readonly .classify{pointer-events:all}:host .classify a{color:var(--ymt-text-color-subtle);text-decoration:none}\n"], dependencies: [{ kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i1$4.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i1$4.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i1$4.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i1$4.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.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: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: ScrollButtonsComponent, selector: "yuv-scroll-buttons", inputs: ["scrollAmount"] }] }); }
|
|
2036
2331
|
}
|
|
2037
2332
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: StringComponent, decorators: [{
|
|
2038
2333
|
type: Component,
|
|
@@ -2045,215 +2340,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
2045
2340
|
type: Input
|
|
2046
2341
|
}], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }], regex: [{ type: i0.Input, args: [{ isSignal: true, alias: "regex", required: false }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }] } });
|
|
2047
2342
|
|
|
2048
|
-
class CatalogComponent extends AbstractMatFormField {
|
|
2049
|
-
constructor() {
|
|
2050
|
-
super(...arguments);
|
|
2051
|
-
this.#system = inject(SystemService);
|
|
2052
|
-
this.#dRef = inject(DestroyRef);
|
|
2053
|
-
this.translate = inject(TranslateService);
|
|
2054
|
-
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2055
|
-
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
2056
|
-
this._options = signal([], ...(ngDevMode ? [{ debugName: "_options" }] : /* istanbul ignore next */ []));
|
|
2057
|
-
this.options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
2058
|
-
this.#optionsEffect = effect(() => {
|
|
2059
|
-
untracked(() => {
|
|
2060
|
-
this.#setOptions(this.options() || [], false);
|
|
2061
|
-
});
|
|
2062
|
-
}, ...(ngDevMode ? [{ debugName: "#optionsEffect" }] : /* istanbul ignore next */ []));
|
|
2063
|
-
/**
|
|
2064
|
-
* Additional semantics for the form element.
|
|
2065
|
-
*/
|
|
2066
|
-
this.classifications = input([], ...(ngDevMode ? [{ debugName: "classifications" }] : /* istanbul ignore next */ []));
|
|
2067
|
-
this.#classificationEffect = effect(() => {
|
|
2068
|
-
const cls = this.classifications();
|
|
2069
|
-
untracked(() => {
|
|
2070
|
-
const ce = this.#system.getClassifications(cls).get(Classification.STRING_CATALOG);
|
|
2071
|
-
if (ce && ce.options) {
|
|
2072
|
-
this.#setOptions(ce.options, false);
|
|
2073
|
-
}
|
|
2074
|
-
});
|
|
2075
|
-
}, ...(ngDevMode ? [{ debugName: "#classificationEffect" }] : /* istanbul ignore next */ []));
|
|
2076
|
-
/**
|
|
2077
|
-
* Possibles values are `EDIT` (default),`SEARCH`,`CREATE`. In search situation validation of the form element will be turned off, so you are able to enter search terms that do not meet the elements validators.
|
|
2078
|
-
*/
|
|
2079
|
-
this.situation = input(...(ngDevMode ? [undefined, { debugName: "situation" }] : /* istanbul ignore next */ []));
|
|
2080
|
-
this.ngControl = injectNgControl(this);
|
|
2081
|
-
this.fc = new FormControl(undefined);
|
|
2082
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2083
|
-
this.propagateChange = (_) => { };
|
|
2084
|
-
}
|
|
2085
|
-
#system;
|
|
2086
|
-
#dRef;
|
|
2087
|
-
#optionsEffect;
|
|
2088
|
-
#classificationEffect;
|
|
2089
|
-
#onValueChange(val) {
|
|
2090
|
-
this.value = val;
|
|
2091
|
-
this.propagateChange(this.value);
|
|
2092
|
-
}
|
|
2093
|
-
#setOptions(options, translate) {
|
|
2094
|
-
if (translate) {
|
|
2095
|
-
this._options.set(options.map((o) => ({
|
|
2096
|
-
label: this.translate.instant(o),
|
|
2097
|
-
value: o
|
|
2098
|
-
})));
|
|
2099
|
-
}
|
|
2100
|
-
else {
|
|
2101
|
-
this._options.set(options.map((o) => ({
|
|
2102
|
-
label: o,
|
|
2103
|
-
value: o
|
|
2104
|
-
})));
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
writeValue(value) {
|
|
2108
|
-
this.value = value;
|
|
2109
|
-
this.fc.setValue(value, { emitEvent: false });
|
|
2110
|
-
}
|
|
2111
|
-
registerOnChange(fn) {
|
|
2112
|
-
this.propagateChange = fn;
|
|
2113
|
-
}
|
|
2114
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2115
|
-
registerOnTouched(fn) { }
|
|
2116
|
-
setDisabledState(isDisabled) {
|
|
2117
|
-
if (isDisabled) {
|
|
2118
|
-
this.fc.disable();
|
|
2119
|
-
}
|
|
2120
|
-
else {
|
|
2121
|
-
this.fc.enable();
|
|
2122
|
-
}
|
|
2123
|
-
this.disabled = isDisabled;
|
|
2124
|
-
}
|
|
2125
|
-
ngOnInit() {
|
|
2126
|
-
if (this.required)
|
|
2127
|
-
this.fc.setValidators(Validators.required);
|
|
2128
|
-
this.fc.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
2129
|
-
this.errorState = FormUtils.getErrorState(this.fc);
|
|
2130
|
-
if (this.ngControl?.control) {
|
|
2131
|
-
this.ngControl.control.setErrors(this.fc.errors);
|
|
2132
|
-
}
|
|
2133
|
-
});
|
|
2134
|
-
this.fc.updateValueAndValidity();
|
|
2135
|
-
this.fc.valueChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => this.#onValueChange(v));
|
|
2136
|
-
}
|
|
2137
|
-
ngOnDestroy() {
|
|
2138
|
-
super.onNgOnDestroy();
|
|
2139
|
-
}
|
|
2140
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CatalogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2141
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CatalogComponent, isStandalone: true, selector: "yuv-catalog", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: CatalogComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1$2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
2142
|
-
}
|
|
2143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CatalogComponent, decorators: [{
|
|
2144
|
-
type: Component,
|
|
2145
|
-
args: [{ selector: 'yuv-catalog', imports: [MatSelectModule, ReactiveFormsModule], providers: [{ provide: MatFormFieldControl, useExisting: CatalogComponent }], template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>\n" }]
|
|
2146
|
-
}], propDecorators: { readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }] } });
|
|
2147
|
-
|
|
2148
|
-
/**
|
|
2149
|
-
* Form element for selecting one or multiple i18n catalog values.
|
|
2150
|
-
* Having a classification of `i18n:catalog[one, two, three]` configured on the metadata field
|
|
2151
|
-
* will automatically populate the options from the catalog. The options will be translated
|
|
2152
|
-
* using the catalogs static values adding a prefix, the property name an the value itself.
|
|
2153
|
-
* E.g. for property name `status` and option value `open` the label key will be `catalog:status:open_label`.
|
|
2154
|
-
*/
|
|
2155
|
-
class I18nCatalogComponent extends AbstractMatFormField {
|
|
2156
|
-
#system;
|
|
2157
|
-
#dRef;
|
|
2158
|
-
#optionsEffect;
|
|
2159
|
-
#classificationEffect;
|
|
2160
|
-
constructor() {
|
|
2161
|
-
super();
|
|
2162
|
-
this.#system = inject(SystemService);
|
|
2163
|
-
this.#dRef = inject(DestroyRef);
|
|
2164
|
-
this.translate = inject(TranslateService);
|
|
2165
|
-
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2166
|
-
this.multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
2167
|
-
this.propertyName = input(undefined, ...(ngDevMode ? [{ debugName: "propertyName" }] : /* istanbul ignore next */ []));
|
|
2168
|
-
this._options = signal([], ...(ngDevMode ? [{ debugName: "_options" }] : /* istanbul ignore next */ []));
|
|
2169
|
-
this.options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
2170
|
-
this.#optionsEffect = effect(() => {
|
|
2171
|
-
untracked(() => {
|
|
2172
|
-
this.#setOptions(this.options());
|
|
2173
|
-
});
|
|
2174
|
-
}, ...(ngDevMode ? [{ debugName: "#optionsEffect" }] : /* istanbul ignore next */ []));
|
|
2175
|
-
/**
|
|
2176
|
-
* Additional semantics for the form element.
|
|
2177
|
-
*/
|
|
2178
|
-
this.classifications = input([], ...(ngDevMode ? [{ debugName: "classifications" }] : /* istanbul ignore next */ []));
|
|
2179
|
-
this.#classificationEffect = effect(() => {
|
|
2180
|
-
const cls = this.classifications();
|
|
2181
|
-
untracked(() => {
|
|
2182
|
-
const ce = this.#system.getClassifications(cls).get(Classification.STRING_CATALOG_I18N);
|
|
2183
|
-
if (ce && ce.options) {
|
|
2184
|
-
this.#setOptions(ce.options);
|
|
2185
|
-
}
|
|
2186
|
-
});
|
|
2187
|
-
}, ...(ngDevMode ? [{ debugName: "#classificationEffect" }] : /* istanbul ignore next */ []));
|
|
2188
|
-
/**
|
|
2189
|
-
* Possibles values are `EDIT` (default),`SEARCH`,`CREATE`. In search situation validation of the form element will be turned off, so you are able to enter search terms that do not meet the elements validators.
|
|
2190
|
-
*/
|
|
2191
|
-
this.situation = input(...(ngDevMode ? [undefined, { debugName: "situation" }] : /* istanbul ignore next */ []));
|
|
2192
|
-
this.ngControl = injectNgControl(this);
|
|
2193
|
-
this.fc = new FormControl(undefined);
|
|
2194
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2195
|
-
this.propagateChange = (_) => { };
|
|
2196
|
-
this.translate.onLangChange.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
2197
|
-
// re-apply options to trigger translation
|
|
2198
|
-
this.#setOptions(this.options());
|
|
2199
|
-
});
|
|
2200
|
-
}
|
|
2201
|
-
#onValueChange(val) {
|
|
2202
|
-
this.value = val;
|
|
2203
|
-
this.propagateChange(this.value);
|
|
2204
|
-
}
|
|
2205
|
-
#setOptions(options) {
|
|
2206
|
-
this._options.set(options.map((o) => ({
|
|
2207
|
-
label: this.#translateOption(o),
|
|
2208
|
-
value: o
|
|
2209
|
-
})));
|
|
2210
|
-
}
|
|
2211
|
-
#translateOption(option) {
|
|
2212
|
-
// labelkey: 'catalog:status:open_label' for option 'open'
|
|
2213
|
-
// This will be derived fom a prefix the property name if available and this option itself
|
|
2214
|
-
return this.#system.getLocalizedLabel(`catalog:${this.propertyName() || ''}:${option}`) || option;
|
|
2215
|
-
}
|
|
2216
|
-
writeValue(value) {
|
|
2217
|
-
this.value = value;
|
|
2218
|
-
this.fc.setValue(value, { emitEvent: false });
|
|
2219
|
-
}
|
|
2220
|
-
registerOnChange(fn) {
|
|
2221
|
-
this.propagateChange = fn;
|
|
2222
|
-
}
|
|
2223
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2224
|
-
registerOnTouched(fn) { }
|
|
2225
|
-
setDisabledState(isDisabled) {
|
|
2226
|
-
if (isDisabled) {
|
|
2227
|
-
this.fc.disable();
|
|
2228
|
-
}
|
|
2229
|
-
else {
|
|
2230
|
-
this.fc.enable();
|
|
2231
|
-
}
|
|
2232
|
-
this.disabled = isDisabled;
|
|
2233
|
-
}
|
|
2234
|
-
ngOnInit() {
|
|
2235
|
-
if (this.required)
|
|
2236
|
-
this.fc.setValidators(Validators.required);
|
|
2237
|
-
this.fc.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => {
|
|
2238
|
-
this.errorState = FormUtils.getErrorState(this.fc);
|
|
2239
|
-
if (this.ngControl?.control) {
|
|
2240
|
-
this.ngControl.control.setErrors(this.fc.errors);
|
|
2241
|
-
}
|
|
2242
|
-
});
|
|
2243
|
-
this.fc.updateValueAndValidity();
|
|
2244
|
-
this.fc.valueChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((v) => this.#onValueChange(v));
|
|
2245
|
-
}
|
|
2246
|
-
ngOnDestroy() {
|
|
2247
|
-
super.onNgOnDestroy();
|
|
2248
|
-
}
|
|
2249
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: I18nCatalogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2250
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: I18nCatalogComponent, isStandalone: true, selector: "yuv-i18n-catalog", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, propertyName: { classPropertyName: "propertyName", publicName: "propertyName", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, classifications: { classPropertyName: "classifications", publicName: "classifications", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: MatFormFieldControl, useExisting: I18nCatalogComponent }], usesInheritance: true, ngImport: i0, template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>", styles: [""], dependencies: [{ kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i1$2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i1$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
2251
|
-
}
|
|
2252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: I18nCatalogComponent, decorators: [{
|
|
2253
|
-
type: Component,
|
|
2254
|
-
args: [{ selector: 'yuv-i18n-catalog', imports: [MatSelectModule, ReactiveFormsModule], providers: [{ provide: MatFormFieldControl, useExisting: I18nCatalogComponent }], template: "<mat-select [multiple]=\"multiple()\" [disabled]=\"readonly()\" [formControl]=\"fc\">\n @for (o of _options(); track o) {\n <mat-option [value]=\"o.value\">{{ o.label }}</mat-option>\n }\n</mat-select>" }]
|
|
2255
|
-
}], ctorParameters: () => [], propDecorators: { readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], propertyName: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyName", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], classifications: [{ type: i0.Input, args: [{ isSignal: true, alias: "classifications", required: false }] }], situation: [{ type: i0.Input, args: [{ isSignal: true, alias: "situation", required: false }] }] } });
|
|
2256
|
-
|
|
2257
2343
|
const formElementCmps = [
|
|
2258
2344
|
StringComponent,
|
|
2259
2345
|
NumberComponent,
|
|
@@ -2263,6 +2349,7 @@ const formElementCmps = [
|
|
|
2263
2349
|
OrganizationComponent,
|
|
2264
2350
|
StringComponent,
|
|
2265
2351
|
CatalogComponent,
|
|
2352
|
+
DynamicCatalogComponent,
|
|
2266
2353
|
I18nCatalogComponent
|
|
2267
2354
|
];
|
|
2268
2355
|
/**
|
|
@@ -2278,6 +2365,7 @@ class YuvFormsModule {
|
|
|
2278
2365
|
OrganizationComponent,
|
|
2279
2366
|
StringComponent,
|
|
2280
2367
|
CatalogComponent,
|
|
2368
|
+
DynamicCatalogComponent,
|
|
2281
2369
|
I18nCatalogComponent], exports: [StringComponent,
|
|
2282
2370
|
NumberComponent,
|
|
2283
2371
|
NumberRangeComponent,
|
|
@@ -2286,6 +2374,7 @@ class YuvFormsModule {
|
|
|
2286
2374
|
OrganizationComponent,
|
|
2287
2375
|
StringComponent,
|
|
2288
2376
|
CatalogComponent,
|
|
2377
|
+
DynamicCatalogComponent,
|
|
2289
2378
|
I18nCatalogComponent] }); }
|
|
2290
2379
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: YuvFormsModule, imports: [formElementCmps] }); }
|
|
2291
2380
|
}
|
|
@@ -2301,5 +2390,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
2301
2390
|
* Generated bundle index. Do not edit.
|
|
2302
2391
|
*/
|
|
2303
2392
|
|
|
2304
|
-
export { CatalogComponent, DataGridComponent, DatetimeComponent, DatetimeRangeComponent, FormUtils, I18nCatalogComponent, NumberComponent, NumberRangeComponent, OrganizationComponent, OrganizationSetComponent, RangeSelectDateComponent, RangeSelectFilesizeComponent, StringComponent, YuvFormsModule };
|
|
2393
|
+
export { CatalogComponent, DataGridComponent, DatetimeComponent, DatetimeRangeComponent, DynamicCatalogComponent, FormUtils, I18nCatalogComponent, NumberComponent, NumberRangeComponent, OrganizationComponent, OrganizationSetComponent, RangeSelectDateComponent, RangeSelectFilesizeComponent, StringComponent, YuvFormsModule };
|
|
2305
2394
|
//# sourceMappingURL=yuuvis-client-framework-forms.mjs.map
|