sea-chart 1.1.9 → 1.1.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.
|
@@ -1437,7 +1437,7 @@ BaseUtils.formatedTableSqlRowsByCollaboratorAndMultiple = (chart, sqlRows, chart
|
|
|
1437
1437
|
summarySQLColumnName2ColumnKey,
|
|
1438
1438
|
sqlColumnGroupbyColumnKey
|
|
1439
1439
|
} = chartSQLMap;
|
|
1440
|
-
|
|
1440
|
+
let newSqlRows = JSON.parse(JSON.stringify(sqlRows));
|
|
1441
1441
|
if (config.summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
1442
1442
|
// has column group
|
|
1443
1443
|
if (sqlColumnGroupbyColumnKey) {
|
|
@@ -1448,40 +1448,26 @@ BaseUtils.formatedTableSqlRowsByCollaboratorAndMultiple = (chart, sqlRows, chart
|
|
|
1448
1448
|
return newSqlRows;
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
|
-
|
|
1451
|
+
let collaboratorsRowsMap = {};
|
|
1452
1452
|
// no has column group
|
|
1453
1453
|
if (!sqlColumnGroupbyColumnKey) {
|
|
1454
|
-
sqlRows.forEach(
|
|
1454
|
+
sqlRows.forEach(sqlRow => {
|
|
1455
1455
|
const collaborators = sqlRow[sqlGroupbyColumnKey];
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
const
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
} else {
|
|
1470
|
-
const obj = {};
|
|
1471
|
-
if (sqlGroupbyColumnKey) {
|
|
1472
|
-
obj[sqlGroupbyColumnKey] = [item];
|
|
1473
|
-
}
|
|
1474
|
-
if (sqlSummaryColumnKey) {
|
|
1475
|
-
obj[sqlSummaryColumnKey] = oldCollaboratorCount;
|
|
1476
|
-
}
|
|
1477
|
-
newSqlRows.push({
|
|
1478
|
-
...sqlRow,
|
|
1479
|
-
...obj
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1456
|
+
collaborators.forEach(c => {
|
|
1457
|
+
if (collaboratorsRowsMap[c]) {
|
|
1458
|
+
const existedRow = collaboratorsRowsMap[c];
|
|
1459
|
+
sqlRow[sqlSummaryColumnKey] && (existedRow[sqlSummaryColumnKey] += sqlRow[sqlSummaryColumnKey]);
|
|
1460
|
+
} else {
|
|
1461
|
+
const row = {
|
|
1462
|
+
...sqlRow
|
|
1463
|
+
};
|
|
1464
|
+
sqlGroupbyColumnKey && row[sqlGroupbyColumnKey] && (row[sqlGroupbyColumnKey] = [c]);
|
|
1465
|
+
sqlSummaryColumnKey && row[sqlSummaryColumnKey] && (row[sqlSummaryColumnKey] = sqlRow[sqlSummaryColumnKey]);
|
|
1466
|
+
collaboratorsRowsMap[c] = row;
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1484
1469
|
});
|
|
1470
|
+
newSqlRows = Object.values(collaboratorsRowsMap);
|
|
1485
1471
|
}
|
|
1486
1472
|
}
|
|
1487
1473
|
if (config.summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
@@ -1534,8 +1520,8 @@ BaseUtils.formatedTableSqlRowsByCollaboratorAndMultiple = (chart, sqlRows, chart
|
|
|
1534
1520
|
newSqlRows.splice(index, 1);
|
|
1535
1521
|
collaborators.forEach(collaborator => {
|
|
1536
1522
|
const rowIndex = newSqlRows.findIndex(rows => {
|
|
1537
|
-
var _rows$
|
|
1538
|
-
return ((_rows$
|
|
1523
|
+
var _rows$sqlGroupbyColum;
|
|
1524
|
+
return ((_rows$sqlGroupbyColum = rows[sqlGroupbyColumnKey]) === null || _rows$sqlGroupbyColum === void 0 ? void 0 : _rows$sqlGroupbyColum[0]) === collaborator;
|
|
1539
1525
|
});
|
|
1540
1526
|
// has same collaborator
|
|
1541
1527
|
if (rowIndex !== -1) {
|
|
@@ -169,9 +169,7 @@ SQLStatisticsUtils.updateTwoDimensionColumns = (pivot_columns, key, _ref, column
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
|
-
SQLStatisticsUtils.updateTwoDimensionRows = (chart, pivot_rows, pivot_columns, index, name,
|
|
173
|
-
// count,
|
|
174
|
-
row, isColumnDataAsAnArray, cellValue, _ref2, chartSQLMap, columnMap) => {
|
|
172
|
+
SQLStatisticsUtils.updateTwoDimensionRows = (chart, pivot_rows, pivot_columns, index, name, row, isColumnDataAsAnArray, cellValue, _ref2, chartSQLMap, columnMap) => {
|
|
175
173
|
let {
|
|
176
174
|
singleNumeriColumnWithMethod,
|
|
177
175
|
multipleNumericColumnsWithMethod
|
|
@@ -353,7 +351,8 @@ SQLStatisticsUtils.oneDimensionTableSQLResult2JavaScript = async (chart, sqlRows
|
|
|
353
351
|
let pivot_rows = [];
|
|
354
352
|
const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
|
|
355
353
|
|
|
356
|
-
// handle
|
|
354
|
+
// if key is an array, handle it here ,currently only handle collaborator and multiple select
|
|
355
|
+
// MULTIPLE_CELL_VALUE_COLUMN_TYPE = [CellType.COLLABORATOR, CellType.MULTIPLE_SELECT, CellType.LINK]
|
|
357
356
|
const isGroupByColumnLinkFormula = groupbyColumn.type === CellType.LINK_FORMULA;
|
|
358
357
|
let newSqlRows = sqlRows;
|
|
359
358
|
if (isGroupByColumnLinkFormula) {
|
|
@@ -499,6 +498,9 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = async (chart, sqlRows
|
|
|
499
498
|
} else {
|
|
500
499
|
isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
501
500
|
}
|
|
501
|
+
|
|
502
|
+
// if key is an array, handle it here ,currently only handle collaborator and multiple select
|
|
503
|
+
// MULTIPLE_CELL_VALUE_COLUMN_TYPE = [CellType.COLLABORATOR, CellType.MULTIPLE_SELECT, CellType.LINK]
|
|
502
504
|
if (isGroupByColumnLinkFormula) {
|
|
503
505
|
const {
|
|
504
506
|
array_type
|
|
@@ -513,9 +515,7 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = async (chart, sqlRows
|
|
|
513
515
|
let pivot_columns = [];
|
|
514
516
|
let pivot_rows = [];
|
|
515
517
|
let pivot_columns_total = {};
|
|
516
|
-
// let pivot_table_total = BaseUtils.initTotal(summaryMethod);
|
|
517
518
|
let pivot_table_total = 0;
|
|
518
|
-
// const isRowGroupbyColumnDataAsAnArray = !!MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[columnGroupbyColumn.type];
|
|
519
519
|
|
|
520
520
|
// update pivot_columns
|
|
521
521
|
for (const row of newSqlRows) {
|
|
@@ -549,6 +549,7 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = async (chart, sqlRows
|
|
|
549
549
|
columnGroupbyColumnCellValueKey = await _SQLStatisticsUtils.getGroupLabelFromDB(columnGroupbyColumnCellValue, columnGroupbyColumn, chart.config, true);
|
|
550
550
|
}
|
|
551
551
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValue, groupby_include_empty_cells)) {
|
|
552
|
+
// data is an array is handled previously, but to keep capability, still use old code
|
|
552
553
|
if (isGroupbyColumnDataAsAnArray) {
|
|
553
554
|
if ((!Array.isArray(groupbyColumnCellValueKey) || groupbyColumnCellValueKey.length === 0) && groupby_include_empty_cells) {
|
|
554
555
|
let pivotRowIndex = pivot_rows.findIndex(r => !r.name);
|
|
@@ -588,9 +589,7 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = async (chart, sqlRows
|
|
|
588
589
|
const new_pivot_rows = BaseUtils.updateCollaboratorAndMultipleAvg(pivot_rows, [singleNumeriColumnWithMethod, ...multipleNumericColumnsWithMethod]);
|
|
589
590
|
pivot_rows = new_pivot_rows;
|
|
590
591
|
}
|
|
591
|
-
[pivot_columns_total, pivot_table_total] = _SQLStatisticsUtils.getAndUpdateTwoDimensionTotal(pivot_columns_total, pivot_columns, pivot_rows,
|
|
592
|
-
// { summaryMethod, summaryColumn }
|
|
593
|
-
pivot_table_total, chart);
|
|
592
|
+
[pivot_columns_total, pivot_table_total] = _SQLStatisticsUtils.getAndUpdateTwoDimensionTotal(pivot_columns_total, pivot_columns, pivot_rows, pivot_table_total, chart);
|
|
594
593
|
BaseUtils.sortCharts(pivot_rows, groupbyColumn, 'name', true);
|
|
595
594
|
BaseUtils.sortCharts(pivot_columns, columnGroupbyColumn, 'key', true);
|
|
596
595
|
if ((groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === CellType.COLLABORATOR) {
|
|
@@ -89,7 +89,7 @@ class Funnel extends ChartComponent {
|
|
|
89
89
|
} else {
|
|
90
90
|
labelStyle = {
|
|
91
91
|
position: 'left',
|
|
92
|
-
|
|
92
|
+
offsetX: -80,
|
|
93
93
|
style: {
|
|
94
94
|
fontSize: funnel_label_font_size,
|
|
95
95
|
fill: theme.labelColor
|
|
@@ -105,8 +105,8 @@ class Funnel extends ChartComponent {
|
|
|
105
105
|
this.chart.axis(false);
|
|
106
106
|
this.chart.coordinate('rect').transpose().scale(1, -1);
|
|
107
107
|
this.chart.interval().adjust('symmetric').position('name*value').shape('funnel').color('name', ['#0050B3', '#1890FF', '#40A9FF', '#69C0FF', '#BAE7FF']).label('name*value*percent', name => {
|
|
108
|
-
if (name.length >
|
|
109
|
-
name = name.substring(0,
|
|
108
|
+
if (name.length > 10) {
|
|
109
|
+
name = name.substring(0, 10) + '...';
|
|
110
110
|
}
|
|
111
111
|
return {
|
|
112
112
|
content: funnel_show_labels ? "".concat(name) : ''
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
|
+
import PropTypes, { array } from 'prop-types';
|
|
2
3
|
import shallowEqual from 'shallowequal';
|
|
3
4
|
import dayjs from 'dayjs';
|
|
4
5
|
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_RESULT_TYPE, getOption, getCollaborator, getNumberDisplayString, isNumber, isValidEmail } from 'dtable-utils';
|
|
@@ -129,6 +130,11 @@ class PivotTableDisplayName extends React.Component {
|
|
|
129
130
|
} else {
|
|
130
131
|
options = getColumnOptions(column);
|
|
131
132
|
}
|
|
133
|
+
|
|
134
|
+
// if this is a link-formula column and linked to a single select column, in this case the value is an array
|
|
135
|
+
if (Array.isArray(value)) {
|
|
136
|
+
value = value[0];
|
|
137
|
+
}
|
|
132
138
|
let option = getOption(options, value) || {};
|
|
133
139
|
if (Object.keys(option).length === 0) {
|
|
134
140
|
option = options.find(item => item.name === value) || {};
|
|
@@ -263,7 +269,13 @@ class PivotTableDisplayName extends React.Component {
|
|
|
263
269
|
}
|
|
264
270
|
case CellType.LINK:
|
|
265
271
|
{
|
|
266
|
-
|
|
272
|
+
let newValue;
|
|
273
|
+
if (!array.isArray(value)) {
|
|
274
|
+
newValue = [value];
|
|
275
|
+
} else {
|
|
276
|
+
newValue = value;
|
|
277
|
+
}
|
|
278
|
+
const displayValue = getClientFormulaDisplayString(newValue, data, {
|
|
267
279
|
collaborators
|
|
268
280
|
}) || null;
|
|
269
281
|
displayName = /*#__PURE__*/React.createElement("div", {
|