@file-viewer/renderer-spreadsheet 2.1.9 → 2.1.10

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.
@@ -4,16 +4,25 @@ import { type CellStyleCache, type SheetDefaults, type VirtualSheetState } from
4
4
  export declare const INDEX_COLUMN_WIDTH = 68;
5
5
  export declare const HEADER_HEIGHT = 34;
6
6
  export declare const RESIZABLE_COLUMN_MIN_WIDTH = 40;
7
+ export declare const RESIZABLE_ROW_MIN_HEIGHT = 18;
7
8
  interface TableConfigOptions {
8
9
  hostHeight: number;
9
10
  resizableColumns?: boolean;
11
+ resizableRows?: boolean;
12
+ copySelection?: (params: SpreadsheetCopyParams) => void;
10
13
  sheetDefaults: SheetDefaults;
11
14
  virtualState: VirtualSheetState;
12
15
  zoomScale?: number;
13
16
  }
17
+ interface SpreadsheetCopyParams {
18
+ focusCell?: unknown;
19
+ data: unknown;
20
+ xArr: number[];
21
+ yArr: number[];
22
+ }
14
23
  export declare const getRowHeight: (heights: number | number[] | undefined, index: number, fallback: number) => number;
15
24
  export declare const normalizeRowHeight: (height: number | undefined, fallback: number) => number;
16
- export declare const detectIndexOffset: (ws: SheetModel) => 1 | 0;
25
+ export declare const detectIndexOffset: (ws: SheetModel) => 0 | 1;
17
26
  export declare const buildColumns: (ws: SheetModel) => {
18
27
  columns: Column[];
19
28
  dataKeys: string[];
@@ -23,5 +32,5 @@ export declare const normalizeCellStyle: (meta: {
23
32
  className?: string;
24
33
  style: any;
25
34
  } | undefined) => CellStyleCache | undefined;
26
- export declare const createTableConfig: ({ hostHeight, resizableColumns, sheetDefaults, virtualState, zoomScale }: TableConfigOptions) => ConfigType;
35
+ export declare const createTableConfig: ({ hostHeight, resizableColumns, resizableRows, copySelection, sheetDefaults, virtualState, zoomScale }: TableConfigOptions) => ConfigType;
27
36
  export {};
@@ -9,6 +9,7 @@ const CELL_PADDING = 2;
9
9
  const CELL_LINE_HEIGHT = 1.2;
10
10
  export const HEADER_HEIGHT = 34;
11
11
  export const RESIZABLE_COLUMN_MIN_WIDTH = 40;
12
+ export const RESIZABLE_ROW_MIN_HEIGHT = 18;
12
13
  const EXCEL_HEADER_BG = '#f3f3f3';
13
14
  const EXCEL_HEADER_TEXT = '#5f6368';
14
15
  const EXCEL_GRID = '#d7dbe0';
@@ -503,6 +504,68 @@ const getExcelOverflowLayout = (virtualState, row, rowIndex, dataColIndex, colum
503
504
  width
504
505
  };
505
506
  };
507
+ const getDataColumnSpanWidth = (virtualState, startDataColIndex, endDataColIndex) => {
508
+ let width = 0;
509
+ for (let index = startDataColIndex; index < endDataColIndex; index += 1) {
510
+ width += getRenderColumnWidth(virtualState.columns[index + 1]);
511
+ }
512
+ return width;
513
+ };
514
+ const getLeftOverflowMirror = (virtualState, row, rowIndex, targetDataColIndex, zoomScale, documentRef) => {
515
+ if (!isBlankOverflowTarget(virtualState, row, rowIndex, targetDataColIndex)) {
516
+ return undefined;
517
+ }
518
+ const targetColumn = virtualState.columns[targetDataColIndex + 1];
519
+ const targetWidth = getRenderColumnWidth(targetColumn);
520
+ if (!targetWidth) {
521
+ return undefined;
522
+ }
523
+ for (let step = 1; step <= MAX_OVERFLOW_SCAN_COLS; step += 1) {
524
+ const sourceDataColIndex = targetDataColIndex - step;
525
+ if (sourceDataColIndex < 0) {
526
+ break;
527
+ }
528
+ const sourceColumn = virtualState.columns[sourceDataColIndex + 1];
529
+ if (!isVisibleDataColumn(sourceColumn)) {
530
+ break;
531
+ }
532
+ const sourceValue = row[getDataKey(sourceDataColIndex)];
533
+ if (!hasRenderableValue(sourceValue)) {
534
+ if (!isBlankOverflowTarget(virtualState, row, rowIndex, sourceDataColIndex)) {
535
+ break;
536
+ }
537
+ continue;
538
+ }
539
+ const sourceCellKey = getCellKeyByDataColumn(rowIndex, sourceDataColIndex);
540
+ const rawSourceStyle = virtualState.cellCache.get(sourceCellKey);
541
+ const sourceStyle = {
542
+ ...(scaleCellStyle(rawSourceStyle, zoomScale) || {}),
543
+ horizontalAlign: (rawSourceStyle === null || rawSourceStyle === void 0 ? void 0 : rawSourceStyle.horizontalAlign) || (sourceColumn === null || sourceColumn === void 0 ? void 0 : sourceColumn.align),
544
+ verticalAlign: (rawSourceStyle === null || rawSourceStyle === void 0 ? void 0 : rawSourceStyle.verticalAlign) || (sourceColumn === null || sourceColumn === void 0 ? void 0 : sourceColumn.verticalAlign)
545
+ };
546
+ const sourceLayout = getExcelOverflowLayout(virtualState, row, rowIndex, sourceDataColIndex, sourceColumn, sourceStyle, sourceValue, zoomScale, documentRef);
547
+ if (!sourceLayout) {
548
+ return undefined;
549
+ }
550
+ const targetOffset = getDataColumnSpanWidth(virtualState, sourceDataColIndex, targetDataColIndex);
551
+ const sourceTextLeft = sourceLayout.left;
552
+ const sourceTextRight = sourceLayout.left + sourceLayout.width;
553
+ const targetLeft = targetOffset;
554
+ const targetRight = targetOffset + targetWidth;
555
+ if (sourceTextLeft < targetRight && sourceTextRight > targetLeft) {
556
+ return {
557
+ value: sourceValue,
558
+ style: sourceStyle,
559
+ overflowLayout: {
560
+ left: sourceLayout.left - targetOffset,
561
+ width: sourceLayout.width
562
+ }
563
+ };
564
+ }
565
+ return undefined;
566
+ }
567
+ return undefined;
568
+ };
506
569
  const getBorderScore = (border) => {
507
570
  if (!border) {
508
571
  return 0;
@@ -603,31 +666,31 @@ const applyOverflowLayout = (text, overflowLayout) => {
603
666
  };
604
667
  // e-virt-table 的普通样式接口不支持 Excel 式四边边框和单元格级换行/垂直对齐,
605
668
  // 这里借助官方的 BODY_CELL_RENDER_METHOD,只在可视区补轻量 DOM 覆盖层。
606
- const renderCellOverlay = (cellEl, style, value, renderText, overflowLayout, zoomScale) => {
669
+ const renderCellOverlay = (cellEl, borderStyle, textStyle, textValue, renderText, overflowLayout, zoomScale) => {
607
670
  const documentRef = cellEl.ownerDocument;
608
671
  cellEl.replaceChildren();
609
672
  Object.assign(cellEl.style, {
610
673
  pointerEvents: 'none',
611
- overflow: 'visible',
674
+ overflow: overflowLayout ? 'hidden' : 'visible',
612
675
  background: 'transparent'
613
676
  });
614
677
  const fragment = documentRef.createDocumentFragment();
615
678
  if (renderText) {
616
- const text = createTextLayer(documentRef, value, style, scaleNumber(CELL_PADDING, zoomScale));
679
+ const text = createTextLayer(documentRef, textValue, textStyle, scaleNumber(CELL_PADDING, zoomScale));
617
680
  applyOverflowLayout(text, overflowLayout);
618
681
  fragment.appendChild(text);
619
682
  }
620
- if (style.borderTop) {
621
- fragment.appendChild(createBorderLine(documentRef, 'top', style.borderTop));
683
+ if (borderStyle.borderTop) {
684
+ fragment.appendChild(createBorderLine(documentRef, 'top', borderStyle.borderTop));
622
685
  }
623
- if (style.borderRight) {
624
- fragment.appendChild(createBorderLine(documentRef, 'right', style.borderRight));
686
+ if (borderStyle.borderRight) {
687
+ fragment.appendChild(createBorderLine(documentRef, 'right', borderStyle.borderRight));
625
688
  }
626
- if (style.borderBottom) {
627
- fragment.appendChild(createBorderLine(documentRef, 'bottom', style.borderBottom));
689
+ if (borderStyle.borderBottom) {
690
+ fragment.appendChild(createBorderLine(documentRef, 'bottom', borderStyle.borderBottom));
628
691
  }
629
- if (style.borderLeft) {
630
- fragment.appendChild(createBorderLine(documentRef, 'left', style.borderLeft));
692
+ if (borderStyle.borderLeft) {
693
+ fragment.appendChild(createBorderLine(documentRef, 'left', borderStyle.borderLeft));
631
694
  }
632
695
  cellEl.appendChild(fragment);
633
696
  };
@@ -688,7 +751,7 @@ export const normalizeCellStyle = (meta) => {
688
751
  }
689
752
  return nextStyle;
690
753
  };
691
- export const createTableConfig = ({ hostHeight, resizableColumns = false, sheetDefaults, virtualState, zoomScale = 1 }) => {
754
+ export const createTableConfig = ({ hostHeight, resizableColumns = false, resizableRows = false, copySelection, sheetDefaults, virtualState, zoomScale = 1 }) => {
692
755
  const normalizedScale = normalizeZoomScale(zoomScale);
693
756
  const scaledPadding = scaleNumber(CELL_PADDING, normalizedScale);
694
757
  const scaledHeaderHeight = scaleNumber(HEADER_HEIGHT, normalizedScale);
@@ -738,8 +801,12 @@ export const createTableConfig = ({ hostHeight, resizableColumns = false, sheetD
738
801
  }
739
802
  const style = scaleCellStyle(virtualState.cellCache.get(cellKey), normalizedScale);
740
803
  const dataColIndex = getDataColumnIndex(column, colIndex);
741
- const overflowLayout = getExcelOverflowLayout(virtualState, currentRow, rowIndex, dataColIndex, column, style, value, normalizedScale);
742
- const renderText = shouldRenderTextInOverlay(style, column) || !!overflowLayout;
804
+ const measureDocument = typeof document === 'undefined' ? undefined : document;
805
+ const overflowLayout = getExcelOverflowLayout(virtualState, currentRow, rowIndex, dataColIndex, column, style, value, normalizedScale, measureDocument);
806
+ const mirror = !hasRenderableValue(value)
807
+ ? getLeftOverflowMirror(virtualState, currentRow, rowIndex, dataColIndex, normalizedScale, measureDocument)
808
+ : undefined;
809
+ const renderText = shouldRenderTextInOverlay(style, column) || !!overflowLayout || !!mirror;
743
810
  if (!hasBorder(style) && !renderText) {
744
811
  return undefined;
745
812
  }
@@ -752,7 +819,7 @@ export const createTableConfig = ({ hostHeight, resizableColumns = false, sheetD
752
819
  const collapsedStyle = hasBorder(style)
753
820
  ? getCollapsedBorderStyle(virtualState, rowIndex, dataColIndex, baseStyle, normalizedScale)
754
821
  : baseStyle;
755
- renderCellOverlay(cellEl, collapsedStyle, value, renderText, overflowLayout, normalizedScale);
822
+ renderCellOverlay(cellEl, collapsedStyle, (mirror === null || mirror === void 0 ? void 0 : mirror.style) || collapsedStyle, mirror ? mirror.value : value, renderText, (mirror === null || mirror === void 0 ? void 0 : mirror.overflowLayout) || overflowLayout, normalizedScale);
756
823
  });
757
824
  };
758
825
  return {
@@ -803,9 +870,17 @@ export const createTableConfig = ({ hostHeight, resizableColumns = false, sheetD
803
870
  RESIZE_COLUMN_LINE_COLOR: EXCEL_GREEN,
804
871
  RESIZE_COLUMN_TEXT_BG_COLOR: EXCEL_GREEN,
805
872
  RESIZE_COLUMN_MIN_WIDTH: RESIZABLE_COLUMN_MIN_WIDTH,
806
- ENABLE_RESIZE_ROW: false,
873
+ ENABLE_RESIZE_ROW: resizableRows,
874
+ RESIZE_ROW_LINE_COLOR: EXCEL_GREEN,
875
+ RESIZE_ROW_MIN_HEIGHT: scaleNumber(RESIZABLE_ROW_MIN_HEIGHT, normalizedScale),
807
876
  ENABLE_KEYBOARD: true,
808
877
  ENABLE_COPY: true,
878
+ BEFORE_COPY_METHOD: copySelection
879
+ ? (params) => {
880
+ copySelection(params);
881
+ return undefined;
882
+ }
883
+ : undefined,
809
884
  // 预览态只开放“拖动扩选”的交互,不允许真正写回单元格内容。
810
885
  BEFORE_AUTOFILL_DATA_METHOD: () => [],
811
886
  SPAN_METHOD: spanMethod,
@@ -825,8 +900,13 @@ export const createTableConfig = ({ hostHeight, resizableColumns = false, sheetD
825
900
  }
826
901
  const currentRow = row;
827
902
  const style = scaleCellStyle(virtualState.cellCache.get(getCellCacheKey(rowIndex, colIndex, column)), normalizedScale);
828
- const overflowLayout = getExcelOverflowLayout(virtualState, currentRow, rowIndex, getDataColumnIndex(column, colIndex), column, style, value, normalizedScale);
829
- if (shouldRenderTextInOverlay(style, column) || overflowLayout) {
903
+ const dataColIndex = getDataColumnIndex(column, colIndex);
904
+ const measureDocument = typeof document === 'undefined' ? undefined : document;
905
+ const overflowLayout = getExcelOverflowLayout(virtualState, currentRow, rowIndex, dataColIndex, column, style, value, normalizedScale, measureDocument);
906
+ const mirror = !hasRenderableValue(value)
907
+ ? getLeftOverflowMirror(virtualState, currentRow, rowIndex, dataColIndex, normalizedScale, measureDocument)
908
+ : undefined;
909
+ if (shouldRenderTextInOverlay(style, column) || overflowLayout || mirror) {
830
910
  return '';
831
911
  }
832
912
  if (value === null || value === undefined) {
@@ -1,6 +1,6 @@
1
1
  import { createFileViewerWorkerController, createFileViewerTranslator, createFileViewerZoomChangeEmitter as createZoomChangeEmitter, registerFileViewerZoomProvider, resolveFileViewerSpreadsheetWorkerUrl, unregisterFileViewerZoomProvider, } from '@file-viewer/core';
2
2
  import { buildRows, clampWindowStart, collectWindowStarts, createEmptyVirtualState, DEFAULT_SHEET_DEFAULTS, displayCellKey, getDataKey, INDEX_COLUMN_KEY, markWindowState, ROW_STATE_FIELD, RowState, WINDOW_SIZE, } from './spreadsheet/state.js';
3
- import { buildColumns, createTableConfig, detectIndexOffset, getDisplayColumns, getRowHeight, HEADER_HEIGHT, INDEX_COLUMN_WIDTH, normalizeCellStyle, normalizeRowHeight, RESIZABLE_COLUMN_MIN_WIDTH, } from './spreadsheet/view.js';
3
+ import { buildColumns, createTableConfig, detectIndexOffset, getDisplayColumns, getRowHeight, HEADER_HEIGHT, INDEX_COLUMN_WIDTH, normalizeCellStyle, normalizeRowHeight, RESIZABLE_COLUMN_MIN_WIDTH, RESIZABLE_ROW_MIN_HEIGHT, } from './spreadsheet/view.js';
4
4
  const EXCEL_IMAGE_SCROLLBAR_GUARD = 18;
5
5
  const spreadsheetStyle = `
6
6
  .excel-wrapper{position:relative;width:100%;height:100%;display:flex;flex-direction:column;background:#fff;color:#172033;font-family:Aptos,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif}
@@ -190,8 +190,78 @@ const setHidden = (element, hidden) => {
190
190
  const clampZoom = (value) => {
191
191
  return Math.min(2.5, Math.max(0.5, Number(value.toFixed(2))));
192
192
  };
193
+ const serializeSpreadsheetCopyCell = (value) => {
194
+ if (value === null || value === undefined) {
195
+ return '';
196
+ }
197
+ const text = `${value}`;
198
+ return /[\t\r\n"]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
199
+ };
200
+ const serializeSpreadsheetCopyData = (data) => {
201
+ if (!Array.isArray(data)) {
202
+ return serializeSpreadsheetCopyCell(data);
203
+ }
204
+ return data.map(row => {
205
+ if (!Array.isArray(row)) {
206
+ return serializeSpreadsheetCopyCell(row);
207
+ }
208
+ return row.map(serializeSpreadsheetCopyCell).join('\t');
209
+ }).join('\n');
210
+ };
211
+ const copyTextWithTextareaFallback = (documentRef, text) => {
212
+ var _a;
213
+ const body = documentRef.body;
214
+ if (!body || typeof documentRef.execCommand !== 'function') {
215
+ return false;
216
+ }
217
+ const activeElement = documentRef.activeElement;
218
+ const textarea = documentRef.createElement('textarea');
219
+ textarea.value = text;
220
+ textarea.setAttribute('readonly', 'true');
221
+ textarea.setAttribute('aria-hidden', 'true');
222
+ Object.assign(textarea.style, {
223
+ position: 'fixed',
224
+ top: '0',
225
+ left: '0',
226
+ width: '1px',
227
+ height: '1px',
228
+ padding: '0',
229
+ border: '0',
230
+ opacity: '0',
231
+ pointerEvents: 'none',
232
+ });
233
+ body.appendChild(textarea);
234
+ textarea.focus({ preventScroll: true });
235
+ textarea.select();
236
+ textarea.setSelectionRange(0, textarea.value.length);
237
+ let copied = false;
238
+ try {
239
+ copied = documentRef.execCommand('copy');
240
+ }
241
+ finally {
242
+ textarea.remove();
243
+ (_a = activeElement === null || activeElement === void 0 ? void 0 : activeElement.focus) === null || _a === void 0 ? void 0 : _a.call(activeElement, { preventScroll: true });
244
+ }
245
+ return copied;
246
+ };
247
+ const writeSpreadsheetClipboard = async (documentRef, text) => {
248
+ var _a;
249
+ const targetWindow = documentRef.defaultView;
250
+ const clipboard = (_a = targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.navigator) === null || _a === void 0 ? void 0 : _a.clipboard;
251
+ const useAsyncClipboard = !!(targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.isSecureContext) && typeof (clipboard === null || clipboard === void 0 ? void 0 : clipboard.writeText) === 'function';
252
+ if (useAsyncClipboard) {
253
+ try {
254
+ await clipboard.writeText(text);
255
+ return true;
256
+ }
257
+ catch {
258
+ return copyTextWithTextareaFallback(documentRef, text);
259
+ }
260
+ }
261
+ return copyTextWithTextareaFallback(documentRef, text);
262
+ };
193
263
  const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
194
- var _a, _b, _c, _d;
264
+ var _a, _b, _c, _d, _e, _f;
195
265
  const documentRef = target.ownerDocument;
196
266
  const EVirtTable = await loadEVirtTable();
197
267
  const t = createFileViewerTranslator(context === null || context === void 0 ? void 0 : context.options);
@@ -288,6 +358,7 @@ const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
288
358
  let disposed = false;
289
359
  let hasNotifiedFirstPaint = false;
290
360
  const resizableColumns = ((_b = (_a = context === null || context === void 0 ? void 0 : context.options) === null || _a === void 0 ? void 0 : _a.spreadsheet) === null || _b === void 0 ? void 0 : _b.resizableColumns) === true;
361
+ const resizableRows = ((_d = (_c = context === null || context === void 0 ? void 0 : context.options) === null || _c === void 0 ? void 0 : _c.spreadsheet) === null || _d === void 0 ? void 0 : _d.resizableRows) === true;
291
362
  const controller = createFileViewerWorkerController(createSpreadsheetWorkerFactory(target, context), { logErrors: false });
292
363
  const getActiveSheet = () => sheets.find(sheet => sheet.id === sheetIndex);
293
364
  const getSheetTabs = () => {
@@ -488,10 +559,39 @@ const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
488
559
  };
489
560
  renderImages();
490
561
  };
562
+ const markCopiedSelection = (params) => {
563
+ var _a, _b, _c, _d;
564
+ const selector = table === null || table === void 0 ? void 0 : table.ctx.selector;
565
+ if (!selector) {
566
+ return;
567
+ }
568
+ selector.xArrCopy = params.xArr.slice();
569
+ selector.yArrCopy = params.yArr.slice();
570
+ (_b = table === null || table === void 0 ? void 0 : (_a = table.ctx).emit) === null || _b === void 0 ? void 0 : _b.call(_a, 'copyChange', {
571
+ xArr: selector.xArrCopy,
572
+ yArr: selector.yArrCopy,
573
+ data: params.data,
574
+ });
575
+ (_d = table === null || table === void 0 ? void 0 : (_c = table.ctx).emit) === null || _d === void 0 ? void 0 : _d.call(_c, 'draw');
576
+ };
577
+ const copySpreadsheetSelection = (params) => {
578
+ const text = serializeSpreadsheetCopyData(params.data);
579
+ void writeSpreadsheetClipboard(documentRef, text).then((copied) => {
580
+ if (copied) {
581
+ markCopiedSelection(params);
582
+ return;
583
+ }
584
+ console.error('Spreadsheet copy failed: clipboard fallback returned false.');
585
+ }).catch((error) => {
586
+ console.error('Spreadsheet copy failed:', error);
587
+ });
588
+ };
491
589
  const buildTableView = () => ({
492
590
  config: createTableConfig({
493
591
  hostHeight: getHostHeight(),
494
592
  resizableColumns,
593
+ resizableRows,
594
+ copySelection: copySpreadsheetSelection,
495
595
  sheetDefaults,
496
596
  virtualState,
497
597
  zoomScale: zoom,
@@ -546,6 +646,8 @@ const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
546
646
  config: createTableConfig({
547
647
  hostHeight: getHostHeight(),
548
648
  resizableColumns,
649
+ resizableRows,
650
+ copySelection: copySpreadsheetSelection,
549
651
  sheetDefaults,
550
652
  virtualState,
551
653
  zoomScale: zoom,
@@ -555,6 +657,7 @@ const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
555
657
  table.on('onScrollY', scheduleViewportLoad);
556
658
  table.on('resize', scheduleViewportLoad);
557
659
  table.on('resizeColumnChange', handleColumnResizeChange);
660
+ table.on('resizeRowChange', handleRowResizeChange);
558
661
  return table;
559
662
  };
560
663
  const renderTable = (instance, columns = virtualState.columns, rows = virtualState.rows, resetScroll = false) => {
@@ -562,6 +665,8 @@ const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
562
665
  config: createTableConfig({
563
666
  hostHeight: getHostHeight(),
564
667
  resizableColumns,
668
+ resizableRows,
669
+ copySelection: copySpreadsheetSelection,
565
670
  sheetDefaults,
566
671
  virtualState,
567
672
  zoomScale: zoom,
@@ -638,6 +743,28 @@ const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
638
743
  clearTableResizableHeaderCache();
639
744
  syncTableLayout();
640
745
  }
746
+ function handleRowResizeChange(event) {
747
+ if (!resizableRows || disposed) {
748
+ return;
749
+ }
750
+ const rowIndex = Number(event === null || event === void 0 ? void 0 : event.rowIndex);
751
+ const displayHeight = Number(event === null || event === void 0 ? void 0 : event.height);
752
+ if (!Number.isInteger(rowIndex) || rowIndex < 0 || !Number.isFinite(displayHeight) || displayHeight <= 0) {
753
+ return;
754
+ }
755
+ const row = virtualState.rows[rowIndex];
756
+ if (!row) {
757
+ return;
758
+ }
759
+ const baseHeight = normalizeRowHeight(Math.max(RESIZABLE_ROW_MIN_HEIGHT, Math.round(displayHeight / Math.max(zoom, 0.01))), virtualState.defaults.rowHeight);
760
+ applyRowHeight(row, baseHeight);
761
+ virtualState.rowHeightCache.set(rowIndex, baseHeight);
762
+ const activeSheetId = getActiveSheetId();
763
+ if (activeSheetId !== undefined) {
764
+ sheetStateCache.set(activeSheetId, virtualState);
765
+ }
766
+ syncTableLayout();
767
+ }
641
768
  function requestWindow(startRow = 0, silent = true) {
642
769
  const sheetId = getActiveSheetId();
643
770
  if (sheetId === undefined) {
@@ -969,12 +1096,12 @@ const renderFileViewerSpreadsheet = async (buffer, target, _type, context) => {
969
1096
  errorMessage = event.message || t('spreadsheet.error.workerFailed');
970
1097
  renderChrome();
971
1098
  });
972
- (_c = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _c === void 0 ? void 0 : _c.call(context, {
1099
+ (_e = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _e === void 0 ? void 0 : _e.call(context, {
973
1100
  print: false,
974
1101
  exportHtml: false,
975
1102
  });
976
1103
  ensureTable();
977
- const ResizeObserverCtor = ((_d = getTargetWindow(target)) === null || _d === void 0 ? void 0 : _d.ResizeObserver) ||
1104
+ const ResizeObserverCtor = ((_f = getTargetWindow(target)) === null || _f === void 0 ? void 0 : _f.ResizeObserver) ||
978
1105
  (typeof ResizeObserver !== 'undefined' ? ResizeObserver : undefined);
979
1106
  if (ResizeObserverCtor) {
980
1107
  resizeObserver = new ResizeObserverCtor(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/renderer-spreadsheet",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone spreadsheet renderer plugin for Flyfish File Viewer powered by styled-exceljs and e-virt-table.",
@@ -68,7 +68,7 @@
68
68
  "LICENSE"
69
69
  ],
70
70
  "dependencies": {
71
- "@file-viewer/core": "^2.1.9",
71
+ "@file-viewer/core": "^2.1.10",
72
72
  "e-virt-table": "^1.3.26",
73
73
  "styled-exceljs": "0.21.1",
74
74
  "tinycolor2": "^1.6.0"