perf: update listeners

pull/1741/head
tanjinzhou 2020-01-19 16:58:38 +08:00
parent 20ff3419e7
commit 4e65ae0e0a
89 changed files with 257 additions and 215 deletions

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
devComponent: 'table', devComponent: 'menu',
}; };

View File

@ -15,6 +15,7 @@ import {
mergeProps, mergeProps,
getComponentFromProp, getComponentFromProp,
isValidElement, isValidElement,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
@ -262,16 +263,16 @@ export default {
sShowDate: showDate, sShowDate: showDate,
sHoverValue: hoverValue, sHoverValue: hoverValue,
sOpen: open, sOpen: open,
$listeners,
$scopedSlots, $scopedSlots,
} = this; } = this;
const listeners = getListeners(this);
const { const {
calendarChange = noop, calendarChange = noop,
ok = noop, ok = noop,
focus = noop, focus = noop,
blur = noop, blur = noop,
panelChange = noop, panelChange = noop,
} = $listeners; } = listeners;
const { const {
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,
tagPrefixCls: customizeTagPrefixCls, tagPrefixCls: customizeTagPrefixCls,
@ -407,7 +408,7 @@ export default {
const vcDatePickerProps = mergeProps( const vcDatePickerProps = mergeProps(
{ {
props, props,
on: $listeners, on: listeners,
}, },
pickerChangeHandler, pickerChangeHandler,
{ {

View File

@ -9,6 +9,7 @@ import {
initDefaultProps, initDefaultProps,
getComponentFromProp, getComponentFromProp,
isValidElement, isValidElement,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { WeekPickerProps } from './interface'; import { WeekPickerProps } from './interface';
@ -149,16 +150,15 @@ export default {
localeCode, localeCode,
disabledDate, disabledDate,
$data, $data,
$listeners,
$scopedSlots, $scopedSlots,
} = this; } = this;
const listeners = getListeners(this);
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('calendar', customizePrefixCls); const prefixCls = getPrefixCls('calendar', customizePrefixCls);
this._prefixCls = prefixCls; this._prefixCls = prefixCls;
const { _value: pickerValue, _open: open } = $data; const { _value: pickerValue, _open: open } = $data;
const { focus = noop, blur = noop } = $listeners; const { focus = noop, blur = noop } = listeners;
if (pickerValue && localeCode) { if (pickerValue && localeCode) {
pickerValue.locale(localeCode); pickerValue.locale(localeCode);
@ -225,7 +225,7 @@ export default {
open, open,
}, },
on: { on: {
...$listeners, ...listeners,
change: this.handleChange, change: this.handleChange,
openChange: this.handleOpenChange, openChange: this.handleOpenChange,
}, },

View File

@ -3,7 +3,7 @@ import classNames from 'classnames';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { generateShowHourMinuteSecond } from '../time-picker'; import { generateShowHourMinuteSecond } from '../time-picker';
import enUS from './locale/en_US'; import enUS from './locale/en_US';
import { getOptionProps, initDefaultProps } from '../_util/props-util'; import { getOptionProps, initDefaultProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
const DEFAULT_FORMAT = { const DEFAULT_FORMAT = {
@ -168,7 +168,7 @@ export default function wrapPicker(Picker, props, pickerType) {
timePicker, timePicker,
}, },
on: { on: {
...this.$listeners, ...getListeners(this),
openChange: this.handleOpenChange, openChange: this.handleOpenChange,
focus: this.handleFocus, focus: this.handleFocus,
blur: this.handleBlur, blur: this.handleBlur,

View File

@ -3,7 +3,7 @@ import VcDrawer from '../vc-drawer/src';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import Icon from '../icon'; import Icon from '../icon';
import { getComponentFromProp, getOptionProps } from '../_util/props-util'; import { getComponentFromProp, getOptionProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Base from '../base'; import Base from '../base';
@ -214,7 +214,7 @@ const Drawer = {
}, },
on: { on: {
maskClick: this.onMaskClick, maskClick: this.onMaskClick,
...this.$listeners, ...getListeners(this),
}, },
}; };
return <VcDrawer {...vcDrawerProps}>{this.renderBody(prefixCls)}</VcDrawer>; return <VcDrawer {...vcDrawerProps}>{this.renderBody(prefixCls)}</VcDrawer>;

View File

@ -2,7 +2,12 @@ import RcDropdown from '../vc-dropdown/src/index';
import DropdownButton from './dropdown-button'; import DropdownButton from './dropdown-button';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import { getOptionProps, getPropsData, getComponentFromProp } from '../_util/props-util'; import {
getOptionProps,
getPropsData,
getComponentFromProp,
getListeners,
} from '../_util/props-util';
import getDropdownProps from './getDropdownProps'; import getDropdownProps from './getDropdownProps';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Icon from '../icon'; import Icon from '../icon';
@ -72,7 +77,7 @@ const Dropdown = {
}, },
render() { render() {
const { $slots, $listeners } = this; const { $slots } = this;
const props = getOptionProps(this); const props = getOptionProps(this);
const { prefixCls: customizePrefixCls, trigger, disabled, getPopupContainer } = props; const { prefixCls: customizePrefixCls, trigger, disabled, getPopupContainer } = props;
const { getPopupContainer: getContextPopupContainer } = this.configProvider; const { getPopupContainer: getContextPopupContainer } = this.configProvider;
@ -99,7 +104,7 @@ const Dropdown = {
transitionName: this.getTransitionName(), transitionName: this.getTransitionName(),
trigger: triggerActions, trigger: triggerActions,
}, },
on: $listeners, on: getListeners(this),
}; };
return ( return (
<RcDropdown {...dropdownProps}> <RcDropdown {...dropdownProps}>

View File

@ -1,6 +1,6 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import { getComponentFromProp } from '../_util/props-util'; import { getComponentFromProp, getListeners } from '../_util/props-util';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';
import emptyImg from './empty.svg'; import emptyImg from './empty.svg';
import Base from '../base'; import Base from '../base';
@ -43,7 +43,7 @@ const Empty = {
imageNode = image; imageNode = image;
} }
return ( return (
<div class={prefixCls} {...{ on: this.$listeners }}> <div class={prefixCls} {...{ on: getListeners(this) }}>
<div class={`${prefixCls}-image`}>{imageNode}</div> <div class={`${prefixCls}-image`}>{imageNode}</div>
<p class={`${prefixCls}-description`}>{des}</p> <p class={`${prefixCls}-description`}>{des}</p>
{this.$slots.default && <div class={`${prefixCls}-footer`}>{this.$slots.default}</div>} {this.$slots.default && <div class={`${prefixCls}-footer`}>{this.$slots.default}</div>}

View File

@ -8,7 +8,7 @@ import createDOMForm from '../vc-form/src/createDOMForm';
import createFormField from '../vc-form/src/createFormField'; import createFormField from '../vc-form/src/createFormField';
import FormItem from './FormItem'; import FormItem from './FormItem';
import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants'; import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants';
import { initDefaultProps } from '../_util/props-util'; import { initDefaultProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Base from '../base'; import Base from '../base';
@ -192,8 +192,7 @@ const Form = {
}, },
methods: { methods: {
onSubmit(e) { onSubmit(e) {
const { $listeners } = this; if (!getListeners(this).submit) {
if (!$listeners.submit) {
e.preventDefault(); e.preventDefault();
} else { } else {
this.$emit('submit', e); this.$emit('submit', e);

View File

@ -1,5 +1,6 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import { getListeners } from '../_util/props-util';
const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]); const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
@ -46,7 +47,6 @@ export default {
pull, pull,
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,
$slots, $slots,
$listeners,
rowContext, rowContext,
} = this; } = this;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
@ -80,7 +80,7 @@ export default {
...sizeClassObj, ...sizeClassObj,
}; };
const divProps = { const divProps = {
on: $listeners, on: getListeners(this),
class: classes, class: classes,
style: {}, style: {},
}; };

View File

@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { initDefaultProps, getOptionProps } from '../_util/props-util'; import { initDefaultProps, getOptionProps, getListeners } from '../_util/props-util';
import classNames from 'classnames'; import classNames from 'classnames';
import Icon from '../icon'; import Icon from '../icon';
import VcInputNumber from '../vc-input-number/src'; import VcInputNumber from '../vc-input-number/src';
@ -68,7 +68,7 @@ const InputNumber = {
}, },
class: inputNumberClass, class: inputNumberClass,
ref: 'inputNumberRef', ref: 'inputNumberRef',
on: this.$listeners, on: getListeners(this),
}; };
return <VcInputNumber {...vcInputNumberprops} />; return <VcInputNumber {...vcInputNumberprops} />;
}, },

View File

@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { filterEmpty } from '../_util/props-util'; import { filterEmpty, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
export default { export default {
@ -32,9 +32,8 @@ export default {
}, },
methods: {}, methods: {},
render() { render() {
const { $listeners } = this;
return ( return (
<span class={this.classes} {...{ on: $listeners }}> <span class={this.classes} {...{ on: getListeners(this) }}>
{filterEmpty(this.$slots.default)} {filterEmpty(this.$slots.default)}
</span> </span>
); );

View File

@ -2,7 +2,7 @@ import classNames from 'classnames';
import TextArea from './TextArea'; import TextArea from './TextArea';
import omit from 'omit.js'; import omit from 'omit.js';
import inputProps from './inputProps'; import inputProps from './inputProps';
import { hasProp, getComponentFromProp } from '../_util/props-util'; import { hasProp, getComponentFromProp, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Icon from '../icon'; import Icon from '../icon';
@ -234,7 +234,7 @@ export default {
'defaultValue', 'defaultValue',
'lazy', 'lazy',
]); ]);
const { stateValue, getInputClassName, handleKeyDown, handleChange, $listeners } = this; const { stateValue, getInputClassName, handleKeyDown, handleChange } = this;
const inputProps = { const inputProps = {
directives: [{ name: 'ant-input' }], directives: [{ name: 'ant-input' }],
domProps: { domProps: {
@ -242,7 +242,7 @@ export default {
}, },
attrs: { ...otherProps, ...this.$attrs }, attrs: { ...otherProps, ...this.$attrs },
on: { on: {
...$listeners, ...getListeners(this),
keydown: handleKeyDown, keydown: handleKeyDown,
input: handleChange, input: handleChange,
change: noop, change: noop,
@ -256,12 +256,11 @@ export default {
}, },
render() { render() {
if (this.$props.type === 'textarea') { if (this.$props.type === 'textarea') {
const { $listeners } = this;
const textareaProps = { const textareaProps = {
props: this.$props, props: this.$props,
attrs: this.$attrs, attrs: this.$attrs,
on: { on: {
...$listeners, ...getListeners(this),
input: this.handleChange, input: this.handleChange,
keydown: this.handleKeyDown, keydown: this.handleKeyDown,
change: noop, change: noop,

View File

@ -1,5 +1,5 @@
import classNames from 'classnames'; import classNames from 'classnames';
import { getComponentFromProp, getOptionProps } from '../_util/props-util'; import { getComponentFromProp, getOptionProps, getListeners } from '../_util/props-util';
import Input from './Input'; import Input from './Input';
import Icon from '../icon'; import Icon from '../icon';
import inputProps from './inputProps'; import inputProps from './inputProps';
@ -93,7 +93,7 @@ export default {
}, },
class: inputClassName, class: inputClassName,
ref: 'input', ref: 'input',
on: this.$listeners, on: getListeners(this),
}; };
return <Input {...inputProps} />; return <Input {...inputProps} />;
}, },

View File

@ -4,7 +4,7 @@ import Icon from '../icon';
import inputProps from './inputProps'; import inputProps from './inputProps';
import Button from '../button'; import Button from '../button';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import { getOptionProps, getComponentFromProp, isValidElement } from '../_util/props-util'; import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -119,7 +119,7 @@ export default {
inputClassName = prefixCls; inputClassName = prefixCls;
} }
const on = { ...this.$listeners }; const on = { ...getListeners(this) };
delete on.search; delete on.search;
const inputProps = { const inputProps = {
props: { props: {

View File

@ -3,7 +3,7 @@ import omit from 'omit.js';
import ResizeObserver from 'resize-observer-polyfill'; import ResizeObserver from 'resize-observer-polyfill';
import inputProps from './inputProps'; import inputProps from './inputProps';
import calculateNodeHeight from './calculateNodeHeight'; import calculateNodeHeight from './calculateNodeHeight';
import hasProp from '../_util/props-util'; import hasProp, { getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
function onNextFrame(cb) { function onNextFrame(cb) {
@ -146,7 +146,6 @@ export default {
handleTextareaChange, handleTextareaChange,
textareaStyles, textareaStyles,
$attrs, $attrs,
$listeners,
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,
disabled, disabled,
} = this; } = this;
@ -169,7 +168,7 @@ export default {
directives: [{ name: 'ant-input' }], directives: [{ name: 'ant-input' }],
attrs: { ...otherProps, ...$attrs }, attrs: { ...otherProps, ...$attrs },
on: { on: {
...$listeners, ...getListeners(this),
keydown: handleKeyDown, keydown: handleKeyDown,
input: handleTextareaChange, input: handleTextareaChange,
change: noop, change: noop,

View File

@ -1,6 +1,6 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { getOptionProps } from '../_util/props-util'; import { getOptionProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
export const BasicProps = { export const BasicProps = {
@ -27,7 +27,7 @@ function generator(props, name) {
prefixCls, prefixCls,
...getOptionProps(this), ...getOptionProps(this),
}, },
on: this.$listeners, on: getListeners(this),
}; };
return <BasicComponent {...basicComponentProps}>{this.$slots.default}</BasicComponent>; return <BasicComponent {...basicComponentProps}>{this.$slots.default}</BasicComponent>;
}, },
@ -38,10 +38,10 @@ function generator(props, name) {
const Basic = { const Basic = {
props: BasicProps, props: BasicProps,
render() { render() {
const { prefixCls, $slots, $listeners } = this; const { prefixCls, $slots } = this;
const divProps = { const divProps = {
class: prefixCls, class: prefixCls,
on: $listeners, on: getListeners(this),
}; };
return <div {...divProps}>{$slots.default}</div>; return <div {...divProps}>{$slots.default}</div>;
}, },
@ -67,13 +67,13 @@ const BasicLayout = {
}; };
}, },
render() { render() {
const { prefixCls, $slots, hasSider, $listeners } = this; const { prefixCls, $slots, hasSider } = this;
const divCls = classNames(prefixCls, { const divCls = classNames(prefixCls, {
[`${prefixCls}-has-sider`]: hasSider || this.siders.length > 0, [`${prefixCls}-has-sider`]: hasSider || this.siders.length > 0,
}); });
const divProps = { const divProps = {
class: divCls, class: divCls,
on: $listeners, on: getListeners,
}; };
return <div {...divProps}>{$slots.default}</div>; return <div {...divProps}>{$slots.default}</div>;
}, },

View File

@ -1,6 +1,11 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { getSlotOptions, getComponentFromProp, isEmptyElement } from '../_util/props-util'; import {
getSlotOptions,
getComponentFromProp,
isEmptyElement,
getListeners,
} from '../_util/props-util';
import { Col } from '../grid'; import { Col } from '../grid';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import { ListGridType } from './index'; import { ListGridType } from './index';
@ -65,7 +70,8 @@ export default {
}, },
render() { render() {
const { grid } = this.listContext; const { grid } = this.listContext;
const { prefixCls: customizePrefixCls, $slots, $listeners } = this; const { prefixCls: customizePrefixCls, $slots } = this;
const listeners = getListeners(this);
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('list', customizePrefixCls); const prefixCls = getPrefixCls('list', customizePrefixCls);
@ -127,7 +133,7 @@ export default {
xl={getGrid(grid, 'xl')} xl={getGrid(grid, 'xl')}
xxl={getGrid(grid, 'xxl')} xxl={getGrid(grid, 'xxl')}
> >
<div {...{ on: $listeners }} class={classString}> <div {...{ on: listeners }} class={classString}>
{extra && extraContent} {extra && extraContent}
{!extra && metaContent} {!extra && metaContent}
{!extra && content} {!extra && content}
@ -135,7 +141,7 @@ export default {
</div> </div>
</Col> </Col>
) : ( ) : (
<div {...{ on: $listeners }} class={classString}> <div {...{ on: listeners }} class={classString}>
{extra && extraContent} {extra && extraContent}
{!extra && metaContent} {!extra && metaContent}
{!extra && content} {!extra && content}

View File

@ -8,7 +8,12 @@ import Pagination, { PaginationConfig } from '../pagination';
import { Row } from '../grid'; import { Row } from '../grid';
import Item from './Item'; import Item from './Item';
import { initDefaultProps, getComponentFromProp, filterEmpty } from '../_util/props-util'; import {
initDefaultProps,
getComponentFromProp,
filterEmpty,
getListeners,
} from '../_util/props-util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import Base from '../base'; import Base from '../base';
@ -136,7 +141,6 @@ const List = {
dataSource, dataSource,
size, size,
loading, loading,
$listeners,
$slots, $slots,
paginationCurrent, paginationCurrent,
} = this; } = this;
@ -229,7 +233,7 @@ const List = {
const paginationPosition = paginationProps.position || 'bottom'; const paginationPosition = paginationProps.position || 'bottom';
return ( return (
<div class={classString} {...{ on: $listeners }}> <div class={classString} {...{ on: getListeners(this) }}>
{(paginationPosition === 'top' || paginationPosition === 'both') && paginationContent} {(paginationPosition === 'top' || paginationPosition === 'both') && paginationContent}
{header && <div class={`${prefixCls}-header`}>{header}</div>} {header && <div class={`${prefixCls}-header`}>{header}</div>}
<Spin {...{ props: loadingProp }}> <Spin {...{ props: loadingProp }}>

View File

@ -1,5 +1,5 @@
import { Item, itemProps } from '../vc-menu'; import { Item, itemProps } from '../vc-menu';
import { getOptionProps } from '../_util/props-util'; import { getOptionProps, getListeners } from '../_util/props-util';
import Tooltip from '../tooltip'; import Tooltip from '../tooltip';
function noop() {} function noop() {}
export default { export default {
@ -18,7 +18,7 @@ export default {
render() { render() {
const props = getOptionProps(this); const props = getOptionProps(this);
const { level, title, rootPrefixCls } = props; const { level, title, rootPrefixCls } = props;
const { getInlineCollapsed, $slots, $attrs: attrs, $listeners } = this; const { getInlineCollapsed, $slots, $attrs: attrs } = this;
const inlineCollapsed = getInlineCollapsed(); const inlineCollapsed = getInlineCollapsed();
let titleNode; let titleNode;
if (inlineCollapsed) { if (inlineCollapsed) {
@ -31,7 +31,7 @@ export default {
title: inlineCollapsed ? null : title, title: inlineCollapsed ? null : title,
}, },
attrs, attrs,
on: $listeners, on: getListeners(this),
}; };
const toolTipProps = { const toolTipProps = {
props: { props: {

View File

@ -4,7 +4,7 @@ import PropTypes from '../_util/vue-types';
import animation from '../_util/openAnimation'; import animation from '../_util/openAnimation';
import warning from '../_util/warning'; import warning from '../_util/warning';
import Item from './MenuItem'; import Item from './MenuItem';
import { hasProp } from '../_util/props-util'; import { hasProp, getListeners } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import commonPropsType from '../vc-menu/commonPropsType'; import commonPropsType from '../vc-menu/commonPropsType';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -205,7 +205,7 @@ const Menu = {
}, },
}, },
render() { render() {
const { layoutSiderContext, $slots, $listeners } = this; const { layoutSiderContext, $slots } = this;
const { collapsedWidth } = layoutSiderContext; const { collapsedWidth } = layoutSiderContext;
const { getPopupContainer: getContextPopupContainer } = this.configProvider; const { getPopupContainer: getContextPopupContainer } = this.configProvider;
const { prefixCls: customizePrefixCls, theme, getPopupContainer } = this.$props; const { prefixCls: customizePrefixCls, theme, getPopupContainer } = this.$props;
@ -228,7 +228,7 @@ const Menu = {
prefixCls, prefixCls,
}, },
on: { on: {
...$listeners, ...getListeners(this),
select: this.handleSelect, select: this.handleSelect,
deselect: this.handleDeselect, deselect: this.handleDeselect,
openChange: this.handleOpenChange, openChange: this.handleOpenChange,

View File

@ -14,6 +14,7 @@ import {
getClass, getClass,
getStyle, getStyle,
mergeProps, mergeProps,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -160,7 +161,6 @@ export default {
visible, visible,
wrapClassName, wrapClassName,
centered, centered,
$listeners,
$slots, $slots,
$attrs, $attrs,
} = this; } = this;
@ -194,7 +194,7 @@ export default {
closeIcon, closeIcon,
}, },
on: { on: {
...$listeners, ...getListeners(this),
close: this.handleCancel, close: this.handleCancel,
}, },
class: getClass(this), class: getClass(this),

View File

@ -1,5 +1,5 @@
import VcSelect, { SelectProps } from '../select'; import VcSelect, { SelectProps } from '../select';
import { getOptionProps, filterEmpty } from '../_util/props-util'; import { getOptionProps, filterEmpty, getListeners } from '../_util/props-util';
export default { export default {
props: { props: {
@ -13,7 +13,7 @@ export default {
...selectOptionsProps, ...selectOptionsProps,
size: 'small', size: 'small',
}, },
on: this.$listeners, on: getListeners(this),
}; };
return <VcSelect {...selelctProps}>{filterEmpty(this.$slots.default)}</VcSelect>; return <VcSelect {...selelctProps}>{filterEmpty(this.$slots.default)}</VcSelect>;
}, },

View File

@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
import VcSelect from '../select'; import VcSelect from '../select';
import MiniSelect from './MiniSelect'; import MiniSelect from './MiniSelect';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { getOptionProps } from '../_util/props-util'; import { getOptionProps, getListeners } from '../_util/props-util';
import VcPagination from '../vc-pagination'; import VcPagination from '../vc-pagination';
import enUS from '../vc-pagination/locale/en_US'; import enUS from '../vc-pagination/locale/en_US';
import Icon from '../icon'; import Icon from '../icon';
@ -111,7 +111,7 @@ export default {
class: { class: {
mini: isSmall, mini: isSmall,
}, },
on: this.$listeners, on: getListeners(this),
}; };
return <VcPagination {...paginationProps} />; return <VcPagination {...paginationProps} />;

View File

@ -1,7 +1,7 @@
import Tooltip from '../tooltip'; import Tooltip from '../tooltip';
import abstractTooltipProps from '../tooltip/abstractTooltipProps'; import abstractTooltipProps from '../tooltip/abstractTooltipProps';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponentFromProp } from '../_util/props-util'; import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Base from '../base'; import Base from '../base';
@ -42,7 +42,7 @@ const Popover = {
prefixCls, prefixCls,
}, },
ref: 'tooltip', ref: 'tooltip',
on: this.$listeners, on: getListeners(this),
}; };
return ( return (
<Tooltip {...tooltipProps}> <Tooltip {...tooltipProps}>

View File

@ -1,6 +1,6 @@
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, initDefaultProps } from '../_util/props-util'; import { getOptionProps, initDefaultProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Icon from '../icon'; import Icon from '../icon';
import Line from './line'; import Line from './line';
@ -136,7 +136,7 @@ export default {
props: { props: {
...restProps, ...restProps,
}, },
on: this.$listeners, on: getListeners(this),
class: classString, class: classString,
}; };
return <div {...progressProps}>{progress}</div>; return <div {...progressProps}>{progress}</div>;

View File

@ -1,7 +1,7 @@
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import Radio from './Radio'; import Radio from './Radio';
import { getOptionProps, filterEmpty, hasProp } from '../_util/props-util'; import { getOptionProps, filterEmpty, hasProp, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
function noop() {} function noop() {}
@ -85,7 +85,7 @@ export default {
}, },
}, },
render() { render() {
const { mouseenter = noop, mouseleave = noop } = this.$listeners; const { mouseenter = noop, mouseleave = noop } = getListeners(this);
const props = getOptionProps(this); const props = getOptionProps(this);
const { prefixCls: customizePrefixCls, options, buttonStyle } = props; const { prefixCls: customizePrefixCls, options, buttonStyle } = props;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;

View File

@ -1,7 +1,7 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import VcCheckbox from '../vc-checkbox'; import VcCheckbox from '../vc-checkbox';
import classNames from 'classnames'; import classNames from 'classnames';
import { getOptionProps, getAttrs } from '../_util/props-util'; import { getOptionProps, getAttrs, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
function noop() {} function noop() {}
@ -48,10 +48,10 @@ export default {
}, },
render() { render() {
const { $slots, $listeners, radioGroupContext: radioGroup } = this; const { $slots, radioGroupContext: radioGroup } = this;
const props = getOptionProps(this); const props = getOptionProps(this);
const children = $slots.default; const children = $slots.default;
const { mouseenter = noop, mouseleave = noop, ...restListeners } = $listeners; const { mouseenter = noop, mouseleave = noop, ...restListeners } = getListeners(this);
const { prefixCls: customizePrefixCls, ...restProps } = props; const { prefixCls: customizePrefixCls, ...restProps } = props;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('radio', customizePrefixCls); const prefixCls = getPrefixCls('radio', customizePrefixCls);

View File

@ -1,6 +1,6 @@
import omit from 'omit.js'; import omit from 'omit.js';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponentFromProp } from '../_util/props-util'; import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import VcRate from '../vc-rate'; import VcRate from '../vc-rate';
import Icon from '../icon'; import Icon from '../icon';
@ -58,7 +58,7 @@ const Rate = {
prefixCls, prefixCls,
...omit(restProps, ['tooltips']), ...omit(restProps, ['tooltips']),
}, },
on: this.$listeners, on: getListeners(this),
ref: 'refRate', ref: 'refRate',
}; };
return <VcRate {...rateProps} />; return <VcRate {...rateProps} />;

View File

@ -8,6 +8,7 @@ import {
getOptionProps, getOptionProps,
filterEmpty, filterEmpty,
isValidElement, isValidElement,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import Icon from '../icon'; import Icon from '../icon';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
@ -254,7 +255,7 @@ const Select = {
dropdownRender: getComponentFromProp(this, 'dropdownRender', {}, false), dropdownRender: getComponentFromProp(this, 'dropdownRender', {}, false),
getPopupContainer: getPopupContainer || getContextPopupContainer, getPopupContainer: getPopupContainer || getContextPopupContainer,
}, },
on: this.$listeners, on: getListeners(this),
class: cls, class: cls,
ref: 'vcSelect', ref: 'vcSelect',
}; };

View File

@ -6,6 +6,7 @@ import {
initDefaultProps, initDefaultProps,
isValidElement, isValidElement,
getComponentFromProp, getComponentFromProp,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -151,7 +152,10 @@ export default {
}; };
return ( return (
<div {...{ on: this.$listeners }} class={[`${prefixCls}-nested-loading`, wrapperClassName]}> <div
{...{ on: getListeners(this) }}
class={[`${prefixCls}-nested-loading`, wrapperClassName]}
>
{sSpinning && <div key="loading">{spinElement}</div>} {sSpinning && <div key="loading">{spinElement}</div>}
<div class={containerClassName} key="container"> <div class={containerClassName} key="container">
{children} {children}

View File

@ -1,7 +1,7 @@
import * as moment from 'moment'; import * as moment from 'moment';
import interopDefault from '../_util/interopDefault'; import interopDefault from '../_util/interopDefault';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import { initDefaultProps } from '../_util/props-util'; import { initDefaultProps, getListeners } from '../_util/props-util';
import Statistic, { StatisticProps } from './Statistic'; import Statistic, { StatisticProps } from './Statistic';
import { formatCountdown } from './utils'; import { formatCountdown } from './utils';
@ -88,7 +88,7 @@ export default {
valueRender: this.valueRenderHtml, valueRender: this.valueRenderHtml,
formatter: this.formatCountdown, formatter: this.formatCountdown,
}, },
on: this.$listeners, on: getListeners(this),
}} }}
/> />
); );

View File

@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { initDefaultProps, getOptionProps } from '../_util/props-util'; import { initDefaultProps, getOptionProps, getListeners } from '../_util/props-util';
import VcSteps from '../vc-steps'; import VcSteps from '../vc-steps';
import Icon from '../icon'; import Icon from '../icon';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -47,7 +47,7 @@ const Steps = {
prefixCls, prefixCls,
...props, ...props,
}, },
on: this.$listeners, on: getListeners(this),
scopedSlots: this.$scopedSlots, scopedSlots: this.$scopedSlots,
}; };
return <VcSteps {...stepsProps}>{this.$slots.default}</VcSteps>; return <VcSteps {...stepsProps}>{this.$slots.default}</VcSteps>;

View File

@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponentFromProp } from '../_util/props-util'; import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
import VcSwitch from '../vc-switch'; import VcSwitch from '../vc-switch';
import Wave from '../_util/wave'; import Wave from '../_util/wave';
import Icon from '../icon'; import Icon from '../icon';
@ -60,7 +60,7 @@ const Switch = {
unCheckedChildren: getComponentFromProp(this, 'unCheckedChildren'), unCheckedChildren: getComponentFromProp(this, 'unCheckedChildren'),
disabled: disabled || loading, disabled: disabled || loading,
}, },
on: this.$listeners, on: getListeners(this),
class: classes, class: classes,
ref: 'refSwitchNode', ref: 'refSwitchNode',
}; };

View File

@ -3,7 +3,7 @@ import Icon from '../icon';
import getTransitionProps from '../_util/getTransitionProps'; import getTransitionProps from '../_util/getTransitionProps';
import omit from 'omit.js'; import omit from 'omit.js';
import Wave from '../_util/wave'; import Wave from '../_util/wave';
import { hasProp } from '../_util/props-util'; import { hasProp, getListeners } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -103,7 +103,7 @@ export default {
const tag = ( const tag = (
<div <div
v-show={visible} v-show={visible}
{...{ on: omit(this.$listeners, ['close']) }} {...{ on: omit(getListeners(this), ['close']) }}
class={this.getTagClassName(prefixCls)} class={this.getTagClassName(prefixCls)}
style={this.getTagStyle()} style={this.getTagStyle()}
> >

View File

@ -14,6 +14,7 @@ import {
getOptionProps, getOptionProps,
getComponentFromProp, getComponentFromProp,
isValidElement, isValidElement,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -220,7 +221,7 @@ const TimePicker = {
class: pickerClassName, class: pickerClassName,
ref: 'timePicker', ref: 'timePicker',
on: { on: {
...this.$listeners, ...getListeners(this),
change: this.handleChange, change: this.handleChange,
open: this.handleOpenClose, open: this.handleOpenClose,
close: this.handleOpenClose, close: this.handleOpenClose,

View File

@ -5,6 +5,7 @@ import {
initDefaultProps, initDefaultProps,
filterEmpty, filterEmpty,
getComponentFromProp, getComponentFromProp,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import TimelineItem from './TimelineItem'; import TimelineItem from './TimelineItem';
@ -92,7 +93,7 @@ export default {
...restProps, ...restProps,
}, },
class: classString, class: classString,
on: this.$listeners, on: getListeners(this),
}; };
return <ul {...timelineProps}>{items}</ul>; return <ul {...timelineProps}>{items}</ul>;
}, },

View File

@ -1,6 +1,11 @@
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, initDefaultProps, getComponentFromProp } from '../_util/props-util'; import {
getOptionProps,
initDefaultProps,
getComponentFromProp,
getListeners,
} from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
export const TimeLineItemProps = { export const TimeLineItemProps = {
@ -37,7 +42,7 @@ export default {
}); });
const liProps = { const liProps = {
class: itemClassName, class: itemClassName,
on: this.$listeners, on: getListeners(this),
}; };
return ( return (
<li {...liProps}> <li {...liProps}>

View File

@ -8,6 +8,7 @@ import {
getClass, getClass,
getStyle, getStyle,
isValidElement, isValidElement,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import abstractTooltipProps from './abstractTooltipProps'; import abstractTooltipProps from './abstractTooltipProps';
@ -161,7 +162,7 @@ export default {
}, },
render() { render() {
const { $props, $data, $slots, $listeners } = this; const { $props, $data, $slots } = this;
const { prefixCls: customizePrefixCls, openClassName, getPopupContainer } = $props; const { prefixCls: customizePrefixCls, openClassName, getPopupContainer } = $props;
const { getPopupContainer: getContextPopupContainer } = this.configProvider; const { getPopupContainer: getContextPopupContainer } = this.configProvider;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
@ -192,7 +193,7 @@ export default {
}, },
ref: 'tooltip', ref: 'tooltip',
on: { on: {
...$listeners, ...getListeners(this),
visibleChange: this.onVisibleChange, visibleChange: this.onVisibleChange,
popupAlign: this.onPopupAlign, popupAlign: this.onPopupAlign,
}, },

View File

@ -4,6 +4,7 @@ import {
initDefaultProps, initDefaultProps,
getOptionProps, getOptionProps,
getComponentFromProp, getComponentFromProp,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import classNames from 'classnames'; import classNames from 'classnames';
@ -240,7 +241,7 @@ const Transfer = {
// add filter // add filter
[`${direction}Filter`]: value, [`${direction}Filter`]: value,
}); });
if (this.$listeners.searchChange) { if (getListeners(this).searchChange) {
warning(false, '`searchChange` in Transfer is deprecated. Please use `search` instead.'); warning(false, '`searchChange` in Transfer is deprecated. Please use `search` instead.');
this.$emit('searchChange', direction, e); this.$emit('searchChange', direction, e);
} }

View File

@ -8,6 +8,7 @@ import {
getComponentFromProp, getComponentFromProp,
filterEmpty, filterEmpty,
isValidElement, isValidElement,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Base from '../base'; import Base from '../base';
@ -152,7 +153,7 @@ const TreeSelect = {
treeData ? { treeData } : {}, treeData ? { treeData } : {},
), ),
class: cls, class: cls,
on: { ...this.$listeners, change: this.onChange }, on: { ...getListeners(this), change: this.onChange },
ref: 'vcTreeSelect', ref: 'vcTreeSelect',
scopedSlots: this.$scopedSlots, scopedSlots: this.$scopedSlots,
}; };

View File

@ -8,6 +8,7 @@ import {
filterEmpty, filterEmpty,
getComponentFromProp, getComponentFromProp,
getClass, getClass,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
@ -205,7 +206,7 @@ export default {
__propsSymbol__: Symbol(), __propsSymbol__: Symbol(),
switcherIcon: nodeProps => this.renderSwitcherIcon(prefixCls, switcherIcon, nodeProps), switcherIcon: nodeProps => this.renderSwitcherIcon(prefixCls, switcherIcon, nodeProps),
}, },
on: this.$listeners, on: getListeners(this),
ref: 'tree', ref: 'tree',
class: !showIcon && `${prefixCls}-icon-hide`, class: !showIcon && `${prefixCls}-icon-hide`,
}; };

View File

@ -1,4 +1,4 @@
import { getOptionProps } from '../_util/props-util'; import { getOptionProps, getListeners } from '../_util/props-util';
import Upload from './Upload'; import Upload from './Upload';
import { UploadProps } from './interface'; import { UploadProps } from './interface';
@ -12,7 +12,7 @@ export default {
...props, ...props,
type: 'drag', type: 'drag',
}, },
on: this.$listeners, on: getListeners(this),
style: { height: this.height }, style: { height: this.height },
}; };
return <Upload {...draggerProps}>{this.$slots.default}</Upload>; return <Upload {...draggerProps}>{this.$slots.default}</Upload>;

View File

@ -238,7 +238,6 @@ export default {
beforeUpload: this.reBeforeUpload, beforeUpload: this.reBeforeUpload,
}, },
on: { on: {
// ...this.$listeners,
start: this.onStart, start: this.onStart,
error: this.onError, error: this.onError,
progress: this.onProgress, progress: this.onProgress,

View File

@ -1,5 +1,5 @@
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { getOptionProps, initDefaultProps } from '../_util/props-util'; import { getOptionProps, initDefaultProps, getListeners } from '../_util/props-util';
import getTransitionProps from '../_util/getTransitionProps'; import getTransitionProps from '../_util/getTransitionProps';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Icon from '../icon'; import Icon from '../icon';
@ -95,7 +95,7 @@ export default {
this.$emit('remove', file); this.$emit('remove', file);
}, },
handlePreview(file, e) { handlePreview(file, e) {
const { preview } = this.$listeners; const { preview } = getListeners(this);
if (!preview) { if (!preview) {
return; return;
} }

View File

@ -1,7 +1,7 @@
import moment from 'moment'; import moment from 'moment';
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { getOptionProps, hasProp } from '../../_util/props-util'; import { getOptionProps, hasProp, getListeners } from '../../_util/props-util';
import DateTable from './date/DateTable'; import DateTable from './date/DateTable';
import MonthTable from './month/MonthTable'; import MonthTable from './month/MonthTable';
import CalendarMixin, { getNowByCurrentStateValue } from './mixin/CalendarMixin'; import CalendarMixin, { getNowByCurrentStateValue } from './mixin/CalendarMixin';
@ -93,7 +93,7 @@ const FullCalendar = {
headerRender, headerRender,
disabledDate, disabledDate,
} = props; } = props;
const { sValue: value, sType: type, $listeners } = this; const { sValue: value, sType: type } = this;
let header = null; let header = null;
if (showHeader) { if (showHeader) {
@ -109,7 +109,7 @@ const FullCalendar = {
value, value,
}, },
on: { on: {
...$listeners, ...getListeners(this),
typeChange: this.setType, typeChange: this.setType,
valueChange: this.setValue, valueChange: this.setValue,
}, },

View File

@ -1,6 +1,12 @@
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { getOptionProps, hasProp, mergeProps, getComponentFromProp } from '../../_util/props-util'; import {
getOptionProps,
hasProp,
mergeProps,
getComponentFromProp,
getListeners,
} from '../../_util/props-util';
import moment from 'moment'; import moment from 'moment';
import KeyCode from '../../_util/KeyCode'; import KeyCode from '../../_util/KeyCode';
import CalendarPart from './range-calendar/CalendarPart'; import CalendarPart from './range-calendar/CalendarPart';
@ -613,7 +619,7 @@ const RangeCalendar = {
seperator, seperator,
} = props; } = props;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponentFromProp(this, 'clearIcon');
const { sHoverValue, sSelectedValue, sMode, showTimePicker, sValue, $listeners } = this; const { sHoverValue, sSelectedValue, sMode, showTimePicker, sValue } = this;
const className = { const className = {
[prefixCls]: 1, [prefixCls]: 1,
[`${prefixCls}-hidden`]: !props.visible, [`${prefixCls}-hidden`]: !props.visible,
@ -623,7 +629,7 @@ const RangeCalendar = {
}; };
const baseProps = { const baseProps = {
props, props,
on: $listeners, on: getListeners(this),
}; };
const newProps = { const newProps = {
props: { props: {

View File

@ -1,6 +1,6 @@
import PropTypes from '../../../_util/vue-types'; import PropTypes from '../../../_util/vue-types';
import BaseMixin from '../../../_util/BaseMixin'; import BaseMixin from '../../../_util/BaseMixin';
import { getOptionProps } from '../../../_util/props-util'; import { getOptionProps, getListeners } from '../../../_util/props-util';
import TodayButton from './TodayButton'; import TodayButton from './TodayButton';
import OkButton from './OkButton'; import OkButton from './OkButton';
import TimePickerButton from './TimePickerButton'; import TimePickerButton from './TimePickerButton';
@ -37,7 +37,6 @@ const CalendarFooter = {
render() { render() {
const props = getOptionProps(this); const props = getOptionProps(this);
const { $listeners } = this;
const { value, prefixCls, showOk, timePicker, renderFooter, showToday, mode } = props; const { value, prefixCls, showOk, timePicker, renderFooter, showToday, mode } = props;
let footerEl = null; let footerEl = null;
const extraFooter = renderFooter && renderFooter(mode); const extraFooter = renderFooter && renderFooter(mode);
@ -47,7 +46,7 @@ const CalendarFooter = {
...props, ...props,
value: value, value: value,
}, },
on: $listeners, on: getListeners(this),
}; };
let nowEl = null; let nowEl = null;
if (showToday) { if (showToday) {

View File

@ -1,6 +1,6 @@
import PropTypes from '../../../_util/vue-types'; import PropTypes from '../../../_util/vue-types';
import BaseMixin from '../../../_util/BaseMixin'; import BaseMixin from '../../../_util/BaseMixin';
import { getOptionProps } from '../../../_util/props-util'; import { getOptionProps, getListeners } from '../../../_util/props-util';
import MonthPanel from '../month/MonthPanel'; import MonthPanel from '../month/MonthPanel';
import YearPanel from '../year/YearPanel'; import YearPanel from '../year/YearPanel';
import DecadePanel from '../decade/DecadePanel'; import DecadePanel from '../decade/DecadePanel';
@ -51,7 +51,7 @@ const CalendarHeader = {
methods: { methods: {
onMonthSelect(value) { onMonthSelect(value) {
this.__emit('panelChange', value, 'date'); this.__emit('panelChange', value, 'date');
if (this.$listeners.monthSelect) { if (getListeners(this).monthSelect) {
this.__emit('monthSelect', value); this.__emit('monthSelect', value);
} else { } else {
this.__emit('valueChange', value); this.__emit('valueChange', value);

View File

@ -1,5 +1,5 @@
import PropTypes from '../../../_util/vue-types'; import PropTypes from '../../../_util/vue-types';
import { getOptionProps } from '../../../_util/props-util'; import { getOptionProps, getListeners } from '../../../_util/props-util';
import cx from 'classnames'; import cx from 'classnames';
import DateConstants from './DateConstants'; import DateConstants from './DateConstants';
import { getTitleString, getTodayTime } from '../util/'; import { getTitleString, getTodayTime } from '../util/';
@ -50,8 +50,7 @@ const DateTBody = {
disabledDate, disabledDate,
hoverValue, hoverValue,
} = props; } = props;
const { $listeners = {} } = this; const { select = noop, dayHover = noop } = getListeners(this);
const { select = noop, dayHover = noop } = $listeners;
let iIndex; let iIndex;
let jIndex; let jIndex;
let current; let current;

View File

@ -1,6 +1,6 @@
import PropTypes from '../../../_util/vue-types'; import PropTypes from '../../../_util/vue-types';
import BaseMixin from '../../../_util/BaseMixin'; import BaseMixin from '../../../_util/BaseMixin';
import { hasProp } from '../../../_util/props-util'; import { hasProp, getListeners } from '../../../_util/props-util';
import MonthTable from './MonthTable'; import MonthTable from './MonthTable';
function goYear(direction) { function goYear(direction) {
@ -66,7 +66,6 @@ const MonthPanel = {
rootPrefixCls, rootPrefixCls,
disabledDate, disabledDate,
renderFooter, renderFooter,
$listeners = {},
} = this; } = this;
const year = sValue.year(); const year = sValue.year();
const prefixCls = `${rootPrefixCls}-month-panel`; const prefixCls = `${rootPrefixCls}-month-panel`;
@ -86,7 +85,7 @@ const MonthPanel = {
<a <a
class={`${prefixCls}-year-select`} class={`${prefixCls}-year-select`}
role="button" role="button"
onClick={$listeners.yearPanelShow || noop} onClick={getListeners(this).yearPanelShow || noop}
title={locale.yearSelect} title={locale.yearSelect}
> >
<span class={`${prefixCls}-year-select-content`}>{year}</span> <span class={`${prefixCls}-year-select-content`}>{year}</span>

View File

@ -1,6 +1,6 @@
import PropTypes from '../../../_util/vue-types'; import PropTypes from '../../../_util/vue-types';
import BaseMixin from '../../../_util/BaseMixin'; import BaseMixin from '../../../_util/BaseMixin';
import { getOptionProps, getComponentFromProp } from '../../../_util/props-util'; import { getOptionProps, getComponentFromProp, getListeners } from '../../../_util/props-util';
import { cloneElement } from '../../../_util/vnode'; import { cloneElement } from '../../../_util/vnode';
import CalendarHeader from '../calendar/CalendarHeader'; import CalendarHeader from '../calendar/CalendarHeader';
import DateTable from '../date/DateTable'; import DateTable from '../date/DateTable';
@ -34,7 +34,7 @@ const CalendarPart = {
clearIcon: PropTypes.any, clearIcon: PropTypes.any,
}, },
render() { render() {
const { $props: props, $listeners = {} } = this; const { $props: props } = this;
const { const {
prefixCls, prefixCls,
value, value,
@ -65,7 +65,7 @@ const CalendarPart = {
panelChange = noop, panelChange = noop,
select = noop, select = noop,
dayHover = noop, dayHover = noop,
} = $listeners; } = getListeners(this);
const shouldShowTimePicker = showTimePicker && timePicker; const shouldShowTimePicker = showTimePicker && timePicker;
const disabledTimeConfig = const disabledTimeConfig =
shouldShowTimePicker && disabledTime ? getTimeConfig(selectedValue, disabledTime) : null; shouldShowTimePicker && disabledTime ? getTimeConfig(selectedValue, disabledTime) : null;

View File

@ -1,5 +1,6 @@
import PropTypes from '../../../_util/vue-types'; import PropTypes from '../../../_util/vue-types';
import BaseMixin from '../../../_util/BaseMixin'; import BaseMixin from '../../../_util/BaseMixin';
import { getListeners } from '../../../_util/props-util';
const ROW = 4; const ROW = 4;
const COL = 3; const COL = 3;
function noop() {} function noop() {}
@ -61,8 +62,8 @@ export default {
}, },
render() { render() {
const { sValue: value, locale, renderFooter, $listeners = {} } = this; const { sValue: value, locale, renderFooter } = this;
const decadePanelShow = $listeners.decadePanelShow || noop; const decadePanelShow = getListeners(this).decadePanelShow || noop;
const years = this.years(); const years = this.years();
const currentYear = value.year(); const currentYear = value.year();
const startYear = parseInt(currentYear / 10, 10) * 10; const startYear = parseInt(currentYear / 10, 10) * 10;

View File

@ -1,4 +1,4 @@
import { getComponentFromProp } from '../_util/props-util'; import { getComponentFromProp, getListeners } from '../_util/props-util';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import Trigger from '../vc-trigger'; import Trigger from '../vc-trigger';
import Menus from './Menus'; import Menus from './Menus';
@ -313,14 +313,13 @@ export default {
render() { render() {
const { const {
$props, $props,
$slots,
sActiveValue, sActiveValue,
handleMenuSelect, handleMenuSelect,
sPopupVisible, sPopupVisible,
handlePopupVisibleChange, handlePopupVisibleChange,
handleKeyDown, handleKeyDown,
$listeners,
} = this; } = this;
const listeners = getListeners(this);
const { const {
prefixCls, prefixCls,
transitionName, transitionName,
@ -348,7 +347,7 @@ export default {
expandIcon, expandIcon,
}, },
on: { on: {
...$listeners, ...listeners,
select: handleMenuSelect, select: handleMenuSelect,
itemDoubleClick: this.handleItemDoubleClick, itemDoubleClick: this.handleItemDoubleClick,
}, },
@ -370,7 +369,7 @@ export default {
popupClassName: popupClassName + emptyMenuClassName, popupClassName: popupClassName + emptyMenuClassName,
}, },
on: { on: {
...$listeners, ...listeners,
popupVisibleChange: handlePopupVisibleChange, popupVisibleChange: handlePopupVisibleChange,
}, },
ref: 'trigger', ref: 'trigger',

View File

@ -1,6 +1,12 @@
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { getOptionProps, hasProp, initDefaultProps, getAttrs } from '../../_util/props-util'; import {
getOptionProps,
hasProp,
initDefaultProps,
getAttrs,
getListeners,
} from '../../_util/props-util';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
export default { export default {
@ -137,7 +143,7 @@ export default {
{...{ {...{
attrs: globalProps, attrs: globalProps,
on: { on: {
...this.$listeners, ...getListeners(this),
change: this.handleChange, change: this.handleChange,
click: this.onClick, click: this.onClick,
}, },

View File

@ -1,7 +1,7 @@
import Dialog from './Dialog'; import Dialog from './Dialog';
import ContainerRender from '../_util/ContainerRender'; import ContainerRender from '../_util/ContainerRender';
import getDialogPropTypes from './IDialogPropTypes'; import getDialogPropTypes from './IDialogPropTypes';
import { getStyle, getClass } from '../_util/props-util'; import { getStyle, getClass, getListeners } from '../_util/props-util';
const IDialogPropTypes = getDialogPropTypes(); const IDialogPropTypes = getDialogPropTypes();
let openCount = 0; let openCount = 0;
const DialogWrap = { const DialogWrap = {
@ -37,7 +37,7 @@ const DialogWrap = {
}, },
methods: { methods: {
getComponent(extra = {}) { getComponent(extra = {}) {
const { $attrs, $listeners, $props, $slots, getContainer } = this; const { $attrs, $props, $slots, getContainer } = this;
const { on, ...otherProps } = extra; const { on, ...otherProps } = extra;
const dialogProps = { const dialogProps = {
props: { props: {
@ -51,7 +51,7 @@ const DialogWrap = {
ref: '_component', ref: '_component',
key: 'dialog', key: 'dialog',
on: { on: {
...$listeners, ...getListeners(this),
...on, ...on,
}, },
}; };

View File

@ -1,4 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getListeners } from '../_util/props-util';
const ILazyRenderBoxPropTypes = { const ILazyRenderBoxPropTypes = {
visible: PropTypes.bool, visible: PropTypes.bool,
@ -9,6 +10,6 @@ const ILazyRenderBoxPropTypes = {
export default { export default {
props: ILazyRenderBoxPropTypes, props: ILazyRenderBoxPropTypes,
render() { render() {
return <div {...{ on: this.$listeners }}>{this.$slots.default}</div>; return <div {...{ on: getListeners(this) }}>{this.$slots.default}</div>;
}, },
}; };

View File

@ -2,7 +2,7 @@ import classnames from 'classnames';
import Vue from 'vue'; import Vue from 'vue';
import ref from 'vue-ref'; import ref from 'vue-ref';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { initDefaultProps, getEvents } from '../../_util/props-util'; import { initDefaultProps, getEvents, getListeners } from '../../_util/props-util';
import { cloneElement } from '../../_util/vnode'; import { cloneElement } from '../../_util/vnode';
import ContainerRender from '../../_util/ContainerRender'; import ContainerRender from '../../_util/ContainerRender';
import getScrollBarSize from '../../_util/getScrollBarSize'; import getScrollBarSize from '../../_util/getScrollBarSize';
@ -363,7 +363,7 @@ const Drawer = {
} }
} }
} }
const { change } = this.$listeners; const { change } = getListeners(this);
if (change && this.isOpenChange && this.sFirstEnter) { if (change && this.isOpenChange && this.sFirstEnter) {
change(open); change(open);
this.isOpenChange = false; this.isOpenChange = false;

View File

@ -7,7 +7,13 @@ import omit from 'lodash/omit';
import createFieldsStore from './createFieldsStore'; import createFieldsStore from './createFieldsStore';
import { cloneElement } from '../../_util/vnode'; import { cloneElement } from '../../_util/vnode';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { getOptionProps, getEvents, slotHasProp, getComponentName } from '../../_util/props-util'; import {
getOptionProps,
getEvents,
slotHasProp,
getComponentName,
getListeners,
} from '../../_util/props-util';
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import { import {
@ -704,7 +710,7 @@ function createBaseForm(option = {}, mixins = []) {
}, },
render() { render() {
const { $listeners, $slots } = this; const { $slots } = this;
const formProps = { const formProps = {
[formPropName]: this.getForm(), [formPropName]: this.getForm(),
}; };
@ -714,7 +720,7 @@ function createBaseForm(option = {}, mixins = []) {
...formProps, ...formProps,
...restProps, ...restProps,
}), }),
on: $listeners, on: getListeners(this),
ref: 'WrappedComponent', ref: 'WrappedComponent',
directives: [ directives: [
{ {

View File

@ -1,5 +1,6 @@
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import Touchable from '../../vc-m-feedback'; import Touchable from '../../vc-m-feedback';
import { getListeners } from '../../_util/props-util';
const InputHandler = { const InputHandler = {
props: { props: {
@ -13,7 +14,7 @@ const InputHandler = {
disabled, disabled,
activeClassName: `${prefixCls}-handler-active`, activeClassName: `${prefixCls}-handler-active`,
}, },
on: this.$listeners, on: getListeners(this),
}; };
return ( return (
<Touchable {...touchableProps}> <Touchable {...touchableProps}>

View File

@ -1,7 +1,7 @@
// based on rc-input-number 4.4.0 // based on rc-input-number 4.4.0
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { initDefaultProps, hasProp, getOptionProps } from '../../_util/props-util'; import { initDefaultProps, hasProp, getOptionProps, getListeners } from '../../_util/props-util';
import classNames from 'classnames'; import classNames from 'classnames';
import isNegativeZero from 'is-negative-zero'; import isNegativeZero from 'is-negative-zero';
import KeyCode from '../../_util/KeyCode'; import KeyCode from '../../_util/KeyCode';
@ -674,7 +674,7 @@ export default {
mouseleave = noop, mouseleave = noop,
mouseover = noop, mouseover = noop,
mouseout = noop, mouseout = noop,
} = this.$listeners; } = getListeners(this);
const contentProps = { const contentProps = {
on: { mouseenter, mouseleave, mouseover, mouseout }, on: { mouseenter, mouseleave, mouseover, mouseout },
class: classes, class: classes,

View File

@ -4,7 +4,7 @@ import SubMenu from './SubMenu';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { getWidth, setStyle, menuAllProps } from './util'; import { getWidth, setStyle, menuAllProps } from './util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import { getClass, getPropsData, getEvents } from '../_util/props-util'; import { getClass, getPropsData, getEvents, getListeners } from '../_util/props-util';
const canUseDOM = !!( const canUseDOM = !!(
typeof window !== 'undefined' && typeof window !== 'undefined' &&
@ -285,7 +285,7 @@ const DOMWrap = {
render() { render() {
const Tag = this.$props.tag; const Tag = this.$props.tag;
const tagProps = { const tagProps = {
on: this.$listeners, on: getListeners(this),
}; };
return <Tag {...tagProps}>{this.renderChildren(this.$slots.default)}</Tag>; return <Tag {...tagProps}>{this.renderChildren(this.$slots.default)}</Tag>;
}, },

View File

@ -2,7 +2,12 @@ import PropTypes from '../_util/vue-types';
import { Provider, create } from '../_util/store'; import { Provider, create } from '../_util/store';
import { default as SubPopupMenu, getActiveKey } from './SubPopupMenu'; import { default as SubPopupMenu, getActiveKey } from './SubPopupMenu';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import hasProp, { getOptionProps, getComponentFromProp, filterEmpty } from '../_util/props-util'; import hasProp, {
getOptionProps,
getComponentFromProp,
filterEmpty,
getListeners,
} from '../_util/props-util';
import commonPropsType from './commonPropsType'; import commonPropsType from './commonPropsType';
const Menu = { const Menu = {
@ -168,7 +173,7 @@ const Menu = {
}, },
class: `${props.prefixCls}-root`, class: `${props.prefixCls}-root`,
on: { on: {
...this.$listeners, ...getListeners(this),
click: this.onClick, click: this.onClick,
openChange: this.onOpenChange, openChange: this.onOpenChange,
deselect: this.onDeselect, deselect: this.onDeselect,

View File

@ -4,7 +4,7 @@ import BaseMixin from '../_util/BaseMixin';
import scrollIntoView from 'dom-scroll-into-view'; import scrollIntoView from 'dom-scroll-into-view';
import { connect } from '../_util/store'; import { connect } from '../_util/store';
import { noop, menuAllProps } from './util'; import { noop, menuAllProps } from './util';
import { getComponentFromProp } from '../_util/props-util'; import { getComponentFromProp, getListeners } from '../_util/props-util';
const props = { const props = {
attribute: PropTypes.object, attribute: PropTypes.object,
@ -174,7 +174,7 @@ const MenuItem = {
if (props.mode === 'inline') { if (props.mode === 'inline') {
style.paddingLeft = `${props.inlineIndent * props.level}px`; style.paddingLeft = `${props.inlineIndent * props.level}px`;
} }
const listeners = { ...this.$listeners }; const listeners = { ...getListeners(this) };
menuAllProps.props.forEach(key => delete props[key]); menuAllProps.props.forEach(key => delete props[key]);
menuAllProps.on.forEach(key => delete listeners[key]); menuAllProps.on.forEach(key => delete listeners[key]);
const liProps = { const liProps = {

View File

@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getComponentFromProp } from '../_util/props-util'; import { getComponentFromProp, getListeners } from '../_util/props-util';
// import { menuAllProps } from './util' // import { menuAllProps } from './util'
const MenuItemGroup = { const MenuItemGroup = {
@ -27,7 +27,7 @@ const MenuItemGroup = {
const titleClassName = `${rootPrefixCls}-item-group-title`; const titleClassName = `${rootPrefixCls}-item-group-title`;
const listClassName = `${rootPrefixCls}-item-group-list`; const listClassName = `${rootPrefixCls}-item-group-list`;
// menuAllProps.props.forEach(key => delete props[key]) // menuAllProps.props.forEach(key => delete props[key])
const listeners = { ...this.$listeners }; const listeners = { ...getListeners(this) };
delete listeners.click; delete listeners.click;
return ( return (

View File

@ -6,7 +6,7 @@ import { connect } from '../_util/store';
import SubPopupMenu from './SubPopupMenu'; import SubPopupMenu from './SubPopupMenu';
import placements from './placements'; import placements from './placements';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { getComponentFromProp, filterEmpty } from '../_util/props-util'; import { getComponentFromProp, filterEmpty, getListeners } from '../_util/props-util';
import { requestAnimationTimeout, cancelAnimationTimeout } from '../_util/requestAnimationTimeout'; import { requestAnimationTimeout, cancelAnimationTimeout } from '../_util/requestAnimationTimeout';
import { noop, loopMenuItemRecursively, getMenuIdFromSubMenuEventKey } from './util'; import { noop, loopMenuItemRecursively, getMenuIdFromSubMenuEventKey } from './util';
import getTransitionProps from '../_util/getTransitionProps'; import getTransitionProps from '../_util/getTransitionProps';
@ -333,7 +333,7 @@ const SubMenu = {
renderChildren(children) { renderChildren(children) {
const props = this.$props; const props = this.$props;
const { select, deselect, openChange } = this.$listeners; const { select, deselect, openChange } = getListeners(this);
const subPopupMenuProps = { const subPopupMenuProps = {
props: { props: {
mode: props.mode === 'horizontal' ? 'vertical' : props.mode, mode: props.mode === 'horizontal' ? 'vertical' : props.mode,
@ -416,7 +416,7 @@ const SubMenu = {
render() { render() {
const props = this.$props; const props = this.$props;
const { rootPrefixCls, parentMenu, $listeners = {} } = this; const { rootPrefixCls, parentMenu } = this;
const isOpen = props.isOpen; const isOpen = props.isOpen;
const prefixCls = this.getPrefixCls(); const prefixCls = this.getPrefixCls();
const isInlineMode = props.mode === 'inline'; const isInlineMode = props.mode === 'inline';
@ -504,7 +504,7 @@ const SubMenu = {
const popupAlign = props.popupOffset ? { offset: props.popupOffset } : {}; const popupAlign = props.popupOffset ? { offset: props.popupOffset } : {};
const popupClassName = props.mode === 'inline' ? '' : props.popupClassName; const popupClassName = props.mode === 'inline' ? '' : props.popupClassName;
const liProps = { const liProps = {
on: { ...omit($listeners, ['click']), ...mouseEvents }, on: { ...omit(getListeners(this), ['click']), ...mouseEvents },
class: className, class: className,
}; };

View File

@ -13,6 +13,7 @@ import {
getPropsData, getPropsData,
getEvents, getEvents,
getComponentFromProp, getComponentFromProp,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
function allDisabled(arr) { function allDisabled(arr) {
@ -390,7 +391,7 @@ const SubPopupMenu = {
}, },
class: className, class: className,
// Otherwise, the propagated click event will trigger another onClick // Otherwise, the propagated click event will trigger another onClick
on: omit(this.$listeners || {}, ['click']), on: omit(getListeners(this), ['click']),
}; };
// if (props.id) { // if (props.id) {
// domProps.id = props.id // domProps.id = props.id

View File

@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getStyle, getComponentFromProp } from '../_util/props-util'; import { getStyle, getComponentFromProp, getListeners } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
function noop() {} function noop() {}
@ -63,15 +63,7 @@ export default {
}, },
render() { render() {
const { const { prefixCls, closable, clearCloseTimer, startCloseTimer, $slots, close } = this;
prefixCls,
closable,
clearCloseTimer,
startCloseTimer,
$slots,
close,
$listeners,
} = this;
const componentClass = `${prefixCls}-notice`; const componentClass = `${prefixCls}-notice`;
const className = { const className = {
[`${componentClass}`]: 1, [`${componentClass}`]: 1,
@ -85,7 +77,7 @@ export default {
style={style || { right: '50%' }} style={style || { right: '50%' }}
onMouseenter={clearCloseTimer} onMouseenter={clearCloseTimer}
onMouseleave={startCloseTimer} onMouseleave={startCloseTimer}
onClick={$listeners.click || noop} onClick={getListeners(this).click || noop}
> >
<div class={`${componentClass}-content`}>{$slots.default}</div> <div class={`${componentClass}-content`}>{$slots.default}</div>
{closable ? ( {closable ? (

View File

@ -5,7 +5,7 @@ import scrollIntoView from 'dom-scroll-into-view';
import { getSelectKeys, preventDefaultEvent } from './util'; import { getSelectKeys, preventDefaultEvent } from './util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { getSlotOptions, getComponentFromProp } from '../_util/props-util'; import { getSlotOptions, getComponentFromProp, getListeners } from '../_util/props-util';
export default { export default {
name: 'DropdownMenu', name: 'DropdownMenu',
@ -101,7 +101,7 @@ export default {
visible, visible,
} = props; } = props;
const menuItemSelectedIcon = getComponentFromProp(this, 'menuItemSelectedIcon'); const menuItemSelectedIcon = getComponentFromProp(this, 'menuItemSelectedIcon');
const { menuDeselect, menuSelect, popupScroll } = this.$listeners; const { menuDeselect, menuSelect, popupScroll } = getListeners(this);
if (menuItems && menuItems.length) { if (menuItems && menuItems.length) {
const selectedKeys = getSelectKeys(menuItems, value); const selectedKeys = getSelectKeys(menuItems, value);
const menuProps = { const menuProps = {
@ -191,7 +191,7 @@ export default {
}, },
render() { render() {
const renderMenu = this.renderMenu(); const renderMenu = this.renderMenu();
const { popupFocus, popupScroll } = this.$listeners; const { popupFocus, popupScroll } = getListeners(this);
return renderMenu ? ( return renderMenu ? (
<div <div
style={{ style={{

View File

@ -19,6 +19,7 @@ import {
getAttrs, getAttrs,
getOptionProps, getOptionProps,
getSlots, getSlots,
getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import getTransitionProps from '../_util/getTransitionProps'; import getTransitionProps from '../_util/getTransitionProps';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
@ -790,7 +791,7 @@ const Select = {
keydown: chaining( keydown: chaining(
this.onInputKeydown, this.onInputKeydown,
inputEvents.keydown, inputEvents.keydown,
this.$listeners.inputKeydown, getListeners(this).inputKeydown,
), ),
focus: chaining(this.inputFocus, inputEvents.focus), focus: chaining(this.inputFocus, inputEvents.focus),
blur: chaining(this.inputBlur, inputEvents.blur), blur: chaining(this.inputBlur, inputEvents.blur),
@ -1554,8 +1555,7 @@ const Select = {
const realOpen = this.getRealOpenState(); const realOpen = this.getRealOpenState();
const empty = this._empty; const empty = this._empty;
const options = this._options || []; const options = this._options || [];
const { $listeners } = this; const { mouseenter = noop, mouseleave = noop, popupScroll = noop } = getListeners(this);
const { mouseenter = noop, mouseleave = noop, popupScroll = noop } = $listeners;
const selectionProps = { const selectionProps = {
props: {}, props: {},
attrs: { attrs: {

View File

@ -4,6 +4,7 @@ import PropTypes from '../_util/vue-types';
import DropdownMenu from './DropdownMenu'; import DropdownMenu from './DropdownMenu';
import { isSingleMode, saveRef } from './util'; import { isSingleMode, saveRef } from './util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { getListeners } from '../_util/props-util';
const BUILT_IN_PLACEMENTS = { const BUILT_IN_PLACEMENTS = {
bottomLeft: { bottomLeft: {
@ -105,7 +106,7 @@ export default {
backfillValue, backfillValue,
menuItemSelectedIcon, menuItemSelectedIcon,
} = this; } = this;
const { menuSelect, menuDeselect, popupScroll } = this.$listeners; const { menuSelect, menuDeselect, popupScroll } = getListeners(this);
const props = this.$props; const props = this.$props;
const { dropdownRender, ariaId } = props; const { dropdownRender, ariaId } = props;
@ -157,7 +158,7 @@ export default {
}, },
render() { render() {
const { $props, $slots, $listeners } = this; const { $props, $slots } = this;
const { const {
multiple, multiple,
visible, visible,
@ -173,7 +174,7 @@ export default {
showAction, showAction,
empty, empty,
} = $props; } = $props;
const { mouseenter, mouseleave, popupFocus, dropdownVisibleChange } = $listeners; const { mouseenter, mouseleave, popupFocus, dropdownVisibleChange } = getListeners(this);
const dropdownPrefixCls = this.getDropdownPrefixCls(); const dropdownPrefixCls = this.getDropdownPrefixCls();
const popupClassName = { const popupClassName = {
[dropdownClassName]: !!dropdownClassName, [dropdownClassName]: !!dropdownClassName,

View File

@ -2,7 +2,7 @@ import debounce from 'lodash/debounce';
import classnames from 'classnames'; import classnames from 'classnames';
import Vue from 'vue'; import Vue from 'vue';
import ref from 'vue-ref'; import ref from 'vue-ref';
import { getStyle } from '../../_util/props-util'; import { getStyle, getListeners } from '../../_util/props-util';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import defaultProps from './default-props'; import defaultProps from './default-props';
import initialState from './initial-state'; import initialState from './initial-state';
@ -236,7 +236,7 @@ export default {
const slidesToLoad = state.lazyLoadedList.filter( const slidesToLoad = state.lazyLoadedList.filter(
value => this.lazyLoadedList.indexOf(value) < 0, value => this.lazyLoadedList.indexOf(value) < 0,
); );
if (this.$listeners.lazyLoad && slidesToLoad.length > 0) { if (getListeners(this).lazyLoad && slidesToLoad.length > 0) {
this.$emit('lazyLoad', slidesToLoad); this.$emit('lazyLoad', slidesToLoad);
} }
this.setState(state, () => { this.setState(state, () => {

View File

@ -3,7 +3,7 @@ import Vue from 'vue';
import ref from 'vue-ref'; import ref from 'vue-ref';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { cloneElement } from '../../_util/vnode'; import { cloneElement } from '../../_util/vnode';
import { getStyle } from '../../_util/props-util'; import { getStyle, getListeners } from '../../_util/props-util';
import InnerSlider from './inner-slider'; import InnerSlider from './inner-slider';
import defaultProps from './default-props'; import defaultProps from './default-props';
import { canUseDOM } from './utils/innerSliderUtils'; import { canUseDOM } from './utils/innerSliderUtils';
@ -197,9 +197,7 @@ export default {
children: newChildren, children: newChildren,
__propsSymbol__: Symbol(), __propsSymbol__: Symbol(),
}, },
on: { on: getListeners(this),
...this.$listeners,
},
directives: [ directives: [
{ {
name: 'ant-ref', name: 'ant-ref',

View File

@ -1,7 +1,7 @@
import classNames from 'classnames'; import classNames from 'classnames';
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { getOptionProps } from '../../_util/props-util'; import { getOptionProps, getListeners } from '../../_util/props-util';
import addEventListener from '../../_util/Dom/addEventListener'; import addEventListener from '../../_util/Dom/addEventListener';
export default { export default {
@ -92,7 +92,7 @@ export default {
}, },
class: className, class: className,
on: { on: {
...this.$listeners, ...getListeners(this),
blur: this.handleBlur, blur: this.handleBlur,
keydown: this.handleKeyDown, keydown: this.handleKeyDown,
mousedown: this.handleMousedown, mousedown: this.handleMousedown,

View File

@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponentFromProp } from '../_util/props-util'; import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
function isString(str) { function isString(str) {
return typeof str === 'string'; return typeof str === 'string';
@ -88,7 +88,7 @@ export default {
}; };
const stepProps = { const stepProps = {
class: classString, class: classString,
on: this.$listeners, on: getListeners(this),
}; };
const stepItemStyle = {}; const stepItemStyle = {};
if (itemWidth) { if (itemWidth) {

View File

@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import isFlexSupported from '../_util/isFlexSupported'; import isFlexSupported from '../_util/isFlexSupported';
import { filterEmpty, getEvents, getPropsData } from '../_util/props-util'; import { filterEmpty, getEvents, getPropsData, getListeners } from '../_util/props-util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
export default { export default {
@ -111,7 +111,7 @@ export default {
const stepsProps = { const stepsProps = {
class: classString, class: classString,
ref: 'vcStepsRef', ref: 'vcStepsRef',
on: this.$listeners, on: getListeners(this),
}; };
return ( return (
<div {...stepsProps}> <div {...stepsProps}>

View File

@ -1,6 +1,6 @@
import { switchPropTypes } from './PropTypes'; import { switchPropTypes } from './PropTypes';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import { hasProp, getOptionProps, getComponentFromProp } from '../_util/props-util'; import { hasProp, getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
// function noop () { // function noop () {
// } // }
@ -89,7 +89,7 @@ export default {
const spanProps = { const spanProps = {
props: { ...restProps }, props: { ...restProps },
on: { on: {
...this.$listeners, ...getListeners(this),
keydown: this.handleKeyDown, keydown: this.handleKeyDown,
click: this.handleClick, click: this.handleClick,
mouseup: this.handleMouseUp, mouseup: this.handleMouseUp,

View File

@ -3,6 +3,7 @@ import TabBarTabsNode from './TabBarTabsNode';
import TabBarRootNode from './TabBarRootNode'; import TabBarRootNode from './TabBarRootNode';
import ScrollableTabBarNode from './ScrollableTabBarNode'; import ScrollableTabBarNode from './ScrollableTabBarNode';
import SaveRef from './SaveRef'; import SaveRef from './SaveRef';
import { getListeners } from '../../_util/props-util';
export default { export default {
name: 'ScrollableInkTabBar', name: 'ScrollableInkTabBar',
@ -21,7 +22,7 @@ export default {
], ],
render() { render() {
const props = { ...this.$props }; const props = { ...this.$props };
const listeners = this.$listeners; const listeners = getListeners(this);
const { default: renderTabBarNode } = this.$scopedSlots; const { default: renderTabBarNode } = this.$scopedSlots;
return ( return (
<SaveRef <SaveRef

View File

@ -1,14 +1,14 @@
import TabBarRootNode from './TabBarRootNode'; import TabBarRootNode from './TabBarRootNode';
import TabBarTabsNode from './TabBarTabsNode'; import TabBarTabsNode from './TabBarTabsNode';
import SaveRef from './SaveRef'; import SaveRef from './SaveRef';
import { getAttrs } from '../../_util/props-util'; import { getAttrs, getListeners } from '../../_util/props-util';
export default { export default {
name: 'TabBar', name: 'TabBar',
inheritAttrs: false, inheritAttrs: false,
render() { render() {
const props = getAttrs(this); const props = getAttrs(this);
const listeners = this.$listeners; const listeners = getListeners(this);
return ( return (
<SaveRef <SaveRef
children={saveRef => ( children={saveRef => (

View File

@ -3,7 +3,7 @@ import BaseMixin from '../../_util/BaseMixin';
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import raf from 'raf'; import raf from 'raf';
import KeyCode from './KeyCode'; import KeyCode from './KeyCode';
import { getOptionProps } from '../../_util/props-util'; import { getOptionProps, getListeners } from '../../_util/props-util';
import { cloneElement } from '../../_util/vnode'; import { cloneElement } from '../../_util/vnode';
import Sentinel from './Sentinel'; import Sentinel from './Sentinel';
@ -248,7 +248,7 @@ export default {
contents.push(tabBar, sentinelStart, tabContent, sentinelEnd); contents.push(tabBar, sentinelStart, tabContent, sentinelEnd);
} }
const listeners = { const listeners = {
...omit(this.$listeners, ['change']), ...omit(getListeners(this), ['change']),
scroll: this.onScroll, scroll: this.onScroll,
}; };
return <div {...{ on: listeners, class: cls }}>{contents}</div>; return <div {...{ on: listeners, class: cls }}>{contents}</div>;

View File

@ -3,7 +3,7 @@ import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
import Header from './Header'; import Header from './Header';
import Combobox from './Combobox'; import Combobox from './Combobox';
import { getComponentFromProp } from '../_util/props-util'; import { getComponentFromProp, getListeners } from '../_util/props-util';
function noop() {} function noop() {}
@ -144,10 +144,9 @@ const Panel = {
inputReadOnly, inputReadOnly,
sValue, sValue,
currentSelectPanel, currentSelectPanel,
$listeners = {},
} = this; } = this;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponentFromProp(this, 'clearIcon');
const { esc = noop, clear = noop, keydown = noop } = $listeners; const { esc = noop, clear = noop, keydown = noop } = getListeners(this);
const disabledHourOptions = this.disabledHours2(); const disabledHourOptions = this.disabledHours2();
const disabledMinuteOptions = disabledMinutes(sValue ? sValue.hour() : null); const disabledMinuteOptions = disabledMinutes(sValue ? sValue.hour() : null);

View File

@ -8,7 +8,7 @@
import { createRef } from '../util'; import { createRef } from '../util';
import PropTypes from '../../../_util/vue-types'; import PropTypes from '../../../_util/vue-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { initDefaultProps, getComponentFromProp } from '../../../_util/props-util'; import { initDefaultProps, getComponentFromProp, getListeners } from '../../../_util/props-util';
import BaseMixin from '../../../_util/BaseMixin'; import BaseMixin from '../../../_util/BaseMixin';
export const selectorPropTypes = () => ({ export const selectorPropTypes = () => ({
prefixCls: PropTypes.string, prefixCls: PropTypes.string,
@ -134,7 +134,6 @@ export default function(modeName) {
} = this.$props; } = this.$props;
const { const {
vcTreeSelect: { onSelectorKeyDown }, vcTreeSelect: { onSelectorKeyDown },
$listeners,
} = this; } = this;
let myTabIndex = tabIndex; let myTabIndex = tabIndex;
@ -145,7 +144,7 @@ export default function(modeName) {
return ( return (
<span <span
style={style} style={style}
onClick={$listeners.click || noop} onClick={getListeners(this).click || noop}
class={classNames(className, prefixCls, { class={classNames(className, prefixCls, {
[`${prefixCls}-open`]: open, [`${prefixCls}-open`]: open,
[`${prefixCls}-focused`]: open || focused, [`${prefixCls}-focused`]: open || focused,

View File

@ -2,6 +2,7 @@ import PropTypes from '../../../_util/vue-types';
import BasePopup from '../Base/BasePopup'; import BasePopup from '../Base/BasePopup';
import SearchInput from '../SearchInput'; import SearchInput from '../SearchInput';
import { createRef } from '../util'; import { createRef } from '../util';
import { getListeners } from '../../../_util/props-util';
const SinglePopup = { const SinglePopup = {
name: 'SinglePopup', name: 'SinglePopup',
@ -54,7 +55,7 @@ const SinglePopup = {
<SearchInput <SearchInput
{...{ {...{
props: { ...this.$props, renderPlaceholder: this._renderPlaceholder }, props: { ...this.$props, renderPlaceholder: this._renderPlaceholder },
on: this.$listeners, on: getListeners(this),
directives: [ directives: [
{ {
name: 'ant-ref', name: 'ant-ref',
@ -72,7 +73,7 @@ const SinglePopup = {
<BasePopup <BasePopup
{...{ {...{
props: { ...this.$props, renderSearch: this._renderSearch, __propsSymbol__: Symbol() }, props: { ...this.$props, renderSearch: this._renderSearch, __propsSymbol__: Symbol() },
on: this.$listeners, on: getListeners(this),
}} }}
/> />
); );

View File

@ -56,6 +56,7 @@ import {
mergeProps, mergeProps,
getPropsData, getPropsData,
filterEmpty, filterEmpty,
getListeners,
} from '../../_util/props-util'; } from '../../_util/props-util';
function getWatch(keys = []) { function getWatch(keys = []) {
const watch = {}; const watch = {};
@ -958,7 +959,7 @@ const Select = {
} }
// Only do the logic when `onChange` function provided // Only do the logic when `onChange` function provided
if (this.$listeners.change) { if (getListeners(this).change) {
let connectValueList; let connectValueList;
// Get value by mode // Get value by mode
@ -1034,7 +1035,7 @@ const Select = {
ariaId: this.ariaId, ariaId: this.ariaId,
}, },
on: { on: {
...this.$listeners, ...getListeners(this),
choiceAnimationLeave: this.onChoiceAnimationLeave, choiceAnimationLeave: this.onChoiceAnimationLeave,
}, },
scopedSlots: this.$scopedSlots, scopedSlots: this.$scopedSlots,

View File

@ -1,6 +1,6 @@
import PropTypes from '../../../../_util/vue-types'; import PropTypes from '../../../../_util/vue-types';
import { toTitle, UNSELECTABLE_ATTRIBUTE, UNSELECTABLE_STYLE } from '../../util'; import { toTitle, UNSELECTABLE_ATTRIBUTE, UNSELECTABLE_STYLE } from '../../util';
import { getComponentFromProp } from '../../../../_util/props-util'; import { getComponentFromProp, getListeners } from '../../../../_util/props-util';
import BaseMixin from '../../../../_util/BaseMixin'; import BaseMixin from '../../../../_util/BaseMixin';
const Selection = { const Selection = {
@ -24,7 +24,6 @@ const Selection = {
render() { render() {
const { prefixCls, maxTagTextLength, label, value } = this.$props; const { prefixCls, maxTagTextLength, label, value } = this.$props;
const { $listeners } = this;
let content = label || value; let content = label || value;
if (maxTagTextLength && typeof content === 'string' && content.length > maxTagTextLength) { if (maxTagTextLength && typeof content === 'string' && content.length > maxTagTextLength) {
content = `${content.slice(0, maxTagTextLength)}...`; content = `${content.slice(0, maxTagTextLength)}...`;
@ -38,7 +37,7 @@ const Selection = {
class={`${prefixCls}-selection__choice`} class={`${prefixCls}-selection__choice`}
title={toTitle(label)} title={toTitle(label)}
> >
{$listeners.remove && ( {getListeners(this).remove && (
<span class={`${prefixCls}-selection__choice__remove`} onClick={this.onRemove}> <span class={`${prefixCls}-selection__choice__remove`} onClick={this.onRemove}>
{getComponentFromProp(this, 'removeIcon')} {getComponentFromProp(this, 'removeIcon')}
</span> </span>

View File

@ -1,6 +1,6 @@
import generateSelector, { selectorPropTypes } from '../Base/BaseSelector'; import generateSelector, { selectorPropTypes } from '../Base/BaseSelector';
import { toTitle } from '../util'; import { toTitle } from '../util';
import { getOptionProps } from '../../../_util/props-util'; import { getOptionProps, getListeners } from '../../../_util/props-util';
import { createRef } from '../util'; import { createRef } from '../util';
const Selector = generateSelector('single'); const Selector = generateSelector('single');
@ -47,7 +47,7 @@ const SingleSelector = {
...getOptionProps(this), ...getOptionProps(this),
renderSelection: this.renderSelection, renderSelection: this.renderSelection,
}, },
on: this.$listeners, on: getListeners(this),
directives: [ directives: [
{ {
name: 'ant-ref', name: 'ant-ref',

View File

@ -1,5 +1,6 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import LazyRenderBox from './LazyRenderBox'; import LazyRenderBox from './LazyRenderBox';
import { getListeners } from '../_util/props-util';
export default { export default {
props: { props: {
@ -9,9 +10,8 @@ export default {
}, },
render() { render() {
const { prefixCls, visible, hiddenClassName } = this.$props; const { prefixCls, visible, hiddenClassName } = this.$props;
const { $listeners } = this;
const divProps = { const divProps = {
on: $listeners, on: getListeners(this),
}; };
return ( return (

View File

@ -375,7 +375,7 @@ export default {
} }
mouseProps.mousedown = this.onPopupMouseDown; mouseProps.mousedown = this.onPopupMouseDown;
mouseProps.touchstart = this.onPopupMouseDown; mouseProps.touchstart = this.onPopupMouseDown;
const { handleGetPopupClassFromAlign, getRootDomNode, getContainer, $listeners } = self; const { handleGetPopupClassFromAlign, getRootDomNode, getContainer } = self;
const { const {
prefixCls, prefixCls,
destroyPopupOnHide, destroyPopupOnHide,
@ -415,7 +415,7 @@ export default {
popupStyle, popupStyle,
}, },
on: { on: {
align: $listeners.popupAlign || noop, align: getListeners(this).popupAlign || noop,
...mouseProps, ...mouseProps,
}, },
directives: [ directives: [
@ -520,7 +520,7 @@ export default {
createTwoChains(event) { createTwoChains(event) {
let fn = () => {}; let fn = () => {};
const events = this.$listeners; const events = getListeners(this);
if (this.childOriginEvents[event] && events[event]) { if (this.childOriginEvents[event] && events[event]) {
return this[`fire${event}`]; return this[`fire${event}`];
} }

View File

@ -6,6 +6,7 @@ import defaultRequest from './request';
import getUid from './uid'; import getUid from './uid';
import attrAccept from './attr-accept'; import attrAccept from './attr-accept';
import traverseFileTree from './traverseFileTree'; import traverseFileTree from './traverseFileTree';
import { getListeners } from '../../_util/props-util';
const upLoadPropTypes = { const upLoadPropTypes = {
componentTag: PropTypes.string, componentTag: PropTypes.string,
@ -206,7 +207,7 @@ const AjaxUploader = {
}; };
const tagProps = { const tagProps = {
on: { on: {
...this.$listeners, ...getListeners(this),
...events, ...events,
}, },
attrs: { attrs: {

View File

@ -1,5 +1,5 @@
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
import { initDefaultProps } from '../../_util/props-util'; import { initDefaultProps, getListeners } from '../../_util/props-util';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import AjaxUpload from './AjaxUploader'; import AjaxUpload from './AjaxUploader';
import IframeUpload from './IframeUploader'; import IframeUpload from './IframeUploader';
@ -83,7 +83,7 @@ export default {
props: { props: {
...this.$props, ...this.$props,
}, },
on: this.$listeners, on: getListeners(this),
ref: 'uploaderRef', ref: 'uploaderRef',
attrs: this.$attrs, attrs: this.$attrs,
}; };