diff --git a/.stylelintrc b/.stylelintrc index 74e6c9149c..0ceab4333f 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -3,6 +3,7 @@ "rules": { at-rule-empty-line-before: null, at-rule-name-space-after: null, + at-rule-no-unknown: null, comment-empty-line-before: null, declaration-bang-space-before: null, declaration-empty-line-before: null, diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 81b9982054..057aa62302 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -18,12 +18,12 @@ timeline: true `2017-07-22` -- **Feature* +- **Feature** - `ListItem` 支持 `onLongPress`. ([#1533](https://github.com/ant-design/ant-design-mobile/pull/1533)) - **Bug Fix** - 修复 `Tabs` 滑动浮层覆盖 `Popup` 蒙版的问题。([#1512](https://github.com/ant-design/ant-design-mobile/pull/1512)) - - 修复 `Switch` 在 android 上 0.5px 导致显示不正常的问题。((86dabf)[https://github.com/ant-design/ant-design-mobile/commit/86dabfea9841695fbca5319b422f11a0ddb17184]) + - 修复 `Switch` 在 android 上 0.5px 导致显示不正常的问题。([86dabf](https://github.com/ant-design/ant-design-mobile/commit/86dabfea9841695fbca5319b422f11a0ddb17184)) - 修复 React Native `Modal.prompt` 键盘遮挡的问题。([#1489](https://github.com/ant-design/ant-design-mobile/issues/1489)) - **Improve && Enhancement** diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 14c5019e08..ad81da3cd3 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -18,12 +18,12 @@ timeline: true `2017-07-22` -- **Feature* +- **Feature** - `ListItem` 支持 `onLongPress`. ([#1533](https://github.com/ant-design/ant-design-mobile/pull/1533)) - **Bug Fix** - 修复 `Tabs` 滑动浮层覆盖 `Popup` 蒙版的问题。([#1512](https://github.com/ant-design/ant-design-mobile/pull/1512)) - - 修复 `Switch` 在 android 上 0.5px 导致显示不正常的问题。((86dabf)[https://github.com/ant-design/ant-design-mobile/commit/86dabfea9841695fbca5319b422f11a0ddb17184]) + - 修复 `Switch` 在 android 上 0.5px 导致显示不正常的问题。([86dabf](https://github.com/ant-design/ant-design-mobile/commit/86dabfea9841695fbca5319b422f11a0ddb17184)) - 修复 React Native `Modal.prompt` 键盘遮挡的问题。([#1489](https://github.com/ant-design/ant-design-mobile/issues/1489)) - **Improve && Enhancement** diff --git a/components/card/demo/basic.md b/components/card/demo/basic.md index 517f58717a..5eed898b7e 100644 --- a/components/card/demo/basic.md +++ b/components/card/demo/basic.md @@ -32,5 +32,5 @@ ReactDOM.render( -, mountNode); + , mountNode); ```` diff --git a/components/card/demo/full.md b/components/card/demo/full.md index 51a5198458..922831e04d 100644 --- a/components/card/demo/full.md +++ b/components/card/demo/full.md @@ -32,5 +32,5 @@ ReactDOM.render( extra footer content} /> -, mountNode); + , mountNode); ```` diff --git a/components/input-item/demo/basic.md b/components/input-item/demo/basic.md index 2d84ffe3bb..72f999e417 100644 --- a/components/input-item/demo/basic.md +++ b/components/input-item/demo/basic.md @@ -53,8 +53,8 @@ class BasicInputExample extends React.Component { }); }} > - click to focus - + click to focus + 'Whether is controlled'}> diff --git a/components/menu/demo/basic.md b/components/menu/demo/basic.md index cd3fc71dcb..8c0ef4dd39 100644 --- a/components/menu/demo/basic.md +++ b/components/menu/demo/basic.md @@ -128,7 +128,7 @@ class MenuExample extends React.Component { onChange={this.onChange} height={document.documentElement.clientHeight * 0.6} /> - ); + ); const loadingEl = (
diff --git a/components/nav-bar/demo/basic.md b/components/nav-bar/demo/basic.md index 729f5e1380..86416abc27 100644 --- a/components/nav-bar/demo/basic.md +++ b/components/nav-bar/demo/basic.md @@ -27,5 +27,5 @@ ReactDOM.render( ]} >NavBar
-, mountNode); + , mountNode); ```` diff --git a/components/popup/demo/basic-up.md b/components/popup/demo/basic-up.md index 1c5cb487c4..5dee4a84ac 100644 --- a/components/popup/demo/basic-up.md +++ b/components/popup/demo/basic-up.md @@ -26,20 +26,22 @@ class Test extends React.Component { state = { sel: '', }; + renderHeader = () => ( +
+ 委托买入 + this.onClose('cancel')} + > + + +
+ ); onClick = () => { Popup.show(
- ( -
- 委托买入 - this.onClose('cancel')} - > - - -
)} + {['股票名称', '股票代码', '买入价格', '买入数量', '更多', '更多'].map((i, index) => ( diff --git a/components/slider/demo/icon-slider.md b/components/slider/demo/icon-slider.md index e2a397a8d0..296dd5d63e 100644 --- a/components/slider/demo/icon-slider.md +++ b/components/slider/demo/icon-slider.md @@ -53,7 +53,7 @@ class IconSlider extends React.Component { ReactDOM.render( -, mountNode); + , mountNode); ```` ````css diff --git a/components/stepper/demo/basic.md b/components/stepper/demo/basic.md index 81dbb3c08b..a014e57eb8 100644 --- a/components/stepper/demo/basic.md +++ b/components/stepper/demo/basic.md @@ -27,30 +27,32 @@ class Demo extends React.Component { render() { return ( 'Demos'}> - } + } > Show number value(Use TouchEvent for mobile by default) - } + } > Show number value(Use MouseEvent for PC) diff --git a/components/steps/demo/basic.md b/components/steps/demo/basic.md index 9317bc173f..7f0471d14a 100644 --- a/components/steps/demo/basic.md +++ b/components/steps/demo/basic.md @@ -61,7 +61,7 @@ ReactDOM.render( } /> -, mountNode); + , mountNode); ```` ````css diff --git a/components/steps/demo/horizontal.md b/components/steps/demo/horizontal.md index ed4833d0d4..8b7d185e01 100644 --- a/components/steps/demo/horizontal.md +++ b/components/steps/demo/horizontal.md @@ -45,7 +45,7 @@ ReactDOM.render( } /> -, mountNode); + , mountNode); ```` ````css diff --git a/components/tab-bar/demo/basic.md b/components/tab-bar/demo/basic.md index f4ac731a81..77d898eeea 100644 --- a/components/tab-bar/demo/basic.md +++ b/components/tab-bar/demo/basic.md @@ -10,10 +10,7 @@ title: ````jsx import { TabBar, Icon } from 'antd-mobile'; -/* eslint global-require: 0 */ - class TabBarExample extends React.Component { - constructor(props) { super(props); this.state = { diff --git a/components/tag/demo/basic.md b/components/tag/demo/basic.md index 9846a7ba51..60fec9775d 100644 --- a/components/tag/demo/basic.md +++ b/components/tag/demo/basic.md @@ -38,8 +38,9 @@ ReactDOM.render( Small and Readonly
-, mountNode); + , mountNode); ```` + ````css .tag-container{ display: flex; diff --git a/package.json b/package.json index d1ae2512dc..b2475e57c7 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "rc-steps": "~2.5.1", "rc-swipeout": "~1.3.0", "rc-table": "~5.4.0", - "rc-tabs": "~8.0.0", + "rc-tabs": "~8.1.0", "rc-tooltip": "~3.4.3", "rc-touchable": "~1.2.2", "react-native-camera-roll-picker": "~1.1.6", @@ -72,7 +72,7 @@ "antd-demo-jest": "^1.3.1", "antd-mobile-demo-data": "^0.1.1", "antd-tools": "^1.6.0", - "babel-eslint": "^7.1.0", + "babel-eslint": "^7.2.3", "babel-jest": "^20.0.3", "babel-plugin-import": "^1.2.1", "babel-plugin-transform-runtime": "^6.23.0", @@ -88,19 +88,19 @@ "enquire.js": "^2.1.1", "enzyme": "^2.7.1", "enzyme-to-json": "^1.5.0", - "eslint": "^3.0.0", + "eslint": "^4.3.0", "eslint-config-airbnb": "latest", - "eslint-plugin-babel": "^4.0.0", - "eslint-plugin-import": "^2.2.0", - "eslint-plugin-jsx-a11y": "^5.0.1", + "eslint-plugin-babel": "^4.1.1", + "eslint-plugin-import": "^2.7.0", + "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-markdown": "~1.0.0-beta.6", - "eslint-plugin-react": "^7.0.1", - "eslint-tinker": "^0.4.0", + "eslint-plugin-react": "^7.1.0", + "eslint-tinker": "^0.4.1", "glob": "^7.1.1", "jest": "^20.0.4", "jsonml.js": "^0.1.0", - "lesshint": "^3.1.1", - "lint-staged": "^3.3.1", + "lesshint": "^4.0.2", + "lint-staged": "^4.0.2", "lodash.debounce": "^4.0.6", "mockdate": "^2.0.1", "postcss-pxtorem": "^3.3.1", @@ -118,8 +118,8 @@ "react-native-mock": "^0.3.1", "react-navigation": "^1.0.0-beta.11", "react-test-renderer": "^15.4.2", - "stylelint": "^7.12.0", - "stylelint-config-standard": "^16.0.0", + "stylelint": "^8.0.0", + "stylelint-config-standard": "^17.0.0", "svg-sprite-loader": "^0.3.1", "typescript": "~2.4.0", "typescript-babel-jest": "^1.0.1", diff --git a/rn-kitchen-sink/components/Home.js b/rn-kitchen-sink/components/Home.js index 33b5416015..750633dd02 100644 --- a/rn-kitchen-sink/components/Home.js +++ b/rn-kitchen-sink/components/Home.js @@ -86,33 +86,33 @@ class Home extends React.Component { }); const appVersion = AppInfo.getInfoShortVersion(); fetch('https://raw.githubusercontent.com/ant-design/ant-design-mobile/master/rn-kitchen-sink/appInfo.json') - .then(response => response.json()) - .then((responseJson) => { - const os = Platform.OS; - if (responseJson[os]) { - const newestVersion = responseJson[os].appversion; - const appUrl = responseJson[os].appurl; - if (appVersion.localeCompare(newestVersion) < 0) { - this.setState({ - animating: false, - }); - Alert.alert( - '', - '检测到 APP 有新版本,是否前往下载', - [ - { text: '取消', style: 'cancel' }, - { text: '下载', onPress: () => Linking.openURL(appUrl) }, - ], - ); + .then(response => response.json()) + .then((responseJson) => { + const os = Platform.OS; + if (responseJson[os]) { + const newestVersion = responseJson[os].appversion; + const appUrl = responseJson[os].appurl; + if (appVersion.localeCompare(newestVersion) < 0) { + this.setState({ + animating: false, + }); + Alert.alert( + '', + '检测到 APP 有新版本,是否前往下载', + [ + { text: '取消', style: 'cancel' }, + { text: '下载', onPress: () => Linking.openURL(appUrl) }, + ], + ); + } else { + this.updateDemo(); + } } else { this.updateDemo(); } - } else { + }).catch(() => { this.updateDemo(); - } - }).catch(() => { - this.updateDemo(); - }); + }); } updateDemo() { diff --git a/rn-kitchen-sink/components/RnIndex.js b/rn-kitchen-sink/components/RnIndex.js index d89b44c47f..f1b98c4ce6 100644 --- a/rn-kitchen-sink/components/RnIndex.js +++ b/rn-kitchen-sink/components/RnIndex.js @@ -53,7 +53,18 @@ export default class RnIndex extends React.Component { searchText: text, }); } - + renderItem = el => ( + { + this.onPressRow(el); + }} + arrow="horizontal" + key={el.title} + > + {`${el.title} ${el.description}`} + + ); render() { const { uiViews, uiControls, others, uiBars } = this.state; return ( @@ -61,10 +72,12 @@ export default class RnIndex extends React.Component { { this.search(text); }} /> { - [['UI Views', uiViews], - ['UI Controls', uiControls], - ['Others', others], - ['UI Bars', uiBars]].map((item, i) => ( + [ + ['UI Views', uiViews], + ['UI Controls', uiControls], + ['Others', others], + ['UI Bars', uiBars], + ].map((item, i) => ( item[0]} @@ -72,18 +85,9 @@ export default class RnIndex extends React.Component { marginTop: 0, marginBottom: 0, }} - >{ - item[1].map(el => ( - { - this.onPressRow(el); - }} - arrow="horizontal" - key={el.title} - >{`${el.title} ${el.description}`} - )) - } + > + {item[1].map(el => this.renderItem(el))} +
)) } diff --git a/site/desktop/src/static/footer.less b/site/desktop/src/static/footer.less index a44dc749ec..5ce7aaa1dc 100644 --- a/site/desktop/src/static/footer.less +++ b/site/desktop/src/static/footer.less @@ -1,6 +1,5 @@ footer { clear: both; - // border-top: 1Px solid #eee; font-size: 12Px; background: #fff; position: relative; diff --git a/site/desktop/src/static/page-nav.less b/site/desktop/src/static/page-nav.less index d3d075e501..23a9c3c15f 100644 --- a/site/desktop/src/static/page-nav.less +++ b/site/desktop/src/static/page-nav.less @@ -1,4 +1,4 @@ -@border-color-split : #e9e9e9; // split border inside a component +@border-color-split : #e9e9e9; @text-color-secondary : fade(#000, 43%); @blue-6: #108ee9; @primary-color : @blue-6; diff --git a/site/desktop/src/template/Content/ComponentDoc.jsx b/site/desktop/src/template/Content/ComponentDoc.jsx index eef71c8cf6..02674f8707 100644 --- a/site/desktop/src/template/Content/ComponentDoc.jsx +++ b/site/desktop/src/template/Content/ComponentDoc.jsx @@ -29,8 +29,9 @@ export default class ComponentDoc extends React.Component { getIndex(props) { const linkTo = props.location.hash.replace('#', ''); - const demos = Object.keys(props.demos).map(key => props.demos[key]) - .filter(demoData => !demoData.meta.hidden); + const demos = Object.keys(props.demos) + .map(key => props.demos[key]) + .filter(demoData => !demoData.meta.hidden); const demoSort = demos.sort((a, b) => parseInt(a.meta.order, 10) - parseInt(b.meta.order, 10)); demos.map((item, index) => { @@ -70,8 +71,9 @@ export default class ComponentDoc extends React.Component { const codeExpandList = {}; // const { meta } = this.props.doc; const props = this.props; - const demos = Object.keys(props.demos).map(key => props.demos[key]) - .filter(demoData => !demoData.meta.hidden); + const demos = Object.keys(props.demos) + .map(key => props.demos[key]) + .filter(demoData => !demoData.meta.hidden); this.setState({ expandAll: !this.state.expandAll, @@ -82,8 +84,9 @@ export default class ComponentDoc extends React.Component { initExpandAll = (nextProps) => { const codeExpandList = {}; const props = nextProps || this.props; - const demos = Object.keys(props.demos).map(key => props.demos[key]) - .filter(demoData => !demoData.meta.hidden); + const demos = Object.keys(props.demos) + .map(key => props.demos[key]) + .filter(demoData => !demoData.meta.hidden); this.setState({ expandAll: true, @@ -100,8 +103,9 @@ export default class ComponentDoc extends React.Component { const { doc, location } = props; const { content, meta } = doc; - const demos = Object.keys(props.demos).map(key => props.demos[key]) - .filter(demoData => !demoData.meta.hidden); + const demos = Object.keys(props.demos) + .map(key => props.demos[key]) + .filter(demoData => !demoData.meta.hidden); const expand = this.state.expandAll; const leftChildren = []; @@ -159,9 +163,8 @@ export default class ComponentDoc extends React.Component { { - props.utils.toReactComponent( - ['section', { className: 'markdown' }] - .concat(getChildren(content)), + props.utils.toReactComponent(['section', { className: 'markdown' }] + .concat(getChildren(content)), ) } diff --git a/site/desktop/src/template/Content/Demo.jsx b/site/desktop/src/template/Content/Demo.jsx index ef934a9df4..5ee762ff6c 100644 --- a/site/desktop/src/template/Content/Demo.jsx +++ b/site/desktop/src/template/Content/Demo.jsx @@ -84,22 +84,22 @@ export default class Demo extends React.Component { const lang = this.state.lang; return Array.isArray(highlightedCode) ? (
- + } + visible={this.state.copyTooltipVisible} + onVisibleChange={this.onCopyTooltipVisibleChange} > - } - visible={this.state.copyTooltipVisible} - onVisibleChange={this.onCopyTooltipVisibleChange} + - - - - - + + + + {props.utils.toReactComponent(highlightedCode)}
) : ( @@ -125,7 +125,7 @@ export default class Demo extends React.Component { div.innerHTML = highlightedCode[1].highlighted; this.setState({ sourceCode: div.textContent }); } - /* eslint-enable react/jsx-indent */ + render() { const { props, state } = this; const { diff --git a/site/desktop/src/template/Content/MainContent.jsx b/site/desktop/src/template/Content/MainContent.jsx index dfaa9ad85b..1183414fa2 100644 --- a/site/desktop/src/template/Content/MainContent.jsx +++ b/site/desktop/src/template/Content/MainContent.jsx @@ -174,9 +174,9 @@ export default class MainContent extends React.Component { const localizedPageData = props.localizedPageData; const demos = props.demos; - const DemoEl = demos ? ( - - ) :
; + const DemoEl = demos ? + () : +
; return (
diff --git a/site/desktop/src/template/Content/index.jsx b/site/desktop/src/template/Content/index.jsx index 7049bf6f55..41ea4d7cd2 100644 --- a/site/desktop/src/template/Content/index.jsx +++ b/site/desktop/src/template/Content/index.jsx @@ -10,15 +10,15 @@ export default collect(async (nextProps) => { const pathname = nextProps.location.pathname; const pageDataPath = pathname.replace('-cn', '').split('/'); const pageData = isChangelog(pathname) ? - nextProps.data.changelog.CHANGELOG : - nextProps.utils.get(nextProps.data, pageDataPath); + nextProps.data.changelog.CHANGELOG : + nextProps.utils.get(nextProps.data, pageDataPath); if (!pageData) { throw 404; // eslint-disable-line no-throw-literal } const locale = utils.isZhCN(pathname) ? 'zh-CN' : 'en-US'; const pageDataPromise = typeof pageData === 'function' ? - pageData() : (pageData[locale] || pageData.index[locale] || pageData.index)(); + pageData() : (pageData[locale] || pageData.index[locale] || pageData.index)(); const demosFetcher = nextProps.utils.get(nextProps.data, [...pageDataPath, 'demo']); if (demosFetcher) { const [localizedPageData, demos] = await Promise.all([pageDataPromise, demosFetcher()]); diff --git a/site/kitchen/src/template/KitchenSink/Demo.jsx b/site/kitchen/src/template/KitchenSink/Demo.jsx index 20bcd394bf..99c7948574 100644 --- a/site/kitchen/src/template/KitchenSink/Demo.jsx +++ b/site/kitchen/src/template/KitchenSink/Demo.jsx @@ -98,8 +98,8 @@ export default class Demo extends React.Component { {demoMeta.title} { - !demoMeta.subtitle || locale === 'en-US' ? null : - {demoMeta.subtitle} + (!demoMeta.subtitle || locale === 'en-US') ? + null : {demoMeta.subtitle} }
{ demoContent } diff --git a/site/kitchen/src/template/KitchenSink/index.jsx b/site/kitchen/src/template/KitchenSink/index.jsx index 64ff5595ba..208843e41c 100644 --- a/site/kitchen/src/template/KitchenSink/index.jsx +++ b/site/kitchen/src/template/KitchenSink/index.jsx @@ -84,55 +84,55 @@ export default class App extends React.Component {
{ Object.keys(lists) - .sort((a, b) => sort(config.categoryOrder[a], config.categoryOrder[b])) - .map((cate, index) => (lists[cate].length ? ( - ( -
{ - const { cateOpend } = this.state; - cateOpend[index] = !cateOpend[index]; - this.setState({ cateOpend }); - }} - className="am-demo-category" - > -
{appLocale.locale === 'en-US' ? cate : `${config.cateChinese[cate]} ${cate}`}
-
-
- )} - className={this.state.cateOpend[index] ? 'category-open' : 'category-closed'} - > - { - lists[cate].sort((a, b) => sort(a.title.toLowerCase(), b.title.toLowerCase())).map((item) => { - const paths = item.filename.split('/'); - if (config.indexDemos.indexOf(paths[1]) > -1) { - return item.demos.sort((a, b) => a.order > b.order).map(j => ( + .sort((a, b) => sort(config.categoryOrder[a], config.categoryOrder[b])) + .map((cate, index) => (lists[cate].length ? ( + ( +
{ + const { cateOpend } = this.state; + cateOpend[index] = !cateOpend[index]; + this.setState({ cateOpend }); + }} + className="am-demo-category" + > +
{appLocale.locale === 'en-US' ? cate : `${config.cateChinese[cate]} ${cate}`}
+
+
+ )} + className={this.state.cateOpend[index] ? 'category-open' : 'category-closed'} + > + { + lists[cate].sort((a, b) => sort(a.title.toLowerCase(), b.title.toLowerCase())).map((item) => { + const paths = item.filename.split('/'); + if (config.indexDemos.indexOf(paths[1]) > -1) { + return item.demos.sort((a, b) => a.order > b.order).map(j => ( + location.href = `${rootPath}/${paths[1]}${this.addSearch()}#${ + paths[1] + config.hashSpliter + j.order + }`} + > + {`${item.title} ${appLocale.locale === 'zh-CN' ? item.subtitle : ''}-${j.title[appLocale.locale]}`} + + )); + } + return ( location.href = `${rootPath}/${paths[1]}${this.addSearch()}#${ - paths[1] + config.hashSpliter + j.order - }`} + key={`${item.filename}-${cate}`} + onClick={() => { location.href = `${rootPath}/${paths[1]}${this.addSearch()}`; }} > - {`${item.title} ${appLocale.locale === 'zh-CN' ? item.subtitle : ''}-${j.title[appLocale.locale]}`} + {`${item.title} `} + {!item.subtitle || appLocale.locale === 'en-US' ? null : item.subtitle} - )); - } - return ( - { location.href = `${rootPath}/${paths[1]}${this.addSearch()}`; }} - > - {`${item.title} `} - {!item.subtitle || appLocale.locale === 'en-US' ? null : item.subtitle} - - ); - }) - } -
- ) : null)) + ); + }) + } +
+ ) : null)) }
diff --git a/site/utils.jsx b/site/utils.jsx index b1fab91844..89ad6b33f0 100644 --- a/site/utils.jsx +++ b/site/utils.jsx @@ -66,7 +66,7 @@ export function isLocalStorageNameSupported() { export function collectDocs(docs) { // locale copy from layout const locale = (window.localStorage && localStorage.getItem('locale') !== 'en-US') ? - 'zh-CN' : 'en-US'; + 'zh-CN' : 'en-US'; const docsList = Object.keys(docs) .map(key => docs[key]) .map((value) => {