@masterteam/components 0.0.304 → 0.0.306

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.304",
3
+ "version": "0.0.306",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -4,7 +4,6 @@ import { LookupMatrixFieldConfig, LookupOptionItemConfig, LookupMatrixCellConfig
4
4
  import { ControlValueAccessor, NgControl, AbstractControl, Validators } from '@angular/forms';
5
5
  import { HttpContext } from '@angular/common/http';
6
6
  import { ColumnDef, TableAction } from '@masterteam/components/table';
7
- import * as _masterteam_components_entities from '@masterteam/components/entities';
8
7
  import { EntityData, EntityListLocalSchemaField, EntityListLocalCell } from '@masterteam/components/entities';
9
8
 
10
9
  declare class LookupMatrixField implements AfterViewInit {
@@ -319,6 +318,18 @@ declare class SchedulePredecessorField implements ControlValueAccessor {
319
318
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SchedulePredecessorField, "mt-schedule-predecessor-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
320
319
  }
321
320
 
321
+ /**
322
+ * One saved revision of a list — `GET entity-lists/revisions`, newest first.
323
+ * `createdBy` is an actor id and is never shown; `createdByName` is the
324
+ * author's *current* display name, null when it cannot be resolved, and
325
+ * absent on a backend older than `f039e096`.
326
+ */
327
+ interface EntityListRevision {
328
+ version: number;
329
+ createdAt: string;
330
+ createdBy?: string | null;
331
+ createdByName?: string | null;
332
+ }
322
333
  /**
323
334
  * Why the metadata request produced no table.
324
335
  *
@@ -622,7 +633,7 @@ declare class EntityListField implements ControlValueAccessor {
622
633
  * active schema is the fallback for a list that has never been saved.
623
634
  */
624
635
  private readonly localSchema;
625
- protected readonly localFields: _angular_core.Signal<_masterteam_components_entities.EntityListLocalSchemaField[]>;
636
+ protected readonly localFields: _angular_core.Signal<EntityListLocalSchemaField[]>;
626
637
  /**
627
638
  * Render the Local table once the metadata answered: it is the access
628
639
  * boundary, and it carries the operation switches the table obeys.
@@ -656,6 +667,8 @@ declare class EntityListField implements ControlValueAccessor {
656
667
  * control value and option label, like a locally added linked row.
657
668
  */
658
669
  protected readonly localTableRows: _angular_core.Signal<EntityListRow[]>;
670
+ private buildLocalColumns;
671
+ private buildLocalRows;
659
672
  /**
660
673
  * Edit and delete per row. A row added in this session is still part of the
661
674
  * create — changing or dropping it undoes nothing stored — so it follows
@@ -702,6 +715,99 @@ declare class EntityListField implements ControlValueAccessor {
702
715
  * withholds its values, and the row says so, so the user can remove it.
703
716
  */
704
717
  protected readonly selectionRows: _angular_core.Signal<EntityListRow[]>;
718
+ /**
719
+ * One table row from a rendered record — `{ entityId, values }` with each
720
+ * value's `rawValue` and rendered `value` — cell by cell against the
721
+ * metadata columns, the same cells a related list shows. Selected `records`
722
+ * and the comparison's preserved / live rows all have this shape.
723
+ */
724
+ private recordRow;
725
+ /** The comparison response, once loaded. */
726
+ private readonly comparison;
727
+ /**
728
+ * The record that owns the list, when the host named it (a table cell's
729
+ * drawer). Only a read-only list reads its comparison: an editable one
730
+ * edits the source records it queries.
731
+ */
732
+ private readonly comparisonOwner;
733
+ /**
734
+ * A saved Related list viewed from outside its form: the values preserved
735
+ * when it was saved beside the source records' current ones. Local and
736
+ * Selected lists hold their own rows and never compare.
737
+ */
738
+ protected readonly comparisonMode: _angular_core.Signal<boolean>;
739
+ protected readonly comparisonReady: _angular_core.Signal<boolean>;
740
+ protected readonly liveRows: _angular_core.Signal<EntityListRow[]>;
741
+ protected readonly preservedRows: _angular_core.Signal<EntityListRow[]>;
742
+ /** No baseline was captured yet — not the same as an empty saved list. */
743
+ protected readonly preservedAvailable: _angular_core.Signal<boolean>;
744
+ protected readonly preservedAt: _angular_core.Signal<string | null>;
745
+ protected readonly unavailableCount: _angular_core.Signal<number>;
746
+ /** Query of the two read-only review endpoints for this list's owner. */
747
+ private reviewParams;
748
+ private fetchComparison;
749
+ /**
750
+ * A list viewed from outside its form, with its owning record named (a
751
+ * table cell's drawer), has saved revisions to browse — Related, Local and
752
+ * Selected alike. Nowhere else: an editable list, a record preview and a
753
+ * form know no owner, and history is read-only anyway.
754
+ */
755
+ protected readonly historyAvailable: _angular_core.Signal<boolean>;
756
+ /**
757
+ * A Local or Selected list shows its value until a revision is picked;
758
+ * then that revision, until *Back to latest*. A Related list always shows
759
+ * a comparison, the latest one when no revision is picked.
760
+ */
761
+ protected readonly showingRevision: _angular_core.Signal<boolean>;
762
+ /** The Local rows of the revision being viewed, with that revision's schema. */
763
+ private readonly revisionLocalDocument;
764
+ private readonly revisionLocalFields;
765
+ protected readonly revisionLocalColumns: _angular_core.Signal<EntityListColumnDef[]>;
766
+ protected readonly revisionLocalRows: _angular_core.Signal<EntityListRow[]>;
767
+ /** The history list is open. */
768
+ protected readonly revisionsOpen: _angular_core.WritableSignal<boolean>;
769
+ /** Revisions loaded so far, newest first. */
770
+ protected readonly revisions: _angular_core.WritableSignal<EntityListRevision[]>;
771
+ /**
772
+ * The revisions as listed, each with the author to print: the name the
773
+ * backend resolved for the page, or "Unknown user" when it resolved none.
774
+ * Plain text — the template interpolates it, never binds it as HTML.
775
+ */
776
+ protected readonly revisionItems: _angular_core.Signal<{
777
+ version: number;
778
+ createdAt: string;
779
+ author: string;
780
+ }[]>;
781
+ private readonly revisionsTotal;
782
+ private revisionsPage;
783
+ protected readonly revisionsLoading: _angular_core.WritableSignal<boolean>;
784
+ protected readonly revisionsError: _angular_core.WritableSignal<string | null>;
785
+ protected readonly hasMoreRevisions: _angular_core.Signal<boolean>;
786
+ /** The revision the comparison shows; null is the list as saved last. */
787
+ protected readonly viewedRevision: _angular_core.WritableSignal<number | null>;
788
+ /** A revision is being read; the tables stay until it arrives. */
789
+ protected readonly revisionLoading: _angular_core.WritableSignal<boolean>;
790
+ /** Why the chosen revision could not be read. The last comparison stays. */
791
+ protected readonly revisionError: _angular_core.WritableSignal<string | null>;
792
+ private revisionSubscription?;
793
+ private revisionsSubscription?;
794
+ protected toggleRevisions(): void;
795
+ /** The next page of the revision index. */
796
+ protected loadRevisions(): void;
797
+ /**
798
+ * Compare a saved revision with today — its preserved rows beside today's
799
+ * values of the records it held; for Local, its rows as saved — or, with
800
+ * `null`, go back to the latest: a Related list re-reads its comparison, a
801
+ * Local or Selected one shows its value again. Read-only: nothing here is
802
+ * ever submitted.
803
+ */
804
+ protected showRevision(version: number | null): void;
805
+ /**
806
+ * `entity_list.history_source_changed` (`400`): the revision was saved with
807
+ * another source configuration. `404`: it no longer exists.
808
+ */
809
+ private revisionFailureMessage;
810
+ private resetRevisions;
705
811
  protected readonly selectionRowActions: _angular_core.Signal<TableAction[]>;
706
812
  /**
707
813
  * A required Selected list needs a record. An emptied selection is an
@@ -785,11 +891,17 @@ declare class EntityListField implements ControlValueAccessor {
785
891
  */
786
892
  private writeLocalValue;
787
893
  /**
788
- * True when the written value still carries exactly the rows and deletions
789
- * we last emitted — i.e. the form is echoing our own value back rather than
790
- * loading a new one.
894
+ * True when the written value still carries exactly the change we last
895
+ * emitted — i.e. the form is echoing our own value back rather than loading
896
+ * a new one.
897
+ *
898
+ * The list version, change id and tokens are part of it: a reload after a
899
+ * save can carry the same (empty) rows and deletions as the last emission,
900
+ * and taking it for an echo kept the old version, so the next save was
901
+ * refused as a version conflict.
791
902
  */
792
903
  private isEchoOfLastEmit;
904
+ private echoKey;
793
905
  /**
794
906
  * The stored value is persisted as JSON, so a host may write either the
795
907
  * parsed object or its raw string form.
@@ -913,6 +1025,8 @@ declare class EntityListField implements ControlValueAccessor {
913
1025
  * what it loaded with; the backend skips it.
914
1026
  */
915
1027
  private linkedMutation;
1028
+ /** The loaded value's `mutationId`, restored once nothing is left to apply. */
1029
+ private loadedMutationId;
916
1030
  private linkedMutationId;
917
1031
  /**
918
1032
  * `values[]` entries, restricted to `writeFields` when configured.
@@ -56,6 +56,13 @@ interface EntityRuntimeContext {
56
56
  levelId?: number | string | null;
57
57
  /** Owning level-data row — what related records are scoped to. */
58
58
  levelDataId?: number | string | null;
59
+ /**
60
+ * The record that owns the list, for the reads addressed to it rather than
61
+ * to its level — the saved list's `entity-lists/comparison`. Set by a host
62
+ * that knows the row it renders (a table cell); a record preview leaves it.
63
+ */
64
+ ownerKind?: 'ModuleData' | 'LevelData' | null;
65
+ ownerId?: number | null;
59
66
  }
60
67
  /**
61
68
  * Publishes an `EntityRuntimeContext` to a subtree of entity renderers.
@@ -735,6 +735,13 @@ interface EntityListFieldRuntimeContext {
735
735
  * on a level's own form, whose context is `Level:{levelId}`.
736
736
  */
737
737
  moduleId?: number | string | null;
738
+ /**
739
+ * The record that owns the list. A read-only Related list with an owner
740
+ * shows its saved list's preserved and current values
741
+ * (`entity-lists/comparison`) instead of querying the source module.
742
+ */
743
+ ownerKind?: 'ModuleData' | 'LevelData' | null;
744
+ ownerId?: number | null;
738
745
  }
739
746
  declare class EntityListFieldConfig extends BaseFieldConfig {
740
747
  /** EntityList property id (used in the read endpoint route). */