@@ -14,6 +14,7 @@ import {
14
14
} from "./features/delegate" ;
15
15
import { TableRowSelectionContext } from "./features/row-selection" ;
16
16
import { useProArrayTableContext } from "./hooks" ;
17
+ import { useQueryListContext } from "src/query-list" ;
17
18
18
19
const justifyContentList : Required < React . CSSProperties > [ "justifyContent" ] [ ] = [
19
20
"space-around" ,
@@ -134,10 +135,12 @@ export interface CommonShadowPopup extends IShadowFormOptions {
134
135
act ?: string ;
135
136
onCancel ?: (
136
137
ctx : ReturnType < typeof useProArrayTableContext > ,
138
+ querylistCtx : ReturnType < typeof useQueryListContext > ,
137
139
) => void | Promise < void > ;
138
140
onOk ?: (
139
141
data : any ,
140
142
ctx : ReturnType < typeof useProArrayTableContext > ,
143
+ querylistCtx : ReturnType < typeof useQueryListContext > ,
141
144
) => void | Promise < void > ;
142
145
}
143
146
@@ -155,6 +158,7 @@ export const ArrayTableShowModal: React.FC<
155
158
const visible = delegate . act === act && delegate . index > - 1 ;
156
159
const pending = useRef ( false ) ;
157
160
const ctx = useProArrayTableContext ( ) ;
161
+ const queryListCtx = useQueryListContext ( ) ;
158
162
159
163
useEffect ( ( ) => {
160
164
if ( visible ) {
@@ -196,15 +200,20 @@ export const ArrayTableShowModal: React.FC<
196
200
if ( pending . current ) return ;
197
201
return form
198
202
. reset ( )
199
- . then ( ( ) => props ?. onCancel ?.( ctx ) )
203
+ . then ( ( ) => props ?. onCancel ?.( ctx , queryListCtx ) )
200
204
. then ( ( ) => reset ( ) ) ;
201
205
} }
202
206
onOk = { ( ) => {
203
207
if ( pending . current ) return ;
208
+ pending . current = true ;
204
209
return form
205
210
. submit ( )
206
211
. then ( ( data ) => {
207
- return props ?. onOk ?.( data , ctx ) ;
212
+ return Promise . resolve (
213
+ props ?. onOk ?.( data , ctx , queryListCtx ) ,
214
+ ) . finally ( ( ) => {
215
+ pending . current = false ;
216
+ } ) ;
208
217
} )
209
218
. then ( ( ) => reset ( ) ) ;
210
219
} }
0 commit comments