easybill-ui 1.0.2 → 1.0.4
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.
|
@@ -321,7 +321,10 @@ const onMenuOption = (optionKey: MenuEventKey, val: string) => {
|
|
|
321
321
|
return curs.join(",")
|
|
322
322
|
}
|
|
323
323
|
if (schema.formatter) {
|
|
324
|
-
|
|
324
|
+
let result = schema.formatter(row, schema, val, i) as string
|
|
325
|
+
if (/^[0-9\.,+-]+.[0-9]{2}$/.test(String(result))) {
|
|
326
|
+
result = +parseFloat(String(result).replace(/,|$|¥/g, ""))
|
|
327
|
+
}
|
|
325
328
|
return result === "--" ? "" : result
|
|
326
329
|
}
|
|
327
330
|
return val
|
|
@@ -34,12 +34,12 @@ const tableToExcel = (function () {
|
|
|
34
34
|
" padding:2px 5px;" +
|
|
35
35
|
" text-align: center;" +
|
|
36
36
|
" }" +
|
|
37
|
-
".text-column{" +
|
|
38
|
-
" mso-number-format:'@'; " +
|
|
39
|
-
"}" +
|
|
40
37
|
"</style>" +
|
|
41
38
|
'</head><body ><table class="excelTable">{table}</table></body></html>',
|
|
42
39
|
base64 = function (s: string) {
|
|
40
|
+
const encoder = new TextEncoder()
|
|
41
|
+
const utf8Array = encoder.encode(s) as any
|
|
42
|
+
return btoa(String.fromCharCode.apply(null, utf8Array))
|
|
43
43
|
return window.btoa(decodeURIComponent(encodeURIComponent(s)))
|
|
44
44
|
},
|
|
45
45
|
format = function (s: string, c: any) {
|
|
@@ -54,18 +54,13 @@ const tableToExcel = (function () {
|
|
|
54
54
|
return `<tr>${td}</tr>`
|
|
55
55
|
})
|
|
56
56
|
.join("")
|
|
57
|
-
// console.log("tableStr", tableStr)
|
|
58
|
-
// var textColumns = getByClassName(table, "text-column")
|
|
59
|
-
// for (var i = 0; i < textColumns.length; i++) {
|
|
60
|
-
// textColumns[i].setAttribute("style", "mso-number-format:\\@;")
|
|
61
|
-
// }
|
|
62
57
|
|
|
63
58
|
setTimeout(() => {
|
|
64
59
|
const ctx = { worksheet: worksheetName || "Worksheet", table: tableStr }
|
|
65
60
|
// window.location.href = uri + base64(format(template, ctx)) ;
|
|
66
61
|
const a = document.createElement("a")
|
|
67
62
|
a.href = uri + base64(format(template, ctx))
|
|
68
|
-
console.log(format(template, ctx))
|
|
63
|
+
// console.log(format(template, ctx))
|
|
69
64
|
a.download = filename
|
|
70
65
|
a.click()
|
|
71
66
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easybill-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A component library for easybill",
|
|
5
5
|
"author": "tuchongyang <779311998@qq.com>",
|
|
6
6
|
"private": false,
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "ccc07a4f78838145cd25b92ebcaac8823569ed7b"
|
|
18
18
|
}
|