@masterteam/components 0.0.302 → 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.302",
3
+ "version": "0.0.303",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -386,6 +386,11 @@ declare class EntityListField implements ControlValueAccessor {
386
386
  * effective configuration.
387
387
  */
388
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>;
389
394
  /**
390
395
  * Stored property configuration (sourceType, moduleId, access, readFields …).
391
396
  *
@@ -639,6 +644,73 @@ declare class EntityListField implements ControlValueAccessor {
639
644
  * `allowCreate`; a loaded row follows `allowEdit` / `allowDelete`.
640
645
  */
641
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;
642
714
  /** Enough context to ask the backend what this field should render. */
643
715
  protected readonly hasRequiredContext: _angular_core.Signal<boolean>;
644
716
  /**
@@ -680,9 +752,10 @@ declare class EntityListField implements ControlValueAccessor {
680
752
  * - A value some instance of this field emitted restores that instance's
681
753
  * state — see `LOCAL_EDITOR_STATES`.
682
754
  * - A document the backend sent starts a fresh session on it: the projection
683
- * `process-form-load` returns (its `schema` set, cells rendered), or the
684
- * stored document the fetch endpoints return for a preview (`schema:
685
- * null`, cells unrendered) — the schema then comes from the metadata.
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.
686
759
  * Every backend document carries the `schema` member, null or not; a
687
760
  * mutation never does. So a mutation nobody here emitted has no rows to
688
761
  * rebuild the table from and is left as the control's value, untouched
@@ -769,9 +842,9 @@ declare class EntityListField implements ControlValueAccessor {
769
842
  private buildLocalDraftCell;
770
843
  /**
771
844
  * A loaded cell: the backend's rendered `value` beside its `rawValue`. A
772
- * stored document from the fetch endpoints has no rendered values, so the
773
- * raw one is shaped the way a locally set cell would be — a user id still
774
- * renders as a user, though only as its id until the backend renders it.
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.
775
848
  */
776
849
  private buildLocalLoadedCell;
777
850
  /**
@@ -894,7 +967,7 @@ declare class EntityListField implements ControlValueAccessor {
894
967
  private applyRecords;
895
968
  private toEntityData;
896
969
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListField, never>;
897
- 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>;
898
971
  }
899
972
 
900
973
  /** Inputs the EntityList add-row dialog will receive via ModalService inputValues. */
@@ -601,6 +601,42 @@ interface EntityListLocalDocument {
601
601
  }
602
602
  /** Whether a stored or rendered `EntityList` value is a Local document. */
603
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;
604
640
  /**
605
641
  * One field definition of an inline `EntityList`, from its property
606
642
  * configuration's `inlineFields`. This is the only description of the nested
@@ -1950,5 +1986,5 @@ declare class FitText {
1950
1986
 
1951
1987
  declare function sharedActiveLang(transloco: TranslocoService): Signal<string>;
1952
1988
 
1953
- 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, 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 };
1954
- 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, 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 };
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[];