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,243 @@
|
|
|
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, STAT_TYPE } from '../../../../constants';
|
|
16
|
+
var HorizontalBarChartStyle = /*#__PURE__*/function (_Component) {
|
|
17
|
+
_inherits(HorizontalBarChartStyle, _Component);
|
|
18
|
+
var _super = _createSuper(HorizontalBarChartStyle);
|
|
19
|
+
function HorizontalBarChartStyle() {
|
|
20
|
+
var _this;
|
|
21
|
+
_classCallCheck(this, HorizontalBarChartStyle);
|
|
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.onToggleVerticalAxisLabel = function () {
|
|
27
|
+
var _this$props = _this.props,
|
|
28
|
+
statItem = _this$props.statItem,
|
|
29
|
+
eventBus = _this$props.eventBus;
|
|
30
|
+
var _ref = statItem || {},
|
|
31
|
+
show_vertical_axis_label = _ref.show_vertical_axis_label;
|
|
32
|
+
var updated = {
|
|
33
|
+
show_vertical_axis_label: !show_vertical_axis_label,
|
|
34
|
+
vertical_axis_label_position: !show_vertical_axis_label ? 'center' : null
|
|
35
|
+
};
|
|
36
|
+
var newStatItem = Object.assign({}, statItem, updated);
|
|
37
|
+
eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
|
|
38
|
+
_this.props.updateStatItem(newStatItem);
|
|
39
|
+
};
|
|
40
|
+
_this.onToggleHorizontalAxisLabel = function () {
|
|
41
|
+
var _this$props2 = _this.props,
|
|
42
|
+
statItem = _this$props2.statItem,
|
|
43
|
+
eventBus = _this$props2.eventBus;
|
|
44
|
+
var _ref2 = statItem || {},
|
|
45
|
+
show_horizontal_axis_label = _ref2.show_horizontal_axis_label;
|
|
46
|
+
var updated = {
|
|
47
|
+
show_horizontal_axis_label: !show_horizontal_axis_label,
|
|
48
|
+
horizontal_axis_label_position: !show_horizontal_axis_label ? 'center' : null
|
|
49
|
+
};
|
|
50
|
+
var newStatItem = Object.assign({}, statItem, updated);
|
|
51
|
+
eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
|
|
52
|
+
_this.props.updateStatItem(newStatItem);
|
|
53
|
+
};
|
|
54
|
+
_this.onSelectAxisLabelPosition = function (type, option) {
|
|
55
|
+
var updated;
|
|
56
|
+
if (type === 'vertical') {
|
|
57
|
+
updated = {
|
|
58
|
+
vertical_axis_label_position: option.value
|
|
59
|
+
};
|
|
60
|
+
} else {
|
|
61
|
+
updated = {
|
|
62
|
+
horizontal_axis_label_position: option.value
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
var _this$props3 = _this.props,
|
|
66
|
+
statItem = _this$props3.statItem,
|
|
67
|
+
eventBus = _this$props3.eventBus;
|
|
68
|
+
var newStatItem = Object.assign({}, statItem, updated);
|
|
69
|
+
eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
|
|
70
|
+
_this.props.updateStatItem(newStatItem);
|
|
71
|
+
};
|
|
72
|
+
_this.onToggleShowLabel = function () {
|
|
73
|
+
var statItem = _this.props.statItem;
|
|
74
|
+
var _ref3 = statItem || {},
|
|
75
|
+
horizontal_axis_show_label = _ref3.horizontal_axis_show_label,
|
|
76
|
+
horizontal_axis_label_color = _ref3.horizontal_axis_label_color;
|
|
77
|
+
horizontal_axis_show_label = !horizontal_axis_show_label;
|
|
78
|
+
if (horizontal_axis_show_label) {
|
|
79
|
+
horizontal_axis_label_color = LABEL_COLORS[0];
|
|
80
|
+
} else {
|
|
81
|
+
horizontal_axis_label_color = null;
|
|
82
|
+
}
|
|
83
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
84
|
+
horizontal_axis_show_label: horizontal_axis_show_label,
|
|
85
|
+
horizontal_axis_label_color: horizontal_axis_label_color
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
_this.onToggleDisplayData = function () {
|
|
89
|
+
var statItem = _this.props.statItem;
|
|
90
|
+
var _ref4 = statItem || {},
|
|
91
|
+
display_data = _ref4.display_data;
|
|
92
|
+
var updated = {
|
|
93
|
+
display_data: !display_data
|
|
94
|
+
};
|
|
95
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
96
|
+
};
|
|
97
|
+
_this.onChangeLabelFontSize = function (label_font_size) {
|
|
98
|
+
var statItem = _this.props.statItem;
|
|
99
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
100
|
+
label_font_size: label_font_size
|
|
101
|
+
}));
|
|
102
|
+
};
|
|
103
|
+
_this.onToggleHAxisAutoRange = function () {
|
|
104
|
+
var statItem = _this.props.statItem;
|
|
105
|
+
var _ref5 = statItem || {},
|
|
106
|
+
h_axis_auto_range = _ref5.h_axis_auto_range;
|
|
107
|
+
var updated = {
|
|
108
|
+
h_axis_auto_range: h_axis_auto_range == undefined ? false : !h_axis_auto_range
|
|
109
|
+
};
|
|
110
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
111
|
+
};
|
|
112
|
+
_this.onHAxisMinChange = function (min) {
|
|
113
|
+
var newMin = parseInt(min);
|
|
114
|
+
if (!Number.isNaN(newMin)) {
|
|
115
|
+
var statItem = _this.props.statItem;
|
|
116
|
+
var updated = {
|
|
117
|
+
h_axis_min: newMin
|
|
118
|
+
};
|
|
119
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
_this.onHAxisMaxChange = function (max) {
|
|
123
|
+
var newMax = parseInt(max);
|
|
124
|
+
if (!Number.isNaN(newMax)) {
|
|
125
|
+
var statItem = _this.props.statItem;
|
|
126
|
+
var updated = {
|
|
127
|
+
h_axis_max: newMax
|
|
128
|
+
};
|
|
129
|
+
_this.props.updateStatItem(Object.assign({}, statItem, updated));
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
_this.updateTitleName = function (setting) {
|
|
133
|
+
var statItem = _this.props.statItem;
|
|
134
|
+
_this.props.updateStatItem(Object.assign({}, statItem, setting));
|
|
135
|
+
};
|
|
136
|
+
_this.displayColorSelector = function () {
|
|
137
|
+
var _this$props4 = _this.props,
|
|
138
|
+
statItem = _this$props4.statItem,
|
|
139
|
+
getTableById = _this$props4.getTableById;
|
|
140
|
+
var type = statItem.type,
|
|
141
|
+
table_id = statItem.table_id,
|
|
142
|
+
column_groupby_column_key = statItem.column_groupby_column_key;
|
|
143
|
+
if (type == STAT_TYPE.HORIZONTAL_GROUP_BAR || type == STAT_TYPE.STACKED_HORIZONTAL_BAR) {
|
|
144
|
+
if (!column_groupby_column_key) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
var table = getTableById(table_id);
|
|
148
|
+
var groupByColumn = TableUtils.getTableColumnByKey(table, column_groupby_column_key);
|
|
149
|
+
var columnType = groupByColumn.type;
|
|
150
|
+
if (columnType == CellType.SINGLE_SELECT) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
};
|
|
157
|
+
_this.renderAutoRange = function () {
|
|
158
|
+
var statItem = _this.props.statItem;
|
|
159
|
+
var h_axis_auto_range = statItem.h_axis_auto_range,
|
|
160
|
+
h_axis_min = statItem.h_axis_min,
|
|
161
|
+
h_axis_max = statItem.h_axis_max;
|
|
162
|
+
var checked = h_axis_auto_range == undefined ? true : h_axis_auto_range;
|
|
163
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
className: "mt-1"
|
|
165
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
166
|
+
isChecked: checked,
|
|
167
|
+
handleToggleChange: _this.onToggleHAxisAutoRange,
|
|
168
|
+
label: intl.get('Auto_range')
|
|
169
|
+
}), !checked && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
170
|
+
min: h_axis_min,
|
|
171
|
+
max: h_axis_max,
|
|
172
|
+
onMinChange: _this.onHAxisMinChange,
|
|
173
|
+
onMaxChange: _this.onHAxisMaxChange
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
return _this;
|
|
177
|
+
}
|
|
178
|
+
_createClass(HorizontalBarChartStyle, [{
|
|
179
|
+
key: "render",
|
|
180
|
+
value: function render() {
|
|
181
|
+
var _this$props5 = this.props,
|
|
182
|
+
statItem = _this$props5.statItem,
|
|
183
|
+
labelColorConfigs = _this$props5.labelColorConfigs;
|
|
184
|
+
var chartType = statItem.type,
|
|
185
|
+
show_vertical_axis_label = statItem.show_vertical_axis_label,
|
|
186
|
+
show_horizontal_axis_label = statItem.show_horizontal_axis_label,
|
|
187
|
+
display_data = statItem.display_data,
|
|
188
|
+
label_font_size = statItem.label_font_size,
|
|
189
|
+
title_name = statItem.title_name;
|
|
190
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
191
|
+
className: "statistic-chart-parameter-item"
|
|
192
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Vertical_axis')), /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
193
|
+
isChecked: show_vertical_axis_label || false,
|
|
194
|
+
handleToggleChange: this.onToggleVerticalAxisLabel,
|
|
195
|
+
label: intl.get('Display_title')
|
|
196
|
+
}), show_vertical_axis_label && chartType == STAT_TYPE.STACKED_HORIZONTAL_BAR && /*#__PURE__*/React.createElement(CustomTitleSetting, {
|
|
197
|
+
titleName: title_name,
|
|
198
|
+
updateTitleName: this.updateTitleName
|
|
199
|
+
}), show_vertical_axis_label && /*#__PURE__*/React.createElement(AxisLabelPosition, {
|
|
200
|
+
statItem: statItem,
|
|
201
|
+
axisType: 'vertical',
|
|
202
|
+
onSelectAxisLabelPosition: this.onSelectAxisLabelPosition
|
|
203
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
className: "statistic-chart-parameter-divider"
|
|
205
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
className: "statistic-chart-parameter-item"
|
|
207
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Horizontal_axis')), /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
208
|
+
isChecked: show_horizontal_axis_label || false,
|
|
209
|
+
handleToggleChange: this.onToggleHorizontalAxisLabel,
|
|
210
|
+
label: intl.get('Display_title')
|
|
211
|
+
}), show_horizontal_axis_label && /*#__PURE__*/React.createElement(AxisLabelPosition, {
|
|
212
|
+
statItem: statItem,
|
|
213
|
+
axisType: 'horizontal',
|
|
214
|
+
onSelectAxisLabelPosition: this.onSelectAxisLabelPosition
|
|
215
|
+
}), chartType !== STAT_TYPE.STACKED_HORIZONTAL_BAR && this.renderAutoRange()), this.displayColorSelector() && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
216
|
+
className: "statistic-chart-parameter-divider"
|
|
217
|
+
}), /*#__PURE__*/React.createElement(ColorUseTypeSelector, {
|
|
218
|
+
chart: statItem,
|
|
219
|
+
updateChart: this.props.updateStatItem
|
|
220
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
221
|
+
className: "statistic-chart-parameter-divider"
|
|
222
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
className: "statistic-chart-parameter-item"
|
|
224
|
+
}, /*#__PURE__*/React.createElement(IndToggleSetting, {
|
|
225
|
+
isChecked: display_data || false,
|
|
226
|
+
handleToggleChange: this.onToggleDisplayData,
|
|
227
|
+
label: chartType == STAT_TYPE.STACKED_HORIZONTAL_BAR ? intl.get('Display_stack_total_value') : intl.get('Display_data')
|
|
228
|
+
}), display_data && /*#__PURE__*/React.createElement(LabelFontSizeEditor, {
|
|
229
|
+
className: "mt-3",
|
|
230
|
+
fontSize: label_font_size,
|
|
231
|
+
onChangeFontSize: this.onChangeLabelFontSize
|
|
232
|
+
})), chartType === STAT_TYPE.HORIZONTAL_BAR && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
233
|
+
className: "statistic-chart-parameter-divider"
|
|
234
|
+
}), /*#__PURE__*/React.createElement(ColorUseTypeSelector, {
|
|
235
|
+
chart: statItem,
|
|
236
|
+
labelColorConfigs: labelColorConfigs,
|
|
237
|
+
updateChart: this.props.updateStatItem
|
|
238
|
+
})));
|
|
239
|
+
}
|
|
240
|
+
}]);
|
|
241
|
+
return HorizontalBarChartStyle;
|
|
242
|
+
}(Component);
|
|
243
|
+
export default HorizontalBarChartStyle;
|
package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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 { Form, FormGroup, Label } from 'reactstrap';
|
|
8
|
+
var LabelFontSizeEditor = /*#__PURE__*/function (_Component) {
|
|
9
|
+
_inherits(LabelFontSizeEditor, _Component);
|
|
10
|
+
var _super = _createSuper(LabelFontSizeEditor);
|
|
11
|
+
function LabelFontSizeEditor() {
|
|
12
|
+
var _this;
|
|
13
|
+
_classCallCheck(this, LabelFontSizeEditor);
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
18
|
+
_this.onChange = function (evt) {
|
|
19
|
+
var value = evt.target.value.trim().replace(/[^0-9]/g, '');
|
|
20
|
+
var fontSize = value ? Number(value) : null;
|
|
21
|
+
if (fontSize === _this.props.fontSize) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (fontSize) {
|
|
25
|
+
_this.props.onChangeFontSize(fontSize);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
_this.onKeyDown = function (e) {
|
|
29
|
+
if (e.key == 'Enter') {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
e.target.blur();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
_createClass(LabelFontSizeEditor, [{
|
|
37
|
+
key: "render",
|
|
38
|
+
value: function render() {
|
|
39
|
+
var _this$props = this.props,
|
|
40
|
+
fontSize = _this$props.fontSize,
|
|
41
|
+
className = _this$props.className,
|
|
42
|
+
id = _this$props.id,
|
|
43
|
+
labelText = _this$props.labelText;
|
|
44
|
+
var inputID = id || 'label-font-size';
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "label-font-size-editor ".concat(className ? className : '')
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement(Label, {
|
|
48
|
+
for: inputID
|
|
49
|
+
}, labelText || intl.get('Label_font_size')), /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "font-size-editor-wrapper"
|
|
51
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
52
|
+
type: "text",
|
|
53
|
+
className: "form-control",
|
|
54
|
+
id: inputID,
|
|
55
|
+
defaultValue: fontSize,
|
|
56
|
+
onBlur: this.onChange,
|
|
57
|
+
onKeyDown: this.onKeyDown
|
|
58
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "font-size-unit"
|
|
60
|
+
}, /*#__PURE__*/React.createElement("span", null, "px"))))));
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
return LabelFontSizeEditor;
|
|
64
|
+
}(Component);
|
|
65
|
+
export default LabelFontSizeEditor;
|
package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
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 { Form, FormGroup, Label } from 'reactstrap';
|
|
7
|
+
import intl from 'react-intl-universal';
|
|
8
|
+
import { CellType, TableUtils } from 'dtable-store';
|
|
9
|
+
import { DTableSelect } from '../../../../components';
|
|
10
|
+
import ToggleSetting from '../../public-setting/toggle-setting';
|
|
11
|
+
import ColorUseTypeSelector from '../../color-setting/color-use-type-selector';
|
|
12
|
+
import LabelFontSizeEditor from './label-font-size-editor';
|
|
13
|
+
import { DEFAULT_ANNOTATION_SIZE, LABEL_FORMATS, LABEL_FORMATS_MAP, LABEL_POSITIONS, LABEL_POSITIONS_MAP, STAT_TYPE } from '../../../../constants';
|
|
14
|
+
var PieStyleSettings = /*#__PURE__*/function (_Component) {
|
|
15
|
+
_inherits(PieStyleSettings, _Component);
|
|
16
|
+
var _super = _createSuper(PieStyleSettings);
|
|
17
|
+
function PieStyleSettings(props) {
|
|
18
|
+
var _this;
|
|
19
|
+
_classCallCheck(this, PieStyleSettings);
|
|
20
|
+
_this = _super.call(this, props);
|
|
21
|
+
_this.renderShowLegend = function () {
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: "statistic-chart-parameter-item"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
25
|
+
isChecked: _this.props.statItem.show_legend || false,
|
|
26
|
+
handleToggleChange: _this.onToggleShowLegend,
|
|
27
|
+
label: intl.get('Display_legend')
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
_this.replaceNumberNotAllowInput = function (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 = function () {
|
|
39
|
+
var minimumSlicePercent = _this.state.minimumSlicePercent;
|
|
40
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "statistic-chart-parameter-item"
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement(Label, {
|
|
43
|
+
for: "percent"
|
|
44
|
+
}, intl.get('Minimum_slice_percent')), /*#__PURE__*/React.createElement("input", {
|
|
45
|
+
className: "form-control",
|
|
46
|
+
id: "percent",
|
|
47
|
+
ref: function ref(_ref) {
|
|
48
|
+
return _this.inputRef = _ref;
|
|
49
|
+
},
|
|
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 = function () {
|
|
59
|
+
var statItem = _this.props.statItem;
|
|
60
|
+
var label_font_size = statItem.label_font_size;
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "statistic-chart-parameter-item"
|
|
63
|
+
}, /*#__PURE__*/React.createElement(LabelFontSizeEditor, {
|
|
64
|
+
fontSize: label_font_size,
|
|
65
|
+
onChangeFontSize: _this.onChangeLabelFontSize
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
_this.onKeyDown = function (event) {
|
|
69
|
+
if (event.keyCode === 13) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
_this.inputRef.blur();
|
|
72
|
+
_this.onCommit();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
_this.onPercentChange = function (e) {
|
|
76
|
+
var value = e.target.value;
|
|
77
|
+
value = _this.replaceNumberNotAllowInput(value);
|
|
78
|
+
_this.setState({
|
|
79
|
+
minimumSlicePercent: value
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
_this.onBlur = function () {
|
|
83
|
+
_this.onCommit();
|
|
84
|
+
};
|
|
85
|
+
_this.onCommit = function () {
|
|
86
|
+
var statItem = _this.props.statItem;
|
|
87
|
+
var minimumSlicePercent = _this.state.minimumSlicePercent;
|
|
88
|
+
if (minimumSlicePercent > 100) {
|
|
89
|
+
minimumSlicePercent = 100;
|
|
90
|
+
}
|
|
91
|
+
_this.setState({
|
|
92
|
+
minimumSlicePercent: Number(minimumSlicePercent)
|
|
93
|
+
});
|
|
94
|
+
if (minimumSlicePercent === statItem.minimum_slice_percent) return;
|
|
95
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
96
|
+
minimum_slice_percent: Number(minimumSlicePercent)
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
_this.onToggleShowLegend = function () {
|
|
100
|
+
var statItem = _this.props.statItem;
|
|
101
|
+
var show_legend = !statItem.show_legend;
|
|
102
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
103
|
+
show_legend: show_legend
|
|
104
|
+
}));
|
|
105
|
+
};
|
|
106
|
+
_this.onChangeLabelFontSize = function (label_font_size) {
|
|
107
|
+
var statItem = _this.props.statItem;
|
|
108
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
109
|
+
label_font_size: label_font_size
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
_this.getLabelFormatOptions = function () {
|
|
113
|
+
var options = LABEL_FORMATS.map(function (item) {
|
|
114
|
+
return {
|
|
115
|
+
value: item,
|
|
116
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
117
|
+
className: 'select-module select-module-name'
|
|
118
|
+
}, intl.get(LABEL_FORMATS_MAP[item]))
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
return options;
|
|
122
|
+
};
|
|
123
|
+
_this.getSelectedLabelFormat = function () {
|
|
124
|
+
var options = _this.labelFormatOptions;
|
|
125
|
+
var _this$props$statItem = _this.props.statItem,
|
|
126
|
+
show_percent = _this$props$statItem.show_percent,
|
|
127
|
+
label_format = _this$props$statItem.label_format;
|
|
128
|
+
|
|
129
|
+
// be compatible with `show_percent`(the previous `display percent` setting option)
|
|
130
|
+
if (show_percent) {
|
|
131
|
+
return options[0]; // the 'percent' option
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return options.filter(function (option) {
|
|
135
|
+
return option.value == label_format;
|
|
136
|
+
})[0] || options[0];
|
|
137
|
+
};
|
|
138
|
+
_this.onSelectLabelFormat = function (option) {
|
|
139
|
+
var statItem = _this.props.statItem;
|
|
140
|
+
var newObj = {
|
|
141
|
+
label_format: option.value
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// make `show_percent` no longer work (as there is a 'percent' option in this 'label format selector')
|
|
145
|
+
var show_percent = statItem.show_percent;
|
|
146
|
+
if (show_percent) {
|
|
147
|
+
newObj.show_percent = false;
|
|
148
|
+
}
|
|
149
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, newObj));
|
|
150
|
+
};
|
|
151
|
+
_this.renderLabelFormatSelector = function () {
|
|
152
|
+
var selectedOption = _this.getSelectedLabelFormat();
|
|
153
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: "statistic-chart-parameter-item"
|
|
155
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Label_format')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
156
|
+
value: selectedOption,
|
|
157
|
+
onChange: _this.onSelectLabelFormat,
|
|
158
|
+
options: _this.labelFormatOptions
|
|
159
|
+
}));
|
|
160
|
+
};
|
|
161
|
+
_this.getLabelPositionOptions = function () {
|
|
162
|
+
var options = LABEL_POSITIONS.map(function (item) {
|
|
163
|
+
return {
|
|
164
|
+
value: item,
|
|
165
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
166
|
+
className: 'select-module select-module-name'
|
|
167
|
+
}, intl.get(LABEL_POSITIONS_MAP[item]))
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
return options;
|
|
171
|
+
};
|
|
172
|
+
_this.getSelectedLabelPosition = function () {
|
|
173
|
+
var options = _this.labelPositionOptions;
|
|
174
|
+
var label_position = _this.props.statItem.label_position;
|
|
175
|
+
return options.filter(function (option) {
|
|
176
|
+
return option.value == label_position;
|
|
177
|
+
})[0] || options[0];
|
|
178
|
+
};
|
|
179
|
+
_this.onSelectLabelPosition = function (option) {
|
|
180
|
+
var statItem = _this.props.statItem;
|
|
181
|
+
var newObj = {
|
|
182
|
+
label_position: option.value
|
|
183
|
+
};
|
|
184
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, newObj));
|
|
185
|
+
};
|
|
186
|
+
_this.renderLabelPositionSelector = function () {
|
|
187
|
+
var selectedOption = _this.getSelectedLabelPosition();
|
|
188
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: "statistic-chart-parameter-item"
|
|
190
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Label_position')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
191
|
+
value: selectedOption,
|
|
192
|
+
onChange: _this.onSelectLabelPosition,
|
|
193
|
+
options: _this.labelPositionOptions
|
|
194
|
+
}));
|
|
195
|
+
};
|
|
196
|
+
_this.onToggleDisplayLabel = function () {
|
|
197
|
+
var statItem = _this.props.statItem;
|
|
198
|
+
var display_label = statItem.display_label,
|
|
199
|
+
show_percent = statItem.show_percent;
|
|
200
|
+
var newObj;
|
|
201
|
+
// be compatible with the previous `show_percent`(the `display percent` option)
|
|
202
|
+
if (show_percent) {
|
|
203
|
+
newObj = {
|
|
204
|
+
show_percent: false,
|
|
205
|
+
display_label: false
|
|
206
|
+
};
|
|
207
|
+
} else {
|
|
208
|
+
newObj = {
|
|
209
|
+
display_label: !display_label
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, newObj));
|
|
213
|
+
};
|
|
214
|
+
_this.renderDisplayLabel = function () {
|
|
215
|
+
var statItem = _this.props.statItem;
|
|
216
|
+
var show_percent = statItem.show_percent,
|
|
217
|
+
display_label = statItem.display_label;
|
|
218
|
+
// be compatible with the previous `show_percent`(the `display percent` option)
|
|
219
|
+
if (show_percent) {
|
|
220
|
+
display_label = true;
|
|
221
|
+
}
|
|
222
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
className: "statistic-chart-parameter-item"
|
|
224
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
225
|
+
isChecked: display_label || false,
|
|
226
|
+
handleToggleChange: _this.onToggleDisplayLabel,
|
|
227
|
+
label: intl.get('Display_label')
|
|
228
|
+
}));
|
|
229
|
+
};
|
|
230
|
+
_this.displayColorSelector = function () {
|
|
231
|
+
var _this$props = _this.props,
|
|
232
|
+
getTableById = _this$props.getTableById,
|
|
233
|
+
statItem = _this$props.statItem;
|
|
234
|
+
var table_id = statItem.table_id,
|
|
235
|
+
groupby_column_key = statItem.groupby_column_key;
|
|
236
|
+
if (!groupby_column_key) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
var table = getTableById(table_id);
|
|
240
|
+
var groupByColumn = TableUtils.getTableColumnByKey(table, groupby_column_key);
|
|
241
|
+
var columnType = groupByColumn.type;
|
|
242
|
+
if (columnType == CellType.SINGLE_SELECT) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
};
|
|
247
|
+
_this.renderDisplayAnnotation = function () {
|
|
248
|
+
var display_annotation = _this.getDisplayAnnotation();
|
|
249
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
250
|
+
className: "statistic-chart-parameter-item"
|
|
251
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
252
|
+
isChecked: display_annotation,
|
|
253
|
+
handleToggleChange: _this.onToggleDisplayAnnotation,
|
|
254
|
+
label: intl.get('Display_annotation')
|
|
255
|
+
}));
|
|
256
|
+
};
|
|
257
|
+
_this.onToggleDisplayAnnotation = function (e) {
|
|
258
|
+
var statItem = _this.props.statItem;
|
|
259
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
260
|
+
display_annotation: e.target.checked
|
|
261
|
+
}));
|
|
262
|
+
};
|
|
263
|
+
_this.getDisplayAnnotation = function () {
|
|
264
|
+
var statItem = _this.props.statItem;
|
|
265
|
+
var display_annotation = statItem.display_annotation;
|
|
266
|
+
// for stat items created before `display_annotation` was added.
|
|
267
|
+
if (display_annotation == undefined) {
|
|
268
|
+
display_annotation = true;
|
|
269
|
+
}
|
|
270
|
+
return display_annotation;
|
|
271
|
+
};
|
|
272
|
+
_this.renderAnnotationFontSizeEditor = function () {
|
|
273
|
+
var statItem = _this.props.statItem;
|
|
274
|
+
var annotation_font_size = statItem.annotation_font_size;
|
|
275
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
276
|
+
className: "statistic-chart-parameter-item"
|
|
277
|
+
}, /*#__PURE__*/React.createElement(LabelFontSizeEditor, {
|
|
278
|
+
id: 'annotation-font-size',
|
|
279
|
+
labelText: intl.get('Font_size'),
|
|
280
|
+
fontSize: annotation_font_size || DEFAULT_ANNOTATION_SIZE,
|
|
281
|
+
onChangeFontSize: _this.onChangeAnnotationFontSize
|
|
282
|
+
}));
|
|
283
|
+
};
|
|
284
|
+
_this.onChangeAnnotationFontSize = function (annotation_font_size) {
|
|
285
|
+
var statItem = _this.props.statItem;
|
|
286
|
+
_this.props.updateStatisticsSettings(Object.assign({}, statItem, {
|
|
287
|
+
annotation_font_size: annotation_font_size
|
|
288
|
+
}));
|
|
289
|
+
};
|
|
290
|
+
_this.labelFormatOptions = _this.getLabelFormatOptions();
|
|
291
|
+
_this.labelPositionOptions = _this.getLabelPositionOptions();
|
|
292
|
+
var _minimumSlicePercent = typeof props.statItem.minimum_slice_percent === 'number' ? props.statItem.minimum_slice_percent : 1.5;
|
|
293
|
+
_this.state = {
|
|
294
|
+
minimumSlicePercent: _minimumSlicePercent
|
|
295
|
+
};
|
|
296
|
+
return _this;
|
|
297
|
+
}
|
|
298
|
+
_createClass(PieStyleSettings, [{
|
|
299
|
+
key: "render",
|
|
300
|
+
value: function render() {
|
|
301
|
+
var statItem = this.props.statItem;
|
|
302
|
+
var show_percent = statItem.show_percent,
|
|
303
|
+
display_label = statItem.display_label;
|
|
304
|
+
return /*#__PURE__*/React.createElement(Fragment, null, this.renderShowLegend(), /*#__PURE__*/React.createElement("div", {
|
|
305
|
+
className: "statistic-chart-parameter-divider"
|
|
306
|
+
}), this.renderDisplayLabel(), (show_percent || display_label) && /*#__PURE__*/React.createElement(Fragment, null, this.renderLabelPositionSelector(), this.renderLabelFormatSelector(), this.renderMinimumPercent(), this.labelFontSizeEditor()), statItem.type == STAT_TYPE.RING && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
307
|
+
className: "statistic-chart-parameter-divider"
|
|
308
|
+
}), this.renderDisplayAnnotation(), this.getDisplayAnnotation() && this.renderAnnotationFontSizeEditor()), this.displayColorSelector() && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
309
|
+
className: "statistic-chart-parameter-divider"
|
|
310
|
+
}), /*#__PURE__*/React.createElement(ColorUseTypeSelector, {
|
|
311
|
+
chart: statItem,
|
|
312
|
+
updateChart: this.props.updateStatisticsSettings
|
|
313
|
+
})));
|
|
314
|
+
}
|
|
315
|
+
}]);
|
|
316
|
+
return PieStyleSettings;
|
|
317
|
+
}(Component);
|
|
318
|
+
export default PieStyleSettings;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 ToggleSetting from '../../public-setting/toggle-setting';
|
|
8
|
+
var TimeCompareStyle = /*#__PURE__*/function (_Component) {
|
|
9
|
+
_inherits(TimeCompareStyle, _Component);
|
|
10
|
+
var _super = _createSuper(TimeCompareStyle);
|
|
11
|
+
function TimeCompareStyle() {
|
|
12
|
+
var _this;
|
|
13
|
+
_classCallCheck(this, TimeCompareStyle);
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
18
|
+
_this.onToggleIncreaseLabel = function () {
|
|
19
|
+
var _this$props = _this.props,
|
|
20
|
+
statItem = _this$props.statItem,
|
|
21
|
+
updateStatItem = _this$props.updateStatItem;
|
|
22
|
+
var display_increase_percentage = statItem.display_increase_percentage;
|
|
23
|
+
updateStatItem(Object.assign({}, statItem, {
|
|
24
|
+
display_increase_percentage: !display_increase_percentage
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
_createClass(TimeCompareStyle, [{
|
|
30
|
+
key: "render",
|
|
31
|
+
value: function render() {
|
|
32
|
+
var statItem = this.props.statItem;
|
|
33
|
+
var display_increase = statItem.display_increase,
|
|
34
|
+
display_increase_percentage = statItem.display_increase_percentage;
|
|
35
|
+
if (!display_increase) return null;
|
|
36
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "statistic-chart-parameter-divider"
|
|
38
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "statistic-chart-parameter-item"
|
|
40
|
+
}, /*#__PURE__*/React.createElement(ToggleSetting, {
|
|
41
|
+
isChecked: display_increase_percentage || false,
|
|
42
|
+
handleToggleChange: this.onToggleIncreaseLabel,
|
|
43
|
+
label: intl.get('Display_percentage_increase')
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
}]);
|
|
47
|
+
return TimeCompareStyle;
|
|
48
|
+
}(Component);
|
|
49
|
+
export default TimeCompareStyle;
|