From 76d8491b6679a9d90ff1eaea2b8a0cc31a79d648 Mon Sep 17 00:00:00 2001 From: wangxueliang Date: Tue, 28 May 2019 11:37:38 +0800 Subject: [PATCH] style: fix code format --- components/anchor/Anchor.jsx | 10 +- components/auto-complete/index.jsx | 9 +- components/avatar/__tests__/Avatar.test.js | 6 +- components/badge/ScrollNumber.jsx | 4 +- components/button/button.jsx | 4 +- components/calendar/Header.jsx | 2 +- components/calendar/index.jsx | 7 +- components/carousel/index.jsx | 1 - components/cascader/index.jsx | 7 +- components/collapse/Collapse.jsx | 21 ++- components/config-provider/index.jsx | 8 +- components/config-provider/renderEmpty.jsx | 3 +- components/date-picker/RangePicker.jsx | 10 +- components/date-picker/WeekPicker.jsx | 12 +- components/date-picker/createPicker.js | 8 +- components/date-picker/index.js | 2 +- components/date-picker/wrapPicker.js | 6 +- components/drawer/index.jsx | 12 +- components/dropdown/dropdown-button.jsx | 8 +- components/empty/index.jsx | 9 +- components/form/FormItem.jsx | 2 +- components/icon/index.js | 14 +- components/input/Input.jsx | 2 +- components/input/Password.js | 11 +- components/input/Search.jsx | 11 +- components/layout/Sider.jsx | 18 ++- components/list/Item.jsx | 3 +- components/list/index.jsx | 9 +- components/modal/index.js | 8 +- components/popconfirm/index.jsx | 4 +- components/progress/progress.jsx | 16 +-- components/progress/utils.js | 2 +- components/radio/RadioButton.jsx | 13 +- components/rate/index.jsx | 1 - components/select/index.jsx | 7 +- components/select/style/index.less | 2 +- components/spin/Spin.jsx | 10 +- components/statistic/Statistic.jsx | 7 +- .../__tests__/__snapshots__/demo.test.js.snap | 70 ++++++---- components/style/themes/default.less | 6 +- components/switch/index.jsx | 4 +- components/table/Table.jsx | 29 ++-- components/table/filterDropdown.jsx | 4 +- .../time-picker/__tests__/index.test.js | 13 +- components/time-picker/index.jsx | 7 +- components/transfer/index.jsx | 7 +- components/transfer/list.jsx | 5 +- components/tree-select/index.jsx | 129 +++++++++--------- components/tree/Tree.jsx | 12 +- components/upload/Upload.jsx | 10 +- components/vc-calendar/src/date/DateInput.jsx | 2 +- components/vc-dropdown/assets/index.less | 19 ++- components/vc-dropdown/demo/simple.jsx | 8 +- components/vc-dropdown/src/Dropdown.jsx | 9 +- components/vc-notification/demo/simple.jsx | 42 +++--- components/vc-rate/src/Star.jsx | 12 +- components/vc-select/Select.jsx | 6 +- components/vc-select/assets/index.less | 2 +- components/vc-slider/demo/slider.jsx | 1 - components/vc-slider/src/Range.jsx | 4 +- components/vc-slider/src/Slider.jsx | 2 +- .../vc-tabs/src/ScrollableInkTabBar.jsx | 5 +- components/vc-time-picker/Header.jsx | 6 +- components/vc-time-picker/Select.jsx | 8 +- components/vc-time-picker/TimePicker.jsx | 8 +- components/vc-time-picker/assets/index.less | 2 +- components/vc-tree-select/src/util.js | 4 +- types/statistic.ts | 3 +- 68 files changed, 394 insertions(+), 334 deletions(-) diff --git a/components/anchor/Anchor.jsx b/components/anchor/Anchor.jsx index 0c98648de..591825b5f 100644 --- a/components/anchor/Anchor.jsx +++ b/components/anchor/Anchor.jsx @@ -212,7 +212,15 @@ export default { }, render() { - const { prefixCls: customizePrefixCls, offsetTop, affix, showInkInFixed, activeLink, $slots, getContainer } = this; + const { + prefixCls: customizePrefixCls, + offsetTop, + affix, + showInkInFixed, + activeLink, + $slots, + getContainer, + } = this; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('anchor', customizePrefixCls); diff --git a/components/auto-complete/index.jsx b/components/auto-complete/index.jsx index 30d51f8e1..e2d68f588 100644 --- a/components/auto-complete/index.jsx +++ b/components/auto-complete/index.jsx @@ -81,7 +81,14 @@ const AutoComplete = { }, render() { - const { size, prefixCls: customizePrefixCls, optionLabelProp, dataSource, $slots, $listeners } = this; + const { + size, + prefixCls: customizePrefixCls, + optionLabelProp, + dataSource, + $slots, + $listeners, + } = this; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('select', customizePrefixCls); diff --git a/components/avatar/__tests__/Avatar.test.js b/components/avatar/__tests__/Avatar.test.js index 2990367a8..c8991327f 100644 --- a/components/avatar/__tests__/Avatar.test.js +++ b/components/avatar/__tests__/Avatar.test.js @@ -44,7 +44,7 @@ describe('Avatar Render', () => { global.document.body.innerHTML = ''; }, 0); }); - it('should handle onError correctly', async() => { + it('should handle onError correctly', async () => { global.document.body.innerHTML = ''; const LOAD_FAILURE_SRC = 'http://error.url'; const LOAD_SUCCESS_SRC = 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png'; @@ -68,7 +68,7 @@ describe('Avatar Render', () => { }, }; - const wrapper = mount(Foo, { sync: false, attachToDocument: true },); + const wrapper = mount(Foo, { sync: false, attachToDocument: true }); await asyncExpect(() => { // mock img load Error, since jsdom do not load resource by default // https://github.com/jsdom/jsdom/issues/1816 @@ -82,7 +82,7 @@ describe('Avatar Render', () => { }, 0); }); - it('should show image on success after a failure state', async() => { + it('should show image on success after a failure state', async () => { global.document.body.innerHTML = ''; const LOAD_FAILURE_SRC = 'http://error.url'; const LOAD_SUCCESS_SRC = 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png'; diff --git a/components/badge/ScrollNumber.jsx b/components/badge/ScrollNumber.jsx index 4bab678e8..3abcec126 100644 --- a/components/badge/ScrollNumber.jsx +++ b/components/badge/ScrollNumber.jsx @@ -118,8 +118,8 @@ export default { const { sCount } = this; if (sCount && Number(sCount) % 1 === 0) { return getNumberArray(sCount) - .map((num, i) => this.renderCurrentNumber(prefixCls, num, i)) - .reverse(); + .map((num, i) => this.renderCurrentNumber(prefixCls, num, i)) + .reverse(); } return sCount; }, diff --git a/components/button/button.jsx b/components/button/button.jsx index 697c6a09e..f987e44d3 100644 --- a/components/button/button.jsx +++ b/components/button/button.jsx @@ -151,7 +151,9 @@ export default { const iconNode = iconType ? : null; const children = filterEmpty($slots.default); const autoInsertSpace = this.configProvider.autoInsertSpaceInButton !== false; - const kids = children.map(child => this.insertSpace(child, this.isNeedInserted() && autoInsertSpace)); + const kids = children.map(child => + this.insertSpace(child, this.isNeedInserted() && autoInsertSpace), + ); if ($attrs.href !== undefined) { return ( diff --git a/components/calendar/Header.jsx b/components/calendar/Header.jsx index 8788435a2..b30ef45f3 100644 --- a/components/calendar/Header.jsx +++ b/components/calendar/Header.jsx @@ -135,7 +135,7 @@ export default { }, render() { - const { prefixCls: customizePrefixCls,type, value, locale, fullscreen } = this; + const { prefixCls: customizePrefixCls, type, value, locale, fullscreen } = this; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('fullcalendar', customizePrefixCls); diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx index 1a03ee47f..35fb82568 100644 --- a/components/calendar/index.jsx +++ b/components/calendar/index.jsx @@ -167,7 +167,12 @@ const Calendar = { if (value && localeCode) { value.locale(localeCode); } - const { prefixCls: customizePrefixCls, fullscreen, dateFullCellRender, monthFullCellRender } = props; + const { + prefixCls: customizePrefixCls, + fullscreen, + dateFullCellRender, + monthFullCellRender, + } = props; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('fullcalendar', customizePrefixCls); const type = mode === 'year' ? 'month' : 'date'; diff --git a/components/carousel/index.jsx b/components/carousel/index.jsx index f25b7683b..c1a62900c 100644 --- a/components/carousel/index.jsx +++ b/components/carousel/index.jsx @@ -136,7 +136,6 @@ const Carousel = { props.fade = true; } - const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; let className = getPrefixCls('carousel', props.prefixCls); diff --git a/components/cascader/index.jsx b/components/cascader/index.jsx index 6cc45ed2d..2675a52e1 100644 --- a/components/cascader/index.jsx +++ b/components/cascader/index.jsx @@ -380,10 +380,9 @@ const Cascader = { ...otherProps } = props; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; - const renderEmpty = ( - this.configProvider.renderEmpty && - this.configProvider.renderEmpty() - ) || ConfigConsumerProps.renderEmpty; + const renderEmpty = + (this.configProvider.renderEmpty && this.configProvider.renderEmpty()) || + ConfigConsumerProps.renderEmpty; const prefixCls = getPrefixCls('cascader', customizePrefixCls); const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls); diff --git a/components/collapse/Collapse.jsx b/components/collapse/Collapse.jsx index 2bf16ae1e..b47579413 100644 --- a/components/collapse/Collapse.jsx +++ b/components/collapse/Collapse.jsx @@ -1,5 +1,10 @@ import animation from '../_util/openAnimation'; -import { getOptionProps, initDefaultProps, getComponentFromProp, isValidElement } from '../_util/props-util'; +import { + getOptionProps, + initDefaultProps, + getComponentFromProp, + isValidElement, +} from '../_util/props-util'; import { cloneElement } from '../_util/vnode'; import VcCollapse, { collapseProps } from '../vc-collapse'; import Icon from '../icon'; @@ -22,12 +27,14 @@ export default { methods: { renderExpandIcon(panelProps, prefixCls) { const expandIcon = getComponentFromProp(this, 'expandIcon', panelProps); - const icon = expandIcon || ; + const icon = expandIcon || ( + + ); return isValidElement(expandIcon ? icon[0] : icon) - ? cloneElement(icon, { - class: `${prefixCls}-arrow`, - }) - : icon; + ? cloneElement(icon, { + class: `${prefixCls}-arrow`, + }) + : icon; }, }, render() { @@ -42,7 +49,7 @@ export default { props: { ...getOptionProps(this), prefixCls, - expandIcon: (panelProps) => this.renderExpandIcon(panelProps, prefixCls), + expandIcon: panelProps => this.renderExpandIcon(panelProps, prefixCls), }, class: collapseClassName, on: $listeners, diff --git a/components/config-provider/index.jsx b/components/config-provider/index.jsx index a30c34ca9..cb83b4277 100644 --- a/components/config-provider/index.jsx +++ b/components/config-provider/index.jsx @@ -38,15 +38,11 @@ const ConfigProvider = { }; }, watch: { - ...getWatch([ - 'prefixCls', - 'csp', - 'autoInsertSpaceInButton', - ]), + ...getWatch(['prefixCls', 'csp', 'autoInsertSpaceInButton']), }, methods: { renderEmptyComponent() { - const customRender = getComponentFromProp(this,'renderEmpty', {}, false); + const customRender = getComponentFromProp(this, 'renderEmpty', {}, false); return this.$props.renderEmpty || customRender || defaultRenderEmpty; }, getPrefixCls(suffixCls, customizePrefixCls) { diff --git a/components/config-provider/renderEmpty.jsx b/components/config-provider/renderEmpty.jsx index ca6f12e5c..61140ee9a 100644 --- a/components/config-provider/renderEmpty.jsx +++ b/components/config-provider/renderEmpty.jsx @@ -14,7 +14,8 @@ const RenderEmpty = { render(createElement, context) { const { props, injections } = context; function renderHtml(componentName) { - const getPrefixCls = injections.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; + const getPrefixCls = + injections.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefix = getPrefixCls('empty'); switch (componentName) { case 'Table': diff --git a/components/date-picker/RangePicker.jsx b/components/date-picker/RangePicker.jsx index 3af35c668..9cb6313be 100644 --- a/components/date-picker/RangePicker.jsx +++ b/components/date-picker/RangePicker.jsx @@ -111,20 +111,20 @@ export default { }; } this.setState(state); - this.prevState = {...this.$data, ...state}; + this.prevState = { ...this.$data, ...state }; }, open(val) { - const state = { sOpen: val}; + const state = { sOpen: val }; this.setState(state); - this.prevState = {...this.$data, ...state}; + this.prevState = { ...this.$data, ...state }; }, }, mounted() { - this.prevState = {...this.$data}; + this.prevState = { ...this.$data }; }, updated() { this.$nextTick(() => { - if(!hasProp(this, 'open') && this.prevState.sOpen && !this.sOpen) { + if (!hasProp(this, 'open') && this.prevState.sOpen && !this.sOpen) { this.focus(); } }); diff --git a/components/date-picker/WeekPicker.jsx b/components/date-picker/WeekPicker.jsx index 72180b550..280c79db3 100644 --- a/components/date-picker/WeekPicker.jsx +++ b/components/date-picker/WeekPicker.jsx @@ -56,20 +56,20 @@ export default { value(val) { const state = { _value: val }; this.setState(state); - this.prevState = {...this.$data, ...state}; + this.prevState = { ...this.$data, ...state }; }, open(val) { const state = { _open: val }; this.setState(state); - this.prevState = {...this.$data, ...state}; + this.prevState = { ...this.$data, ...state }; }, }, mounted() { - this.prevState = {...this.$data}; + this.prevState = { ...this.$data }; }, updated() { this.$nextTick(() => { - if(!hasProp(this, 'open') && this.prevState._open && !this._open) { + if (!hasProp(this, 'open') && this.prevState._open && !this._open) { this.focus(); } }); @@ -77,7 +77,7 @@ export default { methods: { weekDateRender(current) { const selectedValue = this.$data._value; - const { _prefixCls: prefixCls, $scopedSlots } = this; + const { _prefixCls: prefixCls, $scopedSlots } = this; const dateRender = this.dateRender || $scopedSlots.dateRender; const dateNode = dateRender ? dateRender(current) : current.date(); if ( @@ -111,7 +111,7 @@ export default { this.handleChange(null); }, renderFooter(...args) { - const {_prefixCls: prefixCls, $scopedSlots} = this; + const { _prefixCls: prefixCls, $scopedSlots } = this; const renderExtraFooter = this.renderExtraFooter || $scopedSlots.renderExtraFooter; return renderExtraFooter ? ( diff --git a/components/date-picker/createPicker.js b/components/date-picker/createPicker.js index 4338524da..adf594641 100644 --- a/components/date-picker/createPicker.js +++ b/components/date-picker/createPicker.js @@ -58,7 +58,7 @@ export default function createPicker(TheCalendar, props) { state.showDate = props.value; } this.setState(state); - this.prevState = {...this.$data, ...state}; + this.prevState = { ...this.$data, ...state }; }, value(val) { const state = {}; @@ -67,15 +67,15 @@ export default function createPicker(TheCalendar, props) { state.showDate = val; } this.setState(state); - this.prevState = {...this.$data, ...state}; + this.prevState = { ...this.$data, ...state }; }, }, mounted() { - this.prevState = {...this.$data}; + this.prevState = { ...this.$data }; }, updated() { this.$nextTick(() => { - if(!hasProp(this, 'open') && this.prevState._open && !this._open) { + if (!hasProp(this, 'open') && this.prevState._open && !this._open) { this.focus(); } }); diff --git a/components/date-picker/index.js b/components/date-picker/index.js index 3e4b1de59..b65c1430f 100755 --- a/components/date-picker/index.js +++ b/components/date-picker/index.js @@ -9,7 +9,7 @@ import { DatePickerProps, MonthPickerProps, WeekPickerProps, RangePickerProps } const DatePicker = wrapPicker( { ...createPicker(VcCalendar, DatePickerProps()), name: 'ADatePicker' }, DatePickerProps(), - 'date' + 'date', ); const MonthPicker = wrapPicker( diff --git a/components/date-picker/wrapPicker.js b/components/date-picker/wrapPicker.js index c1d2d3bc4..26f578cf1 100644 --- a/components/date-picker/wrapPicker.js +++ b/components/date-picker/wrapPicker.js @@ -113,9 +113,9 @@ export default function wrapPicker(Picker, props, pickerType) { } = props; const mergedPickerType = showTime ? `${pickerType}Time` : pickerType; const mergedFormat = - format || - locale[LOCALE_FORMAT_MAPPING[mergedPickerType]] || - DEFAULT_FORMAT[mergedPickerType]; + format || + locale[LOCALE_FORMAT_MAPPING[mergedPickerType]] || + DEFAULT_FORMAT[mergedPickerType]; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('calendar', customizePrefixCls); diff --git a/components/drawer/index.jsx b/components/drawer/index.jsx index 8425cbdad..9c909f0e4 100644 --- a/components/drawer/index.jsx +++ b/components/drawer/index.jsx @@ -142,9 +142,7 @@ const Drawer = { return null; } this.destroyClose = false; - const { - placement, - } = this.$props; + const { placement } = this.$props; const containerStyle = placement === 'left' || placement === 'right' @@ -179,8 +177,12 @@ const Drawer = { const props = getOptionProps(this); const { prefixCls: customizePrefixCls, - width, height, visible, - placement, wrapClassName, ...rest + width, + height, + visible, + placement, + wrapClassName, + ...rest } = props; const haveMask = rest.mask ? '' : 'no-mask'; const offsetStyle = {}; diff --git a/components/dropdown/dropdown-button.jsx b/components/dropdown/dropdown-button.jsx index 986ccad67..c82a0b116 100644 --- a/components/dropdown/dropdown-button.jsx +++ b/components/dropdown/dropdown-button.jsx @@ -73,7 +73,13 @@ export default { return ( - diff --git a/components/empty/index.jsx b/components/empty/index.jsx index aca4831db..efe63b777 100644 --- a/components/empty/index.jsx +++ b/components/empty/index.jsx @@ -25,10 +25,7 @@ const Empty = { }, methods: { renderEmpty(contentLocale) { - const { - prefixCls: customizePrefixCls, - ...restProps - } = this.$props; + const { prefixCls: customizePrefixCls, ...restProps } = this.$props; const prefixCls = ConfigConsumerProps.getPrefixCls('empty', customizePrefixCls); const image = getComponentFromProp(this, 'image'); const description = getComponentFromProp(this, 'description'); @@ -57,9 +54,7 @@ const Empty = { }, }, render() { - return ( - - ); + return ; }, }; diff --git a/components/form/FormItem.jsx b/components/form/FormItem.jsx index 736ae8366..c0824252e 100644 --- a/components/form/FormItem.jsx +++ b/components/form/FormItem.jsx @@ -407,7 +407,7 @@ export default { prefixCls, this.slotDefault, this.renderHelp(prefixCls), - this.renderExtra(prefixCls) + this.renderExtra(prefixCls), ), ), ]; diff --git a/components/icon/index.js b/components/icon/index.js index 8cde86400..a0923452c 100644 --- a/components/icon/index.js +++ b/components/icon/index.js @@ -54,11 +54,11 @@ function renderIcon(h, locale, context) { }); const svgStyle = rotate - ? { - msTransform: `rotate(${rotate}deg)`, - transform: `rotate(${rotate}deg)`, - } - : undefined; + ? { + msTransform: `rotate(${rotate}deg)`, + transform: `rotate(${rotate}deg)`, + } + : undefined; let innerNode; @@ -121,7 +121,7 @@ function renderIcon(h, locale, context) { ); } let iconTabIndex = tabIndex; - if (iconTabIndex === undefined && ('click' in listeners)) { + if (iconTabIndex === undefined && 'click' in listeners) { iconTabIndex = -1; } const { attrs, ...restDataProps } = data; @@ -158,7 +158,7 @@ const Icon = { return ( renderIcon(h, locale, context) }} + scopedSlots={{ default: locale => renderIcon(h, locale, context) }} /> ); }, diff --git a/components/input/Input.jsx b/components/input/Input.jsx index 87e5d7b36..7f7bc6e42 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -222,7 +222,7 @@ export default { if ($listeners['change.value']) { inputProps.directives = [{ name: 'ant-input' }]; } - return this.renderLabeledIcon(prefixCls,); + return this.renderLabeledIcon(prefixCls, ); }, }, render() { diff --git a/components/input/Password.js b/components/input/Password.js index 0f02af98a..1da00f1d3 100644 --- a/components/input/Password.js +++ b/components/input/Password.js @@ -47,7 +47,7 @@ export default { }, on: { [iconTrigger]: this.onChange, - onMouseDown: (e) => { + onMouseDown: e => { // Prevent focused state lost // https://github.com/ant-design/ant-design/issues/15173 e.preventDefault(); @@ -60,14 +60,7 @@ export default { }, }, render() { - const { - prefixCls, - inputPrefixCls, - size, - suffix, - visibilityToggle, - ...restProps - } = this.$props; + const { prefixCls, inputPrefixCls, size, suffix, visibilityToggle, ...restProps } = this.$props; const suffixIcon = visibilityToggle && this.getIcon(); const inputClassName = classNames(prefixCls, { [`${prefixCls}-${size}`]: !!size, diff --git a/components/input/Search.jsx b/components/input/Search.jsx index 3d370f81b..e7db19331 100644 --- a/components/input/Search.jsx +++ b/components/input/Search.jsx @@ -47,12 +47,7 @@ export default { if (enterButton) return suffix; const node = ( - + ); if (suffix) { @@ -71,7 +66,7 @@ export default { const { size, disabled } = this; const enterButton = getComponentFromProp(this, 'enterButton'); const addonAfter = getComponentFromProp(this, 'addonAfter'); - if(!enterButton) return addonAfter; + if (!enterButton) return addonAfter; const btnClassName = `${prefixCls}-button`; const enterButtonAsElement = Array.isArray(enterButton) ? enterButton[0] : enterButton; let button; @@ -122,7 +117,7 @@ export default { const enterButton = getComponentFromProp(this, 'enterButton'); const addonBefore = getComponentFromProp(this, 'addonBefore'); let inputClassName; - if(enterButton) { + if (enterButton) { inputClassName = classNames(prefixCls, { [`${prefixCls}-enter-button`]: !!enterButton, [`${prefixCls}-${size}`]: !!size, diff --git a/components/layout/Sider.jsx b/components/layout/Sider.jsx index 59b9f5c51..748620472 100644 --- a/components/layout/Sider.jsx +++ b/components/layout/Sider.jsx @@ -179,7 +179,14 @@ export default { }, render() { - const { prefixCls: customizePrefixCls, theme, collapsible, reverseArrow, width, collapsedWidth } = getOptionProps(this); + const { + prefixCls: customizePrefixCls, + theme, + collapsible, + reverseArrow, + width, + collapsedWidth, + } = getOptionProps(this); const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('layout-sider', customizePrefixCls); @@ -190,9 +197,12 @@ export default { // special trigger when collapsedWidth == 0 const zeroWidthTrigger = parseFloat(String(collapsedWidth || 0)) === 0 ? ( - + ) : null; diff --git a/components/list/Item.jsx b/components/list/Item.jsx index a828a3727..eefb5c40c 100644 --- a/components/list/Item.jsx +++ b/components/list/Item.jsx @@ -5,7 +5,6 @@ import { Col } from '../grid'; import { ConfigConsumerProps } from '../config-provider'; import { ListGridType } from './index'; - export const ListItemProps = { prefixCls: PropTypes.string, extra: PropTypes.any, @@ -62,7 +61,7 @@ export default { props: ListItemProps, inject: { listContext: { default: () => ({}) }, - configProvider: { default: () =>({}) }, + configProvider: { default: () => ({}) }, }, render() { const { grid } = this.listContext; diff --git a/components/list/index.jsx b/components/list/index.jsx index 4f1c926ad..fcbebace5 100644 --- a/components/list/index.jsx +++ b/components/list/index.jsx @@ -118,7 +118,7 @@ const List = { const locale = this; return (
- {(locale && locale.emptyText) || renderEmpty(h, 'List')} + {(locale && locale.emptyText) || renderEmpty(h, 'List')}
); }, @@ -222,10 +222,9 @@ const List = { childrenContent = grid ? {childrenList} : childrenList; } else if (!children.length && !isLoading) { - const renderEmpty = ( - this.configProvider.renderEmpty && - this.configProvider.renderEmpty() - ) || ConfigConsumerProps.renderEmpty; + const renderEmpty = + (this.configProvider.renderEmpty && this.configProvider.renderEmpty()) || + ConfigConsumerProps.renderEmpty; childrenContent = this.renderEmpty(prefixCls, renderEmpty); } const paginationPosition = paginationProps.position || 'bottom'; diff --git a/components/modal/index.js b/components/modal/index.js index 45ce47349..6b446f904 100644 --- a/components/modal/index.js +++ b/components/modal/index.js @@ -8,7 +8,7 @@ import Icon from '../icon'; const info = function(props) { const config = { type: 'info', - icon: (h) => { + icon: h => { return ; }, okCancel: false, @@ -20,7 +20,7 @@ const info = function(props) { const success = function(props) { const config = { type: 'success', - icon: (h) => { + icon: h => { return ; }, okCancel: false, @@ -32,7 +32,7 @@ const success = function(props) { const error = function(props) { const config = { type: 'error', - icon: (h) => { + icon: h => { return ; }, okCancel: false, @@ -44,7 +44,7 @@ const error = function(props) { const warning = function(props) { const config = { type: 'warning', - icon: (h) => { + icon: h => { return ; }, okCancel: false, diff --git a/components/popconfirm/index.jsx b/components/popconfirm/index.jsx index d11e026f7..28bb01271 100644 --- a/components/popconfirm/index.jsx +++ b/components/popconfirm/index.jsx @@ -144,7 +144,9 @@ const Popconfirm = { this.renderOverlay(prefixCls, popconfirmLocale) }} + scopedSlots={{ + default: popconfirmLocale => this.renderOverlay(prefixCls, popconfirmLocale), + }} /> ); return ( diff --git a/components/progress/progress.jsx b/components/progress/progress.jsx index a8531da17..057b8cc03 100644 --- a/components/progress/progress.jsx +++ b/components/progress/progress.jsx @@ -93,8 +93,8 @@ export default { const prefixCls = getPrefixCls('progress', customizePrefixCls); const progressStatus = - parseInt(successPercent !== undefined ? successPercent.toString() : percent.toString(), 10) >= 100 && - !('status' in props) + parseInt(successPercent !== undefined ? successPercent.toString() : percent.toString(), 10) >= + 100 && !('status' in props) ? 'success' : status || 'normal'; let progress; @@ -108,11 +108,7 @@ export default { prefixCls, }, }; - progress = ( - - {progressInfo} - - ); + progress = {progressInfo}; } else if (type === 'circle' || type === 'dashboard') { const circleProps = { props: { @@ -121,11 +117,7 @@ export default { progressStatus, }, }; - progress = ( - - {progressInfo} - - ); + progress = {progressInfo}; } const classString = classNames(prefixCls, { diff --git a/components/progress/utils.js b/components/progress/utils.js index aa5fa6ccb..3252d8eb7 100644 --- a/components/progress/utils.js +++ b/components/progress/utils.js @@ -5,4 +5,4 @@ export function validProgress(progress) { return 100; } return progress; -}; +} diff --git a/components/radio/RadioButton.jsx b/components/radio/RadioButton.jsx index ffa507bb3..5ec4990c1 100644 --- a/components/radio/RadioButton.jsx +++ b/components/radio/RadioButton.jsx @@ -15,14 +15,17 @@ export default { configProvider: { default: () => ({}) }, }, render() { - const {prefixCls: customizePrefixCls, ...otherProps} = getOptionProps(this); + const { prefixCls: customizePrefixCls, ...otherProps } = getOptionProps(this); const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('radio-button', customizePrefixCls); - const radioProps = { props: { - ...otherProps, - prefixCls, - }, on: { ...this.$listeners } }; + const radioProps = { + props: { + ...otherProps, + prefixCls, + }, + on: { ...this.$listeners }, + }; if (this.radioGroupContext) { radioProps.on.change = this.radioGroupContext.onRadioChange; radioProps.props.checked = this.$props.value === this.radioGroupContext.stateValue; diff --git a/components/rate/index.jsx b/components/rate/index.jsx index b31767cba..66cc2a510 100644 --- a/components/rate/index.jsx +++ b/components/rate/index.jsx @@ -1,4 +1,3 @@ - import omit from 'omit.js'; import PropTypes from '../_util/vue-types'; import { getOptionProps, getComponentFromProp } from '../_util/props-util'; diff --git a/components/select/index.jsx b/components/select/index.jsx index 501bcd11f..c8270f4d8 100644 --- a/components/select/index.jsx +++ b/components/select/index.jsx @@ -165,10 +165,9 @@ const Select = { } = getOptionProps(this); const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; - const renderEmpty = ( - this.configProvider.renderEmpty && - this.configProvider.renderEmpty() - ) || ConfigConsumerProps.renderEmpty; + const renderEmpty = + (this.configProvider.renderEmpty && this.configProvider.renderEmpty()) || + ConfigConsumerProps.renderEmpty; const prefixCls = getPrefixCls('select', customizePrefixCls); const { getPopupContainer: getContextPopupContainer } = this.configProvider; diff --git a/components/select/style/index.less b/components/select/style/index.less index 8b7ff1b37..8af34857f 100644 --- a/components/select/style/index.less +++ b/components/select/style/index.less @@ -556,7 +556,7 @@ font-size: 12px; text-shadow: 0 0.1px 0, 0.1px 0 0, 0 -0.1px 0, -0.1px 0; transform: translateY(-50%); - transition: all .2s; + transition: all 0.2s; } &:hover .@{select-prefix-cls}-selected-icon { diff --git a/components/spin/Spin.jsx b/components/spin/Spin.jsx index a9a19c37a..f6fec3ddf 100644 --- a/components/spin/Spin.jsx +++ b/components/spin/Spin.jsx @@ -74,7 +74,7 @@ export default { methods: { debouncifyUpdateSpinning(props) { const { delay } = props || this.$props; - if(delay) { + if (delay) { this.updateSpinning = debounce(this.originalUpdateSpinning, delay); } }, @@ -117,7 +117,13 @@ export default { }, }, render(h) { - const { size, prefixCls: customizePrefixCls, tip, wrapperClassName, ...restProps } = this.$props; + const { + size, + prefixCls: customizePrefixCls, + tip, + wrapperClassName, + ...restProps + } = this.$props; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('spin', customizePrefixCls); diff --git a/components/statistic/Statistic.jsx b/components/statistic/Statistic.jsx index 524373947..f4044c8b7 100644 --- a/components/statistic/Statistic.jsx +++ b/components/statistic/Statistic.jsx @@ -30,12 +30,7 @@ export default { }, render() { - const { - prefixCls: customizePrefixCls, - value = 0, - valueStyle, - valueRender, - } = this.$props; + const { prefixCls: customizePrefixCls, value = 0, valueStyle, valueRender } = this.$props; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('statistic', customizePrefixCls); diff --git a/components/statistic/__tests__/__snapshots__/demo.test.js.snap b/components/statistic/__tests__/__snapshots__/demo.test.js.snap index da2953495..d4bbb4ce7 100644 --- a/components/statistic/__tests__/__snapshots__/demo.test.js.snap +++ b/components/statistic/__tests__/__snapshots__/demo.test.js.snap @@ -14,16 +14,26 @@ exports[`renders ./components/statistic/demo/basic.md correctly 1`] = ` `; exports[`renders ./components/statistic/demo/card.md correctly 1`] = ` -
-
-
-
-
Feedback
-
1,128
+
+
+
+
+
+
+
Feedback
+
11.28%
+
+
-
-
Unmerged
-
1,234,567,890 / 100
+
+
+
+
+
+
Idle
+
9.30%
+
+
@@ -31,27 +41,41 @@ exports[`renders ./components/statistic/demo/card.md correctly 1`] = ` `; exports[`renders ./components/statistic/demo/countdown.md correctly 1`] = ` -
-
-
Countdown
-
48:00:30
+
+
+
+
Countdown
+
48:00:30
+
-
-
Million Seconds
-
48:00:30:000
+
+
+
Million Seconds
+
48:00:30:000
+
+
+
+
+
Day Level
+
2 天 0 时 0 分 30 秒
+
`; exports[`renders ./components/statistic/demo/unit.md correctly 1`] = ` -
-
-
Feedback
-
11.28%
+
+
+
+
Feedback
+
1,128
+
-
-
Unmerged
-
78 / 100
+
+
+
Unmerged
+
93 / 100
+
`; diff --git a/components/style/themes/default.less b/components/style/themes/default.less index d80425490..07d809d16 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -38,9 +38,9 @@ @body-background: #fff; // Base background color for most components @component-background: #fff; -@font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', - 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, - 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; +@font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', + 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', + 'Segoe UI Emoji', 'Segoe UI Symbol'; @code-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; @heading-color: fade(@black, 85%); @text-color: fade(@black, 65%); diff --git a/components/switch/index.jsx b/components/switch/index.jsx index 7e55ae7c4..30a6e32f5 100644 --- a/components/switch/index.jsx +++ b/components/switch/index.jsx @@ -37,7 +37,9 @@ const Switch = { }, render() { - const { prefixCls: customizePrefixCls, size, loading, disabled, ...restProps } = getOptionProps(this); + const { prefixCls: customizePrefixCls, size, loading, disabled, ...restProps } = getOptionProps( + this, + ); const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('switch', customizePrefixCls); diff --git a/components/table/Table.jsx b/components/table/Table.jsx index 0bc0b606f..fef139822 100755 --- a/components/table/Table.jsx +++ b/components/table/Table.jsx @@ -92,7 +92,7 @@ export default { selectedRowKeys: getRowSelection(this.$props).selectedRowKeys || [], selectionDirty: false, }); - this.prevRowSelection = this.rowSelection ? {...this.rowSelection} : this.rowSelection; + this.prevRowSelection = this.rowSelection ? { ...this.rowSelection } : this.rowSelection; return { ...this.getDefaultSortOrder(this.columns), // 减少状态 @@ -127,12 +127,12 @@ export default { if (rowSelection && val.getCheckboxProps !== rowSelection.getCheckboxProps) { this.CheckboxPropsCache = {}; } - } else if(val && !this.prevRowSelection) { + } else if (val && !this.prevRowSelection) { this.store.setState({ selectedRowKeys: [], }); } - this.prevRowSelection = val ? {...val} : val; + this.prevRowSelection = val ? { ...val } : val; }, deep: true, }, @@ -379,7 +379,7 @@ export default { // 按照sortDirections的内容依次切换排序状态 const methodIndex = sortDirections.indexOf(sortOrder) + 1; newSortOrder = - methodIndex === sortDirections.length ? undefined : sortDirections[methodIndex]; + methodIndex === sortDirections.length ? undefined : sortDirections[methodIndex]; } else { newSortOrder = sortDirections[0]; } @@ -869,10 +869,7 @@ export default { [`${prefixCls}-column-sort`]: isSortColumn && sortOrder, }), title: [ -
+
{this.renderColumnTitle(column.title)} {sortButton}
, @@ -1151,10 +1148,7 @@ export default { }, render() { - const { - prefixCls: customizePrefixCls, - dropdownPrefixCls: customizeDropdownPrefixCls, - } = this; + const { prefixCls: customizePrefixCls, dropdownPrefixCls: customizeDropdownPrefixCls } = this; const data = this.getCurrentPageData(); let loading = this.loading; @@ -1170,10 +1164,9 @@ export default { }; } const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; - const renderEmpty = ( - this.configProvider.renderEmpty && - this.configProvider.renderEmpty() - ) || ConfigConsumerProps.renderEmpty; + const renderEmpty = + (this.configProvider.renderEmpty && this.configProvider.renderEmpty()) || + ConfigConsumerProps.renderEmpty; const prefixCls = getPrefixCls('table', customizePrefixCls); const dropdownPrefixCls = getPrefixCls('dropdown', customizeDropdownPrefixCls); @@ -1182,7 +1175,9 @@ export default { this.renderTable(prefixCls, renderEmpty, dropdownPrefixCls, locale, loading)} + children={locale => + this.renderTable(prefixCls, renderEmpty, dropdownPrefixCls, locale, loading) + } /> ); diff --git a/components/table/filterDropdown.jsx b/components/table/filterDropdown.jsx index a5f25b13a..ea41aa926 100755 --- a/components/table/filterDropdown.jsx +++ b/components/table/filterDropdown.jsx @@ -261,7 +261,9 @@ export default { } const menus = filterDropdown ? ( - {filterDropdown} + + {filterDropdown} + ) : ( { ); }); it('not render clean icon when allowClear is false', () => { - const wrapper = mount( - { - render() { - return ; - }, - } - ); + const wrapper = mount({ + render() { + return ; + }, + }); expect(wrapper.html()).toMatchSnapshot(); }); - }); diff --git a/components/time-picker/index.jsx b/components/time-picker/index.jsx index 5f498152d..0f7f6cccd 100644 --- a/components/time-picker/index.jsx +++ b/components/time-picker/index.jsx @@ -175,12 +175,7 @@ const TimePicker = { let props = getOptionProps(this); props = omit(props, ['defaultValue', 'suffixIcon', 'allowEmpty', 'allowClear']); - const { - prefixCls: customizePrefixCls, - getPopupContainer, - placeholder, - size, - } = props; + const { prefixCls: customizePrefixCls, getPopupContainer, placeholder, size } = props; const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('time-picker', customizePrefixCls); diff --git a/components/transfer/index.jsx b/components/transfer/index.jsx index 404a0b764..5f301a0c6 100644 --- a/components/transfer/index.jsx +++ b/components/transfer/index.jsx @@ -348,10 +348,9 @@ const Transfer = { const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('transfer', customizePrefixCls); - const renderEmpty = ( - this.configProvider.renderEmpty && - this.configProvider.renderEmpty() - ) || ConfigConsumerProps.renderEmpty; + const renderEmpty = + (this.configProvider.renderEmpty && this.configProvider.renderEmpty()) || + ConfigConsumerProps.renderEmpty; const locale = this.getLocale(transferLocale, renderEmpty); const { leftFilter, diff --git a/components/transfer/list.jsx b/components/transfer/list.jsx index 0c4653e67..01e5072be 100644 --- a/components/transfer/list.jsx +++ b/components/transfer/list.jsx @@ -243,8 +243,7 @@ export default { )} > {search} - { - !searchNotFound && + {!searchNotFound && ( {showItems} - } + )} {searchNotFound}
); diff --git a/components/tree-select/index.jsx b/components/tree-select/index.jsx index 429e68347..6a088a06f 100644 --- a/components/tree-select/index.jsx +++ b/components/tree-select/index.jsx @@ -86,77 +86,74 @@ const TreeSelect = { render(h) { const props = getOptionProps(this); - const { - prefixCls: customizePrefixCls, - size, - dropdownStyle, - dropdownClassName, - getPopupContainer, - ...restProps - } = props; - const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; - const prefixCls = getPrefixCls('select', customizePrefixCls); + const { + prefixCls: customizePrefixCls, + size, + dropdownStyle, + dropdownClassName, + getPopupContainer, + ...restProps + } = props; + const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; + const prefixCls = getPrefixCls('select', customizePrefixCls); - const renderEmpty = ( - this.configProvider.renderEmpty && - this.configProvider.renderEmpty() - ) || ConfigConsumerProps.renderEmpty; - const notFoundContent = getComponentFromProp(this, 'notFoundContent'); - const { getPopupContainer: getContextPopupContainer } = this.configProvider; - const rest = omit(restProps, [ - 'inputIcon', - 'removeIcon', - 'clearIcon', - 'switcherIcon', - 'suffixIcon', - ]); - let suffixIcon = getComponentFromProp(this, 'suffixIcon'); - suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; - let treeData = props.treeData; - if (treeData) { - treeData = this.updateTreeData(treeData); - } - const cls = { - [`${prefixCls}-lg`]: size === 'large', - [`${prefixCls}-sm`]: size === 'small', - }; + const renderEmpty = + (this.configProvider.renderEmpty && this.configProvider.renderEmpty()) || + ConfigConsumerProps.renderEmpty; + const notFoundContent = getComponentFromProp(this, 'notFoundContent'); + const { getPopupContainer: getContextPopupContainer } = this.configProvider; + const rest = omit(restProps, [ + 'inputIcon', + 'removeIcon', + 'clearIcon', + 'switcherIcon', + 'suffixIcon', + ]); + let suffixIcon = getComponentFromProp(this, 'suffixIcon'); + suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon; + let treeData = props.treeData; + if (treeData) { + treeData = this.updateTreeData(treeData); + } + const cls = { + [`${prefixCls}-lg`]: size === 'large', + [`${prefixCls}-sm`]: size === 'small', + }; - let checkable = getComponentFromProp(this, 'treeCheckable'); - if (checkable) { - checkable = ; - } + let checkable = getComponentFromProp(this, 'treeCheckable'); + if (checkable) { + checkable = ; + } - const inputIcon = (suffixIcon && - (isValidElement(suffixIcon) ? cloneElement(suffixIcon) : suffixIcon)) || ( - - ); + const inputIcon = (suffixIcon && + (isValidElement(suffixIcon) ? cloneElement(suffixIcon) : suffixIcon)) || ( + + ); - const removeIcon = ; + const removeIcon = ; - const clearIcon = ( - - ); - const VcTreeSelectProps = { - props: { - switcherIcon: (nodeProps) => this.renderSwitcherIcon(prefixCls, nodeProps), - inputIcon, - removeIcon, - clearIcon, - ...rest, - getPopupContainer: getPopupContainer || getContextPopupContainer, - dropdownClassName: classNames(dropdownClassName, `${prefixCls}-tree-dropdown`), - prefixCls, - dropdownStyle: { maxHeight: '100vh', overflow: 'auto', ...dropdownStyle }, - treeCheckable: checkable, - notFoundContent: notFoundContent || renderEmpty(h, 'Select'), - __propsSymbol__: Symbol(), - }, - class: cls, - on: { ...this.$listeners, change: this.onChange }, - ref: 'vcTreeSelect', - scopedSlots: this.$scopedSlots, - }; - return {filterEmpty(this.$slots.default)}; + const clearIcon = ; + const VcTreeSelectProps = { + props: { + switcherIcon: nodeProps => this.renderSwitcherIcon(prefixCls, nodeProps), + inputIcon, + removeIcon, + clearIcon, + ...rest, + getPopupContainer: getPopupContainer || getContextPopupContainer, + dropdownClassName: classNames(dropdownClassName, `${prefixCls}-tree-dropdown`), + prefixCls, + dropdownStyle: { maxHeight: '100vh', overflow: 'auto', ...dropdownStyle }, + treeCheckable: checkable, + notFoundContent: notFoundContent || renderEmpty(h, 'Select'), + __propsSymbol__: Symbol(), + }, + class: cls, + on: { ...this.$listeners, change: this.onChange }, + ref: 'vcTreeSelect', + scopedSlots: this.$scopedSlots, + }; + return {filterEmpty(this.$slots.default)}; }, }; diff --git a/components/tree/Tree.jsx b/components/tree/Tree.jsx index fc70ae3e3..11af040ae 100644 --- a/components/tree/Tree.jsx +++ b/components/tree/Tree.jsx @@ -2,7 +2,13 @@ import warning from 'warning'; import { Tree as VcTree, TreeNode } from '../vc-tree'; import animation from '../_util/openAnimation'; import PropTypes from '../_util/vue-types'; -import { initDefaultProps, getOptionProps, filterEmpty, getComponentFromProp, getClass } from '../_util/props-util'; +import { + initDefaultProps, + getOptionProps, + filterEmpty, + getComponentFromProp, + getClass, +} from '../_util/props-util'; import { cloneElement } from '../_util/vnode'; import { ConfigConsumerProps } from '../config-provider'; import Icon from '../icon'; @@ -131,7 +137,7 @@ export default { const switcherCls = `${prefixCls}-switcher-icon`; if (isLeaf) { return null; - }else if (switcherIcon) { + } else if (switcherIcon) { const switcherOriginCls = getClass(switcherIcon[0]); return cloneElement(switcherIcon, { class: { @@ -198,7 +204,7 @@ export default { checkable: checkable ? : checkable, children: filterEmpty(this.$slots.default || []), __propsSymbol__: Symbol(), - switcherIcon: (nodeProps) => this.renderSwitcherIcon(prefixCls, switcherIcon, nodeProps), + switcherIcon: nodeProps => this.renderSwitcherIcon(prefixCls, switcherIcon, nodeProps), }, on: this.$listeners, ref: 'tree', diff --git a/components/upload/Upload.jsx b/components/upload/Upload.jsx index ce8df496d..50b8eb788 100644 --- a/components/upload/Upload.jsx +++ b/components/upload/Upload.jsx @@ -161,7 +161,7 @@ export default { }); }, handleManualRemove(file) { - if(this.$refs.uploadRef) { + if (this.$refs.uploadRef) { this.$refs.uploadRef.abort(file); } this.handleRemove(file); @@ -219,7 +219,13 @@ export default { }, }, render() { - const { prefixCls: customizePrefixCls, showUploadList, listType, type, disabled } = getOptionProps(this); + const { + prefixCls: customizePrefixCls, + showUploadList, + listType, + type, + disabled, + } = getOptionProps(this); const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls; const prefixCls = getPrefixCls('upload', customizePrefixCls); diff --git a/components/vc-calendar/src/date/DateInput.jsx b/components/vc-calendar/src/date/DateInput.jsx index 6cabb2c79..819517ed0 100644 --- a/components/vc-calendar/src/date/DateInput.jsx +++ b/components/vc-calendar/src/date/DateInput.jsx @@ -141,7 +141,7 @@ const DateInput = { const { value, disabledDate } = this.$props; if (keyCode === KeyCode.ENTER) { const validateDate = !disabledDate || !disabledDate(value); - if(validateDate) { + if (validateDate) { this.__emit('select', value.clone()); } } diff --git a/components/vc-dropdown/assets/index.less b/components/vc-dropdown/assets/index.less index 531cbda9c..14a8e3f39 100644 --- a/components/vc-dropdown/assets/index.less +++ b/components/vc-dropdown/assets/index.less @@ -4,7 +4,11 @@ font-family: 'anticon'; src: url('//at.alicdn.com/t/font_1434092639_4910953.eot'); /* IE9*/ - src: url('//at.alicdn.com/t/font_1434092639_4910953.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('//at.alicdn.com/t/font_1434092639_4910953.woff') format('woff'), /* chrome、firefox */ url('//at.alicdn.com/t/font_1434092639_4910953.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('//at.alicdn.com/t/font_1434092639_4910953.svg#iconfont') format('svg'); + src: url('//at.alicdn.com/t/font_1434092639_4910953.eot?#iefix') format('embedded-opentype'), + /* IE6-IE8 */ url('//at.alicdn.com/t/font_1434092639_4910953.woff') format('woff'), + /* chrome、firefox */ url('//at.alicdn.com/t/font_1434092639_4910953.ttf') format('truetype'), + /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ + url('//at.alicdn.com/t/font_1434092639_4910953.svg#iconfont') format('svg'); /* iOS 4.1- */ } @@ -14,7 +18,7 @@ top: -9999px; z-index: 1070; display: block; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; font-weight: normal; line-height: 1.5; @@ -42,7 +46,7 @@ } &:before { - content: ""; + content: ''; position: absolute; top: -4px; left: 0; @@ -62,7 +66,9 @@ color: #666666; white-space: nowrap; - &:hover, &-active, &-selected { + &:hover, + &-active, + &-selected { background-color: #ebfaff; } @@ -75,7 +81,7 @@ position: absolute; top: 6px; right: 16px; - color: #3CB8F0; + color: #3cb8f0; } } @@ -118,7 +124,8 @@ display: block !important; } - &-slide-up-enter,&-slide-up-appear { + &-slide-up-enter, + &-slide-up-appear { .effect(); opacity: 0; animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1); diff --git a/components/vc-dropdown/demo/simple.jsx b/components/vc-dropdown/demo/simple.jsx index 0e98e3a11..ccccb0121 100644 --- a/components/vc-dropdown/demo/simple.jsx +++ b/components/vc-dropdown/demo/simple.jsx @@ -17,13 +17,9 @@ export default { render() { return (
-
+
- + disabled one diff --git a/components/vc-dropdown/src/Dropdown.jsx b/components/vc-dropdown/src/Dropdown.jsx index 4365c622f..902d63e27 100644 --- a/components/vc-dropdown/src/Dropdown.jsx +++ b/components/vc-dropdown/src/Dropdown.jsx @@ -18,10 +18,7 @@ export default { align: PropTypes.object, overlayStyle: PropTypes.object.def({}), placement: PropTypes.string.def('bottomLeft'), - overlay: PropTypes.oneOfType([ - PropTypes.any, - PropTypes.func, - ]), + overlay: PropTypes.oneOfType([PropTypes.any, PropTypes.func]), trigger: PropTypes.array.def(['hover']), alignPoint: PropTypes.bool, showAction: PropTypes.array.def([]), @@ -153,7 +150,9 @@ export default { renderChildren() { const children = this.$slots.default && this.$slots.default[0]; const { sVisible } = this; - return (sVisible && children) ? cloneElement(children, { class: this.getOpenClassName() }) : children; + return sVisible && children + ? cloneElement(children, { class: this.getOpenClassName() }) + : children; }, }, diff --git a/components/vc-notification/demo/simple.jsx b/components/vc-notification/demo/simple.jsx index d2ac5fcc9..894aa3b98 100644 --- a/components/vc-notification/demo/simple.jsx +++ b/components/vc-notification/demo/simple.jsx @@ -93,30 +93,34 @@ function updatableFn() { } let notification2 = null; -const clearPath = 'M793 242H366v-74c0-6.7-7.7-10.4-12.9' + +const clearPath = + 'M793 242H366v-74c0-6.7-7.7-10.4-12.9' + '-6.3l-142 112c-4.1 3.2-4.1 9.4 0 12.6l142 112c' + '5.2 4.1 12.9 0.4 12.9-6.3v-74h415v470H175c-4.4' + ' 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-' + '28.7 64-64V306c0-35.3-28.7-64-64-64z'; -Notification.newInstance({ - closeIcon: h => { - return ( - - - - - - ); +Notification.newInstance( + { + closeIcon: h => { + return ( + + + + + + ); + }, }, -}, (n) => { - notification2 = n; -}); + n => { + notification2 = n; + }, +); function customCloseIconFn() { notification2.notice({ content: 'It is using custom close icon...', diff --git a/components/vc-rate/src/Star.jsx b/components/vc-rate/src/Star.jsx index 7a452ac47..84c46d805 100644 --- a/components/vc-rate/src/Star.jsx +++ b/components/vc-rate/src/Star.jsx @@ -53,7 +53,17 @@ export default { }, }, render() { - const { onHover, onClick, onKeyDown, disabled, prefixCls, characterRender, index, count, value } = this; + const { + onHover, + onClick, + onKeyDown, + disabled, + prefixCls, + characterRender, + index, + count, + value, + } = this; const character = getComponentFromProp(this, 'character'); let star = ( diff --git a/components/vc-select/Select.jsx b/components/vc-select/Select.jsx index 997d2b791..9ede7a67c 100644 --- a/components/vc-select/Select.jsx +++ b/components/vc-select/Select.jsx @@ -153,7 +153,7 @@ const Select = { this.$nextTick(() => { // when defaultOpen is true, we should auto focus search input // https://github.com/ant-design/ant-design/issues/14254 - if(this.autoFocus || this._open) { + if (this.autoFocus || this._open) { this.focus(); } }); @@ -1127,7 +1127,7 @@ const Select = { }; options = [{notFoundContent}]; } - return {empty, options}; + return { empty, options }; }, renderFilterOptionsFromChildren(children = [], childrenKeys, menuItems) { @@ -1401,7 +1401,7 @@ const Select = { // showArrow : Set to true if not multiple by default but keep set value. const { showArrow = !multiple, loading, prefixCls } = this.$props; const inputIcon = getComponentFromProp(this, 'inputIcon'); - if (!showArrow && !loading ) { + if (!showArrow && !loading) { return null; } // if loading have loading icon diff --git a/components/vc-select/assets/index.less b/components/vc-select/assets/index.less index 14254dc7c..6fbef9e9a 100644 --- a/components/vc-select/assets/index.less +++ b/components/vc-select/assets/index.less @@ -82,7 +82,7 @@ &-loading { .@{selectPrefixCls}-selection--multiple { .@{selectPrefixCls}-selection__clear { - right: 20px; + right: 20px; } } } diff --git a/components/vc-slider/demo/slider.jsx b/components/vc-slider/demo/slider.jsx index 95b8761ff..687e2542f 100644 --- a/components/vc-slider/demo/slider.jsx +++ b/components/vc-slider/demo/slider.jsx @@ -3,7 +3,6 @@ import Tooltip from '../../vc-tooltip'; import '../assets/index.less'; import '../../vc-tooltip/assets/bootstrap.less'; - const { createSliderWithTooltip } = Slider; function log(value) { diff --git a/components/vc-slider/src/Range.jsx b/components/vc-slider/src/Range.jsx index e44509756..551dad5ed 100644 --- a/components/vc-slider/src/Range.jsx +++ b/components/vc-slider/src/Range.jsx @@ -117,9 +117,9 @@ const Range = { this.onChange({ bounds: nextBounds }); }, onEnd(force) { - const {sHandle} = this; + const { sHandle } = this; this.removeDocumentEvents(); - if(sHandle || force) { + if (sHandle || force) { this.$emit('afterChange', this.bounds); } this.setState({ sHandle: null }); diff --git a/components/vc-slider/src/Slider.jsx b/components/vc-slider/src/Slider.jsx index 6fad0de0e..d582f6ab5 100644 --- a/components/vc-slider/src/Slider.jsx +++ b/components/vc-slider/src/Slider.jsx @@ -103,7 +103,7 @@ const Slider = { onEnd(force) { const { dragging } = this; this.removeDocumentEvents(); - if(dragging || force) { + if (dragging || force) { this.$emit('afterChange', this.sValue); } this.setState({ dragging: false }); diff --git a/components/vc-tabs/src/ScrollableInkTabBar.jsx b/components/vc-tabs/src/ScrollableInkTabBar.jsx index bbd42a023..3f404a828 100644 --- a/components/vc-tabs/src/ScrollableInkTabBar.jsx +++ b/components/vc-tabs/src/ScrollableInkTabBar.jsx @@ -28,7 +28,10 @@ export default { children={(saveRef, getRef) => ( - + diff --git a/components/vc-time-picker/Header.jsx b/components/vc-time-picker/Header.jsx index 4eda403ba..64be26395 100644 --- a/components/vc-time-picker/Header.jsx +++ b/components/vc-time-picker/Header.jsx @@ -181,11 +181,7 @@ const Header = { render() { const { prefixCls } = this; - return ( -
- {this.getInput()} -
- ); + return
{this.getInput()}
; }, }; diff --git a/components/vc-time-picker/Select.jsx b/components/vc-time-picker/Select.jsx index 1180fb25c..5daff2dbb 100644 --- a/components/vc-time-picker/Select.jsx +++ b/components/vc-time-picker/Select.jsx @@ -67,10 +67,10 @@ const Select = { [`${prefixCls}-select-option-disabled`]: item.disabled, }); const onClick = item.disabled - ? undefined - : () => { - this.onSelect(item.value); - }; + ? undefined + : () => { + this.onSelect(item.value); + }; return (
  • {item.value} diff --git a/components/vc-time-picker/TimePicker.jsx b/components/vc-time-picker/TimePicker.jsx index 14cc9734a..4905b0a60 100644 --- a/components/vc-time-picker/TimePicker.jsx +++ b/components/vc-time-picker/TimePicker.jsx @@ -1,7 +1,13 @@ import moment from 'moment'; import PropTypes from '../_util/vue-types'; import BaseMixin from '../_util/BaseMixin'; -import { initDefaultProps, hasProp, getComponentFromProp,isValidElement, getEvents } from '../_util/props-util'; +import { + initDefaultProps, + hasProp, + getComponentFromProp, + isValidElement, + getEvents, +} from '../_util/props-util'; import { cloneElement } from '../_util/vnode'; import Trigger from '../vc-trigger'; import Panel from './Panel'; diff --git a/components/vc-time-picker/assets/index.less b/components/vc-time-picker/assets/index.less index 1582de656..3f819b097 100644 --- a/components/vc-time-picker/assets/index.less +++ b/components/vc-time-picker/assets/index.less @@ -21,7 +21,7 @@ margin: 0; &-icon:after { - content: "x"; + content: 'x'; font-size: 12px; font-style: normal; color: #aaa; diff --git a/components/vc-tree-select/src/util.js b/components/vc-tree-select/src/util.js index 2c4ab4d3e..81d7b52f6 100644 --- a/components/vc-tree-select/src/util.js +++ b/components/vc-tree-select/src/util.js @@ -118,7 +118,7 @@ export function parseSimpleTreeData(treeData, { id, pId, rootPId }) { const rootNodeList = []; // Fill in the map - const nodeList = treeData.map((node) => { + const nodeList = treeData.map(node => { const clone = { ...node }; const key = clone[id]; keyNodes[key] = clone; @@ -239,7 +239,7 @@ export function formatInternalValue(value, props) { // Parse label in value if (isLabelInValue(props)) { - return valueList.map((val) => { + return valueList.map(val => { if (typeof val !== 'object' || !val) { return { value: '', diff --git a/types/statistic.ts b/types/statistic.ts index 9910d3e14..d24320de7 100644 --- a/types/statistic.ts +++ b/types/statistic.ts @@ -42,7 +42,7 @@ export declare class Statistic extends AntdComponent { * suffix node of value * @type string | VNode */ - suffix: string | VNode;; + suffix: string | VNode; /** * Display title @@ -55,5 +55,4 @@ export declare class Statistic extends AntdComponent { * @type string or number */ value: string | number; - }