h5-tdsign-for-vue 0.1.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.
- package/README.md +330 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +659 -0
- package/dist/index.js +969 -0
- package/dist/index.js.map +1 -0
- package/dist/resolver.cjs +2 -0
- package/dist/resolver.cjs.map +1 -0
- package/dist/resolver.d.ts +41 -0
- package/dist/resolver.js +24 -0
- package/dist/resolver.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +89 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
import { AllowedComponentProps } from 'vue';
|
|
2
|
+
import { AttachNode } from 'tdesign-mobile-vue';
|
|
3
|
+
import { CascaderProps } from 'tdesign-mobile-vue';
|
|
4
|
+
import { CheckboxGroupProps } from 'tdesign-mobile-vue';
|
|
5
|
+
import { Component } from 'vue';
|
|
6
|
+
import { ComponentCustomProps } from 'vue';
|
|
7
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
8
|
+
import { ComponentProvideOptions } from 'vue';
|
|
9
|
+
import { DateTimePickerMode } from 'tdesign-mobile-vue';
|
|
10
|
+
import { DateTimePickerProps } from 'tdesign-mobile-vue';
|
|
11
|
+
import { DefineComponent } from 'vue';
|
|
12
|
+
import { FormRule } from 'tdesign-mobile-vue';
|
|
13
|
+
import { InputProps } from 'tdesign-mobile-vue';
|
|
14
|
+
import { OverlayProps } from 'tdesign-mobile-vue';
|
|
15
|
+
import { PickerProps } from 'tdesign-mobile-vue';
|
|
16
|
+
import { PickerValue } from 'tdesign-mobile-vue';
|
|
17
|
+
import { PopupProps } from 'tdesign-mobile-vue';
|
|
18
|
+
import { PublicProps } from 'vue';
|
|
19
|
+
import { RadioGroupProps } from 'tdesign-mobile-vue';
|
|
20
|
+
import { RequestMethodResponse } from 'tdesign-mobile-vue';
|
|
21
|
+
import { ShallowUnwrapRef } from 'vue';
|
|
22
|
+
import { StepperProps } from 'tdesign-mobile-vue';
|
|
23
|
+
import { SuccessContext } from 'tdesign-mobile-vue';
|
|
24
|
+
import { SwitchProps } from 'tdesign-mobile-vue';
|
|
25
|
+
import { TextareaProps } from 'tdesign-mobile-vue';
|
|
26
|
+
import { TimeModeValues } from 'tdesign-mobile-vue';
|
|
27
|
+
import { TNode } from 'tdesign-mobile-vue';
|
|
28
|
+
import { TreeLevel } from 'tdesign-mobile-vue';
|
|
29
|
+
import { TreeOptionData } from 'tdesign-mobile-vue';
|
|
30
|
+
import { _TreeOptionData } from 'tdesign-mobile-vue';
|
|
31
|
+
import { TreeSelectProps } from 'tdesign-mobile-vue';
|
|
32
|
+
import { TreeSelectValue } from 'tdesign-mobile-vue';
|
|
33
|
+
import { UploadFailContext } from 'tdesign-mobile-vue';
|
|
34
|
+
import { UploadFile } from 'tdesign-mobile-vue';
|
|
35
|
+
import { VNode } from 'vue';
|
|
36
|
+
import { VNodeProps } from 'vue';
|
|
37
|
+
|
|
38
|
+
declare type __VLS_PrettifyLocal<T> = {
|
|
39
|
+
[K in keyof T]: T[K];
|
|
40
|
+
} & {};
|
|
41
|
+
|
|
42
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
43
|
+
new (): {
|
|
44
|
+
$slots: S;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
49
|
+
new (): {
|
|
50
|
+
$slots: S;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
declare type __VLS_WithTemplateSlots_3<T, S> = T & {
|
|
55
|
+
new (): {
|
|
56
|
+
$slots: S;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare type __VLS_WithTemplateSlots_4<T, S> = T & {
|
|
61
|
+
new (): {
|
|
62
|
+
$slots: S;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
declare type BaseComponentProps<P> = Omit<P, 'modelValue' | 'value' | 'defaultValue' | 'onChange'>;
|
|
67
|
+
|
|
68
|
+
declare interface BaseFormSchema<T = Record<string, unknown>> {
|
|
69
|
+
name: Extract<keyof T, string>;
|
|
70
|
+
label?: string;
|
|
71
|
+
required?: boolean;
|
|
72
|
+
rules?: FormRule[];
|
|
73
|
+
hidden?: boolean | ((model: T) => boolean);
|
|
74
|
+
disabled?: boolean | ((model: T) => boolean);
|
|
75
|
+
help?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export declare interface CascaderFormSchema<T> extends BaseFormSchema<T> {
|
|
79
|
+
type: 'cascader';
|
|
80
|
+
props?: SchemaProps<T, BaseComponentProps<SmartCascaderProps>>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare interface CheckboxFormSchema<T> extends BaseFormSchema<T> {
|
|
84
|
+
type: 'checkbox';
|
|
85
|
+
props?: SchemaProps<T, BaseComponentProps<CheckboxGroupProps>>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare type ComponentMapType = Record<string, Component>;
|
|
89
|
+
|
|
90
|
+
export declare type ComponentType = 'input' | 'textarea' | 'password' | 'number' | 'select' | 'cascader' | 'tree-select' | 'date' | 'time' | 'switch' | 'radio' | 'checkbox' | 'stepper' | 'upload' | 'slot';
|
|
91
|
+
|
|
92
|
+
export declare interface DateFormSchema<T> extends BaseFormSchema<T> {
|
|
93
|
+
type: 'date' | 'time';
|
|
94
|
+
props?: SchemaProps<T, BaseComponentProps<SmartTimePickerProps>>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 文件项对象类型(对象数组模式下使用)
|
|
99
|
+
*/
|
|
100
|
+
export declare interface FileItem {
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 文件列表值类型:支持字符串、字符串数组或对象数组
|
|
106
|
+
*/
|
|
107
|
+
export declare type FileListValue = string | string[] | FileItem[];
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 值类型枚举
|
|
111
|
+
* - 'string': 逗号分隔的 URL 字符串
|
|
112
|
+
* - 'stringArray': URL 字符串数组
|
|
113
|
+
* - 'objectArray': 对象数组 [{id, filename, fileUrl}, ...]
|
|
114
|
+
*/
|
|
115
|
+
export declare type FileListValueType = 'string' | 'stringArray' | 'objectArray';
|
|
116
|
+
|
|
117
|
+
export declare type FormSchema<T = Record<string, unknown>> = InputFormSchema<T> | TextareaFormSchema<T> | SelectFormSchema<T> | CascaderFormSchema<T> | TreeSelectFormSchema<T> | DateFormSchema<T> | SwitchFormSchema<T> | RadioFormSchema<T> | CheckboxFormSchema<T> | StepperFormSchema<T> | UploadFormSchema<T> | SlotFormSchema<T>;
|
|
118
|
+
|
|
119
|
+
export declare interface InputFormSchema<T> extends BaseFormSchema<T> {
|
|
120
|
+
type?: 'input' | 'password' | 'number';
|
|
121
|
+
props?: SchemaProps<T, BaseComponentProps<InputProps>>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export declare interface RadioFormSchema<T> extends BaseFormSchema<T> {
|
|
125
|
+
type: 'radio';
|
|
126
|
+
props?: SchemaProps<T, BaseComponentProps<RadioGroupProps>>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare type SchemaProps<T, P> = P | ((model: T) => P);
|
|
130
|
+
|
|
131
|
+
export declare interface SelectFormSchema<T> extends BaseFormSchema<T> {
|
|
132
|
+
type: 'select';
|
|
133
|
+
props?: SchemaProps<T, BaseComponentProps<SmartSelectProps>>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export declare interface SlotFormSchema<T> extends BaseFormSchema<T> {
|
|
137
|
+
type: 'slot';
|
|
138
|
+
slot: string;
|
|
139
|
+
props?: SchemaProps<T, Record<string, unknown>>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare const SmartCascader: __VLS_WithTemplateSlots_2<DefineComponent<SmartCascaderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
143
|
+
change: (value: string | number, context: unknown) => any;
|
|
144
|
+
"update:modelValue": (value: string | number) => any;
|
|
145
|
+
close: (trigger: unknown) => any;
|
|
146
|
+
pick: (value: string | number, context: unknown) => any;
|
|
147
|
+
}, string, PublicProps, Readonly<SmartCascaderProps> & Readonly<{
|
|
148
|
+
onChange?: ((value: string | number, context: unknown) => any) | undefined;
|
|
149
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
150
|
+
onClose?: ((trigger: unknown) => any) | undefined;
|
|
151
|
+
onPick?: ((value: string | number, context: unknown) => any) | undefined;
|
|
152
|
+
}>, {
|
|
153
|
+
modelValue: string | number;
|
|
154
|
+
align: "left" | "center" | "right";
|
|
155
|
+
borderless: boolean;
|
|
156
|
+
clearable: boolean;
|
|
157
|
+
disabled: boolean;
|
|
158
|
+
placeholder: string;
|
|
159
|
+
readonly: boolean;
|
|
160
|
+
title: string | TNode;
|
|
161
|
+
rules: Array<{
|
|
162
|
+
validator: (val: unknown) => boolean;
|
|
163
|
+
message: string;
|
|
164
|
+
}>;
|
|
165
|
+
required: boolean;
|
|
166
|
+
checkStrictly: boolean;
|
|
167
|
+
options: TreeOptionData[];
|
|
168
|
+
theme: "step" | "tab";
|
|
169
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>, Partial<Record<number, (_: any) => any>>>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* SmartCascader 组件的 Props 定义
|
|
173
|
+
* 基于 TDesign Cascader 组件封装,使用 Input 作为触发器
|
|
174
|
+
*/
|
|
175
|
+
declare interface SmartCascaderProps extends Omit<InputProps, 'value' | 'modelValue' | 'onChange' | 'defaultValue'>, Omit<CascaderProps, 'value' | 'modelValue' | 'visible' | 'onChange' | 'onPick' | 'onClose'> {
|
|
176
|
+
/**
|
|
177
|
+
* 绑定值 (v-model)
|
|
178
|
+
*/
|
|
179
|
+
modelValue?: string | number;
|
|
180
|
+
/**
|
|
181
|
+
* 占位符
|
|
182
|
+
*/
|
|
183
|
+
placeholder?: string;
|
|
184
|
+
/**
|
|
185
|
+
* 表单验证规则
|
|
186
|
+
*/
|
|
187
|
+
rules?: Array<{
|
|
188
|
+
validator: (val: unknown) => boolean;
|
|
189
|
+
message: string;
|
|
190
|
+
}>;
|
|
191
|
+
/**
|
|
192
|
+
* 是否必填
|
|
193
|
+
*/
|
|
194
|
+
required?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* 输入框标签
|
|
197
|
+
*/
|
|
198
|
+
label?: InputProps['label'];
|
|
199
|
+
/**
|
|
200
|
+
* 显示文本 (用于异步加载 options 时的 fallback)
|
|
201
|
+
*/
|
|
202
|
+
displayLabel?: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export declare const SmartForm: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
206
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
207
|
+
readonly onSubmit?: ((value: Record<string, unknown>) => any) | undefined;
|
|
208
|
+
readonly "onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
209
|
+
readonly onReset?: (() => any) | undefined;
|
|
210
|
+
readonly "onValidate-failed"?: ((errors: unknown) => any) | undefined;
|
|
211
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onUpdate:modelValue" | "onReset" | "onSubmit" | "onValidate-failed"> & SmartFormProps<T> & Partial<{}>> & PublicProps;
|
|
212
|
+
expose(exposed: ShallowUnwrapRef< {
|
|
213
|
+
validate: () => Promise<unknown> | undefined;
|
|
214
|
+
reset: () => void | undefined;
|
|
215
|
+
clearValidate: () => void | undefined;
|
|
216
|
+
}>): void;
|
|
217
|
+
attrs: any;
|
|
218
|
+
slots: Partial<Record<string, (_: {
|
|
219
|
+
model: T;
|
|
220
|
+
schema: SlotFormSchema<T>;
|
|
221
|
+
}) => any>>;
|
|
222
|
+
emit: {
|
|
223
|
+
(e: "update:modelValue", value: Record<string, unknown>): void;
|
|
224
|
+
(e: "submit", value: Record<string, unknown>): void;
|
|
225
|
+
(e: "reset"): void;
|
|
226
|
+
(e: "validate-failed", errors: unknown): void;
|
|
227
|
+
};
|
|
228
|
+
}>) => VNode & {
|
|
229
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export declare interface SmartFormProps<T = Record<string, unknown>> {
|
|
233
|
+
modelValue: T;
|
|
234
|
+
schemas: FormSchema<T>[];
|
|
235
|
+
labelWidth?: string | number;
|
|
236
|
+
labelAlign?: 'left' | 'right' | 'top';
|
|
237
|
+
showFooter?: boolean;
|
|
238
|
+
submitBtnText?: string;
|
|
239
|
+
resetBtnText?: string;
|
|
240
|
+
loading?: boolean;
|
|
241
|
+
disabled?: boolean;
|
|
242
|
+
/** 自定义组件映射,用于扩展 schema.type 支持的组件类型 */
|
|
243
|
+
componentMap?: ComponentMapType;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export declare const SmartSelect: __VLS_WithTemplateSlots<DefineComponent<SmartSelectProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
247
|
+
change: (value: PickerValue[], context: unknown) => any;
|
|
248
|
+
confirm: (value: PickerValue[], context: unknown) => any;
|
|
249
|
+
"update:modelValue": (value: string | number | boolean) => any;
|
|
250
|
+
cancel: (context: unknown) => any;
|
|
251
|
+
}, string, PublicProps, Readonly<SmartSelectProps> & Readonly<{
|
|
252
|
+
onChange?: ((value: PickerValue[], context: unknown) => any) | undefined;
|
|
253
|
+
onConfirm?: ((value: PickerValue[], context: unknown) => any) | undefined;
|
|
254
|
+
"onUpdate:modelValue"?: ((value: string | number | boolean) => any) | undefined;
|
|
255
|
+
onCancel?: ((context: unknown) => any) | undefined;
|
|
256
|
+
}>, {
|
|
257
|
+
modelValue: string | number | boolean;
|
|
258
|
+
align: "left" | "center" | "right";
|
|
259
|
+
borderless: boolean;
|
|
260
|
+
clearable: boolean;
|
|
261
|
+
disabled: boolean;
|
|
262
|
+
placeholder: string;
|
|
263
|
+
readonly: boolean;
|
|
264
|
+
columns: PickerProps["columns"];
|
|
265
|
+
cancelBtn: boolean | string;
|
|
266
|
+
confirmBtn: boolean | string;
|
|
267
|
+
title: string;
|
|
268
|
+
placement: "top" | "left" | "right" | "bottom" | "center";
|
|
269
|
+
showOverlay: boolean;
|
|
270
|
+
rules: Array<{
|
|
271
|
+
validator: (val: unknown) => boolean;
|
|
272
|
+
message: string;
|
|
273
|
+
}>;
|
|
274
|
+
required: boolean;
|
|
275
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>, Partial<Record<number, (_: any) => any>>>;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* SmartSelect 组件的 Props 定义
|
|
279
|
+
* 继承了 Input, Picker, Popup 的所有属性
|
|
280
|
+
* 使用 Omit 排除冲突或由组件内部管理的属性
|
|
281
|
+
*/
|
|
282
|
+
declare interface SmartSelectProps extends Omit<InputProps, 'value' | 'modelValue' | 'onChange' | 'defaultValue'>, Omit<PickerProps, 'value' | 'modelValue' | 'columns' | 'onChange' | 'onConfirm' | 'onCancel' | 'defaultValue'>, Omit<PopupProps, 'visible' | 'onVisibleChange' | 'modelValue'> {
|
|
283
|
+
/**
|
|
284
|
+
* 绑定值
|
|
285
|
+
*/
|
|
286
|
+
modelValue?: string | number | boolean;
|
|
287
|
+
/**
|
|
288
|
+
* 选择器列配置
|
|
289
|
+
*/
|
|
290
|
+
columns?: PickerProps['columns'];
|
|
291
|
+
/**
|
|
292
|
+
* 表单验证规则
|
|
293
|
+
*/
|
|
294
|
+
rules?: Array<{
|
|
295
|
+
validator: (val: unknown) => boolean;
|
|
296
|
+
message: string;
|
|
297
|
+
}>;
|
|
298
|
+
/**
|
|
299
|
+
* 是否必填
|
|
300
|
+
*/
|
|
301
|
+
required?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* 弹窗标题
|
|
304
|
+
*/
|
|
305
|
+
title?: string;
|
|
306
|
+
/**
|
|
307
|
+
* 输入框标签
|
|
308
|
+
*/
|
|
309
|
+
label?: InputProps['label'];
|
|
310
|
+
/**
|
|
311
|
+
* 占位符
|
|
312
|
+
*/
|
|
313
|
+
placeholder?: string;
|
|
314
|
+
/**
|
|
315
|
+
* 显示文本 (用于异步加载 columns 时的 fallback)
|
|
316
|
+
* 当 columns 未加载完成但 modelValue 已有值时,显示此文本
|
|
317
|
+
*/
|
|
318
|
+
displayLabel?: string;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export declare const SmartTimePicker: __VLS_WithTemplateSlots_4<DefineComponent<SmartTimePickerProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
322
|
+
change: (value: string | number) => any;
|
|
323
|
+
confirm: (value: string | number) => any;
|
|
324
|
+
"update:modelValue": (value: string | number) => any;
|
|
325
|
+
cancel: (context: {
|
|
326
|
+
e: MouseEvent;
|
|
327
|
+
}) => any;
|
|
328
|
+
pick: (value: string | number) => any;
|
|
329
|
+
}, string, PublicProps, Readonly<SmartTimePickerProps> & Readonly<{
|
|
330
|
+
onChange?: ((value: string | number) => any) | undefined;
|
|
331
|
+
onConfirm?: ((value: string | number) => any) | undefined;
|
|
332
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
333
|
+
onCancel?: ((context: {
|
|
334
|
+
e: MouseEvent;
|
|
335
|
+
}) => any) | undefined;
|
|
336
|
+
onPick?: ((value: string | number) => any) | undefined;
|
|
337
|
+
}>, {
|
|
338
|
+
modelValue: string | number;
|
|
339
|
+
align: "left" | "center" | "right";
|
|
340
|
+
autofocus: boolean;
|
|
341
|
+
borderless: boolean;
|
|
342
|
+
clearTrigger: "always" | "focus";
|
|
343
|
+
clearable: boolean;
|
|
344
|
+
cursorColor: string;
|
|
345
|
+
disabled: boolean;
|
|
346
|
+
format: string;
|
|
347
|
+
layout: "vertical" | "horizontal";
|
|
348
|
+
name: string;
|
|
349
|
+
placeholder: string;
|
|
350
|
+
readonly: boolean;
|
|
351
|
+
status: "default" | "success" | "warning" | "error";
|
|
352
|
+
type: "text" | "number" | "url" | "tel" | "password" | "search" | "submit" | "hidden";
|
|
353
|
+
cancelBtn: string;
|
|
354
|
+
confirmBtn: string;
|
|
355
|
+
title: string;
|
|
356
|
+
attach: AttachNode;
|
|
357
|
+
closeOnOverlayClick: boolean;
|
|
358
|
+
duration: number;
|
|
359
|
+
overlayProps: OverlayProps;
|
|
360
|
+
placement: "top" | "left" | "right" | "bottom" | "center";
|
|
361
|
+
preventScrollThrough: boolean;
|
|
362
|
+
showOverlay: boolean;
|
|
363
|
+
transitionName: string;
|
|
364
|
+
rules: Array<{
|
|
365
|
+
validator: (val: unknown) => boolean;
|
|
366
|
+
message: string;
|
|
367
|
+
}>;
|
|
368
|
+
required: boolean;
|
|
369
|
+
mode: DateTimePickerMode;
|
|
370
|
+
showWeek: boolean;
|
|
371
|
+
steps: { [key in TimeModeValues]?: number; };
|
|
372
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>, Partial<Record<number, (_: any) => any>>>;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* SmartTimePicker 组件的 Props 定义
|
|
376
|
+
* 继承了 Input, DateTimePicker, Popup 的所有属性
|
|
377
|
+
*/
|
|
378
|
+
declare interface SmartTimePickerProps extends Omit<InputProps, 'value' | 'modelValue' | 'onChange' | 'defaultValue' | 'format'>, Omit<DateTimePickerProps, 'value' | 'modelValue' | 'onChange' | 'onConfirm' | 'onCancel' | 'defaultValue' | 'mode'>, Omit<PopupProps, 'visible' | 'onVisibleChange' | 'modelValue'> {
|
|
379
|
+
/**
|
|
380
|
+
* 绑定值
|
|
381
|
+
*/
|
|
382
|
+
modelValue?: string | number;
|
|
383
|
+
/**
|
|
384
|
+
* 表单验证规则
|
|
385
|
+
*/
|
|
386
|
+
rules?: Array<{
|
|
387
|
+
validator: (val: unknown) => boolean;
|
|
388
|
+
message: string;
|
|
389
|
+
}>;
|
|
390
|
+
/**
|
|
391
|
+
* 是否必填
|
|
392
|
+
*/
|
|
393
|
+
required?: boolean;
|
|
394
|
+
/**
|
|
395
|
+
* 输入框标签
|
|
396
|
+
*/
|
|
397
|
+
label?: InputProps['label'];
|
|
398
|
+
/**
|
|
399
|
+
* 占位符
|
|
400
|
+
*/
|
|
401
|
+
placeholder?: string;
|
|
402
|
+
/**
|
|
403
|
+
* 选择模式
|
|
404
|
+
* year | month | date | hour | minute | second 及其组合
|
|
405
|
+
*/
|
|
406
|
+
mode?: DateTimePickerMode;
|
|
407
|
+
/**
|
|
408
|
+
* 输入框内容格式化函数
|
|
409
|
+
* 对应 Input 组件的 format 属性 (因与 DateTimePicker format 属性冲突而重命名)
|
|
410
|
+
*/
|
|
411
|
+
inputFormat?: InputProps['format'];
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export declare const SmartTreeSelect: __VLS_WithTemplateSlots_3<DefineComponent<SmartTreeSelectProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
415
|
+
change: (value: TreeSelectValue, level: TreeLevel) => any;
|
|
416
|
+
"update:modelValue": (value: TreeSelectValue) => any;
|
|
417
|
+
close: (trigger: unknown) => any;
|
|
418
|
+
}, string, PublicProps, Readonly<SmartTreeSelectProps> & Readonly<{
|
|
419
|
+
onChange?: ((value: TreeSelectValue, level: TreeLevel) => any) | undefined;
|
|
420
|
+
"onUpdate:modelValue"?: ((value: TreeSelectValue) => any) | undefined;
|
|
421
|
+
onClose?: ((trigger: unknown) => any) | undefined;
|
|
422
|
+
}>, {
|
|
423
|
+
align: "left" | "center" | "right";
|
|
424
|
+
autofocus: boolean;
|
|
425
|
+
borderless: boolean;
|
|
426
|
+
clearTrigger: "always" | "focus";
|
|
427
|
+
clearable: boolean;
|
|
428
|
+
cursorColor: string;
|
|
429
|
+
disabled: boolean;
|
|
430
|
+
layout: "vertical" | "horizontal";
|
|
431
|
+
name: string;
|
|
432
|
+
placeholder: string;
|
|
433
|
+
readonly: boolean;
|
|
434
|
+
status: "default" | "success" | "warning" | "error";
|
|
435
|
+
type: "text" | "number" | "url" | "tel" | "password" | "search" | "submit" | "hidden";
|
|
436
|
+
title: string;
|
|
437
|
+
attach: AttachNode;
|
|
438
|
+
closeOnOverlayClick: boolean;
|
|
439
|
+
duration: number;
|
|
440
|
+
overlayProps: OverlayProps;
|
|
441
|
+
placement: "top" | "left" | "right" | "bottom" | "center";
|
|
442
|
+
preventScrollThrough: boolean;
|
|
443
|
+
showOverlay: boolean;
|
|
444
|
+
transitionName: string;
|
|
445
|
+
rules: Array<{
|
|
446
|
+
validator: (val: unknown) => boolean;
|
|
447
|
+
message: string;
|
|
448
|
+
}>;
|
|
449
|
+
required: boolean;
|
|
450
|
+
options: _TreeOptionData<string | number>[];
|
|
451
|
+
customStyle: string;
|
|
452
|
+
filterable: boolean;
|
|
453
|
+
height: string | number;
|
|
454
|
+
multiple: boolean;
|
|
455
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>, Partial<Record<number, (_: any) => any>>>;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* SmartTreeSelect 组件的 Props 定义
|
|
459
|
+
*/
|
|
460
|
+
declare interface SmartTreeSelectProps extends Omit<InputProps, 'value' | 'modelValue' | 'onChange' | 'defaultValue'>, Omit<TreeSelectProps, 'value' | 'modelValue' | 'onChange' | 'defaultValue'>, Omit<PopupProps, 'visible' | 'onVisibleChange' | 'modelValue' | 'defaultVisible'> {
|
|
461
|
+
/**
|
|
462
|
+
* 绑定值
|
|
463
|
+
*/
|
|
464
|
+
modelValue?: TreeSelectProps['value'];
|
|
465
|
+
/**
|
|
466
|
+
* 选项数据
|
|
467
|
+
*/
|
|
468
|
+
options?: TreeSelectProps['options'];
|
|
469
|
+
/**
|
|
470
|
+
* 表单验证规则
|
|
471
|
+
*/
|
|
472
|
+
rules?: Array<{
|
|
473
|
+
validator: (val: unknown) => boolean;
|
|
474
|
+
message: string;
|
|
475
|
+
}>;
|
|
476
|
+
/**
|
|
477
|
+
* 是否必填
|
|
478
|
+
*/
|
|
479
|
+
required?: boolean;
|
|
480
|
+
/**
|
|
481
|
+
* 弹窗标题
|
|
482
|
+
*/
|
|
483
|
+
title?: string;
|
|
484
|
+
/**
|
|
485
|
+
* 输入框标签
|
|
486
|
+
*/
|
|
487
|
+
label?: InputProps['label'];
|
|
488
|
+
/**
|
|
489
|
+
* 占位符
|
|
490
|
+
*/
|
|
491
|
+
placeholder?: string;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export declare const SmartUpload: DefineComponent<SmartUploadProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
495
|
+
success: (context: SuccessContext) => any;
|
|
496
|
+
"update:modelValue": (value: FileListValue) => any;
|
|
497
|
+
fail: (context: UploadFailContext) => any;
|
|
498
|
+
remove: (file: SmartUploadFile, index: number) => any;
|
|
499
|
+
}, string, PublicProps, Readonly<SmartUploadProps> & Readonly<{
|
|
500
|
+
onSuccess?: ((context: SuccessContext) => any) | undefined;
|
|
501
|
+
"onUpdate:modelValue"?: ((value: FileListValue) => any) | undefined;
|
|
502
|
+
onFail?: ((context: UploadFailContext) => any) | undefined;
|
|
503
|
+
onRemove?: ((file: SmartUploadFile, index: number) => any) | undefined;
|
|
504
|
+
}>, {
|
|
505
|
+
modelValue: FileListValue;
|
|
506
|
+
disabled: boolean;
|
|
507
|
+
mode: "image" | "file";
|
|
508
|
+
multiple: boolean;
|
|
509
|
+
separator: string;
|
|
510
|
+
urlPrefix: string;
|
|
511
|
+
urlKey: string;
|
|
512
|
+
nameKey: string;
|
|
513
|
+
accept: string | string[];
|
|
514
|
+
max: number;
|
|
515
|
+
maxSize: number;
|
|
516
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* 扩展的上传文件类型,添加自定义字段
|
|
520
|
+
*/
|
|
521
|
+
export declare interface SmartUploadFile extends UploadFile {
|
|
522
|
+
/**
|
|
523
|
+
* 原始路径(不含 urlPrefix 前缀)
|
|
524
|
+
* 用于存储服务器返回的纯路径
|
|
525
|
+
*/
|
|
526
|
+
originalPath?: string;
|
|
527
|
+
/**
|
|
528
|
+
* 原始响应对象(对象数组模式下保存完整返回)
|
|
529
|
+
*/
|
|
530
|
+
__rawResult__?: Record<string, unknown>;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* SmartUpload 组件的 Props 定义
|
|
535
|
+
*/
|
|
536
|
+
export declare interface SmartUploadProps {
|
|
537
|
+
/**
|
|
538
|
+
* 绑定值,支持多种格式
|
|
539
|
+
* - string: 逗号分隔的 URL 字符串,如 'a.jpg,b.jpg'
|
|
540
|
+
* - string[]: URL 字符串数组,如 ['a.jpg', 'b.jpg']
|
|
541
|
+
* - object[]: 对象数组,如 [{id: 1, fileUrl: 'a.jpg'}]
|
|
542
|
+
*/
|
|
543
|
+
modelValue?: FileListValue;
|
|
544
|
+
/**
|
|
545
|
+
* 显式指定值类型
|
|
546
|
+
* - 不传:自动根据初始值推断
|
|
547
|
+
* - 'string': 逗号分隔的字符串
|
|
548
|
+
* - 'stringArray': 字符串数组
|
|
549
|
+
* - 'objectArray': 对象数组
|
|
550
|
+
*/
|
|
551
|
+
valueType?: FileListValueType;
|
|
552
|
+
/**
|
|
553
|
+
* URL 分隔符,当 valueType 为 'string' 时使用
|
|
554
|
+
* @default ','
|
|
555
|
+
*/
|
|
556
|
+
separator?: string;
|
|
557
|
+
/**
|
|
558
|
+
* URL 前缀,用于显示和预览
|
|
559
|
+
* 输出时不包含此前缀
|
|
560
|
+
* @example 'https://cdn.example.com/'
|
|
561
|
+
*/
|
|
562
|
+
urlPrefix?: string;
|
|
563
|
+
/**
|
|
564
|
+
* 对象数组模式下,url 字段的键名
|
|
565
|
+
* @default 'fileUrl'
|
|
566
|
+
*/
|
|
567
|
+
urlKey?: string;
|
|
568
|
+
/**
|
|
569
|
+
* 对象数组模式下,name 字段的键名
|
|
570
|
+
* @default 'filename'
|
|
571
|
+
*/
|
|
572
|
+
nameKey?: string;
|
|
573
|
+
/**
|
|
574
|
+
* 上传模式
|
|
575
|
+
* - image: 图片上传,显示缩略图网格,支持预览
|
|
576
|
+
* - file: 文件上传,显示文件名列表
|
|
577
|
+
* @default 'image'
|
|
578
|
+
*/
|
|
579
|
+
mode?: 'image' | 'file';
|
|
580
|
+
/**
|
|
581
|
+
* 接受的文件类型
|
|
582
|
+
* 可以是字符串或字符串数组
|
|
583
|
+
* @example 'image/*' 或 ['image/jpeg', 'image/png'] 或 ['.pdf', '.doc']
|
|
584
|
+
*/
|
|
585
|
+
accept?: string | string[];
|
|
586
|
+
/**
|
|
587
|
+
* 上传地址
|
|
588
|
+
*/
|
|
589
|
+
action?: string;
|
|
590
|
+
/**
|
|
591
|
+
* 最大上传数量
|
|
592
|
+
* @default 9
|
|
593
|
+
*/
|
|
594
|
+
max?: number;
|
|
595
|
+
/**
|
|
596
|
+
* 最大文件大小,单位 KB
|
|
597
|
+
* @default 10240 (10MB)
|
|
598
|
+
*/
|
|
599
|
+
maxSize?: number;
|
|
600
|
+
/**
|
|
601
|
+
* 是否支持多选
|
|
602
|
+
* @default true
|
|
603
|
+
*/
|
|
604
|
+
multiple?: boolean;
|
|
605
|
+
/**
|
|
606
|
+
* 是否禁用
|
|
607
|
+
* @default false
|
|
608
|
+
*/
|
|
609
|
+
disabled?: boolean;
|
|
610
|
+
/**
|
|
611
|
+
* 自定义上传方法
|
|
612
|
+
* 返回 string 或包含 url、name 等字段的对象
|
|
613
|
+
*/
|
|
614
|
+
requestMethod?: (files: UploadFile | UploadFile[]) => Promise<RequestMethodResponse>;
|
|
615
|
+
/**
|
|
616
|
+
* 自定义格式化响应,提取上传后的数据
|
|
617
|
+
*
|
|
618
|
+
* @param response 服务器响应
|
|
619
|
+
* @returns
|
|
620
|
+
* - string: 返回文件 URL
|
|
621
|
+
* - object: 返回完整对象(对象数组模式下会保留所有字段)
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* // 返回 URL 字符串
|
|
625
|
+
* formatResponse: (res) => res.data.url
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* // 返回完整对象(对象数组模式)
|
|
629
|
+
* formatResponse: (res) => ({ id: res.data.id, fileUrl: res.data.url, filename: res.data.name })
|
|
630
|
+
*/
|
|
631
|
+
formatResponse?: (response: unknown) => string | Record<string, unknown>;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export declare interface StepperFormSchema<T> extends BaseFormSchema<T> {
|
|
635
|
+
type: 'stepper';
|
|
636
|
+
props?: SchemaProps<T, BaseComponentProps<StepperProps>>;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export declare interface SwitchFormSchema<T> extends BaseFormSchema<T> {
|
|
640
|
+
type: 'switch';
|
|
641
|
+
props?: SchemaProps<T, BaseComponentProps<SwitchProps>>;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export declare interface TextareaFormSchema<T> extends BaseFormSchema<T> {
|
|
645
|
+
type: 'textarea';
|
|
646
|
+
props?: SchemaProps<T, BaseComponentProps<TextareaProps>>;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export declare interface TreeSelectFormSchema<T> extends BaseFormSchema<T> {
|
|
650
|
+
type: 'tree-select';
|
|
651
|
+
props?: SchemaProps<T, BaseComponentProps<SmartTreeSelectProps>>;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export declare interface UploadFormSchema<T> extends BaseFormSchema<T> {
|
|
655
|
+
type: 'upload';
|
|
656
|
+
props?: SchemaProps<T, BaseComponentProps<SmartUploadProps>>;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export { }
|