UNPKG

vue-devui

Version:

DevUI components based on Vite and Vue3

178 lines (177 loc) 5.39 kB
import { PropType, ComputedRef, ExtractPropTypes, Ref } from 'vue'; export interface OptionObjectItem { name: string; value: string | number; _checked: boolean; [key: string]: unknown; } export type OptionItem = number | string | ({ value: string | number; } & Partial<OptionObjectItem>); export type Options = Array<OptionItem>; export type ModelValue = number | string | Array<number | string>; export type filterValue = boolean | ((query: string) => void); export type SelectSize = 'sm' | 'md' | 'lg'; export type Placement = 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end'; export declare const selectProps: { readonly modelValue: { readonly type: PropType<ModelValue>; readonly default: ""; }; readonly 'onUpdate:modelValue': { readonly type: PropType<(val: ModelValue) => void>; readonly default: undefined; }; readonly options: { readonly type: PropType<Options>; readonly default: () => never[]; }; readonly position: { readonly type: PropType<Placement[]>; readonly default: () => string[]; }; readonly size: { readonly type: PropType<SelectSize>; readonly default: ""; }; readonly overview: { readonly type: PropType<"border" | "underlined">; readonly default: "border"; }; readonly placeholder: { readonly type: StringConstructor; readonly default: ""; }; readonly multiple: { readonly type: BooleanConstructor; readonly default: false; }; readonly disabled: { readonly type: BooleanConstructor; readonly default: false; }; readonly allowClear: { readonly type: BooleanConstructor; readonly default: false; }; readonly optionDisabledKey: { readonly type: StringConstructor; readonly default: ""; }; readonly collapseTags: { readonly type: BooleanConstructor; readonly default: false; }; readonly collapseTagsTooltip: { readonly type: BooleanConstructor; readonly default: false; }; readonly filter: { readonly type: PropType<filterValue>; readonly default: false; }; readonly remote: { readonly type: BooleanConstructor; readonly default: false; }; readonly allowCreate: { readonly type: BooleanConstructor; readonly default: false; }; readonly noDataText: { readonly type: StringConstructor; readonly default: ""; }; readonly noMatchText: { readonly type: StringConstructor; readonly default: ""; }; readonly loading: { readonly type: BooleanConstructor; readonly default: false; }; readonly loadingText: { readonly type: StringConstructor; readonly default: ""; }; readonly onToggleChange: { readonly type: PropType<(bool: boolean) => void>; readonly default: undefined; }; readonly onValueChange: { readonly type: PropType<(item: OptionItem, index: number) => void>; readonly default: undefined; }; readonly multipleLimit: { readonly type: NumberConstructor; readonly default: 0; }; readonly showGlowStyle: { readonly type: BooleanConstructor; readonly default: true; }; readonly menuClass: { readonly type: StringConstructor; readonly default: ""; }; readonly maxLength: { readonly type: NumberConstructor; }; }; export type SelectProps = ExtractPropTypes<typeof selectProps>; export type OptionModelValue = number | string; export interface SelectContext extends SelectProps { selectDisabled: boolean; selectSize: string; isOpen: boolean; selectedOptions: OptionObjectItem[]; filterQuery: string; valueChange: (item: OptionObjectItem) => void; handleClear: () => void; updateInjectOptions: (item: Record<string, unknown>, operation: string, isObject: boolean) => void; tagDelete: (data: OptionObjectItem) => void; onFocus: (e: FocusEvent) => void; onBlur: (e: FocusEvent) => void; debounceQueryFilter: (query: string) => void; } export declare const optionProps: { value: { type: PropType<OptionModelValue>; default: string; }; name: { type: StringConstructor; default: string; }; disabled: { type: BooleanConstructor; default: boolean; }; create: { type: BooleanConstructor; default: boolean; }; }; export type OptionProps = ExtractPropTypes<typeof optionProps>; export interface UseOptionReturnType { currentName: ComputedRef<OptionModelValue>; selectOptionCls: ComputedRef<string>; isVisible: ComputedRef<boolean>; optionSelect: () => void; } export interface UseSelectFunctionReturn { isSelectFocus: Ref<boolean>; blur: () => void; focus: () => void; } export declare const optionGroupProps: { label: { type: StringConstructor; }; disabled: { type: BooleanConstructor; default: boolean; }; }; export type OptionGroupProps = ExtractPropTypes<typeof optionGroupProps>; export type OptionGroupContext = OptionGroupProps;