@masterteam/client-components 0.0.4 → 0.0.6

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