@gridsuite/commons-ui 0.24.1 → 0.25.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.
@@ -31,7 +31,9 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
31
31
  onSearchTermChange = props.onSearchTermChange,
32
32
  onSelectionChange = props.onSelectionChange,
33
33
  elementsFound = props.elementsFound,
34
- renderElement = props.renderElement;
34
+ renderElement = props.renderElement,
35
+ searchTermDisabled = props.searchTermDisabled,
36
+ initialSearchTerm = props.initialSearchTerm;
35
37
 
36
38
  var _useState = (0, _react.useState)(false),
37
39
  expanded = _useState[0],
@@ -74,7 +76,9 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
74
76
  },
75
77
  fullWidth: true,
76
78
  onInputChange: function onInputChange(_event, value) {
77
- return handleSearchTermChange(value);
79
+ if (!searchTermDisabled) {
80
+ handleSearchTermChange(value);
81
+ }
78
82
  },
79
83
  onChange: function onChange(_event, newValue) {
80
84
  return onSelectionChange(newValue);
@@ -112,7 +116,11 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
112
116
  }), params.InputProps.startAdornment)
113
117
  })
114
118
  }));
115
- }
119
+ },
120
+ defaultValue: searchTermDisabled ? {
121
+ label: initialSearchTerm
122
+ } : null,
123
+ disabled: searchTermDisabled
116
124
  })));
117
125
  };
118
126
 
@@ -123,7 +131,9 @@ ElementSearchDialog.propTypes = process.env.NODE_ENV !== "production" ? {
123
131
  onSearchTermChange: _propTypes["default"].func.isRequired,
124
132
  onSelectionChange: _propTypes["default"].func.isRequired,
125
133
  elementsFound: _propTypes["default"].array.isRequired,
126
- renderElement: _propTypes["default"].func.isRequired
134
+ renderElement: _propTypes["default"].func.isRequired,
135
+ searchTermDisabled: _propTypes["default"].bool,
136
+ initialSearchTerm: _propTypes["default"].string
127
137
  } : {};
128
138
  var _default = ElementSearchDialog;
129
139
  exports["default"] = _default;
@@ -19,7 +19,7 @@ var _react = _interopRequireDefault(require("react"));
19
19
 
20
20
  var _EquipmentType = require("../../utils/EquipmentType");
21
21
 
22
- var _excluded = ["inputValue", "suffixRenderer", "element"];
22
+ var _excluded = ["inputValue", "suffixRenderer", "element", "showsJustText"];
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
25
 
@@ -32,6 +32,8 @@ var EquipmentItem = function EquipmentItem(_ref) {
32
32
  _ref$suffixRenderer = _ref.suffixRenderer,
33
33
  suffixRenderer = _ref$suffixRenderer === void 0 ? _index.TagRenderer : _ref$suffixRenderer,
34
34
  element = _ref.element,
35
+ _ref$showsJustText = _ref.showsJustText,
36
+ showsJustText = _ref$showsJustText === void 0 ? false : _ref$showsJustText,
35
37
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
36
38
 
37
39
  var matches = (0, _match["default"])(element.label, inputValue, {
@@ -45,7 +47,7 @@ var EquipmentItem = function EquipmentItem(_ref) {
45
47
  key: element.key
46
48
  }, props), /*#__PURE__*/_react["default"].createElement("div", {
47
49
  className: props.classes.equipmentOption
48
- }, /*#__PURE__*/_react["default"].createElement("span", {
50
+ }, !showsJustText && /*#__PURE__*/_react["default"].createElement("span", {
49
51
  className: (0, _clsx["default"])(props.classes.equipmentTag, props.classes.equipmentTypeTag)
50
52
  }, /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
51
53
  id: _EquipmentType.EQUIPMENT_TYPE[element.type].tagLabel
@@ -61,7 +63,7 @@ var EquipmentItem = function EquipmentItem(_ref) {
61
63
  fontWeight: part.highlight ? 'bold' : 'inherit'
62
64
  }
63
65
  }, part.text);
64
- })), suffixRenderer({
66
+ })), !showsJustText && suffixRenderer({
65
67
  props: props,
66
68
  element: element
67
69
  })));
@@ -29,12 +29,12 @@ var overflowStyle = function overflowStyle(theme) {
29
29
  return {
30
30
  overflow: {
31
31
  display: 'inline-block',
32
- whiteSpace: 'nowrap',
32
+ whiteSpace: 'pre',
33
33
  textOverflow: 'ellipsis',
34
34
  overflow: 'hidden'
35
35
  },
36
36
  tooltip: {
37
- whiteSpace: 'nowrap',
37
+ whiteSpace: 'pre',
38
38
  width: 'fit-content',
39
39
  maxWidth: 'fit-content'
40
40
  }
@@ -235,7 +235,9 @@ var TopBar = function TopBar(_ref) {
235
235
  elementsFound = _ref.elementsFound,
236
236
  renderElement = _ref.renderElement,
237
237
  onLanguageClick = _ref.onLanguageClick,
238
- language = _ref.language;
238
+ language = _ref.language,
239
+ searchTermDisabled = _ref.searchTermDisabled,
240
+ initialSearchTerm = _ref.initialSearchTerm;
239
241
  var classes = useStyles();
240
242
 
241
243
  var _React$useState = _react["default"].useState(null),
@@ -387,7 +389,9 @@ var TopBar = function TopBar(_ref) {
387
389
  _onSelectionChange(element);
388
390
  },
389
391
  elementsFound: elementsFound,
390
- renderElement: renderElement
392
+ renderElement: renderElement,
393
+ searchTermDisabled: searchTermDisabled,
394
+ initialSearchTerm: initialSearchTerm
391
395
  }), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
392
396
  color: "inherit",
393
397
  onClick: handleClickElementSearch,
@@ -630,7 +634,9 @@ TopBar.propTypes = process.env.NODE_ENV !== "production" ? {
630
634
  onSelectionChange: _propTypes["default"].func,
631
635
  elementsFound: _propTypes["default"].array,
632
636
  onLanguageClick: _propTypes["default"].func.isRequired,
633
- language: _propTypes["default"].string.isRequired
637
+ language: _propTypes["default"].string.isRequired,
638
+ searchTermDisabled: _propTypes["default"].bool,
639
+ initialSearchTerm: _propTypes["default"].string
634
640
  } : {};
635
641
  var _default = TopBar;
636
642
  exports["default"] = _default;
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var card_error_boundary_en = {
6
13
  'card_error_boundary/title': 'Sorry, unexpected error :(',
7
14
  'card_error_boundary/content': 'Please reload, or close and reopen this application, or contact support.',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var card_error_boundary_fr = {
6
13
  'card_error_boundary/title': 'Désolé, erreur inattendue :(',
7
14
  'card_error_boundary/content': 'Veuillez recharger, ou fermer et réouvrir cette application, ou contacter le support.',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var element_search_en = {
6
13
  'element_search/label': 'Search for an element',
7
14
  'element_search/noResult': 'No result'
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var element_search_fr = {
6
13
  'element_search/label': 'Rechercher un élément',
7
14
  'element_search/noResult': 'Aucun résultat'
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var equipment_search_en = {
6
13
  'equipment_search/label': 'Search for an equipment',
7
14
  'equipment_search/switchTag': 'SWITCH',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var equipment_search_fr = {
6
13
  'equipment_search/label': 'Rechercher un équipement',
7
14
  'equipment_search/switchTag': 'SWITCH',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var login_en = {
6
13
  'login/login': 'Login',
7
14
  'login/connection': 'Connection'
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var login_fr = {
6
13
  'login/login': 'Se connecter',
7
14
  'login/connection': 'Connexion'
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var report_viewer_en = {
6
13
  'report_viewer/close': 'Close',
7
14
  'report_viewer/severity': 'Severity',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var report_viewer_fr = {
6
13
  'report_viewer/close': 'Fermer',
7
14
  'report_viewer/severity': 'Sévérité',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var table_en = {
6
13
  'MuiVirtualizedTable/exportCSV': 'Export to CSV File'
7
14
  };
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var table_fr = {
6
13
  'MuiVirtualizedTable/exportCSV': 'Exporter vers un fichier CSV'
7
14
  };
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var top_bar_en = {
6
13
  'top-bar/settings': 'Settings',
7
14
  'top-bar/logout': 'Logout',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var top_bar_fr = {
6
13
  'top-bar/settings': 'Paramètres',
7
14
  'top-bar/logout': 'Se déconnecter',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var treeview_finder_en = {
6
13
  'treeview_finder/close': 'Close',
7
14
  'treeview_finder/cancel': 'Cancel',
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+
6
+ /**
7
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
8
+ * This Source Code Form is subject to the terms of the Mozilla Public
9
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ */
5
12
  var treeview_finder_fr = {
6
13
  'treeview_finder/close': 'Fermer',
7
14
  'treeview_finder/cancel': 'Annuler',
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useImportExportParams = void 0;
5
+
6
+ var _react = _interopRequireWildcard(require("react"));
7
+
8
+ var _material = require("@mui/material");
9
+
10
+ var _makeStyles = _interopRequireDefault(require("@mui/styles/makeStyles"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ function _extends() { _extends = Object.assign || 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); }
19
+
20
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+
22
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
+
24
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
25
+
26
+ var useStyles = (0, _makeStyles["default"])(function (theme) {
27
+ return {
28
+ paramListItem: {
29
+ justifyContent: 'space-between',
30
+ gap: theme.spacing(2)
31
+ }
32
+ };
33
+ });
34
+
35
+ function longestCommonPrefix(strs) {
36
+ if (!(strs === null || strs === void 0 ? void 0 : strs.length)) return '';
37
+ var prefix = strs.reduce(function (acc, str) {
38
+ return str.length < acc.length ? str : acc;
39
+ });
40
+
41
+ for (var _iterator = _createForOfIteratorHelperLoose(strs), _step; !(_step = _iterator()).done;) {
42
+ var str = _step.value;
43
+
44
+ while (str.slice(0, prefix.length) !== prefix) {
45
+ prefix = prefix.slice(0, -1);
46
+ }
47
+ }
48
+
49
+ return prefix;
50
+ }
51
+
52
+ var useImportExportParams = function useImportExportParams(paramsAsArray) {
53
+ var classes = useStyles();
54
+ var longestPrefix = longestCommonPrefix(paramsAsArray.map(function (m) {
55
+ return m.name;
56
+ }));
57
+ var lastDotIndex = longestPrefix.lastIndexOf('.');
58
+ var prefix = longestPrefix.slice(0, lastDotIndex + 1);
59
+ var defaultValues = (0, _react.useMemo)(function () {
60
+ return Object.fromEntries(paramsAsArray.map(function (m) {
61
+ var _m$defaultValue, _m$defaultValue2;
62
+
63
+ if (m.type === 'BOOLEAN') return [m.name, m.defaultValue];
64
+ if (m.type === 'STRING_LIST') return [m.name, (_m$defaultValue = m.defaultValue) !== null && _m$defaultValue !== void 0 ? _m$defaultValue : []];
65
+ return [m.name, (_m$defaultValue2 = m.defaultValue) !== null && _m$defaultValue2 !== void 0 ? _m$defaultValue2 : null];
66
+ }));
67
+ }, [paramsAsArray]);
68
+
69
+ var _useState = (0, _react.useState)(defaultValues),
70
+ currentValues = _useState[0],
71
+ setCurrentValues = _useState[1];
72
+
73
+ var onFieldChange = function onFieldChange(value, paramName) {
74
+ setCurrentValues(function (prevCurrentValues) {
75
+ var nextCurrentValues = _extends({}, prevCurrentValues);
76
+
77
+ nextCurrentValues[paramName] = value;
78
+ return nextCurrentValues;
79
+ });
80
+ };
81
+
82
+ var renderField = function renderField(param) {
83
+ var _currentValues$param$, _param$possibleValues, _currentValues$param$2, _currentValues$param$3;
84
+
85
+ switch (param.type) {
86
+ case 'BOOLEAN':
87
+ return /*#__PURE__*/_react["default"].createElement(_material.Switch, {
88
+ checked: (_currentValues$param$ = currentValues === null || currentValues === void 0 ? void 0 : currentValues[param.name]) !== null && _currentValues$param$ !== void 0 ? _currentValues$param$ : defaultValues[param.name],
89
+ onChange: function onChange(e) {
90
+ return onFieldChange(e.target.checked, param.name);
91
+ }
92
+ });
93
+
94
+ case 'STRING_LIST':
95
+ return /*#__PURE__*/_react["default"].createElement(_material.Autocomplete, {
96
+ fullWidth: true,
97
+ multiple: true,
98
+ options: (_param$possibleValues = param.possibleValues) !== null && _param$possibleValues !== void 0 ? _param$possibleValues : [],
99
+ freeSolo: !param.possibleValues,
100
+ onChange: function onChange(e, value) {
101
+ return onFieldChange(value, param.name);
102
+ },
103
+ value: (_currentValues$param$2 = currentValues === null || currentValues === void 0 ? void 0 : currentValues[param.name]) !== null && _currentValues$param$2 !== void 0 ? _currentValues$param$2 : defaultValues[param.name],
104
+ renderTags: function renderTags(value, getTagProps) {
105
+ return value.map(function (option, index) {
106
+ return /*#__PURE__*/_react["default"].createElement(_material.Chip, _extends({
107
+ variant: "outlined",
108
+ label: option
109
+ }, getTagProps({
110
+ index: index
111
+ })));
112
+ });
113
+ },
114
+ renderInput: function renderInput(options) {
115
+ return /*#__PURE__*/_react["default"].createElement(_material.TextField, _extends({}, options, {
116
+ variant: "standard"
117
+ }));
118
+ }
119
+ });
120
+
121
+ default:
122
+ return /*#__PURE__*/_react["default"].createElement(_material.TextField, {
123
+ fullWidth: true,
124
+ defaultValue: (_currentValues$param$3 = currentValues === null || currentValues === void 0 ? void 0 : currentValues[param.name]) !== null && _currentValues$param$3 !== void 0 ? _currentValues$param$3 : defaultValues[param.name],
125
+ onChange: function onChange(e) {
126
+ return onFieldChange(e.target.value, param.name);
127
+ },
128
+ variant: 'standard'
129
+ });
130
+ }
131
+ };
132
+
133
+ var resetValuesToDefault = function resetValuesToDefault() {
134
+ setCurrentValues({});
135
+ };
136
+
137
+ var paramsComponent = /*#__PURE__*/_react["default"].createElement(_material.List, null, paramsAsArray.map(function (param) {
138
+ return /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
139
+ title: param.description,
140
+ enterDelay: 1200,
141
+ key: param.name
142
+ }, /*#__PURE__*/_react["default"].createElement(_material.ListItem, {
143
+ key: param.name,
144
+ className: classes.paramListItem
145
+ }, /*#__PURE__*/_react["default"].createElement(_material.Typography, {
146
+ style: {
147
+ minWidth: '30%'
148
+ }
149
+ }, param.name.slice(prefix.length)), renderField(param)));
150
+ }));
151
+
152
+ return [currentValues, paramsComponent, resetValuesToDefault];
153
+ };
154
+
155
+ exports.useImportExportParams = useImportExportParams;
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.EquipmentItem = exports.TagRenderer = exports.setSignInCallbackError = exports.SIGNIN_CALLBACK_ERROR = exports.setLoggedUser = exports.USER = exports.LANG_FRENCH = exports.LANG_ENGLISH = exports.LANG_SYSTEM = exports.LIGHT_THEME = exports.DARK_THEME = exports.DEFAULT_ROW_HEIGHT = exports.DEFAULT_HEADER_HEIGHT = exports.DEFAULT_CELL_PADDING = exports.getFileIcon = exports.elementType = exports.getPreLoginPath = exports.dispatchUser = exports.logout = exports.initializeAuthenticationProd = exports.initializeAuthenticationDev = exports.equipmentStyles = exports.getEquipmentsInfosForSearchBar = exports.EQUIPMENT_TYPE = void 0;
4
+ exports.useImportExportParams = exports.EquipmentItem = exports.TagRenderer = exports.setSignInCallbackError = exports.SIGNIN_CALLBACK_ERROR = exports.setLoggedUser = exports.USER = exports.LANG_FRENCH = exports.LANG_ENGLISH = exports.LANG_SYSTEM = exports.LIGHT_THEME = exports.DARK_THEME = exports.DEFAULT_ROW_HEIGHT = exports.DEFAULT_HEADER_HEIGHT = exports.DEFAULT_CELL_PADDING = exports.getFileIcon = exports.elementType = exports.getPreLoginPath = exports.dispatchUser = exports.logout = exports.initializeAuthenticationProd = exports.initializeAuthenticationDev = exports.equipmentStyles = exports.getEquipmentsInfosForSearchBar = exports.EQUIPMENT_TYPE = void 0;
5
5
 
6
6
  var _TreeViewFinder2 = _interopRequireDefault(require("./components/TreeViewFinder"));
7
7
 
@@ -152,6 +152,10 @@ var _CardErrorBoundary2 = _interopRequireDefault(require("./components/CardError
152
152
 
153
153
  exports.CardErrorBoundary = _CardErrorBoundary2["default"];
154
154
 
155
+ var _useImportExportParams = require("./hooks/useImportExportParams");
156
+
157
+ exports.useImportExportParams = _useImportExportParams.useImportExportParams;
158
+
155
159
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
156
160
 
157
161
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.24.1",
3
+ "version": "0.25.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "engines": {
6
6
  "npm": "<=6",