dtable-statistic 4.0.2-test-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 (210) hide show
  1. package/README.md +3 -0
  2. package/es/api/dtable-db-api.js +43 -0
  3. package/es/assets/css/color-picker.css +53 -0
  4. package/es/assets/css/color-rules-popover.css +144 -0
  5. package/es/assets/css/color-theme-dialog.css +40 -0
  6. package/es/assets/css/dashboard.css +562 -0
  7. package/es/assets/css/dialog.css +415 -0
  8. package/es/assets/css/mobile-dashboard.module.css +91 -0
  9. package/es/assets/css/slider.css +77 -0
  10. package/es/assets/css/statistic-chart.module.css +11 -0
  11. package/es/assets/css/statistic-custom-title.module.css +3 -0
  12. package/es/assets/css/statistic-custom.module.css +4 -0
  13. package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
  14. package/es/assets/css/statistic-time-picker.module.css +21 -0
  15. package/es/assets/css/theme.css +61 -0
  16. package/es/assets/images/icon.png +0 -0
  17. package/es/calculator/base-calculator.js +111 -0
  18. package/es/calculator/basic-chart-calculator.js +571 -0
  19. package/es/calculator/combination-calculator.js +296 -0
  20. package/es/calculator/compare-bar-calculator.js +291 -0
  21. package/es/calculator/completeness-calculator.js +307 -0
  22. package/es/calculator/copy-value.js +47 -0
  23. package/es/calculator/dashboard-calculator.js +146 -0
  24. package/es/calculator/heat-map-calculator.js +225 -0
  25. package/es/calculator/horizontal-bar-calculator.js +100 -0
  26. package/es/calculator/index.js +88 -0
  27. package/es/calculator/map-calculator.js +169 -0
  28. package/es/calculator/mirror-calculator.js +217 -0
  29. package/es/calculator/number-card-calculator.js +135 -0
  30. package/es/calculator/pivot-table-calculator.js +810 -0
  31. package/es/calculator/scatter-calculator.js +150 -0
  32. package/es/calculator/thread-manager.js +70 -0
  33. package/es/calculator/trend-calculator.js +204 -0
  34. package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
  35. package/es/calculator/workers/calculator.worker.js +22 -0
  36. package/es/calculator/workers/card-calculator-worker.js +28 -0
  37. package/es/calculator/workers/combination-calculator-worker.js +257 -0
  38. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
  39. package/es/calculator/workers/completeness-calculator-worker.js +153 -0
  40. package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
  41. package/es/calculator/workers/mirror-calculator-worker.js +132 -0
  42. package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
  43. package/es/calculator/workers/scatter-calculator-worker.js +67 -0
  44. package/es/calculator/workers/trend-calculator-worker.js +93 -0
  45. package/es/calculator/world-map-calculator.js +193 -0
  46. package/es/components/common-add-tool.js +19 -0
  47. package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
  48. package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
  49. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
  50. package/es/components/dialog/color-theme-dialog.js +71 -0
  51. package/es/components/dialog/enlarged-chart-dialog.js +73 -0
  52. package/es/components/dialog/new-table-dialog.js +113 -0
  53. package/es/components/dialog/new-view-dialog.js +87 -0
  54. package/es/components/dialog/rename-view-dialog.js +87 -0
  55. package/es/components/dialog/statistic-record-dialog/index.css +114 -0
  56. package/es/components/dialog/statistic-record-dialog/index.js +174 -0
  57. package/es/components/dialog/table-select-dialog.js +93 -0
  58. package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
  59. package/es/components/dtable-popover.js +109 -0
  60. package/es/components/dtable-search-input.js +137 -0
  61. package/es/components/dtable-select.js +104 -0
  62. package/es/components/index.js +11 -0
  63. package/es/components/loading.js +8 -0
  64. package/es/components/modal-portal.js +36 -0
  65. package/es/components/popover/color-rules/color-rule.js +179 -0
  66. package/es/components/popover/color-rules/index.js +87 -0
  67. package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
  68. package/es/components/popover/color-rules/rule-filters/index.css +214 -0
  69. package/es/components/popover/color-rules/rule-filters/index.js +97 -0
  70. package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
  71. package/es/components/popover/color-rules-popover.js +213 -0
  72. package/es/components/popover/color-selector-popover.js +85 -0
  73. package/es/components/seatable-radio/index.css +51 -0
  74. package/es/components/seatable-radio/index.js +28 -0
  75. package/es/components/select/index.js +2 -0
  76. package/es/components/select/option-group.css +104 -0
  77. package/es/components/select/option-group.js +225 -0
  78. package/es/components/select/option.js +51 -0
  79. package/es/components/select/select.css +211 -0
  80. package/es/components/select/select.js +157 -0
  81. package/es/components/toast/alert.js +130 -0
  82. package/es/components/toast/index.js +3 -0
  83. package/es/components/toast/toast.js +164 -0
  84. package/es/components/toast/toastManager.js +150 -0
  85. package/es/components/toast/toaster.js +64 -0
  86. package/es/constants/color-rules.js +8 -0
  87. package/es/constants/dtable-select-style.js +61 -0
  88. package/es/constants/event-types.js +1 -0
  89. package/es/constants/index.js +501 -0
  90. package/es/constants/key-codes.js +102 -0
  91. package/es/constants/zIndexes.js +1 -0
  92. package/es/custom-g2.js +614 -0
  93. package/es/dashboard.js +408 -0
  94. package/es/desktop-dashboard.js +299 -0
  95. package/es/index.js +33 -0
  96. package/es/locale/index.js +17 -0
  97. package/es/locale/lang/de.js +237 -0
  98. package/es/locale/lang/en.js +237 -0
  99. package/es/locale/lang/fr.js +237 -0
  100. package/es/locale/lang/zh_CN.js +237 -0
  101. package/es/mobile-dashboard.js +103 -0
  102. package/es/model/collaborators.js +11 -0
  103. package/es/model/stat-item.js +340 -0
  104. package/es/model/statistic-dashboard.js +8 -0
  105. package/es/service/chart-service.js +192 -0
  106. package/es/service/dashboard-service.js +415 -0
  107. package/es/stat-editor/chart-name-editor.js +75 -0
  108. package/es/stat-editor/index.js +74 -0
  109. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
  110. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
  111. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
  112. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
  113. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
  114. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
  115. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
  116. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
  117. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
  118. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
  119. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
  120. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
  121. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
  122. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
  123. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
  124. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
  125. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
  126. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
  127. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
  128. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
  129. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
  130. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
  131. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
  132. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
  133. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
  134. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
  135. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
  136. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
  137. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
  138. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
  139. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
  140. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
  141. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
  142. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
  143. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
  144. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
  145. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
  146. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
  147. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
  148. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
  149. package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
  150. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
  151. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
  152. package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
  153. package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
  154. package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
  155. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
  156. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
  157. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
  158. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
  159. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
  160. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
  161. package/es/stat-list/chart-preview.js +139 -0
  162. package/es/stat-list/index.js +275 -0
  163. package/es/stat-view/area-chart.js +521 -0
  164. package/es/stat-view/bar-chart.js +568 -0
  165. package/es/stat-view/base-chart.js +44 -0
  166. package/es/stat-view/basic-number-card.js +255 -0
  167. package/es/stat-view/combination-chart.js +558 -0
  168. package/es/stat-view/compare-chart.js +485 -0
  169. package/es/stat-view/completeness-chart.js +389 -0
  170. package/es/stat-view/custom-bar.js +433 -0
  171. package/es/stat-view/dashboard-chart.js +317 -0
  172. package/es/stat-view/heat-map.js +501 -0
  173. package/es/stat-view/horizontal-bar-chart.js +569 -0
  174. package/es/stat-view/index.js +183 -0
  175. package/es/stat-view/line-chart.js +505 -0
  176. package/es/stat-view/map.js +428 -0
  177. package/es/stat-view/mirror.js +285 -0
  178. package/es/stat-view/pie-chart.js +326 -0
  179. package/es/stat-view/pivot-table/index.js +206 -0
  180. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
  181. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
  182. package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
  183. package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
  184. package/es/stat-view/ring-chart.js +416 -0
  185. package/es/stat-view/scatter-chart.js +367 -0
  186. package/es/stat-view/treemap-chart.js +318 -0
  187. package/es/stat-view/trend-chart.js +299 -0
  188. package/es/stat-view/world-map.js +443 -0
  189. package/es/tabs/index.js +252 -0
  190. package/es/tabs/statistic-tabs.module.css +154 -0
  191. package/es/tabs/tab.js +167 -0
  192. package/es/utils/basic-chart-utils.js +24 -0
  193. package/es/utils/cell-format.js +110 -0
  194. package/es/utils/cell-value.js +27 -0
  195. package/es/utils/collaborator.js +31 -0
  196. package/es/utils/color-utils.js +112 -0
  197. package/es/utils/column-utils.js +18 -0
  198. package/es/utils/column.js +13 -0
  199. package/es/utils/common-utils.js +303 -0
  200. package/es/utils/date-format.js +65 -0
  201. package/es/utils/export-table-utils.js +632 -0
  202. package/es/utils/index.js +26 -0
  203. package/es/utils/object.js +26 -0
  204. package/es/utils/row-utils.js +115 -0
  205. package/es/utils/search.js +67 -0
  206. package/es/utils/sql-utils.js +293 -0
  207. package/es/utils/stat-utils.js +353 -0
  208. package/es/utils/trend-utils.js +136 -0
  209. package/index.js +1 -0
  210. package/package.json +188 -0
@@ -0,0 +1,193 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import React, { Component, Fragment } from 'react';
7
+ import { Input } from 'reactstrap';
8
+ import intl from 'react-intl-universal';
9
+ import { DTableSelect } from '../../../components';
10
+ import BaseSettings from '../public-setting/base-settings';
11
+ import ColumnSettings from '../public-setting/column-settings';
12
+ import { STATISTICS_COUNT_SHOW, SUMMARY_METHOD } from '../../../constants';
13
+ var DashboardChartSettings = /*#__PURE__*/function (_Component) {
14
+ _inherits(DashboardChartSettings, _Component);
15
+ var _super = _createSuper(DashboardChartSettings);
16
+ function DashboardChartSettings(props) {
17
+ var _this;
18
+ _classCallCheck(this, DashboardChartSettings);
19
+ _this = _super.call(this, props);
20
+ _this.onSelectTargetValueColumn = function (option) {
21
+ var target_value_column = _this.props.statItem.target_value_column;
22
+ var new_column = option.value.key;
23
+ if (target_value_column === new_column) return;
24
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
25
+ target_value_column: new_column
26
+ }));
27
+ };
28
+ _this.onSelectTotalValueColumn = function (option) {
29
+ var total_value_column = _this.props.statItem.total_value_column;
30
+ var new_column = option.value.key;
31
+ if (total_value_column === new_column) return;
32
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
33
+ total_value_column: new_column
34
+ }));
35
+ };
36
+ _this.getSummaryMethodsOptions = function () {
37
+ var numberCardSummaryMethod = ['Row_count'].concat(_toConsumableArray(SUMMARY_METHOD));
38
+ return numberCardSummaryMethod.map(function (method) {
39
+ return {
40
+ label: /*#__PURE__*/React.createElement("span", {
41
+ className: "select-option-name"
42
+ }, intl.get(STATISTICS_COUNT_SHOW[method])),
43
+ value: method
44
+ };
45
+ });
46
+ };
47
+ _this.getSelectedMethodOption = function (method, summaryMethodsOptions) {
48
+ return summaryMethodsOptions.find(function (m) {
49
+ return m.value === method;
50
+ }) || summaryMethodsOptions[0];
51
+ };
52
+ _this.onSelectTargetValueColumnSummaryMethod = function (option) {
53
+ var target_value_column_summary_method = _this.props.statItem.target_value_column_summary_method;
54
+ var new_summary_method = option.value;
55
+ if (target_value_column_summary_method === new_summary_method) return;
56
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
57
+ target_value_column_summary_method: new_summary_method
58
+ }));
59
+ };
60
+ _this.onSelectTotalValueColumnSummaryMethod = function (option) {
61
+ var total_value_column_summary_method = _this.props.statItem.total_value_column_summary_method;
62
+ var new_summary_method = option.value;
63
+ if (total_value_column_summary_method === new_summary_method) return;
64
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
65
+ total_value_column_summary_method: new_summary_method
66
+ }));
67
+ };
68
+ _this.renderSummaryMethod = function (option) {
69
+ var statItem = _this.props.statItem;
70
+ var target_value_column_summary_method = statItem.target_value_column_summary_method,
71
+ total_value_column_summary_method = statItem.total_value_column_summary_method;
72
+ var summary_method, onSelectSummaryMethod;
73
+ if (option.targetColumn === 'target_value_column') {
74
+ summary_method = target_value_column_summary_method;
75
+ onSelectSummaryMethod = _this.onSelectTargetValueColumnSummaryMethod;
76
+ } else {
77
+ summary_method = total_value_column_summary_method;
78
+ onSelectSummaryMethod = _this.onSelectTotalValueColumnSummaryMethod;
79
+ }
80
+ var selectedMethodOption = _this.getSelectedMethodOption(summary_method, _this.summaryMethodsOptions);
81
+ return /*#__PURE__*/React.createElement("div", {
82
+ className: "statistic-chart-parameter-item"
83
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
84
+ value: selectedMethodOption,
85
+ onChange: onSelectSummaryMethod,
86
+ options: _this.summaryMethodsOptions
87
+ }));
88
+ };
89
+ _this.onChangeName = function (event) {
90
+ var value = event.target.value;
91
+ _this.setState({
92
+ statName: value
93
+ });
94
+ };
95
+ _this.onSaveName = function (event) {
96
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
97
+ name: _this.state.statName
98
+ }));
99
+ };
100
+ _this.onKeyDown = function (e) {
101
+ if (e.key == 'Enter') {
102
+ e.preventDefault();
103
+ e.target.blur();
104
+ }
105
+ };
106
+ _this.getStyleSetting = function () {
107
+ var statItem = _this.props.statItem;
108
+ var statName = _this.state.statName;
109
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
110
+ className: "statistic-chart-parameter-item"
111
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Label')), /*#__PURE__*/React.createElement(Input, {
112
+ type: "text",
113
+ value: statName || '',
114
+ placeholder: statItem.name,
115
+ onBlur: _this.onSaveName,
116
+ onKeyDown: _this.onKeyDown,
117
+ onChange: _this.onChangeName
118
+ })));
119
+ };
120
+ var numericColumns = props.numericColumns,
121
+ getColumnsOptions = props.getColumnsOptions,
122
+ _statItem = props.statItem;
123
+ _this.numericColumnOptions = getColumnsOptions(numericColumns);
124
+ _this.summaryMethodsOptions = _this.getSummaryMethodsOptions();
125
+ _this.state = {
126
+ statName: _statItem.name
127
+ };
128
+ return _this;
129
+ }
130
+ _createClass(DashboardChartSettings, [{
131
+ key: "componentWillReceiveProps",
132
+ value: function componentWillReceiveProps(nextProps) {
133
+ if (nextProps.selectedTableId !== this.props.selectedTableId) {
134
+ var numericColumns = nextProps.numericColumns,
135
+ getColumnsOptions = nextProps.getColumnsOptions;
136
+ this.numericColumnOptions = getColumnsOptions(numericColumns);
137
+ }
138
+ }
139
+ }, {
140
+ key: "render",
141
+ value: function render() {
142
+ var _this$props = this.props,
143
+ getTables = _this$props.getTables,
144
+ getViews = _this$props.getViews,
145
+ statItem = _this$props.statItem,
146
+ updateStatItem = _this$props.updateStatItem,
147
+ selectedTableId = _this$props.selectedTableId,
148
+ settingType = _this$props.settingType;
149
+ if (settingType === 'style') {
150
+ return this.getStyleSetting();
151
+ }
152
+ var target_value_column = statItem.target_value_column,
153
+ total_value_column = statItem.total_value_column;
154
+ var selectedTargetValueColumnOption = this.numericColumnOptions.filter(function (option) {
155
+ return option.value.key === target_value_column;
156
+ })[0];
157
+ var selectedTotalValueColumnOption = this.numericColumnOptions.filter(function (option) {
158
+ return option.value.key === total_value_column;
159
+ })[0];
160
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
161
+ statItem: statItem,
162
+ selectedTableId: selectedTableId,
163
+ selectedViewId: statItem.view_id,
164
+ getTables: getTables,
165
+ getViews: getViews,
166
+ getTableById: this.props.getTableById,
167
+ updateStatItem: updateStatItem
168
+ }), /*#__PURE__*/React.createElement("div", {
169
+ className: "statistic-chart-parameter-divider"
170
+ }), /*#__PURE__*/React.createElement("div", {
171
+ className: "statistic-chart-parameter-item"
172
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Current_value_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
173
+ columnsOptions: this.numericColumnOptions,
174
+ selectedColumnOption: selectedTargetValueColumnOption,
175
+ onChangeSelectedColumn: this.onSelectTargetValueColumn
176
+ })), this.renderSummaryMethod({
177
+ targetColumn: 'target_value_column'
178
+ }), /*#__PURE__*/React.createElement("div", {
179
+ className: "statistic-chart-parameter-divider"
180
+ }), /*#__PURE__*/React.createElement("div", {
181
+ className: "statistic-chart-parameter-item"
182
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Total_value_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
183
+ columnsOptions: this.numericColumnOptions,
184
+ selectedColumnOption: selectedTotalValueColumnOption,
185
+ onChangeSelectedColumn: this.onSelectTotalValueColumn
186
+ })), this.renderSummaryMethod({
187
+ targetColumn: 'total_value_column'
188
+ }));
189
+ }
190
+ }]);
191
+ return DashboardChartSettings;
192
+ }(Component);
193
+ export default DashboardChartSettings;
@@ -0,0 +1,13 @@
1
+ import React, { Fragment } from 'react';
2
+ import { DTableSelect } from '../../../components';
3
+ function GeoGranularitySettings(props) {
4
+ var geoGranularityOptions = props.geoGranularityOptions,
5
+ selectedGeoGranularityOption = props.selectedGeoGranularityOption,
6
+ onChangeGeoGranularity = props.onChangeGeoGranularity;
7
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DTableSelect, {
8
+ value: selectedGeoGranularityOption,
9
+ options: geoGranularityOptions,
10
+ onChange: onChangeGeoGranularity
11
+ }));
12
+ }
13
+ export default GeoGranularitySettings;
@@ -0,0 +1,107 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React, { Component, Fragment } from 'react';
6
+ import intl from 'react-intl-universal';
7
+ import BaseSettings from '../public-setting/base-settings';
8
+ import ColumnSettings from '../public-setting/column-settings';
9
+ import SummarySettings from './summary-settings';
10
+ import StyleSettings from './style-setting/heat-map-settings';
11
+ import { TIME_COLUMN_LIST } from '../../../constants';
12
+ var HeatMapSettings = /*#__PURE__*/function (_Component) {
13
+ _inherits(HeatMapSettings, _Component);
14
+ var _super = _createSuper(HeatMapSettings);
15
+ function HeatMapSettings(props) {
16
+ var _this;
17
+ _classCallCheck(this, HeatMapSettings);
18
+ _this = _super.call(this, props);
19
+ _this.getSelectedDateColumnOption = function () {
20
+ return _this.dateColumnsOptions.find(function (option) {
21
+ return option.value.key === _this.props.statItem.time_column;
22
+ });
23
+ };
24
+ _this.onSelectDateColumn = function (option) {
25
+ var time_column = _this.props.statItem.time_column;
26
+ var 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
+ var columns = props.columns,
33
+ getColumnsOptions = props.getColumnsOptions;
34
+ var dateColumns = columns.filter(function (column) {
35
+ return TIME_COLUMN_LIST.includes(column.type);
36
+ });
37
+ _this.dateColumnsOptions = getColumnsOptions(dateColumns);
38
+ return _this;
39
+ }
40
+ _createClass(HeatMapSettings, [{
41
+ key: "componentWillReceiveProps",
42
+ value: function componentWillReceiveProps(nextProps) {
43
+ if (nextProps.selectedTableId !== this.props.selectedTableId) {
44
+ var columns = nextProps.columns,
45
+ getColumnsOptions = nextProps.getColumnsOptions;
46
+ var dateColumns = columns.filter(function (column) {
47
+ return TIME_COLUMN_LIST.includes(column.type);
48
+ });
49
+ this.dateColumnsOptions = getColumnsOptions(dateColumns);
50
+ }
51
+ }
52
+ }, {
53
+ key: "render",
54
+ value: function render() {
55
+ var _this$props = this.props,
56
+ getTables = _this$props.getTables,
57
+ getViews = _this$props.getViews,
58
+ settingType = _this$props.settingType,
59
+ selectedTableId = _this$props.selectedTableId,
60
+ statItem = _this$props.statItem,
61
+ getColumnsOptions = _this$props.getColumnsOptions,
62
+ numericColumns = _this$props.numericColumns;
63
+ var selectedViewId = statItem.view_id;
64
+ var selectedDateColumnOption = this.getSelectedDateColumnOption();
65
+ if (settingType === 'style') {
66
+ return /*#__PURE__*/React.createElement(StyleSettings, {
67
+ statItem: statItem,
68
+ onChangeColor: this.props.onChangeColor,
69
+ updateStatItem: this.props.updateStatItem
70
+ });
71
+ }
72
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
73
+ statItem: statItem,
74
+ selectedTableId: selectedTableId,
75
+ selectedViewId: selectedViewId,
76
+ getTables: getTables,
77
+ getViews: getViews,
78
+ getTableById: this.props.getTableById,
79
+ updateStatItem: this.props.updateStatItem
80
+ }), /*#__PURE__*/React.createElement("div", {
81
+ className: "statistic-chart-parameter-divider"
82
+ }), /*#__PURE__*/React.createElement("div", {
83
+ className: "statistic-chart-parameter-item"
84
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Time_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
85
+ columnsOptions: this.dateColumnsOptions,
86
+ selectedColumnOption: selectedDateColumnOption,
87
+ onChangeSelectedColumn: this.onSelectDateColumn
88
+ })), /*#__PURE__*/React.createElement("div", {
89
+ className: "statistic-chart-parameter-divider"
90
+ }), /*#__PURE__*/React.createElement(SummarySettings, {
91
+ label: intl.get('Summary_method'),
92
+ statItem: statItem,
93
+ selectedTableId: selectedTableId,
94
+ numericColumns: numericColumns,
95
+ summaryType: statItem.summary_type,
96
+ summaryMethod: statItem.summary_method,
97
+ summaryColumn: statItem.summary_column,
98
+ getColumnsOptions: getColumnsOptions,
99
+ onChangeSummaryType: this.props.onChangeSummaryType,
100
+ onSelectSummaryColumn: this.props.onSelectSummaryColumn,
101
+ onSelectSummaryMethod: this.props.onSelectSummaryMethod
102
+ }));
103
+ }
104
+ }]);
105
+ return HeatMapSettings;
106
+ }(Component);
107
+ export default HeatMapSettings;
@@ -0,0 +1,332 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React, { Fragment } from 'react';
6
+ import intl from 'react-intl-universal';
7
+ import { isNumericColumn } from 'dtable-store';
8
+ import MapSettings from './map-settings';
9
+ import WorldMapSettings from './world-map-settings';
10
+ import HeatMapSettings from './heat-map-settings';
11
+ import MirrorSettings from './mirror-settings';
12
+ import BasicNumberCardSettings from './basic-number-card-settings';
13
+ import CombinationSettings from './combination-settings';
14
+ import TrendSettings from './trend-chart-settings';
15
+ import DashboardChartSettings from './dashboard-chart-settings';
16
+ import { STAT_TYPE, SUMMARY_TYPE, SUMMARY_METHOD } from '../../../constants';
17
+ var GROUP_TYPES = {
18
+ COUNT: 'count',
19
+ SINGLE_NUMERIC_COLUMN: 'single_numeric_column',
20
+ MULTIPLE_NUMERIC_COLUMN: 'multiple_numeric_column'
21
+ };
22
+ var AdvancedChartSettings = /*#__PURE__*/function (_React$Component) {
23
+ _inherits(AdvancedChartSettings, _React$Component);
24
+ var _super = _createSuper(AdvancedChartSettings);
25
+ function AdvancedChartSettings(props) {
26
+ var _this;
27
+ _classCallCheck(this, AdvancedChartSettings);
28
+ _this = _super.call(this, props);
29
+ _this.getDefaultColumnGroupbyType = function (_ref) {
30
+ var summary_type = _ref.summary_type;
31
+ if (summary_type === SUMMARY_TYPE.ADVANCED) {
32
+ return GROUP_TYPES.SINGLE_NUMERIC_COLUMN;
33
+ }
34
+ return GROUP_TYPES.COUNT;
35
+ };
36
+ _this.getNumericColumns = function (columns) {
37
+ if (!columns) return [];
38
+ return columns.filter(function (column) {
39
+ return column && isNumericColumn(column);
40
+ });
41
+ };
42
+ _this.getSettingsByType = function () {
43
+ var settingType = _this.state.settingType;
44
+ var _this$props = _this.props,
45
+ getTables = _this$props.getTables,
46
+ getViews = _this$props.getViews,
47
+ getTableById = _this$props.getTableById,
48
+ statItem = _this$props.statItem,
49
+ labelColorConfigs = _this$props.labelColorConfigs,
50
+ eventBus = _this$props.eventBus,
51
+ updateStatItem = _this$props.updateStatItem;
52
+ var type = statItem.type,
53
+ selectedTableId = statItem.table_id;
54
+ switch (type) {
55
+ case STAT_TYPE.MAP:
56
+ case STAT_TYPE.MAP_BUBBLE:
57
+ {
58
+ return /*#__PURE__*/React.createElement(MapSettings, {
59
+ settingType: settingType,
60
+ selectedTableId: selectedTableId,
61
+ columns: _this.columns,
62
+ numericColumns: _this.numericColumns,
63
+ statItem: statItem,
64
+ labelColorConfigs: labelColorConfigs,
65
+ eventBus: eventBus,
66
+ getTables: getTables,
67
+ getViews: getViews,
68
+ getTableById: getTableById,
69
+ getColumnsOptions: _this.getColumnsOptions,
70
+ updateStatItem: updateStatItem,
71
+ onChangeSummaryType: _this.onChangeSummaryType,
72
+ onSelectSummaryColumn: _this.onSelectSummaryColumn,
73
+ onSelectSummaryMethod: _this.onSelectSummaryMethod,
74
+ onChangeColor: _this.onChangeColor
75
+ });
76
+ }
77
+ case STAT_TYPE.WORLD_MAP:
78
+ case STAT_TYPE.WORLD_MAP_BUBBLE:
79
+ {
80
+ return /*#__PURE__*/React.createElement(WorldMapSettings, {
81
+ settingType: settingType,
82
+ selectedTableId: selectedTableId,
83
+ columns: _this.columns,
84
+ numericColumns: _this.numericColumns,
85
+ statItem: statItem,
86
+ labelColorConfigs: labelColorConfigs,
87
+ eventBus: eventBus,
88
+ getColumnsOptions: _this.getColumnsOptions,
89
+ getTables: getTables,
90
+ getViews: getViews,
91
+ getTableById: getTableById,
92
+ updateStatItem: updateStatItem,
93
+ onChangeSummaryType: _this.onChangeSummaryType,
94
+ onSelectSummaryColumn: _this.onSelectSummaryColumn,
95
+ onSelectSummaryMethod: _this.onSelectSummaryMethod,
96
+ onChangeColor: _this.onChangeColor
97
+ });
98
+ }
99
+ case STAT_TYPE.HEAT_MAP:
100
+ {
101
+ return /*#__PURE__*/React.createElement(HeatMapSettings, {
102
+ settingType: settingType,
103
+ selectedTableId: selectedTableId,
104
+ columns: _this.columns,
105
+ numericColumns: _this.numericColumns,
106
+ statItem: statItem,
107
+ labelColorConfigs: labelColorConfigs,
108
+ eventBus: eventBus,
109
+ getColumnsOptions: _this.getColumnsOptions,
110
+ getTables: getTables,
111
+ getViews: getViews,
112
+ getTableById: getTableById,
113
+ updateStatItem: updateStatItem,
114
+ onChangeSummaryType: _this.onChangeSummaryType,
115
+ onSelectSummaryColumn: _this.onSelectSummaryColumn,
116
+ onSelectSummaryMethod: _this.onSelectSummaryMethod,
117
+ onChangeColor: _this.onChangeColor
118
+ });
119
+ }
120
+ case STAT_TYPE.MIRROR:
121
+ {
122
+ return /*#__PURE__*/React.createElement(MirrorSettings, {
123
+ settingType: settingType,
124
+ selectedTableId: selectedTableId,
125
+ columns: _this.columns,
126
+ numericColumns: _this.numericColumns,
127
+ statItem: statItem,
128
+ labelColorConfigs: labelColorConfigs,
129
+ eventBus: eventBus,
130
+ getColumnsOptions: _this.getColumnsOptions,
131
+ getTables: getTables,
132
+ getViews: getViews,
133
+ getTableById: getTableById,
134
+ updateStatItem: updateStatItem,
135
+ onChangeSummaryType: _this.onChangeSummaryType,
136
+ onSelectSummaryColumn: _this.onSelectSummaryColumn,
137
+ onSelectSummaryMethod: _this.onSelectSummaryMethod
138
+ });
139
+ }
140
+ case STAT_TYPE.BASIC_NUMBER_CARD:
141
+ {
142
+ return /*#__PURE__*/React.createElement(BasicNumberCardSettings, {
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
+ updateStatItem: updateStatItem,
152
+ numericColumns: _this.numericColumns,
153
+ getColumnsOptions: _this.getColumnsOptions,
154
+ onChangeSummaryType: _this.onChangeSummaryType,
155
+ onSelectSummaryMethod: _this.onSelectSummaryMethod
156
+ });
157
+ }
158
+ case STAT_TYPE.COMBINATION_CHART:
159
+ {
160
+ return /*#__PURE__*/React.createElement(CombinationSettings, {
161
+ statItem: statItem,
162
+ labelColorConfigs: labelColorConfigs,
163
+ eventBus: eventBus,
164
+ settingType: settingType,
165
+ columns: _this.columns,
166
+ selectedTableId: selectedTableId,
167
+ getTables: getTables,
168
+ getViews: getViews,
169
+ getTableById: getTableById,
170
+ updateStatItem: updateStatItem,
171
+ numericColumns: _this.numericColumns,
172
+ getColumnsOptions: _this.getColumnsOptions
173
+ });
174
+ }
175
+ case STAT_TYPE.TREND_CHART:
176
+ {
177
+ return /*#__PURE__*/React.createElement(TrendSettings, {
178
+ settingType: settingType,
179
+ selectedTableId: selectedTableId,
180
+ columns: _this.columns,
181
+ numericColumns: _this.numericColumns,
182
+ statItem: statItem,
183
+ labelColorConfigs: labelColorConfigs,
184
+ eventBus: eventBus,
185
+ getColumnsOptions: _this.getColumnsOptions,
186
+ getTables: getTables,
187
+ getViews: getViews,
188
+ getTableById: getTableById,
189
+ updateStatItem: updateStatItem,
190
+ onChangeSummaryType: _this.onChangeSummaryType,
191
+ onSelectSummaryColumn: _this.onSelectSummaryColumn,
192
+ onSelectSummaryMethod: _this.onSelectSummaryMethod
193
+ });
194
+ }
195
+ case STAT_TYPE.DASHBOARD:
196
+ {
197
+ return /*#__PURE__*/React.createElement(DashboardChartSettings, {
198
+ statItem: statItem,
199
+ labelColorConfigs: labelColorConfigs,
200
+ eventBus: eventBus,
201
+ settingType: settingType,
202
+ selectedTableId: selectedTableId,
203
+ getTables: getTables,
204
+ getViews: getViews,
205
+ getTableById: getTableById,
206
+ updateStatItem: updateStatItem,
207
+ numericColumns: _this.numericColumns,
208
+ getColumnsOptions: _this.getColumnsOptions
209
+ });
210
+ }
211
+ default:
212
+ {
213
+ return null;
214
+ }
215
+ }
216
+ };
217
+ _this.getColumnsOptions = function (columns) {
218
+ if (!Array.isArray(columns)) return [];
219
+ return columns.map(function (column) {
220
+ var name = column.name,
221
+ key = column.key,
222
+ type = column.type;
223
+ return {
224
+ label: /*#__PURE__*/React.createElement("span", {
225
+ className: "select-option-name"
226
+ }, name),
227
+ value: {
228
+ name: name,
229
+ key: key,
230
+ type: type
231
+ }
232
+ };
233
+ });
234
+ };
235
+ _this.onChangeSummaryType = function (summaryType) {
236
+ var _this$props$statItem = _this.props.statItem,
237
+ summary_type = _this$props$statItem.summary_type,
238
+ summary_column = _this$props$statItem.summary_column,
239
+ summary_method = _this$props$statItem.summary_method;
240
+ if (summaryType === _this.columnGroupbyType) return;
241
+ if (summaryType === GROUP_TYPES.SINGLE_NUMERIC_COLUMN) {
242
+ var defaultColumn = _this.numericColumns[0];
243
+ summary_column = defaultColumn ? defaultColumn.key : null;
244
+ summary_method = SUMMARY_METHOD[0];
245
+ summary_type = SUMMARY_TYPE.ADVANCED;
246
+ } else {
247
+ summary_type = SUMMARY_TYPE.COUNT;
248
+ summary_method = null;
249
+ summary_column = null;
250
+ }
251
+ _this.columnGroupbyType = summaryType;
252
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
253
+ summary_type: summary_type,
254
+ summary_column: summary_column,
255
+ summary_method: summary_method
256
+ }));
257
+ };
258
+ _this.onChangeColor = function (targetColor) {
259
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
260
+ data_color: targetColor
261
+ }));
262
+ };
263
+ _this.onSelectSummaryColumn = function (summaryColumn) {
264
+ var summary_column = _this.props.statItem.summary_column;
265
+ if (summaryColumn === summary_column) return;
266
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
267
+ summary_column: summaryColumn
268
+ }));
269
+ };
270
+ _this.onSelectSummaryMethod = function (summaryMethod) {
271
+ var summary_method = _this.props.statItem.summary_method;
272
+ if (summaryMethod === summary_method) return;
273
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
274
+ summary_method: summaryMethod
275
+ }));
276
+ };
277
+ _this.selectEditType = function (type) {
278
+ _this.setState({
279
+ settingType: type
280
+ });
281
+ };
282
+ var _getTableById = props.getTableById,
283
+ _statItem = props.statItem;
284
+ var selectedTable = _getTableById(_statItem.table_id);
285
+ _this.columns = selectedTable.columns;
286
+ _this.numericColumns = _this.getNumericColumns(_this.columns);
287
+ _this.state = {
288
+ settingType: 'data'
289
+ };
290
+ _this.columnGroupbyType = _this.getDefaultColumnGroupbyType(_statItem);
291
+ return _this;
292
+ }
293
+ _createClass(AdvancedChartSettings, [{
294
+ key: "componentWillReceiveProps",
295
+ value: function componentWillReceiveProps(nextProps) {
296
+ var getTableById = this.props.getTableById;
297
+ var newSelectedTableId = nextProps.statItem.table_id;
298
+ if (newSelectedTableId !== this.props.statItem.table_id) {
299
+ var selectedTable = getTableById(newSelectedTableId);
300
+ this.columns = selectedTable.columns;
301
+ this.numericColumns = this.getNumericColumns(this.columns);
302
+ }
303
+ }
304
+ }, {
305
+ key: "render",
306
+ value: function render() {
307
+ var _this2 = this;
308
+ var settingType = this.state.settingType;
309
+ return /*#__PURE__*/React.createElement("div", {
310
+ className: "statistic-chart-settings"
311
+ }, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
312
+ className: "statistic-chart-settings-type"
313
+ }, /*#__PURE__*/React.createElement("div", {
314
+ onClick: function onClick() {
315
+ return _this2.selectEditType('data');
316
+ },
317
+ className: "statistic-type-item ".concat(settingType === 'data' ? 'selected-statistic-type-item' : '')
318
+ }, intl.get('Data_settings')), /*#__PURE__*/React.createElement("div", {
319
+ onClick: function onClick() {
320
+ return _this2.selectEditType('style');
321
+ },
322
+ className: "statistic-type-item ".concat(settingType === 'style' ? 'selected-statistic-type-item' : '')
323
+ }, intl.get('Style_settings'))), /*#__PURE__*/React.createElement("div", {
324
+ className: "statistic-chart-settings-container"
325
+ }, /*#__PURE__*/React.createElement("div", {
326
+ className: "statistic-chart-settings-parameter-list pt-4"
327
+ }, this.getSettingsByType()))));
328
+ }
329
+ }]);
330
+ return AdvancedChartSettings;
331
+ }(React.Component);
332
+ export default AdvancedChartSettings;