@pdg/react-admin-layout 1.0.17 → 1.0.19
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/README.md +1 -1
- package/dist/index.esm.js +26 -46
- package/dist/index.js +28 -48
- package/package.json +2 -1
- package/dist/@util/compare.d.ts +0 -4
- package/dist/@util/index.d.ts +0 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Admin Layout for React
|
|
|
4
4
|
|
|
5
5
|
## 설치
|
|
6
6
|
```
|
|
7
|
-
npm install -D @pdg/react-admin-layout @mui/material @mui/icons-material @emotion/react @emotion/styled simplebar-react
|
|
7
|
+
npm install -D @pdg/react-admin-layout @mui/material @mui/icons-material @emotion/react @emotion/styled @pdg/util simplebar-react
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
### index.html 에 추가
|
package/dist/index.esm.js
CHANGED
|
@@ -1,55 +1,11 @@
|
|
|
1
|
-
import {Grid,useTheme,alpha,ListItemButton,ListItemIcon,Icon,ListItemText,Badge,Collapse,styled,List,Box,Toolbar,Typography,AppBar,Drawer,IconButton}from'@mui/material';import React,{useState,useEffect,useCallback,useMemo}from'react';import {useLocation}from'react-router-dom';import {ExpandMore,Menu}from'@mui/icons-material';import SimpleBar from'simplebar-react';var CardLayoutDefaultProps = {
|
|
1
|
+
import {Grid,useTheme,alpha,ListItemButton,ListItemIcon,Icon,ListItemText,Badge,Collapse,styled,List,Box,Toolbar,Typography,AppBar,Drawer,IconButton}from'@mui/material';import React,{useState,useEffect,useCallback,useMemo}from'react';import {useLocation}from'react-router-dom';import {ExpandMore,Menu}from'@mui/icons-material';import {notEmpty,empty}from'@pdg/util';import SimpleBar from'simplebar-react';var CardLayoutDefaultProps = {
|
|
2
2
|
backgroundColor: '#eff3f8',
|
|
3
3
|
};var CardLayout = function (_a) {
|
|
4
4
|
var children = _a.children, backgroundColor = _a.backgroundColor;
|
|
5
5
|
return (React.createElement(Grid, { container: true, direction: 'column', alignItems: 'center', justifyContent: 'center', style: { minHeight: '100vh', backgroundColor: backgroundColor } },
|
|
6
6
|
React.createElement(Grid, { item: true, xs: 12 }, children)));
|
|
7
7
|
};
|
|
8
|
-
CardLayout.defaultProps = CardLayoutDefaultProps
|
|
9
|
-
Copyright (c) Microsoft Corporation.
|
|
10
|
-
|
|
11
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
-
purpose with or without fee is hereby granted.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */
|
|
22
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function __makeTemplateObject(cooked, raw) {
|
|
26
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
27
|
-
return cooked;
|
|
28
|
-
}
|
|
29
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
30
|
-
var e = new Error(message);
|
|
31
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
32
|
-
};var empty = function (v) {
|
|
33
|
-
var result = false;
|
|
34
|
-
if (v == null) {
|
|
35
|
-
result = true;
|
|
36
|
-
}
|
|
37
|
-
else if (typeof v === 'string') {
|
|
38
|
-
result = v === '';
|
|
39
|
-
}
|
|
40
|
-
else if (typeof v === 'object') {
|
|
41
|
-
if (Array.isArray(v)) {
|
|
42
|
-
result = v.length === 0;
|
|
43
|
-
}
|
|
44
|
-
else if (!(v instanceof Date)) {
|
|
45
|
-
result = Object.entries(v).length === 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return result;
|
|
49
|
-
};
|
|
50
|
-
var notEmpty = function (v) {
|
|
51
|
-
return !empty(v);
|
|
52
|
-
};var SideMenuListItem = function (_a) {
|
|
8
|
+
CardLayout.defaultProps = CardLayoutDefaultProps;var SideMenuListItem = function (_a) {
|
|
53
9
|
var info = _a.info, badgeVariant = _a.badgeVariant, onClick = _a.onClick;
|
|
54
10
|
var theme = useTheme();
|
|
55
11
|
var location = useLocation();
|
|
@@ -149,6 +105,30 @@ var notEmpty = function (v) {
|
|
|
149
105
|
React.createElement(Collapse, { in: isExpand, style: collapseStyle }, isExpandable &&
|
|
150
106
|
info.items &&
|
|
151
107
|
info.items.map(function (subInfo, idx) { return (React.createElement(SideMenuListItem, { key: idx, badgeVariant: badgeVariant, info: subInfo, onClick: onClick })); }))));
|
|
108
|
+
};/******************************************************************************
|
|
109
|
+
Copyright (c) Microsoft Corporation.
|
|
110
|
+
|
|
111
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
112
|
+
purpose with or without fee is hereby granted.
|
|
113
|
+
|
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
115
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
116
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
117
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
118
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
119
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
120
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
121
|
+
***************************************************************************** */
|
|
122
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
function __makeTemplateObject(cooked, raw) {
|
|
126
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
127
|
+
return cooked;
|
|
128
|
+
}
|
|
129
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
130
|
+
var e = new Error(message);
|
|
131
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
152
132
|
};var StyledList = styled(List)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n padding: 0;\n"], ["\n padding: 0;\n"])));
|
|
153
133
|
var templateObject_1$3;var SideMenuList = function (_a) {
|
|
154
134
|
var list = _a.list, badgeVariant = _a.badgeVariant, onClick = _a.onClick;
|
package/dist/index.js
CHANGED
|
@@ -1,55 +1,11 @@
|
|
|
1
|
-
'use strict';var material=require('@mui/material'),React=require('react'),reactRouterDom=require('react-router-dom'),iconsMaterial=require('@mui/icons-material'),SimpleBar=require('simplebar-react');var CardLayoutDefaultProps = {
|
|
1
|
+
'use strict';var material=require('@mui/material'),React=require('react'),reactRouterDom=require('react-router-dom'),iconsMaterial=require('@mui/icons-material'),util=require('@pdg/util'),SimpleBar=require('simplebar-react');var CardLayoutDefaultProps = {
|
|
2
2
|
backgroundColor: '#eff3f8',
|
|
3
3
|
};var CardLayout = function (_a) {
|
|
4
4
|
var children = _a.children, backgroundColor = _a.backgroundColor;
|
|
5
5
|
return (React.createElement(material.Grid, { container: true, direction: 'column', alignItems: 'center', justifyContent: 'center', style: { minHeight: '100vh', backgroundColor: backgroundColor } },
|
|
6
6
|
React.createElement(material.Grid, { item: true, xs: 12 }, children)));
|
|
7
7
|
};
|
|
8
|
-
CardLayout.defaultProps = CardLayoutDefaultProps
|
|
9
|
-
Copyright (c) Microsoft Corporation.
|
|
10
|
-
|
|
11
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
-
purpose with or without fee is hereby granted.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */
|
|
22
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function __makeTemplateObject(cooked, raw) {
|
|
26
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
27
|
-
return cooked;
|
|
28
|
-
}
|
|
29
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
30
|
-
var e = new Error(message);
|
|
31
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
32
|
-
};var empty = function (v) {
|
|
33
|
-
var result = false;
|
|
34
|
-
if (v == null) {
|
|
35
|
-
result = true;
|
|
36
|
-
}
|
|
37
|
-
else if (typeof v === 'string') {
|
|
38
|
-
result = v === '';
|
|
39
|
-
}
|
|
40
|
-
else if (typeof v === 'object') {
|
|
41
|
-
if (Array.isArray(v)) {
|
|
42
|
-
result = v.length === 0;
|
|
43
|
-
}
|
|
44
|
-
else if (!(v instanceof Date)) {
|
|
45
|
-
result = Object.entries(v).length === 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return result;
|
|
49
|
-
};
|
|
50
|
-
var notEmpty = function (v) {
|
|
51
|
-
return !empty(v);
|
|
52
|
-
};var SideMenuListItem = function (_a) {
|
|
8
|
+
CardLayout.defaultProps = CardLayoutDefaultProps;var SideMenuListItem = function (_a) {
|
|
53
9
|
var info = _a.info, badgeVariant = _a.badgeVariant, onClick = _a.onClick;
|
|
54
10
|
var theme = material.useTheme();
|
|
55
11
|
var location = reactRouterDom.useLocation();
|
|
@@ -58,7 +14,7 @@ var notEmpty = function (v) {
|
|
|
58
14
|
var _c = React.useState(false), isExpand = _c[0], setIsExpand = _c[1];
|
|
59
15
|
// -------------------------------------------------------------------------------------------------------------------
|
|
60
16
|
React.useEffect(function () {
|
|
61
|
-
setIsExpandable(!!info && notEmpty(info.items));
|
|
17
|
+
setIsExpandable(!!info && util.notEmpty(info.items));
|
|
62
18
|
if (info.items && info.items.find(function (info) { return location.pathname === info.uri; })) {
|
|
63
19
|
setIsExpand(true);
|
|
64
20
|
}
|
|
@@ -149,6 +105,30 @@ var notEmpty = function (v) {
|
|
|
149
105
|
React.createElement(material.Collapse, { in: isExpand, style: collapseStyle }, isExpandable &&
|
|
150
106
|
info.items &&
|
|
151
107
|
info.items.map(function (subInfo, idx) { return (React.createElement(SideMenuListItem, { key: idx, badgeVariant: badgeVariant, info: subInfo, onClick: onClick })); }))));
|
|
108
|
+
};/******************************************************************************
|
|
109
|
+
Copyright (c) Microsoft Corporation.
|
|
110
|
+
|
|
111
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
112
|
+
purpose with or without fee is hereby granted.
|
|
113
|
+
|
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
115
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
116
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
117
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
118
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
119
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
120
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
121
|
+
***************************************************************************** */
|
|
122
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
function __makeTemplateObject(cooked, raw) {
|
|
126
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
127
|
+
return cooked;
|
|
128
|
+
}
|
|
129
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
130
|
+
var e = new Error(message);
|
|
131
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
152
132
|
};var StyledList = material.styled(material.List)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n padding: 0;\n"], ["\n padding: 0;\n"])));
|
|
153
133
|
var templateObject_1$3;var SideMenuList = function (_a) {
|
|
154
134
|
var list = _a.list, badgeVariant = _a.badgeVariant, onClick = _a.onClick;
|
|
@@ -261,7 +241,7 @@ var DefaultLayout = function (_a) {
|
|
|
261
241
|
var menuTitles = {};
|
|
262
242
|
if (menu) {
|
|
263
243
|
menu.forEach(function (info) {
|
|
264
|
-
if (empty(info.uri) && info.items && info.items.length > 0) {
|
|
244
|
+
if (util.empty(info.uri) && info.items && info.items.length > 0) {
|
|
265
245
|
info.items.map(function (subInfo) {
|
|
266
246
|
menuTitles[subInfo.uri] = { name: subInfo.name, parentName: info.name, parentIcon: info.icon };
|
|
267
247
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdg/react-admin-layout",
|
|
3
3
|
"title": "React Admin Layout",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.19",
|
|
5
5
|
"description": "Admin Layout for React",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@emotion/styled": "^11.11.0",
|
|
46
46
|
"@mui/icons-material": "^5.15.13",
|
|
47
47
|
"@mui/material": "^5.15.13",
|
|
48
|
+
"@pdg/util": "^1.0.13",
|
|
48
49
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
49
50
|
"react": "^17.0.0 || ^18.0.0",
|
|
50
51
|
"react-dom": "^17.0.0 || ^18.0.0",
|
package/dist/@util/compare.d.ts
DELETED
package/dist/@util/index.d.ts
DELETED