dtable-statistic 4.3.4 → 4.3.5
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 +10 -3
- package/es/calculator/base-calculator.js +20 -12
- package/es/calculator/basic-chart-calculator.js +72 -65
- package/es/calculator/combination-calculator.js +64 -57
- package/es/calculator/compare-bar-calculator.js +33 -26
- package/es/calculator/completeness-calculator.js +37 -30
- package/es/calculator/copy-value.js +7 -1
- package/es/calculator/dashboard-calculator.js +20 -13
- package/es/calculator/heat-map-calculator.js +25 -18
- package/es/calculator/horizontal-bar-calculator.js +15 -8
- package/es/calculator/index.js +42 -35
- package/es/calculator/map-calculator.js +29 -22
- package/es/calculator/mirror-calculator.js +27 -20
- package/es/calculator/number-card-calculator.js +17 -10
- package/es/calculator/pivot-table-calculator.js +65 -58
- package/es/calculator/scatter-calculator.js +21 -14
- package/es/calculator/thread-manager.js +7 -1
- package/es/calculator/trend-calculator.js +29 -22
- package/es/calculator/workers/basic-chart-calculator-worker.js +83 -76
- package/es/calculator/workers/calculator.worker.js +33 -30
- package/es/calculator/workers/card-calculator-worker.js +19 -13
- package/es/calculator/workers/combination-calculator-worker.js +53 -46
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +29 -22
- package/es/calculator/workers/completeness-calculator-worker.js +41 -34
- package/es/calculator/workers/dashboard-calculator-worker.js +24 -18
- package/es/calculator/workers/mirror-calculator-worker.js +29 -22
- package/es/calculator/workers/pivot-table-calculator-worker.js +84 -77
- package/es/calculator/workers/scatter-calculator-worker.js +27 -20
- package/es/calculator/workers/trend-calculator-worker.js +34 -27
- package/es/calculator/world-map-calculator.js +24 -17
- package/es/components/common-add-tool.js +12 -5
- package/es/components/dialog/chart-addition-edit-dialog.js +20 -12
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +108 -101
- package/es/components/dialog/color-theme-dialog.js +22 -15
- package/es/components/dialog/delete-confirmation-dialog.js +18 -11
- package/es/components/dialog/enlarged-chart-dialog.js +28 -20
- package/es/components/dialog/new-table-dialog.js +23 -16
- package/es/components/dialog/new-view-dialog.js +21 -14
- package/es/components/dialog/rename-view-dialog.js +22 -14
- package/es/components/dialog/statistic-record-dialog/index.js +45 -37
- package/es/components/dialog/statistic-types-dialog/index.js +22 -14
- package/es/components/dialog/table-select-dialog.js +23 -15
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +49 -41
- package/es/components/dtable-popover.js +19 -12
- package/es/components/dtable-search-input.js +21 -13
- package/es/components/dtable-select.js +20 -12
- package/es/components/icon.js +11 -4
- package/es/components/index.js +76 -11
- package/es/components/loading.js +10 -3
- package/es/components/modal-portal.js +12 -5
- package/es/components/popover/color-rules/color-rule.js +33 -25
- package/es/components/popover/color-rules/index.js +14 -6
- package/es/components/popover/color-rules/rule-filters/filter.js +34 -27
- package/es/components/popover/color-rules/rule-filters/index.js +25 -17
- package/es/components/popover/color-rules/rule-filters/number-input.js +17 -9
- package/es/components/popover/color-rules-popover.js +32 -24
- package/es/components/popover/color-selector-popover.js +17 -10
- package/es/components/seatable-radio/index.js +16 -9
- package/es/components/select/index.js +9 -2
- package/es/components/select/option-group.js +27 -19
- package/es/components/select/option.js +14 -6
- package/es/components/select/select.js +25 -17
- package/es/components/toast/alert.js +31 -24
- package/es/components/toast/index.js +10 -3
- package/es/components/toast/toast.js +20 -12
- package/es/components/toast/toastManager.js +17 -9
- package/es/components/toast/toaster.js +14 -6
- package/es/constants/color-rules.js +12 -6
- package/es/constants/dtable-select-style.js +9 -4
- package/es/constants/event-types.js +10 -4
- package/es/constants/index.js +96 -67
- package/es/constants/key-codes.js +2 -0
- package/es/constants/map.js +8 -2
- package/es/constants/model.js +26 -20
- package/es/constants/regions.js +8 -3
- package/es/constants/zIndexes.js +7 -1
- package/es/custom-g2.js +236 -208
- package/es/dashboard.js +58 -50
- package/es/desktop-dashboard.js +55 -47
- package/es/index.js +6 -3
- package/es/locale/index.js +13 -10
- package/es/locale/lang/de.js +7 -1
- package/es/locale/lang/en.js +7 -1
- package/es/locale/lang/fr.js +7 -1
- package/es/locale/lang/zh_CN.js +7 -1
- package/es/mobile-dashboard.js +46 -38
- package/es/model/bar-group.js +19 -11
- package/es/model/bar.js +18 -10
- package/es/model/base-model.js +9 -2
- package/es/model/basic-number-card.js +16 -8
- package/es/model/collaborators.js +9 -2
- package/es/model/combination.js +20 -12
- package/es/model/compare-bar.js +24 -16
- package/es/model/completeness-group.js +16 -8
- package/es/model/completeness.js +13 -5
- package/es/model/custom-bar.js +14 -6
- package/es/model/dashboard.js +14 -6
- package/es/model/generic-model.js +141 -133
- package/es/model/heat-map.js +19 -11
- package/es/model/horizontal-bar-group.js +18 -10
- package/es/model/horizontal-bar.js +18 -10
- package/es/model/index.js +185 -53
- package/es/model/map.js +23 -15
- package/es/model/mirror.js +21 -13
- package/es/model/pie.js +18 -10
- package/es/model/ring.js +19 -11
- package/es/model/scatter.js +14 -6
- package/es/model/statistic-dashboard.js +9 -2
- package/es/model/table.js +18 -10
- package/es/model/trend.js +20 -12
- package/es/model/world-map.js +21 -13
- package/es/service/chart-service.js +14 -7
- package/es/service/dashboard-service.js +41 -34
- package/es/service/map-json.js +14 -8
- package/es/stat-editor/chart-name-editor.js +15 -8
- package/es/stat-editor/index.js +24 -16
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +29 -21
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +57 -49
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +11 -4
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +27 -19
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +51 -43
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +31 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +45 -37
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +27 -19
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +34 -26
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +55 -47
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +30 -22
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +35 -27
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +32 -24
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +41 -33
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +30 -22
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +54 -46
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +31 -23
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +34 -26
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +85 -77
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +29 -21
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +81 -73
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +24 -16
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +27 -19
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +26 -18
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +57 -49
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +25 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +55 -47
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +19 -11
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +53 -45
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +17 -9
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +28 -20
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +38 -30
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +58 -50
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +25 -17
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +55 -47
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +19 -11
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +19 -12
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +70 -62
- package/es/stat-editor/stat-settings/map/map-level.js +20 -13
- package/es/stat-editor/stat-settings/map/map-province-city.js +27 -20
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +19 -11
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +28 -20
- package/es/stat-editor/stat-settings/public-setting/calender.js +29 -22
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +13 -6
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +16 -9
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +21 -13
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +15 -8
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +19 -11
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +35 -27
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +15 -8
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +26 -18
- package/es/stat-list/chart-preview.js +28 -20
- package/es/stat-list/index.js +35 -27
- package/es/stat-view/area-chart.js +50 -43
- package/es/stat-view/bar-chart.js +54 -47
- package/es/stat-view/base-chart.js +32 -24
- package/es/stat-view/basic-number-card.js +26 -19
- package/es/stat-view/combination-chart.js +56 -49
- package/es/stat-view/compare-chart.js +46 -39
- package/es/stat-view/completeness-chart.js +35 -28
- package/es/stat-view/custom-bar.js +38 -31
- package/es/stat-view/dashboard-chart.js +22 -15
- package/es/stat-view/heat-map.js +50 -43
- package/es/stat-view/horizontal-bar-chart.js +58 -51
- package/es/stat-view/index.js +80 -73
- package/es/stat-view/line-chart.js +46 -39
- package/es/stat-view/map.js +40 -33
- package/es/stat-view/mirror.js +28 -21
- package/es/stat-view/pie-chart.js +36 -29
- package/es/stat-view/pivot-table/index.js +39 -32
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +39 -31
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +37 -29
- package/es/stat-view/pivot-table/pivot-table-display-name.js +54 -46
- package/es/stat-view/pivot-table/two-dimension-table.js +70 -62
- package/es/stat-view/ring-chart.js +45 -38
- package/es/stat-view/scatter-chart.js +37 -30
- package/es/stat-view/treemap-chart.js +44 -37
- package/es/stat-view/trend-chart.js +39 -32
- package/es/stat-view/world-map.js +40 -33
- package/es/tabs/index.js +40 -32
- package/es/tabs/tab.js +34 -26
- package/es/utils/basic-chart-utils.js +9 -2
- package/es/utils/cell-format.js +22 -14
- package/es/utils/cell-value.js +14 -7
- package/es/utils/collaborator.js +13 -4
- package/es/utils/color-utils.js +29 -18
- package/es/utils/column-utils.js +29 -18
- package/es/utils/column.js +11 -4
- package/es/utils/common-utils.js +65 -41
- package/es/utils/date-format.js +8 -2
- package/es/utils/export-table-utils.js +91 -82
- package/es/utils/index.js +100 -11
- package/es/utils/map.js +36 -26
- package/es/utils/model.js +14 -6
- package/es/utils/object.js +15 -6
- package/es/utils/pivot-table.js +23 -16
- package/es/utils/row-utils.js +33 -23
- package/es/utils/search.js +29 -21
- package/es/utils/sql-utils.js +75 -65
- package/es/utils/stat-utils.js +66 -60
- package/es/utils/trend-utils.js +40 -32
- package/package.json +3 -3
package/es/stat-view/map.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _index = _interopRequireDefault(require("@antv/data-set/lib/index"));
|
|
11
|
+
var _dtableStore = require("dtable-store");
|
|
12
|
+
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
13
|
+
var _customG = require("../custom-g2");
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
var _map = require("../constants/map");
|
|
16
|
+
var _commonUtils = require("../utils/common-utils");
|
|
17
|
+
var _map2 = require("../utils/map");
|
|
18
|
+
class Map extends _baseChart.default {
|
|
12
19
|
constructor(props) {
|
|
13
20
|
super(props);
|
|
14
21
|
this.hasMapChanged = (preStatItem, statItem) => {
|
|
@@ -20,7 +27,7 @@ class Map extends BaseChart {
|
|
|
20
27
|
map_level,
|
|
21
28
|
map_location
|
|
22
29
|
} = statItem;
|
|
23
|
-
return map_level !== preMapLevel || !shallowEqual(map_location, prevMapLocation);
|
|
30
|
+
return map_level !== preMapLevel || !(0, _commonUtils.shallowEqual)(map_location, prevMapLocation);
|
|
24
31
|
};
|
|
25
32
|
this.reCalculateChart = statItem => {
|
|
26
33
|
this.rerenderChart();
|
|
@@ -41,7 +48,7 @@ class Map extends BaseChart {
|
|
|
41
48
|
const {
|
|
42
49
|
map_level
|
|
43
50
|
} = statItem;
|
|
44
|
-
return map_level || MAP_LEVEL.COUNTRY;
|
|
51
|
+
return map_level || _map.MAP_LEVEL.COUNTRY;
|
|
45
52
|
};
|
|
46
53
|
this.fixData = statisticData => {
|
|
47
54
|
if (!statisticData) return [];
|
|
@@ -89,16 +96,16 @@ class Map extends BaseChart {
|
|
|
89
96
|
summary_method,
|
|
90
97
|
summary_column
|
|
91
98
|
} = this.props.statItem;
|
|
92
|
-
const currentColorOption = COLOR_OPTIONS.filter(item => item.name === data_color)[0] || COLOR_OPTIONS[0];
|
|
99
|
+
const currentColorOption = _constants.COLOR_OPTIONS.filter(item => item.name === data_color)[0] || _constants.COLOR_OPTIONS[0];
|
|
93
100
|
const {
|
|
94
101
|
exampleColors,
|
|
95
102
|
highlightedBorderColor
|
|
96
103
|
} = currentColorOption;
|
|
97
|
-
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
98
|
-
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
104
|
+
let columnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
105
|
+
if (summary_type === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
99
106
|
const table = getTableById(table_id);
|
|
100
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
101
|
-
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
107
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
108
|
+
columnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
102
109
|
}
|
|
103
110
|
this.statisticView = this.chart.createView();
|
|
104
111
|
this.statisticView.data(userDataView.rows);
|
|
@@ -186,11 +193,11 @@ class Map extends BaseChart {
|
|
|
186
193
|
summary_method,
|
|
187
194
|
summary_column
|
|
188
195
|
} = this.props.statItem;
|
|
189
|
-
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
190
|
-
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
196
|
+
let columnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
197
|
+
if (summary_type === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
191
198
|
const table = getTableById(table_id);
|
|
192
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
193
|
-
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
199
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
200
|
+
columnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
194
201
|
}
|
|
195
202
|
this.statisticView = this.chart.createView();
|
|
196
203
|
this.statisticView.data(userDv.rows);
|
|
@@ -259,7 +266,7 @@ class Map extends BaseChart {
|
|
|
259
266
|
const {
|
|
260
267
|
scale_w,
|
|
261
268
|
scale_h
|
|
262
|
-
} = getRegionScaleOffsets(map_level, map_location);
|
|
269
|
+
} = (0, _map2.getRegionScaleOffsets)(map_level, map_location);
|
|
263
270
|
let h = containerHeight;
|
|
264
271
|
let w = h * (scale_w / scale_h);
|
|
265
272
|
if (w > containerWidth) {
|
|
@@ -285,7 +292,7 @@ class Map extends BaseChart {
|
|
|
285
292
|
} = this.getSize();
|
|
286
293
|
const horizontalPadding = (containerWidth - mapWidth) / 4;
|
|
287
294
|
const leftPadding = horizontalPadding < 20 ? 20 : horizontalPadding;
|
|
288
|
-
this.chart = new Chart({
|
|
295
|
+
this.chart = new _customG.Chart({
|
|
289
296
|
container: this.container,
|
|
290
297
|
width: containerWidth,
|
|
291
298
|
height: containerHeight,
|
|
@@ -321,7 +328,7 @@ class Map extends BaseChart {
|
|
|
321
328
|
}
|
|
322
329
|
});
|
|
323
330
|
this.chart.axis(false);
|
|
324
|
-
this.dataSet = new
|
|
331
|
+
this.dataSet = new _index.default();
|
|
325
332
|
|
|
326
333
|
// transform map data
|
|
327
334
|
const mapData = this.dataSet.createView('mapDataModel').source(geolocation, {
|
|
@@ -424,18 +431,18 @@ class Map extends BaseChart {
|
|
|
424
431
|
isDataLoaded,
|
|
425
432
|
isCalculatingData
|
|
426
433
|
} = this.state;
|
|
427
|
-
return /*#__PURE__*/
|
|
434
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (!isDataLoaded || isCalculatingData) && this.renderLoading(), /*#__PURE__*/_react.default.createElement("div", {
|
|
428
435
|
ref: ref => this.container = ref,
|
|
429
436
|
className: "statistic-chart-container map d-flex justify-content-around align-items-center w-100 h-100"
|
|
430
437
|
}));
|
|
431
438
|
}
|
|
432
439
|
}
|
|
433
440
|
Map.propTypes = {
|
|
434
|
-
isPreview:
|
|
435
|
-
statItem:
|
|
436
|
-
chartCalculator:
|
|
437
|
-
getTableById:
|
|
438
|
-
queryMapJson:
|
|
439
|
-
toggleStatisticRecordsDialog:
|
|
441
|
+
isPreview: _propTypes.default.bool,
|
|
442
|
+
statItem: _propTypes.default.object,
|
|
443
|
+
chartCalculator: _propTypes.default.object,
|
|
444
|
+
getTableById: _propTypes.default.func,
|
|
445
|
+
queryMapJson: _propTypes.default.func.isRequired,
|
|
446
|
+
toggleStatisticRecordsDialog: _propTypes.default.func
|
|
440
447
|
};
|
|
441
|
-
|
|
448
|
+
var _default = exports.default = Map;
|
package/es/stat-view/mirror.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _dtableStore = require("dtable-store");
|
|
12
|
+
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
13
|
+
var _customG = require("../custom-g2");
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
class Mirror extends _baseChart.default {
|
|
9
16
|
constructor(props) {
|
|
10
17
|
super(props);
|
|
11
18
|
this.destroyChart = () => {
|
|
@@ -32,11 +39,11 @@ class Mirror extends BaseChart {
|
|
|
32
39
|
this.props.toggleStatisticRecordsDialog(e.data.data, statItem);
|
|
33
40
|
});
|
|
34
41
|
const themeColors = this.getThemeColors();
|
|
35
|
-
let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
36
|
-
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
42
|
+
let summaryColumnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
43
|
+
if (summary_type === _constants.SUMMARY_TYPE.ADVANCED) {
|
|
37
44
|
const table = getTableById(table_id);
|
|
38
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
39
|
-
summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
45
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column) || {};
|
|
46
|
+
summaryColumnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
40
47
|
}
|
|
41
48
|
this.chart.data(data);
|
|
42
49
|
this.setAxis(themeColors);
|
|
@@ -57,7 +64,7 @@ class Mirror extends BaseChart {
|
|
|
57
64
|
}
|
|
58
65
|
view.interval().position('name*value').color('group_name', colorSet).tooltip('name*formatted_value', (name, value) => {
|
|
59
66
|
return {
|
|
60
|
-
title: summary_type === 'count' ?
|
|
67
|
+
title: summary_type === 'count' ? _reactIntlUniversal.default.get(_constants.TITLE_AMOUNT) : _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[summary_method]),
|
|
61
68
|
name,
|
|
62
69
|
value
|
|
63
70
|
};
|
|
@@ -101,7 +108,7 @@ class Mirror extends BaseChart {
|
|
|
101
108
|
config.width = 800;
|
|
102
109
|
config.padding = is_transpose ? [35, 30, 30, 30] : [30, 100, 30, 30];
|
|
103
110
|
}
|
|
104
|
-
this.chart = new Chart(config);
|
|
111
|
+
this.chart = new _customG.Chart(config);
|
|
105
112
|
};
|
|
106
113
|
this.setAxis = themeColors => {
|
|
107
114
|
this.chart.axis('name', {
|
|
@@ -252,17 +259,17 @@ class Mirror extends BaseChart {
|
|
|
252
259
|
isCalculatingData,
|
|
253
260
|
showResultDescription
|
|
254
261
|
} = this.state;
|
|
255
|
-
return /*#__PURE__*/
|
|
262
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/_react.default.createElement("div", {
|
|
256
263
|
ref: ref => this.container = ref,
|
|
257
264
|
className: "statistic-mirror-chart-container statistic-chart-container"
|
|
258
265
|
}));
|
|
259
266
|
}
|
|
260
267
|
}
|
|
261
268
|
Mirror.propTypes = {
|
|
262
|
-
isPreview:
|
|
263
|
-
statItem:
|
|
264
|
-
chartCalculator:
|
|
265
|
-
getTableById:
|
|
266
|
-
toggleStatisticRecordsDialog:
|
|
269
|
+
isPreview: _propTypes.default.bool,
|
|
270
|
+
statItem: _propTypes.default.object,
|
|
271
|
+
chartCalculator: _propTypes.default.object,
|
|
272
|
+
getTableById: _propTypes.default.func,
|
|
273
|
+
toggleStatisticRecordsDialog: _propTypes.default.func
|
|
267
274
|
};
|
|
268
|
-
|
|
275
|
+
var _default = exports.default = Mirror;
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _baseChart = _interopRequireDefault(require("./base-chart"));
|
|
12
|
+
var _customG = require("../custom-g2");
|
|
13
|
+
var _commonUtils = require("../utils/common-utils");
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
var _statisticChartModule = _interopRequireDefault(require("../assets/css/statistic-chart.module.css"));
|
|
9
16
|
const propTypes = {
|
|
10
|
-
isPreview:
|
|
11
|
-
colorThemeName:
|
|
12
|
-
statItem:
|
|
13
|
-
chartCalculator:
|
|
14
|
-
getTableById:
|
|
15
|
-
toggleStatisticRecordsDialog:
|
|
17
|
+
isPreview: _propTypes.default.bool,
|
|
18
|
+
colorThemeName: _propTypes.default.string,
|
|
19
|
+
statItem: _propTypes.default.object,
|
|
20
|
+
chartCalculator: _propTypes.default.object,
|
|
21
|
+
getTableById: _propTypes.default.func,
|
|
22
|
+
toggleStatisticRecordsDialog: _propTypes.default.func
|
|
16
23
|
};
|
|
17
|
-
class PieChart extends
|
|
24
|
+
class PieChart extends _baseChart.default {
|
|
18
25
|
constructor(props) {
|
|
19
26
|
super(props);
|
|
20
27
|
this.drawChart = data => {
|
|
@@ -22,13 +29,13 @@ class PieChart extends BaseChart {
|
|
|
22
29
|
isPreview
|
|
23
30
|
} = this.props;
|
|
24
31
|
if (isPreview) {
|
|
25
|
-
this.chart = new Chart({
|
|
32
|
+
this.chart = new _customG.Chart({
|
|
26
33
|
container: this.container,
|
|
27
34
|
autoFit: true,
|
|
28
35
|
padding: [20, 0]
|
|
29
36
|
});
|
|
30
37
|
} else {
|
|
31
|
-
this.chart = new Chart({
|
|
38
|
+
this.chart = new _customG.Chart({
|
|
32
39
|
container: this.container,
|
|
33
40
|
autoFit: true,
|
|
34
41
|
height: 400,
|
|
@@ -56,9 +63,9 @@ class PieChart extends BaseChart {
|
|
|
56
63
|
label_position
|
|
57
64
|
} = statItem;
|
|
58
65
|
const table = getTableById(table_id);
|
|
59
|
-
const currentTheme = getCurrentTheme(colorThemeName);
|
|
66
|
+
const currentTheme = (0, _commonUtils.getCurrentTheme)(colorThemeName);
|
|
60
67
|
const themeColors = this.getThemeColors();
|
|
61
|
-
const newData = formatPieChartData(data, statItem, table, currentTheme);
|
|
68
|
+
const newData = (0, _commonUtils.formatPieChartData)(data, statItem, table, currentTheme);
|
|
62
69
|
this.chart.data(newData, {
|
|
63
70
|
'name': {
|
|
64
71
|
type: 'cat',
|
|
@@ -83,7 +90,7 @@ class PieChart extends BaseChart {
|
|
|
83
90
|
const colorIndex = sIndex.charAt(sIndex.length - 1);
|
|
84
91
|
let name = obj.name;
|
|
85
92
|
if (!obj.name && typeof obj.name !== 'number') {
|
|
86
|
-
name =
|
|
93
|
+
name = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
|
|
87
94
|
}
|
|
88
95
|
return {
|
|
89
96
|
name,
|
|
@@ -113,7 +120,7 @@ class PieChart extends BaseChart {
|
|
|
113
120
|
content: this.getLabel(value, percent)
|
|
114
121
|
};
|
|
115
122
|
}, {
|
|
116
|
-
offset: !label_position || label_position === LABEL_POSITIONS[0] ? isCreating ? -10 : -2 : undefined,
|
|
123
|
+
offset: !label_position || label_position === _constants.LABEL_POSITIONS[0] ? isCreating ? -10 : -2 : undefined,
|
|
117
124
|
style: {
|
|
118
125
|
fill: themeColors.labelColor,
|
|
119
126
|
fontSize: this.getLabelFontSize(),
|
|
@@ -123,9 +130,9 @@ class PieChart extends BaseChart {
|
|
|
123
130
|
}).tooltip('name*formatted_value*percent', (name, value, percent) => {
|
|
124
131
|
let title = name;
|
|
125
132
|
if (!name || name === 'undefined') {
|
|
126
|
-
title =
|
|
133
|
+
title = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
|
|
127
134
|
} else if (name === 'Others') {
|
|
128
|
-
title =
|
|
135
|
+
title = _reactIntlUniversal.default.get('Others');
|
|
129
136
|
}
|
|
130
137
|
return show_percent || display_label ? {
|
|
131
138
|
name: title,
|
|
@@ -167,13 +174,13 @@ class PieChart extends BaseChart {
|
|
|
167
174
|
}
|
|
168
175
|
}
|
|
169
176
|
switch (label_format) {
|
|
170
|
-
case LABEL_FORMATS[0]:
|
|
177
|
+
case _constants.LABEL_FORMATS[0]:
|
|
171
178
|
content = percent;
|
|
172
179
|
break;
|
|
173
|
-
case LABEL_FORMATS[1]:
|
|
180
|
+
case _constants.LABEL_FORMATS[1]:
|
|
174
181
|
content = value;
|
|
175
182
|
break;
|
|
176
|
-
case LABEL_FORMATS[2]:
|
|
183
|
+
case _constants.LABEL_FORMATS[2]:
|
|
177
184
|
content = "".concat(value, " (").concat(percent, ")");
|
|
178
185
|
break;
|
|
179
186
|
default:
|
|
@@ -273,11 +280,11 @@ class PieChart extends BaseChart {
|
|
|
273
280
|
isCalculatingData,
|
|
274
281
|
showResultDescription
|
|
275
282
|
} = this.state;
|
|
276
|
-
return /*#__PURE__*/
|
|
283
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/_react.default.createElement("div", {
|
|
277
284
|
ref: ref => this.container = ref,
|
|
278
|
-
className: "".concat(
|
|
285
|
+
className: "".concat(_statisticChartModule.default['statistic-pie-chart-container'], " statistic-chart-container")
|
|
279
286
|
}));
|
|
280
287
|
}
|
|
281
288
|
}
|
|
282
289
|
PieChart.propTypes = propTypes;
|
|
283
|
-
|
|
290
|
+
var _default = exports.default = PieChart;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _dtableStore = require("dtable-store");
|
|
12
|
+
var _baseChart = _interopRequireDefault(require("../base-chart"));
|
|
13
|
+
var _oneDimensionTableNoNumericColumns = _interopRequireDefault(require("./one-dimension-table-no-numeric-columns"));
|
|
14
|
+
var _twoDimensionTable = _interopRequireDefault(require("./two-dimension-table"));
|
|
15
|
+
var _oneDimensionTableWithNumericColumns = _interopRequireDefault(require("./one-dimension-table-with-numeric-columns"));
|
|
16
|
+
var _constants = require("../../constants");
|
|
17
|
+
var _statisticPivotTableModule = _interopRequireDefault(require("./statistic-pivot-table.module.css"));
|
|
18
|
+
class PivotTable extends _baseChart.default {
|
|
12
19
|
constructor(props) {
|
|
13
20
|
super(props);
|
|
14
21
|
this.isValidValue = value => {
|
|
@@ -33,12 +40,12 @@ class PivotTable extends BaseChart {
|
|
|
33
40
|
} = statItem;
|
|
34
41
|
const themeColors = this.getThemeColors('#212529');
|
|
35
42
|
if (Array.isArray(pivot_columns) && pivot_columns.length > 100) {
|
|
36
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
44
|
className: 'statistic-chart-text'
|
|
38
|
-
},
|
|
45
|
+
}, _reactIntlUniversal.default.get(_constants.TOO_MANY_STATISTIC_ENTRIES));
|
|
39
46
|
}
|
|
40
47
|
if (column_groupby_column_key) {
|
|
41
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_twoDimensionTable.default, {
|
|
42
49
|
pivotResult: this.state.statData,
|
|
43
50
|
statItem: statItem,
|
|
44
51
|
isPreview: isPreview,
|
|
@@ -50,7 +57,7 @@ class PivotTable extends BaseChart {
|
|
|
50
57
|
});
|
|
51
58
|
}
|
|
52
59
|
if (pivot_columns.length < 2) {
|
|
53
|
-
return /*#__PURE__*/
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_oneDimensionTableNoNumericColumns.default, {
|
|
54
61
|
pivotResult: this.state.statData,
|
|
55
62
|
statItem: statItem,
|
|
56
63
|
isPreview: isPreview,
|
|
@@ -61,7 +68,7 @@ class PivotTable extends BaseChart {
|
|
|
61
68
|
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
62
69
|
});
|
|
63
70
|
}
|
|
64
|
-
return /*#__PURE__*/
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_oneDimensionTableWithNumericColumns.default, {
|
|
65
72
|
getSummaryValueDisplayString: this.getSummaryValueDisplayString,
|
|
66
73
|
pivotResult: this.state.statData,
|
|
67
74
|
statItem: statItem,
|
|
@@ -73,23 +80,23 @@ class PivotTable extends BaseChart {
|
|
|
73
80
|
});
|
|
74
81
|
};
|
|
75
82
|
this.getSummaryValueDisplayString = function (summaryColumn, summaryValue) {
|
|
76
|
-
let summaryMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SUMMARY_TYPE.COUNT;
|
|
83
|
+
let summaryMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.SUMMARY_TYPE.COUNT;
|
|
77
84
|
if (!summaryColumn || !summaryColumn.type) return summaryValue;
|
|
78
85
|
if (!summaryValue && summaryValue !== 0) return summaryValue;
|
|
79
86
|
if (summaryMethod && summaryMethod.toUpperCase() === 'DISTINCT_VALUES') return summaryValue;
|
|
80
87
|
const {
|
|
81
88
|
data
|
|
82
89
|
} = summaryColumn;
|
|
83
|
-
if (TIME_COLUMN_LIST.includes(summaryColumn.type)) {
|
|
90
|
+
if (_constants.TIME_COLUMN_LIST.includes(summaryColumn.type)) {
|
|
84
91
|
if (typeof summaryValue !== 'string') return '';
|
|
85
92
|
// The date returned by db carries T and Z, so that there is a time difference in data formatting
|
|
86
93
|
const {
|
|
87
94
|
format
|
|
88
95
|
} = data || {};
|
|
89
|
-
return getDateDisplayString(summaryValue.replace(/[T|Z]/g, ' '), format);
|
|
96
|
+
return (0, _dtableStore.getDateDisplayString)(summaryValue.replace(/[T|Z]/g, ' '), format);
|
|
90
97
|
}
|
|
91
98
|
if (typeof summaryValue !== 'number') return summaryValue;
|
|
92
|
-
return getNumberDisplayString(summaryValue, data || DEFAULT_NUMBER_FORMAT_OBJECT);
|
|
99
|
+
return (0, _dtableStore.getNumberDisplayString)(summaryValue, data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT);
|
|
93
100
|
};
|
|
94
101
|
this.getStatData = () => {
|
|
95
102
|
const {
|
|
@@ -103,9 +110,9 @@ class PivotTable extends BaseChart {
|
|
|
103
110
|
summary_column_key
|
|
104
111
|
} = statItem;
|
|
105
112
|
const table = getTableById(table_id);
|
|
106
|
-
const groupbyColumn = groupby_column_key && TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
107
|
-
const columnGroupbyColumn = column_groupby_column_key && TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
108
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
113
|
+
const groupbyColumn = groupby_column_key && _dtableStore.TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
114
|
+
const columnGroupbyColumn = column_groupby_column_key && _dtableStore.TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
115
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
109
116
|
return {
|
|
110
117
|
pivotResult: this.state.statData,
|
|
111
118
|
statisticTableColumns: table.columns,
|
|
@@ -169,21 +176,21 @@ class PivotTable extends BaseChart {
|
|
|
169
176
|
isCalculatingData,
|
|
170
177
|
showResultDescription
|
|
171
178
|
} = this.state;
|
|
172
|
-
return /*#__PURE__*/
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCalculatingData && this.renderLoading(), !isCalculatingData && /*#__PURE__*/_react.default.createElement("div", {
|
|
173
180
|
ref: ref => this.container = ref,
|
|
174
181
|
style: isEdit ? {
|
|
175
182
|
padding: '15px 30px'
|
|
176
183
|
} : null,
|
|
177
|
-
className: "statistic-chart-container ".concat(
|
|
184
|
+
className: "statistic-chart-container ".concat(_statisticPivotTableModule.default['pivot-table-container'])
|
|
178
185
|
}, this.renderPivotTable()), showResultDescription && this.renderEmpty());
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
188
|
PivotTable.propTypes = {
|
|
182
|
-
isPreview:
|
|
183
|
-
isEdit:
|
|
184
|
-
statItem:
|
|
185
|
-
chartCalculator:
|
|
186
|
-
getTableById:
|
|
187
|
-
toggleStatisticRecordsDialog:
|
|
189
|
+
isPreview: _propTypes.default.bool,
|
|
190
|
+
isEdit: _propTypes.default.bool,
|
|
191
|
+
statItem: _propTypes.default.object,
|
|
192
|
+
chartCalculator: _propTypes.default.object,
|
|
193
|
+
getTableById: _propTypes.default.func,
|
|
194
|
+
toggleStatisticRecordsDialog: _propTypes.default.func
|
|
188
195
|
};
|
|
189
|
-
|
|
196
|
+
var _default = exports.default = PivotTable;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _dtableStore = require("dtable-store");
|
|
12
|
+
var _pivotTableDisplayName = _interopRequireDefault(require("./pivot-table-display-name"));
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
var _statisticPivotTableModule = _interopRequireDefault(require("./statistic-pivot-table.module.css"));
|
|
16
|
+
class OneDimensionTableNoNumericColumns extends _react.PureComponent {
|
|
9
17
|
constructor() {
|
|
10
18
|
var _this;
|
|
11
19
|
super(...arguments);
|
|
@@ -15,7 +23,7 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
15
23
|
isColumn = false,
|
|
16
24
|
isRow = false
|
|
17
25
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18
|
-
if (isMobile) return;
|
|
26
|
+
if (_utils.isMobile) return;
|
|
19
27
|
_this.props.toggleStatisticRecordsDialog(cell, _this.props.statItem, {
|
|
20
28
|
isColumn,
|
|
21
29
|
isRow
|
|
@@ -25,7 +33,7 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
25
33
|
let {
|
|
26
34
|
isCurrentView
|
|
27
35
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28
|
-
if (isMobile) return;
|
|
36
|
+
if (_utils.isMobile) return;
|
|
29
37
|
const {
|
|
30
38
|
getTableById,
|
|
31
39
|
statItem
|
|
@@ -35,8 +43,8 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
35
43
|
view_id
|
|
36
44
|
} = statItem;
|
|
37
45
|
const table = getTableById(table_id);
|
|
38
|
-
const view = Views.getViewById(table.views, view_id);
|
|
39
|
-
const rows = !Views.isArchiveView(view) ? recordsList.flat() : [];
|
|
46
|
+
const view = _dtableStore.Views.getViewById(table.views, view_id);
|
|
47
|
+
const rows = !_dtableStore.Views.isArchiveView(view) ? recordsList.flat() : [];
|
|
40
48
|
_this.props.toggleStatisticRecordsDialog({
|
|
41
49
|
rows
|
|
42
50
|
}, _this.props.statItem, {
|
|
@@ -56,11 +64,11 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
56
64
|
const {
|
|
57
65
|
name: groupName
|
|
58
66
|
} = groupByColumn || {};
|
|
59
|
-
return /*#__PURE__*/
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", {
|
|
60
68
|
className: "pivot-table-header"
|
|
61
|
-
}, /*#__PURE__*/
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, groupName)), display_total && /*#__PURE__*/_react.default.createElement("th", {
|
|
62
70
|
className: 'pivot-table-header'
|
|
63
|
-
}, /*#__PURE__*/
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, _reactIntlUniversal.default.get(_constants.TITLE_TOTAL)))));
|
|
64
72
|
};
|
|
65
73
|
this.renderRows = _ref2 => {
|
|
66
74
|
let {
|
|
@@ -81,11 +89,11 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
81
89
|
summary_method,
|
|
82
90
|
display_total = true
|
|
83
91
|
} = statItem;
|
|
84
|
-
const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
92
|
+
const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column_key) || {};
|
|
85
93
|
const columnTotal = getSummaryValueDisplayString(summaryColumn, pivot_columns_total['total'], summary_method);
|
|
86
94
|
const isValidTColumnTotal = this.props.isValidValue(columnTotal);
|
|
87
95
|
let pivotColumnCells = [];
|
|
88
|
-
return /*#__PURE__*/
|
|
96
|
+
return /*#__PURE__*/_react.default.createElement("tbody", null, pivot_rows.map((rowItem, rowIdx) => {
|
|
89
97
|
const {
|
|
90
98
|
original_name,
|
|
91
99
|
total,
|
|
@@ -94,29 +102,29 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
94
102
|
const totalDisplayValue = getSummaryValueDisplayString(summaryColumn, total.total, summary_method);
|
|
95
103
|
const isValidTotalDisplayValue = this.props.isValidValue(totalDisplayValue);
|
|
96
104
|
pivotColumnCells[rowIdx] = rows;
|
|
97
|
-
return /*#__PURE__*/
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
98
106
|
key: 'table-row-' + rowIdx
|
|
99
|
-
}, /*#__PURE__*/
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement("td", {
|
|
100
108
|
className: 'pivot-row-name'
|
|
101
|
-
}, /*#__PURE__*/
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(_pivotTableDisplayName.default, {
|
|
102
110
|
value: original_name,
|
|
103
111
|
column: groupByColumn
|
|
104
|
-
})), display_total && /*#__PURE__*/
|
|
105
|
-
className: "".concat(
|
|
112
|
+
})), display_total && /*#__PURE__*/_react.default.createElement("td", {
|
|
113
|
+
className: "".concat(_statisticPivotTableModule.default['pivot-cell'], " ").concat(isValidTotalDisplayValue ? '' : _statisticPivotTableModule.default['pivot-empty-cell']),
|
|
106
114
|
title: isValidTotalDisplayValue ? totalDisplayValue : '',
|
|
107
115
|
onClick: () => this.toggleRecords(rowItem, {
|
|
108
116
|
isRow: true
|
|
109
117
|
})
|
|
110
|
-
}, isValidTotalDisplayValue ? /*#__PURE__*/
|
|
111
|
-
}), display_total && /*#__PURE__*/
|
|
118
|
+
}, isValidTotalDisplayValue ? /*#__PURE__*/_react.default.createElement("div", null, totalDisplayValue) : /*#__PURE__*/_react.default.createElement("i", null)));
|
|
119
|
+
}), display_total && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
|
|
112
120
|
className: 'pivot-column-total'
|
|
113
|
-
}, /*#__PURE__*/
|
|
114
|
-
className: "".concat(
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, _reactIntlUniversal.default.get(_constants.TITLE_TOTAL))), /*#__PURE__*/_react.default.createElement("td", {
|
|
122
|
+
className: "".concat(_statisticPivotTableModule.default['pivot-cell'], " pivot-table-total ").concat(isValidTColumnTotal ? '' : _statisticPivotTableModule.default['pivot-empty-cell']),
|
|
115
123
|
onClick: () => this.onClickTotals(pivotColumnCells, {
|
|
116
124
|
isCurrentView: true
|
|
117
125
|
}),
|
|
118
126
|
title: isValidTColumnTotal ? columnTotal : ''
|
|
119
|
-
}, isValidTColumnTotal ? /*#__PURE__*/
|
|
127
|
+
}, isValidTColumnTotal ? /*#__PURE__*/_react.default.createElement("div", null, columnTotal) : /*#__PURE__*/_react.default.createElement("i", null))));
|
|
120
128
|
};
|
|
121
129
|
}
|
|
122
130
|
render() {
|
|
@@ -131,12 +139,12 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
131
139
|
groupby_column_key
|
|
132
140
|
} = statItem;
|
|
133
141
|
const table = getTableById(table_id);
|
|
134
|
-
const groupByColumn = groupby_column_key && TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
135
|
-
return /*#__PURE__*/
|
|
142
|
+
const groupByColumn = groupby_column_key && _dtableStore.TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement("table", {
|
|
136
144
|
style: {
|
|
137
145
|
color: textColor
|
|
138
146
|
},
|
|
139
|
-
className: "".concat(isPreview ?
|
|
147
|
+
className: "".concat(isPreview ? _statisticPivotTableModule.default['preview-pivot-table'] : _statisticPivotTableModule.default['large-pivot-table'], " ").concat(_statisticPivotTableModule.default['pivot-table'])
|
|
140
148
|
}, this.renderHeader({
|
|
141
149
|
groupByColumn
|
|
142
150
|
}), this.renderRows({
|
|
@@ -145,4 +153,4 @@ class OneDimensionTableNoNumericColumns extends PureComponent {
|
|
|
145
153
|
}));
|
|
146
154
|
}
|
|
147
155
|
}
|
|
148
|
-
|
|
156
|
+
var _default = exports.default = OneDimensionTableNoNumericColumns;
|