grep-components 1.27.0-GREPF-2190.1 → 1.27.0-GREPF-2104.2
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.
|
@@ -4,6 +4,7 @@ export interface SidebarProps {
|
|
|
4
4
|
currentPageId?: number;
|
|
5
5
|
pages: NavigationProps[];
|
|
6
6
|
onPageClick: (page: NavigationProps) => any;
|
|
7
|
+
expandOnIcon?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const Sidebar: ({ pages, onPageClick, currentPageId }: SidebarProps) => JSX.Element;
|
|
9
|
+
declare const Sidebar: ({ pages, onPageClick, currentPageId, expandOnIcon }: SidebarProps) => JSX.Element;
|
|
9
10
|
export default Sidebar;
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { useTheme } from '@mui/material/styles';
|
|
|
12
12
|
import { useHistory, NavLink, Prompt } from 'react-router-dom';
|
|
13
13
|
import MenuIcon from '@mui/icons-material/Menu';
|
|
14
14
|
import IconExpand from '@mui/icons-material/ExpandMore';
|
|
15
|
-
import { ArrowForward, Info,
|
|
15
|
+
import { ArrowForward, Info, ExpandLess, ExpandMore, Menu as Menu$1 } from '@mui/icons-material';
|
|
16
16
|
import ListItemIcon$1 from '@mui/material/ListItemIcon';
|
|
17
17
|
import MoreVert from '@mui/icons-material/MoreVert';
|
|
18
18
|
import { useDispatch, connect, Provider as Provider$1, useSelector } from 'react-redux';
|
|
@@ -3582,7 +3582,7 @@ var TableHeader = function (_a) {
|
|
|
3582
3582
|
React__default.createElement(TableRow, null, headerColumns.map(function (column, index) {
|
|
3583
3583
|
var sortable = !!(onSortBy && column.sortable);
|
|
3584
3584
|
var label = column.label, colDef = column.colDef;
|
|
3585
|
-
return (React__default.createElement(TableHeaderCell, { key: index, empty: label
|
|
3585
|
+
return (React__default.createElement(TableHeaderCell, { key: index, empty: !label, column: column, direction: sortDirection, active: sortable ? sortBy === colDef : undefined, onClick: function () { return sortable && onSortBy(column); }, onKeyDown: onActivation(function (e) {
|
|
3586
3586
|
if (sortable) {
|
|
3587
3587
|
e.preventDefault();
|
|
3588
3588
|
onSortBy(column);
|
|
@@ -4727,7 +4727,7 @@ var useStyles$6 = makeStyles()(function (_a, _props, classes) {
|
|
|
4727
4727
|
});
|
|
4728
4728
|
|
|
4729
4729
|
var Sidebar = function (_a) {
|
|
4730
|
-
var pages = _a.pages, onPageClick = _a.onPageClick, currentPageId = _a.currentPageId;
|
|
4730
|
+
var pages = _a.pages, onPageClick = _a.onPageClick, currentPageId = _a.currentPageId, expandOnIcon = _a.expandOnIcon;
|
|
4731
4731
|
var _b = __read(React.useState([]), 2), expanded = _b[0], setExpanded = _b[1];
|
|
4732
4732
|
var classes = useStyles$6().classes;
|
|
4733
4733
|
React.useEffect(function () {
|
|
@@ -4746,18 +4746,44 @@ var Sidebar = function (_a) {
|
|
|
4746
4746
|
}
|
|
4747
4747
|
};
|
|
4748
4748
|
var handleClick = function (page) {
|
|
4749
|
-
|
|
4749
|
+
if (expandOnIcon) {
|
|
4750
|
+
onPageClick(page);
|
|
4751
|
+
}
|
|
4752
|
+
else {
|
|
4753
|
+
page.children ? toggleExpand(page.id) : onPageClick(page);
|
|
4754
|
+
}
|
|
4750
4755
|
};
|
|
4751
4756
|
var renderItem = function (page) { return (React.createElement(React.Fragment, null,
|
|
4752
4757
|
page.linkIcon && (React.createElement(ListItemIcon, { className: classes.icon }, page.linkIcon)),
|
|
4753
4758
|
React.createElement(ListItemText$1, { sx: { outline: 'none !important' }, tabIndex: -1, disableTypography: true, primary: page.label, className: page.id === currentPageId ? classes.selected : classes.text }))); };
|
|
4759
|
+
var renderExpandIcon = function (page) {
|
|
4760
|
+
if (page.children) {
|
|
4761
|
+
if (expanded.includes(page.id)) {
|
|
4762
|
+
if (expandOnIcon) {
|
|
4763
|
+
return React.createElement(ExpandLess, { onClick: function (e) { e.stopPropagation(), toggleExpand(page.id); } });
|
|
4764
|
+
}
|
|
4765
|
+
else {
|
|
4766
|
+
return React.createElement(ExpandLess, null);
|
|
4767
|
+
}
|
|
4768
|
+
}
|
|
4769
|
+
else {
|
|
4770
|
+
if (expandOnIcon) {
|
|
4771
|
+
return React.createElement(ExpandMore, { onClick: function (e) { e.stopPropagation(), toggleExpand(page.id); } });
|
|
4772
|
+
}
|
|
4773
|
+
else {
|
|
4774
|
+
return React.createElement(ExpandMore, null);
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
return null;
|
|
4779
|
+
};
|
|
4754
4780
|
return (React.createElement(Box$1, { className: classes.container },
|
|
4755
4781
|
React.createElement(List$1, null, pages.map(function (page) {
|
|
4756
4782
|
var _a;
|
|
4757
4783
|
return (React.createElement("div", { key: page.id },
|
|
4758
4784
|
React.createElement(ListItem$1, { key: page.id, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(page); }, onKeyPress: keyboard.onActivation(function () { return handleClick(page); }) },
|
|
4759
4785
|
renderItem(page),
|
|
4760
|
-
|
|
4786
|
+
renderExpandIcon(page)),
|
|
4761
4787
|
React.createElement(Collapse, { in: expanded.includes(page.id), timeout: "auto", unmountOnExit: true },
|
|
4762
4788
|
React.createElement(List$1, { disablePadding: true }, (_a = page.children) === null || _a === void 0 ? void 0 : _a.map(function (child) { return (React.createElement(ListItem$1, { key: child.id, style: { paddingLeft: '30px' }, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(child); }, onKeyPress: keyboard.onActivation(function () { return handleClick(child); }) }, renderItem(child))); })))));
|
|
4763
4789
|
}))));
|