@fileverse-dev/dsheet 4.0.3 → 4.0.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.
Files changed (41) hide show
  1. package/dist/{constants-Cdz6oSCq.js → constants-CRFfbkoQ.js} +1 -1
  2. package/dist/constants.js +1 -1
  3. package/dist/{crypto-constants-CqpCRs86.js → crypto-constants-ZTlAYRUf.js} +33 -22
  4. package/dist/editor/components/sidebar/use-right-panels.d.ts +1 -1
  5. package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
  6. package/dist/editor/hooks/use-celldata-compaction.d.ts +2 -3
  7. package/dist/editor/utils/compact-committed-celldata.d.ts +11 -10
  8. package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
  9. package/dist/editor/utils/import-compaction.d.ts +25 -0
  10. package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
  11. package/dist/editor/utils/xlsx-import-pipeline.d.ts +28 -0
  12. package/dist/{executeStringFunction-BQvE7aeV.js → executeStringFunction-B6fhDKyN.js} +7014 -6490
  13. package/dist/formula.js +1 -1
  14. package/dist/{index-CeTa91qc.js → index-BqGOKo9u.js} +15445 -14688
  15. package/dist/index.es.js +22 -22
  16. package/dist/sheet-engine/core/api/common.d.ts +1 -0
  17. package/dist/sheet-engine/core/context.d.ts +3 -1
  18. package/dist/sheet-engine/core/index.d.ts +2 -2
  19. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +11 -0
  20. package/dist/sheet-engine/core/modules/formula.d.ts +27 -0
  21. package/dist/sheet-engine/core/modules/index.d.ts +3 -2
  22. package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
  23. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +2 -0
  24. package/dist/sheet-engine/core/settings.d.ts +2 -0
  25. package/dist/sheet-engine/core/types.d.ts +21 -0
  26. package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
  27. package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -0
  28. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
  29. package/dist/style.css +1 -1
  30. package/dist/{template-data-list-oP1s0Uxn.js → template-data-list-RKnVLsuf.js} +51 -50
  31. package/dist/use-xlsx-import-impl-Bddlxx23.js +1898 -0
  32. package/dist/worker/dsheet-worker-client.d.ts +14 -0
  33. package/dist/worker/dsheet-worker.d.ts +14 -0
  34. package/dist/xlsx-defined-names-DsWdNZw-.js +117 -0
  35. package/dist/xlsx-export-impl-DJiXCevi.js +831 -0
  36. package/dist/xlsx-hyperlink-inline-CTg4_gg1.js +2512 -0
  37. package/package.json +5 -4
  38. package/dist/use-xlsx-import-impl-BVsfV8ZV.js +0 -1572
  39. package/dist/xlsx-export-impl-Ber9FhFY.js +0 -3138
  40. package/dist/xlsx-hyperlink-inline-DzewAypN.js +0 -71
  41. package/dist/xlsx-image-utils-Cvg0qxRA.js +0 -126
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 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 f, v as w, w as A, x as I, z as L, A as T, B as v, D as b, E as D } from "./index-CeTa91qc.js";
2
- import { cr as k, cs as V, ct as y, cy as z, bo as P, e as U, f as X, l as _, a as B, d7 as O, d8 as j, b7 as G, d9 as H, da as q, de as J, df as K, dh as N, I as W, dw as Y, dW as Z, b0 as Q } from "./executeStringFunction-BQvE7aeV.js";
1
+ import { C as s, d as t, f as o, S as r, g as l, h as d, j as n, T as i, k as S, l as c, n as h, o as m, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A as I, B as f, D as w, E as A, F as L, G as T, H as v, I as D, J as M } from "./index-BqGOKo9u.js";
2
+ import { cw as k, cx as V, cy as y, cE as z, bq as G, e as P, f as U, l as X, a as _, dg as j, dh as B, b9 as H, di as O, dj as q, dn as J, dp as K, dr as N, I as Y, dG as Z, ed as Q, b2 as W } from "./executeStringFunction-B6fhDKyN.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-CRFfbkoQ.js";
5
5
  export {
6
6
  s as CommentAction,
7
7
  t as CommentCellUI,
@@ -21,39 +21,39 @@ export {
21
21
  y as clearSelectedCellFormat,
22
22
  h as createFilter,
23
23
  z as deleteRowCol,
24
- P as deleteSelectedCellText,
24
+ G as deleteSelectedCellText,
25
25
  m as describeMatchedShortcut,
26
- U as executeStringFunction,
27
- X as formulaResponseUiSync,
28
- _ as getFlowdata,
26
+ P as executeStringFunction,
27
+ U as formulaResponseUiSync,
28
+ X as getFlowdata,
29
29
  p as getRemoveDuplicatesErrorMessage,
30
30
  C as getRemoveDuplicatesPreview,
31
- B as getSheetIndex,
31
+ _ 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
- O as handleFreeze,
38
- j as handleHorizontalAlign,
39
- G as handleLink,
40
- H as handleMerge,
37
+ j as handleFreeze,
38
+ B as handleHorizontalAlign,
39
+ H as handleLink,
40
+ O as handleMerge,
41
41
  R as handlePasteByClick,
42
42
  q as handleSort,
43
43
  J as handleTextSize,
44
44
  K as handleVerticalAlign,
45
- f as importSpreadsheetFile,
45
+ I as importSpreadsheetFile,
46
46
  N as insertRowCol,
47
- w as isBrowserZoomShortcut,
48
- A as isFormulaListShortcut,
49
- I as isOpenShortcutsModalShortcut,
50
- W as jfrefreshgrid,
51
- Y as loadLocale,
47
+ f as isBrowserZoomShortcut,
48
+ w as isFormulaListShortcut,
49
+ A as isOpenShortcutsModalShortcut,
50
+ Y as jfrefreshgrid,
51
+ Z as loadLocale,
52
52
  L as removeActiveImage,
53
53
  T as removeDuplicates,
54
54
  v as showImgChooser,
55
- Z as toolbarItemClickHandler,
56
- Q as updateFormat,
57
- b as useEnsStatus,
58
- D as useXLSXImport
55
+ Q as toolbarItemClickHandler,
56
+ W as updateFormat,
57
+ D as useEnsStatus,
58
+ M as useXLSXImport
59
59
  };
@@ -56,6 +56,7 @@ export declare function getSheetWithLatestCelldata(ctx: Context, options?: Commo
56
56
  luckysheet_conditionformat_save?: any[];
57
57
  luckysheet_alternateformat_save?: any[];
58
58
  dataVerification?: any;
59
+ dataVerificationDefs?: any[];
59
60
  conditionRules?: import('../types').ConditionRulesProps;
60
61
  hyperlink?: Record<string, import('..').HyperlinkEntry | import('..').HyperlinkEntry[]>;
61
62
  dynamicArray_compute?: any;
@@ -1,4 +1,4 @@
1
- import { SheetConfig, Sheet, Selection, Cell, CommentBox, Rect, Image, Presence, LinkCardProps, FilterOptions, RangeDialogProps, DataRegulationProps, ConditionRulesProps, GlobalCache, CellError } from './types';
1
+ import { SheetConfig, Sheet, Selection, Cell, CommentBox, Rect, Image, Presence, LinkCardProps, FilterOptions, RangeDialogProps, DataRegulationProps, ConditionRulesProps, GlobalCache, CellError, DefinedName } from './types';
2
2
  import { FormulaCache } from './modules';
3
3
  import { FormulaAsyncEvalJob } from './modules/formula-async-eval';
4
4
  import { DateBaseLocale, Hooks } from './settings';
@@ -116,6 +116,8 @@ export type Context = {
116
116
  currentSheetId: string;
117
117
  calculateSheetId: string;
118
118
  config: SheetConfig;
119
+ /** Workbook-level named ranges (synced via Yjs `${dsheetId}:definedNames`). */
120
+ definedNames: DefinedName[];
119
121
  visibledatarow: number[];
120
122
  visibledatacolumn: number[];
121
123
  ch_width: number;
@@ -7,11 +7,11 @@ export { defaultSettings } from './settings';
7
7
  export type { Settings, Hooks, DateBaseLocale } from './settings';
8
8
  export { handleCopy, handleGlobalKeyDown, handlePaste, handlePasteByClick, fixPositionOnFrozenCells, handleCellAreaMouseDown, handleCellAreaDoubleClick, handleContextMenu, mouseRender, handleOverlayMouseMove, handleOverlayMouseUp, handleRowHeaderMouseDown, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColSizeHandleDoubleClick, handleRowSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleRowFreezeHandleMouseDown, describeMatchedShortcut, isBrowserZoomShortcut, isOpenShortcutsModalShortcut, isFormulaListShortcut, } from './events';
9
9
  export * from './locale';
10
- export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, FormulaCache, groupValuesRefresh, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, isFormulaEvalPending, FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, getFilterHiddenRowsUnionFromFilterMap, getFilterHiddenRowsUnion, ensureManualHiddenInitialized, rebuildRowHiddenUnion, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, defaultLuckysheetSelectRanges, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, mergeSelectionHasValues, handleSort, getRemoveDuplicatesPreview, removeDuplicates, getRemoveDuplicatesErrorMessage, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, removeOverShowComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, copyActiveImage, cutActiveImage, pasteImageItem, loadImageFromFile, getImageClipboard, getImageCutSourceId, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, sortSheetBySelectedColumn, searchAll, searchNext, replace, replaceAll, replaceAllScoped, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, clearFilterForColumn, toggleViewerFilter, createFilter, applySheetFilterState, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, checkCF, getComputeMap, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
10
+ export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, FormulaCache, groupValuesRefresh, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, isFormulaEvalPending, FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, ensureFormulaRangeToSheet, shouldPreserveFormulaEditOnSheetSwitch, activateSheetForNavigation, returnToFormulaOriginSheet, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, getFilterHiddenRowsUnionFromFilterMap, getFilterHiddenRowsUnion, ensureManualHiddenInitialized, rebuildRowHiddenUnion, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, defaultLuckysheetSelectRanges, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, mergeSelectionHasValues, handleSort, getRemoveDuplicatesPreview, removeDuplicates, getRemoveDuplicatesErrorMessage, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, removeOverShowComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, copyActiveImage, cutActiveImage, pasteImageItem, loadImageFromFile, getImageClipboard, getImageCutSourceId, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, sortSheetBySelectedColumn, searchAll, searchNext, replace, replaceAll, replaceAllScoped, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, clearFilterForColumn, toggleViewerFilter, createFilter, applySheetFilterState, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, refreshFormulasUsingDefinedNames, checkCF, getComputeMap, isValidDefinedNameIdentifier, getDefinedNameDisplayRange, findDefinedNameForSelection, findDefinedNameByName, resolveDefinedNameForFormula, addDefinedName, updateDefinedName, deleteDefinedName, selectDefinedName, openNamedRangesSidebar, scheduleDefinedNamesSync, shiftDefinedNamesOnInsert, shiftDefinedNamesOnDelete, removeDefinedNamesForSheet, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
11
11
  export type { FilterDate, FilterValue, FilterColor } from './modules';
12
12
  export { getFreezeState, toggleFreeze, indexToColumnChar, escapeScriptTag, escapeHTMLTag, getSheetIndex, replaceHtml, isAllowEdit, isAllowEditReadOnly, filterPatch, patchToOp, opToPatch, inverseRowColOptions, } from './utils';
13
13
  export type { PatchOptions, ChangedSheet } from './utils';
14
- export type { Op, Cell, CellWithRowAndCol, CellMatrix, HyperlinkEntry, Selection, Presence, Sheet, GlobalCache, SingleRange, Range, SearchResult, LinkCardProps, LiveQueryData, Freezen, } from './types';
14
+ export type { Op, Cell, CellWithRowAndCol, CellMatrix, HyperlinkEntry, Selection, Presence, Sheet, GlobalCache, SingleRange, Range, SearchResult, LinkCardProps, LiveQueryData, Freezen, DefinedName, } from './types';
15
15
  export type { RemoveDuplicatesColumnOption, RemoveDuplicatesError, RemoveDuplicatesOptions, RemoveDuplicatesPreview, RemoveDuplicatesResult, } from './modules';
16
16
  export type { CheckModes, HyperlinkMap, FindSearchScope, ReplaceScope, SearchHiddenConfig, SearchNextResult, ReplaceAllResult, } from './modules/searchReplace';
17
17
  export { cellFadeAnimator, markCellChanged } from './animate';
@@ -28,6 +28,17 @@ export type SnapshotEvalInput = {
28
28
  f: unknown;
29
29
  }>;
30
30
  formulas: SnapshotFormulaCell[];
31
+ /** Workbook-level named ranges for VARIABLE resolution. */
32
+ definedNames?: Array<{
33
+ name: string;
34
+ sheetId: string;
35
+ range: {
36
+ row: [number, number];
37
+ column: [number, number];
38
+ };
39
+ scope?: 'workbook' | 'sheet';
40
+ localSheetId?: string;
41
+ }>;
31
42
  };
32
43
  export type SnapshotEvalOutput = {
33
44
  execFunctionGlobalData: Record<string, {
@@ -31,6 +31,11 @@ export declare class FormulaCache {
31
31
  /** True after arrow/Shift+arrow moved `func_selectedrange` without updating yellow selection. */
32
32
  formulaKeyboardRefSync?: boolean;
33
33
  formulaEditorOwner?: 'cell' | 'fx' | null;
34
+ /**
35
+ * Set when switching sheets while a formula edit stays open so InputBox/Fx
36
+ * can restore focus/caret for continued keyboard ref picking.
37
+ */
38
+ refocusFormulaEditorAfterSheetSwitch?: boolean;
34
39
  functionRangeIndex?: number[];
35
40
  functionRangeGlobalOffset?: number | null;
36
41
  functionlistMap: any;
@@ -80,6 +85,11 @@ export declare function groupValuesRefresh(ctx: Context): void;
80
85
  export declare function applyWorkerFormulaChunkResults(ctx: Context, output: SnapshotEvalOutput, impactedByCircular: Set<string>, cycleNodes: Set<string>, calcChainKeys?: string[], data?: CellMatrix | null): void;
81
86
  /** Run up to `chunkSize` formulas from an async job. Returns true when job is complete. */
82
87
  export declare function runFormulaEvalChunk(ctx: Context, job: FormulaAsyncEvalJob, chunkSize?: number): boolean;
88
+ /**
89
+ * Re-evaluate formula cells that reference the given defined names
90
+ * (e.g. after a named range was edited, shifted, or deleted).
91
+ */
92
+ export declare function refreshFormulasUsingDefinedNames(ctx: Context, names: string[]): void;
83
93
  export declare function execFunctionGroup(ctx: Context, origin_r: number, origin_c: number, value: any, id?: string, data?: any, isForce?: boolean): void;
84
94
  /**
85
95
  * Before the first `moveHighlightCell/Range(..., "rangeOfFormula")` while editing
@@ -102,6 +112,23 @@ export declare function getLastFormulaRangeIndex($editor: HTMLDivElement): numbe
102
112
  export declare function getFormulaRangeIndexAtCaret($editor: HTMLDivElement): number | null;
103
113
  export declare function setFormulaEditorOwner(ctx: Context, owner: 'cell' | 'fx' | null): void;
104
114
  export declare function getFormulaEditorOwner(ctx: Context): 'cell' | 'fx' | null;
115
+ /**
116
+ * Record the sheet where the formula edit started so cross-sheet picks can emit
117
+ * `SheetName!A1` via `rangeSetValue` / `getRangetxt`.
118
+ */
119
+ export declare function ensureFormulaRangeToSheet(ctx: Context): void;
120
+ /** True while an in-cell / fx formula edit should survive sheet-tab switches. */
121
+ export declare function shouldPreserveFormulaEditOnSheetSwitch(ctx: Context): boolean;
122
+ /**
123
+ * Activate another sheet from tab click or Alt/Option+Arrow navigation.
124
+ * Returns whether the sheet changed and whether formula edit was preserved.
125
+ */
126
+ export declare function activateSheetForNavigation(ctx: Context, targetSheetId: string): 'preserved-formula' | 'cancel-edit' | false;
127
+ /**
128
+ * Switch back to the formula's origin sheet (and restore its scroll/selection)
129
+ * before commit or cancel. Returns true when a switch happened.
130
+ */
131
+ export declare function returnToFormulaOriginSheet(ctx: Context): boolean;
105
132
  /**
106
133
  * True when the formula text looks like a truncated A1-style range: LHS has a row
107
134
  * number but RHS after ":" is only column letters (e.g. =A1:A after deleting the
@@ -4,7 +4,7 @@ export { default as clipboard } from './clipboard';
4
4
  export { moveToEnd, getRangeRectsByCharacterOffset } from './cursor';
5
5
  export { getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, } from './date-base-locale';
6
6
  export { update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, } from './format';
7
- export { FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, maybeRecoverDirtyRangeSelection, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, remapFormulaReferencesByMap, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, getFormulaRangeIndexForKeyboardSync, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, functionStrChange, setFormulaEditorOwner, getAllFunctionGroup, suppressFormulaRangeSelectionForInitialEdit, } from './formula';
7
+ export { FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, maybeRecoverDirtyRangeSelection, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, remapFormulaReferencesByMap, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, getFormulaRangeIndexForKeyboardSync, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, functionStrChange, setFormulaEditorOwner, getAllFunctionGroup, suppressFormulaRangeSelectionForInitialEdit, ensureFormulaRangeToSheet, shouldPreserveFormulaEditOnSheetSwitch, activateSheetForNavigation, returnToFormulaOriginSheet, } from './formula';
8
8
  export { FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, isFormulaEvalPending, } from './formula-async-eval';
9
9
  export type { FormulaAsyncEvalJob } from './formula-async-eval';
10
10
  export { initFreeze } from './freeze';
@@ -42,6 +42,7 @@ export { sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStar
42
42
  export { setCellError, clearCellError, overShowError, } from './error-state-helpers';
43
43
  export { checkCellIsLocked } from './protection';
44
44
  export { detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, } from './validation';
45
- export { iscelldata, getcellrange, execfunction, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, insertUpdateFunctionGroup, functionCopy, } from './formula';
45
+ export { iscelldata, getcellrange, execfunction, execFunctionGroup, refreshFormulasUsingDefinedNames, runFormulaEvalChunk, applyWorkerFormulaChunkResults, insertUpdateFunctionGroup, functionCopy, } from './formula';
46
46
  export { checkCF, getComputeMap } from './ConditionFormat';
47
+ export { isValidDefinedNameIdentifier, getDefinedNameDisplayRange, findDefinedNameForSelection, findDefinedNameByName, resolveDefinedNameForFormula, addDefinedName, updateDefinedName, deleteDefinedName, selectDefinedName, openNamedRangesSidebar, scheduleDefinedNamesSync, shiftDefinedNamesOnInsert, shiftDefinedNamesOnDelete, removeDefinedNamesForSheet, } from './namedRanges';
47
48
  export { getdatabyselection, getQKBorder } from './cell';
@@ -0,0 +1,53 @@
1
+ import { Context } from '../context';
2
+ import { DefinedName, SingleRange } from '../types';
3
+
4
+ /** Excel/Google: names must start with letter/underscore; no spaces; not a cell ref. */
5
+ export declare function isValidDefinedNameIdentifier(name: string): boolean;
6
+ export declare function getDefinedNameDisplayRange(ctx: Context, dn: DefinedName): string;
7
+ export declare function findDefinedNameForSelection(ctx: Context): DefinedName | null;
8
+ export declare function findDefinedNameByName(ctx: Context, name: string, excludeId?: string): DefinedName | null;
9
+ /**
10
+ * Resolve a formula VARIABLE (e.g. `=SUM(Custom)`) to a defined name.
11
+ * Prefers sheet-scoped names matching `formulaSheetId`, then workbook-scoped.
12
+ */
13
+ export declare function resolveDefinedNameForFormula(definedNames: DefinedName[] | undefined | null, name: string, formulaSheetId?: string): DefinedName | null;
14
+ export declare function addDefinedName(ctx: Context, input: {
15
+ name: string;
16
+ sheetId: string;
17
+ range: SingleRange;
18
+ scope?: DefinedName['scope'];
19
+ localSheetId?: string;
20
+ }): {
21
+ ok: true;
22
+ namedRange: DefinedName;
23
+ } | {
24
+ ok: false;
25
+ error: string;
26
+ };
27
+ export declare function updateDefinedName(ctx: Context, id: string, patch: {
28
+ name?: string;
29
+ sheetId?: string;
30
+ range?: SingleRange;
31
+ }): {
32
+ ok: true;
33
+ namedRange: DefinedName;
34
+ } | {
35
+ ok: false;
36
+ error: string;
37
+ };
38
+ export declare function deleteDefinedName(ctx: Context, id: string): boolean;
39
+ /** Jump to a named range (switch sheet if needed) and select its cells. */
40
+ export declare function selectDefinedName(ctx: Context, id: string): boolean;
41
+ export declare function openNamedRangesSidebar(): void;
42
+ /**
43
+ * Defer Yjs sync until after Immer applies the draft (same pattern as
44
+ * sheet-metadata-hooks). Capture the hook fn — not `ctx.hooks` — so the
45
+ * draft proxy is not read after revoke.
46
+ */
47
+ export declare function scheduleDefinedNamesSync(ctx: Context): void;
48
+ /** Shift named ranges on the given sheet after row/col insert. Returns affected names. */
49
+ export declare function shiftDefinedNamesOnInsert(ctx: Context, sheetId: string, type: 'row' | 'column', index: number, count: number, direction: 'lefttop' | 'rightbottom'): string[];
50
+ /** Shift/remove named ranges on the given sheet after row/col delete. */
51
+ export declare function shiftDefinedNamesOnDelete(ctx: Context, sheetId: string, type: 'row' | 'column', start: number, end: number): string[];
52
+ /** Drop named ranges that pointed at a deleted sheet. */
53
+ export declare function removeDefinedNamesForSheet(ctx: Context, deletedSheetId: string): string[];
@@ -21,3 +21,5 @@ export declare function filterMeaningfulBorderSides(sides: {
21
21
  color?: string;
22
22
  };
23
23
  }): typeof sides;
24
+ /** Drop junk borderInfo entries. Returns undefined when unchanged. */
25
+ export declare function compactBorderInfo(borderInfo: any[] | undefined): any[] | undefined;
@@ -22,6 +22,8 @@ export type Hooks = {
22
22
  filterChange?: () => void;
23
23
  cellDataChange?: () => void;
24
24
  hyperlinkChange?: () => void;
25
+ /** Workbook-level named ranges (definedNames) changed — sync to Yjs. */
26
+ definedNamesChange?: () => void;
25
27
  updateCellYdoc?: (changes: SheetChangePath[]) => void;
26
28
  updateAllCell?: (sheetId: string, caller?: string) => void;
27
29
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
@@ -143,10 +143,29 @@ export type SheetConfig = {
143
143
  borderInfo?: any[];
144
144
  /** Range-level cell formatting for empty cells (toolbar bulk format). */
145
145
  cellFormatRanges?: CellFormatRange[];
146
+ /** Background compaction revision (celldata + borderInfo); synced via Yjs. */
147
+ sheetCompactionRev?: number;
146
148
  authority?: any;
147
149
  rowReadOnly?: Record<number, number>;
148
150
  colReadOnly?: Record<number, number>;
149
151
  };
152
+ /**
153
+ * Workbook-level named range (Google Sheets / Excel definedNames).
154
+ * Runtime list lives on Context; persisted in Yjs as `${dsheetId}:definedNames`.
155
+ */
156
+ export type DefinedName = {
157
+ id: string;
158
+ name: string;
159
+ sheetId: string;
160
+ range: {
161
+ row: [number, number];
162
+ column: [number, number];
163
+ };
164
+ scope: 'workbook' | 'sheet';
165
+ /** When scope === 'sheet', which sheet owns the name. */
166
+ localSheetId?: string;
167
+ comment?: string;
168
+ };
150
169
  export type Image = {
151
170
  id: string;
152
171
  width: number;
@@ -246,6 +265,8 @@ export type Sheet = {
246
265
  luckysheet_conditionformat_save?: any[];
247
266
  luckysheet_alternateformat_save?: any[];
248
267
  dataVerification?: any;
268
+ /** Interned dataVerification entries; per-cell map may hold numeric refs into this list. */
269
+ dataVerificationDefs?: any[];
249
270
  conditionRules?: ConditionRulesProps;
250
271
  hyperlink?: Record<string, HyperlinkEntry | HyperlinkEntry[]>;
251
272
  dynamicArray_compute?: any;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+
3
+ declare const NamedRanges: React.FC;
4
+ export default NamedRanges;
@@ -119,6 +119,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
119
119
  luckysheet_conditionformat_save?: any[];
120
120
  luckysheet_alternateformat_save?: any[];
121
121
  dataVerification?: any;
122
+ dataVerificationDefs?: any[];
122
123
  conditionRules?: import('../../../core/types').ConditionRulesProps;
123
124
  hyperlink?: Record<string, import('../../../core').HyperlinkEntry | import('../../../core').HyperlinkEntry[]>;
124
125
  dynamicArray_compute?: any;
@@ -120,6 +120,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
120
120
  luckysheet_conditionformat_save?: any[];
121
121
  luckysheet_alternateformat_save?: any[];
122
122
  dataVerification?: any;
123
+ dataVerificationDefs?: any[];
123
124
  conditionRules?: import('../../../core/types').ConditionRulesProps;
124
125
  hyperlink?: Record<string, import('../../../core').HyperlinkEntry | import('../../../core').HyperlinkEntry[]>;
125
126
  dynamicArray_compute?: any;