Skip to content

Commit 9f68a10

Browse files
authored
Merge pull request #9 from AS-Devs/upgrade/bugfix-plan
Upgrade/bugfix plan
2 parents 82fe11d + 2cb1b28 commit 9f68a10

29 files changed

Lines changed: 1749 additions & 3713 deletions

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ name: NPM package Publish
44

55
on:
66
push:
7-
branches: ["main"]
7+
branches: [ "main" ]
88
pull_request:
9-
branches: ["main"]
9+
branches: [ "main" ]
1010

1111
jobs:
1212
quality:
1313
runs-on: ubuntu-latest
1414

1515
strategy:
1616
matrix:
17-
node-version: [18.x]
17+
node-version: [ 18.x ]
1818

1919
steps:
2020
- uses: actions/checkout@v3
@@ -28,15 +28,16 @@ jobs:
2828
publish:
2929
runs-on: ubuntu-latest
3030
if: ${{github.ref == 'refs/heads/main'}}
31-
needs: [quality]
31+
needs: [ quality ]
3232
steps:
3333
- uses: actions/checkout@v3
34-
- name: Use Node.js ${{ matrix.node-version }}
34+
- name: Use Node.js 18.x
3535
uses: actions/setup-node@v3
3636
with:
37-
node-version: ${{ matrix.node-version }}
37+
node-version: 18.x
3838
cache: "npm"
3939
- run: npm ci
40+
- run: npm run build
4041
- run: npm run semantic-release
4142
env:
4243
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
node_modules
33
*.log
44
.idea/
5-
coverage/
5+
coverage/
6+
.claude/
7+
CLAUDE.md
8+
docs/
9+
src-js/

.npmignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 AS Developers
3+
Copyright (c) 2026 AS Developers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,75 @@ pnpm add react-xlsx-wrapper@latest
2525
yarn add react-xlsx-wrapper@latest
2626
```
2727

28+
## Framework Support
29+
30+
### Next.js (App Router)
31+
32+
This library is a **client-only** component — it uses browser APIs (`Blob`, `URL.createObjectURL`) to trigger downloads. Wrap it with `'use client'` in your component:
33+
34+
```tsx
35+
'use client';
36+
37+
import { ExcelFile, ExcelSheet, ExcelColumn } from 'react-xlsx-wrapper';
38+
39+
export function ExportButton({ data }: { data: any[] }) {
40+
return (
41+
<ExcelFile filename="report" element={<button>Download</button>}>
42+
<ExcelSheet name="Sheet1" data={data}>
43+
<ExcelColumn label="Name" value="name" />
44+
<ExcelColumn label="Email" value="email" />
45+
</ExcelSheet>
46+
</ExcelFile>
47+
);
48+
}
49+
```
50+
51+
If the parent is a Server Component, lazy-load to avoid SSR:
52+
53+
```tsx
54+
import dynamic from 'next/dynamic';
55+
56+
const ExportButton = dynamic(() => import('./ExportButton'), { ssr: false });
57+
```
58+
59+
> **Note:** Server-side Excel generation (e.g. from an API route) is not supported. The library is designed for browser downloads only.
60+
61+
### Vite
62+
63+
Works out of the box with Vite via the ESM entry point (`dist/index.mjs`). No additional config needed.
64+
65+
If you encounter CJS interop warnings with an older version of this package, add to `vite.config.ts`:
66+
67+
```ts
68+
optimizeDeps: { include: ['react-xlsx-wrapper', 'xlsx-js-style'] }
69+
```
70+
71+
### TanStack (Router / Query / Table)
72+
73+
Fully compatible. Pass filtered/sorted rows from TanStack Table directly as the `data` prop:
74+
75+
```tsx
76+
'use client'; // if using Next.js App Router
77+
78+
import { useReactTable, getCoreRowModel } from '@tanstack/react-table';
79+
import { ExcelFile, ExcelSheet, ExcelColumn } from 'react-xlsx-wrapper';
80+
81+
export function DataTable({ data }) {
82+
const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
83+
84+
return (
85+
<>
86+
{/* your table UI */}
87+
<ExcelFile filename="export" element={<button>Export</button>}>
88+
<ExcelSheet name="Data" data={table.getFilteredRowModel().rows.map(r => r.original)}>
89+
<ExcelColumn label="Name" value="name" />
90+
</ExcelSheet>
91+
</ExcelFile>
92+
</>
93+
);
94+
}
95+
```
96+
2897
## Code Examples
2998

3099
- [Simple Excel Export](examples/simple_excel_export_01.md)

babel.config.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

dist/ExcelPlugin/components/ExcelFile.js

Lines changed: 0 additions & 151 deletions
This file was deleted.

dist/ExcelPlugin/elements/ExcelColumn.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)