dtable-statistic 4.3.2 → 4.3.3

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 (222) hide show
  1. package/es/api/dtable-db-api.js +10 -3
  2. package/es/calculator/base-calculator.js +20 -12
  3. package/es/calculator/basic-chart-calculator.js +72 -65
  4. package/es/calculator/combination-calculator.js +64 -57
  5. package/es/calculator/compare-bar-calculator.js +33 -26
  6. package/es/calculator/completeness-calculator.js +37 -30
  7. package/es/calculator/copy-value.js +7 -1
  8. package/es/calculator/dashboard-calculator.js +20 -13
  9. package/es/calculator/heat-map-calculator.js +25 -18
  10. package/es/calculator/horizontal-bar-calculator.js +15 -8
  11. package/es/calculator/index.js +42 -35
  12. package/es/calculator/map-calculator.js +29 -22
  13. package/es/calculator/mirror-calculator.js +27 -20
  14. package/es/calculator/number-card-calculator.js +17 -10
  15. package/es/calculator/pivot-table-calculator.js +65 -58
  16. package/es/calculator/scatter-calculator.js +21 -14
  17. package/es/calculator/thread-manager.js +7 -1
  18. package/es/calculator/trend-calculator.js +29 -22
  19. package/es/calculator/workers/basic-chart-calculator-worker.js +83 -76
  20. package/es/calculator/workers/calculator.worker.js +33 -30
  21. package/es/calculator/workers/card-calculator-worker.js +19 -13
  22. package/es/calculator/workers/combination-calculator-worker.js +53 -46
  23. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +29 -22
  24. package/es/calculator/workers/completeness-calculator-worker.js +41 -34
  25. package/es/calculator/workers/dashboard-calculator-worker.js +24 -18
  26. package/es/calculator/workers/mirror-calculator-worker.js +29 -22
  27. package/es/calculator/workers/pivot-table-calculator-worker.js +84 -77
  28. package/es/calculator/workers/scatter-calculator-worker.js +27 -20
  29. package/es/calculator/workers/trend-calculator-worker.js +34 -27
  30. package/es/calculator/world-map-calculator.js +24 -17
  31. package/es/components/common-add-tool.js +12 -5
  32. package/es/components/dialog/chart-addition-edit-dialog.js +20 -12
  33. package/es/components/dialog/chart-addition-widgets/chart-selector.js +110 -103
  34. package/es/components/dialog/color-theme-dialog.js +22 -15
  35. package/es/components/dialog/delete-confirmation-dialog.js +18 -11
  36. package/es/components/dialog/enlarged-chart-dialog.js +28 -20
  37. package/es/components/dialog/new-table-dialog.js +23 -16
  38. package/es/components/dialog/new-view-dialog.js +22 -15
  39. package/es/components/dialog/rename-view-dialog.js +22 -14
  40. package/es/components/dialog/statistic-record-dialog/index.js +45 -37
  41. package/es/components/dialog/statistic-types-dialog/index.js +22 -14
  42. package/es/components/dialog/table-select-dialog.js +23 -15
  43. package/es/components/dropdown-menu/statistic-dropdown-menu.js +56 -43
  44. package/es/components/dtable-popover.js +19 -12
  45. package/es/components/dtable-search-input.js +21 -13
  46. package/es/components/dtable-select.js +20 -12
  47. package/es/components/icon.js +11 -4
  48. package/es/components/index.js +76 -11
  49. package/es/components/loading.js +10 -3
  50. package/es/components/modal-portal.js +12 -5
  51. package/es/components/popover/color-rules/color-rule.js +33 -25
  52. package/es/components/popover/color-rules/index.js +14 -6
  53. package/es/components/popover/color-rules/rule-filters/filter.js +35 -28
  54. package/es/components/popover/color-rules/rule-filters/index.js +25 -17
  55. package/es/components/popover/color-rules/rule-filters/number-input.js +17 -9
  56. package/es/components/popover/color-rules-popover.js +32 -24
  57. package/es/components/popover/color-selector-popover.js +17 -10
  58. package/es/components/seatable-radio/index.js +16 -9
  59. package/es/components/select/index.js +9 -2
  60. package/es/components/select/option-group.js +27 -19
  61. package/es/components/select/option.js +14 -6
  62. package/es/components/select/select.js +25 -17
  63. package/es/components/toast/alert.js +31 -24
  64. package/es/components/toast/index.js +10 -3
  65. package/es/components/toast/toast.js +20 -12
  66. package/es/components/toast/toastManager.js +17 -9
  67. package/es/components/toast/toaster.js +14 -6
  68. package/es/constants/color-rules.js +12 -6
  69. package/es/constants/dtable-select-style.js +9 -4
  70. package/es/constants/event-types.js +10 -4
  71. package/es/constants/index.js +96 -67
  72. package/es/constants/key-codes.js +2 -0
  73. package/es/constants/map.js +8 -2
  74. package/es/constants/model.js +26 -20
  75. package/es/constants/regions.js +8 -3
  76. package/es/constants/zIndexes.js +7 -1
  77. package/es/custom-g2.js +236 -208
  78. package/es/dashboard.js +58 -50
  79. package/es/desktop-dashboard.js +55 -47
  80. package/es/index.js +6 -3
  81. package/es/locale/index.js +13 -10
  82. package/es/locale/lang/de.js +7 -1
  83. package/es/locale/lang/en.js +7 -1
  84. package/es/locale/lang/fr.js +7 -1
  85. package/es/locale/lang/zh_CN.js +7 -1
  86. package/es/mobile-dashboard.js +46 -38
  87. package/es/model/bar-group.js +19 -11
  88. package/es/model/bar.js +18 -10
  89. package/es/model/base-model.js +9 -2
  90. package/es/model/basic-number-card.js +16 -8
  91. package/es/model/collaborators.js +9 -2
  92. package/es/model/combination.js +20 -12
  93. package/es/model/compare-bar.js +24 -16
  94. package/es/model/completeness-group.js +16 -8
  95. package/es/model/completeness.js +13 -5
  96. package/es/model/custom-bar.js +14 -6
  97. package/es/model/dashboard.js +14 -6
  98. package/es/model/generic-model.js +141 -133
  99. package/es/model/heat-map.js +19 -11
  100. package/es/model/horizontal-bar-group.js +18 -10
  101. package/es/model/horizontal-bar.js +18 -10
  102. package/es/model/index.js +185 -53
  103. package/es/model/map.js +23 -15
  104. package/es/model/mirror.js +21 -13
  105. package/es/model/pie.js +18 -10
  106. package/es/model/ring.js +19 -11
  107. package/es/model/scatter.js +14 -6
  108. package/es/model/statistic-dashboard.js +9 -2
  109. package/es/model/table.js +18 -10
  110. package/es/model/trend.js +20 -12
  111. package/es/model/world-map.js +21 -13
  112. package/es/service/chart-service.js +14 -7
  113. package/es/service/dashboard-service.js +42 -35
  114. package/es/service/map-json.js +14 -8
  115. package/es/stat-editor/chart-name-editor.js +15 -8
  116. package/es/stat-editor/index.js +24 -16
  117. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +30 -22
  118. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +57 -49
  119. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +32 -24
  120. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +11 -4
  121. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +27 -19
  122. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +51 -43
  123. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +31 -23
  124. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +31 -23
  125. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +48 -40
  126. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +29 -21
  127. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +34 -26
  128. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +55 -47
  129. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +30 -22
  130. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +26 -18
  131. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +35 -27
  132. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +32 -24
  133. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +41 -33
  134. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +30 -22
  135. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +25 -17
  136. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +54 -46
  137. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +31 -23
  138. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +34 -26
  139. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +85 -77
  140. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +29 -21
  141. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +81 -73
  142. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +24 -16
  143. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +27 -19
  144. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +26 -18
  145. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +59 -51
  146. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +27 -19
  147. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +57 -49
  148. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +20 -12
  149. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +56 -48
  150. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +17 -9
  151. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +29 -21
  152. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +38 -30
  153. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +58 -50
  154. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +25 -17
  155. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +56 -47
  156. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +20 -12
  157. package/es/stat-editor/stat-settings/color-setting/color-picker.js +19 -12
  158. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +70 -62
  159. package/es/stat-editor/stat-settings/map/map-level.js +20 -13
  160. package/es/stat-editor/stat-settings/map/map-province-city.js +27 -20
  161. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +19 -11
  162. package/es/stat-editor/stat-settings/public-setting/base-settings.js +28 -20
  163. package/es/stat-editor/stat-settings/public-setting/calender.js +29 -22
  164. package/es/stat-editor/stat-settings/public-setting/column-settings.js +13 -6
  165. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +16 -9
  166. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +21 -13
  167. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +15 -8
  168. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +19 -11
  169. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +35 -27
  170. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +15 -8
  171. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +26 -18
  172. package/es/stat-list/chart-preview.js +33 -20
  173. package/es/stat-list/index.js +36 -28
  174. package/es/stat-view/area-chart.js +51 -44
  175. package/es/stat-view/bar-chart.js +55 -48
  176. package/es/stat-view/base-chart.js +32 -24
  177. package/es/stat-view/basic-number-card.js +26 -19
  178. package/es/stat-view/combination-chart.js +57 -50
  179. package/es/stat-view/compare-chart.js +47 -40
  180. package/es/stat-view/completeness-chart.js +37 -30
  181. package/es/stat-view/custom-bar.js +38 -31
  182. package/es/stat-view/dashboard-chart.js +22 -15
  183. package/es/stat-view/heat-map.js +50 -43
  184. package/es/stat-view/horizontal-bar-chart.js +59 -52
  185. package/es/stat-view/index.js +80 -73
  186. package/es/stat-view/line-chart.js +47 -40
  187. package/es/stat-view/map.js +40 -33
  188. package/es/stat-view/mirror.js +28 -21
  189. package/es/stat-view/pie-chart.js +36 -29
  190. package/es/stat-view/pivot-table/index.js +39 -32
  191. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +39 -31
  192. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +37 -29
  193. package/es/stat-view/pivot-table/pivot-table-display-name.js +54 -46
  194. package/es/stat-view/pivot-table/two-dimension-table.js +70 -62
  195. package/es/stat-view/ring-chart.js +46 -39
  196. package/es/stat-view/scatter-chart.js +37 -30
  197. package/es/stat-view/treemap-chart.js +45 -38
  198. package/es/stat-view/trend-chart.js +39 -32
  199. package/es/stat-view/world-map.js +40 -33
  200. package/es/tabs/index.js +40 -32
  201. package/es/tabs/tab.js +35 -27
  202. package/es/utils/basic-chart-utils.js +9 -2
  203. package/es/utils/cell-format.js +22 -14
  204. package/es/utils/cell-value.js +14 -7
  205. package/es/utils/collaborator.js +13 -4
  206. package/es/utils/color-utils.js +29 -18
  207. package/es/utils/column-utils.js +29 -18
  208. package/es/utils/column.js +11 -4
  209. package/es/utils/common-utils.js +67 -43
  210. package/es/utils/date-format.js +8 -2
  211. package/es/utils/export-table-utils.js +91 -82
  212. package/es/utils/index.js +100 -11
  213. package/es/utils/map.js +36 -26
  214. package/es/utils/model.js +14 -6
  215. package/es/utils/object.js +15 -6
  216. package/es/utils/pivot-table.js +23 -16
  217. package/es/utils/row-utils.js +34 -24
  218. package/es/utils/search.js +29 -21
  219. package/es/utils/sql-utils.js +75 -65
  220. package/es/utils/stat-utils.js +67 -60
  221. package/es/utils/trend-utils.js +40 -32
  222. package/package.json +82 -125
@@ -1,10 +1,18 @@
1
- import React, { Component } from 'react';
2
- import intl from 'react-intl-universal';
3
- import Icon from '../../../../components/icon';
4
- import StatisticTypesDialog from '../../../../components/dialog/statistic-types-dialog';
5
- import { STATISTIC_TYPE_SHOW, STAT_TYPE } from '../../../../constants';
6
- import './index.css';
7
- class TypeSettings extends Component {
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 _icon = _interopRequireDefault(require("../../../../components/icon"));
12
+ var _statisticTypesDialog = _interopRequireDefault(require("../../../../components/dialog/statistic-types-dialog"));
13
+ var _constants = require("../../../../constants");
14
+ require("./index.css");
15
+ class TypeSettings extends _react.Component {
8
16
  constructor(props) {
9
17
  super(props);
10
18
  this.openTypesDialog = () => {
@@ -22,21 +30,21 @@ class TypeSettings extends Component {
22
30
  type: chartType
23
31
  } = this.props.chart;
24
32
  switch (chartType) {
25
- case STAT_TYPE.MAP:
33
+ case _constants.STAT_TYPE.MAP:
26
34
  {
27
35
  return '中国地图';
28
36
  }
29
- case STAT_TYPE.MAP_BUBBLE:
37
+ case _constants.STAT_TYPE.MAP_BUBBLE:
30
38
  {
31
39
  return '中国地图(气泡图)';
32
40
  }
33
- case STAT_TYPE.WORLD_MAP_BUBBLE:
41
+ case _constants.STAT_TYPE.WORLD_MAP_BUBBLE:
34
42
  {
35
- return "".concat(intl.get(STATISTIC_TYPE_SHOW[STAT_TYPE.WORLD_MAP]), "(").concat(intl.get('Bubble'), ")");
43
+ return "".concat(_reactIntlUniversal.default.get(_constants.STATISTIC_TYPE_SHOW[_constants.STAT_TYPE.WORLD_MAP]), "(").concat(_reactIntlUniversal.default.get('Bubble'), ")");
36
44
  }
37
45
  default:
38
46
  {
39
- return intl.get(STATISTIC_TYPE_SHOW[chartType]);
47
+ return _reactIntlUniversal.default.get(_constants.STATISTIC_TYPE_SHOW[chartType]);
40
48
  }
41
49
  }
42
50
  };
@@ -54,21 +62,21 @@ class TypeSettings extends Component {
54
62
  const {
55
63
  type: chartType
56
64
  } = chart;
57
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
65
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
58
66
  className: "statistic-chart-parameter-item"
59
- }, /*#__PURE__*/React.createElement("label", null, intl.get('Chart_type')), /*#__PURE__*/React.createElement("div", {
67
+ }, /*#__PURE__*/_react.default.createElement("label", null, _reactIntlUniversal.default.get('Chart_type')), /*#__PURE__*/_react.default.createElement("div", {
60
68
  className: "statistic-selected-type-container d-flex align-items-center"
61
- }, /*#__PURE__*/React.createElement("span", null, this.getChartTypeName()), /*#__PURE__*/React.createElement("div", {
69
+ }, /*#__PURE__*/_react.default.createElement("span", null, this.getChartTypeName()), /*#__PURE__*/_react.default.createElement("div", {
62
70
  className: "statistic-switch-type-container",
63
71
  onClick: this.openTypesDialog
64
- }, /*#__PURE__*/React.createElement(Icon, {
72
+ }, /*#__PURE__*/_react.default.createElement(_icon.default, {
65
73
  symbol: "switch-icon",
66
74
  className: "statistic-type-switch-icon"
67
- })))), isShowDialog && /*#__PURE__*/React.createElement(StatisticTypesDialog, {
75
+ })))), isShowDialog && /*#__PURE__*/_react.default.createElement(_statisticTypesDialog.default, {
68
76
  type: chartType,
69
77
  onChange: this.props.onChange,
70
78
  onToggle: this.closeTypesDialog
71
79
  }));
72
80
  }
73
81
  }
74
- export default TypeSettings;
82
+ var _default = exports.default = TypeSettings;
@@ -1,12 +1,24 @@
1
- import React, { Component } from 'react';
2
- import ReactDOM from 'react-dom';
3
- import html2canvas from 'html2canvas';
4
- import StatView from '../stat-view';
5
- import StatisticDropdownMenu from '../components/dropdown-menu/statistic-dropdown-menu';
6
- import { STAT_TYPE } from '../constants';
7
- class ChartPreview extends Component {
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 _reactDom = _interopRequireDefault(require("react-dom"));
11
+ var _html2canvas = _interopRequireDefault(require("html2canvas"));
12
+ var _statView = _interopRequireDefault(require("../stat-view"));
13
+ var _statisticDropdownMenu = _interopRequireDefault(require("../components/dropdown-menu/statistic-dropdown-menu"));
14
+ var _constants = require("../constants");
15
+ class ChartPreview extends _react.Component {
8
16
  constructor() {
9
17
  super(...arguments);
18
+ this.onMouseDown = event => {
19
+ event.preventDefault();
20
+ event.stopPropagation();
21
+ };
10
22
  this.onToggleShowEnlarged = event => {
11
23
  if (event) {
12
24
  event.preventDefault();
@@ -30,11 +42,11 @@ class ChartPreview extends Component {
30
42
  exportContainer.setAttribute('style', "width: ".concat(containerWidth, "px; height: ").concat(containerHeight, "px;"));
31
43
  }
32
44
  document.body.appendChild(exportContainer);
33
- ReactDOM.render(this.renderChart(statItem), exportContainer);
45
+ _reactDom.default.render(this.renderChart(statItem), exportContainer);
34
46
  setTimeout(() => {
35
47
  const ele = document.querySelector("#".concat(exportContainerID, " .statistic-chart-container"));
36
48
  if (!ele) return;
37
- html2canvas(ele, {
49
+ (0, _html2canvas.default)(ele, {
38
50
  windowWidth: ele.scrollWidth,
39
51
  windowHeight: ele.scrollHeight
40
52
  }).then(canvas => {
@@ -66,7 +78,7 @@ class ChartPreview extends Component {
66
78
  colorThemeName,
67
79
  eventBus
68
80
  } = this.props;
69
- return /*#__PURE__*/React.createElement(StatView, {
81
+ return /*#__PURE__*/_react.default.createElement(_statView.default, {
70
82
  ref: ref => this.chartView = ref,
71
83
  isPreview: true,
72
84
  isEnlarge: false,
@@ -98,19 +110,20 @@ class ChartPreview extends Component {
98
110
  name: statName,
99
111
  type
100
112
  } = statItem;
101
- const showStatName = !(type === STAT_TYPE.BASIC_NUMBER_CARD || type === STAT_TYPE.DASHBOARD);
102
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
113
+ const showStatName = !(type === _constants.STAT_TYPE.BASIC_NUMBER_CARD || type === _constants.STAT_TYPE.DASHBOARD);
114
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
103
115
  className: "statistic-chart-preview-header"
104
- }, /*#__PURE__*/React.createElement("span", {
116
+ }, /*#__PURE__*/_react.default.createElement("span", {
105
117
  className: "statistic-chart-preview-name"
106
- }, showStatName ? statName : ''), /*#__PURE__*/React.createElement("span", {
118
+ }, showStatName ? statName : ''), /*#__PURE__*/_react.default.createElement("span", {
107
119
  className: "statistic-chart-preview-operations"
108
- }, /*#__PURE__*/React.createElement("span", {
120
+ }, /*#__PURE__*/_react.default.createElement("span", {
109
121
  className: "statistic-chart-preview-microscope",
122
+ onMouseDown: this.onMouseDown,
110
123
  onClick: this.onToggleShowEnlarged
111
- }, /*#__PURE__*/React.createElement("i", {
124
+ }, /*#__PURE__*/_react.default.createElement("i", {
112
125
  className: "dtable-font dtable-icon-open"
113
- })), /*#__PURE__*/React.createElement(StatisticDropdownMenu, {
126
+ })), /*#__PURE__*/_react.default.createElement(_statisticDropdownMenu.default, {
114
127
  isTableReadOnly: isTableReadOnly,
115
128
  chartType: type,
116
129
  getOtherStatistics: this.props.getOtherStatistics,
@@ -121,12 +134,12 @@ class ChartPreview extends Component {
121
134
  deleteStatItem: this.props.deleteChart.bind(this, statId),
122
135
  onNewTableDialogToggle: this.onNewTableDialogToggle,
123
136
  onUpdateTableDialogToggle: this.onUpdateTableDialogToggle
124
- }))), /*#__PURE__*/React.createElement("div", {
137
+ }))), /*#__PURE__*/_react.default.createElement("div", {
125
138
  id: "stat-item-".concat(statItem._id),
126
139
  className: "statistic-chart-preview-container"
127
- }, this.renderChart(statItem)), /*#__PURE__*/React.createElement("div", {
140
+ }, this.renderChart(statItem)), /*#__PURE__*/_react.default.createElement("div", {
128
141
  className: "statistic-chart-preview-container-resize"
129
142
  }));
130
143
  }
131
144
  }
132
- export default ChartPreview;
145
+ var _default = exports.default = ChartPreview;
@@ -1,20 +1,28 @@
1
- import React, { Component } from 'react';
2
- import GridLayout, { WidthProvider } from 'react-grid-layout';
3
- import intl from 'react-intl-universal';
4
- import ChartPreview from './chart-preview';
5
- import { NewTableDialog, toaster } from '../components';
6
- import EnlargeChartDialog from '../components/dialog/enlarged-chart-dialog';
7
- import TableSelectDialog from '../components/dialog/table-select-dialog';
8
- import { exportStatisticToTable, updateStatisticToTable } from '../utils/export-table-utils';
9
- import { CommonEventTypes, STAT_TYPE } from '../constants';
10
- const ReactGridLayout = WidthProvider(GridLayout);
11
- class StatList extends Component {
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 _reactGridLayout = _interopRequireWildcard(require("react-grid-layout"));
11
+ var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
12
+ var _chartPreview = _interopRequireDefault(require("./chart-preview"));
13
+ var _components = require("../components");
14
+ var _enlargedChartDialog = _interopRequireDefault(require("../components/dialog/enlarged-chart-dialog"));
15
+ var _tableSelectDialog = _interopRequireDefault(require("../components/dialog/table-select-dialog"));
16
+ var _exportTableUtils = require("../utils/export-table-utils");
17
+ var _constants = require("../constants");
18
+ const ReactGridLayout = (0, _reactGridLayout.WidthProvider)(_reactGridLayout.default);
19
+ class StatList extends _react.Component {
12
20
  constructor(props) {
13
21
  super(props);
14
22
  this.getStatItemsLayout = statItems => {
15
23
  return Array.isArray(statItems) ? statItems.map(chart => {
16
24
  // eslint-disable-next-line
17
- if (chart.layout.y == null) {
25
+ if (chart.layout.y === null || chart.layout.y === undefined) {
18
26
  return {
19
27
  ...chart.layout,
20
28
  y: Infinity
@@ -50,9 +58,9 @@ class StatList extends Component {
50
58
  });
51
59
  };
52
60
  this.exportChart2Table = (tableName, chart) => {
53
- if (chart.type !== STAT_TYPE.PIVOT_TABLE) {
61
+ if (chart.type !== _constants.STAT_TYPE.PIVOT_TABLE) {
54
62
  this.statisticalResult4Export = null;
55
- toaster.danger(intl.get('Failed_export_statistic_to_Table'));
63
+ _components.toaster.danger(_reactIntlUniversal.default.get('Failed_export_statistic_to_Table'));
56
64
  this.closeNewTableDialog();
57
65
  return;
58
66
  }
@@ -63,7 +71,7 @@ class StatList extends Component {
63
71
  const {
64
72
  columns,
65
73
  rows
66
- } = exportStatisticToTable({
74
+ } = (0, _exportTableUtils.exportStatisticToTable)({
67
75
  statisticalResult: this.statisticalResult4Export
68
76
  });
69
77
  if (window.app && window.app.onExportStatisticToTable) {
@@ -91,9 +99,9 @@ class StatList extends Component {
91
99
  const {
92
100
  getTableById
93
101
  } = this.props;
94
- if (chartUpdate2Table.type !== STAT_TYPE.PIVOT_TABLE) {
102
+ if (chartUpdate2Table.type !== _constants.STAT_TYPE.PIVOT_TABLE) {
95
103
  this.statisticalResult4Update = null;
96
- toaster.danger(intl.get('Failed_export_statistic_to_Table'));
104
+ _components.toaster.danger(_reactIntlUniversal.default.get('Failed_export_statistic_to_Table'));
97
105
  this.closeSelectTableDialog();
98
106
  return;
99
107
  }
@@ -107,7 +115,7 @@ class StatList extends Component {
107
115
  updatedRows,
108
116
  rowIds,
109
117
  oldRows
110
- } = updateStatisticToTable({
118
+ } = (0, _exportTableUtils.updateStatisticToTable)({
111
119
  updateTable,
112
120
  statisticalResult: this.statisticalResult4Update
113
121
  });
@@ -122,7 +130,7 @@ class StatList extends Component {
122
130
 
123
131
  // refresh charts if has updates
124
132
  if (Array.isArray(rowIds) && rowIds.length > 0 || Array.isArray(newRows) && newRows.length > 0) {
125
- this.props.eventBus.dispatch(CommonEventTypes.REFRESH_CHARTS);
133
+ this.props.eventBus.dispatch(_constants.CommonEventTypes.REFRESH_CHARTS);
126
134
  }
127
135
  }
128
136
  this.statisticalResult4Update = null;
@@ -170,9 +178,9 @@ class StatList extends Component {
170
178
  const enlargedChart = enlargedChartIndex > -1 && statItems[enlargedChartIndex];
171
179
  const chartExport2Table = chartIndexExport2Table > -1 && statItems[chartIndexExport2Table];
172
180
  const chartUpdate2Table = chartIndexUpdate2Table > -1 && statItems[chartIndexUpdate2Table];
173
- return /*#__PURE__*/React.createElement("div", {
181
+ return /*#__PURE__*/_react.default.createElement("div", {
174
182
  className: "statistic-list"
175
- }, Array.isArray(statItems) && /*#__PURE__*/React.createElement(ReactGridLayout, {
183
+ }, Array.isArray(statItems) && /*#__PURE__*/_react.default.createElement(ReactGridLayout, {
176
184
  className: "statistic-layout layout",
177
185
  isDraggable: true,
178
186
  rowHeight: 35,
@@ -186,11 +194,11 @@ class StatList extends Component {
186
194
  }, statItems.map((statItem, index) => {
187
195
  const statId = statItem._id;
188
196
  if (!statId) return null;
189
- return /*#__PURE__*/React.createElement("div", {
197
+ return /*#__PURE__*/_react.default.createElement("div", {
190
198
  id: statId,
191
199
  key: statId,
192
200
  className: "statistic-chart-preview"
193
- }, /*#__PURE__*/React.createElement(ChartPreview, {
201
+ }, /*#__PURE__*/_react.default.createElement(_chartPreview.default, {
194
202
  isTableReadOnly: isTableReadOnly,
195
203
  dtableChangedTime: dtableChangedTime,
196
204
  theme: theme,
@@ -222,7 +230,7 @@ class StatList extends Component {
222
230
  onCloseDashboard: this.props.onCloseDashboard,
223
231
  toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
224
232
  }));
225
- })), enlargedChart && /*#__PURE__*/React.createElement(EnlargeChartDialog, {
233
+ })), enlargedChart && /*#__PURE__*/_react.default.createElement(_enlargedChartDialog.default, {
226
234
  dtableChangedTime: dtableChangedTime,
227
235
  colorThemeName: colorThemeName,
228
236
  statItem: enlargedChart,
@@ -233,17 +241,17 @@ class StatList extends Component {
233
241
  onEnlargeToggle: this.closeEnlargedChart,
234
242
  onToggleShowEnlarged: this.closeEnlargedChart,
235
243
  toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
236
- }), chartExport2Table && /*#__PURE__*/React.createElement(NewTableDialog, {
244
+ }), chartExport2Table && /*#__PURE__*/_react.default.createElement(_components.NewTableDialog, {
237
245
  getTables: this.props.getTables,
238
246
  tableName: chartExport2Table.name,
239
247
  onNewTableConfirm: tableName => this.exportChart2Table(tableName, chartExport2Table),
240
248
  onNewTableCancel: this.closeNewTableDialog
241
- }), chartUpdate2Table && /*#__PURE__*/React.createElement(TableSelectDialog, {
249
+ }), chartUpdate2Table && /*#__PURE__*/_react.default.createElement(_tableSelectDialog.default, {
242
250
  tables: this.props.getTables(),
243
- title: intl.get('Update_to_a_table'),
251
+ title: _reactIntlUniversal.default.get('Update_to_a_table'),
244
252
  toggle: this.closeSelectTableDialog,
245
253
  onSelectTable: selectedTableId => this.updateChart2Table(selectedTableId, chartUpdate2Table)
246
254
  }));
247
255
  }
248
256
  }
249
- export default StatList;
257
+ var _default = exports.default = StatList;
@@ -1,23 +1,30 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import intl from 'react-intl-universal';
4
- import { TableUtils } from 'dtable-store';
5
- import BaseChart from './base-chart';
6
- import { Chart } from '../custom-g2';
7
- import { getCurrentTheme } from '../utils/common-utils';
8
- import { getChartGroups } from '../utils/basic-chart-utils';
9
- import { DEFAULT_NUMBER_FORMAT_OBJECT, EMPTY_NAME, LABEL_CONFIG_CHANGED, STATISTICS_COUNT_SHOW, SUMMARY_TYPE, TITLE_AMOUNT, TYPE_COLOR_USING } from '../constants';
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
11
+ var _dtableStore = require("dtable-store");
12
+ var _baseChart = _interopRequireDefault(require("./base-chart"));
13
+ var _customG = require("../custom-g2");
14
+ var _commonUtils = require("../utils/common-utils");
15
+ var _basicChartUtils = require("../utils/basic-chart-utils");
16
+ var _constants = require("../constants");
10
17
  const propTypes = {
11
- isPreview: PropTypes.bool,
12
- isEdit: PropTypes.bool,
13
- colorThemeName: PropTypes.string,
14
- statItem: PropTypes.object,
15
- chartCalculator: PropTypes.object,
16
- eventBus: PropTypes.object,
17
- getTableById: PropTypes.func,
18
- toggleStatisticRecordsDialog: PropTypes.func
18
+ isPreview: _propTypes.default.bool,
19
+ isEdit: _propTypes.default.bool,
20
+ colorThemeName: _propTypes.default.string,
21
+ statItem: _propTypes.default.object,
22
+ chartCalculator: _propTypes.default.object,
23
+ eventBus: _propTypes.default.object,
24
+ getTableById: _propTypes.default.func,
25
+ toggleStatisticRecordsDialog: _propTypes.default.func
19
26
  };
20
- class AreaChart extends BaseChart {
27
+ class AreaChart extends _baseChart.default {
21
28
  constructor(props) {
22
29
  super(props);
23
30
  this.drawChart = data => {
@@ -34,7 +41,7 @@ class AreaChart extends BaseChart {
34
41
  this.props.toggleStatisticRecordsDialog(data, statItem);
35
42
  }
36
43
  });
37
- const currentTheme = getCurrentTheme(colorThemeName);
44
+ const currentTheme = (0, _commonUtils.getCurrentTheme)(colorThemeName);
38
45
  let {
39
46
  table_id,
40
47
  y_axis_summary_type,
@@ -44,17 +51,17 @@ class AreaChart extends BaseChart {
44
51
  color_option
45
52
  } = statItem;
46
53
  const isGroup = column_groupby_column_key || column_groupby_multiple_numeric_column;
47
- let summaryColumnData = DEFAULT_NUMBER_FORMAT_OBJECT;
48
- if (y_axis_summary_type === SUMMARY_TYPE.ADVANCED) {
54
+ let summaryColumnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
55
+ if (y_axis_summary_type === _constants.SUMMARY_TYPE.ADVANCED) {
49
56
  const table = getTableById(table_id);
50
- const summaryColumn = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
51
- summaryColumnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
57
+ const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
58
+ summaryColumnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
52
59
  }
53
60
  let groupColorMapping = null;
54
61
  let chartBarColor = '#2a67d1';
55
62
  if (isGroup) {
56
63
  chartBarColor = currentTheme && currentTheme.colors;
57
- if (color_option === TYPE_COLOR_USING.USE_COLUMN_COLORS) {
64
+ if (color_option === _constants.TYPE_COLOR_USING.USE_COLUMN_COLORS) {
58
65
  // when the 'Group by' column is a 'single-select' column,
59
66
  // and the user chooses to use the colors from the column.
60
67
  groupColorMapping = {};
@@ -79,7 +86,7 @@ class AreaChart extends BaseChart {
79
86
  nice: false
80
87
  }
81
88
  });
82
- const chartData = isGroup ? getChartGroups(data) : data;
89
+ const chartData = isGroup ? (0, _basicChartUtils.getChartGroups)(data) : data;
83
90
  const {
84
91
  width
85
92
  } = this.chart.coordinateBBox;
@@ -140,7 +147,7 @@ class AreaChart extends BaseChart {
140
147
  config.height = 400;
141
148
  config.width = 700;
142
149
  }
143
- this.chart = new Chart(config);
150
+ this.chart = new _customG.Chart(config);
144
151
  };
145
152
  this.drawLine = _ref => {
146
153
  let {
@@ -155,7 +162,7 @@ class AreaChart extends BaseChart {
155
162
  this.chart.line().position('name*value').color(chartBarColor).tooltip('name*formatted_value', (name, value) => {
156
163
  return {
157
164
  value,
158
- name: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
165
+ name: y_axis_summary_type === _constants.SUMMARY_TYPE.COUNT ? _reactIntlUniversal.default.get(_constants.TITLE_AMOUNT) : _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[y_axis_summary_method])
159
166
  };
160
167
  });
161
168
  this.chart.point().label(display_data ? 'formatted_value' : false, {
@@ -169,8 +176,8 @@ class AreaChart extends BaseChart {
169
176
  }).tooltip('name*formatted_value', (name, value) => {
170
177
  return {
171
178
  value,
172
- name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
173
- title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
179
+ name: !name && typeof name !== 'number' ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name,
180
+ title: y_axis_summary_type === _constants.SUMMARY_TYPE.COUNT ? _reactIntlUniversal.default.get(_constants.TITLE_AMOUNT) : _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[y_axis_summary_method])
174
181
  };
175
182
  });
176
183
  };
@@ -196,8 +203,8 @@ class AreaChart extends BaseChart {
196
203
  }).position('name*value').size(3).color('group_name', chartBarColor).tooltip('name*formatted_value*group_name', (name, value, group_name) => {
197
204
  return {
198
205
  value,
199
- title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
200
- name: !group_name && typeof group_name !== 'number' ? intl.get(EMPTY_NAME) : group_name
206
+ title: !name && typeof name !== 'number' ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name,
207
+ name: !group_name && typeof group_name !== 'number' ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : group_name
201
208
  };
202
209
  }).shape('circle').style({
203
210
  lineWidth: 1,
@@ -215,8 +222,8 @@ class AreaChart extends BaseChart {
215
222
  this.chart.area().position('name*value').color(chartBarColor).tooltip('name*formatted_value', (name, value) => {
216
223
  return {
217
224
  value,
218
- name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
219
- title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
225
+ name: !name && typeof name !== 'number' ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name,
226
+ title: y_axis_summary_type === _constants.SUMMARY_TYPE.COUNT ? _reactIntlUniversal.default.get(_constants.TITLE_AMOUNT) : _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[y_axis_summary_method])
220
227
  };
221
228
  });
222
229
  };
@@ -231,8 +238,8 @@ class AreaChart extends BaseChart {
231
238
  this.chart.area().position('name*value').color('group_name', chartBarColor).tooltip('name*formatted_value', (name, value) => {
232
239
  return {
233
240
  value,
234
- name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
235
- title: y_axis_summary_type === SUMMARY_TYPE.COUNT ? intl.get(TITLE_AMOUNT) : intl.get(STATISTICS_COUNT_SHOW[y_axis_summary_method])
241
+ name: !name && typeof name !== 'number' ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name,
242
+ title: y_axis_summary_type === _constants.SUMMARY_TYPE.COUNT ? _reactIntlUniversal.default.get(_constants.TITLE_AMOUNT) : _reactIntlUniversal.default.get(_constants.STATISTICS_COUNT_SHOW[y_axis_summary_method])
236
243
  };
237
244
  });
238
245
  };
@@ -250,7 +257,7 @@ class AreaChart extends BaseChart {
250
257
  };
251
258
 
252
259
  // eslint-disable-next-line
253
- if (y_axis_auto_range == undefined || y_axis_auto_range) {
260
+ if (y_axis_auto_range === undefined || y_axis_auto_range === null || y_axis_auto_range) {
254
261
  valueScaleOptions = Object.assign(valueScaleOptions, {
255
262
  nice: true
256
263
  });
@@ -338,7 +345,7 @@ class AreaChart extends BaseChart {
338
345
  fill: themeColors.textColor
339
346
  },
340
347
  formatter: name => {
341
- return !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name;
348
+ return !name && typeof name !== 'number' ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
342
349
  }
343
350
  },
344
351
  pageNavigator: {
@@ -387,7 +394,7 @@ class AreaChart extends BaseChart {
387
394
  const div = document.createElement('div');
388
395
  div.id = xAxisID;
389
396
  div.className = 'statistic-chart-axis-label';
390
- const column = TableUtils.getTableColumnByKey(table, x_axis_column_key);
397
+ const column = _dtableStore.TableUtils.getTableColumnByKey(table, x_axis_column_key);
391
398
  div.innerHTML = "".concat(column ? column.name : '');
392
399
  div.setAttribute('style', "color:".concat(textColor, "; width: 100%; padding-left: ").concat(autoPadding.left, "px; text-align: ").concat(x_axis_label_position, "; bottom: -20px"));
393
400
  chartContainer.appendChild(div);
@@ -405,10 +412,10 @@ class AreaChart extends BaseChart {
405
412
  const div = document.createElement('div');
406
413
  div.id = yAxisID;
407
414
  div.className = 'statistic-chart-axis-label';
408
- if (y_axis_summary_type === SUMMARY_TYPE.COUNT) {
409
- div.innerHTML = intl.get(TITLE_AMOUNT);
415
+ if (y_axis_summary_type === _constants.SUMMARY_TYPE.COUNT) {
416
+ div.innerHTML = _reactIntlUniversal.default.get(_constants.TITLE_AMOUNT);
410
417
  } else {
411
- const column = TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
418
+ const column = _dtableStore.TableUtils.getTableColumnByKey(table, y_axis_column_key) || {};
412
419
  div.innerHTML = column.name || '';
413
420
  }
414
421
  const containerHeight = chartContainer.offsetHeight;
@@ -445,7 +452,7 @@ class AreaChart extends BaseChart {
445
452
  chartCalculator,
446
453
  eventBus
447
454
  } = this.props;
448
- this.unsubscribeStyleChange = eventBus.subscribe(LABEL_CONFIG_CHANGED, newStatItem => {
455
+ this.unsubscribeStyleChange = eventBus.subscribe(_constants.LABEL_CONFIG_CHANGED, newStatItem => {
449
456
  this.renderAxisLabel(newStatItem);
450
457
  });
451
458
  if (!this.container) return;
@@ -531,7 +538,7 @@ class AreaChart extends BaseChart {
531
538
  show_y_axis_label,
532
539
  show_x_axis_label
533
540
  } = statItem;
534
- return /*#__PURE__*/React.createElement(React.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/React.createElement("div", {
541
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCalculatingData && this.renderLoading(), showResultDescription && this.renderEmpty(), /*#__PURE__*/_react.default.createElement("div", {
535
542
  ref: ref => this.container = ref,
536
543
  style: {
537
544
  padding: show_y_axis_label || show_x_axis_label ? 30 : 20
@@ -541,4 +548,4 @@ class AreaChart extends BaseChart {
541
548
  }
542
549
  }
543
550
  AreaChart.propTypes = propTypes;
544
- export default AreaChart;
551
+ var _default = exports.default = AreaChart;