@bsg-export/react 1.0.6 → 1.0.7

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 ADDED
@@ -0,0 +1,100 @@
1
+ # @bsg-export/react
2
+
3
+ [![npm](https://img.shields.io/npm/v/@bsg-export/react)](https://www.npmjs.com/package/@bsg-export/react)
4
+
5
+ > [belobog-stellar-grid](https://github.com/kurisu994/belobog-stellar-grid) 的 React 官方封装
6
+
7
+ ## 简介
8
+
9
+ 提供 `useExporter` Hook 和 `ExportButton` 组件,自动管理 WASM 初始化、导出状态和进度追踪。
10
+
11
+ ## 安装
12
+
13
+ ```bash
14
+ npm install @bsg-export/react belobog-stellar-grid
15
+ # 或
16
+ pnpm add @bsg-export/react belobog-stellar-grid
17
+ ```
18
+
19
+ **前置依赖**:`react >= 17.0.0`、`belobog-stellar-grid >= 1.0.0`
20
+
21
+ ## 快速开始
22
+
23
+ ### useExporter Hook
24
+
25
+ ```tsx
26
+ import { useExporter, ExportFormat } from '@bsg-export/react';
27
+
28
+ function App() {
29
+ const { initialized, loading, progress, error, exportTable, exportData } = useExporter();
30
+
31
+ return (
32
+ <button
33
+ disabled={!initialized || loading}
34
+ onClick={() =>
35
+ exportTable({
36
+ tableId: 'my-table',
37
+ filename: '报表.xlsx',
38
+ format: ExportFormat.Xlsx,
39
+ })
40
+ }
41
+ >
42
+ {loading ? `导出中 ${Math.round(progress)}%` : '导出 Excel'}
43
+ </button>
44
+ );
45
+ }
46
+ ```
47
+
48
+ ### ExportButton 组件
49
+
50
+ ```tsx
51
+ import { ExportButton, ExportFormat } from '@bsg-export/react';
52
+
53
+ <ExportButton
54
+ tableId="my-table"
55
+ filename="报表.xlsx"
56
+ format={ExportFormat.Xlsx}
57
+ onExportSuccess={() => console.log('导出成功')}
58
+ onExportError={(err) => console.error('导出失败', err)}
59
+ >
60
+ 导出 Excel
61
+ </ExportButton>
62
+ ```
63
+
64
+ ## API
65
+
66
+ ### `useExporter()` 返回值
67
+
68
+ | 属性/方法 | 类型 | 说明 |
69
+ |-----------|------|------|
70
+ | `initialized` | `boolean` | WASM 是否初始化完成 |
71
+ | `loading` | `boolean` | 是否正在导出 |
72
+ | `progress` | `number` | 导出进度 (0-100) |
73
+ | `error` | `Error \| null` | 错误信息 |
74
+ | `exportTable` | `(options) => void` | DOM 表格导出 |
75
+ | `exportData` | `(data, options?) => void` | 纯数据导出 |
76
+ | `exportTablesXlsx` | `(options) => void` | 多 Sheet 导出 |
77
+ | `exportCsvBatch` | `(options) => Promise` | CSV 分批导出 |
78
+ | `exportXlsxBatch` | `(options) => Promise` | XLSX 分批导出 |
79
+ | `exportTablesBatch` | `(options) => Promise` | 多 Sheet 分批导出 |
80
+
81
+ ### `<ExportButton>` Props
82
+
83
+ 继承所有 `<button>` HTML 属性,额外支持:
84
+
85
+ | Prop | 类型 | 默认值 | 说明 |
86
+ |------|------|--------|------|
87
+ | `tableId` | `string` | — | 要导出的表格 ID(必填) |
88
+ | `filename` | `string` | — | 导出文件名 |
89
+ | `format` | `ExportFormat` | `Csv` | 导出格式 |
90
+ | `excludeHidden` | `boolean` | `false` | 排除隐藏行/列 |
91
+ | `withBom` | `boolean` | `false` | 添加 UTF-8 BOM |
92
+ | `onExportSuccess` | `() => void` | — | 导出成功回调 |
93
+ | `onExportError` | `(error) => void` | — | 导出失败回调 |
94
+ | `onExportProgress` | `(progress) => void` | — | 进度变化回调 |
95
+ | `initializingText` | `string` | `'初始化中...'` | 初始化中按钮文本 |
96
+ | `loadingText` | `string` | `'导出中 {progress}%'` | 导出中按钮文本 |
97
+
98
+ ## 许可证
99
+
100
+ MIT OR Apache-2.0
@@ -34,18 +34,18 @@ export function ExportButton({ tableId, filename, format, excludeHidden, withBom
34
34
  buttonProps.onClick?.(e);
35
35
  if (e.defaultPrevented)
36
36
  return;
37
- exportTable({
37
+ const success = exportTable({
38
38
  tableId,
39
39
  filename,
40
40
  format,
41
41
  excludeHidden,
42
42
  withBom,
43
43
  });
44
- // 导出成功回调(同步导出完成后立即触发)
45
- if (onExportSuccess && !error) {
44
+ // 导出成功回调(同步导出完成后检查返回值)
45
+ if (success && onExportSuccess) {
46
46
  onExportSuccess();
47
47
  }
48
- }, [tableId, filename, format, excludeHidden, withBom, exportTable, onExportSuccess, error, buttonProps]);
48
+ }, [tableId, filename, format, excludeHidden, withBom, exportTable, onExportSuccess, buttonProps]);
49
49
  /** 渲染按钮文本 */
50
50
  const renderText = () => {
51
51
  if (!initialized)
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  export { useExporter } from './use-exporter';
9
- export type { UseExporterReturn, ExportTableOptions, ExportTablesXlsxOptions, ExportCsvBatchOptions, ExportXlsxBatchOptions, ExportTablesBatchOptions, } from './use-exporter';
9
+ export type { UseExporterReturn, } from './use-exporter';
10
10
  export { ExportButton } from './ExportButton';
11
11
  export type { ExportButtonProps } from './ExportButton';
12
- export type { Column, MergeCellValue, CellValue, MergeableCellValue, DataRow, ExportDataOptions, SheetConfig, BatchSheetConfig, ProgressCallback, } from '@bsg-export/types';
12
+ export type { Column, MergeCellValue, CellValue, MergeableCellValue, DataRow, ExportDataOptions, SheetConfig, BatchSheetConfig, ProgressCallback, ExportTableOptions, ExportTablesXlsxOptions, ExportCsvBatchOptions, ExportXlsxBatchOptions, ExportTablesBatchOptions, } from '@bsg-export/types';
13
13
  export { ExportFormat } from '@bsg-export/types';
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,YAAY,EACV,MAAM,EACN,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACV,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,YAAY,EACV,MAAM,EACN,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -15,66 +15,7 @@
15
15
  * );
16
16
  * ```
17
17
  */
18
- import type { ExportFormat, ExportDataOptions, SheetConfig, BatchSheetConfig, DataRow } from '@bsg-export/types';
19
- /** export_table 的参数配置 */
20
- export interface ExportTableOptions {
21
- /** 要导出的 HTML 表格元素的 ID */
22
- tableId: string;
23
- /** 导出文件名 */
24
- filename?: string;
25
- /** 导出格式 */
26
- format?: ExportFormat;
27
- /** 是否排除隐藏行/列 */
28
- excludeHidden?: boolean;
29
- /** 是否添加 UTF-8 BOM(仅 CSV 有效) */
30
- withBom?: boolean;
31
- /** 回调失败是否中断导出 */
32
- strictProgressCallback?: boolean;
33
- }
34
- /** 多工作表导出的参数配置 */
35
- export interface ExportTablesXlsxOptions {
36
- /** Sheet 配置数组 */
37
- sheets: SheetConfig[];
38
- /** 导出文件名 */
39
- filename?: string;
40
- }
41
- /** 分批导出 CSV 的参数配置 */
42
- export interface ExportCsvBatchOptions {
43
- /** 要导出的 HTML 表格元素的 ID */
44
- tableId: string;
45
- /** 可选的独立 tbody ID */
46
- tbodyId?: string;
47
- /** 导出文件名 */
48
- filename?: string;
49
- /** 每批处理行数 */
50
- batchSize?: number;
51
- /** 是否排除隐藏行/列 */
52
- excludeHidden?: boolean;
53
- /** 是否添加 UTF-8 BOM */
54
- withBom?: boolean;
55
- }
56
- /** 分批导出 XLSX 的参数配置 */
57
- export interface ExportXlsxBatchOptions {
58
- /** 要导出的 HTML 表格元素的 ID */
59
- tableId: string;
60
- /** 可选的独立 tbody ID */
61
- tbodyId?: string;
62
- /** 导出文件名 */
63
- filename?: string;
64
- /** 每批处理行数 */
65
- batchSize?: number;
66
- /** 是否排除隐藏行/列 */
67
- excludeHidden?: boolean;
68
- }
69
- /** 多工作表分批导出的参数配置 */
70
- export interface ExportTablesBatchOptions {
71
- /** Sheet 配置数组 */
72
- sheets: BatchSheetConfig[];
73
- /** 导出文件名 */
74
- filename?: string;
75
- /** 每批处理行数 */
76
- batchSize?: number;
77
- }
18
+ import type { ExportDataOptions, ExportTableOptions, ExportTablesXlsxOptions, ExportCsvBatchOptions, ExportXlsxBatchOptions, ExportTablesBatchOptions, DataRow } from '@bsg-export/types';
78
19
  /** useExporter Hook 的返回值 */
79
20
  export interface UseExporterReturn {
80
21
  /** WASM 是否已初始化完成 */
@@ -86,17 +27,17 @@ export interface UseExporterReturn {
86
27
  /** 错误信息 */
87
28
  error: Error | null;
88
29
  /** 导出 HTML 表格 */
89
- exportTable: (options: ExportTableOptions) => void;
30
+ exportTable: (options: ExportTableOptions) => boolean;
90
31
  /** 从 JS 数组直接导出 */
91
- exportData: (data: DataRow[], options?: ExportDataOptions) => void;
32
+ exportData: (data: DataRow[], options?: ExportDataOptions) => boolean;
92
33
  /** 多工作表同步导出 */
93
- exportTablesXlsx: (options: ExportTablesXlsxOptions) => void;
34
+ exportTablesXlsx: (options: ExportTablesXlsxOptions) => boolean;
94
35
  /** 分批异步导出 CSV */
95
- exportCsvBatch: (options: ExportCsvBatchOptions) => Promise<void>;
36
+ exportCsvBatch: (options: ExportCsvBatchOptions) => Promise<boolean>;
96
37
  /** 分批异步导出 XLSX */
97
- exportXlsxBatch: (options: ExportXlsxBatchOptions) => Promise<void>;
38
+ exportXlsxBatch: (options: ExportXlsxBatchOptions) => Promise<boolean>;
98
39
  /** 多工作表分批异步导出 */
99
- exportTablesBatch: (options: ExportTablesBatchOptions) => Promise<void>;
40
+ exportTablesBatch: (options: ExportTablesBatchOptions) => Promise<boolean>;
100
41
  }
101
42
  /**
102
43
  * WASM 导出管理 Hook
@@ -1 +1 @@
1
- {"version":3,"file":"use-exporter.d.ts","sourceRoot":"","sources":["../src/use-exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAEhB,OAAO,EACR,MAAM,mBAAmB,CAAC;AAE3B,yBAAyB;AACzB,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,gBAAgB;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,kBAAkB;AAClB,MAAM,WAAW,uBAAuB;IACtC,iBAAiB;IACjB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB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ChE,iBAAiB;IACjB,cAAc,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,kBAAkB;IAClB,eAAe,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvE,iBAAiB;IACjB,iBAAiB,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5E;AA6BD;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAgL/C"}
@@ -26,10 +26,16 @@ async function initWasm() {
26
26
  if (wasmModule)
27
27
  return wasmModule;
28
28
  if (!wasmInitPromise) {
29
- wasmInitPromise = import('belobog-stellar-grid').then(async (mod) => {
29
+ wasmInitPromise = import('belobog-stellar-grid')
30
+ .then(async (mod) => {
30
31
  await mod.default();
31
32
  wasmModule = mod;
32
33
  return mod;
34
+ })
35
+ .catch((err) => {
36
+ // 初始化失败时重置 Promise,允许后续调用重试
37
+ wasmInitPromise = null;
38
+ throw err;
33
39
  });
34
40
  }
35
41
  return wasmInitPromise;
@@ -71,7 +77,7 @@ export function useExporter() {
71
77
  /** 包装同步导出操作 */
72
78
  const wrapSync = useCallback((fn) => {
73
79
  if (!initialized || !wasmModule)
74
- return;
80
+ return false;
75
81
  setLoading(true);
76
82
  setProgress(0);
77
83
  setError(null);
@@ -79,10 +85,12 @@ export function useExporter() {
79
85
  fn();
80
86
  if (mountedRef.current)
81
87
  setProgress(100);
88
+ return true;
82
89
  }
83
90
  catch (err) {
84
91
  if (mountedRef.current)
85
92
  setError(err instanceof Error ? err : new Error(String(err)));
93
+ return false;
86
94
  }
87
95
  finally {
88
96
  if (mountedRef.current)
@@ -92,7 +100,7 @@ export function useExporter() {
92
100
  /** 包装异步导出操作 */
93
101
  const wrapAsync = useCallback(async (fn) => {
94
102
  if (!initialized || !wasmModule)
95
- return;
103
+ return false;
96
104
  setLoading(true);
97
105
  setProgress(0);
98
106
  setError(null);
@@ -100,10 +108,12 @@ export function useExporter() {
100
108
  await fn();
101
109
  if (mountedRef.current)
102
110
  setProgress(100);
111
+ return true;
103
112
  }
104
113
  catch (err) {
105
114
  if (mountedRef.current)
106
115
  setError(err instanceof Error ? err : new Error(String(err)));
116
+ return false;
107
117
  }
108
118
  finally {
109
119
  if (mountedRef.current)
@@ -111,12 +121,12 @@ export function useExporter() {
111
121
  }
112
122
  }, [initialized]);
113
123
  const exportTable = useCallback((options) => {
114
- wrapSync(() => {
124
+ return wrapSync(() => {
115
125
  wasmModule.export_table(options.tableId, options.filename, options.format, options.excludeHidden, createProgressCallback(), options.withBom, options.strictProgressCallback);
116
126
  });
117
127
  }, [wrapSync, createProgressCallback]);
118
128
  const exportData = useCallback((data, options) => {
119
- wrapSync(() => {
129
+ return wrapSync(() => {
120
130
  const opts = options
121
131
  ? { ...options, progressCallback: options.progressCallback ?? createProgressCallback() }
122
132
  : { progressCallback: createProgressCallback() };
@@ -124,23 +134,23 @@ export function useExporter() {
124
134
  });
125
135
  }, [wrapSync, createProgressCallback]);
126
136
  const exportTablesXlsx = useCallback((options) => {
127
- wrapSync(() => {
128
- wasmModule.export_tables_xlsx(options.sheets, options.filename, createProgressCallback());
137
+ return wrapSync(() => {
138
+ wasmModule.export_tables_xlsx(options.sheets, options.filename, createProgressCallback(), options.strictProgressCallback);
129
139
  });
130
140
  }, [wrapSync, createProgressCallback]);
131
141
  const exportCsvBatch = useCallback(async (options) => {
132
- await wrapAsync(async () => {
133
- await wasmModule.export_table_to_csv_batch(options.tableId, options.tbodyId, options.filename, options.batchSize, options.excludeHidden, createProgressCallback(), options.withBom);
142
+ return await wrapAsync(async () => {
143
+ await wasmModule.export_table_to_csv_batch(options.tableId, options.tbodyId, options.filename, options.batchSize, options.excludeHidden, createProgressCallback(), options.withBom, options.strictProgressCallback);
134
144
  });
135
145
  }, [wrapAsync, createProgressCallback]);
136
146
  const exportXlsxBatch = useCallback(async (options) => {
137
- await wrapAsync(async () => {
138
- await wasmModule.export_table_to_xlsx_batch(options.tableId, options.tbodyId, options.filename, options.batchSize, options.excludeHidden, createProgressCallback());
147
+ return await wrapAsync(async () => {
148
+ await wasmModule.export_table_to_xlsx_batch(options.tableId, options.tbodyId, options.filename, options.batchSize, options.excludeHidden, createProgressCallback(), options.strictProgressCallback);
139
149
  });
140
150
  }, [wrapAsync, createProgressCallback]);
141
151
  const exportTablesBatch = useCallback(async (options) => {
142
- await wrapAsync(async () => {
143
- await wasmModule.export_tables_to_xlsx_batch(options.sheets, options.filename, options.batchSize, createProgressCallback());
152
+ return await wrapAsync(async () => {
153
+ await wasmModule.export_tables_to_xlsx_batch(options.sheets, options.filename, options.batchSize, createProgressCallback(), options.strictProgressCallback);
144
154
  });
145
155
  }, [wrapAsync, createProgressCallback]);
146
156
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsg-export/react",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "belobog-stellar-grid 的 React 官方封装组件",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",