vuestic-ui
Version:
Vue 3 UI Framework
38 lines (37 loc) • 1.29 kB
TypeScript
import type { ExtractPropTypes, PropType } from 'vue';
export type SelectableOption = string | number | boolean | Record<string, any> | null | undefined;
export type StringOrFunction = string | ((option: SelectableOption) => unknown);
export declare const useSelectableListProps: {
options: {
type: PropType<SelectableOption[]>;
default: () => never[];
};
textBy: {
type: PropType<StringOrFunction>;
default: string;
};
valueBy: {
type: PropType<StringOrFunction>;
default: string;
};
trackBy: {
type: PropType<StringOrFunction>;
default: string;
};
disabledBy: {
type: PropType<StringOrFunction>;
default: string;
};
groupBy: {
type: PropType<StringOrFunction>;
default: string;
};
};
export declare function useSelectableList(props: ExtractPropTypes<typeof useSelectableListProps>): {
tryResolveByValue: <T>(value: T) => SelectableOption | T;
getValue: (option: SelectableOption) => any;
getText: (option: SelectableOption) => string;
getDisabled: (option: SelectableOption) => boolean;
getTrackBy: (option: SelectableOption) => string | number;
getGroupBy: (option: SelectableOption) => string | number | undefined;
};