gomtm 0.0.282 → 0.0.284

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.
@@ -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;
@@ -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,
@@ -11,6 +11,7 @@ interface ListViewProps {
11
11
  params?: any;
12
12
  getParams?: any;
13
13
  detailData?: any;
14
+ layout?: string;
14
15
  }
15
16
  export declare function ListViewProvider(props: ListViewProps & PropsWithChildren): import("react").JSX.Element;
16
17
  export declare function useListView<I extends Message<I>, O extends Message<O>>(): {
@@ -24,6 +25,7 @@ export declare function useListView<I extends Message<I>, O extends Message<O>>(
24
25
  params?: any;
25
26
  getParams?: any;
26
27
  detailData?: any;
28
+ layout?: string | undefined;
27
29
  openRemove?: boolean | undefined;
28
30
  setOpenRemove?: Dispatch<SetStateAction<boolean>> | undefined;
29
31
  openCreate?: boolean | undefined;
@@ -35,6 +37,7 @@ export declare function useListView<I extends Message<I>, O extends Message<O>>(
35
37
  setOpenDebug?: Dispatch<SetStateAction<boolean>> | undefined;
36
38
  setParams?: Dispatch<any> | undefined;
37
39
  setDetailData?: Dispatch<any> | undefined;
40
+ setLayout?: Dispatch<SetStateAction<string>> | undefined;
38
41
  };
39
42
  export declare function useDetail(): {
40
43
  svc: string;
@@ -47,6 +50,7 @@ export declare function useDetail(): {
47
50
  params?: any;
48
51
  getParams?: any;
49
52
  detailData?: any;
53
+ layout?: string | undefined;
50
54
  openRemove: boolean;
51
55
  setOpenRemove: Dispatch<SetStateAction<boolean>>;
52
56
  openCreate: boolean;
@@ -58,6 +62,7 @@ export declare function useDetail(): {
58
62
  setOpenDebug: Dispatch<SetStateAction<boolean>>;
59
63
  setParams: Dispatch<any>;
60
64
  setDetailData: Dispatch<any>;
65
+ setLayout: Dispatch<SetStateAction<string>>;
61
66
  };
62
67
  export declare function CommonListView<I extends Message<I>, O extends Message<O>>(): import("react").JSX.Element | null;
63
68
  export declare const ListViewActions: () => import("react").JSX.Element;
@@ -35,7 +35,7 @@ var __async = (__this, __arguments, generator) => {
35
35
  step((generator = generator.apply(__this, __arguments)).next());
36
36
  });
37
37
  };
38
- import { jsx, jsxs } from "react/jsx-runtime";
38
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
39
39
  import { debounce } from "lodash";
40
40
  import { Icons } from "mtxuilib/icons/icons";
41
41
  import { cn } from "mtxuilib/lib/utils";
@@ -44,14 +44,22 @@ 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
  const { children, svc, methodList, methodDelete, slugPath, methodCreate, methodGet } = props;
@@ -64,6 +72,7 @@ function ListViewProvider(props) {
64
72
  const [openDebug, setOpenDebug] = useState(false);
65
73
  const [_params, _setParams] = useState(mtapp.globalSearchParams);
66
74
  const [detailData, setDetailData] = useState(void 0);
75
+ const [layout, setLayout] = useState("default");
67
76
  const params = useMemo(() => {
68
77
  var _a;
69
78
  return {
@@ -93,8 +102,13 @@ function ListViewProvider(props) {
93
102
  params,
94
103
  setParams,
95
104
  detailData,
96
- setDetailData
97
- }, children });
105
+ setDetailData,
106
+ layout,
107
+ setLayout
108
+ }, children: /* @__PURE__ */ jsxs(ListViewLayout, { children: [
109
+ children,
110
+ /* @__PURE__ */ jsx(ListViewLayoutSwitch, {})
111
+ ] }) });
98
112
  }
99
113
  function useListView() {
100
114
  const ctx = useContext(commonListViewContext);
@@ -186,6 +200,38 @@ const ListViewActions = () => {
186
200
  ] })
187
201
  ] });
188
202
  };
203
+ const ListViewLayout = (props) => {
204
+ const listView = useListView();
205
+ const { children } = props;
206
+ return /* @__PURE__ */ jsx(Fragment, { children: listView.layout == "default" ? /* @__PURE__ */ jsxs(ListViewLayoutDefault, { children: [
207
+ " ",
208
+ children,
209
+ " "
210
+ ] }) : listView.layout == "demo" ? /* @__PURE__ */ jsxs(ListViewLayoutDemo, { children: [
211
+ " ",
212
+ children,
213
+ " "
214
+ ] }) : listView.layout == "none" ? /* @__PURE__ */ jsx(Fragment, { children }) : children });
215
+ };
216
+ const ListViewLayoutSwitch = () => {
217
+ const listview = useListView();
218
+ const [open, setOpen] = useState(false);
219
+ useHotkeys(HOTKEY_Listview_Switchlayout, () => {
220
+ setOpen((pre) => !pre);
221
+ }, [open, setOpen]);
222
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
223
+ /* @__PURE__ */ jsxs(DialogTitle, { children: [
224
+ "LayoutSwitch,",
225
+ listview.layout
226
+ ] }),
227
+ /* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout) => {
228
+ return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
229
+ listview.setLayout(layout);
230
+ setOpen(false);
231
+ }, children: layout }, layout);
232
+ }) })
233
+ ] }) });
234
+ };
189
235
  export {
190
236
  CommonListView,
191
237
  ListViewActions,
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare const ListViewLayoutDefault: (props: PropsWithChildren) => import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
+ const ListViewLayoutDefault = (props) => {
4
+ const { children } = props;
5
+ return /* @__PURE__ */ jsx(Fragment, { children });
6
+ };
7
+ export {
8
+ ListViewLayoutDefault
9
+ };
@@ -1,2 +1,2 @@
1
1
  import { PropsWithChildren } from "react";
2
- export default function ListViewDemoLayout(props: PropsWithChildren): import("react").JSX.Element;
2
+ export default function ListViewLayoutDemo(props: PropsWithChildren): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ function ListViewLayoutDemo(props) {
4
+ const { children } = props;
5
+ return /* @__PURE__ */ jsxs("div", { className: "bg-blue-300 p-2", children: [
6
+ /* @__PURE__ */ jsx("h1", { children: "ListViewDemoLayout" }),
7
+ children
8
+ ] });
9
+ }
10
+ export {
11
+ ListViewLayoutDemo as default
12
+ };
@@ -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 } from "react";
10
+ import { Suspense, lazy, useState } from "react";
11
11
  import { useHotkeys } from "react-hotkeys-hook";
12
12
  import { Toaster } from "sonner";
13
13
  import { HOTKEY_Switchlayout } from "../consts";
@@ -50,10 +50,11 @@ const LayoutBase = (props) => {
50
50
  };
51
51
  const LayoutSwitchDlg = () => {
52
52
  const mtapp = useMtmApp();
53
+ const [open, setOpen] = useState(false);
53
54
  useHotkeys(HOTKEY_Switchlayout, () => {
54
- mtapp.setOpenLayoutSwitchDlg((pre) => !pre);
55
- }, [mtapp.setOpenLayoutSwitchDlg, mtapp.openLayoutSwitchDlg]);
56
- return /* @__PURE__ */ jsx(Dialog, { open: mtapp.openLayoutSwitchDlg, onOpenChange: mtapp.setOpenLayoutSwitchDlg, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
55
+ setOpen((pre) => !pre);
56
+ }, [open, setOpen]);
57
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
57
58
  /* @__PURE__ */ jsxs(DialogTitle, { children: [
58
59
  "LayoutSwitch,",
59
60
  mtapp.layoutName
@@ -61,7 +62,7 @@ const LayoutSwitchDlg = () => {
61
62
  /* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout) => {
62
63
  return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
63
64
  mtapp.setLayoutName(layout);
64
- mtapp.setOpenLayoutSwitchDlg(false);
65
+ setOpen(false);
65
66
  }, children: layout }, layout);
66
67
  }) })
67
68
  ] }) });
@@ -15,8 +15,6 @@ export declare function useMtmApp(): {
15
15
  setIsDebug: Dispatch<SetStateAction<boolean>>;
16
16
  setBackendUrl: Dispatch<SetStateAction<string | null | undefined>>;
17
17
  setLayoutName: Dispatch<SetStateAction<string>>;
18
- openLayoutSwitchDlg?: boolean | undefined;
19
- setOpenLayoutSwitchDlg: Dispatch<SetStateAction<boolean>>;
20
18
  setCookieStr: Dispatch<SetStateAction<string>>;
21
19
  globalSearchParams?: any;
22
20
  setGlobalSearchParams: Dispatch<any>;
@@ -54,8 +54,8 @@ function GomtmProvider(props) {
54
54
  setBackendUrl,
55
55
  layoutName: _layoutName,
56
56
  setLayoutName,
57
- openLayoutSwitchDlg,
58
- setOpenLayoutSwitchDlg,
57
+ // openLayoutSwitchDlg: openLayoutSwitchDlg,
58
+ // setOpenLayoutSwitchDlg: setOpenLayoutSwitchDlg,
59
59
  cookieStr: _cookieStr,
60
60
  setCookieStr,
61
61
  globalSearchParams,
@@ -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<{