@yidun/antd-super-table 0.1.1 → 0.1.3
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 +177 -150
- package/dist/SuperTable.vue.d.ts +311 -0
- package/dist/components/DynamicList.vue.d.ts +518 -0
- package/dist/components/EllipsisElement.vue.d.ts +347 -0
- package/dist/components/FormFieldItem.vue.d.ts +84 -0
- package/dist/components/FormSearchParams.vue.d.ts +101 -0
- package/dist/components/InputGroup.vue.d.ts +62 -0
- package/dist/components/InputNumberRange.vue.d.ts +44 -0
- package/dist/components/SceneConfigModal.vue.d.ts +93 -0
- package/dist/components/SceneListModal.vue.d.ts +90 -0
- package/dist/components/TableCellContent.vue.d.ts +79 -0
- package/dist/components/TableConfig.vue.d.ts +30 -0
- package/dist/index.js +1736 -2221
- package/example/index.vue +16 -4
- package/package.json +5 -4
- package/dist/example/formItems.d.ts +0 -325
- package/dist/example/main.d.ts +0 -1
- package/dist/example/tableColumns.d.ts +0 -1146
- package/dist/example/type-example.d.ts +0 -0
- /package/dist/{src/components → components}/VNodes.d.ts +0 -0
- /package/dist/{src/config.d.ts → config.d.ts} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/utils → utils}/dialogManager.d.ts +0 -0
- /package/dist/{src/utils → utils}/index.d.ts +0 -0
- /package/dist/{src/utils → utils}/service.d.ts +0 -0
- /package/dist/{src/utils → utils}/useDialog.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
# Antd Super Table 组件
|
|
2
|
+
|
|
2
3
|
## 介绍
|
|
4
|
+
|
|
3
5
|
Antd Super Table 是一个基于 Ant Design Vue 的高级表格组件,提供了丰富的功能特性:
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
- 🔍 灵活的查询条件配置
|
|
8
|
+
- 📊 强大的表格列配置
|
|
9
|
+
- 🎯 场景管理功能
|
|
10
|
+
- ⚡️ 高性能渲染
|
|
11
|
+
- 🛠 可定制的表格配置
|
|
12
|
+
- 🔄 表格拖拽排序
|
|
13
|
+
- 📱 响应式设计
|
|
14
|
+
- 🎨 主题定制
|
|
13
15
|
|
|
14
16
|
## 示例
|
|
17
|
+
|
|
15
18
|

|
|
16
19
|
|
|
17
20
|
## 安装
|
|
21
|
+
|
|
18
22
|
```bash
|
|
19
23
|
npm install @yidun/antd-super-table
|
|
20
24
|
```
|
|
21
25
|
|
|
22
26
|
## 基础用法
|
|
27
|
+
|
|
23
28
|
```vue
|
|
24
29
|
<template>
|
|
25
30
|
<SuperTable :form-items="formItems" :columns="columns" :request="onRequest" scene-type="user-list" />
|
|
@@ -91,39 +96,40 @@ const onRequest = async (options: { params: Record<string, any>; pageSize: numbe
|
|
|
91
96
|
pageSize: options.pageSize,
|
|
92
97
|
}),
|
|
93
98
|
}).then(res => res.json())
|
|
94
|
-
|
|
99
|
+
|
|
95
100
|
return {
|
|
96
101
|
data: res.data,
|
|
97
102
|
total: res.total,
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
</script>
|
|
101
|
-
|
|
102
106
|
```
|
|
103
107
|
|
|
104
108
|
## 查询场景配置
|
|
105
|
-
默认启用场景,场景相关的配置存储在localStorage中
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
| --- | --- | --- | --- |
|
|
109
|
-
| sceneType | string | '' | 场景对应的标识 |
|
|
110
|
-
| enableScene | boolean | `true` | 是否启用场景管理 |
|
|
111
|
-
| sceneStorageType | string | `local` | 场景存储位置,可选 `local` 或 `api` |
|
|
112
|
-
| sceneRequest | object | - | 场景请求函数配置(API模式时必填) |
|
|
113
|
-
| defaultScene | object/array | | 默认场景配置 |
|
|
114
|
-
| maxSceneCount | number | `100` | 最大场景数量 |
|
|
110
|
+
默认启用场景,场景相关的配置存储在localStorage中
|
|
115
111
|
|
|
112
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
113
|
+
| ---------------- | ------------ | ------- | ----------------------------------- |
|
|
114
|
+
| sceneType | string | '' | 场景对应的标识 |
|
|
115
|
+
| enableScene | boolean | `true` | 是否启用场景管理 |
|
|
116
|
+
| sceneStorageType | string | `local` | 场景存储位置,可选 `local` 或 `api` |
|
|
117
|
+
| sceneRequest | object | - | 场景请求函数配置(API模式时必填) |
|
|
118
|
+
| defaultScene | object/array | | 默认场景配置 |
|
|
119
|
+
| maxSceneCount | number | `100` | 最大场景数量 |
|
|
116
120
|
|
|
117
121
|
### 场景存储配置
|
|
122
|
+
|
|
118
123
|
#### 本地存储模式(默认)
|
|
124
|
+
|
|
119
125
|
```vue
|
|
120
126
|
<template>
|
|
121
127
|
<SuperTable :form-items="formItems" :columns="columns" :request="onRequest" scene-storage-type="local" enable-scene />
|
|
122
128
|
</template>
|
|
123
|
-
|
|
124
129
|
```
|
|
125
130
|
|
|
126
131
|
#### API存储模式
|
|
132
|
+
|
|
127
133
|
```vue
|
|
128
134
|
<template>
|
|
129
135
|
<SuperTable
|
|
@@ -180,10 +186,10 @@ const sceneRequest = {
|
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
188
|
</script>
|
|
183
|
-
|
|
184
189
|
```
|
|
185
190
|
|
|
186
191
|
#### 错误处理
|
|
192
|
+
|
|
187
193
|
当 `sceneStorageType` 为 `'api'` 但没有提供 `sceneRequest` 时,组件会在控制台输出错误信息并禁用场景功能:
|
|
188
194
|
|
|
189
195
|
```javascript
|
|
@@ -192,37 +198,40 @@ SuperTable: sceneStorageType 为 "api" 时,必须提供 sceneRequest 配置
|
|
|
192
198
|
```
|
|
193
199
|
|
|
194
200
|
## 查询条件配置
|
|
201
|
+
|
|
195
202
|
### 支持的输入类型
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
|
|
204
|
+
- 文本输入框 (input)
|
|
205
|
+
- 组合输入框 (inputGroup)
|
|
206
|
+
- 数字输入框 (inputNumber)
|
|
207
|
+
- 数字范围输入框 (inputNumberRange)
|
|
208
|
+
- 选择器 (select)
|
|
209
|
+
- 日期选择器 (datePicker)
|
|
210
|
+
- 日期范围选择器 (rangePicker)
|
|
211
|
+
- 级联选择 (cascader)
|
|
212
|
+
- 树形选择 (treeSelect)
|
|
213
|
+
- 自定义组件 (component)
|
|
206
214
|
|
|
207
215
|
### 查询条件属性
|
|
208
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
209
|
-
| --- | --- | --- | --- |
|
|
210
|
-
| type | string | - | 查询条件类型 |
|
|
211
|
-
| name | string | - | 字段名称 |
|
|
212
|
-
| label | string | - | 显示标签 |
|
|
213
|
-
| value | any | - | 默认值 |
|
|
214
|
-
| props | object | {} | 传递给组件的属性 |
|
|
215
|
-
| component | Component | - | 自定义组件(type为component时必填) |
|
|
216
|
-
| modelPropName | string | 'value' | 自定义组件的v-model属性名 |
|
|
217
|
-
| span | number | 1 | 列宽系数 |
|
|
218
|
-
| visible | boolean | true | 是否显示 |
|
|
219
|
-
| fixed | boolean | false | 是否固定(不可删除) |
|
|
220
|
-
| selected | boolean | false | 是否默认选中 |
|
|
221
|
-
| quiet | boolean | false | 是否静默更新(不触发搜索) |
|
|
222
|
-
| showLabel | boolean | true | 是否显示标签 |
|
|
223
216
|
|
|
217
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
218
|
+
| ------------- | --------- | ------- | ----------------------------------- |
|
|
219
|
+
| type | string | - | 查询条件类型 |
|
|
220
|
+
| name | string | - | 字段名称 |
|
|
221
|
+
| label | string | - | 显示标签 |
|
|
222
|
+
| value | any | - | 默认值 |
|
|
223
|
+
| props | object | {} | 传递给组件的属性 |
|
|
224
|
+
| component | Component | - | 自定义组件(type为component时必填) |
|
|
225
|
+
| modelPropName | string | 'value' | 自定义组件的v-model属性名 |
|
|
226
|
+
| span | number | 1 | 列宽系数 |
|
|
227
|
+
| visible | boolean | true | 是否显示 |
|
|
228
|
+
| fixed | boolean | false | 是否固定(不可删除) |
|
|
229
|
+
| selected | boolean | false | 是否默认选中 |
|
|
230
|
+
| quiet | boolean | false | 是否静默更新(不触发搜索) |
|
|
231
|
+
| showLabel | boolean | true | 是否显示标签 |
|
|
224
232
|
|
|
225
233
|
### 完整示例
|
|
234
|
+
|
|
226
235
|
```typescript
|
|
227
236
|
import dayjs from 'dayjs'
|
|
228
237
|
import { Switch } from 'ant-design-vue'
|
|
@@ -400,36 +409,39 @@ export const createFormItems = () => {
|
|
|
400
409
|
```
|
|
401
410
|
|
|
402
411
|
## 表格列配置
|
|
412
|
+
|
|
403
413
|
### 支持的列类型
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
414
|
+
|
|
415
|
+
- 文本 (text)
|
|
416
|
+
- 图片 (image)
|
|
417
|
+
- 标签 (tag)
|
|
418
|
+
- 按钮 (button)
|
|
419
|
+
- 链接 (link)
|
|
420
|
+
- 自定义 (component)
|
|
421
|
+
- 排序 (sort)
|
|
411
422
|
|
|
412
423
|
内置解析类型,均支持在一个单元格内展示多个节点,超出最大个数后会展示更多按钮,点击更多按钮可展开查看所有数据,所以可以扩展出文本列表、图片列表、按钮列表、标签列表等展示形式
|
|
413
424
|
|
|
414
425
|
### 表格列属性
|
|
415
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
416
|
-
| --- | --- | --- | --- |
|
|
417
|
-
| key | string | - | 列的唯一标识 |
|
|
418
|
-
| title | string | - | 列标题 |
|
|
419
|
-
| type | string/function | 'text' | 列类型 |
|
|
420
|
-
| content | string/function | - | 列内容 |
|
|
421
|
-
| titleTooltip | string/function | - | 标题提示信息 |
|
|
422
|
-
| tooltip | string/boolean/function | - | 内容提示信息 |
|
|
423
|
-
| component | Component | - | 自定义组件(type为component时必填) |
|
|
424
|
-
| props | object/function | {} | 传递给组件的属性 |
|
|
425
|
-
| width | number | 120 | 列宽度 |
|
|
426
|
-
| visible | boolean | true | 是否可见 |
|
|
427
|
-
| fixed | string | - | 固定列位置,可选 'left' 或 'right' |
|
|
428
|
-
| copyable | boolean | false | 是否可复制 |
|
|
429
|
-
| ellipsis | boolean | true | 是否超出显示省略号 |
|
|
430
426
|
|
|
427
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
428
|
+
| ------------ | ----------------------- | ------ | ----------------------------------- |
|
|
429
|
+
| key | string | - | 列的唯一标识 |
|
|
430
|
+
| title | string | - | 列标题 |
|
|
431
|
+
| type | string/function | 'text' | 列类型 |
|
|
432
|
+
| content | string/function | - | 列内容 |
|
|
433
|
+
| titleTooltip | string/function | - | 标题提示信息 |
|
|
434
|
+
| tooltip | string/boolean/function | - | 内容提示信息 |
|
|
435
|
+
| component | Component | - | 自定义组件(type为component时必填) |
|
|
436
|
+
| props | object/function | {} | 传递给组件的属性 |
|
|
437
|
+
| width | number | 120 | 列宽度 |
|
|
438
|
+
| visible | boolean | true | 是否可见 |
|
|
439
|
+
| fixed | string | - | 固定列位置,可选 'left' 或 'right' |
|
|
440
|
+
| copyable | boolean | false | 是否可复制 |
|
|
441
|
+
| ellipsis | boolean | true | 是否超出显示省略号 |
|
|
431
442
|
|
|
432
443
|
### 完整示例
|
|
444
|
+
|
|
433
445
|
```typescript
|
|
434
446
|
import { Input } from 'ant-design-vue'
|
|
435
447
|
|
|
@@ -573,7 +585,9 @@ export const createTableColumns = (options: { onDelete: (record: Record<string,
|
|
|
573
585
|
```
|
|
574
586
|
|
|
575
587
|
## 高级功能
|
|
588
|
+
|
|
576
589
|
### 表格拖拽排序
|
|
590
|
+
|
|
577
591
|
```vue
|
|
578
592
|
<template>
|
|
579
593
|
<SuperTable
|
|
@@ -591,18 +605,18 @@ const onRowSortEnd = newData => {
|
|
|
591
605
|
// 处理排序后的数据
|
|
592
606
|
}
|
|
593
607
|
</script>
|
|
594
|
-
|
|
595
608
|
```
|
|
596
609
|
|
|
597
610
|
### 表格配置
|
|
611
|
+
|
|
598
612
|
```vue
|
|
599
613
|
<template>
|
|
600
614
|
<SuperTable :form-items="formItems" :columns="columns" :request="onRequest" :enable-table-config="true" />
|
|
601
615
|
</template>
|
|
602
|
-
|
|
603
616
|
```
|
|
604
617
|
|
|
605
618
|
### 自定义查询参数
|
|
619
|
+
|
|
606
620
|
```vue
|
|
607
621
|
<template>
|
|
608
622
|
<SuperTable
|
|
@@ -612,104 +626,101 @@ const onRowSortEnd = newData => {
|
|
|
612
626
|
:custom-query-params="{ status: 1, type: 'active' }"
|
|
613
627
|
/>
|
|
614
628
|
</template>
|
|
615
|
-
|
|
616
629
|
```
|
|
617
630
|
|
|
618
631
|
### 插槽使用
|
|
632
|
+
|
|
619
633
|
```vue
|
|
620
634
|
<template>
|
|
621
635
|
<SuperTable :form-items="formItems" :columns="columns" :request="onRequest">
|
|
622
636
|
<!-- 场景选择器前的内容 -->
|
|
623
637
|
<template #sceneAddonBefore>
|
|
624
638
|
<a-button type="primary">自定义按钮</a-button>
|
|
625
|
-
|
|
626
639
|
</template>
|
|
627
640
|
|
|
628
641
|
<!-- 场景选择器后的内容 -->
|
|
629
642
|
<template #sceneAddonAfter>
|
|
630
643
|
<a-button>导出</a-button>
|
|
631
|
-
|
|
632
644
|
</template>
|
|
633
645
|
|
|
634
646
|
<!-- 表格头部 -->
|
|
635
647
|
<template #tableHead>
|
|
636
648
|
<h3>用户列表</h3>
|
|
637
|
-
|
|
638
649
|
</template>
|
|
639
650
|
|
|
640
651
|
<!-- 工具栏 -->
|
|
641
652
|
<template #toolBar>
|
|
642
653
|
<a-button type="primary">新增用户</a-button>
|
|
643
|
-
|
|
644
654
|
</template>
|
|
645
655
|
|
|
646
656
|
<!-- 表格底部 -->
|
|
647
657
|
<template #tableFoot>
|
|
648
658
|
<div>总计: {{ total }} 条数据</div>
|
|
649
|
-
|
|
650
659
|
</template>
|
|
651
660
|
|
|
652
661
|
<!-- 展开行 -->
|
|
653
662
|
<template #expandedRowRender="{ record }">
|
|
654
663
|
<p>详细信息: {{ record.description }}</p>
|
|
655
|
-
|
|
656
664
|
</template>
|
|
657
|
-
|
|
658
665
|
</SuperTable>
|
|
659
|
-
|
|
660
666
|
</template>
|
|
661
|
-
|
|
662
667
|
```
|
|
663
668
|
|
|
664
669
|
## API
|
|
670
|
+
|
|
665
671
|
### Props
|
|
666
|
-
|
|
667
|
-
|
|
|
668
|
-
|
|
|
669
|
-
|
|
|
670
|
-
|
|
|
671
|
-
|
|
|
672
|
-
|
|
|
673
|
-
|
|
|
674
|
-
|
|
|
675
|
-
|
|
|
676
|
-
|
|
|
677
|
-
|
|
|
678
|
-
|
|
|
679
|
-
|
|
|
680
|
-
|
|
|
681
|
-
|
|
|
682
|
-
|
|
|
683
|
-
|
|
|
684
|
-
|
|
|
685
|
-
|
|
|
672
|
+
|
|
673
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
674
|
+
| ----------------- | ---------------- | ----------------------------- | ------------------------------- | --------- |
|
|
675
|
+
| formItems | 查询条件配置 | `SuperTableFormItem[]` | `[]` |
|
|
676
|
+
| columns | 表格列配置 | `SuperTableColumn[]` | `[]` |
|
|
677
|
+
| request | 数据请求函数 | `SuperTableRequestFunction` | - |
|
|
678
|
+
| sceneType | 场景类型 | `string` | `''` |
|
|
679
|
+
| enableScene | 是否启用场景管理 | `boolean` | `true` |
|
|
680
|
+
| sceneStorageType | 场景存储位置 | `'local' | 'api'` | `'local'` |
|
|
681
|
+
| sceneRequest | 场景请求函数配置 | `SceneRequestConfig` | - |
|
|
682
|
+
| defaultScene | 默认场景配置 | `SuperTableDefaultSceneConfig | SuperTableDefaultSceneConfig[]` | - |
|
|
683
|
+
| maxSceneCount | 最大场景数量 | `number` | `100` |
|
|
684
|
+
| formItemColSpan | 查询条件列数 | `number` | `6` |
|
|
685
|
+
| debounceWait | 查询防抖时间(ms) | `number` | `100` |
|
|
686
|
+
| refreshDeps | 依赖刷新选项 | `any[]` | `[]` |
|
|
687
|
+
| tableProps | 表格属性 | `TableProps` | `{}` |
|
|
688
|
+
| formatDataSource | 转换表格数据 | `(data: any[]) => any[]` | `(data) => data` |
|
|
689
|
+
| sortable | 是否可排序 | `boolean` | `false` |
|
|
690
|
+
| wrapperStyle | 容器样式 | `object` | `{}` |
|
|
691
|
+
| tableWrapperStyle | 表格容器样式 | `object` | `{}` |
|
|
692
|
+
| customQueryParams | 默认查询条件 | `object` | `{}` |
|
|
693
|
+
| showRefreshButton | 展示刷新按钮 | `boolean` | `false` |
|
|
686
694
|
| enableTableConfig | 开启表格设置 | `boolean` | `true` |
|
|
687
695
|
|
|
688
696
|
### Events
|
|
689
|
-
| 事件名 | 说明 | 回调参数 |
|
|
690
|
-
| --- | --- | --- |
|
|
691
|
-
| form-item-change | 表单项值变更 | `(name: string, value: any, formItem: SuperTableFormItem) => void` |
|
|
692
|
-
| scene-change | 场景切换 | `(scene: SuperTableQueryScene) => void` |
|
|
693
|
-
| sort-change | 排序变化 | `(sorter: any) => void` |
|
|
694
|
-
| row-sort-end | 行排序结束 | `(newData: any[]) => void` |
|
|
695
697
|
|
|
698
|
+
| 事件名 | 说明 | 回调参数 |
|
|
699
|
+
| ---------------- | ------------ | ------------------------------------------------------------------ |
|
|
700
|
+
| form-item-change | 表单项值变更 | `(name: string, value: any, formItem: SuperTableFormItem) => void` |
|
|
701
|
+
| scene-change | 场景切换 | `(scene: SuperTableQueryScene) => void` |
|
|
702
|
+
| sort-change | 排序变化 | `(sorter: any) => void` |
|
|
703
|
+
| row-sort-end | 行排序结束 | `(newData: any[]) => void` |
|
|
696
704
|
|
|
697
705
|
### Methods
|
|
698
|
-
|
|
699
|
-
|
|
|
700
|
-
|
|
|
701
|
-
|
|
|
702
|
-
|
|
|
703
|
-
|
|
|
704
|
-
|
|
|
705
|
-
|
|
|
706
|
-
|
|
|
707
|
-
|
|
|
708
|
-
|
|
|
706
|
+
|
|
707
|
+
| 方法名 | 说明 | 参数 |
|
|
708
|
+
| ---------------- | ---------------- | --------------------------------------------------------- | --------------------------------- |
|
|
709
|
+
| getFormItem | 获取表单项配置 | `(name: string) => SuperTableFormItem | undefined` |
|
|
710
|
+
| setFormItem | 设置表单项配置 | `(name: string, keyPath: string, newConfig: any) => void` |
|
|
711
|
+
| getFormValue | 获取表单项值 | `(name: string) => any` |
|
|
712
|
+
| setFormValue | 设置表单项值 | `(name: string, value: any) => void` |
|
|
713
|
+
| getFormValues | 获取所有表单项值 | `(name?: string | string[]) => Record<string, any>` |
|
|
714
|
+
| setFormValues | 批量设置表单项值 | `(values: Record<string, any>) => void` |
|
|
715
|
+
| getTableData | 获取表格数据 | `() => any[]` |
|
|
716
|
+
| setTableData | 设置表格数据 | `(data: any[]) => void` |
|
|
717
|
+
| setTableDataItem | 修改单条数据 | `(index: number, data: Record<string, any>) => void` |
|
|
709
718
|
| onRefresh | 刷新表格数据 | `() => void` |
|
|
710
719
|
|
|
711
720
|
## TypeScript 类型定义
|
|
721
|
+
|
|
712
722
|
### 基础类型
|
|
723
|
+
|
|
713
724
|
```typescript
|
|
714
725
|
/** 表格列对应的type类型 */
|
|
715
726
|
export type SuperTableColumnType = 'text' | 'link' | 'button' | 'tag' | 'image' | 'component' | 'sort'
|
|
@@ -738,6 +749,7 @@ export type SuperTableSortOrders = 'ascend' | 'descend' | null
|
|
|
738
749
|
```
|
|
739
750
|
|
|
740
751
|
### 表格列配置
|
|
752
|
+
|
|
741
753
|
```typescript
|
|
742
754
|
/** 表格列配置 */
|
|
743
755
|
export interface SuperTableColumn {
|
|
@@ -785,6 +797,7 @@ export interface SuperTableColumn {
|
|
|
785
797
|
```
|
|
786
798
|
|
|
787
799
|
### 查询条件配置
|
|
800
|
+
|
|
788
801
|
```typescript
|
|
789
802
|
/** 查询条件配置 */
|
|
790
803
|
export interface SuperTableFormItem {
|
|
@@ -850,6 +863,7 @@ export interface SuperTableFormItem {
|
|
|
850
863
|
```
|
|
851
864
|
|
|
852
865
|
### 场景管理类型
|
|
866
|
+
|
|
853
867
|
```typescript
|
|
854
868
|
/** 场景请求函数配置 */
|
|
855
869
|
export interface SceneRequestConfig {
|
|
@@ -948,6 +962,7 @@ export interface SuperTableSceneState {
|
|
|
948
962
|
```
|
|
949
963
|
|
|
950
964
|
### 数据请求类型
|
|
965
|
+
|
|
951
966
|
```typescript
|
|
952
967
|
/** 数据请求方法 */
|
|
953
968
|
export type SuperTableRequestFunction = (options: {
|
|
@@ -972,51 +987,63 @@ export interface SuperTableAntdProps extends TableProps {
|
|
|
972
987
|
```
|
|
973
988
|
|
|
974
989
|
## 注意事项
|
|
990
|
+
|
|
975
991
|
1. **依赖要求**:组件依赖于 Ant Design Vue,请确保项目中已安装相关依赖
|
|
976
992
|
2. **TypeScript 支持**:TypeScript 项目需要在 `tsconfig.json` 中配置类型声明文件路径
|
|
977
993
|
3. **自定义组件**:自定义组件需要通过 `component` 属性传入,并确保组件已全局注册或局部引入
|
|
978
994
|
4. **场景管理**:
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
995
|
+
- 场景管理功能需要配置 `sceneType` 属性
|
|
996
|
+
- 使用 `local` 存储模式时,场景数据保存在浏览器的 localStorage 中
|
|
997
|
+
- 使用 `api` 存储模式时,必须提供 `sceneRequest` 配置,否则会禁用场景功能并在控制台输出错误信息
|
|
982
998
|
5. **性能优化**:组件内置了防抖、虚拟滚动等性能优化,大数据量场景下表现良好
|
|
983
999
|
6. **响应式设计**:组件支持响应式布局,可根据屏幕尺寸自动调整
|
|
984
1000
|
7. **主题定制**:支持通过 CSS 变量或 Ant Design 主题系统进行样式定制
|
|
985
1001
|
|
|
986
1002
|
## 更新日志
|
|
1003
|
+
|
|
987
1004
|
### v0.0.7
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
+
|
|
1006
|
+
- 🔄 **重构场景管理API**:
|
|
1007
|
+
- 将 `sceneRequestUrls` 重构为 `sceneRequest`
|
|
1008
|
+
- 从传递URL字符串改为传递请求函数,提供更大的灵活性
|
|
1009
|
+
- 支持自定义请求逻辑、错误处理和认证机制
|
|
1010
|
+
- 🔧 **优化错误处理**:
|
|
1011
|
+
- 当 `sceneStorageType` 为 `'api'` 但未提供 `sceneRequest` 时,提供清晰的错误提示
|
|
1012
|
+
- 实现优雅降级,避免应用崩溃
|
|
1013
|
+
- 🗑️ **移除冗余代码**:
|
|
1014
|
+
- 删除 `apiSceneService` 中间层,直接使用 `sceneRequest`
|
|
1015
|
+
- 简化架构,提高代码可维护性
|
|
1016
|
+
- 📚 **完善文档**:
|
|
1017
|
+
- 更新API文档和类型定义
|
|
1018
|
+
- 添加详细的配置示例和错误处理说明
|
|
1019
|
+
- 提供本地存储和API存储两种模式的完整示例
|
|
1020
|
+
- 🖼️ **修复文档图片**:
|
|
1021
|
+
- 修复 npm 包中示例图片无法显示的问题
|
|
1022
|
+
- 使用 CDN 方式确保图片在不同平台都能正确显示
|
|
1005
1023
|
|
|
1006
1024
|
### v0.0.6
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1025
|
+
|
|
1026
|
+
- 🐛 修复场景管理相关问题
|
|
1027
|
+
- 🐛 修复表格列配置缓存问题
|
|
1028
|
+
- 💄 优化UI样式和交互体验
|
|
1010
1029
|
|
|
1011
1030
|
### v0.0.2
|
|
1012
|
-
+ ✨ 新增表格拖拽排序功能
|
|
1013
|
-
+ ✨ 新增表格配置功能
|
|
1014
|
-
+ ✨ 新增自定义查询参数支持
|
|
1015
|
-
+ ✨ 新增多种插槽支持
|
|
1016
|
-
+ ✨ 新增级联选择和树形选择组件
|
|
1017
|
-
+ 🐛 修复场景管理相关问题
|
|
1018
|
-
+ 🐛 修复表格列配置缓存问题
|
|
1019
|
-
+ 💄 优化UI样式和交互体验
|
|
1020
|
-
+ 📚 完善TypeScript类型定义
|
|
1021
|
-
+ 📚 更新文档和示例代码
|
|
1022
1031
|
|
|
1032
|
+
- ✨ 新增表格拖拽排序功能
|
|
1033
|
+
- ✨ 新增表格配置功能
|
|
1034
|
+
- ✨ 新增自定义查询参数支持
|
|
1035
|
+
- ✨ 新增多种插槽支持
|
|
1036
|
+
- ✨ 新增级联选择和树形选择组件
|
|
1037
|
+
- 🐛 修复场景管理相关问题
|
|
1038
|
+
- 🐛 修复表格列配置缓存问题
|
|
1039
|
+
- 💄 优化UI样式和交互体验
|
|
1040
|
+
- 📚 完善TypeScript类型定义
|
|
1041
|
+
- 📚 更新文档和示例代码
|
|
1042
|
+
|
|
1043
|
+
## 更新记录
|
|
1044
|
+
|
|
1045
|
+
### 0.1.2
|
|
1046
|
+
|
|
1047
|
+
- 新增 `tableWrapperStyle` 属性,支持自定义表格容器样式。
|
|
1048
|
+
- 修复 `toolBarExtra` 插槽在未提供 `tableHead` 时无法展示的问题。
|
|
1049
|
+
- 修复 `rowKey` 为函数时构建声明文件的类型错误。
|