dtable-statistic 5.0.48-alpha.1 → 5.0.48-alpha.10
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 +2 -2
- package/es/utils/formula-calc-worker/calc-formula-result.worker.js +10 -0
- package/es/utils/formula-calc-worker/calc-view-rows.worker.js +10 -0
- package/es/utils/formula-calc-worker/calc-with-worker.js +22 -41
- package/es/utils/formula-calc-worker/calc.worker.js +8 -0
- package/package.json +3 -4
- package/es/utils/formula-calc-worker/calc-formula-result-worker.js +0 -21
- package/es/utils/formula-calc-worker/calc-view-rows-worker.js +0 -16
package/es/index.js
CHANGED
|
@@ -41,7 +41,7 @@ class Statistic {
|
|
|
41
41
|
userId = null,
|
|
42
42
|
userDepartmentIdsMap = null
|
|
43
43
|
} = dtableStore.dtableSettings;
|
|
44
|
-
const rows = await (0, _calcWithWorker.calcViewRowsWithWorker)(view, table,
|
|
44
|
+
const rows = await (0, _calcWithWorker.calcViewRowsWithWorker)(view, table, dtableStore.value, username, userId, userDepartmentIdsMap);
|
|
45
45
|
return rows;
|
|
46
46
|
}
|
|
47
47
|
static async getTableFormulaResults(table, rows) {
|
|
@@ -52,7 +52,7 @@ class Statistic {
|
|
|
52
52
|
userDepartmentIdsMap = null
|
|
53
53
|
} = dtableStore.dtableSettings;
|
|
54
54
|
const formulaColumns = _dtableStore.Views.getFormulaColumnsContainLinks(table);
|
|
55
|
-
const res = await (0, _calcWithWorker.calcFormulaResultsWithWorker)(table, rows,
|
|
55
|
+
const res = await (0, _calcWithWorker.calcFormulaResultsWithWorker)(table, rows, dtableStore.value, formulaColumns, username, userId, userDepartmentIdsMap);
|
|
56
56
|
return res;
|
|
57
57
|
}
|
|
58
58
|
static updateStatistics(dtableStore, statistics) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var Comlink = _interopRequireWildcard(require("comlink"));
|
|
5
|
+
async function calcFormulaResults(callback) {
|
|
6
|
+
// const res = Views.getTableFormulaResults(table, rows, value, formulaColumns, { username, userId, userDepartmentIdsMap });
|
|
7
|
+
const res = await callback();
|
|
8
|
+
return res;
|
|
9
|
+
}
|
|
10
|
+
Comlink.expose(calcFormulaResults);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var Comlink = _interopRequireWildcard(require("comlink"));
|
|
5
|
+
async function calcViewRows(callback) {
|
|
6
|
+
// const rows = Views.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
|
|
7
|
+
const rows = await callback();
|
|
8
|
+
return rows;
|
|
9
|
+
}
|
|
10
|
+
Comlink.expose(calcViewRows);
|
|
@@ -1,51 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.calcFormulaResultsWithWorker = calcFormulaResultsWithWorker;
|
|
7
9
|
exports.calcViewRowsWithWorker = calcViewRowsWithWorker;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
});
|
|
10
|
+
var Comlink = _interopRequireWildcard(require("comlink"));
|
|
11
|
+
var _calc = _interopRequireDefault(require("./calc.worker"));
|
|
12
|
+
var _dtableStore = require("dtable-store");
|
|
13
|
+
async function calcViewRowsWithWorker(view, table, value, username, userId, userDepartmentIdsMap) {
|
|
14
|
+
const worker = new _calc.default();
|
|
15
|
+
const calcWorker = Comlink.wrap(worker);
|
|
16
|
+
const cb = () => _dtableStore.Views.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
|
|
17
|
+
const rows = await calcWorker(Comlink.proxy(cb));
|
|
18
|
+
worker.terminate();
|
|
19
|
+
return rows;
|
|
27
20
|
}
|
|
28
|
-
function calcFormulaResultsWithWorker(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
};
|
|
21
|
+
async function calcFormulaResultsWithWorker(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap) {
|
|
22
|
+
const worker = new _calc.default();
|
|
23
|
+
const calcWorker = Comlink.wrap(worker);
|
|
24
|
+
const cb = () => _dtableStore.Views.getTableFormulaResults(table, rows, value, formulaColumns, {
|
|
25
|
+
username,
|
|
26
|
+
userId,
|
|
27
|
+
userDepartmentIdsMap
|
|
50
28
|
});
|
|
29
|
+
const results = await calcWorker(Comlink.proxy(cb));
|
|
30
|
+
worker.terminate();
|
|
31
|
+
return results;
|
|
51
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "5.0.48-alpha.
|
|
3
|
+
"version": "5.0.48-alpha.10",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -18,8 +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": "
|
|
22
|
-
|
|
21
|
+
"sea-chart": "^0.0.95-alpha.4"
|
|
23
22
|
},
|
|
24
23
|
"peerDependencies": {
|
|
25
24
|
"dtable-ui-component": "~5.0.*",
|
|
@@ -53,7 +52,7 @@
|
|
|
53
52
|
"css-minimizer-webpack-plugin": "^3.2.0",
|
|
54
53
|
"dotenv": "^10.0.0",
|
|
55
54
|
"dotenv-expand": "^5.1.0",
|
|
56
|
-
"dtable-store": "
|
|
55
|
+
"dtable-store": "4.3.6",
|
|
57
56
|
"dtable-ui-component": "~5.0.11",
|
|
58
57
|
"dtable-utils": "5.0.0",
|
|
59
58
|
"dtable-web-api": "^5.0.3",
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
};
|