@rowsncolumns/spreadsheet 10.10.2 → 10.10.3

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.
@@ -16,6 +16,11 @@ export declare const parseNumberStoredAsText: (text: string | null | undefined)
16
16
  export type ErrorCheckInput = {
17
17
  /** What the user typed (`uev`): a formula, a number, a string, … */
18
18
  userEnteredValue: ExtendedValue | null | undefined;
19
+ /**
20
+ * The cell's value (`ev`). A typed number keeps what was typed in `uev.sv` and its number here,
21
+ * in `ev.nv`, so this tells text from a number. Without it, `userEnteredValue` decides.
22
+ */
23
+ effectiveValue?: ExtendedValue | null;
19
24
  /** The cell's error, if its effective value is one. */
20
25
  errorValue: ErrorValue | null | undefined;
21
26
  };
@@ -24,7 +29,7 @@ export type ErrorCheckInput = {
24
29
  * A typed error constant (`#N/A` entered as a value) is not flagged — only a formula's result.
25
30
  * A data-validation failure is not an error-checking rule (Excel only circles it on request).
26
31
  */
27
- export declare const getErrorCheckKind: ({ userEnteredValue, errorValue, }: ErrorCheckInput) => ErrorCheckKind | undefined;
32
+ export declare const getErrorCheckKind: ({ userEnteredValue, effectiveValue, errorValue, }: ErrorCheckInput) => ErrorCheckKind | undefined;
28
33
  /** What the error-checking smart tag's menu can do. */
29
34
  export type ErrorCheckOption = "convertToNumber" | "help" | "ignore" | "editInFormulaBar" | "options";
30
35
  /** The menu's heading, as Excel words it. */
@@ -49,7 +54,7 @@ export type NumberRun = {
49
54
  * clipped to `maxRow` / `maxColumn` (the sheet's data extent) so a whole-column selection scans
50
55
  * only the used rows.
51
56
  */
52
- export declare const collectNumberStoredAsTextRuns: (ranges: GridRange[], getUserEnteredValue: (rowIndex: number, columnIndex: number) => ExtendedValue | null | undefined, maxRow: number, maxColumn: number) => NumberRun[];
57
+ export declare const collectNumberStoredAsTextRuns: (ranges: GridRange[], getUserEnteredValue: (rowIndex: number, columnIndex: number) => ExtendedValue | null | undefined, maxRow: number, maxColumn: number, getEffectiveValue?: (rowIndex: number, columnIndex: number) => ExtendedValue | null | undefined) => NumberRun[];
53
58
  export type ErrorCheckActionContext = {
54
59
  sheetId: number;
55
60
  kind: ErrorCheckKind;
@@ -57,6 +62,7 @@ export type ErrorCheckActionContext = {
57
62
  /** The selection's ranges (the active cell's when nothing else is selected). */
58
63
  ranges: GridRange[];
59
64
  getUserEnteredValue(rowIndex: number, columnIndex: number): ExtendedValue | null | undefined;
65
+ getEffectiveValue?(rowIndex: number, columnIndex: number): ExtendedValue | null | undefined;
60
66
  /** The sheet's data extent: Convert to Number scans no further. */
61
67
  maxRow: number;
62
68
  maxColumn: number;
@@ -1 +1 @@
1
- {"version":3,"file":"error-checking.d.ts","sourceRoot":"","sources":["../../../api/error-checking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAShE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,KAC9B,MAAM,GAAG,SAQX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,gBAAgB,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,uDAAuD;IACvD,UAAU,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,mCAG/B,eAAe,KAAG,cAAc,GAAG,SAQrC,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,MAAM,GACN,QAAQ,GACR,kBAAkB,GAClB,SAAS,CAAC;AAcd,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,GAAI,M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B,SAkDjC,CAAC"}
@@ -24,19 +24,30 @@ var parseNumberStoredAsText = function (text) {
24
24
  return isPercent ? value / 100 : value;
25
25
  };
26
26
  exports.parseNumberStoredAsText = parseNumberStoredAsText;
27
+ /**
28
+ * The text a cell's value is, or `undefined` when its value is not text: `ev.sv` when the cell has
29
+ * an effective value (a number typed into a Text-formatted cell, or after an apostrophe, is text
30
+ * there), else `uev.sv`.
31
+ */
32
+ var getCellText = function (userEnteredValue, effectiveValue) {
33
+ var _a, _b;
34
+ return effectiveValue
35
+ ? ((_a = effectiveValue.sv) !== null && _a !== void 0 ? _a : effectiveValue.stringValue)
36
+ : ((_b = userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.sv) !== null && _b !== void 0 ? _b : userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.stringValue);
37
+ };
27
38
  /**
28
39
  * Which error-checking rule (if any) flags this cell, before ignored errors are applied.
29
40
  * A typed error constant (`#N/A` entered as a value) is not flagged — only a formula's result.
30
41
  * A data-validation failure is not an error-checking rule (Excel only circles it on request).
31
42
  */
32
43
  var getErrorCheckKind = function (_a) {
33
- var _b, _c;
34
- var userEnteredValue = _a.userEnteredValue, errorValue = _a.errorValue;
44
+ var _b;
45
+ var userEnteredValue = _a.userEnteredValue, effectiveValue = _a.effectiveValue, errorValue = _a.errorValue;
35
46
  var formula = (_b = userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.fv) !== null && _b !== void 0 ? _b : userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.formulaValue;
36
47
  if (formula) {
37
48
  return (errorValue === null || errorValue === void 0 ? void 0 : errorValue.type) === "Error" ? "evalError" : undefined;
38
49
  }
39
- var text = (_c = userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.sv) !== null && _c !== void 0 ? _c : userEnteredValue === null || userEnteredValue === void 0 ? void 0 : userEnteredValue.stringValue;
50
+ var text = getCellText(userEnteredValue, effectiveValue);
40
51
  if ((0, exports.parseNumberStoredAsText)(text) !== undefined)
41
52
  return "numberStoredAsText";
42
53
  return undefined;
@@ -102,9 +113,8 @@ exports.appendIgnoredError = appendIgnoredError;
102
113
  * clipped to `maxRow` / `maxColumn` (the sheet's data extent) so a whole-column selection scans
103
114
  * only the used rows.
104
115
  */
105
- var collectNumberStoredAsTextRuns = function (ranges, getUserEnteredValue, maxRow, maxColumn) {
116
+ var collectNumberStoredAsTextRuns = function (ranges, getUserEnteredValue, maxRow, maxColumn, getEffectiveValue) {
106
117
  var e_1, _a;
107
- var _b;
108
118
  var runs = [];
109
119
  var seen = new Set();
110
120
  try {
@@ -117,10 +127,15 @@ var collectNumberStoredAsTextRuns = function (ranges, getUserEnteredValue, maxRo
117
127
  for (var col = range.startColumnIndex; col <= endColumn; col++) {
118
128
  var key = "".concat(row, ":").concat(col);
119
129
  var uev = seen.has(key) ? null : getUserEnteredValue(row, col);
130
+ var ev = seen.has(key) ? null : getEffectiveValue === null || getEffectiveValue === void 0 ? void 0 : getEffectiveValue(row, col);
120
131
  seen.add(key);
121
- var kind = (0, exports.getErrorCheckKind)({ userEnteredValue: uev, errorValue: null });
132
+ var kind = (0, exports.getErrorCheckKind)({
133
+ userEnteredValue: uev,
134
+ effectiveValue: ev,
135
+ errorValue: null,
136
+ });
122
137
  var value = kind === "numberStoredAsText"
123
- ? (0, exports.parseNumberStoredAsText)((_b = uev === null || uev === void 0 ? void 0 : uev.sv) !== null && _b !== void 0 ? _b : uev === null || uev === void 0 ? void 0 : uev.stringValue)
138
+ ? (0, exports.parseNumberStoredAsText)(getCellText(uev, ev))
124
139
  : undefined;
125
140
  if (value === undefined) {
126
141
  run = null;
@@ -157,7 +172,7 @@ var runErrorCheckOption = function (option, context) {
157
172
  var sheetId = context.sheetId, kind = context.kind, ranges = context.ranges;
158
173
  switch (option) {
159
174
  case "convertToNumber": {
160
- var runs_1 = (0, exports.collectNumberStoredAsTextRuns)(ranges, context.getUserEnteredValue, context.maxRow, context.maxColumn);
175
+ var runs_1 = (0, exports.collectNumberStoredAsTextRuns)(ranges, context.getUserEnteredValue, context.maxRow, context.maxColumn, context.getEffectiveValue);
161
176
  if (!runs_1.length)
162
177
  return;
163
178
  var write = function () {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAmEA,OAAO,KASN,MAAM,OAAO,CAAC;AAuQf,OAAO,KAAK,EAGV,QAAQ,EAYT,MAAM,aAAa,CAAC;AA4CrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AA4jOnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAmEA,OAAO,KASN,MAAM,OAAO,CAAC;AAuQf,OAAO,KAAK,EAGV,QAAQ,EAYT,MAAM,aAAa,CAAC;AA4CrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AAgkOnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
@@ -1203,6 +1203,7 @@ function CanvasGridComponent(props, forwardedRef) {
1203
1203
  var getErrorCheck = (0, react_1.useCallback)(function (targetSheetId, rowIndex, columnIndex) {
1204
1204
  var kind = (0, error_checking_1.getErrorCheckKind)({
1205
1205
  userEnteredValue: getUserEnteredValue(targetSheetId, rowIndex, columnIndex),
1206
+ effectiveValue: getEffectiveValue(targetSheetId, rowIndex, columnIndex),
1206
1207
  errorValue: getErrorValue(targetSheetId, rowIndex, columnIndex),
1207
1208
  });
1208
1209
  if (kind &&
@@ -1214,6 +1215,7 @@ function CanvasGridComponent(props, forwardedRef) {
1214
1215
  return kind;
1215
1216
  }, [
1216
1217
  getUserEnteredValue,
1218
+ getEffectiveValue,
1217
1219
  getErrorValue,
1218
1220
  getIgnoredErrorsStable,
1219
1221
  stableIgnoredErrors,
@@ -3795,6 +3797,9 @@ function CanvasGridComponent(props, forwardedRef) {
3795
3797
  getUserEnteredValue: function (rowIndex, columnIndex) {
3796
3798
  return getUserEnteredValue(sheetId, rowIndex, columnIndex);
3797
3799
  },
3800
+ getEffectiveValue: function (rowIndex, columnIndex) {
3801
+ return getEffectiveValue(sheetId, rowIndex, columnIndex);
3802
+ },
3798
3803
  maxRow: (_a = getDataRowCount === null || getDataRowCount === void 0 ? void 0 : getDataRowCount(sheetId)) !== null && _a !== void 0 ? _a : Number.MAX_SAFE_INTEGER,
3799
3804
  maxColumn: (_b = getDataColumnCount === null || getDataColumnCount === void 0 ? void 0 : getDataColumnCount(sheetId)) !== null && _b !== void 0 ? _b : Number.MAX_SAFE_INTEGER,
3800
3805
  getIgnoredErrors: getIgnoredErrors,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/formula-input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAGrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAiB,MAAM,OAAO,CAAC;AActC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,sGAuLxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/formula-input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAIrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAiB,MAAM,OAAO,CAAC;AActC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,sGAyLxB,CAAC"}
@@ -4,9 +4,11 @@ exports.FormulaInput = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var ui_1 = require("@rowsncolumns/ui");
6
6
  var utils_1 = require("@rowsncolumns/utils");
7
+ var jotai_1 = require("jotai");
7
8
  var react_1 = require("react");
8
9
  var react_2 = tslib_1.__importStar(require("react"));
9
10
  var atoms_1 = require("../../atoms");
11
+ var active_editor_atom_1 = require("../../atoms/active-editor.atom");
10
12
  var cell_input_context_atom_1 = require("../../atoms/cell-input-context.atom");
11
13
  var use_isomorphic_layout_effect_1 = require("../../hooks/use-isomorphic-layout-effect");
12
14
  var use_merge_refs_1 = require("../../hooks/use-merge.refs");
@@ -22,7 +24,7 @@ exports.FormulaInput = (0, react_1.forwardRef)(function (_a, forwardedRef) {
22
24
  var editorRef = (0, react_2.useRef)(null);
23
25
  var _d = tslib_1.__read((0, atoms_1.useFormulaMode)(), 2), isFormulaMode = _d[0], setFormulaMode = _d[1];
24
26
  var setFormulaSelections = (0, atoms_1.useSetFormulaSelections)();
25
- var activeEditor = (0, atoms_1.useActiveEditor)();
27
+ var store = (0, jotai_1.useStore)();
26
28
  var setActiveEditor = (0, atoms_1.useSetActiveEditor)();
27
29
  var getSelectionsFromFormula = (0, atoms_1.useGetSelectionsFromFormula)();
28
30
  var onEditorKeyDown = (0, atoms_1.useOnEditorKeyDown)();
@@ -117,7 +119,9 @@ exports.FormulaInput = (0, react_1.forwardRef)(function (_a, forwardedRef) {
117
119
  }, [closeFormulaMode, isFormulaMode, setActiveEditor, onCancel, getGridRef, onBlur]);
118
120
  var handleChange = (0, react_1.useCallback)(function (value, textFormatRuns) {
119
121
  onChange === null || onChange === void 0 ? void 0 : onChange(value, textFormatRuns);
120
- // Prevent selecting when there is no active editor
122
+ // Prevent selecting when there is no active editor. Read it from the store, not the
123
+ // render: a blur clears it, and ProseMirror's blur transaction then lands here.
124
+ var activeEditor = store.get(active_editor_atom_1.activeEditorAtom);
121
125
  if (!activeEditor || activeEditor !== editorRef.current) {
122
126
  return;
123
127
  }
@@ -129,7 +133,7 @@ exports.FormulaInput = (0, react_1.forwardRef)(function (_a, forwardedRef) {
129
133
  setFormulaSelections(selections);
130
134
  }
131
135
  }, [
132
- activeEditor,
136
+ store,
133
137
  onChange,
134
138
  enterFormulaMode,
135
139
  setFormulaSelections,
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.releaseDate = void 0;
5
5
  exports.releaseDate =
6
6
  // @ts-ignore
7
- (_a = new Date("2026-11-11")) !== null && _a !== void 0 ? _a : new Date("2025-06-18");
7
+ (_a = new Date("2026-11-12")) !== null && _a !== void 0 ? _a : new Date("2025-06-18");
@@ -16,6 +16,11 @@ export declare const parseNumberStoredAsText: (text: string | null | undefined)
16
16
  export type ErrorCheckInput = {
17
17
  /** What the user typed (`uev`): a formula, a number, a string, … */
18
18
  userEnteredValue: ExtendedValue | null | undefined;
19
+ /**
20
+ * The cell's value (`ev`). A typed number keeps what was typed in `uev.sv` and its number here,
21
+ * in `ev.nv`, so this tells text from a number. Without it, `userEnteredValue` decides.
22
+ */
23
+ effectiveValue?: ExtendedValue | null;
19
24
  /** The cell's error, if its effective value is one. */
20
25
  errorValue: ErrorValue | null | undefined;
21
26
  };
@@ -24,7 +29,7 @@ export type ErrorCheckInput = {
24
29
  * A typed error constant (`#N/A` entered as a value) is not flagged — only a formula's result.
25
30
  * A data-validation failure is not an error-checking rule (Excel only circles it on request).
26
31
  */
27
- export declare const getErrorCheckKind: ({ userEnteredValue, errorValue, }: ErrorCheckInput) => ErrorCheckKind | undefined;
32
+ export declare const getErrorCheckKind: ({ userEnteredValue, effectiveValue, errorValue, }: ErrorCheckInput) => ErrorCheckKind | undefined;
28
33
  /** What the error-checking smart tag's menu can do. */
29
34
  export type ErrorCheckOption = "convertToNumber" | "help" | "ignore" | "editInFormulaBar" | "options";
30
35
  /** The menu's heading, as Excel words it. */
@@ -49,7 +54,7 @@ export type NumberRun = {
49
54
  * clipped to `maxRow` / `maxColumn` (the sheet's data extent) so a whole-column selection scans
50
55
  * only the used rows.
51
56
  */
52
- export declare const collectNumberStoredAsTextRuns: (ranges: GridRange[], getUserEnteredValue: (rowIndex: number, columnIndex: number) => ExtendedValue | null | undefined, maxRow: number, maxColumn: number) => NumberRun[];
57
+ export declare const collectNumberStoredAsTextRuns: (ranges: GridRange[], getUserEnteredValue: (rowIndex: number, columnIndex: number) => ExtendedValue | null | undefined, maxRow: number, maxColumn: number, getEffectiveValue?: (rowIndex: number, columnIndex: number) => ExtendedValue | null | undefined) => NumberRun[];
53
58
  export type ErrorCheckActionContext = {
54
59
  sheetId: number;
55
60
  kind: ErrorCheckKind;
@@ -57,6 +62,7 @@ export type ErrorCheckActionContext = {
57
62
  /** The selection's ranges (the active cell's when nothing else is selected). */
58
63
  ranges: GridRange[];
59
64
  getUserEnteredValue(rowIndex: number, columnIndex: number): ExtendedValue | null | undefined;
65
+ getEffectiveValue?(rowIndex: number, columnIndex: number): ExtendedValue | null | undefined;
60
66
  /** The sheet's data extent: Convert to Number scans no further. */
61
67
  maxRow: number;
62
68
  maxColumn: number;
@@ -1 +1 @@
1
- {"version":3,"file":"error-checking.d.ts","sourceRoot":"","sources":["../../../api/error-checking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAShE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,KAC9B,MAAM,GAAG,SAQX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,gBAAgB,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,uDAAuD;IACvD,UAAU,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,mCAG/B,eAAe,KAAG,cAAc,GAAG,SAQrC,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,MAAM,GACN,QAAQ,GACR,kBAAkB,GAClB,SAAS,CAAC;AAcd,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,GAAI,MAAM,cAAc,EAAE,YAAY,MAAM,WAGT,CAAC;AAEnE,8FAA8F;AAC9F,eAAO,MAAM,uBAAuB,oIAC+F,CAAC;AAapI,8FAA8F;AAC9F,eAAO,MAAM,eAAe,GAAI,MAAM,cAAc,EA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,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,iBAAiB,CAAC,CAChB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IACtE,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC;IAC5E,2DAA2D;IAC3D,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACrC,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,aAAa,EAAE,YAAY,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,8FAA8F;IAC9F,gBAAgB,IAAI,IAAI,CAAC;IACzB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,gBAAgB,EACxB,SAAS,uBAAuB,SAkDjC,CAAC"}
@@ -19,17 +19,25 @@ export const parseNumberStoredAsText = (text) => {
19
19
  return undefined;
20
20
  return isPercent ? value / 100 : value;
21
21
  };
22
+ /**
23
+ * The text a cell's value is, or `undefined` when its value is not text: `ev.sv` when the cell has
24
+ * an effective value (a number typed into a Text-formatted cell, or after an apostrophe, is text
25
+ * there), else `uev.sv`.
26
+ */
27
+ const getCellText = (userEnteredValue, effectiveValue) => effectiveValue
28
+ ? (effectiveValue.sv ?? effectiveValue.stringValue)
29
+ : (userEnteredValue?.sv ?? userEnteredValue?.stringValue);
22
30
  /**
23
31
  * Which error-checking rule (if any) flags this cell, before ignored errors are applied.
24
32
  * A typed error constant (`#N/A` entered as a value) is not flagged — only a formula's result.
25
33
  * A data-validation failure is not an error-checking rule (Excel only circles it on request).
26
34
  */
27
- export const getErrorCheckKind = ({ userEnteredValue, errorValue, }) => {
35
+ export const getErrorCheckKind = ({ userEnteredValue, effectiveValue, errorValue, }) => {
28
36
  const formula = userEnteredValue?.fv ?? userEnteredValue?.formulaValue;
29
37
  if (formula) {
30
38
  return errorValue?.type === "Error" ? "evalError" : undefined;
31
39
  }
32
- const text = userEnteredValue?.sv ?? userEnteredValue?.stringValue;
40
+ const text = getCellText(userEnteredValue, effectiveValue);
33
41
  if (parseNumberStoredAsText(text) !== undefined)
34
42
  return "numberStoredAsText";
35
43
  return undefined;
@@ -78,7 +86,7 @@ export const appendIgnoredError = (ignoredErrors, ranges, kind) => [
78
86
  * clipped to `maxRow` / `maxColumn` (the sheet's data extent) so a whole-column selection scans
79
87
  * only the used rows.
80
88
  */
81
- export const collectNumberStoredAsTextRuns = (ranges, getUserEnteredValue, maxRow, maxColumn) => {
89
+ export const collectNumberStoredAsTextRuns = (ranges, getUserEnteredValue, maxRow, maxColumn, getEffectiveValue) => {
82
90
  const runs = [];
83
91
  const seen = new Set();
84
92
  for (const range of ranges) {
@@ -89,10 +97,15 @@ export const collectNumberStoredAsTextRuns = (ranges, getUserEnteredValue, maxRo
89
97
  for (let col = range.startColumnIndex; col <= endColumn; col++) {
90
98
  const key = `${row}:${col}`;
91
99
  const uev = seen.has(key) ? null : getUserEnteredValue(row, col);
100
+ const ev = seen.has(key) ? null : getEffectiveValue?.(row, col);
92
101
  seen.add(key);
93
- const kind = getErrorCheckKind({ userEnteredValue: uev, errorValue: null });
102
+ const kind = getErrorCheckKind({
103
+ userEnteredValue: uev,
104
+ effectiveValue: ev,
105
+ errorValue: null,
106
+ });
94
107
  const value = kind === "numberStoredAsText"
95
- ? parseNumberStoredAsText(uev?.sv ?? uev?.stringValue)
108
+ ? parseNumberStoredAsText(getCellText(uev, ev))
96
109
  : undefined;
97
110
  if (value === undefined) {
98
111
  run = null;
@@ -119,7 +132,7 @@ export const runErrorCheckOption = (option, context) => {
119
132
  const { sheetId, kind, ranges } = context;
120
133
  switch (option) {
121
134
  case "convertToNumber": {
122
- const runs = collectNumberStoredAsTextRuns(ranges, context.getUserEnteredValue, context.maxRow, context.maxColumn);
135
+ const runs = collectNumberStoredAsTextRuns(ranges, context.getUserEnteredValue, context.maxRow, context.maxColumn, context.getEffectiveValue);
123
136
  if (!runs.length)
124
137
  return;
125
138
  const write = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAmEA,OAAO,KASN,MAAM,OAAO,CAAC;AAuQf,OAAO,KAAK,EAGV,QAAQ,EAYT,MAAM,aAAa,CAAC;AA4CrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AA4jOnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAmEA,OAAO,KASN,MAAM,OAAO,CAAC;AAuQf,OAAO,KAAK,EAGV,QAAQ,EAYT,MAAM,aAAa,CAAC;AA4CrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AAgkOnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
@@ -1064,6 +1064,7 @@ function CanvasGridComponent(props, forwardedRef) {
1064
1064
  const getErrorCheck = useCallback((targetSheetId, rowIndex, columnIndex) => {
1065
1065
  const kind = getErrorCheckKind({
1066
1066
  userEnteredValue: getUserEnteredValue(targetSheetId, rowIndex, columnIndex),
1067
+ effectiveValue: getEffectiveValue(targetSheetId, rowIndex, columnIndex),
1067
1068
  errorValue: getErrorValue(targetSheetId, rowIndex, columnIndex),
1068
1069
  });
1069
1070
  if (kind &&
@@ -1075,6 +1076,7 @@ function CanvasGridComponent(props, forwardedRef) {
1075
1076
  return kind;
1076
1077
  }, [
1077
1078
  getUserEnteredValue,
1079
+ getEffectiveValue,
1078
1080
  getErrorValue,
1079
1081
  getIgnoredErrorsStable,
1080
1082
  stableIgnoredErrors,
@@ -3592,6 +3594,7 @@ function CanvasGridComponent(props, forwardedRef) {
3592
3594
  errorName: activeErrorName,
3593
3595
  ranges,
3594
3596
  getUserEnteredValue: (rowIndex, columnIndex) => getUserEnteredValue(sheetId, rowIndex, columnIndex),
3597
+ getEffectiveValue: (rowIndex, columnIndex) => getEffectiveValue(sheetId, rowIndex, columnIndex),
3595
3598
  maxRow: getDataRowCount?.(sheetId) ?? Number.MAX_SAFE_INTEGER,
3596
3599
  maxColumn: getDataColumnCount?.(sheetId) ?? Number.MAX_SAFE_INTEGER,
3597
3600
  getIgnoredErrors,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/formula-input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAGrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAiB,MAAM,OAAO,CAAC;AActC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,sGAuLxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/formula-input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAIrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAiB,MAAM,OAAO,CAAC;AActC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,sGAyLxB,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import { cn } from "@rowsncolumns/ui";
2
2
  import { debug, isAFormula } from "@rowsncolumns/utils";
3
+ import { useStore } from "jotai";
3
4
  import { forwardRef, useCallback } from "react";
4
5
  import React, { useRef } from "react";
5
- import { useActiveEditor, useFormulaMode, useGetGridRef, useGetSelectionsFromFormula, useOnEditorKeyDown, useSetActiveEditor, useSetFormulaSelections, } from "../../atoms";
6
+ import { useFormulaMode, useGetGridRef, useGetSelectionsFromFormula, useOnEditorKeyDown, useSetActiveEditor, useSetFormulaSelections, } from "../../atoms";
7
+ import { activeEditorAtom } from "../../atoms/active-editor.atom";
6
8
  import { useCellInputContext } from "../../atoms/cell-input-context.atom";
7
9
  import { useIsomorphicLayoutEffect } from "../../hooks/use-isomorphic-layout-effect";
8
10
  import { useMergeRefs } from "../../hooks/use-merge.refs";
@@ -17,7 +19,7 @@ export const FormulaInput = forwardRef(({ value = "", onChange, onCancel, onBlur
17
19
  const editorRef = useRef(null);
18
20
  const [isFormulaMode, setFormulaMode] = useFormulaMode();
19
21
  const setFormulaSelections = useSetFormulaSelections();
20
- const activeEditor = useActiveEditor();
22
+ const store = useStore();
21
23
  const setActiveEditor = useSetActiveEditor();
22
24
  const getSelectionsFromFormula = useGetSelectionsFromFormula();
23
25
  const onEditorKeyDown = useOnEditorKeyDown();
@@ -108,7 +110,9 @@ export const FormulaInput = forwardRef(({ value = "", onChange, onCancel, onBlur
108
110
  }, [closeFormulaMode, isFormulaMode, setActiveEditor, onCancel, getGridRef, onBlur]);
109
111
  const handleChange = useCallback((value, textFormatRuns) => {
110
112
  onChange?.(value, textFormatRuns);
111
- // Prevent selecting when there is no active editor
113
+ // Prevent selecting when there is no active editor. Read it from the store, not the
114
+ // render: a blur clears it, and ProseMirror's blur transaction then lands here.
115
+ const activeEditor = store.get(activeEditorAtom);
112
116
  if (!activeEditor || activeEditor !== editorRef.current) {
113
117
  return;
114
118
  }
@@ -120,7 +124,7 @@ export const FormulaInput = forwardRef(({ value = "", onChange, onCancel, onBlur
120
124
  setFormulaSelections(selections);
121
125
  }
122
126
  }, [
123
- activeEditor,
127
+ store,
124
128
  onChange,
125
129
  enterFormulaMode,
126
130
  setFormulaSelections,
@@ -1,3 +1,3 @@
1
1
  export const releaseDate =
2
2
  // @ts-ignore
3
- new Date("2026-11-11") ?? new Date("2025-06-18");
3
+ new Date("2026-11-12") ?? new Date("2025-06-18");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/spreadsheet",
3
- "version": "10.10.2",
3
+ "version": "10.10.3",
4
4
  "author": "Vinay M",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "./dist/cjs/index.js",
@@ -41,7 +41,7 @@
41
41
  "@dnd-kit/modifiers": "^9.0.0",
42
42
  "@dnd-kit/sortable": "^10.0.0",
43
43
  "@dnd-kit/utilities": "^3.2.2",
44
- "@rowsncolumns/calculator": ">=7.3.5",
44
+ "@rowsncolumns/calculator": ">=7.3.6",
45
45
  "@rowsncolumns/common-types": ">=5.5.1",
46
46
  "@rowsncolumns/fast-formula-parser": ">=6.2.49",
47
47
  "@rowsncolumns/functions": ">=15.1.4",