gomtm 0.0.251 → 0.0.253
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/CommonListViewV2.d.ts +19 -2
- package/dist/esm/curd/CommonListViewV2.js +66 -50
- package/dist/esm/curd/create/CurdCreatePanel.d.ts +0 -3
- package/dist/esm/curd/create/CurdCreatePanel.js +6 -8
- package/dist/esm/curd/curd.atoms.d.ts +0 -16
- package/dist/esm/curd/curd.atoms.js +0 -38
- package/dist/esm/curd/dlg/DlgCurdDebugInfo.js +1 -8
- package/dist/esm/curd/edit/CurdEditPanel.d.ts +0 -3
- package/dist/esm/curd/edit/CurdEditPanel.js +9 -18
- package/dist/esm/curd/list-item/CommonListItemView.js +8 -9
- package/dist/esm/curd/list-item/PostCardListItem.js +15 -20
- package/dist/esm/ly/LayoutBase.d.ts +3 -0
- package/dist/esm/ly/LayoutBase.js +24 -30
- package/dist/esm/ly/Lazy.d.ts +2 -0
- package/dist/esm/ly/Lazy.js +12 -0
- package/dist/esm/ly/debug-layout/index.js +5 -2
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Message } from "@bufbuild/protobuf";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
2
|
+
import { Dispatch, PropsWithChildren, SetStateAction } from "react";
|
|
3
3
|
import { MethodUnaryDescriptor } from "../connectquery";
|
|
4
|
-
export declare const curdSlugPathAtom: import("jotai").Atom<string>;
|
|
5
4
|
export declare const exampleListItemValueComponent: import("jotai").PrimitiveAtom<any> & {
|
|
6
5
|
init: any;
|
|
7
6
|
};
|
|
@@ -12,5 +11,23 @@ export declare function CommonListViewProvider<I extends Message<I>, O extends M
|
|
|
12
11
|
methodCreate?: MethodUnaryDescriptor<any, any>;
|
|
13
12
|
slugPath?: string;
|
|
14
13
|
} & PropsWithChildren): import("react").JSX.Element;
|
|
14
|
+
export declare const useListView: () => {
|
|
15
|
+
methodList?: MethodUnaryDescriptor<any, any> | undefined;
|
|
16
|
+
methodDelete?: MethodUnaryDescriptor<any, any> | undefined;
|
|
17
|
+
methodCreate?: MethodUnaryDescriptor<any, any> | undefined;
|
|
18
|
+
slugPath?: string | undefined;
|
|
19
|
+
activateItem?: any;
|
|
20
|
+
params?: any;
|
|
21
|
+
openRemove?: boolean | undefined;
|
|
22
|
+
setOpenRemove?: Dispatch<SetStateAction<boolean>> | undefined;
|
|
23
|
+
openCreate?: boolean | undefined;
|
|
24
|
+
setOpenCreate?: Dispatch<SetStateAction<boolean>> | undefined;
|
|
25
|
+
setActivateItem?: Dispatch<any> | undefined;
|
|
26
|
+
openEdit?: boolean | undefined;
|
|
27
|
+
setOpenEdit?: Dispatch<SetStateAction<boolean>> | undefined;
|
|
28
|
+
openDebug?: boolean | undefined;
|
|
29
|
+
setOpenDebug?: Dispatch<SetStateAction<boolean>> | undefined;
|
|
30
|
+
setParams?: Dispatch<any> | undefined;
|
|
31
|
+
};
|
|
15
32
|
export declare function CommonListView<I extends Message<I>, O extends Message<O>>(): import("react").JSX.Element | null;
|
|
16
33
|
export declare const ListViewActions: () => import("react").JSX.Element;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __spreadValues = (a, b) => {
|
|
8
|
+
for (var prop in b || (b = {}))
|
|
9
|
+
if (__hasOwnProp.call(b, prop))
|
|
10
|
+
__defNormalProp(a, prop, b[prop]);
|
|
11
|
+
if (__getOwnPropSymbols)
|
|
12
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
+
if (__propIsEnum.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
};
|
|
2
18
|
var __async = (__this, __arguments, generator) => {
|
|
3
19
|
return new Promise((resolve, reject) => {
|
|
4
20
|
var fulfilled = (value) => {
|
|
@@ -20,33 +36,21 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
36
|
});
|
|
21
37
|
};
|
|
22
38
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
import { atom
|
|
24
|
-
import { ScopeAtomsHydrator } from "mtxlib/jotai/jotai-helper";
|
|
25
|
-
import { DebugAtomValue } from "mtxuilib/common/devtools/DebugAtomValue";
|
|
39
|
+
import { atom } from "jotai";
|
|
26
40
|
import { Icons } from "mtxuilib/icons/icons";
|
|
27
41
|
import { cn } from "mtxuilib/lib/utils";
|
|
28
42
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
29
43
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
|
|
30
44
|
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
|
|
31
45
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
32
|
-
import { Suspense } from "react";
|
|
46
|
+
import { Suspense, createContext, useContext, useState } from "react";
|
|
33
47
|
import { MtUnaryCallErrorView } from "../components/MtUnaryCallErrorView";
|
|
34
48
|
import { useMutation, useSuspenseInfiniteQuery } from "../connectquery";
|
|
35
|
-
import CurdCreatePanel, { CurdCreatePanelTriggerButton
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
38
|
-
import CurdEditPanel, { CurdEditPanelTriggerButton, openCurdEditPanelAtom } from "./edit/CurdEditPanel";
|
|
49
|
+
import CurdCreatePanel, { CurdCreatePanelTriggerButton } from "./create/CurdCreatePanel";
|
|
50
|
+
import { DlgCurdDebugInfo, DlgCurdDebugInfoTriggerButton } from "./dlg/DlgCurdDebugInfo";
|
|
51
|
+
import CurdEditPanel, { CurdEditPanelTriggerButton } from "./edit/CurdEditPanel";
|
|
39
52
|
import { ListItemView } from "./list-item/ListItem";
|
|
40
53
|
import { ListLayout } from "./list-item/ListLayout";
|
|
41
|
-
const listQueryAtom = atom(null);
|
|
42
|
-
const curdSlugPathValueAtom = atom("");
|
|
43
|
-
const curdSlugPathAtom = atom((get) => {
|
|
44
|
-
const value = get(curdSlugPathValueAtom);
|
|
45
|
-
if (value == "/") {
|
|
46
|
-
return "";
|
|
47
|
-
}
|
|
48
|
-
return value || "";
|
|
49
|
-
});
|
|
50
54
|
const exampleListItemValueComponent = atom(void 0);
|
|
51
55
|
const exampleListItemComponent = atom((get) => {
|
|
52
56
|
const v = get(exampleListItemValueComponent);
|
|
@@ -57,34 +61,50 @@ const exampleListItemComponent = atom((get) => {
|
|
|
57
61
|
return /* @__PURE__ */ jsx("div", { children: "missing exampleListItemComponent" });
|
|
58
62
|
};
|
|
59
63
|
});
|
|
64
|
+
const commonListViewContext = createContext(void 0);
|
|
60
65
|
function CommonListViewProvider(props) {
|
|
61
66
|
const { children, methodList, methodDelete, slugPath, methodCreate } = props;
|
|
62
|
-
const
|
|
63
|
-
|
|
67
|
+
const [openRemove, setOpenRemove] = useState(false);
|
|
68
|
+
const [openCreate, setOpenCreate] = useState(false);
|
|
69
|
+
const [activateItem, setActivateItem] = useState(void 0);
|
|
70
|
+
const [openEdit, setOpenEdit] = useState(false);
|
|
71
|
+
const [openDebug, setOpenDebug] = useState(false);
|
|
72
|
+
const [params, setParams] = useState(void 0);
|
|
73
|
+
return /* @__PURE__ */ jsx(commonListViewContext.Provider, { value: {
|
|
74
|
+
methodList,
|
|
75
|
+
slugPath,
|
|
76
|
+
openRemove,
|
|
77
|
+
setOpenRemove,
|
|
78
|
+
methodDelete,
|
|
79
|
+
methodCreate,
|
|
80
|
+
openCreate,
|
|
81
|
+
setOpenCreate,
|
|
82
|
+
activateItem,
|
|
83
|
+
setActivateItem,
|
|
84
|
+
openEdit,
|
|
85
|
+
setOpenEdit,
|
|
86
|
+
openDebug,
|
|
87
|
+
setOpenDebug,
|
|
88
|
+
params,
|
|
89
|
+
setParams
|
|
90
|
+
}, children });
|
|
91
|
+
}
|
|
92
|
+
const useListView = () => {
|
|
93
|
+
const ctx = useContext(commonListViewContext);
|
|
94
|
+
return __spreadValues({}, ctx);
|
|
95
|
+
};
|
|
96
|
+
function CommonListView() {
|
|
97
|
+
const a = useListView();
|
|
98
|
+
const listQuery = useSuspenseInfiniteQuery(a.methodList, {
|
|
64
99
|
page: 1
|
|
65
100
|
}, {
|
|
66
101
|
pageParamKey: "pagination",
|
|
67
102
|
getNextPageParam: (res, b, c) => {
|
|
68
103
|
return {
|
|
69
|
-
//@ts-expect-error
|
|
70
104
|
page: ((c == null ? void 0 : c.page) || 0) + 1
|
|
71
105
|
};
|
|
72
106
|
}
|
|
73
107
|
});
|
|
74
|
-
return /* @__PURE__ */ jsx(ScopeAtomsHydrator, { atomValues: [
|
|
75
|
-
[listQueryAtom, listquery],
|
|
76
|
-
[curdSlugPathValueAtom, slugPath],
|
|
77
|
-
[removeMethodSigAtom, methodDelete],
|
|
78
|
-
[createMethodSigAtom, methodCreate],
|
|
79
|
-
[openRemovePanelAtom, false],
|
|
80
|
-
[openCreatePanelAtom, false],
|
|
81
|
-
[openDlgCurdDebugInfoAtom, false],
|
|
82
|
-
[openCurdEditPanelAtom, false],
|
|
83
|
-
[openCurdCreatePanelAtom, false]
|
|
84
|
-
], children });
|
|
85
|
-
}
|
|
86
|
-
function CommonListView() {
|
|
87
|
-
const [listQuery, setListQuery] = useAtom(listQueryAtom);
|
|
88
108
|
if (!(listQuery == null ? void 0 : listQuery.data)) {
|
|
89
109
|
return null;
|
|
90
110
|
}
|
|
@@ -119,29 +139,25 @@ function CommonListView() {
|
|
|
119
139
|
] });
|
|
120
140
|
}
|
|
121
141
|
const PanelRemove = () => {
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const mutation = useMutation(removeMeghodSig);
|
|
126
|
-
return /* @__PURE__ */ jsx(Dialog, { open: openRemovePanel, onOpenChange: setOpenRemovePanel, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
142
|
+
const listView = useListView();
|
|
143
|
+
const mutation = useMutation(listView.methodDelete);
|
|
144
|
+
return /* @__PURE__ */ jsx(Dialog, { open: listView.openRemove, onOpenChange: listView.setOpenRemove, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
127
145
|
/* @__PURE__ */ jsx(DialogTitle, { children: "remove item" }),
|
|
128
146
|
/* @__PURE__ */ jsx(MtButton, { onClick: () => __async(void 0, null, function* () {
|
|
147
|
+
var _a;
|
|
129
148
|
yield mutation.mutateAsync({
|
|
130
|
-
id: activateItem.id
|
|
149
|
+
id: (_a = listView.activateItem) == null ? void 0 : _a.id
|
|
131
150
|
});
|
|
132
|
-
|
|
133
|
-
}), children: "ok" })
|
|
134
|
-
/* @__PURE__ */ jsx(DebugAtomValue, { title: "removeMeghodSigAtom", atom: removeMethodSigAtom }),
|
|
135
|
-
/* @__PURE__ */ jsx(DebugAtomValue, { title: "activateItemAtom", atom: activateItemAtom })
|
|
151
|
+
listView.setOpenRemove(false);
|
|
152
|
+
}), children: "ok" })
|
|
136
153
|
] }) });
|
|
137
154
|
};
|
|
138
155
|
const PanelCreate = () => {
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
return /* @__PURE__ */ jsx(Dialog, { open: openCreatePanel, onOpenChange: setOpenCreatePanel, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
156
|
+
const listView = useListView();
|
|
157
|
+
return /* @__PURE__ */ jsx(Dialog, { open: listView.openCreate, onOpenChange: listView.setOpenCreate, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
142
158
|
/* @__PURE__ */ jsx(DialogTitle, { children: "TODO create item Dlg" }),
|
|
143
159
|
/* @__PURE__ */ jsx(MtButton, { onClick: () => __async(void 0, null, function* () {
|
|
144
|
-
|
|
160
|
+
listView.setOpenCreate(false);
|
|
145
161
|
}), children: "ok" })
|
|
146
162
|
] }) });
|
|
147
163
|
};
|
|
@@ -171,7 +187,7 @@ export {
|
|
|
171
187
|
CommonListView,
|
|
172
188
|
CommonListViewProvider,
|
|
173
189
|
ListViewActions,
|
|
174
|
-
curdSlugPathAtom,
|
|
175
190
|
exampleListItemComponent,
|
|
176
|
-
exampleListItemValueComponent
|
|
191
|
+
exampleListItemValueComponent,
|
|
192
|
+
useListView
|
|
177
193
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const openCurdCreatePanelAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
3
|
-
init: boolean;
|
|
4
|
-
};
|
|
5
2
|
export default function CurdCreatePanel(): import("react").JSX.Element;
|
|
6
3
|
export declare const CurdCreatePanelTriggerButton: () => import("react").JSX.Element;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { atom, useAtom } from "jotai";
|
|
4
3
|
import { useMtRouter } from "mtxuilib/hooks/use-router";
|
|
5
4
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
6
5
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
7
|
-
|
|
6
|
+
import { useListView } from "../CommonListViewV2";
|
|
8
7
|
function CurdCreatePanel() {
|
|
9
8
|
const router = useMtRouter();
|
|
10
|
-
const
|
|
11
|
-
return /* @__PURE__ */ jsx(Dialog, { open:
|
|
9
|
+
const listView = useListView();
|
|
10
|
+
return /* @__PURE__ */ jsx(Dialog, { open: listView.openCreate, onOpenChange: listView.setOpenCreate, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogTitle, { children: " Create " }) }) });
|
|
12
11
|
}
|
|
13
12
|
const CurdCreatePanelTriggerButton = () => {
|
|
14
|
-
const
|
|
13
|
+
const listView = useListView();
|
|
15
14
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
16
|
-
|
|
15
|
+
listView.setOpenCreate(true);
|
|
17
16
|
}, children: "OpenCreatePanel" }) });
|
|
18
17
|
};
|
|
19
18
|
export {
|
|
20
19
|
CurdCreatePanelTriggerButton,
|
|
21
|
-
CurdCreatePanel as default
|
|
22
|
-
openCurdCreatePanelAtom
|
|
20
|
+
CurdCreatePanel as default
|
|
23
21
|
};
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import { AnyMessage, PlainMessage } from "@bufbuild/protobuf";
|
|
2
2
|
import { CommontListRes } from "../gomtmpb/mtm/sppb/mtm_pb";
|
|
3
|
-
export declare const curdActivateIdAtom: import("jotai").PrimitiveAtom<string> & {
|
|
4
|
-
init: string;
|
|
5
|
-
};
|
|
6
3
|
export declare const curd3ListParamsAtom: import("jotai").PrimitiveAtom<PlainMessage<AnyMessage>> & {
|
|
7
4
|
init: PlainMessage<AnyMessage>;
|
|
8
5
|
};
|
|
9
|
-
export declare const activateItemValueAtom: import("jotai").PrimitiveAtom<any> & {
|
|
10
|
-
init: any;
|
|
11
|
-
};
|
|
12
|
-
export declare const activateItemAtom: import("jotai").WritableAtom<any, [value: any], void>;
|
|
13
|
-
export declare const paramsAtom: import("jotai").Atom<any>;
|
|
14
|
-
export declare const removeMethodSigAtom: import("jotai").PrimitiveAtom<any> & {
|
|
15
|
-
init: any;
|
|
16
|
-
};
|
|
17
|
-
export declare const openRemovePanelAtom: import("jotai").WritableAtom<boolean, [value: boolean], void>;
|
|
18
|
-
export declare const createMethodSigAtom: import("jotai").PrimitiveAtom<any> & {
|
|
19
|
-
init: any;
|
|
20
|
-
};
|
|
21
|
-
export declare const openCreatePanelAtom: import("jotai").WritableAtom<boolean, [value: boolean], void>;
|
|
22
6
|
export declare const curdPathAtom: import("jotai").PrimitiveAtom<string> & {
|
|
23
7
|
init: string;
|
|
24
8
|
};
|
|
@@ -24,37 +24,7 @@ import { usePathname } from "next/navigation";
|
|
|
24
24
|
import { useMemo } from "react";
|
|
25
25
|
import { CommontListRes } from "../gomtmpb/mtm/sppb/mtm_pb";
|
|
26
26
|
import { gomtmBaseUrlAtom } from "../providers/GomtmProvider";
|
|
27
|
-
const curdActivateIdAtom = atom("");
|
|
28
27
|
const curd3ListParamsAtom = atom({});
|
|
29
|
-
const activateItemValueAtom = atom(void 0);
|
|
30
|
-
const activateItemAtom = atom((get) => {
|
|
31
|
-
const v = get(activateItemValueAtom);
|
|
32
|
-
return v;
|
|
33
|
-
}, (_, set, value) => {
|
|
34
|
-
if (value == null ? void 0 : value.id) {
|
|
35
|
-
set(curdActivateIdAtom, value.id);
|
|
36
|
-
}
|
|
37
|
-
set(activateItemValueAtom, value);
|
|
38
|
-
});
|
|
39
|
-
const paramsValueAtom = atom(void 0);
|
|
40
|
-
const paramsAtom = atom((get) => {
|
|
41
|
-
const v = get(paramsValueAtom);
|
|
42
|
-
return v;
|
|
43
|
-
});
|
|
44
|
-
const removeMethodSigAtom = atom(void 0);
|
|
45
|
-
const openRemovePanelValueAtom = atom(false);
|
|
46
|
-
const openRemovePanelAtom = atom((get) => {
|
|
47
|
-
return get(openRemovePanelValueAtom);
|
|
48
|
-
}, (_, set, value) => {
|
|
49
|
-
set(openRemovePanelValueAtom, value);
|
|
50
|
-
});
|
|
51
|
-
const createMethodSigAtom = atom(void 0);
|
|
52
|
-
const openCreatePanelValueAtom = atom(false);
|
|
53
|
-
const openCreatePanelAtom = atom((get) => {
|
|
54
|
-
return get(openCreatePanelValueAtom);
|
|
55
|
-
}, (_, set, value) => {
|
|
56
|
-
set(openCreatePanelValueAtom, value);
|
|
57
|
-
});
|
|
58
28
|
const curdPathAtom = atom("");
|
|
59
29
|
const curd3ItemsV2Atom = atom((get) => __async(void 0, null, function* () {
|
|
60
30
|
const slugPath = get(curdPathAtom);
|
|
@@ -77,16 +47,8 @@ const useCurdSlugName = () => {
|
|
|
77
47
|
return nameSlug;
|
|
78
48
|
};
|
|
79
49
|
export {
|
|
80
|
-
activateItemAtom,
|
|
81
|
-
activateItemValueAtom,
|
|
82
|
-
createMethodSigAtom,
|
|
83
50
|
curd3ItemsV2Atom,
|
|
84
51
|
curd3ListParamsAtom,
|
|
85
|
-
curdActivateIdAtom,
|
|
86
52
|
curdPathAtom,
|
|
87
|
-
openCreatePanelAtom,
|
|
88
|
-
openRemovePanelAtom,
|
|
89
|
-
paramsAtom,
|
|
90
|
-
removeMethodSigAtom,
|
|
91
53
|
useCurdSlugName
|
|
92
54
|
};
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { atom, useAtom } from "jotai";
|
|
4
|
-
import { DebugAtomValue } from "mtxuilib/common/devtools/DebugAtomValue";
|
|
5
4
|
import { flexRender } from "mtxuilib/lib/render";
|
|
6
5
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
7
6
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
8
7
|
import { isDebugAtom } from "../../providers/GomtmProvider";
|
|
9
8
|
import { exampleListItemComponent } from "../CommonListViewV2";
|
|
10
|
-
import { createMethodSigAtom, curdActivateIdAtom, removeMethodSigAtom } from "../curd.atoms";
|
|
11
9
|
const openDlgCurdDebugInfoAtom = atom(false);
|
|
12
10
|
function DlgCurdDebugInfo() {
|
|
13
11
|
const [Comp] = useAtom(exampleListItemComponent);
|
|
14
12
|
const [openDlgCurdDebugInfo, setOpenDlgCurdDebugInfo] = useAtom(openDlgCurdDebugInfoAtom);
|
|
15
13
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Dialog, { open: openDlgCurdDebugInfo, onOpenChange: setOpenDlgCurdDebugInfo, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
16
14
|
/* @__PURE__ */ jsx(DialogTitle, { children: "list view info" }),
|
|
17
|
-
Comp && flexRender(Comp, {})
|
|
18
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
19
|
-
/* @__PURE__ */ jsx(DebugAtomValue, { title: "curdActivateIdAtom", atom: curdActivateIdAtom }),
|
|
20
|
-
/* @__PURE__ */ jsx(DebugAtomValue, { title: "removeMethodSigAtom", atom: removeMethodSigAtom }),
|
|
21
|
-
/* @__PURE__ */ jsx(DebugAtomValue, { title: "createMethodSigAtom", atom: createMethodSigAtom })
|
|
22
|
-
] })
|
|
15
|
+
Comp && flexRender(Comp, {})
|
|
23
16
|
] }) }) });
|
|
24
17
|
}
|
|
25
18
|
const DlgCurdDebugInfoTriggerButton = () => {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const openCurdEditPanelAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
3
|
-
init: boolean;
|
|
4
|
-
};
|
|
5
2
|
export default function CurdEditPanel(): import("react").JSX.Element;
|
|
6
3
|
export declare const CurdEditPanelTriggerButton: () => import("react").JSX.Element;
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Fragment, jsx
|
|
3
|
-
import { atom, useAtom } from "jotai";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
3
|
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
5
4
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
6
|
-
|
|
5
|
+
import { useListView } from "../CommonListViewV2";
|
|
7
6
|
function CurdEditPanel() {
|
|
8
|
-
const
|
|
9
|
-
return /* @__PURE__ */ jsx(Dialog, { open:
|
|
7
|
+
const listView = useListView();
|
|
8
|
+
return /* @__PURE__ */ jsx(Dialog, { open: listView.openEdit, onOpenChange: listView.setOpenEdit, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(DialogTitle, { children: " Edit " }) }) });
|
|
10
9
|
}
|
|
11
10
|
const CurdEditPanelTriggerButton = () => {
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
setOpenCurdEditPanel(true);
|
|
17
|
-
}, children: [
|
|
18
|
-
"Edit(",
|
|
19
|
-
JSON.stringify(openCurdEditPanel, null, 2),
|
|
20
|
-
")"
|
|
21
|
-
] })
|
|
22
|
-
] });
|
|
11
|
+
const listView = useListView();
|
|
12
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
13
|
+
listView.setOpenEdit(true);
|
|
14
|
+
}, children: "Edit" }) });
|
|
23
15
|
};
|
|
24
16
|
export {
|
|
25
17
|
CurdEditPanelTriggerButton,
|
|
26
|
-
CurdEditPanel as default
|
|
27
|
-
openCurdEditPanelAtom
|
|
18
|
+
CurdEditPanel as default
|
|
28
19
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useAtom } from "jotai";
|
|
4
3
|
import { MtLink } from "mtxuilib/common/mtlink";
|
|
5
4
|
import { Icons } from "mtxuilib/icons/icons";
|
|
6
5
|
import { cn } from "mtxuilib/lib/utils";
|
|
@@ -8,12 +7,12 @@ import { buttonVariants } from "mtxuilib/ui/button";
|
|
|
8
7
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
|
|
9
8
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
10
9
|
import { DropdownMenuItemLink } from "mtxuilib/ui/ui-mt/DropdownMenuItemLink";
|
|
11
|
-
import {
|
|
10
|
+
import { useListView } from "../CommonListViewV2";
|
|
12
11
|
const CommonListItemView = (props) => {
|
|
13
12
|
const { item } = props;
|
|
14
13
|
const handleSelect = () => {
|
|
15
14
|
};
|
|
16
|
-
const
|
|
15
|
+
const listView = useListView();
|
|
17
16
|
return /* @__PURE__ */ jsxs(
|
|
18
17
|
"div",
|
|
19
18
|
{
|
|
@@ -26,8 +25,8 @@ const CommonListItemView = (props) => {
|
|
|
26
25
|
"flex min-h-16 justify-start border p-4 text-left"
|
|
27
26
|
),
|
|
28
27
|
children: [
|
|
29
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxs(MtLink, { href: `${
|
|
30
|
-
|
|
28
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxs(MtLink, { href: `${listView.slugPath}/${item.id}`, children: [
|
|
29
|
+
listView.slugPath,
|
|
31
30
|
item.title || item.id,
|
|
32
31
|
item.description && /* @__PURE__ */ jsx("div", { children: item.description })
|
|
33
32
|
] }) }),
|
|
@@ -38,7 +37,7 @@ const CommonListItemView = (props) => {
|
|
|
38
37
|
};
|
|
39
38
|
const ListItemViewActions = (props) => {
|
|
40
39
|
const { id } = props;
|
|
41
|
-
const
|
|
40
|
+
const listView = useListView();
|
|
42
41
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
43
42
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
44
43
|
MtButton,
|
|
@@ -52,9 +51,9 @@ const ListItemViewActions = (props) => {
|
|
|
52
51
|
}
|
|
53
52
|
) }),
|
|
54
53
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[160px]", children: [
|
|
55
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${
|
|
56
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${
|
|
57
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${
|
|
54
|
+
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${listView.slugPath}/show`, children: "show" }),
|
|
55
|
+
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${listView.slugPath}/edit`, children: "edit" }),
|
|
56
|
+
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${listView.slugPath}/listdebug`, children: "list debug" }),
|
|
58
57
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
59
58
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
|
|
60
59
|
"Delete",
|
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useAtom } from "jotai";
|
|
4
3
|
import { MtLink } from "mtxuilib/common/mtlink";
|
|
5
4
|
import { cn } from "mtxuilib/lib/utils";
|
|
6
5
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
|
|
7
6
|
import { Icons } from "mtxuilib/icons/icons";
|
|
8
7
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
|
|
9
8
|
import { DropdownMenuItemLink } from "mtxuilib/ui/ui-mt/DropdownMenuItemLink";
|
|
10
|
-
import {
|
|
11
|
-
import { activateItemAtom, openCreatePanelAtom, openRemovePanelAtom, removeMethodSigAtom } from "../curd.atoms";
|
|
9
|
+
import { useListView } from "../CommonListViewV2";
|
|
12
10
|
const PostCardListItem = (props) => {
|
|
11
|
+
var _a;
|
|
13
12
|
const { item } = props;
|
|
14
|
-
const
|
|
15
|
-
const [curdSlugPath] = useAtom(curdSlugPathAtom);
|
|
13
|
+
const listView = useListView();
|
|
16
14
|
return /* @__PURE__ */ jsxs(
|
|
17
15
|
Card,
|
|
18
16
|
{
|
|
19
17
|
className: cn(
|
|
20
18
|
"m-2 w-[350px]",
|
|
21
|
-
item.id == (activateItem == null ? void 0 :
|
|
19
|
+
item.id == ((_a = listView.activateItem) == null ? void 0 : _a.id) && " p-2 shadow-md"
|
|
22
20
|
),
|
|
23
21
|
onClick: () => {
|
|
24
|
-
setActivateItem(item);
|
|
22
|
+
listView.setActivateItem(item);
|
|
25
23
|
},
|
|
26
24
|
children: [
|
|
27
25
|
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
28
|
-
/* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(MtLink, { href: `${
|
|
26
|
+
/* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(MtLink, { href: `${listView.slugPath}/${item.id}`, className: "pb-4 text-3xl font-bold hover:text-gray-700", children: item == null ? void 0 : item.title }) }),
|
|
29
27
|
/* @__PURE__ */ jsx(CardDescription, { children: "Deploy your new project in one-click." })
|
|
30
28
|
] }),
|
|
31
29
|
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("article", { className: "my-4 flex flex-col", children: [
|
|
32
30
|
/* @__PURE__ */ jsx(MtLink, {
|
|
33
|
-
href: `${
|
|
31
|
+
href: `${listView.slugPath}/${item.id}`,
|
|
34
32
|
className: "hover:opacity-75",
|
|
35
33
|
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
|
|
36
34
|
children: item.topImage && /* @__PURE__ */ jsx("img", { src: item.topImage, alt: item.title })
|
|
37
35
|
}),
|
|
38
36
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-start bg-white p-6", children: [
|
|
39
|
-
/* @__PURE__ */ jsx(MtLink, { href: `${
|
|
37
|
+
/* @__PURE__ */ jsx(MtLink, { href: `${listView.slugPath}/${item.id}`, className: "pb-4 text-sm font-bold uppercase text-blue-700", children: item.category || "news" }),
|
|
40
38
|
/* @__PURE__ */ jsxs("p", { className: "pb-3 text-sm", children: [
|
|
41
39
|
"By ",
|
|
42
40
|
/* @__PURE__ */ jsx(MtLink, { href: "#", children: item.author }),
|
|
@@ -46,7 +44,7 @@ const PostCardListItem = (props) => {
|
|
|
46
44
|
] })
|
|
47
45
|
] }) }),
|
|
48
46
|
/* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-end", children: [
|
|
49
|
-
/* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: `${
|
|
47
|
+
/* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: `${listView.slugPath}/${item.id}`, children: "Show" }),
|
|
50
48
|
/* @__PURE__ */ jsx(PostCardItemActions, { id: item.id })
|
|
51
49
|
] })
|
|
52
50
|
]
|
|
@@ -55,15 +53,12 @@ const PostCardListItem = (props) => {
|
|
|
55
53
|
};
|
|
56
54
|
const PostCardItemActions = (props) => {
|
|
57
55
|
const { id } = props;
|
|
58
|
-
const
|
|
59
|
-
const [deleteMethod] = useAtom(removeMethodSigAtom);
|
|
60
|
-
const [openRemovePanel, setOpenRemovePanel] = useAtom(openRemovePanelAtom);
|
|
61
|
-
const [openCreatePanel, setOpenCreatePanel] = useAtom(openCreatePanelAtom);
|
|
56
|
+
const listView = useListView();
|
|
62
57
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
63
58
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
64
59
|
MtLink,
|
|
65
60
|
{
|
|
66
|
-
href: `${
|
|
61
|
+
href: `${listView.slugPath}/${id}`,
|
|
67
62
|
variant: "ghost",
|
|
68
63
|
className: "data-[state=open]:bg-muted flex size-8 p-0",
|
|
69
64
|
children: [
|
|
@@ -77,18 +72,18 @@ const PostCardItemActions = (props) => {
|
|
|
77
72
|
DropdownMenuItem,
|
|
78
73
|
{
|
|
79
74
|
onClick: () => {
|
|
80
|
-
|
|
75
|
+
listView.setOpenCreate(true);
|
|
81
76
|
},
|
|
82
77
|
children: "create"
|
|
83
78
|
}
|
|
84
79
|
),
|
|
85
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${
|
|
86
|
-
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${
|
|
80
|
+
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${listView.slugPath}/create`, children: "create" }),
|
|
81
|
+
/* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `${listView.slugPath}/edit/${id}`, children: "edit" }),
|
|
87
82
|
/* @__PURE__ */ jsx(
|
|
88
83
|
DropdownMenuItem,
|
|
89
84
|
{
|
|
90
85
|
onClick: () => {
|
|
91
|
-
|
|
86
|
+
listView.setOpenRemove(true);
|
|
92
87
|
},
|
|
93
88
|
children: "remove"
|
|
94
89
|
}
|
|
@@ -11,6 +11,9 @@ export declare const LzDebugLayout: import("react").ComponentType<{
|
|
|
11
11
|
export declare const LzFrontLayout: import("react").ComponentType<{
|
|
12
12
|
children?: import("react").ReactNode;
|
|
13
13
|
}>;
|
|
14
|
+
export declare const LzHelloLazyLayout: import("react").ComponentType<{
|
|
15
|
+
children?: import("react").ReactNode;
|
|
16
|
+
}>;
|
|
14
17
|
export declare const layoutNameAtom: import("jotai").WritableAtom<string, [value: string], void>;
|
|
15
18
|
export declare const LayoutBase: (props: {
|
|
16
19
|
layoutName?: string;
|