@fileverse-dev/dsheet 1.3.18-patch.1 → 1.3.18-patch.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 (31) hide show
  1. package/dist/editor/utils/xlsx-border-utils.d.ts +21 -0
  2. package/dist/editor/utils/xlsx-cf-export-utils.d.ts +47 -0
  3. package/dist/editor/utils/xlsx-cf-postprocess.d.ts +14 -0
  4. package/dist/editor/utils/xlsx-image-utils.d.ts +14 -1
  5. package/dist/editor/utils/xlsx-richtext-utils.d.ts +16 -0
  6. package/dist/{en-DhXXsqA5.js → en-Cyd9m-Dg.js} +1 -1
  7. package/dist/index-Cn_S2KAM.js +52411 -0
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.es.js +5 -5
  10. package/dist/sheet-engine/core/api/cell.d.ts +1 -1
  11. package/dist/sheet-engine/core/events/keyboard.d.ts +2 -2
  12. package/dist/sheet-engine/core/events/mouse.d.ts +1 -1
  13. package/dist/sheet-engine/core/index.d.ts +1 -1
  14. package/dist/sheet-engine/core/modules/cell.d.ts +5 -1
  15. package/dist/sheet-engine/core/modules/formula.d.ts +50 -1
  16. package/dist/sheet-engine/core/modules/index.d.ts +1 -1
  17. package/dist/sheet-engine/core/modules/inline-string.d.ts +6 -6
  18. package/dist/sheet-engine/core/modules/rowcol.d.ts +3 -3
  19. package/dist/sheet-engine/core/modules/selection.d.ts +6 -5
  20. package/dist/sheet-engine/core/modules/sort.d.ts +1 -1
  21. package/dist/sheet-engine/core/paste-table-helpers.d.ts +1 -1
  22. package/dist/sheet-engine/core/types.d.ts +6 -4
  23. package/dist/sheet-engine/react/components/FormulaSearch/constant.d.ts +63 -0
  24. package/dist/sheet-engine/react/components/FormulaSearch/index.d.ts +3 -2
  25. package/dist/sheet-engine/react/components/SheetOverlay/formula-segment-boundary.d.ts +1 -0
  26. package/dist/sheet-engine/react/components/SheetOverlay/helper.d.ts +34 -0
  27. package/dist/sheet-engine/react/hooks/useFormulaEditorHistory.d.ts +30 -0
  28. package/dist/sheet-engine/react/hooks/useRerenderOnFormulaCaret.d.ts +11 -0
  29. package/dist/style.css +1 -1
  30. package/package.json +5 -3
  31. package/dist/index-ZCAfF51b.js +0 -47201
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default as DsheetEditor } from './editor/dsheet-editor';
1
+ export { default as DSheetEditor } from './editor/dsheet-editor';
2
2
  export { formulaResponseUiSync } from './editor/utils/formula-ui-sync';
3
3
  export { executeStringFunction } from './editor/utils/executeStringFunction';
4
4
  export { FLVURL } from '@fileverse-dev/formulajs';
package/dist/index.es.js CHANGED
@@ -1,8 +1,8 @@
1
- import { S as s, E as l, i as o, a as r, b as t, c as n, d, e as h, f as i, g as S, h as c, j as C, k as m, l as p, m as E, n as F, o as x, p as g, q as R, r as u, s as A, t as I, u as L, v as f, w as T, x as w, y as V, z as k, A as y, B as z, C as X, D as _, G as v, H as G, I as H, J as M, K as P } from "./index-ZCAfF51b.js";
1
+ import { S as s, E as l, i as o, a as r, b as t, c as n, d, e as S, f as h, g as i, h as c, j as C, k as m, l as p, m as E, n as F, o as x, p as g, q as R, r as u, s as A, t as I, u as L, v as f, w as T, x as w, y as V, z as k, A as y, B as z, C as X, D as _, G as v, H as G, I as H, J as M, K as P } from "./index-Cn_S2KAM.js";
2
2
  import { FLVURL as b } from "@fileverse-dev/formulajs";
3
3
  import { TEMPLATES as B } from "@fileverse-dev/dsheets-templates";
4
4
  export {
5
- s as DsheetEditor,
5
+ s as DSheetEditor,
6
6
  l as ERROR_MESSAGES_FLAG,
7
7
  b as FLVURL,
8
8
  o as FortuneCore,
@@ -11,9 +11,9 @@ export {
11
11
  t as api,
12
12
  n as clearColumnsCellsFormat,
13
13
  d as clearFilter,
14
- h as clearRowsCellsFormat,
15
- i as clearSelectedCellFormat,
16
- S as createFilter,
14
+ S as clearRowsCellsFormat,
15
+ h as clearSelectedCellFormat,
16
+ i as createFilter,
17
17
  c as deleteRowCol,
18
18
  C as deleteSelectedCellText,
19
19
  m as executeStringFunction,
@@ -8,4 +8,4 @@ export declare function getCellValue(ctx: Context, row: number, column: number,
8
8
  export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions, callAfterUpdate?: boolean): void;
9
9
  export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
10
10
  export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
11
- export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: 'up' | 'down' | 'left' | 'right'): void;
11
+ export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right"): void;
@@ -1,7 +1,7 @@
1
1
  import { Context } from '../context';
2
2
  import { GlobalCache } from '../types';
3
3
 
4
- export declare function handleGlobalEnter(ctx: Context, cellInput: HTMLDivElement, e: KeyboardEvent, canvas?: CanvasRenderingContext2D): void;
5
- export declare function handleWithCtrlOrMetaKey(ctx: Context, cache: GlobalCache, e: KeyboardEvent, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, handleUndo: () => void, handleRedo: () => void): void;
4
+ export declare function handleGlobalEnter(ctx: Context, cellInput: HTMLDivElement, e: KeyboardEvent, cache: GlobalCache, canvas?: CanvasRenderingContext2D): void;
5
+ export declare function handleWithCtrlOrMetaKey(ctx: Context, cache: GlobalCache, e: KeyboardEvent, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, handleUndo: () => void, handleRedo: () => void, canvas?: CanvasRenderingContext2D): void;
6
6
  export declare function handleArrowKey(ctx: Context, e: KeyboardEvent): void;
7
7
  export declare function handleGlobalKeyDown(ctx: Context, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, e: KeyboardEvent, cache: GlobalCache, handleUndo: () => void, handleRedo: () => void, canvas?: CanvasRenderingContext2D): Promise<void>;
@@ -12,7 +12,7 @@ export declare function fixPositionOnFrozenCells(freeze: Freezen | undefined, x:
12
12
  };
13
13
  export declare function handleCellAreaMouseDown(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null, canvas?: CanvasRenderingContext2D): void;
14
14
  export declare function handleCellAreaDoubleClick(ctx: Context, globalCache: GlobalCache, settings: Settings, e: MouseEvent, container: HTMLElement): void;
15
- export declare function handleContextMenu(ctx: Context, settings: Settings, e: MouseEvent, workbookContainer: HTMLDivElement, container: HTMLDivElement, area: 'cell' | 'rowHeader' | 'columnHeader'): void;
15
+ export declare function handleContextMenu(ctx: Context, settings: Settings, e: MouseEvent, workbookContainer: HTMLDivElement, container: HTMLDivElement, area: "cell" | "rowHeader" | "columnHeader"): void;
16
16
  export declare function mouseRender(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, scrollX: HTMLDivElement, scrollY: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
17
17
  export declare function handleOverlayMouseMove(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, scrollX: HTMLDivElement, scrollY: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
18
18
  export declare function handleOverlayMouseUp(ctx: Context, globalCache: GlobalCache, settings: Settings, e: MouseEvent, scrollbarX: HTMLDivElement, scrollbarY: HTMLDivElement, container: HTMLDivElement, cellInput: HTMLDivElement | null, fxInput: HTMLDivElement | null): void;
@@ -7,7 +7,7 @@ export { defaultSettings } from './settings';
7
7
  export type { Settings, Hooks } from './settings';
8
8
  export { handleCopy, handleGlobalKeyDown, handlePaste, handlePasteByClick, fixPositionOnFrozenCells, handleCellAreaMouseDown, handleCellAreaDoubleClick, handleContextMenu, mouseRender, handleOverlayMouseMove, handleOverlayMouseUp, handleRowHeaderMouseDown, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColSizeHandleDoubleClick, handleRowSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleRowFreezeHandleMouseDown, } from './events';
9
9
  export * from './locale';
10
- export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, getInlineStringHTML, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, update, is_date, valueShowEs, FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, normalizeSelection, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, searchAll, searchNext, replace, replaceAll, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, createFilter, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, handleKeydownForZoom, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, checkCF, getComputeMap, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
10
+ export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, getInlineStringHTML, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, update, is_date, valueShowEs, FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, normalizeSelection, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, searchAll, searchNext, replace, replaceAll, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, createFilter, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, handleKeydownForZoom, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, checkCF, getComputeMap, 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';
@@ -26,7 +26,11 @@ export declare function getRangeByTxt(ctx: Context, txt: string): any[];
26
26
  export declare function isAllSelectedCellsInStatus(ctx: Context, attr: keyof Cell, status: any): boolean;
27
27
  export declare function getFontStyleByCell(cell: Cell | null | undefined, checksAF?: any[], checksCF?: any, isCheck?: boolean): any;
28
28
  export declare function getStyleByCell(ctx: Context, d: CellMatrix, r: number, c: number): any;
29
- export declare function getInlineStringHTML(r: number, c: number, data: CellMatrix): string;
29
+ export declare function getInlineStringHTML(r: number, c: number, data: CellMatrix, options?: {
30
+ useSemanticMarkup?: boolean;
31
+ isRichTextCopy?: boolean;
32
+ inheritedStyle?: Record<string, string>;
33
+ }): string;
30
34
  export declare function getQKBorder(width: string, type: string, color: string): (string | number)[];
31
35
  /**
32
36
  * 计算范围行高
@@ -21,6 +21,9 @@ export declare class FormulaCache {
21
21
  rangetosheet?: string;
22
22
  rangedrag_column_start?: boolean;
23
23
  rangedrag_row_start?: boolean;
24
+ rangeSelectionActive?: boolean | null;
25
+ keyboardRangeSelectionLock?: boolean;
26
+ formulaEditorOwner?: "cell" | "fx" | null;
24
27
  functionRangeIndex?: number[];
25
28
  functionlistMap: any;
26
29
  execFunctionExist?: any[];
@@ -45,12 +48,58 @@ export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, chi
45
48
  export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
46
49
  export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
47
50
  export declare function functionHTMLGenerate(txt: string): string;
51
+ export declare function getLastFormulaRangeIndex($editor: HTMLDivElement): number | null;
52
+ /** Range cell that contains the caret, if any (inside #luckysheet-rich-text-editor tree). */
53
+ export declare function getFormulaRangeIndexAtCaret($editor: HTMLDivElement): number | null;
54
+ export declare function setFormulaEditorOwner(ctx: Context, owner: "cell" | "fx" | null): void;
55
+ export declare function getFormulaEditorOwner(ctx: Context): "cell" | "fx" | null;
56
+ /**
57
+ * True when the formula text looks like a truncated A1-style range: LHS has a row
58
+ * number but RHS after ":" is only column letters (e.g. =A1:A after deleting the
59
+ * row digit from A2). Those states should not allow range recovery / keyboard ref nav.
60
+ */
61
+ export declare function hasIncompleteTruncatedCellRangeSyntax(formulaText: string): boolean;
62
+ /**
63
+ * True when the formula is only "=" plus a single cell or range token (no parentheses,
64
+ * so no function call). Same UX as =A1: do not use arrow keys to drive sheet refs until
65
+ * the user changes the formula shape (e.g. adds a function).
66
+ */
67
+ export declare function isBareCellOrRangeOnlyFormula(formulaText: string): boolean;
68
+ /**
69
+ * When opening in-cell / FX edit on a cell that already stores a formula (`cell.f`),
70
+ * disable sheet-driven range selection until the caret reaches a fresh insertion slot
71
+ * (comma, open paren, operator, etc.) or the user starts an active range drag.
72
+ */
73
+ export declare function suppressFormulaRangeSelectionForInitialEdit(ctx: Context): void;
74
+ export declare function isCaretAtValidFormulaRangeInsertionPoint(editor: HTMLElement | null): boolean;
75
+ export declare function markRangeSelectionDirty(ctx: Context): void;
76
+ /**
77
+ * Which `rangeindex` keyboard selection sync should update: caret's cell if any;
78
+ * else the last range cell when the caret is editing that ref — not when the caret
79
+ * is before it (`=,A4` between `=` and `,`) or **past** it into a following comma /
80
+ * next argument (`=SUM(A1,` after the comma must not replace `A1`).
81
+ */
82
+ export declare function getFormulaRangeIndexForKeyboardSync($editor: HTMLDivElement): number | null;
48
83
  export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
49
84
  export declare function israngeseleciton(ctx: Context, istooltip?: boolean): boolean;
50
- export declare function functionStrChange(txt: string, type: string, rc: 'row' | 'col', orient: string | null, stindex: number, step: number): string;
85
+ export declare function isFormulaReferenceInputMode(ctx: Context): boolean;
86
+ export declare function maybeRecoverDirtyRangeSelection(ctx: Context): boolean;
87
+ export declare function functionStrChange(txt: string, type: string, rc: "row" | "col", orient: string | null, stindex: number, step: number): string;
51
88
  export declare function rangeSetValue(ctx: Context, cellInput: HTMLDivElement, selected: any, fxInput?: HTMLDivElement | null): void;
52
89
  export declare function onFormulaRangeDragEnd(ctx: Context): void;
53
90
  export declare function rangeDrag(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
54
91
  export declare function rangeDragColumn(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
55
92
  export declare function rangeDragRow(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
56
93
  export declare function functionCopy(ctx: Context, txt: string, mode: string, step: number): string;
94
+ type MoveReferenceRect = {
95
+ rowStart: number;
96
+ rowEnd: number;
97
+ colStart: number;
98
+ colEnd: number;
99
+ };
100
+ export declare function remapFormulaReferencesByMap(formula: string, formulaSheetName: string, movedSheetName: string, maps: {
101
+ rowMap?: Record<number, number>;
102
+ colMap?: Record<number, number>;
103
+ }): string;
104
+ export declare function functionMoveReference(txt: string, formulaSheetName: string, movedSheetName: string, sourceRect: MoveReferenceRect, targetRowStart: number, targetColStart: number): string;
105
+ export {};
@@ -3,7 +3,7 @@ export { normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getReal
3
3
  export { default as clipboard } from './clipboard';
4
4
  export { moveToEnd, getRangeRectsByCharacterOffset } from './cursor';
5
5
  export { update, is_date, valueShowEs } from './format';
6
- export { FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, } from './formula';
6
+ export { FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, maybeRecoverDirtyRangeSelection, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, remapFormulaReferencesByMap, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, markRangeSelectionDirty, getFormulaRangeIndexForKeyboardSync, isFormulaReferenceInputMode, functionStrChange, setFormulaEditorOwner, getAllFunctionGroup, suppressFormulaRangeSelectionForInitialEdit, } from './formula';
7
7
  export { initFreeze } from './freeze';
8
8
  export { isInlineStringCell, getInlineStringNoStyle } from './inline-string';
9
9
  export { rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, } from './location';
@@ -20,12 +20,12 @@ export declare const inlineStyleAffectAttribute: {
20
20
  fc: number;
21
21
  };
22
22
  export declare const inlineStyleAffectCssName: {
23
- 'font-weight': number;
24
- 'font-style': number;
25
- 'font-family': number;
26
- 'text-decoration': number;
27
- 'border-bottom': number;
28
- 'font-size': number;
23
+ "font-weight": number;
24
+ "font-style": number;
25
+ "font-family": number;
26
+ "text-decoration": number;
27
+ "border-bottom": number;
28
+ "font-size": number;
29
29
  color: number;
30
30
  };
31
31
  export declare function isInlineStringCell(cell: any): boolean;
@@ -10,14 +10,14 @@ import { Context } from '../context';
10
10
  * @returns
11
11
  */
12
12
  export declare function insertRowCol(ctx: Context, op: {
13
- type: 'row' | 'column';
13
+ type: "row" | "column";
14
14
  index: number;
15
15
  count: number;
16
- direction: 'lefttop' | 'rightbottom';
16
+ direction: "lefttop" | "rightbottom";
17
17
  id: string;
18
18
  }, changeSelection?: boolean): void;
19
19
  export declare function deleteRowCol(ctx: Context, op: {
20
- type: 'row' | 'column';
20
+ type: "row" | "column";
21
21
  start: number;
22
22
  end: number;
23
23
  id?: string;
@@ -3,6 +3,7 @@ import { Context } from '../context';
3
3
 
4
4
  export declare const selectionCache: {
5
5
  isPasteAction: boolean;
6
+ isPasteValuesOnly: boolean;
6
7
  };
7
8
  export declare function scrollToHighlightCell(ctx: Context, r: number, c: number): void;
8
9
  export declare function seletedHighlistByindex(ctx: Context, r1: number, r2: number, c1: number, c2: number): {
@@ -11,24 +12,24 @@ export declare function seletedHighlistByindex(ctx: Context, r1: number, r2: num
11
12
  top: number;
12
13
  height: number;
13
14
  } | null;
14
- export declare function normalizeSelection(ctx: Context, selection: SheetType['luckysheet_select_save']): import('..').Selection[] | undefined;
15
+ export declare function normalizeSelection(ctx: Context, selection: SheetType["luckysheet_select_save"]): import('..').Selection[] | undefined;
15
16
  export declare function selectTitlesMap(rangeMap: Record<string, number>, range1: number, range2: number): Record<string, number>;
16
17
  export declare function selectTitlesRange(map: Record<string, number>): number[][];
17
- export declare function pasteHandlerOfPaintModel(ctx: Context, copyRange: Context['luckysheet_copy_save']): void;
18
+ export declare function pasteHandlerOfPaintModel(ctx: Context, copyRange: Context["luckysheet_copy_save"]): void;
18
19
  export declare function selectionCopyShow(range: any, ctx: Context): void;
19
20
  export declare function rowHasMerged(ctx: Context, r: number, c1: number, c2: number): boolean;
20
21
  export declare function colHasMerged(ctx: Context, c: number, r1: number, r2: number): boolean;
21
22
  export declare function getRowMerge(ctx: Context, rIndex: number, c1: number, c2: number): (number | null)[];
22
23
  export declare function getColMerge(ctx: Context, cIndex: number, r1: number, r2: number): (number | null)[];
23
- export declare function moveHighlightCell(ctx: Context, postion: 'down' | 'right', index: number, type: 'rangeOfSelect' | 'rangeOfFormula'): void;
24
- export declare function moveHighlightRange(ctx: Context, postion: 'down' | 'right', index: number, type: 'rangeOfSelect' | 'rangeOfFormula'): void;
24
+ export declare function moveHighlightCell(ctx: Context, postion: "down" | "right", index: number, type: "rangeOfSelect" | "rangeOfFormula"): void;
25
+ export declare function moveHighlightRange(ctx: Context, postion: "down" | "right", index: number, type: "rangeOfSelect" | "rangeOfFormula"): void;
25
26
  export declare function rangeValueToHtml(ctx: Context, sheetId: string, ranges?: Range): string | null;
26
27
  export declare function copy(ctx: Context): void;
27
28
  export declare function deleteSelectedCellText(ctx: Context): string;
28
29
  export declare function deleteSelectedCellFormat(ctx: Context): string;
29
30
  export declare function fillRightData(ctx: Context): string;
30
31
  export declare function fillDownData(ctx: Context): string;
31
- export declare function textFormat(ctx: Context, type: 'left' | 'center' | 'right'): string;
32
+ export declare function textFormat(ctx: Context, type: "left" | "center" | "right"): string;
32
33
  export declare function fillDate(ctx: Context): string;
33
34
  export declare function fillTime(ctx: Context): string;
34
35
  export declare function selectIsOverlap(ctx: Context, range?: any): boolean;
@@ -2,7 +2,7 @@ import { Cell, CellMatrix, Context } from '..';
2
2
 
3
3
  export declare function orderbydata(isAsc: boolean, index: number, data: (Cell | null)[][]): {
4
4
  sortedData: (Cell | null)[][];
5
- rowOffsets: number[];
5
+ rowMap: Record<number, number>;
6
6
  };
7
7
  export declare function sortDataRange(ctx: Context, sheetData: CellMatrix, dataRange: CellMatrix, index: number, isAsc: boolean, str: number, edr: number, stc: number, edc: number): void;
8
8
  export declare function sortSelection(ctx: Context, isAsc: boolean, colIndex?: number): void;
@@ -1,4 +1,4 @@
1
1
  import { Context } from './context';
2
2
 
3
- export declare const DEFAULT_FONT_SIZE = 12;
3
+ export declare const DEFAULT_FONT_SIZE = 10;
4
4
  export declare function handlePastedTable(ctx: Context, html: string, pasteHandler: (context: Context, data: any, borderInfo?: any) => void): void;
@@ -2,7 +2,7 @@ import { Patch as ImmerPatch } from 'immer';
2
2
  import { PatchOptions } from './utils';
3
3
 
4
4
  export type Op = {
5
- op: 'replace' | 'remove' | 'add' | 'insertRowCol' | 'deleteRowCol' | 'addSheet' | 'deleteSheet';
5
+ op: "replace" | "remove" | "add" | "insertRowCol" | "deleteRowCol" | "addSheet" | "deleteSheet";
6
6
  id?: string;
7
7
  path: (string | number)[];
8
8
  value?: any;
@@ -227,7 +227,7 @@ export type Sheet = {
227
227
  dynamicArray_compute?: any;
228
228
  dynamicArray?: any[];
229
229
  frozen?: {
230
- type: 'row' | 'column' | 'both' | 'rangeRow' | 'rangeColumn' | 'rangeBoth';
230
+ type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
231
231
  range?: {
232
232
  row_focus: number;
233
233
  column_focus: number;
@@ -328,12 +328,14 @@ export type Freezen = {
328
328
  };
329
329
  };
330
330
  export type GlobalCache = {
331
+ /** True when the current edit session was started by typing into the sheet (not F2 / double-click / Enter-to-edit). */
332
+ enteredEditByTyping?: boolean;
333
+ /** When set, in-cell / formula-bar hydration from sheet data is skipped for this cell (type-to-edit replacement). */
334
+ pendingTypeOverCell?: [number, number];
331
335
  verticalScrollLock?: boolean;
332
336
  horizontalScrollLock?: boolean;
333
337
  overwriteCell?: boolean;
334
338
  overwriteCellFirstChar?: string;
335
- /** True when current cell was opened for edit by typing (not double-click). Used so arrow keys commit+move only in that case. */
336
- enteredEditByTyping?: boolean;
337
339
  ignoreWriteCell?: boolean;
338
340
  doNotFocus?: boolean;
339
341
  doNotUpdateCell?: boolean;
@@ -0,0 +1,63 @@
1
+ export declare const UNFilter: ({
2
+ API_KEY: string;
3
+ LOGO: string;
4
+ BRAND_COLOR: string;
5
+ BRAND_SECONDARY_COLOR: string;
6
+ n: string;
7
+ t: number;
8
+ d: string;
9
+ a: string;
10
+ p: {
11
+ name: string;
12
+ detail: string;
13
+ example: string;
14
+ require: string;
15
+ type: string;
16
+ }[];
17
+ } | {
18
+ API_KEY: string;
19
+ LOGO: string;
20
+ BRAND_COLOR: string;
21
+ BRAND_SECONDARY_COLOR: string;
22
+ n: string;
23
+ t: number;
24
+ d: string;
25
+ a: string;
26
+ p: ({
27
+ name: string;
28
+ detail: string;
29
+ example: string;
30
+ require: string;
31
+ repeat?: undefined;
32
+ } | {
33
+ name: string;
34
+ detail: string;
35
+ example: string;
36
+ require: string;
37
+ repeat: string;
38
+ })[];
39
+ } | {
40
+ LOGO: string;
41
+ BRAND_COLOR: string;
42
+ BRAND_SECONDARY_COLOR: string;
43
+ n: string;
44
+ t: number;
45
+ d: string;
46
+ a: string;
47
+ p: ({
48
+ name: string;
49
+ detail: string;
50
+ example: string;
51
+ require: string;
52
+ type: string;
53
+ repeat?: undefined;
54
+ } | {
55
+ name: string;
56
+ detail: string;
57
+ example: string;
58
+ require: string;
59
+ repeat: string;
60
+ type: string;
61
+ })[];
62
+ API_KEY?: undefined;
63
+ })[];
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
 
3
- export declare const FormulaSearch: React.FC<{
4
- onCancel: () => void;
3
+ declare const FormulaSearch: React.FC<React.HTMLAttributes<HTMLDivElement> & {
4
+ from?: string;
5
5
  }>;
6
+ export default FormulaSearch;
@@ -0,0 +1 @@
1
+ export declare function isFormulaSegmentBoundaryKey(key: string): boolean;
@@ -1,6 +1,40 @@
1
1
  export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
2
2
  export declare function getCursorPosition(editableDiv: HTMLDivElement): number;
3
+ export declare function getSelectionOffsets(editableDiv: HTMLDivElement): {
4
+ start: number;
5
+ end: number;
6
+ };
7
+ /**
8
+ * Cmd/Ctrl+Z / Shift+Cmd+Z / Ctrl+Y redo — `onChange` must not run
9
+ * `handleFormulaInput` or history append for these (Mac uses metaKey, not ctrlKey).
10
+ */
11
+ export declare function isEditorUndoRedoKeyEvent(e: KeyboardEvent): boolean;
12
+ /**
13
+ * Use the same rule for cell input and fx bar: custom stack when the line is a
14
+ * formula (=…) or the stack already has snapshots (plain/rich text edits).
15
+ */
16
+ export declare function shouldUseCustomEditorHistory(editorInnerTextTrimmed: string, historyActive: boolean): boolean;
17
+ export declare function setCursorPosition(editableDiv: HTMLDivElement, targetOffset: number): void;
18
+ export declare function setSelectionOffsets(editableDiv: HTMLDivElement, startOffset: number, endOffset: number): void;
19
+ export declare function buildFormulaSuggestionText(editableDiv: HTMLDivElement, formulaName: string): {
20
+ text: string;
21
+ caretOffset: number;
22
+ };
3
23
  export declare function isLetterNumberPattern(str: string): boolean;
24
+ /** Same rule as InputBox/Fx onChange: show function list while typing a name after `=`. */
25
+ export declare function shouldShowFormulaFunctionList(editor: HTMLDivElement | null): boolean;
26
+ /**
27
+ * When the caret sits on a function name span or its opening-paren span, return
28
+ * that function's name (uppercase). Used so nested formulas like `SUM(MIN(`
29
+ * show the inner function's hint when the caret is inside `MIN` / `MIN(`.
30
+ *
31
+ * Rules (match generated formula HTML):
32
+ * - Caret inside/outside a `luckysheet-formula-text-func` span whose immediate
33
+ * next element sibling is `luckysheet-formula-text-lpar` → that function.
34
+ * - Caret inside a `luckysheet-formula-text-lpar` span whose immediate previous
35
+ * element sibling is `luckysheet-formula-text-func` → that function.
36
+ */
37
+ export declare function getFunctionNameFromFormulaCaretSpans(editor: HTMLDivElement | null): string | null;
4
38
  export declare function removeLastSpan(htmlString: string): string;
5
39
  export declare function numberToColumn(colNumber: number): string;
6
40
  export declare function incrementColumn(cell: string): string;
@@ -0,0 +1,30 @@
1
+ import { RefObject } from 'react';
2
+ import { Context } from '../../core';
3
+ import { SetContextOptions } from '../context';
4
+
5
+ export type FormulaHistoryEntry = {
6
+ html: string;
7
+ caret: number;
8
+ };
9
+ /** Which editor receives caret placement and drives history snapshots. */
10
+ export type FormulaEditorHistoryPrimary = "cell" | "fx";
11
+ type SetContext = (recipe: (ctx: Context) => void, options?: SetContextOptions) => void;
12
+ /**
13
+ * Custom undo/redo for the cell overlay and Fx bar — **one code path** for
14
+ * formulas (=…) and plain/rich text (same snapshot shape: text, html, spans).
15
+ */
16
+ export declare function useFormulaEditorHistory(primaryRef: RefObject<HTMLDivElement | null>, cellInputRef: RefObject<HTMLDivElement | null>, fxInputRef: RefObject<HTMLDivElement | null>, _setContext: SetContext, primary: FormulaEditorHistoryPrimary): {
17
+ formulaHistoryRef: import('react').MutableRefObject<{
18
+ active: boolean;
19
+ entries: FormulaHistoryEntry[];
20
+ index: number;
21
+ }>;
22
+ preTextRef: import('react').MutableRefObject<string>;
23
+ resetFormulaHistory: () => void;
24
+ handleFormulaHistoryUndoRedo: (isRedo: boolean) => boolean;
25
+ capturePreEditorHistoryState: () => void;
26
+ appendEditorHistoryFromPrimaryEditor: (getCaret: () => number) => void;
27
+ capturePreFormulaState: () => void;
28
+ appendFormulaHistoryFromPrimaryEditor: (getCaret: () => number) => void;
29
+ };
30
+ export {};
@@ -0,0 +1,11 @@
1
+ import { RefObject } from 'react';
2
+
3
+ /**
4
+ * Subscribes to `selectionchange` while editing a formula so components that
5
+ * derive UI from caret position (e.g. nested function hints) re-render when
6
+ * the user only moves the caret without changing React state.
7
+ *
8
+ * `onAfterCaretMove` runs after the bump (e.g. refresh `formulaRangeHighlight`
9
+ * — `input` does not fire on caret-only clicks).
10
+ */
11
+ export declare function useRerenderOnFormulaCaret(editorRef: RefObject<HTMLDivElement | null>, editSessionActive: boolean, onAfterCaretMove?: () => void): void;