Files
ETB/ETB-FrontEnd/node_modules/.cache/babel-loader/4ec4a34bd96d5a011574751b7df9b2c3cf9a555c859dc9dc5a1a80671fe407df.json
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

1 line
50 KiB
JSON

{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';\nimport { useGridApiMethod } from '../../utils/useGridApiMethod';\nimport { useGridLogger } from '../../utils/useGridLogger';\nimport { gridRowsLookupSelector } from '../rows/gridRowsSelector';\nimport { gridSelectionStateSelector, selectedGridRowsSelector, selectedIdsLookupSelector } from './gridSelectionSelector';\nimport { gridPaginatedVisibleSortedGridRowIdsSelector } from '../pagination';\nimport { gridFocusCellSelector } from '../focus/gridFocusStateSelector';\nimport { gridVisibleSortedRowIdsSelector } from '../filter/gridFilterSelector';\nimport { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';\nimport { GridCellModes } from '../../../models/gridEditRowModel';\nimport { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';\nimport { getVisibleRows, useGridVisibleRows } from '../../utils/useGridVisibleRows';\nimport { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';\nimport { gridClasses } from '../../../constants/gridClasses';\nconst getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {\n if (selectionModelProp == null) {\n return selectionModelProp;\n }\n if (Array.isArray(selectionModelProp)) {\n return selectionModelProp;\n }\n if (prevSelectionModel && prevSelectionModel[0] === selectionModelProp) {\n return prevSelectionModel;\n }\n return [selectionModelProp];\n};\nexport const selectionStateInitializer = (state, props) => {\n var _getSelectionModelPro;\n return _extends({}, state, {\n selection: (_getSelectionModelPro = getSelectionModelPropValue(props.selectionModel)) != null ? _getSelectionModelPro : []\n });\n};\n/**\n * @requires useGridRows (state, method) - can be after\n * @requires useGridParamsApi (method) - can be after\n * @requires useGridFocus (state) - can be after\n * @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)\n */\n\nexport const useGridSelection = (apiRef, props) => {\n const logger = useGridLogger(apiRef, 'useGridSelection');\n const propSelectionModel = React.useMemo(() => {\n return getSelectionModelPropValue(props.selectionModel, gridSelectionStateSelector(apiRef.current.state));\n }, [apiRef, props.selectionModel]);\n const lastRowToggled = React.useRef(null);\n apiRef.current.unstable_registerControlState({\n stateId: 'selection',\n propModel: propSelectionModel,\n propOnChange: props.onSelectionModelChange,\n stateSelector: gridSelectionStateSelector,\n changeEvent: 'selectionChange'\n });\n const {\n checkboxSelection,\n disableMultipleSelection,\n disableSelectionOnClick,\n pagination,\n paginationMode,\n isRowSelectable: propIsRowSelectable\n } = props;\n const canHaveMultipleSelection = !disableMultipleSelection || checkboxSelection;\n const visibleRows = useGridVisibleRows(apiRef, props);\n const expandMouseRowRangeSelection = React.useCallback(id => {\n var _lastRowToggled$curre;\n let endId = id;\n const startId = (_lastRowToggled$curre = lastRowToggled.current) != null ? _lastRowToggled$curre : id;\n const isSelected = apiRef.current.isRowSelected(id);\n if (isSelected) {\n const visibleRowIds = gridVisibleSortedRowIdsSelector(apiRef);\n const startIndex = visibleRowIds.findIndex(rowId => rowId === startId);\n const endIndex = visibleRowIds.findIndex(rowId => rowId === endId);\n if (startIndex === endIndex) {\n return;\n }\n if (startIndex > endIndex) {\n endId = visibleRowIds[endIndex + 1];\n } else {\n endId = visibleRowIds[endIndex - 1];\n }\n }\n lastRowToggled.current = id;\n apiRef.current.selectRowRange({\n startId,\n endId\n }, !isSelected);\n }, [apiRef]);\n /**\n * API METHODS\n */\n\n const setSelectionModel = React.useCallback(model => {\n const currentModel = gridSelectionStateSelector(apiRef.current.state);\n if (currentModel !== model) {\n logger.debug(`Setting selection model`);\n apiRef.current.setState(state => _extends({}, state, {\n selection: model\n }));\n apiRef.current.forceUpdate();\n }\n }, [apiRef, logger]);\n const isRowSelected = React.useCallback(id => gridSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);\n const isRowSelectable = React.useCallback(id => {\n if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {\n return false;\n }\n const rowNode = apiRef.current.getRowNode(id);\n if ((rowNode == null ? void 0 : rowNode.position) === 'footer' || rowNode != null && rowNode.isPinned) {\n return false;\n }\n return true;\n }, [apiRef, propIsRowSelectable]);\n const getSelectedRows = React.useCallback(() => selectedGridRowsSelector(apiRef), [apiRef]);\n const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {\n if (!apiRef.current.isRowSelectable(id)) {\n return;\n }\n lastRowToggled.current = id;\n if (resetSelection) {\n logger.debug(`Setting selection for row ${id}`);\n apiRef.current.setSelectionModel(isSelected ? [id] : []);\n } else {\n logger.debug(`Toggling selection for row ${id}`);\n const selection = gridSelectionStateSelector(apiRef.current.state);\n const newSelection = selection.filter(el => el !== id);\n if (isSelected) {\n newSelection.push(id);\n }\n const isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;\n if (isSelectionValid) {\n apiRef.current.setSelectionModel(newSelection);\n }\n }\n }, [apiRef, logger, canHaveMultipleSelection]);\n const selectRows = React.useCallback((ids, isSelected = true, resetSelection = false) => {\n logger.debug(`Setting selection for several rows`);\n const selectableIds = ids.filter(id => apiRef.current.isRowSelectable(id));\n let newSelection;\n if (resetSelection) {\n newSelection = isSelected ? selectableIds : [];\n } else {\n // We clone the existing object to avoid mutating the same object returned by the selector to others part of the project\n const selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));\n selectableIds.forEach(id => {\n if (isSelected) {\n selectionLookup[id] = id;\n } else {\n delete selectionLookup[id];\n }\n });\n newSelection = Object.values(selectionLookup);\n }\n const isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;\n if (isSelectionValid) {\n apiRef.current.setSelectionModel(newSelection);\n }\n }, [apiRef, logger, canHaveMultipleSelection]);\n const selectRowRange = React.useCallback(({\n startId,\n endId\n }, isSelected = true, resetSelection) => {\n if (!apiRef.current.getRow(startId) || !apiRef.current.getRow(endId)) {\n return;\n }\n logger.debug(`Expanding selection from row ${startId} to row ${endId}`); // Using rows from all pages allow to select a range across several pages\n\n const allPagesRowIds = gridVisibleSortedRowIdsSelector(apiRef);\n const startIndex = allPagesRowIds.indexOf(startId);\n const endIndex = allPagesRowIds.indexOf(endId);\n const [start, end] = startIndex > endIndex ? [endIndex, startIndex] : [startIndex, endIndex];\n const rowsBetweenStartAndEnd = allPagesRowIds.slice(start, end + 1);\n apiRef.current.selectRows(rowsBetweenStartAndEnd, isSelected, resetSelection);\n }, [apiRef, logger]);\n const selectionApi = {\n selectRow,\n selectRows,\n selectRowRange,\n setSelectionModel,\n getSelectedRows,\n isRowSelected,\n isRowSelectable\n };\n useGridApiMethod(apiRef, selectionApi, 'GridSelectionApi');\n /**\n * EVENTS\n */\n\n const removeOutdatedSelection = React.useCallback(() => {\n if (props.keepNonExistentRowsSelected) {\n return;\n }\n const currentSelection = gridSelectionStateSelector(apiRef.current.state);\n const rowsLookup = gridRowsLookupSelector(apiRef); // We clone the existing object to avoid mutating the same object returned by the selector to others part of the project\n\n const selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));\n let hasChanged = false;\n currentSelection.forEach(id => {\n if (!rowsLookup[id]) {\n delete selectionLookup[id];\n hasChanged = true;\n }\n });\n if (hasChanged) {\n apiRef.current.setSelectionModel(Object.values(selectionLookup));\n }\n }, [apiRef, props.keepNonExistentRowsSelected]);\n const handleSingleRowSelection = React.useCallback((id, event) => {\n const hasCtrlKey = event.metaKey || event.ctrlKey; // multiple selection is only allowed if:\n // - it is a checkboxSelection\n // - it is a keyboard selection\n // - Ctrl is pressed\n\n const isMultipleSelectionDisabled = !checkboxSelection && !hasCtrlKey && !isKeyboardEvent(event);\n const resetSelection = !canHaveMultipleSelection || isMultipleSelectionDisabled;\n const isSelected = apiRef.current.isRowSelected(id);\n if (resetSelection) {\n apiRef.current.selectRow(id, !isMultipleSelectionDisabled ? !isSelected : true, true);\n } else {\n apiRef.current.selectRow(id, !isSelected, false);\n }\n }, [apiRef, canHaveMultipleSelection, checkboxSelection]);\n const handleRowClick = React.useCallback((params, event) => {\n var _closest;\n if (disableSelectionOnClick) {\n return;\n }\n const field = (_closest = event.target.closest(`.${gridClasses.cell}`)) == null ? void 0 : _closest.getAttribute('data-field');\n if (field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {\n // click on checkbox should not trigger row selection\n return;\n }\n if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {\n // click to open the detail panel should not select the row\n return;\n }\n if (field) {\n const column = apiRef.current.getColumn(field);\n if (column.type === GRID_ACTIONS_COLUMN_TYPE) {\n return;\n }\n }\n const rowNode = apiRef.current.getRowNode(params.id);\n if (rowNode.isPinned) {\n return;\n }\n if (event.shiftKey && (canHaveMultipleSelection || checkboxSelection)) {\n expandMouseRowRangeSelection(params.id);\n } else {\n handleSingleRowSelection(params.id, event);\n }\n }, [disableSelectionOnClick, canHaveMultipleSelection, checkboxSelection, apiRef, expandMouseRowRangeSelection, handleSingleRowSelection]);\n const preventSelectionOnShift = React.useCallback((params, event) => {\n if (canHaveMultipleSelection && event.shiftKey) {\n var _window$getSelection;\n (_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.removeAllRanges();\n }\n }, [canHaveMultipleSelection]);\n const handleRowSelectionCheckboxChange = React.useCallback((params, event) => {\n if (event.nativeEvent.shiftKey) {\n expandMouseRowRangeSelection(params.id);\n } else {\n apiRef.current.selectRow(params.id, params.value);\n }\n }, [apiRef, expandMouseRowRangeSelection]);\n const handleHeaderSelectionCheckboxChange = React.useCallback(params => {\n const shouldLimitSelectionToCurrentPage = props.checkboxSelectionVisibleOnly && props.pagination;\n const rowsToBeSelected = shouldLimitSelectionToCurrentPage ? gridPaginatedVisibleSortedGridRowIdsSelector(apiRef) : gridVisibleSortedRowIdsSelector(apiRef);\n apiRef.current.selectRows(rowsToBeSelected, params.value);\n }, [apiRef, props.checkboxSelectionVisibleOnly, props.pagination]);\n const handleCellKeyDown = React.useCallback((params, event) => {\n // Get the most recent cell mode because it may have been changed by another listener\n if (apiRef.current.getCellMode(params.id, params.field) === GridCellModes.Edit) {\n return;\n } // Ignore portal\n // Do not apply shortcuts if the focus is not on the cell root component\n\n if (!event.currentTarget.contains(event.target)) {\n return;\n }\n if (isNavigationKey(event.key) && event.shiftKey) {\n // The cell that has focus after the keyboard navigation\n const focusCell = gridFocusCellSelector(apiRef);\n if (focusCell && focusCell.id !== params.id) {\n event.preventDefault();\n const isNextRowSelected = apiRef.current.isRowSelected(focusCell.id);\n if (!canHaveMultipleSelection) {\n apiRef.current.selectRow(focusCell.id, !isNextRowSelected, true);\n return;\n }\n const newRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(focusCell.id);\n const previousRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(params.id);\n let start;\n let end;\n if (newRowIndex > previousRowIndex) {\n if (isNextRowSelected) {\n // We are navigating to the bottom of the page and adding selected rows\n start = previousRowIndex;\n end = newRowIndex - 1;\n } else {\n // We are navigating to the bottom of the page and removing selected rows\n start = previousRowIndex;\n end = newRowIndex;\n }\n } else {\n // eslint-disable-next-line no-lonely-if\n if (isNextRowSelected) {\n // We are navigating to the top of the page and removing selected rows\n start = newRowIndex + 1;\n end = previousRowIndex;\n } else {\n // We are navigating to the top of the page and adding selected rows\n start = newRowIndex;\n end = previousRowIndex;\n }\n }\n const rowsBetweenStartAndEnd = visibleRows.rows.slice(start, end + 1).map(row => row.id);\n apiRef.current.selectRows(rowsBetweenStartAndEnd, !isNextRowSelected);\n return;\n }\n }\n if (event.key === ' ' && event.shiftKey) {\n event.preventDefault();\n handleSingleRowSelection(params.id, event);\n return;\n }\n if (event.key.toLowerCase() === 'a' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n selectRows(apiRef.current.getAllRowIds(), true);\n }\n }, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);\n useGridApiEventHandler(apiRef, 'sortedRowsSet', removeOutdatedSelection);\n useGridApiEventHandler(apiRef, 'rowClick', handleRowClick);\n useGridApiEventHandler(apiRef, 'rowSelectionCheckboxChange', handleRowSelectionCheckboxChange);\n useGridApiEventHandler(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);\n useGridApiEventHandler(apiRef, 'cellMouseDown', preventSelectionOnShift);\n useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);\n /**\n * EFFECTS\n */\n\n React.useEffect(() => {\n if (propSelectionModel !== undefined) {\n apiRef.current.setSelectionModel(propSelectionModel);\n }\n }, [apiRef, propSelectionModel]);\n const isStateControlled = propSelectionModel != null;\n React.useEffect(() => {\n if (isStateControlled) {\n return;\n } // props.isRowSelectable changed\n\n const currentSelection = gridSelectionStateSelector(apiRef.current.state);\n if (isRowSelectable) {\n const newSelection = currentSelection.filter(id => isRowSelectable(id));\n if (newSelection.length < currentSelection.length) {\n apiRef.current.setSelectionModel(newSelection);\n }\n }\n }, [apiRef, isRowSelectable, isStateControlled]);\n React.useEffect(() => {\n const currentSelection = gridSelectionStateSelector(apiRef.current.state);\n if (!canHaveMultipleSelection && currentSelection.length > 1) {\n const {\n rows: currentPageRows\n } = getVisibleRows(apiRef, {\n pagination,\n paginationMode\n });\n const currentPageRowsLookup = currentPageRows.reduce((acc, {\n id\n }) => {\n acc[id] = true;\n return acc;\n }, {});\n const firstSelectableRow = currentSelection.find(id => {\n let isSelectable = true;\n if (isRowSelectable) {\n isSelectable = isRowSelectable(id);\n }\n return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page\n });\n apiRef.current.setSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);\n }\n }, [apiRef, canHaveMultipleSelection, checkboxSelection, disableMultipleSelection, isRowSelectable, pagination, paginationMode]);\n};","map":{"version":3,"names":["_extends","React","useGridApiEventHandler","useGridApiMethod","useGridLogger","gridRowsLookupSelector","gridSelectionStateSelector","selectedGridRowsSelector","selectedIdsLookupSelector","gridPaginatedVisibleSortedGridRowIdsSelector","gridFocusCellSelector","gridVisibleSortedRowIdsSelector","GRID_CHECKBOX_SELECTION_COL_DEF","GRID_ACTIONS_COLUMN_TYPE","GridCellModes","isKeyboardEvent","isNavigationKey","getVisibleRows","useGridVisibleRows","GRID_DETAIL_PANEL_TOGGLE_FIELD","gridClasses","getSelectionModelPropValue","selectionModelProp","prevSelectionModel","Array","isArray","selectionStateInitializer","state","props","_getSelectionModelPro","selection","selectionModel","useGridSelection","apiRef","logger","propSelectionModel","useMemo","current","lastRowToggled","useRef","unstable_registerControlState","stateId","propModel","propOnChange","onSelectionModelChange","stateSelector","changeEvent","checkboxSelection","disableMultipleSelection","disableSelectionOnClick","pagination","paginationMode","isRowSelectable","propIsRowSelectable","canHaveMultipleSelection","visibleRows","expandMouseRowRangeSelection","useCallback","id","_lastRowToggled$curre","endId","startId","isSelected","isRowSelected","visibleRowIds","startIndex","findIndex","rowId","endIndex","selectRowRange","setSelectionModel","model","currentModel","debug","setState","forceUpdate","includes","getRowParams","rowNode","getRowNode","position","isPinned","getSelectedRows","selectRow","resetSelection","newSelection","filter","el","push","isSelectionValid","length","selectRows","ids","selectableIds","selectionLookup","forEach","Object","values","getRow","allPagesRowIds","indexOf","start","end","rowsBetweenStartAndEnd","slice","selectionApi","removeOutdatedSelection","keepNonExistentRowsSelected","currentSelection","rowsLookup","hasChanged","handleSingleRowSelection","event","hasCtrlKey","metaKey","ctrlKey","isMultipleSelectionDisabled","handleRowClick","params","_closest","field","target","closest","cell","getAttribute","column","getColumn","type","shiftKey","preventSelectionOnShift","_window$getSelection","window","getSelection","removeAllRanges","handleRowSelectionCheckboxChange","nativeEvent","value","handleHeaderSelectionCheckboxChange","shouldLimitSelectionToCurrentPage","checkboxSelectionVisibleOnly","rowsToBeSelected","handleCellKeyDown","getCellMode","Edit","currentTarget","contains","key","focusCell","preventDefault","isNextRowSelected","newRowIndex","getRowIndexRelativeToVisibleRows","previousRowIndex","rows","map","row","toLowerCase","getAllRowIds","useEffect","undefined","isStateControlled","currentPageRows","currentPageRowsLookup","reduce","acc","firstSelectableRow","find","isSelectable"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/hooks/features/selection/useGridSelection.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';\nimport { useGridApiMethod } from '../../utils/useGridApiMethod';\nimport { useGridLogger } from '../../utils/useGridLogger';\nimport { gridRowsLookupSelector } from '../rows/gridRowsSelector';\nimport { gridSelectionStateSelector, selectedGridRowsSelector, selectedIdsLookupSelector } from './gridSelectionSelector';\nimport { gridPaginatedVisibleSortedGridRowIdsSelector } from '../pagination';\nimport { gridFocusCellSelector } from '../focus/gridFocusStateSelector';\nimport { gridVisibleSortedRowIdsSelector } from '../filter/gridFilterSelector';\nimport { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';\nimport { GridCellModes } from '../../../models/gridEditRowModel';\nimport { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';\nimport { getVisibleRows, useGridVisibleRows } from '../../utils/useGridVisibleRows';\nimport { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';\nimport { gridClasses } from '../../../constants/gridClasses';\n\nconst getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {\n if (selectionModelProp == null) {\n return selectionModelProp;\n }\n\n if (Array.isArray(selectionModelProp)) {\n return selectionModelProp;\n }\n\n if (prevSelectionModel && prevSelectionModel[0] === selectionModelProp) {\n return prevSelectionModel;\n }\n\n return [selectionModelProp];\n};\n\nexport const selectionStateInitializer = (state, props) => {\n var _getSelectionModelPro;\n\n return _extends({}, state, {\n selection: (_getSelectionModelPro = getSelectionModelPropValue(props.selectionModel)) != null ? _getSelectionModelPro : []\n });\n};\n/**\n * @requires useGridRows (state, method) - can be after\n * @requires useGridParamsApi (method) - can be after\n * @requires useGridFocus (state) - can be after\n * @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)\n */\n\nexport const useGridSelection = (apiRef, props) => {\n const logger = useGridLogger(apiRef, 'useGridSelection');\n const propSelectionModel = React.useMemo(() => {\n return getSelectionModelPropValue(props.selectionModel, gridSelectionStateSelector(apiRef.current.state));\n }, [apiRef, props.selectionModel]);\n const lastRowToggled = React.useRef(null);\n apiRef.current.unstable_registerControlState({\n stateId: 'selection',\n propModel: propSelectionModel,\n propOnChange: props.onSelectionModelChange,\n stateSelector: gridSelectionStateSelector,\n changeEvent: 'selectionChange'\n });\n const {\n checkboxSelection,\n disableMultipleSelection,\n disableSelectionOnClick,\n pagination,\n paginationMode,\n isRowSelectable: propIsRowSelectable\n } = props;\n const canHaveMultipleSelection = !disableMultipleSelection || checkboxSelection;\n const visibleRows = useGridVisibleRows(apiRef, props);\n const expandMouseRowRangeSelection = React.useCallback(id => {\n var _lastRowToggled$curre;\n\n let endId = id;\n const startId = (_lastRowToggled$curre = lastRowToggled.current) != null ? _lastRowToggled$curre : id;\n const isSelected = apiRef.current.isRowSelected(id);\n\n if (isSelected) {\n const visibleRowIds = gridVisibleSortedRowIdsSelector(apiRef);\n const startIndex = visibleRowIds.findIndex(rowId => rowId === startId);\n const endIndex = visibleRowIds.findIndex(rowId => rowId === endId);\n\n if (startIndex === endIndex) {\n return;\n }\n\n if (startIndex > endIndex) {\n endId = visibleRowIds[endIndex + 1];\n } else {\n endId = visibleRowIds[endIndex - 1];\n }\n }\n\n lastRowToggled.current = id;\n apiRef.current.selectRowRange({\n startId,\n endId\n }, !isSelected);\n }, [apiRef]);\n /**\n * API METHODS\n */\n\n const setSelectionModel = React.useCallback(model => {\n const currentModel = gridSelectionStateSelector(apiRef.current.state);\n\n if (currentModel !== model) {\n logger.debug(`Setting selection model`);\n apiRef.current.setState(state => _extends({}, state, {\n selection: model\n }));\n apiRef.current.forceUpdate();\n }\n }, [apiRef, logger]);\n const isRowSelected = React.useCallback(id => gridSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);\n const isRowSelectable = React.useCallback(id => {\n if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {\n return false;\n }\n\n const rowNode = apiRef.current.getRowNode(id);\n\n if ((rowNode == null ? void 0 : rowNode.position) === 'footer' || rowNode != null && rowNode.isPinned) {\n return false;\n }\n\n return true;\n }, [apiRef, propIsRowSelectable]);\n const getSelectedRows = React.useCallback(() => selectedGridRowsSelector(apiRef), [apiRef]);\n const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {\n if (!apiRef.current.isRowSelectable(id)) {\n return;\n }\n\n lastRowToggled.current = id;\n\n if (resetSelection) {\n logger.debug(`Setting selection for row ${id}`);\n apiRef.current.setSelectionModel(isSelected ? [id] : []);\n } else {\n logger.debug(`Toggling selection for row ${id}`);\n const selection = gridSelectionStateSelector(apiRef.current.state);\n const newSelection = selection.filter(el => el !== id);\n\n if (isSelected) {\n newSelection.push(id);\n }\n\n const isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;\n\n if (isSelectionValid) {\n apiRef.current.setSelectionModel(newSelection);\n }\n }\n }, [apiRef, logger, canHaveMultipleSelection]);\n const selectRows = React.useCallback((ids, isSelected = true, resetSelection = false) => {\n logger.debug(`Setting selection for several rows`);\n const selectableIds = ids.filter(id => apiRef.current.isRowSelectable(id));\n let newSelection;\n\n if (resetSelection) {\n newSelection = isSelected ? selectableIds : [];\n } else {\n // We clone the existing object to avoid mutating the same object returned by the selector to others part of the project\n const selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));\n\n selectableIds.forEach(id => {\n if (isSelected) {\n selectionLookup[id] = id;\n } else {\n delete selectionLookup[id];\n }\n });\n newSelection = Object.values(selectionLookup);\n }\n\n const isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;\n\n if (isSelectionValid) {\n apiRef.current.setSelectionModel(newSelection);\n }\n }, [apiRef, logger, canHaveMultipleSelection]);\n const selectRowRange = React.useCallback(({\n startId,\n endId\n }, isSelected = true, resetSelection) => {\n if (!apiRef.current.getRow(startId) || !apiRef.current.getRow(endId)) {\n return;\n }\n\n logger.debug(`Expanding selection from row ${startId} to row ${endId}`); // Using rows from all pages allow to select a range across several pages\n\n const allPagesRowIds = gridVisibleSortedRowIdsSelector(apiRef);\n const startIndex = allPagesRowIds.indexOf(startId);\n const endIndex = allPagesRowIds.indexOf(endId);\n const [start, end] = startIndex > endIndex ? [endIndex, startIndex] : [startIndex, endIndex];\n const rowsBetweenStartAndEnd = allPagesRowIds.slice(start, end + 1);\n apiRef.current.selectRows(rowsBetweenStartAndEnd, isSelected, resetSelection);\n }, [apiRef, logger]);\n const selectionApi = {\n selectRow,\n selectRows,\n selectRowRange,\n setSelectionModel,\n getSelectedRows,\n isRowSelected,\n isRowSelectable\n };\n useGridApiMethod(apiRef, selectionApi, 'GridSelectionApi');\n /**\n * EVENTS\n */\n\n const removeOutdatedSelection = React.useCallback(() => {\n if (props.keepNonExistentRowsSelected) {\n return;\n }\n\n const currentSelection = gridSelectionStateSelector(apiRef.current.state);\n const rowsLookup = gridRowsLookupSelector(apiRef); // We clone the existing object to avoid mutating the same object returned by the selector to others part of the project\n\n const selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));\n\n let hasChanged = false;\n currentSelection.forEach(id => {\n if (!rowsLookup[id]) {\n delete selectionLookup[id];\n hasChanged = true;\n }\n });\n\n if (hasChanged) {\n apiRef.current.setSelectionModel(Object.values(selectionLookup));\n }\n }, [apiRef, props.keepNonExistentRowsSelected]);\n const handleSingleRowSelection = React.useCallback((id, event) => {\n const hasCtrlKey = event.metaKey || event.ctrlKey; // multiple selection is only allowed if:\n // - it is a checkboxSelection\n // - it is a keyboard selection\n // - Ctrl is pressed\n\n const isMultipleSelectionDisabled = !checkboxSelection && !hasCtrlKey && !isKeyboardEvent(event);\n const resetSelection = !canHaveMultipleSelection || isMultipleSelectionDisabled;\n const isSelected = apiRef.current.isRowSelected(id);\n\n if (resetSelection) {\n apiRef.current.selectRow(id, !isMultipleSelectionDisabled ? !isSelected : true, true);\n } else {\n apiRef.current.selectRow(id, !isSelected, false);\n }\n }, [apiRef, canHaveMultipleSelection, checkboxSelection]);\n const handleRowClick = React.useCallback((params, event) => {\n var _closest;\n\n if (disableSelectionOnClick) {\n return;\n }\n\n const field = (_closest = event.target.closest(`.${gridClasses.cell}`)) == null ? void 0 : _closest.getAttribute('data-field');\n\n if (field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {\n // click on checkbox should not trigger row selection\n return;\n }\n\n if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {\n // click to open the detail panel should not select the row\n return;\n }\n\n if (field) {\n const column = apiRef.current.getColumn(field);\n\n if (column.type === GRID_ACTIONS_COLUMN_TYPE) {\n return;\n }\n }\n\n const rowNode = apiRef.current.getRowNode(params.id);\n\n if (rowNode.isPinned) {\n return;\n }\n\n if (event.shiftKey && (canHaveMultipleSelection || checkboxSelection)) {\n expandMouseRowRangeSelection(params.id);\n } else {\n handleSingleRowSelection(params.id, event);\n }\n }, [disableSelectionOnClick, canHaveMultipleSelection, checkboxSelection, apiRef, expandMouseRowRangeSelection, handleSingleRowSelection]);\n const preventSelectionOnShift = React.useCallback((params, event) => {\n if (canHaveMultipleSelection && event.shiftKey) {\n var _window$getSelection;\n\n (_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.removeAllRanges();\n }\n }, [canHaveMultipleSelection]);\n const handleRowSelectionCheckboxChange = React.useCallback((params, event) => {\n if (event.nativeEvent.shiftKey) {\n expandMouseRowRangeSelection(params.id);\n } else {\n apiRef.current.selectRow(params.id, params.value);\n }\n }, [apiRef, expandMouseRowRangeSelection]);\n const handleHeaderSelectionCheckboxChange = React.useCallback(params => {\n const shouldLimitSelectionToCurrentPage = props.checkboxSelectionVisibleOnly && props.pagination;\n const rowsToBeSelected = shouldLimitSelectionToCurrentPage ? gridPaginatedVisibleSortedGridRowIdsSelector(apiRef) : gridVisibleSortedRowIdsSelector(apiRef);\n apiRef.current.selectRows(rowsToBeSelected, params.value);\n }, [apiRef, props.checkboxSelectionVisibleOnly, props.pagination]);\n const handleCellKeyDown = React.useCallback((params, event) => {\n // Get the most recent cell mode because it may have been changed by another listener\n if (apiRef.current.getCellMode(params.id, params.field) === GridCellModes.Edit) {\n return;\n } // Ignore portal\n // Do not apply shortcuts if the focus is not on the cell root component\n\n\n if (!event.currentTarget.contains(event.target)) {\n return;\n }\n\n if (isNavigationKey(event.key) && event.shiftKey) {\n // The cell that has focus after the keyboard navigation\n const focusCell = gridFocusCellSelector(apiRef);\n\n if (focusCell && focusCell.id !== params.id) {\n event.preventDefault();\n const isNextRowSelected = apiRef.current.isRowSelected(focusCell.id);\n\n if (!canHaveMultipleSelection) {\n apiRef.current.selectRow(focusCell.id, !isNextRowSelected, true);\n return;\n }\n\n const newRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(focusCell.id);\n const previousRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(params.id);\n let start;\n let end;\n\n if (newRowIndex > previousRowIndex) {\n if (isNextRowSelected) {\n // We are navigating to the bottom of the page and adding selected rows\n start = previousRowIndex;\n end = newRowIndex - 1;\n } else {\n // We are navigating to the bottom of the page and removing selected rows\n start = previousRowIndex;\n end = newRowIndex;\n }\n } else {\n // eslint-disable-next-line no-lonely-if\n if (isNextRowSelected) {\n // We are navigating to the top of the page and removing selected rows\n start = newRowIndex + 1;\n end = previousRowIndex;\n } else {\n // We are navigating to the top of the page and adding selected rows\n start = newRowIndex;\n end = previousRowIndex;\n }\n }\n\n const rowsBetweenStartAndEnd = visibleRows.rows.slice(start, end + 1).map(row => row.id);\n apiRef.current.selectRows(rowsBetweenStartAndEnd, !isNextRowSelected);\n return;\n }\n }\n\n if (event.key === ' ' && event.shiftKey) {\n event.preventDefault();\n handleSingleRowSelection(params.id, event);\n return;\n }\n\n if (event.key.toLowerCase() === 'a' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n selectRows(apiRef.current.getAllRowIds(), true);\n }\n }, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);\n useGridApiEventHandler(apiRef, 'sortedRowsSet', removeOutdatedSelection);\n useGridApiEventHandler(apiRef, 'rowClick', handleRowClick);\n useGridApiEventHandler(apiRef, 'rowSelectionCheckboxChange', handleRowSelectionCheckboxChange);\n useGridApiEventHandler(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);\n useGridApiEventHandler(apiRef, 'cellMouseDown', preventSelectionOnShift);\n useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);\n /**\n * EFFECTS\n */\n\n React.useEffect(() => {\n if (propSelectionModel !== undefined) {\n apiRef.current.setSelectionModel(propSelectionModel);\n }\n }, [apiRef, propSelectionModel]);\n const isStateControlled = propSelectionModel != null;\n React.useEffect(() => {\n if (isStateControlled) {\n return;\n } // props.isRowSelectable changed\n\n\n const currentSelection = gridSelectionStateSelector(apiRef.current.state);\n\n if (isRowSelectable) {\n const newSelection = currentSelection.filter(id => isRowSelectable(id));\n\n if (newSelection.length < currentSelection.length) {\n apiRef.current.setSelectionModel(newSelection);\n }\n }\n }, [apiRef, isRowSelectable, isStateControlled]);\n React.useEffect(() => {\n const currentSelection = gridSelectionStateSelector(apiRef.current.state);\n\n if (!canHaveMultipleSelection && currentSelection.length > 1) {\n const {\n rows: currentPageRows\n } = getVisibleRows(apiRef, {\n pagination,\n paginationMode\n });\n const currentPageRowsLookup = currentPageRows.reduce((acc, {\n id\n }) => {\n acc[id] = true;\n return acc;\n }, {});\n const firstSelectableRow = currentSelection.find(id => {\n let isSelectable = true;\n\n if (isRowSelectable) {\n isSelectable = isRowSelectable(id);\n }\n\n return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page\n });\n apiRef.current.setSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);\n }\n }, [apiRef, canHaveMultipleSelection, checkboxSelection, disableMultipleSelection, isR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