@file-viewer/renderer-spreadsheet 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,160 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work by
47
+ the copyright owner or by an individual or Legal Entity authorized to submit on
48
+ behalf of the copyright owner. For the purposes of this definition, "submitted"
49
+ means any form of electronic, verbal, or written communication sent to the
50
+ Licensor or its representatives, including but not limited to communication on
51
+ electronic mailing lists, source code control systems, and issue tracking systems
52
+ that are managed by, or on behalf of, the Licensor for the purpose of discussing
53
+ and improving the Work, but excluding communication that is conspicuously marked
54
+ or otherwise designated in writing by the copyright owner as "Not a
55
+ Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable (except as stated in this section) patent
71
+ license to make, have made, use, offer to sell, sell, import, and otherwise
72
+ transfer the Work, where such license applies only to those patent claims
73
+ licensable by such Contributor that are necessarily infringed by their
74
+ Contribution(s) alone or by combination of their Contribution(s) with the Work to
75
+ which such Contribution(s) was submitted. If You institute patent litigation
76
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
77
+ alleging that the Work or a Contribution incorporated within the Work
78
+ constitutes direct or contributory patent infringement, then any patent licenses
79
+ granted to You under this License for that Work shall terminate as of the date
80
+ such litigation is filed.
81
+
82
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
83
+ Derivative Works thereof in any medium, with or without modifications, and in
84
+ Source or Object form, provided that You meet the following conditions:
85
+
86
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
87
+ this License; and
88
+
89
+ (b) You must cause any modified files to carry prominent notices stating that
90
+ You changed the files; and
91
+
92
+ (c) You must retain, in the Source form of any Derivative Works that You
93
+ distribute, all copyright, patent, trademark, and attribution notices from the
94
+ Source form of the Work, excluding those notices that do not pertain to any part
95
+ of the Derivative Works; and
96
+
97
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
98
+ any Derivative Works that You distribute must include a readable copy of the
99
+ attribution notices contained within such NOTICE file, excluding those notices
100
+ that do not pertain to any part of the Derivative Works, in at least one of the
101
+ following places: within a NOTICE text file distributed as part of the Derivative
102
+ Works; within the Source form or documentation, if provided along with the
103
+ Derivative Works; or, within a display generated by the Derivative Works, if and
104
+ wherever such third-party notices normally appear. The contents of the NOTICE
105
+ file are for informational purposes only and do not modify the License. You may
106
+ add Your own attribution notices within Derivative Works that You distribute,
107
+ alongside or as an addendum to the NOTICE text from the Work, provided that such
108
+ additional attribution notices cannot be construed as modifying the License.
109
+
110
+ You may add Your own copyright statement to Your modifications and may provide
111
+ additional or different license terms and conditions for use, reproduction, or
112
+ distribution of Your modifications, or for any such Derivative Works as a whole,
113
+ provided Your use, reproduction, and distribution of the Work otherwise complies
114
+ with the conditions stated in this License.
115
+
116
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
117
+ Contribution intentionally submitted for inclusion in the Work by You to the
118
+ Licensor shall be under the terms and conditions of this License, without any
119
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
120
+ supersede or modify the terms of any separate license agreement you may have
121
+ executed with Licensor regarding such Contributions.
122
+
123
+ 6. Trademarks. This License does not grant permission to use the trade names,
124
+ trademarks, service marks, or product names of the Licensor, except as required
125
+ for reasonable and customary use in describing the origin of the Work and
126
+ reproducing the content of the NOTICE file.
127
+
128
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
129
+ writing, Licensor provides the Work (and each Contributor provides its
130
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
131
+ KIND, either express or implied, including, without limitation, any warranties or
132
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
133
+ PARTICULAR PURPOSE. You are solely responsible for determining the
134
+ appropriateness of using or redistributing the Work and assume any risks
135
+ associated with Your exercise of permissions under this License.
136
+
137
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
138
+ tort (including negligence), contract, or otherwise, unless required by
139
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
140
+ writing, shall any Contributor be liable to You for damages, including any
141
+ direct, indirect, special, incidental, or consequential damages of any character
142
+ arising as a result of this License or out of the use or inability to use the
143
+ Work (including but not limited to damages for loss of goodwill, work stoppage,
144
+ computer failure or malfunction, or any and all other commercial damages or
145
+ losses), even if such Contributor has been advised of the possibility of such
146
+ damages.
147
+
148
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
149
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
150
+ acceptance of support, warranty, indemnity, or other liability obligations and/or
151
+ rights consistent with this License. However, in accepting such obligations, You
152
+ may act only on Your own behalf and on Your sole responsibility, not on behalf of
153
+ any other Contributor, and only if You agree to indemnify, defend, and hold each
154
+ Contributor harmless for any liability incurred by, or claims asserted against,
155
+ such Contributor by reason of your accepting any such warranty or additional
156
+ liability.
157
+
158
+ END OF TERMS AND CONDITIONS
159
+
160
+ Copyright 2026 Flyfish Viewer
package/README.en.md ADDED
@@ -0,0 +1,47 @@
1
+ # @file-viewer/renderer-spreadsheet
2
+
3
+ Standalone spreadsheet renderer package for Flyfish File Viewer. It is powered by `styled-exceljs` and `e-virt-table`, previews XLSX, XLSM, XLSB, XLS, CSV, ODS, FODS, Numbers, and compatible spreadsheet files in the browser, and resolves the optional worker URL through the File Viewer asset manifest for offline enterprise deployments.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import FileViewer from '@file-viewer/vue3'
9
+ import { spreadsheetRenderer } from '@file-viewer/renderer-spreadsheet'
10
+
11
+ const options = {
12
+ rendererMode: 'replace',
13
+ renderers: spreadsheetRenderer,
14
+ }
15
+ ```
16
+
17
+ You can also compose it with other renderer packages:
18
+
19
+ ```ts
20
+ import { pdfRenderer } from '@file-viewer/renderer-pdf'
21
+ import { spreadsheetRenderer } from '@file-viewer/renderer-spreadsheet'
22
+
23
+ const options = {
24
+ rendererMode: 'replace',
25
+ renderers: [pdfRenderer, spreadsheetRenderer],
26
+ }
27
+ ```
28
+
29
+ ## Capabilities
30
+
31
+ - Supports `.xlsx`, `.xltx`, `.xlsm`, `.xlsb`, `.xls`, `.xlt`, `.xltm`, `.csv`, `.ods`, `.fods`, and `.numbers`.
32
+ - Uses main-thread parsing by default to avoid worker stalls caused by local servers, mobile WebViews, MIME configuration, or strict CSP.
33
+ - Can opt into the static worker path with `options.spreadsheet.worker: true` and `options.spreadsheet.workerUrl`.
34
+ - Supports multiple sheets, horizontally scrollable sheet tabs, merged cells, row and column sizing, borders, fills, alignment, text color, workbook images, the global zoom provider, and optional header drag column resizing.
35
+ - Uses virtual rendering for interaction. Host components usually hide full-document print for spreadsheets to avoid printing only the current viewport.
36
+
37
+ ## Offline Assets
38
+
39
+ The optional worker path is:
40
+
41
+ - `vendor/xlsx/sheet.worker.js`
42
+
43
+ For private deployments, override it with `options.spreadsheet.workerUrl`. The official Vite plugin and demo worker build script generate this file from this package's worker entry.
44
+
45
+ ## Migration Note
46
+
47
+ Spreadsheet preview has moved completely out of `@file-viewer/core`. Core now only keeps the asset manifest, shared types, and a compatibility error message, and it no longer installs `styled-exceljs`, `e-virt-table`, or `tinycolor2` by default. Install this package and pass it through `renderers`, or use `@file-viewer/preset-all` for the complete spreadsheet experience.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # @file-viewer/renderer-spreadsheet
2
+
3
+ Flyfish File Viewer 的独立表格 renderer 包。它基于 `styled-exceljs` 与 `e-virt-table` 提供 XLSX、XLSM、XLSB、XLS、CSV、ODS、FODS、Numbers 等表格文件的浏览器端预览,并通过 File Viewer 统一的 asset manifest 解析可选 Worker 路径,适合企业内网和离线部署。
4
+
5
+ ## 用法
6
+
7
+ ```ts
8
+ import FileViewer from '@file-viewer/vue3'
9
+ import { spreadsheetRenderer } from '@file-viewer/renderer-spreadsheet'
10
+
11
+ const options = {
12
+ rendererMode: 'replace',
13
+ renderers: spreadsheetRenderer,
14
+ }
15
+ ```
16
+
17
+ 也可以和其他 renderer 一起组合:
18
+
19
+ ```ts
20
+ import { pdfRenderer } from '@file-viewer/renderer-pdf'
21
+ import { spreadsheetRenderer } from '@file-viewer/renderer-spreadsheet'
22
+
23
+ const options = {
24
+ rendererMode: 'replace',
25
+ renderers: [pdfRenderer, spreadsheetRenderer],
26
+ }
27
+ ```
28
+
29
+ ## 能力边界
30
+
31
+ - 支持 `.xlsx`、`.xltx`、`.xlsm`、`.xlsb`、`.xls`、`.xlt`、`.xltm`、`.csv`、`.ods`、`.fods`、`.numbers`。
32
+ - 默认主线程解析,避免本地服务器、手机 WebView、MIME 或 CSP 导致 Worker 卡住。
33
+ - 可以通过 `options.spreadsheet.worker: true` 与 `options.spreadsheet.workerUrl` 显式启用静态 Worker。
34
+ - 支持多 sheet、横向滚动标签栏、合并单元格、列宽/行高、边框、填充、对齐、文本颜色、图片覆盖层、统一缩放 provider 和可选表头拖拽调整列宽。
35
+ - 表格使用虚拟渲染,适合交互预览;完整打印按钮通常由上层能力判断隐藏,避免只打印当前视口。
36
+
37
+ ## 离线资产
38
+
39
+ 默认可选 Worker 路径为:
40
+
41
+ - `vendor/xlsx/sheet.worker.js`
42
+
43
+ 私有化部署时可以通过 `options.spreadsheet.workerUrl` 覆盖。官方 Vite 插件和 Demo worker 构建脚本会从本包的 worker 入口生成该文件。
44
+
45
+ ## 迁移说明
46
+
47
+ 表格预览已经从 `@file-viewer/core` 中彻底移出,core 只保留资产 manifest、类型和兼容错误提示,不再默认安装 `styled-exceljs`、`e-virt-table` 或 `tinycolor2`。完整表格能力请安装本包并传入 `renderers`,或直接使用 `@file-viewer/preset-all`。
@@ -0,0 +1,5 @@
1
+ import { type FileRenderHandler, type FileViewerRenderedInstance, type FileViewerRendererPlugin, type RendererDefinition } from '@file-viewer/core';
2
+ export declare const spreadsheetRendererDefinition: RendererDefinition;
3
+ export declare const renderFileViewerSpreadsheet: FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>;
4
+ export declare const spreadsheetRenderer: FileViewerRendererPlugin<FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>>;
5
+ export default spreadsheetRenderer;
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ import { DEFAULT_RENDERER_DEFINITIONS, } from '@file-viewer/core';
2
+ const spreadsheetDefinition = DEFAULT_RENDERER_DEFINITIONS.find(definition => definition.id === 'spreadsheet-openxml');
3
+ if (!spreadsheetDefinition) {
4
+ throw new Error('@file-viewer/renderer-spreadsheet could not locate the shared Spreadsheet format definition.');
5
+ }
6
+ export const spreadsheetRendererDefinition = spreadsheetDefinition;
7
+ export const renderFileViewerSpreadsheet = (buffer, target, type, context) => import('./spreadsheet.js').then(({ default: renderSpreadsheet }) => renderSpreadsheet(buffer, target, type, context));
8
+ export const spreadsheetRenderer = {
9
+ id: 'file-viewer-renderer-spreadsheet',
10
+ label: 'Flyfish File Viewer Spreadsheet renderer',
11
+ definitions: [spreadsheetRendererDefinition],
12
+ handlers: [{
13
+ rendererId: spreadsheetRendererDefinition.id,
14
+ handler: renderFileViewerSpreadsheet,
15
+ }],
16
+ };
17
+ export default spreadsheetRenderer;
@@ -0,0 +1,80 @@
1
+ import type { Align, Column, VerticalAlign } from 'e-virt-table';
2
+ import type { CellMerge } from './worker/type.js';
3
+ export declare const WINDOW_SIZE = 500;
4
+ export declare const PREFETCH_AHEAD = 3;
5
+ export declare const PREFETCH_BEHIND = 1;
6
+ export declare const INDEX_COLUMN_KEY = "__index";
7
+ export declare const ROW_KEY_FIELD = "__k";
8
+ export declare const ROW_STATE_FIELD = "__s";
9
+ export interface SheetDefaults {
10
+ rowHeight: number;
11
+ colWidth: number;
12
+ }
13
+ export declare const DEFAULT_SHEET_DEFAULTS: SheetDefaults;
14
+ export declare const RowState: {
15
+ readonly Placeholder: 0;
16
+ readonly Loading: 1;
17
+ readonly Loaded: 2;
18
+ };
19
+ export type RowStateValue = (typeof RowState)[keyof typeof RowState];
20
+ export interface VirtualRow extends Record<string, any> {
21
+ __k: string;
22
+ __s: RowStateValue;
23
+ __baseHeight?: number;
24
+ _height?: number;
25
+ }
26
+ export interface CellBorderCache {
27
+ width: number;
28
+ style: string;
29
+ color: string;
30
+ }
31
+ export interface CellStyleCache {
32
+ backgroundColor?: string;
33
+ color?: string;
34
+ font?: string;
35
+ horizontalAlign?: Align;
36
+ verticalAlign?: VerticalAlign;
37
+ wrapText?: boolean;
38
+ shrinkToFit?: boolean;
39
+ borderTop?: CellBorderCache;
40
+ borderRight?: CellBorderCache;
41
+ borderBottom?: CellBorderCache;
42
+ borderLeft?: CellBorderCache;
43
+ }
44
+ export interface VirtualSheetState {
45
+ active: boolean;
46
+ totalRows: number;
47
+ totalCols: number;
48
+ indexOffset: number;
49
+ defaults: SheetDefaults;
50
+ dataKeys: string[];
51
+ rows: VirtualRow[];
52
+ columns: Column[];
53
+ cellCache: Map<string, CellStyleCache>;
54
+ mergeStartMap: Map<string, CellMerge>;
55
+ mergeCoveredMap: Map<string, true>;
56
+ rowHeightCache: Map<number, number>;
57
+ windowRows: Map<number, number[]>;
58
+ windowCells: Map<number, string[]>;
59
+ loadedWindows: Set<number>;
60
+ loadingWindows: Set<number>;
61
+ }
62
+ export type ScrollDirection = 1 | -1;
63
+ interface CollectWindowStartsOptions {
64
+ direction: ScrollDirection;
65
+ endRow: number;
66
+ far?: boolean;
67
+ startRow: number;
68
+ totalRows: number;
69
+ }
70
+ export declare const createEmptyVirtualState: () => VirtualSheetState;
71
+ export declare const displayCellKey: (row: number, col: number) => string;
72
+ export declare const getDataKey: (index: number) => string;
73
+ export declare const getRowState: (row?: VirtualRow | null) => RowStateValue;
74
+ export declare const buildRows: (count: number) => VirtualRow[];
75
+ export declare const getMaxWindowStart: (totalRows: number) => number;
76
+ export declare const clampWindowStart: (startRow?: number, totalRows?: number) => number;
77
+ export declare const getWindowStart: (row?: number, totalRows?: number) => number;
78
+ export declare const collectWindowStarts: ({ startRow, endRow, direction, totalRows, far }: CollectWindowStartsOptions) => number[];
79
+ export declare const markWindowState: (rows: VirtualRow[], totalRows: number, windowStart: number, nextState: RowStateValue) => void;
80
+ export {};
@@ -0,0 +1,96 @@
1
+ export const WINDOW_SIZE = 500;
2
+ export const PREFETCH_AHEAD = 3;
3
+ export const PREFETCH_BEHIND = 1;
4
+ export const INDEX_COLUMN_KEY = '__index';
5
+ export const ROW_KEY_FIELD = '__k';
6
+ export const ROW_STATE_FIELD = '__s';
7
+ export const DEFAULT_SHEET_DEFAULTS = {
8
+ rowHeight: 20,
9
+ colWidth: 64
10
+ };
11
+ export const RowState = {
12
+ Placeholder: 0,
13
+ Loading: 1,
14
+ Loaded: 2
15
+ };
16
+ export const createEmptyVirtualState = () => ({
17
+ active: false,
18
+ totalRows: 0,
19
+ totalCols: 0,
20
+ indexOffset: 0,
21
+ defaults: { ...DEFAULT_SHEET_DEFAULTS },
22
+ dataKeys: [],
23
+ rows: [],
24
+ columns: [],
25
+ cellCache: new Map(),
26
+ mergeStartMap: new Map(),
27
+ mergeCoveredMap: new Map(),
28
+ rowHeightCache: new Map(),
29
+ windowRows: new Map(),
30
+ windowCells: new Map(),
31
+ loadedWindows: new Set(),
32
+ loadingWindows: new Set()
33
+ });
34
+ export const displayCellKey = (row, col) => {
35
+ return `${row}-${col}`;
36
+ };
37
+ export const getDataKey = (index) => {
38
+ return `c${index}`;
39
+ };
40
+ export const getRowState = (row) => {
41
+ var _a;
42
+ return (_a = row === null || row === void 0 ? void 0 : row[ROW_STATE_FIELD]) !== null && _a !== void 0 ? _a : RowState.Placeholder;
43
+ };
44
+ export const buildRows = (count) => {
45
+ const rows = new Array(count);
46
+ for (let index = 0; index < count; index += 1) {
47
+ rows[index] = {
48
+ [ROW_KEY_FIELD]: `${index}`,
49
+ [ROW_STATE_FIELD]: RowState.Placeholder
50
+ };
51
+ }
52
+ return rows;
53
+ };
54
+ export const getMaxWindowStart = (totalRows) => {
55
+ if (!totalRows) {
56
+ return 0;
57
+ }
58
+ return Math.floor(Math.max(totalRows - 1, 0) / WINDOW_SIZE) * WINDOW_SIZE;
59
+ };
60
+ export const clampWindowStart = (startRow = 0, totalRows = 0) => {
61
+ return Math.min(Math.max(startRow, 0), getMaxWindowStart(totalRows));
62
+ };
63
+ export const getWindowStart = (row = 0, totalRows = 0) => {
64
+ const start = Math.floor(Math.max(row, 0) / WINDOW_SIZE) * WINDOW_SIZE;
65
+ return clampWindowStart(start, totalRows);
66
+ };
67
+ // 视口周边始终保留一小圈热窗口,滚轮滚动和拖动滚动条都可以直接命中缓存,
68
+ // 避免每次跳转都同步等待 worker 回包。
69
+ export const collectWindowStarts = ({ startRow, endRow, direction, totalRows, far = false }) => {
70
+ const starts = new Set();
71
+ const firstWindow = getWindowStart(startRow, totalRows);
72
+ const lastWindow = getWindowStart(endRow, totalRows);
73
+ for (let current = firstWindow; current <= lastWindow; current += WINDOW_SIZE) {
74
+ starts.add(current);
75
+ }
76
+ const ahead = far ? PREFETCH_AHEAD + 1 : PREFETCH_AHEAD;
77
+ const behind = far ? PREFETCH_BEHIND + 1 : PREFETCH_BEHIND;
78
+ const anchor = direction > 0 ? lastWindow : firstWindow;
79
+ for (let step = 1; step <= ahead; step += 1) {
80
+ starts.add(clampWindowStart(anchor + direction * step * WINDOW_SIZE, totalRows));
81
+ }
82
+ for (let step = 1; step <= behind; step += 1) {
83
+ starts.add(clampWindowStart(anchor - direction * step * WINDOW_SIZE, totalRows));
84
+ }
85
+ return Array.from(starts);
86
+ };
87
+ export const markWindowState = (rows, totalRows, windowStart, nextState) => {
88
+ const endRow = Math.min(windowStart + WINDOW_SIZE, totalRows);
89
+ for (let rowIndex = windowStart; rowIndex < endRow; rowIndex += 1) {
90
+ const row = rows[rowIndex];
91
+ if (!row) {
92
+ continue;
93
+ }
94
+ row[ROW_STATE_FIELD] = nextState;
95
+ }
96
+ };
@@ -0,0 +1,27 @@
1
+ import type { Column, ConfigType } from 'e-virt-table';
2
+ import type { SheetModel } from './worker/type.js';
3
+ import { type CellStyleCache, type SheetDefaults, type VirtualSheetState } from './state.js';
4
+ export declare const INDEX_COLUMN_WIDTH = 68;
5
+ export declare const HEADER_HEIGHT = 34;
6
+ export declare const RESIZABLE_COLUMN_MIN_WIDTH = 40;
7
+ interface TableConfigOptions {
8
+ hostHeight: number;
9
+ resizableColumns?: boolean;
10
+ sheetDefaults: SheetDefaults;
11
+ virtualState: VirtualSheetState;
12
+ zoomScale?: number;
13
+ }
14
+ export declare const getRowHeight: (heights: number | number[] | undefined, index: number, fallback: number) => number;
15
+ export declare const normalizeRowHeight: (height: number | undefined, fallback: number) => number;
16
+ export declare const detectIndexOffset: (ws: SheetModel) => 1 | 0;
17
+ export declare const buildColumns: (ws: SheetModel) => {
18
+ columns: Column[];
19
+ dataKeys: string[];
20
+ };
21
+ export declare const getDisplayColumns: (columns: Column[], zoomScale?: number) => Column[];
22
+ export declare const normalizeCellStyle: (meta: {
23
+ className?: string;
24
+ style: any;
25
+ } | undefined) => CellStyleCache | undefined;
26
+ export declare const createTableConfig: ({ hostHeight, resizableColumns, sheetDefaults, virtualState, zoomScale }: TableConfigOptions) => ConfigType;
27
+ export {};