im-ui-mobile 0.1.24 → 0.1.25
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/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { AllowedComponentProps, VNodeProps } from '../common'
|
|
|
3
3
|
/**
|
|
4
4
|
* 表单项配置接口
|
|
5
5
|
*/
|
|
6
|
-
declare interface
|
|
6
|
+
declare interface FormItemProps {
|
|
7
7
|
/** 字段名 */
|
|
8
8
|
prop?: string
|
|
9
9
|
/** 标签文本 */
|
|
@@ -37,14 +37,14 @@ declare interface _FormItemProps {
|
|
|
37
37
|
/**
|
|
38
38
|
* 表单项事件接口
|
|
39
39
|
*/
|
|
40
|
-
declare interface
|
|
40
|
+
declare interface FormItemEmits {
|
|
41
41
|
(e: 'validate', prop: string, valid: boolean, message?: string): void
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
declare interface _FormItem {
|
|
45
45
|
new(): {
|
|
46
|
-
$props: AllowedComponentProps & VNodeProps &
|
|
47
|
-
$emit:
|
|
46
|
+
$props: AllowedComponentProps & VNodeProps & FormItemProps
|
|
47
|
+
$emit: FormItemEmits
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -53,5 +53,7 @@ export declare const FormItem: _FormItem
|
|
|
53
53
|
// 默认导出
|
|
54
54
|
export default FormItem
|
|
55
55
|
|
|
56
|
-
export
|
|
57
|
-
|
|
56
|
+
export type {
|
|
57
|
+
FormItemProps,
|
|
58
|
+
FormItemEmits
|
|
59
|
+
}
|
|
@@ -28,7 +28,7 @@ export type FormErrors = Record<string, string>
|
|
|
28
28
|
/**
|
|
29
29
|
* 验证规则接口
|
|
30
30
|
*/
|
|
31
|
-
declare interface
|
|
31
|
+
declare interface FormRule {
|
|
32
32
|
/** 是否必填 */
|
|
33
33
|
required?: boolean
|
|
34
34
|
/** 验证消息 */
|
|
@@ -38,7 +38,7 @@ declare interface _FormRule {
|
|
|
38
38
|
/** 正则表达式验证 */
|
|
39
39
|
pattern?: RegExp
|
|
40
40
|
/** 自定义验证函数 */
|
|
41
|
-
validator?: (value: any, rule:
|
|
41
|
+
validator?: (value: any, rule: FormRule) => boolean | string | Promise<boolean | string>
|
|
42
42
|
/** 最小长度 */
|
|
43
43
|
min?: number
|
|
44
44
|
/** 最大长度 */
|
|
@@ -58,7 +58,7 @@ declare interface _FormRule {
|
|
|
58
58
|
/**
|
|
59
59
|
* 表单验证结果
|
|
60
60
|
*/
|
|
61
|
-
declare interface
|
|
61
|
+
declare interface ValidateResult {
|
|
62
62
|
valid: boolean
|
|
63
63
|
errors: FormErrors
|
|
64
64
|
fields: Record<string, boolean>
|
|
@@ -67,7 +67,7 @@ declare interface _ValidateResult {
|
|
|
67
67
|
/**
|
|
68
68
|
* 表单配置接口
|
|
69
69
|
*/
|
|
70
|
-
declare interface
|
|
70
|
+
declare interface FormProps {
|
|
71
71
|
/** 表单数据模型 */
|
|
72
72
|
modelValue?: FormModel
|
|
73
73
|
/** 表单布局 */
|
|
@@ -103,10 +103,10 @@ declare interface _FormProps {
|
|
|
103
103
|
/**
|
|
104
104
|
* 表单事件接口
|
|
105
105
|
*/
|
|
106
|
-
declare interface
|
|
106
|
+
declare interface FormEmits {
|
|
107
107
|
(e: 'update:modelValue', values: FormModel): void
|
|
108
108
|
(e: 'submit', values: FormModel): void
|
|
109
|
-
(e: 'validate', result:
|
|
109
|
+
(e: 'validate', result: ValidateResult): void
|
|
110
110
|
(e: 'error', errors: FormErrors): void
|
|
111
111
|
(e: 'change', values: FormModel): void
|
|
112
112
|
(e: 'reset'): void
|
|
@@ -115,9 +115,9 @@ declare interface _FormEmits {
|
|
|
115
115
|
/**
|
|
116
116
|
* 表单上下文接口
|
|
117
117
|
*/
|
|
118
|
-
declare interface
|
|
118
|
+
declare interface FormContext {
|
|
119
119
|
model: FormModel
|
|
120
|
-
rules: Record<string,
|
|
120
|
+
rules: Record<string, FormRule[]>
|
|
121
121
|
errors: FormErrors
|
|
122
122
|
layout: FormLayout
|
|
123
123
|
size: FormSize
|
|
@@ -139,8 +139,8 @@ declare interface _FormContext {
|
|
|
139
139
|
|
|
140
140
|
declare interface _Form {
|
|
141
141
|
new(): {
|
|
142
|
-
$props: AllowedComponentProps & VNodeProps &
|
|
143
|
-
$emit:
|
|
142
|
+
$props: AllowedComponentProps & VNodeProps & FormProps
|
|
143
|
+
$emit: FormEmits
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -149,8 +149,10 @@ export declare const Form: _Form
|
|
|
149
149
|
// 默认导出
|
|
150
150
|
export default Form
|
|
151
151
|
|
|
152
|
-
export
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
export type {
|
|
153
|
+
FormRule,
|
|
154
|
+
ValidateResult,
|
|
155
|
+
FormProps,
|
|
156
|
+
FormEmits,
|
|
157
|
+
FormContext
|
|
158
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -65,6 +65,24 @@ import type {
|
|
|
65
65
|
DropdownState,
|
|
66
66
|
VirtualScrollState
|
|
67
67
|
} from './components/select'
|
|
68
|
+
import { Form } from './components/form'
|
|
69
|
+
import type {
|
|
70
|
+
FormLayout,
|
|
71
|
+
FormSize,
|
|
72
|
+
LabelAlign,
|
|
73
|
+
FormModel,
|
|
74
|
+
FormErrors,
|
|
75
|
+
FormRule,
|
|
76
|
+
ValidateResult,
|
|
77
|
+
FormProps,
|
|
78
|
+
FormEmits,
|
|
79
|
+
FormContext
|
|
80
|
+
} from './components/form'
|
|
81
|
+
import { FormItem } from './components/form-item'
|
|
82
|
+
import type {
|
|
83
|
+
FormItemProps,
|
|
84
|
+
FormItemEmits
|
|
85
|
+
} from './components/form-item'
|
|
68
86
|
|
|
69
87
|
declare module 'im-ui-mobile' {
|
|
70
88
|
export function install(): void
|
|
@@ -119,6 +137,20 @@ declare module 'im-ui-mobile' {
|
|
|
119
137
|
SelectEmits,
|
|
120
138
|
DropdownState,
|
|
121
139
|
VirtualScrollState,
|
|
140
|
+
|
|
141
|
+
FormLayout,
|
|
142
|
+
FormSize,
|
|
143
|
+
LabelAlign,
|
|
144
|
+
FormModel,
|
|
145
|
+
FormErrors,
|
|
146
|
+
FormRule,
|
|
147
|
+
ValidateResult,
|
|
148
|
+
FormProps,
|
|
149
|
+
FormEmits,
|
|
150
|
+
FormContext,
|
|
151
|
+
|
|
152
|
+
FormItemProps,
|
|
153
|
+
FormItemEmits
|
|
122
154
|
}
|
|
123
155
|
|
|
124
156
|
// 导出函数/实例
|
|
@@ -154,6 +186,8 @@ declare module 'im-ui-mobile' {
|
|
|
154
186
|
// 组件
|
|
155
187
|
Upload,
|
|
156
188
|
Select,
|
|
189
|
+
Form,
|
|
190
|
+
FormItem
|
|
157
191
|
}
|
|
158
192
|
|
|
159
193
|
|