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,132 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import RcSlider from 'rc-slider';
|
|
8
|
+
import intl from 'react-intl-universal';
|
|
9
|
+
import ColorGroupSelector from '../../color-setting/color-group-selector';
|
|
10
|
+
import { DTableSelect } from '../../../../components';
|
|
11
|
+
import { LABEL_COLORS } from '../../../../constants';
|
|
12
|
+
import '../../../../assets/css/slider.css';
|
|
13
|
+
var MapStyleSetting = /*#__PURE__*/function (_Component) {
|
|
14
|
+
_inherits(MapStyleSetting, _Component);
|
|
15
|
+
var _super = _createSuper(MapStyleSetting);
|
|
16
|
+
function MapStyleSetting(props) {
|
|
17
|
+
var _this;
|
|
18
|
+
_classCallCheck(this, MapStyleSetting);
|
|
19
|
+
_this = _super.call(this, props);
|
|
20
|
+
_this.onSliderChange = function (value) {
|
|
21
|
+
_this.setState({
|
|
22
|
+
legendSize: value
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
_this.onAfterChange = function (value) {
|
|
26
|
+
var statItem = _this.props.statItem;
|
|
27
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
28
|
+
legend_size: value
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
_this.getSelectedDirectionOption = function () {
|
|
32
|
+
var statItem = _this.props.statItem;
|
|
33
|
+
var _statItem$legend_dire = statItem.legend_direction,
|
|
34
|
+
legend_direction = _statItem$legend_dire === void 0 ? 'vertical' : _statItem$legend_dire;
|
|
35
|
+
if (legend_direction === 'vertical') {
|
|
36
|
+
return _this.legendDirectionOptions[0];
|
|
37
|
+
}
|
|
38
|
+
return _this.legendDirectionOptions[1];
|
|
39
|
+
};
|
|
40
|
+
_this.renderLabelColor = function () {
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: "statistic-chart-parameter-item"
|
|
43
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Bubble_color')), /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "row gutters-xs ml-0"
|
|
45
|
+
}, LABEL_COLORS.map(function (item, index) {
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
key: "map-bubble-color-".concat(index),
|
|
48
|
+
className: "col-auto pl-0"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
50
|
+
className: "colorinput"
|
|
51
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
52
|
+
className: "colorinput-color statistic-colorinput",
|
|
53
|
+
onClick: _this.updateBubbleColor.bind(_assertThisInitialized(_this), item),
|
|
54
|
+
style: {
|
|
55
|
+
backgroundColor: item,
|
|
56
|
+
borderColor: item
|
|
57
|
+
}
|
|
58
|
+
}, item === (_this.props.statItem.bubble_color || LABEL_COLORS[0]) && /*#__PURE__*/React.createElement("i", {
|
|
59
|
+
className: "dtable-font dtable-icon-check-mark statistic-check-mark"
|
|
60
|
+
}))));
|
|
61
|
+
})));
|
|
62
|
+
};
|
|
63
|
+
_this.updateBubbleColor = function (color) {
|
|
64
|
+
var statItem = _this.props.statItem;
|
|
65
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
66
|
+
bubble_color: color
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
_this.renderColorSetting = function () {
|
|
70
|
+
var _this$props = _this.props,
|
|
71
|
+
onChangeColor = _this$props.onChangeColor,
|
|
72
|
+
statItem = _this$props.statItem;
|
|
73
|
+
var type = statItem.type;
|
|
74
|
+
return !type.includes('bubble') ? /*#__PURE__*/React.createElement(ColorGroupSelector, {
|
|
75
|
+
currentColor: statItem.data_color,
|
|
76
|
+
onChangeColor: onChangeColor
|
|
77
|
+
}) : _this.renderLabelColor();
|
|
78
|
+
};
|
|
79
|
+
_this.onDirectionChange = function (option) {
|
|
80
|
+
var statItem = _this.props.statItem;
|
|
81
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
82
|
+
legend_direction: option.value
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
_this.renderLegendDirection = function () {
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: "statistic-chart-parameter-item"
|
|
88
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Legend_direction')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
89
|
+
value: _this.getSelectedDirectionOption(),
|
|
90
|
+
options: _this.legendDirectionOptions,
|
|
91
|
+
onChange: _this.onDirectionChange
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
94
|
+
_this.renderLegendSize = function () {
|
|
95
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: "statistic-chart-parameter-item"
|
|
97
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Legend_size')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(RcSlider, {
|
|
98
|
+
value: _this.state.legendSize,
|
|
99
|
+
step: 0.5,
|
|
100
|
+
min: 1,
|
|
101
|
+
max: 5,
|
|
102
|
+
onChange: _this.onSliderChange,
|
|
103
|
+
onAfterChange: _this.onAfterChange
|
|
104
|
+
})));
|
|
105
|
+
};
|
|
106
|
+
_this.legendDirectionOptions = [{
|
|
107
|
+
value: 'vertical',
|
|
108
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
109
|
+
className: "select-option-name"
|
|
110
|
+
}, intl.get('Vertical'))
|
|
111
|
+
}, {
|
|
112
|
+
value: 'horizontal',
|
|
113
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
className: "select-option-name"
|
|
115
|
+
}, intl.get('Horizontal'))
|
|
116
|
+
}];
|
|
117
|
+
_this.state = {
|
|
118
|
+
legendSize: props.statItem.legend_size || 1
|
|
119
|
+
};
|
|
120
|
+
return _this;
|
|
121
|
+
}
|
|
122
|
+
_createClass(MapStyleSetting, [{
|
|
123
|
+
key: "render",
|
|
124
|
+
value: function render() {
|
|
125
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderColorSetting(), /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
className: "statistic-chart-parameter-divider"
|
|
127
|
+
}), this.renderLegendDirection(), this.renderLegendSize());
|
|
128
|
+
}
|
|
129
|
+
}]);
|
|
130
|
+
return MapStyleSetting;
|
|
131
|
+
}(Component);
|
|
132
|
+
export default MapStyleSetting;
|
|
@@ -0,0 +1,319 @@
|
|
|
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 intl from 'react-intl-universal';
|
|
8
|
+
import { DTableSelect } from '../../../components';
|
|
9
|
+
import NumericSummaryItem from '../public-setting/numeric-summary-item';
|
|
10
|
+
import { STATISTICS_COUNT_SHOW, STAT_TYPE, SUMMARY_METHOD, SUMMARY_TYPE } from '../../../constants';
|
|
11
|
+
var GROUP_TYPES = {
|
|
12
|
+
COUNT: 'count',
|
|
13
|
+
SINGLE_NUMERIC_COLUMN: 'single_numeric_column',
|
|
14
|
+
MULTIPLE_NUMERIC_COLUMN: 'multiple_numeric_column'
|
|
15
|
+
};
|
|
16
|
+
var SummarySettings = /*#__PURE__*/function (_Component) {
|
|
17
|
+
_inherits(SummarySettings, _Component);
|
|
18
|
+
var _super = _createSuper(SummarySettings);
|
|
19
|
+
function SummarySettings(props) {
|
|
20
|
+
var _this;
|
|
21
|
+
_classCallCheck(this, SummarySettings);
|
|
22
|
+
_this = _super.call(this, props);
|
|
23
|
+
_this.getSummaryTypeOptions = function () {
|
|
24
|
+
var summaryTypes = [{
|
|
25
|
+
value: GROUP_TYPES.COUNT,
|
|
26
|
+
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: 'select-module select-module-name'
|
|
28
|
+
}, intl.get(STATISTICS_COUNT_SHOW['count'])), /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "summary-type-explanation"
|
|
30
|
+
}, _this.summaryExplanation['count']))
|
|
31
|
+
}, {
|
|
32
|
+
value: GROUP_TYPES.SINGLE_NUMERIC_COLUMN,
|
|
33
|
+
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: 'select-module select-module-name'
|
|
35
|
+
}, intl.get(STATISTICS_COUNT_SHOW['advanced'])), /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "summary-type-explanation"
|
|
37
|
+
}, _this.summaryExplanation['advanced']))
|
|
38
|
+
}];
|
|
39
|
+
|
|
40
|
+
// multiple_numeric_column
|
|
41
|
+
if (_this.props.useMultipleSummaryColumns) {
|
|
42
|
+
summaryTypes.push({
|
|
43
|
+
value: GROUP_TYPES.MULTIPLE_NUMERIC_COLUMN,
|
|
44
|
+
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: 'select-module select-module-name'
|
|
46
|
+
}, intl.get('Summarize_multiple_fields')), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: "summary-type-explanation"
|
|
48
|
+
}, intl.get('Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_multiple_fields')))
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return summaryTypes;
|
|
52
|
+
};
|
|
53
|
+
_this.getSummaryExplanation = function () {
|
|
54
|
+
var statItem = _this.props.statItem;
|
|
55
|
+
var chartType = statItem.type;
|
|
56
|
+
var variable = '';
|
|
57
|
+
if (chartType === 'map') {
|
|
58
|
+
variable = '位置字段';
|
|
59
|
+
}
|
|
60
|
+
if (chartType === 'world_map') {
|
|
61
|
+
variable = intl.get('Location_field');
|
|
62
|
+
}
|
|
63
|
+
if (chartType === 'heat_map') {
|
|
64
|
+
variable = intl.get('Time_field');
|
|
65
|
+
}
|
|
66
|
+
if (chartType === 'mirror') {
|
|
67
|
+
variable = intl.get('Statistic_field');
|
|
68
|
+
}
|
|
69
|
+
if (chartType === 'combination_chart') {
|
|
70
|
+
variable = intl.get('X-axis');
|
|
71
|
+
}
|
|
72
|
+
if (chartType === 'trend_chart') {
|
|
73
|
+
return {
|
|
74
|
+
count: intl.get('Calculate_the_number_of_records_in_two_time_periods'),
|
|
75
|
+
advanced: intl.get('Use_a_field_to_calculate_the_sum_maximum_or_minimum_value_of_records_in_two_time_periods')
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
count: intl.get('Count_by_var', {
|
|
80
|
+
var: variable
|
|
81
|
+
}),
|
|
82
|
+
advanced: intl.get('Compute_sum_max_min_by_var', {
|
|
83
|
+
var: variable
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
_this.getSummaryMethodsOptions = function () {
|
|
88
|
+
return SUMMARY_METHOD.map(function (method) {
|
|
89
|
+
return {
|
|
90
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
91
|
+
className: "select-option-name"
|
|
92
|
+
}, intl.get(STATISTICS_COUNT_SHOW[method])),
|
|
93
|
+
value: method
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
_this.getSelectedMethodOption = function (method, summaryMethodsOptions) {
|
|
98
|
+
return summaryMethodsOptions.find(function (m) {
|
|
99
|
+
return m.value === method;
|
|
100
|
+
}) || summaryMethodsOptions[0];
|
|
101
|
+
};
|
|
102
|
+
_this.renderSummaryTypes = function () {
|
|
103
|
+
var label = _this.props.label;
|
|
104
|
+
var selectedSummaryType = _this.getSelectedSummaryType();
|
|
105
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "statistic-chart-parameter-item"
|
|
107
|
+
}, /*#__PURE__*/React.createElement("label", null, label), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
108
|
+
classNamePrefix: 'statistic-chart-summary-types',
|
|
109
|
+
value: selectedSummaryType,
|
|
110
|
+
onChange: _this.onChangeSummaryType,
|
|
111
|
+
options: _this.summaryTypeOptions
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
_this.getSelectedSummaryType = function () {
|
|
115
|
+
var _this$props = _this.props,
|
|
116
|
+
_this$props$summaryTy = _this$props.summaryType,
|
|
117
|
+
summaryType = _this$props$summaryTy === void 0 ? 'count' : _this$props$summaryTy,
|
|
118
|
+
statItem = _this$props.statItem,
|
|
119
|
+
useMultipleSummaryColumns = _this$props.useMultipleSummaryColumns;
|
|
120
|
+
if (summaryType === SUMMARY_TYPE.COUNT) {
|
|
121
|
+
return _this.summaryTypeOptions[0];
|
|
122
|
+
}
|
|
123
|
+
if (statItem.type === STAT_TYPE.COMBINATION_CHART && statItem.y_axis_left_group_by_multiple_numeric_column && useMultipleSummaryColumns) {
|
|
124
|
+
return _this.summaryTypeOptions[2];
|
|
125
|
+
}
|
|
126
|
+
return _this.summaryTypeOptions[1];
|
|
127
|
+
};
|
|
128
|
+
_this.onChangeSummaryType = function (option) {
|
|
129
|
+
var type = option.value;
|
|
130
|
+
var summaryType = _this.props.summaryType;
|
|
131
|
+
if (type === summaryType) return;
|
|
132
|
+
_this.props.onChangeSummaryType(type);
|
|
133
|
+
};
|
|
134
|
+
_this.onSelectSummaryColumn = function (option) {
|
|
135
|
+
_this.props.onSelectSummaryColumn(option.value.key);
|
|
136
|
+
};
|
|
137
|
+
_this.renderNumericColumn = function () {
|
|
138
|
+
var summaryColumn = _this.props.summaryColumn;
|
|
139
|
+
var selectedColumnOption = _this.numericColumnsOptions.find(function (o) {
|
|
140
|
+
return o.value.key === summaryColumn;
|
|
141
|
+
});
|
|
142
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: "statistic-chart-parameter-item"
|
|
144
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Numeric_column')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
145
|
+
value: selectedColumnOption,
|
|
146
|
+
onChange: _this.onSelectSummaryColumn,
|
|
147
|
+
options: _this.numericColumnsOptions,
|
|
148
|
+
placeholder: intl.get('Select_a_column'),
|
|
149
|
+
noOptionsMessage: function noOptionsMessage() {
|
|
150
|
+
return /*#__PURE__*/React.createElement("span", null, intl.get('No_options'));
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
};
|
|
154
|
+
_this.renderSummaryMethod = function () {
|
|
155
|
+
var selectedMethodOption = _this.getSelectedMethodOption(_this.props.summaryMethod, _this.summaryMethodsOptions);
|
|
156
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: "statistic-chart-parameter-item"
|
|
158
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
159
|
+
value: selectedMethodOption,
|
|
160
|
+
onChange: _this.onSelectSummaryMethod,
|
|
161
|
+
options: _this.summaryMethodsOptions
|
|
162
|
+
}));
|
|
163
|
+
};
|
|
164
|
+
_this.onSelectSummaryMethod = function (option) {
|
|
165
|
+
_this.props.onSelectSummaryMethod(option.value);
|
|
166
|
+
};
|
|
167
|
+
_this.renderNumericSummaryItem = function () {
|
|
168
|
+
var _this$props2 = _this.props,
|
|
169
|
+
statItem = _this$props2.statItem,
|
|
170
|
+
onSelectSummaryColumn = _this$props2.onSelectSummaryColumn,
|
|
171
|
+
onSelectSummaryMethod = _this$props2.onSelectSummaryMethod;
|
|
172
|
+
var type = statItem.type;
|
|
173
|
+
var column_key, summary_method;
|
|
174
|
+
if (type === STAT_TYPE.COMBINATION_CHART) {
|
|
175
|
+
column_key = statItem.y_axis_left_summary_column;
|
|
176
|
+
summary_method = statItem.y_axis_left_summary_method;
|
|
177
|
+
}
|
|
178
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
179
|
+
statItem: statItem,
|
|
180
|
+
key: "number-column-".concat(0),
|
|
181
|
+
numericColumnsOptions: _this.numericColumnsOptions,
|
|
182
|
+
summaryMethodOptions: _this.summaryMethodsOptions,
|
|
183
|
+
index: 0,
|
|
184
|
+
numericColumnItem: {
|
|
185
|
+
column_key: column_key,
|
|
186
|
+
summary_method: summary_method
|
|
187
|
+
},
|
|
188
|
+
onChangeColumnOption: function onChangeColumnOption(index, option) {
|
|
189
|
+
return onSelectSummaryColumn(option.value.key);
|
|
190
|
+
},
|
|
191
|
+
onChangeSummaryMethod: function onChangeSummaryMethod(index, option) {
|
|
192
|
+
return onSelectSummaryMethod(option.value);
|
|
193
|
+
}
|
|
194
|
+
}), _this.renderGroupbyNumericColumns(), Array.isArray(_this.numericColumnsOptions) && _this.numericColumnsOptions.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
195
|
+
className: "statistics-add-number-column",
|
|
196
|
+
onClick: _this.onAddNumericColumn
|
|
197
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
198
|
+
className: "number-column-item dtable-font dtable-icon-add-table"
|
|
199
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
200
|
+
className: "number-column-item add-number-column-description"
|
|
201
|
+
}, intl.get('Add_new_numeric_column'))));
|
|
202
|
+
};
|
|
203
|
+
_this.onDeleteNumericColumnItem = function (index) {
|
|
204
|
+
var _ref = _this.props.statItem || {},
|
|
205
|
+
y_axis_left_group_by_numeric_columns = _ref.y_axis_left_group_by_numeric_columns;
|
|
206
|
+
y_axis_left_group_by_numeric_columns = y_axis_left_group_by_numeric_columns || [];
|
|
207
|
+
y_axis_left_group_by_numeric_columns = _toConsumableArray(y_axis_left_group_by_numeric_columns);
|
|
208
|
+
y_axis_left_group_by_numeric_columns.splice(index - 1, 1);
|
|
209
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
210
|
+
y_axis_left_group_by_numeric_columns: _toConsumableArray(y_axis_left_group_by_numeric_columns)
|
|
211
|
+
}));
|
|
212
|
+
};
|
|
213
|
+
_this.onAddNumericColumn = function () {
|
|
214
|
+
var statItem = _this.props.statItem;
|
|
215
|
+
var _ref2 = statItem || {},
|
|
216
|
+
y_axis_left_group_by_numeric_columns = _ref2.y_axis_left_group_by_numeric_columns;
|
|
217
|
+
var newNumericColumnKey = _this.numericColumnsOptions[0].value.key;
|
|
218
|
+
if (Array.isArray(y_axis_left_group_by_numeric_columns)) {
|
|
219
|
+
y_axis_left_group_by_numeric_columns = _toConsumableArray(y_axis_left_group_by_numeric_columns);
|
|
220
|
+
y_axis_left_group_by_numeric_columns.push({
|
|
221
|
+
column_key: newNumericColumnKey,
|
|
222
|
+
summary_method: SUMMARY_METHOD[0]
|
|
223
|
+
});
|
|
224
|
+
} else {
|
|
225
|
+
y_axis_left_group_by_numeric_columns = [{
|
|
226
|
+
column_key: newNumericColumnKey,
|
|
227
|
+
summary_method: SUMMARY_METHOD[0]
|
|
228
|
+
}];
|
|
229
|
+
}
|
|
230
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
231
|
+
y_axis_left_group_by_numeric_columns: _toConsumableArray(y_axis_left_group_by_numeric_columns)
|
|
232
|
+
}));
|
|
233
|
+
};
|
|
234
|
+
_this.onChangeNumericSummaryColumn = function (index, columnOption) {
|
|
235
|
+
var _ref3 = _this.props.statItem || {},
|
|
236
|
+
y_axis_left_group_by_numeric_columns = _ref3.y_axis_left_group_by_numeric_columns;
|
|
237
|
+
y_axis_left_group_by_numeric_columns = y_axis_left_group_by_numeric_columns || [];
|
|
238
|
+
y_axis_left_group_by_numeric_columns = _toConsumableArray(y_axis_left_group_by_numeric_columns);
|
|
239
|
+
var selectedItem = y_axis_left_group_by_numeric_columns[index - 1];
|
|
240
|
+
selectedItem = Object.assign({}, selectedItem, {
|
|
241
|
+
column_key: columnOption.value.key
|
|
242
|
+
});
|
|
243
|
+
y_axis_left_group_by_numeric_columns[index - 1] = selectedItem;
|
|
244
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
245
|
+
y_axis_left_group_by_numeric_columns: y_axis_left_group_by_numeric_columns
|
|
246
|
+
}));
|
|
247
|
+
};
|
|
248
|
+
_this.onChangeNumericSummaryMethod = function (index, option) {
|
|
249
|
+
var _ref4 = _this.props.statItem || {},
|
|
250
|
+
y_axis_left_group_by_numeric_columns = _ref4.y_axis_left_group_by_numeric_columns;
|
|
251
|
+
y_axis_left_group_by_numeric_columns = y_axis_left_group_by_numeric_columns || [];
|
|
252
|
+
y_axis_left_group_by_numeric_columns = _toConsumableArray(y_axis_left_group_by_numeric_columns);
|
|
253
|
+
var selectedItem = y_axis_left_group_by_numeric_columns[index - 1];
|
|
254
|
+
selectedItem = Object.assign({}, selectedItem, {
|
|
255
|
+
summary_method: option.value
|
|
256
|
+
});
|
|
257
|
+
y_axis_left_group_by_numeric_columns[index - 1] = selectedItem;
|
|
258
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
259
|
+
y_axis_left_group_by_numeric_columns: y_axis_left_group_by_numeric_columns
|
|
260
|
+
}));
|
|
261
|
+
};
|
|
262
|
+
_this.renderGroupbyNumericColumns = function () {
|
|
263
|
+
var statItem = _this.props.statItem;
|
|
264
|
+
var y_axis_left_group_by_numeric_columns = statItem.y_axis_left_group_by_numeric_columns;
|
|
265
|
+
if (!y_axis_left_group_by_numeric_columns || !Array.isArray(y_axis_left_group_by_numeric_columns)) return null;
|
|
266
|
+
return y_axis_left_group_by_numeric_columns.map(function (item, index) {
|
|
267
|
+
return /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
268
|
+
statItem: statItem,
|
|
269
|
+
key: "number-column-".concat(index),
|
|
270
|
+
numericColumnsOptions: _this.numericColumnsOptions,
|
|
271
|
+
summaryMethodOptions: _this.summaryMethodsOptions,
|
|
272
|
+
index: index + 1,
|
|
273
|
+
numericColumnItem: item,
|
|
274
|
+
onDeleteNumericColumnItem: _this.onDeleteNumericColumnItem,
|
|
275
|
+
onChangeColumnOption: _this.onChangeNumericSummaryColumn,
|
|
276
|
+
onChangeSummaryMethod: _this.onChangeNumericSummaryMethod
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
};
|
|
280
|
+
_this.useMultipleSummaryColumns = function () {
|
|
281
|
+
var _this$props3 = _this.props,
|
|
282
|
+
statItem = _this$props3.statItem,
|
|
283
|
+
summaryType = _this$props3.summaryType,
|
|
284
|
+
useMultipleSummaryColumns = _this$props3.useMultipleSummaryColumns;
|
|
285
|
+
if (statItem.type === STAT_TYPE.COMBINATION_CHART) {
|
|
286
|
+
if (useMultipleSummaryColumns && summaryType === SUMMARY_TYPE.ADVANCED && statItem.y_axis_left_group_by_multiple_numeric_column) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return false;
|
|
291
|
+
};
|
|
292
|
+
var numericColumns = props.numericColumns,
|
|
293
|
+
getColumnsOptions = props.getColumnsOptions;
|
|
294
|
+
_this.numericColumnsOptions = getColumnsOptions(numericColumns);
|
|
295
|
+
_this.summaryMethodsOptions = _this.getSummaryMethodsOptions();
|
|
296
|
+
_this.summaryExplanation = _this.getSummaryExplanation();
|
|
297
|
+
_this.summaryTypeOptions = _this.getSummaryTypeOptions();
|
|
298
|
+
return _this;
|
|
299
|
+
}
|
|
300
|
+
_createClass(SummarySettings, [{
|
|
301
|
+
key: "componentWillReceiveProps",
|
|
302
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
303
|
+
if (nextProps.selectedTableId !== this.props.selectedTableId) {
|
|
304
|
+
var numericColumns = nextProps.numericColumns,
|
|
305
|
+
getColumnsOptions = nextProps.getColumnsOptions;
|
|
306
|
+
this.numericColumnsOptions = getColumnsOptions(numericColumns);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}, {
|
|
310
|
+
key: "render",
|
|
311
|
+
value: function render() {
|
|
312
|
+
var summaryType = this.props.summaryType;
|
|
313
|
+
var _useMultipleSummaryColumns = this.useMultipleSummaryColumns();
|
|
314
|
+
return /*#__PURE__*/React.createElement(Fragment, null, this.renderSummaryTypes(), !_useMultipleSummaryColumns && summaryType === SUMMARY_TYPE.ADVANCED && /*#__PURE__*/React.createElement(Fragment, null, this.renderNumericColumn(), this.renderSummaryMethod()), _useMultipleSummaryColumns && this.renderNumericSummaryItem());
|
|
315
|
+
}
|
|
316
|
+
}]);
|
|
317
|
+
return SummarySettings;
|
|
318
|
+
}(Component);
|
|
319
|
+
export default SummarySettings;
|
|
@@ -0,0 +1,138 @@
|
|
|
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 _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
var _COMPARED_LIST;
|
|
7
|
+
import React, { Component, Fragment } from 'react';
|
|
8
|
+
import intl from 'react-intl-universal';
|
|
9
|
+
import { DTableSelect } from '../../../components';
|
|
10
|
+
import ColumnSettings from '../public-setting/column-settings';
|
|
11
|
+
import BaseSettings from '../public-setting/base-settings';
|
|
12
|
+
import SummarySettings from './summary-settings';
|
|
13
|
+
import { TIME_COLUMN_LIST } from '../../../constants';
|
|
14
|
+
var COMPARE_GRANULARITY = ['day', 'week', 'quarter', 'month', 'year', 'days_7', 'days_30'];
|
|
15
|
+
var COMPARED_LIST = (_COMPARED_LIST = {}, _defineProperty(_COMPARED_LIST, COMPARE_GRANULARITY[0], 'Yesterday_vs_the_day_before_yesterday'), _defineProperty(_COMPARED_LIST, COMPARE_GRANULARITY[1], 'Last_week_vs_the_week_before_last'), _defineProperty(_COMPARED_LIST, COMPARE_GRANULARITY[3], 'Last_month_vs_the_month_before_last'), _defineProperty(_COMPARED_LIST, COMPARE_GRANULARITY[2], 'Last_quarter_vs_the_quarter_before_last'), _defineProperty(_COMPARED_LIST, COMPARE_GRANULARITY[4], 'Last_year_vs_the_year_before_last'), _defineProperty(_COMPARED_LIST, COMPARE_GRANULARITY[5], 'Last_7_days_vs_previous_7_days'), _defineProperty(_COMPARED_LIST, COMPARE_GRANULARITY[6], 'Last_30_days_vs_previous_30_days'), _COMPARED_LIST);
|
|
16
|
+
var TrendSettings = /*#__PURE__*/function (_Component) {
|
|
17
|
+
_inherits(TrendSettings, _Component);
|
|
18
|
+
var _super = _createSuper(TrendSettings);
|
|
19
|
+
function TrendSettings(props) {
|
|
20
|
+
var _this;
|
|
21
|
+
_classCallCheck(this, TrendSettings);
|
|
22
|
+
_this = _super.call(this, props);
|
|
23
|
+
_this.getGranularityOptions = function (options) {
|
|
24
|
+
return options.map(function (g) {
|
|
25
|
+
return {
|
|
26
|
+
value: g,
|
|
27
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
28
|
+
className: 'select-module select-module-name'
|
|
29
|
+
}, intl.get(COMPARED_LIST[g]))
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
_this.getSelectedDateColumnOption = function () {
|
|
34
|
+
return _this.dateColumnsOptions.find(function (option) {
|
|
35
|
+
return option.value.key === _this.props.statItem.date_column;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
_this.onSelectDateColumn = function (option) {
|
|
39
|
+
var date_column = _this.props.statItem.date_column;
|
|
40
|
+
var new_date_column = option.value.key;
|
|
41
|
+
if (new_date_column === date_column) return;
|
|
42
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
43
|
+
date_column: new_date_column
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
_this.onSelectGroupbyGeolocationGranularity = function (option) {
|
|
47
|
+
var date_granularity = _this.props.statItem.date_granularity;
|
|
48
|
+
if (option.value === date_granularity) return;
|
|
49
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
50
|
+
date_granularity: option.value
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
_this.renderDateGranularity = function () {
|
|
54
|
+
var statItem = _this.props.statItem;
|
|
55
|
+
var date_granularity = statItem.date_granularity;
|
|
56
|
+
var selectedGeolocationGranularity = _this.dateGranularityOptions.find(function (option) {
|
|
57
|
+
return option.value === date_granularity;
|
|
58
|
+
});
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "statistic-chart-parameter-item"
|
|
61
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Comparison_mode')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
62
|
+
value: selectedGeolocationGranularity,
|
|
63
|
+
onChange: _this.onSelectGroupbyGeolocationGranularity,
|
|
64
|
+
options: _this.dateGranularityOptions
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
var columns = props.columns,
|
|
68
|
+
getColumnsOptions = props.getColumnsOptions;
|
|
69
|
+
var dateColumns = columns.filter(function (column) {
|
|
70
|
+
return TIME_COLUMN_LIST.includes(column.type);
|
|
71
|
+
});
|
|
72
|
+
_this.dateColumnsOptions = getColumnsOptions(dateColumns);
|
|
73
|
+
_this.dateGranularityOptions = _this.getGranularityOptions(COMPARE_GRANULARITY);
|
|
74
|
+
return _this;
|
|
75
|
+
}
|
|
76
|
+
_createClass(TrendSettings, [{
|
|
77
|
+
key: "componentWillReceiveProps",
|
|
78
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
79
|
+
if (nextProps.selectedTableId !== this.props.selectedTableId) {
|
|
80
|
+
var columns = nextProps.columns,
|
|
81
|
+
getColumnsOptions = nextProps.getColumnsOptions;
|
|
82
|
+
var dateColumns = columns.filter(function (column) {
|
|
83
|
+
return TIME_COLUMN_LIST.includes(column.type);
|
|
84
|
+
});
|
|
85
|
+
this.dateColumnsOptions = getColumnsOptions(dateColumns);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "render",
|
|
90
|
+
value: function render() {
|
|
91
|
+
var _this$props = this.props,
|
|
92
|
+
getTables = _this$props.getTables,
|
|
93
|
+
getViews = _this$props.getViews,
|
|
94
|
+
settingType = _this$props.settingType,
|
|
95
|
+
selectedTableId = _this$props.selectedTableId,
|
|
96
|
+
statItem = _this$props.statItem,
|
|
97
|
+
getColumnsOptions = _this$props.getColumnsOptions,
|
|
98
|
+
numericColumns = _this$props.numericColumns;
|
|
99
|
+
var selectedDateColumnOption = this.getSelectedDateColumnOption();
|
|
100
|
+
if (settingType === 'style') {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
|
|
104
|
+
statItem: statItem,
|
|
105
|
+
selectedTableId: statItem.table_id,
|
|
106
|
+
selectedViewId: statItem.view_id,
|
|
107
|
+
getTables: getTables,
|
|
108
|
+
getViews: getViews,
|
|
109
|
+
getTableById: this.props.getTableById,
|
|
110
|
+
updateStatItem: this.props.updateStatItem
|
|
111
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: "statistic-chart-parameter-divider"
|
|
113
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: "statistic-chart-parameter-item"
|
|
115
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Time_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
|
|
116
|
+
columnsOptions: this.dateColumnsOptions,
|
|
117
|
+
selectedColumnOption: selectedDateColumnOption,
|
|
118
|
+
onChangeSelectedColumn: this.onSelectDateColumn
|
|
119
|
+
})), this.renderDateGranularity(), /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: "statistic-chart-parameter-divider"
|
|
121
|
+
}), /*#__PURE__*/React.createElement(SummarySettings, {
|
|
122
|
+
label: intl.get('Summary_method'),
|
|
123
|
+
statItem: statItem,
|
|
124
|
+
selectedTableId: selectedTableId,
|
|
125
|
+
numericColumns: numericColumns,
|
|
126
|
+
summaryType: statItem.summary_type,
|
|
127
|
+
summaryMethod: statItem.summary_method,
|
|
128
|
+
summaryColumn: statItem.summary_column,
|
|
129
|
+
getColumnsOptions: getColumnsOptions,
|
|
130
|
+
onChangeSummaryType: this.props.onChangeSummaryType,
|
|
131
|
+
onSelectSummaryColumn: this.props.onSelectSummaryColumn,
|
|
132
|
+
onSelectSummaryMethod: this.props.onSelectSummaryMethod
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
}]);
|
|
136
|
+
return TrendSettings;
|
|
137
|
+
}(Component);
|
|
138
|
+
export default TrendSettings;
|