mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-03 11:47:48 +08:00
fix(components): [table] inaccurate type of toggleRowSelection
(#17687)
This commit is contained in:
parent
506b5f84aa
commit
c76cc8bc92
@ -321,7 +321,7 @@ table/table-layout
|
|||||||
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||||
| clearSelection | used in multiple selection Table, clear user selection | ^[Function]`() => void` |
|
| clearSelection | used in multiple selection Table, clear user selection | ^[Function]`() => void` |
|
||||||
| getSelectionRows | returns the currently selected rows | ^[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` |
|
| 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` |
|
| 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` |
|
| setCurrentRow | used in single selection Table, set a certain row selected. If called without any parameter, it will clear selection | ^[Function]`(row: any) => void` |
|
||||||
|
@ -190,7 +190,7 @@ function useWatcher<T>() {
|
|||||||
|
|
||||||
const toggleRowSelection = (
|
const toggleRowSelection = (
|
||||||
row: T,
|
row: T,
|
||||||
selected = undefined,
|
selected?: boolean,
|
||||||
emitChange = true
|
emitChange = true
|
||||||
) => {
|
) => {
|
||||||
const changed = toggleRowStatus(selection.value, row, selected)
|
const changed = toggleRowStatus(selection.value, row, selected)
|
||||||
|
@ -8,7 +8,7 @@ function useUtils<T>(store: Store<T>) {
|
|||||||
const getSelectionRows = () => {
|
const getSelectionRows = () => {
|
||||||
return store.getSelectionRows()
|
return store.getSelectionRows()
|
||||||
}
|
}
|
||||||
const toggleRowSelection = (row: T, selected: boolean) => {
|
const toggleRowSelection = (row: T, selected?: boolean) => {
|
||||||
store.toggleRowSelection(row, selected, false)
|
store.toggleRowSelection(row, selected, false)
|
||||||
store.updateAllSelected()
|
store.updateAllSelected()
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ export function compose(...funcs) {
|
|||||||
export function toggleRowStatus<T>(
|
export function toggleRowStatus<T>(
|
||||||
statusArr: T[],
|
statusArr: T[],
|
||||||
row: T,
|
row: T,
|
||||||
newVal: boolean
|
newVal?: boolean
|
||||||
): boolean {
|
): boolean {
|
||||||
let changed = false
|
let changed = false
|
||||||
const index = statusArr.indexOf(row)
|
const index = statusArr.indexOf(row)
|
||||||
|
Loading…
Reference in New Issue
Block a user