dtable-statistic 4.2.2 → 4.3.0
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.
- package/es/api/dtable-db-api.js +31 -37
- package/es/calculator/base-calculator.js +49 -99
- package/es/calculator/basic-chart-calculator.js +335 -559
- package/es/calculator/combination-calculator.js +231 -299
- package/es/calculator/compare-bar-calculator.js +184 -281
- package/es/calculator/completeness-calculator.js +203 -288
- package/es/calculator/copy-value.js +18 -18
- package/es/calculator/dashboard-calculator.js +68 -137
- package/es/calculator/heat-map-calculator.js +139 -220
- package/es/calculator/horizontal-bar-calculator.js +64 -93
- package/es/calculator/index.js +53 -69
- package/es/calculator/map-calculator.js +98 -174
- package/es/calculator/mirror-calculator.js +137 -216
- package/es/calculator/number-card-calculator.js +58 -126
- package/es/calculator/pivot-table-calculator.js +750 -792
- package/es/calculator/scatter-calculator.js +72 -140
- package/es/calculator/thread-manager.js +48 -67
- package/es/calculator/trend-calculator.js +107 -191
- package/es/calculator/workers/basic-chart-calculator-worker.js +194 -165
- package/es/calculator/workers/calculator.worker.js +22 -6
- package/es/calculator/workers/card-calculator-worker.js +16 -14
- package/es/calculator/workers/combination-calculator-worker.js +128 -135
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +80 -96
- package/es/calculator/workers/completeness-calculator-worker.js +56 -49
- package/es/calculator/workers/dashboard-calculator-worker.js +24 -22
- package/es/calculator/workers/mirror-calculator-worker.js +52 -52
- package/es/calculator/workers/pivot-table-calculator-worker.js +247 -230
- package/es/calculator/workers/scatter-calculator-worker.js +34 -32
- package/es/calculator/workers/trend-calculator-worker.js +33 -29
- package/es/calculator/world-map-calculator.js +120 -197
- package/es/components/common-add-tool.js +7 -5
- package/es/components/dialog/chart-addition-edit-dialog.js +67 -77
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +57 -67
- package/es/components/dialog/color-theme-dialog.js +34 -47
- package/es/components/dialog/delete-confirmation-dialog.js +7 -5
- package/es/components/dialog/enlarged-chart-dialog.js +68 -81
- package/es/components/dialog/new-table-dialog.js +62 -80
- package/es/components/dialog/new-view-dialog.js +50 -62
- package/es/components/dialog/rename-view-dialog.js +49 -58
- package/es/components/dialog/statistic-record-dialog/index.js +233 -231
- package/es/components/dialog/statistic-types-dialog/index.js +40 -49
- package/es/components/dialog/table-select-dialog.js +61 -70
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +129 -142
- package/es/components/dtable-popover.js +62 -81
- package/es/components/dtable-search-input.js +89 -99
- package/es/components/dtable-select.js +55 -74
- package/es/components/icon.js +5 -3
- package/es/components/loading.js +1 -1
- package/es/components/modal-portal.js +15 -32
- package/es/components/popover/color-rules/color-rule.js +137 -141
- package/es/components/popover/color-rules/index.js +58 -66
- package/es/components/popover/color-rules/rule-filters/filter.js +124 -124
- package/es/components/popover/color-rules/rule-filters/index.js +50 -58
- package/es/components/popover/color-rules/rule-filters/number-input.js +42 -57
- package/es/components/popover/color-rules-popover.js +117 -121
- package/es/components/popover/color-selector-popover.js +60 -70
- package/es/components/seatable-radio/index.js +2 -2
- package/es/components/select/option-group.js +139 -157
- package/es/components/select/option.js +26 -40
- package/es/components/select/select.js +97 -112
- package/es/components/toast/alert.js +65 -80
- package/es/components/toast/index.js +1 -1
- package/es/components/toast/toast.js +76 -103
- package/es/components/toast/toastManager.js +57 -93
- package/es/components/toast/toaster.js +58 -56
- package/es/constants/color-rules.js +8 -5
- package/es/constants/dtable-select-style.js +44 -48
- package/es/constants/event-types.js +4 -4
- package/es/constants/index.js +328 -242
- package/es/constants/map.js +2 -2
- package/es/constants/model.js +20 -20
- package/es/constants/regions.js +1 -1
- package/es/constants/zIndexes.js +1 -1
- package/es/custom-g2.js +11 -11
- package/es/dashboard.js +343 -333
- package/es/desktop-dashboard.js +217 -224
- package/es/index.js +45 -58
- package/es/locale/index.js +3 -3
- package/es/locale/lang/de.js +1 -1
- package/es/locale/lang/en.js +7 -7
- package/es/locale/lang/fr.js +1 -1
- package/es/locale/lang/zh_CN.js +1 -1
- package/es/mobile-dashboard.js +76 -89
- package/es/model/bar-group.js +34 -44
- package/es/model/bar.js +26 -36
- package/es/model/base-model.js +11 -12
- package/es/model/basic-number-card.js +10 -20
- package/es/model/collaborators.js +10 -11
- package/es/model/combination.js +32 -42
- package/es/model/compare-bar.js +30 -40
- package/es/model/completeness-group.js +19 -29
- package/es/model/completeness.js +14 -24
- package/es/model/custom-bar.js +14 -24
- package/es/model/dashboard.js +9 -19
- package/es/model/generic-model.js +187 -197
- package/es/model/heat-map.js +16 -26
- package/es/model/horizontal-bar-group.js +32 -42
- package/es/model/horizontal-bar.js +26 -36
- package/es/model/index.js +31 -3
- package/es/model/map.js +20 -30
- package/es/model/mirror.js +15 -25
- package/es/model/pie.js +21 -31
- package/es/model/ring.js +23 -33
- package/es/model/scatter.js +11 -21
- package/es/model/statistic-dashboard.js +7 -8
- package/es/model/table.js +19 -29
- package/es/model/trend.js +15 -25
- package/es/model/world-map.js +17 -27
- package/es/service/chart-service.js +69 -65
- package/es/service/dashboard-service.js +421 -419
- package/es/service/map-json.js +112 -132
- package/es/stat-editor/chart-name-editor.js +44 -58
- package/es/stat-editor/index.js +59 -70
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +93 -98
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +246 -248
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +127 -126
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +5 -3
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +78 -90
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +146 -150
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +88 -98
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +100 -118
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +161 -148
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +58 -66
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +58 -60
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +152 -148
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +101 -105
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +81 -91
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +110 -122
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +101 -113
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +130 -120
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +88 -102
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +88 -102
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +200 -194
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +98 -110
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +106 -118
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +212 -223
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +109 -119
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +329 -319
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +82 -90
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +58 -65
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +126 -116
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +201 -182
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +79 -79
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +196 -175
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +35 -50
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +180 -147
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +31 -40
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +56 -67
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +60 -69
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +165 -158
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +61 -74
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +199 -193
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +25 -38
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +79 -86
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +138 -120
- package/es/stat-editor/stat-settings/map/map-level.js +31 -43
- package/es/stat-editor/stat-settings/map/map-province-city.js +82 -83
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +48 -50
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +96 -96
- package/es/stat-editor/stat-settings/public-setting/calender.js +69 -75
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +5 -3
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +36 -41
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +37 -41
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +25 -38
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +40 -52
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +90 -93
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +23 -36
- package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +39 -44
- package/es/stat-list/chart-preview.js +85 -98
- package/es/stat-list/index.js +170 -178
- package/es/stat-view/area-chart.js +282 -274
- package/es/stat-view/bar-chart.js +300 -292
- package/es/stat-view/base-chart.js +58 -52
- package/es/stat-view/basic-number-card.js +115 -168
- package/es/stat-view/combination-chart.js +298 -334
- package/es/stat-view/compare-chart.js +256 -254
- package/es/stat-view/completeness-chart.js +194 -206
- package/es/stat-view/custom-bar.js +221 -223
- package/es/stat-view/dashboard-chart.js +122 -180
- package/es/stat-view/heat-map.js +268 -294
- package/es/stat-view/horizontal-bar-chart.js +291 -281
- package/es/stat-view/index.js +136 -152
- package/es/stat-view/line-chart.js +267 -265
- package/es/stat-view/map.js +246 -246
- package/es/stat-view/mirror.js +141 -152
- package/es/stat-view/pie-chart.js +143 -156
- package/es/stat-view/pivot-table/index.js +113 -118
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +104 -102
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +116 -118
- package/es/stat-view/pivot-table/pivot-table-display-name.js +96 -95
- package/es/stat-view/pivot-table/two-dimension-table.js +238 -229
- package/es/stat-view/ring-chart.js +189 -200
- package/es/stat-view/scatter-chart.js +162 -213
- package/es/stat-view/treemap-chart.js +136 -200
- package/es/stat-view/trend-chart.js +137 -183
- package/es/stat-view/world-map.js +233 -243
- package/es/tabs/index.js +164 -169
- package/es/tabs/tab.js +101 -116
- package/es/utils/basic-chart-utils.js +7 -9
- package/es/utils/cell-format.js +48 -51
- package/es/utils/cell-value.js +1 -1
- package/es/utils/collaborator.js +15 -14
- package/es/utils/color-utils.js +48 -37
- package/es/utils/column-utils.js +47 -33
- package/es/utils/column.js +1 -1
- package/es/utils/common-utils.js +111 -117
- package/es/utils/date-format.js +17 -17
- package/es/utils/export-table-utils.js +507 -396
- package/es/utils/index.js +6 -6
- package/es/utils/map.js +30 -34
- package/es/utils/model.js +3 -5
- package/es/utils/object.js +4 -4
- package/es/utils/pivot-table.js +20 -20
- package/es/utils/row-utils.js +41 -33
- package/es/utils/search.js +18 -20
- package/es/utils/sql-utils.js +132 -98
- package/es/utils/stat-utils.js +303 -320
- package/es/utils/trend-utils.js +57 -67
- 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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
17
|
+
this.onDropdownToggle = evt => {
|
|
27
18
|
evt.nativeEvent.stopImmediatePropagation();
|
|
28
|
-
|
|
29
|
-
top
|
|
30
|
-
left
|
|
31
|
-
height
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
28
|
+
left
|
|
37
29
|
}
|
|
38
30
|
});
|
|
39
31
|
};
|
|
40
|
-
|
|
32
|
+
this.onDragStart = event => {
|
|
41
33
|
event.stopPropagation();
|
|
42
|
-
|
|
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',
|
|
37
|
+
event.dataTransfer.setData('text/plain', this.props.item._id);
|
|
46
38
|
};
|
|
47
|
-
|
|
39
|
+
this.onDragEnter = event => {
|
|
48
40
|
event.stopPropagation();
|
|
49
|
-
|
|
41
|
+
this.enteredCounter++;
|
|
50
42
|
};
|
|
51
|
-
|
|
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
|
-
|
|
50
|
+
this.setState({
|
|
59
51
|
dropRelativePosition: event.nativeEvent.offsetX <= event.target.clientWidth / 2 ? 'before' : 'after'
|
|
60
52
|
});
|
|
61
53
|
};
|
|
62
|
-
|
|
54
|
+
this.onDragLeave = event => {
|
|
63
55
|
event.stopPropagation();
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
|
|
56
|
+
this.enteredCounter--;
|
|
57
|
+
if (this.enteredCounter === 0) {
|
|
58
|
+
this.setState({
|
|
67
59
|
dropRelativePosition: ''
|
|
68
60
|
});
|
|
69
61
|
}
|
|
70
62
|
};
|
|
71
|
-
|
|
63
|
+
this.onDrop = event => {
|
|
72
64
|
event.stopPropagation();
|
|
73
65
|
event.preventDefault();
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
this.enteredCounter = 0;
|
|
67
|
+
const {
|
|
68
|
+
dropRelativePosition
|
|
69
|
+
} = this.state;
|
|
70
|
+
this.setState({
|
|
77
71
|
dropRelativePosition: ''
|
|
78
72
|
});
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
80
|
+
this.props.onMoveDashboard && this.props.onMoveDashboard(draggedDashboardId, _id, dropRelativePosition);
|
|
85
81
|
};
|
|
86
|
-
|
|
82
|
+
this.state = {
|
|
87
83
|
isShowViewDropdown: false,
|
|
88
84
|
dropdownMenuPosition: {
|
|
89
85
|
top: 0,
|
|
90
86
|
left: 0
|
|
91
87
|
}
|
|
92
88
|
};
|
|
93
|
-
|
|
94
|
-
return _this;
|
|
89
|
+
this.enteredCounter = 0;
|
|
95
90
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
3
|
-
|
|
2
|
+
let labels = [];
|
|
3
|
+
let labelCount = Math.floor(containerWidth / minItemWidth);
|
|
4
4
|
labelCount = labelCount % 2 ? labelCount + 1 : labelCount;
|
|
5
|
-
|
|
5
|
+
let avg = Math.round(statistics.length / labelCount);
|
|
6
6
|
avg = avg > 2 ? avg : 2;
|
|
7
|
-
Array.isArray(statistics) && statistics.forEach(
|
|
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
|
-
|
|
16
|
-
Array.isArray(statistics) && statistics.forEach(
|
|
17
|
-
if (!chartGroups.find(
|
|
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
|
});
|
package/es/utils/cell-format.js
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
|
24
|
-
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
-
return link.display_value;
|
|
51
|
-
});
|
|
50
|
+
const displayValue = links.map(link => link.display_value);
|
|
52
51
|
return getClientFormulaDisplayString(displayValue, formulaData, {
|
|
53
|
-
tables
|
|
54
|
-
collaborators
|
|
52
|
+
tables,
|
|
53
|
+
collaborators
|
|
55
54
|
});
|
|
56
55
|
};
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
67
|
-
|
|
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
|
-
|
|
72
|
-
value.forEach(
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
84
|
+
const formulaRow = formulaRows[row._id] || {};
|
|
88
85
|
return getClientFormulaDisplayString(formulaRow[key], data, {
|
|
89
|
-
tables
|
|
90
|
-
collaborators
|
|
86
|
+
tables,
|
|
87
|
+
collaborators
|
|
91
88
|
});
|
|
92
89
|
} else if (type === CellType.LINK) {
|
|
93
|
-
|
|
94
|
-
return getClientLinkDisplayString(
|
|
95
|
-
tables
|
|
96
|
-
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
|
|
105
|
-
data
|
|
106
|
-
collaborators
|
|
107
|
-
tables
|
|
101
|
+
formulaRows,
|
|
102
|
+
data,
|
|
103
|
+
collaborators,
|
|
104
|
+
tables
|
|
108
105
|
});
|
|
109
106
|
};
|
|
110
107
|
export { getClientCellValueDisplayString, getClientFormulaDisplayString };
|
package/es/utils/cell-value.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CellType } from 'dtable-store';
|
|
2
2
|
import { isEmptyObject, isSameObject } from './object';
|
|
3
|
-
export
|
|
3
|
+
export const isCellValueChanged = (oldVal, newVal, columnType) => {
|
|
4
4
|
if (oldVal === newVal) {
|
|
5
5
|
return false;
|
|
6
6
|
}
|
package/es/utils/collaborator.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
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
|
|
6
|
-
|
|
7
|
-
mediaUrl
|
|
8
|
-
|
|
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
|
-
|
|
16
|
-
return collaborator.email === email;
|
|
17
|
-
});
|
|
16
|
+
let creator = collaborators.find(collaborator => collaborator.email === email);
|
|
18
17
|
if (creator) return creator;
|
|
19
|
-
|
|
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
|
|
31
|
+
export const generateDefaultUser = name => {
|
|
33
32
|
if (!window || window.dtable) return {};
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
let {
|
|
34
|
+
mediaUrl
|
|
35
|
+
} = window.dtable;
|
|
36
|
+
let defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
|
|
36
37
|
return {
|
|
37
|
-
name
|
|
38
|
+
name,
|
|
38
39
|
avatar_url: defaultAvatarUrl
|
|
39
40
|
};
|
|
40
41
|
};
|
package/es/utils/color-utils.js
CHANGED
|
@@ -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
|
|
4
|
+
export const getValidColorRules = colorRules => {
|
|
6
5
|
if (!Array.isArray(colorRules) || colorRules.length === 0) {
|
|
7
6
|
return [];
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
colorRules.forEach(
|
|
12
|
-
colorRule.filters.forEach(
|
|
13
|
-
|
|
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(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
33
|
+
const validFilters = getValidFilters(convertedFilters, columns);
|
|
32
34
|
if (validFilters.length === 0) {
|
|
33
35
|
return null;
|
|
34
36
|
}
|
|
35
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
...colorRule,
|
|
36
39
|
filters: validFilters
|
|
37
|
-
}
|
|
40
|
+
};
|
|
38
41
|
}).filter(Boolean);
|
|
39
42
|
};
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
return validColorRules.map(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
59
|
+
return {
|
|
60
|
+
...colorRule,
|
|
54
61
|
filters: convertedFilters
|
|
55
|
-
}
|
|
62
|
+
};
|
|
56
63
|
});
|
|
57
64
|
};
|
|
58
|
-
export
|
|
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
|
|
81
|
+
export const getLabelColorFromColorRules = (colorRules, value) => {
|
|
75
82
|
if (!colorRules) {
|
|
76
83
|
return null;
|
|
77
84
|
}
|
|
78
|
-
|
|
85
|
+
const row = {
|
|
79
86
|
'numeric_value': value
|
|
80
87
|
};
|
|
81
|
-
|
|
82
|
-
for (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
{
|