gomtm 0.0.254 → 0.0.255
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.
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { Message, PartialMessage } from "@bufbuild/protobuf";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
2
|
+
import { Dispatch, PropsWithChildren } from "react";
|
|
3
3
|
import { MethodUnaryDescriptor } from "../connectquery";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
interface CurdDetailProps {
|
|
5
|
+
curdDetailPageData?: any | null;
|
|
6
|
+
methodGet: MethodUnaryDescriptor<any, any>;
|
|
7
|
+
params?: PartialMessage<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare function CurdDetailProvider<I extends Message<I>, O extends Message<O>>(props: CurdDetailProps & PropsWithChildren): import("react").JSX.Element;
|
|
10
|
+
export declare function useDetail(): {
|
|
11
|
+
setCurdDetailPageData: Dispatch<any>;
|
|
12
|
+
curdDetailPageData?: any;
|
|
13
|
+
methodGet: MethodUnaryDescriptor<any, any>;
|
|
14
|
+
params?: PartialMessage<any> | undefined;
|
|
6
15
|
};
|
|
7
|
-
export declare function CurdDetailProvider<I extends Message<I>, O extends Message<O>>(props: {
|
|
8
|
-
methodGet: MethodUnaryDescriptor<I, O>;
|
|
9
|
-
params?: PartialMessage<I>;
|
|
10
|
-
} & PropsWithChildren): import("react").JSX.Element;
|
|
11
16
|
export declare const DetailViewDataDlg: () => import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -1,33 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __spreadValues = (a, b) => {
|
|
8
|
+
for (var prop in b || (b = {}))
|
|
9
|
+
if (__hasOwnProp.call(b, prop))
|
|
10
|
+
__defNormalProp(a, prop, b[prop]);
|
|
11
|
+
if (__getOwnPropSymbols)
|
|
12
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
+
if (__propIsEnum.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
};
|
|
2
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { atom, useAtom } from "jotai";
|
|
4
|
-
import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
|
|
5
19
|
import { Dialog, DialogContent, DialogTrigger } from "mtxuilib/ui/dialog";
|
|
6
20
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
7
|
-
import { Suspense } from "react";
|
|
21
|
+
import { Suspense, createContext, useContext, useState } from "react";
|
|
8
22
|
import { useSuspenseQuery } from "../connectquery";
|
|
9
23
|
import { useMtmApp } from "../providers/GomtmProvider";
|
|
10
|
-
const
|
|
24
|
+
const CurdDetailContext = createContext(void 0);
|
|
11
25
|
function CurdDetailProvider(props) {
|
|
12
|
-
const {
|
|
26
|
+
const { params, methodGet, children } = props;
|
|
27
|
+
const [curdDetailPageData, setCurdDetailPageData] = useState(null);
|
|
13
28
|
const mtApp = useMtmApp();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
return /* @__PURE__ */ jsxs(CurdDetailContext.Provider, { value: {
|
|
30
|
+
params,
|
|
31
|
+
methodGet,
|
|
32
|
+
curdDetailPageData,
|
|
33
|
+
setCurdDetailPageData
|
|
34
|
+
}, children: [
|
|
18
35
|
children,
|
|
19
36
|
mtApp.isDebug && /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(DetailViewDataDlg, {}) })
|
|
20
37
|
] });
|
|
21
38
|
}
|
|
39
|
+
function useDetail() {
|
|
40
|
+
const mtappContext = useContext(CurdDetailContext);
|
|
41
|
+
if (mtappContext === void 0) {
|
|
42
|
+
throw new Error("useMtmApp must be used within a MtAppProvider");
|
|
43
|
+
}
|
|
44
|
+
return __spreadValues({}, mtappContext);
|
|
45
|
+
}
|
|
22
46
|
const DetailViewDataDlg = () => {
|
|
23
|
-
const
|
|
47
|
+
const detail = useDetail();
|
|
48
|
+
const query = useSuspenseQuery(detail.methodGet);
|
|
24
49
|
return /* @__PURE__ */ jsxs(Dialog, { children: [
|
|
25
50
|
/* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx(MtButton, { children: "DetailData" }) }),
|
|
26
|
-
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx("pre", { children: JSON.stringify(
|
|
51
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx("pre", { children: JSON.stringify(query.data, null, 2) }) })
|
|
27
52
|
] });
|
|
28
53
|
};
|
|
29
54
|
export {
|
|
30
55
|
CurdDetailProvider,
|
|
31
56
|
DetailViewDataDlg,
|
|
32
|
-
|
|
57
|
+
useDetail
|
|
33
58
|
};
|