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.
18 lines
524 B
18 lines
524 B
import type { InjectionKey } from 'vue';
|
|
import { inject, provide } from 'vue';
|
|
import type { Key } from '../interface';
|
|
|
|
interface ResizeContextProps {
|
|
onColumnResize: (columnKey: Key, width: number) => void;
|
|
}
|
|
|
|
export const ResizeContextKey: InjectionKey<ResizeContextProps> = Symbol('ResizeContextProps');
|
|
|
|
export const useProvideResize = (props: ResizeContextProps) => {
|
|
provide(ResizeContextKey, props);
|
|
};
|
|
|
|
export const useInjectResize = () => {
|
|
return inject(ResizeContextKey, { onColumnResize: () => {} });
|
|
};
|