@wyfex/ivue 0.19.4 → 0.20.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.
Files changed (43) hide show
  1. package/README.md +7 -1
  2. package/dist/index.es.js +9 -9
  3. package/dist/index.umd.cjs +6 -6
  4. package/dist/ivue.css +1 -1
  5. package/dist/types/UseCrud/defaultExtConfig.d.ts +4 -0
  6. package/dist/types/UseCrud/hook.d.ts +2 -22
  7. package/dist/types/UseCrud/index.vue.d.ts +11 -2
  8. package/dist/types/UseCrud/types.d.ts +48 -3
  9. package/dist/types/UseCrud/utils.d.ts +48 -2
  10. package/dist/types/UseElCheckbox/index.vue.d.ts +1 -1
  11. package/dist/types/UseElDatePicker/index.vue.d.ts +4 -4
  12. package/dist/types/UseElDatePicker/types.d.ts +2 -2
  13. package/dist/types/UseElDialog/hook.d.ts +1 -0
  14. package/dist/types/UseElDialog/index.vue.d.ts +19 -1
  15. package/dist/types/UseElDialog/props.d.ts +8 -0
  16. package/dist/types/UseElDrawer/index.vue.d.ts +10 -1
  17. package/dist/types/UseElDrawer/props.d.ts +4 -0
  18. package/dist/types/UseElForm/types.d.ts +1 -2
  19. package/dist/types/UseElInput/index.vue.d.ts +4 -4
  20. package/dist/types/UseElSelect/index.vue.d.ts +4 -4
  21. package/dist/types/UseElTable/defaultExtConfig.d.ts +1 -1
  22. package/dist/types/UseElTable/types.d.ts +9 -10
  23. package/dist/types/UseElTimeSelect/index.vue.d.ts +28 -0
  24. package/dist/types/UseElTimeSelect/props.d.ts +13 -0
  25. package/dist/types/UseElTimeSelect/types.d.ts +6 -0
  26. package/dist/types/UseRender/index.vue.d.ts +1 -1
  27. package/dist/types/index.d.ts +1 -1
  28. package/package.json +7 -7
  29. package/src/components/UseCrud/defaultExtConfig.ts +1 -0
  30. package/src/components/UseCrud/props.ts +1 -1
  31. package/src/components/UseCrud/types.ts +99 -23
  32. package/src/components/UseElButton/types.ts +12 -37
  33. package/src/components/UseElCheckbox/types.ts +1 -1
  34. package/src/components/UseElConfigProvider/types.ts +10 -18
  35. package/src/components/UseElDatePicker/types.ts +3 -3
  36. package/src/components/UseElDialog/props.ts +16 -2
  37. package/src/components/UseElDrawer/props.ts +7 -0
  38. package/src/components/UseElForm/types.ts +3 -10
  39. package/src/components/UseElTable/types.ts +92 -183
  40. package/src/components/UseElTimeSelect/props.ts +22 -0
  41. package/src/components/UseElTimeSelect/types.ts +15 -0
  42. package/dist/types/UseCrud/useCrudWithBusiness.d.ts +0 -46
  43. /package/dist/types/UseElForm/components/controls/{TimeSelect.vue.d.ts → TimeSelectRange.vue.d.ts} +0 -0
@@ -1,4 +1,10 @@
1
- import type { Component, ExtractPropTypes } from 'vue'
1
+ import type {
2
+ Component,
3
+ ComputedRef,
4
+ ExtractPropTypes,
5
+ Ref,
6
+ ShallowRef
7
+ } from 'vue'
2
8
  import componentProps from './props'
3
9
  import type { FormColumn } from '../UseElForm/types'
4
10
  import type {
@@ -15,51 +21,54 @@ export type Props = ExtractPropTypes<typeof componentProps>
15
21
  * emits类型
16
22
  */
17
23
  export type Emits = {
18
- /**
19
- * dictKeys事件
20
- */
24
+ /** dictKeys事件 */
21
25
  (e: 'onDictKeys', value?: string[]): void
22
26
  }
23
27
 
24
28
  /**
25
29
  * 基础配置类型
26
30
  */
27
- export type BaseConfigs = Omit<FormColumn, 'prop'> & Omit<TableColumn, 'prop'>
31
+ export type BaseConfigs = FormColumn & TableColumn
28
32
 
29
33
  /**
30
34
  * 配置项接口
31
35
  */
32
36
  export interface Configs extends BaseConfigs {
33
- prop: string
37
+ /** 查询表单项标签 当查询表单项标签和表格项标签不一致使使用 */
38
+ queryLabel?: string
39
+ /** 查询表单项属性 当查询表单项属性和表格项属性不一致使使用,可传以逗号分隔的字符串,组件内部自动拆解*/
40
+ queryProp?: string
41
+ /** 是否仅搜索 */
34
42
  onlySearch?: boolean
43
+ /** 表格排序 */
35
44
  tableOrder?: number
36
45
  }
37
46
 
38
47
  /**
39
48
  * 分割线配置接口
40
- * show:是否显示分割线
41
- * borderStyle:分割线边框样式
42
49
  */
43
50
  export interface Divider {
51
+ /** 是否显示分割线 */
44
52
  show?: boolean
53
+ /** 分割线边框样式 */
45
54
  borderStyle?: 'none' | 'solid' | 'hidden' | 'dashed'
46
55
  }
47
56
 
48
57
  /**
49
58
  * 操作栏配置接口
50
- * margin:操作栏外边距
51
- * showControlFormDisplayBtn:是否显示【收起/展开查询】按钮
52
- * controlFormDisplayBtnWithOpenedIcon:【收起/展开查询】按钮展开时图标
53
- * controlFormDisplayBtnWithClosedIcon:【收起/展开查询】按钮收起时图标
54
- * reverse:是否反转操作栏按钮 仅showControlFormDisplayBtn为true时生效
55
- * divider:操作栏底部分割线
56
59
  */
57
60
  export interface ActionBar {
61
+ /** 操作栏外边距 */
58
62
  margin?: string
63
+ /** 是否显示【收起/展开查询】按钮 */
59
64
  showControlFormDisplayBtn?: boolean
65
+ /** 【收起/展开查询】按钮展开时图标 */
60
66
  controlFormDisplayBtnWithOpenedIcon?: Component
67
+ /** 【收起/展开查询】按钮收起时图标 */
61
68
  controlFormDisplayBtnWithClosedIcon?: Component
69
+ /** 是否反转操作栏按钮 仅showControlFormDisplayBtn为true时生效 */
62
70
  reverse?: boolean
71
+ /** 操作栏底部分割线 */
63
72
  divider?: Divider
64
73
  }
65
74
 
@@ -67,19 +76,86 @@ export interface ActionBar {
67
76
  * extConfig接口
68
77
  */
69
78
  export interface ExtConfig {
70
- /**
71
- * 操作栏配置项
72
- */
79
+ /** 增删改查请求配置项 */
80
+ crudFetch?: {
81
+ /** 查询api */
82
+ queryApi?: Function
83
+ /** 是否立即查询 */
84
+ queryImmediate?: boolean
85
+ /** 自动取消查询策略 配合signal实现接口取消请求 */
86
+ autoCancelQueryStrategy?: 'none' | 'unmount' | 'deactivate' | 'both'
87
+ /** 开始查询前钩子 用于注入字典数据等 */
88
+ onQueryBefore?: (done: () => void) => void
89
+ /** 查询错误钩子 */
90
+ onQueryError?: (err: any) => void
91
+ /** 删除api */
92
+ deleteApi?: Function
93
+ }
94
+ /** 操作栏配置项 */
73
95
  actionBar?: ActionBar
74
- /**
75
- * 弹窗配置项
76
- * type:弹窗类型 支持Drawer和Dialog
77
- * 其他配置项由于组件内部已进行v-bind透传,不不在此重复声明接口,详见UseElDrawer和UseElDialog组件types
78
- */
79
- modal?: { type?: 'Drawer' | 'Dialog' }
96
+ /** 弹窗配置项 */
97
+ modal?: {
98
+ /** 弹窗类型 支持Drawer和Dialog */
99
+ type?: 'Drawer' | 'Dialog'
100
+ /** 其他配置项由于组件内部已进行v-bind透传,故不在此重复声明接口,详见UseElDrawer和UseElDialog组件types */
101
+ }
80
102
  }
81
103
 
82
104
  /**
83
105
  * 合并后的extConfig类型 本组件ExtConfig和UseElTable组件ExtConfig合并
84
106
  */
85
107
  export type MergedExtConfig = ExtConfig & TableExtConfig
108
+
109
+ /**
110
+ * Crud状态类型
111
+ */
112
+ export interface UseCrudState {
113
+ /** 表单列配置 */
114
+ formColumns: FormColumn[]
115
+ /** 表格列配置 */
116
+ tableColumns: TableColumn[]
117
+ /** 表单模型 查询表单的原始数据模型 */
118
+ formModel: Record<string, any>
119
+ /** 表单参数 查询表单提交接口的数据参数 */
120
+ formParams: Record<string, any>
121
+ /** 表格loading */
122
+ tableLoading: boolean
123
+ /** 表格数据 */
124
+ tableData: any[]
125
+ /** 当前页码 */
126
+ currentPage: number
127
+ /** 分页大小 */
128
+ pageSize: number
129
+ /** 分页总数 */
130
+ total: number
131
+ /** 字典映射 */
132
+ dictMap: Record<string, any>
133
+ }
134
+
135
+ /**
136
+ * Crud返回类型
137
+ */
138
+ export interface UseCrudReturn {
139
+ state: Ref<UseCrudState>
140
+ heightComputed: ComputedRef<string>
141
+ fetchTableData: (
142
+ options?: { params?: Record<string, any>; isPageApi?: boolean },
143
+ cb?: () => void
144
+ ) => Promise<any>
145
+ onQuery: (e: Record<string, unknown>, done?: () => void) => void
146
+ onCancelQueryRequest: () => void
147
+ handleDelete: (
148
+ payload: { id?: string | number; ids?: string | Array<string | number> },
149
+ loadingConfig: { source?: Record<string, unknown>; key?: string },
150
+ successCb?: () => void,
151
+ errorCb?: (err: unknown) => void,
152
+ successMsg?: string
153
+ ) => Promise<void>
154
+ margin: ComputedRef<string | undefined>
155
+ actionBar: any
156
+ handleDisplayQueryForm: () => void
157
+ showModal: Ref<boolean>
158
+ modalComponent: ShallowRef<Component | null>
159
+ handleShowModal: () => Promise<void>
160
+ handleCloseModal: ComputedRef<() => void>
161
+ }
@@ -10,9 +10,7 @@ export type Props = ExtractPropTypes<typeof componentProps>
10
10
  * emits类型
11
11
  */
12
12
  export type Emits = {
13
- /**
14
- * 点击事件 默认自带防抖
15
- */
13
+ /** 点击事件 默认自带防抖 */
16
14
  (e: 'click', value?: string | number | Record<string, unknown>): void
17
15
  }
18
16
 
@@ -20,31 +18,18 @@ export type Emits = {
20
18
  * extConfig接口
21
19
  */
22
20
  export interface ExtConfig {
23
- /**
24
- * 防抖配置项 无需防抖将delay设置为0即可
25
- */
21
+ /** 防抖配置项 无需防抖将delay设置为0即可 */
26
22
  debounce?: {
27
- /**
28
- * 防抖时间
29
- */
23
+ /** 防抖时间 */
30
24
  delay?: number
31
- /**
32
- * 是否立即开启防抖
33
- */
25
+ /** 是否立即开启防抖 */
34
26
  immediate?: boolean
35
27
  }
36
- /**
37
- * 二次确认配置项
38
- */
28
+ /** 二次确认配置项 */
39
29
  confirm?: {
40
- /**
41
- * 二次确认数据 显式设置则开启二次确认
42
- * 可为String、Number、Object、Array,无需传递数据则显式设置为null
43
- */
30
+ /** 二次确认数据 显式设置则开启二次确认,可为String、Number、Object、Array,无需传递数据则显式设置为null */
44
31
  data?: string | number | Record<string, unknown> | unknown[] | null
45
- /**
46
- * 二次确认类型 同ElButton类型
47
- */
32
+ /** 二次确认类型 同ElButton类型 */
48
33
  type?:
49
34
  | 'default'
50
35
  | 'primary'
@@ -53,25 +38,15 @@ export interface ExtConfig {
53
38
  | 'danger'
54
39
  | 'info'
55
40
  | ''
56
- /**
57
- * 二次确认数据主键key 对象或对象数组需要
58
- */
41
+ /** 二次确认数据主键key 对象或对象数组需要 */
59
42
  dataKey?: string
60
- /**
61
- * 是否将数组转换为以逗号分隔的字符串 如:[1,2] => '1,2'
62
- */
43
+ /** 是否将数组转换为以逗号分隔的字符串 如:[1,2] => '1,2' */
63
44
  toJoin?: boolean
64
- /**
65
- * 是否追加s到dataKey后面 如:id => ids
66
- */
45
+ /** 是否追加s到dataKey后面 如:id => ids */
67
46
  appendS?: boolean
68
- /**
69
- * 二次确认弹框标题
70
- */
47
+ /** 二次确认弹框标题 */
71
48
  title?: string
72
- /**
73
- * 二次确认弹框内容
74
- */
49
+ /** 二次确认弹框内容 */
75
50
  content?: string
76
51
  }
77
52
  }
@@ -10,6 +10,6 @@ export type Props = ExtractPropTypes<typeof componentProps>
10
10
  * emits类型
11
11
  */
12
12
  export type Emits = {
13
- // 更新value值
13
+ /** 更新value值 */
14
14
  (e: 'update:modelValue', value: string | number | (string | number)[]): void
15
15
  }
@@ -11,34 +11,26 @@ export type Props = ExtractPropTypes<typeof componentProps>
11
11
  * extConfig接口
12
12
  */
13
13
  export interface ExtConfig {
14
- /**
15
- * 字典属性配置项
16
- */
14
+ /** 字典属性配置项 */
17
15
  dictProps?: DictProps
18
- /**
19
- * crud配置项
20
- * pageHeight:crud表格页面高度 extConfig.mode.type='PAGE'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度
21
- * modalHeight:crud表格弹窗高度 extConfig.mode.type='MODAL'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度
22
- */
16
+ /** crud配置项 */
23
17
  crud?: {
18
+ /** crud表格页面高度 extConfig.mode.type='PAGE'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度 */
24
19
  pageHeight?: string
20
+ /** crud表格弹窗高度 extConfig.mode.type='MODAL'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度 */
25
21
  modalHeight?: string
26
22
  }
27
- /**
28
- * 表格配置项
29
- * pageHeight:表格页面高度 extConfig.mode.type='PAGE'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度
30
- * modalHeight:表格弹窗高度 extConfig.mode.type='MODAL'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度
31
- * pageBottomOffset:表格页面底部预留偏移
32
- * modalBottomOffset:表格弹窗底部预留偏移
33
- */
23
+ /** 表格配置项 */
34
24
  table?: {
25
+ /** 表格页面高度 extConfig.mode.type='PAGE'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度 */
35
26
  pageHeight?: string
27
+ /** 表格弹窗高度 extConfig.mode.type='MODAL'时生效,显式设置则表格自适应高度不生效,否则默认使用表格自适应高度 */
36
28
  modalHeight?: string
29
+ /** 表格页面底部预留偏移 */
37
30
  pageBottomOffset?: number
31
+ /** 表格弹窗底部预留偏移 */
38
32
  modalBottomOffset?: number
39
33
  }
40
- /**
41
- * 上传配置项
42
- */
34
+ /** 上传配置项 */
43
35
  upload?: UploadConfig
44
36
  }
@@ -7,9 +7,9 @@ import componentProps from './props'
7
7
  export type Props = ExtractPropTypes<typeof componentProps>
8
8
 
9
9
  /**
10
- * emits接口
10
+ * emits类型
11
11
  */
12
- export interface Emits {
13
- // 更新value值
12
+ export type Emits = {
13
+ /** 更新value值 */
14
14
  (e: 'update:modelValue', value: string | number | any[]): void
15
15
  }
@@ -17,11 +17,18 @@ export default {
17
17
  default: true
18
18
  },
19
19
  /**
20
- * el-dialog内容区域最大高度
20
+ * el-dialog CSS 中的 margin-top 值 默认12dvh
21
+ */
22
+ top: {
23
+ type: String,
24
+ default: '12dvh'
25
+ },
26
+ /**
27
+ * el-dialog内容区域最大高度 默认为autoMax,内部自动根据浏览器高度进行计算最大高度
21
28
  */
22
29
  maxHeight: {
23
30
  type: [String, Number],
24
- default: ''
31
+ default: 'autoCalcMaxHeight'
25
32
  },
26
33
  /**
27
34
  * el-scrollbar不响应容器尺寸变化,如果容器尺寸不会发生变化,最好设置它可以优化性能
@@ -108,6 +115,13 @@ export default {
108
115
  type: String,
109
116
  default: '取消'
110
117
  },
118
+ /**
119
+ * 确定按钮loading状态
120
+ */
121
+ confirmLoading: {
122
+ type: Boolean,
123
+ default: false
124
+ },
111
125
  /**
112
126
  * 取消按钮类型
113
127
  */
@@ -87,6 +87,13 @@ export default {
87
87
  type: String,
88
88
  default: '取消'
89
89
  },
90
+ /**
91
+ * 确定按钮loading状态
92
+ */
93
+ confirmLoading: {
94
+ type: Boolean,
95
+ default: false
96
+ },
90
97
  /**
91
98
  * 取消按钮类型 同ElButton类型
92
99
  */
@@ -11,9 +11,7 @@ export type Props = ExtractPropTypes<typeof componentProps>
11
11
  * emits类型
12
12
  */
13
13
  export type Emits = {
14
- /**
15
- * dictKeys事件
16
- */
14
+ /** dictKeys事件 */
17
15
  (e: 'onDictKeys', value?: string[]): void
18
16
  }
19
17
 
@@ -369,15 +367,10 @@ export interface FormColumn {
369
367
  label?: string
370
368
  /**
371
369
  * el-form-item的prop
370
+ * 一般情况下为必传 为适配UseCrud组件类型特将此属性设置为非必传
372
371
  * 可传以逗号分隔的字符串,组件内部自动拆解,如'startDate,endDate' => { startDate: xxx, endDate: yyy }
373
372
  */
374
- prop: string
375
- /**
376
- * 查询prop
377
- * 当查询表单(如起止时间字段拆分)和列表prop字段不一致时传入该配置项
378
- * 可传以逗号分隔的字符串,组件内部自动拆解,亦可传入字符串数组
379
- */
380
- queryProp?: string | string[]
373
+ prop?: string
381
374
  /**
382
375
  * 是否为必填项
383
376
  * 如为boolean则使用基础必填校验