perf: update listeners
parent
8b6b506110
commit
594dc07dff
|
@ -201,7 +201,7 @@ export function getEvents(child) {
|
|||
// use getListeners instead this.$listeners
|
||||
// https://github.com/vueComponent/ant-design-vue/issues/1705
|
||||
export function getListeners(context) {
|
||||
return context.$vnode ? context.$vnode.componentOptions.listeners || {} : context.$listeners;
|
||||
return (context.$vnode ? context.$vnode.componentOptions.listeners : context.$listeners) || {};
|
||||
}
|
||||
export function getClass(ele) {
|
||||
let data = {};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import PropTypes from './vue-types';
|
||||
import { getOptionProps } from './props-util';
|
||||
import { getOptionProps, getListeners } from './props-util';
|
||||
|
||||
function getDisplayName(WrappedComponent) {
|
||||
return WrappedComponent.name || 'Component';
|
||||
|
@ -23,7 +23,7 @@ export default function wrapWithConnect(WrappedComponent) {
|
|||
},
|
||||
},
|
||||
render() {
|
||||
const { $listeners, $slots = {}, $scopedSlots } = this;
|
||||
const { $slots = {}, $scopedSlots } = this;
|
||||
const props = getOptionProps(this);
|
||||
const wrapProps = {
|
||||
props: {
|
||||
|
@ -32,7 +32,7 @@ export default function wrapWithConnect(WrappedComponent) {
|
|||
componentWillReceiveProps: { ...props },
|
||||
children: $slots.default || props.children || [],
|
||||
},
|
||||
on: $listeners,
|
||||
on: getListeners(this),
|
||||
};
|
||||
if (Object.keys($scopedSlots).length) {
|
||||
wrapProps.scopedSlots = $scopedSlots;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import shallowEqual from 'shallowequal';
|
||||
import omit from 'omit.js';
|
||||
import { getOptionProps } from '../props-util';
|
||||
import { getOptionProps, getListeners } from '../props-util';
|
||||
import PropTypes from '../vue-types';
|
||||
import proxyComponent from '../proxyComponent';
|
||||
|
||||
|
@ -81,7 +81,7 @@ export default function connect(mapStateToProps) {
|
|||
},
|
||||
render() {
|
||||
this.preProps = { ...this.$props };
|
||||
const { $listeners, $slots = {}, $scopedSlots, subscribed, store } = this;
|
||||
const { $slots = {}, $scopedSlots, subscribed, store } = this;
|
||||
const props = getOptionProps(this);
|
||||
this.preProps = { ...omit(props, ['__propsSymbol__']) };
|
||||
const wrapProps = {
|
||||
|
@ -90,7 +90,7 @@ export default function connect(mapStateToProps) {
|
|||
...subscribed,
|
||||
store,
|
||||
},
|
||||
on: $listeners,
|
||||
on: getListeners(this),
|
||||
scopedSlots: $scopedSlots,
|
||||
};
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import { cloneElement } from '../_util/vnode';
|
||||
import { getOptionProps } from '../_util/props-util';
|
||||
import { getOptionProps, getListeners } from '../_util/props-util';
|
||||
function chaining(...fns) {
|
||||
return function(...args) {
|
||||
// eslint-disable-line
|
||||
|
@ -14,6 +14,7 @@ function chaining(...fns) {
|
|||
}
|
||||
export default {
|
||||
name: 'InputElement',
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
value: PropTypes.any,
|
||||
disabled: PropTypes.bool,
|
||||
|
@ -30,16 +31,17 @@ export default {
|
|||
},
|
||||
|
||||
render() {
|
||||
const { $slots = {}, $listeners = {}, $attrs = {} } = this;
|
||||
const { $slots = {}, $attrs = {} } = this;
|
||||
const listeners = getListeners(this);
|
||||
const props = getOptionProps(this);
|
||||
const value = props.value === undefined ? '' : props.value;
|
||||
const children = $slots.default[0];
|
||||
const { componentOptions = {} } = $slots.default[0];
|
||||
const { listeners = {} } = componentOptions;
|
||||
const newEvent = { ...listeners };
|
||||
const { listeners: events = {} } = componentOptions;
|
||||
const newEvent = { ...events };
|
||||
|
||||
for (const [eventName, event] of Object.entries($listeners)) {
|
||||
newEvent[eventName] = chaining(event, listeners[eventName]);
|
||||
for (const [eventName, event] of Object.entries(listeners)) {
|
||||
newEvent[eventName] = chaining(event, events[eventName]);
|
||||
}
|
||||
|
||||
return cloneElement(children, {
|
||||
|
|
|
@ -23,7 +23,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
|
|||
<div unselectable="on" class="ant-select-selection__placeholder" style="display: block; user-select: none;">input here</div>
|
||||
<ul>
|
||||
<li class="ant-select-search ant-select-search--inline">
|
||||
<div class="ant-select-search__field__wrap"><span class="ant-input-affix-wrapper ant-select-search__field" value=""><input type="text" value="" class="ant-input"><span class="ant-input-suffix"><i slot="suffix" aria-label="icon: search" class="certain-category-icon anticon anticon-search"><svg viewBox="64 64 896 896" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0 0 11.6 0l43.6-43.5a8.2 8.2 0 0 0 0-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg></i></span></span><span class="ant-select-search__field__mirror"> </span></div>
|
||||
<div class="ant-select-search__field__wrap"><span class="ant-input-affix-wrapper ant-select-search__field"><input type="text" value="" class="ant-input"><span class="ant-input-suffix"><i slot="suffix" aria-label="icon: search" class="certain-category-icon anticon anticon-search"><svg viewBox="64 64 896 896" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0 0 11.6 0l43.6-43.5a8.2 8.2 0 0 0 0-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg></i></span></span><span class="ant-select-search__field__mirror"> </span></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div><span unselectable="on" class="ant-select-arrow" style="user-select: none;"><i aria-label="icon: down" class="ant-select-arrow-icon anticon anticon-down"><svg viewBox="64 64 896 896" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span>
|
||||
|
@ -84,7 +84,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
|
|||
<div unselectable="on" class="ant-select-selection__placeholder" style="display: block; user-select: none;">input here</div>
|
||||
<ul>
|
||||
<li class="ant-select-search ant-select-search--inline">
|
||||
<div class="ant-select-search__field__wrap"><span class="ant-input-affix-wrapper ant-select-search__field" value=""><input type="text" value="" class="ant-input"><span class="ant-input-suffix"><button type="button" class="search-btn ant-btn ant-btn-primary ant-btn-lg"><i aria-label="icon: search" class="anticon anticon-search"><svg viewBox="64 64 896 896" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0 0 11.6 0l43.6-43.5a8.2 8.2 0 0 0 0-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg></i></button></span></span><span class="ant-select-search__field__mirror"> </span></div>
|
||||
<div class="ant-select-search__field__wrap"><span class="ant-input-affix-wrapper ant-select-search__field"><input type="text" value="" class="ant-input"><span class="ant-input-suffix"><button type="button" class="search-btn ant-btn ant-btn-primary ant-btn-lg"><i aria-label="icon: search" class="anticon anticon-search"><svg viewBox="64 64 896 896" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0 0 11.6 0l43.6-43.5a8.2 8.2 0 0 0 0-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg></i></button></span></span><span class="ant-select-search__field__mirror"> </span></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div><span unselectable="on" class="ant-select-arrow" style="user-select: none;"><i aria-label="icon: down" class="ant-select-arrow-icon anticon anticon-down"><svg viewBox="64 64 896 896" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i></span>
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
getOptionProps,
|
||||
filterEmpty,
|
||||
isValidElement,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import Base from '../base';
|
||||
|
||||
|
@ -91,14 +92,7 @@ const AutoComplete = {
|
|||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
size,
|
||||
prefixCls: customizePrefixCls,
|
||||
optionLabelProp,
|
||||
dataSource,
|
||||
$slots,
|
||||
$listeners,
|
||||
} = this;
|
||||
const { size, prefixCls: customizePrefixCls, optionLabelProp, dataSource, $slots } = this;
|
||||
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
||||
|
@ -143,7 +137,7 @@ const AutoComplete = {
|
|||
},
|
||||
class: cls,
|
||||
ref: 'select',
|
||||
on: $listeners,
|
||||
on: getListeners(this),
|
||||
};
|
||||
return <Select {...selectProps}>{options}</Select>;
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import Icon from '../icon';
|
||||
import { getListeners } from '../_util/props-util';
|
||||
|
||||
export default {
|
||||
name: 'AAvatar',
|
||||
|
@ -155,7 +156,7 @@ export default {
|
|||
}
|
||||
}
|
||||
return (
|
||||
<span {...{ on: this.$listeners, class: classString, style: sizeStyle }}>{children}</span>
|
||||
<span {...{ on: getListeners(this), class: classString, style: sizeStyle }}>{children}</span>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@ import BaseMixin from '../_util/BaseMixin';
|
|||
import getTransitionProps from '../_util/getTransitionProps';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import Base from '../base';
|
||||
import { getListeners } from '../_util/props-util';
|
||||
|
||||
const easeInOutCubic = (t, b, c, d) => {
|
||||
const cc = c - b;
|
||||
|
@ -106,7 +107,7 @@ const BackTop = {
|
|||
},
|
||||
|
||||
render() {
|
||||
const { prefixCls: customizePrefixCls, $slots, $listeners } = this;
|
||||
const { prefixCls: customizePrefixCls, $slots } = this;
|
||||
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('back-top', customizePrefixCls);
|
||||
|
@ -118,7 +119,7 @@ const BackTop = {
|
|||
);
|
||||
const divProps = {
|
||||
on: {
|
||||
...$listeners,
|
||||
...getListeners(this),
|
||||
click: this.scrollToTop,
|
||||
},
|
||||
class: prefixCls,
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import ScrollNumber from './ScrollNumber';
|
||||
import classNames from 'classnames';
|
||||
import { initDefaultProps, filterEmpty, getComponentFromProp } from '../_util/props-util';
|
||||
import {
|
||||
initDefaultProps,
|
||||
filterEmpty,
|
||||
getComponentFromProp,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import { cloneElement } from '../_util/vnode';
|
||||
import getTransitionProps from '../_util/getTransitionProps';
|
||||
import isNumeric from '../_util/isNumeric';
|
||||
|
@ -178,7 +183,7 @@ export default {
|
|||
if (!children.length && status) {
|
||||
return (
|
||||
<span
|
||||
{...{ on: this.$listeners }}
|
||||
{...{ on: getListeners(this) }}
|
||||
class={this.getBadgeClassName(prefixCls)}
|
||||
style={this.getStyleWithOffset()}
|
||||
>
|
||||
|
@ -191,7 +196,7 @@ export default {
|
|||
const transitionProps = getTransitionProps(children.length ? `${prefixCls}-zoom` : '');
|
||||
|
||||
return (
|
||||
<span {...{ on: this.$listeners }} class={this.getBadgeClassName(prefixCls)}>
|
||||
<span {...{ on: getListeners(this) }} class={this.getBadgeClassName(prefixCls)}>
|
||||
{children}
|
||||
<transition {...transitionProps}>{scrollNumber}</transition>
|
||||
{statusText}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Wave from '../_util/wave';
|
||||
import Icon from '../icon';
|
||||
import buttonTypes from './buttonTypes';
|
||||
import { filterEmpty } from '../_util/props-util';
|
||||
import { filterEmpty, getListeners } from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
|
||||
|
@ -128,18 +128,7 @@ export default {
|
|||
},
|
||||
},
|
||||
render() {
|
||||
const {
|
||||
type,
|
||||
htmlType,
|
||||
classes,
|
||||
icon,
|
||||
disabled,
|
||||
handleClick,
|
||||
sLoading,
|
||||
$slots,
|
||||
$attrs,
|
||||
$listeners,
|
||||
} = this;
|
||||
const { type, htmlType, classes, icon, disabled, handleClick, sLoading, $slots, $attrs } = this;
|
||||
const buttonProps = {
|
||||
attrs: {
|
||||
...$attrs,
|
||||
|
@ -147,7 +136,7 @@ export default {
|
|||
},
|
||||
class: classes,
|
||||
on: {
|
||||
...$listeners,
|
||||
...getListeners(this),
|
||||
click: handleClick,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import { getOptionProps, hasProp, initDefaultProps } from '../_util/props-util';
|
||||
import { getOptionProps, hasProp, initDefaultProps, getListeners } from '../_util/props-util';
|
||||
import * as moment from 'moment';
|
||||
import FullCalendar from '../vc-calendar/src/FullCalendar';
|
||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||
|
@ -172,7 +172,7 @@ const Calendar = {
|
|||
},
|
||||
renderCalendar(locale, localeCode) {
|
||||
const props = getOptionProps(this);
|
||||
const { sValue: value, sMode: mode, $listeners, $scopedSlots } = this;
|
||||
const { sValue: value, sMode: mode, $scopedSlots } = this;
|
||||
if (value && localeCode) {
|
||||
value.locale(localeCode);
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ const Calendar = {
|
|||
disabledDate,
|
||||
},
|
||||
on: {
|
||||
...$listeners,
|
||||
...getListeners(this),
|
||||
select: this.onSelect,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -4,7 +4,12 @@ import Row from '../row';
|
|||
import Col from '../col';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
import addEventListener from '../_util/Dom/addEventListener';
|
||||
import { getComponentFromProp, getSlotOptions, filterEmpty } from '../_util/props-util';
|
||||
import {
|
||||
getComponentFromProp,
|
||||
getSlotOptions,
|
||||
filterEmpty,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
|
@ -112,7 +117,7 @@ export default {
|
|||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('card', customizePrefixCls);
|
||||
|
||||
const { $slots, $scopedSlots, $listeners } = this;
|
||||
const { $slots, $scopedSlots } = this;
|
||||
|
||||
const classString = {
|
||||
[`${prefixCls}`]: true,
|
||||
|
@ -234,7 +239,7 @@ export default {
|
|||
<div
|
||||
class={classString}
|
||||
ref="cardContainerRef"
|
||||
{...{ on: omit($listeners, ['tabChange', 'tab-change']) }}
|
||||
{...{ on: omit(getListeners(this), ['tabChange', 'tab-change']) }}
|
||||
>
|
||||
{head}
|
||||
{coverDom}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import { getListeners } from '../_util/props-util';
|
||||
|
||||
export default {
|
||||
name: 'ACardGrid',
|
||||
|
@ -20,7 +21,7 @@ export default {
|
|||
[`${prefixCls}-grid`]: true,
|
||||
};
|
||||
return (
|
||||
<div {...{ on: this.$listeners }} class={classString}>
|
||||
<div {...{ on: getListeners(this) }} class={classString}>
|
||||
{this.$slots.default}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import { getComponentFromProp } from '../_util/props-util';
|
||||
import { getComponentFromProp, getListeners } from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
export default {
|
||||
|
@ -39,7 +39,7 @@ export default {
|
|||
</div>
|
||||
) : null;
|
||||
return (
|
||||
<div {...{ on: this.$listeners }} class={classString}>
|
||||
<div {...{ on: getListeners(this) }} class={classString}>
|
||||
{avatarDom}
|
||||
{MetaDetail}
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import debounce from 'lodash/debounce';
|
||||
import { initDefaultProps, getComponentFromProp, filterEmpty } from '../_util/props-util';
|
||||
import {
|
||||
initDefaultProps,
|
||||
getComponentFromProp,
|
||||
filterEmpty,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import Base from '../base';
|
||||
|
||||
|
@ -132,7 +137,7 @@ const Carousel = {
|
|||
const props = {
|
||||
...this.$props,
|
||||
};
|
||||
const { $slots, $listeners } = this;
|
||||
const { $slots } = this;
|
||||
|
||||
if (props.effect === 'fade') {
|
||||
props.fade = true;
|
||||
|
@ -150,7 +155,7 @@ const Carousel = {
|
|||
nextArrow: getComponentFromProp(this, 'nextArrow'),
|
||||
prevArrow: getComponentFromProp(this, 'prevArrow'),
|
||||
},
|
||||
on: $listeners,
|
||||
on: getListeners(this),
|
||||
scopedSlots: this.$scopedSlots,
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
getAttrs,
|
||||
getComponentFromProp,
|
||||
isValidElement,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import { cloneElement } from '../_util/vnode';
|
||||
|
@ -372,7 +373,7 @@ const Cascader = {
|
|||
},
|
||||
|
||||
render() {
|
||||
const { $slots, sPopupVisible, inputValue, $listeners, configProvider, localeData } = this;
|
||||
const { $slots, sPopupVisible, inputValue, configProvider, localeData } = this;
|
||||
const { sValue: value, inputFocused } = this.$data;
|
||||
const props = getOptionProps(this);
|
||||
let suffixIcon = getComponentFromProp(this, 'suffixIcon');
|
||||
|
@ -542,7 +543,7 @@ const Cascader = {
|
|||
loadingIcon,
|
||||
},
|
||||
on: {
|
||||
...$listeners,
|
||||
...getListeners(this),
|
||||
popupVisibleChange: this.handlePopupVisibleChange,
|
||||
change: this.handleChange,
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import classNames from 'classnames';
|
||||
import VcCheckbox from '../vc-checkbox';
|
||||
import { getOptionProps, getAttrs } from '../_util/props-util';
|
||||
import { getOptionProps, getAttrs, getListeners } from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
function noop() {}
|
||||
|
||||
|
@ -43,10 +43,10 @@ export default {
|
|||
},
|
||||
|
||||
render() {
|
||||
const { checkboxGroupContext: checkboxGroup, $listeners, $slots } = this;
|
||||
const { checkboxGroupContext: checkboxGroup, $slots } = this;
|
||||
const props = getOptionProps(this);
|
||||
const children = $slots.default;
|
||||
const { mouseenter = noop, mouseleave = noop, input, ...restListeners } = $listeners;
|
||||
const { mouseenter = noop, mouseleave = noop, input, ...restListeners } = getListeners(this);
|
||||
const { prefixCls: customizePrefixCls, indeterminate, ...restProps } = props;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
initDefaultProps,
|
||||
getComponentFromProp,
|
||||
isValidElement,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import { cloneElement } from '../_util/vnode';
|
||||
import VcCollapse, { collapseProps } from '../vc-collapse';
|
||||
|
@ -37,7 +38,7 @@ export default {
|
|||
},
|
||||
},
|
||||
render() {
|
||||
const { prefixCls: customizePrefixCls, bordered, $listeners } = this;
|
||||
const { prefixCls: customizePrefixCls, bordered } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
||||
|
||||
|
@ -51,7 +52,7 @@ export default {
|
|||
expandIcon: panelProps => this.renderExpandIcon(panelProps, prefixCls),
|
||||
},
|
||||
class: collapseClassName,
|
||||
on: $listeners,
|
||||
on: getListeners(this),
|
||||
};
|
||||
return <VcCollapse {...rcCollapeProps}>{this.$slots.default}</VcCollapse>;
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getOptionProps, getComponentFromProp } from '../_util/props-util';
|
||||
import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
|
||||
import VcCollapse, { panelProps } from '../vc-collapse';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
|
@ -11,7 +11,7 @@ export default {
|
|||
configProvider: { default: () => ConfigConsumerProps },
|
||||
},
|
||||
render() {
|
||||
const { prefixCls: customizePrefixCls, showArrow = true, $listeners } = this;
|
||||
const { prefixCls: customizePrefixCls, showArrow = true } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
||||
|
||||
|
@ -24,7 +24,7 @@ export default {
|
|||
prefixCls,
|
||||
},
|
||||
class: collapsePanelClassName,
|
||||
on: $listeners,
|
||||
on: getListeners(this),
|
||||
};
|
||||
const header = getComponentFromProp(this, 'header');
|
||||
return (
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import PropsTypes from '../_util/vue-types';
|
||||
import { initDefaultProps, getComponentFromProp } from '../_util/props-util';
|
||||
import { initDefaultProps, getComponentFromProp, getListeners } from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import Base from '../base';
|
||||
export const CommentProps = {
|
||||
|
@ -81,7 +81,7 @@ const Comment = {
|
|||
);
|
||||
const children = this.$slots.default;
|
||||
return (
|
||||
<div class={prefixCls} {...{ on: this.$listeners }}>
|
||||
<div class={prefixCls} {...{ on: getListeners(this) }}>
|
||||
{comment}
|
||||
{children ? this.renderNested(prefixCls, children) : null}
|
||||
</div>
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
mergeProps,
|
||||
getComponentFromProp,
|
||||
isValidElement,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import { cloneElement } from '../_util/vnode';
|
||||
|
||||
|
@ -131,11 +132,12 @@ export default function createPicker(TheCalendar, props) {
|
|||
},
|
||||
|
||||
render() {
|
||||
const { $listeners, $scopedSlots } = this;
|
||||
const { $scopedSlots } = this;
|
||||
const { sValue: value, showDate, _open: open } = this.$data;
|
||||
let suffixIcon = getComponentFromProp(this, 'suffixIcon');
|
||||
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
|
||||
const { panelChange = noop, focus = noop, blur = noop, ok = noop } = $listeners;
|
||||
const listeners = getListeners(this);
|
||||
const { panelChange = noop, focus = noop, blur = noop, ok = noop } = listeners;
|
||||
const props = getOptionProps(this);
|
||||
|
||||
const { prefixCls: customizePrefixCls, locale, localeCode } = props;
|
||||
|
@ -243,7 +245,7 @@ export default function createPicker(TheCalendar, props) {
|
|||
prefixCls: `${prefixCls}-picker-container`,
|
||||
},
|
||||
on: {
|
||||
...omit($listeners, 'change'),
|
||||
...omit(listeners, 'change'),
|
||||
...pickerProps.on,
|
||||
open,
|
||||
onOpenChange: this.handleOpenChange,
|
||||
|
|
|
@ -20,6 +20,7 @@ import {
|
|||
getOptionProps,
|
||||
hasProp,
|
||||
getComponentFromProp,
|
||||
getListeners,
|
||||
} from '../_util/props-util';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import isNumeric from '../_util/isNumeric';
|
||||
|
@ -234,7 +235,7 @@ export default {
|
|||
[`${prefixCls}-zero-width`]: parseFloat(siderWidth) === 0,
|
||||
});
|
||||
const divProps = {
|
||||
on: this.$listeners,
|
||||
on: getListeners(this),
|
||||
class: siderCls,
|
||||
style: divStyle,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { createRef } from '../../util';
|
|||
import generateSelector, { selectorPropTypes } from '../../Base/BaseSelector';
|
||||
import SearchInput from '../../SearchInput';
|
||||
import Selection from './Selection';
|
||||
import { getComponentFromProp } from '../../../../_util/props-util';
|
||||
import { getComponentFromProp, getListeners } from '../../../../_util/props-util';
|
||||
import getTransitionProps from '../../../../_util/getTransitionProps';
|
||||
import BaseMixin from '../../../../_util/BaseMixin';
|
||||
const TREE_SELECT_EMPTY_VALUE_KEY = 'RC_TREE_SELECT_EMPTY_VALUE_KEY';
|
||||
|
@ -87,10 +87,9 @@ const MultipleSelector = {
|
|||
} = this.$props;
|
||||
const {
|
||||
vcTreeSelect: { onMultipleSelectorRemove },
|
||||
$listeners,
|
||||
$slots,
|
||||
} = this;
|
||||
|
||||
const listeners = getListeners(this);
|
||||
// Check if `maxTagCount` is set
|
||||
let myValueList = selectorValueList;
|
||||
if (maxTagCount >= 0) {
|
||||
|
@ -105,7 +104,7 @@ const MultipleSelector = {
|
|||
label,
|
||||
value,
|
||||
},
|
||||
on: { ...$listeners, remove: onMultipleSelectorRemove },
|
||||
on: { ...listeners, remove: onMultipleSelectorRemove },
|
||||
}}
|
||||
key={value || TREE_SELECT_EMPTY_VALUE_KEY}
|
||||
>
|
||||
|
@ -134,7 +133,7 @@ const MultipleSelector = {
|
|||
label: content,
|
||||
value: null,
|
||||
},
|
||||
on: $listeners,
|
||||
on: listeners,
|
||||
}}
|
||||
key="rc-tree-select-internal-max-tag-counter"
|
||||
>
|
||||
|
@ -153,7 +152,7 @@ const MultipleSelector = {
|
|||
...this.$props,
|
||||
needAlign: true,
|
||||
},
|
||||
on: $listeners,
|
||||
on: listeners,
|
||||
directives: [
|
||||
{
|
||||
name: 'ant-ref',
|
||||
|
@ -187,7 +186,8 @@ const MultipleSelector = {
|
|||
},
|
||||
|
||||
render() {
|
||||
const { $listeners, $slots } = this;
|
||||
const { $slots } = this;
|
||||
const listeners = getListeners(this);
|
||||
return (
|
||||
<Selector
|
||||
{...{
|
||||
|
@ -198,7 +198,7 @@ const MultipleSelector = {
|
|||
renderSelection: this.renderSelection,
|
||||
renderPlaceholder: this._renderPlaceholder,
|
||||
},
|
||||
on: $listeners,
|
||||
on: listeners,
|
||||
}}
|
||||
>
|
||||
{$slots.default}
|
||||
|
|
|
@ -4,6 +4,7 @@ import PopupInner from './PopupInner';
|
|||
import LazyRenderBox from './LazyRenderBox';
|
||||
import animate from '../_util/css-animation';
|
||||
import BaseMixin from '../_util/BaseMixin';
|
||||
import { getListeners } from '../_util/props-util';
|
||||
|
||||
export default {
|
||||
mixins: [BaseMixin],
|
||||
|
@ -72,7 +73,8 @@ export default {
|
|||
this.currentAlignClassName = currentAlignClassName;
|
||||
popupDomNode.className = this.getClassName(currentAlignClassName);
|
||||
}
|
||||
this.$listeners.align && this.$listeners.align(popupDomNode, align);
|
||||
const listeners = getListeners(this);
|
||||
listeners.align && listeners.align(popupDomNode, align);
|
||||
},
|
||||
|
||||
// Record size if stretch needed
|
||||
|
@ -148,7 +150,7 @@ export default {
|
|||
return `${this.$props.prefixCls} ${this.$props.popupClassName} ${currentAlignClassName}`;
|
||||
},
|
||||
getPopupElement() {
|
||||
const { $props: props, $slots, $listeners, getTransitionName } = this;
|
||||
const { $props: props, $slots, getTransitionName } = this;
|
||||
const { stretchChecked, targetHeight, targetWidth } = this.$data;
|
||||
|
||||
const {
|
||||
|
@ -161,7 +163,6 @@ export default {
|
|||
destroyPopupOnHide,
|
||||
stretch,
|
||||
} = props;
|
||||
// const { mouseenter, mouseleave } = $listeners
|
||||
const className = this.getClassName(
|
||||
this.currentAlignClassName || getClassNameFromAlign(align),
|
||||
);
|
||||
|
@ -201,7 +202,7 @@ export default {
|
|||
// hiddenClassName,
|
||||
},
|
||||
class: className,
|
||||
on: $listeners,
|
||||
on: getListeners(this),
|
||||
ref: 'popupInstance',
|
||||
style: { ...sizeStyle, ...popupStyle, ...this.getZIndexStyle() },
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue