diff --git a/.eslintrc.js b/.eslintrc.js index 598b09c13..46bf9e429 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,3 @@ module.exports = { "extends": "react-impression", - rules: { - "import/no-extraneous-dependencies": ["error", {"devDependencies": true, "optionalDependencies": true, "peerDependencies": true}] - }, }; diff --git a/gulpfile.js b/gulpfile.js index 900b9aa8f..5d8e6152a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -95,7 +95,6 @@ gulp.task('edit:package.json', function() { delete json.devDependencies; delete json.dependencies['highlight.js']; - delete json.dependencies['perfect-scrollbar']; delete json.dependencies['react-router']; return json; diff --git a/index.html b/index.html index 2044064d2..82203dd77 100755 --- a/index.html +++ b/index.html @@ -1,4 +1,3 @@ - diff --git a/package.json b/package.json index fd081df2b..4322d9f86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-impression", - "version": "1.2.21", + "version": "1.3.1", "author": "NewDadaFE", "description": "UI Components with React.", "main": "./dist/scripts/index.js", @@ -34,7 +34,7 @@ "perfect-scrollbar": "^0.6.12", "prop-types": "^15.5.10", "react": "^15.4.1", - "react-addons-css-transition-group": "^15.4.1", + "react-addons-css-transition-group": "^15.6.0", "react-dom": "^15.4.1", "react-router": "3.0.5" }, @@ -53,7 +53,8 @@ "babel-preset-react": "^6.5.0", "babel-preset-stage-0": "^6.5.0", "babel-runtime": "^6.11.6", - "eslint-config-react-impression": "^1.1.4", + "eslint-config-react-impression": "^1.2.0", + "eslint-loader": "^1.9.0", "file-loader": "^0.8.5", "gulp": "^3.9.1", "gulp-autoprefixer": "^3.1.1", diff --git a/src/scripts/components/Breadcrumb.js b/src/scripts/components/Breadcrumb.js index 49822f035..74ff62176 100644 --- a/src/scripts/components/Breadcrumb.js +++ b/src/scripts/components/Breadcrumb.js @@ -12,13 +12,13 @@ const WrapBreadcrumb = ({ routes }) => { { routes.map((route, index) => { if(index < length - 1) { return ( - + {route.path === 'app' ? 'home' : route.path} ); } - return {route.path}; + return {route.path}; })} ); diff --git a/src/scripts/components/CommenTable.js b/src/scripts/components/CommenTable.js index 2a8638775..a9e65feae 100644 --- a/src/scripts/components/CommenTable.js +++ b/src/scripts/components/CommenTable.js @@ -4,9 +4,9 @@ import PropTypes from 'prop-types'; * React组件 */ const CommenTable = ({ data }) => { - let rows = data.map((item, index) => { + let rows = data.map(item => { return ( - + {item[0]} {item[1]} {item[2]} diff --git a/src/scripts/components/impression/components/Alert.js b/src/scripts/components/impression/components/Alert.js index 21c6483a4..0a15acacd 100644 --- a/src/scripts/components/impression/components/Alert.js +++ b/src/scripts/components/impression/components/Alert.js @@ -1,6 +1,17 @@ import classnames from 'classnames'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; + +// 获取小图标 +const getAddonByType = type => { + switch(type) { + case 'danger': + return 'fa-exclamation-circle text-danger'; + default: + return 'fa-exclamation-triangle text-warning'; + } +}; + /** * Alert 组件 */ @@ -22,18 +33,9 @@ export default class Alert extends PureComponent { type: 'info', btnText: '确定', } - // 获取小图标 - getAddonByType(type) { - switch(type) { - case 'danger': - return 'fa-exclamation-circle text-danger'; - default: - return 'fa-exclamation-triangle text-warning'; - } - } render() { let { type, btnText, onClick, className, children, ...others } = this.props, - iconTypeClass = this.getAddonByType(type); + iconTypeClass = getAddonByType(type); return(
diff --git a/src/scripts/components/impression/components/ButtonGroup.js b/src/scripts/components/impression/components/ButtonGroup.js index a3b8c4176..de8fde39a 100644 --- a/src/scripts/components/impression/components/ButtonGroup.js +++ b/src/scripts/components/impression/components/ButtonGroup.js @@ -37,15 +37,15 @@ export default class ButtonGroup extends PureComponent { btnGroupSize = size ? `btn-group-${size}` : null; delete others.activeKey; - children = children.map((child, index) => { + children = children.map(child => { let { eventKey, onClick } = child.props; return React.cloneElement(child, { - key: index, + key: child, outline: theme !== 'default' && (!onSelect || activeKey !== eventKey), theme: theme === 'default' && onSelect && activeKey === eventKey ? 'primary' : theme, - onClick: onSelect ? (event) => { + onClick: onSelect ? event => { this.setState({ activeKey: eventKey, }); diff --git a/src/scripts/components/impression/components/Calendar.js b/src/scripts/components/impression/components/Calendar.js index 0db3efb10..0d03b0682 100644 --- a/src/scripts/components/impression/components/Calendar.js +++ b/src/scripts/components/impression/components/Calendar.js @@ -44,8 +44,6 @@ export default class Calendar extends Component { firstDayOfWeek: PropTypes.number, // 周几 weekdays: PropTypes.arrayOf(PropTypes.string), - // 月份 - months: PropTypes.arrayOf(PropTypes.string), // 是否显示工具栏 showToolbar: PropTypes.bool, // 是否显示头部 @@ -65,7 +63,6 @@ export default class Calendar extends Component { showHeader: true, firstDayOfWeek: 1, weekdays: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], - months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], } /** * 获取排序后的星期. @@ -75,9 +72,9 @@ export default class Calendar extends Component { let { firstDayOfWeek, weekdays } = this.props; return firstDayOfWeek === 0 ? - weekdays : - [...weekdays.slice(firstDayOfWeek, weekdays.length), - ...weekdays.slice(0, firstDayOfWeek)]; + weekdays : + [...weekdays.slice(firstDayOfWeek, weekdays.length), + ...weekdays.slice(0, firstDayOfWeek)]; } /** * 前一个月. @@ -220,15 +217,15 @@ export default class Calendar extends Component { }
- { weekdays.map((weekday, index) => -
{weekday}
+ { weekdays.map(weekday => +
{weekday}
)}
{ days.map((day, index) => -
onCellClick && onCellClick({ day: day.text, year: day.date.format(FORMAT.YEAR), @@ -261,7 +258,7 @@ export default class Calendar extends Component { isToday: day.isToday, })}
-
+
) )}
diff --git a/src/scripts/components/impression/components/Checkbox.js b/src/scripts/components/impression/components/Checkbox.js index a055750ac..2273a6964 100644 --- a/src/scripts/components/impression/components/Checkbox.js +++ b/src/scripts/components/impression/components/Checkbox.js @@ -42,15 +42,15 @@ export default class Checkbox extends PureComponent { // 渲染 render() { let { - value, - checked, - defaultChecked, - disabled, - className, - onChange, - children, - ...others - } = this.props; + value, + checked, + defaultChecked, + disabled, + className, + onChange, + children, + ...others + } = this.props; return(