dtable-statistic 4.3.3 → 4.3.4
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/api/dtable-db-api.js +3 -10
- package/es/calculator/base-calculator.js +12 -20
- package/es/calculator/basic-chart-calculator.js +65 -72
- package/es/calculator/combination-calculator.js +57 -64
- package/es/calculator/compare-bar-calculator.js +26 -33
- package/es/calculator/completeness-calculator.js +30 -37
- package/es/calculator/copy-value.js +1 -7
- package/es/calculator/dashboard-calculator.js +13 -20
- package/es/calculator/heat-map-calculator.js +18 -25
- package/es/calculator/horizontal-bar-calculator.js +8 -15
- package/es/calculator/index.js +35 -42
- package/es/calculator/map-calculator.js +22 -29
- package/es/calculator/mirror-calculator.js +20 -27
- package/es/calculator/number-card-calculator.js +10 -17
- package/es/calculator/pivot-table-calculator.js +58 -65
- package/es/calculator/scatter-calculator.js +14 -21
- package/es/calculator/thread-manager.js +1 -7
- package/es/calculator/trend-calculator.js +22 -29
- package/es/calculator/workers/basic-chart-calculator-worker.js +76 -83
- package/es/calculator/workers/calculator.worker.js +30 -33
- package/es/calculator/workers/card-calculator-worker.js +13 -19
- package/es/calculator/workers/combination-calculator-worker.js +46 -53
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +22 -29
- package/es/calculator/workers/completeness-calculator-worker.js +34 -41
- package/es/calculator/workers/dashboard-calculator-worker.js +18 -24
- package/es/calculator/workers/mirror-calculator-worker.js +22 -29
- package/es/calculator/workers/pivot-table-calculator-worker.js +77 -84
- package/es/calculator/workers/scatter-calculator-worker.js +20 -27
- package/es/calculator/workers/trend-calculator-worker.js +27 -34
- package/es/calculator/world-map-calculator.js +17 -24
- package/es/components/common-add-tool.js +5 -12
- package/es/components/dialog/chart-addition-edit-dialog.js +12 -20
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +101 -108
- package/es/components/dialog/color-theme-dialog.js +15 -22
- package/es/components/dialog/delete-confirmation-dialog.js +11 -18
- package/es/components/dialog/enlarged-chart-dialog.js +20 -28
- package/es/components/dialog/new-table-dialog.js +16 -23
- package/es/components/dialog/new-view-dialog.js +14 -21
- package/es/components/dialog/rename-view-dialog.js +14 -22
- package/es/components/dialog/statistic-record-dialog/index.js +37 -45
- package/es/components/dialog/statistic-types-dialog/index.js +14 -22
- package/es/components/dialog/table-select-dialog.js +15 -23
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +41 -49
- package/es/components/dtable-popover.js +12 -19
- package/es/components/dtable-search-input.js +13 -21
- package/es/components/dtable-select.js +15 -21
- package/es/components/icon.js +4 -11
- package/es/components/index.js +11 -76
- package/es/components/loading.js +3 -10
- package/es/components/modal-portal.js +5 -12
- package/es/components/popover/color-rules/color-rule.js +25 -33
- package/es/components/popover/color-rules/index.js +6 -14
- package/es/components/popover/color-rules/rule-filters/filter.js +27 -34
- package/es/components/popover/color-rules/rule-filters/index.js +17 -25
- package/es/components/popover/color-rules/rule-filters/number-input.js +9 -17
- package/es/components/popover/color-rules-popover.js +24 -32
- package/es/components/popover/color-selector-popover.js +10 -17
- package/es/components/seatable-radio/index.js +9 -16
- package/es/components/select/index.js +2 -9
- package/es/components/select/option-group.js +19 -27
- package/es/components/select/option.js +6 -14
- package/es/components/select/select.js +17 -25
- package/es/components/toast/alert.js +24 -31
- package/es/components/toast/index.js +3 -10
- package/es/components/toast/toast.js +12 -20
- package/es/components/toast/toastManager.js +9 -17
- package/es/components/toast/toaster.js +6 -14
- package/es/constants/color-rules.js +6 -12
- package/es/constants/dtable-select-style.js +4 -9
- package/es/constants/event-types.js +4 -10
- package/es/constants/index.js +67 -96
- package/es/constants/key-codes.js +0 -2
- package/es/constants/map.js +2 -8
- package/es/constants/model.js +20 -26
- package/es/constants/regions.js +3 -8
- package/es/constants/zIndexes.js +1 -7
- package/es/custom-g2.js +208 -236
- package/es/dashboard.js +50 -58
- package/es/desktop-dashboard.js +47 -55
- package/es/index.js +3 -6
- package/es/locale/index.js +10 -13
- package/es/locale/lang/de.js +1 -7
- package/es/locale/lang/en.js +1 -7
- package/es/locale/lang/fr.js +1 -7
- package/es/locale/lang/zh_CN.js +1 -7
- package/es/mobile-dashboard.js +38 -46
- package/es/model/bar-group.js +11 -19
- package/es/model/bar.js +10 -18
- package/es/model/base-model.js +2 -9
- package/es/model/basic-number-card.js +8 -16
- package/es/model/collaborators.js +2 -9
- package/es/model/combination.js +12 -20
- package/es/model/compare-bar.js +16 -24
- package/es/model/completeness-group.js +8 -16
- package/es/model/completeness.js +5 -13
- package/es/model/custom-bar.js +6 -14
- package/es/model/dashboard.js +6 -14
- package/es/model/generic-model.js +133 -141
- package/es/model/heat-map.js +11 -19
- package/es/model/horizontal-bar-group.js +10 -18
- package/es/model/horizontal-bar.js +10 -18
- package/es/model/index.js +53 -185
- package/es/model/map.js +15 -23
- package/es/model/mirror.js +13 -21
- package/es/model/pie.js +10 -18
- package/es/model/ring.js +11 -19
- package/es/model/scatter.js +6 -14
- package/es/model/statistic-dashboard.js +2 -9
- package/es/model/table.js +10 -18
- package/es/model/trend.js +12 -20
- package/es/model/world-map.js +13 -21
- package/es/service/chart-service.js +7 -14
- package/es/service/dashboard-service.js +34 -41
- package/es/service/map-json.js +8 -14
- package/es/stat-editor/chart-name-editor.js +8 -15
- package/es/stat-editor/index.js +16 -24
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +21 -29
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +49 -57
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +4 -11
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +43 -51
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +23 -31
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +37 -45
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +19 -27
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +26 -34
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +47 -55
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +22 -30
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +27 -35
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +24 -32
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +33 -41
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +22 -30
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +27 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +46 -54
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +23 -31
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +26 -34
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +77 -85
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +21 -29
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +73 -81
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +16 -24
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +19 -27
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +18 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +49 -57
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +47 -55
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +11 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +45 -53
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +9 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +20 -28
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +30 -38
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +50 -58
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +17 -25
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +47 -55
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +11 -19
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +12 -19
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +62 -70
- package/es/stat-editor/stat-settings/map/map-level.js +13 -20
- package/es/stat-editor/stat-settings/map/map-province-city.js +20 -27
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +20 -28
- package/es/stat-editor/stat-settings/public-setting/calender.js +22 -29
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +6 -13
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +9 -16
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +13 -21
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +11 -19
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +27 -35
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +8 -15
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +18 -26
- package/es/stat-list/chart-preview.js +20 -28
- package/es/stat-list/index.js +27 -35
- package/es/stat-view/area-chart.js +43 -50
- package/es/stat-view/bar-chart.js +47 -54
- package/es/stat-view/base-chart.js +24 -32
- package/es/stat-view/basic-number-card.js +19 -26
- package/es/stat-view/combination-chart.js +49 -56
- package/es/stat-view/compare-chart.js +39 -46
- package/es/stat-view/completeness-chart.js +28 -35
- package/es/stat-view/custom-bar.js +31 -38
- package/es/stat-view/dashboard-chart.js +15 -22
- package/es/stat-view/heat-map.js +43 -50
- package/es/stat-view/horizontal-bar-chart.js +51 -58
- package/es/stat-view/index.js +73 -80
- package/es/stat-view/line-chart.js +39 -46
- package/es/stat-view/map.js +33 -40
- package/es/stat-view/mirror.js +21 -28
- package/es/stat-view/pie-chart.js +29 -36
- package/es/stat-view/pivot-table/index.js +32 -39
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +31 -39
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +29 -37
- package/es/stat-view/pivot-table/pivot-table-display-name.js +46 -54
- package/es/stat-view/pivot-table/two-dimension-table.js +62 -70
- package/es/stat-view/ring-chart.js +38 -45
- package/es/stat-view/scatter-chart.js +30 -37
- package/es/stat-view/treemap-chart.js +37 -44
- package/es/stat-view/trend-chart.js +32 -39
- package/es/stat-view/world-map.js +33 -40
- package/es/tabs/index.js +32 -40
- package/es/tabs/tab.js +26 -34
- package/es/utils/basic-chart-utils.js +2 -9
- package/es/utils/cell-format.js +14 -22
- package/es/utils/cell-value.js +7 -14
- package/es/utils/collaborator.js +4 -13
- package/es/utils/color-utils.js +18 -29
- package/es/utils/column-utils.js +18 -29
- package/es/utils/column.js +4 -11
- package/es/utils/common-utils.js +41 -65
- package/es/utils/date-format.js +2 -8
- package/es/utils/export-table-utils.js +82 -91
- package/es/utils/index.js +11 -100
- package/es/utils/map.js +26 -36
- package/es/utils/model.js +6 -14
- package/es/utils/object.js +6 -15
- package/es/utils/pivot-table.js +16 -23
- package/es/utils/row-utils.js +23 -33
- package/es/utils/search.js +21 -29
- package/es/utils/sql-utils.js +65 -75
- package/es/utils/stat-utils.js +60 -66
- package/es/utils/trend-utils.js +32 -40
- package/package.json +1 -1
package/es/utils/sql-utils.js
CHANGED
|
@@ -1,53 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getSqlString = exports.getSqlOrder = exports.getSqlGroup = exports.getPieChartSqlGroupName = void 0;
|
|
7
|
-
var _dtableStore = require("dtable-store");
|
|
8
|
-
var _constants = require("../constants");
|
|
9
|
-
const getSqlOrder = (sortType, groupName) => {
|
|
1
|
+
import { CellType, filter2SqlCondition, TableUtils, Views } from 'dtable-store';
|
|
2
|
+
import { STATISTICS_COUNT_TYPE, STAT_TYPE, TIME_COLUMN_LIST } from '../constants';
|
|
3
|
+
export const getSqlOrder = (sortType, groupName) => {
|
|
10
4
|
if (!sortType) {
|
|
11
5
|
return "order by ".concat(groupName);
|
|
12
6
|
}
|
|
13
7
|
return '';
|
|
14
8
|
};
|
|
15
|
-
|
|
16
|
-
const getSqlGroup = (granularity, column) => {
|
|
9
|
+
export const getSqlGroup = (granularity, column) => {
|
|
17
10
|
const {
|
|
18
11
|
name,
|
|
19
12
|
type
|
|
20
13
|
} = column;
|
|
21
14
|
let columnName = "`".concat(name, "`");
|
|
22
|
-
if (
|
|
23
|
-
if (granularity && granularity.includes(
|
|
15
|
+
if (TIME_COLUMN_LIST.includes(type)) {
|
|
16
|
+
if (granularity && granularity.includes(STATISTICS_COUNT_TYPE.DAY)) {
|
|
24
17
|
return "ISODATE(".concat(columnName, ")");
|
|
25
18
|
}
|
|
26
|
-
if (granularity ===
|
|
19
|
+
if (granularity === STATISTICS_COUNT_TYPE.WEEK) {
|
|
27
20
|
return 'ISODATE(STARTOFWEEK(' + columnName + ', "monday"))';
|
|
28
21
|
}
|
|
29
|
-
if (granularity ===
|
|
22
|
+
if (granularity === STATISTICS_COUNT_TYPE.MONTH) {
|
|
30
23
|
return "ISOMONTH(".concat(columnName, ")");
|
|
31
24
|
}
|
|
32
|
-
if (granularity ===
|
|
25
|
+
if (granularity === STATISTICS_COUNT_TYPE.QUARTER) {
|
|
33
26
|
return "CONCATENATE(year(".concat(columnName, "), \"-Q\", quarter(").concat(columnName, "))");
|
|
34
27
|
}
|
|
35
28
|
return "YEAR(".concat(columnName, ")");
|
|
36
|
-
} else if (type ===
|
|
37
|
-
if (granularity ===
|
|
29
|
+
} else if (type === CellType.GEOLOCATION) {
|
|
30
|
+
if (granularity === STATISTICS_COUNT_TYPE.PROVINCE) {
|
|
38
31
|
return "PROVINCE(".concat(columnName, ")");
|
|
39
32
|
}
|
|
40
|
-
if (granularity ===
|
|
33
|
+
if (granularity === STATISTICS_COUNT_TYPE.CITY) {
|
|
41
34
|
return "CITY(".concat(columnName, ")");
|
|
42
35
|
}
|
|
43
|
-
if (granularity ===
|
|
36
|
+
if (granularity === STATISTICS_COUNT_TYPE.DISTRICT) {
|
|
44
37
|
return "DISTRICT(".concat(columnName, ")");
|
|
45
38
|
}
|
|
46
39
|
}
|
|
47
40
|
return "`".concat(columnName, "`");
|
|
48
41
|
};
|
|
49
|
-
|
|
50
|
-
const getPieChartSqlGroupName = (statisticRecord, selectedColumn, groupName) => {
|
|
42
|
+
export const getPieChartSqlGroupName = (statisticRecord, selectedColumn, groupName) => {
|
|
51
43
|
const {
|
|
52
44
|
original_name_list,
|
|
53
45
|
name_list
|
|
@@ -64,8 +56,7 @@ const getPieChartSqlGroupName = (statisticRecord, selectedColumn, groupName) =>
|
|
|
64
56
|
});
|
|
65
57
|
return sqlString;
|
|
66
58
|
};
|
|
67
|
-
|
|
68
|
-
const getSqlString = (statItem, statisticRecord, _ref) => {
|
|
59
|
+
export const getSqlString = (statItem, statisticRecord, _ref) => {
|
|
69
60
|
let {
|
|
70
61
|
isColumn,
|
|
71
62
|
isCurrentView,
|
|
@@ -80,7 +71,7 @@ const getSqlString = (statItem, statisticRecord, _ref) => {
|
|
|
80
71
|
type
|
|
81
72
|
} = statItem;
|
|
82
73
|
const selectedTable = getTableById(table_id);
|
|
83
|
-
const selectedView =
|
|
74
|
+
const selectedView = Views.getViewById(selectedTable.views, view_id);
|
|
84
75
|
const {
|
|
85
76
|
groupName,
|
|
86
77
|
selectedColumn,
|
|
@@ -89,7 +80,7 @@ const getSqlString = (statItem, statisticRecord, _ref) => {
|
|
|
89
80
|
} = getDatabaseGroupName(statItem, selectedTable, {
|
|
90
81
|
isCurrentView
|
|
91
82
|
});
|
|
92
|
-
const sqlCondition =
|
|
83
|
+
const sqlCondition = filter2SqlCondition(selectedTable, selectedView);
|
|
93
84
|
const isGroup = column_groupby_column_key && !column_groupby_multiple_numeric_column;
|
|
94
85
|
const {
|
|
95
86
|
name,
|
|
@@ -98,7 +89,7 @@ const getSqlString = (statItem, statisticRecord, _ref) => {
|
|
|
98
89
|
group_name
|
|
99
90
|
} = statisticRecord;
|
|
100
91
|
let sqlName = getSqlGroupName(name, original_name, selectedColumn);
|
|
101
|
-
if ((type ===
|
|
92
|
+
if ((type === STAT_TYPE.PIE || type === STAT_TYPE.RING) && original_name === 'Others') {
|
|
102
93
|
sqlName = getPieChartSqlGroupName(statisticRecord, selectedColumn, groupName);
|
|
103
94
|
}
|
|
104
95
|
let sqlGroupName;
|
|
@@ -106,7 +97,7 @@ const getSqlString = (statItem, statisticRecord, _ref) => {
|
|
|
106
97
|
sqlGroupName = getSqlGroupName(group_name, group_original_name, columnSelectedColumn);
|
|
107
98
|
}
|
|
108
99
|
let sqlString;
|
|
109
|
-
if (
|
|
100
|
+
if (STAT_TYPE.PIVOT_TABLE === type) {
|
|
110
101
|
let pivotGroupName = "".concat(isGroup ? "".concat(columnGroupName, "=").concat(sqlGroupName) : '');
|
|
111
102
|
if (isColumn) {
|
|
112
103
|
if (sqlCondition && pivotGroupName) {
|
|
@@ -138,12 +129,11 @@ const getSqlString = (statItem, statisticRecord, _ref) => {
|
|
|
138
129
|
}
|
|
139
130
|
return sqlString;
|
|
140
131
|
};
|
|
141
|
-
exports.getSqlString = getSqlString;
|
|
142
132
|
const getSqlGroupName = (name, original_name, column) => {
|
|
143
133
|
const {
|
|
144
134
|
type
|
|
145
135
|
} = column || {};
|
|
146
|
-
if (type ===
|
|
136
|
+
if (type === CellType.SINGLE_SELECT || type === CellType.MULTIPLE_SELECT) {
|
|
147
137
|
return "'".concat(name, "'");
|
|
148
138
|
}
|
|
149
139
|
const newName = original_name ? original_name : name;
|
|
@@ -158,10 +148,10 @@ const getGroupName = (selectedColumn, _ref2) => {
|
|
|
158
148
|
groupby_geolocation_granularity
|
|
159
149
|
} = _ref2;
|
|
160
150
|
let groupName = "`".concat(selectedColumn.name, "`");
|
|
161
|
-
const isTimeColumn =
|
|
151
|
+
const isTimeColumn = TIME_COLUMN_LIST.includes(selectedColumn.type);
|
|
162
152
|
if (isTimeColumn) {
|
|
163
153
|
groupName = getSqlGroup(groupby_date_granularity, selectedColumn);
|
|
164
|
-
} else if (selectedColumn.type ===
|
|
154
|
+
} else if (selectedColumn.type === CellType.GEOLOCATION) {
|
|
165
155
|
groupName = getSqlGroup(groupby_geolocation_granularity, selectedColumn);
|
|
166
156
|
}
|
|
167
157
|
return groupName;
|
|
@@ -175,18 +165,18 @@ const getDatabaseGroupName = (statItem, selectedTable, _ref3) => {
|
|
|
175
165
|
const type = statItem.type;
|
|
176
166
|
let groupName, selectedColumn, columnGroupName, columnSelectedColumn;
|
|
177
167
|
switch (type) {
|
|
178
|
-
case
|
|
179
|
-
case
|
|
180
|
-
case
|
|
181
|
-
case
|
|
182
|
-
case
|
|
183
|
-
case
|
|
184
|
-
case
|
|
185
|
-
case
|
|
186
|
-
case
|
|
187
|
-
case
|
|
188
|
-
case
|
|
189
|
-
case
|
|
168
|
+
case STAT_TYPE.BAR:
|
|
169
|
+
case STAT_TYPE.BAR_GROUP:
|
|
170
|
+
case STAT_TYPE.BAR_STACK:
|
|
171
|
+
case STAT_TYPE.LINE:
|
|
172
|
+
case STAT_TYPE.PIE:
|
|
173
|
+
case STAT_TYPE.RING:
|
|
174
|
+
case STAT_TYPE.AREA_CHART:
|
|
175
|
+
case STAT_TYPE.AREA_GROUP_CHART:
|
|
176
|
+
case STAT_TYPE.TREEMAP:
|
|
177
|
+
case STAT_TYPE.HORIZONTAL_BAR:
|
|
178
|
+
case STAT_TYPE.HORIZONTAL_GROUP_BAR:
|
|
179
|
+
case STAT_TYPE.STACKED_HORIZONTAL_BAR:
|
|
190
180
|
{
|
|
191
181
|
let groupby_column_key, groupby_date_granularity, groupby_geolocation_granularity;
|
|
192
182
|
const {
|
|
@@ -195,11 +185,11 @@ const getDatabaseGroupName = (statItem, selectedTable, _ref3) => {
|
|
|
195
185
|
column_groupby_date_granularity,
|
|
196
186
|
column_groupby_geolocation_granularity
|
|
197
187
|
} = statItem;
|
|
198
|
-
if (type ===
|
|
188
|
+
if (type === STAT_TYPE.PIE || type === STAT_TYPE.RING || type === STAT_TYPE.TREEMAP) {
|
|
199
189
|
groupby_column_key = statItem.groupby_column_key;
|
|
200
190
|
groupby_date_granularity = statItem.groupby_date_granularity;
|
|
201
191
|
groupby_geolocation_granularity = statItem.groupby_geolocation_granularity;
|
|
202
|
-
} else if (type ===
|
|
192
|
+
} else if (type === STAT_TYPE.HORIZONTAL_BAR || type === STAT_TYPE.HORIZONTAL_GROUP_BAR || type === STAT_TYPE.STACKED_HORIZONTAL_BAR) {
|
|
203
193
|
groupby_column_key = statItem.vertical_axis_column_key;
|
|
204
194
|
groupby_date_granularity = statItem.vertical_axis_date_granularity;
|
|
205
195
|
groupby_geolocation_granularity = statItem.vertical_axis_geolocation_granularity;
|
|
@@ -209,117 +199,117 @@ const getDatabaseGroupName = (statItem, selectedTable, _ref3) => {
|
|
|
209
199
|
groupby_geolocation_granularity = statItem.x_axis_geolocation_granularity;
|
|
210
200
|
}
|
|
211
201
|
if (!column_groupby_multiple_numeric_column && column_groupby_column_key) {
|
|
212
|
-
columnSelectedColumn =
|
|
202
|
+
columnSelectedColumn = TableUtils.getTableColumnByKey(selectedTable, column_groupby_column_key);
|
|
213
203
|
columnGroupName = getGroupName(columnSelectedColumn, {
|
|
214
204
|
groupby_date_granularity: column_groupby_date_granularity,
|
|
215
205
|
groupby_geolocation_granularity: column_groupby_geolocation_granularity
|
|
216
206
|
});
|
|
217
207
|
}
|
|
218
|
-
selectedColumn =
|
|
208
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, groupby_column_key);
|
|
219
209
|
groupName = getGroupName(selectedColumn, {
|
|
220
210
|
groupby_date_granularity,
|
|
221
211
|
groupby_geolocation_granularity
|
|
222
212
|
});
|
|
223
213
|
break;
|
|
224
214
|
}
|
|
225
|
-
case
|
|
226
|
-
case
|
|
215
|
+
case STAT_TYPE.MAP:
|
|
216
|
+
case STAT_TYPE.MAP_BUBBLE:
|
|
227
217
|
{
|
|
228
218
|
const {
|
|
229
219
|
geolocation_granularity,
|
|
230
220
|
geo_column
|
|
231
221
|
} = statItem;
|
|
232
|
-
selectedColumn =
|
|
222
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, geo_column);
|
|
233
223
|
groupName = getSqlGroup(geolocation_granularity, selectedColumn);
|
|
234
224
|
break;
|
|
235
225
|
}
|
|
236
|
-
case
|
|
237
|
-
case
|
|
238
|
-
case
|
|
226
|
+
case STAT_TYPE.WORLD_MAP:
|
|
227
|
+
case STAT_TYPE.WORLD_MAP_BUBBLE:
|
|
228
|
+
case STAT_TYPE.MIRROR:
|
|
239
229
|
{
|
|
240
230
|
const {
|
|
241
231
|
column
|
|
242
232
|
} = statItem;
|
|
243
|
-
selectedColumn =
|
|
233
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, column);
|
|
244
234
|
groupName = selectedColumn.name;
|
|
245
235
|
break;
|
|
246
236
|
}
|
|
247
|
-
case
|
|
237
|
+
case STAT_TYPE.HEAT_MAP:
|
|
248
238
|
{
|
|
249
239
|
const {
|
|
250
240
|
time_column
|
|
251
241
|
} = statItem;
|
|
252
|
-
selectedColumn =
|
|
242
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, time_column);
|
|
253
243
|
groupName = "ISODATE(".concat(selectedColumn.name, ")");
|
|
254
244
|
break;
|
|
255
245
|
}
|
|
256
|
-
case
|
|
246
|
+
case STAT_TYPE.SCATTER:
|
|
257
247
|
{
|
|
258
248
|
const {
|
|
259
249
|
group_column
|
|
260
250
|
} = statItem;
|
|
261
|
-
selectedColumn =
|
|
251
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, group_column);
|
|
262
252
|
groupName = selectedColumn.name;
|
|
263
253
|
break;
|
|
264
254
|
}
|
|
265
|
-
case
|
|
255
|
+
case STAT_TYPE.BASIC_NUMBER_CARD:
|
|
266
256
|
{
|
|
267
257
|
// todo
|
|
268
258
|
break;
|
|
269
259
|
}
|
|
270
|
-
case
|
|
260
|
+
case STAT_TYPE.COMPARE_BAR:
|
|
271
261
|
{
|
|
272
262
|
const {
|
|
273
263
|
x_axis_column_key,
|
|
274
264
|
x_axis_date_granularity
|
|
275
265
|
} = statItem;
|
|
276
|
-
selectedColumn =
|
|
266
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
277
267
|
groupName = getSqlGroup(x_axis_date_granularity, selectedColumn);
|
|
278
268
|
break;
|
|
279
269
|
}
|
|
280
|
-
case
|
|
270
|
+
case STAT_TYPE.COMBINATION_CHART:
|
|
281
271
|
{
|
|
282
272
|
const {
|
|
283
273
|
x_axis_column_key,
|
|
284
274
|
x_axis_date_granularity: groupby_date_granularity,
|
|
285
275
|
x_axis_geolocation_granularity: groupby_geolocation_granularity
|
|
286
276
|
} = statItem;
|
|
287
|
-
selectedColumn =
|
|
277
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
288
278
|
if (!selectedColumn) return [];
|
|
289
279
|
groupName = "`".concat(selectedColumn.name, "`");
|
|
290
|
-
if (
|
|
280
|
+
if (TIME_COLUMN_LIST.includes(selectedColumn.type)) {
|
|
291
281
|
groupName = getSqlGroup(groupby_date_granularity, selectedColumn);
|
|
292
|
-
} else if (selectedColumn.type ===
|
|
282
|
+
} else if (selectedColumn.type === CellType.GEOLOCATION) {
|
|
293
283
|
groupName = getSqlGroup(groupby_geolocation_granularity, selectedColumn);
|
|
294
284
|
}
|
|
295
285
|
break;
|
|
296
286
|
}
|
|
297
|
-
case
|
|
287
|
+
case STAT_TYPE.TREND_CHART:
|
|
298
288
|
{
|
|
299
289
|
const {
|
|
300
290
|
date_column,
|
|
301
291
|
date_granularity
|
|
302
292
|
} = statItem;
|
|
303
|
-
selectedColumn =
|
|
293
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, date_column);
|
|
304
294
|
groupName = getSqlGroup(date_granularity, selectedColumn);
|
|
305
295
|
break;
|
|
306
296
|
}
|
|
307
|
-
case
|
|
308
|
-
case
|
|
297
|
+
case STAT_TYPE.COMPLETENESS_CHART:
|
|
298
|
+
case STAT_TYPE.GROUP_COMPLETENESS_CHART:
|
|
309
299
|
{
|
|
310
300
|
const {
|
|
311
301
|
name_column
|
|
312
302
|
} = statItem;
|
|
313
|
-
selectedColumn =
|
|
303
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, name_column);
|
|
314
304
|
groupName = "`".concat(selectedColumn.name, "`");
|
|
315
305
|
break;
|
|
316
306
|
}
|
|
317
|
-
case
|
|
307
|
+
case STAT_TYPE.DASHBOARD:
|
|
318
308
|
{
|
|
319
309
|
// todo
|
|
320
310
|
break;
|
|
321
311
|
}
|
|
322
|
-
case
|
|
312
|
+
case STAT_TYPE.PIVOT_TABLE:
|
|
323
313
|
{
|
|
324
314
|
let {
|
|
325
315
|
groupby_column_key,
|
|
@@ -331,13 +321,13 @@ const getDatabaseGroupName = (statItem, selectedTable, _ref3) => {
|
|
|
331
321
|
column_groupby_multiple_numeric_column
|
|
332
322
|
} = statItem;
|
|
333
323
|
if (!column_groupby_multiple_numeric_column && column_groupby_column_key) {
|
|
334
|
-
columnSelectedColumn =
|
|
324
|
+
columnSelectedColumn = TableUtils.getTableColumnByKey(selectedTable, column_groupby_column_key);
|
|
335
325
|
columnGroupName = getGroupName(columnSelectedColumn, {
|
|
336
326
|
groupby_date_granularity: column_groupby_date_granularity,
|
|
337
327
|
groupby_geolocation_granularity: column_groupby_geolocation_granularity
|
|
338
328
|
});
|
|
339
329
|
}
|
|
340
|
-
selectedColumn =
|
|
330
|
+
selectedColumn = TableUtils.getTableColumnByKey(selectedTable, groupby_column_key);
|
|
341
331
|
groupName = getGroupName(selectedColumn, {
|
|
342
332
|
groupby_date_granularity,
|
|
343
333
|
groupby_geolocation_granularity
|
package/es/utils/stat-utils.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _dtableStore = require("dtable-store");
|
|
8
|
-
var _utils = require("../utils");
|
|
9
|
-
var _constants = require("../constants");
|
|
10
|
-
const SUPPORT_SORT_COLUMNS = [_dtableStore.CellType.TEXT, _dtableStore.CellType.NUMBER, _dtableStore.CellType.DATE, _dtableStore.CellType.SINGLE_SELECT, _dtableStore.CellType.FORMULA, _dtableStore.CellType.LINK_FORMULA, _dtableStore.CellType.CTIME, _dtableStore.CellType.MTIME, _dtableStore.CellType.RATE];
|
|
1
|
+
import { DateUtils, isNumber, isNumericColumn, CellType, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, sortText, sortNumber, sortDate, sortSingleSelect, getPrecisionNumber, getFormulaDisplayString, getGeolocationDisplayString, getDateDisplayString, getNumberDisplayString } from 'dtable-store';
|
|
2
|
+
import { getClientFormulaDisplayString } from '../utils';
|
|
3
|
+
import { DATA_SORT_TYPE, STATISTICS_COUNT_TYPE, SUMMARY_METHOD_MAP } from '../constants';
|
|
4
|
+
const SUPPORT_SORT_COLUMNS = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.SINGLE_SELECT, CellType.FORMULA, CellType.LINK_FORMULA, CellType.CTIME, CellType.MTIME, CellType.RATE];
|
|
11
5
|
const getValidCollaborators = (collaborators, emails) => {
|
|
12
6
|
if (!Array.isArray(emails)) {
|
|
13
7
|
return [];
|
|
@@ -22,20 +16,20 @@ class StatUtils {
|
|
|
22
16
|
data
|
|
23
17
|
} = column;
|
|
24
18
|
switch (type) {
|
|
25
|
-
case
|
|
19
|
+
case CellType.TEXT:
|
|
26
20
|
{
|
|
27
21
|
return cellValue || null;
|
|
28
22
|
}
|
|
29
|
-
case
|
|
23
|
+
case CellType.NUMBER:
|
|
30
24
|
{
|
|
31
25
|
if (!cellValue && cellValue !== 0) {
|
|
32
26
|
return null;
|
|
33
27
|
}
|
|
34
|
-
const number =
|
|
28
|
+
const number = getPrecisionNumber(cellValue, data);
|
|
35
29
|
let valueNumber = parseFloat(number);
|
|
36
|
-
return
|
|
30
|
+
return isNumber(valueNumber) ? getNumberDisplayString(valueNumber, column.data) : valueNumber;
|
|
37
31
|
}
|
|
38
|
-
case
|
|
32
|
+
case CellType.SINGLE_SELECT:
|
|
39
33
|
{
|
|
40
34
|
let isInvalidValue = data && data.options.findIndex(opt => opt.id === cellValue) < 0;
|
|
41
35
|
if (isInvalidValue) {
|
|
@@ -43,20 +37,20 @@ class StatUtils {
|
|
|
43
37
|
}
|
|
44
38
|
return cellValue;
|
|
45
39
|
}
|
|
46
|
-
case
|
|
47
|
-
case
|
|
48
|
-
case
|
|
40
|
+
case CellType.DATE:
|
|
41
|
+
case CellType.CTIME:
|
|
42
|
+
case CellType.MTIME:
|
|
49
43
|
{
|
|
50
44
|
if (!dateGranularity) {
|
|
51
|
-
return
|
|
45
|
+
return getDateDisplayString(cellValue);
|
|
52
46
|
}
|
|
53
47
|
if (dateGranularity.toUpperCase() === 'QUARTER') {
|
|
54
48
|
// TODO: fix the unknown word 'QUARTAR'
|
|
55
|
-
return
|
|
49
|
+
return DateUtils.getDateByGranularity(cellValue, 'QUARTAR');
|
|
56
50
|
}
|
|
57
|
-
return
|
|
51
|
+
return DateUtils.getDateByGranularity(cellValue, dateGranularity);
|
|
58
52
|
}
|
|
59
|
-
case
|
|
53
|
+
case CellType.MULTIPLE_SELECT:
|
|
60
54
|
{
|
|
61
55
|
let options = data && data.options;
|
|
62
56
|
if (!Array.isArray(cellValue)) {
|
|
@@ -64,44 +58,44 @@ class StatUtils {
|
|
|
64
58
|
}
|
|
65
59
|
return cellValue.filter(id => options.findIndex(o => o.id === id) > -1);
|
|
66
60
|
}
|
|
67
|
-
case
|
|
61
|
+
case CellType.COLLABORATOR:
|
|
68
62
|
{
|
|
69
63
|
return getValidCollaborators(value.collaborators, cellValue);
|
|
70
64
|
}
|
|
71
|
-
case
|
|
72
|
-
case
|
|
65
|
+
case CellType.CREATOR:
|
|
66
|
+
case CellType.LAST_MODIFIER:
|
|
73
67
|
{
|
|
74
68
|
return cellValue ? cellValue : null;
|
|
75
69
|
}
|
|
76
|
-
case
|
|
77
|
-
case
|
|
70
|
+
case CellType.LINK_FORMULA:
|
|
71
|
+
case CellType.FORMULA:
|
|
78
72
|
{
|
|
79
73
|
if (!formulaRow) return '';
|
|
80
74
|
let formulaCellValue = formulaRow[key];
|
|
81
75
|
let {
|
|
82
76
|
result_type
|
|
83
77
|
} = data || {};
|
|
84
|
-
if (result_type ===
|
|
85
|
-
return
|
|
78
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
79
|
+
return getFormulaDisplayString(formulaCellValue, data, {
|
|
86
80
|
tables: value.tables
|
|
87
81
|
}) || null;
|
|
88
82
|
}
|
|
89
|
-
if (result_type ===
|
|
90
|
-
return
|
|
83
|
+
if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
84
|
+
return getPrecisionNumber(formulaCellValue, data);
|
|
91
85
|
}
|
|
92
86
|
return formulaCellValue ? formulaCellValue + '' : null;
|
|
93
87
|
}
|
|
94
|
-
case
|
|
88
|
+
case CellType.GEOLOCATION:
|
|
95
89
|
{
|
|
96
90
|
const {
|
|
97
91
|
geo_format
|
|
98
92
|
} = data || {};
|
|
99
93
|
if (geo_format === 'country_region' || geo_format === 'lng_lat' || !geoGranularity) {
|
|
100
|
-
return
|
|
94
|
+
return getGeolocationDisplayString(cellValue, data);
|
|
101
95
|
}
|
|
102
96
|
return cellValue ? cellValue[geoGranularity] : null;
|
|
103
97
|
}
|
|
104
|
-
case
|
|
98
|
+
case CellType.LINK:
|
|
105
99
|
{
|
|
106
100
|
const linkCellValue = formulaRow && formulaRow[key];
|
|
107
101
|
if (!Array.isArray(linkCellValue)) {
|
|
@@ -109,11 +103,11 @@ class StatUtils {
|
|
|
109
103
|
}
|
|
110
104
|
return linkCellValue.map(linkVal => linkVal.display_value);
|
|
111
105
|
}
|
|
112
|
-
case
|
|
106
|
+
case CellType.CHECKBOX:
|
|
113
107
|
{
|
|
114
108
|
return String(!!cellValue);
|
|
115
109
|
}
|
|
116
|
-
case
|
|
110
|
+
case CellType.RATE:
|
|
117
111
|
{
|
|
118
112
|
if (!cellValue) return null;
|
|
119
113
|
return cellValue + '';
|
|
@@ -131,7 +125,7 @@ class StatUtils {
|
|
|
131
125
|
} = column;
|
|
132
126
|
let sortType = 'up';
|
|
133
127
|
let option_id_index_map = {};
|
|
134
|
-
if (column_type ===
|
|
128
|
+
if (column_type === CellType.SINGLE_SELECT) {
|
|
135
129
|
const {
|
|
136
130
|
options
|
|
137
131
|
} = data || {};
|
|
@@ -154,7 +148,7 @@ class StatUtils {
|
|
|
154
148
|
}
|
|
155
149
|
if (SUPPORT_SORT_COLUMNS.includes(column_type)) {
|
|
156
150
|
switch (column_type) {
|
|
157
|
-
case
|
|
151
|
+
case CellType.NUMBER:
|
|
158
152
|
{
|
|
159
153
|
if (current) {
|
|
160
154
|
current = current - 0;
|
|
@@ -162,42 +156,42 @@ class StatUtils {
|
|
|
162
156
|
if (next) {
|
|
163
157
|
next = next - 0;
|
|
164
158
|
}
|
|
165
|
-
return
|
|
159
|
+
return sortNumber(current, next, sortType);
|
|
166
160
|
}
|
|
167
|
-
case
|
|
168
|
-
case
|
|
169
|
-
case
|
|
161
|
+
case CellType.DATE:
|
|
162
|
+
case CellType.CTIME:
|
|
163
|
+
case CellType.MTIME:
|
|
170
164
|
{
|
|
171
|
-
return
|
|
165
|
+
return sortDate(current, next, sortType);
|
|
172
166
|
}
|
|
173
|
-
case
|
|
174
|
-
case
|
|
167
|
+
case CellType.SINGLE_SELECT:
|
|
168
|
+
case CellType.MULTIPLE_SELECT:
|
|
175
169
|
{
|
|
176
|
-
return
|
|
170
|
+
return sortSingleSelect(current, next, {
|
|
177
171
|
sort_type: sortType,
|
|
178
172
|
option_id_index_map
|
|
179
173
|
});
|
|
180
174
|
}
|
|
181
|
-
case
|
|
182
|
-
case
|
|
175
|
+
case CellType.FORMULA:
|
|
176
|
+
case CellType.LINK_FORMULA:
|
|
183
177
|
{
|
|
184
178
|
let {
|
|
185
179
|
result_type
|
|
186
180
|
} = data || {};
|
|
187
|
-
if (result_type ===
|
|
181
|
+
if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
188
182
|
if (current) {
|
|
189
183
|
current = current - 0;
|
|
190
184
|
}
|
|
191
185
|
if (next) {
|
|
192
186
|
next = next - 0;
|
|
193
187
|
}
|
|
194
|
-
return
|
|
188
|
+
return sortNumber(current, next, sortType);
|
|
195
189
|
}
|
|
196
|
-
return
|
|
190
|
+
return sortText(result_type, current, next, sortType);
|
|
197
191
|
}
|
|
198
192
|
default:
|
|
199
193
|
{
|
|
200
|
-
return
|
|
194
|
+
return sortText(current, next, sortType);
|
|
201
195
|
}
|
|
202
196
|
}
|
|
203
197
|
}
|
|
@@ -214,7 +208,7 @@ class StatUtils {
|
|
|
214
208
|
if (!nextVal && nextVal !== 0) {
|
|
215
209
|
return 1;
|
|
216
210
|
}
|
|
217
|
-
if (sortType ===
|
|
211
|
+
if (sortType === DATA_SORT_TYPE.ASCENDING) {
|
|
218
212
|
return currentVal > nextVal ? 1 : -1;
|
|
219
213
|
} else {
|
|
220
214
|
return currentVal > nextVal ? -1 : 1;
|
|
@@ -229,9 +223,9 @@ class StatUtils {
|
|
|
229
223
|
let formula_rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
230
224
|
let rowsLength = rows.length;
|
|
231
225
|
let total;
|
|
232
|
-
if (summary_type ===
|
|
226
|
+
if (summary_type === STATISTICS_COUNT_TYPE.COUNT) {
|
|
233
227
|
total = rowsLength;
|
|
234
|
-
} else if (summary_type ===
|
|
228
|
+
} else if (summary_type === STATISTICS_COUNT_TYPE.ADVANCED) {
|
|
235
229
|
switch (summary_method) {
|
|
236
230
|
case 'Distinct_values':
|
|
237
231
|
{
|
|
@@ -239,7 +233,7 @@ class StatUtils {
|
|
|
239
233
|
let existMap = {};
|
|
240
234
|
rows.forEach(r => {
|
|
241
235
|
let num;
|
|
242
|
-
if (
|
|
236
|
+
if (FORMULA_COLUMN_TYPES_MAP[summary_column_type]) {
|
|
243
237
|
const formulaRow = formula_rows[r._id] || {};
|
|
244
238
|
num = formulaRow[summary_column_key];
|
|
245
239
|
num = Array.isArray(num) ? num[0] : num;
|
|
@@ -268,14 +262,14 @@ class StatUtils {
|
|
|
268
262
|
let validNumbersCount = 0;
|
|
269
263
|
rows.forEach(r => {
|
|
270
264
|
let num;
|
|
271
|
-
if (
|
|
265
|
+
if (FORMULA_COLUMN_TYPES_MAP[summary_column_type]) {
|
|
272
266
|
let formulaRow = formula_rows[r._id] || {};
|
|
273
267
|
num = formulaRow[summary_column_key];
|
|
274
268
|
num = Array.isArray(num) ? num[0] : num;
|
|
275
269
|
} else {
|
|
276
270
|
num = r[summary_column_key];
|
|
277
271
|
}
|
|
278
|
-
if (
|
|
272
|
+
if (isNumber(num)) {
|
|
279
273
|
validNumbersCount++;
|
|
280
274
|
sum += num;
|
|
281
275
|
}
|
|
@@ -293,7 +287,7 @@ class StatUtils {
|
|
|
293
287
|
if (rowsLength > 0) {
|
|
294
288
|
let result = rows.reduce((current, next) => {
|
|
295
289
|
let currentValue, nextValue;
|
|
296
|
-
if (
|
|
290
|
+
if (FORMULA_COLUMN_TYPES_MAP[summary_column_type]) {
|
|
297
291
|
let currentFormulaRow = formula_rows[current._id];
|
|
298
292
|
let nextFormulaRow = formula_rows[next._id];
|
|
299
293
|
currentValue = currentFormulaRow && currentFormulaRow[summary_column_key];
|
|
@@ -314,7 +308,7 @@ class StatUtils {
|
|
|
314
308
|
return isNextGreater ? next : current;
|
|
315
309
|
}
|
|
316
310
|
});
|
|
317
|
-
if (
|
|
311
|
+
if (FORMULA_COLUMN_TYPES_MAP[summary_column_type]) {
|
|
318
312
|
let formulaRow = formula_rows[result._id];
|
|
319
313
|
total = formulaRow && formulaRow[summary_column_key];
|
|
320
314
|
total = Array.isArray(total) ? total[0] : total;
|
|
@@ -336,20 +330,20 @@ class StatUtils {
|
|
|
336
330
|
if (!column) {
|
|
337
331
|
return value;
|
|
338
332
|
}
|
|
339
|
-
if (summaryMethod ===
|
|
333
|
+
if (summaryMethod === SUMMARY_METHOD_MAP.Distinct_values) {
|
|
340
334
|
return value;
|
|
341
335
|
}
|
|
342
336
|
const {
|
|
343
337
|
type,
|
|
344
338
|
data
|
|
345
339
|
} = column;
|
|
346
|
-
if (
|
|
347
|
-
return
|
|
340
|
+
if (isNumericColumn(column)) {
|
|
341
|
+
return getNumberDisplayString(value, data);
|
|
348
342
|
}
|
|
349
|
-
if (
|
|
350
|
-
return
|
|
343
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
344
|
+
return getClientFormulaDisplayString(value, data);
|
|
351
345
|
}
|
|
352
346
|
return value;
|
|
353
347
|
}
|
|
354
348
|
}
|
|
355
|
-
|
|
349
|
+
export default StatUtils;
|