@corbe30/fortune-excel 1.0.3

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.
Files changed (44) hide show
  1. package/.github/workflows/main.yml +30 -0
  2. package/.github/workflows/publish.yml +30 -0
  3. package/.storybook/main.ts +18 -0
  4. package/.storybook/preview.ts +15 -0
  5. package/LICENSE +21 -0
  6. package/README.md +59 -0
  7. package/dist/HandleZip.d.ts +8 -0
  8. package/dist/HandleZip.js +37 -0
  9. package/dist/ICommon.d.ts +34 -0
  10. package/dist/ICommon.js +1 -0
  11. package/dist/ToExcel/ExcelBorder.d.ts +3 -0
  12. package/dist/ToExcel/ExcelBorder.js +1412 -0
  13. package/dist/ToExcel/ExcelConvert.d.ts +16 -0
  14. package/dist/ToExcel/ExcelConvert.js +92 -0
  15. package/dist/ToExcel/ExcelFile.d.ts +1 -0
  16. package/dist/ToExcel/ExcelFile.js +30 -0
  17. package/dist/ToExcel/ExcelImage.d.ts +2 -0
  18. package/dist/ToExcel/ExcelImage.js +64 -0
  19. package/dist/ToExcel/ExcelStyle.d.ts +3 -0
  20. package/dist/ToExcel/ExcelStyle.js +53 -0
  21. package/dist/ToFortuneSheet/FortuneBase.d.ts +133 -0
  22. package/dist/ToFortuneSheet/FortuneBase.js +28 -0
  23. package/dist/ToFortuneSheet/FortuneCell.d.ts +25 -0
  24. package/dist/ToFortuneSheet/FortuneCell.js +782 -0
  25. package/dist/ToFortuneSheet/FortuneFile.d.ts +50 -0
  26. package/dist/ToFortuneSheet/FortuneFile.js +432 -0
  27. package/dist/ToFortuneSheet/FortuneImage.d.ts +20 -0
  28. package/dist/ToFortuneSheet/FortuneImage.js +51 -0
  29. package/dist/ToFortuneSheet/FortuneSheet.d.ts +36 -0
  30. package/dist/ToFortuneSheet/FortuneSheet.js +581 -0
  31. package/dist/ToFortuneSheet/IFortune.d.ts +301 -0
  32. package/dist/ToFortuneSheet/IFortune.js +1 -0
  33. package/dist/ToFortuneSheet/ReadXml.d.ts +61 -0
  34. package/dist/ToFortuneSheet/ReadXml.js +337 -0
  35. package/dist/common/constant.d.ts +25 -0
  36. package/dist/common/constant.js +277 -0
  37. package/dist/common/emf.d.ts +3 -0
  38. package/dist/common/emf.js +1294 -0
  39. package/dist/common/method.d.ts +132 -0
  40. package/dist/common/method.js +1075 -0
  41. package/dist/main.d.ts +2 -0
  42. package/dist/main.js +24 -0
  43. package/package.json +47 -0
  44. package/tsconfig.json +13 -0
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const transformExcelToFortune: (e: any, setSheets: any, setKey: any, sheetRef: any) => Promise<void>;
2
+ export declare const transformFortuneToExcel: (luckysheetRef: any) => Promise<void>;
package/dist/main.js ADDED
@@ -0,0 +1,24 @@
1
+ import { FortuneFile } from "./ToFortuneSheet/FortuneFile.js";
2
+ import { HandleZip } from "./HandleZip.js";
3
+ import { exportSheetExcel } from "./ToExcel/ExcelFile.js";
4
+ export const transformExcelToFortune = async (e, setSheets, setKey, sheetRef) => {
5
+ const excelFile = await e.target.files[0].arrayBuffer();
6
+ const files = await new HandleZip(excelFile).unzipFile();
7
+ const fortuneFile = new FortuneFile(files, excelFile.name);
8
+ fortuneFile.Parse();
9
+ const lsh = fortuneFile.serialize();
10
+ let config = lsh.sheets[0].config;
11
+ for (let sheet of lsh.sheets) {
12
+ delete sheet.config;
13
+ }
14
+ setSheets(lsh.sheets);
15
+ setKey((k) => k + 1);
16
+ setTimeout(() => {
17
+ var _a, _b;
18
+ (_a = sheetRef.current) === null || _a === void 0 ? void 0 : _a.setColumnWidth((config === null || config === void 0 ? void 0 : config.columnlen) || {});
19
+ (_b = sheetRef.current) === null || _b === void 0 ? void 0 : _b.setRowHeight((config === null || config === void 0 ? void 0 : config.rowlen) || {});
20
+ }, 1);
21
+ };
22
+ export const transformFortuneToExcel = async (luckysheetRef) => {
23
+ await exportSheetExcel(luckysheetRef);
24
+ };
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@corbe30/fortune-excel",
3
+ "version": "1.0.3",
4
+ "description": "An Excel import/export import library for FortuneSheet",
5
+ "main": "dist/main.js",
6
+ "types": "dist/main.d.ts",
7
+ "type": "module",
8
+ "keywords": [
9
+ "fortunesheet",
10
+ "spreadsheet",
11
+ "excel"
12
+ ],
13
+ "author": "shashankc1705@gmail.com",
14
+ "homepage": "https://github.com/Corbe30/FortuneExcel",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/Corbe30/FortuneExcel.git"
18
+ },
19
+ "license": "MIT",
20
+ "devDependencies": {
21
+ "@fortune-sheet/react": "^0.19.2",
22
+ "@storybook/addon-essentials": "^7.6.12",
23
+ "@storybook/addon-interactions": "^7.6.12",
24
+ "@storybook/addon-links": "^7.6.12",
25
+ "@storybook/blocks": "^7.6.12",
26
+ "@storybook/react": "^7.6.12",
27
+ "@storybook/react-vite": "^7.6.12",
28
+ "@storybook/test": "^7.6.12",
29
+ "@types/node": "^20.11.16",
30
+ "react": "^18.2.0",
31
+ "react-dom": "^18.2.0",
32
+ "storybook": "^7.6.16",
33
+ "typescript": "^5.3.3"
34
+ },
35
+ "dependencies": {
36
+ "@types/file-saver": "^2.0.7",
37
+ "dayjs": "^1.11.10",
38
+ "exceljs": "^4.4.0",
39
+ "file-saver": "^2.0.5",
40
+ "jszip": "^3.10.1"
41
+ },
42
+ "scripts": {
43
+ "prepare": "tsc",
44
+ "storybook": "storybook dev -p 6006",
45
+ "build-storybook": "storybook build"
46
+ }
47
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "files": ["src/main.ts"],
3
+ "compilerOptions": {
4
+ "noImplicitAny": true,
5
+ "declaration": true,
6
+ "target": "es2017",
7
+ "outDir": "dist/",
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "module": "node16",
11
+ "moduleResolution": "node16"
12
+ }
13
+ }