carbon-addons-iot-react 5.15.1 → 5.15.2

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.
@@ -1,4 +1,3 @@
1
- import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
2
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
3
  import debounce from '../../../node_modules/lodash-es/debounce.js';
@@ -272,21 +271,27 @@ var TableHead = function TableHead(_ref) {
272
271
  };
273
272
  var onManualColumnResize = function onManualColumnResize(modifiedColumnWidths) {
274
273
  if (percentageMode) {
275
- var modifiedColumns = _toConsumableArray(columns);
276
- Object.keys(modifiedColumns).forEach(function (key) {
277
- if (modifiedColumns[key].hasOwnProperty('width')) {
278
- delete modifiedColumns[key].width;
279
- }
280
- });
274
+ // Measure current rendered widths BEFORE switching to pixel mode
275
+ // This prevents unused space by preserving actual column widths
276
+ var measuredWidths = measureColumnWidths();
281
277
 
282
- // while Resizing setting all column width to default DEFAULT_COLUMN_WIDTH 150px
283
- var columnPropInlcudingWidths = addMissingColumnWidths({
284
- ordering: ordering,
285
- columns: modifiedColumns,
286
- currentColumnWidths: {}
278
+ // Convert measured widths directly to column format with pixel values
279
+ // This preserves the actual rendered widths instead of using defaults
280
+ var columnsWithMeasuredWidths = columns.map(function (col) {
281
+ var measured = measuredWidths.find(function (m) {
282
+ return m.id === col.id;
283
+ });
284
+ return _objectSpread(_objectSpread({}, col), {}, {
285
+ width: measured ? "".concat(measured.width, "px") : col.width
286
+ });
287
287
  });
288
- var newColumnWidths = createNewWidthsMap(ordering, columnPropInlcudingWidths);
289
- setCurrentColumnWidths(newColumnWidths);
288
+
289
+ // Create width map from columns with measured values, then apply user's resize
290
+ var newColumnWidths = createNewWidthsMap(ordering, columnsWithMeasuredWidths, modifiedColumnWidths);
291
+
292
+ // Update both state and notify parent component
293
+ // This ensures horizontal scrollbar appears if total width exceeds container
294
+ updateColumnWidths(newColumnWidths);
290
295
  setPercentageMode(false);
291
296
  } else {
292
297
  var _newColumnWidths = createNewWidthsMap(ordering, currentColumnWidths, modifiedColumnWidths);
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
4
3
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
5
4
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
5
  var debounce = require('../../../node_modules/lodash-es/debounce.js');
@@ -49,7 +48,6 @@ var iconsReact = require('@carbon/icons-react');
49
48
 
50
49
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
51
50
 
52
- var _toConsumableArray__default = /*#__PURE__*/_interopDefault(_toConsumableArray);
53
51
  var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
54
52
  var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
55
53
  var React__default = /*#__PURE__*/_interopDefault(React);
@@ -284,21 +282,27 @@ var TableHead = function TableHead(_ref) {
284
282
  };
285
283
  var onManualColumnResize = function onManualColumnResize(modifiedColumnWidths) {
286
284
  if (percentageMode) {
287
- var modifiedColumns = _toConsumableArray__default.default(columns);
288
- Object.keys(modifiedColumns).forEach(function (key) {
289
- if (modifiedColumns[key].hasOwnProperty('width')) {
290
- delete modifiedColumns[key].width;
291
- }
292
- });
285
+ // Measure current rendered widths BEFORE switching to pixel mode
286
+ // This prevents unused space by preserving actual column widths
287
+ var measuredWidths = measureColumnWidths();
293
288
 
294
- // while Resizing setting all column width to default DEFAULT_COLUMN_WIDTH 150px
295
- var columnPropInlcudingWidths = columnWidthUtilityFunctions.addMissingColumnWidths({
296
- ordering: ordering,
297
- columns: modifiedColumns,
298
- currentColumnWidths: {}
289
+ // Convert measured widths directly to column format with pixel values
290
+ // This preserves the actual rendered widths instead of using defaults
291
+ var columnsWithMeasuredWidths = columns.map(function (col) {
292
+ var measured = measuredWidths.find(function (m) {
293
+ return m.id === col.id;
294
+ });
295
+ return _objectSpread(_objectSpread({}, col), {}, {
296
+ width: measured ? "".concat(measured.width, "px") : col.width
297
+ });
299
298
  });
300
- var newColumnWidths = columnWidthUtilityFunctions.createNewWidthsMap(ordering, columnPropInlcudingWidths);
301
- setCurrentColumnWidths(newColumnWidths);
299
+
300
+ // Create width map from columns with measured values, then apply user's resize
301
+ var newColumnWidths = columnWidthUtilityFunctions.createNewWidthsMap(ordering, columnsWithMeasuredWidths, modifiedColumnWidths);
302
+
303
+ // Update both state and notify parent component
304
+ // This ensures horizontal scrollbar appears if total width exceeds container
305
+ updateColumnWidths(newColumnWidths);
302
306
  setPercentageMode(false);
303
307
  } else {
304
308
  var _newColumnWidths = columnWidthUtilityFunctions.createNewWidthsMap(ordering, currentColumnWidths, modifiedColumnWidths);
package/package.json CHANGED
@@ -353,7 +353,7 @@
353
353
  "whatwg-fetch": "^3.0.0"
354
354
  },
355
355
  "sideEffects": false,
356
- "version": "5.15.1",
356
+ "version": "5.15.2",
357
357
  "resolutions": {
358
358
  "chokidar": "3.3.1",
359
359
  "react-grid-layout": "1.2.2",
@@ -234295,21 +234295,27 @@ ${formatRule(Codicon.menuSubmenu)}
234295
234295
  };
234296
234296
  var onManualColumnResize = function onManualColumnResize(modifiedColumnWidths) {
234297
234297
  if (percentageMode) {
234298
- var modifiedColumns = _toConsumableArray$2(columns);
234299
- Object.keys(modifiedColumns).forEach(function (key) {
234300
- if (modifiedColumns[key].hasOwnProperty('width')) {
234301
- delete modifiedColumns[key].width;
234302
- }
234303
- });
234298
+ // Measure current rendered widths BEFORE switching to pixel mode
234299
+ // This prevents unused space by preserving actual column widths
234300
+ var measuredWidths = measureColumnWidths();
234304
234301
 
234305
- // while Resizing setting all column width to default DEFAULT_COLUMN_WIDTH 150px
234306
- var columnPropInlcudingWidths = addMissingColumnWidths({
234307
- ordering: ordering,
234308
- columns: modifiedColumns,
234309
- currentColumnWidths: {}
234302
+ // Convert measured widths directly to column format with pixel values
234303
+ // This preserves the actual rendered widths instead of using defaults
234304
+ var columnsWithMeasuredWidths = columns.map(function (col) {
234305
+ var measured = measuredWidths.find(function (m) {
234306
+ return m.id === col.id;
234307
+ });
234308
+ return _objectSpread$1R(_objectSpread$1R({}, col), {}, {
234309
+ width: measured ? "".concat(measured.width, "px") : col.width
234310
+ });
234310
234311
  });
234311
- var newColumnWidths = createNewWidthsMap(ordering, columnPropInlcudingWidths);
234312
- setCurrentColumnWidths(newColumnWidths);
234312
+
234313
+ // Create width map from columns with measured values, then apply user's resize
234314
+ var newColumnWidths = createNewWidthsMap(ordering, columnsWithMeasuredWidths, modifiedColumnWidths);
234315
+
234316
+ // Update both state and notify parent component
234317
+ // This ensures horizontal scrollbar appears if total width exceeds container
234318
+ updateColumnWidths(newColumnWidths);
234313
234319
  setPercentageMode(false);
234314
234320
  } else {
234315
234321
  var _newColumnWidths = createNewWidthsMap(ordering, currentColumnWidths, modifiedColumnWidths);