mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-02 12:07:54 +08:00
f0385d7c24
* feat: tree * refactor: select * refactor: select * refactor: select * refactor: vc-tree-select * refactor: tree-select * refactor: tree-select * feat: add showLeafIcon * refactor: remove lod vc-tree-select * feat: tree-select add tag-render * refactor: cascader * refactor: cascader * refactor: cascader * refactor: cascader * fix: maxTagmaxTagPlaceholder not work
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
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<BaseCascaderProps['options']>;
|
|
fieldNames: Ref<InternalFieldNames>;
|
|
values: Ref<SingleValueType[]>;
|
|
halfValues: Ref<SingleValueType[]>;
|
|
changeOnSelect: Ref<boolean>;
|
|
onSelect: (valuePath: SingleValueType) => void;
|
|
checkable: Ref<boolean | VueNode>;
|
|
searchOptions: Ref<DefaultOptionType[]>;
|
|
dropdownPrefixCls?: Ref<string>;
|
|
loadData: Ref<(selectOptions: DefaultOptionType[]) => void>;
|
|
expandTrigger: Ref<'hover' | 'click'>;
|
|
expandIcon: Ref<VueNode>;
|
|
loadingIcon: Ref<VueNode>;
|
|
dropdownMenuColumnStyle: Ref<CSSProperties>;
|
|
customSlots: Ref<Record<string, Function>>;
|
|
}
|
|
|
|
const CascaderContextKey: InjectionKey<CascaderContextProps> = Symbol('CascaderContextKey');
|
|
export const useProvideCascader = (props: CascaderContextProps) => {
|
|
provide(CascaderContextKey, props);
|
|
};
|
|
|
|
export const useInjectCascader = () => {
|
|
return inject(CascaderContextKey);
|
|
};
|