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,203 +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 _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;
@@ -1,23 +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
- 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;
@@ -1,104 +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 _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;
@@ -1,334 +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 _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;