belobog-stellar-grid 1.0.0 → 1.0.1
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/README.md +78 -1
- package/belobog_stellar_grid.d.ts +71 -35
- package/belobog_stellar_grid.js +465 -403
- package/belobog_stellar_grid_bg.wasm +0 -0
- package/package.json +2 -4
- package/LICENSE_APACHE +0 -176
- package/LICENSE_MIT +0 -25
package/README.md
CHANGED
|
@@ -170,7 +170,7 @@ await export_table_to_csv_batch(
|
|
|
170
170
|
1000, // 每批处理 1000 行
|
|
171
171
|
(progress) => {
|
|
172
172
|
console.log(`进度: ${Math.round(progress)}%`);
|
|
173
|
-
}
|
|
173
|
+
},
|
|
174
174
|
);
|
|
175
175
|
```
|
|
176
176
|
|
|
@@ -319,6 +319,46 @@ basic-http-server .
|
|
|
319
319
|
# 访问: http://localhost:4000/examples/
|
|
320
320
|
```
|
|
321
321
|
|
|
322
|
+
### 发布到 npm
|
|
323
|
+
|
|
324
|
+
项目使用 `just` 进行发布管理。需要先安装 [just](https://github.com/casey/just) 和 [cargo-edit](https://github.com/killercup/cargo-edit):
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# 安装 just
|
|
328
|
+
cargo install just
|
|
329
|
+
|
|
330
|
+
# 安装 cargo-edit(用于版本管理)
|
|
331
|
+
cargo install cargo-edit
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**发布流程**:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# 1. 升级版本
|
|
338
|
+
just bump patch # 1.0.0 -> 1.0.1 (补丁版本)
|
|
339
|
+
just bump minor # 1.0.0 -> 1.1.0 (次要版本)
|
|
340
|
+
just bump major # 1.0.0 -> 2.0.0 (主要版本)
|
|
341
|
+
|
|
342
|
+
# 2. 提交更改
|
|
343
|
+
git add .
|
|
344
|
+
git commit -m "chore: bump version"
|
|
345
|
+
|
|
346
|
+
# 3. 发布到 npm
|
|
347
|
+
just publish latest # 发布稳定版
|
|
348
|
+
just publish beta # 发布 beta 版
|
|
349
|
+
just publish next # 发布 next 版
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**其他发布相关命令**:
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
just info # 查看当前版本
|
|
356
|
+
just test # 运行测试
|
|
357
|
+
just build # 构建 WASM
|
|
358
|
+
just optimize # 优化 WASM 文件大小
|
|
359
|
+
just dry-run # 发布前测试
|
|
360
|
+
```
|
|
361
|
+
|
|
322
362
|
### 项目结构
|
|
323
363
|
|
|
324
364
|
```
|
|
@@ -364,6 +404,43 @@ belobog-stellar-grid/
|
|
|
364
404
|
|
|
365
405
|
---
|
|
366
406
|
|
|
407
|
+
## 📌 TODO / 开发路线图
|
|
408
|
+
|
|
409
|
+
以下是待改进的功能点:
|
|
410
|
+
|
|
411
|
+
### 数据类型处理
|
|
412
|
+
|
|
413
|
+
- [ ] 支持数据类型自动检测(数字、日期、布尔值等)
|
|
414
|
+
- [ ] 导出时将数字类型写入 Excel 数值单元格而非文本
|
|
415
|
+
- [ ] 支持 Excel 公式导出
|
|
416
|
+
|
|
417
|
+
### 样式与格式化
|
|
418
|
+
|
|
419
|
+
- [ ] 支持基础样式设置(字体、颜色、边框、背景色)
|
|
420
|
+
- [ ] 支持列宽自动调整
|
|
421
|
+
- [ ] 支持表头行特殊样式(加粗、背景色)
|
|
422
|
+
- [ ] 支持条件格式(数据条、图标集等)
|
|
423
|
+
|
|
424
|
+
### 表格结构
|
|
425
|
+
|
|
426
|
+
- [ ] 导出时保留合并单元格状态
|
|
427
|
+
- [ ] 支持多工作表导出(多表格导出到同一 Excel 文件的不同 sheet)
|
|
428
|
+
- [ ] 支持检测并排除隐藏行/列(`display: none`)
|
|
429
|
+
|
|
430
|
+
### 数据选择与过滤
|
|
431
|
+
|
|
432
|
+
- [ ] 支持选择性导出特定行或列
|
|
433
|
+
- [ ] 支持导出前数据预处理/转换
|
|
434
|
+
- [ ] 支持自定义列名映射
|
|
435
|
+
|
|
436
|
+
### 其他
|
|
437
|
+
|
|
438
|
+
- [ ] 支持从 JavaScript 数组直接生成文件(不依赖 DOM)
|
|
439
|
+
- [ ] CSV 导出添加 BOM 头选项(兼容旧版 Excel)
|
|
440
|
+
- [ ] 探索 Node.js/服务端支持可能性
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
367
444
|
## 🤝 社区与支持
|
|
368
445
|
|
|
369
446
|
### 获取帮助
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* 导出格式枚举
|
|
6
6
|
*/
|
|
7
7
|
export enum ExportFormat {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
/**
|
|
9
|
+
* CSV 格式(默认)
|
|
10
|
+
*/
|
|
11
|
+
Csv = 0,
|
|
12
|
+
/**
|
|
13
|
+
* Excel XLSX 格式
|
|
14
|
+
*/
|
|
15
|
+
Xlsx = 1,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -57,6 +57,7 @@ export function export_table(table_id: string, filename?: string | null, format?
|
|
|
57
57
|
*
|
|
58
58
|
* 这个函数将表格数据分批处理,在批次之间让出控制权给浏览器事件循环,
|
|
59
59
|
* 从而避免在处理大量数据时阻塞主线程导致页面卡死。
|
|
60
|
+
* 支持合并单元格(colspan/rowspan)的正确处理。
|
|
60
61
|
*
|
|
61
62
|
* # 参数
|
|
62
63
|
* * `table_id` - 要导出的 HTML 表格元素的 ID
|
|
@@ -85,42 +86,77 @@ export function export_table(table_id: string, filename?: string | null, format?
|
|
|
85
86
|
*/
|
|
86
87
|
export function export_table_to_csv_batch(table_id: string, tbody_id?: string | null, filename?: string | null, batch_size?: number | null, progress_callback?: Function | null): Promise<any>;
|
|
87
88
|
|
|
89
|
+
/**
|
|
90
|
+
* 分批异步导出 HTML 表格到 XLSX 文件
|
|
91
|
+
*
|
|
92
|
+
* 采用两阶段策略避免阻塞主线程:
|
|
93
|
+
* 1. 分批读取 DOM 数据(异步,可 yield 让出控制权)
|
|
94
|
+
* 2. 同步生成 XLSX 文件(内存操作,快速)
|
|
95
|
+
*
|
|
96
|
+
* # 参数
|
|
97
|
+
* * `table_id` - 要导出的 HTML 表格元素的 ID
|
|
98
|
+
* * `tbody_id` - 可选的数据表格体 ID(用于分离表头和数据)
|
|
99
|
+
* * `filename` - 可选的导出文件名(默认为 "table_export.xlsx")
|
|
100
|
+
* * `batch_size` - 每批处理的行数(默认 1000)
|
|
101
|
+
* * `progress_callback` - 进度回调函数,接收进度百分比 (0-100)
|
|
102
|
+
*
|
|
103
|
+
* # 返回值
|
|
104
|
+
* * `Promise<void>` - 异步操作的 Promise
|
|
105
|
+
*
|
|
106
|
+
* # 示例
|
|
107
|
+
* ```javascript
|
|
108
|
+
* import { export_table_to_xlsx_batch } from './pkg/belobog_stellar_grid.js';
|
|
109
|
+
*
|
|
110
|
+
* await export_table_to_xlsx_batch(
|
|
111
|
+
* 'my-table',
|
|
112
|
+
* 'my-tbody', // 可选的 tbody ID
|
|
113
|
+
* 'data.xlsx',
|
|
114
|
+
* 1000, // 每批 1000 行
|
|
115
|
+
* (progress) => {
|
|
116
|
+
* console.log(`进度: ${progress}%`);
|
|
117
|
+
* }
|
|
118
|
+
* );
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export function export_table_to_xlsx_batch(table_id: string, tbody_id?: string | null, filename?: string | null, batch_size?: number | null, progress_callback?: Function | null): Promise<any>;
|
|
122
|
+
|
|
88
123
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
89
124
|
|
|
90
125
|
export interface InitOutput {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
126
|
+
readonly memory: WebAssembly.Memory;
|
|
127
|
+
readonly export_table: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
128
|
+
readonly export_table_to_csv_batch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
129
|
+
readonly export_table_to_xlsx_batch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
130
|
+
readonly wasm_bindgen__closure__destroy__hfa0c196dc31165a7: (a: number, b: number) => void;
|
|
131
|
+
readonly wasm_bindgen__convert__closures_____invoke__h532f206189913be7: (a: number, b: number, c: any, d: any) => void;
|
|
132
|
+
readonly wasm_bindgen__convert__closures_____invoke__h44abe8207b381064: (a: number, b: number, c: any) => void;
|
|
133
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
134
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
135
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
136
|
+
readonly __externref_table_alloc: () => number;
|
|
137
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
138
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
139
|
+
readonly __wbindgen_start: () => void;
|
|
104
140
|
}
|
|
105
141
|
|
|
106
142
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
107
143
|
|
|
108
144
|
/**
|
|
109
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
110
|
-
* a precompiled `WebAssembly.Module`.
|
|
111
|
-
*
|
|
112
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
113
|
-
*
|
|
114
|
-
* @returns {InitOutput}
|
|
115
|
-
*/
|
|
145
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
146
|
+
* a precompiled `WebAssembly.Module`.
|
|
147
|
+
*
|
|
148
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
149
|
+
*
|
|
150
|
+
* @returns {InitOutput}
|
|
151
|
+
*/
|
|
116
152
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
117
153
|
|
|
118
154
|
/**
|
|
119
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
120
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
121
|
-
*
|
|
122
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
123
|
-
*
|
|
124
|
-
* @returns {Promise<InitOutput>}
|
|
125
|
-
*/
|
|
155
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
156
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
157
|
+
*
|
|
158
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
159
|
+
*
|
|
160
|
+
* @returns {Promise<InitOutput>}
|
|
161
|
+
*/
|
|
126
162
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|