rapid-spreadjs 1.0.21 → 1.0.23
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/dist/index.cjs.js +49 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +49 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/utils/common.d.ts +6 -0
- package/dist/utils/wookbook.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -25,27 +25,6 @@ function _interopNamespaceDefault(e) {
|
|
|
25
25
|
var echarts__namespace = /*#__PURE__*/_interopNamespaceDefault(echarts);
|
|
26
26
|
var math__namespace = /*#__PURE__*/_interopNamespaceDefault(math);
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* 公用工具函数属性
|
|
30
|
-
*/
|
|
31
|
-
const CommonUtils = {
|
|
32
|
-
/**
|
|
33
|
-
* 获取列的英文字母
|
|
34
|
-
* @param colIndex 列的索引
|
|
35
|
-
* @returns 返回英文字母
|
|
36
|
-
*/
|
|
37
|
-
getColLetterName: (colIndex) => {
|
|
38
|
-
colIndex += 1;
|
|
39
|
-
let letter = "";
|
|
40
|
-
while (colIndex > 0) {
|
|
41
|
-
const remainder = (colIndex - 1) % 26;
|
|
42
|
-
letter = String.fromCharCode(remainder + 65) + letter;
|
|
43
|
-
colIndex = Math.floor((colIndex - 1) / 26);
|
|
44
|
-
}
|
|
45
|
-
return letter.toUpperCase();
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
28
|
/******************************************************************************
|
|
50
29
|
Copyright (c) Microsoft Corporation.
|
|
51
30
|
|
|
@@ -78,6 +57,45 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
78
57
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
79
58
|
};
|
|
80
59
|
|
|
60
|
+
/**
|
|
61
|
+
* 公用工具函数属性
|
|
62
|
+
*/
|
|
63
|
+
const CommonUtils = {
|
|
64
|
+
/**
|
|
65
|
+
* 获取文件的字节流对象
|
|
66
|
+
* @param fileUrl 在线文件地址
|
|
67
|
+
* @returns 文件的字节流对象
|
|
68
|
+
*/
|
|
69
|
+
getFileBlob: (fileUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
// 获取文件响应结果
|
|
71
|
+
const response = yield fetch(fileUrl, { method: 'GET' });
|
|
72
|
+
// 获取成功
|
|
73
|
+
if (response.ok) {
|
|
74
|
+
// 文件的字节流对象
|
|
75
|
+
const blob = yield response.blob();
|
|
76
|
+
return blob;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}),
|
|
82
|
+
/**
|
|
83
|
+
* 获取列的英文字母
|
|
84
|
+
* @param colIndex 列的索引
|
|
85
|
+
* @returns 返回英文字母
|
|
86
|
+
*/
|
|
87
|
+
getColLetterName: (colIndex) => {
|
|
88
|
+
colIndex += 1;
|
|
89
|
+
let letter = '';
|
|
90
|
+
while (colIndex > 0) {
|
|
91
|
+
const remainder = (colIndex - 1) % 26;
|
|
92
|
+
letter = String.fromCharCode(remainder + 65) + letter;
|
|
93
|
+
colIndex = Math.floor((colIndex - 1) / 26);
|
|
94
|
+
}
|
|
95
|
+
return letter.toUpperCase();
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
81
99
|
/**
|
|
82
100
|
* 公用方法,如:修约计算等
|
|
83
101
|
*/
|
|
@@ -7787,18 +7805,22 @@ const WorkbookUtils = {
|
|
|
7787
7805
|
// 文件的字节流对象
|
|
7788
7806
|
const blob = yield response.blob();
|
|
7789
7807
|
// 将Blob转换为File或Blob对象
|
|
7790
|
-
new File([blob], 'template.sjs', { type: 'application/octet-stream' });
|
|
7808
|
+
// const file = new File([blob], 'template.sjs', { type: 'application/octet-stream' });
|
|
7791
7809
|
const sjsBlob = new Blob([blob], { type: 'application/zip' });
|
|
7792
7810
|
// SpreadJS打开文件
|
|
7793
|
-
spread.open(sjsBlob, () => {
|
|
7811
|
+
spread.open(sjsBlob, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7794
7812
|
if (typeof succFunc === 'function') {
|
|
7795
|
-
succFunc(spread);
|
|
7813
|
+
yield succFunc(spread);
|
|
7814
|
+
// // 或者使用then回调
|
|
7815
|
+
// succFunc(spread).then((ret) => {
|
|
7816
|
+
// // return ret;
|
|
7817
|
+
// });
|
|
7796
7818
|
}
|
|
7797
|
-
}, (e) => {
|
|
7819
|
+
}), (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7798
7820
|
if (typeof errorFunc === 'function') {
|
|
7799
|
-
errorFunc(e);
|
|
7821
|
+
yield errorFunc(e);
|
|
7800
7822
|
}
|
|
7801
|
-
});
|
|
7823
|
+
}));
|
|
7802
7824
|
}
|
|
7803
7825
|
}),
|
|
7804
7826
|
/**
|