dtable-statistic 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/es/assets/css/dashboard.css +1 -0
  2. package/es/assets/css/dialog.css +35 -0
  3. package/es/components/dialog/chart-edit-dialog.js +93 -0
  4. package/es/components/dialog/enlarged-chart-dialog.js +8 -13
  5. package/es/components/dialog/statistic-record-dialog/index.js +27 -35
  6. package/es/components/dialog/table-select-dialog.js +3 -3
  7. package/es/components/dropdown-menu/statistic-dropdown-menu.js +2 -2
  8. package/es/constants/index.js +3 -499
  9. package/es/dashboard.js +9 -87
  10. package/es/desktop-dashboard.js +51 -32
  11. package/es/index.js +56 -1
  12. package/es/mobile-dashboard.js +8 -16
  13. package/es/model/conver-statItem.js +124 -0
  14. package/es/service/chart-service.js +8 -27
  15. package/es/service/dashboard-service.js +25 -29
  16. package/es/stat-list/chart-preview.js +19 -20
  17. package/es/stat-list/index.js +17 -23
  18. package/es/stat-view/index.js +47 -156
  19. package/es/tabs/tab.js +18 -15
  20. package/es/utils/common-utils.js +2 -352
  21. package/es/utils/export-table-utils.js +0 -69
  22. package/es/utils/index.js +12 -89
  23. package/package.json +5 -8
  24. package/es/assets/css/color-picker.css +0 -53
  25. package/es/assets/css/color-rules-popover.css +0 -144
  26. package/es/assets/css/slider.css +0 -77
  27. package/es/assets/css/statistic-chart.module.css +0 -11
  28. package/es/assets/css/statistic-custom-title.module.css +0 -3
  29. package/es/assets/css/statistic-custom.module.css +0 -4
  30. package/es/assets/css/statistic-numeric-column-item.module.css +0 -43
  31. package/es/assets/css/statistic-time-picker.module.css +0 -21
  32. package/es/calculator/base-calculator.js +0 -80
  33. package/es/calculator/basic-chart-calculator.js +0 -349
  34. package/es/calculator/combination-calculator.js +0 -246
  35. package/es/calculator/compare-bar-calculator.js +0 -197
  36. package/es/calculator/completeness-calculator.js +0 -215
  37. package/es/calculator/copy-value.js +0 -53
  38. package/es/calculator/dashboard-calculator.js +0 -70
  39. package/es/calculator/heat-map-calculator.js +0 -148
  40. package/es/calculator/horizontal-bar-calculator.js +0 -67
  41. package/es/calculator/index.js +0 -81
  42. package/es/calculator/map-calculator.js +0 -103
  43. package/es/calculator/mirror-calculator.js +0 -146
  44. package/es/calculator/number-card-calculator.js +0 -60
  45. package/es/calculator/pivot-table-calculator.js +0 -821
  46. package/es/calculator/scatter-calculator.js +0 -75
  47. package/es/calculator/thread-manager.js +0 -57
  48. package/es/calculator/trend-calculator.js +0 -113
  49. package/es/calculator/workers/basic-chart-calculator-worker.js +0 -495
  50. package/es/calculator/workers/calculator.worker.js +0 -44
  51. package/es/calculator/workers/card-calculator-worker.js +0 -40
  52. package/es/calculator/workers/combination-calculator-worker.js +0 -276
  53. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +0 -150
  54. package/es/calculator/workers/completeness-calculator-worker.js +0 -208
  55. package/es/calculator/workers/dashboard-calculator-worker.js +0 -68
  56. package/es/calculator/workers/mirror-calculator-worker.js +0 -152
  57. package/es/calculator/workers/pivot-table-calculator-worker.js +0 -718
  58. package/es/calculator/workers/scatter-calculator-worker.js +0 -80
  59. package/es/calculator/workers/trend-calculator-worker.js +0 -108
  60. package/es/calculator/world-map-calculator.js +0 -124
  61. package/es/components/dialog/chart-addition-edit-dialog.js +0 -90
  62. package/es/components/dialog/chart-addition-widgets/chart-selector.js +0 -259
  63. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +0 -83
  64. package/es/components/dialog/statistic-types-dialog/index.css +0 -14
  65. package/es/components/dialog/statistic-types-dialog/index.js +0 -62
  66. package/es/components/popover/color-rules/color-rule.js +0 -183
  67. package/es/components/popover/color-rules/index.js +0 -87
  68. package/es/components/popover/color-rules/rule-filters/filter.js +0 -221
  69. package/es/components/popover/color-rules/rule-filters/index.css +0 -210
  70. package/es/components/popover/color-rules/rule-filters/index.js +0 -97
  71. package/es/components/popover/color-rules/rule-filters/number-input.js +0 -78
  72. package/es/components/popover/color-rules-popover.js +0 -218
  73. package/es/components/popover/color-selector-popover.js +0 -83
  74. package/es/constants/color-rules.js +0 -17
  75. package/es/constants/map.js +0 -13
  76. package/es/constants/model.js +0 -26
  77. package/es/constants/regions.js +0 -2111
  78. package/es/constants/zIndexes.js +0 -7
  79. package/es/custom-g2.js +0 -644
  80. package/es/model/bar-group.js +0 -58
  81. package/es/model/bar.js +0 -47
  82. package/es/model/base-model.js +0 -18
  83. package/es/model/basic-number-card.js +0 -25
  84. package/es/model/combination.js +0 -48
  85. package/es/model/compare-bar.js +0 -56
  86. package/es/model/completeness-group.js +0 -31
  87. package/es/model/completeness.js +0 -25
  88. package/es/model/custom-bar.js +0 -25
  89. package/es/model/dashboard.js +0 -20
  90. package/es/model/generic-model.js +0 -222
  91. package/es/model/heat-map.js +0 -33
  92. package/es/model/horizontal-bar-group.js +0 -55
  93. package/es/model/horizontal-bar.js +0 -47
  94. package/es/model/index.js +0 -187
  95. package/es/model/map.js +0 -38
  96. package/es/model/mirror.js +0 -33
  97. package/es/model/pie.js +0 -38
  98. package/es/model/ring.js +0 -40
  99. package/es/model/scatter.js +0 -22
  100. package/es/model/table.js +0 -32
  101. package/es/model/trend.js +0 -32
  102. package/es/model/world-map.js +0 -34
  103. package/es/service/map-json.js +0 -140
  104. package/es/stat-editor/chart-name-editor.js +0 -68
  105. package/es/stat-editor/index.js +0 -75
  106. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +0 -153
  107. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +0 -422
  108. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +0 -203
  109. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +0 -23
  110. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +0 -104
  111. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +0 -334
  112. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +0 -119
  113. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +0 -132
  114. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +0 -240
  115. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +0 -89
  116. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +0 -138
  117. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +0 -331
  118. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +0 -143
  119. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +0 -109
  120. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +0 -153
  121. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +0 -144
  122. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +0 -214
  123. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +0 -121
  124. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +0 -172
  125. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +0 -366
  126. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +0 -142
  127. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +0 -150
  128. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +0 -473
  129. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +0 -182
  130. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +0 -564
  131. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +0 -112
  132. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +0 -87
  133. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +0 -187
  134. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +0 -300
  135. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +0 -113
  136. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +0 -289
  137. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +0 -58
  138. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +0 -359
  139. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +0 -48
  140. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +0 -121
  141. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +0 -143
  142. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +0 -269
  143. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +0 -104
  144. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +0 -366
  145. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +0 -55
  146. package/es/stat-editor/stat-settings/color-setting/color-picker.js +0 -130
  147. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +0 -374
  148. package/es/stat-editor/stat-settings/map/map-level.js +0 -72
  149. package/es/stat-editor/stat-settings/map/map-province-city.js +0 -151
  150. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +0 -108
  151. package/es/stat-editor/stat-settings/public-setting/base-settings.js +0 -154
  152. package/es/stat-editor/stat-settings/public-setting/calender.js +0 -125
  153. package/es/stat-editor/stat-settings/public-setting/column-settings.js +0 -24
  154. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +0 -62
  155. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +0 -61
  156. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +0 -35
  157. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +0 -60
  158. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +0 -123
  159. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +0 -33
  160. package/es/stat-editor/stat-settings/public-setting/type-settings/index.css +0 -29
  161. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +0 -82
  162. package/es/stat-view/area-chart.js +0 -551
  163. package/es/stat-view/bar-chart.js +0 -582
  164. package/es/stat-view/base-chart.js +0 -132
  165. package/es/stat-view/basic-number-card.js +0 -201
  166. package/es/stat-view/combination-chart.js +0 -546
  167. package/es/stat-view/compare-chart.js +0 -483
  168. package/es/stat-view/completeness-chart.js +0 -390
  169. package/es/stat-view/custom-bar.js +0 -418
  170. package/es/stat-view/dashboard-chart.js +0 -266
  171. package/es/stat-view/heat-map.js +0 -463
  172. package/es/stat-view/horizontal-bar-chart.js +0 -562
  173. package/es/stat-view/line-chart.js +0 -518
  174. package/es/stat-view/map.js +0 -448
  175. package/es/stat-view/mirror.js +0 -275
  176. package/es/stat-view/pie-chart.js +0 -290
  177. package/es/stat-view/pivot-table/index.js +0 -196
  178. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +0 -156
  179. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +0 -176
  180. package/es/stat-view/pivot-table/pivot-table-display-name.js +0 -215
  181. package/es/stat-view/pivot-table/statistic-pivot-table.module.css +0 -132
  182. package/es/stat-view/pivot-table/two-dimension-table.js +0 -384
  183. package/es/stat-view/ring-chart.js +0 -392
  184. package/es/stat-view/scatter-chart.js +0 -306
  185. package/es/stat-view/treemap-chart.js +0 -253
  186. package/es/stat-view/trend-chart.js +0 -249
  187. package/es/stat-view/world-map.js +0 -431
  188. package/es/utils/basic-chart-utils.js +0 -29
  189. package/es/utils/cell-format.js +0 -115
  190. package/es/utils/collaborator.js +0 -50
  191. package/es/utils/color-utils.js +0 -134
  192. package/es/utils/column-utils.js +0 -110
  193. package/es/utils/column.js +0 -20
  194. package/es/utils/date-format.js +0 -71
  195. package/es/utils/map.js +0 -114
  196. package/es/utils/model.js +0 -19
  197. package/es/utils/row-utils.js +0 -134
  198. package/es/utils/search.js +0 -73
  199. package/es/utils/sql-utils.js +0 -359
  200. package/es/utils/stat-utils.js +0 -351
  201. package/es/utils/trend-utils.js +0 -135
@@ -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;
@@ -1,119 +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 _baseSettings = _interopRequireDefault(require("../public-setting/base-settings"));
11
- var _columnSettings = _interopRequireDefault(require("../public-setting/column-settings"));
12
- var _summarySettings = _interopRequireDefault(require("./summary-settings"));
13
- var _mapSetting = _interopRequireDefault(require("./style-setting/map-setting"));
14
- var _columnUtils = require("../../../utils/column-utils");
15
- var _constants = require("../../../constants");
16
- var _mapLevel = _interopRequireDefault(require("../map/map-level"));
17
- var _mapProvinceCity = _interopRequireDefault(require("../map/map-province-city"));
18
- class MapSettings extends _react.Component {
19
- constructor(props) {
20
- super(props);
21
- this.getColumns = columns => {
22
- if (!Array.isArray(columns) || columns.length === 0) return [];
23
- return columns.filter(column => (0, _columnUtils.isMapColumn)(column));
24
- };
25
- this.getSelectedGeoColumnOption = () => {
26
- return this.geoColumnsOptions.find(option => option.value.key === this.props.statItem.geo_column);
27
- };
28
- this.onSelectGeoColumn = option => {
29
- const {
30
- geo_column
31
- } = this.props.statItem;
32
- const new_geo_column = option.value.key;
33
- if (new_geo_column === geo_column) return;
34
- this.props.updateStatItem(Object.assign({}, this.props.statItem, {
35
- geo_column: new_geo_column,
36
- geolocation_granularity: _constants.GEOLOCATION_GRANULARITY.PROVINCE
37
- }));
38
- };
39
- const {
40
- columns: _columns,
41
- getColumnsOptions
42
- } = props;
43
- const geoColumns = this.getColumns(_columns);
44
- this.geoColumnsOptions = getColumnsOptions(geoColumns);
45
- }
46
- UNSAFE_componentWillReceiveProps(nextProps) {
47
- if (nextProps.selectedTableId !== this.props.selectedTableId) {
48
- const {
49
- columns,
50
- getColumnsOptions
51
- } = nextProps;
52
- const geoColumns = this.getColumns(columns);
53
- this.geoColumnsOptions = getColumnsOptions(geoColumns);
54
- }
55
- }
56
- render() {
57
- const {
58
- getTables,
59
- getViews,
60
- settingType,
61
- selectedTableId,
62
- statItem,
63
- getColumnsOptions,
64
- numericColumns
65
- } = this.props;
66
- const {
67
- view_id: selectedViewId
68
- } = statItem;
69
- const selectedGeoColumnOption = this.getSelectedGeoColumnOption();
70
- if (settingType === 'style') {
71
- return /*#__PURE__*/_react.default.createElement(_mapSetting.default, {
72
- statItem: statItem,
73
- onChangeColor: this.props.onChangeColor,
74
- updateStatItem: this.props.updateStatItem
75
- });
76
- }
77
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_baseSettings.default, {
78
- statItem: statItem,
79
- selectedTableId: selectedTableId,
80
- selectedViewId: selectedViewId,
81
- getTables: getTables,
82
- getViews: getViews,
83
- getTableById: this.props.getTableById,
84
- getConvertedChart: this.props.getConvertedChart,
85
- updateStatItem: this.props.updateStatItem
86
- }), /*#__PURE__*/_react.default.createElement("div", {
87
- className: "statistic-chart-parameter-divider"
88
- }), /*#__PURE__*/_react.default.createElement(_mapLevel.default, {
89
- statItem: statItem,
90
- updateStatItem: this.props.updateStatItem
91
- }), /*#__PURE__*/_react.default.createElement(_mapProvinceCity.default, {
92
- statItem: statItem,
93
- updateStatItem: this.props.updateStatItem
94
- }), /*#__PURE__*/_react.default.createElement("div", {
95
- className: "statistic-chart-parameter-divider"
96
- }), /*#__PURE__*/_react.default.createElement("div", {
97
- className: "statistic-chart-parameter-item"
98
- }, /*#__PURE__*/_react.default.createElement("label", null, "\u4F4D\u7F6E\u5B57\u6BB5"), /*#__PURE__*/_react.default.createElement(_columnSettings.default, {
99
- columnsOptions: this.geoColumnsOptions,
100
- selectedColumnOption: selectedGeoColumnOption,
101
- onChangeSelectedColumn: this.onSelectGeoColumn
102
- })), /*#__PURE__*/_react.default.createElement("div", {
103
- className: "statistic-chart-parameter-divider"
104
- }), /*#__PURE__*/_react.default.createElement(_summarySettings.default, {
105
- label: '归总方法',
106
- statItem: statItem,
107
- selectedTableId: selectedTableId,
108
- numericColumns: numericColumns,
109
- summaryType: statItem.summary_type,
110
- summaryMethod: statItem.summary_method,
111
- summaryColumn: statItem.summary_column,
112
- getColumnsOptions: getColumnsOptions,
113
- onChangeSummaryType: this.props.onChangeSummaryType,
114
- onSelectSummaryColumn: this.props.onSelectSummaryColumn,
115
- onSelectSummaryMethod: this.props.onSelectSummaryMethod
116
- }));
117
- }
118
- }
119
- var _default = exports.default = MapSettings;
@@ -1,132 +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 _toggleSetting = _interopRequireDefault(require("../public-setting/toggle-setting"));
15
- var _columnUtils = require("../../../utils/column-utils");
16
- class MirrorSettings extends _react.Component {
17
- constructor(props) {
18
- super(props);
19
- this.getSelectedStatColumnOption = () => {
20
- return this.statColumnsOptions.find(option => option.value.key === this.props.statItem.column);
21
- };
22
- this.getSelectedGroupColumnOption = () => {
23
- return this.groupColumnsOptions.find(option => option.value.key === this.props.statItem.group_column);
24
- };
25
- this.onSelectStatColumn = option => {
26
- const {
27
- column
28
- } = this.props.statItem;
29
- const new_column = option.value.key;
30
- if (new_column === column) return;
31
- this.props.updateStatItem(Object.assign({}, this.props.statItem, {
32
- column: new_column
33
- }));
34
- };
35
- this.onSelectGroupColumn = option => {
36
- const {
37
- group_column
38
- } = this.props.statItem;
39
- const new_column = option.value.key;
40
- if (new_column === group_column) return;
41
- this.props.updateStatItem(Object.assign({}, this.props.statItem, {
42
- group_column: new_column
43
- }));
44
- };
45
- this.handleToggleChange = event => {
46
- this.props.updateStatItem(Object.assign({}, this.props.statItem, {
47
- is_transpose: event.target.checked
48
- }));
49
- };
50
- const {
51
- columns,
52
- getColumnsOptions
53
- } = props;
54
- const statColumns = columns.filter(column => (0, _columnUtils.isMirrorColumn)(column));
55
- const groupColumns = columns.filter(column => column.type === 'single-select');
56
- this.statColumnsOptions = getColumnsOptions(statColumns);
57
- this.groupColumnsOptions = getColumnsOptions(groupColumns);
58
- }
59
- UNSAFE_componentWillReceiveProps(nextProps) {
60
- if (nextProps.selectedTableId !== this.props.selectedTableId) {
61
- const {
62
- columns,
63
- getColumnsOptions
64
- } = nextProps;
65
- const statColumns = columns.filter(column => (0, _columnUtils.isMirrorColumn)(column));
66
- this.statColumnsOptions = getColumnsOptions(statColumns);
67
- const groupColumns = columns.filter(column => column.type === 'single-select');
68
- this.groupColumnsOptions = getColumnsOptions(groupColumns);
69
- }
70
- }
71
- render() {
72
- const {
73
- getTables,
74
- getViews,
75
- settingType,
76
- selectedTableId,
77
- statItem,
78
- getColumnsOptions,
79
- numericColumns
80
- } = this.props;
81
- const selectedColumnOption = this.getSelectedStatColumnOption();
82
- const selectedGroupColumnOption = this.getSelectedGroupColumnOption();
83
- if (settingType === 'style') {
84
- return null;
85
- }
86
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_baseSettings.default, {
87
- statItem: statItem,
88
- selectedTableId: statItem.table_id,
89
- selectedViewId: statItem.view_id,
90
- getTables: getTables,
91
- getViews: getViews,
92
- getTableById: this.props.getTableById,
93
- getConvertedChart: this.props.getConvertedChart,
94
- updateStatItem: this.props.updateStatItem
95
- }), /*#__PURE__*/_react.default.createElement("div", {
96
- className: "statistic-chart-parameter-divider"
97
- }), /*#__PURE__*/_react.default.createElement("div", {
98
- className: "statistic-chart-parameter-item"
99
- }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Statistic_field')), /*#__PURE__*/_react.default.createElement(_columnSettings.default, {
100
- columnsOptions: this.statColumnsOptions,
101
- selectedColumnOption: selectedColumnOption,
102
- onChangeSelectedColumn: this.onSelectStatColumn
103
- })), /*#__PURE__*/_react.default.createElement("div", {
104
- className: "statistic-chart-parameter-item"
105
- }, /*#__PURE__*/_react.default.createElement(_toggleSetting.default, {
106
- label: _reactIntlUniversal.default.get('Transpose'),
107
- isChecked: statItem.is_transpose,
108
- handleToggleChange: this.handleToggleChange
109
- })), /*#__PURE__*/_react.default.createElement("div", {
110
- className: "statistic-chart-parameter-item"
111
- }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Column_grouping_field')), /*#__PURE__*/_react.default.createElement(_columnSettings.default, {
112
- columnsOptions: this.groupColumnsOptions,
113
- selectedColumnOption: selectedGroupColumnOption,
114
- onChangeSelectedColumn: this.onSelectGroupColumn
115
- })), /*#__PURE__*/_react.default.createElement("div", {
116
- className: "statistic-chart-parameter-divider"
117
- }), /*#__PURE__*/_react.default.createElement(_summarySettings.default, {
118
- label: _reactIntlUniversal.default.get('Summary_method'),
119
- statItem: statItem,
120
- selectedTableId: selectedTableId,
121
- numericColumns: numericColumns,
122
- summaryType: statItem.summary_type,
123
- summaryMethod: statItem.summary_method,
124
- summaryColumn: statItem.summary_column,
125
- getColumnsOptions: getColumnsOptions,
126
- onChangeSummaryType: this.props.onChangeSummaryType,
127
- onSelectSummaryColumn: this.props.onSelectSummaryColumn,
128
- onSelectSummaryMethod: this.props.onSelectSummaryMethod
129
- }));
130
- }
131
- }
132
- var _default = exports.default = MirrorSettings;