@things-factory/export-ui-excel 4.3.122 → 4.3.123
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/client/bootstrap.js +9 -7
- package/package.json +2 -2
package/client/bootstrap.js
CHANGED
|
@@ -62,7 +62,8 @@ async function objDataToExcel({ extension, name, data }) {
|
|
|
62
62
|
return {
|
|
63
63
|
header: column.header || '',
|
|
64
64
|
key: column.key || '',
|
|
65
|
-
width: column.width ? column.width : column.header.length < 12 ? 12 : column.header.length
|
|
65
|
+
width: column.width ? column.width : column.header.length < 12 ? 12 : column.header.length,
|
|
66
|
+
rowCount: column.rowCount || false
|
|
66
67
|
}
|
|
67
68
|
})
|
|
68
69
|
]
|
|
@@ -109,7 +110,8 @@ async function objDataToExcel({ extension, name, data }) {
|
|
|
109
110
|
printData,
|
|
110
111
|
records.groups.map(itm => itm.column),
|
|
111
112
|
records.groups,
|
|
112
|
-
records.totals
|
|
113
|
+
records.totals,
|
|
114
|
+
header
|
|
113
115
|
)
|
|
114
116
|
} else {
|
|
115
117
|
printData = printData.map(row => {
|
|
@@ -262,7 +264,7 @@ export default function bootstrap() {
|
|
|
262
264
|
})
|
|
263
265
|
}
|
|
264
266
|
|
|
265
|
-
function multiGroupTree(array, groups, groupsRaw, totals) {
|
|
267
|
+
function multiGroupTree(array, groups, groupsRaw, totals, header) {
|
|
266
268
|
if (!groups) {
|
|
267
269
|
return array
|
|
268
270
|
}
|
|
@@ -301,7 +303,7 @@ function multiGroupTree(array, groups, groupsRaw, totals) {
|
|
|
301
303
|
|
|
302
304
|
totals.forEach(total => {
|
|
303
305
|
sumData.data[total] = grouping[itm].reduce((acc, obj) => {
|
|
304
|
-
acc = acc + (parseFloat(obj
|
|
306
|
+
acc = acc + ((header.find(x => x.key == total)?.rowCount ? 1 : parseFloat(obj?.data[total])) || 0)
|
|
305
307
|
return acc
|
|
306
308
|
}, 0)
|
|
307
309
|
})
|
|
@@ -319,7 +321,7 @@ function multiGroupTree(array, groups, groupsRaw, totals) {
|
|
|
319
321
|
let result = transform(
|
|
320
322
|
grouping,
|
|
321
323
|
(result, value, key) => {
|
|
322
|
-
let rows = multiGroupTree(value, restGroups, groupsRaw, totals)
|
|
324
|
+
let rows = multiGroupTree(value, restGroups, groupsRaw, totals, header)
|
|
323
325
|
|
|
324
326
|
let currentGroupSetting = groupsRaw.filter(x => x.column === currentGroup)[0]
|
|
325
327
|
|
|
@@ -335,7 +337,7 @@ function multiGroupTree(array, groups, groupsRaw, totals) {
|
|
|
335
337
|
|
|
336
338
|
totals.forEach(total => {
|
|
337
339
|
sumData.data[total] = value.reduce((acc, obj) => {
|
|
338
|
-
acc = acc +
|
|
340
|
+
acc = acc + parseFloat(obj[total]) || 0
|
|
339
341
|
return acc
|
|
340
342
|
}, 0)
|
|
341
343
|
})
|
|
@@ -407,7 +409,7 @@ function stripObject(source) {
|
|
|
407
409
|
? null
|
|
408
410
|
: t == 'object'
|
|
409
411
|
? stripObject(source[key])
|
|
410
|
-
: { string: '', number:
|
|
412
|
+
: { string: '', number: '', boolean: '' }[t]
|
|
411
413
|
}
|
|
412
414
|
}
|
|
413
415
|
return o
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/export-ui-excel",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.123",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"file-saver": "^2.0.2",
|
|
32
32
|
"xlsx": "^0.16.8"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "4b257504bfc8c0a626dd90dc0216abb7ca30d8d3"
|
|
35
35
|
}
|