@masterteam/client-components 0.0.4 → 0.0.5

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.
@@ -1,9 +1,13 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { TemplateRef, OnDestroy } from '@angular/core';
3
+ import { DashboardBuilderData } from '@masterteam/dashboard-builder';
4
+ import { EntityData, EntityConfiguration } from '@masterteam/components/entities';
3
5
  import { ColumnDef } from '@masterteam/components/table';
4
6
  import { Observable } from 'rxjs';
5
7
 
6
8
  type ClientListMode = 'auto' | 'override';
9
+ type ClientListAreaType = 'table' | 'cards';
10
+ type ClientListType = 'form' | 'informative';
7
11
  interface Response<T> {
8
12
  endpoint: string;
9
13
  status: number;
@@ -20,6 +24,8 @@ interface ClientListConfiguration {
20
24
  levelDataId?: number;
21
25
  moduleId?: number;
22
26
  title?: string;
27
+ type?: ClientListType;
28
+ areaType?: ClientListAreaType;
23
29
  mode?: ClientListMode;
24
30
  columnKeys?: string[];
25
31
  isPaginated?: boolean;
@@ -42,7 +48,7 @@ interface ClientListLayoutConfig {
42
48
  tableSpan?: number;
43
49
  endSpan?: number;
44
50
  }
45
- interface ClientListQuery {
51
+ interface ClientListTableQuery {
46
52
  mode: ClientListMode;
47
53
  columnKeys?: string[];
48
54
  skip: number;
@@ -50,14 +56,33 @@ interface ClientListQuery {
50
56
  }
51
57
  interface RuntimeTableColumn {
52
58
  columnKey: string;
53
- sourceType: number;
59
+ sourceType: string;
54
60
  order: number;
55
61
  isVisible: boolean;
56
- configuration?: Record<string, unknown>;
62
+ id?: number;
63
+ propertyId?: number;
64
+ key?: string;
65
+ normalizedKey?: string;
66
+ name?: string;
67
+ viewType?: string;
68
+ configuration?: string;
69
+ type?: string;
57
70
  }
58
- interface RuntimeTableRow {
59
- entityId: number;
60
- values: Record<string, unknown>;
71
+ /** Raw row as returned by the API, flat object keyed by column keys */
72
+ type RuntimeTableApiRow = Record<string, unknown>;
73
+ /** A single cell value enriched with its column metadata */
74
+ interface RuntimeTableCell extends RuntimeTableColumn {
75
+ value: unknown;
76
+ }
77
+ /** Display row: Id stays plain, every other key holds a RuntimeTableCell */
78
+ type RuntimeTableDisplayRow = Record<string, unknown | RuntimeTableCell>;
79
+ /** Column definition extended with full runtime column metadata and forced entity type */
80
+ interface RuntimeEntityColumnDef extends ColumnDef, Omit<RuntimeTableColumn, 'type'> {
81
+ key: string;
82
+ label: string;
83
+ /** Original API column type (e.g. CustomProperty) preserved as runtimeType */
84
+ runtimeType?: RuntimeTableColumn['type'];
85
+ type: 'entity';
61
86
  }
62
87
  interface RuntimeTablePagination {
63
88
  skip: number;
@@ -71,27 +96,109 @@ interface RuntimeTableRowsResponse {
71
96
  moduleKey: string;
72
97
  surfaceKey: string;
73
98
  columns: RuntimeTableColumn[];
74
- rows: RuntimeTableRow[];
99
+ rows: RuntimeTableApiRow[];
75
100
  pagination: RuntimeTablePagination;
76
101
  }
77
- interface ClientListTableState {
102
+ interface ClientListCardModule {
103
+ id: number;
104
+ key?: string;
105
+ name: string;
106
+ order?: number;
107
+ typeGroup?: string;
108
+ }
109
+ interface ClientListCardProperty {
110
+ id?: number;
111
+ propertyId?: number;
112
+ key: string;
113
+ normalizedKey: string;
114
+ name: string;
115
+ rawValue?: string;
116
+ value: EntityData['value'];
117
+ viewType: EntityData['viewType'];
118
+ configuration?: Record<string, unknown>;
119
+ type?: string;
120
+ [key: string]: unknown;
121
+ }
122
+ interface ClientListCard {
123
+ id: number;
124
+ name: string;
125
+ module?: ClientListCardModule;
126
+ levelDataId?: number;
127
+ properties: ClientListCardProperty[];
128
+ displayProperties?: Record<string, unknown>;
129
+ entities: EntityData[];
130
+ }
131
+ interface ClientListCardDisplayProperty {
132
+ propertyKey: string;
133
+ areaKey: string;
134
+ order: number;
135
+ configuration: EntityConfiguration;
136
+ }
137
+ interface ClientListCardDisplayConfiguration {
138
+ contextKey: string;
139
+ moduleId?: number;
140
+ levelId?: number;
141
+ properties: ClientListCardDisplayProperty[];
142
+ }
143
+ interface ClientListCardsDetailsBlock {
144
+ module?: ClientListCardModule;
145
+ data: Omit<ClientListCard, 'entities'>[];
146
+ }
147
+ interface ClientListCardsPayload {
148
+ details?: ClientListCardsDetailsBlock[];
149
+ displayConfigurations?: ClientListCardDisplayConfiguration[];
150
+ }
151
+ interface ClientListInformativeChartLink {
152
+ id?: number;
153
+ chartComponentId?: string;
154
+ configuration?: Record<string, any>;
155
+ order?: number;
156
+ }
157
+ interface ClientListInformativeDashboardPayload {
158
+ moduleId: number;
159
+ ignoreQueryFilter: boolean;
160
+ filters: Record<string, any>;
161
+ extraInfo: Record<string, any>;
162
+ versionNumber: number;
163
+ chartLinks: ClientListInformativeChartLink[];
164
+ }
165
+ interface ClientListBaseState {
78
166
  key: string;
79
167
  config: NormalizedClientListConfiguration;
168
+ type: ClientListType;
169
+ areaType: ClientListAreaType;
80
170
  loading: boolean;
81
171
  error: string | null;
82
172
  title: string;
83
173
  moduleKey: string;
84
- columns: ColumnDef[];
85
- rows: RuntimeTableRow[];
174
+ totalCount: number;
175
+ columns: RuntimeEntityColumnDef[];
176
+ rows: RuntimeTableDisplayRow[];
177
+ cards: ClientListCard[];
86
178
  skip: number;
87
179
  take: number;
88
- totalCount: number;
89
180
  expanded: boolean;
181
+ dashboardData: DashboardBuilderData | null;
182
+ }
183
+ interface ClientListTableState extends ClientListBaseState {
184
+ type: 'form';
185
+ areaType: 'table';
186
+ }
187
+ interface ClientListCardsState extends ClientListBaseState {
188
+ type: 'form';
189
+ areaType: 'cards';
190
+ }
191
+ interface ClientListInformativeState extends ClientListBaseState {
192
+ type: 'informative';
193
+ areaType: 'table';
90
194
  }
195
+ type ClientListState = ClientListTableState | ClientListCardsState | ClientListInformativeState;
91
196
  interface NormalizedClientListConfiguration {
92
197
  levelId: number;
93
198
  levelDataId: number;
94
199
  moduleId: number;
200
+ type: ClientListType;
201
+ areaType: ClientListAreaType;
95
202
  mode: ClientListMode;
96
203
  isPaginated: boolean;
97
204
  take: number;
@@ -105,8 +212,8 @@ interface NormalizedClientListConfiguration {
105
212
  contentEnd?: TemplateRef<ClientListContentTemplateContext>;
106
213
  }
107
214
  interface ClientListContentTemplateContext {
108
- $implicit: ClientListTableState;
109
- table: ClientListTableState;
215
+ $implicit: ClientListState;
216
+ table: ClientListState;
110
217
  }
111
218
  interface ClientListLazyLoadEvent {
112
219
  pageSize?: number;
@@ -115,14 +222,30 @@ interface ClientListLazyLoadEvent {
115
222
  }
116
223
 
117
224
  declare class ClientListStateService {
118
- readonly tablesByKey: _angular_core.WritableSignal<Record<string, ClientListTableState>>;
119
- readonly tables: _angular_core.Signal<ClientListTableState[]>;
120
- setConfigs(configs: ClientListTableState[]): void;
225
+ readonly itemsByKey: _angular_core.WritableSignal<Record<string, ClientListState>>;
226
+ readonly items: _angular_core.Signal<ClientListState[]>;
227
+ setConfigs(configs: ClientListState[]): void;
121
228
  setLoading(key: string, loading: boolean): void;
122
229
  setError(key: string, message: string | null): void;
123
230
  setRowsResult(key: string, response: RuntimeTableRowsResponse, config: NormalizedClientListConfiguration, skip: number, take: number): void;
231
+ setCardsResult(key: string, response: ClientListCardsPayload, config: NormalizedClientListConfiguration): void;
232
+ setInformativeResult(key: string, response: ClientListInformativeDashboardPayload | null, config: NormalizedClientListConfiguration): void;
124
233
  toggleExpanded(key: string): void;
234
+ private mergeItemState;
235
+ private getVisibleColumns;
125
236
  private toColumnDefs;
237
+ /**
238
+ * Enriches each flat API row so that every cell value becomes a
239
+ * RuntimeTableCell carrying both the original value and the full
240
+ * column metadata. The `Id` key is preserved as-is.
241
+ */
242
+ private toDisplayRows;
243
+ private toCell;
244
+ private toCards;
245
+ private toDashboardData;
246
+ private buildDisplayConfigurationLookup;
247
+ private mapEntities;
248
+ private getPropertyConfiguration;
126
249
  private toLabel;
127
250
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientListStateService, never>;
128
251
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<ClientListStateService>;
@@ -138,40 +261,51 @@ declare class ClientList implements OnDestroy {
138
261
  key: string;
139
262
  message: string;
140
263
  }>;
141
- protected readonly tables: _angular_core.Signal<ClientListTableState[]>;
142
- protected readonly gridTemplateColumns = "repeat(12, minmax(0, 1fr))";
264
+ protected readonly items: _angular_core.Signal<ClientListState[]>;
143
265
  private readonly subscriptions;
144
266
  private readonly inFlightRequestSignatures;
145
267
  private readonly fulfilledRequestSignatures;
146
268
  constructor();
147
- onLazyLoad(tableKey: string, event: ClientListLazyLoadEvent): void;
148
- reload(tableKey?: string): void;
149
- reloadByKey(tableKey: string): void;
269
+ onLazyLoad(itemKey: string, event: ClientListLazyLoadEvent): void;
270
+ reload(itemKey?: string): void;
271
+ reloadByKey(itemKey: string): void;
150
272
  toggleExpanded(key: string): void;
151
- slotGridSpan(span: number): string;
152
- templateContext(table: ClientListTableState): ClientListContentTemplateContext;
273
+ templateContext(item: ClientListState): ClientListContentTemplateContext;
274
+ defaultTitle(item: ClientListState): string;
153
275
  ngOnDestroy(): void;
154
- private configureTables;
276
+ private configureItems;
277
+ private loadItem;
155
278
  private loadTable;
279
+ private loadCards;
280
+ private loadInformative;
281
+ private resolveAreaType;
282
+ private resolveType;
156
283
  private resolveMode;
157
284
  private toNormalizedConfig;
158
285
  private resolveLayout;
159
286
  private clampSpan;
160
287
  private cleanupStaleResources;
161
- private toQuery;
162
- private createRequestSignature;
288
+ private toTableQuery;
289
+ private createTableRequestSignature;
290
+ private createCardsRequestSignature;
291
+ private createInformativeRequestSignature;
163
292
  private hasValidIdentifiers;
293
+ private getMissingIdentifiersMessage;
164
294
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientList, never>;
165
295
  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"; }, never, never, true, never>;
166
296
  }
167
297
 
168
298
  declare class ClientListApiService {
169
299
  private readonly http;
170
- private readonly baseUrl;
171
- getRows(levelId: number, levelDataId: number, moduleId: number, query: ClientListQuery): Observable<Response<RuntimeTableRowsResponse>>;
300
+ private readonly tablesBaseUrl;
301
+ private readonly cardsBaseUrl;
302
+ private readonly informativeBaseUrl;
303
+ getRows(levelId: number, levelDataId: number, moduleId: number, query: ClientListTableQuery): Observable<Response<RuntimeTableRowsResponse>>;
304
+ getCards(levelDataId: number, moduleId: number): Observable<Response<ClientListCardsPayload>>;
305
+ getInformativeDashboard(moduleId: number): Observable<Response<ClientListInformativeDashboardPayload>>;
172
306
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientListApiService, never>;
173
307
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<ClientListApiService>;
174
308
  }
175
309
 
176
310
  export { ClientList, ClientListApiService, ClientListStateService };
177
- export type { ClientListCollapseConfig, ClientListConfiguration, ClientListContentTemplateContext, ClientListLayoutConfig, ClientListLazyLoadEvent, ClientListMode, ClientListQuery, ClientListTableState, NormalizedClientListConfiguration, Response, RuntimeTableColumn, RuntimeTablePagination, RuntimeTableRow, RuntimeTableRowsResponse };
311
+ export type { ClientListAreaType, ClientListBaseState, ClientListCard, ClientListCardDisplayConfiguration, ClientListCardDisplayProperty, ClientListCardModule, ClientListCardProperty, ClientListCardsDetailsBlock, ClientListCardsPayload, ClientListCardsState, ClientListCollapseConfig, ClientListConfiguration, ClientListContentTemplateContext, ClientListInformativeChartLink, ClientListInformativeDashboardPayload, ClientListInformativeState, ClientListLayoutConfig, ClientListLazyLoadEvent, ClientListMode, ClientListState, ClientListTableQuery, ClientListTableState, ClientListType, NormalizedClientListConfiguration, Response, RuntimeEntityColumnDef, RuntimeTableApiRow, RuntimeTableCell, RuntimeTableColumn, RuntimeTableDisplayRow, RuntimeTablePagination, RuntimeTableRowsResponse };