@fileverse-dev/dsheet 2.0.8 → 2.0.9

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.
@@ -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;
@@ -9,6 +9,7 @@ export declare const error: {
9
9
  nm: string;
10
10
  nl: string;
11
11
  sp: string;
12
+ circ: string;
12
13
  };
13
14
  export declare const errorMessagesFromValue: Record<string, string>;
14
15
  export declare function detectErrorFromValue(input: string): string;
@@ -20,3 +20,4 @@ export const ERROR_NULL: "NULL";
20
20
  export const ERROR_NUM: "NUM";
21
21
  export const ERROR_REF: "REF";
22
22
  export const ERROR_VALUE: "VALUE";
23
+ export const CIRCULAR_REF_ERROR: "CIRC";
@@ -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(`