@masterteam/components 0.0.297 → 0.0.299

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/components",
3
- "version": "0.0.297",
3
+ "version": "0.0.299",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -465,11 +465,65 @@ declare class EntityListField implements ControlValueAccessor {
465
465
  */
466
466
  private readonly showsPendingOperations;
467
467
  /**
468
- * Rows rendered in the table: existing rows merged with pending edits,
469
- * removed rows hidden, and created rows appended.
468
+ * Whether each row is flagged with the operation the request performs on it,
469
+ * and a removed row stays on screen instead of disappearing.
470
+ *
471
+ * Only while reviewing an unapplied submission. In an editable field the user
472
+ * just pressed delete, so the row leaving *is* the feedback — putting it back
473
+ * with a badge and no way to undo reads as a delete that failed.
474
+ */
475
+ protected readonly showsChangeFlags: _angular_core.Signal<boolean>;
476
+ /**
477
+ * Rows rendered in the table: existing rows merged with pending edits, and
478
+ * created rows appended.
479
+ *
480
+ * While reviewing a submission the removed rows stay too, flagged `deleted`,
481
+ * and every row carries the operation it represents. An approver has to see
482
+ * the deletes they are approving — hiding them understated what pressing
483
+ * Approve would do. Everywhere else a removed row is simply gone.
470
484
  */
471
485
  protected readonly displayRows: _angular_core.Signal<EntityListRow[]>;
472
486
  protected readonly hasRows: _angular_core.Signal<boolean>;
487
+ /**
488
+ * Tag a rendered row with its staged operation and the cell that displays it.
489
+ * A no-op outside a reviewed submission, so an editable table keeps the rows
490
+ * exactly as the projection built them.
491
+ */
492
+ private withRowChange;
493
+ /**
494
+ * Deleted ids with no loaded record behind them — already applied elsewhere,
495
+ * or outside the level-data scope this table queries. They render as an empty
496
+ * flagged row rather than vanishing: a review screen that silently drops a
497
+ * delete is the bug this whole overlay exists to avoid, and an id the table
498
+ * cannot describe is still a deletion the approver is signing off on.
499
+ */
500
+ private orphanDeletedRows;
501
+ /**
502
+ * The flag cell, built as the `Status` entity `mt-table` already renders — a
503
+ * `rounded-md` badge tinted from the value's own colour. Assembled here
504
+ * rather than as a bespoke cell template so the column looks like every other
505
+ * cell in the table and needs no host wiring.
506
+ */
507
+ private buildRowChangeCell;
508
+ /**
509
+ * Badge labels, re-resolved when the active language changes. `translate()`
510
+ * is a plain call, so without a language signal to depend on the computed
511
+ * would keep whichever language it first ran in.
512
+ */
513
+ private readonly rowChangeLabels;
514
+ /**
515
+ * Columns bound to the table: the data columns, followed by the flag column
516
+ * while reviewing a submission.
517
+ *
518
+ * Last, not first: the leading column is what identifies a row, and pushing
519
+ * the record's own name aside for a badge makes the table harder to read for
520
+ * the rows nothing happened to — which is most of them.
521
+ *
522
+ * Deliberately separate from `columns()`, which is the metadata projection
523
+ * the row builders iterate — a synthetic column in there would be looked up
524
+ * against the record values and add an empty cell to every row.
525
+ */
526
+ protected readonly tableColumns: _angular_core.Signal<EntityListColumnDef[]>;
473
527
  /** Enough context to ask the backend what this field should render. */
474
528
  protected readonly hasRequiredContext: _angular_core.Signal<boolean>;
475
529
  /**
@@ -486,6 +540,8 @@ declare class EntityListField implements ControlValueAccessor {
486
540
  private readonly destroyRef;
487
541
  private readonly modal;
488
542
  private readonly transloco;
543
+ /** Active language — see `rowChangeLabels`. */
544
+ private readonly lang;
489
545
  /**
490
546
  * Optional rich add-row dialog (provided by `@masterteam/forms` via
491
547
  * `provideEntityListAddForm()`). When available, used instead of the local
@@ -493,10 +493,18 @@ interface EntityScheduleItemValue {
493
493
  moduleKey?: string;
494
494
  itemType?: string;
495
495
  }
496
- /** One cell of an `EntityList` row. Values are always sent as strings. */
496
+ /** One cell of an `EntityList` row. `rawValue` is always sent as a string. */
497
497
  interface EntityListValueItem {
498
498
  propertyKey: string;
499
499
  rawValue?: string | null;
500
+ /**
501
+ * The backend's resolved counterpart of `rawValue` — a user object, a
502
+ * formatted date. `process-form-load` emits it beside every row value (see
503
+ * `toDisplayMap` in `mt-entity-list-field`); the `fetch` Card projection
504
+ * currently does not, which is why a snapshot-backed preview renders the
505
+ * stored id. Read when present so that stays a backend-only fix.
506
+ */
507
+ value?: unknown;
500
508
  }
501
509
  /** One row of an `EntityList` value. */
502
510
  interface EntityListRowValue {
@@ -505,13 +513,26 @@ interface EntityListRowValue {
505
513
  values?: EntityListValueItem[];
506
514
  }
507
515
  /**
508
- * The stored `EntityList` payload, as the backend renders it. `rows` is the
509
- * only part this view type displays — `entityIds` and the operation-marker
510
- * arrays exist for the writable runtime, not for reading.
516
+ * The stored `EntityList` payload, as the backend renders it.
517
+ *
518
+ * Two parts carry displayable rows, and which one holds them depends on the
519
+ * source. An inline list keeps its rows in `rows`; a **module-backed** list
520
+ * keeps the linked target records in `snapshot.entities` and uses `rows` only
521
+ * for creates/updates the backend has not applied yet. Reading `rows` alone
522
+ * therefore shows nothing for the common module case — see
523
+ * `buildEntityListRows`, which merges the two.
524
+ *
525
+ * `entityIds` and the operation-marker arrays exist for the writable runtime,
526
+ * not for reading.
511
527
  */
512
528
  interface EntityListEntityValue {
513
529
  entityIds?: number[];
514
530
  rows?: EntityListRowValue[];
531
+ /** Preserved values of the linked target records, for module-backed lists. */
532
+ snapshot?: {
533
+ takenAt?: string | null;
534
+ entities?: EntityListRowValue[];
535
+ };
515
536
  }
516
537
  /**
517
538
  * One field definition of an inline `EntityList`, from its property
@@ -524,6 +545,13 @@ interface EntityListInlineFieldMeta {
524
545
  order?: number;
525
546
  required?: boolean;
526
547
  configuration?: EntityPropertyConfiguration;
548
+ /**
549
+ * Display label. Absent on a genuine `inlineFields` entry — inline
550
+ * configuration has no labels, which is what `humanizeEntityListKey` exists
551
+ * for. Set when the columns are derived from `catalog.nestedProperties`,
552
+ * whose entries carry the target module's own label.
553
+ */
554
+ label?: string;
527
555
  }
528
556
  /**
529
557
  * Catalog metadata for a property nested inside another property's value.
@@ -1067,11 +1095,17 @@ declare function humanizeEntityListKey(key: string): string;
1067
1095
  /**
1068
1096
  * Turns an `EntityList` entity into rendered rows.
1069
1097
  *
1070
- * Nothing is fetched: the value already carries `rows[]`, and the property
1071
- * configuration's `inlineFields` is the only description of the nested columns
1072
- * — the rows themselves carry bare keys. Shared by the trigger
1073
- * (`mt-entity-list-preview`, which needs the count and the titles) and the
1074
- * drawer that renders them in full.
1098
+ * Nothing is fetched. The value carries the rows — in `rows` for an inline
1099
+ * list, in `snapshot.entities` for a module-backed one, see `displayRowsOf` —
1100
+ * and the columns are described by the property configuration's
1101
+ * `inlineFields`, since the rows themselves carry bare keys. A module list has
1102
+ * no `inlineFields`, so its columns are derived from the keys present and
1103
+ * ordered by `readFields`; that yields humanized labels and plain text rather
1104
+ * than the target module's own labels and view types, which only that module's
1105
+ * catalog knows and this renderer never loads.
1106
+ *
1107
+ * Shared by the trigger (`mt-entity-list-preview`, which needs the count and
1108
+ * the titles) and the drawer that renders them in full.
1075
1109
  *
1076
1110
  * `allowed` narrows to those keys, in that order; empty renders every field
1077
1111
  * that survives the companion and identifier rules.
@@ -1460,7 +1494,7 @@ declare class EntityPreview {
1460
1494
  * `mt-entity-preview` usages in the app.
1461
1495
  */
1462
1496
  readonly infoText: _angular_core.Signal<string>;
1463
- readonly comparisonKind: _angular_core.Signal<"Value" | "EntityList" | null>;
1497
+ readonly comparisonKind: _angular_core.Signal<"EntityList" | "Value" | null>;
1464
1498
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityPreview, never>;
1465
1499
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityPreview, "mt-entity-preview", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "attachmentShape": { "alias": "attachmentShape"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1466
1500
  }