dtable-statistic 4.4.24 → 5.0.0-alpha.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/dashboard.css +1 -0
- package/es/assets/css/dialog.css +35 -0
- package/es/components/dialog/chart-edit-dialog.js +93 -0
- package/es/components/dialog/enlarged-chart-dialog.js +8 -13
- package/es/components/dialog/statistic-record-dialog/index.js +26 -33
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +2 -2
- package/es/constants/index.js +3 -499
- package/es/dashboard.js +9 -87
- package/es/desktop-dashboard.js +51 -32
- package/es/index.js +56 -1
- package/es/mobile-dashboard.js +8 -16
- package/es/model/conver-statItem.js +124 -0
- package/es/service/chart-service.js +8 -27
- package/es/service/dashboard-service.js +25 -29
- package/es/stat-list/chart-preview.js +19 -20
- package/es/stat-list/index.js +15 -21
- package/es/stat-view/index.js +47 -156
- package/es/tabs/tab.js +17 -14
- package/es/utils/common-utils.js +2 -352
- package/es/utils/export-table-utils.js +0 -69
- package/es/utils/index.js +0 -89
- package/package.json +5 -7
- package/es/assets/css/color-picker.css +0 -53
- package/es/assets/css/color-rules-popover.css +0 -144
- package/es/assets/css/slider.css +0 -77
- package/es/assets/css/statistic-chart.module.css +0 -11
- package/es/assets/css/statistic-custom-title.module.css +0 -3
- package/es/assets/css/statistic-custom.module.css +0 -4
- package/es/assets/css/statistic-numeric-column-item.module.css +0 -43
- package/es/assets/css/statistic-time-picker.module.css +0 -21
- package/es/calculator/base-calculator.js +0 -80
- package/es/calculator/basic-chart-calculator.js +0 -349
- package/es/calculator/combination-calculator.js +0 -246
- package/es/calculator/compare-bar-calculator.js +0 -197
- package/es/calculator/completeness-calculator.js +0 -215
- package/es/calculator/copy-value.js +0 -53
- package/es/calculator/dashboard-calculator.js +0 -70
- package/es/calculator/heat-map-calculator.js +0 -148
- package/es/calculator/horizontal-bar-calculator.js +0 -67
- package/es/calculator/index.js +0 -81
- package/es/calculator/map-calculator.js +0 -103
- package/es/calculator/mirror-calculator.js +0 -146
- package/es/calculator/number-card-calculator.js +0 -60
- package/es/calculator/pivot-table-calculator.js +0 -821
- package/es/calculator/scatter-calculator.js +0 -75
- package/es/calculator/thread-manager.js +0 -57
- package/es/calculator/trend-calculator.js +0 -113
- package/es/calculator/workers/basic-chart-calculator-worker.js +0 -495
- package/es/calculator/workers/calculator.worker.js +0 -44
- package/es/calculator/workers/card-calculator-worker.js +0 -40
- package/es/calculator/workers/combination-calculator-worker.js +0 -276
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +0 -150
- package/es/calculator/workers/completeness-calculator-worker.js +0 -208
- package/es/calculator/workers/dashboard-calculator-worker.js +0 -68
- package/es/calculator/workers/mirror-calculator-worker.js +0 -152
- package/es/calculator/workers/pivot-table-calculator-worker.js +0 -718
- package/es/calculator/workers/scatter-calculator-worker.js +0 -80
- package/es/calculator/workers/trend-calculator-worker.js +0 -108
- package/es/calculator/world-map-calculator.js +0 -124
- package/es/components/common-add-tool.js +0 -28
- package/es/components/dialog/chart-addition-edit-dialog.js +0 -90
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +0 -259
- package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +0 -83
- package/es/components/dialog/statistic-types-dialog/index.css +0 -14
- package/es/components/dialog/statistic-types-dialog/index.js +0 -62
- package/es/components/dtable-popover.js +0 -97
- package/es/components/dtable-search-input.js +0 -135
- package/es/components/index.js +0 -55
- package/es/components/loading.js +0 -15
- package/es/components/modal-portal.js +0 -26
- package/es/components/popover/color-rules/color-rule.js +0 -183
- package/es/components/popover/color-rules/index.js +0 -87
- package/es/components/popover/color-rules/rule-filters/filter.js +0 -221
- package/es/components/popover/color-rules/rule-filters/index.css +0 -210
- package/es/components/popover/color-rules/rule-filters/index.js +0 -97
- package/es/components/popover/color-rules/rule-filters/number-input.js +0 -78
- package/es/components/popover/color-rules-popover.js +0 -217
- package/es/components/popover/color-selector-popover.js +0 -82
- package/es/components/seatable-radio/index.css +0 -51
- package/es/components/seatable-radio/index.js +0 -35
- package/es/constants/color-rules.js +0 -17
- package/es/constants/map.js +0 -13
- package/es/constants/model.js +0 -26
- package/es/constants/regions.js +0 -2111
- package/es/constants/zIndexes.js +0 -7
- package/es/custom-g2.js +0 -644
- package/es/model/bar-group.js +0 -58
- package/es/model/bar.js +0 -47
- package/es/model/base-model.js +0 -18
- package/es/model/basic-number-card.js +0 -25
- package/es/model/combination.js +0 -48
- package/es/model/compare-bar.js +0 -56
- package/es/model/completeness-group.js +0 -31
- package/es/model/completeness.js +0 -25
- package/es/model/custom-bar.js +0 -25
- package/es/model/dashboard.js +0 -20
- package/es/model/generic-model.js +0 -222
- package/es/model/heat-map.js +0 -33
- package/es/model/horizontal-bar-group.js +0 -55
- package/es/model/horizontal-bar.js +0 -47
- package/es/model/index.js +0 -187
- package/es/model/map.js +0 -38
- package/es/model/mirror.js +0 -33
- package/es/model/pie.js +0 -38
- package/es/model/ring.js +0 -40
- package/es/model/scatter.js +0 -22
- package/es/model/table.js +0 -32
- package/es/model/trend.js +0 -32
- package/es/model/world-map.js +0 -34
- package/es/service/map-json.js +0 -140
- package/es/stat-editor/chart-name-editor.js +0 -68
- package/es/stat-editor/index.js +0 -75
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +0 -153
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +0 -422
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +0 -203
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +0 -23
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +0 -104
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +0 -334
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +0 -119
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +0 -132
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +0 -240
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +0 -89
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +0 -138
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +0 -331
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +0 -143
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +0 -109
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +0 -153
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +0 -144
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +0 -214
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +0 -121
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +0 -172
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +0 -366
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +0 -142
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +0 -150
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +0 -473
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +0 -182
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +0 -564
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +0 -112
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +0 -87
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +0 -187
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +0 -300
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +0 -113
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +0 -289
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +0 -58
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +0 -359
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +0 -48
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +0 -121
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +0 -143
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +0 -269
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +0 -104
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +0 -366
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +0 -55
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +0 -130
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +0 -374
- package/es/stat-editor/stat-settings/map/map-level.js +0 -72
- package/es/stat-editor/stat-settings/map/map-province-city.js +0 -151
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +0 -108
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +0 -154
- package/es/stat-editor/stat-settings/public-setting/calender.js +0 -125
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +0 -24
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +0 -62
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +0 -61
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +0 -35
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +0 -60
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +0 -123
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +0 -33
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.css +0 -29
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +0 -82
- package/es/stat-view/area-chart.js +0 -551
- package/es/stat-view/bar-chart.js +0 -582
- package/es/stat-view/base-chart.js +0 -132
- package/es/stat-view/basic-number-card.js +0 -201
- package/es/stat-view/combination-chart.js +0 -546
- package/es/stat-view/compare-chart.js +0 -483
- package/es/stat-view/completeness-chart.js +0 -390
- package/es/stat-view/custom-bar.js +0 -418
- package/es/stat-view/dashboard-chart.js +0 -266
- package/es/stat-view/heat-map.js +0 -463
- package/es/stat-view/horizontal-bar-chart.js +0 -562
- package/es/stat-view/line-chart.js +0 -518
- package/es/stat-view/map.js +0 -448
- package/es/stat-view/mirror.js +0 -275
- package/es/stat-view/pie-chart.js +0 -290
- package/es/stat-view/pivot-table/index.js +0 -196
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +0 -156
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +0 -176
- package/es/stat-view/pivot-table/pivot-table-display-name.js +0 -215
- package/es/stat-view/pivot-table/statistic-pivot-table.module.css +0 -132
- package/es/stat-view/pivot-table/two-dimension-table.js +0 -384
- package/es/stat-view/ring-chart.js +0 -392
- package/es/stat-view/scatter-chart.js +0 -306
- package/es/stat-view/treemap-chart.js +0 -253
- package/es/stat-view/trend-chart.js +0 -249
- package/es/stat-view/world-map.js +0 -431
- package/es/utils/basic-chart-utils.js +0 -29
- package/es/utils/cell-format.js +0 -115
- package/es/utils/collaborator.js +0 -50
- package/es/utils/color-utils.js +0 -134
- package/es/utils/column-utils.js +0 -110
- package/es/utils/column.js +0 -20
- package/es/utils/date-format.js +0 -71
- package/es/utils/map.js +0 -114
- package/es/utils/model.js +0 -19
- package/es/utils/row-utils.js +0 -134
- package/es/utils/search.js +0 -73
- package/es/utils/sql-utils.js +0 -359
- package/es/utils/stat-utils.js +0 -351
- package/es/utils/trend-utils.js +0 -135
package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js
DELETED
|
@@ -1,359 +0,0 @@
|
|
|
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;
|
package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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;
|
|
@@ -1,121 +0,0 @@
|
|
|
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;
|
|
@@ -1,143 +0,0 @@
|
|
|
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;
|