@masterteam/components 0.0.294 → 0.0.295

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.294",
3
+ "version": "0.0.295",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -408,6 +408,14 @@ declare class EntityListField implements ControlValueAccessor {
408
408
  * this field does not render them.
409
409
  */
410
410
  protected readonly moduleBacked: _angular_core.Signal<boolean>;
411
+ /**
412
+ * Rows live in this property's own value rather than in target records: the
413
+ * module supplies the columns and the editors, nothing else. The whole row
414
+ * array is submitted on every save and no target record is ever written.
415
+ */
416
+ protected readonly embedded: _angular_core.Signal<boolean>;
417
+ /** The module record that owns an embedded value — the rows `instanceId`. */
418
+ protected readonly ownerRecordId: _angular_core.Signal<number>;
411
419
  protected readonly canRead: _angular_core.Signal<boolean>;
412
420
  /**
413
421
  * Whether the field has rows it may display. Write-only access cannot read
@@ -445,12 +453,25 @@ declare class EntityListField implements ControlValueAccessor {
445
453
  private readonly deletedIds;
446
454
  /** rowId → original form values / option labels (view state only). */
447
455
  private readonly rowDrafts;
456
+ /**
457
+ * rowId → the backend's rendered cells for a saved embedded row, from the
458
+ * rows endpoint. View state only: the submitted values stay `pendingRows`.
459
+ */
460
+ private readonly renderedRows;
448
461
  private localRowSeq;
449
462
  /** Serialized copy of the last value we emitted, to ignore CVA echoes. */
450
463
  private lastEmittedJson;
451
464
  /** Server rows indexed by entity id, for merging pending updates. */
452
465
  private readonly rowsByEntityId;
453
- /** Locally created rows (not yet persisted). */
466
+ /**
467
+ * Rows with no target record: locally created ones in a linked list, and
468
+ * *every* row of an embedded list.
469
+ *
470
+ * Three sources, in order: what the user last entered (`rowDrafts`), what the
471
+ * rows endpoint rendered for a saved embedded row, and the stored value's own
472
+ * cells. The middle one is what turns a saved `rawValue` of `"3fa85f64…"`
473
+ * back into an assignee's name after a reload.
474
+ */
454
475
  private readonly createdRows;
455
476
  /** Pending edits of existing rows, keyed by entity id. */
456
477
  private readonly editedRowsByEntityId;
@@ -617,6 +638,20 @@ declare class EntityListField implements ControlValueAccessor {
617
638
  * not read them.
618
639
  */
619
640
  private applyMetadata;
641
+ /**
642
+ * Saved rows of an embedded list, rendered by the backend.
643
+ *
644
+ * They are not merged into `rows` — that signal is target module records,
645
+ * which an embedded list has none of. They land in `renderedRows`, which
646
+ * `createdRows` consults to render the value's own rows with resolved labels
647
+ * instead of stored scalars.
648
+ *
649
+ * The stored value stays authoritative for *which* rows exist, so a value
650
+ * that already carries them is left alone; the response only seeds the array
651
+ * when the control arrived without one.
652
+ */
653
+ private fetchEmbeddedRows;
654
+ private applyEmbeddedRows;
620
655
  /**
621
656
  * Table columns, in the order the backend returned them.
622
657
  *
@@ -625,12 +660,16 @@ declare class EntityListField implements ControlValueAccessor {
625
660
  * value directly. The lookup still falls back to `normalizedKey` so a column
626
661
  * fed from any other projection keeps resolving.
627
662
  *
628
- * The columns are the *union* of readable and writable fields, so a
629
- * write-only key arrives as a column too — a `Planned Finish` the user may
630
- * set in the dialog but may not read. It is not projected into the rows and
631
- * would render as an empty column, so only readable keys become columns.
632
- * Write-only access is the exception: its readable set is empty by
633
- * definition, and its stored rows have nothing else to render through.
663
+ * The columns are the *union* of readable and writable fields, so in a
664
+ * **linked** list a write-only key arrives as a column too — a `Planned
665
+ * Finish` the user may set in the dialog but may not read. It is not
666
+ * projected into the rows and would render as an empty column, so only
667
+ * readable keys become columns there. Two exceptions keep the union:
668
+ *
669
+ * - **Write-only access**, whose readable set is empty by definition and
670
+ * whose stored rows have nothing else to render through.
671
+ * - **Embedded storage**, where the rows endpoint returns cells for the whole
672
+ * union by design, "so saved editor values can be rendered after reload".
634
673
  */
635
674
  private buildColumns;
636
675
  /** Catalog properties of the loaded metadata, keyed by property key. */
@@ -665,6 +704,16 @@ interface EntityListAddDialogInputs {
665
704
  initialValues?: Record<string, unknown>;
666
705
  /** True when the dialog edits an existing row rather than adding one. */
667
706
  isEdit?: boolean;
707
+ /**
708
+ * Load the target module's **root** form rather than its level-scoped one,
709
+ * by omitting `levelId` / `levelDataId` from the form load.
710
+ *
711
+ * Set for an embedded list. Its columns, its saved cells and the backend's
712
+ * own write validation all resolve from root module definitions, so a
713
+ * level-scoped editor could render a property that does not exist at root —
714
+ * and the save would reject that cell as unknown.
715
+ */
716
+ useRootModuleSchema?: boolean;
668
717
  }
669
718
  /**
670
719
  * Token used by `mt-entity-list-field` (Write mode) to open the rich add-row
@@ -1460,7 +1460,7 @@ declare class EntityPreview {
1460
1460
  * `mt-entity-preview` usages in the app.
1461
1461
  */
1462
1462
  readonly infoText: _angular_core.Signal<string>;
1463
- readonly comparisonKind: _angular_core.Signal<"EntityList" | "Value" | null>;
1463
+ readonly comparisonKind: _angular_core.Signal<"Value" | "EntityList" | null>;
1464
1464
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityPreview, never>;
1465
1465
  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
1466
  }
@@ -728,6 +728,13 @@ interface EntityListFieldRuntimeContext {
728
728
  /** Current level id (used to build the fetch/query contextKey). */
729
729
  levelId?: number | string | null;
730
730
  levelDataId?: number | string | null;
731
+ /**
732
+ * The module record that owns this property value — `instanceId` of the
733
+ * embedded rows endpoint. Distinct from `sourceId`, which falls back to the
734
+ * level-data id: an embedded list is only served for a module-owned record,
735
+ * so the level-data id must not be sent in its place.
736
+ */
737
+ moduleDataId?: number | string | null;
731
738
  }
732
739
  declare class EntityListFieldConfig extends BaseFieldConfig {
733
740
  /** EntityList property id (used in the read endpoint route). */