sea-chart 0.0.82-alpha.0 → 0.0.82-alpha.2
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.
|
@@ -308,6 +308,14 @@ BaseUtils.getSummaryValue = (_ref, currentValue, nextValue) => {
|
|
|
308
308
|
if (currentValue === null && nextValue === null) return null;
|
|
309
309
|
if (currentValue === null) return nextValue;
|
|
310
310
|
if (nextValue === null) return currentValue;
|
|
311
|
+
if (currentValue && nextValue) {
|
|
312
|
+
if (summaryMethod === 'MAX') {
|
|
313
|
+
return Math.max(currentValue, nextValue);
|
|
314
|
+
}
|
|
315
|
+
if (summaryMethod === 'MIN') {
|
|
316
|
+
return Math.min(currentValue, nextValue);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
311
319
|
}
|
|
312
320
|
return (currentValue - 0 || 0) + (nextValue - 0 || 0);
|
|
313
321
|
};
|
|
@@ -58,7 +58,7 @@ async function calculateOneDimensionTable(chart, value, _ref) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
const summary_columns_option_keys = Array.isArray(summary_columns) ? summary_columns.map(option => option.
|
|
61
|
+
const summary_columns_option_keys = Array.isArray(summary_columns) ? summary_columns.map(option => option.column_key) : [];
|
|
62
62
|
const statisticColumnKeys = [summary_column_key, ...summary_columns_option_keys];
|
|
63
63
|
const validStatisticColumnKeys = statisticColumnKeys;
|
|
64
64
|
let statisticColumns = validStatisticColumnKeys.map(key => {
|
|
@@ -72,7 +72,7 @@ async function calculateOneDimensionTable(chart, value, _ref) {
|
|
|
72
72
|
}
|
|
73
73
|
Array.isArray(summary_columns) && summary_columns.forEach((option, index) => {
|
|
74
74
|
if (statisticColumns[index + 1]) {
|
|
75
|
-
statisticColumns[index + 1].method = option.
|
|
75
|
+
statisticColumns[index + 1].method = option.summary_method;
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
const {
|
|
@@ -243,34 +243,7 @@ async function calculateTwoDimensionTable(chart, value, _ref2) {
|
|
|
243
243
|
const summaryColumn = getTableColumnByKey(table, summary_column_key);
|
|
244
244
|
const statRows = await getViewRows(view, table);
|
|
245
245
|
const formulaRows = await getTableFormulaResults(table, statRows);
|
|
246
|
-
const pivot_summary_multiple_columns = [];
|
|
247
|
-
Array.isArray(summary_columns) && summary_columns.forEach(item => {
|
|
248
|
-
const column = getTableColumnByKey(table, item.column_key);
|
|
249
|
-
if (column && isNumericColumn(column)) {
|
|
250
|
-
pivot_summary_multiple_columns.push({
|
|
251
|
-
key: item.column_key,
|
|
252
|
-
type: column.type,
|
|
253
|
-
data: column.data,
|
|
254
|
-
method: item.summary_method,
|
|
255
|
-
column_name: column.name
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
// [{key: null}, {key: cell_value}, {key: cell_value}, ...]
|
|
261
246
|
let pivot_columns = [];
|
|
262
|
-
|
|
263
|
-
// [
|
|
264
|
-
// {
|
|
265
|
-
// name: '',
|
|
266
|
-
// cells: {
|
|
267
|
-
// [key1]: {rows: [], total: ''},
|
|
268
|
-
// [key2]: {rows: [], total: ''},
|
|
269
|
-
// [key3]: {rows: [], total: ''},
|
|
270
|
-
// }
|
|
271
|
-
// },
|
|
272
|
-
// ...
|
|
273
|
-
// ]
|
|
274
247
|
let pivot_rows = [];
|
|
275
248
|
statRows.forEach(row => {
|
|
276
249
|
const {
|
|
@@ -333,9 +306,10 @@ async function calculateTwoDimensionTable(chart, value, _ref2) {
|
|
|
333
306
|
pivot_columns,
|
|
334
307
|
pivot_columns_total: new_pivot_columns_total,
|
|
335
308
|
pivot_table_total,
|
|
336
|
-
pivot_summary_multiple_columns,
|
|
337
309
|
formulaRows,
|
|
338
|
-
dimensions: TABLE_DIMENSIONS.TWO
|
|
310
|
+
dimensions: TABLE_DIMENSIONS.TWO,
|
|
311
|
+
summary_columns: [summaryColumn, ...(summary_columns === null || summary_columns === void 0 ? void 0 : summary_columns.map(item => getTableColumnByKey(table, item.column_key)))],
|
|
312
|
+
isSingleNumericColumn: !summary_columns.length ? 'true' : 'false'
|
|
339
313
|
};
|
|
340
314
|
}
|
|
341
315
|
function updateTwoDimensionColumns(value, pivot_columns, column, row, formulaRow, isIncludeEmpty, dateGranularity, geolocationGranularity, isRowGroupbyColumnDataAsAnArray) {
|
|
@@ -438,7 +412,7 @@ function updateTwoDimensionRows(pivot_rows, pivot_columns, index, name, row, isC
|
|
|
438
412
|
const nextValue = row[current === null || current === void 0 ? void 0 : current.column.key];
|
|
439
413
|
const currentValue = Object.values(cells[key].total).find(item => item[2] === columnKey)[1];
|
|
440
414
|
const computedValue = BaseUtils.getSummaryValue({
|
|
441
|
-
summaryMethod: current.summary_method,
|
|
415
|
+
summaryMethod: current.summary_method.toUpperCase(),
|
|
442
416
|
summaryColumn: current.column
|
|
443
417
|
}, currentValue, nextValue);
|
|
444
418
|
const columnName = current.column.name;
|
|
@@ -132,9 +132,9 @@ class TwoDimensionTable extends PureComponent {
|
|
|
132
132
|
};
|
|
133
133
|
this.renderEmpty = (summaryColumns, cellIdx) => {
|
|
134
134
|
if (summaryColumns && (summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.length) !== 0) {
|
|
135
|
-
return summaryColumns.map(
|
|
135
|
+
return summaryColumns.map(item => {
|
|
136
136
|
return /*#__PURE__*/React.createElement("div", {
|
|
137
|
-
key: "table-cell-".concat(
|
|
137
|
+
key: "table-cell-".concat(item.key),
|
|
138
138
|
className: classnames('pivot-cell', {
|
|
139
139
|
'pivot-empty-cell': true
|
|
140
140
|
})
|