@commercetools-uikit/data-table 19.20.1 → 19.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.
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
-
require('prop-types');
|
|
7
|
-
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
8
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
9
5
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
10
6
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
11
7
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -14,6 +10,11 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
14
10
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
15
11
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
16
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
15
|
+
require('prop-types');
|
|
16
|
+
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
17
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
17
18
|
var react$1 = require('react');
|
|
18
19
|
var isEqual = require('lodash/isEqual');
|
|
19
20
|
var utils = require('@commercetools-uikit/utils');
|
|
@@ -32,8 +33,6 @@ var dataTableManagerProvider = require('@commercetools-uikit/data-table-manager/
|
|
|
32
33
|
|
|
33
34
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
34
35
|
|
|
35
|
-
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
36
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
37
36
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
38
37
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
39
38
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -42,6 +41,8 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
42
41
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
43
42
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
44
43
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
44
|
+
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
45
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
45
46
|
var isEqual__default = /*#__PURE__*/_interopDefault(isEqual);
|
|
46
47
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
47
48
|
var AccessibleButton__default = /*#__PURE__*/_interopDefault(AccessibleButton);
|
|
@@ -267,14 +268,14 @@ const TableRow = /*#__PURE__*/_styled__default["default"]("tr", {
|
|
|
267
268
|
target: "epk01s20"
|
|
268
269
|
} )("display:contents;", getClickableRowStyle, " :hover,:focus-within{", RowExpandCollapseButton, "{opacity:1;}}" + ("" ));
|
|
269
270
|
|
|
270
|
-
const defaultProps
|
|
271
|
+
const defaultProps = {
|
|
271
272
|
horizontalCellAlignment: 'left'
|
|
272
273
|
};
|
|
273
274
|
const Footer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
274
275
|
target: "e2ce7vj0"
|
|
275
276
|
} )("box-sizing:border-box;display:block;", getPaddingStyle, " ", getHorizontalAlignmentStyle, " background-color:", designSystem.designTokens.colorSurface, ";border-top:1px solid ", designSystem.designTokens.colorNeutral90, ";border-bottom:1px solid ", designSystem.designTokens.colorNeutral90, ";width:100%;", props => props.resizedTotalWidth ? `max-width: ${props.resizedTotalWidth}px;` : '', ";" + ("" ));
|
|
276
277
|
Footer.displayName = 'Footer';
|
|
277
|
-
Footer.defaultProps = defaultProps
|
|
278
|
+
Footer.defaultProps = defaultProps;
|
|
278
279
|
var Footer$1 = Footer;
|
|
279
280
|
|
|
280
281
|
const ResizerIndicator = /*#__PURE__*/_styled__default["default"]("div", {
|
|
@@ -302,6 +303,7 @@ const isFixedWidthValue = value => {
|
|
|
302
303
|
};
|
|
303
304
|
var isFixedWidthValue$1 = isFixedWidthValue;
|
|
304
305
|
|
|
306
|
+
const _excluded$3 = ["sortDirection", "disableHeaderStickiness", "horizontalCellAlignment"];
|
|
305
307
|
function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
306
308
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$3(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$3(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
307
309
|
const HeaderCellWrapper = props => {
|
|
@@ -341,21 +343,23 @@ const HeaderCellWrapper = props => {
|
|
|
341
343
|
});
|
|
342
344
|
};
|
|
343
345
|
HeaderCellWrapper.displayName = 'HeaderCellWrapper';
|
|
344
|
-
const
|
|
345
|
-
sortDirection
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
const HeaderCell = _ref => {
|
|
347
|
+
let _ref$sortDirection = _ref.sortDirection,
|
|
348
|
+
sortDirection = _ref$sortDirection === void 0 ? 'desc' : _ref$sortDirection,
|
|
349
|
+
_ref$disableHeaderSti = _ref.disableHeaderStickiness,
|
|
350
|
+
disableHeaderStickiness = _ref$disableHeaderSti === void 0 ? false : _ref$disableHeaderSti,
|
|
351
|
+
_ref$horizontalCellAl = _ref.horizontalCellAlignment,
|
|
352
|
+
horizontalCellAlignment = _ref$horizontalCellAl === void 0 ? 'left' : _ref$horizontalCellAl,
|
|
353
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
350
354
|
let sortableHeaderProps = {};
|
|
351
355
|
let SortingIcon;
|
|
352
356
|
if (props.isSortable) {
|
|
353
357
|
const isActive = props.sortedBy === props.columnKey;
|
|
354
|
-
const nextSortDirection = !isActive ||
|
|
355
|
-
SortingIcon =
|
|
358
|
+
const nextSortDirection = !isActive || sortDirection === 'desc' ? 'asc' : 'desc';
|
|
359
|
+
SortingIcon = sortDirection === 'desc' ? icons.ArrowDownIcon : icons.ArrowUpIcon;
|
|
356
360
|
sortableHeaderProps = {
|
|
357
361
|
as: 'button',
|
|
358
|
-
label:
|
|
362
|
+
label: sortDirection,
|
|
359
363
|
onClick: () => props.onClick && props.onClick(props.columnKey, nextSortDirection),
|
|
360
364
|
isActive,
|
|
361
365
|
isSortable: true
|
|
@@ -366,11 +370,11 @@ const HeaderCell = props => {
|
|
|
366
370
|
columnKey: props.columnKey,
|
|
367
371
|
onColumnResized: props.onColumnResized,
|
|
368
372
|
disableResizing: props.disableResizing,
|
|
369
|
-
disableHeaderStickiness:
|
|
373
|
+
disableHeaderStickiness: disableHeaderStickiness,
|
|
370
374
|
children: jsxRuntime.jsxs(HeaderCellInner, _objectSpread$3(_objectSpread$3({
|
|
371
375
|
shouldWrap: props.shouldWrap,
|
|
372
376
|
isCondensed: props.isCondensed,
|
|
373
|
-
horizontalCellAlignment:
|
|
377
|
+
horizontalCellAlignment: horizontalCellAlignment
|
|
374
378
|
}, sortableHeaderProps), {}, {
|
|
375
379
|
children: [jsxRuntime.jsxs(HeaderLabelWrapper, {
|
|
376
380
|
children: [jsxRuntime.jsx(HeaderLabelTextWrapper, {
|
|
@@ -394,29 +398,33 @@ const HeaderCell = props => {
|
|
|
394
398
|
};
|
|
395
399
|
HeaderCell.propTypes = {};
|
|
396
400
|
HeaderCell.displayName = 'HeaderCell';
|
|
397
|
-
HeaderCell.defaultProps = defaultProps$3;
|
|
398
401
|
var HeaderCell$1 = HeaderCell;
|
|
399
402
|
|
|
403
|
+
const _excluded$2 = ["isTruncated", "shouldRenderBottomBorder"];
|
|
400
404
|
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
401
405
|
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
402
|
-
const
|
|
403
|
-
isTruncated
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
406
|
+
const DataCell = _ref => {
|
|
407
|
+
let _ref$isTruncated = _ref.isTruncated,
|
|
408
|
+
isTruncated = _ref$isTruncated === void 0 ? false : _ref$isTruncated,
|
|
409
|
+
_ref$shouldRenderBott = _ref.shouldRenderBottomBorder,
|
|
410
|
+
shouldRenderBottomBorder = _ref$shouldRenderBott === void 0 ? true : _ref$shouldRenderBott,
|
|
411
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
407
412
|
if (props.shouldRenderCollapseButton) ;
|
|
408
413
|
const Icon = props.isRowCollapsed ? icons.RightTriangleFilledIcon : icons.RightTriangleLinearIcon;
|
|
409
414
|
return jsxRuntime.jsxs(BaseCell, {
|
|
410
415
|
onClick: props.onCellClick,
|
|
411
416
|
shouldIgnoreRowClick: props.shouldIgnoreRowClick,
|
|
412
|
-
shouldClipContent:
|
|
413
|
-
shouldRenderBottomBorder:
|
|
417
|
+
shouldClipContent: isTruncated && !props.shouldRenderResizingIndicator,
|
|
418
|
+
shouldRenderBottomBorder: shouldRenderBottomBorder,
|
|
414
419
|
children: [jsxRuntime.jsx(CellInner, _objectSpread$2(_objectSpread$2({
|
|
415
420
|
isCondensed: props.isCondensed,
|
|
416
|
-
isTruncated:
|
|
421
|
+
isTruncated: isTruncated,
|
|
417
422
|
verticalCellAlignment: props.verticalCellAlignment,
|
|
418
423
|
horizontalCellAlignment: props.horizontalCellAlignment
|
|
419
|
-
}, utils.filterDataAttributes(
|
|
424
|
+
}, utils.filterDataAttributes(_objectSpread$2({
|
|
425
|
+
isTruncated,
|
|
426
|
+
shouldRenderBottomBorder
|
|
427
|
+
}, props))), {}, {
|
|
420
428
|
children: props.children
|
|
421
429
|
})), props.shouldRenderCollapseButton && jsxRuntime.jsx(RowExpandCollapseButton, {
|
|
422
430
|
label: "Expand/Collapse Row",
|
|
@@ -435,25 +443,29 @@ const DataCell = props => {
|
|
|
435
443
|
};
|
|
436
444
|
DataCell.propTypes = {};
|
|
437
445
|
DataCell.displayName = 'DataCell';
|
|
438
|
-
DataCell.defaultProps = defaultProps$2;
|
|
439
446
|
var DataCell$1 = DataCell;
|
|
440
447
|
|
|
441
|
-
const
|
|
448
|
+
const _excluded$1 = ["isCondensed", "shouldClipContent", "verticalCellAlignment", "horizontalCellAlignment", "shouldRenderBottomBorder", "itemRenderer"];
|
|
449
|
+
const defaultItemRenderer = (row, column, _isRowCollapsed) => {
|
|
442
450
|
// @ts-ignore
|
|
443
451
|
return row[column.key];
|
|
444
452
|
};
|
|
445
|
-
const
|
|
446
|
-
isCondensed: true,
|
|
447
|
-
shouldClipContent: false,
|
|
448
|
-
verticalCellAlignment: 'top',
|
|
449
|
-
horizontalCellAlignment: 'left',
|
|
450
|
-
shouldRenderBottomBorder: true,
|
|
451
|
-
itemRenderer: defaultItemRenderer
|
|
452
|
-
};
|
|
453
|
-
const DataRow = props => {
|
|
453
|
+
const DataRow = _ref => {
|
|
454
454
|
var _context, _context2;
|
|
455
|
-
|
|
456
|
-
|
|
455
|
+
let _ref$isCondensed = _ref.isCondensed,
|
|
456
|
+
isCondensed = _ref$isCondensed === void 0 ? true : _ref$isCondensed;
|
|
457
|
+
_ref.shouldClipContent;
|
|
458
|
+
let _ref$verticalCellAlig = _ref.verticalCellAlignment,
|
|
459
|
+
verticalCellAlignment = _ref$verticalCellAlig === void 0 ? 'top' : _ref$verticalCellAlig,
|
|
460
|
+
_ref$horizontalCellAl = _ref.horizontalCellAlignment,
|
|
461
|
+
horizontalCellAlignment = _ref$horizontalCellAl === void 0 ? 'left' : _ref$horizontalCellAl,
|
|
462
|
+
_ref$shouldRenderBott = _ref.shouldRenderBottomBorder,
|
|
463
|
+
shouldRenderBottomBorder = _ref$shouldRenderBott === void 0 ? true : _ref$shouldRenderBott,
|
|
464
|
+
_ref$itemRenderer = _ref.itemRenderer,
|
|
465
|
+
itemRenderer = _ref$itemRenderer === void 0 ? defaultItemRenderer : _ref$itemRenderer,
|
|
466
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
467
|
+
const _ref2 = react$1.useContext(ColumnResizingContext),
|
|
468
|
+
getIsColumnBeingResized = _ref2.getIsColumnBeingResized;
|
|
457
469
|
const rowHasTruncatedColumn = _someInstanceProperty__default["default"](_context = props.columns).call(_context, column => column.isTruncated);
|
|
458
470
|
const _useState = react$1.useState(rowHasTruncatedColumn),
|
|
459
471
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -477,22 +489,21 @@ const DataRow = props => {
|
|
|
477
489
|
children: _mapInstanceProperty__default["default"](_context2 = props.columns).call(_context2, (column, columnIndex) => jsxRuntime.jsx(DataCell$1, {
|
|
478
490
|
"data-testid": `cell-${props.rowIndex}-${column.key}`,
|
|
479
491
|
isTruncated: column.isTruncated && isRowCollapsed,
|
|
480
|
-
isCondensed:
|
|
492
|
+
isCondensed: isCondensed,
|
|
481
493
|
isRowCollapsed: isRowCollapsed,
|
|
482
|
-
verticalCellAlignment:
|
|
483
|
-
horizontalCellAlignment: column.align ? column.align :
|
|
494
|
+
verticalCellAlignment: verticalCellAlignment,
|
|
495
|
+
horizontalCellAlignment: column.align ? column.align : horizontalCellAlignment,
|
|
484
496
|
shouldIgnoreRowClick: column.shouldIgnoreRowClick,
|
|
485
497
|
handleRowCollapseClick: handleRowCollapseClick,
|
|
486
498
|
shouldRenderCollapseButton: shouldRenderCollapseButton(props.columns.length, columnIndex),
|
|
487
499
|
onCellClick: props.onRowClick && !column.shouldIgnoreRowClick ? () => props.onRowClick?.(props.row, props.rowIndex, column.key) : undefined,
|
|
488
|
-
shouldRenderBottomBorder:
|
|
500
|
+
shouldRenderBottomBorder: shouldRenderBottomBorder,
|
|
489
501
|
shouldRenderResizingIndicator: getIsColumnBeingResized(columnIndex),
|
|
490
|
-
children: column.renderItem ? column.renderItem(props.row, isRowCollapsed) :
|
|
502
|
+
children: column.renderItem ? column.renderItem(props.row, isRowCollapsed) : itemRenderer(props.row, column, isRowCollapsed)
|
|
491
503
|
}, `${props.row.id}-${column.key}`))
|
|
492
504
|
});
|
|
493
505
|
};
|
|
494
506
|
DataRow.propTypes = {};
|
|
495
|
-
DataRow.defaultProps = defaultProps$1;
|
|
496
507
|
DataRow.displayName = 'DataRow';
|
|
497
508
|
var DataRow$1 = DataRow;
|
|
498
509
|
|
|
@@ -648,6 +659,7 @@ const useManualColumnResizing = tableRef => {
|
|
|
648
659
|
};
|
|
649
660
|
var useManualColumnResizing$1 = useManualColumnResizing;
|
|
650
661
|
|
|
662
|
+
const _excluded = ["columns", "isCondensed", "wrapHeaderLabels", "verticalCellAlignment", "horizontalCellAlignment", "disableSelfContainment", "itemRenderer"];
|
|
651
663
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
652
664
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
653
665
|
const getColumnsLayoutInfo = columns => _reduceInstanceProperty__default["default"](columns).call(columns, (acc, currentValue) => [...acc, {
|
|
@@ -659,24 +671,29 @@ const shouldRenderRowBottomBorder = (rowIndex, rowCount, footer) => {
|
|
|
659
671
|
if (rowIndex + 1 < rowCount) return true;
|
|
660
672
|
return false;
|
|
661
673
|
};
|
|
662
|
-
const
|
|
663
|
-
columns: [],
|
|
664
|
-
isCondensed: true,
|
|
665
|
-
wrapHeaderLabels: true,
|
|
666
|
-
verticalCellAlignment: 'top',
|
|
667
|
-
horizontalCellAlignment: 'left',
|
|
668
|
-
disableSelfContainment: false,
|
|
669
|
-
// @ts-ignore
|
|
670
|
-
itemRenderer: (row, column) => row[column.key]
|
|
671
|
-
};
|
|
672
|
-
const DataTable = props => {
|
|
674
|
+
const DataTable = _ref => {
|
|
673
675
|
var _context;
|
|
676
|
+
let _ref$columns = _ref.columns,
|
|
677
|
+
columns = _ref$columns === void 0 ? [] : _ref$columns,
|
|
678
|
+
_ref$isCondensed = _ref.isCondensed,
|
|
679
|
+
isCondensed = _ref$isCondensed === void 0 ? true : _ref$isCondensed,
|
|
680
|
+
_ref$wrapHeaderLabels = _ref.wrapHeaderLabels,
|
|
681
|
+
wrapHeaderLabels = _ref$wrapHeaderLabels === void 0 ? true : _ref$wrapHeaderLabels,
|
|
682
|
+
_ref$verticalCellAlig = _ref.verticalCellAlignment,
|
|
683
|
+
verticalCellAlignment = _ref$verticalCellAlig === void 0 ? 'top' : _ref$verticalCellAlig,
|
|
684
|
+
_ref$horizontalCellAl = _ref.horizontalCellAlignment,
|
|
685
|
+
horizontalCellAlignment = _ref$horizontalCellAl === void 0 ? 'left' : _ref$horizontalCellAl,
|
|
686
|
+
_ref$disableSelfConta = _ref.disableSelfContainment,
|
|
687
|
+
disableSelfContainment = _ref$disableSelfConta === void 0 ? false : _ref$disableSelfConta,
|
|
688
|
+
_ref$itemRenderer = _ref.itemRenderer,
|
|
689
|
+
itemRenderer = _ref$itemRenderer === void 0 ? (row, column) => row[column.key] : _ref$itemRenderer,
|
|
690
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
674
691
|
const _useDataTableManagerC = dataTableManagerProvider.useDataTableManagerContext(),
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
const isValueFromProvider = Boolean(
|
|
678
|
-
const columnsData = isValueFromProvider ?
|
|
679
|
-
const condensedValue = isValueFromProvider &&
|
|
692
|
+
contextColumns = _useDataTableManagerC.columns,
|
|
693
|
+
contextIsCondensed = _useDataTableManagerC.isCondensed;
|
|
694
|
+
const isValueFromProvider = Boolean(contextColumns && contextColumns.length !== 0);
|
|
695
|
+
const columnsData = isValueFromProvider ? contextColumns : columns;
|
|
696
|
+
const condensedValue = isValueFromProvider && contextIsCondensed !== undefined ? contextIsCondensed : isCondensed;
|
|
680
697
|
const tableRef = react$1.useRef();
|
|
681
698
|
const columnResizingReducer = useManualColumnResizing$1(tableRef);
|
|
682
699
|
|
|
@@ -706,13 +723,19 @@ const DataTable = props => {
|
|
|
706
723
|
maxWidth: props.maxWidth,
|
|
707
724
|
maxHeight: props.maxHeight,
|
|
708
725
|
isBeingResized: columnResizingReducer.getIsAnyColumnBeingResized(),
|
|
709
|
-
disableSelfContainment: !!
|
|
726
|
+
disableSelfContainment: !!disableSelfContainment,
|
|
710
727
|
children: [jsxRuntime.jsx(TableGrid, _objectSpread(_objectSpread({
|
|
711
728
|
ref: tableRef
|
|
712
|
-
}, utils.filterDataAttributes(
|
|
729
|
+
}, utils.filterDataAttributes(_objectSpread({
|
|
730
|
+
isCondensed,
|
|
731
|
+
wrapHeaderLabels,
|
|
732
|
+
verticalCellAlignment,
|
|
733
|
+
horizontalCellAlignment,
|
|
734
|
+
disableSelfContainment
|
|
735
|
+
}, props))), {}, {
|
|
713
736
|
columns: columnsData,
|
|
714
737
|
maxHeight: props.maxHeight,
|
|
715
|
-
disableSelfContainment: !!
|
|
738
|
+
disableSelfContainment: !!disableSelfContainment,
|
|
716
739
|
resizedTotalWidth: resizedTotalWidth,
|
|
717
740
|
children: jsxRuntime.jsxs(ColumnResizingContext.Provider, {
|
|
718
741
|
value: columnResizingReducer,
|
|
@@ -720,13 +743,13 @@ const DataTable = props => {
|
|
|
720
743
|
children: jsxRuntime.jsx(TableRow, {
|
|
721
744
|
isRowClickable: false,
|
|
722
745
|
children: _mapInstanceProperty__default["default"](columnsData).call(columnsData, column => jsxRuntime.jsx(HeaderCell$1, {
|
|
723
|
-
shouldWrap:
|
|
746
|
+
shouldWrap: wrapHeaderLabels,
|
|
724
747
|
isCondensed: condensedValue,
|
|
725
748
|
iconComponent: column.headerIcon,
|
|
726
749
|
onColumnResized: props.onColumnResized,
|
|
727
750
|
disableResizing: column.disableResizing,
|
|
728
|
-
horizontalCellAlignment: column.align ? column.align :
|
|
729
|
-
disableHeaderStickiness: props.disableHeaderStickiness,
|
|
751
|
+
horizontalCellAlignment: column.align ? column.align : horizontalCellAlignment,
|
|
752
|
+
disableHeaderStickiness: Boolean(props.disableHeaderStickiness),
|
|
730
753
|
columnWidth: column.width
|
|
731
754
|
/* Sorting Props */,
|
|
732
755
|
onClick: props.onSortChange && props.onSortChange,
|
|
@@ -739,12 +762,13 @@ const DataTable = props => {
|
|
|
739
762
|
})
|
|
740
763
|
}), jsxRuntime.jsx(TableBody, {
|
|
741
764
|
children: _mapInstanceProperty__default["default"](_context = props.rows).call(_context, (row, rowIndex) => react.createElement(DataRow$1, _objectSpread(_objectSpread({}, props), {}, {
|
|
765
|
+
itemRenderer: itemRenderer,
|
|
742
766
|
isCondensed: condensedValue,
|
|
743
767
|
columns: columnsData,
|
|
744
768
|
row: row,
|
|
745
769
|
key: row.id,
|
|
746
770
|
rowIndex: rowIndex,
|
|
747
|
-
shouldClipContent: columnResizingReducer.getIsAnyColumnBeingResized() || hasTableBeenResized,
|
|
771
|
+
shouldClipContent: columnResizingReducer.getIsAnyColumnBeingResized() || Boolean(hasTableBeenResized),
|
|
748
772
|
shouldRenderBottomBorder: shouldRenderRowBottomBorder(rowIndex, props.rows.length, props.footer)
|
|
749
773
|
})))
|
|
750
774
|
})]
|
|
@@ -752,19 +776,18 @@ const DataTable = props => {
|
|
|
752
776
|
})), props.footer && jsxRuntime.jsx(Footer$1, {
|
|
753
777
|
"data-testid": "footer",
|
|
754
778
|
isCondensed: condensedValue,
|
|
755
|
-
horizontalCellAlignment:
|
|
779
|
+
horizontalCellAlignment: horizontalCellAlignment,
|
|
756
780
|
resizedTotalWidth: resizedTotalWidth,
|
|
757
781
|
children: props.footer
|
|
758
782
|
})]
|
|
759
783
|
});
|
|
760
784
|
};
|
|
761
785
|
DataTable.propTypes = {};
|
|
762
|
-
DataTable.defaultProps = defaultProps;
|
|
763
786
|
DataTable.displayName = 'DataTable';
|
|
764
787
|
var DataTable$1 = DataTable;
|
|
765
788
|
|
|
766
789
|
// NOTE: This string will be replaced on build time with the package version.
|
|
767
|
-
var version = "19.
|
|
790
|
+
var version = "19.22.0";
|
|
768
791
|
|
|
769
792
|
Object.defineProperty(exports, 'useRowSelection', {
|
|
770
793
|
enumerable: true,
|