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,124 @@
|
|
|
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 { DTableSelect } from '../../../components';
|
|
8
|
+
import { STATISTICS_COUNT_SHOW, STATISTICS_COUNT_TYPE, STAT_TYPE, SUMMARY_METHOD, TIME_COLUMN_LIST } from '../../../constants';
|
|
9
|
+
var DATE_COLUMN_SUMMARY_METHOD = ['Max', 'Min'];
|
|
10
|
+
var SummaryMethodSettings = /*#__PURE__*/function (_Component) {
|
|
11
|
+
_inherits(SummaryMethodSettings, _Component);
|
|
12
|
+
var _super = _createSuper(SummaryMethodSettings);
|
|
13
|
+
function SummaryMethodSettings(props) {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, SummaryMethodSettings);
|
|
16
|
+
_this = _super.call(this, props);
|
|
17
|
+
_this.renderNumericColumn = function () {
|
|
18
|
+
var _this$props = _this.props,
|
|
19
|
+
summaryColumnKey = _this$props.summaryColumnKey,
|
|
20
|
+
numericColumnsOptions = _this$props.numericColumnsOptions,
|
|
21
|
+
statItem = _this$props.statItem;
|
|
22
|
+
var selectedColumnOption = _this.props.getSelectedColumnOption(summaryColumnKey, numericColumnsOptions);
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: "statistic-chart-parameter-item"
|
|
25
|
+
}, /*#__PURE__*/React.createElement("label", null, statItem.type === STAT_TYPE.PIVOT_TABLE ? intl.get('Summary_column') : intl.get('Numeric_column')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
26
|
+
value: selectedColumnOption,
|
|
27
|
+
onChange: _this.onSelectNumericColumn,
|
|
28
|
+
options: numericColumnsOptions,
|
|
29
|
+
placeholder: intl.get('Select_a_column'),
|
|
30
|
+
noOptionsMessage: function noOptionsMessage() {
|
|
31
|
+
return /*#__PURE__*/React.createElement("span", null, intl.get('No_options'));
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
_this.renderSummaryMethod = function () {
|
|
36
|
+
var _this$props2 = _this.props,
|
|
37
|
+
summaryColumnKey = _this$props2.summaryColumnKey,
|
|
38
|
+
numericColumnsOptions = _this$props2.numericColumnsOptions,
|
|
39
|
+
summaryMethod = _this$props2.summaryMethod;
|
|
40
|
+
var selectedMethodOption = _this.getSelectedMethodOption(summaryMethod, _this.summaryMethodsOptions);
|
|
41
|
+
var summaryMethodOption = _this.summaryMethodsOptions;
|
|
42
|
+
var selectedColumnOption = _this.props.getSelectedColumnOption(summaryColumnKey, numericColumnsOptions);
|
|
43
|
+
if (selectedColumnOption && TIME_COLUMN_LIST.includes(selectedColumnOption.value.type)) {
|
|
44
|
+
summaryMethodOption = summaryMethodOption.filter(function (option) {
|
|
45
|
+
return option.value == DATE_COLUMN_SUMMARY_METHOD[0] || option.value == DATE_COLUMN_SUMMARY_METHOD[1];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "statistic-chart-parameter-item"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
51
|
+
value: selectedMethodOption,
|
|
52
|
+
onChange: _this.onSelectSummaryMethod,
|
|
53
|
+
options: summaryMethodOption
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
_this.getSummaryMethodsOptions = function () {
|
|
57
|
+
return SUMMARY_METHOD.map(function (m) {
|
|
58
|
+
return {
|
|
59
|
+
value: m,
|
|
60
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
61
|
+
className: 'select-module select-module-name'
|
|
62
|
+
}, intl.get(STATISTICS_COUNT_SHOW[m]))
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
_this.getSelectedMethodOption = function (method, summaryMethodsOptions) {
|
|
67
|
+
return summaryMethodsOptions.find(function (m) {
|
|
68
|
+
return m.value === method;
|
|
69
|
+
}) || summaryMethodsOptions[0];
|
|
70
|
+
};
|
|
71
|
+
_this.onChangeSummaryType = function (option) {
|
|
72
|
+
var type = option.value;
|
|
73
|
+
var _this$props3 = _this.props,
|
|
74
|
+
summaryType = _this$props3.summaryType,
|
|
75
|
+
numericColumnsOptions = _this$props3.numericColumnsOptions;
|
|
76
|
+
if (type === summaryType) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
var summaryColumnKey = null;
|
|
80
|
+
var summaryMethod = null;
|
|
81
|
+
if (type === STATISTICS_COUNT_TYPE.ADVANCED && Array.isArray(numericColumnsOptions) && numericColumnsOptions.length > 0) {
|
|
82
|
+
summaryColumnKey = numericColumnsOptions[0].value.key;
|
|
83
|
+
summaryMethod = SUMMARY_METHOD[0];
|
|
84
|
+
}
|
|
85
|
+
_this.props.onChangeSummaryType(type, summaryColumnKey, summaryMethod);
|
|
86
|
+
};
|
|
87
|
+
_this.onSelectNumericColumn = function (columnOption) {
|
|
88
|
+
var newSummaryColumnKey = columnOption.value.key;
|
|
89
|
+
if (newSummaryColumnKey === _this.props.summaryColumnKey) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
var _this$props4 = _this.props,
|
|
93
|
+
statItem = _this$props4.statItem,
|
|
94
|
+
updateStatItem = _this$props4.updateStatItem,
|
|
95
|
+
onSelectNumericColumn = _this$props4.onSelectNumericColumn;
|
|
96
|
+
var newSummaryColumnType = columnOption.value.type;
|
|
97
|
+
if (TIME_COLUMN_LIST.includes(newSummaryColumnType) && !DATE_COLUMN_SUMMARY_METHOD.includes(_this.props.summaryMethod)) {
|
|
98
|
+
updateStatItem(Object.assign({}, statItem, {
|
|
99
|
+
summary_method: DATE_COLUMN_SUMMARY_METHOD[1],
|
|
100
|
+
summary_column_key: newSummaryColumnKey
|
|
101
|
+
}));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
onSelectNumericColumn(newSummaryColumnKey);
|
|
105
|
+
};
|
|
106
|
+
_this.onSelectSummaryMethod = function (summaryMethodOption) {
|
|
107
|
+
var newSummaryMethod = summaryMethodOption.value;
|
|
108
|
+
if (newSummaryMethod === _this.props.summaryMethod) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
_this.props.onSelectSummaryMethod(newSummaryMethod);
|
|
112
|
+
};
|
|
113
|
+
_this.summaryMethodsOptions = _this.getSummaryMethodsOptions();
|
|
114
|
+
return _this;
|
|
115
|
+
}
|
|
116
|
+
_createClass(SummaryMethodSettings, [{
|
|
117
|
+
key: "render",
|
|
118
|
+
value: function render() {
|
|
119
|
+
return /*#__PURE__*/React.createElement(Fragment, null, this.renderNumericColumn(), this.renderSummaryMethod());
|
|
120
|
+
}
|
|
121
|
+
}]);
|
|
122
|
+
return SummaryMethodSettings;
|
|
123
|
+
}(Component);
|
|
124
|
+
export default SummaryMethodSettings;
|
|
@@ -0,0 +1,150 @@
|
|
|
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 { DTableSelect } from '../../../components';
|
|
8
|
+
import { STATISTICS_COUNT_SHOW, STATISTICS_COUNT_TYPE, STAT_TYPE, SUMMARY_METHOD, SUMMARY_TYPE } from '../../../constants';
|
|
9
|
+
var SUMMARY_TYPES = [SUMMARY_TYPE.COUNT, SUMMARY_TYPE.ADVANCED];
|
|
10
|
+
var SummarySettings = /*#__PURE__*/function (_Component) {
|
|
11
|
+
_inherits(SummarySettings, _Component);
|
|
12
|
+
var _super = _createSuper(SummarySettings);
|
|
13
|
+
function SummarySettings(props) {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, SummarySettings);
|
|
16
|
+
_this = _super.call(this, props);
|
|
17
|
+
_this.getSummaryTypeOptions = function () {
|
|
18
|
+
var summaryExplanation = _this.getSummaryExplanation();
|
|
19
|
+
return SUMMARY_TYPES.map(function (type, index) {
|
|
20
|
+
return {
|
|
21
|
+
value: type,
|
|
22
|
+
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: 'select-module select-module-name'
|
|
24
|
+
}, intl.get(STATISTICS_COUNT_SHOW[type])), /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: "summary-type-explanation"
|
|
26
|
+
}, summaryExplanation[type]))
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
_this.getSummaryExplanation = function () {
|
|
31
|
+
var statItem = _this.props.statItem;
|
|
32
|
+
var type = statItem.type;
|
|
33
|
+
if (type === STAT_TYPE.PIE || type === STAT_TYPE.RING || type === STAT_TYPE.TREEMAP) {
|
|
34
|
+
return {
|
|
35
|
+
count: intl.get('Count_the_number_of_records_in_each_group'),
|
|
36
|
+
advanced: intl.get('Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_a_field')
|
|
37
|
+
};
|
|
38
|
+
} else if (type === STAT_TYPE.HORIZONTAL_BAR) {
|
|
39
|
+
return {
|
|
40
|
+
count: intl.get('Group_the_records_according_to_the_vertical_axis_and_count_the_records_in_each_group'),
|
|
41
|
+
advanced: intl.get('Group_the_records_according_to_the_vertical_axis_and_compute_the_sum_maximum_or_minimum_of_records_in_each_group_by_a_field')
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
count: intl.get('Count_the_records'),
|
|
46
|
+
advanced: intl.get('Compute_sum_max_min')
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
_this.renderSummaryTypes = function () {
|
|
50
|
+
var _this$props = _this.props,
|
|
51
|
+
summaryType = _this$props.summaryType,
|
|
52
|
+
label = _this$props.label;
|
|
53
|
+
summaryType = summaryType || 'count';
|
|
54
|
+
var selectedSummaryMethod = _this.summaryTypeOptions.find(function (item) {
|
|
55
|
+
return item.value === summaryType;
|
|
56
|
+
}) || _this.summaryTypeOptions[0];
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "statistic-chart-parameter-item"
|
|
59
|
+
}, /*#__PURE__*/React.createElement("label", null, label), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
60
|
+
classNamePrefix: 'statistic-chart-summary-types',
|
|
61
|
+
value: selectedSummaryMethod,
|
|
62
|
+
onChange: _this.onChangeSummaryType,
|
|
63
|
+
options: _this.summaryTypeOptions
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
_this.renderNumericColumn = function () {
|
|
67
|
+
var _this$props2 = _this.props,
|
|
68
|
+
summaryColumnKey = _this$props2.summaryColumnKey,
|
|
69
|
+
numericColumnsOptions = _this$props2.numericColumnsOptions;
|
|
70
|
+
var selectedColumnOption = _this.props.getSelectedColumnOption(summaryColumnKey, numericColumnsOptions);
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: "statistic-chart-parameter-item"
|
|
73
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Numeric_column')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
74
|
+
value: selectedColumnOption,
|
|
75
|
+
onChange: _this.onSelectNumericColumn,
|
|
76
|
+
options: numericColumnsOptions,
|
|
77
|
+
placeholder: intl.get('Select_a_column'),
|
|
78
|
+
noOptionsMessage: function noOptionsMessage() {
|
|
79
|
+
return /*#__PURE__*/React.createElement("span", null, intl.get('No_options'));
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
_this.renderSummaryMethod = function () {
|
|
84
|
+
var selectedMethodOption = _this.getSelectedMethodOption(_this.props.summaryMethod, _this.summaryMethodsOptions);
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "statistic-chart-parameter-item"
|
|
87
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
88
|
+
value: selectedMethodOption,
|
|
89
|
+
onChange: _this.onSelectSummaryMethod,
|
|
90
|
+
options: _this.summaryMethodsOptions
|
|
91
|
+
}));
|
|
92
|
+
};
|
|
93
|
+
_this.getSummaryMethodsOptions = function () {
|
|
94
|
+
return SUMMARY_METHOD.map(function (m) {
|
|
95
|
+
return {
|
|
96
|
+
value: m,
|
|
97
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
className: 'select-module select-module-name'
|
|
99
|
+
}, intl.get(STATISTICS_COUNT_SHOW[m]))
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
_this.getSelectedMethodOption = function (method, summaryMethodsOptions) {
|
|
104
|
+
return summaryMethodsOptions.find(function (m) {
|
|
105
|
+
return m.value === method;
|
|
106
|
+
}) || summaryMethodsOptions[0];
|
|
107
|
+
};
|
|
108
|
+
_this.onChangeSummaryType = function (option) {
|
|
109
|
+
var type = option.value;
|
|
110
|
+
var _this$props3 = _this.props,
|
|
111
|
+
summaryType = _this$props3.summaryType,
|
|
112
|
+
numericColumnsOptions = _this$props3.numericColumnsOptions;
|
|
113
|
+
if (type === summaryType) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
var summaryColumnKey = null;
|
|
117
|
+
var summaryMethod = null;
|
|
118
|
+
if (type === STATISTICS_COUNT_TYPE.ADVANCED && Array.isArray(numericColumnsOptions) && numericColumnsOptions.length > 0) {
|
|
119
|
+
summaryColumnKey = numericColumnsOptions[0].value.key;
|
|
120
|
+
summaryMethod = SUMMARY_METHOD[0];
|
|
121
|
+
}
|
|
122
|
+
_this.props.onChangeSummaryType(type, summaryColumnKey, summaryMethod);
|
|
123
|
+
};
|
|
124
|
+
_this.onSelectNumericColumn = function (columnOption) {
|
|
125
|
+
var newSummaryColumnKey = columnOption.value.key;
|
|
126
|
+
if (newSummaryColumnKey === _this.props.summaryColumnKey) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
_this.props.onSelectNumericColumn(newSummaryColumnKey);
|
|
130
|
+
};
|
|
131
|
+
_this.onSelectSummaryMethod = function (summaryMethodOption) {
|
|
132
|
+
var newSummaryMethod = summaryMethodOption.value;
|
|
133
|
+
if (newSummaryMethod === _this.props.summaryMethod) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
_this.props.onSelectSummaryMethod(newSummaryMethod);
|
|
137
|
+
};
|
|
138
|
+
_this.summaryMethodsOptions = _this.getSummaryMethodsOptions();
|
|
139
|
+
_this.summaryTypeOptions = _this.getSummaryTypeOptions();
|
|
140
|
+
return _this;
|
|
141
|
+
}
|
|
142
|
+
_createClass(SummarySettings, [{
|
|
143
|
+
key: "render",
|
|
144
|
+
value: function render() {
|
|
145
|
+
return /*#__PURE__*/React.createElement(Fragment, null, this.renderSummaryTypes(), this.props.summaryType === STATISTICS_COUNT_TYPE.ADVANCED && /*#__PURE__*/React.createElement(Fragment, null, this.renderNumericColumn(), this.renderSummaryMethod()));
|
|
146
|
+
}
|
|
147
|
+
}]);
|
|
148
|
+
return SummarySettings;
|
|
149
|
+
}(Component);
|
|
150
|
+
export default SummarySettings;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
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 BaseSettings from '../public-setting/base-settings';
|
|
10
|
+
import ToggleSetting from '../public-setting/toggle-setting';
|
|
11
|
+
import SummarySettings from './summary-settings';
|
|
12
|
+
import TimePicker from './timer-picker';
|
|
13
|
+
import BarChartStyle from './style-setting/bar-chart-style-setting';
|
|
14
|
+
import TimeCompareStyle from './style-setting/time-compare-style';
|
|
15
|
+
import ColorPicker from '../color-setting/color-picker';
|
|
16
|
+
import { TIME_COLUMN_LIST } from '../../../constants';
|
|
17
|
+
import styles from '../../../assets/css/statistic-time-picker.module.css';
|
|
18
|
+
var TimeComparisonSettings = /*#__PURE__*/function (_Component) {
|
|
19
|
+
_inherits(TimeComparisonSettings, _Component);
|
|
20
|
+
var _super = _createSuper(TimeComparisonSettings);
|
|
21
|
+
function TimeComparisonSettings(props) {
|
|
22
|
+
var _this;
|
|
23
|
+
_classCallCheck(this, TimeComparisonSettings);
|
|
24
|
+
_this = _super.call(this, props);
|
|
25
|
+
_this.renderGroupbyDateGranularity = function () {
|
|
26
|
+
var _this$props = _this.props,
|
|
27
|
+
dateGranularityOptions = _this$props.dateGranularityOptions,
|
|
28
|
+
groupbyDateGranularity = _this$props.groupbyDateGranularity;
|
|
29
|
+
var selectedDateGranularity = _this.getSelectedDateGranularity(groupbyDateGranularity);
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "statistic-chart-parameter-item"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
33
|
+
value: selectedDateGranularity,
|
|
34
|
+
onChange: _this.onSelectGroupbyDateGranularity,
|
|
35
|
+
options: dateGranularityOptions
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
_this.renderGroupby = function () {
|
|
39
|
+
var statItem = _this.props.statItem;
|
|
40
|
+
var x_axis_column_key = statItem.x_axis_column_key;
|
|
41
|
+
var selectedColumnOption = _this.props.getSelectedColumnOption(x_axis_column_key, _this.columnsOptions);
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "statistic-chart-parameter-item"
|
|
44
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('X-axis')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
45
|
+
placeholder: intl.get('Select_a_column'),
|
|
46
|
+
value: selectedColumnOption,
|
|
47
|
+
onChange: _this.onSelectGroupbyColumn,
|
|
48
|
+
options: _this.columnsOptions
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
_this.renderGroupbyDateGranularity = function () {
|
|
52
|
+
var _this$props2 = _this.props,
|
|
53
|
+
dateGranularityOptions = _this$props2.dateGranularityOptions,
|
|
54
|
+
statItem = _this$props2.statItem;
|
|
55
|
+
dateGranularityOptions = dateGranularityOptions.filter(function (item) {
|
|
56
|
+
return item.value !== 'year';
|
|
57
|
+
});
|
|
58
|
+
var selectedDateGranularity = _this.getSelectedDateGranularity(statItem.x_axis_date_granularity);
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "statistic-chart-parameter-item"
|
|
61
|
+
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
62
|
+
value: selectedDateGranularity,
|
|
63
|
+
onChange: _this.onSelectGroupbyDateGranularity,
|
|
64
|
+
options: dateGranularityOptions
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
_this.onSelectGroupbyDateGranularity = function (dateGranularity) {
|
|
68
|
+
var updated = {
|
|
69
|
+
x_axis_date_granularity: dateGranularity.value
|
|
70
|
+
};
|
|
71
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
|
|
72
|
+
};
|
|
73
|
+
_this.onSelectGroupbyColumn = function (option) {
|
|
74
|
+
var updated = {
|
|
75
|
+
x_axis_column_key: option.value.key
|
|
76
|
+
};
|
|
77
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, updated));
|
|
78
|
+
};
|
|
79
|
+
_this.getSelectedDateGranularity = function (dateGranularity) {
|
|
80
|
+
var dateGranularityOptions = _this.props.dateGranularityOptions;
|
|
81
|
+
return dateGranularityOptions.find(function (g) {
|
|
82
|
+
return g.value === dateGranularity;
|
|
83
|
+
}) || dateGranularityOptions[2];
|
|
84
|
+
};
|
|
85
|
+
_this.onColorChanged = function (color) {
|
|
86
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
87
|
+
increase_line_color: color.hex
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
90
|
+
_this.renderDateRange = function () {
|
|
91
|
+
var statItem = _this.props.statItem;
|
|
92
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: "statistic-chart-parameter-item"
|
|
94
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Date_range')), /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: styles['time-input-container']
|
|
96
|
+
}, /*#__PURE__*/React.createElement(TimePicker, {
|
|
97
|
+
onCommit: function onCommit(value) {
|
|
98
|
+
return _this.updateDate('x_axis_date_range_start', value);
|
|
99
|
+
},
|
|
100
|
+
value: statItem.x_axis_date_range_start
|
|
101
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: styles['concat']
|
|
103
|
+
}, ' - '), /*#__PURE__*/React.createElement(TimePicker, {
|
|
104
|
+
onCommit: function onCommit(value) {
|
|
105
|
+
return _this.updateDate('x_axis_date_range_end', value);
|
|
106
|
+
},
|
|
107
|
+
value: statItem.x_axis_date_range_end
|
|
108
|
+
})));
|
|
109
|
+
};
|
|
110
|
+
_this.renderComparedDateRange = function () {
|
|
111
|
+
var statItem = _this.props.statItem;
|
|
112
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: "statistic-chart-parameter-item"
|
|
114
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Compare_to_date_range')), /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
className: styles['time-input-container']
|
|
116
|
+
}, /*#__PURE__*/React.createElement(TimePicker, {
|
|
117
|
+
onCommit: function onCommit(value) {
|
|
118
|
+
return _this.updateDate('x_axis_compared_date_range_start', value);
|
|
119
|
+
},
|
|
120
|
+
value: statItem.x_axis_compared_date_range_start
|
|
121
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: styles['concat']
|
|
123
|
+
}, ' - '), /*#__PURE__*/React.createElement(TimePicker, {
|
|
124
|
+
onCommit: function onCommit(value) {
|
|
125
|
+
return _this.updateDate('x_axis_compared_date_range_end', value);
|
|
126
|
+
},
|
|
127
|
+
value: statItem.x_axis_compared_date_range_end
|
|
128
|
+
})));
|
|
129
|
+
};
|
|
130
|
+
_this.renderIncrementLineSetting = function () {
|
|
131
|
+
var statItem = _this.props.statItem;
|
|
132
|
+
var display_increase = statItem.display_increase;
|
|
133
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
134
|
+
className: "statistic-chart-parameter-item"
|
|
135
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
136
|
+
isChecked: display_increase || false,
|
|
137
|
+
handleToggleChange: _this.onToggleIncrease,
|
|
138
|
+
label: intl.get('Display_increase')
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
_this.renderColorPicker = function () {
|
|
142
|
+
var _this$props$statItem$ = _this.props.statItem.increase_line_color,
|
|
143
|
+
increase_line_color = _this$props$statItem$ === void 0 ? '#fbd44a' : _this$props$statItem$;
|
|
144
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
className: "statistic-chart-parameter-item"
|
|
146
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Line_color')), /*#__PURE__*/React.createElement(ColorPicker, {
|
|
147
|
+
isPickAllColor: true,
|
|
148
|
+
activeColor: increase_line_color,
|
|
149
|
+
onColorChanged: _this.onColorChanged
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
_this.onToggleIncrease = function () {
|
|
153
|
+
var statItem = _this.props.statItem;
|
|
154
|
+
var display_increase = statItem.display_increase;
|
|
155
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
156
|
+
display_increase: !display_increase
|
|
157
|
+
}));
|
|
158
|
+
};
|
|
159
|
+
_this.updateDate = function (key, date) {
|
|
160
|
+
var statItem = _this.props.statItem;
|
|
161
|
+
_this.props.updateStatItem(Object.assign({}, statItem, _defineProperty({}, key, date)));
|
|
162
|
+
};
|
|
163
|
+
_this.updatedSummaryType = function (summaryType, summaryColumnKey, summaryMethod) {
|
|
164
|
+
var statItem = _this.props.statItem;
|
|
165
|
+
var updated = {
|
|
166
|
+
y_axis_summary_type: summaryType,
|
|
167
|
+
y_axis_column_key: summaryColumnKey,
|
|
168
|
+
y_axis_summary_method: summaryMethod
|
|
169
|
+
};
|
|
170
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
171
|
+
};
|
|
172
|
+
_this.updateSummaryColumn = function (summaryColumnKey) {
|
|
173
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
174
|
+
y_axis_column_key: summaryColumnKey
|
|
175
|
+
}));
|
|
176
|
+
};
|
|
177
|
+
_this.updateSummaryMethod = function (summaryMethod) {
|
|
178
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
179
|
+
y_axis_summary_method: summaryMethod
|
|
180
|
+
}));
|
|
181
|
+
};
|
|
182
|
+
var _statItem = props.statItem,
|
|
183
|
+
generalColumnsOptions = props.generalColumnsOptions;
|
|
184
|
+
var x_axis_date_range_start = _statItem.x_axis_date_range_start,
|
|
185
|
+
x_axis_date_range_end = _statItem.x_axis_date_range_end,
|
|
186
|
+
x_axis_compared_date_range_start = _statItem.x_axis_compared_date_range_start,
|
|
187
|
+
x_axis_compared_date_range_end = _statItem.x_axis_compared_date_range_end;
|
|
188
|
+
_this.state = {
|
|
189
|
+
dateRangeStart: x_axis_date_range_start,
|
|
190
|
+
dateRangeEnd: x_axis_date_range_end,
|
|
191
|
+
comparedDateRangeStart: x_axis_compared_date_range_start,
|
|
192
|
+
comparedDateRangeEnd: x_axis_compared_date_range_end
|
|
193
|
+
};
|
|
194
|
+
_this.columnsOptions = generalColumnsOptions.filter(function (item) {
|
|
195
|
+
return TIME_COLUMN_LIST.includes(item.value.type);
|
|
196
|
+
});
|
|
197
|
+
return _this;
|
|
198
|
+
}
|
|
199
|
+
_createClass(TimeComparisonSettings, [{
|
|
200
|
+
key: "componentWillReceiveProps",
|
|
201
|
+
value: function componentWillReceiveProps(nextProps, props) {
|
|
202
|
+
if (nextProps.selectedTableId !== this.props.selectedTableId || nextProps.generalColumnsOptions !== props.generalColumnsOptions) {
|
|
203
|
+
this.columnsOptions = nextProps.generalColumnsOptions.filter(function (item) {
|
|
204
|
+
return TIME_COLUMN_LIST.includes(item.value.type);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
key: "render",
|
|
210
|
+
value: function render() {
|
|
211
|
+
var _this$props3 = this.props,
|
|
212
|
+
getTableById = _this$props3.getTableById,
|
|
213
|
+
statItem = _this$props3.statItem,
|
|
214
|
+
labelColorConfigs = _this$props3.labelColorConfigs,
|
|
215
|
+
eventBus = _this$props3.eventBus,
|
|
216
|
+
numericColumnsOptions = _this$props3.numericColumnsOptions,
|
|
217
|
+
settingType = _this$props3.settingType;
|
|
218
|
+
var _ref = statItem || {},
|
|
219
|
+
selectedTableId = _ref.table_id,
|
|
220
|
+
selectedViewId = _ref.view_id,
|
|
221
|
+
y_axis_summary_type = _ref.y_axis_summary_type,
|
|
222
|
+
y_axis_column_key = _ref.y_axis_column_key,
|
|
223
|
+
y_axis_summary_method = _ref.y_axis_summary_method;
|
|
224
|
+
if (settingType === 'style') {
|
|
225
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BarChartStyle, {
|
|
226
|
+
hideDisplayDataSetting: false,
|
|
227
|
+
statItem: statItem,
|
|
228
|
+
labelColorConfigs: labelColorConfigs,
|
|
229
|
+
eventBus: eventBus,
|
|
230
|
+
getTableById: getTableById,
|
|
231
|
+
updateStatItem: this.props.updateStatItem
|
|
232
|
+
}), /*#__PURE__*/React.createElement(TimeCompareStyle, {
|
|
233
|
+
statItem: statItem,
|
|
234
|
+
updateStatItem: this.props.updateStatItem
|
|
235
|
+
}), this.renderColorPicker());
|
|
236
|
+
}
|
|
237
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
|
|
238
|
+
statItem: statItem,
|
|
239
|
+
selectedTableId: selectedTableId,
|
|
240
|
+
selectedViewId: selectedViewId,
|
|
241
|
+
getTables: this.props.getTables,
|
|
242
|
+
getViews: this.props.getViews,
|
|
243
|
+
getTableById: this.props.getTableById,
|
|
244
|
+
updateStatItem: this.props.updateStatItem
|
|
245
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
246
|
+
className: "statistic-chart-parameter-divider"
|
|
247
|
+
}), this.renderGroupby(), this.renderGroupbyDateGranularity(), this.renderDateRange(), this.renderComparedDateRange(), /*#__PURE__*/React.createElement("div", {
|
|
248
|
+
className: "statistic-chart-parameter-divider"
|
|
249
|
+
}), /*#__PURE__*/React.createElement(SummarySettings, {
|
|
250
|
+
statItem: statItem,
|
|
251
|
+
label: intl.get('Y-axis'),
|
|
252
|
+
numericColumnsOptions: numericColumnsOptions,
|
|
253
|
+
summaryType: y_axis_summary_type,
|
|
254
|
+
summaryColumnKey: y_axis_column_key,
|
|
255
|
+
summaryMethod: y_axis_summary_method,
|
|
256
|
+
getSelectedColumnOption: this.props.getSelectedColumnOption,
|
|
257
|
+
onChangeSummaryType: this.updatedSummaryType,
|
|
258
|
+
onSelectNumericColumn: this.updateSummaryColumn,
|
|
259
|
+
onSelectSummaryMethod: this.updateSummaryMethod
|
|
260
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
261
|
+
className: "statistic-chart-parameter-divider"
|
|
262
|
+
}), this.renderIncrementLineSetting());
|
|
263
|
+
}
|
|
264
|
+
}]);
|
|
265
|
+
return TimeComparisonSettings;
|
|
266
|
+
}(Component);
|
|
267
|
+
export default TimeComparisonSettings;
|
|
@@ -0,0 +1,109 @@
|
|
|
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 dayjs from 'dayjs';
|
|
7
|
+
import DateEditorPopover from '../public-setting/calender';
|
|
8
|
+
import styles from '../../../assets/css/statistic-time-picker.module.css';
|
|
9
|
+
var DATE_FORMAT = 'YYYY-MM-DD';
|
|
10
|
+
var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
_inherits(TimePicker, _React$Component);
|
|
12
|
+
var _super = _createSuper(TimePicker);
|
|
13
|
+
function TimePicker(props) {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, TimePicker);
|
|
16
|
+
_this = _super.call(this, props);
|
|
17
|
+
_this.onDateEditorToggle = function () {
|
|
18
|
+
_this.setState({
|
|
19
|
+
isPopoverShow: !_this.state.isPopoverShow
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
_this.onValueChanged = function (value) {
|
|
23
|
+
if (value !== _this.props.value) {
|
|
24
|
+
_this.setState({
|
|
25
|
+
value: value
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
_this.handleKeyDown = function (e) {
|
|
30
|
+
if (e.keyCode === 13) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
setTimeout(function () {
|
|
33
|
+
_this.onClosePopover();
|
|
34
|
+
}, 1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
_this.commitAndClosePopover = function () {
|
|
38
|
+
if (_this.state.value !== _this.props.value) {
|
|
39
|
+
_this.onCommit(_this.state.value);
|
|
40
|
+
}
|
|
41
|
+
_this.onClosePopover();
|
|
42
|
+
};
|
|
43
|
+
_this.onCommit = function (newValue) {
|
|
44
|
+
_this.props.onCommit(newValue);
|
|
45
|
+
};
|
|
46
|
+
_this.onClosePopover = function () {
|
|
47
|
+
_this.setState({
|
|
48
|
+
isPopoverShow: false
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
_this.state = {
|
|
52
|
+
isDateInit: false,
|
|
53
|
+
isPopoverShow: false,
|
|
54
|
+
defaultCalendarValue: null,
|
|
55
|
+
value: props.value
|
|
56
|
+
};
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
_createClass(TimePicker, [{
|
|
60
|
+
key: "componentDidMount",
|
|
61
|
+
value: function componentDidMount() {
|
|
62
|
+
var isZhcn = window.dtable && window.dtable.lang === 'zh-cn';
|
|
63
|
+
if (isZhcn) {
|
|
64
|
+
dayjs.locale('zh-cn');
|
|
65
|
+
} else {
|
|
66
|
+
dayjs.locale('en-gb');
|
|
67
|
+
}
|
|
68
|
+
this.setState({
|
|
69
|
+
isDateInit: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "render",
|
|
74
|
+
value: function render() {
|
|
75
|
+
if (!this.state.isDateInit) {
|
|
76
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: "cell-editor date-editor"
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "date-editor-container"
|
|
80
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "control-form"
|
|
82
|
+
})));
|
|
83
|
+
}
|
|
84
|
+
var isPopoverShow = this.state.isPopoverShow;
|
|
85
|
+
var lang = window.dtable && window.dtable.lang || 'zh-cn';
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
onKeyDown: this.handleKeyDown,
|
|
88
|
+
className: styles['date-editor']
|
|
89
|
+
}, !isPopoverShow && /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: styles['date-editor-container']
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "form-control",
|
|
93
|
+
onClick: this.onDateEditorToggle
|
|
94
|
+
}, this.props.value)), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DateEditorPopover, {
|
|
95
|
+
lang: lang,
|
|
96
|
+
value: this.props.value,
|
|
97
|
+
dateFormat: DATE_FORMAT,
|
|
98
|
+
showHourAndMinute: false,
|
|
99
|
+
onValueChanged: this.onValueChanged,
|
|
100
|
+
commitAndClosePopover: this.commitAndClosePopover
|
|
101
|
+
})));
|
|
102
|
+
}
|
|
103
|
+
}]);
|
|
104
|
+
return TimePicker;
|
|
105
|
+
}(React.Component);
|
|
106
|
+
TimePicker.defaultProps = {
|
|
107
|
+
value: ''
|
|
108
|
+
};
|
|
109
|
+
export default TimePicker;
|