diff --git a/components/affix/index.jsx b/components/affix/index.jsx index eaa9c11bcd658eb1a8e2245337141c3a5f43ea0a..c8a1f4185547361ed06948d3ce0a58cb3f70aeda 100644 --- a/components/affix/index.jsx +++ b/components/affix/index.jsx @@ -8,10 +8,10 @@ function getScroll(w, top) { let method = 'scroll' + (top ? 'Top' : 'Left'); if (typeof ret !== 'number') { let d = w.document; - //ie6,7,8 standard mode + // ie6,7,8 standard mode ret = d.documentElement[method]; if (typeof ret !== 'number') { - //quirks mode + // quirks mode ret = d.body[method]; } } diff --git a/components/alert/index.jsx b/components/alert/index.jsx index 91c0f8ad231f946f9309ef1d0bdc9c407884af3a..a5cf1fa569251a554a89f8f86c84565a9a5e9a0b 100644 --- a/components/alert/index.jsx +++ b/components/alert/index.jsx @@ -44,20 +44,20 @@ export default React.createClass({ let iconType = ''; switch (type) { - case 'success': - iconType = 'check-circle'; - break; - case 'info': - iconType = 'info-circle'; - break; - case 'error': - iconType = 'exclamation-circle'; - break; - case 'warn': - iconType = 'exclamation-circle'; - break; - default: - iconType = 'default'; + case 'success': + iconType = 'check-circle'; + break; + case 'info': + iconType = 'info-circle'; + break; + case 'error': + iconType = 'exclamation-circle'; + break; + case 'warn': + iconType = 'exclamation-circle'; + break; + default: + iconType = 'default'; } // use outline icon in alert with description diff --git a/components/badge/ScrollNumber.jsx b/components/badge/ScrollNumber.jsx index d3bff2236d00f8c809884056a22e6770467f872d..cf01a80ecf7e2d62c418ea219860e23d92a2b7ea 100644 --- a/components/badge/ScrollNumber.jsx +++ b/components/badge/ScrollNumber.jsx @@ -26,16 +26,13 @@ class AntScrollNumber extends React.Component { if (this.state.count > this.lastCount) { if (currentDigit >= lastDigit) { return 10 + num; - } else { - return 20 + num; - } - } else { - if (currentDigit <= lastDigit) { - return 10 + num; - } else { - return num; } + return 20 + num; + } + if (currentDigit <= lastDigit) { + return 10 + num; } + return num; } componentWillReceiveProps(nextProps) { @@ -106,13 +103,12 @@ class AntScrollNumber extends React.Component { props, this.renderNumberElement() ); - } else { - return createElement( - this.props.component, - props, - props.count - ); } + return createElement( + this.props.component, + props, + props.count + ); } } diff --git a/components/breadcrumb/index.jsx b/components/breadcrumb/index.jsx index cc3837b3276c520920a78d8a3d46075f0a576b2c..657a477b779ac5ee06040113850e3de734c9c1b7 100644 --- a/components/breadcrumb/index.jsx +++ b/components/breadcrumb/index.jsx @@ -21,10 +21,12 @@ const BreadcrumbItem = React.createClass({ if (typeof this.props.href === 'undefined') { link = {children}; } - return - {link} - {separator} - ; + return ( + + {link} + {separator} + + ); } }); diff --git a/components/button/button.jsx b/components/button/button.jsx index cecabc9786d4997feb70f4a3c46e0cc76d908c09..43b33c2d799e0617feabd8f1189a65d1294de52c 100644 --- a/components/button/button.jsx +++ b/components/button/button.jsx @@ -52,9 +52,11 @@ export default class Button extends React.Component { const kids = React.Children.map(children, insertSpace); - return ; + return ( + + ); } } diff --git a/components/calendar/index.jsx b/components/calendar/index.jsx index 39fd6af6d25042c88af266bb83a9c6ef1dfb697a..9e4615ce85e9f785126863ab1e8d6c54f6b63815 100644 --- a/components/calendar/index.jsx +++ b/components/calendar/index.jsx @@ -35,25 +35,29 @@ class Calendar extends Component { monthCellRender(value, locale) { const prefixCls = this.props.prefixCls; const month = value.getMonth(); - return
-
- {locale.format.shortMonths[month]} -
-
- {this.props.monthCellRender(value)} + return ( +
+
+ {locale.format.shortMonths[month]} +
+
+ {this.props.monthCellRender(value)} +
-
; + ); } dateCellRender(value) { const prefixCls = this.props.prefixCls; - return
-
- {zerofixed(value.getDayOfMonth())} -
-
- {this.props.dateCellRender(value)} + return ( +
+
+ {zerofixed(value.getDayOfMonth())} +
+
+ {this.props.dateCellRender(value)} +
-
; + ); } setValue(value) { if (!('value' in this.props) && this.state.value !== value) { diff --git a/components/checkbox/Group.jsx b/components/checkbox/Group.jsx index 50cbd9229f1dfa153042b6962b6a42fe003c7589..b0e795c7d4426997213a99e5faa844a7ae352627 100644 --- a/components/checkbox/Group.jsx +++ b/components/checkbox/Group.jsx @@ -42,17 +42,19 @@ export default React.createClass({ }, render() { const options = this.props.options; - return
- { - options.map(option => - - ) - } -
; + return ( +
+ { + options.map(option => + + ) + } +
+ ); }, }); diff --git a/components/date-picker/RangePicker.jsx b/components/date-picker/RangePicker.jsx index e5aaa57414f5575b84f9e6b1d9f626d6a0d79354..6bda6ffc0ea10b12195328b26a86a37247296341 100644 --- a/components/date-picker/RangePicker.jsx +++ b/components/date-picker/RangePicker.jsx @@ -76,14 +76,16 @@ export default React.createClass({ ['ant-calendar-time']: this.props.showTime, }); - const calendar = ; + const calendar = ( + + ); const pickerClass = classNames({ 'ant-calendar-picker': true, diff --git a/components/date-picker/index.jsx b/components/date-picker/index.jsx index beea4abec2359e35111b9e8a3797a0c9ac6ea327..091e6c25f29596b13e42f0e22861f4976872f80a 100644 --- a/components/date-picker/index.jsx +++ b/components/date-picker/index.jsx @@ -91,35 +91,36 @@ function createPicker(TheCalendar, defaultFormat) { pickerClass += ' ant-calendar-picker-open'; } - return - - { - ({ value }) => { - return ( - - - - - ); + return ( + + + { + ({ value }) => { + return ( + + + + + ); + } } - } - - ; + + + ); } }); } diff --git a/components/dropdown/dropdown-button.jsx b/components/dropdown/dropdown-button.jsx index a986201455dbc95a16d71bfd68791659cf65c862..df05003e2c08ecee926aaf0bdb56cbfb965f414d 100644 --- a/components/dropdown/dropdown-button.jsx +++ b/components/dropdown/dropdown-button.jsx @@ -22,15 +22,17 @@ export default React.createClass({ }; }, render() { - return - - + return ( + - - ; + + + + + ); } }); diff --git a/components/form/FormItem.jsx b/components/form/FormItem.jsx index 8c9e9ea08fbf9f2fb2ef7d00642770d39cd5f2e2..7fc94a47c41429a57a9151a443723a4fe2a146a7 100644 --- a/components/form/FormItem.jsx +++ b/components/form/FormItem.jsx @@ -85,10 +85,8 @@ class FormItem extends React.Component { const compactControls = ['checkbox', 'radio', 'radio-group', 'static', 'file']; let isCompact = false; - if (!Array.isArray(children)) { - children = [children]; - } - children.map((child) => { + const childrenArray = Array.isArray(children) ? children : [children]; + childrenArray.map((child) => { const type = child.props && child.props.type; let prefixCls = child.props && child.props.prefixCls; prefixCls = prefixCls ? prefixCls.substring(prefixCls.indexOf('-') + 1) : ''; diff --git a/components/input/index.jsx b/components/input/index.jsx index a1385db08960342b8e855d0722bba4c9951f4b8f..c699680d74a22b1f0e14382b9c3b9ce63a44c09d 100644 --- a/components/input/index.jsx +++ b/components/input/index.jsx @@ -72,12 +72,12 @@ class Input extends React.Component { } switch (props.size) { - case 'small': inputClassName = prefixClsFn(prefixCls, 'input', 'input-sm'); break; - case 'large': inputClassName = prefixClsFn(prefixCls, 'input', 'input-lg'); break; - default: + case 'small': inputClassName = prefixClsFn(prefixCls, 'input', 'input-sm'); break; + case 'large': inputClassName = prefixClsFn(prefixCls, 'input', 'input-lg'); break; + default: } let placeholder = props.placeholder; - if(placeholder && ieGT9()){ + if (placeholder && ieGT9()) { placeholder = null; } if ('value' in props) { diff --git a/components/modal/confirm.jsx b/components/modal/confirm.jsx index 9b8eb43d4625a218e84a1e683057cc1087431a59..21b9356407f93fbb729dd262a76776adf3d16a3e 100644 --- a/components/modal/confirm.jsx +++ b/components/modal/confirm.jsx @@ -4,12 +4,11 @@ import Dialog from './index'; import Icon from '../icon'; import Button from '../button'; -export default function (props) { +export default function (props = {}) { let div = document.createElement('div'); document.body.appendChild(div); let d; - props = props || {}; props.iconClassName = props.iconClassName || 'question-circle'; let iconClassType = props.iconClassName; @@ -72,28 +71,34 @@ export default function (props) { } } - let body =
- - {props.title} -
{props.content}
-
; + let body = ( +
+ + {props.title} +
{props.content}
+
+ ); let footer = null; if (props.okCancel) { - footer =
- - -
; + footer = ( +
+ + +
+ ); } else { - footer =
- -
; + footer = ( +
+ +
+ ); } ReactDOM.render( ]; let footer = props.footer || defaultFooter; - return ; + return ( + + ); } }); diff --git a/components/notification/index.jsx b/components/notification/index.jsx index 0810c52247a83c4c4baf2c2514864c91649dc9d2..54ad38e993a8c718d153bd8a32c63f284425e456 100644 --- a/components/notification/index.jsx +++ b/components/notification/index.jsx @@ -98,10 +98,10 @@ function notice(args) { } let api = { - open(args){ + open(args) { notice(args); }, - close(key){ + close(key) { if (notificationInstance) { notificationInstance.removeNotice(key); } diff --git a/components/pagination/index.jsx b/components/pagination/index.jsx index 048184ed63e8f0218d8f5f3c107d6a9ad316dcfa..5435334341d6a6d667a7387bb1ee6152ff9db16d 100644 --- a/components/pagination/index.jsx +++ b/components/pagination/index.jsx @@ -21,10 +21,12 @@ class AntPagination extends React.Component { selectComponentClass = MiniSelect; } - return ; + return ( + + ); } } diff --git a/components/popconfirm/index.jsx b/components/popconfirm/index.jsx index f095519db03da9c87ec052be3ca01ebb16083502..eaa1fe0b36562fdbce7b5b02a0ba200dcb1eefda 100644 --- a/components/popconfirm/index.jsx +++ b/components/popconfirm/index.jsx @@ -63,18 +63,20 @@ export default React.createClass({ }, render() { const {title, okText, cancelText, placement, overlayStyle, trigger} = this.props; - const overlay =
-
-

- - {title} -

-
- - + const overlay = ( +
+
+

+ + {title} +

+
+ + +
-
; + ); const transitionName = transitionNames[placement]; diff --git a/components/popover/index.jsx b/components/popover/index.jsx index 8e4e772b7d3be097a24c06778444672b3750677e..dc2b9e9a6fbb4f613ec74c0d50c5abd03d95ce89 100644 --- a/components/popover/index.jsx +++ b/components/popover/index.jsx @@ -46,12 +46,14 @@ const Popover = React.createClass({ }, getOverlay() { - return
- {this.props.title &&
{this.props.title}
} -
- {this.props.overlay} + return ( +
+ {this.props.title &&
{this.props.title}
} +
+ {this.props.overlay} +
-
; + ); }, }); diff --git a/components/progress/index.jsx b/components/progress/index.jsx index 8212674209d5a4f9efa313178a9e691b76f4a954..b089befb560e71f89e982dbc4f58ddf63d68083a 100644 --- a/components/progress/index.jsx +++ b/components/progress/index.jsx @@ -39,7 +39,7 @@ let Line = React.createClass({ const text = (typeof props.format === 'string') ? props.format.replace('${percent}', props.percent) : props.format; - if(props.showInfo === true){ + if (props.showInfo === true) { if (props.status === 'exception') { progressInfo = ( {text} diff --git a/components/radio/group.jsx b/components/radio/group.jsx index bb29baeae5fb1bf12f04239bf85c60af0eb1ee3c..389417cd454de061336f3d3b7d9da1930aabdb2d 100644 --- a/components/radio/group.jsx +++ b/components/radio/group.jsx @@ -37,13 +37,13 @@ export default React.createClass({ let props = this.props; let children = React.Children.map(props.children, (radio) => { if (radio.props) { - return ; + return ( + + ); } return radio; }); diff --git a/components/spin/index.jsx b/components/spin/index.jsx index 6e14d764e6f0e79245bade421c59aaf79c2cdced..e3f949774580cf334dbc67d0d5f6e70c081a3d0d 100644 --- a/components/spin/index.jsx +++ b/components/spin/index.jsx @@ -53,9 +53,8 @@ const AntSpin = React.createClass({
); - } else { - return spinElement; } + return spinElement; } }); diff --git a/components/table/filterDropdown.jsx b/components/table/filterDropdown.jsx index a4dd7dae92fac2f90ef9a833ac14ae9467fc0c56..267c2fe13801d5489334c313ff5e30045f4662a9 100644 --- a/components/table/filterDropdown.jsx +++ b/components/table/filterDropdown.jsx @@ -13,7 +13,7 @@ let FilterMenu = React.createClass({ visible: false, }; }, - componentWillReceiveProps(nextProps){ + componentWillReceiveProps(nextProps) { this.setState({ selectedKeys: nextProps.selectedKeys }); @@ -95,6 +95,7 @@ let FilterMenu = React.createClass({ if ('filterMultiple' in column) { multiple = column.filterMultiple; } +<<<<<<< 1e001d2d82c5816b55d3953939fcaedbbacf1a3c let menus =
{locale.filterReset} +======= + let menus = ( +
+ + {this.renderMenus(column.filters)} + + +>>>>>>> style: update code style to please lint
-
; + ); let dropdownSelectedClass = ''; if (this.props.selectedKeys.length > 0) { dropdownSelectedClass = 'ant-table-filter-selected'; } - return - - ; + return ( + + + + ); } }); diff --git a/components/table/index.jsx b/components/table/index.jsx index c2c0e73049a0ca3c031f9b0bd51cd908aa82f437..f1c45343645b38570b705d75f02b6436ccbd0cd7 100644 --- a/components/table/index.jsx +++ b/components/table/index.jsx @@ -147,9 +147,9 @@ let AntTable = React.createClass({ this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState))); }, - handleFilter(column, filters) { - filters = objectAssign({}, this.state.filters, { - [this.getColumnKey(column)]: filters + handleFilter(column, nextFilters) { + const filters = objectAssign({}, this.state.filters, { + [this.getColumnKey(column)]: nextFilters }); // Remove filters not in current columns const currentColumnKeys = this.props.columns.map(c => this.getColumnKey(c)); @@ -281,8 +281,10 @@ let AntTable = React.createClass({ checked = (this.state.radioIndex === rowIndex || this.getDefaultSelection().indexOf(rowIndex) >= 0); } - return ; + return ( + + ); }, renderSelectionCheckBox(value, record, index) { @@ -298,8 +300,10 @@ let AntTable = React.createClass({ if (this.props.rowSelection.getCheckboxProps) { props = this.props.rowSelection.getCheckboxProps.call(this, record); } - return ; + return ( + + ); }, getRecordKey(record, index) { @@ -377,16 +381,18 @@ let AntTable = React.createClass({ renderColumnsDropdown(columns) { let locale = objectAssign({}, defaultLocale, this.props.locale); - return columns.map((column, i) => { - column = objectAssign({}, column); + return columns.map((originColumn, i) => { + let column = objectAssign({}, originColumn); let key = this.getColumnKey(column, i); - let filterDropdown, sortButton; + let filterDropdown; + let sortButton; if (column.filters && column.filters.length > 0) { let colFilters = this.state.filters[key] || []; - filterDropdown = + filterDropdown = ( ; + confirmFilter={this.handleFilter}/> + ); } if (column.sorter) { let isSortColumn = this.isSortColumn(column); @@ -397,26 +403,30 @@ let AntTable = React.createClass({ } } - sortButton =
- - - - - - -
; + sortButton = ( +
+ + + + + + +
+ ); } - column.title =
- {column.title} - {sortButton} - {filterDropdown} -
; + column.title = ( +
+ {column.title} + {sortButton} + {filterDropdown} +
+ ); return column; }); }, @@ -475,7 +485,8 @@ let AntTable = React.createClass({ getCurrentPageData(dataSource) { let data = this.getLocalData(dataSource); - let current, pageSize; + let current; + let pageSize; let state = this.state; // 如果没有分页的话,默认全部展示 if (!this.hasPagination()) { @@ -546,20 +557,24 @@ let AntTable = React.createClass({ let emptyText; let emptyClass = ''; if (!data || data.length === 0) { - emptyText =
- {locale.emptyText} -
; + emptyText = ( +
+ {locale.emptyText} +
+ ); emptyClass = ' ant-table-empty'; } - let table =
- - {emptyText} - ; + let table = ( +
+
+ {emptyText} + + ); if (this.props.loading) { // if there is no pagination or no data, the height of spin should decrease by half of pagination let paginationPatchClass = (this.hasPagination() && data && data.length !== 0) diff --git a/components/tabs/index.jsx b/components/tabs/index.jsx index bbd93930c666d370088be2efcb0a5717709a5ff8..66eeccba838f5afd3bb8ee1b42f34022674306be 100644 --- a/components/tabs/index.jsx +++ b/components/tabs/index.jsx @@ -51,20 +51,28 @@ class AntTabs extends React.Component { }); } // Add new tab handler - tabBarExtraContent = - - {tabBarExtraContent} - ; + tabBarExtraContent = ( + + + {tabBarExtraContent} + + ); } // Wrap the extra content - tabBarExtraContent =
- {tabBarExtraContent} -
; - return {children}; + tabBarExtraContent = ( +
+ {tabBarExtraContent} +
+ ); + return ( + + {children} + + ); } } diff --git a/components/timeline/index.jsx b/components/timeline/index.jsx index 9784873638691b7cef706a2dd2c4c253f1320a0f..b6886d55c05fcebf0d1ab90dd2f22d23617a6c65 100644 --- a/components/timeline/index.jsx +++ b/components/timeline/index.jsx @@ -42,7 +42,7 @@ Timeline.Item = React.createClass({ return (
  • -
    +
    {props.children}
    {last} diff --git a/components/transfer/index.jsx b/components/transfer/index.jsx index 9e7bae431b4192ef51e5f0b4b1b75ed9f973cddf..96315ef449c44638065c165a77ee1dd2485810cf 100644 --- a/components/transfer/index.jsx +++ b/components/transfer/index.jsx @@ -29,7 +29,7 @@ class Transfer extends Component { if ( targetKeys.length > 0 ) { targetKeys.forEach((targetKey) => { rightDataSource.push(leftDataSource.find((data, index) => { - if( data.key === targetKey ) { + if ( data.key === targetKey ) { leftDataSource.splice(index, 1); return true; } @@ -53,7 +53,7 @@ class Transfer extends Component { // empty checked keys this.setState({ - [direction === 'right' ? 'leftCheckedKeys' : 'rightCheckedKeys']: [], + [ direction === 'right' ? 'leftCheckedKeys' : 'rightCheckedKeys' ]: [], }); this.props.onChange(newTargetKeys); @@ -162,52 +162,51 @@ class Transfer extends Component { prefixCls: true, }); - return
    - - - -
    ; + return ( +
    + + + +
    + ); } } diff --git a/components/transfer/list.jsx b/components/transfer/list.jsx index 35902dab09cf0f36df1e22208f4823338b466015..1910c1fe2a2b9242c4504c90c3e6fc7c417563eb 100644 --- a/components/transfer/list.jsx +++ b/components/transfer/list.jsx @@ -54,11 +54,13 @@ class TransferList extends Component { if (typeof props.checkable !== 'boolean') { customEle = props.checkable; } - return - {customEle} - ; + return ( + + {customEle} + + ); } matchFilter(text, filterText) { @@ -78,48 +80,50 @@ class TransferList extends Component { [prefixCls + '-with-footer']: !!footerDom, }); - return
    -
    - {this.renderCheckbox({ - prefixCls: 'ant-transfer', - checked: checkStatus === 'all', - checkPart: checkStatus === 'part', - checkable: - })}{(checkedKeys.length > 0 ? checkedKeys.length + '/' : '') + dataSource.length} 条 - {titleText} -
    - { bodyDom ? bodyDom : -
    - { showSearch ?
    - + return ( +
    +
    + {this.renderCheckbox({ + prefixCls: 'ant-transfer', + checked: checkStatus === 'all', + checkPart: checkStatus === 'part', + checkable: + })}{(checkedKeys.length > 0 ? checkedKeys.length + '/' : '') + dataSource.length} 条 + {titleText} +
    + { bodyDom ? bodyDom : +
    + { showSearch ?
    + +
    : null } + + {dataSource.length > 0 ? + dataSource.map((item) => { + // apply filter + const itemText = this.props.render(item); + const filterResult = this.matchFilter(itemText, filter); + + const renderedText = this.props.render(item); + + if (filterResult) { + return ( +
  • + key === item.key)} /> + {renderedText} +
  • + ); + } + }) :
    Not Found
    + } + + } + { footerDom ?
    + { footerDom }
    : null } - - {dataSource.length > 0 ? - dataSource.map((item) => { - // apply filter - const itemText = this.props.render(item); - const filterResult = this.matchFilter(itemText, filter); - - const renderedText = this.props.render(item); - - if (filterResult) { - return ( -
  • - key === item.key)} /> - {renderedText} -
  • - ); - } - }) :
    Not Found
    - } -
    - } - { footerDom ?
    - { footerDom } -
    : null } - ; + + ); } } @@ -132,7 +136,7 @@ TransferList.defaultProps = { handleSelect: noop, handleSelectAll: noop, render: noop, - //advanced + // advanced body: noop, footer: noop, }; diff --git a/components/transfer/operation.jsx b/components/transfer/operation.jsx index 33f6b13b37acf9779f8f32d2f42ea61d07759594..5a482c125865193fefe84fb70744f68c69cfb595 100644 --- a/components/transfer/operation.jsx +++ b/components/transfer/operation.jsx @@ -27,10 +27,12 @@ class TransferOperation extends Component { {{rightArrowText}} ); - return
    - {moveToLeftButton} - {moveToRightButton} -
    ; + return ( +
    + {moveToLeftButton} + {moveToRightButton} +
    + ); } } diff --git a/components/transfer/search.jsx b/components/transfer/search.jsx index f872da6c506a9bf79c186ce478f84aabd245fb56..faecda0204fc8d00435d1a7ca736ff2ec6b1f880 100644 --- a/components/transfer/search.jsx +++ b/components/transfer/search.jsx @@ -14,16 +14,18 @@ class Search extends Component { render() { const {placeholder, value, prefixCls} = this.props; - return
    - - { value && value.length > 0 ? - - - - : - } -
    ; + return ( +
    + + { value && value.length > 0 ? + + + + : + } +
    + ); } } diff --git a/components/tree/index.jsx b/components/tree/index.jsx index 04f89cb48f7d96570b88bf11e3ab6e65b252269b..eea4b1e63a876bdd0d55c4cc975253da38229bf7 100644 --- a/components/tree/index.jsx +++ b/components/tree/index.jsx @@ -17,9 +17,11 @@ const AntTree = React.createClass({ if (checkable) { checkable = ; } - return - {this.props.children} - ; + return ( + + {this.props.children} + + ); } }); diff --git a/components/upload/getFileItem.js b/components/upload/getFileItem.js index 660b02e72bfe75bb14692c316a33be5919355e55..db224b13d157c2642a0cd5ad14c66077bf826bf9 100644 --- a/components/upload/getFileItem.js +++ b/components/upload/getFileItem.js @@ -3,9 +3,8 @@ export default function getFileItem(file, fileList) { let target = fileList.filter((item) => { if (matchWay === 'byName') { return item.name === file.name; - } else { - return item.uid === file.uid; } + return item.uid === file.uid; })[0]; return target; } diff --git a/components/upload/index.jsx b/components/upload/index.jsx index ee3d0eeffc725160afb30754b49c488deb6c8f3e..ccf140f2a38908ef45993484d600475d8772407f 100644 --- a/components/upload/index.jsx +++ b/components/upload/index.jsx @@ -37,15 +37,16 @@ function genPercentAdd() { let k = 0.1; const i = 0.01; const end = 0.98; - return function(start) { + return function(s) { + let start = s; if (start >= end) { return start; - } else { - start += k; - k = k - i; - if (k < 0.001) { - k = 0.001; - } + } + + start += k; + k = k - i; + if (k < 0.001) { + k = 0.001; } return start * 100; }; @@ -65,9 +66,9 @@ const AntUpload = React.createClass({ let nextFileList = this.state.fileList.concat(); if (file.length > 0) { targetItem = file.map(function(f) { - f = fileToObject(f); - f.status = 'uploading'; - return f; + const fileObject = fileToObject(f); + fileObject.status = 'uploading'; + return fileObject; }); nextFileList = nextFileList.concat(targetItem); } else { diff --git a/components/upload/uploadList.jsx b/components/upload/uploadList.jsx index e076fd4981c1c606db29f2aa56d8d721d80d21f2..f4d7d6c848ba894adc5c5fc492c5d4eef9288e19 100644 --- a/components/upload/uploadList.jsx +++ b/components/upload/uploadList.jsx @@ -60,9 +60,11 @@ export default React.createClass({ target="_blank">{file.name}; } if (file.status === 'uploading') { - progress =
    - -
    ; + progress = ( +
    + +
    + ); } const infoUploadingClass = classNames({ [`${prefixCls}-list-item`]: true, @@ -83,10 +85,12 @@ export default React.createClass({ [`${prefixCls}-list`]: true, [`${prefixCls}-list-${this.props.listType}`]: true, }); - return
    - - {list} - -
    ; + return ( +
    + + {list} + +
    + ); } });