dtable-statistic 4.0.12 → 4.1.0
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/es/calculator/workers/pivot-table-calculator-worker.js +15 -7
- package/es/components/dialog/chart-addition-edit-dialog.js +1 -0
- package/es/components/dialog/statistic-record-dialog/index.js +128 -51
- package/es/constants/event-types.js +4 -1
- package/es/dashboard.js +26 -15
- package/es/desktop-dashboard.js +2 -0
- package/es/model/generic-model.js +2 -2
- package/es/stat-editor/index.js +1 -0
- package/es/stat-list/index.js +6 -1
- package/es/stat-view/pie-chart.js +0 -2
- package/es/stat-view/pivot-table/index.js +2 -2
- package/es/stat-view/pivot-table/two-dimension-table.js +5 -93
- package/es/stat-view/ring-chart.js +0 -2
- package/es/utils/common-utils.js +25 -2
- package/es/utils/export-table-utils.js +510 -311
- package/es/utils/pivot-table.js +91 -0
- package/es/utils/sql-utils.js +18 -0
- package/package.json +3 -3
package/es/utils/common-utils.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, generatorBase64Code, isNumber, TableUtils } from 'dtable-store';
|
|
3
|
+
import intl from 'react-intl-universal';
|
|
2
4
|
import { STAT_TYPE, DEFAULT_LABEL_FONT_SIZE, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, CHART_STYLE_COLORS, PIE_COLOR_OPTIONS, SUMMARY_METHOD_MAP } from '../constants';
|
|
3
5
|
import StatUtils from './stat-utils';
|
|
4
6
|
export var generatorUniqueId = function generatorUniqueId(list) {
|
|
@@ -8,7 +10,10 @@ export var generatorUniqueId = function generatorUniqueId(list) {
|
|
|
8
10
|
uniqueId = generatorBase64Code();
|
|
9
11
|
|
|
10
12
|
// eslint-disable-next-line
|
|
11
|
-
|
|
13
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
isUnique = list.every(function (item) {
|
|
12
17
|
return item._id !== uniqueId;
|
|
13
18
|
});
|
|
14
19
|
if (isUnique) {
|
|
@@ -251,10 +256,28 @@ export function formatPieChartData(data, statItem, table, currentTheme) {
|
|
|
251
256
|
var filteredSum = filteredItems.reduce(function (total, currentValue) {
|
|
252
257
|
return total += currentValue.value;
|
|
253
258
|
}, 0);
|
|
259
|
+
var original_name_list = [];
|
|
260
|
+
var name_list = [];
|
|
261
|
+
var rows = [];
|
|
262
|
+
filteredItems.forEach(function (item) {
|
|
263
|
+
if (item.original_name) {
|
|
264
|
+
original_name_list.push(item.original_name);
|
|
265
|
+
}
|
|
266
|
+
if (item.name) {
|
|
267
|
+
name_list.push(item.name);
|
|
268
|
+
}
|
|
269
|
+
if (item.rows) {
|
|
270
|
+
rows.push.apply(rows, _toConsumableArray(item.rows));
|
|
271
|
+
}
|
|
272
|
+
});
|
|
254
273
|
data.push({
|
|
255
|
-
|
|
274
|
+
rows: rows,
|
|
275
|
+
name_list: name_list,
|
|
276
|
+
original_name_list: original_name_list,
|
|
277
|
+
name: intl.get('Others'),
|
|
256
278
|
value: filteredSum,
|
|
257
279
|
color: '#dbdbdb',
|
|
280
|
+
original_name: 'Others',
|
|
258
281
|
percent: String(Number.parseFloat(filteredSum / sum * 100).toFixed(1)) + '%'
|
|
259
282
|
});
|
|
260
283
|
colorSet.push('#dbdbdb');
|