@masterteam/components 0.0.303 → 0.0.305
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 +8 -1
- package/assets/i18n/en.json +8 -1
- package/fesm2022/masterteam-components-business-fields.mjs +219 -40
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +93 -17
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +61 -2
- package/types/masterteam-components-entities.d.ts +124 -77
- package/types/masterteam-components.d.ts +7 -0
package/assets/i18n/ar.json
CHANGED
|
@@ -140,7 +140,14 @@
|
|
|
140
140
|
"selectedCount": "تم اختيار {{count}}",
|
|
141
141
|
"selectionLimit": "تم اختيار {{count}} — الحد الأقصى {{max}}.",
|
|
142
142
|
"selectionUnavailable": "لا يمكن اختيار السجلات هنا.",
|
|
143
|
-
"selectionLoadFailed": "تعذّر تحميل السجلات المتاحة للاختيار."
|
|
143
|
+
"selectionLoadFailed": "تعذّر تحميل السجلات المتاحة للاختيار.",
|
|
144
|
+
"shownAfterSave": "يظهر بعد الحفظ",
|
|
145
|
+
"currentValues": "القيم الحالية",
|
|
146
|
+
"preservedValues": "القيم المحفوظة",
|
|
147
|
+
"preservedAt": "التُقطت في {{date}}",
|
|
148
|
+
"noPreservedSnapshot": "لا توجد لقطة محفوظة بعد.",
|
|
149
|
+
"preservedEmpty": "القائمة المحفوظة فارغة.",
|
|
150
|
+
"unavailableRecords": "{{count}} من السجلات المحفوظة لم تعد متاحة."
|
|
144
151
|
},
|
|
145
152
|
"entityListPreview": {
|
|
146
153
|
"view": "عرض القائمة",
|
package/assets/i18n/en.json
CHANGED
|
@@ -140,7 +140,14 @@
|
|
|
140
140
|
"selectedCount": "{{count}} selected",
|
|
141
141
|
"selectionLimit": "{{count}} selected — the limit is {{max}}.",
|
|
142
142
|
"selectionUnavailable": "Records cannot be chosen here.",
|
|
143
|
-
"selectionLoadFailed": "Could not load the records to choose from."
|
|
143
|
+
"selectionLoadFailed": "Could not load the records to choose from.",
|
|
144
|
+
"shownAfterSave": "Shown after saving",
|
|
145
|
+
"currentValues": "Current values",
|
|
146
|
+
"preservedValues": "Preserved values",
|
|
147
|
+
"preservedAt": "Captured {{date}}",
|
|
148
|
+
"noPreservedSnapshot": "No preserved snapshot yet.",
|
|
149
|
+
"preservedEmpty": "The preserved list is empty.",
|
|
150
|
+
"unavailableRecords": "{{count}} saved record(s) are no longer available."
|
|
144
151
|
},
|
|
145
152
|
"entityListPreview": {
|
|
146
153
|
"view": "View list",
|
|
@@ -16,7 +16,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
|
|
16
16
|
import { Button } from '@masterteam/components/button';
|
|
17
17
|
import { NumberField } from '@masterteam/components/number-field';
|
|
18
18
|
import { Table } from '@masterteam/components/table';
|
|
19
|
-
import { newFieldId, coerceCheckboxValue } from '@masterteam/components';
|
|
19
|
+
import { newFieldId, coerceCheckboxValue, MTDateFormatPipe } from '@masterteam/components';
|
|
20
20
|
import { Skeleton } from 'primeng/skeleton';
|
|
21
21
|
import { Message } from 'primeng/message';
|
|
22
22
|
import { ModalService } from '@masterteam/components/modal';
|
|
@@ -951,11 +951,31 @@ function newLocalUuid() {
|
|
|
951
951
|
].join('-');
|
|
952
952
|
}
|
|
953
953
|
|
|
954
|
+
/**
|
|
955
|
+
* The display record an option carries in `metadataJson` — a JSON string
|
|
956
|
+
* holding `{ entityId, values }`, the shape of a projected `records` entry.
|
|
957
|
+
* Null when absent (an older backend), unparsable, or for another record.
|
|
958
|
+
*/
|
|
959
|
+
function parseOptionRecord(metadataJson, id) {
|
|
960
|
+
if (typeof metadataJson !== 'string' || !metadataJson.trim())
|
|
961
|
+
return null;
|
|
962
|
+
try {
|
|
963
|
+
const parsed = JSON.parse(metadataJson);
|
|
964
|
+
if (Number(parsed?.entityId) !== id || !Array.isArray(parsed?.values)) {
|
|
965
|
+
return null;
|
|
966
|
+
}
|
|
967
|
+
return { entityId: id, values: parsed.values };
|
|
968
|
+
}
|
|
969
|
+
catch {
|
|
970
|
+
return null;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
954
973
|
function createSelectionEditorState(base) {
|
|
955
974
|
return {
|
|
956
975
|
base,
|
|
957
976
|
ids: positiveIds(base?.entityIds),
|
|
958
977
|
names: {},
|
|
978
|
+
records: {},
|
|
959
979
|
mutationId: null,
|
|
960
980
|
mutationKey: null,
|
|
961
981
|
};
|
|
@@ -987,11 +1007,16 @@ function applySelectionPicks(state, picks, multiple) {
|
|
|
987
1007
|
const kept = state.ids.filter((id) => chosen.includes(id));
|
|
988
1008
|
const added = chosen.filter((id) => !kept.includes(id));
|
|
989
1009
|
const names = { ...state.names };
|
|
1010
|
+
const records = { ...state.records };
|
|
990
1011
|
for (const pick of picks) {
|
|
991
|
-
if (added.includes(pick.id)
|
|
1012
|
+
if (!added.includes(pick.id))
|
|
1013
|
+
continue;
|
|
1014
|
+
if (pick.name)
|
|
992
1015
|
names[pick.id] = pick.name;
|
|
1016
|
+
if (pick.record)
|
|
1017
|
+
records[pick.id] = pick.record;
|
|
993
1018
|
}
|
|
994
|
-
return { ...state, ids: [...kept, ...added], names };
|
|
1019
|
+
return { ...state, ids: [...kept, ...added], names, records };
|
|
995
1020
|
}
|
|
996
1021
|
function removeSelectedRecord(state, id) {
|
|
997
1022
|
return { ...state, ids: state.ids.filter((entry) => entry !== id) };
|
|
@@ -1117,10 +1142,11 @@ class EntityListSelectionDialog {
|
|
|
1117
1142
|
this.ref.close(null);
|
|
1118
1143
|
}
|
|
1119
1144
|
onApply() {
|
|
1120
|
-
const
|
|
1145
|
+
const listed = new Map(this.items().map((item) => [item.id, item]));
|
|
1121
1146
|
const picks = [...this.picked()].map(([id, name]) => ({
|
|
1122
1147
|
id,
|
|
1123
|
-
name: name ||
|
|
1148
|
+
name: name || listed.get(id)?.name || '',
|
|
1149
|
+
record: listed.get(id)?.record ?? null,
|
|
1124
1150
|
}));
|
|
1125
1151
|
this.ref.close(picks);
|
|
1126
1152
|
}
|
|
@@ -1189,7 +1215,11 @@ class EntityListSelectionDialog {
|
|
|
1189
1215
|
const id = Number(item?.key);
|
|
1190
1216
|
if (!Number.isInteger(id) || id <= 0)
|
|
1191
1217
|
continue;
|
|
1192
|
-
page.push({
|
|
1218
|
+
page.push({
|
|
1219
|
+
id,
|
|
1220
|
+
name: item.name?.trim() || `#${id}`,
|
|
1221
|
+
record: parseOptionRecord(item.metadataJson, id),
|
|
1222
|
+
});
|
|
1193
1223
|
}
|
|
1194
1224
|
const seen = new Set(this.items().map((item) => item.id));
|
|
1195
1225
|
this.items.set([
|
|
@@ -1200,7 +1230,7 @@ class EntityListSelectionDialog {
|
|
|
1200
1230
|
this.nextSkip = skip + PAGE_SIZE$1;
|
|
1201
1231
|
}
|
|
1202
1232
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListSelectionDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1203
|
-
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'\">\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 (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 });
|
|
1233
|
+
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'\">\r\n <mt-text-field\r\n [formControl]=\"searchControl\"\r\n icon=\"general.search-md\"\r\n [placeholder]=\"'components.entityListField.searchRecords' | transloco\"\r\n />\r\n\r\n @if (multiple()) {\r\n <p\r\n class=\"text-xs\"\r\n [class.text-muted-color]=\"!atLimit()\"\r\n [class.text-amber-700]=\"atLimit()\"\r\n >\r\n {{\r\n (atLimit()\r\n ? \"components.entityListField.selectionLimit\"\r\n : \"components.entityListField.selectedCount\"\r\n ) | transloco: { count: pickedCount(), max: maxSelections }\r\n }}\r\n </p>\r\n }\r\n\r\n @if (failureKey(); as failure) {\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 {{ failure | transloco }}\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-40 flex-col gap-1 overflow-y-auto\"\r\n role=\"listbox\"\r\n [attr.aria-multiselectable]=\"multiple()\"\r\n >\r\n @for (item of items(); track item.id) {\r\n @let chosen = isPicked(item.id);\r\n <button\r\n type=\"button\"\r\n role=\"option\"\r\n [attr.aria-selected]=\"chosen\"\r\n [disabled]=\"!chosen && atLimit()\"\r\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\"\r\n [class.border-primary]=\"chosen\"\r\n [class.bg-primary-50]=\"chosen\"\r\n [class.border-surface]=\"!chosen\"\r\n (click)=\"toggle(item)\"\r\n >\r\n <span\r\n class=\"flex size-4 shrink-0 items-center justify-center border\"\r\n [class.rounded-sm]=\"multiple()\"\r\n [class.rounded-full]=\"!multiple()\"\r\n [class.border-primary]=\"chosen\"\r\n [class.bg-primary]=\"chosen\"\r\n [class.text-primary-contrast]=\"chosen\"\r\n [class.border-surface-400]=\"!chosen\"\r\n >\r\n @if (chosen) {\r\n <mt-icon icon=\"general.check\" class=\"text-[0.625rem]\" />\r\n }\r\n </span>\r\n <span class=\"min-w-0 flex-1 truncate text-color\">{{\r\n item.name\r\n }}</span>\r\n </button>\r\n }\r\n\r\n @if (loading()) {\r\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\r\n } @else if (!items().length) {\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.noCandidates\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n\r\n @if (hasMore() && !loading()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n [label]=\"'components.entityListField.loadMore' | transloco\"\r\n variant=\"text\"\r\n size=\"small\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n }\r\n</div>\r\n\r\n<div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"'components.entityListField.cancel' | transloco\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"onCancel()\"\r\n />\r\n <mt-button\r\n [label]=\"'components.entityListField.apply' | transloco\"\r\n severity=\"primary\"\r\n [disabled]=\"!!failureKey()\"\r\n (onClick)=\"onApply()\"\r\n />\r\n</div>\r\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 });
|
|
1204
1234
|
}
|
|
1205
1235
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListSelectionDialog, decorators: [{
|
|
1206
1236
|
type: Component,
|
|
@@ -1211,7 +1241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1211
1241
|
Icon,
|
|
1212
1242
|
Button,
|
|
1213
1243
|
TextField,
|
|
1214
|
-
], 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 (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" }]
|
|
1244
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"modal.contentClass + ' flex max-h-[70vh] flex-col gap-3 p-4'\">\r\n <mt-text-field\r\n [formControl]=\"searchControl\"\r\n icon=\"general.search-md\"\r\n [placeholder]=\"'components.entityListField.searchRecords' | transloco\"\r\n />\r\n\r\n @if (multiple()) {\r\n <p\r\n class=\"text-xs\"\r\n [class.text-muted-color]=\"!atLimit()\"\r\n [class.text-amber-700]=\"atLimit()\"\r\n >\r\n {{\r\n (atLimit()\r\n ? \"components.entityListField.selectionLimit\"\r\n : \"components.entityListField.selectedCount\"\r\n ) | transloco: { count: pickedCount(), max: maxSelections }\r\n }}\r\n </p>\r\n }\r\n\r\n @if (failureKey(); as failure) {\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 {{ failure | transloco }}\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-40 flex-col gap-1 overflow-y-auto\"\r\n role=\"listbox\"\r\n [attr.aria-multiselectable]=\"multiple()\"\r\n >\r\n @for (item of items(); track item.id) {\r\n @let chosen = isPicked(item.id);\r\n <button\r\n type=\"button\"\r\n role=\"option\"\r\n [attr.aria-selected]=\"chosen\"\r\n [disabled]=\"!chosen && atLimit()\"\r\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\"\r\n [class.border-primary]=\"chosen\"\r\n [class.bg-primary-50]=\"chosen\"\r\n [class.border-surface]=\"!chosen\"\r\n (click)=\"toggle(item)\"\r\n >\r\n <span\r\n class=\"flex size-4 shrink-0 items-center justify-center border\"\r\n [class.rounded-sm]=\"multiple()\"\r\n [class.rounded-full]=\"!multiple()\"\r\n [class.border-primary]=\"chosen\"\r\n [class.bg-primary]=\"chosen\"\r\n [class.text-primary-contrast]=\"chosen\"\r\n [class.border-surface-400]=\"!chosen\"\r\n >\r\n @if (chosen) {\r\n <mt-icon icon=\"general.check\" class=\"text-[0.625rem]\" />\r\n }\r\n </span>\r\n <span class=\"min-w-0 flex-1 truncate text-color\">{{\r\n item.name\r\n }}</span>\r\n </button>\r\n }\r\n\r\n @if (loading()) {\r\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"2.5rem\" borderRadius=\"0.375rem\" />\r\n } @else if (!items().length) {\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.noCandidates\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n\r\n @if (hasMore() && !loading()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n [label]=\"'components.entityListField.loadMore' | transloco\"\r\n variant=\"text\"\r\n size=\"small\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n }\r\n</div>\r\n\r\n<div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"'components.entityListField.cancel' | transloco\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"onCancel()\"\r\n />\r\n <mt-button\r\n [label]=\"'components.entityListField.apply' | transloco\"\r\n severity=\"primary\"\r\n [disabled]=\"!!failureKey()\"\r\n (onClick)=\"onApply()\"\r\n />\r\n</div>\r\n" }]
|
|
1215
1245
|
}], 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 }] }] } });
|
|
1216
1246
|
|
|
1217
1247
|
function resolveMetadataFailure(status) {
|
|
@@ -1422,6 +1452,19 @@ class EntityListField {
|
|
|
1422
1452
|
* value keys.
|
|
1423
1453
|
*/
|
|
1424
1454
|
writeFields = computed(() => this.metadata()?.writeFields ?? [], ...(ngDevMode ? [{ debugName: "writeFields" }] : /* istanbul ignore next */ []));
|
|
1455
|
+
/**
|
|
1456
|
+
* Write fields a new row must fill: the target's required, non-calculated
|
|
1457
|
+
* properties. The backend rejects a create row without any of them
|
|
1458
|
+
* (`entity_list.required_field_missing`), while the target module's form —
|
|
1459
|
+
* which the add dialog renders — may mark fewer required.
|
|
1460
|
+
*/
|
|
1461
|
+
createRequiredFields = computed(() => {
|
|
1462
|
+
const properties = this.propertyByKey();
|
|
1463
|
+
return this.writeFields().filter((key) => {
|
|
1464
|
+
const property = properties.get(key);
|
|
1465
|
+
return !!property?.isRequired && !property.isCalculated;
|
|
1466
|
+
});
|
|
1467
|
+
}, ...(ngDevMode ? [{ debugName: "createRequiredFields" }] : /* istanbul ignore next */ []));
|
|
1425
1468
|
/**
|
|
1426
1469
|
* Pending create/update rows, in the exact shape persisted by the backend
|
|
1427
1470
|
* (`rows[]` of the stored EntityList JSON). Rows with `entityId > 0` are
|
|
@@ -1849,8 +1892,9 @@ class EntityListField {
|
|
|
1849
1892
|
*
|
|
1850
1893
|
* A saved record renders from the backend's `records`, cell by cell against
|
|
1851
1894
|
* the metadata columns — the same cells a related list shows. A record
|
|
1852
|
-
* picked in this session
|
|
1853
|
-
*
|
|
1895
|
+
* picked in this session renders the display values its option carried
|
|
1896
|
+
* (`metadataJson`) the same way; an older backend sends none, and the row
|
|
1897
|
+
* then shows its name and "Shown after saving". A record in `unavailableIds` was
|
|
1854
1898
|
* deleted or is no longer visible: the backend keeps it selected but
|
|
1855
1899
|
* withholds its values, and the row says so, so the user can remove it.
|
|
1856
1900
|
*/
|
|
@@ -1861,35 +1905,129 @@ class EntityListField {
|
|
|
1861
1905
|
const records = new Map((state.base?.records ?? []).map((record) => [record.entityId, record]));
|
|
1862
1906
|
const unavailable = new Set(state.base?.unavailableIds ?? []);
|
|
1863
1907
|
return state.ids.map((id) => {
|
|
1908
|
+
// A loaded record renders the backend's values for it; a record picked
|
|
1909
|
+
// in this session renders the picker's display values, when sent.
|
|
1910
|
+
const record = records.get(id) ?? state.records[id];
|
|
1911
|
+
if (record)
|
|
1912
|
+
return this.recordRow(record, columns, properties);
|
|
1864
1913
|
const row = {
|
|
1865
1914
|
Id: id,
|
|
1866
1915
|
[ROW_ID_KEY]: `entity-${id}`,
|
|
1867
1916
|
[ROW_ENTITY_ID_KEY]: id,
|
|
1868
1917
|
};
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
const values = new Map((record.values ?? []).map((item) => [item.propertyKey, item]));
|
|
1872
|
-
for (const column of columns) {
|
|
1873
|
-
const propertyKey = column.propertyKey ?? column.key;
|
|
1874
|
-
const item = values.get(propertyKey) ?? values.get(column.key);
|
|
1875
|
-
row[column.key] = this.toEntityData(column, item ? { raw: item.rawValue, value: item.value } : undefined, properties.get(propertyKey), id);
|
|
1876
|
-
}
|
|
1877
|
-
return row;
|
|
1878
|
-
}
|
|
1879
|
-
const label = unavailable.has(id)
|
|
1918
|
+
const isUnavailable = unavailable.has(id);
|
|
1919
|
+
const label = isUnavailable
|
|
1880
1920
|
? this.transloco.translate('components.entityListField.unavailableRecord', { id }, this.lang())
|
|
1881
1921
|
: state.names[id] || `#${id}`;
|
|
1922
|
+
// The picker returns only names; the other values are rendered once the
|
|
1923
|
+
// parent is saved. Say so rather than show a known value as empty.
|
|
1924
|
+
const pending = isUnavailable
|
|
1925
|
+
? ''
|
|
1926
|
+
: this.transloco.translate('components.entityListField.shownAfterSave', {}, this.lang());
|
|
1882
1927
|
columns.forEach((column, index) => {
|
|
1883
1928
|
row[column.key] = {
|
|
1884
1929
|
key: column.key,
|
|
1885
1930
|
name: column.label,
|
|
1886
1931
|
viewType: 'Text',
|
|
1887
|
-
value: index === 0 ? label :
|
|
1932
|
+
value: index === 0 ? label : pending,
|
|
1888
1933
|
};
|
|
1889
1934
|
});
|
|
1890
1935
|
return row;
|
|
1891
1936
|
});
|
|
1892
1937
|
}, ...(ngDevMode ? [{ debugName: "selectionRows" }] : /* istanbul ignore next */ []));
|
|
1938
|
+
/**
|
|
1939
|
+
* One table row from a rendered record — `{ entityId, values }` with each
|
|
1940
|
+
* value's `rawValue` and rendered `value` — cell by cell against the
|
|
1941
|
+
* metadata columns, the same cells a related list shows. Selected `records`
|
|
1942
|
+
* and the comparison's preserved / live rows all have this shape.
|
|
1943
|
+
*/
|
|
1944
|
+
recordRow(record, columns, properties) {
|
|
1945
|
+
const id = record.entityId;
|
|
1946
|
+
const row = {
|
|
1947
|
+
Id: id,
|
|
1948
|
+
[ROW_ID_KEY]: `entity-${id}`,
|
|
1949
|
+
[ROW_ENTITY_ID_KEY]: id,
|
|
1950
|
+
};
|
|
1951
|
+
const values = new Map((record.values ?? []).map((item) => [item.propertyKey, item]));
|
|
1952
|
+
for (const column of columns) {
|
|
1953
|
+
const propertyKey = column.propertyKey ?? column.key;
|
|
1954
|
+
const item = values.get(propertyKey) ?? values.get(column.key);
|
|
1955
|
+
row[column.key] = this.toEntityData(column, item ? { raw: item.rawValue, value: item.value } : undefined, properties.get(propertyKey), id);
|
|
1956
|
+
}
|
|
1957
|
+
return row;
|
|
1958
|
+
}
|
|
1959
|
+
// ============================================================================
|
|
1960
|
+
// Saved Related list — preserved and current values (`entity-lists/comparison`)
|
|
1961
|
+
// ============================================================================
|
|
1962
|
+
/** The comparison response, once loaded. */
|
|
1963
|
+
comparison = signal(null, ...(ngDevMode ? [{ debugName: "comparison" }] : /* istanbul ignore next */ []));
|
|
1964
|
+
/**
|
|
1965
|
+
* The record that owns the list, when the host named it (a table cell's
|
|
1966
|
+
* drawer). Only a read-only list reads its comparison: an editable one
|
|
1967
|
+
* edits the source records it queries.
|
|
1968
|
+
*/
|
|
1969
|
+
comparisonOwner = computed(() => {
|
|
1970
|
+
const context = this.runtimeContext();
|
|
1971
|
+
const ownerId = Number(context?.ownerId);
|
|
1972
|
+
if (!this.readonly() || !context?.ownerKind || !(ownerId > 0)) {
|
|
1973
|
+
return null;
|
|
1974
|
+
}
|
|
1975
|
+
return { ownerKind: context.ownerKind, ownerId };
|
|
1976
|
+
}, ...(ngDevMode ? [{ debugName: "comparisonOwner" }] : /* istanbul ignore next */ []));
|
|
1977
|
+
/**
|
|
1978
|
+
* A saved Related list viewed from outside its form: the values preserved
|
|
1979
|
+
* when it was saved beside the source records' current ones. Local and
|
|
1980
|
+
* Selected lists hold their own rows and never compare.
|
|
1981
|
+
*/
|
|
1982
|
+
comparisonMode = computed(() => !!this.comparisonOwner() &&
|
|
1983
|
+
!!this.metadata() &&
|
|
1984
|
+
!this.localMode() &&
|
|
1985
|
+
!this.selectionMode() &&
|
|
1986
|
+
this.moduleBacked(), ...(ngDevMode ? [{ debugName: "comparisonMode" }] : /* istanbul ignore next */ []));
|
|
1987
|
+
comparisonReady = computed(() => this.comparisonMode() && !!this.comparison(), ...(ngDevMode ? [{ debugName: "comparisonReady" }] : /* istanbul ignore next */ []));
|
|
1988
|
+
liveRows = computed(() => {
|
|
1989
|
+
const columns = this.columns();
|
|
1990
|
+
const properties = this.propertyByKey();
|
|
1991
|
+
return (this.comparison()?.live ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
1992
|
+
}, ...(ngDevMode ? [{ debugName: "liveRows" }] : /* istanbul ignore next */ []));
|
|
1993
|
+
preservedRows = computed(() => {
|
|
1994
|
+
const columns = this.columns();
|
|
1995
|
+
const properties = this.propertyByKey();
|
|
1996
|
+
return (this.comparison()?.preserved ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
1997
|
+
}, ...(ngDevMode ? [{ debugName: "preservedRows" }] : /* istanbul ignore next */ []));
|
|
1998
|
+
/** No baseline was captured yet — not the same as an empty saved list. */
|
|
1999
|
+
preservedAvailable = computed(() => this.comparison()?.preservedAvailable === true, ...(ngDevMode ? [{ debugName: "preservedAvailable" }] : /* istanbul ignore next */ []));
|
|
2000
|
+
preservedAt = computed(() => this.comparison()?.preservedAt ?? null, ...(ngDevMode ? [{ debugName: "preservedAt" }] : /* istanbul ignore next */ []));
|
|
2001
|
+
unavailableCount = computed(() => this.comparison()?.unavailableIds?.length ?? 0, ...(ngDevMode ? [{ debugName: "unavailableCount" }] : /* istanbul ignore next */ []));
|
|
2002
|
+
fetchComparison(propertyId) {
|
|
2003
|
+
const owner = this.comparisonOwner();
|
|
2004
|
+
if (!owner)
|
|
2005
|
+
return;
|
|
2006
|
+
this.loading.set(true);
|
|
2007
|
+
const ctx = this.context();
|
|
2008
|
+
this.fetchSubscription = this.http
|
|
2009
|
+
.get('entity-lists/comparison', {
|
|
2010
|
+
params: {
|
|
2011
|
+
ownerKind: owner.ownerKind,
|
|
2012
|
+
ownerId: String(owner.ownerId),
|
|
2013
|
+
propertyId: String(propertyId),
|
|
2014
|
+
},
|
|
2015
|
+
// `403` / `404` are rendered as notices, not toasts.
|
|
2016
|
+
headers: { noMessage: 'true' },
|
|
2017
|
+
...(ctx ? { context: ctx } : {}),
|
|
2018
|
+
})
|
|
2019
|
+
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.loading.set(false)))
|
|
2020
|
+
.subscribe({
|
|
2021
|
+
next: (response) => this.comparison.set(response),
|
|
2022
|
+
error: (error) => {
|
|
2023
|
+
const failure = resolveMetadataFailure(error.status);
|
|
2024
|
+
this.metadataFailure.set(failure);
|
|
2025
|
+
if (failure === 'failed') {
|
|
2026
|
+
this.errorMessage.set(this.transloco.translate('components.entityListField.loadFailed'));
|
|
2027
|
+
}
|
|
2028
|
+
},
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
1893
2031
|
selectionRowActions = computed(() => {
|
|
1894
2032
|
this.lang();
|
|
1895
2033
|
if (!this.selectionWritable())
|
|
@@ -2104,6 +2242,7 @@ class EntityListField {
|
|
|
2104
2242
|
if (this.isEchoOfLastEmit(incoming))
|
|
2105
2243
|
return;
|
|
2106
2244
|
this.lastEmittedJson = null;
|
|
2245
|
+
this.linkedMutation = null;
|
|
2107
2246
|
this.storedValue.set(incoming);
|
|
2108
2247
|
// Restore rows the backend left unprocessed. Whether the loaded
|
|
2109
2248
|
// `deletedIds` are historical markers or pending intent depends on the
|
|
@@ -2239,6 +2378,7 @@ class EntityListField {
|
|
|
2239
2378
|
levelId: this.levelId(),
|
|
2240
2379
|
levelDataId: this.levelDataId(),
|
|
2241
2380
|
writeFields: this.writeFields(),
|
|
2381
|
+
requiredFieldKeys: this.createRequiredFields(),
|
|
2242
2382
|
lookups: this.lookups(),
|
|
2243
2383
|
},
|
|
2244
2384
|
});
|
|
@@ -2284,6 +2424,9 @@ class EntityListField {
|
|
|
2284
2424
|
levelId: this.levelId(),
|
|
2285
2425
|
levelDataId: this.levelDataId(),
|
|
2286
2426
|
writeFields: this.writeFields(),
|
|
2427
|
+
// A row not saved yet is still a create; an existing record's update
|
|
2428
|
+
// carries only what changed.
|
|
2429
|
+
requiredFieldKeys: entityId > 0 ? [] : this.createRequiredFields(),
|
|
2287
2430
|
lookups: this.lookups(),
|
|
2288
2431
|
initialValues: prefillValues,
|
|
2289
2432
|
isEdit: true,
|
|
@@ -2740,23 +2883,27 @@ class EntityListField {
|
|
|
2740
2883
|
// Submit payload (see EntityList.md — "Stored Value Shape")
|
|
2741
2884
|
// ============================================================================
|
|
2742
2885
|
emitValue() {
|
|
2743
|
-
|
|
2744
|
-
// `
|
|
2745
|
-
//
|
|
2746
|
-
// and
|
|
2747
|
-
const
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
rawValue,
|
|
2757
|
-
})),
|
|
2886
|
+
// `entityIds` / `createdIds` / `updatedIds` / `snapshot`, and the loaded
|
|
2887
|
+
// `version` / `expectedVersions`, are backend-owned and passed through
|
|
2888
|
+
// untouched; the frontend only contributes pending rows, delete intents
|
|
2889
|
+
// and the change's id. `live` is response-only and stays behind.
|
|
2890
|
+
const { live: _live, ...current } = this.storedValue() ?? {};
|
|
2891
|
+
// `values[].value` is the backend's rendered label, carried only so the
|
|
2892
|
+
// table can print it. Submitting it back would echo a user object where
|
|
2893
|
+
// the stored scalar belongs.
|
|
2894
|
+
const rows = this.pendingRows().map((row) => ({
|
|
2895
|
+
...row,
|
|
2896
|
+
values: (row.values ?? []).map(({ propertyKey, rawValue }) => ({
|
|
2897
|
+
propertyKey,
|
|
2898
|
+
rawValue,
|
|
2758
2899
|
})),
|
|
2759
|
-
|
|
2900
|
+
}));
|
|
2901
|
+
const deletedIds = this.deletedIds();
|
|
2902
|
+
const next = {
|
|
2903
|
+
...current,
|
|
2904
|
+
rows,
|
|
2905
|
+
deletedIds,
|
|
2906
|
+
...this.linkedMutationId(current, rows, deletedIds),
|
|
2760
2907
|
};
|
|
2761
2908
|
this.storedValue.set(next);
|
|
2762
2909
|
this.lastEmittedJson = JSON.stringify({
|
|
@@ -2766,6 +2913,30 @@ class EntityListField {
|
|
|
2766
2913
|
this.onModelChange(next);
|
|
2767
2914
|
this.onTouched();
|
|
2768
2915
|
}
|
|
2916
|
+
/**
|
|
2917
|
+
* The id of the change a Related list's value carries. The backend rejects
|
|
2918
|
+
* a Related change without one (`entity_list.invalid_payload`), and the form
|
|
2919
|
+
* load sends it empty — so a value with rows or deletions gets its own: the
|
|
2920
|
+
* same while the change is (a retry of the same save), a new one when it
|
|
2921
|
+
* differs, since reusing an id for other content is refused
|
|
2922
|
+
* (`entity_list.linked_mutation_reused`). A value with nothing to apply keeps
|
|
2923
|
+
* what it loaded with; the backend skips it.
|
|
2924
|
+
*/
|
|
2925
|
+
linkedMutation = null;
|
|
2926
|
+
linkedMutationId(current, rows, deletedIds) {
|
|
2927
|
+
if (rows.length === 0 && deletedIds.length === 0)
|
|
2928
|
+
return {};
|
|
2929
|
+
const version = Number(current.version ?? 0) || 0;
|
|
2930
|
+
const key = JSON.stringify({ version, rows, deletedIds });
|
|
2931
|
+
if (this.linkedMutation?.key !== key) {
|
|
2932
|
+
this.linkedMutation = { key, id: newLocalUuid() };
|
|
2933
|
+
}
|
|
2934
|
+
return {
|
|
2935
|
+
version,
|
|
2936
|
+
mutationId: this.linkedMutation.id,
|
|
2937
|
+
expectedVersions: current.expectedVersions ?? {},
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2769
2940
|
/**
|
|
2770
2941
|
* `values[]` entries, restricted to `writeFields` when configured.
|
|
2771
2942
|
*
|
|
@@ -2887,6 +3058,7 @@ class EntityListField {
|
|
|
2887
3058
|
this.metadataFailure.set(null);
|
|
2888
3059
|
this.columns.set([]);
|
|
2889
3060
|
this.rows.set([]);
|
|
3061
|
+
this.comparison.set(null);
|
|
2890
3062
|
this.errorMessage.set(null);
|
|
2891
3063
|
this.loading.set(false);
|
|
2892
3064
|
if (!(propertyId > 0) || levelId == null || !(Number(levelId) > 0))
|
|
@@ -2938,6 +3110,12 @@ class EntityListField {
|
|
|
2938
3110
|
this.loading.set(false);
|
|
2939
3111
|
return;
|
|
2940
3112
|
}
|
|
3113
|
+
// A saved Related list opened from outside its form shows what was
|
|
3114
|
+
// preserved and what is current, not whatever the source holds today.
|
|
3115
|
+
if (this.comparisonMode()) {
|
|
3116
|
+
this.fetchComparison(metadata.propertyId);
|
|
3117
|
+
return;
|
|
3118
|
+
}
|
|
2941
3119
|
if (!this.moduleBacked() ||
|
|
2942
3120
|
!this.canRead() ||
|
|
2943
3121
|
levelDataId == null ||
|
|
@@ -3109,7 +3287,7 @@ class EntityListField {
|
|
|
3109
3287
|
};
|
|
3110
3288
|
}
|
|
3111
3289
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3112
|
-
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.\n -->\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]=\"localColumns()\"\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 } @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.\n -->\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]=\"columns()\"\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 } @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", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { 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: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3290
|
+
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.\n -->\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]=\"localColumns()\"\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 } @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.\n -->\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]=\"columns()\"\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 } @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 <section class=\"flex flex-col gap-2\">\n <h4 class=\"text-sm font-semibold text-color\">\n {{ \"components.entityListField.currentValues\" | transloco }}\n </h4>\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"columns()\"\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 </section>\n\n <section class=\"flex flex-col gap-2\">\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 @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]=\"columns()\"\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 }\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", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { 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: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3113
3291
|
}
|
|
3114
3292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
|
|
3115
3293
|
type: Component,
|
|
@@ -3121,7 +3299,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3121
3299
|
Table,
|
|
3122
3300
|
Button,
|
|
3123
3301
|
TranslocoPipe,
|
|
3124
|
-
|
|
3302
|
+
MTDateFormatPipe,
|
|
3303
|
+
], 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.\n -->\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]=\"localColumns()\"\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 } @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.\n -->\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]=\"columns()\"\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 } @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 <section class=\"flex flex-col gap-2\">\n <h4 class=\"text-sm font-semibold text-color\">\n {{ \"components.entityListField.currentValues\" | transloco }}\n </h4>\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"columns()\"\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 </section>\n\n <section class=\"flex flex-col gap-2\">\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 @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]=\"columns()\"\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 }\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", styles: [":host{display:block}\n"] }]
|
|
3125
3304
|
}], 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 }] }] } });
|
|
3126
3305
|
|
|
3127
3306
|
/**
|