@yuuvis/client-framework 2.5.0 → 2.5.1
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.
|
@@ -13,7 +13,7 @@ import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
|
|
|
13
13
|
import * as i4 from '@angular/material/table';
|
|
14
14
|
import { MatTableModule } from '@angular/material/table';
|
|
15
15
|
import * as i2 from '@yuuvis/client-core';
|
|
16
|
-
import { SystemService, Situation, TranslateModule, TranslateService, Operator, OperatorLabel, Utils, LocaleNumberPipe, FileSizePipe, Classification,
|
|
16
|
+
import { SystemService, Situation, TranslateModule, TranslateService, Operator, OperatorLabel, Utils, LocaleNumberPipe, FileSizePipe, Classification, IdmService, UserService, SearchUtils, LocaleDatePipe, ClassificationPrefix } from '@yuuvis/client-core';
|
|
17
17
|
import { YUV_ICONS } from '@yuuvis/client-framework/icons';
|
|
18
18
|
import { MetadataFormFieldComponent, ObjectMetadataElementLabelDirective } from '@yuuvis/client-framework/metadata-form';
|
|
19
19
|
import { RendererDirective } from '@yuuvis/client-framework/renderer';
|
|
@@ -1010,16 +1010,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
1010
1010
|
type: Input
|
|
1011
1011
|
}] } });
|
|
1012
1012
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1013
|
+
const mapOrganizationNode = (innerValue) => map$1((node) => node
|
|
1014
|
+
.filter((e) => !innerValue?.some((value) => value?.id === e.id))
|
|
1015
|
+
.map((e) => ({
|
|
1016
|
+
label: e.title,
|
|
1017
|
+
value: {
|
|
1018
|
+
id: e.id,
|
|
1019
|
+
title: e.title,
|
|
1020
|
+
type: 'user' in e ? 'user' : 'role'
|
|
1021
|
+
}
|
|
1022
|
+
})));
|
|
1021
1023
|
/**
|
|
1022
|
-
* Creates form input for
|
|
1024
|
+
* Creates form input for organization values.
|
|
1023
1025
|
*
|
|
1024
1026
|
* @example
|
|
1025
1027
|
* <yuv-organization [multiselect]="true"></yuv-organization>
|
|
@@ -1028,8 +1030,8 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1028
1030
|
constructor() {
|
|
1029
1031
|
super(...arguments);
|
|
1030
1032
|
this.#system = inject(SystemService);
|
|
1031
|
-
this.#userService = inject(UserService);
|
|
1032
1033
|
this.#idmService = inject(IdmService);
|
|
1034
|
+
this.#userService = inject(UserService);
|
|
1033
1035
|
this.#dRef = inject(DestroyRef);
|
|
1034
1036
|
this.translate = inject(TranslateService);
|
|
1035
1037
|
this.minLength = 2;
|
|
@@ -1049,25 +1051,31 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1049
1051
|
/**
|
|
1050
1052
|
* Additional semantics for the form element.
|
|
1051
1053
|
*/
|
|
1052
|
-
|
|
1054
|
+
// #organizationType: Classification = Classification.STRING_ORGANIZATION;
|
|
1055
|
+
this.#organizationType = computed(() => {
|
|
1056
|
+
const c = this.classifications();
|
|
1057
|
+
if (c?.length) {
|
|
1058
|
+
const classifications = this.#system.getClassifications(c);
|
|
1059
|
+
if (classifications.has(Classification.STRING_ORGANIZATION_SET)) {
|
|
1060
|
+
return Classification.STRING_ORGANIZATION_SET;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
return Classification.STRING_ORGANIZATION;
|
|
1064
|
+
});
|
|
1053
1065
|
this.classifications = input(undefined);
|
|
1054
1066
|
this.#filterRoles = computed(() => {
|
|
1067
|
+
const t = this.#organizationType();
|
|
1055
1068
|
const c = this.classifications();
|
|
1056
1069
|
if (c?.length) {
|
|
1057
1070
|
const classifications = this.#system.getClassifications(c);
|
|
1058
|
-
if (
|
|
1059
|
-
this.#organizationType = Classification.STRING_ORGANIZATION;
|
|
1071
|
+
if (t === Classification.STRING_ORGANIZATION) {
|
|
1060
1072
|
return classifications.get(Classification.STRING_ORGANIZATION).options;
|
|
1061
1073
|
}
|
|
1062
|
-
else if (
|
|
1063
|
-
this.#organizationType = Classification.STRING_ORGANIZATION_SET;
|
|
1074
|
+
else if (t === Classification.STRING_ORGANIZATION_SET) {
|
|
1064
1075
|
return classifications.get(Classification.STRING_ORGANIZATION_SET).options;
|
|
1065
1076
|
}
|
|
1066
|
-
return [];
|
|
1067
|
-
}
|
|
1068
|
-
else {
|
|
1069
|
-
return [];
|
|
1070
1077
|
}
|
|
1078
|
+
return [];
|
|
1071
1079
|
});
|
|
1072
1080
|
/**
|
|
1073
1081
|
* Will prevent the input from being changed (default: false)
|
|
@@ -1086,8 +1094,8 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1086
1094
|
this.propagateChange = (_) => { };
|
|
1087
1095
|
}
|
|
1088
1096
|
#system;
|
|
1089
|
-
#userService;
|
|
1090
1097
|
#idmService;
|
|
1098
|
+
#userService;
|
|
1091
1099
|
#dRef;
|
|
1092
1100
|
set innerValue(iv) {
|
|
1093
1101
|
this._innerValue = iv || [];
|
|
@@ -1098,13 +1106,14 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1098
1106
|
/**
|
|
1099
1107
|
* Additional semantics for the form element.
|
|
1100
1108
|
*/
|
|
1109
|
+
// #organizationType: Classification = Classification.STRING_ORGANIZATION;
|
|
1101
1110
|
#organizationType;
|
|
1102
1111
|
#filterRoles;
|
|
1103
1112
|
writeValue(value) {
|
|
1104
|
-
if (this.#organizationType === Classification.STRING_ORGANIZATION) {
|
|
1113
|
+
if (this.#organizationType() === Classification.STRING_ORGANIZATION) {
|
|
1105
1114
|
if (value) {
|
|
1106
1115
|
this.value = value;
|
|
1107
|
-
this.resolveFn(value);
|
|
1116
|
+
this.resolveFn(Array.isArray(value) ? value : [value]);
|
|
1108
1117
|
}
|
|
1109
1118
|
else {
|
|
1110
1119
|
this.value = null;
|
|
@@ -1112,12 +1121,8 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1112
1121
|
}
|
|
1113
1122
|
}
|
|
1114
1123
|
else {
|
|
1115
|
-
|
|
1116
|
-
this.
|
|
1117
|
-
this.value = val.map((v) => JSON.stringify(v));
|
|
1118
|
-
if (!this.multiselect) {
|
|
1119
|
-
this.value = this.value[0] || null;
|
|
1120
|
-
}
|
|
1124
|
+
this.value = value;
|
|
1125
|
+
this.resolveFn(Array.isArray(value) ? value : [value]);
|
|
1121
1126
|
}
|
|
1122
1127
|
}
|
|
1123
1128
|
registerOnChange(fn) {
|
|
@@ -1138,52 +1143,54 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1138
1143
|
}
|
|
1139
1144
|
}
|
|
1140
1145
|
#getPropagateValue() {
|
|
1141
|
-
const value = this.innerValue.map((v) => (this.withMetadata() ? { id: v.
|
|
1146
|
+
const value = this.innerValue.map((v) => (this.withMetadata() ? { id: v.id, title: v.title } : v.id));
|
|
1142
1147
|
return this.multiselect() ? value : value[0];
|
|
1143
1148
|
}
|
|
1144
1149
|
resolveFn(value) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1150
|
+
// check if entry is a user
|
|
1151
|
+
const userRegExp = new RegExp('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$');
|
|
1152
|
+
const tasks = value.map((v) => v.match(userRegExp)
|
|
1153
|
+
? this.#idmService.getUserById(v).pipe(map$1((res) => {
|
|
1154
|
+
return res
|
|
1155
|
+
? {
|
|
1156
|
+
id: res.id,
|
|
1157
|
+
title: res.title,
|
|
1158
|
+
type: 'user'
|
|
1159
|
+
}
|
|
1160
|
+
: {
|
|
1161
|
+
id: v,
|
|
1162
|
+
title: v,
|
|
1163
|
+
type: 'user',
|
|
1164
|
+
notFound: true
|
|
1165
|
+
};
|
|
1166
|
+
}))
|
|
1167
|
+
: of({
|
|
1168
|
+
id: v,
|
|
1169
|
+
title: v,
|
|
1170
|
+
type: 'role'
|
|
1171
|
+
}));
|
|
1172
|
+
forkJoin(tasks).subscribe((data) => {
|
|
1166
1173
|
this.innerValue = data;
|
|
1167
|
-
const mapped = this.innerValue.map((
|
|
1168
|
-
label:
|
|
1169
|
-
value:
|
|
1174
|
+
const mapped = this.innerValue.map((n) => ({
|
|
1175
|
+
label: n.title,
|
|
1176
|
+
value: n
|
|
1170
1177
|
}));
|
|
1171
1178
|
this.acFormControl.setValue(this.multiselect() ? mapped : [mapped[0]], { emitEvent: false });
|
|
1172
1179
|
this.acFormControl.updateValueAndValidity({ emitEvent: false });
|
|
1173
1180
|
});
|
|
1174
1181
|
}
|
|
1175
|
-
#
|
|
1176
|
-
return this.#userService.queryUser(query, excludeMe, filterRoles).pipe(
|
|
1182
|
+
#resolveOrganization(query, excludeMe, filterRoles) {
|
|
1183
|
+
return this.#userService.queryUser(query, excludeMe, filterRoles).pipe(mapOrganizationNode(this.innerValue), catchError(() => of([])));
|
|
1177
1184
|
}
|
|
1178
|
-
#
|
|
1179
|
-
return this.#idmService.queryOrganizationEntity(query, filterRoles).pipe(
|
|
1185
|
+
#resolveOrganizationSet(query, filterRoles) {
|
|
1186
|
+
return this.#idmService.queryOrganizationEntity(query, filterRoles).pipe(mapOrganizationNode(this.innerValue), catchError(() => of([])));
|
|
1180
1187
|
}
|
|
1181
1188
|
autocompleteFn(query) {
|
|
1182
1189
|
if (query.length >= this.minLength) {
|
|
1183
1190
|
this.busy.set(true);
|
|
1184
|
-
(this.#organizationType === Classification.STRING_ORGANIZATION
|
|
1185
|
-
? this.#
|
|
1186
|
-
: this.#
|
|
1191
|
+
(this.#organizationType() === Classification.STRING_ORGANIZATION
|
|
1192
|
+
? this.#resolveOrganization(query, this.excludeMe(), this.#filterRoles())
|
|
1193
|
+
: this.#resolveOrganizationSet(query, this.#filterRoles())).subscribe({
|
|
1187
1194
|
next: (res) => {
|
|
1188
1195
|
this.busy.set(false);
|
|
1189
1196
|
this.autocompleteRes = res;
|
|
@@ -1216,11 +1223,11 @@ class OrganizationComponent extends AbstractMatFormField {
|
|
|
1216
1223
|
super.onNgOnDestroy();
|
|
1217
1224
|
}
|
|
1218
1225
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: OrganizationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1219
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", 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
|
|
1226
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", 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$2.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$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.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: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
1220
1227
|
}
|
|
1221
1228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: OrganizationComponent, decorators: [{
|
|
1222
1229
|
type: Component,
|
|
1223
|
-
args: [{ selector: 'yuv-organization', standalone: true, imports: [CommonModule, FormsModule, YuvAutocompleteModule, MatTooltipModule, MatIconModule, ReactiveFormsModule, TranslateModule], 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
|
|
1230
|
+
args: [{ selector: 'yuv-organization', standalone: true, imports: [CommonModule, FormsModule, YuvAutocompleteModule, MatTooltipModule, MatIconModule, ReactiveFormsModule, TranslateModule], 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"] }]
|
|
1224
1231
|
}] });
|
|
1225
1232
|
|
|
1226
1233
|
/**
|