ish-ui 1.0.26 → 1.0.28
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { MessageProps } from '../../model/Message';
|
|
3
|
+
declare const Message: ({ opened, text, clearMessage, success, persist }: MessageProps) => React.JSX.Element;
|
|
4
|
+
export default Message;
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { withStyles } from '@mui/styles';
|
|
8
7
|
import Snackbar from '@mui/material/Snackbar';
|
|
9
8
|
import IconButton from '@mui/material/IconButton';
|
|
10
9
|
import Alert from '@mui/material/Alert';
|
|
11
10
|
import CloseIcon from '@mui/icons-material/Close';
|
|
12
|
-
|
|
11
|
+
import { makeAppStyles } from '../../styles';
|
|
12
|
+
const useStyles = makeAppStyles((theme) => ({
|
|
13
13
|
close: {
|
|
14
14
|
color: theme.palette.primary.contrastText,
|
|
15
15
|
width: theme.spacing(4),
|
|
@@ -38,54 +38,34 @@ const styles = theme => ({
|
|
|
38
38
|
marginRight: theme.spacing(-2),
|
|
39
39
|
paddingRight: theme.spacing(2)
|
|
40
40
|
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.props.clearMessage();
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
this.state = {
|
|
51
|
-
success: props.isSuccess,
|
|
52
|
-
text: props.text,
|
|
53
|
-
persist: props.persist
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
componentDidUpdate(prevProps) {
|
|
57
|
-
if (this.props.opened !== prevProps.opened) {
|
|
58
|
-
this.setState({
|
|
59
|
-
success: this.props.opened ? this.props.isSuccess : this.state.success,
|
|
60
|
-
text: this.props.opened ? this.props.text : this.state.text,
|
|
61
|
-
persist: this.props.opened ? this.props.persist : this.state.persist
|
|
62
|
-
});
|
|
41
|
+
}));
|
|
42
|
+
const Message = ({ opened, text, clearMessage, success, persist }) => {
|
|
43
|
+
const classes = useStyles();
|
|
44
|
+
const handleClose = () => {
|
|
45
|
+
if (!persist && clearMessage) {
|
|
46
|
+
clearMessage();
|
|
63
47
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
root: classes.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
React.createElement(CloseIcon, null))) }, text)));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
export default withStyles(styles)(Message);
|
|
48
|
+
};
|
|
49
|
+
return (React.createElement(Snackbar, { open: opened, anchorOrigin: {
|
|
50
|
+
vertical: 'bottom',
|
|
51
|
+
horizontal: 'left'
|
|
52
|
+
}, classes: {
|
|
53
|
+
root: classes.autoWidthRoot
|
|
54
|
+
}, ContentProps: {
|
|
55
|
+
classes: {
|
|
56
|
+
root: clsx(classes.autoWidth, {
|
|
57
|
+
[classes.success]: success
|
|
58
|
+
}),
|
|
59
|
+
message: persist ? classes.fullScreenMessage : undefined
|
|
60
|
+
}
|
|
61
|
+
}, ClickAwayListenerProps: {
|
|
62
|
+
onClickAway: handleClose
|
|
63
|
+
}, autoHideDuration: persist ? null : 6000, onClose: handleClose, disableWindowBlurListener: persist },
|
|
64
|
+
React.createElement(Alert, { variant: "filled", severity: success ? 'success' : 'error', classes: {
|
|
65
|
+
message: 'text-pre-wrap',
|
|
66
|
+
standardError: 'errorBackgroundColor',
|
|
67
|
+
standardSuccess: 'successBackgroundColor'
|
|
68
|
+
}, action: (React.createElement(IconButton, { key: "close", "aria-label": "Close", color: "inherit", className: classes.close, onClick: clearMessage },
|
|
69
|
+
React.createElement(CloseIcon, null))) }, text)));
|
|
70
|
+
};
|
|
71
|
+
export default Message;
|
|
@@ -208,7 +208,7 @@ function EditInPlaceSearchSelect({ label, disabled, className, labelAdornment, i
|
|
|
208
208
|
const getOptionLabel = option => (selectLabelCondition ? selectLabelCondition(option) : option && option[selectLabelMark]) || '';
|
|
209
209
|
const getOptionSelected = (option, value) => {
|
|
210
210
|
if (multiple || returnType === 'object') {
|
|
211
|
-
return option[selectValueMark] === value[selectValueMark];
|
|
211
|
+
return value && (option[selectValueMark] === value[selectValueMark]);
|
|
212
212
|
}
|
|
213
213
|
return option[selectValueMark] === value;
|
|
214
214
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright ish group pty ltd 2023.
|
|
3
|
+
*
|
|
4
|
+
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
5
|
+
*
|
|
6
|
+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|