@wyfex/ivue 0.19.0 → 0.19.1

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.
@@ -8,18 +8,28 @@ import componentProps from './props'
8
8
  export type Props = ExtractPropTypes<typeof componentProps>
9
9
 
10
10
  /**
11
- * emits接口
11
+ * emits类型
12
12
  */
13
- export interface Emits {
14
- // dictKeys事件
13
+ export type Emits = {
14
+ /**
15
+ * dictKeys事件
16
+ */
15
17
  (e: 'onDictKeys', value?: string[]): void
16
- // 选中数据更新事件(支持 v-model:selectionData)
17
- (e: 'update:selectionData', selectionData: any): void
18
- // 当前行更新事件(支持 v-model:currentRow)
18
+ /**
19
+ * 选中数据更新事件 v-model:selectionData
20
+ */
21
+ (e: 'update:selectionData', selectionData: any[]): void
22
+ /**
23
+ * 当前行更新事件 v-model:currentRow
24
+ */
19
25
  (e: 'update:currentRow', currentRow: any): void
20
- // 当前页码更新事件(支持 v-model:currentPage)
26
+ /**
27
+ * 当前页码更新事件 v-model:currentPage
28
+ */
21
29
  (e: 'update:currentPage', currentPage: number): void
22
- // 每页条数更新事件(支持 v-model:pageSize)
30
+ /**
31
+ * 每页条数更新事件 v-model:pageSize
32
+ */
23
33
  (e: 'update:pageSize', pageSize: number): void
24
34
  }
25
35
 
@@ -27,9 +37,21 @@ export interface Emits {
27
37
  * EditableCell和SpanVue组件的props接口
28
38
  */
29
39
  export interface EditableCellAndSpanVueProps {
40
+ /**
41
+ * 行数据
42
+ */
30
43
  row: Record<string, any>
44
+ /**
45
+ * 表格配置项
46
+ */
31
47
  item: TableColumn
48
+ /**
49
+ * 合并后的props
50
+ */
32
51
  mergedProps: Props
52
+ /**
53
+ * 全局配置
54
+ */
33
55
  globalConfig: GlobalConfig
34
56
  }
35
57
 
@@ -37,11 +59,17 @@ export interface EditableCellAndSpanVueProps {
37
59
  * 表头配置接口
38
60
  */
39
61
  export interface Header {
40
- // 表头具名插槽 为true则在模板代码中添加`<template #prop-header="{ item }"></template>`即可,可传入string自定义具名插槽名称
62
+ /**
63
+ * 表头具名插槽 为true则在模板代码中添加`<template #prop-header="{ item }"></template>`即可,可传入string自定义具名插槽名称
64
+ */
41
65
  slot?: boolean | string
42
- // 表头是否必填,必填表头默认在表头名称前添加*号
66
+ /**
67
+ * 表头是否必填 必填表头默认在表头名称前添加*号
68
+ */
43
69
  required?: boolean
44
- // 必填表头*号位置,默认为before
70
+ /**
71
+ * 必填表头*号位置 默认为before
72
+ */
45
73
  asteriskPosition?: 'before' | 'after'
46
74
  }
47
75
 
@@ -49,7 +77,13 @@ export interface Header {
49
77
  * 编辑配置接口
50
78
  */
51
79
  export interface Edit {
80
+ /**
81
+ * 组件
82
+ */
52
83
  component: Component
84
+ /**
85
+ * 属性
86
+ */
53
87
  attrs?: EditAttrs
54
88
  }
55
89
 
@@ -57,17 +91,29 @@ export interface Edit {
57
91
  * tableColumn的extConfig接口
58
92
  */
59
93
  export interface TableColumnExtConfig {
60
- // 表头配置
94
+ /**
95
+ * 表头配置
96
+ */
61
97
  header?: Header
62
- // 编辑配置
98
+ /**
99
+ * 编辑配置
100
+ */
63
101
  edit?: Edit
64
- // 过滤器
102
+ /**
103
+ * 过滤器
104
+ */
65
105
  formatter?: Function
66
- // 类名
106
+ /**
107
+ * 类名
108
+ */
67
109
  class?: string | string[]
68
- // 样式
110
+ /**
111
+ * 样式
112
+ */
69
113
  style?: string | Record<string, unknown>
70
- // 插槽 为true则在模板代码中添加`<template #prop="{ row }"></template>`即可,可传入string自定义具名插槽名称
114
+ /**
115
+ * 插槽 为true则在模板代码中添加`<template #prop="{ row }"></template>`即可,可传入string自定义具名插槽名称
116
+ */
71
117
  slot?: boolean | string
72
118
  }
73
119
 
@@ -75,22 +121,55 @@ export interface TableColumnExtConfig {
75
121
  * tableColumn接口
76
122
  */
77
123
  export interface TableColumn {
124
+ /**
125
+ * 表格列的标签
126
+ */
78
127
  label?: string
79
- prop?: string //多级表头的父级表头可不传
128
+ /**
129
+ * 表格列的属性 多级表头的父级表头可不传
130
+ */
131
+ prop?: string
80
132
  /**
81
133
  * 使用字典
82
134
  * 如为boolean则将label作为dictMap的key
83
135
  * 如为string或dict.data为string则将dict或dict.data作为dictMap的key
84
136
  */
85
137
  useDict?: boolean | string | UseDict
138
+ /**
139
+ * 表格列的宽度
140
+ */
86
141
  width?: string | number
142
+ /**
143
+ * 表格列的最小宽度
144
+ */
87
145
  minWidth?: string | number
146
+ /**
147
+ * 是否显示表格列
148
+ */
88
149
  show?: boolean
150
+ /**
151
+ * 表格列的排列方式
152
+ */
89
153
  align?: string
154
+ /**
155
+ * 表格列是否固定
156
+ */
90
157
  fixed?: boolean | string
158
+ /**
159
+ * 表格列是否开启排序
160
+ */
91
161
  sortable?: boolean
162
+ /**
163
+ * 表格列溢出是否显示省略号
164
+ */
92
165
  showOverflowTooltip?: boolean
166
+ /**
167
+ * 表格列扩展配置
168
+ */
93
169
  extConfig?: TableColumnExtConfig
170
+ /**
171
+ * 表格列的子表格列
172
+ */
94
173
  children?: TableColumn[]
95
174
  }
96
175
 
@@ -98,16 +177,43 @@ export interface TableColumn {
98
177
  * 选择器配置项
99
178
  */
100
179
  export interface Selection {
180
+ /**
181
+ * 选择器的标签
182
+ */
101
183
  label?: string
102
- type?: string
184
+ /**
185
+ * 选择器的类型
186
+ */
187
+ type?: 'CHECKBOX' | 'CHECKBOXRADIO' | 'RADIO'
188
+ /**
189
+ * 选择器的宽度
190
+ */
103
191
  width?: number
192
+ /**
193
+ * 选择器的唯一键
194
+ */
104
195
  key?: string
196
+ /**
197
+ * 是否允许点击行触发选择器勾选
198
+ */
105
199
  enableRowClick?: boolean
200
+ /**
201
+ * 自定义选择器功能函数
202
+ */
106
203
  selectable?: Function
204
+ /**
205
+ * 选择器禁止勾选配置
206
+ */
107
207
  disabledConfig?:
108
208
  | Record<string, string | number | string[] | number[]>
109
209
  | Array<{ key: string; value: string | number | string[] | number[] }>
210
+ /**
211
+ * 选择器排列方式
212
+ */
110
213
  align?: string
214
+ /**
215
+ * 选择器是否固定
216
+ */
111
217
  fixed?: boolean
112
218
  }
113
219
 
@@ -115,26 +221,64 @@ export interface Selection {
115
221
  * UseElTable的extConfig接口
116
222
  */
117
223
  export interface ExtConfig {
118
- // 额外表头配置项
224
+ /**
225
+ * 额外表头配置项
226
+ * border:是否显示边框线 默认和el-table的border保持一致
227
+ * class:额外表头类名
228
+ * style:额外表头样式对象
229
+ */
119
230
  extraHeader?: {
231
+ border?: boolean
120
232
  class?: string
121
233
  style?: { padding?: string; borderBottom?: string }
122
234
  }
123
- // 高度配置项
124
- heightAdaptive?: {
125
- isModal?: boolean
126
- modalFooterHeight?: number
127
- bottomOffset?: number
128
- }
129
- // 选择器配置项
235
+ /**
236
+ * 模式配置项
237
+ * type:模式类型 可选值:PAGE(页面) | MODAL(弹窗)
238
+ * height:表格高度 不设置则默认高度自适应,该配置项设置的是UseELTable组件整体高度,非ElTable组件的高度
239
+ * bottomOffset:表格高度自适应表格底部预留偏移 该配置项由UseElConfigProvider组件统一提供默认值
240
+ */
241
+ mode?: { type?: 'PAGE' | 'MODAL'; height?: string; bottomOffset?: number }
242
+ /**
243
+ * 选择器配置项
244
+ * 绑定v-model:selectionData="selectionData"则开启选择器 不显式设置type则默认为CHECKBOX复选
245
+ * type:选择类型 可选值:CHECKBOX(复选) | CHECKBOXRADIO(复选框单选) | RADIO(单选)
246
+ * label:type为CHECKBOXRADIO、RADIO时表头全选复选框的文本 不设置则为空显示
247
+ * key:选中数据的唯一键 对应tableData中的唯一键 如id
248
+ * selectable:决定当前行复选框是否可以勾选 传入function,如果是简单禁用逻辑推荐优先使用disabledConfig配置项,复杂逻辑才建议使用本配置项
249
+ * disabledConfig:禁用配置 可传对象或对象数组
250
+ * enableRowClick:允许通过点击行触发单选/复选 默认否 PS:默认不高亮当前行,若需高亮当前行,只需给UseElTable组件设置highlightCurrentRow属性即可
251
+ * width:选择器的列宽 默认为40px
252
+ * align:选择器的排列方式 默认为center居中
253
+ * fixed:是否固定 默认为true
254
+ */
130
255
  selection?: Selection
131
- // 序号列配置项
256
+ /**
257
+ * 序号列配置项
258
+ * label:序号列表头文本 不显式设置则不显示序号列
259
+ * width、align、fixed同选择器配置项
260
+ */
132
261
  index?: { label?: string; width?: number; align?: string; fixed?: boolean }
133
- // 展开列配置项
262
+ /**
263
+ * 展开列配置项
264
+ * show:是否显示展开列
265
+ * width:展开列宽度
266
+ */
134
267
  expand?: { show?: boolean; width?: number }
135
- // 操作列配置项
268
+ /**
269
+ * 操作列配置项
270
+ * label:操作列文案 显式设置则开启操作列
271
+ * width:操作列宽度 默认为128px
272
+ * fixed:固定方向 默认固定在右侧
273
+ */
136
274
  operation?: { label?: string; width?: number; fixed?: string }
137
- // 分页器配置项
275
+ /**
276
+ * 分页器配置项
277
+ * total:分页总数 为-1时不显示分页器
278
+ * marginTop:分页器与表格的间距 默认20px
279
+ * func:分页方法 显式设置则在组件内部自动处理分页逻辑
280
+ * position:分页器位置 默认为right 可选值:left | center | right
281
+ */
138
282
  pagination?: {
139
283
  total?: number
140
284
  marginTop?: number
@@ -1,6 +1,6 @@
1
1
  import type { Component, VNode } from 'vue'
2
2
 
3
- // ==================================== 渲染器相关接口 start ====================================
3
+ // =========================== 渲染器相关接口 start ===========================
4
4
  /**
5
5
  * 渲染器内容类型
6
6
  */
@@ -17,29 +17,45 @@ export type RenderContent =
17
17
  * 渲染器配置接口
18
18
  */
19
19
  export interface RenderConfig {
20
- // 内容
20
+ /**
21
+ * 内容
22
+ */
21
23
  content?: RenderContent
22
- // 样式类名
24
+ /**
25
+ * 样式类名
26
+ */
23
27
  class?: string
24
- // 内联样式
28
+ /**
29
+ * 内联样式
30
+ */
25
31
  style?: string
26
- // 内联样式字段
32
+ /**
33
+ * 内联样式字段
34
+ */
27
35
  styleField?: string
28
- // 单位
36
+ /**
37
+ * 单位
38
+ */
29
39
  unit?: string
30
40
  }
31
- // ==================================== 渲染器相关接口 end ====================================
41
+ // =========================== 渲染器相关接口 end ===========================
32
42
 
33
- // ==================================== 字典相关接口 start ====================================
43
+ // =========================== 字典相关接口 start ===========================
34
44
  /**
35
45
  * 字典属性接口 共用于其它props配置属性
36
46
  */
37
47
  export interface DictProps {
38
- // 指定选项label为选项对象的某个属性值
48
+ /**
49
+ * 指定选项label为选项对象的某个属性值
50
+ */
39
51
  label: string
40
- // 指定选项value为选项对象的某个属性值
52
+ /**
53
+ * 指定选项value为选项对象的某个属性值
54
+ */
41
55
  value: string
42
- // 指定选项children为选项对象的某个属性值
56
+ /**
57
+ * 指定选项children为选项对象的某个属性值
58
+ */
43
59
  children: string
44
60
  }
45
61
 
@@ -47,44 +63,63 @@ export interface DictProps {
47
63
  * 字典映射接口
48
64
  */
49
65
  export interface DictMap {
50
- // 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
66
+ /**
67
+ * 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
68
+ */
51
69
  [key: string]: Record<DictProps['label'] | DictProps['value'], any>[]
52
70
  }
53
- // export interface DictMap {
54
- // // 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
55
- // [key: string]: Array<{ label: string; value: string | number | boolean }>
56
- // }
57
71
 
58
72
  /**
59
73
  * 使用字典接口
60
74
  */
61
75
  export interface UseDict {
62
- // 字典key 即dictMap的key,如为boolean则以label作为dictMap的key
76
+ /**
77
+ * 字典key 即dictMap的key,为boolean则以label作为dictMap的key
78
+ */
63
79
  key?: string | boolean
64
- // 字典属性
80
+ /**
81
+ * 字典属性
82
+ */
65
83
  props?: DictProps
66
- // 字典类名
84
+ /**
85
+ * 字典类名
86
+ */
67
87
  class?: string
68
- // 内联样式
88
+ /**
89
+ * 内联样式
90
+ */
69
91
  inlineStyle?: string
70
- // 字典样式字段
92
+ /**
93
+ * 字典样式字段
94
+ */
71
95
  styleField?: string
72
- // 字典分割符 默认为逗号(,)
96
+ /**
97
+ * 字典分割符 默认为逗号(,)
98
+ */
73
99
  separator?: string
74
100
  }
75
- // ==================================== 字典相关接口 start ====================================
101
+ // =========================== 字典相关接口 end ===========================
76
102
 
103
+ // =========================== 其他接口 start ===========================
77
104
  /**
78
105
  * 上传配置接口
79
106
  */
80
107
  export interface UploadConfig {
81
- // 上传地址
108
+ /**
109
+ * 上传地址
110
+ */
82
111
  action?: string
83
- // 请求头
112
+ /**
113
+ * 请求头
114
+ */
84
115
  headers?: Record<string, unknown>
85
- // 上传数据
116
+ /**
117
+ * 上传数据
118
+ */
86
119
  data?: Record<string, unknown>
87
- // 其他配置项
120
+ /**
121
+ * 其他配置项
122
+ */
88
123
  [key: string]: any
89
124
  }
90
125
 
@@ -92,17 +127,37 @@ export interface UploadConfig {
92
127
  * 全局配置接口 其他组件声明globalConfig类型时需要
93
128
  */
94
129
  export interface GlobalConfig {
95
- // 最终语言
130
+ /**
131
+ * 最终语言
132
+ */
96
133
  finalLanguage: string
97
- // 最终字典属性
134
+ /**
135
+ * 最终字典属性
136
+ */
98
137
  finalDictProps: DictProps
99
- // 最终字典映射
138
+ /**
139
+ * 最终字典映射
140
+ */
100
141
  finalDictMap: DictMap
101
- // 最终表格底部预留偏移
102
- finalTableBottomOffset: number
103
- // 最终表格弹窗底部操作栏固定高度,isModal=true生效
104
- finalTableModalFooterHeight?: number
105
- // 最终上传配置
142
+ /**
143
+ * 最终表格页面高度
144
+ */
145
+ finalTablePageHeight: string
146
+ /**
147
+ * 最终表格弹窗高度
148
+ */
149
+ finalTableModalHeight: string
150
+ /**
151
+ * 最终表格页面底部预留偏移
152
+ */
153
+ finalTablePageBottomOffset: number
154
+ /**
155
+ * 最终表格弹窗底部预留偏移 tableMode=modal生效
156
+ */
157
+ finalTableModalBottomOffset: number
158
+ /**
159
+ * 最终上传配置
160
+ */
106
161
  finalUploadConfig: UploadConfig
107
162
  }
108
163
 
@@ -115,8 +170,17 @@ export type InputEventName = 'nonNegativeDecimal'
115
170
  * input事件接口
116
171
  */
117
172
  export interface InputEvent {
173
+ /**
174
+ * input事件名称
175
+ */
118
176
  name: InputEventName
177
+ /**
178
+ * 保留的小数位数
179
+ */
119
180
  digits?: number
181
+ /**
182
+ * 回调函数
183
+ */
120
184
  cb?: Function
121
185
  }
122
186
 
@@ -124,16 +188,30 @@ export interface InputEvent {
124
188
  * 编辑配置属性接口
125
189
  */
126
190
  export interface EditAttrs {
127
- // 是否追加label到placeholder后面 默认是,不需要可显式设置appendLabelToPlaceholder为false
191
+ /**
192
+ * 是否追加label到placeholder后面 默认是
193
+ * 不需要可显式设置appendLabelToPlaceholder为false
194
+ */
128
195
  appendLabelToPlaceholder?: boolean
129
- // UseElSelect等组件的options
196
+ /**
197
+ * UseElSelect等组件的options
198
+ */
130
199
  options?: Record<string, any>[]
131
- // UseElSelect等组件的props
200
+ /**
201
+ * UseElSelect等组件的props
202
+ */
132
203
  props?: DictProps
133
- // change事件
204
+ /**
205
+ * change事件
206
+ */
134
207
  changeEvent?: Function
135
- // focus事件
208
+ /**
209
+ * focus事件
210
+ */
136
211
  focusEvent?: Function
137
- // input事件
212
+ /**
213
+ * input事件
214
+ */
138
215
  inputEvent?: Function | InputEventName | InputEvent
139
216
  }
217
+ // =========================== 其他接口 end ===========================
@@ -1,11 +0,0 @@
1
- import { ComputedRef, Ref } from 'vue';
2
- import { Props } from '../types';
3
- import { GlobalConfig } from '../../../types';
4
- export declare const useTableHeightAdaptive: ({ rootRef, tableWrapperRef, mergedProps, globalConfig }: {
5
- rootRef: Ref<HTMLDivElement | null>;
6
- tableWrapperRef: Ref<HTMLDivElement | null>;
7
- mergedProps: ComputedRef<Props>;
8
- globalConfig: ComputedRef<GlobalConfig>;
9
- }) => {
10
- tableRealHeight: Ref<string, string>;
11
- };
@@ -1 +0,0 @@
1
- var e={primary:`color:#1677ff;font-weight:bold;`,success:`color:#52c41a;font-weight:bold;`,warn:`color:#fa8c14;font-weight:bold;`,error:`color:#f5222d;font-weight:bold;`,block:`color:#4e5969;font-weight:bold;`,json:`color:#20b2aa;font-weight:bold;`},t={primary:`🔧`,success:`✅`,warn:`⚠️`,error:`❌`,block:`📦`,json:`📄`},n=`background:#000; padding:10px 8px;`,r=r=>{let i=(i,a,o,s)=>{let c=`${t[i]} [${r}]`;if(!s||o===void 0){console.log(`%c${c}%c ${a}`,e[i],``,o);return}let l=JSON.stringify(o,null,2);console.log(`%c${c}%c ${a}\n%c${l}`,e[i],``,n)};return{primary:(e,t,n)=>i(`primary`,e,t,n),success:(e,t,n)=>i(`success`,e,t,n),warn:(e,t,n)=>i(`warn`,e,t,n),error:(e,t,n)=>i(`error`,e,t,n),block:(i,a,o)=>{console.log(`%c- - - - - - - - - - - - - - - - - - - - - - -`,`color:#888`);let s=`${t.block} [${r}]`;if(!o||a===void 0)console.log(`%c${s}%c ${i}`,e.block,``,a);else{let t=JSON.stringify(a,null,2);console.log(`%c${s}%c ${i}\n%c${t}`,e.block,``,n)}console.log(`%c- - - - - - - - - - - - - - - - - - - - - - -`,`color:#888`)},json:(i,a)=>{let o=`${t.json} [${r}]`,s=JSON.stringify(a,null,2);console.log(`%c${o}%c ${i}\n%c${s}`,e.json,``,n)}}};export{r as useLog};