@gridsuite/commons-ui 0.20.3 → 0.21.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.
@@ -106,7 +106,6 @@ var ElementSearchDialog = function ElementSearchDialog(props) {
106
106
  return renderElement(_extends({}, optionProps, {
107
107
  element: element,
108
108
  inputValue: inputValue,
109
- setExpanded: setExpanded,
110
109
  onClose: handleClose
111
110
  }));
112
111
  },
@@ -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,
@@ -26,6 +26,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
26
26
  * License, v. 2.0. If a copy of the MPL was not distributed with this
27
27
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
28
28
  */
29
+ // set as a global variable to allow log level configuration at runtime
30
+ window.OIDCLog = _oidcClient.Log;
29
31
  var hackauthoritykey = 'oidc.hack.authority';
30
32
  var pathKey = 'powsybl-gridsuite-current-path';
31
33
 
@@ -46,6 +48,7 @@ function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings) {
46
48
  /* hack to ignore the iss check. XXX TODO to remove */
47
49
  var regextoken = /id_token=[^&]*/;
48
50
  var regexstate = /state=[^&]*/;
51
+ var regexexpires = /expires_in=[^&]*/;
49
52
  var authority;
50
53
 
51
54
  if (window.location.hash) {
@@ -58,11 +61,26 @@ function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings) {
58
61
  var strState = localStorage.getItem('oidc.' + state);
59
62
 
60
63
  if (strState != null) {
61
- authority = (0, _jwtDecode["default"])(id_token).iss;
64
+ var decoded = (0, _jwtDecode["default"])(id_token);
65
+ authority = decoded.iss;
62
66
  var storedState = JSON.parse(strState);
67
+ console.debug('Replacing authority in storedState. Before: ', storedState.authority, 'after: ', authority);
63
68
  storedState.authority = authority;
64
69
  localStorage.setItem('oidc.' + state, JSON.stringify(storedState));
65
70
  sessionStorage.setItem(hackauthoritykey, authority);
71
+ var matched_expires = window.location.hash.match(regexexpires);
72
+
73
+ if (matched_expires != null) {
74
+ var expires_in = parseInt(matched_expires[0].split('=')[1]);
75
+ var now = parseInt(Date.now() / 1000);
76
+ var exp = decoded.exp;
77
+
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
+ window.location.hash = newhash;
82
+ }
83
+ }
66
84
  }
67
85
  }
68
86
  }
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.20.3",
3
+ "version": "0.21.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",