@qin-ui/element-plus-pro 1.0.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 +77 -0
- package/es/component-provider/index.js +220 -0
- package/es/core/index-VQxpXgLX.js +362 -0
- package/es/element-plus-pro.css +66 -0
- package/es/form/index-BvqMIOZ8.js +470 -0
- package/es/form/index.js +20 -0
- package/es/index.d.ts +924 -0
- package/es/index.js +51 -0
- package/es/table/index.js +880 -0
- package/es/vendor/utils/lodash-es-p6jau26B.js +1120 -0
- package/package.json +49 -0
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,924 @@
|
|
|
1
|
+
import { AllowedComponentProps } from 'vue';
|
|
2
|
+
import { App } from 'vue';
|
|
3
|
+
import { ColProps } from 'element-plus';
|
|
4
|
+
import { Component } from 'vue';
|
|
5
|
+
import { ComponentCustomProps } from 'vue';
|
|
6
|
+
import { ComponentExposed } from 'vue-component-type-helpers';
|
|
7
|
+
import { ComponentOptionsBase } from 'vue';
|
|
8
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
9
|
+
import { ComponentProps } from 'vue-component-type-helpers';
|
|
10
|
+
import { ComponentProvideOptions } from 'vue';
|
|
11
|
+
import { ComponentPublicInstance } from 'vue';
|
|
12
|
+
import { ComponentSize } from 'element-plus';
|
|
13
|
+
import { ComponentSlots } from 'vue-component-type-helpers';
|
|
14
|
+
import { ComputedRef } from 'vue';
|
|
15
|
+
import { CreateComponentPublicInstanceWithMixins } from 'vue';
|
|
16
|
+
import { CSSProperties } from 'vue';
|
|
17
|
+
import { DefineComponent } from 'vue';
|
|
18
|
+
import { ElAutocomplete } from 'element-plus';
|
|
19
|
+
import { ElCascader } from 'element-plus';
|
|
20
|
+
import { ElCheckboxGroup } from 'element-plus';
|
|
21
|
+
import { ElDatePicker } from 'element-plus';
|
|
22
|
+
import { ElFormItem } from 'element-plus';
|
|
23
|
+
import { ElInput } from 'element-plus';
|
|
24
|
+
import { ElInputNumber } from 'element-plus';
|
|
25
|
+
import { ElRadioGroup } from 'element-plus';
|
|
26
|
+
import { ElSelect } from 'element-plus';
|
|
27
|
+
import { ElSlider } from 'element-plus';
|
|
28
|
+
import { ElSwitch } from 'element-plus';
|
|
29
|
+
import { ElTimePicker } from 'element-plus';
|
|
30
|
+
import { ElTimeSelect } from 'element-plus';
|
|
31
|
+
import { ElTransfer } from 'element-plus';
|
|
32
|
+
import { ElTreeSelect } from 'element-plus';
|
|
33
|
+
import { FormInstance } from 'element-plus';
|
|
34
|
+
import { FormItemInstance } from 'element-plus';
|
|
35
|
+
import { FormItemProps } from 'element-plus';
|
|
36
|
+
import { FormProps } from 'element-plus';
|
|
37
|
+
import { FormRules } from 'element-plus';
|
|
38
|
+
import { GlobalComponents } from 'vue';
|
|
39
|
+
import { GlobalDirectives } from 'vue';
|
|
40
|
+
import { InjectionKey } from 'vue';
|
|
41
|
+
import { MaybeRef } from 'vue';
|
|
42
|
+
import { PaginationProps } from 'element-plus';
|
|
43
|
+
import { Plugin as Plugin_2 } from 'vue';
|
|
44
|
+
import { PublicProps } from 'vue';
|
|
45
|
+
import { Raw } from 'vue';
|
|
46
|
+
import { Reactive } from 'vue';
|
|
47
|
+
import { Ref } from 'vue';
|
|
48
|
+
import { RowProps } from 'element-plus';
|
|
49
|
+
import { ShallowUnwrapRef } from 'vue';
|
|
50
|
+
import { Slot } from 'vue';
|
|
51
|
+
import { TableColumnCtx } from 'element-plus';
|
|
52
|
+
import { TableProps as TableProps_2 } from 'element-plus';
|
|
53
|
+
import { VNode } from 'vue';
|
|
54
|
+
import { VNodeProps } from 'vue';
|
|
55
|
+
|
|
56
|
+
declare const __VLS_component: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
57
|
+
|
|
58
|
+
declare type __VLS_PrettifyLocal<T> = {
|
|
59
|
+
[K in keyof T]: T[K];
|
|
60
|
+
} & {};
|
|
61
|
+
|
|
62
|
+
declare type __VLS_PrettifyLocal_2<T> = {
|
|
63
|
+
[K in keyof T]: T[K];
|
|
64
|
+
} & {};
|
|
65
|
+
|
|
66
|
+
declare function __VLS_template(): {
|
|
67
|
+
attrs: Partial<{}>;
|
|
68
|
+
slots: {
|
|
69
|
+
default?(_: {}): any;
|
|
70
|
+
default?(_: {}): any;
|
|
71
|
+
};
|
|
72
|
+
refs: {};
|
|
73
|
+
rootEl: any;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
77
|
+
|
|
78
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
79
|
+
new (): {
|
|
80
|
+
$slots: S;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
declare type AdditionalMethods<FormItemInstance> = {
|
|
85
|
+
/**
|
|
86
|
+
* @description 获取FormItem实例的方法
|
|
87
|
+
*/
|
|
88
|
+
getFormItemRef?: () => FormItemInstance;
|
|
89
|
+
/**
|
|
90
|
+
* @description 获取传入FormItem组件的属性
|
|
91
|
+
*/
|
|
92
|
+
getFormItemComputedProps?: () => Readonly<{
|
|
93
|
+
[x: string]: any;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* @description 获取组件实例的方法
|
|
97
|
+
*/
|
|
98
|
+
getComponentRef?: () => any;
|
|
99
|
+
/**
|
|
100
|
+
* @description 获取传入Component组件的属性
|
|
101
|
+
*/
|
|
102
|
+
getComponentComputedProps?: () => Readonly<{
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
[x: string]: any;
|
|
105
|
+
}>;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare type AllowStringKey<T, Prefix extends string = ''> = {
|
|
109
|
+
[K in keyof T]: K extends string ? T[K] extends (infer U)[] ? `${Prefix}${K}` | (IsRecord<U> extends true ? AllowStringKey<U, `${Prefix}${K}[index].`> : never) : IsRecord<T[K]> extends true ? `${Prefix}${K}` | AllowStringKey<T[K], `${Prefix}${K}.`> : `${Prefix}${K}` : never;
|
|
110
|
+
}[keyof T];
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @type {Object} Base - 基础公共字段类型
|
|
114
|
+
*/
|
|
115
|
+
export declare type Base<D extends Data = Data> = BaseWithFields<D> | BaseWithoutFields<D>;
|
|
116
|
+
|
|
117
|
+
declare interface BaseColumn<D extends Data = Data> {
|
|
118
|
+
key?: Path<D>;
|
|
119
|
+
dataIndex?: Path<D> | Path<D>[];
|
|
120
|
+
children?: BaseColumn<D>[];
|
|
121
|
+
[key: string]: any;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare type BaseCommon<D extends Data = Data> = {
|
|
125
|
+
/**
|
|
126
|
+
* @description 字段标识namePath, 同prop
|
|
127
|
+
* @example 'name' | 'age' | 'sex' | ...
|
|
128
|
+
*/
|
|
129
|
+
path?: Path<D>;
|
|
130
|
+
/**
|
|
131
|
+
* @description 字段是否隐藏
|
|
132
|
+
*/
|
|
133
|
+
hidden?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* @description 字段是否禁用
|
|
136
|
+
*/
|
|
137
|
+
disabled?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* @description 字段中文名称,支持字符串或组件
|
|
140
|
+
* @example '姓名' | '年龄' | '性别' | () => h('span', '自定义标签')
|
|
141
|
+
*/
|
|
142
|
+
label?: SlotComponentType;
|
|
143
|
+
/**
|
|
144
|
+
* @description 字段插槽配置,可包含formItem插槽和component插槽
|
|
145
|
+
* @example
|
|
146
|
+
* ```js
|
|
147
|
+
* slots: {
|
|
148
|
+
* label: () => h('div', { style: { fontSize: '12px' } }, '年龄'),
|
|
149
|
+
* addonAfter: '岁',
|
|
150
|
+
* suffix: () => h('span', '元')
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
slots?: Partial<ComponentSlots<typeof ElFormItem>>;
|
|
155
|
+
/**
|
|
156
|
+
* @description 字段formItem样式属性
|
|
157
|
+
* @example { marginBottom: '8px', padding: '12px' }
|
|
158
|
+
*/
|
|
159
|
+
formItemStyle?: CSSProperties;
|
|
160
|
+
/**
|
|
161
|
+
* @description 字段formItem样式类名
|
|
162
|
+
* @example 'custom-form-item' | 'required-field'
|
|
163
|
+
*/
|
|
164
|
+
formItemClass?: string;
|
|
165
|
+
/**
|
|
166
|
+
* @description 字段formItem容器包裹组件
|
|
167
|
+
* @example (props, ctx) => h('div', { class: 'custom-container' }, ctx.slots.default?.())
|
|
168
|
+
*/
|
|
169
|
+
formItemContainer?: ContainerComponent;
|
|
170
|
+
/**
|
|
171
|
+
* @description 将属性附加到 FormItem 的 DOM 节点
|
|
172
|
+
* @example { 'data-form-item-test': 'test-value', 'aria-label': 'name' }
|
|
173
|
+
*/
|
|
174
|
+
formItemDataAttrs?: Record<string, string>;
|
|
175
|
+
/**
|
|
176
|
+
* @description 额外的自定义属性,不会被当作组件参数,仅用做给字段添加标识属性等功能
|
|
177
|
+
* @example { group: 'group-1' }
|
|
178
|
+
*/
|
|
179
|
+
extraProps?: Record<string, any>;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export declare type BaseComponentMap = {
|
|
183
|
+
'input': typeof ElInput;
|
|
184
|
+
'input-number': typeof ElInputNumber;
|
|
185
|
+
'autocomplete': typeof ElAutocomplete;
|
|
186
|
+
'select': typeof ElSelect;
|
|
187
|
+
'cascader': typeof ElCascader;
|
|
188
|
+
'date-picker': typeof ElDatePicker;
|
|
189
|
+
'time-picker': typeof ElTimePicker;
|
|
190
|
+
'time-select': typeof ElTimeSelect;
|
|
191
|
+
'checkbox-group': typeof ElCheckboxGroup;
|
|
192
|
+
'radio-group': typeof ElRadioGroup;
|
|
193
|
+
'switch': typeof ElSwitch;
|
|
194
|
+
'slider': typeof ElSlider;
|
|
195
|
+
'tree-select': typeof ElTreeSelect;
|
|
196
|
+
'transfer': typeof ElTransfer;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export declare const BaseField: DefineComponent<Props, {
|
|
200
|
+
getComponentRef: () => any;
|
|
201
|
+
getComponentComputedProps: () => any;
|
|
202
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
203
|
+
componentRef: unknown;
|
|
204
|
+
}, any>;
|
|
205
|
+
|
|
206
|
+
declare interface BaseField_2<D extends Data = Data> {
|
|
207
|
+
path?: Path<D> | any;
|
|
208
|
+
name?: any;
|
|
209
|
+
fields?: any[];
|
|
210
|
+
[key: string]: any;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export declare const BaseForm: <F extends Form<any> = Form>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal_2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
214
|
+
props: __VLS_PrettifyLocal_2<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & ({
|
|
215
|
+
grid?: Grid;
|
|
216
|
+
form?: F;
|
|
217
|
+
} & Partial<Omit<FormProps, "model">>) & Partial<{}>> & PublicProps;
|
|
218
|
+
expose(exposed: ShallowUnwrapRef< {}>): void;
|
|
219
|
+
attrs: any;
|
|
220
|
+
slots: Readonly<Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
|
|
221
|
+
path?: string;
|
|
222
|
+
} & Data & {
|
|
223
|
+
[x: string]: any;
|
|
224
|
+
disabled?: boolean;
|
|
225
|
+
}>> & {
|
|
226
|
+
default: Slot;
|
|
227
|
+
}>> & Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
|
|
228
|
+
path?: string;
|
|
229
|
+
} & Data & {
|
|
230
|
+
[x: string]: any;
|
|
231
|
+
disabled?: boolean;
|
|
232
|
+
}>> & {
|
|
233
|
+
default: Slot;
|
|
234
|
+
}>;
|
|
235
|
+
emit: {};
|
|
236
|
+
}>) => VNode & {
|
|
237
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export declare const BaseFormItem: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
241
|
+
|
|
242
|
+
declare type BaseWithFields<D extends Data = Data> = BaseCommon<D> & {
|
|
243
|
+
/**
|
|
244
|
+
* @description 嵌套子字段配置
|
|
245
|
+
* @example [{ key: 'firstName', label: '名' }, { key: 'lastName', label: '姓' }]
|
|
246
|
+
*/
|
|
247
|
+
fields: Fields<D>;
|
|
248
|
+
/**
|
|
249
|
+
* @description 网格布局属性,true表示使用默认网格布局,针对具有嵌套字段的字段
|
|
250
|
+
* @example boolean | { gutter: 24 }
|
|
251
|
+
*/
|
|
252
|
+
grid?: Grid;
|
|
253
|
+
component?: never;
|
|
254
|
+
/**
|
|
255
|
+
* @description 字段component样式属性
|
|
256
|
+
* @example { width: '100%', borderColor: '#d9d9d9' }
|
|
257
|
+
*/
|
|
258
|
+
componentStyle?: never;
|
|
259
|
+
/**
|
|
260
|
+
* @description 字段component样式类名
|
|
261
|
+
* @example 'custom-input' | 'error-input'
|
|
262
|
+
*/
|
|
263
|
+
componentClass?: never;
|
|
264
|
+
/**
|
|
265
|
+
* @description 字段component容器包裹组件
|
|
266
|
+
* @example (props, ctx) => h('div', { class: 'input-wrapper' }, ctx.slots.default?.())
|
|
267
|
+
*/
|
|
268
|
+
componentContainer?: never;
|
|
269
|
+
/**
|
|
270
|
+
* @description 将属性附加到表单组件的 DOM 节点
|
|
271
|
+
* @example { 'data-test': 'input-value', 'aria-label': 'name' }
|
|
272
|
+
*/
|
|
273
|
+
componentDataAttrs?: never;
|
|
274
|
+
/**
|
|
275
|
+
* @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
|
|
276
|
+
* @example (val) => val?.trim()
|
|
277
|
+
*/
|
|
278
|
+
valueFormatter?: never;
|
|
279
|
+
/**
|
|
280
|
+
* @description 组件v-model双向绑定更新属性名,默认'modelValue'
|
|
281
|
+
*/
|
|
282
|
+
modelProp?: never;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
declare type BaseWithoutFields<D extends Data = Data> = BaseCommon<D> & {
|
|
286
|
+
fields?: undefined;
|
|
287
|
+
grid?: never;
|
|
288
|
+
/**
|
|
289
|
+
* @description 字段component样式属性
|
|
290
|
+
* @example { width: '100%', borderColor: '#d9d9d9' }
|
|
291
|
+
*/
|
|
292
|
+
componentStyle?: CSSProperties;
|
|
293
|
+
/**
|
|
294
|
+
* @description 字段component样式类名
|
|
295
|
+
* @example 'custom-input' | 'error-input'
|
|
296
|
+
*/
|
|
297
|
+
componentClass?: string;
|
|
298
|
+
/**
|
|
299
|
+
* @description 字段component容器包裹组件
|
|
300
|
+
* @example (props, ctx) => h('div', { class: 'input-wrapper' }, ctx.slots.default?.())
|
|
301
|
+
*/
|
|
302
|
+
componentContainer?: ContainerComponent;
|
|
303
|
+
/**
|
|
304
|
+
* @description 将属性附加到表单组件的 DOM 节点
|
|
305
|
+
* @example { 'data-test': 'input-value', 'aria-label': 'name' }
|
|
306
|
+
*/
|
|
307
|
+
componentDataAttrs?: Record<string, string>;
|
|
308
|
+
/**
|
|
309
|
+
* @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
|
|
310
|
+
* @example (val) => val?.trim()
|
|
311
|
+
*/
|
|
312
|
+
valueFormatter?: ValueFormatter;
|
|
313
|
+
/**
|
|
314
|
+
* @description 组件v-model双向绑定更新属性名,默认'modelValue'
|
|
315
|
+
*/
|
|
316
|
+
modelProp?: string;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
declare type ButtonProps = {
|
|
320
|
+
onClick: () => void;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export declare type Column<D extends Data = Data> = Partial<Omit<TableColumnCtx<ExtendWithAny<D>>, 'prop' | 'property' | 'children'>> & {
|
|
324
|
+
key?: Path<D>;
|
|
325
|
+
prop?: KeyExpandString<Extract<keyof D, string>> | Paths<D>;
|
|
326
|
+
hidden?: boolean;
|
|
327
|
+
children?: Columns<D>;
|
|
328
|
+
render?: (scope: ColumnScope<D>) => any;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
declare type ColumnFindBy<D extends Data, C extends BaseColumn<D> = BaseColumn<D>> = (column: Readonly<C>) => boolean;
|
|
332
|
+
|
|
333
|
+
export declare type Columns<D extends Data = Data> = Array<Column<D>>;
|
|
334
|
+
|
|
335
|
+
declare type Columns_2<D extends Data = Data, C extends BaseColumn<D> = BaseColumn<D>> = Array<C>;
|
|
336
|
+
|
|
337
|
+
export declare type ColumnScope<D extends Data = Data> = {
|
|
338
|
+
row: ExtendWithAny<D>;
|
|
339
|
+
column: Column<D>;
|
|
340
|
+
$index: number;
|
|
341
|
+
cellValue: any;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @description 暴露给外部扩充自定义组件类型的接口
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* declare module '@qin-ui/element-plus-pro' {
|
|
349
|
+
* interface ComponentMap {
|
|
350
|
+
* 'my-custom-input': typeof MyCustomInput;
|
|
351
|
+
* }
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
export declare interface ComponentMap {
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export declare const componentMap: BaseComponentMap;
|
|
359
|
+
|
|
360
|
+
export declare type ComponentName = keyof BaseComponentMap | keyof ComponentMap | 'custom';
|
|
361
|
+
|
|
362
|
+
export declare type ComponentVars = Partial<RequiredComponentVars>;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @description 容器组件类型
|
|
366
|
+
*/
|
|
367
|
+
export declare type ContainerComponent = Component<PathProps>;
|
|
368
|
+
|
|
369
|
+
export declare const ContainerFragment: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
370
|
+
|
|
371
|
+
declare type Control = {
|
|
372
|
+
sizeControl: boolean;
|
|
373
|
+
columnControl: boolean;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
declare type Data = Record<string, any>;
|
|
377
|
+
|
|
378
|
+
declare type DatePickerType = NonNullable<ComponentProps<typeof ElDatePicker>['type']>;
|
|
379
|
+
|
|
380
|
+
declare type DeepPartial<T> = T extends object ? {
|
|
381
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
382
|
+
} : T;
|
|
383
|
+
|
|
384
|
+
declare const _default: {
|
|
385
|
+
install(app: App): void;
|
|
386
|
+
};
|
|
387
|
+
export default _default;
|
|
388
|
+
|
|
389
|
+
declare const _default_2: <T extends Table<any> = Table>(__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<{
|
|
390
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
391
|
+
readonly "onUpdate:size"?: ((value: "" | "default" | "large" | "small" | undefined) => any) | undefined;
|
|
392
|
+
readonly "onUpdate:loading"?: ((value: boolean) => any) | undefined;
|
|
393
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onUpdate:size" | "onUpdate:loading"> & ({
|
|
394
|
+
size?: TableProps["size"];
|
|
395
|
+
loading?: boolean;
|
|
396
|
+
} & {
|
|
397
|
+
table?: T;
|
|
398
|
+
search?: () => Promise<unknown>;
|
|
399
|
+
addIndexColumn?: boolean;
|
|
400
|
+
immediateSearch?: boolean;
|
|
401
|
+
control?: boolean | Partial<{
|
|
402
|
+
sizeControl: boolean;
|
|
403
|
+
columnControl: boolean;
|
|
404
|
+
}>;
|
|
405
|
+
searchFormConfig?: Omit<SearchFormProps, "form"> & {
|
|
406
|
+
hidden?: boolean;
|
|
407
|
+
container?: ContainerComponent | false;
|
|
408
|
+
};
|
|
409
|
+
tableContainer?: ContainerComponent | false;
|
|
410
|
+
columns?: Columns<T extends Table<any, infer R extends object> ? R : any>;
|
|
411
|
+
data?: (T extends Table<any, infer R extends object> ? R : any)[];
|
|
412
|
+
pagination?: false | Partial<PaginationProps>;
|
|
413
|
+
} & Omit<TableProps, "data">) & Partial<{}>> & PublicProps;
|
|
414
|
+
expose(exposed: ShallowUnwrapRef< {}>): void;
|
|
415
|
+
attrs: any;
|
|
416
|
+
slots: Partial<Record<string, (_: any) => any>> & {
|
|
417
|
+
'search-form'?(_: {}): any;
|
|
418
|
+
'button-bar'?(_: {}): any;
|
|
419
|
+
toolbar?(_: {}): any;
|
|
420
|
+
table?(_: {}): any;
|
|
421
|
+
};
|
|
422
|
+
emit: ((evt: "update:size", value: "" | "default" | "large" | "small" | undefined) => void) & ((evt: "update:loading", value: boolean) => void);
|
|
423
|
+
}>) => VNode & {
|
|
424
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
export declare const ensureInjectConfig: (key: string) => InjectConfigEntry;
|
|
428
|
+
|
|
429
|
+
declare type Expand = {
|
|
430
|
+
minExpandRows?: number;
|
|
431
|
+
expandStatus?: boolean;
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
declare type ExpandButtonProps = ButtonProps & {
|
|
435
|
+
expandStatus: boolean;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
declare type ExtendWithAny<D> = {
|
|
439
|
+
[K in keyof D]: IsRecord<D[K]> extends true ? ExtendWithAny<D[K]> : D[K];
|
|
440
|
+
} & Record<string, any>;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* @description 字段配置类型,包含所有字段属性和响应式支持
|
|
444
|
+
* @template D - 数据对象类型
|
|
445
|
+
*/
|
|
446
|
+
export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = (FieldTypeMap<D>[C] & {
|
|
447
|
+
component?: C extends 'custom' ? FieldTypeMap<D>[C]['component'] : C;
|
|
448
|
+
}) | WithFields<D>;
|
|
449
|
+
|
|
450
|
+
declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @description 字段数组类型
|
|
454
|
+
* @template D - 数据对象类型
|
|
455
|
+
*/
|
|
456
|
+
export declare type Fields<D extends Data = Data> = Array<Field<ComponentName, D>>;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* @type {FieldTypeMap} 字段类型集合
|
|
460
|
+
*/
|
|
461
|
+
export declare type FieldTypeMap<D extends Data = Data> = {
|
|
462
|
+
[K in ComponentName]: K extends 'custom' ? WithCommon<{
|
|
463
|
+
slots?: Slots;
|
|
464
|
+
[x: string]: any;
|
|
465
|
+
}, D> & {
|
|
466
|
+
component?: RenderComponentType | Raw<RenderComponentType>;
|
|
467
|
+
} : WithComponent<GetComponentType<K>, D> & {
|
|
468
|
+
component?: K;
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* 重新定义 Form 类型:
|
|
474
|
+
* 1. 将第二个泛型参数 F 默认绑定为本地 Field<ComponentName, D>;
|
|
475
|
+
* 2. 将 core Form 的第三个泛型参数 I 绑定为本地 UI 库(element-plus)的 FormInstance,
|
|
476
|
+
* 使 formRef 的类型变为 Ref<FormInstance | undefined>。
|
|
477
|
+
*/
|
|
478
|
+
export declare type Form<D extends Data = Data, F extends Field<ComponentName, D> = Field<ComponentName, D>> = Form_2<D, F, FormInstance>;
|
|
479
|
+
|
|
480
|
+
declare type Form_2<D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>, I = any> = ReturnType<typeof useFormData<D>> & ReturnType<typeof useFields_2<D, F>> & ReturnType<typeof useFormRef_2<I>>;
|
|
481
|
+
|
|
482
|
+
export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "error"];
|
|
483
|
+
|
|
484
|
+
export { FormInstance }
|
|
485
|
+
|
|
486
|
+
declare type _FormProps = Pick<Partial<FormProps>, 'disabled' | 'labelPosition' | 'labelWidth' | 'inline' | 'inlineMessage' | 'statusIcon' | 'showMessage' | 'size'>;
|
|
487
|
+
|
|
488
|
+
declare type FP<T extends Record<string, any>> = Partial<T & Pick<Base, 'valueFormatter' | 'componentContainer' | 'modelProp' | 'componentClass' | 'componentStyle'> & AllowedComponentProps>;
|
|
489
|
+
|
|
490
|
+
export declare type GetComponentType<K extends ComponentName> = K extends keyof ComponentMap ? ComponentMap[K] : K extends keyof BaseComponentMap ? BaseComponentMap[K] : never;
|
|
491
|
+
|
|
492
|
+
export declare const getInitProps: (field: Field) => Record<string, any>;
|
|
493
|
+
|
|
494
|
+
export declare const getInjectConfig: (key: string) => InjectConfigEntry | undefined;
|
|
495
|
+
|
|
496
|
+
export declare type Grid = boolean | (RowProps & {});
|
|
497
|
+
|
|
498
|
+
export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
|
|
499
|
+
|
|
500
|
+
export declare const INJECT_CONFIG: {
|
|
501
|
+
[key in keyof RequiredComponentVars]: {
|
|
502
|
+
injectionKey: InjectionKey<RequiredComponentVars[key]>;
|
|
503
|
+
default: RequiredComponentVars[key];
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export declare type InjectConfigEntry<T = any> = {
|
|
508
|
+
injectionKey: InjectionKey<T>;
|
|
509
|
+
default: T;
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
export declare const InjectionFormKey: InjectionKey<any>;
|
|
513
|
+
|
|
514
|
+
export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
|
|
515
|
+
|
|
516
|
+
declare type IsRecord<T> = T extends object ? T extends ((...args: any[]) => any) | any[] | null ? false : true : false;
|
|
517
|
+
|
|
518
|
+
declare type JoinPath<Prefix extends any[], Key extends PropertyKey> = [
|
|
519
|
+
...Prefix,
|
|
520
|
+
KeyExpandString<Extract<Key, string>>
|
|
521
|
+
];
|
|
522
|
+
|
|
523
|
+
declare type KeyExpandString<T extends string> = T | (string & {});
|
|
524
|
+
|
|
525
|
+
declare type KeyPathString<D extends Data> = KeyExpandString<AllowStringKey<D>>;
|
|
526
|
+
|
|
527
|
+
declare type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* @description 不支持响应式的属性名
|
|
531
|
+
*/
|
|
532
|
+
declare type NotSupportedRefOrGetterProps = 'component' | 'formItemContainer' | 'componentContainer' | 'valueFormatter' | 'fields' | 'slots' | 'modelProp';
|
|
533
|
+
|
|
534
|
+
declare type Option_2 = {
|
|
535
|
+
label: string;
|
|
536
|
+
value: any;
|
|
537
|
+
[x: string]: any;
|
|
538
|
+
};
|
|
539
|
+
export { Option_2 as Option }
|
|
540
|
+
|
|
541
|
+
export declare type Options = Array<Option_2>;
|
|
542
|
+
|
|
543
|
+
declare interface PageParam {
|
|
544
|
+
current: number;
|
|
545
|
+
pageSize: number;
|
|
546
|
+
total: number;
|
|
547
|
+
[key: string]: any;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
declare type Path<D extends Data = Data> = KeyPathString<D>;
|
|
551
|
+
|
|
552
|
+
export declare type PathProps = {
|
|
553
|
+
path?: string;
|
|
554
|
+
} & Data;
|
|
555
|
+
|
|
556
|
+
declare type Paths<T, Prefix extends any[] = []> = T extends object ? {
|
|
557
|
+
[K in keyof T]: IsRecord<T[K]> extends true ? JoinPath<Prefix, K> | Paths<T[K], JoinPath<Prefix, K>> : JoinPath<Prefix, K>;
|
|
558
|
+
}[keyof T] : never;
|
|
559
|
+
|
|
560
|
+
declare type PP<T extends Record<string, any>> = Partial<T & AllowedComponentProps>;
|
|
561
|
+
|
|
562
|
+
export declare const ProComponentProvider: SFCWithInstall<{
|
|
563
|
+
new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
564
|
+
componentVars?: ComponentVars;
|
|
565
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
566
|
+
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, any, ComponentProvideOptions, {
|
|
567
|
+
P: {};
|
|
568
|
+
B: {};
|
|
569
|
+
D: {};
|
|
570
|
+
C: {};
|
|
571
|
+
M: {};
|
|
572
|
+
Defaults: {};
|
|
573
|
+
}, Readonly<{
|
|
574
|
+
componentVars?: ComponentVars;
|
|
575
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
576
|
+
}> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
577
|
+
__isFragment?: never;
|
|
578
|
+
__isTeleport?: never;
|
|
579
|
+
__isSuspense?: never;
|
|
580
|
+
} & ComponentOptionsBase<Readonly<{
|
|
581
|
+
componentVars?: ComponentVars;
|
|
582
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
583
|
+
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
584
|
+
$slots: {
|
|
585
|
+
default?(_: {}): any;
|
|
586
|
+
};
|
|
587
|
+
})>;
|
|
588
|
+
|
|
589
|
+
export declare const ProForm: SFCWithInstall<(<F extends Form<any> = Form>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
590
|
+
slots: Readonly<Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
|
|
591
|
+
path?: string;
|
|
592
|
+
} & Data & {
|
|
593
|
+
[x: string]: any;
|
|
594
|
+
disabled?: boolean;
|
|
595
|
+
}>> & {
|
|
596
|
+
default: Slot;
|
|
597
|
+
}>> & Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
|
|
598
|
+
path?: string;
|
|
599
|
+
} & Data & {
|
|
600
|
+
[x: string]: any;
|
|
601
|
+
disabled?: boolean;
|
|
602
|
+
}>> & {
|
|
603
|
+
default: Slot;
|
|
604
|
+
}>;
|
|
605
|
+
attrs: any;
|
|
606
|
+
emit: {};
|
|
607
|
+
}, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
608
|
+
props: {
|
|
609
|
+
grid?: Grid | undefined;
|
|
610
|
+
form?: F | undefined;
|
|
611
|
+
size?: ComponentSize | undefined;
|
|
612
|
+
disabled?: boolean | undefined;
|
|
613
|
+
labelWidth?: string | number | undefined;
|
|
614
|
+
labelPosition?: "left" | "right" | "top" | undefined;
|
|
615
|
+
rules?: FormRules | undefined;
|
|
616
|
+
inlineMessage?: boolean | undefined;
|
|
617
|
+
showMessage?: boolean | undefined;
|
|
618
|
+
requireAsteriskPosition?: "left" | "right" | undefined;
|
|
619
|
+
labelSuffix?: string | undefined;
|
|
620
|
+
inline?: boolean | undefined;
|
|
621
|
+
statusIcon?: boolean | undefined;
|
|
622
|
+
validateOnRuleChange?: boolean | undefined;
|
|
623
|
+
hideRequiredAsterisk?: boolean | undefined;
|
|
624
|
+
scrollToError?: boolean | undefined;
|
|
625
|
+
scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
|
|
626
|
+
} & PublicProps;
|
|
627
|
+
expose(exposed: ShallowUnwrapRef< {}>): void;
|
|
628
|
+
attrs: any;
|
|
629
|
+
slots: Readonly<Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
|
|
630
|
+
path?: string;
|
|
631
|
+
} & Data & {
|
|
632
|
+
[x: string]: any;
|
|
633
|
+
disabled?: boolean;
|
|
634
|
+
}>> & {
|
|
635
|
+
default: Slot;
|
|
636
|
+
}>> & Partial<Record<F extends Form<infer D extends Data> ? Path<D> : string, Slot<VModelProps & {
|
|
637
|
+
path?: string;
|
|
638
|
+
} & Data & {
|
|
639
|
+
[x: string]: any;
|
|
640
|
+
disabled?: boolean;
|
|
641
|
+
}>> & {
|
|
642
|
+
default: Slot;
|
|
643
|
+
}>;
|
|
644
|
+
emit: {};
|
|
645
|
+
}>) => VNode & {
|
|
646
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
647
|
+
})>;
|
|
648
|
+
|
|
649
|
+
export declare type ProFormInstance = ComponentExposed<typeof BaseForm>;
|
|
650
|
+
|
|
651
|
+
export declare type ProFormItemInstance = ComponentExposed<typeof BaseFormItem>;
|
|
652
|
+
|
|
653
|
+
export declare type ProFormItemProps = ComponentProps<typeof BaseFormItem>;
|
|
654
|
+
|
|
655
|
+
export declare type ProFormProps = ComponentProps<typeof BaseForm>;
|
|
656
|
+
|
|
657
|
+
declare type Props = {
|
|
658
|
+
component?: string | Component;
|
|
659
|
+
path?: string;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
declare type Props_2 = {
|
|
663
|
+
component?: ContainerComponent;
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
declare type Props_3 = {
|
|
667
|
+
component?: SlotComponentType;
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
declare type Props_4 = {
|
|
671
|
+
grid?: Grid;
|
|
672
|
+
fields?: Fields;
|
|
673
|
+
disabled?: boolean;
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
export declare const ProTable: typeof _default_2;
|
|
677
|
+
|
|
678
|
+
export declare type ProTableInstance = ComponentPublicInstance;
|
|
679
|
+
|
|
680
|
+
export declare type ProTableProps<T extends Table<any> = Table> = {
|
|
681
|
+
table?: T;
|
|
682
|
+
search?: () => Promise<unknown>;
|
|
683
|
+
addIndexColumn?: boolean;
|
|
684
|
+
immediateSearch?: boolean;
|
|
685
|
+
control?: boolean | Partial<Control>;
|
|
686
|
+
searchFormConfig?: SearchFormConfig;
|
|
687
|
+
tableContainer?: ContainerComponent | false;
|
|
688
|
+
columns?: Columns<ReturnTableRecord<T>>;
|
|
689
|
+
data?: ReturnTableRecord<T>[];
|
|
690
|
+
pagination?: false | Partial<PaginationProps>;
|
|
691
|
+
} & Omit<TableProps, 'data'>;
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* @description 自定义组件
|
|
695
|
+
* @example (p, ctx) => h('div', ctx.attrs)
|
|
696
|
+
*/
|
|
697
|
+
export declare type RenderComponentType = Component<VModelProps & PathProps>;
|
|
698
|
+
|
|
699
|
+
export declare type RequiredComponentVars = {
|
|
700
|
+
'pro-table': PP<TableProps & {
|
|
701
|
+
pagination?: Partial<PaginationProps>;
|
|
702
|
+
control?: boolean | {
|
|
703
|
+
sizeControl?: boolean;
|
|
704
|
+
columnControl?: boolean;
|
|
705
|
+
};
|
|
706
|
+
searchFormConfig?: any;
|
|
707
|
+
immediateSearch?: boolean;
|
|
708
|
+
addIndexColumn?: boolean;
|
|
709
|
+
tableContainer?: any;
|
|
710
|
+
}>;
|
|
711
|
+
'pro-form': PP<Omit<ProFormProps, 'form' | 'grid'> & {
|
|
712
|
+
grid: Exclude<Grid, undefined | boolean>;
|
|
713
|
+
}>;
|
|
714
|
+
'pro-form-item': PP<FormItemProps & Pick<ColProps, 'span' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'> & Pick<Base, 'formItemContainer'>>;
|
|
715
|
+
'input.password': FP<ComponentProps<GetComponentType<'input'>>>;
|
|
716
|
+
'input.textarea': FP<ComponentProps<GetComponentType<'input'>>>;
|
|
717
|
+
} & {
|
|
718
|
+
[K in DatePickerType as `date-picker.${K}`]: FP<ComponentProps<GetComponentType<'date-picker'>>>;
|
|
719
|
+
} & {
|
|
720
|
+
[K in Exclude<ComponentName, 'custom'>]: FP<ComponentProps<GetComponentType<K>>>;
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
declare type ReturnTableRecord<V> = V extends Table<any, infer R> ? R : any;
|
|
724
|
+
|
|
725
|
+
declare type SearchFormConfig = Omit<SearchFormProps, 'form'> & {
|
|
726
|
+
hidden?: boolean;
|
|
727
|
+
container?: ContainerComponent | false;
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
declare type SearchFormProps = {
|
|
731
|
+
form: Form;
|
|
732
|
+
layout?: 'grid' | 'inline';
|
|
733
|
+
expand?: boolean | Expand;
|
|
734
|
+
searchButton?: Component<ButtonProps> | DefineComponent<ButtonProps>;
|
|
735
|
+
resetButton?: Component<ButtonProps> | DefineComponent<ButtonProps>;
|
|
736
|
+
expandButton?: Component<ExpandButtonProps> | DefineComponent<ExpandButtonProps>;
|
|
737
|
+
} & /* @vue-ignore */ _FormProps & AllowedComponentProps;
|
|
738
|
+
|
|
739
|
+
declare type SetColumn<D extends Data = Data, C extends BaseColumn<D> = BaseColumn<D>> = (key: Path<D>, column: C | ((pre: Readonly<C>) => C), options?: {
|
|
740
|
+
updateType?: 'rewrite' | 'merge';
|
|
741
|
+
} & UpdateColumnOptions) => void;
|
|
742
|
+
|
|
743
|
+
declare type SetPageParam = (pageParam: Partial<PageParam> | ((pre: Readonly<PageParam>) => Partial<PageParam>)) => void;
|
|
744
|
+
|
|
745
|
+
declare type SFCWithInstall<T> = T & Plugin_2;
|
|
746
|
+
|
|
747
|
+
export declare const SlotComponent: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_3> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* @description 插槽组件类型
|
|
751
|
+
*/
|
|
752
|
+
export declare type SlotComponentType = Component<PathProps> | VNode | string | number | boolean | null | undefined | ((...args: any[]) => SlotComponentType);
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* @description 插槽对象类型
|
|
756
|
+
*/
|
|
757
|
+
export declare type Slots = {
|
|
758
|
+
[name: string]: SlotComponentType;
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* 重新定义 Table 类型,将 Column 类型绑定为 element-plus-pro 的 Column<D>
|
|
763
|
+
*/
|
|
764
|
+
export declare type Table<D extends Data = Data, T extends object = ExtendWithAny<D>> = Omit<Table_2<D, T, Column<D>>, 'dataSource'> & {
|
|
765
|
+
/**
|
|
766
|
+
* element-plus table 数据源
|
|
767
|
+
*/
|
|
768
|
+
data: Ref<T[]>;
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
declare type Table_2<D extends Data = Data, T extends object = ExtendWithAny<D>, C extends BaseColumn<D> = BaseColumn<D>> = {
|
|
772
|
+
columns: Ref<Columns_2<D, C>>;
|
|
773
|
+
dataSource: Ref<T[]>;
|
|
774
|
+
pageParam: Reactive<PageParam>;
|
|
775
|
+
searchForm: Form_2<D>;
|
|
776
|
+
setColumn: SetColumn<D, C>;
|
|
777
|
+
deleteColumn: (path: Path<D> | ColumnFindBy<D, C>, options?: UpdateColumnOptions) => void;
|
|
778
|
+
appendColumn: (path: Path<D> | ColumnFindBy<D, C> | undefined, column: C | Columns_2<D, C>, options?: UpdateColumnOptions) => void;
|
|
779
|
+
prependColumn: (path: Path<D> | ColumnFindBy<D, C> | undefined, column: C | Columns_2<D, C>, options?: UpdateColumnOptions) => void;
|
|
780
|
+
setPageParam: SetPageParam;
|
|
781
|
+
resetQueryParams: () => void;
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
declare type TableProps = TableProps_2<any>;
|
|
785
|
+
|
|
786
|
+
export declare const TeleportComponentNamePrefix = "TeleportComponent_";
|
|
787
|
+
|
|
788
|
+
declare type UpdateColumnOptions = {
|
|
789
|
+
all?: boolean;
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
declare type UpdateFieldOptions = {
|
|
793
|
+
all?: boolean;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
/** useFields 返回值类型,固定为本地 Fields<D> */
|
|
797
|
+
export declare type UseFields<D extends Data = Data> = ReturnType<typeof useFields<D>>;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* 类型断言 re-export @qin-ui/core 的 useFields,
|
|
801
|
+
* 将泛型参数 F 的默认值覆盖为本地的 Field<D>,
|
|
802
|
+
* 使得 fields、getField 等方法的类型推断包含 UI 库的完整属性签名。
|
|
803
|
+
*/
|
|
804
|
+
export declare const useFields: {
|
|
805
|
+
<D extends Data = Data>(initFields?: Fields<D>): ReturnType<typeof useFields_2<D, Field<ComponentName, D>, FormItemInstance>>;
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>, FormInstance = any>(initFields?: F[]) => {
|
|
809
|
+
fields: Ref<F[], F[]>;
|
|
810
|
+
getField: {
|
|
811
|
+
(path: Path<D> | FieldFindBy<D, F>): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
|
|
812
|
+
(path: Path<D> | FieldFindBy<D, F>, options?: {
|
|
813
|
+
all?: false;
|
|
814
|
+
}): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
|
|
815
|
+
(path: Path<D> | FieldFindBy<D, F>, options: {
|
|
816
|
+
all: true;
|
|
817
|
+
}): Readonly<F & AdditionalMethods<FormInstance>>[] | undefined;
|
|
818
|
+
};
|
|
819
|
+
setField: (path: Path<D> | FieldFindBy<D, F>, field: F | ((preField: Readonly<F>) => F), options?: {
|
|
820
|
+
updateType?: "rewrite" | "merge";
|
|
821
|
+
} & UpdateFieldOptions) => void;
|
|
822
|
+
deleteField: (path: Path<D> | FieldFindBy<D, F>, options?: UpdateFieldOptions) => void;
|
|
823
|
+
appendField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
|
|
824
|
+
prependField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
|
|
825
|
+
getParentField: {
|
|
826
|
+
(path: Path<D> | FieldFindBy<D, F>): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
|
|
827
|
+
(path: Path<D> | FieldFindBy<D, F>, options: {
|
|
828
|
+
all?: false;
|
|
829
|
+
}): Readonly<F & AdditionalMethods<FormInstance>> | undefined;
|
|
830
|
+
(path: Path<D> | FieldFindBy<D, F>, options: {
|
|
831
|
+
all: true;
|
|
832
|
+
}): Readonly<F & AdditionalMethods<FormInstance>>[] | undefined;
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* 类型断言 re-export @qin-ui/core 的 useForm,
|
|
838
|
+
* 将默认返回的 Form<D, BaseField<D>> 覆盖为本地的 Form<D, Field<ComponentName, D>>。
|
|
839
|
+
*/
|
|
840
|
+
export declare const useForm: {
|
|
841
|
+
<D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>, initFields?: Field<ComponentName, D>[], root?: boolean): Form<D, Field<ComponentName, D>>;
|
|
842
|
+
<D extends Data = Data>(root?: boolean): Form<D, Field<ComponentName, D>>;
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* 表单数据处理hook
|
|
847
|
+
* @param initFormData 初始表单数据
|
|
848
|
+
* @returns {Object} { formData, getFormData, setFormData }
|
|
849
|
+
*/
|
|
850
|
+
export declare const useFormData: <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>) => {
|
|
851
|
+
formData: Reactive<ExtendWithAny<D>>;
|
|
852
|
+
getFormData: {
|
|
853
|
+
<K extends keyof D>(path: K): D[K];
|
|
854
|
+
<K extends keyof D & string, K1 extends keyof D[K] & string>(path: `${K}.${K1}`): D[K][K1];
|
|
855
|
+
<K extends keyof D & string, K1_1 extends keyof D[K] & string, K2 extends keyof D[K][K1_1] & string>(path: `${K}.${K1_1}.${K2}`): D[K][K1_1][K2];
|
|
856
|
+
(path: Path<D>): any;
|
|
857
|
+
};
|
|
858
|
+
setFormData: {
|
|
859
|
+
(path: Path<D>, value: any): void;
|
|
860
|
+
(path: Path<D>, value: (v: any) => any): void;
|
|
861
|
+
(value: ExtendWithAny<DeepPartial<D>>): void;
|
|
862
|
+
(value: (v: ExtendWithAny<DeepPartial<D>>) => ExtendWithAny<DeepPartial<D>>): void;
|
|
863
|
+
};
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* 类型断言 re-export @qin-ui/core 的 useFormRef,
|
|
868
|
+
* 将 FormInstance 泛型参数绑定为本地 UI 库(element-plus)的 FormInstance。
|
|
869
|
+
*/
|
|
870
|
+
export declare const useFormRef: {
|
|
871
|
+
(): ReturnType<typeof useFormRef_2<FormInstance>>;
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
declare const useFormRef_2: <F = any>() => {
|
|
875
|
+
formRef: Ref<F | undefined, F | undefined>;
|
|
876
|
+
setFormRef: (inst: F) => void;
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
export declare const useTable: <D extends Data = Data, T extends object = ExtendWithAny<D>>(params?: UseTableParams<D, T>) => Table<D, T>;
|
|
880
|
+
|
|
881
|
+
declare type UseTableParams<D extends Data = Data, T extends object = ExtendWithAny<D>> = {
|
|
882
|
+
columns?: Columns<D>;
|
|
883
|
+
data?: T[];
|
|
884
|
+
pageParam?: PageParam;
|
|
885
|
+
searchParam?: ExtendWithAny<DeepPartial<D>>;
|
|
886
|
+
searchFields?: Fields<D>;
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
export declare type ValueFormatter = {
|
|
890
|
+
(val: any, oldVal: any): any;
|
|
891
|
+
} | {
|
|
892
|
+
get?: (val: any) => any;
|
|
893
|
+
set?: (val: any, oldVal: any) => any;
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
export declare type VModelProps<T = any> = {
|
|
897
|
+
modelValue?: T;
|
|
898
|
+
'onUpdate:modelValue'?: (val: T) => void;
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
declare type WithCommon<T, D extends Data = Data> = WithRef<WithCommonBase<T> & BaseWithoutFields<D>>;
|
|
902
|
+
|
|
903
|
+
declare type WithCommonBase<T = unknown> = T & Omit<FormItemProps, 'label'> & ColProps;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* @description 自动从 Vue 组件提取 Props 和 Slots,并加上公共表单字段属性
|
|
907
|
+
* @template T - Vue 组件类型
|
|
908
|
+
* @template D - 数据对象类型
|
|
909
|
+
*/
|
|
910
|
+
declare type WithComponent<T extends abstract new (...args: any) => any, D extends Data = Data> = WithCommon<{
|
|
911
|
+
slots?: ComponentSlots<T>;
|
|
912
|
+
} & Omit<ComponentProps<T>, keyof VNodeProps>, D>;
|
|
913
|
+
|
|
914
|
+
declare type WithFields<D extends Data = Data> = WithRef<WithCommonBase & BaseWithFields<D>>;
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* @description 为对象属性添加响应式支持的类型
|
|
918
|
+
* @template T - 原始类型
|
|
919
|
+
*/
|
|
920
|
+
export declare type WithRef<T> = {
|
|
921
|
+
[P in keyof T]: P extends NotSupportedRefOrGetterProps ? T[P] : T[P] extends (...args: any[]) => any ? T[P] : MaybeRefOrComputedRef<T[P]>;
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
export { }
|