@wyfex/ivue 0.9.0 → 0.11.0
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/dist/index.es.js +11 -6
- package/dist/index.umd.cjs +11 -6
- package/dist/ivue.css +1 -1
- package/dist/types/UseElButton/types.d.ts +1 -1
- package/dist/types/UseElConfigProvider/index.vue.d.ts +0 -20
- package/dist/types/UseElConfigProvider/props.d.ts +0 -9
- package/dist/types/UseElDatePicker/index.vue.d.ts +2 -2
- package/dist/types/UseElDatePicker/props.d.ts +1 -1
- package/dist/types/UseElDescriptions/hook.d.ts +2 -1
- package/dist/types/UseElDescriptions/index.vue.d.ts +1 -1
- package/dist/types/UseElDialog/hook.d.ts +4 -314
- package/dist/types/UseElDialog/index.vue.d.ts +14 -20
- package/dist/types/UseElDialog/props.d.ts +5 -9
- package/dist/types/UseElDrawer/hook.d.ts +4 -352
- package/dist/types/UseElDrawer/index.vue.d.ts +2 -2
- package/dist/types/UseElSelect/hook.d.ts +5 -4
- package/dist/types/UseElSelect/index.vue.d.ts +2 -2
- package/dist/types/UseElSelect/props.d.ts +1 -1
- package/dist/types/UseElTable/components/EditableCell.vue.d.ts +4 -0
- package/dist/types/UseElTable/components/RecTableColumn.vue.d.ts +86 -0
- package/dist/types/UseElTable/components/Selection.vue.d.ts +12 -0
- package/dist/types/UseElTable/components/Span.vue.d.ts +4 -0
- package/dist/types/UseElTable/defaultExtConfig.d.ts +35 -0
- package/dist/types/UseElTable/hooks/useElTable.d.ts +18 -0
- package/dist/types/UseElTable/hooks/usePagination.d.ts +9 -0
- package/dist/types/UseElTable/hooks/useSelection.d.ts +15 -0
- package/dist/types/UseElTable/index.vue.d.ts +122 -0
- package/dist/types/UseElTable/props.d.ts +50 -0
- package/dist/types/UseElTable/types.d.ts +96 -0
- package/dist/types/UseElTable/utils.d.ts +9 -0
- package/dist/types/UseRender/index.vue.d.ts +1 -1
- package/dist/types/UseSvgIcon/index.vue.d.ts +54 -0
- package/dist/types/UseSvgIcon/props.d.ts +27 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +3 -3
- package/src/components/UseElButton/types.ts +1 -1
- package/src/components/UseElConfigProvider/props.ts +0 -15
- package/src/components/UseElDialog/props.ts +9 -11
- package/src/components/UseElTable/defaultExtConfig.ts +64 -0
- package/src/components/UseElTable/props.ts +83 -0
- package/src/components/UseElTable/types.ts +144 -0
- package/src/components/UseSvgIcon/props.ts +59 -0
- package/src/types/index.ts +9 -14
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Component, ExtractPropTypes } from 'vue'
|
|
2
|
+
import type { EditAttrs, GlobalConfig, UseDict } from '@/types'
|
|
3
|
+
import componentProps from './props'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* props类型
|
|
7
|
+
*/
|
|
8
|
+
export type Props = ExtractPropTypes<typeof componentProps>
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* emits接口
|
|
12
|
+
*/
|
|
13
|
+
export interface Emits {
|
|
14
|
+
// dictKeys事件
|
|
15
|
+
(e: 'onDictKeys', value?: string[]): void
|
|
16
|
+
// 选中数据更新事件(支持 v-model:selectionData)
|
|
17
|
+
(e: 'update:selectionData', selectionData: any[] | any): void
|
|
18
|
+
// 当前行更新事件(支持 v-model:currentRow)
|
|
19
|
+
(e: 'update:currentRow', currentRow: any): void
|
|
20
|
+
// 当前页码更新事件(支持 v-model:currentPage)
|
|
21
|
+
(e: 'update:currentPage', currentPage: number): void
|
|
22
|
+
// 每页条数更新事件(支持 v-model:pageSize)
|
|
23
|
+
(e: 'update:pageSize', pageSize: number): void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* EditableCell和SpanVue组件的props接口
|
|
28
|
+
*/
|
|
29
|
+
export interface EditableCellAndSpanVueProps {
|
|
30
|
+
row: Record<string, any>
|
|
31
|
+
item: TableColumn
|
|
32
|
+
mergedProps: Props
|
|
33
|
+
globalConfig: GlobalConfig
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 表头配置接口
|
|
38
|
+
*/
|
|
39
|
+
export interface Header {
|
|
40
|
+
// 表头具名插槽 为true则在模板代码中添加`<template #prop-header="{ item }"></template>`即可,可传入string自定义具名插槽名称
|
|
41
|
+
slot?: boolean | string
|
|
42
|
+
// 表头是否必填,必填表头默认在表头名称前添加*号
|
|
43
|
+
required?: boolean
|
|
44
|
+
// 必填表头*号位置,默认为before
|
|
45
|
+
asteriskPosition?: 'before' | 'after'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 编辑配置接口
|
|
50
|
+
*/
|
|
51
|
+
export interface Edit {
|
|
52
|
+
component: Component
|
|
53
|
+
attrs?: EditAttrs
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* tableColumn的extConfig接口
|
|
58
|
+
*/
|
|
59
|
+
export interface TableColumnExtConfig {
|
|
60
|
+
// 表头配置
|
|
61
|
+
header?: Header
|
|
62
|
+
// 编辑配置
|
|
63
|
+
edit?: Edit
|
|
64
|
+
// 过滤器
|
|
65
|
+
formatter?: Function
|
|
66
|
+
// 类名
|
|
67
|
+
class?: string | string[]
|
|
68
|
+
// 样式
|
|
69
|
+
style?: string | Record<string, unknown>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* tableColumn接口
|
|
74
|
+
*/
|
|
75
|
+
export interface TableColumn {
|
|
76
|
+
label?: string
|
|
77
|
+
prop?: string //多级表头的父级表头可不传
|
|
78
|
+
/**
|
|
79
|
+
* 使用字典
|
|
80
|
+
* 如为boolean则将label作为dictMap的key
|
|
81
|
+
* 如为string或dict.data为string则将dict或dict.data作为dictMap的key
|
|
82
|
+
*/
|
|
83
|
+
useDict?: boolean | string | UseDict
|
|
84
|
+
/**
|
|
85
|
+
* 插槽
|
|
86
|
+
* 为true则在模板代码中添加`<template #prop="{ row }"></template>`即可,可传入string自定义具名插槽名称
|
|
87
|
+
*/
|
|
88
|
+
slot?: boolean | string
|
|
89
|
+
width?: string | number
|
|
90
|
+
minWidth?: string | number
|
|
91
|
+
show?: boolean
|
|
92
|
+
align?: string
|
|
93
|
+
fixed?: boolean | string
|
|
94
|
+
sortable?: boolean
|
|
95
|
+
showOverflowTooltip?: boolean
|
|
96
|
+
extConfig?: TableColumnExtConfig
|
|
97
|
+
children?: TableColumn[]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 选择器配置项
|
|
102
|
+
*/
|
|
103
|
+
export interface Selection {
|
|
104
|
+
label?: string
|
|
105
|
+
type?: string
|
|
106
|
+
width?: number
|
|
107
|
+
key?: string
|
|
108
|
+
enableRowClick?: boolean
|
|
109
|
+
selectable?: Function
|
|
110
|
+
disabledConfig?:
|
|
111
|
+
| Record<string, string | number | string[] | number[]>
|
|
112
|
+
| Array<{ key: string; value: string | number | string[] | number[] }>
|
|
113
|
+
align?: string
|
|
114
|
+
fixed?: boolean
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* UseElTable的extConfig接口
|
|
119
|
+
*/
|
|
120
|
+
export interface ExtConfig {
|
|
121
|
+
// 额外表头配置项
|
|
122
|
+
extraHeader?: {
|
|
123
|
+
class?: string
|
|
124
|
+
style?: { padding?: string; borderBottom?: string }
|
|
125
|
+
}
|
|
126
|
+
// 选择器配置项
|
|
127
|
+
selection?: Selection
|
|
128
|
+
// 序号列配置项
|
|
129
|
+
index?: { label?: string; width?: number; align?: string; fixed?: boolean }
|
|
130
|
+
// 展开列配置项
|
|
131
|
+
expand?: { show?: boolean; width?: number }
|
|
132
|
+
// 操作列配置项
|
|
133
|
+
operation?: { label?: string; width?: number; fixed?: string }
|
|
134
|
+
// 分页器配置项
|
|
135
|
+
pagination?: {
|
|
136
|
+
total?: number
|
|
137
|
+
marginTop?: number
|
|
138
|
+
position?: string
|
|
139
|
+
pageSizes?: number[]
|
|
140
|
+
background?: boolean
|
|
141
|
+
layout?: string
|
|
142
|
+
func?: Function
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
import { isArray } from '@wyfex/iutils'
|
|
3
|
+
import { parseUnit, isValidUnit } from '@/utils'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 组件props
|
|
7
|
+
*/
|
|
8
|
+
export default {
|
|
9
|
+
/**
|
|
10
|
+
* 图标名称 必传
|
|
11
|
+
*/
|
|
12
|
+
name: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* 图标大小 默认类型为数字(单位为px);可传带单位的字符串,如:20px、0.2rem
|
|
18
|
+
*/
|
|
19
|
+
size: {
|
|
20
|
+
type: [Number, String],
|
|
21
|
+
default: 28,
|
|
22
|
+
validator(val: any) {
|
|
23
|
+
if (typeof val === 'number') return val
|
|
24
|
+
return isValidUnit(parseUnit(val)) && val
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* 图标颜色 可传String或Array
|
|
29
|
+
* 若传Array,只能传两项 第一项为默认图标颜色 第二项为暗黑模式下图标颜色
|
|
30
|
+
*/
|
|
31
|
+
color: {
|
|
32
|
+
type: [String, Array] as PropType<string | Record<string, any>[]>,
|
|
33
|
+
validator(val: any) {
|
|
34
|
+
if (!isArray(val)) return val
|
|
35
|
+
if (!val.length) throw new Error(`color类型为Array时length不能为0`)
|
|
36
|
+
if (val.length > 2) throw new Error(`color类型为Array时length最大为2`)
|
|
37
|
+
return val
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* 图标的margin外边距 同css的margin规则
|
|
42
|
+
*/
|
|
43
|
+
margin: {
|
|
44
|
+
type: String
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* 是否可点击
|
|
48
|
+
*/
|
|
49
|
+
clickable: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* hover类名
|
|
55
|
+
*/
|
|
56
|
+
hoverClass: {
|
|
57
|
+
type: String
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -48,20 +48,19 @@ export interface DictProps {
|
|
|
48
48
|
*/
|
|
49
49
|
export interface DictMap {
|
|
50
50
|
// 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
|
|
51
|
-
[key: string]:
|
|
51
|
+
[key: string]: Record<DictProps['label'] | DictProps['value'], unknown>[]
|
|
52
52
|
}
|
|
53
|
+
// export interface DictMap {
|
|
54
|
+
// // 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
|
|
55
|
+
// [key: string]: Array<{ label: string; value: string | number | boolean }>
|
|
56
|
+
// }
|
|
53
57
|
|
|
54
58
|
/**
|
|
55
59
|
* 使用字典接口
|
|
56
60
|
*/
|
|
57
61
|
export interface UseDict {
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
| string
|
|
61
|
-
| Record<string, any>
|
|
62
|
-
| string[]
|
|
63
|
-
| number[]
|
|
64
|
-
| Record<string, any>[]
|
|
62
|
+
// 字典key 即dictMap的key,如为boolean则以label作为dictMap的key
|
|
63
|
+
key?: string | boolean
|
|
65
64
|
// 字典属性
|
|
66
65
|
props?: DictProps
|
|
67
66
|
// 字典类名
|
|
@@ -95,14 +94,10 @@ export interface UploadConfig {
|
|
|
95
94
|
export interface GlobalConfig {
|
|
96
95
|
// 最终语言
|
|
97
96
|
finalLanguage: string
|
|
98
|
-
// 最终主题模式
|
|
99
|
-
finalThemeMode: string
|
|
100
97
|
// 最终字典属性
|
|
101
98
|
finalDictProps: DictProps
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
// 最终表格额外高度
|
|
105
|
-
finalTableExtraHeight: number
|
|
99
|
+
// 最终字典映射
|
|
100
|
+
finalDictMap: DictMap
|
|
106
101
|
// 最终上传配置
|
|
107
102
|
finalUploadConfig: UploadConfig
|
|
108
103
|
}
|