dtable-statistic 4.4.24-alpha.9 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/assets/css/color-picker.css +53 -0
- package/es/assets/css/color-rules-popover.css +144 -0
- package/es/assets/css/dashboard.css +0 -1
- package/es/assets/css/dialog.css +0 -30
- 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/calculator/base-calculator.js +80 -0
- package/es/calculator/basic-chart-calculator.js +349 -0
- package/es/calculator/combination-calculator.js +246 -0
- package/es/calculator/compare-bar-calculator.js +197 -0
- package/es/calculator/completeness-calculator.js +215 -0
- package/es/calculator/copy-value.js +53 -0
- package/es/calculator/dashboard-calculator.js +70 -0
- package/es/calculator/heat-map-calculator.js +148 -0
- package/es/calculator/horizontal-bar-calculator.js +67 -0
- package/es/calculator/index.js +81 -0
- package/es/calculator/map-calculator.js +103 -0
- package/es/calculator/mirror-calculator.js +146 -0
- package/es/calculator/number-card-calculator.js +60 -0
- package/es/calculator/pivot-table-calculator.js +821 -0
- package/es/calculator/scatter-calculator.js +75 -0
- package/es/calculator/thread-manager.js +57 -0
- package/es/calculator/trend-calculator.js +113 -0
- package/es/calculator/workers/basic-chart-calculator-worker.js +495 -0
- package/es/calculator/workers/calculator.worker.js +44 -0
- package/es/calculator/workers/card-calculator-worker.js +40 -0
- package/es/calculator/workers/combination-calculator-worker.js +276 -0
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +150 -0
- package/es/calculator/workers/completeness-calculator-worker.js +208 -0
- package/es/calculator/workers/dashboard-calculator-worker.js +68 -0
- package/es/calculator/workers/mirror-calculator-worker.js +152 -0
- package/es/calculator/workers/pivot-table-calculator-worker.js +718 -0
- package/es/calculator/workers/scatter-calculator-worker.js +80 -0
- package/es/calculator/workers/trend-calculator-worker.js +108 -0
- package/es/calculator/world-map-calculator.js +124 -0
- package/es/components/dialog/chart-addition-edit-dialog.js +90 -0
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +259 -0
- package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +83 -0
- package/es/components/dialog/enlarged-chart-dialog.js +13 -8
- package/es/components/dialog/statistic-record-dialog/index.js +34 -25
- package/es/components/dialog/statistic-types-dialog/index.css +14 -0
- package/es/components/dialog/statistic-types-dialog/index.js +62 -0
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +2 -2
- package/es/components/popover/color-rules/color-rule.js +183 -0
- package/es/components/popover/color-rules/index.js +87 -0
- package/es/components/popover/color-rules/rule-filters/filter.js +221 -0
- package/es/components/popover/color-rules/rule-filters/index.css +210 -0
- package/es/components/popover/color-rules/rule-filters/index.js +97 -0
- package/es/components/popover/color-rules/rule-filters/number-input.js +78 -0
- package/es/components/popover/color-rules-popover.js +218 -0
- package/es/components/popover/color-selector-popover.js +83 -0
- package/es/constants/index.js +2 -1
- package/es/custom-g2.js +644 -0
- package/es/dashboard.js +31 -9
- package/es/desktop-dashboard.js +32 -51
- package/es/mobile-dashboard.js +16 -8
- package/es/model/bar-group.js +58 -0
- package/es/model/bar.js +47 -0
- package/es/model/base-model.js +18 -0
- package/es/model/basic-number-card.js +25 -0
- package/es/model/combination.js +48 -0
- package/es/model/compare-bar.js +56 -0
- package/es/model/completeness-group.js +31 -0
- package/es/model/completeness.js +25 -0
- package/es/model/custom-bar.js +25 -0
- package/es/model/dashboard.js +20 -0
- package/es/model/generic-model.js +222 -0
- package/es/model/heat-map.js +33 -0
- package/es/model/horizontal-bar-group.js +55 -0
- package/es/model/horizontal-bar.js +47 -0
- package/es/model/index.js +187 -0
- package/es/model/map.js +38 -0
- package/es/model/mirror.js +33 -0
- package/es/model/pie.js +38 -0
- package/es/model/ring.js +40 -0
- package/es/model/scatter.js +22 -0
- package/es/model/table.js +32 -0
- package/es/model/trend.js +32 -0
- package/es/model/world-map.js +34 -0
- package/es/service/chart-service.js +15 -8
- package/es/service/dashboard-service.js +29 -25
- package/es/stat-editor/chart-name-editor.js +68 -0
- package/es/stat-editor/index.js +75 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +153 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +422 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +203 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +23 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +104 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +334 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +119 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +132 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +240 -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 +138 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +331 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +143 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +109 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +153 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +144 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +214 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +121 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +172 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +366 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +142 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +150 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +473 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +182 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +564 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +112 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +87 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +187 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +300 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +113 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +289 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +58 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +359 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +48 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +121 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +143 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +269 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +104 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +366 -0
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +55 -0
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +130 -0
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +374 -0
- package/es/stat-editor/stat-settings/map/map-level.js +72 -0
- package/es/stat-editor/stat-settings/map/map-province-city.js +151 -0
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +108 -0
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +154 -0
- package/es/stat-editor/stat-settings/public-setting/calender.js +125 -0
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +24 -0
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +62 -0
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +61 -0
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +35 -0
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +60 -0
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +123 -0
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +33 -0
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.css +29 -0
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +82 -0
- package/es/stat-list/chart-preview.js +20 -19
- package/es/stat-list/index.js +21 -15
- package/es/stat-view/area-chart.js +551 -0
- package/es/stat-view/bar-chart.js +582 -0
- package/es/stat-view/base-chart.js +132 -0
- package/es/stat-view/basic-number-card.js +201 -0
- package/es/stat-view/combination-chart.js +546 -0
- package/es/stat-view/compare-chart.js +483 -0
- package/es/stat-view/completeness-chart.js +390 -0
- package/es/stat-view/custom-bar.js +418 -0
- package/es/stat-view/dashboard-chart.js +266 -0
- package/es/stat-view/heat-map.js +463 -0
- package/es/stat-view/horizontal-bar-chart.js +562 -0
- package/es/stat-view/index.js +156 -47
- package/es/stat-view/line-chart.js +518 -0
- package/es/stat-view/map.js +448 -0
- package/es/stat-view/mirror.js +275 -0
- package/es/stat-view/pie-chart.js +290 -0
- package/es/stat-view/pivot-table/index.js +196 -0
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +156 -0
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +176 -0
- package/es/stat-view/pivot-table/pivot-table-display-name.js +215 -0
- package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
- package/es/stat-view/pivot-table/two-dimension-table.js +384 -0
- package/es/stat-view/ring-chart.js +392 -0
- package/es/stat-view/scatter-chart.js +306 -0
- package/es/stat-view/treemap-chart.js +253 -0
- package/es/stat-view/trend-chart.js +249 -0
- package/es/stat-view/world-map.js +431 -0
- package/es/tabs/tab.js +2 -2
- package/es/utils/basic-chart-utils.js +29 -0
- package/es/utils/cell-format.js +115 -0
- package/es/utils/collaborator.js +50 -0
- package/es/utils/color-utils.js +134 -0
- package/es/utils/column-utils.js +110 -0
- package/es/utils/column.js +20 -0
- package/es/utils/common-utils.js +352 -2
- package/es/utils/date-format.js +71 -0
- package/es/utils/export-table-utils.js +69 -0
- package/es/utils/index.js +89 -12
- package/es/utils/map.js +114 -0
- package/es/utils/model.js +19 -0
- package/es/utils/row-utils.js +134 -0
- package/es/utils/search.js +73 -0
- package/es/utils/sql-utils.js +359 -0
- package/es/utils/stat-utils.js +351 -0
- package/es/utils/trend-utils.js +135 -0
- package/package.json +8 -6
- package/es/components/dialog/chart-edit-dialog.js +0 -93
- package/es/components/dtable-popover.js +0 -97
- package/es/components/dtable-search-input.js +0 -135
- package/es/components/index.js +0 -41
- package/es/components/loading.js +0 -15
- package/es/components/modal-portal.js +0 -26
- package/es/model/conver-statItem.js +0 -124
package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactstrap = require("reactstrap");
|
|
11
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
12
|
+
var _dtableUtils = require("dtable-utils");
|
|
13
|
+
var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
|
|
14
|
+
var _toggleSetting = _interopRequireDefault(require("../../public-setting/toggle-setting"));
|
|
15
|
+
var _colorUseTypeSelector = _interopRequireDefault(require("../../color-setting/color-use-type-selector"));
|
|
16
|
+
var _labelFontSizeEditor = _interopRequireDefault(require("./label-font-size-editor"));
|
|
17
|
+
var _constants = require("../../../../constants");
|
|
18
|
+
class PieStyleSettings extends _react.Component {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.renderShowLegend = () => {
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
+
className: "statistic-chart-parameter-item"
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement(_toggleSetting.default, {
|
|
25
|
+
isChecked: this.props.statItem.show_legend || false,
|
|
26
|
+
handleToggleChange: this.onToggleShowLegend,
|
|
27
|
+
label: _reactIntlUniversal.default.get('Display_legend')
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
this.replaceNumberNotAllowInput = value => {
|
|
31
|
+
if (!value) {
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
value = value.replace(/。/g, '.');
|
|
35
|
+
value = value.replace(/-/g, '');
|
|
36
|
+
return value.replace(/[^.-\d,]/g, '');
|
|
37
|
+
};
|
|
38
|
+
this.renderMinimumPercent = () => {
|
|
39
|
+
const {
|
|
40
|
+
minimumSlicePercent
|
|
41
|
+
} = this.state;
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: "statistic-chart-parameter-item"
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Form, null, /*#__PURE__*/_react.default.createElement(_reactstrap.FormGroup, null, /*#__PURE__*/_react.default.createElement(_reactstrap.Label, {
|
|
45
|
+
for: "percent"
|
|
46
|
+
}, _reactIntlUniversal.default.get('Minimum_slice_percent')), /*#__PURE__*/_react.default.createElement("input", {
|
|
47
|
+
className: "form-control",
|
|
48
|
+
id: "percent",
|
|
49
|
+
ref: ref => this.inputRef = ref,
|
|
50
|
+
type: "text",
|
|
51
|
+
autoComplete: "off",
|
|
52
|
+
onKeyDown: this.onKeyDown,
|
|
53
|
+
onBlur: this.onBlur,
|
|
54
|
+
value: minimumSlicePercent,
|
|
55
|
+
onChange: this.onPercentChange
|
|
56
|
+
}))));
|
|
57
|
+
};
|
|
58
|
+
this.labelFontSizeEditor = () => {
|
|
59
|
+
const {
|
|
60
|
+
statItem
|
|
61
|
+
} = this.props;
|
|
62
|
+
const {
|
|
63
|
+
label_font_size
|
|
64
|
+
} = statItem;
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
66
|
+
className: "statistic-chart-parameter-item"
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(_labelFontSizeEditor.default, {
|
|
68
|
+
fontSize: label_font_size,
|
|
69
|
+
onChangeFontSize: this.onChangeLabelFontSize
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
this.onKeyDown = event => {
|
|
73
|
+
if (event.keyCode === 13) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
this.inputRef.blur();
|
|
76
|
+
this.onCommit();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
this.onPercentChange = e => {
|
|
80
|
+
let value = e.target.value;
|
|
81
|
+
value = this.replaceNumberNotAllowInput(value);
|
|
82
|
+
this.setState({
|
|
83
|
+
minimumSlicePercent: value
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
this.onBlur = () => {
|
|
87
|
+
this.onCommit();
|
|
88
|
+
};
|
|
89
|
+
this.onCommit = () => {
|
|
90
|
+
const {
|
|
91
|
+
statItem
|
|
92
|
+
} = this.props;
|
|
93
|
+
let {
|
|
94
|
+
minimumSlicePercent
|
|
95
|
+
} = this.state;
|
|
96
|
+
if (minimumSlicePercent > 100) {
|
|
97
|
+
minimumSlicePercent = 100;
|
|
98
|
+
}
|
|
99
|
+
this.setState({
|
|
100
|
+
minimumSlicePercent: Number(minimumSlicePercent)
|
|
101
|
+
});
|
|
102
|
+
if (minimumSlicePercent === statItem.minimum_slice_percent) return;
|
|
103
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
104
|
+
minimum_slice_percent: Number(minimumSlicePercent)
|
|
105
|
+
}));
|
|
106
|
+
};
|
|
107
|
+
this.onToggleShowLegend = () => {
|
|
108
|
+
let {
|
|
109
|
+
statItem
|
|
110
|
+
} = this.props;
|
|
111
|
+
let show_legend = !statItem.show_legend;
|
|
112
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
113
|
+
show_legend
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
this.onChangeLabelFontSize = label_font_size => {
|
|
117
|
+
const {
|
|
118
|
+
statItem
|
|
119
|
+
} = this.props;
|
|
120
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
121
|
+
label_font_size
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
this.getLabelFormatOptions = () => {
|
|
125
|
+
const options = _constants.LABEL_FORMATS.map(item => {
|
|
126
|
+
return {
|
|
127
|
+
value: item,
|
|
128
|
+
label: /*#__PURE__*/_react.default.createElement("span", {
|
|
129
|
+
className: 'select-module select-module-name'
|
|
130
|
+
}, _reactIntlUniversal.default.get(_constants.LABEL_FORMATS_MAP[item]))
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
return options;
|
|
134
|
+
};
|
|
135
|
+
this.getSelectedLabelFormat = () => {
|
|
136
|
+
const options = this.labelFormatOptions;
|
|
137
|
+
const {
|
|
138
|
+
show_percent,
|
|
139
|
+
label_format
|
|
140
|
+
} = this.props.statItem;
|
|
141
|
+
|
|
142
|
+
// be compatible with `show_percent`(the previous `display percent` setting option)
|
|
143
|
+
if (show_percent) {
|
|
144
|
+
return options[0]; // the 'percent' option
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return options.filter(option => option.value === label_format)[0] || options[0];
|
|
148
|
+
};
|
|
149
|
+
this.onSelectLabelFormat = option => {
|
|
150
|
+
const {
|
|
151
|
+
statItem
|
|
152
|
+
} = this.props;
|
|
153
|
+
const newObj = {
|
|
154
|
+
label_format: option.value
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// make `show_percent` no longer work (as there is a 'percent' option in this 'label format selector')
|
|
158
|
+
const {
|
|
159
|
+
show_percent
|
|
160
|
+
} = statItem;
|
|
161
|
+
if (show_percent) {
|
|
162
|
+
newObj.show_percent = false;
|
|
163
|
+
}
|
|
164
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, newObj));
|
|
165
|
+
};
|
|
166
|
+
this.renderLabelFormatSelector = () => {
|
|
167
|
+
let selectedOption = this.getSelectedLabelFormat();
|
|
168
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
169
|
+
className: "statistic-chart-parameter-item"
|
|
170
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Label_format')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
|
|
171
|
+
value: selectedOption,
|
|
172
|
+
onChange: this.onSelectLabelFormat,
|
|
173
|
+
options: this.labelFormatOptions
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
this.getLabelPositionOptions = () => {
|
|
177
|
+
const options = _constants.LABEL_POSITIONS.map(item => {
|
|
178
|
+
return {
|
|
179
|
+
value: item,
|
|
180
|
+
label: /*#__PURE__*/_react.default.createElement("span", {
|
|
181
|
+
className: 'select-module select-module-name'
|
|
182
|
+
}, _reactIntlUniversal.default.get(_constants.LABEL_POSITIONS_MAP[item]))
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
return options;
|
|
186
|
+
};
|
|
187
|
+
this.getSelectedLabelPosition = () => {
|
|
188
|
+
const options = this.labelPositionOptions;
|
|
189
|
+
const {
|
|
190
|
+
label_position
|
|
191
|
+
} = this.props.statItem;
|
|
192
|
+
return options.filter(option => option.value === label_position)[0] || options[0];
|
|
193
|
+
};
|
|
194
|
+
this.onSelectLabelPosition = option => {
|
|
195
|
+
const {
|
|
196
|
+
statItem
|
|
197
|
+
} = this.props;
|
|
198
|
+
const newObj = {
|
|
199
|
+
label_position: option.value
|
|
200
|
+
};
|
|
201
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, newObj));
|
|
202
|
+
};
|
|
203
|
+
this.renderLabelPositionSelector = () => {
|
|
204
|
+
let selectedOption = this.getSelectedLabelPosition();
|
|
205
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
206
|
+
className: "statistic-chart-parameter-item"
|
|
207
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Label_position')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
|
|
208
|
+
value: selectedOption,
|
|
209
|
+
onChange: this.onSelectLabelPosition,
|
|
210
|
+
options: this.labelPositionOptions
|
|
211
|
+
}));
|
|
212
|
+
};
|
|
213
|
+
this.onToggleDisplayLabel = () => {
|
|
214
|
+
const {
|
|
215
|
+
statItem
|
|
216
|
+
} = this.props;
|
|
217
|
+
const {
|
|
218
|
+
display_label,
|
|
219
|
+
show_percent
|
|
220
|
+
} = statItem;
|
|
221
|
+
let newObj;
|
|
222
|
+
// be compatible with the previous `show_percent`(the `display percent` option)
|
|
223
|
+
if (show_percent) {
|
|
224
|
+
newObj = {
|
|
225
|
+
show_percent: false,
|
|
226
|
+
display_label: false
|
|
227
|
+
};
|
|
228
|
+
} else {
|
|
229
|
+
newObj = {
|
|
230
|
+
display_label: !display_label
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, newObj));
|
|
234
|
+
};
|
|
235
|
+
this.renderDisplayLabel = () => {
|
|
236
|
+
const {
|
|
237
|
+
statItem
|
|
238
|
+
} = this.props;
|
|
239
|
+
let {
|
|
240
|
+
show_percent,
|
|
241
|
+
display_label
|
|
242
|
+
} = statItem;
|
|
243
|
+
// be compatible with the previous `show_percent`(the `display percent` option)
|
|
244
|
+
if (show_percent) {
|
|
245
|
+
display_label = true;
|
|
246
|
+
}
|
|
247
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
248
|
+
className: "statistic-chart-parameter-item"
|
|
249
|
+
}, /*#__PURE__*/_react.default.createElement(_toggleSetting.default, {
|
|
250
|
+
isChecked: display_label || false,
|
|
251
|
+
handleToggleChange: this.onToggleDisplayLabel,
|
|
252
|
+
label: _reactIntlUniversal.default.get('Display_label')
|
|
253
|
+
}));
|
|
254
|
+
};
|
|
255
|
+
this.displayColorSelector = () => {
|
|
256
|
+
const {
|
|
257
|
+
getTableById,
|
|
258
|
+
statItem
|
|
259
|
+
} = this.props;
|
|
260
|
+
const {
|
|
261
|
+
table_id,
|
|
262
|
+
groupby_column_key
|
|
263
|
+
} = statItem;
|
|
264
|
+
if (!groupby_column_key) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
const table = getTableById(table_id);
|
|
268
|
+
const groupByColumn = (0, _dtableUtils.getTableColumnByKey)(table, groupby_column_key);
|
|
269
|
+
const {
|
|
270
|
+
type: columnType
|
|
271
|
+
} = groupByColumn;
|
|
272
|
+
if (columnType === _dtableUtils.CellType.SINGLE_SELECT) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
return false;
|
|
276
|
+
};
|
|
277
|
+
this.renderDisplayAnnotation = () => {
|
|
278
|
+
const display_annotation = this.getDisplayAnnotation();
|
|
279
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
280
|
+
className: "statistic-chart-parameter-item"
|
|
281
|
+
}, /*#__PURE__*/_react.default.createElement(_toggleSetting.default, {
|
|
282
|
+
isChecked: display_annotation,
|
|
283
|
+
handleToggleChange: this.onToggleDisplayAnnotation,
|
|
284
|
+
label: _reactIntlUniversal.default.get('Display_annotation')
|
|
285
|
+
}));
|
|
286
|
+
};
|
|
287
|
+
this.onToggleDisplayAnnotation = e => {
|
|
288
|
+
const {
|
|
289
|
+
statItem
|
|
290
|
+
} = this.props;
|
|
291
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
292
|
+
display_annotation: e.target.checked
|
|
293
|
+
}));
|
|
294
|
+
};
|
|
295
|
+
this.getDisplayAnnotation = () => {
|
|
296
|
+
const {
|
|
297
|
+
statItem
|
|
298
|
+
} = this.props;
|
|
299
|
+
let {
|
|
300
|
+
display_annotation
|
|
301
|
+
} = statItem;
|
|
302
|
+
// for stat items created before `display_annotation` was added.
|
|
303
|
+
if (display_annotation === undefined || display_annotation === null) {
|
|
304
|
+
display_annotation = true;
|
|
305
|
+
}
|
|
306
|
+
return display_annotation;
|
|
307
|
+
};
|
|
308
|
+
this.renderAnnotationFontSizeEditor = () => {
|
|
309
|
+
const {
|
|
310
|
+
statItem
|
|
311
|
+
} = this.props;
|
|
312
|
+
const {
|
|
313
|
+
annotation_font_size
|
|
314
|
+
} = statItem;
|
|
315
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
316
|
+
className: "statistic-chart-parameter-item"
|
|
317
|
+
}, /*#__PURE__*/_react.default.createElement(_labelFontSizeEditor.default, {
|
|
318
|
+
id: 'annotation-font-size',
|
|
319
|
+
labelText: _reactIntlUniversal.default.get('Font_size'),
|
|
320
|
+
fontSize: annotation_font_size || _constants.DEFAULT_ANNOTATION_SIZE,
|
|
321
|
+
onChangeFontSize: this.onChangeAnnotationFontSize
|
|
322
|
+
}));
|
|
323
|
+
};
|
|
324
|
+
this.onChangeAnnotationFontSize = annotation_font_size => {
|
|
325
|
+
const {
|
|
326
|
+
statItem
|
|
327
|
+
} = this.props;
|
|
328
|
+
this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
329
|
+
annotation_font_size
|
|
330
|
+
}));
|
|
331
|
+
};
|
|
332
|
+
this.labelFormatOptions = this.getLabelFormatOptions();
|
|
333
|
+
this.labelPositionOptions = this.getLabelPositionOptions();
|
|
334
|
+
let _minimumSlicePercent = typeof props.statItem.minimum_slice_percent === 'number' ? props.statItem.minimum_slice_percent : 1.5;
|
|
335
|
+
this.state = {
|
|
336
|
+
minimumSlicePercent: _minimumSlicePercent
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
render() {
|
|
340
|
+
const {
|
|
341
|
+
statItem
|
|
342
|
+
} = this.props;
|
|
343
|
+
const {
|
|
344
|
+
show_percent,
|
|
345
|
+
display_label
|
|
346
|
+
} = statItem;
|
|
347
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, this.renderShowLegend(), /*#__PURE__*/_react.default.createElement("div", {
|
|
348
|
+
className: "statistic-chart-parameter-divider"
|
|
349
|
+
}), this.renderDisplayLabel(), (show_percent || display_label) && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, this.renderLabelPositionSelector(), this.renderLabelFormatSelector(), this.renderMinimumPercent(), this.labelFontSizeEditor()), statItem.type === _constants.STAT_TYPE.RING && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
350
|
+
className: "statistic-chart-parameter-divider"
|
|
351
|
+
}), this.renderDisplayAnnotation(), this.getDisplayAnnotation() && this.renderAnnotationFontSizeEditor()), this.displayColorSelector() && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
352
|
+
className: "statistic-chart-parameter-divider"
|
|
353
|
+
}), /*#__PURE__*/_react.default.createElement(_colorUseTypeSelector.default, {
|
|
354
|
+
chart: statItem,
|
|
355
|
+
updateChart: this.props.updateStatisticsSettings
|
|
356
|
+
})));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
var _default = exports.default = PieStyleSettings;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _toggleSetting = _interopRequireDefault(require("../../public-setting/toggle-setting"));
|
|
12
|
+
class TimeCompareStyle extends _react.Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.onToggleIncreaseLabel = () => {
|
|
16
|
+
const {
|
|
17
|
+
statItem,
|
|
18
|
+
updateStatItem
|
|
19
|
+
} = this.props;
|
|
20
|
+
const {
|
|
21
|
+
display_increase_percentage
|
|
22
|
+
} = statItem;
|
|
23
|
+
updateStatItem(Object.assign({}, statItem, {
|
|
24
|
+
display_increase_percentage: !display_increase_percentage
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
const {
|
|
30
|
+
statItem
|
|
31
|
+
} = this.props;
|
|
32
|
+
const {
|
|
33
|
+
display_increase,
|
|
34
|
+
display_increase_percentage
|
|
35
|
+
} = statItem;
|
|
36
|
+
if (!display_increase) return null;
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
className: "statistic-chart-parameter-divider"
|
|
39
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: "statistic-chart-parameter-item"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_toggleSetting.default, {
|
|
42
|
+
isChecked: display_increase_percentage || false,
|
|
43
|
+
handleToggleChange: this.onToggleIncreaseLabel,
|
|
44
|
+
label: _reactIntlUniversal.default.get('Display_percentage_increase')
|
|
45
|
+
})));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
var _default = exports.default = TimeCompareStyle;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
|
|
12
|
+
var _constants = require("../../../constants");
|
|
13
|
+
const DATE_COLUMN_SUMMARY_METHOD = ['Max', 'Min'];
|
|
14
|
+
class SummaryMethodSettings extends _react.Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.renderNumericColumn = () => {
|
|
18
|
+
let {
|
|
19
|
+
summaryColumnKey,
|
|
20
|
+
numericColumnsOptions,
|
|
21
|
+
statItem
|
|
22
|
+
} = this.props;
|
|
23
|
+
let selectedColumnOption = this.props.getSelectedColumnOption(summaryColumnKey, numericColumnsOptions);
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: "statistic-chart-parameter-item"
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, statItem.type === _constants.STAT_TYPE.PIVOT_TABLE ? _reactIntlUniversal.default.get('Summary_column') : _reactIntlUniversal.default.get('Numeric_column')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
|
|
27
|
+
value: selectedColumnOption,
|
|
28
|
+
onChange: this.onSelectNumericColumn,
|
|
29
|
+
options: numericColumnsOptions,
|
|
30
|
+
placeholder: _reactIntlUniversal.default.get('Select_column'),
|
|
31
|
+
noOptionsMessage: () => {
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement("span", null, _reactIntlUniversal.default.get('No_options'));
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
this.renderSummaryMethod = () => {
|
|
37
|
+
let {
|
|
38
|
+
summaryColumnKey,
|
|
39
|
+
numericColumnsOptions,
|
|
40
|
+
summaryMethod
|
|
41
|
+
} = this.props;
|
|
42
|
+
let selectedMethodOption = this.getSelectedMethodOption(summaryMethod, this.summaryMethodsOptions);
|
|
43
|
+
let summaryMethodOption = this.summaryMethodsOptions;
|
|
44
|
+
let selectedColumnOption = this.props.getSelectedColumnOption(summaryColumnKey, numericColumnsOptions);
|
|
45
|
+
if (selectedColumnOption && _constants.TIME_COLUMN_LIST.includes(selectedColumnOption.value.type)) {
|
|
46
|
+
summaryMethodOption = summaryMethodOption.filter(option => {
|
|
47
|
+
return option.value === DATE_COLUMN_SUMMARY_METHOD[0] || option.value === DATE_COLUMN_SUMMARY_METHOD[1];
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
+
className: "statistic-chart-parameter-item"
|
|
52
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Summary_method')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
|
|
53
|
+
value: selectedMethodOption,
|
|
54
|
+
onChange: this.onSelectSummaryMethod,
|
|
55
|
+
options: summaryMethodOption
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
this.getSummaryMethodsOptions = () => {
|
|
59
|
+
return _constants.SUMMARY_METHOD.map(m => {
|
|
60
|
+
return {
|
|
61
|
+
value: m,
|
|
62
|
+
label: /*#__PURE__*/_react.default.createElement("span", {
|
|
63
|
+
className: 'select-module select-module-name'
|
|
64
|
+
}, _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[m]))
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
this.getSelectedMethodOption = (method, summaryMethodsOptions) => {
|
|
69
|
+
return summaryMethodsOptions.find(m => m.value === method) || summaryMethodsOptions[0];
|
|
70
|
+
};
|
|
71
|
+
this.onChangeSummaryType = option => {
|
|
72
|
+
const type = option.value;
|
|
73
|
+
let {
|
|
74
|
+
summaryType,
|
|
75
|
+
numericColumnsOptions
|
|
76
|
+
} = this.props;
|
|
77
|
+
if (type === summaryType) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
let summaryColumnKey = null;
|
|
81
|
+
let summaryMethod = null;
|
|
82
|
+
if (type === _constants.STATISTICS_COUNT_TYPE.ADVANCED && Array.isArray(numericColumnsOptions) && numericColumnsOptions.length > 0) {
|
|
83
|
+
summaryColumnKey = numericColumnsOptions[0].value.key;
|
|
84
|
+
summaryMethod = _constants.SUMMARY_METHOD[0];
|
|
85
|
+
}
|
|
86
|
+
this.props.onChangeSummaryType(type, summaryColumnKey, summaryMethod);
|
|
87
|
+
};
|
|
88
|
+
this.onSelectNumericColumn = columnOption => {
|
|
89
|
+
let newSummaryColumnKey = columnOption.value.key;
|
|
90
|
+
if (newSummaryColumnKey === this.props.summaryColumnKey) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const {
|
|
94
|
+
statItem,
|
|
95
|
+
updateStatItem,
|
|
96
|
+
onSelectNumericColumn
|
|
97
|
+
} = this.props;
|
|
98
|
+
const newSummaryColumnType = columnOption.value.type;
|
|
99
|
+
if (_constants.TIME_COLUMN_LIST.includes(newSummaryColumnType) && !DATE_COLUMN_SUMMARY_METHOD.includes(this.props.summaryMethod)) {
|
|
100
|
+
updateStatItem(Object.assign({}, statItem, {
|
|
101
|
+
summary_method: DATE_COLUMN_SUMMARY_METHOD[1],
|
|
102
|
+
summary_column_key: newSummaryColumnKey
|
|
103
|
+
}));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
onSelectNumericColumn(newSummaryColumnKey);
|
|
107
|
+
};
|
|
108
|
+
this.onSelectSummaryMethod = summaryMethodOption => {
|
|
109
|
+
let newSummaryMethod = summaryMethodOption.value;
|
|
110
|
+
if (newSummaryMethod === this.props.summaryMethod) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.props.onSelectSummaryMethod(newSummaryMethod);
|
|
114
|
+
};
|
|
115
|
+
this.summaryMethodsOptions = this.getSummaryMethodsOptions();
|
|
116
|
+
}
|
|
117
|
+
render() {
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, this.renderNumericColumn(), this.renderSummaryMethod());
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
var _default = exports.default = SummaryMethodSettings;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
+
var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
|
|
12
|
+
var _constants = require("../../../constants");
|
|
13
|
+
const SUMMARY_TYPES = [_constants.SUMMARY_TYPE.COUNT, _constants.SUMMARY_TYPE.ADVANCED];
|
|
14
|
+
class SummarySettings extends _react.Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.getSummaryTypeOptions = () => {
|
|
18
|
+
const summaryExplanation = this.getSummaryExplanation();
|
|
19
|
+
return SUMMARY_TYPES.map((type, index) => {
|
|
20
|
+
return {
|
|
21
|
+
value: type,
|
|
22
|
+
label: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
+
className: 'select-module select-module-name'
|
|
24
|
+
}, _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[type])), /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: "summary-type-explanation"
|
|
26
|
+
}, summaryExplanation[type]))
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
this.getSummaryExplanation = () => {
|
|
31
|
+
const {
|
|
32
|
+
statItem
|
|
33
|
+
} = this.props;
|
|
34
|
+
const {
|
|
35
|
+
type
|
|
36
|
+
} = statItem;
|
|
37
|
+
if (type === _constants.STAT_TYPE.PIE || type === _constants.STAT_TYPE.RING || type === _constants.STAT_TYPE.TREEMAP) {
|
|
38
|
+
return {
|
|
39
|
+
count: _reactIntlUniversal.default.get('Count_the_number_of_records_in_each_group'),
|
|
40
|
+
advanced: _reactIntlUniversal.default.get('Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_a_field')
|
|
41
|
+
};
|
|
42
|
+
} else if (type === _constants.STAT_TYPE.HORIZONTAL_BAR) {
|
|
43
|
+
return {
|
|
44
|
+
count: _reactIntlUniversal.default.get('Group_the_records_according_to_the_vertical_axis_and_count_the_records_in_each_group'),
|
|
45
|
+
advanced: _reactIntlUniversal.default.get('Group_the_records_according_to_the_vertical_axis_and_compute_the_sum_maximum_or_minimum_of_records_in_each_group_by_a_field')
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
count: _reactIntlUniversal.default.get('Count_the_records'),
|
|
50
|
+
advanced: _reactIntlUniversal.default.get('Compute_sum_max_min')
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
this.renderSummaryTypes = () => {
|
|
54
|
+
let {
|
|
55
|
+
summaryType,
|
|
56
|
+
label
|
|
57
|
+
} = this.props;
|
|
58
|
+
summaryType = summaryType || 'count';
|
|
59
|
+
const selectedSummaryMethod = this.summaryTypeOptions.find(item => item.value === summaryType) || this.summaryTypeOptions[0];
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
61
|
+
className: "statistic-chart-parameter-item"
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, label), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
|
|
63
|
+
classNamePrefix: 'statistic-chart-summary-types',
|
|
64
|
+
value: selectedSummaryMethod,
|
|
65
|
+
onChange: this.onChangeSummaryType,
|
|
66
|
+
options: this.summaryTypeOptions
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
this.renderNumericColumn = () => {
|
|
70
|
+
const {
|
|
71
|
+
summaryColumnKey,
|
|
72
|
+
numericColumnsOptions
|
|
73
|
+
} = this.props;
|
|
74
|
+
const selectedColumnOption = this.props.getSelectedColumnOption(summaryColumnKey, numericColumnsOptions);
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
+
className: "statistic-chart-parameter-item"
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Numeric_column')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
|
|
78
|
+
value: selectedColumnOption,
|
|
79
|
+
onChange: this.onSelectNumericColumn,
|
|
80
|
+
options: numericColumnsOptions,
|
|
81
|
+
placeholder: _reactIntlUniversal.default.get('Select_column'),
|
|
82
|
+
noOptionsMessage: () => {
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement("span", null, _reactIntlUniversal.default.get('No_options'));
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
this.renderSummaryMethod = () => {
|
|
88
|
+
const selectedMethodOption = this.getSelectedMethodOption(this.props.summaryMethod, this.summaryMethodsOptions);
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
className: "statistic-chart-parameter-item"
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Summary_method')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
|
|
92
|
+
value: selectedMethodOption,
|
|
93
|
+
onChange: this.onSelectSummaryMethod,
|
|
94
|
+
options: this.summaryMethodsOptions
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
this.getSummaryMethodsOptions = () => {
|
|
98
|
+
return _constants.SUMMARY_METHOD.map(m => {
|
|
99
|
+
return {
|
|
100
|
+
value: m,
|
|
101
|
+
label: /*#__PURE__*/_react.default.createElement("span", {
|
|
102
|
+
className: 'select-module select-module-name'
|
|
103
|
+
}, _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[m]))
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
this.getSelectedMethodOption = (method, summaryMethodsOptions) => {
|
|
108
|
+
return summaryMethodsOptions.find(m => m.value === method) || summaryMethodsOptions[0];
|
|
109
|
+
};
|
|
110
|
+
this.onChangeSummaryType = option => {
|
|
111
|
+
const type = option.value;
|
|
112
|
+
const {
|
|
113
|
+
summaryType
|
|
114
|
+
} = this.props;
|
|
115
|
+
if (type === summaryType) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const summaryColumnKey = null;
|
|
119
|
+
const summaryMethod = type === _constants.STATISTICS_COUNT_TYPE.ADVANCED ? _constants.SUMMARY_METHOD[0] : null;
|
|
120
|
+
this.props.onChangeSummaryType(type, summaryColumnKey, summaryMethod);
|
|
121
|
+
};
|
|
122
|
+
this.onSelectNumericColumn = columnOption => {
|
|
123
|
+
let newSummaryColumnKey = columnOption.value.key;
|
|
124
|
+
if (newSummaryColumnKey === this.props.summaryColumnKey) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this.props.onSelectNumericColumn(newSummaryColumnKey);
|
|
128
|
+
};
|
|
129
|
+
this.onSelectSummaryMethod = summaryMethodOption => {
|
|
130
|
+
let newSummaryMethod = summaryMethodOption.value;
|
|
131
|
+
if (newSummaryMethod === this.props.summaryMethod) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
this.props.onSelectSummaryMethod(newSummaryMethod);
|
|
135
|
+
};
|
|
136
|
+
this.summaryMethodsOptions = this.getSummaryMethodsOptions();
|
|
137
|
+
this.summaryTypeOptions = this.getSummaryTypeOptions();
|
|
138
|
+
}
|
|
139
|
+
render() {
|
|
140
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, this.renderSummaryTypes(), this.props.summaryType === _constants.STATISTICS_COUNT_TYPE.ADVANCED && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, this.renderNumericColumn(), this.renderSummaryMethod()));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
var _default = exports.default = SummarySettings;
|