@masterteam/components 0.0.300 → 0.0.302
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 +392 -391
- package/assets/i18n/en.json +392 -391
- package/fesm2022/masterteam-components-business-fields.mjs +696 -51
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +2 -2
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +363 -293
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs +2 -2
- package/fesm2022/masterteam-components-radio-button-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +23 -2
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +1 -1
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs +2 -2
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +43 -2
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +259 -29
- package/types/masterteam-components-entities.d.ts +252 -111
- package/types/masterteam-components-select-field.d.ts +14 -0
- package/types/masterteam-components.d.ts +27 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, ChangeDetectionStrategy, Component, inject, ElementRef, DestroyRef, afterNextRender, Directive,
|
|
2
|
+
import { signal, Injectable, InjectionToken, input, computed, ChangeDetectionStrategy, Component, inject, ElementRef, DestroyRef, afterNextRender, Directive, effect, untracked, ViewEncapsulation, output, NgZone, model } from '@angular/core';
|
|
3
3
|
import { TruncateTooltip, Tooltip } from '@masterteam/components/tooltip';
|
|
4
4
|
import { Icon } from '@masterteam/icons';
|
|
5
|
-
import { MTDateFormatPipe, REQUEST_CONTEXT, readableTextOn } from '@masterteam/components';
|
|
5
|
+
import { MTDateFormatPipe, REQUEST_CONTEXT, coerceCheckboxValue, readableTextOn } from '@masterteam/components';
|
|
6
6
|
import { HttpContext, HttpClient } from '@angular/common/http';
|
|
7
7
|
import { TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
|
8
8
|
import { Avatar } from '@masterteam/components/avatar';
|
|
@@ -14,12 +14,20 @@ import { FormsModule } from '@angular/forms';
|
|
|
14
14
|
import { Button } from '@masterteam/components/button';
|
|
15
15
|
import { forkJoin, finalize, of, take, switchMap, EMPTY, map, catchError } from 'rxjs';
|
|
16
16
|
import { Chip } from '@masterteam/components/chip';
|
|
17
|
+
import { NgComponentOutlet, NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
17
18
|
import { ModalService } from '@masterteam/components/modal';
|
|
18
19
|
import * as i1$1 from 'primeng/tooltip';
|
|
19
20
|
import { TooltipModule } from 'primeng/tooltip';
|
|
20
|
-
import { NgComponentOutlet, NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
21
21
|
import { CdkDrag, CdkDropList, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
|
|
22
22
|
|
|
23
|
+
/** Whether a stored or rendered `EntityList` value is a Local document. */
|
|
24
|
+
function isEntityListLocalDocument(value) {
|
|
25
|
+
return (!!value &&
|
|
26
|
+
typeof value === 'object' &&
|
|
27
|
+
!Array.isArray(value) &&
|
|
28
|
+
value.storageMode === 'Local');
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
/**
|
|
24
32
|
* A section is persisted/transported as an ordinary display item whose
|
|
25
33
|
* `propertyKey` carries this sentinel prefix instead of a real property key
|
|
@@ -224,6 +232,40 @@ function normalizeNumerals(input) {
|
|
|
224
232
|
.replace(/[٬ ]/g, '');
|
|
225
233
|
}
|
|
226
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Publishes an `EntityRuntimeContext` to a subtree of entity renderers.
|
|
237
|
+
*
|
|
238
|
+
* Deliberately **not** `providedIn: 'root'`: an unprovided store is the signal
|
|
239
|
+
* that the host has no runtime context, and every consumer injects it
|
|
240
|
+
* `{ optional: true }`. Providing it on a component scopes it to that
|
|
241
|
+
* component's view — which is also how a nested renderer shuts the context
|
|
242
|
+
* off for its own children (see `EntityListField`, whose table cells must not
|
|
243
|
+
* re-enter the fetching path).
|
|
244
|
+
*/
|
|
245
|
+
class EntityRuntimeContextStore {
|
|
246
|
+
context = signal(null, ...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
247
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityRuntimeContextStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
248
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityRuntimeContextStore });
|
|
249
|
+
}
|
|
250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityRuntimeContextStore, decorators: [{
|
|
251
|
+
type: Injectable
|
|
252
|
+
}] });
|
|
253
|
+
/**
|
|
254
|
+
* The component `mt-entity-list-preview` renders inline instead of its
|
|
255
|
+
* count-and-drawer trigger, when a runtime context is available.
|
|
256
|
+
*
|
|
257
|
+
* Indirection rather than a direct import because the real renderer is
|
|
258
|
+
* `mt-entity-list-field` (`@masterteam/components/business-fields`), which
|
|
259
|
+
* builds on `mt-table` — and `table` already imports `entities`, so importing
|
|
260
|
+
* it back here would make the two entry points circular. The provider lives
|
|
261
|
+
* with the component: `provideEntityListTablePreview()`.
|
|
262
|
+
*
|
|
263
|
+
* The component is created with `NgComponentOutlet` and receives
|
|
264
|
+
* `propertyId`, `runtimeContext`, `configuration`, `initialValue`, `readonly`
|
|
265
|
+
* and `label` as inputs.
|
|
266
|
+
*/
|
|
267
|
+
const ENTITY_LIST_TABLE_COMPONENT = new InjectionToken('ENTITY_LIST_TABLE_COMPONENT');
|
|
268
|
+
|
|
227
269
|
class EntityField {
|
|
228
270
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
229
271
|
labelIconName = input(null, ...(ngDevMode ? [{ debugName: "labelIconName" }] : /* istanbul ignore next */ []));
|
|
@@ -934,30 +976,16 @@ class EntityCheckbox {
|
|
|
934
976
|
displayName = computed(() => this.data()?.name ?? this.name() ?? '', ...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
|
|
935
977
|
emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;
|
|
936
978
|
hideName = computed(() => isEntityLabelHidden(this.data()?.configuration), ...(ngDevMode ? [{ debugName: "hideName" }] : /* istanbul ignore next */ []));
|
|
979
|
+
// Reads `rawValue` first (the value as stored) and falls back to the
|
|
980
|
+
// rendered `value`. Both arrive as text — `coerceCheckboxValue` owns the
|
|
981
|
+
// single definition of which strings count as checked, shared with the
|
|
982
|
+
// editable form so a record cannot preview one way and edit another.
|
|
937
983
|
checkboxState = computed(() => {
|
|
938
|
-
const raw = this.data()?.rawValue ?? this.rawValue();
|
|
939
|
-
if (raw !==
|
|
940
|
-
return
|
|
941
|
-
|
|
942
|
-
const val = this.data()?.value ?? this.value();
|
|
943
|
-
if (typeof val === 'string') {
|
|
944
|
-
return this.parseBoolean(val);
|
|
945
|
-
}
|
|
946
|
-
return null;
|
|
984
|
+
const raw = coerceCheckboxValue(this.data()?.rawValue ?? this.rawValue());
|
|
985
|
+
if (raw !== null)
|
|
986
|
+
return raw;
|
|
987
|
+
return coerceCheckboxValue(this.data()?.value ?? this.value());
|
|
947
988
|
}, ...(ngDevMode ? [{ debugName: "checkboxState" }] : /* istanbul ignore next */ []));
|
|
948
|
-
parseBoolean(value) {
|
|
949
|
-
const normalized = value.trim().toLowerCase();
|
|
950
|
-
if (!normalized.length) {
|
|
951
|
-
return null;
|
|
952
|
-
}
|
|
953
|
-
if (normalized === 'true') {
|
|
954
|
-
return true;
|
|
955
|
-
}
|
|
956
|
-
if (normalized === 'false') {
|
|
957
|
-
return false;
|
|
958
|
-
}
|
|
959
|
-
return null;
|
|
960
|
-
}
|
|
961
989
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
962
990
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityCheckbox, isStandalone: true, selector: "mt-entity-checkbox", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rawValue: { classPropertyName: "rawValue", publicName: "rawValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex items-center gap-2\">\r\n @if (checkboxState() === true) {\r\n <svg class=\"w-5 h-5 text-green-500\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else if (checkboxState() === false) {\r\n <svg class=\"w-5 h-5 text-gray-300\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm-1-5.414l-2.293-2.293a1 1 0 011.414-1.414L10 11.172l3.879-3.879a1 1 0 111.414 1.414L10 13.414l-.707-.707-.293-.293z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else {\r\n <span\r\n class=\"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-100 px-1 text-[10px] font-semibold text-gray-500\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n @if (!hideName()) {\r\n <span class=\"text-sm font-semibold\">{{ displayName() }}</span>\r\n }\r\n</div>\r\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
963
991
|
}
|
|
@@ -1559,6 +1587,87 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1559
1587
|
args: [{ selector: 'mt-entity-schedule-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, Chip], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n gap=\"normal\"\n>\n @if (items().length) {\n <div class=\"flex flex-wrap items-center gap-2\">\n @for (item of items(); track item.id) {\n <mt-chip [label]=\"item.name\" size=\"small\" />\n }\n </div>\n } @else {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n" }]
|
|
1560
1588
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
1561
1589
|
|
|
1590
|
+
/**
|
|
1591
|
+
* Pure helpers shared by everything that reads a Local `EntityList`
|
|
1592
|
+
* (`storageMode: "Local"`) — the runtime field that edits it and the preview
|
|
1593
|
+
* that only renders it. See `.github/instructions/properties/EntityList.md`.
|
|
1594
|
+
*/
|
|
1595
|
+
/**
|
|
1596
|
+
* The schema's fields a row is rendered with, in order.
|
|
1597
|
+
*
|
|
1598
|
+
* A removed field stays in the stored schema as `hidden` so its values survive
|
|
1599
|
+
* and come back if it is re-added. The projected schema of a loaded value has
|
|
1600
|
+
* already dropped them, but the configuration's copy — what a create form falls
|
|
1601
|
+
* back to — has not.
|
|
1602
|
+
*/
|
|
1603
|
+
function visibleLocalSchemaFields(schema) {
|
|
1604
|
+
const fields = Array.isArray(schema?.fields) ? schema.fields : [];
|
|
1605
|
+
return fields
|
|
1606
|
+
.filter((field) => !!field && !field.hidden && !!field.id)
|
|
1607
|
+
.slice()
|
|
1608
|
+
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
1609
|
+
}
|
|
1610
|
+
function pickTranslatable(value, lang) {
|
|
1611
|
+
if (!value)
|
|
1612
|
+
return '';
|
|
1613
|
+
const own = lang === 'ar' ? value.ar : value.en;
|
|
1614
|
+
const other = lang === 'ar' ? value.en : value.ar;
|
|
1615
|
+
return (own ?? '').trim() || (other ?? '').trim();
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* The label a field renders under: its local override, then the source label
|
|
1619
|
+
* captured when it was published, then its key. The publisher writes an
|
|
1620
|
+
* override into the captured definition as well, so either path shows it.
|
|
1621
|
+
*/
|
|
1622
|
+
function resolveLocalFieldLabel(field, lang = 'en') {
|
|
1623
|
+
const definition = field.definition;
|
|
1624
|
+
return (pickTranslatable(field.label, lang) ||
|
|
1625
|
+
pickTranslatable({ en: definition?.nameEn, ar: definition?.nameAr }, lang) ||
|
|
1626
|
+
(definition?.name ?? '').trim() ||
|
|
1627
|
+
field.sourceKey);
|
|
1628
|
+
}
|
|
1629
|
+
/** The source view type the field captured; `Text` when none was. */
|
|
1630
|
+
function resolveLocalFieldViewType(field) {
|
|
1631
|
+
return field.definition?.viewType || 'Text';
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* The captured source configuration (lookup id, percentage colour rules …).
|
|
1635
|
+
* `PropertyDefinitionReadDto.configuration` is typed `object?`, so the backend
|
|
1636
|
+
* writes whatever the source held — an object, or its JSON text.
|
|
1637
|
+
*/
|
|
1638
|
+
function resolveLocalFieldConfiguration(field) {
|
|
1639
|
+
const configuration = field.definition?.configuration;
|
|
1640
|
+
if (!configuration)
|
|
1641
|
+
return null;
|
|
1642
|
+
if (typeof configuration !== 'string')
|
|
1643
|
+
return configuration;
|
|
1644
|
+
try {
|
|
1645
|
+
const parsed = JSON.parse(configuration);
|
|
1646
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
1647
|
+
? parsed
|
|
1648
|
+
: null;
|
|
1649
|
+
}
|
|
1650
|
+
catch {
|
|
1651
|
+
return null;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
/** A row's cells keyed by field id. */
|
|
1655
|
+
function localCellsByFieldId(row) {
|
|
1656
|
+
const map = new Map();
|
|
1657
|
+
for (const cell of Array.isArray(row?.cells) ? row.cells : []) {
|
|
1658
|
+
if (cell?.fieldId)
|
|
1659
|
+
map.set(cell.fieldId, cell);
|
|
1660
|
+
}
|
|
1661
|
+
return map;
|
|
1662
|
+
}
|
|
1663
|
+
/** Rows in their stored order. */
|
|
1664
|
+
function sortLocalRows(rows) {
|
|
1665
|
+
return (Array.isArray(rows) ? rows : [])
|
|
1666
|
+
.filter((row) => !!row?.rowId)
|
|
1667
|
+
.slice()
|
|
1668
|
+
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1562
1671
|
/**
|
|
1563
1672
|
* Nested fields render as small labelled pairs. The row is the unit of
|
|
1564
1673
|
* meaning, so labels sit above their values and stay muted.
|
|
@@ -1637,11 +1746,11 @@ function coerceValue(data) {
|
|
|
1637
1746
|
}
|
|
1638
1747
|
}
|
|
1639
1748
|
/**
|
|
1640
|
-
*
|
|
1641
|
-
*
|
|
1642
|
-
*
|
|
1749
|
+
* The inline field catalog. `propertyConfiguration` is the untouched catalog
|
|
1750
|
+
* entry; `configuration` is read as well because the table merges its own
|
|
1751
|
+
* display flags into that object when it builds a cell.
|
|
1643
1752
|
*/
|
|
1644
|
-
function
|
|
1753
|
+
function readInlineFields(data) {
|
|
1645
1754
|
const sources = [
|
|
1646
1755
|
data.propertyConfiguration ?? null,
|
|
1647
1756
|
(data.configuration ?? null),
|
|
@@ -1649,27 +1758,13 @@ function readConfigArray(data, key) {
|
|
|
1649
1758
|
for (const source of sources) {
|
|
1650
1759
|
if (!source || Array.isArray(source))
|
|
1651
1760
|
continue;
|
|
1652
|
-
const
|
|
1653
|
-
if (Array.isArray(
|
|
1654
|
-
return
|
|
1761
|
+
const fields = source['inlineFields'];
|
|
1762
|
+
if (Array.isArray(fields) && fields.length > 0) {
|
|
1763
|
+
return fields;
|
|
1764
|
+
}
|
|
1655
1765
|
}
|
|
1656
1766
|
return [];
|
|
1657
1767
|
}
|
|
1658
|
-
/** The inline field catalog — present only on an inline list. */
|
|
1659
|
-
function readInlineFields(data) {
|
|
1660
|
-
return readConfigArray(data, 'inlineFields');
|
|
1661
|
-
}
|
|
1662
|
-
/**
|
|
1663
|
-
* Readable target property keys of a module-backed list, in configured order.
|
|
1664
|
-
*
|
|
1665
|
-
* Unlike `inlineFields` these are bare keys: a module list's configuration
|
|
1666
|
-
* names *what* to read from the target module, never how to render it — the
|
|
1667
|
-
* labels and view types live in that module's own catalog, which this
|
|
1668
|
-
* read-only renderer never fetches.
|
|
1669
|
-
*/
|
|
1670
|
-
function readModuleFieldKeys(data) {
|
|
1671
|
-
return readConfigArray(data, 'readFields').filter((key) => typeof key === 'string' && key.length > 0);
|
|
1672
|
-
}
|
|
1673
1768
|
/**
|
|
1674
1769
|
* The field this one is a machine companion of, when that field is present in
|
|
1675
1770
|
* the same list. `status_color` returns `status`; a standalone `color` field
|
|
@@ -1686,10 +1781,10 @@ function companionTargetOf(field, present) {
|
|
|
1686
1781
|
return null;
|
|
1687
1782
|
}
|
|
1688
1783
|
/** Field definitions in render order, machine companions already removed. */
|
|
1689
|
-
function
|
|
1690
|
-
const
|
|
1691
|
-
const present = new Set(
|
|
1692
|
-
const visible =
|
|
1784
|
+
function visibleFields(data, allowed) {
|
|
1785
|
+
const declared = [...readInlineFields(data)].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
1786
|
+
const present = new Set(declared.map((field) => field.key));
|
|
1787
|
+
const visible = declared.filter((field) => !isIdentifierField(field) && !companionTargetOf(field, present));
|
|
1693
1788
|
if (allowed.length === 0)
|
|
1694
1789
|
return visible;
|
|
1695
1790
|
const byKey = new Map(visible.map((field) => [field.key, field]));
|
|
@@ -1697,115 +1792,7 @@ function refineFields(declared, allowed) {
|
|
|
1697
1792
|
.map((key) => byKey.get(key))
|
|
1698
1793
|
.filter((field) => !!field);
|
|
1699
1794
|
}
|
|
1700
|
-
/** `values` merged by property key, with `next` winning. */
|
|
1701
|
-
function mergeRowValues(base, next) {
|
|
1702
|
-
const byKey = new Map();
|
|
1703
|
-
for (const item of [...(base.values ?? []), ...(next.values ?? [])]) {
|
|
1704
|
-
if (item?.propertyKey)
|
|
1705
|
-
byKey.set(item.propertyKey, item);
|
|
1706
|
-
}
|
|
1707
|
-
return { ...base, ...next, values: [...byKey.values()] };
|
|
1708
|
-
}
|
|
1709
|
-
/**
|
|
1710
|
-
* Identity that recognises the same record in both halves of the value, or
|
|
1711
|
-
* null when the row carries nothing stable to match on.
|
|
1712
|
-
*/
|
|
1713
|
-
function rowKeyOf(row) {
|
|
1714
|
-
const entityId = Number(row.entityId);
|
|
1715
|
-
if (entityId > 0)
|
|
1716
|
-
return `entity:${entityId}`;
|
|
1717
|
-
return row.rowId ? `row:${row.rowId}` : null;
|
|
1718
|
-
}
|
|
1719
|
-
/**
|
|
1720
|
-
* The rows a reader should see, drawn from both halves of the value.
|
|
1721
|
-
*
|
|
1722
|
-
* An inline list carries everything in `rows`, so this is a pass-through for
|
|
1723
|
-
* it. A **module-backed** list keeps its linked records in `snapshot.entities`
|
|
1724
|
-
* and uses `rows` only for creates/updates the backend has not applied yet —
|
|
1725
|
-
* so reading `rows` alone showed an empty placeholder for every module list
|
|
1726
|
-
* that had been saved, and a count of the pending writes for one that had not.
|
|
1727
|
-
* Neither number was the number of related records.
|
|
1728
|
-
*
|
|
1729
|
-
* Snapshot first, so the linked records keep their order, with a pending row
|
|
1730
|
-
* for the same record merged over it — a pending update carries only the keys
|
|
1731
|
-
* the user changed, so replacing outright would blank the rest.
|
|
1732
|
-
*/
|
|
1733
|
-
function displayRowsOf(value) {
|
|
1734
|
-
const byKey = new Map();
|
|
1735
|
-
const loose = [];
|
|
1736
|
-
const absorb = (rows) => {
|
|
1737
|
-
for (const row of rows ?? []) {
|
|
1738
|
-
if (!row)
|
|
1739
|
-
continue;
|
|
1740
|
-
const key = rowKeyOf(row);
|
|
1741
|
-
if (!key) {
|
|
1742
|
-
loose.push(row);
|
|
1743
|
-
continue;
|
|
1744
|
-
}
|
|
1745
|
-
const base = byKey.get(key);
|
|
1746
|
-
byKey.set(key, base ? mergeRowValues(base, row) : row);
|
|
1747
|
-
}
|
|
1748
|
-
};
|
|
1749
|
-
absorb(value.snapshot?.entities);
|
|
1750
|
-
absorb(value.rows);
|
|
1751
|
-
return [...byKey.values(), ...loose];
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* Field definitions for a list whose configuration declares none — every
|
|
1755
|
-
* module-backed list, whose rows carry bare target property keys.
|
|
1756
|
-
*
|
|
1757
|
-
* Order and membership come from the configured `readFields` when there is
|
|
1758
|
-
* one: a key the configuration does not read is not shown, the same rule the
|
|
1759
|
-
* runtime table applies to its columns. With no `readFields`, every key
|
|
1760
|
-
* present renders in first-seen order.
|
|
1761
|
-
*/
|
|
1762
|
-
function derivedFields(data, rows) {
|
|
1763
|
-
const present = [];
|
|
1764
|
-
const seen = new Set();
|
|
1765
|
-
for (const row of rows) {
|
|
1766
|
-
for (const item of row.values ?? []) {
|
|
1767
|
-
if (!item?.propertyKey || seen.has(item.propertyKey))
|
|
1768
|
-
continue;
|
|
1769
|
-
seen.add(item.propertyKey);
|
|
1770
|
-
present.push(item.propertyKey);
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
const configured = readModuleFieldKeys(data);
|
|
1774
|
-
const keys = configured.length
|
|
1775
|
-
? configured.filter((key) => seen.has(key))
|
|
1776
|
-
: present;
|
|
1777
|
-
// `catalog.nestedProperties` carries the target module's own label and view
|
|
1778
|
-
// type per nested key. The backend populates it for LookupModuleCheckList
|
|
1779
|
-
// and not (yet) for EntityList, so this is usually empty and the key is
|
|
1780
|
-
// humanized instead — but when it arrives, the columns improve on their own.
|
|
1781
|
-
const meta = new Map((data.nestedProperties ?? []).map((property) => [property.key, property]));
|
|
1782
|
-
return keys.map((key, order) => {
|
|
1783
|
-
const nested = meta.get(key);
|
|
1784
|
-
return {
|
|
1785
|
-
key,
|
|
1786
|
-
order,
|
|
1787
|
-
label: nested?.label,
|
|
1788
|
-
viewType: nested?.viewType,
|
|
1789
|
-
configuration: nested?.configuration,
|
|
1790
|
-
};
|
|
1791
|
-
});
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* Row values by key. The resolved `value` is preferred over `rawValue` when
|
|
1795
|
-
* the backend sent one — a user object renders as a name, where the stored id
|
|
1796
|
-
* renders as a GUID.
|
|
1797
|
-
*/
|
|
1798
1795
|
function valuesByKey(row) {
|
|
1799
|
-
const map = new Map();
|
|
1800
|
-
for (const item of row.values ?? []) {
|
|
1801
|
-
if (!item?.propertyKey)
|
|
1802
|
-
continue;
|
|
1803
|
-
map.set(item.propertyKey, item.value ?? item.rawValue ?? null);
|
|
1804
|
-
}
|
|
1805
|
-
return map;
|
|
1806
|
-
}
|
|
1807
|
-
/** The same values, as the raw strings the status companions are read from. */
|
|
1808
|
-
function rawValuesByKey(row) {
|
|
1809
1796
|
const map = new Map();
|
|
1810
1797
|
for (const item of row.values ?? []) {
|
|
1811
1798
|
if (item?.propertyKey)
|
|
@@ -1818,16 +1805,13 @@ function rawValuesByKey(row) {
|
|
|
1818
1805
|
* companion becomes a `Status`, so the trio renders as one coloured badge
|
|
1819
1806
|
* instead of three separate cells.
|
|
1820
1807
|
*/
|
|
1821
|
-
function toNestedEntity(field, values
|
|
1822
|
-
const raw =
|
|
1823
|
-
const
|
|
1824
|
-
const
|
|
1825
|
-
const statusKey = rawValues.get(`${field.key}_key`);
|
|
1808
|
+
function toNestedEntity(field, values) {
|
|
1809
|
+
const raw = values.get(field.key) ?? null;
|
|
1810
|
+
const color = values.get(`${field.key}_color`);
|
|
1811
|
+
const statusKey = values.get(`${field.key}_key`);
|
|
1826
1812
|
const base = {
|
|
1827
1813
|
key: field.key,
|
|
1828
|
-
|
|
1829
|
-
// one; inline configuration never has one, hence the humanized fallback.
|
|
1830
|
-
name: field.label || humanizeEntityListKey(field.key),
|
|
1814
|
+
name: humanizeEntityListKey(field.key),
|
|
1831
1815
|
propertyConfiguration: field.configuration,
|
|
1832
1816
|
configuration: NESTED_FIELD_CONFIG,
|
|
1833
1817
|
order: field.order,
|
|
@@ -1848,43 +1832,36 @@ function toNestedEntity(field, values, rawValues) {
|
|
|
1848
1832
|
...base,
|
|
1849
1833
|
rawValue: raw ?? undefined,
|
|
1850
1834
|
viewType: normalizeViewType(field.viewType),
|
|
1851
|
-
|
|
1852
|
-
// to the stored string, which is all a snapshot carries today.
|
|
1853
|
-
value: (resolved ?? ''),
|
|
1835
|
+
value: raw ?? '',
|
|
1854
1836
|
};
|
|
1855
1837
|
}
|
|
1856
1838
|
/**
|
|
1857
1839
|
* Turns an `EntityList` entity into rendered rows.
|
|
1858
1840
|
*
|
|
1859
|
-
* Nothing is fetched
|
|
1860
|
-
*
|
|
1861
|
-
*
|
|
1862
|
-
* `
|
|
1863
|
-
*
|
|
1864
|
-
* ordered by `readFields`; that yields humanized labels and plain text rather
|
|
1865
|
-
* than the target module's own labels and view types, which only that module's
|
|
1866
|
-
* catalog knows and this renderer never loads.
|
|
1867
|
-
*
|
|
1868
|
-
* Shared by the trigger (`mt-entity-list-preview`, which needs the count and
|
|
1869
|
-
* the titles) and the drawer that renders them in full.
|
|
1841
|
+
* Nothing is fetched: the value already carries `rows[]`, and the property
|
|
1842
|
+
* configuration's `inlineFields` is the only description of the nested columns
|
|
1843
|
+
* — the rows themselves carry bare keys. Shared by the trigger
|
|
1844
|
+
* (`mt-entity-list-preview`, which needs the count and the titles) and the
|
|
1845
|
+
* drawer that renders them in full.
|
|
1870
1846
|
*
|
|
1871
1847
|
* `allowed` narrows to those keys, in that order; empty renders every field
|
|
1872
1848
|
* that survives the companion and identifier rules.
|
|
1873
1849
|
*/
|
|
1874
|
-
function buildEntityListRows(data, allowed = []) {
|
|
1850
|
+
function buildEntityListRows(data, allowed = [], lang = 'en') {
|
|
1875
1851
|
const value = coerceValue(data);
|
|
1876
|
-
if (
|
|
1877
|
-
return
|
|
1878
|
-
|
|
1879
|
-
|
|
1852
|
+
if (isEntityListLocalDocument(value)) {
|
|
1853
|
+
return buildLocalRows(value, data, allowed, lang);
|
|
1854
|
+
}
|
|
1855
|
+
const fields = visibleFields(data, allowed);
|
|
1856
|
+
const rows = value?.rows;
|
|
1857
|
+
if (!Array.isArray(rows))
|
|
1880
1858
|
return [];
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1859
|
+
return rows
|
|
1860
|
+
.filter((row) => !!row)
|
|
1861
|
+
.map((row, index) => {
|
|
1884
1862
|
const values = valuesByKey(row);
|
|
1885
|
-
const rawValues = rawValuesByKey(row);
|
|
1886
1863
|
const rendered = fields
|
|
1887
|
-
.map((field) => toNestedEntity(field, values
|
|
1864
|
+
.map((field) => toNestedEntity(field, values))
|
|
1888
1865
|
.filter((entity) => !!entity);
|
|
1889
1866
|
// The title is the first field that actually rendered, not the first
|
|
1890
1867
|
// that was declared: a leading field can drop out (an empty status
|
|
@@ -1898,6 +1875,64 @@ function buildEntityListRows(data, allowed = []) {
|
|
|
1898
1875
|
};
|
|
1899
1876
|
});
|
|
1900
1877
|
}
|
|
1878
|
+
/**
|
|
1879
|
+
* Rows of a Local list (`storageMode: "Local"`).
|
|
1880
|
+
*
|
|
1881
|
+
* The projected document `process-form-load` returns carries its own
|
|
1882
|
+
* `schema`, and it wins: pending and approved evidence is pinned to the schema
|
|
1883
|
+
* it was submitted against, which the property configuration's *active* one
|
|
1884
|
+
* may no longer be. The fetch endpoints return the stored document instead —
|
|
1885
|
+
* `schema: null` — so the configuration's `localSchema` is the fallback.
|
|
1886
|
+
* Cells are keyed by the field's local id and carry the backend-rendered
|
|
1887
|
+
* `value` beside `rawValue` where one was rendered; otherwise the raw value
|
|
1888
|
+
* shows.
|
|
1889
|
+
*
|
|
1890
|
+
* `allowed` narrows by source key, the one identity the host can know.
|
|
1891
|
+
*/
|
|
1892
|
+
function buildLocalRows(document, data, allowed, lang) {
|
|
1893
|
+
const declared = visibleLocalSchemaFields(document.schema ?? readConfiguredLocalSchema(data));
|
|
1894
|
+
const bySourceKey = new Map(declared.map((field) => [field.sourceKey, field]));
|
|
1895
|
+
const fields = allowed.length === 0
|
|
1896
|
+
? declared
|
|
1897
|
+
: allowed
|
|
1898
|
+
.map((key) => bySourceKey.get(key))
|
|
1899
|
+
.filter((field) => !!field);
|
|
1900
|
+
return sortLocalRows(document.localRows).map((row) => {
|
|
1901
|
+
const cells = localCellsByFieldId(row);
|
|
1902
|
+
const rendered = fields.map((field) => {
|
|
1903
|
+
const cell = cells.get(field.id);
|
|
1904
|
+
const rawValue = cell?.rawValue ?? undefined;
|
|
1905
|
+
return {
|
|
1906
|
+
key: field.sourceKey,
|
|
1907
|
+
name: resolveLocalFieldLabel(field, lang),
|
|
1908
|
+
viewType: normalizeViewType(resolveLocalFieldViewType(field)),
|
|
1909
|
+
value: (cell?.value ?? rawValue ?? ''),
|
|
1910
|
+
rawValue,
|
|
1911
|
+
propertyConfiguration: resolveLocalFieldConfiguration(field) ?? undefined,
|
|
1912
|
+
configuration: NESTED_FIELD_CONFIG,
|
|
1913
|
+
order: field.order,
|
|
1914
|
+
};
|
|
1915
|
+
});
|
|
1916
|
+
const [first, ...rest] = rendered;
|
|
1917
|
+
return {
|
|
1918
|
+
id: row.rowId,
|
|
1919
|
+
title: first ? { ...first, configuration: TITLE_FIELD_CONFIG } : null,
|
|
1920
|
+
fields: rest,
|
|
1921
|
+
};
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
/** The active Local schema from the property configuration, if any. */
|
|
1925
|
+
function readConfiguredLocalSchema(data) {
|
|
1926
|
+
for (const source of [data.propertyConfiguration, data.configuration]) {
|
|
1927
|
+
if (!source || Array.isArray(source))
|
|
1928
|
+
continue;
|
|
1929
|
+
const schema = source['localSchema'];
|
|
1930
|
+
if (schema && typeof schema === 'object') {
|
|
1931
|
+
return schema;
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
return null;
|
|
1935
|
+
}
|
|
1901
1936
|
/**
|
|
1902
1937
|
* The row's title as plain text. A title that folded into a `Status` carries
|
|
1903
1938
|
* an object, not a string — reading only the string case would silently drop
|
|
@@ -1925,22 +1960,6 @@ function summarizeEntityListRows(rows, limit) {
|
|
|
1925
1960
|
};
|
|
1926
1961
|
}
|
|
1927
1962
|
|
|
1928
|
-
/**
|
|
1929
|
-
* The component that renders an `EntityList` as its full read-only table —
|
|
1930
|
-
* `mt-entity-list-field` in practice, registered by `provideEntityListTable()`
|
|
1931
|
-
* from `@masterteam/components/business-fields`.
|
|
1932
|
-
*
|
|
1933
|
-
* It is a token rather than a direct import because `business-fields` already
|
|
1934
|
-
* imports this package: rendering the field from here would close the cycle.
|
|
1935
|
-
* The same reason `ENTITY_LIST_ADD_DIALOG_COMPONENT` exists one layer up.
|
|
1936
|
-
*
|
|
1937
|
-
* Unregistered, every `EntityList` keeps the compact count-and-drawer
|
|
1938
|
-
* renderer, which is also what a call site gets when it passes no
|
|
1939
|
-
* {@link EntityListPreviewContext} — a table cell must never expand into a
|
|
1940
|
-
* table, since one row would then own the height of the whole grid.
|
|
1941
|
-
*/
|
|
1942
|
-
const ENTITY_LIST_TABLE_COMPONENT = new InjectionToken('ENTITY_LIST_TABLE_COMPONENT');
|
|
1943
|
-
|
|
1944
1963
|
/**
|
|
1945
1964
|
* One shared active-language signal per `TranslocoService`.
|
|
1946
1965
|
*
|
|
@@ -2140,34 +2159,45 @@ class EntityListDrawer {
|
|
|
2140
2159
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
2141
2160
|
/** Ordered allowlist of nested field keys; empty renders all of them. */
|
|
2142
2161
|
fields = input([], ...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
2143
|
-
|
|
2162
|
+
/** A Local list's labels are `{ en, ar }` pairs; see `sharedActiveLang`. */
|
|
2163
|
+
activeLang = sharedActiveLang(inject(TranslocoService));
|
|
2164
|
+
rows = computed(() => buildEntityListRows(this.data(), this.fields(), this.activeLang()), ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
2144
2165
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListDrawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2145
|
-
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: "<!--\
|
|
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 <div class=\"rounded-md border border-surface-200 bg-surface-50 px-3 py-2.5\">\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</div>\n", dependencies: [{ kind: "component", type: EntityValuePreview, selector: "mt-entity-value-preview", inputs: ["data", "attachmentShape"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2146
2167
|
}
|
|
2147
2168
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListDrawer, decorators: [{
|
|
2148
2169
|
type: Component,
|
|
2149
|
-
args: [{ selector: 'mt-entity-list-drawer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityValuePreview], host: { class: 'block h-full' }, template: "<!--\
|
|
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 <div class=\"rounded-md border border-surface-200 bg-surface-50 px-3 py-2.5\">\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</div>\n" }]
|
|
2150
2171
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }] } });
|
|
2151
2172
|
|
|
2152
2173
|
/** Rows named in the tooltip before it collapses into "+N more". */
|
|
2153
2174
|
const TOOLTIP_ROW_LIMIT = 6;
|
|
2154
2175
|
/**
|
|
2155
|
-
* Read-only renderer for an `EntityList` value
|
|
2156
|
-
*
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2176
|
+
* Read-only renderer for an `EntityList` value. It has two shapes, and which
|
|
2177
|
+
* one applies is decided by what the host gave it — never by the value.
|
|
2178
|
+
*
|
|
2179
|
+
* **Inline table.** When the host published an `EntityRuntimeContext` and the
|
|
2180
|
+
* property is module-backed, the rows are the target module's own records and
|
|
2181
|
+
* live behind `Properties/{id}/entitylist/table-metadata` + `fetch/query`.
|
|
2182
|
+
* Nothing in the value describes them — a `Realtime` list's value is literally
|
|
2183
|
+
* `null` — so the whole table is fetched, by handing the work to the read-only
|
|
2184
|
+
* `mt-entity-list-field` through `ENTITY_LIST_TABLE_COMPONENT`. That component
|
|
2185
|
+
* already owns the metadata call, the authorization boundary (`403` is a
|
|
2186
|
+
* notice, not an error) and the column projection; duplicating it here would
|
|
2187
|
+
* be a second implementation of the same contract. This is the shape a card
|
|
2188
|
+
* preview gets.
|
|
2159
2189
|
*
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2164
|
-
*
|
|
2165
|
-
*
|
|
2190
|
+
* **Count + drawer.** Otherwise the value carries its own `rows[]` and the
|
|
2191
|
+
* property configuration's `inlineFields` is the only description of the
|
|
2192
|
+
* columns — a calculated inline list, phase gate checklists being the case
|
|
2193
|
+
* this was written for. Those render inside a *table cell* (`mt-table` builds
|
|
2194
|
+
* its entity cells through `mt-entity-preview`), where inline rows would own
|
|
2195
|
+
* the height of every row in the grid: three lines per checklist item, times
|
|
2196
|
+
* however many the phase gate has. The rows go in a drawer instead, and the
|
|
2197
|
+
* tooltip names them so "which ones are these?" is answered without opening
|
|
2198
|
+
* anything. A table cell publishes no runtime context, so it keeps this shape.
|
|
2166
2199
|
*
|
|
2167
|
-
*
|
|
2168
|
-
* configuration's `inlineFields` carries the only description of the columns.
|
|
2169
|
-
* There is no writable path here by design — calculated inline lists are
|
|
2170
|
-
* `access: Read` at the source.
|
|
2200
|
+
* There is no writable path in either case.
|
|
2171
2201
|
*/
|
|
2172
2202
|
class EntityListPreview {
|
|
2173
2203
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
@@ -2175,10 +2205,26 @@ class EntityListPreview {
|
|
|
2175
2205
|
* Restricts rendering to these nested field keys, in this order. Left empty,
|
|
2176
2206
|
* every field in `inlineFields` renders — what the generic table path wants;
|
|
2177
2207
|
* a host that knows the list narrows it here. Forwarded to the drawer.
|
|
2208
|
+
*
|
|
2209
|
+
* Applies to the drawer shape only: an inline table's columns come from the
|
|
2210
|
+
* backend's own projection, which already reflects the configured read
|
|
2211
|
+
* fields for this level.
|
|
2178
2212
|
*/
|
|
2179
2213
|
fields = input([], ...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
2180
2214
|
modal = inject(ModalService);
|
|
2181
2215
|
transloco = inject(TranslocoService);
|
|
2216
|
+
/**
|
|
2217
|
+
* Both optional, and both have to be present for the inline table: the
|
|
2218
|
+
* component says the host *can* render one, the context says it knows which
|
|
2219
|
+
* level-data row to scope the rows to. A host that provides neither — every
|
|
2220
|
+
* `mt-table` cell — keeps the drawer.
|
|
2221
|
+
*/
|
|
2222
|
+
tableComponent = inject(ENTITY_LIST_TABLE_COMPONENT, {
|
|
2223
|
+
optional: true,
|
|
2224
|
+
});
|
|
2225
|
+
runtimeContextStore = inject(EntityRuntimeContextStore, {
|
|
2226
|
+
optional: true,
|
|
2227
|
+
});
|
|
2182
2228
|
/**
|
|
2183
2229
|
* Read inside every computed that translates. `transloco.translate()` is a
|
|
2184
2230
|
* one-shot read with no signal of its own, so without this dependency the
|
|
@@ -2188,9 +2234,67 @@ class EntityListPreview {
|
|
|
2188
2234
|
*/
|
|
2189
2235
|
activeLang = sharedActiveLang(this.transloco);
|
|
2190
2236
|
label = computed(() => this.data().name ?? '', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2191
|
-
rows = computed(() => buildEntityListRows(this.data(), this.fields()), ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
2237
|
+
rows = computed(() => buildEntityListRows(this.data(), this.fields(), this.activeLang()), ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
2192
2238
|
count = computed(() => this.rows().length, ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
|
|
2193
2239
|
hasRows = computed(() => this.count() > 0, ...(ngDevMode ? [{ debugName: "hasRows" }] : /* istanbul ignore next */ []));
|
|
2240
|
+
/**
|
|
2241
|
+
* Whether the list's rows are records of another module rather than values
|
|
2242
|
+
* held inside this one.
|
|
2243
|
+
*
|
|
2244
|
+
* Mirrors the backend's own `ResolveSourceType`: an explicit `sourceType`
|
|
2245
|
+
* wins, and a configuration written before that field existed is module-
|
|
2246
|
+
* backed exactly when it names a module. Read from the stored configuration
|
|
2247
|
+
* because it is the only description available before the metadata request —
|
|
2248
|
+
* the effective, level-overridden one comes back from that endpoint, and the
|
|
2249
|
+
* table component gates on it again.
|
|
2250
|
+
*/
|
|
2251
|
+
moduleBacked = computed(() => {
|
|
2252
|
+
const configuration = this.propertyConfiguration();
|
|
2253
|
+
if (!configuration)
|
|
2254
|
+
return false;
|
|
2255
|
+
const sourceType = configuration['sourceType'];
|
|
2256
|
+
if (typeof sourceType === 'string' && sourceType.trim()) {
|
|
2257
|
+
return sourceType.trim().toLowerCase() === 'module';
|
|
2258
|
+
}
|
|
2259
|
+
return Number(configuration['moduleId'] ?? 0) > 0;
|
|
2260
|
+
}, ...(ngDevMode ? [{ debugName: "moduleBacked" }] : /* istanbul ignore next */ []));
|
|
2261
|
+
/**
|
|
2262
|
+
* The inline table's component and inputs, or null when this instance
|
|
2263
|
+
* renders the drawer trigger instead.
|
|
2264
|
+
*
|
|
2265
|
+
* A `computed` rather than a template expression on purpose: the object is
|
|
2266
|
+
* re-created only when its inputs actually change, and `NgComponentOutlet`
|
|
2267
|
+
* re-applies inputs on identity change — a fresh object per change-detection
|
|
2268
|
+
* pass would re-write every input on every tick.
|
|
2269
|
+
*/
|
|
2270
|
+
tableHost = computed(() => {
|
|
2271
|
+
const component = this.tableComponent;
|
|
2272
|
+
if (!component || !this.moduleBacked())
|
|
2273
|
+
return null;
|
|
2274
|
+
const context = this.runtimeContextStore?.context() ?? null;
|
|
2275
|
+
if (!context || !(Number(context.levelId) > 0))
|
|
2276
|
+
return null;
|
|
2277
|
+
const data = this.data();
|
|
2278
|
+
const propertyId = Number(data.propertyId ?? 0);
|
|
2279
|
+
if (!(propertyId > 0))
|
|
2280
|
+
return null;
|
|
2281
|
+
return {
|
|
2282
|
+
component,
|
|
2283
|
+
inputs: {
|
|
2284
|
+
propertyId,
|
|
2285
|
+
runtimeContext: context,
|
|
2286
|
+
configuration: this.propertyConfiguration(),
|
|
2287
|
+
// Rendered outside a form, so there is no `ControlValueAccessor` to
|
|
2288
|
+
// write through. A Write-only list has no readable records and its
|
|
2289
|
+
// stored rows are the only thing it can show.
|
|
2290
|
+
initialValue: data.value ?? data.rawValue ?? null,
|
|
2291
|
+
readonly: true,
|
|
2292
|
+
// `mt-entity-field` already renders the property's label above the
|
|
2293
|
+
// table; the field would repeat it.
|
|
2294
|
+
label: '',
|
|
2295
|
+
},
|
|
2296
|
+
};
|
|
2297
|
+
}, ...(ngDevMode ? [{ debugName: "tableHost" }] : /* istanbul ignore next */ []));
|
|
2194
2298
|
/**
|
|
2195
2299
|
* An empty list reads as the standard empty value, not as a sentence — this
|
|
2196
2300
|
* sits in a table cell, where a "no related items" line would be louder than
|
|
@@ -2224,6 +2328,25 @@ class EntityListPreview {
|
|
|
2224
2328
|
: [];
|
|
2225
2329
|
return [...names, ...more].join(' · ');
|
|
2226
2330
|
}, ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
2331
|
+
/**
|
|
2332
|
+
* The untouched catalog configuration. `configuration` is read as a fallback
|
|
2333
|
+
* because the table merges its own display flags into that object when it
|
|
2334
|
+
* builds a cell, and a `LeafDetails` catalog entry is an array — neither is
|
|
2335
|
+
* an `EntityList` configuration, so both are rejected here.
|
|
2336
|
+
*/
|
|
2337
|
+
propertyConfiguration = computed(() => {
|
|
2338
|
+
const data = this.data();
|
|
2339
|
+
const sources = [
|
|
2340
|
+
data.propertyConfiguration,
|
|
2341
|
+
data.configuration,
|
|
2342
|
+
];
|
|
2343
|
+
for (const source of sources) {
|
|
2344
|
+
if (!source || Array.isArray(source))
|
|
2345
|
+
continue;
|
|
2346
|
+
return source;
|
|
2347
|
+
}
|
|
2348
|
+
return null;
|
|
2349
|
+
}, ...(ngDevMode ? [{ debugName: "propertyConfiguration" }] : /* istanbul ignore next */ []));
|
|
2227
2350
|
viewLabel() {
|
|
2228
2351
|
return this.transloco.translate('components.entityListPreview.view');
|
|
2229
2352
|
}
|
|
@@ -2240,11 +2363,11 @@ class EntityListPreview {
|
|
|
2240
2363
|
});
|
|
2241
2364
|
}
|
|
2242
2365
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2243
|
-
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\
|
|
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 (hasRows()) {\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.\n -->\n <mt-button\n icon=\"general.eye\"\n [label]=\"count().toString()\"\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 });
|
|
2244
2367
|
}
|
|
2245
2368
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListPreview, decorators: [{
|
|
2246
2369
|
type: Component,
|
|
2247
|
-
args: [{ selector: 'mt-entity-list-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityField, Button], template: "<mt-entity-field\
|
|
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 (hasRows()) {\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.\n -->\n <mt-button\n icon=\"general.eye\"\n [label]=\"count().toString()\"\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" }]
|
|
2248
2371
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }] } });
|
|
2249
2372
|
|
|
2250
2373
|
/**
|
|
@@ -2814,64 +2937,15 @@ function buildDisplayEntities(entities) {
|
|
|
2814
2937
|
class EntityPreviewBody {
|
|
2815
2938
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
2816
2939
|
attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
|
|
2817
|
-
/**
|
|
2818
|
-
* Runtime ids that opt an `EntityList` into its full read-only table instead
|
|
2819
|
-
* of the compact count-and-drawer. Null — the default, and what every table
|
|
2820
|
-
* cell passes — keeps the compact renderer.
|
|
2821
|
-
*/
|
|
2822
|
-
entityListContext = input(null, ...(ngDevMode ? [{ debugName: "entityListContext" }] : /* istanbul ignore next */ []));
|
|
2823
|
-
tableComponent = inject(ENTITY_LIST_TABLE_COMPONENT, {
|
|
2824
|
-
optional: true,
|
|
2825
|
-
});
|
|
2826
|
-
/**
|
|
2827
|
-
* The expanded table, when this call site asked for one, a host registered a
|
|
2828
|
-
* component to render it, and the ids that component needs are present. The
|
|
2829
|
-
* property id addresses the metadata endpoint and the level scopes it, so
|
|
2830
|
-
* without either there is nothing to render and the compact view stands in.
|
|
2831
|
-
*/
|
|
2832
|
-
entityListTable = computed(() => {
|
|
2833
|
-
if (!this.tableComponent)
|
|
2834
|
-
return null;
|
|
2835
|
-
const context = this.entityListContext();
|
|
2836
|
-
if (!context || !(Number(context.levelId ?? 0) > 0))
|
|
2837
|
-
return null;
|
|
2838
|
-
return Number(this.data().propertyId ?? 0) > 0 ? this.tableComponent : null;
|
|
2839
|
-
}, ...(ngDevMode ? [{ debugName: "entityListTable" }] : /* istanbul ignore next */ []));
|
|
2840
|
-
/**
|
|
2841
|
-
* Inputs for the registered table. `label` is deliberately blank: the
|
|
2842
|
-
* surrounding `mt-entity-field` already prints the property name, and the
|
|
2843
|
-
* field would otherwise print a second one in its own style.
|
|
2844
|
-
*/
|
|
2845
|
-
entityListTableInputs = computed(() => {
|
|
2846
|
-
const context = this.entityListContext() ?? {};
|
|
2847
|
-
return {
|
|
2848
|
-
propertyId: Number(this.data().propertyId ?? 0),
|
|
2849
|
-
runtimeContext: {
|
|
2850
|
-
levelId: context.levelId ?? null,
|
|
2851
|
-
levelDataId: context.levelDataId ?? null,
|
|
2852
|
-
},
|
|
2853
|
-
readonly: true,
|
|
2854
|
-
label: '',
|
|
2855
|
-
// There is no form control here, so the stored value has to be handed
|
|
2856
|
-
// over directly — it is all a write-only list has to render.
|
|
2857
|
-
value: this.data().value ?? null,
|
|
2858
|
-
};
|
|
2859
|
-
}, ...(ngDevMode ? [{ debugName: "entityListTableInputs" }] : /* istanbul ignore next */ []));
|
|
2860
2940
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreviewBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2861
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreviewBody, isStandalone: true, selector: "mt-entity-preview-body", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null }
|
|
2941
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreviewBody, isStandalone: true, selector: "mt-entity-preview-body", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "w-full" }, ngImport: i0, template: "@if (data().viewType === \"LookupModuleCheckList\") {\r\n <mt-entity-lookup-module-check-list [data]=\"data()\" />\r\n} @else if (data().viewType === \"EntityList\") {\r\n <mt-entity-list-preview [data]=\"data()\" />\r\n} @else {\r\n <mt-entity-value-preview\r\n [data]=\"data()\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n}\r\n", dependencies: [{ kind: "component", type: EntityListPreview, selector: "mt-entity-list-preview", inputs: ["data", "fields"] }, { kind: "component", type: EntityLookupModuleCheckList, selector: "mt-entity-lookup-module-check-list", inputs: ["data"] }, { kind: "component", type: EntityValuePreview, selector: "mt-entity-value-preview", inputs: ["data", "attachmentShape"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2862
2942
|
}
|
|
2863
2943
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreviewBody, decorators: [{
|
|
2864
2944
|
type: Component,
|
|
2865
|
-
args: [{ selector: 'mt-entity-preview-body', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2866
|
-
EntityField,
|
|
2867
|
-
EntityListPreview,
|
|
2868
|
-
EntityLookupModuleCheckList,
|
|
2869
|
-
EntityValuePreview,
|
|
2870
|
-
NgComponentOutlet,
|
|
2871
|
-
], host: {
|
|
2945
|
+
args: [{ selector: 'mt-entity-preview-body', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityListPreview, EntityLookupModuleCheckList, EntityValuePreview], host: {
|
|
2872
2946
|
class: 'w-full',
|
|
2873
|
-
}, template: "@if (data().viewType === \"LookupModuleCheckList\") {\n <mt-entity-lookup-module-check-list [data]=\"data()\" />\n} @else if (data().viewType === \"EntityList\") {\
|
|
2874
|
-
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }]
|
|
2947
|
+
}, template: "@if (data().viewType === \"LookupModuleCheckList\") {\r\n <mt-entity-lookup-module-check-list [data]=\"data()\" />\r\n} @else if (data().viewType === \"EntityList\") {\r\n <mt-entity-list-preview [data]=\"data()\" />\r\n} @else {\r\n <mt-entity-value-preview\r\n [data]=\"data()\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n}\r\n" }]
|
|
2948
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
|
|
2875
2949
|
|
|
2876
2950
|
class ComparisonValue {
|
|
2877
2951
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
@@ -2895,7 +2969,7 @@ class ComparisonValue {
|
|
|
2895
2969
|
};
|
|
2896
2970
|
}
|
|
2897
2971
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ComparisonValue, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2898
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: ComparisonValue, isStandalone: true, selector: "mt-comparison-value", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "block w-full" }, ngImport: i0, template: "@if (comparison(); as cmp) {\r\n <div class=\"flex w-full min-w-0 items-stretch gap-3\">\r\n <div\r\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\r\n >\r\n <span class=\"text-xs font-medium uppercase tracking-wide text-muted-color\"\r\n >Before</span\r\n >\r\n @if (oldEntity(); as old) {\r\n <mt-entity-preview-body [data]=\"old\" />\r\n } @else {\r\n <span class=\"text-sm text-muted-color\">_</span>\r\n }\r\n </div>\r\n <div class=\"flex shrink-0 items-center text-muted-color\" aria-hidden=\"true\">\r\n →\r\n </div>\r\n <div\r\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-primary-200 bg-primary-50 px-3 py-2\"\r\n >\r\n <span class=\"text-xs font-medium uppercase tracking-wide text-primary-600\"\r\n >After</span\r\n >\r\n @if (newEntity(); as next) {\r\n <mt-entity-preview-body [data]=\"next\" />\r\n } @else {\r\n <span class=\"text-sm text-muted-color\">_</span>\r\n }\r\n </div>\r\n </div>\r\n}\r\n", dependencies: [{ kind: "component", type: EntityPreviewBody, selector: "mt-entity-preview-body", inputs: ["data", "attachmentShape"
|
|
2972
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: ComparisonValue, isStandalone: true, selector: "mt-comparison-value", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "block w-full" }, ngImport: i0, template: "@if (comparison(); as cmp) {\r\n <div class=\"flex w-full min-w-0 items-stretch gap-3\">\r\n <div\r\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\r\n >\r\n <span class=\"text-xs font-medium uppercase tracking-wide text-muted-color\"\r\n >Before</span\r\n >\r\n @if (oldEntity(); as old) {\r\n <mt-entity-preview-body [data]=\"old\" />\r\n } @else {\r\n <span class=\"text-sm text-muted-color\">_</span>\r\n }\r\n </div>\r\n <div class=\"flex shrink-0 items-center text-muted-color\" aria-hidden=\"true\">\r\n →\r\n </div>\r\n <div\r\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-primary-200 bg-primary-50 px-3 py-2\"\r\n >\r\n <span class=\"text-xs font-medium uppercase tracking-wide text-primary-600\"\r\n >After</span\r\n >\r\n @if (newEntity(); as next) {\r\n <mt-entity-preview-body [data]=\"next\" />\r\n } @else {\r\n <span class=\"text-sm text-muted-color\">_</span>\r\n }\r\n </div>\r\n </div>\r\n}\r\n", dependencies: [{ kind: "component", type: EntityPreviewBody, selector: "mt-entity-preview-body", inputs: ["data", "attachmentShape"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2899
2973
|
}
|
|
2900
2974
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ComparisonValue, decorators: [{
|
|
2901
2975
|
type: Component,
|
|
@@ -2960,8 +3034,6 @@ class EntityPreview {
|
|
|
2960
3034
|
transloco = inject(TranslocoService);
|
|
2961
3035
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
2962
3036
|
attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
|
|
2963
|
-
/** Forwarded to the body; see `EntityPreviewBody.entityListContext`. */
|
|
2964
|
-
entityListContext = input(null, ...(ngDevMode ? [{ debugName: "entityListContext" }] : /* istanbul ignore next */ []));
|
|
2965
3037
|
activeLang = sharedActiveLang(this.transloco);
|
|
2966
3038
|
/**
|
|
2967
3039
|
* The admin-authored note for the active language, or `''` when the property
|
|
@@ -2982,7 +3054,7 @@ class EntityPreview {
|
|
|
2982
3054
|
return null;
|
|
2983
3055
|
}, ...(ngDevMode ? [{ debugName: "comparisonKind" }] : /* istanbul ignore next */ []));
|
|
2984
3056
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2985
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreview, isStandalone: true, selector: "mt-entity-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null }
|
|
3057
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreview, isStandalone: true, selector: "mt-entity-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.relative": "infoText()", "class.pe-4": "infoText()" }, classAttribute: "w-full" }, ngImport: i0, template: "@if (infoText(); as info) {\r\n <!--\r\n The note affordance. Absolutely positioned so it stays out of the value's\r\n own layout \u2014 each viewType renders its own markup and there is no shared\r\n slot to put this in \u2014 while the host reserves the corner with `pe-4`, so a\r\n long value truncates before it can run underneath the icon.\r\n -->\r\n <!--\r\n Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\r\n is `width: 1em` \u2014 so font-size is what actually scales the glyph.\r\n -->\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\r\n [mtTooltip]=\"info\"\r\n tooltipPosition=\"top\"\r\n tooltipStyleClass=\"mt-entity-info-tooltip\"\r\n [attr.aria-label]=\"info\"\r\n />\r\n}\r\n\r\n@switch (comparisonKind()) {\r\n @case (\"Value\") {\r\n <mt-comparison-value [data]=\"data()\" />\r\n }\r\n @case (\"EntityList\") {\r\n <mt-comparison-entity-list [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-preview-body\r\n [data]=\"data()\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n }\r\n}\r\n", styles: [".mt-entity-info-tooltip{max-width:22rem}.mt-entity-info-tooltip .p-tooltip-text{white-space:pre-wrap;text-align:start;overflow-wrap:anywhere}\n"], dependencies: [{ kind: "component", type: EntityPreviewBody, selector: "mt-entity-preview-body", inputs: ["data", "attachmentShape"] }, { kind: "component", type: ComparisonValue, selector: "mt-comparison-value", inputs: ["data"] }, { kind: "component", type: ComparisonEntityList, selector: "mt-comparison-entity-list", inputs: ["data"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2986
3058
|
}
|
|
2987
3059
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, decorators: [{
|
|
2988
3060
|
type: Component,
|
|
@@ -2998,8 +3070,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
2998
3070
|
// exactly the box it had before this feature existed.
|
|
2999
3071
|
'[class.relative]': 'infoText()',
|
|
3000
3072
|
'[class.pe-4]': 'infoText()',
|
|
3001
|
-
}, template: "@if (infoText(); as info) {\r\n <!--\r\n The note affordance. Absolutely positioned so it stays out of the value's\r\n own layout \u2014 each viewType renders its own markup and there is no shared\r\n slot to put this in \u2014 while the host reserves the corner with `pe-4`, so a\r\n long value truncates before it can run underneath the icon.\r\n -->\r\n <!--\r\n Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\r\n is `width: 1em` \u2014 so font-size is what actually scales the glyph.\r\n -->\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\r\n [mtTooltip]=\"info\"\r\n tooltipPosition=\"top\"\r\n tooltipStyleClass=\"mt-entity-info-tooltip\"\r\n [attr.aria-label]=\"info\"\r\n />\r\n}\r\n\r\n@switch (comparisonKind()) {\r\n @case (\"Value\") {\r\n <mt-comparison-value [data]=\"data()\" />\r\n }\r\n @case (\"EntityList\") {\r\n <mt-comparison-entity-list [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-preview-body\r\n [data]=\"data()\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n
|
|
3002
|
-
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }]
|
|
3073
|
+
}, template: "@if (infoText(); as info) {\r\n <!--\r\n The note affordance. Absolutely positioned so it stays out of the value's\r\n own layout \u2014 each viewType renders its own markup and there is no shared\r\n slot to put this in \u2014 while the host reserves the corner with `pe-4`, so a\r\n long value truncates before it can run underneath the icon.\r\n -->\r\n <!--\r\n Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\r\n is `width: 1em` \u2014 so font-size is what actually scales the glyph.\r\n -->\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\r\n [mtTooltip]=\"info\"\r\n tooltipPosition=\"top\"\r\n tooltipStyleClass=\"mt-entity-info-tooltip\"\r\n [attr.aria-label]=\"info\"\r\n />\r\n}\r\n\r\n@switch (comparisonKind()) {\r\n @case (\"Value\") {\r\n <mt-comparison-value [data]=\"data()\" />\r\n }\r\n @case (\"EntityList\") {\r\n <mt-comparison-entity-list [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-preview-body\r\n [data]=\"data()\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n }\r\n}\r\n", styles: [".mt-entity-info-tooltip{max-width:22rem}.mt-entity-info-tooltip .p-tooltip-text{white-space:pre-wrap;text-align:start;overflow-wrap:anywhere}\n"] }]
|
|
3074
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
|
|
3003
3075
|
|
|
3004
3076
|
const EMPTY_KEY_SET = new Set();
|
|
3005
3077
|
/** Classes every entity slot carries, before its per-slot modifiers. */
|
|
@@ -3011,8 +3083,6 @@ class EntitiesPreview {
|
|
|
3011
3083
|
/** Array of entity data to display */
|
|
3012
3084
|
entities = input.required(...(ngDevMode ? [{ debugName: "entities" }] : /* istanbul ignore next */ []));
|
|
3013
3085
|
attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
|
|
3014
|
-
/** Forwarded to every entity; see `EntityPreviewBody.entityListContext`. */
|
|
3015
|
-
entityListContext = input(null, ...(ngDevMode ? [{ debugName: "entityListContext" }] : /* istanbul ignore next */ []));
|
|
3016
3086
|
/**
|
|
3017
3087
|
* Soft "stack every field full-width when the host is narrower than the
|
|
3018
3088
|
* 24-column grid reads well" behavior (the ≤400px container-query fallback,
|
|
@@ -3106,15 +3176,15 @@ class EntitiesPreview {
|
|
|
3106
3176
|
});
|
|
3107
3177
|
}
|
|
3108
3178
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3109
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesPreview, isStandalone: true, selector: "mt-entities-preview", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null },
|
|
3179
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesPreview, isStandalone: true, selector: "mt-entities-preview", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null }, stackOnNarrow: { classPropertyName: "stackOnNarrow", publicName: "stackOnNarrow", isSignal: true, isRequired: false, transformFunction: null }, clickableKeys: { classPropertyName: "clickableKeys", publicName: "clickableKeys", isSignal: true, isRequired: false, transformFunction: null }, activeKeys: { classPropertyName: "activeKeys", publicName: "activeKeys", isSignal: true, isRequired: false, transformFunction: null }, clickableTooltip: { classPropertyName: "clickableTooltip", publicName: "clickableTooltip", isSignal: true, isRequired: false, transformFunction: null }, activeTooltip: { classPropertyName: "activeTooltip", publicName: "activeTooltip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { entityClick: "entityClick" }, host: { properties: { "class.mt-entities-stack-narrow": "stackOnNarrow()" }, classAttribute: "block min-w-0 w-full" }, ngImport: i0, template: "<div class=\"flex flex-col gap-4\">\r\n @for (group of slotGroups(); track group.trackKey) {\r\n @if (group.boxed) {\r\n <!-- Titled section box (matches the client-form section view) -->\r\n <div\r\n class=\"flex flex-col gap-0 overflow-hidden rounded-md border border-surface-200 bg-surface-0\"\r\n >\r\n @if (group.title) {\r\n <h3\r\n class=\"m-0 border-b border-surface-200 bg-surface-50 px-4 py-3 text-lg font-semibold text-color\"\r\n dir=\"auto\"\r\n >\r\n {{ group.title }}\r\n </h3>\r\n }\r\n <div class=\"p-4\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n </div>\r\n </div>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n }\r\n }\r\n</div>\r\n\r\n<!--\r\n Every binding here reads a value the component already resolved into the slot\r\n (see `EntitiesPreview.slotGroups`). Keep it that way: this template runs once\r\n per entity per change detection pass, and a card grid renders thousands of\r\n them, so a method call or a fresh object literal in this block is measurably\r\n expensive.\r\n-->\r\n<ng-template #entityGrid let-slots>\r\n <div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (slot of slots; track slot.trackKey) {\r\n <div\r\n [class]=\"slot.containerClass\"\r\n [attr.data-row-click-ignore]=\"slot.rowClickIgnore\"\r\n [attr.title]=\"slot.title\"\r\n [style.grid-column]=\"slot.colSpan\"\r\n (click)=\"onSlotClick($event, slot)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"slot.entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [":host{container-type:inline-size}@container (max-width: 400px){:host(.mt-entities-stack-narrow) .mt-entities-grid{grid-template-columns:1fr;column-gap:0}:host(.mt-entities-stack-narrow) .mt-entities-grid>*{grid-column:1 / -1!important}}@container (max-width: 280px){.mt-entities-grid{grid-template-columns:1fr;column-gap:0}.mt-entities-grid>*{grid-column:1 / -1!important}}.mt-entity-filterable{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-in!important}.mt-entity-filter-active{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2314b8a6' stroke='%2314b8a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-out!important}.mt-entity-filterable:hover{background-color:#ccfbf147;outline:1px dashed rgb(20 184 166 / .28);outline-offset:2px}.mt-entity-filter-active{background-color:#ccfbf14d;box-shadow:inset 0 0 0 1.5px #14b8a666,0 0 0 1px #ffffff80}\n"], dependencies: [{ kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3110
3180
|
}
|
|
3111
3181
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesPreview, decorators: [{
|
|
3112
3182
|
type: Component,
|
|
3113
3183
|
args: [{ selector: 'mt-entities-preview', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityPreview, NgTemplateOutlet], host: {
|
|
3114
3184
|
class: 'block min-w-0 w-full',
|
|
3115
3185
|
'[class.mt-entities-stack-narrow]': 'stackOnNarrow()',
|
|
3116
|
-
}, template: "<div class=\"flex flex-col gap-4\">\r\n @for (group of slotGroups(); track group.trackKey) {\r\n @if (group.boxed) {\r\n <!-- Titled section box (matches the client-form section view) -->\r\n <div\r\n class=\"flex flex-col gap-0 overflow-hidden rounded-md border border-surface-200 bg-surface-0\"\r\n >\r\n @if (group.title) {\r\n <h3\r\n class=\"m-0 border-b border-surface-200 bg-surface-50 px-4 py-3 text-lg font-semibold text-color\"\r\n dir=\"auto\"\r\n >\r\n {{ group.title }}\r\n </h3>\r\n }\r\n <div class=\"p-4\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n </div>\r\n </div>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n }\r\n }\r\n</div>\r\n\r\n<!--\r\n Every binding here reads a value the component already resolved into the slot\r\n (see `EntitiesPreview.slotGroups`). Keep it that way: this template runs once\r\n per entity per change detection pass, and a card grid renders thousands of\r\n them, so a method call or a fresh object literal in this block is measurably\r\n expensive.\r\n-->\r\n<ng-template #entityGrid let-slots>\r\n <div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (slot of slots; track slot.trackKey) {\r\n <div\r\n [class]=\"slot.containerClass\"\r\n [attr.data-row-click-ignore]=\"slot.rowClickIgnore\"\r\n [attr.title]=\"slot.title\"\r\n [style.grid-column]=\"slot.colSpan\"\r\n (click)=\"onSlotClick($event, slot)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"slot.entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n
|
|
3117
|
-
}], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }],
|
|
3186
|
+
}, template: "<div class=\"flex flex-col gap-4\">\r\n @for (group of slotGroups(); track group.trackKey) {\r\n @if (group.boxed) {\r\n <!-- Titled section box (matches the client-form section view) -->\r\n <div\r\n class=\"flex flex-col gap-0 overflow-hidden rounded-md border border-surface-200 bg-surface-0\"\r\n >\r\n @if (group.title) {\r\n <h3\r\n class=\"m-0 border-b border-surface-200 bg-surface-50 px-4 py-3 text-lg font-semibold text-color\"\r\n dir=\"auto\"\r\n >\r\n {{ group.title }}\r\n </h3>\r\n }\r\n <div class=\"p-4\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n </div>\r\n </div>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n }\r\n }\r\n</div>\r\n\r\n<!--\r\n Every binding here reads a value the component already resolved into the slot\r\n (see `EntitiesPreview.slotGroups`). Keep it that way: this template runs once\r\n per entity per change detection pass, and a card grid renders thousands of\r\n them, so a method call or a fresh object literal in this block is measurably\r\n expensive.\r\n-->\r\n<ng-template #entityGrid let-slots>\r\n <div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (slot of slots; track slot.trackKey) {\r\n <div\r\n [class]=\"slot.containerClass\"\r\n [attr.data-row-click-ignore]=\"slot.rowClickIgnore\"\r\n [attr.title]=\"slot.title\"\r\n [style.grid-column]=\"slot.colSpan\"\r\n (click)=\"onSlotClick($event, slot)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"slot.entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [":host{container-type:inline-size}@container (max-width: 400px){:host(.mt-entities-stack-narrow) .mt-entities-grid{grid-template-columns:1fr;column-gap:0}:host(.mt-entities-stack-narrow) .mt-entities-grid>*{grid-column:1 / -1!important}}@container (max-width: 280px){.mt-entities-grid{grid-template-columns:1fr;column-gap:0}.mt-entities-grid>*{grid-column:1 / -1!important}}.mt-entity-filterable{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-in!important}.mt-entity-filter-active{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2314b8a6' stroke='%2314b8a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-out!important}.mt-entity-filterable:hover{background-color:#ccfbf147;outline:1px dashed rgb(20 184 166 / .28);outline-offset:2px}.mt-entity-filter-active{background-color:#ccfbf14d;box-shadow:inset 0 0 0 1.5px #14b8a666,0 0 0 1px #ffffff80}\n"] }]
|
|
3187
|
+
}], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }], stackOnNarrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackOnNarrow", required: false }] }], clickableKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableKeys", required: false }] }], activeKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeKeys", required: false }] }], clickableTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableTooltip", required: false }] }], activeTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTooltip", required: false }] }], entityClick: [{ type: i0.Output, args: ["entityClick"] }] } });
|
|
3118
3188
|
/** Stable key resolution shared with the host — must agree on order. */
|
|
3119
3189
|
function resolveEntityKey(entity) {
|
|
3120
3190
|
return entity.key || entity.normalizedKey || entity.name || '';
|
|
@@ -3324,7 +3394,7 @@ class EntitiesManage extends EntitiesResizeBase {
|
|
|
3324
3394
|
});
|
|
3325
3395
|
}
|
|
3326
3396
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesManage, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3327
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesManage, isStandalone: true, selector: "mt-entities-manage", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { entities: "entitiesChange", entitiesReordered: "entitiesReordered", entityClicked: "entityClicked", externalItemDropped: "externalItemDropped" }, usesInheritance: true, ngImport: i0, template: "<div\r\n cdkDropList\r\n cdkDropListOrientation=\"mixed\"\r\n [cdkDropListData]=\"displayEntities()\"\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n class=\"grid grid-cols-24 gap-x-4 gap-y-6\"\r\n>\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n @if (isSection(entity)) {\r\n <!-- Section marker: full-width, non-resizable header row -->\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell section-row group relative min-w-0 flex items-center gap-2 px-4 py-2.5 cursor-grab active:cursor-grabbing rounded-md border border-surface-200 bg-surface-50 transition-colors hover:bg-emphasis\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n >\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-11 bg-black/10 rounded-md\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <span\r\n class=\"flex-1 min-w-0 truncate text-base font-semibold\"\r\n dir=\"auto\"\r\n >\r\n {{ entity.name }}\r\n </span>\r\n <mt-icon\r\n icon=\"editor.pencil-01\"\r\n class=\"shrink-0 opacity-0 transition-opacity group-hover:opacity-60\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell group relative min-w-0 flex items-center p-3 cursor-grab active:cursor-grabbing rounded-lg transition-colors bg-surface-100/60\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-300]=\"entity.configuration?.showBorder\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n >\r\n <!-- Drag placeholder -->\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-12 bg-black/10 rounded-xl\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n class=\"flex-1 min-w-0 cursor-pointer\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n />\r\n\r\n <!-- Resize handle (right edge) -->\r\n <div\r\n class=\"resize-handle\"\r\n (mousedown)=\"onResizeStart($event, entity)\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div class=\"resize-handle-bar\"></div>\r\n </div>\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".cdk-drag{cursor:grab}.cdk-drag:active{cursor:grabbing}.cdk-drag-preview{cursor:grabbing;overflow:hidden}.cdk-drag-placeholder{opacity:.5}.cdk-drop-list-dragging .cdk-drag{cursor:grabbing}.entity-cell{position:relative}.resize-handle{position:absolute;top:0;inset-inline-end:-4px;width:8px;height:100%;cursor:col-resize;z-index:10;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s ease}.entity-cell:hover .resize-handle,.entity-cell.resizing .resize-handle{opacity:1}.resize-handle-bar{width:3px;height:24px;border-radius:2px;background-color:var(--p-primary-color, #6366f1);transition:height .15s ease,background-color .15s ease}.resize-handle:hover .resize-handle-bar{height:36px;background-color:var(--p-primary-color, #4f46e5)}.entity-cell.resizing{outline:2px dashed var(--p-primary-color, #6366f1);outline-offset:-1px;border-radius:8px;-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"
|
|
3397
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesManage, isStandalone: true, selector: "mt-entities-manage", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { entities: "entitiesChange", entitiesReordered: "entitiesReordered", entityClicked: "entityClicked", externalItemDropped: "externalItemDropped" }, usesInheritance: true, ngImport: i0, template: "<div\r\n cdkDropList\r\n cdkDropListOrientation=\"mixed\"\r\n [cdkDropListData]=\"displayEntities()\"\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n class=\"grid grid-cols-24 gap-x-4 gap-y-6\"\r\n>\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n @if (isSection(entity)) {\r\n <!-- Section marker: full-width, non-resizable header row -->\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell section-row group relative min-w-0 flex items-center gap-2 px-4 py-2.5 cursor-grab active:cursor-grabbing rounded-md border border-surface-200 bg-surface-50 transition-colors hover:bg-emphasis\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n >\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-11 bg-black/10 rounded-md\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <span\r\n class=\"flex-1 min-w-0 truncate text-base font-semibold\"\r\n dir=\"auto\"\r\n >\r\n {{ entity.name }}\r\n </span>\r\n <mt-icon\r\n icon=\"editor.pencil-01\"\r\n class=\"shrink-0 opacity-0 transition-opacity group-hover:opacity-60\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell group relative min-w-0 flex items-center p-3 cursor-grab active:cursor-grabbing rounded-lg transition-colors bg-surface-100/60\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-300]=\"entity.configuration?.showBorder\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n >\r\n <!-- Drag placeholder -->\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-12 bg-black/10 rounded-xl\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n class=\"flex-1 min-w-0 cursor-pointer\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n />\r\n\r\n <!-- Resize handle (right edge) -->\r\n <div\r\n class=\"resize-handle\"\r\n (mousedown)=\"onResizeStart($event, entity)\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div class=\"resize-handle-bar\"></div>\r\n </div>\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".cdk-drag{cursor:grab}.cdk-drag:active{cursor:grabbing}.cdk-drag-preview{cursor:grabbing;overflow:hidden}.cdk-drag-placeholder{opacity:.5}.cdk-drop-list-dragging .cdk-drag{cursor:grabbing}.entity-cell{position:relative}.resize-handle{position:absolute;top:0;inset-inline-end:-4px;width:8px;height:100%;cursor:col-resize;z-index:10;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s ease}.entity-cell:hover .resize-handle,.entity-cell.resizing .resize-handle{opacity:1}.resize-handle-bar{width:3px;height:24px;border-radius:2px;background-color:var(--p-primary-color, #6366f1);transition:height .15s ease,background-color .15s ease}.resize-handle:hover .resize-handle-bar{height:36px;background-color:var(--p-primary-color, #4f46e5)}.entity-cell.resizing{outline:2px dashed var(--p-primary-color, #6366f1);outline-offset:-1px;border-radius:8px;-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }] });
|
|
3328
3398
|
}
|
|
3329
3399
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesManage, decorators: [{
|
|
3330
3400
|
type: Component,
|
|
@@ -3335,5 +3405,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3335
3405
|
* Generated bundle index. Do not edit.
|
|
3336
3406
|
*/
|
|
3337
3407
|
|
|
3338
|
-
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, 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, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, readEntityValueColor, resolveConnectionLevelName, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, sharedActiveLang, splitConnectionKey, splitLeafKey, summarizeEntityListRows };
|
|
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 };
|
|
3339
3409
|
//# sourceMappingURL=masterteam-components-entities.mjs.map
|