pankosmia-rcl 0.0.8 → 0.0.10
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/build/pankosmia-rcl.es.js +6957 -44226
- package/build/pankosmia-rcl.umd.js +57 -245
- package/package.json +1 -1
- package/rclStash/DrawerComponent.jsx +128 -0
- package/rclStash/PanDialog.jsx +31 -0
- package/rclStash/PanDialogActions.jsx +11 -0
- package/rclStash/PanDialogButton.jsx +20 -0
- package/rclStash/PanDialogContent.jsx +13 -0
- package/rclStash/PanDialogDefault.jsx +16 -0
- package/vite.config.js +2 -2
package/package.json
CHANGED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Drawer,
|
|
5
|
+
Stack,
|
|
6
|
+
IconButton,
|
|
7
|
+
List,
|
|
8
|
+
ListItem,
|
|
9
|
+
ListItemButton, ListItemText,
|
|
10
|
+
Switch,
|
|
11
|
+
Collapse
|
|
12
|
+
} from "@mui/material";
|
|
13
|
+
import MenuIcon from "@mui/icons-material/Menu";
|
|
14
|
+
import ExpandLess from '@mui/icons-material/ExpandLess';
|
|
15
|
+
import ExpandMore from '@mui/icons-material/ExpandMore';
|
|
16
|
+
|
|
17
|
+
import {i18nContext, netContext, debugContext, doI18n} from "pithekos-lib";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export default function DrawerComponent({drawerIsOpen, setDrawerIsOpen, menuItems, toggleDebug, showAdvanced, setShowAdvanced, drawerWidth, measurementRef }) {
|
|
21
|
+
|
|
22
|
+
const {i18nRef} = useContext(i18nContext);
|
|
23
|
+
const {enabledRef} = useContext(netContext);
|
|
24
|
+
const {debugRef} = useContext(debugContext);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Box sx={{m: 0, mr: 2}}>
|
|
28
|
+
<IconButton onClick={e => setDrawerIsOpen(true)}>
|
|
29
|
+
<MenuIcon />
|
|
30
|
+
</IconButton>
|
|
31
|
+
<Drawer
|
|
32
|
+
open={drawerIsOpen}
|
|
33
|
+
onClose={() => setDrawerIsOpen(false)}
|
|
34
|
+
slotProps={{ paper: { sx: { width: drawerWidth, overflow: 'hidden' } } }}
|
|
35
|
+
>
|
|
36
|
+
<Box sx={{width: "100%", minHeight: '98vh', m: 0, p: 0}} role="presentation">
|
|
37
|
+
<List sx={{ height: '100%', width: '100%' }}>
|
|
38
|
+
<Stack
|
|
39
|
+
direction="column"
|
|
40
|
+
spacing={0}
|
|
41
|
+
sx={{
|
|
42
|
+
height: '100%',
|
|
43
|
+
width: '100%',
|
|
44
|
+
justifyContent: "space-between",
|
|
45
|
+
alignItems: "flex-start",
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<Box sx={{width: '100%'}}>
|
|
49
|
+
{
|
|
50
|
+
menuItems
|
|
51
|
+
.map(
|
|
52
|
+
(mi, n) => /* mi.id === currentId ?
|
|
53
|
+
<ListItem key={n} disablePadding onClick={() => setDrawerIsOpen(false)}>
|
|
54
|
+
<ListItemButton selected={true} >
|
|
55
|
+
<ListItemText
|
|
56
|
+
primary={doI18n(`pages:${mi.id}:title`, i18nRef.current)}/>
|
|
57
|
+
</ListItemButton>
|
|
58
|
+
</ListItem> : */
|
|
59
|
+
<ListItem key={n} disablePadding>
|
|
60
|
+
<ListItemButton
|
|
61
|
+
disabled={mi.requires.net && !enabledRef.current}
|
|
62
|
+
onClick={() => {
|
|
63
|
+
window.location.href = mi.url
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<ListItemText
|
|
67
|
+
primary={doI18n(`pages:${mi.id}:title`, i18nRef.current)}/>
|
|
68
|
+
</ListItemButton>
|
|
69
|
+
</ListItem>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
</Box>
|
|
73
|
+
<Box>
|
|
74
|
+
<ListItem disablePadding >
|
|
75
|
+
<ListItemButton
|
|
76
|
+
/* selected={currentId.includes("settings")} */
|
|
77
|
+
onClick={ () => { window.location.href = "/clients/settings" }}
|
|
78
|
+
>
|
|
79
|
+
<ListItemText primary={doI18n("pages:core-settings:title", i18nRef.current)}/>
|
|
80
|
+
</ListItemButton>
|
|
81
|
+
</ListItem>
|
|
82
|
+
<ListItem sx={{width: drawerWidth}} disablePadding>
|
|
83
|
+
<ListItemButton onClick={() => setShowAdvanced(a => !a)}>
|
|
84
|
+
<ListItemText primary={doI18n(`components:header:advanced`, i18nRef.current)} />
|
|
85
|
+
{showAdvanced ? <ExpandLess /> : <ExpandMore />}
|
|
86
|
+
</ListItemButton>
|
|
87
|
+
</ListItem>
|
|
88
|
+
<Collapse in={showAdvanced} timeout="auto" unmountOnExit>
|
|
89
|
+
<List component="div" disablePadding>
|
|
90
|
+
<ListItemButton onClick={toggleDebug} sx={{ pl:4 }}>
|
|
91
|
+
<ListItemText primary={doI18n(`components:header:experimental_mode`, i18nRef.current)} />
|
|
92
|
+
<Switch
|
|
93
|
+
edge="end"
|
|
94
|
+
onChange={toggleDebug}
|
|
95
|
+
checked={debugRef.current}
|
|
96
|
+
/>
|
|
97
|
+
</ListItemButton>
|
|
98
|
+
</List>
|
|
99
|
+
</Collapse>
|
|
100
|
+
<Box
|
|
101
|
+
ref={measurementRef}
|
|
102
|
+
sx={{
|
|
103
|
+
visibility: 'hidden',
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
whiteSpace: 'nowrap',
|
|
106
|
+
top: 0,
|
|
107
|
+
left: 0,
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
<List component="div" disablePadding>
|
|
111
|
+
<ListItemButton onClick={toggleDebug} sx={{ pl:4 }}>
|
|
112
|
+
<ListItemText primary={doI18n(`components:header:experimental_mode`, i18nRef.current)} />
|
|
113
|
+
<Switch
|
|
114
|
+
edge="end"
|
|
115
|
+
onChange={toggleDebug}
|
|
116
|
+
checked={debugRef.current}
|
|
117
|
+
/>
|
|
118
|
+
</ListItemButton>
|
|
119
|
+
</List>
|
|
120
|
+
</Box>
|
|
121
|
+
</Box>
|
|
122
|
+
</Stack>
|
|
123
|
+
</List>
|
|
124
|
+
</Box>
|
|
125
|
+
</Drawer>
|
|
126
|
+
</Box>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AppBar, Dialog, Toolbar, Typography } from "@mui/material";
|
|
2
|
+
import { i18nContext, doI18n } from "pithekos-lib";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import PanDialogActions from "./PanDialogActions";
|
|
5
|
+
import PanDialogContent from "./PanDialogContent";
|
|
6
|
+
|
|
7
|
+
export default function PanDialog({ open, closeFn,children,createButtonDisabled=false }) {
|
|
8
|
+
const { i18nRef } = useContext(i18nContext);
|
|
9
|
+
return <Dialog
|
|
10
|
+
open={open}
|
|
11
|
+
onClose={closeFn}
|
|
12
|
+
slotProps={{
|
|
13
|
+
paper: {
|
|
14
|
+
component: 'form',
|
|
15
|
+
},
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<AppBar color='secondary' sx={{ position: 'relative', borderTopLeftRadius: 4, borderTopRightRadius: 4 }}>
|
|
19
|
+
<Toolbar>
|
|
20
|
+
<Typography variant="h6" component="div">
|
|
21
|
+
{doI18n("pages:content:restore_content", i18nRef.current)}
|
|
22
|
+
</Typography>
|
|
23
|
+
|
|
24
|
+
</Toolbar>
|
|
25
|
+
</AppBar>
|
|
26
|
+
<PanDialogContent>
|
|
27
|
+
{children}
|
|
28
|
+
</PanDialogContent>
|
|
29
|
+
<PanDialogActions closeFn={closeFn} createButtonDisabled={createButtonDisabled} />
|
|
30
|
+
</Dialog>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DialogActions } from "@mui/material";
|
|
2
|
+
import PanDialogButton from "./PanDialogButton";
|
|
3
|
+
|
|
4
|
+
export default function PanDialogActions ({closeFn,createButtonDisabled}) {
|
|
5
|
+
return <>
|
|
6
|
+
<DialogActions>
|
|
7
|
+
<PanDialogButton closeFn={closeFn} createButtonDisabled={createButtonDisabled}/>
|
|
8
|
+
</DialogActions>
|
|
9
|
+
</>
|
|
10
|
+
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Button } from "@mui/material";
|
|
2
|
+
import { i18nContext, doI18n } from "pithekos-lib";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
|
|
5
|
+
export default function PanDialogButton ({closeFn,createButtonDisabled}) {
|
|
6
|
+
const { i18nRef } = useContext(i18nContext);
|
|
7
|
+
return <>
|
|
8
|
+
<Button onClick={closeFn}>
|
|
9
|
+
{doI18n("pages:content:cancel", i18nRef.current)}
|
|
10
|
+
</Button>
|
|
11
|
+
<Button
|
|
12
|
+
variant='contained'
|
|
13
|
+
color="primary"
|
|
14
|
+
onClick={() => {
|
|
15
|
+
closeFn();
|
|
16
|
+
}}
|
|
17
|
+
disabled={createButtonDisabled}
|
|
18
|
+
>{doI18n("pages:content:accept", i18nRef.current)}</Button>
|
|
19
|
+
</>
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DialogContent, DialogContentText, Typography } from "@mui/material";
|
|
2
|
+
import { i18nContext, doI18n } from "pithekos-lib";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
export default function PanDialogContent({children}) {
|
|
5
|
+
const { i18nRef } = useContext(i18nContext);
|
|
6
|
+
return <>
|
|
7
|
+
<DialogContent>
|
|
8
|
+
<DialogContentText>
|
|
9
|
+
{children}
|
|
10
|
+
</DialogContentText>
|
|
11
|
+
</DialogContent>
|
|
12
|
+
</>
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AppBar, Dialog, Toolbar, Typography } from "@mui/material";
|
|
2
|
+
import { i18nContext, doI18n } from "pithekos-lib";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import PanDialogActions from "./PanDialogActions";
|
|
5
|
+
import PanDialogContent from "./PanDialogContent";
|
|
6
|
+
import PanDialog from "./PanDialog";
|
|
7
|
+
|
|
8
|
+
export default function PanDialogDefault({ open, closeFn,children,createButtonDisabled=false }) {
|
|
9
|
+
|
|
10
|
+
return <PanDialog>
|
|
11
|
+
<PanDialogContent>
|
|
12
|
+
{children}
|
|
13
|
+
</PanDialogContent>
|
|
14
|
+
<PanDialogActions closeFn={closeFn} createButtonDisabled={createButtonDisabled} />
|
|
15
|
+
</PanDialog>;
|
|
16
|
+
}
|
package/vite.config.js
CHANGED
|
@@ -17,10 +17,10 @@ export default defineConfig({
|
|
|
17
17
|
emptyOutDir: true,
|
|
18
18
|
rollupOptions: {
|
|
19
19
|
external: ["react", "react-dom"],
|
|
20
|
-
output: {
|
|
20
|
+
/* output: {
|
|
21
21
|
name: "pankosmia-rcl",
|
|
22
22
|
globals: { 'react': 'React', 'react-dom': 'ReactDom' }
|
|
23
|
-
}
|
|
23
|
+
}*/
|
|
24
24
|
},
|
|
25
25
|
lib: {
|
|
26
26
|
entry: path.resolve(__dirname, './src/rcl/index.js'),
|