dtable-statistic 5.0.47 → 5.0.48-alpha.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.
package/es/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _dtableStore = require("dtable-store");
|
|
6
6
|
var _dashboard = _interopRequireDefault(require("./dashboard"));
|
|
7
|
+
var _calcWithWorker = require("./utils/formula-calc-worker/calc-with-worker");
|
|
7
8
|
class Statistic {
|
|
8
9
|
static getInitProps() {
|
|
9
10
|
if (!window || !window.app) {
|
|
@@ -33,16 +34,17 @@ class Statistic {
|
|
|
33
34
|
deletePluginSettings: this.deletePluginSettings.bind(this, dtableStore)
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
static getViewRows(view, table) {
|
|
37
|
+
static async getViewRows(view, table) {
|
|
37
38
|
const dtableStore = window.app.dtableStore || {};
|
|
38
39
|
const {
|
|
39
40
|
username = null,
|
|
40
41
|
userId = null,
|
|
41
42
|
userDepartmentIdsMap = null
|
|
42
43
|
} = dtableStore.dtableSettings;
|
|
43
|
-
|
|
44
|
+
const rows = await (0, _calcWithWorker.calcViewRowsWithWorker)(view, table, this.dtableStore.value, username, userId, userDepartmentIdsMap);
|
|
45
|
+
return rows;
|
|
44
46
|
}
|
|
45
|
-
static getTableFormulaResults(table, rows) {
|
|
47
|
+
static async getTableFormulaResults(table, rows) {
|
|
46
48
|
const dtableStore = window.app.dtableStore || {};
|
|
47
49
|
const {
|
|
48
50
|
username = null,
|
|
@@ -50,11 +52,8 @@ class Statistic {
|
|
|
50
52
|
userDepartmentIdsMap = null
|
|
51
53
|
} = dtableStore.dtableSettings;
|
|
52
54
|
const formulaColumns = _dtableStore.Views.getFormulaColumnsContainLinks(table);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
userId,
|
|
56
|
-
userDepartmentIdsMap
|
|
57
|
-
});
|
|
55
|
+
const res = await (0, _calcWithWorker.calcFormulaResultsWithWorker)(table, rows, this.dtableStore.value, formulaColumns, username, userId, userDepartmentIdsMap);
|
|
56
|
+
return res;
|
|
58
57
|
}
|
|
59
58
|
static updateStatistics(dtableStore, statistics) {
|
|
60
59
|
dtableStore.updateStatisticsList(statistics);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _dtableStore = require("dtable-store");
|
|
4
|
+
/* eslint-disable no-restricted-globals */
|
|
5
|
+
self.onmessage = function (e) {
|
|
6
|
+
const {
|
|
7
|
+
table,
|
|
8
|
+
rows,
|
|
9
|
+
value,
|
|
10
|
+
formulaColumns,
|
|
11
|
+
username,
|
|
12
|
+
userId,
|
|
13
|
+
userDepartmentIdsMap
|
|
14
|
+
} = e.data;
|
|
15
|
+
const res = _dtableStore.Views.getTableFormulaResults(table, rows, value, formulaColumns, {
|
|
16
|
+
username,
|
|
17
|
+
userId,
|
|
18
|
+
userDepartmentIdsMap
|
|
19
|
+
});
|
|
20
|
+
self.postMessage(res);
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _dtableStore = require("dtable-store");
|
|
4
|
+
/* eslint-disable no-restricted-globals */
|
|
5
|
+
self.onmessage = function (e) {
|
|
6
|
+
const {
|
|
7
|
+
view,
|
|
8
|
+
table,
|
|
9
|
+
value,
|
|
10
|
+
username,
|
|
11
|
+
userId,
|
|
12
|
+
userDepartmentIdsMap
|
|
13
|
+
} = e.data;
|
|
14
|
+
const rows = _dtableStore.Views.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
|
|
15
|
+
self.postMessage(rows);
|
|
16
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.calcFormulaResultsWithWorker = calcFormulaResultsWithWorker;
|
|
7
|
+
exports.calcViewRowsWithWorker = calcViewRowsWithWorker;
|
|
8
|
+
function calcViewRowsWithWorker(view, table, value) {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const worker = new Worker(new URL('./calc-view-rows-worker.js', import.meta.url), {
|
|
11
|
+
type: 'module'
|
|
12
|
+
});
|
|
13
|
+
worker.postMessage({
|
|
14
|
+
view,
|
|
15
|
+
table,
|
|
16
|
+
value
|
|
17
|
+
});
|
|
18
|
+
worker.onmessage = function (e) {
|
|
19
|
+
resolve(e.data);
|
|
20
|
+
worker.terminate();
|
|
21
|
+
};
|
|
22
|
+
worker.onerror = function (e) {
|
|
23
|
+
reject(e);
|
|
24
|
+
worker.terminate();
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function calcFormulaResultsWithWorker(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap) {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const worker = new Worker(new URL('./calc-formula-result-worker.js', import.meta.url), {
|
|
31
|
+
type: 'module'
|
|
32
|
+
});
|
|
33
|
+
worker.postMessage({
|
|
34
|
+
table,
|
|
35
|
+
rows,
|
|
36
|
+
value,
|
|
37
|
+
formulaColumns,
|
|
38
|
+
username,
|
|
39
|
+
userId,
|
|
40
|
+
userDepartmentIdsMap
|
|
41
|
+
});
|
|
42
|
+
worker.onmessage = function (e) {
|
|
43
|
+
resolve(e.data);
|
|
44
|
+
worker.terminate();
|
|
45
|
+
};
|
|
46
|
+
worker.onerror = function (e) {
|
|
47
|
+
reject(e);
|
|
48
|
+
worker.terminate();
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.48-alpha.1",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -18,7 +18,8 @@
|
|
|
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.94"
|
|
22
|
+
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
25
|
"dtable-ui-component": "~5.0.*",
|
|
@@ -52,9 +53,10 @@
|
|
|
52
53
|
"css-minimizer-webpack-plugin": "^3.2.0",
|
|
53
54
|
"dotenv": "^10.0.0",
|
|
54
55
|
"dotenv-expand": "^5.1.0",
|
|
55
|
-
"dtable-store": "
|
|
56
|
+
"dtable-store": "5.0.8",
|
|
56
57
|
"dtable-ui-component": "~5.0.11",
|
|
57
58
|
"dtable-utils": "5.0.0",
|
|
59
|
+
"dtable-web-api": "^5.0.3",
|
|
58
60
|
"eslint": "^8.3.0",
|
|
59
61
|
"eslint-config-react-app": "^7.0.1",
|
|
60
62
|
"eslint-webpack-plugin": "^3.1.1",
|