@gridsuite/commons-ui 0.37.0 → 0.39.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 -0
- package/es/components/TopBar/TopBar.js +1 -1
- package/es/components/TreeViewFinder/TreeViewFinder.js +11 -9
- package/es/components/react-hook-form/utils/cancel-button.js +23 -0
- package/es/components/react-hook-form/utils/submit-button.js +11 -7
- package/es/components/translations/common-button-en.js +12 -0
- package/es/components/translations/common-button-fr.js +12 -0
- package/es/components/translations/treeview-finder-en.js +0 -1
- package/es/components/translations/treeview-finder-fr.js +0 -1
- package/es/index.js +3 -0
- package/package.json +1 -1
|
@@ -45,6 +45,13 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
}, [searchTermDisabled, searchTermDisableReason]);
|
|
48
|
+
|
|
49
|
+
// to reset the value between the dialog closing and opening
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
setValue(function (old) {
|
|
52
|
+
return !open ? null : old;
|
|
53
|
+
});
|
|
54
|
+
}, [open]);
|
|
48
55
|
var handleSearchTermChange = function handleSearchTermChange(term) {
|
|
49
56
|
if (term) {
|
|
50
57
|
setLoading(true);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var _defaultStyles;
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
3
|
/**
|
|
3
4
|
* Copyright (c) 2021, RTE (http://www.rte-france.com)
|
|
4
5
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -7,7 +8,7 @@ var _defaultStyles;
|
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import React, { useState, useCallback, useEffect } from 'react';
|
|
10
|
-
import {
|
|
11
|
+
import { useIntl } from 'react-intl';
|
|
11
12
|
import PropTypes from 'prop-types';
|
|
12
13
|
import { toNestedGlobalSelectors, makeComposeClasses } from '../../utils/styles';
|
|
13
14
|
import { styled } from '@mui/system';
|
|
@@ -23,6 +24,7 @@ import Typography from '@mui/material/Typography';
|
|
|
23
24
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
24
25
|
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
|
25
26
|
import CheckIcon from '@mui/icons-material/Check';
|
|
27
|
+
import CancelButton from '../react-hook-form/utils/cancel-button';
|
|
26
28
|
|
|
27
29
|
// As a bunch of individual variables to try to make it easier
|
|
28
30
|
// to track that they are all used. Not sure, maybe group them in an object ?
|
|
@@ -84,6 +86,7 @@ var composeClasses = makeComposeClasses(generateTreeViewFinderClass);
|
|
|
84
86
|
* @param {String} [validationButtonText=default text] - Customized Validation Button text (default: Add N Elements)
|
|
85
87
|
* @param {Boolean} [onlyLeaves=true] - Allow/Forbid selection only on leaves
|
|
86
88
|
* @param {Boolean} [multiselect=false] - Allow/Forbid multiselection on Tree
|
|
89
|
+
* @param {Object} [cancelButtonProps] - The cancel button props
|
|
87
90
|
*/
|
|
88
91
|
var TreeViewFinder = function TreeViewFinder(props) {
|
|
89
92
|
var intl = useIntl();
|
|
@@ -100,7 +103,8 @@ var TreeViewFinder = function TreeViewFinder(props) {
|
|
|
100
103
|
onlyLeaves = props.onlyLeaves,
|
|
101
104
|
multiselect = props.multiselect,
|
|
102
105
|
sortMethod = props.sortMethod,
|
|
103
|
-
className = props.className
|
|
106
|
+
className = props.className,
|
|
107
|
+
cancelButtonProps = props.cancelButtonProps;
|
|
104
108
|
var _useState = useState({}),
|
|
105
109
|
mapPrintedNodes = _useState[0],
|
|
106
110
|
setMapPrintedNodes = _useState[1];
|
|
@@ -277,8 +281,7 @@ var TreeViewFinder = function TreeViewFinder(props) {
|
|
|
277
281
|
multiSelect: multiselect
|
|
278
282
|
}, data && Array.isArray(data) ? data.sort(sortMethod).map(function (child) {
|
|
279
283
|
return renderTree(child);
|
|
280
|
-
}) : null)), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(
|
|
281
|
-
variant: "contained",
|
|
284
|
+
}) : null)), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(CancelButton, _extends({
|
|
282
285
|
style: {
|
|
283
286
|
"float": 'left',
|
|
284
287
|
margin: '5px'
|
|
@@ -287,10 +290,8 @@ var TreeViewFinder = function TreeViewFinder(props) {
|
|
|
287
290
|
_onClose([]);
|
|
288
291
|
setSelected([]);
|
|
289
292
|
}
|
|
290
|
-
}, /*#__PURE__*/React.createElement(
|
|
291
|
-
|
|
292
|
-
})), /*#__PURE__*/React.createElement(Button, {
|
|
293
|
-
variant: "contained",
|
|
293
|
+
}, cancelButtonProps)), /*#__PURE__*/React.createElement(Button, {
|
|
294
|
+
variant: "outlined",
|
|
294
295
|
style: {
|
|
295
296
|
"float": 'left',
|
|
296
297
|
margin: '5px'
|
|
@@ -323,7 +324,8 @@ TreeViewFinder.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
323
324
|
defaultExpanded: PropTypes.arrayOf(PropTypes.string),
|
|
324
325
|
onlyLeaves: PropTypes.bool,
|
|
325
326
|
multiselect: PropTypes.bool,
|
|
326
|
-
sortMethod: PropTypes.func
|
|
327
|
+
sortMethod: PropTypes.func,
|
|
328
|
+
cancelButtonProps: PropTypes.object
|
|
327
329
|
} : {};
|
|
328
330
|
|
|
329
331
|
/* TreeViewFinder props default values */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
5
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
7
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { Button } from '@mui/material';
|
|
12
|
+
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
var CancelButton = function CancelButton(_ref) {
|
|
15
|
+
var buttonProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
16
|
+
return /*#__PURE__*/React.createElement(Button, buttonProps, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
17
|
+
id: "cancel"
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
CancelButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
21
|
+
buttonProps: PropTypes.object
|
|
22
|
+
} : {};
|
|
23
|
+
export default CancelButton;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
3
|
/**
|
|
2
4
|
* Copyright (c) 2022, RTE (http://www.rte-france.com)
|
|
3
5
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -9,17 +11,19 @@ import React from 'react';
|
|
|
9
11
|
import { Button } from '@mui/material';
|
|
10
12
|
import { useFormState } from 'react-hook-form';
|
|
11
13
|
import { FormattedMessage } from 'react-intl';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
12
15
|
var SubmitButton = function SubmitButton(_ref) {
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
16
|
+
var _buttonProps$disabled;
|
|
17
|
+
var buttonProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
16
18
|
var _useFormState = useFormState(),
|
|
17
19
|
isDirty = _useFormState.isDirty;
|
|
18
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
20
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, buttonProps, {
|
|
21
|
+
disabled: !isDirty || ((_buttonProps$disabled = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.disabled) !== null && _buttonProps$disabled !== void 0 ? _buttonProps$disabled : false)
|
|
22
|
+
}), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
22
23
|
id: "validate"
|
|
23
24
|
}));
|
|
24
25
|
};
|
|
26
|
+
SubmitButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
27
|
+
buttonProps: PropTypes.object
|
|
28
|
+
} : {};
|
|
25
29
|
export default SubmitButton;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var common_button_en = {
|
|
9
|
+
cancel: 'Cancel',
|
|
10
|
+
validate: 'Validate'
|
|
11
|
+
};
|
|
12
|
+
export default common_button_en;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var common_button_fr = {
|
|
9
|
+
cancel: 'Annuler',
|
|
10
|
+
validate: 'Valider'
|
|
11
|
+
};
|
|
12
|
+
export default common_button_fr;
|
package/es/index.js
CHANGED
|
@@ -43,6 +43,8 @@ export { default as flat_parameters_en } from './components/translations/flat-pa
|
|
|
43
43
|
export { default as flat_parameters_fr } from './components/translations/flat-parameters-fr';
|
|
44
44
|
export { default as multiple_selection_dialog_en } from './components/translations/multiple-selection-dialog-en';
|
|
45
45
|
export { default as multiple_selection_dialog_fr } from './components/translations/multiple-selection-dialog-fr';
|
|
46
|
+
export { default as common_button_en } from './components/translations/common-button-en';
|
|
47
|
+
export { default as common_button_fr } from './components/translations/common-button-fr';
|
|
46
48
|
export { TagRenderer } from './components/ElementSearchDialog';
|
|
47
49
|
export { EquipmentItem } from './components/ElementSearchDialog/equipment-item';
|
|
48
50
|
export { default as CardErrorBoundary } from './components/CardErrorBoundary';
|
|
@@ -64,4 +66,5 @@ export { default as MidFormError } from './components/react-hook-form/error-mana
|
|
|
64
66
|
export { default as TextFieldWithAdornment } from './components/react-hook-form/utils/text-field-with-adornment';
|
|
65
67
|
export { default as FieldLabel } from './components/react-hook-form/utils/field-label';
|
|
66
68
|
export { default as SubmitButton } from './components/react-hook-form/utils/submit-button';
|
|
69
|
+
export { default as CancelButton } from './components/react-hook-form/utils/cancel-button';
|
|
67
70
|
export { genHelperPreviousValue, genHelperError, identity, isFieldRequired } from './components/react-hook-form/utils/functions';
|