gomtm 0.0.327 → 0.0.328
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,8 @@ import { flexRender } from "mtxuilib/lib/render";
|
|
|
4
4
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
5
5
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
6
6
|
import { FullScreenPanel } from "mtxuilib/ui/ui-mt/FullScreenEditPanel";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { useGomtmSuspenseQuery } from "../../gomtmQuery";
|
|
7
9
|
import { useListview } from "../listview/list-store";
|
|
8
10
|
function CurdEditPanel(props) {
|
|
9
11
|
const { fullScreen } = props;
|
|
@@ -14,7 +16,7 @@ function CurdEditPanel(props) {
|
|
|
14
16
|
return null;
|
|
15
17
|
}
|
|
16
18
|
if (fullScreen) {
|
|
17
|
-
return /* @__PURE__ */ jsx(FullScreenPanel, { children: openEdit && editRender && flexRender(editRender, {}) });
|
|
19
|
+
return /* @__PURE__ */ jsx(WithLoadGetData, { children: /* @__PURE__ */ jsx(FullScreenPanel, { children: openEdit && editRender && flexRender(editRender, {}) }) });
|
|
18
20
|
}
|
|
19
21
|
return /* @__PURE__ */ jsx(Dialog, { open: openEdit, onOpenChange: setOpenEdit, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
20
22
|
/* @__PURE__ */ jsx(DialogTitle, { children: " Edit " }),
|
|
@@ -24,6 +26,26 @@ function CurdEditPanel(props) {
|
|
|
24
26
|
}, children: "xxxxx" })
|
|
25
27
|
] }) });
|
|
26
28
|
}
|
|
29
|
+
const WithLoadGetData = (props) => {
|
|
30
|
+
const { children } = props;
|
|
31
|
+
const methodGet = useListview((x) => x.methodGet);
|
|
32
|
+
const svc = useListview((x) => x.svc);
|
|
33
|
+
const activateItem = useListview((x) => x.activateItem);
|
|
34
|
+
const setDetailData = useListview((x) => x.setDetailData);
|
|
35
|
+
const detailQuery = useGomtmSuspenseQuery(svc, methodGet, {
|
|
36
|
+
id: parseInt(activateItem.id)
|
|
37
|
+
});
|
|
38
|
+
useMemo(() => {
|
|
39
|
+
setDetailData(detailQuery.data);
|
|
40
|
+
}, [detailQuery.data, setDetailData]);
|
|
41
|
+
if (detailQuery.isLoading) {
|
|
42
|
+
return /* @__PURE__ */ jsx("div", { children: "loading detail" });
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-red-200 p-2", children: [
|
|
45
|
+
"WithLoadGetData",
|
|
46
|
+
children
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
27
49
|
const CurdEditPanelTriggerButton = () => {
|
|
28
50
|
const setOpenEdit = useListview((x) => x.setOpenEdit);
|
|
29
51
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
@@ -29,6 +29,7 @@ export interface ListViewState extends ListViewStateProps {
|
|
|
29
29
|
loadListData: () => Promise<any>;
|
|
30
30
|
nextPage: () => void;
|
|
31
31
|
setEditRender: (a: Renderable<any>) => void;
|
|
32
|
+
setDetailData: (detailData: any) => void;
|
|
32
33
|
}
|
|
33
34
|
export declare const listViewContext: import("react").Context<import("zustand").StoreApi<ListViewState> | null>;
|
|
34
35
|
type BearProviderProps = React.PropsWithChildren<ListViewStateProps>;
|
|
@@ -96,7 +96,8 @@ const createListviewStore = (initProps) => {
|
|
|
96
96
|
}),
|
|
97
97
|
nextPage: () => {
|
|
98
98
|
},
|
|
99
|
-
setEditRender: (editRender) => set({ editRender })
|
|
99
|
+
setEditRender: (editRender) => set({ editRender }),
|
|
100
|
+
setDetailData: (detailData) => set({ detailData })
|
|
100
101
|
}));
|
|
101
102
|
};
|
|
102
103
|
const listViewContext = createContext(null);
|