@compill/admin 1.0.61 → 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 +71 -46
- package/index.esm.js +70 -46
- 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.
|
@@ -2893,50 +2895,52 @@ function MenuItem(_a) {
|
|
2893
2895
|
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2894
2896
|
const match = reactRouterDom.useMatch("/" + path); // + "/*")
|
2895
2897
|
const selected = match != null;
|
2896
|
-
return jsxRuntime.jsxs(
|
2897
|
-
|
2898
|
-
|
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
|
-
darkMode:
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
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))]
|
2940
2944
|
});
|
2941
2945
|
}
|
2942
2946
|
|
@@ -2964,9 +2968,12 @@ function Sidebar(_a) {
|
|
2964
2968
|
borderB: "px",
|
2965
2969
|
borderBColor: "slate-900",
|
2966
2970
|
borderOpacity: "5",
|
2967
|
-
children: [logo
|
2971
|
+
children: [logo !== null && logo !== void 0 ? logo : jsxRuntime.jsx(Logo, {
|
2972
|
+
width: 40,
|
2973
|
+
height: 40
|
2974
|
+
}), jsxRuntime.jsx("h1", {
|
2968
2975
|
textSize: "md",
|
2969
|
-
children: title
|
2976
|
+
children: title !== null && title !== void 0 ? title : env.Env.appName()
|
2970
2977
|
})]
|
2971
2978
|
}), jsxRuntime.jsx(Menu, {
|
2972
2979
|
overflowY: "auto",
|
@@ -2977,6 +2984,24 @@ function Sidebar(_a) {
|
|
2977
2984
|
})]
|
2978
2985
|
}));
|
2979
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
|
+
}
|
2980
3005
|
|
2981
3006
|
function AdminLayout(_a) {
|
2982
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.
|
@@ -2884,50 +2885,52 @@ function MenuItem(_a) {
|
|
2884
2885
|
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2885
2886
|
const match = useMatch("/" + path); // + "/*")
|
2886
2887
|
const selected = match != null;
|
2887
|
-
return jsxs(
|
2888
|
-
|
2889
|
-
|
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
|
-
darkMode:
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
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))]
|
2931
2934
|
});
|
2932
2935
|
}
|
2933
2936
|
|
@@ -2955,9 +2958,12 @@ function Sidebar(_a) {
|
|
2955
2958
|
borderB: "px",
|
2956
2959
|
borderBColor: "slate-900",
|
2957
2960
|
borderOpacity: "5",
|
2958
|
-
children: [logo
|
2961
|
+
children: [logo !== null && logo !== void 0 ? logo : jsx(Logo, {
|
2962
|
+
width: 40,
|
2963
|
+
height: 40
|
2964
|
+
}), jsx("h1", {
|
2959
2965
|
textSize: "md",
|
2960
|
-
children: title
|
2966
|
+
children: title !== null && title !== void 0 ? title : Env.appName()
|
2961
2967
|
})]
|
2962
2968
|
}), jsx(Menu, {
|
2963
2969
|
overflowY: "auto",
|
@@ -2968,6 +2974,24 @@ function Sidebar(_a) {
|
|
2968
2974
|
})]
|
2969
2975
|
}));
|
2970
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
|
+
}
|
2971
2995
|
|
2972
2996
|
function AdminLayout(_a) {
|
2973
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 {};
|