gomtm 0.0.226 → 0.0.228
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.
|
@@ -35,7 +35,7 @@ import { useMutation, useSuspenseInfiniteQuery } from "../connectquery";
|
|
|
35
35
|
import CurdCreatePanel, { CurdCreatePanelTriggerButton, openCurdCreatePanelAtom } from "./create/CurdCreatePanel";
|
|
36
36
|
import { activateItemAtom, createMethodSigAtom, openCreatePanelAtom, openRemovePanelAtom, removeMethodSigAtom } from "./curd.atoms";
|
|
37
37
|
import { DlgCurdDebugInfo, DlgCurdDebugInfoTriggerButton, openDlgCurdDebugInfoAtom } from "./dlg/DlgCurdDebugInfo";
|
|
38
|
-
import { CurdEditPanelTriggerButton, openCurdEditPanelAtom } from "./edit/CurdEditPanel";
|
|
38
|
+
import CurdEditPanel, { CurdEditPanelTriggerButton, openCurdEditPanelAtom } from "./edit/CurdEditPanel";
|
|
39
39
|
import { ListItemView } from "./list-item/ListItem";
|
|
40
40
|
import { ListLayout } from "./list-item/ListLayout";
|
|
41
41
|
const listQueryAtom = atom(null);
|
|
@@ -158,6 +158,7 @@ const ListViewActions = () => {
|
|
|
158
158
|
/* @__PURE__ */ jsx(PanelCreate, {}),
|
|
159
159
|
/* @__PURE__ */ jsx(DlgCurdDebugInfo, {}),
|
|
160
160
|
/* @__PURE__ */ jsx(CurdCreatePanel, {}),
|
|
161
|
+
/* @__PURE__ */ jsx(CurdEditPanel, {}),
|
|
161
162
|
/* @__PURE__ */ jsxs("div", { className: "bg-yellow-100 p-2", children: [
|
|
162
163
|
/* @__PURE__ */ jsx(DlgCurdDebugInfoTriggerButton, {}),
|
|
163
164
|
/* @__PURE__ */ jsx(CurdEditPanelTriggerButton, {}),
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { atom, useAtom } from "jotai";
|
|
4
|
-
import { useMtRouter } from "mtxuilib/hooks/use-router";
|
|
5
4
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
6
5
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
7
6
|
const openCurdEditPanelAtom = atom(false);
|
|
8
7
|
function CurdEditPanel() {
|
|
9
|
-
const router = useMtRouter();
|
|
10
8
|
const [openCurdEditPanel, setOpenCurdEditPanel] = useAtom(openCurdEditPanelAtom);
|
|
11
9
|
return /* @__PURE__ */ jsx(Dialog, { open: openCurdEditPanel, onOpenChange: setOpenCurdEditPanel, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogTitle, { children: " Edit " }) }) });
|
|
12
10
|
}
|
|
13
11
|
const CurdEditPanelTriggerButton = () => {
|
|
14
|
-
const [
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const [openCurdEditPanel, setOpenCurdEditPanel] = useAtom(openCurdEditPanelAtom);
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx("pre", { children: openCurdEditPanel }),
|
|
15
|
+
/* @__PURE__ */ jsxs(MtButton, { onClick: () => {
|
|
16
|
+
setOpenCurdEditPanel(true);
|
|
17
|
+
}, children: [
|
|
18
|
+
"Edit(",
|
|
19
|
+
JSON.stringify(openCurdEditPanel, null, 2),
|
|
20
|
+
")"
|
|
21
|
+
] })
|
|
22
|
+
] });
|
|
18
23
|
};
|
|
19
24
|
export {
|
|
20
25
|
CurdEditPanelTriggerButton,
|
package/dist/esm/mtmFetcher.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ServiceType } from "@bufbuild/protobuf";
|
|
2
2
|
export declare const ssrGetBackendUrl: () => string;
|
|
3
|
+
export declare const gomtmApiUrl: () => string;
|
|
3
4
|
export declare function createMtmServiceClient<T extends ServiceType>(service: T, url?: string): import("@connectrpc/connect").PromiseClient<T>;
|
|
4
5
|
export declare function createMtmServiceClientByName<T extends ServiceType>(svcName: string, url?: string): import("@connectrpc/connect").PromiseClient<ServiceType>;
|
|
5
6
|
type CustomRequestInit = RequestInit & {
|
package/dist/esm/mtmFetcher.js
CHANGED
|
@@ -51,24 +51,22 @@ const ssrGetBackendUrl = () => {
|
|
|
51
51
|
}
|
|
52
52
|
return "";
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
const gomtmApiUrl = () => {
|
|
55
55
|
const baseUrl = ssrGetBackendUrl();
|
|
56
56
|
const apiUrl = new URL(MTM_API_PREFIX, baseUrl).toString();
|
|
57
57
|
console.info("gomtm apiUrl:", baseUrl);
|
|
58
|
+
return apiUrl;
|
|
59
|
+
};
|
|
60
|
+
function createMtmServiceClient(service, url) {
|
|
58
61
|
return createPromiseClient(
|
|
59
62
|
service,
|
|
60
63
|
createConnectTransport({
|
|
61
|
-
baseUrl:
|
|
64
|
+
baseUrl: gomtmApiUrl(),
|
|
62
65
|
fetch: gomtmFetcher()
|
|
63
66
|
})
|
|
64
67
|
);
|
|
65
68
|
}
|
|
66
69
|
function createMtmServiceClientByName(svcName, url) {
|
|
67
|
-
const baseUrl = url || process.env.MTM_BACKEND;
|
|
68
|
-
if (!baseUrl) {
|
|
69
|
-
throw new Error("missing mtm api url,\xB7MTM_BACKEND\xB7");
|
|
70
|
-
}
|
|
71
|
-
console.info("gomtm baseUrl:", baseUrl);
|
|
72
70
|
let svcType = void 0;
|
|
73
71
|
for (const a of allServices) {
|
|
74
72
|
if (a.typeName == svcName) {
|
|
@@ -81,7 +79,7 @@ function createMtmServiceClientByName(svcName, url) {
|
|
|
81
79
|
return createPromiseClient(
|
|
82
80
|
svcType,
|
|
83
81
|
createConnectTransport({
|
|
84
|
-
baseUrl,
|
|
82
|
+
baseUrl: gomtmApiUrl(),
|
|
85
83
|
fetch: gomtmFetcher()
|
|
86
84
|
})
|
|
87
85
|
);
|
|
@@ -136,6 +134,7 @@ const gomtmFetcher = (initGlobal) => {
|
|
|
136
134
|
export {
|
|
137
135
|
createMtmServiceClient,
|
|
138
136
|
createMtmServiceClientByName,
|
|
137
|
+
gomtmApiUrl,
|
|
139
138
|
gomtmFetcher,
|
|
140
139
|
ssrGetBackendUrl
|
|
141
140
|
};
|