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,86 @@
|
|
|
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 classnames from 'classnames';
|
|
7
|
+
import intl from 'react-intl-universal';
|
|
8
|
+
import NumericSummaryItem from '../public-setting/numeric-summary-item';
|
|
9
|
+
var StackItemSettings = /*#__PURE__*/function (_Component) {
|
|
10
|
+
_inherits(StackItemSettings, _Component);
|
|
11
|
+
var _super = _createSuper(StackItemSettings);
|
|
12
|
+
function StackItemSettings(props) {
|
|
13
|
+
var _this;
|
|
14
|
+
_classCallCheck(this, StackItemSettings);
|
|
15
|
+
_this = _super.call(this, props);
|
|
16
|
+
_this.onToggleExpand = function () {
|
|
17
|
+
_this.setState({
|
|
18
|
+
expanded: !_this.state.expanded
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
_this.renderGroupbyNumericColumns = function () {
|
|
22
|
+
var _this$props = _this.props,
|
|
23
|
+
statItem = _this$props.statItem,
|
|
24
|
+
stack = _this$props.stack,
|
|
25
|
+
numericColumnsOptions = _this$props.numericColumnsOptions,
|
|
26
|
+
summaryMethodsOptions = _this$props.summaryMethodsOptions;
|
|
27
|
+
var column_groupby_numeric_columns = stack.column_groupby_numeric_columns;
|
|
28
|
+
return Array.isArray(column_groupby_numeric_columns) && column_groupby_numeric_columns.map(function (item, index) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
30
|
+
statItem: statItem,
|
|
31
|
+
key: "stack-number-column-".concat(index),
|
|
32
|
+
index: index,
|
|
33
|
+
canDeleteFirstColumn: true,
|
|
34
|
+
numericColumnItem: item,
|
|
35
|
+
numericColumnsOptions: numericColumnsOptions,
|
|
36
|
+
summaryMethodOptions: summaryMethodsOptions,
|
|
37
|
+
onChangeColumnOption: _this.props.modifyGroupbyNumericColumn,
|
|
38
|
+
onChangeSummaryMethod: _this.props.modifySummaryMethod,
|
|
39
|
+
onDeleteNumericColumnItem: _this.props.deleteNumericColumn
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
_this.state = {
|
|
44
|
+
expanded: true
|
|
45
|
+
};
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
_createClass(StackItemSettings, [{
|
|
49
|
+
key: "render",
|
|
50
|
+
value: function render() {
|
|
51
|
+
var _this$props2 = this.props,
|
|
52
|
+
label = _this$props2.label,
|
|
53
|
+
numericColumnsOptions = _this$props2.numericColumnsOptions;
|
|
54
|
+
var expanded = this.state.expanded;
|
|
55
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: classnames('statistic-chart-parameter-item', {
|
|
57
|
+
collapsible: !expanded
|
|
58
|
+
})
|
|
59
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "statistic-y-axis-title"
|
|
61
|
+
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("i", {
|
|
62
|
+
onClick: this.onToggleExpand,
|
|
63
|
+
className: classnames('dtable-font', 'statistic-y-axis-title-expand-icon', {
|
|
64
|
+
'dtable-icon-drop-down': expanded,
|
|
65
|
+
'dtable-icon-right-slide': !expanded
|
|
66
|
+
})
|
|
67
|
+
}), /*#__PURE__*/React.createElement("label", null, label)), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("i", {
|
|
68
|
+
onClick: this.props.deleteStack,
|
|
69
|
+
className: "dtable-font dtable-icon-fork-number"
|
|
70
|
+
}))), expanded && /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "stack-settings-content-wrapper"
|
|
72
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "statistics-add-number"
|
|
74
|
+
}, this.renderGroupbyNumericColumns()), Array.isArray(numericColumnsOptions) && numericColumnsOptions.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: "statistics-add-number-column",
|
|
76
|
+
onClick: this.props.addNumericSummary
|
|
77
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
78
|
+
className: "number-column-item dtable-font dtable-icon-add-table"
|
|
79
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
80
|
+
className: "number-column-item add-number-column-description"
|
|
81
|
+
}, intl.get('Add_new_numeric_column'))))));
|
|
82
|
+
}
|
|
83
|
+
}]);
|
|
84
|
+
return StackItemSettings;
|
|
85
|
+
}(Component);
|
|
86
|
+
export default StackItemSettings;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React, { Component, Fragment } from 'react';
|
|
7
|
+
import intl from 'react-intl-universal';
|
|
8
|
+
import StackItemSettings from './stack-item-settings';
|
|
9
|
+
import { STATISTICS_COUNT_SHOW, STAT_TYPE, SUMMARY_METHOD } from '../../../constants';
|
|
10
|
+
var StacksSettings = /*#__PURE__*/function (_Component) {
|
|
11
|
+
_inherits(StacksSettings, _Component);
|
|
12
|
+
var _super = _createSuper(StacksSettings);
|
|
13
|
+
function StacksSettings(props) {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, StacksSettings);
|
|
16
|
+
_this = _super.call(this, props);
|
|
17
|
+
_this.addStack = function () {
|
|
18
|
+
var statItem = _this.props.statItem;
|
|
19
|
+
var y_axises = statItem.y_axises;
|
|
20
|
+
var defaultStack = {
|
|
21
|
+
type: STAT_TYPE.BAR_STACK,
|
|
22
|
+
column_groupby_numeric_columns: null
|
|
23
|
+
};
|
|
24
|
+
var updatedStacks = y_axises ? [].concat(_toConsumableArray(y_axises), [defaultStack]) : [defaultStack];
|
|
25
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
26
|
+
y_axises: updatedStacks
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
_this.deleteStack = function (index) {
|
|
30
|
+
var statItem = _this.props.statItem;
|
|
31
|
+
var y_axises = statItem.y_axises;
|
|
32
|
+
if (!Array.isArray(y_axises) || !y_axises[index]) return;
|
|
33
|
+
var updatedStacks = _toConsumableArray(y_axises);
|
|
34
|
+
updatedStacks.splice(index, 1);
|
|
35
|
+
if (updatedStacks.length === 0) {
|
|
36
|
+
updatedStacks = null;
|
|
37
|
+
}
|
|
38
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
39
|
+
y_axises: updatedStacks
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
_this.addStackNumericSummary = function (index) {
|
|
43
|
+
var _this$props = _this.props,
|
|
44
|
+
statItem = _this$props.statItem,
|
|
45
|
+
numericColumnsOptions = _this$props.numericColumnsOptions;
|
|
46
|
+
var y_axises = statItem.y_axises;
|
|
47
|
+
var updatedStacks = Array.isArray(y_axises) && _toConsumableArray(y_axises);
|
|
48
|
+
var updatedStack = updatedStacks && updatedStacks[index];
|
|
49
|
+
if (!updatedStack) return;
|
|
50
|
+
var column_groupby_numeric_columns = updatedStack.column_groupby_numeric_columns;
|
|
51
|
+
var updatedNumericColumns = column_groupby_numeric_columns ? _toConsumableArray(column_groupby_numeric_columns) : [];
|
|
52
|
+
var newNumericColumnKey = numericColumnsOptions[0].value.key;
|
|
53
|
+
updatedNumericColumns.push({
|
|
54
|
+
column_key: newNumericColumnKey,
|
|
55
|
+
summary_method: SUMMARY_METHOD[0]
|
|
56
|
+
});
|
|
57
|
+
updatedStack.column_groupby_numeric_columns = updatedNumericColumns;
|
|
58
|
+
updatedStacks[index] = updatedStack;
|
|
59
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
60
|
+
y_axises: updatedStacks
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
_this.modifyStackGroupbyNumericColumn = function (stackIndex, _ref) {
|
|
64
|
+
var numericColumnIndex = _ref.numericColumnIndex,
|
|
65
|
+
columnOption = _ref.columnOption;
|
|
66
|
+
var statItem = _this.props.statItem;
|
|
67
|
+
var y_axises = statItem.y_axises;
|
|
68
|
+
var updatedStacks = Array.isArray(y_axises) && _toConsumableArray(y_axises);
|
|
69
|
+
var updatedStack = updatedStacks && updatedStacks[stackIndex];
|
|
70
|
+
var updatedNumericColumns = updatedStack && updatedStack.column_groupby_numeric_columns;
|
|
71
|
+
var updatedNumericColumn = updatedNumericColumns && updatedNumericColumns[numericColumnIndex];
|
|
72
|
+
if (!updatedNumericColumn) return;
|
|
73
|
+
updatedNumericColumn.column_key = columnOption.value.key;
|
|
74
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
75
|
+
y_axises: updatedStacks
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
_this.deleteStackNumericColumn = function (stackIndex, _ref2) {
|
|
79
|
+
var numericColumnIndex = _ref2.numericColumnIndex;
|
|
80
|
+
var statItem = _this.props.statItem;
|
|
81
|
+
var y_axises = statItem.y_axises;
|
|
82
|
+
var updatedStacks = Array.isArray(y_axises) && _toConsumableArray(y_axises);
|
|
83
|
+
var updatedStack = updatedStacks && updatedStacks[stackIndex];
|
|
84
|
+
var updatedNumericColumns = updatedStack && updatedStack.column_groupby_numeric_columns;
|
|
85
|
+
if (!updatedNumericColumns || !updatedNumericColumns[numericColumnIndex]) return;
|
|
86
|
+
updatedNumericColumns.splice(numericColumnIndex, 1);
|
|
87
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
88
|
+
y_axises: updatedStacks
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
_this.modifyStackSummaryMethod = function (stackIndex, _ref3) {
|
|
92
|
+
var numericColumnIndex = _ref3.numericColumnIndex,
|
|
93
|
+
summaryMethodOption = _ref3.summaryMethodOption;
|
|
94
|
+
var statItem = _this.props.statItem;
|
|
95
|
+
var y_axises = statItem.y_axises;
|
|
96
|
+
var updatedStacks = Array.isArray(y_axises) && _toConsumableArray(y_axises);
|
|
97
|
+
var updatedStack = updatedStacks && updatedStacks[stackIndex];
|
|
98
|
+
var updatedNumericColumns = updatedStack && updatedStack.column_groupby_numeric_columns;
|
|
99
|
+
var updatedNumericColumn = updatedNumericColumns && updatedNumericColumns[numericColumnIndex];
|
|
100
|
+
if (!updatedNumericColumn) return;
|
|
101
|
+
updatedNumericColumn.summary_method = summaryMethodOption.value;
|
|
102
|
+
_this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
|
|
103
|
+
y_axises: updatedStacks
|
|
104
|
+
}));
|
|
105
|
+
};
|
|
106
|
+
_this.getSummaryMethodsOptions = function () {
|
|
107
|
+
return SUMMARY_METHOD.map(function (m) {
|
|
108
|
+
return {
|
|
109
|
+
value: m,
|
|
110
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
111
|
+
className: 'select-module select-module-name'
|
|
112
|
+
}, intl.get(STATISTICS_COUNT_SHOW[m]))
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
_this.summaryMethodsOptions = _this.getSummaryMethodsOptions();
|
|
117
|
+
return _this;
|
|
118
|
+
}
|
|
119
|
+
_createClass(StacksSettings, [{
|
|
120
|
+
key: "render",
|
|
121
|
+
value: function render() {
|
|
122
|
+
var _this2 = this;
|
|
123
|
+
var statItem = this.props.statItem;
|
|
124
|
+
var y_axises = statItem.y_axises;
|
|
125
|
+
return /*#__PURE__*/React.createElement(Fragment, null, Array.isArray(y_axises) && y_axises.map(function (yAxis, index) {
|
|
126
|
+
return /*#__PURE__*/React.createElement(StackItemSettings, {
|
|
127
|
+
key: "stack-settings-".concat(index),
|
|
128
|
+
statItem: statItem,
|
|
129
|
+
stack: yAxis,
|
|
130
|
+
label: "".concat(intl.get('Stack')).concat(index + 1),
|
|
131
|
+
numericColumnsOptions: _this2.props.numericColumnsOptions,
|
|
132
|
+
summaryMethodsOptions: _this2.summaryMethodsOptions,
|
|
133
|
+
deleteStack: function deleteStack() {
|
|
134
|
+
return _this2.deleteStack(index);
|
|
135
|
+
},
|
|
136
|
+
addNumericSummary: function addNumericSummary() {
|
|
137
|
+
return _this2.addStackNumericSummary(index);
|
|
138
|
+
},
|
|
139
|
+
modifyGroupbyNumericColumn: function modifyGroupbyNumericColumn(numericColumnIndex, columnOption) {
|
|
140
|
+
return _this2.modifyStackGroupbyNumericColumn(index, {
|
|
141
|
+
numericColumnIndex: numericColumnIndex,
|
|
142
|
+
columnOption: columnOption
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
modifySummaryMethod: function modifySummaryMethod(numericColumnIndex, summaryMethodOption) {
|
|
146
|
+
return _this2.modifyStackSummaryMethod(index, {
|
|
147
|
+
numericColumnIndex: numericColumnIndex,
|
|
148
|
+
summaryMethodOption: summaryMethodOption
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
deleteNumericColumn: function deleteNumericColumn(numericColumnIndex) {
|
|
152
|
+
return _this2.deleteStackNumericColumn(index, {
|
|
153
|
+
numericColumnIndex: numericColumnIndex
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
className: "statistics-add-stack",
|
|
159
|
+
onClick: this.addStack
|
|
160
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
161
|
+
className: "dtable-font dtable-icon-add-table"
|
|
162
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
163
|
+
className: "add-stack-description"
|
|
164
|
+
}, intl.get('Add_new_stack'))));
|
|
165
|
+
}
|
|
166
|
+
}]);
|
|
167
|
+
return StacksSettings;
|
|
168
|
+
}(Component);
|
|
169
|
+
export default StacksSettings;
|
package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
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 { CellType, TableUtils } from 'dtable-store';
|
|
8
|
+
import ToggleSetting from '../../public-setting/toggle-setting';
|
|
9
|
+
import IndToggleSetting from '../../public-setting/ind-toggle-setting';
|
|
10
|
+
import AxisLabelPosition from '../../public-setting/axis-label-position-setting';
|
|
11
|
+
import MinMaxSetting from '../../public-setting/min-max-setting';
|
|
12
|
+
import ColorUseTypeSelector from '../../color-setting/color-use-type-selector';
|
|
13
|
+
import LabelFontSizeEditor from './label-font-size-editor';
|
|
14
|
+
import CustomTitleSetting from '../../public-setting/custom-title-setting';
|
|
15
|
+
import { LABEL_COLORS, LABEL_CONFIG_CHANGED, PIE_COLOR_OPTIONS, PIE_COlOR_OPTIONS_MAP, STAT_TYPE } from '../../../../constants';
|
|
16
|
+
var BarChartStyle = /*#__PURE__*/function (_Component) {
|
|
17
|
+
_inherits(BarChartStyle, _Component);
|
|
18
|
+
var _super = _createSuper(BarChartStyle);
|
|
19
|
+
function BarChartStyle() {
|
|
20
|
+
var _this;
|
|
21
|
+
_classCallCheck(this, BarChartStyle);
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
26
|
+
_this.onToggleYAxisAutoRange = function () {
|
|
27
|
+
var statItem = _this.props.statItem;
|
|
28
|
+
var _ref = statItem || {},
|
|
29
|
+
y_axis_auto_range = _ref.y_axis_auto_range;
|
|
30
|
+
var updated = {
|
|
31
|
+
y_axis_auto_range: y_axis_auto_range == undefined ? false : !y_axis_auto_range
|
|
32
|
+
};
|
|
33
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
34
|
+
};
|
|
35
|
+
_this.onYAxisMinChange = function (min) {
|
|
36
|
+
var newMin = parseInt(min);
|
|
37
|
+
if (!Number.isNaN(newMin)) {
|
|
38
|
+
var statItem = _this.props.statItem;
|
|
39
|
+
var updated = {
|
|
40
|
+
y_axis_min: newMin
|
|
41
|
+
};
|
|
42
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
_this.onYAxisMaxChange = function (max) {
|
|
46
|
+
var newMax = parseInt(max);
|
|
47
|
+
if (!Number.isNaN(newMax)) {
|
|
48
|
+
var statItem = _this.props.statItem;
|
|
49
|
+
var updated = {
|
|
50
|
+
y_axis_max: newMax
|
|
51
|
+
};
|
|
52
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
_this.renderAutoRange = function () {
|
|
56
|
+
var statItem = _this.props.statItem;
|
|
57
|
+
var y_axis_auto_range = statItem.y_axis_auto_range,
|
|
58
|
+
y_axis_min = statItem.y_axis_min,
|
|
59
|
+
y_axis_max = statItem.y_axis_max;
|
|
60
|
+
var checked = y_axis_auto_range == undefined ? true : y_axis_auto_range;
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "mt-1"
|
|
63
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
64
|
+
isChecked: checked,
|
|
65
|
+
handleToggleChange: _this.onToggleYAxisAutoRange,
|
|
66
|
+
label: intl.get('Auto_range')
|
|
67
|
+
}), !checked && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
68
|
+
min: y_axis_min,
|
|
69
|
+
max: y_axis_max,
|
|
70
|
+
onMinChange: _this.onYAxisMinChange,
|
|
71
|
+
onMaxChange: _this.onYAxisMaxChange
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
_this.onToggleDisplayData = function () {
|
|
75
|
+
var statItem = _this.props.statItem;
|
|
76
|
+
var _ref2 = statItem || {},
|
|
77
|
+
display_data = _ref2.display_data;
|
|
78
|
+
var updated = {
|
|
79
|
+
display_data: !display_data
|
|
80
|
+
};
|
|
81
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
82
|
+
};
|
|
83
|
+
_this.onToggleXAxisLabel = function () {
|
|
84
|
+
var _this$props = _this.props,
|
|
85
|
+
statItem = _this$props.statItem,
|
|
86
|
+
eventBus = _this$props.eventBus;
|
|
87
|
+
var _ref3 = statItem || {},
|
|
88
|
+
show_x_axis_label = _ref3.show_x_axis_label;
|
|
89
|
+
var updated = {
|
|
90
|
+
show_x_axis_label: !show_x_axis_label,
|
|
91
|
+
x_axis_label_position: !show_x_axis_label ? 'center' : null
|
|
92
|
+
};
|
|
93
|
+
var newStatItem = Object.assign({}, statItem, updated);
|
|
94
|
+
eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
|
|
95
|
+
_this.props.updateStatItem(newStatItem);
|
|
96
|
+
};
|
|
97
|
+
_this.onToggleYAxisLabel = function () {
|
|
98
|
+
var _this$props2 = _this.props,
|
|
99
|
+
statItem = _this$props2.statItem,
|
|
100
|
+
eventBus = _this$props2.eventBus;
|
|
101
|
+
var _ref4 = statItem || {},
|
|
102
|
+
show_y_axis_label = _ref4.show_y_axis_label;
|
|
103
|
+
var updated = {
|
|
104
|
+
show_y_axis_label: !show_y_axis_label,
|
|
105
|
+
y_axis_label_position: !show_y_axis_label ? 'center' : null
|
|
106
|
+
};
|
|
107
|
+
var newStatItem = Object.assign({}, statItem, updated);
|
|
108
|
+
eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
|
|
109
|
+
_this.props.updateStatItem(newStatItem);
|
|
110
|
+
};
|
|
111
|
+
_this.onSelectAxisLabelPosition = function (type, option) {
|
|
112
|
+
var updated;
|
|
113
|
+
if (type === 'x') {
|
|
114
|
+
updated = {
|
|
115
|
+
x_axis_label_position: option.value
|
|
116
|
+
};
|
|
117
|
+
} else {
|
|
118
|
+
updated = {
|
|
119
|
+
y_axis_label_position: option.value
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
var _this$props3 = _this.props,
|
|
123
|
+
statItem = _this$props3.statItem,
|
|
124
|
+
eventBus = _this$props3.eventBus;
|
|
125
|
+
var newStatItem = Object.assign({}, statItem, updated);
|
|
126
|
+
eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
|
|
127
|
+
_this.props.updateStatItem(newStatItem);
|
|
128
|
+
};
|
|
129
|
+
_this.onToggleDisplayEachBlockData = function () {
|
|
130
|
+
var statItem = _this.props.statItem;
|
|
131
|
+
var _ref5 = statItem || {},
|
|
132
|
+
display_each_block_data = _ref5.display_each_block_data;
|
|
133
|
+
var updated = {
|
|
134
|
+
display_each_block_data: !display_each_block_data
|
|
135
|
+
};
|
|
136
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
137
|
+
};
|
|
138
|
+
_this.onToggleShowLabel = function () {
|
|
139
|
+
var statItem = _this.props.statItem;
|
|
140
|
+
var _ref6 = statItem || {},
|
|
141
|
+
y_axis_show_label = _ref6.y_axis_show_label,
|
|
142
|
+
y_axis_label_color = _ref6.y_axis_label_color;
|
|
143
|
+
y_axis_show_label = !y_axis_show_label;
|
|
144
|
+
if (y_axis_show_label) {
|
|
145
|
+
y_axis_label_color = LABEL_COLORS[0];
|
|
146
|
+
} else {
|
|
147
|
+
y_axis_label_color = null;
|
|
148
|
+
}
|
|
149
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
150
|
+
y_axis_show_label: y_axis_show_label,
|
|
151
|
+
y_axis_label_color: y_axis_label_color
|
|
152
|
+
}));
|
|
153
|
+
};
|
|
154
|
+
_this.onChangeLabelFontSize = function (label_font_size) {
|
|
155
|
+
var statItem = _this.props.statItem;
|
|
156
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
157
|
+
label_font_size: label_font_size
|
|
158
|
+
}));
|
|
159
|
+
};
|
|
160
|
+
_this.enableUseSingleSelectColumnColorSetting = function () {
|
|
161
|
+
var _this$props4 = _this.props,
|
|
162
|
+
getTableById = _this$props4.getTableById,
|
|
163
|
+
statItem = _this$props4.statItem;
|
|
164
|
+
var table_id = statItem.table_id,
|
|
165
|
+
column_groupby_column_key = statItem.column_groupby_column_key;
|
|
166
|
+
if (!column_groupby_column_key) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
var table = getTableById(table_id);
|
|
170
|
+
var groupByColumn = TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
171
|
+
var columnType = groupByColumn.type;
|
|
172
|
+
if (columnType == CellType.SINGLE_SELECT) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
};
|
|
177
|
+
_this.getColorOptions = function () {
|
|
178
|
+
var options = PIE_COLOR_OPTIONS.map(function (item, index) {
|
|
179
|
+
return {
|
|
180
|
+
value: item,
|
|
181
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
182
|
+
className: 'select-module select-module-name'
|
|
183
|
+
}, intl.get(PIE_COlOR_OPTIONS_MAP[item]))
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
return options;
|
|
187
|
+
};
|
|
188
|
+
_this.updateTitleName = function (setting) {
|
|
189
|
+
var statItem = _this.props.statItem;
|
|
190
|
+
_this.props.updateStatItem(Object.assign({}, statItem, setting));
|
|
191
|
+
};
|
|
192
|
+
return _this;
|
|
193
|
+
}
|
|
194
|
+
_createClass(BarChartStyle, [{
|
|
195
|
+
key: "render",
|
|
196
|
+
value: function render() {
|
|
197
|
+
var _this$props5 = this.props,
|
|
198
|
+
statItem = _this$props5.statItem,
|
|
199
|
+
labelColorConfigs = _this$props5.labelColorConfigs,
|
|
200
|
+
hideDisplayDataSetting = _this$props5.hideDisplayDataSetting,
|
|
201
|
+
_this$props5$showRang = _this$props5.showRangeSetting,
|
|
202
|
+
showRangeSetting = _this$props5$showRang === void 0 ? true : _this$props5$showRang;
|
|
203
|
+
var chartType = statItem.type,
|
|
204
|
+
show_x_axis_label = statItem.show_x_axis_label,
|
|
205
|
+
show_y_axis_label = statItem.show_y_axis_label,
|
|
206
|
+
display_data = statItem.display_data,
|
|
207
|
+
label_font_size = statItem.label_font_size,
|
|
208
|
+
display_each_block_data = statItem.display_each_block_data,
|
|
209
|
+
_statItem$title_name = statItem.title_name,
|
|
210
|
+
title_name = _statItem$title_name === void 0 ? '' : _statItem$title_name;
|
|
211
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
212
|
+
className: "statistic-chart-parameter-item"
|
|
213
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('X-axis')), /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
214
|
+
isChecked: show_x_axis_label || false,
|
|
215
|
+
handleToggleChange: this.onToggleXAxisLabel,
|
|
216
|
+
label: intl.get('Display_title')
|
|
217
|
+
}), show_x_axis_label && /*#__PURE__*/React.createElement(AxisLabelPosition, {
|
|
218
|
+
statItem: statItem,
|
|
219
|
+
axisType: 'x',
|
|
220
|
+
onSelectAxisLabelPosition: this.onSelectAxisLabelPosition
|
|
221
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
className: "statistic-chart-parameter-divider"
|
|
223
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
224
|
+
className: "statistic-chart-parameter-item"
|
|
225
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Y-axis')), /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
226
|
+
isChecked: show_y_axis_label || false,
|
|
227
|
+
handleToggleChange: this.onToggleYAxisLabel,
|
|
228
|
+
label: intl.get('Display_title')
|
|
229
|
+
}), show_y_axis_label && (this.props.enableYAxisCustomTitle || chartType == STAT_TYPE.BAR_STACK) && /*#__PURE__*/React.createElement(CustomTitleSetting, {
|
|
230
|
+
titleName: title_name || '',
|
|
231
|
+
updateTitleName: this.updateTitleName
|
|
232
|
+
}), show_y_axis_label && /*#__PURE__*/React.createElement(AxisLabelPosition, {
|
|
233
|
+
statItem: statItem,
|
|
234
|
+
axisType: 'y',
|
|
235
|
+
onSelectAxisLabelPosition: this.onSelectAxisLabelPosition
|
|
236
|
+
}), showRangeSetting && this.renderAutoRange()), this.enableUseSingleSelectColumnColorSetting() && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
237
|
+
className: "statistic-chart-parameter-divider"
|
|
238
|
+
}), /*#__PURE__*/React.createElement(ColorUseTypeSelector, {
|
|
239
|
+
chart: statItem,
|
|
240
|
+
labelColorConfigs: labelColorConfigs,
|
|
241
|
+
updateChart: this.props.updateStatItem
|
|
242
|
+
})), !hideDisplayDataSetting && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
className: "statistic-chart-parameter-divider"
|
|
244
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
245
|
+
className: "statistic-chart-parameter-item"
|
|
246
|
+
}, /*#__PURE__*/React.createElement(IndToggleSetting, {
|
|
247
|
+
isChecked: display_data || false,
|
|
248
|
+
label: statItem.type == STAT_TYPE.BAR_STACK ? intl.get('Display_stack_total_value') : intl.get('Display_data'),
|
|
249
|
+
handleToggleChange: this.onToggleDisplayData
|
|
250
|
+
}), display_data && /*#__PURE__*/React.createElement(LabelFontSizeEditor, {
|
|
251
|
+
fontSize: label_font_size,
|
|
252
|
+
className: "mt-3",
|
|
253
|
+
onChangeFontSize: this.onChangeLabelFontSize
|
|
254
|
+
}))), chartType === STAT_TYPE.BAR && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
255
|
+
className: "statistic-chart-parameter-divider"
|
|
256
|
+
}), /*#__PURE__*/React.createElement(ColorUseTypeSelector, {
|
|
257
|
+
chart: statItem,
|
|
258
|
+
labelColorConfigs: labelColorConfigs,
|
|
259
|
+
updateChart: this.props.updateStatItem
|
|
260
|
+
})), (this.props.isDisplayEachBlockData || chartType == STAT_TYPE.BAR_STACK) && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
261
|
+
className: "statistic-chart-parameter-divider"
|
|
262
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
263
|
+
className: "statistic-chart-parameter-item"
|
|
264
|
+
}, /*#__PURE__*/React.createElement(IndToggleSetting, {
|
|
265
|
+
isChecked: display_each_block_data || false,
|
|
266
|
+
label: intl.get('Display_value_of_each_block'),
|
|
267
|
+
handleToggleChange: this.onToggleDisplayEachBlockData
|
|
268
|
+
}))));
|
|
269
|
+
}
|
|
270
|
+
}]);
|
|
271
|
+
return BarChartStyle;
|
|
272
|
+
}(Component);
|
|
273
|
+
export default BarChartStyle;
|
|
@@ -0,0 +1,105 @@
|
|
|
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 } from 'react';
|
|
6
|
+
import intl from 'react-intl-universal';
|
|
7
|
+
import IndToggleSetting from '../../public-setting/ind-toggle-setting';
|
|
8
|
+
import LabelFontSizeEditor from './label-font-size-editor';
|
|
9
|
+
import ToggleSetting from '../../public-setting/toggle-setting';
|
|
10
|
+
import MinMaxSetting from '../../public-setting/min-max-setting';
|
|
11
|
+
var CompletenessStyle = /*#__PURE__*/function (_Component) {
|
|
12
|
+
_inherits(CompletenessStyle, _Component);
|
|
13
|
+
var _super = _createSuper(CompletenessStyle);
|
|
14
|
+
function CompletenessStyle() {
|
|
15
|
+
var _this;
|
|
16
|
+
_classCallCheck(this, CompletenessStyle);
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
21
|
+
_this.onToggleDisplayData = function () {
|
|
22
|
+
var statItem = _this.props.statItem;
|
|
23
|
+
var _ref = statItem || {},
|
|
24
|
+
display_percentage = _ref.display_percentage;
|
|
25
|
+
var updated = {
|
|
26
|
+
display_percentage: !display_percentage
|
|
27
|
+
};
|
|
28
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
29
|
+
};
|
|
30
|
+
_this.onChangeLabelFontSize = function (label_font_size) {
|
|
31
|
+
var statItem = _this.props.statItem;
|
|
32
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
33
|
+
label_font_size: label_font_size
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
_this.onToggleYAxisAutoRange = function () {
|
|
37
|
+
var statItem = _this.props.statItem;
|
|
38
|
+
var _ref2 = statItem || {},
|
|
39
|
+
y_axis_auto_range = _ref2.y_axis_auto_range;
|
|
40
|
+
var updated = {
|
|
41
|
+
y_axis_auto_range: y_axis_auto_range == undefined ? false : !y_axis_auto_range
|
|
42
|
+
};
|
|
43
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
44
|
+
};
|
|
45
|
+
_this.onYAxisMinChange = function (min) {
|
|
46
|
+
var newMin = parseInt(min);
|
|
47
|
+
if (!Number.isNaN(newMin)) {
|
|
48
|
+
var statItem = _this.props.statItem;
|
|
49
|
+
var updated = {
|
|
50
|
+
y_axis_min: newMin
|
|
51
|
+
};
|
|
52
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
_this.onYAxisMaxChange = function (max) {
|
|
56
|
+
var newMax = parseInt(max);
|
|
57
|
+
if (!Number.isNaN(newMax)) {
|
|
58
|
+
var statItem = _this.props.statItem;
|
|
59
|
+
var updated = {
|
|
60
|
+
y_axis_max: newMax
|
|
61
|
+
};
|
|
62
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
_createClass(CompletenessStyle, [{
|
|
68
|
+
key: "render",
|
|
69
|
+
value: function render() {
|
|
70
|
+
var statItem = this.props.statItem;
|
|
71
|
+
var display_percentage = statItem.display_percentage,
|
|
72
|
+
label_font_size = statItem.label_font_size,
|
|
73
|
+
y_axis_auto_range = statItem.y_axis_auto_range,
|
|
74
|
+
y_axis_min = statItem.y_axis_min,
|
|
75
|
+
y_axis_max = statItem.y_axis_max;
|
|
76
|
+
var checked = y_axis_auto_range == undefined ? true : y_axis_auto_range;
|
|
77
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "statistic-chart-parameter-item"
|
|
79
|
+
}, /*#__PURE__*/React.createElement(IndToggleSetting, {
|
|
80
|
+
isChecked: display_percentage || false,
|
|
81
|
+
handleToggleChange: this.onToggleDisplayData,
|
|
82
|
+
label: intl.get('Display_percentage')
|
|
83
|
+
}), display_percentage && /*#__PURE__*/React.createElement(LabelFontSizeEditor, {
|
|
84
|
+
fontSize: label_font_size,
|
|
85
|
+
className: "mt-3",
|
|
86
|
+
onChangeFontSize: this.onChangeLabelFontSize
|
|
87
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "statistic-chart-parameter-item"
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "mt-1"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
92
|
+
isChecked: checked,
|
|
93
|
+
handleToggleChange: this.onToggleYAxisAutoRange,
|
|
94
|
+
label: intl.get('Auto_range')
|
|
95
|
+
}), !checked && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
96
|
+
min: y_axis_min,
|
|
97
|
+
max: y_axis_max,
|
|
98
|
+
onMinChange: this.onYAxisMinChange,
|
|
99
|
+
onMaxChange: this.onYAxisMaxChange
|
|
100
|
+
}))));
|
|
101
|
+
}
|
|
102
|
+
}]);
|
|
103
|
+
return CompletenessStyle;
|
|
104
|
+
}(Component);
|
|
105
|
+
export default CompletenessStyle;
|