| 40 | const [selectedRowKeys, setSelectedRowKeys] = useState((defaultSelectedRowKeys && defaultSelectedRowKeys.length) ? defaultSelectedRowKeys : []); |
| 41 | useEffect(() => { |
| 42 | const updateScroll = () => { |
| 43 | let tableContainer: HTMLElement | null = document.querySelector('.ant-table-container .ant-table-body table'); |
| 44 | let tableContainerH: HTMLElement | null = document.querySelector('.ant-table-container'); |
| 45 | let modalInnerTable: HTMLElement | null = document.querySelector('.modal-inner-table'); |
| 46 | let modalOpen = true; |
| 47 | if (modalInnerTable) { |
| 48 | modalOpen = getComputedStyle(modalInnerTable).display === 'none' |
| 49 | } |
| 50 | let elementsWithPrefix: any = document.querySelectorAll('[class*="_drawer-inner-table"]'); |
| 51 | let elementsWithPrefix1: any = document.querySelectorAll('[class*="_drawer-inner-chunk"]'); |
| 52 | let containerWidth = 0; |
| 53 | let containerHeight = 0; |
| 54 | if (!modalInnerTable && elementsWithPrefix.length === 0 && elementsWithPrefix1.length === 0) { |
| 55 | setTimeout(() => { |
| 56 | if (!tableContainer) { |
| 57 | return |
| 58 | } |
| 59 | containerWidth = tableContainer.offsetWidth; |
| 60 | |
| 61 | containerHeight = tableContainerH?.offsetHeight as any; |
| 62 | setScroll({ |
| 63 | x: containerWidth, |
| 64 | y: containerHeight - 61 |
| 65 | }); |
| 66 | }, 0) |
| 67 | } else if (elementsWithPrefix.length !== 0 && elementsWithPrefix1.length === 0 && modalOpen) { |
| 68 | |
| 69 | setTimeout(() => { |
| 70 | let firstElement = elementsWithPrefix[0]; |
| 71 | let antDrawerBodyClassName = firstElement.querySelector('.ant-drawer-body'); |
| 72 | let tableClassName = firstElement.querySelector('.ant-drawer-body table') |
| 73 | containerWidth = tableClassName.offsetWidth; |
| 74 | containerHeight = antDrawerBodyClassName.offsetHeight; |
| 75 | setScroll({ |
| 76 | x: containerWidth, |
| 77 | y: containerHeight - 202, |
| 78 | }); |
| 79 | |
| 80 | }, 0) |
| 81 | } else if (elementsWithPrefix1.length !== 0 && elementsWithPrefix.length === 0 && modalOpen) { |
| 82 | setTimeout(() => { |
| 83 | let firstElement = elementsWithPrefix1[0]; |
| 84 | let antDrawerBodyClassName = firstElement.querySelector('.ant-drawer-body'); |
| 85 | let tableClassName = firstElement.querySelector('.ant-drawer-body table') |
| 86 | containerWidth = tableClassName.offsetWidth; |
| 87 | containerHeight = antDrawerBodyClassName.offsetHeight; |
| 88 | setScroll({ |
| 89 | x: containerWidth, |
| 90 | y: containerHeight - 202, |
| 91 | }); |
| 92 | }) |
| 93 | } else if (modalInnerTable) { |
| 94 | setTimeout(() => { |
| 95 | const tableContainer: HTMLElement | null = document.querySelector('.modal-inner-table .ant-table-container table'); |
| 96 | const tableContainerH: HTMLElement | null = document.querySelector('.modal-inner-table .ant-table-container'); |
| 97 | containerWidth = tableContainer?.offsetWidth as any; |
| 98 | containerHeight = tableContainerH?.offsetHeight as any; |
| 99 | setScroll({ |