@gridsuite/commons-ui 0.36.1 → 0.38.0
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/ElementSearchDialog/element-search-dialog.js +7 -3
- package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +13 -18
- package/es/components/TopBar/TopBar.js +1 -1
- package/es/components/images/powsybl_logo.svg +0 -0
- package/es/components/react-hook-form/utils/cancel-button.js +26 -0
- package/es/index.js +1 -0
- package/es/utils/ElementType.js +7 -1
- package/package.json +1 -1
|
@@ -84,9 +84,13 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
|
|
|
84
84
|
handleSearchTermChange(value);
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
-
onChange: function onChange(_event, newValue) {
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
onChange: function onChange(_event, newValue, reason) {
|
|
88
|
+
if (reason === 'selectOption') {
|
|
89
|
+
onSelectionChange(newValue);
|
|
90
|
+
setValue(newValue);
|
|
91
|
+
} else {
|
|
92
|
+
setValue(null);
|
|
93
|
+
}
|
|
90
94
|
},
|
|
91
95
|
getOptionLabel: function getOptionLabel(option) {
|
|
92
96
|
return option.label;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { Dialog, DialogContent,
|
|
8
|
+
import { Dialog, DialogContent, List } from '@mui/material';
|
|
9
9
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
11
11
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
@@ -43,33 +43,32 @@ var MultipleSelectionDialog = function MultipleSelectionDialog(_ref) {
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
46
|
-
open: open
|
|
47
|
-
fullWidth: true,
|
|
48
|
-
maxWidth: 'lg'
|
|
46
|
+
open: open
|
|
49
47
|
}, /*#__PURE__*/React.createElement(DialogTitle, null, titleId), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(Grid, {
|
|
50
48
|
container: true,
|
|
51
|
-
spacing: 2
|
|
49
|
+
spacing: 2,
|
|
50
|
+
flexDirection: "column"
|
|
52
51
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
53
|
-
item: true
|
|
54
|
-
|
|
55
|
-
}, /*#__PURE__*/React.createElement(Divider, null, /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
52
|
+
item: true
|
|
53
|
+
}, /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
56
54
|
label: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
57
55
|
id: 'multiple_selection_dialog/selectAll'
|
|
58
56
|
}),
|
|
59
57
|
control: /*#__PURE__*/React.createElement(Checkbox, {
|
|
60
58
|
checked: selectedIds.length === options.length,
|
|
61
|
-
indeterminate: selectedIds.length && selectedIds.length !== options.length,
|
|
59
|
+
indeterminate: !!selectedIds.length && selectedIds.length !== options.length,
|
|
62
60
|
onChange: handleSelectAll
|
|
63
61
|
})
|
|
64
|
-
}))
|
|
62
|
+
})), /*#__PURE__*/React.createElement(Grid, {
|
|
63
|
+
item: true
|
|
64
|
+
}, /*#__PURE__*/React.createElement(List, null, options.map(function (option) {
|
|
65
65
|
var _option$id;
|
|
66
66
|
var optionId = (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option;
|
|
67
67
|
var label = getOptionLabel(option);
|
|
68
68
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
69
69
|
key: optionId
|
|
70
70
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
71
|
-
item: true
|
|
72
|
-
xs: 4
|
|
71
|
+
item: true
|
|
73
72
|
}, /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
74
73
|
label: label,
|
|
75
74
|
control: /*#__PURE__*/React.createElement(Checkbox, {
|
|
@@ -78,12 +77,8 @@ var MultipleSelectionDialog = function MultipleSelectionDialog(_ref) {
|
|
|
78
77
|
return handleOptionSelection(optionId);
|
|
79
78
|
}
|
|
80
79
|
})
|
|
81
|
-
}))
|
|
82
|
-
|
|
83
|
-
xs: 12,
|
|
84
|
-
key: index
|
|
85
|
-
}, /*#__PURE__*/React.createElement(Divider, null)));
|
|
86
|
-
}))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
80
|
+
})));
|
|
81
|
+
}))))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
87
82
|
onClick: function onClick() {
|
|
88
83
|
return handleClose();
|
|
89
84
|
}
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '@mui/material';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
var CancelButton = function CancelButton(_ref) {
|
|
6
|
+
var onClick = _ref.onClick,
|
|
7
|
+
variant = _ref.variant,
|
|
8
|
+
disabled = _ref.disabled,
|
|
9
|
+
_ref$withCustomColor = _ref.withCustomColor,
|
|
10
|
+
withCustomColor = _ref$withCustomColor === void 0 ? true : _ref$withCustomColor;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
12
|
+
onClick: onClick,
|
|
13
|
+
variant: variant,
|
|
14
|
+
disabled: disabled,
|
|
15
|
+
color: withCustomColor ? 'customButton' : 'primary'
|
|
16
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
17
|
+
id: "cancel"
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
CancelButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
21
|
+
onClick: PropTypes.func.isRequired,
|
|
22
|
+
variant: PropTypes.string,
|
|
23
|
+
disabled: PropTypes.bool,
|
|
24
|
+
withCustomColor: PropTypes.bool
|
|
25
|
+
} : {};
|
|
26
|
+
export default CancelButton;
|
package/es/index.js
CHANGED
|
@@ -64,4 +64,5 @@ export { default as MidFormError } from './components/react-hook-form/error-mana
|
|
|
64
64
|
export { default as TextFieldWithAdornment } from './components/react-hook-form/utils/text-field-with-adornment';
|
|
65
65
|
export { default as FieldLabel } from './components/react-hook-form/utils/field-label';
|
|
66
66
|
export { default as SubmitButton } from './components/react-hook-form/utils/submit-button';
|
|
67
|
+
export { default as CancelButton } from './components/react-hook-form/utils/cancel-button';
|
|
67
68
|
export { genHelperPreviousValue, genHelperError, identity, isFieldRequired } from './components/react-hook-form/utils/functions';
|
package/es/utils/ElementType.js
CHANGED
|
@@ -8,11 +8,13 @@ import React from 'react';
|
|
|
8
8
|
import LibraryBooksOutlinedIcon from '@mui/icons-material/LibraryBooksOutlined';
|
|
9
9
|
import OfflineBoltIcon from '@mui/icons-material/OfflineBolt';
|
|
10
10
|
import ArticleIcon from '@mui/icons-material/Article';
|
|
11
|
+
import SettingsIcon from '@mui/icons-material/Settings';
|
|
11
12
|
export var elementType = {
|
|
12
13
|
DIRECTORY: 'DIRECTORY',
|
|
13
14
|
STUDY: 'STUDY',
|
|
14
15
|
FILTER: 'FILTER',
|
|
15
|
-
CONTINGENCY_LIST: 'CONTINGENCY_LIST'
|
|
16
|
+
CONTINGENCY_LIST: 'CONTINGENCY_LIST',
|
|
17
|
+
VOLTAGE_INIT_PARAMETERS: 'VOLTAGE_INIT_PARAMETERS'
|
|
16
18
|
};
|
|
17
19
|
export function getFileIcon(type, style) {
|
|
18
20
|
switch (type) {
|
|
@@ -28,6 +30,10 @@ export function getFileIcon(type, style) {
|
|
|
28
30
|
return /*#__PURE__*/React.createElement(ArticleIcon, {
|
|
29
31
|
sx: style
|
|
30
32
|
});
|
|
33
|
+
case elementType.VOLTAGE_INIT_PARAMETERS:
|
|
34
|
+
return /*#__PURE__*/React.createElement(SettingsIcon, {
|
|
35
|
+
sx: style
|
|
36
|
+
});
|
|
31
37
|
case elementType.DIRECTORY:
|
|
32
38
|
// to easily use in TreeView we do not give icons for directories
|
|
33
39
|
return;
|