gomtm 0.0.282 → 0.0.283
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/ListViewProvider.d.ts +5 -0
- package/dist/esm/curd/listview/ListViewProvider.js +4 -1
- package/dist/esm/curd/listview/MtListView.js +50 -3
- package/dist/esm/curd/listview/listview-layouts/default/index.d.ts +2 -0
- package/dist/esm/curd/listview/listview-layouts/default/index.js +12 -0
- package/dist/esm/curd/listview/listview-layouts/listviewlayout-demo/index.d.ts +2 -0
- package/dist/esm/curd/listview/listview-layouts/listviewlayout-demo/index.js +12 -0
- package/dist/esm/ly/LayoutBase.js +6 -5
- package/dist/esm/providers/GomtmProvider.d.ts +0 -2
- package/dist/esm/providers/GomtmProvider.js +2 -2
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -11,6 +11,7 @@ interface ListViewProps {
|
|
|
11
11
|
params?: any;
|
|
12
12
|
getParams?: any;
|
|
13
13
|
detailData?: any;
|
|
14
|
+
layout?: string;
|
|
14
15
|
}
|
|
15
16
|
export declare function ListViewProvider(props: ListViewProps & PropsWithChildren): import("react").JSX.Element;
|
|
16
17
|
export declare function useListView<I extends Message<I>, O extends Message<O>>(): {
|
|
@@ -24,6 +25,7 @@ export declare function useListView<I extends Message<I>, O extends Message<O>>(
|
|
|
24
25
|
params?: any;
|
|
25
26
|
getParams?: any;
|
|
26
27
|
detailData?: any;
|
|
28
|
+
layout?: string | undefined;
|
|
27
29
|
openRemove?: boolean | undefined;
|
|
28
30
|
setOpenRemove?: Dispatch<SetStateAction<boolean>> | undefined;
|
|
29
31
|
openCreate?: boolean | undefined;
|
|
@@ -35,6 +37,7 @@ export declare function useListView<I extends Message<I>, O extends Message<O>>(
|
|
|
35
37
|
setOpenDebug?: Dispatch<SetStateAction<boolean>> | undefined;
|
|
36
38
|
setParams?: Dispatch<any> | undefined;
|
|
37
39
|
setDetailData?: Dispatch<any> | undefined;
|
|
40
|
+
setLayout?: Dispatch<SetStateAction<string>> | undefined;
|
|
38
41
|
};
|
|
39
42
|
export declare function useDetail(): {
|
|
40
43
|
svc: string;
|
|
@@ -47,6 +50,7 @@ export declare function useDetail(): {
|
|
|
47
50
|
params?: any;
|
|
48
51
|
getParams?: any;
|
|
49
52
|
detailData?: any;
|
|
53
|
+
layout?: string | undefined;
|
|
50
54
|
openRemove: boolean;
|
|
51
55
|
setOpenRemove: Dispatch<SetStateAction<boolean>>;
|
|
52
56
|
openCreate: boolean;
|
|
@@ -58,6 +62,7 @@ export declare function useDetail(): {
|
|
|
58
62
|
setOpenDebug: Dispatch<SetStateAction<boolean>>;
|
|
59
63
|
setParams: Dispatch<any>;
|
|
60
64
|
setDetailData: Dispatch<any>;
|
|
65
|
+
setLayout: Dispatch<SetStateAction<string>>;
|
|
61
66
|
};
|
|
62
67
|
export declare function CommonListView<I extends Message<I>, O extends Message<O>>(): import("react").JSX.Element | null;
|
|
63
68
|
export declare const ListViewActions: () => import("react").JSX.Element;
|
|
@@ -64,6 +64,7 @@ function ListViewProvider(props) {
|
|
|
64
64
|
const [openDebug, setOpenDebug] = useState(false);
|
|
65
65
|
const [_params, _setParams] = useState(mtapp.globalSearchParams);
|
|
66
66
|
const [detailData, setDetailData] = useState(void 0);
|
|
67
|
+
const [layout, setLayout] = useState("default");
|
|
67
68
|
const params = useMemo(() => {
|
|
68
69
|
var _a;
|
|
69
70
|
return {
|
|
@@ -93,7 +94,9 @@ function ListViewProvider(props) {
|
|
|
93
94
|
params,
|
|
94
95
|
setParams,
|
|
95
96
|
detailData,
|
|
96
|
-
setDetailData
|
|
97
|
+
setDetailData,
|
|
98
|
+
layout,
|
|
99
|
+
setLayout
|
|
97
100
|
}, children });
|
|
98
101
|
}
|
|
99
102
|
function useListView() {
|
|
@@ -29,10 +29,22 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { jsx } from "react/jsx-runtime";
|
|
32
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
34
|
+
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
35
|
+
import { useState } from "react";
|
|
36
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
33
37
|
import { PrefetchConnectInfiniteQuery } from "../../components/SSR";
|
|
38
|
+
import { HOTKEY_Switchlayout } from "../../consts";
|
|
34
39
|
import { siteList } from "../../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
|
|
35
|
-
import { ListViewProvider } from "./ListViewProvider";
|
|
40
|
+
import { ListViewProvider, useListView } from "./ListViewProvider";
|
|
41
|
+
import { ListViewLayoutDefault } from "./listview-layouts/default";
|
|
42
|
+
import ListViewLayoutDemo from "./listview-layouts/listviewlayout-demo";
|
|
43
|
+
const ALL_Layouts = [
|
|
44
|
+
"demo",
|
|
45
|
+
"default",
|
|
46
|
+
"none"
|
|
47
|
+
];
|
|
36
48
|
function MtListView(props) {
|
|
37
49
|
const _a = props, { children } = _a, etc = __objRest(_a, ["children"]);
|
|
38
50
|
return /* @__PURE__ */ jsx(ListViewProvider, __spreadProps(__spreadValues({}, etc), { children: /* @__PURE__ */ jsx(
|
|
@@ -41,10 +53,45 @@ function MtListView(props) {
|
|
|
41
53
|
svc: siteList.service.typeName,
|
|
42
54
|
method: siteList.name,
|
|
43
55
|
input: etc.params,
|
|
44
|
-
children
|
|
56
|
+
children: /* @__PURE__ */ jsxs(ListViewLayout, { children: [
|
|
57
|
+
children,
|
|
58
|
+
/* @__PURE__ */ jsx(ListViewLayoutSwitch, {})
|
|
59
|
+
] })
|
|
45
60
|
}
|
|
46
61
|
) }));
|
|
47
62
|
}
|
|
63
|
+
const ListViewLayout = (props) => {
|
|
64
|
+
const listView = useListView();
|
|
65
|
+
const { children } = props;
|
|
66
|
+
return /* @__PURE__ */ jsx(Fragment, { children: listView.layout == "default" ? /* @__PURE__ */ jsxs(ListViewLayoutDefault, { children: [
|
|
67
|
+
" ",
|
|
68
|
+
children,
|
|
69
|
+
" "
|
|
70
|
+
] }) : listView.layout == "demo" ? /* @__PURE__ */ jsxs(ListViewLayoutDemo, { children: [
|
|
71
|
+
" ",
|
|
72
|
+
children,
|
|
73
|
+
" "
|
|
74
|
+
] }) : listView.layout == "none" ? /* @__PURE__ */ jsx(Fragment, { children }) : children });
|
|
75
|
+
};
|
|
76
|
+
const ListViewLayoutSwitch = () => {
|
|
77
|
+
const listview = useListView();
|
|
78
|
+
const [open, setOpen] = useState(false);
|
|
79
|
+
useHotkeys(HOTKEY_Switchlayout, () => {
|
|
80
|
+
setOpen((pre) => !pre);
|
|
81
|
+
}, [open, setOpen]);
|
|
82
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
83
|
+
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
84
|
+
"LayoutSwitch,",
|
|
85
|
+
listview.layout
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout) => {
|
|
88
|
+
return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
89
|
+
listview.setLayout(layout);
|
|
90
|
+
setOpen(false);
|
|
91
|
+
}, children: layout }, layout);
|
|
92
|
+
}) })
|
|
93
|
+
] }) });
|
|
94
|
+
};
|
|
48
95
|
export {
|
|
49
96
|
MtListView as default
|
|
50
97
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs } from "react/jsx-runtime";
|
|
3
|
+
const ListViewLayoutDefault = (props) => {
|
|
4
|
+
const { children } = props;
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-red-100 p-2", children: [
|
|
6
|
+
"ListViewLayoutDefault",
|
|
7
|
+
children
|
|
8
|
+
] });
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
ListViewLayoutDefault
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function ListViewLayoutDemo(props) {
|
|
4
|
+
const { children } = props;
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-blue-300 p-2", children: [
|
|
6
|
+
/* @__PURE__ */ jsx("h1", { children: "ListViewDemoLayout" }),
|
|
7
|
+
children
|
|
8
|
+
] });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
ListViewLayoutDemo as default
|
|
12
|
+
};
|
|
@@ -7,7 +7,7 @@ import { Dialog, DialogContent, DialogTitle } from "mtxuilib/ui/dialog";
|
|
|
7
7
|
import { TooltipProvider } from "mtxuilib/ui/tooltip";
|
|
8
8
|
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
9
9
|
import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
|
|
10
|
-
import { Suspense, lazy } from "react";
|
|
10
|
+
import { Suspense, lazy, useState } from "react";
|
|
11
11
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
12
12
|
import { Toaster } from "sonner";
|
|
13
13
|
import { HOTKEY_Switchlayout } from "../consts";
|
|
@@ -50,10 +50,11 @@ const LayoutBase = (props) => {
|
|
|
50
50
|
};
|
|
51
51
|
const LayoutSwitchDlg = () => {
|
|
52
52
|
const mtapp = useMtmApp();
|
|
53
|
+
const [open, setOpen] = useState(false);
|
|
53
54
|
useHotkeys(HOTKEY_Switchlayout, () => {
|
|
54
|
-
|
|
55
|
-
}, [
|
|
56
|
-
return /* @__PURE__ */ jsx(Dialog, { open
|
|
55
|
+
setOpen((pre) => !pre);
|
|
56
|
+
}, [open, setOpen]);
|
|
57
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
57
58
|
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
58
59
|
"LayoutSwitch,",
|
|
59
60
|
mtapp.layoutName
|
|
@@ -61,7 +62,7 @@ const LayoutSwitchDlg = () => {
|
|
|
61
62
|
/* @__PURE__ */ jsx("div", { className: "flex gap-2 bg-red-100 p-2", children: ALL_Layouts.map((layout) => {
|
|
62
63
|
return /* @__PURE__ */ jsx(MtButton, { onClick: () => {
|
|
63
64
|
mtapp.setLayoutName(layout);
|
|
64
|
-
|
|
65
|
+
setOpen(false);
|
|
65
66
|
}, children: layout }, layout);
|
|
66
67
|
}) })
|
|
67
68
|
] }) });
|
|
@@ -15,8 +15,6 @@ export declare function useMtmApp(): {
|
|
|
15
15
|
setIsDebug: Dispatch<SetStateAction<boolean>>;
|
|
16
16
|
setBackendUrl: Dispatch<SetStateAction<string | null | undefined>>;
|
|
17
17
|
setLayoutName: Dispatch<SetStateAction<string>>;
|
|
18
|
-
openLayoutSwitchDlg?: boolean | undefined;
|
|
19
|
-
setOpenLayoutSwitchDlg: Dispatch<SetStateAction<boolean>>;
|
|
20
18
|
setCookieStr: Dispatch<SetStateAction<string>>;
|
|
21
19
|
globalSearchParams?: any;
|
|
22
20
|
setGlobalSearchParams: Dispatch<any>;
|
|
@@ -54,8 +54,8 @@ function GomtmProvider(props) {
|
|
|
54
54
|
setBackendUrl,
|
|
55
55
|
layoutName: _layoutName,
|
|
56
56
|
setLayoutName,
|
|
57
|
-
openLayoutSwitchDlg,
|
|
58
|
-
setOpenLayoutSwitchDlg,
|
|
57
|
+
// openLayoutSwitchDlg: openLayoutSwitchDlg,
|
|
58
|
+
// setOpenLayoutSwitchDlg: setOpenLayoutSwitchDlg,
|
|
59
59
|
cookieStr: _cookieStr,
|
|
60
60
|
setCookieStr,
|
|
61
61
|
globalSearchParams,
|