@masterteam/components 0.0.302 → 0.0.304
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/common.css +1 -1
- package/assets/i18n/ar.json +406 -392
- package/assets/i18n/en.json +406 -392
- package/fesm2022/masterteam-components-business-fields.mjs +601 -30
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +190 -18
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +6 -0
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +110 -7
- package/types/masterteam-components-entities.d.ts +154 -78
- package/types/masterteam-components.d.ts +12 -0
|
@@ -27,6 +27,13 @@ function isEntityListLocalDocument(value) {
|
|
|
27
27
|
!Array.isArray(value) &&
|
|
28
28
|
value.storageMode === 'Local');
|
|
29
29
|
}
|
|
30
|
+
/** Whether a stored or rendered `EntityList` value is a Selected document. */
|
|
31
|
+
function isEntityListSelectionDocument(value) {
|
|
32
|
+
return (!!value &&
|
|
33
|
+
typeof value === 'object' &&
|
|
34
|
+
!Array.isArray(value) &&
|
|
35
|
+
value.recordMode === 'Selected');
|
|
36
|
+
}
|
|
30
37
|
|
|
31
38
|
/**
|
|
32
39
|
* A section is persisted/transported as an ordinary display item whose
|
|
@@ -1852,6 +1859,9 @@ function buildEntityListRows(data, allowed = [], lang = 'en') {
|
|
|
1852
1859
|
if (isEntityListLocalDocument(value)) {
|
|
1853
1860
|
return buildLocalRows(value, data, allowed, lang);
|
|
1854
1861
|
}
|
|
1862
|
+
if (isEntityListSelectionDocument(value)) {
|
|
1863
|
+
return buildSelectionRows(value, data, allowed);
|
|
1864
|
+
}
|
|
1855
1865
|
const fields = visibleFields(data, allowed);
|
|
1856
1866
|
const rows = value?.rows;
|
|
1857
1867
|
if (!Array.isArray(rows))
|
|
@@ -1881,8 +1891,9 @@ function buildEntityListRows(data, allowed = [], lang = 'en') {
|
|
|
1881
1891
|
* The projected document `process-form-load` returns carries its own
|
|
1882
1892
|
* `schema`, and it wins: pending and approved evidence is pinned to the schema
|
|
1883
1893
|
* it was submitted against, which the property configuration's *active* one
|
|
1884
|
-
* may no longer be. The fetch endpoints
|
|
1885
|
-
*
|
|
1894
|
+
* may no longer be. The fetch endpoints project against the active schema;
|
|
1895
|
+
* an older backend returned the stored document there (`schema: null`), for
|
|
1896
|
+
* which the configuration's `localSchema` is the fallback.
|
|
1886
1897
|
* Cells are keyed by the field's local id and carry the backend-rendered
|
|
1887
1898
|
* `value` beside `rawValue` where one was rendered; otherwise the raw value
|
|
1888
1899
|
* shows.
|
|
@@ -1913,14 +1924,132 @@ function buildLocalRows(document, data, allowed, lang) {
|
|
|
1913
1924
|
order: field.order,
|
|
1914
1925
|
};
|
|
1915
1926
|
});
|
|
1916
|
-
|
|
1927
|
+
// The title names the row, and it renders without its label. The first
|
|
1928
|
+
// field of a Local list is whatever the field manager put first — often a
|
|
1929
|
+
// progress bar or a date, which as a bare headline reads as the row's
|
|
1930
|
+
// name. So the title is the first filled text field; everything else keeps
|
|
1931
|
+
// its label, in schema order. A row with no text to name it has no title.
|
|
1932
|
+
const titleIndex = rendered.findIndex(isRowNameField);
|
|
1933
|
+
const title = titleIndex >= 0 ? rendered[titleIndex] : null;
|
|
1917
1934
|
return {
|
|
1918
1935
|
id: row.rowId,
|
|
1919
|
-
title:
|
|
1920
|
-
fields:
|
|
1936
|
+
title: title ? { ...title, configuration: TITLE_FIELD_CONFIG } : null,
|
|
1937
|
+
fields: rendered.filter((_, index) => index !== titleIndex),
|
|
1921
1938
|
};
|
|
1922
1939
|
});
|
|
1923
1940
|
}
|
|
1941
|
+
/**
|
|
1942
|
+
* Rows of a Selected list (`recordMode: "Selected"`): one per selected record
|
|
1943
|
+
* the value carries values for, in selection order.
|
|
1944
|
+
*
|
|
1945
|
+
* Here there is no metadata request, so nothing names the fields or their
|
|
1946
|
+
* view types: labels come from the keys and each value renders as its display
|
|
1947
|
+
* text. A record whose values the backend withheld (`unavailableIds`) has
|
|
1948
|
+
* nothing to show and is left out.
|
|
1949
|
+
*
|
|
1950
|
+
* `allowed` narrows by field key; otherwise the configured `readFields`
|
|
1951
|
+
* order, then the order the values arrived in.
|
|
1952
|
+
*/
|
|
1953
|
+
function buildSelectionRows(document, data, allowed) {
|
|
1954
|
+
const records = new Map((document.records ?? []).map((record) => [record.entityId, record]));
|
|
1955
|
+
const ids = document.entityIds?.length
|
|
1956
|
+
? document.entityIds
|
|
1957
|
+
: [...records.keys()];
|
|
1958
|
+
const configured = readConfiguredReadFields(data);
|
|
1959
|
+
return ids.flatMap((id) => {
|
|
1960
|
+
const record = records.get(id);
|
|
1961
|
+
if (!record)
|
|
1962
|
+
return [];
|
|
1963
|
+
const values = new Map((record.values ?? []).map((item) => [item.propertyKey, item]));
|
|
1964
|
+
const keys = allowed.length
|
|
1965
|
+
? allowed
|
|
1966
|
+
: configured.length
|
|
1967
|
+
? configured
|
|
1968
|
+
: [...values.keys()];
|
|
1969
|
+
const rendered = keys
|
|
1970
|
+
.map((key) => values.get(key))
|
|
1971
|
+
.filter((item) => !!item)
|
|
1972
|
+
.map((item, index) => ({
|
|
1973
|
+
key: item.propertyKey,
|
|
1974
|
+
name: humanizeEntityListKey(item.propertyKey),
|
|
1975
|
+
...selectionCell(item.value, item.rawValue),
|
|
1976
|
+
rawValue: item.rawValue ?? undefined,
|
|
1977
|
+
configuration: NESTED_FIELD_CONFIG,
|
|
1978
|
+
order: index,
|
|
1979
|
+
}));
|
|
1980
|
+
const [first, ...rest] = rendered;
|
|
1981
|
+
return [
|
|
1982
|
+
{
|
|
1983
|
+
id: String(record.entityId),
|
|
1984
|
+
title: first ? { ...first, configuration: TITLE_FIELD_CONFIG } : null,
|
|
1985
|
+
fields: rest,
|
|
1986
|
+
},
|
|
1987
|
+
];
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
/** The configured displayed fields of a Selected list, if any. */
|
|
1991
|
+
function readConfiguredReadFields(data) {
|
|
1992
|
+
for (const source of [data.propertyConfiguration, data.configuration]) {
|
|
1993
|
+
if (!source || Array.isArray(source))
|
|
1994
|
+
continue;
|
|
1995
|
+
const fields = source['readFields'];
|
|
1996
|
+
if (Array.isArray(fields) && fields.length) {
|
|
1997
|
+
return fields.filter((key) => typeof key === 'string' && !!key);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
return [];
|
|
2001
|
+
}
|
|
2002
|
+
/** An ISO date or date-time, as the backend renders a Date / DateTime value. */
|
|
2003
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
2004
|
+
/**
|
|
2005
|
+
* How one Selected cell renders without field metadata — a table cell has
|
|
2006
|
+
* none to ask for. The rendered value's own shape decides: an ISO date is a
|
|
2007
|
+
* `Date` (printed `2026/09/20`, not `2026-09-20T00:00:00.0000000Z`), a user
|
|
2008
|
+
* object a `User`, and everything else its display text.
|
|
2009
|
+
*/
|
|
2010
|
+
function selectionCell(value, rawValue) {
|
|
2011
|
+
if (typeof value === 'string' && ISO_DATE.test(value.trim())) {
|
|
2012
|
+
return { viewType: 'Date', value: value.trim() };
|
|
2013
|
+
}
|
|
2014
|
+
if (value &&
|
|
2015
|
+
typeof value === 'object' &&
|
|
2016
|
+
!Array.isArray(value) &&
|
|
2017
|
+
typeof value['displayName'] === 'string') {
|
|
2018
|
+
return { viewType: 'User', value: value };
|
|
2019
|
+
}
|
|
2020
|
+
return { viewType: 'Text', value: selectionDisplayText(value, rawValue) };
|
|
2021
|
+
}
|
|
2022
|
+
/**
|
|
2023
|
+
* A rendered source value as text: a scalar as is, a user or a lookup by its
|
|
2024
|
+
* display name, a list joined. Falls back to the stored scalar.
|
|
2025
|
+
*/
|
|
2026
|
+
function selectionDisplayText(value, rawValue) {
|
|
2027
|
+
if (value == null || value === '')
|
|
2028
|
+
return rawValue ?? '';
|
|
2029
|
+
if (Array.isArray(value)) {
|
|
2030
|
+
return value
|
|
2031
|
+
.map((entry) => selectionDisplayText(entry, null))
|
|
2032
|
+
.filter((text) => !!text)
|
|
2033
|
+
.join(', ');
|
|
2034
|
+
}
|
|
2035
|
+
if (typeof value !== 'object')
|
|
2036
|
+
return String(value);
|
|
2037
|
+
const record = value;
|
|
2038
|
+
for (const key of ['display', 'displayName', 'name']) {
|
|
2039
|
+
const text = record[key];
|
|
2040
|
+
if (typeof text === 'string' && text.trim())
|
|
2041
|
+
return text.trim();
|
|
2042
|
+
}
|
|
2043
|
+
return rawValue ?? '';
|
|
2044
|
+
}
|
|
2045
|
+
/** A text field with a value — something that can name a row. */
|
|
2046
|
+
function isRowNameField(entity) {
|
|
2047
|
+
if (entity.viewType !== 'Text' && entity.viewType !== 'LongText') {
|
|
2048
|
+
return false;
|
|
2049
|
+
}
|
|
2050
|
+
const value = entity.value;
|
|
2051
|
+
return typeof value === 'string' ? value.trim().length > 0 : value != null;
|
|
2052
|
+
}
|
|
1924
2053
|
/** The active Local schema from the property configuration, if any. */
|
|
1925
2054
|
function readConfiguredLocalSchema(data) {
|
|
1926
2055
|
for (const source of [data.propertyConfiguration, data.configuration]) {
|
|
@@ -2150,25 +2279,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
2150
2279
|
* and a checklist of fifteen made the grid unreadable. The drawer has the
|
|
2151
2280
|
* width and height this content actually needs.
|
|
2152
2281
|
*
|
|
2282
|
+
* With a `table` it renders the list the way a record preview does — the
|
|
2283
|
+
* read-only `mt-entity-list-field`, with its columns, typed cells and access
|
|
2284
|
+
* notices — for a table cell whose host knew the record's runtime ids.
|
|
2285
|
+
* Otherwise it renders the rows the value itself carries.
|
|
2286
|
+
*
|
|
2153
2287
|
* Created through `ModalService`, so its inputs arrive via `inputValues` and
|
|
2154
2288
|
* it is built with the **root** injector — nothing route-provided is visible
|
|
2155
|
-
* here, which is why it takes the already-resolved entity
|
|
2156
|
-
* anything up.
|
|
2289
|
+
* here, which is why it takes the already-resolved entity and table rather
|
|
2290
|
+
* than looking anything up.
|
|
2157
2291
|
*/
|
|
2158
2292
|
class EntityListDrawer {
|
|
2159
2293
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
2160
2294
|
/** Ordered allowlist of nested field keys; empty renders all of them. */
|
|
2161
2295
|
fields = input([], ...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
2296
|
+
/** The list's table, when the opener could build one; see above. */
|
|
2297
|
+
table = input(null, ...(ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []));
|
|
2162
2298
|
/** A Local list's labels are `{ en, ar }` pairs; see `sharedActiveLang`. */
|
|
2163
2299
|
activeLang = sharedActiveLang(inject(TranslocoService));
|
|
2164
2300
|
rows = computed(() => buildEntityListRows(this.data(), this.fields(), this.activeLang()), ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
2165
2301
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListDrawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2166
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListDrawer, isStandalone: true, selector: "mt-entity-list-drawer", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block h-full" }, ngImport: i0, template: "<!--\n Owns its scroll rather than taking the shared `mt-modal-content` shell: that\n class reserves 60px for a footer, and this drawer is read-only and has none,\n so it would leave a dead strip at the bottom. `h-full` chains off the host's,\n which chains off `.p-drawer-content` \u2014 the one definite height here.\n-->\n<div class=\"flex h-full flex-col gap-2 overflow-auto p-5\">\n @for (row of rows(); track row.id) {\n
|
|
2302
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListDrawer, isStandalone: true, selector: "mt-entity-list-drawer", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, table: { classPropertyName: "table", publicName: "table", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block h-full" }, ngImport: i0, template: "<!--\n Owns its scroll rather than taking the shared `mt-modal-content` shell: that\n class reserves 60px for a footer, and this drawer is read-only and has none,\n so it would leave a dead strip at the bottom. `h-full` chains off the host's,\n which chains off `.p-drawer-content` \u2014 the one definite height here.\n-->\n<div class=\"flex h-full flex-col gap-2 overflow-auto p-5\">\n @if (table(); as host) {\n <!--\n The list as a record preview renders it: the read-only\n `mt-entity-list-field`, through the component the opener handed over \u2014\n it cannot be imported here without a circular entry point.\n -->\n <ng-container\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\n ></ng-container>\n } @else {\n @for (row of rows(); track row.id) {\n <div\n class=\"rounded-md border border-surface-200 bg-surface-50 px-3 py-2.5\"\n >\n @if (row.title; as title) {\n <div class=\"min-w-0 text-sm font-medium text-color\">\n <mt-entity-value-preview [data]=\"title\" attachmentShape=\"compact\" />\n </div>\n }\n\n @if (row.fields.length) {\n <!--\n The drawer has room the cell did not, so fields get a real grid with\n their labels instead of being crushed onto one wrapping line.\n `auto-fill` adapts to the drawer's actual width without a container\n query, and the `min()` floor keeps a narrow drawer from being forced\n wider than the viewport.\n -->\n <div\n class=\"mt-2 grid gap-x-4 gap-y-3 [grid-template-columns:repeat(auto-fill,minmax(min(9rem,100%),1fr))]\"\n >\n @for (field of row.fields; track field.key) {\n <div class=\"min-w-0 overflow-hidden\">\n <mt-entity-value-preview\n [data]=\"field\"\n attachmentShape=\"compact\"\n />\n </div>\n }\n </div>\n }\n </div>\n }\n }\n</div>\n", dependencies: [{ kind: "component", type: EntityValuePreview, selector: "mt-entity-value-preview", inputs: ["data", "attachmentShape"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2167
2303
|
}
|
|
2168
2304
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListDrawer, decorators: [{
|
|
2169
2305
|
type: Component,
|
|
2170
|
-
args: [{ selector: 'mt-entity-list-drawer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityValuePreview], host: { class: 'block h-full' }, template: "<!--\n Owns its scroll rather than taking the shared `mt-modal-content` shell: that\n class reserves 60px for a footer, and this drawer is read-only and has none,\n so it would leave a dead strip at the bottom. `h-full` chains off the host's,\n which chains off `.p-drawer-content` \u2014 the one definite height here.\n-->\n<div class=\"flex h-full flex-col gap-2 overflow-auto p-5\">\n @for (row of rows(); track row.id) {\n
|
|
2171
|
-
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }] } });
|
|
2306
|
+
args: [{ selector: 'mt-entity-list-drawer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityValuePreview, NgComponentOutlet], host: { class: 'block h-full' }, template: "<!--\n Owns its scroll rather than taking the shared `mt-modal-content` shell: that\n class reserves 60px for a footer, and this drawer is read-only and has none,\n so it would leave a dead strip at the bottom. `h-full` chains off the host's,\n which chains off `.p-drawer-content` \u2014 the one definite height here.\n-->\n<div class=\"flex h-full flex-col gap-2 overflow-auto p-5\">\n @if (table(); as host) {\n <!--\n The list as a record preview renders it: the read-only\n `mt-entity-list-field`, through the component the opener handed over \u2014\n it cannot be imported here without a circular entry point.\n -->\n <ng-container\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\n ></ng-container>\n } @else {\n @for (row of rows(); track row.id) {\n <div\n class=\"rounded-md border border-surface-200 bg-surface-50 px-3 py-2.5\"\n >\n @if (row.title; as title) {\n <div class=\"min-w-0 text-sm font-medium text-color\">\n <mt-entity-value-preview [data]=\"title\" attachmentShape=\"compact\" />\n </div>\n }\n\n @if (row.fields.length) {\n <!--\n The drawer has room the cell did not, so fields get a real grid with\n their labels instead of being crushed onto one wrapping line.\n `auto-fill` adapts to the drawer's actual width without a container\n query, and the `min()` floor keeps a narrow drawer from being forced\n wider than the viewport.\n -->\n <div\n class=\"mt-2 grid gap-x-4 gap-y-3 [grid-template-columns:repeat(auto-fill,minmax(min(9rem,100%),1fr))]\"\n >\n @for (field of row.fields; track field.key) {\n <div class=\"min-w-0 overflow-hidden\">\n <mt-entity-value-preview\n [data]=\"field\"\n attachmentShape=\"compact\"\n />\n </div>\n }\n </div>\n }\n </div>\n }\n }\n</div>\n" }]
|
|
2307
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], table: [{ type: i0.Input, args: [{ isSignal: true, alias: "table", required: false }] }] } });
|
|
2172
2308
|
|
|
2173
2309
|
/** Rows named in the tooltip before it collapses into "+N more". */
|
|
2174
2310
|
const TOOLTIP_ROW_LIMIT = 6;
|
|
@@ -2267,11 +2403,19 @@ class EntityListPreview {
|
|
|
2267
2403
|
* re-applies inputs on identity change — a fresh object per change-detection
|
|
2268
2404
|
* pass would re-write every input on every tick.
|
|
2269
2405
|
*/
|
|
2270
|
-
tableHost = computed(() => {
|
|
2406
|
+
tableHost = computed(() => this.buildTableHost(this.runtimeContextStore?.context() ?? null), ...(ngDevMode ? [{ debugName: "tableHost" }] : /* istanbul ignore next */ []));
|
|
2407
|
+
/**
|
|
2408
|
+
* The same table, for the drawer of a table cell. A cell publishes no
|
|
2409
|
+
* runtime context — an inline table would set the height of every row — but
|
|
2410
|
+
* a host that knows the record's ids puts them on the value
|
|
2411
|
+
* (`EntityData.runtimeContext`), and the drawer then shows the list exactly
|
|
2412
|
+
* as a record preview does, instead of the value-only rows.
|
|
2413
|
+
*/
|
|
2414
|
+
drawerTable = computed(() => this.tableHost() ? null : this.buildTableHost(this.data().runtimeContext), ...(ngDevMode ? [{ debugName: "drawerTable" }] : /* istanbul ignore next */ []));
|
|
2415
|
+
buildTableHost(context) {
|
|
2271
2416
|
const component = this.tableComponent;
|
|
2272
2417
|
if (!component || !this.moduleBacked())
|
|
2273
2418
|
return null;
|
|
2274
|
-
const context = this.runtimeContextStore?.context() ?? null;
|
|
2275
2419
|
if (!context || !(Number(context.levelId) > 0))
|
|
2276
2420
|
return null;
|
|
2277
2421
|
const data = this.data();
|
|
@@ -2294,7 +2438,29 @@ class EntityListPreview {
|
|
|
2294
2438
|
label: '',
|
|
2295
2439
|
},
|
|
2296
2440
|
};
|
|
2297
|
-
}
|
|
2441
|
+
}
|
|
2442
|
+
/**
|
|
2443
|
+
* Whether the value itself holds the list's rows — a Local or Selected
|
|
2444
|
+
* document. A Related list's value is membership and evidence only; its
|
|
2445
|
+
* rows are read by the table, so its cell does not claim a count.
|
|
2446
|
+
*/
|
|
2447
|
+
valueHoldsRows = computed(() => {
|
|
2448
|
+
const value = this.data().value;
|
|
2449
|
+
return (isEntityListLocalDocument(value) || isEntityListSelectionDocument(value));
|
|
2450
|
+
}, ...(ngDevMode ? [{ debugName: "valueHoldsRows" }] : /* istanbul ignore next */ []));
|
|
2451
|
+
/** The trigger shows when there are rows to count, or a table to open. */
|
|
2452
|
+
showTrigger = computed(() => this.hasRows() || !!this.drawerTable(), ...(ngDevMode ? [{ debugName: "showTrigger" }] : /* istanbul ignore next */ []));
|
|
2453
|
+
/**
|
|
2454
|
+
* The trigger's label: the row count when the value holds the rows, else
|
|
2455
|
+
* "View" — a Related list's saved membership is not what its table shows,
|
|
2456
|
+
* so it is not presented as a count.
|
|
2457
|
+
*/
|
|
2458
|
+
triggerLabel = computed(() => {
|
|
2459
|
+
this.activeLang();
|
|
2460
|
+
return this.valueHoldsRows() || !this.drawerTable()
|
|
2461
|
+
? this.count().toString()
|
|
2462
|
+
: this.viewLabel();
|
|
2463
|
+
}, ...(ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []));
|
|
2298
2464
|
/**
|
|
2299
2465
|
* An empty list reads as the standard empty value, not as a sentence — this
|
|
2300
2466
|
* sits in a table cell, where a "no related items" line would be louder than
|
|
@@ -2308,7 +2474,10 @@ class EntityListPreview {
|
|
|
2308
2474
|
*/
|
|
2309
2475
|
ariaLabel = computed(() => {
|
|
2310
2476
|
this.activeLang();
|
|
2311
|
-
|
|
2477
|
+
const label = this.triggerLabel();
|
|
2478
|
+
return label === this.viewLabel()
|
|
2479
|
+
? label
|
|
2480
|
+
: `${this.viewLabel()} (${label})`;
|
|
2312
2481
|
}, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
2313
2482
|
/**
|
|
2314
2483
|
* Names the rows, so the cell answers "which ones?" on hover. Falls back to
|
|
@@ -2351,23 +2520,26 @@ class EntityListPreview {
|
|
|
2351
2520
|
return this.transloco.translate('components.entityListPreview.view');
|
|
2352
2521
|
}
|
|
2353
2522
|
openDrawer() {
|
|
2523
|
+
const table = this.drawerTable();
|
|
2354
2524
|
this.modal.openModal(EntityListDrawer, 'drawer', {
|
|
2355
2525
|
header: this.label() || undefined,
|
|
2356
2526
|
position: 'end',
|
|
2357
|
-
|
|
2527
|
+
// A table needs the width a stack of rows does not.
|
|
2528
|
+
styleClass: table ? '!w-[60rem] max-w-[96vw]' : '!w-[34rem] max-w-[96vw]',
|
|
2358
2529
|
dismissableMask: true,
|
|
2359
2530
|
inputValues: {
|
|
2360
2531
|
data: this.data(),
|
|
2361
2532
|
fields: this.fields(),
|
|
2533
|
+
table,
|
|
2362
2534
|
},
|
|
2363
2535
|
});
|
|
2364
2536
|
}
|
|
2365
2537
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2366
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListPreview, isStandalone: true, selector: "mt-entity-list-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"label()\"\n [configuration]=\"data().configuration\"\n gap=\"normal\"\n>\n @if (tableHost(); as host) {\n <!--\n The related records, rendered in full by the read-only\n `mt-entity-list-field`. It owns the metadata request, the access notices\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\n arrives through an outlet rather than an import.\n -->\n <ng-container\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\n ></ng-container>\n } @else if (
|
|
2538
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListPreview, isStandalone: true, selector: "mt-entity-list-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"label()\"\n [configuration]=\"data().configuration\"\n gap=\"normal\"\n>\n @if (tableHost(); as host) {\n <!--\n The related records, rendered in full by the read-only\n `mt-entity-list-field`. It owns the metadata request, the access notices\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\n arrives through an outlet rather than an import.\n -->\n <ng-container\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\n ></ng-container>\n } @else if (showTrigger()) {\n <!--\n The count carries the information; the button carries the affordance.\n `mt-button` owns the tooltip and the accessible name, so the trigger is\n one element rather than a button wrapped in a tooltip host. A Related\n list opened as a table says \"View\" instead of a count; see\n `triggerLabel`.\n -->\n <mt-button\n icon=\"general.eye\"\n [label]=\"triggerLabel()\"\n [tooltip]=\"tooltip()\"\n [ariaLabel]=\"ariaLabel()\"\n variant=\"text\"\n size=\"small\"\n styleClass=\"!px-2 !py-1 !gap-1\"\n (onClick)=\"openDrawer()\"\n />\n } @else {\n <span\n class=\"inline-flex w-fit items-center rounded-md bg-surface-100 px-3 py-2 text-xs font-semibold text-muted-color\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { 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: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2367
2539
|
}
|
|
2368
2540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListPreview, decorators: [{
|
|
2369
2541
|
type: Component,
|
|
2370
|
-
args: [{ selector: 'mt-entity-list-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityField, Button, NgComponentOutlet], template: "<mt-entity-field\n [label]=\"label()\"\n [configuration]=\"data().configuration\"\n gap=\"normal\"\n>\n @if (tableHost(); as host) {\n <!--\n The related records, rendered in full by the read-only\n `mt-entity-list-field`. It owns the metadata request, the access notices\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\n arrives through an outlet rather than an import.\n -->\n <ng-container\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\n ></ng-container>\n } @else if (
|
|
2542
|
+
args: [{ selector: 'mt-entity-list-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityField, Button, NgComponentOutlet], template: "<mt-entity-field\n [label]=\"label()\"\n [configuration]=\"data().configuration\"\n gap=\"normal\"\n>\n @if (tableHost(); as host) {\n <!--\n The related records, rendered in full by the read-only\n `mt-entity-list-field`. It owns the metadata request, the access notices\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\n arrives through an outlet rather than an import.\n -->\n <ng-container\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\n ></ng-container>\n } @else if (showTrigger()) {\n <!--\n The count carries the information; the button carries the affordance.\n `mt-button` owns the tooltip and the accessible name, so the trigger is\n one element rather than a button wrapped in a tooltip host. A Related\n list opened as a table says \"View\" instead of a count; see\n `triggerLabel`.\n -->\n <mt-button\n icon=\"general.eye\"\n [label]=\"triggerLabel()\"\n [tooltip]=\"tooltip()\"\n [ariaLabel]=\"ariaLabel()\"\n variant=\"text\"\n size=\"small\"\n styleClass=\"!px-2 !py-1 !gap-1\"\n (onClick)=\"openDrawer()\"\n />\n } @else {\n <span\n class=\"inline-flex w-fit items-center rounded-md bg-surface-100 px-3 py-2 text-xs font-semibold text-muted-color\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n" }]
|
|
2371
2543
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }] } });
|
|
2372
2544
|
|
|
2373
2545
|
/**
|
|
@@ -3405,5 +3577,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3405
3577
|
* Generated bundle index. Do not edit.
|
|
3406
3578
|
*/
|
|
3407
3579
|
|
|
3408
|
-
export { CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, ENTITY_LIST_TABLE_COMPONENT, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityRuntimeContextStore, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, getEntitySectionTitle, groupEntitiesIntoSections, humanizeEntityListKey, isConnectionSyntheticKey, isEntityAlignEnd, isEntityLabelHidden, isEntityListLocalDocument, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, localCellsByFieldId, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, readEntityValueColor, resolveConnectionLevelName, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalFieldConfiguration, resolveLocalFieldLabel, resolveLocalFieldViewType, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, sharedActiveLang, sortLocalRows, splitConnectionKey, splitLeafKey, summarizeEntityListRows, visibleLocalSchemaFields };
|
|
3580
|
+
export { CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, ENTITY_LIST_TABLE_COMPONENT, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityRuntimeContextStore, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, getEntitySectionTitle, groupEntitiesIntoSections, humanizeEntityListKey, isConnectionSyntheticKey, isEntityAlignEnd, isEntityLabelHidden, isEntityListLocalDocument, isEntityListSelectionDocument, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, localCellsByFieldId, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, readEntityValueColor, resolveConnectionLevelName, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalFieldConfiguration, resolveLocalFieldLabel, resolveLocalFieldViewType, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, sharedActiveLang, sortLocalRows, splitConnectionKey, splitLeafKey, summarizeEntityListRows, visibleLocalSchemaFields };
|
|
3409
3581
|
//# sourceMappingURL=masterteam-components-entities.mjs.map
|