Browse Source

style: fix code format

pull/1040/head
wangxueliang 6 years ago
parent
commit
76d8491b66
  1. 10
      components/anchor/Anchor.jsx
  2. 9
      components/auto-complete/index.jsx
  3. 6
      components/avatar/__tests__/Avatar.test.js
  4. 4
      components/badge/ScrollNumber.jsx
  5. 4
      components/button/button.jsx
  6. 2
      components/calendar/Header.jsx
  7. 7
      components/calendar/index.jsx
  8. 1
      components/carousel/index.jsx
  9. 7
      components/cascader/index.jsx
  10. 21
      components/collapse/Collapse.jsx
  11. 8
      components/config-provider/index.jsx
  12. 3
      components/config-provider/renderEmpty.jsx
  13. 10
      components/date-picker/RangePicker.jsx
  14. 12
      components/date-picker/WeekPicker.jsx
  15. 8
      components/date-picker/createPicker.js
  16. 2
      components/date-picker/index.js
  17. 6
      components/date-picker/wrapPicker.js
  18. 12
      components/drawer/index.jsx
  19. 8
      components/dropdown/dropdown-button.jsx
  20. 9
      components/empty/index.jsx
  21. 2
      components/form/FormItem.jsx
  22. 14
      components/icon/index.js
  23. 2
      components/input/Input.jsx
  24. 11
      components/input/Password.js
  25. 11
      components/input/Search.jsx
  26. 18
      components/layout/Sider.jsx
  27. 3
      components/list/Item.jsx
  28. 9
      components/list/index.jsx
  29. 8
      components/modal/index.js
  30. 4
      components/popconfirm/index.jsx
  31. 16
      components/progress/progress.jsx
  32. 2
      components/progress/utils.js
  33. 13
      components/radio/RadioButton.jsx
  34. 1
      components/rate/index.jsx
  35. 7
      components/select/index.jsx
  36. 2
      components/select/style/index.less
  37. 10
      components/spin/Spin.jsx
  38. 7
      components/statistic/Statistic.jsx
  39. 70
      components/statistic/__tests__/__snapshots__/demo.test.js.snap
  40. 6
      components/style/themes/default.less
  41. 4
      components/switch/index.jsx
  42. 29
      components/table/Table.jsx
  43. 4
      components/table/filterDropdown.jsx
  44. 13
      components/time-picker/__tests__/index.test.js
  45. 7
      components/time-picker/index.jsx
  46. 7
      components/transfer/index.jsx
  47. 5
      components/transfer/list.jsx
  48. 129
      components/tree-select/index.jsx
  49. 12
      components/tree/Tree.jsx
  50. 10
      components/upload/Upload.jsx
  51. 2
      components/vc-calendar/src/date/DateInput.jsx
  52. 19
      components/vc-dropdown/assets/index.less
  53. 8
      components/vc-dropdown/demo/simple.jsx
  54. 9
      components/vc-dropdown/src/Dropdown.jsx
  55. 42
      components/vc-notification/demo/simple.jsx
  56. 12
      components/vc-rate/src/Star.jsx
  57. 6
      components/vc-select/Select.jsx
  58. 2
      components/vc-select/assets/index.less
  59. 1
      components/vc-slider/demo/slider.jsx
  60. 4
      components/vc-slider/src/Range.jsx
  61. 2
      components/vc-slider/src/Slider.jsx
  62. 5
      components/vc-tabs/src/ScrollableInkTabBar.jsx
  63. 6
      components/vc-time-picker/Header.jsx
  64. 8
      components/vc-time-picker/Select.jsx
  65. 8
      components/vc-time-picker/TimePicker.jsx
  66. 2
      components/vc-time-picker/assets/index.less
  67. 4
      components/vc-tree-select/src/util.js
  68. 3
      types/statistic.ts

10
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);

9
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);

6
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';

4
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;
},

4
components/button/button.jsx

@ -151,7 +151,9 @@ export default {
const iconNode = iconType ? <Icon type={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 (

2
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);

7
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';

1
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);

7
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);

21
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 || <Icon type="right" rotate={panelProps.isActive ? 90 : undefined} />;
const icon = expandIcon || (
<Icon type="right" rotate={panelProps.isActive ? 90 : undefined} />
);
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,

8
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) {

3
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':

10
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();
}
});

12
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 ? (
<div class={`${prefixCls}-footer-extra`}>{renderExtraFooter(...args)}</div>

8
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();
}
});

2
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(

6
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);

12
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 = {};

8
components/dropdown/dropdown-button.jsx

@ -73,7 +73,13 @@ export default {
return (
<ButtonGroup {...restProps} class={prefixCls}>
<Button type={type} disabled={disabled} onClick={this.onClick} htmlType={htmlType} href={href}>
<Button
type={type}
disabled={disabled}
onClick={this.onClick}
htmlType={htmlType}
href={href}
>
{this.$slots.default}
</Button>
<Dropdown {...dropdownProps}>

9
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 (
<LocaleReceiver componentName="Empty" scopedSlots={{ default: this.renderEmpty }} />
);
return <LocaleReceiver componentName="Empty" scopedSlots={{ default: this.renderEmpty }} />;
},
};

2
components/form/FormItem.jsx

@ -407,7 +407,7 @@ export default {
prefixCls,
this.slotDefault,
this.renderHelp(prefixCls),
this.renderExtra(prefixCls)
this.renderExtra(prefixCls),
),
),
];

14
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 (
<LocaleReceiver
componentName="Icon"
scopedSlots={{ default: (locale) => renderIcon(h, locale, context) }}
scopedSlots={{ default: locale => renderIcon(h, locale, context) }}
/>
);
},

2
components/input/Input.jsx

@ -222,7 +222,7 @@ export default {
if ($listeners['change.value']) {
inputProps.directives = [{ name: 'ant-input' }];
}
return this.renderLabeledIcon(prefixCls,<input {...inputProps} />);
return this.renderLabeledIcon(prefixCls, <input {...inputProps} />);
},
},
render() {

11
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,

11
components/input/Search.jsx

@ -47,12 +47,7 @@ export default {
if (enterButton) return suffix;
const node = (
<Icon
class={`${prefixCls}-icon`}
type="search"
key="searchIcon"
onClick={this.onSearch}
/>
<Icon class={`${prefixCls}-icon`} type="search" key="searchIcon" onClick={this.onSearch} />
);
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,

18
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 ? (
<span onClick={this.toggle} class={`${prefixCls}-zero-width-trigger ${prefixCls}-zero-width-trigger-${
reverseArrow ? 'right' : 'left'
}`}>
<span
onClick={this.toggle}
class={`${prefixCls}-zero-width-trigger ${prefixCls}-zero-width-trigger-${
reverseArrow ? 'right' : 'left'
}`}
>
<Icon type="bars" />
</span>
) : null;

3
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;

9
components/list/index.jsx

@ -118,7 +118,7 @@ const List = {
const locale = this;
return (
<div class={`${prefixCls}-empty-text`}>
{(locale && locale.emptyText) || renderEmpty(h, 'List')}
{(locale && locale.emptyText) || renderEmpty(h, 'List')}
</div>
);
},
@ -222,10 +222,9 @@ const List = {
childrenContent = grid ? <Row gutter={grid.gutter}>{childrenList}</Row> : 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';

8
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 <Icon type="info-circle" />;
},
okCancel: false,
@ -20,7 +20,7 @@ const info = function(props) {
const success = function(props) {
const config = {
type: 'success',
icon: (h) => {
icon: h => {
return <Icon type="check-circle" />;
},
okCancel: false,
@ -32,7 +32,7 @@ const success = function(props) {
const error = function(props) {
const config = {
type: 'error',
icon: (h) => {
icon: h => {
return <Icon type="close-circle" />;
},
okCancel: false,
@ -44,7 +44,7 @@ const error = function(props) {
const warning = function(props) {
const config = {
type: 'warning',
icon: (h) => {
icon: h => {
return <Icon type="exclamation-circle" />;
},
okCancel: false,

4
components/popconfirm/index.jsx

@ -144,7 +144,9 @@ const Popconfirm = {
<LocaleReceiver
componentName="Popconfirm"
defaultLocale={defaultLocale.Popconfirm}
scopedSlots={{ default: (popconfirmLocale) => this.renderOverlay(prefixCls, popconfirmLocale) }}
scopedSlots={{
default: popconfirmLocale => this.renderOverlay(prefixCls, popconfirmLocale),
}}
/>
);
return (

16
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 = (
<Line {...lineProps}>
{progressInfo}
</Line>
);
progress = <Line {...lineProps}>{progressInfo}</Line>;
} else if (type === 'circle' || type === 'dashboard') {
const circleProps = {
props: {
@ -121,11 +117,7 @@ export default {
progressStatus,
},
};
progress = (
<Circle {...circleProps}>
{progressInfo}
</Circle>
);
progress = <Circle {...circleProps}>{progressInfo}</Circle>;
}
const classString = classNames(prefixCls, {

2
components/progress/utils.js

@ -5,4 +5,4 @@ export function validProgress(progress) {
return 100;
}
return progress;
};
}

13
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;

1
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';

7
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;

2
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 {

10
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);

7
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);

70
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`] = `
<div>
<div class="ant-card ant-card-bordered" style="padding: 30px;">
<div class="ant-card-body">
<div class="ant-statistic" style="margin-right: 50px;">
<div class="ant-statistic-title">Feedback</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-prefix"><i slot="prefix" aria-label="icon: like" class="anticon anticon-like"><svg viewBox="64 64 896 896" data-icon="like" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"></path></svg></i></span><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">1,128</span></span></div>
<div style="background: rgb(236, 236, 236); padding: 30px;">
<div class="ant-row" style="margin-left: -8px; margin-right: -8px;">
<div class="ant-col-12" style="padding-left: 8px; padding-right: 8px;">
<div class="ant-card ant-card-bordered">
<div class="ant-card-body">
<div class="ant-statistic" style="margin-right: 50px;">
<div class="ant-statistic-title">Feedback</div>
<div class="ant-statistic-content" style="color: rgb(63, 134, 0);"><span class="ant-statistic-content-prefix"><i aria-label="icon: arrow-up" class="anticon anticon-arrow-up"><svg viewBox="64 64 896 896" data-icon="arrow-up" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M868 545.5L536.1 163a31.96 31.96 0 0 0-48.3 0L156 545.5a7.97 7.97 0 0 0 6 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z"></path></svg></i></span><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">11</span><span class="ant-statistic-content-value-decimal">.28</span></span><span class="ant-statistic-content-suffix">%</span></div>
</div>
</div>
</div>
<div class="ant-statistic" valueclass="demo-class">
<div class="ant-statistic-title">Unmerged</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">1,234,567,890</span></span><span class="ant-statistic-content-suffix"><span> / 100</span></span></div>
</div>
<div class="ant-col-12" style="padding-left: 8px; padding-right: 8px;">
<div class="ant-card ant-card-bordered">
<div class="ant-card-body">
<div class="ant-statistic" valueclass="demo-class">
<div class="ant-statistic-title">Idle</div>
<div class="ant-statistic-content" style="color: rgb(207, 19, 34);"><span class="ant-statistic-content-prefix"><i aria-label="icon: arrow-down" class="anticon anticon-arrow-down"><svg viewBox="64 64 896 896" data-icon="arrow-down" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M862 465.3h-81c-4.6 0-9 2-12.1 5.5L550 723.1V160c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v563.1L255.1 470.8c-3-3.5-7.4-5.5-12.1-5.5h-81c-6.8 0-10.5 8.1-6 13.2L487.9 861a31.96 31.96 0 0 0 48.3 0L868 478.5c4.5-5.2.8-13.2-6-13.2z"></path></svg></i></span><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">9</span><span class="ant-statistic-content-value-decimal">.30</span></span><span class="ant-statistic-content-suffix">%</span></div>
</div>
</div>
</div>
</div>
</div>
@ -31,27 +41,41 @@ exports[`renders ./components/statistic/demo/card.md correctly 1`] = `
`;
exports[`renders ./components/statistic/demo/countdown.md correctly 1`] = `
<div>
<div class="ant-statistic" style="margin-right: 50px;">
<div class="ant-statistic-title">Countdown</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value">48:00:30</span></div>
<div class="ant-row" style="margin-left: -8px; margin-right: -8px;">
<div class="ant-col-12" style="padding-left: 8px; padding-right: 8px;">
<div class="ant-statistic" style="margin-right: 50px;">
<div class="ant-statistic-title">Countdown</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value">48:00:30</span></div>
</div>
</div>
<div class="ant-statistic">
<div class="ant-statistic-title">Million Seconds</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value">48:00:30:000</span></div>
<div class="ant-col-12" style="padding-left: 8px; padding-right: 8px;">
<div class="ant-statistic" style="margin-right: 50px;">
<div class="ant-statistic-title">Million Seconds</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value">48:00:30:000</span></div>
</div>
</div>
<div class="ant-col-24" style="padding-left: 8px; padding-right: 8px; margin-top: 32px;">
<div class="ant-statistic">
<div class="ant-statistic-title">Day Level</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value">2 天 0 时 0 分 30 秒</span></div>
</div>
</div>
</div>
`;
exports[`renders ./components/statistic/demo/unit.md correctly 1`] = `
<div>
<div class="ant-statistic" style="margin-right: 50px;">
<div class="ant-statistic-title">Feedback</div>
<div class="ant-statistic-content" style="color: rgb(63, 134, 0);"><span class="ant-statistic-content-prefix"><i slot="prefix" aria-label="icon: arrow-up" class="anticon anticon-arrow-up"><svg viewBox="64 64 896 896" data-icon="arrow-up" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M868 545.5L536.1 163a31.96 31.96 0 0 0-48.3 0L156 545.5a7.97 7.97 0 0 0 6 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z"></path></svg></i></span><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">11</span><span class="ant-statistic-content-value-decimal">.28</span></span><span class="ant-statistic-content-suffix">%</span></div>
<div class="ant-row" style="margin-left: -8px; margin-right: -8px;">
<div class="ant-col-12" style="padding-left: 8px; padding-right: 8px;">
<div class="ant-statistic" style="margin-right: 50px;">
<div class="ant-statistic-title">Feedback</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">1,128</span></span><span class="ant-statistic-content-suffix"><i aria-label="icon: like" class="anticon anticon-like"><svg viewBox="64 64 896 896" data-icon="like" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"></path></svg></i></span></div>
</div>
</div>
<div class="ant-statistic" valueclass="demo-class">
<div class="ant-statistic-title">Unmerged</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">78</span></span><span class="ant-statistic-content-suffix"><span> / 100</span></span></div>
<div class="ant-col-12" style="padding-left: 8px; padding-right: 8px;">
<div class="ant-statistic" valueclass="demo-class">
<div class="ant-statistic-title">Unmerged</div>
<div class="ant-statistic-content"><span class="ant-statistic-content-value"><span class="ant-statistic-content-value-int">93</span></span><span class="ant-statistic-content-suffix"><span> / 100</span></span></div>
</div>
</div>
</div>
`;

6
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%);

4
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);

29
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: [
<div
key="title"
class={sortButton ? `${prefixCls}-column-sorters` : undefined}
>
<div key="title" class={sortButton ? `${prefixCls}-column-sorters` : undefined}>
{this.renderColumnTitle(column.title)}
{sortButton}
</div>,
@ -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 {
<LocaleReceiver
componentName="Table"
defaultLocale={defaultLocale.Table}
children={locale => this.renderTable(prefixCls, renderEmpty, dropdownPrefixCls, locale, loading)}
children={locale =>
this.renderTable(prefixCls, renderEmpty, dropdownPrefixCls, locale, loading)
}
/>
);

4
components/table/filterDropdown.jsx

@ -261,7 +261,9 @@ export default {
}
const menus = filterDropdown ? (
<FilterDropdownMenuWrapper class={`${prefixCls}-dropdown`}>{filterDropdown}</FilterDropdownMenuWrapper>
<FilterDropdownMenuWrapper class={`${prefixCls}-dropdown`}>
{filterDropdown}
</FilterDropdownMenuWrapper>
) : (
<FilterDropdownMenuWrapper class={`${prefixCls}-dropdown`}>
<Menu

13
components/time-picker/__tests__/index.test.js

@ -43,14 +43,11 @@ describe('TimePicker', () => {
);
});
it('not render clean icon when allowClear is false', () => {
const wrapper = mount(
{
render() {
return <TimePicker defaultValue={moment('2000-01-01 00:00:00')} allowClear={false} />;
},
}
);
const wrapper = mount({
render() {
return <TimePicker defaultValue={moment('2000-01-01 00:00:00')} allowClear={false} />;
},
});
expect(wrapper.html()).toMatchSnapshot();
});
});

7
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);

7
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,

5
components/transfer/list.jsx

@ -243,8 +243,7 @@ export default {
)}
>
{search}
{
!searchNotFound &&
{!searchNotFound && (
<transition-group
{...transitionProps}
tag="ul"
@ -253,7 +252,7 @@ export default {
>
{showItems}
</transition-group>
}
)}
{searchNotFound}
</div>
);

129
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 = <span class={`${prefixCls}-tree-checkbox-inner`} />;
}
let checkable = getComponentFromProp(this, 'treeCheckable');
if (checkable) {
checkable = <span class={`${prefixCls}-tree-checkbox-inner`} />;
}
const inputIcon = (suffixIcon &&
(isValidElement(suffixIcon) ? cloneElement(suffixIcon) : suffixIcon)) || (
<Icon type="down" class={`${prefixCls}-arrow-icon`} />
);
const inputIcon = (suffixIcon &&
(isValidElement(suffixIcon) ? cloneElement(suffixIcon) : suffixIcon)) || (
<Icon type="down" class={`${prefixCls}-arrow-icon`} />
);
const removeIcon = <Icon type="close" class={`${prefixCls}-remove-icon`} />;
const removeIcon = <Icon type="close" class={`${prefixCls}-remove-icon`} />;
const clearIcon = (
<Icon type="close-circle" class={`${prefixCls}-clear-icon`} theme="filled" />
);
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 <VcTreeSelect {...VcTreeSelectProps}>{filterEmpty(this.$slots.default)}</VcTreeSelect>;
const clearIcon = <Icon type="close-circle" class={`${prefixCls}-clear-icon`} theme="filled" />;
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 <VcTreeSelect {...VcTreeSelectProps}>{filterEmpty(this.$slots.default)}</VcTreeSelect>;
},
};

12
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 ? <span class={`${prefixCls}-checkbox-inner`} /> : 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',

10
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);

2
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());
}
}

19
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);

8
components/vc-dropdown/demo/simple.jsx

@ -17,13 +17,9 @@ export default {
render() {
return (
<div style="margin: 100px">
<div style="height: 100px"/>
<div style="height: 100px" />
<div>
<Dropdown
trigger={['click']}
animation="slide-up"
onVisibleChange={this.onVisibleChange}
>
<Dropdown trigger={['click']} animation="slide-up" onVisibleChange={this.onVisibleChange}>
<Menu slot="overlay" onSelect={this.onSelect}>
<MenuItem disabled>disabled</MenuItem>
<MenuItem key="1">one</MenuItem>

9
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;
},
},

42
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 (
<i>
<svg
viewBox="0 0 1024 1024"
width="1em"
height="1em"
fill="currentColor"
style={{ verticalAlign: '-.125em ' }}
>
<path d={clearPath} />
</svg>
</i>
);
Notification.newInstance(
{
closeIcon: h => {
return (
<i>
<svg
viewBox="0 0 1024 1024"
width="1em"
height="1em"
fill="currentColor"
style={{ verticalAlign: '-.125em ' }}
>
<path d={clearPath} />
</svg>
</i>
);
},
},
}, (n) => {
notification2 = n;
});
n => {
notification2 = n;
},
);
function customCloseIconFn() {
notification2.notice({
content: 'It is using custom close icon...',

12
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 = (

6
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 = [<MenuItem {...p}>{notFoundContent}</MenuItem>];
}
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

2
components/vc-select/assets/index.less

@ -82,7 +82,7 @@
&-loading {
.@{selectPrefixCls}-selection--multiple {
.@{selectPrefixCls}-selection__clear {
right: 20px;
right: 20px;
}
}
}

1
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) {

4
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 });

2
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 });

5
components/vc-tabs/src/ScrollableInkTabBar.jsx

@ -28,7 +28,10 @@ export default {
children={(saveRef, getRef) => (
<TabBarRootNode saveRef={saveRef} {...{ props, on: listeners }}>
<ScrollableTabBarNode saveRef={saveRef} getRef={getRef} {...{ props, on: listeners }}>
<TabBarTabsNode saveRef={saveRef} {...{ props: {...props, renderTabBarNode}, on: listeners }} />
<TabBarTabsNode
saveRef={saveRef}
{...{ props: { ...props, renderTabBarNode }, on: listeners }}
/>
<InkTabBarNode saveRef={saveRef} getRef={getRef} {...{ props, on: listeners }} />
</ScrollableTabBarNode>
</TabBarRootNode>

6
components/vc-time-picker/Header.jsx

@ -181,11 +181,7 @@ const Header = {
render() {
const { prefixCls } = this;
return (
<div class={`${prefixCls}-input-wrap`}>
{this.getInput()}
</div>
);
return <div class={`${prefixCls}-input-wrap`}>{this.getInput()}</div>;
},
};

8
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 (
<li role="button" onClick={onClick} class={cls} key={index} disabled={item.disabled}>
{item.value}

8
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';

2
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;

4
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: '',

3
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;
}

Loading…
Cancel
Save