@masterteam/components 0.0.304 → 0.0.305
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/i18n/ar.json +7 -1
- package/assets/i18n/en.json +7 -1
- package/fesm2022/masterteam-components-business-fields.mjs +109 -15
- 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 +29 -0
- package/types/masterteam-components-entities.d.ts +7 -0
- package/types/masterteam-components.d.ts +7 -0
package/assets/i18n/ar.json
CHANGED
|
@@ -141,7 +141,13 @@
|
|
|
141
141
|
"selectionLimit": "تم اختيار {{count}} — الحد الأقصى {{max}}.",
|
|
142
142
|
"selectionUnavailable": "لا يمكن اختيار السجلات هنا.",
|
|
143
143
|
"selectionLoadFailed": "تعذّر تحميل السجلات المتاحة للاختيار.",
|
|
144
|
-
"shownAfterSave": "يظهر بعد الحفظ"
|
|
144
|
+
"shownAfterSave": "يظهر بعد الحفظ",
|
|
145
|
+
"currentValues": "القيم الحالية",
|
|
146
|
+
"preservedValues": "القيم المحفوظة",
|
|
147
|
+
"preservedAt": "التُقطت في {{date}}",
|
|
148
|
+
"noPreservedSnapshot": "لا توجد لقطة محفوظة بعد.",
|
|
149
|
+
"preservedEmpty": "القائمة المحفوظة فارغة.",
|
|
150
|
+
"unavailableRecords": "{{count}} من السجلات المحفوظة لم تعد متاحة."
|
|
145
151
|
},
|
|
146
152
|
"entityListPreview": {
|
|
147
153
|
"view": "عرض القائمة",
|
package/assets/i18n/en.json
CHANGED
|
@@ -141,7 +141,13 @@
|
|
|
141
141
|
"selectionLimit": "{{count}} selected — the limit is {{max}}.",
|
|
142
142
|
"selectionUnavailable": "Records cannot be chosen here.",
|
|
143
143
|
"selectionLoadFailed": "Could not load the records to choose from.",
|
|
144
|
-
"shownAfterSave": "Shown after saving"
|
|
144
|
+
"shownAfterSave": "Shown after saving",
|
|
145
|
+
"currentValues": "Current values",
|
|
146
|
+
"preservedValues": "Preserved values",
|
|
147
|
+
"preservedAt": "Captured {{date}}",
|
|
148
|
+
"noPreservedSnapshot": "No preserved snapshot yet.",
|
|
149
|
+
"preservedEmpty": "The preserved list is empty.",
|
|
150
|
+
"unavailableRecords": "{{count}} saved record(s) are no longer available."
|
|
145
151
|
},
|
|
146
152
|
"entityListPreview": {
|
|
147
153
|
"view": "View list",
|
|
@@ -16,7 +16,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
|
|
16
16
|
import { Button } from '@masterteam/components/button';
|
|
17
17
|
import { NumberField } from '@masterteam/components/number-field';
|
|
18
18
|
import { Table } from '@masterteam/components/table';
|
|
19
|
-
import { newFieldId, coerceCheckboxValue } from '@masterteam/components';
|
|
19
|
+
import { newFieldId, coerceCheckboxValue, MTDateFormatPipe } from '@masterteam/components';
|
|
20
20
|
import { Skeleton } from 'primeng/skeleton';
|
|
21
21
|
import { Message } from 'primeng/message';
|
|
22
22
|
import { ModalService } from '@masterteam/components/modal';
|
|
@@ -1905,23 +1905,16 @@ class EntityListField {
|
|
|
1905
1905
|
const records = new Map((state.base?.records ?? []).map((record) => [record.entityId, record]));
|
|
1906
1906
|
const unavailable = new Set(state.base?.unavailableIds ?? []);
|
|
1907
1907
|
return state.ids.map((id) => {
|
|
1908
|
+
// A loaded record renders the backend's values for it; a record picked
|
|
1909
|
+
// in this session renders the picker's display values, when sent.
|
|
1910
|
+
const record = records.get(id) ?? state.records[id];
|
|
1911
|
+
if (record)
|
|
1912
|
+
return this.recordRow(record, columns, properties);
|
|
1908
1913
|
const row = {
|
|
1909
1914
|
Id: id,
|
|
1910
1915
|
[ROW_ID_KEY]: `entity-${id}`,
|
|
1911
1916
|
[ROW_ENTITY_ID_KEY]: id,
|
|
1912
1917
|
};
|
|
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
1918
|
const isUnavailable = unavailable.has(id);
|
|
1926
1919
|
const label = isUnavailable
|
|
1927
1920
|
? this.transloco.translate('components.entityListField.unavailableRecord', { id }, this.lang())
|
|
@@ -1942,6 +1935,99 @@ class EntityListField {
|
|
|
1942
1935
|
return row;
|
|
1943
1936
|
});
|
|
1944
1937
|
}, ...(ngDevMode ? [{ debugName: "selectionRows" }] : /* istanbul ignore next */ []));
|
|
1938
|
+
/**
|
|
1939
|
+
* One table row from a rendered record — `{ entityId, values }` with each
|
|
1940
|
+
* value's `rawValue` and rendered `value` — cell by cell against the
|
|
1941
|
+
* metadata columns, the same cells a related list shows. Selected `records`
|
|
1942
|
+
* and the comparison's preserved / live rows all have this shape.
|
|
1943
|
+
*/
|
|
1944
|
+
recordRow(record, columns, properties) {
|
|
1945
|
+
const id = record.entityId;
|
|
1946
|
+
const row = {
|
|
1947
|
+
Id: id,
|
|
1948
|
+
[ROW_ID_KEY]: `entity-${id}`,
|
|
1949
|
+
[ROW_ENTITY_ID_KEY]: id,
|
|
1950
|
+
};
|
|
1951
|
+
const values = new Map((record.values ?? []).map((item) => [item.propertyKey, item]));
|
|
1952
|
+
for (const column of columns) {
|
|
1953
|
+
const propertyKey = column.propertyKey ?? column.key;
|
|
1954
|
+
const item = values.get(propertyKey) ?? values.get(column.key);
|
|
1955
|
+
row[column.key] = this.toEntityData(column, item ? { raw: item.rawValue, value: item.value } : undefined, properties.get(propertyKey), id);
|
|
1956
|
+
}
|
|
1957
|
+
return row;
|
|
1958
|
+
}
|
|
1959
|
+
// ============================================================================
|
|
1960
|
+
// Saved Related list — preserved and current values (`entity-lists/comparison`)
|
|
1961
|
+
// ============================================================================
|
|
1962
|
+
/** The comparison response, once loaded. */
|
|
1963
|
+
comparison = signal(null, ...(ngDevMode ? [{ debugName: "comparison" }] : /* istanbul ignore next */ []));
|
|
1964
|
+
/**
|
|
1965
|
+
* The record that owns the list, when the host named it (a table cell's
|
|
1966
|
+
* drawer). Only a read-only list reads its comparison: an editable one
|
|
1967
|
+
* edits the source records it queries.
|
|
1968
|
+
*/
|
|
1969
|
+
comparisonOwner = computed(() => {
|
|
1970
|
+
const context = this.runtimeContext();
|
|
1971
|
+
const ownerId = Number(context?.ownerId);
|
|
1972
|
+
if (!this.readonly() || !context?.ownerKind || !(ownerId > 0)) {
|
|
1973
|
+
return null;
|
|
1974
|
+
}
|
|
1975
|
+
return { ownerKind: context.ownerKind, ownerId };
|
|
1976
|
+
}, ...(ngDevMode ? [{ debugName: "comparisonOwner" }] : /* istanbul ignore next */ []));
|
|
1977
|
+
/**
|
|
1978
|
+
* A saved Related list viewed from outside its form: the values preserved
|
|
1979
|
+
* when it was saved beside the source records' current ones. Local and
|
|
1980
|
+
* Selected lists hold their own rows and never compare.
|
|
1981
|
+
*/
|
|
1982
|
+
comparisonMode = computed(() => !!this.comparisonOwner() &&
|
|
1983
|
+
!!this.metadata() &&
|
|
1984
|
+
!this.localMode() &&
|
|
1985
|
+
!this.selectionMode() &&
|
|
1986
|
+
this.moduleBacked(), ...(ngDevMode ? [{ debugName: "comparisonMode" }] : /* istanbul ignore next */ []));
|
|
1987
|
+
comparisonReady = computed(() => this.comparisonMode() && !!this.comparison(), ...(ngDevMode ? [{ debugName: "comparisonReady" }] : /* istanbul ignore next */ []));
|
|
1988
|
+
liveRows = computed(() => {
|
|
1989
|
+
const columns = this.columns();
|
|
1990
|
+
const properties = this.propertyByKey();
|
|
1991
|
+
return (this.comparison()?.live ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
1992
|
+
}, ...(ngDevMode ? [{ debugName: "liveRows" }] : /* istanbul ignore next */ []));
|
|
1993
|
+
preservedRows = computed(() => {
|
|
1994
|
+
const columns = this.columns();
|
|
1995
|
+
const properties = this.propertyByKey();
|
|
1996
|
+
return (this.comparison()?.preserved ?? []).map((record) => this.recordRow(record, columns, properties));
|
|
1997
|
+
}, ...(ngDevMode ? [{ debugName: "preservedRows" }] : /* istanbul ignore next */ []));
|
|
1998
|
+
/** No baseline was captured yet — not the same as an empty saved list. */
|
|
1999
|
+
preservedAvailable = computed(() => this.comparison()?.preservedAvailable === true, ...(ngDevMode ? [{ debugName: "preservedAvailable" }] : /* istanbul ignore next */ []));
|
|
2000
|
+
preservedAt = computed(() => this.comparison()?.preservedAt ?? null, ...(ngDevMode ? [{ debugName: "preservedAt" }] : /* istanbul ignore next */ []));
|
|
2001
|
+
unavailableCount = computed(() => this.comparison()?.unavailableIds?.length ?? 0, ...(ngDevMode ? [{ debugName: "unavailableCount" }] : /* istanbul ignore next */ []));
|
|
2002
|
+
fetchComparison(propertyId) {
|
|
2003
|
+
const owner = this.comparisonOwner();
|
|
2004
|
+
if (!owner)
|
|
2005
|
+
return;
|
|
2006
|
+
this.loading.set(true);
|
|
2007
|
+
const ctx = this.context();
|
|
2008
|
+
this.fetchSubscription = this.http
|
|
2009
|
+
.get('entity-lists/comparison', {
|
|
2010
|
+
params: {
|
|
2011
|
+
ownerKind: owner.ownerKind,
|
|
2012
|
+
ownerId: String(owner.ownerId),
|
|
2013
|
+
propertyId: String(propertyId),
|
|
2014
|
+
},
|
|
2015
|
+
// `403` / `404` are rendered as notices, not toasts.
|
|
2016
|
+
headers: { noMessage: 'true' },
|
|
2017
|
+
...(ctx ? { context: ctx } : {}),
|
|
2018
|
+
})
|
|
2019
|
+
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.loading.set(false)))
|
|
2020
|
+
.subscribe({
|
|
2021
|
+
next: (response) => this.comparison.set(response),
|
|
2022
|
+
error: (error) => {
|
|
2023
|
+
const failure = resolveMetadataFailure(error.status);
|
|
2024
|
+
this.metadataFailure.set(failure);
|
|
2025
|
+
if (failure === 'failed') {
|
|
2026
|
+
this.errorMessage.set(this.transloco.translate('components.entityListField.loadFailed'));
|
|
2027
|
+
}
|
|
2028
|
+
},
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
1945
2031
|
selectionRowActions = computed(() => {
|
|
1946
2032
|
this.lang();
|
|
1947
2033
|
if (!this.selectionWritable())
|
|
@@ -2972,6 +3058,7 @@ class EntityListField {
|
|
|
2972
3058
|
this.metadataFailure.set(null);
|
|
2973
3059
|
this.columns.set([]);
|
|
2974
3060
|
this.rows.set([]);
|
|
3061
|
+
this.comparison.set(null);
|
|
2975
3062
|
this.errorMessage.set(null);
|
|
2976
3063
|
this.loading.set(false);
|
|
2977
3064
|
if (!(propertyId > 0) || levelId == null || !(Number(levelId) > 0))
|
|
@@ -3023,6 +3110,12 @@ class EntityListField {
|
|
|
3023
3110
|
this.loading.set(false);
|
|
3024
3111
|
return;
|
|
3025
3112
|
}
|
|
3113
|
+
// A saved Related list opened from outside its form shows what was
|
|
3114
|
+
// preserved and what is current, not whatever the source holds today.
|
|
3115
|
+
if (this.comparisonMode()) {
|
|
3116
|
+
this.fetchComparison(metadata.propertyId);
|
|
3117
|
+
return;
|
|
3118
|
+
}
|
|
3026
3119
|
if (!this.moduleBacked() ||
|
|
3027
3120
|
!this.canRead() ||
|
|
3028
3121
|
levelDataId == null ||
|
|
@@ -3194,7 +3287,7 @@ class EntityListField {
|
|
|
3194
3287
|
};
|
|
3195
3288
|
}
|
|
3196
3289
|
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 });
|
|
3290
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, pendingSubmission: { classPropertyName: "pendingSubmission", publicName: "pendingSubmission", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, providers: [EntityRuntimeContextStore], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (errorMessage(); as err) {\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\n } @else if (noticeKey(); as notice) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ notice | transloco }}\n </div>\n } @else if (localReady()) {\n <!--\n A Local list: rows owned by this record, staged into its own submission.\n Add / edit / delete / drag follow the Local operation switches.\n -->\n @if (localCanCreate()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openLocalRowDialog()\"\n />\n </div>\n }\n @if (localTableRows().length || localCanCreate()) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"localTableRows()\"\n [columns]=\"localColumns()\"\n [rowActions]=\"localRowActions()\"\n [reorderableRows]=\"localCanReorder()\"\n (rowReorder)=\"onLocalReorder($event)\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noLocalRows\" | transloco }}\n </div>\n }\n } @else if (selectionReady()) {\n <!--\n A Selected list: the source records picked for this record, and nothing\n else. Picking and removing change only which records it holds.\n -->\n @if (selectionWritable()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.selectRecords' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openSelectionDialog()\"\n />\n </div>\n }\n @if (selectionRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"selectionRows()\"\n [columns]=\"columns()\"\n [rowActions]=\"selectionRowActions()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\n </div>\n }\n } @else if (comparisonMode()) {\n <!--\n A saved Related list opened from outside its form: its sources' current\n values, and the values preserved when it was saved. A missing baseline is\n said as such \u2014 it is not an empty list.\n -->\n @if (!comparisonReady()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else {\n <section class=\"flex flex-col gap-2\">\n <h4 class=\"text-sm font-semibold text-color\">\n {{ \"components.entityListField.currentValues\" | transloco }}\n </h4>\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n }\n </section>\n\n <section class=\"flex flex-col gap-2\">\n <h4\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\n >\n {{ \"components.entityListField.preservedValues\" | transloco }}\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs font-normal text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n </h4>\n @if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n\n @if (unavailableCount()) {\n <p class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.unavailableRecords\"\n | transloco: { count: unavailableCount() }\n }}\n </p>\n }\n }\n } @else if (canWrite()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openAddDialog()\"\n />\n </div>\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n [rowActions]=\"writeRowActions()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n } @else if (loading() && !hasRows()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else if (!hasRows()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3198
3291
|
}
|
|
3199
3292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
|
|
3200
3293
|
type: Component,
|
|
@@ -3206,7 +3299,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3206
3299
|
Table,
|
|
3207
3300
|
Button,
|
|
3208
3301
|
TranslocoPipe,
|
|
3209
|
-
|
|
3302
|
+
MTDateFormatPipe,
|
|
3303
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, providers: [EntityRuntimeContextStore], template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (errorMessage(); as err) {\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\n } @else if (noticeKey(); as notice) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ notice | transloco }}\n </div>\n } @else if (localReady()) {\n <!--\n A Local list: rows owned by this record, staged into its own submission.\n Add / edit / delete / drag follow the Local operation switches.\n -->\n @if (localCanCreate()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openLocalRowDialog()\"\n />\n </div>\n }\n @if (localTableRows().length || localCanCreate()) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"localTableRows()\"\n [columns]=\"localColumns()\"\n [rowActions]=\"localRowActions()\"\n [reorderableRows]=\"localCanReorder()\"\n (rowReorder)=\"onLocalReorder($event)\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noLocalRows\" | transloco }}\n </div>\n }\n } @else if (selectionReady()) {\n <!--\n A Selected list: the source records picked for this record, and nothing\n else. Picking and removing change only which records it holds.\n -->\n @if (selectionWritable()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.selectRecords' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openSelectionDialog()\"\n />\n </div>\n }\n @if (selectionRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"selectionRows()\"\n [columns]=\"columns()\"\n [rowActions]=\"selectionRowActions()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noSelectedRecords\" | transloco }}\n </div>\n }\n } @else if (comparisonMode()) {\n <!--\n A saved Related list opened from outside its form: its sources' current\n values, and the values preserved when it was saved. A missing baseline is\n said as such \u2014 it is not an empty list.\n -->\n @if (!comparisonReady()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else {\n <section class=\"flex flex-col gap-2\">\n <h4 class=\"text-sm font-semibold text-color\">\n {{ \"components.entityListField.currentValues\" | transloco }}\n </h4>\n @if (liveRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"liveRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n }\n </section>\n\n <section class=\"flex flex-col gap-2\">\n <h4\n class=\"flex flex-wrap items-baseline gap-2 text-sm font-semibold text-color\"\n >\n {{ \"components.entityListField.preservedValues\" | transloco }}\n @if (preservedAt(); as capturedAt) {\n <span class=\"text-xs font-normal text-muted-color\">\n {{\n \"components.entityListField.preservedAt\"\n | transloco: { date: (capturedAt | mtDateFormat: \"dateTime\") }\n }}\n </span>\n }\n </h4>\n @if (!preservedAvailable()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noPreservedSnapshot\" | transloco }}\n </div>\n } @else if (preservedRows().length) {\n <mt-table\n [noCard]=\"true\"\n [data]=\"preservedRows()\"\n [columns]=\"columns()\"\n dataKey=\"Id\"\n />\n } @else {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.preservedEmpty\" | transloco }}\n </div>\n }\n </section>\n\n @if (unavailableCount()) {\n <p class=\"text-xs text-muted-color\">\n {{\n \"components.entityListField.unavailableRecords\"\n | transloco: { count: unavailableCount() }\n }}\n </p>\n }\n }\n } @else if (canWrite()) {\n <div class=\"flex justify-end\">\n <mt-button\n [label]=\"'components.entityListField.add' | transloco\"\n icon=\"general.plus\"\n size=\"small\"\n [disabled]=\"disabled()\"\n (onClick)=\"openAddDialog()\"\n />\n </div>\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n [rowActions]=\"writeRowActions()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n } @else if (loading() && !hasRows()) {\n <div class=\"flex flex-col gap-2\">\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n <p-skeleton width=\"100%\" height=\"3rem\" borderRadius=\"0.375rem\" />\n </div>\n } @else if (!hasRows()) {\n <div\n class=\"rounded-md border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"displayRows()\"\n [columns]=\"tableColumns()\"\n dataKey=\"Id\"\n [loading]=\"loading()\"\n />\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n", styles: [":host{display:block}\n"] }]
|
|
3210
3304
|
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: false }] }], propertyKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyKey", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }], pendingSubmission: [{ type: i0.Input, args: [{ isSignal: true, alias: "pendingSubmission", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }], initialValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValue", required: false }] }] } });
|
|
3211
3305
|
|
|
3212
3306
|
/**
|