belobog-stellar-grid 1.0.0
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_APACHE +176 -0
- package/LICENSE_MIT +25 -0
- package/README.md +413 -0
- package/belobog_stellar_grid.d.ts +126 -0
- package/belobog_stellar_grid.js +690 -0
- package/belobog_stellar_grid_bg.wasm +0 -0
- package/package.json +33 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 导出格式枚举
|
|
6
|
+
*/
|
|
7
|
+
export enum ExportFormat {
|
|
8
|
+
/**
|
|
9
|
+
* CSV 格式(默认)
|
|
10
|
+
*/
|
|
11
|
+
Csv = 0,
|
|
12
|
+
/**
|
|
13
|
+
* Excel XLSX 格式
|
|
14
|
+
*/
|
|
15
|
+
Xlsx = 1,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 统一的表格导出函数(带进度回调)
|
|
20
|
+
*
|
|
21
|
+
* 支持导出为 CSV 或 Excel 格式,通过 format 参数控制,支持进度回调
|
|
22
|
+
*
|
|
23
|
+
* # 参数
|
|
24
|
+
* * `table_id` - 要导出的 HTML 表格元素的 ID
|
|
25
|
+
* * `filename` - 可选的导出文件名(不包含扩展名时会自动添加)
|
|
26
|
+
* * `format` - 导出格式(Csv 或 Xlsx),默认为 Csv
|
|
27
|
+
* * `progress_callback` - 可选的进度回调函数,接收 0-100 的进度值
|
|
28
|
+
*
|
|
29
|
+
* # 返回值
|
|
30
|
+
* * `Ok(())` - 导出成功
|
|
31
|
+
* * `Err(JsValue)` - 导出失败,包含错误信息
|
|
32
|
+
*
|
|
33
|
+
* # 示例
|
|
34
|
+
* ```javascript
|
|
35
|
+
* import init, { export_table, ExportFormat } from './pkg/excel_exporter.js';
|
|
36
|
+
* await init();
|
|
37
|
+
*
|
|
38
|
+
* // 导出为 CSV(默认,无进度回调)
|
|
39
|
+
* export_table('my-table');
|
|
40
|
+
* export_table('my-table', '数据.csv');
|
|
41
|
+
*
|
|
42
|
+
* // 导出为 CSV(带进度回调)
|
|
43
|
+
* export_table('my-table', '数据', ExportFormat.Csv, (progress) => {
|
|
44
|
+
* console.log(`进度: ${progress.toFixed(1)}%`);
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // 导出为 Excel(带进度回调)
|
|
48
|
+
* export_table('my-table', '报表', ExportFormat.Xlsx, (progress) => {
|
|
49
|
+
* document.getElementById('progress').style.width = `${progress}%`;
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export function export_table(table_id: string, filename?: string | null, format?: ExportFormat | null, progress_callback?: Function | null): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 分批异步导出 HTML 表格到 CSV 文件
|
|
57
|
+
*
|
|
58
|
+
* 这个函数将表格数据分批处理,在批次之间让出控制权给浏览器事件循环,
|
|
59
|
+
* 从而避免在处理大量数据时阻塞主线程导致页面卡死。
|
|
60
|
+
*
|
|
61
|
+
* # 参数
|
|
62
|
+
* * `table_id` - 要导出的 HTML 表格元素的 ID
|
|
63
|
+
* * `tbody_id` - 可选的数据表格体 ID(用于分离表头和数据)
|
|
64
|
+
* * `filename` - 可选的导出文件名(可选,默认为 "table_export.csv")
|
|
65
|
+
* * `batch_size` - 每批处理的行数(默认 1000)
|
|
66
|
+
* * `progress_callback` - 进度回调函数,接收进度百分比 (0-100)
|
|
67
|
+
*
|
|
68
|
+
* # 返回值
|
|
69
|
+
* * `Promise<void>` - 异步操作的 Promise
|
|
70
|
+
*
|
|
71
|
+
* # 示例
|
|
72
|
+
* ```javascript
|
|
73
|
+
* import { export_table_to_csv_batch } from './pkg/excel_exporter.js';
|
|
74
|
+
*
|
|
75
|
+
* await export_table_to_csv_batch(
|
|
76
|
+
* 'my-table',
|
|
77
|
+
* 'my-tbody', // 可选的 tbody ID
|
|
78
|
+
* 'data.csv',
|
|
79
|
+
* 1000, // 每批 1000 行
|
|
80
|
+
* (progress) => {
|
|
81
|
+
* console.log(`进度: ${progress}%`);
|
|
82
|
+
* }
|
|
83
|
+
* );
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
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
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
89
|
+
|
|
90
|
+
export interface InitOutput {
|
|
91
|
+
readonly memory: WebAssembly.Memory;
|
|
92
|
+
readonly export_table: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
93
|
+
readonly export_table_to_csv_batch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
94
|
+
readonly wasm_bindgen__convert__closures_____invoke__hd548f8095fd5fd71: (a: number, b: number, c: any) => void;
|
|
95
|
+
readonly wasm_bindgen__closure__destroy__hd85ddfaf9b76fe33: (a: number, b: number) => void;
|
|
96
|
+
readonly wasm_bindgen__convert__closures_____invoke__h27f1beedb8b1e394: (a: number, b: number, c: any, d: any) => void;
|
|
97
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
98
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
99
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
100
|
+
readonly __externref_table_alloc: () => number;
|
|
101
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
102
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
103
|
+
readonly __wbindgen_start: () => void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
107
|
+
|
|
108
|
+
/**
|
|
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
|
+
*/
|
|
116
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
117
|
+
|
|
118
|
+
/**
|
|
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
|
+
*/
|
|
126
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|