@cellaware/utils 8.11.15 → 8.11.16
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 +12 -25
- 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);
|
|
@@ -1341,10 +1335,9 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1341
1335
|
}
|
|
1342
1336
|
rows = sortModel.length > 0 ? sortRows(rows, sortModel) : rows;
|
|
1343
1337
|
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)) ?? [];
|
|
1346
1338
|
let rowIdx = 0;
|
|
1347
|
-
rows.forEach(row => {
|
|
1339
|
+
rows.forEach((row) => {
|
|
1340
|
+
let adjRow = {};
|
|
1348
1341
|
let chartRow = {};
|
|
1349
1342
|
let htmlRowValues = [];
|
|
1350
1343
|
let htmlRowStyles = [];
|
|
@@ -1352,16 +1345,13 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1352
1345
|
let htmlTransposeColumnStyles = [];
|
|
1353
1346
|
let teamsRowStyles = [];
|
|
1354
1347
|
let teamsColumnStyles = [];
|
|
1355
|
-
hiddenColumnNames.forEach(columnName => {
|
|
1356
|
-
delete row[columnName];
|
|
1357
|
-
});
|
|
1358
1348
|
// Important: anchoring to column state will ensure we add columns in the correct sequence.
|
|
1359
1349
|
visibleColumnState.forEach(column => {
|
|
1360
|
-
const columnFormat =
|
|
1350
|
+
const columnFormat = columnFormats.find(columnFormat => columnFormat.name === column.colId);
|
|
1361
1351
|
if (!!columnFormat) {
|
|
1362
1352
|
const value = row[columnFormat.name];
|
|
1363
1353
|
const formattedValue = evaluateValueFormat(columnFormat, value, locale);
|
|
1364
|
-
|
|
1354
|
+
adjRow[columnFormat.displayName] = formattedValue;
|
|
1365
1355
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1366
1356
|
htmlRowValues.push(formattedValue);
|
|
1367
1357
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
@@ -1369,12 +1359,9 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1369
1359
|
if (rowIdx === 0) {
|
|
1370
1360
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1371
1361
|
}
|
|
1372
|
-
// Remove name in favor of display name.
|
|
1373
|
-
if (columnFormat.displayName !== columnFormat.name) {
|
|
1374
|
-
delete row[columnFormat.name];
|
|
1375
|
-
}
|
|
1376
1362
|
}
|
|
1377
1363
|
});
|
|
1364
|
+
adjRows.push(adjRow);
|
|
1378
1365
|
chartRows.push(chartRow);
|
|
1379
1366
|
if (rowIdx < DATAGRID_HTML_ROWS) {
|
|
1380
1367
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, DATAGRID_HTML_COLS);
|
|
@@ -1396,12 +1383,12 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1396
1383
|
rowIdx++;
|
|
1397
1384
|
});
|
|
1398
1385
|
if (!!condition) {
|
|
1399
|
-
|
|
1386
|
+
adjRows = evaluateDatagridCondition(rows, condition);
|
|
1400
1387
|
}
|
|
1401
1388
|
}
|
|
1402
1389
|
return {
|
|
1403
1390
|
...datagridState,
|
|
1404
|
-
adjRows
|
|
1391
|
+
adjRows,
|
|
1405
1392
|
chartRows,
|
|
1406
1393
|
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
1394
|
teamsRows: [
|