dtable-statistic 5.0.48-alpha.7 → 5.0.48-alpha.9
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 +14 -0
- package/es/utils/formula-calc-worker/calc-view-rows.worker.js +10 -0
- package/es/utils/formula-calc-worker/calc-with-worker.js +17 -42
- package/package.json +4 -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,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _dtableStore = require("dtable-store");
|
|
5
|
+
var Comlink = _interopRequireWildcard(require("comlink"));
|
|
6
|
+
function calcFormulaResults(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap) {
|
|
7
|
+
const res = _dtableStore.Views.getTableFormulaResults(table, rows, value, formulaColumns, {
|
|
8
|
+
username,
|
|
9
|
+
userId,
|
|
10
|
+
userDepartmentIdsMap
|
|
11
|
+
});
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
14
|
+
Comlink.expose(calcFormulaResults);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _dtableStore = require("dtable-store");
|
|
5
|
+
var Comlink = _interopRequireWildcard(require("comlink"));
|
|
6
|
+
function calcViewRows(view, table, value, username, userId, userDepartmentIdsMap) {
|
|
7
|
+
const rows = _dtableStore.Views.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
|
|
8
|
+
return rows;
|
|
9
|
+
}
|
|
10
|
+
Comlink.expose(calcViewRows);
|
|
@@ -1,51 +1,26 @@
|
|
|
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 _calcFormulaResult = _interopRequireDefault(require("./calc-formula-result.worker"));
|
|
12
|
+
var _calcViewRows = _interopRequireDefault(require("./calc-view-rows.worker"));
|
|
13
|
+
async function calcViewRowsWithWorker(view, table, value, username, userId, userDepartmentIdsMap) {
|
|
14
|
+
const worker = new _calcViewRows.default();
|
|
15
|
+
const calcViewRows = Comlink.wrap(worker);
|
|
16
|
+
const rows = await calcViewRows(view, table, value, username, userId, userDepartmentIdsMap);
|
|
17
|
+
worker.terminate();
|
|
18
|
+
return rows;
|
|
27
19
|
}
|
|
28
|
-
function calcFormulaResultsWithWorker(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
});
|
|
20
|
+
async function calcFormulaResultsWithWorker(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap) {
|
|
21
|
+
const worker = new _calcFormulaResult.default();
|
|
22
|
+
const calcFormulaResults = Comlink.wrap(worker);
|
|
23
|
+
const results = await calcFormulaResults(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap);
|
|
24
|
+
worker.terminate();
|
|
25
|
+
return results;
|
|
51
26
|
}
|
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.9",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"react-dom": "17.0.2",
|
|
18
18
|
"react-grid-layout": "^1.2.5",
|
|
19
19
|
"react-intl-universal": "^2.4.8",
|
|
20
|
-
"reactstrap": "8.9.0"
|
|
20
|
+
"reactstrap": "8.9.0",
|
|
21
|
+
"sea-chart": "^0.0.95-alpha.4"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
24
|
"dtable-ui-component": "~5.0.*",
|
|
24
25
|
"dtable-utils": "~5.0.*"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"sea-chart": "0.0.95-alpha.5",
|
|
28
28
|
"@babel/cli": "7.22.15",
|
|
29
29
|
"@babel/core": "^7.16.0",
|
|
30
30
|
"@babel/eslint-parser": "^7.16.3",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"css-minimizer-webpack-plugin": "^3.2.0",
|
|
53
53
|
"dotenv": "^10.0.0",
|
|
54
54
|
"dotenv-expand": "^5.1.0",
|
|
55
|
-
"dtable-store": "
|
|
55
|
+
"dtable-store": "4.3.6",
|
|
56
56
|
"dtable-ui-component": "~5.0.11",
|
|
57
57
|
"dtable-utils": "5.0.0",
|
|
58
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
|
-
};
|