gomtm 0.0.371 → 0.0.372

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.
@@ -51,7 +51,6 @@ const CurdViewContentField = (props) => {
51
51
  const { name } = props;
52
52
  const form = useFormContext();
53
53
  const defaultValues = form.getValues()[name];
54
- console.log("defaultValues", defaultValues);
55
54
  const contentForm = useForm({
56
55
  defaultValues
57
56
  });
@@ -88,6 +87,11 @@ const CurdViewContentField = (props) => {
88
87
  /* @__PURE__ */ jsx(FormLabel, { children: "methodUpdate" }),
89
88
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, __spreadValues({ placeholder: "methodUpdate" }, field)) }),
90
89
  /* @__PURE__ */ jsx(FormMessage, {})
90
+ ] }) }),
91
+ /* @__PURE__ */ jsx(FormField, { control: contentForm.control, name: "methodDelete", render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
92
+ /* @__PURE__ */ jsx(FormLabel, { children: "methodDelete" }),
93
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, __spreadValues({ placeholder: "methodDelete" }, field)) }),
94
+ /* @__PURE__ */ jsx(FormMessage, {})
91
95
  ] }) })
92
96
  ] });
93
97
  };
@@ -21,7 +21,10 @@ const CurdViewView = (props) => {
21
21
  if (!query.data.item.value) {
22
22
  return /* @__PURE__ */ jsx("div", { children: "missing curd data222" });
23
23
  }
24
- return /* @__PURE__ */ jsx(ListViewStoreProvider, { curdView: query.data.item.value, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "loading CommonListView" }), children: /* @__PURE__ */ jsx(CommonListView, {}) }) });
24
+ if (!query.data.item.value.content) {
25
+ return /* @__PURE__ */ jsx("div", { children: "missing curdview content" });
26
+ }
27
+ return /* @__PURE__ */ jsx(ListViewStoreProvider, { curdView: query.data.item.value, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "loading CommonListView" }), children: /* @__PURE__ */ jsx(CommonListView, { curdViewContent: query.data.item.value.content }) }) });
25
28
  }
26
29
  };
27
30
  export {
@@ -27,7 +27,7 @@ import { CurdViewGetReq } from "../gomtmpb/mtm/sppb/curd_pb";
27
27
  import { createMtmServiceClient } from "../mtmFetcher";
28
28
  import { CurdViewView } from "./CurdView";
29
29
  const CurdViewSS = (props) => __async(void 0, null, function* () {
30
- var _a, _b;
30
+ var _a, _b, _c, _d;
31
31
  const { name } = props;
32
32
  const client = createMtmServiceClient(CurdService);
33
33
  const curdViewRes = yield client.curdViewGet(new CurdViewGetReq({
@@ -39,8 +39,8 @@ const CurdViewSS = (props) => __async(void 0, null, function* () {
39
39
  curdViewRes.item.value.message
40
40
  ] });
41
41
  }
42
- const svc = ((_a = curdViewRes.item.value) == null ? void 0 : _a.svcName) || "";
43
- const methodList = ((_b = curdViewRes.item.value) == null ? void 0 : _b.methodList) || "";
42
+ const svc = ((_b = (_a = curdViewRes.item.value) == null ? void 0 : _a.content) == null ? void 0 : _b.svcName) || "";
43
+ const methodList = ((_d = (_c = curdViewRes.item.value) == null ? void 0 : _c.content) == null ? void 0 : _d.methodList) || "";
44
44
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
45
45
  PrefetchConnectQuery,
46
46
  {
@@ -2,10 +2,7 @@
2
2
  import { Fragment, jsx } from "react/jsx-runtime";
3
3
  import { useMtRouter } from "mtxuilib/hooks/use-router";
4
4
  import { MtPopupPanel } from "mtxuilib/ui/ui-mt/MtPopupPanel";
5
- import { useMemo } from "react";
6
- import { useGomtmSuspenseQuery } from "../../gomtmQuery";
7
5
  import { RenderViewByName } from "../DynViews";
8
- import { useListview } from "../listview/list-store";
9
6
  import { useGomtmForm2 } from "./formStore";
10
7
  function CurdEditPanel(props) {
11
8
  const gomtmForm = useGomtmForm2();
@@ -34,23 +31,6 @@ function CurdEditPanel(props) {
34
31
  }
35
32
  ) });
36
33
  }
37
- const WithLoadGetData = (props) => {
38
- const { children } = props;
39
- const methodGet = useListview((x) => x.curdView.methodGet);
40
- const svc = useListview((x) => x.curdView.svcName);
41
- const activateItem = useListview((x) => x.activateItem);
42
- const setDetailData = useListview((x) => x.setDetailData);
43
- const detailQuery = useGomtmSuspenseQuery(svc, methodGet, {
44
- id: parseInt(activateItem.id)
45
- });
46
- useMemo(() => {
47
- setDetailData(detailQuery.data);
48
- }, [detailQuery.data, setDetailData]);
49
- if (detailQuery.isLoading) {
50
- return /* @__PURE__ */ jsx("div", { children: "loading detail" });
51
- }
52
- return children;
53
- };
54
34
  export {
55
35
  CurdEditPanel as default
56
36
  };
@@ -1,5 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { PlainMessage } from "@bufbuild/protobuf";
3
+ import { CurdViewContent } from "../../gomtmpb/mtm/sppb/curd_pb";
2
4
  export declare const LzListViewLayoutDemo: import("react").LazyExoticComponent<typeof import("./listview-layouts/listviewlayout-demo").default>;
3
5
  export declare const LzListViewLayoutDefault: import("react").LazyExoticComponent<typeof import("./listview-layouts/default").default>;
4
- export declare function CommonListView(): import("react").JSX.Element | null;
6
+ export declare function CommonListView(props: {
7
+ curdViewContent: PlainMessage<CurdViewContent>;
8
+ }): import("react").JSX.Element | null;
5
9
  export declare const ListViewActions: () => import("react").JSX.Element;
@@ -19,18 +19,19 @@ const ALL_Layouts = [
19
19
  ];
20
20
  const LzListViewLayoutDemo = lazy(() => import("./listview-layouts/listviewlayout-demo"));
21
21
  const LzListViewLayoutDefault = lazy(() => import("./listview-layouts/default"));
22
- function CommonListView() {
23
- const svc = useListview((x) => x.curdView.svcName);
24
- const methodList = useListview((x) => x.curdView.methodList);
22
+ function CommonListView(props) {
23
+ const { curdViewContent } = props;
24
+ const svc = useListview((x) => curdViewContent.svcName);
25
+ const methodList = useListview((x) => curdViewContent.methodList);
25
26
  const paramList = useListview((x) => x.paramsList);
26
27
  const setOpenEdit = useListview((x) => x.setOpenEdit);
27
28
  const openEdit = useListview((x) => x.openEdit);
28
29
  const openCreate = useListview((x) => x.openCreate);
29
30
  const setOpenCreate = useListview((x) => x.setOpenCreate);
30
- const viewUpdate = useListview((x) => x.curdView.routeEdit);
31
- const viewCreate = useListview((x) => x.curdView.routeCreate);
32
- const methodUpdate = useListview((x) => x.curdView.methodUpdate);
33
- const methodCreate = useListview((x) => x.curdView.methodCreate);
31
+ const viewUpdate = useListview((x) => curdViewContent.routeEdit);
32
+ const viewCreate = useListview((x) => curdViewContent.routeCreate);
33
+ const methodUpdate = useListview((x) => curdViewContent.methodUpdate);
34
+ const methodCreate = useListview((x) => curdViewContent.methodCreate);
34
35
  const openCurdViewEditor = useListview((x) => x.openCurdViewEditor);
35
36
  const setOpenCurdViewEditor = useListview((x) => x.setOpenCurdViewEditor);
36
37
  const curdView = useListview((x) => x.curdView);
@@ -90,7 +91,7 @@ function CommonListView() {
90
91
  children: /* @__PURE__ */ jsx(CurdEditPanel, {})
91
92
  }
92
93
  ),
93
- /* @__PURE__ */ jsx(PanelRemove, {}),
94
+ /* @__PURE__ */ jsx(PanelRemove, { curdViewContent }),
94
95
  openCurdViewEditor && /* @__PURE__ */ jsx(
95
96
  GomtmForm,
96
97
  {
@@ -1,7 +1,13 @@
1
1
  /// <reference types="react" />
2
- export declare function useCurdRemove(): {
2
+ import { PlainMessage } from "@bufbuild/protobuf";
3
+ import { CurdViewContent } from "../../gomtmpb/mtm/sppb/curd_pb";
4
+ export declare function useCurdRemove(props: {
5
+ curdViewContent: PlainMessage<CurdViewContent>;
6
+ }): {
3
7
  handlerSubmit: () => Promise<void>;
4
8
  open: boolean;
5
9
  setOpen: (openRemove: boolean) => void;
6
10
  };
7
- export declare const PanelRemove: () => import("react").JSX.Element;
11
+ export declare const PanelRemove: (props: {
12
+ curdViewContent: PlainMessage<CurdViewContent>;
13
+ }) => import("react").JSX.Element;
@@ -27,12 +27,13 @@ import { useCallback } from "react";
27
27
  import { useGomtmMutation } from "../../gomtmQuery";
28
28
  import { createQueryKey } from "../../mtmFetcher";
29
29
  import { useListview } from "../listview/list-store";
30
- function useCurdRemove() {
31
- const svc = useListview((x) => x.curdView.svcName);
30
+ function useCurdRemove(props) {
31
+ const { curdViewContent } = props;
32
+ const svc = useListview((x) => curdViewContent.svcName);
32
33
  const openRemove = useListview((x) => x.openRemove);
33
34
  const setOpenRemove = useListview((x) => x.setOpenRemove);
34
- const methodDelete = useListview((x) => x.curdView.methodDelete);
35
- const methodList = useListview((x) => x.curdView.methodList);
35
+ const methodDelete = useListview((x) => curdViewContent.methodDelete);
36
+ const methodList = useListview((x) => curdViewContent.methodList);
36
37
  const mutation = useGomtmMutation(svc, methodDelete, {
37
38
  onSuccess(data, variables, context) {
38
39
  queryClient.invalidateQueries({
@@ -55,8 +56,9 @@ function useCurdRemove() {
55
56
  setOpen: setOpenRemove
56
57
  };
57
58
  }
58
- const PanelRemove = () => {
59
- const curdRemove = useCurdRemove();
59
+ const PanelRemove = (props) => {
60
+ const { curdViewContent } = props;
61
+ const curdRemove = useCurdRemove({ curdViewContent });
60
62
  return /* @__PURE__ */ jsx(Dialog, { open: curdRemove.open, onOpenChange: curdRemove.setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
61
63
  /* @__PURE__ */ jsx(DialogTitle, { children: "remove item" }),
62
64
  /* @__PURE__ */ jsx(MtButton, { onClick: () => {
@@ -157,28 +157,6 @@ export declare class CurdView extends Message<CurdView> {
157
157
  name: string;
158
158
  title: string;
159
159
  enabled: boolean;
160
- routeList: string;
161
- routeShow: string;
162
- routeCreate: string;
163
- routeEdit: string;
164
- svcName: string;
165
- methodList: string;
166
- methodGet: string;
167
- methodCreate: string;
168
- methodUpdate: string;
169
- methodDelete: string;
170
- rolesView: string[];
171
- rolesEdit: string[];
172
- rolesDelete: string[];
173
- formCreate?: FormSchema;
174
- formEdit?: FormSchema;
175
- pageSize: number;
176
- paginateType: PaginateType;
177
- params: {
178
- [key: string]: string;
179
- };
180
- layout: string;
181
- defaultDetailView: string;
182
160
  content?: CurdViewContent;
183
161
  constructor(data?: PartialMessage<CurdView>);
184
162
  static readonly runtime: typeof proto3;
@@ -204,6 +182,12 @@ export declare class CurdViewContent extends Message<CurdViewContent> {
204
182
  rolesView: string[];
205
183
  rolesEdit: string[];
206
184
  rolesDelete: string[];
185
+ formCreate?: FormSchema;
186
+ formEdit?: FormSchema;
187
+ pageSize: number;
188
+ paginateType: PaginateType;
189
+ layout: string;
190
+ defaultDetailView: string;
207
191
  constructor(data?: PartialMessage<CurdViewContent>);
208
192
  static readonly runtime: typeof proto3;
209
193
  static readonly typeName = "sppb.CurdViewContent";
@@ -474,92 +474,28 @@ const _CurdView = class _CurdView extends Message {
474
474
  */
475
475
  __publicField(this, "title", "");
476
476
  /**
477
+ * string route_list = 4;
478
+ * string route_show = 5;
479
+ * string route_create = 6;
480
+ * string route_edit = 7;
481
+ * string svc_name = 8;
482
+ * string method_list = 9;
483
+ * string method_get = 10;
484
+ * string method_create = 11;
485
+ * string method_update = 12;
486
+ * string method_delete = 13;
487
+ * repeated string roles_view = 14;
488
+ * repeated string roles_edit = 15;
489
+ * repeated string roles_delete = 16;
490
+ *
477
491
  * @generated from field: bool enabled = 3;
478
492
  */
479
493
  __publicField(this, "enabled", false);
480
494
  /**
481
- * @generated from field: string route_list = 4;
482
- */
483
- __publicField(this, "routeList", "");
484
- /**
485
- * @generated from field: string route_show = 5;
486
- */
487
- __publicField(this, "routeShow", "");
488
- /**
489
- * @generated from field: string route_create = 6;
490
- */
491
- __publicField(this, "routeCreate", "");
492
- /**
493
- * @generated from field: string route_edit = 7;
494
- */
495
- __publicField(this, "routeEdit", "");
496
- /**
497
- * @generated from field: string svc_name = 8;
498
- */
499
- __publicField(this, "svcName", "");
500
- /**
501
- * @generated from field: string method_list = 9;
502
- */
503
- __publicField(this, "methodList", "");
504
- /**
505
- * @generated from field: string method_get = 10;
506
- */
507
- __publicField(this, "methodGet", "");
508
- /**
509
- * @generated from field: string method_create = 11;
510
- */
511
- __publicField(this, "methodCreate", "");
512
- /**
513
- * @generated from field: string method_update = 12;
514
- */
515
- __publicField(this, "methodUpdate", "");
516
- /**
517
- * @generated from field: string method_delete = 13;
518
- */
519
- __publicField(this, "methodDelete", "");
520
- /**
521
- * @generated from field: repeated string roles_view = 14;
522
- */
523
- __publicField(this, "rolesView", []);
524
- /**
525
- * @generated from field: repeated string roles_edit = 15;
526
- */
527
- __publicField(this, "rolesEdit", []);
528
- /**
529
- * @generated from field: repeated string roles_delete = 16;
530
- */
531
- __publicField(this, "rolesDelete", []);
532
- /**
533
- * @generated from field: sppb.FormSchema form_create = 17;
534
- */
535
- __publicField(this, "formCreate");
536
- /**
537
- * @generated from field: sppb.FormSchema form_edit = 18;
538
- */
539
- __publicField(this, "formEdit");
540
- /**
541
- * @generated from field: uint32 page_size = 19;
542
- */
543
- __publicField(this, "pageSize", 0);
544
- /**
545
- * @generated from field: sppb.PaginateType paginate_type = 20;
546
- */
547
- __publicField(this, "paginateType", PaginateType.INFINITE);
548
- /**
549
- * 初始查询参数
495
+ * map<string, string> params = 21; // 初始查询参数
496
+ * string layout = 22;
497
+ * string default_detail_view = 24;
550
498
  *
551
- * @generated from field: map<string, string> params = 21;
552
- */
553
- __publicField(this, "params", {});
554
- /**
555
- * @generated from field: string layout = 22;
556
- */
557
- __publicField(this, "layout", "");
558
- /**
559
- * @generated from field: string default_detail_view = 24;
560
- */
561
- __publicField(this, "defaultDetailView", "");
562
- /**
563
499
  * @generated from field: sppb.CurdViewContent content = 25;
564
500
  */
565
501
  __publicField(this, "content");
@@ -609,108 +545,6 @@ __publicField(_CurdView, "fields", proto3.util.newFieldList(() => [
609
545
  T: 8
610
546
  /* ScalarType.BOOL */
611
547
  },
612
- {
613
- no: 4,
614
- name: "route_list",
615
- kind: "scalar",
616
- T: 9
617
- /* ScalarType.STRING */
618
- },
619
- {
620
- no: 5,
621
- name: "route_show",
622
- kind: "scalar",
623
- T: 9
624
- /* ScalarType.STRING */
625
- },
626
- {
627
- no: 6,
628
- name: "route_create",
629
- kind: "scalar",
630
- T: 9
631
- /* ScalarType.STRING */
632
- },
633
- {
634
- no: 7,
635
- name: "route_edit",
636
- kind: "scalar",
637
- T: 9
638
- /* ScalarType.STRING */
639
- },
640
- {
641
- no: 8,
642
- name: "svc_name",
643
- kind: "scalar",
644
- T: 9
645
- /* ScalarType.STRING */
646
- },
647
- {
648
- no: 9,
649
- name: "method_list",
650
- kind: "scalar",
651
- T: 9
652
- /* ScalarType.STRING */
653
- },
654
- {
655
- no: 10,
656
- name: "method_get",
657
- kind: "scalar",
658
- T: 9
659
- /* ScalarType.STRING */
660
- },
661
- {
662
- no: 11,
663
- name: "method_create",
664
- kind: "scalar",
665
- T: 9
666
- /* ScalarType.STRING */
667
- },
668
- {
669
- no: 12,
670
- name: "method_update",
671
- kind: "scalar",
672
- T: 9
673
- /* ScalarType.STRING */
674
- },
675
- {
676
- no: 13,
677
- name: "method_delete",
678
- kind: "scalar",
679
- T: 9
680
- /* ScalarType.STRING */
681
- },
682
- { no: 14, name: "roles_view", kind: "scalar", T: 9, repeated: true },
683
- { no: 15, name: "roles_edit", kind: "scalar", T: 9, repeated: true },
684
- { no: 16, name: "roles_delete", kind: "scalar", T: 9, repeated: true },
685
- { no: 17, name: "form_create", kind: "message", T: FormSchema },
686
- { no: 18, name: "form_edit", kind: "message", T: FormSchema },
687
- {
688
- no: 19,
689
- name: "page_size",
690
- kind: "scalar",
691
- T: 13
692
- /* ScalarType.UINT32 */
693
- },
694
- { no: 20, name: "paginate_type", kind: "enum", T: proto3.getEnumType(PaginateType) },
695
- { no: 21, name: "params", kind: "map", K: 9, V: {
696
- kind: "scalar",
697
- T: 9
698
- /* ScalarType.STRING */
699
- } },
700
- {
701
- no: 22,
702
- name: "layout",
703
- kind: "scalar",
704
- T: 9
705
- /* ScalarType.STRING */
706
- },
707
- {
708
- no: 24,
709
- name: "default_detail_view",
710
- kind: "scalar",
711
- T: 9
712
- /* ScalarType.STRING */
713
- },
714
548
  { no: 25, name: "content", kind: "message", T: CurdViewContent }
715
549
  ]));
716
550
  let CurdView = _CurdView;
@@ -773,6 +607,30 @@ const _CurdViewContent = class _CurdViewContent extends Message {
773
607
  * @generated from field: repeated string roles_delete = 16;
774
608
  */
775
609
  __publicField(this, "rolesDelete", []);
610
+ /**
611
+ * @generated from field: sppb.FormSchema form_create = 17;
612
+ */
613
+ __publicField(this, "formCreate");
614
+ /**
615
+ * @generated from field: sppb.FormSchema form_edit = 18;
616
+ */
617
+ __publicField(this, "formEdit");
618
+ /**
619
+ * @generated from field: uint32 page_size = 19;
620
+ */
621
+ __publicField(this, "pageSize", 0);
622
+ /**
623
+ * @generated from field: sppb.PaginateType paginate_type = 20;
624
+ */
625
+ __publicField(this, "paginateType", PaginateType.INFINITE);
626
+ /**
627
+ * @generated from field: string layout = 22;
628
+ */
629
+ __publicField(this, "layout", "");
630
+ /**
631
+ * @generated from field: string default_detail_view = 24;
632
+ */
633
+ __publicField(this, "defaultDetailView", "");
776
634
  proto3.util.initPartial(data, this);
777
635
  }
778
636
  static fromBinary(bytes, options) {
@@ -870,7 +728,31 @@ __publicField(_CurdViewContent, "fields", proto3.util.newFieldList(() => [
870
728
  },
871
729
  { no: 14, name: "roles_view", kind: "scalar", T: 9, repeated: true },
872
730
  { no: 15, name: "roles_edit", kind: "scalar", T: 9, repeated: true },
873
- { no: 16, name: "roles_delete", kind: "scalar", T: 9, repeated: true }
731
+ { no: 16, name: "roles_delete", kind: "scalar", T: 9, repeated: true },
732
+ { no: 17, name: "form_create", kind: "message", T: FormSchema },
733
+ { no: 18, name: "form_edit", kind: "message", T: FormSchema },
734
+ {
735
+ no: 19,
736
+ name: "page_size",
737
+ kind: "scalar",
738
+ T: 13
739
+ /* ScalarType.UINT32 */
740
+ },
741
+ { no: 20, name: "paginate_type", kind: "enum", T: proto3.getEnumType(PaginateType) },
742
+ {
743
+ no: 22,
744
+ name: "layout",
745
+ kind: "scalar",
746
+ T: 9
747
+ /* ScalarType.STRING */
748
+ },
749
+ {
750
+ no: 24,
751
+ name: "default_detail_view",
752
+ kind: "scalar",
753
+ T: 9
754
+ /* ScalarType.STRING */
755
+ }
874
756
  ]));
875
757
  let CurdViewContent = _CurdViewContent;
876
758
  export {