@gridsuite/commons-ui 0.20.4 → 0.22.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.
@@ -211,13 +211,14 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
211
211
  });
212
212
 
213
213
  _defineProperty(_assertThisInitialized(_this), "getRowClassName", function (_ref2) {
214
- var _clsx;
214
+ var _rowGetter, _clsx;
215
215
 
216
- var index = _ref2.index;
216
+ var index = _ref2.index,
217
+ rowGetter = _ref2.rowGetter;
217
218
  var _this$props2 = _this.props,
218
219
  classes = _this$props2.classes,
219
220
  onRowClick = _this$props2.onRowClick;
220
- return (0, _clsx3["default"])(classes.tableRow, classes.flexContainer, index % 2 === 0 && classes.rowBackgroundDark, index % 2 !== 0 && classes.rowBackgroundLight, (_clsx = {}, _clsx[classes.tableRowHover] = index !== -1 && onRowClick != null, _clsx));
221
+ return (0, _clsx3["default"])(classes.tableRow, classes.flexContainer, index % 2 === 0 && classes.rowBackgroundDark, index % 2 !== 0 && classes.rowBackgroundLight, ((_rowGetter = rowGetter(index)) === null || _rowGetter === void 0 ? void 0 : _rowGetter.notClickable) === true && classes.noClick, (_clsx = {}, _clsx[classes.tableRowHover] = index !== -1 && onRowClick != null, _clsx));
221
222
  });
222
223
 
223
224
  _defineProperty(_assertThisInitialized(_this), "cellRenderer", function (_ref3) {
@@ -429,11 +430,11 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
429
430
  return index < reorderedIndex.length ? reorderedIndex[index] : 0;
430
431
  };
431
432
 
432
- var _rowGetter = function rowGetter(index) {
433
+ var _rowGetter2 = function rowGetter(index) {
433
434
  return _this2.props.rows[getIndexFor(index)];
434
435
  };
435
436
 
436
- var sizes = this.sizes(this.props.columns, this.props.rows, _rowGetter);
437
+ var sizes = this.sizes(this.props.columns, this.props.rows, _rowGetter2);
437
438
  var csvHeaders = this.csvHeaders(this.props.columns, this.props.exportCSVDataKeys);
438
439
  return /*#__PURE__*/_react["default"].createElement("div", {
439
440
  style: {
@@ -474,14 +475,20 @@ var MuiVirtualizedTable = /*#__PURE__*/function (_React$PureComponent) {
474
475
  className: classes.table
475
476
  }, tableProps, {
476
477
  rowCount: reorderedIndex.length,
477
- rowClassName: _this2.getRowClassName,
478
- rowGetter: function rowGetter(_ref6) {
478
+ rowClassName: function rowClassName(_ref6) {
479
479
  var index = _ref6.index;
480
- return _rowGetter(index);
480
+ return _this2.getRowClassName({
481
+ index: index,
482
+ rowGetter: _rowGetter2
483
+ });
484
+ },
485
+ rowGetter: function rowGetter(_ref7) {
486
+ var index = _ref7.index;
487
+ return _rowGetter2(index);
481
488
  }
482
- }), columns.map(function (_ref7, index) {
483
- var dataKey = _ref7.dataKey,
484
- other = _objectWithoutPropertiesLoose(_ref7, _excluded2);
489
+ }), columns.map(function (_ref8, index) {
490
+ var dataKey = _ref8.dataKey,
491
+ other = _objectWithoutPropertiesLoose(_ref8, _excluded2);
485
492
 
486
493
  return /*#__PURE__*/_react["default"].createElement(_reactVirtualized.Column, _extends({
487
494
  key: dataKey,
@@ -62,7 +62,7 @@ var OverflowableText = function OverflowableText(_ref) {
62
62
  }, [setOverflowed, element]);
63
63
  (0, _react.useEffect)(function () {
64
64
  checkOverflow();
65
- }, [checkOverflow]);
65
+ }, [checkOverflow, text]);
66
66
  return /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
67
67
  title: text || '',
68
68
  disableHoverListener: !overflowed,
@@ -227,6 +227,7 @@ var TopBar = function TopBar(_ref) {
227
227
  onEquipmentLabellingClick = _ref.onEquipmentLabellingClick,
228
228
  equipmentLabelling = _ref.equipmentLabelling,
229
229
  withElementsSearch = _ref.withElementsSearch,
230
+ searchDisabled = _ref.searchDisabled,
230
231
  searchingLabel = _ref.searchingLabel,
231
232
  onSearchTermChange = _ref.onSearchTermChange,
232
233
  _onSelectionChange = _ref.onSelectionChange,
@@ -331,15 +332,20 @@ var TopBar = function TopBar(_ref) {
331
332
  };
332
333
 
333
334
  (0, _react.useEffect)(function () {
334
- if (user && withElementsSearch) {
335
- document.addEventListener('keydown', function (e) {
335
+ if (user && withElementsSearch && !searchDisabled) {
336
+ var openSearch = function openSearch(e) {
336
337
  if (e.ctrlKey && e.key === 'f') {
337
338
  e.preventDefault();
338
339
  setDialogSearchOpen(true);
339
340
  }
340
- });
341
+ };
342
+
343
+ document.addEventListener('keydown', openSearch);
344
+ return function () {
345
+ return document.removeEventListener('keydown', openSearch);
346
+ };
341
347
  }
342
- }, [user, withElementsSearch]);
348
+ }, [user, withElementsSearch, searchDisabled]);
343
349
  return /*#__PURE__*/_react["default"].createElement(_AppBar["default"], {
344
350
  position: "static",
345
351
  color: "default",
@@ -383,7 +389,8 @@ var TopBar = function TopBar(_ref) {
383
389
  renderElement: renderElement
384
390
  }), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
385
391
  color: "inherit",
386
- onClick: handleClickElementSearch
392
+ onClick: handleClickElementSearch,
393
+ disabled: searchDisabled
387
394
  }, /*#__PURE__*/_react["default"].createElement(_Search["default"], null)))), user && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
388
395
  "aria-controls": "apps-menu",
389
396
  "aria-haspopup": "true",
@@ -616,6 +623,7 @@ TopBar.propTypes = process.env.NODE_ENV !== "production" ? {
616
623
  onEquipmentLabellingClick: _propTypes["default"].func,
617
624
  equipmentLabelling: _propTypes["default"].bool,
618
625
  withElementsSearch: _propTypes["default"].bool,
626
+ searchDisabled: _propTypes["default"].bool,
619
627
  searchingLabel: _propTypes["default"].string,
620
628
  onSearchTermChange: _propTypes["default"].func,
621
629
  onSelectionChange: _propTypes["default"].func,
@@ -74,10 +74,23 @@ function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings) {
74
74
  var expires_in = parseInt(matched_expires[0].split('=')[1]);
75
75
  var now = parseInt(Date.now() / 1000);
76
76
  var exp = decoded.exp;
77
+ var idTokenExpiresIn = exp - now;
78
+ var minAccesstokenOrIdtokenOrIdpSettingsExpiresIn = expires_in;
79
+ var newExpireReplaceReason;
77
80
 
78
- if (exp < now + expires_in) {
79
- var newhash = window.location.hash.replace(matched_expires[0], 'expires_in=' + (exp - now));
80
- console.debug('Replacing expires_in in window.location.hash because idtoken.exp is earlier. Before: ', window.location.hash, 'after: ', newhash);
81
+ if (idTokenExpiresIn < minAccesstokenOrIdtokenOrIdpSettingsExpiresIn) {
82
+ minAccesstokenOrIdtokenOrIdpSettingsExpiresIn = idTokenExpiresIn;
83
+ newExpireReplaceReason = 'idtoken.exp is earlier';
84
+ }
85
+
86
+ if (idpSettings.maxExpiresIn && idpSettings.maxExpiresIn < minAccesstokenOrIdtokenOrIdpSettingsExpiresIn) {
87
+ minAccesstokenOrIdtokenOrIdpSettingsExpiresIn = idpSettings.maxExpiresIn;
88
+ newExpireReplaceReason = 'idpSettings.maxExpiresIn is smaller';
89
+ }
90
+
91
+ if (newExpireReplaceReason) {
92
+ var newhash = window.location.hash.replace(matched_expires[0], 'expires_in=' + minAccesstokenOrIdtokenOrIdpSettingsExpiresIn);
93
+ console.debug('Replacing expires_in in window.location.hash to ' + minAccesstokenOrIdtokenOrIdpSettingsExpiresIn + ' because ' + newExpireReplaceReason + '. ', 'debug:', 'original expires_in: ' + expires_in + ', ', 'idTokenExpiresIn: ' + idTokenExpiresIn + '(idtoken exp: ' + exp + '), ', 'idpSettings maxExpiresIn: ' + idpSettings.maxExpiresIn);
81
94
  window.location.hash = newhash;
82
95
  }
83
96
  }
@@ -119,7 +132,11 @@ function logout(dispatch, userManagerInstance) {
119
132
  dispatch((0, _actions.setLoggedUser)(null));
120
133
  sessionStorage.removeItem(hackauthoritykey); //To remove when hack is removed
121
134
 
122
- return userManagerInstance.signoutRedirect().then(function () {
135
+ return userManagerInstance.signoutRedirect({
136
+ extraQueryParams: {
137
+ TargetResource: userManagerInstance.settings.post_logout_redirect_uri
138
+ }
139
+ }).then(function () {
123
140
  return console.debug('logged out');
124
141
  });
125
142
  }
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.20.4",
3
+ "version": "0.22.0",
4
4
  "description": "common react components for gridsuite applications",
5
+ "engines": {
6
+ "npm": "<=6",
7
+ "node": "<=14"
8
+ },
5
9
  "main": "lib/index.js",
6
10
  "files": [
7
11
  "css",