@antscorp/antsomi-ui 1.3.5-beta.221 → 1.3.5-beta.223
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/es/components/molecules/DrawerDetail/DrawerDetail.js +8 -3
- package/es/components/molecules/DrawerDetail/components/ToggleDrawerSizeButton.js +1 -0
- package/es/components/molecules/DrawerDetail/constants.d.ts +7 -1
- package/es/components/molecules/DrawerDetail/constants.js +9 -1
- package/es/components/molecules/DrawerDetail/index.d.ts +1 -0
- package/es/components/molecules/DrawerDetail/index.js +2 -0
- package/es/components/molecules/DrawerDetail/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -18,10 +18,11 @@ import { CloseBtn, Content, LeftMenu, MenuFooter, MenuItem, StyledDrawer } from
|
|
|
18
18
|
// Constants
|
|
19
19
|
import { BREAK_POINT, DRAWER_LARGE_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, } from './constants';
|
|
20
20
|
import { ToggleDrawerSizeButton } from './components';
|
|
21
|
+
// Hooks
|
|
21
22
|
import { useMediaQuery, useToggle } from '@antscorp/antsomi-ui/es/hooks';
|
|
22
23
|
export const DrawerDetail = props => {
|
|
23
24
|
// Props
|
|
24
|
-
const { width, fullScreen, children, menuProps, closeIconProps } = props, restProps = __rest(props, ["width", "fullScreen", "children", "menuProps", "closeIconProps"]);
|
|
25
|
+
const { width, fullScreen, children, menuProps, closeIconProps, maxWidth, minWidth } = props, restProps = __rest(props, ["width", "fullScreen", "children", "menuProps", "closeIconProps", "maxWidth", "minWidth"]);
|
|
25
26
|
const { show: showMenu = true, showExpandButton = true, showClose = true, items, selectedKeys, footer, onClick = () => { }, } = menuProps || {};
|
|
26
27
|
const { onClose = () => { } } = props;
|
|
27
28
|
const _a = closeIconProps || {}, { show: showCloseIcon, onClick: onCloseIconClick = () => { } } = _a, restOfCloseIcon = __rest(_a, ["show", "onClick"]);
|
|
@@ -46,18 +47,22 @@ export const DrawerDetail = props => {
|
|
|
46
47
|
*/
|
|
47
48
|
switch (collapseDrawer) {
|
|
48
49
|
case false: {
|
|
50
|
+
if (maxWidth)
|
|
51
|
+
return maxWidth;
|
|
49
52
|
if (matchesSmallScreen)
|
|
50
53
|
return DRAWER_SMALL_MAX_WIDTH;
|
|
51
54
|
return DRAWER_LARGE_MAX_WIDTH;
|
|
52
55
|
}
|
|
53
56
|
case true:
|
|
54
57
|
default: {
|
|
58
|
+
if (minWidth)
|
|
59
|
+
return minWidth;
|
|
55
60
|
if (matchesSmallScreen)
|
|
56
61
|
return DRAWER_SMALL_MIN_WIDTH;
|
|
57
62
|
return DRAWER_LARGE_MIN_WIDTH;
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
|
-
}, [collapseDrawer, fullScreen, matchesSmallScreen, width]);
|
|
65
|
+
}, [collapseDrawer, fullScreen, matchesSmallScreen, maxWidth, minWidth, width]);
|
|
61
66
|
return (React.createElement(StyledDrawer, Object.assign({}, restProps, { closable: false, width: drawerWidth, classNames: {
|
|
62
67
|
body: 'drawer-detail-body',
|
|
63
68
|
} }),
|
|
@@ -66,8 +71,8 @@ export const DrawerDetail = props => {
|
|
|
66
71
|
onClose(e);
|
|
67
72
|
} }),
|
|
68
73
|
React.createElement(Icon, { type: "icon-ants-remove-slim", size: 14 }))),
|
|
74
|
+
showExpandButton && !fullScreen && (React.createElement(ToggleDrawerSizeButton, { style: Object.assign({}, (!showMenu && { background: '#ffffff' })), onClick: () => toggleCollapseDrawer(), collapse: collapseDrawer })),
|
|
69
75
|
showMenu && (React.createElement(LeftMenu, { className: "animate__animated animate__fadeIn" },
|
|
70
|
-
showExpandButton && !fullScreen && (React.createElement(ToggleDrawerSizeButton, { onClick: () => toggleCollapseDrawer(), collapse: collapseDrawer })),
|
|
71
76
|
React.createElement("div", null,
|
|
72
77
|
showClose && (React.createElement(CloseBtn, { onClick: onClose },
|
|
73
78
|
React.createElement(Icon, { type: "icon-ants-remove-slim", size: 14 }))),
|
|
@@ -4,4 +4,10 @@ declare const DRAWER_LARGE_MAX_WIDTH = "calc(100vw - 70px)";
|
|
|
4
4
|
declare const DRAWER_SMALL_MAX_WIDTH = "calc(100vw - 70px)";
|
|
5
5
|
declare const DRAWER_SMALL_MIN_WIDTH = "calc(100vw - 310px)";
|
|
6
6
|
declare const BREAK_POINT = "1440px";
|
|
7
|
-
|
|
7
|
+
declare const DRAWER_DETAIL_DIMENSION: {
|
|
8
|
+
LAYER_2: {
|
|
9
|
+
minWidth: string;
|
|
10
|
+
maxWidth: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export { DRAWER_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_LARGE_MAX_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, BREAK_POINT, DRAWER_DETAIL_DIMENSION, };
|
|
@@ -4,4 +4,12 @@ const DRAWER_LARGE_MAX_WIDTH = 'calc(100vw - 70px)';
|
|
|
4
4
|
const DRAWER_SMALL_MAX_WIDTH = 'calc(100vw - 70px)';
|
|
5
5
|
const DRAWER_SMALL_MIN_WIDTH = 'calc(100vw - 310px)';
|
|
6
6
|
const BREAK_POINT = '1440px';
|
|
7
|
-
|
|
7
|
+
const LAYER_2_MIN_WIDTH = '740px';
|
|
8
|
+
const LAYER_2_MAX_WIDTH = 'calc(100vw - 46px)';
|
|
9
|
+
const DRAWER_DETAIL_DIMENSION = {
|
|
10
|
+
LAYER_2: {
|
|
11
|
+
minWidth: LAYER_2_MIN_WIDTH,
|
|
12
|
+
maxWidth: LAYER_2_MAX_WIDTH,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export { DRAWER_MAX_WIDTH, DRAWER_LARGE_MIN_WIDTH, DRAWER_LARGE_MAX_WIDTH, DRAWER_SMALL_MAX_WIDTH, DRAWER_SMALL_MIN_WIDTH, BREAK_POINT, DRAWER_DETAIL_DIMENSION, };
|
|
@@ -3,6 +3,8 @@ import type { DrawerProps, MenuProps as AntdProps } from 'antd';
|
|
|
3
3
|
import { ItemType } from 'antd/es/menu/hooks/useItems';
|
|
4
4
|
export interface DrawerDetailProps extends Omit<DrawerProps, 'closeIcon'> {
|
|
5
5
|
fullScreen?: boolean;
|
|
6
|
+
maxWidth?: string | number;
|
|
7
|
+
minWidth?: string | number;
|
|
6
8
|
menuProps?: DrawerDetailMenuProps;
|
|
7
9
|
closeIconProps?: DrawerDetailCloseIconProps;
|
|
8
10
|
}
|