@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
70 lines (69 loc) • 2.63 kB
TypeScript
import type { InjectionKey } from 'vue';
export declare type SelectOptionValue = string | number | object;
export declare type SelectOptionContext = {
el: HTMLElement | undefined;
index: number;
groupDisabled: boolean;
label?: string;
value: SelectOptionValue;
isDisabled: boolean;
visible: boolean;
hit: boolean;
hover: boolean;
created: boolean;
currentLabel: string;
};
export declare type SelectTargetElement = 'select' | 'chip' | 'popper' | 'chip' | 'chip-close' | 'input' | 'input-filter' | 'reference';
export declare type SelectValue = SelectOptionValue | SelectOptionValue[];
export declare type SelectStates = {
options: Map<SelectOptionValue, SelectOptionContext>;
cachedOptions: Map<SelectOptionValue, SelectOptionContext>;
selected: Map<SelectOptionValue, SelectOptionContext>;
disabledOptions: Map<SelectOptionValue, SelectOptionContext>;
createdLabel: string | null;
createdSelected: boolean;
targetOnElement: SelectTargetElement | null;
optionsCount: number;
filteredOptionsCount: number;
visible: boolean;
softFocus: boolean;
selectedLabel: string;
hoverIndex: number;
query: string;
previousQuery: string | null;
cachedPlaceHolder: string | undefined;
currentPlaceholder: string | undefined;
menuVisibleOnFocus: boolean;
isOnComposition: boolean;
isSilentBlur: boolean;
mouseEnter: boolean;
};
export declare type SelectGroupContext = {
disabled: boolean;
};
export declare type SelectContext = {
multipleLimit: number;
multiple: boolean;
states: SelectStates;
queryChange: string | null;
selectWrapper: HTMLElement | undefined;
selectedArray: SelectOptionContext[];
optionsArray: SelectOptionContext[];
cachedOptionsArray: SelectOptionContext[];
hoverIndex: number;
handleTarget: (target: SelectTargetElement | null, condition?: boolean) => void;
setSelected(): void;
handleOptionSelect(vm: SelectOptionContext, byClick: boolean): void;
};
declare type SelectRegisterContext = (option: SelectOptionContext) => {
unregister: () => void;
updateOption: (option: SelectOptionContext) => void;
};
export declare const selectContextKey: InjectionKey<SelectContext>;
export declare const selectRegisterKey: InjectionKey<SelectRegisterContext>;
export declare const optionGroupContextKey: InjectionKey<SelectGroupContext>;
declare type OptionGroupRegisterContext = (option: SelectOptionContext) => {
unregister: () => void;
};
export declare const optionGroupRegisterKey: InjectionKey<OptionGroupRegisterContext>;
export {};