@masterteam/data-table 0.0.8 → 0.0.10
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/README.md +104 -5
- package/fesm2022/masterteam-data-table-config.mjs +7 -1
- package/fesm2022/masterteam-data-table-config.mjs.map +1 -1
- package/fesm2022/masterteam-data-table-icons.mjs +2 -0
- package/fesm2022/masterteam-data-table-icons.mjs.map +1 -1
- package/fesm2022/masterteam-data-table-legacy.mjs +4 -7
- package/fesm2022/masterteam-data-table-legacy.mjs.map +1 -1
- package/fesm2022/masterteam-data-table.mjs +877 -14
- package/fesm2022/masterteam-data-table.mjs.map +1 -1
- package/package.json +3 -3
- package/types/masterteam-data-table-config.d.ts +39 -2
- package/types/masterteam-data-table-legacy.d.ts +4 -10
- package/types/masterteam-data-table.d.ts +208 -8
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, ChangeDetectionStrategy, ViewEncapsulation, Component, inject, Injectable, output, viewChild, untracked } from '@angular/core';
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, ViewEncapsulation, Component, inject, Injectable, InjectionToken, output, signal, viewChild, effect, untracked, DestroyRef } from '@angular/core';
|
|
3
3
|
import { currencyUnitOf, EntityPreview, EntityText, EntityRuntimeContextStore } from '@masterteam/components/entities';
|
|
4
4
|
import { TableValueResolver, TableExportService, TableActionsMenu } from '@masterteam/components/table';
|
|
5
|
-
import { AUTO_GROUP_COLUMN_ID, MtDataGridComponent, applyGridViewState, captureGridViewState } from '@masterteam/data-grid';
|
|
5
|
+
import { AUTO_GROUP_COLUMN_ID, CHART_TYPES, MtDataGridComponent, applyGridViewState, captureGridViewState } from '@masterteam/data-grid';
|
|
6
6
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
7
7
|
import { TranslocoService } from '@jsverse/transloco';
|
|
8
|
-
import { observeOn, asapScheduler } from 'rxjs';
|
|
9
|
-
import {
|
|
8
|
+
import { observeOn, asapScheduler, firstValueFrom } from 'rxjs';
|
|
9
|
+
import { MT_DATA_TABLE_CONFIGURATION, mtTablePreferenceKey, MT_GRID_CHART_STORE } from '@masterteam/data-table/config';
|
|
10
10
|
import { Button } from '@masterteam/components/button';
|
|
11
|
+
import { EmptyState } from '@masterteam/components/empty-state';
|
|
12
|
+
import { Menu } from '@masterteam/components/menu';
|
|
13
|
+
import { HttpClient } from '@angular/common/http';
|
|
11
14
|
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
12
15
|
import { Popover } from 'primeng/popover';
|
|
13
16
|
import { Skeleton } from 'primeng/skeleton';
|
|
@@ -574,6 +577,29 @@ const MT_TABLE_GRID_AR = {
|
|
|
574
577
|
'Pin Right': 'تثبيت يمينًا',
|
|
575
578
|
'Autosize This Column': 'ضبط عرض العمود تلقائيًا',
|
|
576
579
|
'Autosize All Columns': 'ضبط عرض كل الأعمدة تلقائيًا',
|
|
580
|
+
'Select Column': 'تحديد العمود',
|
|
581
|
+
'Select All Cells': 'تحديد كل الخلايا',
|
|
582
|
+
'Select column': 'تحديد العمود',
|
|
583
|
+
'Select all cells': 'تحديد كل الخلايا',
|
|
584
|
+
'Sort {column}': 'ترتيب {column}',
|
|
585
|
+
'Sorted ascending, click to sort descending': 'مرتّب تصاعدياً، انقر للترتيب تنازلياً',
|
|
586
|
+
'Sorted descending, click to clear sort': 'مرتّب تنازلياً، انقر لإلغاء الترتيب',
|
|
587
|
+
// Charts: dock, Charts panel, remove and undo.
|
|
588
|
+
'Move to Charts panel': 'نقل إلى لوحة المخططات',
|
|
589
|
+
'Remove chart': 'إزالة المخطط',
|
|
590
|
+
'Chart removed': 'تمت إزالة المخطط',
|
|
591
|
+
Undo: 'تراجع',
|
|
592
|
+
Charts: 'المخططات',
|
|
593
|
+
'No charts yet': 'لا توجد مخططات بعد',
|
|
594
|
+
'Select cells or click a column header, then create a chart.': 'حدّد خلايا أو انقر عنوان عمود، ثم أنشئ مخططاً.',
|
|
595
|
+
'On page': 'على الصفحة',
|
|
596
|
+
Open: 'فتح',
|
|
597
|
+
Rename: 'إعادة تسمية',
|
|
598
|
+
'Columns no longer available': 'الأعمدة لم تعد متاحة',
|
|
599
|
+
'Follow selection': 'تتبّع التحديد',
|
|
600
|
+
'Chart opened': 'تم فتح المخطط',
|
|
601
|
+
'Chart actions': 'إجراءات المخطط',
|
|
602
|
+
'Chart title': 'عنوان المخطط',
|
|
577
603
|
'Reset Columns': 'إعادة ضبط الأعمدة',
|
|
578
604
|
'Group by {column}': 'تجميع حسب {column}',
|
|
579
605
|
'Un-Group by {column}': 'إلغاء التجميع حسب {column}',
|
|
@@ -867,6 +893,17 @@ const TEXT = {
|
|
|
867
893
|
],
|
|
868
894
|
chart: ['Chart table', 'رسم بياني للجدول'],
|
|
869
895
|
chartSelection: ['Chart selection', 'رسم بياني للتحديد'],
|
|
896
|
+
// The standard grid's Chart split button.
|
|
897
|
+
chartAction: ['Chart', 'مخطط'],
|
|
898
|
+
chartTypes: ['Chart type', 'نوع المخطط'],
|
|
899
|
+
chartColumn: ['Column', 'أعمدة'],
|
|
900
|
+
chartBar: ['Bar', 'أشرطة'],
|
|
901
|
+
chartLine: ['Line', 'خطي'],
|
|
902
|
+
chartPie: ['Pie', 'دائري'],
|
|
903
|
+
chartDoughnut: ['Doughnut', 'حلقي'],
|
|
904
|
+
chartNeedsCells: ['Select cells to create a chart', 'حدّد خلايا لإنشاء مخطط'],
|
|
905
|
+
// A server page's charts cover the loaded page: their context line says so.
|
|
906
|
+
chartThisPage: ['this page', 'هذه الصفحة'],
|
|
870
907
|
};
|
|
871
908
|
/** Product translations override package defaults. Language changes remain reactive. */
|
|
872
909
|
class MtTableText {
|
|
@@ -1030,6 +1067,570 @@ function standardColumn(column, options) {
|
|
|
1030
1067
|
};
|
|
1031
1068
|
}
|
|
1032
1069
|
|
|
1070
|
+
/** Most charts one grid keeps; older ones are dropped first. */
|
|
1071
|
+
const MT_GRID_CHARTS_MAX = 20;
|
|
1072
|
+
/** A range with more row ids than this is saved as `rowIds: null` (every row). */
|
|
1073
|
+
const MT_GRID_CHART_MAX_ROW_IDS = 1000;
|
|
1074
|
+
/** Largest saved document, in characters (browser storage) or UTF-8 bytes (server). */
|
|
1075
|
+
const MT_GRID_CHARTS_MAX_LENGTH = 131072;
|
|
1076
|
+
const MAX_LIST = 1000;
|
|
1077
|
+
const MAX_ID = 512;
|
|
1078
|
+
const MAX_CHART_ID = 200;
|
|
1079
|
+
const AGG_FUNCS = [
|
|
1080
|
+
'sum',
|
|
1081
|
+
'avg',
|
|
1082
|
+
'count',
|
|
1083
|
+
'min',
|
|
1084
|
+
'max',
|
|
1085
|
+
'first',
|
|
1086
|
+
'last',
|
|
1087
|
+
];
|
|
1088
|
+
const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
1089
|
+
const isObject = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
1090
|
+
const isId = (value) => typeof value === 'string' && value.length <= MAX_ID;
|
|
1091
|
+
const ids = (value, max = MAX_LIST) => Array.isArray(value) && value.length <= max && value.every(isId);
|
|
1092
|
+
const isChartType = (value) => CHART_TYPES.includes(value);
|
|
1093
|
+
/** A JSON-safe copy without prototype keys, bounded in depth and size (theme overrides). */
|
|
1094
|
+
function plain(value, depth = 0) {
|
|
1095
|
+
if (value === null || typeof value === 'boolean')
|
|
1096
|
+
return value;
|
|
1097
|
+
if (typeof value === 'string')
|
|
1098
|
+
return value.slice(0, 2000);
|
|
1099
|
+
if (typeof value === 'number')
|
|
1100
|
+
return Number.isFinite(value) ? value : null;
|
|
1101
|
+
if (depth >= 8)
|
|
1102
|
+
return undefined;
|
|
1103
|
+
if (Array.isArray(value))
|
|
1104
|
+
return value.slice(0, 200).map((entry) => plain(entry, depth + 1) ?? null);
|
|
1105
|
+
if (!isObject(value))
|
|
1106
|
+
return undefined;
|
|
1107
|
+
const copy = {};
|
|
1108
|
+
for (const [key, entry] of Object.entries(value).slice(0, 200)) {
|
|
1109
|
+
if (UNSAFE_KEYS.has(key))
|
|
1110
|
+
continue;
|
|
1111
|
+
const safe = plain(entry, depth + 1);
|
|
1112
|
+
if (safe !== undefined)
|
|
1113
|
+
copy[key] = safe;
|
|
1114
|
+
}
|
|
1115
|
+
return copy;
|
|
1116
|
+
}
|
|
1117
|
+
function parseRanges(value) {
|
|
1118
|
+
if (!Array.isArray(value) || value.length > MAX_LIST)
|
|
1119
|
+
return null;
|
|
1120
|
+
const ranges = [];
|
|
1121
|
+
for (const range of value) {
|
|
1122
|
+
if (!isObject(range) || !ids(range['columns']))
|
|
1123
|
+
return null;
|
|
1124
|
+
const rowIds = range['rowIds'];
|
|
1125
|
+
if (rowIds !== null && !(Array.isArray(rowIds) && rowIds.every(isId)))
|
|
1126
|
+
return null;
|
|
1127
|
+
const named = rowIds;
|
|
1128
|
+
ranges.push({
|
|
1129
|
+
columns: [...range['columns']],
|
|
1130
|
+
// Too many records to name: the chart follows every row instead of being dropped.
|
|
1131
|
+
rowIds: named === null || named.length > MT_GRID_CHART_MAX_ROW_IDS
|
|
1132
|
+
? null
|
|
1133
|
+
: [...named],
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
return ranges;
|
|
1137
|
+
}
|
|
1138
|
+
function parseBox(value) {
|
|
1139
|
+
if (!isObject(value))
|
|
1140
|
+
return undefined;
|
|
1141
|
+
const { x, y, width, height } = value;
|
|
1142
|
+
const finite = [x, y, width, height].every((entry) => typeof entry === 'number' &&
|
|
1143
|
+
Number.isFinite(entry) &&
|
|
1144
|
+
Math.abs(entry) <= 100000);
|
|
1145
|
+
return finite && width > 0 && height > 0
|
|
1146
|
+
? {
|
|
1147
|
+
x: x,
|
|
1148
|
+
y: y,
|
|
1149
|
+
width: width,
|
|
1150
|
+
height: height,
|
|
1151
|
+
}
|
|
1152
|
+
: undefined;
|
|
1153
|
+
}
|
|
1154
|
+
function parseSeriesChartTypes(value) {
|
|
1155
|
+
if (!Array.isArray(value))
|
|
1156
|
+
return [];
|
|
1157
|
+
return value.slice(0, MAX_LIST).flatMap((series) => isObject(series) &&
|
|
1158
|
+
isId(series['colId']) &&
|
|
1159
|
+
isChartType(series['chartType'])
|
|
1160
|
+
? [
|
|
1161
|
+
{
|
|
1162
|
+
colId: series['colId'],
|
|
1163
|
+
chartType: series['chartType'],
|
|
1164
|
+
secondaryAxis: series['secondaryAxis'] === true,
|
|
1165
|
+
},
|
|
1166
|
+
]
|
|
1167
|
+
: []);
|
|
1168
|
+
}
|
|
1169
|
+
/** One v2 chart, validated field by field; null drops it. */
|
|
1170
|
+
function parseChart(value) {
|
|
1171
|
+
if (!isObject(value))
|
|
1172
|
+
return null;
|
|
1173
|
+
const { chartId, title, chartType, chartContext, categoryId, seriesIds, aggFunc, themeName, themeOverrides, } = value;
|
|
1174
|
+
if (typeof chartId !== 'string' ||
|
|
1175
|
+
!chartId ||
|
|
1176
|
+
chartId.length > MAX_CHART_ID ||
|
|
1177
|
+
!isChartType(chartType))
|
|
1178
|
+
return null;
|
|
1179
|
+
const ranges = parseRanges(value['ranges']);
|
|
1180
|
+
if (!ranges)
|
|
1181
|
+
return null;
|
|
1182
|
+
if (title !== undefined && typeof title !== 'string')
|
|
1183
|
+
return null;
|
|
1184
|
+
if (chartContext !== undefined && typeof chartContext !== 'string')
|
|
1185
|
+
return null;
|
|
1186
|
+
if (categoryId !== undefined && !isId(categoryId))
|
|
1187
|
+
return null;
|
|
1188
|
+
if (seriesIds !== undefined && !ids(seriesIds))
|
|
1189
|
+
return null;
|
|
1190
|
+
const seriesChartTypes = parseSeriesChartTypes(value['seriesChartTypes']);
|
|
1191
|
+
const box = parseBox(value['box']);
|
|
1192
|
+
const overrides = isObject(themeOverrides)
|
|
1193
|
+
? plain(themeOverrides)
|
|
1194
|
+
: undefined;
|
|
1195
|
+
return {
|
|
1196
|
+
chartId,
|
|
1197
|
+
...(title ? { title: title.slice(0, 500) } : {}),
|
|
1198
|
+
chartType,
|
|
1199
|
+
...(chartContext ? { chartContext: chartContext.slice(0, 1000) } : {}),
|
|
1200
|
+
...(categoryId !== undefined ? { categoryId } : {}),
|
|
1201
|
+
// The synthetic measures (`__count__`, `__nonEmpty__:<col>`, `__distinct__:<col>`) stay.
|
|
1202
|
+
...(seriesIds !== undefined ? { seriesIds: [...seriesIds] } : {}),
|
|
1203
|
+
...(AGG_FUNCS.includes(aggFunc)
|
|
1204
|
+
? { aggFunc: aggFunc }
|
|
1205
|
+
: {}),
|
|
1206
|
+
...(seriesChartTypes.length ? { seriesChartTypes } : {}),
|
|
1207
|
+
...(value['switchCategorySeries'] === true
|
|
1208
|
+
? { switchCategorySeries: true }
|
|
1209
|
+
: {}),
|
|
1210
|
+
...(typeof themeName === 'string' && themeName.length <= 100
|
|
1211
|
+
? { themeName }
|
|
1212
|
+
: {}),
|
|
1213
|
+
...(overrides && Object.keys(overrides).length
|
|
1214
|
+
? { themeOverrides: overrides }
|
|
1215
|
+
: {}),
|
|
1216
|
+
ranges,
|
|
1217
|
+
followSelection: value['followSelection'] === true,
|
|
1218
|
+
...(box ? { box } : {}),
|
|
1219
|
+
state: value['state'] === 'open' ? 'open' : 'docked',
|
|
1220
|
+
...(value['unavailable'] === true ? { unavailable: true } : {}),
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* A version-1 chart (`{ options, ranges }`, Studio until 2026-11): its options and ranges
|
|
1225
|
+
* become a docked chart that does not follow the selection.
|
|
1226
|
+
*/
|
|
1227
|
+
function migrateChart(value, index) {
|
|
1228
|
+
const options = value['options'];
|
|
1229
|
+
if (!isObject(options))
|
|
1230
|
+
return null;
|
|
1231
|
+
return parseChart({
|
|
1232
|
+
chartId: `saved-chart-${index + 1}`,
|
|
1233
|
+
title: options['title'],
|
|
1234
|
+
chartType: options['chartType'],
|
|
1235
|
+
chartContext: options['chartContext'],
|
|
1236
|
+
categoryId: options['categoryId'],
|
|
1237
|
+
seriesIds: options['seriesIds'],
|
|
1238
|
+
aggFunc: options['aggFunc'],
|
|
1239
|
+
seriesChartTypes: options['seriesChartTypes'],
|
|
1240
|
+
switchCategorySeries: options['switchCategorySeries'],
|
|
1241
|
+
themeName: options['chartThemeName'],
|
|
1242
|
+
themeOverrides: options['chartThemeOverrides'],
|
|
1243
|
+
ranges: value['ranges'],
|
|
1244
|
+
followSelection: false,
|
|
1245
|
+
state: 'docked',
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Reads a saved chart set: a v2 document, a v2 chart array (the server's `charts`) or a
|
|
1250
|
+
* version-1 array, which migrates. Invalid charts are dropped one by one, duplicate ids
|
|
1251
|
+
* keep their first chart, and only the newest {@link MT_GRID_CHARTS_MAX} survive; anything
|
|
1252
|
+
* else reads as no charts.
|
|
1253
|
+
*/
|
|
1254
|
+
function parseMtGridCharts(value) {
|
|
1255
|
+
const list = Array.isArray(value)
|
|
1256
|
+
? value
|
|
1257
|
+
: isObject(value) &&
|
|
1258
|
+
value['version'] === 2 &&
|
|
1259
|
+
Array.isArray(value['charts'])
|
|
1260
|
+
? value['charts']
|
|
1261
|
+
: null;
|
|
1262
|
+
if (!list)
|
|
1263
|
+
return [];
|
|
1264
|
+
const seen = new Set();
|
|
1265
|
+
const charts = [];
|
|
1266
|
+
list.forEach((entry, index) => {
|
|
1267
|
+
const chart = isObject(entry) && 'options' in entry
|
|
1268
|
+
? migrateChart(entry, index)
|
|
1269
|
+
: parseChart(entry);
|
|
1270
|
+
if (chart && !seen.has(chart.chartId)) {
|
|
1271
|
+
seen.add(chart.chartId);
|
|
1272
|
+
charts.push(chart);
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
return charts.slice(-MT_GRID_CHARTS_MAX);
|
|
1276
|
+
}
|
|
1277
|
+
/** The newest charts whose measure fits `limit`, dropping the oldest first; may be empty. */
|
|
1278
|
+
function fitMtGridCharts(charts, measure, limit = MT_GRID_CHARTS_MAX_LENGTH) {
|
|
1279
|
+
let fitted = charts.slice(-MT_GRID_CHARTS_MAX);
|
|
1280
|
+
while (fitted.length && measure(fitted) > limit)
|
|
1281
|
+
fitted = fitted.slice(1);
|
|
1282
|
+
return fitted;
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* The v2 document text to store: the charts validated, then the oldest dropped until the
|
|
1286
|
+
* text fits `limit` characters. Null when there is nothing to keep (no charts, or not even
|
|
1287
|
+
* one fits), which means the stored document is removed rather than left stale.
|
|
1288
|
+
*/
|
|
1289
|
+
function serializeMtGridCharts(charts, limit = MT_GRID_CHARTS_MAX_LENGTH) {
|
|
1290
|
+
const text = (list) => JSON.stringify({ version: 2, charts: list });
|
|
1291
|
+
const fitted = fitMtGridCharts(parseMtGridCharts(charts), (list) => text(list).length, limit);
|
|
1292
|
+
return fitted.length ? text(fitted) : null;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* The default chart store: the browser's local storage, per signed-in identity. The key is
|
|
1297
|
+
* the view's preference key plus `:charts:<scope>` (the one Studio used for its version-1
|
|
1298
|
+
* charts, which therefore migrate). Without an identity it keeps nothing; storage errors
|
|
1299
|
+
* (private browsing, quota, blocked storage) never reach the grid.
|
|
1300
|
+
*/
|
|
1301
|
+
class MtLocalChartStore {
|
|
1302
|
+
configuration = inject(MT_DATA_TABLE_CONFIGURATION);
|
|
1303
|
+
/** The storage key of a grid's charts; null without an identity. */
|
|
1304
|
+
storageKey(key) {
|
|
1305
|
+
const identity = this.configuration.identity();
|
|
1306
|
+
return identity
|
|
1307
|
+
? `${mtTablePreferenceKey(identity, key.view)}:charts:${key.scope}`
|
|
1308
|
+
: null;
|
|
1309
|
+
}
|
|
1310
|
+
/** The saved charts, read synchronously. */
|
|
1311
|
+
readNow(key) {
|
|
1312
|
+
const storageKey = this.storageKey(key);
|
|
1313
|
+
if (!storageKey)
|
|
1314
|
+
return [];
|
|
1315
|
+
try {
|
|
1316
|
+
const text = localStorage.getItem(storageKey);
|
|
1317
|
+
return text && text.length <= MT_GRID_CHARTS_MAX_LENGTH
|
|
1318
|
+
? parseMtGridCharts(JSON.parse(text))
|
|
1319
|
+
: [];
|
|
1320
|
+
}
|
|
1321
|
+
catch {
|
|
1322
|
+
return [];
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
read(key) {
|
|
1326
|
+
return Promise.resolve(this.readNow(key));
|
|
1327
|
+
}
|
|
1328
|
+
write(key, charts) {
|
|
1329
|
+
const storageKey = this.storageKey(key);
|
|
1330
|
+
if (!storageKey)
|
|
1331
|
+
return;
|
|
1332
|
+
try {
|
|
1333
|
+
const text = serializeMtGridCharts(charts);
|
|
1334
|
+
if (text === null)
|
|
1335
|
+
localStorage.removeItem(storageKey);
|
|
1336
|
+
else
|
|
1337
|
+
localStorage.setItem(storageKey, text);
|
|
1338
|
+
}
|
|
1339
|
+
catch {
|
|
1340
|
+
// A failed write must not leave the previous set behind as if it were current.
|
|
1341
|
+
this.remove(storageKey);
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
clear(key) {
|
|
1345
|
+
const storageKey = this.storageKey(key);
|
|
1346
|
+
if (storageKey)
|
|
1347
|
+
this.remove(storageKey);
|
|
1348
|
+
}
|
|
1349
|
+
remove(storageKey) {
|
|
1350
|
+
try {
|
|
1351
|
+
localStorage.removeItem(storageKey);
|
|
1352
|
+
}
|
|
1353
|
+
catch {
|
|
1354
|
+
/* Optional browser storage. */
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtLocalChartStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1358
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtLocalChartStore, providedIn: 'root' });
|
|
1359
|
+
}
|
|
1360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtLocalChartStore, decorators: [{
|
|
1361
|
+
type: Injectable,
|
|
1362
|
+
args: [{ providedIn: 'root' }]
|
|
1363
|
+
}] });
|
|
1364
|
+
const MT_GRID_SERVER_CHARTS_OPTIONS = new InjectionToken('MT_GRID_SERVER_CHARTS_OPTIONS', { providedIn: 'root', factory: () => ({}) });
|
|
1365
|
+
const SERVER_KEY_MAX = 400;
|
|
1366
|
+
const UNSYNCED = ':unsynced';
|
|
1367
|
+
/** 64-bit FNV-1a of the text's UTF-8 bytes, as 16 hex digits. */
|
|
1368
|
+
function fnv1a64(text) {
|
|
1369
|
+
let hash = 0xcbf29ce484222325n;
|
|
1370
|
+
for (const byte of new TextEncoder().encode(text)) {
|
|
1371
|
+
hash ^= BigInt(byte);
|
|
1372
|
+
hash = (hash * 0x100000001b3n) & 0xffffffffffffffffn;
|
|
1373
|
+
}
|
|
1374
|
+
return hash.toString(16).padStart(16, '0');
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* The server key of a grid's charts: the JSON of application, template, level, module, role
|
|
1378
|
+
* and scope. A key over 400 characters becomes `h:<FNV-1a 64 hex>:<first 300 characters>`.
|
|
1379
|
+
* User, actor and tenant are left out: the server takes them from the token.
|
|
1380
|
+
*/
|
|
1381
|
+
function mtGridChartServerKey(identity, key) {
|
|
1382
|
+
const json = JSON.stringify([
|
|
1383
|
+
identity.application,
|
|
1384
|
+
identity.template ?? null,
|
|
1385
|
+
key.view.level,
|
|
1386
|
+
key.view.module ?? null,
|
|
1387
|
+
key.view.role,
|
|
1388
|
+
key.scope,
|
|
1389
|
+
]);
|
|
1390
|
+
return json.length > SERVER_KEY_MAX
|
|
1391
|
+
? `h:${fnv1a64(json)}:${json.slice(0, 300)}`
|
|
1392
|
+
: json;
|
|
1393
|
+
}
|
|
1394
|
+
/** The server's numeric level id (a positive integer, or its digits), else null. */
|
|
1395
|
+
function serverLevelId(level) {
|
|
1396
|
+
const id = typeof level === 'number' ? level : /^\d+$/.test(level) ? +level : NaN;
|
|
1397
|
+
return Number.isSafeInteger(id) && id > 0 ? id : null;
|
|
1398
|
+
}
|
|
1399
|
+
const utf8Length = (charts) => new TextEncoder().encode(JSON.stringify(charts)).length;
|
|
1400
|
+
const sameCharts = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
1401
|
+
/**
|
|
1402
|
+
* Charts that follow the user across browsers: the local store first, then the caller's
|
|
1403
|
+
* `grid-charts` set on the server (`provideMTGridServerCharts`).
|
|
1404
|
+
*
|
|
1405
|
+
* - `read` answers with the local copy at once, then asks the server (or a level prefetch).
|
|
1406
|
+
* When the server's stored set differs and nothing was written for the key since the read
|
|
1407
|
+
* began, it replaces the local copy and calls `onRemoteChange`. A key the server has never
|
|
1408
|
+
* stored keeps the local copy, which a non-empty local set then seeds on the server: the
|
|
1409
|
+
* version-1 Studio charts that migrate locally, or a grid that used the local store before.
|
|
1410
|
+
* - `write` and `clear` update the local copy at once, then PUT the set; a clear PUTs an empty
|
|
1411
|
+
* set, so other browsers see the removal instead of a key the server never stored. One
|
|
1412
|
+
* request per key runs at a time and the latest one waits for it. Failures are silent:
|
|
1413
|
+
* the key stays marked unsynced in local storage and the next write, or the next read,
|
|
1414
|
+
* sends it again, so a set changed just before a refresh is not replaced by the older
|
|
1415
|
+
* server copy.
|
|
1416
|
+
* - What it remembers in memory (prefetched levels, the sets it knows) is per signed-in
|
|
1417
|
+
* user and actor, since the server key leaves them out: switching actor never answers
|
|
1418
|
+
* with the previous actor's sets.
|
|
1419
|
+
*/
|
|
1420
|
+
class MtServerChartStore {
|
|
1421
|
+
http = inject(HttpClient);
|
|
1422
|
+
local = inject(MtLocalChartStore);
|
|
1423
|
+
configuration = inject(MT_DATA_TABLE_CONFIGURATION);
|
|
1424
|
+
endpoint = inject(MT_GRID_SERVER_CHARTS_OPTIONS).endpoint ?? 'grid-charts/me';
|
|
1425
|
+
/*
|
|
1426
|
+
* The maps below are keyed by `slot()`: the signed-in account plus the server key (or the
|
|
1427
|
+
* level), because the server key itself names no user or actor.
|
|
1428
|
+
*/
|
|
1429
|
+
/** Writes per server key: a server answer that started before the latest write loses. */
|
|
1430
|
+
writes = new Map();
|
|
1431
|
+
/** Server sets known without a GET: a level prefetch, or what this store sent last. */
|
|
1432
|
+
known = new Map();
|
|
1433
|
+
/** Level prefetches; true once the level's sets are in `known`. */
|
|
1434
|
+
levels = new Map();
|
|
1435
|
+
/** The request running per server key and the latest one waiting for it. */
|
|
1436
|
+
sending = new Map();
|
|
1437
|
+
/** The server key of a grid's charts; null without an identity. */
|
|
1438
|
+
gridKey(key) {
|
|
1439
|
+
const identity = this.configuration.identity();
|
|
1440
|
+
return identity ? mtGridChartServerKey(identity, key) : null;
|
|
1441
|
+
}
|
|
1442
|
+
/** A server key (or a level) of the signed-in user and actor; null without an identity. */
|
|
1443
|
+
slot(name) {
|
|
1444
|
+
const identity = this.configuration.identity();
|
|
1445
|
+
return identity
|
|
1446
|
+
? JSON.stringify([identity.tenant, identity.user, identity.actor, name])
|
|
1447
|
+
: null;
|
|
1448
|
+
}
|
|
1449
|
+
read(key, onRemoteChange) {
|
|
1450
|
+
const local = this.local.readNow(key);
|
|
1451
|
+
const gridKey = this.gridKey(key), slot = gridKey && this.slot(gridKey);
|
|
1452
|
+
if (!gridKey || !slot)
|
|
1453
|
+
return Promise.resolve(local);
|
|
1454
|
+
if (this.unsynced(key)) {
|
|
1455
|
+
// The local set is newer than the server's (a failed or interrupted save): send it.
|
|
1456
|
+
this.send(key, gridKey, slot, local);
|
|
1457
|
+
return Promise.resolve(local);
|
|
1458
|
+
}
|
|
1459
|
+
const since = this.writes.get(slot) ?? 0;
|
|
1460
|
+
void this.remote(key, gridKey, slot).then((remote) => {
|
|
1461
|
+
if (!remote || (this.writes.get(slot) ?? 0) !== since)
|
|
1462
|
+
return;
|
|
1463
|
+
if (!remote.stored) {
|
|
1464
|
+
// Nothing on the server yet: the local set stays, and seeds the server.
|
|
1465
|
+
if (local.length)
|
|
1466
|
+
this.send(key, gridKey, slot, local);
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
if (!this.known.has(slot))
|
|
1470
|
+
this.known.set(slot, remote.charts);
|
|
1471
|
+
if (sameCharts(remote.charts, local))
|
|
1472
|
+
return;
|
|
1473
|
+
this.local.write(key, remote.charts);
|
|
1474
|
+
onRemoteChange?.(remote.charts);
|
|
1475
|
+
});
|
|
1476
|
+
return Promise.resolve(local);
|
|
1477
|
+
}
|
|
1478
|
+
write(key, charts) {
|
|
1479
|
+
this.local.write(key, charts);
|
|
1480
|
+
const gridKey = this.gridKey(key), slot = gridKey && this.slot(gridKey);
|
|
1481
|
+
if (!gridKey || !slot)
|
|
1482
|
+
return;
|
|
1483
|
+
this.writes.set(slot, (this.writes.get(slot) ?? 0) + 1);
|
|
1484
|
+
this.send(key, gridKey, slot, charts);
|
|
1485
|
+
}
|
|
1486
|
+
clear(key) {
|
|
1487
|
+
this.local.clear(key);
|
|
1488
|
+
const gridKey = this.gridKey(key), slot = gridKey && this.slot(gridKey);
|
|
1489
|
+
if (!gridKey || !slot)
|
|
1490
|
+
return;
|
|
1491
|
+
this.writes.set(slot, (this.writes.get(slot) ?? 0) + 1);
|
|
1492
|
+
this.send(key, gridKey, slot, []);
|
|
1493
|
+
}
|
|
1494
|
+
/** One GET for every set the caller saved at a numeric level; later reads use it. */
|
|
1495
|
+
prefetch(hint) {
|
|
1496
|
+
const level = serverLevelId(hint.level);
|
|
1497
|
+
const levelSlot = level === null ? null : this.slot(level);
|
|
1498
|
+
if (level === null || !levelSlot)
|
|
1499
|
+
return Promise.resolve();
|
|
1500
|
+
let pending = this.levels.get(levelSlot);
|
|
1501
|
+
if (!pending) {
|
|
1502
|
+
pending = firstValueFrom(this.http.get(`${this.endpoint}/level/${level}`)).then((response) => {
|
|
1503
|
+
const sets = response?.data;
|
|
1504
|
+
if (!Array.isArray(sets)) {
|
|
1505
|
+
this.levels.delete(levelSlot);
|
|
1506
|
+
return false;
|
|
1507
|
+
}
|
|
1508
|
+
for (const set of sets) {
|
|
1509
|
+
const slot = typeof set?.gridKey === 'string' ? this.slot(set.gridKey) : null;
|
|
1510
|
+
if (slot && !this.known.has(slot))
|
|
1511
|
+
this.known.set(slot, parseMtGridCharts(set.charts));
|
|
1512
|
+
}
|
|
1513
|
+
return true;
|
|
1514
|
+
}, () => {
|
|
1515
|
+
this.levels.delete(levelSlot);
|
|
1516
|
+
return false;
|
|
1517
|
+
});
|
|
1518
|
+
this.levels.set(levelSlot, pending);
|
|
1519
|
+
}
|
|
1520
|
+
return pending.then(() => undefined);
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* The server's set: known, from a level prefetch (absent there = never stored), else a GET;
|
|
1524
|
+
* null when the server could not answer.
|
|
1525
|
+
*/
|
|
1526
|
+
async remote(key, gridKey, slot) {
|
|
1527
|
+
const level = serverLevelId(key.view.level);
|
|
1528
|
+
const levelSlot = level === null ? null : this.slot(level);
|
|
1529
|
+
// Without a level prefetch the GET goes out within `read` itself.
|
|
1530
|
+
const prefetch = levelSlot ? this.levels.get(levelSlot) : undefined;
|
|
1531
|
+
const prefetched = prefetch ? await prefetch : false;
|
|
1532
|
+
const known = this.known.get(slot);
|
|
1533
|
+
if (known)
|
|
1534
|
+
return { charts: known, stored: true };
|
|
1535
|
+
if (prefetched)
|
|
1536
|
+
return { charts: [], stored: false };
|
|
1537
|
+
try {
|
|
1538
|
+
const response = await firstValueFrom(this.http.get(this.endpoint, {
|
|
1539
|
+
params: { gridKey },
|
|
1540
|
+
}));
|
|
1541
|
+
const set = response?.data;
|
|
1542
|
+
if (!set)
|
|
1543
|
+
return null;
|
|
1544
|
+
const charts = parseMtGridCharts(set.charts);
|
|
1545
|
+
// An unknown key answers revision 0, updatedAt null and no charts.
|
|
1546
|
+
const stored = charts.length > 0 ||
|
|
1547
|
+
(typeof set.revision === 'number' && set.revision > 0) ||
|
|
1548
|
+
!!set.updatedAt;
|
|
1549
|
+
return { charts, stored };
|
|
1550
|
+
}
|
|
1551
|
+
catch {
|
|
1552
|
+
return null;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* PUTs the set after the request already running for the key. An empty set is PUT too (not
|
|
1557
|
+
* DELETEd): the server then knows the charts were removed, not never saved.
|
|
1558
|
+
*/
|
|
1559
|
+
send(key, gridKey, slot, charts) {
|
|
1560
|
+
const body = fitMtGridCharts(parseMtGridCharts(charts), utf8Length);
|
|
1561
|
+
this.known.set(slot, body);
|
|
1562
|
+
this.mark(key, true);
|
|
1563
|
+
const request = () => this.http.put(this.endpoint, {
|
|
1564
|
+
gridKey,
|
|
1565
|
+
levelId: serverLevelId(key.view.level),
|
|
1566
|
+
schemaVersion: 2,
|
|
1567
|
+
charts: body,
|
|
1568
|
+
});
|
|
1569
|
+
const running = this.sending.get(slot);
|
|
1570
|
+
if (running) {
|
|
1571
|
+
running.next = request;
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
const run = (next) => {
|
|
1575
|
+
const entry = {
|
|
1576
|
+
next: null,
|
|
1577
|
+
};
|
|
1578
|
+
this.sending.set(slot, entry);
|
|
1579
|
+
const done = (saved) => {
|
|
1580
|
+
if (entry.next)
|
|
1581
|
+
return run(entry.next);
|
|
1582
|
+
this.sending.delete(slot);
|
|
1583
|
+
if (saved)
|
|
1584
|
+
this.mark(key, false);
|
|
1585
|
+
};
|
|
1586
|
+
next().subscribe({
|
|
1587
|
+
complete: () => done(true),
|
|
1588
|
+
error: () => done(false),
|
|
1589
|
+
});
|
|
1590
|
+
};
|
|
1591
|
+
run(request);
|
|
1592
|
+
}
|
|
1593
|
+
unsynced(key) {
|
|
1594
|
+
const storageKey = this.local.storageKey(key);
|
|
1595
|
+
try {
|
|
1596
|
+
return (!!storageKey && localStorage.getItem(storageKey + UNSYNCED) === '1');
|
|
1597
|
+
}
|
|
1598
|
+
catch {
|
|
1599
|
+
return false;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
mark(key, unsynced) {
|
|
1603
|
+
const storageKey = this.local.storageKey(key);
|
|
1604
|
+
if (!storageKey)
|
|
1605
|
+
return;
|
|
1606
|
+
try {
|
|
1607
|
+
if (unsynced)
|
|
1608
|
+
localStorage.setItem(storageKey + UNSYNCED, '1');
|
|
1609
|
+
else
|
|
1610
|
+
localStorage.removeItem(storageKey + UNSYNCED);
|
|
1611
|
+
}
|
|
1612
|
+
catch {
|
|
1613
|
+
/* Optional browser storage. */
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtServerChartStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1617
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtServerChartStore });
|
|
1618
|
+
}
|
|
1619
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtServerChartStore, decorators: [{
|
|
1620
|
+
type: Injectable
|
|
1621
|
+
}] });
|
|
1622
|
+
/**
|
|
1623
|
+
* Keeps every `mt-standard-grid` chart set below it on the server as well as locally. Use it
|
|
1624
|
+
* in application providers, or in a component's `providers` for that subtree only.
|
|
1625
|
+
*/
|
|
1626
|
+
function provideMTGridServerCharts(options = {}) {
|
|
1627
|
+
return [
|
|
1628
|
+
{ provide: MT_GRID_SERVER_CHARTS_OPTIONS, useValue: options },
|
|
1629
|
+
MtServerChartStore,
|
|
1630
|
+
{ provide: MT_GRID_CHART_STORE, useExisting: MtServerChartStore },
|
|
1631
|
+
];
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1033
1634
|
const EXPORT_FORMATS = [
|
|
1034
1635
|
'csv',
|
|
1035
1636
|
'excel',
|
|
@@ -1042,9 +1643,25 @@ const EXPORT_FORMATS = [
|
|
|
1042
1643
|
const STATUS_BAR = {
|
|
1043
1644
|
panels: ['selectedRowCount', 'aggregation'],
|
|
1044
1645
|
};
|
|
1646
|
+
/** Excel-style: a header click selects the column; sorting is the header's sort icon. */
|
|
1647
|
+
const CELL_SELECTION = { headerClick: 'select' };
|
|
1045
1648
|
/** mt-table's rows-per-page choices and default, so every migrated page keeps them. */
|
|
1046
1649
|
const PAGE_SIZES = [5, 10, 20, 50, 100];
|
|
1650
|
+
/** The Chart button's types: its main part takes the type the data recommends. */
|
|
1651
|
+
const CHART_TYPE_ITEMS = [
|
|
1652
|
+
{ type: 'groupedColumn', text: 'chartColumn', icon: 'chart.bar-chart-01' },
|
|
1653
|
+
{
|
|
1654
|
+
type: 'groupedBar',
|
|
1655
|
+
text: 'chartBar',
|
|
1656
|
+
icon: 'chart.horizontal-bar-chart-01',
|
|
1657
|
+
},
|
|
1658
|
+
{ type: 'line', text: 'chartLine', icon: 'chart.line-chart-up-01' },
|
|
1659
|
+
{ type: 'pie', text: 'chartPie', icon: 'chart.pie-chart-01' },
|
|
1660
|
+
{ type: 'donut', text: 'chartDoughnut', icon: 'chart.pie-chart-03' },
|
|
1661
|
+
];
|
|
1047
1662
|
const DEFAULT_PAGE_SIZE = 10;
|
|
1663
|
+
/** Chart changes are saved this long after the last one. */
|
|
1664
|
+
const CHART_WRITE_DELAY = 600;
|
|
1048
1665
|
function controlColumnIds(columns) {
|
|
1049
1666
|
const ids = new Set();
|
|
1050
1667
|
const visit = (defs) => defs.forEach((def) => {
|
|
@@ -1060,8 +1677,9 @@ function controlColumnIds(columns) {
|
|
|
1060
1677
|
* The one standard grid for product pages (user decision 2026-11-03). Every page that shows
|
|
1061
1678
|
* the new grid renders this component, so every grid has the same header (sort, menu and
|
|
1062
1679
|
* filter on every data column; the menu only on control columns), the same geometry, the same
|
|
1063
|
-
* top strip (group panel, quick filter, pivot zone while pivoting), the same
|
|
1064
|
-
* Filters side bar, status bar, pager, context menu, CSV/Excel export and
|
|
1680
|
+
* top strip (group panel, quick filter, Chart button, pivot zone while pivoting), the same
|
|
1681
|
+
* Columns, Filters and Charts side bar, status bar, pager, context menu, CSV/Excel export and
|
|
1682
|
+
* live charts that dock into the Charts panel.
|
|
1065
1683
|
*
|
|
1066
1684
|
* A page supplies data, entity columns, the row id, permissions and behaviour hooks only;
|
|
1067
1685
|
* there is deliberately no input for header templates, heights or feature toggles.
|
|
@@ -1102,6 +1720,11 @@ class MtStandardGridComponent {
|
|
|
1102
1720
|
exporter = input(null, ...(ngDevMode ? [{ debugName: "exporter" }] : /* istanbul ignore next */ []));
|
|
1103
1721
|
/** Page-specific row actions, appended to the standard context menu of a data row. */
|
|
1104
1722
|
rowMenuItems = input(null, ...(ngDevMode ? [{ debugName: "rowMenuItems" }] : /* istanbul ignore next */ []));
|
|
1723
|
+
/**
|
|
1724
|
+
* The row's primary actions (an "Open record"), shown first: above the standard
|
|
1725
|
+
* clipboard, export and chart items, with a separator after them.
|
|
1726
|
+
*/
|
|
1727
|
+
rowMenuLeadItems = input(null, ...(ngDevMode ? [{ debugName: "rowMenuLeadItems" }] : /* istanbul ignore next */ []));
|
|
1105
1728
|
/** Server paging; sorting, filtering and paging then belong to the owner (external data). */
|
|
1106
1729
|
server = input(null, ...(ngDevMode ? [{ debugName: "server" }] : /* istanbul ignore next */ []));
|
|
1107
1730
|
/** The pager. A page whose grid scrolls every row inside its own viewport turns it off. */
|
|
@@ -1132,6 +1755,13 @@ class MtStandardGridComponent {
|
|
|
1132
1755
|
emptyDescription = input(null, ...(ngDevMode ? [{ debugName: "emptyDescription" }] : /* istanbul ignore next */ []));
|
|
1133
1756
|
/** A saved view applied once when the grid is ready. */
|
|
1134
1757
|
view = input(null, ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
1758
|
+
/**
|
|
1759
|
+
* Keeps the grid's charts per view (and `scope`, default `'default'`) in the
|
|
1760
|
+
* `MT_GRID_CHART_STORE`, else the browser-only `MtLocalChartStore`. Saved charts return
|
|
1761
|
+
* docked into the Charts panel once the grid has loaded; every change is saved 600ms
|
|
1762
|
+
* later. Null (the default) keeps charts for the visit only.
|
|
1763
|
+
*/
|
|
1764
|
+
chartPersistence = input(null, ...(ngDevMode ? [{ debugName: "chartPersistence" }] : /* istanbul ignore next */ []));
|
|
1135
1765
|
gridReady = output();
|
|
1136
1766
|
rowClicked = output();
|
|
1137
1767
|
selectionChanged = output();
|
|
@@ -1141,7 +1771,7 @@ class MtStandardGridComponent {
|
|
|
1141
1771
|
rowGroupOpened = output();
|
|
1142
1772
|
/** The captured view after any column, sort, filter or grouping change (persist it per user). */
|
|
1143
1773
|
viewChanged = output();
|
|
1144
|
-
/** A chart was opened,
|
|
1774
|
+
/** A chart was created, opened, docked, moved, changed, restored or removed. */
|
|
1145
1775
|
chartsChanged = output();
|
|
1146
1776
|
/** Fixed height in px; in `'auto'` mode the grid sizes itself and this is its fallback. */
|
|
1147
1777
|
gridHeight = computed(() => {
|
|
@@ -1156,7 +1786,7 @@ class MtStandardGridComponent {
|
|
|
1156
1786
|
: undefined, ...(ngDevMode ? [{ debugName: "autoGroupColumnDef" }] : /* istanbul ignore next */ []));
|
|
1157
1787
|
direction = computed(() => this.text.language().startsWith('ar') ? 'rtl' : 'ltr', ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
|
|
1158
1788
|
sideBar = computed(() => ({
|
|
1159
|
-
toolPanels: ['columns', 'filters'],
|
|
1789
|
+
toolPanels: ['columns', 'filters', 'charts'],
|
|
1160
1790
|
position: this.direction() === 'rtl' ? 'left' : 'right',
|
|
1161
1791
|
}), ...(ngDevMode ? [{ debugName: "sideBar" }] : /* istanbul ignore next */ []));
|
|
1162
1792
|
selectionOptions = computed(() => this.selection()
|
|
@@ -1199,10 +1829,24 @@ class MtStandardGridComponent {
|
|
|
1199
1829
|
detailRenderer = computed(() => this.detail()?.renderer, ...(ngDevMode ? [{ debugName: "detailRenderer" }] : /* istanbul ignore next */ []));
|
|
1200
1830
|
detailParams = computed(() => this.detail()?.params, ...(ngDevMode ? [{ debugName: "detailParams" }] : /* istanbul ignore next */ []));
|
|
1201
1831
|
isRowMaster = computed(() => this.detail()?.isRowMaster, ...(ngDevMode ? [{ debugName: "isRowMaster" }] : /* istanbul ignore next */ []));
|
|
1202
|
-
|
|
1832
|
+
/** The charts' context line; a server page's charts cover the loaded page only. */
|
|
1833
|
+
chartTitle = computed(() => {
|
|
1834
|
+
const context = this.chartContext() ?? this.label();
|
|
1835
|
+
return this.server()
|
|
1836
|
+
? `${context} · ${this.text.text('chartThisPage')}`
|
|
1837
|
+
: context;
|
|
1838
|
+
}, ...(ngDevMode ? [{ debugName: "chartTitle" }] : /* istanbul ignore next */ []));
|
|
1203
1839
|
csvAllowed = computed(() => this.exportable() && this.exportFormats().includes('csv'), ...(ngDevMode ? [{ debugName: "csvAllowed" }] : /* istanbul ignore next */ []));
|
|
1204
1840
|
excelAllowed = computed(() => this.exportable() && this.exportFormats().includes('excel'), ...(ngDevMode ? [{ debugName: "excelAllowed" }] : /* istanbul ignore next */ []));
|
|
1841
|
+
/** A cell range exists: the Chart button charts it. */
|
|
1842
|
+
hasRange = signal(false, ...(ngDevMode ? [{ debugName: "hasRange" }] : /* istanbul ignore next */ []));
|
|
1843
|
+
chartTypeItems = computed(() => CHART_TYPE_ITEMS.map((item) => ({
|
|
1844
|
+
label: this.text.text(item.text),
|
|
1845
|
+
icon: item.icon,
|
|
1846
|
+
command: () => this.createChart(item.type),
|
|
1847
|
+
})), ...(ngDevMode ? [{ debugName: "chartTypeItems" }] : /* istanbul ignore next */ []));
|
|
1205
1848
|
statusBar = STATUS_BAR;
|
|
1849
|
+
cellSelection = CELL_SELECTION;
|
|
1206
1850
|
pageSizes = PAGE_SIZES;
|
|
1207
1851
|
fit = { type: 'fitGridWidth' };
|
|
1208
1852
|
api = null;
|
|
@@ -1221,8 +1865,56 @@ class MtStandardGridComponent {
|
|
|
1221
1865
|
return id;
|
|
1222
1866
|
}
|
|
1223
1867
|
applyingView = false;
|
|
1868
|
+
chartStore = inject(MT_GRID_CHART_STORE, { optional: true }) ??
|
|
1869
|
+
inject(MtLocalChartStore);
|
|
1870
|
+
tableConfiguration = inject(MT_DATA_TABLE_CONFIGURATION);
|
|
1871
|
+
/**
|
|
1872
|
+
* The identity the stores key charts by (application, tenant, user, actor, template), read
|
|
1873
|
+
* afresh each time: the configuration's `identity` need not be signal-backed.
|
|
1874
|
+
*/
|
|
1875
|
+
chartIdentity() {
|
|
1876
|
+
const identity = this.tableConfiguration.identity();
|
|
1877
|
+
return identity
|
|
1878
|
+
? JSON.stringify([
|
|
1879
|
+
identity.application,
|
|
1880
|
+
identity.tenant,
|
|
1881
|
+
identity.user,
|
|
1882
|
+
identity.actor,
|
|
1883
|
+
identity.template ?? null,
|
|
1884
|
+
])
|
|
1885
|
+
: null;
|
|
1886
|
+
}
|
|
1887
|
+
/** The grid's api once ready, for the chart restore. */
|
|
1888
|
+
readyApi = signal(null, ...(ngDevMode ? [{ debugName: "readyApi" }] : /* istanbul ignore next */ []));
|
|
1889
|
+
chartSession = null;
|
|
1890
|
+
/** Grid chart events caused by a restore or a key change are not user changes. */
|
|
1891
|
+
chartEventsMuted = 0;
|
|
1892
|
+
chartWrite = null;
|
|
1893
|
+
chartWriteTimer;
|
|
1894
|
+
destroyed = false;
|
|
1895
|
+
constructor() {
|
|
1896
|
+
effect(() => {
|
|
1897
|
+
const persistence = this.chartPersistence();
|
|
1898
|
+
const identity = this.chartIdentity();
|
|
1899
|
+
const api = this.readyApi();
|
|
1900
|
+
const loading = this.loading();
|
|
1901
|
+
const filled = this.rows().length > 0 && this.columns().length > 0;
|
|
1902
|
+
untracked(() => this.syncCharts(persistence, identity, api, loading, filled));
|
|
1903
|
+
});
|
|
1904
|
+
// A refresh does not destroy the page: save a pending change before it goes.
|
|
1905
|
+
const flush = () => this.flushChartWrite();
|
|
1906
|
+
if (typeof window !== 'undefined')
|
|
1907
|
+
window.addEventListener('pagehide', flush);
|
|
1908
|
+
inject(DestroyRef).onDestroy(() => {
|
|
1909
|
+
if (typeof window !== 'undefined')
|
|
1910
|
+
window.removeEventListener('pagehide', flush);
|
|
1911
|
+
this.flushChartWrite();
|
|
1912
|
+
this.destroyed = true;
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1224
1915
|
onReady(event) {
|
|
1225
1916
|
this.api = event.api;
|
|
1917
|
+
this.readyApi.set(event.api);
|
|
1226
1918
|
const view = untracked(this.view);
|
|
1227
1919
|
if (view) {
|
|
1228
1920
|
this.applyingView = true;
|
|
@@ -1235,6 +1927,167 @@ class MtStandardGridComponent {
|
|
|
1235
1927
|
}
|
|
1236
1928
|
this.gridReady.emit(event);
|
|
1237
1929
|
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Starts a session per persistence key and identity, and restores its charts, docked,
|
|
1932
|
+
* once the grid is ready and loaded: not loading, and holding rows or done with a load. A
|
|
1933
|
+
* new key first saves what is pending under the old one and removes the old key's charts;
|
|
1934
|
+
* a new identity (another user or actor) drops the pending change instead, since the
|
|
1935
|
+
* store would save it for the new identity.
|
|
1936
|
+
*/
|
|
1937
|
+
syncCharts(persistence, identity, api, loading, filled) {
|
|
1938
|
+
const key = persistence
|
|
1939
|
+
? { view: persistence.view, scope: persistence.scope ?? 'default' }
|
|
1940
|
+
: null;
|
|
1941
|
+
const id = key
|
|
1942
|
+
? JSON.stringify([
|
|
1943
|
+
identity,
|
|
1944
|
+
key.view.level,
|
|
1945
|
+
key.view.module ?? null,
|
|
1946
|
+
key.view.role,
|
|
1947
|
+
key.scope,
|
|
1948
|
+
])
|
|
1949
|
+
: null;
|
|
1950
|
+
if (id !== (this.chartSession?.id ?? null)) {
|
|
1951
|
+
const previous = this.chartSession;
|
|
1952
|
+
this.flushChartWrite();
|
|
1953
|
+
if (previous && api)
|
|
1954
|
+
this.removeCharts(api);
|
|
1955
|
+
this.chartSession =
|
|
1956
|
+
key && id
|
|
1957
|
+
? {
|
|
1958
|
+
id,
|
|
1959
|
+
key,
|
|
1960
|
+
identity,
|
|
1961
|
+
phase: 'waiting',
|
|
1962
|
+
loaded: false,
|
|
1963
|
+
// Charts made before persistence was on are saved with the restored ones.
|
|
1964
|
+
edited: !previous && !!api?.getChartModels().length,
|
|
1965
|
+
}
|
|
1966
|
+
: null;
|
|
1967
|
+
}
|
|
1968
|
+
const session = this.chartSession;
|
|
1969
|
+
if (!session || session.phase !== 'waiting')
|
|
1970
|
+
return;
|
|
1971
|
+
if (loading) {
|
|
1972
|
+
session.loaded = true;
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
if (!api || !(filled || session.loaded))
|
|
1976
|
+
return;
|
|
1977
|
+
session.phase = 'reading';
|
|
1978
|
+
this.chartStore
|
|
1979
|
+
.read(session.key, (charts) => this.adoptRemoteCharts(session, charts))
|
|
1980
|
+
.then((charts) => this.restoreSavedCharts(session, charts), () => this.restoreSavedCharts(session, []));
|
|
1981
|
+
}
|
|
1982
|
+
restoreSavedCharts(session, charts) {
|
|
1983
|
+
const api = this.gridApi();
|
|
1984
|
+
if (session !== this.chartSession || this.destroyed || !api)
|
|
1985
|
+
return;
|
|
1986
|
+
const saved = session.remote ?? charts;
|
|
1987
|
+
// A chart made while the store answered keeps its id; a saved chart with the same id
|
|
1988
|
+
// takes a new one instead of being skipped.
|
|
1989
|
+
const taken = new Set(api.getChartModels().map((model) => model.chartId));
|
|
1990
|
+
const states = saved.map((state) => {
|
|
1991
|
+
if (!taken.has(state.chartId))
|
|
1992
|
+
return state;
|
|
1993
|
+
let index = 2;
|
|
1994
|
+
while (taken.has(`${state.chartId}-${index}`))
|
|
1995
|
+
index++;
|
|
1996
|
+
taken.add(`${state.chartId}-${index}`);
|
|
1997
|
+
return { ...state, chartId: `${state.chartId}-${index}` };
|
|
1998
|
+
});
|
|
1999
|
+
this.muteChartEvents(() => api.restoreCharts(states));
|
|
2000
|
+
session.phase = 'restored';
|
|
2001
|
+
if (session.edited)
|
|
2002
|
+
this.scheduleChartWrite();
|
|
2003
|
+
}
|
|
2004
|
+
/** A later server answer replaces the restored charts while the user has changed none. */
|
|
2005
|
+
adoptRemoteCharts(session, charts) {
|
|
2006
|
+
if (session !== this.chartSession || this.destroyed || session.edited)
|
|
2007
|
+
return;
|
|
2008
|
+
if (session.phase !== 'restored') {
|
|
2009
|
+
session.remote = charts;
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
const api = this.gridApi();
|
|
2013
|
+
if (!api)
|
|
2014
|
+
return;
|
|
2015
|
+
this.removeCharts(api);
|
|
2016
|
+
this.muteChartEvents(() => api.restoreCharts(charts));
|
|
2017
|
+
}
|
|
2018
|
+
/** Removes every chart; a pending "Chart removed" Undo would put its chart into the new set. */
|
|
2019
|
+
removeCharts(api) {
|
|
2020
|
+
api.dismissChartNotice();
|
|
2021
|
+
const ids = new Set([
|
|
2022
|
+
...api.getChartModels().map((model) => model.chartId),
|
|
2023
|
+
...api.getChartStates().map((state) => state.chartId),
|
|
2024
|
+
]);
|
|
2025
|
+
this.muteChartEvents(() => ids.forEach((id) => api.removeChart(id)));
|
|
2026
|
+
}
|
|
2027
|
+
muteChartEvents(change) {
|
|
2028
|
+
this.chartEventsMuted++;
|
|
2029
|
+
try {
|
|
2030
|
+
change();
|
|
2031
|
+
}
|
|
2032
|
+
finally {
|
|
2033
|
+
this.chartEventsMuted--;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
/** Every chart action: `chartsChanged`, and a save 600ms after the user's last change. */
|
|
2037
|
+
onChartStateChanged(event) {
|
|
2038
|
+
this.chartsChanged.emit();
|
|
2039
|
+
const session = this.chartSession;
|
|
2040
|
+
if (event.type === 'restored' || this.chartEventsMuted || !session)
|
|
2041
|
+
return;
|
|
2042
|
+
session.edited = true;
|
|
2043
|
+
// Before the restore the change waits for it, then saves with the restored charts.
|
|
2044
|
+
if (session.phase === 'restored')
|
|
2045
|
+
this.scheduleChartWrite();
|
|
2046
|
+
}
|
|
2047
|
+
scheduleChartWrite() {
|
|
2048
|
+
clearTimeout(this.chartWriteTimer);
|
|
2049
|
+
this.chartWrite = this.chartSession;
|
|
2050
|
+
this.chartWriteTimer = setTimeout(() => this.flushChartWrite(), CHART_WRITE_DELAY);
|
|
2051
|
+
}
|
|
2052
|
+
/** Saves the pending change now; an empty set clears the stored one. */
|
|
2053
|
+
flushChartWrite() {
|
|
2054
|
+
clearTimeout(this.chartWriteTimer);
|
|
2055
|
+
const session = this.chartWrite;
|
|
2056
|
+
this.chartWrite = null;
|
|
2057
|
+
const api = this.gridApi();
|
|
2058
|
+
if (!session || !api || this.destroyed)
|
|
2059
|
+
return;
|
|
2060
|
+
// Signed out or switched actor since the change: never save it for someone else.
|
|
2061
|
+
if (session.identity !== untracked(() => this.chartIdentity()))
|
|
2062
|
+
return;
|
|
2063
|
+
// A chart made from the grid has no context of its own (it shows the grid's current,
|
|
2064
|
+
// translated `chartTitle`), so its state carries none and a restore follows the grid.
|
|
2065
|
+
const charts = api.getChartStates();
|
|
2066
|
+
if (charts.length)
|
|
2067
|
+
this.chartStore.write(session.key, charts);
|
|
2068
|
+
else
|
|
2069
|
+
this.chartStore.clear(session.key);
|
|
2070
|
+
}
|
|
2071
|
+
onCellSelection(event) {
|
|
2072
|
+
this.hasRange.set(event.ranges.length > 0);
|
|
2073
|
+
}
|
|
2074
|
+
/**
|
|
2075
|
+
* The Chart button: a live chart of the current cell ranges, open on the page and not
|
|
2076
|
+
* following later selections. Without a type the grid picks the recommended one.
|
|
2077
|
+
*/
|
|
2078
|
+
createChart(chartType) {
|
|
2079
|
+
const api = this.gridApi();
|
|
2080
|
+
const [cellRange, ...cellRanges] = api?.getSelectionChartRanges() ?? [];
|
|
2081
|
+
if (!api || !cellRange)
|
|
2082
|
+
return;
|
|
2083
|
+
api.createRangeChart({
|
|
2084
|
+
cellRange,
|
|
2085
|
+
cellRanges,
|
|
2086
|
+
...(chartType ? { chartType } : {}),
|
|
2087
|
+
followSelection: false,
|
|
2088
|
+
state: 'open',
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
1238
2091
|
onViewChange() {
|
|
1239
2092
|
if (!this.api || this.applyingView)
|
|
1240
2093
|
return;
|
|
@@ -1345,15 +2198,25 @@ class MtStandardGridComponent {
|
|
|
1345
2198
|
});
|
|
1346
2199
|
const row = params.node?.data;
|
|
1347
2200
|
const rowItems = row !== undefined && this.rowMenuItems() ? this.rowMenuItems()(row) : [];
|
|
1348
|
-
|
|
2201
|
+
const leadItems = row !== undefined && this.rowMenuLeadItems()
|
|
2202
|
+
? this.rowMenuLeadItems()(row)
|
|
2203
|
+
: [];
|
|
2204
|
+
const menu = [...leadItems];
|
|
2205
|
+
if (leadItems.length && items.length)
|
|
2206
|
+
menu.push('separator');
|
|
2207
|
+
menu.push(...items);
|
|
2208
|
+
if (rowItems.length && menu.length)
|
|
2209
|
+
menu.push('separator');
|
|
2210
|
+
menu.push(...rowItems);
|
|
2211
|
+
return menu;
|
|
1349
2212
|
};
|
|
1350
2213
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtStandardGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1351
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: MtStandardGridComponent, isStandalone: true, selector: "mt-standard-grid", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, rowId: { classPropertyName: "rowId", publicName: "rowId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", 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 }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, exportButtons: { classPropertyName: "exportButtons", publicName: "exportButtons", isSignal: true, isRequired: false, transformFunction: null }, exportName: { classPropertyName: "exportName", publicName: "exportName", isSignal: true, isRequired: false, transformFunction: null }, exportFormats: { classPropertyName: "exportFormats", publicName: "exportFormats", isSignal: true, isRequired: false, transformFunction: null }, exporter: { classPropertyName: "exporter", publicName: "exporter", isSignal: true, isRequired: false, transformFunction: null }, rowMenuItems: { classPropertyName: "rowMenuItems", publicName: "rowMenuItems", isSignal: true, isRequired: false, transformFunction: null }, server: { classPropertyName: "server", publicName: "server", isSignal: true, isRequired: false, transformFunction: null }, paged: { classPropertyName: "paged", publicName: "paged", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, clickableRows: { classPropertyName: "clickableRows", publicName: "clickableRows", isSignal: true, isRequired: false, transformFunction: null }, cellClickFilter: { classPropertyName: "cellClickFilter", publicName: "cellClickFilter", isSignal: true, isRequired: false, transformFunction: null }, rowClass: { classPropertyName: "rowClass", publicName: "rowClass", isSignal: true, isRequired: false, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: false, transformFunction: null }, chartContext: { classPropertyName: "chartContext", publicName: "chartContext", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, emptyTitle: { classPropertyName: "emptyTitle", publicName: "emptyTitle", isSignal: true, isRequired: false, transformFunction: null }, emptyDescription: { classPropertyName: "emptyDescription", publicName: "emptyDescription", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gridReady: "gridReady", rowClicked: "rowClicked", selectionChanged: "selectionChanged", sortChanged: "sortChanged", filterChanged: "filterChanged", paginationChanged: "paginationChanged", rowGroupOpened: "rowGroupOpened", viewChanged: "viewChanged", chartsChanged: "chartsChanged" }, viewQueries: [{ propertyName: "grid", first: true, predicate: MtDataGridComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"mt-standard-grid\">\r\n <div class=\"mt-standard-grid-toolbar\">\r\n <ng-content select=\"[mtGridToolbar]\" />\r\n @if (excelButton() || printButton()) {\r\n <mt-table-actions-menu\r\n class=\"mt-standard-grid-export\"\r\n [exportable]=\"excelButton()\"\r\n [printable]=\"printButton()\"\r\n (exportRequested)=\"exportAs('excel')\"\r\n (printRequested)=\"exportAs('pdf')\"\r\n />\r\n }\r\n </div>\r\n <mt-data-grid\r\n [rowData]=\"rows()\"\r\n [columnDefs]=\"standardColumns()\"\r\n [getRowId]=\"rowId()\"\r\n [dataProcessing]=\"server() ? 'external' : 'client'\"\r\n [height]=\"gridHeight()\"\r\n [rowHeight]=\"rowHeight()\"\r\n [autoHeight]=\"height() === 'auto'\"\r\n [autoSizeStrategy]=\"fit\"\r\n [ariaLabel]=\"label()\"\r\n [loading]=\"loading()\"\r\n [direction]=\"direction()\"\r\n [localeText]=\"text.gridLocale()\"\r\n [showQuickFilter]=\"true\"\r\n [showRowCount]=\"true\"\r\n [quickFilterText]=\"search()\"\r\n rowGroupPanelShow=\"always\"\r\n pivotPanelShow=\"onlyWhenPivoting\"\r\n [sideBar]=\"sideBar()\"\r\n [statusBar]=\"statusBar\"\r\n [getRowClass]=\"gridRowClass()\"\r\n [rowSelection]=\"selectionOptions()\"\r\n [cellSelection]=\"true\"\r\n [enableCharts]=\"true\"\r\n [chartContext]=\"chartTitle()\"\r\n [chartRecordsLabel]=\"label()\"\r\n [animateRows]=\"true\"\r\n [suppressCutToClipboard]=\"true\"\r\n [suppressCsvExport]=\"!csvAllowed()\"\r\n [suppressExcelExport]=\"!excelAllowed()\"\r\n [suppressPdfExport]=\"true\"\r\n [defaultCsvExportParams]=\"exportParams()\"\r\n [defaultExcelExportParams]=\"exportParams()\"\r\n [getContextMenuItems]=\"contextMenu\"\r\n groupDisplayType=\"groupRows\"\r\n [groupMaintainOrder]=\"true\"\r\n [autoGroupColumnDef]=\"autoGroupColumnDef()\"\r\n [groupDefaultExpanded]=\"-1\"\r\n [pagination]=\"paged()\"\r\n paginationPanelShow=\"whenNeeded\"\r\n [paginationPageSize]=\"gridPageSize()\"\r\n [paginationPageSizeSelector]=\"pageSizes\"\r\n [paginationTotalRows]=\"pagedTotal()\"\r\n [paginationCurrentPage]=\"pagedPage()\"\r\n [masterDetail]=\"detail() !== null\"\r\n [detailCellRenderer]=\"detailRenderer()\"\r\n [detailCellRendererParams]=\"detailParams()\"\r\n [detailRowAutoHeight]=\"true\"\r\n [isRowMaster]=\"isRowMaster()\"\r\n [noRowsTemplate]=\"emptyTitle() ? emptyState : undefined\"\r\n (gridReady)=\"onReady($event)\"\r\n (rowClicked)=\"onRowClicked($event)\"\r\n (selectionChanged)=\"onSelectionChanged($event)\"\r\n (sortChanged)=\"sortChanged.emit($event); onViewChange()\"\r\n (filterChanged)=\"filterChanged.emit($event); onViewChange()\"\r\n (paginationChanged)=\"onPaginationChanged($event)\"\r\n (rowGroupOpened)=\"rowGroupOpened.emit($event)\"\r\n (chartCreated)=\"chartsChanged.emit()\"\r\n (chartDestroyed)=\"chartsChanged.emit()\"\r\n (chartOptionsChanged)=\"chartsChanged.emit()\"\r\n (columnRowGroupChanged)=\"onViewChange()\"\r\n (columnValueChanged)=\"onViewChange()\"\r\n (columnPivotChanged)=\"onViewChange()\"\r\n (columnPivotModeChanged)=\"onViewChange()\"\r\n (columnMoved)=\"onViewChange()\"\r\n (columnPinned)=\"onViewChange()\"\r\n (columnVisible)=\"onViewChange()\"\r\n (columnResized)=\"$event.finished && onViewChange()\"\r\n />\r\n</div>\r\n<ng-template #emptyState>\r\n <mt-empty-state\r\n [title]=\"emptyTitle() ?? ''\"\r\n [description]=\"emptyDescription() ?? ''\"\r\n />\r\n</ng-template>\r\n", styles: [":host{display:block}.mt-standard-grid{display:flex;flex-direction:column;gap:12px}.mt-standard-grid-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}.mt-standard-grid-toolbar:empty{display:none}.mt-standard-grid-export{margin-inline-start:auto}:host ::ng-deep .mt-standard-grid-row-clickable{cursor:pointer}\n"], dependencies: [{ kind: "component", type: MtDataGridComponent, selector: "mt-data-grid", inputs: ["rowData", "dataProcessing", "columnDefs", "getRowId", "height", "autoHeight", "autoHeightMaxRows", "autoHeightMinRows", "rowHeight", "getRowClass", "animateRows", "headerHeight", "groupHeaderHeight", "direction", "localeText", "localeTextResolver", "ariaLabel", "loading", "noRowsText", "loadingText", "noRowsTemplate", "autoSizeStrategy", "columnMenu", "mainMenuItems", "autoSizePadding", "quickFilterText", "showQuickFilter", "showRowCount", "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: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: TableActionsMenu, selector: "mt-table-actions-menu", inputs: ["exportable", "printable", "groupable", "groupColumns", "activeGroup"], outputs: ["exportRequested", "printRequested", "groupChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2214
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: MtStandardGridComponent, isStandalone: true, selector: "mt-standard-grid", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, rowId: { classPropertyName: "rowId", publicName: "rowId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", 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 }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, exportButtons: { classPropertyName: "exportButtons", publicName: "exportButtons", isSignal: true, isRequired: false, transformFunction: null }, exportName: { classPropertyName: "exportName", publicName: "exportName", isSignal: true, isRequired: false, transformFunction: null }, exportFormats: { classPropertyName: "exportFormats", publicName: "exportFormats", isSignal: true, isRequired: false, transformFunction: null }, exporter: { classPropertyName: "exporter", publicName: "exporter", isSignal: true, isRequired: false, transformFunction: null }, rowMenuItems: { classPropertyName: "rowMenuItems", publicName: "rowMenuItems", isSignal: true, isRequired: false, transformFunction: null }, rowMenuLeadItems: { classPropertyName: "rowMenuLeadItems", publicName: "rowMenuLeadItems", isSignal: true, isRequired: false, transformFunction: null }, server: { classPropertyName: "server", publicName: "server", isSignal: true, isRequired: false, transformFunction: null }, paged: { classPropertyName: "paged", publicName: "paged", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, clickableRows: { classPropertyName: "clickableRows", publicName: "clickableRows", isSignal: true, isRequired: false, transformFunction: null }, cellClickFilter: { classPropertyName: "cellClickFilter", publicName: "cellClickFilter", isSignal: true, isRequired: false, transformFunction: null }, rowClass: { classPropertyName: "rowClass", publicName: "rowClass", isSignal: true, isRequired: false, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: false, transformFunction: null }, chartContext: { classPropertyName: "chartContext", publicName: "chartContext", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, emptyTitle: { classPropertyName: "emptyTitle", publicName: "emptyTitle", isSignal: true, isRequired: false, transformFunction: null }, emptyDescription: { classPropertyName: "emptyDescription", publicName: "emptyDescription", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, chartPersistence: { classPropertyName: "chartPersistence", publicName: "chartPersistence", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gridReady: "gridReady", rowClicked: "rowClicked", selectionChanged: "selectionChanged", sortChanged: "sortChanged", filterChanged: "filterChanged", paginationChanged: "paginationChanged", rowGroupOpened: "rowGroupOpened", viewChanged: "viewChanged", chartsChanged: "chartsChanged" }, viewQueries: [{ propertyName: "grid", first: true, predicate: MtDataGridComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"mt-standard-grid\">\n <div class=\"mt-standard-grid-toolbar\">\n <ng-content select=\"[mtGridToolbar]\" />\n @if (excelButton() || printButton()) {\n <mt-table-actions-menu\n class=\"mt-standard-grid-export\"\n [exportable]=\"excelButton()\"\n [printable]=\"printButton()\"\n (exportRequested)=\"exportAs('excel')\"\n (printRequested)=\"exportAs('pdf')\"\n />\n }\n </div>\n <mt-data-grid\n [rowData]=\"rows()\"\n [columnDefs]=\"standardColumns()\"\n [getRowId]=\"rowId()\"\n [dataProcessing]=\"server() ? 'external' : 'client'\"\n [height]=\"gridHeight()\"\n [rowHeight]=\"rowHeight()\"\n [autoHeight]=\"height() === 'auto'\"\n [autoSizeStrategy]=\"fit\"\n [ariaLabel]=\"label()\"\n [loading]=\"loading()\"\n [direction]=\"direction()\"\n [localeText]=\"text.gridLocale()\"\n [showQuickFilter]=\"true\"\n [showRowCount]=\"true\"\n [quickFilterText]=\"search()\"\n rowGroupPanelShow=\"always\"\n pivotPanelShow=\"onlyWhenPivoting\"\n [sideBar]=\"sideBar()\"\n [statusBar]=\"statusBar\"\n [getRowClass]=\"gridRowClass()\"\n [rowSelection]=\"selectionOptions()\"\n [cellSelection]=\"cellSelection\"\n [enableCharts]=\"true\"\n [chartContext]=\"chartTitle()\"\n [chartRecordsLabel]=\"label()\"\n [animateRows]=\"true\"\n [suppressCutToClipboard]=\"true\"\n [suppressCsvExport]=\"!csvAllowed()\"\n [suppressExcelExport]=\"!excelAllowed()\"\n [suppressPdfExport]=\"true\"\n [defaultCsvExportParams]=\"exportParams()\"\n [defaultExcelExportParams]=\"exportParams()\"\n [getContextMenuItems]=\"contextMenu\"\n groupDisplayType=\"groupRows\"\n [groupMaintainOrder]=\"true\"\n [autoGroupColumnDef]=\"autoGroupColumnDef()\"\n [groupDefaultExpanded]=\"-1\"\n [pagination]=\"paged()\"\n paginationPanelShow=\"whenNeeded\"\n [paginationPageSize]=\"gridPageSize()\"\n [paginationPageSizeSelector]=\"pageSizes\"\n [paginationTotalRows]=\"pagedTotal()\"\n [paginationCurrentPage]=\"pagedPage()\"\n [masterDetail]=\"detail() !== null\"\n [detailCellRenderer]=\"detailRenderer()\"\n [detailCellRendererParams]=\"detailParams()\"\n [detailRowAutoHeight]=\"true\"\n [isRowMaster]=\"isRowMaster()\"\n [noRowsTemplate]=\"emptyTitle() ? emptyState : undefined\"\n (gridReady)=\"onReady($event)\"\n (rowClicked)=\"onRowClicked($event)\"\n (selectionChanged)=\"onSelectionChanged($event)\"\n (sortChanged)=\"sortChanged.emit($event); onViewChange()\"\n (filterChanged)=\"filterChanged.emit($event); onViewChange()\"\n (paginationChanged)=\"onPaginationChanged($event)\"\n (rowGroupOpened)=\"rowGroupOpened.emit($event)\"\n (chartCreated)=\"chartsChanged.emit()\"\n (chartDestroyed)=\"chartsChanged.emit()\"\n (chartOptionsChanged)=\"chartsChanged.emit()\"\n (chartStateChanged)=\"onChartStateChanged($event)\"\n (columnRowGroupChanged)=\"onViewChange()\"\n (columnValueChanged)=\"onViewChange()\"\n (columnPivotChanged)=\"onViewChange()\"\n (columnPivotModeChanged)=\"onViewChange()\"\n (columnMoved)=\"onViewChange()\"\n (columnPinned)=\"onViewChange()\"\n (columnVisible)=\"onViewChange()\"\n (columnResized)=\"$event.finished && onViewChange()\"\n (cellSelectionChanged)=\"onCellSelection($event)\"\n >\n <!-- The Chart split button, in the grid's top strip after the quick filter. -->\n <div\n mtGridTopStrip\n class=\"mt-standard-grid-chart\"\n role=\"group\"\n [attr.aria-label]=\"text.text('chartAction')\"\n [attr.title]=\"hasRange() ? null : text.text('chartNeedsCells')\"\n >\n <mt-button\n class=\"mt-standard-grid-chart-main\"\n icon=\"chart.bar-chart-01\"\n [label]=\"text.text('chartAction')\"\n severity=\"secondary\"\n variant=\"outlined\"\n size=\"small\"\n [disabled]=\"!hasRange()\"\n [tooltip]=\"hasRange() ? '' : text.text('chartNeedsCells')\"\n (onClick)=\"createChart()\"\n />\n <mt-button\n class=\"mt-standard-grid-chart-types\"\n icon=\"arrow.chevron-down\"\n severity=\"secondary\"\n variant=\"outlined\"\n size=\"small\"\n [disabled]=\"!hasRange()\"\n [ariaLabel]=\"text.text('chartTypes')\"\n [tooltip]=\"\n hasRange() ? text.text('chartTypes') : text.text('chartNeedsCells')\n \"\n (onClick)=\"chartMenu.toggle($event)\"\n />\n <mt-menu\n #chartMenu\n [model]=\"chartTypeItems()\"\n [ariaLabel]=\"text.text('chartTypes')\"\n />\n </div>\n </mt-data-grid>\n</div>\n<ng-template #emptyState>\n <mt-empty-state\n [title]=\"emptyTitle() ?? ''\"\n [description]=\"emptyDescription() ?? ''\"\n />\n</ng-template>\n", styles: [":host{display:block}.mt-standard-grid{display:flex;flex-direction:column;gap:12px}.mt-standard-grid-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}.mt-standard-grid-toolbar:empty{display:none}.mt-standard-grid-export{margin-inline-start:auto}:host ::ng-deep .mt-standard-grid-row-clickable{cursor:pointer}.mt-standard-grid-chart{display:inline-flex;flex:none;align-items:center;align-self:center;margin-inline-end:12px}.mt-standard-grid-chart-types{margin-inline-start:-1px}:host ::ng-deep .mt-standard-grid-chart-main .p-button{border-start-end-radius:0;border-end-end-radius:0}:host ::ng-deep .mt-standard-grid-chart-types .p-button{border-start-start-radius:0;border-end-start-radius:0}\n"], dependencies: [{ kind: "component", type: MtDataGridComponent, selector: "mt-data-grid", inputs: ["rowData", "dataProcessing", "columnDefs", "getRowId", "height", "autoHeight", "autoHeightMaxRows", "autoHeightMinRows", "rowHeight", "getRowClass", "animateRows", "headerHeight", "groupHeaderHeight", "direction", "localeText", "localeTextResolver", "ariaLabel", "loading", "noRowsText", "loadingText", "noRowsTemplate", "autoSizeStrategy", "columnMenu", "mainMenuItems", "autoSizePadding", "quickFilterText", "showQuickFilter", "showRowCount", "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", "chartStateChanged"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: TableActionsMenu, selector: "mt-table-actions-menu", inputs: ["exportable", "printable", "groupable", "groupColumns", "activeGroup"], outputs: ["exportRequested", "printRequested", "groupChange"] }, { 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 });
|
|
1352
2215
|
}
|
|
1353
2216
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtStandardGridComponent, decorators: [{
|
|
1354
2217
|
type: Component,
|
|
1355
|
-
args: [{ selector: 'mt-standard-grid', imports: [MtDataGridComponent, EmptyState, TableActionsMenu], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mt-standard-grid\">\
|
|
1356
|
-
}], propDecorators: { rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], rowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], exportButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportButtons", required: false }] }], exportName: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportName", required: false }] }], exportFormats: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportFormats", required: false }] }], exporter: [{ type: i0.Input, args: [{ isSignal: true, alias: "exporter", required: false }] }], rowMenuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowMenuItems", required: false }] }], server: [{ type: i0.Input, args: [{ isSignal: true, alias: "server", required: false }] }], paged: [{ type: i0.Input, args: [{ isSignal: true, alias: "paged", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], clickableRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableRows", required: false }] }], cellClickFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellClickFilter", required: false }] }], rowClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowClass", required: false }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], chartContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "chartContext", required: false }] }], search: [{ type: i0.Input, args: [{ isSignal: true, alias: "search", required: false }] }], emptyTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyTitle", required: false }] }], emptyDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyDescription", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], gridReady: [{ type: i0.Output, args: ["gridReady"] }], rowClicked: [{ type: i0.Output, args: ["rowClicked"] }], selectionChanged: [{ type: i0.Output, args: ["selectionChanged"] }], sortChanged: [{ type: i0.Output, args: ["sortChanged"] }], filterChanged: [{ type: i0.Output, args: ["filterChanged"] }], paginationChanged: [{ type: i0.Output, args: ["paginationChanged"] }], rowGroupOpened: [{ type: i0.Output, args: ["rowGroupOpened"] }], viewChanged: [{ type: i0.Output, args: ["viewChanged"] }], chartsChanged: [{ type: i0.Output, args: ["chartsChanged"] }], grid: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MtDataGridComponent), { isSignal: true }] }] } });
|
|
2218
|
+
args: [{ selector: 'mt-standard-grid', imports: [MtDataGridComponent, EmptyState, TableActionsMenu, Button, Menu], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mt-standard-grid\">\n <div class=\"mt-standard-grid-toolbar\">\n <ng-content select=\"[mtGridToolbar]\" />\n @if (excelButton() || printButton()) {\n <mt-table-actions-menu\n class=\"mt-standard-grid-export\"\n [exportable]=\"excelButton()\"\n [printable]=\"printButton()\"\n (exportRequested)=\"exportAs('excel')\"\n (printRequested)=\"exportAs('pdf')\"\n />\n }\n </div>\n <mt-data-grid\n [rowData]=\"rows()\"\n [columnDefs]=\"standardColumns()\"\n [getRowId]=\"rowId()\"\n [dataProcessing]=\"server() ? 'external' : 'client'\"\n [height]=\"gridHeight()\"\n [rowHeight]=\"rowHeight()\"\n [autoHeight]=\"height() === 'auto'\"\n [autoSizeStrategy]=\"fit\"\n [ariaLabel]=\"label()\"\n [loading]=\"loading()\"\n [direction]=\"direction()\"\n [localeText]=\"text.gridLocale()\"\n [showQuickFilter]=\"true\"\n [showRowCount]=\"true\"\n [quickFilterText]=\"search()\"\n rowGroupPanelShow=\"always\"\n pivotPanelShow=\"onlyWhenPivoting\"\n [sideBar]=\"sideBar()\"\n [statusBar]=\"statusBar\"\n [getRowClass]=\"gridRowClass()\"\n [rowSelection]=\"selectionOptions()\"\n [cellSelection]=\"cellSelection\"\n [enableCharts]=\"true\"\n [chartContext]=\"chartTitle()\"\n [chartRecordsLabel]=\"label()\"\n [animateRows]=\"true\"\n [suppressCutToClipboard]=\"true\"\n [suppressCsvExport]=\"!csvAllowed()\"\n [suppressExcelExport]=\"!excelAllowed()\"\n [suppressPdfExport]=\"true\"\n [defaultCsvExportParams]=\"exportParams()\"\n [defaultExcelExportParams]=\"exportParams()\"\n [getContextMenuItems]=\"contextMenu\"\n groupDisplayType=\"groupRows\"\n [groupMaintainOrder]=\"true\"\n [autoGroupColumnDef]=\"autoGroupColumnDef()\"\n [groupDefaultExpanded]=\"-1\"\n [pagination]=\"paged()\"\n paginationPanelShow=\"whenNeeded\"\n [paginationPageSize]=\"gridPageSize()\"\n [paginationPageSizeSelector]=\"pageSizes\"\n [paginationTotalRows]=\"pagedTotal()\"\n [paginationCurrentPage]=\"pagedPage()\"\n [masterDetail]=\"detail() !== null\"\n [detailCellRenderer]=\"detailRenderer()\"\n [detailCellRendererParams]=\"detailParams()\"\n [detailRowAutoHeight]=\"true\"\n [isRowMaster]=\"isRowMaster()\"\n [noRowsTemplate]=\"emptyTitle() ? emptyState : undefined\"\n (gridReady)=\"onReady($event)\"\n (rowClicked)=\"onRowClicked($event)\"\n (selectionChanged)=\"onSelectionChanged($event)\"\n (sortChanged)=\"sortChanged.emit($event); onViewChange()\"\n (filterChanged)=\"filterChanged.emit($event); onViewChange()\"\n (paginationChanged)=\"onPaginationChanged($event)\"\n (rowGroupOpened)=\"rowGroupOpened.emit($event)\"\n (chartCreated)=\"chartsChanged.emit()\"\n (chartDestroyed)=\"chartsChanged.emit()\"\n (chartOptionsChanged)=\"chartsChanged.emit()\"\n (chartStateChanged)=\"onChartStateChanged($event)\"\n (columnRowGroupChanged)=\"onViewChange()\"\n (columnValueChanged)=\"onViewChange()\"\n (columnPivotChanged)=\"onViewChange()\"\n (columnPivotModeChanged)=\"onViewChange()\"\n (columnMoved)=\"onViewChange()\"\n (columnPinned)=\"onViewChange()\"\n (columnVisible)=\"onViewChange()\"\n (columnResized)=\"$event.finished && onViewChange()\"\n (cellSelectionChanged)=\"onCellSelection($event)\"\n >\n <!-- The Chart split button, in the grid's top strip after the quick filter. -->\n <div\n mtGridTopStrip\n class=\"mt-standard-grid-chart\"\n role=\"group\"\n [attr.aria-label]=\"text.text('chartAction')\"\n [attr.title]=\"hasRange() ? null : text.text('chartNeedsCells')\"\n >\n <mt-button\n class=\"mt-standard-grid-chart-main\"\n icon=\"chart.bar-chart-01\"\n [label]=\"text.text('chartAction')\"\n severity=\"secondary\"\n variant=\"outlined\"\n size=\"small\"\n [disabled]=\"!hasRange()\"\n [tooltip]=\"hasRange() ? '' : text.text('chartNeedsCells')\"\n (onClick)=\"createChart()\"\n />\n <mt-button\n class=\"mt-standard-grid-chart-types\"\n icon=\"arrow.chevron-down\"\n severity=\"secondary\"\n variant=\"outlined\"\n size=\"small\"\n [disabled]=\"!hasRange()\"\n [ariaLabel]=\"text.text('chartTypes')\"\n [tooltip]=\"\n hasRange() ? text.text('chartTypes') : text.text('chartNeedsCells')\n \"\n (onClick)=\"chartMenu.toggle($event)\"\n />\n <mt-menu\n #chartMenu\n [model]=\"chartTypeItems()\"\n [ariaLabel]=\"text.text('chartTypes')\"\n />\n </div>\n </mt-data-grid>\n</div>\n<ng-template #emptyState>\n <mt-empty-state\n [title]=\"emptyTitle() ?? ''\"\n [description]=\"emptyDescription() ?? ''\"\n />\n</ng-template>\n", styles: [":host{display:block}.mt-standard-grid{display:flex;flex-direction:column;gap:12px}.mt-standard-grid-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}.mt-standard-grid-toolbar:empty{display:none}.mt-standard-grid-export{margin-inline-start:auto}:host ::ng-deep .mt-standard-grid-row-clickable{cursor:pointer}.mt-standard-grid-chart{display:inline-flex;flex:none;align-items:center;align-self:center;margin-inline-end:12px}.mt-standard-grid-chart-types{margin-inline-start:-1px}:host ::ng-deep .mt-standard-grid-chart-main .p-button{border-start-end-radius:0;border-end-end-radius:0}:host ::ng-deep .mt-standard-grid-chart-types .p-button{border-start-start-radius:0;border-end-start-radius:0}\n"] }]
|
|
2219
|
+
}], ctorParameters: () => [], propDecorators: { rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], rowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], exportButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportButtons", required: false }] }], exportName: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportName", required: false }] }], exportFormats: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportFormats", required: false }] }], exporter: [{ type: i0.Input, args: [{ isSignal: true, alias: "exporter", required: false }] }], rowMenuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowMenuItems", required: false }] }], rowMenuLeadItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowMenuLeadItems", required: false }] }], server: [{ type: i0.Input, args: [{ isSignal: true, alias: "server", required: false }] }], paged: [{ type: i0.Input, args: [{ isSignal: true, alias: "paged", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], clickableRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableRows", required: false }] }], cellClickFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellClickFilter", required: false }] }], rowClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowClass", required: false }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], chartContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "chartContext", required: false }] }], search: [{ type: i0.Input, args: [{ isSignal: true, alias: "search", required: false }] }], emptyTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyTitle", required: false }] }], emptyDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyDescription", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], chartPersistence: [{ type: i0.Input, args: [{ isSignal: true, alias: "chartPersistence", required: false }] }], gridReady: [{ type: i0.Output, args: ["gridReady"] }], rowClicked: [{ type: i0.Output, args: ["rowClicked"] }], selectionChanged: [{ type: i0.Output, args: ["selectionChanged"] }], sortChanged: [{ type: i0.Output, args: ["sortChanged"] }], filterChanged: [{ type: i0.Output, args: ["filterChanged"] }], paginationChanged: [{ type: i0.Output, args: ["paginationChanged"] }], rowGroupOpened: [{ type: i0.Output, args: ["rowGroupOpened"] }], viewChanged: [{ type: i0.Output, args: ["viewChanged"] }], chartsChanged: [{ type: i0.Output, args: ["chartsChanged"] }], grid: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MtDataGridComponent), { isSignal: true }] }] } });
|
|
1357
2220
|
|
|
1358
2221
|
/** The standard row-actions column id. */
|
|
1359
2222
|
const MT_ACTIONS_COLUMN_ID = '$actions';
|
|
@@ -1616,5 +2479,5 @@ function mtTableColumn(column, rows) {
|
|
|
1616
2479
|
* Generated bundle index. Do not edit.
|
|
1617
2480
|
*/
|
|
1618
2481
|
|
|
1619
|
-
export { MT_ACTIONS_COLUMN_ID, MtActionsCell, MtDataTableEntityCell, MtStandardGridComponent, MtTableText, MtTemplateCell, mtActionsColumn, mtEntityCategoryValues, mtEntityCellValues, mtEntityColumn, mtEntityExportValue, mtIsControlColumn, mtStandardColumns, mtTableColumns, mtTablePrintConfiguration };
|
|
2482
|
+
export { MT_ACTIONS_COLUMN_ID, MT_GRID_CHARTS_MAX, MT_GRID_CHARTS_MAX_LENGTH, MT_GRID_CHART_MAX_ROW_IDS, MT_GRID_SERVER_CHARTS_OPTIONS, MtActionsCell, MtDataTableEntityCell, MtLocalChartStore, MtServerChartStore, MtStandardGridComponent, MtTableText, MtTemplateCell, fitMtGridCharts, mtActionsColumn, mtEntityCategoryValues, mtEntityCellValues, mtEntityColumn, mtEntityExportValue, mtGridChartServerKey, mtIsControlColumn, mtStandardColumns, mtTableColumns, mtTablePrintConfiguration, parseMtGridCharts, provideMTGridServerCharts, serializeMtGridCharts };
|
|
1620
2483
|
//# sourceMappingURL=masterteam-data-table.mjs.map
|