@masterteam/components 0.0.310 → 0.0.312
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/assets/common.css +1 -1
- package/assets/i18n/ar.json +2 -0
- package/assets/i18n/en.json +2 -0
- package/fesm2022/masterteam-components-business-fields.mjs +71 -17
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +66 -3
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-icon-field.mjs +2 -2
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +10 -0
- package/types/masterteam-components-entities.d.ts +14 -3
package/assets/i18n/ar.json
CHANGED
|
@@ -133,6 +133,8 @@
|
|
|
133
133
|
"noSelectedRecords": "لم يتم اختيار أي سجلات.",
|
|
134
134
|
"unavailableRecord": "السجل رقم {{id}} لم يعد متاحاً",
|
|
135
135
|
"searchRecords": "البحث باسم السجل",
|
|
136
|
+
"reviewSelection": "بعض السجلات المختارة لم تعد تحقق شرط هذه القائمة أو لم تعد متاحة. ألغِ تحديدها أو اختر غيرها، ثم احفظ مرة أخرى.",
|
|
137
|
+
"reviewSelectionTag": "غير متاح",
|
|
136
138
|
"noCandidates": "لم يتم العثور على سجلات.",
|
|
137
139
|
"loadMore": "تحميل المزيد",
|
|
138
140
|
"cancel": "إلغاء",
|
package/assets/i18n/en.json
CHANGED
|
@@ -133,6 +133,8 @@
|
|
|
133
133
|
"noSelectedRecords": "No records selected.",
|
|
134
134
|
"unavailableRecord": "Record #{{id}} is no longer available",
|
|
135
135
|
"searchRecords": "Search by record name",
|
|
136
|
+
"reviewSelection": "Some selected records no longer meet this list's condition or aren't available. Untick them, or pick others instead, then save again.",
|
|
137
|
+
"reviewSelectionTag": "Not available",
|
|
136
138
|
"noCandidates": "No records found.",
|
|
137
139
|
"loadMore": "Load more",
|
|
138
140
|
"cancel": "Cancel",
|
|
@@ -22,7 +22,7 @@ import { Skeleton } from 'primeng/skeleton';
|
|
|
22
22
|
import { Message } from 'primeng/message';
|
|
23
23
|
import { Tabs } from '@masterteam/components/tabs';
|
|
24
24
|
import { ModalService } from '@masterteam/components/modal';
|
|
25
|
-
import { sortLocalRows, visibleLocalSchemaFields, resolveLocalFieldViewType, resolveLocalFieldLabel, localCellsByFieldId, resolveLocalFieldConfiguration, isEntityListSelectionDocument, isEntityListLocalDocument, serializeEntityRawValue, resolveLocalizedLabel, readEntityValueColor, EntityRuntimeContextStore, ENTITY_LIST_TABLE_COMPONENT } from '@masterteam/components/entities';
|
|
25
|
+
import { sortLocalRows, mergeStakeholderNameRows, mergeStakeholderNameColumns, visibleLocalSchemaFields, resolveLocalFieldViewType, resolveLocalFieldLabel, localCellsByFieldId, resolveLocalFieldConfiguration, isEntityListSelectionDocument, isEntityListLocalDocument, serializeEntityRawValue, resolveLocalizedLabel, readEntityValueColor, EntityRuntimeContextStore, ENTITY_LIST_TABLE_COMPONENT } from '@masterteam/components/entities';
|
|
26
26
|
import { ModalRef } from '@masterteam/components/dialog';
|
|
27
27
|
import { TextField } from '@masterteam/components/text-field';
|
|
28
28
|
import * as i2$1 from 'primeng/inputtext';
|
|
@@ -1091,6 +1091,8 @@ class EntityListSelectionDialog {
|
|
|
1091
1091
|
multiple = input(true, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
1092
1092
|
/** The records the field holds now. */
|
|
1093
1093
|
selectedIds = input([], ...(ngDevMode ? [{ debugName: "selectedIds" }] : /* istanbul ignore next */ []));
|
|
1094
|
+
/** Their names as the field shows them, for the ones that need review. */
|
|
1095
|
+
selectedNames = input({}, ...(ngDevMode ? [{ debugName: "selectedNames" }] : /* istanbul ignore next */ []));
|
|
1094
1096
|
context = input(undefined, ...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
1095
1097
|
searchControl = new FormControl('', {
|
|
1096
1098
|
nonNullable: true,
|
|
@@ -1105,6 +1107,19 @@ class EntityListSelectionDialog {
|
|
|
1105
1107
|
pickedCount = computed(() => this.picked().size, ...(ngDevMode ? [{ debugName: "pickedCount" }] : /* istanbul ignore next */ []));
|
|
1106
1108
|
atLimit = computed(() => this.multiple() && this.pickedCount() >= ENTITY_LIST_MAX_SELECTIONS, ...(ngDevMode ? [{ debugName: "atLimit" }] : /* istanbul ignore next */ []));
|
|
1107
1109
|
maxSelections = ENTITY_LIST_MAX_SELECTIONS;
|
|
1110
|
+
/**
|
|
1111
|
+
* Selected records the backend no longer offers: they fail the list's
|
|
1112
|
+
* "Limit available records" condition, or were deleted or hidden. Known only
|
|
1113
|
+
* from the first unfiltered page, which asks for every selected id
|
|
1114
|
+
* (`includeSelected`) and returns the eligible ones — absence from a search
|
|
1115
|
+
* or a later page says nothing. They stay picked until the user unticks
|
|
1116
|
+
* them; nothing is dropped behind their back.
|
|
1117
|
+
*/
|
|
1118
|
+
reviewIds = signal([], ...(ngDevMode ? [{ debugName: "reviewIds" }] : /* istanbul ignore next */ []));
|
|
1119
|
+
reviewRows = computed(() => this.reviewIds().map((id) => ({
|
|
1120
|
+
id,
|
|
1121
|
+
name: this.selectedNames()[id] || `#${id}`,
|
|
1122
|
+
})), ...(ngDevMode ? [{ debugName: "reviewRows" }] : /* istanbul ignore next */ []));
|
|
1108
1123
|
nextSkip = 0;
|
|
1109
1124
|
request;
|
|
1110
1125
|
ngOnInit() {
|
|
@@ -1188,7 +1203,8 @@ class EntityListSelectionDialog {
|
|
|
1188
1203
|
params = params.set('search', search);
|
|
1189
1204
|
}
|
|
1190
1205
|
const selected = this.selectedIds();
|
|
1191
|
-
|
|
1206
|
+
const includesSelected = skip === 0 && !search && selected.length > 0;
|
|
1207
|
+
if (includesSelected) {
|
|
1192
1208
|
params = params.set('includeSelected', 'true');
|
|
1193
1209
|
for (const id of selected) {
|
|
1194
1210
|
params = params.append('selectedIds', String(id));
|
|
@@ -1205,13 +1221,13 @@ class EntityListSelectionDialog {
|
|
|
1205
1221
|
})
|
|
1206
1222
|
.pipe(finalize(() => this.loading.set(false)), takeUntilDestroyed(this.destroyRef))
|
|
1207
1223
|
.subscribe({
|
|
1208
|
-
next: (response) => this.applyPage(response, skip),
|
|
1224
|
+
next: (response) => this.applyPage(response, skip, includesSelected),
|
|
1209
1225
|
error: (error) => this.failureKey.set(error?.error?.errors?.code === 'entity_list.target_read_denied'
|
|
1210
1226
|
? 'components.entityListField.accessDenied'
|
|
1211
1227
|
: 'components.entityListField.selectionLoadFailed'),
|
|
1212
1228
|
});
|
|
1213
1229
|
}
|
|
1214
|
-
applyPage(response, skip) {
|
|
1230
|
+
applyPage(response, skip, includesSelected) {
|
|
1215
1231
|
const page = [];
|
|
1216
1232
|
for (const item of response?.data?.items ?? []) {
|
|
1217
1233
|
const id = Number(item?.key);
|
|
@@ -1230,9 +1246,13 @@ class EntityListSelectionDialog {
|
|
|
1230
1246
|
]);
|
|
1231
1247
|
this.hasMore.set(!!response?.data?.hasMore);
|
|
1232
1248
|
this.nextSkip = skip + PAGE_SIZE$1;
|
|
1249
|
+
if (includesSelected) {
|
|
1250
|
+
const offered = new Set(page.map((item) => item.id));
|
|
1251
|
+
this.reviewIds.set(this.selectedIds().filter((id) => !offered.has(id)));
|
|
1252
|
+
}
|
|
1233
1253
|
}
|
|
1234
1254
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListSelectionDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1235
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListSelectionDialog, isStandalone: true, selector: "mt-entity-list-selection-dialog", inputs: { propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, contextKey: { classPropertyName: "contextKey", publicName: "contextKey", isSignal: true, isRequired: false, transformFunction: null }, levelDataId: { classPropertyName: "levelDataId", publicName: "levelDataId", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div [class]=\"modal.contentClass + ' flex max-h-[70vh] flex-col gap-3 p-4'\">\
|
|
1255
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListSelectionDialog, isStandalone: true, selector: "mt-entity-list-selection-dialog", inputs: { propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, contextKey: { classPropertyName: "contextKey", publicName: "contextKey", isSignal: true, isRequired: false, transformFunction: null }, levelDataId: { classPropertyName: "levelDataId", publicName: "levelDataId", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, selectedNames: { classPropertyName: "selectedNames", publicName: "selectedNames", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div [class]=\"modal.contentClass + ' flex max-h-[70vh] flex-col gap-3 p-4'\">\n <mt-text-field\n [formControl]=\"searchControl\"\n icon=\"general.search-md\"\n [placeholder]=\"'components.entityListField.searchRecords' | transloco\"\n />\n\n @if (multiple()) {\n <p\n class=\"text-xs\"\n [class.text-muted-color]=\"!atLimit()\"\n [class.text-amber-700]=\"atLimit()\"\n >\n {{\n (atLimit()\n ? \"components.entityListField.selectionLimit\"\n : \"components.entityListField.selectedCount\"\n ) | transloco: { count: pickedCount(), max: maxSelections }\n }}\n </p>\n }\n\n @if (reviewRows().length) {\n <div\n class=\"flex flex-col gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-700\"\n role=\"status\"\n >\n <span>{{\n \"components.entityListField.reviewSelection\" | transloco\n }}</span>\n @for (item of reviewRows(); track item.id) {\n @let chosen = isPicked(item.id);\n <button\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"chosen\"\n [disabled]=\"!chosen && atLimit()\"\n class=\"flex w-full items-center gap-3 rounded-md border border-amber-200 bg-content px-3 py-2 text-start text-sm transition-colors hover:border-primary disabled:cursor-not-allowed disabled:opacity-50\"\n (click)=\"toggle(item)\"\n >\n <span\n class=\"flex size-4 shrink-0 items-center justify-center border\"\n [class.rounded-sm]=\"multiple()\"\n [class.rounded-full]=\"!multiple()\"\n [class.border-primary]=\"chosen\"\n [class.bg-primary]=\"chosen\"\n [class.text-primary-contrast]=\"chosen\"\n [class.border-surface-400]=\"!chosen\"\n >\n @if (chosen) {\n <mt-icon icon=\"general.check\" class=\"text-[0.625rem]\" />\n }\n </span>\n <span class=\"min-w-0 flex-1 truncate text-color\">{{\n item.name\n }}</span>\n <span\n class=\"shrink-0 rounded-md bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700\"\n >\n {{ \"components.entityListField.reviewSelectionTag\" | transloco }}\n </span>\n </button>\n }\n </div>\n }\n\n @if (failureKey(); as failure) {\n <div\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ failure | transloco }}\n </div>\n } @else {\n <div\n class=\"flex min-h-40 flex-col gap-1 overflow-y-auto\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple()\"\n >\n @for (item of items(); track item.id) {\n @let chosen = isPicked(item.id);\n <button\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"chosen\"\n [disabled]=\"!chosen && atLimit()\"\n class=\"flex w-full items-center gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors hover:border-primary disabled:cursor-not-allowed disabled:opacity-50\"\n [class.border-primary]=\"chosen\"\n [class.bg-primary-50]=\"chosen\"\n [class.border-surface]=\"!chosen\"\n (click)=\"toggle(item)\"\n >\n <span\n class=\"flex size-4 shrink-0 items-center justify-center border\"\n [class.rounded-sm]=\"multiple()\"\n [class.rounded-full]=\"!multiple()\"\n [class.border-primary]=\"chosen\"\n [class.bg-primary]=\"chosen\"\n [class.text-primary-contrast]=\"chosen\"\n [class.border-surface-400]=\"!chosen\"\n >\n @if (chosen) {\n <mt-icon icon=\"general.check\" class=\"text-[0.625rem]\" />\n }\n </span>\n <span class=\"min-w-0 flex-1 truncate text-color\">{{\n item.name\n }}</span>\n </button>\n }\n\n @if (loading()) {\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\n } @else if (!items().length) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noCandidates\" | transloco }}\n </div>\n }\n </div>\n\n @if (hasMore() && !loading()) {\n <div class=\"flex justify-center\">\n <mt-button\n [label]=\"'components.entityListField.loadMore' | transloco\"\n variant=\"text\"\n size=\"small\"\n (onClick)=\"loadMore()\"\n />\n </div>\n }\n }\n</div>\n\n<div [class]=\"modal.footerClass\">\n <mt-button\n [label]=\"'components.entityListField.cancel' | transloco\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"onCancel()\"\n />\n <mt-button\n [label]=\"'components.entityListField.apply' | transloco\"\n severity=\"primary\"\n [disabled]=\"!!failureKey()\"\n (onClick)=\"onApply()\"\n />\n</div>\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: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1236
1256
|
}
|
|
1237
1257
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListSelectionDialog, decorators: [{
|
|
1238
1258
|
type: Component,
|
|
@@ -1243,8 +1263,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1243
1263
|
Icon,
|
|
1244
1264
|
Button,
|
|
1245
1265
|
TextField,
|
|
1246
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"modal.contentClass + ' flex max-h-[70vh] flex-col gap-3 p-4'\">\
|
|
1247
|
-
}], propDecorators: { propertyKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyKey", required: false }] }], contextKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextKey", required: false }] }], levelDataId: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelDataId", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], selectedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedIds", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
|
|
1266
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"modal.contentClass + ' flex max-h-[70vh] flex-col gap-3 p-4'\">\n <mt-text-field\n [formControl]=\"searchControl\"\n icon=\"general.search-md\"\n [placeholder]=\"'components.entityListField.searchRecords' | transloco\"\n />\n\n @if (multiple()) {\n <p\n class=\"text-xs\"\n [class.text-muted-color]=\"!atLimit()\"\n [class.text-amber-700]=\"atLimit()\"\n >\n {{\n (atLimit()\n ? \"components.entityListField.selectionLimit\"\n : \"components.entityListField.selectedCount\"\n ) | transloco: { count: pickedCount(), max: maxSelections }\n }}\n </p>\n }\n\n @if (reviewRows().length) {\n <div\n class=\"flex flex-col gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-700\"\n role=\"status\"\n >\n <span>{{\n \"components.entityListField.reviewSelection\" | transloco\n }}</span>\n @for (item of reviewRows(); track item.id) {\n @let chosen = isPicked(item.id);\n <button\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"chosen\"\n [disabled]=\"!chosen && atLimit()\"\n class=\"flex w-full items-center gap-3 rounded-md border border-amber-200 bg-content px-3 py-2 text-start text-sm transition-colors hover:border-primary disabled:cursor-not-allowed disabled:opacity-50\"\n (click)=\"toggle(item)\"\n >\n <span\n class=\"flex size-4 shrink-0 items-center justify-center border\"\n [class.rounded-sm]=\"multiple()\"\n [class.rounded-full]=\"!multiple()\"\n [class.border-primary]=\"chosen\"\n [class.bg-primary]=\"chosen\"\n [class.text-primary-contrast]=\"chosen\"\n [class.border-surface-400]=\"!chosen\"\n >\n @if (chosen) {\n <mt-icon icon=\"general.check\" class=\"text-[0.625rem]\" />\n }\n </span>\n <span class=\"min-w-0 flex-1 truncate text-color\">{{\n item.name\n }}</span>\n <span\n class=\"shrink-0 rounded-md bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700\"\n >\n {{ \"components.entityListField.reviewSelectionTag\" | transloco }}\n </span>\n </button>\n }\n </div>\n }\n\n @if (failureKey(); as failure) {\n <div\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ failure | transloco }}\n </div>\n } @else {\n <div\n class=\"flex min-h-40 flex-col gap-1 overflow-y-auto\"\n role=\"listbox\"\n [attr.aria-multiselectable]=\"multiple()\"\n >\n @for (item of items(); track item.id) {\n @let chosen = isPicked(item.id);\n <button\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"chosen\"\n [disabled]=\"!chosen && atLimit()\"\n class=\"flex w-full items-center gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors hover:border-primary disabled:cursor-not-allowed disabled:opacity-50\"\n [class.border-primary]=\"chosen\"\n [class.bg-primary-50]=\"chosen\"\n [class.border-surface]=\"!chosen\"\n (click)=\"toggle(item)\"\n >\n <span\n class=\"flex size-4 shrink-0 items-center justify-center border\"\n [class.rounded-sm]=\"multiple()\"\n [class.rounded-full]=\"!multiple()\"\n [class.border-primary]=\"chosen\"\n [class.bg-primary]=\"chosen\"\n [class.text-primary-contrast]=\"chosen\"\n [class.border-surface-400]=\"!chosen\"\n >\n @if (chosen) {\n <mt-icon icon=\"general.check\" class=\"text-[0.625rem]\" />\n }\n </span>\n <span class=\"min-w-0 flex-1 truncate text-color\">{{\n item.name\n }}</span>\n </button>\n }\n\n @if (loading()) {\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\n } @else if (!items().length) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noCandidates\" | transloco }}\n </div>\n }\n </div>\n\n @if (hasMore() && !loading()) {\n <div class=\"flex justify-center\">\n <mt-button\n [label]=\"'components.entityListField.loadMore' | transloco\"\n variant=\"text\"\n size=\"small\"\n (onClick)=\"loadMore()\"\n />\n </div>\n }\n }\n</div>\n\n<div [class]=\"modal.footerClass\">\n <mt-button\n [label]=\"'components.entityListField.cancel' | transloco\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"onCancel()\"\n />\n <mt-button\n [label]=\"'components.entityListField.apply' | transloco\"\n severity=\"primary\"\n [disabled]=\"!!failureKey()\"\n (onClick)=\"onApply()\"\n />\n</div>\n" }]
|
|
1267
|
+
}], propDecorators: { propertyKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyKey", required: false }] }], contextKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextKey", required: false }] }], levelDataId: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelDataId", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], selectedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedIds", required: false }] }], selectedNames: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedNames", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
|
|
1248
1268
|
|
|
1249
1269
|
/** Revisions fetched per page of the history list (the backend allows 1–100). */
|
|
1250
1270
|
const REVISIONS_PAGE_SIZE = 25;
|
|
@@ -1602,7 +1622,7 @@ class EntityListField {
|
|
|
1602
1622
|
* the deletes they are approving — hiding them understated what pressing
|
|
1603
1623
|
* Approve would do. Everywhere else a removed row is simply gone.
|
|
1604
1624
|
*/
|
|
1605
|
-
|
|
1625
|
+
pendingDisplayRows = computed(() => {
|
|
1606
1626
|
if (!this.showsPendingOperations())
|
|
1607
1627
|
return this.rows();
|
|
1608
1628
|
const deleted = new Set(this.deletedIds());
|
|
@@ -1623,7 +1643,9 @@ class EntityListField {
|
|
|
1623
1643
|
}
|
|
1624
1644
|
const created = this.createdRows().map((row) => this.withRowChange(row, 'added'));
|
|
1625
1645
|
return [...existing, ...this.orphanDeletedRows(), ...created];
|
|
1626
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
1646
|
+
}, ...(ngDevMode ? [{ debugName: "pendingDisplayRows" }] : /* istanbul ignore next */ []));
|
|
1647
|
+
displayRows = computed(() => mergeStakeholderNameRows(this.columns(), this.pendingDisplayRows()), ...(ngDevMode ? [{ debugName: "displayRows" }] : /* istanbul ignore next */ []));
|
|
1648
|
+
displayColumns = computed(() => mergeStakeholderNameColumns(this.columns()), ...(ngDevMode ? [{ debugName: "displayColumns" }] : /* istanbul ignore next */ []));
|
|
1627
1649
|
hasRows = computed(() => this.displayRows().length > 0, ...(ngDevMode ? [{ debugName: "hasRows" }] : /* istanbul ignore next */ []));
|
|
1628
1650
|
/**
|
|
1629
1651
|
* Tag a rendered row with its staged operation and the cell that displays it.
|
|
@@ -1708,7 +1730,7 @@ class EntityListField {
|
|
|
1708
1730
|
* against the record values and add an empty cell to every row.
|
|
1709
1731
|
*/
|
|
1710
1732
|
tableColumns = computed(() => {
|
|
1711
|
-
const columns = this.
|
|
1733
|
+
const columns = this.displayColumns();
|
|
1712
1734
|
if (!this.showsChangeFlags())
|
|
1713
1735
|
return columns;
|
|
1714
1736
|
return [
|
|
@@ -1778,19 +1800,22 @@ class EntityListField {
|
|
|
1778
1800
|
* table would show an order that is not the one being saved.
|
|
1779
1801
|
*/
|
|
1780
1802
|
localColumns = computed(() => this.buildLocalColumns(this.localFields(), !this.localCanEdit()), ...(ngDevMode ? [{ debugName: "localColumns" }] : /* istanbul ignore next */ []));
|
|
1803
|
+
displayLocalColumns = computed(() => mergeStakeholderNameColumns(this.localColumns()), ...(ngDevMode ? [{ debugName: "displayLocalColumns" }] : /* istanbul ignore next */ []));
|
|
1781
1804
|
/**
|
|
1782
1805
|
* Rows as rendered: loaded rows with this session's edits over them, then
|
|
1783
1806
|
* new rows, in the order they would be saved. A loaded cell renders from the
|
|
1784
1807
|
* backend's resolved `value`; a cell the user set renders from the dialog's
|
|
1785
1808
|
* control value and option label, like a locally added linked row.
|
|
1786
1809
|
*/
|
|
1787
|
-
localTableRows = computed(() => this.buildLocalRows(this.localState(), this.localFields(), this.localColumns()), ...(ngDevMode ? [{ debugName: "localTableRows" }] : /* istanbul ignore next */ []));
|
|
1810
|
+
localTableRows = computed(() => mergeStakeholderNameRows(this.localColumns(), this.buildLocalRows(this.localState(), this.localFields(), this.localColumns())), ...(ngDevMode ? [{ debugName: "localTableRows" }] : /* istanbul ignore next */ []));
|
|
1788
1811
|
buildLocalColumns(fields, sortable) {
|
|
1789
1812
|
const lang = this.lang();
|
|
1790
1813
|
return fields.map((field, index) => {
|
|
1791
1814
|
const viewType = resolveLocalFieldViewType(field);
|
|
1792
1815
|
return {
|
|
1793
1816
|
key: field.id,
|
|
1817
|
+
normalizedKey: this.propertyByKey().get(field.sourceKey)?.normalizedKey ??
|
|
1818
|
+
field.sourceKey,
|
|
1794
1819
|
label: resolveLocalFieldLabel(field, lang),
|
|
1795
1820
|
type: 'entity',
|
|
1796
1821
|
sortable: sortable &&
|
|
@@ -1923,7 +1948,7 @@ class EntityListField {
|
|
|
1923
1948
|
const properties = this.propertyByKey();
|
|
1924
1949
|
const records = new Map((state.base?.records ?? []).map((record) => [record.entityId, record]));
|
|
1925
1950
|
const unavailable = new Set(state.base?.unavailableIds ?? []);
|
|
1926
|
-
|
|
1951
|
+
const rows = state.ids.map((id) => {
|
|
1927
1952
|
// A loaded record renders the backend's values for it; a record picked
|
|
1928
1953
|
// in this session renders the picker's display values, when sent.
|
|
1929
1954
|
const record = records.get(id) ?? state.records[id];
|
|
@@ -1953,7 +1978,33 @@ class EntityListField {
|
|
|
1953
1978
|
});
|
|
1954
1979
|
return row;
|
|
1955
1980
|
});
|
|
1981
|
+
return mergeStakeholderNameRows(columns, rows);
|
|
1956
1982
|
}, ...(ngDevMode ? [{ debugName: "selectionRows" }] : /* istanbul ignore next */ []));
|
|
1983
|
+
/**
|
|
1984
|
+
* Each selected record's name as its row shows it — the first column's text
|
|
1985
|
+
* — so the picker can name the ones it asks the user to review.
|
|
1986
|
+
*/
|
|
1987
|
+
selectionNames() {
|
|
1988
|
+
const first = this.columns()[0]?.key;
|
|
1989
|
+
const names = {};
|
|
1990
|
+
for (const row of this.selectionRows()) {
|
|
1991
|
+
const id = Number(row[ROW_ENTITY_ID_KEY]);
|
|
1992
|
+
if (!(id > 0))
|
|
1993
|
+
continue;
|
|
1994
|
+
const value = first
|
|
1995
|
+
? row[first]?.value
|
|
1996
|
+
: null;
|
|
1997
|
+
const text = typeof value === 'string'
|
|
1998
|
+
? value
|
|
1999
|
+
: value && typeof value === 'object'
|
|
2000
|
+
? String(value['display'] ??
|
|
2001
|
+
value['displayName'] ??
|
|
2002
|
+
'')
|
|
2003
|
+
: '';
|
|
2004
|
+
names[id] = text.trim() || this.selectionState().names[id] || '';
|
|
2005
|
+
}
|
|
2006
|
+
return names;
|
|
2007
|
+
}
|
|
1957
2008
|
/**
|
|
1958
2009
|
* One table row from a rendered record — `{ entityId, values }` with each
|
|
1959
2010
|
* value's `rawValue` and rendered `value` — cell by cell against the
|
|
@@ -2038,12 +2089,12 @@ class EntityListField {
|
|
|
2038
2089
|
liveRows = computed(() => {
|
|
2039
2090
|
const columns = this.columns();
|
|
2040
2091
|
const properties = this.propertyByKey();
|
|
2041
|
-
return (this.comparison()?.live ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
2092
|
+
return mergeStakeholderNameRows(columns, (this.comparison()?.live ?? []).map((record) => this.recordRow(record, columns, properties)));
|
|
2042
2093
|
}, ...(ngDevMode ? [{ debugName: "liveRows" }] : /* istanbul ignore next */ []));
|
|
2043
2094
|
preservedRows = computed(() => {
|
|
2044
2095
|
const columns = this.columns();
|
|
2045
2096
|
const properties = this.propertyByKey();
|
|
2046
|
-
return (this.comparison()?.preserved ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
2097
|
+
return mergeStakeholderNameRows(columns, (this.comparison()?.preserved ?? []).map((record) => this.recordRow(record, columns, properties)));
|
|
2047
2098
|
}, ...(ngDevMode ? [{ debugName: "preservedRows" }] : /* istanbul ignore next */ []));
|
|
2048
2099
|
/** No baseline was captured yet — not the same as an empty saved list. */
|
|
2049
2100
|
preservedAvailable = computed(() => this.comparison()?.preservedAvailable === true, ...(ngDevMode ? [{ debugName: "preservedAvailable" }] : /* istanbul ignore next */ []));
|
|
@@ -2130,11 +2181,12 @@ class EntityListField {
|
|
|
2130
2181
|
revisionLocalDocument = computed(() => this.localMode() ? (this.comparison()?.localDocument ?? null) : null, ...(ngDevMode ? [{ debugName: "revisionLocalDocument" }] : /* istanbul ignore next */ []));
|
|
2131
2182
|
revisionLocalFields = computed(() => visibleLocalSchemaFields(this.revisionLocalDocument()?.schema), ...(ngDevMode ? [{ debugName: "revisionLocalFields" }] : /* istanbul ignore next */ []));
|
|
2132
2183
|
revisionLocalColumns = computed(() => this.buildLocalColumns(this.revisionLocalFields(), true), ...(ngDevMode ? [{ debugName: "revisionLocalColumns" }] : /* istanbul ignore next */ []));
|
|
2184
|
+
displayRevisionLocalColumns = computed(() => mergeStakeholderNameColumns(this.revisionLocalColumns()), ...(ngDevMode ? [{ debugName: "displayRevisionLocalColumns" }] : /* istanbul ignore next */ []));
|
|
2133
2185
|
revisionLocalRows = computed(() => {
|
|
2134
2186
|
const document = this.revisionLocalDocument();
|
|
2135
2187
|
if (!document)
|
|
2136
2188
|
return [];
|
|
2137
|
-
return this.buildLocalRows(createLocalEditorState(document), this.revisionLocalFields(), this.revisionLocalColumns());
|
|
2189
|
+
return mergeStakeholderNameRows(this.revisionLocalColumns(), this.buildLocalRows(createLocalEditorState(document), this.revisionLocalFields(), this.revisionLocalColumns()));
|
|
2138
2190
|
}, ...(ngDevMode ? [{ debugName: "revisionLocalRows" }] : /* istanbul ignore next */ []));
|
|
2139
2191
|
/** The history list is open. */
|
|
2140
2192
|
revisionsOpen = signal(false, ...(ngDevMode ? [{ debugName: "revisionsOpen" }] : /* istanbul ignore next */ []));
|
|
@@ -2302,6 +2354,7 @@ class EntityListField {
|
|
|
2302
2354
|
levelDataId: this.levelDataId(),
|
|
2303
2355
|
multiple: this.selectionMultiple(),
|
|
2304
2356
|
selectedIds: this.selectionState().ids,
|
|
2357
|
+
selectedNames: this.selectionNames(),
|
|
2305
2358
|
context: this.context(),
|
|
2306
2359
|
},
|
|
2307
2360
|
});
|
|
@@ -3415,6 +3468,7 @@ class EntityListField {
|
|
|
3415
3468
|
.sort((a, b) => a.order - b.order)
|
|
3416
3469
|
.map((column) => ({
|
|
3417
3470
|
key: column.key,
|
|
3471
|
+
normalizedKey: propertyByKey.get(column.key)?.normalizedKey ?? column.key,
|
|
3418
3472
|
label: column.label,
|
|
3419
3473
|
type: 'entity',
|
|
3420
3474
|
sortable: !UNSORTABLE_ENTITY_VIEW_TYPES.has(column.viewType),
|
|
@@ -3548,7 +3602,7 @@ class EntityListField {
|
|
|
3548
3602
|
};
|
|
3549
3603
|
}
|
|
3550
3604
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3551
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, pendingSubmission: { classPropertyName: "pendingSubmission", publicName: "pendingSubmission", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, providers: [EntityRuntimeContextStore], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (noticeKey(); as notice) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ notice | transloco }}\r\n </div>\r\n } @else if (localReady()) {\r\n <!--\r\n A Local list: rows owned by this record, staged into its own submission.\r\n Add / edit / delete / drag follow the Local operation switches. Opened\r\n from a table cell, it can also show a saved revision's rows instead.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\r\n @if (revisionLocalRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"revisionLocalRows()\"\r\n [columns]=\"revisionLocalColumns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n } @else {\r\n @if (localCanCreate()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openLocalRowDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (localTableRows().length || localCanCreate()) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"localTableRows()\"\r\n [columns]=\"localColumns()\"\r\n [rowActions]=\"localRowActions()\"\r\n [reorderableRows]=\"localCanReorder()\"\r\n (rowReorder)=\"onLocalReorder($event)\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noLocalRows\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (selectionReady()) {\r\n <!--\r\n A Selected list: the source records picked for this record, and nothing\r\n else. Picking and removing change only which records it holds. Opened\r\n from a table cell, a saved revision compares the records it held then\r\n with their values today.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n } @else {\r\n @if (selectionWritable()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.selectRecords' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openSelectionDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (selectionRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"selectionRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"selectionRowActions()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (comparisonMode()) {\r\n <!--\r\n A saved Related list opened from outside its form: its sources' current\r\n values, and the values preserved when it was saved. A missing baseline is\r\n said as such \u2014 it is not an empty list.\r\n -->\r\n @if (!comparisonReady()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else {\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n }\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n\r\n<!--\r\n Saved list revisions: each successful save of this list, newest first.\r\n Picking one shows what it preserved \u2014 beside today's values of the records\r\n it held, for a linked list. Read-only: history is never submitted.\r\n-->\r\n<ng-template #history>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @if (viewedRevision(); as version) {\r\n <span\r\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\r\n >\r\n {{\r\n \"components.entityListField.viewingRevision\"\r\n | transloco: { version: version }\r\n }}\r\n </span>\r\n <mt-button\r\n [label]=\"'components.entityListField.backToLatest' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n [disabled]=\"revisionLoading()\"\r\n (onClick)=\"showRevision(null)\"\r\n />\r\n }\r\n </div>\r\n <mt-button\r\n [label]=\"'components.entityListField.revisions' | transloco\"\r\n icon=\"time.clock-rewind\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"toggleRevisions()\"\r\n />\r\n </div>\r\n\r\n @if (revisionsOpen()) {\r\n <div\r\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\r\n >\r\n <p class=\"text-xs text-muted-color\">\r\n {{ \"components.entityListField.revisionsHint\" | transloco }}\r\n </p>\r\n @if (revisionsError(); as message) {\r\n <p class=\"text-sm text-red-600\">{{ message }}</p>\r\n }\r\n @for (revision of revisionItems(); track revision.version) {\r\n <button\r\n type=\"button\"\r\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\r\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\r\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\r\n [class.border-surface]=\"viewedRevision() !== revision.version\"\r\n [class.bg-content]=\"viewedRevision() !== revision.version\"\r\n [disabled]=\"revisionLoading()\"\r\n (click)=\"showRevision(revision.version)\"\r\n >\r\n <span class=\"font-medium text-color\">\r\n {{\r\n \"components.entityListField.revisionLabel\"\r\n | transloco: { version: revision.version }\r\n }}\r\n </span>\r\n <span\r\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\r\n >\r\n <span class=\"truncate\">{{ revision.author }}</span>\r\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\r\n </span>\r\n </button>\r\n } @empty {\r\n @if (!revisionsLoading() && !revisionsError()) {\r\n <p class=\"text-sm text-muted-color\">\r\n {{ \"components.entityListField.noRevisions\" | transloco }}\r\n </p>\r\n }\r\n }\r\n @if (revisionsLoading()) {\r\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\r\n } @else if (hasMoreRevisions()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n [label]=\"'components.entityListField.loadMore' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n (onClick)=\"loadRevisions()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (revisionError(); as message) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\r\n >\r\n {{ message }}\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<!-- \"Preserved values\", with when they were captured. -->\r\n<ng-template #preservedHeading>\r\n <h4\r\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\r\n >\r\n {{ \"components.entityListField.preservedValues\" | transloco }}\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs font-normal text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n </h4>\r\n</ng-template>\r\n\r\n<!--\r\n A linked list's comparison, one table at a time: the values preserved when\r\n it was saved, or its source records' current values. It opens on the\r\n property's configured mode. A missing baseline says so \u2014 it is never\r\n replaced by the current values.\r\n-->\r\n<ng-template #comparisonSections>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <mt-tabs\r\n size=\"small\"\r\n [options]=\"comparisonViewOptions()\"\r\n [active]=\"comparisonView()\"\r\n (onChange)=\"setComparisonView($event)\"\r\n />\r\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n }\r\n </div>\r\n\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n @if (comparisonView() === \"current\") {\r\n @if (liveRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"liveRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n }\r\n } @else if (!preservedAvailable()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\r\n </div>\r\n } @else if (preservedRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"preservedRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n\r\n @if (unavailableCount()) {\r\n <p class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.unavailableRecords\"\r\n | transloco: { count: unavailableCount() }\r\n }}\r\n </p>\r\n }\r\n</ng-template>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3605
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, pendingSubmission: { classPropertyName: "pendingSubmission", publicName: "pendingSubmission", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, providers: [EntityRuntimeContextStore], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (errorMessage(); as err) {\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\n } @else if (noticeKey(); as notice) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ notice | transloco }}\n </div>\n } @else if (localReady()) {\n <!--\n A Local list: rows owned by this record, staged into its own submission.\n Add / edit / delete / drag follow the Local operation switches. Opened\n from a table cell, it can also show a saved revision's rows instead.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\n @if (revisionLocalRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"revisionLocalRows()\"\n [columns]=\"displayRevisionLocalColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n } @else {\n @if (localCanCreate()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openLocalRowDialog()\"\n />\n </div>\n }\n @if (localTableRows().length || localCanCreate()) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"localTableRows()\"\n [columns]=\"displayLocalColumns()\"\n [rowActions]=\"localRowActions()\"\n [reorderableRows]=\"localCanReorder()\"\n (rowReorder)=\"onLocalReorder($event)\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noLocalRows\" | transloco }}\n </div>\n }\n }\n } @else if (selectionReady()) {\n <!--\n A Selected list: the source records picked for this record, and nothing\n else. Picking and removing change only which records it holds. Opened\n from a table cell, a saved revision compares the records it held then\n with their values today.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n } @else {\n @if (selectionWritable()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.selectRecords' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openSelectionDialog()\"\n />\n </div>\n }\n @if (selectionRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"selectionRows()\"\n [columns]=\"displayColumns()\"\n [rowActions]=\"selectionRowActions()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\n </div>\n }\n }\n } @else if (comparisonMode()) {\n <!--\n A saved Related list opened from outside its form: its sources' current\n values, and the values preserved when it was saved. A missing baseline is\n said as such \u2014 it is not an empty list.\n -->\n @if (!comparisonReady()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else {\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n }\n } @else if (canWrite()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openAddDialog()\"\n />\n </div>\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n [rowActions]=\"writeRowActions()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n } @else if (loading() && !hasRows()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else if (!hasRows()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n\n<!--\n Saved list revisions: each successful save of this list, newest first.\n Picking one shows what it preserved \u2014 beside today's values of the records\n it held, for a linked list. Read-only: history is never submitted.\n-->\n<ng-template #history>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <div class=\"flex flex-wrap items-center gap-2\">\n @if (viewedRevision(); as version) {\n <span\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\n >\n {{\n \"components.entityListField.viewingRevision\"\n | transloco: { version: version }\n }}\n </span>\n <mt-button\n [label]=\"'components.entityListField.backToLatest' | transloco\"\n size=\"small\"\n variant=\"text\"\n [disabled]=\"revisionLoading()\"\n (onClick)=\"showRevision(null)\"\n />\n }\n </div>\n <mt-button\n [label]=\"'components.entityListField.revisions' | transloco\"\n icon=\"time.clock-rewind\"\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"toggleRevisions()\"\n />\n </div>\n\n @if (revisionsOpen()) {\n <div\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\n >\n <p class=\"text-xs text-muted-color\">\n {{ \"components.entityListField.revisionsHint\" | transloco }}\n </p>\n @if (revisionsError(); as message) {\n <p class=\"text-sm text-red-600\">{{ message }}</p>\n }\n @for (revision of revisionItems(); track revision.version) {\n <button\n type=\"button\"\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\n [class.border-surface]=\"viewedRevision() !== revision.version\"\n [class.bg-content]=\"viewedRevision() !== revision.version\"\n [disabled]=\"revisionLoading()\"\n (click)=\"showRevision(revision.version)\"\n >\n <span class=\"font-medium text-color\">\n {{\n \"components.entityListField.revisionLabel\"\n | transloco: { version: revision.version }\n }}\n </span>\n <span\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\n >\n <span class=\"truncate\">{{ revision.author }}</span>\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\n </span>\n </button>\n } @empty {\n @if (!revisionsLoading() && !revisionsError()) {\n <p class=\"text-sm text-muted-color\">\n {{ \"components.entityListField.noRevisions\" | transloco }}\n </p>\n }\n }\n @if (revisionsLoading()) {\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\n } @else if (hasMoreRevisions()) {\n <div class=\"flex justify-center\">\n <mt-button\n [label]=\"'components.entityListField.loadMore' | transloco\"\n size=\"small\"\n variant=\"text\"\n (onClick)=\"loadRevisions()\"\n />\n </div>\n }\n </div>\n }\n\n @if (revisionError(); as message) {\n <div\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ message }}\n </div>\n }\n</ng-template>\n\n<!-- \"Preserved values\", with when they were captured. -->\n<ng-template #preservedHeading>\n <h4\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\n >\n {{ \"components.entityListField.preservedValues\" | transloco }}\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs font-normal text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n </h4>\n</ng-template>\n\n<!--\n A linked list's comparison, one table at a time: the values preserved when\n it was saved, or its source records' current values. It opens on the\n property's configured mode. A missing baseline says so \u2014 it is never\n replaced by the current values.\n-->\n<ng-template #comparisonSections>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <mt-tabs\n size=\"small\"\n [options]=\"comparisonViewOptions()\"\n [active]=\"comparisonView()\"\n (onChange)=\"setComparisonView($event)\"\n />\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n }\n </div>\n\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n @if (comparisonView() === \"current\") {\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"displayColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n }\n } @else if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"displayColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n\n @if (unavailableCount()) {\n <p class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.unavailableRecords\"\n | transloco: { count: unavailableCount() }\n }}\n </p>\n }\n</ng-template>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3552
3606
|
}
|
|
3553
3607
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
|
|
3554
3608
|
type: Component,
|
|
@@ -3562,7 +3616,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3562
3616
|
Tabs,
|
|
3563
3617
|
TranslocoPipe,
|
|
3564
3618
|
MTDateFormatPipe,
|
|
3565
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, providers: [EntityRuntimeContextStore], template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (noticeKey(); as notice) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ notice | transloco }}\r\n </div>\r\n } @else if (localReady()) {\r\n <!--\r\n A Local list: rows owned by this record, staged into its own submission.\r\n Add / edit / delete / drag follow the Local operation switches. Opened\r\n from a table cell, it can also show a saved revision's rows instead.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\r\n @if (revisionLocalRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"revisionLocalRows()\"\r\n [columns]=\"revisionLocalColumns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n } @else {\r\n @if (localCanCreate()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openLocalRowDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (localTableRows().length || localCanCreate()) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"localTableRows()\"\r\n [columns]=\"localColumns()\"\r\n [rowActions]=\"localRowActions()\"\r\n [reorderableRows]=\"localCanReorder()\"\r\n (rowReorder)=\"onLocalReorder($event)\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noLocalRows\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (selectionReady()) {\r\n <!--\r\n A Selected list: the source records picked for this record, and nothing\r\n else. Picking and removing change only which records it holds. Opened\r\n from a table cell, a saved revision compares the records it held then\r\n with their values today.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n } @else {\r\n @if (selectionWritable()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.selectRecords' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openSelectionDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (selectionRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"selectionRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"selectionRowActions()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (comparisonMode()) {\r\n <!--\r\n A saved Related list opened from outside its form: its sources' current\r\n values, and the values preserved when it was saved. A missing baseline is\r\n said as such \u2014 it is not an empty list.\r\n -->\r\n @if (!comparisonReady()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else {\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n }\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n\r\n<!--\r\n Saved list revisions: each successful save of this list, newest first.\r\n Picking one shows what it preserved \u2014 beside today's values of the records\r\n it held, for a linked list. Read-only: history is never submitted.\r\n-->\r\n<ng-template #history>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @if (viewedRevision(); as version) {\r\n <span\r\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\r\n >\r\n {{\r\n \"components.entityListField.viewingRevision\"\r\n | transloco: { version: version }\r\n }}\r\n </span>\r\n <mt-button\r\n [label]=\"'components.entityListField.backToLatest' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n [disabled]=\"revisionLoading()\"\r\n (onClick)=\"showRevision(null)\"\r\n />\r\n }\r\n </div>\r\n <mt-button\r\n [label]=\"'components.entityListField.revisions' | transloco\"\r\n icon=\"time.clock-rewind\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"toggleRevisions()\"\r\n />\r\n </div>\r\n\r\n @if (revisionsOpen()) {\r\n <div\r\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\r\n >\r\n <p class=\"text-xs text-muted-color\">\r\n {{ \"components.entityListField.revisionsHint\" | transloco }}\r\n </p>\r\n @if (revisionsError(); as message) {\r\n <p class=\"text-sm text-red-600\">{{ message }}</p>\r\n }\r\n @for (revision of revisionItems(); track revision.version) {\r\n <button\r\n type=\"button\"\r\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\r\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\r\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\r\n [class.border-surface]=\"viewedRevision() !== revision.version\"\r\n [class.bg-content]=\"viewedRevision() !== revision.version\"\r\n [disabled]=\"revisionLoading()\"\r\n (click)=\"showRevision(revision.version)\"\r\n >\r\n <span class=\"font-medium text-color\">\r\n {{\r\n \"components.entityListField.revisionLabel\"\r\n | transloco: { version: revision.version }\r\n }}\r\n </span>\r\n <span\r\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\r\n >\r\n <span class=\"truncate\">{{ revision.author }}</span>\r\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\r\n </span>\r\n </button>\r\n } @empty {\r\n @if (!revisionsLoading() && !revisionsError()) {\r\n <p class=\"text-sm text-muted-color\">\r\n {{ \"components.entityListField.noRevisions\" | transloco }}\r\n </p>\r\n }\r\n }\r\n @if (revisionsLoading()) {\r\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\r\n } @else if (hasMoreRevisions()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n [label]=\"'components.entityListField.loadMore' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n (onClick)=\"loadRevisions()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (revisionError(); as message) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\r\n >\r\n {{ message }}\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<!-- \"Preserved values\", with when they were captured. -->\r\n<ng-template #preservedHeading>\r\n <h4\r\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\r\n >\r\n {{ \"components.entityListField.preservedValues\" | transloco }}\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs font-normal text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n </h4>\r\n</ng-template>\r\n\r\n<!--\r\n A linked list's comparison, one table at a time: the values preserved when\r\n it was saved, or its source records' current values. It opens on the\r\n property's configured mode. A missing baseline says so \u2014 it is never\r\n replaced by the current values.\r\n-->\r\n<ng-template #comparisonSections>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <mt-tabs\r\n size=\"small\"\r\n [options]=\"comparisonViewOptions()\"\r\n [active]=\"comparisonView()\"\r\n (onChange)=\"setComparisonView($event)\"\r\n />\r\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n }\r\n </div>\r\n\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n @if (comparisonView() === \"current\") {\r\n @if (liveRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"liveRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n }\r\n } @else if (!preservedAvailable()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\r\n </div>\r\n } @else if (preservedRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"preservedRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n\r\n @if (unavailableCount()) {\r\n <p class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.unavailableRecords\"\r\n | transloco: { count: unavailableCount() }\r\n }}\r\n </p>\r\n }\r\n</ng-template>\r\n", styles: [":host{display:block}\n"] }]
|
|
3619
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, providers: [EntityRuntimeContextStore], template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (errorMessage(); as err) {\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\n } @else if (noticeKey(); as notice) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ notice | transloco }}\n </div>\n } @else if (localReady()) {\n <!--\n A Local list: rows owned by this record, staged into its own submission.\n Add / edit / delete / drag follow the Local operation switches. Opened\n from a table cell, it can also show a saved revision's rows instead.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\n @if (revisionLocalRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"revisionLocalRows()\"\n [columns]=\"displayRevisionLocalColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n } @else {\n @if (localCanCreate()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openLocalRowDialog()\"\n />\n </div>\n }\n @if (localTableRows().length || localCanCreate()) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"localTableRows()\"\n [columns]=\"displayLocalColumns()\"\n [rowActions]=\"localRowActions()\"\n [reorderableRows]=\"localCanReorder()\"\n (rowReorder)=\"onLocalReorder($event)\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noLocalRows\" | transloco }}\n </div>\n }\n }\n } @else if (selectionReady()) {\n <!--\n A Selected list: the source records picked for this record, and nothing\n else. Picking and removing change only which records it holds. Opened\n from a table cell, a saved revision compares the records it held then\n with their values today.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n } @else {\n @if (selectionWritable()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.selectRecords' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openSelectionDialog()\"\n />\n </div>\n }\n @if (selectionRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"selectionRows()\"\n [columns]=\"displayColumns()\"\n [rowActions]=\"selectionRowActions()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\n </div>\n }\n }\n } @else if (comparisonMode()) {\n <!--\n A saved Related list opened from outside its form: its sources' current\n values, and the values preserved when it was saved. A missing baseline is\n said as such \u2014 it is not an empty list.\n -->\n @if (!comparisonReady()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else {\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n }\n } @else if (canWrite()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openAddDialog()\"\n />\n </div>\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n [rowActions]=\"writeRowActions()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n } @else if (loading() && !hasRows()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else if (!hasRows()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n\n<!--\n Saved list revisions: each successful save of this list, newest first.\n Picking one shows what it preserved \u2014 beside today's values of the records\n it held, for a linked list. Read-only: history is never submitted.\n-->\n<ng-template #history>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <div class=\"flex flex-wrap items-center gap-2\">\n @if (viewedRevision(); as version) {\n <span\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\n >\n {{\n \"components.entityListField.viewingRevision\"\n | transloco: { version: version }\n }}\n </span>\n <mt-button\n [label]=\"'components.entityListField.backToLatest' | transloco\"\n size=\"small\"\n variant=\"text\"\n [disabled]=\"revisionLoading()\"\n (onClick)=\"showRevision(null)\"\n />\n }\n </div>\n <mt-button\n [label]=\"'components.entityListField.revisions' | transloco\"\n icon=\"time.clock-rewind\"\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"toggleRevisions()\"\n />\n </div>\n\n @if (revisionsOpen()) {\n <div\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\n >\n <p class=\"text-xs text-muted-color\">\n {{ \"components.entityListField.revisionsHint\" | transloco }}\n </p>\n @if (revisionsError(); as message) {\n <p class=\"text-sm text-red-600\">{{ message }}</p>\n }\n @for (revision of revisionItems(); track revision.version) {\n <button\n type=\"button\"\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\n [class.border-surface]=\"viewedRevision() !== revision.version\"\n [class.bg-content]=\"viewedRevision() !== revision.version\"\n [disabled]=\"revisionLoading()\"\n (click)=\"showRevision(revision.version)\"\n >\n <span class=\"font-medium text-color\">\n {{\n \"components.entityListField.revisionLabel\"\n | transloco: { version: revision.version }\n }}\n </span>\n <span\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\n >\n <span class=\"truncate\">{{ revision.author }}</span>\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\n </span>\n </button>\n } @empty {\n @if (!revisionsLoading() && !revisionsError()) {\n <p class=\"text-sm text-muted-color\">\n {{ \"components.entityListField.noRevisions\" | transloco }}\n </p>\n }\n }\n @if (revisionsLoading()) {\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\n } @else if (hasMoreRevisions()) {\n <div class=\"flex justify-center\">\n <mt-button\n [label]=\"'components.entityListField.loadMore' | transloco\"\n size=\"small\"\n variant=\"text\"\n (onClick)=\"loadRevisions()\"\n />\n </div>\n }\n </div>\n }\n\n @if (revisionError(); as message) {\n <div\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ message }}\n </div>\n }\n</ng-template>\n\n<!-- \"Preserved values\", with when they were captured. -->\n<ng-template #preservedHeading>\n <h4\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\n >\n {{ \"components.entityListField.preservedValues\" | transloco }}\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs font-normal text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n </h4>\n</ng-template>\n\n<!--\n A linked list's comparison, one table at a time: the values preserved when\n it was saved, or its source records' current values. It opens on the\n property's configured mode. A missing baseline says so \u2014 it is never\n replaced by the current values.\n-->\n<ng-template #comparisonSections>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <mt-tabs\n size=\"small\"\n [options]=\"comparisonViewOptions()\"\n [active]=\"comparisonView()\"\n (onChange)=\"setComparisonView($event)\"\n />\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n }\n </div>\n\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n @if (comparisonView() === \"current\") {\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"displayColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n }\n } @else if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"displayColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n\n @if (unavailableCount()) {\n <p class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.unavailableRecords\"\n | transloco: { count: unavailableCount() }\n }}\n </p>\n }\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
3566
3620
|
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: false }] }], propertyKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyKey", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }], pendingSubmission: [{ type: i0.Input, args: [{ isSignal: true, alias: "pendingSubmission", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }], initialValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValue", required: false }] }] } });
|
|
3567
3621
|
|
|
3568
3622
|
/**
|