dtable-statistic 4.2.2 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/es/api/dtable-db-api.js +31 -37
  2. package/es/calculator/base-calculator.js +49 -99
  3. package/es/calculator/basic-chart-calculator.js +335 -559
  4. package/es/calculator/combination-calculator.js +231 -299
  5. package/es/calculator/compare-bar-calculator.js +184 -281
  6. package/es/calculator/completeness-calculator.js +203 -288
  7. package/es/calculator/copy-value.js +18 -18
  8. package/es/calculator/dashboard-calculator.js +68 -137
  9. package/es/calculator/heat-map-calculator.js +139 -220
  10. package/es/calculator/horizontal-bar-calculator.js +64 -93
  11. package/es/calculator/index.js +53 -69
  12. package/es/calculator/map-calculator.js +98 -174
  13. package/es/calculator/mirror-calculator.js +137 -216
  14. package/es/calculator/number-card-calculator.js +58 -126
  15. package/es/calculator/pivot-table-calculator.js +750 -792
  16. package/es/calculator/scatter-calculator.js +72 -140
  17. package/es/calculator/thread-manager.js +48 -67
  18. package/es/calculator/trend-calculator.js +107 -191
  19. package/es/calculator/workers/basic-chart-calculator-worker.js +194 -165
  20. package/es/calculator/workers/calculator.worker.js +22 -6
  21. package/es/calculator/workers/card-calculator-worker.js +16 -14
  22. package/es/calculator/workers/combination-calculator-worker.js +128 -135
  23. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +80 -96
  24. package/es/calculator/workers/completeness-calculator-worker.js +56 -49
  25. package/es/calculator/workers/dashboard-calculator-worker.js +24 -22
  26. package/es/calculator/workers/mirror-calculator-worker.js +52 -52
  27. package/es/calculator/workers/pivot-table-calculator-worker.js +247 -230
  28. package/es/calculator/workers/scatter-calculator-worker.js +34 -32
  29. package/es/calculator/workers/trend-calculator-worker.js +33 -29
  30. package/es/calculator/world-map-calculator.js +120 -197
  31. package/es/components/common-add-tool.js +7 -5
  32. package/es/components/dialog/chart-addition-edit-dialog.js +67 -77
  33. package/es/components/dialog/chart-addition-widgets/chart-selector.js +57 -67
  34. package/es/components/dialog/color-theme-dialog.js +34 -47
  35. package/es/components/dialog/delete-confirmation-dialog.js +7 -5
  36. package/es/components/dialog/enlarged-chart-dialog.js +68 -81
  37. package/es/components/dialog/new-table-dialog.js +62 -80
  38. package/es/components/dialog/new-view-dialog.js +50 -62
  39. package/es/components/dialog/rename-view-dialog.js +49 -58
  40. package/es/components/dialog/statistic-record-dialog/index.js +233 -231
  41. package/es/components/dialog/statistic-types-dialog/index.js +40 -49
  42. package/es/components/dialog/table-select-dialog.js +61 -70
  43. package/es/components/dropdown-menu/statistic-dropdown-menu.js +129 -142
  44. package/es/components/dtable-popover.js +62 -81
  45. package/es/components/dtable-search-input.js +89 -99
  46. package/es/components/dtable-select.js +55 -74
  47. package/es/components/icon.js +5 -3
  48. package/es/components/loading.js +1 -1
  49. package/es/components/modal-portal.js +15 -32
  50. package/es/components/popover/color-rules/color-rule.js +137 -141
  51. package/es/components/popover/color-rules/index.js +58 -66
  52. package/es/components/popover/color-rules/rule-filters/filter.js +124 -124
  53. package/es/components/popover/color-rules/rule-filters/index.js +50 -58
  54. package/es/components/popover/color-rules/rule-filters/number-input.js +42 -57
  55. package/es/components/popover/color-rules-popover.js +117 -121
  56. package/es/components/popover/color-selector-popover.js +60 -70
  57. package/es/components/seatable-radio/index.js +2 -2
  58. package/es/components/select/option-group.js +139 -157
  59. package/es/components/select/option.js +26 -40
  60. package/es/components/select/select.js +97 -112
  61. package/es/components/toast/alert.js +65 -80
  62. package/es/components/toast/index.js +1 -1
  63. package/es/components/toast/toast.js +76 -103
  64. package/es/components/toast/toastManager.js +57 -93
  65. package/es/components/toast/toaster.js +58 -56
  66. package/es/constants/color-rules.js +8 -5
  67. package/es/constants/dtable-select-style.js +44 -48
  68. package/es/constants/event-types.js +4 -4
  69. package/es/constants/index.js +328 -242
  70. package/es/constants/map.js +2 -2
  71. package/es/constants/model.js +20 -20
  72. package/es/constants/regions.js +1 -1
  73. package/es/constants/zIndexes.js +1 -1
  74. package/es/custom-g2.js +11 -11
  75. package/es/dashboard.js +343 -333
  76. package/es/desktop-dashboard.js +217 -224
  77. package/es/index.js +45 -58
  78. package/es/locale/index.js +3 -3
  79. package/es/locale/lang/de.js +1 -1
  80. package/es/locale/lang/en.js +7 -7
  81. package/es/locale/lang/fr.js +1 -1
  82. package/es/locale/lang/zh_CN.js +1 -1
  83. package/es/mobile-dashboard.js +76 -89
  84. package/es/model/bar-group.js +34 -44
  85. package/es/model/bar.js +26 -36
  86. package/es/model/base-model.js +11 -12
  87. package/es/model/basic-number-card.js +10 -20
  88. package/es/model/collaborators.js +10 -11
  89. package/es/model/combination.js +32 -42
  90. package/es/model/compare-bar.js +30 -40
  91. package/es/model/completeness-group.js +19 -29
  92. package/es/model/completeness.js +14 -24
  93. package/es/model/custom-bar.js +14 -24
  94. package/es/model/dashboard.js +9 -19
  95. package/es/model/generic-model.js +187 -197
  96. package/es/model/heat-map.js +16 -26
  97. package/es/model/horizontal-bar-group.js +32 -42
  98. package/es/model/horizontal-bar.js +26 -36
  99. package/es/model/index.js +31 -3
  100. package/es/model/map.js +20 -30
  101. package/es/model/mirror.js +15 -25
  102. package/es/model/pie.js +21 -31
  103. package/es/model/ring.js +23 -33
  104. package/es/model/scatter.js +11 -21
  105. package/es/model/statistic-dashboard.js +7 -8
  106. package/es/model/table.js +19 -29
  107. package/es/model/trend.js +15 -25
  108. package/es/model/world-map.js +17 -27
  109. package/es/service/chart-service.js +69 -65
  110. package/es/service/dashboard-service.js +421 -419
  111. package/es/service/map-json.js +112 -132
  112. package/es/stat-editor/chart-name-editor.js +44 -58
  113. package/es/stat-editor/index.js +59 -70
  114. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +93 -98
  115. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +246 -248
  116. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +127 -126
  117. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +5 -3
  118. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +78 -90
  119. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +146 -150
  120. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +88 -98
  121. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +100 -118
  122. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +161 -148
  123. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +58 -66
  124. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +58 -60
  125. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +152 -148
  126. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +101 -105
  127. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +81 -91
  128. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +110 -122
  129. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +101 -113
  130. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +130 -120
  131. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +88 -102
  132. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +88 -102
  133. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +200 -194
  134. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +98 -110
  135. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +106 -118
  136. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +212 -223
  137. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +109 -119
  138. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +329 -319
  139. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +82 -90
  140. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +58 -65
  141. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +126 -116
  142. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +201 -182
  143. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +79 -79
  144. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +196 -175
  145. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +35 -50
  146. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +180 -147
  147. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +31 -40
  148. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +56 -67
  149. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +60 -69
  150. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +165 -158
  151. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +61 -74
  152. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +199 -193
  153. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +25 -38
  154. package/es/stat-editor/stat-settings/color-setting/color-picker.js +79 -86
  155. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +138 -120
  156. package/es/stat-editor/stat-settings/map/map-level.js +31 -43
  157. package/es/stat-editor/stat-settings/map/map-province-city.js +82 -83
  158. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +48 -50
  159. package/es/stat-editor/stat-settings/public-setting/base-settings.js +96 -96
  160. package/es/stat-editor/stat-settings/public-setting/calender.js +69 -75
  161. package/es/stat-editor/stat-settings/public-setting/column-settings.js +5 -3
  162. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +36 -41
  163. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +37 -41
  164. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +25 -38
  165. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +40 -52
  166. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +90 -93
  167. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +23 -36
  168. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +39 -44
  169. package/es/stat-list/chart-preview.js +85 -98
  170. package/es/stat-list/index.js +170 -178
  171. package/es/stat-view/area-chart.js +282 -274
  172. package/es/stat-view/bar-chart.js +300 -292
  173. package/es/stat-view/base-chart.js +58 -52
  174. package/es/stat-view/basic-number-card.js +115 -168
  175. package/es/stat-view/combination-chart.js +298 -334
  176. package/es/stat-view/compare-chart.js +256 -254
  177. package/es/stat-view/completeness-chart.js +194 -206
  178. package/es/stat-view/custom-bar.js +221 -223
  179. package/es/stat-view/dashboard-chart.js +122 -180
  180. package/es/stat-view/heat-map.js +268 -294
  181. package/es/stat-view/horizontal-bar-chart.js +291 -281
  182. package/es/stat-view/index.js +136 -152
  183. package/es/stat-view/line-chart.js +267 -265
  184. package/es/stat-view/map.js +246 -246
  185. package/es/stat-view/mirror.js +141 -152
  186. package/es/stat-view/pie-chart.js +143 -156
  187. package/es/stat-view/pivot-table/index.js +113 -118
  188. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +104 -102
  189. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +116 -118
  190. package/es/stat-view/pivot-table/pivot-table-display-name.js +96 -95
  191. package/es/stat-view/pivot-table/two-dimension-table.js +238 -229
  192. package/es/stat-view/ring-chart.js +189 -200
  193. package/es/stat-view/scatter-chart.js +162 -213
  194. package/es/stat-view/treemap-chart.js +136 -200
  195. package/es/stat-view/trend-chart.js +137 -183
  196. package/es/stat-view/world-map.js +233 -243
  197. package/es/tabs/index.js +164 -169
  198. package/es/tabs/tab.js +101 -116
  199. package/es/utils/basic-chart-utils.js +7 -9
  200. package/es/utils/cell-format.js +48 -51
  201. package/es/utils/cell-value.js +1 -1
  202. package/es/utils/collaborator.js +15 -14
  203. package/es/utils/color-utils.js +48 -37
  204. package/es/utils/column-utils.js +47 -33
  205. package/es/utils/column.js +1 -1
  206. package/es/utils/common-utils.js +111 -117
  207. package/es/utils/date-format.js +17 -17
  208. package/es/utils/export-table-utils.js +507 -396
  209. package/es/utils/index.js +6 -6
  210. package/es/utils/map.js +30 -34
  211. package/es/utils/model.js +3 -5
  212. package/es/utils/object.js +4 -4
  213. package/es/utils/pivot-table.js +20 -20
  214. package/es/utils/row-utils.js +41 -33
  215. package/es/utils/search.js +18 -20
  216. package/es/utils/sql-utils.js +132 -98
  217. package/es/utils/stat-utils.js +303 -320
  218. package/es/utils/trend-utils.js +57 -67
  219. package/package.json +2 -2
package/es/tabs/tab.js CHANGED
@@ -1,168 +1,153 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
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
1
  import React, { Component } from 'react';
7
2
  import intl from 'react-intl-universal';
8
3
  import { ModalPortal } from '../components';
9
4
  import { isMobile } from '../utils';
10
5
  import { THEME_NAME_MAP } from '../constants';
11
6
  import styles from './statistic-tabs.module.css';
12
- var DashBoardTab = /*#__PURE__*/function (_Component) {
13
- _inherits(DashBoardTab, _Component);
14
- var _super = _createSuper(DashBoardTab);
15
- function DashBoardTab(props) {
16
- var _this;
17
- _classCallCheck(this, DashBoardTab);
18
- _this = _super.call(this, props);
19
- _this.onHideViewDropdown = function () {
20
- if (_this.state.isShowViewDropdown) {
21
- _this.setState({
7
+ class DashBoardTab extends Component {
8
+ constructor(props) {
9
+ super(props);
10
+ this.onHideViewDropdown = () => {
11
+ if (this.state.isShowViewDropdown) {
12
+ this.setState({
22
13
  isShowViewDropdown: false
23
14
  });
24
15
  }
25
16
  };
26
- _this.onDropdownToggle = function (evt) {
17
+ this.onDropdownToggle = evt => {
27
18
  evt.nativeEvent.stopImmediatePropagation();
28
- var _this$btnViewDropdown = _this.btnViewDropdown.parentNode.getBoundingClientRect(),
29
- top = _this$btnViewDropdown.top,
30
- left = _this$btnViewDropdown.left,
31
- height = _this$btnViewDropdown.height;
32
- _this.setState({
33
- isShowViewDropdown: !_this.state.isShowViewDropdown,
19
+ const {
20
+ top,
21
+ left,
22
+ height
23
+ } = this.btnViewDropdown.parentNode.getBoundingClientRect();
24
+ this.setState({
25
+ isShowViewDropdown: !this.state.isShowViewDropdown,
34
26
  dropdownMenuPosition: {
35
27
  top: top + height - 3,
36
- left: left
28
+ left
37
29
  }
38
30
  });
39
31
  };
40
- _this.onDragStart = function (event) {
32
+ this.onDragStart = event => {
41
33
  event.stopPropagation();
42
- var ref = _this.itemRef;
34
+ const ref = this.itemRef;
43
35
  event.dataTransfer.setDragImage(ref, 10, 10);
44
36
  event.dataTransfer.effectAllowed = 'move';
45
- event.dataTransfer.setData('text/plain', _this.props.item._id);
37
+ event.dataTransfer.setData('text/plain', this.props.item._id);
46
38
  };
47
- _this.onDragEnter = function (event) {
39
+ this.onDragEnter = event => {
48
40
  event.stopPropagation();
49
- _this.enteredCounter++;
41
+ this.enteredCounter++;
50
42
  };
51
- _this.onDragOver = function (event) {
43
+ this.onDragOver = event => {
52
44
  if (event.dataTransfer.dropEffect === 'copy') {
53
45
  return;
54
46
  }
55
47
  event.stopPropagation();
56
48
  event.preventDefault();
57
49
  event.dataTransfer.dropEffect = 'move';
58
- _this.setState({
50
+ this.setState({
59
51
  dropRelativePosition: event.nativeEvent.offsetX <= event.target.clientWidth / 2 ? 'before' : 'after'
60
52
  });
61
53
  };
62
- _this.onDragLeave = function (event) {
54
+ this.onDragLeave = event => {
63
55
  event.stopPropagation();
64
- _this.enteredCounter--;
65
- if (_this.enteredCounter === 0) {
66
- _this.setState({
56
+ this.enteredCounter--;
57
+ if (this.enteredCounter === 0) {
58
+ this.setState({
67
59
  dropRelativePosition: ''
68
60
  });
69
61
  }
70
62
  };
71
- _this.onDrop = function (event) {
63
+ this.onDrop = event => {
72
64
  event.stopPropagation();
73
65
  event.preventDefault();
74
- _this.enteredCounter = 0;
75
- var dropRelativePosition = _this.state.dropRelativePosition;
76
- _this.setState({
66
+ this.enteredCounter = 0;
67
+ const {
68
+ dropRelativePosition
69
+ } = this.state;
70
+ this.setState({
77
71
  dropRelativePosition: ''
78
72
  });
79
- var draggedDashboardId = event.dataTransfer.getData('text/plain');
80
- var _id = _this.props.item._id;
73
+ const draggedDashboardId = event.dataTransfer.getData('text/plain');
74
+ const {
75
+ _id
76
+ } = this.props.item;
81
77
  if (draggedDashboardId == _id) {
82
78
  return;
83
79
  }
84
- _this.props.onMoveDashboard && _this.props.onMoveDashboard(draggedDashboardId, _id, dropRelativePosition);
80
+ this.props.onMoveDashboard && this.props.onMoveDashboard(draggedDashboardId, _id, dropRelativePosition);
85
81
  };
86
- _this.state = {
82
+ this.state = {
87
83
  isShowViewDropdown: false,
88
84
  dropdownMenuPosition: {
89
85
  top: 0,
90
86
  left: 0
91
87
  }
92
88
  };
93
- _this.enteredCounter = 0;
94
- return _this;
89
+ this.enteredCounter = 0;
95
90
  }
96
- _createClass(DashBoardTab, [{
97
- key: "componentDidMount",
98
- value: function componentDidMount() {
99
- document.addEventListener('click', this.onHideViewDropdown);
100
- }
101
- }, {
102
- key: "componentWillUnmount",
103
- value: function componentWillUnmount() {
104
- document.removeEventListener('click', this.onHideViewDropdown);
105
- }
106
- }, {
107
- key: "render",
108
- value: function render() {
109
- var _this2 = this;
110
- var _this$props = this.props,
111
- selected = _this$props.selected,
112
- theme = _this$props.theme,
113
- item = _this$props.item,
114
- canDelete = _this$props.canDelete;
115
- var _this$state = this.state,
116
- isShowViewDropdown = _this$state.isShowViewDropdown,
117
- dropdownMenuPosition = _this$state.dropdownMenuPosition,
118
- dropRelativePosition = _this$state.dropRelativePosition;
119
- return /*#__PURE__*/React.createElement("div", {
120
- ref: function ref(_ref2) {
121
- return _this2.itemRef = _ref2;
122
- },
123
- draggable: "true",
124
- onDragStart: this.onDragStart,
125
- onDragEnter: this.onDragEnter,
126
- onDragOver: this.onDragOver,
127
- onDragLeave: this.onDragLeave,
128
- onDrop: this.onDrop,
129
- className: "\n ".concat(styles['dashboard-tab'], "\n ").concat(dropRelativePosition == 'before' ? styles['dashboard-tab-can-drop-before'] : '', "\n ").concat(dropRelativePosition == 'after' ? styles['dashboard-tab-can-drop-after'] : '', "\n ")
130
- }, /*#__PURE__*/React.createElement("div", {
131
- ref: this.props.setViewItem,
132
- onClick: this.props.onSelectDashboard,
133
- className: "".concat(styles['dashboard-tab-content'], " ").concat(selected ? isMobile ? styles['tab-item-active-mobile'] : styles['tab-item-active'] : '')
134
- }, /*#__PURE__*/React.createElement("div", {
135
- className: "view-name"
136
- }, item.name), selected && !isMobile && /*#__PURE__*/React.createElement("div", {
137
- onClick: this.onDropdownToggle,
138
- ref: function ref(_ref) {
139
- return _this2.btnViewDropdown = _ref;
140
- },
141
- className: "".concat(styles['btn-view-dropdown'])
142
- }, /*#__PURE__*/React.createElement("i", {
143
- className: "".concat(styles['icon'], " dtable-font dtable-icon-drop-down")
144
- }), isShowViewDropdown && /*#__PURE__*/React.createElement(ModalPortal, null, /*#__PURE__*/React.createElement("div", {
145
- className: "".concat(theme === THEME_NAME_MAP.DARK ? 'statistic-tabs-dropdown-dark' : 'statistic-tabs-dropdown-light', " statistic-dropdown-menu dropdown-menu large show"),
146
- style: _objectSpread(_objectSpread({}, dropdownMenuPosition), {}, {
147
- zIndex: 1500
148
- })
149
- }, /*#__PURE__*/React.createElement("button", {
150
- className: "dropdown-item",
151
- onClick: this.props.onToggleRenameView
152
- }, /*#__PURE__*/React.createElement("i", {
153
- className: "item-icon dtable-font dtable-icon-rename"
154
- }), /*#__PURE__*/React.createElement("span", {
155
- className: "item-text"
156
- }, intl.get('Rename'))), canDelete && /*#__PURE__*/React.createElement("button", {
157
- className: "dropdown-item",
158
- onClick: this.props.onDeleteDashboard
159
- }, /*#__PURE__*/React.createElement("i", {
160
- className: "item-icon dtable-font dtable-icon-delete"
161
- }), /*#__PURE__*/React.createElement("span", {
162
- className: "item-text"
163
- }, intl.get('Delete'))))))));
164
- }
165
- }]);
166
- return DashBoardTab;
167
- }(Component);
91
+ componentDidMount() {
92
+ document.addEventListener('click', this.onHideViewDropdown);
93
+ }
94
+ componentWillUnmount() {
95
+ document.removeEventListener('click', this.onHideViewDropdown);
96
+ }
97
+ render() {
98
+ const {
99
+ selected,
100
+ theme,
101
+ item,
102
+ canDelete
103
+ } = this.props;
104
+ const {
105
+ isShowViewDropdown,
106
+ dropdownMenuPosition,
107
+ dropRelativePosition
108
+ } = this.state;
109
+ return /*#__PURE__*/React.createElement("div", {
110
+ ref: ref => this.itemRef = ref,
111
+ draggable: "true",
112
+ onDragStart: this.onDragStart,
113
+ onDragEnter: this.onDragEnter,
114
+ onDragOver: this.onDragOver,
115
+ onDragLeave: this.onDragLeave,
116
+ onDrop: this.onDrop,
117
+ className: "\n ".concat(styles['dashboard-tab'], "\n ").concat(dropRelativePosition == 'before' ? styles['dashboard-tab-can-drop-before'] : '', "\n ").concat(dropRelativePosition == 'after' ? styles['dashboard-tab-can-drop-after'] : '', "\n ")
118
+ }, /*#__PURE__*/React.createElement("div", {
119
+ ref: this.props.setViewItem,
120
+ onClick: this.props.onSelectDashboard,
121
+ className: "".concat(styles['dashboard-tab-content'], " ").concat(selected ? isMobile ? styles['tab-item-active-mobile'] : styles['tab-item-active'] : '')
122
+ }, /*#__PURE__*/React.createElement("div", {
123
+ className: "view-name"
124
+ }, item.name), selected && !isMobile && /*#__PURE__*/React.createElement("div", {
125
+ onClick: this.onDropdownToggle,
126
+ ref: ref => this.btnViewDropdown = ref,
127
+ className: "".concat(styles['btn-view-dropdown'])
128
+ }, /*#__PURE__*/React.createElement("i", {
129
+ className: "".concat(styles['icon'], " dtable-font dtable-icon-drop-down")
130
+ }), isShowViewDropdown && /*#__PURE__*/React.createElement(ModalPortal, null, /*#__PURE__*/React.createElement("div", {
131
+ className: "".concat(theme === THEME_NAME_MAP.DARK ? 'statistic-tabs-dropdown-dark' : 'statistic-tabs-dropdown-light', " statistic-dropdown-menu dropdown-menu large show"),
132
+ style: {
133
+ ...dropdownMenuPosition,
134
+ zIndex: 1500
135
+ }
136
+ }, /*#__PURE__*/React.createElement("button", {
137
+ className: "dropdown-item",
138
+ onClick: this.props.onToggleRenameView
139
+ }, /*#__PURE__*/React.createElement("i", {
140
+ className: "item-icon dtable-font dtable-icon-rename"
141
+ }), /*#__PURE__*/React.createElement("span", {
142
+ className: "item-text"
143
+ }, intl.get('Rename'))), canDelete && /*#__PURE__*/React.createElement("button", {
144
+ className: "dropdown-item",
145
+ onClick: this.props.onDeleteDashboard
146
+ }, /*#__PURE__*/React.createElement("i", {
147
+ className: "item-icon dtable-font dtable-icon-delete"
148
+ }), /*#__PURE__*/React.createElement("span", {
149
+ className: "item-text"
150
+ }, intl.get('Delete'))))))));
151
+ }
152
+ }
168
153
  export default DashBoardTab;
@@ -1,10 +1,10 @@
1
1
  export function getChartDisplayLabels(containerWidth, minItemWidth, statistics) {
2
- var labels = [];
3
- var labelCount = Math.floor(containerWidth / minItemWidth);
2
+ let labels = [];
3
+ let labelCount = Math.floor(containerWidth / minItemWidth);
4
4
  labelCount = labelCount % 2 ? labelCount + 1 : labelCount;
5
- var avg = Math.round(statistics.length / labelCount);
5
+ let avg = Math.round(statistics.length / labelCount);
6
6
  avg = avg > 2 ? avg : 2;
7
- Array.isArray(statistics) && statistics.forEach(function (v, i) {
7
+ Array.isArray(statistics) && statistics.forEach((v, i) => {
8
8
  if (i % avg === 0) {
9
9
  labels.push(v.name);
10
10
  }
@@ -12,11 +12,9 @@ export function getChartDisplayLabels(containerWidth, minItemWidth, statistics)
12
12
  return labels;
13
13
  }
14
14
  export function getChartGroups(statistics) {
15
- var chartGroups = [];
16
- Array.isArray(statistics) && statistics.forEach(function (item) {
17
- if (!chartGroups.find(function (g) {
18
- return g.name === item.name;
19
- })) {
15
+ let chartGroups = [];
16
+ Array.isArray(statistics) && statistics.forEach(item => {
17
+ if (!chartGroups.find(g => g.name === item.name)) {
20
18
  chartGroups.push(item);
21
19
  }
22
20
  });
@@ -1,27 +1,27 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import dayjs from 'dayjs';
3
2
  import { getCollaboratorsName, getCellValueDisplayString, getFormulaDisplayString, CellType, FORMULA_COLUMN_TYPES, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES } from 'dtable-store';
4
- var getClientFormulaDisplayString = function getClientFormulaDisplayString(value, columnData) {
5
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
6
- _ref$tables = _ref.tables,
7
- tables = _ref$tables === void 0 ? [] : _ref$tables,
8
- _ref$collaborators = _ref.collaborators,
9
- collaborators = _ref$collaborators === void 0 ? [] : _ref$collaborators;
3
+ const getClientFormulaDisplayString = function (value, columnData) {
4
+ let {
5
+ tables = [],
6
+ collaborators = []
7
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10
8
  if (!columnData || !value && value !== 0) return '';
11
- var result_type = columnData.result_type,
12
- array_type = columnData.array_type;
9
+ const {
10
+ result_type,
11
+ array_type
12
+ } = columnData;
13
13
  if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
14
14
  if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
15
15
  if (!value) {
16
16
  return null;
17
17
  }
18
- var collaboratorList = Array.isArray(value) ? value : [value];
18
+ const collaboratorList = Array.isArray(value) ? value : [value];
19
19
  return getCollaboratorsName(collaborators, collaboratorList);
20
20
  }
21
21
  }
22
22
  return getFormulaDisplayString(value, columnData, {
23
- tables: tables,
24
- collaborators: collaborators
23
+ tables,
24
+ collaborators
25
25
  });
26
26
  };
27
27
 
@@ -33,67 +33,64 @@ var getClientFormulaDisplayString = function getClientFormulaDisplayString(value
33
33
  * }
34
34
  * ]
35
35
  */
36
- var getClientLinkDisplayString = function getClientLinkDisplayString(links, columnData) {
37
- var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
38
- _ref2$tables = _ref2.tables,
39
- tables = _ref2$tables === void 0 ? [] : _ref2$tables,
40
- _ref2$collaborators = _ref2.collaborators,
41
- collaborators = _ref2$collaborators === void 0 ? [] : _ref2$collaborators;
36
+ const getClientLinkDisplayString = function (links, columnData) {
37
+ let {
38
+ tables = [],
39
+ collaborators = []
40
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
42
41
  if (!columnData || !Array.isArray(links) || links.length === 0) {
43
42
  return null;
44
43
  }
45
- var formulaData = _objectSpread({}, columnData);
44
+ let formulaData = {
45
+ ...columnData
46
+ };
46
47
  if (!columnData.hasOwnProperty('result_type')) {
47
48
  formulaData.result_type = FORMULA_RESULT_TYPE.ARRAY;
48
49
  }
49
- var displayValue = links.map(function (link) {
50
- return link.display_value;
51
- });
50
+ const displayValue = links.map(link => link.display_value);
52
51
  return getClientFormulaDisplayString(displayValue, formulaData, {
53
- tables: tables,
54
- collaborators: collaborators
52
+ tables,
53
+ collaborators
55
54
  });
56
55
  };
57
- var getAutoTimeDisplayString = function getAutoTimeDisplayString(row, key) {
58
- var value = row[key];
56
+ const getAutoTimeDisplayString = (row, key) => {
57
+ let value = row[key];
59
58
  if (value === '' || !value || typeof value !== 'string') {
60
59
  return null;
61
60
  }
62
- var date = dayjs(value);
61
+ const date = dayjs(value);
63
62
  if (!date.isValid()) return value;
64
63
  return date.format('YYYY-MM-DD HH:mm:ss');
65
64
  };
66
- var getFileDisplayString = function getFileDisplayString(row, key) {
67
- var value = row[key];
65
+ const getFileDisplayString = (row, key) => {
66
+ let value = row[key];
68
67
  if (!value || !Array.isArray(value) || value.length === 0) {
69
68
  return null;
70
69
  }
71
- var fileNameList = [];
72
- value.forEach(function (v) {
70
+ let fileNameList = [];
71
+ value.forEach(v => {
73
72
  fileNameList.push(v.url.split('/').slice(-3).join('/').trim());
74
73
  });
75
74
  return decodeURIComponent(fileNameList.join(','));
76
75
  };
77
- var getClientCellValueDisplayString = function getClientCellValueDisplayString(row, type, key) {
78
- var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
79
- _ref3$formulaRows = _ref3.formulaRows,
80
- formulaRows = _ref3$formulaRows === void 0 ? {} : _ref3$formulaRows,
81
- data = _ref3.data,
82
- _ref3$collaborators = _ref3.collaborators,
83
- collaborators = _ref3$collaborators === void 0 ? [] : _ref3$collaborators,
84
- _ref3$tables = _ref3.tables,
85
- tables = _ref3$tables === void 0 ? [] : _ref3$tables;
76
+ const getClientCellValueDisplayString = function (row, type, key) {
77
+ let {
78
+ formulaRows = {},
79
+ data,
80
+ collaborators = [],
81
+ tables = []
82
+ } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
86
83
  if (FORMULA_COLUMN_TYPES.includes(type)) {
87
- var formulaRow = formulaRows[row._id] || {};
84
+ const formulaRow = formulaRows[row._id] || {};
88
85
  return getClientFormulaDisplayString(formulaRow[key], data, {
89
- tables: tables,
90
- collaborators: collaborators
86
+ tables,
87
+ collaborators
91
88
  });
92
89
  } else if (type === CellType.LINK) {
93
- var _formulaRow = formulaRows[row._id] || {};
94
- return getClientLinkDisplayString(_formulaRow[key], data, {
95
- tables: tables,
96
- collaborators: collaborators
90
+ const formulaRow = formulaRows[row._id] || {};
91
+ return getClientLinkDisplayString(formulaRow[key], data, {
92
+ tables,
93
+ collaborators
97
94
  });
98
95
  } else if (type === CellType.CTIME || type === CellType.MTIME) {
99
96
  return getAutoTimeDisplayString(row, key);
@@ -101,10 +98,10 @@ var getClientCellValueDisplayString = function getClientCellValueDisplayString(r
101
98
  return getFileDisplayString(row, key);
102
99
  }
103
100
  return getCellValueDisplayString(row, type, key, {
104
- formulaRows: formulaRows,
105
- data: data,
106
- collaborators: collaborators,
107
- tables: tables
101
+ formulaRows,
102
+ data,
103
+ collaborators,
104
+ tables
108
105
  });
109
106
  };
110
107
  export { getClientCellValueDisplayString, getClientFormulaDisplayString };
@@ -1,6 +1,6 @@
1
1
  import { CellType } from 'dtable-store';
2
2
  import { isEmptyObject, isSameObject } from './object';
3
- export var isCellValueChanged = function isCellValueChanged(oldVal, newVal, columnType) {
3
+ export const isCellValueChanged = (oldVal, newVal, columnType) => {
4
4
  if (oldVal === newVal) {
5
5
  return false;
6
6
  }
@@ -1,22 +1,21 @@
1
- export var isValidCollaboratorEmail = function isValidCollaboratorEmail(email) {
2
- var reg = /^[A-Za-z0-9]+([-_.][A-Za-z0-9]+)*@([A-Za-z0-9]+[-.])+[A-Za-z0-9]{2,6}$/;
1
+ export const isValidCollaboratorEmail = email => {
2
+ const reg = /^[A-Za-z0-9]+([-_.][A-Za-z0-9]+)*@([A-Za-z0-9]+[-.])+[A-Za-z0-9]{2,6}$/;
3
3
  return reg.test(email);
4
4
  };
5
- export var getKnownCreatorByEmail = function getKnownCreatorByEmail(collaborators, email) {
6
- var _ref = window.dtable || {},
7
- mediaUrl = _ref.mediaUrl;
8
- var defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
5
+ export const getKnownCreatorByEmail = (collaborators, email) => {
6
+ let {
7
+ mediaUrl
8
+ } = window.dtable || {};
9
+ let defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
9
10
  if (email === 'anonymous' || email === 'Automation Rule') {
10
11
  return {
11
12
  name: email,
12
13
  avatar_url: defaultAvatarUrl
13
14
  };
14
15
  }
15
- var creator = collaborators.find(function (collaborator) {
16
- return collaborator.email === email;
17
- });
16
+ let creator = collaborators.find(collaborator => collaborator.email === email);
18
17
  if (creator) return creator;
19
- var dtableCollaborators = window.app && window.app.collaboratorsCache ? window.app.collaboratorsCache : {};
18
+ let dtableCollaborators = window.app && window.app.collaboratorsCache ? window.app.collaboratorsCache : {};
20
19
  if (!isValidCollaboratorEmail(email)) {
21
20
  creator = {
22
21
  name: email,
@@ -29,12 +28,14 @@ export var getKnownCreatorByEmail = function getKnownCreatorByEmail(collaborator
29
28
  if (creator) return creator;
30
29
  return null;
31
30
  };
32
- export var generateDefaultUser = function generateDefaultUser(name) {
31
+ export const generateDefaultUser = name => {
33
32
  if (!window || window.dtable) return {};
34
- var mediaUrl = window.dtable.mediaUrl;
35
- var defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
33
+ let {
34
+ mediaUrl
35
+ } = window.dtable;
36
+ let defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
36
37
  return {
37
- name: name,
38
+ name,
38
39
  avatar_url: defaultAvatarUrl
39
40
  };
40
41
  };
@@ -1,16 +1,15 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import { filterRow, getValidFilters } from 'dtable-store';
3
2
  import { STAT_TYPE, TYPE_COLOR_USING } from '../constants';
4
3
  import { COLOR_RULE_FILTER_TYPE_MAP, FILTER_TYPE_2_CELL_TYPE } from '../constants/color-rules';
5
- export var getValidColorRules = function getValidColorRules(colorRules) {
4
+ export const getValidColorRules = colorRules => {
6
5
  if (!Array.isArray(colorRules) || colorRules.length === 0) {
7
6
  return [];
8
7
  }
9
- var columns = [];
10
- var keyExistColumnMap = {};
11
- colorRules.forEach(function (colorRule) {
12
- colorRule.filters.forEach(function (filter) {
13
- var filterType = filter.filter_type;
8
+ const columns = [];
9
+ const keyExistColumnMap = {};
10
+ colorRules.forEach(colorRule => {
11
+ colorRule.filters.forEach(filter => {
12
+ const filterType = filter.filter_type;
14
13
  if (keyExistColumnMap[filterType]) {
15
14
  return;
16
15
  }
@@ -21,41 +20,49 @@ export var getValidColorRules = function getValidColorRules(colorRules) {
21
20
  keyExistColumnMap[filterType] = true;
22
21
  });
23
22
  });
24
- return colorRules.map(function (colorRule) {
25
- var filters = colorRule.filters;
26
- var convertedFilters = filters.map(function (filter) {
27
- return _objectSpread(_objectSpread({}, filter), {}, {
23
+ return colorRules.map(colorRule => {
24
+ const {
25
+ filters
26
+ } = colorRule;
27
+ const convertedFilters = filters.map(filter => {
28
+ return {
29
+ ...filter,
28
30
  column_key: filter.filter_type
29
- });
31
+ };
30
32
  });
31
- var validFilters = getValidFilters(convertedFilters, columns);
33
+ const validFilters = getValidFilters(convertedFilters, columns);
32
34
  if (validFilters.length === 0) {
33
35
  return null;
34
36
  }
35
- return _objectSpread(_objectSpread({}, colorRule), {}, {
37
+ return {
38
+ ...colorRule,
36
39
  filters: validFilters
37
- });
40
+ };
38
41
  }).filter(Boolean);
39
42
  };
40
- export var getConvertedColorRules = function getConvertedColorRules(colorRules) {
41
- var validColorRules = getValidColorRules(colorRules);
42
- return validColorRules.map(function (colorRule) {
43
- var convertedFilters = colorRule.filters.map(function (filter) {
44
- var filter_type = filter.filter_type;
45
- return _objectSpread(_objectSpread({}, filter), {}, {
43
+ export const getConvertedColorRules = colorRules => {
44
+ const validColorRules = getValidColorRules(colorRules);
45
+ return validColorRules.map(colorRule => {
46
+ const convertedFilters = colorRule.filters.map(filter => {
47
+ const {
48
+ filter_type
49
+ } = filter;
50
+ return {
51
+ ...filter,
46
52
  column_key: filter_type,
47
53
  column: {
48
54
  key: filter_type,
49
55
  type: FILTER_TYPE_2_CELL_TYPE[filter_type]
50
56
  }
51
- });
57
+ };
52
58
  });
53
- return _objectSpread(_objectSpread({}, colorRule), {}, {
59
+ return {
60
+ ...colorRule,
54
61
  filters: convertedFilters
55
- });
62
+ };
56
63
  });
57
64
  };
58
- export var getLabelColorFromSpecificColor = function getLabelColorFromSpecificColor(chart) {
65
+ export const getLabelColorFromSpecificColor = chart => {
59
66
  switch (chart.type) {
60
67
  case STAT_TYPE.BAR:
61
68
  {
@@ -71,19 +78,21 @@ export var getLabelColorFromSpecificColor = function getLabelColorFromSpecificCo
71
78
  }
72
79
  }
73
80
  };
74
- export var getLabelColorFromColorRules = function getLabelColorFromColorRules(colorRules, value) {
81
+ export const getLabelColorFromColorRules = (colorRules, value) => {
75
82
  if (!colorRules) {
76
83
  return null;
77
84
  }
78
- var row = {
85
+ const row = {
79
86
  'numeric_value': value
80
87
  };
81
- var matchedRuleColor = null;
82
- for (var i = 0, colorRulesLen = colorRules.length; i < colorRulesLen; i++) {
83
- var colorRule = colorRules[i];
84
- var color = colorRule.color,
85
- filter_conjunction = colorRule.filter_conjunction,
86
- filters = colorRule.filters;
88
+ let matchedRuleColor = null;
89
+ for (let i = 0, colorRulesLen = colorRules.length; i < colorRulesLen; i++) {
90
+ const colorRule = colorRules[i];
91
+ const {
92
+ color,
93
+ filter_conjunction,
94
+ filters
95
+ } = colorRule;
87
96
  if (filterRow(row, filter_conjunction, filters)) {
88
97
  matchedRuleColor = color;
89
98
  break;
@@ -91,10 +100,12 @@ export var getLabelColorFromColorRules = function getLabelColorFromColorRules(co
91
100
  }
92
101
  return matchedRuleColor;
93
102
  };
94
- export var getLabelColor = function getLabelColor(_ref) {
95
- var chart = _ref.chart,
96
- colorRules = _ref.colorRules,
97
- value = _ref.value;
103
+ export const getLabelColor = _ref => {
104
+ let {
105
+ chart,
106
+ colorRules,
107
+ value
108
+ } = _ref;
98
109
  switch (chart.color_option) {
99
110
  case TYPE_COLOR_USING.USE_SPECIFIC_COLORS:
100
111
  {