fix: getComponentFromProp to getComponent

pull/2682/head
tangjinzhou 2020-07-19 23:02:34 +08:00
parent a194bbdf43
commit a3592033be
11 changed files with 27 additions and 27 deletions

View File

@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import hasProp, { import hasProp, {
initDefaultProps, initDefaultProps,
getComponentFromProp, getComponent,
filterEmpty, filterEmpty,
getListeners, getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
@ -174,8 +174,8 @@ const Carousel = {
const SlickCarouselProps = { const SlickCarouselProps = {
props: { props: {
...props, ...props,
nextArrow: getComponentFromProp(this, 'nextArrow'), nextArrow: getComponent(this, 'nextArrow'),
prevArrow: getComponentFromProp(this, 'prevArrow'), prevArrow: getComponent(this, 'prevArrow'),
}, },
on: getListeners(this), on: getListeners(this),
scopedSlots: this.$scopedSlots, scopedSlots: this.$scopedSlots,

View File

@ -13,7 +13,7 @@ import {
getOptionProps, getOptionProps,
initDefaultProps, initDefaultProps,
mergeProps, mergeProps,
getComponentFromProp, getComponent,
getListeners, getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
@ -262,7 +262,7 @@ export default {
render() { render() {
const props = getOptionProps(this); const props = getOptionProps(this);
let suffixIcon = getComponentFromProp(this, 'suffixIcon'); let suffixIcon = getComponent(this, 'suffixIcon');
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
const { const {
sValue: value, sValue: value,

View File

@ -7,7 +7,7 @@ import {
hasProp, hasProp,
getOptionProps, getOptionProps,
initDefaultProps, initDefaultProps,
getComponentFromProp, getComponent,
getListeners, getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
@ -135,7 +135,7 @@ export default {
render() { render() {
const props = getOptionProps(this); const props = getOptionProps(this);
let suffixIcon = getComponentFromProp(this, 'suffixIcon'); let suffixIcon = getComponent(this, 'suffixIcon');
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
const { const {
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,

View File

@ -13,7 +13,7 @@ import {
getOptionProps, getOptionProps,
initDefaultProps, initDefaultProps,
mergeProps, mergeProps,
getComponentFromProp, getComponent,
isValidElement, isValidElement,
getListeners, getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
@ -135,7 +135,7 @@ export default function createPicker(TheCalendar, props) {
render() { render() {
const { $scopedSlots } = this; const { $scopedSlots } = this;
const { sValue: value, showDate, _open: open } = this.$data; const { sValue: value, showDate, _open: open } = this.$data;
let suffixIcon = getComponentFromProp(this, 'suffixIcon'); let suffixIcon = getComponent(this, 'suffixIcon');
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
const listeners = getListeners(this); const listeners = getListeners(this);
const { panelChange = noop, focus = noop, blur = noop, ok = noop } = listeners; const { panelChange = noop, focus = noop, blur = noop, ok = noop } = listeners;

View File

@ -11,7 +11,7 @@ import {
initDefaultProps, initDefaultProps,
hasProp, hasProp,
getOptionProps, getOptionProps,
getComponentFromProp, getComponent,
isValidElement, isValidElement,
getListeners, getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
@ -174,7 +174,7 @@ const TimePicker = {
}, },
renderInputIcon(prefixCls) { renderInputIcon(prefixCls) {
let suffixIcon = getComponentFromProp(this, 'suffixIcon'); let suffixIcon = getComponent(this, 'suffixIcon');
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
const clockIcon = (suffixIcon && const clockIcon = (suffixIcon &&
isValidElement(suffixIcon) && isValidElement(suffixIcon) &&
@ -186,7 +186,7 @@ const TimePicker = {
}, },
renderClearIcon(prefixCls) { renderClearIcon(prefixCls) {
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
const clearIconPrefixCls = `${prefixCls}-clear`; const clearIconPrefixCls = `${prefixCls}-clear`;
if (clearIcon && isValidElement(clearIcon)) { if (clearIcon && isValidElement(clearIcon)) {
@ -210,7 +210,7 @@ const TimePicker = {
const pickerClassName = { const pickerClassName = {
[`${prefixCls}-${size}`]: !!size, [`${prefixCls}-${size}`]: !!size,
}; };
const tempAddon = getComponentFromProp(this, 'addon', {}, false); const tempAddon = getComponent(this, 'addon', {}, false);
const pickerAddon = panel => { const pickerAddon = panel => {
return tempAddon ? ( return tempAddon ? (
<div class={`${prefixCls}-panel-addon`}> <div class={`${prefixCls}-panel-addon`}>

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, hasProp, getComponentFromProp } from '../../_util/props-util'; import { getOptionProps, hasProp, getComponent } from '../../_util/props-util';
import { cloneElement } from '../../_util/vnode'; import { cloneElement } from '../../_util/vnode';
import KeyCode from '../../_util/KeyCode'; import KeyCode from '../../_util/KeyCode';
import moment from 'moment'; import moment from 'moment';
@ -261,7 +261,7 @@ const Calendar = {
monthCellContentRender, monthCellContentRender,
$props: props, $props: props,
} = this; } = this;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
const showTimePicker = sMode === 'time'; const showTimePicker = sMode === 'time';
const disabledTimeConfig = const disabledTimeConfig =
showTimePicker && disabledTime && timePicker showTimePicker && disabledTime && timePicker

View File

@ -4,7 +4,7 @@ import {
getOptionProps, getOptionProps,
hasProp, hasProp,
mergeProps, mergeProps,
getComponentFromProp, getComponent,
getListeners, getListeners,
} from '../../_util/props-util'; } from '../../_util/props-util';
import moment from 'moment'; import moment from 'moment';
@ -669,7 +669,7 @@ const RangeCalendar = {
type, type,
seperator, seperator,
} = props; } = props;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
const { sHoverValue, sSelectedValue, sMode: mode, sShowTimePicker, sValue } = this; const { sHoverValue, sSelectedValue, sMode: mode, sShowTimePicker, sValue } = this;
const className = { const className = {
[prefixCls]: 1, [prefixCls]: 1,

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 { getComponentFromProp } from '../../../_util/props-util'; import { getComponent } from '../../../_util/props-util';
import moment from 'moment'; import moment from 'moment';
import { formatDate } from '../util'; import { formatDate } from '../util';
import KeyCode from '../../../_util/KeyCode'; import KeyCode from '../../../_util/KeyCode';
@ -184,7 +184,7 @@ const DateInput = {
inputMode, inputMode,
inputReadOnly, inputReadOnly,
} = this; } = this;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
const invalidClass = invalid ? `${prefixCls}-input-invalid` : ''; const invalidClass = invalid ? `${prefixCls}-input-invalid` : '';
return ( return (
<div class={`${prefixCls}-input-wrap`}> <div class={`${prefixCls}-input-wrap`}>

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, getListeners } from '../../../_util/props-util'; import { getOptionProps, getComponent, 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';
@ -62,7 +62,7 @@ const CalendarPart = {
inputMode, inputMode,
inputReadOnly, inputReadOnly,
} = props; } = props;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
const { const {
inputChange = noop, inputChange = noop,
inputSelect = noop, inputSelect = noop,

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, getListeners } from '../_util/props-util'; import { getComponent, getListeners } from '../_util/props-util';
function noop() {} function noop() {}
@ -144,7 +144,7 @@ const Panel = {
sValue, sValue,
currentSelectPanel, currentSelectPanel,
} = this; } = this;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
const { esc = noop, keydown = noop } = getListeners(this); const { esc = noop, keydown = noop } = getListeners(this);
const disabledHourOptions = this.disabledHours2(); const disabledHourOptions = this.disabledHours2();

View File

@ -5,7 +5,7 @@ import BaseMixin from '../_util/BaseMixin';
import { import {
initDefaultProps, initDefaultProps,
hasProp, hasProp,
getComponentFromProp, getComponent,
isValidElement, isValidElement,
getEvents, getEvents,
} from '../_util/props-util'; } from '../_util/props-util';
@ -205,7 +205,7 @@ export default {
secondStep, secondStep,
sValue, sValue,
} = this; } = this;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
return ( return (
<Panel <Panel
clearText={clearText} clearText={clearText}
@ -296,7 +296,7 @@ export default {
if (!allowEmpty || !sValue || disabled) { if (!allowEmpty || !sValue || disabled) {
return null; return null;
} }
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponent(this, 'clearIcon');
if (isValidElement(clearIcon)) { if (isValidElement(clearIcon)) {
const { click } = getEvents(clearIcon) || {}; const { click } = getEvents(clearIcon) || {};
return cloneElement(clearIcon, { return cloneElement(clearIcon, {
@ -344,7 +344,7 @@ export default {
popupStyle, popupStyle,
} = this; } = this;
const popupClassName = this.getPopupClassName(); const popupClassName = this.getPopupClassName();
const inputIcon = getComponentFromProp(this, 'inputIcon'); const inputIcon = getComponent(this, 'inputIcon');
return ( return (
<Trigger <Trigger
prefixCls={`${prefixCls}-panel`} prefixCls={`${prefixCls}-panel`}