gomtm 0.0.359 → 0.0.361

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 (29) hide show
  1. package/dist/esm/components/curdView/curdViewEditor.d.ts +2 -0
  2. package/dist/esm/components/curdView/curdViewEditor.js +41 -0
  3. package/dist/esm/curd/CurdView.js +1 -1
  4. package/dist/esm/curd/CurdViewSS.js +3 -3
  5. package/dist/esm/curd/DynViews.d.ts +1 -0
  6. package/dist/esm/curd/DynViews.js +46 -3
  7. package/dist/esm/curd/form/FormShell.d.ts +2 -0
  8. package/dist/esm/curd/form/FormShell.js +9 -0
  9. package/dist/esm/curd/form/formStore.d.ts +9 -14
  10. package/dist/esm/curd/form/formStore.js +58 -20
  11. package/dist/esm/curd/listview/CommonListView.js +35 -8
  12. package/dist/esm/curd/listview/list-store.d.ts +2 -2
  13. package/dist/esm/curd/listview/list-store.js +2 -14
  14. package/dist/esm/curd/remove/RemovePanel.js +2 -5
  15. package/dist/esm/gomtmpb/mtm/sppb/curd-CurdService_connectquery.d.ts +42 -2
  16. package/dist/esm/gomtmpb/mtm/sppb/curd-CurdService_connectquery.js +46 -2
  17. package/dist/esm/gomtmpb/mtm/sppb/curd_connect.d.ts +26 -2
  18. package/dist/esm/gomtmpb/mtm/sppb/curd_connect.js +43 -2
  19. package/dist/esm/gomtmpb/mtm/sppb/curd_pb.d.ts +44 -0
  20. package/dist/esm/gomtmpb/mtm/sppb/curd_pb.js +106 -0
  21. package/dist/esm/gomtmpb/mtm/sppb/mtm-MtmService_connectquery.d.ts +1 -41
  22. package/dist/esm/gomtmpb/mtm/sppb/mtm-MtmService_connectquery.js +1 -45
  23. package/dist/esm/gomtmpb/mtm/sppb/mtm_connect.d.ts +1 -25
  24. package/dist/esm/gomtmpb/mtm/sppb/mtm_connect.js +1 -37
  25. package/dist/esm/gomtmpb/mtm/sppb/mtm_pb.d.ts +0 -42
  26. package/dist/esm/gomtmpb/mtm/sppb/mtm_pb.js +0 -94
  27. package/dist/esm/mtmFetcher.js +5 -1
  28. package/dist/tsconfig.type.tsbuildinfo +1 -1
  29. package/package.json +3 -3
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function CurdViewEditor(): import("react").JSX.Element;
@@ -0,0 +1,41 @@
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
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "mtxuilib/ui/form";
20
+ import { Input } from "mtxuilib/ui/input";
21
+ import { useFormContext } from "react-hook-form";
22
+ import { FormShell } from "../../curd/form/FormShell";
23
+ function CurdViewEditor() {
24
+ const form = useFormContext();
25
+ return /* @__PURE__ */ jsx(FormShell, { children: /* @__PURE__ */ jsx(
26
+ FormField,
27
+ {
28
+ control: form.control,
29
+ name: "svcName",
30
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
31
+ /* @__PURE__ */ jsx(FormLabel, { children: "Svc" }),
32
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, __spreadValues({ placeholder: "svcName" }, field)) }),
33
+ /* @__PURE__ */ jsx(FormDescription, { children: "svcName" }),
34
+ /* @__PURE__ */ jsx(FormMessage, {})
35
+ ] })
36
+ }
37
+ ) });
38
+ }
39
+ export {
40
+ CurdViewEditor as default
41
+ };
@@ -35,7 +35,7 @@ import { toPlainMessage } from "@bufbuild/protobuf";
35
35
  import { Suspense, createContext, useContext, useRef } from "react";
36
36
  import { createStore, useStore } from "zustand";
37
37
  import { useSuspenseQuery } from "../connectquery";
38
- import { curdViewGet } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
38
+ import { curdViewGet } from "../gomtmpb/mtm/sppb/curd-CurdService_connectquery";
39
39
  import { CurdView } from "../gomtmpb/mtm/sppb/mtm_pb";
40
40
  import { CommonListView } from "./listview/CommonListView";
41
41
  import { ListViewStoreProvider } from "./listview/list-store";
@@ -21,15 +21,15 @@ var __async = (__this, __arguments, generator) => {
21
21
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
22
  import { Suspense } from "react";
23
23
  import { PrefetchConnectInfiniteQuery, PrefetchConnectQuery } from "../components/SSR";
24
- import { curdViewGet } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
25
- import { MtmService } from "../gomtmpb/mtm/sppb/mtm_connect";
24
+ import { curdViewGet } from "../gomtmpb/mtm/sppb/curd-CurdService_connectquery";
25
+ import { CurdService } from "../gomtmpb/mtm/sppb/curd_connect";
26
26
  import { CurdViewGetReq } from "../gomtmpb/mtm/sppb/mtm_pb";
27
27
  import { createMtmServiceClient } from "../mtmFetcher";
28
28
  import { CurdViewView } from "./CurdView";
29
29
  const CurdViewSS = (props) => __async(void 0, null, function* () {
30
30
  var _a, _b;
31
31
  const { name } = props;
32
- const client = createMtmServiceClient(MtmService);
32
+ const client = createMtmServiceClient(CurdService);
33
33
  const curdViewRes = yield client.curdViewGet(new CurdViewGetReq({
34
34
  name
35
35
  }));
@@ -2,4 +2,5 @@ import { ComponentType } from "react";
2
2
  export declare const RegisterEditorComponent: (name: string, Component: ComponentType<any>) => void;
3
3
  export declare const RenderViewByName: (props: {
4
4
  name: string;
5
+ warpper?: "fullScreen" | "none" | "form";
5
6
  }) => import("react").JSX.Element;
@@ -1,12 +1,36 @@
1
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));
2
21
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Suspense, useMemo } from "react";
22
+ import { EditFormToolbar } from "mtxuilib/form/EditFormToolbar";
23
+ import { Suspense, lazy, useMemo, useState } from "react";
24
+ import { FormProvider } from "react-hook-form";
25
+ import { useGomtmForm2 } from "./form/formStore";
4
26
  const allEditorComponent = {};
5
27
  const RegisterEditorComponent = (name, Component) => {
6
28
  allEditorComponent[name] = Component;
7
29
  };
8
30
  const RenderViewByName = (props) => {
9
- const { name } = props;
31
+ const { name, warpper } = props;
32
+ const [_warpper, setWrapper] = useState(warpper);
33
+ const form = useGomtmForm2();
10
34
  const Comp = useMemo(() => {
11
35
  const c = allEditorComponent[name || ""];
12
36
  return c || null;
@@ -18,8 +42,27 @@ const RenderViewByName = (props) => {
18
42
  "\u201D"
19
43
  ] });
20
44
  }
21
- return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "loading" }), children: /* @__PURE__ */ jsx(Comp, {}) });
45
+ if (!form.form) {
46
+ return /* @__PURE__ */ jsx("div", { children: "missing formObj2" });
47
+ }
48
+ switch (_warpper) {
49
+ case "none":
50
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "loading" }), children: /* @__PURE__ */ jsx(Comp, {}) });
51
+ default:
52
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "loading" }), children: /* @__PURE__ */ jsx(FormProvider, __spreadProps(__spreadValues({}, form.form), { children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleFormSubmit, children: [
53
+ /* @__PURE__ */ jsx("div", { className: " sticky top-0 z-30 p-1", children: /* @__PURE__ */ jsx(
54
+ EditFormToolbar,
55
+ {
56
+ onSubmit: form.handleValuesSubmit,
57
+ onCancel: form.handleCancel
58
+ }
59
+ ) }),
60
+ /* @__PURE__ */ jsx(Comp, {})
61
+ ] }) })) });
62
+ }
22
63
  };
64
+ const LzCurdViewEditor = lazy(() => import("../components/curdView/curdViewEditor"));
65
+ RegisterEditorComponent("CurdViewEditor", LzCurdViewEditor);
23
66
  export {
24
67
  RegisterEditorComponent,
25
68
  RenderViewByName
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare const FormShell: (props: PropsWithChildren) => import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ const FormShell = (props) => {
4
+ const { children } = props;
5
+ return /* @__PURE__ */ jsx("div", { children });
6
+ };
7
+ export {
8
+ FormShell
9
+ };
@@ -1,22 +1,14 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  interface GomtmFormProps {
3
+ svc: string;
4
+ method?: string;
3
5
  open?: boolean;
4
6
  fullScreen?: boolean;
5
7
  viewName: string;
6
8
  title?: string;
7
9
  onOpenChange?: (open: boolean) => void;
8
10
  }
9
- export interface GomtmFormState extends GomtmFormProps {
10
- setOpen: (open: boolean) => void;
11
- setFullScreen: (open: boolean) => void;
12
- setTitle: (title: string) => void;
13
- handleSubmit: (values: any) => void;
14
- handleCancel: (values?: any) => void;
15
- }
16
- export declare const gomtmFormContext: import("react").Context<import("zustand").StoreApi<GomtmFormState> | null>;
17
- export declare const GomtmFormProvider: (props: PropsWithChildren<GomtmFormProps>) => import("react").JSX.Element;
18
- export declare function useGomtmForm(): GomtmFormState;
19
- export declare function useGomtmForm<T>(selector: (state: GomtmFormState) => T): T;
11
+ export declare const GomtmForm: (props: PropsWithChildren<GomtmFormProps>) => import("react").JSX.Element;
20
12
  export declare function useGomtmForm2(): {
21
13
  form: import("react-hook-form").UseFormReturn<import("react-hook-form").FieldValues, any, undefined>;
22
14
  open: boolean | undefined;
@@ -24,11 +16,14 @@ export declare function useGomtmForm2(): {
24
16
  fullScreen: boolean | undefined;
25
17
  viewName: string;
26
18
  title: string | undefined;
19
+ handleFormSubmit: () => void;
20
+ handleValuesSubmit: (values: any) => Promise<void>;
21
+ handleCancel: () => void;
27
22
  setFullScreen: (open: boolean) => void;
28
23
  setTitle: (title: string) => void;
29
- handleSubmit: (values: any) => void;
30
- handleCancel: (values?: any) => void;
24
+ svc: string;
25
+ method?: string | undefined;
31
26
  onOpenChange?: ((open: boolean) => void) | undefined;
32
27
  };
33
- export declare function GomtmFormDebug(): import("react").JSX.Element;
28
+ export declare function GomtmFormDebug(): import("react").JSX.Element | null;
34
29
  export {};
@@ -30,30 +30,43 @@ var __objRest = (source, exclude) => {
30
30
  }
31
31
  return target;
32
32
  };
33
+ var __async = (__this, __arguments, generator) => {
34
+ return new Promise((resolve, reject) => {
35
+ var fulfilled = (value) => {
36
+ try {
37
+ step(generator.next(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ };
42
+ var rejected = (value) => {
43
+ try {
44
+ step(generator.throw(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
+ step((generator = generator.apply(__this, __arguments)).next());
51
+ });
52
+ };
33
53
  import { jsx, jsxs } from "react/jsx-runtime";
34
54
  import { createContext, useCallback, useContext, useMemo, useRef } from "react";
35
55
  import { useForm } from "react-hook-form";
36
56
  import { useStore } from "zustand";
37
57
  import { createStore } from "zustand/vanilla";
58
+ import { useGomtmMutation } from "../../gomtmQuery";
59
+ import { useGomtm } from "../../store/mtapp-store";
38
60
  const createGomtmFormStore = (initProps) => {
39
61
  const DEFAULT_PROPS = {
40
62
  open: false,
41
- viewName: ""
63
+ viewName: "",
64
+ svc: ""
42
65
  };
43
66
  return createStore()((set, get) => __spreadProps(__spreadValues(__spreadValues({}, DEFAULT_PROPS), initProps), {
44
67
  setOpen: (open) => set({ open }),
45
68
  setFullScreen: (fullScreen) => set({ fullScreen }),
46
- setTitle: (title) => set({ title }),
47
- handleSubmit: (values) => {
48
- console.log("TODO submit formvalues", values);
49
- },
50
- handleCancel: (values) => {
51
- set({ open: false });
52
- const onOpenChange = get().onOpenChange;
53
- if (onOpenChange) {
54
- onOpenChange(false);
55
- }
56
- }
69
+ setTitle: (title) => set({ title })
57
70
  }));
58
71
  };
59
72
  const gomtmFormContext = createContext(null);
@@ -83,39 +96,64 @@ function useGomtmForm(selector) {
83
96
  const formStore = useStore(store, selector);
84
97
  return formStore;
85
98
  }
99
+ const GomtmForm = (props) => {
100
+ const _a = props, { children } = _a, etc = __objRest(_a, ["children"]);
101
+ return /* @__PURE__ */ jsx(GomtmFormProvider, __spreadProps(__spreadValues({}, etc), { children }));
102
+ };
86
103
  function useGomtmForm2() {
87
104
  const storeForm = useGomtmForm();
88
105
  const _setOpen = useGomtmForm((x) => x.setOpen);
89
106
  const fullScreen = useGomtmForm((x) => x.fullScreen);
90
107
  const viewName = useGomtmForm((x) => x.viewName);
91
108
  const title = useGomtmForm((x) => x.title);
109
+ const _onOpenChange = useGomtmForm((x) => x.onOpenChange);
110
+ const method = useGomtmForm((x) => x.method);
111
+ const svc = useGomtmForm((x) => x.svc);
112
+ const mutation = useGomtmMutation(svc, method);
92
113
  const form = useForm();
93
- const open = storeForm.open;
94
- const setOpen = useCallback((open2) => {
95
- _setOpen(open2);
114
+ const setOpen = useCallback((open) => {
115
+ _setOpen(open);
96
116
  }, [_setOpen]);
117
+ const handleValuesSubmit = useCallback((values) => __async(this, null, function* () {
118
+ const result = yield mutation.mutateAsync(values);
119
+ setOpen(false);
120
+ }), [setOpen, mutation]);
121
+ const handleFormSubmit = useCallback(() => {
122
+ form.handleSubmit(handleValuesSubmit);
123
+ }, [form, handleValuesSubmit]);
124
+ const handleCancel = useCallback(() => {
125
+ _setOpen(false);
126
+ if (_onOpenChange) {
127
+ _onOpenChange(false);
128
+ }
129
+ }, [_onOpenChange, _setOpen]);
97
130
  return __spreadProps(__spreadValues({}, storeForm), {
98
131
  form,
99
- open,
132
+ open: storeForm.open,
100
133
  setOpen,
101
134
  fullScreen,
102
135
  viewName,
103
- title
136
+ title,
137
+ handleFormSubmit,
138
+ handleValuesSubmit,
139
+ handleCancel
104
140
  });
105
141
  }
106
142
  function GomtmFormDebug() {
107
143
  const viewName = useGomtmForm((x) => x.viewName);
108
144
  const open = useGomtmForm((x) => x.open);
109
145
  const gomtmForm = useGomtmForm2();
146
+ const debug = useGomtm((x) => x.debug);
147
+ if (!debug) {
148
+ return null;
149
+ }
110
150
  return /* @__PURE__ */ jsxs("div", { className: "bg-blue-100 p-2", children: [
111
151
  /* @__PURE__ */ jsx("h1", { children: "GomtmFormDebug" }),
112
152
  /* @__PURE__ */ jsx("pre", { children: JSON.stringify({ viewName, open, open2: gomtmForm.open }, null, 2) })
113
153
  ] });
114
154
  }
115
155
  export {
156
+ GomtmForm,
116
157
  GomtmFormDebug,
117
- GomtmFormProvider,
118
- gomtmFormContext,
119
- useGomtmForm,
120
158
  useGomtmForm2
121
159
  };
@@ -9,7 +9,7 @@ import { Suspense, lazy, useState } from "react";
9
9
  import { MtmErrorView } from "../../components/MtmErrorView";
10
10
  import { useGomtmSuspenseInfiniteQuery } from "../../gomtmQuery";
11
11
  import CurdEditPanel from "../form/CurdEditPanel";
12
- import { GomtmFormProvider } from "../form/formStore";
12
+ import { GomtmForm } from "../form/formStore";
13
13
  import { CommontListResView } from "../list-item/ListViewLayoutRender";
14
14
  import { PanelRemove } from "../remove/RemovePanel";
15
15
  import { useListview } from "./list-store";
@@ -29,6 +29,10 @@ function CommonListView() {
29
29
  const setOpenCreate = useListview((x) => x.setOpenCreate);
30
30
  const viewUpdate = useListview((x) => x.viewUpdate);
31
31
  const viewCreate = useListview((x) => x.viewCreate);
32
+ const methodUpdate = useListview((x) => x.methodUpdate);
33
+ const methodCreate = useListview((x) => x.methodCreate);
34
+ const openCurdViewEditor = useListview((x) => x.openCurdViewEditor);
35
+ const setOpenCurdViewEditor = useListview((x) => x.setOpenCurdViewEditor);
32
36
  const listQuery = useGomtmSuspenseInfiniteQuery(svc, methodList, paramList);
33
37
  if (!(listQuery == null ? void 0 : listQuery.data)) {
34
38
  return null;
@@ -62,41 +66,64 @@ function CommonListView() {
62
66
  /* @__PURE__ */ jsx("div", { className: "absolute right-1 top-1", children: /* @__PURE__ */ jsx(ListViewActions, {}) }),
63
67
  /* @__PURE__ */ jsxs(Suspense, { children: [
64
68
  /* @__PURE__ */ jsx(
65
- GomtmFormProvider,
69
+ GomtmForm,
66
70
  {
67
71
  open: openEdit,
68
72
  fullScreen: true,
69
73
  viewName: viewUpdate,
70
74
  onOpenChange: setOpenEdit,
75
+ svc,
76
+ method: methodUpdate,
71
77
  children: /* @__PURE__ */ jsx(CurdEditPanel, {})
72
78
  }
73
79
  ),
74
80
  /* @__PURE__ */ jsx(
75
- GomtmFormProvider,
81
+ GomtmForm,
76
82
  {
77
83
  open: openCreate,
78
84
  fullScreen: true,
79
85
  viewName: viewCreate,
80
86
  onOpenChange: setOpenCreate,
87
+ svc,
88
+ method: methodCreate,
81
89
  children: /* @__PURE__ */ jsx(CurdEditPanel, {})
82
90
  }
83
91
  ),
84
- /* @__PURE__ */ jsx(PanelRemove, {})
92
+ /* @__PURE__ */ jsx(PanelRemove, {}),
93
+ openCurdViewEditor && /* @__PURE__ */ jsx(
94
+ GomtmForm,
95
+ {
96
+ open: openCurdViewEditor,
97
+ fullScreen: true,
98
+ viewName: "CurdViewEditor",
99
+ onOpenChange: setOpenCurdViewEditor,
100
+ svc: "sppb.CurdService",
101
+ method: methodCreate,
102
+ children: /* @__PURE__ */ jsx(CurdEditPanel, {})
103
+ }
104
+ )
85
105
  ] })
86
106
  ] });
87
107
  }
88
108
  const ListViewActions = () => {
89
109
  const [open, setOpen] = useState(false);
90
110
  const setOpenCreate = useListview((x) => x.setOpenCreate);
111
+ const setOpenCurdViewEditor = useListview((x) => x.setOpenCurdViewEditor);
91
112
  return /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
92
113
  /* @__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, {}) }) }),
93
114
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", children: [
94
115
  /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "List \u64CD\u4F5C" }),
95
116
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
96
- /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => {
97
- setOpenCreate(true);
98
- setOpen(false);
99
- }, children: "create" }) }),
117
+ /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
118
+ /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => {
119
+ setOpenCreate(true);
120
+ setOpen(false);
121
+ }, children: "create" }),
122
+ /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => {
123
+ setOpenCurdViewEditor(true);
124
+ setOpen(false);
125
+ }, children: "editView" })
126
+ ] }),
100
127
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
101
128
  ] })
102
129
  ] });
@@ -20,6 +20,7 @@ interface ListViewStateProps {
20
20
  viewUpdate: string;
21
21
  viewCreate: string;
22
22
  curdView?: PlainMessage<CurdView>;
23
+ openCurdViewEditor?: boolean;
23
24
  }
24
25
  export interface ListViewState extends ListViewStateProps {
25
26
  openRemove: boolean;
@@ -32,11 +33,10 @@ export interface ListViewState extends ListViewStateProps {
32
33
  setActivateItem: (activateItem: any) => void;
33
34
  nextPage: () => void;
34
35
  setDetailData: (detailData: any) => void;
36
+ setOpenCurdViewEditor: (openCurdViewEditor: boolean) => void;
35
37
  }
36
38
  export declare const listViewContext: import("react").Context<import("zustand").StoreApi<ListViewState> | null>;
37
39
  export declare const ListViewStoreProvider: (props: PropsWithChildren<ListViewStateProps>) => import("react").JSX.Element;
38
40
  export declare const ListView: (props: Omit<ComponentProps<typeof ListViewStoreProvider>, 'backendUrl'> & PropsWithChildren) => import("react").JSX.Element;
39
41
  export declare function useListview<T>(selector: (state: ListViewState) => T): T;
40
- export declare const useCurdUpdateMutation: () => import("@tanstack/react-query").UseMutationResult<unknown, any, any, any>;
41
- export declare const useCurdCreateMutation: () => import("@tanstack/react-query").UseMutationResult<unknown, any, any, any>;
42
42
  export {};
@@ -36,7 +36,6 @@ import { createContext, useContext, useRef } from "react";
36
36
  import { useStore } from "zustand";
37
37
  import { createStore } from "zustand/vanilla";
38
38
  import { CONST_cookieListViewLayout } from "../../consts";
39
- import { useGomtmMutation } from "../../gomtmQuery";
40
39
  import { useGomtm } from "../../store/mtapp-store";
41
40
  const createListviewStore = (initProps) => {
42
41
  const DEFAULT_PROPS = {
@@ -64,7 +63,8 @@ const createListviewStore = (initProps) => {
64
63
  },
65
64
  nextPage: () => {
66
65
  },
67
- setDetailData: (detailData) => set({ detailData })
66
+ setDetailData: (detailData) => set({ detailData }),
67
+ setOpenCurdViewEditor: (openCurdViewEditor) => set({ openCurdViewEditor })
68
68
  }));
69
69
  };
70
70
  const listViewContext = createContext(null);
@@ -87,21 +87,9 @@ function useListview(selector) {
87
87
  throw new Error("useListview Missing ListViewProvider in the tree");
88
88
  return useStore(store, selector);
89
89
  }
90
- const useCurdUpdateMutation = () => {
91
- const svc = useListview((x) => x.svc);
92
- const methodUpdate = useListview((x) => x.methodUpdate);
93
- return useGomtmMutation(svc, methodUpdate);
94
- };
95
- const useCurdCreateMutation = () => {
96
- const svc = useListview((x) => x.svc);
97
- const methodCreate = useListview((x) => x.methodCreate);
98
- return useGomtmMutation(svc, methodCreate);
99
- };
100
90
  export {
101
91
  ListView,
102
92
  ListViewStoreProvider,
103
93
  listViewContext,
104
- useCurdCreateMutation,
105
- useCurdUpdateMutation,
106
94
  useListview
107
95
  };
@@ -21,7 +21,6 @@ var __async = (__this, __arguments, generator) => {
21
21
  };
22
22
  import { jsx, jsxs } from "react/jsx-runtime";
23
23
  import { useQueryClient } from "@tanstack/react-query";
24
- import { useMtRouter } from "mtxuilib/hooks/use-router";
25
24
  import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
26
25
  import { MtButton } from "mtxuilib/ui/ui-mt/Button";
27
26
  import { useCallback } from "react";
@@ -36,7 +35,6 @@ function useCurdRemove() {
36
35
  const methodList = useListview((x) => x.methodList);
37
36
  const mutation = useGomtmMutation(svc, methodDelete, {
38
37
  onSuccess(data, variables, context) {
39
- console.log("remove sucess", data);
40
38
  queryClient.invalidateQueries({
41
39
  queryKey: createQueryKey(svc, methodList)
42
40
  });
@@ -44,13 +42,12 @@ function useCurdRemove() {
44
42
  }
45
43
  });
46
44
  const activateItem = useListview((x) => x.activateItem);
47
- const router = useMtRouter();
48
45
  const queryClient = useQueryClient();
49
46
  const handlerSubmit = useCallback(() => __async(this, null, function* () {
50
47
  yield mutation.mutateAsync({
51
- id: activateItem == null ? void 0 : activateItem.id
48
+ ids: [activateItem == null ? void 0 : activateItem.id.toString()]
52
49
  });
53
- }), [activateItem == null ? void 0 : activateItem.id, mutation]);
50
+ }), [activateItem, mutation]);
54
51
  return {
55
52
  handlerSubmit,
56
53
  open: openRemove,
@@ -1,6 +1,6 @@
1
1
  import { MethodKind } from "@bufbuild/protobuf";
2
- import { CurdConfig, GetCurdConfigReq } from "./curd_pb";
3
- import { CommontListReq, CommontListRes, CurdDetailReq, CurdDetailRes } from "./mtm_pb";
2
+ import { CurdConfig, CurdViewCreateReq, CurdViewGetRes, CurdViewUpdateReq, GetCurdConfigReq } from "./curd_pb";
3
+ import { CommontListReq, CommontListRes, CurdDetailReq, CurdDetailRes, CurdViewGetReq, Result } from "./mtm_pb";
4
4
  export declare const getCurdConfig: {
5
5
  readonly localName: "getCurdConfig";
6
6
  readonly name: "GetCurdConfig";
@@ -31,3 +31,43 @@ export declare const curdDetail: {
31
31
  readonly typeName: "sppb.CurdService";
32
32
  };
33
33
  };
34
+ export declare const curdViewList: {
35
+ readonly localName: "curdViewList";
36
+ readonly name: "CurdViewList";
37
+ readonly kind: MethodKind.Unary;
38
+ readonly I: typeof CommontListReq;
39
+ readonly O: typeof CommontListRes;
40
+ readonly service: {
41
+ readonly typeName: "sppb.CurdService";
42
+ };
43
+ };
44
+ export declare const curdViewGet: {
45
+ readonly localName: "curdViewGet";
46
+ readonly name: "CurdViewGet";
47
+ readonly kind: MethodKind.Unary;
48
+ readonly I: typeof CurdViewGetReq;
49
+ readonly O: typeof CurdViewGetRes;
50
+ readonly service: {
51
+ readonly typeName: "sppb.CurdService";
52
+ };
53
+ };
54
+ export declare const curdViewCreate: {
55
+ readonly localName: "curdViewCreate";
56
+ readonly name: "CurdViewCreate";
57
+ readonly kind: MethodKind.Unary;
58
+ readonly I: typeof CurdViewCreateReq;
59
+ readonly O: typeof Result;
60
+ readonly service: {
61
+ readonly typeName: "sppb.CurdService";
62
+ };
63
+ };
64
+ export declare const curdViewUpdate: {
65
+ readonly localName: "curdViewUpdate";
66
+ readonly name: "CurdViewUpdate";
67
+ readonly kind: MethodKind.Unary;
68
+ readonly I: typeof CurdViewUpdateReq;
69
+ readonly O: typeof Result;
70
+ readonly service: {
71
+ readonly typeName: "sppb.CurdService";
72
+ };
73
+ };
@@ -1,6 +1,6 @@
1
1
  import { MethodKind } from "@bufbuild/protobuf";
2
- import { CurdConfig, GetCurdConfigReq } from "./curd_pb";
3
- import { CommontListReq, CommontListRes, CurdDetailReq, CurdDetailRes } from "./mtm_pb";
2
+ import { CurdConfig, CurdViewCreateReq, CurdViewGetRes, CurdViewUpdateReq, GetCurdConfigReq } from "./curd_pb";
3
+ import { CommontListReq, CommontListRes, CurdDetailReq, CurdDetailRes, CurdViewGetReq, Result } from "./mtm_pb";
4
4
  const getCurdConfig = {
5
5
  localName: "getCurdConfig",
6
6
  name: "GetCurdConfig",
@@ -31,8 +31,52 @@ const curdDetail = {
31
31
  typeName: "sppb.CurdService"
32
32
  }
33
33
  };
34
+ const curdViewList = {
35
+ localName: "curdViewList",
36
+ name: "CurdViewList",
37
+ kind: MethodKind.Unary,
38
+ I: CommontListReq,
39
+ O: CommontListRes,
40
+ service: {
41
+ typeName: "sppb.CurdService"
42
+ }
43
+ };
44
+ const curdViewGet = {
45
+ localName: "curdViewGet",
46
+ name: "CurdViewGet",
47
+ kind: MethodKind.Unary,
48
+ I: CurdViewGetReq,
49
+ O: CurdViewGetRes,
50
+ service: {
51
+ typeName: "sppb.CurdService"
52
+ }
53
+ };
54
+ const curdViewCreate = {
55
+ localName: "curdViewCreate",
56
+ name: "CurdViewCreate",
57
+ kind: MethodKind.Unary,
58
+ I: CurdViewCreateReq,
59
+ O: Result,
60
+ service: {
61
+ typeName: "sppb.CurdService"
62
+ }
63
+ };
64
+ const curdViewUpdate = {
65
+ localName: "curdViewUpdate",
66
+ name: "CurdViewUpdate",
67
+ kind: MethodKind.Unary,
68
+ I: CurdViewUpdateReq,
69
+ O: Result,
70
+ service: {
71
+ typeName: "sppb.CurdService"
72
+ }
73
+ };
34
74
  export {
35
75
  curdDetail,
36
76
  curdList,
77
+ curdViewCreate,
78
+ curdViewGet,
79
+ curdViewList,
80
+ curdViewUpdate,
37
81
  getCurdConfig
38
82
  };