gomtm 0.0.323 → 0.0.325

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,12 +1,12 @@
1
+ /// <reference types="react" />
1
2
  import { PlainMessage } from "@bufbuild/protobuf";
2
- import { PropsWithChildren } from "react";
3
- import { ListItem, ListViewLayout, PostCardItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
4
- export declare const ListViewLayoutRender: (props: {
5
- layout: ListViewLayout;
6
- } & PropsWithChildren) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<import("react").AwaitedReactNode> | import("react").JSX.Element | null | undefined;
7
- export declare const ListItemView: (props: {
8
- item: PlainMessage<ListItem>;
9
- }) => import("react").JSX.Element | null;
3
+ import { CommonListItem, CommontListRes, PostCardItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
4
+ export declare const CommontListResView: (props: {
5
+ data: PlainMessage<CommontListRes>;
6
+ }) => import("react").JSX.Element;
7
+ export declare const CommonListItemView: (props: {
8
+ item: PlainMessage<CommonListItem>;
9
+ }) => import("react").JSX.Element;
10
10
  export declare const PostCardListItem: (props: {
11
11
  item: PostCardItem;
12
12
  }) => import("react").JSX.Element;
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { MtLink } from "mtxuilib/common/mtlink";
4
4
  import { Icons } from "mtxuilib/icons/icons";
5
5
  import { cn } from "mtxuilib/lib/utils";
6
+ import { buttonVariants } from "mtxuilib/ui/button";
6
7
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
7
8
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
8
9
  import { title } from "process";
@@ -11,7 +12,11 @@ import { MtDateView } from "../../components/MtDate";
11
12
  import Tag from "../../components/Tag";
12
13
  import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
13
14
  import { useListview } from "../listview/list-store";
14
- import { CommonListItemView } from "./CommonListItemView";
15
+ const CommontListResView = (props) => {
16
+ var _a;
17
+ const { data } = props;
18
+ return /* @__PURE__ */ jsx(ListViewLayoutRender, { layout: data.listLayout, children: (_a = data == null ? void 0 : data.items) == null ? void 0 : _a.map((item, j) => /* @__PURE__ */ jsx(ListItemView, { item }, `${j}`)) });
19
+ };
15
20
  const ListViewLayoutRender = (props) => {
16
21
  const { children } = props;
17
22
  switch (props.layout) {
@@ -41,6 +46,33 @@ const ListItemView = (props) => {
41
46
  }
42
47
  return null;
43
48
  };
49
+ const CommonListItemView = (props) => {
50
+ const { item } = props;
51
+ const handleSelect = () => {
52
+ };
53
+ const slugPath = useListview((x) => x.slugPath);
54
+ return /* @__PURE__ */ jsxs(
55
+ "div",
56
+ {
57
+ "aria-label": item.id,
58
+ onClick: handleSelect,
59
+ className: cn(
60
+ buttonVariants({
61
+ variant: "ghost"
62
+ }),
63
+ "flex min-h-16 justify-start border p-4 text-left"
64
+ ),
65
+ children: [
66
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxs(MtLink, { href: `${slugPath}/${item.id}`, children: [
67
+ slugPath,
68
+ item.title || item.id,
69
+ item.description && /* @__PURE__ */ jsx("div", { children: item.description })
70
+ ] }) }),
71
+ /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id })
72
+ ]
73
+ }
74
+ );
75
+ };
44
76
  const PostCardListItem = (props) => {
45
77
  const { item } = props;
46
78
  const slugPath = useListview((x) => x.slugPath);
@@ -178,8 +210,8 @@ const PostCardItemActions = (props) => {
178
210
  ] });
179
211
  };
180
212
  export {
181
- ListItemView,
182
- ListViewLayoutRender,
213
+ CommonListItemView,
214
+ CommontListResView,
183
215
  PostCardItemActions,
184
216
  PostCardListItem
185
217
  };
@@ -13,7 +13,7 @@ import { HOTKEY_Listview_Switchlayout } from "../../consts";
13
13
  import { useGomtmSuspenseInfiniteQuery } from "../../gomtmQuery";
14
14
  import { CurdCreatePanelTriggerButton } from "../create/CurdCreatePanel";
15
15
  import { CurdEditPanelTriggerButton } from "../edit/CurdEditPanel";
16
- import { ListItemView, ListViewLayoutRender } from "../list-item/ListViewLayoutRender";
16
+ import { CommontListResView } from "../list-item/ListViewLayoutRender";
17
17
  import { useListview } from "./list-store";
18
18
  const ALL_Layouts = [
19
19
  "default",
@@ -39,11 +39,10 @@ function CommonListView() {
39
39
  // " max-h-[700px] overflow-y-auto"
40
40
  ),
41
41
  children: listQuery.data.pages.map((page, i) => {
42
- var _a;
43
42
  if (page.errCode) {
44
43
  return /* @__PURE__ */ jsx(MtmErrorView, { unaryError: page }, i);
45
44
  } else {
46
- return /* @__PURE__ */ jsx(ListViewLayoutRender, { layout: page.listLayout, children: (_a = page == null ? void 0 : page.items) == null ? void 0 : _a.map((item, j) => /* @__PURE__ */ jsx(ListItemView, { item }, `${i}-${j}`)) }, i);
45
+ return /* @__PURE__ */ jsx(CommontListResView, { data: page }, i);
47
46
  }
48
47
  })
49
48
  }
@@ -1,4 +1,6 @@
1
+ import { PlainMessage } from "@bufbuild/protobuf";
2
+ import { MtmError } from "./gomtmpb/mtm/sppb/mtm_pb";
1
3
  export declare const useGomtmQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseQueryResult<any, Error>;
2
4
  export declare const useGomtmSuspenseQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseSuspenseQueryResult<any, Error>;
3
- export declare const useGomtmSuspenseInfiniteQuery: (svc: string, method: string, input?: any) => import("@tanstack/react-query").UseSuspenseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<any, unknown>, Error>;
5
+ export declare function useGomtmSuspenseInfiniteQuery<T = any>(svc: string, method: string, input?: any): import("@tanstack/react-query").UseSuspenseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<T & PlainMessage<MtmError>, unknown>, Error>;
4
6
  export declare const useGomtmMutation: (svc: string, method: string) => import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
@@ -47,7 +47,7 @@ const useGomtmSuspenseQuery = (svc, method, input) => {
47
47
  });
48
48
  return query;
49
49
  };
50
- const useGomtmSuspenseInfiniteQuery = (svc, method, input) => {
50
+ function useGomtmSuspenseInfiniteQuery(svc, method, input) {
51
51
  const fn = useGmtmQjeryFn();
52
52
  const query = useSuspenseInfiniteQuery({
53
53
  queryKey: createInfiniteQueryKey(svc, method, input),
@@ -59,7 +59,7 @@ const useGomtmSuspenseInfiniteQuery = (svc, method, input) => {
59
59
  }
60
60
  });
61
61
  return query;
62
- };
62
+ }
63
63
  const useGomtmMutation = (svc, method) => {
64
64
  const fn = useGmtmQjeryFn();
65
65
  return useMutation({