@extend-ai/react-xlsx 0.20.7 → 0.20.8

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.
Files changed (42) hide show
  1. package/dist/{chunk-PU7GI2DN.js → chunk-CVMHJO5H.js} +14 -14
  2. package/dist/{chunk-PU7GI2DN.js.map → chunk-CVMHJO5H.js.map} +1 -1
  3. package/dist/{chunk-6LLCA7IL.cjs → chunk-NXXZO2BL.cjs} +2448 -1871
  4. package/dist/chunk-NXXZO2BL.cjs.map +1 -0
  5. package/dist/{chunk-YNJ37P46.cjs → chunk-OGZ6ROZC.cjs} +13 -13
  6. package/dist/chunk-OGZ6ROZC.cjs.map +1 -0
  7. package/dist/{chunk-QGVGTRPL.js → chunk-R2KLWFAZ.js} +807 -230
  8. package/dist/chunk-R2KLWFAZ.js.map +1 -0
  9. package/dist/index.cjs +1252 -834
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +706 -288
  14. package/dist/index.js.map +1 -1
  15. package/dist/{internal-BWLyus2V.d.cts → internal-BBaC9yCh.d.cts} +1 -0
  16. package/dist/{internal-BWLyus2V.d.ts → internal-BBaC9yCh.d.ts} +1 -0
  17. package/dist/internal.cjs +3 -3
  18. package/dist/internal.d.cts +1 -1
  19. package/dist/internal.d.ts +1 -1
  20. package/dist/internal.js +2 -2
  21. package/dist/{shared-chart-X6KINN3S.cjs → shared-chart-4LUQQI2B.cjs} +4 -3
  22. package/dist/shared-chart-4LUQQI2B.cjs.map +1 -0
  23. package/dist/{shared-chart-PFTMNQGJ.js → shared-chart-BLOOGI7S.js} +4 -3
  24. package/dist/shared-chart-BLOOGI7S.js.map +1 -0
  25. package/dist/{shared-chart-7T3XVIDU.cjs → shared-chart-CIRSCWTO.cjs} +15 -14
  26. package/dist/shared-chart-CIRSCWTO.cjs.map +1 -0
  27. package/dist/{shared-chart-APBJ7QVM.js → shared-chart-XOCTF7KQ.js} +5 -4
  28. package/dist/shared-chart-XOCTF7KQ.js.map +1 -0
  29. package/dist/vanilla.cjs +3 -3
  30. package/dist/vanilla.d.cts +2 -2
  31. package/dist/vanilla.d.ts +2 -2
  32. package/dist/vanilla.js +2 -2
  33. package/dist/xlsx-worker.js +7 -3
  34. package/dist/xlsx-worker.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-6LLCA7IL.cjs.map +0 -1
  37. package/dist/chunk-QGVGTRPL.js.map +0 -1
  38. package/dist/chunk-YNJ37P46.cjs.map +0 -1
  39. package/dist/shared-chart-7T3XVIDU.cjs.map +0 -1
  40. package/dist/shared-chart-APBJ7QVM.js.map +0 -1
  41. package/dist/shared-chart-PFTMNQGJ.js.map +0 -1
  42. package/dist/shared-chart-X6KINN3S.cjs.map +0 -1
@@ -20,7 +20,7 @@ import {
20
20
  w,
21
21
  x,
22
22
  y
23
- } from "./chunk-PU7GI2DN.js";
23
+ } from "./chunk-CVMHJO5H.js";
24
24
 
25
25
  // src/range-reference.ts
26
26
  var XLSX_MAX_ROWS = 1048576;
@@ -284,6 +284,161 @@ function localizeRows(worksheet, rows, locale = "en-US") {
284
284
  }
285
285
  }
286
286
 
287
+ // src/formula-references.ts
288
+ var REFERENCE_COLORS = ["#3472c9", "#c53645", "#9b4dbb", "#258447", "#b97812", "#16858e"];
289
+ var CELL = String.raw`\$?[A-Z]{1,3}\$?[1-9]\d{0,6}`;
290
+ var COLUMN = String.raw`\$?[A-Z]{1,3}`;
291
+ var ROW = String.raw`\$?[1-9]\d{0,6}`;
292
+ var SHEET = String.raw`(?:'(?:[^']|'')+'|[\p{L}\p{N}_\\.]+)!`;
293
+ var REFERENCE = new RegExp(
294
+ `(?:${SHEET})?(?:${CELL}(?:\\s*:\\s*${CELL})?|${COLUMN}\\s*:\\s*${COLUMN}|${ROW}\\s*:\\s*${ROW})`,
295
+ "iyu"
296
+ );
297
+ var NAME_CHARACTER = /[\p{L}\p{N}_.$\\]/u;
298
+ function getFormulaReferences(value, sheetName) {
299
+ if (!/^[=+-]/.test(value)) return [];
300
+ const references = [];
301
+ const colors = /* @__PURE__ */ new Map();
302
+ let index = value.startsWith("=") ? 1 : 0;
303
+ while (index < value.length) {
304
+ if (value[index] === '"') {
305
+ index += 1;
306
+ while (index < value.length) {
307
+ if (value[index++] === '"') {
308
+ if (value[index] !== '"') break;
309
+ index += 1;
310
+ }
311
+ }
312
+ continue;
313
+ }
314
+ if (value[index] === "[") {
315
+ let depth = 1;
316
+ while (++index < value.length && depth) {
317
+ if (value[index] === "[") depth += 1;
318
+ if (value[index] === "]") depth -= 1;
319
+ }
320
+ while (index < value.length && /[^\s+\-*/^&=<>(),;]/.test(value[index])) index += 1;
321
+ continue;
322
+ }
323
+ if (NAME_CHARACTER.test(value[index - 1])) {
324
+ index += 1;
325
+ continue;
326
+ }
327
+ REFERENCE.lastIndex = index;
328
+ const match = REFERENCE.exec(value);
329
+ if (match) {
330
+ const end = index + match[0].length;
331
+ const previous = value[index - 1];
332
+ const next = value[end];
333
+ const parsed = parseXlsxRange(match[0].replace(/\s*:\s*/g, ":"));
334
+ if (parsed && !NAME_CHARACTER.test(previous) && previous !== "]" && previous !== "!" && previous !== ":" && (!next || !NAME_CHARACTER.test(next) && !/[!\[]/.test(next)) && !/^\s*\(/.test(value.slice(end))) {
335
+ const { range } = parsed;
336
+ const key = `${(parsed.sheetName ?? sheetName).toLowerCase()}:${range.start.row},${range.start.col}:${range.end.row},${range.end.col}`;
337
+ let color = colors.get(key);
338
+ if (!color) {
339
+ color = REFERENCE_COLORS[colors.size % REFERENCE_COLORS.length];
340
+ colors.set(key, color);
341
+ }
342
+ references.push({ ...parsed, start: index, end, color });
343
+ }
344
+ index = end;
345
+ } else if (value[index] === "'") {
346
+ index += 1;
347
+ while (index < value.length) {
348
+ if (value[index++] === "'") {
349
+ if (value[index] !== "'") break;
350
+ index += 1;
351
+ }
352
+ }
353
+ } else {
354
+ index += 1;
355
+ }
356
+ }
357
+ return references;
358
+ }
359
+
360
+ // src/cell-input.ts
361
+ function isTextCell(worksheet, cell) {
362
+ const style = worksheet.getCellStyleAt(cell.row, cell.col);
363
+ return style?.numberFormat?.formatString === "@" || style?.numberFormat?.id === 49;
364
+ }
365
+ function coerceUserEnteredValue(value, locale = "en-US", source = "edit") {
366
+ if (source === "edit" && value.startsWith("'")) return value.slice(1);
367
+ const trimmed = value.trim();
368
+ if (!trimmed) return value;
369
+ if (/^(true|false)$/i.test(trimmed)) return trimmed.toLowerCase() === "true";
370
+ const localized = parseLocaleNumber(trimmed, locale);
371
+ if (localized !== void 0) return localized;
372
+ if (/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(trimmed)) {
373
+ const number = Number(trimmed);
374
+ if (Number.isFinite(number)) return number;
375
+ }
376
+ return value;
377
+ }
378
+ function getUserEnteredFormula(value, locale = "en-US") {
379
+ if (value.startsWith("=") && value.length > 1) return value;
380
+ if (/^[+-].+/.test(value) && typeof coerceUserEnteredValue(value, locale) !== "number") return `=${value}`;
381
+ return null;
382
+ }
383
+ function applyInputNumberFormat(worksheet, cell, input) {
384
+ const style = worksheet.getCellStyleAt(cell.row, cell.col);
385
+ const format = style?.numberFormat;
386
+ if (format?.formatString && format.formatString.toLowerCase() !== "general") return;
387
+ const formatString = /^[+-]?(?:\d+\.?\d*|\.\d+)[eE][+-]?\d+$/.test(input.trim()) ? "0.00E+00" : /^=\s*(?:DATE|TODAY)\s*\(/i.test(input) ? "m/d/yy" : void 0;
388
+ if (formatString) worksheet.setCellStyleAt(cell.row, cell.col, { ...style, numberFormat: { formatString } });
389
+ }
390
+ function normalizeFormulaReferences(formula) {
391
+ for (const reference of getFormulaReferences(formula, "").reverse()) {
392
+ const token = formula.slice(reference.start, reference.end);
393
+ const separator = token.lastIndexOf("!") + 1;
394
+ formula = formula.slice(0, reference.start) + token.slice(0, separator) + token.slice(separator).toUpperCase().replace(/\s*:\s*/g, ":") + formula.slice(reference.end);
395
+ }
396
+ return formula;
397
+ }
398
+ function getCellEditingValue(worksheet, cell, locale) {
399
+ const value = worksheet.getCellAt(cell.row, cell.col);
400
+ try {
401
+ if (value.is_empty) return "";
402
+ if (value.is_number) {
403
+ const decimal = new Intl.NumberFormat(locale).formatToParts(1.1).find((part) => part.type === "decimal")?.value ?? ".";
404
+ return String(value.asNumber()).replace(".", decimal);
405
+ }
406
+ const text = value.toString();
407
+ if (value.is_text && (text.startsWith("'") || !isTextCell(worksheet, cell) && (getUserEnteredFormula(text, locale) || coerceUserEnteredValue(text, locale) !== text))) return `'${text}`;
408
+ return text;
409
+ } finally {
410
+ value.free();
411
+ }
412
+ }
413
+ function parseClipboardText(text) {
414
+ const normalized = text.replace(/\r\n?/g, "\n");
415
+ const rows = [];
416
+ let row = [];
417
+ let offset = 0;
418
+ while (offset < normalized.length) {
419
+ let value = "";
420
+ if (normalized[offset] === '"') {
421
+ const quoted = /^"((?:[^"]|"")*)"(?=\t|\n|$)/.exec(normalized.slice(offset));
422
+ if (quoted) {
423
+ value = quoted[1].replace(/""/g, '"');
424
+ offset += quoted[0].length;
425
+ }
426
+ }
427
+ while (offset < normalized.length && normalized[offset] !== " " && normalized[offset] !== "\n") value += normalized[offset++];
428
+ row.push(value);
429
+ const delimiter = normalized[offset++];
430
+ if (delimiter === "\n" || delimiter === void 0) {
431
+ rows.push(row);
432
+ row = [];
433
+ } else if (offset === normalized.length) row.push("");
434
+ }
435
+ if (row.length) rows.push(row);
436
+ return rows;
437
+ }
438
+ function quoteClipboardField(value) {
439
+ return /[\t\r\n"]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value;
440
+ }
441
+
287
442
  // src/spreadsheet-fonts.ts
288
443
  import { strFromU8, unzipSync } from "fflate";
289
444
  async function loadSpreadsheetFonts(buffer) {
@@ -5730,12 +5885,11 @@ function parseSheetState(archive, path, options) {
5730
5885
  );
5731
5886
  const defaultRowHeight = Number(sheetFormatNode?.getAttribute("defaultRowHeight") ?? 15);
5732
5887
  const digitWidthPt = measureOfficeDigitWidthPt(options?.defaultFont?.family, options?.defaultFont?.sizePt);
5733
- const storedColumnPixels = (width) => Math.max(0, Math.floor(
5734
- (256 * width + Math.floor(128 / digitWidthPt)) / 256 * digitWidthPt
5735
- ) * (4 / 3));
5888
+ const storedColumnPixels = (width) => resolveOfficeColumnWidthPixels(width, digitWidthPt);
5736
5889
  const explicitDefaultWidth = Number(sheetFormatNode?.getAttribute("defaultColWidth") ?? Number.NaN);
5737
5890
  const baseWidth = Number(sheetFormatNode?.getAttribute("baseColWidth") ?? 8);
5738
5891
  const officeLayout = {
5892
+ columnDigitWidthPt: digitWidthPt,
5739
5893
  defaultColumnPx: Number.isFinite(explicitDefaultWidth) && explicitDefaultWidth > 0 ? storedColumnPixels(explicitDefaultWidth) : ((Number.isFinite(baseWidth) && baseWidth > 0 ? baseWidth : 8) * digitWidthPt + 5) * (4 / 3),
5740
5894
  defaultRowPx: (Number.isFinite(defaultRowHeight) && defaultRowHeight > 0 ? defaultRowHeight : 15) * (4 / 3),
5741
5895
  columns: {},
@@ -7510,6 +7664,15 @@ function pixelsToEmu(value) {
7510
7664
  function pxToSheetColumnWidth(widthPx) {
7511
7665
  return (Math.max(widthPx, MIN_COL_WIDTH_PX) - 5) / 7;
7512
7666
  }
7667
+ function resolveOfficeColumnWidthPixels(width, digitWidthPt = 6) {
7668
+ return Math.max(0, Math.floor(
7669
+ (256 * width + Math.floor(128 / digitWidthPt)) / 256 * digitWidthPt
7670
+ ) * (4 / 3));
7671
+ }
7672
+ function pxToOfficeColumnWidth(widthPx, digitWidthPt = 6) {
7673
+ const points = Math.round(Math.max(widthPx, MIN_COL_WIDTH_PX) * (3 / 4));
7674
+ return (points + 0.5) / digitWidthPt - Math.floor(128 / digitWidthPt) / 256;
7675
+ }
7513
7676
  function resolveSheetColumnWidthPixels(width, columnWidthCharacterWidthPx) {
7514
7677
  return sheetColumnWidthToPixels(width, columnWidthCharacterWidthPx);
7515
7678
  }
@@ -9023,27 +9186,6 @@ function cloneCellStyle(style) {
9023
9186
  return style;
9024
9187
  }
9025
9188
  }
9026
- function coerceUserEnteredValue(value, locale = "en-US") {
9027
- const trimmed = value.trim();
9028
- if (!trimmed) {
9029
- return "";
9030
- }
9031
- if (trimmed.startsWith("'")) {
9032
- return trimmed.slice(1);
9033
- }
9034
- if (/^(true|false)$/i.test(trimmed)) {
9035
- return trimmed.toLowerCase() === "true";
9036
- }
9037
- const localizedNumber = parseLocaleNumber(trimmed, locale);
9038
- if (localizedNumber !== void 0) return localizedNumber;
9039
- if (/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(trimmed)) {
9040
- const parsed = Number(trimmed);
9041
- if (Number.isFinite(parsed)) {
9042
- return parsed;
9043
- }
9044
- }
9045
- return value;
9046
- }
9047
9189
  function applyCellMutationState(worksheet, cell, state) {
9048
9190
  if (state.formula) {
9049
9191
  worksheet.setFormula(cellAddressToA1(cell), state.formula);
@@ -9057,14 +9199,6 @@ function applyCellMutationState(worksheet, cell, state) {
9057
9199
  function escapeHtml(value) {
9058
9200
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
9059
9201
  }
9060
- function parseClipboardText(text) {
9061
- const normalized = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
9062
- const rows = normalized.split("\n");
9063
- if (rows.length > 1 && rows[rows.length - 1] === "") {
9064
- rows.pop();
9065
- }
9066
- return rows.map((row) => row.split(" "));
9067
- }
9068
9202
  function createAbortError2() {
9069
9203
  if (typeof DOMException !== "undefined") {
9070
9204
  return new DOMException("Aborted", "AbortError");
@@ -10629,7 +10763,7 @@ function useXlsxViewerController(options) {
10629
10763
  rowSpan
10630
10764
  });
10631
10765
  }
10632
- textCells.push(value);
10766
+ textCells.push(quoteClipboardField(value));
10633
10767
  htmlCells.push(
10634
10768
  `<td${rowSpan > 1 ? ` rowspan="${rowSpan}"` : ""}${colSpan > 1 ? ` colspan="${colSpan}"` : ""} style="${escapeHtml(cellStyles.join(";"))}">${escapeHtml(value)}</td>`
10635
10769
  );
@@ -11088,7 +11222,7 @@ function useXlsxViewerController(options) {
11088
11222
  if (!activeSheet) {
11089
11223
  return;
11090
11224
  }
11091
- const contentSizePx = resolveContentSheetAxisPixels(sizePx, activeSheet.showGridLines);
11225
+ const contentSizePx = activeSheet.officeLayout ? sizePx : resolveContentSheetAxisPixels(sizePx, activeSheet.showGridLines);
11092
11226
  const targetWorkbookSheetIndex = activeSheet.workbookSheetIndex;
11093
11227
  setSheets((currentSheets) => currentSheets.map((sheet) => {
11094
11228
  if (sheet.workbookSheetIndex !== targetWorkbookSheetIndex) {
@@ -11142,7 +11276,7 @@ function useXlsxViewerController(options) {
11142
11276
  const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
11143
11277
  worksheet.setColumnWidth(
11144
11278
  col,
11145
- pxToSheetColumnWidth(resolveContentSheetAxisPixels(widthPx, activeSheet.showGridLines))
11279
+ activeSheet.officeLayout ? pxToOfficeColumnWidth(widthPx, activeSheet.officeLayout.columnDigitWidthPt) : pxToSheetColumnWidth(resolveContentSheetAxisPixels(widthPx, activeSheet.showGridLines))
11146
11280
  );
11147
11281
  refreshWorkbookState(workbook);
11148
11282
  }, [
@@ -11170,7 +11304,7 @@ function useXlsxViewerController(options) {
11170
11304
  const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
11171
11305
  worksheet.setRowHeight(
11172
11306
  row,
11173
- pxToSheetRowHeight(resolveContentSheetAxisPixels(heightPx, activeSheet.showGridLines))
11307
+ activeSheet.officeLayout ? Math.max(heightPx, MIN_ROW_HEIGHT_PX2) * (3 / 4) : pxToSheetRowHeight(resolveContentSheetAxisPixels(heightPx, activeSheet.showGridLines))
11174
11308
  );
11175
11309
  refreshWorkbookState(workbook);
11176
11310
  }, [
@@ -11537,8 +11671,9 @@ function useXlsxViewerController(options) {
11537
11671
  return;
11538
11672
  }
11539
11673
  if (locale !== "en-US" && value === getCellDisplayValue2(cell)) return;
11540
- const nextValue = coerceUserEnteredValue(value, locale);
11674
+ const nextValue = isTextCell(worksheet, cell) ? value.startsWith("'") ? value.slice(1) : value : coerceUserEnteredValue(value, locale);
11541
11675
  worksheet.setCell(cellAddressToA1(cell), nextValue);
11676
+ if (typeof nextValue === "number") applyInputNumberFormat(worksheet, cell, value);
11542
11677
  const after = captureCellMutationState(cell);
11543
11678
  if (!after) {
11544
11679
  return;
@@ -11560,7 +11695,8 @@ function useXlsxViewerController(options) {
11560
11695
  if (!formula.trim()) {
11561
11696
  worksheet.setCell(cellAddressToA1(cell), "");
11562
11697
  } else {
11563
- worksheet.setFormula(cellAddressToA1(cell), formula);
11698
+ worksheet.setFormula(cellAddressToA1(cell), normalizeFormulaReferences(formula));
11699
+ applyInputNumberFormat(worksheet, cell, formula);
11564
11700
  }
11565
11701
  const after = captureCellMutationState(cell);
11566
11702
  if (!after) {
@@ -11875,8 +12011,11 @@ function useXlsxViewerController(options) {
11875
12011
  if (!before) {
11876
12012
  continue;
11877
12013
  }
11878
- if (rawValue.startsWith("=") && rawValue.length > 1) {
11879
- worksheet.setFormula(cellAddressToA1(nextCell), rawValue);
12014
+ const textCell = isTextCell(worksheet, nextCell);
12015
+ const formula = textCell ? null : getUserEnteredFormula(rawValue, locale);
12016
+ if (formula) {
12017
+ worksheet.setFormula(cellAddressToA1(nextCell), normalizeFormulaReferences(formula));
12018
+ applyInputNumberFormat(worksheet, nextCell, formula);
11880
12019
  const after = captureCellMutationState(nextCell);
11881
12020
  if (!after) {
11882
12021
  continue;
@@ -11887,8 +12026,9 @@ function useXlsxViewerController(options) {
11887
12026
  cell: nextCell
11888
12027
  });
11889
12028
  } else {
11890
- const nextValue = coerceUserEnteredValue(rawValue, locale);
12029
+ const nextValue = textCell ? rawValue : coerceUserEnteredValue(rawValue, locale, "paste");
11891
12030
  worksheet.setCell(cellAddressToA1(nextCell), nextValue);
12031
+ if (typeof nextValue === "number") applyInputNumberFormat(worksheet, nextCell, rawValue);
11892
12032
  const after = captureCellMutationState(nextCell);
11893
12033
  if (!after) {
11894
12034
  continue;
@@ -13968,6 +14108,267 @@ function growScrollDisplayLimit(current, growth, maximum, readOnly) {
13968
14108
  return readOnly ? Math.max(current, Math.min(maximum, nextLimit)) : nextLimit;
13969
14109
  }
13970
14110
 
14111
+ // src/cell-editor.tsx
14112
+ function CellEditor({
14113
+ value,
14114
+ references,
14115
+ inputRef,
14116
+ canvasText = false,
14117
+ canvasOffset,
14118
+ paintCanvasText,
14119
+ style,
14120
+ onChange,
14121
+ onBlur,
14122
+ onCommit,
14123
+ onCancel,
14124
+ onNavigate
14125
+ }) {
14126
+ const rootRef = A(null);
14127
+ const mirrorRef = A(null);
14128
+ const textRef = A(null);
14129
+ const baselineRef = A(null);
14130
+ const plainTextRef = A(null);
14131
+ const canvasRef = A(null);
14132
+ const textareaRef = A(null);
14133
+ const baselineOffsetRef = A(0);
14134
+ const measuringContextRef = A(null);
14135
+ const [bounds, setBounds] = d({ width: 0, height: 0 });
14136
+ _(() => {
14137
+ const root = rootRef.current;
14138
+ const anchor = root?.parentElement;
14139
+ const viewport = root?.closest('[role="grid"]');
14140
+ if (!root || !anchor || !viewport) {
14141
+ return;
14142
+ }
14143
+ const updateBounds = () => {
14144
+ const anchorRect = anchor.getBoundingClientRect();
14145
+ const viewportRect = viewport.getBoundingClientRect();
14146
+ const anchorWidth = parseFloat(getComputedStyle(anchor).width) || anchor.offsetWidth;
14147
+ const scale = anchorWidth ? anchorRect.width / anchorWidth : 1;
14148
+ const viewportScale = viewport.offsetWidth ? viewportRect.width / viewport.offsetWidth : 1;
14149
+ const viewportRight = viewportRect.right - (viewport.offsetWidth - viewport.clientWidth - viewport.clientLeft) * viewportScale;
14150
+ const width = Math.max(anchor.clientWidth, (viewportRight - anchorRect.left) / (scale || 1));
14151
+ const height = anchorRect.height / (scale || 1);
14152
+ setBounds((previous) => previous.width === width && previous.height === height ? previous : { width, height });
14153
+ };
14154
+ updateBounds();
14155
+ const observer = new ResizeObserver(updateBounds);
14156
+ observer.observe(viewport);
14157
+ observer.observe(anchor);
14158
+ viewport.addEventListener("scroll", updateBounds);
14159
+ return () => {
14160
+ observer.disconnect();
14161
+ viewport.removeEventListener("scroll", updateBounds);
14162
+ };
14163
+ }, []);
14164
+ _(() => {
14165
+ const text = textRef.current;
14166
+ const textarea = textareaRef.current;
14167
+ const root = rootRef.current;
14168
+ const baseline = baselineRef.current;
14169
+ const mirror = mirrorRef.current;
14170
+ if (!text || !textarea || !root || !baseline || !mirror) return;
14171
+ const computedStyle = getComputedStyle(text);
14172
+ const lineHeight = parseFloat(computedStyle.lineHeight) || parseFloat(computedStyle.fontSize) * 1.2;
14173
+ mirror.style.padding = typeof style.padding === "number" ? `${style.padding}px` : style.padding ?? "0";
14174
+ const mirrorStyle = getComputedStyle(mirror);
14175
+ const paddingTop = parseFloat(mirrorStyle.paddingTop) || 0;
14176
+ const paddingBottom = parseFloat(mirrorStyle.paddingBottom) || 0;
14177
+ const spareHeight = Math.max(0, bounds.height - paddingTop - paddingBottom - lineHeight);
14178
+ const editorTextTop = paddingTop + (style.verticalAlign === "top" ? 0 : style.verticalAlign === "middle" ? spareHeight / 2 : spareHeight);
14179
+ if (canvasText) mirror.style.paddingTop = `${editorTextTop}px`;
14180
+ const rootRect = root.getBoundingClientRect();
14181
+ const scale = rootRect.width / parseFloat(getComputedStyle(root).width) || 1;
14182
+ const textTop = (text.getBoundingClientRect().top - rootRect.top) / scale - baselineOffsetRef.current;
14183
+ textarea.style.paddingTop = `${Math.max(0, textTop)}px`;
14184
+ let baselineOffset = 0;
14185
+ if (canvasText) {
14186
+ const context = measuringContextRef.current ??= document.createElement("canvas").getContext("2d");
14187
+ if (context) {
14188
+ context.font = computedStyle.font;
14189
+ context.textBaseline = "alphabetic";
14190
+ const alphabetic = context.measureText("M");
14191
+ context.textBaseline = "middle";
14192
+ const middle = context.measureText("M");
14193
+ const browserBaseline = (baseline.getBoundingClientRect().top - rootRect.top) / scale - baselineOffsetRef.current;
14194
+ baselineOffset = editorTextTop + lineHeight / 2 + alphabetic.actualBoundingBoxAscent - middle.actualBoundingBoxAscent - browserBaseline;
14195
+ }
14196
+ }
14197
+ baselineOffsetRef.current = baselineOffset;
14198
+ root.style.setProperty("--xlsx-editor-baseline-offset", `${baselineOffset}px`);
14199
+ const canvas = canvasRef.current;
14200
+ if (canvas && paintCanvasText) {
14201
+ const dpr = window.devicePixelRatio || 1;
14202
+ const offsetX = (canvasOffset?.left ?? 0) * dpr % 1 / dpr;
14203
+ const offsetY = (canvasOffset?.top ?? 0) * dpr % 1 / dpr;
14204
+ const width = rootRect.width / scale;
14205
+ const height = rootRect.height / scale;
14206
+ canvas.width = Math.ceil((width + offsetX) * dpr);
14207
+ canvas.height = Math.ceil((height + offsetY) * dpr);
14208
+ canvas.style.width = `${canvas.width / dpr}px`;
14209
+ canvas.style.height = `${canvas.height / dpr}px`;
14210
+ canvas.style.left = `${-offsetX}px`;
14211
+ canvas.style.top = `${-offsetY}px`;
14212
+ const context = canvas.getContext("2d");
14213
+ if (context) {
14214
+ const node = plainTextRef.current?.firstChild;
14215
+ const lines = [];
14216
+ if (node) {
14217
+ const range = document.createRange();
14218
+ const length = node.textContent?.length ?? 0;
14219
+ let start = 0;
14220
+ while (start < length) {
14221
+ range.setStart(node, start);
14222
+ range.setEnd(node, start + 1);
14223
+ const top = range.getBoundingClientRect().top;
14224
+ let low = start + 1;
14225
+ let high = length;
14226
+ while (low < high) {
14227
+ const middle = Math.floor((low + high) / 2);
14228
+ range.setStart(node, middle);
14229
+ range.setEnd(node, middle + 1);
14230
+ if (Math.abs(range.getBoundingClientRect().top - top) < 1) low = middle + 1;
14231
+ else high = middle;
14232
+ }
14233
+ lines.push({ start, text: value.slice(start, low).replace(/\r?\n$/, "") });
14234
+ start = low;
14235
+ }
14236
+ }
14237
+ context.scale(dpr, dpr);
14238
+ context.translate(offsetX, offsetY);
14239
+ paintCanvasText(context, width, height, lines, editorTextTop);
14240
+ }
14241
+ }
14242
+ });
14243
+ const parts = [];
14244
+ let offset = 0;
14245
+ for (const reference of references) {
14246
+ parts.push(value.slice(offset, reference.start));
14247
+ parts.push(/* @__PURE__ */ u("span", { style: { color: reference.color }, children: value.slice(reference.start, reference.end) }, reference.start));
14248
+ offset = reference.end;
14249
+ }
14250
+ parts.push(value.slice(offset));
14251
+ return /* @__PURE__ */ u(
14252
+ "div",
14253
+ {
14254
+ ref: rootRef,
14255
+ onPointerDown: (event) => event.stopPropagation(),
14256
+ onClick: (event) => event.stopPropagation(),
14257
+ onDoubleClick: (event) => event.stopPropagation(),
14258
+ style: {
14259
+ ...style,
14260
+ boxSizing: "border-box",
14261
+ position: "absolute",
14262
+ top: 0,
14263
+ left: 0,
14264
+ minHeight: "100%",
14265
+ minWidth: "100%",
14266
+ width: "max-content",
14267
+ maxWidth: bounds.width || "100%",
14268
+ textAlign: style.textAlign ?? "left",
14269
+ whiteSpace: "pre-wrap",
14270
+ wordBreak: canvasText ? "break-all" : void 0,
14271
+ overflowWrap: "anywhere",
14272
+ padding: 0,
14273
+ lineHeight: style.lineHeight ?? "inherit",
14274
+ overflow: "hidden"
14275
+ },
14276
+ children: [
14277
+ /* @__PURE__ */ u(
14278
+ "div",
14279
+ {
14280
+ ref: mirrorRef,
14281
+ "aria-hidden": "true",
14282
+ "data-xlsx-formula-text": "",
14283
+ style: {
14284
+ boxSizing: "border-box",
14285
+ padding: style.padding,
14286
+ minHeight: bounds.height,
14287
+ display: canvasText ? "block" : "flex",
14288
+ flexDirection: "column",
14289
+ justifyContent: style.verticalAlign === "top" ? "flex-start" : style.verticalAlign === "middle" ? "center" : "flex-end",
14290
+ overflow: "hidden",
14291
+ visibility: paintCanvasText ? "hidden" : void 0,
14292
+ pointerEvents: "none"
14293
+ },
14294
+ children: /* @__PURE__ */ u("span", { ref: textRef, style: { display: "block", transform: "translateY(var(--xlsx-editor-baseline-offset, 0px))" }, children: [
14295
+ /* @__PURE__ */ u("span", { ref: baselineRef, style: { display: "inline-block", width: 0, height: 0, verticalAlign: "baseline" } }),
14296
+ paintCanvasText ? /* @__PURE__ */ u("span", { ref: plainTextRef, children: !value || /[\r\n]$/.test(value) ? value + "\u200B" : value }) : /* @__PURE__ */ u(S, { children: [
14297
+ parts,
14298
+ "\u200B"
14299
+ ] })
14300
+ ] })
14301
+ }
14302
+ ),
14303
+ paintCanvasText ? /* @__PURE__ */ u("canvas", { ref: canvasRef, "aria-hidden": "true", style: { position: "absolute", pointerEvents: "none" } }) : null,
14304
+ /* @__PURE__ */ u(
14305
+ "textarea",
14306
+ {
14307
+ ref: (element) => {
14308
+ textareaRef.current = element;
14309
+ if (typeof inputRef === "function") inputRef(element);
14310
+ else if (inputRef) inputRef.current = element;
14311
+ },
14312
+ "aria-label": "Edit cell",
14313
+ autoFocus: true,
14314
+ autoComplete: "off",
14315
+ spellCheck: false,
14316
+ rows: 1,
14317
+ value,
14318
+ onBlur,
14319
+ onChange: (event) => onChange(event.target.value),
14320
+ onScroll: (event) => {
14321
+ if (mirrorRef.current) mirrorRef.current.scrollTop = event.currentTarget.scrollTop;
14322
+ },
14323
+ onKeyDown: (event) => {
14324
+ event.stopPropagation();
14325
+ if (event.nativeEvent.isComposing) return;
14326
+ if (event.key === "Enter" && !event.altKey) {
14327
+ event.preventDefault();
14328
+ onCommit();
14329
+ } else if (event.key === "Escape") {
14330
+ event.preventDefault();
14331
+ onCancel();
14332
+ } else if (event.key === "Tab") {
14333
+ event.preventDefault();
14334
+ onNavigate(event.shiftKey ? "ArrowLeft" : "ArrowRight", event.currentTarget.value);
14335
+ } else if ((event.key === "ArrowDown" || event.key === "ArrowUp") && event.currentTarget.clientHeight < parseFloat(getComputedStyle(event.currentTarget).lineHeight) * 2) {
14336
+ event.preventDefault();
14337
+ onNavigate(event.key, event.currentTarget.value);
14338
+ }
14339
+ },
14340
+ style: {
14341
+ position: "absolute",
14342
+ inset: 0,
14343
+ background: "transparent",
14344
+ border: 0,
14345
+ boxSizing: "border-box",
14346
+ color: "transparent",
14347
+ caretColor: style.color ?? "currentColor",
14348
+ font: "inherit",
14349
+ lineHeight: "inherit",
14350
+ letterSpacing: "inherit",
14351
+ textAlign: "inherit",
14352
+ height: "100%",
14353
+ width: "100%",
14354
+ minWidth: 0,
14355
+ whiteSpace: "pre-wrap",
14356
+ wordBreak: canvasText ? "break-all" : void 0,
14357
+ overflowWrap: "anywhere",
14358
+ resize: "none",
14359
+ overflow: "hidden",
14360
+ padding: style.padding,
14361
+ margin: 0,
14362
+ outline: "none",
14363
+ transform: "translateY(var(--xlsx-editor-baseline-offset, 0px))"
14364
+ }
14365
+ }
14366
+ )
14367
+ ]
14368
+ }
14369
+ );
14370
+ }
14371
+
13971
14372
  // src/merged-range-lookup.ts
13972
14373
  function createMergedRangeLookup(ranges) {
13973
14374
  const normalizedRanges = [];
@@ -14405,18 +14806,18 @@ function createChartModule(importModule) {
14405
14806
  var officeChartRenderer = createChartModule(async () => {
14406
14807
  const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([
14407
14808
  import("./browser-KDZS5QQX.js"),
14408
- import("./shared-chart-APBJ7QVM.js")
14809
+ import("./shared-chart-XOCTF7KQ.js")
14409
14810
  ]);
14410
14811
  return { renderer: await loadOfficeCharts(), SharedChartSvg };
14411
14812
  });
14412
14813
  var suppliedOfficeChartRenderer = createChartModule(async () => {
14413
- const { SharedChartSvg } = await import("./shared-chart-APBJ7QVM.js");
14814
+ const { SharedChartSvg } = await import("./shared-chart-XOCTF7KQ.js");
14414
14815
  return { renderer: null, SharedChartSvg };
14415
14816
  });
14416
14817
  var officeExtendedChartRenderer = createChartModule(async () => {
14417
14818
  const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([
14418
14819
  import("./full-IEKDBMU3.js"),
14419
- import("./shared-chart-APBJ7QVM.js")
14820
+ import("./shared-chart-XOCTF7KQ.js")
14420
14821
  ]);
14421
14822
  return { renderer: await loadOfficeCharts(typeof DecompressionStream === "function" ? void 0 : new URL("./office_charts_full_bg.wasm", import.meta.url)), SharedChartSvg };
14422
14823
  });
@@ -14533,14 +14934,13 @@ var CANVAS_DIRTY_CELL_CULL_MARGIN_PX = CANVAS_VIEWPORT_OVERSCAN_PX * 2;
14533
14934
  var LIVE_ZOOM_COMMIT_IDLE_MS = 48;
14534
14935
  var WHEEL_ZOOM_SENSITIVITY = 25e-4;
14535
14936
  var WHEEL_LINE_DELTA_PX = 16;
14536
- var CHART_SOURCE_HIGHLIGHT_COLORS = ["#2563eb", "#dc2626", "#7c3aed", "#059669", "#ea580c", "#db2777"];
14537
14937
  var CHART_SOURCE_HIGHLIGHT_COLOR_BY_ROLE = {
14538
- bubble: CHART_SOURCE_HIGHLIGHT_COLORS[3] ?? "#059669",
14539
- category: CHART_SOURCE_HIGHLIGHT_COLORS[2] ?? "#7c3aed",
14540
- name: CHART_SOURCE_HIGHLIGHT_COLORS[0] ?? "#2563eb",
14541
- point: CHART_SOURCE_HIGHLIGHT_COLORS[5] ?? "#db2777",
14542
- value: CHART_SOURCE_HIGHLIGHT_COLORS[4] ?? "#ea580c"
14938
+ bubble: "#258447",
14939
+ category: "#8157b6",
14940
+ name: "#c53645",
14941
+ value: "#326bc7"
14543
14942
  };
14943
+ var CHART_SELECTION_STROKE = "#a6a6a6";
14544
14944
  var SHEET_SURFACE = "#ffffff";
14545
14945
  var DRAWING_SELECTION_STROKE = "#64748b";
14546
14946
  var DRAWING_SELECTION_HANDLE_FILL = "#ffffff";
@@ -15302,6 +15702,45 @@ function darkenColor(color, ratio) {
15302
15702
  }
15303
15703
  var ViewerContext = X(null);
15304
15704
  var ViewerAppearanceContext = X({ isDark: false });
15705
+ function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
15706
+ return /* @__PURE__ */ u(S, { children: [top && "top", bottom && "bottom"].flatMap((vertical) => vertical ? [left && "left", right && "right"].map((horizontal) => horizontal ? /* @__PURE__ */ u("span", { style: {
15707
+ position: "absolute",
15708
+ [vertical]: -4,
15709
+ [horizontal]: -4,
15710
+ width: 6,
15711
+ height: 6,
15712
+ backgroundColor: color,
15713
+ border: "1px solid white"
15714
+ } }, `${vertical}-${horizontal}`) : null) : []) });
15715
+ }
15716
+ function ReferenceRangeOutline({
15717
+ rect,
15718
+ color,
15719
+ fillColor,
15720
+ zIndex,
15721
+ formula,
15722
+ chartSourceIndex
15723
+ }) {
15724
+ return /* @__PURE__ */ u(
15725
+ "div",
15726
+ {
15727
+ "aria-hidden": "true",
15728
+ "data-xlsx-formula-reference": formula,
15729
+ "data-xlsx-chart-source-range": chartSourceIndex,
15730
+ style: {
15731
+ ...rect,
15732
+ position: "absolute",
15733
+ pointerEvents: "none",
15734
+ boxSizing: "border-box",
15735
+ border: `2px solid ${color}`,
15736
+ borderRadius: 0,
15737
+ backgroundColor: fillColor,
15738
+ zIndex
15739
+ },
15740
+ children: /* @__PURE__ */ u(ReferenceRangeHandles, { color })
15741
+ }
15742
+ );
15743
+ }
15305
15744
  function classNames(...values) {
15306
15745
  return values.filter(Boolean).join(" ");
15307
15746
  }
@@ -17299,22 +17738,6 @@ function resolveChartFormulaRange(formula, fallbackSheetIndex, sheets, workbook)
17299
17738
  workbookSheetIndex
17300
17739
  };
17301
17740
  }
17302
- function resolveRangePointCell(range, pointIndex) {
17303
- const normalized = normalizeRange2(range);
17304
- const rowCount = normalized.end.row - normalized.start.row + 1;
17305
- const colCount = normalized.end.col - normalized.start.col + 1;
17306
- const cellCount = rowCount * colCount;
17307
- if (pointIndex < 0 || pointIndex >= cellCount) {
17308
- return null;
17309
- }
17310
- const rowOffset = Math.floor(pointIndex / colCount);
17311
- const colOffset = pointIndex % colCount;
17312
- const cell = {
17313
- col: normalized.start.col + colOffset,
17314
- row: normalized.start.row + rowOffset
17315
- };
17316
- return { start: cell, end: cell };
17317
- }
17318
17741
  function collectChartRangeHighlights(chart, selectedElement, sheets, workbook, isDark) {
17319
17742
  if (!chart) {
17320
17743
  return [];
@@ -17366,34 +17789,12 @@ function collectChartRangeHighlights(chart, selectedElement, sheets, workbook, i
17366
17789
  seenRanges.add(key);
17367
17790
  const strokeColor = CHART_SOURCE_HIGHLIGHT_COLOR_BY_ROLE[reference.role];
17368
17791
  highlights.push({
17369
- fillColor: applyAlphaToColor(strokeColor, isDark ? 0.24 : 0.14),
17792
+ fillColor: applyAlphaToColor(strokeColor, isDark ? 0.2 : 0.1),
17370
17793
  range: resolved.range,
17371
17794
  strokeColor,
17372
17795
  workbookSheetIndex: resolved.workbookSheetIndex
17373
17796
  });
17374
17797
  });
17375
- if (selectedElement?.chartId === chart.id && selectedElement.kind === "point") {
17376
- references.forEach((reference) => {
17377
- if (!reference.formula || reference.role === "name") {
17378
- return;
17379
- }
17380
- const resolved = resolveChartFormulaRange(reference.formula, chart.workbookSheetIndex, sheets, workbook);
17381
- if (!resolved) {
17382
- return;
17383
- }
17384
- const range = resolveRangePointCell(resolved.range, selectedElement.pointIndex);
17385
- if (!range) {
17386
- return;
17387
- }
17388
- const strokeColor = CHART_SOURCE_HIGHLIGHT_COLOR_BY_ROLE.point;
17389
- highlights.push({
17390
- fillColor: applyAlphaToColor(strokeColor, isDark ? 0.34 : 0.22),
17391
- range,
17392
- strokeColor,
17393
- workbookSheetIndex: resolved.workbookSheetIndex
17394
- });
17395
- });
17396
- }
17397
17798
  return highlights;
17398
17799
  }
17399
17800
  function clampSparklineValue(value, min, max) {
@@ -17930,6 +18331,41 @@ function resolveTableHeaderTriggerStyle(palette, zoomFactor) {
17930
18331
  zIndex: 6
17931
18332
  };
17932
18333
  }
18334
+ function drawCanvasTableHeaderTrigger(context, rect, direction, palette, zoomFactor) {
18335
+ const size = 16 * zoomFactor;
18336
+ const left = rect.left + Math.max(0, rect.width - size - zoomFactor);
18337
+ const top = rect.top + Math.max(0, rect.height - size - zoomFactor);
18338
+ context.save();
18339
+ context.beginPath();
18340
+ context.rect(rect.left, rect.top, rect.width, rect.height);
18341
+ context.clip();
18342
+ context.translate(left, top);
18343
+ context.scale(zoomFactor, zoomFactor);
18344
+ context.fillStyle = paletteIsDark(palette) ? palette.headerSurface : "#f8fafb";
18345
+ context.fillRect(0, 0, 16, 16);
18346
+ context.strokeStyle = paletteIsDark(palette) ? palette.mutedText : "#969c9e";
18347
+ context.lineWidth = 1;
18348
+ context.strokeRect(0.5, 0.5, 15, 15);
18349
+ context.fillStyle = paletteIsDark(palette) ? palette.headerText : "#667174";
18350
+ const triangleX = direction ? 2 : 4;
18351
+ const triangleY = direction ? 10 : 6;
18352
+ context.beginPath();
18353
+ context.moveTo(triangleX, triangleY);
18354
+ context.lineTo(triangleX + (direction ? 5 : 8), triangleY);
18355
+ context.lineTo(triangleX + (direction ? 2.5 : 4), triangleY + (direction ? 3 : 4));
18356
+ context.fill();
18357
+ if (direction) {
18358
+ const headY = direction === "ascending" ? 3 : 13;
18359
+ const shoulderY = direction === "ascending" ? 6 : 10;
18360
+ context.fillRect(10, 5, 2, 6);
18361
+ context.beginPath();
18362
+ context.moveTo(11, headY);
18363
+ context.lineTo(7.5, shoulderY);
18364
+ context.lineTo(14.5, shoulderY);
18365
+ context.fill();
18366
+ }
18367
+ context.restore();
18368
+ }
17933
18369
  function SegmentedControl({
17934
18370
  items,
17935
18371
  onValueChange,
@@ -19211,6 +19647,8 @@ function GridRow({
19211
19647
  actualRow,
19212
19648
  editingCell,
19213
19649
  editingValue,
19650
+ formulaReferences,
19651
+ editorBoxShadow,
19214
19652
  frozenRowHeaderZIndex,
19215
19653
  getCellData,
19216
19654
  headerLabelLiveScale,
@@ -19363,6 +19801,9 @@ function GridRow({
19363
19801
  }
19364
19802
  if (isEditing) {
19365
19803
  cellStyle.padding = 0;
19804
+ cellStyle.position = stickyTop !== void 0 || stickyLeft !== void 0 ? "sticky" : "relative";
19805
+ cellStyle.overflow = "visible";
19806
+ cellStyle.zIndex = 42;
19366
19807
  }
19367
19808
  const cellContentStyle = {
19368
19809
  alignItems: "stretch",
@@ -19461,15 +19902,25 @@ function GridRow({
19461
19902
  "aria-hidden": "true",
19462
19903
  style: {
19463
19904
  backgroundColor: cellData.chartHighlight.fillColor,
19464
- borderBottom: cellData.chartHighlight.borderBottom ? `${Math.max(1, zoomFactor)}px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19465
- borderLeft: cellData.chartHighlight.borderLeft ? `${Math.max(1, zoomFactor)}px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19466
- borderRight: cellData.chartHighlight.borderRight ? `${Math.max(1, zoomFactor)}px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19467
- borderTop: cellData.chartHighlight.borderTop ? `${Math.max(1, zoomFactor)}px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19905
+ borderBottom: cellData.chartHighlight.borderBottom ? `2px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19906
+ borderLeft: cellData.chartHighlight.borderLeft ? `2px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19907
+ borderRight: cellData.chartHighlight.borderRight ? `2px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19908
+ borderTop: cellData.chartHighlight.borderTop ? `2px solid ${cellData.chartHighlight.strokeColor}` : void 0,
19468
19909
  boxSizing: "border-box",
19469
- inset: Math.max(1, zoomFactor * 0.5),
19910
+ inset: 0,
19470
19911
  pointerEvents: "none",
19471
19912
  position: "absolute"
19472
- }
19913
+ },
19914
+ children: /* @__PURE__ */ u(
19915
+ ReferenceRangeHandles,
19916
+ {
19917
+ color: cellData.chartHighlight.strokeColor,
19918
+ top: cellData.chartHighlight.borderTop,
19919
+ bottom: cellData.chartHighlight.borderBottom,
19920
+ left: cellData.chartHighlight.borderLeft,
19921
+ right: cellData.chartHighlight.borderRight
19922
+ }
19923
+ )
19473
19924
  }
19474
19925
  ) : null,
19475
19926
  cellData.conditionalDataBar ? /* @__PURE__ */ u(
@@ -19521,41 +19972,34 @@ function GridRow({
19521
19972
  children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
19522
19973
  }
19523
19974
  ) : null,
19975
+ isSpilling && !isEditing ? /* @__PURE__ */ u("div", { "aria-hidden": "true", style: {
19976
+ backgroundColor: cellStyle.backgroundColor ?? palette.surface,
19977
+ position: "absolute",
19978
+ left: cellData.spillSide === "left" ? cellData.spillOffsetX : "calc(100% - 1px)",
19979
+ top: 0,
19980
+ width: cellData.spillSide === "left" ? -(cellData.spillOffsetX ?? 0) + 1 : `calc(${(cellData.spillWidth ?? 0) + getHorizontalPadding(cellStyle.padding) + 1}px - 100%)`,
19981
+ height: "calc(100% - 1px)",
19982
+ pointerEvents: "none"
19983
+ } }) : null,
19524
19984
  isEditing ? /* @__PURE__ */ u(
19525
- "input",
19985
+ CellEditor,
19526
19986
  {
19527
- autoFocus: true,
19987
+ value: editingValue,
19988
+ references: formulaReferences,
19528
19989
  onBlur: onEditingBlur,
19529
- onChange: (event) => onEditingValueChange(event.target.value),
19530
- onKeyDown: (event) => {
19531
- event.stopPropagation();
19532
- if (event.key === "Enter") {
19533
- event.preventDefault();
19534
- onEditingCommit();
19535
- return;
19536
- }
19537
- if (event.key === "Escape") {
19538
- event.preventDefault();
19539
- onEditingCancel();
19540
- return;
19541
- }
19542
- if (event.key === "ArrowDown" || event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "ArrowUp") {
19543
- event.preventDefault();
19544
- onEditingNavigate(event.key, event.currentTarget.value);
19545
- }
19546
- },
19990
+ onChange: onEditingValueChange,
19991
+ onCommit: onEditingCommit,
19992
+ onCancel: onEditingCancel,
19993
+ onNavigate: onEditingNavigate,
19547
19994
  style: {
19548
- backgroundColor: "transparent",
19549
- border: 0,
19550
- color: "inherit",
19995
+ backgroundColor: cellStyle.backgroundColor ?? palette.surface,
19996
+ boxShadow: editorBoxShadow,
19997
+ color: cellStyle.color ?? palette.text,
19551
19998
  font: "inherit",
19552
- height: "100%",
19553
- margin: 0,
19554
- outline: "none",
19555
- padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
19556
- width: "100%"
19557
- },
19558
- value: editingValue
19999
+ lineHeight: cellData.style.lineHeight,
20000
+ verticalAlign: cellData.style.verticalAlign,
20001
+ padding: cellData.style.padding
20002
+ }
19559
20003
  }
19560
20004
  ) : isSpilling ? /* @__PURE__ */ u(
19561
20005
  "div",
@@ -19626,7 +20070,7 @@ var MemoGridRow = N(GridRow, (prev, next) => {
19626
20070
  if (prevEditingCol !== nextEditingCol) {
19627
20071
  return false;
19628
20072
  }
19629
- if (prevEditingCol !== -1 && prev.editingValue !== next.editingValue) {
20073
+ if (prevEditingCol !== -1 && (prev.editingValue !== next.editingValue || prev.formulaReferences !== next.formulaReferences || prev.editorBoxShadow !== next.editorBoxShadow)) {
19630
20074
  return false;
19631
20075
  }
19632
20076
  return true;
@@ -19688,6 +20132,7 @@ function XlsxGrid({
19688
20132
  getRowsBatchAsync,
19689
20133
  getClipboardData,
19690
20134
  getCellDisplayValue: getControllerCellDisplayValue,
20135
+ getCellFormula,
19691
20136
  locale,
19692
20137
  getFormControlItems,
19693
20138
  highlightedRanges,
@@ -19721,6 +20166,7 @@ function XlsxGrid({
19721
20166
  setChartRect,
19722
20167
  setImageRect,
19723
20168
  setCellValue,
20169
+ setCellFormula,
19724
20170
  setZoomScale,
19725
20171
  sheets,
19726
20172
  tabs,
@@ -19800,6 +20246,7 @@ function XlsxGrid({
19800
20246
  const selectionCommitFrameRef = A(null);
19801
20247
  const selectionRef = A(null);
19802
20248
  const editingCellRef = A(null);
20249
+ const editingOriginalValueRef = A(null);
19803
20250
  const commitEditingRef = A(() => {
19804
20251
  });
19805
20252
  const editingInputRef = A(null);
@@ -19844,6 +20291,13 @@ function XlsxGrid({
19844
20291
  const chartInteractionRef = A(null);
19845
20292
  const [editingCell, setEditingCell] = d(null);
19846
20293
  const [editingValue, setEditingValue] = d("");
20294
+ const formulaReferences = T(
20295
+ () => {
20296
+ const worksheet2 = getActiveWorksheet();
20297
+ return editingCell && worksheet2 && !isTextCell(worksheet2, editingCell) ? getFormulaReferences(editingValue, activeSheet?.name ?? "") : [];
20298
+ },
20299
+ [activeSheet?.name, editingCell, editingValue, getActiveWorksheet]
20300
+ );
19847
20301
  const [openTableMenu, setOpenTableMenu] = d(null);
19848
20302
  const [fillPreviewRange, setFillPreviewRange] = d(null);
19849
20303
  const [chartPreviewRect, setChartPreviewRect] = d(null);
@@ -20396,7 +20850,9 @@ function XlsxGrid({
20396
20850
  if (hiddenColSet.has(index)) return 0;
20397
20851
  const original = office.columns[index];
20398
20852
  const override = activeSheet?.colWidthOverridesPx[index];
20399
- return override !== void 0 && override !== original?.sourcePx ? override : original?.sizePx ?? office.defaultColumnPx;
20853
+ if (override !== void 0 && override !== original?.sourcePx) return override;
20854
+ const width = worksheet?.getColumnWidth(index);
20855
+ return width !== void 0 && width !== null ? resolveOfficeColumnWidthPixels(width, office.columnDigitWidthPt) : original?.sizePx ?? office.defaultColumnPx;
20400
20856
  });
20401
20857
  }
20402
20858
  const widths = new Array(displayColLimit).fill(0);
@@ -20475,7 +20931,9 @@ function XlsxGrid({
20475
20931
  if (hiddenRowSet.has(index)) return 0;
20476
20932
  const original = office.rows[index];
20477
20933
  const override = activeSheet?.rowHeightOverridesPx[index];
20478
- return override !== void 0 && override !== original?.sourcePx ? override : original?.sizePx ?? office.defaultRowPx;
20934
+ if (override !== void 0 && override !== original?.sourcePx) return override;
20935
+ const height = worksheet?.getRowHeight(index);
20936
+ return height !== void 0 && height !== null ? Math.max(0, height * (4 / 3)) : original?.sizePx ?? office.defaultRowPx;
20479
20937
  });
20480
20938
  }
20481
20939
  const heights = new Array(displayRowLimit).fill(0);
@@ -21117,7 +21575,7 @@ function XlsxGrid({
21117
21575
  }, [activeTabIndex, clearLiveGestureZoom]);
21118
21576
  h(() => {
21119
21577
  setOpenTableMenu(null);
21120
- }, [activeSheet, activeSheetIndex]);
21578
+ }, [activeSheetIndex, workbook]);
21121
21579
  h(() => {
21122
21580
  if (!pendingNavigation || pendingNavigation.sheetIndex !== activeSheetIndex) {
21123
21581
  return;
@@ -21660,13 +22118,28 @@ function XlsxGrid({
21660
22118
  return;
21661
22119
  }
21662
22120
  selectCell(cell);
22121
+ editingCellRef.current = cell;
21663
22122
  setEditingCell(cell);
21664
- setEditingValue(initialValue ?? getControllerCellDisplayValue(cell));
22123
+ const formula = getCellFormula(cell);
22124
+ const worksheet2 = getActiveWorksheet();
22125
+ const value = formula ? formula.startsWith("=") ? formula : `=${formula}` : worksheet2 ? getCellEditingValue(worksheet2, cell, locale) : getControllerCellDisplayValue(cell);
22126
+ editingOriginalValueRef.current = initialValue === void 0 ? value : null;
22127
+ setEditingValue(initialValue ?? value);
21665
22128
  },
21666
- [getControllerCellDisplayValue, readOnly, selectCell]
22129
+ [getActiveWorksheet, getCellFormula, getControllerCellDisplayValue, locale, readOnly, selectCell]
21667
22130
  );
22131
+ const saveEditingValue = q((cell, value) => {
22132
+ if (value === editingOriginalValueRef.current) return;
22133
+ const worksheet2 = getActiveWorksheet();
22134
+ const formula = worksheet2 && !isTextCell(worksheet2, cell) ? getUserEnteredFormula(value, locale) : null;
22135
+ if (formula) {
22136
+ setCellFormula(cell, formula);
22137
+ } else {
22138
+ setCellValue(cell, value);
22139
+ }
22140
+ }, [getActiveWorksheet, locale, setCellFormula, setCellValue]);
21668
22141
  const commitEditing = q(() => {
21669
- if (!editingCell) {
22142
+ if (!editingCell || !editingCellRef.current) {
21670
22143
  return;
21671
22144
  }
21672
22145
  if (readOnly) {
@@ -21676,12 +22149,12 @@ function XlsxGrid({
21676
22149
  focusGrid();
21677
22150
  return;
21678
22151
  }
21679
- setCellValue(editingCell, editingValue);
22152
+ saveEditingValue(editingCell, editingValue);
21680
22153
  editingCellRef.current = null;
21681
22154
  setEditingCell(null);
21682
22155
  setEditingValue("");
21683
22156
  focusGrid();
21684
- }, [editingCell, editingValue, focusGrid, readOnly, setCellValue]);
22157
+ }, [editingCell, editingValue, focusGrid, readOnly, saveEditingValue]);
21685
22158
  const cancelEditing = q(() => {
21686
22159
  editingCellRef.current = null;
21687
22160
  setEditingCell(null);
@@ -21703,7 +22176,7 @@ function XlsxGrid({
21703
22176
  const currentColIndex = colIndexByActual.get(cell.col);
21704
22177
  if (currentRowIndex === void 0 || currentColIndex === void 0) {
21705
22178
  if (!readOnlyRef.current) {
21706
- setCellValue(cell, value);
22179
+ saveEditingValue(cell, value);
21707
22180
  }
21708
22181
  editingCellRef.current = null;
21709
22182
  setEditingCell(null);
@@ -21730,14 +22203,14 @@ function XlsxGrid({
21730
22203
  return;
21731
22204
  }
21732
22205
  if (!readOnlyRef.current) {
21733
- setCellValue(cell, value);
22206
+ saveEditingValue(cell, value);
21734
22207
  }
21735
22208
  editingCellRef.current = null;
21736
22209
  setEditingCell(null);
21737
22210
  setEditingValue("");
21738
22211
  moveSelection(nextRowIndex, nextColIndex, false);
21739
22212
  focusGrid();
21740
- }, [colIndexByActual, focusGrid, rowIndexByActual, setCellValue, visibleCols, visibleRows]);
22213
+ }, [colIndexByActual, focusGrid, rowIndexByActual, saveEditingValue, visibleCols, visibleRows]);
21741
22214
  h(() => {
21742
22215
  commitEditingRef.current = commitEditing;
21743
22216
  }, [commitEditing]);
@@ -22058,6 +22531,7 @@ function XlsxGrid({
22058
22531
  generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row, col) : batchedCell?.generalAlignment,
22059
22532
  showGridLines: activeSheet?.showGridLines
22060
22533
  }), zoomFactor),
22534
+ usesGeneralAlignment: !alignment?.horizontal || alignment.horizontal === "general",
22061
22535
  textRotationDeg,
22062
22536
  validation: resolveCellDataValidation(row, col, activeSheet),
22063
22537
  value: sparkline ? "" : checkboxState !== null ? "" : readDisplayValue()
@@ -22080,6 +22554,7 @@ function XlsxGrid({
22080
22554
  });
22081
22555
  if (styleOverrides) {
22082
22556
  nextData.style = { ...nextData.style, ...styleOverrides };
22557
+ if (styleOverrides.textAlign !== void 0) nextData.usesGeneralAlignment = false;
22083
22558
  if (nextData.conditionalColorScale && (styleOverrides.backgroundColor !== void 0 || styleOverrides.background !== void 0)) {
22084
22559
  nextData.conditionalColorScale = null;
22085
22560
  }
@@ -23557,6 +24032,9 @@ function XlsxGrid({
23557
24032
  return /* @__PURE__ */ u(
23558
24033
  "button",
23559
24034
  {
24035
+ "aria-haspopup": "menu",
24036
+ "aria-label": `Open menu for ${tableColumn.name}`,
24037
+ "aria-expanded": openTableMenu?.tableName === table.name && openTableMenu.col === cell.col && openTableMenu.row === cell.row,
23560
24038
  onPointerDown: (event) => {
23561
24039
  event.preventDefault();
23562
24040
  event.stopPropagation();
@@ -23569,13 +24047,14 @@ function XlsxGrid({
23569
24047
  );
23570
24048
  },
23571
24049
  style: {
23572
- ...resolveTableHeaderTriggerStyle(palette, zoomFactor)
24050
+ ...resolveTableHeaderTriggerStyle(palette, zoomFactor),
24051
+ ...experimentalCanvas ? { bottom: zoomFactor, right: zoomFactor, top: void 0, maxHeight: "100%", maxWidth: "100%" } : {}
23573
24052
  },
23574
24053
  type: "button",
23575
- children: triggerIcon
24054
+ children: experimentalCanvas ? null : triggerIcon
23576
24055
  }
23577
24056
  );
23578
- }, [effectiveTables, palette, renderTableHeaderMenu, sortState, sortTable, zoomFactor]);
24057
+ }, [effectiveTables, experimentalCanvas, openTableMenu, palette, renderTableHeaderMenu, sortState, sortTable, zoomFactor]);
23579
24058
  const resolveCanvasColumnHeaderRect = q((actualCol) => {
23580
24059
  const colIndex = colIndexByActual.get(actualCol);
23581
24060
  if (colIndex === void 0) {
@@ -23769,6 +24248,27 @@ function XlsxGrid({
23769
24248
  }
23770
24249
  event.preventDefault();
23771
24250
  focusGrid();
24251
+ if (!renderTableHeaderMenu) {
24252
+ const table = getTableAtCell(effectiveTables, cell.row, cell.col);
24253
+ const column = getTableHeaderColumn(table, cell.row, cell.col);
24254
+ const columnRect = resolveCanvasColumnHeaderRect(cell.col);
24255
+ const rowRect = resolveCanvasRowHeaderRect(cell.row);
24256
+ const viewportRect = scrollRef.current?.getBoundingClientRect();
24257
+ if (table && column && columnRect && rowRect && viewportRect) {
24258
+ const right = viewportRect.left + columnRect.left + columnRect.width - zoomFactor;
24259
+ const bottom = viewportRect.top + rowRect.top + rowRect.height - zoomFactor;
24260
+ if (event.clientX >= right - 16 * zoomFactor && event.clientX <= right && event.clientY >= bottom - 16 * zoomFactor && event.clientY <= bottom) {
24261
+ event.stopPropagation();
24262
+ axisSelectionRef.current = null;
24263
+ if (editingCellRef.current) {
24264
+ commitEditingRef.current();
24265
+ }
24266
+ commitSelectionRange({ start: cell, end: cell });
24267
+ setOpenTableMenu({ col: cell.col, row: cell.row, tableName: table.name });
24268
+ return;
24269
+ }
24270
+ }
24271
+ }
23772
24272
  axisSelectionRef.current = null;
23773
24273
  const currentSelection = selectionRef.current;
23774
24274
  const anchor = event.shiftKey && currentSelection ? currentSelection.start : cell;
@@ -23810,13 +24310,18 @@ function XlsxGrid({
23810
24310
  colIndexByActual,
23811
24311
  colPrefixSums,
23812
24312
  commitSelectionRange,
24313
+ effectiveTables,
23813
24314
  focusGrid,
24315
+ renderTableHeaderMenu,
24316
+ resolveCanvasColumnHeaderRect,
24317
+ resolveCanvasRowHeaderRect,
23814
24318
  resolveOverlayRect,
23815
24319
  resolveCellSelectionRange,
23816
24320
  resolvePointerCellFromClient,
23817
24321
  rowIndexByActual,
23818
24322
  rowPrefixSums,
23819
- startCellSelection
24323
+ startCellSelection,
24324
+ zoomFactor
23820
24325
  ]);
23821
24326
  const handleCanvasBodyClick = q((event) => {
23822
24327
  const cell = resolvePointerCellFromClient(event.clientX, event.clientY);
@@ -24040,6 +24545,7 @@ function XlsxGrid({
24040
24545
  palette,
24041
24546
  rowHeaderWidth,
24042
24547
  rowSignature: buildRenderedAxisSignature(canvasVisibleRowItems, (item) => item.index),
24548
+ tableHeaderSignature: `${sortState ? `${sortState.tableName}:${sortState.columnIndex}:${sortState.direction}` : ""}|${renderTableHeaderMenu && activeCell ? `${activeCell.row}:${activeCell.col}` : ""}`,
24043
24549
  viewportLeft: drawingViewport.left,
24044
24550
  viewportTop: drawingViewport.top,
24045
24551
  zoomFactor
@@ -24061,10 +24567,10 @@ function XlsxGrid({
24061
24567
  const previousBodyCanvasSignature = paintedBodyCanvasSignatureRef.current;
24062
24568
  const previousHeaderCanvasSignature = paintedHeaderCanvasSignatureRef.current;
24063
24569
  const previousPaintedViewport = paintedDrawingViewportRef.current;
24064
- const shouldRepaintBody = !(previousBodyCanvasSignature && previousBodyCanvasSignature.activeSheet === nextBodyCanvasSignature.activeSheet && previousBodyCanvasSignature.bakedDrawingSignature === nextBodyCanvasSignature.bakedDrawingSignature && previousBodyCanvasSignature.bodyHeight === nextBodyCanvasSignature.bodyHeight && previousBodyCanvasSignature.bodyWidth === nextBodyCanvasSignature.bodyWidth && previousBodyCanvasSignature.colSignature === nextBodyCanvasSignature.colSignature && previousBodyCanvasSignature.getCellData === nextBodyCanvasSignature.getCellData && previousBodyCanvasSignature.headerHeight === nextBodyCanvasSignature.headerHeight && previousBodyCanvasSignature.palette === nextBodyCanvasSignature.palette && previousBodyCanvasSignature.rowHeaderWidth === nextBodyCanvasSignature.rowHeaderWidth && previousBodyCanvasSignature.rowSignature === nextBodyCanvasSignature.rowSignature && previousBodyCanvasSignature.viewportLeft === nextBodyCanvasSignature.viewportLeft && previousBodyCanvasSignature.viewportTop === nextBodyCanvasSignature.viewportTop && previousBodyCanvasSignature.zoomFactor === nextBodyCanvasSignature.zoomFactor);
24570
+ const shouldRepaintBody = !(previousBodyCanvasSignature && previousBodyCanvasSignature.activeSheet === nextBodyCanvasSignature.activeSheet && previousBodyCanvasSignature.bakedDrawingSignature === nextBodyCanvasSignature.bakedDrawingSignature && previousBodyCanvasSignature.bodyHeight === nextBodyCanvasSignature.bodyHeight && previousBodyCanvasSignature.bodyWidth === nextBodyCanvasSignature.bodyWidth && previousBodyCanvasSignature.colSignature === nextBodyCanvasSignature.colSignature && previousBodyCanvasSignature.getCellData === nextBodyCanvasSignature.getCellData && previousBodyCanvasSignature.headerHeight === nextBodyCanvasSignature.headerHeight && previousBodyCanvasSignature.palette === nextBodyCanvasSignature.palette && previousBodyCanvasSignature.rowHeaderWidth === nextBodyCanvasSignature.rowHeaderWidth && previousBodyCanvasSignature.rowSignature === nextBodyCanvasSignature.rowSignature && previousBodyCanvasSignature.tableHeaderSignature === nextBodyCanvasSignature.tableHeaderSignature && previousBodyCanvasSignature.viewportLeft === nextBodyCanvasSignature.viewportLeft && previousBodyCanvasSignature.viewportTop === nextBodyCanvasSignature.viewportTop && previousBodyCanvasSignature.zoomFactor === nextBodyCanvasSignature.zoomFactor);
24065
24571
  const shouldRepaintHeaders = !(previousHeaderCanvasSignature && previousHeaderCanvasSignature.activeSheet === nextHeaderCanvasSignature.activeSheet && previousHeaderCanvasSignature.bodyHeight === nextHeaderCanvasSignature.bodyHeight && previousHeaderCanvasSignature.bodyWidth === nextHeaderCanvasSignature.bodyWidth && previousHeaderCanvasSignature.colSignature === nextHeaderCanvasSignature.colSignature && previousHeaderCanvasSignature.headerHeight === nextHeaderCanvasSignature.headerHeight && previousHeaderCanvasSignature.palette === nextHeaderCanvasSignature.palette && previousHeaderCanvasSignature.rangeSignature === nextHeaderCanvasSignature.rangeSignature && previousHeaderCanvasSignature.rowHeaderWidth === nextHeaderCanvasSignature.rowHeaderWidth && previousHeaderCanvasSignature.rowSignature === nextHeaderCanvasSignature.rowSignature && previousHeaderCanvasSignature.viewportLeft === nextHeaderCanvasSignature.viewportLeft && previousHeaderCanvasSignature.viewportTop === nextHeaderCanvasSignature.viewportTop && previousHeaderCanvasSignature.zoomFactor === nextHeaderCanvasSignature.zoomFactor);
24066
24572
  const canBlitBody = Boolean(
24067
- shouldRepaintBody && previousBodyCanvasSignature && previousBodyCanvasSignature.activeSheet === nextBodyCanvasSignature.activeSheet && previousBodyCanvasSignature.bakedDrawingSignature === nextBodyCanvasSignature.bakedDrawingSignature && previousBodyCanvasSignature.bodyHeight === nextBodyCanvasSignature.bodyHeight && previousBodyCanvasSignature.bodyWidth === nextBodyCanvasSignature.bodyWidth && previousBodyCanvasSignature.getCellData === nextBodyCanvasSignature.getCellData && previousBodyCanvasSignature.headerHeight === nextBodyCanvasSignature.headerHeight && previousBodyCanvasSignature.palette === nextBodyCanvasSignature.palette && previousBodyCanvasSignature.rowHeaderWidth === nextBodyCanvasSignature.rowHeaderWidth && previousBodyCanvasSignature.zoomFactor === nextBodyCanvasSignature.zoomFactor
24573
+ shouldRepaintBody && previousBodyCanvasSignature && previousBodyCanvasSignature.activeSheet === nextBodyCanvasSignature.activeSheet && previousBodyCanvasSignature.bakedDrawingSignature === nextBodyCanvasSignature.bakedDrawingSignature && previousBodyCanvasSignature.bodyHeight === nextBodyCanvasSignature.bodyHeight && previousBodyCanvasSignature.bodyWidth === nextBodyCanvasSignature.bodyWidth && previousBodyCanvasSignature.getCellData === nextBodyCanvasSignature.getCellData && previousBodyCanvasSignature.headerHeight === nextBodyCanvasSignature.headerHeight && previousBodyCanvasSignature.palette === nextBodyCanvasSignature.palette && previousBodyCanvasSignature.rowHeaderWidth === nextBodyCanvasSignature.rowHeaderWidth && previousBodyCanvasSignature.zoomFactor === nextBodyCanvasSignature.zoomFactor && previousBodyCanvasSignature.tableHeaderSignature === nextBodyCanvasSignature.tableHeaderSignature
24068
24574
  );
24069
24575
  const canBlitTopHeader = Boolean(
24070
24576
  shouldRepaintHeaders && previousHeaderCanvasSignature && previousHeaderCanvasSignature.activeSheet === nextHeaderCanvasSignature.activeSheet && previousHeaderCanvasSignature.bodyHeight === nextHeaderCanvasSignature.bodyHeight && previousHeaderCanvasSignature.bodyWidth === nextHeaderCanvasSignature.bodyWidth && previousHeaderCanvasSignature.headerHeight === nextHeaderCanvasSignature.headerHeight && previousHeaderCanvasSignature.palette === nextHeaderCanvasSignature.palette && previousHeaderCanvasSignature.rangeSignature === nextHeaderCanvasSignature.rangeSignature && previousHeaderCanvasSignature.rowHeaderWidth === nextHeaderCanvasSignature.rowHeaderWidth && previousHeaderCanvasSignature.zoomFactor === nextHeaderCanvasSignature.zoomFactor
@@ -24308,7 +24814,7 @@ function XlsxGrid({
24308
24814
  return;
24309
24815
  }
24310
24816
  for (const entry of bakedCanvasDrawingEntries) {
24311
- if (resolveDrawingPane(entry.rect) !== pane) {
24817
+ if (!drawingIntersectsPane(entry.rect, pane)) {
24312
24818
  continue;
24313
24819
  }
24314
24820
  const localRect = resolveBakedCanvasLocalRect(entry.kind === "image" ? resolvePicturePaintRect(entry.image, entry.rect) : entry.rect, pane);
@@ -24472,15 +24978,6 @@ function XlsxGrid({
24472
24978
  }
24473
24979
  paneContext.fillStyle = gradientFill ?? fillColor;
24474
24980
  paneContext.fillRect(localRect.left, localRect.top, localRect.width, localRect.height);
24475
- if (cellData.chartHighlight) {
24476
- paneContext.fillStyle = cellData.chartHighlight.fillColor;
24477
- paneContext.fillRect(
24478
- localRect.left + 1,
24479
- localRect.top + 1,
24480
- Math.max(0, localRect.width - 2),
24481
- Math.max(0, localRect.height - 2)
24482
- );
24483
- }
24484
24981
  if (cellData.conditionalDataBar) {
24485
24982
  const barLeft = localRect.left + 4 * zoomFactor;
24486
24983
  const barTop = localRect.top + 4 * zoomFactor;
@@ -24565,25 +25062,6 @@ function XlsxGrid({
24565
25062
  if (leftBorder && drawColIndex === 0) {
24566
25063
  drawCellBorder("left", localRect, leftBorder);
24567
25064
  }
24568
- if (cellData.chartHighlight) {
24569
- const highlightBorder = {
24570
- color: cellData.chartHighlight.strokeColor,
24571
- style: "solid",
24572
- width: Math.max(1, zoomFactor)
24573
- };
24574
- if (cellData.chartHighlight.borderTop) {
24575
- strokeCanvasBorderSide(paneContext, "top", localRect, highlightBorder);
24576
- }
24577
- if (cellData.chartHighlight.borderRight) {
24578
- strokeCanvasBorderSide(paneContext, "right", localRect, highlightBorder);
24579
- }
24580
- if (cellData.chartHighlight.borderBottom) {
24581
- strokeCanvasBorderSide(paneContext, "bottom", localRect, highlightBorder);
24582
- }
24583
- if (cellData.chartHighlight.borderLeft) {
24584
- strokeCanvasBorderSide(paneContext, "left", localRect, highlightBorder);
24585
- }
24586
- }
24587
25065
  const rawText = cellData.value ?? "";
24588
25066
  const shouldDrawCanvasContent = cellData.checkboxState != null || cellData.sparkline || rawText.length > 0 || cellData.conditionalIcon || cellData.isTableHeader;
24589
25067
  if (!shouldDrawCanvasContent) {
@@ -24785,6 +25263,13 @@ function XlsxGrid({
24785
25263
  const spillClipLeft = cellData.spillSide === "left" ? contentLeft + contentWidth - spillMaxWidth - textClipOverscan : contentLeft - textClipOverscan;
24786
25264
  deferredSpillTextsByPane[pane].push({
24787
25265
  align,
25266
+ background: {
25267
+ color: typeof cellStyle.backgroundColor === "string" ? cellStyle.backgroundColor : sheetSurface,
25268
+ left: cellData.spillSide === "left" ? localRect.left + (cellData.spillOffsetX ?? 0) : localRect.left + localRect.width - 1,
25269
+ top: localRect.top,
25270
+ width: cellData.spillSide === "left" ? -(cellData.spillOffsetX ?? 0) + 1 : Math.max(0, spillMaxWidth + padding.left + padding.right - localRect.width + 1),
25271
+ height: Math.max(0, localRect.height - 1)
25272
+ },
24788
25273
  clipHeight: contentHeight + textClipOverscan * 2,
24789
25274
  clipLeft: spillClipLeft,
24790
25275
  clipTop: contentTop - textClipOverscan,
@@ -24824,12 +25309,13 @@ function XlsxGrid({
24824
25309
  const iconY = localRect.top + localRect.height / 2;
24825
25310
  drawCanvasConditionalIcon(paneContext, cellData.conditionalIcon, iconX + iconSize / 2, iconY, iconSize);
24826
25311
  }
24827
- if (cellData.isTableHeader) {
24828
- paneContext.fillStyle = palette.mutedText;
24829
- paneContext.textAlign = "center";
24830
- paneContext.fillText("\u25BE", localRect.left + localRect.width - 10 * zoomFactor, localRect.top + localRect.height / 2);
24831
- }
24832
25312
  paneContext.restore();
25313
+ if (cellData.isTableHeader && !(renderTableHeaderMenu && isSameCell(activeCell, drawCell))) {
25314
+ const table = getTableAtCell(effectiveTables, drawCell.row, drawCell.col);
25315
+ const column = getTableHeaderColumn(table, drawCell.row, drawCell.col);
25316
+ const direction = table && column && sortState?.tableName === table.name && sortState.columnIndex === column.index ? sortState.direction : null;
25317
+ drawCanvasTableHeaderTrigger(paneContext, localRect, direction, palette, zoomFactor);
25318
+ }
24833
25319
  }
24834
25320
  }
24835
25321
  flushPendingGridlines();
@@ -24844,6 +25330,9 @@ function XlsxGrid({
24844
25330
  }
24845
25331
  for (const spillText of deferredSpillTextsByPane[pane]) {
24846
25332
  paneContext.save();
25333
+ const background = spillText.background;
25334
+ paneContext.fillStyle = background.color;
25335
+ paneContext.fillRect(background.left, background.top, background.width, background.height);
24847
25336
  paneContext.beginPath();
24848
25337
  paneContext.rect(spillText.clipLeft, spillText.clipTop, spillText.clipWidth, spillText.clipHeight);
24849
25338
  paneContext.clip();
@@ -25046,6 +25535,7 @@ function XlsxGrid({
25046
25535
  }
25047
25536
  }
25048
25537
  }, [
25538
+ activeCell,
25049
25539
  activeSheet,
25050
25540
  applyCanvasViewportCompensation,
25051
25541
  bakedCanvasDrawingSignature,
@@ -25063,6 +25553,7 @@ function XlsxGrid({
25063
25553
  displayHeaderHeight,
25064
25554
  displayRowHeaderWidth,
25065
25555
  displayedSelection,
25556
+ effectiveTables,
25066
25557
  drawingViewport.left,
25067
25558
  drawingViewport.top,
25068
25559
  drawingViewport.height,
@@ -25075,11 +25566,13 @@ function XlsxGrid({
25075
25566
  getBodyBlitBufferCanvas,
25076
25567
  getHeaderBlitBufferCanvas,
25077
25568
  palette,
25569
+ renderTableHeaderMenu,
25078
25570
  resolveCellDisplayRect,
25079
25571
  resolveMergeAnchorCell,
25080
25572
  rowIndexByActual,
25081
25573
  rowPrefixSums,
25082
25574
  selectionHeaderSurface,
25575
+ sortState,
25083
25576
  shouldBakeCanvasStaticDrawings,
25084
25577
  stickyLeftByCol,
25085
25578
  stickyTopByRow,
@@ -25489,7 +25982,16 @@ function XlsxGrid({
25489
25982
  const activeCellOverlayCell = renderActiveCellOverlay && activeCell ? resolveMergeAnchorCell(activeCell) : null;
25490
25983
  const activeCellOverlayRect = activeCellOverlayCell ? resolveCellDisplayRect(activeCellOverlayCell) : null;
25491
25984
  const activeCellOverlay = activeCellOverlayCell && activeCellOverlayRect ? renderActiveCellOverlay?.({ cell: activeCellOverlayCell, rect: activeCellOverlayRect }) : null;
25492
- function resolveDrawingPane(rect) {
25985
+ function drawingIntersectsPane(rect, pane) {
25986
+ if (experimentalCanvas) {
25987
+ const frozenX = pane === "left" || pane === "corner";
25988
+ const frozenY = pane === "top" || pane === "corner";
25989
+ const left = frozenX ? displayRowHeaderWidth : frozenPaneRight;
25990
+ const top = frozenY ? displayHeaderHeight : frozenPaneBottom;
25991
+ const right = frozenX ? frozenPaneRight : Infinity;
25992
+ const bottom = frozenY ? frozenPaneBottom : Infinity;
25993
+ return right > left && bottom > top && rect.left < right && rect.left + rect.width > left && rect.top < bottom && rect.top + rect.height > top;
25994
+ }
25493
25995
  return resolveFrozenDrawingPane(
25494
25996
  rect,
25495
25997
  frozenRows,
@@ -25505,11 +26007,10 @@ function XlsxGrid({
25505
26007
  headerHeight: displayHeaderHeight,
25506
26008
  rowHeaderWidth: displayRowHeaderWidth
25507
26009
  }
25508
- );
26010
+ ) === pane;
25509
26011
  }
25510
26012
  function renderShapeDrawing(shape, rect, pane) {
25511
- const drawingPane = resolveDrawingPane(rect);
25512
- if (drawingPane !== pane) {
26013
+ if (!drawingIntersectsPane(rect, pane)) {
25513
26014
  return null;
25514
26015
  }
25515
26016
  const hasMeasuredViewport = drawingViewport.width > 0 && drawingViewport.height > 0;
@@ -25637,8 +26138,7 @@ function XlsxGrid({
25637
26138
  );
25638
26139
  }
25639
26140
  function renderFormControlDrawing(control, rect, pane) {
25640
- const drawingPane = resolveDrawingPane(rect);
25641
- if (drawingPane !== pane) {
26141
+ if (!drawingIntersectsPane(rect, pane)) {
25642
26142
  return null;
25643
26143
  }
25644
26144
  const hasMeasuredViewport = drawingViewport.width > 0 && drawingViewport.height > 0;
@@ -26052,8 +26552,7 @@ function XlsxGrid({
26052
26552
  );
26053
26553
  }
26054
26554
  function renderImageDrawing(image, rect, pane) {
26055
- const drawingPane = resolveDrawingPane(rect);
26056
- if (drawingPane !== pane) {
26555
+ if (!drawingIntersectsPane(rect, pane)) {
26057
26556
  return null;
26058
26557
  }
26059
26558
  const paintRect = resolvePicturePaintRect(image, rect);
@@ -26182,8 +26681,7 @@ function XlsxGrid({
26182
26681
  ] }, `${pane}-${image.id}`);
26183
26682
  }
26184
26683
  function renderChartDrawing(chart, rect, pane) {
26185
- const drawingPane = resolveDrawingPane(rect);
26186
- if (drawingPane !== pane) {
26684
+ if (!drawingIntersectsPane(rect, pane)) {
26187
26685
  return null;
26188
26686
  }
26189
26687
  const hasMeasuredViewport = drawingViewport.width > 0 && drawingViewport.height > 0;
@@ -26207,6 +26705,7 @@ function XlsxGrid({
26207
26705
  const selectionNode = selectedChartId === chart.id ? /* @__PURE__ */ u(
26208
26706
  "div",
26209
26707
  {
26708
+ "data-xlsx-chart-selection-frame": "",
26210
26709
  style: {
26211
26710
  ...style,
26212
26711
  contain: "layout",
@@ -26218,7 +26717,7 @@ function XlsxGrid({
26218
26717
  "div",
26219
26718
  {
26220
26719
  style: {
26221
- border: `${Math.max(1, zoomFactor)}px solid ${DRAWING_SELECTION_STROKE}`,
26720
+ border: `${Math.max(1, zoomFactor)}px solid ${CHART_SELECTION_STROKE}`,
26222
26721
  boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${drawingSelectionSurface}`,
26223
26722
  boxSizing: "border-box",
26224
26723
  inset: 0,
@@ -26228,8 +26727,13 @@ function XlsxGrid({
26228
26727
  children: canEditChart ? IMAGE_HANDLE_POSITIONS.map((position) => /* @__PURE__ */ u(
26229
26728
  "div",
26230
26729
  {
26730
+ "data-xlsx-chart-resize-handle": position,
26231
26731
  onPointerDown: (event) => startChartResize(event, chart, rect, position),
26232
- style: resolveImageHandleStyle(position, DRAWING_SELECTION_STROKE, drawingSelectionSurface, zoomFactor)
26732
+ style: {
26733
+ ...resolveImageHandleStyle(position, CHART_SELECTION_STROKE, drawingSelectionSurface, zoomFactor * 0.8),
26734
+ borderRadius: 0,
26735
+ boxShadow: "none"
26736
+ }
26233
26737
  },
26234
26738
  position
26235
26739
  )) : null
@@ -26345,7 +26849,7 @@ function XlsxGrid({
26345
26849
  width: cornerBodyCanvasWidth,
26346
26850
  zIndex: 36
26347
26851
  };
26348
- const drawingViewportCacheSignature = `${Math.floor(drawingViewport.left / CANVAS_VIEWPORT_OVERSCAN_PX)}:${Math.floor(drawingViewport.top / CANVAS_VIEWPORT_OVERSCAN_PX)}:${drawingViewport.width}:${drawingViewport.height}`;
26852
+ const drawingViewportCacheSignature = `${experimentalCanvas}:${frozenPaneRight}:${frozenPaneBottom}:${Math.floor(drawingViewport.left / CANVAS_VIEWPORT_OVERSCAN_PX)}:${Math.floor(drawingViewport.top / CANVAS_VIEWPORT_OVERSCAN_PX)}:${drawingViewport.width}:${drawingViewport.height}`;
26349
26853
  const previousPaneDrawingNodes = paneDrawingNodesCacheRef.current;
26350
26854
  const canReusePaneDrawingNodes = previousPaneDrawingNodes !== null && previousPaneDrawingNodes.experimentalOfficeCharts === experimentalOfficeCharts && previousPaneDrawingNodes.showImages === showImages && previousPaneDrawingNodes.updateFormControl === updateFormControl && previousPaneDrawingNodes.chartRects === chartRects && previousPaneDrawingNodes.formControlRects === domFormControlRects && previousPaneDrawingNodes.formControlItemsById === formControlItemsById && previousPaneDrawingNodes.shapeRects === domShapeRects && previousPaneDrawingNodes.imageRects === domImageRects && previousPaneDrawingNodes.selectedChartId === selectedChartId && previousPaneDrawingNodes.selectedImageId === selectedImageId && previousPaneDrawingNodes.readOnly === readOnly && previousPaneDrawingNodes.onFormControlAction === onFormControlAction && previousPaneDrawingNodes.onFormControlChange === onFormControlChange && previousPaneDrawingNodes.selectionStroke === selectionStroke && previousPaneDrawingNodes.renderChartLoading === renderChartLoading && previousPaneDrawingNodes.renderFormControl === renderFormControl && previousPaneDrawingNodes.renderImage === renderImage && previousPaneDrawingNodes.renderImageSelection === renderImageSelection && previousPaneDrawingNodes.isChartsLoading === isChartsLoading && previousPaneDrawingNodes.selectedChartElement === selectedChartElement && previousPaneDrawingNodes.palette === palette && previousPaneDrawingNodes.drawingViewportSignature === drawingViewportCacheSignature;
26351
26855
  const paneDrawingNodes = canReusePaneDrawingNodes ? previousPaneDrawingNodes.value : !showImages ? {
@@ -27112,8 +27616,57 @@ function XlsxGrid({
27112
27616
  index
27113
27617
  )
27114
27618
  ] : []);
27619
+ const chartSourceHighlightNodes = (experimentalCanvas ? activeSheetChartHighlights : []).flatMap((highlight, index) => {
27620
+ const range = expandHighlightedRange(highlight.range, activeSheet?.mergedRanges ?? mergedRegions);
27621
+ const rows = getHighlightAxisExtent(visibleRows, rowPrefixSums, range.start.row, range.end.row);
27622
+ const cols = getHighlightAxisExtent(visibleCols, colPrefixSums, range.start.col, range.end.col);
27623
+ if (!rows || !cols) return [];
27624
+ return [
27625
+ /* @__PURE__ */ u(
27626
+ ReferenceRangeOutline,
27627
+ {
27628
+ chartSourceIndex: index,
27629
+ color: highlight.strokeColor,
27630
+ fillColor: highlight.fillColor,
27631
+ rect: {
27632
+ left: displayRowHeaderWidth + cols.start,
27633
+ top: displayHeaderHeight + rows.start,
27634
+ width: cols.end - cols.start,
27635
+ height: rows.end - rows.start
27636
+ },
27637
+ zIndex: 0
27638
+ },
27639
+ index
27640
+ )
27641
+ ];
27642
+ });
27643
+ const formulaHighlightNodes = formulaReferences.flatMap((reference, index) => {
27644
+ if (reference.sheetName && reference.sheetName.toLowerCase() !== activeSheet?.name.toLowerCase()) return [];
27645
+ const range = expandHighlightedRange(reference.range, activeSheet?.mergedRanges ?? mergedRegions);
27646
+ const rows = getHighlightAxisExtent(visibleRows, rowPrefixSums, range.start.row, range.end.row);
27647
+ const cols = getHighlightAxisExtent(visibleCols, colPrefixSums, range.start.col, range.end.col);
27648
+ if (!rows || !cols) return [];
27649
+ return [
27650
+ /* @__PURE__ */ u(
27651
+ ReferenceRangeOutline,
27652
+ {
27653
+ formula: editingValue.slice(reference.start, reference.end),
27654
+ color: reference.color,
27655
+ fillColor: `${reference.color}14`,
27656
+ rect: {
27657
+ left: displayRowHeaderWidth + cols.start,
27658
+ top: displayHeaderHeight + rows.start,
27659
+ width: cols.end - cols.start,
27660
+ height: rows.end - rows.start
27661
+ },
27662
+ zIndex: maxDrawingOverlayZIndex + 2
27663
+ },
27664
+ index
27665
+ )
27666
+ ];
27667
+ });
27115
27668
  function renderSelectionOverlay(pane) {
27116
- return /* @__PURE__ */ u(S, { children: [
27669
+ return /* @__PURE__ */ u("div", { style: { display: editingCell ? "none" : "contents" }, children: [
27117
27670
  /* @__PURE__ */ u(
27118
27671
  "div",
27119
27672
  {
@@ -27210,7 +27763,7 @@ function XlsxGrid({
27210
27763
  children: renderSelectionOverlay(pane)
27211
27764
  }
27212
27765
  ) }, pane)) }) : null;
27213
- const drawingOverlayPanes = experimentalCanvas && hasCanvasDomDrawingOverlays || rangeHighlightNodes.length > 0 ? /* @__PURE__ */ u("div", { style: { ...canvasBodyViewportLayerStyle, zIndex: experimentalCanvas ? 23 : 34 }, children: overlayPanes.map(({ pane, style, ref, left, top }) => /* @__PURE__ */ u("div", { style, children: /* @__PURE__ */ u(
27766
+ const drawingOverlayPanes = experimentalCanvas && hasCanvasDomDrawingOverlays || chartSourceHighlightNodes.length > 0 || rangeHighlightNodes.length > 0 || formulaHighlightNodes.length > 0 ? /* @__PURE__ */ u("div", { style: { ...canvasBodyViewportLayerStyle, zIndex: 34 }, children: overlayPanes.map(({ pane, style, ref, left, top }) => /* @__PURE__ */ u("div", { style, children: /* @__PURE__ */ u(
27214
27767
  "div",
27215
27768
  {
27216
27769
  ref,
@@ -27225,8 +27778,10 @@ function XlsxGrid({
27225
27778
  width: totalWidth
27226
27779
  },
27227
27780
  children: [
27781
+ chartSourceHighlightNodes,
27228
27782
  experimentalCanvas ? paneDrawingNodes[pane] : null,
27229
- rangeHighlightNodes
27783
+ rangeHighlightNodes,
27784
+ formulaHighlightNodes
27230
27785
  ]
27231
27786
  }
27232
27787
  ) }, pane)) }) : null;
@@ -27352,7 +27907,12 @@ function XlsxGrid({
27352
27907
  /* @__PURE__ */ u("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
27353
27908
  ] }),
27354
27909
  editingCell && editingOverlayRect ? (() => {
27355
- const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
27910
+ const editingCellData = getCellData(editingCell.row, editingCell.col);
27911
+ const editingCellStyle = { ...editingCellData.style };
27912
+ if (editingCellData.usesGeneralAlignment) {
27913
+ const enteredValue = worksheet && isTextCell(worksheet, editingCell) ? editingValue : coerceUserEnteredValue(editingValue, locale);
27914
+ editingCellStyle.textAlign = typeof enteredValue === "number" ? "right" : typeof enteredValue === "boolean" ? "center" : "left";
27915
+ }
27356
27916
  const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
27357
27917
  const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
27358
27918
  return /* @__PURE__ */ u(
@@ -27364,49 +27924,64 @@ function XlsxGrid({
27364
27924
  top: editingOverlayRect.top,
27365
27925
  width: editingOverlayRect.width,
27366
27926
  height: editingOverlayRect.height,
27367
- zIndex: 28
27927
+ zIndex: 42
27368
27928
  },
27369
27929
  children: /* @__PURE__ */ u(
27370
- "input",
27930
+ CellEditor,
27371
27931
  {
27372
- ref: editingInputRef,
27373
- autoFocus: true,
27374
- onBlur: handleEditingBlur,
27375
- onChange: (event) => setEditingValue(event.target.value),
27376
- onKeyDown: (event) => {
27377
- event.stopPropagation();
27378
- if (event.key === "Enter") {
27379
- event.preventDefault();
27380
- commitEditing();
27381
- return;
27382
- }
27383
- if (event.key === "Escape") {
27384
- event.preventDefault();
27385
- cancelEditing();
27386
- return;
27387
- }
27388
- if (event.key === "ArrowDown" || event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "ArrowUp") {
27389
- event.preventDefault();
27390
- handleEditingNavigate(event.key, event.currentTarget.value);
27391
- }
27932
+ canvasText: true,
27933
+ canvasOffset: {
27934
+ left: editingOverlayRect.left - drawingViewport.left - (stickyLeftByCol.has(editingCell.col) ? displayRowHeaderWidth : scrollBodyCanvasLeft),
27935
+ top: editingOverlayRect.top - drawingViewport.top - (stickyTopByRow.has(editingCell.row) ? displayHeaderHeight : scrollBodyCanvasTop)
27936
+ },
27937
+ paintCanvasText: (context, width, _height, lines, textTop) => {
27938
+ const padding = resolveCanvasPadding(editingCellStyle.padding);
27939
+ const contentWidth = Math.max(0, width - padding.left - padding.right);
27940
+ const lineHeight = resolveCanvasLineHeight(editingCellStyle, 12 * zoomFactor);
27941
+ context.font = resolveCanvasFont(editingCellStyle, 12 * zoomFactor);
27942
+ context.textBaseline = "middle";
27943
+ context.fillStyle = editingColor;
27944
+ const align = editingCellStyle.textAlign === "right" ? "right" : editingCellStyle.textAlign === "center" ? "center" : "left";
27945
+ lines.forEach(({ text: line, start: lineStart }, lineIndex) => {
27946
+ const textWidth = context.measureText(line).width;
27947
+ const x2 = padding.left + (align === "right" ? contentWidth - textWidth : align === "center" ? (contentWidth - textWidth) / 2 : 0);
27948
+ const y2 = textTop + (lineIndex + 0.5) * lineHeight;
27949
+ context.fillStyle = editingColor;
27950
+ context.fillText(line, x2, y2);
27951
+ for (const reference of formulaReferences) {
27952
+ const from = Math.max(0, reference.start - lineStart);
27953
+ const to = Math.min(line.length, reference.end - lineStart);
27954
+ if (from >= to) continue;
27955
+ const left = x2 + context.measureText(line.slice(0, from)).width;
27956
+ const right = x2 + context.measureText(line.slice(0, to)).width;
27957
+ context.save();
27958
+ context.beginPath();
27959
+ context.rect(left, y2 - lineHeight / 2, right - left, lineHeight);
27960
+ context.clip();
27961
+ context.fillStyle = reference.color;
27962
+ context.fillText(line, x2, y2);
27963
+ context.restore();
27964
+ }
27965
+ });
27392
27966
  },
27967
+ inputRef: editingInputRef,
27968
+ value: editingValue,
27969
+ references: formulaReferences,
27970
+ onBlur: handleEditingBlur,
27971
+ onChange: setEditingValue,
27972
+ onCommit: commitEditing,
27973
+ onCancel: cancelEditing,
27974
+ onNavigate: handleEditingNavigate,
27393
27975
  style: {
27394
27976
  backgroundColor: editingBackground,
27395
- border: 0,
27396
27977
  boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
27397
- boxSizing: "border-box",
27398
27978
  color: editingColor,
27399
- display: "block",
27400
27979
  font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
27401
- height: "100%",
27402
- margin: 0,
27403
- minHeight: 0,
27404
- outline: "none",
27405
- overflow: "hidden",
27406
- padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
27407
- width: "100%"
27408
- },
27409
- value: editingValue
27980
+ lineHeight: editingCellStyle.lineHeight,
27981
+ textAlign: editingCellStyle.textAlign,
27982
+ verticalAlign: editingCellStyle.verticalAlign,
27983
+ padding: editingCellStyle.padding
27984
+ }
27410
27985
  }
27411
27986
  )
27412
27987
  }
@@ -27536,6 +28111,8 @@ function XlsxGrid({
27536
28111
  actualRow,
27537
28112
  editingCell,
27538
28113
  editingValue,
28114
+ formulaReferences,
28115
+ editorBoxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
27539
28116
  frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
27540
28117
  getCellData,
27541
28118
  leadingSpacerWidth: leadingColumnSpacerWidth,
@@ -28070,4 +28647,4 @@ export {
28070
28647
  __createContentNode,
28071
28648
  __createContentRoot
28072
28649
  };
28073
- //# sourceMappingURL=chunk-QGVGTRPL.js.map
28650
+ //# sourceMappingURL=chunk-R2KLWFAZ.js.map