dtable-statistic 5.0.48-alpha.10 → 5.0.48-alpha.3
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 +21 -0
- package/es/utils/formula-calc-worker/calc-view-rows-worker.js +16 -0
- package/es/utils/formula-calc-worker/calc-with-worker.js +41 -22
- package/package.json +4 -3
- package/es/utils/formula-calc-worker/calc-formula-result.worker.js +0 -10
- package/es/utils/formula-calc-worker/calc-view-rows.worker.js +0 -10
- package/es/utils/formula-calc-worker/calc.worker.js +0 -8
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, dtableStore.value, username, userId, userDepartmentIdsMap);
|
|
44
|
+
const rows = await (0, _calcWithWorker.calcViewRowsWithWorker)(view, table, this.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, dtableStore.value, formulaColumns, username, userId, userDepartmentIdsMap);
|
|
55
|
+
const res = await (0, _calcWithWorker.calcFormulaResultsWithWorker)(table, rows, this.dtableStore.value, formulaColumns, username, userId, userDepartmentIdsMap);
|
|
56
56
|
return res;
|
|
57
57
|
}
|
|
58
58
|
static updateStatistics(dtableStore, 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
|
+
};
|
|
@@ -1,32 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.calcFormulaResultsWithWorker = calcFormulaResultsWithWorker;
|
|
9
7
|
exports.calcViewRowsWithWorker = calcViewRowsWithWorker;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
});
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
};
|
|
28
50
|
});
|
|
29
|
-
const results = await calcWorker(Comlink.proxy(cb));
|
|
30
|
-
worker.terminate();
|
|
31
|
-
return results;
|
|
32
51
|
}
|
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.3",
|
|
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": "
|
|
21
|
+
"sea-chart": "~0.0.94"
|
|
22
|
+
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
25
|
"dtable-ui-component": "~5.0.*",
|
|
@@ -52,7 +53,7 @@
|
|
|
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",
|
|
58
59
|
"dtable-web-api": "^5.0.3",
|
|
@@ -1,10 +0,0 @@
|
|
|
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);
|
|
@@ -1,10 +0,0 @@
|
|
|
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);
|