gomtm 0.0.258 → 0.0.259

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.
Files changed (56) hide show
  1. package/dist/esm/ly/LayoutBase.js +24 -21
  2. package/dist/esm/validations/spContentModi.d.ts +8 -8
  3. package/dist/esm/validations/spRoute.d.ts +10 -10
  4. package/dist/esm/validations/user.d.ts +6 -6
  5. package/dist/tsconfig.type.tsbuildinfo +1 -1
  6. package/package.json +3 -3
  7. package/dist/esm/curd/CommonListViewV2.backup.d.ts +0 -7
  8. package/dist/esm/curd/CommonListViewV2.backup.js +0 -81
  9. package/dist/esm/curd/CommonListViewV2.d.ts +0 -29
  10. package/dist/esm/curd/CommonListViewV2.js +0 -180
  11. package/dist/esm/curd/curd-detail-page.d.ts +0 -10
  12. package/dist/esm/curd/curd-detail-page.js +0 -17
  13. package/dist/esm/curd/curd-detail.d.ts +0 -7
  14. package/dist/esm/curd/curd-detail.js +0 -63
  15. package/dist/esm/curd/curd.atoms.d.ts +0 -10
  16. package/dist/esm/curd/curd.atoms.js +0 -54
  17. package/dist/esm/curd/dlg/DlgCurdDebugInfo.d.ts +0 -3
  18. package/dist/esm/curd/dlg/DlgCurdDebugInfo.js +0 -24
  19. package/dist/esm/ly/DashLayout.d.ts +0 -2
  20. package/dist/esm/ly/DashLayout.js +0 -39
  21. package/dist/esm/ly--/DashLayout.d.ts +0 -2
  22. package/dist/esm/ly--/DashLayout.js +0 -39
  23. package/dist/esm/ly--/UserAvatorMenus.d.ts +0 -2
  24. package/dist/esm/ly--/UserAvatorMenus.js +0 -63
  25. package/dist/esm/ly--/dash5/aside.d.ts +0 -2
  26. package/dist/esm/ly--/dash5/aside.js +0 -40
  27. package/dist/esm/ly--/dash5/components/PageCreate.d.ts +0 -4
  28. package/dist/esm/ly--/dash5/components/PageCreate.js +0 -8
  29. package/dist/esm/ly--/dash5/components/PageEdit.d.ts +0 -4
  30. package/dist/esm/ly--/dash5/components/PageEdit.js +0 -8
  31. package/dist/esm/ly--/dash5/components/PageList.d.ts +0 -4
  32. package/dist/esm/ly--/dash5/components/PageList.js +0 -9
  33. package/dist/esm/ly--/dash5/components/PageShow.d.ts +0 -4
  34. package/dist/esm/ly--/dash5/components/PageShow.js +0 -8
  35. package/dist/esm/ly--/dash5/header.d.ts +0 -2
  36. package/dist/esm/ly--/dash5/header.js +0 -123
  37. package/dist/esm/ly--/dash5/index.d.ts +0 -2
  38. package/dist/esm/ly--/dash5/index.js +0 -21
  39. package/dist/esm/ly--/front-layout/PageCmds.d.ts +0 -2
  40. package/dist/esm/ly--/front-layout/PageCmds.js +0 -25
  41. package/dist/esm/ly--/front-layout/PageSearchCmd.d.ts +0 -2
  42. package/dist/esm/ly--/front-layout/PageSearchCmd.js +0 -63
  43. package/dist/esm/ly--/front-layout/header.d.ts +0 -2
  44. package/dist/esm/ly--/front-layout/header.js +0 -18
  45. package/dist/esm/ly--/front-layout/index.d.ts +0 -2
  46. package/dist/esm/ly--/front-layout/index.js +0 -13
  47. package/dist/esm/ly--/front-layout/main-nav.d.ts +0 -3
  48. package/dist/esm/ly--/front-layout/main-nav.js +0 -116
  49. package/dist/esm/mtmquery.d.ts +0 -0
  50. package/dist/esm/mtmquery.js +0 -1
  51. package/dist/esm/providers/logger.context.d.ts +0 -10
  52. package/dist/esm/providers/logger.context.js +0 -23
  53. package/dist/esm/store/auth.d.ts +0 -7
  54. package/dist/esm/store/auth.js +0 -35
  55. package/dist/esm/utils.d.ts +0 -1
  56. package/dist/esm/utils.js +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gomtm",
3
- "version": "0.0.258",
3
+ "version": "0.0.259",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -82,8 +82,8 @@
82
82
  "stable-hash": "^0.0.4",
83
83
  "universal-cookie": "^7.1.4",
84
84
  "zod": "^3.22.2",
85
- "mtxlib": "0.3.338",
86
- "mtxuilib": "0.0.615"
85
+ "mtxlib": "0.3.339",
86
+ "mtxuilib": "0.0.616"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@babel/core": "^7.24.0",
@@ -1,7 +0,0 @@
1
- import { Message } from "@bufbuild/protobuf";
2
- import { PropsWithChildren } from "react";
3
- import { MethodUnaryDescriptor } from "../connectquery";
4
- export declare function CommonListViewProvider<I extends Message<I>, O extends Message<O>>(props: {
5
- methodList: MethodUnaryDescriptor<I, any>;
6
- } & PropsWithChildren): import("react").JSX.Element;
7
- export declare function CommonListView<I extends Message<I>, O extends Message<O>>(): import("react").JSX.Element | null;
@@ -1,81 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { atom, useAtom } from "jotai";
4
- import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
5
- import { cn } from "mtxuilib/lib/utils";
6
- import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
7
- import { MtUnaryCallErrorView } from "../components/MtUnaryCallErrorView";
8
- import { useSuspenseInfiniteQuery } from "../connectquery";
9
- import { ListViewLayout } from "../gomtmpb/mtm/sppb/mtm_pb";
10
- import { ListItemView } from "./list-item/ListItem";
11
- const listQueryAtom = atom(null);
12
- function CommonListViewProvider(props) {
13
- const { children, methodList } = props;
14
- const listquery = useSuspenseInfiniteQuery(methodList, {
15
- //@ts-expect-error
16
- page: 1
17
- }, {
18
- pageParamKey: "pagination",
19
- getNextPageParam: (res, b, c) => {
20
- return {
21
- //@ts-expect-error
22
- page: ((c == null ? void 0 : c.page) || 0) + 1
23
- };
24
- }
25
- });
26
- return /* @__PURE__ */ jsx(ScopeAtomsHydrator, { atomValues: [
27
- [listQueryAtom, listquery]
28
- ], children });
29
- }
30
- function CommonListView() {
31
- const [listQuery, setListQuery] = useAtom(listQueryAtom);
32
- if (!(listQuery == null ? void 0 : listQuery.data)) {
33
- return null;
34
- }
35
- return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
36
- /* @__PURE__ */ jsx(
37
- "div",
38
- {
39
- className: cn(
40
- "w-full"
41
- // 滚动设置
42
- // " max-h-[700px] overflow-y-auto"
43
- ),
44
- children: listQuery.data.pages.map((page, i) => {
45
- var _a;
46
- if (page.error_code) {
47
- return /* @__PURE__ */ jsx(MtUnaryCallErrorView, { unaryError: page }, i);
48
- } else {
49
- 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);
50
- }
51
- })
52
- }
53
- ),
54
- /* @__PURE__ */ jsx(Pagination, { children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
55
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationPrevious, { href: "#" }) }),
56
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "1" }) }),
57
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", isActive: true, children: "2" }) }),
58
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "3" }) }),
59
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }),
60
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationNext, { href: "#" }) })
61
- ] }) }),
62
- /* @__PURE__ */ jsx("div", { className: "absolute right-1 top-1" })
63
- ] });
64
- }
65
- const ListLayout = (props) => {
66
- const { children } = props;
67
- switch (props.layout) {
68
- case ListViewLayout.simple:
69
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1 rounded-md p-2 shadow-sm", children });
70
- case ListViewLayout.grid:
71
- return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
72
- case ListViewLayout.card:
73
- return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
74
- default:
75
- return children;
76
- }
77
- };
78
- export {
79
- CommonListView,
80
- CommonListViewProvider
81
- };
@@ -1,29 +0,0 @@
1
- import { Message } from "@bufbuild/protobuf";
2
- import { Dispatch, PropsWithChildren, SetStateAction } from "react";
3
- import { MethodUnaryDescriptor } from "../connectquery";
4
- export declare function CommonListViewProvider<I extends Message<I>, O extends Message<O>>(props: {
5
- methodList: MethodUnaryDescriptor<I, any>;
6
- methodDelete: MethodUnaryDescriptor<any, any>;
7
- methodCreate?: MethodUnaryDescriptor<any, any>;
8
- slugPath?: string;
9
- } & PropsWithChildren): import("react").JSX.Element;
10
- export declare const useListView: () => {
11
- methodList?: MethodUnaryDescriptor<any, any> | undefined;
12
- methodDelete?: MethodUnaryDescriptor<any, any> | undefined;
13
- methodCreate?: MethodUnaryDescriptor<any, any> | undefined;
14
- slugPath?: string | undefined;
15
- activateItem?: any;
16
- params?: any;
17
- openRemove?: boolean | undefined;
18
- setOpenRemove?: Dispatch<SetStateAction<boolean>> | undefined;
19
- openCreate?: boolean | undefined;
20
- setOpenCreate?: Dispatch<SetStateAction<boolean>> | undefined;
21
- setActivateItem?: Dispatch<any> | undefined;
22
- openEdit?: boolean | undefined;
23
- setOpenEdit?: Dispatch<SetStateAction<boolean>> | undefined;
24
- openDebug?: boolean | undefined;
25
- setOpenDebug?: Dispatch<SetStateAction<boolean>> | undefined;
26
- setParams?: Dispatch<any> | undefined;
27
- };
28
- export declare function CommonListView<I extends Message<I>, O extends Message<O>>(): import("react").JSX.Element | null;
29
- export declare const ListViewActions: () => import("react").JSX.Element;
@@ -1,180 +0,0 @@
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
- };
18
- var __async = (__this, __arguments, generator) => {
19
- return new Promise((resolve, reject) => {
20
- var fulfilled = (value) => {
21
- try {
22
- step(generator.next(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var rejected = (value) => {
28
- try {
29
- step(generator.throw(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- };
34
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
- step((generator = generator.apply(__this, __arguments)).next());
36
- });
37
- };
38
- import { jsx, jsxs } from "react/jsx-runtime";
39
- import { Icons } from "mtxuilib/icons/icons";
40
- import { cn } from "mtxuilib/lib/utils";
41
- import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
42
- import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
43
- import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
44
- import { MtButton } from "mtxuilib/ui/ui-mt/Button";
45
- import { Suspense, createContext, useContext, useState } from "react";
46
- import { MtUnaryCallErrorView } from "../components/MtUnaryCallErrorView";
47
- import { useMutation, useSuspenseInfiniteQuery } from "../connectquery";
48
- import CurdCreatePanel, { CurdCreatePanelTriggerButton } from "./create/CurdCreatePanel";
49
- import { DlgCurdDebugInfo, DlgCurdDebugInfoTriggerButton } from "./dlg/DlgCurdDebugInfo";
50
- import CurdEditPanel, { CurdEditPanelTriggerButton } from "./edit/CurdEditPanel";
51
- import { ListItemView } from "./list-item/ListItem";
52
- import { ListLayout } from "./list-item/ListLayout";
53
- const commonListViewContext = createContext(void 0);
54
- function CommonListViewProvider(props) {
55
- const { children, methodList, methodDelete, slugPath, methodCreate } = props;
56
- const [openRemove, setOpenRemove] = useState(false);
57
- const [openCreate, setOpenCreate] = useState(false);
58
- const [activateItem, setActivateItem] = useState(void 0);
59
- const [openEdit, setOpenEdit] = useState(false);
60
- const [openDebug, setOpenDebug] = useState(false);
61
- const [params, setParams] = useState(void 0);
62
- return /* @__PURE__ */ jsx(commonListViewContext.Provider, { value: {
63
- methodList,
64
- slugPath,
65
- openRemove,
66
- setOpenRemove,
67
- methodDelete,
68
- methodCreate,
69
- openCreate,
70
- setOpenCreate,
71
- activateItem,
72
- setActivateItem,
73
- openEdit,
74
- setOpenEdit,
75
- openDebug,
76
- setOpenDebug,
77
- params,
78
- setParams
79
- }, children });
80
- }
81
- const useListView = () => {
82
- const ctx = useContext(commonListViewContext);
83
- return __spreadValues({}, ctx);
84
- };
85
- function CommonListView() {
86
- const a = useListView();
87
- const listQuery = useSuspenseInfiniteQuery(a.methodList, {
88
- page: 1
89
- }, {
90
- pageParamKey: "pagination",
91
- getNextPageParam: (res, b, c) => {
92
- return {
93
- page: ((c == null ? void 0 : c.page) || 0) + 1
94
- };
95
- }
96
- });
97
- if (!(listQuery == null ? void 0 : listQuery.data)) {
98
- return null;
99
- }
100
- return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
101
- /* @__PURE__ */ jsx(
102
- "div",
103
- {
104
- className: cn(
105
- "w-full"
106
- // 滚动设置
107
- // " max-h-[700px] overflow-y-auto"
108
- ),
109
- children: listQuery.data.pages.map((page, i) => {
110
- var _a;
111
- if (page.error_code) {
112
- return /* @__PURE__ */ jsx(MtUnaryCallErrorView, { unaryError: page }, i);
113
- } else {
114
- 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);
115
- }
116
- })
117
- }
118
- ),
119
- /* @__PURE__ */ jsx(Pagination, { children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
120
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationPrevious, { href: "#" }) }),
121
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "1" }) }),
122
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", isActive: true, children: "2" }) }),
123
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "3" }) }),
124
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }),
125
- /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationNext, { href: "#" }) })
126
- ] }) }),
127
- /* @__PURE__ */ jsx("div", { className: "absolute right-1 top-1", children: /* @__PURE__ */ jsx(ListViewActions, {}) })
128
- ] });
129
- }
130
- const PanelRemove = () => {
131
- const listView = useListView();
132
- const mutation = useMutation(listView.methodDelete);
133
- return /* @__PURE__ */ jsx(Dialog, { open: listView.openRemove, onOpenChange: listView.setOpenRemove, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
134
- /* @__PURE__ */ jsx(DialogTitle, { children: "remove item" }),
135
- /* @__PURE__ */ jsx(MtButton, { onClick: () => __async(void 0, null, function* () {
136
- var _a;
137
- yield mutation.mutateAsync({
138
- id: (_a = listView.activateItem) == null ? void 0 : _a.id
139
- });
140
- listView.setOpenRemove(false);
141
- }), children: "ok" })
142
- ] }) });
143
- };
144
- const PanelCreate = () => {
145
- const listView = useListView();
146
- return /* @__PURE__ */ jsx(Dialog, { open: listView.openCreate, onOpenChange: listView.setOpenCreate, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
147
- /* @__PURE__ */ jsx(DialogTitle, { children: "TODO create item Dlg" }),
148
- /* @__PURE__ */ jsx(MtButton, { onClick: () => __async(void 0, null, function* () {
149
- listView.setOpenCreate(false);
150
- }), children: "ok" })
151
- ] }) });
152
- };
153
- const ListViewActions = () => {
154
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
155
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(MtButton, { variant: "ghost", className: "m-0 flex h-10 w-10 items-center justify-center border p-0 shadow-sm backdrop-blur", children: /* @__PURE__ */ jsx(Icons.ellipsis, {}) }) }),
156
- /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", children: [
157
- /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Edit" }),
158
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
159
- /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
160
- /* @__PURE__ */ jsx(PanelRemove, {}),
161
- /* @__PURE__ */ jsx(PanelCreate, {}),
162
- /* @__PURE__ */ jsx(DlgCurdDebugInfo, {}),
163
- /* @__PURE__ */ jsx(CurdCreatePanel, {}),
164
- /* @__PURE__ */ jsx(CurdEditPanel, {}),
165
- /* @__PURE__ */ jsxs("div", { className: "bg-yellow-100 p-2", children: [
166
- /* @__PURE__ */ jsx(DlgCurdDebugInfoTriggerButton, {}),
167
- /* @__PURE__ */ jsx(CurdEditPanelTriggerButton, {}),
168
- /* @__PURE__ */ jsx(CurdCreatePanelTriggerButton, {})
169
- ] })
170
- ] }) }) }),
171
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
172
- ] })
173
- ] });
174
- };
175
- export {
176
- CommonListView,
177
- CommonListViewProvider,
178
- ListViewActions,
179
- useListView
180
- };
@@ -1,10 +0,0 @@
1
- import type { Message, PartialMessage } from "@bufbuild/protobuf";
2
- import { PropsWithChildren } from "react";
3
- import { MethodUnaryDescriptor } from "../connectquery";
4
- export declare const curdDetailPageDataAtom: import("jotai").PrimitiveAtom<undefined> & {
5
- init: undefined;
6
- };
7
- export declare function CurdDetailPage<I extends Message<I>, O extends Message<O>>(props: {
8
- methodGet: MethodUnaryDescriptor<I, O>;
9
- params?: PartialMessage<I>;
10
- } & PropsWithChildren): import("react").JSX.Element;
@@ -1,17 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { atom } from "jotai";
4
- import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
5
- import { useSuspenseQuery } from "../connectquery";
6
- const curdDetailPageDataAtom = atom(void 0);
7
- function CurdDetailPage(props) {
8
- const { children, methodGet, params } = props;
9
- const query = useSuspenseQuery(methodGet, params);
10
- return /* @__PURE__ */ jsx(ScopeAtomsHydrator, { atomValues: [
11
- [curdDetailPageDataAtom, query]
12
- ], children });
13
- }
14
- export {
15
- CurdDetailPage,
16
- curdDetailPageDataAtom
17
- };
@@ -1,7 +0,0 @@
1
- import { PropsWithChildren } from "react";
2
- export declare const curdDetailSlugAtom: import("jotai").PrimitiveAtom<string> & {
3
- init: string;
4
- };
5
- export declare function CurdViewDetailProvider<T = any>(props: PropsWithChildren): import("react").JSX.Element;
6
- export declare const CurdViewDetailDefault: () => import("react").JSX.Element;
7
- export declare const DetailViewActions: () => import("react").JSX.Element;
@@ -1,63 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { atom } from "jotai";
4
- import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
5
- import { Icons } from "mtxuilib/icons/icons";
6
- import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
7
- import { MtButton } from "mtxuilib/ui/ui-mt/Button";
8
- import { usePathname } from "next/navigation";
9
- import { useSuspenseQuery } from "../connectquery";
10
- import { SchemaFormView } from "../form/SchemaFormView";
11
- import { curdDetail } from "../gomtmpb/mtm/sppb/curd-CurdService_connectquery";
12
- import { curdViewGet } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
13
- import { useCurdSlugName } from "./curd.atoms";
14
- const curdDetailSlugAtom = atom("");
15
- function CurdViewDetailProvider(props) {
16
- const { children } = props;
17
- const pathName = usePathname();
18
- return /* @__PURE__ */ jsx(ScopeAtomsHydrator, { atomValues: [
19
- [curdDetailSlugAtom, pathName]
20
- ], children });
21
- }
22
- const CurdViewDetailDefault = () => {
23
- var _a, _b, _c, _d;
24
- const nameSlug = useCurdSlugName();
25
- const detailQuery = useSuspenseQuery(curdDetail, {
26
- slug: nameSlug
27
- });
28
- const curdGetQuery = useSuspenseQuery(curdViewGet, {
29
- name: nameSlug
30
- });
31
- if ((_b = (_a = detailQuery.data) == null ? void 0 : _a.detailView) == null ? void 0 : _b.form) {
32
- return /* @__PURE__ */ jsx(
33
- SchemaFormView,
34
- {
35
- formSchema: (_d = (_c = detailQuery.data) == null ? void 0 : _c.detailView) == null ? void 0 : _d.form,
36
- onSubmit: (values) => {
37
- console.log(values);
38
- }
39
- }
40
- );
41
- }
42
- return /* @__PURE__ */ jsxs("div", { children: [
43
- /* @__PURE__ */ jsx("pre", { children: JSON.stringify(detailQuery.data, null, 2) }),
44
- /* @__PURE__ */ jsx("pre", { children: JSON.stringify(curdGetQuery.data, null, 2) })
45
- ] });
46
- };
47
- const DetailViewActions = () => {
48
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
49
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(MtButton, { variant: "ghost", className: "m-0 flex h-10 w-10 items-center justify-center border p-0 shadow-sm backdrop-blur", children: /* @__PURE__ */ jsx(Icons.ellipsis, {}) }) }),
50
- /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", children: [
51
- /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Edit" }),
52
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
53
- /* @__PURE__ */ jsx(DropdownMenuGroup, {}),
54
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
55
- ] })
56
- ] });
57
- };
58
- export {
59
- CurdViewDetailDefault,
60
- CurdViewDetailProvider,
61
- DetailViewActions,
62
- curdDetailSlugAtom
63
- };
@@ -1,10 +0,0 @@
1
- import { AnyMessage, PlainMessage } from "@bufbuild/protobuf";
2
- import { CommontListRes } from "../gomtmpb/mtm/sppb/mtm_pb";
3
- export declare const curd3ListParamsAtom: import("jotai").PrimitiveAtom<PlainMessage<AnyMessage>> & {
4
- init: PlainMessage<AnyMessage>;
5
- };
6
- export declare const curdPathAtom: import("jotai").PrimitiveAtom<string> & {
7
- init: string;
8
- };
9
- export declare const curd3ItemsV2Atom: import("jotai").Atom<Promise<CommontListRes>>;
10
- export declare const useCurdSlugName: () => string | undefined;
@@ -1,54 +0,0 @@
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
- import { atom } from "jotai";
23
- import { usePathname } from "next/navigation";
24
- import { useMemo } from "react";
25
- import { CommontListRes } from "../gomtmpb/mtm/sppb/mtm_pb";
26
- import { gomtmBaseUrlAtom } from "../providers/GomtmProvider";
27
- const curd3ListParamsAtom = atom({});
28
- const curdPathAtom = atom("");
29
- const curd3ItemsV2Atom = atom((get) => __async(void 0, null, function* () {
30
- const slugPath = get(curdPathAtom);
31
- const path2 = slugPath.split("/");
32
- const path3 = path2.slice(2).join("/");
33
- const baseUrl = get(gomtmBaseUrlAtom);
34
- const url = new URL(`/curd-api/list/${path3}`, baseUrl);
35
- const data = yield fetch(url.toString(), {}).then((x) => x.json());
36
- const data2 = CommontListRes.fromJson(data);
37
- return data2;
38
- }));
39
- const useCurdSlugName = () => {
40
- const pathname = usePathname();
41
- const nameSlug = useMemo(() => {
42
- const a = pathname.split("/");
43
- if (a.length >= 2) {
44
- return a[2];
45
- }
46
- }, [pathname]);
47
- return nameSlug;
48
- };
49
- export {
50
- curd3ItemsV2Atom,
51
- curd3ListParamsAtom,
52
- curdPathAtom,
53
- useCurdSlugName
54
- };
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function DlgCurdDebugInfo(): import("react").JSX.Element;
3
- export declare const DlgCurdDebugInfoTriggerButton: () => import("react").JSX.Element | null;
@@ -1,24 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx } from "react/jsx-runtime";
3
- import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
4
- import { MtButton } from "mtxuilib/ui/ui-mt/Button";
5
- import { useMtmApp } from "../../providers/GomtmProvider";
6
- import { useListView } from "../CommonListViewV2";
7
- function DlgCurdDebugInfo() {
8
- const listView = useListView();
9
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Dialog, { open: listView.openDebug, onOpenChange: listView.setOpenDebug, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "list view info" }) }) }) });
10
- }
11
- const DlgCurdDebugInfoTriggerButton = () => {
12
- const listView = useListView();
13
- const mtApp = useMtmApp();
14
- if (!mtApp.isDebug) {
15
- return null;
16
- }
17
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtButton, { onClick: () => {
18
- listView.setOpenDebug(true);
19
- }, children: "DlgCurdDebug" }) });
20
- };
21
- export {
22
- DlgCurdDebugInfo,
23
- DlgCurdDebugInfoTriggerButton
24
- };
@@ -1,2 +0,0 @@
1
- import { PropsWithChildren } from "react";
2
- export declare const DashLayout: (props: PropsWithChildren) => import("react").JSX.Element;
@@ -1,39 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
4
- import { atom, useAtom } from "jotai";
5
- import { TailwindIndicator } from "mtxuilib/common/tailwind-indicator";
6
- import { AppMetaRender } from "mtxuilib/store/AppMetaRender";
7
- import { TooltipProvider } from "mtxuilib/ui/tooltip";
8
- import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
9
- import { Toaster } from "sonner";
10
- import Dash5 from "./dash5";
11
- const dashLayoutNameAtom = atom("default");
12
- const DashLayout = (props) => {
13
- const { children } = props;
14
- const [dashLayoutName, setDashLayoutName] = useAtom(dashLayoutNameAtom);
15
- return /* @__PURE__ */ jsxs(Fragment, { children: [
16
- /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 0, children: [
17
- dashLayoutName == "default" ? /* @__PURE__ */ jsx(Dash5, { children }) : /* @__PURE__ */ jsxs("div", { className: "bg-slate-300 p-2", children: [
18
- /* @__PURE__ */ jsx("h1", { children: "unknow layout name" }),
19
- children
20
- ] }),
21
- /* @__PURE__ */ jsx(
22
- ProgressBar,
23
- {
24
- height: "4px",
25
- color: "#4934eb",
26
- options: { showSpinner: false },
27
- shallowRouting: true
28
- }
29
- ),
30
- /* @__PURE__ */ jsx(ReactQueryDevtools, {}),
31
- /* @__PURE__ */ jsx(Toaster, {}),
32
- /* @__PURE__ */ jsx(TailwindIndicator, {})
33
- ] }),
34
- /* @__PURE__ */ jsx(AppMetaRender, {})
35
- ] });
36
- };
37
- export {
38
- DashLayout
39
- };
@@ -1,2 +0,0 @@
1
- import { PropsWithChildren } from "react";
2
- export declare const DashLayout: (props: PropsWithChildren) => import("react").JSX.Element;
@@ -1,39 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
4
- import { atom, useAtom } from "jotai";
5
- import { TailwindIndicator } from "mtxuilib/common/tailwind-indicator";
6
- import { AppMetaRender } from "mtxuilib/store/AppMetaRender";
7
- import { TooltipProvider } from "mtxuilib/ui/tooltip";
8
- import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
9
- import { Toaster } from "sonner";
10
- import Dash5 from "./dash5";
11
- const dashLayoutNameAtom = atom("default");
12
- const DashLayout = (props) => {
13
- const { children } = props;
14
- const [dashLayoutName, setDashLayoutName] = useAtom(dashLayoutNameAtom);
15
- return /* @__PURE__ */ jsxs(Fragment, { children: [
16
- /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 0, children: [
17
- dashLayoutName == "default" ? /* @__PURE__ */ jsx(Dash5, { children }) : /* @__PURE__ */ jsxs("div", { className: "bg-slate-300 p-2", children: [
18
- /* @__PURE__ */ jsx("h1", { children: "unknow layout name" }),
19
- children
20
- ] }),
21
- /* @__PURE__ */ jsx(
22
- ProgressBar,
23
- {
24
- height: "4px",
25
- color: "#4934eb",
26
- options: { showSpinner: false },
27
- shallowRouting: true
28
- }
29
- ),
30
- /* @__PURE__ */ jsx(ReactQueryDevtools, {}),
31
- /* @__PURE__ */ jsx(Toaster, {}),
32
- /* @__PURE__ */ jsx(TailwindIndicator, {})
33
- ] }),
34
- /* @__PURE__ */ jsx(AppMetaRender, {})
35
- ] });
36
- };
37
- export {
38
- DashLayout
39
- };
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export default function UserAvatorMenus(): import("react").JSX.Element;