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,170 @@
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 { CellType, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES } from 'dtable-store';
7
+ import BaseSettings from '../public-setting/base-settings';
8
+ import ColumnSettings from '../public-setting/column-settings';
9
+ import GeoGranularitySettings from './geo-granularity-settings';
10
+ import SummarySettings from './summary-settings';
11
+ import MapStyleSetting from './style-setting/map-setting';
12
+ import { GEOLOCATION_GRANULARITY } from '../../../constants';
13
+ var MapSettings = /*#__PURE__*/function (_Component) {
14
+ _inherits(MapSettings, _Component);
15
+ var _super = _createSuper(MapSettings);
16
+ function MapSettings(props) {
17
+ var _this;
18
+ _classCallCheck(this, MapSettings);
19
+ _this = _super.call(this, props);
20
+ _this.getColumns = function (columns) {
21
+ var geoColumns = columns.filter(function (column) {
22
+ var type = column.type,
23
+ data = column.data;
24
+ if (type === CellType.GEOLOCATION) {
25
+ var _ref = data || {},
26
+ geo_format = _ref.geo_format;
27
+ if (geo_format === 'lng_lat' || geo_format === 'country_region') {
28
+ return false;
29
+ }
30
+ return true;
31
+ }
32
+ if (FORMULA_COLUMN_TYPES.includes(type)) {
33
+ var _ref2 = data || {},
34
+ result_type = _ref2.result_type,
35
+ array_type = _ref2.array_type,
36
+ array_data = _ref2.array_data;
37
+ if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
38
+ return false;
39
+ }
40
+ var _ref3 = array_data || {},
41
+ _geo_format = _ref3.geo_format;
42
+ if (_geo_format === 'lng_lat' || _geo_format === 'country_region') {
43
+ return false;
44
+ }
45
+ return true;
46
+ }
47
+ return false;
48
+ });
49
+ return geoColumns;
50
+ };
51
+ _this.getGeoGranularityOptions = function () {
52
+ return [{
53
+ id: GEOLOCATION_GRANULARITY.PROVINCE,
54
+ name: '按省'
55
+ }].map(function (granularity) {
56
+ return {
57
+ label: /*#__PURE__*/React.createElement("span", {
58
+ className: "select-option-name"
59
+ }, granularity.name),
60
+ value: granularity.id
61
+ };
62
+ });
63
+ };
64
+ _this.getSelectedGeoColumnOption = function () {
65
+ return _this.geoColumnsOptions.find(function (option) {
66
+ return option.value.key === _this.props.statItem.geo_column;
67
+ });
68
+ };
69
+ _this.getSelectedGeoGranularityOption = function () {
70
+ return _this.geoGranularityOptions.find(function (option) {
71
+ return option.value === _this.props.statItem.geolocation_granularity;
72
+ });
73
+ };
74
+ _this.onSelectGeoColumn = function (option) {
75
+ var geo_column = _this.props.statItem.geo_column;
76
+ var new_geo_column = option.value.key;
77
+ if (new_geo_column === geo_column) return;
78
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
79
+ geo_column: new_geo_column,
80
+ geolocation_granularity: GEOLOCATION_GRANULARITY.PROVINCE
81
+ }));
82
+ };
83
+ _this.onSelectGeoGranularity = function (option) {
84
+ var geolocation_granularity = _this.props.statItem.geolocation_granularity;
85
+ var new_geolocation_granularity = option.value;
86
+ if (new_geolocation_granularity === geolocation_granularity) return;
87
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
88
+ geolocation_granularity: new_geolocation_granularity
89
+ }));
90
+ };
91
+ var _columns = props.columns,
92
+ getColumnsOptions = props.getColumnsOptions;
93
+ var _geoColumns = _this.getColumns(_columns);
94
+ _this.geoColumnsOptions = getColumnsOptions(_geoColumns);
95
+ _this.geoGranularityOptions = _this.getGeoGranularityOptions();
96
+ return _this;
97
+ }
98
+ _createClass(MapSettings, [{
99
+ key: "UNSAFE_componentWillReceiveProps",
100
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
101
+ if (nextProps.selectedTableId !== this.props.selectedTableId) {
102
+ var columns = nextProps.columns,
103
+ getColumnsOptions = nextProps.getColumnsOptions;
104
+ var geoColumns = this.getColumns(columns);
105
+ this.geoColumnsOptions = getColumnsOptions(geoColumns);
106
+ }
107
+ }
108
+ }, {
109
+ key: "render",
110
+ value: function render() {
111
+ var _this$props = this.props,
112
+ getTables = _this$props.getTables,
113
+ getViews = _this$props.getViews,
114
+ settingType = _this$props.settingType,
115
+ selectedTableId = _this$props.selectedTableId,
116
+ statItem = _this$props.statItem,
117
+ getColumnsOptions = _this$props.getColumnsOptions,
118
+ numericColumns = _this$props.numericColumns;
119
+ var selectedViewId = statItem.view_id;
120
+ var selectedGeoColumnOption = this.getSelectedGeoColumnOption();
121
+ var selectedGeoGranularityOption = this.getSelectedGeoGranularityOption();
122
+ if (settingType === 'style') {
123
+ return /*#__PURE__*/React.createElement(MapStyleSetting, {
124
+ statItem: statItem,
125
+ onChangeColor: this.props.onChangeColor,
126
+ updateStatItem: this.props.updateStatItem
127
+ });
128
+ }
129
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
130
+ statItem: statItem,
131
+ selectedTableId: selectedTableId,
132
+ selectedViewId: selectedViewId,
133
+ getTables: getTables,
134
+ getViews: getViews,
135
+ getTableById: this.props.getTableById,
136
+ updateStatItem: this.props.updateStatItem
137
+ }), /*#__PURE__*/React.createElement("div", {
138
+ className: "statistic-chart-parameter-divider"
139
+ }), /*#__PURE__*/React.createElement("div", {
140
+ className: "statistic-chart-parameter-item"
141
+ }, /*#__PURE__*/React.createElement("label", null, "\u4F4D\u7F6E\u5B57\u6BB5"), /*#__PURE__*/React.createElement(ColumnSettings, {
142
+ columnsOptions: this.geoColumnsOptions,
143
+ selectedColumnOption: selectedGeoColumnOption,
144
+ onChangeSelectedColumn: this.onSelectGeoColumn
145
+ })), /*#__PURE__*/React.createElement("div", {
146
+ className: "statistic-chart-parameter-item"
147
+ }, /*#__PURE__*/React.createElement(GeoGranularitySettings, {
148
+ geoGranularityOptions: this.geoGranularityOptions,
149
+ selectedGeoGranularityOption: selectedGeoGranularityOption,
150
+ onChangeGeoGranularity: this.onSelectGeoGranularity
151
+ })), /*#__PURE__*/React.createElement("div", {
152
+ className: "statistic-chart-parameter-divider"
153
+ }), /*#__PURE__*/React.createElement(SummarySettings, {
154
+ label: '归总方法',
155
+ statItem: statItem,
156
+ selectedTableId: selectedTableId,
157
+ numericColumns: numericColumns,
158
+ summaryType: statItem.summary_type,
159
+ summaryMethod: statItem.summary_method,
160
+ summaryColumn: statItem.summary_column,
161
+ getColumnsOptions: getColumnsOptions,
162
+ onChangeSummaryType: this.props.onChangeSummaryType,
163
+ onSelectSummaryColumn: this.props.onSelectSummaryColumn,
164
+ onSelectSummaryMethod: this.props.onSelectSummaryMethod
165
+ }));
166
+ }
167
+ }]);
168
+ return MapSettings;
169
+ }(Component);
170
+ export default MapSettings;
@@ -0,0 +1,141 @@
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 ToggleSetting from '../public-setting/toggle-setting';
11
+ import { MIRROR_COLUMN_LIST } from '../../../constants';
12
+ var MirrorSettings = /*#__PURE__*/function (_Component) {
13
+ _inherits(MirrorSettings, _Component);
14
+ var _super = _createSuper(MirrorSettings);
15
+ function MirrorSettings(props) {
16
+ var _this;
17
+ _classCallCheck(this, MirrorSettings);
18
+ _this = _super.call(this, props);
19
+ _this.getSelectedStatColumnOption = function () {
20
+ return _this.statColumnsOptions.find(function (option) {
21
+ return option.value.key === _this.props.statItem.column;
22
+ });
23
+ };
24
+ _this.getSelectedGroupColumnOption = function () {
25
+ return _this.groupColumnsOptions.find(function (option) {
26
+ return option.value.key === _this.props.statItem.group_column;
27
+ });
28
+ };
29
+ _this.onSelectStatColumn = function (option) {
30
+ var column = _this.props.statItem.column;
31
+ var new_column = option.value.key;
32
+ if (new_column === column) return;
33
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
34
+ column: new_column
35
+ }));
36
+ };
37
+ _this.onSelectGroupColumn = function (option) {
38
+ var group_column = _this.props.statItem.group_column;
39
+ var 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 = function (event) {
46
+ _this.props.updateStatItem(Object.assign({}, _this.props.statItem, {
47
+ is_transpose: event.target.checked
48
+ }));
49
+ };
50
+ var columns = props.columns,
51
+ getColumnsOptions = props.getColumnsOptions;
52
+ var statColumns = columns.filter(function (column) {
53
+ return MIRROR_COLUMN_LIST.includes(column.type);
54
+ });
55
+ var groupColumns = columns.filter(function (column) {
56
+ return column.type === 'single-select';
57
+ });
58
+ _this.statColumnsOptions = getColumnsOptions(statColumns);
59
+ _this.groupColumnsOptions = getColumnsOptions(groupColumns);
60
+ return _this;
61
+ }
62
+ _createClass(MirrorSettings, [{
63
+ key: "UNSAFE_componentWillReceiveProps",
64
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
65
+ if (nextProps.selectedTableId !== this.props.selectedTableId) {
66
+ var columns = nextProps.columns,
67
+ getColumnsOptions = nextProps.getColumnsOptions;
68
+ var statColumns = columns.filter(function (column) {
69
+ return MIRROR_COLUMN_LIST.includes(column.type);
70
+ });
71
+ this.statColumnsOptions = getColumnsOptions(statColumns);
72
+ var groupColumns = columns.filter(function (column) {
73
+ return column.type === 'single-select';
74
+ });
75
+ this.groupColumnsOptions = getColumnsOptions(groupColumns);
76
+ }
77
+ }
78
+ }, {
79
+ key: "render",
80
+ value: function render() {
81
+ var _this$props = this.props,
82
+ getTables = _this$props.getTables,
83
+ getViews = _this$props.getViews,
84
+ settingType = _this$props.settingType,
85
+ selectedTableId = _this$props.selectedTableId,
86
+ statItem = _this$props.statItem,
87
+ getColumnsOptions = _this$props.getColumnsOptions,
88
+ numericColumns = _this$props.numericColumns;
89
+ var selectedColumnOption = this.getSelectedStatColumnOption();
90
+ var selectedGroupColumnOption = this.getSelectedGroupColumnOption();
91
+ if (settingType === 'style') {
92
+ return null;
93
+ }
94
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(BaseSettings, {
95
+ statItem: statItem,
96
+ selectedTableId: statItem.table_id,
97
+ selectedViewId: statItem.view_id,
98
+ getTables: getTables,
99
+ getViews: getViews,
100
+ getTableById: this.props.getTableById,
101
+ updateStatItem: this.props.updateStatItem
102
+ }), /*#__PURE__*/React.createElement("div", {
103
+ className: "statistic-chart-parameter-divider"
104
+ }), /*#__PURE__*/React.createElement("div", {
105
+ className: "statistic-chart-parameter-item"
106
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Statistic_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
107
+ columnsOptions: this.statColumnsOptions,
108
+ selectedColumnOption: selectedColumnOption,
109
+ onChangeSelectedColumn: this.onSelectStatColumn
110
+ })), /*#__PURE__*/React.createElement("div", {
111
+ className: "statistic-chart-parameter-item"
112
+ }, /*#__PURE__*/React.createElement(ToggleSetting, {
113
+ label: intl.get('Reversing'),
114
+ isChecked: statItem.is_transpose,
115
+ handleToggleChange: this.handleToggleChange
116
+ })), /*#__PURE__*/React.createElement("div", {
117
+ className: "statistic-chart-parameter-item"
118
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Column_grouping_field')), /*#__PURE__*/React.createElement(ColumnSettings, {
119
+ columnsOptions: this.groupColumnsOptions,
120
+ selectedColumnOption: selectedGroupColumnOption,
121
+ onChangeSelectedColumn: this.onSelectGroupColumn
122
+ })), /*#__PURE__*/React.createElement("div", {
123
+ className: "statistic-chart-parameter-divider"
124
+ }), /*#__PURE__*/React.createElement(SummarySettings, {
125
+ label: intl.get('Summary_method'),
126
+ statItem: statItem,
127
+ selectedTableId: selectedTableId,
128
+ numericColumns: numericColumns,
129
+ summaryType: statItem.summary_type,
130
+ summaryMethod: statItem.summary_method,
131
+ summaryColumn: statItem.summary_column,
132
+ getColumnsOptions: getColumnsOptions,
133
+ onChangeSummaryType: this.props.onChangeSummaryType,
134
+ onSelectSummaryColumn: this.props.onSelectSummaryColumn,
135
+ onSelectSummaryMethod: this.props.onSelectSummaryMethod
136
+ }));
137
+ }
138
+ }]);
139
+ return MirrorSettings;
140
+ }(Component);
141
+ export default MirrorSettings;
@@ -0,0 +1,219 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
+ import React, { Component, Fragment } from 'react';
8
+ import intl from 'react-intl-universal';
9
+ import ToggleSetting from '../../public-setting/toggle-setting';
10
+ import AxisLabelPosition from '../../public-setting/axis-label-position-setting';
11
+ import IndToggleSetting from '../../public-setting/ind-toggle-setting';
12
+ import MinMaxSetting from '../../public-setting/min-max-setting';
13
+ import LabelFontSizeEditor from '../../basic-chart-settings/style-setting/label-font-size-editor';
14
+ import { LABEL_CONFIG_CHANGED } from '../../../../constants';
15
+ var CombinationChartStyle = /*#__PURE__*/function (_Component) {
16
+ _inherits(CombinationChartStyle, _Component);
17
+ var _super = _createSuper(CombinationChartStyle);
18
+ function CombinationChartStyle() {
19
+ var _this;
20
+ _classCallCheck(this, CombinationChartStyle);
21
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
+ args[_key] = arguments[_key];
23
+ }
24
+ _this = _super.call.apply(_super, [this].concat(args));
25
+ _this.renderShowAxisLabel = function (type, position) {
26
+ var statItem = _this.props.statItem;
27
+ var _ref = statItem || {},
28
+ show_x_axis_label = _ref.show_x_axis_label;
29
+ if (type === 'x') {
30
+ return /*#__PURE__*/React.createElement(ToggleSetting, {
31
+ isChecked: show_x_axis_label || false,
32
+ handleToggleChange: _this.onToggleXAxisLabel,
33
+ label: intl.get('Display_title')
34
+ });
35
+ } else {
36
+ var isChecked = _this.props.statItem["show_y_axis_".concat(position, "_label")] || false;
37
+ return /*#__PURE__*/React.createElement(ToggleSetting, {
38
+ isChecked: isChecked,
39
+ handleToggleChange: function handleToggleChange() {
40
+ return _this.onToggleYAxisLabel(position);
41
+ },
42
+ label: intl.get('Display_title')
43
+ });
44
+ }
45
+ };
46
+ _this.onToggleXAxisLabel = function () {
47
+ var _this$props = _this.props,
48
+ statItem = _this$props.statItem,
49
+ eventBus = _this$props.eventBus;
50
+ var _ref2 = statItem || {},
51
+ show_x_axis_label = _ref2.show_x_axis_label;
52
+ var updated = {
53
+ show_x_axis_label: !show_x_axis_label,
54
+ x_axis_label_position: !show_x_axis_label ? 'center' : null
55
+ };
56
+ var newStatItem = Object.assign({}, statItem, updated);
57
+ eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
58
+ _this.props.updateStatItem(newStatItem);
59
+ };
60
+ _this.onToggleYAxisLabel = function (position) {
61
+ var _updated;
62
+ var _this$props2 = _this.props,
63
+ statItem = _this$props2.statItem,
64
+ eventBus = _this$props2.eventBus;
65
+ var updated = (_updated = {}, _defineProperty(_updated, "show_y_axis_".concat(position, "_label"), !statItem["show_y_axis_".concat(position, "_label")]), _defineProperty(_updated, "y_axis_".concat(position, "_label_position"), !statItem["show_y_axis_".concat(position, "_label")] ? 'center' : null), _updated);
66
+ var newStatItem = Object.assign({}, statItem, updated);
67
+ eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
68
+ _this.props.updateStatItem(newStatItem);
69
+ };
70
+ _this.onSelectAxisLabelPosition = function (type, option, position) {
71
+ var updated;
72
+ if (type === 'x') {
73
+ updated = {
74
+ x_axis_label_position: option.value
75
+ };
76
+ } else {
77
+ updated = _defineProperty({}, "y_axis_".concat(position, "_label_position"), option.value);
78
+ }
79
+ var _this$props3 = _this.props,
80
+ statItem = _this$props3.statItem,
81
+ eventBus = _this$props3.eventBus;
82
+ var newStatItem = Object.assign({}, statItem, updated);
83
+ eventBus.dispatch(LABEL_CONFIG_CHANGED, newStatItem);
84
+ _this.props.updateStatItem(newStatItem);
85
+ };
86
+ _this.onToggleYAxisAutoRange = function (key) {
87
+ var statItem = _this.props.statItem;
88
+ var updated = _defineProperty({}, key, statItem[key] == undefined ? false : !statItem[key]);
89
+ _this.props.updateStatItem(Object.assign({}, statItem, updated));
90
+ };
91
+ _this.onYAxisMinChange = function (key, min) {
92
+ var newMin = parseInt(min);
93
+ if (!Number.isNaN(newMin)) {
94
+ var statItem = _this.props.statItem;
95
+ var updated = _defineProperty({}, key, newMin);
96
+ _this.props.updateStatItem(Object.assign({}, statItem, updated));
97
+ }
98
+ };
99
+ _this.onYAxisMaxChange = function (key, max) {
100
+ var newMax = parseInt(max);
101
+ if (!Number.isNaN(newMax)) {
102
+ var statItem = _this.props.statItem;
103
+ var updated = _defineProperty({}, key, newMax);
104
+ _this.props.updateStatItem(Object.assign({}, statItem, updated));
105
+ }
106
+ };
107
+ _this.onToggleDisplayData = function () {
108
+ var statItem = _this.props.statItem;
109
+ var _ref3 = statItem || {},
110
+ display_data = _ref3.display_data;
111
+ var updated = {
112
+ display_data: !display_data
113
+ };
114
+ _this.props.updateStatItem(Object.assign({}, statItem, updated));
115
+ };
116
+ _this.onChangeLabelFontSize = function (label_font_size) {
117
+ var statItem = _this.props.statItem;
118
+ _this.props.updateStatItem(Object.assign({}, statItem, {
119
+ label_font_size: label_font_size
120
+ }));
121
+ };
122
+ _this.renderLeftAutoRange = function () {
123
+ var statItem = _this.props.statItem;
124
+ var y_axis_auto_range_left = statItem.y_axis_auto_range_left,
125
+ y_axis_min_left = statItem.y_axis_min_left,
126
+ y_axis_max_left = statItem.y_axis_max_left;
127
+ var checked = y_axis_auto_range_left == undefined ? true : y_axis_auto_range_left;
128
+ return /*#__PURE__*/React.createElement("div", {
129
+ className: "mt-1"
130
+ }, /*#__PURE__*/React.createElement(ToggleSetting, {
131
+ isChecked: checked,
132
+ handleToggleChange: function handleToggleChange() {
133
+ _this.onToggleYAxisAutoRange('y_axis_auto_range_left');
134
+ },
135
+ label: intl.get('Auto_range')
136
+ }), !checked && /*#__PURE__*/React.createElement(MinMaxSetting, {
137
+ min: y_axis_min_left,
138
+ max: y_axis_max_left,
139
+ onMinChange: _this.onYAxisMinChange.bind(_assertThisInitialized(_this), 'y_axis_min_left'),
140
+ onMaxChange: _this.onYAxisMaxChange.bind(_assertThisInitialized(_this), 'y_axis_max_left')
141
+ }));
142
+ };
143
+ _this.renderRightAutoRange = function () {
144
+ var statItem = _this.props.statItem;
145
+ var y_axis_auto_range_right = statItem.y_axis_auto_range_right,
146
+ y_axis_min_right = statItem.y_axis_min_right,
147
+ y_axis_max_right = statItem.y_axis_max_right;
148
+ var checked = y_axis_auto_range_right == undefined ? true : y_axis_auto_range_right;
149
+ return /*#__PURE__*/React.createElement("div", {
150
+ className: "mt-1"
151
+ }, /*#__PURE__*/React.createElement(ToggleSetting, {
152
+ isChecked: checked,
153
+ handleToggleChange: function handleToggleChange() {
154
+ _this.onToggleYAxisAutoRange('y_axis_auto_range_right');
155
+ },
156
+ label: intl.get('Auto_range')
157
+ }), !checked && /*#__PURE__*/React.createElement(MinMaxSetting, {
158
+ min: y_axis_min_right,
159
+ max: y_axis_max_right,
160
+ onMinChange: _this.onYAxisMinChange.bind(_assertThisInitialized(_this), 'y_axis_min_right'),
161
+ onMaxChange: _this.onYAxisMaxChange.bind(_assertThisInitialized(_this), 'y_axis_max_right')
162
+ }));
163
+ };
164
+ return _this;
165
+ }
166
+ _createClass(CombinationChartStyle, [{
167
+ key: "render",
168
+ value: function render() {
169
+ var _this2 = this;
170
+ var statItem = this.props.statItem;
171
+ var show_x_axis_label = statItem.show_x_axis_label,
172
+ show_y_axis_left_label = statItem.show_y_axis_left_label,
173
+ show_y_axis_right_label = statItem.show_y_axis_right_label,
174
+ _statItem$display_dat = statItem.display_data,
175
+ display_data = _statItem$display_dat === void 0 ? false : _statItem$display_dat,
176
+ _statItem$label_font_ = statItem.label_font_size,
177
+ label_font_size = _statItem$label_font_ === void 0 ? 12 : _statItem$label_font_;
178
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
179
+ className: "statistic-chart-parameter-item"
180
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('X-axis')), this.renderShowAxisLabel('x'), show_x_axis_label && /*#__PURE__*/React.createElement(AxisLabelPosition, {
181
+ statItem: statItem,
182
+ axisType: 'x',
183
+ onSelectAxisLabelPosition: this.onSelectAxisLabelPosition
184
+ })), /*#__PURE__*/React.createElement("div", {
185
+ className: "statistic-chart-parameter-divider"
186
+ }), /*#__PURE__*/React.createElement("div", {
187
+ className: "statistic-chart-parameter-item"
188
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Y-axis(left side)')), this.renderShowAxisLabel('y', 'left'), show_y_axis_left_label && /*#__PURE__*/React.createElement(AxisLabelPosition, {
189
+ statItem: statItem,
190
+ axisType: 'y_left',
191
+ onSelectAxisLabelPosition: function onSelectAxisLabelPosition(type, option) {
192
+ return _this2.onSelectAxisLabelPosition(type, option, 'left');
193
+ }
194
+ }), this.renderLeftAutoRange()), /*#__PURE__*/React.createElement("div", {
195
+ className: "statistic-chart-parameter-item"
196
+ }, /*#__PURE__*/React.createElement("label", null, intl.get('Y-axis(right side)')), this.renderShowAxisLabel('y', 'right'), show_y_axis_right_label && /*#__PURE__*/React.createElement(AxisLabelPosition, {
197
+ statItem: statItem,
198
+ axisType: 'y_right',
199
+ onSelectAxisLabelPosition: function onSelectAxisLabelPosition(type, option) {
200
+ return _this2.onSelectAxisLabelPosition(type, option, 'right');
201
+ }
202
+ }), this.renderRightAutoRange()), /*#__PURE__*/React.createElement("div", {
203
+ className: "statistic-chart-parameter-divider"
204
+ }), /*#__PURE__*/React.createElement("div", {
205
+ className: "statistic-chart-parameter-item"
206
+ }, /*#__PURE__*/React.createElement(IndToggleSetting, {
207
+ isChecked: display_data,
208
+ handleToggleChange: this.onToggleDisplayData,
209
+ label: intl.get('Display_data')
210
+ }), display_data && /*#__PURE__*/React.createElement(LabelFontSizeEditor, {
211
+ className: "mt-3",
212
+ fontSize: label_font_size,
213
+ onChangeFontSize: this.onChangeLabelFontSize
214
+ })));
215
+ }
216
+ }]);
217
+ return CombinationChartStyle;
218
+ }(Component);
219
+ export default CombinationChartStyle;
@@ -0,0 +1,89 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
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 } from 'react';
7
+ import intl from 'react-intl-universal';
8
+ import { Label, Input, InputGroup, InputGroupAddon } from 'reactstrap';
9
+ import ColorGroupSelector from '../../color-setting/color-group-selector';
10
+ import { DEFAULT_GRID_DISTANCE, DEFAULT_GRID_SIZE } from '../../../../constants';
11
+ var HeatMapStyleSettings = /*#__PURE__*/function (_Component) {
12
+ _inherits(HeatMapStyleSettings, _Component);
13
+ var _super = _createSuper(HeatMapStyleSettings);
14
+ function HeatMapStyleSettings() {
15
+ var _this;
16
+ _classCallCheck(this, HeatMapStyleSettings);
17
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ args[_key] = arguments[_key];
19
+ }
20
+ _this = _super.call.apply(_super, [this].concat(args));
21
+ _this.renderColorSetting = function () {
22
+ var _this$props = _this.props,
23
+ onChangeColor = _this$props.onChangeColor,
24
+ statItem = _this$props.statItem;
25
+ return /*#__PURE__*/React.createElement(ColorGroupSelector, {
26
+ currentColor: statItem.data_color,
27
+ onChangeColor: onChangeColor
28
+ });
29
+ };
30
+ _this.onSubmit = function (evt) {
31
+ var statItem = _this.props.statItem;
32
+ var key = evt.target.name;
33
+ var value = evt.target.value.trim().replace(/[^0-9]/g, '');
34
+ var newValue = value ? Number(value) : null;
35
+ if (newValue == statItem[key]) {
36
+ return;
37
+ }
38
+ if (newValue) {
39
+ _this.props.updateStatItem(Object.assign({}, statItem, _defineProperty({}, key, newValue)));
40
+ }
41
+ };
42
+ _this.onKeyDown = function (e) {
43
+ if (e.key == 'Enter') {
44
+ e.preventDefault();
45
+ e.target.blur();
46
+ }
47
+ };
48
+ return _this;
49
+ }
50
+ _createClass(HeatMapStyleSettings, [{
51
+ key: "render",
52
+ value: function render() {
53
+ var statItem = this.props.statItem;
54
+ var grid_size = statItem.grid_size,
55
+ grid_distance = statItem.grid_distance;
56
+ return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderColorSetting(), /*#__PURE__*/React.createElement("div", {
57
+ className: "statistic-chart-parameter-divider"
58
+ }), /*#__PURE__*/React.createElement("div", {
59
+ className: "statistic-chart-parameter-item"
60
+ }, /*#__PURE__*/React.createElement(Label, {
61
+ for: "grid-size"
62
+ }, intl.get('Grid_size')), /*#__PURE__*/React.createElement(InputGroup, null, /*#__PURE__*/React.createElement(Input, {
63
+ type: "text",
64
+ id: "grid-size",
65
+ name: "grid_size",
66
+ defaultValue: grid_size || DEFAULT_GRID_SIZE,
67
+ onBlur: this.onSubmit,
68
+ onKeyDown: this.onKeyDown
69
+ }), /*#__PURE__*/React.createElement(InputGroupAddon, {
70
+ addonType: "append"
71
+ }, "px"))), /*#__PURE__*/React.createElement("div", {
72
+ className: "statistic-chart-parameter-item"
73
+ }, /*#__PURE__*/React.createElement(Label, {
74
+ for: "grid-distance"
75
+ }, intl.get('Grid_distance')), /*#__PURE__*/React.createElement(InputGroup, null, /*#__PURE__*/React.createElement(Input, {
76
+ type: "text",
77
+ id: "grid-distance",
78
+ name: "grid_distance",
79
+ defaultValue: grid_distance || DEFAULT_GRID_DISTANCE,
80
+ onBlur: this.onSubmit,
81
+ onKeyDown: this.onKeyDown
82
+ }), /*#__PURE__*/React.createElement(InputGroupAddon, {
83
+ addonType: "append"
84
+ }, "px"))));
85
+ }
86
+ }]);
87
+ return HeatMapStyleSettings;
88
+ }(Component);
89
+ export default HeatMapStyleSettings;