cr grid & icon & upload

pull/1225/head
tangjinzhou 2019-09-10 21:54:22 +08:00
parent 927a0a6c81
commit 4c58c52b21
11 changed files with 34 additions and 37 deletions

View File

@ -11,7 +11,7 @@ export const ColSize = PropTypes.shape({
pull: stringOrNumber, pull: stringOrNumber,
}).loose; }).loose;
const objectOrNumber = PropTypes.oneOfType([PropTypes.number, ColSize]); const objectOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number, ColSize]);
export const ColProps = { export const ColProps = {
span: stringOrNumber, span: stringOrNumber,

View File

@ -21,9 +21,9 @@ describe('Grid', () => {
return ( return (
<Row gutter={20}> <Row gutter={20}>
<div> <div>
<Col span="12" /> <Col span={12} />
</div> </div>
<Col span="12" /> <Col span={12} />
</Row> </Row>
); );
}, },

View File

@ -57,7 +57,7 @@ exports[`Icon should support pass svg paths as children 1`] = `
</svg></i> </svg></i>
`; `;
exports[`Icon should support svg react component 1`] = ` exports[`Icon should support svg vue component 1`] = `
<i class="my-home-icon anticon"><svg width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""> <i class="my-home-icon anticon"><svg width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class="">
<title>Cool Home</title> <title>Cool Home</title>
<path d="'M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'"></path> <path d="'M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'"></path>

View File

@ -169,7 +169,7 @@ describe('Icon', () => {
}); });
}); });
it('should support svg react component', () => { it('should support svg vue component', () => {
const SvgComponent = { const SvgComponent = {
render() { render() {
return ( return (

View File

@ -6,7 +6,7 @@
| style | Style properties of icon, like `fontSize` and `color` | CSSProperties | - | | style | Style properties of icon, like `fontSize` and `color` | CSSProperties | - |
| theme | Theme of the ant design icon | 'filled' \| 'outlined' \| 'twoTone' | 'outlined' | | theme | Theme of the ant design icon | 'filled' \| 'outlined' \| 'twoTone' | 'outlined' |
| spin | Rotate icon with animation | boolean | false | | spin | Rotate icon with animation | boolean | false |
| rotate | Rotate degrees (added in 1.40.0, not working in IE9) | number | - | | rotate | Rotate degrees (added in 1.4.0, not working in IE9) | number | - |
| component | The component used for the root node. This will override the **`type`** property. | ComponentType<CustomIconComponentProps\> | - | | component | The component used for the root node. This will override the **`type`** property. | ComponentType<CustomIconComponentProps\> | - |
| twoToneColor | Only support the two-tone icon. Specific the primary color. | string (hex color) | - | | twoToneColor | Only support the two-tone icon. Specific the primary color. | string (hex color) | - |

View File

@ -68,10 +68,10 @@ function renderIcon(h, locale, context) {
const innerSvgProps = { const innerSvgProps = {
attrs: { attrs: {
...svgBaseProps, ...svgBaseProps,
style: svgStyle,
viewBox, viewBox,
}, },
class: svgClassString, class: svgClassString,
style: svgStyle,
}; };
if (!viewBox) { if (!viewBox) {
delete innerSvgProps.attrs.viewBox; delete innerSvgProps.attrs.viewBox;
@ -90,6 +90,7 @@ function renderIcon(h, locale, context) {
...svgBaseProps, ...svgBaseProps,
}, },
class: svgClassString, class: svgClassString,
style: svgStyle,
}; };
innerNode = ( innerNode = (
<svg {...innerSvgProps} viewBox={viewBox}> <svg {...innerSvgProps} viewBox={viewBox}>

View File

@ -7,7 +7,7 @@
| style | 设置图标的样式,例如 `fontSize``color` | CSSProperties | - | | style | 设置图标的样式,例如 `fontSize``color` | CSSProperties | - |
| theme | 图标主题风格。可选实心、描线、双色等主题风格,适用于官方图标 | 'filled' \| 'outlined' \| 'twoTone' | 'outlined' | | theme | 图标主题风格。可选实心、描线、双色等主题风格,适用于官方图标 | 'filled' \| 'outlined' \| 'twoTone' | 'outlined' |
| spin | 是否有旋转动画 | boolean | false | | spin | 是否有旋转动画 | boolean | false |
| rotate | 图标旋转角度1.40.0 后新增IE9 无效) | number | - | | rotate | 图标旋转角度1.4.0 后新增IE9 无效) | number | - |
| component | 控制如何渲染图标,通常是一个渲染根标签为 `<svg>``Vue` 组件,**会使 `type` 属性失效** | ComponentType<CustomIconComponentProps\> | - | | component | 控制如何渲染图标,通常是一个渲染根标签为 `<svg>``Vue` 组件,**会使 `type` 属性失效** | ComponentType<CustomIconComponentProps\> | - |
| twoToneColor | 仅适用双色图标。设置双色图标的主要颜色 | string (十六进制颜色) | - | | twoToneColor | 仅适用双色图标。设置双色图标的主要颜色 | string (十六进制颜色) | - |

View File

@ -140,7 +140,7 @@ export default {
this.$emit('reject', fileList); this.$emit('reject', fileList);
}, },
handleRemove(file) { handleRemove(file) {
const { remove } = getOptionProps(this); const { remove } = this;
const { status } = file; const { status } = file;
file.status = 'removed'; // eslint-disable-line file.status = 'removed'; // eslint-disable-line

View File

@ -1,7 +1,5 @@
## API ## API
> You can consult [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload/wiki) about how to implement server side upload interface.
| Property | Description | Type | Default | | Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- | | -------- | ----------- | ---- | ------- |
| accept | File types that can be accepted. See [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string | - | | accept | File types that can be accepted. See [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string | - |
@ -49,7 +47,7 @@ When uploading state change, it returns:
```js ```js
{ {
uid: 'uid', // unique identifiernegative is recommendto prevent interference with internal generated id uid: 'uid', // unique identifier, negative is recommend, to prevent interference with internal generated id
name: 'xx.png' // file name name: 'xx.png' // file name
status: 'done', // optionsuploading, done, error, removed status: 'done', // optionsuploading, done, error, removed
response: '{"status": "success"}', // response from server response: '{"status": "success"}', // response from server

View File

@ -1,7 +1,5 @@
## API ## API
> 服务端上传接口实现可以参考 [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload/wiki)。
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| accept | 接受上传的文件类型, 详见 [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string | 无 | | accept | 接受上传的文件类型, 详见 [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string | 无 |

46
types/grid/col.d.ts vendored
View File

@ -3,76 +3,76 @@
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
type ColSpanType = number | string;
export declare class Col extends AntdComponent { export declare class Col extends AntdComponent {
/** /**
* raster number of cells to occupy, 0 corresponds to display: none * raster number of cells to occupy, 0 corresponds to display: none
* @default none (0) * @default none (0)
* @type number * @type ColSpanType
*/ */
span: number; span: ColSpanType;
/** /**
* raster order, used in flex layout mode * raster order, used in flex layout mode
* @default 0 * @default 0
* @type number * @type ColSpanType
*/ */
order: number; order: ColSpanType;
/** /**
* the number of cells to offset Col from the left * the number of cells to offset Col from the left
* @default 0 * @default 0
* @type number * @type ColSpanType
*/ */
offset: number; offset: ColSpanType;
/** /**
* the number of cells that raster is moved to the right * the number of cells that raster is moved to the right
* @default 0 * @default 0
* @type number * @type ColSpanType
*/ */
push: number; push: ColSpanType;
/** /**
* the number of cells that raster is moved to the left * the number of cells that raster is moved to the left
* @default 0 * @default 0
* @type number * @type ColSpanType
*/ */
pull: number; pull: ColSpanType;
/** /**
* <576px and also default setting, could be a span value or an object containing above props * <576px and also default setting, could be a span value or an object containing above props
* @type { span: number, offset: number } | number * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType
*/ */
xs: { span: number; offset: number } | number; xs: { span: ColSpanType; offset: ColSpanType } | ColSpanType;
/** /**
* 576px, could be a span value or an object containing above props * 576px, could be a span value or an object containing above props
* @type { span: number, offset: number } | number * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType
*/ */
sm: { span: number; offset: number } | number; sm: { span: ColSpanType; offset: ColSpanType } | ColSpanType;
/** /**
* 768px, could be a span value or an object containing above props * 768px, could be a span value or an object containing above props
* @type { span: number, offset: number } | number * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType
*/ */
md: { span: number; offset: number } | number; md: { span: ColSpanType; offset: ColSpanType } | ColSpanType;
/** /**
* 992px, could be a span value or an object containing above props * 992px, could be a span value or an object containing above props
* @type { span: number, offset: number } | number * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType
*/ */
lg: { span: number; offset: number } | number; lg: { span: ColSpanType; offset: ColSpanType } | ColSpanType;
/** /**
* 1200px, could be a span value or an object containing above props * 1200px, could be a span value or an object containing above props
* @type { span: number, offset: number } | number * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType
*/ */
xl: { span: number; offset: number } | number; xl: { span: ColSpanType; offset: ColSpanType } | ColSpanType;
/** /**
* 1600px, could be a span value or an object containing above props * 1600px, could be a span value or an object containing above props
* @type { span: number, offset: number } | number * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType
*/ */
xxl: { span: number; offset: number } | number; xxl: { span: ColSpanType; offset: ColSpanType } | ColSpanType;
} }