@wyfex/ivue 0.2.0 → 0.4.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.
@@ -1,6 +1,133 @@
1
1
  import type { Component, VNode } from 'vue'
2
2
 
3
+ // ==================================== 渲染器相关接口 start ====================================
3
4
  /**
4
5
  * 渲染器内容类型
5
6
  */
6
7
  export type RenderContent = string | number | boolean | VNode | Component
8
+
9
+ /**
10
+ * 渲染器配置接口
11
+ */
12
+ export interface RenderConfig {
13
+ // 内容
14
+ content?: RenderContent
15
+ // 样式类名
16
+ class?: string
17
+ // 内联样式
18
+ style?: string
19
+ // 内联样式字段
20
+ styleField?: string
21
+ // 单位
22
+ unit?: string
23
+ }
24
+ // ==================================== 渲染器相关接口 end ====================================
25
+
26
+ // ==================================== 字典相关接口 start ====================================
27
+ /**
28
+ * 字典属性接口 共用于其它props配置属性
29
+ */
30
+ export interface DictProps {
31
+ // 指定选项label为选项对象的某个属性值
32
+ label: string
33
+ // 指定选项value为选项对象的某个属性值
34
+ value: string
35
+ // 指定选项children为选项对象的某个属性值
36
+ children: string
37
+ }
38
+
39
+ /**
40
+ * 字典映射接口
41
+ */
42
+ export interface DictMap {
43
+ // 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
44
+ [key: string]: Array<{ label: string; value: string | number | boolean }>
45
+ }
46
+
47
+ /**
48
+ * 使用字典接口
49
+ */
50
+ export interface UseDict {
51
+ // 字典数据 可为字符串、对象、字符串数组、数字数组、对象数组,如为string则为dictMap的key
52
+ data?:
53
+ | string
54
+ | Record<string, any>
55
+ | string[]
56
+ | number[]
57
+ | Record<string, any>[]
58
+ // 字典属性
59
+ props?: DictProps
60
+ // 字典类名
61
+ class?: string
62
+ // 内联样式
63
+ inlineStyle?: string
64
+ // 字典样式字段
65
+ styleField?: string
66
+ // 字典分割符 默认为逗号(,)
67
+ separator?: string
68
+ }
69
+ // ==================================== 字典相关接口 start ====================================
70
+
71
+ /**
72
+ * 上传配置接口
73
+ */
74
+ export interface UploadConfig {
75
+ // 上传地址
76
+ action?: string
77
+ // 请求头
78
+ headers?: Record<string, unknown>
79
+ // 上传数据
80
+ data?: Record<string, unknown>
81
+ // 其他配置项
82
+ [key: string]: any
83
+ }
84
+
85
+ /**
86
+ * 全局配置接口 其他组件声明globalConfig类型时需要
87
+ */
88
+ export interface GlobalConfig {
89
+ // 最终语言
90
+ finalLanguage: string
91
+ // 最终主题模式
92
+ finalThemeMode: string
93
+ // 最终字典属性
94
+ finalDictProps: DictProps
95
+ // 最终字典分割符
96
+ finalDictDataSeparator?: string
97
+ // 最终表格额外高度
98
+ finalTableExtraHeight: number
99
+ // 最终上传配置
100
+ finalUploadConfig: UploadConfig
101
+ }
102
+
103
+ /**
104
+ * input事件名称类型
105
+ */
106
+ export type InputEventName = 'nonNegativeDecimal'
107
+
108
+ /**
109
+ * input事件接口
110
+ */
111
+ export interface InputEvent {
112
+ name: InputEventName
113
+ digits?: number
114
+ cb?: Function
115
+ }
116
+
117
+ /**
118
+ * 编辑配置属性接口
119
+ */
120
+ export interface EditAttrs {
121
+ // 是否追加label到placeholder后面 默认是,不需要可显式设置appendLabelToPlaceholder为false
122
+ appendLabelToPlaceholder?: boolean
123
+ // UseElSelect等组件的options
124
+ options?: Record<string, any>[]
125
+ // UseElSelect等组件的props
126
+ props?: DictProps
127
+ // change事件
128
+ changeEvent?: Function
129
+ // focus事件
130
+ focusEvent?: Function
131
+ // input事件
132
+ inputEvent?: Function | InputEventName | InputEvent
133
+ }