@itwin/itwinui-react
Version:
A react component library for iTwinUI
65 lines (64 loc) • 1.88 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', {
value: true,
});
function _export(target, all) {
for (var name in all)
Object.defineProperty(target, name, {
enumerable: true,
get: all[name],
});
}
_export(exports, {
EXPANDER_CELL_ID: function () {
return EXPANDER_CELL_ID;
},
ExpanderColumn: function () {
return ExpanderColumn;
},
});
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
const _react = /*#__PURE__*/ _interop_require_wildcard._(require('react'));
const _index = require('../../../utils/index.js');
const _IconButton = require('../../Buttons/IconButton.js');
const _index1 = require('../cells/index.js');
const EXPANDER_CELL_ID = 'iui-table-expander';
const ExpanderColumn = (props = {}) => {
let { subComponent, isDisabled } = props;
return {
id: EXPANDER_CELL_ID,
disableResizing: true,
disableGroupBy: true,
disableReordering: true,
minWidth: 48,
width: 48,
maxWidth: 48,
columnClassName: 'iui-slot',
cellClassName: 'iui-slot',
Cell: (props) => {
let { row } = props;
if (!subComponent?.(row)) return null;
return _react.createElement(
_IconButton.IconButton,
{
'aria-label': 'Toggle expandable content',
className: 'iui-table-row-expander',
styleType: 'borderless',
size: 'small',
onClick: (e) => {
e.stopPropagation();
row.toggleRowExpanded();
},
disabled: isDisabled?.(props.row.original),
'aria-expanded': row.isExpanded,
},
_react.createElement(_index.SvgChevronRight, null),
);
},
cellRenderer: (props) =>
_react.createElement(_index1.DefaultCell, {
...props,
isDisabled: (rowData) => !!isDisabled?.(rowData),
}),
};
};