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.
23 lines
701 B
23 lines
701 B
3 years ago
|
import type { InjectionKey } from 'vue';
|
||
|
import { inject, provide } from 'vue';
|
||
|
import type { ColumnType, StickyOffsets } from '../interface';
|
||
|
|
||
|
export type FlattenColumns<RecordType> = readonly (ColumnType<RecordType> & {
|
||
|
scrollbar?: boolean;
|
||
|
})[];
|
||
|
type SummaryContextProps = {
|
||
|
stickyOffsets?: StickyOffsets;
|
||
|
scrollColumnIndex?: number;
|
||
|
flattenColumns?: FlattenColumns<any>;
|
||
|
};
|
||
|
|
||
|
export const SummaryContextKey: InjectionKey<SummaryContextProps> = Symbol('SummaryContextProps');
|
||
|
|
||
|
export const useProvideSummary = (props: SummaryContextProps) => {
|
||
|
provide(SummaryContextKey, props);
|
||
|
};
|
||
|
|
||
|
export const useInjectSummary = () => {
|
||
|
return inject(SummaryContextKey, {} as SummaryContextProps);
|
||
|
};
|