dtable-statistic 5.0.8-alpha.7 → 5.0.9-alpha.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/components/dialog/enlarged-chart-dialog.js +1 -3
- package/es/constants/index.js +1 -32
- package/es/desktop-dashboard.js +3 -39
- package/es/stat-list/chart-preview.js +2 -4
- package/es/stat-list/index.js +2 -4
- package/package.json +3 -3
- package/es/components/dialog/statistic-record-dialog/index.css +0 -120
- package/es/components/dialog/statistic-record-dialog/index.js +0 -344
|
@@ -27,7 +27,6 @@ class EnlargeChartDialog extends _react.Component {
|
|
|
27
27
|
colorThemeName,
|
|
28
28
|
statItem,
|
|
29
29
|
getTableById,
|
|
30
|
-
toggleStatisticRecordsDialog,
|
|
31
30
|
api,
|
|
32
31
|
value
|
|
33
32
|
} = this.props;
|
|
@@ -36,8 +35,7 @@ class EnlargeChartDialog extends _react.Component {
|
|
|
36
35
|
statItem,
|
|
37
36
|
api,
|
|
38
37
|
value,
|
|
39
|
-
getTableById
|
|
40
|
-
toggleStatisticRecordsDialog
|
|
38
|
+
getTableById
|
|
41
39
|
};
|
|
42
40
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
41
|
className: "view-wrapper",
|
package/es/constants/index.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "KeyCodes", {
|
|
|
12
12
|
return _keyCodes.default;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
exports.THEME_NAME_MAP = exports.SUMMARY_TYPE = exports.SUMMARY_METHOD_MAP = exports.SUMMARY_METHOD = exports.
|
|
15
|
+
exports.THEME_NAME_MAP = exports.SUMMARY_TYPE = exports.SUMMARY_METHOD_MAP = exports.SUMMARY_METHOD = exports.STATISTICS_COUNT_TYPE = void 0;
|
|
16
16
|
var _keyCodes = _interopRequireDefault(require("./key-codes"));
|
|
17
17
|
var CommonEventTypes = _interopRequireWildcard(require("./event-types"));
|
|
18
18
|
exports.CommonEventTypes = CommonEventTypes;
|
|
@@ -29,37 +29,6 @@ const DASHBOARD_ACTION_TYPE = exports.DASHBOARD_ACTION_TYPE = {
|
|
|
29
29
|
MOVE_CHART_TO_VIEW: 'move_chart_to_view',
|
|
30
30
|
DELETE_CHART: 'delete_chart'
|
|
31
31
|
};
|
|
32
|
-
const STAT_TYPE = exports.STAT_TYPE = {
|
|
33
|
-
MAP: 'map',
|
|
34
|
-
MAP_BUBBLE: 'map_bubble',
|
|
35
|
-
HEAT_MAP: 'heat_map',
|
|
36
|
-
WORLD_MAP: 'world_map',
|
|
37
|
-
WORLD_MAP_BUBBLE: 'world_map_bubble',
|
|
38
|
-
MIRROR: 'mirror',
|
|
39
|
-
BAR: 'chart_bar',
|
|
40
|
-
BAR_GROUP: 'chart_bar_group',
|
|
41
|
-
BAR_STACK: 'chart_bar_stack',
|
|
42
|
-
LINE: 'chart_line',
|
|
43
|
-
GROUP_LINE: 'chart_group_line',
|
|
44
|
-
PIE: 'chart_pie',
|
|
45
|
-
RING: 'chart_ring',
|
|
46
|
-
SCATTER: 'scatter_chart',
|
|
47
|
-
BASIC_NUMBER_CARD: 'basic_number_card',
|
|
48
|
-
HORIZONTAL_BAR: 'horizontal_bar',
|
|
49
|
-
HORIZONTAL_GROUP_BAR: 'horizontal_group_bar',
|
|
50
|
-
STACKED_HORIZONTAL_BAR: 'stacked_horizontal_bar',
|
|
51
|
-
COMBINATION_CHART: 'combination_chart',
|
|
52
|
-
TREND_CHART: 'trend_chart',
|
|
53
|
-
AREA_CHART: 'area_chart',
|
|
54
|
-
AREA_GROUP_CHART: 'area_group_chart',
|
|
55
|
-
COMPARE_BAR: 'compare_bar',
|
|
56
|
-
COMPLETENESS_CHART: 'completeness_chart',
|
|
57
|
-
DASHBOARD: 'dashboard',
|
|
58
|
-
GROUP_COMPLETENESS_CHART: 'group_completeness_chart',
|
|
59
|
-
TREEMAP: 'treemap',
|
|
60
|
-
PIVOT_TABLE: 'pivot_table',
|
|
61
|
-
CUSTOM_BAR: 'custom_bar'
|
|
62
|
-
};
|
|
63
32
|
const SUMMARY_TYPE = exports.SUMMARY_TYPE = {
|
|
64
33
|
COUNT: 'count',
|
|
65
34
|
ADVANCED: 'advanced'
|
package/es/desktop-dashboard.js
CHANGED
|
@@ -15,7 +15,6 @@ var _tabs = _interopRequireDefault(require("./tabs"));
|
|
|
15
15
|
var _statList = _interopRequireDefault(require("./stat-list"));
|
|
16
16
|
var _colorThemeDialog = _interopRequireDefault(require("./components/dialog/color-theme-dialog"));
|
|
17
17
|
var _chartEditDialog = _interopRequireDefault(require("./components/dialog/chart-edit-dialog"));
|
|
18
|
-
var _statisticRecordDialog = _interopRequireDefault(require("./components/dialog/statistic-record-dialog"));
|
|
19
18
|
var _dtableDbApi = _interopRequireDefault(require("./api/dtable-db-api"));
|
|
20
19
|
var _chartService = _interopRequireDefault(require("./service/chart-service"));
|
|
21
20
|
var _constants = require("./constants");
|
|
@@ -23,9 +22,7 @@ var _icon = _interopRequireDefault(require("./assets/images/icon.png"));
|
|
|
23
22
|
const KEY_LOCAL_THEME_MODE = 'statistics-theme-mode';
|
|
24
23
|
class DesktopDashboard extends _react.Component {
|
|
25
24
|
constructor(props) {
|
|
26
|
-
var _this;
|
|
27
25
|
super(props);
|
|
28
|
-
_this = this;
|
|
29
26
|
this.onToggleColorThemeDialog = () => {
|
|
30
27
|
this.setState({
|
|
31
28
|
isShowColorThemeDialog: !this.state.isShowColorThemeDialog
|
|
@@ -95,28 +92,6 @@ class DesktopDashboard extends _react.Component {
|
|
|
95
92
|
const uuidThemeModeMap = this.getThemeModeMap();
|
|
96
93
|
return uuidThemeModeMap[dtableUuid];
|
|
97
94
|
};
|
|
98
|
-
this.toggleStatisticRecordsDialog = function (statisticRecord, chart) {
|
|
99
|
-
let {
|
|
100
|
-
isColumn = false,
|
|
101
|
-
isCurrentView = false,
|
|
102
|
-
isRow = false
|
|
103
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
104
|
-
if (_this.state.chartRecordsParams) {
|
|
105
|
-
_this.setState({
|
|
106
|
-
chartRecordsParams: null
|
|
107
|
-
});
|
|
108
|
-
} else {
|
|
109
|
-
_this.setState({
|
|
110
|
-
chartRecordsParams: {
|
|
111
|
-
statisticRecord,
|
|
112
|
-
chart,
|
|
113
|
-
isColumn,
|
|
114
|
-
isCurrentView,
|
|
115
|
-
isRow
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
95
|
this.generateChart = chartType => {
|
|
121
96
|
const {
|
|
122
97
|
statistics,
|
|
@@ -150,8 +125,7 @@ class DesktopDashboard extends _react.Component {
|
|
|
150
125
|
isShowChartEditDialog: false,
|
|
151
126
|
isShowChartAddDialog: false,
|
|
152
127
|
isShowColorThemeDialog: false,
|
|
153
|
-
editingChart: null
|
|
154
|
-
chartRecordsParams: null
|
|
128
|
+
editingChart: null
|
|
155
129
|
};
|
|
156
130
|
this.api = {
|
|
157
131
|
sqlQuery: this.sqlQuery,
|
|
@@ -165,7 +139,6 @@ class DesktopDashboard extends _react.Component {
|
|
|
165
139
|
}
|
|
166
140
|
render() {
|
|
167
141
|
const {
|
|
168
|
-
getTableById,
|
|
169
142
|
getValue,
|
|
170
143
|
isTableReadOnly,
|
|
171
144
|
colorThemeName,
|
|
@@ -177,7 +150,6 @@ class DesktopDashboard extends _react.Component {
|
|
|
177
150
|
theme,
|
|
178
151
|
isFullScreen,
|
|
179
152
|
editingChart,
|
|
180
|
-
chartRecordsParams,
|
|
181
153
|
isShowChartAddDialog
|
|
182
154
|
} = this.state;
|
|
183
155
|
const darkMode = theme === _constants.THEME_NAME_MAP.DARK;
|
|
@@ -273,8 +245,7 @@ class DesktopDashboard extends _react.Component {
|
|
|
273
245
|
deleteChart: this.props.deleteChart,
|
|
274
246
|
modifyDashboardLayout: this.props.modifyDashboardLayout,
|
|
275
247
|
onToggleEditChart: this.onToggleEditChart,
|
|
276
|
-
onCloseDashboard: this.props.onCloseDashboard
|
|
277
|
-
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
248
|
+
onCloseDashboard: this.props.onCloseDashboard
|
|
278
249
|
})), this.state.isShowChartEditDialog && /*#__PURE__*/_react.default.createElement(_chartEditDialog.default, {
|
|
279
250
|
theme: theme,
|
|
280
251
|
colorThemeName: colorThemeName,
|
|
@@ -286,8 +257,7 @@ class DesktopDashboard extends _react.Component {
|
|
|
286
257
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
287
258
|
addChart: this.props.addChart,
|
|
288
259
|
modifyChart: this.props.modifyChart,
|
|
289
|
-
onToggleEditChart: this.onToggleEditChart
|
|
290
|
-
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
260
|
+
onToggleEditChart: this.onToggleEditChart
|
|
291
261
|
}), isShowChartAddDialog && /*#__PURE__*/_react.default.createElement(_seaChart.TypesDialog, {
|
|
292
262
|
type: "",
|
|
293
263
|
onToggle: this.onToggleAddChart,
|
|
@@ -296,12 +266,6 @@ class DesktopDashboard extends _react.Component {
|
|
|
296
266
|
colorThemeName: colorThemeName,
|
|
297
267
|
onToggleColorThemeDialog: this.onToggleColorThemeDialog,
|
|
298
268
|
modifyColorTheme: this.props.modifyColorTheme
|
|
299
|
-
}), !!chartRecordsParams && /*#__PURE__*/_react.default.createElement(_statisticRecordDialog.default, {
|
|
300
|
-
eventBus: this.props.eventBus,
|
|
301
|
-
chartRecordsParams: chartRecordsParams,
|
|
302
|
-
getTableById: getTableById,
|
|
303
|
-
getValue: getValue,
|
|
304
|
-
toggleStatisticRecordsDialog: this.toggleStatisticRecordsDialog
|
|
305
269
|
}));
|
|
306
270
|
}
|
|
307
271
|
}
|
|
@@ -76,8 +76,7 @@ class ChartPreview extends _react.Component {
|
|
|
76
76
|
api,
|
|
77
77
|
value,
|
|
78
78
|
eventBus,
|
|
79
|
-
getTableById
|
|
80
|
-
toggleStatisticRecordsDialog
|
|
79
|
+
getTableById
|
|
81
80
|
} = this.props;
|
|
82
81
|
return /*#__PURE__*/_react.default.createElement(_statView.default, {
|
|
83
82
|
ref: ref => this.chartView = ref,
|
|
@@ -87,8 +86,7 @@ class ChartPreview extends _react.Component {
|
|
|
87
86
|
api: api,
|
|
88
87
|
value: value,
|
|
89
88
|
eventBus: eventBus,
|
|
90
|
-
getTableById: getTableById
|
|
91
|
-
toggleStatisticRecordsDialog: toggleStatisticRecordsDialog
|
|
89
|
+
getTableById: getTableById
|
|
92
90
|
});
|
|
93
91
|
};
|
|
94
92
|
this.moveChartToView = viewId => {
|
package/es/stat-list/index.js
CHANGED
|
@@ -227,8 +227,7 @@ class StatList extends _react.Component {
|
|
|
227
227
|
} = _ref2;
|
|
228
228
|
return this.showSelectTableDialog(index, statisticalResult);
|
|
229
229
|
},
|
|
230
|
-
onToggleEditChart: this.props.onToggleEditChart
|
|
231
|
-
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
230
|
+
onToggleEditChart: this.props.onToggleEditChart
|
|
232
231
|
}));
|
|
233
232
|
})), enlargedChart && /*#__PURE__*/_react.default.createElement(_enlargedChartDialog.default, {
|
|
234
233
|
colorThemeName: colorThemeName,
|
|
@@ -236,8 +235,7 @@ class StatList extends _react.Component {
|
|
|
236
235
|
api: api,
|
|
237
236
|
value: this.value,
|
|
238
237
|
getTableById: this.props.getTableById,
|
|
239
|
-
onEnlargeToggle: this.closeEnlargedChart
|
|
240
|
-
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
238
|
+
onEnlargeToggle: this.closeEnlargedChart
|
|
241
239
|
}), chartExport2Table && /*#__PURE__*/_react.default.createElement(_newTableDialog.default, {
|
|
242
240
|
getTables: this.props.getTables,
|
|
243
241
|
tableName: chartExport2Table.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.9-alpha.0",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"react-grid-layout": "^1.2.5",
|
|
19
19
|
"react-intl-universal": "^2.4.8",
|
|
20
20
|
"reactstrap": "8.9.0",
|
|
21
|
-
"sea-chart": "0.0.55-alpha.
|
|
21
|
+
"sea-chart": "0.0.55-alpha.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"dtable-ui-component": "~5.0.*",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dotenv": "^10.0.0",
|
|
54
54
|
"dotenv-expand": "^5.1.0",
|
|
55
55
|
"dtable-store": "4.3.6",
|
|
56
|
-
"dtable-ui-component": "5.0.
|
|
56
|
+
"dtable-ui-component": "^5.0.7",
|
|
57
57
|
"dtable-utils": "4.4.0",
|
|
58
58
|
"eslint": "^8.3.0",
|
|
59
59
|
"eslint-config-react-app": "^7.0.1",
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
.statistic-records-dialog {
|
|
2
|
-
width: 800px;
|
|
3
|
-
max-width: 800px;
|
|
4
|
-
height: calc(100% - 56px);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.statistic-records-dialog .modal-content {
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: 100%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.statistic-records-dialog .search-header {
|
|
13
|
-
height: 46px;
|
|
14
|
-
line-height: 46px;
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: space-between;
|
|
17
|
-
border-bottom: 1px solid #e9ecef;
|
|
18
|
-
align-items: center;
|
|
19
|
-
padding: 0 20px;
|
|
20
|
-
font-weight: 500;
|
|
21
|
-
font-size: 16px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.statistic-records-dialog .no-search-result {
|
|
25
|
-
height: 100%;
|
|
26
|
-
width: 100%;
|
|
27
|
-
text-align: center;
|
|
28
|
-
background-position: 50% 140px;
|
|
29
|
-
background-size: 132px 132px;
|
|
30
|
-
line-height: 600px;
|
|
31
|
-
color: #aaa;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.statistic-records-dialog .search-input-container .close {
|
|
35
|
-
height: 24px !important;
|
|
36
|
-
width: 24px;
|
|
37
|
-
line-height: 24px;
|
|
38
|
-
position: absolute;
|
|
39
|
-
right: 14px;
|
|
40
|
-
top: 22px;
|
|
41
|
-
padding: 0;
|
|
42
|
-
margin: 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.statistic-records-dialog .search-input-container {
|
|
46
|
-
margin-top: 10px;
|
|
47
|
-
padding: 0 20px;
|
|
48
|
-
height: 48px;
|
|
49
|
-
position: relative;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.statistic-records-dialog .search-input-container .search-tables-input {
|
|
53
|
-
height: 38px;
|
|
54
|
-
line-height: 38px;
|
|
55
|
-
padding-left: 30px;
|
|
56
|
-
border-bottom: 0;
|
|
57
|
-
background: #f5f5f5;
|
|
58
|
-
border-radius: 3px;
|
|
59
|
-
border: 1px solid #dedede;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.statistic-records-dialog .search-input-container .search-tables-input:focus {
|
|
63
|
-
outline: none;
|
|
64
|
-
box-shadow: unset;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.statistic-records-dialog .search-input-container .header-search-icon {
|
|
68
|
-
line-height: 38px;
|
|
69
|
-
text-align: center;
|
|
70
|
-
color: #aaa;
|
|
71
|
-
margin-left: 11px;
|
|
72
|
-
position: absolute;
|
|
73
|
-
left: unset;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.statistic-records-dialog .search-input-container .clear-search-text {
|
|
77
|
-
display: inline-block;
|
|
78
|
-
position: absolute;
|
|
79
|
-
right: 30px;
|
|
80
|
-
top: 10px;
|
|
81
|
-
height: 12px;
|
|
82
|
-
width: 12px;
|
|
83
|
-
line-height: 12px;
|
|
84
|
-
color: #ccc;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.statistic-records-dialog .search-input-container .clear-search-text .dtable-font {
|
|
88
|
-
font-size: 12px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.statistic-records-dialog .search-input-container .clear-search-text:hover {
|
|
92
|
-
cursor: pointer;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.statistic-records-dialog .statistic-records-container {
|
|
96
|
-
width: 100%;
|
|
97
|
-
height: 100%;
|
|
98
|
-
padding: 0;
|
|
99
|
-
overflow-y: hidden;
|
|
100
|
-
background-color: #f8f8f8;
|
|
101
|
-
border-bottom-left-radius: 3px;
|
|
102
|
-
border-bottom-right-radius: 3px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.statistic-records-dialog.statistic-records-container .records-list {
|
|
106
|
-
height: calc(100% - 47px);
|
|
107
|
-
width: fit-content;
|
|
108
|
-
min-width: 100%;
|
|
109
|
-
padding: 10px 20px;
|
|
110
|
-
overflow-y: auto;
|
|
111
|
-
margin-top: 3px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.statistic-records-dialog .statistic-records-container .records-list .records-container {
|
|
115
|
-
height: auto;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.statistic-records-dialog .row-card-item-content .grid-cell-type-button .grid-cell-type-button-inner {
|
|
119
|
-
justify-content: flex-start;
|
|
120
|
-
}
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _Loading2 = _interopRequireDefault(require("dtable-ui-component/lib/Loading"));
|
|
10
|
-
var _DTableSearchInput2 = _interopRequireDefault(require("dtable-ui-component/lib/DTableSearchInput"));
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
13
|
-
var _reactstrap = require("reactstrap");
|
|
14
|
-
var _dtableUtils = require("dtable-utils");
|
|
15
|
-
var _dtableDbApi = _interopRequireDefault(require("../../../api/dtable-db-api"));
|
|
16
|
-
var _constants = require("../../../constants");
|
|
17
|
-
require("./index.css");
|
|
18
|
-
// import { searchRows } from '../../../utils';
|
|
19
|
-
// import { getSqlString } from '../../../utils/sql-utils';
|
|
20
|
-
class StatisticRecordDialog extends _react.default.Component {
|
|
21
|
-
constructor(props) {
|
|
22
|
-
super(props);
|
|
23
|
-
this.init = () => {
|
|
24
|
-
const {
|
|
25
|
-
chartRecordsParams
|
|
26
|
-
} = this.props;
|
|
27
|
-
if (!chartRecordsParams) return;
|
|
28
|
-
const {
|
|
29
|
-
statisticRecord,
|
|
30
|
-
chart,
|
|
31
|
-
isColumn,
|
|
32
|
-
isCurrentView,
|
|
33
|
-
isRow
|
|
34
|
-
} = chartRecordsParams || {};
|
|
35
|
-
const {
|
|
36
|
-
rows: records
|
|
37
|
-
} = statisticRecord;
|
|
38
|
-
const {
|
|
39
|
-
getTableById
|
|
40
|
-
} = this.props;
|
|
41
|
-
const {
|
|
42
|
-
table_id,
|
|
43
|
-
view_id
|
|
44
|
-
} = chart;
|
|
45
|
-
this.table = getTableById(table_id);
|
|
46
|
-
this.view = (0, _dtableUtils.getViewById)(this.table.views, view_id);
|
|
47
|
-
this.isArchiveView = (0, _dtableUtils.isArchiveView)(this.view);
|
|
48
|
-
this.unShowColumnKeyList = this.getUnShowColumnKeyList(this.view);
|
|
49
|
-
this.renderedColumns = this.getRenderedColumns(this.table);
|
|
50
|
-
// if (this.isArchiveView || !records) {
|
|
51
|
-
// const { username, userId, userDepartmentIdsMap } = window.dtable || {};
|
|
52
|
-
// const sqlString = getSqlString(chart, statisticRecord, { isColumn, isCurrentView, isRow, getTableById, username, userId, userDepartmentIdsMap });
|
|
53
|
-
// dtableDbAPI.sqlQuery(sqlString).then(res => {
|
|
54
|
-
// const { results: rows } = res.data;
|
|
55
|
-
// this.processDrilledRows(rows);
|
|
56
|
-
// });
|
|
57
|
-
// return;
|
|
58
|
-
// }
|
|
59
|
-
|
|
60
|
-
this.processDrilledRows(records);
|
|
61
|
-
};
|
|
62
|
-
this.processDrilledRows = drilledRows => {
|
|
63
|
-
const {
|
|
64
|
-
statisticRecord
|
|
65
|
-
} = this.props.chartRecordsParams;
|
|
66
|
-
const {
|
|
67
|
-
name
|
|
68
|
-
} = statisticRecord;
|
|
69
|
-
const searchedRowsIds = this.getSearchedRows(drilledRows);
|
|
70
|
-
let idRowMap = {};
|
|
71
|
-
drilledRows.forEach(row => {
|
|
72
|
-
idRowMap[row._id] = row;
|
|
73
|
-
});
|
|
74
|
-
this.initComputedProperties(drilledRows);
|
|
75
|
-
this.setState({
|
|
76
|
-
loading: false,
|
|
77
|
-
title: name,
|
|
78
|
-
rows: drilledRows,
|
|
79
|
-
idRowMap,
|
|
80
|
-
searchedRowsIds
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
this.initComputedProperties = drilledRows => {
|
|
84
|
-
if (this.isArchiveView) {
|
|
85
|
-
const formulaColumns = (0, _dtableUtils.getFormulaColumnsContainLinks)(this.table);
|
|
86
|
-
if (formulaColumns.length === 0) return {};
|
|
87
|
-
let formulaRows = {};
|
|
88
|
-
drilledRows.forEach(row => {
|
|
89
|
-
const rowId = row._id;
|
|
90
|
-
formulaRows[rowId] = {};
|
|
91
|
-
formulaColumns.forEach(column => formulaRows[rowId][column.key] = row[column.key]);
|
|
92
|
-
});
|
|
93
|
-
this.formulaRows = formulaRows;
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const {
|
|
97
|
-
formulaRows
|
|
98
|
-
} = this.getTableViewFormulaRows();
|
|
99
|
-
this.formulaRows = formulaRows;
|
|
100
|
-
};
|
|
101
|
-
this.onSearch = searchVal => {
|
|
102
|
-
const {
|
|
103
|
-
rows
|
|
104
|
-
} = this.state;
|
|
105
|
-
const searchedRowsIds = this.getSearchedRows(rows, searchVal);
|
|
106
|
-
this.setState({
|
|
107
|
-
searchedRowsIds,
|
|
108
|
-
searchVal
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
this.clearTimer = () => {
|
|
112
|
-
if (this.timer) {
|
|
113
|
-
clearTimeout(this.timer);
|
|
114
|
-
this.timer = null;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
this.clearSearch = () => {
|
|
118
|
-
const {
|
|
119
|
-
rows
|
|
120
|
-
} = this.state;
|
|
121
|
-
const searchedRowsIds = this.getSearchedRows(rows);
|
|
122
|
-
this.setState({
|
|
123
|
-
searchedRowsIds,
|
|
124
|
-
searchVal: ''
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
this.getSearchedRows = (rows, searchVal) => {
|
|
128
|
-
if (!Array.isArray(rows) || rows.length === 0) return [];
|
|
129
|
-
// if (searchVal) {
|
|
130
|
-
// return searchRows(
|
|
131
|
-
// rows,
|
|
132
|
-
// getViewShownColumns(this.view, this.table.columns),
|
|
133
|
-
// searchVal,
|
|
134
|
-
// (row) => {
|
|
135
|
-
// return row;
|
|
136
|
-
// },
|
|
137
|
-
// ).map((row) => row._id);
|
|
138
|
-
// }
|
|
139
|
-
return rows.map(row => row._id);
|
|
140
|
-
};
|
|
141
|
-
this.getRowsByIds = rowsIds => {
|
|
142
|
-
if (!Array.isArray(rowsIds) || rowsIds.length === 0) {
|
|
143
|
-
return [];
|
|
144
|
-
}
|
|
145
|
-
const {
|
|
146
|
-
idRowMap
|
|
147
|
-
} = this.state;
|
|
148
|
-
return rowsIds.map(rowId => idRowMap[rowId]).filter(Boolean);
|
|
149
|
-
};
|
|
150
|
-
this.toggle = () => {
|
|
151
|
-
// if (this.valueChanged) {
|
|
152
|
-
// this.props.eventBus.dispatch(CommonEventTypes.REFRESH_CHARTS);
|
|
153
|
-
// }
|
|
154
|
-
this.props.toggleStatisticRecordsDialog();
|
|
155
|
-
};
|
|
156
|
-
this.expandRowUpdated = _ref => {
|
|
157
|
-
let {
|
|
158
|
-
table_id,
|
|
159
|
-
updatedRow
|
|
160
|
-
} = _ref;
|
|
161
|
-
// none-matched
|
|
162
|
-
if (table_id !== this.table._id) return;
|
|
163
|
-
const {
|
|
164
|
-
rows,
|
|
165
|
-
searchedRowsIds,
|
|
166
|
-
idRowMap,
|
|
167
|
-
searchVal
|
|
168
|
-
} = this.state;
|
|
169
|
-
let updatedSearchedRowsIds = searchedRowsIds;
|
|
170
|
-
let updatedRows = [...rows];
|
|
171
|
-
let updatedIdRowMap = idRowMap;
|
|
172
|
-
rows.forEach((row, index) => {
|
|
173
|
-
const rowId = row._id;
|
|
174
|
-
if (rowId === updatedRow._id) {
|
|
175
|
-
updatedRows[index] = updatedRow;
|
|
176
|
-
updatedIdRowMap[rowId] = updatedRow;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
if (searchedRowsIds.length > 0) {
|
|
180
|
-
const searchedRows = this.getRowsByIds(searchedRowsIds);
|
|
181
|
-
updatedSearchedRowsIds = this.getSearchedRows(searchedRows, searchVal);
|
|
182
|
-
}
|
|
183
|
-
this.valueChanged = true;
|
|
184
|
-
this.setState({
|
|
185
|
-
rows: updatedRows,
|
|
186
|
-
idRowMap: updatedIdRowMap,
|
|
187
|
-
searchedRowsIds: updatedSearchedRowsIds
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
this.expandRowDeleted = _ref2 => {
|
|
191
|
-
let {
|
|
192
|
-
table_id,
|
|
193
|
-
row_id
|
|
194
|
-
} = _ref2;
|
|
195
|
-
// none-matched
|
|
196
|
-
if (table_id !== this.table._id) return;
|
|
197
|
-
const {
|
|
198
|
-
rows,
|
|
199
|
-
searchedRowsIds,
|
|
200
|
-
idRowMap
|
|
201
|
-
} = this.state;
|
|
202
|
-
let updatedSearchedRowsIds = searchedRowsIds;
|
|
203
|
-
let updatedIdRowMap = idRowMap;
|
|
204
|
-
const updatedRows = rows.filter(row => row._id !== row_id);
|
|
205
|
-
delete updatedIdRowMap[row_id];
|
|
206
|
-
if (searchedRowsIds.length > 0) {
|
|
207
|
-
updatedSearchedRowsIds = searchedRowsIds.filter(rowId => rowId !== row_id);
|
|
208
|
-
}
|
|
209
|
-
this.valueChanged = true;
|
|
210
|
-
this.setState({
|
|
211
|
-
rows: updatedRows,
|
|
212
|
-
idRowMap: updatedIdRowMap,
|
|
213
|
-
searchedRowsIds: updatedSearchedRowsIds
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
this.getUnShowColumnKeyList = view => {
|
|
217
|
-
const firstColumnKey = '0000';
|
|
218
|
-
const {
|
|
219
|
-
hidden_columns = []
|
|
220
|
-
} = view;
|
|
221
|
-
return [firstColumnKey, ...hidden_columns];
|
|
222
|
-
};
|
|
223
|
-
this.getRenderedColumns = table => {
|
|
224
|
-
const {
|
|
225
|
-
columns
|
|
226
|
-
} = table;
|
|
227
|
-
return columns.filter(column => !this.unShowColumnKeyList.includes(column.key));
|
|
228
|
-
};
|
|
229
|
-
this.getTableViewFormulaRows = () => {
|
|
230
|
-
const {
|
|
231
|
-
table,
|
|
232
|
-
view
|
|
233
|
-
} = this;
|
|
234
|
-
const value = this.props.getValue();
|
|
235
|
-
if (view.formula_rows && Object.keys(view.formula_rows).length > 0) {
|
|
236
|
-
return {
|
|
237
|
-
formulaRows: view.formula_rows
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
if (window.app && window.app.cacheFormulaResults) {
|
|
241
|
-
window.app.cacheFormulaResults(table.rows, {
|
|
242
|
-
targetViewId: view._id,
|
|
243
|
-
table,
|
|
244
|
-
value
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
return {
|
|
248
|
-
formulaRows: view.formula_rows
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
this.renderRowsCards = () => {
|
|
252
|
-
const {
|
|
253
|
-
searchedRowsIds
|
|
254
|
-
} = this.state;
|
|
255
|
-
const searchedRows = this.getRowsByIds(searchedRowsIds);
|
|
256
|
-
if (searchedRows.length === 0) return null;
|
|
257
|
-
if (!window.app || !window.app.renderRowsCards) return null;
|
|
258
|
-
return window.app.renderRowsCards({
|
|
259
|
-
table: this.table,
|
|
260
|
-
renderedColumns: this.renderedColumns,
|
|
261
|
-
unShowColumnKeyList: this.unShowColumnKeyList,
|
|
262
|
-
isShowRowCardHeader: true,
|
|
263
|
-
formulaRows: this.formulaRows,
|
|
264
|
-
columns: this.renderedColumns,
|
|
265
|
-
rows: searchedRows,
|
|
266
|
-
rowCardType: 'statistic'
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
this.state = {
|
|
270
|
-
loading: true,
|
|
271
|
-
title: '',
|
|
272
|
-
rows: [],
|
|
273
|
-
idRowMap: {},
|
|
274
|
-
searchVal: '',
|
|
275
|
-
searchedRowsIds: []
|
|
276
|
-
};
|
|
277
|
-
this.table = null;
|
|
278
|
-
this.view = null;
|
|
279
|
-
this.isArchiveView = false;
|
|
280
|
-
this.valueChanged = false;
|
|
281
|
-
this.renderedColumns = [];
|
|
282
|
-
this.formulaRows = null;
|
|
283
|
-
this.unShowColumnKeyList = null;
|
|
284
|
-
}
|
|
285
|
-
componentDidMount() {
|
|
286
|
-
this.unsubscribeExpandRowUpdated = this.props.eventBus.subscribe(_constants.CommonEventTypes.EXPAND_ROW_UPDATED, this.expandRowUpdated);
|
|
287
|
-
this.unsubscribeExpandRowDeleted = this.props.eventBus.subscribe(_constants.CommonEventTypes.EXPAND_ROW_DELETED, this.expandRowDeleted);
|
|
288
|
-
this.init();
|
|
289
|
-
}
|
|
290
|
-
componentWillUnmount() {
|
|
291
|
-
this.unsubscribeExpandRowUpdated();
|
|
292
|
-
this.unsubscribeExpandRowDeleted();
|
|
293
|
-
}
|
|
294
|
-
render() {
|
|
295
|
-
const {
|
|
296
|
-
loading,
|
|
297
|
-
title
|
|
298
|
-
} = this.state;
|
|
299
|
-
return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
|
|
300
|
-
isOpen: true,
|
|
301
|
-
autoFocus: false,
|
|
302
|
-
toggle: this.toggle,
|
|
303
|
-
className: "statistic-records-dialog",
|
|
304
|
-
zIndex: 1048
|
|
305
|
-
}, /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
306
|
-
className: "search-header"
|
|
307
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, title), /*#__PURE__*/_react.default.createElement("button", {
|
|
308
|
-
type: "button",
|
|
309
|
-
className: "close",
|
|
310
|
-
"aria-label": "Close",
|
|
311
|
-
onClick: this.toggle
|
|
312
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
313
|
-
"aria-hidden": "true"
|
|
314
|
-
}, "\xD7"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
315
|
-
className: "search-input-container"
|
|
316
|
-
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
317
|
-
className: "header-search-icon dtable-font dtable-icon-search"
|
|
318
|
-
}), /*#__PURE__*/_react.default.createElement(_DTableSearchInput2.default, {
|
|
319
|
-
autoFocus: true,
|
|
320
|
-
isClearable: true,
|
|
321
|
-
className: "search-tables-input",
|
|
322
|
-
placeholder: _reactIntlUniversal.default.get('Search_records'),
|
|
323
|
-
onChange: this.onSearch,
|
|
324
|
-
clearValue: this.clearSearch,
|
|
325
|
-
components: {
|
|
326
|
-
ClearIndicator: props => {
|
|
327
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
328
|
-
className: "clear-search-text",
|
|
329
|
-
onClick: props.clearValue,
|
|
330
|
-
title: _reactIntlUniversal.default.get('Clear_search_text'),
|
|
331
|
-
"aria-label": _reactIntlUniversal.default.get('Clear_search_text')
|
|
332
|
-
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
333
|
-
className: "dtable-font dtable-icon-x-"
|
|
334
|
-
}));
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
})), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
|
|
338
|
-
className: "statistic-records-container"
|
|
339
|
-
}, loading ? /*#__PURE__*/_react.default.createElement("div", {
|
|
340
|
-
className: "d-flex py-8"
|
|
341
|
-
}, /*#__PURE__*/_react.default.createElement(_Loading2.default, null)) : this.renderRowsCards())));
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
var _default = exports.default = StatisticRecordDialog;
|