@fileverse-dev/dsheet 2.0.7 → 2.0.8-formulaInteraction-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/utils/formula-ui-sync.d.ts +5 -0
- package/dist/index.es.js +17765 -17175
- package/dist/sheet-engine/core/index.d.ts +1 -1
- package/dist/sheet-engine/core/modules/format.d.ts +60 -1
- package/dist/sheet-engine/core/modules/formula.d.ts +13 -1
- package/dist/sheet-engine/core/modules/index.d.ts +4 -4
- package/dist/sheet-engine/core/modules/merge.d.ts +2 -0
- package/dist/sheet-engine/core/modules/selection.d.ts +7 -2
- package/dist/sheet-engine/core/modules/toolbar.d.ts +3 -2
- package/dist/sheet-engine/core/modules/validation.d.ts +1 -0
- package/dist/sheet-engine/core/types.d.ts +4 -0
- package/dist/sheet-engine/formula-parser/error.d.ts +1 -0
- package/dist/sheet-engine/formula-parser/index.d.ts +2 -2
- package/dist/sheet-engine/react/components/SheetOverlay/helper.d.ts +8 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/sheet-engine/react/components/FormulaSearch/constant.d.ts +0 -63
- package/dist/sheet-engine/react/components/FormulaSearch/index.d.ts +0 -6
|
@@ -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, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, update, is_date, valueShowEs, 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';
|
|
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, selectionIsExactlyOneMergeBlock, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, mergeSelectionHasValues, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, 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';
|
|
@@ -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;
|
|
@@ -30,6 +30,18 @@ export declare class FormulaCache {
|
|
|
30
30
|
functionlistMap: any;
|
|
31
31
|
execFunctionExist?: any[];
|
|
32
32
|
execFunctionGlobalData: any;
|
|
33
|
+
/** Formula dependency graph: cell -> referenced cells. Key format: `${sheetId}:${r}:${c}` */
|
|
34
|
+
depsByCell: Map<string, Set<string>>;
|
|
35
|
+
/** Reverse dependency graph: referenced cell -> dependent formula cells. */
|
|
36
|
+
revDepsByCell: Map<string, Set<string>>;
|
|
37
|
+
/**
|
|
38
|
+
* Dependency collection state for the currently-parsed formula, set by `execfunction`.
|
|
39
|
+
* When null, dependency recording is disabled.
|
|
40
|
+
*/
|
|
41
|
+
activeDepCollection: null | {
|
|
42
|
+
originKey: string;
|
|
43
|
+
deps: Set<string>;
|
|
44
|
+
};
|
|
33
45
|
constructor();
|
|
34
46
|
tryGetCellAsNumber(cell: Cell): string | number | boolean | undefined;
|
|
35
47
|
}
|
|
@@ -52,7 +64,7 @@ export declare function createFormulaRangeSelect(ctx: Context, select: {
|
|
|
52
64
|
rangeIndex: number;
|
|
53
65
|
} & Rect): void;
|
|
54
66
|
export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void;
|
|
55
|
-
export declare function moveCursorToEnd(editableDiv: HTMLDivElement): void;
|
|
67
|
+
export declare function moveCursorToEnd(editableDiv: HTMLDivElement | null | undefined): void;
|
|
56
68
|
export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number, parentTextDom?: HTMLElement): void;
|
|
57
69
|
export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
|
|
58
70
|
export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
|
|
@@ -2,20 +2,20 @@ 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';
|
|
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, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, rangeValueToHtml, } from './selection';
|
|
11
|
+
export { scrollToHighlightCell, seletedHighlistByindex, selectTitlesMap, selectTitlesRange, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, 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, captureLinkEditorOpenSnapshot, 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, isHyperlinkCreationBlocked, 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';
|
|
17
17
|
export { createDropCellRange, dropCellCache, getTypeItemHide, updateDropCell, } from './dropCell';
|
|
18
|
-
export { mergeCells } from './merge';
|
|
18
|
+
export { mergeCells, mergeSelectionHasValues } from './merge';
|
|
19
19
|
export { sortSelection, spillSortResult } from './sort';
|
|
20
20
|
export { searchAll, searchNext, replace, replaceAll, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, } from './searchReplace';
|
|
21
21
|
export type { CheckModes, HyperlinkMap, FindSearchScope, SearchHiddenConfig, SearchNextResult, ReplaceAllResult, } from './searchReplace';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Context } from '../context';
|
|
2
2
|
import { Range } from '../types';
|
|
3
3
|
|
|
4
|
+
/** True if any cell in the current selection has content that merge would consider. */
|
|
5
|
+
export declare function mergeSelectionHasValues(ctx: Context): boolean;
|
|
4
6
|
export declare function mergeCells(ctx: Context, sheetId: string, ranges: Range, type: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Sheet as SheetType, Freezen, Range } from '../types';
|
|
1
|
+
import { Sheet as SheetType, Freezen, Range, Selection } from '../types';
|
|
2
2
|
import { Context } from '../context';
|
|
3
3
|
|
|
4
4
|
export declare const selectionCache: {
|
|
@@ -12,6 +12,11 @@ export declare function seletedHighlistByindex(ctx: Context, r1: number, r2: num
|
|
|
12
12
|
top: number;
|
|
13
13
|
height: number;
|
|
14
14
|
} | null;
|
|
15
|
+
/**
|
|
16
|
+
* True when the selection rectangle is exactly one merged block (multi grid cells, one
|
|
17
|
+
* logical cell). Literal 1×1 is false here — callers use row/column span for that.
|
|
18
|
+
*/
|
|
19
|
+
export declare function selectionIsExactlyOneMergeBlock(ctx: Context, selection: Selection): boolean;
|
|
15
20
|
/**
|
|
16
21
|
* Updates `ctx.primaryCellActive` from a selection list (multi-cell → active focus cell;
|
|
17
22
|
* else null). Pass `selection` explicitly when normalizing a **new** array that is not
|
|
@@ -38,7 +43,7 @@ export declare function setPrimaryCellActive(ctx: Context, r: number, c: number)
|
|
|
38
43
|
* that range so Enter-primary navigation + typing do not collapse the yellow box.
|
|
39
44
|
*/
|
|
40
45
|
export declare function snapSheetSelectionFocusToCellPreserveMultiRange(ctx: Context, r: number, c: number): void;
|
|
41
|
-
export declare function normalizeSelection(ctx: Context, selection: SheetType["luckysheet_select_save"]):
|
|
46
|
+
export declare function normalizeSelection(ctx: Context, selection: SheetType["luckysheet_select_save"]): Selection[] | undefined;
|
|
42
47
|
export declare function selectTitlesMap(rangeMap: Record<string, number>, range1: number, range2: number): Record<string, number>;
|
|
43
48
|
export declare function selectTitlesRange(map: Record<string, number>): number[][];
|
|
44
49
|
export declare function pasteHandlerOfPaintModel(ctx: Context, copyRange: Context["luckysheet_copy_save"]): void;
|
|
@@ -28,9 +28,10 @@ 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
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Hyperlink insert is not supported for formula cells or when the user is entering a formula
|
|
32
|
+
* (cell / formula bar content starts with `=`).
|
|
33
33
|
*/
|
|
34
|
+
export declare function isHyperlinkCreationBlocked(ctx: Context, cellInput: HTMLDivElement | null | undefined): boolean;
|
|
34
35
|
export declare function captureLinkEditorOpenSnapshot(ctx: Context, cellInput: HTMLDivElement | null | undefined, cache: GlobalCache | undefined): void;
|
|
35
36
|
export declare function handleLink(ctx: Context, cellInput: HTMLDivElement | null | undefined, cache?: GlobalCache): void;
|
|
36
37
|
export declare function toolbarItemClickHandler(name: string): ToolbarItemClickHandler;
|
|
@@ -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;
|
|
@@ -426,6 +428,8 @@ export type GlobalCache = {
|
|
|
426
428
|
} | null;
|
|
427
429
|
selectedPlain: string;
|
|
428
430
|
};
|
|
431
|
+
/** Injected by React: show modal when link insert is blocked (formula / = in editor). */
|
|
432
|
+
onHyperlinkInsertBlocked?: () => void;
|
|
429
433
|
dragCellStartPos?: {
|
|
430
434
|
x: number;
|
|
431
435
|
y: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as SUPPORTED_FORMULAS } from './supported-formulas';
|
|
2
|
-
import { ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, default as error } from './error';
|
|
2
|
+
import { ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, CIRCULAR_REF_ERROR, default as error } from './error';
|
|
3
3
|
import { default as Parser } from './parser';
|
|
4
4
|
import { extractLabel, toLabel, columnIndexToLabel, columnLabelToIndex, rowIndexToLabel, rowLabelToIndex } from './helper/cell';
|
|
5
5
|
|
|
6
|
-
export { SUPPORTED_FORMULAS, ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, Parser, error, extractLabel, toLabel, columnIndexToLabel, columnLabelToIndex, rowIndexToLabel, rowLabelToIndex };
|
|
6
|
+
export { SUPPORTED_FORMULAS, ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, CIRCULAR_REF_ERROR, Parser, error, extractLabel, toLabel, columnIndexToLabel, columnLabelToIndex, rowIndexToLabel, rowLabelToIndex };
|
|
@@ -21,8 +21,16 @@ export declare function buildFormulaSuggestionText(editableDiv: HTMLDivElement,
|
|
|
21
21
|
caretOffset: number;
|
|
22
22
|
};
|
|
23
23
|
export declare function isLetterNumberPattern(str: string): boolean;
|
|
24
|
+
export declare function isStrictFormulaEditorText(editor: HTMLDivElement | null): boolean;
|
|
24
25
|
/** Same rule as InputBox/Fx onChange: show function list while typing a name after `=`. */
|
|
25
26
|
export declare function shouldShowFormulaFunctionList(editor: HTMLDivElement | null): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* True when the formula looks complete at the caret:
|
|
29
|
+
* - strict first character '='
|
|
30
|
+
* - caret at end of editor text
|
|
31
|
+
* - parentheses are balanced (no negative depth; final depth 0)
|
|
32
|
+
*/
|
|
33
|
+
export declare function isFormulaCompleteAtCaret(editor: HTMLDivElement | null): boolean;
|
|
26
34
|
/**
|
|
27
35
|
* When the caret sits on a function name span or its opening-paren span, return
|
|
28
36
|
* that function's name (uppercase). Used so nested formulas like `SUM(MIN(`
|