gomtm 0.0.283 → 0.0.285
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.
- package/dist/esm/components/SSR.js +7 -4
- package/dist/esm/consts.d.ts +1 -0
- package/dist/esm/consts.js +2 -0
- package/dist/esm/curd/listview/ListViewProvider.js +55 -11
- package/dist/esm/curd/listview/MtListView.js +3 -50
- package/dist/esm/curd/listview/listview-layouts/default/index.js +2 -5
- package/dist/esm/gomtmQuery.d.ts +0 -10
- package/dist/esm/gomtmQuery.js +2 -39
- package/dist/esm/ly/LayoutBase.js +14 -6
- package/dist/esm/mtmFetcher.d.ts +9 -0
- package/dist/esm/mtmFetcher.js +19 -2
- package/dist/esm/validations/spContentModi.d.ts +4 -4
- package/dist/esm/validations/spRoute.d.ts +4 -4
- package/dist/esm/validations/user.d.ts +2 -2
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/esm/components/MtUnaryCallErrorView.d.ts +0 -7
- package/dist/esm/components/MtUnaryCallErrorView.js +0 -16
- package/dist/esm/curd/ListViewPage.d.ts +0 -4
- package/dist/esm/curd/ListViewPage.js +0 -50
- package/dist/esm/curd/ListViewProvider.d.ts +0 -64
- package/dist/esm/curd/ListViewProvider.js +0 -198
- package/dist/esm/curd/MtListView.d.ts +0 -3
- package/dist/esm/curd/MtListView.js +0 -50
- package/dist/esm/curd/listview/listview-layouts/listview-demolayout/index.d.ts +0 -2
- package/dist/esm/curd/listview/listview-layouts/listview-demolayout/index.js +0 -9
|
@@ -36,15 +36,18 @@ var __async = (__this, __arguments, generator) => {
|
|
|
36
36
|
};
|
|
37
37
|
import { jsx } from "react/jsx-runtime";
|
|
38
38
|
import { HydrationBoundary, QueryClient, dehydrate } from "@tanstack/react-query";
|
|
39
|
-
import { goMtmQueryFn } from "../
|
|
40
|
-
import { createInfiniteQueryKey } from "../mtmFetcher";
|
|
39
|
+
import { createInfiniteQueryKey, goMtmQueryFn } from "../mtmFetcher";
|
|
41
40
|
function PrefetchConnectInfiniteQuery(props) {
|
|
42
41
|
return __async(this, null, function* () {
|
|
43
42
|
const { svc, method, input, children } = props;
|
|
44
43
|
const queryClient = new QueryClient();
|
|
44
|
+
const queryKey = createInfiniteQueryKey(svc, method, input);
|
|
45
|
+
const data = yield goMtmQueryFn({ svc, method, input });
|
|
45
46
|
yield queryClient.prefetchInfiniteQuery({
|
|
46
|
-
queryKey
|
|
47
|
-
queryFn: (k) =>
|
|
47
|
+
queryKey,
|
|
48
|
+
queryFn: (k) => __async(this, null, function* () {
|
|
49
|
+
return data;
|
|
50
|
+
}),
|
|
48
51
|
initialPageParam: __spreadValues({}, input)
|
|
49
52
|
});
|
|
50
53
|
const dehydratedState = dehydrate(queryClient);
|
package/dist/esm/consts.d.ts
CHANGED
|
@@ -28,5 +28,6 @@ export declare const MEMBER_ROLE = "member";
|
|
|
28
28
|
export declare const TRPC_API_PREFIX = "/api.v1/trpc";
|
|
29
29
|
export declare const HOTKEY_Debug = "alt+j";
|
|
30
30
|
export declare const HOTKEY_Switchlayout = "alt+l";
|
|
31
|
+
export declare const HOTKEY_Listview_Switchlayout = "alt+m";
|
|
31
32
|
export declare const HOTKEY_ListViewCMDK = "alt+c";
|
|
32
33
|
export declare const CONST_debounce_INPUT = 300;
|
package/dist/esm/consts.js
CHANGED
|
@@ -28,6 +28,7 @@ const MEMBER_ROLE = "member";
|
|
|
28
28
|
const TRPC_API_PREFIX = "/api.v1/trpc";
|
|
29
29
|
const HOTKEY_Debug = "alt+j";
|
|
30
30
|
const HOTKEY_Switchlayout = "alt+l";
|
|
31
|
+
const HOTKEY_Listview_Switchlayout = "alt+m";
|
|
31
32
|
const HOTKEY_ListViewCMDK = "alt+c";
|
|
32
33
|
const CONST_debounce_INPUT = 300;
|
|
33
34
|
export {
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
ExtKey_Hostname,
|
|
46
47
|
HOTKEY_Debug,
|
|
47
48
|
HOTKEY_ListViewCMDK,
|
|
49
|
+
HOTKEY_Listview_Switchlayout,
|
|
48
50
|
HOTKEY_Switchlayout,
|
|
49
51
|
HeaderMtmApi,
|
|
50
52
|
HeaderMtmHost,
|
|
@@ -44,17 +44,26 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel
|
|
|
44
44
|
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
|
|
45
45
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
46
46
|
import { Suspense, createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
47
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
47
48
|
import { MtmErrorView } from "../../components/MtmErrorView";
|
|
48
|
-
import { CONST_debounce_INPUT } from "../../consts";
|
|
49
|
+
import { CONST_debounce_INPUT, HOTKEY_Listview_Switchlayout } from "../../consts";
|
|
49
50
|
import { useGomtmMutation, useGomtmSuspenseInfiniteQuery } from "../../gomtmQuery";
|
|
50
51
|
import { useMtmApp } from "../../providers/GomtmProvider";
|
|
51
52
|
import CurdCreatePanel, { CurdCreatePanelTriggerButton } from "../create/CurdCreatePanel";
|
|
52
53
|
import CurdEditPanel, { CurdEditPanelTriggerButton } from "../edit/CurdEditPanel";
|
|
53
54
|
import { ListItemView } from "../list-item/ListItem";
|
|
54
55
|
import { ListLayout } from "../list-item/ListLayout";
|
|
56
|
+
import { ListViewLayoutDefault } from "./listview-layouts/default";
|
|
57
|
+
import ListViewLayoutDemo from "./listview-layouts/listviewlayout-demo";
|
|
58
|
+
const ALL_Layouts = [
|
|
59
|
+
"demo",
|
|
60
|
+
"default",
|
|
61
|
+
"none"
|
|
62
|
+
];
|
|
55
63
|
const commonListViewContext = createContext(void 0);
|
|
56
64
|
function ListViewProvider(props) {
|
|
57
|
-
|
|
65
|
+
var _a;
|
|
66
|
+
const { children, svc, methodList, methodDelete, slugPath, methodCreate, methodGet, params } = props;
|
|
58
67
|
const mtapp = useMtmApp();
|
|
59
68
|
const [_svc, setSvc] = useState(svc);
|
|
60
69
|
const [openRemove, setOpenRemove] = useState(false);
|
|
@@ -62,15 +71,13 @@ function ListViewProvider(props) {
|
|
|
62
71
|
const [activateItem, setActivateItem] = useState(void 0);
|
|
63
72
|
const [openEdit, setOpenEdit] = useState(false);
|
|
64
73
|
const [openDebug, setOpenDebug] = useState(false);
|
|
65
|
-
const [_params, _setParams] = useState(
|
|
74
|
+
const [_params, _setParams] = useState(params);
|
|
66
75
|
const [detailData, setDetailData] = useState(void 0);
|
|
67
76
|
const [layout, setLayout] = useState("default");
|
|
68
|
-
const
|
|
69
|
-
var
|
|
70
|
-
return {
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
}, [mtapp.globalSearchParams]);
|
|
77
|
+
const __params = useMemo(() => {
|
|
78
|
+
var _a2, _b;
|
|
79
|
+
return __spreadValues(__spreadValues({}, params), ((_a2 = mtapp.globalSearchParams) == null ? void 0 : _a2.q) && { q: (_b = mtapp.globalSearchParams) == null ? void 0 : _b.q });
|
|
80
|
+
}, [(_a = mtapp.globalSearchParams) == null ? void 0 : _a.q, params]);
|
|
74
81
|
const setParams = useCallback(debounce((values) => {
|
|
75
82
|
_setParams(values);
|
|
76
83
|
}, CONST_debounce_INPUT), [_setParams]);
|
|
@@ -91,13 +98,18 @@ function ListViewProvider(props) {
|
|
|
91
98
|
setOpenEdit,
|
|
92
99
|
openDebug,
|
|
93
100
|
setOpenDebug,
|
|
94
|
-
params,
|
|
101
|
+
params: __params,
|
|
95
102
|
setParams,
|
|
96
103
|
detailData,
|
|
97
104
|
setDetailData,
|
|
98
105
|
layout,
|
|
99
106
|
setLayout
|
|
100
|
-
}, children
|
|
107
|
+
}, children: /* @__PURE__ */ jsxs(ListViewLayout, { children: [
|
|
108
|
+
" ",
|
|
109
|
+
children,
|
|
110
|
+
" ",
|
|
111
|
+
/* @__PURE__ */ jsx(ListViewLayoutSwitch, {})
|
|
112
|
+
] }) });
|
|
101
113
|
}
|
|
102
114
|
function useListView() {
|
|
103
115
|
const ctx = useContext(commonListViewContext);
|
|
@@ -189,6 +201,38 @@ const ListViewActions = () => {
|
|
|
189
201
|
] })
|
|
190
202
|
] });
|
|
191
203
|
};
|
|
204
|
+
const ListViewLayout = (props) => {
|
|
205
|
+
const listView = useListView();
|
|
206
|
+
const { children } = props;
|
|
207
|
+
const Layout = useMemo(() => {
|
|
208
|
+
switch (listView.layout) {
|
|
209
|
+
case "demo":
|
|
210
|
+
return ListViewLayoutDemo;
|
|
211
|
+
default:
|
|
212
|
+
return ListViewLayoutDefault;
|
|
213
|
+
}
|
|
214
|
+
}, [listView.layout]);
|
|
215
|
+
return /* @__PURE__ */ jsx(Layout, { children });
|
|
216
|
+
};
|
|
217
|
+
const ListViewLayoutSwitch = () => {
|
|
218
|
+
const listview = useListView();
|
|
219
|
+
const [open, setOpen] = useState(false);
|
|
220
|
+
useHotkeys(HOTKEY_Listview_Switchlayout, () => {
|
|
221
|
+
setOpen((pre) => !pre);
|
|
222
|
+
}, [open, setOpen]);
|
|
223
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
224
|
+
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
225
|
+
"LayoutSwitch,",
|
|
226
|
+
listview.layout
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout) => {
|
|
229
|
+
return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
230
|
+
listview.setLayout(layout);
|
|
231
|
+
setOpen(false);
|
|
232
|
+
}, children: layout }, layout);
|
|
233
|
+
}) })
|
|
234
|
+
] }) });
|
|
235
|
+
};
|
|
192
236
|
export {
|
|
193
237
|
CommonListView,
|
|
194
238
|
ListViewActions,
|
|
@@ -29,22 +29,10 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import {
|
|
33
|
-
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
34
|
-
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
35
|
-
import { useState } from "react";
|
|
36
|
-
import { useHotkeys } from "react-hotkeys-hook";
|
|
32
|
+
import { jsx } from "react/jsx-runtime";
|
|
37
33
|
import { PrefetchConnectInfiniteQuery } from "../../components/SSR";
|
|
38
|
-
import { HOTKEY_Switchlayout } from "../../consts";
|
|
39
34
|
import { siteList } from "../../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
|
|
40
|
-
import { ListViewProvider
|
|
41
|
-
import { ListViewLayoutDefault } from "./listview-layouts/default";
|
|
42
|
-
import ListViewLayoutDemo from "./listview-layouts/listviewlayout-demo";
|
|
43
|
-
const ALL_Layouts = [
|
|
44
|
-
"demo",
|
|
45
|
-
"default",
|
|
46
|
-
"none"
|
|
47
|
-
];
|
|
35
|
+
import { ListViewProvider } from "./ListViewProvider";
|
|
48
36
|
function MtListView(props) {
|
|
49
37
|
const _a = props, { children } = _a, etc = __objRest(_a, ["children"]);
|
|
50
38
|
return /* @__PURE__ */ jsx(ListViewProvider, __spreadProps(__spreadValues({}, etc), { children: /* @__PURE__ */ jsx(
|
|
@@ -53,45 +41,10 @@ function MtListView(props) {
|
|
|
53
41
|
svc: siteList.service.typeName,
|
|
54
42
|
method: siteList.name,
|
|
55
43
|
input: etc.params,
|
|
56
|
-
children
|
|
57
|
-
children,
|
|
58
|
-
/* @__PURE__ */ jsx(ListViewLayoutSwitch, {})
|
|
59
|
-
] })
|
|
44
|
+
children
|
|
60
45
|
}
|
|
61
46
|
) }));
|
|
62
47
|
}
|
|
63
|
-
const ListViewLayout = (props) => {
|
|
64
|
-
const listView = useListView();
|
|
65
|
-
const { children } = props;
|
|
66
|
-
return /* @__PURE__ */ jsx(Fragment, { children: listView.layout == "default" ? /* @__PURE__ */ jsxs(ListViewLayoutDefault, { children: [
|
|
67
|
-
" ",
|
|
68
|
-
children,
|
|
69
|
-
" "
|
|
70
|
-
] }) : listView.layout == "demo" ? /* @__PURE__ */ jsxs(ListViewLayoutDemo, { children: [
|
|
71
|
-
" ",
|
|
72
|
-
children,
|
|
73
|
-
" "
|
|
74
|
-
] }) : listView.layout == "none" ? /* @__PURE__ */ jsx(Fragment, { children }) : children });
|
|
75
|
-
};
|
|
76
|
-
const ListViewLayoutSwitch = () => {
|
|
77
|
-
const listview = useListView();
|
|
78
|
-
const [open, setOpen] = useState(false);
|
|
79
|
-
useHotkeys(HOTKEY_Switchlayout, () => {
|
|
80
|
-
setOpen((pre) => !pre);
|
|
81
|
-
}, [open, setOpen]);
|
|
82
|
-
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
83
|
-
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
84
|
-
"LayoutSwitch,",
|
|
85
|
-
listview.layout
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout) => {
|
|
88
|
-
return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
89
|
-
listview.setLayout(layout);
|
|
90
|
-
setOpen(false);
|
|
91
|
-
}, children: layout }, layout);
|
|
92
|
-
}) })
|
|
93
|
-
] }) });
|
|
94
|
-
};
|
|
95
48
|
export {
|
|
96
49
|
MtListView as default
|
|
97
50
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
const ListViewLayoutDefault = (props) => {
|
|
4
4
|
const { children } = props;
|
|
5
|
-
return /* @__PURE__ */
|
|
6
|
-
"ListViewLayoutDefault",
|
|
7
|
-
children
|
|
8
|
-
] });
|
|
5
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
9
6
|
};
|
|
10
7
|
export {
|
|
11
8
|
ListViewLayoutDefault
|
package/dist/esm/gomtmQuery.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
interface goMtmQueryFnProps {
|
|
2
|
-
svc: string;
|
|
3
|
-
method: string;
|
|
4
|
-
input?: any;
|
|
5
|
-
options?: {
|
|
6
|
-
url: string;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export declare const goMtmQueryFn: (props: goMtmQueryFnProps) => Promise<any>;
|
|
10
1
|
export declare const useGomtmQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
11
2
|
export declare const useGomtmSuspenseQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseSuspenseQueryResult<any, Error>;
|
|
12
3
|
export declare const useGomtmSuspenseInfiniteQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseSuspenseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<any, unknown>, Error>;
|
|
13
4
|
export declare const useGomtmMutation: (svc: string, method: string) => import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
|
|
14
|
-
export {};
|
package/dist/esm/gomtmQuery.js
CHANGED
|
@@ -1,44 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __async = (__this, __arguments, generator) => {
|
|
3
|
-
return new Promise((resolve, reject) => {
|
|
4
|
-
var fulfilled = (value) => {
|
|
5
|
-
try {
|
|
6
|
-
step(generator.next(value));
|
|
7
|
-
} catch (e) {
|
|
8
|
-
reject(e);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
var rejected = (value) => {
|
|
12
|
-
try {
|
|
13
|
-
step(generator.throw(value));
|
|
14
|
-
} catch (e) {
|
|
15
|
-
reject(e);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
2
|
import { useMutation, useQuery, useSuspenseInfiniteQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
23
|
-
import { camelCase } from "lodash";
|
|
24
3
|
import { MTM_API_PREFIX } from "./consts";
|
|
25
|
-
import {
|
|
4
|
+
import { createInfiniteQueryKey, createQueryKey, goMtmQueryFn } from "./mtmFetcher";
|
|
26
5
|
import { useMtmApp } from "./providers/GomtmProvider";
|
|
27
|
-
const goMtmQueryFn = (props) => __async(void 0, null, function* () {
|
|
28
|
-
var _a;
|
|
29
|
-
const client = createMtmServiceClientByName(props.svc, (_a = props.options) == null ? void 0 : _a.url);
|
|
30
|
-
if (!client) {
|
|
31
|
-
throw new Error(`missing mtmclient:"${props.svc}"`);
|
|
32
|
-
}
|
|
33
|
-
const methodName = camelCase(props.method);
|
|
34
|
-
const methodFn = client[methodName];
|
|
35
|
-
if (!methodFn) {
|
|
36
|
-
throw new Error(`missing mtmclient method:"${props.svc}.${methodName}"`);
|
|
37
|
-
}
|
|
38
|
-
const data = yield methodFn(props.input);
|
|
39
|
-
console.log(`goMtmQueryFn ${props.svc}.${props.method}.${props.input}`, data);
|
|
40
|
-
return data;
|
|
41
|
-
});
|
|
42
6
|
const useGomtmQuery = (svc, method, input) => {
|
|
43
7
|
const query = useQuery({
|
|
44
8
|
queryKey: createQueryKey(svc, method, input),
|
|
@@ -64,7 +28,7 @@ const useGomtmSuspenseQuery = (svc, method, input) => {
|
|
|
64
28
|
const useGomtmSuspenseInfiniteQuery = (svc, method, input) => {
|
|
65
29
|
const mtapp = useMtmApp();
|
|
66
30
|
const query = useSuspenseInfiniteQuery({
|
|
67
|
-
queryKey:
|
|
31
|
+
queryKey: createInfiniteQueryKey(svc, method, input),
|
|
68
32
|
queryFn: (k) => goMtmQueryFn({
|
|
69
33
|
svc,
|
|
70
34
|
method,
|
|
@@ -94,7 +58,6 @@ const useGomtmMutation = (svc, method) => {
|
|
|
94
58
|
});
|
|
95
59
|
};
|
|
96
60
|
export {
|
|
97
|
-
goMtmQueryFn,
|
|
98
61
|
useGomtmMutation,
|
|
99
62
|
useGomtmQuery,
|
|
100
63
|
useGomtmSuspenseInfiniteQuery,
|
|
@@ -7,7 +7,7 @@ import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
|
7
7
|
import { TooltipProvider } from "mtxuilib/ui/tooltip";
|
|
8
8
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
9
9
|
import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
|
|
10
|
-
import { Suspense, lazy, useState } from "react";
|
|
10
|
+
import { Suspense, lazy, useMemo, useState } from "react";
|
|
11
11
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
12
12
|
import { Toaster } from "sonner";
|
|
13
13
|
import { HOTKEY_Switchlayout } from "../consts";
|
|
@@ -26,12 +26,20 @@ const LzFrontLayout = lazy(() => import("./front-layout"));
|
|
|
26
26
|
const LayoutBase = (props) => {
|
|
27
27
|
const { children } = props;
|
|
28
28
|
const mtapp = useMtmApp();
|
|
29
|
+
const LayoutComponent = useMemo(() => {
|
|
30
|
+
switch (mtapp.layoutName) {
|
|
31
|
+
case "dash5":
|
|
32
|
+
return LzDash5;
|
|
33
|
+
case "debug":
|
|
34
|
+
return LzDebugLayout;
|
|
35
|
+
case "demo":
|
|
36
|
+
return LzDemoLayout;
|
|
37
|
+
default:
|
|
38
|
+
return LzFrontLayout;
|
|
39
|
+
}
|
|
40
|
+
}, [mtapp.layoutName]);
|
|
29
41
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 0, children: [
|
|
30
|
-
|
|
31
|
-
" ",
|
|
32
|
-
children,
|
|
33
|
-
" "
|
|
34
|
-
] }) : mtapp.layoutName == "dash5" ? /* @__PURE__ */ jsx(LzDash5, { children }) : mtapp.layoutName == "debug" ? /* @__PURE__ */ jsx(LzDebugLayout, { children }) : mtapp.layoutName == "demo1" ? /* @__PURE__ */ jsx(LzDemoLayout, { children }) : mtapp.layoutName == "default" ? /* @__PURE__ */ jsx(Fragment, { children }) : children,
|
|
42
|
+
/* @__PURE__ */ jsx(LayoutComponent, { children }),
|
|
35
43
|
/* @__PURE__ */ jsx(
|
|
36
44
|
ProgressBar,
|
|
37
45
|
{
|
package/dist/esm/mtmFetcher.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ServiceType } from "@bufbuild/protobuf";
|
|
2
2
|
export declare const createQueryKey: (svc: string, method: string, input: any) => any[];
|
|
3
3
|
export declare const createInfiniteQueryKey: (svc: string, method: string, input: any) => any[];
|
|
4
|
+
interface goMtmQueryFnProps {
|
|
5
|
+
svc: string;
|
|
6
|
+
method: string;
|
|
7
|
+
input?: any;
|
|
8
|
+
options?: {
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const goMtmQueryFn: (props: goMtmQueryFnProps) => Promise<any>;
|
|
4
13
|
export declare const ssrGetBackendUrl: () => string;
|
|
5
14
|
export declare const gomtmApiUrl: () => string;
|
|
6
15
|
export declare function createMtmServiceClient<T extends ServiceType>(service: T, url?: string): import("@connectrpc/connect").PromiseClient<T>;
|
package/dist/esm/mtmFetcher.js
CHANGED
|
@@ -34,9 +34,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
34
34
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
+
import { toPlainMessage } from "@bufbuild/protobuf";
|
|
37
38
|
import { createPromiseClient } from "@connectrpc/connect";
|
|
38
39
|
import { createConnectTransport } from "@connectrpc/connect-web";
|
|
39
|
-
import { merge } from "lodash";
|
|
40
|
+
import { camelCase, merge } from "lodash";
|
|
40
41
|
import { fetchMiddleWithCache } from "mtxlib/http/fetchMiddleWithCache";
|
|
41
42
|
import { MTM_API_PREFIX } from "./consts";
|
|
42
43
|
import { MtmService } from "./gomtmpb/mtm/sppb/mtm_connect";
|
|
@@ -45,8 +46,23 @@ const createQueryKey = (svc, method, input) => {
|
|
|
45
46
|
return [svc, method, input || {}];
|
|
46
47
|
};
|
|
47
48
|
const createInfiniteQueryKey = (svc, method, input) => {
|
|
48
|
-
return [svc, method, input
|
|
49
|
+
return [...createQueryKey(svc, method, input), "infinite"];
|
|
49
50
|
};
|
|
51
|
+
const goMtmQueryFn = (props) => __async(void 0, null, function* () {
|
|
52
|
+
var _a;
|
|
53
|
+
const client = createMtmServiceClientByName(props.svc, (_a = props.options) == null ? void 0 : _a.url);
|
|
54
|
+
if (!client) {
|
|
55
|
+
throw new Error(`missing mtmclient:"${props.svc}"`);
|
|
56
|
+
}
|
|
57
|
+
const methodName = camelCase(props.method);
|
|
58
|
+
const methodFn = client[methodName];
|
|
59
|
+
if (!methodFn) {
|
|
60
|
+
throw new Error(`missing mtmclient method:"${props.svc}.${methodName}"`);
|
|
61
|
+
}
|
|
62
|
+
const data = yield methodFn(props.input);
|
|
63
|
+
console.log(`goMtmQueryFn ${props.svc}.${props.method}.(${props.input})`, data);
|
|
64
|
+
return toPlainMessage(data);
|
|
65
|
+
});
|
|
50
66
|
const ssrGetBackendUrl = () => {
|
|
51
67
|
var _a;
|
|
52
68
|
if (typeof window == "undefined") {
|
|
@@ -157,6 +173,7 @@ export {
|
|
|
157
173
|
createMtmServiceClientByName,
|
|
158
174
|
createQueryKey,
|
|
159
175
|
createTransport,
|
|
176
|
+
goMtmQueryFn,
|
|
160
177
|
gomtmApiUrl,
|
|
161
178
|
gomtmFetcher,
|
|
162
179
|
ssrGetBackendUrl
|
|
@@ -21,15 +21,15 @@ export declare const spContentModiCreateInput: z.ZodObject<{
|
|
|
21
21
|
action: z.ZodString;
|
|
22
22
|
value: z.ZodString;
|
|
23
23
|
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
action: string;
|
|
25
24
|
value: string;
|
|
25
|
+
action: string;
|
|
26
26
|
sel: string;
|
|
27
27
|
spRouteId: string;
|
|
28
28
|
matchContentType: string;
|
|
29
29
|
title?: string | undefined;
|
|
30
30
|
}, {
|
|
31
|
-
action: string;
|
|
32
31
|
value: string;
|
|
32
|
+
action: string;
|
|
33
33
|
sel: string;
|
|
34
34
|
spRouteId: string;
|
|
35
35
|
matchContentType: string;
|
|
@@ -44,17 +44,17 @@ export declare const spContentModiSaveInput: z.ZodObject<{
|
|
|
44
44
|
action: z.ZodString;
|
|
45
45
|
value: z.ZodString;
|
|
46
46
|
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
value: string;
|
|
47
48
|
id: string;
|
|
48
49
|
action: string;
|
|
49
|
-
value: string;
|
|
50
50
|
sel: string;
|
|
51
51
|
spRouteId: string;
|
|
52
52
|
matchContentType: string;
|
|
53
53
|
title?: string | undefined;
|
|
54
54
|
}, {
|
|
55
|
+
value: string;
|
|
55
56
|
id: string;
|
|
56
57
|
action: string;
|
|
57
|
-
value: string;
|
|
58
58
|
sel: string;
|
|
59
59
|
spRouteId: string;
|
|
60
60
|
matchContentType: string;
|
|
@@ -20,17 +20,17 @@ export declare const spRouteCreateInput: z.ZodObject<{
|
|
|
20
20
|
pathPattern: z.ZodString;
|
|
21
21
|
value: z.ZodString;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
value: string;
|
|
23
24
|
title: string;
|
|
24
25
|
spProjectId: string;
|
|
25
26
|
hostPattern: string;
|
|
26
27
|
pathPattern: string;
|
|
27
|
-
value: string;
|
|
28
28
|
}, {
|
|
29
|
+
value: string;
|
|
29
30
|
title: string;
|
|
30
31
|
spProjectId: string;
|
|
31
32
|
hostPattern: string;
|
|
32
33
|
pathPattern: string;
|
|
33
|
-
value: string;
|
|
34
34
|
}>;
|
|
35
35
|
export type SpRouteSaveInput = z.infer<typeof SpRouteSaveInput>;
|
|
36
36
|
export declare const SpRouteSaveInput: z.ZodObject<{
|
|
@@ -41,17 +41,17 @@ export declare const SpRouteSaveInput: z.ZodObject<{
|
|
|
41
41
|
pathPattern: z.ZodString;
|
|
42
42
|
value: z.ZodString;
|
|
43
43
|
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
value: string;
|
|
44
45
|
id: string;
|
|
45
46
|
title: string;
|
|
46
47
|
spProjectId: string;
|
|
47
48
|
hostPattern: string;
|
|
48
49
|
pathPattern: string;
|
|
49
|
-
value: string;
|
|
50
50
|
}, {
|
|
51
|
+
value: string;
|
|
51
52
|
id: string;
|
|
52
53
|
title: string;
|
|
53
54
|
spProjectId: string;
|
|
54
55
|
hostPattern: string;
|
|
55
56
|
pathPattern: string;
|
|
56
|
-
value: string;
|
|
57
57
|
}>;
|
|
@@ -27,11 +27,11 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
27
27
|
name: z.ZodString;
|
|
28
28
|
email: z.ZodString;
|
|
29
29
|
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
name: string;
|
|
31
30
|
email: string;
|
|
32
|
-
}, {
|
|
33
31
|
name: string;
|
|
32
|
+
}, {
|
|
34
33
|
email: string;
|
|
34
|
+
name: string;
|
|
35
35
|
}>;
|
|
36
36
|
export type ICreateUser = z.infer<typeof createUserSchema>;
|
|
37
37
|
export declare const Oauth2LoginResponseSchema: z.ZodObject<{
|