import { ComputedRef } from 'vue'; import { MaybeRefOrGetter } from 'vue'; /** * The return value for `useSelection` */ export declare interface UseSelection { /** * Sets the selection state to `true` for the given item unless selection is disabled for that item */ select: (item: Item) => void; /** * Sets the selection state to `false` for the given item unless selection is disabled for that item */ unselect: (item: Item) => void; /** * Toggles the given item's selection state unless selection is disabled for that item */ selectToggle: (item: Item) => void; /** * Selects all items except those that have selection disabled */ selectAll: () => void; /** * Unselects all items except those that have selection disabled */ unselectAll: () => void; /** * Selects all non-disabled items if some are unselected, otherwise unselects all non-disabled items */ selectToggleAll: () => void; /** * Resets the selected items to their initial selection state with respect to `shouldPreselect`. If `shouldPreselect` is not provided, then all non-disabled items will be unselected. */ resetSelection: () => void; /** * Returns a boolean indicating if the given item is selected */ isSelected: (item: Item) => boolean; /** * Returns a boolean indicating if the given item is disabled from changing its selection state */ isSelectDisabled: (item: Item) => boolean; /** * A computed list of the currently selected items */ selectedItems: ComputedRef; /** * A computed boolean indicating if all items are selected regardless if they are disabled */ allSelected: ComputedRef; /** * A computed boolean indicating if all non-disabled items are selected */ allNonDisabledSelected: ComputedRef; /** * A computed boolean indicating if one or more items are selected regardless if they are disabled */ someSelected: ComputedRef; /** * A computed boolean indicating if one or more non-disabled items are selected */ someNonDisabledSelected: ComputedRef; } declare function useSelection({ items, trackBy, shouldDisable, shouldPreselect, }: UseSelectionArgs): UseSelection; export default useSelection; /** * The inputs for `useSelection` */ export declare interface UseSelectionArgs { items: MaybeRefOrGetter; /** * The item key used as a unique identifier for each item. The default value is "id". */ trackBy?: string; /** * A callback function that is used internally to determine if an item should be disabled from changing its selection state */ shouldDisable?: (item: Item) => boolean; /** * A callback function that is used internally to determine if an item should be selected by default and when `resetSelection` is called */ shouldPreselect?: (item: Item) => boolean; } export { }