Merge remote-tracking branch 'origin/master' into feat-vue3

# Conflicts:
#	antdv-demo
#	components/_util/store/connect.jsx
#	components/locale-provider/__tests__/__snapshots__/index.test.js.snap
#	package.json
pull/2502/head
tangjinzhou 2020-06-28 23:11:31 +08:00
parent 19e4e27814
commit 0c851369e0
7 changed files with 142 additions and 220 deletions

View File

@ -127,7 +127,7 @@ const getOptionProps = instance => {
}
return res;
};
const getComponent = (instance, prop, options = instance, execute = true) => {
const getComponent = (instance, prop = 'default', options = instance, execute = true) => {
if (instance.$) {
const temp = instance[prop];
if (temp !== undefined) {
@ -231,9 +231,6 @@ const getAttrs = ele => {
const getKey = ele => {
let key = ele.key;
if (ele.$vnode) {
key = ele.$vnode.key;
}
return key;
};

View File

@ -1,6 +1,6 @@
import { reactive, provide } from 'vue';
import PropTypes from '../_util/vue-types';
import { getComponentFromProp } from '../_util/props-util';
import { getComponent } from '../_util/props-util';
import defaultRenderEmpty from './renderEmpty';
import LocaleProvider, { ANT_MARK } from '../locale-provider';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
@ -51,10 +51,9 @@ const ConfigProvider = {
]),
},
methods: {
renderEmptyComponent(h, name) {
const renderEmpty =
getComponentFromProp(this, 'renderEmpty', {}, false) || defaultRenderEmpty;
return renderEmpty(h, name);
renderEmptyComponent(name) {
const renderEmpty = getComponent(this, 'renderEmpty', {}, false) || defaultRenderEmpty;
return renderEmpty(name);
},
getPrefixCls(suffixCls, customizePrefixCls) {
const { prefixCls = 'ant' } = this.$props;

View File

@ -1,14 +1,15 @@
import { provide, inject } from 'vue';
import warning from '../_util/warning';
import omit from 'omit.js';
import PropTypes from '../_util/vue-types';
import { Select as VcSelect, Option, OptGroup } from '../vc-select';
import { ConfigConsumerProps } from '../config-provider';
import {
getComponentFromProp,
getComponent,
getOptionProps,
filterEmpty,
isValidElement,
getListeners,
getSlot,
} from '../_util/props-util';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled';
@ -16,7 +17,6 @@ import CheckOutlined from '@ant-design/icons-vue/CheckOutlined';
import DownOutlined from '@ant-design/icons-vue/DownOutlined';
import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined';
import { cloneElement } from '../_util/vnode';
import Base from '../base';
const AbstractSelectProps = () => ({
prefixCls: PropTypes.string,
@ -107,19 +107,17 @@ const Select = {
choiceTransitionName: PropTypes.string.def('zoom'),
},
propTypes: SelectPropTypes,
model: {
prop: 'value',
event: 'change',
},
provide() {
// model: {
// prop: 'value',
// event: 'change',
// },
setup() {
return {
savePopupRef: this.savePopupRef,
configProvider: inject('configProvider', ConfigConsumerProps),
};
},
inject: {
configProvider: { default: () => ConfigConsumerProps },
},
created() {
provide('savePopupRef', this.savePopupRef);
warning(
this.$props.mode !== 'combobox',
'Select',
@ -130,15 +128,14 @@ const Select = {
},
methods: {
getNotFoundContent(renderEmpty) {
const h = this.$createElement;
const notFoundContent = getComponentFromProp(this, 'notFoundContent');
const notFoundContent = getComponent(this, 'notFoundContent');
if (notFoundContent !== undefined) {
return notFoundContent;
}
if (this.isCombobox()) {
return null;
}
return renderEmpty(h, 'Select');
return renderEmpty('Select');
},
savePopupRef(ref) {
this.popupRef = ref;
@ -157,7 +154,7 @@ const Select = {
renderSuffixIcon(prefixCls) {
const { loading } = this.$props;
let suffixIcon = getComponentFromProp(this, 'suffixIcon');
let suffixIcon = getComponent(this, 'suffixIcon');
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
if (suffixIcon) {
return isValidElement(suffixIcon)
@ -180,17 +177,18 @@ const Select = {
showArrow,
...restProps
} = getOptionProps(this);
const { class: className } = this.$attrs;
const getPrefixCls = this.configProvider.getPrefixCls;
const renderEmpty = this.configProvider.renderEmpty;
const prefixCls = getPrefixCls('select', customizePrefixCls);
const { getPopupContainer: getContextPopupContainer } = this.configProvider;
let removeIcon = getComponentFromProp(this, 'removeIcon');
let removeIcon = getComponent(this, 'removeIcon');
removeIcon = Array.isArray(removeIcon) ? removeIcon[0] : removeIcon;
let clearIcon = getComponentFromProp(this, 'clearIcon');
let clearIcon = getComponent(this, 'clearIcon');
clearIcon = Array.isArray(clearIcon) ? clearIcon[0] : clearIcon;
let menuItemSelectedIcon = getComponentFromProp(this, 'menuItemSelectedIcon');
let menuItemSelectedIcon = getComponent(this, 'menuItemSelectedIcon');
menuItemSelectedIcon = Array.isArray(menuItemSelectedIcon)
? menuItemSelectedIcon[0]
: menuItemSelectedIcon;
@ -203,6 +201,7 @@ const Select = {
]);
const cls = {
[className]: className,
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
[`${prefixCls}-show-arrow`]: showArrow,
@ -235,34 +234,32 @@ const Select = {
: menuItemSelectedIcon)) || <CheckOutlined class={`${prefixCls}-selected-icon`} />;
const selectProps = {
props: {
inputIcon: this.renderSuffixIcon(prefixCls),
removeIcon: finalRemoveIcon,
clearIcon: finalClearIcon,
menuItemSelectedIcon: finalMenuItemSelectedIcon,
showArrow,
...rest,
...modeConfig,
prefixCls,
optionLabelProp: optionLabelProp || 'children',
notFoundContent: this.getNotFoundContent(renderEmpty),
maxTagPlaceholder: getComponentFromProp(this, 'maxTagPlaceholder'),
placeholder: getComponentFromProp(this, 'placeholder'),
children: options
? options.map(option => {
const { key, label = option.title, on, class: cls, style, ...restOption } = option;
return (
<Option key={key} {...{ props: restOption, on, class: cls, style }}>
{label}
</Option>
);
})
: filterEmpty(this.$slots.default),
__propsSymbol__: Symbol(),
dropdownRender: getComponentFromProp(this, 'dropdownRender', {}, false),
getPopupContainer: getPopupContainer || getContextPopupContainer,
},
on: getListeners(this),
inputIcon: this.renderSuffixIcon(prefixCls),
removeIcon: finalRemoveIcon,
clearIcon: finalClearIcon,
menuItemSelectedIcon: finalMenuItemSelectedIcon,
showArrow,
...rest,
...modeConfig,
prefixCls,
optionLabelProp: optionLabelProp || 'children',
notFoundContent: this.getNotFoundContent(renderEmpty),
maxTagPlaceholder: getComponent(this, 'maxTagPlaceholder'),
placeholder: getComponent(this, 'placeholder'),
children: options
? options.map(option => {
const { key, label = option.title, on, class: cls, style, ...restOption } = option;
return (
<Option key={key} {...{ on, class: cls, style, ...restOption }}>
{label}
</Option>
);
})
: filterEmpty(getSlot(this)),
__propsSymbol__: Symbol(),
dropdownRender: getComponent(this, 'dropdownRender', {}, false),
getPopupContainer: getPopupContainer || getContextPopupContainer,
...this.$attrs,
class: cls,
ref: 'vcSelect',
};
@ -271,11 +268,9 @@ const Select = {
};
/* istanbul ignore next */
Select.install = function(Vue) {
Vue.use(Base);
Vue.component(Select.name, Select);
Vue.component(Select.Option.name, Select.Option);
Vue.component(Select.OptGroup.name, Select.OptGroup);
Select.install = function(app) {
app.component(Select.name, Select);
app.component(Select.Option.name, Select.Option);
app.component(Select.OptGroup.name, Select.OptGroup);
};
export default Select;

View File

@ -56,4 +56,6 @@ export const SelectPropTypes = {
dropdownMenuStyle: PropTypes.object,
notFoundContent: PropTypes.oneOfType([String, Number]),
tabIndex: PropTypes.oneOfType([String, Number]),
__propsSymbol__: PropTypes.any,
children: PropTypes.array,
};

View File

@ -4,7 +4,6 @@ import classnames from 'classnames';
import classes from 'component-classes';
import { Item as MenuItem, ItemGroup as MenuItemGroup } from '../vc-menu';
import warning from 'warning';
import Vue from 'vue';
import Option from './Option';
import OptGroup from './OptGroup';
import {
@ -12,20 +11,15 @@ import {
getSlotOptions,
getPropsData,
getValueByProp as getValue,
getComponentFromProp,
getComponent,
getEvents,
getClass,
getStyle,
getAttrs,
getOptionProps,
getSlots,
getListeners,
} from '../_util/props-util';
import getTransitionProps from '../_util/getTransitionProps';
import { cloneElement } from '../_util/vnode';
import BaseMixin from '../_util/BaseMixin';
import proxyComponent from '../_util/proxyComponent';
import ref from 'vue-ref';
import SelectTrigger from './SelectTrigger';
import {
defaultFilterFn,
@ -54,7 +48,6 @@ import { SelectPropTypes } from './PropTypes';
import contains from '../vc-util/Dom/contains';
import { isIE, isEdge } from '../_util/env';
Vue.use(ref, { name: 'ant-ref' });
const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY';
const noop = () => null;
@ -670,11 +663,9 @@ const Select = {
const placeholder = props.placeholder;
if (placeholder) {
const p = {
on: {
mousedown: preventDefaultEvent,
click: this.onPlaceholderClick,
},
attrs: UNSELECTABLE_ATTRIBUTE,
onMousedown: preventDefaultEvent,
onClick: this.onPlaceholderClick,
...UNSELECTABLE_ATTRIBUTE,
style: {
display: hidden ? 'none' : 'block',
...UNSELECTABLE_STYLE,
@ -810,51 +801,28 @@ const Select = {
return (
<div class={`${props.prefixCls}-search__field__wrap`} onClick={this.inputClick}>
{cloneElement(inputElement, {
props: {
disabled: props.disabled,
value: inputValue,
},
attrs: {
...(inputElement.data.attrs || {}),
disabled: props.disabled,
value: inputValue,
},
domProps: {
value: inputValue,
},
disabled: props.disabled,
value: inputValue,
...(inputElement.data.attrs || {}),
disabled: props.disabled,
value: inputValue,
class: inputCls,
ref: this.saveInputRef,
directives: [
{
name: 'ant-ref',
value: this.saveInputRef,
},
{
name: 'ant-input',
},
],
on: {
input: this.onInputChange,
keydown: chaining(
this.onInputKeydown,
inputEvents.keydown,
getListeners(this).inputKeydown,
),
focus: chaining(this.inputFocus, inputEvents.focus),
blur: chaining(this.inputBlur, inputEvents.blur),
},
onInput: this.onInputChange,
onKeydown: chaining(
this.onInputKeydown,
inputEvents.onKeydown,
this.$attrs.onInputKeydown,
),
onFocus: chaining(this.inputFocus, inputEvents.onFocus),
onBlur: chaining(this.inputBlur, inputEvents.onBlur),
})}
<span
{...{
directives: [
{
name: 'ant-ref',
value: this.saveInputMirrorRef,
},
],
}}
// ref='inputMirrorRef'
class={`${props.prefixCls}-search__field__mirror`}
>
<span ref={this.saveInputMirrorRef} class={`${props.prefixCls}-search__field__mirror`}>
{_mirrorInputValue}&nbsp;
</span>
</div>
@ -1177,7 +1145,7 @@ const Select = {
role: 'option',
};
const menuItem = (
<MenuItem style={UNSELECTABLE_STYLE} {...{ attrs }} value={key} key={key}>
<MenuItem style={UNSELECTABLE_STYLE} {...attrs} value={key} key={key}>
{key}
</MenuItem>
);
@ -1187,12 +1155,10 @@ const Select = {
// ref: https://github.com/ant-design/ant-design/issues/14090
if (inputValue && menuItems.every(option => getValuePropValue(option) !== inputValue)) {
const p = {
attrs: UNSELECTABLE_ATTRIBUTE,
...UNSELECTABLE_ATTRIBUTE,
key: inputValue,
props: {
value: inputValue,
role: 'option',
},
value: inputValue,
role: 'option',
style: UNSELECTABLE_STYLE,
};
options.unshift(<MenuItem {...p}>{inputValue}</MenuItem>);
@ -1202,13 +1168,11 @@ const Select = {
if (!options.length && notFoundContent) {
empty = true;
const p = {
attrs: UNSELECTABLE_ATTRIBUTE,
...UNSELECTABLE_ATTRIBUTE,
key: 'NOT_FOUND',
props: {
value: 'NOT_FOUND',
disabled: true,
role: 'option',
},
value: 'NOT_FOUND',
disabled: true,
role: 'option',
style: UNSELECTABLE_STYLE,
};
options = [<MenuItem {...p}>{notFoundContent}</MenuItem>];
@ -1222,32 +1186,38 @@ const Select = {
const { _inputValue: inputValue } = this.$data;
const tags = props.tags;
children.forEach(child => {
if (!child.data || child.data.slot !== undefined) {
const type = child.type;
warning(
typeof type === 'object' && type.isSelectOption,
'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' +
`instead of \`${getSlotOptions(child).name || getSlotOptions(child)}\`.`,
);
if (typeof type !== 'object' || !type.isSelectOption) {
return;
}
if (getSlotOptions(child).isSelectOptGroup) {
let label = getComponentFromProp(child, 'label');
if (type.isSelectOptGroup) {
let label = getComponent(child, 'label');
let key = child.key;
if (!key && typeof label === 'string') {
key = label;
} else if (!label && key) {
label = key;
}
let childChildren = getSlots(child).default;
childChildren = typeof childChildren === 'function' ? childChildren() : childChildren;
let childChildren = getComponent(child);
childChildren = Array.isArray(childChildren) ? childChildren : [childChildren];
// Match option group label
if (inputValue && this._filterOption(inputValue, child)) {
const innerItems = childChildren.map(subChild => {
const childValueSub = getValuePropValue(subChild) || subChild.key;
return (
<MenuItem key={childValueSub} value={childValueSub} {...subChild.data}>
{subChild.componentOptions.children}
<MenuItem key={childValueSub} value={childValueSub} {...subChild.props}>
{subChild.children?.default()}
</MenuItem>
);
});
sel.push(
<MenuItemGroup key={key} title={label} class={getClass(child)}>
<MenuItemGroup key={key} title={label} class={child.props?.class}>
{innerItems}
</MenuItemGroup>,
);
@ -1261,7 +1231,7 @@ const Select = {
);
if (innerItems.length) {
sel.push(
<MenuItemGroup key={key} title={label} {...child.data}>
<MenuItemGroup key={key} title={label} {...child.props}>
{innerItems}
</MenuItemGroup>,
);
@ -1270,32 +1240,21 @@ const Select = {
return;
}
warning(
getSlotOptions(child).isSelectOption,
'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' +
`instead of \`${getSlotOptions(child).name || getSlotOptions(child)}\`.`,
);
const childValue = getValuePropValue(child);
validateOptionValue(childValue, this.$props);
if (this._filterOption(inputValue, child)) {
const p = {
attrs: {
...UNSELECTABLE_ATTRIBUTE,
...getAttrs(child),
},
...UNSELECTABLE_ATTRIBUTE,
key: childValue,
props: {
value: childValue,
...getPropsData(child),
role: 'option',
},
value: childValue,
...getPropsData(child),
role: 'option',
style: UNSELECTABLE_STYLE,
on: getEvents(child),
class: getClass(child),
class: child?.class,
};
const menuItem = <MenuItem {...p}>{child.componentOptions.children}</MenuItem>;
const menuItem = <MenuItem {...p}>{child.children?.default()}</MenuItem>;
sel.push(menuItem);
menuItems.push(menuItem);
}
@ -1318,7 +1277,7 @@ const Select = {
maxTagPlaceholder,
showSearch,
} = props;
const removeIcon = getComponentFromProp(this, 'removeIcon');
const removeIcon = getComponent(this, 'removeIcon');
const className = `${prefixCls}-selection__rendered`;
// search input is inside topControlNode in single, multiple & combobox. 2016/04/13
let innerNode = null;
@ -1391,7 +1350,7 @@ const Select = {
maxTagPlaceholderEl = (
<li
style={UNSELECTABLE_STYLE}
{...{ attrs }}
{...attrs}
onMousedown={preventDefaultEvent}
class={`${prefixCls}-selection__choice ${prefixCls}-selection__choice__disabled`}
key="maxTagPlaceholder"
@ -1425,7 +1384,7 @@ const Select = {
return (
<li
style={UNSELECTABLE_STYLE}
{...{ attrs }}
{...attrs}
onMousedown={preventDefaultEvent}
class={choiceClassName}
key={singleValue || SELECT_EMPTY_VALUE_KEY}
@ -1467,18 +1426,7 @@ const Select = {
}
}
return (
<div
class={className}
{...{
directives: [
{
name: 'ant-ref',
value: this.saveTopCtrlRef,
},
],
}}
onClick={this.topCtrlContainerClick}
>
<div class={className} ref={this.saveTopCtrlRef} onClick={this.topCtrlContainerClick}>
{this.getPlaceholderElement()}
{innerNode}
</div>
@ -1487,7 +1435,7 @@ const Select = {
renderArrow(multiple) {
// showArrow : Set to true if not multiple by default but keep set value.
const { showArrow = !multiple, loading, prefixCls } = this.$props;
const inputIcon = getComponentFromProp(this, 'inputIcon');
const inputIcon = getComponent(this, 'inputIcon');
if (!showArrow && !loading) {
return null;
}
@ -1502,7 +1450,7 @@ const Select = {
key="arrow"
class={`${prefixCls}-arrow`}
style={UNSELECTABLE_STYLE}
{...{ attrs: UNSELECTABLE_ATTRIBUTE }}
{...UNSELECTABLE_ATTRIBUTE}
onClick={this.onArrowClick}
ref="arrow"
>
@ -1518,14 +1466,14 @@ const Select = {
renderClear() {
const { prefixCls, allowClear } = this.$props;
const { _value: value, _inputValue: inputValue } = this.$data;
const clearIcon = getComponentFromProp(this, 'clearIcon');
const clearIcon = getComponent(this, 'clearIcon');
const clear = (
<span
key="clear"
class={`${prefixCls}-selection__clear`}
onMousedown={preventDefaultEvent}
style={UNSELECTABLE_STYLE}
{...{ attrs: UNSELECTABLE_ATTRIBUTE }}
{...UNSELECTABLE_ATTRIBUTE}
onClick={this.onClearSelection}
>
{clearIcon || <i class={`${prefixCls}-selection__clear-icon`}>×</i>}
@ -1582,12 +1530,12 @@ const Select = {
render() {
const props = this.$props;
const { class: className, style } = this.$attrs;
const multiple = isMultipleOrTags(props);
// Default set showArrow to true if not set (not set directly in defaultProps to handle multiple case)
const { showArrow = true } = props;
const state = this.$data;
const { disabled, prefixCls, loading } = props;
const ctrlNode = this.renderTopControlNode();
const { _open: open, _inputValue: inputValue, _value: value } = this.$data;
if (open) {
const filterOptions = this.renderFilterOptions();
@ -1597,26 +1545,13 @@ const Select = {
const realOpen = this.getRealOpenState();
const empty = this._empty;
const options = this._options || [];
const { mouseenter = noop, mouseleave = noop, popupScroll = noop } = getListeners(this);
const selectionProps = {
props: {},
attrs: {
role: 'combobox',
'aria-autocomplete': 'list',
'aria-haspopup': 'true',
'aria-expanded': realOpen,
'aria-controls': this.$data._ariaId,
},
on: {
// click: this.selectionRefClick,
},
role: 'combobox',
'aria-autocomplete': 'list',
'aria-haspopup': 'true',
'aria-expanded': realOpen,
'aria-controls': this.$data._ariaId,
class: `${prefixCls}-selection ${prefixCls}-selection--${multiple ? 'multiple' : 'single'}`,
// directives: [
// {
// name: 'ant-ref',
// value: this.saveSelectionRef,
// },
// ],
key: 'selection',
};
//if (!isMultipleOrTagsOrCombobox(props)) {
@ -1626,6 +1561,7 @@ const Select = {
// selectionProps.attrs.tabIndex = props.disabled ? -1 : props.tabIndex;
//}
const rootCls = {
[className]: className,
[prefixCls]: true,
[`${prefixCls}-open`]: open,
[`${prefixCls}-focused`]: open || !!this._focused,
@ -1662,26 +1598,19 @@ const Select = {
getPopupContainer={props.getPopupContainer}
onMenuSelect={this.onMenuSelect}
onMenuDeselect={this.onMenuDeselect}
onPopupScroll={popupScroll}
onPopupScroll={this.$attrs.onPopupScroll}
onPopupFocus={this.onPopupFocus}
onMouseenter={mouseenter}
onMouseleave={mouseleave}
onMouseenter={this.$attrs.onMouseenter}
onMouseleave={this.$attrs.onMouseleave}
showAction={props.showAction}
menuItemSelectedIcon={getComponentFromProp(this, 'menuItemSelectedIcon')}
menuItemSelectedIcon={getComponent(this, 'menuItemSelectedIcon')}
ref={this.saveSelectTriggerRef}
dropdownRender={props.dropdownRender}
ariaId={this.$data._ariaId}
>
<div
{...{
directives: [
{
name: 'ant-ref',
value: chaining(this.saveRootRef, this.saveSelectionRef),
},
],
}}
style={getStyle(this)}
ref={chaining(this.saveRootRef, this.saveSelectionRef)}
style={style}
class={classnames(rootCls)}
onMousedown={this.markMouseDown}
onMouseup={this.markMouseLeave}
@ -1693,7 +1622,7 @@ const Select = {
onKeydown={isMultipleOrTagsOrCombobox(props) ? noop : this.onKeyDown}
>
<div {...selectionProps}>
{ctrlNode}
{this.renderTopControlNode()}
{this.renderClear()}
{this.renderArrow(!!multiple)}
</div>
@ -1703,4 +1632,4 @@ const Select = {
},
};
export { Select };
export default proxyComponent(Select);
export default Select;

View File

@ -1,11 +1,5 @@
import {
getPropsData,
getSlotOptions,
getKey,
getAttrs,
getComponentFromProp,
} from '../_util/props-util';
import { cloneVNodes } from '../_util/vnode';
import { getPropsData, getSlotOptions, getKey, getComponent } from '../_util/props-util';
import { cloneElement } from '../_util/vnode';
export function toTitle(title) {
if (typeof title === 'string') {
@ -24,8 +18,8 @@ export function getValuePropValue(child) {
if (getKey(child) !== undefined) {
return getKey(child);
}
if (getSlotOptions(child).isSelectOptGroup) {
const label = getComponentFromProp(child, 'label');
if (typeof child.type === 'object' && child.type.isSelectOptGroup) {
const label = getComponent(child, 'label');
if (label) {
return label;
}
@ -39,8 +33,8 @@ export function getPropValue(child, prop) {
}
if (prop === 'children') {
const newChild = child.$slots
? cloneVNodes(child.$slots.default, true)
: cloneVNodes(child.componentOptions.children, true);
? cloneElement(child.$slots.default)
: cloneElement(child.componentOptions.children);
if (newChild.length === 1 && !newChild[0].tag) {
return newChild[0].text;
}
@ -50,7 +44,7 @@ export function getPropValue(child, prop) {
if (prop in data) {
return data[prop];
} else {
return getAttrs(child)[prop];
return child.props && child.props[prop];
}
}

View File

@ -2,7 +2,14 @@ import { inject, provide } from 'vue';
import antRef from '../_util/ant-ref';
import PropTypes from '../_util/vue-types';
import contains from '../vc-util/Dom/contains';
import { hasProp, getComponent, getEvents, filterEmpty, getSlot } from '../_util/props-util';
import {
hasProp,
getComponent,
getEvents,
filterEmpty,
getSlot,
findDOMNode,
} from '../_util/props-util';
import { requestAnimationTimeout, cancelAnimationTimeout } from '../_util/requestAnimationTimeout';
import addEventListener from '../vc-util/Dom/addEventListener';
import warning from '../_util/warning';
@ -324,7 +331,7 @@ export default {
},
getRootDomNode() {
return this.$refs.trigger.$el || this.$refs.trigger;
return findDOMNode(this);
},
handleGetPopupClassFromAlign(align) {
@ -583,7 +590,6 @@ export default {
this.childOriginEvents = getEvents(child);
const newChildProps = {
key: 'trigger',
ref: 'trigger',
};
if (this.isContextmenuToShow()) {