dtable-statistic 4.4.23 → 4.4.24-alpha.1

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.
Files changed (196) hide show
  1. package/es/assets/css/dashboard.css +1 -0
  2. package/es/assets/css/dialog.css +30 -0
  3. package/es/components/dialog/chart-edit-dialog.js +92 -0
  4. package/es/components/dialog/enlarged-chart-dialog.js +8 -13
  5. package/es/components/dialog/statistic-record-dialog/index.js +22 -30
  6. package/es/components/dropdown-menu/statistic-dropdown-menu.js +2 -2
  7. package/es/components/index.js +1 -15
  8. package/es/constants/index.js +1 -2
  9. package/es/dashboard.js +5 -31
  10. package/es/desktop-dashboard.js +51 -32
  11. package/es/mobile-dashboard.js +8 -16
  12. package/es/model/conver-statItem.js +124 -0
  13. package/es/service/chart-service.js +8 -15
  14. package/es/service/dashboard-service.js +25 -29
  15. package/es/stat-list/chart-preview.js +19 -20
  16. package/es/stat-list/index.js +13 -19
  17. package/es/stat-view/index.js +46 -156
  18. package/es/utils/common-utils.js +2 -352
  19. package/es/utils/export-table-utils.js +0 -69
  20. package/es/utils/index.js +0 -89
  21. package/package.json +5 -7
  22. package/es/assets/css/color-picker.css +0 -53
  23. package/es/assets/css/color-rules-popover.css +0 -144
  24. package/es/assets/css/slider.css +0 -77
  25. package/es/assets/css/statistic-chart.module.css +0 -11
  26. package/es/assets/css/statistic-custom-title.module.css +0 -3
  27. package/es/assets/css/statistic-custom.module.css +0 -4
  28. package/es/assets/css/statistic-numeric-column-item.module.css +0 -43
  29. package/es/assets/css/statistic-time-picker.module.css +0 -21
  30. package/es/calculator/base-calculator.js +0 -80
  31. package/es/calculator/basic-chart-calculator.js +0 -349
  32. package/es/calculator/combination-calculator.js +0 -246
  33. package/es/calculator/compare-bar-calculator.js +0 -197
  34. package/es/calculator/completeness-calculator.js +0 -215
  35. package/es/calculator/copy-value.js +0 -53
  36. package/es/calculator/dashboard-calculator.js +0 -70
  37. package/es/calculator/heat-map-calculator.js +0 -148
  38. package/es/calculator/horizontal-bar-calculator.js +0 -67
  39. package/es/calculator/index.js +0 -81
  40. package/es/calculator/map-calculator.js +0 -103
  41. package/es/calculator/mirror-calculator.js +0 -146
  42. package/es/calculator/number-card-calculator.js +0 -60
  43. package/es/calculator/pivot-table-calculator.js +0 -821
  44. package/es/calculator/scatter-calculator.js +0 -75
  45. package/es/calculator/thread-manager.js +0 -57
  46. package/es/calculator/trend-calculator.js +0 -113
  47. package/es/calculator/workers/basic-chart-calculator-worker.js +0 -495
  48. package/es/calculator/workers/calculator.worker.js +0 -44
  49. package/es/calculator/workers/card-calculator-worker.js +0 -40
  50. package/es/calculator/workers/combination-calculator-worker.js +0 -276
  51. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +0 -150
  52. package/es/calculator/workers/completeness-calculator-worker.js +0 -208
  53. package/es/calculator/workers/dashboard-calculator-worker.js +0 -68
  54. package/es/calculator/workers/mirror-calculator-worker.js +0 -152
  55. package/es/calculator/workers/pivot-table-calculator-worker.js +0 -718
  56. package/es/calculator/workers/scatter-calculator-worker.js +0 -80
  57. package/es/calculator/workers/trend-calculator-worker.js +0 -108
  58. package/es/calculator/world-map-calculator.js +0 -124
  59. package/es/components/common-add-tool.js +0 -28
  60. package/es/components/dialog/chart-addition-edit-dialog.js +0 -90
  61. package/es/components/dialog/chart-addition-widgets/chart-selector.js +0 -259
  62. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +0 -83
  63. package/es/components/dialog/statistic-types-dialog/index.css +0 -14
  64. package/es/components/dialog/statistic-types-dialog/index.js +0 -62
  65. package/es/components/popover/color-rules/color-rule.js +0 -183
  66. package/es/components/popover/color-rules/index.js +0 -87
  67. package/es/components/popover/color-rules/rule-filters/filter.js +0 -221
  68. package/es/components/popover/color-rules/rule-filters/index.css +0 -210
  69. package/es/components/popover/color-rules/rule-filters/index.js +0 -97
  70. package/es/components/popover/color-rules/rule-filters/number-input.js +0 -78
  71. package/es/components/popover/color-rules-popover.js +0 -217
  72. package/es/components/popover/color-selector-popover.js +0 -82
  73. package/es/components/seatable-radio/index.css +0 -51
  74. package/es/components/seatable-radio/index.js +0 -35
  75. package/es/custom-g2.js +0 -644
  76. package/es/model/bar-group.js +0 -58
  77. package/es/model/bar.js +0 -47
  78. package/es/model/base-model.js +0 -18
  79. package/es/model/basic-number-card.js +0 -25
  80. package/es/model/combination.js +0 -48
  81. package/es/model/compare-bar.js +0 -56
  82. package/es/model/completeness-group.js +0 -31
  83. package/es/model/completeness.js +0 -25
  84. package/es/model/custom-bar.js +0 -25
  85. package/es/model/dashboard.js +0 -20
  86. package/es/model/generic-model.js +0 -222
  87. package/es/model/heat-map.js +0 -33
  88. package/es/model/horizontal-bar-group.js +0 -55
  89. package/es/model/horizontal-bar.js +0 -47
  90. package/es/model/index.js +0 -187
  91. package/es/model/map.js +0 -38
  92. package/es/model/mirror.js +0 -33
  93. package/es/model/pie.js +0 -38
  94. package/es/model/ring.js +0 -40
  95. package/es/model/scatter.js +0 -22
  96. package/es/model/table.js +0 -32
  97. package/es/model/trend.js +0 -32
  98. package/es/model/world-map.js +0 -34
  99. package/es/stat-editor/chart-name-editor.js +0 -68
  100. package/es/stat-editor/index.js +0 -75
  101. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +0 -153
  102. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +0 -422
  103. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +0 -203
  104. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +0 -23
  105. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +0 -104
  106. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +0 -334
  107. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +0 -119
  108. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +0 -132
  109. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +0 -240
  110. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +0 -89
  111. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +0 -138
  112. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +0 -331
  113. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +0 -143
  114. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +0 -109
  115. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +0 -153
  116. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +0 -144
  117. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +0 -214
  118. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +0 -121
  119. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +0 -172
  120. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +0 -366
  121. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +0 -142
  122. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +0 -150
  123. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +0 -473
  124. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +0 -182
  125. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +0 -564
  126. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +0 -112
  127. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +0 -87
  128. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +0 -187
  129. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +0 -300
  130. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +0 -113
  131. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +0 -289
  132. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +0 -58
  133. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +0 -359
  134. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +0 -48
  135. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +0 -121
  136. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +0 -143
  137. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +0 -269
  138. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +0 -104
  139. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +0 -366
  140. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +0 -55
  141. package/es/stat-editor/stat-settings/color-setting/color-picker.js +0 -130
  142. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +0 -374
  143. package/es/stat-editor/stat-settings/map/map-level.js +0 -72
  144. package/es/stat-editor/stat-settings/map/map-province-city.js +0 -151
  145. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +0 -108
  146. package/es/stat-editor/stat-settings/public-setting/base-settings.js +0 -154
  147. package/es/stat-editor/stat-settings/public-setting/calender.js +0 -125
  148. package/es/stat-editor/stat-settings/public-setting/column-settings.js +0 -24
  149. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +0 -62
  150. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +0 -61
  151. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +0 -35
  152. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +0 -60
  153. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +0 -123
  154. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +0 -33
  155. package/es/stat-editor/stat-settings/public-setting/type-settings/index.css +0 -29
  156. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +0 -82
  157. package/es/stat-view/area-chart.js +0 -551
  158. package/es/stat-view/bar-chart.js +0 -582
  159. package/es/stat-view/base-chart.js +0 -132
  160. package/es/stat-view/basic-number-card.js +0 -201
  161. package/es/stat-view/combination-chart.js +0 -546
  162. package/es/stat-view/compare-chart.js +0 -483
  163. package/es/stat-view/completeness-chart.js +0 -390
  164. package/es/stat-view/custom-bar.js +0 -418
  165. package/es/stat-view/dashboard-chart.js +0 -266
  166. package/es/stat-view/heat-map.js +0 -463
  167. package/es/stat-view/horizontal-bar-chart.js +0 -562
  168. package/es/stat-view/line-chart.js +0 -518
  169. package/es/stat-view/map.js +0 -448
  170. package/es/stat-view/mirror.js +0 -275
  171. package/es/stat-view/pie-chart.js +0 -290
  172. package/es/stat-view/pivot-table/index.js +0 -196
  173. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +0 -156
  174. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +0 -176
  175. package/es/stat-view/pivot-table/pivot-table-display-name.js +0 -215
  176. package/es/stat-view/pivot-table/statistic-pivot-table.module.css +0 -132
  177. package/es/stat-view/pivot-table/two-dimension-table.js +0 -384
  178. package/es/stat-view/ring-chart.js +0 -392
  179. package/es/stat-view/scatter-chart.js +0 -306
  180. package/es/stat-view/treemap-chart.js +0 -253
  181. package/es/stat-view/trend-chart.js +0 -249
  182. package/es/stat-view/world-map.js +0 -431
  183. package/es/utils/basic-chart-utils.js +0 -29
  184. package/es/utils/cell-format.js +0 -115
  185. package/es/utils/collaborator.js +0 -50
  186. package/es/utils/color-utils.js +0 -134
  187. package/es/utils/column-utils.js +0 -110
  188. package/es/utils/column.js +0 -20
  189. package/es/utils/date-format.js +0 -71
  190. package/es/utils/map.js +0 -114
  191. package/es/utils/model.js +0 -19
  192. package/es/utils/row-utils.js +0 -134
  193. package/es/utils/search.js +0 -73
  194. package/es/utils/sql-utils.js +0 -359
  195. package/es/utils/stat-utils.js +0 -351
  196. package/es/utils/trend-utils.js +0 -135
@@ -1,374 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _reactstrap = require("reactstrap");
12
- var _reactColor = _interopRequireDefault(require("react-color"));
13
- var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
14
- var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
15
- var _colorRulesPopover = _interopRequireDefault(require("../../../components/popover/color-rules-popover"));
16
- var _colorUtils = require("../../../utils/color-utils");
17
- var _constants = require("../../../constants");
18
- var _colorRules = require("../../../constants/color-rules");
19
- const COVER = {
20
- top: '0px',
21
- right: '0px',
22
- bottom: '0px',
23
- left: '0px'
24
- };
25
- class ColorUseTypeSelector extends _react.Component {
26
- constructor(props) {
27
- super(props);
28
- this.getPopoverStyle = () => {
29
- if (!this.colorPickerContainerRef) return {};
30
- const {
31
- top,
32
- height
33
- } = this.colorPickerContainerRef.getBoundingClientRect();
34
- const {
35
- clientHeight
36
- } = document.body;
37
- const selectTop = top + height;
38
- if (clientHeight - selectTop < 247) {
39
- // 247: ReactColor's height
40
- return {
41
- position: 'absolute',
42
- left: '20px',
43
- bottom: '2.375rem',
44
- zIndex: '2'
45
- };
46
- }
47
- return {
48
- position: 'absolute',
49
- left: '20px',
50
- zIndex: '2'
51
- };
52
- };
53
- this.getUsableColorTypes = chartType => {
54
- switch (chartType) {
55
- case _constants.STAT_TYPE.BAR_GROUP:
56
- case _constants.STAT_TYPE.BAR_STACK:
57
- case _constants.STAT_TYPE.HORIZONTAL_GROUP_BAR:
58
- case _constants.STAT_TYPE.STACKED_HORIZONTAL_BAR:
59
- case _constants.STAT_TYPE.PIE:
60
- case _constants.STAT_TYPE.RING:
61
- case _constants.STAT_TYPE.GROUP_LINE:
62
- case _constants.STAT_TYPE.AREA_GROUP_CHART:
63
- {
64
- return [_constants.TYPE_COLOR_USING.USE_DEFAULT, _constants.TYPE_COLOR_USING.USE_COLUMN_COLORS];
65
- }
66
- case _constants.STAT_TYPE.BAR:
67
- case _constants.STAT_TYPE.HORIZONTAL_BAR:
68
- {
69
- return [_constants.TYPE_COLOR_USING.USE_DEFAULT, _constants.TYPE_COLOR_USING.USE_SPECIFIC_COLORS, _constants.TYPE_COLOR_USING.USE_RULES];
70
- }
71
- default:
72
- {
73
- return [_constants.TYPE_COLOR_USING.USE_DEFAULT];
74
- }
75
- }
76
- };
77
- this.initColorTypeOptions = () => {
78
- const {
79
- chart
80
- } = this.props;
81
- const {
82
- type
83
- } = chart;
84
- const useableColorTypes = this.getUsableColorTypes(type);
85
- return useableColorTypes.map(colorType => {
86
- return {
87
- value: colorType,
88
- label: /*#__PURE__*/_react.default.createElement("span", {
89
- className: "select-module select-module-name"
90
- }, _reactIntlUniversal.default.get(_constants.TYPE_DISPLAY_COLOR_USING[colorType]))
91
- };
92
- });
93
- };
94
- this.getSelectedSpecificColor = () => {
95
- const {
96
- chart,
97
- labelColorConfigs
98
- } = this.props;
99
- const {
100
- type
101
- } = chart;
102
- switch (type) {
103
- case _constants.STAT_TYPE.BAR:
104
- {
105
- const {
106
- y_axis_label_color
107
- } = chart;
108
- if (y_axis_label_color) {
109
- return y_axis_label_color.toUpperCase();
110
- }
111
- return labelColorConfigs[0].color;
112
- }
113
- case _constants.STAT_TYPE.HORIZONTAL_BAR:
114
- {
115
- const {
116
- horizontal_axis_label_color
117
- } = chart;
118
- if (horizontal_axis_label_color) {
119
- return horizontal_axis_label_color.toUpperCase();
120
- }
121
- return labelColorConfigs[0].color;
122
- }
123
- default:
124
- {
125
- return '';
126
- }
127
- }
128
- };
129
- this.getColorRules = () => {
130
- const {
131
- chart
132
- } = this.props;
133
- const {
134
- type
135
- } = chart;
136
- switch (type) {
137
- case _constants.STAT_TYPE.BAR:
138
- {
139
- return (0, _colorUtils.getValidColorRules)(chart.y_axis_label_color_rules);
140
- }
141
- case _constants.STAT_TYPE.HORIZONTAL_BAR:
142
- {
143
- return (0, _colorUtils.getValidColorRules)(chart.horizontal_axis_label_color_rules);
144
- }
145
- default:
146
- {
147
- return [];
148
- }
149
- }
150
- };
151
- this.getColorRuleTypes = () => {
152
- const {
153
- chart
154
- } = this.props;
155
- const {
156
- type
157
- } = chart;
158
- switch (type) {
159
- case _constants.STAT_TYPE.BAR:
160
- case _constants.STAT_TYPE.HORIZONTAL_BAR:
161
- {
162
- return [_colorRules.COLOR_RULE_FILTER_TYPE_MAP.NUMERIC_VALUE];
163
- }
164
- default:
165
- {
166
- return [];
167
- }
168
- }
169
- };
170
- this.onSelectColorOption = _ref => {
171
- let {
172
- value: color_option
173
- } = _ref;
174
- const {
175
- chart,
176
- labelColorConfigs
177
- } = this.props;
178
- let updatedChart = Object.assign({}, chart, {
179
- color_option
180
- });
181
- if (color_option === _constants.TYPE_COLOR_USING.USE_SPECIFIC_COLORS) {
182
- switch (chart.type) {
183
- case _constants.STAT_TYPE.BAR:
184
- {
185
- updatedChart.y_axis_label_color = updatedChart.y_axis_label_color || labelColorConfigs[0].color;
186
- break;
187
- }
188
- case _constants.STAT_TYPE.HORIZONTAL_BAR:
189
- {
190
- updatedChart.horizontal_axis_label_color = updatedChart.horizontal_axis_label_color || labelColorConfigs[0].color;
191
- break;
192
- }
193
- default:
194
- {
195
- break;
196
- }
197
- }
198
- }
199
- this.props.updateChart(updatedChart);
200
- };
201
- this.onToggleColorSelector = () => {
202
- this.setState({
203
- isShowColorSelector: !this.state.isShowColorSelector
204
- }, () => {
205
- if (!this.state.isShowColorSelector) {
206
- this.modifySpecificColor(this.state.specificColor);
207
- }
208
- });
209
- };
210
- this.showColorRulesEditor = () => {
211
- if (this.state.isShowColorRulesEditor) {
212
- return;
213
- }
214
- this.setState({
215
- isShowColorRulesEditor: true
216
- });
217
- };
218
- this.hideColorRulesEditor = () => {
219
- this.setState({
220
- isShowColorRulesEditor: false
221
- });
222
- };
223
- this.modifySpecificColor = color => {
224
- const {
225
- chart
226
- } = this.props;
227
- let updatedChart = Object.assign({}, chart);
228
- switch (chart.type) {
229
- case _constants.STAT_TYPE.BAR:
230
- {
231
- updatedChart.y_axis_label_color = color;
232
- break;
233
- }
234
- case _constants.STAT_TYPE.HORIZONTAL_BAR:
235
- {
236
- updatedChart.horizontal_axis_label_color = color;
237
- break;
238
- }
239
- default:
240
- {
241
- break;
242
- }
243
- }
244
- this.setState({
245
- specificColor: color
246
- }, () => {
247
- this.props.updateChart(updatedChart);
248
- });
249
- };
250
- this.modifyHex = colorSelection => {
251
- if (colorSelection.hex === this.state.specificColor) return;
252
- this.setState({
253
- specificColor: colorSelection.hex
254
- });
255
- };
256
- this.modifyColorRules = colorRules => {
257
- const {
258
- chart
259
- } = this.props;
260
- let updatedChart = Object.assign({}, chart);
261
- switch (chart.type) {
262
- case _constants.STAT_TYPE.BAR:
263
- {
264
- updatedChart.y_axis_label_color_rules = colorRules;
265
- break;
266
- }
267
- case _constants.STAT_TYPE.HORIZONTAL_BAR:
268
- {
269
- updatedChart.horizontal_axis_label_color_rules = colorRules;
270
- break;
271
- }
272
- default:
273
- {
274
- break;
275
- }
276
- }
277
- this.props.updateChart(updatedChart);
278
- };
279
- this.renderSpecificColorSelector = () => {
280
- const {
281
- specificColor
282
- } = this.state;
283
- const id = 'statistic_selected_specific_color';
284
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
285
- id: id,
286
- className: "selected-specific-color mt-1",
287
- ref: ref => this.colorPickerContainerRef = ref
288
- }, /*#__PURE__*/_react.default.createElement("div", {
289
- className: "selected-specific-color-wrapper"
290
- }, /*#__PURE__*/_react.default.createElement("span", {
291
- className: "specific-color-show",
292
- style: {
293
- backgroundColor: specificColor
294
- },
295
- onClick: this.onToggleColorSelector
296
- }), /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
297
- type: "text",
298
- className: "specific-color-input",
299
- value: specificColor,
300
- onChange: event => this.modifySpecificColor(event.target.value)
301
- }))), this.state.isShowColorSelector && /*#__PURE__*/_react.default.createElement("div", {
302
- style: this.getPopoverStyle()
303
- }, /*#__PURE__*/_react.default.createElement("div", {
304
- className: "position-fixed",
305
- style: COVER,
306
- onClick: this.onToggleColorSelector
307
- }), /*#__PURE__*/_react.default.createElement(_reactColor.default, {
308
- disableAlpha: true,
309
- color: specificColor,
310
- onChange: this.modifyHex
311
- })));
312
- };
313
- this.renderColorRulesEditor = () => {
314
- const {
315
- labelColorConfigs
316
- } = this.props;
317
- const colorRules = this.getColorRules();
318
- const colorRuleTypes = this.getColorRuleTypes();
319
- const rulesLen = colorRules ? colorRules.length : 0;
320
- const hasRules = rulesLen > 0;
321
- const id = 'statistic_color_rules_toggle';
322
- let msg = _reactIntlUniversal.default.get('Add_rule');
323
- if (rulesLen === 1) {
324
- msg = _reactIntlUniversal.default.get('Added_1_rule');
325
- } else if (rulesLen > 1) {
326
- msg = _reactIntlUniversal.default.get('Added_xxx_rules', {
327
- rules_count: rulesLen
328
- });
329
- }
330
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
331
- id: id,
332
- className: (0, _classnames.default)('statistic-color-rules-toggle', 'mt-1', hasRules ? 'statistic-edit-color-rule' : 'statistic-add-color-rule'),
333
- onClick: this.showColorRulesEditor
334
- }, hasRules ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", null, msg), /*#__PURE__*/_react.default.createElement("i", {
335
- className: "dtable-font dtable-icon-rename"
336
- })) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("i", {
337
- className: "dtable-font dtable-icon-add-table"
338
- }), /*#__PURE__*/_react.default.createElement("span", {
339
- className: "ml-2"
340
- }, msg))), this.state.isShowColorRulesEditor && /*#__PURE__*/_react.default.createElement(_colorRulesPopover.default, {
341
- target: id,
342
- colorRules: colorRules,
343
- colorRuleTypes: colorRuleTypes,
344
- labelColorConfigs: labelColorConfigs,
345
- hideColorRulesPopover: this.hideColorRulesEditor,
346
- updateColorRules: this.modifyColorRules
347
- }));
348
- };
349
- this.state = {
350
- isShowColorSelector: false,
351
- isShowColorRulesEditor: false,
352
- specificColor: this.getSelectedSpecificColor()
353
- };
354
- this.colorOptions = this.initColorTypeOptions();
355
- this.isToggleColorRulesEditor = false;
356
- }
357
- render() {
358
- const {
359
- chart
360
- } = this.props;
361
- const {
362
- color_option
363
- } = chart;
364
- const selectedColorOption = this.colorOptions.find(colorOption => colorOption.value === color_option) || this.colorOptions[0];
365
- return /*#__PURE__*/_react.default.createElement("div", {
366
- className: "statistic-chart-parameter-item"
367
- }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Color')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
368
- value: selectedColorOption,
369
- options: this.colorOptions,
370
- onChange: this.onSelectColorOption
371
- }), color_option === _constants.TYPE_COLOR_USING.USE_SPECIFIC_COLORS && this.renderSpecificColorSelector(), color_option === _constants.TYPE_COLOR_USING.USE_RULES && this.renderColorRulesEditor());
372
- }
373
- }
374
- var _default = exports.default = ColorUseTypeSelector;
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
11
- var _map = require("../../../utils/map");
12
- var _map2 = require("../../../constants/map");
13
- const MAP_LEVELS = [{
14
- key: _map2.MAP_LEVEL.COUNTRY,
15
- name: '国家'
16
- }, {
17
- key: _map2.MAP_LEVEL.PROVINCE,
18
- name: '省级'
19
- }, {
20
- key: _map2.MAP_LEVEL.CITY,
21
- name: '市级'
22
- }];
23
- class MapLevelSettings extends _react.Component {
24
- constructor(props) {
25
- super(props);
26
- this.createMapLevelOptions = () => {
27
- return MAP_LEVELS.map(mapLevel => {
28
- return {
29
- label: /*#__PURE__*/_react.default.createElement("span", {
30
- className: "select-option-name"
31
- }, mapLevel.name),
32
- value: mapLevel.key
33
- };
34
- });
35
- };
36
- this.getSelectedMapLevelOption = () => {
37
- const {
38
- map_level
39
- } = this.props.statItem;
40
- const defaultOption = this.mapLevelOptions[0];
41
- if (!map_level) return defaultOption;
42
- return this.mapLevelOptions.find(option => option.value === map_level) || defaultOption;
43
- };
44
- this.onSelectMapLevel = option => {
45
- const {
46
- map_level,
47
- map_location
48
- } = this.props.statItem;
49
- const newLevel = option.value;
50
- if (newLevel === map_level) return;
51
- const updated = {
52
- map_level: newLevel,
53
- geolocation_granularity: (0, _map.fixGeoGranularity)({
54
- mapLevel: newLevel,
55
- mapLocation: map_location
56
- })
57
- };
58
- this.props.updateStatItem(Object.assign({}, this.props.statItem, updated));
59
- };
60
- this.mapLevelOptions = this.createMapLevelOptions();
61
- }
62
- render() {
63
- return /*#__PURE__*/_react.default.createElement("div", {
64
- className: "statistic-chart-parameter-item"
65
- }, /*#__PURE__*/_react.default.createElement("label", null, "\u5730\u56FE\u7EA7\u522B"), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
66
- value: this.getSelectedMapLevelOption(),
67
- options: this.mapLevelOptions,
68
- onChange: this.onSelectMapLevel
69
- }));
70
- }
71
- }
72
- var _default = exports.default = MapLevelSettings;
@@ -1,151 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
11
- var _map = require("../../../constants/map");
12
- var _regions = require("../../../constants/regions");
13
- var _map2 = require("../../../utils/map");
14
- class MapProvinceCitySettings extends _react.Component {
15
- constructor(props) {
16
- super(props);
17
- this.isProvinceWithCities = province => {
18
- const provinceWithCities = _regions.regions.find(provinceWithCities => provinceWithCities.name === province);
19
- return provinceWithCities && provinceWithCities.cities.length > 0;
20
- };
21
- this.createProvinceOptions = () => {
22
- return _regions.regions.map(provinceWithCities => {
23
- const {
24
- name
25
- } = provinceWithCities;
26
- return {
27
- label: /*#__PURE__*/_react.default.createElement("span", {
28
- className: "select-option-name"
29
- }, name),
30
- value: name
31
- };
32
- });
33
- };
34
- this.createProvinceCitiesOptions = province => {
35
- const provinceWithCities = _regions.regions.find(provinceWithCities => provinceWithCities.name === province);
36
- if (!provinceWithCities || provinceWithCities.cities.length === 0) return [];
37
- return provinceWithCities.cities.map(city => {
38
- const {
39
- name
40
- } = city;
41
- return {
42
- label: /*#__PURE__*/_react.default.createElement("span", {
43
- className: "select-option-name"
44
- }, name),
45
- value: name
46
- };
47
- });
48
- };
49
- this.getProvinceCitiesOptions = province => {
50
- if (this.provinceCitiesOptionsMap[province]) {
51
- return this.provinceCitiesOptionsMap[province];
52
- }
53
- const citiesOptions = this.createProvinceCitiesOptions(province);
54
- this.provinceCitiesOptionsMap[province] = citiesOptions;
55
- return citiesOptions;
56
- };
57
- this.getSelectedProvinceOption = () => {
58
- const {
59
- map_location
60
- } = this.props.statItem;
61
- const province = map_location && map_location.province;
62
- if (!province) return null;
63
- return this.provinceOptions.find(option => option.value === province);
64
- };
65
- this.getSelectedCity = citiesOptions => {
66
- const {
67
- map_location
68
- } = this.props.statItem;
69
- const city = map_location && map_location.city;
70
- if (!city) return null;
71
- return citiesOptions.find(option => option.value === city);
72
- };
73
- this.onSelectProvince = option => {
74
- const {
75
- statItem
76
- } = this.props;
77
- const {
78
- map_level,
79
- map_location
80
- } = statItem;
81
- const newMapLocation = {
82
- province: option.value
83
- };
84
- if (map_location && newMapLocation.province === map_location.province) return;
85
- const updated = {
86
- map_location: newMapLocation,
87
- geolocation_granularity: (0, _map2.fixGeoGranularity)({
88
- mapLevel: map_level,
89
- mapLocation: newMapLocation
90
- })
91
- };
92
- this.props.updateStatItem(Object.assign({}, statItem, updated));
93
- };
94
- this.onSelectCity = option => {
95
- const {
96
- statItem
97
- } = this.props;
98
- const {
99
- map_level,
100
- map_location
101
- } = statItem;
102
- const newMapLocation = Object.assign({}, map_location, {
103
- city: option.value
104
- });
105
- if (map_location && newMapLocation.city === map_location.city) return;
106
- const updated = {
107
- map_location: newMapLocation,
108
- geolocation_granularity: (0, _map2.fixGeoGranularity)({
109
- mapLevel: map_level,
110
- mapLocation: newMapLocation
111
- })
112
- };
113
- this.props.updateStatItem(Object.assign({}, statItem, updated));
114
- };
115
- this.renderCitySelector = () => {
116
- const {
117
- map_location
118
- } = this.props.statItem;
119
- const province = map_location && map_location.province;
120
- const citiesOptions = this.getProvinceCitiesOptions(province);
121
- return /*#__PURE__*/_react.default.createElement("div", {
122
- className: "statistic-chart-parameter-item"
123
- }, /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
124
- value: this.getSelectedCity(citiesOptions),
125
- options: citiesOptions,
126
- onChange: this.onSelectCity,
127
- placeholder: "\u8BF7\u9009\u62E9\u57CE\u5E02"
128
- }));
129
- };
130
- this.provinceOptions = this.createProvinceOptions();
131
- this.provinceCitiesOptionsMap = {};
132
- }
133
- render() {
134
- const {
135
- map_level
136
- } = this.props.statItem;
137
- if (map_level !== _map.MAP_LEVEL.PROVINCE && map_level !== _map.MAP_LEVEL.CITY) {
138
- return null;
139
- }
140
- const isCity = map_level === _map.MAP_LEVEL.CITY;
141
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
142
- className: "statistic-chart-parameter-item"
143
- }, /*#__PURE__*/_react.default.createElement("label", null, isCity ? '城市' : '省份'), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
144
- value: this.getSelectedProvinceOption(),
145
- options: this.provinceOptions,
146
- onChange: this.onSelectProvince,
147
- placeholder: "\u8BF7\u9009\u62E9\u7701\u4EFD"
148
- })), isCity && this.renderCitySelector());
149
- }
150
- }
151
- var _default = exports.default = MapProvinceCitySettings;
@@ -1,108 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
11
- var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
12
- const LABEL_POSITIONS_X = ['left', 'center', 'right'];
13
- const LABEL_POSITIONS_Y = ['bottom', 'center', 'top'];
14
- const LABEL_POSITIONS_SHOW_X = {
15
- left: 'Left',
16
- center: 'Center',
17
- right: 'Right'
18
- };
19
- const LABEL_POSITIONS_SHOW_Y = {
20
- bottom: 'Bottom',
21
- center: 'Center',
22
- top: 'Top'
23
- };
24
- class AxisLabelPosition extends _react.Component {
25
- constructor(props) {
26
- super(props);
27
- this.getLabelPositionOptions = () => {
28
- let {
29
- axisType
30
- } = this.props;
31
- let positions = LABEL_POSITIONS_X;
32
- if (axisType.includes('y') || axisType === 'vertical') {
33
- positions = LABEL_POSITIONS_Y;
34
- }
35
- if (axisType === 'x' || axisType === 'horizontal') {
36
- return positions.map(g => {
37
- return {
38
- value: g,
39
- label: /*#__PURE__*/_react.default.createElement("span", {
40
- className: 'select-module select-module-name'
41
- }, _reactIntlUniversal.default.get(LABEL_POSITIONS_SHOW_X[g]))
42
- };
43
- });
44
- }
45
- if (axisType.includes('y') || axisType === 'vertical') {
46
- return positions.map(g => {
47
- return {
48
- value: g,
49
- label: /*#__PURE__*/_react.default.createElement("span", {
50
- className: 'select-module select-module-name'
51
- }, _reactIntlUniversal.default.get(LABEL_POSITIONS_SHOW_Y[g]))
52
- };
53
- });
54
- }
55
- };
56
- this.onSelectAxisPosition = option => {
57
- let {
58
- axisType
59
- } = this.props;
60
- this.props.onSelectAxisLabelPosition(axisType, option);
61
- };
62
- this.renderXAxisLabelPosition = () => {
63
- let {
64
- statItem,
65
- axisType
66
- } = this.props;
67
- let selectedOption = null;
68
- if (axisType === 'y' || axisType === 'vertical') {
69
- const {
70
- y_axis_label_position,
71
- vertical_axis_label_position
72
- } = statItem;
73
- selectedOption = this.labelPositionOptions.find(item => {
74
- return item.value === y_axis_label_position || item.value === vertical_axis_label_position;
75
- });
76
- } else if (axisType === 'y_left' || axisType === 'y_right') {
77
- const {
78
- y_axis_left_label_position,
79
- y_axis_right_label_position
80
- } = statItem;
81
- let target = axisType === 'y_left' ? y_axis_left_label_position : y_axis_right_label_position;
82
- selectedOption = this.labelPositionOptions.find(item => {
83
- return item.value === target;
84
- });
85
- } else {
86
- const {
87
- x_axis_label_position,
88
- horizontal_axis_label_position
89
- } = statItem;
90
- selectedOption = this.labelPositionOptions.find(item => {
91
- return item.value === x_axis_label_position || item.value === horizontal_axis_label_position;
92
- });
93
- }
94
- return /*#__PURE__*/_react.default.createElement("div", {
95
- className: "mt-1"
96
- }, /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
97
- value: selectedOption,
98
- onChange: this.onSelectAxisPosition,
99
- options: this.labelPositionOptions
100
- }));
101
- };
102
- this.labelPositionOptions = this.getLabelPositionOptions();
103
- }
104
- render() {
105
- return this.renderXAxisLabelPosition();
106
- }
107
- }
108
- var _default = exports.default = AxisLabelPosition;