@nethru/ui 2.1.0 → 2.1.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.
- package/base/AddableFormList.js +3 -2
- package/base/editor/Editor.js +8 -2
- package/base/index.js +0 -3
- package/base/styles/createTheme.js +2 -0
- package/base/styles/mui/inputAdornment.js +9 -0
- package/package.json +1 -1
- package/base/deprecated/AvatarDropdown.js +0 -80
- package/base/deprecated/GroupSelect.js +0 -67
- package/base/deprecated/StatusChip.js +0 -34
package/base/AddableFormList.js
CHANGED
|
@@ -8,6 +8,7 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
8
8
|
const AddableFormList = /*#__PURE__*/forwardRef(({
|
|
9
9
|
forms = [],
|
|
10
10
|
renderForm,
|
|
11
|
+
renderButton = () => [true, true],
|
|
11
12
|
onAdd,
|
|
12
13
|
onRemove,
|
|
13
14
|
readOnly,
|
|
@@ -33,7 +34,7 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
|
|
|
33
34
|
alignItems: "start",
|
|
34
35
|
gap: 1,
|
|
35
36
|
marginTop: `${margins[index > 0 ? 1 : 0]}px`,
|
|
36
|
-
children: [showRemoveButton && /*#__PURE__*/_jsx(Tooltip, {
|
|
37
|
+
children: [showRemoveButton && renderButton(form, index)[0] && /*#__PURE__*/_jsx(Tooltip, {
|
|
37
38
|
title: "\uC0AD\uC81C",
|
|
38
39
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
39
40
|
variant: "menu",
|
|
@@ -46,7 +47,7 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
|
|
|
46
47
|
}
|
|
47
48
|
})
|
|
48
49
|
})
|
|
49
|
-
}), showAddButton && /*#__PURE__*/_jsx(Tooltip, {
|
|
50
|
+
}), showAddButton && renderButton(form, index)[1] && /*#__PURE__*/_jsx(Tooltip, {
|
|
50
51
|
title: "\uCD94\uAC00",
|
|
51
52
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
52
53
|
variant: "menu",
|
package/base/editor/Editor.js
CHANGED
|
@@ -7,6 +7,8 @@ import { nScript } from './nScript';
|
|
|
7
7
|
import { Decoration, EditorView } from "@codemirror/view";
|
|
8
8
|
import { RegExpCursor, SearchCursor } from '@codemirror/search';
|
|
9
9
|
import { StateEffect, StateField } from "@codemirror/state";
|
|
10
|
+
import { keymap as keyMapper } from '@codemirror/view';
|
|
11
|
+
import { defaultKeymap } from '@codemirror/commands';
|
|
10
12
|
import borderRadius from "../styles/borderRadius";
|
|
11
13
|
import { blue, grey, red, yellow } from "../colors";
|
|
12
14
|
import typography from "../styles/typography";
|
|
@@ -19,6 +21,7 @@ export default function Editor({
|
|
|
19
21
|
error = false,
|
|
20
22
|
helperText,
|
|
21
23
|
basicSetup,
|
|
24
|
+
keymap = [],
|
|
22
25
|
extensions = [],
|
|
23
26
|
format = 'javascript',
|
|
24
27
|
keyword,
|
|
@@ -139,8 +142,11 @@ export default function Editor({
|
|
|
139
142
|
});
|
|
140
143
|
}
|
|
141
144
|
}, [format]);
|
|
145
|
+
const keymapExtension = useMemo(() => {
|
|
146
|
+
return [keyMapper.of(keymap), keyMapper.of(defaultKeymap)];
|
|
147
|
+
}, [keymap]);
|
|
142
148
|
const extensionList = useMemo(() => {
|
|
143
|
-
const result = [languageExtension, EditorView.lineWrapping, highlight.extension];
|
|
149
|
+
const result = [languageExtension, EditorView.lineWrapping, highlight.extension, ...keymapExtension];
|
|
144
150
|
if (onScroll) {
|
|
145
151
|
result.push(EditorView.domEventHandlers({
|
|
146
152
|
scroll(event, view) {
|
|
@@ -151,7 +157,7 @@ export default function Editor({
|
|
|
151
157
|
}
|
|
152
158
|
result.push(...extensions);
|
|
153
159
|
return result;
|
|
154
|
-
}, [languageExtension, highlight.extension, extensions, onScroll]);
|
|
160
|
+
}, [languageExtension, highlight.extension, keymapExtension, extensions, onScroll]);
|
|
155
161
|
const handleUpdate = viewUpdate => {
|
|
156
162
|
setFocused(viewUpdate.view.hasFocus);
|
|
157
163
|
if (onUpdate) onUpdate(viewUpdate);
|
package/base/index.js
CHANGED
|
@@ -42,15 +42,12 @@ export * from './frame/sidebar/SidebarContext';
|
|
|
42
42
|
export { default as Error } from "./error/Error";
|
|
43
43
|
export { default as HttpError } from "./error/HttpError";
|
|
44
44
|
export { default as AppendableFormList } from "./deprecated/AppendableFormList";
|
|
45
|
-
export { default as AvatarDropdown } from "./deprecated/AvatarDropdown";
|
|
46
45
|
export { default as CircularProgress } from "./deprecated/CircularProgress";
|
|
47
46
|
export { default as FormLabel } from "./deprecated/FormLabel";
|
|
48
|
-
export { default as GroupSelect } from "./deprecated/GroupSelect";
|
|
49
47
|
export { default as ListItem } from "./deprecated/ListItem";
|
|
50
48
|
export { default as ListItemDivider } from "./deprecated/ListItemDivider";
|
|
51
49
|
export { default as ListItemGrid } from "./deprecated/ListItemGrid";
|
|
52
50
|
export { default as ListItemText } from "./deprecated/ListItemText";
|
|
53
51
|
export { default as ShadowedSection } from "./deprecated/ShadowedSection";
|
|
54
|
-
export { default as StatusChip } from "./deprecated/StatusChip";
|
|
55
52
|
export { default as TabbedSection } from "./deprecated/TabbedSection";
|
|
56
53
|
export { default as Tabs } from "./deprecated/Tabs";
|
|
@@ -22,6 +22,7 @@ import * as formLabel from "./mui/formLabel";
|
|
|
22
22
|
import * as outlinedInput from "./mui/outlinedInput";
|
|
23
23
|
import * as formHelperText from "./mui/formHelperText";
|
|
24
24
|
import * as inputLabel from "./mui/inputLabel";
|
|
25
|
+
import * as inputAdornment from "./mui/inputAdornment";
|
|
25
26
|
import * as popover from "./mui/popover";
|
|
26
27
|
import * as paper from "./mui/paper";
|
|
27
28
|
import * as list from "./mui/list";
|
|
@@ -72,6 +73,7 @@ export default function createTheme() {
|
|
|
72
73
|
MuiFormControlLabel: formControlLabel.styles,
|
|
73
74
|
MuiFormLabel: formLabel.styles,
|
|
74
75
|
MuiInputLabel: inputLabel.styles,
|
|
76
|
+
MuiInputAdornment: inputAdornment.styles,
|
|
75
77
|
MuiOutlinedInput: outlinedInput.styles,
|
|
76
78
|
MuiFormHelperText: formHelperText.styles,
|
|
77
79
|
MuiPopover: popover.styles,
|
package/package.json
CHANGED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { useMemo, useState } from 'react';
|
|
2
|
-
import { Avatar, Box, IconButton } from '@mui/material';
|
|
3
|
-
import Menu from '@mui/material/Menu';
|
|
4
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
5
|
-
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
6
|
-
import Divider from '@mui/material/Divider';
|
|
7
|
-
import LogoutRoundedIcon from '@mui/icons-material/LogoutRounded';
|
|
8
|
-
import { red } from '@mui/material/colors';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
export default function AvatarDropdown({
|
|
12
|
-
name,
|
|
13
|
-
color,
|
|
14
|
-
bgcolor,
|
|
15
|
-
children,
|
|
16
|
-
onProfileClick,
|
|
17
|
-
onLogoutClick,
|
|
18
|
-
...props
|
|
19
|
-
}) {
|
|
20
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
21
|
-
const open = Boolean(anchorEl);
|
|
22
|
-
const firstLetter = useMemo(() => {
|
|
23
|
-
return name && name.length > 0 ? name[0].toUpperCase() : "?";
|
|
24
|
-
}, [name]);
|
|
25
|
-
const handleClick = event => setAnchorEl(event.currentTarget);
|
|
26
|
-
const handleClose = () => setAnchorEl(null);
|
|
27
|
-
const styles = {
|
|
28
|
-
color: color ? color : '#fff',
|
|
29
|
-
bgcolor: bgcolor ? bgcolor : red[900],
|
|
30
|
-
width: 32,
|
|
31
|
-
height: 32,
|
|
32
|
-
fontSize: 16
|
|
33
|
-
};
|
|
34
|
-
return /*#__PURE__*/_jsxs(Box, {
|
|
35
|
-
...props,
|
|
36
|
-
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
37
|
-
onClick: handleClick,
|
|
38
|
-
size: "small",
|
|
39
|
-
sx: {
|
|
40
|
-
ml: 2
|
|
41
|
-
},
|
|
42
|
-
children: /*#__PURE__*/_jsx(Avatar, {
|
|
43
|
-
sx: styles,
|
|
44
|
-
children: firstLetter
|
|
45
|
-
})
|
|
46
|
-
}), /*#__PURE__*/_jsxs(Menu, {
|
|
47
|
-
anchorEl: anchorEl,
|
|
48
|
-
open: open,
|
|
49
|
-
onClose: handleClose,
|
|
50
|
-
onClick: handleClose,
|
|
51
|
-
sx: {
|
|
52
|
-
'.MuiButtonBase-root.MuiMenuItem-root': {
|
|
53
|
-
fontSize: 14
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
children: [/*#__PURE__*/_jsxs(MenuItem, {
|
|
57
|
-
onClick: onProfileClick,
|
|
58
|
-
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
59
|
-
children: /*#__PURE__*/_jsx(Avatar, {
|
|
60
|
-
sx: {
|
|
61
|
-
...styles,
|
|
62
|
-
mr: 1,
|
|
63
|
-
fontSize: 13,
|
|
64
|
-
width: 22,
|
|
65
|
-
height: 22
|
|
66
|
-
},
|
|
67
|
-
children: firstLetter
|
|
68
|
-
})
|
|
69
|
-
}), name]
|
|
70
|
-
}), /*#__PURE__*/_jsx(Divider, {}), children, children && /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(MenuItem, {
|
|
71
|
-
onClick: onLogoutClick,
|
|
72
|
-
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
73
|
-
children: /*#__PURE__*/_jsx(LogoutRoundedIcon, {
|
|
74
|
-
fontSize: "small"
|
|
75
|
-
})
|
|
76
|
-
}), "\uB85C\uADF8\uC544\uC6C3"]
|
|
77
|
-
})]
|
|
78
|
-
})]
|
|
79
|
-
});
|
|
80
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Autocomplete, TextField } from "@mui/material";
|
|
2
|
-
import Paper from "@mui/material/Paper";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
export default function GroupSelect({
|
|
5
|
-
id,
|
|
6
|
-
options,
|
|
7
|
-
groupKey,
|
|
8
|
-
value,
|
|
9
|
-
onSelect,
|
|
10
|
-
placeholder,
|
|
11
|
-
disableClearable = false,
|
|
12
|
-
sx,
|
|
13
|
-
...props
|
|
14
|
-
}) {
|
|
15
|
-
const styles = {
|
|
16
|
-
'.MuiInputLabel-root, .MuiInputBase-input': {
|
|
17
|
-
fontSize: '0.875rem'
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const paperStyles = {
|
|
21
|
-
'& .MuiAutocomplete-groupLabel': {
|
|
22
|
-
fontSize: '0.8rem',
|
|
23
|
-
paddingTop: 0,
|
|
24
|
-
paddingBottom: 0
|
|
25
|
-
},
|
|
26
|
-
'& .MuiAutocomplete-option': {
|
|
27
|
-
color: '#333',
|
|
28
|
-
fontSize: '0.875rem',
|
|
29
|
-
paddingTop: '3px',
|
|
30
|
-
paddingBottom: '3px'
|
|
31
|
-
},
|
|
32
|
-
'& .MuiAutocomplete-noOptions': {
|
|
33
|
-
fontSize: '0.8rem'
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const handleSelect = (event, value, reason) => {
|
|
37
|
-
if (reason !== 'selectOption') return;
|
|
38
|
-
if (onSelect) onSelect(id, value);
|
|
39
|
-
};
|
|
40
|
-
function CustomPaper(props) {
|
|
41
|
-
return /*#__PURE__*/_jsx(Paper, {
|
|
42
|
-
...props,
|
|
43
|
-
sx: paperStyles
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return /*#__PURE__*/_jsx(Autocomplete, {
|
|
47
|
-
id: id,
|
|
48
|
-
size: "small",
|
|
49
|
-
options: options,
|
|
50
|
-
groupBy: option => option[groupKey],
|
|
51
|
-
value: value,
|
|
52
|
-
onChange: handleSelect,
|
|
53
|
-
blurOnSelect: true,
|
|
54
|
-
disableClearable: disableClearable,
|
|
55
|
-
noOptionsText: "\uC77C\uCE58\uD558\uB294 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
56
|
-
PaperComponent: CustomPaper,
|
|
57
|
-
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
58
|
-
...params,
|
|
59
|
-
label: placeholder
|
|
60
|
-
}),
|
|
61
|
-
sx: {
|
|
62
|
-
...sx,
|
|
63
|
-
...styles
|
|
64
|
-
},
|
|
65
|
-
...props
|
|
66
|
-
});
|
|
67
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Chip } from "@mui/material";
|
|
2
|
-
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
|
3
|
-
import ErrorIcon from "@mui/icons-material/Error";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export default function StatusChip({
|
|
6
|
-
id,
|
|
7
|
-
label,
|
|
8
|
-
status,
|
|
9
|
-
onOperate,
|
|
10
|
-
sx,
|
|
11
|
-
...props
|
|
12
|
-
}) {
|
|
13
|
-
const styles = {
|
|
14
|
-
'&': {
|
|
15
|
-
bgcolor: status === 'normal' ? '#4caf50' : '#fff'
|
|
16
|
-
},
|
|
17
|
-
'.MuiSvgIcon-root.MuiChip-deleteIcon': {
|
|
18
|
-
cursor: onOperate ? 'pointer' : 'default'
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return /*#__PURE__*/_jsx(Chip, {
|
|
22
|
-
id: id,
|
|
23
|
-
label: label,
|
|
24
|
-
variant: status === 'normal' ? 'filled' : 'outlined',
|
|
25
|
-
color: status === 'normal' ? 'success' : 'default',
|
|
26
|
-
deleteIcon: status === 'normal' ? /*#__PURE__*/_jsx(CheckCircleIcon, {}) : /*#__PURE__*/_jsx(ErrorIcon, {}),
|
|
27
|
-
onDelete: _ => onOperate && onOperate(id, status),
|
|
28
|
-
sx: {
|
|
29
|
-
...sx,
|
|
30
|
-
...styles
|
|
31
|
-
},
|
|
32
|
-
...props
|
|
33
|
-
});
|
|
34
|
-
}
|