@fileverse-dev/dsheet 2.0.6 → 2.0.7-percent

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.
@@ -40,6 +40,32 @@ export type Context = {
40
40
  presences?: Presence[];
41
41
  showSearch?: boolean;
42
42
  showReplace?: boolean;
43
+ findReplaceHiddenDuringRangePick?: boolean;
44
+ findReplaceRestoreVisibility?: {
45
+ showSearch: boolean;
46
+ showReplace: boolean;
47
+ };
48
+ showQuickSearch?: boolean;
49
+ quickSearchFocusNonce?: number;
50
+ findReplacePrefill?: string;
51
+ quickSearchLoading?: boolean;
52
+ quickSearchHighlight?: {
53
+ matches: {
54
+ r: number;
55
+ c: number;
56
+ }[];
57
+ activeIndex: number;
58
+ } | null;
59
+ searchRangeScopeHighlight?: {
60
+ row: number[];
61
+ column: number[];
62
+ } | null;
63
+ /**
64
+ * When true, render the specific-range scope border in an emphasized style
65
+ * (e.g. after pressing Find). When false, keep a lighter border after
66
+ * confirming the range.
67
+ */
68
+ searchRangeScopeEmphasis?: boolean;
43
69
  linkCard?: LinkCardProps;
44
70
  rangeDialog?: RangeDialogProps;
45
71
  warnDialog?: string;
@@ -7,9 +7,10 @@ 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, 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';
10
+ export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, FormulaCache, groupValuesRefresh, execFunctionGroup, 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, 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, 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, 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, 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
14
  export type { Op, Cell, CellWithRowAndCol, CellMatrix, HyperlinkEntry, Selection, Presence, Sheet, GlobalCache, SingleRange, Range, SearchResult, LinkCardProps, LiveQueryData, Freezen, } from './types';
15
+ export type { CheckModes, HyperlinkMap, FindSearchScope, SearchHiddenConfig, SearchNextResult, ReplaceAllResult, } from './modules/searchReplace';
15
16
  export { cellFadeAnimator, markCellChanged } from './animate';
@@ -467,11 +467,38 @@ declare const _default: {
467
467
  locationExample: string;
468
468
  lessTwoRowTip: string;
469
469
  lessTwoColumnTip: string;
470
+ searchNoResults: string;
471
+ searchMatchCountAria: string;
472
+ quickSearchDialogAria: string;
473
+ quickSearchPlaceholder: string;
474
+ quickSearchSearching: string;
475
+ quickSearchNoResults: string;
476
+ quickSearchCounterTemplate: string;
477
+ quickSearchMatchCountAria: string;
478
+ quickSearchPrevAria: string;
479
+ quickSearchNextAria: string;
480
+ quickSearchMoreOptionsTitle: string;
481
+ quickSearchOpenFindReplaceAria: string;
482
+ quickSearchCloseAria: string;
470
483
  findTextbox: string;
471
484
  replaceTextbox: string;
472
485
  regexTextbox: string;
473
486
  wholeTextbox: string;
474
487
  distinguishTextbox: string;
488
+ formulaTextbox: string;
489
+ linkTextbox: string;
490
+ allSheetsTextbox: string;
491
+ searchScopeLabel: string;
492
+ searchScopeAllSheets: string;
493
+ searchScopeThisSheet: string;
494
+ searchScopeSpecificRange: string;
495
+ rangeInputPlaceholder: string;
496
+ rangeInputInvalidError: string;
497
+ rangeSelectOnSheetTitle: string;
498
+ selectDataRangeTitle: string;
499
+ replaceAllWithSkippedTip: string;
500
+ replaceAllSuccessInfotext: string;
501
+ replaceAllSuccessWithSkippedInfotext: string;
475
502
  allReplaceBtn: string;
476
503
  replaceBtn: string;
477
504
  allFindBtn: string;
@@ -630,11 +630,28 @@ declare const _default: {
630
630
  locationExample: string;
631
631
  lessTwoRowTip: string;
632
632
  lessTwoColumnTip: string;
633
+ quickSearchDialogAria: string;
634
+ quickSearchPlaceholder: string;
635
+ quickSearchSearching: string;
636
+ quickSearchNoResults: string;
637
+ quickSearchCounterTemplate: string;
638
+ quickSearchMatchCountAria: string;
639
+ quickSearchPrevAria: string;
640
+ quickSearchNextAria: string;
641
+ quickSearchMoreOptionsTitle: string;
642
+ quickSearchOpenFindReplaceAria: string;
643
+ quickSearchCloseAria: string;
633
644
  findTextbox: string;
634
645
  replaceTextbox: string;
635
646
  regexTextbox: string;
636
647
  wholeTextbox: string;
637
648
  distinguishTextbox: string;
649
+ formulaTextbox: string;
650
+ linkTextbox: string;
651
+ allSheetsTextbox: string;
652
+ searchScopeLabel: string;
653
+ searchScopeAllSheets: string;
654
+ searchScopeThisSheet: string;
638
655
  allReplaceBtn: string;
639
656
  replaceBtn: string;
640
657
  allFindBtn: string;
@@ -505,11 +505,28 @@ declare const _default: {
505
505
  locationExample: string;
506
506
  lessTwoRowTip: string;
507
507
  lessTwoColumnTip: string;
508
+ quickSearchDialogAria: string;
509
+ quickSearchPlaceholder: string;
510
+ quickSearchSearching: string;
511
+ quickSearchNoResults: string;
512
+ quickSearchCounterTemplate: string;
513
+ quickSearchMatchCountAria: string;
514
+ quickSearchPrevAria: string;
515
+ quickSearchNextAria: string;
516
+ quickSearchMoreOptionsTitle: string;
517
+ quickSearchOpenFindReplaceAria: string;
518
+ quickSearchCloseAria: string;
508
519
  findTextbox: string;
509
520
  replaceTextbox: string;
510
521
  regexTextbox: string;
511
522
  wholeTextbox: string;
512
523
  distinguishTextbox: string;
524
+ formulaTextbox: string;
525
+ linkTextbox: string;
526
+ allSheetsTextbox: string;
527
+ searchScopeLabel: string;
528
+ searchScopeAllSheets: string;
529
+ searchScopeThisSheet: string;
513
530
  allReplaceBtn: string;
514
531
  replaceBtn: string;
515
532
  allFindBtn: string;
@@ -523,11 +523,28 @@ declare const _default: {
523
523
  locationExample: string;
524
524
  lessTwoRowTip: string;
525
525
  lessTwoColumnTip: string;
526
+ quickSearchDialogAria: string;
527
+ quickSearchPlaceholder: string;
528
+ quickSearchSearching: string;
529
+ quickSearchNoResults: string;
530
+ quickSearchCounterTemplate: string;
531
+ quickSearchMatchCountAria: string;
532
+ quickSearchPrevAria: string;
533
+ quickSearchNextAria: string;
534
+ quickSearchMoreOptionsTitle: string;
535
+ quickSearchOpenFindReplaceAria: string;
536
+ quickSearchCloseAria: string;
526
537
  findTextbox: string;
527
538
  replaceTextbox: string;
528
539
  regexTextbox: string;
529
540
  wholeTextbox: string;
530
541
  distinguishTextbox: string;
542
+ formulaTextbox: string;
543
+ linkTextbox: string;
544
+ allSheetsTextbox: string;
545
+ searchScopeLabel: string;
546
+ searchScopeAllSheets: string;
547
+ searchScopeThisSheet: string;
531
548
  allReplaceBtn: string;
532
549
  replaceBtn: string;
533
550
  allFindBtn: string;
@@ -668,11 +668,28 @@ declare const _default: {
668
668
  locationExample: string;
669
669
  lessTwoRowTip: string;
670
670
  lessTwoColumnTip: string;
671
+ quickSearchDialogAria: string;
672
+ quickSearchPlaceholder: string;
673
+ quickSearchSearching: string;
674
+ quickSearchNoResults: string;
675
+ quickSearchCounterTemplate: string;
676
+ quickSearchMatchCountAria: string;
677
+ quickSearchPrevAria: string;
678
+ quickSearchNextAria: string;
679
+ quickSearchMoreOptionsTitle: string;
680
+ quickSearchOpenFindReplaceAria: string;
681
+ quickSearchCloseAria: string;
671
682
  findTextbox: string;
672
683
  replaceTextbox: string;
673
684
  regexTextbox: string;
674
685
  wholeTextbox: string;
675
686
  distinguishTextbox: string;
687
+ formulaTextbox: string;
688
+ linkTextbox: string;
689
+ allSheetsTextbox: string;
690
+ searchScopeLabel: string;
691
+ searchScopeAllSheets: string;
692
+ searchScopeThisSheet: string;
676
693
  allReplaceBtn: string;
677
694
  replaceBtn: string;
678
695
  allFindBtn: string;
@@ -1,7 +1,66 @@
1
- import { CellMatrix } from '../types';
1
+ import { Cell, CellMatrix } from '../types';
2
2
 
3
+ /** Below this absolute value, never use automatic scientific (Sheets-like). */
4
+ export declare const GS_PLAIN_MAX_ABS = 999999999999997;
5
+ /** Smallest 16-digit positive integer — use plain / text, not E-notation. */
6
+ export declare const GS_SIXTEEN_DIGIT_MIN_ABS = 1000000000000000;
7
+ /** Scientific only in (GS_PLAIN_MAX_ABS, 1e15) — 999…997 itself stays plain. */
8
+ export declare function gsAllowsScientificMagnitude(av: number): boolean;
9
+ /** Integer string (optional `-`, optional `,`) with ≥16 digits — store literally under General/Auto. */
10
+ export declare function isSixteenPlusDigitIntegerString(value: unknown): boolean;
11
+ /**
12
+ * Display string for a JS number when `toString()` may use `e` notation.
13
+ * Applies Sheets-like rules: no E below GS_PLAIN_MAX_ABS or at/above 16-digit scale.
14
+ */
15
+ export declare function formatMForNumericCellAvoidingGsRules(v: number): string;
16
+ /**
17
+ * Numeric safety gate for formula-computed numbers:
18
+ * - integer beyond MAX_SAFE_INTEGER => scientific
19
+ * - significant digits > 15 => scientific
20
+ */
21
+ export declare function shouldUseScientificForComputedNumber(v: number): boolean;
22
+ export declare function formatScientificForComputedNumber(v: number): string;
23
+ export declare function formatCompactScientific(v: number, fractionDigits?: number): string;
24
+ /**
25
+ * Sheets-like Auto decimal display:
26
+ * keep about 10 visible digits total (integer digits + decimal digits), with rounding.
27
+ * Examples:
28
+ * - 999999999.478 -> 999999999.5
29
+ * - 123456.123456 -> 123456.1235
30
+ */
31
+ export declare function formatGeneralAutoDecimalWithTenDigitRule(v: number): string | null;
3
32
  export declare function datenum_local(v: Date, date1904?: number): number;
4
33
  export declare function genarate(value: string | number | boolean): any[] | null;
34
+ /** Crypto tickers for typed prefix (e.g. BTC123) — keep aligned with toolbar CRYPTO_OPTIONS. */
35
+ export declare const TYPED_CRYPTO_CURRENCY_PREFIXES: readonly ["BTC", "ETH", "SOL"];
36
+ /**
37
+ * True when `fa` matches formats produced by typed currency/crypto prefix (or the same shape).
38
+ * Used so the format dropdown shows "Currency" instead of mislabeling `#,##0` masks as "Number".
39
+ */
40
+ export declare function isTypedCurrencyDisplayFormat(fa: string | undefined, currencyDetail: unknown): boolean;
41
+ /**
42
+ * True for currency / accounting / crypto number formats where we should keep `fa` when the user
43
+ * types plain text, so a later numeric entry still formats like Google Sheets.
44
+ */
45
+ export declare function isCurrencyLikeNumberFormat(fa: string | undefined, currencyDetail: unknown): boolean;
46
+ /**
47
+ * If the user types a known currency/crypto prefix immediately followed by a parseable number
48
+ * (e.g. `$1,234.5`, `€100`, `BTC1.5`), return numeric cell value + matching currency format.
49
+ * Uses locale `currencyDetail` (fiat symbols); object-shaped locales yield no fiat prefixes.
50
+ */
51
+ export declare function parseCurrencyPrefixedInput(raw: string, currencyDetail: unknown): [string, {
52
+ fa: string;
53
+ t: string;
54
+ }, number] | null;
55
+ export declare function genarateOrCurrencyPrefixed(vupdateStr: string, vupdate: any, currencyDetail: unknown): ReturnType<typeof genarate>;
5
56
  export declare function update(fmt: string, v: any): string;
57
+ /** Max decimal places for toolbar +/- on General (Auto) without switching to a numeric `fa`. */
58
+ export declare const MAX_GENERAL_AUTO_DP = 15;
59
+ /**
60
+ * Recompute `m` for numeric cells with `fa === "General"`.
61
+ * When `ct.dp` is set (1..MAX), uses fixed decimals like Sheets Auto + decimal buttons.
62
+ * Otherwise uses the usual `genarate` General display.
63
+ */
64
+ export declare function refreshGeneralNumericDisplay(cell: Cell): void;
6
65
  export declare function is_date(fmt: string, v?: any): boolean;
7
66
  export declare function valueShowEs(r: number, c: number, d: CellMatrix): any;
@@ -2,7 +2,7 @@ export { getBorderInfoComputeRange, getBorderInfoCompute } from './border';
2
2
  export { normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, getInlineStringHTML, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, cancelFunctionrangeSelected, } from './cell';
3
3
  export { default as clipboard } from './clipboard';
4
4
  export { moveToEnd, getRangeRectsByCharacterOffset } from './cursor';
5
- export { update, is_date, valueShowEs } from './format';
5
+ export { update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, } from './format';
6
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
8
  export { isInlineStringCell, getInlineStringNoStyle, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, } from './inline-string';
@@ -17,7 +17,8 @@ export { showImgChooser, insertImage, removeActiveImage, cancelActiveImgItem, on
17
17
  export { createDropCellRange, dropCellCache, getTypeItemHide, updateDropCell, } from './dropCell';
18
18
  export { mergeCells } from './merge';
19
19
  export { sortSelection, spillSortResult } from './sort';
20
- export { searchAll, searchNext, replace, replaceAll } from './searchReplace';
20
+ export { searchAll, searchNext, replace, replaceAll, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, } from './searchReplace';
21
+ export type { CheckModes, HyperlinkMap, FindSearchScope, SearchHiddenConfig, SearchNextResult, ReplaceAllResult, } from './searchReplace';
21
22
  export { getCellRowColumn, getCellHyperlink, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, saveHyperlink, removeHyperlink, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, showLinkCard, goToLink, isLinkValid, } from './hyperlink';
22
23
  export { createFilterOptions, clearFilter, createFilter, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, } from './filter';
23
24
  export type { FilterDate, FilterValue, FilterColor } from './filter';
@@ -1,37 +1,129 @@
1
1
  import { Context } from '../context';
2
- import { CellMatrix, SearchResult, GlobalCache } from '../types';
2
+ import { CellMatrix, Selection, SearchResult, GlobalCache } from '../types';
3
3
 
4
+ /** Where find/replace scans on the current sheet (workbook-wide only applies to find-all). */
5
+ export type FindSearchScope = 'allSheets' | 'thisSheet' | 'specificRange';
6
+ /**
7
+ * Return value of {@link searchNext}.
8
+ *
9
+ * @remarks
10
+ * **Semver:** Older releases returned `string | null` from `searchNext` (a localized message, or `null` on success).
11
+ * The object form is a **breaking change** for callers that still expect `string | null`; update them to read
12
+ * {@link SearchNextResult.alertMsg} (and optionally {@link SearchNextResult.matchIndex} /
13
+ * {@link SearchNextResult.matchTotal} for on-sheet scoped search UI).
14
+ */
15
+ export type SearchNextResult = {
16
+ /** Localized message for an alert dialog, or `null` when the next/previous hit was selected successfully. */
17
+ alertMsg: string | null;
18
+ /**
19
+ * 0-based index of the selected hit in the current sheet's ordered hit list when
20
+ * `scope` is `thisSheet` or `specificRange` and navigation succeeded; otherwise `0`.
21
+ */
22
+ matchIndex: number;
23
+ /**
24
+ * Size of that hit list for `thisSheet` / `specificRange`; `0` when not applicable (e.g. `allSheets`, errors,
25
+ * or empty search).
26
+ */
27
+ matchTotal: number;
28
+ };
29
+ /** Outcome of {@link replaceAll} for UI (inline status vs. error message). */
30
+ export type ReplaceAllResult = {
31
+ ok: false;
32
+ message: string;
33
+ } | {
34
+ ok: true;
35
+ replaced: number;
36
+ skipped: number;
37
+ };
38
+ /** Full used grid on the active sheet for find/replace on this sheet; `null` if the sheet has no cells. */
39
+ export declare function getFindRangeOnCurrentSheet(flowdata: CellMatrix): Selection[] | null;
40
+ export type HyperlinkMap = Record<string, {
41
+ linkType?: string;
42
+ linkAddress?: string;
43
+ }>;
44
+ export interface CheckModes {
45
+ regCheck?: boolean;
46
+ wordCheck?: boolean;
47
+ caseCheck?: boolean;
48
+ /** Also search inside formula strings (cell.f) */
49
+ formulaCheck?: boolean;
50
+ /** Also search sheet hyperlink address/type for the cell */
51
+ linkCheck?: boolean;
52
+ }
53
+ /** Skip cells in hidden rows/columns (manual hide + filter). */
54
+ export type SearchHiddenConfig = {
55
+ rowhidden?: Record<string, number> | null;
56
+ colhidden?: Record<string, number> | null;
57
+ };
4
58
  export declare function getSearchIndexArr(searchText: string, range: {
5
59
  row: number[];
6
60
  column: number[];
7
- }[], flowdata: CellMatrix, { regCheck, wordCheck, caseCheck }?: {
8
- regCheck: boolean;
9
- wordCheck: boolean;
10
- caseCheck: boolean;
11
- }): {
61
+ }[], flowdata: CellMatrix, { regCheck, wordCheck, caseCheck, formulaCheck, linkCheck, }?: CheckModes, hyperlinkMap?: HyperlinkMap, hiddenConfig?: SearchHiddenConfig): {
12
62
  r: number;
13
63
  c: number;
14
64
  }[];
15
- export declare function searchNext(ctx: Context, searchText: string, checkModes: {
16
- regCheck: boolean;
17
- wordCheck: boolean;
18
- caseCheck: boolean;
19
- }): any;
20
- export declare function searchAll(ctx: Context, searchText: string, checkModes: {
21
- regCheck: boolean;
22
- wordCheck: boolean;
23
- caseCheck: boolean;
24
- }): SearchResult[];
65
+ /** Use chunked async scan when the active sheet has at least this many rows. */
66
+ export declare const QUICK_SEARCH_ASYNC_ROW_THRESHOLD = 50000;
67
+ export declare function getQuickSearchHiddenConfig(ctx: Context): SearchHiddenConfig;
68
+ /** Display-only, case-insensitive substring find; skips hidden rows/columns. */
69
+ export declare function getQuickSearchIndexArr(ctx: Context, searchText: string, flowdata: CellMatrix): {
70
+ r: number;
71
+ c: number;
72
+ }[];
73
+ /** Bounding grid rect for overlay (merged region or single cell). */
74
+ export declare function expandCellRectForMerge(ctx: Context, r: number, c: number): {
75
+ r1: number;
76
+ r2: number;
77
+ c1: number;
78
+ c2: number;
79
+ };
80
+ export declare function shouldQuickSearchUseAsync(flowdata: CellMatrix): boolean;
81
+ /**
82
+ * Finds the next or previous match, updates selection and scroll, and optionally switches sheet when
83
+ * `scope` is `allSheets`.
84
+ *
85
+ * @param specificRange - When `scope` is `specificRange`, restricts the scan to this rectangle on the active sheet.
86
+ * @returns Structured result; see {@link SearchNextResult} and semver note on {@link SearchNextResult} remarks.
87
+ */
88
+ export declare function searchNext(ctx: Context, searchText: string, checkModes: CheckModes, scope?: FindSearchScope, direction?: 'next' | 'prev', specificRange?: Selection): SearchNextResult;
89
+ export declare function searchAll(ctx: Context, searchText: string, checkModes: CheckModes, scope?: FindSearchScope, specificRange?: Selection): SearchResult[];
25
90
  export declare function onSearchDialogMoveStart(globalCache: GlobalCache, e: MouseEvent, container: HTMLDivElement): void;
26
91
  export declare function onSearchDialogMove(globalCache: GlobalCache, e: MouseEvent): void;
27
92
  export declare function onSearchDialogMoveEnd(globalCache: GlobalCache): void;
28
- export declare function replace(ctx: Context, searchText: string, replaceText: string, checkModes: {
29
- regCheck: boolean;
30
- wordCheck: boolean;
31
- caseCheck: boolean;
32
- }): any;
33
- export declare function replaceAll(ctx: Context, searchText: string, replaceText: string, checkModes: {
34
- regCheck: boolean;
35
- wordCheck: boolean;
36
- caseCheck: boolean;
37
- }): any;
93
+ export declare function replace(ctx: Context, searchText: string, replaceText: string, checkModes: CheckModes, specificRange?: Selection): any;
94
+ export declare function replaceAll(ctx: Context, searchText: string, replaceText: string, checkModes: CheckModes, specificRange?: Selection): ReplaceAllResult;
95
+ /**
96
+ * Asynchronously scans `flowdata` for `searchText` in chunks, yielding
97
+ * between chunks so the main thread stays responsive.
98
+ *
99
+ * Returns an AbortController — call `.abort()` to cancel an in-flight scan.
100
+ *
101
+ * @param onProgress - called with partial results after each chunk
102
+ * @param onComplete - called once with the full result array when done
103
+ */
104
+ export declare function getSearchIndexArrAsync(searchText: string, range: {
105
+ row: number[];
106
+ column: number[];
107
+ }[], flowdata: CellMatrix, modes: CheckModes, hyperlinkMap?: HyperlinkMap, hiddenConfig?: SearchHiddenConfig, onProgress?: (partial: {
108
+ r: number;
109
+ c: number;
110
+ }[]) => void, onComplete?: (all: {
111
+ r: number;
112
+ c: number;
113
+ }[]) => void): AbortController;
114
+ /** Chunked quick search with hidden row/column skip (same semantics as `getQuickSearchIndexArr`). */
115
+ export declare function runQuickSearchIndexArrAsync(ctx: Context, searchText: string, flowdata: CellMatrix, onProgress: (partial: {
116
+ r: number;
117
+ c: number;
118
+ }[]) => void, onComplete: (all: {
119
+ r: number;
120
+ c: number;
121
+ }[]) => void): AbortController;
122
+ /**
123
+ * Parses an A1-notation range string (e.g. "E10:H14" or "Sheet1!E10:H14")
124
+ * into a `Selection` suitable for scoping find/replace.
125
+ *
126
+ * Returns `null` if the text is empty or cannot be parsed.
127
+ * The sheet-name prefix is stripped before parsing — the active sheet is always used.
128
+ */
129
+ export declare function parseRangeText(rangeText: string, ctx: Context): Selection | null;
@@ -43,11 +43,13 @@ export type Cell = {
43
43
  cs?: number;
44
44
  };
45
45
  f?: string;
46
+ /** `dp`: fixed decimal places for display when `fa` is General (Auto); does not change `fa`/`t`. */
46
47
  ct?: {
47
48
  fa?: string;
48
49
  t?: string;
49
50
  tb?: string;
50
51
  s?: any;
52
+ dp?: number;
51
53
  };
52
54
  qp?: number;
53
55
  spl?: any;
@@ -399,6 +401,8 @@ export type GlobalCache = {
399
401
  } | undefined;
400
402
  };
401
403
  };
404
+ /** Element to restore focus to after closing Quick Search (not stored in Immer context). */
405
+ quickSearchReturnFocus?: Element | null;
402
406
  linkCard?: {
403
407
  mouseEnter?: boolean;
404
408
  rangeSelectionModal?: {
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+
3
+ declare const QuickSearchBar: React.FC;
4
+ export default QuickSearchBar;