dtable-statistic 4.2.2 → 4.3.1
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 +31 -37
- package/es/calculator/base-calculator.js +49 -99
- package/es/calculator/basic-chart-calculator.js +335 -559
- package/es/calculator/combination-calculator.js +231 -299
- package/es/calculator/compare-bar-calculator.js +184 -281
- package/es/calculator/completeness-calculator.js +203 -288
- package/es/calculator/copy-value.js +18 -18
- package/es/calculator/dashboard-calculator.js +68 -137
- package/es/calculator/heat-map-calculator.js +139 -220
- package/es/calculator/horizontal-bar-calculator.js +64 -93
- package/es/calculator/index.js +53 -69
- package/es/calculator/map-calculator.js +98 -174
- package/es/calculator/mirror-calculator.js +137 -216
- package/es/calculator/number-card-calculator.js +58 -126
- package/es/calculator/pivot-table-calculator.js +750 -792
- package/es/calculator/scatter-calculator.js +72 -140
- package/es/calculator/thread-manager.js +48 -67
- package/es/calculator/trend-calculator.js +107 -191
- package/es/calculator/workers/basic-chart-calculator-worker.js +194 -165
- package/es/calculator/workers/calculator.worker.js +22 -6
- package/es/calculator/workers/card-calculator-worker.js +16 -14
- package/es/calculator/workers/combination-calculator-worker.js +128 -135
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +80 -96
- package/es/calculator/workers/completeness-calculator-worker.js +56 -49
- package/es/calculator/workers/dashboard-calculator-worker.js +24 -22
- package/es/calculator/workers/mirror-calculator-worker.js +52 -52
- package/es/calculator/workers/pivot-table-calculator-worker.js +247 -230
- package/es/calculator/workers/scatter-calculator-worker.js +34 -32
- package/es/calculator/workers/trend-calculator-worker.js +33 -29
- package/es/calculator/world-map-calculator.js +120 -197
- package/es/components/common-add-tool.js +7 -5
- package/es/components/dialog/chart-addition-edit-dialog.js +67 -77
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +57 -67
- package/es/components/dialog/color-theme-dialog.js +34 -47
- package/es/components/dialog/delete-confirmation-dialog.js +7 -5
- package/es/components/dialog/enlarged-chart-dialog.js +68 -81
- package/es/components/dialog/new-table-dialog.js +62 -80
- package/es/components/dialog/new-view-dialog.js +50 -62
- package/es/components/dialog/rename-view-dialog.js +49 -58
- package/es/components/dialog/statistic-record-dialog/index.js +233 -231
- package/es/components/dialog/statistic-types-dialog/index.js +40 -49
- package/es/components/dialog/table-select-dialog.js +61 -70
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +129 -142
- package/es/components/dtable-popover.js +62 -81
- package/es/components/dtable-search-input.js +89 -99
- package/es/components/dtable-select.js +55 -74
- package/es/components/icon.js +5 -3
- package/es/components/loading.js +1 -1
- package/es/components/modal-portal.js +15 -32
- package/es/components/popover/color-rules/color-rule.js +137 -141
- package/es/components/popover/color-rules/index.js +58 -66
- package/es/components/popover/color-rules/rule-filters/filter.js +124 -124
- package/es/components/popover/color-rules/rule-filters/index.js +50 -58
- package/es/components/popover/color-rules/rule-filters/number-input.js +42 -57
- package/es/components/popover/color-rules-popover.js +117 -121
- package/es/components/popover/color-selector-popover.js +60 -70
- package/es/components/seatable-radio/index.js +2 -2
- package/es/components/select/option-group.js +139 -157
- package/es/components/select/option.js +26 -40
- package/es/components/select/select.js +97 -112
- package/es/components/toast/alert.js +65 -80
- package/es/components/toast/index.js +1 -1
- package/es/components/toast/toast.js +76 -103
- package/es/components/toast/toastManager.js +57 -93
- package/es/components/toast/toaster.js +58 -56
- package/es/constants/color-rules.js +8 -5
- package/es/constants/dtable-select-style.js +44 -48
- package/es/constants/event-types.js +4 -4
- package/es/constants/index.js +328 -242
- package/es/constants/map.js +2 -2
- package/es/constants/model.js +20 -20
- package/es/constants/regions.js +1 -1
- package/es/constants/zIndexes.js +1 -1
- package/es/custom-g2.js +11 -11
- package/es/dashboard.js +343 -333
- package/es/desktop-dashboard.js +217 -224
- package/es/index.js +45 -58
- package/es/locale/index.js +3 -3
- package/es/locale/lang/de.js +1 -1
- package/es/locale/lang/en.js +7 -7
- package/es/locale/lang/fr.js +1 -1
- package/es/locale/lang/zh_CN.js +1 -1
- package/es/mobile-dashboard.js +76 -89
- package/es/model/bar-group.js +34 -44
- package/es/model/bar.js +26 -36
- package/es/model/base-model.js +11 -12
- package/es/model/basic-number-card.js +10 -20
- package/es/model/collaborators.js +10 -11
- package/es/model/combination.js +32 -42
- package/es/model/compare-bar.js +30 -40
- package/es/model/completeness-group.js +19 -29
- package/es/model/completeness.js +14 -24
- package/es/model/custom-bar.js +14 -24
- package/es/model/dashboard.js +9 -19
- package/es/model/generic-model.js +187 -197
- package/es/model/heat-map.js +16 -26
- package/es/model/horizontal-bar-group.js +32 -42
- package/es/model/horizontal-bar.js +26 -36
- package/es/model/index.js +31 -3
- package/es/model/map.js +20 -30
- package/es/model/mirror.js +15 -25
- package/es/model/pie.js +21 -31
- package/es/model/ring.js +23 -33
- package/es/model/scatter.js +11 -21
- package/es/model/statistic-dashboard.js +7 -8
- package/es/model/table.js +19 -29
- package/es/model/trend.js +15 -25
- package/es/model/world-map.js +17 -27
- package/es/service/chart-service.js +69 -65
- package/es/service/dashboard-service.js +421 -419
- package/es/service/map-json.js +112 -132
- package/es/stat-editor/chart-name-editor.js +44 -58
- package/es/stat-editor/index.js +59 -70
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +93 -98
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +246 -248
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +127 -126
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +5 -3
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +78 -90
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +146 -150
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +88 -98
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +100 -118
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +161 -148
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +58 -66
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +58 -60
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +152 -148
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +101 -105
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +81 -91
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +110 -122
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +101 -113
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +130 -120
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +88 -102
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +88 -102
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +200 -194
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +98 -110
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +106 -118
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +212 -223
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +109 -119
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +329 -319
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +82 -90
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +58 -65
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +126 -116
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +201 -182
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +79 -79
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +196 -175
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +35 -50
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +180 -147
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +31 -40
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +56 -67
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +60 -69
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +165 -158
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +61 -74
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +199 -193
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +25 -38
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +79 -86
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +138 -120
- package/es/stat-editor/stat-settings/map/map-level.js +31 -43
- package/es/stat-editor/stat-settings/map/map-province-city.js +82 -83
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +48 -50
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +96 -96
- package/es/stat-editor/stat-settings/public-setting/calender.js +69 -75
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +5 -3
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +36 -41
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +37 -41
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +25 -38
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +40 -52
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +90 -93
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +23 -36
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +39 -44
- package/es/stat-list/chart-preview.js +85 -98
- package/es/stat-list/index.js +170 -178
- package/es/stat-view/area-chart.js +282 -274
- package/es/stat-view/bar-chart.js +300 -292
- package/es/stat-view/base-chart.js +58 -52
- package/es/stat-view/basic-number-card.js +115 -168
- package/es/stat-view/combination-chart.js +298 -334
- package/es/stat-view/compare-chart.js +256 -254
- package/es/stat-view/completeness-chart.js +194 -206
- package/es/stat-view/custom-bar.js +221 -223
- package/es/stat-view/dashboard-chart.js +122 -180
- package/es/stat-view/heat-map.js +268 -294
- package/es/stat-view/horizontal-bar-chart.js +291 -281
- package/es/stat-view/index.js +136 -152
- package/es/stat-view/line-chart.js +267 -265
- package/es/stat-view/map.js +246 -246
- package/es/stat-view/mirror.js +141 -152
- package/es/stat-view/pie-chart.js +143 -156
- package/es/stat-view/pivot-table/index.js +113 -118
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +104 -102
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +116 -118
- package/es/stat-view/pivot-table/pivot-table-display-name.js +96 -95
- package/es/stat-view/pivot-table/two-dimension-table.js +238 -229
- package/es/stat-view/ring-chart.js +189 -200
- package/es/stat-view/scatter-chart.js +162 -213
- package/es/stat-view/treemap-chart.js +136 -200
- package/es/stat-view/trend-chart.js +137 -183
- package/es/stat-view/world-map.js +233 -243
- package/es/tabs/index.js +164 -169
- package/es/tabs/tab.js +101 -116
- package/es/utils/basic-chart-utils.js +7 -9
- package/es/utils/cell-format.js +48 -51
- package/es/utils/cell-value.js +1 -1
- package/es/utils/collaborator.js +15 -14
- package/es/utils/color-utils.js +48 -37
- package/es/utils/column-utils.js +47 -33
- package/es/utils/column.js +1 -1
- package/es/utils/common-utils.js +111 -117
- package/es/utils/date-format.js +17 -17
- package/es/utils/export-table-utils.js +507 -396
- package/es/utils/index.js +6 -6
- package/es/utils/map.js +30 -34
- package/es/utils/model.js +3 -5
- package/es/utils/object.js +4 -4
- package/es/utils/pivot-table.js +20 -20
- package/es/utils/row-utils.js +41 -33
- package/es/utils/search.js +18 -20
- package/es/utils/sql-utils.js +132 -98
- package/es/utils/stat-utils.js +303 -320
- package/es/utils/trend-utils.js +57 -67
- package/package.json +2 -2
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
1
|
import React, { Component, Fragment } from 'react';
|
|
8
2
|
import intl from 'react-intl-universal';
|
|
9
3
|
import { isNumericColumn, TableUtils } from 'dtable-store';
|
|
@@ -14,12 +8,12 @@ import NumericSummaryItem from '../public-setting/numeric-summary-item';
|
|
|
14
8
|
import SummaryMethodSettings from './summary-method-setting';
|
|
15
9
|
import IndToggleSetting from '../public-setting/ind-toggle-setting';
|
|
16
10
|
import { GROUPBY_TYPE, STATISTICS_COUNT_SHOW, SUMMARY_METHOD, SUMMARY_METHOD_MAP, SUMMARY_TYPE, TIME_COLUMN_LIST } from '../../../constants';
|
|
17
|
-
|
|
11
|
+
const GROUP_TYPES = {
|
|
18
12
|
COUNT: 'count',
|
|
19
13
|
SINGLE_NUMERIC_COLUMN: 'single_numeric_column',
|
|
20
14
|
MULTIPLE_NUMERIC_COLUMN: 'multiple_numeric_column'
|
|
21
15
|
};
|
|
22
|
-
|
|
16
|
+
const GROUP_EXPLANATIONS = {
|
|
23
17
|
COUNT: {
|
|
24
18
|
name: STATISTICS_COUNT_SHOW['count'],
|
|
25
19
|
content: 'Count_the_number_of_records_in_each_group'
|
|
@@ -33,15 +27,11 @@ var GROUP_EXPLANATIONS = {
|
|
|
33
27
|
content: 'Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_multiple_fields'
|
|
34
28
|
}
|
|
35
29
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_classCallCheck(this, PivotSettings);
|
|
42
|
-
_this = _super.call(this, props);
|
|
43
|
-
_this.getSummaryMethodsOptions = function () {
|
|
44
|
-
return SUMMARY_METHOD.map(function (m) {
|
|
30
|
+
class PivotSettings extends Component {
|
|
31
|
+
constructor(props) {
|
|
32
|
+
super(props);
|
|
33
|
+
this.getSummaryMethodsOptions = () => {
|
|
34
|
+
return SUMMARY_METHOD.map(m => {
|
|
45
35
|
return {
|
|
46
36
|
value: m,
|
|
47
37
|
label: /*#__PURE__*/React.createElement("span", {
|
|
@@ -50,8 +40,8 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
50
40
|
};
|
|
51
41
|
});
|
|
52
42
|
};
|
|
53
|
-
|
|
54
|
-
return Object.keys(GROUP_TYPES).map(
|
|
43
|
+
this.getGroupTypeOptions = () => {
|
|
44
|
+
return Object.keys(GROUP_TYPES).map(key => {
|
|
55
45
|
return {
|
|
56
46
|
value: GROUP_TYPES[key],
|
|
57
47
|
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -62,8 +52,8 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
62
52
|
};
|
|
63
53
|
});
|
|
64
54
|
};
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
this.onSelectGroupbyColumn = (type, groupbyColumnKey, groupbyDateGranularity, groupbyGeolocationGranularity) => {
|
|
56
|
+
let updated;
|
|
67
57
|
if (type === GROUPBY_TYPE.ROW) {
|
|
68
58
|
updated = {
|
|
69
59
|
groupby_column_key: groupbyColumnKey,
|
|
@@ -77,12 +67,12 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
77
67
|
column_groupby_geolocation_granularity: groupbyGeolocationGranularity
|
|
78
68
|
};
|
|
79
69
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
70
|
+
const newStatItem = Object.assign({}, this.props.statItem, updated);
|
|
71
|
+
this.groupTypeOptions = this.getGroupTypeOptions(newStatItem);
|
|
72
|
+
this.props.updateStatItem(newStatItem);
|
|
83
73
|
};
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
this.onSelectGroupbyDateGranularity = (type, dateGranularity) => {
|
|
75
|
+
let updated;
|
|
86
76
|
if (type === GROUPBY_TYPE.ROW) {
|
|
87
77
|
updated = {
|
|
88
78
|
groupby_date_granularity: dateGranularity
|
|
@@ -92,10 +82,10 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
92
82
|
column_groupby_date_granularity: dateGranularity
|
|
93
83
|
};
|
|
94
84
|
}
|
|
95
|
-
|
|
85
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, updated));
|
|
96
86
|
};
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
this.onSelectGroupbyGeolocationGranularity = (type, geolocationGranularity) => {
|
|
88
|
+
let updated;
|
|
99
89
|
if (type === GROUPBY_TYPE.ROW) {
|
|
100
90
|
updated = {
|
|
101
91
|
groupby_geolocation_granularity: geolocationGranularity
|
|
@@ -105,41 +95,45 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
105
95
|
column_groupby_geolocation_granularity: geolocationGranularity
|
|
106
96
|
};
|
|
107
97
|
}
|
|
108
|
-
|
|
98
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, updated));
|
|
109
99
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
100
|
+
this.updatedSummaryType = (summaryType, summaryColumnKey, summaryMethod) => {
|
|
101
|
+
let {
|
|
102
|
+
statItem
|
|
103
|
+
} = this.props;
|
|
104
|
+
let updated = {
|
|
113
105
|
summary_type: summaryType,
|
|
114
106
|
summary_column_key: summaryColumnKey,
|
|
115
107
|
summary_method: summaryMethod
|
|
116
108
|
};
|
|
117
|
-
|
|
109
|
+
this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
118
110
|
};
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
this.updateSummaryColumn = summaryColumnKey => {
|
|
112
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
121
113
|
summary_column_key: summaryColumnKey
|
|
122
114
|
}));
|
|
123
115
|
};
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
this.updateSummaryMethod = summaryMethod => {
|
|
117
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
126
118
|
summary_method: summaryMethod
|
|
127
119
|
}));
|
|
128
120
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
statItem
|
|
133
|
-
pivotTableSummaryColumnOptions
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
121
|
+
this.onChangeGroupType = option => {
|
|
122
|
+
const value = option.value;
|
|
123
|
+
const {
|
|
124
|
+
statItem,
|
|
125
|
+
pivotTableSummaryColumnOptions
|
|
126
|
+
} = this.props;
|
|
127
|
+
let {
|
|
128
|
+
column_groupby_column_key,
|
|
129
|
+
column_groupby_date_granularity,
|
|
130
|
+
column_groupby_geolocation_granularity,
|
|
131
|
+
column_groupby_multiple_numeric_column,
|
|
132
|
+
summary_columns_option,
|
|
133
|
+
summary_type,
|
|
134
|
+
summary_method,
|
|
135
|
+
summary_column_key
|
|
136
|
+
} = this.props.statItem || {};
|
|
143
137
|
if (value === GROUP_TYPES.SINGLE_NUMERIC_COLUMN) {
|
|
144
138
|
summary_type = SUMMARY_TYPE.ADVANCED;
|
|
145
139
|
column_groupby_multiple_numeric_column = false;
|
|
@@ -157,191 +151,205 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
157
151
|
column_groupby_multiple_numeric_column = true;
|
|
158
152
|
if (column_groupby_column_key) {
|
|
159
153
|
summary_columns_option = [{
|
|
160
|
-
key:
|
|
154
|
+
key: this.getNumericalColumnOptions()[0].value.key,
|
|
161
155
|
method: SUMMARY_METHOD[0],
|
|
162
|
-
type:
|
|
156
|
+
type: this.getNumericalColumnOptions()[0].value.type
|
|
163
157
|
}];
|
|
164
158
|
} else {
|
|
165
|
-
|
|
159
|
+
const pivotTableSummaryColumnOption = pivotTableSummaryColumnOptions[0];
|
|
166
160
|
summary_columns_option = [];
|
|
167
161
|
summary_column_key = pivotTableSummaryColumnOption && pivotTableSummaryColumnOption.value.key;
|
|
168
162
|
summary_method = SUMMARY_METHOD[1];
|
|
169
163
|
}
|
|
170
164
|
}
|
|
171
|
-
|
|
172
|
-
column_groupby_column_key
|
|
173
|
-
column_groupby_date_granularity
|
|
174
|
-
column_groupby_geolocation_granularity
|
|
175
|
-
column_groupby_multiple_numeric_column
|
|
176
|
-
summary_columns_option
|
|
177
|
-
summary_type
|
|
178
|
-
summary_method
|
|
179
|
-
summary_column_key
|
|
165
|
+
let updated = {
|
|
166
|
+
column_groupby_column_key,
|
|
167
|
+
column_groupby_date_granularity,
|
|
168
|
+
column_groupby_geolocation_granularity,
|
|
169
|
+
column_groupby_multiple_numeric_column,
|
|
170
|
+
summary_columns_option,
|
|
171
|
+
summary_type,
|
|
172
|
+
summary_method,
|
|
173
|
+
summary_column_key
|
|
180
174
|
};
|
|
181
|
-
|
|
175
|
+
this.setState({
|
|
182
176
|
columnGroupbyType: value
|
|
183
|
-
},
|
|
184
|
-
|
|
177
|
+
}, () => {
|
|
178
|
+
this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
185
179
|
});
|
|
186
180
|
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
this.getSelectedGroupType = () => {
|
|
182
|
+
const {
|
|
183
|
+
statItem
|
|
184
|
+
} = this.props;
|
|
185
|
+
const {
|
|
186
|
+
column_groupby_multiple_numeric_column,
|
|
187
|
+
summary_type,
|
|
188
|
+
column_groupby_column_key
|
|
189
|
+
} = statItem;
|
|
192
190
|
if (summary_type === SUMMARY_TYPE.ADVANCED && column_groupby_column_key && !column_groupby_multiple_numeric_column) {
|
|
193
|
-
return
|
|
191
|
+
return this.groupTypeOptions[1];
|
|
194
192
|
}
|
|
195
193
|
if (column_groupby_multiple_numeric_column) {
|
|
196
|
-
return
|
|
197
|
-
return item.value === GROUP_TYPES.MULTIPLE_NUMERIC_COLUMN;
|
|
198
|
-
});
|
|
194
|
+
return this.groupTypeOptions.find(item => item.value === GROUP_TYPES.MULTIPLE_NUMERIC_COLUMN);
|
|
199
195
|
}
|
|
200
196
|
if (summary_type === SUMMARY_TYPE.COUNT) {
|
|
201
|
-
return
|
|
197
|
+
return this.groupTypeOptions[0];
|
|
202
198
|
}
|
|
203
199
|
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
204
|
-
return
|
|
200
|
+
return this.groupTypeOptions[1];
|
|
205
201
|
}
|
|
206
202
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
getTableById
|
|
210
|
-
pivotTableSummaryColumnOptions
|
|
211
|
-
statItem
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
203
|
+
this.getNumericalColumnOptions = () => {
|
|
204
|
+
const {
|
|
205
|
+
getTableById,
|
|
206
|
+
pivotTableSummaryColumnOptions,
|
|
207
|
+
statItem
|
|
208
|
+
} = this.props || {};
|
|
209
|
+
const {
|
|
210
|
+
table_id
|
|
211
|
+
} = statItem || {};
|
|
212
|
+
const table = getTableById(table_id);
|
|
215
213
|
if (!table) return [];
|
|
216
|
-
|
|
217
|
-
pivotTableSummaryColumnOptions.forEach(
|
|
218
|
-
|
|
214
|
+
const newPivotTableSummaryColumnOptions = [];
|
|
215
|
+
pivotTableSummaryColumnOptions.forEach(item => {
|
|
216
|
+
const column = TableUtils.getTableColumnByKey(table, item.value.key) || {};
|
|
219
217
|
if (isNumericColumn(column)) {
|
|
220
218
|
newPivotTableSummaryColumnOptions.push(item);
|
|
221
219
|
}
|
|
222
220
|
});
|
|
223
221
|
return newPivotTableSummaryColumnOptions;
|
|
224
222
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
pivotTableSummaryColumnOptions
|
|
228
|
-
|
|
223
|
+
this.canAddSummaryColumn = () => {
|
|
224
|
+
const {
|
|
225
|
+
pivotTableSummaryColumnOptions,
|
|
226
|
+
statItem: {
|
|
227
|
+
column_groupby_column_key
|
|
228
|
+
}
|
|
229
|
+
} = this.props;
|
|
229
230
|
if (column_groupby_column_key) {
|
|
230
|
-
|
|
231
|
+
const numericalColumnOptions = this.getNumericalColumnOptions();
|
|
231
232
|
return Array.isArray(numericalColumnOptions) && numericalColumnOptions.length > 0;
|
|
232
233
|
} else {
|
|
233
234
|
return Array.isArray(pivotTableSummaryColumnOptions) && pivotTableSummaryColumnOptions.length > 0;
|
|
234
235
|
}
|
|
235
236
|
};
|
|
236
|
-
|
|
237
|
+
this.onChangeGroupbyNumericColumn = (index, columnOption) => {
|
|
237
238
|
if (index === 0) {
|
|
238
|
-
|
|
239
|
+
const updated = {
|
|
239
240
|
summary_column_key: columnOption.value.key
|
|
240
241
|
};
|
|
241
242
|
if (TIME_COLUMN_LIST.includes(columnOption.value.type)) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
const {
|
|
244
|
+
statItem
|
|
245
|
+
} = this.props;
|
|
246
|
+
const {
|
|
247
|
+
summary_method
|
|
248
|
+
} = statItem || {};
|
|
245
249
|
if (summary_method == SUMMARY_METHOD_MAP.Sum || summary_method === SUMMARY_METHOD_MAP.Mean) {
|
|
246
250
|
updated.summary_method = SUMMARY_METHOD_MAP.Min;
|
|
247
251
|
}
|
|
248
252
|
}
|
|
249
|
-
|
|
253
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, updated));
|
|
250
254
|
} else {
|
|
251
|
-
|
|
252
|
-
summary_columns_option
|
|
255
|
+
let {
|
|
256
|
+
summary_columns_option
|
|
257
|
+
} = this.props.statItem || {};
|
|
253
258
|
summary_columns_option = summary_columns_option || [];
|
|
254
|
-
summary_columns_option =
|
|
255
|
-
|
|
256
|
-
|
|
259
|
+
summary_columns_option = [...summary_columns_option];
|
|
260
|
+
let selectedItem = summary_columns_option[index - 1];
|
|
261
|
+
const updated = {
|
|
257
262
|
key: columnOption.value.key
|
|
258
263
|
};
|
|
259
264
|
if (TIME_COLUMN_LIST.includes(columnOption.value.type)) {
|
|
260
265
|
if (selectedItem.method === SUMMARY_METHOD_MAP.Sum || selectedItem.method === SUMMARY_METHOD_MAP.Mean) {
|
|
261
|
-
|
|
266
|
+
updated.method = SUMMARY_METHOD_MAP.Min;
|
|
262
267
|
}
|
|
263
268
|
}
|
|
264
|
-
selectedItem = Object.assign({}, selectedItem,
|
|
269
|
+
selectedItem = Object.assign({}, selectedItem, updated);
|
|
265
270
|
summary_columns_option[index - 1] = selectedItem;
|
|
266
|
-
|
|
267
|
-
summary_columns_option
|
|
271
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
272
|
+
summary_columns_option
|
|
268
273
|
}));
|
|
269
274
|
}
|
|
270
275
|
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
column_groupby_multiple_numeric_column
|
|
274
|
-
column_groupby_column_key
|
|
275
|
-
summary_columns_option
|
|
276
|
+
this.onChangeGroupbyMultiNumericColumn = (index, columnOption) => {
|
|
277
|
+
let {
|
|
278
|
+
column_groupby_multiple_numeric_column,
|
|
279
|
+
column_groupby_column_key,
|
|
280
|
+
summary_columns_option
|
|
281
|
+
} = this.props.statItem || {};
|
|
276
282
|
if (column_groupby_multiple_numeric_column && column_groupby_column_key) {
|
|
277
|
-
|
|
278
|
-
|
|
283
|
+
const summaryColumnOption = summary_columns_option[index];
|
|
284
|
+
const update = {
|
|
279
285
|
key: columnOption.value.key,
|
|
280
286
|
method: summaryColumnOption && summaryColumnOption.method || SUMMARY_METHOD_MAP.Sum
|
|
281
287
|
};
|
|
282
288
|
summary_columns_option = summary_columns_option || [];
|
|
283
|
-
summary_columns_option =
|
|
289
|
+
summary_columns_option = [...summary_columns_option];
|
|
284
290
|
summary_columns_option[index] = update;
|
|
285
|
-
|
|
286
|
-
summary_columns_option
|
|
291
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
292
|
+
summary_columns_option
|
|
287
293
|
}));
|
|
288
294
|
return;
|
|
289
295
|
}
|
|
290
296
|
};
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
summary_columns_option = summary_columns_option.filter(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
301
|
-
summary_columns_option: _toConsumableArray(summary_columns_option)
|
|
297
|
+
this.onDeleteNumericColumnItem = index => {
|
|
298
|
+
let {
|
|
299
|
+
summary_columns_option = [],
|
|
300
|
+
column_groupby_column_key
|
|
301
|
+
} = this.props.statItem || {};
|
|
302
|
+
const deleteIndex = column_groupby_column_key ? index : index - 1;
|
|
303
|
+
summary_columns_option = summary_columns_option.filter((_, index) => index !== deleteIndex);
|
|
304
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
305
|
+
summary_columns_option: [...summary_columns_option]
|
|
302
306
|
}));
|
|
303
307
|
};
|
|
304
|
-
|
|
308
|
+
this.onChangeSummaryMethod = (index, option) => {
|
|
305
309
|
if (index === 0) {
|
|
306
|
-
|
|
310
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
307
311
|
summary_method: option.value
|
|
308
312
|
}));
|
|
309
313
|
} else {
|
|
310
|
-
|
|
311
|
-
summary_columns_option
|
|
314
|
+
let {
|
|
315
|
+
summary_columns_option
|
|
316
|
+
} = this.props.statItem || {};
|
|
312
317
|
summary_columns_option = summary_columns_option || [];
|
|
313
|
-
summary_columns_option =
|
|
314
|
-
|
|
318
|
+
summary_columns_option = [...summary_columns_option];
|
|
319
|
+
let selectedItem = summary_columns_option[index - 1];
|
|
315
320
|
selectedItem = Object.assign({}, selectedItem, {
|
|
316
321
|
method: option.value
|
|
317
322
|
});
|
|
318
323
|
summary_columns_option[index - 1] = selectedItem;
|
|
319
|
-
|
|
320
|
-
summary_columns_option
|
|
324
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
325
|
+
summary_columns_option
|
|
321
326
|
}));
|
|
322
327
|
}
|
|
323
328
|
};
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
summary_columns_option
|
|
327
|
-
|
|
329
|
+
this.onChangeMultiSummaryMethod = (index, option) => {
|
|
330
|
+
let {
|
|
331
|
+
summary_columns_option
|
|
332
|
+
} = this.props.statItem || {};
|
|
333
|
+
summary_columns_option = Array.isArray(summary_columns_option) ? [...summary_columns_option] : [];
|
|
328
334
|
summary_columns_option[index] = Object.assign({}, summary_columns_option[index], {
|
|
329
335
|
method: option.value
|
|
330
336
|
});
|
|
331
|
-
|
|
332
|
-
summary_columns_option
|
|
337
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
338
|
+
summary_columns_option
|
|
333
339
|
}));
|
|
334
340
|
};
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
statItem
|
|
338
|
-
pivotTableSummaryColumnOptions
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
this.onAddNumericColumn = () => {
|
|
342
|
+
let {
|
|
343
|
+
statItem,
|
|
344
|
+
pivotTableSummaryColumnOptions
|
|
345
|
+
} = this.props;
|
|
346
|
+
let {
|
|
347
|
+
summary_columns_option,
|
|
348
|
+
column_groupby_column_key
|
|
349
|
+
} = statItem || {};
|
|
350
|
+
let newNumericColumnKey = column_groupby_column_key ? this.getNumericalColumnOptions()[0].value.key : pivotTableSummaryColumnOptions[0].value.key;
|
|
343
351
|
if (Array.isArray(summary_columns_option)) {
|
|
344
|
-
summary_columns_option =
|
|
352
|
+
summary_columns_option = [...summary_columns_option];
|
|
345
353
|
summary_columns_option.push({
|
|
346
354
|
key: newNumericColumnKey,
|
|
347
355
|
method: SUMMARY_METHOD[0]
|
|
@@ -352,195 +360,197 @@ var PivotSettings = /*#__PURE__*/function (_Component) {
|
|
|
352
360
|
method: SUMMARY_METHOD[0]
|
|
353
361
|
}];
|
|
354
362
|
}
|
|
355
|
-
|
|
356
|
-
summary_columns_option:
|
|
363
|
+
this.props.updateStatItem(Object.assign({}, this.props.statItem, {
|
|
364
|
+
summary_columns_option: [...summary_columns_option]
|
|
357
365
|
}));
|
|
358
366
|
};
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
367
|
+
this.onToggleDisplayData = () => {
|
|
368
|
+
const {
|
|
369
|
+
statItem
|
|
370
|
+
} = this.props;
|
|
371
|
+
const {
|
|
372
|
+
display_total
|
|
373
|
+
} = statItem || {};
|
|
374
|
+
const updated = {
|
|
364
375
|
display_total: !display_total
|
|
365
376
|
};
|
|
366
|
-
|
|
377
|
+
this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
367
378
|
};
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
379
|
+
this.renderGroupbyNumericColumns = () => {
|
|
380
|
+
const {
|
|
381
|
+
statItem
|
|
382
|
+
} = this.props;
|
|
383
|
+
const {
|
|
384
|
+
summary_columns_option,
|
|
385
|
+
column_groupby_column_key
|
|
386
|
+
} = statItem;
|
|
372
387
|
if (!Array.isArray(summary_columns_option)) return null;
|
|
373
388
|
if (column_groupby_column_key) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
return restSummaryColumnsOption.map(function (item, index) {
|
|
389
|
+
const [, ...restSummaryColumnsOption] = summary_columns_option;
|
|
390
|
+
return restSummaryColumnsOption.map((item, index) => {
|
|
377
391
|
return /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
378
392
|
key: "number-column-".concat(index),
|
|
379
393
|
statItem: statItem,
|
|
380
394
|
index: index + 1,
|
|
381
395
|
numericColumnItem: item,
|
|
382
|
-
numericColumnsOptions:
|
|
383
|
-
summaryMethodOptions:
|
|
384
|
-
onChangeColumnOption:
|
|
385
|
-
onChangeSummaryMethod:
|
|
386
|
-
onDeleteNumericColumnItem:
|
|
396
|
+
numericColumnsOptions: this.getNumericalColumnOptions(),
|
|
397
|
+
summaryMethodOptions: this.summaryMethodsOptions,
|
|
398
|
+
onChangeColumnOption: this.onChangeGroupbyMultiNumericColumn,
|
|
399
|
+
onChangeSummaryMethod: this.onChangeMultiSummaryMethod,
|
|
400
|
+
onDeleteNumericColumnItem: this.onDeleteNumericColumnItem
|
|
387
401
|
});
|
|
388
402
|
});
|
|
389
403
|
}
|
|
390
|
-
return summary_columns_option.map(
|
|
404
|
+
return summary_columns_option.map((item, index) => {
|
|
391
405
|
return /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
392
406
|
key: "number-column-".concat(index),
|
|
393
407
|
statItem: statItem,
|
|
394
|
-
numericColumnsOptions:
|
|
395
|
-
summaryMethodOptions:
|
|
408
|
+
numericColumnsOptions: this.props.pivotTableSummaryColumnOptions,
|
|
409
|
+
summaryMethodOptions: this.summaryMethodsOptions,
|
|
396
410
|
index: index + 1,
|
|
397
411
|
numericColumnItem: item,
|
|
398
|
-
onChangeColumnOption:
|
|
399
|
-
onChangeSummaryMethod:
|
|
400
|
-
onDeleteNumericColumnItem:
|
|
412
|
+
onChangeColumnOption: this.onChangeGroupbyNumericColumn,
|
|
413
|
+
onChangeSummaryMethod: this.onChangeSummaryMethod,
|
|
414
|
+
onDeleteNumericColumnItem: this.onDeleteNumericColumnItem
|
|
401
415
|
});
|
|
402
416
|
});
|
|
403
417
|
};
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
return _this;
|
|
418
|
+
this.groupTypeOptions = this.getGroupTypeOptions(props.statItem);
|
|
419
|
+
this.summaryMethodsOptions = this.getSummaryMethodsOptions();
|
|
407
420
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return null;
|
|
439
|
-
}
|
|
440
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
|
|
441
|
-
statItem: statItem,
|
|
442
|
-
selectedTableId: selectedTableId,
|
|
443
|
-
selectedViewId: selectedViewId,
|
|
444
|
-
getTables: this.props.getTables,
|
|
445
|
-
getViews: this.props.getViews,
|
|
446
|
-
getTableById: this.props.getTableById,
|
|
447
|
-
getConvertedChart: this.props.getConvertedChart,
|
|
448
|
-
updateStatItem: this.props.updateStatItem
|
|
449
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
450
|
-
className: "statistic-chart-parameter-divider"
|
|
451
|
-
}), /*#__PURE__*/React.createElement(GroupbySettings, {
|
|
452
|
-
selectedTable: selectedTable,
|
|
453
|
-
columnsOptions: generalColumnsOptions,
|
|
454
|
-
dateGranularityOptions: dateGranularityOptions,
|
|
455
|
-
geolocationGranularityOptions: geolocationGranularityOptions,
|
|
456
|
-
label: intl.get('Row_grouping_field'),
|
|
457
|
-
placeholder: intl.get('Select_a_column'),
|
|
458
|
-
groupbyColumnKey: groupby_column_key,
|
|
459
|
-
groupbyDateGranularity: groupby_date_granularity,
|
|
460
|
-
groupbyGeolocationGranularity: groupby_geolocation_granularity,
|
|
461
|
-
getSelectedColumnOption: this.props.getSelectedColumnOption,
|
|
462
|
-
onSelectGroupbyColumn: this.onSelectGroupbyColumn.bind(this, GROUPBY_TYPE.ROW),
|
|
463
|
-
onSelectGroupbyDateGranularity: this.onSelectGroupbyDateGranularity.bind(this, GROUPBY_TYPE.ROW),
|
|
464
|
-
onSelectGroupbyGeolocationGranularity: this.onSelectGroupbyGeolocationGranularity.bind(this, GROUPBY_TYPE.ROW),
|
|
465
|
-
renderIncludeEmpty: renderIncludeEmpty
|
|
466
|
-
}), /*#__PURE__*/React.createElement(GroupbySettings, {
|
|
467
|
-
selectedTable: selectedTable,
|
|
468
|
-
columnsOptions: generalColumnsOptions,
|
|
469
|
-
dateGranularityOptions: dateGranularityOptions,
|
|
470
|
-
geolocationGranularityOptions: geolocationGranularityOptions,
|
|
471
|
-
label: intl.get('Column_grouping_field'),
|
|
472
|
-
placeholder: intl.get('Select_a_column'),
|
|
473
|
-
groupbyColumnKey: column_groupby_column_key,
|
|
474
|
-
groupbyDateGranularity: column_groupby_date_granularity,
|
|
475
|
-
groupbyGeolocationGranularity: column_groupby_geolocation_granularity,
|
|
476
|
-
getSelectedColumnOption: this.props.getSelectedColumnOption,
|
|
477
|
-
onSelectGroupbyColumn: this.onSelectGroupbyColumn.bind(this, GROUPBY_TYPE.COLUMN),
|
|
478
|
-
onSelectGroupbyDateGranularity: this.onSelectGroupbyDateGranularity.bind(this, GROUPBY_TYPE.COLUMN),
|
|
479
|
-
onSelectGroupbyGeolocationGranularity: this.onSelectGroupbyGeolocationGranularity.bind(this, GROUPBY_TYPE.COLUMN)
|
|
480
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
481
|
-
className: "statistic-chart-parameter-divider"
|
|
482
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
483
|
-
className: "statistic-chart-parameter-item"
|
|
484
|
-
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_type')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
485
|
-
classNamePrefix: "statistic-chart-summary-types",
|
|
486
|
-
value: selectedGroupItem,
|
|
487
|
-
options: this.groupTypeOptions,
|
|
488
|
-
onChange: this.onChangeGroupType
|
|
489
|
-
})), summary_type === SUMMARY_TYPE.ADVANCED && (column_groupby_multiple_numeric_column ? /*#__PURE__*/React.createElement(React.Fragment, null, column_groupby_column_key && /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
490
|
-
statItem: statItem,
|
|
491
|
-
key: "number-column-".concat(0),
|
|
492
|
-
index: 0,
|
|
493
|
-
numericColumnItem: {
|
|
494
|
-
column_key: summary_columns_option[0] && summary_columns_option[0].key,
|
|
495
|
-
summary_method: summary_columns_option[0] && summary_columns_option[0].method
|
|
496
|
-
},
|
|
497
|
-
numericColumnsOptions: this.getNumericalColumnOptions(),
|
|
498
|
-
summaryMethodOptions: this.summaryMethodsOptions,
|
|
499
|
-
onChangeColumnOption: this.onChangeGroupbyMultiNumericColumn,
|
|
500
|
-
onChangeSummaryMethod: this.onChangeMultiSummaryMethod
|
|
501
|
-
}), !column_groupby_column_key && /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
502
|
-
statItem: statItem,
|
|
503
|
-
key: "number-column-".concat(0),
|
|
504
|
-
index: 0,
|
|
505
|
-
numericColumnItem: {
|
|
506
|
-
column_key: summary_column_key,
|
|
507
|
-
summary_method: summary_method
|
|
508
|
-
},
|
|
509
|
-
numericColumnsOptions: pivotTableSummaryColumnOptions,
|
|
510
|
-
summaryMethodOptions: this.summaryMethodsOptions,
|
|
511
|
-
onChangeColumnOption: this.onChangeGroupbyNumericColumn,
|
|
512
|
-
onChangeSummaryMethod: this.onChangeSummaryMethod
|
|
513
|
-
})) : /*#__PURE__*/React.createElement(SummaryMethodSettings, {
|
|
514
|
-
statItem: statItem,
|
|
515
|
-
numericColumnsOptions: pivotTableSummaryColumnOptions,
|
|
516
|
-
summaryType: summary_type,
|
|
517
|
-
summaryColumnKey: summary_column_key,
|
|
518
|
-
summaryMethod: summary_method,
|
|
519
|
-
getSelectedColumnOption: this.props.getSelectedColumnOption,
|
|
520
|
-
onChangeSummaryType: this.updatedSummaryType,
|
|
521
|
-
onSelectSummaryMethod: this.updateSummaryMethod,
|
|
522
|
-
onSelectNumericColumn: this.updateSummaryColumn,
|
|
523
|
-
updateStatItem: this.props.updateStatItem
|
|
524
|
-
})), column_groupby_multiple_numeric_column && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
525
|
-
className: "statistics-add-number"
|
|
526
|
-
}, this.renderGroupbyNumericColumns()), this.canAddSummaryColumn() && /*#__PURE__*/React.createElement("div", {
|
|
527
|
-
className: "statistics-add-number-column",
|
|
528
|
-
onClick: this.onAddNumericColumn
|
|
529
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
530
|
-
className: "number-column-item dtable-font dtable-icon-add-table"
|
|
531
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
532
|
-
className: "number-column-item add-number-column-description"
|
|
533
|
-
}, intl.get('Add_new_summary_column')))), /*#__PURE__*/React.createElement("div", {
|
|
534
|
-
className: "statistic-chart-parameter-divider"
|
|
535
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
536
|
-
className: "statistic-chart-parameter-item"
|
|
537
|
-
}, /*#__PURE__*/React.createElement(IndToggleSetting, {
|
|
538
|
-
isChecked: display_total,
|
|
539
|
-
handleToggleChange: this.onToggleDisplayData,
|
|
540
|
-
label: intl.get('Display_total')
|
|
541
|
-
})));
|
|
421
|
+
render() {
|
|
422
|
+
let {
|
|
423
|
+
settingType,
|
|
424
|
+
statItem,
|
|
425
|
+
selectedTable,
|
|
426
|
+
generalColumnsOptions,
|
|
427
|
+
pivotTableSummaryColumnOptions,
|
|
428
|
+
dateGranularityOptions,
|
|
429
|
+
geolocationGranularityOptions,
|
|
430
|
+
renderIncludeEmpty
|
|
431
|
+
} = this.props;
|
|
432
|
+
let {
|
|
433
|
+
table_id: selectedTableId,
|
|
434
|
+
view_id: selectedViewId,
|
|
435
|
+
groupby_column_key,
|
|
436
|
+
groupby_date_granularity,
|
|
437
|
+
groupby_geolocation_granularity,
|
|
438
|
+
summary_type,
|
|
439
|
+
summary_column_key,
|
|
440
|
+
summary_method,
|
|
441
|
+
column_groupby_column_key,
|
|
442
|
+
column_groupby_date_granularity,
|
|
443
|
+
column_groupby_geolocation_granularity,
|
|
444
|
+
column_groupby_multiple_numeric_column,
|
|
445
|
+
display_total = true,
|
|
446
|
+
summary_columns_option
|
|
447
|
+
} = statItem || {};
|
|
448
|
+
const selectedGroupItem = this.getSelectedGroupType();
|
|
449
|
+
if (settingType === 'style') {
|
|
450
|
+
return null;
|
|
542
451
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
452
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
|
|
453
|
+
statItem: statItem,
|
|
454
|
+
selectedTableId: selectedTableId,
|
|
455
|
+
selectedViewId: selectedViewId,
|
|
456
|
+
getTables: this.props.getTables,
|
|
457
|
+
getViews: this.props.getViews,
|
|
458
|
+
getTableById: this.props.getTableById,
|
|
459
|
+
getConvertedChart: this.props.getConvertedChart,
|
|
460
|
+
updateStatItem: this.props.updateStatItem
|
|
461
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
462
|
+
className: "statistic-chart-parameter-divider"
|
|
463
|
+
}), /*#__PURE__*/React.createElement(GroupbySettings, {
|
|
464
|
+
selectedTable: selectedTable,
|
|
465
|
+
columnsOptions: generalColumnsOptions,
|
|
466
|
+
dateGranularityOptions: dateGranularityOptions,
|
|
467
|
+
geolocationGranularityOptions: geolocationGranularityOptions,
|
|
468
|
+
label: intl.get('Row_grouping_field'),
|
|
469
|
+
placeholder: intl.get('Select_a_column'),
|
|
470
|
+
groupbyColumnKey: groupby_column_key,
|
|
471
|
+
groupbyDateGranularity: groupby_date_granularity,
|
|
472
|
+
groupbyGeolocationGranularity: groupby_geolocation_granularity,
|
|
473
|
+
getSelectedColumnOption: this.props.getSelectedColumnOption,
|
|
474
|
+
onSelectGroupbyColumn: this.onSelectGroupbyColumn.bind(this, GROUPBY_TYPE.ROW),
|
|
475
|
+
onSelectGroupbyDateGranularity: this.onSelectGroupbyDateGranularity.bind(this, GROUPBY_TYPE.ROW),
|
|
476
|
+
onSelectGroupbyGeolocationGranularity: this.onSelectGroupbyGeolocationGranularity.bind(this, GROUPBY_TYPE.ROW),
|
|
477
|
+
renderIncludeEmpty: renderIncludeEmpty
|
|
478
|
+
}), /*#__PURE__*/React.createElement(GroupbySettings, {
|
|
479
|
+
selectedTable: selectedTable,
|
|
480
|
+
columnsOptions: generalColumnsOptions,
|
|
481
|
+
dateGranularityOptions: dateGranularityOptions,
|
|
482
|
+
geolocationGranularityOptions: geolocationGranularityOptions,
|
|
483
|
+
label: intl.get('Column_grouping_field'),
|
|
484
|
+
placeholder: intl.get('Select_a_column'),
|
|
485
|
+
groupbyColumnKey: column_groupby_column_key,
|
|
486
|
+
groupbyDateGranularity: column_groupby_date_granularity,
|
|
487
|
+
groupbyGeolocationGranularity: column_groupby_geolocation_granularity,
|
|
488
|
+
getSelectedColumnOption: this.props.getSelectedColumnOption,
|
|
489
|
+
onSelectGroupbyColumn: this.onSelectGroupbyColumn.bind(this, GROUPBY_TYPE.COLUMN),
|
|
490
|
+
onSelectGroupbyDateGranularity: this.onSelectGroupbyDateGranularity.bind(this, GROUPBY_TYPE.COLUMN),
|
|
491
|
+
onSelectGroupbyGeolocationGranularity: this.onSelectGroupbyGeolocationGranularity.bind(this, GROUPBY_TYPE.COLUMN)
|
|
492
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
493
|
+
className: "statistic-chart-parameter-divider"
|
|
494
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
495
|
+
className: "statistic-chart-parameter-item"
|
|
496
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_type')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
497
|
+
classNamePrefix: "statistic-chart-summary-types",
|
|
498
|
+
value: selectedGroupItem,
|
|
499
|
+
options: this.groupTypeOptions,
|
|
500
|
+
onChange: this.onChangeGroupType
|
|
501
|
+
})), summary_type === SUMMARY_TYPE.ADVANCED && (column_groupby_multiple_numeric_column ? /*#__PURE__*/React.createElement(React.Fragment, null, column_groupby_column_key && /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
502
|
+
statItem: statItem,
|
|
503
|
+
key: "number-column-".concat(0),
|
|
504
|
+
index: 0,
|
|
505
|
+
numericColumnItem: {
|
|
506
|
+
column_key: summary_columns_option[0] && summary_columns_option[0].key,
|
|
507
|
+
summary_method: summary_columns_option[0] && summary_columns_option[0].method
|
|
508
|
+
},
|
|
509
|
+
numericColumnsOptions: this.getNumericalColumnOptions(),
|
|
510
|
+
summaryMethodOptions: this.summaryMethodsOptions,
|
|
511
|
+
onChangeColumnOption: this.onChangeGroupbyMultiNumericColumn,
|
|
512
|
+
onChangeSummaryMethod: this.onChangeMultiSummaryMethod
|
|
513
|
+
}), !column_groupby_column_key && /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
514
|
+
statItem: statItem,
|
|
515
|
+
key: "number-column-".concat(0),
|
|
516
|
+
index: 0,
|
|
517
|
+
numericColumnItem: {
|
|
518
|
+
column_key: summary_column_key,
|
|
519
|
+
summary_method: summary_method
|
|
520
|
+
},
|
|
521
|
+
numericColumnsOptions: pivotTableSummaryColumnOptions,
|
|
522
|
+
summaryMethodOptions: this.summaryMethodsOptions,
|
|
523
|
+
onChangeColumnOption: this.onChangeGroupbyNumericColumn,
|
|
524
|
+
onChangeSummaryMethod: this.onChangeSummaryMethod
|
|
525
|
+
})) : /*#__PURE__*/React.createElement(SummaryMethodSettings, {
|
|
526
|
+
statItem: statItem,
|
|
527
|
+
numericColumnsOptions: pivotTableSummaryColumnOptions,
|
|
528
|
+
summaryType: summary_type,
|
|
529
|
+
summaryColumnKey: summary_column_key,
|
|
530
|
+
summaryMethod: summary_method,
|
|
531
|
+
getSelectedColumnOption: this.props.getSelectedColumnOption,
|
|
532
|
+
onChangeSummaryType: this.updatedSummaryType,
|
|
533
|
+
onSelectSummaryMethod: this.updateSummaryMethod,
|
|
534
|
+
onSelectNumericColumn: this.updateSummaryColumn,
|
|
535
|
+
updateStatItem: this.props.updateStatItem
|
|
536
|
+
})), column_groupby_multiple_numeric_column && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
537
|
+
className: "statistics-add-number"
|
|
538
|
+
}, this.renderGroupbyNumericColumns()), this.canAddSummaryColumn() && /*#__PURE__*/React.createElement("div", {
|
|
539
|
+
className: "statistics-add-number-column",
|
|
540
|
+
onClick: this.onAddNumericColumn
|
|
541
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
542
|
+
className: "number-column-item dtable-font dtable-icon-add-table"
|
|
543
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
544
|
+
className: "number-column-item add-number-column-description"
|
|
545
|
+
}, intl.get('Add_new_summary_column')))), /*#__PURE__*/React.createElement("div", {
|
|
546
|
+
className: "statistic-chart-parameter-divider"
|
|
547
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
548
|
+
className: "statistic-chart-parameter-item"
|
|
549
|
+
}, /*#__PURE__*/React.createElement(IndToggleSetting, {
|
|
550
|
+
isChecked: display_total,
|
|
551
|
+
handleToggleChange: this.onToggleDisplayData,
|
|
552
|
+
label: intl.get('Display_total')
|
|
553
|
+
})));
|
|
554
|
+
}
|
|
555
|
+
}
|
|
546
556
|
export default PivotSettings;
|