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