gomtm 0.0.269 → 0.0.271
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/devtools/GoMtmDebug.js +12 -0
- package/dist/esm/curd/ListViewProvider.js +5 -3
- package/dist/esm/mtmFetcher.js +1 -1
- package/dist/esm/providers/AuthProvider.d.ts +1 -1
- package/dist/esm/providers/AuthProvider.js +3 -3
- package/dist/esm/providers/GomtmProvider.js +8 -16
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Icons } from "mtxuilib/icons/icons";
|
|
4
4
|
import { CommandDialog, CommandEmpty, CommandInput, CommandList, CommandSeparator } from "mtxuilib/ui/command";
|
|
5
|
+
import { Dialog, DialogContent, DialogTrigger } from "mtxuilib/ui/dialog";
|
|
5
6
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
6
7
|
import { useState } from "react";
|
|
7
8
|
import { useMtmApp } from "../../providers/GomtmProvider";
|
|
@@ -21,11 +22,22 @@ const GoMtmDebug = () => {
|
|
|
21
22
|
} }),
|
|
22
23
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
23
24
|
/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }),
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-slate-100 p-2", children: /* @__PURE__ */ jsx(DebugAppMainStateDlg, {}) }),
|
|
24
26
|
/* @__PURE__ */ jsx(CommandSeparator, {})
|
|
25
27
|
] })
|
|
26
28
|
] })
|
|
27
29
|
] });
|
|
28
30
|
};
|
|
31
|
+
const DebugAppMainStateDlg = () => {
|
|
32
|
+
const matpp = useMtmApp();
|
|
33
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [
|
|
34
|
+
/* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx(MtButton, { children: "appState" }) }),
|
|
35
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
36
|
+
"appstate",
|
|
37
|
+
/* @__PURE__ */ jsx("pre", { children: JSON.stringify(matpp.globalSearchParams || "null", null, 2) })
|
|
38
|
+
] })
|
|
39
|
+
] });
|
|
40
|
+
};
|
|
29
41
|
export {
|
|
30
42
|
GoMtmDebug
|
|
31
43
|
};
|
|
@@ -95,9 +95,12 @@ function useListView() {
|
|
|
95
95
|
}
|
|
96
96
|
function CommonListView() {
|
|
97
97
|
const listView = useListView();
|
|
98
|
+
console.log("listView.params", listView.params);
|
|
98
99
|
const listQuery = useSuspenseInfiniteQuery(listView.methodList, {
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
params: {
|
|
101
|
+
params: {
|
|
102
|
+
q: listView.params.q
|
|
103
|
+
}
|
|
101
104
|
},
|
|
102
105
|
pagination: {
|
|
103
106
|
page: 1
|
|
@@ -114,7 +117,6 @@ function CommonListView() {
|
|
|
114
117
|
return null;
|
|
115
118
|
}
|
|
116
119
|
return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
117
|
-
JSON.stringify(listView.params, null, 2),
|
|
118
120
|
/* @__PURE__ */ jsx(
|
|
119
121
|
"div",
|
|
120
122
|
{
|
package/dist/esm/mtmFetcher.js
CHANGED
|
@@ -111,7 +111,7 @@ const gomtmFetcher = (initGlobal) => {
|
|
|
111
111
|
}, (initGlobal == null ? void 0 : initGlobal.cookieStr) && { "Cookie": initGlobal == null ? void 0 : initGlobal.cookieStr })
|
|
112
112
|
});
|
|
113
113
|
let fetcher = fetch;
|
|
114
|
-
req.enableCache =
|
|
114
|
+
req.enableCache = false;
|
|
115
115
|
if (req.enableCache) {
|
|
116
116
|
fetcher = fetchMiddleWithCache(fetch);
|
|
117
117
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function isRoleMatch(currentRoles: string[], allowRoles?: string[]): boolean;
|
|
2
1
|
import { MyJWTPayload } from "../lib/auth/jwt";
|
|
2
|
+
export declare function isRoleMatch(currentRoles: string[], allowRoles?: string[]): boolean;
|
|
3
3
|
export declare function useAuth(): {
|
|
4
4
|
auth: MyJWTPayload | null;
|
|
5
5
|
userId: string | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { useSuspenseQuery } from "../connectquery";
|
|
4
|
+
import { userinfo } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
|
|
2
5
|
function isRoleMatch(currentRoles, allowRoles) {
|
|
3
6
|
if (!currentRoles) {
|
|
4
7
|
return true;
|
|
@@ -14,9 +17,6 @@ function isRoleMatch(currentRoles, allowRoles) {
|
|
|
14
17
|
}
|
|
15
18
|
return false;
|
|
16
19
|
}
|
|
17
|
-
import React, { useMemo } from "react";
|
|
18
|
-
import { useSuspenseQuery } from "../connectquery";
|
|
19
|
-
import { userinfo } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
|
|
20
20
|
function useAuth() {
|
|
21
21
|
const [auth, setAuth] = React.useState(null);
|
|
22
22
|
const isAdmin = useMemo(() => {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -17,9 +15,8 @@ var __spreadValues = (a, b) => {
|
|
|
17
15
|
}
|
|
18
16
|
return a;
|
|
19
17
|
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { createContext, useContext, useMemo, useState } from "react";
|
|
19
|
+
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
23
20
|
import { createConnectTransport } from "@connectrpc/connect-web";
|
|
24
21
|
import { debounce } from "lodash";
|
|
25
22
|
import { useSearchParams } from "next/navigation";
|
|
@@ -38,23 +35,18 @@ function GomtmProvider(props) {
|
|
|
38
35
|
const [_layoutName, setLayoutName] = useState("front");
|
|
39
36
|
const [openLayoutSwitchDlg, setOpenLayoutSwitchDlg] = useState(false);
|
|
40
37
|
const [_cookieStr, setCookieStr] = useState("");
|
|
41
|
-
const [_globalSearchParams,
|
|
38
|
+
const [_globalSearchParams, _setGlobalSearchParams] = useState({});
|
|
42
39
|
useHotkeys(HOTKEY_Debug, () => {
|
|
43
|
-
console.log("set debug");
|
|
44
40
|
setDebug((pre) => !pre);
|
|
45
41
|
}, [_isDebug, setDebug]);
|
|
46
42
|
const searchParams = useSearchParams();
|
|
43
|
+
const setGlobalSearchParams = useCallback(debounce((values) => {
|
|
44
|
+
_setGlobalSearchParams(values);
|
|
45
|
+
}, 200), [_setGlobalSearchParams]);
|
|
47
46
|
const globalSearchParams = useMemo(() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (q) {
|
|
52
|
-
setGlobalSearchParams((pre) => {
|
|
53
|
-
return __spreadProps(__spreadValues({}, pre), { q });
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}, 500);
|
|
57
|
-
}, [searchParams]);
|
|
47
|
+
const q = searchParams.get("q");
|
|
48
|
+
return __spreadValues({ q }, _globalSearchParams);
|
|
49
|
+
}, [searchParams, _globalSearchParams]);
|
|
58
50
|
return /* @__PURE__ */ jsx(AppContext.Provider, { value: {
|
|
59
51
|
isDebug: _isDebug,
|
|
60
52
|
setIsDebug: setDebug,
|