You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/vc-table/context/HoverContext.tsx

22 lines
588 B

import type { InjectionKey, Ref } from 'vue';
import { ref, inject, provide } from 'vue';
export interface HoverContextProps {
startRow: Ref<number>;
endRow: Ref<number>;
onHover: (start: number, end: number) => void;
}
export const HoverContextKey: InjectionKey<HoverContextProps> = Symbol('HoverContextProps');
export const useProvideHover = (props: HoverContextProps) => {
provide(HoverContextKey, props);
};
export const useInjectHover = () => {
return inject(HoverContextKey, {
startRow: ref(-1),
endRow: ref(-1),
onHover() {},
} as HoverContextProps);
};