gomtm 0.0.317 → 0.0.319

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.
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
- export default function CurdEditPanel(): import("react").JSX.Element;
2
+ export default function CurdEditPanel(props: {
3
+ fullScreen?: boolean;
4
+ }): import("react").JSX.Element;
3
5
  export declare const CurdEditPanelTriggerButton: () => import("react").JSX.Element;
@@ -1,12 +1,25 @@
1
1
  "use client";
2
- import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { flexRender } from "mtxuilib/lib/render";
3
4
  import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
4
5
  import { MtButton } from "mtxuilib/ui/ui-mt/Button";
6
+ import { FullScreenPanel } from "mtxuilib/ui/ui-mt/FullScreenEditPanel";
5
7
  import { useListview } from "../listview/list-store";
6
- function CurdEditPanel() {
8
+ function CurdEditPanel(props) {
9
+ const { fullScreen } = props;
7
10
  const setOpenEdit = useListview((x) => x.setOpenEdit);
8
11
  const openEdit = useListview((x) => x.openEdit);
9
- return /* @__PURE__ */ jsx(Dialog, { open: openEdit, onOpenChange: setOpenEdit, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogTitle, { children: " Edit " }) }) });
12
+ const editRender = useListview((x) => x.editRender);
13
+ if (fullScreen) {
14
+ return /* @__PURE__ */ jsx(FullScreenPanel, { children: editRender && flexRender(editRender, {}) });
15
+ }
16
+ return /* @__PURE__ */ jsx(Dialog, { open: openEdit, onOpenChange: setOpenEdit, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
17
+ /* @__PURE__ */ jsx(DialogTitle, { children: " Edit " }),
18
+ editRender && flexRender(editRender, {}),
19
+ /* @__PURE__ */ jsx(MtButton, { onClick: () => {
20
+ console.log("editRender", editRender);
21
+ }, children: "xxxxx" })
22
+ ] }) });
10
23
  }
11
24
  const CurdEditPanelTriggerButton = () => {
12
25
  const setOpenEdit = useListview((x) => x.setOpenEdit);
@@ -5,7 +5,7 @@ import { cn } from "mtxuilib/lib/utils";
5
5
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
6
6
  import { Icons } from "mtxuilib/icons/icons";
7
7
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
8
- import { DropdownMenuItemLink } from "mtxuilib/ui/ui-mt/DropdownMenuItemLink";
8
+ import { useState } from "react";
9
9
  import { useListview } from "../listview/list-store";
10
10
  const PostCardListItem = (props) => {
11
11
  const { item } = props;
@@ -57,7 +57,9 @@ const PostCardItemActions = (props) => {
57
57
  const setOpenCreate = useListview((x) => x.setOpenCreate);
58
58
  const setOpenRemove = useListview((x) => x.setOpenRemove);
59
59
  const slugPath = useListview((x) => x.slugPath);
60
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
60
+ const [open, setOpen] = useState(false);
61
+ const setOpenEdit = useListview((x) => x.setOpenEdit);
62
+ return /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
61
63
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
62
64
  MtLink,
63
65
  {
@@ -74,19 +76,32 @@ const PostCardItemActions = (props) => {
74
76
  /* @__PURE__ */ jsx(
75
77
  DropdownMenuItem,
76
78
  {
77
- onClick: () => {
79
+ onClick: (e) => {
80
+ e.preventDefault();
78
81
  setOpenCreate(true);
82
+ setOpen(false);
79
83
  },
80
84
  children: "create"
81
85
  }
82
86
  ),
83
- /* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${slugPath}/create`, children: "create" }),
84
- /* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${slugPath}/edit/${id}`, children: "edit" }),
85
87
  /* @__PURE__ */ jsx(
86
88
  DropdownMenuItem,
87
89
  {
88
- onClick: () => {
90
+ onClick: (e) => {
91
+ e.preventDefault();
92
+ setOpenEdit(true);
93
+ setOpen(false);
94
+ },
95
+ children: "edit"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsx(
99
+ DropdownMenuItem,
100
+ {
101
+ onClick: (e) => {
102
+ e.preventDefault();
89
103
  setOpenRemove(true);
104
+ setOpen(false);
90
105
  },
91
106
  children: "remove"
92
107
  }
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare const ListViewSetupEditView: (props: PropsWithChildren) => null;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ import { useListview } from "./list-store";
4
+ const ListViewSetupEditView = (props) => {
5
+ const { children } = props;
6
+ const setEditRender = useListview((x) => x.setEditRender);
7
+ const openEdit = useListview((x) => x.openEdit);
8
+ useMemo(() => {
9
+ setEditRender(children);
10
+ }, [children, setEditRender, openEdit]);
11
+ return null;
12
+ };
13
+ export {
14
+ ListViewSetupEditView
15
+ };
@@ -1,24 +1,4 @@
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 { jsx, jsxs } from "react/jsx-runtime";
23
3
  import { Icons } from "mtxuilib/icons/icons";
24
4
  import { cn } from "mtxuilib/lib/utils";
@@ -30,9 +10,9 @@ import { Suspense, lazy, useMemo, useState } from "react";
30
10
  import { useHotkeys } from "react-hotkeys-hook";
31
11
  import { MtmErrorView } from "../../components/MtmErrorView";
32
12
  import { HOTKEY_Listview_Switchlayout } from "../../consts";
33
- import { useGomtmMutation, useGomtmSuspenseInfiniteQuery } from "../../gomtmQuery";
34
- import CurdCreatePanel, { CurdCreatePanelTriggerButton } from "../create/CurdCreatePanel";
35
- import CurdEditPanel, { CurdEditPanelTriggerButton } from "../edit/CurdEditPanel";
13
+ import { useGomtmSuspenseInfiniteQuery } from "../../gomtmQuery";
14
+ import { CurdCreatePanelTriggerButton } from "../create/CurdCreatePanel";
15
+ import { CurdEditPanelTriggerButton } from "../edit/CurdEditPanel";
36
16
  import { ListItemView } from "../list-item/ListItem";
37
17
  import { ListLayout } from "../list-item/ListLayout";
38
18
  import { useListview } from "./list-store";
@@ -80,51 +60,16 @@ function CommonListView() {
80
60
  /* @__PURE__ */ jsx("div", { className: "absolute right-1 top-1", children: /* @__PURE__ */ jsx(ListViewActions, {}) })
81
61
  ] });
82
62
  }
83
- const PanelRemove = () => {
84
- const svc = useListview((x) => x.svc);
85
- const openRemove = useListview((x) => x.openRemove);
86
- const setOpenRemove = useListview((x) => x.setOpenRemove);
87
- const methodDelete = useListview((x) => x.methodDelete);
88
- const mutation = useGomtmMutation(svc, methodDelete);
89
- const activateItem = useListview((x) => x.activateItem);
90
- return /* @__PURE__ */ jsx(Dialog, { open: openRemove, onOpenChange: setOpenRemove, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
91
- /* @__PURE__ */ jsx(DialogTitle, { children: "remove item" }),
92
- /* @__PURE__ */ jsx(MtButton, { onClick: () => __async(void 0, null, function* () {
93
- yield mutation.mutateAsync({
94
- id: activateItem == null ? void 0 : activateItem.id
95
- });
96
- setOpenRemove(false);
97
- }), children: "ok" })
98
- ] }) });
99
- };
100
- const PanelCreate = () => {
101
- const svc = useListview((x) => x.svc);
102
- const openCreate = useListview((x) => x.openCreate);
103
- const setOpenCreate = useListview((x) => x.setOpenCreate);
104
- const methodDelete = useListview((x) => x.methodDelete);
105
- return /* @__PURE__ */ jsx(Dialog, { open: openCreate, onOpenChange: setOpenCreate, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
106
- /* @__PURE__ */ jsx(DialogTitle, { children: "TODO create item Dlg" }),
107
- /* @__PURE__ */ jsx(MtButton, { onClick: () => __async(void 0, null, function* () {
108
- setOpenCreate(false);
109
- }), children: "ok" })
110
- ] }) });
111
- };
112
63
  const ListViewActions = () => {
113
64
  return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
114
65
  /* @__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, {}) }) }),
115
66
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", children: [
116
67
  /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Edit" }),
117
68
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
118
- /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
119
- /* @__PURE__ */ jsx(PanelRemove, {}),
120
- /* @__PURE__ */ jsx(PanelCreate, {}),
121
- /* @__PURE__ */ jsx(CurdCreatePanel, {}),
122
- /* @__PURE__ */ jsx(CurdEditPanel, {}),
123
- /* @__PURE__ */ jsxs("div", { className: "bg-yellow-100 p-2", children: [
124
- /* @__PURE__ */ jsx(CurdEditPanelTriggerButton, {}),
125
- /* @__PURE__ */ jsx(CurdCreatePanelTriggerButton, {})
126
- ] })
127
- ] }) }) }),
69
+ /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxs("div", { className: "bg-yellow-100 p-2", children: [
70
+ /* @__PURE__ */ jsx(CurdEditPanelTriggerButton, {}),
71
+ /* @__PURE__ */ jsx(CurdCreatePanelTriggerButton, {})
72
+ ] }) }) }) }),
128
73
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
129
74
  ] })
130
75
  ] });
@@ -1,9 +1,22 @@
1
1
  "use client";
2
- import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CommonListView } from "./ListViewProvider";
4
+ import { Suspense } from "react";
5
+ import CurdCreatePanel from "../create/CurdCreatePanel";
6
+ import CurdEditPanel from "../edit/CurdEditPanel";
7
+ import { PanelRemove } from "../remove/RemovePanel";
4
8
  const ListViewRender = (props) => {
5
9
  const { children } = props;
6
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(CommonListView, {}) });
10
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
11
+ /* @__PURE__ */ jsx(CommonListView, {}),
12
+ /* @__PURE__ */ jsxs(Suspense, { children: [
13
+ /* @__PURE__ */ jsx(PanelRemove, {}),
14
+ /* @__PURE__ */ jsx(CurdCreatePanel, {}),
15
+ /* @__PURE__ */ jsx(CurdEditPanel, { fullScreen: true }),
16
+ /* @__PURE__ */ jsx(PanelRemove, {})
17
+ ] }),
18
+ children
19
+ ] });
7
20
  };
8
21
  export {
9
22
  ListViewRender
@@ -31,29 +31,19 @@ var __objRest = (source, exclude) => {
31
31
  };
32
32
  import { jsx } from "react/jsx-runtime";
33
33
  import { PrefetchConnectInfiniteQuery } from "../../components/SSR";
34
- import { siteList } from "../../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
35
- import { ListViewStoreProvider } from "./list-store";
36
34
  import { ListViewRender } from "./ListViewRender";
35
+ import { ListViewStoreProvider } from "./list-store";
37
36
  function MtListView(props) {
38
37
  const _a = props, { children } = _a, etc = __objRest(_a, ["children"]);
39
- return /* @__PURE__ */ jsx(
40
- ListViewStoreProvider,
41
- __spreadProps(__spreadValues({}, etc), {
42
- svc: siteList.service.typeName,
43
- methodList: siteList.name,
44
- paramsList: etc.paramsList,
45
- paramsGet: etc.paramsGet,
46
- children: /* @__PURE__ */ jsx(
47
- PrefetchConnectInfiniteQuery,
48
- {
49
- svc: siteList.service.typeName,
50
- method: siteList.name,
51
- input: etc.paramsList,
52
- children: /* @__PURE__ */ jsx(ListViewRender, { children })
53
- }
54
- )
55
- })
56
- );
38
+ return /* @__PURE__ */ jsx(ListViewStoreProvider, __spreadProps(__spreadValues({}, etc), { children: /* @__PURE__ */ jsx(
39
+ PrefetchConnectInfiniteQuery,
40
+ {
41
+ svc: etc.svc,
42
+ method: etc.methodList,
43
+ input: etc.paramsList,
44
+ children: /* @__PURE__ */ jsx(ListViewRender, { children })
45
+ }
46
+ ) }));
57
47
  }
58
48
  export {
59
49
  MtListView as default
@@ -1,3 +1,4 @@
1
+ import { Renderable } from 'mtxuilib/lib/render';
1
2
  import { ComponentProps, PropsWithChildren } from 'react';
2
3
  interface ListViewStateProps {
3
4
  backendUrl?: string;
@@ -14,6 +15,7 @@ interface ListViewStateProps {
14
15
  layout?: string;
15
16
  data?: any;
16
17
  error?: any;
18
+ editRender?: Renderable<any>;
17
19
  }
18
20
  export interface ListViewState extends ListViewStateProps {
19
21
  openRemove: boolean;
@@ -26,6 +28,7 @@ export interface ListViewState extends ListViewStateProps {
26
28
  setActivateItem: (activateItem: any) => void;
27
29
  loadListData: () => Promise<any>;
28
30
  nextPage: () => void;
31
+ setEditRender: (a: Renderable<any>) => void;
29
32
  }
30
33
  export declare const listViewContext: import("react").Context<import("zustand").StoreApi<ListViewState> | null>;
31
34
  type BearProviderProps = React.PropsWithChildren<ListViewStateProps>;
@@ -95,7 +95,8 @@ const createListviewStore = (initProps) => {
95
95
  return data;
96
96
  }),
97
97
  nextPage: () => {
98
- }
98
+ },
99
+ setEditRender: (editRender) => set({ editRender })
99
100
  }));
100
101
  };
101
102
  const listViewContext = createContext(null);
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const PanelRemove: () => import("react").JSX.Element;
@@ -0,0 +1,46 @@
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 { jsx, jsxs } from "react/jsx-runtime";
23
+ import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
24
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
25
+ import { useGomtmMutation } from "../../gomtmQuery";
26
+ import { useListview } from "../listview/list-store";
27
+ const PanelRemove = () => {
28
+ const svc = useListview((x) => x.svc);
29
+ const openRemove = useListview((x) => x.openRemove);
30
+ const setOpenRemove = useListview((x) => x.setOpenRemove);
31
+ const methodDelete = useListview((x) => x.methodDelete);
32
+ const mutation = useGomtmMutation(svc, methodDelete);
33
+ const activateItem = useListview((x) => x.activateItem);
34
+ return /* @__PURE__ */ jsx(Dialog, { open: openRemove, onOpenChange: setOpenRemove, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
35
+ /* @__PURE__ */ jsx(DialogTitle, { children: "remove item" }),
36
+ /* @__PURE__ */ jsx(MtButton, { onClick: () => __async(void 0, null, function* () {
37
+ yield mutation.mutateAsync({
38
+ id: activateItem == null ? void 0 : activateItem.id
39
+ });
40
+ setOpenRemove(false);
41
+ }), children: "ok" })
42
+ ] }) });
43
+ };
44
+ export {
45
+ PanelRemove
46
+ };
@@ -16,6 +16,8 @@ import { Button } from "mtxuilib/ui/button";
16
16
  import { Input } from "mtxuilib/ui/input";
17
17
  import { Sheet, SheetContent, SheetTrigger } from "mtxuilib/ui/sheet";
18
18
  import Link from "next/link";
19
+ import { Suspense } from "react";
20
+ import UserAvatorMenus from "../UserAvatorMenus";
19
21
  const Header = () => {
20
22
  return /* @__PURE__ */ jsxs("header", { className: cn(
21
23
  "bg-background sticky top-0 z-30 flex h-14 items-center gap-4 border-b px-4 pt-1 sm:static sm:h-auto sm:border-0 sm:bg-transparent sm:px-6"
@@ -113,7 +115,8 @@ const Header = () => {
113
115
  }
114
116
  }
115
117
  )
116
- ] })
118
+ ] }),
119
+ /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(UserAvatorMenus, {}) })
117
120
  ] });
118
121
  };
119
122
  export {
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { MtLink } from "mtxuilib/common/mtlink";
3
3
  import { Suspense } from "react";
4
+ import UserAvatorMenus from "../UserAvatorMenus";
4
5
  import { PageSearchCmd } from "./PageSearchCmd";
5
6
  import { MainNav } from "./main-nav";
6
7
  const FrontLayoutHeader = () => {
@@ -9,7 +10,7 @@ const FrontLayoutHeader = () => {
9
10
  /* @__PURE__ */ jsx(MainNav, {}),
10
11
  /* @__PURE__ */ jsx("nav", { className: " flex items-center space-x-6 text-sm font-medium" }),
11
12
  /* @__PURE__ */ jsx(PageSearchCmd, {}),
12
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 shrink items-center justify-end space-x-2 pr-4", children: /* @__PURE__ */ jsx("nav", { className: "flex items-center", children: /* @__PURE__ */ jsx(Suspense, {}) }) })
13
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 shrink items-center justify-end space-x-2 pr-4", children: /* @__PURE__ */ jsx("nav", { className: "flex items-center", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(UserAvatorMenus, {}) }) }) })
13
14
  ] }) });
14
15
  };
15
16
  export {