Skip to content

Commit 00e44a5

Browse files
committed
feat: 🎸 pro addition with querylist
1 parent 3016eb0 commit 00e44a5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/pro-array-table/mixin.pro.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from "./features/delegate";
1515
import { TableRowSelectionContext } from "./features/row-selection";
1616
import { useProArrayTableContext } from "./hooks";
17+
import { useQueryListContext } from "src/query-list";
1718

1819
const justifyContentList: Required<React.CSSProperties>["justifyContent"][] = [
1920
"space-around",
@@ -134,10 +135,12 @@ export interface CommonShadowPopup extends IShadowFormOptions {
134135
act?: string;
135136
onCancel?: (
136137
ctx: ReturnType<typeof useProArrayTableContext>,
138+
querylistCtx: ReturnType<typeof useQueryListContext>,
137139
) => void | Promise<void>;
138140
onOk?: (
139141
data: any,
140142
ctx: ReturnType<typeof useProArrayTableContext>,
143+
querylistCtx: ReturnType<typeof useQueryListContext>,
141144
) => void | Promise<void>;
142145
}
143146

@@ -155,6 +158,7 @@ export const ArrayTableShowModal: React.FC<
155158
const visible = delegate.act === act && delegate.index > -1;
156159
const pending = useRef(false);
157160
const ctx = useProArrayTableContext();
161+
const queryListCtx = useQueryListContext();
158162

159163
useEffect(() => {
160164
if (visible) {
@@ -196,15 +200,20 @@ export const ArrayTableShowModal: React.FC<
196200
if (pending.current) return;
197201
return form
198202
.reset()
199-
.then(() => props?.onCancel?.(ctx))
203+
.then(() => props?.onCancel?.(ctx, queryListCtx))
200204
.then(() => reset());
201205
}}
202206
onOk={() => {
203207
if (pending.current) return;
208+
pending.current = true;
204209
return form
205210
.submit()
206211
.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+
});
208217
})
209218
.then(() => reset());
210219
}}

0 commit comments

Comments
 (0)