dtable-statistic 4.4.24-alpha.9 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/es/assets/css/color-picker.css +53 -0
  2. package/es/assets/css/color-rules-popover.css +144 -0
  3. package/es/assets/css/dashboard.css +0 -1
  4. package/es/assets/css/dialog.css +0 -30
  5. package/es/assets/css/slider.css +77 -0
  6. package/es/assets/css/statistic-chart.module.css +11 -0
  7. package/es/assets/css/statistic-custom-title.module.css +3 -0
  8. package/es/assets/css/statistic-custom.module.css +4 -0
  9. package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
  10. package/es/assets/css/statistic-time-picker.module.css +21 -0
  11. package/es/calculator/base-calculator.js +80 -0
  12. package/es/calculator/basic-chart-calculator.js +349 -0
  13. package/es/calculator/combination-calculator.js +246 -0
  14. package/es/calculator/compare-bar-calculator.js +197 -0
  15. package/es/calculator/completeness-calculator.js +215 -0
  16. package/es/calculator/copy-value.js +53 -0
  17. package/es/calculator/dashboard-calculator.js +70 -0
  18. package/es/calculator/heat-map-calculator.js +148 -0
  19. package/es/calculator/horizontal-bar-calculator.js +67 -0
  20. package/es/calculator/index.js +81 -0
  21. package/es/calculator/map-calculator.js +103 -0
  22. package/es/calculator/mirror-calculator.js +146 -0
  23. package/es/calculator/number-card-calculator.js +60 -0
  24. package/es/calculator/pivot-table-calculator.js +821 -0
  25. package/es/calculator/scatter-calculator.js +75 -0
  26. package/es/calculator/thread-manager.js +57 -0
  27. package/es/calculator/trend-calculator.js +113 -0
  28. package/es/calculator/workers/basic-chart-calculator-worker.js +495 -0
  29. package/es/calculator/workers/calculator.worker.js +44 -0
  30. package/es/calculator/workers/card-calculator-worker.js +40 -0
  31. package/es/calculator/workers/combination-calculator-worker.js +276 -0
  32. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +150 -0
  33. package/es/calculator/workers/completeness-calculator-worker.js +208 -0
  34. package/es/calculator/workers/dashboard-calculator-worker.js +68 -0
  35. package/es/calculator/workers/mirror-calculator-worker.js +152 -0
  36. package/es/calculator/workers/pivot-table-calculator-worker.js +718 -0
  37. package/es/calculator/workers/scatter-calculator-worker.js +80 -0
  38. package/es/calculator/workers/trend-calculator-worker.js +108 -0
  39. package/es/calculator/world-map-calculator.js +124 -0
  40. package/es/components/dialog/chart-addition-edit-dialog.js +90 -0
  41. package/es/components/dialog/chart-addition-widgets/chart-selector.js +259 -0
  42. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +83 -0
  43. package/es/components/dialog/enlarged-chart-dialog.js +13 -8
  44. package/es/components/dialog/statistic-record-dialog/index.js +34 -25
  45. package/es/components/dialog/statistic-types-dialog/index.css +14 -0
  46. package/es/components/dialog/statistic-types-dialog/index.js +62 -0
  47. package/es/components/dropdown-menu/statistic-dropdown-menu.js +2 -2
  48. package/es/components/popover/color-rules/color-rule.js +183 -0
  49. package/es/components/popover/color-rules/index.js +87 -0
  50. package/es/components/popover/color-rules/rule-filters/filter.js +221 -0
  51. package/es/components/popover/color-rules/rule-filters/index.css +210 -0
  52. package/es/components/popover/color-rules/rule-filters/index.js +97 -0
  53. package/es/components/popover/color-rules/rule-filters/number-input.js +78 -0
  54. package/es/components/popover/color-rules-popover.js +218 -0
  55. package/es/components/popover/color-selector-popover.js +83 -0
  56. package/es/constants/index.js +2 -1
  57. package/es/custom-g2.js +644 -0
  58. package/es/dashboard.js +31 -9
  59. package/es/desktop-dashboard.js +32 -51
  60. package/es/mobile-dashboard.js +16 -8
  61. package/es/model/bar-group.js +58 -0
  62. package/es/model/bar.js +47 -0
  63. package/es/model/base-model.js +18 -0
  64. package/es/model/basic-number-card.js +25 -0
  65. package/es/model/combination.js +48 -0
  66. package/es/model/compare-bar.js +56 -0
  67. package/es/model/completeness-group.js +31 -0
  68. package/es/model/completeness.js +25 -0
  69. package/es/model/custom-bar.js +25 -0
  70. package/es/model/dashboard.js +20 -0
  71. package/es/model/generic-model.js +222 -0
  72. package/es/model/heat-map.js +33 -0
  73. package/es/model/horizontal-bar-group.js +55 -0
  74. package/es/model/horizontal-bar.js +47 -0
  75. package/es/model/index.js +187 -0
  76. package/es/model/map.js +38 -0
  77. package/es/model/mirror.js +33 -0
  78. package/es/model/pie.js +38 -0
  79. package/es/model/ring.js +40 -0
  80. package/es/model/scatter.js +22 -0
  81. package/es/model/table.js +32 -0
  82. package/es/model/trend.js +32 -0
  83. package/es/model/world-map.js +34 -0
  84. package/es/service/chart-service.js +15 -8
  85. package/es/service/dashboard-service.js +29 -25
  86. package/es/stat-editor/chart-name-editor.js +68 -0
  87. package/es/stat-editor/index.js +75 -0
  88. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +153 -0
  89. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +422 -0
  90. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +203 -0
  91. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +23 -0
  92. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +104 -0
  93. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +334 -0
  94. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +119 -0
  95. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +132 -0
  96. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +240 -0
  97. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
  98. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +138 -0
  99. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +331 -0
  100. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +143 -0
  101. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +109 -0
  102. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +153 -0
  103. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +144 -0
  104. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +214 -0
  105. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +121 -0
  106. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +172 -0
  107. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +366 -0
  108. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +142 -0
  109. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +150 -0
  110. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +473 -0
  111. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +182 -0
  112. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +564 -0
  113. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +112 -0
  114. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +87 -0
  115. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +187 -0
  116. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +300 -0
  117. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +113 -0
  118. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +289 -0
  119. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +58 -0
  120. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +359 -0
  121. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +48 -0
  122. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +121 -0
  123. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +143 -0
  124. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +269 -0
  125. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +104 -0
  126. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +366 -0
  127. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +55 -0
  128. package/es/stat-editor/stat-settings/color-setting/color-picker.js +130 -0
  129. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +374 -0
  130. package/es/stat-editor/stat-settings/map/map-level.js +72 -0
  131. package/es/stat-editor/stat-settings/map/map-province-city.js +151 -0
  132. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +108 -0
  133. package/es/stat-editor/stat-settings/public-setting/base-settings.js +154 -0
  134. package/es/stat-editor/stat-settings/public-setting/calender.js +125 -0
  135. package/es/stat-editor/stat-settings/public-setting/column-settings.js +24 -0
  136. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +62 -0
  137. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +61 -0
  138. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +35 -0
  139. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +60 -0
  140. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +123 -0
  141. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +33 -0
  142. package/es/stat-editor/stat-settings/public-setting/type-settings/index.css +29 -0
  143. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +82 -0
  144. package/es/stat-list/chart-preview.js +20 -19
  145. package/es/stat-list/index.js +21 -15
  146. package/es/stat-view/area-chart.js +551 -0
  147. package/es/stat-view/bar-chart.js +582 -0
  148. package/es/stat-view/base-chart.js +132 -0
  149. package/es/stat-view/basic-number-card.js +201 -0
  150. package/es/stat-view/combination-chart.js +546 -0
  151. package/es/stat-view/compare-chart.js +483 -0
  152. package/es/stat-view/completeness-chart.js +390 -0
  153. package/es/stat-view/custom-bar.js +418 -0
  154. package/es/stat-view/dashboard-chart.js +266 -0
  155. package/es/stat-view/heat-map.js +463 -0
  156. package/es/stat-view/horizontal-bar-chart.js +562 -0
  157. package/es/stat-view/index.js +156 -47
  158. package/es/stat-view/line-chart.js +518 -0
  159. package/es/stat-view/map.js +448 -0
  160. package/es/stat-view/mirror.js +275 -0
  161. package/es/stat-view/pie-chart.js +290 -0
  162. package/es/stat-view/pivot-table/index.js +196 -0
  163. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +156 -0
  164. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +176 -0
  165. package/es/stat-view/pivot-table/pivot-table-display-name.js +215 -0
  166. package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
  167. package/es/stat-view/pivot-table/two-dimension-table.js +384 -0
  168. package/es/stat-view/ring-chart.js +392 -0
  169. package/es/stat-view/scatter-chart.js +306 -0
  170. package/es/stat-view/treemap-chart.js +253 -0
  171. package/es/stat-view/trend-chart.js +249 -0
  172. package/es/stat-view/world-map.js +431 -0
  173. package/es/tabs/tab.js +2 -2
  174. package/es/utils/basic-chart-utils.js +29 -0
  175. package/es/utils/cell-format.js +115 -0
  176. package/es/utils/collaborator.js +50 -0
  177. package/es/utils/color-utils.js +134 -0
  178. package/es/utils/column-utils.js +110 -0
  179. package/es/utils/column.js +20 -0
  180. package/es/utils/common-utils.js +352 -2
  181. package/es/utils/date-format.js +71 -0
  182. package/es/utils/export-table-utils.js +69 -0
  183. package/es/utils/index.js +89 -12
  184. package/es/utils/map.js +114 -0
  185. package/es/utils/model.js +19 -0
  186. package/es/utils/row-utils.js +134 -0
  187. package/es/utils/search.js +73 -0
  188. package/es/utils/sql-utils.js +359 -0
  189. package/es/utils/stat-utils.js +351 -0
  190. package/es/utils/trend-utils.js +135 -0
  191. package/package.json +8 -6
  192. package/es/components/dialog/chart-edit-dialog.js +0 -93
  193. package/es/components/dtable-popover.js +0 -97
  194. package/es/components/dtable-search-input.js +0 -135
  195. package/es/components/index.js +0 -41
  196. package/es/components/loading.js +0 -15
  197. package/es/components/modal-portal.js +0 -26
  198. package/es/model/conver-statItem.js +0 -124
@@ -0,0 +1,374 @@
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;
@@ -0,0 +1,72 @@
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;
@@ -0,0 +1,151 @@
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;
@@ -0,0 +1,108 @@
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;