@masterteam/components 0.0.303 → 0.0.304
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 -1
- package/assets/i18n/en.json +2 -1
- package/fesm2022/masterteam-components-business-fields.mjs +115 -30
- 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 +32 -2
- package/types/masterteam-components-entities.d.ts +117 -77
package/assets/i18n/ar.json
CHANGED
|
@@ -140,7 +140,8 @@
|
|
|
140
140
|
"selectedCount": "تم اختيار {{count}}",
|
|
141
141
|
"selectionLimit": "تم اختيار {{count}} — الحد الأقصى {{max}}.",
|
|
142
142
|
"selectionUnavailable": "لا يمكن اختيار السجلات هنا.",
|
|
143
|
-
"selectionLoadFailed": "تعذّر تحميل السجلات المتاحة للاختيار."
|
|
143
|
+
"selectionLoadFailed": "تعذّر تحميل السجلات المتاحة للاختيار.",
|
|
144
|
+
"shownAfterSave": "يظهر بعد الحفظ"
|
|
144
145
|
},
|
|
145
146
|
"entityListPreview": {
|
|
146
147
|
"view": "عرض القائمة",
|
package/assets/i18n/en.json
CHANGED
|
@@ -140,7 +140,8 @@
|
|
|
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"
|
|
144
145
|
},
|
|
145
146
|
"entityListPreview": {
|
|
146
147
|
"view": "View list",
|
|
@@ -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
|
*/
|
|
@@ -1866,7 +1910,9 @@ class EntityListField {
|
|
|
1866
1910
|
[ROW_ID_KEY]: `entity-${id}`,
|
|
1867
1911
|
[ROW_ENTITY_ID_KEY]: id,
|
|
1868
1912
|
};
|
|
1869
|
-
|
|
1913
|
+
// A loaded record renders the backend's values for it; a record picked
|
|
1914
|
+
// in this session renders the picker's display values, when sent.
|
|
1915
|
+
const record = records.get(id) ?? state.records[id];
|
|
1870
1916
|
if (record) {
|
|
1871
1917
|
const values = new Map((record.values ?? []).map((item) => [item.propertyKey, item]));
|
|
1872
1918
|
for (const column of columns) {
|
|
@@ -1876,15 +1922,21 @@ class EntityListField {
|
|
|
1876
1922
|
}
|
|
1877
1923
|
return row;
|
|
1878
1924
|
}
|
|
1879
|
-
const
|
|
1925
|
+
const isUnavailable = unavailable.has(id);
|
|
1926
|
+
const label = isUnavailable
|
|
1880
1927
|
? this.transloco.translate('components.entityListField.unavailableRecord', { id }, this.lang())
|
|
1881
1928
|
: state.names[id] || `#${id}`;
|
|
1929
|
+
// The picker returns only names; the other values are rendered once the
|
|
1930
|
+
// parent is saved. Say so rather than show a known value as empty.
|
|
1931
|
+
const pending = isUnavailable
|
|
1932
|
+
? ''
|
|
1933
|
+
: this.transloco.translate('components.entityListField.shownAfterSave', {}, this.lang());
|
|
1882
1934
|
columns.forEach((column, index) => {
|
|
1883
1935
|
row[column.key] = {
|
|
1884
1936
|
key: column.key,
|
|
1885
1937
|
name: column.label,
|
|
1886
1938
|
viewType: 'Text',
|
|
1887
|
-
value: index === 0 ? label :
|
|
1939
|
+
value: index === 0 ? label : pending,
|
|
1888
1940
|
};
|
|
1889
1941
|
});
|
|
1890
1942
|
return row;
|
|
@@ -2104,6 +2156,7 @@ class EntityListField {
|
|
|
2104
2156
|
if (this.isEchoOfLastEmit(incoming))
|
|
2105
2157
|
return;
|
|
2106
2158
|
this.lastEmittedJson = null;
|
|
2159
|
+
this.linkedMutation = null;
|
|
2107
2160
|
this.storedValue.set(incoming);
|
|
2108
2161
|
// Restore rows the backend left unprocessed. Whether the loaded
|
|
2109
2162
|
// `deletedIds` are historical markers or pending intent depends on the
|
|
@@ -2239,6 +2292,7 @@ class EntityListField {
|
|
|
2239
2292
|
levelId: this.levelId(),
|
|
2240
2293
|
levelDataId: this.levelDataId(),
|
|
2241
2294
|
writeFields: this.writeFields(),
|
|
2295
|
+
requiredFieldKeys: this.createRequiredFields(),
|
|
2242
2296
|
lookups: this.lookups(),
|
|
2243
2297
|
},
|
|
2244
2298
|
});
|
|
@@ -2284,6 +2338,9 @@ class EntityListField {
|
|
|
2284
2338
|
levelId: this.levelId(),
|
|
2285
2339
|
levelDataId: this.levelDataId(),
|
|
2286
2340
|
writeFields: this.writeFields(),
|
|
2341
|
+
// A row not saved yet is still a create; an existing record's update
|
|
2342
|
+
// carries only what changed.
|
|
2343
|
+
requiredFieldKeys: entityId > 0 ? [] : this.createRequiredFields(),
|
|
2287
2344
|
lookups: this.lookups(),
|
|
2288
2345
|
initialValues: prefillValues,
|
|
2289
2346
|
isEdit: true,
|
|
@@ -2740,23 +2797,27 @@ class EntityListField {
|
|
|
2740
2797
|
// Submit payload (see EntityList.md — "Stored Value Shape")
|
|
2741
2798
|
// ============================================================================
|
|
2742
2799
|
emitValue() {
|
|
2743
|
-
|
|
2744
|
-
// `
|
|
2745
|
-
//
|
|
2746
|
-
// and
|
|
2747
|
-
const
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
rawValue,
|
|
2757
|
-
})),
|
|
2800
|
+
// `entityIds` / `createdIds` / `updatedIds` / `snapshot`, and the loaded
|
|
2801
|
+
// `version` / `expectedVersions`, are backend-owned and passed through
|
|
2802
|
+
// untouched; the frontend only contributes pending rows, delete intents
|
|
2803
|
+
// and the change's id. `live` is response-only and stays behind.
|
|
2804
|
+
const { live: _live, ...current } = this.storedValue() ?? {};
|
|
2805
|
+
// `values[].value` is the backend's rendered label, carried only so the
|
|
2806
|
+
// table can print it. Submitting it back would echo a user object where
|
|
2807
|
+
// the stored scalar belongs.
|
|
2808
|
+
const rows = this.pendingRows().map((row) => ({
|
|
2809
|
+
...row,
|
|
2810
|
+
values: (row.values ?? []).map(({ propertyKey, rawValue }) => ({
|
|
2811
|
+
propertyKey,
|
|
2812
|
+
rawValue,
|
|
2758
2813
|
})),
|
|
2759
|
-
|
|
2814
|
+
}));
|
|
2815
|
+
const deletedIds = this.deletedIds();
|
|
2816
|
+
const next = {
|
|
2817
|
+
...current,
|
|
2818
|
+
rows,
|
|
2819
|
+
deletedIds,
|
|
2820
|
+
...this.linkedMutationId(current, rows, deletedIds),
|
|
2760
2821
|
};
|
|
2761
2822
|
this.storedValue.set(next);
|
|
2762
2823
|
this.lastEmittedJson = JSON.stringify({
|
|
@@ -2766,6 +2827,30 @@ class EntityListField {
|
|
|
2766
2827
|
this.onModelChange(next);
|
|
2767
2828
|
this.onTouched();
|
|
2768
2829
|
}
|
|
2830
|
+
/**
|
|
2831
|
+
* The id of the change a Related list's value carries. The backend rejects
|
|
2832
|
+
* a Related change without one (`entity_list.invalid_payload`), and the form
|
|
2833
|
+
* load sends it empty — so a value with rows or deletions gets its own: the
|
|
2834
|
+
* same while the change is (a retry of the same save), a new one when it
|
|
2835
|
+
* differs, since reusing an id for other content is refused
|
|
2836
|
+
* (`entity_list.linked_mutation_reused`). A value with nothing to apply keeps
|
|
2837
|
+
* what it loaded with; the backend skips it.
|
|
2838
|
+
*/
|
|
2839
|
+
linkedMutation = null;
|
|
2840
|
+
linkedMutationId(current, rows, deletedIds) {
|
|
2841
|
+
if (rows.length === 0 && deletedIds.length === 0)
|
|
2842
|
+
return {};
|
|
2843
|
+
const version = Number(current.version ?? 0) || 0;
|
|
2844
|
+
const key = JSON.stringify({ version, rows, deletedIds });
|
|
2845
|
+
if (this.linkedMutation?.key !== key) {
|
|
2846
|
+
this.linkedMutation = { key, id: newLocalUuid() };
|
|
2847
|
+
}
|
|
2848
|
+
return {
|
|
2849
|
+
version,
|
|
2850
|
+
mutationId: this.linkedMutation.id,
|
|
2851
|
+
expectedVersions: current.expectedVersions ?? {},
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2769
2854
|
/**
|
|
2770
2855
|
* `values[]` entries, restricted to `writeFields` when configured.
|
|
2771
2856
|
*
|
|
@@ -3109,7 +3194,7 @@ class EntityListField {
|
|
|
3109
3194
|
};
|
|
3110
3195
|
}
|
|
3111
3196
|
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 });
|
|
3197
|
+
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.\r\n -->\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 } @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.\r\n -->\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 } @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", 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 });
|
|
3113
3198
|
}
|
|
3114
3199
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
|
|
3115
3200
|
type: Component,
|
|
@@ -3121,7 +3206,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3121
3206
|
Table,
|
|
3122
3207
|
Button,
|
|
3123
3208
|
TranslocoPipe,
|
|
3124
|
-
], 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 (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"] }]
|
|
3209
|
+
], 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.\r\n -->\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 } @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.\r\n -->\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 } @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", styles: [":host{display:block}\n"] }]
|
|
3125
3210
|
}], 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
3211
|
|
|
3127
3212
|
/**
|