Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] add tslint type check test #1560

Closed
wants to merge 10 commits into from
23 changes: 22 additions & 1 deletion CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ timeline: true

---



### 2.0.0

`2017-xx-xx`

## New Feature


## Break Change

- `pagination` 组件 `current` 属性改成从 `1` 开始索引 ([#1009](https://github.com/ant-design/ant-design-mobile/issues/1009))
- `Slider` 去除默认的 margin & padding. ([5c9744a](https://github.com/ant-design/ant-design-mobile/commit/5c9744aa8025a8fdfe4ec8f5bca5e108245f7bcd))
- `ImagePicker` ref 由 string 改成 function. ([#1487](https://github.com/ant-design/ant-design-mobile/pull/1487)
- In order to custom style conveniently, the `style` property of `TextareaItem`、`SearchBar` and `InputItem` is passed
to `input`(for web) or `TextInput`(for react native) element;
- Progress: `wrapStyle` has been replaced by `style` and `style` has been replaced by `barStyle` property.
- The `style` property now can custom style, eg: tintColor for switch
- `Flex` remove redundancy api of Flex, just keep `align: enum{start, center, end}`。[#1532](https://github.com/ant-design/ant-design-mobile/issues/1532)

## 1.4.2

`2017-07-12`
Expand All @@ -26,7 +46,6 @@ timeline: true
- **Improve && Enhancement**
- 升级 Slider 依赖的 rc-slider 版本。
- 部分组件文档国际化完善,增加部分组件测试用例。


## 1.4.1

Expand All @@ -48,6 +67,7 @@ timeline: true
- 去除 object-assign 依赖,改为使用 es6 展开操作符 ([67e0ee6](https://github.com/ant-design/ant-design-mobile/commit/67e0ee6a985d1e143f3dbbf63988d01a05d67b59))
- 网站信息结构优化,并增加拷贝代码按钮 ([#1481](https://github.com/ant-design/ant-design-mobile/issues/1481))


## 1.4.0

`2017-06-24`
Expand Down Expand Up @@ -241,6 +261,7 @@ timeline: true

## 1.0.7


`2017-03-24`

- **Feature**
Expand Down
21 changes: 20 additions & 1 deletion CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ timeline: true

---



### 2.0.0

`2017-xx-xx`

## New Feature


## Break Change

- `pagination` 组件 `current` 属性改成从 `1` 开始索引 ([#1009](https://github.com/ant-design/ant-design-mobile/issues/1009))
- `Slider` 去除默认的 margin & padding. ([5c9744a](https://github.com/ant-design/ant-design-mobile/commit/5c9744aa8025a8fdfe4ec8f5bca5e108245f7bcd))
- `ImagePicker` ref 由 string 改成 function. ([#1487](https://github.com/ant-design/ant-design-mobile/pull/1487)
- TextareaItem、SearchBar、InputItem 将 `style` 属性传至 input(web) / TextInput(rn) 元素,方便自定义样式;
- Progress: `wrapStyle` 改为 `style`, 原来的 `style` 将改成 `barStyle`;
- Switch 对 `style` 属性直接针对 switch 样式自身,方便定义样式;
- `Flex` 清理冗余API, 只保留 `align: enum{start, center, end}`。 [#1532](https://github.com/ant-design/ant-design-mobile/issues/1532)

## 1.4.2

`2017-07-12`
Expand All @@ -26,7 +45,6 @@ timeline: true
- **Improve && Enhancement**
- 升级 Slider 依赖的 rc-slider 版本。
- 部分组件文档国际化完善,增加部分组件测试用例。


## 1.4.1

Expand Down Expand Up @@ -262,6 +280,7 @@ timeline: true

## 1.0.6


`2017-03-17`

- **Feature**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ exports[`renders ./components/button/demo/basic.md correctly 1`] = `
inline / small
</p>
<div
class="am-flexbox am-flexbox-align-middle"
class="am-flexbox am-flexbox-align-center"
style="margin-bottom:0.16rem;"
>
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ exports[`renders ./components/checkbox/demo/basic.md correctly 1`] = `
</div>
</div>
<div
class="am-flexbox am-flexbox-align-middle"
class="am-flexbox am-flexbox-align-center"
>
<div
class="am-flexbox-item"
Expand Down
6 changes: 3 additions & 3 deletions components/flex/Flex.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export default class Flex extends React.Component<FlexProps, any> {
[`${prefixCls}-justify-between`]: justify === 'between',
[`${prefixCls}-justify-around`]: justify === 'around',

[`${prefixCls}-align-top`]: align === 'top' || align === 'start',
[`${prefixCls}-align-middle`]: align === 'middle' || align === 'center',
[`${prefixCls}-align-bottom`]: align === 'bottom' || align === 'end',
[`${prefixCls}-align-start`]: align === 'start',
[`${prefixCls}-align-center`]: align === 'center',
[`${prefixCls}-align-end`]: align === 'end',
[`${prefixCls}-align-baseline`]: align === 'baseline',
[`${prefixCls}-align-stretch`]: align === 'stretch',

Expand Down
18 changes: 9 additions & 9 deletions components/flex/__tests__/__snapshots__/demo.test.web.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
基本
</div>
<div
class="am-flexbox am-flexbox-align-middle"
class="am-flexbox am-flexbox-align-center"
>
<div
class="am-flexbox-item"
Expand All @@ -35,7 +35,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
class="am-whitespace am-whitespace-lg"
/>
<div
class="am-flexbox am-flexbox-align-middle"
class="am-flexbox am-flexbox-align-center"
>
<div
class="am-flexbox-item"
Expand Down Expand Up @@ -69,7 +69,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
class="am-whitespace am-whitespace-lg"
/>
<div
class="am-flexbox am-flexbox-align-middle"
class="am-flexbox am-flexbox-align-center"
>
<div
class="am-flexbox-item"
Expand Down Expand Up @@ -117,7 +117,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
wrap 换行
</div>
<div
class="am-flexbox am-flexbox-wrap am-flexbox-align-middle"
class="am-flexbox am-flexbox-wrap am-flexbox-align-center"
>
<div
class="inline"
Expand Down Expand Up @@ -171,7 +171,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
轴对齐方式
</div>
<div
class="am-flexbox am-flexbox-justify-center am-flexbox-align-middle"
class="am-flexbox am-flexbox-justify-center am-flexbox-align-center"
>
<div
class="inline"
Expand All @@ -196,7 +196,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
class="am-whitespace am-whitespace-md"
/>
<div
class="am-flexbox am-flexbox-justify-end am-flexbox-align-middle"
class="am-flexbox am-flexbox-justify-end am-flexbox-align-center"
>
<div
class="inline"
Expand All @@ -221,7 +221,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
class="am-whitespace am-whitespace-md"
/>
<div
class="am-flexbox am-flexbox-justify-between am-flexbox-align-middle"
class="am-flexbox am-flexbox-justify-between am-flexbox-align-center"
>
<div
class="inline"
Expand All @@ -246,7 +246,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
class="am-whitespace am-whitespace-md"
/>
<div
class="am-flexbox am-flexbox-align-top"
class="am-flexbox am-flexbox-align-start"
>
<div
class="inline"
Expand All @@ -271,7 +271,7 @@ exports[`renders ./components/flex/demo/basic.md correctly 1`] = `
class="am-whitespace am-whitespace-md"
/>
<div
class="am-flexbox am-flexbox-align-bottom"
class="am-flexbox am-flexbox-align-end"
>
<div
class="inline"
Expand Down
6 changes: 3 additions & 3 deletions components/flex/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
justify-content: space-around;
}

&&-align-top {
&&-align-start {
align-items: flex-start;
}

&&-align-bottom {
&&-align-end {
align-items: flex-end;
}

&&-align-middle {
&&-align-center {
align-items: center;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`renders ./components/image-picker/demo/basic.md correctly 1`] = `
class="am-wingblank am-wingblank-md"
>
<div
class="am-flexbox am-flexbox-align-middle"
class="am-flexbox am-flexbox-align-center"
>
<div
class="am-flexbox-item"
Expand Down Expand Up @@ -90,7 +90,7 @@ exports[`renders ./components/image-picker/demo/custom.md correctly 1`] = `
class="am-wingblank am-wingblank-md"
>
<div
class="am-flexbox am-flexbox-align-middle"
class="am-flexbox am-flexbox-align-center"
>
<div
class="am-flexbox-item"
Expand Down
8 changes: 5 additions & 3 deletions components/image-picker/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default class ImagePicker extends React.Component<ImagePickerPropTypes, a
selectable: true,
};

fileSelectorInput: any;

// http://stackoverflow.com/questions/7584794/accessing-jpeg-exif-rotation-data-in-javascript-on-the-client-side
getOrientation = (file, callback) => {
const reader = new FileReader();
Expand Down Expand Up @@ -103,8 +105,8 @@ export default class ImagePicker extends React.Component<ImagePickerPropTypes, a
}

onFileChange = () => {
const fileSelectorEl = (this.refs as any).fileSelectorInput;
if (fileSelectorEl.files && fileSelectorEl.files.length) {
const fileSelectorEl = this.fileSelectorInput;
if (fileSelectorEl && fileSelectorEl.files && fileSelectorEl.files.length) {
const file = fileSelectorEl.files[0];
const reader = new FileReader();
reader.onload = (e) => {
Expand Down Expand Up @@ -179,7 +181,7 @@ export default class ImagePicker extends React.Component<ImagePickerPropTypes, a
aria-label="Choose and add image"
>
<input
ref="fileSelectorInput"
ref={(input) => { this.fileSelectorInput = input; }}
type="file"
accept="image/jpg,image/jpeg,image/png,image/gif"
onChange={() => { this.onFileChange(); }}
Expand Down
3 changes: 2 additions & 1 deletion components/input-item/CustomInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class NumberInput extends React.Component<any, any> {
}

render() {
const { placeholder, value, keyboardPrefixCls, disabled, editable, confirmLabel } = this.props;
const { placeholder, value, keyboardPrefixCls, disabled, editable, confirmLabel, style } = this.props;
const { focused } = this.state;
const preventKeyboard = disabled || !editable;
const fakeInputCls = classNames({
Expand All @@ -119,6 +119,7 @@ class NumberInput extends React.Component<any, any> {
<div
className={fakeInputCls}
ref="input-container"
style={style}
onClick={preventKeyboard ? () => {} : this.onFakeInputClick}
>
{value}
Expand Down
4 changes: 3 additions & 1 deletion components/input-item/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class InputItem extends React.Component<InputItemProps, any> {
}

return (
<div className={wrapCls} style={style}>
<div className={wrapCls}>
{children ? (<div className={labelCls}>{children}</div>) : null}
<div className={controlCls}>
{type === 'money' ? (
Expand All @@ -251,6 +251,7 @@ class InputItem extends React.Component<InputItemProps, any> {
{...(this.props.focused !== undefined ? { focused: this.props.focused } : {})}
{...(this.props.autoFocus !== undefined ? { autoFocus: this.props.autoFocus } : {})}
prefixCls={prefixCls}
style={style}
confirmLabel={confirmLabel}
/>
) : (
Expand All @@ -259,6 +260,7 @@ class InputItem extends React.Component<InputItemProps, any> {
{...otherProps}
{...valueProps}
{...classNameProps}
style={style}
type={inputType}
maxLength={maxLength}
name={name}
Expand Down
8 changes: 4 additions & 4 deletions components/list/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* tslint:disable:jsx-no-multiline-js */
import React from 'react';
import { Image, View, TouchableHighlight, Text } from 'react-native';
import { ListItemProps, BriefProps } from './PropsType';
import { ListItemNativeProps, BriefNativeProps } from './PropsType';
import listItemStyles from './style/index';
import listStyles from './style/index';

export class Brief extends React.Component<BriefProps, any> {
export class Brief extends React.Component<BriefNativeProps, any> {
render() {
const { children, style, styles = listStyles, wrap } = this.props;

Expand All @@ -24,8 +24,8 @@ export class Brief extends React.Component<BriefProps, any> {
}
}

export default class Item extends React.Component<ListItemProps, any> {
static defaultProps: Partial<ListItemProps> = {
export default class Item extends React.Component<ListItemNativeProps, any> {
static defaultProps: Partial<ListItemNativeProps> = {
multipleLine: false,
wrap: false,
styles: listItemStyles,
Expand Down
10 changes: 5 additions & 5 deletions components/list/ListItem.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
import React from 'react';
import classNames from 'classnames';
import Touchable from 'rc-touchable';
import { ListItemProps, BriefProps } from './PropsType';
import { ListItemWebProps, BriefWebProps } from './PropsType';
import omit from 'omit.js';

export class Brief extends React.Component<BriefProps, any> {
export class Brief extends React.Component<BriefWebProps, any> {
render() {
return (
<div className="am-list-brief" style={this.props.style}>{this.props.children}</div>
);
}
}

class ListItem extends React.Component<ListItemProps, any> {
static defaultProps: Partial<ListItemProps> = {
class ListItem extends React.Component<ListItemWebProps, any> {
static defaultProps: Partial<ListItemWebProps> = {
prefixCls: 'am-list',
align: 'middle',
error: false,
multipleLine: false,
wrap: false,
// wrap: false,
platform: 'cross',
};

Expand Down
Loading