@fileverse-dev/dsheet 2.1.2-dropIn-5 → 2.1.2-dropIn-mri-2
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/{executeStringFunction-CGbxAbbw.js → executeStringFunction-Don8m4mk.js} +4650 -4344
- package/dist/formula.js +1 -1
- package/dist/index-MrL6atEI.js +55101 -0
- package/dist/index.es.js +15 -15
- package/dist/sheet-engine/core/context.d.ts +5 -0
- package/dist/sheet-engine/core/index.d.ts +1 -1
- package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +47 -0
- package/dist/sheet-engine/core/modules/formula-eval.worker.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-range-cache.d.ts +20 -0
- package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +40 -0
- package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +7 -0
- package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +14 -0
- package/dist/sheet-engine/core/modules/formula-worker-types.d.ts +17 -0
- package/dist/sheet-engine/core/modules/formula.d.ts +26 -1
- package/dist/sheet-engine/core/modules/index.d.ts +3 -1
- package/dist/style.css +1 -1
- package/dist/{use-xlsx-import-impl-CLQyfm8_.js → use-xlsx-import-impl-DTRsLDTh.js} +2 -2
- package/dist/{xlsx-export-impl-DXIj7EEk.js → xlsx-export-impl-Bh1M_V68.js} +2 -2
- package/package.json +2 -2
- package/dist/index-BDaOOD6V.js +0 -54812
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as s, a as t, b as o, S as r, d as l, i as n, T as
|
|
2
|
-
import {
|
|
3
|
-
import { FLVURL as
|
|
1
|
+
import { C as s, a as t, b as o, S as r, d as l, i as n, T as d, e as i, f as S, g as c, h, j as m, k as C, l as u, n as p, o as E, p as F, q as g, r as x, s as R, t as f, u as A, v as I, w as L, x as w, z as T, A as b, B as v, D as k, E as D, F as M, G as V, H as X, I as z, J as P, K as U } from "./index-MrL6atEI.js";
|
|
2
|
+
import { bV as y, bW as B, bX as G, ar as H, bh as O, e as j, f as q, h as J, a as K, ck as N, aq as W, cs as Y } from "./executeStringFunction-Don8m4mk.js";
|
|
3
|
+
import { FLVURL as Q } from "@fileverse-dev/formulajs";
|
|
4
4
|
import { E as ee, S as ae } from "./constants-yStXQJiK.js";
|
|
5
5
|
export {
|
|
6
6
|
s as CommentAction,
|
|
@@ -9,13 +9,13 @@ export {
|
|
|
9
9
|
r as DSheetEditor,
|
|
10
10
|
l as DSheetSkeleton,
|
|
11
11
|
ee as ERROR_MESSAGES_FLAG,
|
|
12
|
-
|
|
12
|
+
Q as FLVURL,
|
|
13
13
|
n as FortuneCore,
|
|
14
14
|
ae as SERVICES_API_KEY,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
d as TEMPLATES,
|
|
16
|
+
i as api,
|
|
17
17
|
y as clearColumnsCellsFormat,
|
|
18
|
-
|
|
18
|
+
S as clearFilter,
|
|
19
19
|
B as clearRowsCellsFormat,
|
|
20
20
|
G as clearSelectedCellFormat,
|
|
21
21
|
c as createFilter,
|
|
@@ -44,14 +44,14 @@ export {
|
|
|
44
44
|
N as insertRowCol,
|
|
45
45
|
b as isBrowserZoomShortcut,
|
|
46
46
|
v as isFormulaListShortcut,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
k as isOpenShortcutsModalShortcut,
|
|
48
|
+
W as jfrefreshgrid,
|
|
49
49
|
Y as loadLocale,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
D as removeActiveImage,
|
|
51
|
+
M as removeDuplicates,
|
|
52
52
|
V as showImgChooser,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
X as toolbarItemClickHandler,
|
|
54
|
+
z as updateFormat,
|
|
55
|
+
P as useEnsStatus,
|
|
56
|
+
U as useXLSXImport
|
|
57
57
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SheetConfig, Sheet, Selection, Cell, CommentBox, Rect, Image, Presence, LinkCardProps, FilterOptions, RangeDialogProps, DataRegulationProps, ConditionRulesProps, GlobalCache, CellError } from './types';
|
|
2
2
|
import { FormulaCache } from './modules';
|
|
3
|
+
import { FormulaAsyncEvalJob } from './modules/formula-async-eval';
|
|
3
4
|
import { DateBaseLocale, Hooks } from './settings';
|
|
4
5
|
|
|
5
6
|
interface MutableRefObject<T> {
|
|
@@ -239,6 +240,10 @@ export type Context = {
|
|
|
239
240
|
luckysheetPaintSingle: boolean;
|
|
240
241
|
defaultCell: Cell;
|
|
241
242
|
groupValuesRefreshData: any[];
|
|
243
|
+
/** Chunked async formula recalc queue (Step 1 perf). Cleared when job completes. */
|
|
244
|
+
formulaAsyncEval?: FormulaAsyncEvalJob | null;
|
|
245
|
+
/** True while `formulaAsyncEval` is draining on the main thread in chunks. */
|
|
246
|
+
isFormulaCalculating?: boolean;
|
|
242
247
|
/**
|
|
243
248
|
* Incremented when formula `func_selectedrange` moves via keyboard (`rangeOfFormula`)
|
|
244
249
|
* so React re-renders — `FormulaCache` is a class and Immer does not track it.
|
|
@@ -7,7 +7,7 @@ export { defaultSettings } from './settings';
|
|
|
7
7
|
export type { Settings, Hooks, DateBaseLocale } from './settings';
|
|
8
8
|
export { handleCopy, handleGlobalKeyDown, handlePaste, handlePasteByClick, fixPositionOnFrozenCells, handleCellAreaMouseDown, handleCellAreaDoubleClick, handleContextMenu, mouseRender, handleOverlayMouseMove, handleOverlayMouseUp, handleRowHeaderMouseDown, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColSizeHandleDoubleClick, handleRowSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleRowFreezeHandleMouseDown, describeMatchedShortcut, isBrowserZoomShortcut, isOpenShortcutsModalShortcut, isFormulaListShortcut, } from './events';
|
|
9
9
|
export * from './locale';
|
|
10
|
-
export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, FormulaCache, groupValuesRefresh, execFunctionGroup, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, getFilterHiddenRowsUnionFromFilterMap, getFilterHiddenRowsUnion, ensureManualHiddenInitialized, rebuildRowHiddenUnion, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, defaultLuckysheetSelectRanges, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, mergeSelectionHasValues, handleSort, getRemoveDuplicatesPreview, removeDuplicates, getRemoveDuplicatesErrorMessage, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, removeOverShowComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, sortSheetBySelectedColumn, searchAll, searchNext, replace, replaceAll, replaceAllScoped, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, clearFilterForColumn, toggleViewerFilter, createFilter, applySheetFilterState, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, checkCF, getComputeMap, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
|
|
10
|
+
export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, FormulaCache, groupValuesRefresh, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, isFormulaEvalPending, FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, getFilterHiddenRowsUnionFromFilterMap, getFilterHiddenRowsUnion, ensureManualHiddenInitialized, rebuildRowHiddenUnion, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, defaultLuckysheetSelectRanges, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, mergeSelectionHasValues, handleSort, getRemoveDuplicatesPreview, removeDuplicates, getRemoveDuplicatesErrorMessage, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, removeOverShowComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, sortSheetBySelectedColumn, searchAll, searchNext, replace, replaceAll, replaceAllScoped, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, clearFilterForColumn, toggleViewerFilter, createFilter, applySheetFilterState, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, checkCF, getComputeMap, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
|
|
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';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Minimum formula count before deferring eval to chunked async (Step 1). */
|
|
2
|
+
export declare const FORMULA_ASYNC_EVAL_THRESHOLD = 15;
|
|
3
|
+
/** Formulas evaluated per animation frame during async recalc. */
|
|
4
|
+
export declare const FORMULA_ASYNC_CHUNK_SIZE = 20;
|
|
5
|
+
/** Use a Web Worker when the async job has at least this many formulas. */
|
|
6
|
+
export declare const FORMULA_WORKER_THRESHOLD = 100;
|
|
7
|
+
/** Formulas evaluated per worker message (larger — runs off main thread). */
|
|
8
|
+
export declare const FORMULA_WORKER_CHUNK_SIZE = 150;
|
|
9
|
+
/** Maximum time to wait for a worker chunk before falling back to the real engine. */
|
|
10
|
+
export declare const FORMULA_WORKER_CHUNK_TIMEOUT_MS = 30000;
|
|
11
|
+
export type FormulaEvalDebugMode = 'worker' | 'main-thread' | 'fallback';
|
|
12
|
+
export type FormulaEvalDebug = {
|
|
13
|
+
mode: FormulaEvalDebugMode;
|
|
14
|
+
lastChunkMs: number;
|
|
15
|
+
lastChunkSize: number;
|
|
16
|
+
completedChunks: number;
|
|
17
|
+
fallbackChunks: number;
|
|
18
|
+
workerAvailable: boolean;
|
|
19
|
+
unsafeFormulaCount: number;
|
|
20
|
+
workerFormulaCount: number;
|
|
21
|
+
lastError: string | null;
|
|
22
|
+
};
|
|
23
|
+
export type FormulaAsyncEvalJob = {
|
|
24
|
+
formulaRunList: Array<{
|
|
25
|
+
r: number;
|
|
26
|
+
c: number;
|
|
27
|
+
id: string;
|
|
28
|
+
calc_funcStr: string;
|
|
29
|
+
level?: number;
|
|
30
|
+
}>;
|
|
31
|
+
calcChainKeys: string[];
|
|
32
|
+
impactedByCircular: string[];
|
|
33
|
+
cycleNodes: string[];
|
|
34
|
+
nextIndex: number;
|
|
35
|
+
total: number;
|
|
36
|
+
debug?: FormulaEvalDebug;
|
|
37
|
+
};
|
|
38
|
+
export declare function isFormulaEvalPending(ctx: {
|
|
39
|
+
isFormulaCalculating?: boolean;
|
|
40
|
+
formulaAsyncEval?: FormulaAsyncEvalJob | null;
|
|
41
|
+
}): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The worker snapshot evaluator intentionally handles only scalar formulas that
|
|
44
|
+
* mirror the main engine well. Dynamic/spill/range-indirection formulas stay on
|
|
45
|
+
* the main thread so `spillSortResult` and special range logic remain authoritative.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isFormulaWorkerUnsafe(calcFuncStr: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type RangePassCacheEntry = {
|
|
2
|
+
fragment: any[][];
|
|
3
|
+
cryptoDenomination: string;
|
|
4
|
+
cryptoDecimal: number;
|
|
5
|
+
globalDataKeysFingerprint: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function makeRangePassCacheKey(sheetId: string, startRow: number, endRow: number, startCol: number, endCol: number): string;
|
|
8
|
+
export declare function collectGlobalDataKeysInRange(execFunctionGlobalData: Record<string, unknown>, sheetId: string, startRow: number, endRow: number, startCol: number, endCol: number): string;
|
|
9
|
+
/** Remove the formula origin cell from a full rectangular range fragment. */
|
|
10
|
+
export declare function sliceRangeFragmentForOrigin(full: any[][], startRow: number, startCol: number, originRow: number | null | undefined, originCol: number | null | undefined): any[][];
|
|
11
|
+
type RangeCacheHost = {
|
|
12
|
+
rangeValuePassCache?: Map<string, RangePassCacheEntry>;
|
|
13
|
+
rangeValuePassCacheStats?: {
|
|
14
|
+
hits: number;
|
|
15
|
+
misses: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function beginRangeValuePassCache(cache: RangeCacheHost): void;
|
|
19
|
+
export declare function clearRangeValuePassCache(cache: RangeCacheHost): void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CellMatrix } from '../types';
|
|
2
|
+
|
|
3
|
+
export type SnapshotSheet = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
data: CellMatrix | null | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type SnapshotFormulaCell = {
|
|
9
|
+
r: number;
|
|
10
|
+
c: number;
|
|
11
|
+
id: string;
|
|
12
|
+
calc_funcStr: string;
|
|
13
|
+
};
|
|
14
|
+
export type SnapshotFormulaResult = {
|
|
15
|
+
r: number;
|
|
16
|
+
c: number;
|
|
17
|
+
id: string;
|
|
18
|
+
v: unknown;
|
|
19
|
+
f: string;
|
|
20
|
+
spe?: unknown;
|
|
21
|
+
deps: string[];
|
|
22
|
+
isError: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type SnapshotEvalInput = {
|
|
25
|
+
sheets: SnapshotSheet[];
|
|
26
|
+
execFunctionGlobalData: Record<string, {
|
|
27
|
+
v: unknown;
|
|
28
|
+
f: unknown;
|
|
29
|
+
}>;
|
|
30
|
+
formulas: SnapshotFormulaCell[];
|
|
31
|
+
};
|
|
32
|
+
export type SnapshotEvalOutput = {
|
|
33
|
+
execFunctionGlobalData: Record<string, {
|
|
34
|
+
v: unknown;
|
|
35
|
+
f: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
results: SnapshotFormulaResult[];
|
|
38
|
+
};
|
|
39
|
+
/** Worker-safe formula evaluation against plain sheet snapshots (no React/immer). */
|
|
40
|
+
export declare function evalFormulasInSnapshot(input: SnapshotEvalInput): SnapshotEvalOutput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Cell / formula key format used in depsByCell and revDepsByCell. */
|
|
2
|
+
export declare function toFormulaDepCellKey(sheetId: string, r: number, c: number): string;
|
|
3
|
+
/**
|
|
4
|
+
* Walk revDepsByCell from a changed cell to collect every formula cell that
|
|
5
|
+
* must recalculate (direct + transitive dependents).
|
|
6
|
+
*/
|
|
7
|
+
export declare function collectTransitiveFormulaDependents(originCellKey: string, revDepsByCell: Map<string, Set<string>>): Set<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context } from '../context';
|
|
2
|
+
import { SnapshotEvalInput, SnapshotEvalOutput, SnapshotFormulaCell, evalFormulasInSnapshot } from './formula-snapshot-eval';
|
|
3
|
+
import { FORMULA_WORKER_CHUNK_SIZE } from './formula-async-eval';
|
|
4
|
+
|
|
5
|
+
export declare function buildSnapshotEvalInput(ctx: Context, formulas: SnapshotFormulaCell[]): SnapshotEvalInput;
|
|
6
|
+
/**
|
|
7
|
+
* Evaluate a formula chunk off the critical UI path when possible.
|
|
8
|
+
* Uses an inline Web Worker. Callers should fall back to the real engine on
|
|
9
|
+
* rejection so the worker cannot silently leave a recalculation job hanging.
|
|
10
|
+
*/
|
|
11
|
+
export declare function evalFormulasInBackground(input: SnapshotEvalInput): Promise<SnapshotEvalOutput>;
|
|
12
|
+
/** @deprecated Use evalFormulasInBackground */
|
|
13
|
+
export declare const evalFormulasInWorker: typeof evalFormulasInBackground;
|
|
14
|
+
export { FORMULA_WORKER_CHUNK_SIZE, evalFormulasInSnapshot };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SnapshotEvalInput, SnapshotEvalOutput } from './formula-snapshot-eval';
|
|
2
|
+
|
|
3
|
+
export type WorkerEvalRequest = {
|
|
4
|
+
type: 'eval';
|
|
5
|
+
requestId: number;
|
|
6
|
+
input: SnapshotEvalInput;
|
|
7
|
+
};
|
|
8
|
+
export type WorkerEvalResponse = {
|
|
9
|
+
type: 'eval-result';
|
|
10
|
+
requestId: number;
|
|
11
|
+
output: SnapshotEvalOutput;
|
|
12
|
+
};
|
|
13
|
+
export type WorkerEvalError = {
|
|
14
|
+
type: 'eval-error';
|
|
15
|
+
requestId: number;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Cell, Rect, Selection } from '../types';
|
|
1
|
+
import { Cell, CellMatrix, Rect, Selection } from '../types';
|
|
2
2
|
import { Context } from '../context';
|
|
3
|
+
import { FormulaAsyncEvalJob } from './formula-async-eval';
|
|
4
|
+
import { RangePassCacheEntry } from './formula-range-cache';
|
|
5
|
+
import { SnapshotEvalOutput } from './formula-snapshot-eval';
|
|
3
6
|
|
|
4
7
|
/** True when the formula is only numeric ops on TODAY()/NOW() (incl. unary +/−); used to display serials as dates. */
|
|
5
8
|
export declare function isTodayNowPureArithmeticDateResult(formula: string, value: number): boolean;
|
|
@@ -37,6 +40,12 @@ export declare class FormulaCache {
|
|
|
37
40
|
depsByCell: Map<string, Set<string>>;
|
|
38
41
|
/** Reverse dependency graph: referenced cell -> dependent formula cells. */
|
|
39
42
|
revDepsByCell: Map<string, Set<string>>;
|
|
43
|
+
/**
|
|
44
|
+
* Formulas that referenced a range too large to fully expand into `revDepsByCell`.
|
|
45
|
+
* These must be included on incremental recalcs because a single-cell edit may
|
|
46
|
+
* affect them even when no precise reverse edge exists.
|
|
47
|
+
*/
|
|
48
|
+
formulasWithWideRangeDeps: Set<string>;
|
|
40
49
|
/**
|
|
41
50
|
* Dependency collection state for the currently-parsed formula, set by `execfunction`.
|
|
42
51
|
* When null, dependency recording is disabled.
|
|
@@ -44,8 +53,20 @@ export declare class FormulaCache {
|
|
|
44
53
|
activeDepCollection: null | {
|
|
45
54
|
originKey: string;
|
|
46
55
|
deps: Set<string>;
|
|
56
|
+
hasWideRangeDep: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** Step 2: per execFunctionGroup pass cache for materialized range reads. */
|
|
59
|
+
rangeValuePassCache?: Map<string, RangePassCacheEntry>;
|
|
60
|
+
rangeValuePassCacheStats?: {
|
|
61
|
+
hits: number;
|
|
62
|
+
misses: number;
|
|
47
63
|
};
|
|
48
64
|
constructor();
|
|
65
|
+
materializeFullRangeFragment(context: Context, sheetId: string, flowdata: CellMatrix | null | undefined, startRow: number, endRow: number, startCol: number, endCol: number): {
|
|
66
|
+
fragment: any[][];
|
|
67
|
+
cryptoDenomination: string;
|
|
68
|
+
cryptoDecimal: number;
|
|
69
|
+
};
|
|
49
70
|
tryGetCellAsNumber(cell: Cell): string | number | boolean | undefined;
|
|
50
71
|
}
|
|
51
72
|
export declare function iscelldata(txt: string): boolean;
|
|
@@ -55,6 +76,10 @@ export declare function delFunctionGroup(ctx: Context, r: number, c: number, id?
|
|
|
55
76
|
export declare function insertUpdateFunctionGroup(ctx: Context, r: number, c: number, id?: string, calcChainSet?: Set<string>): void;
|
|
56
77
|
export declare function execfunction(ctx: Context, txt: string, r: number, c: number, id?: string, calcChainSet?: Set<string>, isrefresh?: boolean, notInsertFunc?: boolean): any[];
|
|
57
78
|
export declare function groupValuesRefresh(ctx: Context): void;
|
|
79
|
+
/** Apply worker chunk output onto the live context (main thread only). */
|
|
80
|
+
export declare function applyWorkerFormulaChunkResults(ctx: Context, output: SnapshotEvalOutput, impactedByCircular: Set<string>, cycleNodes: Set<string>, calcChainKeys?: string[], data?: CellMatrix | null): void;
|
|
81
|
+
/** Run up to `chunkSize` formulas from an async job. Returns true when job is complete. */
|
|
82
|
+
export declare function runFormulaEvalChunk(ctx: Context, job: FormulaAsyncEvalJob, chunkSize?: number): boolean;
|
|
58
83
|
export declare function execFunctionGroup(ctx: Context, origin_r: number, origin_c: number, value: any, id?: string, data?: any, isForce?: boolean): void;
|
|
59
84
|
/**
|
|
60
85
|
* Before the first `moveHighlightCell/Range(..., "rangeOfFormula")` while editing
|
|
@@ -5,6 +5,8 @@ export { moveToEnd, getRangeRectsByCharacterOffset } from './cursor';
|
|
|
5
5
|
export { getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, } from './date-base-locale';
|
|
6
6
|
export { update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, } from './format';
|
|
7
7
|
export { FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, maybeRecoverDirtyRangeSelection, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, remapFormulaReferencesByMap, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, getFormulaRangeIndexForKeyboardSync, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, functionStrChange, setFormulaEditorOwner, getAllFunctionGroup, suppressFormulaRangeSelectionForInitialEdit, } from './formula';
|
|
8
|
+
export { FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, isFormulaEvalPending, } from './formula-async-eval';
|
|
9
|
+
export type { FormulaAsyncEvalJob } from './formula-async-eval';
|
|
8
10
|
export { initFreeze } from './freeze';
|
|
9
11
|
export { isInlineStringCell, getInlineStringNoStyle, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, } from './inline-string';
|
|
10
12
|
export { rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, } from './location';
|
|
@@ -40,6 +42,6 @@ export { sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStar
|
|
|
40
42
|
export { setCellError, clearCellError, overShowError, } from './error-state-helpers';
|
|
41
43
|
export { checkCellIsLocked } from './protection';
|
|
42
44
|
export { detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, } from './validation';
|
|
43
|
-
export { iscelldata, getcellrange, execfunction, execFunctionGroup, insertUpdateFunctionGroup, functionCopy, } from './formula';
|
|
45
|
+
export { iscelldata, getcellrange, execfunction, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, insertUpdateFunctionGroup, functionCopy, } from './formula';
|
|
44
46
|
export { checkCF, getComputeMap } from './ConditionFormat';
|
|
45
47
|
export { getdatabyselection, getQKBorder } from './cell';
|