@gulibs/react-vtable 0.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.
Files changed (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +551 -0
  3. package/dist/components/batch-action-buttons.d.ts +23 -0
  4. package/dist/components/batch-action-buttons.d.ts.map +1 -0
  5. package/dist/components/batch-actions.d.ts +26 -0
  6. package/dist/components/batch-actions.d.ts.map +1 -0
  7. package/dist/components/column-filter.d.ts +17 -0
  8. package/dist/components/column-filter.d.ts.map +1 -0
  9. package/dist/components/column-setting.d.ts +14 -0
  10. package/dist/components/column-setting.d.ts.map +1 -0
  11. package/dist/components/copy-button.d.ts +10 -0
  12. package/dist/components/copy-button.d.ts.map +1 -0
  13. package/dist/components/editable-actions.d.ts +15 -0
  14. package/dist/components/editable-actions.d.ts.map +1 -0
  15. package/dist/components/editable-cell.d.ts +13 -0
  16. package/dist/components/editable-cell.d.ts.map +1 -0
  17. package/dist/components/pagination.d.ts +7 -0
  18. package/dist/components/pagination.d.ts.map +1 -0
  19. package/dist/components/search.d.ts +10 -0
  20. package/dist/components/search.d.ts.map +1 -0
  21. package/dist/components/toolbar.d.ts +19 -0
  22. package/dist/components/toolbar.d.ts.map +1 -0
  23. package/dist/components/ui/alert.d.ts +10 -0
  24. package/dist/components/ui/alert.d.ts.map +1 -0
  25. package/dist/components/ui/avatar.d.ts +7 -0
  26. package/dist/components/ui/avatar.d.ts.map +1 -0
  27. package/dist/components/ui/badge.d.ts +10 -0
  28. package/dist/components/ui/badge.d.ts.map +1 -0
  29. package/dist/components/ui/button.d.ts +11 -0
  30. package/dist/components/ui/button.d.ts.map +1 -0
  31. package/dist/components/ui/calendar.d.ts +9 -0
  32. package/dist/components/ui/calendar.d.ts.map +1 -0
  33. package/dist/components/ui/card.d.ts +10 -0
  34. package/dist/components/ui/card.d.ts.map +1 -0
  35. package/dist/components/ui/checkbox.d.ts +5 -0
  36. package/dist/components/ui/checkbox.d.ts.map +1 -0
  37. package/dist/components/ui/date-picker.d.ts +14 -0
  38. package/dist/components/ui/date-picker.d.ts.map +1 -0
  39. package/dist/components/ui/date-range-picker.d.ts +16 -0
  40. package/dist/components/ui/date-range-picker.d.ts.map +1 -0
  41. package/dist/components/ui/dropdown-menu.d.ts +26 -0
  42. package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
  43. package/dist/components/ui/input.d.ts +4 -0
  44. package/dist/components/ui/input.d.ts.map +1 -0
  45. package/dist/components/ui/label.d.ts +5 -0
  46. package/dist/components/ui/label.d.ts.map +1 -0
  47. package/dist/components/ui/popover.d.ts +8 -0
  48. package/dist/components/ui/popover.d.ts.map +1 -0
  49. package/dist/components/ui/progress.d.ts +5 -0
  50. package/dist/components/ui/progress.d.ts.map +1 -0
  51. package/dist/components/ui/select.d.ts +16 -0
  52. package/dist/components/ui/select.d.ts.map +1 -0
  53. package/dist/components/ui/skeleton.d.ts +3 -0
  54. package/dist/components/ui/skeleton.d.ts.map +1 -0
  55. package/dist/components/ui/switch.d.ts +5 -0
  56. package/dist/components/ui/switch.d.ts.map +1 -0
  57. package/dist/components/ui/table.d.ts +11 -0
  58. package/dist/components/ui/table.d.ts.map +1 -0
  59. package/dist/components/ui/textarea.d.ts +6 -0
  60. package/dist/components/ui/textarea.d.ts.map +1 -0
  61. package/dist/components/ui/tooltip.d.ts +8 -0
  62. package/dist/components/ui/tooltip.d.ts.map +1 -0
  63. package/dist/hooks/useColumns.d.ts +19 -0
  64. package/dist/hooks/useColumns.d.ts.map +1 -0
  65. package/dist/hooks/useProTable.d.ts +69 -0
  66. package/dist/hooks/useProTable.d.ts.map +1 -0
  67. package/dist/hooks/useRequest.d.ts +24 -0
  68. package/dist/hooks/useRequest.d.ts.map +1 -0
  69. package/dist/index.cjs +75 -0
  70. package/dist/index.css +1 -0
  71. package/dist/index.d.ts +36 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +21889 -0
  74. package/dist/locale/context.d.ts +10 -0
  75. package/dist/locale/context.d.ts.map +1 -0
  76. package/dist/locale/en_US.d.ts +3 -0
  77. package/dist/locale/en_US.d.ts.map +1 -0
  78. package/dist/locale/types.d.ts +59 -0
  79. package/dist/locale/types.d.ts.map +1 -0
  80. package/dist/locale/zh_CN.d.ts +3 -0
  81. package/dist/locale/zh_CN.d.ts.map +1 -0
  82. package/dist/pro-table.d.ts +7 -0
  83. package/dist/pro-table.d.ts.map +1 -0
  84. package/dist/styles/constants.d.ts +49 -0
  85. package/dist/styles/constants.d.ts.map +1 -0
  86. package/dist/types.d.ts +234 -0
  87. package/dist/types.d.ts.map +1 -0
  88. package/dist/utils/helpers.d.ts +74 -0
  89. package/dist/utils/helpers.d.ts.map +1 -0
  90. package/dist/utils/index.d.ts +5 -0
  91. package/dist/utils/index.d.ts.map +1 -0
  92. package/dist/utils/value-type.d.ts +10 -0
  93. package/dist/utils/value-type.d.ts.map +1 -0
  94. package/dist/vite.svg +1 -0
  95. package/package.json +86 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 @gulibs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,551 @@
1
+ # @gulibs/react-vtable
2
+
3
+ [English](#english) | [中文](#chinese)
4
+
5
+ ---
6
+
7
+ ## English
8
+
9
+ A powerful React table component library built with shadcn/ui components and TanStack Table.
10
+
11
+ ### Prerequisites
12
+
13
+ This library requires **Tailwind CSS** to be installed and configured in your project.
14
+
15
+ ### Installation
16
+
17
+ ```bash
18
+ # Install the library
19
+ pnpm add @gulibs/react-vtable
20
+
21
+ # Install peer dependencies
22
+ pnpm add react react-dom tailwindcss
23
+ ```
24
+
25
+ ### Configuration
26
+
27
+ #### Configure Tailwind CSS
28
+
29
+ ```javascript
30
+ // tailwind.config.js
31
+ export default {
32
+ content: [
33
+ './src/**/*.{js,ts,jsx,tsx}',
34
+ './node_modules/@gulibs/react-vtable/dist/**/*.js'
35
+ ],
36
+ // No additional configuration needed - styles are automatically injected
37
+ }
38
+ ```
39
+
40
+ > 💡 **Note**: The library automatically injects its CSS styles, so no manual CSS imports are required.
41
+
42
+ ### Usage
43
+
44
+ ```tsx
45
+ import { ProTable } from '@gulibs/react-vtable'
46
+ // No need to manually import CSS, styles are automatically inlined
47
+
48
+ function App() {
49
+ const columns = [
50
+ {
51
+ title: 'Name',
52
+ dataIndex: 'name',
53
+ key: 'name',
54
+ },
55
+ {
56
+ title: 'Age',
57
+ dataIndex: 'age',
58
+ key: 'age',
59
+ },
60
+ ]
61
+
62
+ const dataSource = [
63
+ { name: 'John', age: 30 },
64
+ { name: 'Jane', age: 25 },
65
+ ]
66
+
67
+ return (
68
+ <ProTable
69
+ columns={columns}
70
+ dataSource={dataSource}
71
+ rowKey="name"
72
+ />
73
+ )
74
+ }
75
+ ```
76
+
77
+ ### Features
78
+
79
+ - **Powerful Table**: Built on TanStack Table for maximum flexibility
80
+ - **shadcn/ui Components**: Beautiful, accessible UI components
81
+ - **Drag & Drop**: Row and column reordering with @dnd-kit
82
+ - **Search & Filter**: Advanced search and filtering capabilities
83
+ - **Pagination**: Built-in pagination with customizable options
84
+ - **Column Settings**: Show/hide columns, drag to reorder
85
+ - **Row Selection**: Single and multiple row selection with batch actions
86
+ - **Editable Rows**: Inline editing capabilities with various value types
87
+ - **Fixed Columns**: Left and right fixed columns with shadow effects
88
+ - **Internationalization**: Built-in i18n support with English and Chinese locales
89
+ - **Horizontal Scrolling**: Configurable table width with scroll support
90
+ - **Copy to Clipboard**: One-click copy functionality for cells
91
+ - **Responsive**: Mobile-friendly design
92
+ - **TypeScript**: Full TypeScript support
93
+
94
+ ### Examples
95
+
96
+ #### Basic Table
97
+
98
+ ```tsx
99
+ <ProTable
100
+ columns={columns}
101
+ dataSource={dataSource}
102
+ rowKey="id"
103
+ />
104
+ ```
105
+
106
+ #### With Search
107
+
108
+ ```tsx
109
+ <ProTable
110
+ columns={columns}
111
+ dataSource={dataSource}
112
+ rowKey="id"
113
+ search={{
114
+ filterType: 'query',
115
+ searchText: 'Search',
116
+ resetText: 'Reset'
117
+ }}
118
+ />
119
+ ```
120
+
121
+ #### With Pagination
122
+
123
+ ```tsx
124
+ <ProTable
125
+ columns={columns}
126
+ dataSource={dataSource}
127
+ rowKey="id"
128
+ pagination={{
129
+ current: 1,
130
+ pageSize: 10,
131
+ total: 100,
132
+ showSizeChanger: true
133
+ }}
134
+ />
135
+ ```
136
+
137
+ #### With Internationalization
138
+
139
+ ```tsx
140
+ import { ProTable, zh_CN } from '@gulibs/react-vtable'
141
+
142
+ <ProTable
143
+ columns={columns}
144
+ dataSource={dataSource}
145
+ rowKey="id"
146
+ locale={zh_CN}
147
+ />
148
+ ```
149
+
150
+ #### With Fixed Columns
151
+
152
+ ```tsx
153
+ <ProTable
154
+ columns={[
155
+ {
156
+ title: 'ID',
157
+ dataIndex: 'id',
158
+ key: 'id',
159
+ width: 80,
160
+ fixed: 'left'
161
+ },
162
+ {
163
+ title: 'Name',
164
+ dataIndex: 'name',
165
+ key: 'name',
166
+ width: 120
167
+ },
168
+ {
169
+ title: 'Actions',
170
+ dataIndex: 'actions',
171
+ key: 'actions',
172
+ width: 100,
173
+ fixed: 'right'
174
+ }
175
+ ]}
176
+ dataSource={dataSource}
177
+ rowKey="id"
178
+ scroll={{ x: 1000 }}
179
+ tableLayout="fixed"
180
+ />
181
+ ```
182
+
183
+ #### With Editable Rows
184
+
185
+ ```tsx
186
+ <ProTable
187
+ columns={columns}
188
+ dataSource={dataSource}
189
+ rowKey="id"
190
+ editable={{
191
+ type: 'multiple',
192
+ onSave: async (key, record, originRow) => {
193
+ console.log('Save:', { key, record, originRow })
194
+ // Handle save logic
195
+ }
196
+ }}
197
+ />
198
+ ```
199
+
200
+ #### With Row Selection and Batch Actions
201
+
202
+ ```tsx
203
+ <ProTable
204
+ columns={columns}
205
+ dataSource={dataSource}
206
+ rowKey="id"
207
+ rowSelection={{
208
+ type: 'checkbox',
209
+ onChange: (selectedRowKeys, selectedRows) => {
210
+ console.log('Selected:', selectedRowKeys, selectedRows)
211
+ },
212
+ batchActions: {
213
+ onDelete: (rows) => {
214
+ console.log('Delete:', rows)
215
+ },
216
+ onExport: (rows) => {
217
+ console.log('Export:', rows)
218
+ }
219
+ }
220
+ }}
221
+ />
222
+ ```
223
+
224
+ ### API Reference
225
+
226
+ #### ProTable Props
227
+
228
+ | Prop | Type | Default | Description |
229
+ |------|------|---------|-------------|
230
+ | `columns` | `ProColumn[]` | `[]` | Table column definitions |
231
+ | `dataSource` | `T[]` | `[]` | Table data source |
232
+ | `rowKey` | `string \| (record: T) => string` | `'id'` | Unique key for each row |
233
+ | `loading` | `boolean` | `false` | Loading state |
234
+ | `pagination` | `ProTablePagination \| false` | `false` | Pagination configuration |
235
+ | `search` | `ProTableSearch \| false` | `false` | Search form configuration |
236
+ | `rowSelection` | `ProTableRowSelection` | `undefined` | Row selection configuration |
237
+ | `editable` | `ProTableEditable` | `undefined` | Editable rows configuration |
238
+ | `draggable` | `ProTableDraggable` | `undefined` | Drag and drop configuration |
239
+ | `scroll` | `{ x?: number \| true; y?: number \| string }` | `undefined` | Scroll configuration |
240
+ | `tableLayout` | `'auto' \| 'fixed'` | `'auto'` | Table layout mode |
241
+ | `locale` | `ProTableLocale` | `en_US` | Internationalization locale |
242
+ | `size` | `'small' \| 'middle' \| 'large'` | `'middle'` | Table size |
243
+ | `bordered` | `boolean` | `false` | Show table borders |
244
+
245
+ #### Column Configuration
246
+
247
+ | Prop | Type | Description |
248
+ |------|------|-------------|
249
+ | `title` | `string` | Column header text |
250
+ | `dataIndex` | `string` | Data field name |
251
+ | `key` | `string` | Unique column key |
252
+ | `width` | `number` | Column width in pixels |
253
+ | `fixed` | `'left' \| 'right'` | Fixed column position |
254
+ | `sorter` | `boolean` | Enable sorting |
255
+ | `editable` | `boolean` | Enable inline editing |
256
+ | `copyable` | `boolean` | Enable copy to clipboard |
257
+ | `search` | `boolean` | Include in search form |
258
+ | `valueType` | `ProFieldValueType` | Value type for rendering |
259
+ | `valueEnum` | `Record<string, { text: string; status?: string }>` | Enum values for select |
260
+ | `filters` | `Array<{ text: string; value: any }>` | Filter options |
261
+
262
+ ### Development
263
+
264
+ ```bash
265
+ # Install dependencies
266
+ pnpm install
267
+
268
+ # Build the library
269
+ pnpm run build
270
+
271
+ # Start development server
272
+ pnpm run dev
273
+ ```
274
+
275
+ ### License
276
+
277
+ MIT
278
+
279
+ ---
280
+
281
+ ## Chinese
282
+
283
+ 一个基于 shadcn/ui 组件和 TanStack Table 构建的强大 React 表格组件库。
284
+
285
+ ### 前置要求
286
+
287
+ 此库需要您的项目中安装并配置 **Tailwind CSS**。
288
+
289
+ ### 安装
290
+
291
+ ```bash
292
+ # 安装库
293
+ pnpm add @gulibs/react-vtable
294
+
295
+ # 安装对等依赖
296
+ pnpm add react react-dom tailwindcss
297
+ ```
298
+
299
+ ### 配置
300
+
301
+ #### 配置 Tailwind CSS
302
+
303
+ ```javascript
304
+ // tailwind.config.js
305
+ export default {
306
+ content: [
307
+ './src/**/*.{js,ts,jsx,tsx}',
308
+ './node_modules/@gulibs/react-vtable/dist/**/*.js'
309
+ ],
310
+ // 无需额外配置 - 样式会自动注入
311
+ }
312
+ ```
313
+
314
+ > 💡 **注意**: 库会自动注入其 CSS 样式,因此无需手动导入 CSS。
315
+
316
+ ### 使用方法
317
+
318
+ ```tsx
319
+ import { ProTable } from '@gulibs/react-vtable'
320
+ // 无需手动导入 CSS,样式已自动内联
321
+
322
+ function App() {
323
+ const columns = [
324
+ {
325
+ title: '姓名',
326
+ dataIndex: 'name',
327
+ key: 'name',
328
+ },
329
+ {
330
+ title: '年龄',
331
+ dataIndex: 'age',
332
+ key: 'age',
333
+ },
334
+ ]
335
+
336
+ const dataSource = [
337
+ { name: '张三', age: 30 },
338
+ { name: '李四', age: 25 },
339
+ ]
340
+
341
+ return (
342
+ <ProTable
343
+ columns={columns}
344
+ dataSource={dataSource}
345
+ rowKey="name"
346
+ />
347
+ )
348
+ }
349
+ ```
350
+
351
+ ### 功能特性
352
+
353
+ - **强大表格**: 基于 TanStack Table 构建,提供最大灵活性
354
+ - **shadcn/ui 组件**: 美观、可访问的 UI 组件
355
+ - **拖拽排序**: 使用 @dnd-kit 实现行和列重排序
356
+ - **搜索筛选**: 高级搜索和筛选功能
357
+ - **分页**: 内置分页,支持自定义选项
358
+ - **列设置**: 显示 / 隐藏列,拖拽重排序
359
+ - **行选择**: 单选和多选行,支持批量操作
360
+ - **可编辑行**: 内联编辑功能,支持多种值类型
361
+ - **固定列**: 左右固定列,带阴影效果
362
+ - **国际化**: 内置 i18n 支持,提供中英文语言包
363
+ - **横向滚动**: 可配置表格宽度,支持滚动
364
+ - **复制功能**: 一键复制单元格内容
365
+ - **响应式**: 移动端友好设计
366
+ - **TypeScript**: 完整的 TypeScript 支持
367
+
368
+ ### 示例
369
+
370
+ #### 基础表格
371
+
372
+ ```tsx
373
+ <ProTable
374
+ columns={columns}
375
+ dataSource={dataSource}
376
+ rowKey="id"
377
+ />
378
+ ```
379
+
380
+ #### 带搜索
381
+
382
+ ```tsx
383
+ <ProTable
384
+ columns={columns}
385
+ dataSource={dataSource}
386
+ rowKey="id"
387
+ search={{
388
+ filterType: 'query',
389
+ searchText: '搜索',
390
+ resetText: '重置'
391
+ }}
392
+ />
393
+ ```
394
+
395
+ #### 带分页
396
+
397
+ ```tsx
398
+ <ProTable
399
+ columns={columns}
400
+ dataSource={dataSource}
401
+ rowKey="id"
402
+ pagination={{
403
+ current: 1,
404
+ pageSize: 10,
405
+ total: 100,
406
+ showSizeChanger: true
407
+ }}
408
+ />
409
+ ```
410
+
411
+ #### 带国际化
412
+
413
+ ```tsx
414
+ import { ProTable, zh_CN } from '@gulibs/react-vtable'
415
+
416
+ <ProTable
417
+ columns={columns}
418
+ dataSource={dataSource}
419
+ rowKey="id"
420
+ locale={zh_CN}
421
+ />
422
+ ```
423
+
424
+ #### 带固定列
425
+
426
+ ```tsx
427
+ <ProTable
428
+ columns={[
429
+ {
430
+ title: 'ID',
431
+ dataIndex: 'id',
432
+ key: 'id',
433
+ width: 80,
434
+ fixed: 'left'
435
+ },
436
+ {
437
+ title: '姓名',
438
+ dataIndex: 'name',
439
+ key: 'name',
440
+ width: 120
441
+ },
442
+ {
443
+ title: '操作',
444
+ dataIndex: 'actions',
445
+ key: 'actions',
446
+ width: 100,
447
+ fixed: 'right'
448
+ }
449
+ ]}
450
+ dataSource={dataSource}
451
+ rowKey="id"
452
+ scroll={{ x: 1000 }}
453
+ tableLayout="fixed"
454
+ />
455
+ ```
456
+
457
+ #### 带可编辑行
458
+
459
+ ```tsx
460
+ <ProTable
461
+ columns={columns}
462
+ dataSource={dataSource}
463
+ rowKey="id"
464
+ editable={{
465
+ type: 'multiple',
466
+ onSave: async (key, record, originRow) => {
467
+ console.log('保存:', { key, record, originRow })
468
+ // 处理保存逻辑
469
+ }
470
+ }}
471
+ />
472
+ ```
473
+
474
+ #### 带行选择和批量操作
475
+
476
+ ```tsx
477
+ <ProTable
478
+ columns={columns}
479
+ dataSource={dataSource}
480
+ rowKey="id"
481
+ rowSelection={{
482
+ type: 'checkbox',
483
+ onChange: (selectedRowKeys, selectedRows) => {
484
+ console.log('已选择:', selectedRowKeys, selectedRows)
485
+ },
486
+ batchActions: {
487
+ onDelete: (rows) => {
488
+ console.log('删除:', rows)
489
+ },
490
+ onExport: (rows) => {
491
+ console.log('导出:', rows)
492
+ }
493
+ }
494
+ }}
495
+ />
496
+ ```
497
+
498
+ ### API 参考
499
+
500
+ #### ProTable 属性
501
+
502
+ | 属性 | 类型 | 默认值 | 描述 |
503
+ |------|------|--------|------|
504
+ | `columns` | `ProColumn[]` | `[]` | 表格列定义 |
505
+ | `dataSource` | `T[]` | `[]` | 表格数据源 |
506
+ | `rowKey` | `string \| (record: T) => string` | `'id'` | 每行的唯一键 |
507
+ | `loading` | `boolean` | `false` | 加载状态 |
508
+ | `pagination` | `ProTablePagination \| false` | `false` | 分页配置 |
509
+ | `search` | `ProTableSearch \| false` | `false` | 搜索表单配置 |
510
+ | `rowSelection` | `ProTableRowSelection` | `undefined` | 行选择配置 |
511
+ | `editable` | `ProTableEditable` | `undefined` | 可编辑行配置 |
512
+ | `draggable` | `ProTableDraggable` | `undefined` | 拖拽配置 |
513
+ | `scroll` | `{ x?: number \| true; y?: number \| string }` | `undefined` | 滚动配置 |
514
+ | `tableLayout` | `'auto' \| 'fixed'` | `'auto'` | 表格布局模式 |
515
+ | `locale` | `ProTableLocale` | `en_US` | 国际化语言包 |
516
+ | `size` | `'small' \| 'middle' \| 'large'` | `'middle'` | 表格尺寸 |
517
+ | `bordered` | `boolean` | `false` | 显示表格边框 |
518
+
519
+ #### 列配置
520
+
521
+ | 属性 | 类型 | 描述 |
522
+ |------|------|------|
523
+ | `title` | `string` | 列头文本 |
524
+ | `dataIndex` | `string` | 数据字段名 |
525
+ | `key` | `string` | 唯一列键 |
526
+ | `width` | `number` | 列宽度(像素) |
527
+ | `fixed` | `'left' \| 'right'` | 固定列位置 |
528
+ | `sorter` | `boolean` | 启用排序 |
529
+ | `editable` | `boolean` | 启用内联编辑 |
530
+ | `copyable` | `boolean` | 启用复制到剪贴板 |
531
+ | `search` | `boolean` | 包含在搜索表单中 |
532
+ | `valueType` | `ProFieldValueType` | 值类型渲染 |
533
+ | `valueEnum` | `Record<string, { text: string; status?: string }>` | 枚举值选择 |
534
+ | `filters` | `Array<{ text: string; value: any }>` | 筛选选项 |
535
+
536
+ ### 开发
537
+
538
+ ```bash
539
+ # 安装依赖
540
+ pnpm install
541
+
542
+ # 构建库
543
+ pnpm run build
544
+
545
+ # 启动开发服务器
546
+ pnpm run dev
547
+ ```
548
+
549
+ ### 许可证
550
+
551
+ MIT
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ interface BatchActionButtonsProps<T> {
3
+ selectedCount: number;
4
+ selectedRows: T[];
5
+ onDelete?: (rows: T[]) => void;
6
+ onExport?: (rows: T[]) => void;
7
+ onExportExcel?: (rows: T[]) => void;
8
+ onExportCSV?: (rows: T[]) => void;
9
+ onEmail?: (rows: T[]) => void;
10
+ onArchive?: (rows: T[]) => void;
11
+ customActions?: Array<{
12
+ key: string;
13
+ label: string;
14
+ icon?: React.ReactNode;
15
+ onClick: (rows: T[]) => void;
16
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
17
+ }>;
18
+ disabled?: boolean;
19
+ className?: string;
20
+ }
21
+ export declare function BatchActionButtons<T>({ selectedCount, selectedRows, onDelete, onExport, onExportExcel, onExportCSV, onEmail, onArchive, customActions, disabled, className, }: BatchActionButtonsProps<T>): import("react/jsx-runtime").JSX.Element | null;
22
+ export {};
23
+ //# sourceMappingURL=batch-action-buttons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-action-buttons.d.ts","sourceRoot":"","sources":["../../lib/components/batch-action-buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,UAAU,uBAAuB,CAAC,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,CAAC,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC;QACpB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;QAC7B,OAAO,CAAC,EACJ,SAAS,GACT,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC;KACZ,CAAC,CAAC;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EACpC,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,OAAO,EACP,SAAS,EACT,aAAkB,EAClB,QAAgB,EAChB,SAAS,GACV,EAAE,uBAAuB,CAAC,CAAC,CAAC,kDA4N5B"}
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ interface BatchActionsProps<T = any> {
3
+ selectedCount: number;
4
+ selectedRows?: T[];
5
+ onClear?: () => void;
6
+ actions?: React.ReactNode[];
7
+ alwaysShow?: boolean;
8
+ batchActions?: {
9
+ onDelete?: (rows: T[]) => void;
10
+ onExport?: (rows: T[]) => void;
11
+ onExportExcel?: (rows: T[]) => void;
12
+ onExportCSV?: (rows: T[]) => void;
13
+ onEmail?: (rows: T[]) => void;
14
+ onArchive?: (rows: T[]) => void;
15
+ customActions?: Array<{
16
+ key: string;
17
+ label: string;
18
+ icon?: React.ReactNode;
19
+ onClick: (rows: T[]) => void;
20
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
21
+ }>;
22
+ };
23
+ }
24
+ export declare function BatchActions<T>({ selectedCount, selectedRows, onClear, actions, alwaysShow, batchActions, }: BatchActionsProps<T>): import("react/jsx-runtime").JSX.Element;
25
+ export {};
26
+ //# sourceMappingURL=batch-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-actions.d.ts","sourceRoot":"","sources":["../../lib/components/batch-actions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,UAAU,iBAAiB,CAAC,CAAC,GAAG,GAAG;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;QAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;QAC/B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;QACpC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;QAClC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;QAC9B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;QAChC,aAAa,CAAC,EAAE,KAAK,CAAC;YACpB,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;YACvB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;YAC7B,OAAO,CAAC,EACJ,SAAS,GACT,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC;SACZ,CAAC,CAAC;KACJ,CAAC;CACH;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC9B,aAAa,EACb,YAAiB,EACjB,OAAO,EACP,OAAY,EACZ,UAAkB,EAClB,YAAY,GACb,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CA2DtB"}
@@ -0,0 +1,17 @@
1
+ interface ColumnFilterProps {
2
+ column: {
3
+ key?: string;
4
+ dataIndex?: string;
5
+ title?: string;
6
+ filters?: Array<{
7
+ text: string;
8
+ value: any;
9
+ }>;
10
+ };
11
+ value?: any[];
12
+ onChange?: (value: any[]) => void;
13
+ onClear?: () => void;
14
+ }
15
+ export declare function ColumnFilter({ column, value, onChange, onClear, }: ColumnFilterProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=column-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-filter.d.ts","sourceRoot":"","sources":["../../lib/components/column-filter.tsx"],"names":[],"mappings":"AAWA,UAAU,iBAAiB;IACzB,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,GAAG,CAAA;SAAE,CAAC,CAAC;KAC/C,CAAC;IACF,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,KAAU,EACV,QAAQ,EACR,OAAO,GACR,EAAE,iBAAiB,2CAiFnB"}
@@ -0,0 +1,14 @@
1
+ import type { ProColumn } from "@/types";
2
+ import type { Table } from "@tanstack/react-table";
3
+ interface ColumnSettingProps<T = any> {
4
+ table?: Table<T>;
5
+ columns: ProColumn<T>[];
6
+ visibleColumns: string[];
7
+ onVisibleChange: (columns: string[]) => void;
8
+ fixedColumns?: Record<string, "left" | "right" | undefined>;
9
+ onFixedChange?: (key: string, fixed?: "left" | "right") => void;
10
+ onOrderChange?: (columns: ProColumn<T>[]) => void;
11
+ }
12
+ export declare function ColumnSetting<T = any>({ table, columns, visibleColumns, onVisibleChange, fixedColumns, onFixedChange, onOrderChange, }: ColumnSettingProps<T>): import("react/jsx-runtime").JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=column-setting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-setting.d.ts","sourceRoot":"","sources":["../../lib/components/column-setting.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAUzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,UAAU,kBAAkB,CAAC,CAAC,GAAG,GAAG;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC5D,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;IAChE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;CACnD;AAiDD,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,EACrC,KAAK,EACL,OAAO,EACP,cAAc,EACd,eAAe,EACf,YAAiB,EACjB,aAAa,EACb,aAAa,GACd,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAuPvB"}
@@ -0,0 +1,10 @@
1
+ interface CopyButtonProps {
2
+ value: any;
3
+ className?: string;
4
+ size?: "sm" | "md" | "lg";
5
+ showText?: boolean;
6
+ onCopy?: (value: any) => void;
7
+ }
8
+ export declare function CopyButton({ value, className, size, showText, onCopy, }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=copy-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-button.d.ts","sourceRoot":"","sources":["../../lib/components/copy-button.tsx"],"names":[],"mappings":"AAKA,UAAU,eAAe;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAC/B;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,IAAW,EACX,QAAgB,EAChB,MAAM,GACP,EAAE,eAAe,2CAmEjB"}