sea-chart 1.1.7 → 1.1.9
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/context.js +1 -1
- package/dist/utils/chart-utils/base-utils.js +42 -7
- package/dist/utils/chart-utils/index.js +2 -2
- package/dist/utils/chart-utils/sql-statistics-utils.js +154 -113
- package/dist/utils/collaborator-utils.js +14 -13
- package/dist/view/wrapper/table/pivot-table-display-name.js +15 -3
- package/package.json +1 -1
package/dist/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _BaseUtils;
|
|
2
2
|
import shallowEqual from 'shallowequal';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
|
-
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, getDateDisplayString, getNumberDisplayString, getOption, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, isNumericColumn, isDateColumn, sortText, sortNumber, sortDate, sortSingleSelect, sortFormula, getColumnOptions, DateUtils, getGeolocationDisplayString, getFormulaDisplayString, isArchiveView, getViewById } from 'dtable-utils';
|
|
4
|
+
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, getDateDisplayString, getNumberDisplayString, getOption, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, isNumericColumn, isDateColumn, sortText, sortNumber, sortDate, sortSingleSelect, sortFormula, getColumnOptions, DateUtils, getGeolocationDisplayString, getFormulaDisplayString, isArchiveView, getViewById, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP } from 'dtable-utils';
|
|
5
5
|
import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES } from '../../constants';
|
|
6
6
|
import { getClientFormulaDisplayString } from '../cell-format-utils';
|
|
7
7
|
import { getKnownCollaboratorByEmail, generateDefaultUser, getUsers } from '../collaborator-utils';
|
|
@@ -10,6 +10,21 @@ import ObjectUtils from '../object-utils';
|
|
|
10
10
|
import intl from '../../intl';
|
|
11
11
|
import context from '../../context';
|
|
12
12
|
import { isValidCollaboratorEmail } from '../collaborator';
|
|
13
|
+
export function findIfColumnDataIsArray(column) {
|
|
14
|
+
// link-formula may also be an array type column
|
|
15
|
+
let isGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[column.type];
|
|
16
|
+
if (column.type === CellType.LINK_FORMULA) {
|
|
17
|
+
const {
|
|
18
|
+
array_type,
|
|
19
|
+
result_type
|
|
20
|
+
} = column.data || {};
|
|
21
|
+
// collaborator, creator or last-modifier
|
|
22
|
+
if (COLLABORATOR_COLUMN_TYPES.includes(array_type) && result_type === 'array') {
|
|
23
|
+
isGroupbyColumnDataAsAnArray = true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return isGroupbyColumnDataAsAnArray;
|
|
27
|
+
}
|
|
13
28
|
class BaseUtils {}
|
|
14
29
|
_BaseUtils = BaseUtils;
|
|
15
30
|
BaseUtils.isCollaborator = column => {
|
|
@@ -672,14 +687,15 @@ BaseUtils.updateTableViewList = (result, column, nameKey, colorKey, isScatterCha
|
|
|
672
687
|
});
|
|
673
688
|
};
|
|
674
689
|
// sort chart
|
|
675
|
-
BaseUtils.sortCharts = (charts, column, sortKey) => {
|
|
676
|
-
|
|
690
|
+
BaseUtils.sortCharts = (charts, column, sortKey, isPivot) => {
|
|
691
|
+
let {
|
|
677
692
|
type: columnType,
|
|
678
693
|
data
|
|
679
694
|
} = column;
|
|
680
695
|
const sortType = 'up';
|
|
681
696
|
const optionIdIndexMap = {};
|
|
682
|
-
|
|
697
|
+
const isPivotMultipleSelect = columnType === CellType.MULTIPLE_SELECT && isPivot;
|
|
698
|
+
if ([CellType.SINGLE_SELECT].includes(columnType) || isPivotMultipleSelect) {
|
|
683
699
|
const {
|
|
684
700
|
options
|
|
685
701
|
} = data || {};
|
|
@@ -687,6 +703,17 @@ BaseUtils.sortCharts = (charts, column, sortKey) => {
|
|
|
687
703
|
optionIdIndexMap[option.id] = index;
|
|
688
704
|
});
|
|
689
705
|
}
|
|
706
|
+
const isPivotLinkFormulaSingleAndMultipleSelect = columnType === CellType.LINK_FORMULA && [CellType.SINGLE_SELECT, CellType.MULTIPLE_SELECT].includes(column.data.array_type) && isPivot;
|
|
707
|
+
if (isPivotLinkFormulaSingleAndMultipleSelect) {
|
|
708
|
+
var _column$data;
|
|
709
|
+
let {
|
|
710
|
+
options
|
|
711
|
+
} = ((_column$data = column.data) === null || _column$data === void 0 ? void 0 : _column$data.array_data) || {};
|
|
712
|
+
if (!options) options = [];
|
|
713
|
+
Array.isArray(options) && options.forEach((option, index) => {
|
|
714
|
+
optionIdIndexMap[option.id] = index;
|
|
715
|
+
});
|
|
716
|
+
}
|
|
690
717
|
charts.sort((currResult, nextResult) => {
|
|
691
718
|
let {
|
|
692
719
|
[sortKey]: current
|
|
@@ -701,7 +728,11 @@ BaseUtils.sortCharts = (charts, column, sortKey) => {
|
|
|
701
728
|
return 1;
|
|
702
729
|
}
|
|
703
730
|
if (CHART_SUPPORT_SORT_COLUMNS.includes(columnType)) {
|
|
704
|
-
|
|
731
|
+
let realColumnType = columnType;
|
|
732
|
+
if (columnType === CellType.LINK_FORMULA) {
|
|
733
|
+
realColumnType = column.data.array_type;
|
|
734
|
+
}
|
|
735
|
+
switch (realColumnType) {
|
|
705
736
|
case CellType.NUMBER:
|
|
706
737
|
case CellType.RATE:
|
|
707
738
|
{
|
|
@@ -1666,14 +1697,18 @@ BaseUtils.updateCollaboratorAndMultipleAvg = (pivot_rows, all) => {
|
|
|
1666
1697
|
return new_pivot_rows;
|
|
1667
1698
|
};
|
|
1668
1699
|
BaseUtils.isCollaboratorColumnOrMultipleColumn = columnMap => {
|
|
1700
|
+
var _groupbyColumn$data;
|
|
1669
1701
|
const {
|
|
1670
1702
|
columnGroupbyColumn,
|
|
1671
1703
|
groupbyColumn
|
|
1672
1704
|
} = columnMap || {};
|
|
1673
|
-
if (columnGroupbyColumn && groupbyColumn && (
|
|
1705
|
+
if (columnGroupbyColumn && groupbyColumn && (groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === CellType.COLLABORATOR) {
|
|
1706
|
+
return true;
|
|
1707
|
+
}
|
|
1708
|
+
if (columnGroupbyColumn && groupbyColumn && (groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === CellType.MULTIPLE_SELECT) {
|
|
1674
1709
|
return true;
|
|
1675
1710
|
}
|
|
1676
|
-
if (columnGroupbyColumn && groupbyColumn && (
|
|
1711
|
+
if (columnGroupbyColumn && groupbyColumn && (groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === CellType.LINK_FORMULA && [CellType.MULTIPLE_SELECT, CellType.COLLABORATOR].includes(groupbyColumn === null || groupbyColumn === void 0 ? void 0 : (_groupbyColumn$data = groupbyColumn.data) === null || _groupbyColumn$data === void 0 ? void 0 : _groupbyColumn$data.array_type)) {
|
|
1677
1712
|
return true;
|
|
1678
1713
|
}
|
|
1679
1714
|
return false;
|
|
@@ -13,7 +13,7 @@ ChartUtils.calculateChart = (chart, value, callback) => {
|
|
|
13
13
|
context.queryChartResult({
|
|
14
14
|
chart,
|
|
15
15
|
tables: value.tables,
|
|
16
|
-
onSuccess: function (res) {
|
|
16
|
+
onSuccess: async function (res) {
|
|
17
17
|
var _res$data;
|
|
18
18
|
let dataSources = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SQLStatisticsUtils.dataSources;
|
|
19
19
|
const {
|
|
@@ -29,7 +29,7 @@ ChartUtils.calculateChart = (chart, value, callback) => {
|
|
|
29
29
|
OriginalDataUtils.calculateChart(chart, value, callback);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
SQLStatisticsUtils.calculateChart(chart, value, callback, (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.results) || []);
|
|
32
|
+
await SQLStatisticsUtils.calculateChart(chart, value, callback, (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.results) || []);
|
|
33
33
|
},
|
|
34
34
|
onFail: err => {
|
|
35
35
|
let errorMessage = getErrorMessage(err);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _SQLStatisticsUtils;
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
|
-
import { CellType, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, getFormulaDisplayString, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, DateUtils } from 'dtable-utils';
|
|
3
|
+
import { CellType, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, getFormulaDisplayString, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, DateUtils, COLLABORATOR_COLUMN_TYPES } from 'dtable-utils';
|
|
4
4
|
import { isObject } from 'lodash';
|
|
5
5
|
import { cloneDeep } from 'lodash-es';
|
|
6
6
|
import { CHART_SUMMARY_TYPE, CHART_TYPE, SUPPORT_DATA_SORT_CHART_TYPES, TABLE_DIMENSIONS, Y_AXIS_TYPE_PREFIX, STYLE_COLORS, TREND_TYPES } from '../../constants';
|
|
@@ -10,11 +10,12 @@ import { column2SqlColumn } from '../sql/column-2-sql-column';
|
|
|
10
10
|
import { formatNumericValue, getFormattedValue, getSummaryResult } from '../column-utils';
|
|
11
11
|
import { getCompareDate } from '../trend-utils';
|
|
12
12
|
import intl from '../../intl';
|
|
13
|
-
import
|
|
13
|
+
import { getUsers } from '../collaborator-utils';
|
|
14
|
+
import BaseUtils, { findIfColumnDataIsArray } from './base-utils';
|
|
14
15
|
class SQLStatisticsUtils {}
|
|
15
16
|
_SQLStatisticsUtils = SQLStatisticsUtils;
|
|
16
17
|
SQLStatisticsUtils.dataSources = 'sql_statistics';
|
|
17
|
-
SQLStatisticsUtils.getGroupLabelFromDB = (cellValue, column, chart) => {
|
|
18
|
+
SQLStatisticsUtils.getGroupLabelFromDB = async (cellValue, column, chart, isPivot) => {
|
|
18
19
|
const dateGranularity = BaseUtils.getDateGranularityByType(chart);
|
|
19
20
|
const {
|
|
20
21
|
type,
|
|
@@ -72,15 +73,24 @@ SQLStatisticsUtils.getGroupLabelFromDB = (cellValue, column, chart) => {
|
|
|
72
73
|
case CellType.FORMULA:
|
|
73
74
|
case CellType.LINK_FORMULA:
|
|
74
75
|
{
|
|
75
|
-
const validValue = getFormulaDisplayString(cellValue, data);
|
|
76
76
|
const {
|
|
77
|
-
array_type
|
|
77
|
+
array_type,
|
|
78
|
+
result_type
|
|
78
79
|
} = data || {};
|
|
80
|
+
const validValue = getFormulaDisplayString(cellValue, data) || [];
|
|
79
81
|
if (array_type === 'date' && (cellValue === null || cellValue === void 0 ? void 0 : cellValue.length) === 1) {
|
|
80
82
|
if (!dateGranularity) return validValue;
|
|
81
83
|
if (dateGranularity.toUpperCase() === 'QUARTER') return DateUtils.getDateByGranularity(validValue, 'QUARTAR');
|
|
82
84
|
return DateUtils.getDateByGranularity(validValue, dateGranularity);
|
|
83
85
|
}
|
|
86
|
+
|
|
87
|
+
// collaborator, creator or last-modifier
|
|
88
|
+
if (COLLABORATOR_COLUMN_TYPES.includes(array_type) && result_type === 'array' && !isPivot) {
|
|
89
|
+
const users = await getUsers(validValue);
|
|
90
|
+
return users.map(user => user.name);
|
|
91
|
+
} else if (result_type === 'array' && isPivot) {
|
|
92
|
+
return cellValue;
|
|
93
|
+
}
|
|
84
94
|
if (!validValue && validValue !== 0) return null;
|
|
85
95
|
return validValue;
|
|
86
96
|
}
|
|
@@ -172,10 +182,7 @@ row, isColumnDataAsAnArray, cellValue, _ref2, chartSQLMap, columnMap) => {
|
|
|
172
182
|
const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
|
|
173
183
|
const {
|
|
174
184
|
sqlSummaryColumnKey,
|
|
175
|
-
summarySQLColumnName2ColumnKey = {}
|
|
176
|
-
summaryTableColumnKey2Column,
|
|
177
|
-
summaryTableColumnKey2Method,
|
|
178
|
-
isSingleNumericColumn
|
|
185
|
+
summarySQLColumnName2ColumnKey = {}
|
|
179
186
|
} = chartSQLMap;
|
|
180
187
|
|
|
181
188
|
// single_numeric_column is the first setting in multilpe_numeric_columns
|
|
@@ -260,7 +267,6 @@ row, isColumnDataAsAnArray, cellValue, _ref2, chartSQLMap, columnMap) => {
|
|
|
260
267
|
|
|
261
268
|
// add a new row
|
|
262
269
|
let cells = {};
|
|
263
|
-
// let total = BaseUtils.initTotal(summaryMethod);
|
|
264
270
|
let total = 0;
|
|
265
271
|
pivot_columns.forEach(c => {
|
|
266
272
|
let {
|
|
@@ -308,20 +314,13 @@ row, isColumnDataAsAnArray, cellValue, _ref2, chartSQLMap, columnMap) => {
|
|
|
308
314
|
total
|
|
309
315
|
});
|
|
310
316
|
};
|
|
311
|
-
SQLStatisticsUtils.getAndUpdateTwoDimensionTotal = (pivot_columns_total, pivot_columns, pivot_rows,
|
|
312
|
-
// { summaryMethod, summaryColumn },
|
|
313
|
-
pivot_table_total, chart) => {
|
|
314
|
-
const {
|
|
315
|
-
summary_type
|
|
316
|
-
} = chart.config;
|
|
317
|
-
const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
|
|
317
|
+
SQLStatisticsUtils.getAndUpdateTwoDimensionTotal = (pivot_columns_total, pivot_columns, pivot_rows, pivot_table_total, chart) => {
|
|
318
318
|
pivot_rows.forEach(row => {
|
|
319
319
|
const {
|
|
320
320
|
cells,
|
|
321
321
|
total
|
|
322
322
|
} = row;
|
|
323
323
|
pivot_table_total += total;
|
|
324
|
-
// pivot_table_total = BaseUtils.getSummaryValue({ summaryMethod, summaryColumn }, pivot_table_total, total);
|
|
325
324
|
pivot_columns.forEach(column => {
|
|
326
325
|
const {
|
|
327
326
|
key
|
|
@@ -334,13 +333,12 @@ pivot_table_total, chart) => {
|
|
|
334
333
|
return acc;
|
|
335
334
|
}, 0) : parseInt(cell.total);
|
|
336
335
|
pivot_columns_total[key] = pivot_column_total + currentCellTotal;
|
|
337
|
-
// pivot_columns_total[key] = BaseUtils.getSummaryValue({ summaryMethod, summaryColumn }, pivot_column_total, cell.total);
|
|
338
336
|
}
|
|
339
337
|
});
|
|
340
338
|
});
|
|
341
339
|
return [pivot_columns_total, pivot_table_total];
|
|
342
340
|
};
|
|
343
|
-
SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
341
|
+
SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
344
342
|
const {
|
|
345
343
|
groupbyColumn
|
|
346
344
|
} = columnMap;
|
|
@@ -354,24 +352,35 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
354
352
|
let pivot_columns = [];
|
|
355
353
|
let pivot_rows = [];
|
|
356
354
|
const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
|
|
355
|
+
|
|
356
|
+
// handle LINK_FORMULA
|
|
357
|
+
const isGroupByColumnLinkFormula = groupbyColumn.type === CellType.LINK_FORMULA;
|
|
357
358
|
let newSqlRows = sqlRows;
|
|
359
|
+
if (isGroupByColumnLinkFormula) {
|
|
360
|
+
const {
|
|
361
|
+
array_type
|
|
362
|
+
} = groupbyColumn.data;
|
|
363
|
+
if ([CellType.COLLABORATOR, CellType.MULTIPLE_SELECT].includes(array_type)) {
|
|
364
|
+
newSqlRows = BaseUtils.formatedTableSqlRowsByCollaboratorAndMultiple(chart, sqlRows, chartSQLMap, columnMap);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
358
367
|
if ([CellType.COLLABORATOR, CellType.MULTIPLE_SELECT].includes(groupbyColumn.type)) {
|
|
359
368
|
newSqlRows = BaseUtils.formatedTableSqlRowsByCollaboratorAndMultiple(chart, sqlRows, chartSQLMap, columnMap);
|
|
360
369
|
}
|
|
361
370
|
if (isCount) {
|
|
362
371
|
let allTotal = 0;
|
|
363
|
-
|
|
372
|
+
for (const row of newSqlRows) {
|
|
364
373
|
const total = row[sqlSummaryColumnKey] || 0;
|
|
365
374
|
allTotal += total;
|
|
366
375
|
pivot_rows.push({
|
|
367
|
-
name: _SQLStatisticsUtils.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, chart.config),
|
|
376
|
+
name: await _SQLStatisticsUtils.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, chart.config, true),
|
|
368
377
|
rows: [],
|
|
369
378
|
total: {
|
|
370
379
|
total
|
|
371
380
|
}
|
|
372
381
|
});
|
|
373
|
-
}
|
|
374
|
-
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name');
|
|
382
|
+
}
|
|
383
|
+
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name', true);
|
|
375
384
|
return {
|
|
376
385
|
pivot_columns,
|
|
377
386
|
pivot_rows: pivot_rows,
|
|
@@ -398,10 +407,11 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
398
407
|
let allTotal = {
|
|
399
408
|
...totalTemplate
|
|
400
409
|
};
|
|
401
|
-
|
|
410
|
+
for (const row of newSqlRows) {
|
|
402
411
|
let rowTotal = {
|
|
403
412
|
...totalTemplate
|
|
404
413
|
};
|
|
414
|
+
// eslint-disable-next-line no-loop-func
|
|
405
415
|
sqlSummaryColumnKeys.forEach(key => {
|
|
406
416
|
let columnKey = summarySQLColumnName2ColumnKey[key];
|
|
407
417
|
let summaryColumn = summaryTableColumnKey2Column[columnKey];
|
|
@@ -418,11 +428,11 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
418
428
|
}
|
|
419
429
|
});
|
|
420
430
|
pivot_rows.push({
|
|
421
|
-
name: _SQLStatisticsUtils.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, chart.config),
|
|
431
|
+
name: await _SQLStatisticsUtils.getGroupLabelFromDB(row[sqlGroupbyColumnKey], groupbyColumn, chart.config, true),
|
|
422
432
|
rows: [row],
|
|
423
433
|
total: rowTotal
|
|
424
434
|
});
|
|
425
|
-
}
|
|
435
|
+
}
|
|
426
436
|
if (pivot_columns.length < 2) {
|
|
427
437
|
const pivot_column = pivot_columns[0];
|
|
428
438
|
const {
|
|
@@ -439,7 +449,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
439
449
|
total: allTotal[key]
|
|
440
450
|
};
|
|
441
451
|
}
|
|
442
|
-
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name');
|
|
452
|
+
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name', true);
|
|
443
453
|
return {
|
|
444
454
|
pivot_columns,
|
|
445
455
|
pivot_rows,
|
|
@@ -447,7 +457,7 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
447
457
|
dimensions: TABLE_DIMENSIONS.ONE
|
|
448
458
|
};
|
|
449
459
|
};
|
|
450
|
-
SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
460
|
+
SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
451
461
|
const {
|
|
452
462
|
groupbyColumn,
|
|
453
463
|
columnGroupbyColumn,
|
|
@@ -469,9 +479,34 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
469
479
|
isSingleNumericColumn
|
|
470
480
|
} = chartSQLMap;
|
|
471
481
|
if (!sqlColumnGroupbyColumnKey) return _SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
472
|
-
// const summaryMethod = (summary_method || 'sum').toUpperCase();
|
|
473
|
-
|
|
474
482
|
let newSqlRows = sqlRows;
|
|
483
|
+
|
|
484
|
+
// handle LINK_FORMULA
|
|
485
|
+
const isGroupByColumnLinkFormula = groupbyColumn.type === CellType.LINK_FORMULA;
|
|
486
|
+
const isColumnGroupByColumnLinkFormula = columnGroupbyColumn.type === CellType.LINK_FORMULA;
|
|
487
|
+
let isRowGroupbyColumnDataAsAnArray, isGroupbyColumnDataAsAnArray;
|
|
488
|
+
|
|
489
|
+
// Group by column
|
|
490
|
+
if (isGroupByColumnLinkFormula) {
|
|
491
|
+
isGroupbyColumnDataAsAnArray = true;
|
|
492
|
+
} else {
|
|
493
|
+
isGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[groupbyColumn.type];
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// column group by column
|
|
497
|
+
if (isColumnGroupByColumnLinkFormula) {
|
|
498
|
+
isRowGroupbyColumnDataAsAnArray = true;
|
|
499
|
+
} else {
|
|
500
|
+
isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
501
|
+
}
|
|
502
|
+
if (isGroupByColumnLinkFormula) {
|
|
503
|
+
const {
|
|
504
|
+
array_type
|
|
505
|
+
} = groupbyColumn.data;
|
|
506
|
+
if ([CellType.COLLABORATOR, CellType.MULTIPLE_SELECT].includes(array_type)) {
|
|
507
|
+
newSqlRows = BaseUtils.formatedTableSqlRowsByCollaboratorAndMultiple(chart, sqlRows, chartSQLMap, columnMap);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
475
510
|
if ([CellType.COLLABORATOR, CellType.MULTIPLE_SELECT].includes(groupbyColumn.type)) {
|
|
476
511
|
newSqlRows = BaseUtils.formatedTableSqlRowsByCollaboratorAndMultiple(chart, sqlRows, chartSQLMap, columnMap);
|
|
477
512
|
}
|
|
@@ -480,21 +515,16 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
480
515
|
let pivot_columns_total = {};
|
|
481
516
|
// let pivot_table_total = BaseUtils.initTotal(summaryMethod);
|
|
482
517
|
let pivot_table_total = 0;
|
|
483
|
-
const isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
if (BaseUtils.isCollaborator(groupbyColumn)) {
|
|
488
|
-
groupbyColumnCellValueKey = groupbyColumnCellValue || [];
|
|
489
|
-
} else {
|
|
490
|
-
groupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, chart.config);
|
|
491
|
-
}
|
|
518
|
+
// const isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
519
|
+
|
|
520
|
+
// update pivot_columns
|
|
521
|
+
for (const row of newSqlRows) {
|
|
492
522
|
const columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
493
523
|
let columnGroupbyColumnCellValueKey;
|
|
494
524
|
if (BaseUtils.isCollaborator(columnGroupbyColumn)) {
|
|
495
525
|
columnGroupbyColumnCellValueKey = columnGroupbyColumnCellValue || [];
|
|
496
526
|
} else {
|
|
497
|
-
columnGroupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, chart.config);
|
|
527
|
+
columnGroupbyColumnCellValueKey = await _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, chart.config, true);
|
|
498
528
|
}
|
|
499
529
|
if (BaseUtils.isValidCellValue(columnGroupbyColumnCellValue, groupby_include_empty_cells)) {
|
|
500
530
|
_SQLStatisticsUtils.updateTwoDimensionColumns(pivot_columns, columnGroupbyColumnCellValueKey, {
|
|
@@ -502,24 +532,37 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
502
532
|
isCellValueAsAnArray: isRowGroupbyColumnDataAsAnArray
|
|
503
533
|
}, columnGroupbyColumn);
|
|
504
534
|
}
|
|
535
|
+
}
|
|
536
|
+
for (const row of newSqlRows) {
|
|
537
|
+
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
538
|
+
let groupbyColumnCellValueKey;
|
|
539
|
+
if (BaseUtils.isCollaborator(groupbyColumn)) {
|
|
540
|
+
groupbyColumnCellValueKey = groupbyColumnCellValue || [];
|
|
541
|
+
} else {
|
|
542
|
+
groupbyColumnCellValueKey = await _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, chart.config, true);
|
|
543
|
+
}
|
|
544
|
+
const columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
545
|
+
let columnGroupbyColumnCellValueKey;
|
|
546
|
+
if (BaseUtils.isCollaborator(columnGroupbyColumn)) {
|
|
547
|
+
columnGroupbyColumnCellValueKey = columnGroupbyColumnCellValue || [];
|
|
548
|
+
} else {
|
|
549
|
+
columnGroupbyColumnCellValueKey = await _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, chart.config, true);
|
|
550
|
+
}
|
|
505
551
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValue, groupby_include_empty_cells)) {
|
|
506
|
-
if (
|
|
552
|
+
if (isGroupbyColumnDataAsAnArray) {
|
|
507
553
|
if ((!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) && groupby_include_empty_cells) {
|
|
508
554
|
let pivotRowIndex = pivot_rows.findIndex(r => !r.name);
|
|
509
555
|
_SQLStatisticsUtils.updateTwoDimensionRows(chart, pivot_rows, pivot_columns, pivotRowIndex,
|
|
510
556
|
// groupby’s value is null
|
|
511
|
-
null,
|
|
512
|
-
// count,
|
|
513
|
-
row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
557
|
+
null, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
514
558
|
singleNumeriColumnWithMethod,
|
|
515
559
|
multipleNumericColumnsWithMethod
|
|
516
560
|
}, chartSQLMap, columnMap);
|
|
517
561
|
} else {
|
|
562
|
+
// eslint-disable-next-line no-loop-func
|
|
518
563
|
groupbyColumnCellValueKey.forEach(n => {
|
|
519
564
|
let pivotRowIndex = pivot_rows.findIndex(r => n === r.name);
|
|
520
|
-
_SQLStatisticsUtils.updateTwoDimensionRows(chart, pivot_rows, pivot_columns, pivotRowIndex, n,
|
|
521
|
-
// count,
|
|
522
|
-
row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
565
|
+
_SQLStatisticsUtils.updateTwoDimensionRows(chart, pivot_rows, pivot_columns, pivotRowIndex, n, row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
523
566
|
singleNumeriColumnWithMethod,
|
|
524
567
|
multipleNumericColumnsWithMethod
|
|
525
568
|
}, chartSQLMap, columnMap);
|
|
@@ -538,7 +581,7 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
538
581
|
}, chartSQLMap, columnMap);
|
|
539
582
|
}
|
|
540
583
|
}
|
|
541
|
-
}
|
|
584
|
+
}
|
|
542
585
|
|
|
543
586
|
// update Collaborator and Multiple mean value
|
|
544
587
|
if (BaseUtils.isCollaboratorColumnOrMultipleColumn(columnMap)) {
|
|
@@ -548,8 +591,8 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
548
591
|
[pivot_columns_total, pivot_table_total] = _SQLStatisticsUtils.getAndUpdateTwoDimensionTotal(pivot_columns_total, pivot_columns, pivot_rows,
|
|
549
592
|
// { summaryMethod, summaryColumn }
|
|
550
593
|
pivot_table_total, chart);
|
|
551
|
-
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name');
|
|
552
|
-
BaseUtils.sortCharts(pivot_columns, columnGroupbyColumn, 'key');
|
|
594
|
+
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name', true);
|
|
595
|
+
BaseUtils.sortCharts(pivot_columns, columnGroupbyColumn, 'key', true);
|
|
553
596
|
if ((groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === CellType.COLLABORATOR) {
|
|
554
597
|
pivot_rows = BaseUtils.mergePivotTableSameCollaborator(pivot_rows);
|
|
555
598
|
}
|
|
@@ -564,7 +607,7 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
564
607
|
isSingleNumericColumn
|
|
565
608
|
};
|
|
566
609
|
};
|
|
567
|
-
SQLStatisticsUtils.basicChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap) => {
|
|
610
|
+
SQLStatisticsUtils.basicChartSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap) => {
|
|
568
611
|
const {
|
|
569
612
|
config
|
|
570
613
|
} = chart;
|
|
@@ -578,13 +621,13 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap
|
|
|
578
621
|
const {
|
|
579
622
|
groupbyColumn
|
|
580
623
|
} = columnMap;
|
|
581
|
-
const isGroupbyColumnDataAsAnArray =
|
|
624
|
+
const isGroupbyColumnDataAsAnArray = findIfColumnDataIsArray(groupbyColumn);
|
|
582
625
|
const {
|
|
583
626
|
sqlGroupbyColumnKey,
|
|
584
627
|
sqlSummaryColumnKey
|
|
585
628
|
} = chartSQLMap;
|
|
586
629
|
let result = [];
|
|
587
|
-
|
|
630
|
+
for (const row of sqlRows) {
|
|
588
631
|
const cellValue = row[sqlGroupbyColumnKey];
|
|
589
632
|
const summaryValue = row[sqlSummaryColumnKey];
|
|
590
633
|
let formatted_value = cellValue;
|
|
@@ -592,7 +635,7 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap
|
|
|
592
635
|
formatted_value = getFormattedValue(cellValue, y_axis_summary_column_key, y_axis_summary_method);
|
|
593
636
|
}
|
|
594
637
|
if (BaseUtils.isValidCellValue(cellValue)) {
|
|
595
|
-
const key = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
638
|
+
const key = await _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
596
639
|
if (isGroupbyColumnDataAsAnArray) {
|
|
597
640
|
if (!Array.isArray(key) || key.length === 0) {
|
|
598
641
|
let itemIdx = result.findIndex(v => v.name === null);
|
|
@@ -647,7 +690,7 @@ SQLStatisticsUtils.basicChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap
|
|
|
647
690
|
}
|
|
648
691
|
}
|
|
649
692
|
}
|
|
650
|
-
}
|
|
693
|
+
}
|
|
651
694
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
652
695
|
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color');
|
|
653
696
|
if (SUPPORT_DATA_SORT_CHART_TYPES.includes(type) && sort_type) {
|
|
@@ -664,7 +707,7 @@ SQLStatisticsUtils.basicNumberCardSQLResult2JavaScript = (chart, sqlRows, chartS
|
|
|
664
707
|
}
|
|
665
708
|
return 0;
|
|
666
709
|
};
|
|
667
|
-
SQLStatisticsUtils.customChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables, _ref3) => {
|
|
710
|
+
SQLStatisticsUtils.customChartSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables, _ref3) => {
|
|
668
711
|
let {
|
|
669
712
|
index
|
|
670
713
|
} = _ref3;
|
|
@@ -704,9 +747,9 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMa
|
|
|
704
747
|
geolocationGranularity: x_axis_geolocation_granularity
|
|
705
748
|
});
|
|
706
749
|
let result = [];
|
|
707
|
-
|
|
750
|
+
for (const row of sqlRows) {
|
|
708
751
|
const cellValue = row[sqlGroupbyColumnKey];
|
|
709
|
-
const label = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
752
|
+
const label = await _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
710
753
|
const isEmpty = !label;
|
|
711
754
|
const groupItems = [];
|
|
712
755
|
summaryMethods.forEach((summaryMethod, index) => {
|
|
@@ -725,8 +768,8 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMa
|
|
|
725
768
|
});
|
|
726
769
|
});
|
|
727
770
|
result = result.concat(groupItems);
|
|
728
|
-
}
|
|
729
|
-
const isCellValueAsAnArray =
|
|
771
|
+
}
|
|
772
|
+
const isCellValueAsAnArray = findIfColumnDataIsArray(groupbyColumn);
|
|
730
773
|
if (isCellValueAsAnArray) {
|
|
731
774
|
const takenApart = [];
|
|
732
775
|
const assembled = [];
|
|
@@ -765,7 +808,7 @@ SQLStatisticsUtils.customChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMa
|
|
|
765
808
|
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '');
|
|
766
809
|
return result;
|
|
767
810
|
};
|
|
768
|
-
SQLStatisticsUtils.compareSQLResult2Javascript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
811
|
+
SQLStatisticsUtils.compareSQLResult2Javascript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
769
812
|
const {
|
|
770
813
|
groupbyColumn,
|
|
771
814
|
summaryColumn
|
|
@@ -791,9 +834,9 @@ SQLStatisticsUtils.compareSQLResult2Javascript = (chart, sqlRows, chartSQLMap, c
|
|
|
791
834
|
const dateRangeResult = new Map();
|
|
792
835
|
let dateComparedResult = new Map();
|
|
793
836
|
const isAdvanced = y_axis_summary_type === CHART_SUMMARY_TYPE.ADVANCED;
|
|
794
|
-
|
|
837
|
+
for (const item of sqlRows) {
|
|
795
838
|
const name = item[sqlGroupbyColumnKey];
|
|
796
|
-
const label = _SQLStatisticsUtils.getGroupLabelFromDB(name, groupbyColumn, chart.config);
|
|
839
|
+
const label = await _SQLStatisticsUtils.getGroupLabelFromDB(name, groupbyColumn, chart.config);
|
|
797
840
|
const value = item[sqlSummaryColumnKey];
|
|
798
841
|
if (name >= x_axis_date_range_start && name <= x_axis_date_range_end) {
|
|
799
842
|
const currentValue = dateRangeResult.get(label);
|
|
@@ -826,7 +869,7 @@ SQLStatisticsUtils.compareSQLResult2Javascript = (chart, sqlRows, chartSQLMap, c
|
|
|
826
869
|
}
|
|
827
870
|
}
|
|
828
871
|
}
|
|
829
|
-
}
|
|
872
|
+
}
|
|
830
873
|
let comparedResult = [];
|
|
831
874
|
let rangeResult = [];
|
|
832
875
|
const data = (summaryColumn === null || summaryColumn === void 0 ? void 0 : summaryColumn.data) || {};
|
|
@@ -880,7 +923,7 @@ SQLStatisticsUtils.compareSQLResult2Javascript = (chart, sqlRows, chartSQLMap, c
|
|
|
880
923
|
}
|
|
881
924
|
return [...comparedResult, ...rangeResult];
|
|
882
925
|
};
|
|
883
|
-
SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
926
|
+
SQLStatisticsUtils.combinationSQLResult2Javascript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
884
927
|
const {
|
|
885
928
|
config
|
|
886
929
|
} = chart;
|
|
@@ -900,11 +943,10 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
900
943
|
} = columnMap;
|
|
901
944
|
const {
|
|
902
945
|
sqlGroupbyColumnKey,
|
|
903
|
-
sqlSummaryColumnKey,
|
|
904
946
|
sqlRightSummaryColumnKey,
|
|
905
947
|
sqlLeftSummaryColumnKey
|
|
906
948
|
} = chartSQLMap;
|
|
907
|
-
const isGroupbyColumnDataAsAnArray =
|
|
949
|
+
const isGroupbyColumnDataAsAnArray = findIfColumnDataIsArray(groupbyColumn);
|
|
908
950
|
let result = [];
|
|
909
951
|
if (!y_axis_left_group_by_multiple_numeric_column) {
|
|
910
952
|
let leftSummaryColumn, rightSummaryColumn;
|
|
@@ -914,10 +956,9 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
914
956
|
if (y_axis_right_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
915
957
|
rightSummaryColumn = getTableColumnByKey(table, y_axis_right_summary_column);
|
|
916
958
|
}
|
|
917
|
-
sqlRows.
|
|
959
|
+
for (const [index, row] of sqlRows.entries()) {
|
|
918
960
|
const cellValue = row[sqlGroupbyColumnKey];
|
|
919
|
-
const
|
|
920
|
-
const key = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
961
|
+
const key = await _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
921
962
|
let valueLeft = row[sqlLeftSummaryColumnKey] || 0;
|
|
922
963
|
let valueRight = row[sqlRightSummaryColumnKey] || 0;
|
|
923
964
|
if (y_axis_left_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
@@ -980,7 +1021,7 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
980
1021
|
itemRow.value_right = itemRow.value_right + valueRight;
|
|
981
1022
|
}
|
|
982
1023
|
}
|
|
983
|
-
}
|
|
1024
|
+
}
|
|
984
1025
|
} else {
|
|
985
1026
|
let rightSummaryColumn;
|
|
986
1027
|
if (y_axis_right_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
@@ -1017,9 +1058,9 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
1017
1058
|
}
|
|
1018
1059
|
}
|
|
1019
1060
|
});
|
|
1020
|
-
|
|
1061
|
+
for (const item of sqlRows) {
|
|
1021
1062
|
const cellValue = item[sqlGroupbyColumnKey];
|
|
1022
|
-
const key = _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
1063
|
+
const key = await _SQLStatisticsUtils.getGroupLabelFromDB(cellValue, groupbyColumn, chart.config);
|
|
1023
1064
|
let valueRight = item[sqlRightSummaryColumnKey] || 0;
|
|
1024
1065
|
if (y_axis_right_summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
1025
1066
|
valueRight = BaseUtils.getPrecisionNumber(valueRight, rightSummaryColumn.data);
|
|
@@ -1072,7 +1113,7 @@ SQLStatisticsUtils.combinationSQLResult2Javascript = (chart, sqlRows, chartSQLMa
|
|
|
1072
1113
|
});
|
|
1073
1114
|
});
|
|
1074
1115
|
}
|
|
1075
|
-
}
|
|
1116
|
+
}
|
|
1076
1117
|
}
|
|
1077
1118
|
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', '');
|
|
1078
1119
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
@@ -1141,7 +1182,7 @@ SQLStatisticsUtils.updateGroupingChartRows = (results, name, row, count, isColum
|
|
|
1141
1182
|
}
|
|
1142
1183
|
_SQLStatisticsUtils.updateGroupingChartRow(results, name, groupName, row, count);
|
|
1143
1184
|
};
|
|
1144
|
-
SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1185
|
+
SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1145
1186
|
const {
|
|
1146
1187
|
groupbyColumn,
|
|
1147
1188
|
columnGroupbyColumn
|
|
@@ -1155,14 +1196,14 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = (chart, sqlRo
|
|
|
1155
1196
|
sqlSummaryColumnKey
|
|
1156
1197
|
} = chartSQLMap;
|
|
1157
1198
|
let result = [];
|
|
1158
|
-
const isGroupbyColumnDataAsAnArray =
|
|
1159
|
-
const isColumnGroupbyColumnDataAsAnArray =
|
|
1160
|
-
|
|
1199
|
+
const isGroupbyColumnDataAsAnArray = findIfColumnDataIsArray(groupbyColumn);
|
|
1200
|
+
const isColumnGroupbyColumnDataAsAnArray = findIfColumnDataIsArray(columnGroupbyColumn.type);
|
|
1201
|
+
for (const row of sqlRows) {
|
|
1161
1202
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
1162
|
-
const groupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, chart.config);
|
|
1203
|
+
const groupbyColumnCellValueKey = await _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, chart.config);
|
|
1163
1204
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValueKey, includeEmpty)) {
|
|
1164
1205
|
const columnGroupbyColumnCellValue = row[sqlColumnGroupbyColumnKey];
|
|
1165
|
-
const columnGroupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, chart.config);
|
|
1206
|
+
const columnGroupbyColumnCellValueKey = await _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, chart.config);
|
|
1166
1207
|
const count = row[sqlSummaryColumnKey];
|
|
1167
1208
|
if (isGroupbyColumnDataAsAnArray) {
|
|
1168
1209
|
if (!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) {
|
|
@@ -1176,13 +1217,13 @@ SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript = (chart, sqlRo
|
|
|
1176
1217
|
_SQLStatisticsUtils.updateGroupingChartRows(result, groupbyColumnCellValueKey, row, count, isColumnGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey);
|
|
1177
1218
|
}
|
|
1178
1219
|
}
|
|
1179
|
-
}
|
|
1220
|
+
}
|
|
1180
1221
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
1181
1222
|
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color');
|
|
1182
1223
|
BaseUtils.updateTableViewList(result, columnGroupbyColumn, 'group_name', 'group_color');
|
|
1183
1224
|
return result;
|
|
1184
1225
|
};
|
|
1185
|
-
SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1226
|
+
SQLStatisticsUtils.groupingChartSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1186
1227
|
const {
|
|
1187
1228
|
column_groupby_column_key,
|
|
1188
1229
|
column_groupby_multiple_numeric_column,
|
|
@@ -1190,15 +1231,15 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1190
1231
|
x_axis_include_empty_cells: includeEmpty
|
|
1191
1232
|
} = chart.config;
|
|
1192
1233
|
if (!column_groupby_column_key && !column_groupby_multiple_numeric_column) {
|
|
1193
|
-
return _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1234
|
+
return await _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1194
1235
|
}
|
|
1195
1236
|
const {
|
|
1196
1237
|
groupbyColumn,
|
|
1197
1238
|
columnGroupbyColumn
|
|
1198
1239
|
} = columnMap;
|
|
1199
1240
|
if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
1200
|
-
if (!columnGroupbyColumn) return _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1201
|
-
return _SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1241
|
+
if (!columnGroupbyColumn) return await _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1242
|
+
return await _SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1202
1243
|
}
|
|
1203
1244
|
const {
|
|
1204
1245
|
sqlGroupbyColumnKey
|
|
@@ -1208,10 +1249,10 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1208
1249
|
summaryColumns
|
|
1209
1250
|
} = chartSQLMap;
|
|
1210
1251
|
let result = [];
|
|
1211
|
-
const isGroupbyColumnDataAsAnArray =
|
|
1212
|
-
|
|
1252
|
+
const isGroupbyColumnDataAsAnArray = findIfColumnDataIsArray(groupbyColumn);
|
|
1253
|
+
for (const row of sqlRows) {
|
|
1213
1254
|
const groupbyColumnCellValue = row[sqlGroupbyColumnKey];
|
|
1214
|
-
const groupbyColumnCellValueKey = _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, chart.config);
|
|
1255
|
+
const groupbyColumnCellValueKey = await _SQLStatisticsUtils.getGroupLabelFromDB(groupbyColumnCellValue, groupbyColumn, chart.config);
|
|
1215
1256
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValueKey, includeEmpty)) {
|
|
1216
1257
|
Object.keys(summaryColumns).forEach(sqlSummaryColumnName => {
|
|
1217
1258
|
const {
|
|
@@ -1232,15 +1273,15 @@ SQLStatisticsUtils.groupingChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1232
1273
|
}
|
|
1233
1274
|
});
|
|
1234
1275
|
}
|
|
1235
|
-
}
|
|
1276
|
+
}
|
|
1236
1277
|
BaseUtils.sortCharts(result, groupbyColumn, 'name');
|
|
1237
1278
|
BaseUtils.updateTableViewList(result, groupbyColumn, 'name', 'color');
|
|
1238
1279
|
return result;
|
|
1239
1280
|
}
|
|
1240
1281
|
if (!columnGroupbyColumn) {
|
|
1241
|
-
return _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1282
|
+
return await _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1242
1283
|
}
|
|
1243
|
-
return _SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1284
|
+
return await _SQLStatisticsUtils.groupingTwoDimensionChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1244
1285
|
};
|
|
1245
1286
|
SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1246
1287
|
const {
|
|
@@ -1251,7 +1292,7 @@ SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLM
|
|
|
1251
1292
|
sqlSummaryColumnKey
|
|
1252
1293
|
} = chartSQLMap;
|
|
1253
1294
|
let result = [];
|
|
1254
|
-
|
|
1295
|
+
for (const item of sqlRows) {
|
|
1255
1296
|
const currentValue = item[sqlGroupbyColumnKey];
|
|
1256
1297
|
if (currentValue || currentValue === 0) {
|
|
1257
1298
|
let value = item[sqlSummaryColumnKey];
|
|
@@ -1264,7 +1305,7 @@ SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLM
|
|
|
1264
1305
|
value
|
|
1265
1306
|
});
|
|
1266
1307
|
}
|
|
1267
|
-
}
|
|
1308
|
+
}
|
|
1268
1309
|
let data = [];
|
|
1269
1310
|
let years = [];
|
|
1270
1311
|
result.forEach(item => {
|
|
@@ -1291,7 +1332,7 @@ SQLStatisticsUtils.heatMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLM
|
|
|
1291
1332
|
years
|
|
1292
1333
|
};
|
|
1293
1334
|
};
|
|
1294
|
-
SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1335
|
+
SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1295
1336
|
const {
|
|
1296
1337
|
config
|
|
1297
1338
|
} = chart;
|
|
@@ -1316,8 +1357,8 @@ SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQ
|
|
|
1316
1357
|
if (groupData.length > 0) {
|
|
1317
1358
|
const groupData0 = groupData[0] || {};
|
|
1318
1359
|
const groupData1 = groupData[1] || {};
|
|
1319
|
-
|
|
1320
|
-
const label = _SQLStatisticsUtils.getGroupLabelFromDB(item[column_key], groupbyColumn, chart.config);
|
|
1360
|
+
for (const item of sqlRows) {
|
|
1361
|
+
const label = await _SQLStatisticsUtils.getGroupLabelFromDB(item[column_key], groupbyColumn, chart.config);
|
|
1321
1362
|
const groupValue = item[group_column_key];
|
|
1322
1363
|
const equal2GroupData0 = groupData0.id === groupValue;
|
|
1323
1364
|
const equal2GroupData1 = groupData1.id === groupValue;
|
|
@@ -1344,7 +1385,7 @@ SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQ
|
|
|
1344
1385
|
color: groupData[1].color
|
|
1345
1386
|
});
|
|
1346
1387
|
}
|
|
1347
|
-
}
|
|
1388
|
+
}
|
|
1348
1389
|
}
|
|
1349
1390
|
return {
|
|
1350
1391
|
data: newResult,
|
|
@@ -1427,7 +1468,7 @@ SQLStatisticsUtils.trendMapChartSQLResult2JavaScript = (chart, sqlRows, chartSQL
|
|
|
1427
1468
|
type
|
|
1428
1469
|
};
|
|
1429
1470
|
};
|
|
1430
|
-
SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables, params) => {
|
|
1471
|
+
SQLStatisticsUtils.sqlResult2JavaScript = async (chart, sqlRows, chartSQLMap, columnMap, tables, params) => {
|
|
1431
1472
|
const {
|
|
1432
1473
|
type
|
|
1433
1474
|
} = chart.config;
|
|
@@ -1441,11 +1482,11 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1441
1482
|
let result;
|
|
1442
1483
|
if (!column_groupby_column_key) {
|
|
1443
1484
|
result = {
|
|
1444
|
-
result: _SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1485
|
+
result: await _SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1445
1486
|
};
|
|
1446
1487
|
} else {
|
|
1447
1488
|
result = {
|
|
1448
|
-
result: _SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1489
|
+
result: await _SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1449
1490
|
};
|
|
1450
1491
|
}
|
|
1451
1492
|
return result;
|
|
@@ -1455,7 +1496,7 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1455
1496
|
case CHART_TYPE.TREE_MAP:
|
|
1456
1497
|
{
|
|
1457
1498
|
return {
|
|
1458
|
-
result: _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1499
|
+
result: await _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1459
1500
|
};
|
|
1460
1501
|
}
|
|
1461
1502
|
case CHART_TYPE.BASIC_NUMBER_CARD:
|
|
@@ -1477,7 +1518,7 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1477
1518
|
case CHART_TYPE.FUNNEL:
|
|
1478
1519
|
{
|
|
1479
1520
|
return {
|
|
1480
|
-
result: _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1521
|
+
result: await _SQLStatisticsUtils.basicChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1481
1522
|
};
|
|
1482
1523
|
}
|
|
1483
1524
|
case CHART_TYPE.COMPLETENESS:
|
|
@@ -1491,13 +1532,13 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1491
1532
|
case CHART_TYPE.COMBINATION:
|
|
1492
1533
|
{
|
|
1493
1534
|
return {
|
|
1494
|
-
result: _SQLStatisticsUtils.combinationSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1535
|
+
result: await _SQLStatisticsUtils.combinationSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1495
1536
|
};
|
|
1496
1537
|
}
|
|
1497
1538
|
case CHART_TYPE.COMPARE_BAR:
|
|
1498
1539
|
{
|
|
1499
1540
|
return {
|
|
1500
|
-
result: _SQLStatisticsUtils.compareSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1541
|
+
result: await _SQLStatisticsUtils.compareSQLResult2Javascript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1501
1542
|
};
|
|
1502
1543
|
}
|
|
1503
1544
|
case CHART_TYPE.BAR_GROUP:
|
|
@@ -1508,7 +1549,7 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1508
1549
|
case CHART_TYPE.STACKED_HORIZONTAL_BAR:
|
|
1509
1550
|
{
|
|
1510
1551
|
return {
|
|
1511
|
-
result: _SQLStatisticsUtils.groupingChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1552
|
+
result: await _SQLStatisticsUtils.groupingChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1512
1553
|
};
|
|
1513
1554
|
}
|
|
1514
1555
|
case CHART_TYPE.SCATTER:
|
|
@@ -1520,7 +1561,7 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1520
1561
|
case CHART_TYPE.BAR_CUSTOM:
|
|
1521
1562
|
{
|
|
1522
1563
|
return {
|
|
1523
|
-
result: _SQLStatisticsUtils.customChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables, params)
|
|
1564
|
+
result: await _SQLStatisticsUtils.customChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables, params)
|
|
1524
1565
|
};
|
|
1525
1566
|
}
|
|
1526
1567
|
case CHART_TYPE.MAP:
|
|
@@ -1546,7 +1587,7 @@ SQLStatisticsUtils.sqlResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMa
|
|
|
1546
1587
|
case CHART_TYPE.MIRROR:
|
|
1547
1588
|
{
|
|
1548
1589
|
return {
|
|
1549
|
-
result: _SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1590
|
+
result: await _SQLStatisticsUtils.mirrorMapChartSQLResult2JavaScript(chart, sqlRows, chartSQLMap, columnMap, tables)
|
|
1550
1591
|
};
|
|
1551
1592
|
}
|
|
1552
1593
|
case CHART_TYPE.TREND:
|
|
@@ -1760,7 +1801,7 @@ SQLStatisticsUtils.worldMapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap,
|
|
|
1760
1801
|
});
|
|
1761
1802
|
return result;
|
|
1762
1803
|
};
|
|
1763
|
-
SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
1804
|
+
SQLStatisticsUtils.calculateChart = async (chart, value, callback, sqlRows) => {
|
|
1764
1805
|
const {
|
|
1765
1806
|
tables
|
|
1766
1807
|
} = value;
|
|
@@ -1810,14 +1851,14 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1810
1851
|
// Custom Bar
|
|
1811
1852
|
if (chartType === CHART_TYPE.BAR_CUSTOM) {
|
|
1812
1853
|
const result = [];
|
|
1813
|
-
sqlRows.
|
|
1854
|
+
for (const [index, item] of sqlRows.entries()) {
|
|
1814
1855
|
if (item.length !== 0) {
|
|
1815
|
-
const chartResult = _SQLStatisticsUtils.sqlResult2JavaScript(newChart, item, chartSQLMap, columnMap, tables, {
|
|
1856
|
+
const chartResult = await _SQLStatisticsUtils.sqlResult2JavaScript(newChart, item, chartSQLMap, columnMap, tables, {
|
|
1816
1857
|
index
|
|
1817
1858
|
});
|
|
1818
1859
|
result.push(...chartResult.result);
|
|
1819
1860
|
}
|
|
1820
|
-
}
|
|
1861
|
+
}
|
|
1821
1862
|
if (result.length === 0) {
|
|
1822
1863
|
callback && callback('', tipMessage, null);
|
|
1823
1864
|
return;
|
|
@@ -1839,7 +1880,7 @@ SQLStatisticsUtils.calculateChart = (chart, value, callback, sqlRows) => {
|
|
|
1839
1880
|
callback && callback('', tipMessage, null);
|
|
1840
1881
|
return;
|
|
1841
1882
|
}
|
|
1842
|
-
const chartResult = _SQLStatisticsUtils.sqlResult2JavaScript(newChart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1883
|
+
const chartResult = await _SQLStatisticsUtils.sqlResult2JavaScript(newChart, sqlRows, chartSQLMap, columnMap, tables);
|
|
1843
1884
|
|
|
1844
1885
|
// map is special
|
|
1845
1886
|
if (BaseUtils.imEmptyChartResult(chartResult) && !chartType.includes('map')) {
|
|
@@ -58,10 +58,10 @@ export function updateKnownUsers(emailUserMap) {
|
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
export function getUsers(emails, cb) {
|
|
61
|
+
export async function getUsers(emails, cb) {
|
|
62
62
|
if (!emails) {
|
|
63
|
-
cb([]);
|
|
64
|
-
return;
|
|
63
|
+
if (cb) cb([]);
|
|
64
|
+
return Promise.resolve([]);
|
|
65
65
|
}
|
|
66
66
|
if (!Array.isArray(emails)) {
|
|
67
67
|
emails = [emails];
|
|
@@ -71,17 +71,18 @@ export function getUsers(emails, cb) {
|
|
|
71
71
|
// if no need to fetch
|
|
72
72
|
if (unFetchedUsers.length === 0) {
|
|
73
73
|
const result = getKnownCollaboratorsByEmails(emails);
|
|
74
|
-
cb(result);
|
|
75
|
-
return;
|
|
74
|
+
if (cb) cb(result);
|
|
75
|
+
return Promise.resolve(result);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
context.queryUsers(unFetchedUsers, emailUserMap => {
|
|
79
|
+
// add them to cache
|
|
80
|
+
updateKnownUsers(emailUserMap);
|
|
81
|
+
// now we can get all users
|
|
82
|
+
const result = getKnownCollaboratorsByEmails(emails);
|
|
83
|
+
if (cb) cb(result);
|
|
84
|
+
resolve(result);
|
|
85
|
+
});
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
88
|
export const generateDefaultUser = name => {
|
|
@@ -122,7 +122,13 @@ class PivotTableDisplayName extends React.Component {
|
|
|
122
122
|
switch (type) {
|
|
123
123
|
case CellType.SINGLE_SELECT:
|
|
124
124
|
{
|
|
125
|
-
|
|
125
|
+
let options;
|
|
126
|
+
// column type is LINK_FORMULA, but we need to use single selector formatter here
|
|
127
|
+
if (column.type === CellType.LINK_FORMULA) {
|
|
128
|
+
options = column.data.array_data.options;
|
|
129
|
+
} else {
|
|
130
|
+
options = getColumnOptions(column);
|
|
131
|
+
}
|
|
126
132
|
let option = getOption(options, value) || {};
|
|
127
133
|
if (Object.keys(option).length === 0) {
|
|
128
134
|
option = options.find(item => item.name === value) || {};
|
|
@@ -141,8 +147,14 @@ class PivotTableDisplayName extends React.Component {
|
|
|
141
147
|
original_key
|
|
142
148
|
} = rowData;
|
|
143
149
|
const newValue = original_name || name || original_key;
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
let options, validValue;
|
|
151
|
+
if (column.type === CellType.LINK_FORMULA) {
|
|
152
|
+
options = column.data.array_data.options;
|
|
153
|
+
validValue = Array.isArray(newValue) && newValue.length !== 0 ? newValue : [newValue];
|
|
154
|
+
} else {
|
|
155
|
+
options = getColumnOptions(column);
|
|
156
|
+
validValue = Array.isArray(newValue) && newValue.length !== 0 ? newValue : [newValue];
|
|
157
|
+
}
|
|
146
158
|
displayName = /*#__PURE__*/React.createElement("div", {
|
|
147
159
|
className: "pivot-table-display-name-row"
|
|
148
160
|
}, validValue.map(item => {
|