gomtm 0.0.326 → 0.0.328
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.
|
@@ -4,6 +4,8 @@ import { flexRender } from "mtxuilib/lib/render";
|
|
|
4
4
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
5
5
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
6
6
|
import { FullScreenPanel } from "mtxuilib/ui/ui-mt/FullScreenEditPanel";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { useGomtmSuspenseQuery } from "../../gomtmQuery";
|
|
7
9
|
import { useListview } from "../listview/list-store";
|
|
8
10
|
function CurdEditPanel(props) {
|
|
9
11
|
const { fullScreen } = props;
|
|
@@ -14,7 +16,7 @@ function CurdEditPanel(props) {
|
|
|
14
16
|
return null;
|
|
15
17
|
}
|
|
16
18
|
if (fullScreen) {
|
|
17
|
-
return /* @__PURE__ */ jsx(FullScreenPanel, { children: openEdit && editRender && flexRender(editRender, {}) });
|
|
19
|
+
return /* @__PURE__ */ jsx(WithLoadGetData, { children: /* @__PURE__ */ jsx(FullScreenPanel, { children: openEdit && editRender && flexRender(editRender, {}) }) });
|
|
18
20
|
}
|
|
19
21
|
return /* @__PURE__ */ jsx(Dialog, { open: openEdit, onOpenChange: setOpenEdit, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
20
22
|
/* @__PURE__ */ jsx(DialogTitle, { children: " Edit " }),
|
|
@@ -24,6 +26,26 @@ function CurdEditPanel(props) {
|
|
|
24
26
|
}, children: "xxxxx" })
|
|
25
27
|
] }) });
|
|
26
28
|
}
|
|
29
|
+
const WithLoadGetData = (props) => {
|
|
30
|
+
const { children } = props;
|
|
31
|
+
const methodGet = useListview((x) => x.methodGet);
|
|
32
|
+
const svc = useListview((x) => x.svc);
|
|
33
|
+
const activateItem = useListview((x) => x.activateItem);
|
|
34
|
+
const setDetailData = useListview((x) => x.setDetailData);
|
|
35
|
+
const detailQuery = useGomtmSuspenseQuery(svc, methodGet, {
|
|
36
|
+
id: parseInt(activateItem.id)
|
|
37
|
+
});
|
|
38
|
+
useMemo(() => {
|
|
39
|
+
setDetailData(detailQuery.data);
|
|
40
|
+
}, [detailQuery.data, setDetailData]);
|
|
41
|
+
if (detailQuery.isLoading) {
|
|
42
|
+
return /* @__PURE__ */ jsx("div", { children: "loading detail" });
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-red-200 p-2", children: [
|
|
45
|
+
"WithLoadGetData",
|
|
46
|
+
children
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
27
49
|
const CurdEditPanelTriggerButton = () => {
|
|
28
50
|
const setOpenEdit = useListview((x) => x.setOpenEdit);
|
|
29
51
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
@@ -79,37 +79,52 @@ const PostCardListItem = (props) => {
|
|
|
79
79
|
const activateItem = useListview((x) => x.activateItem);
|
|
80
80
|
const setActivateItem = useListview((x) => x.setActivateItem);
|
|
81
81
|
if (item.layoutVariant == "list") {
|
|
82
|
-
return /* @__PURE__ */ jsx(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
"li",
|
|
84
|
+
{
|
|
85
|
+
className: cn(
|
|
86
|
+
"relative py-12",
|
|
87
|
+
(activateItem == null ? void 0 : activateItem.id) == (item == null ? void 0 : item.id) && "border "
|
|
88
|
+
),
|
|
89
|
+
onClick: () => {
|
|
90
|
+
setActivateItem(item);
|
|
91
|
+
},
|
|
92
|
+
children: /* @__PURE__ */ jsxs("article", { children: [
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
|
|
94
|
+
/* @__PURE__ */ jsxs("dl", { children: [
|
|
95
|
+
/* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
|
|
96
|
+
/* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx(MtDateView, { date: item.publishDate }) })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
|
|
99
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
100
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
101
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
|
|
102
|
+
MtLink,
|
|
103
|
+
{
|
|
104
|
+
href: `/blog/${item.slug}`,
|
|
105
|
+
className: "text-gray-900 dark:text-gray-100",
|
|
106
|
+
children: item.title
|
|
107
|
+
}
|
|
108
|
+
) }),
|
|
109
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: item.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
|
|
110
|
+
] }),
|
|
111
|
+
/* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: item.summary })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
|
|
114
|
+
MtLink,
|
|
115
|
+
{
|
|
116
|
+
href: `/blog/${item.slug}`,
|
|
117
|
+
className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
|
|
118
|
+
"aria-label": `Read more: "${title}"`,
|
|
119
|
+
children: "Read more \u2192"
|
|
120
|
+
}
|
|
121
|
+
) })
|
|
122
|
+
] })
|
|
99
123
|
] }),
|
|
100
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
101
|
-
] })
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
href: `/blog/${item.slug}`,
|
|
106
|
-
className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
|
|
107
|
-
"aria-label": `Read more: "${title}"`,
|
|
108
|
-
children: "Read more \u2192"
|
|
109
|
-
}
|
|
110
|
-
) })
|
|
111
|
-
] })
|
|
112
|
-
] }) }) });
|
|
124
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-0", children: /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id }) })
|
|
125
|
+
] })
|
|
126
|
+
}
|
|
127
|
+
);
|
|
113
128
|
}
|
|
114
129
|
return /* @__PURE__ */ jsxs(
|
|
115
130
|
Card,
|
|
@@ -158,6 +173,7 @@ const PostCardItemActions = (props) => {
|
|
|
158
173
|
const slugPath = useListview((x) => x.slugPath);
|
|
159
174
|
const [open, setOpen] = useState(false);
|
|
160
175
|
const setOpenEdit = useListview((x) => x.setOpenEdit);
|
|
176
|
+
const setActivateItem = useListview((x) => x.setActivateItem);
|
|
161
177
|
return /* @__PURE__ */ jsxs(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
162
178
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
163
179
|
MtLink,
|
|
@@ -29,6 +29,7 @@ export interface ListViewState extends ListViewStateProps {
|
|
|
29
29
|
loadListData: () => Promise<any>;
|
|
30
30
|
nextPage: () => void;
|
|
31
31
|
setEditRender: (a: Renderable<any>) => void;
|
|
32
|
+
setDetailData: (detailData: any) => void;
|
|
32
33
|
}
|
|
33
34
|
export declare const listViewContext: import("react").Context<import("zustand").StoreApi<ListViewState> | null>;
|
|
34
35
|
type BearProviderProps = React.PropsWithChildren<ListViewStateProps>;
|
|
@@ -96,7 +96,8 @@ const createListviewStore = (initProps) => {
|
|
|
96
96
|
}),
|
|
97
97
|
nextPage: () => {
|
|
98
98
|
},
|
|
99
|
-
setEditRender: (editRender) => set({ editRender })
|
|
99
|
+
setEditRender: (editRender) => set({ editRender }),
|
|
100
|
+
setDetailData: (detailData) => set({ detailData })
|
|
100
101
|
}));
|
|
101
102
|
};
|
|
102
103
|
const listViewContext = createContext(null);
|