@mui/x-data-grid-pro
Version:
The Pro plan edition of the MUI X Data Grid components.
93 lines • 3.86 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["style", "className", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence"];
import * as React from 'react';
import PropTypes from 'prop-types';
import { styled } from '@mui/material/styles';
import { forwardRef } from '@mui/x-internals/forwardRef';
import { vars, GridBaseColumnHeaders } from '@mui/x-data-grid/internals';
import { useGridColumnHeadersPro } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const Filler = styled('div')({
flex: 1,
backgroundColor: vars.header.background.base
});
const GridColumnHeaders = forwardRef(function GridColumnHeaders(props, ref) {
const {
className,
visibleColumns,
sortColumnLookup,
filterColumnLookup,
columnHeaderTabIndexState,
columnGroupHeaderTabIndexState,
columnHeaderFocus,
columnGroupHeaderFocus,
headerGroupingMaxDepth,
columnMenuState,
columnVisibility,
columnGroupsHeaderStructure,
hasOtherElementInTabSequence
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const {
getInnerProps,
getColumnHeadersRow,
getColumnFiltersRow,
getColumnGroupHeadersRows
} = useGridColumnHeadersPro({
visibleColumns,
sortColumnLookup,
filterColumnLookup,
columnHeaderTabIndexState,
hasOtherElementInTabSequence,
columnGroupHeaderTabIndexState,
columnHeaderFocus,
columnGroupHeaderFocus,
headerGroupingMaxDepth,
columnMenuState,
columnVisibility,
columnGroupsHeaderStructure
});
return /*#__PURE__*/_jsxs(GridBaseColumnHeaders, _extends({
className: className
}, other, getInnerProps(), {
ref: ref,
children: [getColumnGroupHeadersRows(), getColumnHeadersRow(), getColumnFiltersRow(), /*#__PURE__*/_jsx(Filler, {})]
}));
});
if (process.env.NODE_ENV !== "production") GridColumnHeaders.displayName = "GridColumnHeaders";
process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "pnpm proptypes" |
// ----------------------------------------------------------------------
columnGroupHeaderFocus: PropTypes.shape({
depth: PropTypes.number.isRequired,
field: PropTypes.string.isRequired
}),
columnGroupHeaderTabIndexState: PropTypes.shape({
depth: PropTypes.number.isRequired,
field: PropTypes.string.isRequired
}),
columnGroupsHeaderStructure: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.shape({
columnFields: PropTypes.arrayOf(PropTypes.string).isRequired,
groupId: PropTypes.string
}))).isRequired,
columnHeaderFocus: PropTypes.shape({
field: PropTypes.string.isRequired
}),
columnHeaderTabIndexState: PropTypes.shape({
field: PropTypes.string.isRequired
}),
columnMenuState: PropTypes.shape({
field: PropTypes.string,
open: PropTypes.bool.isRequired
}).isRequired,
columnVisibility: PropTypes.object.isRequired,
filterColumnLookup: PropTypes.object.isRequired,
hasOtherElementInTabSequence: PropTypes.bool.isRequired,
headerGroupingMaxDepth: PropTypes.number.isRequired,
sortColumnLookup: PropTypes.object.isRequired,
visibleColumns: PropTypes.arrayOf(PropTypes.object).isRequired
} : void 0;
export { GridColumnHeaders };