gomtm 0.0.350 → 0.0.351

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.
@@ -37,7 +37,6 @@ import { createStore, useStore } from "zustand";
37
37
  import { useSuspenseQuery } from "../connectquery";
38
38
  import { curdViewGet } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
39
39
  import { CurdView } from "../gomtmpb/mtm/sppb/mtm_pb";
40
- import CurdCreatePanel from "./create/CurdCreatePanel";
41
40
  import CurdEditPanel from "./edit/CurdEditPanel";
42
41
  import { CommonListView } from "./listview/CommonListView";
43
42
  import { ListViewStoreProvider } from "./listview/list-store";
@@ -100,7 +99,6 @@ const CurdViewView = (props) => {
100
99
  children: [
101
100
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "loading CommonListView" }), children: /* @__PURE__ */ jsx(CommonListView, {}) }),
102
101
  /* @__PURE__ */ jsxs(Suspense, { children: [
103
- /* @__PURE__ */ jsx(CurdCreatePanel, { fullScreen: true }),
104
102
  /* @__PURE__ */ jsx(CurdEditPanel, { fullScreen: true }),
105
103
  /* @__PURE__ */ jsx(PanelRemove, {})
106
104
  ] })
@@ -1,9 +1,8 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useMtRouter } from "mtxuilib/hooks/use-router";
4
- import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
5
- import { FullScreenPanel } from "mtxuilib/ui/ui-mt/FullScreenEditPanel";
6
- import { useMemo } from "react";
4
+ import { MtPopupPanel } from "mtxuilib/ui/ui-mt/MtPopupPanel";
5
+ import { useCallback, useMemo } from "react";
7
6
  import { useGomtmSuspenseQuery } from "../../gomtmQuery";
8
7
  import { RenderViewByName } from "../DynViews";
9
8
  import { useListview } from "../listview/list-store";
@@ -11,9 +10,29 @@ function CurdEditPanel(props) {
11
10
  const { fullScreen } = props;
12
11
  const setOpenEdit = useListview((x) => x.setOpenEdit);
13
12
  const openEdit = useListview((x) => x.openEdit);
13
+ const openCreate = useListview((x) => x.openCreate);
14
+ const setOpenCreate = useListview((x) => x.setOpenCreate);
14
15
  const viewUpdate = useListview((x) => x.viewUpdate);
16
+ const viewCreate = useListview((x) => x.viewCreate);
17
+ const open = openEdit || openCreate;
18
+ const setOpen = useCallback((open2) => {
19
+ if (openCreate) {
20
+ setOpenCreate(false);
21
+ }
22
+ if (openEdit) {
23
+ setOpenEdit(false);
24
+ }
25
+ }, [openCreate, openEdit, setOpenCreate, setOpenEdit]);
15
26
  const router = useMtRouter();
16
- if (!openEdit) {
27
+ const viewName = useMemo(() => {
28
+ if (openCreate) {
29
+ return viewCreate;
30
+ }
31
+ if (openEdit) {
32
+ return viewUpdate;
33
+ }
34
+ }, [openCreate, openEdit, viewCreate, viewUpdate]);
35
+ if (!open) {
17
36
  return null;
18
37
  }
19
38
  if (!viewUpdate) {
@@ -23,13 +42,23 @@ function CurdEditPanel(props) {
23
42
  router.push(viewUpdate);
24
43
  return;
25
44
  }
26
- if (fullScreen) {
27
- return /* @__PURE__ */ jsx(WithLoadGetData, { children: /* @__PURE__ */ jsx(FullScreenPanel, { children: /* @__PURE__ */ jsx(RenderViewByName, { name: viewUpdate }) }) });
45
+ if (!viewName) {
46
+ return /* @__PURE__ */ jsx("div", { children: "missing viewName" });
28
47
  }
29
- return /* @__PURE__ */ jsx(Dialog, { open: openEdit, onOpenChange: setOpenEdit, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
30
- /* @__PURE__ */ jsx(DialogTitle, { children: " Edit " }),
31
- /* @__PURE__ */ jsx(RenderViewByName, { name: viewUpdate })
32
- ] }) });
48
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ "openCrate: ",
50
+ JSON.stringify(openCreate, null, 2),
51
+ /* @__PURE__ */ jsx(
52
+ MtPopupPanel,
53
+ {
54
+ open,
55
+ onOpenChange: setOpen,
56
+ fullScreen,
57
+ title: "create",
58
+ children: /* @__PURE__ */ jsx(RenderViewByName, { name: viewName })
59
+ }
60
+ )
61
+ ] });
33
62
  }
34
63
  const WithLoadGetData = (props) => {
35
64
  const { children } = props;
@@ -186,17 +186,6 @@ const PostCardItemActions = (props) => {
186
186
  }
187
187
  ) }),
188
188
  /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[160px]", children: [
189
- /* @__PURE__ */ jsx(
190
- DropdownMenuItem,
191
- {
192
- onClick: (e) => {
193
- e.preventDefault();
194
- setOpenCreate(true);
195
- setOpen(false);
196
- },
197
- children: "create"
198
- }
199
- ),
200
189
  /* @__PURE__ */ jsx(
201
190
  DropdownMenuItem,
202
191
  {
@@ -63,6 +63,7 @@ const ListViewActions = () => {
63
63
  /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "List \u64CD\u4F5C" }),
64
64
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
65
65
  /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => {
66
+ console.log("setOpenCreate");
66
67
  setOpenCreate(true);
67
68
  setOpen(false);
68
69
  }, children: "create" }) }),
@@ -2,7 +2,6 @@
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CommonListView } from "./CommonListView";
4
4
  import { Suspense } from "react";
5
- import CurdCreatePanel from "../create/CurdCreatePanel";
6
5
  import CurdEditPanel from "../edit/CurdEditPanel";
7
6
  import { PanelRemove } from "../remove/RemovePanel";
8
7
  const ListViewRender = (props) => {
@@ -10,7 +9,6 @@ const ListViewRender = (props) => {
10
9
  return /* @__PURE__ */ jsxs(Fragment, { children: [
11
10
  /* @__PURE__ */ jsx(CommonListView, {}),
12
11
  /* @__PURE__ */ jsxs(Suspense, { children: [
13
- /* @__PURE__ */ jsx(CurdCreatePanel, { fullScreen: true }),
14
12
  /* @__PURE__ */ jsx(CurdEditPanel, { fullScreen: true }),
15
13
  /* @__PURE__ */ jsx(PanelRemove, {})
16
14
  ] }),
@@ -0,0 +1,5 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export declare const GomtmForm: (props: {
3
+ methodGet: string;
4
+ methodSutmit: string;
5
+ } & PropsWithChildren) => import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ import { jsx } from "react/jsx-runtime";
22
+ import { Form } from "mtxuilib/ui/form";
23
+ import { useForm } from "react-hook-form";
24
+ const GomtmForm = (props) => {
25
+ const { children } = props;
26
+ const form = useForm();
27
+ return /* @__PURE__ */ jsx(Form, __spreadProps(__spreadValues({}, form), { children }));
28
+ };
29
+ export {
30
+ GomtmForm
31
+ };