chore: enhance eslint (#1890)

* perf: enhance eslint

* perf: remove props in progress
pull/1938/head
Amour1688 2020-03-18 14:52:02 +08:00 committed by GitHub
parent e654713290
commit 615b460ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 104 additions and 163 deletions

View File

@ -15,6 +15,10 @@
"rules": { "rules": {
"comma-dangle": [2, "always-multiline"], "comma-dangle": [2, "always-multiline"],
"no-var": "error", "no-var": "error",
"no-console": [2, { "allow": ["warn", "error"] }],
"object-shorthand": 2,
"no-unused-vars": [2, { "ignoreRestSiblings": true, "argsIgnorePattern": "^h$" }],
"no-undef": 2,
"camelcase": "off", "camelcase": "off",
"no-extra-boolean-cast": "off", "no-extra-boolean-cast": "off",
"semi": ["error", "always"], "semi": ["error", "always"],
@ -32,5 +36,8 @@
} }
} }
] ]
},
"globals": {
"h": true
} }
} }

View File

@ -52,7 +52,7 @@ export default {
} }
if (!this._component) { if (!this._component) {
this._component = new this.$root.constructor({ this._component = new this.$root.constructor({
el: el, el,
parent: self, parent: self,
data: { data: {
comProps: props, comProps: props,

View File

@ -1,3 +1,4 @@
/* eslint-disable no-undef */
// Browser environment sniffing // Browser environment sniffing
export const inBrowser = typeof window !== 'undefined'; export const inBrowser = typeof window !== 'undefined';
export const inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform; export const inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;

View File

@ -2,7 +2,6 @@ import Affix from '..';
import Button from '../../button'; import Button from '../../button';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { spyElementPrototype } from '../../__tests__/util/domHook'; import { spyElementPrototype } from '../../__tests__/util/domHook';
import { asyncExpect } from '@/tests/utils';
const events = {}; const events = {};
const AffixMounter = { const AffixMounter = {
@ -62,7 +61,7 @@ describe('Affix Render', () => {
}); });
const movePlaceholder = top => { const movePlaceholder = top => {
classRect.fixed = { classRect.fixed = {
top: top, top,
bottom: top, bottom: top,
}; };
events.scroll({ events.scroll({

View File

@ -1,6 +1,5 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import classNames from 'classnames'; import classNames from 'classnames';
import shallowequal from 'shallowequal';
import omit from 'omit.js'; import omit from 'omit.js';
import ResizeObserver from '../vc-resize-observer'; import ResizeObserver from '../vc-resize-observer';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
@ -231,7 +230,7 @@ const Affix = {
}, },
render() { render() {
const { prefixCls, affixStyle, placeholderStyle, status, $slots, $props } = this; const { prefixCls, affixStyle, placeholderStyle, $slots, $props } = this;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const className = classNames({ const className = classNames({
[getPrefixCls('affix', prefixCls)]: affixStyle, [getPrefixCls('affix', prefixCls)]: affixStyle,

View File

@ -61,7 +61,7 @@ export default {
return originalPaths; return originalPaths;
}, },
genForRoutes({ routes = [], params = {}, separator, itemRender = defaultItemRender }) { genForRoutes({ routes = [], params = {}, separator, itemRender = this.defaultItemRender }) {
const paths = []; const paths = [];
return routes.map(route => { return routes.map(route => {
const path = this.getPath(route.path, params); const path = this.getPath(route.path, params);

View File

@ -26,7 +26,7 @@ export default {
}; };
}, },
render() { render() {
const { prefixCls: customizePrefixCls, size, sizeMap, $slots } = this; const { prefixCls: customizePrefixCls, size, $slots } = this;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('btn-group', customizePrefixCls); const prefixCls = getPrefixCls('btn-group', customizePrefixCls);

View File

@ -36,7 +36,6 @@ export default {
sLoading, sLoading,
ghost, ghost,
block, block,
sizeMap,
icon, icon,
$slots, $slots,
} = this; } = this;

View File

@ -1,7 +1,7 @@
import Select from '../select'; import Select from '../select';
import { Group, Button } from '../radio'; import { Group, Button } from '../radio';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { initDefaultProps, getComponentFromProp } from '../_util/props-util'; import { initDefaultProps } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
const { Option } = Select; const { Option } = Select;

View File

@ -22,7 +22,7 @@ function zerofixed(v) {
} }
export const MomentType = { export const MomentType = {
type: Object, type: Object,
validator: function(value) { validator(value) {
return moment.isMoment(value); return moment.isMoment(value);
}, },
}; };
@ -207,11 +207,11 @@ const Calendar = {
Select: {}, Select: {},
locale: locale.lang, locale: locale.lang,
type: mode === 'year' ? 'month' : 'date', type: mode === 'year' ? 'month' : 'date',
prefixCls: prefixCls, prefixCls,
showHeader: false, showHeader: false,
value: value, value,
monthCellRender: monthCellRender, monthCellRender,
dateCellRender: dateCellRender, dateCellRender,
disabledDate, disabledDate,
}, },
on: { on: {

View File

@ -3,8 +3,6 @@ import Card from '../index';
import Button from '../../button/index'; import Button from '../../button/index';
import mountTest from '../../../tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';
const testMethod = typeof window !== 'undefined' ? it : xit;
describe('Card', () => { describe('Card', () => {
mountTest(Card); mountTest(Card);
beforeAll(() => { beforeAll(() => {

View File

@ -484,7 +484,7 @@ const Cascader = {
prefixCls: inputPrefixCls, prefixCls: inputPrefixCls,
placeholder: value && value.length > 0 ? undefined : placeholder, placeholder: value && value.length > 0 ? undefined : placeholder,
value: inputValue, value: inputValue,
disabled: disabled, disabled,
readOnly: !showSearch, readOnly: !showSearch,
autoComplete: 'off', autoComplete: 'off',
}, },
@ -535,11 +535,11 @@ const Cascader = {
props: { props: {
...props, ...props,
getPopupContainer, getPopupContainer,
options: options, options,
prefixCls, prefixCls,
value: value, value,
popupVisible: sPopupVisible, popupVisible: sPopupVisible,
dropdownMenuColumnStyle: dropdownMenuColumnStyle, dropdownMenuColumnStyle,
expandIcon, expandIcon,
loadingIcon, loadingIcon,
}, },

View File

@ -1,5 +1,5 @@
import PropsTypes from '../_util/vue-types'; import PropsTypes from '../_util/vue-types';
import { initDefaultProps, getComponentFromProp, getListeners } from '../_util/props-util'; import { getComponentFromProp, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Base from '../base'; import Base from '../base';
export const CommentProps = { export const CommentProps = {

View File

@ -14,11 +14,9 @@ import {
initDefaultProps, initDefaultProps,
mergeProps, mergeProps,
getComponentFromProp, getComponentFromProp,
isValidElement,
getListeners, 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 { formatDate } from './utils'; import { formatDate } from './utils';
import InputIcon from './InputIcon'; import InputIcon from './InputIcon';
@ -221,7 +219,7 @@ export default {
this.$refs.picker.blur(); this.$refs.picker.blur();
}, },
renderFooter(...args) { renderFooter() {
const { ranges, $scopedSlots, $slots } = this; const { ranges, $scopedSlots, $slots } = this;
const { _prefixCls: prefixCls, _tagPrefixCls: tagPrefixCls } = this; const { _prefixCls: prefixCls, _tagPrefixCls: tagPrefixCls } = this;
const renderExtraFooter = const renderExtraFooter =
@ -341,22 +339,22 @@ export default {
const rangeCalendarProps = mergeProps(calendarProps, { const rangeCalendarProps = mergeProps(calendarProps, {
props: { props: {
separator, separator,
format: format, format,
prefixCls: prefixCls, prefixCls,
renderFooter: this.renderFooter, renderFooter: this.renderFooter,
timePicker: props.timePicker, timePicker: props.timePicker,
disabledDate: disabledDate, disabledDate,
disabledTime: disabledTime, disabledTime,
dateInputPlaceholder: [startPlaceholder, endPlaceholder], dateInputPlaceholder: [startPlaceholder, endPlaceholder],
locale: locale.lang, locale: locale.lang,
dateRender: dateRender, dateRender,
value: showDate, value: showDate,
hoverValue: hoverValue, hoverValue,
showToday: showToday, showToday,
}, },
on: { on: {
change: calendarChange, change: calendarChange,
ok: ok, ok,
valueChange: this.handleShowDateChange, valueChange: this.handleShowDateChange,
hoverChange: this.handleHoverChange, hoverChange: this.handleHoverChange,
panelChange, panelChange,
@ -419,9 +417,9 @@ export default {
pickerChangeHandler, pickerChangeHandler,
{ {
props: { props: {
calendar: calendar, calendar,
value: value, value,
open: open, open,
prefixCls: `${prefixCls}-picker-container`, prefixCls: `${prefixCls}-picker-container`,
}, },
on: { on: {

View File

@ -8,13 +8,11 @@ import {
getOptionProps, getOptionProps,
initDefaultProps, initDefaultProps,
getComponentFromProp, getComponentFromProp,
isValidElement,
getListeners, 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';
import interopDefault from '../_util/interopDefault'; import interopDefault from '../_util/interopDefault';
import { cloneElement } from '../_util/vnode';
import InputIcon from './InputIcon'; import InputIcon from './InputIcon';
function formatValue(value, format) { function formatValue(value, format) {

View File

@ -191,7 +191,7 @@ export default function createPicker(TheCalendar, props) {
value: showDate, value: showDate,
}, },
on: { on: {
ok: ok, ok,
panelChange, panelChange,
change: this.handleCalendarChange, change: this.handleCalendarChange,
}, },

View File

@ -4,7 +4,7 @@ import PropTypes from '../_util/vue-types';
export const MomentType = { export const MomentType = {
type: Object, type: Object,
validator: function(value) { validator(value) {
return value === undefined || moment.isMoment(value); return value === undefined || moment.isMoment(value);
}, },
}; };

View File

@ -133,7 +133,7 @@ const Form = {
colon: true, colon: true,
}), }),
Item: FormItem, Item: FormItem,
createFormField: createFormField, createFormField,
create: (options = {}) => { create: (options = {}) => {
return createDOMForm({ return createDOMForm({
fieldNameProp: 'id', fieldNameProp: 'id',
@ -246,7 +246,7 @@ const Form = {
data() { data() {
return { return {
children: $slots.default, children: $slots.default,
formClassName: formClassName, formClassName,
submit: onSubmit, submit: onSubmit,
}; };
}, },

View File

@ -238,7 +238,7 @@ export default {
// Resolve duplicated ids bug between different forms // Resolve duplicated ids bug between different forms
// https://github.com/ant-design/ant-design/issues/7351 // https://github.com/ant-design/ant-design/issues/7351
onLabelClick(e) { onLabelClick() {
const id = this.id || this.getId(); const id = this.id || this.getId();
if (!id) { if (!id) {
return; return;

View File

@ -3,15 +3,6 @@ import BaseMixin from '../_util/BaseMixin';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import ResponsiveObserve from '../_util/responsiveObserve'; import ResponsiveObserve from '../_util/responsiveObserve';
const BreakpointMap = PropTypes.shape({
xs: PropTypes.number,
sm: PropTypes.number,
md: PropTypes.number,
lg: PropTypes.number,
xl: PropTypes.number,
xxl: PropTypes.number,
}).loose;
const RowProps = { const RowProps = {
gutter: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]), gutter: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
type: PropTypes.oneOf(['flex']), type: PropTypes.oneOf(['flex']),

View File

@ -1,8 +1,6 @@
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Layout from '..'; import Layout from '..';
import Icon from '../../icon';
import Menu from '../../menu';
import mountTest from '../../../tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';
const { Sider, Content } = Layout; const { Sider, Content } = Layout;

View File

@ -1,7 +1,6 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { import {
getSlotOptions,
getComponentFromProp, getComponentFromProp,
isStringElement, isStringElement,
getListeners, getListeners,

View File

@ -1,7 +1,6 @@
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Mentions from '..'; import Mentions from '..';
import { asyncExpect } from '@/tests/utils';
import focusTest from '../../../tests/shared/focusTest'; import focusTest from '../../../tests/shared/focusTest';
const { getMentions } = Mentions; const { getMentions } = Mentions;

View File

@ -160,7 +160,7 @@ const Mentions = {
...otherProps, ...otherProps,
disabled, disabled,
filterOption: this.getFilterOption(), filterOption: this.getFilterOption(),
getPopupContainer: getPopupContainer, getPopupContainer,
children: this.getOptions(), children: this.getOptions(),
}, },
class: mergedClassName, class: mergedClassName,

View File

@ -132,7 +132,7 @@ describe('Menu', () => {
props: { props: {
openKeys: { openKeys: {
type: Array, type: Array,
default: function() { default() {
return ['1']; return ['1'];
}, },
}, },
@ -171,7 +171,7 @@ describe('Menu', () => {
props: { props: {
openKeys: { openKeys: {
type: Array, type: Array,
default: function() { default() {
return ['1']; return ['1'];
}, },
}, },
@ -209,7 +209,7 @@ describe('Menu', () => {
props: { props: {
openKeys: { openKeys: {
type: Array, type: Array,
default: function() { default() {
return ['1']; return ['1'];
}, },
}, },

View File

@ -79,7 +79,7 @@ const Menu = {
inlineCollapsed(val) { inlineCollapsed(val) {
this.collapsedChange(val); this.collapsedChange(val);
}, },
'layoutSiderContext.sCollapsed': function(val) { 'layoutSiderContext.sCollapsed'(val) {
this.collapsedChange(val); this.collapsedChange(val);
}, },
}, },

View File

@ -199,7 +199,7 @@ export default {
wrapClassName: classNames({ [`${prefixCls}-centered`]: !!centered }, wrapClassName), wrapClassName: classNames({ [`${prefixCls}-centered`]: !!centered }, wrapClassName),
title, title,
footer: footer === undefined ? defaultFooter : footer, footer: footer === undefined ? defaultFooter : footer,
visible: visible, visible,
mousePosition, mousePosition,
closeIcon: closeIconToRender, closeIcon: closeIconToRender,
}, },

View File

@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import Vue from 'vue';
import Modal from '..'; import Modal from '..';
import mountTest from '../../../tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';

View File

@ -46,7 +46,7 @@ export default function confirm(config) {
confirmDialogProps.props = props; confirmDialogProps.props = props;
const V = Base.Vue || Vue; const V = Base.Vue || Vue;
return new V({ return new V({
el: el, el,
parent: config.parentContext, parent: config.parentContext,
data() { data() {
return { confirmDialogProps }; return { confirmDialogProps };

View File

@ -22,6 +22,7 @@ export const PageHeaderProps = {
}; };
const renderBack = (instance, prefixCls, backIcon, onBack) => { const renderBack = (instance, prefixCls, backIcon, onBack) => {
// eslint-disable-next-line no-unused-vars
const h = instance.$createElement; const h = instance.$createElement;
if (!backIcon || !onBack) { if (!backIcon || !onBack) {
return null; return null;

View File

@ -7,10 +7,6 @@ import Line from './line';
import Circle from './circle'; import Circle from './circle';
import { validProgress } from './utils'; import { validProgress } from './utils';
function addUnit(num, unit) {
const unitType = unit || 'px';
return num ? num + unitType : null;
}
const ProgressStatuses = ['normal', 'exception', 'active', 'success']; const ProgressStatuses = ['normal', 'exception', 'active', 'success'];
export const ProgressType = PropTypes.oneOf(['line', 'circle', 'dashboard']); export const ProgressType = PropTypes.oneOf(['line', 'circle', 'dashboard']);
export const ProgressSize = PropTypes.oneOf(['default', 'small']); export const ProgressSize = PropTypes.oneOf(['default', 'small']);
@ -91,24 +87,7 @@ export default {
}, },
render() { render() {
const props = getOptionProps(this); const props = getOptionProps(this);
const { const { prefixCls: customizePrefixCls, size, type, showInfo } = props;
prefixCls: customizePrefixCls,
percent = 0,
status,
format,
trailColor,
size,
successPercent,
type,
strokeWidth,
width,
showInfo,
gapDegree = 0,
gapPosition,
strokeColor,
strokeLinecap = 'round',
...restProps
} = props;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('progress', customizePrefixCls); const prefixCls = getPrefixCls('progress', customizePrefixCls);
const progressStatus = this.getProgressStatus(); const progressStatus = this.getProgressStatus();
@ -144,9 +123,6 @@ export default {
}); });
const progressProps = { const progressProps = {
props: {
...restProps,
},
on: getListeners(this), on: getListeners(this),
class: classString, class: classString,
}; };

View File

@ -100,7 +100,7 @@ export default {
// options, 使 // options, 使
if (options && options.length > 0) { if (options && options.length > 0) {
children = options.map((option, index) => { children = options.map(option => {
if (typeof option === 'string') { if (typeof option === 'string') {
return ( return (
<Radio <Radio

View File

@ -2,7 +2,6 @@ import { mount } from '@vue/test-utils';
import { asyncExpect } from '@/tests/utils'; import { asyncExpect } from '@/tests/utils';
import Radio from '../Radio'; import Radio from '../Radio';
import RadioGroup from '../Group'; import RadioGroup from '../Group';
import RadioButton from '../RadioButton';
describe('Radio', () => { describe('Radio', () => {
function createRadioGroup(props, listeners = {}) { function createRadioGroup(props, listeners = {}) {

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 { getComponentFromProp } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import Icon from '../icon'; import Icon from '../icon';
import Base from '../base'; import Base from '../base';
@ -57,7 +57,7 @@ const Result = {
configProvider: { default: () => ConfigConsumerProps }, configProvider: { default: () => ConfigConsumerProps },
}, },
render(h) { render(h) {
const { prefixCls: customizePrefixCls, status, ...restProps } = this; const { prefixCls: customizePrefixCls, status } = this;
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('result', customizePrefixCls); const prefixCls = getPrefixCls('result', customizePrefixCls);

View File

@ -1,5 +1,4 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { initDefaultProps } from '../_util/props-util';
const widthUnit = PropTypes.oneOfType([PropTypes.number, PropTypes.string]); const widthUnit = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);

View File

@ -1,10 +1,8 @@
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { asyncExpect } from '@/tests/utils';
import MockDate from 'mockdate'; import MockDate from 'mockdate';
import moment from 'moment'; import moment from 'moment';
import Statistic from '..'; import Statistic from '..';
import { formatTimeStr } from '../utils'; import { formatTimeStr } from '../utils';
import { sleep } from '../../../tests/utils';
import mountTest from '../../../tests/shared/mountTest'; import mountTest from '../../../tests/shared/mountTest';
describe('Statistic', () => { describe('Statistic', () => {

View File

@ -114,7 +114,7 @@ export default {
watch: { watch: {
$props: { $props: {
handler: function() { handler() {
this.setCheckState(this.$props); this.setCheckState(this.$props);
}, },
deep: true, deep: true,

View File

@ -60,8 +60,6 @@ const defaultPagination = {
onShowSizeChange: noop, onShowSizeChange: noop,
}; };
const ROW_SELECTION_COLUMN_WIDTH = '62px';
/** /**
* Avoid creating new object, so that parent component's shouldComponentUpdate * Avoid creating new object, so that parent component's shouldComponentUpdate
* can works appropriately * can works appropriately
@ -1050,7 +1048,6 @@ export default {
let filterDropdown; let filterDropdown;
let sortButton; let sortButton;
let customHeaderCell = column.customHeaderCell; let customHeaderCell = column.customHeaderCell;
const title = this.renderColumnTitle(column.title);
const isSortColumn = this.isSortColumn(column); const isSortColumn = this.isSortColumn(column);
if ((column.filters && column.filters.length > 0) || column.filterDropdown) { if ((column.filters && column.filters.length > 0) || column.filterDropdown) {
const colFilters = key in filters ? filters[key] : []; const colFilters = key in filters ? filters[key] : [];

View File

@ -69,7 +69,7 @@ describe('SelectionBox', () => {
const store = getDefaultStore(); const store = getDefaultStore();
const wrapper = mount(SelectionBox, { const wrapper = mount(SelectionBox, {
propsData: { propsData: {
store: store, store,
rowIndex: '1', rowIndex: '1',
disabled: false, disabled: false,
defaultSelection: [], defaultSelection: [],

View File

@ -592,7 +592,7 @@ describe('Table.rowSelection', () => {
propsData: { propsData: {
columns: filterColumns, columns: filterColumns,
dataSource: data, dataSource: data,
rowSelection: rowSelection, rowSelection,
}, },
sync: false, sync: false,
}); });
@ -692,7 +692,7 @@ describe('Table.rowSelection', () => {
const wrapper = mount(Table, { const wrapper = mount(Table, {
propsData: { propsData: {
columns: columns, columns,
dataSource: newDatas, dataSource: newDatas,
rowSelection: {}, rowSelection: {},
childrenColumnName: 'test', childrenColumnName: 'test',

View File

@ -107,7 +107,7 @@ describe('Table', () => {
dataIndex: 'age', dataIndex: 'age',
key: 'age', key: 'age',
align: 'center', align: 'center',
customCell: (record, rowIndex) => { customCell: () => {
return { return {
style: { style: {
color: 'red', color: 'red',

View File

@ -107,7 +107,7 @@ export default {
display: 'inline-block', // default inline-block is important display: 'inline-block', // default inline-block is important
...picked, ...picked,
cursor: 'not-allowed', cursor: 'not-allowed',
width: isAntBtn && ele.componentOptions.propsData.block ? '100%' : null, width: ele.componentOptions.propsData.block ? '100%' : null,
}; };
const buttonStyle = { const buttonStyle = {
...omitted, ...omitted,

View File

@ -7,7 +7,6 @@ import {
getOptionProps, getOptionProps,
filterEmpty, filterEmpty,
getComponentFromProp, getComponentFromProp,
getClass,
getListeners, getListeners,
} from '../_util/props-util'; } from '../_util/props-util';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';

View File

@ -19,7 +19,7 @@ export default {
name: 'AUpload', name: 'AUpload',
mixins: [BaseMixin], mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
Dragger: Dragger, Dragger,
props: initDefaultProps(UploadProps, { props: initDefaultProps(UploadProps, {
type: 'select', type: 'select',
multiple: false, multiple: false,

View File

@ -731,7 +731,7 @@ const RangeCalendar = {
mode: mode[0], mode: mode[0],
placeholder: placeholder1, placeholder: placeholder1,
showDateInput: this.showDateInput, showDateInput: this.showDateInput,
timePicker: timePicker, timePicker,
showTimePicker: sShowTimePicker || mode[0] === 'time', showTimePicker: sShowTimePicker || mode[0] === 'time',
enablePrev: true, enablePrev: true,
enableNext: !isClosestMonths || this.isMonthYearPanelShow(mode[1]), enableNext: !isClosestMonths || this.isMonthYearPanelShow(mode[1]),
@ -754,7 +754,7 @@ const RangeCalendar = {
value: endValue, value: endValue,
mode: mode[1], mode: mode[1],
showDateInput: this.showDateInput, showDateInput: this.showDateInput,
timePicker: timePicker, timePicker,
showTimePicker: sShowTimePicker || mode[1] === 'time', showTimePicker: sShowTimePicker || mode[1] === 'time',
disabledTime: this.disabledEndTime, disabledTime: this.disabledEndTime,
disabledMonth: this.disabledEndMonth, disabledMonth: this.disabledEndMonth,

View File

@ -44,7 +44,7 @@ const CalendarFooter = {
const btnProps = { const btnProps = {
props: { props: {
...props, ...props,
value: value, value,
}, },
on: getListeners(this), on: getListeners(this),
}; };

View File

@ -363,9 +363,9 @@ export default {
const triggerProps = { const triggerProps = {
props: { props: {
...restProps, ...restProps,
disabled: disabled, disabled,
popupPlacement: popupPlacement, popupPlacement,
builtinPlacements: builtinPlacements, builtinPlacements,
popupTransitionName: transitionName, popupTransitionName: transitionName,
action: disabled ? [] : ['click'], action: disabled ? [] : ['click'],
popupVisible: disabled ? false : sPopupVisible, popupVisible: disabled ? false : sPopupVisible,

View File

@ -1,6 +1,5 @@
import PanelContent from './PanelContent'; import PanelContent from './PanelContent';
import { initDefaultProps, getComponentFromProp } from '../../_util/props-util'; import { initDefaultProps, getComponentFromProp } from '../../_util/props-util';
import { cloneElement } from '../../_util/vnode';
import { panelProps } from './commonProps'; import { panelProps } from './commonProps';
export default { export default {

View File

@ -191,7 +191,7 @@ export default {
popupAnimation: animation, popupAnimation: animation,
popupVisible: this.sVisible, popupVisible: this.sVisible,
afterPopupVisibleChange: this.afterVisibleChange, afterPopupVisibleChange: this.afterVisibleChange,
getPopupContainer: getPopupContainer, getPopupContainer,
}, },
on: { on: {
popupVisibleChange: this.onVisibleChange, popupVisibleChange: this.onVisibleChange,

View File

@ -96,7 +96,7 @@ function createBaseForm(option = {}, mixins = []) {
? {} ? {}
: { : {
$props: { $props: {
handler: function(nextProps) { handler(nextProps) {
if (mapPropsToFields) { if (mapPropsToFields) {
this.fieldsStore.updateFields(mapPropsToFields(nextProps)); this.fieldsStore.updateFields(mapPropsToFields(nextProps));
} }

View File

@ -3,7 +3,6 @@ import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import { initDefaultProps, hasProp, getOptionProps, getListeners } 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 KeyCode from '../../_util/KeyCode'; import KeyCode from '../../_util/KeyCode';
import InputHandler from './InputHandler'; import InputHandler from './InputHandler';

View File

@ -65,7 +65,7 @@ const Menu = {
} }
this.__emit('select', { this.__emit('select', {
...selectInfo, ...selectInfo,
selectedKeys: selectedKeys, selectedKeys,
}); });
} }
}, },
@ -128,7 +128,7 @@ const Menu = {
} }
this.__emit('deselect', { this.__emit('deselect', {
...selectInfo, ...selectInfo,
selectedKeys: selectedKeys, selectedKeys,
}); });
} }
}, },

View File

@ -10,7 +10,6 @@ import { getComponentFromProp, filterEmpty, getListeners } from '../_util/props-
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';
import { MenuItem } from './MenuItem';
let guid = 0; let guid = 0;

View File

@ -38,7 +38,7 @@ export default {
goInputText: value, goInputText: value,
}); });
}, },
handleBlur() { handleBlur(e) {
const { goButton, quickGo, rootPrefixCls } = this.$props; const { goButton, quickGo, rootPrefixCls } = this.$props;
if (goButton) { if (goButton) {
return; return;

View File

@ -181,7 +181,7 @@ const Select = {
__propsSymbol__() { __propsSymbol__() {
Object.assign(this.$data, this.getDerivedStateFromProps(getOptionProps(this), this.$data)); Object.assign(this.$data, this.getDerivedStateFromProps(getOptionProps(this), this.$data));
}, },
'$data._inputValue': function(val) { '$data._inputValue'(val) {
this.$data._mirrorInputValue = val; this.$data._mirrorInputValue = val;
}, },
}, },
@ -417,7 +417,7 @@ const Select = {
// Aviod trigger form submit when select item // Aviod trigger form submit when select item
// https://github.com/ant-design/ant-design/issues/10861 // https://github.com/ant-design/ant-design/issues/10861
// https://github.com/ant-design/ant-design/issues/14544 // https://github.com/ant-design/ant-design/issues/14544
if (isRealOpen || !props.combobox) { if (isRealOpen || !combobox) {
event.preventDefault(); event.preventDefault();
} }
// Hard close popup to avoid lock of non option in combobox mode // Hard close popup to avoid lock of non option in combobox mode
@ -1149,7 +1149,7 @@ const Select = {
}, },
renderFilterOptions() { renderFilterOptions() {
const { _inputValue: inputValue } = this.$data; const { _inputValue: inputValue } = this.$data;
const { children, tags, filterOption, notFoundContent } = this.$props; const { children, tags, notFoundContent } = this.$props;
const menuItems = []; const menuItems = [];
const childrenKeys = []; const childrenKeys = [];
let empty = false; let empty = false;
@ -1545,7 +1545,7 @@ const Select = {
return null; return null;
}, },
selectionRefClick(e) { selectionRefClick() {
//e.stopPropagation(); //e.stopPropagation();
if (!this.disabled) { if (!this.disabled) {
const input = this.getInputDOMNode(); const input = this.getInputDOMNode();

View File

@ -39,8 +39,8 @@ export const PrevArrow = {
}, },
}; };
const customProps = { const customProps = {
currentSlide: currentSlide, currentSlide,
slideCount: slideCount, slideCount,
}; };
let prevArrow; let prevArrow;
@ -110,8 +110,8 @@ export const NextArrow = {
}, },
}; };
const customProps = { const customProps = {
currentSlide: currentSlide, currentSlide,
slideCount: slideCount, slideCount,
}; };
let nextArrow; let nextArrow;

View File

@ -29,10 +29,10 @@ export default {
dotsClass, dotsClass,
} = props; } = props;
const dotCount = getDotCount({ const dotCount = getDotCount({
slideCount: slideCount, slideCount,
slidesToScroll: slidesToScroll, slidesToScroll,
slidesToShow: slidesToShow, slidesToShow,
infinite: infinite, infinite,
}); });
// Apply join & split to Array to pre-fill it for IE8 // Apply join & split to Array to pre-fill it for IE8
@ -55,8 +55,8 @@ export default {
const dotOptions = { const dotOptions = {
message: 'dots', message: 'dots',
index: i, index: i,
slidesToScroll: slidesToScroll, slidesToScroll,
currentSlide: currentSlide, currentSlide,
}; };
function onClick(e) { function onClick(e) {
// In Autoplay the focus stays on clicked button even after transition // In Autoplay the focus stays on clicked button even after transition

View File

@ -161,7 +161,7 @@ export default {
}; };
this.setState({ this.setState({
slideWidth: slideWidth + '%', slideWidth: slideWidth + '%',
trackStyle: trackStyle, trackStyle,
}); });
}, },
checkImagesLoad() { checkImagesLoad() {

View File

@ -73,7 +73,7 @@ export default {
// when not using server side rendering // when not using server side rendering
canUseDOM() && canUseDOM() &&
this.media(bQuery, () => { this.media(bQuery, () => {
this.setState({ breakpoint: breakpoint }); this.setState({ breakpoint });
}); });
}); });

View File

@ -88,7 +88,7 @@ const renderSlides = function(spec, children, createElement) {
let child; let child;
const childOnClickOptions = { const childOnClickOptions = {
message: 'children', message: 'children',
index: index, index,
slidesToScroll: spec.slidesToScroll, slidesToScroll: spec.slidesToScroll,
currentSlide: spec.currentSlide, currentSlide: spec.currentSlide,
}; };

View File

@ -185,7 +185,7 @@ const Range = {
const value = trimAlignValue({ const value = trimAlignValue({
value: mutatedValue, value: mutatedValue,
handle: sHandle, handle: sHandle,
bounds: bounds, bounds,
props: this.$props, props: this.$props,
}); });
if (value === oldValue) return; if (value === oldValue) return;

View File

@ -110,7 +110,7 @@ const BaseTable = {
record, record,
index: i, index: i,
prefixCls: rowPrefixCls, prefixCls: rowPrefixCls,
childrenColumnName: childrenColumnName, childrenColumnName,
columns: leafColumns, columns: leafColumns,
rowKey: key, rowKey: key,
ancestorKeys, ancestorKeys,

View File

@ -72,7 +72,7 @@ export default {
class={cls} class={cls}
key={key} key={key}
style={style} style={style}
{...{ directives: directives }} {...{ directives }}
> >
{tab} {tab}
</div> </div>

View File

@ -57,7 +57,7 @@ export default {
}, },
}, },
render() { render() {
const { activeKey, tabBarPosition, animated, animatedWithMargin, classes } = this; const { activeKey, tabBarPosition, animated, animatedWithMargin, direction, classes } = this;
let style = {}; let style = {};
if (animated && this.$slots.default) { if (animated && this.$slots.default) {
const activeIndex = getActiveIndex(this.$slots.default, activeKey); const activeIndex = getActiveIndex(this.$slots.default, activeKey);

View File

@ -1,8 +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 moment from 'moment'; import moment from 'moment';
import { getComponentFromProp } from '../_util/props-util';
import { isIE, isIE9 } from '../_util/env';
const Header = { const Header = {
mixins: [BaseMixin], mixins: [BaseMixin],

View File

@ -129,7 +129,6 @@ const Panel = {
addon, addon,
disabledSeconds, disabledSeconds,
hideDisabledOptions, hideDisabledOptions,
allowEmpty,
showHour, showHour,
showMinute, showMinute,
showSecond, showSecond,
@ -146,7 +145,7 @@ const Panel = {
currentSelectPanel, currentSelectPanel,
} = this; } = this;
const clearIcon = getComponentFromProp(this, 'clearIcon'); const clearIcon = getComponentFromProp(this, 'clearIcon');
const { esc = noop, clear = noop, keydown = noop } = getListeners(this); const { esc = 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

@ -5,11 +5,6 @@ import raf from 'raf';
function noop() {} function noop() {}
const scrollTo = (element, to, duration) => { const scrollTo = (element, to, duration) => {
const requestAnimationFrame =
window.requestAnimationFrame ||
function requestAnimationFrameTimeout() {
return setTimeout(arguments[0], 10);
};
// jump to target if duration zero // jump to target if duration zero
if (duration <= 0) { if (duration <= 0) {
raf(() => { raf(() => {

View File

@ -192,7 +192,6 @@ export default {
disabledSeconds, disabledSeconds,
hideDisabledOptions, hideDisabledOptions,
inputReadOnly, inputReadOnly,
allowEmpty,
showHour, showHour,
showMinute, showMinute,
showSecond, showSecond,

View File

@ -73,7 +73,7 @@ export default {
const triggerProps = { const triggerProps = {
props: { props: {
popupClassName: overlayClassName, popupClassName: overlayClassName,
prefixCls: prefixCls, prefixCls,
action: trigger, action: trigger,
builtinPlacements: placements, builtinPlacements: placements,
popupPlacement: placement, popupPlacement: placement,
@ -84,9 +84,9 @@ export default {
popupAnimation: animation, popupAnimation: animation,
defaultPopupVisible: defaultVisible, defaultPopupVisible: defaultVisible,
destroyPopupOnHide: destroyTooltipOnHide, destroyPopupOnHide: destroyTooltipOnHide,
mouseLeaveDelay: mouseLeaveDelay, mouseLeaveDelay,
popupStyle: overlayStyle, popupStyle: overlayStyle,
mouseEnterDelay: mouseEnterDelay, mouseEnterDelay,
...extraProps, ...extraProps,
}, },
on: { on: {

View File

@ -255,12 +255,12 @@ const BasePopup = {
selectable: !treeCheckable, selectable: !treeCheckable,
checkable: treeCheckable, checkable: treeCheckable,
checkStrictly: treeCheckStrictly, checkStrictly: treeCheckStrictly,
multiple: multiple, multiple,
loadData: loadData, loadData,
loadedKeys: loadedKeys, loadedKeys,
expandedKeys: expandedKeyList, expandedKeys: expandedKeyList,
filterTreeNode: this.filterTreeNode, filterTreeNode: this.filterTreeNode,
switcherIcon: switcherIcon, switcherIcon,
...treeProps, ...treeProps,
__propsSymbol__: Symbol(), __propsSymbol__: Symbol(),
children: $treeNodes, children: $treeNodes,

View File

@ -219,12 +219,12 @@ const Select = {
this.setState(state); this.setState(state);
this.needSyncKeys = {}; this.needSyncKeys = {};
}, },
'$data._valueList': function() { '$data._valueList'() {
this.$nextTick(() => { this.$nextTick(() => {
this.forcePopupAlign(); this.forcePopupAlign();
}); });
}, },
'$data._open': function() { '$data._open'() {
this.$nextTick(() => { this.$nextTick(() => {
const { prefixCls } = this.$props; const { prefixCls } = this.$props;
const { _selectorValueList: selectorValueList, _valueEntities: valueEntities } = this.$data; const { _selectorValueList: selectorValueList, _valueEntities: valueEntities } = this.$data;

View File

@ -350,7 +350,7 @@ function processProps(props) {
props: omit(props, ['on', 'key', 'class', 'className', 'style']), props: omit(props, ['on', 'key', 'class', 'className', 'style']),
on, on,
class: cls || props.className, class: cls || props.className,
style: style, style,
key, key,
}; };
// Warning user not to use deprecated label prop. // Warning user not to use deprecated label prop.

View File

@ -4,7 +4,6 @@ import { getNodeChildren, mapChildren, warnOnlyTreeNode } from './util';
import { initDefaultProps, filterEmpty, getComponentFromProp } from '../../_util/props-util'; import { initDefaultProps, filterEmpty, getComponentFromProp } from '../../_util/props-util';
import BaseMixin from '../../_util/BaseMixin'; import BaseMixin from '../../_util/BaseMixin';
import getTransitionProps from '../../_util/getTransitionProps'; import getTransitionProps from '../../_util/getTransitionProps';
import { cloneElement } from '../../_util/vnode';
function noop() {} function noop() {}
const ICON_OPEN = 'open'; const ICON_OPEN = 'open';

View File

@ -112,7 +112,7 @@ export default {
this.prevPopupVisible = val; this.prevPopupVisible = val;
} }
}, },
sPopupVisible(val) { sPopupVisible() {
this.$nextTick(() => { this.$nextTick(() => {
this.renderComponent(null, () => { this.renderComponent(null, () => {
this.afterPopupVisibleChange(this.sPopupVisible); this.afterPopupVisibleChange(this.sPopupVisible);