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