gomtm 0.0.271 → 0.0.273
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/MtUnaryCallErrorView.js +1 -1
- package/dist/esm/components/MtmErrorView.d.ts +6 -0
- package/dist/esm/components/MtmErrorView.js +12 -0
- package/dist/esm/curd/ListViewProvider.js +8 -4
- package/dist/esm/mtmFetcher.js +1 -0
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ const MtUnaryCallErrorView = (props) => {
|
|
|
5
5
|
return /* @__PURE__ */ jsxs("div", { className: "bg-red-400 p-4", children: [
|
|
6
6
|
"code: ",
|
|
7
7
|
unaryError.errCode,
|
|
8
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", { className: "prose dark:prose-invert break-words", children: unaryError.errMessage }) }),
|
|
8
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", { className: "prose dark:prose-invert flex-wrap text-wrap break-words", children: unaryError.errMessage }) }),
|
|
9
9
|
retry && /* @__PURE__ */ jsx("button", { onClick: () => {
|
|
10
10
|
retry();
|
|
11
11
|
}, children: "retry" })
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
const MtmErrorView = (props) => {
|
|
4
|
+
const { gomtmError } = props;
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6
|
+
"MtmErrorView",
|
|
7
|
+
/* @__PURE__ */ jsx("pre", { children: JSON.stringify(gomtmError, null, 2) })
|
|
8
|
+
] });
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
MtmErrorView
|
|
12
|
+
};
|
|
@@ -39,13 +39,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
42
|
+
import { debounce } from "lodash";
|
|
42
43
|
import { Icons } from "mtxuilib/icons/icons";
|
|
43
44
|
import { cn } from "mtxuilib/lib/utils";
|
|
44
45
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
45
46
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
|
|
46
47
|
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
|
|
47
48
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
48
|
-
import { Suspense, createContext, useContext, useMemo, useState } from "react";
|
|
49
|
+
import { Suspense, createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
49
50
|
import { MtUnaryCallErrorView } from "../components/MtUnaryCallErrorView";
|
|
50
51
|
import { useMutation, useSuspenseInfiniteQuery } from "../connectquery";
|
|
51
52
|
import { useMtmApp } from "../providers/GomtmProvider";
|
|
@@ -63,13 +64,16 @@ function ListViewProvider(props) {
|
|
|
63
64
|
const [activateItem, setActivateItem] = useState(void 0);
|
|
64
65
|
const [openEdit, setOpenEdit] = useState(false);
|
|
65
66
|
const [openDebug, setOpenDebug] = useState(false);
|
|
66
|
-
const [_params,
|
|
67
|
+
const [_params, _setParams] = useState(mtapp.globalSearchParams);
|
|
67
68
|
const params = useMemo(() => {
|
|
68
69
|
var _a;
|
|
69
70
|
return {
|
|
70
71
|
q: (_a = mtapp.globalSearchParams) == null ? void 0 : _a.q
|
|
71
72
|
};
|
|
72
73
|
}, [mtapp.globalSearchParams]);
|
|
74
|
+
const setParams = useCallback(debounce((values) => {
|
|
75
|
+
_setParams(values);
|
|
76
|
+
}, 300), [_setParams]);
|
|
73
77
|
return /* @__PURE__ */ jsx(commonListViewContext.Provider, { value: {
|
|
74
78
|
methodList,
|
|
75
79
|
slugPath,
|
|
@@ -99,7 +103,7 @@ function CommonListView() {
|
|
|
99
103
|
const listQuery = useSuspenseInfiniteQuery(listView.methodList, {
|
|
100
104
|
params: {
|
|
101
105
|
params: {
|
|
102
|
-
q: listView.params.q
|
|
106
|
+
q: listView.params.q || ""
|
|
103
107
|
}
|
|
104
108
|
},
|
|
105
109
|
pagination: {
|
|
@@ -127,7 +131,7 @@ function CommonListView() {
|
|
|
127
131
|
),
|
|
128
132
|
children: listQuery.data.pages.map((page, i) => {
|
|
129
133
|
var _a;
|
|
130
|
-
if (page.
|
|
134
|
+
if (page.errCode) {
|
|
131
135
|
return /* @__PURE__ */ jsx(MtUnaryCallErrorView, { unaryError: page }, i);
|
|
132
136
|
} else {
|
|
133
137
|
return /* @__PURE__ */ jsx(ListLayout, { layout: page.listLayout, children: (_a = page == null ? void 0 : page.items) == null ? void 0 : _a.map((item, j) => /* @__PURE__ */ jsx(ListItemView, { item }, `${i}-${j}`)) }, i);
|
package/dist/esm/mtmFetcher.js
CHANGED