dtable-statistic 5.0.48-alpha.12 → 5.0.48-alpha.14

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
@@ -76,7 +76,6 @@ class Statistic {
76
76
  if (!window.app) return;
77
77
  _resultCacheManager.viewRowsCacheManager.clear();
78
78
  _resultCacheManager.formulaResultsCacheManager.clear();
79
- console.log('unmount');
80
79
  window.app.unmountWidget({
81
80
  animation
82
81
  });
@@ -29,8 +29,9 @@ async function calcViewRowsWithWorker(view, table, value, username, userId, user
29
29
  return [];
30
30
  }
31
31
  const calcWorker = Comlink.wrap(worker);
32
- const cb = () => _dtableStore.Views.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
33
- const rows = await calcWorker(Comlink.proxy(cb));
32
+ // const cb = () => Views.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
33
+ // const rows = await calcWorker(Comlink.proxy(cb));
34
+ const rows = await calcWorker.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
34
35
  _resultCacheManager.viewRowsCacheManager.set(key, rows);
35
36
  _threadManager.default.removeThread(workerId);
36
37
  return rows;
@@ -49,12 +50,9 @@ async function calcFormulaResultsWithWorker(table, rows, value, formulaColumns,
49
50
  return [];
50
51
  }
51
52
  const calcWorker = Comlink.wrap(worker);
52
- const cb = () => _dtableStore.Views.getTableFormulaResults(table, rows, value, formulaColumns, {
53
- username,
54
- userId,
55
- userDepartmentIdsMap
56
- });
57
- const results = await calcWorker(Comlink.proxy(cb));
53
+ // const cb = () => Views.getTableFormulaResults(table, rows, value, formulaColumns, { username, userId, userDepartmentIdsMap });
54
+ // const results = await calcWorker(Comlink.proxy(cb));
55
+ const results = await calcWorker.getTableFormulaResults(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap);
58
56
  _resultCacheManager.formulaResultsCacheManager.set(key, results);
59
57
  _threadManager.default.removeThread(workerId);
60
58
  return results;
@@ -2,7 +2,20 @@
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
4
  var Comlink = _interopRequireWildcard(require("comlink"));
5
- async function calc(callback) {
6
- return callback();
7
- }
8
- Comlink.expose(calc);
5
+ var _dtableStore = require("dtable-store");
6
+ // async function calc(callback) {
7
+ // return callback();
8
+ // }
9
+ const workerFunctions = {
10
+ async getViewRows(view, table, value, username, userId, userDepartmentIdsMap) {
11
+ return _dtableStore.Views.getViewRows(view, table, value, username, userId, userDepartmentIdsMap);
12
+ },
13
+ async getTableFormulaResults(table, rows, value, formulaColumns, username, userId, userDepartmentIdsMap) {
14
+ return _dtableStore.Views.getTableFormulaResults(table, rows, value, formulaColumns, {
15
+ username,
16
+ userId,
17
+ userDepartmentIdsMap
18
+ });
19
+ }
20
+ };
21
+ Comlink.expose(workerFunctions);
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  class ThreadManager {
8
8
  constructor(threadCount) {
9
- this.threadCount = navigator.hardwareConcurrency || 4;
9
+ const supportedThreads = navigator.hardwareConcurrency;
10
+ // prevent the browser from freezing by leaving 3 threads for the main thread
11
+ if (typeof supportedThreads === 'number' && supportedThreads - 3 > 0) {
12
+ this.threadCount = supportedThreads - 3;
13
+ } else {
14
+ this.threadCount = 2;
15
+ }
10
16
  this.threadList = [];
11
17
  this.queue = [];
12
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-statistic",
3
- "version": "5.0.48-alpha.12",
3
+ "version": "5.0.48-alpha.14",
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.95-alpha.6"
21
+ "sea-chart": "0.0.95-alpha.6"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "dtable-ui-component": "~5.0.*",