fix(components): [table] inaccurate type of toggleRowSelection (#17687)

This commit is contained in:
dopamine 2024-07-29 13:40:05 +08:00 committed by GitHub
parent 506b5f84aa
commit c76cc8bc92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -321,7 +321,7 @@ table/table-layout
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| clearSelection | used in multiple selection Table, clear user selection | ^[Function]`() => void` |
| getSelectionRows | returns the currently selected rows | ^[Function]`() => void` |
| toggleRowSelection | used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can directly set if this row is selected | ^[Function]`(row: any, selected: boolean) => void` |
| toggleRowSelection | used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can directly set if this row is selected | ^[Function]`(row: any, selected?: boolean) => void` |
| toggleAllSelection | used in multiple selection Table, toggle select all and deselect all | ^[Function]`() => void` |
| toggleRowExpansion | used in expandable Table or tree Table, toggle if a certain row is expanded. With the second parameter, you can directly set if this row is expanded or collapsed | ^[Function]`(row: any, expanded?: boolean) => void` |
| setCurrentRow | used in single selection Table, set a certain row selected. If called without any parameter, it will clear selection | ^[Function]`(row: any) => void` |

View File

@ -190,7 +190,7 @@ function useWatcher<T>() {
const toggleRowSelection = (
row: T,
selected = undefined,
selected?: boolean,
emitChange = true
) => {
const changed = toggleRowStatus(selection.value, row, selected)

View File

@ -8,7 +8,7 @@ function useUtils<T>(store: Store<T>) {
const getSelectionRows = () => {
return store.getSelectionRows()
}
const toggleRowSelection = (row: T, selected: boolean) => {
const toggleRowSelection = (row: T, selected?: boolean) => {
store.toggleRowSelection(row, selected, false)
store.updateAllSelected()
}

View File

@ -263,7 +263,7 @@ export function compose(...funcs) {
export function toggleRowStatus<T>(
statusArr: T[],
row: T,
newVal: boolean
newVal?: boolean
): boolean {
let changed = false
const index = statusArr.indexOf(row)