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,203 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactstrap = require("reactstrap");
11
+ var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
12
+ var _DTableSelect = _interopRequireDefault(require("dtable-ui-component/lib/DTableSelect"));
13
+ var _baseSettings = _interopRequireDefault(require("../public-setting/base-settings"));
14
+ var _columnSettings = _interopRequireDefault(require("../public-setting/column-settings"));
15
+ var _constants = require("../../../constants");
16
+ class DashboardChartSettings extends _react.Component {
17
+ constructor(props) {
18
+ super(props);
19
+ this.onSelectTargetValueColumn = option => {
20
+ const {
21
+ target_value_column
22
+ } = this.props.statItem;
23
+ const new_column = option.value.key;
24
+ if (target_value_column === new_column) return;
25
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
26
+ target_value_column: new_column
27
+ }));
28
+ };
29
+ this.onSelectTotalValueColumn = option => {
30
+ const {
31
+ total_value_column
32
+ } = this.props.statItem;
33
+ const new_column = option.value.key;
34
+ if (total_value_column === new_column) return;
35
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
36
+ total_value_column: new_column
37
+ }));
38
+ };
39
+ this.getSummaryMethodsOptions = () => {
40
+ let numberCardSummaryMethod = ['Row_count', ..._constants.SUMMARY_METHOD];
41
+ return numberCardSummaryMethod.map(method => {
42
+ return {
43
+ label: /*#__PURE__*/_react.default.createElement("span", {
44
+ className: "select-option-name"
45
+ }, _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[method])),
46
+ value: method
47
+ };
48
+ });
49
+ };
50
+ this.getSelectedMethodOption = (method, summaryMethodsOptions) => {
51
+ return summaryMethodsOptions.find(m => m.value === method) || summaryMethodsOptions[0];
52
+ };
53
+ this.onSelectTargetValueColumnSummaryMethod = option => {
54
+ const {
55
+ target_value_column_summary_method
56
+ } = this.props.statItem;
57
+ const new_summary_method = option.value;
58
+ if (target_value_column_summary_method === new_summary_method) return;
59
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
60
+ target_value_column_summary_method: new_summary_method
61
+ }));
62
+ };
63
+ this.onSelectTotalValueColumnSummaryMethod = option => {
64
+ const {
65
+ total_value_column_summary_method
66
+ } = this.props.statItem;
67
+ const new_summary_method = option.value;
68
+ if (total_value_column_summary_method === new_summary_method) return;
69
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
70
+ total_value_column_summary_method: new_summary_method
71
+ }));
72
+ };
73
+ this.renderSummaryMethod = option => {
74
+ const {
75
+ statItem
76
+ } = this.props;
77
+ const {
78
+ target_value_column_summary_method,
79
+ total_value_column_summary_method
80
+ } = statItem;
81
+ let summary_method, onSelectSummaryMethod;
82
+ if (option.targetColumn === 'target_value_column') {
83
+ summary_method = target_value_column_summary_method;
84
+ onSelectSummaryMethod = this.onSelectTargetValueColumnSummaryMethod;
85
+ } else {
86
+ summary_method = total_value_column_summary_method;
87
+ onSelectSummaryMethod = this.onSelectTotalValueColumnSummaryMethod;
88
+ }
89
+ const selectedMethodOption = this.getSelectedMethodOption(summary_method, this.summaryMethodsOptions);
90
+ return /*#__PURE__*/_react.default.createElement("div", {
91
+ className: "statistic-chart-parameter-item"
92
+ }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Summary_method')), /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
93
+ value: selectedMethodOption,
94
+ onChange: onSelectSummaryMethod,
95
+ options: this.summaryMethodsOptions
96
+ }));
97
+ };
98
+ this.onChangeName = event => {
99
+ const value = event.target.value;
100
+ this.setState({
101
+ statName: value
102
+ });
103
+ };
104
+ this.onSaveName = event => {
105
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
106
+ name: this.state.statName
107
+ }));
108
+ };
109
+ this.onKeyDown = e => {
110
+ if (e.key === 'Enter') {
111
+ e.preventDefault();
112
+ e.target.blur();
113
+ }
114
+ };
115
+ this.getStyleSetting = () => {
116
+ const {
117
+ statItem
118
+ } = this.props;
119
+ const {
120
+ statName
121
+ } = this.state;
122
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
123
+ className: "statistic-chart-parameter-item"
124
+ }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Label')), /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
125
+ type: "text",
126
+ value: statName || '',
127
+ placeholder: statItem.name,
128
+ onBlur: this.onSaveName,
129
+ onKeyDown: this.onKeyDown,
130
+ onChange: this.onChangeName
131
+ })));
132
+ };
133
+ const {
134
+ numericColumns,
135
+ getColumnsOptions,
136
+ statItem: _statItem
137
+ } = props;
138
+ this.numericColumnOptions = getColumnsOptions(numericColumns);
139
+ this.summaryMethodsOptions = this.getSummaryMethodsOptions();
140
+ this.state = {
141
+ statName: _statItem.name
142
+ };
143
+ }
144
+ componentWillReceiveProps(nextProps) {
145
+ if (nextProps.selectedTableId !== this.props.selectedTableId) {
146
+ const {
147
+ numericColumns,
148
+ getColumnsOptions
149
+ } = nextProps;
150
+ this.numericColumnOptions = getColumnsOptions(numericColumns);
151
+ }
152
+ }
153
+ render() {
154
+ const {
155
+ getTables,
156
+ getViews,
157
+ statItem,
158
+ updateStatItem,
159
+ selectedTableId,
160
+ settingType
161
+ } = this.props;
162
+ if (settingType === 'style') {
163
+ return this.getStyleSetting();
164
+ }
165
+ const {
166
+ target_value_column,
167
+ total_value_column
168
+ } = statItem;
169
+ const selectedTargetValueColumnOption = this.numericColumnOptions.filter(option => option.value.key === target_value_column)[0];
170
+ const selectedTotalValueColumnOption = this.numericColumnOptions.filter(option => option.value.key === total_value_column)[0];
171
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_baseSettings.default, {
172
+ statItem: statItem,
173
+ selectedTableId: selectedTableId,
174
+ selectedViewId: statItem.view_id,
175
+ getTables: getTables,
176
+ getViews: getViews,
177
+ getTableById: this.props.getTableById,
178
+ getConvertedChart: this.props.getConvertedChart,
179
+ updateStatItem: updateStatItem
180
+ }), /*#__PURE__*/_react.default.createElement("div", {
181
+ className: "statistic-chart-parameter-divider"
182
+ }), /*#__PURE__*/_react.default.createElement("div", {
183
+ className: "statistic-chart-parameter-item"
184
+ }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Current_value_field')), /*#__PURE__*/_react.default.createElement(_columnSettings.default, {
185
+ columnsOptions: this.numericColumnOptions,
186
+ selectedColumnOption: selectedTargetValueColumnOption,
187
+ onChangeSelectedColumn: this.onSelectTargetValueColumn
188
+ })), this.renderSummaryMethod({
189
+ targetColumn: 'target_value_column'
190
+ }), /*#__PURE__*/_react.default.createElement("div", {
191
+ className: "statistic-chart-parameter-divider"
192
+ }), /*#__PURE__*/_react.default.createElement("div", {
193
+ className: "statistic-chart-parameter-item"
194
+ }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Total_value_field')), /*#__PURE__*/_react.default.createElement(_columnSettings.default, {
195
+ columnsOptions: this.numericColumnOptions,
196
+ selectedColumnOption: selectedTotalValueColumnOption,
197
+ onChangeSelectedColumn: this.onSelectTotalValueColumn
198
+ })), this.renderSummaryMethod({
199
+ targetColumn: 'total_value_column'
200
+ }));
201
+ }
202
+ }
203
+ var _default = exports.default = DashboardChartSettings;
@@ -0,0 +1,23 @@
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
+ function GeoGranularitySettings(props) {
12
+ const {
13
+ geoGranularityOptions,
14
+ selectedGeoGranularityOption,
15
+ onChangeGeoGranularity
16
+ } = props;
17
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_DTableSelect.default, {
18
+ value: selectedGeoGranularityOption,
19
+ options: geoGranularityOptions,
20
+ onChange: onChangeGeoGranularity
21
+ }));
22
+ }
23
+ var _default = exports.default = GeoGranularitySettings;
@@ -0,0 +1,104 @@
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 _baseSettings = _interopRequireDefault(require("../public-setting/base-settings"));
12
+ var _columnSettings = _interopRequireDefault(require("../public-setting/column-settings"));
13
+ var _summarySettings = _interopRequireDefault(require("./summary-settings"));
14
+ var _heatMapSettings = _interopRequireDefault(require("./style-setting/heat-map-settings"));
15
+ var _columnUtils = require("../../../utils/column-utils");
16
+ class HeatMapSettings extends _react.Component {
17
+ constructor(props) {
18
+ super(props);
19
+ this.getSelectedDateColumnOption = () => {
20
+ return this.dateColumnsOptions.find(option => option.value.key === this.props.statItem.time_column);
21
+ };
22
+ this.onSelectDateColumn = option => {
23
+ const {
24
+ time_column
25
+ } = this.props.statItem;
26
+ const new_time_column = option.value.key;
27
+ if (new_time_column === time_column) return;
28
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
29
+ time_column: new_time_column
30
+ }));
31
+ };
32
+ const {
33
+ columns,
34
+ getColumnsOptions
35
+ } = props;
36
+ const dateColumns = columns.filter(column => (0, _columnUtils.isStatisticDateColumn)(column));
37
+ this.dateColumnsOptions = getColumnsOptions(dateColumns);
38
+ }
39
+ componentWillReceiveProps(nextProps) {
40
+ if (nextProps.selectedTableId !== this.props.selectedTableId) {
41
+ const {
42
+ columns,
43
+ getColumnsOptions
44
+ } = nextProps;
45
+ const dateColumns = columns.filter(column => (0, _columnUtils.isStatisticDateColumn)(column));
46
+ this.dateColumnsOptions = getColumnsOptions(dateColumns);
47
+ }
48
+ }
49
+ render() {
50
+ const {
51
+ getTables,
52
+ getViews,
53
+ settingType,
54
+ selectedTableId,
55
+ statItem,
56
+ getColumnsOptions,
57
+ numericColumns
58
+ } = this.props;
59
+ const {
60
+ view_id: selectedViewId
61
+ } = statItem;
62
+ const selectedDateColumnOption = this.getSelectedDateColumnOption();
63
+ if (settingType === 'style') {
64
+ return /*#__PURE__*/_react.default.createElement(_heatMapSettings.default, {
65
+ statItem: statItem,
66
+ onChangeColor: this.props.onChangeColor,
67
+ updateStatItem: this.props.updateStatItem
68
+ });
69
+ }
70
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_baseSettings.default, {
71
+ statItem: statItem,
72
+ selectedTableId: selectedTableId,
73
+ selectedViewId: selectedViewId,
74
+ getTables: getTables,
75
+ getViews: getViews,
76
+ getTableById: this.props.getTableById,
77
+ getConvertedChart: this.props.getConvertedChart,
78
+ updateStatItem: this.props.updateStatItem
79
+ }), /*#__PURE__*/_react.default.createElement("div", {
80
+ className: "statistic-chart-parameter-divider"
81
+ }), /*#__PURE__*/_react.default.createElement("div", {
82
+ className: "statistic-chart-parameter-item"
83
+ }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Time_field')), /*#__PURE__*/_react.default.createElement(_columnSettings.default, {
84
+ columnsOptions: this.dateColumnsOptions,
85
+ selectedColumnOption: selectedDateColumnOption,
86
+ onChangeSelectedColumn: this.onSelectDateColumn
87
+ })), /*#__PURE__*/_react.default.createElement("div", {
88
+ className: "statistic-chart-parameter-divider"
89
+ }), /*#__PURE__*/_react.default.createElement(_summarySettings.default, {
90
+ label: _reactIntlUniversal.default.get('Summary_method'),
91
+ statItem: statItem,
92
+ selectedTableId: selectedTableId,
93
+ numericColumns: numericColumns,
94
+ summaryType: statItem.summary_type,
95
+ summaryMethod: statItem.summary_method,
96
+ summaryColumn: statItem.summary_column,
97
+ getColumnsOptions: getColumnsOptions,
98
+ onChangeSummaryType: this.props.onChangeSummaryType,
99
+ onSelectSummaryColumn: this.props.onSelectSummaryColumn,
100
+ onSelectSummaryMethod: this.props.onSelectSummaryMethod
101
+ }));
102
+ }
103
+ }
104
+ var _default = exports.default = HeatMapSettings;
@@ -0,0 +1,334 @@
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 _dtableUtils = require("dtable-utils");
12
+ var _mapSettings = _interopRequireDefault(require("./map-settings"));
13
+ var _worldMapSettings = _interopRequireDefault(require("./world-map-settings"));
14
+ var _heatMapSettings = _interopRequireDefault(require("./heat-map-settings"));
15
+ var _mirrorSettings = _interopRequireDefault(require("./mirror-settings"));
16
+ var _basicNumberCardSettings = _interopRequireDefault(require("./basic-number-card-settings"));
17
+ var _combinationSettings = _interopRequireDefault(require("./combination-settings"));
18
+ var _trendChartSettings = _interopRequireDefault(require("./trend-chart-settings"));
19
+ var _dashboardChartSettings = _interopRequireDefault(require("./dashboard-chart-settings"));
20
+ var _constants = require("../../../constants");
21
+ const GROUP_TYPES = {
22
+ COUNT: 'count',
23
+ SINGLE_NUMERIC_COLUMN: 'single_numeric_column',
24
+ MULTIPLE_NUMERIC_COLUMN: 'multiple_numeric_column'
25
+ };
26
+ class AdvancedChartSettings extends _react.default.Component {
27
+ constructor(props) {
28
+ super(props);
29
+ this.getNumericColumns = columns => {
30
+ if (!columns) return [];
31
+ return columns.filter(column => column && (0, _dtableUtils.isNumericColumn)(column));
32
+ };
33
+ this.getSettingsByType = () => {
34
+ const {
35
+ settingType
36
+ } = this.state;
37
+ const {
38
+ getTables,
39
+ getViews,
40
+ getTableById,
41
+ statItem,
42
+ labelColorConfigs,
43
+ eventBus,
44
+ updateStatItem
45
+ } = this.props;
46
+ const {
47
+ type,
48
+ table_id: selectedTableId
49
+ } = statItem;
50
+ switch (type) {
51
+ case _constants.STAT_TYPE.MAP:
52
+ case _constants.STAT_TYPE.MAP_BUBBLE:
53
+ {
54
+ return /*#__PURE__*/_react.default.createElement(_mapSettings.default, {
55
+ settingType: settingType,
56
+ selectedTableId: selectedTableId,
57
+ columns: this.columns,
58
+ numericColumns: this.numericColumns,
59
+ statItem: statItem,
60
+ labelColorConfigs: labelColorConfigs,
61
+ eventBus: eventBus,
62
+ getTables: getTables,
63
+ getViews: getViews,
64
+ getTableById: getTableById,
65
+ getColumnsOptions: this.getColumnsOptions,
66
+ getConvertedChart: this.props.getConvertedChart,
67
+ updateStatItem: updateStatItem,
68
+ onChangeSummaryType: this.onChangeSummaryType,
69
+ onSelectSummaryColumn: this.onSelectSummaryColumn,
70
+ onSelectSummaryMethod: this.onSelectSummaryMethod,
71
+ onChangeColor: this.onChangeColor
72
+ });
73
+ }
74
+ case _constants.STAT_TYPE.WORLD_MAP:
75
+ case _constants.STAT_TYPE.WORLD_MAP_BUBBLE:
76
+ {
77
+ return /*#__PURE__*/_react.default.createElement(_worldMapSettings.default, {
78
+ settingType: settingType,
79
+ selectedTableId: selectedTableId,
80
+ columns: this.columns,
81
+ numericColumns: this.numericColumns,
82
+ statItem: statItem,
83
+ labelColorConfigs: labelColorConfigs,
84
+ eventBus: eventBus,
85
+ getColumnsOptions: this.getColumnsOptions,
86
+ getTables: getTables,
87
+ getViews: getViews,
88
+ getTableById: getTableById,
89
+ getConvertedChart: this.props.getConvertedChart,
90
+ updateStatItem: updateStatItem,
91
+ onChangeSummaryType: this.onChangeSummaryType,
92
+ onSelectSummaryColumn: this.onSelectSummaryColumn,
93
+ onSelectSummaryMethod: this.onSelectSummaryMethod,
94
+ onChangeColor: this.onChangeColor
95
+ });
96
+ }
97
+ case _constants.STAT_TYPE.HEAT_MAP:
98
+ {
99
+ return /*#__PURE__*/_react.default.createElement(_heatMapSettings.default, {
100
+ settingType: settingType,
101
+ selectedTableId: selectedTableId,
102
+ columns: this.columns,
103
+ numericColumns: this.numericColumns,
104
+ statItem: statItem,
105
+ labelColorConfigs: labelColorConfigs,
106
+ eventBus: eventBus,
107
+ getColumnsOptions: this.getColumnsOptions,
108
+ getTables: getTables,
109
+ getViews: getViews,
110
+ getTableById: getTableById,
111
+ getConvertedChart: this.props.getConvertedChart,
112
+ updateStatItem: updateStatItem,
113
+ onChangeSummaryType: this.onChangeSummaryType,
114
+ onSelectSummaryColumn: this.onSelectSummaryColumn,
115
+ onSelectSummaryMethod: this.onSelectSummaryMethod,
116
+ onChangeColor: this.onChangeColor
117
+ });
118
+ }
119
+ case _constants.STAT_TYPE.MIRROR:
120
+ {
121
+ return /*#__PURE__*/_react.default.createElement(_mirrorSettings.default, {
122
+ settingType: settingType,
123
+ selectedTableId: selectedTableId,
124
+ columns: this.columns,
125
+ numericColumns: this.numericColumns,
126
+ statItem: statItem,
127
+ labelColorConfigs: labelColorConfigs,
128
+ eventBus: eventBus,
129
+ getColumnsOptions: this.getColumnsOptions,
130
+ getTables: getTables,
131
+ getViews: getViews,
132
+ getTableById: getTableById,
133
+ getConvertedChart: this.props.getConvertedChart,
134
+ updateStatItem: updateStatItem,
135
+ onChangeSummaryType: this.onChangeSummaryType,
136
+ onSelectSummaryColumn: this.onSelectSummaryColumn,
137
+ onSelectSummaryMethod: this.onSelectSummaryMethod
138
+ });
139
+ }
140
+ case _constants.STAT_TYPE.BASIC_NUMBER_CARD:
141
+ {
142
+ return /*#__PURE__*/_react.default.createElement(_basicNumberCardSettings.default, {
143
+ statItem: statItem,
144
+ labelColorConfigs: labelColorConfigs,
145
+ eventBus: eventBus,
146
+ settingType: settingType,
147
+ selectedTableId: selectedTableId,
148
+ getTables: getTables,
149
+ getViews: getViews,
150
+ getTableById: getTableById,
151
+ getConvertedChart: this.props.getConvertedChart,
152
+ updateStatItem: updateStatItem,
153
+ numericColumns: this.numericColumns,
154
+ getColumnsOptions: this.getColumnsOptions,
155
+ onChangeSummaryType: this.onChangeSummaryType,
156
+ onSelectSummaryMethod: this.onSelectSummaryMethod
157
+ });
158
+ }
159
+ case _constants.STAT_TYPE.COMBINATION_CHART:
160
+ {
161
+ return /*#__PURE__*/_react.default.createElement(_combinationSettings.default, {
162
+ statItem: statItem,
163
+ labelColorConfigs: labelColorConfigs,
164
+ eventBus: eventBus,
165
+ settingType: settingType,
166
+ columns: this.columns,
167
+ selectedTableId: selectedTableId,
168
+ getTables: getTables,
169
+ getViews: getViews,
170
+ getTableById: getTableById,
171
+ getConvertedChart: this.props.getConvertedChart,
172
+ updateStatItem: updateStatItem,
173
+ numericColumns: this.numericColumns,
174
+ getColumnsOptions: this.getColumnsOptions
175
+ });
176
+ }
177
+ case _constants.STAT_TYPE.TREND_CHART:
178
+ {
179
+ return /*#__PURE__*/_react.default.createElement(_trendChartSettings.default, {
180
+ settingType: settingType,
181
+ selectedTableId: selectedTableId,
182
+ columns: this.columns,
183
+ numericColumns: this.numericColumns,
184
+ statItem: statItem,
185
+ labelColorConfigs: labelColorConfigs,
186
+ eventBus: eventBus,
187
+ getColumnsOptions: this.getColumnsOptions,
188
+ getTables: getTables,
189
+ getViews: getViews,
190
+ getTableById: getTableById,
191
+ getConvertedChart: this.props.getConvertedChart,
192
+ updateStatItem: updateStatItem,
193
+ onChangeSummaryType: this.onChangeSummaryType,
194
+ onSelectSummaryColumn: this.onSelectSummaryColumn,
195
+ onSelectSummaryMethod: this.onSelectSummaryMethod
196
+ });
197
+ }
198
+ case _constants.STAT_TYPE.DASHBOARD:
199
+ {
200
+ return /*#__PURE__*/_react.default.createElement(_dashboardChartSettings.default, {
201
+ statItem: statItem,
202
+ labelColorConfigs: labelColorConfigs,
203
+ eventBus: eventBus,
204
+ settingType: settingType,
205
+ selectedTableId: selectedTableId,
206
+ getTables: getTables,
207
+ getViews: getViews,
208
+ getTableById: getTableById,
209
+ getConvertedChart: this.props.getConvertedChart,
210
+ updateStatItem: updateStatItem,
211
+ numericColumns: this.numericColumns,
212
+ getColumnsOptions: this.getColumnsOptions
213
+ });
214
+ }
215
+ default:
216
+ {
217
+ return null;
218
+ }
219
+ }
220
+ };
221
+ this.getColumnsOptions = columns => {
222
+ if (!Array.isArray(columns)) return [];
223
+ return columns.map(column => {
224
+ const {
225
+ name,
226
+ key,
227
+ type
228
+ } = column;
229
+ return {
230
+ label: /*#__PURE__*/_react.default.createElement("span", {
231
+ className: "select-option-name"
232
+ }, name),
233
+ value: {
234
+ name,
235
+ key,
236
+ type
237
+ }
238
+ };
239
+ });
240
+ };
241
+ this.onChangeSummaryType = summaryType => {
242
+ let {
243
+ summary_type,
244
+ summary_column,
245
+ summary_method
246
+ } = this.props.statItem;
247
+ if (summaryType === summary_type) return;
248
+ if (summaryType === GROUP_TYPES.SINGLE_NUMERIC_COLUMN) {
249
+ summary_column = null;
250
+ summary_method = _constants.SUMMARY_METHOD[0];
251
+ summary_type = _constants.SUMMARY_TYPE.ADVANCED;
252
+ } else {
253
+ summary_type = _constants.SUMMARY_TYPE.COUNT;
254
+ summary_method = null;
255
+ summary_column = null;
256
+ }
257
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
258
+ summary_type,
259
+ summary_column,
260
+ summary_method
261
+ }));
262
+ };
263
+ this.onChangeColor = targetColor => {
264
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
265
+ data_color: targetColor
266
+ }));
267
+ };
268
+ this.onSelectSummaryColumn = summaryColumn => {
269
+ const {
270
+ summary_column
271
+ } = this.props.statItem;
272
+ if (summaryColumn === summary_column) return;
273
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
274
+ summary_column: summaryColumn
275
+ }));
276
+ };
277
+ this.onSelectSummaryMethod = summaryMethod => {
278
+ const {
279
+ summary_method
280
+ } = this.props.statItem;
281
+ if (summaryMethod === summary_method) return;
282
+ this.props.updateStatItem(Object.assign({}, this.props.statItem, {
283
+ summary_method: summaryMethod
284
+ }));
285
+ };
286
+ this.selectEditType = type => {
287
+ this.setState({
288
+ settingType: type
289
+ });
290
+ };
291
+ const {
292
+ getTableById: _getTableById,
293
+ statItem: _statItem
294
+ } = props;
295
+ const selectedTable = _getTableById(_statItem.table_id);
296
+ this.columns = selectedTable.columns;
297
+ this.numericColumns = this.getNumericColumns(this.columns);
298
+ this.state = {
299
+ settingType: 'data'
300
+ };
301
+ }
302
+ componentWillReceiveProps(nextProps) {
303
+ const {
304
+ getTableById
305
+ } = this.props;
306
+ const newSelectedTableId = nextProps.statItem.table_id;
307
+ if (newSelectedTableId !== this.props.statItem.table_id) {
308
+ const selectedTable = getTableById(newSelectedTableId);
309
+ this.columns = selectedTable.columns;
310
+ this.numericColumns = this.getNumericColumns(this.columns);
311
+ }
312
+ }
313
+ render() {
314
+ const {
315
+ settingType
316
+ } = this.state;
317
+ return /*#__PURE__*/_react.default.createElement("div", {
318
+ className: "statistic-chart-settings"
319
+ }, /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
320
+ className: "statistic-chart-settings-type"
321
+ }, /*#__PURE__*/_react.default.createElement("div", {
322
+ onClick: () => this.selectEditType('data'),
323
+ className: "statistic-type-item ".concat(settingType === 'data' ? 'selected-statistic-type-item' : '')
324
+ }, _reactIntlUniversal.default.get('Data_settings')), /*#__PURE__*/_react.default.createElement("div", {
325
+ onClick: () => this.selectEditType('style'),
326
+ className: "statistic-type-item ".concat(settingType === 'style' ? 'selected-statistic-type-item' : '')
327
+ }, _reactIntlUniversal.default.get('Style_settings'))), /*#__PURE__*/_react.default.createElement("div", {
328
+ className: "statistic-chart-settings-container"
329
+ }, /*#__PURE__*/_react.default.createElement("div", {
330
+ className: "statistic-chart-settings-parameter-list pt-4"
331
+ }, this.getSettingsByType()))));
332
+ }
333
+ }
334
+ var _default = exports.default = AdvancedChartSettings;