@corbe30/fortune-excel 2.2.6 → 2.3.1
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/README.md
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
|
|
64
64
|
const manualExport = async () => {
|
|
65
65
|
const exportedFile = await transformFortuneToExcel(
|
|
66
|
-
sheetRef
|
|
66
|
+
sheetRef,
|
|
67
67
|
"xlsx", // or "csv"; default = "xlsx"
|
|
68
68
|
true // start automatic download; default = true
|
|
69
69
|
);
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
event.target.files[0], // file type (csv/xlsx) is automatically identified
|
|
81
81
|
setSheets,
|
|
82
82
|
setKey,
|
|
83
|
-
sheetRef
|
|
83
|
+
sheetRef
|
|
84
84
|
)
|
|
85
85
|
}
|
|
86
86
|
```
|
|
@@ -79,7 +79,7 @@ function exportSheetExcel(luckysheetRef, fileType, download) {
|
|
|
79
79
|
return __generator(this, function (_a) {
|
|
80
80
|
switch (_a.label) {
|
|
81
81
|
case 0:
|
|
82
|
-
luckysheet = luckysheetRef.getAllSheets();
|
|
82
|
+
luckysheet = luckysheetRef.current.getAllSheets();
|
|
83
83
|
workbook = new exceljs_1.default.Workbook();
|
|
84
84
|
luckysheet.every(function (table) {
|
|
85
85
|
var _a, _b;
|
|
@@ -107,7 +107,7 @@ function exportSheetExcel(luckysheetRef, fileType, download) {
|
|
|
107
107
|
_a.label = 4;
|
|
108
108
|
case 4:
|
|
109
109
|
if (download)
|
|
110
|
-
fileSaver.saveAs(fileData, "".concat(luckysheetRef.getSheet().name, ".").concat(fileType));
|
|
110
|
+
fileSaver.saveAs(fileData, "".concat(luckysheetRef.current.getSheet().name, ".").concat(fileType));
|
|
111
111
|
return [2 /*return*/, fileData];
|
|
112
112
|
}
|
|
113
113
|
});
|
|
@@ -49,7 +49,7 @@ var ExportHelper = function (props) {
|
|
|
49
49
|
exportHelper.style.visibility = "hidden";
|
|
50
50
|
};
|
|
51
51
|
var onClick = function (fileType) {
|
|
52
|
-
(0, Transform_1.transformFortuneToExcel)(sheetRef
|
|
52
|
+
(0, Transform_1.transformFortuneToExcel)(sheetRef, fileType, true);
|
|
53
53
|
onMouseLeave();
|
|
54
54
|
};
|
|
55
55
|
return (react_1.default.createElement("div", { className: "export-helper", style: exportHelperStyle, onMouseLeave: onMouseLeave },
|
|
@@ -49,7 +49,7 @@ var ImportHelper = function (props) {
|
|
|
49
49
|
var _a, _b;
|
|
50
50
|
return __generator(this, function (_c) {
|
|
51
51
|
switch (_c.label) {
|
|
52
|
-
case 0: return [4 /*yield*/, (0, Transform_1.transformExcelToFortune)((_b = (_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0], setSheets, setKey, sheetRef
|
|
52
|
+
case 0: return [4 /*yield*/, (0, Transform_1.transformExcelToFortune)((_b = (_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0], setSheets, setKey, sheetRef)];
|
|
53
53
|
case 1:
|
|
54
54
|
_c.sent();
|
|
55
55
|
return [2 /*return*/];
|
package/dist/common/Transform.js
CHANGED
|
@@ -113,11 +113,12 @@ var transformExcelToFortune = function (file, setSheets, setKey, sheetRef) { ret
|
|
|
113
113
|
setSheets(lsh.sheets);
|
|
114
114
|
setKey(function (k) { return k + 1; });
|
|
115
115
|
setTimeout(function () {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
var _a, _b, _c, _d;
|
|
117
|
+
for (var _i = 0, _e = lsh.sheets; _i < _e.length; _i++) {
|
|
118
|
+
var sheet = _e[_i];
|
|
118
119
|
var config = sheet.config;
|
|
119
|
-
sheetRef.setColumnWidth((config === null || config === void 0 ? void 0 : config.columnlen) || {}, { id: sheet.id });
|
|
120
|
-
sheetRef.setRowHeight((config === null || config === void 0 ? void 0 : config.rowlen) || {}, { id: sheet.id });
|
|
120
|
+
(_b = (_a = sheetRef === null || sheetRef === void 0 ? void 0 : sheetRef.current) === null || _a === void 0 ? void 0 : _a.setColumnWidth) === null || _b === void 0 ? void 0 : _b.call(_a, (config === null || config === void 0 ? void 0 : config.columnlen) || {}, { id: sheet.id });
|
|
121
|
+
(_d = (_c = sheetRef === null || sheetRef === void 0 ? void 0 : sheetRef.current) === null || _c === void 0 ? void 0 : _c.setRowHeight) === null || _d === void 0 ? void 0 : _d.call(_c, (config === null || config === void 0 ? void 0 : config.rowlen) || {}, { id: sheet.id });
|
|
121
122
|
}
|
|
122
123
|
}, 1);
|
|
123
124
|
return [2 /*return*/];
|