@fileverse-dev/dsheet 0.0.102 → 0.0.103

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
@@ -169893,12 +169893,12 @@ const N6t = 10, B6t = 1.5, R6t = "[object Promise]", L6t = "Loading...", U6t = "
169893
169893
  formulaResponseUiSync: nq
169894
169894
  });
169895
169895
  }, V6t = async (e, r) => {
169896
- var t, a, n, o, i, s;
169896
+ var t, a, n, o, i, s, u;
169897
169897
  try {
169898
- const u = await e;
169899
- if (typeof u == "string" && u.includes("Error")) {
169898
+ const l = await e;
169899
+ if (typeof l == "string" && l.includes("Error")) {
169900
169900
  iq(
169901
- u,
169901
+ l,
169902
169902
  r.sheetEditorRef,
169903
169903
  r.row,
169904
169904
  r.column,
@@ -169906,15 +169906,15 @@ const N6t = 10, B6t = 1.5, R6t = "[object Promise]", L6t = "Loading...", U6t = "
169906
169906
  );
169907
169907
  return;
169908
169908
  }
169909
- if (typeof u == "string" && u.includes("RATE_LIMIT_REACHED") && r.dataBlockApiKeyHandler) {
169910
- W6t(u, r.dataBlockApiKeyHandler, r);
169909
+ if (typeof l == "string" && l.includes("RATE_LIMIT_REACHED") && r.dataBlockApiKeyHandler) {
169910
+ W6t(l, r.dataBlockApiKeyHandler, r);
169911
169911
  return;
169912
169912
  }
169913
- Array.isArray(u) ? oq(u, r) : qC(u, r);
169914
- const l = (t = r.sheetEditorRef.current) == null ? void 0 : t.getWorkbookContext(), c = (o = (n = (a = r.newValue) == null ? void 0 : a.f) == null ? void 0 : n.match(/^=([A-Z0-9_]+)\s*\(/)) == null ? void 0 : o[1], f = (i = l == null ? void 0 : l.formulaCache.functionlistMap[c || ""]) == null ? void 0 : i.API_KEY;
169915
- (s = r.storeApiKey) == null || s.call(r, f);
169916
- } catch (u) {
169917
- console.error("Error processing regular promise:", u), qC("Error processing data", r);
169913
+ Array.isArray(l) ? oq(l, r) : qC(l, r);
169914
+ const c = (t = r.sheetEditorRef.current) == null ? void 0 : t.getWorkbookContext(), f = (o = (n = (a = r.newValue) == null ? void 0 : a.f) == null ? void 0 : n.match(/^=([A-Z0-9_]+)\s*\(/)) == null ? void 0 : o[1], d = (i = c == null ? void 0 : c.formulaCache.functionlistMap[f || ""]) == null ? void 0 : i.API_KEY;
169915
+ (s = r.storeApiKey) == null || s.call(r, d), (u = r.onDataBlockApiResponse) == null || u.call(r, f);
169916
+ } catch (l) {
169917
+ console.error("Error processing regular promise:", l), qC("Error processing data", r);
169918
169918
  }
169919
169919
  }, K6t = async (e, r) => {
169920
169920
  var i, s, u;
@@ -217414,37 +217414,40 @@ const Xwt = ({
217414
217414
  setExportDropdownOpen: d = () => {
217415
217415
  },
217416
217416
  dsheetId: h,
217417
- storeApiKey: p
217417
+ storeApiKey: p,
217418
+ onDataBlockApiResponse: m,
217419
+ onDuneChartEmbed: v,
217420
+ onSheetCountChange: g
217418
217421
  }) => {
217419
217422
  const {
217420
- sheetEditorRef: m,
217421
- ydocRef: v,
217422
- currentDataRef: g,
217423
- handleChange: y,
217424
- forceSheetRender: b,
217425
- setForceSheetRender: F,
217426
- syncStatus: w
217427
- } = oI(), { handleXLSXUpload: A } = Xwt({
217428
- sheetEditorRef: m,
217429
- ydocRef: v,
217430
- setForceSheetRender: F,
217423
+ sheetEditorRef: y,
217424
+ ydocRef: b,
217425
+ currentDataRef: F,
217426
+ handleChange: w,
217427
+ forceSheetRender: A,
217428
+ setForceSheetRender: I,
217429
+ syncStatus: x
217430
+ } = oI(), { handleXLSXUpload: N } = Xwt({
217431
+ sheetEditorRef: y,
217432
+ ydocRef: b,
217433
+ setForceSheetRender: I,
217431
217434
  dsheetId: h,
217432
- currentDataRef: g
217433
- }), I = a ? n ? ["comment"] : [] : cJ, x = a ? ["filter"] : uJ, N = a ? n ? ["filter", "comment"] : ["filter"] : sJ;
217435
+ currentDataRef: F
217436
+ }), D = a ? n ? ["comment"] : [] : cJ, j = a ? ["filter"] : uJ, O = a ? n ? ["filter", "comment"] : ["filter"] : sJ;
217434
217437
  return ea(() => {
217435
- const D = `workbook-${h}-${b}`, j = g.current && g.current.length > 0 ? g.current : a ? [] : WE;
217438
+ const S = `workbook-${h}-${A}`, B = F.current && F.current.length > 0 ? F.current : a ? [] : WE;
217436
217439
  return (
217437
217440
  // @ts-ignore
217438
217441
  /* @__PURE__ */ cr.jsx(
217439
217442
  C6t,
217440
217443
  {
217441
- ref: m,
217442
- data: j,
217443
- toolbarItems: N,
217444
- cellContextMenu: I,
217445
- headerContextMenu: x,
217444
+ ref: y,
217445
+ data: B,
217446
+ toolbarItems: O,
217447
+ cellContextMenu: D,
217448
+ headerContextMenu: j,
217446
217449
  getCommentCellUI: f,
217447
- onChange: y,
217450
+ onChange: w,
217448
217451
  showFormulaBar: !0,
217449
217452
  showToolbar: !0,
217450
217453
  lang: "en",
@@ -217455,44 +217458,47 @@ const Xwt = ({
217455
217458
  customToolbarItems: a ? [] : E6t({
217456
217459
  setExportDropdownOpen: d,
217457
217460
  handleCSVUpload: r5t,
217458
- handleXLSXUpload: A,
217461
+ handleXLSXUpload: N,
217459
217462
  handleExportToXLSX: Wwt,
217460
217463
  handleExportToCSV: Vwt,
217461
217464
  handleExportToJSON: Kwt,
217462
- sheetEditorRef: m,
217463
- ydocRef: v,
217465
+ sheetEditorRef: y,
217466
+ ydocRef: b,
217464
217467
  dsheetId: h,
217465
- currentDataRef: g,
217466
- setForceSheetRender: F,
217468
+ currentDataRef: F,
217469
+ setForceSheetRender: I,
217467
217470
  toggleTemplateSidebar: o
217468
217471
  }),
217469
217472
  hooks: {
217470
- afterUpdateCell: (O, S, B, k) => {
217471
- console.log("afterUpdateCell Old value", B);
217472
- const T = { current: m.current };
217473
+ afterUpdateCell: (k, T, C, E) => {
217474
+ console.log("afterUpdateCell Old value", C);
217475
+ const M = { current: y.current };
217473
217476
  Q6t({
217474
- row: O,
217475
- column: S,
217476
- newValue: k,
217477
- sheetEditorRef: T,
217477
+ row: k,
217478
+ column: T,
217479
+ newValue: E,
217480
+ sheetEditorRef: M,
217478
217481
  onboardingComplete: i,
217479
217482
  // @ts-ignore
217480
217483
  setFetchingURLData: t,
217481
217484
  onboardingHandler: s,
217482
217485
  dataBlockApiKeyHandler: u,
217483
217486
  storeApiKey: p,
217484
- setInputFetchURLDataBlock: e
217487
+ setInputFetchURLDataBlock: e,
217488
+ onDataBlockApiResponse: m
217485
217489
  });
217486
217490
  }
217487
- }
217491
+ },
217492
+ onDuneChartEmbed: v,
217493
+ onSheetCountChange: g
217488
217494
  },
217489
- D
217495
+ S
217490
217496
  )
217491
217497
  );
217492
217498
  }, [
217493
- b,
217499
+ A,
217494
217500
  a,
217495
- y,
217501
+ w,
217496
217502
  o,
217497
217503
  i,
217498
217504
  s,
@@ -217500,8 +217506,8 @@ const Xwt = ({
217500
217506
  h,
217501
217507
  l,
217502
217508
  c,
217503
- w,
217504
- g.current
217509
+ x,
217510
+ F.current
217505
217511
  ]);
217506
217512
  }, Qwt = [
217507
217513
  {
@@ -292439,32 +292445,35 @@ const Xwt = ({
292439
292445
  selectedTemplate: p,
292440
292446
  setFetchingURLData: m,
292441
292447
  setInputFetchURLDataBlock: v,
292442
- storeApiKey: g
292448
+ storeApiKey: g,
292449
+ onDataBlockApiResponse: y,
292450
+ onDuneChartEmbed: b,
292451
+ onSheetCountChange: F
292443
292452
  }) => {
292444
292453
  const {
292445
- loading: y,
292446
- sheetEditorRef: b,
292447
- currentDataRef: F,
292448
- ydocRef: w,
292449
- setForceSheetRender: A
292454
+ loading: w,
292455
+ sheetEditorRef: A,
292456
+ currentDataRef: I,
292457
+ ydocRef: x,
292458
+ setForceSheetRender: N
292450
292459
  } = oI();
292451
292460
  tAt({
292452
292461
  selectedTemplate: p,
292453
- ydocRef: w,
292462
+ ydocRef: x,
292454
292463
  dsheetId: f,
292455
- currentDataRef: F,
292456
- setForceSheetRender: A,
292457
- sheetEditorRef: b
292464
+ currentDataRef: I,
292465
+ setForceSheetRender: N,
292466
+ sheetEditorRef: A
292458
292467
  }), YK({
292459
292468
  exportDropdownOpen: l,
292460
292469
  isTemplateOpen: u,
292461
292470
  isReadOnly: t,
292462
- loading: y
292471
+ loading: w
292463
292472
  });
292464
- const I = {
292465
- sheetEditorRef: b,
292466
- currentDataRef: F,
292467
- ydocRef: w
292473
+ const D = {
292474
+ sheetEditorRef: A,
292475
+ currentDataRef: I,
292476
+ ydocRef: x
292468
292477
  };
292469
292478
  return /* @__PURE__ */ cr.jsxs(
292470
292479
  "div",
@@ -292485,7 +292494,7 @@ const Xwt = ({
292485
292494
  "translate-y-[-100%]": !1
292486
292495
  }
292487
292496
  ),
292488
- children: r(I)
292497
+ children: r(D)
292489
292498
  }
292490
292499
  ),
292491
292500
  /* @__PURE__ */ cr.jsxs(
@@ -292494,8 +292503,8 @@ const Xwt = ({
292494
292503
  style: { height: "97.8%", marginTop: "44px" },
292495
292504
  className: "relative overflow-hidden",
292496
292505
  children: [
292497
- /* @__PURE__ */ cr.jsx(CS, { show: y, children: /* @__PURE__ */ cr.jsx(rZ, { isReadOnly: t }) }),
292498
- /* @__PURE__ */ cr.jsxs(CS, { show: !y, children: [
292506
+ /* @__PURE__ */ cr.jsx(CS, { show: w, children: /* @__PURE__ */ cr.jsx(rZ, { isReadOnly: t }) }),
292507
+ /* @__PURE__ */ cr.jsxs(CS, { show: !w, children: [
292499
292508
  t && /* @__PURE__ */ cr.jsx("div", { className: "absolute top-2 right-4 z-20", children: /* @__PURE__ */ cr.jsx(rAt, { allowComments: a || !1 }) }),
292500
292509
  /* @__PURE__ */ cr.jsx(
292501
292510
  Jwt,
@@ -292514,7 +292523,10 @@ const Xwt = ({
292514
292523
  setExportDropdownOpen: c,
292515
292524
  dsheetId: f,
292516
292525
  storeApiKey: g,
292517
- allowComments: a
292526
+ allowComments: a,
292527
+ onDataBlockApiResponse: y,
292528
+ onDuneChartEmbed: b,
292529
+ onSheetCountChange: F
292518
292530
  }
292519
292531
  )
292520
292532
  ] })
@@ -292547,9 +292559,11 @@ const Xwt = ({
292547
292559
  setShowFetchURLModal: b,
292548
292560
  setInputFetchURLDataBlock: F,
292549
292561
  sheetEditorRef: w,
292550
- storeApiKey: A
292562
+ storeApiKey: A,
292563
+ onDuneChartEmbed: I,
292564
+ onSheetCountChange: x
292551
292565
  }) => {
292552
- const [I, x] = _t(!1);
292566
+ const [N, D] = _t(!1);
292553
292567
  return /* @__PURE__ */ cr.jsx(
292554
292568
  jJ,
292555
292569
  {
@@ -292578,12 +292592,14 @@ const Xwt = ({
292578
292592
  onboardingHandler: p,
292579
292593
  dataBlockApiKeyHandler: g,
292580
292594
  isTemplateOpen: f,
292581
- exportDropdownOpen: I,
292582
- setExportDropdownOpen: x,
292595
+ exportDropdownOpen: N,
292596
+ setExportDropdownOpen: D,
292583
292597
  dsheetId: o,
292584
292598
  selectedTemplate: l,
292585
292599
  storeApiKey: A,
292586
- allowComments: t
292600
+ allowComments: t,
292601
+ onDuneChartEmbed: I,
292602
+ onSheetCountChange: x
292587
292603
  }
292588
292604
  )
292589
292605
  }
@@ -19,6 +19,9 @@ interface EditorWorkbookProps {
19
19
  setExportDropdownOpen?: React.Dispatch<React.SetStateAction<boolean>>;
20
20
  dsheetId: string;
21
21
  storeApiKey?: (apiKeyName: string) => void;
22
+ onDataBlockApiResponse?: (dataBlockName: string) => void;
23
+ onDuneChartEmbed?: () => void;
24
+ onSheetCountChange?: (sheetCount: number) => void;
22
25
  }
23
26
  /**
24
27
  * EditorWorkbook component handles rendering the Fortune Workbook with proper configuration
@@ -7,5 +7,5 @@ import { DsheetProps } from './types';
7
7
  * @param props - Component properties
8
8
  * @returns The SpreadsheetEditor component
9
9
  */
10
- declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, onboardingComplete, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, }: DsheetProps) => JSX.Element;
10
+ declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, onboardingComplete, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, }: DsheetProps) => JSX.Element;
11
11
  export default SpreadsheetEditor;
@@ -59,4 +59,7 @@ export interface DsheetProps {
59
59
  sheetEditorRef?: RefObject<WorkbookInstance>;
60
60
  storeApiKey?: (apiKeyName: string) => void;
61
61
  allowComments?: boolean;
62
+ onDataBlockApiResponse?: (dataBlockName: string) => void;
63
+ onDuneChartEmbed?: () => void;
64
+ onSheetCountChange?: (sheetCount: number) => void;
62
65
  }
@@ -16,6 +16,7 @@ interface AfterUpdateCellParams {
16
16
  dataBlockApiKeyHandler: DataBlockApiKeyHandlerType | undefined;
17
17
  setInputFetchURLDataBlock: React.Dispatch<React.SetStateAction<string>> | undefined;
18
18
  storeApiKey?: (apiKeyName: string) => void;
19
+ onDataBlockApiResponse?: (dataBlockName: string) => void;
19
20
  }
20
21
  /**
21
22
  * Handles logic after a cell is updated, including processing formula results
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "0.0.102",
5
+ "version": "0.0.103",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -83,4 +83,4 @@
83
83
  "typescript": "^5.2.2",
84
84
  "vite": "^5.0.0"
85
85
  }
86
- }
86
+ }