x-next 0.0.0-alpha.52 → 0.0.0-alpha.53
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/_hooks/use-cursor.d.ts +2 -0
- package/dist/_hooks/use-form-item.d.ts +16 -0
- package/dist/_utils/get-value-by-path.d.ts +5 -0
- package/dist/_utils/keycode.d.ts +36 -0
- package/dist/_utils/pick.d.ts +1 -0
- package/dist/_utils/responsive-observe.d.ts +24 -0
- package/dist/components/form/Form.vue.d.ts +313 -0
- package/dist/components/form/FormItem.vue.d.ts +2218 -0
- package/dist/components/form/context.d.ts +49 -0
- package/dist/components/form/form-item-label.vue.d.ts +1435 -0
- package/dist/components/form/form-item-message.vue.d.ts +24 -0
- package/dist/components/form/index.d.ts +4189 -0
- package/dist/components/form/interface.d.ts +185 -0
- package/dist/components/form/utils.d.ts +9 -0
- package/dist/components/form/validateMessages.d.ts +46 -0
- package/dist/components/grid/Col.vue.d.ts +188 -0
- package/dist/components/grid/Grid.vue.d.ts +108 -0
- package/dist/components/grid/GridItem.vue.d.ts +78 -0
- package/dist/components/grid/Row.vue.d.ts +102 -0
- package/dist/components/grid/context.d.ts +19 -0
- package/dist/components/grid/hook/use-responsive-state.d.ts +3 -0
- package/dist/components/grid/hook/use-responsive-value.d.ts +24 -0
- package/dist/components/grid/index.d.ts +562 -0
- package/dist/components/grid/interface.d.ts +80 -0
- package/dist/components/grid/utils/index.d.ts +11 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/input/Input.d.ts +233 -161
- package/dist/components/input/InputGroup.vue.d.ts +9 -0
- package/dist/components/input/InputPassword.vue.d.ts +337 -0
- package/dist/components/input/InputSearch.d.ts +123 -0
- package/dist/components/input/index.d.ts +927 -270
- package/dist/icons/_self/eye-invisible.d.ts +50 -0
- package/dist/icons/_self/eye.d.ts +50 -0
- package/dist/icons/_self/question-message.d.ts +50 -0
- package/dist/icons/_self/search.d.ts +50 -0
- package/dist/index.es.js +6225 -3507
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +10 -0
- package/package.json +4 -2
- package/volar.d.ts +10 -0
- package/dist/components/form/constants.d.ts +0 -4
- package/dist/components/form/form-item.d.ts +0 -31
- package/dist/components/form/form.d.ts +0 -39
- package/dist/components/form/hooks.d.ts +0 -4
- package/dist/components/form/types.d.ts +0 -31
- package/dist/components/input/props.d.ts +0 -95
- package/dist/components/input/utils.d.ts +0 -6
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Ref } from 'vue';
|
2
|
+
import { FormItemContext } from '../components/form/context';
|
3
|
+
import { Size } from '../_utils/constant';
|
4
|
+
export declare const useFormItem: ({ size, disabled, error, uninject, }?: {
|
5
|
+
size?: Ref<Size | undefined>;
|
6
|
+
disabled?: Ref<boolean>;
|
7
|
+
error?: Ref<boolean>;
|
8
|
+
uninject?: boolean;
|
9
|
+
}) => {
|
10
|
+
formItemCtx: FormItemContext;
|
11
|
+
mergedSize: import('vue').ComputedRef<"mini" | "small" | "medium" | "large" | undefined>;
|
12
|
+
mergedDisabled: import('vue').ComputedRef<boolean>;
|
13
|
+
mergedError: import('vue').ComputedRef<boolean>;
|
14
|
+
feedback: Ref<string | undefined, string | undefined>;
|
15
|
+
eventHandlers: Ref<import('../components/form/interface').FormItemEventHandler, import('../components/form/interface').FormItemEventHandler>;
|
16
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { Data } from './types';
|
2
|
+
export declare const getValueByPath: <T = any>(obj: Data | undefined, path: string | undefined) => T | undefined;
|
3
|
+
export declare const setValueByPath: (obj: Data | undefined, path: string | undefined, value: any, { addPath }?: {
|
4
|
+
addPath?: boolean;
|
5
|
+
}) => void;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
export declare const Enter: {
|
2
|
+
key: string;
|
3
|
+
code: string;
|
4
|
+
};
|
5
|
+
export declare const Esc: {
|
6
|
+
key: string;
|
7
|
+
code: string;
|
8
|
+
};
|
9
|
+
export declare const Backspace: {
|
10
|
+
key: string;
|
11
|
+
code: string;
|
12
|
+
};
|
13
|
+
export declare const Tab: {
|
14
|
+
key: string;
|
15
|
+
code: string;
|
16
|
+
};
|
17
|
+
export declare const Space: {
|
18
|
+
key: string;
|
19
|
+
code: string;
|
20
|
+
};
|
21
|
+
export declare const ArrowUp: {
|
22
|
+
key: string;
|
23
|
+
code: string;
|
24
|
+
};
|
25
|
+
export declare const ArrowDown: {
|
26
|
+
key: string;
|
27
|
+
code: string;
|
28
|
+
};
|
29
|
+
export declare const ArrowLeft: {
|
30
|
+
key: string;
|
31
|
+
code: string;
|
32
|
+
};
|
33
|
+
export declare const ArrowRight: {
|
34
|
+
key: string;
|
35
|
+
code: string;
|
36
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function pick<T extends object, K extends keyof T>(obj: T, keys: Array<K | string>): Pick<T, K>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
2
|
+
export type BreakpointMap = Partial<Record<Breakpoint, string>>;
|
3
|
+
export type ScreenMap = Partial<Record<Breakpoint, boolean>>;
|
4
|
+
export declare const responsiveArray: Breakpoint[];
|
5
|
+
export declare const responsiveMap: BreakpointMap;
|
6
|
+
type SubscribeFunc = (screens: ScreenMap, breakpointChecked: Breakpoint) => void;
|
7
|
+
type MediaQueryResult = {
|
8
|
+
matches: boolean;
|
9
|
+
};
|
10
|
+
type MediaQueryListener = (matches: MediaQueryResult) => void;
|
11
|
+
declare const responsiveObserve: {
|
12
|
+
matchHandlers: {
|
13
|
+
[key: string]: {
|
14
|
+
mql: MediaQueryList;
|
15
|
+
listener: MediaQueryListener;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
dispatch(pointMap: ScreenMap, breakpointChecked: Breakpoint): boolean;
|
19
|
+
subscribe(func: SubscribeFunc): string;
|
20
|
+
unsubscribe(token: string): void;
|
21
|
+
unregister(): void;
|
22
|
+
register(): void;
|
23
|
+
};
|
24
|
+
export default responsiveObserve;
|
@@ -0,0 +1,313 @@
|
|
1
|
+
import { PropType } from 'vue';
|
2
|
+
import { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
|
3
|
+
import { Size } from '../../_utils/constant';
|
4
|
+
import { FieldData, FieldRule, ValidatedError } from './interface';
|
5
|
+
declare const FORM_LAYOUTS: readonly ["horizontal", "vertical", "inline"];
|
6
|
+
type FormLayout = (typeof FORM_LAYOUTS)[number];
|
7
|
+
declare const FORM_LABEL_ALIGNS: readonly ["left", "right"];
|
8
|
+
type FormLabelAlign = (typeof FORM_LABEL_ALIGNS)[number];
|
9
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
10
|
+
/**
|
11
|
+
* @zh 表单数据对象
|
12
|
+
* @en Form data object
|
13
|
+
*/
|
14
|
+
model: {
|
15
|
+
type: ObjectConstructor;
|
16
|
+
required: true;
|
17
|
+
};
|
18
|
+
/**
|
19
|
+
* @zh 表单的布局方式,包括水平、垂直、多列
|
20
|
+
* @en The layout of the form, including horizontal, vertical, and multi-column
|
21
|
+
* @values 'horizontal', 'vertical', 'inline'
|
22
|
+
*/
|
23
|
+
layout: {
|
24
|
+
type: PropType<FormLayout>;
|
25
|
+
default: string;
|
26
|
+
};
|
27
|
+
/**
|
28
|
+
* @zh 表单控件的尺寸
|
29
|
+
* @en The size of the form
|
30
|
+
* @values 'mini','small','medium','large'
|
31
|
+
* @defaultValue 'medium'
|
32
|
+
*/
|
33
|
+
size: {
|
34
|
+
type: PropType<Size>;
|
35
|
+
};
|
36
|
+
/**
|
37
|
+
* @zh 标签元素布局选项。参数同 `<col>` 组件一致
|
38
|
+
* @en Label element layout options. The parameters are the same as the `<col>` component
|
39
|
+
*/
|
40
|
+
labelColProps: {
|
41
|
+
type: ObjectConstructor;
|
42
|
+
default: () => {
|
43
|
+
span: number;
|
44
|
+
offset: number;
|
45
|
+
};
|
46
|
+
};
|
47
|
+
/**
|
48
|
+
* @zh 表单控件布局选项。参数同 `<col>` 组件一致
|
49
|
+
* @en Form control layout options. The parameters are the same as the `<col>` component
|
50
|
+
*/
|
51
|
+
wrapperColProps: {
|
52
|
+
type: ObjectConstructor;
|
53
|
+
default: () => {
|
54
|
+
span: number;
|
55
|
+
offset: number;
|
56
|
+
};
|
57
|
+
};
|
58
|
+
labelColStyle: ObjectConstructor;
|
59
|
+
wrapperColStyle: ObjectConstructor;
|
60
|
+
/**
|
61
|
+
* @zh 标签的对齐方向
|
62
|
+
* @en Alignment direction of the label
|
63
|
+
* @values 'left', 'right'
|
64
|
+
*/
|
65
|
+
labelAlign: {
|
66
|
+
type: PropType<FormLabelAlign>;
|
67
|
+
default: string;
|
68
|
+
};
|
69
|
+
/**
|
70
|
+
* @zh 是否禁用表单
|
71
|
+
* @en Whether to disable the form
|
72
|
+
*/
|
73
|
+
disabled: {
|
74
|
+
type: BooleanConstructor;
|
75
|
+
default: undefined;
|
76
|
+
};
|
77
|
+
/**
|
78
|
+
* @zh 表单项校验规则
|
79
|
+
* @en Form item validation rules
|
80
|
+
*/
|
81
|
+
rules: {
|
82
|
+
type: PropType<Record<string, FieldRule | FieldRule[]>>;
|
83
|
+
};
|
84
|
+
/**
|
85
|
+
* @zh 是否开启自动标签宽度,仅在 `layout="horizontal"` 下生效。
|
86
|
+
* @en Whether to enable automatic label width, it only takes effect under `layout="horizontal"`.
|
87
|
+
* @version 2.13.0
|
88
|
+
*/
|
89
|
+
autoLabelWidth: {
|
90
|
+
type: BooleanConstructor;
|
91
|
+
default: boolean;
|
92
|
+
};
|
93
|
+
/**
|
94
|
+
* @zh 表单控件 `id` 的前缀
|
95
|
+
*/
|
96
|
+
id: {
|
97
|
+
type: StringConstructor;
|
98
|
+
};
|
99
|
+
/**
|
100
|
+
* @zh 验证失败后滚动到第一个错误字段
|
101
|
+
* @en Scroll to the first error field after verification fails
|
102
|
+
* @version 2.51.0
|
103
|
+
*/
|
104
|
+
scrollToFirstError: {
|
105
|
+
type: BooleanConstructor;
|
106
|
+
default: boolean;
|
107
|
+
};
|
108
|
+
}>, {
|
109
|
+
cls: import('vue').ComputedRef<(string | {
|
110
|
+
[x: string]: boolean;
|
111
|
+
})[]>;
|
112
|
+
formRef: import('vue').Ref<HTMLFormElement | undefined, HTMLFormElement | undefined>;
|
113
|
+
handleSubmit: (e: Event) => void;
|
114
|
+
innerValidate: (callback?: (errors: undefined | Record<string, ValidatedError>) => void) => Promise<undefined | Record<string, ValidatedError>>;
|
115
|
+
innerValidateField: (field: string | string[], callback?: (errors: undefined | Record<string, ValidatedError>) => void) => Promise<Record<string, ValidatedError> | undefined>;
|
116
|
+
innerResetFields: (field?: string | string[]) => void;
|
117
|
+
innerClearValidate: (field?: string | string[]) => void;
|
118
|
+
innerSetFields: (data: Record<string, FieldData>) => void;
|
119
|
+
innerScrollToField: (field: string, options?: ScrollIntoViewOptions) => void;
|
120
|
+
}, {}, {}, {
|
121
|
+
/**
|
122
|
+
* @zh 校验全部表单数据
|
123
|
+
* @en Verify all form data
|
124
|
+
* @public
|
125
|
+
* @param {(errors: undefined | Record<string, ValidatedError>) => void} callback
|
126
|
+
* @returns {Promise<undefined | Record<string, ValidatedError>>}
|
127
|
+
*/
|
128
|
+
validate(callback?: (errors: undefined | Record<string, ValidatedError>) => void): Promise<undefined | Record<string, ValidatedError>>;
|
129
|
+
/**
|
130
|
+
* @zh 校验部分表单数据
|
131
|
+
* @en Validate part of the form data
|
132
|
+
* @public
|
133
|
+
* @param {string | string[]} field
|
134
|
+
* @param {(errors: undefined | Record<string, ValidatedError>) => void} callback
|
135
|
+
* @returns {Promise<undefined | Record<string, ValidatedError>>}
|
136
|
+
*/
|
137
|
+
validateField(field: string | string[], callback?: (errors: undefined | Record<string, ValidatedError>) => void): Promise<undefined | Record<string, ValidatedError>>;
|
138
|
+
/**
|
139
|
+
* @zh 重置表单数据
|
140
|
+
* @en Reset form data
|
141
|
+
* @public
|
142
|
+
* @param {string | string[]} field
|
143
|
+
*/
|
144
|
+
resetFields(field?: string | string[]): void;
|
145
|
+
/**
|
146
|
+
* @zh 清除校验状态
|
147
|
+
* @en Clear verification status
|
148
|
+
* @public
|
149
|
+
* @param {string | string[]} field
|
150
|
+
*/
|
151
|
+
clearValidate(field?: string | string[]): void;
|
152
|
+
/**
|
153
|
+
* @zh 设置表单项的值和状态
|
154
|
+
* @en Set the value and status of the form item
|
155
|
+
* @param {Record<string, FieldData>} data
|
156
|
+
* @public
|
157
|
+
*/
|
158
|
+
setFields(data: Record<string, FieldData>): void;
|
159
|
+
/**
|
160
|
+
* @zh 滚动到指定表单项
|
161
|
+
* @en Scroll to the specified form item
|
162
|
+
* @param {string} field
|
163
|
+
* @public
|
164
|
+
* @version 2.51.0
|
165
|
+
*/
|
166
|
+
scrollToField(field: string): void;
|
167
|
+
}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
168
|
+
/**
|
169
|
+
* @zh 表单提交时触发
|
170
|
+
* @en Triggered when the form is submitted
|
171
|
+
* @param {{values: Record<string, any>; errors: Record<string, ValidatedError> | undefined}} data
|
172
|
+
* @param {Event} ev
|
173
|
+
*/
|
174
|
+
submit: (data: {
|
175
|
+
values: Record<string, any>;
|
176
|
+
errors: Record<string, ValidatedError> | undefined;
|
177
|
+
}, ev: Event) => true;
|
178
|
+
/**
|
179
|
+
* @zh 验证成功时触发
|
180
|
+
* @en Triggered when verification is successful
|
181
|
+
* @param {Record<string, any>} values
|
182
|
+
* @param {Event} ev
|
183
|
+
*/
|
184
|
+
submitSuccess: (values: Record<string, any>, ev: Event) => true;
|
185
|
+
/**
|
186
|
+
* @zh 验证失败时触发
|
187
|
+
* @en Triggered when verification failed
|
188
|
+
* @param {{values: Record<string, any>; errors: Record<string, ValidatedError>}} data
|
189
|
+
* @param {Event} ev
|
190
|
+
*/
|
191
|
+
submitFailed: (data: {
|
192
|
+
values: Record<string, any>;
|
193
|
+
errors: Record<string, ValidatedError>;
|
194
|
+
}, ev: Event) => true;
|
195
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
196
|
+
/**
|
197
|
+
* @zh 表单数据对象
|
198
|
+
* @en Form data object
|
199
|
+
*/
|
200
|
+
model: {
|
201
|
+
type: ObjectConstructor;
|
202
|
+
required: true;
|
203
|
+
};
|
204
|
+
/**
|
205
|
+
* @zh 表单的布局方式,包括水平、垂直、多列
|
206
|
+
* @en The layout of the form, including horizontal, vertical, and multi-column
|
207
|
+
* @values 'horizontal', 'vertical', 'inline'
|
208
|
+
*/
|
209
|
+
layout: {
|
210
|
+
type: PropType<FormLayout>;
|
211
|
+
default: string;
|
212
|
+
};
|
213
|
+
/**
|
214
|
+
* @zh 表单控件的尺寸
|
215
|
+
* @en The size of the form
|
216
|
+
* @values 'mini','small','medium','large'
|
217
|
+
* @defaultValue 'medium'
|
218
|
+
*/
|
219
|
+
size: {
|
220
|
+
type: PropType<Size>;
|
221
|
+
};
|
222
|
+
/**
|
223
|
+
* @zh 标签元素布局选项。参数同 `<col>` 组件一致
|
224
|
+
* @en Label element layout options. The parameters are the same as the `<col>` component
|
225
|
+
*/
|
226
|
+
labelColProps: {
|
227
|
+
type: ObjectConstructor;
|
228
|
+
default: () => {
|
229
|
+
span: number;
|
230
|
+
offset: number;
|
231
|
+
};
|
232
|
+
};
|
233
|
+
/**
|
234
|
+
* @zh 表单控件布局选项。参数同 `<col>` 组件一致
|
235
|
+
* @en Form control layout options. The parameters are the same as the `<col>` component
|
236
|
+
*/
|
237
|
+
wrapperColProps: {
|
238
|
+
type: ObjectConstructor;
|
239
|
+
default: () => {
|
240
|
+
span: number;
|
241
|
+
offset: number;
|
242
|
+
};
|
243
|
+
};
|
244
|
+
labelColStyle: ObjectConstructor;
|
245
|
+
wrapperColStyle: ObjectConstructor;
|
246
|
+
/**
|
247
|
+
* @zh 标签的对齐方向
|
248
|
+
* @en Alignment direction of the label
|
249
|
+
* @values 'left', 'right'
|
250
|
+
*/
|
251
|
+
labelAlign: {
|
252
|
+
type: PropType<FormLabelAlign>;
|
253
|
+
default: string;
|
254
|
+
};
|
255
|
+
/**
|
256
|
+
* @zh 是否禁用表单
|
257
|
+
* @en Whether to disable the form
|
258
|
+
*/
|
259
|
+
disabled: {
|
260
|
+
type: BooleanConstructor;
|
261
|
+
default: undefined;
|
262
|
+
};
|
263
|
+
/**
|
264
|
+
* @zh 表单项校验规则
|
265
|
+
* @en Form item validation rules
|
266
|
+
*/
|
267
|
+
rules: {
|
268
|
+
type: PropType<Record<string, FieldRule | FieldRule[]>>;
|
269
|
+
};
|
270
|
+
/**
|
271
|
+
* @zh 是否开启自动标签宽度,仅在 `layout="horizontal"` 下生效。
|
272
|
+
* @en Whether to enable automatic label width, it only takes effect under `layout="horizontal"`.
|
273
|
+
* @version 2.13.0
|
274
|
+
*/
|
275
|
+
autoLabelWidth: {
|
276
|
+
type: BooleanConstructor;
|
277
|
+
default: boolean;
|
278
|
+
};
|
279
|
+
/**
|
280
|
+
* @zh 表单控件 `id` 的前缀
|
281
|
+
*/
|
282
|
+
id: {
|
283
|
+
type: StringConstructor;
|
284
|
+
};
|
285
|
+
/**
|
286
|
+
* @zh 验证失败后滚动到第一个错误字段
|
287
|
+
* @en Scroll to the first error field after verification fails
|
288
|
+
* @version 2.51.0
|
289
|
+
*/
|
290
|
+
scrollToFirstError: {
|
291
|
+
type: BooleanConstructor;
|
292
|
+
default: boolean;
|
293
|
+
};
|
294
|
+
}>> & Readonly<{
|
295
|
+
onSubmit?: ((data: {
|
296
|
+
values: Record<string, any>;
|
297
|
+
errors: Record<string, ValidatedError> | undefined;
|
298
|
+
}, ev: Event) => any) | undefined;
|
299
|
+
onSubmitSuccess?: ((values: Record<string, any>, ev: Event) => any) | undefined;
|
300
|
+
onSubmitFailed?: ((data: {
|
301
|
+
values: Record<string, any>;
|
302
|
+
errors: Record<string, ValidatedError>;
|
303
|
+
}, ev: Event) => any) | undefined;
|
304
|
+
}>, {
|
305
|
+
disabled: boolean;
|
306
|
+
layout: "horizontal" | "vertical" | "inline";
|
307
|
+
labelColProps: Record<string, any>;
|
308
|
+
wrapperColProps: Record<string, any>;
|
309
|
+
labelAlign: "left" | "right";
|
310
|
+
autoLabelWidth: boolean;
|
311
|
+
scrollToFirstError: boolean;
|
312
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
313
|
+
export default _default;
|