Browse Source

merge master

pull/13776/head
zombiej 6 years ago
parent
commit
b5fc19632b
  1. 2
      .circleci/config.yml
  2. 8
      .remarkrc.js
  3. 28
      components/form/docs/tutorial.md
  4. 4
      components/form/index.en-US.md
  5. 2
      components/form/index.zh-CN.md
  6. 2
      components/layout/index.zh-CN.md
  7. 2
      components/pagination/index.en-US.md
  8. 2
      components/pagination/index.zh-CN.md
  9. 4
      components/slider/index.en-US.md
  10. 4
      components/slider/index.zh-CN.md
  11. 2
      components/table/Table.tsx
  12. 4
      components/table/demo/fixed-columns-header.md
  13. 4
      components/table/demo/fixed-columns.md
  14. 4
      components/table/demo/row-selection.md
  15. 2
      components/table/interface.tsx
  16. 4
      components/transfer/index.en-US.md
  17. 4
      components/transfer/index.zh-CN.md
  18. 4
      components/tree-select/index.en-US.md
  19. 4
      components/tree-select/index.zh-CN.md
  20. 3
      components/upload/style/index.less
  21. 6
      package.json
  22. 19
      site/theme/template/Home/Banner.jsx

2
.circleci/config.yml

@ -84,6 +84,8 @@ jobs:
root: ~/ant-design root: ~/ant-design
paths: paths:
- node_modules - node_modules
- store_artifacts:
path: package-lock.json
dist: dist:
<<: *container_config <<: *container_config

8
.remarkrc.js

@ -0,0 +1,8 @@
const config = {
plugins: [
'remark-preset-lint-recommended',
['remark-lint-list-item-indent', 'space'],
],
};
module.exports = config;

28
components/form/docs/tutorial.md

@ -16,21 +16,21 @@ antd 中的 [Form](https://github.com/ant-design/ant-design/blob/master/componen
建模方面,FieldsStore 实例以 fields 属性存储表单的实时数据,即由用户行为或开发者显式更新的数据。本文把实时数据已存入 fields 中的字段称为已收集字段;反之,称为未收集字段。以下是 fields\[name\] 中成员属性的意义(name 为字段名,下同)。 建模方面,FieldsStore 实例以 fields 属性存储表单的实时数据,即由用户行为或开发者显式更新的数据。本文把实时数据已存入 fields 中的字段称为已收集字段;反之,称为未收集字段。以下是 fields\[name\] 中成员属性的意义(name 为字段名,下同)。
- value 字段的值。 - value 字段的值。
- errors 校验文案,数组形式。 - errors 校验文案,数组形式。
- validating 校验状态。 - validating 校验状态。
- dirty 脏值标识。真值时意味着字段的值已作变更,但未作校验。 - dirty 脏值标识。真值时意味着字段的值已作变更,但未作校验。
- touched 用户行为标识。通常情况下,真值时意味着用户行为已促使字段的值发生了变更。 - touched 用户行为标识。通常情况下,真值时意味着用户行为已促使字段的值发生了变更。
FieldsStore 实例又以 fieldsMeta 属性存储字段的元数据。元数据作为配置项,通常是指定后不再变更的数据,用于操控表单数据转换等行为。元数据通过下文中 getFieldProps, getFieldDecorator 方法的次参 fieldOption 配置。以下是 fieldsMeta\[name\] 中部分成员属性的意义(如不作特殊说明,该成员属性即 fieldOption 中的同名属性)。 FieldsStore 实例又以 fieldsMeta 属性存储字段的元数据。元数据作为配置项,通常是指定后不再变更的数据,用于操控表单数据转换等行为。元数据通过下文中 getFieldProps, getFieldDecorator 方法的次参 fieldOption 配置。以下是 fieldsMeta\[name\] 中部分成员属性的意义(如不作特殊说明,该成员属性即 fieldOption 中的同名属性)。
- validate 校验规则和触发事件,用于约定在何种事件下以何种方式校验字段的值,\[{ rules, trigger }\] 形式。通过fieldOption.validate, fieldOption.rules, fieldOption.validateTrigger 配置。 - validate 校验规则和触发事件,用于约定在何种事件下以何种方式校验字段的值,\[{ rules, trigger }\] 形式。通过fieldOption.validate, fieldOption.rules, fieldOption.validateTrigger 配置。
- hidden 设置为 true 时,validateFields 将不会校验该字段,需要开发者手动校验,并且,getFieldsValue, getFieldsError 等方法也将无法获取该字段的数据及校验信息等实时数据。适用场景如勾选协议复选框,当其已勾选时,提交按钮才可点击,该复选框的值不会出现在全量表单数据中。本文假定配置了 hidden 为 true 的字段为虚拟隐藏项。 - hidden 设置为 true 时,validateFields 将不会校验该字段,需要开发者手动校验,并且,getFieldsValue, getFieldsError 等方法也将无法获取该字段的数据及校验信息等实时数据。适用场景如勾选协议复选框,当其已勾选时,提交按钮才可点击,该复选框的值不会出现在全量表单数据中。本文假定配置了 hidden 为 true 的字段为虚拟隐藏项。
- getValueFromEvent(event) 用于从 event 对象中获取字段的值,适用场景如处理 input, radio 等原生组件。特别的,当字段组件输出的首参不是 event 对象时,getValueFromEvent 将对首参进行数据转化,以满足特定的场景,比如由开发者指定具体首参内容的自定义字段组件。 - getValueFromEvent(event) 用于从 event 对象中获取字段的值,适用场景如处理 input, radio 等原生组件。特别的,当字段组件输出的首参不是 event 对象时,getValueFromEvent 将对首参进行数据转化,以满足特定的场景,比如由开发者指定具体首参内容的自定义字段组件。
- initialValue 字段的初始值。当字段的值未作收集时,初始值用于作为字段的值。 - initialValue 字段的初始值。当字段的值未作收集时,初始值用于作为字段的值。
- valuePropName 约定字段的值以何种 props 属性注入字段组件中,适用场景如将字段的值以 props.checked 属性注入 radio 组件中。注入字段组件的值数据 props 由 getFieldValuePropValue 方法生成,下同。 - valuePropName 约定字段的值以何种 props 属性注入字段组件中,适用场景如将字段的值以 props.checked 属性注入 radio 组件中。注入字段组件的值数据 props 由 getFieldValuePropValue 方法生成,下同。
- getValueProps(value) 用于转化字段的值,输出 props 以注入字段组件中。适用场景如当 get, post 请求的数据结构不同时,且字段组件以 post 请求的数据结构输出字段的值、以 get 请求的数据结构接受字段的值,那就可以使用 getValueProps 将 post 请求的数据结构转换为 get 请求的数据结构。 - getValueProps(value) 用于转化字段的值,输出 props 以注入字段组件中。适用场景如当 get, post 请求的数据结构不同时,且字段组件以 post 请求的数据结构输出字段的值、以 get 请求的数据结构接受字段的值,那就可以使用 getValueProps 将 post 请求的数据结构转换为 get 请求的数据结构。
- normalize(newValue, oldValue, values) 用于转化存入 FieldsStore 实例的字段的值。使用案例如[全选按钮](https://codepen.io/afc163/pen/JJVXzG?editors=001)。 - normalize(newValue, oldValue, values) 用于转化存入 FieldsStore 实例的字段的值。使用案例如[全选按钮](https://codepen.io/afc163/pen/JJVXzG?editors=001)。
在此基础上,FieldsStore 提供了一些便捷的访问器操作。需要说明的是,rc-form 借助 [lodash](https://github.com/lodash/lodash),支持以嵌套结构定义字段名,即使用 '.', '\[|\]' 作为分割符,如 'a.b' 意味着 a 对象下的 b 属性;'c\[0\]' 意味着 c 数组的首项。本文约定匹配字段指,所有以指定字符串起始或等值的字段列表。为此,FieldsStore 提供 isValidNestedFieldName 用于校验字段名不能作为表单中另一个字段名的成员;flattenRegisteredFields 用于传参数据作扁平化处理;getValidFieldsFullName 用于获取匹配字段列表,但不包含虚拟隐藏项。除此以外,FieldsStore 提供了对实时数据和元数据的读取操作,特别的,部分 api 可用于获取匹配字段的实时数据,参见[文档](https://ant.design/components/form-cn/)。 在此基础上,FieldsStore 提供了一些便捷的访问器操作。需要说明的是,rc-form 借助 [lodash](https://github.com/lodash/lodash),支持以嵌套结构定义字段名,即使用 '.', '\[|\]' 作为分割符,如 'a.b' 意味着 a 对象下的 b 属性;'c\[0\]' 意味着 c 数组的首项。本文约定匹配字段指,所有以指定字符串起始或等值的字段列表。为此,FieldsStore 提供 isValidNestedFieldName 用于校验字段名不能作为表单中另一个字段名的成员;flattenRegisteredFields 用于传参数据作扁平化处理;getValidFieldsFullName 用于获取匹配字段列表,但不包含虚拟隐藏项。除此以外,FieldsStore 提供了对实时数据和元数据的读取操作,特别的,部分 api 可用于获取匹配字段的实时数据,参见[文档](https://ant.design/components/form-cn/)。
@ -46,8 +46,8 @@ FieldsStore 实例又以 fieldsMeta 属性存储字段的元数据。元数据
其次,由 BaseForm 提供的 getFieldProps 或 getFieldDecorator 实例方法完成字段组件的渲染。以下是 getFieldProps, getFieldDecorator 的意义。 其次,由 BaseForm 提供的 getFieldProps 或 getFieldDecorator 实例方法完成字段组件的渲染。以下是 getFieldProps, getFieldDecorator 的意义。
- getFieldProps(name, fieldOption) 用于为 FieldsStore 实例收集字段的元数据,如经转化后的校验规则等;指定字段组件的 ref 引用函数;为字段组件绑定 onCollect, onCollectValidate 实例方法,以在指定事件触发时收集或校验字段的值;最终将输出注入字段组件的 props,包含全量的元数据和实时数据、以及字段的值。 - getFieldProps(name, fieldOption) 用于为 FieldsStore 实例收集字段的元数据,如经转化后的校验规则等;指定字段组件的 ref 引用函数;为字段组件绑定 onCollect, onCollectValidate 实例方法,以在指定事件触发时收集或校验字段的值;最终将输出注入字段组件的 props,包含全量的元数据和实时数据、以及字段的值。
- getFieldDecorator(name, fieldOption) 基于 getFieldProps 方法,直接装饰字段组件,这样就可以操控添加在字段组件上的 ref 引用函数及 props.onChange 等绑定函数。 - getFieldDecorator(name, fieldOption) 基于 getFieldProps 方法,直接装饰字段组件,这样就可以操控添加在字段组件上的 ref 引用函数及 props.onChange 等绑定函数。
其次,当用户行为促使字段的值发生变更时,将执行 BaseForm 实例的 onCollect, onCollectValidate 方法,以收集或校验该字段的实时数据,并重绘表单。其中,rc-form 中的数据校验通过 [async-validate](https://github.com/yiminghe/async-validator) 库实现,具体实现为 BaseForm 实例的 validateFieldsInternal 方法。校验字段时,默认将沿用上一次的校验信息;当设置 force 为 true 时,将强制重新校验。 其次,当用户行为促使字段的值发生变更时,将执行 BaseForm 实例的 onCollect, onCollectValidate 方法,以收集或校验该字段的实时数据,并重绘表单。其中,rc-form 中的数据校验通过 [async-validate](https://github.com/yiminghe/async-validator) 库实现,具体实现为 BaseForm 实例的 validateFieldsInternal 方法。校验字段时,默认将沿用上一次的校验信息;当设置 force 为 true 时,将强制重新校验。

4
components/form/index.en-US.md

@ -55,11 +55,11 @@ The following `options` are available:
| -------- | ----------- | ---- | | -------- | ----------- | ---- |
| mapPropsToFields | Convert props to field value(e.g. reading the values from Redux store). And you must mark returned fields with [`Form.createFormField`](#Form.createFormField) | (props) => ({ \[fieldName\]: FormField { value } }) | | mapPropsToFields | Convert props to field value(e.g. reading the values from Redux store). And you must mark returned fields with [`Form.createFormField`](#Form.createFormField) | (props) => ({ \[fieldName\]: FormField { value } }) |
| name | Set the id prefix of fields under form | - | | name | Set the id prefix of fields under form | - |
| validateMessages | Default validate message. And its format is similar with [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js)'s returned value | Object { [nested.path]&#x3A; String } | | validateMessages | Default validate message. And its format is similar with [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js)'s returned value | Object { \[nested.path]: String } |
| onFieldsChange | Specify a function that will be called when the value a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) | | onFieldsChange | Specify a function that will be called when the value a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) |
| onValuesChange | A handler while value of any field is changed | (props, changedValues, allValues) => void | | onValuesChange | A handler while value of any field is changed | (props, changedValues, allValues) => void |
If you want to get `ref` after `Form.create`, you can use `wrappedComponentRef` provided by `rc-form`,[details can be viewed here](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140). If you want to get `ref` after `Form.create`, you can use `wrappedComponentRef` provided by `rc-form`, [details can be viewed here](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140).
```jsx ```jsx
class CustomizedForm extends React.Component { ... } class CustomizedForm extends React.Component { ... }

2
components/form/index.zh-CN.md

@ -57,7 +57,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
| --- | --- | --- | | --- | --- | --- |
| mapPropsToFields | 把父组件的属性映射到表单项上(如:把 Redux store 中的值读出),需要对返回值中的表单域数据用 [`Form.createFormField`](#Form.createFormField) 标记 | (props) => ({ \[fieldName\]: FormField { value } }) | | mapPropsToFields | 把父组件的属性映射到表单项上(如:把 Redux store 中的值读出),需要对返回值中的表单域数据用 [`Form.createFormField`](#Form.createFormField) 标记 | (props) => ({ \[fieldName\]: FormField { value } }) |
| name | 设置表单域内字段 id 的前缀 | - | | name | 设置表单域内字段 id 的前缀 | - |
| validateMessages | 默认校验信息,可用于把默认错误信息改为中文等,格式与 [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js) 返回值一致 | Object { [nested.path]&#x3A; String } | | validateMessages | 默认校验信息,可用于把默认错误信息改为中文等,格式与 [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js) 返回值一致 | Object { \[nested.path]: String } |
| onFieldsChange | 当 `Form.Item` 子节点的值发生改变时触发,可以把对应的值转存到 Redux store | Function(props, fields) | | onFieldsChange | 当 `Form.Item` 子节点的值发生改变时触发,可以把对应的值转存到 Redux store | Function(props, fields) |
| onValuesChange | 任一表单域的值发生改变时的回调 | (props, changedValues, allValues) => void | | onValuesChange | 任一表单域的值发生改变时的回调 | (props, changedValues, allValues) => void |

2
components/layout/index.zh-CN.md

@ -113,4 +113,4 @@ title: Layout
xl: '1200px', xl: '1200px',
xxl: '1600px', xxl: '1600px',
} }
``` ```

2
components/pagination/index.en-US.md

@ -26,7 +26,7 @@ A long list can be divided into several pages by `Pagination`, and only one page
| hideOnSinglePage | Whether to hide pager on single page | boolean | false | | hideOnSinglePage | Whether to hide pager on single page | boolean | false |
| itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - | | itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
| pageSize | number of data items per page | number | - | | pageSize | number of data items per page | number | - |
| pageSizeOptions | specify the sizeChanger options | string\[] | ['10', '20', '30', '40'] | | pageSizeOptions | specify the sizeChanger options | string\[] | \['10', '20', '30', '40'] |
| showQuickJumper | determine whether you can jump to pages directly | boolean | false | | showQuickJumper | determine whether you can jump to pages directly | boolean | false |
| showSizeChanger | determine whether `pageSize` can be changed | boolean | false | | showSizeChanger | determine whether `pageSize` can be changed | boolean | false |
| showTotal | to display the total number and range | Function(total, range) | - | | showTotal | to display the total number and range | Function(total, range) | - |

2
components/pagination/index.zh-CN.md

@ -27,7 +27,7 @@ cols: 1
| hideOnSinglePage | 只有一页时是否隐藏分页器 | boolean | false | | hideOnSinglePage | 只有一页时是否隐藏分页器 | boolean | false |
| itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - | | itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
| pageSize | 每页条数 | number | - | | pageSize | 每页条数 | number | - |
| pageSizeOptions | 指定每页可以显示多少条 | string\[] | ['10', '20', '30', '40'] | | pageSizeOptions | 指定每页可以显示多少条 | string\[] | \['10', '20', '30', '40'] |
| showQuickJumper | 是否可以快速跳转至某页 | boolean | false | | showQuickJumper | 是否可以快速跳转至某页 | boolean | false |
| showSizeChanger | 是否可以改变 pageSize | boolean | false | | showSizeChanger | 是否可以改变 pageSize | boolean | false |
| showTotal | 用于显示数据总量和当前数据顺序 | Function(total, range) | - | | showTotal | 用于显示数据总量和当前数据顺序 | Function(total, range) | - |

4
components/slider/index.en-US.md

@ -15,11 +15,11 @@ To input a value in a range.
| Property | Description | Type | Default | | Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- | | -------- | ----------- | ---- | ------- |
| autoFocus | get focus when component mounted | boolean | false | | autoFocus | get focus when component mounted | boolean | false |
| defaultValue | The default value of slider. When `range` is `false`, use `number`, otherwise, use `[number, number]` | number\|number\[] | 0 or [0, 0] | | defaultValue | The default value of slider. When `range` is `false`, use `number`, otherwise, use `[number, number]` | number\|number\[] | 0 or \[0, 0] |
| disabled | If true, the slider will not be interactable. | boolean | false | | disabled | If true, the slider will not be interactable. | boolean | false |
| dots | Whether the thumb can drag over tick only. | boolean | false | | dots | Whether the thumb can drag over tick only. | boolean | false |
| included | Make effect when `marks` not null,`true` means containment and `false` means coordinative | boolean | true | | included | Make effect when `marks` not null,`true` means containment and `false` means coordinative | boolean | true |
| marks | Tick mark of Slider, type of key must be `number`, and must in closed interval [min, max] ,each mark can declare its own style. | object | { number: string\|ReactNode } or { number: { style: object, label: string\|ReactNode } } | | marks | Tick mark of Slider, type of key must be `number`, and must in closed interval \[min, max] ,each mark can declare its own style. | object | { number: string\|ReactNode } or { number: { style: object, label: string\|ReactNode } } |
| max | The maximum value the slider can slide to | number | 100 | | max | The maximum value the slider can slide to | number | 100 |
| min | The minimum value the slider can slide to. | number | 0 | | min | The minimum value the slider can slide to. | number | 0 |
| range | dual thumb mode | boolean | false | | range | dual thumb mode | boolean | false |

4
components/slider/index.zh-CN.md

@ -16,11 +16,11 @@ title: Slider
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| allowClear | 支持清除, 单选模式有效 | boolean | false | | allowClear | 支持清除, 单选模式有效 | boolean | false |
| defaultValue | 设置初始取值。当 `range``false` 时,使用 `number`,否则用 `[number, number]` | number\|number\[] | 0 or [0, 0] | | defaultValue | 设置初始取值。当 `range``false` 时,使用 `number`,否则用 `[number, number]` | number\|number\[] | 0 or \[0, 0] |
| disabled | 值为 `true` 时,滑块为禁用状态 | boolean | false | | disabled | 值为 `true` 时,滑块为禁用状态 | boolean | false |
| dots | 是否只能拖拽到刻度上 | boolean | false | | dots | 是否只能拖拽到刻度上 | boolean | false |
| included | `marks` 不为空对象时有效,值为 true 时表示值为包含关系,false 表示并列 | boolean | true | | included | `marks` 不为空对象时有效,值为 true 时表示值为包含关系,false 表示并列 | boolean | true |
| marks | 刻度标记,key 的类型必须为 `number` 且取值在闭区间 [min, max] 内,每个标签可以单独设置样式 | object | { number: string\|ReactNode } or { number: { style: object, label: string\|ReactNode } } | | marks | 刻度标记,key 的类型必须为 `number` 且取值在闭区间 \[min, max] 内,每个标签可以单独设置样式 | object | { number: string\|ReactNode } or { number: { style: object, label: string\|ReactNode } } |
| max | 最大值 | number | 100 | | max | 最大值 | number | 100 |
| min | 最小值 | number | 0 | | min | 最小值 | number | 0 |
| range | 双滑块模式 | boolean | false | | range | 双滑块模式 | boolean | false |

2
components/table/Table.tsx

@ -783,7 +783,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
} }
getColumnKey(column: ColumnProps<T>, index?: number) { getColumnKey(column: ColumnProps<T>, index?: number) {
return column.key || (column.dataIndex as string) || index; return column.key || column.dataIndex || index;
} }
getMaxCurrent(total: number) { getMaxCurrent(total: number) {

4
components/table/demo/fixed-columns-header.md

@ -10,7 +10,7 @@ title:
适合同时展示有大量数据和数据列。 适合同时展示有大量数据和数据列。
> 若列头与内容不对齐或出现列重复,请指定列的宽度 `width` > 若列头与内容不对齐或出现列重复,请指定列的宽度 `width`
>
> 建议指定 `scroll.x` 为大于表格宽度的固定值或百分比。注意,且非固定列宽度之和不要超过 `scroll.x` > 建议指定 `scroll.x` 为大于表格宽度的固定值或百分比。注意,且非固定列宽度之和不要超过 `scroll.x`
## en-US ## en-US
@ -18,7 +18,7 @@ title:
A Solution for displaying large amounts of data with long columns. A Solution for displaying large amounts of data with long columns.
> Specify the width of columns if header and cell do not align properly. > Specify the width of columns if header and cell do not align properly.
>
> A fixed value which is greater than table width for `scroll.x` is recommended. The sum of unfixed columns should not greater than `scroll.x`. > A fixed value which is greater than table width for `scroll.x` is recommended. The sum of unfixed columns should not greater than `scroll.x`.
````jsx ````jsx

4
components/table/demo/fixed-columns.md

@ -10,7 +10,7 @@ title:
对于列数很多的数据,可以固定前后的列,横向滚动查看其它数据,需要和 `scroll.x` 配合使用。 对于列数很多的数据,可以固定前后的列,横向滚动查看其它数据,需要和 `scroll.x` 配合使用。
> 若列头与内容不对齐或出现列重复,请指定列的宽度 `width` > 若列头与内容不对齐或出现列重复,请指定列的宽度 `width`
>
> 建议指定 `scroll.x` 为大于表格宽度的固定值或百分比。注意,且非固定列宽度之和不要超过 `scroll.x` > 建议指定 `scroll.x` 为大于表格宽度的固定值或百分比。注意,且非固定列宽度之和不要超过 `scroll.x`
## en-US ## en-US
@ -18,7 +18,7 @@ title:
To fix some columns and scroll inside other columns, and you must set `scroll.x` meanwhile. To fix some columns and scroll inside other columns, and you must set `scroll.x` meanwhile.
> Specify the width of columns if header and cell do not align properly. > Specify the width of columns if header and cell do not align properly.
>
> A fixed value which is greater than table width for `scroll.x` is recommended. The sum of unfixed columns should not greater than `scroll.x`. > A fixed value which is greater than table width for `scroll.x` is recommended. The sum of unfixed columns should not greater than `scroll.x`.
````jsx ````jsx

4
components/table/demo/row-selection.md

@ -9,13 +9,13 @@ title:
第一列是联动的选择框。 第一列是联动的选择框。
> 默认点击 checkbox 触发选择行为,需要点击行触发可以参考例子:https://codesandbox.io/s/000vqw38rl > 默认点击 checkbox 触发选择行为,需要点击行触发可以参考例子:<https://codesandbox.io/s/000vqw38rl>
## en-US ## en-US
Rows can be selectable by making first column as a selectable column. Rows can be selectable by making first column as a selectable column.
> selection happens when clicking checkbox defaultly. You can see https://codesandbox.io/s/000vqw38rl if you need row-click selection behavior. > selection happens when clicking checkbox defaultly. You can see <https://codesandbox.io/s/000vqw38rl> if you need row-click selection behavior.
````jsx ````jsx
import { Table } from 'antd'; import { Table } from 'antd';

2
components/table/interface.tsx

@ -19,7 +19,7 @@ export interface ColumnProps<T> {
}, },
) => React.ReactNode); ) => React.ReactNode);
key?: React.Key; key?: React.Key;
dataIndex?: keyof T; dataIndex?: string; // Note: We can not use generic type here, since we need to support nested key, see #9393
render?: (text: any, record: T, index: number) => React.ReactNode; render?: (text: any, record: T, index: number) => React.ReactNode;
align?: 'left' | 'right' | 'center'; align?: 'left' | 'right' | 'center';
filters?: ColumnFilterItem[]; filters?: ColumnFilterItem[];

4
components/transfer/index.en-US.md

@ -20,7 +20,7 @@ One or more elements can be selected from either column, one click on the proper
| Property | Description | Type | Default | | Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- | | -------- | ----------- | ---- | ------- |
| className | A custom CSS class. | string | ['', ''] | | className | A custom CSS class. | string | \['', ''] |
| dataSource | Used for setting the source data. The elements that are part of this array will be present the left column. Except the elements whose keys are included in `targetKeys` prop. | [TransferItem](https://git.io/vMM64)\[] | \[] | | dataSource | Used for setting the source data. The elements that are part of this array will be present the left column. Except the elements whose keys are included in `targetKeys` prop. | [TransferItem](https://git.io/vMM64)\[] | \[] |
| disabled | Whether disabled transfer | boolean | false | | disabled | Whether disabled transfer | boolean | false |
| filterOption | A function to determine whether an item should show in search result list | (inputValue, option): boolean | | | filterOption | A function to determine whether an item should show in search result list | (inputValue, option): boolean | |
@ -28,7 +28,7 @@ One or more elements can be selected from either column, one click on the proper
| lazy | property of [react-lazy-load](https://github.com/loktar00/react-lazy-load) for lazy rendering items. Turn off it by set to `false`. | object\|boolean | `{ height: 32, offset: 32 }` | | lazy | property of [react-lazy-load](https://github.com/loktar00/react-lazy-load) for lazy rendering items. Turn off it by set to `false`. | object\|boolean | `{ height: 32, offset: 32 }` |
| listStyle | A custom CSS style used for rendering the transfer columns. | object | | | listStyle | A custom CSS style used for rendering the transfer columns. | object | |
| locale | i18n text including filter, empty text, item unit, etc | object | `{ itemUnit: 'item', itemsUnit: 'items', notFoundContent: 'The list is empty', searchPlaceholder: 'Search here' }` | | locale | i18n text including filter, empty text, item unit, etc | object | `{ itemUnit: 'item', itemsUnit: 'items', notFoundContent: 'The list is empty', searchPlaceholder: 'Search here' }` |
| operations | A set of operations that are sorted from top to bottom. | string\[] | ['>', '<'] | | operations | A set of operations that are sorted from top to bottom. | string\[] | \['>', '<'] |
| operationStyle | A custom CSS style used for rendering the operations column. | object | | | operationStyle | A custom CSS style used for rendering the operations column. | object | |
| render | The function to generate the item shown on a column. Based on an record (element of the dataSource array), this function should return a React element which is generated from that record. Also, it can return a plain object with `value` and `label`, `label` is a React element and `value` is for title | Function(record) | | | render | The function to generate the item shown on a column. Based on an record (element of the dataSource array), this function should return a React element which is generated from that record. Also, it can return a plain object with `value` and `label`, `label` is a React element and `value` is for title | Function(record) | |
| selectedKeys | A set of keys of selected items. | string\[] | \[] | | selectedKeys | A set of keys of selected items. | string\[] | \[] |

4
components/transfer/index.zh-CN.md

@ -30,12 +30,12 @@ title: Transfer
| lazy | Transfer 使用了 [react-lazy-load](https://github.com/loktar00/react-lazy-load) 优化性能,这里可以设置相关参数。设为 `false` 可以关闭懒加载。 | object\|boolean | `{ height: 32, offset: 32 }` | | lazy | Transfer 使用了 [react-lazy-load](https://github.com/loktar00/react-lazy-load) 优化性能,这里可以设置相关参数。设为 `false` 可以关闭懒加载。 | object\|boolean | `{ height: 32, offset: 32 }` |
| listStyle | 两个穿梭框的自定义样式 | object | | | listStyle | 两个穿梭框的自定义样式 | object | |
| locale | 各种语言 | object | `{ itemUnit: '项', itemsUnit: '项', notFoundContent: '列表为空', searchPlaceholder: '请输入搜索内容' }` | | locale | 各种语言 | object | `{ itemUnit: '项', itemsUnit: '项', notFoundContent: '列表为空', searchPlaceholder: '请输入搜索内容' }` |
| operations | 操作文案集合,顺序从上至下 | string\[] | ['>', '<'] | | operations | 操作文案集合,顺序从上至下 | string\[] | \['>', '<'] |
| render | 每行数据渲染函数,该函数的入参为 `dataSource` 中的项,返回值为 ReactElement。或者返回一个普通对象,其中 `label` 字段为 ReactElement,`value` 字段为 title | Function(record) | | | render | 每行数据渲染函数,该函数的入参为 `dataSource` 中的项,返回值为 ReactElement。或者返回一个普通对象,其中 `label` 字段为 ReactElement,`value` 字段为 title | Function(record) | |
| selectedKeys | 设置哪些项应该被选中 | string\[] | \[] | | selectedKeys | 设置哪些项应该被选中 | string\[] | \[] |
| showSearch | 是否显示搜索框 | boolean | false | | showSearch | 是否显示搜索框 | boolean | false |
| targetKeys | 显示在右侧框数据的key集合 | string\[] | \[] | | targetKeys | 显示在右侧框数据的key集合 | string\[] | \[] |
| titles | 标题集合,顺序从左至右 | string\[] | ['', ''] | | titles | 标题集合,顺序从左至右 | string\[] | \['', ''] |
| onChange | 选项在两栏之间转移时的回调函数 | (targetKeys, direction, moveKeys): void | | | onChange | 选项在两栏之间转移时的回调函数 | (targetKeys, direction, moveKeys): void | |
| onScroll | 选项列表滚动时的回调函数 | (direction, event): void | | | onScroll | 选项列表滚动时的回调函数 | (direction, event): void | |
| onSearch | 搜索框内容时改变时的回调函数 | (direction: 'left'\|'right', value: string): void | - | | onSearch | 搜索框内容时改变时的回调函数 | (direction: 'left'\|'right', value: string): void | - |

4
components/tree-select/index.en-US.md

@ -40,8 +40,8 @@ Any data whose entries are defined in a hierarchical manner is fit to use this c
| suffixIcon | The custom suffix icon | ReactNode | - | | suffixIcon | The custom suffix icon | ReactNode | - |
| treeCheckable | Whether to show checkbox on the treeNodes | boolean | false | | treeCheckable | Whether to show checkbox on the treeNodes | boolean | false |
| treeCheckStrictly | Whether to check nodes precisely (in the `checkable` mode), means parent and child nodes are not associated, and it will make `labelInValue` be true | boolean | false | | treeCheckStrictly | Whether to check nodes precisely (in the `checkable` mode), means parent and child nodes are not associated, and it will make `labelInValue` be true | boolean | false |
| treeData | Data of the treeNodes, manual construction work is no longer needed if this property has been set(ensure the Uniqueness of each value) | array&lt;{ value, title, children, [disabled, disableCheckbox, selectable] }> | \[] | | treeData | Data of the treeNodes, manual construction work is no longer needed if this property has been set(ensure the Uniqueness of each value) | array\<{ value, title, children, \[disabled, disableCheckbox, selectable] }> | \[] |
| treeDataSimpleMode | Enable simple mode of treeData. Changes the `treeData` schema to: [{id:1, pId:0, value:'1', title:"test1",...},...] where pId is parent node's id). It is possible to replace the default `id` and `pId` keys by providing object to `treeDataSimpleMode` | false\|Array&lt;{ id: string, pId: string, rootPId: null }> | false | | treeDataSimpleMode | Enable simple mode of treeData. Changes the `treeData` schema to: \[{id:1, pId:0, value:'1', title:"test1",...},...] where pId is parent node's id). It is possible to replace the default `id` and `pId` keys by providing object to `treeDataSimpleMode` | false\|Array\<{ id: string, pId: string, rootPId: null }> | false |
| treeDefaultExpandAll | Whether to expand all treeNodes by default | boolean | false | | treeDefaultExpandAll | Whether to expand all treeNodes by default | boolean | false |
| treeDefaultExpandedKeys | Default expanded treeNodes | string\[] | - | | treeDefaultExpandedKeys | Default expanded treeNodes | string\[] | - |
| treeExpandedKeys | Set expanded keys | string\[] | - | | treeExpandedKeys | Set expanded keys | string\[] | - |

4
components/tree-select/index.zh-CN.md

@ -40,8 +40,8 @@ title: TreeSelect
| suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | | suffixIcon | 自定义的选择框后缀图标 | ReactNode | - |
| treeCheckable | 显示 checkbox | boolean | false | | treeCheckable | 显示 checkbox | boolean | false |
| treeCheckStrictly | checkable 状态下节点选择完全受控(父子节点选中状态不再关联),会使得 `labelInValue` 强制为 true | boolean | false | | treeCheckStrictly | checkable 状态下节点选择完全受控(父子节点选中状态不再关联),会使得 `labelInValue` 强制为 true | boolean | false |
| treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(value 在整个树范围内唯一) | array&lt;{value, title, children, [disabled, disableCheckbox, selectable]}> | \[] | | treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(value 在整个树范围内唯一) | array\<{value, title, children, \[disabled, disableCheckbox, selectable]}> | \[] |
| treeDataSimpleMode | 使用简单格式的 treeData,具体设置参考可设置的类型 (此时 treeData 应变为这样的数据结构: [{id:1, pId:0, value:'1', title:"test1",...},...], `pId` 是父节点的 id) | false\|Array&lt;{ id: string, pId: string, rootPId: null }> | false | | treeDataSimpleMode | 使用简单格式的 treeData,具体设置参考可设置的类型 (此时 treeData 应变为这样的数据结构: \[{id:1, pId:0, value:'1', title:"test1",...},...], `pId` 是父节点的 id) | false\|Array\<{ id: string, pId: string, rootPId: null }> | false |
| treeDefaultExpandAll | 默认展开所有树节点 | boolean | false | | treeDefaultExpandAll | 默认展开所有树节点 | boolean | false |
| treeDefaultExpandedKeys | 默认展开的树节点 | string\[] | - | | treeDefaultExpandedKeys | 默认展开的树节点 | string\[] | - |
| treeExpandedKeys | 设置展开的树节点 | string\[] | - | | treeExpandedKeys | 设置展开的树节点 | string\[] | - |

3
components/upload/style/index.less

@ -4,6 +4,7 @@
@upload-prefix-cls: ~'@{ant-prefix}-upload'; @upload-prefix-cls: ~'@{ant-prefix}-upload';
@upload-item: ~'@{ant-prefix}-upload-list-item'; @upload-item: ~'@{ant-prefix}-upload-list-item';
@upload-pictrue-card-size: 104px; @upload-pictrue-card-size: 104px;
@upload-picture-card-border-style: @border-style-base;
.@{upload-prefix-cls} { .@{upload-prefix-cls} {
.reset-component; .reset-component;
@ -206,7 +207,7 @@
.@{upload-item} { .@{upload-item} {
padding: 8px; padding: 8px;
border-radius: @border-radius-base; border-radius: @border-radius-base;
border: @border-width-base @border-style-base @border-color-base; border: @border-width-base @upload-picture-card-border-style @border-color-base;
height: 66px; height: 66px;
position: relative; position: relative;
&:hover { &:hover {

6
package.json

@ -91,6 +91,7 @@
"warning": "~4.0.2" "warning": "~4.0.2"
}, },
"devDependencies": { "devDependencies": {
"@ant-design/colors": "^2.0.0",
"@types/classnames": "^2.2.6", "@types/classnames": "^2.2.6",
"@types/prop-types": "^15.5.6", "@types/prop-types": "^15.5.6",
"@types/react": "~16.7.13", "@types/react": "~16.7.13",
@ -99,7 +100,6 @@
"@types/react-slick": "^0.23.2", "@types/react-slick": "^0.23.2",
"@yesmeck/offline-plugin": "^5.0.5", "@yesmeck/offline-plugin": "^5.0.5",
"ansi-styles": "^3.2.1", "ansi-styles": "^3.2.1",
"@ant-design/colors": "^2.0.0",
"antd-theme-generator": "^1.1.4", "antd-theme-generator": "^1.1.4",
"antd-tools": "^6.4.4", "antd-tools": "^6.4.4",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
@ -163,8 +163,11 @@
"react-sticky": "^6.0.3", "react-sticky": "^6.0.3",
"react-test-renderer": "^16.6.3", "react-test-renderer": "^16.6.3",
"react-virtualized": "~9.21.0", "react-virtualized": "~9.21.0",
"remark-cli": "^6.0.1",
"remark-frontmatter": "^1.3.0", "remark-frontmatter": "^1.3.0",
"remark-lint": "^6.0.4",
"remark-parse": "^6.0.0", "remark-parse": "^6.0.0",
"remark-preset-lint-recommended": "^3.0.2",
"remark-stringify": "^6.0.0", "remark-stringify": "^6.0.0",
"remark-yaml-config": "^4.0.2", "remark-yaml-config": "^4.0.2",
"reqwest": "^2.0.5", "reqwest": "^2.0.5",
@ -185,6 +188,7 @@
"lint": "npm run lint:ts && npm run lint:es && npm run lint:demo && npm run lint:style", "lint": "npm run lint:ts && npm run lint:es && npm run lint:demo && npm run lint:style",
"lint:ts": "npm run tsc && antd-tools run ts-lint", "lint:ts": "npm run tsc && antd-tools run ts-lint",
"lint:es": "eslint tests site scripts components ./.*.js ./webpack.config.js --ext '.js,.jsx'", "lint:es": "eslint tests site scripts components ./.*.js ./webpack.config.js --ext '.js,.jsx'",
"lint:md": "remark components/",
"lint:demo": "cross-env RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'", "lint:demo": "cross-env RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less", "lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"lint-fix:ts": "npm run tsc && antd-tools run ts-lint-fix", "lint-fix:ts": "npm run tsc && antd-tools run ts-lint-fix",

19
site/theme/template/Home/Banner.jsx

@ -6,6 +6,7 @@ import ScrollParallax from 'rc-scroll-anim/lib/ScrollParallax';
import { Link } from 'bisheng/router'; import { Link } from 'bisheng/router';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import GitHubButton from 'react-github-button'; import GitHubButton from 'react-github-button';
import { Button } from 'antd';
import BannerImage from './BannerImage'; import BannerImage from './BannerImage';
import * as utils from '../utils'; import * as utils from '../utils';
@ -67,17 +68,15 @@ class Banner extends React.PureComponent {
<FormattedMessage id="app.home.introduce" /> <FormattedMessage id="app.home.introduce" />
</p> </p>
<div className="banner-btns" key="buttons"> <div className="banner-btns" key="buttons">
<Link <Link to={utils.getLocalizedPathname('/docs/react/introduce', isZhCN)}>
className="banner-btn components" <Button type="primary" className="banner-btn components">
to={utils.getLocalizedPathname('/docs/react/introduce', isZhCN)} <FormattedMessage id="app.home.getting-started" />
> </Button>
<FormattedMessage id="app.home.getting-started" />
</Link> </Link>
<Link <Link to={utils.getLocalizedPathname('/docs/spec/introduce', isZhCN)}>
className="banner-btn language" <Button className="banner-btn language">
to={utils.getLocalizedPathname('/docs/spec/introduce', isZhCN)} <FormattedMessage id="app.home.design-language" />
> </Button>
<FormattedMessage id="app.home.design-language" />
</Link> </Link>
{!isMobile && ( {!isMobile && (
<GitHubButton <GitHubButton

Loading…
Cancel
Save