From bf087e29bd160099bbfefe93438eeb70807e058e Mon Sep 17 00:00:00 2001 From: zombieJ Date: Wed, 26 Dec 2018 14:14:00 +0800 Subject: [PATCH] Add remark lint (#13906) support remark-lint check --- .remarkrc.js | 8 ++++++ components/form/docs/tutorial.md | 28 +++++++++---------- components/form/index.en-US.md | 4 +-- components/form/index.zh-CN.md | 2 +- components/layout/index.zh-CN.md | 2 +- components/pagination/index.en-US.md | 2 +- components/pagination/index.zh-CN.md | 2 +- components/slider/index.en-US.md | 4 +-- components/slider/index.zh-CN.md | 4 +-- components/table/demo/fixed-columns-header.md | 4 +-- components/table/demo/fixed-columns.md | 4 +-- components/table/demo/row-selection.md | 4 +-- components/transfer/index.en-US.md | 4 +-- components/transfer/index.zh-CN.md | 4 +-- components/tree-select/index.en-US.md | 4 +-- components/tree-select/index.zh-CN.md | 4 +-- package.json | 6 +++- 17 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 .remarkrc.js diff --git a/.remarkrc.js b/.remarkrc.js new file mode 100644 index 0000000000..505e5ef689 --- /dev/null +++ b/.remarkrc.js @@ -0,0 +1,8 @@ +const config = { + plugins: [ + 'remark-preset-lint-recommended', + ['remark-lint-list-item-indent', 'space'], + ], +}; + +module.exports = config; diff --git a/components/form/docs/tutorial.md b/components/form/docs/tutorial.md index 57e66a6f43..a519a50043 100644 --- a/components/form/docs/tutorial.md +++ b/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 为字段名,下同)。 - - value 字段的值。 - - errors 校验文案,数组形式。 - - validating 校验状态。 - - dirty 脏值标识。真值时意味着字段的值已作变更,但未作校验。 - - touched 用户行为标识。通常情况下,真值时意味着用户行为已促使字段的值发生了变更。 +- value 字段的值。 +- errors 校验文案,数组形式。 +- validating 校验状态。 +- dirty 脏值标识。真值时意味着字段的值已作变更,但未作校验。 +- touched 用户行为标识。通常情况下,真值时意味着用户行为已促使字段的值发生了变更。 FieldsStore 实例又以 fieldsMeta 属性存储字段的元数据。元数据作为配置项,通常是指定后不再变更的数据,用于操控表单数据转换等行为。元数据通过下文中 getFieldProps, getFieldDecorator 方法的次参 fieldOption 配置。以下是 fieldsMeta\[name\] 中部分成员属性的意义(如不作特殊说明,该成员属性即 fieldOption 中的同名属性)。 - - validate 校验规则和触发事件,用于约定在何种事件下以何种方式校验字段的值,\[{ rules, trigger }\] 形式。通过fieldOption.validate, fieldOption.rules, fieldOption.validateTrigger 配置。 - - hidden 设置为 true 时,validateFields 将不会校验该字段,需要开发者手动校验,并且,getFieldsValue, getFieldsError 等方法也将无法获取该字段的数据及校验信息等实时数据。适用场景如勾选协议复选框,当其已勾选时,提交按钮才可点击,该复选框的值不会出现在全量表单数据中。本文假定配置了 hidden 为 true 的字段为虚拟隐藏项。 - - getValueFromEvent(event) 用于从 event 对象中获取字段的值,适用场景如处理 input, radio 等原生组件。特别的,当字段组件输出的首参不是 event 对象时,getValueFromEvent 将对首参进行数据转化,以满足特定的场景,比如由开发者指定具体首参内容的自定义字段组件。 - - initialValue 字段的初始值。当字段的值未作收集时,初始值用于作为字段的值。 - - valuePropName 约定字段的值以何种 props 属性注入字段组件中,适用场景如将字段的值以 props.checked 属性注入 radio 组件中。注入字段组件的值数据 props 由 getFieldValuePropValue 方法生成,下同。 - - getValueProps(value) 用于转化字段的值,输出 props 以注入字段组件中。适用场景如当 get, post 请求的数据结构不同时,且字段组件以 post 请求的数据结构输出字段的值、以 get 请求的数据结构接受字段的值,那就可以使用 getValueProps 将 post 请求的数据结构转换为 get 请求的数据结构。 - - normalize(newValue, oldValue, values) 用于转化存入 FieldsStore 实例的字段的值。使用案例如[全选按钮](https://codepen.io/afc163/pen/JJVXzG?editors=001)。 +- validate 校验规则和触发事件,用于约定在何种事件下以何种方式校验字段的值,\[{ rules, trigger }\] 形式。通过fieldOption.validate, fieldOption.rules, fieldOption.validateTrigger 配置。 +- hidden 设置为 true 时,validateFields 将不会校验该字段,需要开发者手动校验,并且,getFieldsValue, getFieldsError 等方法也将无法获取该字段的数据及校验信息等实时数据。适用场景如勾选协议复选框,当其已勾选时,提交按钮才可点击,该复选框的值不会出现在全量表单数据中。本文假定配置了 hidden 为 true 的字段为虚拟隐藏项。 +- getValueFromEvent(event) 用于从 event 对象中获取字段的值,适用场景如处理 input, radio 等原生组件。特别的,当字段组件输出的首参不是 event 对象时,getValueFromEvent 将对首参进行数据转化,以满足特定的场景,比如由开发者指定具体首参内容的自定义字段组件。 +- initialValue 字段的初始值。当字段的值未作收集时,初始值用于作为字段的值。 +- valuePropName 约定字段的值以何种 props 属性注入字段组件中,适用场景如将字段的值以 props.checked 属性注入 radio 组件中。注入字段组件的值数据 props 由 getFieldValuePropValue 方法生成,下同。 +- getValueProps(value) 用于转化字段的值,输出 props 以注入字段组件中。适用场景如当 get, post 请求的数据结构不同时,且字段组件以 post 请求的数据结构输出字段的值、以 get 请求的数据结构接受字段的值,那就可以使用 getValueProps 将 post 请求的数据结构转换为 get 请求的数据结构。 +- 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/)。 @@ -46,8 +46,8 @@ FieldsStore 实例又以 fieldsMeta 属性存储字段的元数据。元数据 其次,由 BaseForm 提供的 getFieldProps 或 getFieldDecorator 实例方法完成字段组件的渲染。以下是 getFieldProps, getFieldDecorator 的意义。 - - getFieldProps(name, fieldOption) 用于为 FieldsStore 实例收集字段的元数据,如经转化后的校验规则等;指定字段组件的 ref 引用函数;为字段组件绑定 onCollect, onCollectValidate 实例方法,以在指定事件触发时收集或校验字段的值;最终将输出注入字段组件的 props,包含全量的元数据和实时数据、以及字段的值。 - - getFieldDecorator(name, fieldOption) 基于 getFieldProps 方法,直接装饰字段组件,这样就可以操控添加在字段组件上的 ref 引用函数及 props.onChange 等绑定函数。 +- getFieldProps(name, fieldOption) 用于为 FieldsStore 实例收集字段的元数据,如经转化后的校验规则等;指定字段组件的 ref 引用函数;为字段组件绑定 onCollect, onCollectValidate 实例方法,以在指定事件触发时收集或校验字段的值;最终将输出注入字段组件的 props,包含全量的元数据和实时数据、以及字段的值。 +- getFieldDecorator(name, fieldOption) 基于 getFieldProps 方法,直接装饰字段组件,这样就可以操控添加在字段组件上的 ref 引用函数及 props.onChange 等绑定函数。 其次,当用户行为促使字段的值发生变更时,将执行 BaseForm 实例的 onCollect, onCollectValidate 方法,以收集或校验该字段的实时数据,并重绘表单。其中,rc-form 中的数据校验通过 [async-validate](https://github.com/yiminghe/async-validator) 库实现,具体实现为 BaseForm 实例的 validateFieldsInternal 方法。校验字段时,默认将沿用上一次的校验信息;当设置 force 为 true 时,将强制重新校验。 diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index d033dedf7b..b0061d0685 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -54,11 +54,11 @@ The following `options` are available: | Property | Description | Type | | -------- | ----------- | ---- | | 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 } }) | -| 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 } | +| 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) | | 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 class CustomizedForm extends React.Component { ... } diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index 3bd98c70ff..af7cc38ec5 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -56,7 +56,7 @@ CustomizedForm = Form.create({})(CustomizedForm); | 参数 | 说明 | 类型 | | --- | --- | --- | | mapPropsToFields | 把父组件的属性映射到表单项上(如:把 Redux store 中的值读出),需要对返回值中的表单域数据用 [`Form.createFormField`](#Form.createFormField) 标记 | (props) => ({ \[fieldName\]: FormField { value } }) | -| validateMessages | 默认校验信息,可用于把默认错误信息改为中文等,格式与 [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js) 返回值一致 | Object { [nested.path]: 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) | | onValuesChange | 任一表单域的值发生改变时的回调 | (props, changedValues, allValues) => void | diff --git a/components/layout/index.zh-CN.md b/components/layout/index.zh-CN.md index be2237feb8..1858465b82 100644 --- a/components/layout/index.zh-CN.md +++ b/components/layout/index.zh-CN.md @@ -113,4 +113,4 @@ title: Layout xl: '1200px', xxl: '1600px', } -``` \ No newline at end of file +``` diff --git a/components/pagination/index.en-US.md b/components/pagination/index.en-US.md index 12c15fc9a1..dc6d9e8ada 100644 --- a/components/pagination/index.en-US.md +++ b/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 | | itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - | | 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 | | showSizeChanger | determine whether `pageSize` can be changed | boolean | false | | showTotal | to display the total number and range | Function(total, range) | - | diff --git a/components/pagination/index.zh-CN.md b/components/pagination/index.zh-CN.md index d4bbd94230..31752ced02 100644 --- a/components/pagination/index.zh-CN.md +++ b/components/pagination/index.zh-CN.md @@ -27,7 +27,7 @@ cols: 1 | hideOnSinglePage | 只有一页时是否隐藏分页器 | boolean | false | | itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - | | pageSize | 每页条数 | number | - | -| pageSizeOptions | 指定每页可以显示多少条 | string\[] | ['10', '20', '30', '40'] | +| pageSizeOptions | 指定每页可以显示多少条 | string\[] | \['10', '20', '30', '40'] | | showQuickJumper | 是否可以快速跳转至某页 | boolean | false | | showSizeChanger | 是否可以改变 pageSize | boolean | false | | showTotal | 用于显示数据总量和当前数据顺序 | Function(total, range) | - | diff --git a/components/slider/index.en-US.md b/components/slider/index.en-US.md index 0b40c2e76d..439dc3e49f 100644 --- a/components/slider/index.en-US.md +++ b/components/slider/index.en-US.md @@ -15,11 +15,11 @@ To input a value in a range. | Property | Description | Type | Default | | -------- | ----------- | ---- | ------- | | 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 | | 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 | -| 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 | | min | The minimum value the slider can slide to. | number | 0 | | range | dual thumb mode | boolean | false | diff --git a/components/slider/index.zh-CN.md b/components/slider/index.zh-CN.md index b1c6a13266..3134947af9 100644 --- a/components/slider/index.zh-CN.md +++ b/components/slider/index.zh-CN.md @@ -16,11 +16,11 @@ title: Slider | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | 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 | | dots | 是否只能拖拽到刻度上 | boolean | false | | 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 | | min | 最小值 | number | 0 | | range | 双滑块模式 | boolean | false | diff --git a/components/table/demo/fixed-columns-header.md b/components/table/demo/fixed-columns-header.md index a8ee864fbd..891b90fa55 100644 --- a/components/table/demo/fixed-columns-header.md +++ b/components/table/demo/fixed-columns-header.md @@ -10,7 +10,7 @@ title: 适合同时展示有大量数据和数据列。 > 若列头与内容不对齐或出现列重复,请指定列的宽度 `width`。 - +> > 建议指定 `scroll.x` 为大于表格宽度的固定值或百分比。注意,且非固定列宽度之和不要超过 `scroll.x`。 ## en-US @@ -18,7 +18,7 @@ title: A Solution for displaying large amounts of data with long columns. > 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`. ````jsx diff --git a/components/table/demo/fixed-columns.md b/components/table/demo/fixed-columns.md index 018eb86913..49812d2fcb 100644 --- a/components/table/demo/fixed-columns.md +++ b/components/table/demo/fixed-columns.md @@ -10,7 +10,7 @@ title: 对于列数很多的数据,可以固定前后的列,横向滚动查看其它数据,需要和 `scroll.x` 配合使用。 > 若列头与内容不对齐或出现列重复,请指定列的宽度 `width`。 - +> > 建议指定 `scroll.x` 为大于表格宽度的固定值或百分比。注意,且非固定列宽度之和不要超过 `scroll.x`。 ## en-US @@ -18,7 +18,7 @@ title: 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. - +> > 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 diff --git a/components/table/demo/row-selection.md b/components/table/demo/row-selection.md index 497e268561..81eb6eadec 100644 --- a/components/table/demo/row-selection.md +++ b/components/table/demo/row-selection.md @@ -9,13 +9,13 @@ title: 第一列是联动的选择框。 -> 默认点击 checkbox 触发选择行为,需要点击行触发可以参考例子:https://codesandbox.io/s/000vqw38rl +> 默认点击 checkbox 触发选择行为,需要点击行触发可以参考例子: ## en-US 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 if you need row-click selection behavior. ````jsx import { Table } from 'antd'; diff --git a/components/transfer/index.en-US.md b/components/transfer/index.en-US.md index c9ac0b1a07..f0f3ff494b 100644 --- a/components/transfer/index.en-US.md +++ b/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 | | -------- | ----------- | ---- | ------- | -| 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)\[] | \[] | | disabled | Whether disabled transfer | boolean | false | | 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 }` | | 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' }` | -| 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 | | | 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\[] | \[] | diff --git a/components/transfer/index.zh-CN.md b/components/transfer/index.zh-CN.md index a5bc210cbb..b4efce1844 100644 --- a/components/transfer/index.zh-CN.md +++ b/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 }` | | listStyle | 两个穿梭框的自定义样式 | object | | | locale | 各种语言 | object | `{ itemUnit: '项', itemsUnit: '项', notFoundContent: '列表为空', searchPlaceholder: '请输入搜索内容' }` | -| operations | 操作文案集合,顺序从上至下 | string\[] | ['>', '<'] | +| operations | 操作文案集合,顺序从上至下 | string\[] | \['>', '<'] | | render | 每行数据渲染函数,该函数的入参为 `dataSource` 中的项,返回值为 ReactElement。或者返回一个普通对象,其中 `label` 字段为 ReactElement,`value` 字段为 title | Function(record) | | | selectedKeys | 设置哪些项应该被选中 | string\[] | \[] | | showSearch | 是否显示搜索框 | boolean | false | | targetKeys | 显示在右侧框数据的key集合 | string\[] | \[] | -| titles | 标题集合,顺序从左至右 | string\[] | ['', ''] | +| titles | 标题集合,顺序从左至右 | string\[] | \['', ''] | | onChange | 选项在两栏之间转移时的回调函数 | (targetKeys, direction, moveKeys): void | | | onScroll | 选项列表滚动时的回调函数 | (direction, event): void | | | onSearch | 搜索框内容时改变时的回调函数 | (direction: 'left'\|'right', value: string): void | - | diff --git a/components/tree-select/index.en-US.md b/components/tree-select/index.en-US.md index 63c007aa3a..d0c2d38019 100644 --- a/components/tree-select/index.en-US.md +++ b/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 | - | | 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 | -| 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<{ id: string, pId: string, rootPId: null }> | 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\<{ 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\<{ id: string, pId: string, rootPId: null }> | false | | treeDefaultExpandAll | Whether to expand all treeNodes by default | boolean | false | | treeDefaultExpandedKeys | Default expanded treeNodes | string\[] | - | | treeExpandedKeys | Set expanded keys | string\[] | - | diff --git a/components/tree-select/index.zh-CN.md b/components/tree-select/index.zh-CN.md index b8fa670587..b891b1fa20 100644 --- a/components/tree-select/index.zh-CN.md +++ b/components/tree-select/index.zh-CN.md @@ -40,8 +40,8 @@ title: TreeSelect | suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | | treeCheckable | 显示 checkbox | boolean | false | | treeCheckStrictly | checkable 状态下节点选择完全受控(父子节点选中状态不再关联),会使得 `labelInValue` 强制为 true | boolean | false | -| 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<{ id: string, pId: string, rootPId: null }> | false | +| 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\<{ id: string, pId: string, rootPId: null }> | false | | treeDefaultExpandAll | 默认展开所有树节点 | boolean | false | | treeDefaultExpandedKeys | 默认展开的树节点 | string\[] | - | | treeExpandedKeys | 设置展开的树节点 | string\[] | - | diff --git a/package.json b/package.json index 37d3dc19fc..8f204b715e 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "warning": "~4.0.2" }, "devDependencies": { + "@ant-design/colors": "^2.0.0", "@types/classnames": "^2.2.6", "@types/prop-types": "^15.5.6", "@types/react": "~16.7.13", @@ -100,7 +101,6 @@ "@types/react-slick": "^0.23.2", "@yesmeck/offline-plugin": "^5.0.5", "ansi-styles": "^3.2.1", - "@ant-design/colors": "^2.0.0", "antd-theme-generator": "^1.1.4", "antd-tools": "^6.4.4", "babel-eslint": "^10.0.1", @@ -164,8 +164,11 @@ "react-sticky": "^6.0.3", "react-test-renderer": "^16.6.3", "react-virtualized": "~9.21.0", + "remark-cli": "^6.0.1", "remark-frontmatter": "^1.3.0", + "remark-lint": "^6.0.4", "remark-parse": "^6.0.0", + "remark-preset-lint-recommended": "^3.0.2", "remark-stringify": "^6.0.0", "remark-yaml-config": "^4.0.2", "reqwest": "^2.0.5", @@ -186,6 +189,7 @@ "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: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:style": "stylelint \"{site,components}/**/*.less\" --syntax less", "lint-fix:ts": "npm run tsc && antd-tools run ts-lint-fix",