import type { CSSProperties, InjectionKey, Ref } from 'vue'; import { inject, provide } from 'vue'; import type { VueNode } from '../_util/type'; import type { BaseCascaderProps, InternalFieldNames, DefaultOptionType, SingleValueType, } from './Cascader'; export interface CascaderContextProps { options: Ref; fieldNames: Ref; values: Ref; halfValues: Ref; changeOnSelect: Ref; onSelect: (valuePath: SingleValueType) => void; checkable: Ref; searchOptions: Ref; dropdownPrefixCls?: Ref; loadData: Ref<(selectOptions: DefaultOptionType[]) => void>; expandTrigger: Ref<'hover' | 'click'>; expandIcon: Ref; loadingIcon: Ref; dropdownMenuColumnStyle: Ref; customSlots: Ref>; } const CascaderContextKey: InjectionKey = Symbol('CascaderContextKey'); export const useProvideCascader = (props: CascaderContextProps) => { provide(CascaderContextKey, props); }; export const useInjectCascader = () => { return inject(CascaderContextKey); };