dtable-statistic 4.4.24-alpha.11 → 4.4.24-alpha.13
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/index.js +56 -1
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _dtableStore = require("dtable-store");
|
|
5
6
|
var _dashboard = _interopRequireDefault(require("./dashboard"));
|
|
7
|
+
var _converStatItem = require("./model/conver-statItem");
|
|
6
8
|
class Statistic {
|
|
7
9
|
static getInitProps() {
|
|
8
10
|
if (!window || !window.app) {
|
|
@@ -17,15 +19,68 @@ class Statistic {
|
|
|
17
19
|
selectedTableIdx,
|
|
18
20
|
selectedViewId
|
|
19
21
|
} = state;
|
|
22
|
+
const convertedValue = this.convertStatistics(value);
|
|
20
23
|
return {
|
|
21
|
-
value,
|
|
24
|
+
value: convertedValue,
|
|
22
25
|
eventBus: dtableStore.eventBus,
|
|
23
26
|
activeTableIdx: selectedTableIdx,
|
|
24
27
|
activeViewId: selectedViewId,
|
|
28
|
+
getViewRows: this.getViewRows,
|
|
29
|
+
getTableFormulaResults: this.getTableFormulaResults,
|
|
25
30
|
updateStatistics: this.updateStatistics.bind(this, dtableStore),
|
|
26
31
|
deletePluginSettings: this.deletePluginSettings.bind(this, dtableStore)
|
|
27
32
|
};
|
|
28
33
|
}
|
|
34
|
+
|
|
35
|
+
// Compatible with old statistics
|
|
36
|
+
static convertStatistics(value) {
|
|
37
|
+
value.statistics.forEach(dashboard => {
|
|
38
|
+
const new_stat_items = dashboard.stat_items.map(item => {
|
|
39
|
+
if (!item.config) {
|
|
40
|
+
const newItem = {
|
|
41
|
+
config: {
|
|
42
|
+
...item,
|
|
43
|
+
...(0, _converStatItem.convertByType)(item)
|
|
44
|
+
},
|
|
45
|
+
layout: item.layout,
|
|
46
|
+
style_config: {
|
|
47
|
+
border: {},
|
|
48
|
+
title: {
|
|
49
|
+
text: item.name
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return newItem;
|
|
54
|
+
}
|
|
55
|
+
return item;
|
|
56
|
+
});
|
|
57
|
+
dashboard.stat_items = new_stat_items;
|
|
58
|
+
});
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
static getViewRows(view, table) {
|
|
62
|
+
const dtableStore = window.app.dtableStore || {};
|
|
63
|
+
const {
|
|
64
|
+
username = null,
|
|
65
|
+
userId = null,
|
|
66
|
+
userDepartmentIdsMap = null
|
|
67
|
+
} = dtableStore.dtableSettings;
|
|
68
|
+
return _dtableStore.Views.getViewRows(view, table, dtableStore.value, username, userId, userDepartmentIdsMap);
|
|
69
|
+
}
|
|
70
|
+
static getTableFormulaResults(table, rows) {
|
|
71
|
+
const dtableStore = window.app.dtableStore || {};
|
|
72
|
+
const {
|
|
73
|
+
username = null,
|
|
74
|
+
userId = null,
|
|
75
|
+
userDepartmentIdsMap = null
|
|
76
|
+
} = dtableStore.dtableSettings;
|
|
77
|
+
const formulaColumns = _dtableStore.Views.getFormulaColumnsContainLinks(table);
|
|
78
|
+
return _dtableStore.Views.getTableFormulaResults(table, rows, dtableStore.value, formulaColumns, {
|
|
79
|
+
username,
|
|
80
|
+
userId,
|
|
81
|
+
userDepartmentIdsMap
|
|
82
|
+
});
|
|
83
|
+
}
|
|
29
84
|
static updateStatistics(dtableStore, statistics) {
|
|
30
85
|
dtableStore.updateStatisticsList(statistics);
|
|
31
86
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "4.4.24-alpha.
|
|
3
|
+
"version": "4.4.24-alpha.13",
|
|
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.
|
|
21
|
+
"sea-chart": "0.0.43-alpha.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"dtable-ui-component": "~4.4.*",
|