@compill/admin 1.0.60 → 1.0.62
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 +72 -49
- package/index.esm.js +71 -49
- package/package.json +1 -1
- package/src/lib/layout/AdminLayout.d.ts +2 -2
- package/src/lib/layout/Sidebar.d.ts +8 -2
package/index.cjs.js
CHANGED
@@ -23,11 +23,13 @@ var hooks = require('@compill/hooks');
|
|
23
23
|
var env = require('@compill/env');
|
24
24
|
var router = require('next/router');
|
25
25
|
var reactQuery = require('@tanstack/react-query');
|
26
|
+
var Image = require('next/image');
|
26
27
|
|
27
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
28
29
|
|
29
30
|
var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
|
30
31
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
32
|
+
var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
|
31
33
|
|
32
34
|
/******************************************************************************
|
33
35
|
Copyright (c) Microsoft Corporation.
|
@@ -1051,9 +1053,7 @@ function PageTopBarToolbar({
|
|
1051
1053
|
if (!portal || !host) return;
|
1052
1054
|
try {
|
1053
1055
|
if (visible) host.appendChild(portal);else host.removeChild(portal);
|
1054
|
-
} catch (e) {
|
1055
|
-
// console.log(e)
|
1056
|
-
}
|
1056
|
+
} catch (e) {}
|
1057
1057
|
return () => {
|
1058
1058
|
try {
|
1059
1059
|
host.removeChild(portal);
|
@@ -2895,50 +2895,52 @@ function MenuItem(_a) {
|
|
2895
2895
|
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2896
2896
|
const match = reactRouterDom.useMatch("/" + path); // + "/*")
|
2897
2897
|
const selected = match != null;
|
2898
|
-
return jsxRuntime.jsxs(
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
darkMode:
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2898
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
2899
|
+
children: [jsxRuntime.jsxs(reactRouterDom.Link, {
|
2900
|
+
to: path,
|
2901
|
+
style: {
|
2902
|
+
position: "relative"
|
2903
|
+
},
|
2904
|
+
children: [jsxRuntime.jsxs(ui.Button, Object.assign({
|
2905
|
+
as: "li",
|
2906
|
+
minH: "8",
|
2907
|
+
ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
|
2908
|
+
p: "2",
|
2909
|
+
font: "title",
|
2910
|
+
textColor: darkMode ? "white" : "black",
|
2911
|
+
fontWeight: "600",
|
2912
|
+
rounded: "lg",
|
2913
|
+
textSize: "sm",
|
2914
|
+
variant: "borderless",
|
2915
|
+
hover_bgColor: darkMode ? "white" : "black",
|
2916
|
+
hover_bgOpacity: "10",
|
2917
|
+
hover_textColor: darkMode ? "white" : "zinc-800",
|
2918
|
+
cursor: "pointer",
|
2919
|
+
dflex: true,
|
2920
|
+
alignItems: "center",
|
2921
|
+
gap: "3"
|
2922
|
+
}, props, {
|
2923
|
+
children: [icon && jsxRuntime.jsx(ui.Icon, {
|
2924
|
+
path: icon,
|
2925
|
+
opacity: selected ? "100" : "60"
|
2926
|
+
}), children]
|
2927
|
+
})), selected && jsxRuntime.jsx("div", {
|
2928
|
+
position: "absolute",
|
2929
|
+
bgColor: darkMode ? "white" : "black",
|
2930
|
+
bgOpacity: "90",
|
2931
|
+
w: "0.5",
|
2932
|
+
h: "6",
|
2933
|
+
top: "1.5",
|
2934
|
+
start: "-4"
|
2935
|
+
})]
|
2936
|
+
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsxRuntime.jsx(MenuItem, {
|
2937
|
+
icon: item.icon,
|
2938
|
+
path: item.path,
|
2939
|
+
depth: (depth !== null && depth !== void 0 ? depth : 0) + 1,
|
2940
|
+
darkMode: darkMode,
|
2941
|
+
subMenu: item.children,
|
2942
|
+
children: item.label
|
2943
|
+
}, index))]
|
2942
2944
|
});
|
2943
2945
|
}
|
2944
2946
|
|
@@ -2966,9 +2968,12 @@ function Sidebar(_a) {
|
|
2966
2968
|
borderB: "px",
|
2967
2969
|
borderBColor: "slate-900",
|
2968
2970
|
borderOpacity: "5",
|
2969
|
-
children: [logo
|
2971
|
+
children: [logo !== null && logo !== void 0 ? logo : jsxRuntime.jsx(Logo, {
|
2972
|
+
width: 40,
|
2973
|
+
height: 40
|
2974
|
+
}), jsxRuntime.jsx("h1", {
|
2970
2975
|
textSize: "md",
|
2971
|
-
children: title
|
2976
|
+
children: title !== null && title !== void 0 ? title : env.Env.appName()
|
2972
2977
|
})]
|
2973
2978
|
}), jsxRuntime.jsx(Menu, {
|
2974
2979
|
overflowY: "auto",
|
@@ -2979,6 +2984,24 @@ function Sidebar(_a) {
|
|
2979
2984
|
})]
|
2980
2985
|
}));
|
2981
2986
|
}
|
2987
|
+
function Logo(_a) {
|
2988
|
+
var {
|
2989
|
+
width,
|
2990
|
+
height,
|
2991
|
+
darkMode
|
2992
|
+
} = _a,
|
2993
|
+
props = __rest$1(_a, ["width", "height", "darkMode"]);
|
2994
|
+
return jsxRuntime.jsx("div", Object.assign({}, props, {
|
2995
|
+
children: jsxRuntime.jsx(Image__default["default"], {
|
2996
|
+
src: `/logo_${darkMode ? "light" : "dark"}.png`,
|
2997
|
+
alt: env.Env.appName(),
|
2998
|
+
width: width,
|
2999
|
+
height: height,
|
3000
|
+
priority: true,
|
3001
|
+
unoptimized: true
|
3002
|
+
})
|
3003
|
+
}));
|
3004
|
+
}
|
2982
3005
|
|
2983
3006
|
function AdminLayout(_a) {
|
2984
3007
|
var {
|
package/index.esm.js
CHANGED
@@ -19,6 +19,7 @@ import { useOpenLink, useBoolean } from '@compill/hooks';
|
|
19
19
|
import { Env } from '@compill/env';
|
20
20
|
import { useRouter } from 'next/router';
|
21
21
|
import { useQueryClient } from '@tanstack/react-query';
|
22
|
+
import Image from 'next/image';
|
22
23
|
|
23
24
|
/******************************************************************************
|
24
25
|
Copyright (c) Microsoft Corporation.
|
@@ -1042,9 +1043,7 @@ function PageTopBarToolbar({
|
|
1042
1043
|
if (!portal || !host) return;
|
1043
1044
|
try {
|
1044
1045
|
if (visible) host.appendChild(portal);else host.removeChild(portal);
|
1045
|
-
} catch (e) {
|
1046
|
-
// console.log(e)
|
1047
|
-
}
|
1046
|
+
} catch (e) {}
|
1048
1047
|
return () => {
|
1049
1048
|
try {
|
1050
1049
|
host.removeChild(portal);
|
@@ -2886,50 +2885,52 @@ function MenuItem(_a) {
|
|
2886
2885
|
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2887
2886
|
const match = useMatch("/" + path); // + "/*")
|
2888
2887
|
const selected = match != null;
|
2889
|
-
return jsxs(
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
darkMode:
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2888
|
+
return jsxs(Fragment, {
|
2889
|
+
children: [jsxs(Link$1, {
|
2890
|
+
to: path,
|
2891
|
+
style: {
|
2892
|
+
position: "relative"
|
2893
|
+
},
|
2894
|
+
children: [jsxs(Button, Object.assign({
|
2895
|
+
as: "li",
|
2896
|
+
minH: "8",
|
2897
|
+
ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
|
2898
|
+
p: "2",
|
2899
|
+
font: "title",
|
2900
|
+
textColor: darkMode ? "white" : "black",
|
2901
|
+
fontWeight: "600",
|
2902
|
+
rounded: "lg",
|
2903
|
+
textSize: "sm",
|
2904
|
+
variant: "borderless",
|
2905
|
+
hover_bgColor: darkMode ? "white" : "black",
|
2906
|
+
hover_bgOpacity: "10",
|
2907
|
+
hover_textColor: darkMode ? "white" : "zinc-800",
|
2908
|
+
cursor: "pointer",
|
2909
|
+
dflex: true,
|
2910
|
+
alignItems: "center",
|
2911
|
+
gap: "3"
|
2912
|
+
}, props, {
|
2913
|
+
children: [icon && jsx(Icon, {
|
2914
|
+
path: icon,
|
2915
|
+
opacity: selected ? "100" : "60"
|
2916
|
+
}), children]
|
2917
|
+
})), selected && jsx("div", {
|
2918
|
+
position: "absolute",
|
2919
|
+
bgColor: darkMode ? "white" : "black",
|
2920
|
+
bgOpacity: "90",
|
2921
|
+
w: "0.5",
|
2922
|
+
h: "6",
|
2923
|
+
top: "1.5",
|
2924
|
+
start: "-4"
|
2925
|
+
})]
|
2926
|
+
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsx(MenuItem, {
|
2927
|
+
icon: item.icon,
|
2928
|
+
path: item.path,
|
2929
|
+
depth: (depth !== null && depth !== void 0 ? depth : 0) + 1,
|
2930
|
+
darkMode: darkMode,
|
2931
|
+
subMenu: item.children,
|
2932
|
+
children: item.label
|
2933
|
+
}, index))]
|
2933
2934
|
});
|
2934
2935
|
}
|
2935
2936
|
|
@@ -2957,9 +2958,12 @@ function Sidebar(_a) {
|
|
2957
2958
|
borderB: "px",
|
2958
2959
|
borderBColor: "slate-900",
|
2959
2960
|
borderOpacity: "5",
|
2960
|
-
children: [logo
|
2961
|
+
children: [logo !== null && logo !== void 0 ? logo : jsx(Logo, {
|
2962
|
+
width: 40,
|
2963
|
+
height: 40
|
2964
|
+
}), jsx("h1", {
|
2961
2965
|
textSize: "md",
|
2962
|
-
children: title
|
2966
|
+
children: title !== null && title !== void 0 ? title : Env.appName()
|
2963
2967
|
})]
|
2964
2968
|
}), jsx(Menu, {
|
2965
2969
|
overflowY: "auto",
|
@@ -2970,6 +2974,24 @@ function Sidebar(_a) {
|
|
2970
2974
|
})]
|
2971
2975
|
}));
|
2972
2976
|
}
|
2977
|
+
function Logo(_a) {
|
2978
|
+
var {
|
2979
|
+
width,
|
2980
|
+
height,
|
2981
|
+
darkMode
|
2982
|
+
} = _a,
|
2983
|
+
props = __rest$1(_a, ["width", "height", "darkMode"]);
|
2984
|
+
return jsx("div", Object.assign({}, props, {
|
2985
|
+
children: jsx(Image, {
|
2986
|
+
src: `/logo_${darkMode ? "light" : "dark"}.png`,
|
2987
|
+
alt: Env.appName(),
|
2988
|
+
width: width,
|
2989
|
+
height: height,
|
2990
|
+
priority: true,
|
2991
|
+
unoptimized: true
|
2992
|
+
})
|
2993
|
+
}));
|
2994
|
+
}
|
2973
2995
|
|
2974
2996
|
function AdminLayout(_a) {
|
2975
2997
|
var {
|
package/package.json
CHANGED
@@ -4,8 +4,8 @@ import { MenuConfig } from "./Menu";
|
|
4
4
|
interface LayoutProps extends SoperioComponent, ParentComponent {
|
5
5
|
color: Color;
|
6
6
|
darkMode?: boolean;
|
7
|
-
logo
|
8
|
-
title
|
7
|
+
logo?: React.ReactNode;
|
8
|
+
title?: string;
|
9
9
|
menuConfig: MenuConfig;
|
10
10
|
}
|
11
11
|
export declare function AdminLayout({ color, darkMode, logo, title, menuConfig, ...props }: LayoutProps): JSX.Element;
|
@@ -5,9 +5,15 @@ interface SidebarProps extends SoperioComponent, ParentComponent {
|
|
5
5
|
show?: boolean;
|
6
6
|
color: Color;
|
7
7
|
darkMode?: boolean;
|
8
|
-
logo
|
9
|
-
title
|
8
|
+
logo?: React.ReactNode;
|
9
|
+
title?: string;
|
10
10
|
menuConfig: MenuConfig;
|
11
11
|
}
|
12
12
|
export declare function Sidebar({ show, logo, title, menuConfig, color, darkMode, ...props }: SidebarProps): JSX.Element;
|
13
|
+
interface LogoProps extends SoperioComponent, ParentComponent {
|
14
|
+
width: number;
|
15
|
+
height: number;
|
16
|
+
darkMode?: boolean;
|
17
|
+
}
|
18
|
+
export default function Logo({ width, height, darkMode, ...props }: LogoProps): JSX.Element;
|
13
19
|
export {};
|