@fileverse-dev/dsheet 1.2.92-ydoc-4 → 1.2.92-ydoc-5

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.es.js CHANGED
@@ -268483,8 +268483,10 @@ const naa = (e) => {
268483
268483
  }, iaa = async (e, t, r, i) => {
268484
268484
  if (!(!e.current || !t.current))
268485
268485
  try {
268486
- const a = t.current.getArray(r), s = Array.from(a), o = e.current.getAllSheets(), f = G7.utils.book_new();
268487
- s.forEach((c, u) => {
268486
+ const a = t.current.getArray(r), s = Array.from(a);
268487
+ console.log("sheetData", s);
268488
+ const o = e.current.getAllSheets(), f = G7.utils.book_new();
268489
+ o.forEach((c, u) => {
268488
268490
  var p, h, b, g;
268489
268491
  const d = ((p = o[u]) == null ? void 0 : p.data) || [], v = G7.utils.aoa_to_sheet(d);
268490
268492
  v["!merges"] = [], (h = c.config) != null && h.merge && Object.values(c.config.merge).forEach((y) => {
@@ -268567,15 +268569,24 @@ const naa = (e) => {
268567
268569
  console.error("CSV export failed:", r);
268568
268570
  }
268569
268571
  }, laa = (e, t, r) => {
268570
- var i;
268571
268572
  if (!(!e.current || !t.current))
268572
268573
  try {
268573
- const n = (i = t.current) == null ? void 0 : i.getArray(r), a = n ? Array.from(n) : [], s = new Blob([JSON.stringify(a, null, 2)], {
268574
+ const i = e.current.getAllSheets();
268575
+ console.log("sheetArray export json", r);
268576
+ const n = i ? Array.from(i) : [];
268577
+ console.log("allSheets", n);
268578
+ const a = [...n].map((l) => {
268579
+ var u;
268580
+ const c = { ...l };
268581
+ return c.celldata = (u = e == null ? void 0 : e.current) == null ? void 0 : u.dataToCelldata(l == null ? void 0 : l.data), console.log("sheet", l), delete c.data, c;
268582
+ });
268583
+ console.log("allSheets", a);
268584
+ const s = new Blob([JSON.stringify(a, null, 2)], {
268574
268585
  type: "application/json"
268575
268586
  }), o = URL.createObjectURL(s), f = document.createElement("a");
268576
268587
  f.href = o, f.download = "spreadsheet.json", document.body.appendChild(f), f.click(), document.body.removeChild(f), URL.revokeObjectURL(o);
268577
- } catch (n) {
268578
- console.error("Error exporting to JSON:", n);
268588
+ } catch (i) {
268589
+ console.error("Error exporting to JSON:", i);
268579
268590
  }
268580
268591
  };
268581
268592
  var P4e = { exports: {} };
@@ -1,7 +1,6 @@
1
1
  import { Sheet } from '@fileverse-dev/fortune-react';
2
2
  import * as Y from 'yjs';
3
3
  export declare function migrateSheetArrayIfNeeded(ydoc: Y.Doc, sheetArray: Y.Array<any>): void;
4
- export declare function migrateSheetArrayForImport(sheets: Sheet[]): Y.Map<any>[];
5
4
  type SheetFactory = () => Y.Map<any>;
6
- export declare function migrateSheetFactory(sheet: Sheet | Y.Map<any>): SheetFactory;
5
+ export declare function migrateSheetFactoryForImport(sheet: Sheet | Y.Map<any>): SheetFactory;
7
6
  export {};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "1.2.92-ydoc-4",
5
+ "version": "1.2.92-ydoc-5",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {