@etsoo/materialui 1.1.12 → 1.1.14

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.
@@ -94,11 +94,11 @@ export function OptionGroup(props) {
94
94
  return (React.createElement(React.Fragment, null,
95
95
  React.createElement(FormControl, { component: "fieldset", fullWidth: fullWidth, ...rest },
96
96
  label && (React.createElement(InputLabel, { required: required, variant: variant, shrink: true }, label)),
97
- React.createElement(Box, { paddingLeft: 2, paddingY: "7px" }, group),
98
97
  variant === "outlined" && (React.createElement(NotchedOutline, { label: label && required ? label + " *" : label, notched: true, style: {
99
98
  position: "absolute",
100
99
  borderRadius: theme.shape.borderRadius,
101
100
  width: fullWidth ? "100%" : "auto"
102
- } }))),
101
+ } })),
102
+ React.createElement(Box, { paddingLeft: 2, paddingY: "7px" }, group)),
103
103
  helperText && React.createElement(FormHelperText, null, helperText)));
104
104
  }
package/lib/index.d.ts CHANGED
@@ -1,80 +1,83 @@
1
- export * from './app/CommonApp';
2
- export * from './app/IServiceApp';
3
- export * from './app/IServiceAppSettings';
4
- export * from './app/IServicePage';
5
- export * from './app/IServiceUser';
6
- export * from './app/ISmartERPUser';
7
- export * from './app/Labels';
8
- export * from './app/ReactApp';
9
- export * from './app/ServiceApp';
10
- export * from './pages/CommonPage';
11
- export * from './pages/CommonPageProps';
12
- export * from './pages/DataGridPage';
13
- export * from './pages/DataGridPageProps';
14
- export * from './pages/EditPage';
15
- export * from './pages/FixedListPage';
16
- export * from './pages/ListPage';
17
- export * from './pages/ListPageProps';
18
- export * from './pages/ResponsivePage';
19
- export * from './pages/ResponsivePageProps';
20
- export * from './pages/SearchPageProps';
21
- export * from './pages/TablePage';
22
- export * from './pages/ViewPage';
23
- export * from './texts/DateText';
24
- export * from './texts/MoneyText';
25
- export * from './texts/NumberText';
26
- export * from './AuditDisplay';
27
- export * from './AutocompleteExtendedProps';
28
- export * from './BackButton';
29
- export * from './BridgeCloseButton';
30
- export * from './ButtonLink';
31
- export * from './ComboBox';
32
- export * from './CountdownButton';
33
- export * from './CountryList';
34
- export * from './CustomFabProps';
35
- export * from './DataGridEx';
36
- export * from './DataGridRenderers';
37
- export * from './DataSteps';
38
- export * from './DialogButton';
39
- export * from './DnDList';
40
- export * from './DraggablePaperComponent';
41
- export * from './EmailInput';
42
- export * from './FabBox';
43
- export * from './FlexBox';
44
- export * from './GridDataFormat';
45
- export * from './HiSelector';
46
- export * from './IconButtonLink';
47
- export * from './InputField';
48
- export * from './ItemList';
49
- export * from './ListChooser';
50
- export * from './ListItemRightIcon';
51
- export * from './ListMoreDisplay';
52
- export * from './LoadingButton';
53
- export * from './MaskInput';
54
- export * from './MobileListItemRenderer';
55
- export * from './MoreFab';
56
- export * from './MUGlobal';
57
- export * from './NotifierMU';
58
- export * from './OptionGroup';
59
- export * from './PList';
60
- export * from './ProgressCount';
61
- export * from './PullToRefreshUI';
62
- export * from './ResponsibleContainer';
63
- export * from './ScrollerListEx';
64
- export * from './ScrollTopFab';
65
- export * from './SearchBar';
66
- export * from './SearchField';
67
- export * from './SearchOptionGroup';
68
- export * from './SelectBool';
69
- export * from './SelectEx';
70
- export * from './ShowDataComparison';
71
- export * from './Switch';
72
- export * from './SwitchAnt';
73
- export * from './TabBox';
74
- export * from './TableEx';
75
- export * from './TextFieldEx';
76
- export * from './Tiplist';
77
- export * from './TwoFieldInput';
78
- export * from './TooltipClick';
79
- export * from './UserAvatar';
80
- export * from './UserAvatarEditor';
1
+ export * from "./app/CommonApp";
2
+ export * from "./app/IServiceApp";
3
+ export * from "./app/IServiceAppSettings";
4
+ export * from "./app/IServicePage";
5
+ export * from "./app/IServiceUser";
6
+ export * from "./app/ISmartERPUser";
7
+ export * from "./app/Labels";
8
+ export * from "./app/ReactApp";
9
+ export * from "./app/ServiceApp";
10
+ export * from "./pages/CommonPage";
11
+ export * from "./pages/CommonPageProps";
12
+ export * from "./pages/DataGridPage";
13
+ export * from "./pages/DataGridPageProps";
14
+ export * from "./pages/DrawerHeader";
15
+ export * from "./pages/EditPage";
16
+ export * from "./pages/FixedListPage";
17
+ export * from "./pages/LeftDrawer";
18
+ export * from "./pages/ListPage";
19
+ export * from "./pages/ListPageProps";
20
+ export * from "./pages/ResponsivePage";
21
+ export * from "./pages/ResponsivePageProps";
22
+ export * from "./pages/SearchPageProps";
23
+ export * from "./pages/TablePage";
24
+ export * from "./pages/UserMenu";
25
+ export * from "./pages/ViewPage";
26
+ export * from "./texts/DateText";
27
+ export * from "./texts/MoneyText";
28
+ export * from "./texts/NumberText";
29
+ export * from "./AuditDisplay";
30
+ export * from "./AutocompleteExtendedProps";
31
+ export * from "./BackButton";
32
+ export * from "./BridgeCloseButton";
33
+ export * from "./ButtonLink";
34
+ export * from "./ComboBox";
35
+ export * from "./CountdownButton";
36
+ export * from "./CountryList";
37
+ export * from "./CustomFabProps";
38
+ export * from "./DataGridEx";
39
+ export * from "./DataGridRenderers";
40
+ export * from "./DataSteps";
41
+ export * from "./DialogButton";
42
+ export * from "./DnDList";
43
+ export * from "./DraggablePaperComponent";
44
+ export * from "./EmailInput";
45
+ export * from "./FabBox";
46
+ export * from "./FlexBox";
47
+ export * from "./GridDataFormat";
48
+ export * from "./HiSelector";
49
+ export * from "./IconButtonLink";
50
+ export * from "./InputField";
51
+ export * from "./ItemList";
52
+ export * from "./ListChooser";
53
+ export * from "./ListItemRightIcon";
54
+ export * from "./ListMoreDisplay";
55
+ export * from "./LoadingButton";
56
+ export * from "./MaskInput";
57
+ export * from "./MobileListItemRenderer";
58
+ export * from "./MoreFab";
59
+ export * from "./MUGlobal";
60
+ export * from "./NotifierMU";
61
+ export * from "./OptionGroup";
62
+ export * from "./PList";
63
+ export * from "./ProgressCount";
64
+ export * from "./PullToRefreshUI";
65
+ export * from "./ResponsibleContainer";
66
+ export * from "./ScrollerListEx";
67
+ export * from "./ScrollTopFab";
68
+ export * from "./SearchBar";
69
+ export * from "./SearchField";
70
+ export * from "./SearchOptionGroup";
71
+ export * from "./SelectBool";
72
+ export * from "./SelectEx";
73
+ export * from "./ShowDataComparison";
74
+ export * from "./Switch";
75
+ export * from "./SwitchAnt";
76
+ export * from "./TabBox";
77
+ export * from "./TableEx";
78
+ export * from "./TextFieldEx";
79
+ export * from "./Tiplist";
80
+ export * from "./TwoFieldInput";
81
+ export * from "./TooltipClick";
82
+ export * from "./UserAvatar";
83
+ export * from "./UserAvatarEditor";
package/lib/index.js CHANGED
@@ -1,80 +1,83 @@
1
- export * from './app/CommonApp';
2
- export * from './app/IServiceApp';
3
- export * from './app/IServiceAppSettings';
4
- export * from './app/IServicePage';
5
- export * from './app/IServiceUser';
6
- export * from './app/ISmartERPUser';
7
- export * from './app/Labels';
8
- export * from './app/ReactApp';
9
- export * from './app/ServiceApp';
10
- export * from './pages/CommonPage';
11
- export * from './pages/CommonPageProps';
12
- export * from './pages/DataGridPage';
13
- export * from './pages/DataGridPageProps';
14
- export * from './pages/EditPage';
15
- export * from './pages/FixedListPage';
16
- export * from './pages/ListPage';
17
- export * from './pages/ListPageProps';
18
- export * from './pages/ResponsivePage';
19
- export * from './pages/ResponsivePageProps';
20
- export * from './pages/SearchPageProps';
21
- export * from './pages/TablePage';
22
- export * from './pages/ViewPage';
23
- export * from './texts/DateText';
24
- export * from './texts/MoneyText';
25
- export * from './texts/NumberText';
26
- export * from './AuditDisplay';
27
- export * from './AutocompleteExtendedProps';
28
- export * from './BackButton';
29
- export * from './BridgeCloseButton';
30
- export * from './ButtonLink';
31
- export * from './ComboBox';
32
- export * from './CountdownButton';
33
- export * from './CountryList';
34
- export * from './CustomFabProps';
35
- export * from './DataGridEx';
36
- export * from './DataGridRenderers';
37
- export * from './DataSteps';
38
- export * from './DialogButton';
39
- export * from './DnDList';
40
- export * from './DraggablePaperComponent';
41
- export * from './EmailInput';
42
- export * from './FabBox';
43
- export * from './FlexBox';
44
- export * from './GridDataFormat';
45
- export * from './HiSelector';
46
- export * from './IconButtonLink';
47
- export * from './InputField';
48
- export * from './ItemList';
49
- export * from './ListChooser';
50
- export * from './ListItemRightIcon';
51
- export * from './ListMoreDisplay';
52
- export * from './LoadingButton';
53
- export * from './MaskInput';
54
- export * from './MobileListItemRenderer';
55
- export * from './MoreFab';
56
- export * from './MUGlobal';
57
- export * from './NotifierMU';
58
- export * from './OptionGroup';
59
- export * from './PList';
60
- export * from './ProgressCount';
61
- export * from './PullToRefreshUI';
62
- export * from './ResponsibleContainer';
63
- export * from './ScrollerListEx';
64
- export * from './ScrollTopFab';
65
- export * from './SearchBar';
66
- export * from './SearchField';
67
- export * from './SearchOptionGroup';
68
- export * from './SelectBool';
69
- export * from './SelectEx';
70
- export * from './ShowDataComparison';
71
- export * from './Switch';
72
- export * from './SwitchAnt';
73
- export * from './TabBox';
74
- export * from './TableEx';
75
- export * from './TextFieldEx';
76
- export * from './Tiplist';
77
- export * from './TwoFieldInput';
78
- export * from './TooltipClick';
79
- export * from './UserAvatar';
80
- export * from './UserAvatarEditor';
1
+ export * from "./app/CommonApp";
2
+ export * from "./app/IServiceApp";
3
+ export * from "./app/IServiceAppSettings";
4
+ export * from "./app/IServicePage";
5
+ export * from "./app/IServiceUser";
6
+ export * from "./app/ISmartERPUser";
7
+ export * from "./app/Labels";
8
+ export * from "./app/ReactApp";
9
+ export * from "./app/ServiceApp";
10
+ export * from "./pages/CommonPage";
11
+ export * from "./pages/CommonPageProps";
12
+ export * from "./pages/DataGridPage";
13
+ export * from "./pages/DataGridPageProps";
14
+ export * from "./pages/DrawerHeader";
15
+ export * from "./pages/EditPage";
16
+ export * from "./pages/FixedListPage";
17
+ export * from "./pages/LeftDrawer";
18
+ export * from "./pages/ListPage";
19
+ export * from "./pages/ListPageProps";
20
+ export * from "./pages/ResponsivePage";
21
+ export * from "./pages/ResponsivePageProps";
22
+ export * from "./pages/SearchPageProps";
23
+ export * from "./pages/TablePage";
24
+ export * from "./pages/UserMenu";
25
+ export * from "./pages/ViewPage";
26
+ export * from "./texts/DateText";
27
+ export * from "./texts/MoneyText";
28
+ export * from "./texts/NumberText";
29
+ export * from "./AuditDisplay";
30
+ export * from "./AutocompleteExtendedProps";
31
+ export * from "./BackButton";
32
+ export * from "./BridgeCloseButton";
33
+ export * from "./ButtonLink";
34
+ export * from "./ComboBox";
35
+ export * from "./CountdownButton";
36
+ export * from "./CountryList";
37
+ export * from "./CustomFabProps";
38
+ export * from "./DataGridEx";
39
+ export * from "./DataGridRenderers";
40
+ export * from "./DataSteps";
41
+ export * from "./DialogButton";
42
+ export * from "./DnDList";
43
+ export * from "./DraggablePaperComponent";
44
+ export * from "./EmailInput";
45
+ export * from "./FabBox";
46
+ export * from "./FlexBox";
47
+ export * from "./GridDataFormat";
48
+ export * from "./HiSelector";
49
+ export * from "./IconButtonLink";
50
+ export * from "./InputField";
51
+ export * from "./ItemList";
52
+ export * from "./ListChooser";
53
+ export * from "./ListItemRightIcon";
54
+ export * from "./ListMoreDisplay";
55
+ export * from "./LoadingButton";
56
+ export * from "./MaskInput";
57
+ export * from "./MobileListItemRenderer";
58
+ export * from "./MoreFab";
59
+ export * from "./MUGlobal";
60
+ export * from "./NotifierMU";
61
+ export * from "./OptionGroup";
62
+ export * from "./PList";
63
+ export * from "./ProgressCount";
64
+ export * from "./PullToRefreshUI";
65
+ export * from "./ResponsibleContainer";
66
+ export * from "./ScrollerListEx";
67
+ export * from "./ScrollTopFab";
68
+ export * from "./SearchBar";
69
+ export * from "./SearchField";
70
+ export * from "./SearchOptionGroup";
71
+ export * from "./SelectBool";
72
+ export * from "./SelectEx";
73
+ export * from "./ShowDataComparison";
74
+ export * from "./Switch";
75
+ export * from "./SwitchAnt";
76
+ export * from "./TabBox";
77
+ export * from "./TableEx";
78
+ export * from "./TextFieldEx";
79
+ export * from "./Tiplist";
80
+ export * from "./TwoFieldInput";
81
+ export * from "./TooltipClick";
82
+ export * from "./UserAvatar";
83
+ export * from "./UserAvatarEditor";
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Common drawer header
4
+ */
5
+ export declare const DrawerHeader: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,13 @@
1
+ import { styled } from "@mui/material";
2
+ /**
3
+ * Common drawer header
4
+ */
5
+ export const DrawerHeader = styled("div")(({ theme }) => ({
6
+ // necessary for content to be below app bar
7
+ ...theme.mixins.toolbar,
8
+ display: "flex",
9
+ alignItems: "center",
10
+ gap: theme.spacing(1),
11
+ padding: theme.spacing(0, 1, 0, 2),
12
+ justifyContent: "flex-start"
13
+ }));
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ /**
3
+ * Left drawer methods
4
+ */
5
+ export interface LeftDrawerMethods {
6
+ open(): void;
7
+ }
8
+ /**
9
+ * Left drawer props
10
+ */
11
+ export interface LeftDrawerProps {
12
+ /**
13
+ * Show when md up
14
+ */
15
+ mdUp: boolean;
16
+ /**
17
+ * Organization
18
+ */
19
+ organization?: number;
20
+ /**
21
+ * Width
22
+ */
23
+ width: number;
24
+ /**
25
+ * Application name
26
+ */
27
+ appName: string;
28
+ /**
29
+ * Minimize hanlder
30
+ */
31
+ onMinimize?: () => void;
32
+ }
33
+ export declare const LeftDrawer: React.ForwardRefExoticComponent<LeftDrawerProps & {
34
+ children?: React.ReactNode;
35
+ } & React.RefAttributes<LeftDrawerMethods>>;
@@ -0,0 +1,44 @@
1
+ import { Avatar, Divider, Drawer, IconButton, List, Typography } from "@mui/material";
2
+ import React from "react";
3
+ import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
4
+ import { DrawerHeader } from "./DrawerHeader";
5
+ import { globalApp } from "../app/ReactApp";
6
+ export const LeftDrawer = React.forwardRef((props, ref) => {
7
+ var _a;
8
+ // Destruct
9
+ const { mdUp, width, appName, onMinimize, children } = props;
10
+ // Menu open/close state
11
+ const [open, setOpen] = React.useState();
12
+ const handleDrawerClose = () => {
13
+ if (onMinimize)
14
+ onMinimize();
15
+ setOpen(false);
16
+ };
17
+ React.useImperativeHandle(ref, () => ({
18
+ open() {
19
+ setOpen(true);
20
+ }
21
+ }));
22
+ // Ready
23
+ React.useEffect(() => {
24
+ setOpen(mdUp);
25
+ }, [mdUp]);
26
+ return (React.createElement(Drawer, { sx: {
27
+ width: open ? width : 0,
28
+ flexShrink: 0,
29
+ "& .MuiDrawer-paper": {
30
+ width: open ? width : 0,
31
+ boxSizing: "border-box"
32
+ }
33
+ }, anchor: "left", variant: mdUp ? "persistent" : "temporary", open: open, onClose: mdUp ? undefined : handleDrawerClose, ModalProps: {
34
+ keepMounted: true // Better open performance on mobile.
35
+ } },
36
+ React.createElement(DrawerHeader, null,
37
+ React.createElement("a", { href: "https://www.etsoo.com", title: (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("etsoo")) !== null && _a !== void 0 ? _a : "ETSOO", target: "_blank", rel: "noreferrer" },
38
+ React.createElement(Avatar, { src: process.env.PUBLIC_URL + "/logo192.png", variant: "square", sx: { marginLeft: -0.5, marginRight: 1.5, marginBottom: 1 } })),
39
+ React.createElement(Typography, { noWrap: true, component: "div", title: appName }, appName),
40
+ React.createElement(IconButton, { size: "small", onClick: handleDrawerClose },
41
+ React.createElement(ChevronLeftIcon, null))),
42
+ React.createElement(Divider, null),
43
+ React.createElement(List, { onClick: mdUp ? undefined : handleDrawerClose }, children)));
44
+ });
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ /**
3
+ * User menu props
4
+ */
5
+ export interface UserMenuProps {
6
+ /**
7
+ * Organization id
8
+ */
9
+ organization: number | undefined;
10
+ /**
11
+ * User name
12
+ */
13
+ name: string;
14
+ /**
15
+ * User avatar
16
+ */
17
+ avatar: string | undefined;
18
+ /**
19
+ * Children
20
+ * @param handleMenuClose Handler
21
+ */
22
+ children(handleMenuClose: () => void): React.ReactNode;
23
+ }
24
+ /**
25
+ * User menu
26
+ * @param props Props
27
+ * @returns Component
28
+ */
29
+ export declare function UserMenu(props: UserMenuProps): JSX.Element;
@@ -0,0 +1,58 @@
1
+ import { IconButton, Menu } from "@mui/material";
2
+ import React from "react";
3
+ import { UserAvatar } from "../UserAvatar";
4
+ /**
5
+ * User menu
6
+ * @param props Props
7
+ * @returns Component
8
+ */
9
+ export function UserMenu(props) {
10
+ // Destruct
11
+ const { children, name, avatar } = props;
12
+ // User menu anchor
13
+ const [anchorEl, setAnchorEl] = React.useState();
14
+ // User menu open or not
15
+ const isMenuOpen = Boolean(anchorEl);
16
+ // User menu
17
+ const handleUserMenuOpen = (event) => {
18
+ setAnchorEl(event.currentTarget);
19
+ };
20
+ const handleMenuClose = () => {
21
+ setAnchorEl(undefined);
22
+ };
23
+ return (React.createElement(React.Fragment, null,
24
+ React.createElement(IconButton, { edge: "end", "aria-haspopup": "true", onClick: handleUserMenuOpen, color: "inherit" },
25
+ React.createElement(UserAvatar, { title: name, src: avatar })),
26
+ React.createElement(Menu, { PaperProps: {
27
+ elevation: 0,
28
+ sx: {
29
+ overflow: "visible",
30
+ filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
31
+ mt: -0.4,
32
+ "& .MuiAvatar-root": {
33
+ width: 32,
34
+ height: 32,
35
+ ml: -0.5,
36
+ mr: 1
37
+ },
38
+ "&:before": {
39
+ content: '""',
40
+ display: "block",
41
+ position: "absolute",
42
+ top: 0,
43
+ right: 14,
44
+ width: 10,
45
+ height: 10,
46
+ bgcolor: "background.paper",
47
+ transform: "translateY(-50%) rotate(45deg)",
48
+ zIndex: 0
49
+ }
50
+ }
51
+ }, disableScrollLock: true, anchorEl: anchorEl, anchorOrigin: {
52
+ vertical: "bottom",
53
+ horizontal: "right"
54
+ }, keepMounted: true, transformOrigin: {
55
+ vertical: "top",
56
+ horizontal: "right"
57
+ }, open: isMenuOpen, onClick: handleMenuClose, onClose: handleMenuClose }, children(handleMenuClose))));
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -55,10 +55,10 @@
55
55
  "@etsoo/react": "^1.6.42",
56
56
  "@etsoo/shared": "^1.1.88",
57
57
  "@mui/icons-material": "^5.11.0",
58
- "@mui/material": "^5.11.5",
58
+ "@mui/material": "^5.11.6",
59
59
  "@types/pica": "^9.0.1",
60
60
  "@types/pulltorefreshjs": "^0.1.5",
61
- "@types/react": "^18.0.26",
61
+ "@types/react": "^18.0.27",
62
62
  "@types/react-avatar-editor": "^13.0.0",
63
63
  "@types/react-dom": "^18.0.10",
64
64
  "@types/react-input-mask": "^3.0.2",
@@ -70,7 +70,7 @@
70
70
  "react-dom": "^18.2.0",
71
71
  "react-draggable": "^4.4.5",
72
72
  "react-imask": "^6.4.3",
73
- "react-router-dom": "^6.6.2",
73
+ "react-router-dom": "^6.7.0",
74
74
  "react-window": "^1.8.8"
75
75
  },
76
76
  "devDependencies": {
@@ -80,14 +80,14 @@
80
80
  "@babel/preset-env": "^7.20.2",
81
81
  "@babel/preset-react": "^7.18.6",
82
82
  "@babel/preset-typescript": "^7.18.6",
83
- "@babel/runtime-corejs3": "^7.20.7",
83
+ "@babel/runtime-corejs3": "^7.20.13",
84
84
  "@testing-library/jest-dom": "^5.16.5",
85
85
  "@testing-library/react": "^13.4.0",
86
- "@types/jest": "^29.2.5",
87
- "@typescript-eslint/eslint-plugin": "^5.48.2",
88
- "@typescript-eslint/parser": "^5.48.2",
89
- "jest": "^29.3.1",
90
- "jest-environment-jsdom": "^29.3.1",
86
+ "@types/jest": "^29.4.0",
87
+ "@typescript-eslint/eslint-plugin": "^5.49.0",
88
+ "@typescript-eslint/parser": "^5.49.0",
89
+ "jest": "^29.4.0",
90
+ "jest-environment-jsdom": "^29.4.0",
91
91
  "typescript": "^4.9.4"
92
92
  }
93
93
  }
@@ -282,9 +282,6 @@ export function OptionGroup<
282
282
  {label}
283
283
  </InputLabel>
284
284
  )}
285
- <Box paddingLeft={2} paddingY="7px">
286
- {group}
287
- </Box>
288
285
  {variant === "outlined" && (
289
286
  <NotchedOutline
290
287
  label={label && required ? label + " *" : label}
@@ -296,6 +293,9 @@ export function OptionGroup<
296
293
  }}
297
294
  />
298
295
  )}
296
+ <Box paddingLeft={2} paddingY="7px">
297
+ {group}
298
+ </Box>
299
299
  </FormControl>
300
300
  {helperText && <FormHelperText>{helperText}</FormHelperText>}
301
301
  </React.Fragment>
package/src/index.ts CHANGED
@@ -1,83 +1,86 @@
1
- export * from './app/CommonApp';
2
- export * from './app/IServiceApp';
3
- export * from './app/IServiceAppSettings';
4
- export * from './app/IServicePage';
5
- export * from './app/IServiceUser';
6
- export * from './app/ISmartERPUser';
7
- export * from './app/Labels';
8
- export * from './app/ReactApp';
9
- export * from './app/ServiceApp';
1
+ export * from "./app/CommonApp";
2
+ export * from "./app/IServiceApp";
3
+ export * from "./app/IServiceAppSettings";
4
+ export * from "./app/IServicePage";
5
+ export * from "./app/IServiceUser";
6
+ export * from "./app/ISmartERPUser";
7
+ export * from "./app/Labels";
8
+ export * from "./app/ReactApp";
9
+ export * from "./app/ServiceApp";
10
10
 
11
- export * from './pages/CommonPage';
12
- export * from './pages/CommonPageProps';
13
- export * from './pages/DataGridPage';
14
- export * from './pages/DataGridPageProps';
15
- export * from './pages/EditPage';
16
- export * from './pages/FixedListPage';
17
- export * from './pages/ListPage';
18
- export * from './pages/ListPageProps';
19
- export * from './pages/ResponsivePage';
20
- export * from './pages/ResponsivePageProps';
21
- export * from './pages/SearchPageProps';
22
- export * from './pages/TablePage';
23
- export * from './pages/ViewPage';
11
+ export * from "./pages/CommonPage";
12
+ export * from "./pages/CommonPageProps";
13
+ export * from "./pages/DataGridPage";
14
+ export * from "./pages/DataGridPageProps";
15
+ export * from "./pages/DrawerHeader";
16
+ export * from "./pages/EditPage";
17
+ export * from "./pages/FixedListPage";
18
+ export * from "./pages/LeftDrawer";
19
+ export * from "./pages/ListPage";
20
+ export * from "./pages/ListPageProps";
21
+ export * from "./pages/ResponsivePage";
22
+ export * from "./pages/ResponsivePageProps";
23
+ export * from "./pages/SearchPageProps";
24
+ export * from "./pages/TablePage";
25
+ export * from "./pages/UserMenu";
26
+ export * from "./pages/ViewPage";
24
27
 
25
- export * from './texts/DateText';
26
- export * from './texts/MoneyText';
27
- export * from './texts/NumberText';
28
+ export * from "./texts/DateText";
29
+ export * from "./texts/MoneyText";
30
+ export * from "./texts/NumberText";
28
31
 
29
- export * from './AuditDisplay';
30
- export * from './AutocompleteExtendedProps';
31
- export * from './BackButton';
32
- export * from './BridgeCloseButton';
33
- export * from './ButtonLink';
34
- export * from './ComboBox';
35
- export * from './CountdownButton';
36
- export * from './CountryList';
37
- export * from './CustomFabProps';
38
- export * from './DataGridEx';
39
- export * from './DataGridRenderers';
40
- export * from './DataSteps';
41
- export * from './DialogButton';
42
- export * from './DnDList';
43
- export * from './DraggablePaperComponent';
44
- export * from './EmailInput';
45
- export * from './FabBox';
46
- export * from './FlexBox';
47
- export * from './GridDataFormat';
48
- export * from './HiSelector';
49
- export * from './IconButtonLink';
50
- export * from './InputField';
51
- export * from './ItemList';
52
- export * from './ListChooser';
53
- export * from './ListItemRightIcon';
54
- export * from './ListMoreDisplay';
55
- export * from './LoadingButton';
56
- export * from './MaskInput';
57
- export * from './MobileListItemRenderer';
58
- export * from './MoreFab';
59
- export * from './MUGlobal';
60
- export * from './NotifierMU';
61
- export * from './OptionGroup';
62
- export * from './PList';
63
- export * from './ProgressCount';
64
- export * from './PullToRefreshUI';
65
- export * from './ResponsibleContainer';
66
- export * from './ScrollerListEx';
67
- export * from './ScrollTopFab';
68
- export * from './SearchBar';
69
- export * from './SearchField';
70
- export * from './SearchOptionGroup';
71
- export * from './SelectBool';
72
- export * from './SelectEx';
73
- export * from './ShowDataComparison';
74
- export * from './Switch';
75
- export * from './SwitchAnt';
76
- export * from './TabBox';
77
- export * from './TableEx';
78
- export * from './TextFieldEx';
79
- export * from './Tiplist';
80
- export * from './TwoFieldInput';
81
- export * from './TooltipClick';
82
- export * from './UserAvatar';
83
- export * from './UserAvatarEditor';
32
+ export * from "./AuditDisplay";
33
+ export * from "./AutocompleteExtendedProps";
34
+ export * from "./BackButton";
35
+ export * from "./BridgeCloseButton";
36
+ export * from "./ButtonLink";
37
+ export * from "./ComboBox";
38
+ export * from "./CountdownButton";
39
+ export * from "./CountryList";
40
+ export * from "./CustomFabProps";
41
+ export * from "./DataGridEx";
42
+ export * from "./DataGridRenderers";
43
+ export * from "./DataSteps";
44
+ export * from "./DialogButton";
45
+ export * from "./DnDList";
46
+ export * from "./DraggablePaperComponent";
47
+ export * from "./EmailInput";
48
+ export * from "./FabBox";
49
+ export * from "./FlexBox";
50
+ export * from "./GridDataFormat";
51
+ export * from "./HiSelector";
52
+ export * from "./IconButtonLink";
53
+ export * from "./InputField";
54
+ export * from "./ItemList";
55
+ export * from "./ListChooser";
56
+ export * from "./ListItemRightIcon";
57
+ export * from "./ListMoreDisplay";
58
+ export * from "./LoadingButton";
59
+ export * from "./MaskInput";
60
+ export * from "./MobileListItemRenderer";
61
+ export * from "./MoreFab";
62
+ export * from "./MUGlobal";
63
+ export * from "./NotifierMU";
64
+ export * from "./OptionGroup";
65
+ export * from "./PList";
66
+ export * from "./ProgressCount";
67
+ export * from "./PullToRefreshUI";
68
+ export * from "./ResponsibleContainer";
69
+ export * from "./ScrollerListEx";
70
+ export * from "./ScrollTopFab";
71
+ export * from "./SearchBar";
72
+ export * from "./SearchField";
73
+ export * from "./SearchOptionGroup";
74
+ export * from "./SelectBool";
75
+ export * from "./SelectEx";
76
+ export * from "./ShowDataComparison";
77
+ export * from "./Switch";
78
+ export * from "./SwitchAnt";
79
+ export * from "./TabBox";
80
+ export * from "./TableEx";
81
+ export * from "./TextFieldEx";
82
+ export * from "./Tiplist";
83
+ export * from "./TwoFieldInput";
84
+ export * from "./TooltipClick";
85
+ export * from "./UserAvatar";
86
+ export * from "./UserAvatarEditor";
@@ -0,0 +1,14 @@
1
+ import { styled } from "@mui/material";
2
+
3
+ /**
4
+ * Common drawer header
5
+ */
6
+ export const DrawerHeader = styled("div")(({ theme }) => ({
7
+ // necessary for content to be below app bar
8
+ ...theme.mixins.toolbar,
9
+ display: "flex",
10
+ alignItems: "center",
11
+ gap: theme.spacing(1),
12
+ padding: theme.spacing(0, 1, 0, 2),
13
+ justifyContent: "flex-start"
14
+ }));
@@ -0,0 +1,119 @@
1
+ import {
2
+ Avatar,
3
+ Divider,
4
+ Drawer,
5
+ IconButton,
6
+ List,
7
+ Typography
8
+ } from "@mui/material";
9
+ import React, { PropsWithChildren } from "react";
10
+ import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
11
+ import { DrawerHeader } from "./DrawerHeader";
12
+ import { globalApp } from "../app/ReactApp";
13
+
14
+ /**
15
+ * Left drawer methods
16
+ */
17
+ export interface LeftDrawerMethods {
18
+ open(): void;
19
+ }
20
+
21
+ /**
22
+ * Left drawer props
23
+ */
24
+ export interface LeftDrawerProps {
25
+ /**
26
+ * Show when md up
27
+ */
28
+ mdUp: boolean;
29
+
30
+ /**
31
+ * Organization
32
+ */
33
+ organization?: number;
34
+
35
+ /**
36
+ * Width
37
+ */
38
+ width: number;
39
+
40
+ /**
41
+ * Application name
42
+ */
43
+ appName: string;
44
+
45
+ /**
46
+ * Minimize hanlder
47
+ */
48
+ onMinimize?: () => void;
49
+ }
50
+
51
+ export const LeftDrawer = React.forwardRef<
52
+ LeftDrawerMethods,
53
+ PropsWithChildren<LeftDrawerProps>
54
+ >((props, ref) => {
55
+ // Destruct
56
+ const { mdUp, width, appName, onMinimize, children } = props;
57
+
58
+ // Menu open/close state
59
+ const [open, setOpen] = React.useState<boolean>();
60
+
61
+ const handleDrawerClose = () => {
62
+ if (onMinimize) onMinimize();
63
+ setOpen(false);
64
+ };
65
+
66
+ React.useImperativeHandle(ref, () => ({
67
+ open() {
68
+ setOpen(true);
69
+ }
70
+ }));
71
+
72
+ // Ready
73
+ React.useEffect(() => {
74
+ setOpen(mdUp);
75
+ }, [mdUp]);
76
+
77
+ return (
78
+ <Drawer
79
+ sx={{
80
+ width: open ? width : 0,
81
+ flexShrink: 0,
82
+ "& .MuiDrawer-paper": {
83
+ width: open ? width : 0,
84
+ boxSizing: "border-box"
85
+ }
86
+ }}
87
+ anchor="left"
88
+ variant={mdUp ? "persistent" : "temporary"}
89
+ open={open}
90
+ onClose={mdUp ? undefined : handleDrawerClose}
91
+ ModalProps={{
92
+ keepMounted: true // Better open performance on mobile.
93
+ }}
94
+ >
95
+ <DrawerHeader>
96
+ <a
97
+ href="https://www.etsoo.com"
98
+ title={globalApp?.get("etsoo") ?? "ETSOO"}
99
+ target="_blank"
100
+ rel="noreferrer"
101
+ >
102
+ <Avatar
103
+ src={process.env.PUBLIC_URL + "/logo192.png"}
104
+ variant="square"
105
+ sx={{ marginLeft: -0.5, marginRight: 1.5, marginBottom: 1 }}
106
+ />
107
+ </a>
108
+ <Typography noWrap component="div" title={appName}>
109
+ {appName}
110
+ </Typography>
111
+ <IconButton size="small" onClick={handleDrawerClose}>
112
+ <ChevronLeftIcon />
113
+ </IconButton>
114
+ </DrawerHeader>
115
+ <Divider />
116
+ <List onClick={mdUp ? undefined : handleDrawerClose}>{children}</List>
117
+ </Drawer>
118
+ );
119
+ });
@@ -0,0 +1,111 @@
1
+ import { IconButton, Menu } from "@mui/material";
2
+ import React from "react";
3
+ import { UserAvatar } from "../UserAvatar";
4
+
5
+ /**
6
+ * User menu props
7
+ */
8
+ export interface UserMenuProps {
9
+ /**
10
+ * Organization id
11
+ */
12
+ organization: number | undefined;
13
+
14
+ /**
15
+ * User name
16
+ */
17
+ name: string;
18
+
19
+ /**
20
+ * User avatar
21
+ */
22
+ avatar: string | undefined;
23
+
24
+ /**
25
+ * Children
26
+ * @param handleMenuClose Handler
27
+ */
28
+ children(handleMenuClose: () => void): React.ReactNode;
29
+ }
30
+
31
+ /**
32
+ * User menu
33
+ * @param props Props
34
+ * @returns Component
35
+ */
36
+ export function UserMenu(props: UserMenuProps) {
37
+ // Destruct
38
+ const { children, name, avatar } = props;
39
+
40
+ // User menu anchor
41
+ const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement>();
42
+
43
+ // User menu open or not
44
+ const isMenuOpen = Boolean(anchorEl);
45
+
46
+ // User menu
47
+ const handleUserMenuOpen = (event: React.MouseEvent<HTMLButtonElement>) => {
48
+ setAnchorEl(event.currentTarget);
49
+ };
50
+
51
+ const handleMenuClose = () => {
52
+ setAnchorEl(undefined);
53
+ };
54
+
55
+ return (
56
+ <React.Fragment>
57
+ <IconButton
58
+ edge="end"
59
+ aria-haspopup="true"
60
+ onClick={handleUserMenuOpen}
61
+ color="inherit"
62
+ >
63
+ <UserAvatar title={name} src={avatar} />
64
+ </IconButton>
65
+ <Menu
66
+ PaperProps={{
67
+ elevation: 0,
68
+ sx: {
69
+ overflow: "visible",
70
+ filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
71
+ mt: -0.4,
72
+ "& .MuiAvatar-root": {
73
+ width: 32,
74
+ height: 32,
75
+ ml: -0.5,
76
+ mr: 1
77
+ },
78
+ "&:before": {
79
+ content: '""',
80
+ display: "block",
81
+ position: "absolute",
82
+ top: 0,
83
+ right: 14,
84
+ width: 10,
85
+ height: 10,
86
+ bgcolor: "background.paper",
87
+ transform: "translateY(-50%) rotate(45deg)",
88
+ zIndex: 0
89
+ }
90
+ }
91
+ }}
92
+ disableScrollLock
93
+ anchorEl={anchorEl}
94
+ anchorOrigin={{
95
+ vertical: "bottom",
96
+ horizontal: "right"
97
+ }}
98
+ keepMounted
99
+ transformOrigin={{
100
+ vertical: "top",
101
+ horizontal: "right"
102
+ }}
103
+ open={isMenuOpen}
104
+ onClick={handleMenuClose}
105
+ onClose={handleMenuClose}
106
+ >
107
+ {children(handleMenuClose)}
108
+ </Menu>
109
+ </React.Fragment>
110
+ );
111
+ }