@masterteam/components 0.0.307 → 0.0.309

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.
@@ -22,7 +22,7 @@ import { Skeleton } from 'primeng/skeleton';
22
22
  import { Message } from 'primeng/message';
23
23
  import { Tabs } from '@masterteam/components/tabs';
24
24
  import { ModalService } from '@masterteam/components/modal';
25
- import { sortLocalRows, visibleLocalSchemaFields, resolveLocalFieldViewType, resolveLocalFieldLabel, localCellsByFieldId, resolveLocalFieldConfiguration, isEntityListSelectionDocument, isEntityListLocalDocument, serializeEntityRawValue, readEntityValueColor, EntityRuntimeContextStore, ENTITY_LIST_TABLE_COMPONENT } from '@masterteam/components/entities';
25
+ import { sortLocalRows, visibleLocalSchemaFields, resolveLocalFieldViewType, resolveLocalFieldLabel, localCellsByFieldId, resolveLocalFieldConfiguration, isEntityListSelectionDocument, isEntityListLocalDocument, serializeEntityRawValue, resolveLocalizedLabel, readEntityValueColor, EntityRuntimeContextStore, ENTITY_LIST_TABLE_COMPONENT } from '@masterteam/components/entities';
26
26
  import { ModalRef } from '@masterteam/components/dialog';
27
27
  import { TextField } from '@masterteam/components/text-field';
28
28
  import * as i2$1 from 'primeng/inputtext';
@@ -1257,6 +1257,14 @@ function resolveMetadataFailure(status) {
1257
1257
  return 'forbidden';
1258
1258
  return status === 400 || status === 404 ? 'unavailable' : 'failed';
1259
1259
  }
1260
+ /** A translated text control value, `{ en, ar }`, not yet given a `display`. */
1261
+ function isTranslatedText(value) {
1262
+ if (!value || typeof value !== 'object' || Array.isArray(value))
1263
+ return false;
1264
+ const text = value;
1265
+ return (!('display' in text) &&
1266
+ (typeof text['en'] === 'string' || typeof text['ar'] === 'string'));
1267
+ }
1260
1268
  const UNSORTABLE_ENTITY_VIEW_TYPES = new Set([
1261
1269
  'Attachment',
1262
1270
  'Checkbox',
@@ -3106,6 +3114,13 @@ class EntityListField {
3106
3114
  }
3107
3115
  if (resolved)
3108
3116
  return resolved;
3117
+ // Translated text: the dialog binds `{ en, ar }`, but the text renderers
3118
+ // print only the `display` the backend adds to a loaded value — without
3119
+ // it the cell shows its placeholder.
3120
+ if ((viewType === 'Text' || viewType === 'LongText') &&
3121
+ isTranslatedText(raw)) {
3122
+ return { ...raw, display: resolveLocalizedLabel(raw, this.lang()) };
3123
+ }
3109
3124
  // Plain / scalar view types: prefer a resolved option label when present,
3110
3125
  // else the raw value (unchanged for text / number / date / percentage).
3111
3126
  if (label != null && (raw == null || typeof raw !== 'object')) {
@@ -3529,7 +3544,7 @@ class EntityListField {
3529
3544
  };
3530
3545
  }
3531
3546
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
3532
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, pendingSubmission: { classPropertyName: "pendingSubmission", publicName: "pendingSubmission", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, providers: [EntityRuntimeContextStore], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (errorMessage(); as err) {\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\n } @else if (noticeKey(); as notice) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ notice | transloco }}\n </div>\n } @else if (localReady()) {\n <!--\n A Local list: rows owned by this record, staged into its own submission.\n Add / edit / delete / drag follow the Local operation switches. Opened\n from a table cell, it can also show a saved revision's rows instead.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\n @if (revisionLocalRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"revisionLocalRows()\"\n [columns]=\"revisionLocalColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n } @else {\n @if (localCanCreate()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openLocalRowDialog()\"\n />\n </div>\n }\n @if (localTableRows().length || localCanCreate()) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"localTableRows()\"\n [columns]=\"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 }\n } @else if (selectionReady()) {\n <!--\n A Selected list: the source records picked for this record, and nothing\n else. Picking and removing change only which records it holds. Opened\n from a table cell, a saved revision compares the records it held then\n with their values today.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n } @else {\n @if (selectionWritable()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.selectRecords' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openSelectionDialog()\"\n />\n </div>\n }\n @if (selectionRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"selectionRows()\"\n [columns]=\"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 }\n } @else if (comparisonMode()) {\n <!--\n A saved Related list opened from outside its form: its sources' current\n values, and the values preserved when it was saved. A missing baseline is\n said as such \u2014 it is not an empty list.\n -->\n @if (!comparisonReady()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else {\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n }\n } @else if (canWrite()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openAddDialog()\"\n />\n </div>\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n [rowActions]=\"writeRowActions()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n } @else if (loading() && !hasRows()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else if (!hasRows()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n\n<!--\n Saved list revisions: each successful save of this list, newest first.\n Picking one shows what it preserved \u2014 beside today's values of the records\n it held, for a linked list. Read-only: history is never submitted.\n-->\n<ng-template #history>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <div class=\"flex flex-wrap items-center gap-2\">\n @if (viewedRevision(); as version) {\n <span\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\n >\n {{\n \"components.entityListField.viewingRevision\"\n | transloco: { version: version }\n }}\n </span>\n <mt-button\n [label]=\"'components.entityListField.backToLatest' | transloco\"\n size=\"small\"\n variant=\"text\"\n [disabled]=\"revisionLoading()\"\n (onClick)=\"showRevision(null)\"\n />\n }\n </div>\n <mt-button\n [label]=\"'components.entityListField.revisions' | transloco\"\n icon=\"time.clock-rewind\"\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"toggleRevisions()\"\n />\n </div>\n\n @if (revisionsOpen()) {\n <div\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\n >\n <p class=\"text-xs text-muted-color\">\n {{ \"components.entityListField.revisionsHint\" | transloco }}\n </p>\n @if (revisionsError(); as message) {\n <p class=\"text-sm text-red-600\">{{ message }}</p>\n }\n @for (revision of revisionItems(); track revision.version) {\n <button\n type=\"button\"\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\n [class.border-surface]=\"viewedRevision() !== revision.version\"\n [class.bg-content]=\"viewedRevision() !== revision.version\"\n [disabled]=\"revisionLoading()\"\n (click)=\"showRevision(revision.version)\"\n >\n <span class=\"font-medium text-color\">\n {{\n \"components.entityListField.revisionLabel\"\n | transloco: { version: revision.version }\n }}\n </span>\n <span\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\n >\n <span class=\"truncate\">{{ revision.author }}</span>\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\n </span>\n </button>\n } @empty {\n @if (!revisionsLoading() && !revisionsError()) {\n <p class=\"text-sm text-muted-color\">\n {{ \"components.entityListField.noRevisions\" | transloco }}\n </p>\n }\n }\n @if (revisionsLoading()) {\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\n } @else if (hasMoreRevisions()) {\n <div class=\"flex justify-center\">\n <mt-button\n [label]=\"'components.entityListField.loadMore' | transloco\"\n size=\"small\"\n variant=\"text\"\n (onClick)=\"loadRevisions()\"\n />\n </div>\n }\n </div>\n }\n\n @if (revisionError(); as message) {\n <div\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ message }}\n </div>\n }\n</ng-template>\n\n<!-- \"Preserved values\", with when they were captured. -->\n<ng-template #preservedHeading>\n <h4\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\n >\n {{ \"components.entityListField.preservedValues\" | transloco }}\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs font-normal text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n </h4>\n</ng-template>\n\n<!--\n A linked list's comparison, one table at a time: the values preserved when\n it was saved, or its source records' current values. It opens on the\n property's configured mode. A missing baseline says so \u2014 it is never\n replaced by the current values.\n-->\n<ng-template #comparisonSections>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <mt-tabs\n size=\"small\"\n [options]=\"comparisonViewOptions()\"\n [active]=\"comparisonView()\"\n (onChange)=\"setComparisonView($event)\"\n />\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n }\n </div>\n\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n @if (comparisonView() === \"current\") {\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"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 } @else if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"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</ng-template>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3547
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, pendingSubmission: { classPropertyName: "pendingSubmission", publicName: "pendingSubmission", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, providers: [EntityRuntimeContextStore], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (noticeKey(); as notice) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ notice | transloco }}\r\n </div>\r\n } @else if (localReady()) {\r\n <!--\r\n A Local list: rows owned by this record, staged into its own submission.\r\n Add / edit / delete / drag follow the Local operation switches. Opened\r\n from a table cell, it can also show a saved revision's rows instead.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\r\n @if (revisionLocalRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"revisionLocalRows()\"\r\n [columns]=\"revisionLocalColumns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n } @else {\r\n @if (localCanCreate()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openLocalRowDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (localTableRows().length || localCanCreate()) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"localTableRows()\"\r\n [columns]=\"localColumns()\"\r\n [rowActions]=\"localRowActions()\"\r\n [reorderableRows]=\"localCanReorder()\"\r\n (rowReorder)=\"onLocalReorder($event)\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noLocalRows\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (selectionReady()) {\r\n <!--\r\n A Selected list: the source records picked for this record, and nothing\r\n else. Picking and removing change only which records it holds. Opened\r\n from a table cell, a saved revision compares the records it held then\r\n with their values today.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n } @else {\r\n @if (selectionWritable()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.selectRecords' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openSelectionDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (selectionRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"selectionRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"selectionRowActions()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (comparisonMode()) {\r\n <!--\r\n A saved Related list opened from outside its form: its sources' current\r\n values, and the values preserved when it was saved. A missing baseline is\r\n said as such \u2014 it is not an empty list.\r\n -->\r\n @if (!comparisonReady()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else {\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n }\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n\r\n<!--\r\n Saved list revisions: each successful save of this list, newest first.\r\n Picking one shows what it preserved \u2014 beside today's values of the records\r\n it held, for a linked list. Read-only: history is never submitted.\r\n-->\r\n<ng-template #history>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @if (viewedRevision(); as version) {\r\n <span\r\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\r\n >\r\n {{\r\n \"components.entityListField.viewingRevision\"\r\n | transloco: { version: version }\r\n }}\r\n </span>\r\n <mt-button\r\n [label]=\"'components.entityListField.backToLatest' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n [disabled]=\"revisionLoading()\"\r\n (onClick)=\"showRevision(null)\"\r\n />\r\n }\r\n </div>\r\n <mt-button\r\n [label]=\"'components.entityListField.revisions' | transloco\"\r\n icon=\"time.clock-rewind\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"toggleRevisions()\"\r\n />\r\n </div>\r\n\r\n @if (revisionsOpen()) {\r\n <div\r\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\r\n >\r\n <p class=\"text-xs text-muted-color\">\r\n {{ \"components.entityListField.revisionsHint\" | transloco }}\r\n </p>\r\n @if (revisionsError(); as message) {\r\n <p class=\"text-sm text-red-600\">{{ message }}</p>\r\n }\r\n @for (revision of revisionItems(); track revision.version) {\r\n <button\r\n type=\"button\"\r\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\r\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\r\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\r\n [class.border-surface]=\"viewedRevision() !== revision.version\"\r\n [class.bg-content]=\"viewedRevision() !== revision.version\"\r\n [disabled]=\"revisionLoading()\"\r\n (click)=\"showRevision(revision.version)\"\r\n >\r\n <span class=\"font-medium text-color\">\r\n {{\r\n \"components.entityListField.revisionLabel\"\r\n | transloco: { version: revision.version }\r\n }}\r\n </span>\r\n <span\r\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\r\n >\r\n <span class=\"truncate\">{{ revision.author }}</span>\r\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\r\n </span>\r\n </button>\r\n } @empty {\r\n @if (!revisionsLoading() && !revisionsError()) {\r\n <p class=\"text-sm text-muted-color\">\r\n {{ \"components.entityListField.noRevisions\" | transloco }}\r\n </p>\r\n }\r\n }\r\n @if (revisionsLoading()) {\r\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\r\n } @else if (hasMoreRevisions()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n [label]=\"'components.entityListField.loadMore' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n (onClick)=\"loadRevisions()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (revisionError(); as message) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\r\n >\r\n {{ message }}\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<!-- \"Preserved values\", with when they were captured. -->\r\n<ng-template #preservedHeading>\r\n <h4\r\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\r\n >\r\n {{ \"components.entityListField.preservedValues\" | transloco }}\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs font-normal text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n </h4>\r\n</ng-template>\r\n\r\n<!--\r\n A linked list's comparison, one table at a time: the values preserved when\r\n it was saved, or its source records' current values. It opens on the\r\n property's configured mode. A missing baseline says so \u2014 it is never\r\n replaced by the current values.\r\n-->\r\n<ng-template #comparisonSections>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <mt-tabs\r\n size=\"small\"\r\n [options]=\"comparisonViewOptions()\"\r\n [active]=\"comparisonView()\"\r\n (onChange)=\"setComparisonView($event)\"\r\n />\r\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n }\r\n </div>\r\n\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n @if (comparisonView() === \"current\") {\r\n @if (liveRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"liveRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n }\r\n } @else if (!preservedAvailable()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\r\n </div>\r\n } @else if (preservedRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"preservedRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n\r\n @if (unavailableCount()) {\r\n <p class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.unavailableRecords\"\r\n | transloco: { count: unavailableCount() }\r\n }}\r\n </p>\r\n }\r\n</ng-template>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3533
3548
  }
3534
3549
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
3535
3550
  type: Component,
@@ -3543,7 +3558,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
3543
3558
  Tabs,
3544
3559
  TranslocoPipe,
3545
3560
  MTDateFormatPipe,
3546
- ], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, providers: [EntityRuntimeContextStore], template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (errorMessage(); as err) {\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\n } @else if (noticeKey(); as notice) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ notice | transloco }}\n </div>\n } @else if (localReady()) {\n <!--\n A Local list: rows owned by this record, staged into its own submission.\n Add / edit / delete / drag follow the Local operation switches. Opened\n from a table cell, it can also show a saved revision's rows instead.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\n @if (revisionLocalRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"revisionLocalRows()\"\n [columns]=\"revisionLocalColumns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n } @else {\n @if (localCanCreate()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openLocalRowDialog()\"\n />\n </div>\n }\n @if (localTableRows().length || localCanCreate()) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"localTableRows()\"\n [columns]=\"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 }\n } @else if (selectionReady()) {\n <!--\n A Selected list: the source records picked for this record, and nothing\n else. Picking and removing change only which records it holds. Opened\n from a table cell, a saved revision compares the records it held then\n with their values today.\n -->\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n @if (showingRevision()) {\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n } @else {\n @if (selectionWritable()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.selectRecords' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openSelectionDialog()\"\n />\n </div>\n }\n @if (selectionRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"selectionRows()\"\n [columns]=\"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 }\n } @else if (comparisonMode()) {\n <!--\n A saved Related list opened from outside its form: its sources' current\n values, and the values preserved when it was saved. A missing baseline is\n said as such \u2014 it is not an empty list.\n -->\n @if (!comparisonReady()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else {\n @if (historyAvailable()) {\n <ng-container [ngTemplateOutlet]=\"history\" />\n }\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\n }\n } @else if (canWrite()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openAddDialog()\"\n />\n </div>\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n [rowActions]=\"writeRowActions()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n } @else if (loading() && !hasRows()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else if (!hasRows()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n\n<!--\n Saved list revisions: each successful save of this list, newest first.\n Picking one shows what it preserved \u2014 beside today's values of the records\n it held, for a linked list. Read-only: history is never submitted.\n-->\n<ng-template #history>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <div class=\"flex flex-wrap items-center gap-2\">\n @if (viewedRevision(); as version) {\n <span\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\n >\n {{\n \"components.entityListField.viewingRevision\"\n | transloco: { version: version }\n }}\n </span>\n <mt-button\n [label]=\"'components.entityListField.backToLatest' | transloco\"\n size=\"small\"\n variant=\"text\"\n [disabled]=\"revisionLoading()\"\n (onClick)=\"showRevision(null)\"\n />\n }\n </div>\n <mt-button\n [label]=\"'components.entityListField.revisions' | transloco\"\n icon=\"time.clock-rewind\"\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"toggleRevisions()\"\n />\n </div>\n\n @if (revisionsOpen()) {\n <div\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\n >\n <p class=\"text-xs text-muted-color\">\n {{ \"components.entityListField.revisionsHint\" | transloco }}\n </p>\n @if (revisionsError(); as message) {\n <p class=\"text-sm text-red-600\">{{ message }}</p>\n }\n @for (revision of revisionItems(); track revision.version) {\n <button\n type=\"button\"\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\n [class.border-surface]=\"viewedRevision() !== revision.version\"\n [class.bg-content]=\"viewedRevision() !== revision.version\"\n [disabled]=\"revisionLoading()\"\n (click)=\"showRevision(revision.version)\"\n >\n <span class=\"font-medium text-color\">\n {{\n \"components.entityListField.revisionLabel\"\n | transloco: { version: revision.version }\n }}\n </span>\n <span\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\n >\n <span class=\"truncate\">{{ revision.author }}</span>\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\n </span>\n </button>\n } @empty {\n @if (!revisionsLoading() && !revisionsError()) {\n <p class=\"text-sm text-muted-color\">\n {{ \"components.entityListField.noRevisions\" | transloco }}\n </p>\n }\n }\n @if (revisionsLoading()) {\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\n } @else if (hasMoreRevisions()) {\n <div class=\"flex justify-center\">\n <mt-button\n [label]=\"'components.entityListField.loadMore' | transloco\"\n size=\"small\"\n variant=\"text\"\n (onClick)=\"loadRevisions()\"\n />\n </div>\n }\n </div>\n }\n\n @if (revisionError(); as message) {\n <div\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ message }}\n </div>\n }\n</ng-template>\n\n<!-- \"Preserved values\", with when they were captured. -->\n<ng-template #preservedHeading>\n <h4\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\n >\n {{ \"components.entityListField.preservedValues\" | transloco }}\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs font-normal text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n </h4>\n</ng-template>\n\n<!--\n A linked list's comparison, one table at a time: the values preserved when\n it was saved, or its source records' current values. It opens on the\n property's configured mode. A missing baseline says so \u2014 it is never\n replaced by the current values.\n-->\n<ng-template #comparisonSections>\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\n <mt-tabs\n size=\"small\"\n [options]=\"comparisonViewOptions()\"\n [active]=\"comparisonView()\"\n (onChange)=\"setComparisonView($event)\"\n />\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n }\n </div>\n\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n @if (comparisonView() === \"current\") {\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"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 } @else if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"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</ng-template>\n", styles: [":host{display:block}\n"] }]
3561
+ ], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, providers: [EntityRuntimeContextStore], template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (noticeKey(); as notice) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ notice | transloco }}\r\n </div>\r\n } @else if (localReady()) {\r\n <!--\r\n A Local list: rows owned by this record, staged into its own submission.\r\n Add / edit / delete / drag follow the Local operation switches. Opened\r\n from a table cell, it can also show a saved revision's rows instead.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\r\n @if (revisionLocalRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"revisionLocalRows()\"\r\n [columns]=\"revisionLocalColumns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n } @else {\r\n @if (localCanCreate()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openLocalRowDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (localTableRows().length || localCanCreate()) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"localTableRows()\"\r\n [columns]=\"localColumns()\"\r\n [rowActions]=\"localRowActions()\"\r\n [reorderableRows]=\"localCanReorder()\"\r\n (rowReorder)=\"onLocalReorder($event)\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noLocalRows\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (selectionReady()) {\r\n <!--\r\n A Selected list: the source records picked for this record, and nothing\r\n else. Picking and removing change only which records it holds. Opened\r\n from a table cell, a saved revision compares the records it held then\r\n with their values today.\r\n -->\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n @if (showingRevision()) {\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n } @else {\r\n @if (selectionWritable()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.selectRecords' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openSelectionDialog()\"\r\n />\r\n </div>\r\n }\r\n @if (selectionRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"selectionRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"selectionRowActions()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\r\n </div>\r\n }\r\n }\r\n } @else if (comparisonMode()) {\r\n <!--\r\n A saved Related list opened from outside its form: its sources' current\r\n values, and the values preserved when it was saved. A missing baseline is\r\n said as such \u2014 it is not an empty list.\r\n -->\r\n @if (!comparisonReady()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else {\r\n @if (historyAvailable()) {\r\n <ng-container [ngTemplateOutlet]=\"history\" />\r\n }\r\n <ng-container [ngTemplateOutlet]=\"comparisonSections\" />\r\n }\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"tableColumns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n\r\n<!--\r\n Saved list revisions: each successful save of this list, newest first.\r\n Picking one shows what it preserved \u2014 beside today's values of the records\r\n it held, for a linked list. Read-only: history is never submitted.\r\n-->\r\n<ng-template #history>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @if (viewedRevision(); as version) {\r\n <span\r\n class=\"rounded-md border border-primary-200 bg-primary-50 px-2 py-0.5 text-xs font-medium text-primary-700\"\r\n >\r\n {{\r\n \"components.entityListField.viewingRevision\"\r\n | transloco: { version: version }\r\n }}\r\n </span>\r\n <mt-button\r\n [label]=\"'components.entityListField.backToLatest' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n [disabled]=\"revisionLoading()\"\r\n (onClick)=\"showRevision(null)\"\r\n />\r\n }\r\n </div>\r\n <mt-button\r\n [label]=\"'components.entityListField.revisions' | transloco\"\r\n icon=\"time.clock-rewind\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"toggleRevisions()\"\r\n />\r\n </div>\r\n\r\n @if (revisionsOpen()) {\r\n <div\r\n class=\"flex flex-col gap-2 rounded-md border border-surface bg-surface-50 p-3\"\r\n >\r\n <p class=\"text-xs text-muted-color\">\r\n {{ \"components.entityListField.revisionsHint\" | transloco }}\r\n </p>\r\n @if (revisionsError(); as message) {\r\n <p class=\"text-sm text-red-600\">{{ message }}</p>\r\n }\r\n @for (revision of revisionItems(); track revision.version) {\r\n <button\r\n type=\"button\"\r\n class=\"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-start text-sm transition-colors\"\r\n [class.border-primary-200]=\"viewedRevision() === revision.version\"\r\n [class.bg-primary-50]=\"viewedRevision() === revision.version\"\r\n [class.border-surface]=\"viewedRevision() !== revision.version\"\r\n [class.bg-content]=\"viewedRevision() !== revision.version\"\r\n [disabled]=\"revisionLoading()\"\r\n (click)=\"showRevision(revision.version)\"\r\n >\r\n <span class=\"font-medium text-color\">\r\n {{\r\n \"components.entityListField.revisionLabel\"\r\n | transloco: { version: revision.version }\r\n }}\r\n </span>\r\n <span\r\n class=\"flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-xs text-muted-color\"\r\n >\r\n <span class=\"truncate\">{{ revision.author }}</span>\r\n <span>{{ revision.createdAt | mtDateFormat: \"dateTime\" }}</span>\r\n </span>\r\n </button>\r\n } @empty {\r\n @if (!revisionsLoading() && !revisionsError()) {\r\n <p class=\"text-sm text-muted-color\">\r\n {{ \"components.entityListField.noRevisions\" | transloco }}\r\n </p>\r\n }\r\n }\r\n @if (revisionsLoading()) {\r\n <p-skeleton width=\"100%\" height=\"2.25rem\" borderRadius=\"0.375rem\" />\r\n } @else if (hasMoreRevisions()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n [label]=\"'components.entityListField.loadMore' | transloco\"\r\n size=\"small\"\r\n variant=\"text\"\r\n (onClick)=\"loadRevisions()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (revisionError(); as message) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\r\n >\r\n {{ message }}\r\n </div>\r\n }\r\n</ng-template>\r\n\r\n<!-- \"Preserved values\", with when they were captured. -->\r\n<ng-template #preservedHeading>\r\n <h4\r\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\r\n >\r\n {{ \"components.entityListField.preservedValues\" | transloco }}\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs font-normal text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n </h4>\r\n</ng-template>\r\n\r\n<!--\r\n A linked list's comparison, one table at a time: the values preserved when\r\n it was saved, or its source records' current values. It opens on the\r\n property's configured mode. A missing baseline says so \u2014 it is never\r\n replaced by the current values.\r\n-->\r\n<ng-template #comparisonSections>\r\n <div class=\"flex flex-wrap items-center justify-between gap-2\">\r\n <mt-tabs\r\n size=\"small\"\r\n [options]=\"comparisonViewOptions()\"\r\n [active]=\"comparisonView()\"\r\n (onChange)=\"setComparisonView($event)\"\r\n />\r\n @if (comparisonView() === \"preserved\" && preservedAvailable()) {\r\n @if (preservedAt(); as capturedAt) {\r\n <span class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.preservedAt\"\r\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\r\n }}\r\n </span>\r\n }\r\n }\r\n </div>\r\n\r\n <section\r\n class=\"flex flex-col gap-2 transition-opacity\"\r\n [class.opacity-60]=\"revisionLoading()\"\r\n >\r\n @if (comparisonView() === \"current\") {\r\n @if (liveRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"liveRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n }\r\n } @else if (!preservedAvailable()) {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\r\n </div>\r\n } @else if (preservedRows().length) {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"preservedRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n />\r\n } @else {\r\n <div\r\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\r\n </div>\r\n }\r\n </section>\r\n\r\n @if (unavailableCount()) {\r\n <p class=\"text-xs text-muted-color\">\r\n {{\r\n \"components.entityListField.unavailableRecords\"\r\n | transloco: { count: unavailableCount() }\r\n }}\r\n </p>\r\n }\r\n</ng-template>\r\n", styles: [":host{display:block}\n"] }]
3547
3562
  }], 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 }] }] } });
3548
3563
 
3549
3564
  /**