dtable-statistic 5.1.17-alpha.1 → 5.1.17
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.
|
@@ -224,11 +224,11 @@ const exportOneDimensionToTable = _ref => {
|
|
|
224
224
|
type: _dtableUtils.CellType.NUMBER,
|
|
225
225
|
name: _reactIntlUniversal.default.get('Total'),
|
|
226
226
|
data: {
|
|
227
|
-
decimal:
|
|
227
|
+
decimal: "dot",
|
|
228
228
|
enable_precision: false,
|
|
229
|
-
format:
|
|
229
|
+
format: "yuan",
|
|
230
230
|
precision: 2,
|
|
231
|
-
thousands:
|
|
231
|
+
thousands: "no"
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
columnMap['total'] = totalColumn;
|
|
@@ -24,21 +24,13 @@ async function calcViewRowsWithWorker(view, table, value, username, userId, user
|
|
|
24
24
|
if (!_resultCacheManager.cachedBase) {
|
|
25
25
|
(0, _resultCacheManager.initCachedBase)(value);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
const idRowMap = table.id_row_map;
|
|
29
|
-
const clonedTable = (0, _lodashEs.cloneDeepWith)(table, (value, key) => {
|
|
30
|
-
if (key === 'rows' || key === 'id_row_map') {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
27
|
+
const clonedTable = (0, _lodashEs.cloneDeep)(table);
|
|
34
28
|
// Symbol can't passed to workers
|
|
35
29
|
clonedTable.columns = clonedTable.columns.map(c => {
|
|
36
|
-
c.editor
|
|
37
|
-
c.formatter
|
|
30
|
+
delete c.editor;
|
|
31
|
+
delete c.formatter;
|
|
38
32
|
return c;
|
|
39
33
|
});
|
|
40
|
-
clonedTable.rows = tableRows;
|
|
41
|
-
clonedTable.id_row_map = idRowMap;
|
|
42
34
|
const workerId = uuid();
|
|
43
35
|
let worker;
|
|
44
36
|
try {
|
|
@@ -46,12 +38,7 @@ async function calcViewRowsWithWorker(view, table, value, username, userId, user
|
|
|
46
38
|
} catch (e) {
|
|
47
39
|
return [];
|
|
48
40
|
}
|
|
49
|
-
const
|
|
50
|
-
requestAnimationFrame(() => {
|
|
51
|
-
resolve(Comlink.wrap(worker));
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
const calcWorker = await getWorker();
|
|
41
|
+
const calcWorker = Comlink.wrap(worker);
|
|
55
42
|
const rows = await calcWorker.getViewRows(view, clonedTable, _resultCacheManager.cachedBase, username, userId, userDepartmentIdsMap);
|
|
56
43
|
if (rows && Object.keys(rows).length) {
|
|
57
44
|
_resultCacheManager.viewRowsCacheManager.set(key, rows);
|
|
@@ -68,25 +55,17 @@ async function calcFormulaResultsWithWorker(table, rows, value, formulaColumns,
|
|
|
68
55
|
if (!_resultCacheManager.cachedBase) {
|
|
69
56
|
(0, _resultCacheManager.initCachedBase)(value);
|
|
70
57
|
}
|
|
71
|
-
const
|
|
72
|
-
const idRowMap = table.id_row_map;
|
|
73
|
-
const clonedTable = (0, _lodashEs.cloneDeepWith)(table, (value, key) => {
|
|
74
|
-
if (key === 'rows' || key === 'id_row_map') {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
58
|
+
const clonedTable = (0, _lodashEs.cloneDeep)(table);
|
|
78
59
|
// Symbol can't passed to workers
|
|
79
60
|
clonedTable.columns = clonedTable.columns.map(c => {
|
|
80
|
-
c.editor
|
|
81
|
-
c.formatter
|
|
61
|
+
delete c.editor;
|
|
62
|
+
delete c.formatter;
|
|
82
63
|
return c;
|
|
83
64
|
});
|
|
84
|
-
clonedTable.rows = tableRows;
|
|
85
|
-
clonedTable.id_row_map = idRowMap;
|
|
86
65
|
let clonedFormulaColumns = (0, _lodashEs.cloneDeep)(formulaColumns);
|
|
87
66
|
clonedFormulaColumns = clonedFormulaColumns.map(c => {
|
|
88
|
-
c.editor
|
|
89
|
-
c.formatter
|
|
67
|
+
delete c.editor;
|
|
68
|
+
delete c.formatter;
|
|
90
69
|
return c;
|
|
91
70
|
});
|
|
92
71
|
const workerId = uuid();
|
|
@@ -96,12 +75,7 @@ async function calcFormulaResultsWithWorker(table, rows, value, formulaColumns,
|
|
|
96
75
|
} catch (e) {
|
|
97
76
|
return [];
|
|
98
77
|
}
|
|
99
|
-
const
|
|
100
|
-
requestAnimationFrame(() => {
|
|
101
|
-
resolve(Comlink.wrap(worker));
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
const calcWorker = await getWorker();
|
|
78
|
+
const calcWorker = Comlink.wrap(worker);
|
|
105
79
|
const results = await calcWorker.getTableFormulaResults(clonedTable, rows, _resultCacheManager.cachedBase, clonedFormulaColumns, username, userId, userDepartmentIdsMap);
|
|
106
80
|
if (results && Object.keys(results).length) {
|
|
107
81
|
_resultCacheManager.formulaResultsCacheManager.set(key, results);
|
|
@@ -27,27 +27,24 @@ const viewRowsCacheManager = exports.viewRowsCacheManager = new ResultCacheManag
|
|
|
27
27
|
const formulaResultsCacheManager = exports.formulaResultsCacheManager = new ResultCacheManager();
|
|
28
28
|
let cachedBase = exports.cachedBase = null;
|
|
29
29
|
function initCachedBase(value) {
|
|
30
|
+
// don't clone rows cause they are really big
|
|
30
31
|
const tableIdRowMap = {};
|
|
31
32
|
value.tables.forEach(t => {
|
|
32
|
-
tableIdRowMap[t._id] =
|
|
33
|
-
|
|
34
|
-
id_row_map: t === null || t === void 0 ? void 0 : t.id_row_map
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
// don't clone rows cause they are really big
|
|
38
|
-
const clonedBase = (0, _lodashEs.cloneDeepWith)(value, (v, k) => {
|
|
39
|
-
if (k === 'rows' || k === 'id_row_map') {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
33
|
+
tableIdRowMap[t._id] = t === null || t === void 0 ? void 0 : t.rows;
|
|
34
|
+
t.rows && delete t.rows;
|
|
42
35
|
});
|
|
36
|
+
const clonedBase = (0, _lodashEs.cloneDeep)(value);
|
|
43
37
|
clonedBase.tables.forEach(t => {
|
|
38
|
+
// delete symbols
|
|
44
39
|
t.columns = t.columns.map(c => {
|
|
45
|
-
c.editor
|
|
46
|
-
c.formatter
|
|
40
|
+
delete c.editor;
|
|
41
|
+
delete c.formatter;
|
|
47
42
|
return c;
|
|
48
43
|
});
|
|
49
|
-
t.rows = tableIdRowMap[t._id]
|
|
50
|
-
|
|
44
|
+
t.rows = tableIdRowMap[t._id];
|
|
45
|
+
});
|
|
46
|
+
value.tables.forEach(t => {
|
|
47
|
+
t.rows = tableIdRowMap[t._id];
|
|
51
48
|
});
|
|
52
49
|
exports.cachedBase = cachedBase = clonedBase;
|
|
53
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "5.1.17
|
|
3
|
+
"version": "5.1.17",
|
|
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": "^1.1.
|
|
21
|
+
"sea-chart": "^1.1.21"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"dtable-ui-component": "~5.1.*",
|