@masterteam/data-table 0.0.0-stage → 0.0.2

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.
@@ -0,0 +1,1349 @@
1
+ import { MtTableText, mtTablePrintConfiguration } from '@masterteam/data-table';
2
+ export * from '@masterteam/data-table';
3
+ import * as i0 from '@angular/core';
4
+ import { InjectionToken, inject, Injectable, makeEnvironmentProviders, input, computed, ChangeDetectionStrategy, Component, output, Injector, ElementRef, DestroyRef, viewChild, signal, afterNextRender, effect, untracked } from '@angular/core';
5
+ import { CHART_TYPES, parseGridViewState, MtDataGridComponent, applyGridViewState, captureGridViewState } from '@masterteam/data-grid';
6
+ import { CdkTrapFocus } from '@angular/cdk/a11y';
7
+ import * as i1 from '@angular/forms';
8
+ import { FormsModule } from '@angular/forms';
9
+ import { Button } from '@masterteam/components/button';
10
+ import { TextField } from '@masterteam/components/text-field';
11
+ import { Menu } from '@masterteam/components/menu';
12
+ import { TableExportService } from '@masterteam/components/table';
13
+ import { Popover } from 'primeng/popover';
14
+ import { ConfirmationService } from '@masterteam/components/confirmation';
15
+
16
+ const MT_DATA_TABLE_CONFIGURATION = new InjectionToken('MT_DATA_TABLE_CONFIGURATION', {
17
+ providedIn: 'root',
18
+ factory: () => ({ identity: () => null }),
19
+ });
20
+
21
+ function captureMtTableChart(model, api, wholeTable = false) {
22
+ const rows = [];
23
+ api.forEachNodeAfterFilterAndSort((node) => rows.push(node.id));
24
+ return {
25
+ options: {
26
+ chartType: model.chartType,
27
+ title: model.chart.title,
28
+ chartContext: model.chartContext,
29
+ chartThemeName: model.chartThemeName,
30
+ chartThemeOverrides: model.chartThemeOverrides,
31
+ categoryId: model.categoryId,
32
+ seriesIds: model.seriesIds,
33
+ aggFunc: model.aggFunc,
34
+ seriesChartTypes: model.seriesChartTypes,
35
+ switchCategorySeries: model.switchCategorySeries,
36
+ },
37
+ ranges: model.cellRanges.map((range) => {
38
+ if (wholeTable || range.rowIds === null)
39
+ return { columns: range.columns, rowIds: null };
40
+ if (range.rowIds !== undefined)
41
+ return { columns: range.columns, rowIds: range.rowIds };
42
+ if (range.rowStartIndex == null && range.rowEndIndex == null)
43
+ return { columns: range.columns, rowIds: null };
44
+ const rowIds = [];
45
+ for (let index = range.rowStartIndex ?? 0; index <= (range.rowEndIndex ?? rows.length - 1); index++) {
46
+ const id = rows[index];
47
+ if (id !== undefined)
48
+ rowIds.push(id);
49
+ }
50
+ return { columns: range.columns, rowIds };
51
+ }),
52
+ };
53
+ }
54
+ function restoreMtTableChart(saved, api) {
55
+ const fields = new Set([
56
+ ...api.getColumnState().map((column) => column.colId),
57
+ ...api.getPivotResultColumns(),
58
+ ]);
59
+ const ranges = saved.ranges.flatMap((range) => {
60
+ const columns = range.columns.filter((column) => fields.has(column));
61
+ if (!columns.length)
62
+ return [];
63
+ return [{ columns, rowIds: range.rowIds }];
64
+ });
65
+ return ranges.length
66
+ ? {
67
+ ...saved.options,
68
+ categoryId: fields.has(saved.options.categoryId ?? '')
69
+ ? saved.options.categoryId
70
+ : undefined,
71
+ seriesIds: saved.options.seriesIds?.filter((id) => fields.has(id)),
72
+ cellRange: ranges[0],
73
+ cellRanges: ranges.slice(1),
74
+ }
75
+ : null;
76
+ }
77
+ function parseMtTableCharts(value) {
78
+ if (!Array.isArray(value) || value.length > 10)
79
+ return [];
80
+ const strings = (values) => Array.isArray(values) &&
81
+ values.length <= 1000 &&
82
+ values.every((value) => typeof value === 'string' && value.length <= 512);
83
+ return value.flatMap((chart) => {
84
+ if (!chart ||
85
+ typeof chart !== 'object' ||
86
+ !chart.options ||
87
+ !CHART_TYPES.includes(chart.options.chartType) ||
88
+ !Array.isArray(chart.ranges) ||
89
+ chart.ranges.length > 1000 ||
90
+ !chart.ranges.every((range) => range &&
91
+ strings(range.columns) &&
92
+ (range.rowIds === null || strings(range.rowIds))))
93
+ return [];
94
+ const options = chart.options;
95
+ if (options.title !== undefined && typeof options.title !== 'string')
96
+ return [];
97
+ if (options.chartContext !== undefined &&
98
+ typeof options.chartContext !== 'string')
99
+ return [];
100
+ if (options.seriesIds !== undefined && !strings(options.seriesIds))
101
+ return [];
102
+ if (options.categoryId !== undefined &&
103
+ typeof options.categoryId !== 'string')
104
+ return [];
105
+ return [
106
+ {
107
+ options: {
108
+ chartType: options.chartType,
109
+ title: options.title?.slice(0, 500),
110
+ chartContext: options.chartContext?.slice(0, 1000),
111
+ categoryId: options.categoryId,
112
+ seriesIds: options.seriesIds,
113
+ aggFunc: [
114
+ 'sum',
115
+ 'avg',
116
+ 'count',
117
+ 'min',
118
+ 'max',
119
+ 'first',
120
+ 'last',
121
+ ].includes(options.aggFunc ?? '')
122
+ ? options.aggFunc
123
+ : undefined,
124
+ chartThemeName: typeof options.chartThemeName === 'string'
125
+ ? options.chartThemeName
126
+ : undefined,
127
+ chartThemeOverrides: options.chartThemeOverrides &&
128
+ typeof options.chartThemeOverrides === 'object'
129
+ ? options.chartThemeOverrides
130
+ : undefined,
131
+ switchCategorySeries: options.switchCategorySeries === true,
132
+ seriesChartTypes: Array.isArray(options.seriesChartTypes)
133
+ ? options.seriesChartTypes
134
+ .filter((series) => series &&
135
+ typeof series.colId === 'string' &&
136
+ CHART_TYPES.includes(series.chartType))
137
+ .map((series) => ({
138
+ colId: series.colId,
139
+ chartType: series.chartType,
140
+ secondaryAxis: series.secondaryAxis === true,
141
+ }))
142
+ : undefined,
143
+ },
144
+ ranges: chart.ranges.map((range) => ({
145
+ columns: range.columns,
146
+ rowIds: range.rowIds,
147
+ })),
148
+ },
149
+ ];
150
+ });
151
+ }
152
+
153
+ function mtTablePreferenceKey(identity, view) {
154
+ return `mt-table:v1:${JSON.stringify([identity.application, identity.tenant, identity.user, identity.actor, identity.template ?? null, view.level, view.module ?? null, view.role])}`;
155
+ }
156
+ /** Local storage is optional (private browsing/quota/security errors must not break a table). */
157
+ class MtTablePreferences {
158
+ configuration = inject(MT_DATA_TABLE_CONFIGURATION);
159
+ key(view) {
160
+ const identity = this.configuration.identity();
161
+ return identity ? mtTablePreferenceKey(identity, view) : null;
162
+ }
163
+ read(view) {
164
+ const key = this.key(view);
165
+ if (!key || typeof localStorage === 'undefined')
166
+ return null;
167
+ try {
168
+ const text = localStorage.getItem(key);
169
+ if (!text || text.length > 131072)
170
+ return null;
171
+ return parseGridViewState(JSON.parse(text));
172
+ }
173
+ catch {
174
+ return null;
175
+ }
176
+ }
177
+ write(view, state) {
178
+ const key = this.key(view);
179
+ if (!key || typeof localStorage === 'undefined')
180
+ return;
181
+ // Construct the document explicitly: never persist an API/row/query response object.
182
+ const document = {
183
+ version: 1,
184
+ columns: state.columns,
185
+ sort: state.sort,
186
+ filters: state.filters,
187
+ rowGroups: state.rowGroups,
188
+ values: state.values,
189
+ pivot: state.pivot,
190
+ };
191
+ try {
192
+ localStorage.setItem(key, JSON.stringify(document));
193
+ }
194
+ catch {
195
+ /* In-memory layout remains usable. */
196
+ }
197
+ }
198
+ clear(view) {
199
+ const key = this.key(view);
200
+ try {
201
+ if (key && typeof localStorage !== 'undefined')
202
+ localStorage.removeItem(key);
203
+ }
204
+ catch {
205
+ /* Optional storage. */
206
+ }
207
+ }
208
+ readCharts(view, scope) {
209
+ const key = this.key(view);
210
+ if (!key)
211
+ return [];
212
+ try {
213
+ const text = localStorage.getItem(`${key}:charts:${scope}`);
214
+ return text && text.length <= 131072
215
+ ? parseMtTableCharts(JSON.parse(text))
216
+ : [];
217
+ }
218
+ catch {
219
+ return [];
220
+ }
221
+ }
222
+ writeCharts(view, scope, charts) {
223
+ const key = this.key(view);
224
+ if (!key)
225
+ return;
226
+ try {
227
+ const text = JSON.stringify(parseMtTableCharts(charts));
228
+ if (text.length <= 131072)
229
+ localStorage.setItem(`${key}:charts:${scope}`, text);
230
+ }
231
+ catch {
232
+ /* Optional browser preferences. */
233
+ }
234
+ }
235
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTablePreferences, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
236
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTablePreferences, providedIn: 'root' });
237
+ }
238
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTablePreferences, decorators: [{
239
+ type: Injectable,
240
+ args: [{ providedIn: 'root' }]
241
+ }] });
242
+
243
+ /** Root installation of the data-table configuration and preferences (portal and Studio). */
244
+ function provideMTDataTables(configuration) {
245
+ return makeEnvironmentProviders([
246
+ MtTablePreferences,
247
+ typeof configuration === 'function'
248
+ ? { provide: MT_DATA_TABLE_CONFIGURATION, useFactory: configuration }
249
+ : { provide: MT_DATA_TABLE_CONFIGURATION, useValue: configuration },
250
+ ]);
251
+ }
252
+
253
+ /** A shared, cancellable FIFO scheduler. Collapsing one record never cancels another. */
254
+ class MtDatasetScheduler {
255
+ concurrency;
256
+ active = 0;
257
+ queue = [];
258
+ constructor(concurrency = 4) {
259
+ this.concurrency = concurrency;
260
+ if (!Number.isInteger(concurrency) || concurrency < 1)
261
+ throw new Error('Invalid concurrency');
262
+ }
263
+ run(work, signal) {
264
+ return new Promise((resolve, reject) => {
265
+ const abort = () => {
266
+ const index = this.queue.indexOf(start);
267
+ if (index >= 0)
268
+ this.queue.splice(index, 1);
269
+ reject(signal.reason ?? new DOMException('Aborted', 'AbortError'));
270
+ };
271
+ const start = () => {
272
+ if (signal.aborted) {
273
+ signal.removeEventListener('abort', abort);
274
+ return;
275
+ }
276
+ this.active++;
277
+ Promise.resolve()
278
+ .then(work)
279
+ .then(resolve, reject)
280
+ .finally(() => {
281
+ signal.removeEventListener('abort', abort);
282
+ this.active--;
283
+ this.drain();
284
+ });
285
+ };
286
+ if (signal.aborted) {
287
+ abort();
288
+ return;
289
+ }
290
+ signal.addEventListener('abort', abort, { once: true });
291
+ this.queue.push(start);
292
+ this.drain();
293
+ });
294
+ }
295
+ drain() {
296
+ while (this.active < this.concurrency && this.queue.length)
297
+ this.queue.shift()();
298
+ }
299
+ }
300
+ /** Values are scoped by the caller's complete authenticated query identity. */
301
+ class MtDatasetCache {
302
+ capacity;
303
+ entries = new Map();
304
+ constructor(capacity = 20) {
305
+ this.capacity = capacity;
306
+ if (!Number.isInteger(capacity) || capacity < 1)
307
+ throw new Error('Invalid cache capacity');
308
+ }
309
+ get(key) {
310
+ const value = this.entries.get(key);
311
+ if (value !== undefined) {
312
+ this.entries.delete(key);
313
+ this.entries.set(key, value);
314
+ }
315
+ return value;
316
+ }
317
+ set(key, value) {
318
+ this.entries.delete(key);
319
+ this.entries.set(key, value);
320
+ while (this.entries.size > this.capacity)
321
+ this.entries.delete(this.entries.keys().next().value);
322
+ }
323
+ clear() {
324
+ this.entries.clear();
325
+ }
326
+ get size() {
327
+ return this.entries.size;
328
+ }
329
+ }
330
+
331
+ class MtIncompleteTableError extends Error {
332
+ constructor() {
333
+ super('The table response did not contain the complete requested result.');
334
+ }
335
+ }
336
+ function uniqueRows(rows, getRowId) {
337
+ const ids = rows.map(getRowId);
338
+ return (ids.every((id) => typeof id === 'string' && id.length > 0) &&
339
+ new Set(ids).size === ids.length);
340
+ }
341
+ /** Load every page of a small result before permitting client aggregation. A threshold is never a truncation limit. */
342
+ async function loadMtTableResult(source, query, signal, getRowId, clientAnalysisThreshold = 1000) {
343
+ if (!Number.isSafeInteger(query.offset) ||
344
+ query.offset < 0 ||
345
+ !Number.isSafeInteger(query.limit) ||
346
+ query.limit <= 0)
347
+ throw new Error('Invalid table page');
348
+ const first = await source.load(query, signal);
349
+ signal.throwIfAborted();
350
+ if (!Number.isSafeInteger(first.totalCount) ||
351
+ first.totalCount < 0 ||
352
+ first.rows.length > first.totalCount ||
353
+ !uniqueRows(first.rows, getRowId))
354
+ throw new MtIncompleteTableError();
355
+ if (source.processing === 'client') {
356
+ if (!first.complete ||
357
+ first.rows.length !== first.totalCount ||
358
+ !uniqueRows(first.rows, getRowId))
359
+ throw new MtIncompleteTableError();
360
+ return first;
361
+ }
362
+ if (first.totalCount > clientAnalysisThreshold) {
363
+ const expected = Math.max(0, Math.min(query.limit, first.totalCount - query.offset));
364
+ if (first.rows.length !== expected)
365
+ throw new MtIncompleteTableError();
366
+ return { ...first, complete: false };
367
+ }
368
+ const pages = [];
369
+ // A non-zero initial page cannot prove that earlier rows were loaded.
370
+ let offset = 0;
371
+ while (offset < first.totalCount) {
372
+ signal.throwIfAborted();
373
+ const page = offset === query.offset
374
+ ? first
375
+ : await source.load({ ...query, offset }, signal);
376
+ signal.throwIfAborted();
377
+ if (page.totalCount !== first.totalCount ||
378
+ page.rows.length === 0 ||
379
+ page.rows.length > query.limit)
380
+ throw new MtIncompleteTableError();
381
+ pages.push(...page.rows);
382
+ offset += page.rows.length;
383
+ }
384
+ if (pages.length !== first.totalCount || !uniqueRows(pages, getRowId))
385
+ throw new MtIncompleteTableError();
386
+ return { ...first, rows: pages, complete: true };
387
+ }
388
+ function mtClientTableSource(key, rows) {
389
+ return {
390
+ key,
391
+ scopeKey: key,
392
+ processing: 'client',
393
+ capabilities: {
394
+ sort: true,
395
+ filter: true,
396
+ group: true,
397
+ pivot: true,
398
+ charts: true,
399
+ exportAll: true,
400
+ },
401
+ load: async (_query, signal) => {
402
+ signal.throwIfAborted();
403
+ return { rows, totalCount: rows.length, complete: true };
404
+ },
405
+ };
406
+ }
407
+
408
+ /** Saved roles are configuration, never authority to enable a now-unavailable operation. */
409
+ function reconcileMtTableView(state, columns, policy) {
410
+ const definitions = new Map(columns.map((column, index) => [
411
+ column.colId ?? column.field ?? String(index),
412
+ column,
413
+ ]));
414
+ const groups = new Set(columns
415
+ .filter((column) => column.enableRowGroup || column.rowGroup)
416
+ .map((column) => column.colId ?? column.field));
417
+ const values = new Set(columns
418
+ .filter((column) => column.enableValue || column.aggFunc)
419
+ .map((column) => column.colId ?? column.field));
420
+ const pivots = new Set(columns
421
+ .filter((column) => column.enablePivot || column.pivot)
422
+ .map((column) => column.colId ?? column.field));
423
+ return {
424
+ ...state,
425
+ sort: state.sort.filter((sort) => definitions.has(sort.colId) &&
426
+ definitions.get(sort.colId)?.sortable !== false),
427
+ filters: Object.fromEntries(Object.entries(state.filters).filter(([id]) => definitions.has(id) && definitions.get(id)?.filter !== false)),
428
+ rowGroups: policy.grouping
429
+ ? state.rowGroups.filter((id) => groups.has(id))
430
+ : [],
431
+ values: policy.values
432
+ ? state.values.filter((value) => values.has(value.colId) &&
433
+ (!definitions.get(value.colId)?.allowedAggFuncs ||
434
+ definitions
435
+ .get(value.colId)
436
+ .allowedAggFuncs.includes(value.aggFunc)))
437
+ : [],
438
+ pivot: {
439
+ enabled: policy.pivot && state.pivot.enabled,
440
+ columns: policy.pivot
441
+ ? state.pivot.columns.filter((id) => pivots.has(id))
442
+ : [],
443
+ },
444
+ };
445
+ }
446
+
447
+ const MT_TABLE_ACTIONS_COLUMN = '__mt_table_actions__';
448
+ class MtDataTableRowActions {
449
+ params = input.required(...(ngDevMode ? [{ debugName: "params" }] : /* istanbul ignore next */ []));
450
+ text = inject(MtTableText);
451
+ confirmation = inject(ConfirmationService);
452
+ anchor = null;
453
+ visible = computed(() => {
454
+ const { data, node } = this.params();
455
+ if (!data || node.group || node.footer)
456
+ return [];
457
+ return this.params()['actions'].filter((action) => !action.hidden?.(data));
458
+ }, ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
459
+ inline = computed(() => this.visible().filter((action) => action.placement === 'inline'), ...(ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []));
460
+ menuItems = computed(() => {
461
+ const actions = this.visible().filter((action) => action.placement !== 'inline');
462
+ const ordered = [
463
+ ...actions.filter((action) => action.color !== 'danger'),
464
+ ...actions.filter((action) => action.color === 'danger'),
465
+ ];
466
+ return ordered.flatMap((action, index) => [
467
+ ...(index > 0 &&
468
+ action.color === 'danger' &&
469
+ ordered[index - 1].color !== 'danger'
470
+ ? [{ separator: true }]
471
+ : []),
472
+ {
473
+ label: this.label(action),
474
+ icon: action.icon,
475
+ severity: action.color,
476
+ disabled: this.disabled(action) || this.busy(action),
477
+ command: () => this.run(action),
478
+ },
479
+ ]);
480
+ }, ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
481
+ label(action) {
482
+ return action.label ?? action.tooltip ?? this.text.text('rowActions');
483
+ }
484
+ busy(action) {
485
+ return typeof action.loading === 'function'
486
+ ? action.loading(this.params().data)
487
+ : !!action.loading;
488
+ }
489
+ disabled(action) {
490
+ return typeof action.disabled === 'function'
491
+ ? action.disabled(this.params().data)
492
+ : !!action.disabled;
493
+ }
494
+ toggle(event, menu) {
495
+ this.anchor =
496
+ event.target.closest('button') ?? event.target;
497
+ menu.toggle(event);
498
+ }
499
+ run(action, event) {
500
+ const row = this.params().data;
501
+ if (action.hidden?.(row) || this.disabled(action) || this.busy(action))
502
+ return;
503
+ const accept = () => {
504
+ if (!action.hidden?.(row) && !this.disabled(action) && !this.busy(action))
505
+ action.action(row);
506
+ };
507
+ if (!action.confirmation) {
508
+ accept();
509
+ return;
510
+ }
511
+ const configuration = {
512
+ ...action.confirmation,
513
+ event: event ??
514
+ {
515
+ target: this.anchor,
516
+ currentTarget: this.anchor,
517
+ },
518
+ accept,
519
+ };
520
+ if (action.confirmation.confirmationType === 'delete')
521
+ this.confirmation.confirmDelete(configuration);
522
+ else
523
+ this.confirmation.confirm(configuration);
524
+ }
525
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtDataTableRowActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
526
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: MtDataTableRowActions, isStandalone: true, selector: "mt-data-table-row-actions", inputs: { params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "$event.stopPropagation()", "pointerdown": "$event.stopPropagation()" } }, ngImport: i0, template: `
527
+ @for (action of inline(); track $index) {
528
+ <mt-button
529
+ [icon]="action.icon"
530
+ [tooltip]="label(action)"
531
+ [ariaLabel]="label(action)"
532
+ [severity]="action.color ?? 'secondary'"
533
+ variant="text"
534
+ size="small"
535
+ [loading]="busy(action)"
536
+ [disabled]="disabled(action)"
537
+ (click)="run(action, $event)"
538
+ />
539
+ }
540
+ @if (menuItems().length) {
541
+ <mt-button
542
+ icon="general.dots-vertical"
543
+ severity="secondary"
544
+ variant="text"
545
+ size="small"
546
+ [ariaLabel]="text.text('rowActions')"
547
+ [tooltip]="text.text('rowActions')"
548
+ (click)="toggle($event, menu)"
549
+ />
550
+ <mt-menu
551
+ #menu
552
+ [model]="menuItems()"
553
+ [ariaLabel]="text.text('rowActions')"
554
+ />
555
+ }
556
+ `, isInline: true, styles: [":host{display:flex;align-items:center;justify-content:center;gap:2px;height:100%}\n"], dependencies: [{ 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", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Menu, selector: "mt-menu", inputs: ["model", "popup", "appendTo", "style", "styleClass", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaLabel", "ariaLabelledBy", "id", "tabindex", "activeItemId"], outputs: ["activeItemIdChange", "onShow", "onHide", "onBlur", "onFocus", "onItemSelect"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
557
+ }
558
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtDataTableRowActions, decorators: [{
559
+ type: Component,
560
+ args: [{ selector: 'mt-data-table-row-actions', imports: [Button, Menu], changeDetection: ChangeDetectionStrategy.OnPush, host: {
561
+ '(click)': '$event.stopPropagation()',
562
+ '(pointerdown)': '$event.stopPropagation()',
563
+ }, template: `
564
+ @for (action of inline(); track $index) {
565
+ <mt-button
566
+ [icon]="action.icon"
567
+ [tooltip]="label(action)"
568
+ [ariaLabel]="label(action)"
569
+ [severity]="action.color ?? 'secondary'"
570
+ variant="text"
571
+ size="small"
572
+ [loading]="busy(action)"
573
+ [disabled]="disabled(action)"
574
+ (click)="run(action, $event)"
575
+ />
576
+ }
577
+ @if (menuItems().length) {
578
+ <mt-button
579
+ icon="general.dots-vertical"
580
+ severity="secondary"
581
+ variant="text"
582
+ size="small"
583
+ [ariaLabel]="text.text('rowActions')"
584
+ [tooltip]="text.text('rowActions')"
585
+ (click)="toggle($event, menu)"
586
+ />
587
+ <mt-menu
588
+ #menu
589
+ [model]="menuItems()"
590
+ [ariaLabel]="text.text('rowActions')"
591
+ />
592
+ }
593
+ `, styles: [":host{display:flex;align-items:center;justify-content:center;gap:2px;height:100%}\n"] }]
594
+ }], propDecorators: { params: [{ type: i0.Input, args: [{ isSignal: true, alias: "params", required: true }] }] } });
595
+
596
+ /** Distribute available width without violating minimums or stretching fixed action columns. */
597
+ function fitMtTableColumns(columns, available) {
598
+ const minimum = columns.reduce((sum, column) => sum + column.min, 0);
599
+ const widths = columns.map((column) => column.min);
600
+ let remaining = Math.max(0, Math.floor(available) - minimum);
601
+ let open = columns
602
+ .map((_, index) => index)
603
+ .filter((index) => (columns[index].max ?? Infinity) > widths[index]);
604
+ while (remaining > 0 && open.length) {
605
+ const weight = open.reduce((sum, index) => sum + Math.max(1, columns[index].width - columns[index].min), 0);
606
+ let assigned = 0;
607
+ for (const index of open) {
608
+ const part = Math.max(1, Math.floor((remaining * Math.max(1, columns[index].width - columns[index].min)) /
609
+ weight));
610
+ const addition = Math.min(part, remaining - assigned, (columns[index].max ?? Infinity) - widths[index]);
611
+ widths[index] += addition;
612
+ assigned += addition;
613
+ }
614
+ remaining -= assigned;
615
+ open = open.filter((index) => widths[index] < (columns[index].max ?? Infinity));
616
+ if (!assigned)
617
+ break;
618
+ }
619
+ return columns.map((column, index) => ({
620
+ colId: column.colId,
621
+ width: widths[index],
622
+ }));
623
+ }
624
+
625
+ const EMPTY_QUERY = {
626
+ offset: 0,
627
+ limit: 1000,
628
+ sort: [],
629
+ filters: {},
630
+ search: '',
631
+ groupColumns: [],
632
+ groupKeys: [],
633
+ valueColumns: [],
634
+ pivotColumns: [],
635
+ };
636
+ /** Masterteam chrome around the independent engine. Business operations remain in the owning feature. */
637
+ class MtDataTableComponent {
638
+ rows = input([], ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
639
+ columns = input.required(...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
640
+ getRowId = input.required(...(ngDevMode ? [{ debugName: "getRowId" }] : /* istanbul ignore next */ []));
641
+ source = input(null, ...(ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []));
642
+ profile = input('compact', ...(ngDevMode ? [{ debugName: "profile" }] : /* istanbul ignore next */ []));
643
+ title = input('', ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
644
+ showHeading = input(true, ...(ngDevMode ? [{ debugName: "showHeading" }] : /* istanbul ignore next */ []));
645
+ height = input(420, ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
646
+ rowHeight = input(52, ...(ngDevMode ? [{ debugName: "rowHeight" }] : /* istanbul ignore next */ []));
647
+ fitColumns = input(false, ...(ngDevMode ? [{ debugName: "fitColumns" }] : /* istanbul ignore next */ []));
648
+ rowActions = input([], ...(ngDevMode ? [{ debugName: "rowActions" }] : /* istanbul ignore next */ []));
649
+ loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
650
+ masterDetail = input(false, ...(ngDevMode ? [{ debugName: "masterDetail" }] : /* istanbul ignore next */ []));
651
+ detailRenderer = input(...(ngDevMode ? [undefined, { debugName: "detailRenderer" }] : /* istanbul ignore next */ []));
652
+ detailRendererParams = input({}, ...(ngDevMode ? [{ debugName: "detailRendererParams" }] : /* istanbul ignore next */ []));
653
+ isRowMaster = input(...(ngDevMode ? [undefined, { debugName: "isRowMaster" }] : /* istanbul ignore next */ []));
654
+ detailAutoHeight = input(true, ...(ngDevMode ? [{ debugName: "detailAutoHeight" }] : /* istanbul ignore next */ []));
655
+ detailHeight = input(500, ...(ngDevMode ? [{ debugName: "detailHeight" }] : /* istanbul ignore next */ []));
656
+ selectable = input(false, ...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
657
+ groupable = input(false, ...(ngDevMode ? [{ debugName: "groupable" }] : /* istanbul ignore next */ []));
658
+ readOnly = input(true, ...(ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []));
659
+ viewIdentity = input(null, ...(ngDevMode ? [{ debugName: "viewIdentity" }] : /* istanbul ignore next */ []));
660
+ exporter = input(null, ...(ngDevMode ? [{ debugName: "exporter" }] : /* istanbul ignore next */ []));
661
+ exportFormats = input([
662
+ 'csv',
663
+ 'excel',
664
+ ], ...(ngDevMode ? [{ debugName: "exportFormats" }] : /* istanbul ignore next */ []));
665
+ columnLoadRequested = output();
666
+ rowClick = output();
667
+ selectionChange = output();
668
+ focusChange = output();
669
+ viewStateChange = output();
670
+ text = inject(MtTableText);
671
+ configuration = inject(MT_DATA_TABLE_CONFIGURATION);
672
+ injector = inject(Injector);
673
+ preferences = inject(MtTablePreferences);
674
+ printService = inject(TableExportService);
675
+ host = inject(ElementRef);
676
+ destroyRef = inject(DestroyRef);
677
+ grid = viewChild((MtDataGridComponent), ...(ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []));
678
+ chartDock = viewChild('chartDock', ...(ngDevMode ? [{ debugName: "chartDock" }] : /* istanbul ignore next */ []));
679
+ query = signal(EMPTY_QUERY, ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
680
+ loadedRows = signal([], ...(ngDevMode ? [{ debugName: "loadedRows" }] : /* istanbul ignore next */ []));
681
+ complete = signal(true, ...(ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []));
682
+ total = signal(0, ...(ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []));
683
+ fetching = signal(false, ...(ngDevMode ? [{ debugName: "fetching" }] : /* istanbul ignore next */ []));
684
+ error = signal(false, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
685
+ focused = signal(false, ...(ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []));
686
+ exporting = signal(false, ...(ngDevMode ? [{ debugName: "exporting" }] : /* istanbul ignore next */ []));
687
+ exportFailed = signal(false, ...(ngDevMode ? [{ debugName: "exportFailed" }] : /* istanbul ignore next */ []));
688
+ chartOpen = computed(() => !!this.grid()?.api.getChartModels().length, ...(ngDevMode ? [{ debugName: "chartOpen" }] : /* istanbul ignore next */ []));
689
+ search = signal('', ...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
690
+ reload = signal(0, ...(ngDevMode ? [{ debugName: "reload" }] : /* istanbul ignore next */ []));
691
+ hydrated = signal(null, ...(ngDevMode ? [{ debugName: "hydrated" }] : /* istanbul ignore next */ []));
692
+ focusHeight = signal(600, ...(ngDevMode ? [{ debugName: "focusHeight" }] : /* istanbul ignore next */ []));
693
+ normalHeight = signal(0, ...(ngDevMode ? [{ debugName: "normalHeight" }] : /* istanbul ignore next */ []));
694
+ focusOrigin = null;
695
+ exportController = null;
696
+ activeScope = null;
697
+ preferenceKey = null;
698
+ chartsHydrated = null;
699
+ direction = computed(() => this.configuration.direction?.() ??
700
+ (this.text.language().startsWith('ar') ? 'rtl' : 'ltr'), ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
701
+ displayedRows = computed(() => this.source() ? this.loadedRows() : this.rows(), ...(ngDevMode ? [{ debugName: "displayedRows" }] : /* istanbul ignore next */ []));
702
+ busy = computed(() => this.loading() || this.fetching(), ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
703
+ analysisEnabled = computed(() => this.profile() === 'studio' && this.complete(), ...(ngDevMode ? [{ debugName: "analysisEnabled" }] : /* istanbul ignore next */ []));
704
+ chartsEnabled = computed(() => this.analysisEnabled() && (this.source()?.capabilities.charts ?? true), ...(ngDevMode ? [{ debugName: "chartsEnabled" }] : /* istanbul ignore next */ []));
705
+ exportAllowed = computed(() => this.source()?.capabilities.exportAll ?? true, ...(ngDevMode ? [{ debugName: "exportAllowed" }] : /* istanbul ignore next */ []));
706
+ sideBar = computed(() => ({
707
+ toolPanels: ['columns', 'filters'],
708
+ position: this.direction() === 'rtl' ? 'left' : 'right',
709
+ }), ...(ngDevMode ? [{ debugName: "sideBar" }] : /* istanbul ignore next */ []));
710
+ count = computed(() => {
711
+ if (!this.complete())
712
+ return this.total();
713
+ const api = this.grid()?.api;
714
+ if (!api)
715
+ return this.displayedRows().length;
716
+ const ids = new Set();
717
+ api.forEachNodeAfterFilterAndSort((node) => {
718
+ if (node.detail || node.footer)
719
+ return;
720
+ if (node.group)
721
+ for (const leaf of node.allLeafChildren ?? []) {
722
+ if (!leaf.detail && !leaf.footer)
723
+ ids.add(leaf.id);
724
+ }
725
+ else
726
+ ids.add(node.id);
727
+ });
728
+ return ids.size;
729
+ }, ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
730
+ clientPaging = computed(() => {
731
+ const api = this.grid()?.api;
732
+ return (this.complete() &&
733
+ !this.masterDetail() &&
734
+ !api?.getRowGroupColumns().length &&
735
+ !api?.isPivotMode() &&
736
+ (this.profile() !== 'embedded' || this.displayedRows().length > 100));
737
+ }, ...(ngDevMode ? [{ debugName: "clientPaging" }] : /* istanbul ignore next */ []));
738
+ pagingInfo = computed(() => {
739
+ if (this.complete() && !this.clientPaging())
740
+ return null;
741
+ const api = this.grid()?.api, size = this.complete()
742
+ ? (api?.paginationGetPageSize() ?? 100)
743
+ : this.query().limit;
744
+ const page = this.complete()
745
+ ? (api?.paginationGetCurrentPage() ?? 0)
746
+ : Math.floor(this.query().offset / size);
747
+ const total = this.count(), pages = Math.max(1, Math.ceil(total / size));
748
+ return {
749
+ size,
750
+ page,
751
+ total,
752
+ pages,
753
+ first: total ? page * size + 1 : 0,
754
+ last: Math.min((page + 1) * size, total),
755
+ };
756
+ }, ...(ngDevMode ? [{ debugName: "pagingInfo" }] : /* istanbul ignore next */ []));
757
+ selection = computed(() => this.selectable() || this.profile() === 'studio'
758
+ ? { mode: 'multiRow', enableClickSelection: false }
759
+ : undefined, ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
760
+ resolvedColumns = computed(() => {
761
+ const map = (column) => 'children' in column
762
+ ? { ...column, children: column.children.map(map) }
763
+ : {
764
+ ...column,
765
+ sortable: this.source()?.capabilities.sort === false
766
+ ? false
767
+ : column.sortable,
768
+ filter: this.source()?.capabilities.filter === false
769
+ ? false
770
+ : column.filter,
771
+ editable: this.profile() === 'studio' || this.readOnly()
772
+ ? false
773
+ : column.editable,
774
+ suppressPaste: this.profile() === 'studio' || this.readOnly()
775
+ ? true
776
+ : column.suppressPaste,
777
+ suppressFillHandle: this.profile() === 'studio' || this.readOnly()
778
+ ? true
779
+ : column.suppressFillHandle,
780
+ enableRowGroup: (this.analysisEnabled() || this.groupable()) &&
781
+ (this.source()?.capabilities.group ?? true) &&
782
+ this.complete() &&
783
+ column.enableRowGroup,
784
+ enableValue: this.analysisEnabled() && column.enableValue,
785
+ enablePivot: this.analysisEnabled() &&
786
+ (this.source()?.capabilities.pivot ?? true) &&
787
+ column.enablePivot,
788
+ // Saved/default analysis roles cannot turn themselves on in compact or partial-result tables.
789
+ rowGroup: (this.analysisEnabled() || this.groupable()) &&
790
+ this.complete() &&
791
+ (this.source()?.capabilities.group ?? true)
792
+ ? column.rowGroup
793
+ : false,
794
+ aggFunc: this.analysisEnabled() ? column.aggFunc : null,
795
+ pivot: this.analysisEnabled() &&
796
+ (this.source()?.capabilities.pivot ?? true)
797
+ ? column.pivot
798
+ : false,
799
+ };
800
+ const columns = this.columns().map(map);
801
+ if (this.rowActions().length && this.profile() !== 'studio')
802
+ columns.push({
803
+ colId: MT_TABLE_ACTIONS_COLUMN,
804
+ headerName: this.text.text('actions'),
805
+ initialWidth: 88,
806
+ minWidth: 88,
807
+ maxWidth: 88,
808
+ resizable: false,
809
+ pinned: this.direction() === 'rtl' ? 'left' : 'right',
810
+ sortable: false,
811
+ filter: false,
812
+ lockVisible: true,
813
+ lockPosition: true,
814
+ suppressHeaderMenuButton: true,
815
+ cellRenderer: (MtDataTableRowActions),
816
+ cellRendererParams: { actions: this.rowActions() },
817
+ });
818
+ return columns;
819
+ }, ...(ngDevMode ? [{ debugName: "resolvedColumns" }] : /* istanbul ignore next */ []));
820
+ policyColumns = computed(() => {
821
+ const flatten = (columns) => columns.flatMap((column) => 'children' in column ? flatten(column.children) : [column]);
822
+ return flatten(this.resolvedColumns());
823
+ }, ...(ngDevMode ? [{ debugName: "policyColumns" }] : /* istanbul ignore next */ []));
824
+ viewStamp = computed(() => {
825
+ const view = this.viewIdentity(), key = view ? this.preferences.key(view) : null;
826
+ return key
827
+ ? JSON.stringify([
828
+ key,
829
+ this.profile(),
830
+ this.complete(),
831
+ this.groupable(),
832
+ this.policyColumns().map((column) => [
833
+ column.colId ?? column.field,
834
+ column.sortable,
835
+ column.filter !== false,
836
+ column.enableRowGroup,
837
+ column.enableValue,
838
+ column.enablePivot,
839
+ column.allowedAggFuncs,
840
+ ]),
841
+ ])
842
+ : null;
843
+ }, ...(ngDevMode ? [{ debugName: "viewStamp" }] : /* istanbul ignore next */ []));
844
+ columnChoices = computed(() => {
845
+ const state = new Map(this.grid()
846
+ ?.api.getColumnState()
847
+ .map((column) => [column.colId, column]) ?? []);
848
+ const flatten = (columns) => columns.flatMap((column) => 'children' in column ? flatten(column.children) : [column]);
849
+ return flatten(this.columns()).map((column, index) => {
850
+ const id = column.colId ?? column.field ?? String(index);
851
+ return {
852
+ id,
853
+ label: column.headerName ?? id,
854
+ visible: !(state.get(id)?.hide ?? column.hide ?? column.initialHide),
855
+ locked: column.lockVisible,
856
+ };
857
+ });
858
+ }, ...(ngDevMode ? [{ debugName: "columnChoices" }] : /* istanbul ignore next */ []));
859
+ groupingItems = computed(() => [
860
+ {
861
+ label: this.text.text('noGrouping'),
862
+ command: () => this.grid()?.api.setRowGroupColumns([]),
863
+ },
864
+ ...this.policyColumns()
865
+ .filter((column) => column.enableRowGroup && column.colId !== MT_TABLE_ACTIONS_COLUMN)
866
+ .map((column) => ({
867
+ label: column.headerName ?? column.colId ?? column.field,
868
+ command: () => this.grid()?.api.setRowGroupColumns([column.colId ?? column.field]),
869
+ })),
870
+ ], ...(ngDevMode ? [{ debugName: "groupingItems" }] : /* istanbul ignore next */ []));
871
+ exportItems = computed(() => this.exportFormats().map((format) => ({
872
+ label: this.text.text(format),
873
+ disabled: this.exporting() ||
874
+ this.busy() ||
875
+ (!this.complete() && !this.exporter()),
876
+ command: () => {
877
+ void this.export(format);
878
+ },
879
+ })), ...(ngDevMode ? [{ debugName: "exportItems" }] : /* istanbul ignore next */ []));
880
+ fitWidth() {
881
+ const api = this.grid()?.api;
882
+ if (!api || !this.fitColumns() || this.focused())
883
+ return;
884
+ const definitions = new Map(this.policyColumns().map((column) => [
885
+ column.colId ?? column.field,
886
+ column,
887
+ ]));
888
+ const state = api.getColumnState().filter((column) => !column.hide);
889
+ const width = this.host.nativeElement.querySelector('mt-data-grid')
890
+ ?.clientWidth ?? this.host.nativeElement.clientWidth;
891
+ if (!width)
892
+ return;
893
+ const widths = fitMtTableColumns(state.map((column) => ({
894
+ colId: column.colId,
895
+ width: column.width ?? 180,
896
+ min: definitions.get(column.colId)?.minWidth ?? 100,
897
+ max: definitions.get(column.colId)?.maxWidth,
898
+ })), width);
899
+ if (widths.some((column) => Math.abs(column.width -
900
+ (state.find((entry) => entry.colId === column.colId)?.width ?? 0)) > 1))
901
+ api.setColumnWidths(widths);
902
+ }
903
+ constructor() {
904
+ afterNextRender(() => {
905
+ const body = this.host.nativeElement.querySelector('.mt-data-table-body');
906
+ if (!body)
907
+ return;
908
+ const observer = new ResizeObserver(() => {
909
+ this.fitWidth();
910
+ if (this.focused())
911
+ this.focusHeight.set(Math.max(120, body.clientHeight -
912
+ (this.chartDock()?.nativeElement.clientHeight ?? 0)));
913
+ });
914
+ observer.observe(body);
915
+ const dock = this.chartDock()?.nativeElement;
916
+ if (dock)
917
+ observer.observe(dock);
918
+ this.destroyRef.onDestroy(() => observer.disconnect());
919
+ });
920
+ effect((onCleanup) => {
921
+ const source = this.source(), query = this.query();
922
+ this.reload();
923
+ const identity = this.configuration.identity();
924
+ const scope = JSON.stringify([identity, source?.scopeKey ?? null]);
925
+ if (scope !== this.activeScope) {
926
+ this.activeScope = scope;
927
+ this.chartsHydrated = null;
928
+ this.loadedRows.set([]);
929
+ this.total.set(0);
930
+ this.selectionChange.emit([]);
931
+ if (source)
932
+ this.complete.set(false);
933
+ this.error.set(false);
934
+ this.exportController?.abort();
935
+ this.exporting.set(false);
936
+ untracked(() => {
937
+ const api = this.grid()?.api;
938
+ api?.deselectAll();
939
+ api?.clearCellSelection();
940
+ api
941
+ ?.getChartModels()
942
+ .forEach((chart) => api.destroyChart(chart.chartId));
943
+ });
944
+ }
945
+ if (!source) {
946
+ this.complete.set(true);
947
+ this.fetching.set(false);
948
+ return;
949
+ }
950
+ const controller = new AbortController();
951
+ onCleanup(() => controller.abort());
952
+ this.fetching.set(true);
953
+ this.error.set(false);
954
+ const getRowId = this.getRowId();
955
+ void loadMtTableResult(source, query, controller.signal, getRowId).then((result) => {
956
+ if (controller.signal.aborted)
957
+ return;
958
+ this.loadedRows.set(result.rows);
959
+ this.total.set(result.totalCount);
960
+ this.complete.set(result.complete);
961
+ this.fetching.set(false);
962
+ }, () => {
963
+ if (controller.signal.aborted)
964
+ return;
965
+ this.error.set(true);
966
+ this.complete.set(false);
967
+ this.fetching.set(false);
968
+ });
969
+ });
970
+ effect(() => {
971
+ const grid = this.grid(), view = this.viewIdentity();
972
+ const key = view ? this.preferences.key(view) : null;
973
+ const complete = this.complete();
974
+ const stamp = this.viewStamp();
975
+ if (!grid || !view || !key || stamp === this.hydrated())
976
+ return;
977
+ untracked(() => {
978
+ if (this.preferenceKey !== null && this.preferenceKey !== key) {
979
+ grid.api.setPivotMode(false);
980
+ grid.api.setRowGroupColumns([]);
981
+ grid.api.setValueColumns([]);
982
+ grid.api.setPivotColumns([]);
983
+ grid.api.setFilterModel({});
984
+ grid.api.setSortModel([]);
985
+ grid.api.resetColumnState();
986
+ grid.api.deselectAll();
987
+ grid.api.clearCellSelection();
988
+ this.setSearch('');
989
+ }
990
+ this.preferenceKey = key;
991
+ const saved = this.preferences.read(view);
992
+ if (saved)
993
+ applyGridViewState(grid.api, reconcileMtTableView(saved, this.policyColumns(), {
994
+ grouping: complete &&
995
+ (this.profile() === 'studio' || this.groupable()) &&
996
+ (this.source()?.capabilities.group ?? true),
997
+ values: this.profile() === 'studio' && complete,
998
+ pivot: this.profile() === 'studio' &&
999
+ complete &&
1000
+ (this.source()?.capabilities.pivot ?? true),
1001
+ }));
1002
+ });
1003
+ this.hydrated.set(stamp);
1004
+ });
1005
+ effect(() => {
1006
+ const grid = this.grid(), view = this.viewIdentity();
1007
+ if (!grid || !view || this.hydrated() !== this.viewStamp())
1008
+ return;
1009
+ const state = captureGridViewState(grid.api);
1010
+ untracked(() => {
1011
+ const saved = this.preferences.read(view);
1012
+ this.preferences.write(view, !this.complete() && saved
1013
+ ? {
1014
+ ...state,
1015
+ rowGroups: saved.rowGroups,
1016
+ values: saved.values,
1017
+ pivot: saved.pivot,
1018
+ }
1019
+ : state);
1020
+ this.viewStateChange.emit(state);
1021
+ });
1022
+ });
1023
+ this.destroyRef.onDestroy(() => {
1024
+ this.exportController?.abort();
1025
+ this.focusOrigin = null;
1026
+ });
1027
+ effect(() => {
1028
+ const api = this.grid()?.api, view = this.viewIdentity(), dock = this.chartDock()?.nativeElement;
1029
+ const scope = this.source()?.viewScopeKey ?? this.source()?.scopeKey ?? 'client';
1030
+ const preference = view ? this.preferences.key(view) : null;
1031
+ if (!api ||
1032
+ !view ||
1033
+ !dock ||
1034
+ !preference ||
1035
+ this.busy() ||
1036
+ !this.chartsEnabled())
1037
+ return;
1038
+ const key = `${preference}:${scope}`;
1039
+ if (this.chartsHydrated !== key) {
1040
+ untracked(() => {
1041
+ for (const saved of this.preferences.readCharts(view, scope)) {
1042
+ const options = restoreMtTableChart(saved, api);
1043
+ if (options) {
1044
+ api.createRangeChart({
1045
+ ...options,
1046
+ chartContainer: dock,
1047
+ });
1048
+ }
1049
+ }
1050
+ });
1051
+ this.chartsHydrated = key;
1052
+ }
1053
+ const charts = api
1054
+ .getChartModels()
1055
+ .map((model) => captureMtTableChart(model, api));
1056
+ untracked(() => this.preferences.writeCharts(view, scope, charts));
1057
+ });
1058
+ }
1059
+ setSearch(value) {
1060
+ this.search.set(value);
1061
+ if (this.source()?.processing === 'server')
1062
+ this.query.update((query) => ({ ...query, search: value, offset: 0 }));
1063
+ }
1064
+ /** Complete query scope for record/level exports and cross-record analysis. Never derived from loaded rows. */
1065
+ getQuery() {
1066
+ const api = this.grid()?.api;
1067
+ return {
1068
+ ...this.query(),
1069
+ sort: api?.getSortModel() ?? [],
1070
+ filters: api?.getFilterModel() ?? {},
1071
+ search: this.search(),
1072
+ groupColumns: api?.getRowGroupColumns() ?? [],
1073
+ valueColumns: api?.getValueColumnState() ?? [],
1074
+ pivotColumns: api?.getPivotColumns() ?? [],
1075
+ };
1076
+ }
1077
+ sorted(sort) {
1078
+ for (const column of sort)
1079
+ this.columnLoadRequested.emit(column.colId);
1080
+ if (this.source()?.processing === 'server')
1081
+ this.query.update((query) => ({ ...query, sort, offset: 0 }));
1082
+ }
1083
+ filtered() {
1084
+ for (const column of Object.keys(this.grid()?.api.getFilterModel() ?? {}))
1085
+ this.columnLoadRequested.emit(column);
1086
+ if (this.source()?.processing === 'server')
1087
+ this.query.update((query) => ({
1088
+ ...query,
1089
+ filters: this.grid()?.api.getFilterModel() ?? {},
1090
+ offset: 0,
1091
+ }));
1092
+ }
1093
+ selected() {
1094
+ this.selectionChange.emit(this.grid()?.api.getSelectedRows() ?? []);
1095
+ }
1096
+ changeColumn(id, visible) {
1097
+ if (visible)
1098
+ this.columnLoadRequested.emit(id);
1099
+ this.grid()?.api.setColumnsVisible([id], visible);
1100
+ this.fitWidth();
1101
+ }
1102
+ columnsVisible(ids) {
1103
+ const visible = new Set(this.grid()
1104
+ ?.api.getColumnState()
1105
+ .filter((column) => !column.hide)
1106
+ .map((column) => column.colId));
1107
+ for (const id of ids)
1108
+ if (visible.has(id))
1109
+ this.columnLoadRequested.emit(id);
1110
+ }
1111
+ analysisFieldsChanged() {
1112
+ const api = this.grid()?.api;
1113
+ for (const id of new Set([
1114
+ ...(api?.getRowGroupColumns() ?? []),
1115
+ ...(api?.getValueColumns() ?? []),
1116
+ ...(api?.getPivotColumns() ?? []),
1117
+ ]))
1118
+ this.columnLoadRequested.emit(id);
1119
+ }
1120
+ retry() {
1121
+ this.reload.update((value) => value + 1);
1122
+ }
1123
+ page(direction) {
1124
+ if (this.complete()) {
1125
+ const api = this.grid()?.api;
1126
+ api?.paginationGoToPage(api.paginationGetCurrentPage() + direction);
1127
+ return;
1128
+ }
1129
+ this.query.update((query) => ({
1130
+ ...query,
1131
+ offset: Math.max(0, query.offset + direction * query.limit),
1132
+ }));
1133
+ }
1134
+ pageSize(size) {
1135
+ if (Number.isSafeInteger(size) && size > 0)
1136
+ this.grid()?.api.paginationSetPageSize(size);
1137
+ }
1138
+ pageNumber(page) {
1139
+ const info = this.pagingInfo();
1140
+ if (!info || !Number.isSafeInteger(page))
1141
+ return;
1142
+ const target = Math.max(0, Math.min(info.pages - 1, page - 1));
1143
+ if (this.complete())
1144
+ this.grid()?.api.paginationGoToPage(target);
1145
+ else
1146
+ this.query.update((query) => ({ ...query, offset: target * info.size }));
1147
+ }
1148
+ number(value) {
1149
+ return new Intl.NumberFormat(this.text.language()).format(value);
1150
+ }
1151
+ openAnalysis() {
1152
+ const api = this.grid()?.api;
1153
+ if (api?.isToolPanelShowing()) {
1154
+ api.closeToolPanel();
1155
+ api.setSideBarVisible(false);
1156
+ }
1157
+ else {
1158
+ api?.setSideBarVisible(true);
1159
+ api?.openToolPanel('columns');
1160
+ }
1161
+ }
1162
+ focus(event) {
1163
+ this.focusOrigin = event.currentTarget;
1164
+ this.normalHeight.set(this.host.nativeElement.getBoundingClientRect().height);
1165
+ this.focusHeight.set(Math.max(240, window.innerHeight - 200));
1166
+ this.focused.set(true);
1167
+ this.focusChange.emit(true);
1168
+ }
1169
+ closeFocus() {
1170
+ if (!this.focused())
1171
+ return;
1172
+ this.focused.set(false);
1173
+ this.focusChange.emit(false);
1174
+ afterNextRender(() => this.focusOrigin?.focus(), {
1175
+ injector: this.injector,
1176
+ });
1177
+ }
1178
+ escape(event) {
1179
+ const menus = this.host.nativeElement.querySelectorAll('details[open]');
1180
+ if (menus.length) {
1181
+ for (const menu of menus)
1182
+ menu.open = false;
1183
+ event.stopPropagation();
1184
+ }
1185
+ else
1186
+ this.closeFocus();
1187
+ }
1188
+ chartTable() {
1189
+ const grid = this.grid(), dock = this.chartDock()?.nativeElement;
1190
+ if (!grid || !dock || !this.chartsEnabled())
1191
+ return;
1192
+ grid.api.createRangeChart({
1193
+ cellRange: {
1194
+ columns: grid.api.isPivotMode()
1195
+ ? [
1196
+ ...grid.api.getRowGroupColumns(),
1197
+ ...(grid.api.getPivotResultColumns().length
1198
+ ? grid.api.getPivotResultColumns()
1199
+ : grid.api.getValueColumns()),
1200
+ ]
1201
+ : [
1202
+ ...grid.api.getRowGroupColumns(),
1203
+ ...this.columnChoices()
1204
+ .filter((column) => column.visible)
1205
+ .map((column) => column.id),
1206
+ ],
1207
+ rowIds: null,
1208
+ },
1209
+ chartContainer: dock,
1210
+ title: this.title(),
1211
+ });
1212
+ }
1213
+ chartSelection() {
1214
+ const api = this.grid()?.api, dock = this.chartDock()?.nativeElement;
1215
+ if (!api || !dock || !this.chartsEnabled())
1216
+ return;
1217
+ const offset = this.clientPaging()
1218
+ ? api.paginationGetCurrentPage() * api.paginationGetPageSize()
1219
+ : 0;
1220
+ const ids = [];
1221
+ api.forEachNodeAfterFilterAndSort((node) => ids.push(node.id));
1222
+ const ranges = api.getCellRanges().map((range) => ({
1223
+ columns: range.columns,
1224
+ rowStartIndex: offset + Math.min(range.startRow, range.endRow),
1225
+ rowEndIndex: offset + Math.max(range.startRow, range.endRow),
1226
+ rowIds: ids.slice(offset + Math.min(range.startRow, range.endRow), offset + Math.max(range.startRow, range.endRow) + 1),
1227
+ }));
1228
+ if (!ranges.length)
1229
+ return;
1230
+ api.createRangeChart({
1231
+ cellRange: ranges[0],
1232
+ cellRanges: ranges.slice(1),
1233
+ chartContainer: dock,
1234
+ title: `${this.title()} · ${this.text.text('chartSelection')}`,
1235
+ });
1236
+ }
1237
+ contextMenu = () => [
1238
+ 'copy',
1239
+ 'copyWithHeaders',
1240
+ ...(this.chartsEnabled()
1241
+ ? [
1242
+ {
1243
+ name: this.text.text('chartSelection'),
1244
+ disabled: !this.grid()?.api.getCellRanges().length,
1245
+ action: () => this.chartSelection(),
1246
+ },
1247
+ ]
1248
+ : []),
1249
+ ];
1250
+ resetView() {
1251
+ const view = this.viewIdentity(), api = this.grid()?.api;
1252
+ if (view)
1253
+ this.preferences.clear(view);
1254
+ if (view)
1255
+ this.preferences.writeCharts(view, this.source()?.viewScopeKey ?? this.source()?.scopeKey ?? 'client', []);
1256
+ api?.getChartModels().forEach((chart) => api.destroyChart(chart.chartId));
1257
+ api?.setPivotMode(false);
1258
+ api?.setRowGroupColumns([]);
1259
+ api?.setValueColumns([]);
1260
+ api?.setPivotColumns([]);
1261
+ api?.setFilterModel({});
1262
+ api?.setSortModel([]);
1263
+ api?.resetColumnState();
1264
+ this.setSearch('');
1265
+ }
1266
+ async export(format) {
1267
+ const api = this.grid()?.api;
1268
+ if (!api || this.exporting())
1269
+ return;
1270
+ const exporter = this.exporter();
1271
+ if (!this.complete() && !exporter)
1272
+ return;
1273
+ this.exportController?.abort();
1274
+ const controller = new AbortController();
1275
+ this.exportController = controller;
1276
+ this.exportFailed.set(false);
1277
+ this.exporting.set(true);
1278
+ try {
1279
+ if (exporter)
1280
+ await exporter.export({
1281
+ format,
1282
+ title: this.title(),
1283
+ query: {
1284
+ ...this.query(),
1285
+ sort: api.getSortModel(),
1286
+ filters: api.getFilterModel(),
1287
+ search: this.search(),
1288
+ },
1289
+ rows: this.displayedRows(),
1290
+ complete: this.complete(),
1291
+ visibleColumns: this.columnChoices()
1292
+ .filter((column) => column.visible)
1293
+ .map((column) => column.id),
1294
+ }, controller.signal);
1295
+ else if (format === 'csv')
1296
+ api.exportDataAsCsv({
1297
+ fileName: this.title() || 'table',
1298
+ columnKeys: this.columnChoices()
1299
+ .filter((column) => column.visible)
1300
+ .map((column) => column.id),
1301
+ });
1302
+ else if (format === 'excel')
1303
+ await api.exportDataAsExcel({
1304
+ fileName: this.title() || 'table',
1305
+ columnKeys: this.columnChoices()
1306
+ .filter((column) => column.visible)
1307
+ .map((column) => column.id),
1308
+ });
1309
+ else
1310
+ this.printService.printPdf(mtTablePrintConfiguration(api, this.policyColumns().filter((column) => column.colId !== MT_TABLE_ACTIONS_COLUMN), this.title()));
1311
+ }
1312
+ catch {
1313
+ if (!controller.signal.aborted)
1314
+ this.exportFailed.set(true);
1315
+ }
1316
+ finally {
1317
+ if (this.exportController === controller)
1318
+ this.exporting.set(false);
1319
+ }
1320
+ }
1321
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtDataTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1322
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: MtDataTableComponent, isStandalone: true, selector: "mt-data-table", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, getRowId: { classPropertyName: "getRowId", publicName: "getRowId", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, profile: { classPropertyName: "profile", publicName: "profile", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, showHeading: { classPropertyName: "showHeading", publicName: "showHeading", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, rowHeight: { classPropertyName: "rowHeight", publicName: "rowHeight", isSignal: true, isRequired: false, transformFunction: null }, fitColumns: { classPropertyName: "fitColumns", publicName: "fitColumns", isSignal: true, isRequired: false, transformFunction: null }, rowActions: { classPropertyName: "rowActions", publicName: "rowActions", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, masterDetail: { classPropertyName: "masterDetail", publicName: "masterDetail", isSignal: true, isRequired: false, transformFunction: null }, detailRenderer: { classPropertyName: "detailRenderer", publicName: "detailRenderer", isSignal: true, isRequired: false, transformFunction: null }, detailRendererParams: { classPropertyName: "detailRendererParams", publicName: "detailRendererParams", isSignal: true, isRequired: false, transformFunction: null }, isRowMaster: { classPropertyName: "isRowMaster", publicName: "isRowMaster", isSignal: true, isRequired: false, transformFunction: null }, detailAutoHeight: { classPropertyName: "detailAutoHeight", publicName: "detailAutoHeight", isSignal: true, isRequired: false, transformFunction: null }, detailHeight: { classPropertyName: "detailHeight", publicName: "detailHeight", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, groupable: { classPropertyName: "groupable", publicName: "groupable", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, viewIdentity: { classPropertyName: "viewIdentity", publicName: "viewIdentity", isSignal: true, isRequired: false, transformFunction: null }, exporter: { classPropertyName: "exporter", publicName: "exporter", isSignal: true, isRequired: false, transformFunction: null }, exportFormats: { classPropertyName: "exportFormats", publicName: "exportFormats", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { columnLoadRequested: "columnLoadRequested", rowClick: "rowClick", selectionChange: "selectionChange", focusChange: "focusChange", viewStateChange: "viewStateChange" }, host: { listeners: { "keydown.escape": "escape($event)" }, properties: { "attr.dir": "direction()", "class.mt-data-table-focused": "focused()", "style.min-height.px": "focused() ? normalHeight() : null" } }, viewQueries: [{ propertyName: "grid", first: true, predicate: (MtDataGridComponent), descendants: true, isSignal: true }, { propertyName: "chartDock", first: true, predicate: ["chartDock"], descendants: true, isSignal: true }], ngImport: i0, template: "<section\r\n class=\"mt-data-table-surface\"\r\n [attr.role]=\"focused() ? 'dialog' : null\"\r\n [attr.aria-modal]=\"focused() ? true : null\"\r\n [attr.aria-label]=\"title()\"\r\n [cdkTrapFocus]=\"focused()\"\r\n [cdkTrapFocusAutoCapture]=\"focused()\"\r\n>\r\n @if (profile() !== \"embedded\" || focused()) {\r\n <div class=\"mt-data-table-toolbar\">\r\n @if (showHeading() && title()) {\r\n <div class=\"mt-data-table-heading\">\r\n <strong>{{ title() }}</strong\r\n ><span>{{ count() }} {{ text.text(\"rows\") }}</span>\r\n </div>\r\n }\r\n <label class=\"mt-data-table-search\">\r\n <span class=\"mt-data-table-sr-only\">{{ text.text(\"search\") }}</span>\r\n <mt-text-field\r\n icon=\"general.search-md\"\r\n [placeholder]=\"text.text('search')\"\r\n [ngModel]=\"search()\"\r\n [readonly]=\"source()?.capabilities?.filter === false\"\r\n (ngModelChange)=\"setSearch($event)\"\r\n />\r\n </label>\r\n <div\r\n class=\"mt-data-table-tools\"\r\n role=\"group\"\r\n [attr.aria-label]=\"text.text('actions')\"\r\n >\r\n <mt-button\r\n [label]=\"text.text('columns')\"\r\n icon=\"layout.columns-03\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"columnsPopup.toggle($event)\"\r\n />\r\n <p-popover #columnsPopup appendTo=\"body\">\r\n <div\r\n class=\"mt-data-table-menu-content\"\r\n role=\"group\"\r\n [attr.aria-label]=\"text.text('columns')\"\r\n >\r\n @for (column of columnChoices(); track column.id) {\r\n <label\r\n ><input\r\n type=\"checkbox\"\r\n [checked]=\"column.visible\"\r\n [disabled]=\"column.locked\"\r\n (change)=\"\r\n changeColumn(column.id, $any($event.target).checked)\r\n \"\r\n />{{ column.label }}</label\r\n >\r\n }\r\n <mt-button\r\n [label]=\"text.text('reset')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n (click)=\"resetView()\"\r\n />\r\n </div>\r\n </p-popover>\r\n @if (groupable() && complete()) {\r\n <mt-button\r\n [label]=\"text.text('groupBy')\"\r\n icon=\"layout.columns-03\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"groupMenu.toggle($event)\"\r\n />\r\n <mt-menu\r\n #groupMenu\r\n [model]=\"groupingItems()\"\r\n [ariaLabel]=\"text.text('groupBy')\"\r\n />\r\n }\r\n @if (analysisEnabled()) {\r\n <mt-button\r\n [label]=\"text.text('analysis')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"openAnalysis()\"\r\n />\r\n <mt-button\r\n [label]=\"text.text('chart')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [disabled]=\"!chartsEnabled()\"\r\n (click)=\"chartTable()\"\r\n />\r\n }\r\n @if (exportFormats().length && exportAllowed()) {\r\n <mt-button\r\n [label]=\"text.text('export')\"\r\n icon=\"general.download-01\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [loading]=\"exporting()\"\r\n (click)=\"exportMenu.toggle($event)\"\r\n />\r\n <mt-menu\r\n #exportMenu\r\n [model]=\"exportItems()\"\r\n [ariaLabel]=\"text.text('export')\"\r\n />\r\n }\r\n @if (profile() === \"studio\") {\r\n <mt-button\r\n [label]=\"text.text('closeFocus')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [hidden]=\"!focused()\"\r\n (click)=\"closeFocus()\"\r\n />\r\n <mt-button\r\n [label]=\"text.text('focus')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [hidden]=\"focused()\"\r\n (click)=\"focus($event)\"\r\n />\r\n }\r\n <ng-content select=\"[tableActions]\" />\r\n </div>\r\n </div>\r\n }\r\n @if (error() || exportFailed()) {\r\n <div class=\"mt-data-table-error\" role=\"alert\">\r\n {{ text.text(error() ? \"failed\" : \"exportFailed\") }}\r\n @if (error()) {\r\n <mt-button\r\n [label]=\"text.text('retry')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n (click)=\"retry()\"\r\n />\r\n }\r\n </div>\r\n }\r\n @if (profile() === \"studio\" && !complete()) {\r\n <p class=\"mt-data-table-hint\">{{ text.text(\"incomplete\") }}</p>\r\n }\r\n <div class=\"mt-data-table-body\">\r\n <mt-data-grid\r\n [rowData]=\"displayedRows()\"\r\n [columnDefs]=\"resolvedColumns()\"\r\n [getRowId]=\"getRowId()\"\r\n [height]=\"focused() ? focusHeight() : height()\"\r\n [rowHeight]=\"rowHeight()\"\r\n [direction]=\"direction()\"\r\n [localeText]=\"text.gridLocale()\"\r\n [ariaLabel]=\"title()\"\r\n [loading]=\"busy()\"\r\n [loadingText]=\"text.text('loading')\"\r\n [noRowsText]=\"text.text('noRows')\"\r\n [dataProcessing]=\"complete() ? 'client' : 'external'\"\r\n [quickFilterText]=\"source()?.processing === 'server' ? '' : search()\"\r\n [rowSelection]=\"selection()\"\r\n [cellSelection]=\"profile() === 'studio'\"\r\n [suppressCutToClipboard]=\"true\"\r\n [getContextMenuItems]=\"contextMenu\"\r\n [sideBar]=\"sideBar()\"\r\n [rowGroupPanelShow]=\"analysisEnabled() ? 'onlyWhenGrouping' : 'never'\"\r\n [pivotPanelShow]=\"analysisEnabled() ? 'onlyWhenPivoting' : 'never'\"\r\n [enableCharts]=\"chartsEnabled()\"\r\n [masterDetail]=\"masterDetail()\"\r\n [detailCellRenderer]=\"detailRenderer()\"\r\n [detailCellRendererParams]=\"detailRendererParams()\"\r\n [isRowMaster]=\"isRowMaster()\"\r\n [detailRowAutoHeight]=\"detailAutoHeight()\"\r\n [detailRowHeight]=\"detailHeight()\"\r\n [pagination]=\"clientPaging()\"\r\n [paginationPageSize]=\"100\"\r\n [suppressPdfExport]=\"true\"\r\n [suppressCsvExport]=\"!complete() || !!exporter()\"\r\n [suppressExcelExport]=\"!complete() || !!exporter()\"\r\n (sortChanged)=\"sorted($event)\"\r\n (filterChanged)=\"filtered()\"\r\n (rowClicked)=\"$event.node.data && rowClick.emit($event.node.data)\"\r\n (selectionChanged)=\"selected()\"\r\n (columnVisible)=\"columnsVisible($event.columns)\"\r\n (columnRowGroupChanged)=\"analysisFieldsChanged()\"\r\n (columnValueChanged)=\"analysisFieldsChanged()\"\r\n (columnPivotChanged)=\"analysisFieldsChanged()\"\r\n />\r\n <div\r\n #chartDock\r\n class=\"mt-data-table-chart-dock\"\r\n [class.mt-data-table-chart-open]=\"chartOpen() && chartsEnabled()\"\r\n ></div>\r\n </div>\r\n @if (pagingInfo(); as paging) {\r\n <div class=\"mt-data-table-pagination\">\r\n @if (complete()) {\r\n <label\r\n >{{ text.text(\"pageSize\") }}\r\n <select\r\n [value]=\"paging.size\"\r\n (change)=\"pageSize(+$any($event.target).value)\"\r\n >\r\n @for (size of [20, 50, 100]; track size) {\r\n <option [value]=\"size\">{{ number(size) }}</option>\r\n }\r\n </select></label\r\n >\r\n }\r\n <mt-button\r\n [label]=\"text.text('previous')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [disabled]=\"busy() || paging.page === 0\"\r\n (click)=\"page(-1)\"\r\n />\r\n <bdi\r\n >{{ number(paging.first) }}\u2013{{ number(paging.last) }} /\r\n {{ number(paging.total) }}</bdi\r\n >\r\n <label\r\n >{{ text.text(\"page\") }}\r\n <input\r\n type=\"number\"\r\n min=\"1\"\r\n [max]=\"paging.pages\"\r\n [value]=\"paging.page + 1\"\r\n [disabled]=\"busy()\"\r\n (change)=\"pageNumber(+$any($event.target).value)\"\r\n /></label>\r\n <mt-button\r\n class=\"mt-data-table-next\"\r\n [label]=\"text.text('next')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [disabled]=\"busy() || paging.page + 1 >= paging.pages\"\r\n (click)=\"page(1)\"\r\n />\r\n </div>\r\n }\r\n</section>\r\n", styles: [":host{display:block;min-width:0;color:var(--p-text-color, #25354a);font:inherit}.mt-data-table-surface{min-width:0;background:var(--p-content-background, #fff);border:1px solid var(--p-content-border-color, #e4e7ec);border-radius:var(--p-content-border-radius, 10px);overflow:hidden}.mt-data-table-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:16px;min-height:68px;box-sizing:border-box;border-bottom:1px solid var(--p-content-border-color, #e4e7ec)}.mt-data-table-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-inline-start:auto}.mt-data-table-search{display:block;flex:1 1 200px;max-width:300px;min-width:160px}.mt-data-table-search mt-text-field{min-width:0}:host ::ng-deep mt-data-grid{padding:0;border:0;border-radius:0}.mt-data-table-heading{display:flex;align-items:baseline;gap:8px;margin-inline-end:auto}.mt-data-table-heading span,.mt-data-table-hint{color:var(--p-text-muted-color, #667085);font-size:12px}.mt-data-table-search input,button,summary{min-height:34px;border:1px solid var(--p-content-border-color, #e4e7ec);border-radius:6px;background:var(--p-content-background, #fff);color:inherit;font:inherit;padding:6px 10px}button,summary{cursor:pointer;list-style:none;font-size:13px}button:hover,summary:hover{background:var(--p-content-hover-background, #f3f6f8)}button:disabled{opacity:.5;cursor:default}input:focus-visible,button:focus-visible,summary:focus-visible{outline:2px solid var(--p-primary-color, #2aaec0);outline-offset:2px}.mt-data-table-menu{position:relative}.mt-data-table-menu-content{display:flex;flex-direction:column;min-width:210px;max-height:320px;overflow:auto;padding:2px}.mt-data-table-menu-content label{display:flex;align-items:center;gap:8px;padding:6px;font-size:13px}.mt-data-table-menu-content button{border:0;text-align:start}.mt-data-table-hint,.mt-data-table-error{margin:0;padding:8px 12px}.mt-data-table-error{display:flex;align-items:center;justify-content:space-between;color:var(--p-red-600, #b42318)}.mt-data-table-body{min-width:0}.mt-data-table-chart-dock{display:none;min-height:300px}.mt-data-table-chart-open{display:block}.mt-data-table-pagination{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:16px;padding:10px 12px;font-size:13px;border-top:1px solid var(--p-content-border-color, #e4e7ec)}.mt-data-table-pagination label{display:flex;align-items:center;gap:6px}.mt-data-table-pagination input{width:4.5em}.mt-data-table-pagination input,.mt-data-table-pagination select{box-sizing:border-box;padding:6px;min-height:34px;border:1px solid var(--p-content-border-color, #ddd);border-radius:6px;background:var(--p-content-background, white);color:inherit;font:inherit}:host ::ng-deep mt-data-grid>.mt-grid-main>mt-grid-pager{display:none}.mt-data-table-sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}:host.mt-data-table-focused>.mt-data-table-surface{position:fixed;inset:var(--mt-data-table-focus-inset, 16px);z-index:var(--mt-data-table-focus-z-index, 1000);overflow:auto;box-shadow:0 12px 60px #0005;border-radius:var(--p-content-border-radius, 6px);display:flex;flex-direction:column}:host.mt-data-table-focused .mt-data-table-body{display:flex;flex-direction:column;flex:1;min-height:120px;overflow:auto}:host.mt-data-table-focused .mt-data-table-chart-open{height:max(300px,45%);flex:0 0 max(300px,45%);overflow:auto}:host.mt-data-table-focused .mt-data-table-toolbar,:host.mt-data-table-focused .mt-data-table-pagination{flex-shrink:0}@media(max-width:640px){.mt-data-table-menu-content{min-width:0;max-width:calc(100vw - 64px);max-height:60dvh}.mt-data-table-search{width:100%;max-width:none;flex-basis:100%}.mt-data-table-search input{box-sizing:border-box;width:100%}:host.mt-data-table-focused>.mt-data-table-surface{inset:4px}}\n"], dependencies: [{ kind: "component", type: MtDataGridComponent, selector: "mt-data-grid", inputs: ["rowData", "dataProcessing", "columnDefs", "getRowId", "height", "autoHeight", "autoHeightMaxRows", "autoHeightMinRows", "rowHeight", "animateRows", "headerHeight", "groupHeaderHeight", "direction", "localeText", "localeTextResolver", "ariaLabel", "loading", "noRowsText", "loadingText", "noRowsTemplate", "autoSizeStrategy", "columnMenu", "mainMenuItems", "autoSizePadding", "quickFilterText", "showQuickFilter", "includeHiddenColumnsInQuickFilter", "quickFilterParser", "quickFilterMatcher", "cacheQuickFilter", "applyQuickFilterBeforePivotOrAgg", "filtersToolPanelDef", "isExternalFilterPresent", "doesExternalFilterPass", "floatingFiltersHeight", "rowSelection", "selectionColumnDef", "rowNumbers", "rowDragManaged", "rowDragEntireRow", "rowDragMultiRow", "suppressMoveWhenRowDragging", "cellSelection", "statusBar", "suppressContextMenu", "allowContextMenuWithControlKey", "preventDefaultOnContextMenu", "getContextMenuItems", "suppressCsvExport", "suppressExcelExport", "suppressPdfExport", "defaultPdfExportParams", "excelStyles", "processCellForClipboard", "processHeaderForClipboard", "processGroupHeaderForClipboard", "copySelectedRows", "copyHeadersToClipboard", "copyGroupHeadersToClipboard", "clipboardDelimiter", "suppressCopyRowsToClipboard", "suppressCopySingleCellRanges", "suppressCutToClipboard", "defaultCsvExportParams", "defaultExcelExportParams", "groupDisplayType", "groupRowRenderer", "groupRowRendererParams", "suppressGroupRowsSticky", "groupHideOpenParents", "groupHideParentOfSingleChild", "groupRemoveSingleChildren", "groupRemoveLowestSingleChildren", "showOpenedGroup", "groupAggFiltering", "suppressAggFilteredOnly", "aggregateOnlyChangedColumns", "suppressColumnMoveAnimation", "pivotRowTotals", "pivotColumnGroupTotals", "pivotMaxGeneratedColumns", "pivotDefaultExpanded", "pivotSuppressAutoColumn", "suppressExpandablePivotGroups", "processPivotResultColDef", "processPivotResultColGroupDef", "processUnpinnedColumns", "rowGroupPanelShow", "pivotPanelShow", "pivotPanelHint", "groupDefaultExpanded", "autoGroupColumnDef", "groupTotalRow", "grandTotalRow", "aggFuncs", "suppressRowGroupHidesColumns", "suppressMakeColumnVisibleAfterUnGroup", "sideBar", "pivotMode", "suppressAggFuncInHeader", "enableCharts", "chartThemes", "customChartThemes", "chartToolPanelsDef", "chartThemeOverrides", "chartContext", "chartRecordsLabel", "getChartToolbarItems", "groupMaintainOrder", "treeData", "getDataPath", "masterDetail", "isRowMaster", "detailCellRenderer", "detailCellRendererParams", "detailRowHeight", "detailRowAutoHeight", "singleClickEdit", "suppressClickEdit", "stopEditingWhenCellsLoseFocus", "undoRedoCellEditing", "undoRedoCellEditingLimit", "pagination", "paginationPanelShow", "paginationPageSize", "paginationTotalRows", "paginationCurrentPage", "paginationPageSizeSelector", "rowGroupPanelSuppressSort"], outputs: ["displayedColumnsChanged", "columnEverythingChanged", "pivotMaxColumnsExceeded", "gridReady", "sortChanged", "cellFocused", "columnResized", "columnMoved", "columnPinned", "columnVisible", "columnGroupOpened", "filterChanged", "filterModified", "filterOpened", "rowSelected", "selectionChanged", "rowClicked", "rowDragEnter", "rowDragMove", "rowDragLeave", "rowDragEnd", "cellSelectionChanged", "contextMenuVisibleChanged", "rowGroupOpened", "columnRowGroupChanged", "expandOrCollapseAll", "cellEditingStarted", "cellEditingStopped", "cellValueChanged", "pasteStart", "pasteEnd", "fillStart", "fillEnd", "paginationChanged", "toolPanelVisibleChanged", "toolPanelSizeChanged", "columnValueChanged", "columnPivotChanged", "columnPivotModeChanged", "chartCreated", "chartDestroyed", "chartRangeSelectionChanged", "chartOptionsChanged"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: Menu, selector: "mt-menu", inputs: ["model", "popup", "appendTo", "style", "styleClass", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaLabel", "ariaLabelledBy", "id", "tabindex", "activeItemId"], outputs: ["activeItemIdChange", "onShow", "onHide", "onBlur", "onFocus", "onItemSelect"] }, { kind: "component", type: Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1323
+ }
1324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtDataTableComponent, decorators: [{
1325
+ type: Component,
1326
+ args: [{ selector: 'mt-data-table', imports: [
1327
+ MtDataGridComponent,
1328
+ CdkTrapFocus,
1329
+ FormsModule,
1330
+ Button,
1331
+ TextField,
1332
+ Menu,
1333
+ Popover,
1334
+ ], changeDetection: ChangeDetectionStrategy.OnPush, host: {
1335
+ '[attr.dir]': 'direction()',
1336
+ '[class.mt-data-table-focused]': 'focused()',
1337
+ '[style.min-height.px]': 'focused() ? normalHeight() : null',
1338
+ '(keydown.escape)': 'escape($event)',
1339
+ }, template: "<section\r\n class=\"mt-data-table-surface\"\r\n [attr.role]=\"focused() ? 'dialog' : null\"\r\n [attr.aria-modal]=\"focused() ? true : null\"\r\n [attr.aria-label]=\"title()\"\r\n [cdkTrapFocus]=\"focused()\"\r\n [cdkTrapFocusAutoCapture]=\"focused()\"\r\n>\r\n @if (profile() !== \"embedded\" || focused()) {\r\n <div class=\"mt-data-table-toolbar\">\r\n @if (showHeading() && title()) {\r\n <div class=\"mt-data-table-heading\">\r\n <strong>{{ title() }}</strong\r\n ><span>{{ count() }} {{ text.text(\"rows\") }}</span>\r\n </div>\r\n }\r\n <label class=\"mt-data-table-search\">\r\n <span class=\"mt-data-table-sr-only\">{{ text.text(\"search\") }}</span>\r\n <mt-text-field\r\n icon=\"general.search-md\"\r\n [placeholder]=\"text.text('search')\"\r\n [ngModel]=\"search()\"\r\n [readonly]=\"source()?.capabilities?.filter === false\"\r\n (ngModelChange)=\"setSearch($event)\"\r\n />\r\n </label>\r\n <div\r\n class=\"mt-data-table-tools\"\r\n role=\"group\"\r\n [attr.aria-label]=\"text.text('actions')\"\r\n >\r\n <mt-button\r\n [label]=\"text.text('columns')\"\r\n icon=\"layout.columns-03\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"columnsPopup.toggle($event)\"\r\n />\r\n <p-popover #columnsPopup appendTo=\"body\">\r\n <div\r\n class=\"mt-data-table-menu-content\"\r\n role=\"group\"\r\n [attr.aria-label]=\"text.text('columns')\"\r\n >\r\n @for (column of columnChoices(); track column.id) {\r\n <label\r\n ><input\r\n type=\"checkbox\"\r\n [checked]=\"column.visible\"\r\n [disabled]=\"column.locked\"\r\n (change)=\"\r\n changeColumn(column.id, $any($event.target).checked)\r\n \"\r\n />{{ column.label }}</label\r\n >\r\n }\r\n <mt-button\r\n [label]=\"text.text('reset')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n (click)=\"resetView()\"\r\n />\r\n </div>\r\n </p-popover>\r\n @if (groupable() && complete()) {\r\n <mt-button\r\n [label]=\"text.text('groupBy')\"\r\n icon=\"layout.columns-03\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"groupMenu.toggle($event)\"\r\n />\r\n <mt-menu\r\n #groupMenu\r\n [model]=\"groupingItems()\"\r\n [ariaLabel]=\"text.text('groupBy')\"\r\n />\r\n }\r\n @if (analysisEnabled()) {\r\n <mt-button\r\n [label]=\"text.text('analysis')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (click)=\"openAnalysis()\"\r\n />\r\n <mt-button\r\n [label]=\"text.text('chart')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [disabled]=\"!chartsEnabled()\"\r\n (click)=\"chartTable()\"\r\n />\r\n }\r\n @if (exportFormats().length && exportAllowed()) {\r\n <mt-button\r\n [label]=\"text.text('export')\"\r\n icon=\"general.download-01\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [loading]=\"exporting()\"\r\n (click)=\"exportMenu.toggle($event)\"\r\n />\r\n <mt-menu\r\n #exportMenu\r\n [model]=\"exportItems()\"\r\n [ariaLabel]=\"text.text('export')\"\r\n />\r\n }\r\n @if (profile() === \"studio\") {\r\n <mt-button\r\n [label]=\"text.text('closeFocus')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [hidden]=\"!focused()\"\r\n (click)=\"closeFocus()\"\r\n />\r\n <mt-button\r\n [label]=\"text.text('focus')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [hidden]=\"focused()\"\r\n (click)=\"focus($event)\"\r\n />\r\n }\r\n <ng-content select=\"[tableActions]\" />\r\n </div>\r\n </div>\r\n }\r\n @if (error() || exportFailed()) {\r\n <div class=\"mt-data-table-error\" role=\"alert\">\r\n {{ text.text(error() ? \"failed\" : \"exportFailed\") }}\r\n @if (error()) {\r\n <mt-button\r\n [label]=\"text.text('retry')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n (click)=\"retry()\"\r\n />\r\n }\r\n </div>\r\n }\r\n @if (profile() === \"studio\" && !complete()) {\r\n <p class=\"mt-data-table-hint\">{{ text.text(\"incomplete\") }}</p>\r\n }\r\n <div class=\"mt-data-table-body\">\r\n <mt-data-grid\r\n [rowData]=\"displayedRows()\"\r\n [columnDefs]=\"resolvedColumns()\"\r\n [getRowId]=\"getRowId()\"\r\n [height]=\"focused() ? focusHeight() : height()\"\r\n [rowHeight]=\"rowHeight()\"\r\n [direction]=\"direction()\"\r\n [localeText]=\"text.gridLocale()\"\r\n [ariaLabel]=\"title()\"\r\n [loading]=\"busy()\"\r\n [loadingText]=\"text.text('loading')\"\r\n [noRowsText]=\"text.text('noRows')\"\r\n [dataProcessing]=\"complete() ? 'client' : 'external'\"\r\n [quickFilterText]=\"source()?.processing === 'server' ? '' : search()\"\r\n [rowSelection]=\"selection()\"\r\n [cellSelection]=\"profile() === 'studio'\"\r\n [suppressCutToClipboard]=\"true\"\r\n [getContextMenuItems]=\"contextMenu\"\r\n [sideBar]=\"sideBar()\"\r\n [rowGroupPanelShow]=\"analysisEnabled() ? 'onlyWhenGrouping' : 'never'\"\r\n [pivotPanelShow]=\"analysisEnabled() ? 'onlyWhenPivoting' : 'never'\"\r\n [enableCharts]=\"chartsEnabled()\"\r\n [masterDetail]=\"masterDetail()\"\r\n [detailCellRenderer]=\"detailRenderer()\"\r\n [detailCellRendererParams]=\"detailRendererParams()\"\r\n [isRowMaster]=\"isRowMaster()\"\r\n [detailRowAutoHeight]=\"detailAutoHeight()\"\r\n [detailRowHeight]=\"detailHeight()\"\r\n [pagination]=\"clientPaging()\"\r\n [paginationPageSize]=\"100\"\r\n [suppressPdfExport]=\"true\"\r\n [suppressCsvExport]=\"!complete() || !!exporter()\"\r\n [suppressExcelExport]=\"!complete() || !!exporter()\"\r\n (sortChanged)=\"sorted($event)\"\r\n (filterChanged)=\"filtered()\"\r\n (rowClicked)=\"$event.node.data && rowClick.emit($event.node.data)\"\r\n (selectionChanged)=\"selected()\"\r\n (columnVisible)=\"columnsVisible($event.columns)\"\r\n (columnRowGroupChanged)=\"analysisFieldsChanged()\"\r\n (columnValueChanged)=\"analysisFieldsChanged()\"\r\n (columnPivotChanged)=\"analysisFieldsChanged()\"\r\n />\r\n <div\r\n #chartDock\r\n class=\"mt-data-table-chart-dock\"\r\n [class.mt-data-table-chart-open]=\"chartOpen() && chartsEnabled()\"\r\n ></div>\r\n </div>\r\n @if (pagingInfo(); as paging) {\r\n <div class=\"mt-data-table-pagination\">\r\n @if (complete()) {\r\n <label\r\n >{{ text.text(\"pageSize\") }}\r\n <select\r\n [value]=\"paging.size\"\r\n (change)=\"pageSize(+$any($event.target).value)\"\r\n >\r\n @for (size of [20, 50, 100]; track size) {\r\n <option [value]=\"size\">{{ number(size) }}</option>\r\n }\r\n </select></label\r\n >\r\n }\r\n <mt-button\r\n [label]=\"text.text('previous')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [disabled]=\"busy() || paging.page === 0\"\r\n (click)=\"page(-1)\"\r\n />\r\n <bdi\r\n >{{ number(paging.first) }}\u2013{{ number(paging.last) }} /\r\n {{ number(paging.total) }}</bdi\r\n >\r\n <label\r\n >{{ text.text(\"page\") }}\r\n <input\r\n type=\"number\"\r\n min=\"1\"\r\n [max]=\"paging.pages\"\r\n [value]=\"paging.page + 1\"\r\n [disabled]=\"busy()\"\r\n (change)=\"pageNumber(+$any($event.target).value)\"\r\n /></label>\r\n <mt-button\r\n class=\"mt-data-table-next\"\r\n [label]=\"text.text('next')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [disabled]=\"busy() || paging.page + 1 >= paging.pages\"\r\n (click)=\"page(1)\"\r\n />\r\n </div>\r\n }\r\n</section>\r\n", styles: [":host{display:block;min-width:0;color:var(--p-text-color, #25354a);font:inherit}.mt-data-table-surface{min-width:0;background:var(--p-content-background, #fff);border:1px solid var(--p-content-border-color, #e4e7ec);border-radius:var(--p-content-border-radius, 10px);overflow:hidden}.mt-data-table-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:16px;min-height:68px;box-sizing:border-box;border-bottom:1px solid var(--p-content-border-color, #e4e7ec)}.mt-data-table-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-inline-start:auto}.mt-data-table-search{display:block;flex:1 1 200px;max-width:300px;min-width:160px}.mt-data-table-search mt-text-field{min-width:0}:host ::ng-deep mt-data-grid{padding:0;border:0;border-radius:0}.mt-data-table-heading{display:flex;align-items:baseline;gap:8px;margin-inline-end:auto}.mt-data-table-heading span,.mt-data-table-hint{color:var(--p-text-muted-color, #667085);font-size:12px}.mt-data-table-search input,button,summary{min-height:34px;border:1px solid var(--p-content-border-color, #e4e7ec);border-radius:6px;background:var(--p-content-background, #fff);color:inherit;font:inherit;padding:6px 10px}button,summary{cursor:pointer;list-style:none;font-size:13px}button:hover,summary:hover{background:var(--p-content-hover-background, #f3f6f8)}button:disabled{opacity:.5;cursor:default}input:focus-visible,button:focus-visible,summary:focus-visible{outline:2px solid var(--p-primary-color, #2aaec0);outline-offset:2px}.mt-data-table-menu{position:relative}.mt-data-table-menu-content{display:flex;flex-direction:column;min-width:210px;max-height:320px;overflow:auto;padding:2px}.mt-data-table-menu-content label{display:flex;align-items:center;gap:8px;padding:6px;font-size:13px}.mt-data-table-menu-content button{border:0;text-align:start}.mt-data-table-hint,.mt-data-table-error{margin:0;padding:8px 12px}.mt-data-table-error{display:flex;align-items:center;justify-content:space-between;color:var(--p-red-600, #b42318)}.mt-data-table-body{min-width:0}.mt-data-table-chart-dock{display:none;min-height:300px}.mt-data-table-chart-open{display:block}.mt-data-table-pagination{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:16px;padding:10px 12px;font-size:13px;border-top:1px solid var(--p-content-border-color, #e4e7ec)}.mt-data-table-pagination label{display:flex;align-items:center;gap:6px}.mt-data-table-pagination input{width:4.5em}.mt-data-table-pagination input,.mt-data-table-pagination select{box-sizing:border-box;padding:6px;min-height:34px;border:1px solid var(--p-content-border-color, #ddd);border-radius:6px;background:var(--p-content-background, white);color:inherit;font:inherit}:host ::ng-deep mt-data-grid>.mt-grid-main>mt-grid-pager{display:none}.mt-data-table-sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}:host.mt-data-table-focused>.mt-data-table-surface{position:fixed;inset:var(--mt-data-table-focus-inset, 16px);z-index:var(--mt-data-table-focus-z-index, 1000);overflow:auto;box-shadow:0 12px 60px #0005;border-radius:var(--p-content-border-radius, 6px);display:flex;flex-direction:column}:host.mt-data-table-focused .mt-data-table-body{display:flex;flex-direction:column;flex:1;min-height:120px;overflow:auto}:host.mt-data-table-focused .mt-data-table-chart-open{height:max(300px,45%);flex:0 0 max(300px,45%);overflow:auto}:host.mt-data-table-focused .mt-data-table-toolbar,:host.mt-data-table-focused .mt-data-table-pagination{flex-shrink:0}@media(max-width:640px){.mt-data-table-menu-content{min-width:0;max-width:calc(100vw - 64px);max-height:60dvh}.mt-data-table-search{width:100%;max-width:none;flex-basis:100%}.mt-data-table-search input{box-sizing:border-box;width:100%}:host.mt-data-table-focused>.mt-data-table-surface{inset:4px}}\n"] }]
1340
+ }], ctorParameters: () => [], propDecorators: { rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], getRowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "getRowId", required: true }] }], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }], profile: [{ type: i0.Input, args: [{ isSignal: true, alias: "profile", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], showHeading: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHeading", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], fitColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "fitColumns", required: false }] }], rowActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActions", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], masterDetail: [{ type: i0.Input, args: [{ isSignal: true, alias: "masterDetail", required: false }] }], detailRenderer: [{ type: i0.Input, args: [{ isSignal: true, alias: "detailRenderer", required: false }] }], detailRendererParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "detailRendererParams", required: false }] }], isRowMaster: [{ type: i0.Input, args: [{ isSignal: true, alias: "isRowMaster", required: false }] }], detailAutoHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "detailAutoHeight", required: false }] }], detailHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "detailHeight", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], groupable: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupable", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], viewIdentity: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewIdentity", required: false }] }], exporter: [{ type: i0.Input, args: [{ isSignal: true, alias: "exporter", required: false }] }], exportFormats: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportFormats", required: false }] }], columnLoadRequested: [{ type: i0.Output, args: ["columnLoadRequested"] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], focusChange: [{ type: i0.Output, args: ["focusChange"] }], viewStateChange: [{ type: i0.Output, args: ["viewStateChange"] }], grid: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MtDataGridComponent), { isSignal: true }] }], chartDock: [{ type: i0.ViewChild, args: ['chartDock', { isSignal: true }] }] } });
1341
+
1342
+ /** Transitional orchestration for existing portal/Studio consumers. New grids use the primary entity API. */
1343
+
1344
+ /**
1345
+ * Generated bundle index. Do not edit.
1346
+ */
1347
+
1348
+ export { MT_DATA_TABLE_CONFIGURATION, MtDataTableComponent, MtDatasetCache, MtDatasetScheduler, MtIncompleteTableError, MtTablePreferences, captureMtTableChart, loadMtTableResult, mtClientTableSource, mtTablePreferenceKey, parseMtTableCharts, provideMTDataTables, reconcileMtTableView, restoreMtTableChart };
1349
+ //# sourceMappingURL=masterteam-data-table-legacy.mjs.map