@masterteam/client-components 0.0.89 → 0.0.90

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/client-components",
3
- "version": "0.0.89",
3
+ "version": "0.0.90",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/client-components",
6
6
  "linkDirectory": true,
@@ -16,10 +16,10 @@
16
16
  "rxjs": "^7.8.2",
17
17
  "tailwindcss": "^4.2.2",
18
18
  "tailwindcss-primeui": "^0.6.1",
19
- "@masterteam/components": "^0.0.281",
20
- "@masterteam/icons": "^0.0.17",
21
- "@masterteam/dashboard-builder": "^0.0.86",
22
- "@masterteam/forms": "^0.0.146"
19
+ "@masterteam/components": "^0.0.283",
20
+ "@masterteam/dashboard-builder": "^0.0.88",
21
+ "@masterteam/forms": "^0.0.147",
22
+ "@masterteam/icons": "^0.0.17"
23
23
  },
24
24
  "dependencies": {
25
25
  "tslib": "^2.8.1"
@@ -24,6 +24,13 @@ interface Response<T> {
24
24
  type ClientListRuntimeContext = string;
25
25
  type ClientListFetchStateKey = 'escalation';
26
26
  declare const CLIENT_LIST_RECORD_STATE_KEY = "__clientListRecordState";
27
+ /**
28
+ * Row key carrying the owning record of a hierarchy row. Sits beside the row's
29
+ * cells rather than in a column so it travels with the row through
30
+ * `transformResult`, row actions and click handlers without ever rendering.
31
+ * Read it with {@link readClientListRowSource}.
32
+ */
33
+ declare const CLIENT_LIST_RECORD_SOURCE_KEY = "__clientListRecordSource";
27
34
  /** Record state every list request asks for. */
28
35
  declare const CLIENT_LIST_DEFAULT_INCLUDE_STATE: readonly ClientListFetchStateKey[];
29
36
  /**
@@ -67,7 +74,23 @@ interface ClientListBaseConfiguration {
67
74
  }
68
75
  interface ClientListRuntimeRecordActionsContext {
69
76
  listKey: string;
77
+ /**
78
+ * The context this row's actions belong to: the owning record's context for
79
+ * a hierarchy row, the list's own context otherwise. In a hierarchy table
80
+ * the list context is only the aggregation scope and addressing a row
81
+ * action to it would target the wrong record.
82
+ */
70
83
  contextKey: string | null;
84
+ /**
85
+ * The list's own configured context, unchanged. Only differs from
86
+ * `contextKey` on a hierarchy row.
87
+ */
88
+ listContextKey: string | null;
89
+ /**
90
+ * The record that owns this row, or null outside a hierarchy table. Its
91
+ * `levelDataId` is the instance a row action applies to.
92
+ */
93
+ source: ClientListFetchRecordSource | null;
71
94
  instanceId: number | null;
72
95
  moduleId: number;
73
96
  row: RuntimeTableDisplayRow;
@@ -153,6 +176,18 @@ interface ClientListFormConfiguration extends ClientListBaseConfiguration {
153
176
  instanceId?: number;
154
177
  /** Complete filter array forwarded unchanged to `fetch/query`. */
155
178
  filters?: ClientListFetchRequestFilter[];
179
+ /**
180
+ * `areaType: 'table'` only — fetch the rows owned by this root's
181
+ * descendants instead of the rows owned by the context's own records. See
182
+ * {@link ClientListFetchHierarchyScope}. Ignored for cards and informative
183
+ * lists, which the backend rejects outright.
184
+ *
185
+ * Rows then arrive from several owners at once: each carries its owning
186
+ * record under {@link CLIENT_LIST_RECORD_SOURCE_KEY}, row actions are
187
+ * addressed to that owner's context, and `state.totals` / `state.sourceGroups`
188
+ * carry the pre-pagination aggregates.
189
+ */
190
+ hierarchy?: ClientListFetchHierarchyScope;
156
191
  mode?: ClientListMode;
157
192
  columnKeys?: string[];
158
193
  /**
@@ -231,6 +266,31 @@ interface ClientListFetchRequestFilter {
231
266
  interface ClientListFetchRequestDisplay {
232
267
  areas: string[];
233
268
  }
269
+ /**
270
+ * Descendant scope for a `Table` request: instead of the rows owned by the
271
+ * context's own records, fetch the rows owned by a root record's descendants,
272
+ * combined across every child level the user may read.
273
+ *
274
+ * Backend constraints, all of them hard errors rather than silent fallbacks:
275
+ * `Table` projection only, in a `level:<id>/module:<id>` context backed by
276
+ * ModuleData, and never combined with tree/selector/process-context requests.
277
+ * The root is only reachable when `rootId` belongs to the level in
278
+ * `contextKey`.
279
+ *
280
+ * Do not also send a `levelDataId` filter naming the root — that filter still
281
+ * means "owned by this record" and would strip the descendants back out.
282
+ */
283
+ interface ClientListFetchHierarchyScope {
284
+ /** Level-data record id of the root, not a module record id. */
285
+ rootId: number;
286
+ /**
287
+ * `-1` (default) every descendant, `1` direct children only, `0` none.
288
+ * Other negative values are rejected by the backend.
289
+ */
290
+ depth?: number;
291
+ /** Also include rows owned by the root itself. Defaults to `false`. */
292
+ includeRoot?: boolean;
293
+ }
234
294
  interface ClientListFetchQueryRequest {
235
295
  contextKey: string;
236
296
  projection: ClientListFetchProjection;
@@ -241,6 +301,7 @@ interface ClientListFetchQueryRequest {
241
301
  pageSize?: number;
242
302
  surfaceKey?: string;
243
303
  display?: ClientListFetchRequestDisplay;
304
+ hierarchy?: ClientListFetchHierarchyScope;
244
305
  }
245
306
  /**
246
307
  * The query settings a list renders with, in the shape `process-submit` takes
@@ -322,9 +383,15 @@ interface ClientListFetchRecordState {
322
383
  interface ClientListFetchRecord {
323
384
  id: number;
324
385
  name?: string;
386
+ /**
387
+ * In a hierarchy response this is the *module* schema for every row, not the
388
+ * owning level — read `source.levelId` for that.
389
+ */
325
390
  schemaId?: number;
326
391
  values: Record<string, ClientListFetchValueCell>;
327
392
  state?: ClientListFetchRecordState | null;
393
+ /** Hierarchy responses only: the record that owns this row. */
394
+ source?: ClientListFetchRecordSource | null;
328
395
  }
329
396
  interface ClientListFetchSchema {
330
397
  id: number;
@@ -340,6 +407,64 @@ interface ClientListFetchCatalog {
340
407
  * keyed by the owning property key (e.g. a `LookupModuleCheckList`).
341
408
  */
342
409
  nestedProperties?: Record<string, ClientListFetchPropertyMeta[]>;
410
+ /**
411
+ * Hierarchy responses only: one catalog per owning child context, keyed by
412
+ * `record.source.contextKey`. Each carries that level's own property ids,
413
+ * configurations and overrides — which is what an edit of that row has to
414
+ * be built from. The top-level `properties` describe the shared columns and
415
+ * are normalized across levels, so they cannot stand in for these.
416
+ *
417
+ * Note every entry's `schemaId` is the *module* schema, the same for all of
418
+ * them; the owning level is `record.source.levelId`, never this.
419
+ */
420
+ byContext?: Record<string, ClientListFetchCatalog>;
421
+ }
422
+ /**
423
+ * The record that actually owns a row in a hierarchy response. The list's own
424
+ * context is only the aggregation scope, so this — not the list config — is
425
+ * what a row action, an edit, or a navigation has to be addressed to.
426
+ */
427
+ interface ClientListFetchRecordSource {
428
+ levelDataId: number;
429
+ levelId: number;
430
+ name: string;
431
+ levelName: string;
432
+ contextKey: string;
433
+ }
434
+ /**
435
+ * One aggregate over every matching row before pagination — not just the
436
+ * current page.
437
+ */
438
+ interface ClientListFetchSum {
439
+ propertyKey: string;
440
+ /** Backend decimal sum of the numeric raw values. */
441
+ value: number;
442
+ /** How many rows contributed, valid zeroes included. */
443
+ valueCount: number;
444
+ /**
445
+ * Rows whose value was missing or non-numeric. Greater than zero means the
446
+ * total is incomplete and must be presented as such — see
447
+ * {@link isClientListTotalIncomplete}.
448
+ */
449
+ missingValueCount: number;
450
+ }
451
+ /**
452
+ * Rows grouped by their owning record. Groups are per *actual* owner at any
453
+ * depth: a grandchild's rows appear once under the grandchild, never repeated
454
+ * under the levels in between.
455
+ */
456
+ interface ClientListFetchSourceGroup {
457
+ source: ClientListFetchRecordSource;
458
+ /**
459
+ * Only this group's row ids **on the current page** — may be empty while
460
+ * `totalCount` and `totals` are non-zero, because an owner's rows can span
461
+ * pages.
462
+ */
463
+ recordIds: number[];
464
+ /** Every matching row for this owner, across all pages. */
465
+ totalCount: number;
466
+ /** Subtotals over all of this owner's matching rows, across all pages. */
467
+ totals: ClientListFetchSum[];
343
468
  }
344
469
  interface ClientListFetchTableColumn {
345
470
  key: string;
@@ -365,6 +490,17 @@ interface ClientListFetchProjectionMeta {
365
490
  columns?: ClientListFetchTableColumn[];
366
491
  displayOrder?: ClientListFetchCardDisplayOrderItem[];
367
492
  groups?: ClientListFetchCardGroup[];
493
+ /** Hierarchy responses only: per-owner groups, subtotals and page row ids. */
494
+ sourceGroups?: ClientListFetchSourceGroup[];
495
+ /**
496
+ * Hierarchy responses only: totals over every matching row before
497
+ * pagination. The backend fills this from the module's configured summary
498
+ * keys, which today means a single `amount` entry on the financial module
499
+ * and an **empty array everywhere else** — so this being present says
500
+ * nothing about which keys are in it. Always look an entry up by key with
501
+ * {@link findClientListTotal}; never read `totals[0]`.
502
+ */
503
+ totals?: ClientListFetchSum[];
368
504
  }
369
505
  interface ClientListFetchQueryResponse {
370
506
  contextKey: string;
@@ -460,6 +596,17 @@ interface ClientListBaseState {
460
596
  expanded: boolean;
461
597
  dashboardData: DashboardBuilderData | null;
462
598
  rawData: unknown | null;
599
+ /**
600
+ * Hierarchy tables only: totals over every matching row before pagination,
601
+ * so they stay put as the user pages. Undefined for an ordinary list — the
602
+ * backend sends none, and a page sum would not be the same number.
603
+ */
604
+ totals?: ClientListFetchSum[];
605
+ /**
606
+ * Hierarchy tables only: one entry per owning record, with its full matching
607
+ * count and subtotals plus the ids of its rows on the current page.
608
+ */
609
+ sourceGroups?: ClientListFetchSourceGroup[];
463
610
  }
464
611
  interface ClientListTableState extends ClientListBaseState {
465
612
  type: 'form';
@@ -485,6 +632,8 @@ interface NormalizedClientListConfiguration {
485
632
  contextKey: ClientListRuntimeContext | null;
486
633
  instanceId: number | null;
487
634
  filters: ClientListFetchRequestFilter[];
635
+ /** Null unless the host asked for descendant scope on a table. */
636
+ hierarchy: ClientListFetchHierarchyScope | null;
488
637
  levelId: number | null;
489
638
  moduleId: number;
490
639
  type: ClientListType;
@@ -556,8 +705,9 @@ declare class ClientListStateService {
556
705
  upsertRecord(key: string, record: ClientListFetchRecord, config: NormalizedClientListConfiguration): boolean;
557
706
  /**
558
707
  * Drops a record the backend has deleted, without re-fetching. Returns
559
- * `false` when the record is not in the loaded set, so the caller can decide
560
- * whether a reload is warranted.
708
+ * `false` when the record is not in the loaded set — or when the list is a
709
+ * hierarchy table, whose server-summed totals a local removal would
710
+ * invalidate — so the caller can decide whether a reload is warranted.
561
711
  */
562
712
  removeRecord(key: string, recordId: number, config: NormalizedClientListConfiguration): boolean;
563
713
  private upsertRowRecord;
@@ -756,6 +906,14 @@ declare class ClientList implements OnDestroy {
756
906
  private resolveAreaType;
757
907
  private resolveType;
758
908
  private resolveMode;
909
+ /**
910
+ * Descendant scope only survives where the backend accepts it: a table, with
911
+ * a usable root id. Anywhere else it is dropped rather than sent, because
912
+ * the backend answers an unsupported combination with a 400 that takes the
913
+ * whole list down — a cards area that happens to share a config object would
914
+ * otherwise render nothing at all.
915
+ */
916
+ private resolveHierarchyScope;
759
917
  private toNormalizedConfig;
760
918
  private createItemKey;
761
919
  private resolveLayout;
@@ -777,11 +935,43 @@ declare class ClientList implements OnDestroy {
777
935
  private asInformativeConfig;
778
936
  private asFormConfig;
779
937
  private serializeFilters;
938
+ private serializeHierarchy;
780
939
  private resolveFetchFilters;
781
940
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientList, never>;
782
941
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClientList, "mt-client-list", never, { "configurations": { "alias": "configurations"; "required": true; "isSignal": true; }; "defaultTake": { "alias": "defaultTake"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "errored": "errored"; "itemClicked": "itemClicked"; }, never, never, true, never>;
783
942
  }
784
943
 
944
+ /**
945
+ * Reads the owning record off a hierarchy row. Returns null for a row from an
946
+ * ordinary list, which has no owner other than the list's own context.
947
+ *
948
+ * Use this before addressing anything at a row — an edit, a navigation, a
949
+ * permission check. The list's configured `contextKey` is the aggregation
950
+ * scope in a hierarchy table, not the row's home.
951
+ */
952
+ declare function readClientListRowSource(row: RuntimeTableDisplayRow | null | undefined): ClientListFetchRecordSource | null;
953
+ /**
954
+ * Looks a total up by property key.
955
+ *
956
+ * Always go through this rather than indexing `totals`. The backend fills the
957
+ * array from the module's configured summary keys — one `amount` entry on the
958
+ * financial module, nothing at all on every other module — so the array being
959
+ * present does not mean the key you want is in it, and position means nothing.
960
+ */
961
+ declare function findClientListTotal(totals: readonly ClientListFetchSum[] | null | undefined, propertyKey: string): ClientListFetchSum | null;
962
+ /**
963
+ * Whether a total left rows out — some row's value was missing or not a
964
+ * number, so the sum is over fewer rows than the table reports.
965
+ *
966
+ * A total in this state must be presented as incomplete. Rendering it as a
967
+ * plain figure states a portfolio total the data does not support.
968
+ */
969
+ declare function isClientListTotalIncomplete(total: ClientListFetchSum | null | undefined): boolean;
970
+ /**
971
+ * The subtotal group for one owning record, by its level-data id.
972
+ */
973
+ declare function findClientListSourceGroup(groups: readonly ClientListFetchSourceGroup[] | null | undefined, levelDataId: number): ClientListFetchSourceGroup | null;
974
+
785
975
  declare class ClientListApiService {
786
976
  private readonly http;
787
977
  private readonly runtimeFetchBaseUrl;
@@ -791,12 +981,18 @@ declare class ClientListApiService {
791
981
  * the request carried, because a write that wants its record projected the
792
982
  * same way has to repeat them and cannot recover them from the response.
793
983
  */
794
- getRows(contextKey: ClientListRuntimeContext, query: ClientListTableQuery, filters?: ClientListFetchRequestFilter[]): Observable<ClientListRowsFetchResult>;
984
+ getRows(contextKey: ClientListRuntimeContext, query: ClientListTableQuery, filters?: ClientListFetchRequestFilter[], hierarchy?: ClientListFetchHierarchyScope | null): Observable<ClientListRowsFetchResult>;
795
985
  /**
796
986
  * Reads a single record back with the list's own query settings — the path
797
987
  * taken when a write reports `recordProjectionStatus: 'Unavailable'`. The
798
988
  * write itself already succeeded; this only reads, and must never be served
799
989
  * by re-submitting.
990
+ *
991
+ * `contextKey` is the context that *owns* the record, which in a hierarchy
992
+ * table is the row's `source.contextKey` rather than the list's own. The
993
+ * read deliberately carries no `hierarchy` scope: the row is filtered by its
994
+ * own id in its own context, which is both cheaper and immune to the record
995
+ * having moved out of the root's subtree since it was written.
800
996
  */
801
997
  getRecord(contextKey: ClientListRuntimeContext, request: ClientListReturnRecordRequest, filters: ClientListFetchRequestFilter[]): Observable<Response<ClientListFetchQueryResponse>>;
802
998
  getCards(contextKey: ClientListRuntimeContext, filters?: ClientListFetchRequestFilter[], skip?: number, take?: number): Observable<Response<ClientListCardsPayload>>;
@@ -804,6 +1000,14 @@ declare class ClientListApiService {
804
1000
  private queryRuntime;
805
1001
  private resolveTablePropertyKeys;
806
1002
  private toPage;
1003
+ /**
1004
+ * Sends the scope with both optional fields resolved rather than omitted.
1005
+ * The backend's defaults match these, but `depth` is range-checked against
1006
+ * `>= -1` and anything else fails the whole request — so a host that means
1007
+ * "everything" gets `-1` written down instead of relying on an absent field
1008
+ * surviving serialization.
1009
+ */
1010
+ private toHierarchyScope;
807
1011
  private toEffectiveColumnKeys;
808
1012
  private readTableSettingsContext;
809
1013
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientListApiService, never>;
@@ -873,5 +1077,5 @@ declare class ClientListToolbarService {
873
1077
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<ClientListToolbarService>;
874
1078
  }
875
1079
 
876
- export { CLIENT_LIST_DEFAULT_INCLUDE_STATE, CLIENT_LIST_RECORD_ID_FILTER_KEY, CLIENT_LIST_RECORD_STATE_KEY, ClientList, ClientListApiService, ClientListRuntimeActionsService, ClientListStateService, ClientListToolbarService, defaultResolveRecordId };
877
- export type { ClientListAreaType, ClientListBaseConfiguration, ClientListBaseState, ClientListCard, ClientListCardModule, ClientListCardProperty, ClientListCardsPayload, ClientListCardsState, ClientListClickableItem, ClientListCollapseConfig, ClientListConfiguration, ClientListContentTemplateContext, ClientListDataLoadedHandler, ClientListFetchCardDisplayOrderItem, ClientListFetchCardGroup, ClientListFetchCatalog, ClientListFetchProjection, ClientListFetchProjectionMeta, ClientListFetchPropertyMeta, ClientListFetchQueryRequest, ClientListFetchQueryResponse, ClientListFetchRecord, ClientListFetchRecordState, ClientListFetchRequestDisplay, ClientListFetchRequestFilter, ClientListFetchSchema, ClientListFetchStateKey, ClientListFetchTableColumn, ClientListFetchValueCell, ClientListFormConfiguration, ClientListInformativeChartLink, ClientListInformativeConfiguration, ClientListInformativeDashboardPayload, ClientListInformativeState, ClientListItemClickedEvent, ClientListLayoutConfig, ClientListLazyLoadEvent, ClientListMode, ClientListRecordEscalationState, ClientListRecordProjectionStatus, ClientListRecordWriteResult, ClientListReturnRecordRequest, ClientListRowsFetchResult, ClientListRuntimeContext, ClientListRuntimeRecordActionsConfig, ClientListRuntimeRecordActionsContext, ClientListState, ClientListTableDisplayConfig, ClientListTablePersistStateKey, ClientListTableQuery, ClientListTableSettingsCatalogResponse, ClientListTableSettingsColumn, ClientListTableState, ClientListTableTransform, ClientListTableTransformResult, ClientListToolbarBucket, ClientListType, NormalizedClientListConfiguration, NormalizedClientListTableDisplayConfig, Response, RuntimeEntityColumnDef, RuntimeTableDisplayRow, RuntimeTableRowsResponse };
1080
+ export { CLIENT_LIST_DEFAULT_INCLUDE_STATE, CLIENT_LIST_RECORD_ID_FILTER_KEY, CLIENT_LIST_RECORD_SOURCE_KEY, CLIENT_LIST_RECORD_STATE_KEY, ClientList, ClientListApiService, ClientListRuntimeActionsService, ClientListStateService, ClientListToolbarService, defaultResolveRecordId, findClientListSourceGroup, findClientListTotal, isClientListTotalIncomplete, readClientListRowSource };
1081
+ export type { ClientListAreaType, ClientListBaseConfiguration, ClientListBaseState, ClientListCard, ClientListCardModule, ClientListCardProperty, ClientListCardsPayload, ClientListCardsState, ClientListClickableItem, ClientListCollapseConfig, ClientListConfiguration, ClientListContentTemplateContext, ClientListDataLoadedHandler, ClientListFetchCardDisplayOrderItem, ClientListFetchCardGroup, ClientListFetchCatalog, ClientListFetchHierarchyScope, ClientListFetchProjection, ClientListFetchProjectionMeta, ClientListFetchPropertyMeta, ClientListFetchQueryRequest, ClientListFetchQueryResponse, ClientListFetchRecord, ClientListFetchRecordSource, ClientListFetchRecordState, ClientListFetchRequestDisplay, ClientListFetchRequestFilter, ClientListFetchSchema, ClientListFetchSourceGroup, ClientListFetchStateKey, ClientListFetchSum, ClientListFetchTableColumn, ClientListFetchValueCell, ClientListFormConfiguration, ClientListInformativeChartLink, ClientListInformativeConfiguration, ClientListInformativeDashboardPayload, ClientListInformativeState, ClientListItemClickedEvent, ClientListLayoutConfig, ClientListLazyLoadEvent, ClientListMode, ClientListRecordEscalationState, ClientListRecordProjectionStatus, ClientListRecordWriteResult, ClientListReturnRecordRequest, ClientListRowsFetchResult, ClientListRuntimeContext, ClientListRuntimeRecordActionsConfig, ClientListRuntimeRecordActionsContext, ClientListState, ClientListTableDisplayConfig, ClientListTablePersistStateKey, ClientListTableQuery, ClientListTableSettingsCatalogResponse, ClientListTableSettingsColumn, ClientListTableState, ClientListTableTransform, ClientListTableTransformResult, ClientListToolbarBucket, ClientListType, NormalizedClientListConfiguration, NormalizedClientListTableDisplayConfig, Response, RuntimeEntityColumnDef, RuntimeTableDisplayRow, RuntimeTableRowsResponse };