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,193 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React, { Component, Fragment } from 'react';
|
|
7
|
+
import { Input } from 'reactstrap';
|
|
8
|
+
import intl from 'react-intl-universal';
|
|
9
|
+
import { DTableSelect } from '../../../components';
|
|
10
|
+
import BaseSettings from '../public-setting/base-settings';
|
|
11
|
+
import ColumnSettings from '../public-setting/column-settings';
|
|
12
|
+
import { STATISTICS_COUNT_SHOW, SUMMARY_METHOD } from '../../../constants';
|
|
13
|
+
var DashboardChartSettings = /*#__PURE__*/function (_Component) {
|
|
14
|
+
_inherits(DashboardChartSettings, _Component);
|
|
15
|
+
var _super = _createSuper(DashboardChartSettings);
|
|
16
|
+
function DashboardChartSettings(props) {
|
|
17
|
+
var _this;
|
|
18
|
+
_classCallCheck(this, DashboardChartSettings);
|
|
19
|
+
_this = _super.call(this, props);
|
|
20
|
+
_this.onSelectTargetValueColumn = function (option) {
|
|
21
|
+
var target_value_column = _this.props.statItem.target_value_column;
|
|
22
|
+
var new_column = option.value.key;
|
|
23
|
+
if (target_value_column === new_column) return;
|
|
24
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
25
|
+
target_value_column: new_column
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
_this.onSelectTotalValueColumn = function (option) {
|
|
29
|
+
var total_value_column = _this.props.statItem.total_value_column;
|
|
30
|
+
var new_column = option.value.key;
|
|
31
|
+
if (total_value_column === new_column) return;
|
|
32
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
33
|
+
total_value_column: new_column
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
_this.getSummaryMethodsOptions = function () {
|
|
37
|
+
var numberCardSummaryMethod = ['Row_count'].concat(_toConsumableArray(SUMMARY_METHOD));
|
|
38
|
+
return numberCardSummaryMethod.map(function (method) {
|
|
39
|
+
return {
|
|
40
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
41
|
+
className: "select-option-name"
|
|
42
|
+
}, intl.get(STATISTICS_COUNT_SHOW[method])),
|
|
43
|
+
value: method
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
_this.getSelectedMethodOption = function (method, summaryMethodsOptions) {
|
|
48
|
+
return summaryMethodsOptions.find(function (m) {
|
|
49
|
+
return m.value === method;
|
|
50
|
+
}) || summaryMethodsOptions[0];
|
|
51
|
+
};
|
|
52
|
+
_this.onSelectTargetValueColumnSummaryMethod = function (option) {
|
|
53
|
+
var target_value_column_summary_method = _this.props.statItem.target_value_column_summary_method;
|
|
54
|
+
var new_summary_method = option.value;
|
|
55
|
+
if (target_value_column_summary_method === new_summary_method) return;
|
|
56
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
57
|
+
target_value_column_summary_method: new_summary_method
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
_this.onSelectTotalValueColumnSummaryMethod = function (option) {
|
|
61
|
+
var total_value_column_summary_method = _this.props.statItem.total_value_column_summary_method;
|
|
62
|
+
var new_summary_method = option.value;
|
|
63
|
+
if (total_value_column_summary_method === new_summary_method) return;
|
|
64
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
65
|
+
total_value_column_summary_method: new_summary_method
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
_this.renderSummaryMethod = function (option) {
|
|
69
|
+
var statItem = _this.props.statItem;
|
|
70
|
+
var target_value_column_summary_method = statItem.target_value_column_summary_method,
|
|
71
|
+
total_value_column_summary_method = statItem.total_value_column_summary_method;
|
|
72
|
+
var summary_method, onSelectSummaryMethod;
|
|
73
|
+
if (option.targetColumn === 'target_value_column') {
|
|
74
|
+
summary_method = target_value_column_summary_method;
|
|
75
|
+
onSelectSummaryMethod = _this.onSelectTargetValueColumnSummaryMethod;
|
|
76
|
+
} else {
|
|
77
|
+
summary_method = total_value_column_summary_method;
|
|
78
|
+
onSelectSummaryMethod = _this.onSelectTotalValueColumnSummaryMethod;
|
|
79
|
+
}
|
|
80
|
+
var selectedMethodOption = _this.getSelectedMethodOption(summary_method, _this.summaryMethodsOptions);
|
|
81
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: "statistic-chart-parameter-item"
|
|
83
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
84
|
+
value: selectedMethodOption,
|
|
85
|
+
onChange: onSelectSummaryMethod,
|
|
86
|
+
options: _this.summaryMethodsOptions
|
|
87
|
+
}));
|
|
88
|
+
};
|
|
89
|
+
_this.onChangeName = function (event) {
|
|
90
|
+
var value = event.target.value;
|
|
91
|
+
_this.setState({
|
|
92
|
+
statName: value
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
_this.onSaveName = function (event) {
|
|
96
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
97
|
+
name: _this.state.statName
|
|
98
|
+
}));
|
|
99
|
+
};
|
|
100
|
+
_this.onKeyDown = function (e) {
|
|
101
|
+
if (e.key == 'Enter') {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
e.target.blur();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
_this.getStyleSetting = function () {
|
|
107
|
+
var statItem = _this.props.statItem;
|
|
108
|
+
var statName = _this.state.statName;
|
|
109
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: "statistic-chart-parameter-item"
|
|
111
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Label')), /*#__PURE__*/React.createElement(Input, {
|
|
112
|
+
type: "text",
|
|
113
|
+
value: statName || '',
|
|
114
|
+
placeholder: statItem.name,
|
|
115
|
+
onBlur: _this.onSaveName,
|
|
116
|
+
onKeyDown: _this.onKeyDown,
|
|
117
|
+
onChange: _this.onChangeName
|
|
118
|
+
})));
|
|
119
|
+
};
|
|
120
|
+
var numericColumns = props.numericColumns,
|
|
121
|
+
getColumnsOptions = props.getColumnsOptions,
|
|
122
|
+
_statItem = props.statItem;
|
|
123
|
+
_this.numericColumnOptions = getColumnsOptions(numericColumns);
|
|
124
|
+
_this.summaryMethodsOptions = _this.getSummaryMethodsOptions();
|
|
125
|
+
_this.state = {
|
|
126
|
+
statName: _statItem.name
|
|
127
|
+
};
|
|
128
|
+
return _this;
|
|
129
|
+
}
|
|
130
|
+
_createClass(DashboardChartSettings, [{
|
|
131
|
+
key: "componentWillReceiveProps",
|
|
132
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
133
|
+
if (nextProps.selectedTableId !== this.props.selectedTableId) {
|
|
134
|
+
var numericColumns = nextProps.numericColumns,
|
|
135
|
+
getColumnsOptions = nextProps.getColumnsOptions;
|
|
136
|
+
this.numericColumnOptions = getColumnsOptions(numericColumns);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "render",
|
|
141
|
+
value: function render() {
|
|
142
|
+
var _this$props = this.props,
|
|
143
|
+
getTables = _this$props.getTables,
|
|
144
|
+
getViews = _this$props.getViews,
|
|
145
|
+
statItem = _this$props.statItem,
|
|
146
|
+
updateStatItem = _this$props.updateStatItem,
|
|
147
|
+
selectedTableId = _this$props.selectedTableId,
|
|
148
|
+
settingType = _this$props.settingType;
|
|
149
|
+
if (settingType === 'style') {
|
|
150
|
+
return this.getStyleSetting();
|
|
151
|
+
}
|
|
152
|
+
var target_value_column = statItem.target_value_column,
|
|
153
|
+
total_value_column = statItem.total_value_column;
|
|
154
|
+
var selectedTargetValueColumnOption = this.numericColumnOptions.filter(function (option) {
|
|
155
|
+
return option.value.key === target_value_column;
|
|
156
|
+
})[0];
|
|
157
|
+
var selectedTotalValueColumnOption = this.numericColumnOptions.filter(function (option) {
|
|
158
|
+
return option.value.key === total_value_column;
|
|
159
|
+
})[0];
|
|
160
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
|
|
161
|
+
statItem: statItem,
|
|
162
|
+
selectedTableId: selectedTableId,
|
|
163
|
+
selectedViewId: statItem.view_id,
|
|
164
|
+
getTables: getTables,
|
|
165
|
+
getViews: getViews,
|
|
166
|
+
getTableById: this.props.getTableById,
|
|
167
|
+
updateStatItem: updateStatItem
|
|
168
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: "statistic-chart-parameter-divider"
|
|
170
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: "statistic-chart-parameter-item"
|
|
172
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Current_value_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
|
|
173
|
+
columnsOptions: this.numericColumnOptions,
|
|
174
|
+
selectedColumnOption: selectedTargetValueColumnOption,
|
|
175
|
+
onChangeSelectedColumn: this.onSelectTargetValueColumn
|
|
176
|
+
})), this.renderSummaryMethod({
|
|
177
|
+
targetColumn: 'target_value_column'
|
|
178
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
className: "statistic-chart-parameter-divider"
|
|
180
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
181
|
+
className: "statistic-chart-parameter-item"
|
|
182
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Total_value_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
|
|
183
|
+
columnsOptions: this.numericColumnOptions,
|
|
184
|
+
selectedColumnOption: selectedTotalValueColumnOption,
|
|
185
|
+
onChangeSelectedColumn: this.onSelectTotalValueColumn
|
|
186
|
+
})), this.renderSummaryMethod({
|
|
187
|
+
targetColumn: 'total_value_column'
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
}]);
|
|
191
|
+
return DashboardChartSettings;
|
|
192
|
+
}(Component);
|
|
193
|
+
export default DashboardChartSettings;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { DTableSelect } from '../../../components';
|
|
3
|
+
function GeoGranularitySettings(props) {
|
|
4
|
+
var geoGranularityOptions = props.geoGranularityOptions,
|
|
5
|
+
selectedGeoGranularityOption = props.selectedGeoGranularityOption,
|
|
6
|
+
onChangeGeoGranularity = props.onChangeGeoGranularity;
|
|
7
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
8
|
+
value: selectedGeoGranularityOption,
|
|
9
|
+
options: geoGranularityOptions,
|
|
10
|
+
onChange: onChangeGeoGranularity
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
export default GeoGranularitySettings;
|
|
@@ -0,0 +1,107 @@
|
|
|
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 ColumnSettings from '../public-setting/column-settings';
|
|
9
|
+
import SummarySettings from './summary-settings';
|
|
10
|
+
import StyleSettings from './style-setting/heat-map-settings';
|
|
11
|
+
import { TIME_COLUMN_LIST } from '../../../constants';
|
|
12
|
+
var HeatMapSettings = /*#__PURE__*/function (_Component) {
|
|
13
|
+
_inherits(HeatMapSettings, _Component);
|
|
14
|
+
var _super = _createSuper(HeatMapSettings);
|
|
15
|
+
function HeatMapSettings(props) {
|
|
16
|
+
var _this;
|
|
17
|
+
_classCallCheck(this, HeatMapSettings);
|
|
18
|
+
_this = _super.call(this, props);
|
|
19
|
+
_this.getSelectedDateColumnOption = function () {
|
|
20
|
+
return _this.dateColumnsOptions.find(function (option) {
|
|
21
|
+
return option.value.key === _this.props.statItem.time_column;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
_this.onSelectDateColumn = function (option) {
|
|
25
|
+
var time_column = _this.props.statItem.time_column;
|
|
26
|
+
var new_time_column = option.value.key;
|
|
27
|
+
if (new_time_column === time_column) return;
|
|
28
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
29
|
+
time_column: new_time_column
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
var columns = props.columns,
|
|
33
|
+
getColumnsOptions = props.getColumnsOptions;
|
|
34
|
+
var dateColumns = columns.filter(function (column) {
|
|
35
|
+
return TIME_COLUMN_LIST.includes(column.type);
|
|
36
|
+
});
|
|
37
|
+
_this.dateColumnsOptions = getColumnsOptions(dateColumns);
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
_createClass(HeatMapSettings, [{
|
|
41
|
+
key: "componentWillReceiveProps",
|
|
42
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
43
|
+
if (nextProps.selectedTableId !== this.props.selectedTableId) {
|
|
44
|
+
var columns = nextProps.columns,
|
|
45
|
+
getColumnsOptions = nextProps.getColumnsOptions;
|
|
46
|
+
var dateColumns = columns.filter(function (column) {
|
|
47
|
+
return TIME_COLUMN_LIST.includes(column.type);
|
|
48
|
+
});
|
|
49
|
+
this.dateColumnsOptions = getColumnsOptions(dateColumns);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "render",
|
|
54
|
+
value: function render() {
|
|
55
|
+
var _this$props = this.props,
|
|
56
|
+
getTables = _this$props.getTables,
|
|
57
|
+
getViews = _this$props.getViews,
|
|
58
|
+
settingType = _this$props.settingType,
|
|
59
|
+
selectedTableId = _this$props.selectedTableId,
|
|
60
|
+
statItem = _this$props.statItem,
|
|
61
|
+
getColumnsOptions = _this$props.getColumnsOptions,
|
|
62
|
+
numericColumns = _this$props.numericColumns;
|
|
63
|
+
var selectedViewId = statItem.view_id;
|
|
64
|
+
var selectedDateColumnOption = this.getSelectedDateColumnOption();
|
|
65
|
+
if (settingType === 'style') {
|
|
66
|
+
return /*#__PURE__*/React.createElement(StyleSettings, {
|
|
67
|
+
statItem: statItem,
|
|
68
|
+
onChangeColor: this.props.onChangeColor,
|
|
69
|
+
updateStatItem: this.props.updateStatItem
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
|
|
73
|
+
statItem: statItem,
|
|
74
|
+
selectedTableId: selectedTableId,
|
|
75
|
+
selectedViewId: selectedViewId,
|
|
76
|
+
getTables: getTables,
|
|
77
|
+
getViews: getViews,
|
|
78
|
+
getTableById: this.props.getTableById,
|
|
79
|
+
updateStatItem: this.props.updateStatItem
|
|
80
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "statistic-chart-parameter-divider"
|
|
82
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: "statistic-chart-parameter-item"
|
|
84
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Time_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
|
|
85
|
+
columnsOptions: this.dateColumnsOptions,
|
|
86
|
+
selectedColumnOption: selectedDateColumnOption,
|
|
87
|
+
onChangeSelectedColumn: this.onSelectDateColumn
|
|
88
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: "statistic-chart-parameter-divider"
|
|
90
|
+
}), /*#__PURE__*/React.createElement(SummarySettings, {
|
|
91
|
+
label: intl.get('Summary_method'),
|
|
92
|
+
statItem: statItem,
|
|
93
|
+
selectedTableId: selectedTableId,
|
|
94
|
+
numericColumns: numericColumns,
|
|
95
|
+
summaryType: statItem.summary_type,
|
|
96
|
+
summaryMethod: statItem.summary_method,
|
|
97
|
+
summaryColumn: statItem.summary_column,
|
|
98
|
+
getColumnsOptions: getColumnsOptions,
|
|
99
|
+
onChangeSummaryType: this.props.onChangeSummaryType,
|
|
100
|
+
onSelectSummaryColumn: this.props.onSelectSummaryColumn,
|
|
101
|
+
onSelectSummaryMethod: this.props.onSelectSummaryMethod
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
}]);
|
|
105
|
+
return HeatMapSettings;
|
|
106
|
+
}(Component);
|
|
107
|
+
export default HeatMapSettings;
|
|
@@ -0,0 +1,332 @@
|
|
|
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, { Fragment } from 'react';
|
|
6
|
+
import intl from 'react-intl-universal';
|
|
7
|
+
import { isNumericColumn } from 'dtable-store';
|
|
8
|
+
import MapSettings from './map-settings';
|
|
9
|
+
import WorldMapSettings from './world-map-settings';
|
|
10
|
+
import HeatMapSettings from './heat-map-settings';
|
|
11
|
+
import MirrorSettings from './mirror-settings';
|
|
12
|
+
import BasicNumberCardSettings from './basic-number-card-settings';
|
|
13
|
+
import CombinationSettings from './combination-settings';
|
|
14
|
+
import TrendSettings from './trend-chart-settings';
|
|
15
|
+
import DashboardChartSettings from './dashboard-chart-settings';
|
|
16
|
+
import { STAT_TYPE, SUMMARY_TYPE, SUMMARY_METHOD } 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 AdvancedChartSettings = /*#__PURE__*/function (_React$Component) {
|
|
23
|
+
_inherits(AdvancedChartSettings, _React$Component);
|
|
24
|
+
var _super = _createSuper(AdvancedChartSettings);
|
|
25
|
+
function AdvancedChartSettings(props) {
|
|
26
|
+
var _this;
|
|
27
|
+
_classCallCheck(this, AdvancedChartSettings);
|
|
28
|
+
_this = _super.call(this, props);
|
|
29
|
+
_this.getDefaultColumnGroupbyType = function (_ref) {
|
|
30
|
+
var summary_type = _ref.summary_type;
|
|
31
|
+
if (summary_type === SUMMARY_TYPE.ADVANCED) {
|
|
32
|
+
return GROUP_TYPES.SINGLE_NUMERIC_COLUMN;
|
|
33
|
+
}
|
|
34
|
+
return GROUP_TYPES.COUNT;
|
|
35
|
+
};
|
|
36
|
+
_this.getNumericColumns = function (columns) {
|
|
37
|
+
if (!columns) return [];
|
|
38
|
+
return columns.filter(function (column) {
|
|
39
|
+
return column && isNumericColumn(column);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
_this.getSettingsByType = function () {
|
|
43
|
+
var settingType = _this.state.settingType;
|
|
44
|
+
var _this$props = _this.props,
|
|
45
|
+
getTables = _this$props.getTables,
|
|
46
|
+
getViews = _this$props.getViews,
|
|
47
|
+
getTableById = _this$props.getTableById,
|
|
48
|
+
statItem = _this$props.statItem,
|
|
49
|
+
labelColorConfigs = _this$props.labelColorConfigs,
|
|
50
|
+
eventBus = _this$props.eventBus,
|
|
51
|
+
updateStatItem = _this$props.updateStatItem;
|
|
52
|
+
var type = statItem.type,
|
|
53
|
+
selectedTableId = statItem.table_id;
|
|
54
|
+
switch (type) {
|
|
55
|
+
case STAT_TYPE.MAP:
|
|
56
|
+
case STAT_TYPE.MAP_BUBBLE:
|
|
57
|
+
{
|
|
58
|
+
return /*#__PURE__*/React.createElement(MapSettings, {
|
|
59
|
+
settingType: settingType,
|
|
60
|
+
selectedTableId: selectedTableId,
|
|
61
|
+
columns: _this.columns,
|
|
62
|
+
numericColumns: _this.numericColumns,
|
|
63
|
+
statItem: statItem,
|
|
64
|
+
labelColorConfigs: labelColorConfigs,
|
|
65
|
+
eventBus: eventBus,
|
|
66
|
+
getTables: getTables,
|
|
67
|
+
getViews: getViews,
|
|
68
|
+
getTableById: getTableById,
|
|
69
|
+
getColumnsOptions: _this.getColumnsOptions,
|
|
70
|
+
updateStatItem: updateStatItem,
|
|
71
|
+
onChangeSummaryType: _this.onChangeSummaryType,
|
|
72
|
+
onSelectSummaryColumn: _this.onSelectSummaryColumn,
|
|
73
|
+
onSelectSummaryMethod: _this.onSelectSummaryMethod,
|
|
74
|
+
onChangeColor: _this.onChangeColor
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
case STAT_TYPE.WORLD_MAP:
|
|
78
|
+
case STAT_TYPE.WORLD_MAP_BUBBLE:
|
|
79
|
+
{
|
|
80
|
+
return /*#__PURE__*/React.createElement(WorldMapSettings, {
|
|
81
|
+
settingType: settingType,
|
|
82
|
+
selectedTableId: selectedTableId,
|
|
83
|
+
columns: _this.columns,
|
|
84
|
+
numericColumns: _this.numericColumns,
|
|
85
|
+
statItem: statItem,
|
|
86
|
+
labelColorConfigs: labelColorConfigs,
|
|
87
|
+
eventBus: eventBus,
|
|
88
|
+
getColumnsOptions: _this.getColumnsOptions,
|
|
89
|
+
getTables: getTables,
|
|
90
|
+
getViews: getViews,
|
|
91
|
+
getTableById: getTableById,
|
|
92
|
+
updateStatItem: updateStatItem,
|
|
93
|
+
onChangeSummaryType: _this.onChangeSummaryType,
|
|
94
|
+
onSelectSummaryColumn: _this.onSelectSummaryColumn,
|
|
95
|
+
onSelectSummaryMethod: _this.onSelectSummaryMethod,
|
|
96
|
+
onChangeColor: _this.onChangeColor
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
case STAT_TYPE.HEAT_MAP:
|
|
100
|
+
{
|
|
101
|
+
return /*#__PURE__*/React.createElement(HeatMapSettings, {
|
|
102
|
+
settingType: settingType,
|
|
103
|
+
selectedTableId: selectedTableId,
|
|
104
|
+
columns: _this.columns,
|
|
105
|
+
numericColumns: _this.numericColumns,
|
|
106
|
+
statItem: statItem,
|
|
107
|
+
labelColorConfigs: labelColorConfigs,
|
|
108
|
+
eventBus: eventBus,
|
|
109
|
+
getColumnsOptions: _this.getColumnsOptions,
|
|
110
|
+
getTables: getTables,
|
|
111
|
+
getViews: getViews,
|
|
112
|
+
getTableById: getTableById,
|
|
113
|
+
updateStatItem: updateStatItem,
|
|
114
|
+
onChangeSummaryType: _this.onChangeSummaryType,
|
|
115
|
+
onSelectSummaryColumn: _this.onSelectSummaryColumn,
|
|
116
|
+
onSelectSummaryMethod: _this.onSelectSummaryMethod,
|
|
117
|
+
onChangeColor: _this.onChangeColor
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
case STAT_TYPE.MIRROR:
|
|
121
|
+
{
|
|
122
|
+
return /*#__PURE__*/React.createElement(MirrorSettings, {
|
|
123
|
+
settingType: settingType,
|
|
124
|
+
selectedTableId: selectedTableId,
|
|
125
|
+
columns: _this.columns,
|
|
126
|
+
numericColumns: _this.numericColumns,
|
|
127
|
+
statItem: statItem,
|
|
128
|
+
labelColorConfigs: labelColorConfigs,
|
|
129
|
+
eventBus: eventBus,
|
|
130
|
+
getColumnsOptions: _this.getColumnsOptions,
|
|
131
|
+
getTables: getTables,
|
|
132
|
+
getViews: getViews,
|
|
133
|
+
getTableById: getTableById,
|
|
134
|
+
updateStatItem: updateStatItem,
|
|
135
|
+
onChangeSummaryType: _this.onChangeSummaryType,
|
|
136
|
+
onSelectSummaryColumn: _this.onSelectSummaryColumn,
|
|
137
|
+
onSelectSummaryMethod: _this.onSelectSummaryMethod
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
case STAT_TYPE.BASIC_NUMBER_CARD:
|
|
141
|
+
{
|
|
142
|
+
return /*#__PURE__*/React.createElement(BasicNumberCardSettings, {
|
|
143
|
+
statItem: statItem,
|
|
144
|
+
labelColorConfigs: labelColorConfigs,
|
|
145
|
+
eventBus: eventBus,
|
|
146
|
+
settingType: settingType,
|
|
147
|
+
selectedTableId: selectedTableId,
|
|
148
|
+
getTables: getTables,
|
|
149
|
+
getViews: getViews,
|
|
150
|
+
getTableById: getTableById,
|
|
151
|
+
updateStatItem: updateStatItem,
|
|
152
|
+
numericColumns: _this.numericColumns,
|
|
153
|
+
getColumnsOptions: _this.getColumnsOptions,
|
|
154
|
+
onChangeSummaryType: _this.onChangeSummaryType,
|
|
155
|
+
onSelectSummaryMethod: _this.onSelectSummaryMethod
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
case STAT_TYPE.COMBINATION_CHART:
|
|
159
|
+
{
|
|
160
|
+
return /*#__PURE__*/React.createElement(CombinationSettings, {
|
|
161
|
+
statItem: statItem,
|
|
162
|
+
labelColorConfigs: labelColorConfigs,
|
|
163
|
+
eventBus: eventBus,
|
|
164
|
+
settingType: settingType,
|
|
165
|
+
columns: _this.columns,
|
|
166
|
+
selectedTableId: selectedTableId,
|
|
167
|
+
getTables: getTables,
|
|
168
|
+
getViews: getViews,
|
|
169
|
+
getTableById: getTableById,
|
|
170
|
+
updateStatItem: updateStatItem,
|
|
171
|
+
numericColumns: _this.numericColumns,
|
|
172
|
+
getColumnsOptions: _this.getColumnsOptions
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
case STAT_TYPE.TREND_CHART:
|
|
176
|
+
{
|
|
177
|
+
return /*#__PURE__*/React.createElement(TrendSettings, {
|
|
178
|
+
settingType: settingType,
|
|
179
|
+
selectedTableId: selectedTableId,
|
|
180
|
+
columns: _this.columns,
|
|
181
|
+
numericColumns: _this.numericColumns,
|
|
182
|
+
statItem: statItem,
|
|
183
|
+
labelColorConfigs: labelColorConfigs,
|
|
184
|
+
eventBus: eventBus,
|
|
185
|
+
getColumnsOptions: _this.getColumnsOptions,
|
|
186
|
+
getTables: getTables,
|
|
187
|
+
getViews: getViews,
|
|
188
|
+
getTableById: getTableById,
|
|
189
|
+
updateStatItem: updateStatItem,
|
|
190
|
+
onChangeSummaryType: _this.onChangeSummaryType,
|
|
191
|
+
onSelectSummaryColumn: _this.onSelectSummaryColumn,
|
|
192
|
+
onSelectSummaryMethod: _this.onSelectSummaryMethod
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
case STAT_TYPE.DASHBOARD:
|
|
196
|
+
{
|
|
197
|
+
return /*#__PURE__*/React.createElement(DashboardChartSettings, {
|
|
198
|
+
statItem: statItem,
|
|
199
|
+
labelColorConfigs: labelColorConfigs,
|
|
200
|
+
eventBus: eventBus,
|
|
201
|
+
settingType: settingType,
|
|
202
|
+
selectedTableId: selectedTableId,
|
|
203
|
+
getTables: getTables,
|
|
204
|
+
getViews: getViews,
|
|
205
|
+
getTableById: getTableById,
|
|
206
|
+
updateStatItem: updateStatItem,
|
|
207
|
+
numericColumns: _this.numericColumns,
|
|
208
|
+
getColumnsOptions: _this.getColumnsOptions
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
default:
|
|
212
|
+
{
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
_this.getColumnsOptions = function (columns) {
|
|
218
|
+
if (!Array.isArray(columns)) return [];
|
|
219
|
+
return columns.map(function (column) {
|
|
220
|
+
var name = column.name,
|
|
221
|
+
key = column.key,
|
|
222
|
+
type = column.type;
|
|
223
|
+
return {
|
|
224
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
225
|
+
className: "select-option-name"
|
|
226
|
+
}, name),
|
|
227
|
+
value: {
|
|
228
|
+
name: name,
|
|
229
|
+
key: key,
|
|
230
|
+
type: type
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
_this.onChangeSummaryType = function (summaryType) {
|
|
236
|
+
var _this$props$statItem = _this.props.statItem,
|
|
237
|
+
summary_type = _this$props$statItem.summary_type,
|
|
238
|
+
summary_column = _this$props$statItem.summary_column,
|
|
239
|
+
summary_method = _this$props$statItem.summary_method;
|
|
240
|
+
if (summaryType === _this.columnGroupbyType) return;
|
|
241
|
+
if (summaryType === GROUP_TYPES.SINGLE_NUMERIC_COLUMN) {
|
|
242
|
+
var defaultColumn = _this.numericColumns[0];
|
|
243
|
+
summary_column = defaultColumn ? defaultColumn.key : null;
|
|
244
|
+
summary_method = SUMMARY_METHOD[0];
|
|
245
|
+
summary_type = SUMMARY_TYPE.ADVANCED;
|
|
246
|
+
} else {
|
|
247
|
+
summary_type = SUMMARY_TYPE.COUNT;
|
|
248
|
+
summary_method = null;
|
|
249
|
+
summary_column = null;
|
|
250
|
+
}
|
|
251
|
+
_this.columnGroupbyType = summaryType;
|
|
252
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
253
|
+
summary_type: summary_type,
|
|
254
|
+
summary_column: summary_column,
|
|
255
|
+
summary_method: summary_method
|
|
256
|
+
}));
|
|
257
|
+
};
|
|
258
|
+
_this.onChangeColor = function (targetColor) {
|
|
259
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
260
|
+
data_color: targetColor
|
|
261
|
+
}));
|
|
262
|
+
};
|
|
263
|
+
_this.onSelectSummaryColumn = function (summaryColumn) {
|
|
264
|
+
var summary_column = _this.props.statItem.summary_column;
|
|
265
|
+
if (summaryColumn === summary_column) return;
|
|
266
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
267
|
+
summary_column: summaryColumn
|
|
268
|
+
}));
|
|
269
|
+
};
|
|
270
|
+
_this.onSelectSummaryMethod = function (summaryMethod) {
|
|
271
|
+
var summary_method = _this.props.statItem.summary_method;
|
|
272
|
+
if (summaryMethod === summary_method) return;
|
|
273
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
274
|
+
summary_method: summaryMethod
|
|
275
|
+
}));
|
|
276
|
+
};
|
|
277
|
+
_this.selectEditType = function (type) {
|
|
278
|
+
_this.setState({
|
|
279
|
+
settingType: type
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
var _getTableById = props.getTableById,
|
|
283
|
+
_statItem = props.statItem;
|
|
284
|
+
var selectedTable = _getTableById(_statItem.table_id);
|
|
285
|
+
_this.columns = selectedTable.columns;
|
|
286
|
+
_this.numericColumns = _this.getNumericColumns(_this.columns);
|
|
287
|
+
_this.state = {
|
|
288
|
+
settingType: 'data'
|
|
289
|
+
};
|
|
290
|
+
_this.columnGroupbyType = _this.getDefaultColumnGroupbyType(_statItem);
|
|
291
|
+
return _this;
|
|
292
|
+
}
|
|
293
|
+
_createClass(AdvancedChartSettings, [{
|
|
294
|
+
key: "componentWillReceiveProps",
|
|
295
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
296
|
+
var getTableById = this.props.getTableById;
|
|
297
|
+
var newSelectedTableId = nextProps.statItem.table_id;
|
|
298
|
+
if (newSelectedTableId !== this.props.statItem.table_id) {
|
|
299
|
+
var selectedTable = getTableById(newSelectedTableId);
|
|
300
|
+
this.columns = selectedTable.columns;
|
|
301
|
+
this.numericColumns = this.getNumericColumns(this.columns);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
key: "render",
|
|
306
|
+
value: function render() {
|
|
307
|
+
var _this2 = this;
|
|
308
|
+
var settingType = this.state.settingType;
|
|
309
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
310
|
+
className: "statistic-chart-settings"
|
|
311
|
+
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
312
|
+
className: "statistic-chart-settings-type"
|
|
313
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
314
|
+
onClick: function onClick() {
|
|
315
|
+
return _this2.selectEditType('data');
|
|
316
|
+
},
|
|
317
|
+
className: "statistic-type-item ".concat(settingType === 'data' ? 'selected-statistic-type-item' : '')
|
|
318
|
+
}, intl.get('Data_settings')), /*#__PURE__*/React.createElement("div", {
|
|
319
|
+
onClick: function onClick() {
|
|
320
|
+
return _this2.selectEditType('style');
|
|
321
|
+
},
|
|
322
|
+
className: "statistic-type-item ".concat(settingType === 'style' ? 'selected-statistic-type-item' : '')
|
|
323
|
+
}, intl.get('Style_settings'))), /*#__PURE__*/React.createElement("div", {
|
|
324
|
+
className: "statistic-chart-settings-container"
|
|
325
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
className: "statistic-chart-settings-parameter-list pt-4"
|
|
327
|
+
}, this.getSettingsByType()))));
|
|
328
|
+
}
|
|
329
|
+
}]);
|
|
330
|
+
return AdvancedChartSettings;
|
|
331
|
+
}(React.Component);
|
|
332
|
+
export default AdvancedChartSettings;
|