@dartech/arsenal-ui 1.4.28 → 1.4.30
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +97 -15
- package/package.json +1 -1
- package/src/lib/Alert/Alert.d.ts +4 -3
- package/src/lib/Property/UpsertProperty/PropertyValueField/BooleanValueField.d.ts +0 -1
- package/src/lib/Property/UpsertProperty/PropertyValueField/DateTimeValueField.d.ts +0 -1
- package/src/lib/Property/UpsertProperty/PropertyValueField/DateValueField.d.ts +0 -1
- package/src/lib/Property/UpsertProperty/PropertyValueField/JsonValueField.d.ts +0 -1
- package/src/lib/Property/UpsertProperty/PropertyValueField/TimeValueField.d.ts +0 -1
- package/src/lib/Property/ViewProperty/PropertyItem.d.ts +0 -1
- package/src/lib/Sidebar/SidebarContext.d.ts +1 -0
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +1 -1
- package/src/lib/Sidebar/SidebarLink/SidebarRootItem.d.ts +11 -0
package/index.js
CHANGED
@@ -159,15 +159,16 @@ const AlertDialog = ({
|
|
159
159
|
open,
|
160
160
|
title,
|
161
161
|
description,
|
162
|
-
closeButtonTitle: _closeButtonTitle =
|
162
|
+
closeButtonTitle: _closeButtonTitle = 'Close',
|
163
163
|
onClose,
|
164
|
-
confirmButtonTitle: _confirmButtonTitle =
|
164
|
+
confirmButtonTitle: _confirmButtonTitle = 'Confirm',
|
165
165
|
confirmButtonDisabled: _confirmButtonDisabled = false,
|
166
166
|
onConfirm,
|
167
167
|
children,
|
168
168
|
dialogProps,
|
169
169
|
loading,
|
170
|
-
maxWidth: _maxWidth =
|
170
|
+
maxWidth: _maxWidth = 'xs',
|
171
|
+
hideCloseButton: _hideCloseButton = false
|
171
172
|
}) => {
|
172
173
|
return jsx("div", {
|
173
174
|
children: jsxs(Dialog, Object.assign({
|
@@ -194,7 +195,7 @@ const AlertDialog = ({
|
|
194
195
|
children: children
|
195
196
|
}))]
|
196
197
|
}), jsxs(DialogActions, {
|
197
|
-
children: [jsx(Button, Object.assign({
|
198
|
+
children: [!_hideCloseButton && jsx(Button, Object.assign({
|
198
199
|
onClick: onClose,
|
199
200
|
variant: "outlined"
|
200
201
|
}, {
|
@@ -6810,10 +6811,14 @@ const SidebarContextProvider = ({
|
|
6810
6811
|
}
|
6811
6812
|
}));
|
6812
6813
|
}, [collapsed]);
|
6814
|
+
const toggleRootElementLink = useCallback((name, isCollapsed) => {
|
6815
|
+
localStorage.setItem(`${name.toLowerCase()}_collapsed`, `${!isCollapsed}`);
|
6816
|
+
}, []);
|
6813
6817
|
return jsx(SidebarContext.Provider, Object.assign({
|
6814
6818
|
value: {
|
6815
6819
|
collapsed,
|
6816
|
-
toggleCollapse
|
6820
|
+
toggleCollapse,
|
6821
|
+
toggleRootElementLink
|
6817
6822
|
}
|
6818
6823
|
}, {
|
6819
6824
|
children: children
|
@@ -7327,12 +7332,16 @@ const ListItemIcon = styled(MuiListItemIcon)(({
|
|
7327
7332
|
const ListSubheader = styled(MuiListSubheader)(({
|
7328
7333
|
theme
|
7329
7334
|
}) => ({
|
7335
|
+
textTransform: 'uppercase',
|
7336
|
+
borderRadius: theme.spacing(2.5),
|
7330
7337
|
backgroundColor: theme.palette.secondary.main,
|
7331
7338
|
color: '#fff',
|
7332
7339
|
paddingLeft: 0,
|
7333
|
-
|
7340
|
+
paddingRight: 0,
|
7334
7341
|
position: 'relative',
|
7335
|
-
|
7342
|
+
'&:hover': {
|
7343
|
+
backgroundColor: 'rgba(255, 255, 255, 0.08)'
|
7344
|
+
},
|
7336
7345
|
'&.collapsed': {
|
7337
7346
|
fontSize: 24,
|
7338
7347
|
textAlign: 'center',
|
@@ -7361,7 +7370,7 @@ const ChildrenList = styled(MuiList)(props => ({
|
|
7361
7370
|
margin: 0,
|
7362
7371
|
padding: 0,
|
7363
7372
|
'& .MuiListItemText-root:not(.main)': {
|
7364
|
-
paddingLeft: props.theme.spacing(
|
7373
|
+
paddingLeft: props.theme.spacing(8.5)
|
7365
7374
|
}
|
7366
7375
|
}));
|
7367
7376
|
const CollapseButton = styled(MuiButtonBase)(props => ({
|
@@ -7519,6 +7528,50 @@ var SidebarLinkItem$1 = SidebarLinkItem;
|
|
7519
7528
|
var img$1 = "data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg opacity='0.6'%3e%3cpath d='M10.3533 2.81334C10.447 2.90709 10.4996 3.03417 10.4996 3.16667C10.4996 3.29917 10.447 3.42626 10.3533 3.52001L5.87334 8.00001L10.3533 12.48C10.4025 12.5258 10.4419 12.581 10.4692 12.6423C10.4965 12.7036 10.5112 12.7699 10.5124 12.837C10.5136 12.9041 10.5012 12.9708 10.4761 13.0331C10.4509 13.0953 10.4135 13.1519 10.366 13.1994C10.3186 13.2468 10.262 13.2843 10.1997 13.3094C10.1375 13.3346 10.0708 13.3469 10.0037 13.3457C9.93652 13.3446 9.87032 13.3299 9.80898 13.3025C9.74765 13.2752 9.69245 13.2358 9.64667 13.1867L4.81334 8.35334C4.71971 8.25959 4.66711 8.13251 4.66711 8.00001C4.66711 7.86751 4.71971 7.74042 4.81334 7.64667L9.64667 2.81334C9.74042 2.71971 9.86751 2.66711 10 2.66711C10.1325 2.66711 10.2596 2.71971 10.3533 2.81334Z' fill='white'/%3e%3c/g%3e%3c/svg%3e";
|
7520
7529
|
var ArrowIcon$1 = img$1;
|
7521
7530
|
|
7531
|
+
const SidebarRootItem = ({
|
7532
|
+
route,
|
7533
|
+
isActive,
|
7534
|
+
isListOpen,
|
7535
|
+
handleClick,
|
7536
|
+
isSubmenu
|
7537
|
+
}) => {
|
7538
|
+
return jsx(ListSubheader, {
|
7539
|
+
children: jsx(ListItem, Object.assign({
|
7540
|
+
disablePadding: true,
|
7541
|
+
onClick: handleClick
|
7542
|
+
}, {
|
7543
|
+
children: jsxs(ListItemButton, Object.assign({
|
7544
|
+
className: classnames({
|
7545
|
+
active: isActive,
|
7546
|
+
main: route.main
|
7547
|
+
}),
|
7548
|
+
sx: {
|
7549
|
+
justifyContent: 'space-between'
|
7550
|
+
}
|
7551
|
+
}, {
|
7552
|
+
children: [jsx(ListItemText, {
|
7553
|
+
primary: route.name,
|
7554
|
+
className: classnames({
|
7555
|
+
main: route.main
|
7556
|
+
}),
|
7557
|
+
sx: !isSubmenu ? {
|
7558
|
+
display: 'none'
|
7559
|
+
} : {}
|
7560
|
+
}), route.name, jsx(Box, {
|
7561
|
+
component: "img",
|
7562
|
+
src: ArrowIcon$1,
|
7563
|
+
mr: 3,
|
7564
|
+
sx: {
|
7565
|
+
transition: 'transform .3s',
|
7566
|
+
transform: `rotate(${isListOpen ? 0 : '-90deg'})`
|
7567
|
+
}
|
7568
|
+
})]
|
7569
|
+
}))
|
7570
|
+
}))
|
7571
|
+
});
|
7572
|
+
};
|
7573
|
+
var SidebarRootItem$1 = SidebarRootItem;
|
7574
|
+
|
7522
7575
|
function SidebarNestedItem({
|
7523
7576
|
route,
|
7524
7577
|
isActive,
|
@@ -7560,12 +7613,15 @@ function SidebarNestedItem({
|
|
7560
7613
|
mr: 3,
|
7561
7614
|
sx: {
|
7562
7615
|
transition: 'transform .3s',
|
7563
|
-
transform: `rotate(${isListOpen ? '-90deg' : 0})
|
7564
|
-
opacity: collapsed ? 0 : 1
|
7616
|
+
transform: `rotate(${isListOpen ? '-90deg' : 0})`
|
7565
7617
|
}
|
7566
7618
|
})]
|
7567
7619
|
}))
|
7568
|
-
})) : jsx(
|
7620
|
+
})) : (route === null || route === void 0 ? void 0 : route.rootLink) ? jsx(SidebarRootItem$1, {
|
7621
|
+
route: route,
|
7622
|
+
handleClick: handleClick,
|
7623
|
+
isListOpen: isListOpen
|
7624
|
+
}) : jsx(ListSubheader, {
|
7569
7625
|
children: route.name
|
7570
7626
|
});
|
7571
7627
|
}
|
@@ -7574,20 +7630,46 @@ const SidebarLink = ({
|
|
7574
7630
|
route,
|
7575
7631
|
isSubmenu
|
7576
7632
|
}) => {
|
7577
|
-
var _a, _b;
|
7633
|
+
var _a, _b, _c;
|
7578
7634
|
const location = useLocation();
|
7579
7635
|
const {
|
7580
|
-
collapsed
|
7636
|
+
collapsed,
|
7637
|
+
toggleRootElementLink
|
7581
7638
|
} = useSidebarContext();
|
7582
7639
|
const [open, setOpen] = useState(false);
|
7640
|
+
const [rootLinkCollapsed, setRootLinkCollapsed] = useState(localStorage.getItem(`${route.name.toLowerCase()}_collapsed`) === 'true');
|
7583
7641
|
const isActive = useMemo(() => !!(route.link || route.rootLink) && location.pathname.startsWith(route.link || route.rootLink), [location.pathname, route]);
|
7584
7642
|
const handleClick = () => {
|
7585
7643
|
setOpen(!open);
|
7586
7644
|
};
|
7645
|
+
const handleRootClick = useCallback(() => {
|
7646
|
+
if (route && route.rootLink) {
|
7647
|
+
toggleRootElementLink(route.name, rootLinkCollapsed);
|
7648
|
+
setRootLinkCollapsed(!rootLinkCollapsed);
|
7649
|
+
}
|
7650
|
+
}, [rootLinkCollapsed, route, toggleRootElementLink]);
|
7587
7651
|
useEffect(() => {
|
7588
7652
|
setOpen(isActive);
|
7589
7653
|
}, [isActive]);
|
7590
|
-
return ((_a = route.children) === null || _a === void 0 ? void 0 : _a.length) && (!collapsed || collapsed && isSubmenu) ? jsxs(Fragment, {
|
7654
|
+
return (route === null || route === void 0 ? void 0 : route.rootLink) && ((_a = route.children) === null || _a === void 0 ? void 0 : _a.length) && (!collapsed || collapsed && isSubmenu) ? jsxs(Fragment, {
|
7655
|
+
children: [jsx(SidebarNestedItem, {
|
7656
|
+
route: route,
|
7657
|
+
isActive: isActive,
|
7658
|
+
handleClick: handleRootClick,
|
7659
|
+
isListOpen: rootLinkCollapsed,
|
7660
|
+
isSubmenu: isSubmenu
|
7661
|
+
}), jsx(Collapse, Object.assign({
|
7662
|
+
in: !rootLinkCollapsed,
|
7663
|
+
timeout: "auto"
|
7664
|
+
}, {
|
7665
|
+
children: jsx(ChildrenList, {
|
7666
|
+
children: route.children.map(childRoute => jsx(SidebarLink, {
|
7667
|
+
route: childRoute,
|
7668
|
+
isSubmenu: isSubmenu
|
7669
|
+
}, childRoute.name))
|
7670
|
+
})
|
7671
|
+
}))]
|
7672
|
+
}) : ((_b = route.children) === null || _b === void 0 ? void 0 : _b.length) && (!collapsed || collapsed && isSubmenu) ? jsxs(Fragment, {
|
7591
7673
|
children: [jsx(SidebarNestedItem, {
|
7592
7674
|
route: route,
|
7593
7675
|
isActive: isActive,
|
@@ -7599,7 +7681,7 @@ const SidebarLink = ({
|
|
7599
7681
|
timeout: "auto"
|
7600
7682
|
}, {
|
7601
7683
|
children: jsx(ChildrenList, {
|
7602
|
-
children: (
|
7684
|
+
children: (_c = route.children) === null || _c === void 0 ? void 0 : _c.map((childRoute, index) => jsx(SidebarLink, {
|
7603
7685
|
route: childRoute,
|
7604
7686
|
isSubmenu: isSubmenu
|
7605
7687
|
}, childRoute.name))
|
package/package.json
CHANGED
package/src/lib/Alert/Alert.d.ts
CHANGED
@@ -28,7 +28,7 @@ export interface AlertDialogProps {
|
|
28
28
|
/**
|
29
29
|
* onClose event handle function
|
30
30
|
*/
|
31
|
-
onClose
|
31
|
+
onClose?: () => void;
|
32
32
|
/**
|
33
33
|
* onConfirm event handle function
|
34
34
|
*/
|
@@ -43,11 +43,12 @@ export interface AlertDialogProps {
|
|
43
43
|
dialogProps?: Partial<DialogProps>;
|
44
44
|
loading?: boolean;
|
45
45
|
confirmButtonDisabled?: boolean;
|
46
|
-
maxWidth?: false |
|
46
|
+
maxWidth?: false | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
47
|
+
hideCloseButton?: boolean;
|
47
48
|
}
|
48
49
|
/**
|
49
50
|
* Alert dialog component. Used for popup information
|
50
51
|
* @category Common UI components
|
51
52
|
*/
|
52
|
-
export declare const AlertDialog: ({ open, title, description, closeButtonTitle, onClose, confirmButtonTitle, confirmButtonDisabled, onConfirm, children, dialogProps, loading, maxWidth }: AlertDialogProps) => JSX.Element;
|
53
|
+
export declare const AlertDialog: ({ open, title, description, closeButtonTitle, onClose, confirmButtonTitle, confirmButtonDisabled, onConfirm, children, dialogProps, loading, maxWidth, hideCloseButton, }: AlertDialogProps) => JSX.Element;
|
53
54
|
export default AlertDialog;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
type SidebarContextProps = {
|
3
3
|
collapsed: boolean;
|
4
4
|
toggleCollapse: () => void;
|
5
|
+
toggleRootElementLink?: (name: string, isCollapsed: boolean) => void;
|
5
6
|
};
|
6
7
|
export declare const SidebarContext: import("react").Context<SidebarContextProps>;
|
7
8
|
export declare const useSidebarContext: () => SidebarContextProps;
|
@@ -7,5 +7,5 @@ type Props = {
|
|
7
7
|
isSubmenu?: boolean;
|
8
8
|
handleClick: () => void;
|
9
9
|
};
|
10
|
-
declare function SidebarNestedItem({ route, isActive, isListOpen, handleClick, isSubmenu }: Props): JSX.Element;
|
10
|
+
declare function SidebarNestedItem({ route, isActive, isListOpen, handleClick, isSubmenu, }: Props): JSX.Element;
|
11
11
|
export default SidebarNestedItem;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { Route } from '../../../interfaces';
|
3
|
+
type Props = {
|
4
|
+
route: Route;
|
5
|
+
isActive?: boolean;
|
6
|
+
isListOpen?: boolean;
|
7
|
+
isSubmenu?: boolean;
|
8
|
+
handleClick?: () => void;
|
9
|
+
};
|
10
|
+
declare const SidebarRootItem: ({ route, isActive, isListOpen, handleClick, isSubmenu, }: Props) => JSX.Element;
|
11
|
+
export default SidebarRootItem;
|