Skip to content

Commit

Permalink
docs(useSelections): modify the type and desc of params (alibaba#2083)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyib authored Mar 1, 2023
1 parent 7162ae4 commit 2ff3eb4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
28 changes: 14 additions & 14 deletions packages/hooks/src/useSelections/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ const result: Result = useSelections<T>(items: T[], defaultSelected?: T[]);

### Result

| Property | Description | Type |
| ----------------- | --------------------------- | ----------------------- |
| selected | Selected Items | `array` |
| allSelected | Is all items selected | `boolean` |
| noneSelected | Is no item selected | `boolean` |
| partiallySelected | Is partially items selected | `boolean` |
| isSelected | Whether item is selected | `(value: T) => boolean` |
| setSelected | Set selected items | `(value: T[]) => void` |
| select | Select item | `(value: T) => void` |
| unSelect | UnSelect item | `(value: T) => void` |
| toggle | Toggle item select status | `(value: T) => void` |
| selectAll | Select all items | `() => void` |
| unSelectAll | UnSelect all items | `() => void` |
| toggleAll | Toggle select all items | `() => void` |
| Property | Description | Type |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| selected | Selected Items | `T[]` |
| allSelected | Is all items selected | `boolean` |
| noneSelected | Is no item selected | `boolean` |
| partiallySelected | Is partially items selected | `boolean` |
| isSelected | Whether item is selected | `(value: T) => boolean` |
| setSelected | Select multiple items. When executed multiple times, the later return value overwrites the previous one, so if you want to merge the results of multiple operations, you need to do this manually: `setSelected((oldArray) => oldArray.concat(newArray))` | `(value: T[]) => void \| (value: (prevState: T[]) => T[]) => void` |
| select | Select single item | `(value: T) => void` |
| unSelect | UnSelect single item | `(value: T) => void` |
| toggle | Toggle single item select status | `(value: T) => void` |
| selectAll | Select all items | `() => void` |
| unSelectAll | UnSelect all items | `() => void` |
| toggleAll | Toggle select all items | `() => void` |
28 changes: 14 additions & 14 deletions packages/hooks/src/useSelections/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ const result: Result = useSelections<T>(items: T[], defaultSelected?: T[]);

### Result

| 参数 | 说明 | 类型 |
| ----------------- | ------------------ | ----------------------- |
| selected | 已经选择的元素 | `array` |
| allSelected | 是否全选 | `boolean` |
| noneSelected | 是否一个都没有选择 | `boolean` |
| partiallySelected | 是否半选 | `boolean` |
| isSelected | 是否被选择 | `(value: T) => boolean` |
| setSelected | 设置选择的元素 | `(value: T[]) => void` |
| select | 选择元素 | `(value: T) => void` |
| unSelect | 取消选择元素 | `(value: T) => void` |
| toggle | 反选元素 | `(value: T) => void` |
| selectAll | 选择全部元素 | `() => void` |
| unSelectAll | 取消选择全部元素 | `() => void` |
| toggleAll | 反选全部元素 | `() => void` |
| 参数 | 说明 | 类型 |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| selected | 已经选择的元素 | `T[]` |
| allSelected | 是否全选 | `boolean` |
| noneSelected | 是否一个都没有选择 | `boolean` |
| partiallySelected | 是否半选 | `boolean` |
| isSelected | 是否被选择 | `(value: T) => boolean` |
| setSelected | 选择多个元素。多次执行时,后面的返回值会覆盖前面的,因此如果希望合并多次操作的结果,需要手动处理:`setSelected((oldArray) => oldArray.concat(newArray))` | `(value: T[]) => void \| (value: (prevState: T[]) => T[]) => void` |
| select | 选择单个元素 | `(value: T) => void` |
| unSelect | 取消选择单个元素 | `(value: T) => void` |
| toggle | 反选单个元素 | `(value: T) => void` |
| selectAll | 选择全部元素 | `() => void` |
| unSelectAll | 取消选择全部元素 | `() => void` |
| toggleAll | 反选全部元素 | `() => void` |

0 comments on commit 2ff3eb4

Please sign in to comment.