Skip to content

Commit 4ef5b5e

Browse files
committed
feat(dialog-select): 支持透传selectAll、selectChange和radioChange事件
1 parent b76c76d commit 4ef5b5e

File tree

1 file changed

+18
-3
lines changed
  • packages/renderless/src/dialog-select

1 file changed

+18
-3
lines changed

packages/renderless/src/dialog-select/index.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const queryGridData =
6161

6262
export const multiGridSelectAll =
6363
({ api, props, state }) =>
64-
({ selection, checked }) => {
64+
({ selection, checked, $table }, event) => {
6565
if (checked) {
6666
arrayEach(selection, (item) => {
6767
const index = findIndexOf(state.selectedValues, (val) => val === item[props.valueField])
@@ -87,11 +87,16 @@ export const multiGridSelectAll =
8787
}
8888

8989
api.selectedBoxInit()
90+
91+
// 透传配置式表格selectAll事件
92+
if (props.gridOp?.events?.selectAll) {
93+
props.gridOp.events.selectAll({ selection, checked, $table }, event)
94+
}
9095
}
9196

9297
export const multiGridSelectChange =
9398
({ api, props, state, vm }) =>
94-
({ row, checked }) => {
99+
({ row, checked, $table }, event) => {
95100
const property = props.valueField
96101
const grid = vm.$refs?.multiGrid
97102
const selectedRows = grid.getSelectRecords()
@@ -130,6 +135,11 @@ export const multiGridSelectChange =
130135
}
131136

132137
api.selectedBoxInit()
138+
139+
// 透传配置式表格selectChange事件
140+
if (props.gridOp?.events?.selectChange) {
141+
props.gridOp.events.selectChange({ row, checked, $table }, event)
142+
}
133143
}
134144

135145
export const selectedBoxInit =
@@ -567,10 +577,15 @@ export const multiTreeRadio =
567577

568578
export const multiGridRadioChange =
569579
({ props, state }) =>
570-
({ row }) => {
580+
({ row, $table }, event) => {
571581
state.selectedValues = [row[props.valueField]]
572582
state.selectedDatas = [row]
573583
state.selectedChanged = true
584+
585+
// 透传配置式表格radioChange事件
586+
if (props.gridOp?.events?.radioChange) {
587+
props.gridOp.events.radioChange({ row, $table }, event)
588+
}
574589
}
575590

576591
export const watchMulti =

0 commit comments

Comments
 (0)