@masterteam/components 0.0.291 → 0.0.293

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.
@@ -20,7 +20,7 @@ import { newFieldId } from '@masterteam/components';
20
20
  import { Skeleton } from 'primeng/skeleton';
21
21
  import { Message } from 'primeng/message';
22
22
  import { ModalService } from '@masterteam/components/modal';
23
- import { serializeEntityRawValue } from '@masterteam/components/entities';
23
+ import { readEntityValueColor, serializeEntityRawValue } from '@masterteam/components/entities';
24
24
  import * as i2$1 from 'primeng/inputtext';
25
25
  import { InputTextModule } from 'primeng/inputtext';
26
26
 
@@ -778,6 +778,16 @@ const ACCESS_ALIASES = {
778
778
  const ROW_ID_KEY = '__rowId';
779
779
  const ROW_ENTITY_ID_KEY = '__entityId';
780
780
  const ROW_VALUES_KEY = '__values';
781
+ const ROW_PREFILL_KEY = '__prefill';
782
+ /**
783
+ * View types whose form control binds the resolved object rather than the
784
+ * stored scalar, so the edit dialog has to be pre-filled from the rendered
785
+ * `value` of the cell and not its `raw`. Mirrors `resolveLoadedFieldValue`
786
+ * in `@masterteam/forms/client-form`, which makes the same exception for
787
+ * these two at the top level of a form — a user picker renders from the
788
+ * object and would otherwise display a bare id.
789
+ */
790
+ const OBJECT_VALUED_VIEW_TYPES = new Set(['User', 'MultiUser']);
781
791
  /**
782
792
  * Stable sort by the payload's `order`, falling back to array position when it
783
793
  * is absent. Used to flatten a process form into reading order: `order` on a
@@ -802,6 +812,14 @@ class EntityListField {
802
812
  configuration = input(null, ...(ngDevMode ? [{ debugName: "configuration" }] : /* istanbul ignore next */ []));
803
813
  /** Runtime ids needed to call the read endpoint. */
804
814
  runtimeContext = input(null, ...(ngDevMode ? [{ debugName: "runtimeContext" }] : /* istanbul ignore next */ []));
815
+ /**
816
+ * The bound value is an unapplied process submission — an Approval step's
817
+ * frozen create/update/delete operations — rather than a persisted record
818
+ * value. Its `rows[]` and `deletedIds` are pending intent the approver has
819
+ * to see staged over the loaded records, not markers of writes the backend
820
+ * already applied. See `.github/instructions/properties/EntityList.md`.
821
+ */
822
+ pendingSubmission = input(false, ...(ngDevMode ? [{ debugName: "pendingSubmission" }] : /* istanbul ignore next */ []));
805
823
  /**
806
824
  * Full lookup catalog of the host form, forwarded to the add/edit dialog's
807
825
  * nested form. `process-form-load` returns only the lookup *id* per field,
@@ -878,8 +896,22 @@ class EntityListField {
878
896
  * partial updates of existing records; `entityId = 0` rows are creates.
879
897
  */
880
898
  pendingRows = signal([], ...(ngDevMode ? [{ debugName: "pendingRows" }] : /* istanbul ignore next */ []));
881
- /** Existing entity ids the user removed (submitted as `deletedIds`). */
882
- deletedIds = signal([], ...(ngDevMode ? [{ debugName: "deletedIds" }] : /* istanbul ignore next */ []));
899
+ /** Existing entity ids the user removed in this session. */
900
+ stagedDeletedIds = signal([], ...(ngDevMode ? [{ debugName: "stagedDeletedIds" }] : /* istanbul ignore next */ []));
901
+ /** `deletedIds` carried by the loaded value, before they mean anything. */
902
+ loadedDeletedIds = signal([], ...(ngDevMode ? [{ debugName: "loadedDeletedIds" }] : /* istanbul ignore next */ []));
903
+ /**
904
+ * Delete intents that apply to the table right now. On a persisted value the
905
+ * loaded `deletedIds` are historical operation markers — the records are
906
+ * already gone — so only this session's removals count. On an unapplied
907
+ * submission they are deletes awaiting approval and must be staged too.
908
+ */
909
+ deletedIds = computed(() => {
910
+ const staged = this.stagedDeletedIds();
911
+ if (!this.pendingSubmission())
912
+ return staged;
913
+ return [...new Set([...this.loadedDeletedIds(), ...staged])];
914
+ }, ...(ngDevMode ? [{ debugName: "deletedIds" }] : /* istanbul ignore next */ []));
883
915
  /** rowId → original form values / option labels (view state only). */
884
916
  rowDrafts = signal({}, ...(ngDevMode ? [{ debugName: "rowDrafts" }] : /* istanbul ignore next */ []));
885
917
  localRowSeq = 0;
@@ -902,7 +934,7 @@ class EntityListField {
902
934
  .filter((row) => !(row.entityId > 0))
903
935
  .map((row) => {
904
936
  const draft = drafts[row.rowId];
905
- return this.buildRow(row.rowId, row.rowId, 0, draft?.values ?? this.toValueMap(row.values), draft?.display ?? {});
937
+ return this.buildRow(row.rowId, row.rowId, 0, draft?.values ?? this.toValueMap(row.values), draft?.display ?? this.toDisplayMap(row.values));
906
938
  });
907
939
  }, ...(ngDevMode ? [{ debugName: "createdRows" }] : /* istanbul ignore next */ []));
908
940
  /** Pending edits of existing rows, keyed by entity id. */
@@ -917,7 +949,7 @@ class EntityListField {
917
949
  const draft = drafts[row.rowId];
918
950
  // A pending update only carries the keys the user changed.
919
951
  const changed = draft?.values ?? this.toValueMap(row.values);
920
- const display = draft?.display ?? {};
952
+ const display = draft?.display ?? this.toDisplayMap(row.values);
921
953
  if (!base) {
922
954
  map.set(row.entityId, this.buildRow(row.entityId, row.rowId, row.entityId, changed, display));
923
955
  continue;
@@ -925,10 +957,15 @@ class EntityListField {
925
957
  // Keep the backend-rendered cells for untouched columns so resolved
926
958
  // labels (users, lookups, statuses) are not replaced by raw ids.
927
959
  const baseValues = base[ROW_VALUES_KEY] ?? {};
960
+ const basePrefill = base[ROW_PREFILL_KEY] ??
961
+ baseValues;
928
962
  const next = {
929
963
  ...base,
930
964
  [ROW_ID_KEY]: row.rowId,
931
965
  [ROW_VALUES_KEY]: { ...baseValues, ...changed },
966
+ // Re-opening the dialog must still show what the controls bind, so
967
+ // the resolved values survive a pending edit.
968
+ [ROW_PREFILL_KEY]: { ...basePrefill, ...changed },
932
969
  };
933
970
  for (const column of this.columns()) {
934
971
  const key = column.propertyKey ?? column.key;
@@ -941,12 +978,23 @@ class EntityListField {
941
978
  return map;
942
979
  }, ...(ngDevMode ? [{ debugName: "editedRowsByEntityId" }] : /* istanbul ignore next */ []));
943
980
  /**
944
- * Rows rendered in the table. In editable write modes, and in a read-only
945
- * Write-only preview, existing rows are merged with pending edits, removed
946
- * rows are hidden, and locally created rows are appended.
981
+ * Whether the table stages pending operations over the loaded records.
982
+ *
983
+ * Editable write modes stage the user's own edits, and a read-only
984
+ * Write-only field has nothing but its stored rows to show. A pending
985
+ * submission stages them too even though it is read-only and `ReadWrite`:
986
+ * an approver reviewing a request has to see what it *will* do to the target
987
+ * module, not the records as they stand.
988
+ */
989
+ showsPendingOperations = computed(() => this.canWrite() ||
990
+ this.accessMode() === 'Write' ||
991
+ this.pendingSubmission(), ...(ngDevMode ? [{ debugName: "showsPendingOperations" }] : /* istanbul ignore next */ []));
992
+ /**
993
+ * Rows rendered in the table: existing rows merged with pending edits,
994
+ * removed rows hidden, and created rows appended.
947
995
  */
948
996
  displayRows = computed(() => {
949
- if (!this.canWrite() && this.accessMode() !== 'Write')
997
+ if (!this.showsPendingOperations())
950
998
  return this.rows();
951
999
  const deleted = new Set(this.deletedIds());
952
1000
  const edited = this.editedRowsByEntityId();
@@ -1019,11 +1067,16 @@ class EntityListField {
1019
1067
  return;
1020
1068
  this.lastEmittedJson = null;
1021
1069
  this.storedValue.set(incoming);
1022
- // Restore rows the backend left unprocessed. `deletedIds` on a loaded
1023
- // value are historical operation markers, not pending intent.
1070
+ // Restore rows the backend left unprocessed. Whether the loaded
1071
+ // `deletedIds` are historical markers or pending intent depends on the
1072
+ // value's provenance, which `deletedIds` resolves from `pendingSubmission`
1073
+ // — an input, so it cannot be read reliably this early.
1024
1074
  const rows = Array.isArray(incoming?.rows) ? incoming.rows : [];
1025
1075
  this.pendingRows.set(rows.filter((row) => !!row && typeof row === 'object'));
1026
- this.deletedIds.set([]);
1076
+ this.loadedDeletedIds.set((Array.isArray(incoming?.deletedIds) ? incoming.deletedIds : [])
1077
+ .map((id) => Number(id))
1078
+ .filter((id) => Number.isFinite(id) && id > 0));
1079
+ this.stagedDeletedIds.set([]);
1027
1080
  this.rowDrafts.set({});
1028
1081
  }
1029
1082
  /**
@@ -1121,7 +1174,11 @@ class EntityListField {
1121
1174
  this.setRowDraft(rowId, values, parsed.display);
1122
1175
  this.pendingRows.set([
1123
1176
  ...this.pendingRows(),
1124
- { rowId, entityId: 0, values: this.toSubmitValues(values) },
1177
+ {
1178
+ rowId,
1179
+ entityId: 0,
1180
+ values: this.toSubmitValues(values, parsed.submit),
1181
+ },
1125
1182
  ]);
1126
1183
  this.emitValue();
1127
1184
  });
@@ -1135,6 +1192,10 @@ class EntityListField {
1135
1192
  const entityId = Number(row[ROW_ENTITY_ID_KEY]) || 0;
1136
1193
  const rowId = String(row[ROW_ID_KEY] ?? '');
1137
1194
  const initialValues = row[ROW_VALUES_KEY] ?? {};
1195
+ // The form is filled with the shapes its controls bind; the diff still
1196
+ // runs against `initialValues`, the stored scalars.
1197
+ const prefillValues = row[ROW_PREFILL_KEY] ??
1198
+ initialValues;
1138
1199
  const ref = this.modal.openModal(component, 'dialog', {
1139
1200
  header: this.transloco.translate('components.entityListField.edit'),
1140
1201
  styleClass: '!w-[48rem] max-w-[96vw]',
@@ -1145,7 +1206,7 @@ class EntityListField {
1145
1206
  levelDataId: this.levelDataId(),
1146
1207
  writeFields: this.writeFields(),
1147
1208
  lookups: this.lookups(),
1148
- initialValues,
1209
+ initialValues: prefillValues,
1149
1210
  isEdit: true,
1150
1211
  },
1151
1212
  });
@@ -1168,7 +1229,7 @@ class EntityListField {
1168
1229
  * (keys outside `readFields`) are left untouched by the backend.
1169
1230
  */
1170
1231
  applyExistingRowEdit(entityId, fallbackRowId, initialValues, parsed) {
1171
- const changed = this.diffValues(initialValues, parsed.values);
1232
+ const changed = this.diffValues(initialValues, parsed.values, parsed.submit);
1172
1233
  const current = this.pendingRows();
1173
1234
  const existing = current.find((row) => row.entityId === entityId);
1174
1235
  const rowId = existing?.rowId || (fallbackRowId ? fallbackRowId : `entity-${entityId}`);
@@ -1186,7 +1247,7 @@ class EntityListField {
1186
1247
  const next = {
1187
1248
  rowId,
1188
1249
  entityId,
1189
- values: this.toSubmitValues(merged),
1250
+ values: this.toSubmitValues(merged, parsed.submit),
1190
1251
  };
1191
1252
  this.pendingRows.set(existing
1192
1253
  ? current.map((row) => (row.entityId === entityId ? next : row))
@@ -1197,7 +1258,7 @@ class EntityListField {
1197
1258
  const values = this.dropEmptyValues(parsed.values);
1198
1259
  this.setRowDraft(rowId, values, parsed.display);
1199
1260
  this.pendingRows.set(this.pendingRows().map((row) => row.rowId === rowId
1200
- ? { ...row, values: this.toSubmitValues(values) }
1261
+ ? { ...row, values: this.toSubmitValues(values, parsed.submit) }
1201
1262
  : row));
1202
1263
  }
1203
1264
  /**
@@ -1211,7 +1272,7 @@ class EntityListField {
1211
1272
  const rowId = String(row[ROW_ID_KEY] ?? '');
1212
1273
  if (entityId > 0) {
1213
1274
  if (!this.deletedIds().includes(entityId)) {
1214
- this.deletedIds.set([...this.deletedIds(), entityId]);
1275
+ this.stagedDeletedIds.set([...this.stagedDeletedIds(), entityId]);
1215
1276
  }
1216
1277
  // A queued update for a deleted record is pointless — drop it.
1217
1278
  this.pendingRows.set(this.pendingRows().filter((pending) => pending.entityId !== entityId));
@@ -1236,9 +1297,10 @@ class EntityListField {
1236
1297
  return {
1237
1298
  values: values,
1238
1299
  display: payload['display'] ?? {},
1300
+ submit: payload['submit'] ?? {},
1239
1301
  };
1240
1302
  }
1241
- return { values: payload, display: {} };
1303
+ return { values: payload, display: {}, submit: {} };
1242
1304
  }
1243
1305
  nextRowId() {
1244
1306
  const used = new Set(this.pendingRows().map((row) => row.rowId));
@@ -1265,6 +1327,9 @@ class EntityListField {
1265
1327
  [ROW_ID_KEY]: rowId,
1266
1328
  [ROW_ENTITY_ID_KEY]: entityId,
1267
1329
  [ROW_VALUES_KEY]: values,
1330
+ // A drafted row is built from control values already, so there is
1331
+ // nothing to resolve — the two maps are the same.
1332
+ [ROW_PREFILL_KEY]: values,
1268
1333
  };
1269
1334
  for (const column of this.columns()) {
1270
1335
  // Form values are keyed by catalog property key (e.g. "task_name"),
@@ -1293,6 +1358,14 @@ class EntityListField {
1293
1358
  * `label` is the resolved option display (present for select-based fields).
1294
1359
  */
1295
1360
  toLocalEntityValue(viewType, raw, label) {
1361
+ // A row loaded from a staged submission carries the backend's resolved
1362
+ // value as its label, and for the rich view types that object *is* what
1363
+ // the renderer binds — the same shape the raw branches below assemble by
1364
+ // hand. A select's resolved option is a plain string and still falls
1365
+ // through to them.
1366
+ const resolved = label != null && typeof label === 'object' && !Array.isArray(label)
1367
+ ? label
1368
+ : null;
1296
1369
  if (viewType === 'User') {
1297
1370
  if (Array.isArray(raw)) {
1298
1371
  const names = raw
@@ -1302,6 +1375,13 @@ class EntityListField {
1302
1375
  .filter((name) => name != null && name !== '');
1303
1376
  return names.length ? { displayName: names.join(', ') } : '';
1304
1377
  }
1378
+ if (resolved) {
1379
+ return {
1380
+ ...resolved,
1381
+ displayName: resolved['displayName'] ?? '',
1382
+ photoUrl: resolved['photoUrl'] ?? resolved['photo'] ?? '',
1383
+ };
1384
+ }
1305
1385
  if (raw && typeof raw === 'object') {
1306
1386
  const user = raw;
1307
1387
  return {
@@ -1317,6 +1397,8 @@ class EntityListField {
1317
1397
  return '';
1318
1398
  }
1319
1399
  if (viewType === 'Status' || viewType === 'Lookup') {
1400
+ if (resolved)
1401
+ return resolved;
1320
1402
  if (raw && typeof raw === 'object')
1321
1403
  return raw;
1322
1404
  if (raw != null && raw !== '' && label != null) {
@@ -1324,6 +1406,8 @@ class EntityListField {
1324
1406
  }
1325
1407
  return raw ?? '';
1326
1408
  }
1409
+ if (resolved)
1410
+ return resolved;
1327
1411
  // Plain / scalar view types: prefer a resolved option label when present,
1328
1412
  // else the raw value (unchanged for text / number / date / percentage).
1329
1413
  if (label != null && (raw == null || typeof raw !== 'object')) {
@@ -1341,7 +1425,16 @@ class EntityListField {
1341
1425
  // and delete intents.
1342
1426
  const next = {
1343
1427
  ...(current ?? {}),
1344
- rows: this.pendingRows(),
1428
+ // `values[].value` is the backend's rendered label, carried only so the
1429
+ // table can print it. Submitting it back would echo a user object where
1430
+ // the stored scalar belongs.
1431
+ rows: this.pendingRows().map((row) => ({
1432
+ ...row,
1433
+ values: (row.values ?? []).map(({ propertyKey, rawValue }) => ({
1434
+ propertyKey,
1435
+ rawValue,
1436
+ })),
1437
+ })),
1345
1438
  deletedIds: this.deletedIds(),
1346
1439
  };
1347
1440
  this.storedValue.set(next);
@@ -1352,14 +1445,24 @@ class EntityListField {
1352
1445
  this.onModelChange(next);
1353
1446
  this.onTouched();
1354
1447
  }
1355
- /** `values[]` entries, restricted to `writeFields` when configured. */
1356
- toSubmitValues(values) {
1448
+ /**
1449
+ * `values[]` entries, restricted to `writeFields` when configured.
1450
+ *
1451
+ * `submitShaped` carries the dialog-normalized counterpart of `values`,
1452
+ * keyed the same way, and is preferred per key. The control value a rich
1453
+ * field holds is not the scalar the backend stores — a user picker holds
1454
+ * the whole search result, a date picker a `Date` — and only the dialog
1455
+ * knows the target module's view types, so it does that reduction. Without
1456
+ * it we would stringify the control value as-is and the row would carry a
1457
+ * JSON user object where a bare id belongs.
1458
+ */
1459
+ toSubmitValues(values, submitShaped = {}) {
1357
1460
  const allowed = new Set(this.writeFields());
1358
1461
  return Object.entries(values)
1359
1462
  .filter(([propertyKey]) => allowed.size === 0 || allowed.has(propertyKey))
1360
1463
  .map(([propertyKey, value]) => ({
1361
1464
  propertyKey,
1362
- rawValue: this.toRawValue(value),
1465
+ rawValue: this.toRawValue(propertyKey in submitShaped ? submitShaped[propertyKey] : value),
1363
1466
  }));
1364
1467
  }
1365
1468
  /** Backend `rawValue` is a serialized scalar; objects/arrays go as JSON. */
@@ -1381,6 +1484,23 @@ class EntityListField {
1381
1484
  }
1382
1485
  return map;
1383
1486
  }
1487
+ /**
1488
+ * Backend-resolved display values of a loaded row, keyed like `toValueMap`.
1489
+ *
1490
+ * A row the user just added carries its labels in a `rowDrafts` entry, but a
1491
+ * row that arrived on a loaded value has none — only what the backend
1492
+ * rendered beside each `rawValue`. Without this the approver's table prints
1493
+ * the stored scalar: a bare GUID where the assignee belongs.
1494
+ */
1495
+ toDisplayMap(values) {
1496
+ const map = {};
1497
+ for (const value of values ?? []) {
1498
+ if (!value?.propertyKey || value.value === undefined)
1499
+ continue;
1500
+ map[value.propertyKey] = value.value;
1501
+ }
1502
+ return map;
1503
+ }
1384
1504
  dropEmptyValues(values) {
1385
1505
  const next = {};
1386
1506
  for (const [key, value] of Object.entries(values)) {
@@ -1394,14 +1514,21 @@ class EntityListField {
1394
1514
  * Keys the user actually changed. A key that was empty before and is still
1395
1515
  * empty is skipped (the dialog simply could not pre-fill it); a key that had
1396
1516
  * a value and is now empty is kept so the backend clears it.
1517
+ *
1518
+ * `initial` holds stored scalars (a `User` column pre-fills as a bare id)
1519
+ * while `next` holds control values (the whole picker result), so the two
1520
+ * are only comparable once reduced — hence comparing `submitShaped`.
1521
+ * Comparing the rich value directly marked every rich-valued column as
1522
+ * changed even when untouched, and the partial update then rewrote it.
1397
1523
  */
1398
- diffValues(initial, next) {
1524
+ diffValues(initial, next, submitShaped = {}) {
1399
1525
  const changed = {};
1400
1526
  for (const [key, value] of Object.entries(next)) {
1401
1527
  const before = initial[key];
1528
+ const comparable = key in submitShaped ? submitShaped[key] : value;
1402
1529
  if (this.isEmptyValue(value) && this.isEmptyValue(before))
1403
1530
  continue;
1404
- if (this.isSameValue(before, value))
1531
+ if (this.isSameValue(before, comparable))
1405
1532
  continue;
1406
1533
  changed[key] = value;
1407
1534
  }
@@ -1580,6 +1707,7 @@ class EntityListField {
1580
1707
  }
1581
1708
  const rows = (response.records ?? []).map((record) => {
1582
1709
  const values = {};
1710
+ const prefill = {};
1583
1711
  const row = {
1584
1712
  Id: record.id,
1585
1713
  [ROW_ID_KEY]: `entity-${record.id}`,
@@ -1591,11 +1719,17 @@ class EntityListField {
1591
1719
  const propertyKey = property?.key ?? column.key;
1592
1720
  const cell = record.values?.[propertyKey];
1593
1721
  row[column.key] = this.toEntityData(column, cell, property, record.id);
1594
- // Keep the machine-readable value so the edit dialog can pre-fill and
1595
- // partial updates can be diffed against it.
1722
+ // Keep the machine-readable value as the baseline a partial update is
1723
+ // diffed against — it is the shape the row submits.
1596
1724
  values[propertyKey] = cell?.raw ?? cell?.value ?? null;
1725
+ // What the edit dialog patches into its form, which is not always the
1726
+ // same thing: see OBJECT_VALUED_VIEW_TYPES.
1727
+ prefill[propertyKey] = OBJECT_VALUED_VIEW_TYPES.has(column.viewType ?? '')
1728
+ ? (cell?.value ?? cell?.raw ?? null)
1729
+ : values[propertyKey];
1597
1730
  }
1598
1731
  row[ROW_VALUES_KEY] = values;
1732
+ row[ROW_PREFILL_KEY] = prefill;
1599
1733
  return row;
1600
1734
  });
1601
1735
  this.rows.set(rows);
@@ -1608,6 +1742,7 @@ class EntityListField {
1608
1742
  normalizedKey: property?.normalizedKey ?? column.key,
1609
1743
  name: column.label ?? property?.label ?? column.key,
1610
1744
  rawValue: serializeEntityRawValue(cell?.raw),
1745
+ color: readEntityValueColor(cell?.color),
1611
1746
  value: (cell?.value ?? ''),
1612
1747
  viewType: (column.viewType ?? 'Text'),
1613
1748
  type: property?.source,
@@ -1618,7 +1753,7 @@ class EntityListField {
1618
1753
  };
1619
1754
  }
1620
1755
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
1621
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (!canDisplayRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.readingNotAllowed\" | transloco }}\r\n </div>\r\n } @else if (!hasRequiredContext()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.missingConfiguration\" | transloco }}\r\n </div>\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1756
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, pendingSubmission: { classPropertyName: "pendingSubmission", publicName: "pendingSubmission", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (!canDisplayRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.readingNotAllowed\" | transloco }}\r\n </div>\r\n } @else if (!hasRequiredContext()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.missingConfiguration\" | transloco }}\r\n </div>\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "messageId"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1622
1757
  }
1623
1758
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
1624
1759
  type: Component,
@@ -1631,7 +1766,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1631
1766
  Button,
1632
1767
  TranslocoPipe,
1633
1768
  ], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (!canDisplayRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.readingNotAllowed\" | transloco }}\r\n </div>\r\n } @else if (!hasRequiredContext()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.missingConfiguration\" | transloco }}\r\n </div>\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n", styles: [":host{display:block}\n"] }]
1634
- }], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
1769
+ }], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }], pendingSubmission: [{ type: i0.Input, args: [{ isSignal: true, alias: "pendingSubmission", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
1635
1770
 
1636
1771
  /** Page size when loading the full deliverable list, and a hard safety cap. */
1637
1772
  const PAGE_SIZE = 100;