carbon-addons-iot-react 2.152.0-next.13 → 2.152.0-next.15

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/css/carbon-addons-iot-react.css +8 -3
  3. package/css/carbon-addons-iot-react.css.map +1 -1
  4. package/es/components/BarChartCard/barChartUtils.js +2 -2
  5. package/es/components/Card/CardTitle.js +8 -2
  6. package/es/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.js +3 -3
  7. package/es/components/DateTimePicker/DateTimePickerV2WithoutTimeSpinner.js +3 -3
  8. package/es/components/SuiteHeader/IdleLogoutConfirmationModal/IdleLogoutConfirmationModal.js +77 -4
  9. package/es/components/SuiteHeader/SuiteHeader.js +26 -3
  10. package/es/components/SuiteHeader/hooks/useUiResources.js +4 -1
  11. package/es/components/SuiteHeader/util/uiresources.js +5 -4
  12. package/es/components/Table/Table.js +7 -17
  13. package/es/components/Table/TableBody/TableBody.js +5 -16
  14. package/es/components/Table/TableBody/TableBodyRow/TableBodyRow.js +9 -20
  15. package/es/components/Table/TableBody/TableBodyRowRenderer.js +5 -16
  16. package/es/components/Table/TableCellRenderer/TableCellRenderer.js +6 -17
  17. package/es/components/Table/TableHead/TableHead.js +4 -15
  18. package/es/constants/SharedPropTypes.js +2 -1
  19. package/es/hooks/usePopoverPositioning.js +53 -11
  20. package/lib/components/BarChartCard/barChartUtils.js +2 -2
  21. package/lib/components/Card/CardTitle.js +8 -2
  22. package/lib/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.js +3 -3
  23. package/lib/components/DateTimePicker/DateTimePickerV2WithoutTimeSpinner.js +3 -3
  24. package/lib/components/SuiteHeader/IdleLogoutConfirmationModal/IdleLogoutConfirmationModal.js +77 -4
  25. package/lib/components/SuiteHeader/SuiteHeader.js +26 -3
  26. package/lib/components/SuiteHeader/hooks/useUiResources.js +4 -1
  27. package/lib/components/SuiteHeader/util/uiresources.js +5 -4
  28. package/lib/components/Table/Table.js +7 -17
  29. package/lib/components/Table/TableBody/TableBody.js +5 -16
  30. package/lib/components/Table/TableBody/TableBodyRow/TableBodyRow.js +9 -20
  31. package/lib/components/Table/TableBody/TableBodyRowRenderer.js +5 -16
  32. package/lib/components/Table/TableCellRenderer/TableCellRenderer.js +6 -17
  33. package/lib/components/Table/TableHead/TableHead.js +4 -15
  34. package/lib/constants/SharedPropTypes.js +2 -0
  35. package/lib/css/carbon-addons-iot-react.css +8 -3
  36. package/lib/css/carbon-addons-iot-react.css.map +1 -1
  37. package/lib/hooks/usePopoverPositioning.js +53 -11
  38. package/lib/scss/components/DateTimePicker/_date-time-pickerv2.scss +4 -4
  39. package/lib/scss/components/Table/_table.scss +5 -0
  40. package/package.json +4 -3
  41. package/scss/components/DateTimePicker/_date-time-pickerv2.scss +4 -4
  42. package/scss/components/Table/_table.scss +5 -0
  43. package/umd/carbon-addons-iot-react.js +212 -134
@@ -29,6 +29,7 @@ import { TableColumnsPropTypes, TableColumnGroupPropType, ActiveTableToolbarProp
29
29
  import TableCellRenderer from '../TableCellRenderer/TableCellRenderer.js';
30
30
  import { tableTranslateWithId } from '../../../utils/componentUtilityFunctions.js';
31
31
  import { settings } from '../../../constants/Settings.js';
32
+ import { WrapCellTextPropTypes } from '../../../constants/SharedPropTypes.js';
32
33
  import { OverflowMenu } from '../../OverflowMenu/index.js';
33
34
  import { usePrevious } from '../../../hooks/usePrevious.js';
34
35
  import deprecate from '../../../internal/deprecate.js';
@@ -58,7 +59,7 @@ var propTypes = {
58
59
  /** If the hierarchy only has 1 nested level of children */
59
60
  hasSingleNestedHierarchy: PropTypes.bool
60
61
  })]),
61
- wrapCellText: PropTypes.oneOf(['always', 'never', 'auto', 'alwaysTruncate']).isRequired,
62
+ wrapCellText: WrapCellTextPropTypes.isRequired,
62
63
  truncateCellText: PropTypes.bool.isRequired,
63
64
  hasMultiSort: PropTypes.bool,
64
65
  useAutoTableLayoutForResize: PropTypes.bool,
@@ -699,20 +700,8 @@ TableHead.__docgenInfo = {
699
700
  "required": false
700
701
  },
701
702
  "wrapCellText": {
702
- "name": "enum",
703
- "value": [{
704
- "value": "'always'",
705
- "computed": false
706
- }, {
707
- "value": "'never'",
708
- "computed": false
709
- }, {
710
- "value": "'auto'",
711
- "computed": false
712
- }, {
713
- "value": "'alwaysTruncate'",
714
- "computed": false
715
- }],
703
+ "name": "custom",
704
+ "raw": "WrapCellTextPropTypes.isRequired",
716
705
  "required": true
717
706
  },
718
707
  "truncateCellText": {
@@ -151,5 +151,6 @@ var CarbonIconPropType = PropTypes.oneOfType([PropTypes.func, PropTypes.object])
151
151
  var HtmlElementRefProp = PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
152
152
  current: PropTypes.oneOfType([PropTypes.object])
153
153
  })]);
154
+ var WrapCellTextPropTypes = PropTypes.oneOf(['always', 'never', 'auto', 'alwaysTruncate', 'expand']);
154
155
 
155
- export { ButtonIconPropType, CarbonIconPropType, ColorPropType, HotspotContentPropTypes, HotspotIconPropType, HotspotPropTypes, HtmlElementRefProp, OverridePropTypes, SvgPropType };
156
+ export { ButtonIconPropType, CarbonIconPropType, ColorPropType, HotspotContentPropTypes, HotspotIconPropType, HotspotPropTypes, HtmlElementRefProp, OverridePropTypes, SvgPropType, WrapCellTextPropTypes };
@@ -46,6 +46,36 @@ var isOffscreen = function isOffscreen(menuBody, menuDirection, menuButton
46
46
  var L = offLeft ? 'left' : '';
47
47
  return [T, R, B, L].filter(Boolean).join('-');
48
48
  };
49
+ /**
50
+ * This is used as the callback for menuOffset ONLY on Tooltips. It's needed due to
51
+ * truncation that might happen on Tooltip trigger, therefore we need to consider
52
+ * right position of the trigger as well. This function is used as an enhancement for
53
+ * the isOffscreen method.
54
+ *
55
+ * @param {HTMLElement} menuBody The underlying carbon FloatingMenu element
56
+ * @param {string} menuDirection The direction prop
57
+ * @param {HTMLElement} menuButton The button triggering the menu
58
+ * @returns {string} 'start', 'center' or 'end'
59
+ */
60
+
61
+
62
+ var getTooltipAlignment = function getTooltipAlignment(menuBody, menuDirection, menuButton) {
63
+ var buttonRect = menuButton.getBoundingClientRect();
64
+ var tooltipRect = menuBody.getBoundingClientRect();
65
+ var windowWidth = window.innerWidth || document.documentElement.clientWidth;
66
+ var triggerCenter = (buttonRect.left + buttonRect.right) / 2;
67
+ var tooltipCenter = tooltipRect.width / 2;
68
+
69
+ if (triggerCenter - tooltipCenter < 0) {
70
+ return 'start';
71
+ }
72
+
73
+ if (triggerCenter + tooltipCenter > windowWidth) {
74
+ return 'end';
75
+ }
76
+
77
+ return 'center';
78
+ };
49
79
  /**
50
80
  * Given a subset of props from the Tooltip, OverflowMenu, or FlyoutMenu. This hook returns a decorator
51
81
  * function around the original menuOffset function. It determines if the element overflows using that
@@ -63,22 +93,29 @@ var usePopoverPositioning = function usePopoverPositioning(_ref) {
63
93
  _ref$isOverflowMenu = _ref.isOverflowMenu,
64
94
  isOverflowMenu = _ref$isOverflowMenu === void 0 ? false : _ref$isOverflowMenu,
65
95
  _ref$useAutoPositioni = _ref.useAutoPositioning,
66
- useAutoPositioning = _ref$useAutoPositioni === void 0 ? true : _ref$useAutoPositioni;
96
+ useAutoPositioning = _ref$useAutoPositioni === void 0 ? true : _ref$useAutoPositioni,
97
+ _ref$defaultAlignment = _ref.defaultAlignment,
98
+ defaultAlignment = _ref$defaultAlignment === void 0 ? 'center' : _ref$defaultAlignment;
67
99
 
68
100
  var _React$useState = React.useState(),
69
101
  _React$useState2 = _slicedToArray(_React$useState, 2),
70
102
  adjustedDirection = _React$useState2[0],
71
103
  setAdjustedDirection = _React$useState2[1];
72
104
 
73
- var _React$useState3 = React.useState(),
105
+ var _React$useState3 = React.useState(defaultAlignment),
74
106
  _React$useState4 = _slicedToArray(_React$useState3, 2),
75
- adjustedFlipped = _React$useState4[0],
76
- setAdjustedFlipped = _React$useState4[1];
107
+ adjustedAlignment = _React$useState4[0],
108
+ setAdjustedAlignment = _React$useState4[1];
77
109
 
78
- var _React$useState5 = React.useState({}),
110
+ var _React$useState5 = React.useState(),
79
111
  _React$useState6 = _slicedToArray(_React$useState5, 2),
80
- flyoutAlignment = _React$useState6[0].flyoutAlignment,
81
- setDirections = _React$useState6[1];
112
+ adjustedFlipped = _React$useState6[0],
113
+ setAdjustedFlipped = _React$useState6[1];
114
+
115
+ var _React$useState7 = React.useState({}),
116
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
117
+ flyoutAlignment = _React$useState8[0].flyoutAlignment,
118
+ setDirections = _React$useState8[1];
82
119
 
83
120
  var previousDirection = React.useRef();
84
121
  var langDir = useLangDirection();
@@ -176,10 +213,12 @@ var usePopoverPositioning = function usePopoverPositioning(_ref) {
176
213
  * be adjusted to `right-start`.
177
214
  */
178
215
 
179
- var fixOverflow = React.useCallback(function (overflow, menuOffsetArgs) {
216
+ var fixOverflow = React.useCallback(function (overflow, menuOffsetArgs, alignment) {
180
217
  var _menuOffsetArgs = _slicedToArray(menuOffsetArgs, 1),
181
218
  tooltipElement = _menuOffsetArgs[0];
182
219
 
220
+ setAdjustedAlignment(alignment);
221
+
183
222
  switch (overflow) {
184
223
  case 'top':
185
224
  if (flyoutAlignment) {
@@ -306,7 +345,9 @@ var usePopoverPositioning = function usePopoverPositioning(_ref) {
306
345
  } // determine if the element is off-screen.
307
346
 
308
347
 
309
- var overflow = isOffscreen.apply(void 0, args.concat([defaultOffset])); // if it's offscreen in a direction we can fix, do so
348
+ var overflow = isOffscreen.apply(void 0, args.concat([defaultOffset])); // determine if the element has new alignment
349
+
350
+ var alignment = getTooltipAlignment.apply(void 0, args); // if it's offscreen in a direction we can fix, do so
310
351
  // otherwise leave it be. ie. 'top-left' is fixable, but
311
352
  // a large element with 'top-right-left' wouldn't be.
312
353
 
@@ -319,7 +360,7 @@ var usePopoverPositioning = function usePopoverPositioning(_ref) {
319
360
  case 'right':
320
361
  case 'bottom':
321
362
  case 'left':
322
- return fixOverflow(overflow, [].concat(args));
363
+ return fixOverflow(overflow, [].concat(args), alignment);
323
364
 
324
365
  default:
325
366
  return defaultOffset;
@@ -333,7 +374,8 @@ var usePopoverPositioning = function usePopoverPositioning(_ref) {
333
374
 
334
375
  return [calculateMenuOffset, {
335
376
  adjustedDirection: adjustedDirection,
336
- adjustedFlipped: adjustedFlipped
377
+ adjustedFlipped: adjustedFlipped,
378
+ adjustedAlignment: adjustedAlignment
337
379
  }];
338
380
  };
339
381
 
@@ -298,7 +298,7 @@ var formatChartData = function formatChartData(seriesArg, values, categoryDataSo
298
298
  group.forEach(function (value) {
299
299
  series.forEach(function (dataset) {
300
300
  // if value is null, don't add it to the formatted chartData
301
- if (!isNil(value[dataset.dataSourceId])) {
301
+ if ((!isNil(value[categoryDataSourceId]) || !isNil(dataset.label)) && (timeDataSourceId && type !== LayoutConstants.BAR_CHART_TYPES.GROUPED ? !isNil(value[timeDataSourceId]) : !isNil(value[categoryDataSourceId]))) {
302
302
  data.push(_objectSpread({
303
303
  // if there's a dataset label, use it
304
304
  group: dataset.label ? dataset.label : value[categoryDataSourceId],
@@ -330,7 +330,7 @@ var formatChartData = function formatChartData(seriesArg, values, categoryDataSo
330
330
  labeledData.forEach(function (dataset) {
331
331
  dataset.forEach(function (value) {
332
332
  // if value is null, don't add it to the formatted chartData
333
- if (!isNil(value[series[0].dataSourceId])) {
333
+ if (!isNil(value[series[0].dataSourceId] && value[categoryDataSourceId])) {
334
334
  data.push({
335
335
  group: value[categoryDataSourceId],
336
336
  // bar this data belongs to
@@ -83,6 +83,7 @@ var CardTitle = function CardTitle(_ref // eslint-disable-line react/prop-types
83
83
 
84
84
  var _usePopoverPositionin = usePopoverPositioning.usePopoverPositioning({
85
85
  direction: 'bottom',
86
+ defaultAlignment: 'center',
86
87
  menuOffset: index.getTooltipMenuOffset,
87
88
  useAutoPositioning: true,
88
89
  isOverflowMenu: true // Needed to preserve default direction (bottom)
@@ -90,7 +91,9 @@ var CardTitle = function CardTitle(_ref // eslint-disable-line react/prop-types
90
91
  }),
91
92
  _usePopoverPositionin2 = _slicedToArray__default['default'](_usePopoverPositionin, 2),
92
93
  calculateMenuOffset = _usePopoverPositionin2[0],
93
- adjustedDirection = _usePopoverPositionin2[1].adjustedDirection;
94
+ _usePopoverPositionin3 = _usePopoverPositionin2[1],
95
+ adjustedDirection = _usePopoverPositionin3.adjustedDirection,
96
+ adjustedAlignment = _usePopoverPositionin3.adjustedAlignment;
94
97
 
95
98
  var _useState = React.useState({
96
99
  title: false,
@@ -166,7 +169,7 @@ var CardTitle = function CardTitle(_ref // eslint-disable-line react/prop-types
166
169
  var _classnames;
167
170
 
168
171
  return hasTitleTooltipFromTruncation || hasExternalTitleTextTooltip ? /*#__PURE__*/React__default['default'].createElement(carbonComponentsReact.Tooltip, {
169
- align: "center",
172
+ align: adjustedAlignment,
170
173
  menuOffset: calculateMenuOffset,
171
174
  direction: adjustedDirection,
172
175
  "data-testid": "".concat(testId, "-title-tooltip"),
@@ -191,6 +194,9 @@ var CardTitle = function CardTitle(_ref // eslint-disable-line react/prop-types
191
194
 
192
195
  var renderSubTitle = function renderSubTitle() {
193
196
  return !subtitle ? null : hasSubTitleTooltip ? /*#__PURE__*/React__default['default'].createElement(carbonComponentsReact.Tooltip, {
197
+ align: adjustedAlignment,
198
+ menuOffset: calculateMenuOffset,
199
+ direction: adjustedDirection,
194
200
  "data-testid": "".concat(testId, "-subtitle"),
195
201
  ref: subTitleRef,
196
202
  showIcon: false,
@@ -287,7 +287,7 @@ var defaultProps = {
287
287
  };
288
288
 
289
289
  var DateTimePicker = function DateTimePicker(_ref) {
290
- var _classnames2, _classnames4, _style$zIndex;
290
+ var _classnames, _classnames2, _classnames4, _style$zIndex;
291
291
 
292
292
  var testId = _ref.testId,
293
293
  defaultValue = _ref.defaultValue,
@@ -862,7 +862,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
862
862
  }, /*#__PURE__*/React__default['default'].createElement("div", {
863
863
  "data-testid": testId,
864
864
  id: "".concat(id, "-").concat(iotPrefix, "--date-time-pickerv2__wrapper"),
865
- className: classnames__default['default']("".concat(iotPrefix, "--date-time-pickerv2__wrapper"), _defineProperty__default['default']({}, "".concat(iotPrefix, "--date-time-pickerv2__wrapper--disabled"), disabled)),
865
+ className: classnames__default['default']("".concat(iotPrefix, "--date-time-pickerv2__wrapper"), (_classnames = {}, _defineProperty__default['default'](_classnames, "".concat(iotPrefix, "--date-time-pickerv2__wrapper--disabled"), disabled), _defineProperty__default['default'](_classnames, "".concat(iotPrefix, "--date-time-pickerv2__wrapper--invalid"), invalidState), _classnames)),
866
866
  style: {
867
867
  '--wrapper-width': hasIconOnly ? '3rem' : '20rem'
868
868
  },
@@ -884,7 +884,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
884
884
  onMouseLeave: toggleTooltip,
885
885
  tabIndex: 0
886
886
  }, /*#__PURE__*/React__default['default'].createElement("div", {
887
- className: classnames__default['default']((_classnames2 = {}, _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--full"), !hasIconOnly), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--light"), light), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--invalid"), invalidState), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--disabled"), disabled), _classnames2))
887
+ className: classnames__default['default']((_classnames2 = {}, _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--full"), !hasIconOnly), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--light"), light), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--disabled"), disabled), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--invalid"), invalidState), _classnames2))
888
888
  }, !hasIconOnly ? /*#__PURE__*/React__default['default'].createElement("div", {
889
889
  "data-testid": "".concat(testId, "__field"),
890
890
  className: "".concat(iotPrefix, "--date-time-picker__field")
@@ -268,7 +268,7 @@ var defaultProps = {
268
268
  };
269
269
 
270
270
  var DateTimePicker = function DateTimePicker(_ref) {
271
- var _classnames2, _classnames4;
271
+ var _classnames, _classnames2, _classnames4;
272
272
 
273
273
  var testId = _ref.testId,
274
274
  defaultValue = _ref.defaultValue,
@@ -721,7 +721,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
721
721
  }, /*#__PURE__*/React__default['default'].createElement("div", {
722
722
  "data-testid": testId,
723
723
  id: "".concat(id, "-").concat(iotPrefix, "--date-time-pickerv2__wrapper"),
724
- className: classnames__default['default']("".concat(iotPrefix, "--date-time-pickerv2__wrapper"), _defineProperty__default['default']({}, "".concat(iotPrefix, "--date-time-pickerv2__wrapper--disabled"), disabled)),
724
+ className: classnames__default['default']("".concat(iotPrefix, "--date-time-pickerv2__wrapper"), (_classnames = {}, _defineProperty__default['default'](_classnames, "".concat(iotPrefix, "--date-time-pickerv2__wrapper--disabled"), disabled), _defineProperty__default['default'](_classnames, "".concat(iotPrefix, "--date-time-pickerv2__wrapper--invalid"), invalidState), _classnames)),
725
725
  style: {
726
726
  '--wrapper-width': hasIconOnly ? '3rem' : '20rem'
727
727
  },
@@ -743,7 +743,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
743
743
  onMouseLeave: toggleTooltip,
744
744
  tabIndex: 0
745
745
  }, /*#__PURE__*/React__default['default'].createElement("div", {
746
- className: classnames__default['default']((_classnames2 = {}, _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--full"), !hasIconOnly), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--light"), light), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--invalid"), invalidState), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--disabled"), disabled), _classnames2))
746
+ className: classnames__default['default']((_classnames2 = {}, _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--full"), !hasIconOnly), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--light"), light), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--disabled"), disabled), _defineProperty__default['default'](_classnames2, "".concat(iotPrefix, "--date-time-picker__box--invalid"), invalidState), _classnames2))
747
747
  }, !hasIconOnly ? /*#__PURE__*/React__default['default'].createElement("div", {
748
748
  "data-testid": "".concat(testId, "__field"),
749
749
  className: "".concat(iotPrefix, "--date-time-picker__field")
@@ -69,6 +69,9 @@ var IdleLogoutConfirmationModalI18NPropTypes = {
69
69
  sessionTimeoutModalStayLoggedInButton: PropTypes__default['default'].string
70
70
  };
71
71
  var defaultProps = {
72
+ isAdminView: null,
73
+ appId: null,
74
+ workspaceId: null,
72
75
  className: null,
73
76
  idleTimeoutData: {
74
77
  timeout: 1800,
@@ -110,6 +113,15 @@ var defaultProps = {
110
113
  }
111
114
  };
112
115
  var propTypes = {
116
+ /** If true, include the originIsAdmin query param in the logout URL */
117
+ isAdminView: PropTypes__default['default'].bool,
118
+
119
+ /** Application ID in suite */
120
+ appId: PropTypes__default['default'].string,
121
+
122
+ /** Workspace ID in suite */
123
+ workspaceId: PropTypes__default['default'].string,
124
+
113
125
  /** Add class name to the rendered Modal component */
114
126
  className: PropTypes__default['default'].string,
115
127
 
@@ -130,7 +142,10 @@ var propTypes = {
130
142
  };
131
143
 
132
144
  var IdleLogoutConfirmationModal = function IdleLogoutConfirmationModal(_ref) {
133
- var className = _ref.className,
145
+ var isAdminView = _ref.isAdminView,
146
+ appId = _ref.appId,
147
+ workspaceId = _ref.workspaceId,
148
+ className = _ref.className,
134
149
  idleTimeoutData = _ref.idleTimeoutData,
135
150
  routes = _ref.routes,
136
151
  onRouteChange = _ref.onRouteChange,
@@ -147,7 +162,7 @@ var IdleLogoutConfirmationModal = function IdleLogoutConfirmationModal(_ref) {
147
162
 
148
163
  return acc.replace(key, val);
149
164
  }, string);
150
- }, []); // Append originHref query parameter to the logout routes
165
+ }, []); // Append originHref query parameter (and, optionally, originIsAdmin, originWorkspaceId and originAppId) to the logout routes
151
166
 
152
167
  var logoutRoute = routes === null || routes === void 0 ? void 0 : routes.logout;
153
168
 
@@ -156,8 +171,21 @@ var IdleLogoutConfirmationModal = function IdleLogoutConfirmationModal(_ref) {
156
171
 
157
172
  if (window.location.href) {
158
173
  url.searchParams.append('originHref', window.location.href);
159
- logoutRoute = url.href;
160
174
  }
175
+
176
+ if (appId) {
177
+ url.searchParams.append('originAppId', appId);
178
+ }
179
+
180
+ if (workspaceId) {
181
+ url.searchParams.append('originWorkspaceId', workspaceId);
182
+ }
183
+
184
+ if (isAdminView) {
185
+ url.searchParams.append('originIsAdmin', isAdminView);
186
+ }
187
+
188
+ logoutRoute = url.href;
161
189
  } catch (e) {
162
190
  logoutRoute = routes === null || routes === void 0 ? void 0 : routes.logout;
163
191
  }
@@ -169,9 +197,21 @@ var IdleLogoutConfirmationModal = function IdleLogoutConfirmationModal(_ref) {
169
197
 
170
198
  if (window.location.href) {
171
199
  _url.searchParams.append('originHref', window.location.href);
200
+ }
172
201
 
173
- logoutInactivityRoute = _url.href;
202
+ if (appId) {
203
+ _url.searchParams.append('originAppId', appId);
174
204
  }
205
+
206
+ if (workspaceId) {
207
+ _url.searchParams.append('originWorkspaceId', workspaceId);
208
+ }
209
+
210
+ if (isAdminView) {
211
+ _url.searchParams.append('originIsAdmin', isAdminView);
212
+ }
213
+
214
+ logoutInactivityRoute = _url.href;
175
215
  } catch (e) {
176
216
  logoutInactivityRoute = routes === null || routes === void 0 ? void 0 : routes.logoutInactivity;
177
217
  } // This state is just to force the recreation of the IdleTimer object in the useEffect below
@@ -329,6 +369,39 @@ IdleLogoutConfirmationModal.__docgenInfo = {
329
369
  "methods": [],
330
370
  "displayName": "IdleLogoutConfirmationModal",
331
371
  "props": {
372
+ "isAdminView": {
373
+ "defaultValue": {
374
+ "value": "null",
375
+ "computed": false
376
+ },
377
+ "type": {
378
+ "name": "bool"
379
+ },
380
+ "required": false,
381
+ "description": "If true, include the originIsAdmin query param in the logout URL"
382
+ },
383
+ "appId": {
384
+ "defaultValue": {
385
+ "value": "null",
386
+ "computed": false
387
+ },
388
+ "type": {
389
+ "name": "string"
390
+ },
391
+ "required": false,
392
+ "description": "Application ID in suite"
393
+ },
394
+ "workspaceId": {
395
+ "defaultValue": {
396
+ "value": "null",
397
+ "computed": false
398
+ },
399
+ "type": {
400
+ "name": "string"
401
+ },
402
+ "required": false,
403
+ "description": "Workspace ID in suite"
404
+ },
332
405
  "className": {
333
406
  "defaultValue": {
334
407
  "value": "null",
@@ -221,6 +221,8 @@ var propTypes = {
221
221
  };
222
222
 
223
223
  var SuiteHeader = function SuiteHeader(_ref) {
224
+ var _currentWorkspace$app, _currentWorkspace$app2, _currentWorkspace$app3, _applications$find;
225
+
224
226
  var className = _ref.className,
225
227
  suiteName = _ref.suiteName,
226
228
  appName = _ref.appName,
@@ -280,7 +282,12 @@ var SuiteHeader = function SuiteHeader(_ref) {
280
282
  var isMultiWorkspace = (workspaces === null || workspaces === void 0 ? void 0 : workspaces.length) > 0;
281
283
  var currentWorkspace = workspaces === null || workspaces === void 0 ? void 0 : workspaces.find(function (wo) {
282
284
  return wo.isCurrent;
283
- }); // Include the current workspace label only if we are not in an admin page and multi workspace is supported and more than one workspace is available
285
+ });
286
+ var appId = (_currentWorkspace$app = currentWorkspace === null || currentWorkspace === void 0 ? void 0 : (_currentWorkspace$app2 = currentWorkspace.applications) === null || _currentWorkspace$app2 === void 0 ? void 0 : (_currentWorkspace$app3 = _currentWorkspace$app2.find(function (a) {
287
+ return a.isCurrent;
288
+ })) === null || _currentWorkspace$app3 === void 0 ? void 0 : _currentWorkspace$app3.id) !== null && _currentWorkspace$app !== void 0 ? _currentWorkspace$app : applications === null || applications === void 0 ? void 0 : (_applications$find = applications.find(function (a) {
289
+ return a.isCurrent;
290
+ })) === null || _applications$find === void 0 ? void 0 : _applications$find.id; // Include the current workspace label only if we are not in an admin page and multi workspace is supported and more than one workspace is available
284
291
 
285
292
  var currentWorkspaceComponent = !isAdminView && isMultiWorkspace && (workspaces === null || workspaces === void 0 ? void 0 : workspaces.length) > 1 && currentWorkspace ? /*#__PURE__*/React__default['default'].createElement("span", {
286
293
  "data-testid": "".concat(testId, "--current-workspace")
@@ -293,7 +300,7 @@ var SuiteHeader = function SuiteHeader(_ref) {
293
300
  className: "".concat(Settings.settings.iotPrefix, "--suite-header-subtitle")
294
301
  }, extraContent) : null;
295
302
  var navigatorRoute = (currentWorkspace === null || currentWorkspace === void 0 ? void 0 : currentWorkspace.href) || (routes === null || routes === void 0 ? void 0 : routes.navigator) || 'javascript:void(0)';
296
- var adminRoute = (routes === null || routes === void 0 ? void 0 : routes.admin) || 'javascript:void(0)'; // Append originHref query parameter to the logout route
303
+ var adminRoute = (routes === null || routes === void 0 ? void 0 : routes.admin) || 'javascript:void(0)'; // Append originHref query parameter (and, optionally, originIsAdmin, originWorkspaceId and originAppId) to the logout route
297
304
 
298
305
  var logoutRoute = routes === null || routes === void 0 ? void 0 : routes.logout;
299
306
 
@@ -302,8 +309,21 @@ var SuiteHeader = function SuiteHeader(_ref) {
302
309
 
303
310
  if (window.location.href) {
304
311
  url.searchParams.append('originHref', window.location.href);
305
- logoutRoute = url.href;
306
312
  }
313
+
314
+ if (appId) {
315
+ url.searchParams.append('originAppId', appId);
316
+ }
317
+
318
+ if (currentWorkspace !== null && currentWorkspace !== void 0 && currentWorkspace.id) {
319
+ url.searchParams.append('originWorkspaceId', currentWorkspace.id);
320
+ }
321
+
322
+ if (isAdminView) {
323
+ url.searchParams.append('originIsAdmin', isAdminView);
324
+ }
325
+
326
+ logoutRoute = url.href;
307
327
  } catch (e) {
308
328
  logoutRoute = routes === null || routes === void 0 ? void 0 : routes.logout;
309
329
  } // If there are custom help links, include an extra child content entry for the separator
@@ -380,6 +400,9 @@ var SuiteHeader = function SuiteHeader(_ref) {
380
400
  return setShowToast(false);
381
401
  }
382
402
  }) : null, idleTimeoutData && (routes === null || routes === void 0 ? void 0 : routes.domain) !== null && (routes === null || routes === void 0 ? void 0 : routes.domain) !== undefined ? /*#__PURE__*/React__default['default'].createElement(IdleLogoutConfirmationModal['default'], {
403
+ isAdminView: isAdminView,
404
+ appId: appId,
405
+ workspaceId: currentWorkspace === null || currentWorkspace === void 0 ? void 0 : currentWorkspace.id,
383
406
  idleTimeoutData: idleTimeoutData,
384
407
  routes: routes,
385
408
  onRouteChange: onRouteChange,
@@ -18,6 +18,8 @@ var useUiResources = function useUiResources(_ref) {
18
18
  lang = _ref$lang === void 0 ? 'en' : _ref$lang,
19
19
  _ref$surveyId = _ref.surveyId,
20
20
  surveyId = _ref$surveyId === void 0 ? null : _ref$surveyId,
21
+ _ref$appId = _ref.appId,
22
+ appId = _ref$appId === void 0 ? null : _ref$appId,
21
23
  _ref$workspaceId = _ref.workspaceId,
22
24
  workspaceId = _ref$workspaceId === void 0 ? null : _ref$workspaceId,
23
25
  _ref$fetchApi = _ref.fetchApi,
@@ -63,6 +65,7 @@ var useUiResources = function useUiResources(_ref) {
63
65
  baseApiUrl: baseApiUrl,
64
66
  lang: lang,
65
67
  surveyId: surveyId,
68
+ appId: appId,
66
69
  workspaceId: workspaceId,
67
70
  fetchApi: fetchApi,
68
71
  isTest: isTest
@@ -90,7 +93,7 @@ var useUiResources = function useUiResources(_ref) {
90
93
  }
91
94
  }
92
95
  }, _callee, null, [[0, 8, 11, 14]]);
93
- })), [baseApiUrl, lang, surveyId, workspaceId, isTest, setIsLoading]); // eslint-disable-line react-hooks/exhaustive-deps
96
+ })), [baseApiUrl, lang, surveyId, appId, workspaceId, isTest, setIsLoading]); // eslint-disable-line react-hooks/exhaustive-deps
94
97
 
95
98
  React.useEffect(function () {
96
99
  // load actual data
@@ -55,13 +55,13 @@ var defaultFetchApi = /*#__PURE__*/function () {
55
55
 
56
56
  var getUiResourcesData = /*#__PURE__*/function () {
57
57
  var _ref3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
58
- var baseApiUrl, _ref2$lang, lang, _ref2$surveyId, surveyId, _ref2$workspaceId, workspaceId, _ref2$fetchApi, fetchApi, _ref2$isTest, isTest, api, langParam, surveyIdParam, workspaceIdParam;
58
+ var baseApiUrl, _ref2$lang, lang, _ref2$surveyId, surveyId, _ref2$appId, appId, _ref2$workspaceId, workspaceId, _ref2$fetchApi, fetchApi, _ref2$isTest, isTest, api, langParam, surveyIdParam, appIdParam, workspaceIdParam;
59
59
 
60
60
  return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
61
61
  while (1) {
62
62
  switch (_context2.prev = _context2.next) {
63
63
  case 0:
64
- baseApiUrl = _ref2.baseApiUrl, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? 'en' : _ref2$lang, _ref2$surveyId = _ref2.surveyId, surveyId = _ref2$surveyId === void 0 ? null : _ref2$surveyId, _ref2$workspaceId = _ref2.workspaceId, workspaceId = _ref2$workspaceId === void 0 ? null : _ref2$workspaceId, _ref2$fetchApi = _ref2.fetchApi, fetchApi = _ref2$fetchApi === void 0 ? defaultFetchApi : _ref2$fetchApi, _ref2$isTest = _ref2.isTest, isTest = _ref2$isTest === void 0 ? false : _ref2$isTest;
64
+ baseApiUrl = _ref2.baseApiUrl, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? 'en' : _ref2$lang, _ref2$surveyId = _ref2.surveyId, surveyId = _ref2$surveyId === void 0 ? null : _ref2$surveyId, _ref2$appId = _ref2.appId, appId = _ref2$appId === void 0 ? null : _ref2$appId, _ref2$workspaceId = _ref2.workspaceId, workspaceId = _ref2$workspaceId === void 0 ? null : _ref2$workspaceId, _ref2$fetchApi = _ref2.fetchApi, fetchApi = _ref2$fetchApi === void 0 ? defaultFetchApi : _ref2$fetchApi, _ref2$isTest = _ref2.isTest, isTest = _ref2$isTest === void 0 ? false : _ref2$isTest;
65
65
 
66
66
  api = function api(method, path, body, headers) {
67
67
  return fetchApi(method, "".concat(baseApiUrl).concat(path), body, headers, isTest ? uiresources_fixture[path.split('?')[0]] : null);
@@ -69,10 +69,11 @@ var getUiResourcesData = /*#__PURE__*/function () {
69
69
 
70
70
  langParam = "&lang=".concat(lang);
71
71
  surveyIdParam = surveyId ? "&surveyId=".concat(surveyId) : '';
72
+ appIdParam = appId ? "&appId=".concat(appId) : '';
72
73
  workspaceIdParam = workspaceId ? "&workspaceId=".concat(workspaceId) : '';
73
- return _context2.abrupt("return", api('GET', "/uiresources?id=masthead".concat(langParam).concat(surveyIdParam).concat(workspaceIdParam)));
74
+ return _context2.abrupt("return", api('GET', "/uiresources?id=masthead".concat(langParam).concat(surveyIdParam).concat(appIdParam).concat(workspaceIdParam)));
74
75
 
75
- case 6:
76
+ case 7:
76
77
  case "end":
77
78
  return _context2.stop();
78
79
  }
@@ -41,6 +41,7 @@ var useLangDirection = require('use-lang-direction');
41
41
  var warning = require('warning');
42
42
  var componentUtilityFunctions = require('../../utils/componentUtilityFunctions.js');
43
43
  var Settings = require('../../constants/Settings.js');
44
+ var SharedPropTypes = require('../../constants/SharedPropTypes.js');
44
45
  var FilterTags = require('../FilterTags/FilterTags.js');
45
46
  var RuleBuilderPropTypes = require('../RuleBuilder/RuleBuilderPropTypes.js');
46
47
  var experimental = require('../../internal/experimental.js');
@@ -175,8 +176,9 @@ var propTypes = {
175
176
  * always - Wrap if needed for all table column configurations
176
177
  * never - Tables with dynamic columns widths grow larger and tables with fixed or resizable columns truncate.
177
178
  * alwaysTruncate - Always truncate if needed for all table column configurations
179
+ * expand - Expand to fit text width (by horizontal scrollbar) for table with fixed columns
178
180
  */
179
- wrapCellText: PropTypes__default['default'].oneOf(['always', 'never', 'auto', 'alwaysTruncate']),
181
+ wrapCellText: SharedPropTypes.WrapCellTextPropTypes,
180
182
 
181
183
  /** use white-space: pre; css when true */
182
184
  preserveCellWhiteSpace: PropTypes__default['default'].bool
@@ -725,7 +727,7 @@ var Table = function Table(props) {
725
727
  forceUpdateCellTextWidth = _useState4[1];
726
728
 
727
729
  var useCellTextTruncate = React.useMemo(function () {
728
- return options ? options.wrapCellText === 'alwaysTruncate' || options.wrapCellText !== 'always' && (options.hasResize && !options.useAutoTableLayoutForResize || columns.some(function (col) {
730
+ return options ? options.wrapCellText === 'alwaysTruncate' || options.wrapCellText !== 'always' && options.wrapCellText !== 'expand' && (options.hasResize && !options.useAutoTableLayoutForResize || columns.some(function (col) {
729
731
  return col.hasOwnProperty('width');
730
732
  })) : undefined;
731
733
  }, [options, columns]);
@@ -1335,21 +1337,9 @@ Table.__docgenInfo = {
1335
1337
  "required": false
1336
1338
  },
1337
1339
  "wrapCellText": {
1338
- "name": "enum",
1339
- "value": [{
1340
- "value": "'always'",
1341
- "computed": false
1342
- }, {
1343
- "value": "'never'",
1344
- "computed": false
1345
- }, {
1346
- "value": "'auto'",
1347
- "computed": false
1348
- }, {
1349
- "value": "'alwaysTruncate'",
1350
- "computed": false
1351
- }],
1352
- "description": "auto - Wrap for tables with dynamic columns widths and truncate for tables with fixed or resizable columns\nalways - Wrap if needed for all table column configurations\nnever - Tables with dynamic columns widths grow larger and tables with fixed or resizable columns truncate.\nalwaysTruncate - Always truncate if needed for all table column configurations",
1340
+ "name": "custom",
1341
+ "raw": "WrapCellTextPropTypes",
1342
+ "description": "auto - Wrap for tables with dynamic columns widths and truncate for tables with fixed or resizable columns\nalways - Wrap if needed for all table column configurations\nnever - Tables with dynamic columns widths grow larger and tables with fixed or resizable columns truncate.\nalwaysTruncate - Always truncate if needed for all table column configurations\nexpand - Expand to fit text width (by horizontal scrollbar) for table with fixed columns",
1353
1343
  "required": false
1354
1344
  },
1355
1345
  "preserveCellWhiteSpace": {
@@ -24,6 +24,7 @@ var PropTypes = require('prop-types');
24
24
  var carbonComponentsReact = require('carbon-components-react');
25
25
  var TablePropTypes = require('../TablePropTypes.js');
26
26
  var deprecate = require('../../../internal/deprecate.js');
27
+ var SharedPropTypes = require('../../../constants/SharedPropTypes.js');
27
28
  var tableUtilities = require('../tableUtilities.js');
28
29
  var TableBodyRowRenderer = require('./TableBodyRowRenderer.js');
29
30
 
@@ -83,7 +84,7 @@ var propTypes = {
83
84
  hasSingleNestedHierarchy: PropTypes__default['default'].bool
84
85
  })]),
85
86
  hasRowActions: PropTypes__default['default'].bool,
86
- wrapCellText: PropTypes__default['default'].oneOf(['always', 'never', 'auto', 'alwaysTruncate']).isRequired,
87
+ wrapCellText: SharedPropTypes.WrapCellTextPropTypes.isRequired,
87
88
  truncateCellText: PropTypes__default['default'].bool.isRequired,
88
89
 
89
90
  /** the current state of the row actions */
@@ -785,22 +786,10 @@ TableBody.__docgenInfo = {
785
786
  },
786
787
  "wrapCellText": {
787
788
  "type": {
788
- "name": "enum",
789
- "value": [{
790
- "value": "'always'",
791
- "computed": false
792
- }, {
793
- "value": "'never'",
794
- "computed": false
795
- }, {
796
- "value": "'auto'",
797
- "computed": false
798
- }, {
799
- "value": "'alwaysTruncate'",
800
- "computed": false
801
- }]
789
+ "name": "custom",
790
+ "raw": "WrapCellTextPropTypes.isRequired"
802
791
  },
803
- "required": true,
792
+ "required": false,
804
793
  "description": ""
805
794
  },
806
795
  "truncateCellText": {