@compill/admin 1.0.66 → 1.0.68
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/index.cjs.js +99 -34
- package/index.esm.js +99 -35
- package/package.json +1 -1
- package/src/lib/layout/Menu.d.ts +2 -1
package/index.cjs.js
CHANGED
@@ -2847,16 +2847,18 @@ function Content(_a) {
|
|
2847
2847
|
function Menu(_a) {
|
2848
2848
|
var {
|
2849
2849
|
darkMode,
|
2850
|
-
config
|
2850
|
+
config,
|
2851
|
+
useNextRouter
|
2851
2852
|
} = _a,
|
2852
|
-
props = __rest$1(_a, ["darkMode", "config"]);
|
2853
|
+
props = __rest$1(_a, ["darkMode", "config", "useNextRouter"]);
|
2854
|
+
const Comp = useNextRouter ? NextMenuItem : MenuItem;
|
2853
2855
|
return jsxRuntime.jsx("ul", Object.assign({}, props, {
|
2854
2856
|
children: config.map((item, index) => {
|
2855
2857
|
if (item.type == "divider") return jsxRuntime.jsx(Divider, {
|
2856
2858
|
title: item.label
|
2857
2859
|
}, index);
|
2858
2860
|
if (item.type == "item") {
|
2859
|
-
return jsxRuntime.jsx(
|
2861
|
+
return jsxRuntime.jsx(Comp, {
|
2860
2862
|
icon: item.icon,
|
2861
2863
|
path: item.path,
|
2862
2864
|
depth: 0,
|
@@ -2903,37 +2905,13 @@ function MenuItem(_a) {
|
|
2903
2905
|
style: {
|
2904
2906
|
position: "relative"
|
2905
2907
|
},
|
2906
|
-
children: [jsxRuntime.
|
2907
|
-
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
fontWeight: "600",
|
2914
|
-
rounded: "lg",
|
2915
|
-
textSize: "sm",
|
2916
|
-
variant: "borderless",
|
2917
|
-
hover_bgColor: darkMode ? "white" : "black",
|
2918
|
-
hover_bgOpacity: "10",
|
2919
|
-
hover_textColor: darkMode ? "white" : "zinc-800",
|
2920
|
-
cursor: "pointer",
|
2921
|
-
dflex: true,
|
2922
|
-
alignItems: "center",
|
2923
|
-
gap: "3"
|
2924
|
-
}, props, {
|
2925
|
-
children: [icon && jsxRuntime.jsx(ui.Icon, {
|
2926
|
-
path: icon,
|
2927
|
-
opacity: selected ? "100" : "60"
|
2928
|
-
}), children]
|
2929
|
-
})), match && jsxRuntime.jsx("div", {
|
2930
|
-
position: "absolute",
|
2931
|
-
bgColor: darkMode ? "white" : "black",
|
2932
|
-
bgOpacity: "90",
|
2933
|
-
w: "0.5",
|
2934
|
-
h: "6",
|
2935
|
-
top: "1.5",
|
2936
|
-
start: "-4"
|
2908
|
+
children: [jsxRuntime.jsx(MenuButton, Object.assign({
|
2909
|
+
depth: depth,
|
2910
|
+
darkMode: darkMode,
|
2911
|
+
icon: icon,
|
2912
|
+
selected: selected
|
2913
|
+
}, props)), match && jsxRuntime.jsx(SelectedIndicator, {
|
2914
|
+
darkMode: darkMode
|
2937
2915
|
})]
|
2938
2916
|
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsxRuntime.jsx(MenuItem, {
|
2939
2917
|
icon: item.icon,
|
@@ -2945,6 +2923,92 @@ function MenuItem(_a) {
|
|
2945
2923
|
}, index))]
|
2946
2924
|
});
|
2947
2925
|
}
|
2926
|
+
function NextMenuItem(_a) {
|
2927
|
+
var {
|
2928
|
+
icon,
|
2929
|
+
path,
|
2930
|
+
depth,
|
2931
|
+
darkMode,
|
2932
|
+
subMenu,
|
2933
|
+
children
|
2934
|
+
} = _a,
|
2935
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2936
|
+
const {
|
2937
|
+
pathname
|
2938
|
+
} = router.useRouter();
|
2939
|
+
const selected = path == "/" ? pathname == "/" : pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
|
2940
|
+
const match = path == "/" ? pathname == "/" : pathname == (path.startsWith("/") ? path : `/${path}`);
|
2941
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
2942
|
+
children: [jsxRuntime.jsxs(Link__default["default"], {
|
2943
|
+
href: path,
|
2944
|
+
style: {
|
2945
|
+
position: "relative"
|
2946
|
+
},
|
2947
|
+
children: [jsxRuntime.jsx(MenuButton, Object.assign({
|
2948
|
+
depth: depth,
|
2949
|
+
darkMode: darkMode,
|
2950
|
+
icon: icon,
|
2951
|
+
selected: selected
|
2952
|
+
}, props)), match && jsxRuntime.jsx(SelectedIndicator, {
|
2953
|
+
darkMode: darkMode
|
2954
|
+
})]
|
2955
|
+
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsxRuntime.jsx(MenuItem, {
|
2956
|
+
icon: item.icon,
|
2957
|
+
path: item.path,
|
2958
|
+
depth: (depth !== null && depth !== void 0 ? depth : 0) + 1,
|
2959
|
+
darkMode: darkMode,
|
2960
|
+
subMenu: item.children,
|
2961
|
+
children: item.label
|
2962
|
+
}, index))]
|
2963
|
+
});
|
2964
|
+
}
|
2965
|
+
function MenuButton(_a) {
|
2966
|
+
var {
|
2967
|
+
depth,
|
2968
|
+
darkMode,
|
2969
|
+
icon,
|
2970
|
+
selected,
|
2971
|
+
children
|
2972
|
+
} = _a,
|
2973
|
+
props = __rest$1(_a, ["depth", "darkMode", "icon", "selected", "children"]);
|
2974
|
+
return jsxRuntime.jsxs(ui.Button, Object.assign({
|
2975
|
+
as: "li",
|
2976
|
+
minH: "8",
|
2977
|
+
ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
|
2978
|
+
p: "2",
|
2979
|
+
font: "title",
|
2980
|
+
textColor: darkMode ? "white" : "black",
|
2981
|
+
fontWeight: "600",
|
2982
|
+
rounded: "lg",
|
2983
|
+
textSize: "sm",
|
2984
|
+
variant: "borderless",
|
2985
|
+
hover_bgColor: darkMode ? "white" : "black",
|
2986
|
+
hover_bgOpacity: "10",
|
2987
|
+
hover_textColor: darkMode ? "white" : "zinc-800",
|
2988
|
+
cursor: "pointer",
|
2989
|
+
dflex: true,
|
2990
|
+
alignItems: "center",
|
2991
|
+
gap: "3"
|
2992
|
+
}, props, {
|
2993
|
+
children: [icon && jsxRuntime.jsx(ui.Icon, {
|
2994
|
+
path: icon,
|
2995
|
+
opacity: selected ? "100" : "60"
|
2996
|
+
}), children]
|
2997
|
+
}));
|
2998
|
+
}
|
2999
|
+
function SelectedIndicator({
|
3000
|
+
darkMode
|
3001
|
+
}) {
|
3002
|
+
return jsxRuntime.jsx("div", {
|
3003
|
+
position: "absolute",
|
3004
|
+
bgColor: darkMode ? "white" : "black",
|
3005
|
+
bgOpacity: "90",
|
3006
|
+
w: "0.5",
|
3007
|
+
h: "6",
|
3008
|
+
top: "1.5",
|
3009
|
+
start: "-4"
|
3010
|
+
});
|
3011
|
+
}
|
2948
3012
|
|
2949
3013
|
function Sidebar(_a) {
|
2950
3014
|
var {
|
@@ -3574,6 +3638,7 @@ exports.FormActionDialog = FormActionDialog;
|
|
3574
3638
|
exports.InvalidateButton = InvalidateButton;
|
3575
3639
|
exports.ItemDeleteDialog = ItemDeleteDialog;
|
3576
3640
|
exports.ItemEditDialog = ItemEditDialog;
|
3641
|
+
exports.Menu = Menu;
|
3577
3642
|
exports.NavigateButton = NavigateButton;
|
3578
3643
|
exports.OrderCell = OrderCell;
|
3579
3644
|
exports.PageContainer = PageContainer;
|
package/index.esm.js
CHANGED
@@ -2837,16 +2837,18 @@ function Content(_a) {
|
|
2837
2837
|
function Menu(_a) {
|
2838
2838
|
var {
|
2839
2839
|
darkMode,
|
2840
|
-
config
|
2840
|
+
config,
|
2841
|
+
useNextRouter
|
2841
2842
|
} = _a,
|
2842
|
-
props = __rest$1(_a, ["darkMode", "config"]);
|
2843
|
+
props = __rest$1(_a, ["darkMode", "config", "useNextRouter"]);
|
2844
|
+
const Comp = useNextRouter ? NextMenuItem : MenuItem;
|
2843
2845
|
return jsx("ul", Object.assign({}, props, {
|
2844
2846
|
children: config.map((item, index) => {
|
2845
2847
|
if (item.type == "divider") return jsx(Divider, {
|
2846
2848
|
title: item.label
|
2847
2849
|
}, index);
|
2848
2850
|
if (item.type == "item") {
|
2849
|
-
return jsx(
|
2851
|
+
return jsx(Comp, {
|
2850
2852
|
icon: item.icon,
|
2851
2853
|
path: item.path,
|
2852
2854
|
depth: 0,
|
@@ -2893,37 +2895,13 @@ function MenuItem(_a) {
|
|
2893
2895
|
style: {
|
2894
2896
|
position: "relative"
|
2895
2897
|
},
|
2896
|
-
children: [
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
fontWeight: "600",
|
2904
|
-
rounded: "lg",
|
2905
|
-
textSize: "sm",
|
2906
|
-
variant: "borderless",
|
2907
|
-
hover_bgColor: darkMode ? "white" : "black",
|
2908
|
-
hover_bgOpacity: "10",
|
2909
|
-
hover_textColor: darkMode ? "white" : "zinc-800",
|
2910
|
-
cursor: "pointer",
|
2911
|
-
dflex: true,
|
2912
|
-
alignItems: "center",
|
2913
|
-
gap: "3"
|
2914
|
-
}, props, {
|
2915
|
-
children: [icon && jsx(Icon, {
|
2916
|
-
path: icon,
|
2917
|
-
opacity: selected ? "100" : "60"
|
2918
|
-
}), children]
|
2919
|
-
})), match && jsx("div", {
|
2920
|
-
position: "absolute",
|
2921
|
-
bgColor: darkMode ? "white" : "black",
|
2922
|
-
bgOpacity: "90",
|
2923
|
-
w: "0.5",
|
2924
|
-
h: "6",
|
2925
|
-
top: "1.5",
|
2926
|
-
start: "-4"
|
2898
|
+
children: [jsx(MenuButton, Object.assign({
|
2899
|
+
depth: depth,
|
2900
|
+
darkMode: darkMode,
|
2901
|
+
icon: icon,
|
2902
|
+
selected: selected
|
2903
|
+
}, props)), match && jsx(SelectedIndicator, {
|
2904
|
+
darkMode: darkMode
|
2927
2905
|
})]
|
2928
2906
|
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsx(MenuItem, {
|
2929
2907
|
icon: item.icon,
|
@@ -2935,6 +2913,92 @@ function MenuItem(_a) {
|
|
2935
2913
|
}, index))]
|
2936
2914
|
});
|
2937
2915
|
}
|
2916
|
+
function NextMenuItem(_a) {
|
2917
|
+
var {
|
2918
|
+
icon,
|
2919
|
+
path,
|
2920
|
+
depth,
|
2921
|
+
darkMode,
|
2922
|
+
subMenu,
|
2923
|
+
children
|
2924
|
+
} = _a,
|
2925
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2926
|
+
const {
|
2927
|
+
pathname
|
2928
|
+
} = useRouter();
|
2929
|
+
const selected = path == "/" ? pathname == "/" : pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
|
2930
|
+
const match = path == "/" ? pathname == "/" : pathname == (path.startsWith("/") ? path : `/${path}`);
|
2931
|
+
return jsxs(Fragment, {
|
2932
|
+
children: [jsxs(Link, {
|
2933
|
+
href: path,
|
2934
|
+
style: {
|
2935
|
+
position: "relative"
|
2936
|
+
},
|
2937
|
+
children: [jsx(MenuButton, Object.assign({
|
2938
|
+
depth: depth,
|
2939
|
+
darkMode: darkMode,
|
2940
|
+
icon: icon,
|
2941
|
+
selected: selected
|
2942
|
+
}, props)), match && jsx(SelectedIndicator, {
|
2943
|
+
darkMode: darkMode
|
2944
|
+
})]
|
2945
|
+
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsx(MenuItem, {
|
2946
|
+
icon: item.icon,
|
2947
|
+
path: item.path,
|
2948
|
+
depth: (depth !== null && depth !== void 0 ? depth : 0) + 1,
|
2949
|
+
darkMode: darkMode,
|
2950
|
+
subMenu: item.children,
|
2951
|
+
children: item.label
|
2952
|
+
}, index))]
|
2953
|
+
});
|
2954
|
+
}
|
2955
|
+
function MenuButton(_a) {
|
2956
|
+
var {
|
2957
|
+
depth,
|
2958
|
+
darkMode,
|
2959
|
+
icon,
|
2960
|
+
selected,
|
2961
|
+
children
|
2962
|
+
} = _a,
|
2963
|
+
props = __rest$1(_a, ["depth", "darkMode", "icon", "selected", "children"]);
|
2964
|
+
return jsxs(Button, Object.assign({
|
2965
|
+
as: "li",
|
2966
|
+
minH: "8",
|
2967
|
+
ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
|
2968
|
+
p: "2",
|
2969
|
+
font: "title",
|
2970
|
+
textColor: darkMode ? "white" : "black",
|
2971
|
+
fontWeight: "600",
|
2972
|
+
rounded: "lg",
|
2973
|
+
textSize: "sm",
|
2974
|
+
variant: "borderless",
|
2975
|
+
hover_bgColor: darkMode ? "white" : "black",
|
2976
|
+
hover_bgOpacity: "10",
|
2977
|
+
hover_textColor: darkMode ? "white" : "zinc-800",
|
2978
|
+
cursor: "pointer",
|
2979
|
+
dflex: true,
|
2980
|
+
alignItems: "center",
|
2981
|
+
gap: "3"
|
2982
|
+
}, props, {
|
2983
|
+
children: [icon && jsx(Icon, {
|
2984
|
+
path: icon,
|
2985
|
+
opacity: selected ? "100" : "60"
|
2986
|
+
}), children]
|
2987
|
+
}));
|
2988
|
+
}
|
2989
|
+
function SelectedIndicator({
|
2990
|
+
darkMode
|
2991
|
+
}) {
|
2992
|
+
return jsx("div", {
|
2993
|
+
position: "absolute",
|
2994
|
+
bgColor: darkMode ? "white" : "black",
|
2995
|
+
bgOpacity: "90",
|
2996
|
+
w: "0.5",
|
2997
|
+
h: "6",
|
2998
|
+
top: "1.5",
|
2999
|
+
start: "-4"
|
3000
|
+
});
|
3001
|
+
}
|
2938
3002
|
|
2939
3003
|
function Sidebar(_a) {
|
2940
3004
|
var {
|
@@ -3553,4 +3617,4 @@ function TableRowPublishPostButton(_a) {
|
|
3553
3617
|
}, props));
|
3554
3618
|
}
|
3555
3619
|
|
3556
|
-
export { AdminLayout, AttachDialog, Breadcrumbs, ButtonBar, ButtonBarButton, ButtonBarDialogButton, DialogButton, FormActionDialog, InvalidateButton, ItemDeleteDialog, ItemEditDialog, NavigateButton, OrderCell, PageContainer, PageContentEditor, PageMain, PageQueryStateContainer, PageSectionTitle, PageSidebar, PageSidebarSection, PageStateContainer, PageSubSectionTitle, PageTabbedTopBar, PageTabbedTopBarProvider, PageTitle, PageTopBar, PageTopBarToolbar, PublishButton, ScreenRenderer, SectionTitle, StatusBadge, TableContainer, TableCreateButton, TableFilterButton, TableRowActionBar, TableRowActionButton, TableRowActionDialogButton, TableRowDeleteButton, TableRowEditButton, TableRowNavigateButton, TableRowPublishPostButton, TableRowViewButton, TableTopBar, UpdateButton, ViewButton };
|
3620
|
+
export { AdminLayout, AttachDialog, Breadcrumbs, ButtonBar, ButtonBarButton, ButtonBarDialogButton, DialogButton, FormActionDialog, InvalidateButton, ItemDeleteDialog, ItemEditDialog, Menu, NavigateButton, OrderCell, PageContainer, PageContentEditor, PageMain, PageQueryStateContainer, PageSectionTitle, PageSidebar, PageSidebarSection, PageStateContainer, PageSubSectionTitle, PageTabbedTopBar, PageTabbedTopBarProvider, PageTitle, PageTopBar, PageTopBarToolbar, PublishButton, ScreenRenderer, SectionTitle, StatusBadge, TableContainer, TableCreateButton, TableFilterButton, TableRowActionBar, TableRowActionButton, TableRowActionDialogButton, TableRowDeleteButton, TableRowEditButton, TableRowNavigateButton, TableRowPublishPostButton, TableRowViewButton, TableTopBar, UpdateButton, ViewButton };
|
package/package.json
CHANGED
package/src/lib/layout/Menu.d.ts
CHANGED
@@ -3,6 +3,7 @@ import { ParentComponent, SoperioComponent } from "@soperio/react";
|
|
3
3
|
export interface MenuProps extends SoperioComponent, ParentComponent {
|
4
4
|
darkMode?: boolean;
|
5
5
|
config: MenuConfig;
|
6
|
+
useNextRouter?: boolean;
|
6
7
|
}
|
7
8
|
export type MenuConfig = MenuItems;
|
8
9
|
type MenuItems = (MenuItem | MenuDivider)[];
|
@@ -21,5 +22,5 @@ export type MenuDivider = {
|
|
21
22
|
*
|
22
23
|
*
|
23
24
|
*/
|
24
|
-
export
|
25
|
+
export declare function Menu({ darkMode, config, useNextRouter, ...props }: MenuProps): JSX.Element;
|
25
26
|
export {};
|