gomtm 0.0.329 → 0.0.330
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.
- package/dist/esm/curd/listview/list-store.d.ts +3 -3
- package/dist/esm/validations/_common.d.ts +6 -6
- package/dist/esm/validations/blog.d.ts +6 -6
- package/dist/esm/validations/crawlerSchema.d.ts +3 -3
- package/dist/esm/validations/spContentModi.d.ts +4 -4
- package/dist/esm/validations/spRoute.d.ts +4 -4
- package/dist/esm/validations/user.d.ts +6 -6
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/esm/curd/list-item/CommonListItemView.d.ts +0 -9
- package/dist/esm/curd/list-item/CommonListItemView.js +0 -68
- package/dist/esm/curd/list-item/ListItem.d.ts +0 -6
- package/dist/esm/curd/list-item/ListItem.js +0 -23
- package/dist/esm/curd/list-item/ListLayout.d.ts +0 -5
- package/dist/esm/curd/list-item/ListLayout.js +0 -19
- package/dist/esm/curd/list-item/PostCardListItem.d.ts +0 -8
- package/dist/esm/curd/list-item/PostCardListItem.js +0 -152
- package/dist/esm/curd/list-item/PostListItemAuto.d.ts +0 -5
- package/dist/esm/curd/list-item/PostListItemAuto.js +0 -43
- package/dist/esm/curd/listview/ListViewProvider.d.ts +0 -5
- package/dist/esm/curd/listview/ListViewProvider.js +0 -115
- package/dist/esm/ly/ExampleChildren.d.ts +0 -2
- package/dist/esm/ly/ExampleChildren.js +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gomtm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.330",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"zod": "^3.22.2",
|
|
86
86
|
"zustand": "^4.5.2",
|
|
87
87
|
"pliny": "0.2.0",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
88
|
+
"mtxlib": "0.3.410",
|
|
89
|
+
"mtxuilib": "0.0.687"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@babel/core": "^7.24.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PlainMessage } from "@bufbuild/protobuf";
|
|
3
|
-
import { CommonListItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
|
|
4
|
-
export declare const CommonListItemView: (props: {
|
|
5
|
-
item: PlainMessage<CommonListItem>;
|
|
6
|
-
}) => import("react").JSX.Element;
|
|
7
|
-
export declare const ListItemViewActions: (props: {
|
|
8
|
-
id: string;
|
|
9
|
-
}) => import("react").JSX.Element;
|
|
@@ -1,68 +0,0 @@
|
|
|
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 { buttonVariants } from "mtxuilib/ui/button";
|
|
7
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
|
|
8
|
-
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
9
|
-
import { DropdownMenuItemLink } from "mtxuilib/ui/ui-mt/DropdownMenuItemLink";
|
|
10
|
-
import { useListview } from "../listview/list-store";
|
|
11
|
-
const CommonListItemView = (props) => {
|
|
12
|
-
const { item } = props;
|
|
13
|
-
const handleSelect = () => {
|
|
14
|
-
};
|
|
15
|
-
const slugPath = useListview((x) => x.slugPath);
|
|
16
|
-
return /* @__PURE__ */ jsxs(
|
|
17
|
-
"div",
|
|
18
|
-
{
|
|
19
|
-
"aria-label": item.id,
|
|
20
|
-
onClick: handleSelect,
|
|
21
|
-
className: cn(
|
|
22
|
-
buttonVariants({
|
|
23
|
-
variant: "ghost"
|
|
24
|
-
}),
|
|
25
|
-
"flex min-h-16 justify-start border p-4 text-left"
|
|
26
|
-
),
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxs(MtLink, { href: `${slugPath}/${item.id}`, children: [
|
|
29
|
-
slugPath,
|
|
30
|
-
item.title || item.id,
|
|
31
|
-
item.description && /* @__PURE__ */ jsx("div", { children: item.description })
|
|
32
|
-
] }) }),
|
|
33
|
-
/* @__PURE__ */ jsx(ListItemViewActions, { id: item.id })
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
const ListItemViewActions = (props) => {
|
|
39
|
-
const { id } = props;
|
|
40
|
-
const slugPath = useListview((x) => x.slugPath);
|
|
41
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
42
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
43
|
-
MtButton,
|
|
44
|
-
{
|
|
45
|
-
variant: "ghost",
|
|
46
|
-
className: "data-[state=open]:bg-muted flex size-8 p-0",
|
|
47
|
-
children: [
|
|
48
|
-
/* @__PURE__ */ jsx(Icons.chevronRight, { className: "size-4" }),
|
|
49
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Open menu" })
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
) }),
|
|
53
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[160px]", children: [
|
|
54
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${slugPath}/show`, children: "show" }),
|
|
55
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${slugPath}/edit`, children: "edit" }),
|
|
56
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${slugPath}/listdebug`, children: "list debug" }),
|
|
57
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
58
|
-
/* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
|
|
59
|
-
"Delete",
|
|
60
|
-
/* @__PURE__ */ jsx(DropdownMenuShortcut, { children: "\u2318\u232B" })
|
|
61
|
-
] })
|
|
62
|
-
] })
|
|
63
|
-
] });
|
|
64
|
-
};
|
|
65
|
-
export {
|
|
66
|
-
CommonListItemView,
|
|
67
|
-
ListItemViewActions
|
|
68
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { CommonListItemView } from "./CommonListItemView";
|
|
4
|
-
import { PostCardListItem } from "./PostCardListItem";
|
|
5
|
-
const ListItemView = (props) => {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
const { item } = props;
|
|
8
|
-
if ((_a = item == null ? void 0 : item.item) == null ? void 0 : _a.value) {
|
|
9
|
-
const itemCase = ((_b = item.item) == null ? void 0 : _b.case) || "";
|
|
10
|
-
switch (itemCase) {
|
|
11
|
-
case "commonListItem":
|
|
12
|
-
return /* @__PURE__ */ jsx(CommonListItemView, { item: item.item.value });
|
|
13
|
-
case "postCard":
|
|
14
|
-
return /* @__PURE__ */ jsx(PostCardListItem, { item: item.item.value });
|
|
15
|
-
default:
|
|
16
|
-
return /* @__PURE__ */ jsx("span", { className: "bg-red-600 p-2", children: "unknow list item type" });
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
ListItemView
|
|
23
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
|
|
3
|
-
export declare const ListLayout: (props: {
|
|
4
|
-
layout: ListViewLayout;
|
|
5
|
-
} & PropsWithChildren) => string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<import("react").AwaitedReactNode> | null | undefined;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
|
|
4
|
-
const ListLayout = (props) => {
|
|
5
|
-
const { children } = props;
|
|
6
|
-
switch (props.layout) {
|
|
7
|
-
case ListViewLayout.simple:
|
|
8
|
-
return /* @__PURE__ */ jsx("ul", { className: "divide-y divide-gray-200 dark:divide-gray-700", children });
|
|
9
|
-
case ListViewLayout.grid:
|
|
10
|
-
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
|
|
11
|
-
case ListViewLayout.card:
|
|
12
|
-
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
|
|
13
|
-
default:
|
|
14
|
-
return children;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
ListLayout
|
|
19
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
6
|
-
export declare const PostCardItemActions: (props: {
|
|
7
|
-
id: string;
|
|
8
|
-
}) => import("react").JSX.Element;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { MtLink } from "mtxuilib/common/mtlink";
|
|
4
|
-
import { cn } from "mtxuilib/lib/utils";
|
|
5
|
-
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
|
|
6
|
-
import { Icons } from "mtxuilib/icons/icons";
|
|
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 { useListview } from "../listview/list-store";
|
|
13
|
-
const PostCardListItem = (props) => {
|
|
14
|
-
const { item } = props;
|
|
15
|
-
const slugPath = useListview((x) => x.slugPath);
|
|
16
|
-
const activateItem = useListview((x) => x.activateItem);
|
|
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
|
-
}
|
|
51
|
-
return /* @__PURE__ */ jsxs(
|
|
52
|
-
Card,
|
|
53
|
-
{
|
|
54
|
-
className: cn(
|
|
55
|
-
"m-2 w-[350px]",
|
|
56
|
-
item.id == (activateItem == null ? void 0 : activateItem.id) && " p-2 shadow-md"
|
|
57
|
-
),
|
|
58
|
-
onClick: () => {
|
|
59
|
-
setActivateItem(item);
|
|
60
|
-
},
|
|
61
|
-
children: [
|
|
62
|
-
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
63
|
-
/* @__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 }) }),
|
|
64
|
-
/* @__PURE__ */ jsx(CardDescription, { children: "Deploy your new project in one-click." })
|
|
65
|
-
] }),
|
|
66
|
-
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("article", { className: "my-4 flex flex-col", children: [
|
|
67
|
-
/* @__PURE__ */ jsx(MtLink, {
|
|
68
|
-
href: `${slugPath}/${item.id}`,
|
|
69
|
-
className: "hover:opacity-75",
|
|
70
|
-
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
|
|
71
|
-
children: item.topImage && /* @__PURE__ */ jsx("img", { src: item.topImage, alt: item.title })
|
|
72
|
-
}),
|
|
73
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-start bg-white p-6", children: [
|
|
74
|
-
/* @__PURE__ */ jsx(MtLink, { href: `${slugPath}/${item.id}`, className: "pb-4 text-sm font-bold uppercase text-blue-700", children: item.category || "news" }),
|
|
75
|
-
/* @__PURE__ */ jsxs("p", { className: "pb-3 text-sm", children: [
|
|
76
|
-
"By ",
|
|
77
|
-
/* @__PURE__ */ jsx(MtLink, { href: "#", children: item.author }),
|
|
78
|
-
","
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ jsx("div", { children: item.excerpt })
|
|
81
|
-
] })
|
|
82
|
-
] }) }),
|
|
83
|
-
/* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-end", children: [
|
|
84
|
-
/* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: `${slugPath}/${item.id}`, children: "Show" }),
|
|
85
|
-
/* @__PURE__ */ jsx(PostCardItemActions, { id: item.id })
|
|
86
|
-
] })
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
const PostCardItemActions = (props) => {
|
|
92
|
-
const { id } = props;
|
|
93
|
-
const setOpenCreate = useListview((x) => x.setOpenCreate);
|
|
94
|
-
const setOpenRemove = useListview((x) => x.setOpenRemove);
|
|
95
|
-
const slugPath = useListview((x) => x.slugPath);
|
|
96
|
-
const [open, setOpen] = useState(false);
|
|
97
|
-
const setOpenEdit = useListview((x) => x.setOpenEdit);
|
|
98
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
99
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
100
|
-
MtLink,
|
|
101
|
-
{
|
|
102
|
-
href: `${slugPath}/${id}`,
|
|
103
|
-
variant: "ghost",
|
|
104
|
-
className: "data-[state=open]:bg-muted flex size-8 p-0",
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ jsx(Icons.chevronRight, { className: "size-4" }),
|
|
107
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "more" })
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
) }),
|
|
111
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[160px]", children: [
|
|
112
|
-
/* @__PURE__ */ jsx(
|
|
113
|
-
DropdownMenuItem,
|
|
114
|
-
{
|
|
115
|
-
onClick: (e) => {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
setOpenCreate(true);
|
|
118
|
-
setOpen(false);
|
|
119
|
-
},
|
|
120
|
-
children: "create"
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
/* @__PURE__ */ jsx(
|
|
124
|
-
DropdownMenuItem,
|
|
125
|
-
{
|
|
126
|
-
onClick: (e) => {
|
|
127
|
-
e.preventDefault();
|
|
128
|
-
setOpenEdit(true);
|
|
129
|
-
setOpen(false);
|
|
130
|
-
},
|
|
131
|
-
children: "edit"
|
|
132
|
-
}
|
|
133
|
-
),
|
|
134
|
-
/* @__PURE__ */ jsx(
|
|
135
|
-
DropdownMenuItem,
|
|
136
|
-
{
|
|
137
|
-
onClick: (e) => {
|
|
138
|
-
e.preventDefault();
|
|
139
|
-
setOpenRemove(true);
|
|
140
|
-
setOpen(false);
|
|
141
|
-
},
|
|
142
|
-
children: "remove"
|
|
143
|
-
}
|
|
144
|
-
),
|
|
145
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
146
|
-
] })
|
|
147
|
-
] });
|
|
148
|
-
};
|
|
149
|
-
export {
|
|
150
|
-
PostCardItemActions,
|
|
151
|
-
PostCardListItem
|
|
152
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
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;
|
|
@@ -1,115 +0,0 @@
|
|
|
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 } from "../list-item/ListItem";
|
|
17
|
-
import { ListLayout } from "../list-item/ListLayout";
|
|
18
|
-
import { useListview } from "./list-store";
|
|
19
|
-
const ALL_Layouts = [
|
|
20
|
-
"default",
|
|
21
|
-
"demo"
|
|
22
|
-
];
|
|
23
|
-
const LzListViewLayoutDemo = lazy(() => import("./listview-layouts/listviewlayout-demo"));
|
|
24
|
-
const LzListViewLayoutDefault = lazy(() => import("./listview-layouts/default"));
|
|
25
|
-
function CommonListView() {
|
|
26
|
-
const svc = useListview((x) => x.svc);
|
|
27
|
-
const methodList = useListview((x) => x.methodList);
|
|
28
|
-
const paramList = useListview((x) => x.paramsList);
|
|
29
|
-
const listQuery = useGomtmSuspenseInfiniteQuery(svc, methodList, paramList);
|
|
30
|
-
if (!(listQuery == null ? void 0 : listQuery.data)) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
34
|
-
/* @__PURE__ */ jsx(
|
|
35
|
-
"div",
|
|
36
|
-
{
|
|
37
|
-
className: cn(
|
|
38
|
-
"w-full"
|
|
39
|
-
// 滚动设置
|
|
40
|
-
// " max-h-[700px] overflow-y-auto"
|
|
41
|
-
),
|
|
42
|
-
children: listQuery.data.pages.map((page, i) => {
|
|
43
|
-
var _a;
|
|
44
|
-
if (page.errCode) {
|
|
45
|
-
return /* @__PURE__ */ jsx(MtmErrorView, { unaryError: page }, i);
|
|
46
|
-
} else {
|
|
47
|
-
return /* @__PURE__ */ jsx(ListLayout, { 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);
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
listQuery.data.pages && !!listQuery.data.pages.length && /* @__PURE__ */ jsx(Pagination, { children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
|
|
53
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationPrevious, { href: "#" }) }),
|
|
54
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "1" }) }),
|
|
55
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", isActive: true, children: "2" }) }),
|
|
56
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { href: "#", children: "3" }) }),
|
|
57
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }),
|
|
58
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationNext, { href: "#" }) })
|
|
59
|
-
] }) }),
|
|
60
|
-
/* @__PURE__ */ jsx("div", { className: "absolute right-1 top-1", children: /* @__PURE__ */ jsx(ListViewActions, {}) })
|
|
61
|
-
] });
|
|
62
|
-
}
|
|
63
|
-
const ListViewActions = () => {
|
|
64
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
65
|
-
/* @__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, {}) }) }),
|
|
66
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", children: [
|
|
67
|
-
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Edit" }),
|
|
68
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
69
|
-
/* @__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: [
|
|
70
|
-
/* @__PURE__ */ jsx(CurdEditPanelTriggerButton, {}),
|
|
71
|
-
/* @__PURE__ */ jsx(CurdCreatePanelTriggerButton, {})
|
|
72
|
-
] }) }) }) }),
|
|
73
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
74
|
-
] })
|
|
75
|
-
] });
|
|
76
|
-
};
|
|
77
|
-
const ListViewLayout = (props) => {
|
|
78
|
-
const layout = useListview((x) => x.layout);
|
|
79
|
-
const { children } = props;
|
|
80
|
-
const Layout = useMemo(() => {
|
|
81
|
-
switch (layout) {
|
|
82
|
-
case "demo":
|
|
83
|
-
return LzListViewLayoutDemo;
|
|
84
|
-
default:
|
|
85
|
-
return LzListViewLayoutDefault;
|
|
86
|
-
}
|
|
87
|
-
}, [layout]);
|
|
88
|
-
return /* @__PURE__ */ jsx(Layout, { children });
|
|
89
|
-
};
|
|
90
|
-
const ListViewLayoutSwitch = () => {
|
|
91
|
-
const layout = useListview((x) => x.layout);
|
|
92
|
-
const setLayout = useListview((x) => x.setLayout);
|
|
93
|
-
const [open, setOpen] = useState(false);
|
|
94
|
-
useHotkeys(HOTKEY_Listview_Switchlayout, () => {
|
|
95
|
-
setOpen((pre) => !pre);
|
|
96
|
-
}, [open, setOpen]);
|
|
97
|
-
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
98
|
-
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
99
|
-
"LayoutSwitch,",
|
|
100
|
-
layout
|
|
101
|
-
] }),
|
|
102
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout2) => {
|
|
103
|
-
return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
104
|
-
setLayout(layout2);
|
|
105
|
-
setOpen(false);
|
|
106
|
-
}, children: layout2 }, layout2);
|
|
107
|
-
}) })
|
|
108
|
-
] }) });
|
|
109
|
-
};
|
|
110
|
-
export {
|
|
111
|
-
CommonListView,
|
|
112
|
-
ListViewActions,
|
|
113
|
-
LzListViewLayoutDefault,
|
|
114
|
-
LzListViewLayoutDemo
|
|
115
|
-
};
|