@yidun/antd-super-table 0.0.7 → 0.0.8
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 +163 -181
- package/dist/example/formItems.d.ts +325 -0
- package/dist/example/main.d.ts +1 -0
- package/dist/example/tableColumns.d.ts +1116 -0
- package/dist/index.js +1962 -1699
- package/dist/{index.d.ts → src/index.d.ts} +4 -0
- package/dist/src/typings.d.ts +358 -0
- package/dist/{utils → src/utils}/index.d.ts +8 -5
- package/dist/typings.ts +193 -80
- package/package.json +3 -2
- package/dist/typings.d.ts +0 -233
- /package/dist/{components → src/components}/VNodes.d.ts +0 -0
- /package/dist/{config.d.ts → src/config.d.ts} +0 -0
- /package/dist/{utils → src/utils}/dialogManager.d.ts +0 -0
- /package/dist/{utils → src/utils}/service.d.ts +0 -0
- /package/dist/{utils → src/utils}/useDialog.d.ts +0 -0
package/dist/typings.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { SelectProps, TableProps, PaginationProps } from 'ant-design-vue'
|
|
2
2
|
import type { Component, Reactive, Ref } from 'vue'
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* 表格列对应的类型枚举
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
5
8
|
export type SuperTableColumnType = 'text' | 'link' | 'button' | 'tag' | 'image' | 'component' | 'sort'
|
|
6
9
|
|
|
7
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* 查询表单项对应的类型枚举
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
8
14
|
export type SuperTableFormItemType =
|
|
9
15
|
| 'input'
|
|
10
16
|
| 'inputGroup'
|
|
@@ -17,21 +23,48 @@ export type SuperTableFormItemType =
|
|
|
17
23
|
| 'rangePicker'
|
|
18
24
|
| 'component'
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
/**
|
|
27
|
+
* 表格列吸附方式类型
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export type SuperTableColumnFixedType = 'left' | 'right' | false
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 排序方式类型
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export type SuperTableSortOrders = 'ascend' | 'descend' | null
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 场景存储类型
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export type SuperTableSceneStorageType = 'local' | 'api'
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 表格数据项类型
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export type SuperTableDataItem = Record<string, any>
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 查询条件配置接口
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
21
54
|
export interface SuperTableFormItem {
|
|
22
|
-
/**
|
|
55
|
+
/** 查询项类型 */
|
|
23
56
|
type: SuperTableFormItemType
|
|
24
57
|
|
|
25
58
|
/** 查询项对应的字段名称 */
|
|
26
59
|
name: string
|
|
27
60
|
|
|
28
|
-
/** 绑定数据时v-model对应的name
|
|
61
|
+
/** 绑定数据时v-model对应的name,默认为value */
|
|
29
62
|
modelPropName?: string
|
|
30
63
|
|
|
31
|
-
/**
|
|
64
|
+
/** 查询项标签 */
|
|
32
65
|
label: string
|
|
33
66
|
|
|
34
|
-
/**
|
|
67
|
+
/** 传递给查询项的props */
|
|
35
68
|
props?: Record<string, any>
|
|
36
69
|
|
|
37
70
|
/** 选项值 */
|
|
@@ -49,7 +82,7 @@ export interface SuperTableFormItem {
|
|
|
49
82
|
/** 带select前缀的组合输入框配置 */
|
|
50
83
|
addonBeforeProps?: SelectProps
|
|
51
84
|
|
|
52
|
-
/**
|
|
85
|
+
/** 改变时保持静默,不要触发搜索 */
|
|
53
86
|
quiet?: boolean
|
|
54
87
|
|
|
55
88
|
/** 是否展示label,默认展示 */
|
|
@@ -59,12 +92,13 @@ export interface SuperTableFormItem {
|
|
|
59
92
|
fixed?: boolean
|
|
60
93
|
|
|
61
94
|
/**
|
|
62
|
-
*
|
|
95
|
+
* 默认选中,开启后表现为:
|
|
63
96
|
* 1. 高级搜索弹窗打开时会默认选中对应的搜索项
|
|
64
|
-
* 2. 没有配置默认场景时,会根据选中的项目生成一个默认场景
|
|
97
|
+
* 2. 没有配置默认场景时,会根据选中的项目生成一个默认场景
|
|
98
|
+
*/
|
|
65
99
|
selected?: boolean
|
|
66
100
|
|
|
67
|
-
|
|
101
|
+
/** @internal 以下为内置属性,不允许修改 */
|
|
68
102
|
|
|
69
103
|
/** 默认值 */
|
|
70
104
|
_defaultValue?: any
|
|
@@ -81,40 +115,34 @@ export interface SuperTableFormItem {
|
|
|
81
115
|
[key: string]: any
|
|
82
116
|
}
|
|
83
117
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export type TableColumnFixedType = 'left' | 'right'
|
|
89
|
-
|
|
90
|
-
/** 排序方式 */
|
|
91
|
-
export type SortOrders = 'ascending' | 'descending' | null
|
|
92
|
-
|
|
93
|
-
/** 表格表头配置 */
|
|
118
|
+
/**
|
|
119
|
+
* 表格列配置接口
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
94
122
|
export interface SuperTableColumn {
|
|
95
|
-
/**
|
|
123
|
+
/** 列对应的key */
|
|
96
124
|
key: string
|
|
97
125
|
|
|
98
|
-
/**
|
|
99
|
-
type?: SuperTableColumnType | ((row:
|
|
126
|
+
/** 展示类型:text-文本,button-按钮,link-链接,tag-标签,component-自定义组件 */
|
|
127
|
+
type?: SuperTableColumnType | ((row: SuperTableDataItem, index: number) => SuperTableColumnType)
|
|
100
128
|
|
|
101
129
|
/** 标题 */
|
|
102
130
|
title: string
|
|
103
131
|
|
|
104
132
|
/** 标题对应的提示信息 */
|
|
105
|
-
titleTooltip?: string | ((row:
|
|
133
|
+
titleTooltip?: string | ((row: SuperTableDataItem, index: number) => string)
|
|
106
134
|
|
|
107
135
|
/** 表格内容 */
|
|
108
|
-
content?: string | ((row:
|
|
136
|
+
content?: string | ((row: SuperTableDataItem, index: number) => any)
|
|
109
137
|
|
|
110
138
|
/** 表格内容对应的提示信息 */
|
|
111
|
-
tooltip?: string | boolean | ((row:
|
|
139
|
+
tooltip?: string | boolean | ((row: SuperTableDataItem, index: number) => string)
|
|
112
140
|
|
|
113
141
|
/** 表格内容解析自定义组件 */
|
|
114
142
|
component?: Component
|
|
115
143
|
|
|
116
|
-
/**
|
|
117
|
-
props?: Record<string, any> | ((row:
|
|
144
|
+
/** 表格内容解析用到的组件对应的props */
|
|
145
|
+
props?: Record<string, any> | ((row: SuperTableDataItem, index: number) => Record<string, any>)
|
|
118
146
|
|
|
119
147
|
/** 是否可复制 */
|
|
120
148
|
copyable?: boolean
|
|
@@ -128,12 +156,40 @@ export interface SuperTableColumn {
|
|
|
128
156
|
/** 宽度 */
|
|
129
157
|
width?: number
|
|
130
158
|
|
|
159
|
+
/** 固定列位置 */
|
|
160
|
+
fixed?: SuperTableColumnFixedType
|
|
161
|
+
|
|
162
|
+
/** 排序 */
|
|
163
|
+
sorter?: boolean | ((a: SuperTableDataItem, b: SuperTableDataItem) => number)
|
|
164
|
+
|
|
165
|
+
/** 默认排序 */
|
|
166
|
+
defaultSortOrder?: SuperTableSortOrders
|
|
167
|
+
|
|
168
|
+
/** 列索引 */
|
|
169
|
+
index?: number
|
|
170
|
+
|
|
131
171
|
[key: string]: any
|
|
132
172
|
}
|
|
133
173
|
|
|
134
174
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
175
|
+
* 场景中保存的查询条件配置接口
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
178
|
+
export interface SuperTableQuerySceneItem {
|
|
179
|
+
/** 字段名称 */
|
|
180
|
+
name: string
|
|
181
|
+
|
|
182
|
+
/** 字段类型 */
|
|
183
|
+
type: SuperTableFormItemType
|
|
184
|
+
|
|
185
|
+
/** 字段值 */
|
|
186
|
+
value: any
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 查询场景接口
|
|
191
|
+
* @public
|
|
192
|
+
*/
|
|
137
193
|
export interface SuperTableQueryScene {
|
|
138
194
|
/** 场景唯一标识 */
|
|
139
195
|
code: string
|
|
@@ -157,24 +213,15 @@ export interface SuperTableQueryScene {
|
|
|
157
213
|
isCustom?: boolean
|
|
158
214
|
}
|
|
159
215
|
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
/** 字段类型 */
|
|
166
|
-
type: string
|
|
167
|
-
|
|
168
|
-
/** 字段值 */
|
|
169
|
-
value: any
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/** 默认场景配置 */
|
|
173
|
-
export interface DefaultSceneConfig {
|
|
216
|
+
/**
|
|
217
|
+
* 默认场景配置接口
|
|
218
|
+
* @public
|
|
219
|
+
*/
|
|
220
|
+
export interface SuperTableDefaultSceneConfig {
|
|
174
221
|
/** 场景名称 */
|
|
175
222
|
name?: string
|
|
176
223
|
|
|
177
|
-
/**
|
|
224
|
+
/** 场景唯一标识,多个自定义场景时必填 */
|
|
178
225
|
code?: string
|
|
179
226
|
|
|
180
227
|
/** 查询项列表 */
|
|
@@ -186,7 +233,10 @@ export interface DefaultSceneConfig {
|
|
|
186
233
|
}[]
|
|
187
234
|
}
|
|
188
235
|
|
|
189
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* 场景状态接口
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
190
240
|
export interface SuperTableSceneState {
|
|
191
241
|
/** 查询场景列表 */
|
|
192
242
|
list: SuperTableQueryScene[]
|
|
@@ -201,7 +251,10 @@ export interface SuperTableSceneState {
|
|
|
201
251
|
loaded: boolean
|
|
202
252
|
}
|
|
203
253
|
|
|
204
|
-
/**
|
|
254
|
+
/**
|
|
255
|
+
* 提供给弹窗使用的表格全局状态接口
|
|
256
|
+
* @public
|
|
257
|
+
*/
|
|
205
258
|
export interface SuperTableContext {
|
|
206
259
|
/** 场景类型 */
|
|
207
260
|
sceneType: string
|
|
@@ -225,8 +278,35 @@ export interface SuperTableContext {
|
|
|
225
278
|
allowCreateScene: Ref<boolean>
|
|
226
279
|
}
|
|
227
280
|
|
|
228
|
-
/**
|
|
229
|
-
|
|
281
|
+
/**
|
|
282
|
+
* 场景请求配置接口
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
export interface SuperTableSceneRequestConfig {
|
|
286
|
+
/** 查询场景列表 */
|
|
287
|
+
querySceneList: (params: { type: string }) => Promise<{ code: number; data: SuperTableQueryScene[]; msg: string }>
|
|
288
|
+
/** 创建场景 */
|
|
289
|
+
createScene: (params: {
|
|
290
|
+
type: string
|
|
291
|
+
name: string
|
|
292
|
+
value: string
|
|
293
|
+
asPrivate?: boolean
|
|
294
|
+
}) => Promise<{ code: number; data: string; msg: string }>
|
|
295
|
+
/** 更新场景 */
|
|
296
|
+
updateScene: (params: {
|
|
297
|
+
code: string
|
|
298
|
+
name: string
|
|
299
|
+
value: string
|
|
300
|
+
}) => Promise<{ code: number; msg: string }>
|
|
301
|
+
/** 删除场景 */
|
|
302
|
+
deleteScene: (params: string[]) => Promise<{ code: number; msg: string }>
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* 数据请求方法类型
|
|
307
|
+
* @public
|
|
308
|
+
*/
|
|
309
|
+
export type SuperTableRequestFunction = (options: {
|
|
230
310
|
/** 查询参数 */
|
|
231
311
|
params: Record<string, any>
|
|
232
312
|
|
|
@@ -239,80 +319,113 @@ export type PropTableRequestFunction = (options: {
|
|
|
239
319
|
[key: string]: any
|
|
240
320
|
}) => Promise<{ total: number; data: Record<string, any>[] }>
|
|
241
321
|
|
|
242
|
-
|
|
322
|
+
/**
|
|
323
|
+
* Antd表格属性扩展接口
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
326
|
+
export interface SuperTableAntdProps extends Omit<TableProps, 'columns' | 'dataSource' | 'pagination'> {
|
|
243
327
|
pagination: PaginationProps
|
|
244
328
|
columns: SuperTableColumn[]
|
|
245
|
-
dataSource:
|
|
329
|
+
dataSource: SuperTableDataItem[]
|
|
246
330
|
}
|
|
247
331
|
|
|
248
|
-
/**
|
|
249
|
-
|
|
332
|
+
/**
|
|
333
|
+
* 表单操作方法接口
|
|
334
|
+
* @public
|
|
335
|
+
*/
|
|
336
|
+
export interface SuperTableFormOperations {
|
|
250
337
|
/**
|
|
251
338
|
* 获取表单项配置
|
|
252
|
-
* @param
|
|
253
|
-
* @returns
|
|
339
|
+
* @param name - 表单项名称
|
|
340
|
+
* @returns 表单项配置
|
|
254
341
|
*/
|
|
255
342
|
getFormItem(name: string): SuperTableFormItem | undefined
|
|
256
343
|
|
|
257
344
|
/**
|
|
258
345
|
* 设置表单项配置
|
|
259
|
-
* @param
|
|
260
|
-
* @param
|
|
261
|
-
* @param
|
|
262
|
-
* @returns {void}
|
|
346
|
+
* @param name - 表单项名称
|
|
347
|
+
* @param keyPath - 配置路径
|
|
348
|
+
* @param newConfig - 新的配置值
|
|
263
349
|
*/
|
|
264
350
|
setFormItem(name: string, keyPath: string, newConfig: any): void
|
|
265
351
|
|
|
266
352
|
/**
|
|
267
353
|
* 获取表单值
|
|
268
|
-
* @param
|
|
269
|
-
* @returns
|
|
354
|
+
* @param name - 表单项名称或名称数组,不传则获取所有值
|
|
355
|
+
* @returns 表单值对象
|
|
270
356
|
*/
|
|
271
357
|
getFormValues(name?: string | string[]): Record<string, any>
|
|
272
358
|
|
|
273
359
|
/**
|
|
274
360
|
* 设置表单值
|
|
275
|
-
* @param
|
|
276
|
-
* @returns {void}
|
|
361
|
+
* @param values - 要设置的表单值对象
|
|
277
362
|
*/
|
|
278
363
|
setFormValues(values: Record<string, any>): void
|
|
279
364
|
|
|
280
365
|
/**
|
|
281
366
|
* 获取单个表单项值
|
|
282
|
-
* @param
|
|
283
|
-
* @returns
|
|
367
|
+
* @param name - 表单项名称
|
|
368
|
+
* @returns 表单项值
|
|
284
369
|
*/
|
|
285
370
|
getFormValue(name: string): any
|
|
286
371
|
|
|
287
372
|
/**
|
|
288
373
|
* 设置单个表单项值
|
|
289
|
-
* @param
|
|
290
|
-
* @param
|
|
291
|
-
* @returns {void}
|
|
374
|
+
* @param name - 表单项名称
|
|
375
|
+
* @param value - 要设置的值
|
|
292
376
|
*/
|
|
293
377
|
setFormValue(name: string, value: any): void
|
|
294
378
|
}
|
|
295
379
|
|
|
296
|
-
/**
|
|
297
|
-
|
|
380
|
+
/**
|
|
381
|
+
* 表格操作方法接口
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
384
|
+
export interface SuperTableTableOperations {
|
|
298
385
|
/**
|
|
299
386
|
* 获取表格数据
|
|
300
|
-
* @returns
|
|
387
|
+
* @returns 表格数据数组
|
|
301
388
|
*/
|
|
302
|
-
getTableData():
|
|
389
|
+
getTableData(): SuperTableDataItem[]
|
|
303
390
|
|
|
304
391
|
/**
|
|
305
392
|
* 设置表格数据
|
|
306
|
-
* @param
|
|
307
|
-
* @returns {void}
|
|
393
|
+
* @param data - 要设置的表格数据
|
|
308
394
|
*/
|
|
309
|
-
setTableData(data:
|
|
395
|
+
setTableData(data: SuperTableDataItem[]): void
|
|
310
396
|
|
|
311
397
|
/**
|
|
312
398
|
* 设置表格数据项
|
|
313
|
-
* @param
|
|
314
|
-
* @param
|
|
315
|
-
|
|
399
|
+
* @param index - 数据项索引
|
|
400
|
+
* @param data - 要设置的数据项
|
|
401
|
+
*/
|
|
402
|
+
setTableDataItem(index: number, data: Partial<SuperTableDataItem>): void
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* 刷新表格数据
|
|
316
406
|
*/
|
|
317
|
-
|
|
407
|
+
onRefresh(): void
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* 组件实例类型
|
|
412
|
+
* @public
|
|
413
|
+
*/
|
|
414
|
+
export interface SuperTableSlots {
|
|
415
|
+
/** 场景选择器前面的插槽 */
|
|
416
|
+
sceneAddonBefore?: () => any
|
|
417
|
+
/** 场景选择器后面的插槽 */
|
|
418
|
+
sceneAddonAfter?: () => any
|
|
419
|
+
/** 额外内容插槽 */
|
|
420
|
+
extra?: () => any
|
|
421
|
+
/** 表格头部插槽 */
|
|
422
|
+
tableHead?: () => any
|
|
423
|
+
/** 工具栏额外按钮插槽 */
|
|
424
|
+
toolBarExtra?: () => any
|
|
425
|
+
/** 展开列标题插槽 */
|
|
426
|
+
expandColumnTitle?: () => any
|
|
427
|
+
/** 表格底部插槽 */
|
|
428
|
+
tableFoot?: () => any
|
|
429
|
+
/** 展开行内容插槽 */
|
|
430
|
+
expandedRowRender?: (props: { record: any }) => any
|
|
318
431
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yidun/antd-super-table",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"build": "vite build --mode lib && tsc --emitDeclarationOnly && cp src/typings.ts dist/",
|
|
15
15
|
"preview": "vite preview",
|
|
16
16
|
"tsc": "tsc --noEmit --project tsconfig.json",
|
|
17
|
-
"lint": "eslint src --
|
|
17
|
+
"lint": "eslint src --ext .js,.ts,.vue",
|
|
18
|
+
"lint:fix": "eslint src --fix",
|
|
18
19
|
"format": "prettier --write src/"
|
|
19
20
|
},
|
|
20
21
|
"optionalDependencies": {
|
package/dist/typings.d.ts
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import type { SelectProps, TableProps, PaginationProps } from 'ant-design-vue';
|
|
2
|
-
import type { Component, Reactive, Ref } from 'vue';
|
|
3
|
-
/** 表格列对应的type类型 */
|
|
4
|
-
export type SuperTableColumnType = 'text' | 'link' | 'button' | 'tag' | 'image' | 'component' | 'sort';
|
|
5
|
-
/** 查询表单项对应的type类型 */
|
|
6
|
-
export type SuperTableFormItemType = 'input' | 'inputGroup' | 'inputNumber' | 'inputNumberRange' | 'select' | 'treeSelect' | 'cascader' | 'datePicker' | 'rangePicker' | 'component';
|
|
7
|
-
export interface SuperTableFormItem {
|
|
8
|
-
/** 查询详类型 */
|
|
9
|
-
type: SuperTableFormItemType;
|
|
10
|
-
/** 查询项对应的字段名称 */
|
|
11
|
-
name: string;
|
|
12
|
-
/** 绑定数据时v-model对应的name,默认value */
|
|
13
|
-
modelPropName?: string;
|
|
14
|
-
/** 查询项label */
|
|
15
|
-
label: string;
|
|
16
|
-
/** 传递给查询详的props */
|
|
17
|
-
props?: Record<string, any>;
|
|
18
|
-
/** 选项值 */
|
|
19
|
-
value?: any;
|
|
20
|
-
/** 自定义组件 */
|
|
21
|
-
component?: Component;
|
|
22
|
-
/** 查询项宽度系数 */
|
|
23
|
-
span?: number;
|
|
24
|
-
/** 是否显示 */
|
|
25
|
-
visible?: boolean;
|
|
26
|
-
/** 带select前缀的组合输入框配置 */
|
|
27
|
-
addonBeforeProps?: SelectProps;
|
|
28
|
-
/** 改变时保持静默,不要触发搜索*/
|
|
29
|
-
quiet?: boolean;
|
|
30
|
-
/** 是否展示label,默认展示 */
|
|
31
|
-
showLabel?: boolean;
|
|
32
|
-
/** 固定选项,不允许删除,高级搜索时一定会默认展示 */
|
|
33
|
-
fixed?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* 默认选中,开启后表现为
|
|
36
|
-
* 1. 高级搜索弹窗打开时会默认选中对应的搜索项
|
|
37
|
-
* 2. 没有配置默认场景时,会根据选中的项目生成一个默认场景 */
|
|
38
|
-
selected?: boolean;
|
|
39
|
-
/** 默认值 */
|
|
40
|
-
_defaultValue?: any;
|
|
41
|
-
/** 排序 */
|
|
42
|
-
_order?: number;
|
|
43
|
-
/** 是否选中 */
|
|
44
|
-
_selected?: boolean;
|
|
45
|
-
/** 在选中场景中的排序 */
|
|
46
|
-
_orderInScene?: number;
|
|
47
|
-
[key: string]: any;
|
|
48
|
-
}
|
|
49
|
-
/** 表格单条数据 */
|
|
50
|
-
export type TableDataItem = Record<string, any>;
|
|
51
|
-
/** 表格列吸附方式 */
|
|
52
|
-
export type TableColumnFixedType = 'left' | 'right';
|
|
53
|
-
/** 排序方式 */
|
|
54
|
-
export type SortOrders = 'ascending' | 'descending' | null;
|
|
55
|
-
/** 表格表头配置 */
|
|
56
|
-
export interface SuperTableColumn {
|
|
57
|
-
/** 列对应key */
|
|
58
|
-
key: string;
|
|
59
|
-
/** 展示类型 text: 文本 button: 按钮 link: 链接 tag: 标签 component:自定义组件 */
|
|
60
|
-
type?: SuperTableColumnType | ((row: TableDataItem, index: number) => SuperTableColumnType);
|
|
61
|
-
/** 标题 */
|
|
62
|
-
title: string;
|
|
63
|
-
/** 标题对应的提示信息 */
|
|
64
|
-
titleTooltip?: string | ((row: TableDataItem, index: number) => string);
|
|
65
|
-
/** 表格内容 */
|
|
66
|
-
content?: string | ((row: TableDataItem, index: number) => any);
|
|
67
|
-
/** 表格内容对应的提示信息 */
|
|
68
|
-
tooltip?: string | boolean | ((row: TableDataItem, index: number) => string);
|
|
69
|
-
/** 表格内容解析自定义组件 */
|
|
70
|
-
component?: Component;
|
|
71
|
-
/** 表格内容解析用到的组件组件对应的props */
|
|
72
|
-
props?: Record<string, any> | ((row: TableDataItem, index: number) => Record<string, any>);
|
|
73
|
-
/** 是否可复制 */
|
|
74
|
-
copyable?: boolean;
|
|
75
|
-
/** 是否超出显示省略号 */
|
|
76
|
-
ellipsis?: boolean;
|
|
77
|
-
/** 是否可见 */
|
|
78
|
-
visible?: boolean;
|
|
79
|
-
/** 宽度 */
|
|
80
|
-
width?: number;
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 查询场景 https://docs.popo.netease.com/lingxi/1f2fdcb62291477f8056457f63fa3fcd?appVersion=4.15.0&deviceType=4&popo_hidenativebar=1&popo_noindicator=1&disposable_login_token=1
|
|
85
|
-
* */
|
|
86
|
-
export interface SuperTableQueryScene {
|
|
87
|
-
/** 场景唯一标识 */
|
|
88
|
-
code: string;
|
|
89
|
-
/** 场景名称 */
|
|
90
|
-
name: string;
|
|
91
|
-
/** 配置类型 */
|
|
92
|
-
type?: string;
|
|
93
|
-
/** 配置详情 */
|
|
94
|
-
value?: string;
|
|
95
|
-
/** 查询项列表 */
|
|
96
|
-
items: SuperTableQuerySceneItem[];
|
|
97
|
-
/** 是否是私有配置 */
|
|
98
|
-
asPrivate?: boolean;
|
|
99
|
-
/** 是否是自定义场景 */
|
|
100
|
-
isCustom?: boolean;
|
|
101
|
-
}
|
|
102
|
-
/** 场景中保存的查询条件配置 */
|
|
103
|
-
export interface SuperTableQuerySceneItem {
|
|
104
|
-
/** 字段名称 */
|
|
105
|
-
name: string;
|
|
106
|
-
/** 字段类型 */
|
|
107
|
-
type: string;
|
|
108
|
-
/** 字段值 */
|
|
109
|
-
value: any;
|
|
110
|
-
}
|
|
111
|
-
/** 默认场景配置 */
|
|
112
|
-
export interface DefaultSceneConfig {
|
|
113
|
-
/** 场景名称 */
|
|
114
|
-
name?: string;
|
|
115
|
-
/** 场景唯一表示,多个自定义场景时必填 */
|
|
116
|
-
code?: string;
|
|
117
|
-
/** 查询项列表 */
|
|
118
|
-
items: {
|
|
119
|
-
/** 字段名称 */
|
|
120
|
-
name: string;
|
|
121
|
-
/** 字段值 */
|
|
122
|
-
value: any;
|
|
123
|
-
}[];
|
|
124
|
-
}
|
|
125
|
-
/** 场景状态 */
|
|
126
|
-
export interface SuperTableSceneState {
|
|
127
|
-
/** 查询场景列表 */
|
|
128
|
-
list: SuperTableQueryScene[];
|
|
129
|
-
/** 是否正在加载场景 */
|
|
130
|
-
loading: boolean;
|
|
131
|
-
/** 是否正在保存场景 */
|
|
132
|
-
submiting: boolean;
|
|
133
|
-
/** 是否已经加载过场景 */
|
|
134
|
-
loaded: boolean;
|
|
135
|
-
}
|
|
136
|
-
/** 提供给弹窗使用的表格全局状态 */
|
|
137
|
-
export interface SuperTableContext {
|
|
138
|
-
/** 场景类型 */
|
|
139
|
-
sceneType: string;
|
|
140
|
-
/** 场景状态 */
|
|
141
|
-
sceneState: Reactive<SuperTableSceneState>;
|
|
142
|
-
/** 查询场景 */
|
|
143
|
-
queryScene(): void;
|
|
144
|
-
/** 新增/更新场景 */
|
|
145
|
-
updateScene(scene: SuperTableQueryScene | SuperTableQueryScene[]): void;
|
|
146
|
-
/** 删除场景 */
|
|
147
|
-
deleteScene(sceneCode: string): void;
|
|
148
|
-
/** 当前生效中的查询参数 */
|
|
149
|
-
selectedFormItems: SuperTableQuerySceneItem[];
|
|
150
|
-
/** 禁用添加场景功能 */
|
|
151
|
-
allowCreateScene: Ref<boolean>;
|
|
152
|
-
}
|
|
153
|
-
/** 数据请求方法 */
|
|
154
|
-
export type PropTableRequestFunction = (options: {
|
|
155
|
-
/** 查询参数 */
|
|
156
|
-
params: Record<string, any>;
|
|
157
|
-
/** 分页大小 */
|
|
158
|
-
pageSize?: number;
|
|
159
|
-
/** 当前页码 */
|
|
160
|
-
pageNum?: number;
|
|
161
|
-
[key: string]: any;
|
|
162
|
-
}) => Promise<{
|
|
163
|
-
total: number;
|
|
164
|
-
data: Record<string, any>[];
|
|
165
|
-
}>;
|
|
166
|
-
export interface AntdTableProps extends TableProps {
|
|
167
|
-
pagination: PaginationProps;
|
|
168
|
-
columns: SuperTableColumn[];
|
|
169
|
-
dataSource: Record<string, any>[];
|
|
170
|
-
}
|
|
171
|
-
/** 表单操作方法接口 */
|
|
172
|
-
export interface FormOperations {
|
|
173
|
-
/**
|
|
174
|
-
* 获取表单项配置
|
|
175
|
-
* @param {string} name - 表单项名称
|
|
176
|
-
* @returns {SuperTableFormItem | undefined} 表单项配置
|
|
177
|
-
*/
|
|
178
|
-
getFormItem(name: string): SuperTableFormItem | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* 设置表单项配置
|
|
181
|
-
* @param {string} name - 表单项名称
|
|
182
|
-
* @param {string} keyPath - 配置路径
|
|
183
|
-
* @param {any} newConfig - 新的配置值
|
|
184
|
-
* @returns {void}
|
|
185
|
-
*/
|
|
186
|
-
setFormItem(name: string, keyPath: string, newConfig: any): void;
|
|
187
|
-
/**
|
|
188
|
-
* 获取表单值
|
|
189
|
-
* @param {string | string[]} [name] - 表单项名称或名称数组,不传则获取所有值
|
|
190
|
-
* @returns {Record<string, any>} 表单值对象
|
|
191
|
-
*/
|
|
192
|
-
getFormValues(name?: string | string[]): Record<string, any>;
|
|
193
|
-
/**
|
|
194
|
-
* 设置表单值
|
|
195
|
-
* @param {Record<string, any>} values - 要设置的表单值对象
|
|
196
|
-
* @returns {void}
|
|
197
|
-
*/
|
|
198
|
-
setFormValues(values: Record<string, any>): void;
|
|
199
|
-
/**
|
|
200
|
-
* 获取单个表单项值
|
|
201
|
-
* @param {string} name - 表单项名称
|
|
202
|
-
* @returns {any} 表单项值
|
|
203
|
-
*/
|
|
204
|
-
getFormValue(name: string): any;
|
|
205
|
-
/**
|
|
206
|
-
* 设置单个表单项值
|
|
207
|
-
* @param {string} name - 表单项名称
|
|
208
|
-
* @param {any} value - 要设置的值
|
|
209
|
-
* @returns {void}
|
|
210
|
-
*/
|
|
211
|
-
setFormValue(name: string, value: any): void;
|
|
212
|
-
}
|
|
213
|
-
/** 表格操作方法接口 */
|
|
214
|
-
export interface TableOperations {
|
|
215
|
-
/**
|
|
216
|
-
* 获取表格数据
|
|
217
|
-
* @returns {any[]} 表格数据数组
|
|
218
|
-
*/
|
|
219
|
-
getTableData(): any[];
|
|
220
|
-
/**
|
|
221
|
-
* 设置表格数据
|
|
222
|
-
* @param {any[]} data - 要设置的表格数据
|
|
223
|
-
* @returns {void}
|
|
224
|
-
*/
|
|
225
|
-
setTableData(data: any[]): void;
|
|
226
|
-
/**
|
|
227
|
-
* 设置表格数据项
|
|
228
|
-
* @param {number} index - 数据项索引
|
|
229
|
-
* @param {Record<string, any>} data - 要设置的数据项
|
|
230
|
-
* @returns {void}
|
|
231
|
-
*/
|
|
232
|
-
setTableDataItem(index: number, data: Record<string, any>): void;
|
|
233
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|