@rowsncolumns/spreadsheet 10.8.1 → 10.8.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/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/helpers.d.ts +7 -0
- package/dist/cjs/components/canvas-grid/helpers.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/helpers.js +18 -1
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +27 -4
- package/dist/cjs/components/canvas-grid/typings.d.ts +6 -1
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/cell-image.d.ts +17 -3
- package/dist/cjs/components/cell-structured/cell-image.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/cell-image.js +15 -4
- package/dist/cjs/components/cell-structured/index.d.ts +2 -2
- package/dist/cjs/components/cell-structured/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/index.js +3 -2
- package/dist/cjs/hooks/use-editor-submit.d.ts +17 -1
- package/dist/cjs/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.js +43 -4
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/helpers.d.ts +7 -0
- package/dist/esm/components/canvas-grid/helpers.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/helpers.js +16 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +27 -4
- package/dist/esm/components/canvas-grid/typings.d.ts +6 -1
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/cell-image.d.ts +17 -3
- package/dist/esm/components/cell-structured/cell-image.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/cell-image.js +15 -4
- package/dist/esm/components/cell-structured/index.d.ts +2 -2
- package/dist/esm/components/cell-structured/index.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/index.js +3 -3
- package/dist/esm/hooks/use-editor-submit.d.ts +17 -1
- package/dist/esm/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.js +40 -2
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-editor-submit.d.ts","sourceRoot":"","sources":["../../../hooks/use-editor-submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAEL,KAAK,kBAAkB,EAIvB,KAAK,aAAa,EAElB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,KAAK,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnC,uFAAuF;AACvF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;CACxB,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,UAAU,EACjB,YAAY,aAAa,EACzB,MAAM,aAAa,KAClB,UAGQ,CAAC;AAwCZ;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,UAAU,EACjB,YAAY,aAAa,EACzB,YAAY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3D;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7E,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,oSAmB7B,oBAAoB,aAQV,MAAM,GAAG,OAAO,kBACP,aAAa,EAAE,GAAG,SAAS,GAAG,IAAI,iBACnC,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,kBAClC,MAAM,cACV,aAAa,mBACR,aAAa,GAAG,IAAI,YAC3B,OAAO,YACP,mBAAmB,kBA2OlC,CAAC"}
|
|
@@ -109,13 +109,35 @@ export const entryTurnsOnWrap = ({ value, previousValue, format, }) => typeof va
|
|
|
109
109
|
value.includes("\n") &&
|
|
110
110
|
value !== previousValue &&
|
|
111
111
|
format?.wrapStrategy !== "wrap";
|
|
112
|
-
|
|
112
|
+
/**
|
|
113
|
+
* The engine refusals of a typed entry past Excel's limits (rnc-store `rejections`, #49969 FX-18):
|
|
114
|
+
* a formula over 8,192 characters, over 64 nested functions, a function over 255 arguments, a text
|
|
115
|
+
* value over 255 characters. Excel shows its message and, on OK, leaves the cell in Edit mode with
|
|
116
|
+
* the typed text so it can be fixed; nothing is entered and the active cell does not move.
|
|
117
|
+
*/
|
|
118
|
+
export const ENTRY_LIMIT_REJECTION_CODES = new Set([
|
|
119
|
+
"formula-too-long",
|
|
120
|
+
"formula-too-many-nested-functions",
|
|
121
|
+
"formula-too-many-arguments",
|
|
122
|
+
"formula-text-too-long",
|
|
123
|
+
]);
|
|
124
|
+
/** Whether `result` (what the host's `onChange` returned) refuses the entry past Excel's limits. */
|
|
125
|
+
export const isEntryLimitRefusal = (result) => {
|
|
126
|
+
const rejections = result
|
|
127
|
+
?.rejections;
|
|
128
|
+
return (Array.isArray(rejections) &&
|
|
129
|
+
rejections.some((r) => typeof r?.code === "string" &&
|
|
130
|
+
ENTRY_LIMIT_REJECTION_CODES.has(r.code)));
|
|
131
|
+
};
|
|
132
|
+
export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, onChange, onComplete, getCommitValidation, showValidationAlert, selections, onChangeBatch, batchHistory, formulaLocale, referenceStyle, onChangeArrayFormula, getArrayFormula, getEffectiveFormat, onChangeFormatting, autoCorrect, reopenEditor, }) => {
|
|
113
133
|
const [formulaMode, setFormulaMode] = useFormulaMode();
|
|
114
134
|
const [_, setEditingCellCoordinate] = useEditingCell();
|
|
115
135
|
const setActiveEditor = useSetActiveEditor();
|
|
116
136
|
const selectionsRef = useRef(selections);
|
|
117
137
|
selectionsRef.current = selections;
|
|
118
138
|
return useCallback(async (value, textFormatRuns, previousValue, editingSheetId, activeCell, nextActiveCell, isDirty, options) => {
|
|
139
|
+
/* The entry exactly as typed — what the editor shows again if the engine refuses it */
|
|
140
|
+
const typedValue = value;
|
|
119
141
|
/* Balance parentheses */
|
|
120
142
|
if (formulaMode && typeof value !== "boolean") {
|
|
121
143
|
value = balanceFormula(value);
|
|
@@ -147,7 +169,12 @@ export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, o
|
|
|
147
169
|
};
|
|
148
170
|
/* Commit the value and advance to the next cell */
|
|
149
171
|
const commit = () => {
|
|
150
|
-
|
|
172
|
+
let refused = false;
|
|
173
|
+
const writeActiveCell = () => {
|
|
174
|
+
const result = onChange?.(editingSheetId, activeCell, value, textFormatRuns, previousValue, isDirty);
|
|
175
|
+
if (isEntryLimitRefusal(result))
|
|
176
|
+
refused = true;
|
|
177
|
+
};
|
|
151
178
|
// Ctrl+Shift+Enter on a formula: ONE legacy array over the selection (or the array being
|
|
152
179
|
// re-entered) — the engine writes and fits every cell of it, so nothing else is written.
|
|
153
180
|
const arrayFormula = options?.arrayFormula && onChangeArrayFormula && isFormulaEntry(value);
|
|
@@ -194,6 +221,16 @@ export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, o
|
|
|
194
221
|
writeAll();
|
|
195
222
|
}
|
|
196
223
|
}
|
|
224
|
+
// Excel's entry limits refused the typed entry: nothing was written. Stay on the cell and
|
|
225
|
+
// put the typed text back in the editor (after this submit has finished closing it).
|
|
226
|
+
if (refused && typeof typedValue === "string" && reopenEditor) {
|
|
227
|
+
if (editingSheetId !== sheetId) {
|
|
228
|
+
onChangeActiveSheet?.(editingSheetId);
|
|
229
|
+
}
|
|
230
|
+
resetEditorState();
|
|
231
|
+
void Promise.resolve().then(() => reopenEditor(editingSheetId, activeCell, typedValue));
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
197
234
|
// Switch to active sheet
|
|
198
235
|
// Always change sheet first.
|
|
199
236
|
// Skipped when the submit was triggered *by* a sheet change — the
|
|
@@ -264,5 +301,6 @@ export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, o
|
|
|
264
301
|
getEffectiveFormat,
|
|
265
302
|
onChangeFormatting,
|
|
266
303
|
autoCorrect,
|
|
304
|
+
reopenEditor,
|
|
267
305
|
]);
|
|
268
306
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rowsncolumns/spreadsheet",
|
|
3
|
-
"version": "10.8.
|
|
3
|
+
"version": "10.8.2",
|
|
4
4
|
"author": "Vinay M",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@dnd-kit/utilities": "^3.2.2",
|
|
44
44
|
"@rowsncolumns/calculator": ">=7.3.2",
|
|
45
45
|
"@rowsncolumns/common-types": ">=5.4.1",
|
|
46
|
-
"@rowsncolumns/fast-formula-parser": ">=6.2.
|
|
47
|
-
"@rowsncolumns/functions": ">=15.1.
|
|
48
|
-
"@rowsncolumns/grid": ">=13.4.
|
|
46
|
+
"@rowsncolumns/fast-formula-parser": ">=6.2.46",
|
|
47
|
+
"@rowsncolumns/functions": ">=15.1.3",
|
|
48
|
+
"@rowsncolumns/grid": ">=13.4.1",
|
|
49
49
|
"@rowsncolumns/icons": ">=7.2.33",
|
|
50
50
|
"@rowsncolumns/ui": ">=16.2.0",
|
|
51
|
-
"@rowsncolumns/utils": ">=9.7.
|
|
51
|
+
"@rowsncolumns/utils": ">=9.7.2",
|
|
52
52
|
"@rowsncolumns/version-comparison": ">=9.0.1",
|
|
53
53
|
"@tanstack/react-virtual": "3.13.9",
|
|
54
54
|
"jotai": "^2.12.4",
|