@masterteam/components 0.0.303 → 0.0.304

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.303",
3
+ "version": "0.0.304",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -375,6 +375,17 @@ interface EntityListStoredValue {
375
375
  deletedIds?: number[];
376
376
  snapshot?: unknown;
377
377
  rows?: EntityListSubmitRow[];
378
+ /**
379
+ * The versioned Related protocol: the parent-owned list version the value
380
+ * was loaded at, one UUID per intended change, and an opaque server token
381
+ * per existing target the change edits or deletes. The form load sends
382
+ * `version` and `expectedVersions`, with `mutationId` empty.
383
+ */
384
+ version?: number;
385
+ mutationId?: string;
386
+ expectedVersions?: Record<string, string>;
387
+ /** Response-only current rows of the targets; never submitted. */
388
+ live?: unknown;
378
389
  }
379
390
  declare class EntityListField implements ControlValueAccessor {
380
391
  readonly label: _angular_core.InputSignal<string>;
@@ -487,6 +498,13 @@ declare class EntityListField implements ControlValueAccessor {
487
498
  * value keys.
488
499
  */
489
500
  protected readonly writeFields: _angular_core.Signal<string[]>;
501
+ /**
502
+ * Write fields a new row must fill: the target's required, non-calculated
503
+ * properties. The backend rejects a create row without any of them
504
+ * (`entity_list.required_field_missing`), while the target module's form —
505
+ * which the add dialog renders — may mark fewer required.
506
+ */
507
+ private readonly createRequiredFields;
490
508
  /**
491
509
  * Pending create/update rows, in the exact shape persisted by the backend
492
510
  * (`rows[]` of the stored EntityList JSON). Rows with `entityId > 0` are
@@ -677,8 +695,9 @@ declare class EntityListField implements ControlValueAccessor {
677
695
  *
678
696
  * A saved record renders from the backend's `records`, cell by cell against
679
697
  * 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
698
+ * picked in this session renders the display values its option carried
699
+ * (`metadataJson`) the same way; an older backend sends none, and the row
700
+ * then shows its name and "Shown after saving". A record in `unavailableIds` was
682
701
  * deleted or is no longer visible: the backend keeps it selected but
683
702
  * withholds its values, and the row says so, so the user can remove it.
684
703
  */
@@ -884,6 +903,17 @@ declare class EntityListField implements ControlValueAccessor {
884
903
  */
885
904
  private toLocalEntityValue;
886
905
  private emitValue;
906
+ /**
907
+ * The id of the change a Related list's value carries. The backend rejects
908
+ * a Related change without one (`entity_list.invalid_payload`), and the form
909
+ * load sends it empty — so a value with rows or deletions gets its own: the
910
+ * same while the change is (a retry of the same save), a new one when it
911
+ * differs, since reusing an id for other content is refused
912
+ * (`entity_list.linked_mutation_reused`). A value with nothing to apply keeps
913
+ * what it loaded with; the backend skips it.
914
+ */
915
+ private linkedMutation;
916
+ private linkedMutationId;
887
917
  /**
888
918
  * `values[]` entries, restricted to `writeFields` when configured.
889
919
  *
@@ -38,6 +38,56 @@ interface EntityListComparison {
38
38
  }
39
39
  type PropertyValueComparison = ValueComparison | EntityListComparison;
40
40
 
41
+ /**
42
+ * The runtime ids an entity renderer needs to fetch anything of its own.
43
+ *
44
+ * A rendered `EntityData` describes one *value*; it carries no idea of which
45
+ * level or level-data row it was read from. Most view types never need one —
46
+ * the value is the whole answer. `EntityList` is the exception: a module-backed
47
+ * list's rows live in another module and are scoped by the owning level-data
48
+ * row, so the renderer cannot resolve them from the value alone.
49
+ *
50
+ * Hosts that know these ids publish them through `EntityRuntimeContextStore`;
51
+ * hosts that do not simply leave it unprovided and every renderer keeps its
52
+ * value-only behaviour.
53
+ */
54
+ interface EntityRuntimeContext {
55
+ /** Owning level id — addresses the per-level configuration override. */
56
+ levelId?: number | string | null;
57
+ /** Owning level-data row — what related records are scoped to. */
58
+ levelDataId?: number | string | null;
59
+ }
60
+ /**
61
+ * Publishes an `EntityRuntimeContext` to a subtree of entity renderers.
62
+ *
63
+ * Deliberately **not** `providedIn: 'root'`: an unprovided store is the signal
64
+ * that the host has no runtime context, and every consumer injects it
65
+ * `{ optional: true }`. Providing it on a component scopes it to that
66
+ * component's view — which is also how a nested renderer shuts the context
67
+ * off for its own children (see `EntityListField`, whose table cells must not
68
+ * re-enter the fetching path).
69
+ */
70
+ declare class EntityRuntimeContextStore {
71
+ readonly context: _angular_core.WritableSignal<EntityRuntimeContext | null>;
72
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityRuntimeContextStore, never>;
73
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<EntityRuntimeContextStore>;
74
+ }
75
+ /**
76
+ * The component `mt-entity-list-preview` renders inline instead of its
77
+ * count-and-drawer trigger, when a runtime context is available.
78
+ *
79
+ * Indirection rather than a direct import because the real renderer is
80
+ * `mt-entity-list-field` (`@masterteam/components/business-fields`), which
81
+ * builds on `mt-table` — and `table` already imports `entities`, so importing
82
+ * it back here would make the two entry points circular. The provider lives
83
+ * with the component: `provideEntityListTablePreview()`.
84
+ *
85
+ * The component is created with `NgComponentOutlet` and receives
86
+ * `propertyId`, `runtimeContext`, `configuration`, `initialValue`, `readonly`
87
+ * and `label` as inputs.
88
+ */
89
+ declare const ENTITY_LIST_TABLE_COMPONENT: InjectionToken<Type<unknown>>;
90
+
41
91
  type EntityViewType = 'Text' | 'LongText' | 'Date' | 'DateTime'
42
92
  /**
43
93
  * Time-of-day. The value on the wire is still a full ISO instant (the
@@ -701,6 +751,12 @@ interface EntityData {
701
751
  configuration?: EntityConfiguration;
702
752
  /** Present on submitted ChangeRequest records — frozen old→new snapshot. */
703
753
  comparison?: PropertyValueComparison;
754
+ /**
755
+ * The record's runtime ids, set by a host that renders the value outside
756
+ * any `EntityRuntimeContextStore` — a table cell. `EntityList` reads it to
757
+ * render its full list in the drawer, as a record preview does inline.
758
+ */
759
+ runtimeContext?: EntityRuntimeContext | null;
704
760
  }
705
761
  /** Emitted when an entity is resized via the drag handle */
706
762
  interface EntityResizeEvent {
@@ -782,56 +838,6 @@ declare function resolveEntityLabelPosition(configuration?: EntityConfiguration
782
838
  */
783
839
  declare function normalizeNumerals(input: string): string;
784
840
 
785
- /**
786
- * The runtime ids an entity renderer needs to fetch anything of its own.
787
- *
788
- * A rendered `EntityData` describes one *value*; it carries no idea of which
789
- * level or level-data row it was read from. Most view types never need one —
790
- * the value is the whole answer. `EntityList` is the exception: a module-backed
791
- * list's rows live in another module and are scoped by the owning level-data
792
- * row, so the renderer cannot resolve them from the value alone.
793
- *
794
- * Hosts that know these ids publish them through `EntityRuntimeContextStore`;
795
- * hosts that do not simply leave it unprovided and every renderer keeps its
796
- * value-only behaviour.
797
- */
798
- interface EntityRuntimeContext {
799
- /** Owning level id — addresses the per-level configuration override. */
800
- levelId?: number | string | null;
801
- /** Owning level-data row — what related records are scoped to. */
802
- levelDataId?: number | string | null;
803
- }
804
- /**
805
- * Publishes an `EntityRuntimeContext` to a subtree of entity renderers.
806
- *
807
- * Deliberately **not** `providedIn: 'root'`: an unprovided store is the signal
808
- * that the host has no runtime context, and every consumer injects it
809
- * `{ optional: true }`. Providing it on a component scopes it to that
810
- * component's view — which is also how a nested renderer shuts the context
811
- * off for its own children (see `EntityListField`, whose table cells must not
812
- * re-enter the fetching path).
813
- */
814
- declare class EntityRuntimeContextStore {
815
- readonly context: _angular_core.WritableSignal<EntityRuntimeContext | null>;
816
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityRuntimeContextStore, never>;
817
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<EntityRuntimeContextStore>;
818
- }
819
- /**
820
- * The component `mt-entity-list-preview` renders inline instead of its
821
- * count-and-drawer trigger, when a runtime context is available.
822
- *
823
- * Indirection rather than a direct import because the real renderer is
824
- * `mt-entity-list-field` (`@masterteam/components/business-fields`), which
825
- * builds on `mt-table` — and `table` already imports `entities`, so importing
826
- * it back here would make the two entry points circular. The provider lives
827
- * with the component: `provideEntityListTablePreview()`.
828
- *
829
- * The component is created with `NgComponentOutlet` and receives
830
- * `propertyId`, `runtimeContext`, `configuration`, `initialValue`, `readonly`
831
- * and `label` as inputs.
832
- */
833
- declare const ENTITY_LIST_TABLE_COMPONENT: InjectionToken<Type<unknown>>;
834
-
835
841
  type EntityFieldGap = 'compact' | 'normal' | 'relaxed';
836
842
  declare class EntityField {
837
843
  readonly label: _angular_core.InputSignal<string>;
@@ -1292,11 +1298,47 @@ declare function localCellsByFieldId(row: EntityListLocalRow): Map<string, Entit
1292
1298
  /** Rows in their stored order. */
1293
1299
  declare function sortLocalRows(rows: readonly EntityListLocalRow[] | null | undefined): EntityListLocalRow[];
1294
1300
 
1295
- /** What `NgComponentOutlet` needs to render the inline table. */
1301
+ /**
1302
+ * What `NgComponentOutlet` needs to render an `EntityList` table: the
1303
+ * read-only `mt-entity-list-field` (`ENTITY_LIST_TABLE_COMPONENT`) and its
1304
+ * inputs.
1305
+ */
1296
1306
  interface EntityListTableHost {
1297
1307
  component: Type<unknown>;
1298
1308
  inputs: Record<string, unknown>;
1299
1309
  }
1310
+ /**
1311
+ * The full nested `EntityList`, rendered in a drawer opened by
1312
+ * `mt-entity-list-preview`.
1313
+ *
1314
+ * It lives in a drawer rather than in the cell because the cell is a table
1315
+ * column: even three lines per row set the height of every row in the table,
1316
+ * and a checklist of fifteen made the grid unreadable. The drawer has the
1317
+ * width and height this content actually needs.
1318
+ *
1319
+ * With a `table` it renders the list the way a record preview does — the
1320
+ * read-only `mt-entity-list-field`, with its columns, typed cells and access
1321
+ * notices — for a table cell whose host knew the record's runtime ids.
1322
+ * Otherwise it renders the rows the value itself carries.
1323
+ *
1324
+ * Created through `ModalService`, so its inputs arrive via `inputValues` and
1325
+ * it is built with the **root** injector — nothing route-provided is visible
1326
+ * here, which is why it takes the already-resolved entity and table rather
1327
+ * than looking anything up.
1328
+ */
1329
+ declare class EntityListDrawer {
1330
+ readonly data: _angular_core.InputSignal<EntityData>;
1331
+ /** Ordered allowlist of nested field keys; empty renders all of them. */
1332
+ readonly fields: _angular_core.InputSignal<string[]>;
1333
+ /** The list's table, when the opener could build one; see above. */
1334
+ readonly table: _angular_core.InputSignal<EntityListTableHost | null>;
1335
+ /** A Local list's labels are `{ en, ar }` pairs; see `sharedActiveLang`. */
1336
+ private readonly activeLang;
1337
+ readonly rows: _angular_core.Signal<EntityListRenderedRow[]>;
1338
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListDrawer, never>;
1339
+ 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; }; "table": { "alias": "table"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1340
+ }
1341
+
1300
1342
  /**
1301
1343
  * Read-only renderer for an `EntityList` value. It has two shapes, and which
1302
1344
  * one applies is decided by what the host gave it — never by the value.
@@ -1380,6 +1422,29 @@ declare class EntityListPreview {
1380
1422
  * pass would re-write every input on every tick.
1381
1423
  */
1382
1424
  protected readonly tableHost: _angular_core.Signal<EntityListTableHost | null>;
1425
+ /**
1426
+ * The same table, for the drawer of a table cell. A cell publishes no
1427
+ * runtime context — an inline table would set the height of every row — but
1428
+ * a host that knows the record's ids puts them on the value
1429
+ * (`EntityData.runtimeContext`), and the drawer then shows the list exactly
1430
+ * as a record preview does, instead of the value-only rows.
1431
+ */
1432
+ private readonly drawerTable;
1433
+ private buildTableHost;
1434
+ /**
1435
+ * Whether the value itself holds the list's rows — a Local or Selected
1436
+ * document. A Related list's value is membership and evidence only; its
1437
+ * rows are read by the table, so its cell does not claim a count.
1438
+ */
1439
+ private readonly valueHoldsRows;
1440
+ /** The trigger shows when there are rows to count, or a table to open. */
1441
+ protected readonly showTrigger: _angular_core.Signal<boolean>;
1442
+ /**
1443
+ * The trigger's label: the row count when the value holds the rows, else
1444
+ * "View" — a Related list's saved membership is not what its table shows,
1445
+ * so it is not presented as a count.
1446
+ */
1447
+ protected readonly triggerLabel: _angular_core.Signal<string>;
1383
1448
  /**
1384
1449
  * An empty list reads as the standard empty value, not as a sentence — this
1385
1450
  * sits in a table cell, where a "no related items" line would be louder than
@@ -1410,31 +1475,6 @@ declare class EntityListPreview {
1410
1475
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityListPreview, "mt-entity-list-preview", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1411
1476
  }
1412
1477
 
1413
- /**
1414
- * The full nested `EntityList`, rendered in a drawer opened by
1415
- * `mt-entity-list-preview`.
1416
- *
1417
- * It lives in a drawer rather than in the cell because the cell is a table
1418
- * column: even three lines per row set the height of every row in the table,
1419
- * and a checklist of fifteen made the grid unreadable. The drawer has the
1420
- * width and height this content actually needs.
1421
- *
1422
- * Created through `ModalService`, so its inputs arrive via `inputValues` and
1423
- * it is built with the **root** injector — nothing route-provided is visible
1424
- * here, which is why it takes the already-resolved entity rather than looking
1425
- * anything up.
1426
- */
1427
- declare class EntityListDrawer {
1428
- readonly data: _angular_core.InputSignal<EntityData>;
1429
- /** Ordered allowlist of nested field keys; empty renders all of them. */
1430
- readonly fields: _angular_core.InputSignal<string[]>;
1431
- /** A Local list's labels are `{ en, ar }` pairs; see `sharedActiveLang`. */
1432
- private readonly activeLang;
1433
- readonly rows: _angular_core.Signal<EntityListRenderedRow[]>;
1434
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListDrawer, never>;
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>;
1436
- }
1437
-
1438
1478
  interface RenderedItem {
1439
1479
  lookupKey: string;
1440
1480
  /** Humanized lookup key for display. */
@@ -1987,4 +2027,4 @@ declare class FitText {
1987
2027
  declare function sharedActiveLang(transloco: TranslocoService): Signal<string>;
1988
2028
 
1989
2029
  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 };
2030
+ 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, EntityListTableHost, 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 };