import { InjectionKey } from 'vue'; import { MaybeRef, OptionalKeys, RequiredKeys } from './typings/internal'; export type ModifierKey = 'meta' | 'shift' | 'ctrl' | 'alt'; export interface DragSelectProps { /** * binding value * @alias v-model */ modelValue?: MaybeRef; /** * whether DragSelect is disabled * @default false */ disabled?: MaybeRef; /** * can draggable when dragstart event target on DragSelectOption */ draggableOnOption?: MaybeRef; /** * whether to enable the click item selection function * @default true */ clickOptionToSelect?: MaybeRef; /** * whether to enable clicking on blank content to clear the option * @default true */ clickBlankToClear?: MaybeRef; /** * the class names of drag area */ dragAreaClass?: string; /** * the class styles of drag area */ dragAreaStyle?: Record; /** * background color of drag area, 'none' represent hide this style to avoid override background color of class */ background?: string; /** * the class names of selected DragSelectOption */ selectedOptionClass?: string; /** * the selected styles of selected DragSelectOption */ selectedOptionStyle?: Record; /** * whether to keep the previously selected. * Only need to use when you need to manually control when to enable multiple selection, otherwise use activeMultipleKeys */ multiple?: MaybeRef; /** * after pressing a certain key, multiple mode will be activated */ activeMultipleKeys?: MaybeRef; /** * in multiple mode, deselect options that are repeatedly selected */ deselectRepeated?: MaybeRef; } export type InnerDragSelectProps = { readonly [P in RequiredKeys]-?: P extends keyof DragSelectProps ? NonNullable[P]> : never; } & { readonly [P in OptionalKeys]?: P extends keyof DragSelectProps ? DragSelectProps[P] : never; }; export type OptionValue = unknown; export interface Option { dom: HTMLElement; value: T; disabled: boolean; } interface ForOptionAction { selectedOptionClass: MaybeRef; has: (option: MaybeRef