1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"ast":null,"code":"import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { useGridApiContext } from '../../hooks/utils/useGridApiContext';\nimport { GridMainContainer } from '../containers/GridMainContainer';\nimport { GridAutoSizer } from '../GridAutoSizer';\nimport { GridOverlays } from './GridOverlays';\nimport { useGridRootProps } from '../../hooks/utils/useGridRootProps';\nimport { useGridSelector } from '../../hooks/utils/useGridSelector';\nimport { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction GridBody(props) {\n const {\n children,\n VirtualScrollerComponent,\n ColumnHeadersComponent\n } = props;\n const apiRef = useGridApiContext();\n const rootProps = useGridRootProps();\n const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);\n const [isVirtualizationDisabled, setIsVirtualizationDisabled] = React.useState(rootProps.disableVirtualization);\n const disableVirtualization = React.useCallback(() => {\n setIsVirtualizationDisabled(true);\n }, []);\n const enableVirtualization = React.useCallback(() => {\n setIsVirtualizationDisabled(false);\n }, []);\n React.useEffect(() => {\n setIsVirtualizationDisabled(rootProps.disableVirtualization);\n }, [rootProps.disableVirtualization]); // The `useGridApiMethod` hook can't be used here, because it only installs the\n // method if it doesn't exist yet. Once installed, it's never updated again.\n // This break the methods above, since their closure comes from the first time\n // they were installed. Which means that calling `setIsVirtualizationDisabled`\n // will trigger a re-render, but it won't update the state. That can be solved\n // by migrating the virtualization status to the global state.\n\n apiRef.current.unstable_disableVirtualization = disableVirtualization;\n apiRef.current.unstable_enableVirtualization = enableVirtualization;\n const columnHeadersRef = React.useRef(null);\n const columnsContainerRef = React.useRef(null);\n const windowRef = React.useRef(null);\n const renderingZoneRef = React.useRef(null);\n apiRef.current.columnHeadersContainerElementRef = columnsContainerRef;\n apiRef.current.columnHeadersElementRef = columnHeadersRef;\n apiRef.current.windowRef = windowRef; // TODO rename, it's not attached to the window anymore\n\n apiRef.current.renderingZoneRef = renderingZoneRef; // TODO remove, nobody should have access to internal parts of the virtualization\n\n const handleResize = React.useCallback(size => {\n apiRef.current.publishEvent('resize', size);\n }, [apiRef]);\n return /*#__PURE__*/_jsxs(GridMainContainer, {\n children: [/*#__PURE__*/_jsx(GridOverlays, {}), /*#__PURE__*/_jsx(ColumnHeadersComponent, {\n ref: columnsContainerRef,\n innerRef: columnHeadersRef\n }), /*#__PURE__*/_jsx(GridAutoSizer, {\n nonce: rootProps.nonce,\n disableHeight: rootProps.autoHeight,\n onResize: handleResize,\n children: size => {\n const style = {\n width: size.width,\n // If `autoHeight` is on, there will be no height value.\n // In this case, let the container to grow whatever it needs.\n height: size.height ? size.height - totalHeaderHeight : 'auto',\n marginTop: totalHeaderHeight\n };\n return /*#__PURE__*/_jsx(VirtualScrollerComponent, {\n ref: windowRef,\n style: style,\n disableVirtualization: isVirtualizationDisabled\n });\n }\n }), children]\n });\n}\nprocess.env.NODE_ENV !== \"production\" ? GridBody.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the TypeScript types and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n children: PropTypes.node,\n ColumnHeadersComponent: PropTypes.elementType.isRequired,\n VirtualScrollerComponent: PropTypes.elementType.isRequired\n} : void 0;\nexport { GridBody };","map":{"version":3,"names":["React","PropTypes","useGridApiContext","GridMainContainer","GridAutoSizer","GridOverlays","useGridRootProps","useGridSelector","gridDensityTotalHeaderHeightSelector","jsx","_jsx","jsxs","_jsxs","GridBody","props","children","VirtualScrollerComponent","ColumnHeadersComponent","apiRef","rootProps","totalHeaderHeight","isVirtualizationDisabled","setIsVirtualizationDisabled","useState","disableVirtualization","useCallback","enableVirtualization","useEffect","current","unstable_disableVirtualization","unstable_enableVirtualization","columnHeadersRef","useRef","columnsContainerRef","windowRef","renderingZoneRef","columnHeadersContainerElementRef","columnHeadersElementRef","handleResize","size","publishEvent","ref","innerRef","nonce","disableHeight","autoHeight","onResize","style","width","height","marginTop","process","env","NODE_ENV","propTypes","node","elementType","isRequired"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/components/base/GridBody.js"],"sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { useGridApiContext } from '../../hooks/utils/useGridApiContext';\nimport { GridMainContainer } from '../containers/GridMainContainer';\nimport { GridAutoSizer } from '../GridAutoSizer';\nimport { GridOverlays } from './GridOverlays';\nimport { useGridRootProps } from '../../hooks/utils/useGridRootProps';\nimport { useGridSelector } from '../../hooks/utils/useGridSelector';\nimport { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\n\nfunction GridBody(props) {\n const {\n children,\n VirtualScrollerComponent,\n ColumnHeadersComponent\n } = props;\n const apiRef = useGridApiContext();\n const rootProps = useGridRootProps();\n const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);\n const [isVirtualizationDisabled, setIsVirtualizationDisabled] = React.useState(rootProps.disableVirtualization);\n const disableVirtualization = React.useCallback(() => {\n setIsVirtualizationDisabled(true);\n }, []);\n const enableVirtualization = React.useCallback(() => {\n setIsVirtualizationDisabled(false);\n }, []);\n React.useEffect(() => {\n setIsVirtualizationDisabled(rootProps.disableVirtualization);\n }, [rootProps.disableVirtualization]); // The `useGridApiMethod` hook can't be used here, because it only installs the\n // method if it doesn't exist yet. Once installed, it's never updated again.\n // This break the methods above, since their closure comes from the first time\n // they were installed. Which means that calling `setIsVirtualizationDisabled`\n // will trigger a re-render, but it won't update the state. That can be solved\n // by migrating the virtualization status to the global state.\n\n apiRef.current.unstable_disableVirtualization = disableVirtualization;\n apiRef.current.unstable_enableVirtualization = enableVirtualization;\n const columnHeadersRef = React.useRef(null);\n const columnsContainerRef = React.useRef(null);\n const windowRef = React.useRef(null);\n const renderingZoneRef = React.useRef(null);\n apiRef.current.columnHeadersContainerElementRef = columnsContainerRef;\n apiRef.current.columnHeadersElementRef = columnHeadersRef;\n apiRef.current.windowRef = windowRef; // TODO rename, it's not attached to the window anymore\n\n apiRef.current.renderingZoneRef = renderingZoneRef; // TODO remove, nobody should have access to internal parts of the virtualization\n\n const handleResize = React.useCallback(size => {\n apiRef.current.publishEvent('resize', size);\n }, [apiRef]);\n return /*#__PURE__*/_jsxs(GridMainContainer, {\n children: [/*#__PURE__*/_jsx(GridOverlays, {}), /*#__PURE__*/_jsx(ColumnHeadersComponent, {\n ref: columnsContainerRef,\n innerRef: columnHeadersRef\n }), /*#__PURE__*/_jsx(GridAutoSizer, {\n nonce: rootProps.nonce,\n disableHeight: rootProps.autoHeight,\n onResize: handleResize,\n children: size => {\n const style = {\n width: size.width,\n // If `autoHeight` is on, there will be no height value.\n // In this case, let the container to grow whatever it needs.\n height: size.height ? size.height - totalHeaderHeight : 'auto',\n marginTop: totalHeaderHeight\n };\n return /*#__PURE__*/_jsx(VirtualScrollerComponent, {\n ref: windowRef,\n style: style,\n disableVirtualization: isVirtualizationDisabled\n });\n }\n }), children]\n });\n}\n\nprocess.env.NODE_ENV !== \"production\" ? GridBody.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the TypeScript types and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n children: PropTypes.node,\n ColumnHeadersComponent: PropTypes.elementType.isRequired,\n VirtualScrollerComponent: PropTypes.elementType.isRequired\n} : void 0;\nexport { GridBody };"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,iBAAiB,QAAQ,qCAAqC;AACvE,SAASC,iBAAiB,QAAQ,iCAAiC;AACnE,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAA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