@next-bricks/advanced 0.51.3 → 0.51.4

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 (61) hide show
  1. package/dist/bricks.json +22 -22
  2. package/dist/chunks/4758.703acb39.js +3 -0
  3. package/dist/chunks/4758.703acb39.js.map +1 -0
  4. package/dist/chunks/{6070.74d93326.js → 7039.0ea489d5.js} +2 -2
  5. package/dist/chunks/7039.0ea489d5.js.map +1 -0
  6. package/dist/chunks/8382.eba253d7.js +2 -0
  7. package/dist/chunks/8382.eba253d7.js.map +1 -0
  8. package/dist/chunks/eo-cascader.b5d6ee02.js +2 -0
  9. package/dist/chunks/eo-cascader.b5d6ee02.js.map +1 -0
  10. package/dist/chunks/eo-next-table.25f4bf4d.js.map +1 -1
  11. package/dist/chunks/eo-table.5dd09651.js.map +1 -1
  12. package/dist/chunks/eo-text-tooltip.74db365e.js.map +1 -1
  13. package/dist/chunks/eo-tree-select.4034b1d9.js +2 -0
  14. package/dist/chunks/eo-tree-select.4034b1d9.js.map +1 -0
  15. package/dist/chunks/eo-workbench-layout-v2.24da89e7.js.map +1 -1
  16. package/dist/chunks/eo-workbench-layout.1ed8ce80.js.map +1 -1
  17. package/dist/chunks/{main.f43a8ad8.js → main.6b40d042.js} +2 -2
  18. package/dist/chunks/{main.f43a8ad8.js.map → main.6b40d042.js.map} +1 -1
  19. package/dist/chunks/pdf-viewer.036787d7.js.map +1 -1
  20. package/dist/examples.json +17 -11
  21. package/dist/{index.3d8026b9.js → index.6f2baf4a.js} +2 -2
  22. package/dist/{index.3d8026b9.js.map → index.6f2baf4a.js.map} +1 -1
  23. package/dist/manifest.json +656 -563
  24. package/dist/types.json +234 -234
  25. package/dist-types/cascader/index.d.ts +18 -0
  26. package/dist-types/next-table/index.d.ts +2 -1
  27. package/dist-types/pdf-viewer/index.d.ts +7 -1
  28. package/dist-types/table/index.d.ts +2 -1
  29. package/dist-types/text-tooltip/index.d.ts +5 -4
  30. package/dist-types/tree-select/index.d.ts +41 -1
  31. package/dist-types/workbench-layout/index.d.ts +26 -1
  32. package/dist-types/workbench-layout-v2/index.d.ts +31 -9
  33. package/docs/eo-cascader.md +184 -1
  34. package/docs/eo-cascader.react.md +247 -0
  35. package/docs/eo-next-table.md +343 -168
  36. package/docs/eo-next-table.react.md +923 -0
  37. package/docs/eo-table.md +296 -0
  38. package/docs/eo-table.react.md +223 -0
  39. package/docs/eo-text-tooltip.md +46 -1
  40. package/docs/eo-text-tooltip.react.md +69 -0
  41. package/docs/eo-tree-select.md +127 -1
  42. package/docs/eo-tree-select.react.md +206 -0
  43. package/docs/eo-tree.md +108 -2
  44. package/docs/eo-tree.react.md +220 -0
  45. package/docs/eo-workbench-layout-v2.md +204 -0
  46. package/docs/eo-workbench-layout-v2.react.md +162 -0
  47. package/docs/eo-workbench-layout.md +45 -3
  48. package/docs/eo-workbench-layout.react.md +141 -0
  49. package/docs/pdf-viewer.md +48 -1
  50. package/docs/pdf-viewer.react.md +63 -0
  51. package/package.json +2 -2
  52. package/dist/chunks/4758.5f79e636.js +0 -3
  53. package/dist/chunks/4758.5f79e636.js.map +0 -1
  54. package/dist/chunks/6070.74d93326.js.map +0 -1
  55. package/dist/chunks/8382.d552299f.js +0 -2
  56. package/dist/chunks/8382.d552299f.js.map +0 -1
  57. package/dist/chunks/eo-cascader.86a685ca.js +0 -2
  58. package/dist/chunks/eo-cascader.86a685ca.js.map +0 -1
  59. package/dist/chunks/eo-tree-select.31dae71f.js +0 -2
  60. package/dist/chunks/eo-tree-select.31dae71f.js.map +0 -1
  61. /package/dist/chunks/{4758.5f79e636.js.LICENSE.txt → 4758.703acb39.js.LICENSE.txt} +0 -0
@@ -0,0 +1,923 @@
1
+ ---
2
+ tagName: eo-next-table
3
+ displayName: WrappedEoNextTable
4
+ description: 大型表格
5
+ category: table
6
+ source: "@next-bricks/advanced"
7
+ ---
8
+
9
+ # WrappedEoNextTable
10
+
11
+ > 大型表格
12
+
13
+ ## 导入
14
+
15
+ ```tsx
16
+ import { WrappedEoNextTable } from "@easyops/wrapped-components";
17
+ ```
18
+
19
+ ## Props
20
+
21
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
22
+ | ------------------ | ------------------------ | ---- | ------------- | ------------------------------------------------------------------------------------------ |
23
+ | rowKey | `string` | 否 | `"key"` | 指定表格行的 key |
24
+ | columns | `Column[]` | 否 | - | 列定义 |
25
+ | cell | `CellConfig` | 否 | - | 单元格统一配置,可配置 useBrick 自定义渲染所有单元格及表头 |
26
+ | dataSource | `DataSource` | 否 | - | 数据源 |
27
+ | frontSearch | `boolean` | 否 | - | 是否前端搜索 |
28
+ | pagination | `PaginationType` | 否 | - | 分页配置 |
29
+ | loading | `boolean` | 否 | - | 显示加载中状态 |
30
+ | multiSort | `boolean` | 否 | - | 是否支持多列排序,前端搜索时需设置 column.sortPriority 优先级 |
31
+ | sort | `Sort \| Sort[]` | 否 | - | 排序信息 |
32
+ | rowSelection | `RowSelectionType` | 否 | - | 表格行可选择配置 |
33
+ | selectedRowKeys | `(string \| number)[]` | 否 | - | 选中项的 key |
34
+ | hiddenColumns | `(string \| number)[]` | 否 | - | 隐藏的列(输入对应的 column.key) |
35
+ | expandable | `ExpandableType` | 否 | - | 表格行展开配置 |
36
+ | expandedRowKeys | `(string \| number)[]` | 否 | - | 展开项的 key |
37
+ | childrenColumnName | `string` | 否 | `"children"` | 树形结构的列名 |
38
+ | rowDraggable | `boolean` | 否 | - | 表格行拖拽配置 |
39
+ | rowClickable | `boolean` | 否 | - | 表格行可点击(激活鼠标手势) |
40
+ | searchFields | `(string \| string[])[]` | 否 | - | 进行前端搜索的字段,支持嵌套的写法。不配置的时候默认为对所有 column.dataIndex 进行前端搜索 |
41
+ | size | `TableProps["size"]` | 否 | `"large"` | 表格大小 |
42
+ | showHeader | `boolean` | 否 | `true` | 是否显示表头 |
43
+ | bordered | `boolean` | 否 | - | 是否显示边框 |
44
+ | scrollConfig | `TableScroll` | 否 | `{ x: true }` | 滚动配置 |
45
+ | optimizedColumns | `(string \| number)[]` | 否 | - | 优化渲染的列(输入对应的 column.key) |
46
+ | themeVariant | `"default" \| "elevo"` | 否 | - | 主题变体 |
47
+
48
+ ## Events
49
+
50
+ | 事件 | detail | 说明 |
51
+ | -------------------- | ----------------------------------------------------------------------- | -------------------------------------------------- |
52
+ | onPageChange | `PageOrPageSizeChangeEventDetail` — 改变后的页码及每页条数 | page 或 pageSize 改变的回调 |
53
+ | onPageSizeChange | `PageOrPageSizeChangeEventDetail` — 改变后的页码及每页条数 | pageSize 变化的回调(已废弃,统一用 onPageChange) |
54
+ | onSortChange | `Sort \| Sort[] \| undefined` — 当前排序的信息 | 排序变化的回调 |
55
+ | onRowClick | `RecordType` — 被点击的行数据 | 行点击时的回调 |
56
+ | onRowSelect | `RowSelectEventDetail` — 改变后的 rowKey 及行数据 | 行选中项发生变化时的回调 |
57
+ | onRowSelectV2 | `RecordType[]` — 改变后的行数据 | 行选中项发生变化时的回调(v2 版本) |
58
+ | onRowExpand | `RowExpandEventDetail` — 当前行的展开情况及数据 | 点击展开图标时触发 |
59
+ | onExpandedRowsChange | `(string \| number)[]` — 所有展开行的 key | 展开的行变化时触发 |
60
+ | onRowDrag | `RowDragEventDetail` — 重新排序的行数据、拖拽的行数据、放下位置的行数据 | 表格行拖拽结束发生的事件 |
61
+
62
+ ## Methods
63
+
64
+ | 方法 | 参数 | 返回值 | 说明 |
65
+ | ------ | -------------------------------------------------------------------- | ------ | -------- |
66
+ | search | <ul><li>`params: { q: string }` - 搜索参数,q 为搜索关键词</li></ul> | `void` | 前端搜索 |
67
+
68
+ ## Examples
69
+
70
+ ### Basic
71
+
72
+ 展示大型表格的基本用法,配置 columns 和 dataSource,并支持分页与操作列。
73
+
74
+ ```tsx
75
+ <WrappedEoNextTable
76
+ scrollConfig={{ x: false }}
77
+ pagination={{ pageSizeOptions: [5, 10, 20] }}
78
+ columns={[
79
+ { dataIndex: "name", key: "name", title: "Name" },
80
+ { dataIndex: "age", key: "age", title: "Age" },
81
+ { dataIndex: "address", key: "address", title: "Address" },
82
+ {
83
+ dataIndex: "remarks",
84
+ key: "remarks",
85
+ title: "Long Column Long Column Long Column Long Column",
86
+ width: 200,
87
+ ellipsis: true,
88
+ },
89
+ {
90
+ dataIndex: "operator",
91
+ key: "operator",
92
+ title: "操作",
93
+ width: 200,
94
+ useBrick: [
95
+ {
96
+ brick: "div",
97
+ properties: {
98
+ style: { display: "flex", gap: "4px" },
99
+ },
100
+ children: [
101
+ {
102
+ brick: "eo-button",
103
+ properties: {
104
+ type: "link",
105
+ size: "small",
106
+ icon: { lib: "antd", icon: "edit" },
107
+ },
108
+ },
109
+ {
110
+ brick: "eo-button",
111
+ properties: {
112
+ type: "link",
113
+ size: "small",
114
+ danger: true,
115
+ icon: { lib: "antd", icon: "delete" },
116
+ },
117
+ },
118
+ ],
119
+ },
120
+ ],
121
+ },
122
+ ]}
123
+ dataSource={{
124
+ pageSize: 5,
125
+ page: 1,
126
+ list: [
127
+ {
128
+ key: 0,
129
+ name: "Jack",
130
+ age: 18,
131
+ address: "Guangzhou",
132
+ remarks:
133
+ "Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text",
134
+ },
135
+ {
136
+ key: 1,
137
+ name: "Alex",
138
+ age: 20,
139
+ address: "Shanghai",
140
+ remarks: "Long text Long text",
141
+ },
142
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
143
+ {
144
+ key: 3,
145
+ name: "Sam",
146
+ age: 28,
147
+ address: "Guangzhou",
148
+ remarks:
149
+ "Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text",
150
+ },
151
+ { key: 4, name: "Bob", age: 35, address: "Hainan" },
152
+ { key: 5, name: "Ava", age: 23, address: "Beijing" },
153
+ { key: 6, name: "Sophia", age: 20, address: "Shanghai" },
154
+ { key: 7, name: "Charlotte", age: 33, address: "Chongqing" },
155
+ { key: 8, name: "Mia", age: 18, address: "Chengdu" },
156
+ { key: 9, name: "Noah", age: 38, address: "Hainan" },
157
+ { key: 10, name: "William", age: 16, address: "Taiwan" },
158
+ ],
159
+ }}
160
+ onPageChange={(e) => console.log(e.detail)}
161
+ onPageSizeChange={(e) => console.log(e.detail)}
162
+ />
163
+ ```
164
+
165
+ ### Fixed & Scroll & useBrick
166
+
167
+ 展示固定列、水平滚动及通过 useBrick 自定义单元格内容。
168
+
169
+ ```tsx
170
+ <WrappedEoNextTable
171
+ scrollConfig={{ x: "max-content" }}
172
+ pagination={{ pageSizeOptions: [5, 10, 20] }}
173
+ columns={[
174
+ {
175
+ dataIndex: "name",
176
+ key: "name",
177
+ title: "Name",
178
+ width: 100,
179
+ fixed: true,
180
+ headerBrick: {
181
+ useBrick: {
182
+ brick: "span",
183
+ properties: {
184
+ style: { color: "red" },
185
+ textContent: "<% DATA.title %>",
186
+ },
187
+ },
188
+ },
189
+ useBrick: [
190
+ {
191
+ brick: "span",
192
+ properties: {
193
+ style: { color: "pink" },
194
+ textContent: "<% DATA.cellData %>",
195
+ },
196
+ },
197
+ ],
198
+ },
199
+ { dataIndex: "address", key: "column1", title: "column1" },
200
+ { dataIndex: "address", key: "column2", title: "column2" },
201
+ { dataIndex: "address", key: "column3", title: "column3" },
202
+ { dataIndex: "address", key: "column4", title: "column4" },
203
+ { dataIndex: "address", key: "column5", title: "column5" },
204
+ { dataIndex: "address", key: "column6", title: "column6" },
205
+ { dataIndex: "address", key: "column7", title: "column7" },
206
+ { dataIndex: "address", key: "column8", title: "column8" },
207
+ { dataIndex: "address", key: "column9", title: "column9" },
208
+ { dataIndex: "address", key: "column10", title: "column10" },
209
+ { dataIndex: "age", key: "age", title: "Age", width: 100, fixed: "right" },
210
+ ]}
211
+ dataSource={{
212
+ pageSize: 5,
213
+ page: 1,
214
+ list: [
215
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
216
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
217
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
218
+ { key: 3, name: "Sam", age: 28, address: "Guangzhou" },
219
+ { key: 4, name: "Bob", age: 35, address: "Hainan" },
220
+ { key: 5, name: "Ava", age: 23, address: "Beijing" },
221
+ { key: 6, name: "Sophia", age: 20, address: "Shanghai" },
222
+ { key: 7, name: "Charlotte", age: 33, address: "Chongqing" },
223
+ { key: 8, name: "Mia", age: 18, address: "Chengdu" },
224
+ { key: 9, name: "Noah", age: 38, address: "Hainan" },
225
+ { key: 10, name: "William", age: 16, address: "Taiwan" },
226
+ ],
227
+ }}
228
+ onPageChange={(e) => console.log(e.detail)}
229
+ onPageSizeChange={(e) => console.log(e.detail)}
230
+ />
231
+ ```
232
+
233
+ ### Front Search
234
+
235
+ 开启前端搜索,配合 search 方法与 searchFields 实现关键字过滤,支持多列排序。
236
+
237
+ ```tsx
238
+ const tableRef = useRef<any>();
239
+
240
+ <>
241
+ <input
242
+ placeholder="Enter keyword"
243
+ onChange={(e) => tableRef.current?.search({ q: e.target.value })}
244
+ />
245
+ <WrappedEoNextTable
246
+ ref={tableRef}
247
+ frontSearch={true}
248
+ searchFields={["address"]}
249
+ sort={{ columnKey: "age", order: "descend" }}
250
+ multiSort={true}
251
+ pagination={{ pageSizeOptions: [5, 10, 20] }}
252
+ columns={[
253
+ { dataIndex: "name", key: "name", title: "Name" },
254
+ {
255
+ dataIndex: "age",
256
+ key: "age",
257
+ title: "Age",
258
+ sortable: true,
259
+ sortPriority: 1,
260
+ },
261
+ {
262
+ dataIndex: "address",
263
+ key: "address",
264
+ title: "Address",
265
+ sortable: true,
266
+ sortPriority: 2,
267
+ },
268
+ ]}
269
+ dataSource={{
270
+ pageSize: 5,
271
+ page: 1,
272
+ list: [
273
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
274
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
275
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
276
+ { key: 3, name: "Sam", age: 28, address: "Guangzhou" },
277
+ { key: 4, name: "Bob", age: 35, address: "Hainan" },
278
+ { key: 5, name: "Ava", age: 23, address: "Beijing" },
279
+ { key: 6, name: "Sophia", age: 20, address: "Shanghai" },
280
+ { key: 7, name: "Charlotte", age: 33, address: "Chongqing" },
281
+ { key: 8, name: "Mia", age: 18, address: "Chengdu" },
282
+ { key: 9, name: "Noah", age: 38, address: "Hainan" },
283
+ { key: 10, name: "William", age: 16, address: "Taiwan" },
284
+ ],
285
+ }}
286
+ onPageChange={(e) => console.log(e.detail)}
287
+ onPageSizeChange={(e) => console.log(e.detail)}
288
+ onSortChange={(e) => console.log(e.detail)}
289
+ />
290
+ </>;
291
+ ```
292
+
293
+ ### Row Selection
294
+
295
+ 配置 rowSelection 开启行选择功能,选中状态变化时触发 onRowSelect 事件。
296
+
297
+ ```tsx
298
+ <WrappedEoNextTable
299
+ rowSelection={true}
300
+ pagination={{ pageSizeOptions: [5, 10, 20] }}
301
+ columns={[
302
+ { dataIndex: "name", key: "name", title: "Name" },
303
+ {
304
+ dataIndex: "age",
305
+ key: "age",
306
+ title: "Age",
307
+ useBrick: [
308
+ {
309
+ brick: "eo-tag",
310
+ properties: {
311
+ color: '<% DATA.cellData > 18 ? "green" : "red" %>',
312
+ textContent: "<% DATA.cellData %>",
313
+ },
314
+ },
315
+ ],
316
+ },
317
+ { dataIndex: "address", key: "address", title: "Address" },
318
+ ]}
319
+ dataSource={{
320
+ pageSize: 5,
321
+ page: 1,
322
+ list: [
323
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
324
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
325
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
326
+ { key: 3, name: "Sam", age: 28, address: "Guangzhou" },
327
+ { key: 4, name: "Bob", age: 35, address: "Hainan" },
328
+ { key: 5, name: "Ava", age: 23, address: "Beijing" },
329
+ { key: 6, name: "Sophia", age: 20, address: "Shanghai" },
330
+ { key: 7, name: "Charlotte", age: 33, address: "Chongqing" },
331
+ { key: 8, name: "Mia", age: 18, address: "Chengdu" },
332
+ { key: 9, name: "Noah", age: 38, address: "Hainan" },
333
+ { key: 10, name: "William", age: 16, address: "Taiwan" },
334
+ ],
335
+ }}
336
+ onRowSelect={(e) => console.log(e.detail)}
337
+ />
338
+ ```
339
+
340
+ ### Row Click
341
+
342
+ 配置 rowClickable 开启行点击功能,点击行时触发 onRowClick 事件。
343
+
344
+ ```tsx
345
+ <WrappedEoNextTable
346
+ rowClickable={true}
347
+ pagination={false}
348
+ columns={[
349
+ { dataIndex: "name", key: "name", title: "Name" },
350
+ { dataIndex: "age", key: "age", title: "Age" },
351
+ { dataIndex: "address", key: "address", title: "Address" },
352
+ ]}
353
+ dataSource={{
354
+ list: [
355
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
356
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
357
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
358
+ ],
359
+ }}
360
+ onRowClick={(e) => console.log(e.detail)}
361
+ />
362
+ ```
363
+
364
+ ### Expandable
365
+
366
+ 配置 expandable 开启行展开功能,支持展开行内嵌套表格。
367
+
368
+ ```tsx
369
+ <WrappedEoNextTable
370
+ expandable={{
371
+ rowExpandable: (rowData: any) => rowData.key % 2 === 0,
372
+ expandedRowBrick: {
373
+ useBrick: {
374
+ brick: "eo-next-table",
375
+ properties: {
376
+ scrollConfig: false,
377
+ pagination: false,
378
+ bordered: true,
379
+ rowKey: "title",
380
+ columns: [
381
+ { dataIndex: "title", key: "title", title: "标题" },
382
+ { dataIndex: "description", key: "description", title: "描述" },
383
+ {
384
+ dataIndex: "operator",
385
+ key: "operator",
386
+ title: "操作",
387
+ useBrick: {
388
+ brick: "eo-link",
389
+ properties: { textContent: "操作" },
390
+ },
391
+ },
392
+ ],
393
+ dataSource: { list: "<% DATA.rowData.info %>" },
394
+ },
395
+ },
396
+ },
397
+ }}
398
+ pagination={{ pageSizeOptions: [5, 10, 20] }}
399
+ columns={[
400
+ { dataIndex: "name", key: "name", title: "Name" },
401
+ { dataIndex: "age", key: "age", title: "Age" },
402
+ { dataIndex: "address", key: "address", title: "Address" },
403
+ ]}
404
+ dataSource={{
405
+ pageSize: 5,
406
+ page: 1,
407
+ list: [
408
+ {
409
+ key: 0,
410
+ name: "Jack",
411
+ age: 18,
412
+ address: "Guangzhou",
413
+ info: [
414
+ { title: "测试1", description: "这是一串描述", id: 1 },
415
+ { title: "测试2", description: "这是一串描述", id: 2 },
416
+ ],
417
+ },
418
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
419
+ {
420
+ key: 2,
421
+ name: "Lucy",
422
+ age: 16,
423
+ address: "Yunnan",
424
+ info: [
425
+ { title: "测试3", description: "这是一串描述", id: 3 },
426
+ { title: "测试4", description: "这是一串描述", id: 4 },
427
+ ],
428
+ },
429
+ { key: 3, name: "Sam", age: 28, address: "Shenzhen" },
430
+ { key: 4, name: "Bob", age: 35, address: "Hainan" },
431
+ { key: 5, name: "Ava", age: 23, address: "Beijing" },
432
+ { key: 6, name: "Sophia", age: 20, address: "Nanjing" },
433
+ { key: 7, name: "Charlotte", age: 33, address: "Chongqing" },
434
+ { key: 8, name: "Mia", age: 18, address: "Chengdu" },
435
+ { key: 9, name: "Noah", age: 38, address: "Wuhan" },
436
+ { key: 10, name: "William", age: 16, address: "Taiwan" },
437
+ ],
438
+ }}
439
+ onRowExpand={(e) => console.log(e.detail)}
440
+ onExpandedRowsChange={(e) => console.log(e.detail)}
441
+ />
442
+ ```
443
+
444
+ ### Bordered
445
+
446
+ 展示带边框的表格样式。
447
+
448
+ ```tsx
449
+ <WrappedEoNextTable
450
+ bordered={true}
451
+ columns={[
452
+ { dataIndex: "name", key: "name", title: "Name" },
453
+ { dataIndex: "age", key: "age", title: "Age" },
454
+ { dataIndex: "address", key: "address", title: "Address" },
455
+ ]}
456
+ dataSource={{
457
+ pageSize: 5,
458
+ page: 1,
459
+ list: [
460
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
461
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
462
+ { key: 3, name: "Sam", age: 28, address: "Shenzhen" },
463
+ ],
464
+ }}
465
+ />
466
+ ```
467
+
468
+ ### Size
469
+
470
+ 展示不同尺寸(large、middle、small)的表格效果。
471
+
472
+ ```tsx
473
+ const sizes = ["large", "middle", "small"] as const;
474
+ const dataSource = {
475
+ pageSize: 5,
476
+ page: 1,
477
+ list: [
478
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
479
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
480
+ { key: 3, name: "Sam", age: 28, address: "Shenzhen" },
481
+ ],
482
+ };
483
+ const columns = [
484
+ { dataIndex: "name", key: "name", title: "Name" },
485
+ { dataIndex: "age", key: "age", title: "Age" },
486
+ { dataIndex: "address", key: "address", title: "Address" },
487
+ ];
488
+
489
+ <div>
490
+ {sizes.map((size) => (
491
+ <div key={size}>
492
+ <strong>Size: {size}</strong>
493
+ <WrappedEoNextTable
494
+ size={size}
495
+ pagination={false}
496
+ columns={columns}
497
+ dataSource={dataSource}
498
+ />
499
+ </div>
500
+ ))}
501
+ </div>;
502
+ ```
503
+
504
+ ### Draggable
505
+
506
+ 开启 rowDraggable 支持行拖拽排序,拖拽结束触发 onRowDrag 事件。
507
+
508
+ ```tsx
509
+ <WrappedEoNextTable
510
+ rowKey="name"
511
+ rowDraggable={true}
512
+ pagination={false}
513
+ columns={[
514
+ { dataIndex: "name", key: "name", title: "Name" },
515
+ { dataIndex: "age", key: "age", title: "Age" },
516
+ { dataIndex: "address", key: "address", title: "Address" },
517
+ ]}
518
+ dataSource={{
519
+ list: [
520
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
521
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
522
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
523
+ { key: 3, name: "Sam", age: 28, address: "Guangzhou" },
524
+ { key: 4, name: "Bob", age: 35, address: "Hainan" },
525
+ { key: 5, name: "Ava", age: 23, address: "Beijing" },
526
+ { key: 6, name: "Sophia", age: 20, address: "Shanghai" },
527
+ { key: 7, name: "Charlotte", age: 33, address: "Chongqing" },
528
+ { key: 8, name: "Mia", age: 18, address: "Chengdu" },
529
+ { key: 9, name: "Noah", age: 38, address: "Hainan" },
530
+ { key: 10, name: "William", age: 16, address: "Taiwan" },
531
+ ],
532
+ }}
533
+ onRowDrag={(e) => console.log(e.detail)}
534
+ />
535
+ ```
536
+
537
+ ### RowSpan & ColSpan
538
+
539
+ 通过列配置的 colSpan、cellColSpanKey、cellRowSpanKey 实现单元格合并。
540
+
541
+ ```tsx
542
+ <WrappedEoNextTable
543
+ pagination={false}
544
+ bordered={true}
545
+ columns={[
546
+ { dataIndex: "name", key: "name", title: "Name" },
547
+ { dataIndex: "age", key: "age", title: "Age" },
548
+ {
549
+ dataIndex: "mobile",
550
+ key: "mobile",
551
+ title: "phone",
552
+ colSpan: 2,
553
+ cellColSpanKey: "mobileColSpan",
554
+ cellRowSpanKey: "mobileRowSpan",
555
+ },
556
+ {
557
+ dataIndex: "landlines",
558
+ key: "landlines",
559
+ colSpan: 0,
560
+ cellColSpanKey: "landlinesColSpan",
561
+ cellRowSpanKey: "landlinesRowSpan",
562
+ },
563
+ { dataIndex: "address", key: "address", title: "Address" },
564
+ ]}
565
+ dataSource={{
566
+ list: [
567
+ {
568
+ key: 0,
569
+ name: "Jack",
570
+ age: 18,
571
+ address: "Guangzhou",
572
+ mobile: "18900010222",
573
+ landlines: "0571-22098909",
574
+ },
575
+ {
576
+ key: 1,
577
+ name: "Alex",
578
+ age: 20,
579
+ address: "Shanghai",
580
+ mobile: "18900010333",
581
+ mobileColSpan: 2,
582
+ landlinesColSpan: 0,
583
+ },
584
+ {
585
+ key: 2,
586
+ name: "Lucy",
587
+ age: 16,
588
+ address: "Yunnan",
589
+ mobile: "18900010444",
590
+ landlines: "0571-22098707",
591
+ landlinesRowSpan: 2,
592
+ },
593
+ {
594
+ key: 3,
595
+ name: "Sam",
596
+ age: 28,
597
+ address: "Guangzhou",
598
+ mobile: "18900010555",
599
+ landlines: "0571-22098707",
600
+ landlinesRowSpan: 0,
601
+ mobileRowSpan: 2,
602
+ },
603
+ {
604
+ key: 4,
605
+ name: "Bob",
606
+ age: 35,
607
+ address: "Hainan",
608
+ mobile: "18900010555",
609
+ landlines: "0571-22098606",
610
+ mobileRowSpan: 0,
611
+ },
612
+ ],
613
+ }}
614
+ />
615
+ ```
616
+
617
+ ### Tree
618
+
619
+ 设置 childrenColumnName 来指定树形结构的列名,展开功能的配置可以使用 expandable。
620
+
621
+ ```tsx
622
+ <WrappedEoNextTable
623
+ pagination={false}
624
+ childrenColumnName="student"
625
+ expandable={{ defaultExpandAllRows: true }}
626
+ columns={[
627
+ { dataIndex: "name", key: "name", title: "Name" },
628
+ { dataIndex: "age", key: "age", title: "Age" },
629
+ { dataIndex: "address", key: "address", title: "Address" },
630
+ ]}
631
+ dataSource={{
632
+ list: [
633
+ {
634
+ key: "1",
635
+ name: "Jack",
636
+ age: 18,
637
+ address: "Guangzhou",
638
+ student: [
639
+ { key: "11", name: "Alex", age: 20, address: "Shanghai" },
640
+ { key: "12", name: "Lucy", age: 16, address: "Yunnan" },
641
+ { key: "13", name: "Sam", age: 28, address: "Guangzhou" },
642
+ ],
643
+ },
644
+ {
645
+ key: "2",
646
+ name: "Bob",
647
+ age: 35,
648
+ address: "Hainan",
649
+ student: [
650
+ { key: "21", name: "Ava", age: 23, address: "Beijing" },
651
+ { key: "22", name: "Sophia", age: 20, address: "Shanghai" },
652
+ {
653
+ key: "23",
654
+ name: "Charlotte",
655
+ age: 33,
656
+ address: "Chongqing",
657
+ student: [
658
+ { key: "231", name: "Mia", age: 18, address: "Chengdu" },
659
+ { key: "232", name: "Noah", age: 38, address: "Hainan" },
660
+ { key: "233", name: "William", age: 16, address: "Taiwan" },
661
+ ],
662
+ },
663
+ ],
664
+ },
665
+ ],
666
+ }}
667
+ onRowExpand={(e) => console.log(e.detail)}
668
+ onExpandedRowsChange={(e) => console.log(e.detail)}
669
+ />
670
+ ```
671
+
672
+ ### Dynamic Columns
673
+
674
+ 通过 cell 配置统一自定义单元格渲染,结合动态列实现灵活的表格展示。
675
+
676
+ ```tsx
677
+ const dates = new Array(4)
678
+ .fill(null)
679
+ .map((_, i) => {
680
+ const d = new Date("2023-01-11");
681
+ d.setDate(d.getDate() + i);
682
+ const mm = String(d.getMonth() + 1).padStart(2, "0");
683
+ const dd = String(d.getDate()).padStart(2, "0");
684
+ return `${mm}-${dd}`;
685
+ })
686
+ .map((key) => ({ dataIndex: key, key, title: key }));
687
+
688
+ <WrappedEoNextTable
689
+ cell={{
690
+ useBrick: [
691
+ {
692
+ if: "<% DATA.columnKey !== '01-13' %>",
693
+ brick: "em",
694
+ properties: { textContent: "<% DATA.cellData %>" },
695
+ },
696
+ {
697
+ if: "<% DATA.columnKey === '01-13' %>",
698
+ brick: "del",
699
+ properties: { textContent: "<% DATA.cellData %>" },
700
+ },
701
+ ],
702
+ header: {
703
+ useBrick: {
704
+ brick: "em",
705
+ properties: { textContent: "<% DATA.title %>" },
706
+ },
707
+ },
708
+ }}
709
+ columns={dates}
710
+ dataSource={{
711
+ list: [
712
+ { "01-11": "abc", "01-12": "def", "01-13": "ghi", "01-14": "jkl" },
713
+ { "01-11": "123", "01-12": "345", "01-13": "789", "01-14": "-" },
714
+ ],
715
+ }}
716
+ />;
717
+ ```
718
+
719
+ ### Cell Status
720
+
721
+ 通过列的 cellStatus 配置,根据数据值设置单元格左边框颜色来表示状态。
722
+
723
+ ```tsx
724
+ <WrappedEoNextTable
725
+ columns={[
726
+ {
727
+ dataIndex: "name",
728
+ key: "name",
729
+ title: "Name",
730
+ cellStatus: {
731
+ dataIndex: "age",
732
+ mapping: [
733
+ { value: 18, leftBorderColor: "green" },
734
+ { value: 20, leftBorderColor: "blue" },
735
+ { value: 28, leftBorderColor: "red" },
736
+ ],
737
+ },
738
+ },
739
+ { dataIndex: "age", key: "age", title: "Age" },
740
+ { dataIndex: "address", key: "address", title: "Address" },
741
+ ]}
742
+ dataSource={{
743
+ pageSize: 5,
744
+ page: 1,
745
+ list: [
746
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
747
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
748
+ { key: 3, name: "Sam", age: 28, address: "Shenzhen" },
749
+ ],
750
+ }}
751
+ />
752
+ ```
753
+
754
+ ### Hidden Columns
755
+
756
+ 通过 hiddenColumns 隐藏指定列,传入对应的 column.key 即可。
757
+
758
+ ```tsx
759
+ <WrappedEoNextTable
760
+ hiddenColumns={["age"]}
761
+ columns={[
762
+ { dataIndex: "name", key: "name", title: "Name" },
763
+ { dataIndex: "age", key: "age", title: "Age" },
764
+ { dataIndex: "address", key: "address", title: "Address" },
765
+ ]}
766
+ dataSource={{
767
+ list: [
768
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
769
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
770
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
771
+ ],
772
+ }}
773
+ />
774
+ ```
775
+
776
+ ### Selected Row Keys
777
+
778
+ 通过 selectedRowKeys 设置默认选中的行。
779
+
780
+ ```tsx
781
+ <WrappedEoNextTable
782
+ rowSelection={true}
783
+ selectedRowKeys={[0, 2]}
784
+ pagination={false}
785
+ columns={[
786
+ { dataIndex: "name", key: "name", title: "Name" },
787
+ { dataIndex: "age", key: "age", title: "Age" },
788
+ { dataIndex: "address", key: "address", title: "Address" },
789
+ ]}
790
+ dataSource={{
791
+ list: [
792
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
793
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
794
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
795
+ ],
796
+ }}
797
+ onRowSelect={(e) => console.log(e.detail)}
798
+ onRowSelectV2={(e) => console.log(e.detail)}
799
+ />
800
+ ```
801
+
802
+ ### Expanded Row Keys
803
+
804
+ 通过 expandedRowKeys 设置默认展开的行。
805
+
806
+ ```tsx
807
+ <WrappedEoNextTable
808
+ expandedRowKeys={[0]}
809
+ expandable={{
810
+ expandedRowBrick: {
811
+ useBrick: {
812
+ brick: "span",
813
+ properties: { textContent: "展开内容" },
814
+ },
815
+ },
816
+ }}
817
+ pagination={false}
818
+ columns={[
819
+ { dataIndex: "name", key: "name", title: "Name" },
820
+ { dataIndex: "age", key: "age", title: "Age" },
821
+ { dataIndex: "address", key: "address", title: "Address" },
822
+ ]}
823
+ dataSource={{
824
+ list: [
825
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
826
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
827
+ { key: 2, name: "Lucy", age: 16, address: "Yunnan" },
828
+ ],
829
+ }}
830
+ onRowExpand={(e) => console.log(e.detail)}
831
+ onExpandedRowsChange={(e) => console.log(e.detail)}
832
+ />
833
+ ```
834
+
835
+ ### Loading
836
+
837
+ 显示加载中状态。
838
+
839
+ ```tsx
840
+ <WrappedEoNextTable
841
+ loading={true}
842
+ columns={[
843
+ { dataIndex: "name", key: "name", title: "Name" },
844
+ { dataIndex: "age", key: "age", title: "Age" },
845
+ { dataIndex: "address", key: "address", title: "Address" },
846
+ ]}
847
+ dataSource={{
848
+ list: [
849
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
850
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
851
+ ],
852
+ }}
853
+ />
854
+ ```
855
+
856
+ ### Show Header
857
+
858
+ 通过 showHeader 控制是否显示表头。
859
+
860
+ ```tsx
861
+ <WrappedEoNextTable
862
+ showHeader={false}
863
+ pagination={false}
864
+ columns={[
865
+ { dataIndex: "name", key: "name", title: "Name" },
866
+ { dataIndex: "age", key: "age", title: "Age" },
867
+ { dataIndex: "address", key: "address", title: "Address" },
868
+ ]}
869
+ dataSource={{
870
+ list: [
871
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
872
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
873
+ ],
874
+ }}
875
+ />
876
+ ```
877
+
878
+ ### Optimized Columns
879
+
880
+ 通过 optimizedColumns 指定需要优化渲染的列。
881
+
882
+ ```tsx
883
+ <WrappedEoNextTable
884
+ optimizedColumns={["name"]}
885
+ pagination={false}
886
+ columns={[
887
+ { dataIndex: "name", key: "name", title: "Name" },
888
+ { dataIndex: "age", key: "age", title: "Age" },
889
+ { dataIndex: "address", key: "address", title: "Address" },
890
+ ]}
891
+ dataSource={{
892
+ list: [
893
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
894
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
895
+ ],
896
+ }}
897
+ />
898
+ ```
899
+
900
+ ### Theme Variant Elevo
901
+
902
+ 使用 themeVariant 为表格设置 elevo 主题样式。
903
+
904
+ ```tsx
905
+ <WrappedEoNextTable
906
+ themeVariant="elevo"
907
+ pagination={false}
908
+ columns={[
909
+ { dataIndex: "name", key: "name", title: "Name" },
910
+ { dataIndex: "age", key: "age", title: "Age" },
911
+ { dataIndex: "address", key: "address", title: "Address" },
912
+ ]}
913
+ dataSource={{
914
+ pageSize: 5,
915
+ page: 1,
916
+ list: [
917
+ { key: 0, name: "Jack", age: 18, address: "Guangzhou" },
918
+ { key: 1, name: "Alex", age: 20, address: "Shanghai" },
919
+ { key: 3, name: "Sam", age: 28, address: "Shenzhen" },
920
+ ],
921
+ }}
922
+ />
923
+ ```