sea-chart 0.0.86 → 0.0.87
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/utils/chart-utils/base-utils.js +6 -1
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +27 -10
- package/dist/utils/chart-utils/sql-statistics-utils.js +21 -11
- package/dist/utils/row-utils.js +7 -1
- package/dist/view/wrapper/table/index.css +1 -0
- package/dist/view/wrapper/table/pivot-table-display-name.js +3 -2
- package/dist/view/wrapper/trend.js +12 -8
- package/package.json +1 -1
|
@@ -233,6 +233,10 @@ BaseUtils.getChartGroups = charts => {
|
|
|
233
233
|
};
|
|
234
234
|
BaseUtils.isSameGroup = (isColumnDataAsAnArray, source, target) => {
|
|
235
235
|
if (isColumnDataAsAnArray) {
|
|
236
|
+
// column type is multiple-select
|
|
237
|
+
if (Array.isArray(source) && Array.isArray(target)) {
|
|
238
|
+
return JSON.stringify(source) === JSON.stringify(target);
|
|
239
|
+
}
|
|
236
240
|
return (!Array.isArray(source) || source.length === 0) && !target || source.includes(target);
|
|
237
241
|
}
|
|
238
242
|
return source === null && target === null || source === undefined && target === undefined || source === target;
|
|
@@ -1020,7 +1024,8 @@ BaseUtils.getGroupLabel = (cellValue, formulaRow, column, dateGranularity, geoGr
|
|
|
1020
1024
|
if (!Array.isArray(cellValue)) {
|
|
1021
1025
|
return [];
|
|
1022
1026
|
}
|
|
1023
|
-
|
|
1027
|
+
const newCellValue = cellValue.filter(id => options.findIndex(o => o.id === id) > -1);
|
|
1028
|
+
return newCellValue.sort();
|
|
1024
1029
|
}
|
|
1025
1030
|
case CellType.COLLABORATOR:
|
|
1026
1031
|
{
|
|
@@ -262,10 +262,16 @@ async function calculateTwoDimensionTable(chart, value, _ref2) {
|
|
|
262
262
|
let pivotRowIndex = pivot_rows.findIndex(r => !r.name);
|
|
263
263
|
updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, null, row, isRowGroupbyColumnDataAsAnArray, cellValueForColumn, chart, groupbyColumn, table);
|
|
264
264
|
} else {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
// groupbyColumn type is multiple-select use equal
|
|
266
|
+
if ((groupbyColumn === null || groupbyColumn === void 0 ? void 0 : groupbyColumn.type) === 'multiple-select') {
|
|
267
|
+
pivotRowIndex = pivot_rows.findIndex(r => JSON.stringify(name) === JSON.stringify(r.name));
|
|
268
|
+
updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, name, row, isRowGroupbyColumnDataAsAnArray, cellValueForColumn, chart, groupbyColumn, table);
|
|
269
|
+
} else {
|
|
270
|
+
name.forEach(n => {
|
|
271
|
+
pivotRowIndex = pivot_rows.findIndex(r => n === r.name);
|
|
272
|
+
updateTwoDimensionRows(pivot_rows, pivot_columns, pivotRowIndex, n, row, isRowGroupbyColumnDataAsAnArray, cellValueForColumn, chart, groupbyColumn, table);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
269
275
|
}
|
|
270
276
|
} else {
|
|
271
277
|
pivotRowIndex = pivot_rows.findIndex(pivotRow => {
|
|
@@ -325,15 +331,26 @@ function updateTwoDimensionColumns(value, pivot_columns, column, row, formulaRow
|
|
|
325
331
|
});
|
|
326
332
|
}
|
|
327
333
|
} else {
|
|
328
|
-
|
|
329
|
-
|
|
334
|
+
// column is multiple-select use equal
|
|
335
|
+
if ((column === null || column === void 0 ? void 0 : column.type) === 'multiple-select') {
|
|
336
|
+
const pivotColumnIndex = pivot_columns.findIndex(r => JSON.stringify(r.key) === JSON.stringify(key));
|
|
330
337
|
if (pivotColumnIndex < 0) {
|
|
331
338
|
pivot_columns.push({
|
|
332
|
-
key:
|
|
333
|
-
original_key:
|
|
339
|
+
key: key,
|
|
340
|
+
original_key: key
|
|
334
341
|
});
|
|
335
342
|
}
|
|
336
|
-
}
|
|
343
|
+
} else {
|
|
344
|
+
key.forEach(k => {
|
|
345
|
+
pivotColumnIndex = pivot_columns.findIndex(r => r.key === k);
|
|
346
|
+
if (pivotColumnIndex < 0) {
|
|
347
|
+
pivot_columns.push({
|
|
348
|
+
key: k,
|
|
349
|
+
original_key: k
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
337
354
|
}
|
|
338
355
|
} else {
|
|
339
356
|
pivotColumnIndex = pivot_columns.findIndex(r => {
|
|
@@ -610,7 +627,7 @@ function getTotal(summary_column, summary_type, summary_method) {
|
|
|
610
627
|
if (summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
611
628
|
total = rowsLength;
|
|
612
629
|
} else if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
613
|
-
if (summary_method === CHART_SUMMARY_TYPE.Distinct_values) {
|
|
630
|
+
if (summary_method === CHART_SUMMARY_TYPE.Distinct_values || summary_method === 'Distinct_values') {
|
|
614
631
|
total = 0;
|
|
615
632
|
let existMap = {};
|
|
616
633
|
rows.forEach(row => {
|
|
@@ -235,7 +235,7 @@ SQLStatisticsUtils.getGroupData = (result, groupColumn) => {
|
|
|
235
235
|
}
|
|
236
236
|
return groupList;
|
|
237
237
|
};
|
|
238
|
-
SQLStatisticsUtils.updateTwoDimensionColumns = (pivot_columns, key, _ref) => {
|
|
238
|
+
SQLStatisticsUtils.updateTwoDimensionColumns = (pivot_columns, key, _ref, columnGroupbyColumn) => {
|
|
239
239
|
let {
|
|
240
240
|
isIncludeEmpty,
|
|
241
241
|
isCellValueAsAnArray
|
|
@@ -251,6 +251,18 @@ SQLStatisticsUtils.updateTwoDimensionColumns = (pivot_columns, key, _ref) => {
|
|
|
251
251
|
}
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
|
+
|
|
255
|
+
// columnGroupbyColumn is multiple-select use equal
|
|
256
|
+
if ((columnGroupbyColumn === null || columnGroupbyColumn === void 0 ? void 0 : columnGroupbyColumn.type) === 'multiple-select') {
|
|
257
|
+
const pivotColumnIndex = pivot_columns.findIndex(r => JSON.stringify(r.key) === JSON.stringify(key));
|
|
258
|
+
if (pivotColumnIndex < 0) {
|
|
259
|
+
pivot_columns.push({
|
|
260
|
+
key: key,
|
|
261
|
+
original_key: key
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
254
266
|
key.forEach(k => {
|
|
255
267
|
const pivotColumnIndex = pivot_columns.findIndex(r => r.key === k);
|
|
256
268
|
if (pivotColumnIndex < 0) {
|
|
@@ -609,7 +621,7 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
609
621
|
_SQLStatisticsUtils.updateTwoDimensionColumns(pivot_columns, columnGroupbyColumnCellValueKey, {
|
|
610
622
|
isIncludeEmpty: groupby_include_empty_cells,
|
|
611
623
|
isCellValueAsAnArray: isRowGroupbyColumnDataAsAnArray
|
|
612
|
-
});
|
|
624
|
+
}, columnGroupbyColumn);
|
|
613
625
|
}
|
|
614
626
|
if (BaseUtils.isValidCellValue(groupbyColumnCellValue, groupby_include_empty_cells)) {
|
|
615
627
|
if (MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[groupbyColumn.type]) {
|
|
@@ -624,15 +636,13 @@ SQLStatisticsUtils.twoDimensionTableSQLResult2JavaScript = (chart, sqlRows, char
|
|
|
624
636
|
multipleNumericColumnsWithMethod
|
|
625
637
|
}, chartSQLMap);
|
|
626
638
|
} else {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}, chartSQLMap);
|
|
635
|
-
});
|
|
639
|
+
let pivotRowIndex = pivot_rows.findIndex(r => JSON.stringify(groupbyColumnCellValueKey) === JSON.stringify(r.name));
|
|
640
|
+
_SQLStatisticsUtils.updateTwoDimensionRows(chart, pivot_rows, pivot_columns, pivotRowIndex, groupbyColumnCellValueKey,
|
|
641
|
+
// count,
|
|
642
|
+
row, isRowGroupbyColumnDataAsAnArray, columnGroupbyColumnCellValueKey, {
|
|
643
|
+
singleNumeriColumnWithMethod,
|
|
644
|
+
multipleNumericColumnsWithMethod
|
|
645
|
+
}, chartSQLMap);
|
|
636
646
|
}
|
|
637
647
|
} else {
|
|
638
648
|
let pivotRowIndex = pivot_rows.findIndex(r => {
|
package/dist/utils/row-utils.js
CHANGED
|
@@ -33,7 +33,7 @@ export const getFormattedLabel = (column, name, collaborators) => {
|
|
|
33
33
|
type: columnType,
|
|
34
34
|
data: columnData
|
|
35
35
|
} = column || {};
|
|
36
|
-
if (columnType === CellType.SINGLE_SELECT
|
|
36
|
+
if (columnType === CellType.SINGLE_SELECT) {
|
|
37
37
|
let options = columnData ? columnData.options : [];
|
|
38
38
|
let selectedOption = options.find(o => {
|
|
39
39
|
let id = name;
|
|
@@ -48,6 +48,12 @@ export const getFormattedLabel = (column, name, collaborators) => {
|
|
|
48
48
|
if (selectedOption) {
|
|
49
49
|
return optionName;
|
|
50
50
|
}
|
|
51
|
+
} else if (columnType === CellType.MULTIPLE_SELECT) {
|
|
52
|
+
// Return the array directly and process it in the rendering, file directly: src/view/wrapper/table/pivot-table-display-name.js
|
|
53
|
+
if (Array.isArray(name)) {
|
|
54
|
+
return name;
|
|
55
|
+
}
|
|
56
|
+
return [];
|
|
51
57
|
} else if (columnType === CellType.COLLABORATOR) {
|
|
52
58
|
let collaborator = collaborators.find(item => {
|
|
53
59
|
let email = name;
|
|
@@ -122,9 +122,10 @@ class PivotTableDisplayName extends React.Component {
|
|
|
122
122
|
} = this.props;
|
|
123
123
|
const {
|
|
124
124
|
original_name,
|
|
125
|
-
name
|
|
125
|
+
name,
|
|
126
|
+
original_key
|
|
126
127
|
} = rowData;
|
|
127
|
-
const newValue = original_name || name;
|
|
128
|
+
const newValue = original_name || name || original_key;
|
|
128
129
|
const options = getColumnOptions(column);
|
|
129
130
|
const validValue = Array.isArray(newValue) && newValue.length !== 0 ? newValue : [newValue];
|
|
130
131
|
displayName = /*#__PURE__*/React.createElement("div", {
|
|
@@ -76,10 +76,10 @@ class Trend extends Component {
|
|
|
76
76
|
previous
|
|
77
77
|
} = data || {};
|
|
78
78
|
let color = '#fa5757',
|
|
79
|
-
icon = '
|
|
79
|
+
icon = 'dtable-icon-down1';
|
|
80
80
|
if (type === 'up') {
|
|
81
81
|
color = '#34aa95';
|
|
82
|
-
icon = '
|
|
82
|
+
icon = 'dtable-icon-up1';
|
|
83
83
|
}
|
|
84
84
|
if (labelFontSize <= 12) {
|
|
85
85
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -98,9 +98,11 @@ class Trend extends Component {
|
|
|
98
98
|
backgroundColor: "".concat(color, "26"),
|
|
99
99
|
textAlign: 'center',
|
|
100
100
|
marginRight: '8px',
|
|
101
|
-
fontWeight: 'bold'
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
fontWeight: 'bold',
|
|
102
|
+
fontSize: '10px'
|
|
103
|
+
},
|
|
104
|
+
className: "dtable-font ".concat(icon)
|
|
105
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
104
106
|
style: {
|
|
105
107
|
color: "".concat(color)
|
|
106
108
|
}
|
|
@@ -132,9 +134,11 @@ class Trend extends Component {
|
|
|
132
134
|
backgroundColor: "".concat(color, "26"),
|
|
133
135
|
textAlign: 'center',
|
|
134
136
|
marginRight: '8px',
|
|
135
|
-
fontWeight: 'bold'
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
fontWeight: 'bold',
|
|
138
|
+
fontSize: '11px'
|
|
139
|
+
},
|
|
140
|
+
className: "dtable-font ".concat(icon)
|
|
141
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
138
142
|
style: {
|
|
139
143
|
color: color,
|
|
140
144
|
marginRight: '0px'
|