gomtm 0.0.321 → 0.0.323

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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { PlainMessage } from "@bufbuild/protobuf";
3
+ import { MtDate } from "../gomtmpb/mtm/sppb/mtm_pb";
4
+ export declare const MtDateView: (props: {
5
+ date?: Partial<PlainMessage<MtDate>>;
6
+ }) => import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
+ import { formatDate } from "pliny/utils/formatDate";
4
+ const MtDateView = (props) => {
5
+ const { date } = props;
6
+ if (!date) {
7
+ return null;
8
+ }
9
+ const date1 = /* @__PURE__ */ new Date();
10
+ date1.setFullYear(date.year);
11
+ date1.setMonth(date.month);
12
+ date1.setDate(date.day);
13
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("time", { dateTime: date1.toString(), children: formatDate(date1.toString(), "en-US") }) });
14
+ };
15
+ export {
16
+ MtDateView
17
+ };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ text: string;
4
+ }
5
+ declare const Tag: ({ text }: Props) => import("react").JSX.Element;
6
+ export default Tag;
@@ -0,0 +1,17 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Link from "next/link";
3
+ import { slug } from "github-slugger";
4
+ const Tag = ({ text }) => {
5
+ return /* @__PURE__ */ jsx(
6
+ Link,
7
+ {
8
+ href: `/tags/${slug(text)}`,
9
+ className: "mr-3 text-sm font-medium uppercase text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
10
+ children: text.split(" ").join("-")
11
+ }
12
+ );
13
+ };
14
+ var Tag_default = Tag;
15
+ export {
16
+ Tag_default as default
17
+ };
@@ -1,19 +1,13 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
3
  import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
4
4
  const ListLayout = (props) => {
5
5
  const { children } = props;
6
6
  switch (props.layout) {
7
7
  case ListViewLayout.simple:
8
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-1 rounded-md p-2 shadow-sm", children: [
9
- /* @__PURE__ */ jsx("div", { children: "simple-list-layout" }),
10
- children
11
- ] });
8
+ return /* @__PURE__ */ jsx("ul", { className: "divide-y divide-gray-200 dark:divide-gray-700", children });
12
9
  case ListViewLayout.grid:
13
- return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children: [
14
- /* @__PURE__ */ jsx("div", { children: "grid-layout" }),
15
- children
16
- ] });
10
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
17
11
  case ListViewLayout.card:
18
12
  return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
19
13
  default:
@@ -0,0 +1,15 @@
1
+ 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;
10
+ export declare const PostCardListItem: (props: {
11
+ item: PostCardItem;
12
+ }) => import("react").JSX.Element;
13
+ export declare const PostCardItemActions: (props: {
14
+ id: string;
15
+ }) => import("react").JSX.Element;
@@ -0,0 +1,185 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { MtLink } from "mtxuilib/common/mtlink";
4
+ import { Icons } from "mtxuilib/icons/icons";
5
+ import { cn } from "mtxuilib/lib/utils";
6
+ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
7
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
8
+ import { title } from "process";
9
+ import { useState } from "react";
10
+ import { MtDateView } from "../../components/MtDate";
11
+ import Tag from "../../components/Tag";
12
+ import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
13
+ import { useListview } from "../listview/list-store";
14
+ import { CommonListItemView } from "./CommonListItemView";
15
+ const ListViewLayoutRender = (props) => {
16
+ const { children } = props;
17
+ switch (props.layout) {
18
+ case ListViewLayout.simple:
19
+ return /* @__PURE__ */ jsx("ul", { className: "divide-y divide-gray-200 dark:divide-gray-700", children });
20
+ case ListViewLayout.grid:
21
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
22
+ case ListViewLayout.card:
23
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
24
+ default:
25
+ return children;
26
+ }
27
+ };
28
+ const ListItemView = (props) => {
29
+ var _a, _b;
30
+ const { item } = props;
31
+ if ((_a = item == null ? void 0 : item.item) == null ? void 0 : _a.value) {
32
+ const itemCase = ((_b = item.item) == null ? void 0 : _b.case) || "";
33
+ switch (itemCase) {
34
+ case "commonListItem":
35
+ return /* @__PURE__ */ jsx(CommonListItemView, { item: item.item.value });
36
+ case "postCard":
37
+ return /* @__PURE__ */ jsx(PostCardListItem, { item: item.item.value });
38
+ default:
39
+ return /* @__PURE__ */ jsx("span", { className: "bg-red-600 p-2", children: "unknow list item type" });
40
+ }
41
+ }
42
+ return null;
43
+ };
44
+ const PostCardListItem = (props) => {
45
+ const { item } = props;
46
+ const slugPath = useListview((x) => x.slugPath);
47
+ const activateItem = useListview((x) => x.activateItem);
48
+ const setActivateItem = useListview((x) => x.setActivateItem);
49
+ if (item.layoutVariant == "list") {
50
+ return /* @__PURE__ */ jsx("li", { className: "py-12", children: /* @__PURE__ */ jsx("article", { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
51
+ /* @__PURE__ */ jsxs("dl", { children: [
52
+ /* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
53
+ /* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx(MtDateView, { date: item.publishDate }) })
54
+ ] }),
55
+ /* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
56
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
57
+ /* @__PURE__ */ jsxs("div", { children: [
58
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
59
+ MtLink,
60
+ {
61
+ href: `/blog/${item.slug}`,
62
+ className: "text-gray-900 dark:text-gray-100",
63
+ children: item.title
64
+ }
65
+ ) }),
66
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: item.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
67
+ ] }),
68
+ /* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: item.summary })
69
+ ] }),
70
+ /* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
71
+ MtLink,
72
+ {
73
+ href: `/blog/${item.slug}`,
74
+ className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
75
+ "aria-label": `Read more: "${title}"`,
76
+ children: "Read more \u2192"
77
+ }
78
+ ) })
79
+ ] })
80
+ ] }) }) });
81
+ }
82
+ return /* @__PURE__ */ jsxs(
83
+ Card,
84
+ {
85
+ className: cn(
86
+ "m-2 w-[350px]",
87
+ item.id == (activateItem == null ? void 0 : activateItem.id) && " p-2 shadow-md"
88
+ ),
89
+ onClick: () => {
90
+ setActivateItem(item);
91
+ },
92
+ children: [
93
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
94
+ /* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(MtLink, { href: `${slugPath}/${item.id}`, className: "pb-4 text-3xl font-bold hover:text-gray-700", children: item == null ? void 0 : item.title }) }),
95
+ /* @__PURE__ */ jsx(CardDescription, { children: "Deploy your new project in one-click." })
96
+ ] }),
97
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("article", { className: "my-4 flex flex-col", children: [
98
+ /* @__PURE__ */ jsx(MtLink, {
99
+ href: `${slugPath}/${item.id}`,
100
+ className: "hover:opacity-75",
101
+ // eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
102
+ children: item.topImage && /* @__PURE__ */ jsx("img", { src: item.topImage, alt: item.title })
103
+ }),
104
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-start bg-white p-6", children: [
105
+ /* @__PURE__ */ jsx(MtLink, { href: `${slugPath}/${item.id}`, className: "pb-4 text-sm font-bold uppercase text-blue-700", children: item.category || "news" }),
106
+ /* @__PURE__ */ jsxs("p", { className: "pb-3 text-sm", children: [
107
+ "By ",
108
+ /* @__PURE__ */ jsx(MtLink, { href: "#", children: item.author }),
109
+ ","
110
+ ] }),
111
+ /* @__PURE__ */ jsx("div", { children: item.excerpt })
112
+ ] })
113
+ ] }) }),
114
+ /* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-end", children: [
115
+ /* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: `${slugPath}/${item.id}`, children: "Show" }),
116
+ /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id })
117
+ ] })
118
+ ]
119
+ }
120
+ );
121
+ };
122
+ const PostCardItemActions = (props) => {
123
+ const { id } = props;
124
+ const setOpenCreate = useListview((x) => x.setOpenCreate);
125
+ const setOpenRemove = useListview((x) => x.setOpenRemove);
126
+ const slugPath = useListview((x) => x.slugPath);
127
+ const [open, setOpen] = useState(false);
128
+ const setOpenEdit = useListview((x) => x.setOpenEdit);
129
+ return /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
130
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
131
+ MtLink,
132
+ {
133
+ href: `${slugPath}/${id}`,
134
+ variant: "ghost",
135
+ className: "data-[state=open]:bg-muted flex size-8 p-0",
136
+ children: [
137
+ /* @__PURE__ */ jsx(Icons.chevronRight, { className: "size-4" }),
138
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "more" })
139
+ ]
140
+ }
141
+ ) }),
142
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[160px]", children: [
143
+ /* @__PURE__ */ jsx(
144
+ DropdownMenuItem,
145
+ {
146
+ onClick: (e) => {
147
+ e.preventDefault();
148
+ setOpenCreate(true);
149
+ setOpen(false);
150
+ },
151
+ children: "create"
152
+ }
153
+ ),
154
+ /* @__PURE__ */ jsx(
155
+ DropdownMenuItem,
156
+ {
157
+ onClick: (e) => {
158
+ e.preventDefault();
159
+ setOpenEdit(true);
160
+ setOpen(false);
161
+ },
162
+ children: "edit"
163
+ }
164
+ ),
165
+ /* @__PURE__ */ jsx(
166
+ DropdownMenuItem,
167
+ {
168
+ onClick: (e) => {
169
+ e.preventDefault();
170
+ setOpenRemove(true);
171
+ setOpen(false);
172
+ },
173
+ children: "remove"
174
+ }
175
+ ),
176
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
177
+ ] })
178
+ ] });
179
+ };
180
+ export {
181
+ ListItemView,
182
+ ListViewLayoutRender,
183
+ PostCardItemActions,
184
+ PostCardListItem
185
+ };
@@ -5,13 +5,49 @@ 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 { title } from "process";
8
9
  import { useState } from "react";
10
+ import { MtDateView } from "../../components/MtDate";
11
+ import Tag from "../../components/Tag";
9
12
  import { useListview } from "../listview/list-store";
10
13
  const PostCardListItem = (props) => {
11
14
  const { item } = props;
12
15
  const slugPath = useListview((x) => x.slugPath);
13
16
  const activateItem = useListview((x) => x.activateItem);
14
17
  const setActivateItem = useListview((x) => x.setActivateItem);
18
+ if (item.layoutVariant == "list") {
19
+ return /* @__PURE__ */ jsx("li", { className: "py-12", children: /* @__PURE__ */ jsx("article", { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
20
+ /* @__PURE__ */ jsxs("dl", { children: [
21
+ /* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
22
+ /* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx(MtDateView, { date: item.publishDate }) })
23
+ ] }),
24
+ /* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
25
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
26
+ /* @__PURE__ */ jsxs("div", { children: [
27
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
28
+ MtLink,
29
+ {
30
+ href: `/blog/${item.slug}`,
31
+ className: "text-gray-900 dark:text-gray-100",
32
+ children: item.title
33
+ }
34
+ ) }),
35
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: item.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
36
+ ] }),
37
+ /* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: item.summary })
38
+ ] }),
39
+ /* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
40
+ MtLink,
41
+ {
42
+ href: `/blog/${item.slug}`,
43
+ className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
44
+ "aria-label": `Read more: "${title}"`,
45
+ children: "Read more \u2192"
46
+ }
47
+ ) })
48
+ ] })
49
+ ] }) }) });
50
+ }
15
51
  return /* @__PURE__ */ jsxs(
16
52
  Card,
17
53
  {
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { PostCardItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
3
+ export declare const PostCardListItem: (props: {
4
+ item: PostCardItem;
5
+ }) => import("react").JSX.Element;
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useListview } from "../listview/list-store";
4
+ const PostCardListItem = (props) => {
5
+ const { item } = props;
6
+ const slugPath = useListview((x) => x.slugPath);
7
+ const activateItem = useListview((x) => x.activateItem);
8
+ const setActivateItem = useListview((x) => x.setActivateItem);
9
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("li", { className: "py-12", children: /* @__PURE__ */ jsx("article", { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
10
+ /* @__PURE__ */ jsxs("dl", { children: [
11
+ /* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
12
+ /* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx("time", { dateTime: date, children: formatDate(date, siteMetadata.locale) }) })
13
+ ] }),
14
+ /* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
15
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
16
+ /* @__PURE__ */ jsxs("div", { children: [
17
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
18
+ Link,
19
+ {
20
+ href: `/blog/${slug}`,
21
+ className: "text-gray-900 dark:text-gray-100",
22
+ children: title
23
+ }
24
+ ) }),
25
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
26
+ ] }),
27
+ /* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: summary })
28
+ ] }),
29
+ /* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
30
+ Link,
31
+ {
32
+ href: `/blog/${slug}`,
33
+ className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
34
+ "aria-label": `Read more: "${title}"`,
35
+ children: "Read more \u2192"
36
+ }
37
+ ) })
38
+ ] })
39
+ ] }) }) }, slug) });
40
+ };
41
+ export {
42
+ PostCardListItem
43
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const LzListViewLayoutDemo: import("react").LazyExoticComponent<typeof import("./listview-layouts/listviewlayout-demo").default>;
3
+ export declare const LzListViewLayoutDefault: import("react").LazyExoticComponent<typeof import("./listview-layouts/default").default>;
4
+ export declare function CommonListView(): import("react").JSX.Element | null;
5
+ export declare const ListViewActions: () => import("react").JSX.Element;
@@ -0,0 +1,114 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Icons } from "mtxuilib/icons/icons";
4
+ import { cn } from "mtxuilib/lib/utils";
5
+ import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
7
+ import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
8
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
9
+ import { Suspense, lazy, useMemo, useState } from "react";
10
+ import { useHotkeys } from "react-hotkeys-hook";
11
+ import { MtmErrorView } from "../../components/MtmErrorView";
12
+ import { HOTKEY_Listview_Switchlayout } from "../../consts";
13
+ import { useGomtmSuspenseInfiniteQuery } from "../../gomtmQuery";
14
+ import { CurdCreatePanelTriggerButton } from "../create/CurdCreatePanel";
15
+ import { CurdEditPanelTriggerButton } from "../edit/CurdEditPanel";
16
+ import { ListItemView, ListViewLayoutRender } from "../list-item/ListViewLayoutRender";
17
+ import { useListview } from "./list-store";
18
+ const ALL_Layouts = [
19
+ "default",
20
+ "demo"
21
+ ];
22
+ const LzListViewLayoutDemo = lazy(() => import("./listview-layouts/listviewlayout-demo"));
23
+ const LzListViewLayoutDefault = lazy(() => import("./listview-layouts/default"));
24
+ function CommonListView() {
25
+ const svc = useListview((x) => x.svc);
26
+ const methodList = useListview((x) => x.methodList);
27
+ const paramList = useListview((x) => x.paramsList);
28
+ const listQuery = useGomtmSuspenseInfiniteQuery(svc, methodList, paramList);
29
+ if (!(listQuery == null ? void 0 : listQuery.data)) {
30
+ return null;
31
+ }
32
+ return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
33
+ /* @__PURE__ */ jsx(
34
+ "div",
35
+ {
36
+ className: cn(
37
+ "w-full"
38
+ // 滚动设置
39
+ // " max-h-[700px] overflow-y-auto"
40
+ ),
41
+ children: listQuery.data.pages.map((page, i) => {
42
+ var _a;
43
+ if (page.errCode) {
44
+ return /* @__PURE__ */ jsx(MtmErrorView, { unaryError: page }, i);
45
+ } 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);
47
+ }
48
+ })
49
+ }
50
+ ),
51
+ listQuery.data.pages && !!listQuery.data.pages.length && /* @__PURE__ */ jsx(Pagination, { children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
52
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationPrevious, { href: "#" }) }),
53
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "1" }) }),
54
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", isActive: true, children: "2" }) }),
55
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "3" }) }),
56
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }),
57
+ /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationNext, { href: "#" }) })
58
+ ] }) }),
59
+ /* @__PURE__ */ jsx("div", { className: "absolute right-1 top-1", children: /* @__PURE__ */ jsx(ListViewActions, {}) })
60
+ ] });
61
+ }
62
+ const ListViewActions = () => {
63
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
64
+ /* @__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, {}) }) }),
65
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", children: [
66
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Edit" }),
67
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
68
+ /* @__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: [
69
+ /* @__PURE__ */ jsx(CurdEditPanelTriggerButton, {}),
70
+ /* @__PURE__ */ jsx(CurdCreatePanelTriggerButton, {})
71
+ ] }) }) }) }),
72
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
73
+ ] })
74
+ ] });
75
+ };
76
+ const ListViewLayout = (props) => {
77
+ const layout = useListview((x) => x.layout);
78
+ const { children } = props;
79
+ const Layout = useMemo(() => {
80
+ switch (layout) {
81
+ case "demo":
82
+ return LzListViewLayoutDemo;
83
+ default:
84
+ return LzListViewLayoutDefault;
85
+ }
86
+ }, [layout]);
87
+ return /* @__PURE__ */ jsx(Layout, { children });
88
+ };
89
+ const ListViewLayoutSwitch = () => {
90
+ const layout = useListview((x) => x.layout);
91
+ const setLayout = useListview((x) => x.setLayout);
92
+ const [open, setOpen] = useState(false);
93
+ useHotkeys(HOTKEY_Listview_Switchlayout, () => {
94
+ setOpen((pre) => !pre);
95
+ }, [open, setOpen]);
96
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
97
+ /* @__PURE__ */ jsxs(DialogTitle, { children: [
98
+ "LayoutSwitch,",
99
+ layout
100
+ ] }),
101
+ /* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout2) => {
102
+ return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
103
+ setLayout(layout2);
104
+ setOpen(false);
105
+ }, children: layout2 }, layout2);
106
+ }) })
107
+ ] }) });
108
+ };
109
+ export {
110
+ CommonListView,
111
+ ListViewActions,
112
+ LzListViewLayoutDefault,
113
+ LzListViewLayoutDemo
114
+ };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { CommonListView } from "./ListViewProvider";
3
+ import { CommonListView } from "./CommonListView";
4
4
  import { Suspense } from "react";
5
5
  import CurdCreatePanel from "../create/CurdCreatePanel";
6
6
  import CurdEditPanel from "../edit/CurdEditPanel";
@@ -428,12 +428,14 @@ export declare class PostCardItem extends Message<PostCardItem> {
428
428
  title: string;
429
429
  subTitle: string;
430
430
  actions?: ItemAction;
431
- sumary: string;
431
+ summary: string;
432
432
  topImage: string;
433
433
  excerpt: string;
434
434
  category: string;
435
435
  author: string;
436
436
  publishDate?: MtDate;
437
+ slug: string;
438
+ tags: string[];
437
439
  constructor(data?: PartialMessage<PostCardItem>);
438
440
  static readonly runtime: typeof proto3;
439
441
  static readonly typeName = "sppb.PostCardItem";
@@ -1612,7 +1612,7 @@ const _PostCardItem = class _PostCardItem extends Message {
1612
1612
  */
1613
1613
  __publicField(this, "id", "");
1614
1614
  /**
1615
- * 变体
1615
+ * 布局
1616
1616
  *
1617
1617
  * @generated from field: string layout_variant = 2;
1618
1618
  */
@@ -1630,9 +1630,9 @@ const _PostCardItem = class _PostCardItem extends Message {
1630
1630
  */
1631
1631
  __publicField(this, "actions");
1632
1632
  /**
1633
- * @generated from field: string sumary = 6;
1633
+ * @generated from field: string summary = 6;
1634
1634
  */
1635
- __publicField(this, "sumary", "");
1635
+ __publicField(this, "summary", "");
1636
1636
  /**
1637
1637
  * @generated from field: string top_image = 7;
1638
1638
  */
@@ -1657,6 +1657,14 @@ const _PostCardItem = class _PostCardItem extends Message {
1657
1657
  * @generated from field: sppb.MtDate publish_date = 11;
1658
1658
  */
1659
1659
  __publicField(this, "publishDate");
1660
+ /**
1661
+ * @generated from field: string slug = 12;
1662
+ */
1663
+ __publicField(this, "slug", "");
1664
+ /**
1665
+ * @generated from field: repeated string tags = 13;
1666
+ */
1667
+ __publicField(this, "tags", []);
1660
1668
  proto3.util.initPartial(data, this);
1661
1669
  }
1662
1670
  static fromBinary(bytes, options) {
@@ -1706,7 +1714,7 @@ __publicField(_PostCardItem, "fields", proto3.util.newFieldList(() => [
1706
1714
  { no: 5, name: "actions", kind: "message", T: ItemAction },
1707
1715
  {
1708
1716
  no: 6,
1709
- name: "sumary",
1717
+ name: "summary",
1710
1718
  kind: "scalar",
1711
1719
  T: 9
1712
1720
  /* ScalarType.STRING */
@@ -1739,7 +1747,15 @@ __publicField(_PostCardItem, "fields", proto3.util.newFieldList(() => [
1739
1747
  T: 9
1740
1748
  /* ScalarType.STRING */
1741
1749
  },
1742
- { no: 11, name: "publish_date", kind: "message", T: MtDate }
1750
+ { no: 11, name: "publish_date", kind: "message", T: MtDate },
1751
+ {
1752
+ no: 12,
1753
+ name: "slug",
1754
+ kind: "scalar",
1755
+ T: 9
1756
+ /* ScalarType.STRING */
1757
+ },
1758
+ { no: 13, name: "tags", kind: "scalar", T: 9, repeated: true }
1743
1759
  ]));
1744
1760
  let PostCardItem = _PostCardItem;
1745
1761
  const _ListItemAction = class _ListItemAction extends Message {
@@ -1929,9 +1945,6 @@ const _CommontListReq = class _CommontListReq extends Message {
1929
1945
  constructor(data) {
1930
1946
  super();
1931
1947
  /**
1932
- * ListParams params = 1;
1933
- * Paging pagination = 2;
1934
- *
1935
1948
  * @generated from field: optional string slugs = 1;
1936
1949
  */
1937
1950
  __publicField(this, "slugs");
@@ -1946,7 +1959,6 @@ const _CommontListReq = class _CommontListReq extends Message {
1946
1959
  */
1947
1960
  __publicField(this, "pagination");
1948
1961
  /**
1949
- * ListViewLayout view_type = 5;
1950
1962
  * optional repeated string service_tags = 6; // 匹配到具体服务的标签(多个)
1951
1963
  *
1952
1964
  * 单个服务最大结果数