fix: cannot select when use custom prefixCls #5023
parent
47066753ac
commit
46b216274f
|
@ -34,7 +34,7 @@ const AutoComplete = defineComponent({
|
||||||
...autoCompleteProps,
|
...autoCompleteProps,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
showSearch: PropTypes.looseBool,
|
showSearch: PropTypes.looseBool,
|
||||||
transitionName: PropTypes.string.def('ant-slide-up'),
|
transitionName: PropTypes.string,
|
||||||
choiceTransitionName: PropTypes.string.def('zoom'),
|
choiceTransitionName: PropTypes.string.def('zoom'),
|
||||||
autofocus: PropTypes.looseBool,
|
autofocus: PropTypes.looseBool,
|
||||||
backfill: PropTypes.looseBool,
|
backfill: PropTypes.looseBool,
|
||||||
|
|
|
@ -28,6 +28,7 @@ import { tuple, withInstall } from '../_util/type';
|
||||||
import type { RenderEmptyHandler } from '../config-provider/renderEmpty';
|
import type { RenderEmptyHandler } from '../config-provider/renderEmpty';
|
||||||
import { useInjectFormItemContext } from '../form/FormItemContext';
|
import { useInjectFormItemContext } from '../form/FormItemContext';
|
||||||
import omit from '../_util/omit';
|
import omit from '../_util/omit';
|
||||||
|
import { getTransitionName } from '../_util/transition';
|
||||||
|
|
||||||
export interface CascaderOptionType {
|
export interface CascaderOptionType {
|
||||||
value?: string | number;
|
value?: string | number;
|
||||||
|
@ -113,7 +114,7 @@ const cascaderProps = {
|
||||||
// onChange?: (value: string[], selectedOptions?: CascaderOptionType[]) => void;
|
// onChange?: (value: string[], selectedOptions?: CascaderOptionType[]) => void;
|
||||||
/** 选择后展示的渲染函数 */
|
/** 选择后展示的渲染函数 */
|
||||||
displayRender: PropTypes.func,
|
displayRender: PropTypes.func,
|
||||||
transitionName: PropTypes.string.def('ant-slide-up'),
|
transitionName: PropTypes.string,
|
||||||
popupStyle: PropTypes.object.def(() => ({})),
|
popupStyle: PropTypes.object.def(() => ({})),
|
||||||
/** 自定义浮层类名 */
|
/** 自定义浮层类名 */
|
||||||
popupClassName: PropTypes.string,
|
popupClassName: PropTypes.string,
|
||||||
|
@ -487,6 +488,7 @@ const Cascader = defineComponent({
|
||||||
} = extraAttrs;
|
} = extraAttrs;
|
||||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||||
const renderEmpty = this.configProvider.renderEmpty;
|
const renderEmpty = this.configProvider.renderEmpty;
|
||||||
|
const rootPrefixCls = getPrefixCls();
|
||||||
const prefixCls = getPrefixCls('cascader', customizePrefixCls);
|
const prefixCls = getPrefixCls('cascader', customizePrefixCls);
|
||||||
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
|
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
|
||||||
|
|
||||||
|
@ -636,6 +638,7 @@ const Cascader = defineComponent({
|
||||||
...onEvents,
|
...onEvents,
|
||||||
onPopupVisibleChange: this.handlePopupVisibleChange,
|
onPopupVisibleChange: this.handlePopupVisibleChange,
|
||||||
onChange: this.handleChange,
|
onChange: this.handleChange,
|
||||||
|
transitionName: getTransitionName(rootPrefixCls, 'slide-up', props.transitionName),
|
||||||
};
|
};
|
||||||
return <VcCascader {...cascaderProps}>{input}</VcCascader>;
|
return <VcCascader {...cascaderProps}>{input}</VcCascader>;
|
||||||
},
|
},
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default defineComponent({
|
||||||
],
|
],
|
||||||
slots: ['expandIcon', 'overflowedIndicator'],
|
slots: ['expandIcon', 'overflowedIndicator'],
|
||||||
setup(props, { slots, emit, attrs }) {
|
setup(props, { slots, emit, attrs }) {
|
||||||
const { prefixCls, direction } = useConfigInject('menu', props);
|
const { prefixCls, direction, getPrefixCls } = useConfigInject('menu', props);
|
||||||
const store = ref<Record<string, StoreMenuInfo>>({});
|
const store = ref<Record<string, StoreMenuInfo>>({});
|
||||||
const siderCollapsed = inject(SiderCollapsedKey, ref(undefined));
|
const siderCollapsed = inject(SiderCollapsedKey, ref(undefined));
|
||||||
const inlineCollapsed = computed(() => {
|
const inlineCollapsed = computed(() => {
|
||||||
|
@ -293,12 +293,12 @@ export default defineComponent({
|
||||||
[`${prefixCls.value}-${props.theme}`]: true,
|
[`${prefixCls.value}-${props.theme}`]: true,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
const rootPrefixCls = computed(() => getPrefixCls());
|
||||||
const defaultMotions = {
|
const defaultMotions = computed(() => ({
|
||||||
horizontal: { name: `ant-slide-up` },
|
horizontal: { name: `${rootPrefixCls.value}-slide-up` },
|
||||||
inline: collapseMotion,
|
inline: collapseMotion,
|
||||||
other: { name: `ant-zoom-big` },
|
other: { name: `${rootPrefixCls.value}-zoom-big` },
|
||||||
};
|
}));
|
||||||
|
|
||||||
useProvideFirstLevel(true);
|
useProvideFirstLevel(true);
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ export default defineComponent({
|
||||||
inlineCollapsed: mergedInlineCollapsed,
|
inlineCollapsed: mergedInlineCollapsed,
|
||||||
antdMenuTheme: computed(() => props.theme),
|
antdMenuTheme: computed(() => props.theme),
|
||||||
siderCollapsed,
|
siderCollapsed,
|
||||||
defaultMotions: computed(() => (isMounted.value ? defaultMotions : null)),
|
defaultMotions: computed(() => (isMounted.value ? defaultMotions.value : null)),
|
||||||
motion: computed(() => (isMounted.value ? props.motion : null)),
|
motion: computed(() => (isMounted.value ? props.motion : null)),
|
||||||
overflowDisabled: ref(undefined),
|
overflowDisabled: ref(undefined),
|
||||||
onOpenChange: onInternalOpenChange,
|
onOpenChange: onInternalOpenChange,
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { tuple } from '../_util/type';
|
||||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||||
import omit from '../_util/omit';
|
import omit from '../_util/omit';
|
||||||
import { useInjectFormItemContext } from '../form/FormItemContext';
|
import { useInjectFormItemContext } from '../form/FormItemContext';
|
||||||
|
import { getTransitionName } from '../_util/transition';
|
||||||
|
|
||||||
type RawValue = string | number;
|
type RawValue = string | number;
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export const selectProps = () => ({
|
||||||
size: PropTypes.oneOf(tuple('small', 'middle', 'large', 'default')),
|
size: PropTypes.oneOf(tuple('small', 'middle', 'large', 'default')),
|
||||||
mode: PropTypes.oneOf(tuple('multiple', 'tags', 'SECRET_COMBOBOX_MODE_DO_NOT_USE')),
|
mode: PropTypes.oneOf(tuple('multiple', 'tags', 'SECRET_COMBOBOX_MODE_DO_NOT_USE')),
|
||||||
bordered: PropTypes.looseBool.def(true),
|
bordered: PropTypes.looseBool.def(true),
|
||||||
transitionName: PropTypes.string.def('ant-slide-up'),
|
transitionName: PropTypes.string,
|
||||||
choiceTransitionName: PropTypes.string.def(''),
|
choiceTransitionName: PropTypes.string.def(''),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -89,7 +90,11 @@ const Select = defineComponent({
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
});
|
});
|
||||||
const { prefixCls, direction, configProvider } = useConfigInject('select', props);
|
const { prefixCls, direction, configProvider, getPrefixCls } = useConfigInject('select', props);
|
||||||
|
const rootPrefixCls = computed(() => getPrefixCls());
|
||||||
|
const transitionName = computed(() =>
|
||||||
|
getTransitionName(rootPrefixCls.value, 'slide-up', props.transitionName),
|
||||||
|
);
|
||||||
const mergedClassName = computed(() =>
|
const mergedClassName = computed(() =>
|
||||||
classNames({
|
classNames({
|
||||||
[`${prefixCls.value}-lg`]: props.size === 'large',
|
[`${prefixCls.value}-lg`]: props.size === 'large',
|
||||||
|
@ -189,6 +194,7 @@ const Select = defineComponent({
|
||||||
id={id}
|
id={id}
|
||||||
dropdownRender={selectProps.dropdownRender || slots.dropdownRender}
|
dropdownRender={selectProps.dropdownRender || slots.dropdownRender}
|
||||||
v-slots={{ option: slots.option }}
|
v-slots={{ option: slots.option }}
|
||||||
|
transitionName={transitionName.value}
|
||||||
>
|
>
|
||||||
{slots.default?.()}
|
{slots.default?.()}
|
||||||
</RcSelect>
|
</RcSelect>
|
||||||
|
|
|
@ -57,7 +57,6 @@ const TreeSelect = defineComponent({
|
||||||
name: 'ATreeSelect',
|
name: 'ATreeSelect',
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
props: initDefaultProps(treeSelectProps, {
|
props: initDefaultProps(treeSelectProps, {
|
||||||
transitionName: 'ant-slide-up',
|
|
||||||
choiceTransitionName: '',
|
choiceTransitionName: '',
|
||||||
listHeight: 256,
|
listHeight: 256,
|
||||||
treeIcon: false,
|
treeIcon: false,
|
||||||
|
@ -101,7 +100,15 @@ const TreeSelect = defineComponent({
|
||||||
dropdownMatchSelectWidth,
|
dropdownMatchSelectWidth,
|
||||||
size,
|
size,
|
||||||
getPopupContainer,
|
getPopupContainer,
|
||||||
|
getPrefixCls,
|
||||||
} = useConfigInject('select', props);
|
} = useConfigInject('select', props);
|
||||||
|
const rootPrefixCls = computed(() => getPrefixCls());
|
||||||
|
const transitionName = computed(() =>
|
||||||
|
getTransitionName(rootPrefixCls.value, 'slide-up', props.transitionName),
|
||||||
|
);
|
||||||
|
const choiceTransitionName = computed(() =>
|
||||||
|
getTransitionName(rootPrefixCls.value, '', props.choiceTransitionName),
|
||||||
|
);
|
||||||
const treePrefixCls = computed(() =>
|
const treePrefixCls = computed(() =>
|
||||||
configProvider.getPrefixCls('select-tree', props.prefixCls),
|
configProvider.getPrefixCls('select-tree', props.prefixCls),
|
||||||
);
|
);
|
||||||
|
@ -154,8 +161,6 @@ const TreeSelect = defineComponent({
|
||||||
listItemHeight,
|
listItemHeight,
|
||||||
multiple,
|
multiple,
|
||||||
treeIcon,
|
treeIcon,
|
||||||
transitionName,
|
|
||||||
choiceTransitionName,
|
|
||||||
treeLine,
|
treeLine,
|
||||||
switcherIcon = slots.switcherIcon?.(),
|
switcherIcon = slots.switcherIcon?.(),
|
||||||
fieldNames = props.replaceFields,
|
fieldNames = props.replaceFields,
|
||||||
|
@ -197,7 +202,6 @@ const TreeSelect = defineComponent({
|
||||||
},
|
},
|
||||||
attrs.class,
|
attrs.class,
|
||||||
);
|
);
|
||||||
const rootPrefixCls = configProvider.getPrefixCls();
|
|
||||||
const otherProps: any = {};
|
const otherProps: any = {};
|
||||||
if (props.treeData === undefined && slots.default) {
|
if (props.treeData === undefined && slots.default) {
|
||||||
otherProps.children = flattenChildren(slots.default());
|
otherProps.children = flattenChildren(slots.default());
|
||||||
|
@ -227,8 +231,7 @@ const TreeSelect = defineComponent({
|
||||||
getPopupContainer={getPopupContainer.value}
|
getPopupContainer={getPopupContainer.value}
|
||||||
treeMotion={null}
|
treeMotion={null}
|
||||||
dropdownClassName={mergedDropdownClassName.value}
|
dropdownClassName={mergedDropdownClassName.value}
|
||||||
choiceTransitionName={getTransitionName(rootPrefixCls, '', choiceTransitionName)}
|
choiceTransitionName={choiceTransitionName.value}
|
||||||
transitionName={getTransitionName(rootPrefixCls, 'slide-up', transitionName)}
|
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
onSearch={handleSearch}
|
onSearch={handleSearch}
|
||||||
|
@ -238,6 +241,7 @@ const TreeSelect = defineComponent({
|
||||||
treeCheckable: () => <span class={`${prefixCls.value}-tree-checkbox-inner`} />,
|
treeCheckable: () => <span class={`${prefixCls.value}-tree-checkbox-inner`} />,
|
||||||
}}
|
}}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
|
transitionName={transitionName.value}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue