@fileverse-dev/dsheet 3.0.1-yjs-15 → 3.0.2-29July-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.
Files changed (37) hide show
  1. package/dist/{constants-Cdz6oSCq.js → constants-Q8nzbvQO.js} +5 -3
  2. package/dist/constants.js +1 -1
  3. package/dist/editor/components/editor-workbook-sync.d.ts +1 -1
  4. package/dist/editor/constants/shared-constants.d.ts +2 -0
  5. package/dist/editor/hooks/use-xlsx-import-impl.d.ts +1 -2
  6. package/dist/editor/hooks/use-xlsx-import.d.ts +1 -2
  7. package/dist/editor/utils/apply-comment-markers.d.ts +22 -0
  8. package/dist/editor/utils/update-ydoc.d.ts +2 -2
  9. package/dist/{executeStringFunction-BHy-_q3d.js → executeStringFunction-C5hEkx9z.js} +9240 -14112
  10. package/dist/formula.js +1 -1
  11. package/dist/{index-OL2_pnvq.js → index-B5OjJYA0.js} +25764 -22624
  12. package/dist/index.es.js +39 -39
  13. package/dist/sheet-engine/core/api/cell.d.ts +20 -0
  14. package/dist/sheet-engine/core/api/common.d.ts +1 -2
  15. package/dist/sheet-engine/core/api/index.d.ts +0 -1
  16. package/dist/sheet-engine/core/api/sheet.d.ts +0 -5
  17. package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +0 -1
  18. package/dist/sheet-engine/core/modules/sheet-metadata-hooks.d.ts +0 -4
  19. package/dist/sheet-engine/core/modules/sheet.d.ts +1 -17
  20. package/dist/sheet-engine/core/settings.d.ts +1 -1
  21. package/dist/sheet-engine/core/types.d.ts +0 -3
  22. package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -8
  23. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -5
  24. package/dist/use-xlsx-import-impl-CevfOsNi.js +1556 -0
  25. package/dist/xlsx-export-impl-CiWHN8hx.js +3138 -0
  26. package/package.json +2 -2
  27. package/dist/editor/hooks/use-celldata-compaction.d.ts +0 -23
  28. package/dist/editor/utils/compact-committed-celldata.d.ts +0 -28
  29. package/dist/editor/utils/config-ydoc-update.d.ts +0 -20
  30. package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +0 -17
  31. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +0 -23
  32. package/dist/sheet-engine/core/utils/border-config-utils.d.ts +0 -16
  33. package/dist/sheet-engine/core/utils/cell-persist-utils.d.ts +0 -10
  34. package/dist/sheet-engine/core/utils/range-format.d.ts +0 -71
  35. package/dist/sheet-engine/core/utils/ydoc-celldata-changes.d.ts +0 -40
  36. package/dist/use-xlsx-import-impl-Bvgo-6F2.js +0 -1554
  37. package/dist/xlsx-export-impl-CxyAa2j_.js +0 -3126
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- import { C as s, a as t, b as o, S as r, d as l, i as d, e as n, T as i, f as c, g as S, h, j as m, k as p, l as C, n as u, o as E, p as F, q as g, s as x, t as R, u as f, v as A, w as L, x as w, z as I, A as T, B as v, D, E as M } from "./index-OL2_pnvq.js";
2
- import { cm as k, cn as V, co as X, ct as z, bj as P, e as U, f as _, l as j, a as y, d2 as B, d3 as O, b2 as G, d4 as H, d5 as q, d9 as J, da as K, dc as N, D as Y, dr as Z, dR as Q, aX as W } from "./executeStringFunction-BHy-_q3d.js";
1
+ import { C as s, a as t, b as o, S as r, d as l, i as n, e as i, T as d, f as S, g as c, h, j as m, k as p, l as C, n as u, o as E, p as F, q as g, s as x, t as R, u as L, v as f, w as A, x as I, z as w, A as T, B as b, D as v, E as M, F as D, G as k, H as V, I as X, J as z, K as P, L as U, M as _, N as y } from "./index-B5OjJYA0.js";
2
+ import { bW as G, bX as H, bY as O, c0 as j, bi as J, e as K, f as N, h as Y, a as q, cm as W, as as Z, cu as Q } from "./executeStringFunction-C5hEkx9z.js";
3
3
  import { FLVURL as ee } from "@fileverse-dev/formulajs";
4
- import { E as se, S as te } from "./constants-Cdz6oSCq.js";
4
+ import { E as se, S as te } from "./constants-Q8nzbvQO.js";
5
5
  export {
6
6
  s as CommentAction,
7
7
  t as CommentCellUI,
@@ -10,50 +10,50 @@ export {
10
10
  l as DSheetSkeleton,
11
11
  se as ERROR_MESSAGES_FLAG,
12
12
  ee as FLVURL,
13
- d as FortuneCore,
13
+ n as FortuneCore,
14
14
  te as SERVICES_API_KEY,
15
- n as SupportedChain,
16
- i as TEMPLATES,
17
- c as api,
18
- k as clearColumnsCellsFormat,
19
- S as clearFilter,
20
- V as clearRowsCellsFormat,
21
- X as clearSelectedCellFormat,
15
+ i as SupportedChain,
16
+ d as TEMPLATES,
17
+ S as api,
18
+ G as clearColumnsCellsFormat,
19
+ c as clearFilter,
20
+ H as clearRowsCellsFormat,
21
+ O as clearSelectedCellFormat,
22
22
  h as createFilter,
23
- z as deleteRowCol,
24
- P as deleteSelectedCellText,
23
+ j as deleteRowCol,
24
+ J as deleteSelectedCellText,
25
25
  m as describeMatchedShortcut,
26
- U as executeStringFunction,
27
- _ as formulaResponseUiSync,
28
- j as getFlowdata,
26
+ K as executeStringFunction,
27
+ N as formulaResponseUiSync,
28
+ Y as getFlowdata,
29
29
  p as getRemoveDuplicatesErrorMessage,
30
30
  C as getRemoveDuplicatesPreview,
31
- y as getSheetIndex,
31
+ q as getSheetIndex,
32
32
  u as handleCSVUpload,
33
33
  E as handleCopy,
34
34
  F as handleExportToCSV,
35
35
  g as handleExportToJSON,
36
36
  x as handleExportToXLSX,
37
- B as handleFreeze,
38
- O as handleHorizontalAlign,
39
- G as handleLink,
40
- H as handleMerge,
41
- R as handlePasteByClick,
42
- q as handleSort,
43
- J as handleTextSize,
44
- K as handleVerticalAlign,
45
- f as importSpreadsheetFile,
46
- N as insertRowCol,
47
- A as isBrowserZoomShortcut,
48
- L as isFormulaListShortcut,
49
- w as isOpenShortcutsModalShortcut,
50
- Y as jfrefreshgrid,
51
- Z as loadLocale,
52
- I as removeActiveImage,
53
- T as removeDuplicates,
54
- v as showImgChooser,
55
- Q as toolbarItemClickHandler,
56
- W as updateFormat,
57
- D as useEnsStatus,
58
- M as useXLSXImport
37
+ R as handleFreeze,
38
+ L as handleHorizontalAlign,
39
+ f as handleLink,
40
+ A as handleMerge,
41
+ I as handlePasteByClick,
42
+ w as handleSort,
43
+ T as handleTextSize,
44
+ b as handleVerticalAlign,
45
+ v as importSpreadsheetFile,
46
+ W as insertRowCol,
47
+ M as isBrowserZoomShortcut,
48
+ D as isFormulaListShortcut,
49
+ k as isOpenShortcutsModalShortcut,
50
+ Z as jfrefreshgrid,
51
+ Q as loadLocale,
52
+ V as removeActiveImage,
53
+ X as removeDuplicates,
54
+ z as showImgChooser,
55
+ P as toolbarItemClickHandler,
56
+ U as updateFormat,
57
+ _ as useEnsStatus,
58
+ y as useXLSXImport
59
59
  };
@@ -6,6 +6,26 @@ export declare function getCellValue(ctx: Context, row: number, column: number,
6
6
  type?: keyof Cell;
7
7
  }): any;
8
8
  export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions, callAfterUpdate?: boolean): void;
9
+ /**
10
+ * Apply a cell value coming from a remote RTC peer, verbatim.
11
+ *
12
+ * This differs from `setCellValue` in two important ways and must be used for
13
+ * every Yjs-driven remote apply:
14
+ *
15
+ * 1. It NEVER runs the formula engine and NEVER fires the local-edit hooks
16
+ * (`onLocalCellEdit` / `afterUpdateCell`). The peer already computed the
17
+ * value, so we use the synced `v`/`m`/`f` as-is. This avoids both
18
+ * recomputation divergence and an update loop back into Yjs.
19
+ *
20
+ * 2. It PRESERVES the formula calc list. The regular `setCellValue` object
21
+ * branch calls `delFunctionGroup`, which removes the cell from `calcChain`
22
+ * and strips its dependency edges. Because `execFunctionGroup` walks
23
+ * `calcChain` to decide what to recompute, dropping a formula cell there
24
+ * permanently breaks its reactivity on that client (even after RTC stops).
25
+ * Here we instead keep formula cells registered via
26
+ * `insertUpdateFunctionGroup`, so they stay reactive to future local edits
27
+ * on both owner and peer.
28
+ */
9
29
  export declare function applyRemoteCellValue(ctx: Context, row: number, column: number, value: any, options?: CommonOptions): void;
10
30
  export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
11
31
  export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
@@ -1,13 +1,12 @@
1
1
  import { Context } from '../context';
2
2
  import { CellMatrix, CellWithRowAndCol, Sheet } from '../types';
3
- import { CellFormatRange } from '../utils/range-format';
4
3
 
5
4
  export type CommonOptions = {
6
5
  index?: number;
7
6
  id?: string;
8
7
  };
9
8
  export declare const dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
10
- export declare const celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number, cellFormatRanges?: CellFormatRange[]) => CellMatrix | null;
9
+ export declare const celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
11
10
  export declare function getSheet(ctx: Context, options?: CommonOptions): Sheet;
12
11
  export declare function getSheetWithLatestCelldata(ctx: Context, options?: CommonOptions): {
13
12
  celldata: CellWithRowAndCol[];
@@ -7,6 +7,5 @@ export * from './rowcol';
7
7
  export * from './range';
8
8
  export * from './merge';
9
9
  export * from './sheet';
10
- export * from './sheet-flowdata-lifecycle';
11
10
  export * from './workbook';
12
11
  export * from '../modules/error-state-helpers';
@@ -5,11 +5,6 @@ import { CellMatrix, Sheet } from '../types';
5
5
  export declare function getAllSheets(ctx: Context): Sheet[];
6
6
  export { getSheet };
7
7
  export declare function initSheetData(draftCtx: Context, index: number, newData: Sheet): CellMatrix | null;
8
- /** Build dense `data` from sparse `celldata` when a sheet is activated or referenced. */
9
- export declare function ensureSheetFlowdata(ctx: Context, options?: {
10
- index?: number;
11
- id?: string;
12
- }): CellMatrix | null;
13
8
  export declare function hideSheet(ctx: Context, sheetId: string): void;
14
9
  export declare function showSheet(ctx: Context, sheetId: string): void;
15
10
  export declare function copySheet(ctx: Context, sheetId: string): void;
@@ -2,7 +2,6 @@ import { Context } from '../context';
2
2
  import { SnapshotEvalInput, SnapshotEvalOutput, SnapshotFormulaCell, evalFormulasInSnapshot } from './formula-snapshot-eval';
3
3
  import { FORMULA_WORKER_CHUNK_SIZE } from './formula-async-eval';
4
4
 
5
- export declare function invalidateFormulaWorkerSnapshot(): void;
6
5
  export declare function buildSnapshotEvalInput(ctx: Context, formulas: SnapshotFormulaCell[]): SnapshotEvalInput;
7
6
  export declare function buildWorkerEvalInput(ctx: Context, formulas: SnapshotFormulaCell[]): Omit<SnapshotEvalInput, 'sheets'>;
8
7
  export declare function initFormulaWorkerSnapshot(ctx: Context, snapshotKey: string): boolean;
@@ -3,9 +3,5 @@ import { Context } from '../context';
3
3
  /**
4
4
  * Defer sheet-level metadata hooks until after React applies Immer updates, so
5
5
  * getSheet() / Yjs diff see dataVerification, CF rules, and hyperlinks from paste/cut.
6
- *
7
- * Capture the hook fns themselves (not `ctx.hooks`): paste runs inside produce,
8
- * and reading a draft `hooks` proxy after it is revoked throws
9
- * "Cannot perform 'get' on a proxy that has been revoked".
10
6
  */
11
7
  export declare function scheduleSheetMetadataSyncHooks(ctx: Context): void;
@@ -1,23 +1,7 @@
1
1
  import { Context } from '../context';
2
2
  import { Settings } from '../settings';
3
- import { CellMatrix, Sheet, SheetConfig } from '../types';
4
- import { CellFormatRange } from '../utils/range-format';
3
+ import { CellMatrix, Sheet } from '../types';
5
4
 
6
- /**
7
- * Persist active ctx.config onto ONE sheet file only.
8
- * If Immer wrote keys (e.g. cellFormatRanges) on file.config but not ctx.config,
9
- * keep those instead of wiping them with a blind replace.
10
- * Never touches other sheets.
11
- */
12
- export declare function assignActiveConfigToSheetFile(file: Sheet, activeConfig: SheetConfig | undefined): void;
13
- /**
14
- * Promote format-only cells in a rectangle into cellFormatRanges.
15
- * Scans only [r1..r2]×[c1..c2]. Returns new ranges if anything changed.
16
- *
17
- * Writes through luckysheetfile[i].config (same as toolbar) so Immer undo
18
- * history tracks the change and peers get the reverse via afterConfigChanges.
19
- */
20
- export declare function syncFormatOnlyRectIntoRanges(ctx: Context, cfg: SheetConfig | undefined, data: CellMatrix | null | undefined, r1: number, r2: number, c1: number, c2: number): CellFormatRange[] | null;
21
5
  export declare function storeSheetParamALL(ctx: Context): void;
22
6
  export declare function changeSheet(ctx: Context, id: string, isPivotInitial?: boolean, isNewSheet?: boolean, isCopySheet?: boolean): void;
23
7
  export declare function addSheet(ctx: Context, settings?: Required<Settings>, newSheetID?: string | undefined, // if action is from websocket, there will be a new sheetID
@@ -23,7 +23,7 @@ export type Hooks = {
23
23
  cellDataChange?: () => void;
24
24
  hyperlinkChange?: () => void;
25
25
  updateCellYdoc?: (changes: SheetChangePath[]) => void;
26
- updateAllCell?: (sheetId: string, caller?: string) => void;
26
+ updateAllCell?: (sheetId: string) => void;
27
27
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
28
28
  /** Clears RTC remote-apply lock so local edits can run data-block formulas. */
29
29
  onLocalCellEdit?: () => void;
@@ -1,6 +1,5 @@
1
1
  import { Patch as ImmerPatch } from 'immer';
2
2
  import { PatchOptions } from './utils';
3
- import { CellFormatRange } from './utils/range-format';
4
3
 
5
4
  export type Op = {
6
5
  op: 'replace' | 'remove' | 'add' | 'insertRowCol' | 'deleteRowCol' | 'addSheet' | 'deleteSheet';
@@ -141,8 +140,6 @@ export type SheetConfig = {
141
140
  customHeight?: Record<string, number>;
142
141
  customWidth?: Record<string, number>;
143
142
  borderInfo?: any[];
144
- /** Range-level cell formatting for empty cells (toolbar bulk format). */
145
- cellFormatRanges?: CellFormatRange[];
146
143
  authority?: any;
147
144
  rowReadOnly?: Record<number, number>;
148
145
  colReadOnly?: Record<number, number>;
@@ -1,4 +1,3 @@
1
- import { CellFormatRange } from '../../../core/utils/range-format';
2
1
  import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol, GlobalCache, LiveQueryData } from '../../../core';
3
2
  import { getCryptoPrice } from '../../utils/cryptoApi';
4
3
  import { SetContextOptions } from '../../context';
@@ -149,12 +148,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
149
148
  } | null;
150
149
  }, options?: api.CommonOptions) => void;
151
150
  setSheetMapField: (field: string, value: Record<string, any> | null | undefined, options?: api.CommonOptions) => void;
152
- /** Merge keys into a map-backed sheet field without replacing the whole map. */
153
- patchSheetMapField: (field: string, updates: Record<string, any>, deleteKeys?: string[], options?: api.CommonOptions) => void;
154
- /** Merge sub-keys into sheet.config without replacing the whole config object. */
155
- setSheetConfigFields: (partial: Record<string, any>, options?: api.CommonOptions & {
156
- deleteKeys?: string[];
157
- }) => void;
158
151
  setSheetConditionFormatRules: (rules: any[], options?: api.CommonOptions) => void;
159
152
  scroll: (options: {
160
153
  scrollLeft?: number;
@@ -173,7 +166,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
173
166
  calculateSubSheetFormula: (id: string) => void;
174
167
  calculateCellReferencedSubSheetFormula: (id: string, refCell?: string[]) => void;
175
168
  dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
176
- celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number, cellFormatRanges?: CellFormatRange[]) => CellMatrix | null;
169
+ celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
177
170
  insertFunction: (selectedFuncIndex: number, filteredFunctionList: any[], callback?: () => void) => void;
178
171
  getLocaleContext: () => any;
179
172
  getWorkbookContext: () => Context;
@@ -150,10 +150,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
150
150
  } | null;
151
151
  }, options?: api.CommonOptions) => void;
152
152
  setSheetMapField: (field: string, value: Record<string, any> | null | undefined, options?: api.CommonOptions) => void;
153
- patchSheetMapField: (field: string, updates: Record<string, any>, deleteKeys?: string[], options?: api.CommonOptions) => void;
154
- setSheetConfigFields: (partial: Record<string, any>, options?: api.CommonOptions & {
155
- deleteKeys?: string[];
156
- }) => void;
157
153
  setSheetConditionFormatRules: (rules: any[], options?: api.CommonOptions) => void;
158
154
  scroll: (options: {
159
155
  scrollLeft?: number;
@@ -172,7 +168,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
172
168
  calculateSubSheetFormula: (id: string) => void;
173
169
  calculateCellReferencedSubSheetFormula: (id: string, refCell?: string[]) => void;
174
170
  dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
175
- celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number, cellFormatRanges?: import('../../../core/utils/range-format').CellFormatRange[]) => CellMatrix | null;
171
+ celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
176
172
  insertFunction: (selectedFuncIndex: number, filteredFunctionList: any[], callback?: () => void) => void;
177
173
  getLocaleContext: () => any;
178
174
  getWorkbookContext: () => Context;