perf: add defineComponent

pull/2992/head
tanjinzhou 2020-10-12 13:27:16 +08:00
parent 3c20fc9f69
commit f48ccdac01
51 changed files with 142 additions and 115 deletions

View File

@ -1,7 +1,7 @@
import PropTypes from './vue-types';
import { Teleport } from 'vue';
import { defineComponent, Teleport } from 'vue';
export default {
export default defineComponent({
name: 'Portal',
props: {
getContainer: PropTypes.func.isRequired,
@ -45,4 +45,4 @@ export default {
}
return null;
},
};
});

View File

@ -2,6 +2,7 @@ import PropTypes from './vue-types';
import switchScrollingEffect from './switchScrollingEffect';
import setStyle from './setStyle';
import Portal from './Portal';
import { defineComponent } from 'vue';
let openCount = 0;
const windowIsUndefined = !(
@ -13,7 +14,7 @@ const windowIsUndefined = !(
// https://github.com/ant-design/ant-design/issues/19332
let cacheOverflow = {};
export default {
export default defineComponent({
name: 'PortalWrapper',
props: {
wrapperClassName: PropTypes.string,
@ -147,4 +148,4 @@ export default {
}
return portal;
},
};
});

View File

@ -1,5 +1,5 @@
import shallowEqual from '../shallowequal';
import { inject, createVNode, watchEffect } from 'vue';
import { inject, createVNode, watchEffect, defineComponent } from 'vue';
import omit from 'omit.js';
import { getOptionProps } from '../props-util';
@ -95,6 +95,6 @@ export default function connect(mapStateToProps) {
return createVNode(WrappedComponent, wrapProps, $slots);
},
};
return Connect;
return defineComponent(Connect);
};
}

View File

@ -1,3 +1,4 @@
import { defineComponent } from 'vue';
/**
* Wrap of sub component which need use as Button capacity (like Icon component).
* This helps accessibility reader to tread as a interactive button to operation.
@ -13,7 +14,7 @@ const inlineStyle = {
display: 'inline-block',
};
const TransButton = {
const TransButton = defineComponent({
name: 'TransButton',
inheritAttrs: false,
props: {
@ -71,6 +72,6 @@ const TransButton = {
</div>
);
},
};
});
export default TransButton;

View File

@ -10,7 +10,7 @@ import { inject } from 'vue';
export const ListItemProps = {
prefixCls: PropTypes.string,
extra: PropTypes.any,
actions: PropTypes.arrayOf(PropTypes.any),
actions: PropTypes.array,
grid: ListGridType,
};

View File

@ -17,7 +17,7 @@ export const SliderProps = () => ({
reverse: PropTypes.looseBool,
min: PropTypes.number,
max: PropTypes.number,
step: PropTypes.oneOfType([PropTypes.number, PropTypes.any]),
step: PropTypes.any,
marks: PropTypes.object,
dots: PropTypes.looseBool,
value: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),

View File

@ -37,7 +37,7 @@ export const TreeSelectProps = () => ({
searchValue: PropTypes.string,
showCheckedStrategy: PropTypes.oneOf(['SHOW_ALL', 'SHOW_PARENT', 'SHOW_CHILD']),
suffixIcon: PropTypes.any,
treeCheckable: withUndefined(PropTypes.oneOfType([PropTypes.any, PropTypes.looseBool])),
treeCheckable: PropTypes.any,
treeCheckStrictly: PropTypes.looseBool,
treeData: PropTypes.arrayOf(Object),
treeDataSimpleMode: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, Object])),

View File

@ -1,4 +1,4 @@
import { nextTick } from 'vue';
import { nextTick, defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import { alignElement, alignPoint } from 'dom-align';
import addEventListener from '../vc-util/Dom/addEventListener';
@ -18,7 +18,7 @@ function getPoint(point) {
return point;
}
export default {
export default defineComponent({
props: {
childrenProps: PropTypes.object,
align: PropTypes.object.isRequired,
@ -167,4 +167,4 @@ export default {
}
return child && child[0];
},
};
});

View File

@ -13,6 +13,7 @@ import DateInput from './date/DateInput';
import enUs from './locale/en_US';
import { getTimeConfig, getTodayTime, syncTime } from './util';
import { goStartMonth, goEndMonth, goTime } from './util/toTime';
import { defineComponent } from 'vue';
const getMomentObjectIfValid = date => {
if (moment.isMoment(date) && date.isValid()) {
@ -21,7 +22,7 @@ const getMomentObjectIfValid = date => {
return false;
};
const Calendar = {
const Calendar = defineComponent({
name: 'Calendar',
inheritAttrs: false,
props: {
@ -383,6 +384,6 @@ const Calendar = {
class: props.showWeekNumber ? `${prefixCls}-week-number` : '',
});
},
};
});
export default Calendar;

View File

@ -8,7 +8,8 @@ import CalendarMixin, { getNowByCurrentStateValue } from './mixin/CalendarMixin'
import CommonMixin from './mixin/CommonMixin';
import CalendarHeader from './full-calendar/CalendarHeader';
import enUs from './locale/en_US';
const FullCalendar = {
import { defineComponent } from 'vue';
const FullCalendar = defineComponent({
name: 'FullCalendar',
inheritAttrs: false,
props: {
@ -158,6 +159,6 @@ const FullCalendar = {
class: className.join(' '),
});
},
};
});
export default FullCalendar;

View File

@ -7,7 +7,8 @@ import CalendarFooter from './calendar/CalendarFooter';
import CalendarMixin from './mixin/CalendarMixin';
import CommonMixin from './mixin/CommonMixin';
import enUs from './locale/en_US';
const MonthCalendar = {
import { defineComponent } from 'vue';
const MonthCalendar = defineComponent({
name: 'MonthCalendar',
inheritAttrs: false,
props: {
@ -120,6 +121,6 @@ const MonthCalendar = {
children,
});
},
};
});
export default MonthCalendar;

View File

@ -8,6 +8,7 @@ import placements from './picker/placements';
import Trigger from '../../vc-trigger';
import moment from 'moment';
import isNil from 'lodash-es/isNil';
import { defineComponent } from 'vue';
const TimeType = {
validator(value) {
if (Array.isArray(value)) {
@ -24,7 +25,7 @@ function refFn(field, component) {
this[field] = component;
}
const Picker = {
const Picker = defineComponent({
name: 'Picker',
inheritAttrs: false,
props: {
@ -239,6 +240,6 @@ const Picker = {
</Trigger>
);
},
};
});
export default Picker;

View File

@ -11,6 +11,7 @@ import CommonMixin from './mixin/CommonMixin';
import enUs from './locale/en_US';
import { syncTime, getTodayTime, isAllowedDate } from './util/';
import { goTime, goStartMonth, goEndMonth, includesTime } from './util/toTime';
import { defineComponent } from 'vue';
function noop() {}
@ -79,7 +80,7 @@ function onInputSelect(direction, value, cause) {
this.fireSelectValueChange(selectedValue, null, cause || { source: 'dateInput' });
}
const RangeCalendar = {
const RangeCalendar = defineComponent({
name: 'RangeCalendar',
inheritAttrs: false,
props: {
@ -832,6 +833,6 @@ const RangeCalendar = {
</div>
);
},
};
});
export default RangeCalendar;

View File

@ -34,7 +34,7 @@ const DateTBody = {
dateRender: PropTypes.func,
disabledDate: PropTypes.func,
prefixCls: PropTypes.string,
selectedValue: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]),
selectedValue: PropTypes.any,
value: PropTypes.object,
hoverValue: PropTypes.any.def([]),
showWeekNumber: PropTypes.looseBool,

View File

@ -8,6 +8,7 @@ import shallowEqualArrays from 'shallow-equal/arrays';
import { hasProp, getEvents } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
import { cloneElement } from '../_util/vnode';
import { defineComponent } from 'vue';
const BUILT_IN_PLACEMENTS = {
bottomLeft: {
@ -44,7 +45,7 @@ const BUILT_IN_PLACEMENTS = {
},
};
export default {
export default defineComponent({
name: 'Cascader',
mixins: [BaseMixin],
inheritAttrs: false,
@ -384,4 +385,4 @@ export default {
</Trigger>
);
},
};
});

View File

@ -1,10 +1,10 @@
import { nextTick } from 'vue';
import { nextTick, defineComponent } from 'vue';
import classNames from '../../_util/classNames';
import PropTypes, { withUndefined } from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin';
import { getOptionProps, hasProp, initDefaultProps } from '../../_util/props-util';
export default {
export default defineComponent({
name: 'Checkbox',
mixins: [BaseMixin],
inheritAttrs: false,
@ -146,4 +146,4 @@ export default {
</span>
);
},
};
});

View File

@ -10,6 +10,7 @@ import { cloneElement } from '../../_util/vnode';
import openAnimationFactory from './openAnimationFactory';
import { collapseProps } from './commonProps';
import { getDataAndAriaProps } from '../../_util/util';
import { defineComponent } from 'vue';
function _toArray(activeKey) {
let currentActiveKey = activeKey;
@ -18,7 +19,7 @@ function _toArray(activeKey) {
}
return currentActiveKey.map(key => String(key));
}
export default {
export default defineComponent({
name: 'Collapse',
mixins: [BaseMixin],
inheritAttrs: false,
@ -142,4 +143,4 @@ export default {
</div>
);
},
};
});

View File

@ -1,10 +1,10 @@
import PanelContent from './PanelContent';
import { initDefaultProps, getComponent, getSlot } from '../../_util/props-util';
import { panelProps } from './commonProps';
import { Transition } from 'vue';
import { defineComponent, Transition } from 'vue';
import BaseMixin from '../../_util/BaseMixin';
export default {
export default defineComponent({
name: 'Panel',
mixins: [BaseMixin],
props: initDefaultProps(panelProps(), {
@ -90,4 +90,4 @@ export default {
</div>
);
},
};
});

View File

@ -1,7 +1,8 @@
import PropTypes from '../../_util/vue-types';
import { getSlot } from '../../_util/props-util';
import { defineComponent } from 'vue';
export default {
export default defineComponent({
name: 'PanelContent',
props: {
prefixCls: PropTypes.string,
@ -35,4 +36,4 @@ export default {
</div>
);
},
};
});

View File

@ -1,4 +1,4 @@
import { provide, Transition } from 'vue';
import { defineComponent, provide, Transition } from 'vue';
import { initDefaultProps, getSlot, findDOMNode } from '../_util/props-util';
import KeyCode from '../_util/KeyCode';
import contains from '../vc-util/Dom/contains';
@ -48,7 +48,7 @@ function offset(el) {
let cacheOverflow = {};
export default {
export default defineComponent({
name: 'VcDialog',
mixins: [BaseMixin],
inheritAttrs: false,
@ -429,4 +429,4 @@ export default {
</div>
);
},
};
});

View File

@ -2,8 +2,9 @@ import Dialog from './Dialog';
import getDialogPropTypes from './IDialogPropTypes';
import Portal from '../_util/PortalWrapper';
import { getSlot } from '../_util/props-util';
import { defineComponent } from 'vue';
const IDialogPropTypes = getDialogPropTypes();
const DialogWrap = {
const DialogWrap = defineComponent({
inheritAttrs: false,
props: {
...IDialogPropTypes,
@ -41,6 +42,6 @@ const DialogWrap = {
/>
);
},
};
});
export default DialogWrap;

View File

@ -1,5 +1,5 @@
import classnames from '../../_util/classNames';
import { cloneVNode, Teleport, nextTick } from 'vue';
import { cloneVNode, Teleport, nextTick, defineComponent } from 'vue';
import BaseMixin from '../../_util/BaseMixin';
import { initDefaultProps, getSlot } from '../../_util/props-util';
import getScrollBarSize from '../../_util/getScrollBarSize';
@ -24,7 +24,7 @@ const windowIsUndefined = !(
window.document.createElement
);
const Drawer = {
const Drawer = defineComponent({
name: 'Drawer',
mixins: [BaseMixin],
inheritAttrs: false,
@ -598,6 +598,6 @@ const Drawer = {
}
return portal;
},
};
});
export default Drawer;

View File

@ -1,4 +1,4 @@
import { Text } from 'vue';
import { defineComponent, Text } from 'vue';
import PropTypes from '../../_util/vue-types';
import Trigger from '../../vc-trigger';
import placements from './placements';
@ -12,7 +12,7 @@ import {
import BaseMixin from '../../_util/BaseMixin';
import { cloneElement } from '../../_util/vnode';
export default {
export default defineComponent({
mixins: [BaseMixin],
props: {
minOverlayWidthMatchTrigger: PropTypes.looseBool,
@ -198,4 +198,4 @@ export default {
};
return <Trigger {...triggerProps}>{this.renderChildren()}</Trigger>;
},
};
});

View File

@ -5,6 +5,7 @@ import { initDefaultProps, hasProp, getOptionProps } from '../../_util/props-uti
import classNames from '../../_util/classNames';
import KeyCode from '../../_util/KeyCode';
import InputHandler from './InputHandler';
import { defineComponent } from 'vue';
function preventDefault(e) {
e.preventDefault();
@ -78,7 +79,7 @@ const inputNumberProps = {
maxlength: PropTypes.any,
};
export default {
export default defineComponent({
name: 'VCInputNumber',
mixins: [BaseMixin],
inheritAttrs: false,
@ -800,4 +801,4 @@ export default {
</div>
);
},
};
});

View File

@ -7,7 +7,7 @@ import debounce from 'lodash-es/debounce';
import throttle from 'lodash-es/throttle';
import parentScroll from './utils/parentScroll';
import inViewport from './utils/inViewport';
import { watchEffect } from 'vue';
import { watchEffect, defineComponent } from 'vue';
const lazyLoadProps = {
debounce: PropTypes.looseBool,
@ -25,7 +25,7 @@ const lazyLoadProps = {
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
export default {
export default defineComponent({
name: 'LazyLoad',
mixins: [BaseMixin],
inheritAttrs: false,
@ -148,4 +148,4 @@ export default {
</ElementType>
);
},
};
});

View File

@ -4,8 +4,9 @@ import { cloneElement } from '../../_util/vnode';
import warning from '../../_util/warning';
import BaseMixin from '../../_util/BaseMixin';
import { ITouchProps } from './PropTypes';
import { defineComponent } from 'vue';
export default {
export default defineComponent({
name: 'TouchFeedback',
mixins: [BaseMixin],
inheritAttrs: false,
@ -104,4 +105,4 @@ export default {
return cloneElement(child, events);
},
};
});

View File

@ -1,4 +1,4 @@
import { provide, withDirectives } from 'vue';
import { defineComponent, provide, withDirectives } from 'vue';
import classNames from '../../_util/classNames';
import omit from 'omit.js';
import KeyCode from '../../_util/KeyCode';
@ -309,4 +309,4 @@ const Mentions = {
},
};
export default Mentions;
export default defineComponent(Mentions);

View File

@ -1,3 +1,4 @@
import { defineComponent } from 'vue';
import PropTypes from '../../_util/vue-types';
export const OptionProps = {
@ -6,10 +7,10 @@ export const OptionProps = {
children: PropTypes.any,
};
export default {
export default defineComponent({
name: 'Option',
props: OptionProps,
render() {
return null;
},
};
});

View File

@ -4,7 +4,7 @@ import { default as SubPopupMenu, getActiveKey } from './SubPopupMenu';
import BaseMixin from '../_util/BaseMixin';
import hasProp, { getOptionProps, getComponent, filterEmpty } from '../_util/props-util';
import commonPropsType from './commonPropsType';
import { provide } from 'vue';
import { defineComponent, provide } from 'vue';
const Menu = {
name: 'Menu',
@ -183,4 +183,4 @@ const Menu = {
},
};
export default Menu;
export default defineComponent(Menu);

View File

@ -1,6 +1,7 @@
import PropTypes from '../_util/vue-types';
import { getComponent, getSlot } from '../_util/props-util';
import { menuAllProps } from './util';
import { defineComponent } from 'vue';
const MenuItemGroup = {
name: 'MenuItemGroup',
@ -41,4 +42,4 @@ const MenuItemGroup = {
},
};
export default MenuItemGroup;
export default defineComponent(MenuItemGroup);

View File

@ -1,4 +1,4 @@
import { createApp, TransitionGroup } from 'vue';
import { createApp, defineComponent, TransitionGroup } from 'vue';
import PropTypes from '../_util/vue-types';
import { getComponent } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
@ -15,7 +15,7 @@ function getUuid() {
return `rcNotification_${now}_${seed++}`;
}
const Notification = {
const Notification = defineComponent({
mixins: [BaseMixin],
props: {
prefixCls: PropTypes.string.def('rc-notification'),
@ -117,7 +117,7 @@ const Notification = {
</div>
);
},
};
});
Notification.newInstance = function newNotificationInstance(properties, callback) {
const { getContainer, style, class: className, ...props } = properties || {};
@ -161,5 +161,4 @@ Notification.newInstance = function newNotificationInstance(properties, callback
});
app.mount(div);
};
export default Notification;

View File

@ -6,7 +6,7 @@ import Options from './Options';
import LOCALE from './locale/zh_CN';
import KEYCODE from './KeyCode';
import classNames from '../_util/classNames';
import { withDirectives } from 'vue';
import { defineComponent, withDirectives } from 'vue';
import antInput from '../_util/antInputDirective';
function noop() {}
@ -28,7 +28,7 @@ function calculatePage(p, state, props) {
return Math.floor((props.total - 1) / pageSize) + 1;
}
export default {
export default defineComponent({
name: 'Pagination',
mixins: [BaseMixin],
inheritAttrs: false,
@ -649,4 +649,4 @@ export default {
</ul>
);
},
};
});

View File

@ -2,6 +2,7 @@ import PropTypes, { withUndefined } from '../../_util/vue-types';
import { initDefaultProps } from '../../_util/props-util';
import enhancer from './enhancer';
import { propTypes, defaultProps } from './types';
import { defineComponent } from 'vue';
const circlePropTypes = {
...propTypes,
@ -70,7 +71,7 @@ function getPathStyles(offset, percent, strokeColor, strokeWidth, gapDegree = 0,
};
}
const Circle = {
const Circle = defineComponent({
name: 'Circle',
props: initDefaultProps(circlePropTypes, circleDefaultProps),
created() {
@ -184,6 +185,6 @@ const Circle = {
</svg>
);
},
};
});
export default enhancer(Circle);

View File

@ -1,8 +1,9 @@
import { defineComponent } from 'vue';
import { initDefaultProps } from '../../_util/props-util';
import enhancer from './enhancer';
import { propTypes, defaultProps } from './types';
const Line = {
const Line = defineComponent({
name: 'Line',
props: initDefaultProps(propTypes, defaultProps),
created() {
@ -78,6 +79,6 @@ const Line = {
</svg>
);
},
};
});
export default enhancer(Line);

View File

@ -11,6 +11,7 @@ import {
import BaseMixin from '../../_util/BaseMixin';
import { getOffsetLeft } from './util';
import Star from './Star';
import { defineComponent } from 'vue';
const rateProps = {
disabled: PropTypes.looseBool,
@ -28,7 +29,7 @@ const rateProps = {
function noop() {}
export default {
export default defineComponent({
name: 'Rate',
mixins: [BaseMixin],
inheritAttrs: false,
@ -211,4 +212,4 @@ export default {
</ul>
);
},
};
});

View File

@ -5,8 +5,9 @@ import InnerSlider from './inner-slider';
import defaultProps from './default-props';
import { canUseDOM } from './utils/innerSliderUtils';
import { getSlot } from '../../_util/props-util';
import { defineComponent } from 'vue';
export default {
export default defineComponent({
name: 'Slider',
props: {
...defaultProps,
@ -196,4 +197,4 @@ export default {
};
return <InnerSlider {...sliderProps} vSlots={this.$slots} __propsSymbol__={[]} />;
},
};
});

View File

@ -4,8 +4,9 @@ import { hasProp } from '../../_util/props-util';
import Track from './common/Track';
import createSlider from './common/createSlider';
import * as utils from './utils';
import { defineComponent } from 'vue';
const Slider = {
const Slider = defineComponent({
name: 'Slider',
inheritAttrs: false,
mixins: [BaseMixin],
@ -192,6 +193,6 @@ const Slider = {
};
},
},
};
});
export default createSlider(Slider);

View File

@ -1,12 +1,13 @@
import PropTypes, { withUndefined } from '../_util/vue-types';
import { getOptionProps, getComponent } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
import { defineComponent } from 'vue';
function isString(str) {
return typeof str === 'string';
}
function noop() {}
export default {
export default defineComponent({
name: 'Step',
mixins: [BaseMixin],
props: {
@ -143,4 +144,4 @@ export default {
</div>
);
},
};
});

View File

@ -4,8 +4,9 @@ import debounce from 'lodash-es/debounce';
import isFlexSupported from '../_util/isFlexSupported';
import { getSlot, getPropsData } from '../_util/props-util';
import { cloneElement } from '../_util/vnode';
import { defineComponent } from 'vue';
export default {
export default defineComponent({
name: 'Steps',
mixins: [BaseMixin],
props: {
@ -166,4 +167,4 @@ export default {
</div>
);
},
};
});

View File

@ -2,10 +2,11 @@ import { switchPropTypes } from './PropTypes';
import BaseMixin from '../_util/BaseMixin';
import { hasProp, getOptionProps, getComponent } from '../_util/props-util';
import Omit from 'omit.js';
import { defineComponent } from 'vue';
// function noop () {
// }
export default {
export default defineComponent({
name: 'VcSwitch',
mixins: [BaseMixin],
inheritAttrs: false,
@ -120,4 +121,4 @@ export default {
</button>
);
},
};
});

View File

@ -1,6 +1,7 @@
import { defineComponent } from 'vue';
import PropTypes from '../../_util/vue-types';
export default {
export default defineComponent({
name: 'ColumnGroup',
props: {
title: PropTypes.any,
@ -9,4 +10,4 @@ export default {
render() {
return null;
},
};
});

View File

@ -1,5 +1,5 @@
/* eslint-disable camelcase */
import { provide, markRaw } from 'vue';
import { provide, markRaw, defineComponent } from 'vue';
import shallowequal from '../../_util/shallowequal';
import merge from 'lodash-es/merge';
import classes from 'component-classes';
@ -16,7 +16,7 @@ import ExpandableTable from './ExpandableTable';
import { initDefaultProps, getOptionProps } from '../../_util/props-util';
import BaseMixin from '../../_util/BaseMixin';
export default {
export default defineComponent({
name: 'Table',
mixins: [BaseMixin],
inheritAttrs: false,
@ -590,4 +590,4 @@ export default {
</Provider>
);
},
};
});

View File

@ -6,7 +6,8 @@ import {
getTransformPropValue,
getMarginStyle,
} from './utils';
export default {
import { defineComponent } from 'vue';
export default defineComponent({
name: 'TabContent',
inheritAttrs: false,
props: {
@ -88,4 +89,4 @@ export default {
</div>
);
},
};
});

View File

@ -1,9 +1,9 @@
import { inject } from 'vue';
import { defineComponent, inject } from 'vue';
import PropTypes from '../../_util/vue-types';
import { getComponent, getSlot } from '../../_util/props-util';
import Sentinel from './Sentinel';
export default {
export default defineComponent({
name: 'TabPane',
props: {
active: PropTypes.looseBool,
@ -54,4 +54,4 @@ export default {
</div>
);
},
};
});

View File

@ -1,4 +1,4 @@
import { provide, reactive, watchEffect } from 'vue';
import { defineComponent, provide, reactive, watchEffect } from 'vue';
import BaseMixin from '../../_util/BaseMixin';
import PropTypes from '../../_util/vue-types';
import raf from 'raf';
@ -25,7 +25,7 @@ function activeKeyIsValid(props, key) {
return keys.indexOf(key) >= 0;
}
export default {
export default defineComponent({
name: 'Tabs',
mixins: [BaseMixin],
inheritAttrs: false,
@ -250,4 +250,4 @@ export default {
};
return <div {...p}>{contents}</div>;
},
};
});

View File

@ -13,13 +13,14 @@ import { cloneElement } from '../_util/vnode';
import Trigger from '../vc-trigger';
import Panel from './Panel';
import placements from './placements';
import { defineComponent } from 'vue';
function noop() {}
function refFn(field, component) {
this[field] = component;
}
export default {
export default defineComponent({
name: 'VcTimePicker',
mixins: [BaseMixin],
inheritAttrs: false,
@ -389,4 +390,4 @@ export default {
</Trigger>
);
},
};
});

View File

@ -3,8 +3,9 @@ import Trigger from '../vc-trigger';
import { placements } from './placements';
import Content from './Content';
import { hasProp, getComponent, getOptionProps, getSlot } from '../_util/props-util';
import { defineComponent } from 'vue';
function noop() {}
export default {
export default defineComponent({
name: 'Tooltip',
inheritAttrs: false,
props: {
@ -97,4 +98,4 @@ export default {
};
return <Trigger {...triggerProps}>{getSlot(this)[0]}</Trigger>;
},
};
});

View File

@ -18,7 +18,7 @@
* In single mode, we should focus on the `span`
* In multiple mode, we should focus on the `input`
*/
import { provide } from 'vue';
import { defineComponent, provide } from 'vue';
import shallowEqual from '../../_util/shallowequal';
import raf from 'raf';
import scrollIntoView from 'dom-scroll-into-view';
@ -67,7 +67,7 @@ function getWatch(keys = []) {
});
return watch;
}
const Select = {
const Select = defineComponent({
name: 'Select',
inheritAttrs: false,
mixins: [BaseMixin],
@ -95,7 +95,7 @@ const Select = {
children: PropTypes.any,
labelInValue: PropTypes.looseBool,
maxTagCount: PropTypes.number,
maxTagPlaceholder: PropTypes.oneOfType([PropTypes.any, PropTypes.func]),
maxTagPlaceholder: PropTypes.any,
maxTagTextLength: PropTypes.number,
showCheckedStrategy: PropTypes.oneOf([SHOW_ALL, SHOW_PARENT, SHOW_CHILD]),
dropdownClassName: PropTypes.string,
@ -1105,7 +1105,7 @@ const Select = {
};
return <SelectTrigger {...selectTriggerProps}>{$selector}</SelectTrigger>;
},
};
});
Select.TreeNode = SelectNode;
Select.SHOW_ALL = SHOW_ALL;

View File

@ -21,6 +21,7 @@ import {
warnOnlyTreeNode,
getDataAndAria,
} from './util';
import { defineComponent } from 'vue';
/**
* Thought we still use `cloneElement` to pass `key`,
@ -40,7 +41,7 @@ function getWatch(keys = []) {
return watch;
}
const Tree = {
const Tree = defineComponent({
name: 'Tree',
inheritAttrs: false,
mixins: [BaseMixin],
@ -678,7 +679,7 @@ const Tree = {
</ul>
);
},
};
});
export { Tree };

View File

@ -1,4 +1,4 @@
import { inject, provide, Transition } from 'vue';
import { defineComponent, inject, provide, Transition } from 'vue';
import PropTypes from '../../_util/vue-types';
import classNames from '../../_util/classNames';
import { getNodeChildren, mapChildren, warnOnlyTreeNode, getDataAndAria } from './util';
@ -12,7 +12,7 @@ const ICON_CLOSE = 'close';
const defaultTitle = '---';
const TreeNode = {
const TreeNode = defineComponent({
name: 'TreeNode',
inheritAttrs: false,
mixins: [BaseMixin],
@ -571,7 +571,7 @@ const TreeNode = {
</li>
);
},
};
});
TreeNode.isTreeNode = 1;

View File

@ -3,7 +3,7 @@ import { initDefaultProps, getSlot } from '../../_util/props-util';
import BaseMixin from '../../_util/BaseMixin';
import AjaxUpload from './AjaxUploader';
import IframeUpload from './IframeUploader';
import { nextTick } from 'vue';
import { defineComponent, nextTick } from 'vue';
function empty() {}
@ -30,7 +30,7 @@ const uploadProps = {
supportServerRender: PropTypes.looseBool,
openFileDialogOnClick: PropTypes.looseBool,
};
export default {
export default defineComponent({
name: 'Upload',
mixins: [BaseMixin],
inheritAttrs: false,
@ -93,4 +93,4 @@ export default {
const ComponentUploader = this.getComponent();
return <ComponentUploader {...componentProps}>{getSlot(this)}</ComponentUploader>;
},
};
});