@cellaware/utils 8.11.15 → 8.11.17
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/dist/chatwms/datagrid.js +14 -26
- package/package.json +1 -1
package/dist/chatwms/datagrid.js
CHANGED
|
@@ -1235,6 +1235,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1235
1235
|
const columnFormats = datagridState.columnFormats ?? [];
|
|
1236
1236
|
const { rowGroupCols, pivotCols, valueCols, sortModel } = parseColumnState(columnState);
|
|
1237
1237
|
rows = filterRows(rows, filterModel);
|
|
1238
|
+
let adjRows = [];
|
|
1238
1239
|
const chartRows = [];
|
|
1239
1240
|
let htmlBuf = '';
|
|
1240
1241
|
let htmlTransposeBuf = '';
|
|
@@ -1252,7 +1253,8 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1252
1253
|
// Should not need to do hidden/visible column analysis -- pivoting creates new results with only the necessary columns.
|
|
1253
1254
|
// Also should not need to analyze column sequence -- our newly created results *should* respect the correct sequence.
|
|
1254
1255
|
let rowIdx = 0;
|
|
1255
|
-
rows.forEach(row => {
|
|
1256
|
+
rows.forEach((row) => {
|
|
1257
|
+
let adjRow = {};
|
|
1256
1258
|
let chartRow = {};
|
|
1257
1259
|
let htmlRowValues = [];
|
|
1258
1260
|
let htmlRowStyles = [];
|
|
@@ -1264,7 +1266,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1264
1266
|
if (columnFormat.name in row) {
|
|
1265
1267
|
const value = row[columnFormat.name];
|
|
1266
1268
|
const formattedValue = evaluateValueFormat(columnFormat, value, locale);
|
|
1267
|
-
|
|
1269
|
+
adjRow[columnFormat.displayName] = formattedValue;
|
|
1268
1270
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1269
1271
|
htmlRowValues.push(formattedValue);
|
|
1270
1272
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
@@ -1272,10 +1274,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1272
1274
|
if (rowIdx === 0) {
|
|
1273
1275
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1274
1276
|
}
|
|
1275
|
-
// Remove name in favor of display name.
|
|
1276
|
-
if (columnFormat.displayName !== columnFormat.name) {
|
|
1277
|
-
delete row[columnFormat.name];
|
|
1278
|
-
}
|
|
1279
1277
|
}
|
|
1280
1278
|
else {
|
|
1281
1279
|
const mappedColumnNamesSet = pivotOutput.mappedColumnNames.get(columnFormat.name);
|
|
@@ -1286,7 +1284,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1286
1284
|
const adjDisplayName = mappedColumnName.replace(columnFormat.name, columnFormat.displayName);
|
|
1287
1285
|
const value = row[mappedColumnName];
|
|
1288
1286
|
const formattedValue = evaluateValueFormat(columnFormat, value, locale);
|
|
1289
|
-
|
|
1287
|
+
adjRow[adjDisplayName] = formattedValue;
|
|
1290
1288
|
chartRow[adjDisplayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1291
1289
|
htmlRowValues.push(formattedValue);
|
|
1292
1290
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, adjDisplayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
@@ -1294,10 +1292,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1294
1292
|
if (rowIdx === 0) {
|
|
1295
1293
|
htmlColumnNames.push(adjDisplayName);
|
|
1296
1294
|
}
|
|
1297
|
-
// Remove name in favor of display name.
|
|
1298
|
-
if (adjDisplayName !== mappedColumnName) {
|
|
1299
|
-
delete row[mappedColumnName];
|
|
1300
|
-
}
|
|
1301
1295
|
let displayColumnNames = mappedDisplayColumnNames.get(columnFormat.displayName);
|
|
1302
1296
|
if (!!displayColumnNames) {
|
|
1303
1297
|
displayColumnNames.add(adjDisplayName);
|
|
@@ -1311,6 +1305,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1311
1305
|
}
|
|
1312
1306
|
}
|
|
1313
1307
|
});
|
|
1308
|
+
adjRows.push(adjRow);
|
|
1314
1309
|
chartRows.push(chartRow);
|
|
1315
1310
|
if (rowIdx < DATAGRID_HTML_ROWS) {
|
|
1316
1311
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, DATAGRID_HTML_COLS);
|
|
@@ -1340,11 +1335,10 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1340
1335
|
rows = groupAndAggregate(rows, rowGroupCols, [], valueCols);
|
|
1341
1336
|
}
|
|
1342
1337
|
rows = sortModel.length > 0 ? sortRows(rows, sortModel) : rows;
|
|
1343
|
-
const visibleColumnState = columnState.filter(column => !column.hide);
|
|
1344
|
-
const hiddenColumnNames = columnState.filter(column => !!column.hide && !column.rowGroup).map(column => column.colId) ?? [];
|
|
1345
|
-
const visibleColumnFormats = columnFormats.filter(column => !hiddenColumnNames.includes(column.name)) ?? [];
|
|
1338
|
+
const visibleColumnState = columnState.filter(column => !column.hide || !!column.rowGroup);
|
|
1346
1339
|
let rowIdx = 0;
|
|
1347
|
-
rows.forEach(row => {
|
|
1340
|
+
rows.forEach((row) => {
|
|
1341
|
+
let adjRow = {};
|
|
1348
1342
|
let chartRow = {};
|
|
1349
1343
|
let htmlRowValues = [];
|
|
1350
1344
|
let htmlRowStyles = [];
|
|
@@ -1352,16 +1346,13 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1352
1346
|
let htmlTransposeColumnStyles = [];
|
|
1353
1347
|
let teamsRowStyles = [];
|
|
1354
1348
|
let teamsColumnStyles = [];
|
|
1355
|
-
hiddenColumnNames.forEach(columnName => {
|
|
1356
|
-
delete row[columnName];
|
|
1357
|
-
});
|
|
1358
1349
|
// Important: anchoring to column state will ensure we add columns in the correct sequence.
|
|
1359
1350
|
visibleColumnState.forEach(column => {
|
|
1360
|
-
const columnFormat =
|
|
1351
|
+
const columnFormat = columnFormats.find(columnFormat => columnFormat.name === column.colId);
|
|
1361
1352
|
if (!!columnFormat) {
|
|
1362
1353
|
const value = row[columnFormat.name];
|
|
1363
1354
|
const formattedValue = evaluateValueFormat(columnFormat, value, locale);
|
|
1364
|
-
|
|
1355
|
+
adjRow[columnFormat.displayName] = formattedValue;
|
|
1365
1356
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1366
1357
|
htmlRowValues.push(formattedValue);
|
|
1367
1358
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
@@ -1369,12 +1360,9 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1369
1360
|
if (rowIdx === 0) {
|
|
1370
1361
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1371
1362
|
}
|
|
1372
|
-
// Remove name in favor of display name.
|
|
1373
|
-
if (columnFormat.displayName !== columnFormat.name) {
|
|
1374
|
-
delete row[columnFormat.name];
|
|
1375
|
-
}
|
|
1376
1363
|
}
|
|
1377
1364
|
});
|
|
1365
|
+
adjRows.push(adjRow);
|
|
1378
1366
|
chartRows.push(chartRow);
|
|
1379
1367
|
if (rowIdx < DATAGRID_HTML_ROWS) {
|
|
1380
1368
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, DATAGRID_HTML_COLS);
|
|
@@ -1396,12 +1384,12 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1396
1384
|
rowIdx++;
|
|
1397
1385
|
});
|
|
1398
1386
|
if (!!condition) {
|
|
1399
|
-
|
|
1387
|
+
adjRows = evaluateDatagridCondition(rows, condition);
|
|
1400
1388
|
}
|
|
1401
1389
|
}
|
|
1402
1390
|
return {
|
|
1403
1391
|
...datagridState,
|
|
1404
|
-
adjRows
|
|
1392
|
+
adjRows,
|
|
1405
1393
|
chartRows,
|
|
1406
1394
|
html: `<p style="font-size: 12px;">Displaying first <b>${DATAGRID_HTML_ROWS} rows</b> and <b>${DATAGRID_HTML_COLS} columns</b></p>\n\n${buildHtmlTableHeader(htmlColumnNames.slice(0, DATAGRID_HTML_COLS))}${htmlBuf}${buildHtmlTableFooter()}`,
|
|
1407
1395
|
teamsRows: [
|