@masterteam/components 0.0.304 → 0.0.306
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 +17 -1
- package/assets/i18n/en.json +17 -1
- package/fesm2022/masterteam-components-business-fields.mjs +313 -43
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- 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 +119 -5
- package/types/masterteam-components-entities.d.ts +7 -0
- package/types/masterteam-components.d.ts +7 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as i1$1 from '@angular/common';
|
|
1
2
|
import { CommonModule, NgComponentOutlet } from '@angular/common';
|
|
2
3
|
import * as i0 from '@angular/core';
|
|
3
4
|
import { input, inject, DestroyRef, signal, computed, ChangeDetectionStrategy, Component, ChangeDetectorRef, effect, untracked, viewChild, linkedSignal, InjectionToken } from '@angular/core';
|
|
@@ -16,7 +17,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
|
|
16
17
|
import { Button } from '@masterteam/components/button';
|
|
17
18
|
import { NumberField } from '@masterteam/components/number-field';
|
|
18
19
|
import { Table } from '@masterteam/components/table';
|
|
19
|
-
import { newFieldId, coerceCheckboxValue } from '@masterteam/components';
|
|
20
|
+
import { newFieldId, coerceCheckboxValue, MTDateFormatPipe } from '@masterteam/components';
|
|
20
21
|
import { Skeleton } from 'primeng/skeleton';
|
|
21
22
|
import { Message } from 'primeng/message';
|
|
22
23
|
import { ModalService } from '@masterteam/components/modal';
|
|
@@ -1244,6 +1245,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1244
1245
|
], 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" }]
|
|
1245
1246
|
}], 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 }] }] } });
|
|
1246
1247
|
|
|
1248
|
+
/** Revisions fetched per page of the history list (the backend allows 1–100). */
|
|
1249
|
+
const REVISIONS_PAGE_SIZE = 25;
|
|
1247
1250
|
function resolveMetadataFailure(status) {
|
|
1248
1251
|
if (status === 403)
|
|
1249
1252
|
return 'forbidden';
|
|
@@ -1757,10 +1760,17 @@ class EntityListField {
|
|
|
1757
1760
|
* id cells are keyed by. Sorting is off while rows can be dragged: a sorted
|
|
1758
1761
|
* table would show an order that is not the one being saved.
|
|
1759
1762
|
*/
|
|
1760
|
-
localColumns = computed(() => {
|
|
1763
|
+
localColumns = computed(() => this.buildLocalColumns(this.localFields(), !this.localCanEdit()), ...(ngDevMode ? [{ debugName: "localColumns" }] : /* istanbul ignore next */ []));
|
|
1764
|
+
/**
|
|
1765
|
+
* Rows as rendered: loaded rows with this session's edits over them, then
|
|
1766
|
+
* new rows, in the order they would be saved. A loaded cell renders from the
|
|
1767
|
+
* backend's resolved `value`; a cell the user set renders from the dialog's
|
|
1768
|
+
* control value and option label, like a locally added linked row.
|
|
1769
|
+
*/
|
|
1770
|
+
localTableRows = computed(() => this.buildLocalRows(this.localState(), this.localFields(), this.localColumns()), ...(ngDevMode ? [{ debugName: "localTableRows" }] : /* istanbul ignore next */ []));
|
|
1771
|
+
buildLocalColumns(fields, sortable) {
|
|
1761
1772
|
const lang = this.lang();
|
|
1762
|
-
|
|
1763
|
-
return this.localFields().map((field, index) => {
|
|
1773
|
+
return fields.map((field, index) => {
|
|
1764
1774
|
const viewType = resolveLocalFieldViewType(field);
|
|
1765
1775
|
return {
|
|
1766
1776
|
key: field.id,
|
|
@@ -1774,17 +1784,9 @@ class EntityListField {
|
|
|
1774
1784
|
configuration: null,
|
|
1775
1785
|
};
|
|
1776
1786
|
});
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
* new rows, in the order they would be saved. A loaded cell renders from the
|
|
1781
|
-
* backend's resolved `value`; a cell the user set renders from the dialog's
|
|
1782
|
-
* control value and option label, like a locally added linked row.
|
|
1783
|
-
*/
|
|
1784
|
-
localTableRows = computed(() => {
|
|
1785
|
-
const state = this.localState();
|
|
1786
|
-
const fields = this.localFields();
|
|
1787
|
-
const columns = new Map(this.localColumns().map((column) => [column.key, column]));
|
|
1787
|
+
}
|
|
1788
|
+
buildLocalRows(state, fields, localColumns) {
|
|
1789
|
+
const columns = new Map(localColumns.map((column) => [column.key, column]));
|
|
1788
1790
|
return orderLocalRows(state).map((entry) => {
|
|
1789
1791
|
const cells = entry.existing
|
|
1790
1792
|
? localCellsByFieldId(entry.existing)
|
|
@@ -1808,7 +1810,7 @@ class EntityListField {
|
|
|
1808
1810
|
}
|
|
1809
1811
|
return row;
|
|
1810
1812
|
});
|
|
1811
|
-
}
|
|
1813
|
+
}
|
|
1812
1814
|
/**
|
|
1813
1815
|
* Edit and delete per row. A row added in this session is still part of the
|
|
1814
1816
|
* create — changing or dropping it undoes nothing stored — so it follows
|
|
@@ -1905,23 +1907,16 @@ class EntityListField {
|
|
|
1905
1907
|
const records = new Map((state.base?.records ?? []).map((record) => [record.entityId, record]));
|
|
1906
1908
|
const unavailable = new Set(state.base?.unavailableIds ?? []);
|
|
1907
1909
|
return state.ids.map((id) => {
|
|
1910
|
+
// A loaded record renders the backend's values for it; a record picked
|
|
1911
|
+
// in this session renders the picker's display values, when sent.
|
|
1912
|
+
const record = records.get(id) ?? state.records[id];
|
|
1913
|
+
if (record)
|
|
1914
|
+
return this.recordRow(record, columns, properties);
|
|
1908
1915
|
const row = {
|
|
1909
1916
|
Id: id,
|
|
1910
1917
|
[ROW_ID_KEY]: `entity-${id}`,
|
|
1911
1918
|
[ROW_ENTITY_ID_KEY]: id,
|
|
1912
1919
|
};
|
|
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];
|
|
1916
|
-
if (record) {
|
|
1917
|
-
const values = new Map((record.values ?? []).map((item) => [item.propertyKey, item]));
|
|
1918
|
-
for (const column of columns) {
|
|
1919
|
-
const propertyKey = column.propertyKey ?? column.key;
|
|
1920
|
-
const item = values.get(propertyKey) ?? values.get(column.key);
|
|
1921
|
-
row[column.key] = this.toEntityData(column, item ? { raw: item.rawValue, value: item.value } : undefined, properties.get(propertyKey), id);
|
|
1922
|
-
}
|
|
1923
|
-
return row;
|
|
1924
|
-
}
|
|
1925
1920
|
const isUnavailable = unavailable.has(id);
|
|
1926
1921
|
const label = isUnavailable
|
|
1927
1922
|
? this.transloco.translate('components.entityListField.unavailableRecord', { id }, this.lang())
|
|
@@ -1942,6 +1937,259 @@ class EntityListField {
|
|
|
1942
1937
|
return row;
|
|
1943
1938
|
});
|
|
1944
1939
|
}, ...(ngDevMode ? [{ debugName: "selectionRows" }] : /* istanbul ignore next */ []));
|
|
1940
|
+
/**
|
|
1941
|
+
* One table row from a rendered record — `{ entityId, values }` with each
|
|
1942
|
+
* value's `rawValue` and rendered `value` — cell by cell against the
|
|
1943
|
+
* metadata columns, the same cells a related list shows. Selected `records`
|
|
1944
|
+
* and the comparison's preserved / live rows all have this shape.
|
|
1945
|
+
*/
|
|
1946
|
+
recordRow(record, columns, properties) {
|
|
1947
|
+
const id = record.entityId;
|
|
1948
|
+
const row = {
|
|
1949
|
+
Id: id,
|
|
1950
|
+
[ROW_ID_KEY]: `entity-${id}`,
|
|
1951
|
+
[ROW_ENTITY_ID_KEY]: id,
|
|
1952
|
+
};
|
|
1953
|
+
const values = new Map((record.values ?? []).map((item) => [item.propertyKey, item]));
|
|
1954
|
+
for (const column of columns) {
|
|
1955
|
+
const propertyKey = column.propertyKey ?? column.key;
|
|
1956
|
+
const item = values.get(propertyKey) ?? values.get(column.key);
|
|
1957
|
+
row[column.key] = this.toEntityData(column, item ? { raw: item.rawValue, value: item.value } : undefined, properties.get(propertyKey), id);
|
|
1958
|
+
}
|
|
1959
|
+
return row;
|
|
1960
|
+
}
|
|
1961
|
+
// ============================================================================
|
|
1962
|
+
// Saved Related list — preserved and current values (`entity-lists/comparison`)
|
|
1963
|
+
// ============================================================================
|
|
1964
|
+
/** The comparison response, once loaded. */
|
|
1965
|
+
comparison = signal(null, ...(ngDevMode ? [{ debugName: "comparison" }] : /* istanbul ignore next */ []));
|
|
1966
|
+
/**
|
|
1967
|
+
* The record that owns the list, when the host named it (a table cell's
|
|
1968
|
+
* drawer). Only a read-only list reads its comparison: an editable one
|
|
1969
|
+
* edits the source records it queries.
|
|
1970
|
+
*/
|
|
1971
|
+
comparisonOwner = computed(() => {
|
|
1972
|
+
const context = this.runtimeContext();
|
|
1973
|
+
const ownerId = Number(context?.ownerId);
|
|
1974
|
+
if (!this.readonly() || !context?.ownerKind || !(ownerId > 0)) {
|
|
1975
|
+
return null;
|
|
1976
|
+
}
|
|
1977
|
+
return { ownerKind: context.ownerKind, ownerId };
|
|
1978
|
+
}, ...(ngDevMode ? [{ debugName: "comparisonOwner" }] : /* istanbul ignore next */ []));
|
|
1979
|
+
/**
|
|
1980
|
+
* A saved Related list viewed from outside its form: the values preserved
|
|
1981
|
+
* when it was saved beside the source records' current ones. Local and
|
|
1982
|
+
* Selected lists hold their own rows and never compare.
|
|
1983
|
+
*/
|
|
1984
|
+
comparisonMode = computed(() => !!this.comparisonOwner() &&
|
|
1985
|
+
!!this.metadata() &&
|
|
1986
|
+
!this.localMode() &&
|
|
1987
|
+
!this.selectionMode() &&
|
|
1988
|
+
this.moduleBacked(), ...(ngDevMode ? [{ debugName: "comparisonMode" }] : /* istanbul ignore next */ []));
|
|
1989
|
+
comparisonReady = computed(() => this.comparisonMode() && !!this.comparison(), ...(ngDevMode ? [{ debugName: "comparisonReady" }] : /* istanbul ignore next */ []));
|
|
1990
|
+
liveRows = computed(() => {
|
|
1991
|
+
const columns = this.columns();
|
|
1992
|
+
const properties = this.propertyByKey();
|
|
1993
|
+
return (this.comparison()?.live ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
1994
|
+
}, ...(ngDevMode ? [{ debugName: "liveRows" }] : /* istanbul ignore next */ []));
|
|
1995
|
+
preservedRows = computed(() => {
|
|
1996
|
+
const columns = this.columns();
|
|
1997
|
+
const properties = this.propertyByKey();
|
|
1998
|
+
return (this.comparison()?.preserved ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
1999
|
+
}, ...(ngDevMode ? [{ debugName: "preservedRows" }] : /* istanbul ignore next */ []));
|
|
2000
|
+
/** No baseline was captured yet — not the same as an empty saved list. */
|
|
2001
|
+
preservedAvailable = computed(() => this.comparison()?.preservedAvailable === true, ...(ngDevMode ? [{ debugName: "preservedAvailable" }] : /* istanbul ignore next */ []));
|
|
2002
|
+
preservedAt = computed(() => this.comparison()?.preservedAt ?? null, ...(ngDevMode ? [{ debugName: "preservedAt" }] : /* istanbul ignore next */ []));
|
|
2003
|
+
unavailableCount = computed(() => this.comparison()?.unavailableIds?.length ?? 0, ...(ngDevMode ? [{ debugName: "unavailableCount" }] : /* istanbul ignore next */ []));
|
|
2004
|
+
/** Query of the two read-only review endpoints for this list's owner. */
|
|
2005
|
+
reviewParams(propertyId) {
|
|
2006
|
+
const owner = this.comparisonOwner();
|
|
2007
|
+
if (!owner)
|
|
2008
|
+
return null;
|
|
2009
|
+
return {
|
|
2010
|
+
ownerKind: owner.ownerKind,
|
|
2011
|
+
ownerId: String(owner.ownerId),
|
|
2012
|
+
propertyId: String(propertyId),
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
2015
|
+
fetchComparison(propertyId) {
|
|
2016
|
+
const params = this.reviewParams(propertyId);
|
|
2017
|
+
if (!params)
|
|
2018
|
+
return;
|
|
2019
|
+
this.loading.set(true);
|
|
2020
|
+
const ctx = this.context();
|
|
2021
|
+
this.fetchSubscription = this.http
|
|
2022
|
+
.get('entity-lists/comparison', {
|
|
2023
|
+
params,
|
|
2024
|
+
// `403` / `404` are rendered as notices, not toasts.
|
|
2025
|
+
headers: { noMessage: 'true' },
|
|
2026
|
+
...(ctx ? { context: ctx } : {}),
|
|
2027
|
+
})
|
|
2028
|
+
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.loading.set(false)))
|
|
2029
|
+
.subscribe({
|
|
2030
|
+
next: (response) => this.comparison.set(response),
|
|
2031
|
+
error: (error) => {
|
|
2032
|
+
const failure = resolveMetadataFailure(error.status);
|
|
2033
|
+
this.metadataFailure.set(failure);
|
|
2034
|
+
if (failure === 'failed') {
|
|
2035
|
+
this.errorMessage.set(this.transloco.translate('components.entityListField.loadFailed'));
|
|
2036
|
+
}
|
|
2037
|
+
},
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
// ============================================================================
|
|
2041
|
+
// Saved list revisions (`entity-lists/revisions`) — read-only history
|
|
2042
|
+
// ============================================================================
|
|
2043
|
+
/**
|
|
2044
|
+
* A list viewed from outside its form, with its owning record named (a
|
|
2045
|
+
* table cell's drawer), has saved revisions to browse — Related, Local and
|
|
2046
|
+
* Selected alike. Nowhere else: an editable list, a record preview and a
|
|
2047
|
+
* form know no owner, and history is read-only anyway.
|
|
2048
|
+
*/
|
|
2049
|
+
historyAvailable = computed(() => !!this.comparisonOwner() &&
|
|
2050
|
+
(this.comparisonMode() || this.localReady() || this.selectionReady()), ...(ngDevMode ? [{ debugName: "historyAvailable" }] : /* istanbul ignore next */ []));
|
|
2051
|
+
/**
|
|
2052
|
+
* A Local or Selected list shows its value until a revision is picked;
|
|
2053
|
+
* then that revision, until *Back to latest*. A Related list always shows
|
|
2054
|
+
* a comparison, the latest one when no revision is picked.
|
|
2055
|
+
*/
|
|
2056
|
+
showingRevision = computed(() => this.viewedRevision() != null && !!this.comparison(), ...(ngDevMode ? [{ debugName: "showingRevision" }] : /* istanbul ignore next */ []));
|
|
2057
|
+
/** The Local rows of the revision being viewed, with that revision's schema. */
|
|
2058
|
+
revisionLocalDocument = computed(() => this.localMode() ? (this.comparison()?.localDocument ?? null) : null, ...(ngDevMode ? [{ debugName: "revisionLocalDocument" }] : /* istanbul ignore next */ []));
|
|
2059
|
+
revisionLocalFields = computed(() => visibleLocalSchemaFields(this.revisionLocalDocument()?.schema), ...(ngDevMode ? [{ debugName: "revisionLocalFields" }] : /* istanbul ignore next */ []));
|
|
2060
|
+
revisionLocalColumns = computed(() => this.buildLocalColumns(this.revisionLocalFields(), true), ...(ngDevMode ? [{ debugName: "revisionLocalColumns" }] : /* istanbul ignore next */ []));
|
|
2061
|
+
revisionLocalRows = computed(() => {
|
|
2062
|
+
const document = this.revisionLocalDocument();
|
|
2063
|
+
if (!document)
|
|
2064
|
+
return [];
|
|
2065
|
+
return this.buildLocalRows(createLocalEditorState(document), this.revisionLocalFields(), this.revisionLocalColumns());
|
|
2066
|
+
}, ...(ngDevMode ? [{ debugName: "revisionLocalRows" }] : /* istanbul ignore next */ []));
|
|
2067
|
+
/** The history list is open. */
|
|
2068
|
+
revisionsOpen = signal(false, ...(ngDevMode ? [{ debugName: "revisionsOpen" }] : /* istanbul ignore next */ []));
|
|
2069
|
+
/** Revisions loaded so far, newest first. */
|
|
2070
|
+
revisions = signal([], ...(ngDevMode ? [{ debugName: "revisions" }] : /* istanbul ignore next */ []));
|
|
2071
|
+
/**
|
|
2072
|
+
* The revisions as listed, each with the author to print: the name the
|
|
2073
|
+
* backend resolved for the page, or "Unknown user" when it resolved none.
|
|
2074
|
+
* Plain text — the template interpolates it, never binds it as HTML.
|
|
2075
|
+
*/
|
|
2076
|
+
revisionItems = computed(() => {
|
|
2077
|
+
const unknown = this.transloco.translate('components.entityListField.unknownUser', {}, this.lang());
|
|
2078
|
+
return this.revisions().map((revision) => ({
|
|
2079
|
+
version: revision.version,
|
|
2080
|
+
createdAt: revision.createdAt,
|
|
2081
|
+
author: revision.createdByName?.trim() || unknown,
|
|
2082
|
+
}));
|
|
2083
|
+
}, ...(ngDevMode ? [{ debugName: "revisionItems" }] : /* istanbul ignore next */ []));
|
|
2084
|
+
revisionsTotal = signal(0, ...(ngDevMode ? [{ debugName: "revisionsTotal" }] : /* istanbul ignore next */ []));
|
|
2085
|
+
revisionsPage = 0;
|
|
2086
|
+
revisionsLoading = signal(false, ...(ngDevMode ? [{ debugName: "revisionsLoading" }] : /* istanbul ignore next */ []));
|
|
2087
|
+
revisionsError = signal(null, ...(ngDevMode ? [{ debugName: "revisionsError" }] : /* istanbul ignore next */ []));
|
|
2088
|
+
hasMoreRevisions = computed(() => this.revisions().length < this.revisionsTotal(), ...(ngDevMode ? [{ debugName: "hasMoreRevisions" }] : /* istanbul ignore next */ []));
|
|
2089
|
+
/** The revision the comparison shows; null is the list as saved last. */
|
|
2090
|
+
viewedRevision = signal(null, ...(ngDevMode ? [{ debugName: "viewedRevision" }] : /* istanbul ignore next */ []));
|
|
2091
|
+
/** A revision is being read; the tables stay until it arrives. */
|
|
2092
|
+
revisionLoading = signal(false, ...(ngDevMode ? [{ debugName: "revisionLoading" }] : /* istanbul ignore next */ []));
|
|
2093
|
+
/** Why the chosen revision could not be read. The last comparison stays. */
|
|
2094
|
+
revisionError = signal(null, ...(ngDevMode ? [{ debugName: "revisionError" }] : /* istanbul ignore next */ []));
|
|
2095
|
+
revisionSubscription;
|
|
2096
|
+
revisionsSubscription;
|
|
2097
|
+
toggleRevisions() {
|
|
2098
|
+
const open = !this.revisionsOpen();
|
|
2099
|
+
this.revisionsOpen.set(open);
|
|
2100
|
+
if (open && this.revisionsPage === 0 && !this.revisionsLoading()) {
|
|
2101
|
+
this.loadRevisions();
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
/** The next page of the revision index. */
|
|
2105
|
+
loadRevisions() {
|
|
2106
|
+
const propertyId = this.metadata()?.propertyId ?? 0;
|
|
2107
|
+
const params = this.reviewParams(propertyId);
|
|
2108
|
+
if (!params)
|
|
2109
|
+
return;
|
|
2110
|
+
const page = this.revisionsPage + 1;
|
|
2111
|
+
const ctx = this.context();
|
|
2112
|
+
this.revisionsLoading.set(true);
|
|
2113
|
+
this.revisionsError.set(null);
|
|
2114
|
+
this.revisionsSubscription = this.http
|
|
2115
|
+
.get('entity-lists/revisions', {
|
|
2116
|
+
params: { ...params, page, pageSize: REVISIONS_PAGE_SIZE },
|
|
2117
|
+
headers: { noMessage: 'true' },
|
|
2118
|
+
...(ctx ? { context: ctx } : {}),
|
|
2119
|
+
})
|
|
2120
|
+
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.revisionsLoading.set(false)))
|
|
2121
|
+
.subscribe({
|
|
2122
|
+
next: (response) => {
|
|
2123
|
+
this.revisionsPage = page;
|
|
2124
|
+
this.revisions.set([...this.revisions(), ...(response.items ?? [])]);
|
|
2125
|
+
this.revisionsTotal.set(Number(response.totalCount) || 0);
|
|
2126
|
+
},
|
|
2127
|
+
error: () => this.revisionsError.set(this.transloco.translate('components.entityListField.revisionsLoadFailed')),
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
/**
|
|
2131
|
+
* Compare a saved revision with today — its preserved rows beside today's
|
|
2132
|
+
* values of the records it held; for Local, its rows as saved — or, with
|
|
2133
|
+
* `null`, go back to the latest: a Related list re-reads its comparison, a
|
|
2134
|
+
* Local or Selected one shows its value again. Read-only: nothing here is
|
|
2135
|
+
* ever submitted.
|
|
2136
|
+
*/
|
|
2137
|
+
showRevision(version) {
|
|
2138
|
+
const propertyId = this.metadata()?.propertyId ?? 0;
|
|
2139
|
+
const params = this.reviewParams(propertyId);
|
|
2140
|
+
if (!params || version === this.viewedRevision())
|
|
2141
|
+
return;
|
|
2142
|
+
this.revisionSubscription?.unsubscribe();
|
|
2143
|
+
this.revisionError.set(null);
|
|
2144
|
+
if (version == null && !this.comparisonMode()) {
|
|
2145
|
+
this.revisionLoading.set(false);
|
|
2146
|
+
this.viewedRevision.set(null);
|
|
2147
|
+
this.comparison.set(null);
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
const ctx = this.context();
|
|
2151
|
+
this.revisionLoading.set(true);
|
|
2152
|
+
this.revisionSubscription = this.http
|
|
2153
|
+
.get('entity-lists/comparison', {
|
|
2154
|
+
params: version == null ? params : { ...params, revision: version },
|
|
2155
|
+
headers: { noMessage: 'true' },
|
|
2156
|
+
...(ctx ? { context: ctx } : {}),
|
|
2157
|
+
})
|
|
2158
|
+
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.revisionLoading.set(false)))
|
|
2159
|
+
.subscribe({
|
|
2160
|
+
next: (response) => {
|
|
2161
|
+
this.comparison.set(response);
|
|
2162
|
+
this.viewedRevision.set(version);
|
|
2163
|
+
},
|
|
2164
|
+
error: (error) => this.revisionError.set(this.revisionFailureMessage(error)),
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* `entity_list.history_source_changed` (`400`): the revision was saved with
|
|
2169
|
+
* another source configuration. `404`: it no longer exists.
|
|
2170
|
+
*/
|
|
2171
|
+
revisionFailureMessage(error) {
|
|
2172
|
+
const code = error.error?.code;
|
|
2173
|
+
const key = code === 'entity_list.history_source_changed'
|
|
2174
|
+
? 'revisionSourceChanged'
|
|
2175
|
+
: error.status === 404
|
|
2176
|
+
? 'revisionNotFound'
|
|
2177
|
+
: 'loadFailed';
|
|
2178
|
+
return this.transloco.translate(`components.entityListField.${key}`);
|
|
2179
|
+
}
|
|
2180
|
+
resetRevisions() {
|
|
2181
|
+
this.revisionSubscription?.unsubscribe();
|
|
2182
|
+
this.revisionsSubscription?.unsubscribe();
|
|
2183
|
+
this.revisionsOpen.set(false);
|
|
2184
|
+
this.revisions.set([]);
|
|
2185
|
+
this.revisionsTotal.set(0);
|
|
2186
|
+
this.revisionsPage = 0;
|
|
2187
|
+
this.revisionsLoading.set(false);
|
|
2188
|
+
this.revisionsError.set(null);
|
|
2189
|
+
this.viewedRevision.set(null);
|
|
2190
|
+
this.revisionLoading.set(false);
|
|
2191
|
+
this.revisionError.set(null);
|
|
2192
|
+
}
|
|
1945
2193
|
selectionRowActions = computed(() => {
|
|
1946
2194
|
this.lang();
|
|
1947
2195
|
if (!this.selectionWritable())
|
|
@@ -2157,6 +2405,7 @@ class EntityListField {
|
|
|
2157
2405
|
return;
|
|
2158
2406
|
this.lastEmittedJson = null;
|
|
2159
2407
|
this.linkedMutation = null;
|
|
2408
|
+
this.loadedMutationId = incoming?.mutationId;
|
|
2160
2409
|
this.storedValue.set(incoming);
|
|
2161
2410
|
// Restore rows the backend left unprocessed. Whether the loaded
|
|
2162
2411
|
// `deletedIds` are historical markers or pending intent depends on the
|
|
@@ -2212,17 +2461,28 @@ class EntityListField {
|
|
|
2212
2461
|
return true;
|
|
2213
2462
|
}
|
|
2214
2463
|
/**
|
|
2215
|
-
* True when the written value still carries exactly the
|
|
2216
|
-
*
|
|
2217
|
-
*
|
|
2464
|
+
* True when the written value still carries exactly the change we last
|
|
2465
|
+
* emitted — i.e. the form is echoing our own value back rather than loading
|
|
2466
|
+
* a new one.
|
|
2467
|
+
*
|
|
2468
|
+
* The list version, change id and tokens are part of it: a reload after a
|
|
2469
|
+
* save can carry the same (empty) rows and deletions as the last emission,
|
|
2470
|
+
* and taking it for an echo kept the old version, so the next save was
|
|
2471
|
+
* refused as a version conflict.
|
|
2218
2472
|
*/
|
|
2219
2473
|
isEchoOfLastEmit(incoming) {
|
|
2220
2474
|
if (this.lastEmittedJson === null)
|
|
2221
2475
|
return false;
|
|
2222
|
-
return (
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2476
|
+
return this.echoKey(incoming) === this.lastEmittedJson;
|
|
2477
|
+
}
|
|
2478
|
+
echoKey(value) {
|
|
2479
|
+
return JSON.stringify({
|
|
2480
|
+
rows: value?.rows ?? [],
|
|
2481
|
+
deletedIds: value?.deletedIds ?? [],
|
|
2482
|
+
version: value?.version ?? null,
|
|
2483
|
+
mutationId: value?.mutationId ?? null,
|
|
2484
|
+
expectedVersions: value?.expectedVersions ?? null,
|
|
2485
|
+
});
|
|
2226
2486
|
}
|
|
2227
2487
|
/**
|
|
2228
2488
|
* The stored value is persisted as JSON, so a host may write either the
|
|
@@ -2820,10 +3080,7 @@ class EntityListField {
|
|
|
2820
3080
|
...this.linkedMutationId(current, rows, deletedIds),
|
|
2821
3081
|
};
|
|
2822
3082
|
this.storedValue.set(next);
|
|
2823
|
-
this.lastEmittedJson =
|
|
2824
|
-
rows: next.rows,
|
|
2825
|
-
deletedIds: next.deletedIds,
|
|
2826
|
-
});
|
|
3083
|
+
this.lastEmittedJson = this.echoKey(next);
|
|
2827
3084
|
this.onModelChange(next);
|
|
2828
3085
|
this.onTouched();
|
|
2829
3086
|
}
|
|
@@ -2837,9 +3094,13 @@ class EntityListField {
|
|
|
2837
3094
|
* what it loaded with; the backend skips it.
|
|
2838
3095
|
*/
|
|
2839
3096
|
linkedMutation = null;
|
|
3097
|
+
/** The loaded value's `mutationId`, restored once nothing is left to apply. */
|
|
3098
|
+
loadedMutationId;
|
|
2840
3099
|
linkedMutationId(current, rows, deletedIds) {
|
|
2841
|
-
|
|
2842
|
-
|
|
3100
|
+
// `current` is the last emission, which may carry this session's id.
|
|
3101
|
+
if (rows.length === 0 && deletedIds.length === 0) {
|
|
3102
|
+
return { mutationId: this.loadedMutationId };
|
|
3103
|
+
}
|
|
2843
3104
|
const version = Number(current.version ?? 0) || 0;
|
|
2844
3105
|
const key = JSON.stringify({ version, rows, deletedIds });
|
|
2845
3106
|
if (this.linkedMutation?.key !== key) {
|
|
@@ -2972,6 +3233,8 @@ class EntityListField {
|
|
|
2972
3233
|
this.metadataFailure.set(null);
|
|
2973
3234
|
this.columns.set([]);
|
|
2974
3235
|
this.rows.set([]);
|
|
3236
|
+
this.comparison.set(null);
|
|
3237
|
+
this.resetRevisions();
|
|
2975
3238
|
this.errorMessage.set(null);
|
|
2976
3239
|
this.loading.set(false);
|
|
2977
3240
|
if (!(propertyId > 0) || levelId == null || !(Number(levelId) > 0))
|
|
@@ -3023,6 +3286,12 @@ class EntityListField {
|
|
|
3023
3286
|
this.loading.set(false);
|
|
3024
3287
|
return;
|
|
3025
3288
|
}
|
|
3289
|
+
// A saved Related list opened from outside its form shows what was
|
|
3290
|
+
// preserved and what is current, not whatever the source holds today.
|
|
3291
|
+
if (this.comparisonMode()) {
|
|
3292
|
+
this.fetchComparison(metadata.propertyId);
|
|
3293
|
+
return;
|
|
3294
|
+
}
|
|
3026
3295
|
if (!this.moduleBacked() ||
|
|
3027
3296
|
!this.canRead() ||
|
|
3028
3297
|
levelDataId == null ||
|
|
@@ -3194,7 +3463,7 @@ class EntityListField {
|
|
|
3194
3463
|
};
|
|
3195
3464
|
}
|
|
3196
3465
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
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 });
|
|
3466
|
+
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 <ng-container [ngTemplateOutlet]=\"history\" />\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: its source records' current values, and the\n values preserved when it was saved (or at the chosen revision).\n-->\n<ng-template #comparisonSections>\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <h4 class=\"text-sm font-semibold text-color\">\n {{ \"components.entityListField.currentValues\" | transloco }}\n </h4>\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n }\n </section>\n\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\n @if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n\n @if (unavailableCount()) {\n <p class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.unavailableRecords\"\n | transloco: { count: unavailableCount() }\n }}\n </p>\n }\n</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: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3198
3467
|
}
|
|
3199
3468
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
|
|
3200
3469
|
type: Component,
|
|
@@ -3206,7 +3475,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3206
3475
|
Table,
|
|
3207
3476
|
Button,
|
|
3208
3477
|
TranslocoPipe,
|
|
3209
|
-
|
|
3478
|
+
MTDateFormatPipe,
|
|
3479
|
+
], 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 <ng-container [ngTemplateOutlet]=\"history\" />\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: its source records' current values, and the\n values preserved when it was saved (or at the chosen revision).\n-->\n<ng-template #comparisonSections>\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <h4 class=\"text-sm font-semibold text-color\">\n {{ \"components.entityListField.currentValues\" | transloco }}\n </h4>\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n }\n </section>\n\n <section\n class=\"flex flex-col gap-2 transition-opacity\"\n [class.opacity-60]=\"revisionLoading()\"\n >\n <ng-container [ngTemplateOutlet]=\"preservedHeading\" />\n @if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n\n @if (unavailableCount()) {\n <p class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.unavailableRecords\"\n | transloco: { count: unavailableCount() }\n }}\n </p>\n }\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
3210
3480
|
}], 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 }] }] } });
|
|
3211
3481
|
|
|
3212
3482
|
/**
|