UNPKG

yanzhen-design-vue

Version:

49 lines (48 loc) 1.44 kB
import { useAttrs, useSlots, computed, mergeProps, unref } from "vue"; import { pick } from "lodash-es"; import { mergeWith } from "@yanzhen-libs/utils"; import { useProxyProps } from "@yanzhen-libs/utils-vue"; import { AntCascader } from "../cascader.mjs"; function useCascaderConfig(props, emit) { const attrs = useAttrs(); const slots = useSlots(); const config = computed(() => { const config2 = pick(props, ...Object.keys(AntCascader.props)); return mergeWith(config2, { expandTrigger: props.subMenuTrigger ?? props.expandTrigger, removeIcon: slots.removeIcon ?? props.removeIcon, clearIcon: slots.clearIcon ?? props.clearIcon, expandIcon: slots.expandIcon ?? props.expandIcon, suffixIcon: slots.suffixIcon ?? props.suffixIcon, notFoundContent: slots.notFoundContent ?? props.notFoundContent, ariaDisabled: props.disabled ?? props.loading, disabled: props.disabled ?? props.loading }); }); const proxyProps = useProxyProps(config, AntCascader.emits, { emit, exclude: [ "value", "loadData", "options", // 'fieldNames', "onUpdate:value", "onChange", "onDropdownVisibleChange" ], filter: true }); const propsRef = computed(() => { return mergeProps(unref(attrs), unref(proxyProps)); }); return { attrs, slots, config, proxyProps, propsRef }; } export { useCascaderConfig };