@compill/admin 1.0.47 → 1.0.48
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 +229 -0
- package/index.esm.js +231 -3
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/layout/AdminLayout.d.ts +12 -0
- package/src/lib/layout/Content.d.ts +10 -0
- package/src/lib/layout/Menu.d.ts +33 -0
- package/src/lib/layout/Sidebar.d.ts +13 -0
package/index.cjs.js
CHANGED
|
@@ -85,6 +85,7 @@ function SectionTitle(_a) {
|
|
|
85
85
|
|
|
86
86
|
// Material Design Icons v7.4.47
|
|
87
87
|
var mdiArrowDownBoldBox = "M5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3M12,17L17,12H14V8H10V12H7L12,17Z";
|
|
88
|
+
var mdiArrowLeft = "M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z";
|
|
88
89
|
var mdiArrowUpBoldBox = "M19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21M12,7L7,12H10V16H14V12H17L12,7Z";
|
|
89
90
|
var mdiCircleSmall = "M12,10A2,2 0 0,0 10,12C10,13.11 10.9,14 12,14C13.11,14 14,13.11 14,12A2,2 0 0,0 12,10Z";
|
|
90
91
|
var mdiCloudUpload = "M11 20H6.5Q4.22 20 2.61 18.43 1 16.85 1 14.58 1 12.63 2.17 11.1 3.35 9.57 5.25 9.15 5.88 6.85 7.75 5.43 9.63 4 12 4 14.93 4 16.96 6.04 19 8.07 19 11 20.73 11.2 21.86 12.5 23 13.78 23 15.5 23 17.38 21.69 18.69 20.38 20 18.5 20H13V12.85L14.6 14.4L16 13L12 9L8 13L9.4 14.4L11 12.85Z";
|
|
@@ -2741,6 +2742,233 @@ function ScreenRenderer(_a) {
|
|
|
2741
2742
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2742
2743
|
}
|
|
2743
2744
|
|
|
2745
|
+
/**
|
|
2746
|
+
*
|
|
2747
|
+
*
|
|
2748
|
+
*/
|
|
2749
|
+
function Content(_a) {
|
|
2750
|
+
var props = __rest$1(_a, []);
|
|
2751
|
+
return jsxRuntime.jsx("div", Object.assign({
|
|
2752
|
+
w: "100%",
|
|
2753
|
+
h: "100%",
|
|
2754
|
+
overflowY: "auto"
|
|
2755
|
+
}, props, {
|
|
2756
|
+
children: jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
2757
|
+
}));
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
/**
|
|
2761
|
+
*
|
|
2762
|
+
*
|
|
2763
|
+
*/
|
|
2764
|
+
function Menu(_a) {
|
|
2765
|
+
var {
|
|
2766
|
+
darkMode,
|
|
2767
|
+
config
|
|
2768
|
+
} = _a,
|
|
2769
|
+
props = __rest$1(_a, ["darkMode", "config"]);
|
|
2770
|
+
return jsxRuntime.jsx("ul", Object.assign({}, props, {
|
|
2771
|
+
children: config.map((item, index) => {
|
|
2772
|
+
if (item.type == "divider") return jsxRuntime.jsx(Divider, {
|
|
2773
|
+
title: item.label
|
|
2774
|
+
}, index);
|
|
2775
|
+
if (item.type == "item") {
|
|
2776
|
+
return jsxRuntime.jsx(MenuItem, {
|
|
2777
|
+
icon: item.icon,
|
|
2778
|
+
path: item.path,
|
|
2779
|
+
depth: 0,
|
|
2780
|
+
darkMode: darkMode,
|
|
2781
|
+
subMenu: item.children,
|
|
2782
|
+
children: item.label
|
|
2783
|
+
}, index);
|
|
2784
|
+
}
|
|
2785
|
+
})
|
|
2786
|
+
}));
|
|
2787
|
+
}
|
|
2788
|
+
function Divider({
|
|
2789
|
+
title
|
|
2790
|
+
}) {
|
|
2791
|
+
return jsxRuntime.jsx("div", {
|
|
2792
|
+
px: "2",
|
|
2793
|
+
mt: "5",
|
|
2794
|
+
mb: "2",
|
|
2795
|
+
opacity: "75",
|
|
2796
|
+
textTransform: "capitalize",
|
|
2797
|
+
letterSpacing: "widest",
|
|
2798
|
+
fontWeight: "700",
|
|
2799
|
+
textSize: "xs",
|
|
2800
|
+
children: title
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
function MenuItem(_a) {
|
|
2804
|
+
var {
|
|
2805
|
+
icon,
|
|
2806
|
+
path,
|
|
2807
|
+
depth,
|
|
2808
|
+
darkMode,
|
|
2809
|
+
subMenu,
|
|
2810
|
+
children
|
|
2811
|
+
} = _a,
|
|
2812
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
|
2813
|
+
const match = reactRouterDom.useMatch("/" + path); // + "/*")
|
|
2814
|
+
const selected = match != null;
|
|
2815
|
+
return jsxRuntime.jsxs(reactRouterDom.Link, {
|
|
2816
|
+
to: path,
|
|
2817
|
+
style: {
|
|
2818
|
+
position: "relative"
|
|
2819
|
+
},
|
|
2820
|
+
children: [jsxRuntime.jsxs(ui.Button, Object.assign({
|
|
2821
|
+
as: "li",
|
|
2822
|
+
minH: "8",
|
|
2823
|
+
ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
|
|
2824
|
+
p: "2",
|
|
2825
|
+
font: "title",
|
|
2826
|
+
textColor: darkMode ? "white" : "black",
|
|
2827
|
+
fontWeight: "600",
|
|
2828
|
+
rounded: "lg",
|
|
2829
|
+
textSize: "sm",
|
|
2830
|
+
variant: "borderless",
|
|
2831
|
+
hover_bgColor: darkMode ? "white" : "black",
|
|
2832
|
+
hover_bgOpacity: "10",
|
|
2833
|
+
hover_textColor: darkMode ? "white" : "zinc-800",
|
|
2834
|
+
cursor: "pointer",
|
|
2835
|
+
dflex: true,
|
|
2836
|
+
alignItems: "center",
|
|
2837
|
+
gap: "3"
|
|
2838
|
+
}, props, {
|
|
2839
|
+
children: [icon && jsxRuntime.jsx(ui.Icon, {
|
|
2840
|
+
path: icon,
|
|
2841
|
+
opacity: selected ? "100" : "60"
|
|
2842
|
+
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsxRuntime.jsx(MenuItem, {
|
|
2843
|
+
icon: item.icon,
|
|
2844
|
+
path: item.path,
|
|
2845
|
+
depth: (depth !== null && depth !== void 0 ? depth : 0) + 1,
|
|
2846
|
+
darkMode: darkMode,
|
|
2847
|
+
subMenu: item.children,
|
|
2848
|
+
children: item.label
|
|
2849
|
+
}, index)), children]
|
|
2850
|
+
})), selected && jsxRuntime.jsx("div", {
|
|
2851
|
+
position: "absolute",
|
|
2852
|
+
bgColor: darkMode ? "white" : "black",
|
|
2853
|
+
bgOpacity: "90",
|
|
2854
|
+
w: "0.5",
|
|
2855
|
+
h: "6",
|
|
2856
|
+
top: "1.5",
|
|
2857
|
+
start: "-4"
|
|
2858
|
+
})]
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
function Sidebar(_a) {
|
|
2863
|
+
var {
|
|
2864
|
+
show,
|
|
2865
|
+
logo,
|
|
2866
|
+
title,
|
|
2867
|
+
menuConfig,
|
|
2868
|
+
color,
|
|
2869
|
+
darkMode
|
|
2870
|
+
} = _a,
|
|
2871
|
+
props = __rest$1(_a, ["show", "logo", "title", "menuConfig", "color", "darkMode"]);
|
|
2872
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
2873
|
+
w: "64",
|
|
2874
|
+
minH: "screen",
|
|
2875
|
+
p: "0",
|
|
2876
|
+
textColor: darkMode ? "white" : "slate-800"
|
|
2877
|
+
}, props, {
|
|
2878
|
+
children: [jsxRuntime.jsxs(components.FlexCenter, {
|
|
2879
|
+
placeContent: "start",
|
|
2880
|
+
p: "4",
|
|
2881
|
+
font: "title",
|
|
2882
|
+
gap: "3",
|
|
2883
|
+
borderB: "px",
|
|
2884
|
+
borderBColor: "slate-900",
|
|
2885
|
+
borderOpacity: "5",
|
|
2886
|
+
children: [logo, jsxRuntime.jsx("h1", {
|
|
2887
|
+
textSize: "md",
|
|
2888
|
+
children: title
|
|
2889
|
+
})]
|
|
2890
|
+
}), jsxRuntime.jsx(Menu, {
|
|
2891
|
+
overflowY: "auto",
|
|
2892
|
+
flexGrow: "1",
|
|
2893
|
+
p: "4",
|
|
2894
|
+
darkMode: darkMode,
|
|
2895
|
+
config: menuConfig
|
|
2896
|
+
})]
|
|
2897
|
+
}));
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2900
|
+
function Layout(_a) {
|
|
2901
|
+
var {
|
|
2902
|
+
color,
|
|
2903
|
+
darkMode,
|
|
2904
|
+
logo,
|
|
2905
|
+
title,
|
|
2906
|
+
menuConfig
|
|
2907
|
+
} = _a,
|
|
2908
|
+
props = __rest$1(_a, ["color", "darkMode", "logo", "title", "menuConfig"]);
|
|
2909
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
2910
|
+
w: "full",
|
|
2911
|
+
h: "screen",
|
|
2912
|
+
dflex: true,
|
|
2913
|
+
flexRow: true,
|
|
2914
|
+
bgColor: `${color}-${darkMode ? "900" : "100"}`
|
|
2915
|
+
}, props, {
|
|
2916
|
+
children: [jsxRuntime.jsx(LeftPanel, {
|
|
2917
|
+
color: color,
|
|
2918
|
+
darkMode: darkMode,
|
|
2919
|
+
logo: logo,
|
|
2920
|
+
title: title,
|
|
2921
|
+
menuConfig: menuConfig
|
|
2922
|
+
}), jsxRuntime.jsx("div", {
|
|
2923
|
+
w: "screen",
|
|
2924
|
+
py: "2",
|
|
2925
|
+
pe: "2",
|
|
2926
|
+
children: jsxRuntime.jsx(Content, {
|
|
2927
|
+
bgColor: "white",
|
|
2928
|
+
rounded: "lg",
|
|
2929
|
+
shadow: true
|
|
2930
|
+
})
|
|
2931
|
+
})]
|
|
2932
|
+
}));
|
|
2933
|
+
}
|
|
2934
|
+
function LeftPanel({
|
|
2935
|
+
color,
|
|
2936
|
+
darkMode,
|
|
2937
|
+
logo,
|
|
2938
|
+
title,
|
|
2939
|
+
menuConfig
|
|
2940
|
+
}) {
|
|
2941
|
+
const [isOpen, __, toggle] = hooks.useBoolean(true);
|
|
2942
|
+
useHotkeys('ctrl+t', () => toggle(), [toggle]);
|
|
2943
|
+
return jsxRuntime.jsxs("div", {
|
|
2944
|
+
ms: isOpen ? "0" : "-64",
|
|
2945
|
+
transition: "all",
|
|
2946
|
+
duration: "500",
|
|
2947
|
+
transform: true,
|
|
2948
|
+
children: [jsxRuntime.jsx(Sidebar, {
|
|
2949
|
+
flexShrink: "0",
|
|
2950
|
+
color: color,
|
|
2951
|
+
darkMode: darkMode,
|
|
2952
|
+
logo: logo,
|
|
2953
|
+
title: title,
|
|
2954
|
+
menuConfig: menuConfig
|
|
2955
|
+
}), jsxRuntime.jsx(ui.IconButton, {
|
|
2956
|
+
icon: mdiArrowLeft,
|
|
2957
|
+
transition: "all",
|
|
2958
|
+
duration: "500",
|
|
2959
|
+
transform: true,
|
|
2960
|
+
rotate: isOpen ? "0" : "180",
|
|
2961
|
+
position: "absolute",
|
|
2962
|
+
bottom: "14",
|
|
2963
|
+
end: "-5",
|
|
2964
|
+
size: "lg",
|
|
2965
|
+
corners: "pill",
|
|
2966
|
+
onClick: toggle,
|
|
2967
|
+
z: "100"
|
|
2968
|
+
})]
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2744
2972
|
const defaultErrorMsg$1 = "Oops, something went wrong...";
|
|
2745
2973
|
function AttachDialog(_a) {
|
|
2746
2974
|
var {
|
|
@@ -3368,6 +3596,7 @@ exports.DialogButton = DialogButton;
|
|
|
3368
3596
|
exports.FormActionDialog = FormActionDialog;
|
|
3369
3597
|
exports.InvalidateButton = InvalidateButton;
|
|
3370
3598
|
exports.ItemEditDialog = ItemEditDialog;
|
|
3599
|
+
exports.Layout = Layout;
|
|
3371
3600
|
exports.NavigateButton = NavigateButton;
|
|
3372
3601
|
exports.OrderCell = OrderCell;
|
|
3373
3602
|
exports.PageContainer = PageContainer;
|
package/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import Link from 'next/link';
|
|
|
4
4
|
import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
|
|
5
5
|
import { INVALIDATE_API } from '@compill/admin-api';
|
|
6
6
|
import { useApiMutation, useMutate, useInvalidateMutation, useApiQuery, useInvalidateQuery, useInvalidateParentMutation, useApiQueries } from '@compill/api';
|
|
7
|
-
import { useNavigate, useParams } from 'react-router-dom';
|
|
7
|
+
import { useNavigate, useParams, Outlet, useMatch, Link as Link$1 } from 'react-router-dom';
|
|
8
8
|
import { toast } from 'react-toastify';
|
|
9
9
|
import { SubmitButton, FormProvider, TextArea, FormRenderer, mergeInitialFormValues, FieldLabel } from '@compill/form';
|
|
10
10
|
import { useFormikContext, Field, Formik, Form } from 'formik';
|
|
@@ -15,7 +15,7 @@ import { Editor } from '@compill/editor';
|
|
|
15
15
|
import { PageSectionTitle as PageSectionTitle$1 } from '@compill/admin';
|
|
16
16
|
import { createPortal } from 'react-dom';
|
|
17
17
|
import { TableContextProvider, useTableContext, Table } from '@compill/table';
|
|
18
|
-
import { useOpenLink } from '@compill/hooks';
|
|
18
|
+
import { useOpenLink, useBoolean } from '@compill/hooks';
|
|
19
19
|
import { useQueryClient } from '@tanstack/react-query';
|
|
20
20
|
|
|
21
21
|
/******************************************************************************
|
|
@@ -76,6 +76,7 @@ function SectionTitle(_a) {
|
|
|
76
76
|
|
|
77
77
|
// Material Design Icons v7.4.47
|
|
78
78
|
var mdiArrowDownBoldBox = "M5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3M12,17L17,12H14V8H10V12H7L12,17Z";
|
|
79
|
+
var mdiArrowLeft = "M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z";
|
|
79
80
|
var mdiArrowUpBoldBox = "M19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21M12,7L7,12H10V16H14V12H17L12,7Z";
|
|
80
81
|
var mdiCircleSmall = "M12,10A2,2 0 0,0 10,12C10,13.11 10.9,14 12,14C13.11,14 14,13.11 14,12A2,2 0 0,0 12,10Z";
|
|
81
82
|
var mdiCloudUpload = "M11 20H6.5Q4.22 20 2.61 18.43 1 16.85 1 14.58 1 12.63 2.17 11.1 3.35 9.57 5.25 9.15 5.88 6.85 7.75 5.43 9.63 4 12 4 14.93 4 16.96 6.04 19 8.07 19 11 20.73 11.2 21.86 12.5 23 13.78 23 15.5 23 17.38 21.69 18.69 20.38 20 18.5 20H13V12.85L14.6 14.4L16 13L12 9L8 13L9.4 14.4L11 12.85Z";
|
|
@@ -2732,6 +2733,233 @@ function ScreenRenderer(_a) {
|
|
|
2732
2733
|
return jsx(Fragment, {});
|
|
2733
2734
|
}
|
|
2734
2735
|
|
|
2736
|
+
/**
|
|
2737
|
+
*
|
|
2738
|
+
*
|
|
2739
|
+
*/
|
|
2740
|
+
function Content(_a) {
|
|
2741
|
+
var props = __rest$1(_a, []);
|
|
2742
|
+
return jsx("div", Object.assign({
|
|
2743
|
+
w: "100%",
|
|
2744
|
+
h: "100%",
|
|
2745
|
+
overflowY: "auto"
|
|
2746
|
+
}, props, {
|
|
2747
|
+
children: jsx(Outlet, {})
|
|
2748
|
+
}));
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
/**
|
|
2752
|
+
*
|
|
2753
|
+
*
|
|
2754
|
+
*/
|
|
2755
|
+
function Menu(_a) {
|
|
2756
|
+
var {
|
|
2757
|
+
darkMode,
|
|
2758
|
+
config
|
|
2759
|
+
} = _a,
|
|
2760
|
+
props = __rest$1(_a, ["darkMode", "config"]);
|
|
2761
|
+
return jsx("ul", Object.assign({}, props, {
|
|
2762
|
+
children: config.map((item, index) => {
|
|
2763
|
+
if (item.type == "divider") return jsx(Divider, {
|
|
2764
|
+
title: item.label
|
|
2765
|
+
}, index);
|
|
2766
|
+
if (item.type == "item") {
|
|
2767
|
+
return jsx(MenuItem, {
|
|
2768
|
+
icon: item.icon,
|
|
2769
|
+
path: item.path,
|
|
2770
|
+
depth: 0,
|
|
2771
|
+
darkMode: darkMode,
|
|
2772
|
+
subMenu: item.children,
|
|
2773
|
+
children: item.label
|
|
2774
|
+
}, index);
|
|
2775
|
+
}
|
|
2776
|
+
})
|
|
2777
|
+
}));
|
|
2778
|
+
}
|
|
2779
|
+
function Divider({
|
|
2780
|
+
title
|
|
2781
|
+
}) {
|
|
2782
|
+
return jsx("div", {
|
|
2783
|
+
px: "2",
|
|
2784
|
+
mt: "5",
|
|
2785
|
+
mb: "2",
|
|
2786
|
+
opacity: "75",
|
|
2787
|
+
textTransform: "capitalize",
|
|
2788
|
+
letterSpacing: "widest",
|
|
2789
|
+
fontWeight: "700",
|
|
2790
|
+
textSize: "xs",
|
|
2791
|
+
children: title
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
function MenuItem(_a) {
|
|
2795
|
+
var {
|
|
2796
|
+
icon,
|
|
2797
|
+
path,
|
|
2798
|
+
depth,
|
|
2799
|
+
darkMode,
|
|
2800
|
+
subMenu,
|
|
2801
|
+
children
|
|
2802
|
+
} = _a,
|
|
2803
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
|
2804
|
+
const match = useMatch("/" + path); // + "/*")
|
|
2805
|
+
const selected = match != null;
|
|
2806
|
+
return jsxs(Link$1, {
|
|
2807
|
+
to: path,
|
|
2808
|
+
style: {
|
|
2809
|
+
position: "relative"
|
|
2810
|
+
},
|
|
2811
|
+
children: [jsxs(Button, Object.assign({
|
|
2812
|
+
as: "li",
|
|
2813
|
+
minH: "8",
|
|
2814
|
+
ms: `${(depth !== null && depth !== void 0 ? depth : 0) * 2}`,
|
|
2815
|
+
p: "2",
|
|
2816
|
+
font: "title",
|
|
2817
|
+
textColor: darkMode ? "white" : "black",
|
|
2818
|
+
fontWeight: "600",
|
|
2819
|
+
rounded: "lg",
|
|
2820
|
+
textSize: "sm",
|
|
2821
|
+
variant: "borderless",
|
|
2822
|
+
hover_bgColor: darkMode ? "white" : "black",
|
|
2823
|
+
hover_bgOpacity: "10",
|
|
2824
|
+
hover_textColor: darkMode ? "white" : "zinc-800",
|
|
2825
|
+
cursor: "pointer",
|
|
2826
|
+
dflex: true,
|
|
2827
|
+
alignItems: "center",
|
|
2828
|
+
gap: "3"
|
|
2829
|
+
}, props, {
|
|
2830
|
+
children: [icon && jsx(Icon, {
|
|
2831
|
+
path: icon,
|
|
2832
|
+
opacity: selected ? "100" : "60"
|
|
2833
|
+
}), subMenu === null || subMenu === void 0 ? void 0 : subMenu.map((item, index) => jsx(MenuItem, {
|
|
2834
|
+
icon: item.icon,
|
|
2835
|
+
path: item.path,
|
|
2836
|
+
depth: (depth !== null && depth !== void 0 ? depth : 0) + 1,
|
|
2837
|
+
darkMode: darkMode,
|
|
2838
|
+
subMenu: item.children,
|
|
2839
|
+
children: item.label
|
|
2840
|
+
}, index)), children]
|
|
2841
|
+
})), selected && jsx("div", {
|
|
2842
|
+
position: "absolute",
|
|
2843
|
+
bgColor: darkMode ? "white" : "black",
|
|
2844
|
+
bgOpacity: "90",
|
|
2845
|
+
w: "0.5",
|
|
2846
|
+
h: "6",
|
|
2847
|
+
top: "1.5",
|
|
2848
|
+
start: "-4"
|
|
2849
|
+
})]
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
function Sidebar(_a) {
|
|
2854
|
+
var {
|
|
2855
|
+
show,
|
|
2856
|
+
logo,
|
|
2857
|
+
title,
|
|
2858
|
+
menuConfig,
|
|
2859
|
+
color,
|
|
2860
|
+
darkMode
|
|
2861
|
+
} = _a,
|
|
2862
|
+
props = __rest$1(_a, ["show", "logo", "title", "menuConfig", "color", "darkMode"]);
|
|
2863
|
+
return jsxs("div", Object.assign({
|
|
2864
|
+
w: "64",
|
|
2865
|
+
minH: "screen",
|
|
2866
|
+
p: "0",
|
|
2867
|
+
textColor: darkMode ? "white" : "slate-800"
|
|
2868
|
+
}, props, {
|
|
2869
|
+
children: [jsxs(FlexCenter, {
|
|
2870
|
+
placeContent: "start",
|
|
2871
|
+
p: "4",
|
|
2872
|
+
font: "title",
|
|
2873
|
+
gap: "3",
|
|
2874
|
+
borderB: "px",
|
|
2875
|
+
borderBColor: "slate-900",
|
|
2876
|
+
borderOpacity: "5",
|
|
2877
|
+
children: [logo, jsx("h1", {
|
|
2878
|
+
textSize: "md",
|
|
2879
|
+
children: title
|
|
2880
|
+
})]
|
|
2881
|
+
}), jsx(Menu, {
|
|
2882
|
+
overflowY: "auto",
|
|
2883
|
+
flexGrow: "1",
|
|
2884
|
+
p: "4",
|
|
2885
|
+
darkMode: darkMode,
|
|
2886
|
+
config: menuConfig
|
|
2887
|
+
})]
|
|
2888
|
+
}));
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
function Layout(_a) {
|
|
2892
|
+
var {
|
|
2893
|
+
color,
|
|
2894
|
+
darkMode,
|
|
2895
|
+
logo,
|
|
2896
|
+
title,
|
|
2897
|
+
menuConfig
|
|
2898
|
+
} = _a,
|
|
2899
|
+
props = __rest$1(_a, ["color", "darkMode", "logo", "title", "menuConfig"]);
|
|
2900
|
+
return jsxs("div", Object.assign({
|
|
2901
|
+
w: "full",
|
|
2902
|
+
h: "screen",
|
|
2903
|
+
dflex: true,
|
|
2904
|
+
flexRow: true,
|
|
2905
|
+
bgColor: `${color}-${darkMode ? "900" : "100"}`
|
|
2906
|
+
}, props, {
|
|
2907
|
+
children: [jsx(LeftPanel, {
|
|
2908
|
+
color: color,
|
|
2909
|
+
darkMode: darkMode,
|
|
2910
|
+
logo: logo,
|
|
2911
|
+
title: title,
|
|
2912
|
+
menuConfig: menuConfig
|
|
2913
|
+
}), jsx("div", {
|
|
2914
|
+
w: "screen",
|
|
2915
|
+
py: "2",
|
|
2916
|
+
pe: "2",
|
|
2917
|
+
children: jsx(Content, {
|
|
2918
|
+
bgColor: "white",
|
|
2919
|
+
rounded: "lg",
|
|
2920
|
+
shadow: true
|
|
2921
|
+
})
|
|
2922
|
+
})]
|
|
2923
|
+
}));
|
|
2924
|
+
}
|
|
2925
|
+
function LeftPanel({
|
|
2926
|
+
color,
|
|
2927
|
+
darkMode,
|
|
2928
|
+
logo,
|
|
2929
|
+
title,
|
|
2930
|
+
menuConfig
|
|
2931
|
+
}) {
|
|
2932
|
+
const [isOpen, __, toggle] = useBoolean(true);
|
|
2933
|
+
useHotkeys('ctrl+t', () => toggle(), [toggle]);
|
|
2934
|
+
return jsxs("div", {
|
|
2935
|
+
ms: isOpen ? "0" : "-64",
|
|
2936
|
+
transition: "all",
|
|
2937
|
+
duration: "500",
|
|
2938
|
+
transform: true,
|
|
2939
|
+
children: [jsx(Sidebar, {
|
|
2940
|
+
flexShrink: "0",
|
|
2941
|
+
color: color,
|
|
2942
|
+
darkMode: darkMode,
|
|
2943
|
+
logo: logo,
|
|
2944
|
+
title: title,
|
|
2945
|
+
menuConfig: menuConfig
|
|
2946
|
+
}), jsx(IconButton, {
|
|
2947
|
+
icon: mdiArrowLeft,
|
|
2948
|
+
transition: "all",
|
|
2949
|
+
duration: "500",
|
|
2950
|
+
transform: true,
|
|
2951
|
+
rotate: isOpen ? "0" : "180",
|
|
2952
|
+
position: "absolute",
|
|
2953
|
+
bottom: "14",
|
|
2954
|
+
end: "-5",
|
|
2955
|
+
size: "lg",
|
|
2956
|
+
corners: "pill",
|
|
2957
|
+
onClick: toggle,
|
|
2958
|
+
z: "100"
|
|
2959
|
+
})]
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2735
2963
|
const defaultErrorMsg$1 = "Oops, something went wrong...";
|
|
2736
2964
|
function AttachDialog(_a) {
|
|
2737
2965
|
var {
|
|
@@ -3353,4 +3581,4 @@ function TableRowPublishPostButton(_a) {
|
|
|
3353
3581
|
}));
|
|
3354
3582
|
}
|
|
3355
3583
|
|
|
3356
|
-
export { AttachDialog, Breadcrumbs, DialogButton, FormActionDialog, InvalidateButton, 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, TableRowDeleteButton, TableRowEditButton, TableRowNavigateButton, TableRowPublishPostButton, TableRowViewButton, TableTopBar, UpdateButton, ViewButton };
|
|
3584
|
+
export { AttachDialog, Breadcrumbs, DialogButton, FormActionDialog, InvalidateButton, ItemEditDialog, Layout, NavigateButton, OrderCell, PageContainer, PageContentEditor, PageMain, PageQueryStateContainer, PageSectionTitle, PageSidebar, PageSidebarSection, PageStateContainer, PageSubSectionTitle, PageTabbedTopBar, PageTabbedTopBarProvider, PageTitle, PageTopBar, PageTopBarToolbar, PublishButton, ScreenRenderer, SectionTitle, StatusBadge, TableContainer, TableCreateButton, TableFilterButton, TableRowActionBar, TableRowDeleteButton, TableRowEditButton, TableRowNavigateButton, TableRowPublishPostButton, TableRowViewButton, TableTopBar, UpdateButton, ViewButton };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from "./lib/json/types/QueryWrapper";
|
|
|
16
16
|
export * from "./lib/json/types/QueryWrapperDialog";
|
|
17
17
|
export * from "./lib/json/types/MultiQueryWrapper";
|
|
18
18
|
export * from "./lib/json/ScreenRenderer";
|
|
19
|
+
export * from "./lib/layout/AdminLayout";
|
|
19
20
|
export * from "./lib/modal/AttachDialog";
|
|
20
21
|
export * from "./lib/modal/FormActionDialog";
|
|
21
22
|
export * from "./lib/modal/ItemEditDialog";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Color, ParentComponent, SoperioComponent } from "@soperio/react";
|
|
3
|
+
import { MenuConfig } from "./Menu";
|
|
4
|
+
interface LayoutProps extends SoperioComponent, ParentComponent {
|
|
5
|
+
color: Color;
|
|
6
|
+
darkMode?: boolean;
|
|
7
|
+
logo: React.ReactNode;
|
|
8
|
+
title: string;
|
|
9
|
+
menuConfig: MenuConfig;
|
|
10
|
+
}
|
|
11
|
+
export declare function Layout({ color, darkMode, logo, title, menuConfig, ...props }: LayoutProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SoperioComponent, ParentComponent } from "@soperio/react";
|
|
3
|
+
interface ContentProps extends SoperioComponent, ParentComponent {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export default function Content({ ...props }: ContentProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ParentComponent, SoperioComponent } from "@soperio/react";
|
|
3
|
+
interface MenuProps extends SoperioComponent, ParentComponent {
|
|
4
|
+
darkMode?: boolean;
|
|
5
|
+
config: MenuConfig;
|
|
6
|
+
}
|
|
7
|
+
export type MenuConfig = MenuItems;
|
|
8
|
+
type MenuItems = (MenuItem | MenuDivider)[];
|
|
9
|
+
type MenuItem = {
|
|
10
|
+
type: "item";
|
|
11
|
+
path: string;
|
|
12
|
+
icon?: string;
|
|
13
|
+
label: string;
|
|
14
|
+
children?: MenuItem[];
|
|
15
|
+
};
|
|
16
|
+
type MenuDivider = {
|
|
17
|
+
type: "divider";
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export default function Menu({ darkMode, config, ...props }: MenuProps): JSX.Element;
|
|
25
|
+
interface MenuItemProps extends SoperioComponent, ParentComponent {
|
|
26
|
+
path: string;
|
|
27
|
+
depth?: number;
|
|
28
|
+
icon?: string;
|
|
29
|
+
darkMode?: boolean;
|
|
30
|
+
subMenu?: MenuItem[];
|
|
31
|
+
}
|
|
32
|
+
declare function MenuItem({ icon, path, depth, darkMode, subMenu, children, ...props }: MenuItemProps): JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Color, ParentComponent, SoperioComponent } from "@soperio/react";
|
|
3
|
+
import { MenuConfig } from "./Menu";
|
|
4
|
+
interface SidebarProps extends SoperioComponent, ParentComponent {
|
|
5
|
+
show?: boolean;
|
|
6
|
+
color: Color;
|
|
7
|
+
darkMode?: boolean;
|
|
8
|
+
logo: React.ReactNode;
|
|
9
|
+
title: string;
|
|
10
|
+
menuConfig: MenuConfig;
|
|
11
|
+
}
|
|
12
|
+
export declare function Sidebar({ show, logo, title, menuConfig, color, darkMode, ...props }: SidebarProps): JSX.Element;
|
|
13
|
+
export {};
|