types(Picker): add PickerInstance type (#9183)
This commit is contained in:
+19
-21
@@ -1,4 +1,11 @@
|
||||
import { ref, watch, computed, PropType, defineComponent } from 'vue';
|
||||
import {
|
||||
ref,
|
||||
watch,
|
||||
computed,
|
||||
PropType,
|
||||
defineComponent,
|
||||
ExtractPropTypes,
|
||||
} from 'vue';
|
||||
|
||||
// Utils
|
||||
import {
|
||||
@@ -16,31 +23,20 @@ import { useExpose } from '../composables/use-expose';
|
||||
|
||||
// Components
|
||||
import { Loading } from '../loading';
|
||||
import Column, {
|
||||
PICKER_KEY,
|
||||
import Column, { PICKER_KEY } from './PickerColumn';
|
||||
|
||||
// Types
|
||||
import type {
|
||||
PickerColumn,
|
||||
PickerOption,
|
||||
PickerExpose,
|
||||
PickerFieldNames,
|
||||
PickerObjectColumn,
|
||||
PickerObjectOption,
|
||||
} from './PickerColumn';
|
||||
PickerToolbarPosition,
|
||||
} from './types';
|
||||
|
||||
const [name, bem, t] = createNamespace('picker');
|
||||
|
||||
export type PickerToolbarPosition = 'top' | 'bottom';
|
||||
|
||||
export type PickerFieldNames = {
|
||||
text?: string;
|
||||
values?: string;
|
||||
children?: string;
|
||||
};
|
||||
|
||||
export type {
|
||||
PickerColumn,
|
||||
PickerOption,
|
||||
PickerObjectColumn,
|
||||
PickerObjectOption,
|
||||
};
|
||||
|
||||
export const pickerProps = {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
@@ -63,6 +59,8 @@ export const pickerProps = {
|
||||
},
|
||||
};
|
||||
|
||||
export type PickerProps = ExtractPropTypes<typeof pickerProps>;
|
||||
|
||||
export default defineComponent({
|
||||
name,
|
||||
|
||||
@@ -380,7 +378,7 @@ export default defineComponent({
|
||||
|
||||
watch(() => props.columns, format, { immediate: true });
|
||||
|
||||
useExpose({
|
||||
useExpose<PickerExpose>({
|
||||
confirm,
|
||||
getValues,
|
||||
setValues,
|
||||
|
||||
Reference in New Issue
Block a user