@masterteam/client-components 0.0.1
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/fesm2022/masterteam-client-components-client-list.mjs +325 -0
- package/fesm2022/masterteam-client-components-client-list.mjs.map +1 -0
- package/fesm2022/masterteam-client-components.mjs +6 -0
- package/fesm2022/masterteam-client-components.mjs.map +1 -0
- package/package.json +40 -0
- package/types/masterteam-client-components-client-list.d.ts +165 -0
- package/types/masterteam-client-components.d.ts +2 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable, signal, computed, input, output, effect, untracked, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { Card } from '@masterteam/components/card';
|
|
6
|
+
import { Table } from '@masterteam/components/table';
|
|
7
|
+
import { Button } from '@masterteam/components/button';
|
|
8
|
+
import * as i2 from 'primeng/skeleton';
|
|
9
|
+
import { SkeletonModule } from 'primeng/skeleton';
|
|
10
|
+
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
11
|
+
|
|
12
|
+
class ClientListApiService {
|
|
13
|
+
http = inject(HttpClient);
|
|
14
|
+
baseUrl = 'data/tables';
|
|
15
|
+
getRows(levelId, levelDataId, moduleId, query) {
|
|
16
|
+
const endpoint = `${this.baseUrl}/level/${levelId}/level-data/${levelDataId}/module/${moduleId}/rows`;
|
|
17
|
+
let params = new HttpParams()
|
|
18
|
+
.set('mode', query.mode)
|
|
19
|
+
.set('skip', query.skip)
|
|
20
|
+
.set('take', query.take);
|
|
21
|
+
(query.columnKeys ?? []).forEach((columnKey) => {
|
|
22
|
+
params = params.append('columnKeys', columnKey);
|
|
23
|
+
});
|
|
24
|
+
return this.http.get(endpoint, {
|
|
25
|
+
params,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientListApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
29
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientListApiService, providedIn: 'root' });
|
|
30
|
+
}
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientListApiService, decorators: [{
|
|
32
|
+
type: Injectable,
|
|
33
|
+
args: [{ providedIn: 'root' }]
|
|
34
|
+
}] });
|
|
35
|
+
|
|
36
|
+
class ClientListStateService {
|
|
37
|
+
tablesByKey = signal({}, ...(ngDevMode ? [{ debugName: "tablesByKey" }] : []));
|
|
38
|
+
tables = computed(() => Object.values(this.tablesByKey()).sort((a, b) => a.config.moduleId === b.config.moduleId
|
|
39
|
+
? a.config.levelDataId - b.config.levelDataId
|
|
40
|
+
: a.config.moduleId - b.config.moduleId), ...(ngDevMode ? [{ debugName: "tables" }] : []));
|
|
41
|
+
setConfigs(configs) {
|
|
42
|
+
const next = {};
|
|
43
|
+
configs.forEach((table) => {
|
|
44
|
+
const current = this.tablesByKey()[table.key];
|
|
45
|
+
next[table.key] = {
|
|
46
|
+
...table,
|
|
47
|
+
loading: current?.loading ?? false,
|
|
48
|
+
error: current?.error ?? null,
|
|
49
|
+
title: current?.title ?? table.title,
|
|
50
|
+
moduleKey: current?.moduleKey ?? table.moduleKey,
|
|
51
|
+
columns: current?.columns ?? table.columns,
|
|
52
|
+
rows: current?.rows ?? table.rows,
|
|
53
|
+
skip: current?.skip ?? table.skip,
|
|
54
|
+
take: current?.take ?? table.take,
|
|
55
|
+
totalCount: current?.totalCount ?? table.totalCount,
|
|
56
|
+
expanded: current?.expanded ?? table.expanded,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
this.tablesByKey.set(next);
|
|
60
|
+
}
|
|
61
|
+
setLoading(key, loading) {
|
|
62
|
+
const target = this.tablesByKey()[key];
|
|
63
|
+
if (!target)
|
|
64
|
+
return;
|
|
65
|
+
this.tablesByKey.set({
|
|
66
|
+
...this.tablesByKey(),
|
|
67
|
+
[key]: {
|
|
68
|
+
...target,
|
|
69
|
+
loading,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
setError(key, message) {
|
|
74
|
+
const target = this.tablesByKey()[key];
|
|
75
|
+
if (!target)
|
|
76
|
+
return;
|
|
77
|
+
this.tablesByKey.set({
|
|
78
|
+
...this.tablesByKey(),
|
|
79
|
+
[key]: {
|
|
80
|
+
...target,
|
|
81
|
+
error: message,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
setRowsResult(key, response, config, skip, take) {
|
|
86
|
+
const target = this.tablesByKey()[key];
|
|
87
|
+
if (!target)
|
|
88
|
+
return;
|
|
89
|
+
const columns = this.toColumnDefs(response.columns);
|
|
90
|
+
const rows = response.rows ?? [];
|
|
91
|
+
const title = (config.title ?? '').trim() || response.moduleKey;
|
|
92
|
+
const totalCount = config.isPaginated === false
|
|
93
|
+
? rows.length
|
|
94
|
+
: (response.pagination?.totalCount ?? rows.length);
|
|
95
|
+
this.tablesByKey.set({
|
|
96
|
+
...this.tablesByKey(),
|
|
97
|
+
[key]: {
|
|
98
|
+
...target,
|
|
99
|
+
title,
|
|
100
|
+
moduleKey: response.moduleKey ?? '',
|
|
101
|
+
columns,
|
|
102
|
+
rows,
|
|
103
|
+
skip,
|
|
104
|
+
take,
|
|
105
|
+
totalCount,
|
|
106
|
+
error: null,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
toggleExpanded(key) {
|
|
111
|
+
const target = this.tablesByKey()[key];
|
|
112
|
+
if (!target)
|
|
113
|
+
return;
|
|
114
|
+
this.tablesByKey.set({
|
|
115
|
+
...this.tablesByKey(),
|
|
116
|
+
[key]: {
|
|
117
|
+
...target,
|
|
118
|
+
expanded: !target.expanded,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
toColumnDefs(columns) {
|
|
123
|
+
return (columns ?? [])
|
|
124
|
+
.filter((column) => column.isVisible)
|
|
125
|
+
.sort((a, b) => a.order - b.order)
|
|
126
|
+
.map((column) => ({
|
|
127
|
+
key: column.columnKey,
|
|
128
|
+
label: this.toLabel(column.columnKey),
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
toLabel(key) {
|
|
132
|
+
return key
|
|
133
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
134
|
+
.replace(/[_-]+/g, ' ')
|
|
135
|
+
.split(' ')
|
|
136
|
+
.filter(Boolean)
|
|
137
|
+
.map((word) => word[0].toUpperCase() + word.slice(1))
|
|
138
|
+
.join(' ');
|
|
139
|
+
}
|
|
140
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientListStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
141
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientListStateService });
|
|
142
|
+
}
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientListStateService, decorators: [{
|
|
144
|
+
type: Injectable
|
|
145
|
+
}] });
|
|
146
|
+
|
|
147
|
+
const DEFAULT_MODE = 'auto';
|
|
148
|
+
const DEFAULT_SERVER_PAGE_SIZE = 50;
|
|
149
|
+
const LOCAL_PAGE_SIZE_SOURCE = 100000;
|
|
150
|
+
const DEFAULT_COLLAPSE_ICON = 'arrow.chevron-up';
|
|
151
|
+
const DEFAULT_EXPAND_ICON = 'arrow.chevron-down';
|
|
152
|
+
const DEFAULT_SIDE_CONTENT_SPAN = 3;
|
|
153
|
+
const DEFAULT_GRID_COLUMNS = 12;
|
|
154
|
+
class ClientList {
|
|
155
|
+
api = inject(ClientListApiService);
|
|
156
|
+
state = inject(ClientListStateService);
|
|
157
|
+
configurations = input.required(...(ngDevMode ? [{ debugName: "configurations" }] : []));
|
|
158
|
+
defaultTake = input(DEFAULT_SERVER_PAGE_SIZE, ...(ngDevMode ? [{ debugName: "defaultTake" }] : []));
|
|
159
|
+
loaded = output();
|
|
160
|
+
errored = output();
|
|
161
|
+
tables = this.state.tables;
|
|
162
|
+
gridTemplateColumns = `repeat(${DEFAULT_GRID_COLUMNS}, minmax(0, 1fr))`;
|
|
163
|
+
subscriptions = new Map();
|
|
164
|
+
constructor() {
|
|
165
|
+
effect(() => {
|
|
166
|
+
const configs = this.configurations();
|
|
167
|
+
untracked(() => this.configureTables(configs));
|
|
168
|
+
untracked(() => {
|
|
169
|
+
this.state.tables().forEach((table) => {
|
|
170
|
+
this.loadTable(table.key, table.config, table.skip, table.take);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
onLazyLoad(tableKey, event) {
|
|
176
|
+
const table = this.state.tablesByKey()[tableKey];
|
|
177
|
+
if (!table || !table.config.isPaginated)
|
|
178
|
+
return;
|
|
179
|
+
const take = Number(event.pageSize ?? table.take);
|
|
180
|
+
const skip = Number(event.first ?? 0);
|
|
181
|
+
this.loadTable(table.key, table.config, skip, take);
|
|
182
|
+
}
|
|
183
|
+
toggleExpanded(key) {
|
|
184
|
+
this.state.toggleExpanded(key);
|
|
185
|
+
}
|
|
186
|
+
slotGridSpan(span) {
|
|
187
|
+
return `span ${span} / span ${span}`;
|
|
188
|
+
}
|
|
189
|
+
templateContext(table) {
|
|
190
|
+
return {
|
|
191
|
+
$implicit: table,
|
|
192
|
+
table,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
ngOnDestroy() {
|
|
196
|
+
this.subscriptions.forEach((sub) => sub.unsubscribe());
|
|
197
|
+
this.subscriptions.clear();
|
|
198
|
+
}
|
|
199
|
+
configureTables(configs) {
|
|
200
|
+
const normalized = (configs ?? []).map((config, index) => {
|
|
201
|
+
const mode = this.resolveMode(config.mode, config.columnKeys);
|
|
202
|
+
const isPaginated = config.isPaginated ?? true;
|
|
203
|
+
const take = isPaginated
|
|
204
|
+
? (config.take ?? this.defaultTake())
|
|
205
|
+
: LOCAL_PAGE_SIZE_SOURCE;
|
|
206
|
+
const layout = this.resolveLayout(config);
|
|
207
|
+
const key = config.key ??
|
|
208
|
+
`${config.levelId ?? 'x'}-${config.levelDataId ?? 'x'}-${config.moduleId ?? 'x'}-${index}`;
|
|
209
|
+
return {
|
|
210
|
+
key,
|
|
211
|
+
config: this.toNormalizedConfig(config, mode, isPaginated, take, layout),
|
|
212
|
+
loading: false,
|
|
213
|
+
error: null,
|
|
214
|
+
title: config.title?.trim() || '',
|
|
215
|
+
moduleKey: '',
|
|
216
|
+
columns: [],
|
|
217
|
+
rows: [],
|
|
218
|
+
skip: 0,
|
|
219
|
+
take,
|
|
220
|
+
totalCount: 0,
|
|
221
|
+
expanded: config.collapse?.expandedByDefault ?? true,
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
this.state.setConfigs(normalized);
|
|
225
|
+
}
|
|
226
|
+
loadTable(key, config, skip, take) {
|
|
227
|
+
this.subscriptions.get(key)?.unsubscribe();
|
|
228
|
+
this.state.setLoading(key, true);
|
|
229
|
+
this.state.setError(key, null);
|
|
230
|
+
const query = {
|
|
231
|
+
mode: config.mode,
|
|
232
|
+
columnKeys: config.mode === 'override' ? config.columnKeys : undefined,
|
|
233
|
+
skip: config.isPaginated ? skip : 0,
|
|
234
|
+
take: config.isPaginated ? take : LOCAL_PAGE_SIZE_SOURCE,
|
|
235
|
+
};
|
|
236
|
+
const sub = this.api
|
|
237
|
+
.getRows(config.levelId, config.levelDataId, config.moduleId, query)
|
|
238
|
+
.subscribe({
|
|
239
|
+
next: (response) => {
|
|
240
|
+
if (response.data) {
|
|
241
|
+
this.state.setRowsResult(key, response.data, config, query.skip, query.take);
|
|
242
|
+
this.loaded.emit(key);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const message = response.message ?? 'Failed to load table rows';
|
|
246
|
+
this.state.setError(key, message);
|
|
247
|
+
this.errored.emit({ key, message });
|
|
248
|
+
}
|
|
249
|
+
this.state.setLoading(key, false);
|
|
250
|
+
},
|
|
251
|
+
error: (error) => {
|
|
252
|
+
const message = error?.error?.message ?? error?.message ?? 'Failed to load rows';
|
|
253
|
+
this.state.setError(key, message);
|
|
254
|
+
this.state.setLoading(key, false);
|
|
255
|
+
this.errored.emit({ key, message });
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
this.subscriptions.set(key, sub);
|
|
259
|
+
}
|
|
260
|
+
resolveMode(mode, columnKeys) {
|
|
261
|
+
if (mode !== 'override')
|
|
262
|
+
return DEFAULT_MODE;
|
|
263
|
+
return (columnKeys ?? []).length > 0 ? 'override' : DEFAULT_MODE;
|
|
264
|
+
}
|
|
265
|
+
toNormalizedConfig(config, mode, isPaginated, take, layout) {
|
|
266
|
+
return {
|
|
267
|
+
levelId: config.levelId,
|
|
268
|
+
levelDataId: config.levelDataId,
|
|
269
|
+
moduleId: config.moduleId,
|
|
270
|
+
mode,
|
|
271
|
+
isPaginated,
|
|
272
|
+
take,
|
|
273
|
+
title: config.title,
|
|
274
|
+
columnKeys: config.columnKeys ?? [],
|
|
275
|
+
contentStart: config.contentStart,
|
|
276
|
+
contentEnd: config.contentEnd,
|
|
277
|
+
collapse: {
|
|
278
|
+
enabled: config.collapse?.enabled ?? true,
|
|
279
|
+
expandedByDefault: config.collapse?.expandedByDefault ?? true,
|
|
280
|
+
collapseIcon: config.collapse?.collapseIcon ?? DEFAULT_COLLAPSE_ICON,
|
|
281
|
+
expandIcon: config.collapse?.expandIcon ?? DEFAULT_EXPAND_ICON,
|
|
282
|
+
},
|
|
283
|
+
layout,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
resolveLayout(config) {
|
|
287
|
+
const hasStart = !!config.contentStart;
|
|
288
|
+
const hasEnd = !!config.contentEnd;
|
|
289
|
+
const startSpan = hasStart
|
|
290
|
+
? this.clampSpan(config.layout?.startSpan ?? DEFAULT_SIDE_CONTENT_SPAN)
|
|
291
|
+
: 0;
|
|
292
|
+
let endSpan = hasEnd
|
|
293
|
+
? this.clampSpan(config.layout?.endSpan ?? DEFAULT_SIDE_CONTENT_SPAN)
|
|
294
|
+
: 0;
|
|
295
|
+
if (startSpan + endSpan >= DEFAULT_GRID_COLUMNS) {
|
|
296
|
+
endSpan = Math.max(0, DEFAULT_GRID_COLUMNS - startSpan - 1);
|
|
297
|
+
}
|
|
298
|
+
const availableForTable = Math.max(1, DEFAULT_GRID_COLUMNS - startSpan - endSpan);
|
|
299
|
+
const tableSpan = this.clampSpan(config.layout?.tableSpan ?? availableForTable, 1, availableForTable);
|
|
300
|
+
return {
|
|
301
|
+
startSpan,
|
|
302
|
+
tableSpan,
|
|
303
|
+
endSpan,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
clampSpan(value, min = 0, max = DEFAULT_GRID_COLUMNS) {
|
|
307
|
+
const normalized = Number(value ?? min);
|
|
308
|
+
if (!Number.isFinite(normalized))
|
|
309
|
+
return min;
|
|
310
|
+
return Math.min(max, Math.max(min, Math.trunc(normalized)));
|
|
311
|
+
}
|
|
312
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
313
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: ClientList, isStandalone: true, selector: "mt-client-list", inputs: { configurations: { classPropertyName: "configurations", publicName: "configurations", isSignal: true, isRequired: true, transformFunction: null }, defaultTake: { classPropertyName: "defaultTake", publicName: "defaultTake", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loaded: "loaded", errored: "errored" }, providers: [ClientListStateService], ngImport: i0, template: "<div class=\"flex flex-col gap-4\">\n @for (table of tables(); track table.key) {\n <mt-card [title]=\"table.title || table.moduleKey || 'Table'\" class=\"w-full\">\n @if (table.config.collapse.enabled) {\n <ng-template #cardEnd>\n <mt-button\n variant=\"text\"\n severity=\"secondary\"\n size=\"small\"\n [icon]=\"\n table.expanded\n ? table.config.collapse.collapseIcon\n : table.config.collapse.expandIcon\n \"\n (onClick)=\"toggleExpanded(table.key)\"\n />\n </ng-template>\n }\n\n @if (table.expanded) {\n <div\n class=\"grid gap-4\"\n [style.gridTemplateColumns]=\"gridTemplateColumns\"\n >\n @if (table.config.contentStart) {\n <div\n [style.gridColumn]=\"slotGridSpan(table.config.layout.startSpan)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"table.config.contentStart\"\n [ngTemplateOutletContext]=\"templateContext(table)\"\n />\n </div>\n }\n\n <div [style.gridColumn]=\"slotGridSpan(table.config.layout.tableSpan)\">\n @if (table.loading && table.rows.length === 0) {\n <div class=\"flex flex-col gap-3 py-3\">\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n </div>\n } @else if (table.error) {\n <div\n class=\"p-3 rounded-lg bg-red-50 text-red-700 border border-red-200 text-sm\"\n >\n {{ table.error }}\n </div>\n } @else {\n <mt-table\n [data]=\"table.rows\"\n [columns]=\"table.columns\"\n [loading]=\"table.loading\"\n [lazy]=\"table.config.isPaginated\"\n [lazyTotalRecords]=\"table.totalCount\"\n [pageSize]=\"table.config.isPaginated ? table.take : 10\"\n [first]=\"table.config.isPaginated ? table.skip : 0\"\n (lazyLoad)=\"onLazyLoad(table.key, $event)\"\n />\n }\n </div>\n\n @if (table.config.contentEnd) {\n <div [style.gridColumn]=\"slotGridSpan(table.config.layout.endSpan)\">\n <ng-container\n [ngTemplateOutlet]=\"table.config.contentEnd\"\n [ngTemplateOutletContext]=\"templateContext(table)\"\n />\n </div>\n }\n </div>\n }\n </mt-card>\n }\n</div>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "generalSearch", "showFilters", "loading", "updating", "lazy", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "exportable", "exportFilename", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "pageSize", "currentPage", "first", "filterTerm"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }] });
|
|
314
|
+
}
|
|
315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientList, decorators: [{
|
|
316
|
+
type: Component,
|
|
317
|
+
args: [{ selector: 'mt-client-list', standalone: true, imports: [CommonModule, Card, Table, Button, SkeletonModule], providers: [ClientListStateService], template: "<div class=\"flex flex-col gap-4\">\n @for (table of tables(); track table.key) {\n <mt-card [title]=\"table.title || table.moduleKey || 'Table'\" class=\"w-full\">\n @if (table.config.collapse.enabled) {\n <ng-template #cardEnd>\n <mt-button\n variant=\"text\"\n severity=\"secondary\"\n size=\"small\"\n [icon]=\"\n table.expanded\n ? table.config.collapse.collapseIcon\n : table.config.collapse.expandIcon\n \"\n (onClick)=\"toggleExpanded(table.key)\"\n />\n </ng-template>\n }\n\n @if (table.expanded) {\n <div\n class=\"grid gap-4\"\n [style.gridTemplateColumns]=\"gridTemplateColumns\"\n >\n @if (table.config.contentStart) {\n <div\n [style.gridColumn]=\"slotGridSpan(table.config.layout.startSpan)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"table.config.contentStart\"\n [ngTemplateOutletContext]=\"templateContext(table)\"\n />\n </div>\n }\n\n <div [style.gridColumn]=\"slotGridSpan(table.config.layout.tableSpan)\">\n @if (table.loading && table.rows.length === 0) {\n <div class=\"flex flex-col gap-3 py-3\">\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n </div>\n } @else if (table.error) {\n <div\n class=\"p-3 rounded-lg bg-red-50 text-red-700 border border-red-200 text-sm\"\n >\n {{ table.error }}\n </div>\n } @else {\n <mt-table\n [data]=\"table.rows\"\n [columns]=\"table.columns\"\n [loading]=\"table.loading\"\n [lazy]=\"table.config.isPaginated\"\n [lazyTotalRecords]=\"table.totalCount\"\n [pageSize]=\"table.config.isPaginated ? table.take : 10\"\n [first]=\"table.config.isPaginated ? table.skip : 0\"\n (lazyLoad)=\"onLazyLoad(table.key, $event)\"\n />\n }\n </div>\n\n @if (table.config.contentEnd) {\n <div [style.gridColumn]=\"slotGridSpan(table.config.layout.endSpan)\">\n <ng-container\n [ngTemplateOutlet]=\"table.config.contentEnd\"\n [ngTemplateOutletContext]=\"templateContext(table)\"\n />\n </div>\n }\n </div>\n }\n </mt-card>\n }\n</div>\n", styles: [":host{display:block}\n"] }]
|
|
318
|
+
}], ctorParameters: () => [], propDecorators: { configurations: [{ type: i0.Input, args: [{ isSignal: true, alias: "configurations", required: true }] }], defaultTake: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultTake", required: false }] }], loaded: [{ type: i0.Output, args: ["loaded"] }], errored: [{ type: i0.Output, args: ["errored"] }] } });
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Generated bundle index. Do not edit.
|
|
322
|
+
*/
|
|
323
|
+
|
|
324
|
+
export { ClientList, ClientListApiService, ClientListStateService };
|
|
325
|
+
//# sourceMappingURL=masterteam-client-components-client-list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-client-components-client-list.mjs","sources":["../../../../packages/masterteam/client-components/client-list/services/client-list-api.service.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-state.service.ts","../../../../packages/masterteam/client-components/client-list/client-list.ts","../../../../packages/masterteam/client-components/client-list/client-list.html","../../../../packages/masterteam/client-components/client-list/masterteam-client-components-client-list.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { HttpClient, HttpParams } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport {\n ClientListQuery,\n Response,\n RuntimeTableRowsResponse,\n} from '../models/client-list.model';\n\n@Injectable({ providedIn: 'root' })\nexport class ClientListApiService {\n private readonly http = inject(HttpClient);\n private readonly baseUrl = 'data/tables';\n\n getRows(\n levelId: number,\n levelDataId: number,\n moduleId: number,\n query: ClientListQuery,\n ): Observable<Response<RuntimeTableRowsResponse>> {\n const endpoint = `${this.baseUrl}/level/${levelId}/level-data/${levelDataId}/module/${moduleId}/rows`;\n let params = new HttpParams()\n .set('mode', query.mode)\n .set('skip', query.skip)\n .set('take', query.take);\n\n (query.columnKeys ?? []).forEach((columnKey) => {\n params = params.append('columnKeys', columnKey);\n });\n\n return this.http.get<Response<RuntimeTableRowsResponse>>(endpoint, {\n params,\n });\n }\n}\n","import { Injectable, computed, signal } from '@angular/core';\nimport {\n NormalizedClientListConfiguration,\n ClientListTableState,\n RuntimeTableRowsResponse,\n} from '../models/client-list.model';\nimport { ColumnDef } from '@masterteam/components/table';\n\n@Injectable()\nexport class ClientListStateService {\n readonly tablesByKey = signal<Record<string, ClientListTableState>>({});\n\n readonly tables = computed<ClientListTableState[]>(() =>\n Object.values(this.tablesByKey()).sort((a, b) =>\n a.config.moduleId === b.config.moduleId\n ? a.config.levelDataId - b.config.levelDataId\n : a.config.moduleId - b.config.moduleId,\n ),\n );\n\n setConfigs(configs: ClientListTableState[]): void {\n const next: Record<string, ClientListTableState> = {};\n configs.forEach((table) => {\n const current = this.tablesByKey()[table.key];\n next[table.key] = {\n ...table,\n loading: current?.loading ?? false,\n error: current?.error ?? null,\n title: current?.title ?? table.title,\n moduleKey: current?.moduleKey ?? table.moduleKey,\n columns: current?.columns ?? table.columns,\n rows: current?.rows ?? table.rows,\n skip: current?.skip ?? table.skip,\n take: current?.take ?? table.take,\n totalCount: current?.totalCount ?? table.totalCount,\n expanded: current?.expanded ?? table.expanded,\n };\n });\n this.tablesByKey.set(next);\n }\n\n setLoading(key: string, loading: boolean): void {\n const target = this.tablesByKey()[key];\n if (!target) return;\n this.tablesByKey.set({\n ...this.tablesByKey(),\n [key]: {\n ...target,\n loading,\n },\n });\n }\n\n setError(key: string, message: string | null): void {\n const target = this.tablesByKey()[key];\n if (!target) return;\n this.tablesByKey.set({\n ...this.tablesByKey(),\n [key]: {\n ...target,\n error: message,\n },\n });\n }\n\n setRowsResult(\n key: string,\n response: RuntimeTableRowsResponse,\n config: NormalizedClientListConfiguration,\n skip: number,\n take: number,\n ): void {\n const target = this.tablesByKey()[key];\n if (!target) return;\n\n const columns = this.toColumnDefs(response.columns);\n const rows = response.rows ?? [];\n const title = (config.title ?? '').trim() || response.moduleKey;\n const totalCount =\n config.isPaginated === false\n ? rows.length\n : (response.pagination?.totalCount ?? rows.length);\n\n this.tablesByKey.set({\n ...this.tablesByKey(),\n [key]: {\n ...target,\n title,\n moduleKey: response.moduleKey ?? '',\n columns,\n rows,\n skip,\n take,\n totalCount,\n error: null,\n },\n });\n }\n\n toggleExpanded(key: string): void {\n const target = this.tablesByKey()[key];\n if (!target) return;\n this.tablesByKey.set({\n ...this.tablesByKey(),\n [key]: {\n ...target,\n expanded: !target.expanded,\n },\n });\n }\n\n private toColumnDefs(\n columns: RuntimeTableRowsResponse['columns'],\n ): ColumnDef[] {\n return (columns ?? [])\n .filter((column) => column.isVisible)\n .sort((a, b) => a.order - b.order)\n .map((column) => ({\n key: column.columnKey,\n label: this.toLabel(column.columnKey),\n }));\n }\n\n private toLabel(key: string): string {\n return key\n .replace(/([a-z])([A-Z])/g, '$1 $2')\n .replace(/[_-]+/g, ' ')\n .split(' ')\n .filter(Boolean)\n .map((word) => word[0].toUpperCase() + word.slice(1))\n .join(' ');\n }\n}\n","import {\n Component,\n effect,\n inject,\n input,\n output,\n untracked,\n OnDestroy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Subscription } from 'rxjs';\nimport { Card } from '@masterteam/components/card';\nimport { Table } from '@masterteam/components/table';\nimport { Button } from '@masterteam/components/button';\nimport { SkeletonModule } from 'primeng/skeleton';\nimport { ClientListApiService } from './services/client-list-api.service';\nimport { ClientListStateService } from './services/client-list-state.service';\nimport {\n ClientListConfiguration,\n ClientListContentTemplateContext,\n ClientListLazyLoadEvent,\n ClientListLayoutConfig,\n ClientListMode,\n NormalizedClientListConfiguration,\n ClientListQuery,\n ClientListTableState,\n} from './models/client-list.model';\n\nconst DEFAULT_MODE: ClientListMode = 'auto';\nconst DEFAULT_SERVER_PAGE_SIZE = 50;\nconst LOCAL_PAGE_SIZE_SOURCE = 100000;\nconst DEFAULT_COLLAPSE_ICON = 'arrow.chevron-up';\nconst DEFAULT_EXPAND_ICON = 'arrow.chevron-down';\nconst DEFAULT_SIDE_CONTENT_SPAN = 3;\nconst DEFAULT_GRID_COLUMNS = 12;\n\n@Component({\n selector: 'mt-client-list',\n standalone: true,\n imports: [CommonModule, Card, Table, Button, SkeletonModule],\n providers: [ClientListStateService],\n templateUrl: './client-list.html',\n styleUrl: './client-list.scss',\n})\nexport class ClientList implements OnDestroy {\n private readonly api = inject(ClientListApiService);\n protected readonly state = inject(ClientListStateService);\n\n readonly configurations = input.required<ClientListConfiguration[]>();\n readonly defaultTake = input(DEFAULT_SERVER_PAGE_SIZE);\n\n readonly loaded = output<string>();\n readonly errored = output<{ key: string; message: string }>();\n\n protected readonly tables = this.state.tables;\n protected readonly gridTemplateColumns = `repeat(${DEFAULT_GRID_COLUMNS}, minmax(0, 1fr))`;\n private readonly subscriptions = new Map<string, Subscription>();\n\n constructor() {\n effect(() => {\n const configs = this.configurations();\n untracked(() => this.configureTables(configs));\n\n untracked(() => {\n this.state.tables().forEach((table) => {\n this.loadTable(table.key, table.config, table.skip, table.take);\n });\n });\n });\n }\n\n onLazyLoad(tableKey: string, event: ClientListLazyLoadEvent): void {\n const table = this.state.tablesByKey()[tableKey];\n if (!table || !table.config.isPaginated) return;\n\n const take = Number(event.pageSize ?? table.take);\n const skip = Number(event.first ?? 0);\n this.loadTable(table.key, table.config, skip, take);\n }\n\n toggleExpanded(key: string): void {\n this.state.toggleExpanded(key);\n }\n\n slotGridSpan(span: number): string {\n return `span ${span} / span ${span}`;\n }\n\n templateContext(\n table: ClientListTableState,\n ): ClientListContentTemplateContext {\n return {\n $implicit: table,\n table,\n };\n }\n\n ngOnDestroy(): void {\n this.subscriptions.forEach((sub) => sub.unsubscribe());\n this.subscriptions.clear();\n }\n\n private configureTables(configs: ClientListConfiguration[]): void {\n const normalized: ClientListTableState[] = (configs ?? []).map(\n (config, index) => {\n const mode = this.resolveMode(config.mode, config.columnKeys);\n const isPaginated = config.isPaginated ?? true;\n const take = isPaginated\n ? (config.take ?? this.defaultTake())\n : LOCAL_PAGE_SIZE_SOURCE;\n const layout = this.resolveLayout(config);\n const key =\n config.key ??\n `${config.levelId ?? 'x'}-${config.levelDataId ?? 'x'}-${config.moduleId ?? 'x'}-${index}`;\n return {\n key,\n config: this.toNormalizedConfig(\n config,\n mode,\n isPaginated,\n take,\n layout,\n ),\n loading: false,\n error: null,\n title: config.title?.trim() || '',\n moduleKey: '',\n columns: [],\n rows: [],\n skip: 0,\n take,\n totalCount: 0,\n expanded: config.collapse?.expandedByDefault ?? true,\n };\n },\n );\n\n this.state.setConfigs(normalized);\n }\n\n private loadTable(\n key: string,\n config: NormalizedClientListConfiguration,\n skip: number,\n take: number,\n ): void {\n this.subscriptions.get(key)?.unsubscribe();\n\n this.state.setLoading(key, true);\n this.state.setError(key, null);\n\n const query: ClientListQuery = {\n mode: config.mode,\n columnKeys: config.mode === 'override' ? config.columnKeys : undefined,\n skip: config.isPaginated ? skip : 0,\n take: config.isPaginated ? take : LOCAL_PAGE_SIZE_SOURCE,\n };\n\n const sub = this.api\n .getRows(config.levelId, config.levelDataId, config.moduleId, query)\n .subscribe({\n next: (response) => {\n if (response.data) {\n this.state.setRowsResult(\n key,\n response.data,\n config,\n query.skip,\n query.take,\n );\n this.loaded.emit(key);\n } else {\n const message = response.message ?? 'Failed to load table rows';\n this.state.setError(key, message);\n this.errored.emit({ key, message });\n }\n this.state.setLoading(key, false);\n },\n error: (error) => {\n const message =\n error?.error?.message ?? error?.message ?? 'Failed to load rows';\n this.state.setError(key, message);\n this.state.setLoading(key, false);\n this.errored.emit({ key, message });\n },\n });\n\n this.subscriptions.set(key, sub);\n }\n\n private resolveMode(\n mode: ClientListMode | undefined,\n columnKeys: string[] | undefined,\n ): ClientListMode {\n if (mode !== 'override') return DEFAULT_MODE;\n return (columnKeys ?? []).length > 0 ? 'override' : DEFAULT_MODE;\n }\n\n private toNormalizedConfig(\n config: ClientListConfiguration,\n mode: ClientListMode,\n isPaginated: boolean,\n take: number,\n layout: Required<ClientListLayoutConfig>,\n ): NormalizedClientListConfiguration {\n return {\n levelId: config.levelId as number,\n levelDataId: config.levelDataId as number,\n moduleId: config.moduleId as number,\n mode,\n isPaginated,\n take,\n title: config.title,\n columnKeys: config.columnKeys ?? [],\n contentStart: config.contentStart,\n contentEnd: config.contentEnd,\n collapse: {\n enabled: config.collapse?.enabled ?? true,\n expandedByDefault: config.collapse?.expandedByDefault ?? true,\n collapseIcon: config.collapse?.collapseIcon ?? DEFAULT_COLLAPSE_ICON,\n expandIcon: config.collapse?.expandIcon ?? DEFAULT_EXPAND_ICON,\n },\n layout,\n };\n }\n\n private resolveLayout(\n config: ClientListConfiguration,\n ): Required<ClientListLayoutConfig> {\n const hasStart = !!config.contentStart;\n const hasEnd = !!config.contentEnd;\n\n const startSpan = hasStart\n ? this.clampSpan(config.layout?.startSpan ?? DEFAULT_SIDE_CONTENT_SPAN)\n : 0;\n let endSpan = hasEnd\n ? this.clampSpan(config.layout?.endSpan ?? DEFAULT_SIDE_CONTENT_SPAN)\n : 0;\n\n if (startSpan + endSpan >= DEFAULT_GRID_COLUMNS) {\n endSpan = Math.max(0, DEFAULT_GRID_COLUMNS - startSpan - 1);\n }\n\n const availableForTable = Math.max(\n 1,\n DEFAULT_GRID_COLUMNS - startSpan - endSpan,\n );\n const tableSpan = this.clampSpan(\n config.layout?.tableSpan ?? availableForTable,\n 1,\n availableForTable,\n );\n\n return {\n startSpan,\n tableSpan,\n endSpan,\n };\n }\n\n private clampSpan(\n value: number | undefined,\n min = 0,\n max = DEFAULT_GRID_COLUMNS,\n ): number {\n const normalized = Number(value ?? min);\n if (!Number.isFinite(normalized)) return min;\n return Math.min(max, Math.max(min, Math.trunc(normalized)));\n }\n}\n","<div class=\"flex flex-col gap-4\">\n @for (table of tables(); track table.key) {\n <mt-card [title]=\"table.title || table.moduleKey || 'Table'\" class=\"w-full\">\n @if (table.config.collapse.enabled) {\n <ng-template #cardEnd>\n <mt-button\n variant=\"text\"\n severity=\"secondary\"\n size=\"small\"\n [icon]=\"\n table.expanded\n ? table.config.collapse.collapseIcon\n : table.config.collapse.expandIcon\n \"\n (onClick)=\"toggleExpanded(table.key)\"\n />\n </ng-template>\n }\n\n @if (table.expanded) {\n <div\n class=\"grid gap-4\"\n [style.gridTemplateColumns]=\"gridTemplateColumns\"\n >\n @if (table.config.contentStart) {\n <div\n [style.gridColumn]=\"slotGridSpan(table.config.layout.startSpan)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"table.config.contentStart\"\n [ngTemplateOutletContext]=\"templateContext(table)\"\n />\n </div>\n }\n\n <div [style.gridColumn]=\"slotGridSpan(table.config.layout.tableSpan)\">\n @if (table.loading && table.rows.length === 0) {\n <div class=\"flex flex-col gap-3 py-3\">\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n </div>\n } @else if (table.error) {\n <div\n class=\"p-3 rounded-lg bg-red-50 text-red-700 border border-red-200 text-sm\"\n >\n {{ table.error }}\n </div>\n } @else {\n <mt-table\n [data]=\"table.rows\"\n [columns]=\"table.columns\"\n [loading]=\"table.loading\"\n [lazy]=\"table.config.isPaginated\"\n [lazyTotalRecords]=\"table.totalCount\"\n [pageSize]=\"table.config.isPaginated ? table.take : 10\"\n [first]=\"table.config.isPaginated ? table.skip : 0\"\n (lazyLoad)=\"onLazyLoad(table.key, $event)\"\n />\n }\n </div>\n\n @if (table.config.contentEnd) {\n <div [style.gridColumn]=\"slotGridSpan(table.config.layout.endSpan)\">\n <ng-container\n [ngTemplateOutlet]=\"table.config.contentEnd\"\n [ngTemplateOutletContext]=\"templateContext(table)\"\n />\n </div>\n }\n </div>\n }\n </mt-card>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAUa,oBAAoB,CAAA;AACd,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACzB,OAAO,GAAG,aAAa;AAExC,IAAA,OAAO,CACL,OAAe,EACf,WAAmB,EACnB,QAAgB,EAChB,KAAsB,EAAA;AAEtB,QAAA,MAAM,QAAQ,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,CAAA,OAAA,EAAU,OAAO,CAAA,YAAA,EAAe,WAAW,CAAA,QAAA,EAAW,QAAQ,OAAO;AACrG,QAAA,IAAI,MAAM,GAAG,IAAI,UAAU;AACxB,aAAA,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI;AACtB,aAAA,GAAG,CAAC,MAAM,EAAE,K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AAA,EAAA,CAAA,wBAAA,CAAA,EAAA;;;AExCrC;;AAEG;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-client-components.mjs","sources":["../../../../packages/masterteam/client-components/src/public-api.ts","../../../../packages/masterteam/client-components/src/masterteam-client-components.ts"],"sourcesContent":["export default {};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA,gBAAe,EAAE;;ACAjB;;AAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@masterteam/client-components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"directory": "../../../dist/masterteam/client-components",
|
|
6
|
+
"linkDirectory": true,
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@angular/common": "catalog:angular21",
|
|
11
|
+
"@angular/core": "catalog:angular21",
|
|
12
|
+
"@angular/forms": "catalog:angular21",
|
|
13
|
+
"@tailwindcss/postcss": "catalog:",
|
|
14
|
+
"postcss": "catalog:",
|
|
15
|
+
"primeng": "catalog:",
|
|
16
|
+
"rxjs": "catalog:angular21",
|
|
17
|
+
"tailwindcss": "catalog:",
|
|
18
|
+
"tailwindcss-primeui": "catalog:",
|
|
19
|
+
"@masterteam/components": "workspace:^"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"module": "fesm2022/masterteam-client-components.mjs",
|
|
23
|
+
"typings": "types/masterteam-client-components.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
"./package.json": {
|
|
26
|
+
"default": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./types/masterteam-client-components.d.ts",
|
|
30
|
+
"default": "./fesm2022/masterteam-client-components.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./client-list": {
|
|
33
|
+
"types": "./types/masterteam-client-components-client-list.d.ts",
|
|
34
|
+
"default": "./fesm2022/masterteam-client-components-client-list.mjs"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"tslib": "catalog:angular21"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TemplateRef, OnDestroy } from '@angular/core';
|
|
3
|
+
import { ColumnDef } from '@masterteam/components/table';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
type ClientListMode = 'auto' | 'override';
|
|
7
|
+
interface Response<T> {
|
|
8
|
+
endpoint: string;
|
|
9
|
+
status: number;
|
|
10
|
+
code: number;
|
|
11
|
+
locale: string;
|
|
12
|
+
message?: string | null;
|
|
13
|
+
errors?: unknown | null;
|
|
14
|
+
data: T;
|
|
15
|
+
cacheSession?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ClientListConfiguration {
|
|
18
|
+
key?: string;
|
|
19
|
+
levelId?: number;
|
|
20
|
+
levelDataId?: number;
|
|
21
|
+
moduleId?: number;
|
|
22
|
+
title?: string;
|
|
23
|
+
mode?: ClientListMode;
|
|
24
|
+
columnKeys?: string[];
|
|
25
|
+
isPaginated?: boolean;
|
|
26
|
+
take?: number;
|
|
27
|
+
collapse?: ClientListCollapseConfig;
|
|
28
|
+
layout?: ClientListLayoutConfig;
|
|
29
|
+
contentStart?: TemplateRef<ClientListContentTemplateContext>;
|
|
30
|
+
contentEnd?: TemplateRef<ClientListContentTemplateContext>;
|
|
31
|
+
}
|
|
32
|
+
interface ClientListCollapseConfig {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
expandedByDefault?: boolean;
|
|
35
|
+
collapseIcon?: string;
|
|
36
|
+
expandIcon?: string;
|
|
37
|
+
}
|
|
38
|
+
interface ClientListLayoutConfig {
|
|
39
|
+
startSpan?: number;
|
|
40
|
+
tableSpan?: number;
|
|
41
|
+
endSpan?: number;
|
|
42
|
+
}
|
|
43
|
+
interface ClientListQuery {
|
|
44
|
+
mode: ClientListMode;
|
|
45
|
+
columnKeys?: string[];
|
|
46
|
+
skip: number;
|
|
47
|
+
take: number;
|
|
48
|
+
}
|
|
49
|
+
interface RuntimeTableColumn {
|
|
50
|
+
columnKey: string;
|
|
51
|
+
sourceType: number;
|
|
52
|
+
order: number;
|
|
53
|
+
isVisible: boolean;
|
|
54
|
+
configuration?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface RuntimeTableRow {
|
|
57
|
+
entityId: number;
|
|
58
|
+
values: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
interface RuntimeTablePagination {
|
|
61
|
+
skip: number;
|
|
62
|
+
take: number;
|
|
63
|
+
totalCount: number;
|
|
64
|
+
}
|
|
65
|
+
interface RuntimeTableRowsResponse {
|
|
66
|
+
levelId: number;
|
|
67
|
+
levelDataId: number;
|
|
68
|
+
moduleId: number;
|
|
69
|
+
moduleKey: string;
|
|
70
|
+
surfaceKey: string;
|
|
71
|
+
columns: RuntimeTableColumn[];
|
|
72
|
+
rows: RuntimeTableRow[];
|
|
73
|
+
pagination: RuntimeTablePagination;
|
|
74
|
+
}
|
|
75
|
+
interface ClientListTableState {
|
|
76
|
+
key: string;
|
|
77
|
+
config: NormalizedClientListConfiguration;
|
|
78
|
+
loading: boolean;
|
|
79
|
+
error: string | null;
|
|
80
|
+
title: string;
|
|
81
|
+
moduleKey: string;
|
|
82
|
+
columns: ColumnDef[];
|
|
83
|
+
rows: RuntimeTableRow[];
|
|
84
|
+
skip: number;
|
|
85
|
+
take: number;
|
|
86
|
+
totalCount: number;
|
|
87
|
+
expanded: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface NormalizedClientListConfiguration {
|
|
90
|
+
levelId: number;
|
|
91
|
+
levelDataId: number;
|
|
92
|
+
moduleId: number;
|
|
93
|
+
mode: ClientListMode;
|
|
94
|
+
isPaginated: boolean;
|
|
95
|
+
take: number;
|
|
96
|
+
title?: string;
|
|
97
|
+
columnKeys: string[];
|
|
98
|
+
collapse: Required<ClientListCollapseConfig>;
|
|
99
|
+
layout: Required<ClientListLayoutConfig>;
|
|
100
|
+
contentStart?: TemplateRef<ClientListContentTemplateContext>;
|
|
101
|
+
contentEnd?: TemplateRef<ClientListContentTemplateContext>;
|
|
102
|
+
}
|
|
103
|
+
interface ClientListContentTemplateContext {
|
|
104
|
+
$implicit: ClientListTableState;
|
|
105
|
+
table: ClientListTableState;
|
|
106
|
+
}
|
|
107
|
+
interface ClientListLazyLoadEvent {
|
|
108
|
+
pageSize?: number;
|
|
109
|
+
first?: number;
|
|
110
|
+
currentPage?: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare class ClientListStateService {
|
|
114
|
+
readonly tablesByKey: _angular_core.WritableSignal<Record<string, ClientListTableState>>;
|
|
115
|
+
readonly tables: _angular_core.Signal<ClientListTableState[]>;
|
|
116
|
+
setConfigs(configs: ClientListTableState[]): void;
|
|
117
|
+
setLoading(key: string, loading: boolean): void;
|
|
118
|
+
setError(key: string, message: string | null): void;
|
|
119
|
+
setRowsResult(key: string, response: RuntimeTableRowsResponse, config: NormalizedClientListConfiguration, skip: number, take: number): void;
|
|
120
|
+
toggleExpanded(key: string): void;
|
|
121
|
+
private toColumnDefs;
|
|
122
|
+
private toLabel;
|
|
123
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientListStateService, never>;
|
|
124
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ClientListStateService>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare class ClientList implements OnDestroy {
|
|
128
|
+
private readonly api;
|
|
129
|
+
protected readonly state: ClientListStateService;
|
|
130
|
+
readonly configurations: _angular_core.InputSignal<ClientListConfiguration[]>;
|
|
131
|
+
readonly defaultTake: _angular_core.InputSignal<number>;
|
|
132
|
+
readonly loaded: _angular_core.OutputEmitterRef<string>;
|
|
133
|
+
readonly errored: _angular_core.OutputEmitterRef<{
|
|
134
|
+
key: string;
|
|
135
|
+
message: string;
|
|
136
|
+
}>;
|
|
137
|
+
protected readonly tables: _angular_core.Signal<ClientListTableState[]>;
|
|
138
|
+
protected readonly gridTemplateColumns = "repeat(12, minmax(0, 1fr))";
|
|
139
|
+
private readonly subscriptions;
|
|
140
|
+
constructor();
|
|
141
|
+
onLazyLoad(tableKey: string, event: ClientListLazyLoadEvent): void;
|
|
142
|
+
toggleExpanded(key: string): void;
|
|
143
|
+
slotGridSpan(span: number): string;
|
|
144
|
+
templateContext(table: ClientListTableState): ClientListContentTemplateContext;
|
|
145
|
+
ngOnDestroy(): void;
|
|
146
|
+
private configureTables;
|
|
147
|
+
private loadTable;
|
|
148
|
+
private resolveMode;
|
|
149
|
+
private toNormalizedConfig;
|
|
150
|
+
private resolveLayout;
|
|
151
|
+
private clampSpan;
|
|
152
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientList, never>;
|
|
153
|
+
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>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare class ClientListApiService {
|
|
157
|
+
private readonly http;
|
|
158
|
+
private readonly baseUrl;
|
|
159
|
+
getRows(levelId: number, levelDataId: number, moduleId: number, query: ClientListQuery): Observable<Response<RuntimeTableRowsResponse>>;
|
|
160
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientListApiService, never>;
|
|
161
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ClientListApiService>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { ClientList, ClientListApiService, ClientListStateService };
|
|
165
|
+
export type { ClientListCollapseConfig, ClientListConfiguration, ClientListContentTemplateContext, ClientListLayoutConfig, ClientListLazyLoadEvent, ClientListMode, ClientListQuery, ClientListTableState, NormalizedClientListConfiguration, Response, RuntimeTableColumn, RuntimeTablePagination, RuntimeTableRow, RuntimeTableRowsResponse };
|