@mui/x-data-grid
Version:
The Community plan edition of the MUI X Data Grid components.
32 lines (31 loc) • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shouldCellShowRightBorder = exports.shouldCellShowLeftBorder = void 0;
var _constants = require("../internals/constants");
const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectionLength, showCellVerticalBorderRootProp, gridHasFiller, pinnedColumnsSectionSeparatorRootProp) => {
const isSectionLastCell = indexInSection === sectionLength - 1;
if (pinnedColumnsSectionSeparatorRootProp?.startsWith('border') && pinnedPosition === _constants.PinnedColumnPosition.LEFT && isSectionLastCell) {
return true;
}
if (showCellVerticalBorderRootProp) {
if (pinnedPosition === _constants.PinnedColumnPosition.LEFT) {
return true;
}
if (pinnedPosition === _constants.PinnedColumnPosition.RIGHT) {
return !isSectionLastCell;
}
// pinnedPosition === undefined, middle section
return !isSectionLastCell || gridHasFiller;
}
return false;
};
exports.shouldCellShowRightBorder = shouldCellShowRightBorder;
const shouldCellShowLeftBorder = (pinnedPosition, indexInSection, showCellVerticalBorderRootProp, pinnedColumnsSectionSeparatorRootProp) => {
if (pinnedColumnsSectionSeparatorRootProp?.startsWith('border')) {
return pinnedPosition === _constants.PinnedColumnPosition.RIGHT && indexInSection === 0;
}
return showCellVerticalBorderRootProp && pinnedPosition === _constants.PinnedColumnPosition.RIGHT && indexInSection === 0;
};
exports.shouldCellShowLeftBorder = shouldCellShowLeftBorder;