@gridsuite/commons-ui 0.35.6 → 0.36.1
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.
|
@@ -21,32 +21,51 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
|
|
|
21
21
|
elementsFound = props.elementsFound,
|
|
22
22
|
renderElement = props.renderElement,
|
|
23
23
|
searchTermDisabled = props.searchTermDisabled,
|
|
24
|
-
|
|
24
|
+
searchTermDisableReason = props.searchTermDisableReason;
|
|
25
25
|
var _useState = useState(false),
|
|
26
26
|
expanded = _useState[0],
|
|
27
27
|
setExpanded = _useState[1];
|
|
28
|
-
var _useState2 = useState(
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
var _useState2 = useState(searchTermDisabled && searchTermDisableReason ? {
|
|
29
|
+
label: searchTermDisableReason
|
|
30
|
+
} : null),
|
|
31
|
+
value = _useState2[0],
|
|
32
|
+
setValue = _useState2[1];
|
|
33
|
+
var _useState3 = useState(false),
|
|
34
|
+
loading = _useState3[0],
|
|
35
|
+
setLoading = _useState3[1];
|
|
31
36
|
useEffect(function () {
|
|
32
37
|
setLoading(false);
|
|
33
38
|
}, [elementsFound]);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
if (!searchTermDisabled || !searchTermDisableReason) {
|
|
41
|
+
setValue(null);
|
|
42
|
+
} else {
|
|
43
|
+
setValue({
|
|
44
|
+
label: searchTermDisableReason
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, [searchTermDisabled, searchTermDisableReason]);
|
|
34
48
|
var handleSearchTermChange = function handleSearchTermChange(term) {
|
|
35
49
|
if (term) {
|
|
36
50
|
setLoading(true);
|
|
37
51
|
onSearchTermChange(term);
|
|
38
52
|
setExpanded(true);
|
|
53
|
+
setValue({
|
|
54
|
+
label: term
|
|
55
|
+
});
|
|
39
56
|
} else {
|
|
40
57
|
setExpanded(false);
|
|
58
|
+
setValue(null);
|
|
41
59
|
}
|
|
42
60
|
};
|
|
43
61
|
var handleClose = useCallback(function () {
|
|
62
|
+
setValue(null);
|
|
44
63
|
setExpanded(false);
|
|
45
64
|
onClose();
|
|
46
65
|
}, [onClose]);
|
|
47
66
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
48
67
|
open: open,
|
|
49
|
-
onClose:
|
|
68
|
+
onClose: handleClose,
|
|
50
69
|
disableRestoreFocus: true,
|
|
51
70
|
"aria-labelledby": "dialog-title-search",
|
|
52
71
|
fullWidth: true
|
|
@@ -58,13 +77,16 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
|
|
|
58
77
|
setExpanded(false);
|
|
59
78
|
},
|
|
60
79
|
fullWidth: true,
|
|
80
|
+
freeSolo: true,
|
|
81
|
+
clearOnBlur: true,
|
|
61
82
|
onInputChange: function onInputChange(_event, value) {
|
|
62
83
|
if (!searchTermDisabled) {
|
|
63
84
|
handleSearchTermChange(value);
|
|
64
85
|
}
|
|
65
86
|
},
|
|
66
87
|
onChange: function onChange(_event, newValue) {
|
|
67
|
-
|
|
88
|
+
onSelectionChange(newValue);
|
|
89
|
+
setValue(null);
|
|
68
90
|
},
|
|
69
91
|
getOptionLabel: function getOptionLabel(option) {
|
|
70
92
|
return option.label;
|
|
@@ -100,9 +122,7 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
|
|
|
100
122
|
})
|
|
101
123
|
}));
|
|
102
124
|
},
|
|
103
|
-
|
|
104
|
-
label: initialSearchTerm
|
|
105
|
-
} : null,
|
|
125
|
+
value: value,
|
|
106
126
|
disabled: searchTermDisabled
|
|
107
127
|
})));
|
|
108
128
|
};
|
|
@@ -115,6 +135,6 @@ ElementSearchDialog.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
115
135
|
elementsFound: PropTypes.array.isRequired,
|
|
116
136
|
renderElement: PropTypes.func.isRequired,
|
|
117
137
|
searchTermDisabled: PropTypes.bool,
|
|
118
|
-
|
|
138
|
+
searchTermDisableReason: PropTypes.string
|
|
119
139
|
} : {};
|
|
120
140
|
export default ElementSearchDialog;
|
|
@@ -75,7 +75,7 @@ OverflowableText.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
75
75
|
text: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]),
|
|
76
76
|
tooltipStyle: PropTypes.string,
|
|
77
77
|
tooltipSx: PropTypes.object,
|
|
78
|
-
sx: PropTypes.object,
|
|
78
|
+
sx: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
79
79
|
className: PropTypes.string
|
|
80
80
|
} : {};
|
|
81
81
|
export default OverflowableText;
|
|
@@ -183,7 +183,7 @@ var TopBar = function TopBar(_ref2) {
|
|
|
183
183
|
onLanguageClick = _ref2.onLanguageClick,
|
|
184
184
|
language = _ref2.language,
|
|
185
185
|
searchTermDisabled = _ref2.searchTermDisabled,
|
|
186
|
-
|
|
186
|
+
searchTermDisableReason = _ref2.searchTermDisableReason;
|
|
187
187
|
var _React$useState = React.useState(null),
|
|
188
188
|
anchorElSettingsMenu = _React$useState[0],
|
|
189
189
|
setAnchorElSettingsMenu = _React$useState[1];
|
|
@@ -312,7 +312,7 @@ var TopBar = function TopBar(_ref2) {
|
|
|
312
312
|
elementsFound: elementsFound,
|
|
313
313
|
renderElement: renderElement,
|
|
314
314
|
searchTermDisabled: searchTermDisabled,
|
|
315
|
-
|
|
315
|
+
searchTermDisableReason: searchTermDisableReason
|
|
316
316
|
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
317
317
|
color: "inherit",
|
|
318
318
|
onClick: handleClickElementSearch,
|
|
@@ -560,6 +560,6 @@ TopBar.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
560
560
|
onLanguageClick: PropTypes.func.isRequired,
|
|
561
561
|
language: PropTypes.string.isRequired,
|
|
562
562
|
searchTermDisabled: PropTypes.bool,
|
|
563
|
-
|
|
563
|
+
searchTermDisableReason: PropTypes.string
|
|
564
564
|
} : {};
|
|
565
565
|
export default TopBar;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridsuite/commons-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.1",
|
|
4
4
|
"description": "common react components for gridsuite applications",
|
|
5
5
|
"engines": {
|
|
6
|
-
"npm": "
|
|
7
|
-
"node": ">=
|
|
6
|
+
"npm": ">=9",
|
|
7
|
+
"node": ">=18"
|
|
8
8
|
},
|
|
9
9
|
"exports": "es/index.js",
|
|
10
10
|
"module": "es/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@mui/lab": "^5.0.0-alpha.72",
|
|
42
42
|
"@mui/material": "^5.5.0",
|
|
43
43
|
"@hookform/resolvers": "^3.0.0",
|
|
44
|
-
"notistack": "^
|
|
44
|
+
"notistack": "^3.0.0",
|
|
45
45
|
"react-router-dom": "^6.0.0",
|
|
46
46
|
"react": "^18.0.0",
|
|
47
47
|
"react-dom": "^18.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"eslint-plugin-prettier": "^4.0.0",
|
|
72
72
|
"eslint-plugin-react": "^7.21.0",
|
|
73
73
|
"eslint-plugin-react-hooks": "^4.1.2",
|
|
74
|
-
"notistack": "^
|
|
74
|
+
"notistack": "^3.0.0",
|
|
75
75
|
"nwb": "^0.25.x",
|
|
76
76
|
"prettier": "^2.0.0",
|
|
77
77
|
"puppeteer": "^17.0.0",
|