@masterteam/components 0.0.301 → 0.0.303

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.301",
3
+ "version": "0.0.303",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -4,7 +4,8 @@ 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 { EntityData } from '@masterteam/components/entities';
7
+ import * as _masterteam_components_entities from '@masterteam/components/entities';
8
+ import { EntityData, EntityListLocalSchemaField, EntityListLocalCell } from '@masterteam/components/entities';
8
9
 
9
10
  declare class LookupMatrixField implements AfterViewInit {
10
11
  readonly config: _angular_core.InputSignal<LookupMatrixFieldConfig>;
@@ -385,6 +386,11 @@ declare class EntityListField implements ControlValueAccessor {
385
386
  * effective configuration.
386
387
  */
387
388
  readonly propertyId: _angular_core.InputSignal<number | null>;
389
+ /**
390
+ * EntityList property key. A Selected list's picker loads its candidates
391
+ * from `forms/options/{propertyKey}`; no other mode reads it.
392
+ */
393
+ readonly propertyKey: _angular_core.InputSignal<string>;
388
394
  /**
389
395
  * Stored property configuration (sourceType, moduleId, access, readFields …).
390
396
  *
@@ -579,6 +585,132 @@ declare class EntityListField implements ControlValueAccessor {
579
585
  * against the record values and add an empty cell to every row.
580
586
  */
581
587
  protected readonly tableColumns: _angular_core.Signal<EntityListColumnDef[]>;
588
+ /** Loaded document plus this session's edits; see `LocalEditorState`. */
589
+ private readonly localState;
590
+ /** The bound value was a Local document, whatever the metadata says yet. */
591
+ private readonly localValueSeen;
592
+ /** The last Local value emitted, so its echo does not reset the edits. */
593
+ private lastLocalEmit;
594
+ /**
595
+ * Rows live inside the parent record: no target records, no `fetch/query`,
596
+ * and the value is a document of its own rather than operation markers.
597
+ * Known from the metadata, or earlier from the value itself.
598
+ */
599
+ protected readonly localMode: _angular_core.Signal<boolean>;
600
+ /**
601
+ * The schema the table is built from. A loaded value's own schema wins: it
602
+ * is the one its rows were projected against, and pending or approved
603
+ * evidence stays pinned to the schema it was submitted with. The metadata's
604
+ * active schema is the fallback for a list that has never been saved.
605
+ */
606
+ private readonly localSchema;
607
+ protected readonly localFields: _angular_core.Signal<_masterteam_components_entities.EntityListLocalSchemaField[]>;
608
+ /**
609
+ * Render the Local table once the metadata answered: it is the access
610
+ * boundary, and it carries the operation switches the table obeys.
611
+ */
612
+ protected readonly localReady: _angular_core.Signal<boolean>;
613
+ /**
614
+ * Writes are staged into the parent's submission, never sent on their own.
615
+ *
616
+ * Whether the host lets this field be edited is the form's call —
617
+ * `readonly` — as it is for a linked list; `pendingSubmission` is not one.
618
+ * A loaded request is not always a review: a returned request is loaded to
619
+ * be corrected and resubmitted, and the backend projects the active schema
620
+ * for exactly that.
621
+ */
622
+ private readonly localWritable;
623
+ protected readonly localCanCreate: _angular_core.Signal<boolean>;
624
+ private readonly localCanEdit;
625
+ private readonly localCanDelete;
626
+ /** Reordering rewrites loaded rows, so it is an edit. */
627
+ protected readonly localCanReorder: _angular_core.Signal<boolean>;
628
+ /**
629
+ * One column per visible schema field, keyed by the field's local id — the
630
+ * id cells are keyed by. Sorting is off while rows can be dragged: a sorted
631
+ * table would show an order that is not the one being saved.
632
+ */
633
+ protected readonly localColumns: _angular_core.Signal<EntityListColumnDef[]>;
634
+ /**
635
+ * Rows as rendered: loaded rows with this session's edits over them, then
636
+ * new rows, in the order they would be saved. A loaded cell renders from the
637
+ * backend's resolved `value`; a cell the user set renders from the dialog's
638
+ * control value and option label, like a locally added linked row.
639
+ */
640
+ protected readonly localTableRows: _angular_core.Signal<EntityListRow[]>;
641
+ /**
642
+ * Edit and delete per row. A row added in this session is still part of the
643
+ * create — changing or dropping it undoes nothing stored — so it follows
644
+ * `allowCreate`; a loaded row follows `allowEdit` / `allowDelete`.
645
+ */
646
+ protected readonly localRowActions: _angular_core.Signal<TableAction[]>;
647
+ /** Loaded selection plus this session's picks; see `SelectionEditorState`. */
648
+ private readonly selectionState;
649
+ /** The bound value was a Selected document, whatever the metadata says yet. */
650
+ private readonly selectionValueSeen;
651
+ /** The last Selected value emitted, so its echo does not reset the picks. */
652
+ private lastSelectionEmit;
653
+ /**
654
+ * The list holds only the records the user picked. It never falls back to
655
+ * every related record: an empty selection is empty. Known from the
656
+ * metadata, or earlier from the value itself.
657
+ */
658
+ protected readonly selectionMode: _angular_core.Signal<boolean>;
659
+ /** Render once the metadata answered: it is the access boundary. */
660
+ protected readonly selectionReady: _angular_core.Signal<boolean>;
661
+ private readonly selectionMultiple;
662
+ /**
663
+ * The picker's `contextKey`: the context of the form that owns the property
664
+ * — never the source module, which the backend resolves from the property's
665
+ * own configuration.
666
+ */
667
+ private readonly selectionContextKey;
668
+ /**
669
+ * Whether the user may change which records are selected. That is the
670
+ * form's call — `readonly`, from the field's `isWrite` — and not the
671
+ * metadata's `access` or its `allow*` switches: those describe the source
672
+ * records, which selecting never writes.
673
+ */
674
+ protected readonly selectionWritable: _angular_core.Signal<boolean>;
675
+ /**
676
+ * The selected records as table rows, in selection order.
677
+ *
678
+ * A saved record renders from the backend's `records`, cell by cell against
679
+ * the metadata columns — the same cells a related list shows. A record
680
+ * picked in this session has no rendered values until the parent is saved,
681
+ * so it shows its name in the first column. A record in `unavailableIds` was
682
+ * deleted or is no longer visible: the backend keeps it selected but
683
+ * withholds its values, and the row says so, so the user can remove it.
684
+ */
685
+ protected readonly selectionRows: _angular_core.Signal<EntityListRow[]>;
686
+ protected readonly selectionRowActions: _angular_core.Signal<TableAction[]>;
687
+ /**
688
+ * A required Selected list needs a record. An emptied selection is an
689
+ * object — a mutation with no ids — so `Validators.required` passes it and
690
+ * only the backend would object (`entity_list.selection_required`).
691
+ */
692
+ private readonly selectionRequiredValidator;
693
+ protected openSelectionDialog(): void;
694
+ /**
695
+ * Publish the selection as the control's value: a mutation when it differs
696
+ * from what was loaded, else the loaded value, which the submission leaves
697
+ * out. See `buildSelectionValue`.
698
+ */
699
+ private emitSelection;
700
+ /**
701
+ * Take a Selected document, and say whether it was one.
702
+ *
703
+ * Our own emission echoed back keeps the session; a value some instance of
704
+ * this field emitted restores that instance's state (see
705
+ * `SELECTION_EDITOR_STATES`); anything else starts a session on it. That is
706
+ * the projection `process-form-load` returns, the stored document a preview
707
+ * gets from the fetch endpoints, or a mutation the form already held — which
708
+ * stays the control's value until the user changes the selection.
709
+ *
710
+ * An empty value resets the session too and still falls through, since
711
+ * which mode the list uses may not be known yet.
712
+ */
713
+ private writeSelectionValue;
582
714
  /** Enough context to ask the backend what this field should render. */
583
715
  protected readonly hasRequiredContext: _angular_core.Signal<boolean>;
584
716
  /**
@@ -604,8 +736,35 @@ declare class EntityListField implements ControlValueAccessor {
604
736
  * `writeFields`.
605
737
  */
606
738
  private readonly addDialogComponent;
739
+ /**
740
+ * Row dialog of a Local list, built from the schema's captured definitions
741
+ * (`provideEntityListAddForm()` registers it beside the linked one). Without
742
+ * it a Local list renders read-only.
743
+ */
744
+ private readonly localDialogComponent;
607
745
  constructor();
608
746
  writeValue(value: EntityListStoredValue | string | null): void;
747
+ /**
748
+ * Take a Local document, and say whether it was one.
749
+ *
750
+ * - Our own emission echoed back (`mt-dynamic-form` re-writes the model on
751
+ * every change) keeps the session's edits.
752
+ * - A value some instance of this field emitted restores that instance's
753
+ * state — see `LOCAL_EDITOR_STATES`.
754
+ * - A document the backend sent starts a fresh session on it: the projection
755
+ * `process-form-load` and the fetch endpoints return (its `schema` set,
756
+ * cells rendered), or the stored document an older backend's fetch
757
+ * endpoints returned (`schema: null`, cells unrendered) — the schema then
758
+ * comes from the metadata.
759
+ * Every backend document carries the `schema` member, null or not; a
760
+ * mutation never does. So a mutation nobody here emitted has no rows to
761
+ * rebuild the table from and is left as the control's value, untouched
762
+ * until the user edits.
763
+ *
764
+ * An empty value resets the Local session too — a form reset — and still
765
+ * falls through, since which storage the list uses may not be known yet.
766
+ */
767
+ private writeLocalValue;
609
768
  /**
610
769
  * True when the written value still carries exactly the rows and deletions
611
770
  * we last emitted — i.e. the form is echoing our own value back rather than
@@ -637,6 +796,57 @@ declare class EntityListField implements ControlValueAccessor {
637
796
  * existing records are queued in `deletedIds` for the backend to delete.
638
797
  */
639
798
  protected deleteRow(row: EntityListRow): void;
799
+ /**
800
+ * Add a Local row (no `row`) or edit one. The dialog is built from the
801
+ * schema; its `submit` map is serialized here into cell `rawValue`s.
802
+ *
803
+ * A loaded row keeps only the cells that differ from what was loaded, so an
804
+ * untouched cell is omitted and retained. Emptying a cell that had a value
805
+ * is a clear, sent as `null` — the dialog is filled from every schema field,
806
+ * so an empty control here really was emptied.
807
+ */
808
+ protected openLocalRowDialog(row?: EntityListRow): void;
809
+ /**
810
+ * Remove a Local row. A loaded row is listed in `deletedRowIds` and its
811
+ * pending edit dropped — a row is never both deleted and submitted. A row
812
+ * added in this session just disappears.
813
+ */
814
+ protected deleteLocalRow(row: EntityListRow): void;
815
+ /**
816
+ * Apply a drag within the table. Replays PrimeNG's own move on the rows as
817
+ * rendered: `p-table` is bound to a derived array, so the event's `value`
818
+ * is not reliably the reordered one.
819
+ */
820
+ protected onLocalReorder(event: {
821
+ dragIndex?: number;
822
+ dropIndex?: number;
823
+ }): void;
824
+ /**
825
+ * Serialize one dialog result into cells, by field id, for every visible
826
+ * field. `submit` is the dialog's reduction to stored scalars and wins over
827
+ * the raw control value, as for linked rows.
828
+ */
829
+ private toLocalCells;
830
+ /**
831
+ * Publish the Local state as the control's value.
832
+ *
833
+ * With changes, the value is a mutation: the loaded list and schema
834
+ * versions, only the changed rows and cells, explicit deletions, and a
835
+ * `mutationId` that stays the same while the content does (a retry of the
836
+ * same save) and changes with it (a new save). Without changes it is the
837
+ * loaded document again, which `mapFormValueToSubmitFields` leaves out of the
838
+ * submission — an unchanged Local list is omitted, never re-sent.
839
+ */
840
+ private emitLocal;
841
+ /** A cell the user set in this session, shaped like a backend one. */
842
+ private buildLocalDraftCell;
843
+ /**
844
+ * A loaded cell: the backend's rendered `value` beside its `rawValue`. A
845
+ * stored document (what an older backend's fetch endpoints returned) has no
846
+ * rendered values, so the raw one is shaped the way a locally set cell would
847
+ * be — a user id still renders as a user, though only as its id.
848
+ */
849
+ private buildLocalLoadedCell;
640
850
  /**
641
851
  * Normalize the add/edit dialog close payload. The rich dialog returns
642
852
  * `{ values, display }`; a custom add-dialog may still return the raw values
@@ -757,7 +967,7 @@ declare class EntityListField implements ControlValueAccessor {
757
967
  private applyRecords;
758
968
  private toEntityData;
759
969
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListField, never>;
760
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityListField, "mt-entity-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "propertyId": { "alias": "propertyId"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; "pendingSubmission": { "alias": "pendingSubmission"; "required": false; "isSignal": true; }; "lookups": { "alias": "lookups"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "initialValue": { "alias": "initialValue"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
970
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityListField, "mt-entity-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "propertyId": { "alias": "propertyId"; "required": false; "isSignal": true; }; "propertyKey": { "alias": "propertyKey"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; "pendingSubmission": { "alias": "pendingSubmission"; "required": false; "isSignal": true; }; "lookups": { "alias": "lookups"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "initialValue": { "alias": "initialValue"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
761
971
  }
762
972
 
763
973
  /** Inputs the EntityList add-row dialog will receive via ModalService inputValues. */
@@ -785,6 +995,46 @@ interface EntityListAddDialogInputs {
785
995
  * token is not registered, the field falls back to a minimal text-only popup.
786
996
  */
787
997
  declare const ENTITY_LIST_ADD_DIALOG_COMPONENT: InjectionToken<Type<unknown>>;
998
+ /**
999
+ * Inputs the Local row dialog receives via `ModalService` `inputValues`.
1000
+ *
1001
+ * A Local list (`storageMode: "Local"`) has no source form to load: its rows
1002
+ * belong to the parent record, and the source module only lent its field
1003
+ * definitions, which the published schema captured. So the dialog is built
1004
+ * from `fields` — never from `process-form-load` of the source module, which
1005
+ * may not even be mapped to this level.
1006
+ */
1007
+ interface EntityListLocalRowDialogInputs {
1008
+ /** Visible schema fields, in order, each with its captured definition. */
1009
+ fields: EntityListLocalSchemaField[];
1010
+ /** Host form's lookup catalog, for `Lookup` / `LookupMultiSelect` fields. */
1011
+ lookups?: unknown[];
1012
+ /**
1013
+ * The loaded cells of the row being edited, by field id. Each is mapped the
1014
+ * way a top-level form maps a loaded value (a `User` from its rendered
1015
+ * object, a `Checkbox` from its stored text …).
1016
+ */
1017
+ initialCells?: Record<string, EntityListLocalCell>;
1018
+ /** Control values from this session, by field id; win over `initialCells`. */
1019
+ initialValues?: Record<string, unknown>;
1020
+ isEdit?: boolean;
1021
+ }
1022
+ /**
1023
+ * Close payload of the Local row dialog, keyed by field id. Same three maps as
1024
+ * the linked dialog: `values` refills the form, `display` renders option
1025
+ * labels, and `submit` is each value reduced to the scalar the backend
1026
+ * stores — the field only serializes it.
1027
+ */
1028
+ interface EntityListLocalRowDialogResult {
1029
+ values: Record<string, unknown>;
1030
+ display: Record<string, unknown>;
1031
+ submit: Record<string, unknown>;
1032
+ }
1033
+ /**
1034
+ * Local counterpart of `ENTITY_LIST_ADD_DIALOG_COMPONENT`, registered by the
1035
+ * same `provideEntityListAddForm()`. Without it a Local list is read-only.
1036
+ */
1037
+ declare const ENTITY_LIST_LOCAL_ROW_DIALOG_COMPONENT: InjectionToken<Type<unknown>>;
788
1038
 
789
1039
  /**
790
1040
  * Lets `mt-entity-list-preview` render a module-backed `EntityList` as the
@@ -998,5 +1248,5 @@ declare class LookupModuleCheckListField implements ControlValueAccessor, OnInit
998
1248
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<LookupModuleCheckListField, "mt-lookup-module-check-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "lookupOptions": { "alias": "lookupOptions"; "required": false; "isSignal": true; }; "lookups": { "alias": "lookups"; "required": false; "isSignal": true; }; "propertyFields": { "alias": "propertyFields"; "required": false; "isSignal": true; }; "scopeId": { "alias": "scopeId"; "required": false; "isSignal": true; }; "propertyKeys": { "alias": "propertyKeys"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
999
1249
  }
1000
1250
 
1001
- export { ENTITY_LIST_ADD_DIALOG_COMPONENT, EntityListField, LOOKUP_CHECK_LIST_FORM_COMPONENT, LookupMatrixField, LookupModuleCheckListField, ScheduleItemSelectorField, SchedulePredecessorField, SchemaConnectionField, provideEntityListTablePreview };
1002
- export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, EntityListAddDialogInputs, LookupCheckListFormInputs, SchemaConnectionConfig, SourceLevelState };
1251
+ export { ENTITY_LIST_ADD_DIALOG_COMPONENT, ENTITY_LIST_LOCAL_ROW_DIALOG_COMPONENT, EntityListField, LOOKUP_CHECK_LIST_FORM_COMPONENT, LookupMatrixField, LookupModuleCheckListField, ScheduleItemSelectorField, SchedulePredecessorField, SchemaConnectionField, provideEntityListTablePreview };
1252
+ export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, EntityListAddDialogInputs, EntityListLocalRowDialogInputs, EntityListLocalRowDialogResult, LookupCheckListFormInputs, SchemaConnectionConfig, SourceLevelState };
@@ -513,6 +513,130 @@ interface EntityListEntityValue {
513
513
  entityIds?: number[];
514
514
  rows?: EntityListRowValue[];
515
515
  }
516
+ /** A `{ en, ar }` pair, as the backend's `Translatable` serializes. */
517
+ interface EntityListTranslatable {
518
+ en?: string | null;
519
+ ar?: string | null;
520
+ }
521
+ /**
522
+ * The source property definition a Local list captured when its schema was
523
+ * published (`PropertyDefinitionReadDto`). Server-owned and response-only: the
524
+ * backend never trusts one sent back, and pins it so saved values stay
525
+ * readable after the source field or module changes or is deleted.
526
+ */
527
+ interface EntityListLocalFieldDefinition {
528
+ key: string;
529
+ name?: string | null;
530
+ nameEn?: string | null;
531
+ nameAr?: string | null;
532
+ viewType: string;
533
+ isRequired?: boolean;
534
+ isTranslatable?: boolean;
535
+ configuration?: Record<string, unknown> | string | null;
536
+ }
537
+ /** A field's share of a row, as the form builder sizes it: ¼, ½ or full. */
538
+ type EntityListLocalFieldWidth = '25' | '50' | '100';
539
+ /**
540
+ * One field of a Local list's schema. `id` is the stable local identity cells
541
+ * are keyed by — a UUID, not the source property id. `label` is an optional
542
+ * local override of the source label, and `required` is local to the list.
543
+ */
544
+ interface EntityListLocalSchemaField {
545
+ id?: string;
546
+ sourceKey: string;
547
+ label?: EntityListTranslatable | null;
548
+ required?: boolean;
549
+ hidden?: boolean;
550
+ order?: number;
551
+ /**
552
+ * The field's size in the row dialog. Sent by the configuration screen but
553
+ * **not yet stored by the backend** (`LocalEntityListField` has no such
554
+ * member), so it is absent from what comes back and the dialog falls back
555
+ * to its default until the backend adds it.
556
+ */
557
+ width?: EntityListLocalFieldWidth | null;
558
+ definition?: EntityListLocalFieldDefinition | null;
559
+ }
560
+ /**
561
+ * A published Local schema. `version` is a UUID that changes whenever the
562
+ * field set does; every mutation names the version it was built against.
563
+ */
564
+ interface EntityListLocalSchema {
565
+ lineageId?: string;
566
+ version?: string;
567
+ fields: EntityListLocalSchemaField[];
568
+ }
569
+ /** One cell of a Local row. `value` is the rendered counterpart, read-only. */
570
+ interface EntityListLocalCell {
571
+ fieldId: string;
572
+ rawValue: string | null;
573
+ value?: unknown;
574
+ }
575
+ /** One Local row. `rowId` is a client-generated UUID, not a record id. */
576
+ interface EntityListLocalRow {
577
+ rowId: string;
578
+ order: number;
579
+ version: number;
580
+ cells: EntityListLocalCell[];
581
+ }
582
+ /**
583
+ * A Local `EntityList` value (`storageMode: "Local"`): rows owned by the parent
584
+ * record, stored inside it rather than as records of the source module.
585
+ *
586
+ * Arrives from `process-form-load` as the *projected* document — current
587
+ * versions, rendered cells, and `schema` with hidden fields already removed —
588
+ * and leaves as a *mutation* carrying only what changed, a fresh `mutationId`,
589
+ * and no `schema`. See `.github/instructions/properties/EntityList.md`.
590
+ */
591
+ interface EntityListLocalDocument {
592
+ storageMode: 'Local';
593
+ formatVersion: number;
594
+ schemaVersion: string;
595
+ version: number;
596
+ mutationId?: string;
597
+ localRows: EntityListLocalRow[];
598
+ deletedRowIds?: string[];
599
+ /** Response-only: the schema the rows were projected against. */
600
+ schema?: EntityListLocalSchema | null;
601
+ }
602
+ /** Whether a stored or rendered `EntityList` value is a Local document. */
603
+ declare function isEntityListLocalDocument(value: unknown): value is EntityListLocalDocument;
604
+ /** One source value of a selected record: stored scalar plus rendered value. */
605
+ interface EntityListSelectionRecordValue {
606
+ propertyKey: string;
607
+ rawValue?: string | null;
608
+ value?: unknown;
609
+ }
610
+ /** A selected source record, with the configured read fields' values. */
611
+ interface EntityListSelectionRecord {
612
+ entityId: number;
613
+ values: EntityListSelectionRecordValue[];
614
+ }
615
+ /**
616
+ * A Selected `EntityList` value (`recordMode: "Selected"`): the source records
617
+ * the user picked, by id. Selecting never creates, edits or deletes a source
618
+ * record.
619
+ *
620
+ * Arrives from `process-form-load` as the projected document — `records`
621
+ * rendered for display, `unavailableIds` for chosen records the user can no
622
+ * longer see — and leaves as a *mutation* carrying only `recordMode`,
623
+ * `version`, `mutationId` and the full replacement `entityIds`. See
624
+ * `.github/instructions/properties/EntityList.md`.
625
+ */
626
+ interface EntityListSelectionDocument {
627
+ recordMode: 'Selected';
628
+ version: number;
629
+ mutationId?: string;
630
+ entityIds: number[];
631
+ /** Response-only: the selected records, rendered for display. */
632
+ records?: EntityListSelectionRecord[];
633
+ /** Response-only: server-captured values; never replayed as a write. */
634
+ snapshot?: unknown;
635
+ /** Response-only: chosen ids whose record is deleted or no longer visible. */
636
+ unavailableIds?: number[];
637
+ }
638
+ /** Whether a stored or rendered `EntityList` value is a Selected document. */
639
+ declare function isEntityListSelectionDocument(value: unknown): value is EntityListSelectionDocument;
516
640
  /**
517
641
  * One field definition of an inline `EntityList`, from its property
518
642
  * configuration's `inlineFields`. This is the only description of the nested
@@ -1125,7 +1249,7 @@ declare function humanizeEntityListKey(key: string): string;
1125
1249
  * `allowed` narrows to those keys, in that order; empty renders every field
1126
1250
  * that survives the companion and identifier rules.
1127
1251
  */
1128
- declare function buildEntityListRows(data: EntityData, allowed?: readonly string[]): EntityListRenderedRow[];
1252
+ declare function buildEntityListRows(data: EntityData, allowed?: readonly string[], lang?: string): EntityListRenderedRow[];
1129
1253
  /**
1130
1254
  * Plain-text summary of the rows, for the trigger's tooltip. Caps the list so
1131
1255
  * a forty-item checklist does not become a forty-line tooltip.
@@ -1135,6 +1259,39 @@ declare function summarizeEntityListRows(rows: readonly EntityListRenderedRow[],
1135
1259
  remaining: number;
1136
1260
  };
1137
1261
 
1262
+ /**
1263
+ * Pure helpers shared by everything that reads a Local `EntityList`
1264
+ * (`storageMode: "Local"`) — the runtime field that edits it and the preview
1265
+ * that only renders it. See `.github/instructions/properties/EntityList.md`.
1266
+ */
1267
+ /**
1268
+ * The schema's fields a row is rendered with, in order.
1269
+ *
1270
+ * A removed field stays in the stored schema as `hidden` so its values survive
1271
+ * and come back if it is re-added. The projected schema of a loaded value has
1272
+ * already dropped them, but the configuration's copy — what a create form falls
1273
+ * back to — has not.
1274
+ */
1275
+ declare function visibleLocalSchemaFields(schema: EntityListLocalSchema | null | undefined): EntityListLocalSchemaField[];
1276
+ /**
1277
+ * The label a field renders under: its local override, then the source label
1278
+ * captured when it was published, then its key. The publisher writes an
1279
+ * override into the captured definition as well, so either path shows it.
1280
+ */
1281
+ declare function resolveLocalFieldLabel(field: EntityListLocalSchemaField, lang?: string): string;
1282
+ /** The source view type the field captured; `Text` when none was. */
1283
+ declare function resolveLocalFieldViewType(field: EntityListLocalSchemaField): string;
1284
+ /**
1285
+ * The captured source configuration (lookup id, percentage colour rules …).
1286
+ * `PropertyDefinitionReadDto.configuration` is typed `object?`, so the backend
1287
+ * writes whatever the source held — an object, or its JSON text.
1288
+ */
1289
+ declare function resolveLocalFieldConfiguration(field: EntityListLocalSchemaField): Record<string, unknown> | null;
1290
+ /** A row's cells keyed by field id. */
1291
+ declare function localCellsByFieldId(row: EntityListLocalRow): Map<string, EntityListLocalCell>;
1292
+ /** Rows in their stored order. */
1293
+ declare function sortLocalRows(rows: readonly EntityListLocalRow[] | null | undefined): EntityListLocalRow[];
1294
+
1138
1295
  /** What `NgComponentOutlet` needs to render the inline table. */
1139
1296
  interface EntityListTableHost {
1140
1297
  component: Type<unknown>;
@@ -1271,6 +1428,8 @@ declare class EntityListDrawer {
1271
1428
  readonly data: _angular_core.InputSignal<EntityData>;
1272
1429
  /** Ordered allowlist of nested field keys; empty renders all of them. */
1273
1430
  readonly fields: _angular_core.InputSignal<string[]>;
1431
+ /** A Local list's labels are `{ en, ar }` pairs; see `sharedActiveLang`. */
1432
+ private readonly activeLang;
1274
1433
  readonly rows: _angular_core.Signal<EntityListRenderedRow[]>;
1275
1434
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListDrawer, never>;
1276
1435
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityListDrawer, "mt-entity-list-drawer", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
@@ -1827,5 +1986,5 @@ declare class FitText {
1827
1986
 
1828
1987
  declare function sharedActiveLang(transloco: TranslocoService): Signal<string>;
1829
1988
 
1830
- 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, 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 };
1831
- export type { ComparisonValueSide, ConnectionCatalogConfiguration, ConnectionLevelSavedConfig, ConnectionSourceLevelConfig, EntityAttachmentItemValue, EntityAttachmentValue, EntityBaseConfig, EntityClickEvent, EntityComparisonField, EntityComparisonOperation, EntityConfiguration, EntityConnectionConfig, EntityConnectionSourceValue, EntityConnectionValue, EntityData, EntityLabelPosition, EntityLeafDetailsConfig, EntityListComparison, EntityListComparisonRow, EntityListEntityValue, EntityListInlineFieldMeta, EntityListRenderedRow, EntityListRowValue, EntityListValueItem, EntityLocationValue, EntityLookupCheckListItem, EntityLookupCheckListPropValue, EntityLookupCheckListValue, EntityLookupValue, EntityMultiLookupValue, EntityMultiUserValue, EntityNestedPropertyMeta, EntityPercentageConfig, EntityPhaseGateValue, EntityPropertyConfiguration, EntityResizeEvent, EntityRuntimeContext, EntityScheduleItemValue, EntitySectionConfig, EntitySectionGroup, EntitySectionLabel, EntitySize, EntityStatusValue, EntityTranslatableTextValue, EntityUserConfig, EntityUserValue, EntityViewType, LeafDetailsBadgeKind, LeafDetailsCatalogConfiguration, LeafDetailsCatalogLevelValue, LeafDetailsCatalogPhaseValue, LeafDetailsCatalogStatusValue, LeafDetailsEntityCollectionValue, LeafDetailsEntityValue, LeafDetailsPhaseSummary, LeafDetailsRuntimeChildSchema, LeafDetailsRuntimePhaseCount, LeafDetailsRuntimePhaseDetails, LeafDetailsRuntimeStatusCount, LeafDetailsRuntimeStatusDetails, LeafDetailsRuntimeValue, LeafDetailsStatusSummary, LeafLevelSavedConfig, LeafPhaseSavedConfig, PercentageColorMode, PercentageColorPropertyRef, PercentageColorRule, PercentageColorSource, PropertyValueComparison, ValueComparison };
1989
+ 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, isEntityListSelectionDocument, 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 };
1990
+ export type { ComparisonValueSide, ConnectionCatalogConfiguration, ConnectionLevelSavedConfig, ConnectionSourceLevelConfig, EntityAttachmentItemValue, EntityAttachmentValue, EntityBaseConfig, EntityClickEvent, EntityComparisonField, EntityComparisonOperation, EntityConfiguration, EntityConnectionConfig, EntityConnectionSourceValue, EntityConnectionValue, EntityData, EntityLabelPosition, EntityLeafDetailsConfig, EntityListComparison, EntityListComparisonRow, EntityListEntityValue, EntityListInlineFieldMeta, EntityListLocalCell, EntityListLocalDocument, EntityListLocalFieldDefinition, EntityListLocalFieldWidth, EntityListLocalRow, EntityListLocalSchema, EntityListLocalSchemaField, EntityListRenderedRow, EntityListRowValue, EntityListSelectionDocument, EntityListSelectionRecord, EntityListSelectionRecordValue, EntityListTranslatable, EntityListValueItem, EntityLocationValue, EntityLookupCheckListItem, EntityLookupCheckListPropValue, EntityLookupCheckListValue, EntityLookupValue, EntityMultiLookupValue, EntityMultiUserValue, EntityNestedPropertyMeta, EntityPercentageConfig, EntityPhaseGateValue, EntityPropertyConfiguration, EntityResizeEvent, EntityRuntimeContext, EntityScheduleItemValue, EntitySectionConfig, EntitySectionGroup, EntitySectionLabel, EntitySize, EntityStatusValue, EntityTranslatableTextValue, EntityUserConfig, EntityUserValue, EntityViewType, LeafDetailsBadgeKind, LeafDetailsCatalogConfiguration, LeafDetailsCatalogLevelValue, LeafDetailsCatalogPhaseValue, LeafDetailsCatalogStatusValue, LeafDetailsEntityCollectionValue, LeafDetailsEntityValue, LeafDetailsPhaseSummary, LeafDetailsRuntimeChildSchema, LeafDetailsRuntimePhaseCount, LeafDetailsRuntimePhaseDetails, LeafDetailsRuntimeStatusCount, LeafDetailsRuntimeStatusDetails, LeafDetailsRuntimeValue, LeafDetailsStatusSummary, LeafLevelSavedConfig, LeafPhaseSavedConfig, PercentageColorMode, PercentageColorPropertyRef, PercentageColorRule, PercentageColorSource, PropertyValueComparison, ValueComparison };
@@ -729,10 +729,21 @@ interface EntityListFieldRuntimeContext {
729
729
  /** Current level id (used to build the fetch/query contextKey). */
730
730
  levelId?: number | string | null;
731
731
  levelDataId?: number | string | null;
732
+ /**
733
+ * Module schema id of the form that owns the property — the `Module:{id}`
734
+ * segment of the options `contextKey` a Selected list's picker sends. Absent
735
+ * on a level's own form, whose context is `Level:{levelId}`.
736
+ */
737
+ moduleId?: number | string | null;
732
738
  }
733
739
  declare class EntityListFieldConfig extends BaseFieldConfig {
734
740
  /** EntityList property id (used in the read endpoint route). */
735
741
  propertyId: number | null;
742
+ /**
743
+ * EntityList property key — the `forms/options/{propertyKey}` route a
744
+ * Selected list's picker loads its candidates from.
745
+ */
746
+ propertyKey: string;
736
747
  /** Property configuration (sourceType, moduleId, access, snapshotMode, fields). */
737
748
  configuration: any;
738
749
  /** Runtime ids needed to call the read endpoint. */
@@ -752,6 +763,7 @@ declare class EntityListFieldConfig extends BaseFieldConfig {
752
763
  pendingSubmission: boolean;
753
764
  constructor(config: Omit<BaseFieldConstructorConfig, 'type'> & {
754
765
  propertyId?: number | null;
766
+ propertyKey?: string;
755
767
  configuration?: any;
756
768
  runtimeContext?: EntityListFieldRuntimeContext | null;
757
769
  lookups?: unknown[];