@fileverse-dev/dsheet 2.0.0 → 2.0.2-hyperlink

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 (40) hide show
  1. package/dist/editor/components/import-button-ui.d.ts +1 -1
  2. package/dist/editor/contexts/editor-context.d.ts +2 -2
  3. package/dist/editor/types.d.ts +1 -1
  4. package/dist/editor/utils/csv-export.d.ts +1 -1
  5. package/dist/editor/utils/csv-import.d.ts +1 -1
  6. package/dist/editor/utils/custom-toolbar-item.d.ts +4 -4
  7. package/dist/editor/utils/export-filename.d.ts +1 -0
  8. package/dist/editor/utils/formula-ui-sync.d.ts +6 -1
  9. package/dist/editor/utils/xlsx-export.d.ts +1 -1
  10. package/dist/{es-DHiiPgkU.js → es-DqFXH9BK.js} +9 -1
  11. package/dist/{hi-DgkuC9mD.js → hi-cBN4FoX2.js} +9 -1
  12. package/dist/index.es.js +22753 -21085
  13. package/dist/sheet-engine/core/api/common.d.ts +1 -4
  14. package/dist/sheet-engine/core/context.d.ts +5 -0
  15. package/dist/sheet-engine/core/index.d.ts +2 -2
  16. package/dist/sheet-engine/core/locale/en.d.ts +8 -0
  17. package/dist/sheet-engine/core/locale/es.d.ts +8 -0
  18. package/dist/sheet-engine/core/locale/hi.d.ts +8 -0
  19. package/dist/sheet-engine/core/locale/zh.d.ts +8 -0
  20. package/dist/sheet-engine/core/locale/zh_tw.d.ts +8 -0
  21. package/dist/sheet-engine/core/modules/cell.d.ts +5 -0
  22. package/dist/sheet-engine/core/modules/cursor.d.ts +5 -0
  23. package/dist/sheet-engine/core/modules/formula.d.ts +9 -0
  24. package/dist/sheet-engine/core/modules/hyperlink.d.ts +32 -4
  25. package/dist/sheet-engine/core/modules/index.d.ts +7 -7
  26. package/dist/sheet-engine/core/modules/inline-string.d.ts +20 -1
  27. package/dist/sheet-engine/core/modules/rowcol.d.ts +4 -0
  28. package/dist/sheet-engine/core/modules/selection.d.ts +6 -0
  29. package/dist/sheet-engine/core/modules/toolbar.d.ts +6 -1
  30. package/dist/sheet-engine/core/modules/validation.d.ts +11 -0
  31. package/dist/sheet-engine/core/types.d.ts +30 -4
  32. package/dist/sheet-engine/core/utils/patch.d.ts +2 -0
  33. package/dist/sheet-engine/react/components/ResetRowHeight/index.d.ts +3 -0
  34. package/dist/sheet-engine/react/components/Toolbar/Button.d.ts +1 -0
  35. package/dist/sheet-engine/react/components/Workbook/api.d.ts +3 -4
  36. package/dist/sheet-engine/react/components/Workbook/index.d.ts +2 -4
  37. package/dist/style.css +1 -1
  38. package/dist/{zh-ForBOJJx.js → zh-UJov73Dl.js} +9 -1
  39. package/dist/{zh_tw-CjJceJE_.js → zh_tw-DTGOcDTq.js} +9 -1
  40. package/package.json +2 -2
@@ -56,10 +56,7 @@ export declare function getSheetWithLatestCelldata(ctx: Context, options?: Commo
56
56
  luckysheet_alternateformat_save?: any[];
57
57
  dataVerification?: any;
58
58
  conditionRules?: import('../types').ConditionRulesProps;
59
- hyperlink?: Record<string, {
60
- linkType: string;
61
- linkAddress: string;
62
- }>;
59
+ hyperlink?: Record<string, import('..').HyperlinkEntry | import('..').HyperlinkEntry[]>;
63
60
  dynamicArray_compute?: any;
64
61
  dynamicArray?: any[];
65
62
  frozen?: {
@@ -192,6 +192,11 @@ export type Context = {
192
192
  luckysheetPaintSingle: boolean;
193
193
  defaultCell: Cell;
194
194
  groupValuesRefreshData: any[];
195
+ /**
196
+ * Incremented when formula `func_selectedrange` moves via keyboard (`rangeOfFormula`)
197
+ * so React re-renders — `FormulaCache` is a class and Immer does not track it.
198
+ */
199
+ formulaRangeNavRevision: number;
195
200
  formulaCache: FormulaCache;
196
201
  hooks: Hooks;
197
202
  showSheetList?: boolean;
@@ -7,9 +7,9 @@ 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, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, normalizeSelection, syncPrimaryCellActiveFromSelection, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, 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';
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, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, normalizeSelection, syncPrimaryCellActiveFromSelection, 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, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, 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, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, saveHyperlink, removeHyperlink, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, 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, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, execFunctionGroup, 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';
14
- export type { Op, Cell, CellWithRowAndCol, CellMatrix, 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, } from './types';
15
15
  export { cellFadeAnimator, markCellChanged } from './animate';
@@ -379,6 +379,14 @@ declare const _default: {
379
379
  cannotDeleteColumnReadOnly: string;
380
380
  cannotInsertOnRowReadOnly: string;
381
381
  cannotInsertOnColumnReadOnly: string;
382
+ insertRowAboveOne: string;
383
+ insertRowsAboveN: string;
384
+ insertRowBelowOne: string;
385
+ insertRowsBelowN: string;
386
+ insertColumnLeftOne: string;
387
+ insertColumnsLeftN: string;
388
+ insertColumnRightOne: string;
389
+ insertColumnsRightN: string;
382
390
  rowOverLimit: string;
383
391
  columnOverLimit: string;
384
392
  conditionFormat: string;
@@ -548,6 +548,14 @@ declare const _default: {
548
548
  cannotDeleteColumnReadOnly: string;
549
549
  cannotInsertOnRowReadOnly: string;
550
550
  cannotInsertOnColumnReadOnly: string;
551
+ insertRowAboveOne: string;
552
+ insertRowsAboveN: string;
553
+ insertRowBelowOne: string;
554
+ insertRowsBelowN: string;
555
+ insertColumnLeftOne: string;
556
+ insertColumnsLeftN: string;
557
+ insertColumnRightOne: string;
558
+ insertColumnsRightN: string;
551
559
  rowOverLimit: string;
552
560
  columnOverLimit: string;
553
561
  };
@@ -418,6 +418,14 @@ declare const _default: {
418
418
  cannotDeleteColumnReadOnly: string;
419
419
  cannotInsertOnRowReadOnly: string;
420
420
  cannotInsertOnColumnReadOnly: string;
421
+ insertRowAboveOne: string;
422
+ insertRowsAboveN: string;
423
+ insertRowBelowOne: string;
424
+ insertRowsBelowN: string;
425
+ insertColumnLeftOne: string;
426
+ insertColumnsLeftN: string;
427
+ insertColumnRightOne: string;
428
+ insertColumnsRightN: string;
421
429
  rowOverLimit: string;
422
430
  columnOverLimit: string;
423
431
  };
@@ -435,6 +435,14 @@ declare const _default: {
435
435
  cannotDeleteColumnReadOnly: string;
436
436
  cannotInsertOnRowReadOnly: string;
437
437
  cannotInsertOnColumnReadOnly: string;
438
+ insertRowAboveOne: string;
439
+ insertRowsAboveN: string;
440
+ insertRowBelowOne: string;
441
+ insertRowsBelowN: string;
442
+ insertColumnLeftOne: string;
443
+ insertColumnsLeftN: string;
444
+ insertColumnRightOne: string;
445
+ insertColumnsRightN: string;
438
446
  rowOverLimit: string;
439
447
  columnOverLimit: string;
440
448
  conditionFormat: string;
@@ -581,6 +581,14 @@ declare const _default: {
581
581
  cannotDeleteColumnReadOnly: string;
582
582
  cannotInsertOnRowReadOnly: string;
583
583
  cannotInsertOnColumnReadOnly: string;
584
+ insertRowAboveOne: string;
585
+ insertRowsAboveN: string;
586
+ insertRowBelowOne: string;
587
+ insertRowsBelowN: string;
588
+ insertColumnLeftOne: string;
589
+ insertColumnsLeftN: string;
590
+ insertColumnRightOne: string;
591
+ insertColumnsRightN: string;
584
592
  rowOverLimit: string;
585
593
  columnOverLimit: string;
586
594
  };
@@ -1,6 +1,11 @@
1
1
  import { Context } from '../context';
2
2
  import { Cell, CellMatrix, Range, Selection, SingleRange } from '../types';
3
3
 
4
+ /**
5
+ * Recompute auto row height for one row from wrap/inline cells; updates cfg.rowlen and ctx.config.
6
+ * Used from updateCell and deleteSelectedCellText (bulk clear).
7
+ */
8
+ export declare function recalcAutoRowHeightForRow(ctx: Context, r: number, d: CellMatrix, canvas: CanvasRenderingContext2D | null | undefined): void;
4
9
  export declare function normalizedCellAttr(cell: Cell, attr: keyof Cell, defaultFontSize?: number): any;
5
10
  export declare function normalizedAttr(data: CellMatrix, r: number, c: number, attr: keyof Cell): any;
6
11
  export declare function getCellValue(r: number, c: number, data: CellMatrix, attr?: keyof Cell): any;
@@ -1,6 +1,11 @@
1
1
  export declare function moveToEnd(obj: HTMLDivElement): void;
2
2
  export declare function selectTextContent(ele: HTMLElement): void;
3
3
  export declare function selectTextContentCross(sEle: HTMLElement, eEle: HTMLElement): void;
4
+ /**
5
+ * Flat character offset (normalized newlines) of the selection **focus** within `element`.
6
+ * Use for insert position when opening link UI so appended text goes where the caret was.
7
+ */
8
+ export declare function getFocusCharacterOffset(element: HTMLElement): number | null;
4
9
  /** Returns character offsets of the current selection within the element, or null if collapsed/outside. */
5
10
  export declare function getSelectionCharacterOffsets(element: Node): {
6
11
  start: number;
@@ -23,6 +23,8 @@ export declare class FormulaCache {
23
23
  rangedrag_row_start?: boolean;
24
24
  rangeSelectionActive?: boolean | null;
25
25
  keyboardRangeSelectionLock?: boolean;
26
+ /** True after arrow/Shift+arrow moved `func_selectedrange` without updating yellow selection. */
27
+ formulaKeyboardRefSync?: boolean;
26
28
  formulaEditorOwner?: "cell" | "fx" | null;
27
29
  functionRangeIndex?: number[];
28
30
  functionlistMap: any;
@@ -39,6 +41,13 @@ export declare function insertUpdateFunctionGroup(ctx: Context, r: number, c: nu
39
41
  export declare function execfunction(ctx: Context, txt: string, r: number, c: number, id?: string, calcChainSet?: Set<string>, isrefresh?: boolean, notInsertFunc?: boolean): any[];
40
42
  export declare function groupValuesRefresh(ctx: Context): void;
41
43
  export declare function execFunctionGroup(ctx: Context, origin_r: number, origin_c: number, value: any, id?: string, data?: any, isForce?: boolean): void;
44
+ /**
45
+ * Before the first `moveHighlightCell/Range(..., "rangeOfFormula")` while editing
46
+ * a formula, copy the current yellow selection into `func_selectedrange` so
47
+ * keyboard navigation updates only the blue formula overlay (like mouse drag),
48
+ * without resizing `luckysheet_select_save`.
49
+ */
50
+ export declare function seedFormulaFuncSelectedRangeFromLastSelection(ctx: Context): boolean;
42
51
  export declare function createFormulaRangeSelect(ctx: Context, select: {
43
52
  rangeIndex: number;
44
53
  } & Rect): void;
@@ -1,19 +1,39 @@
1
1
  import { Context } from '../context';
2
- import { GlobalCache } from '../types';
2
+ import { Cell, GlobalCache, HyperlinkEntry } from '../types';
3
3
 
4
4
  export declare function getCellRowColumn(ctx: Context, e: MouseEvent, container: HTMLDivElement, scrollX: HTMLDivElement, scrollY: HTMLDivElement): {
5
5
  r: number;
6
6
  c: number;
7
7
  } | undefined;
8
- export declare function getCellHyperlink(ctx: Context, r: number, c: number): {
9
- linkType: string;
10
- linkAddress: string;
8
+ export declare function getCellHyperlinks(ctx: Context, r: number, c: number): HyperlinkEntry[];
9
+ export declare function getCellHyperlink(ctx: Context, r: number, c: number): HyperlinkEntry;
10
+ /** Join display text for all inline segments that use this link. */
11
+ export declare function getHyperlinkDisplayTextInCell(cell: Cell | null | undefined, link: HyperlinkEntry): string;
12
+ /** Plain-text [start, end) of consecutive inline segments that carry `target`. */
13
+ export declare function getInlineLinkPlainRange(cell: Cell | null | undefined, target: HyperlinkEntry): {
14
+ start: number;
15
+ end: number;
11
16
  } | undefined;
17
+ /**
18
+ * If every plain character in [start, end) lies in inline segments that share the same
19
+ * `link`, returns that link; otherwise undefined (mixed/unlinked text in range).
20
+ */
21
+ export declare function getUniformLinkCoveringPlainRange(cell: Cell | null | undefined, start: number, end: number): HyperlinkEntry | undefined;
22
+ /** Plain caret offset `pos` lies strictly inside a linked segment (before that segment's end). */
23
+ export declare function getUniformLinkAtPlainOffset(cell: Cell | null | undefined, pos: number): HyperlinkEntry | undefined;
24
+ /** After changing hyperlinks on (r,c), update or close `ctx.linkCard` if it matches. */
25
+ export declare function syncLinkCardAfterHyperlinkChange(ctx: Context, r: number, c: number): void;
12
26
  export declare function saveHyperlink(ctx: Context, r: number, c: number, linkText: string, linkType: string, linkAddress: string, options?: {
13
27
  applyToSelection?: boolean;
14
28
  cellInput?: HTMLDivElement | null;
29
+ /** When true, apply range from ctx.linkCard using cell data only (no active editor). */
30
+ applySelectionFromModel?: boolean;
15
31
  }): void;
16
32
  export declare function removeHyperlink(ctx: Context, r: number, c: number): void;
33
+ /** Remove one distinct hyperlink (inline segment link or sheet map entry). */
34
+ export declare function removeHyperlinkForLink(ctx: Context, r: number, c: number, target: HyperlinkEntry): void;
35
+ /** Update URL/type (and display text when a single segment carries this link). */
36
+ export declare function updateHyperlinkForLink(ctx: Context, r: number, c: number, target: HyperlinkEntry, linkText: string, linkType: string, linkAddress: string): void;
17
37
  export declare function showLinkCard(ctx: Context, r: number, c: number, options?: {
18
38
  applyToSelection?: boolean;
19
39
  originText?: string;
@@ -21,6 +41,14 @@ export declare function showLinkCard(ctx: Context, r: number, c: number, options
21
41
  start: number;
22
42
  end: number;
23
43
  };
44
+ linkInsertOffset?: number;
45
+ /** URL/type defaults when inserting but selection (or cell) already maps to one link */
46
+ prefillLink?: HyperlinkEntry;
47
+ /**
48
+ * In-cell edit: show view-only card for this hyperlink (caret / selection inside that
49
+ * linked run in the contenteditable). Suppresses whole-cell hover list.
50
+ */
51
+ caretViewLink?: HyperlinkEntry;
24
52
  }, isEditing?: boolean, isMouseDown?: boolean): void;
25
53
  export declare function goToLink(ctx: Context, r: number, c: number, linkType: string, linkAddress: string, scrollbarX: HTMLDivElement, scrollbarY: HTMLDivElement): void;
26
54
  export declare function isLinkValid(ctx: Context, linkType: string, linkAddress: string): {
@@ -3,14 +3,14 @@ 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, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, maybeRecoverDirtyRangeSelection, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, remapFormulaReferencesByMap, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, getFormulaRangeIndexForKeyboardSync, isFormulaReferenceInputMode, functionStrChange, setFormulaEditorOwner, getAllFunctionGroup, suppressFormulaRangeSelectionForInitialEdit, } from './formula';
6
+ 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
7
  export { initFreeze } from './freeze';
8
- export { isInlineStringCell, getInlineStringNoStyle } from './inline-string';
8
+ export { isInlineStringCell, getInlineStringNoStyle, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, } from './inline-string';
9
9
  export { rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, } from './location';
10
10
  export { insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, hideCRCount, } from './rowcol';
11
- export { scrollToHighlightCell, seletedHighlistByindex, selectTitlesMap, selectTitlesRange, normalizeSelection, syncPrimaryCellActiveFromSelection, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, rangeValueToHtml, } from './selection';
11
+ export { scrollToHighlightCell, seletedHighlistByindex, selectTitlesMap, selectTitlesRange, normalizeSelection, syncPrimaryCellActiveFromSelection, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, rangeValueToHtml, } from './selection';
12
12
  export { addSheet, deleteSheet, editSheetName, changeSheet, updateSheet, } from './sheet';
13
- export { updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, toolbarItemClickHandler, toolbarItemSelectedFunc, updateFormatCell, cancelPaintModel, } from './toolbar';
13
+ export { updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, toolbarItemClickHandler, toolbarItemSelectedFunc, updateFormatCell, cancelPaintModel, } from './toolbar';
14
14
  export { handleScreenShot } from './screenshot';
15
15
  export { drawArrow, setEditingComment, removeEditingComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxResize, onCommentBoxResizeEnd, removeOverShowComment, } from './comment';
16
16
  export { showImgChooser, insertImage, removeActiveImage, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, onImageMove, onImageMoveEnd, onImageResize, onImageResizeEnd, } from './image';
@@ -18,7 +18,7 @@ export { createDropCellRange, dropCellCache, getTypeItemHide, updateDropCell, }
18
18
  export { mergeCells } from './merge';
19
19
  export { sortSelection, spillSortResult } from './sort';
20
20
  export { searchAll, searchNext, replace, replaceAll } from './searchReplace';
21
- export { getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, } from './hyperlink';
21
+ export { getCellRowColumn, getCellHyperlink, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, saveHyperlink, removeHyperlink, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, showLinkCard, goToLink, isLinkValid, } from './hyperlink';
22
22
  export { createFilterOptions, clearFilter, createFilter, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, } from './filter';
23
23
  export type { FilterDate, FilterValue, FilterColor } from './filter';
24
24
  export { onCellsMoveStart, onCellsMove, onCellsMoveEnd } from './moveCells';
@@ -34,7 +34,7 @@ export { jfrefreshgrid } from './refresh';
34
34
  export { sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, } from './iframe';
35
35
  export { setCellError, clearCellError, overShowError, } from './error-state-helpers';
36
36
  export { checkCellIsLocked } from './protection';
37
- export { isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, } from './validation';
38
- export { iscelldata, getcellrange, execfunction, insertUpdateFunctionGroup, functionCopy, } from './formula';
37
+ export { isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, } from './validation';
38
+ export { iscelldata, getcellrange, execfunction, execFunctionGroup, insertUpdateFunctionGroup, functionCopy, } from './formula';
39
39
  export { checkCF, getComputeMap } from './ConditionFormat';
40
40
  export { getdatabyselection, getQKBorder } from './cell';
@@ -1,5 +1,5 @@
1
1
  import { Context } from '../context';
2
- import { Cell, CellMatrix, CellStyle } from '../types';
2
+ import { Cell, CellMatrix, CellStyle, HyperlinkEntry } from '../types';
3
3
 
4
4
  export declare const attrToCssName: {
5
5
  bl: string;
@@ -36,6 +36,14 @@ export type InlineSegmentLink = {
36
36
  linkType: string;
37
37
  linkAddress: string;
38
38
  };
39
+ export declare function getHyperlinksFromInlineSegments(cell: Cell | null | undefined): InlineSegmentLink[];
40
+ /** Matches `getLinkStyleCssText` / apply-hyperlink blue foreground in the editor. */
41
+ export declare function isDefaultHyperlinkForeground(fc: string): boolean;
42
+ /**
43
+ * Drop fc/un that hyperlink insertion adds to inline runs (link metadata is removed separately).
44
+ * Preserves user bold/italic/etc. on the same segment.
45
+ */
46
+ export declare function stripInlineSegmentHyperlinkDecoration(seg: CellStyle): void;
39
47
  export declare function convertSpanToShareString($dom: NodeListOf<HTMLSpanElement>, originCell: Cell): (CellStyle & {
40
48
  v?: string;
41
49
  link?: InlineSegmentLink;
@@ -44,3 +52,14 @@ export declare function updateInlineStringFormatOutside(cell: Cell, key: string,
44
52
  export declare function updateInlineStringFormat(ctx: Context, attr: keyof Cell, value: any, cellInput: HTMLDivElement): void;
45
53
  /** Applies link style (blue + underline) and data-link-* to the current selection in cellInput. Persisted on blur via convertSpanToShareString. */
46
54
  export declare function applyLinkToSelection(cellInput: HTMLDivElement, linkType: string, linkAddress: string): void;
55
+ /**
56
+ * When the window selection is still inside the cell editor, read hyperlink from the
57
+ * linked span(s) at both range endpoints (same link required).
58
+ */
59
+ export declare function getUniformLinkFromWindowSelectionInEditor(root: HTMLElement): HyperlinkEntry | undefined;
60
+ /**
61
+ * Caret or range inside `root`: returns the hyperlink on the collapsed caret, or the
62
+ * uniform link when a non-collapsed selection stays within one link (same as
63
+ * {@link getUniformLinkFromWindowSelectionInEditor}).
64
+ */
65
+ export declare function getHyperlinkAtCaretInContentEditable(root: HTMLElement): HyperlinkEntry | undefined;
@@ -15,6 +15,10 @@ export declare function insertRowCol(ctx: Context, op: {
15
15
  count: number;
16
16
  direction: "lefttop" | "rightbottom";
17
17
  id: string;
18
+ /** Pre-insert row index for each inserted row (length must equal count). */
19
+ templateSourceRows?: number[];
20
+ /** Pre-insert column index for each inserted column (length must equal count). */
21
+ templateSourceColumns?: number[];
18
22
  }, changeSelection?: boolean): void;
19
23
  export declare function deleteRowCol(ctx: Context, op: {
20
24
  type: "row" | "column";
@@ -32,6 +32,12 @@ export declare function advancePrimaryCellInLastMultiSelection(ctx: Context, for
32
32
  * selection that runs `normalizeSelection` will re-sync from the new range.
33
33
  */
34
34
  export declare function setPrimaryCellActive(ctx: Context, r: number, c: number): void;
35
+ /**
36
+ * After formula segment / delete handling, move selection focus to the edited cell
37
+ * (r,c). If the sheet already has a multi-cell range and (r,c) is inside it, keep
38
+ * that range so Enter-primary navigation + typing do not collapse the yellow box.
39
+ */
40
+ export declare function snapSheetSelectionFocusToCellPreserveMultiRange(ctx: Context, r: number, c: number): void;
35
41
  export declare function normalizeSelection(ctx: Context, selection: SheetType["luckysheet_select_save"]): import('..').Selection[] | undefined;
36
42
  export declare function selectTitlesMap(rangeMap: Record<string, number>, range1: number, range2: number): Record<string, number>;
37
43
  export declare function selectTitlesRange(map: Record<string, number>): number[][];
@@ -27,7 +27,12 @@ export declare function handleSort(ctx: Context, isAsc: boolean): void;
27
27
  export declare function handleFreeze(ctx: Context, type: string): void;
28
28
  export declare function handleTextSize(ctx: Context, cellInput: HTMLDivElement, size: number, canvas?: CanvasRenderingContext2D): void;
29
29
  export declare function handleSum(ctx: Context, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null | undefined, cache?: GlobalCache): void;
30
- export declare function handleLink(ctx: Context, cellInput: HTMLDivElement | null | undefined): void;
30
+ /**
31
+ * Records caret and selection offsets for the active cell editor into `cache`.
32
+ * Call on toolbar link mousedown (before focus leaves the editor) and from selectionchange while editing.
33
+ */
34
+ export declare function captureLinkEditorOpenSnapshot(ctx: Context, cellInput: HTMLDivElement | null | undefined, cache: GlobalCache | undefined): void;
35
+ export declare function handleLink(ctx: Context, cellInput: HTMLDivElement | null | undefined, cache?: GlobalCache): void;
31
36
  export declare function toolbarItemClickHandler(name: string): ToolbarItemClickHandler;
32
37
  export declare function toolbarItemSelectedFunc(name: string): ToolbarItemSelectedFunc;
33
38
  export {};
@@ -16,6 +16,17 @@ export declare function valueIsError(value: string): boolean;
16
16
  export declare function isRealNull(val: any): boolean;
17
17
  export declare function isHexValue(str: string): boolean;
18
18
  export declare function isRealNum(val: any): boolean;
19
+ /**
20
+ * Explicit number format (`t === 'n'`) or General/Automatic with a numeric stored value (`t === 'g'`).
21
+ * Use wherever logic previously required `ct.t === 'n'` so Automatic numeric cells behave the same.
22
+ */
23
+ export declare function isNumericCellType(cell: {
24
+ ct?: {
25
+ t?: string;
26
+ fa?: string;
27
+ };
28
+ v?: unknown;
29
+ } | null | undefined): boolean;
19
30
  export type DateFormatInfo = {
20
31
  year: number;
21
32
  month: number;
@@ -46,6 +46,7 @@ export type Cell = {
46
46
  ct?: {
47
47
  fa?: string;
48
48
  t?: string;
49
+ tb?: string;
49
50
  s?: any;
50
51
  };
51
52
  qp?: number;
@@ -78,6 +79,10 @@ export type CellWithRowAndCol = {
78
79
  v: Cell | null;
79
80
  };
80
81
  export type CellMatrix = (Cell | null)[][];
82
+ export type HyperlinkEntry = {
83
+ linkType: string;
84
+ linkAddress: string;
85
+ };
81
86
  export type Selection = {
82
87
  left?: number;
83
88
  width?: number;
@@ -220,10 +225,7 @@ export type Sheet = {
220
225
  luckysheet_alternateformat_save?: any[];
221
226
  dataVerification?: any;
222
227
  conditionRules?: ConditionRulesProps;
223
- hyperlink?: Record<string, {
224
- linkType: string;
225
- linkAddress: string;
226
- }>;
228
+ hyperlink?: Record<string, HyperlinkEntry | HyperlinkEntry[]>;
227
229
  dynamicArray_compute?: any;
228
230
  dynamicArray?: any[];
229
231
  frozen?: {
@@ -264,6 +266,10 @@ export type LinkCardProps = {
264
266
  originText: string;
265
267
  originType: string;
266
268
  originAddress: string;
269
+ /** Distinct links in this cell (rich text); view lists each with its own actions */
270
+ links?: HyperlinkEntry[];
271
+ /** When editing, index into `links` for multi-link cells (which URL is being edited) */
272
+ editingLinkIndex?: number | null;
267
273
  position: {
268
274
  cellLeft: number;
269
275
  cellBottom: number;
@@ -277,6 +283,11 @@ export type LinkCardProps = {
277
283
  start: number;
278
284
  end: number;
279
285
  };
286
+ /**
287
+ * Normalized flat offset where typed / appended link text should go (selection focus),
288
+ * especially when display text is edited and inserted. Falls back to selection end if unset.
289
+ */
290
+ linkInsertOffset?: number;
280
291
  };
281
292
  export type RangeDialogProps = {
282
293
  show: boolean;
@@ -398,6 +409,21 @@ export type GlobalCache = {
398
409
  } | undefined;
399
410
  };
400
411
  };
412
+ /**
413
+ * Last caret/selection in the cell editor while editing, captured on selectionchange
414
+ * and on toolbar link mousedown so handleLink still knows insert offsets after focus moves.
415
+ */
416
+ linkEditorOpenSnapshot?: {
417
+ sheetId: string;
418
+ r: number;
419
+ c: number;
420
+ focusOffset: number;
421
+ range: {
422
+ start: number;
423
+ end: number;
424
+ } | null;
425
+ selectedPlain: string;
426
+ };
401
427
  dragCellStartPos?: {
402
428
  x: number;
403
429
  y: number;
@@ -15,6 +15,8 @@ export type PatchOptions = {
15
15
  count: number;
16
16
  direction: 'lefttop' | 'rightbottom';
17
17
  id: string;
18
+ templateSourceRows?: number[];
19
+ templateSourceColumns?: number[];
18
20
  };
19
21
  deleteRowColOp?: {
20
22
  type: 'row' | 'column';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+
3
+ export declare const ResetRowHeight: React.FC;
@@ -4,6 +4,7 @@ type Props = {
4
4
  tooltip: string;
5
5
  iconId: string;
6
6
  onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
7
+ onMouseDown?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
7
8
  disabled?: boolean;
8
9
  selected?: boolean;
9
10
  children?: React.ReactNode;
@@ -6,6 +6,8 @@ import { useDialog } from '../../hooks/useDialog';
6
6
  export declare function generateAPIs(context: Context, setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void, handleUndo: () => void, handleRedo: () => void, settings: Required<Settings>, cellInput: HTMLDivElement | null, scrollbarX: HTMLDivElement | null, scrollbarY: HTMLDivElement | null, globalCache: GlobalCache | null, refs: any): {
7
7
  applyOp: (ops: Op[]) => void;
8
8
  getCryptoPrice: typeof getCryptoPrice;
9
+ /** Runs the formula engine on every cell in calcChain (all sheets). Use after XLSX import so values are computed, not cached from the file. */
10
+ recalculateAllFormulas: () => void;
9
11
  getCellValue: (row: number, column: number, options?: api.CommonOptions & {
10
12
  type?: keyof Cell;
11
13
  }) => any;
@@ -105,10 +107,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
105
107
  luckysheet_alternateformat_save?: any[];
106
108
  dataVerification?: any;
107
109
  conditionRules?: import('../../../core/types').ConditionRulesProps;
108
- hyperlink?: Record<string, {
109
- linkType: string;
110
- linkAddress: string;
111
- }>;
110
+ hyperlink?: Record<string, import('../../../core').HyperlinkEntry | import('../../../core').HyperlinkEntry[]>;
112
111
  dynamicArray_compute?: any;
113
112
  dynamicArray?: any[];
114
113
  frozen?: {
@@ -12,6 +12,7 @@ type AdditionalProps = {
12
12
  declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{
13
13
  applyOp: (ops: Op[]) => void;
14
14
  getCryptoPrice: typeof getCryptoPrice;
15
+ recalculateAllFormulas: () => void;
15
16
  getCellValue: (row: number, column: number, options?: api.CommonOptions & {
16
17
  type?: keyof import('../../../core').Cell;
17
18
  }) => any;
@@ -111,10 +112,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
111
112
  luckysheet_alternateformat_save?: any[];
112
113
  dataVerification?: any;
113
114
  conditionRules?: import('../../../core/types').ConditionRulesProps;
114
- hyperlink?: Record<string, {
115
- linkType: string;
116
- linkAddress: string;
117
- }>;
115
+ hyperlink?: Record<string, import('../../../core').HyperlinkEntry | import('../../../core').HyperlinkEntry[]>;
118
116
  dynamicArray_compute?: any;
119
117
  dynamicArray?: any[];
120
118
  frozen?: {