From 89c3be7c885588334c7eb6214499ce82dd312533 Mon Sep 17 00:00:00 2001
From: Renovate-Bot <le.rameur.94@gmail.com>
Date: Mon, 25 Sep 2023 15:06:52 +0000
Subject: [PATCH] fix(deps): update ag-grid monorepo to v30 (major)

---
 package.json                                  |  4 +--
 public/index.html                             |  6 +++++
 src/components/Consents/Consents.tsx          | 27 +++++++++----------
 .../{DowloadModal.tsx => DownloadModal.tsx}   |  0
 yarn.lock                                     | 18 ++++++-------
 5 files changed, 29 insertions(+), 26 deletions(-)
 rename src/components/Consents/{DowloadModal.tsx => DownloadModal.tsx} (100%)

diff --git a/package.json b/package.json
index 80a9eff4..b26c9421 100644
--- a/package.json
+++ b/package.json
@@ -37,8 +37,8 @@
     "@types/html-to-draftjs": "^1.4.0",
     "@types/luxon": "^3.0.0",
     "@types/react-draft-wysiwyg": "^1.13.4",
-    "ag-grid-community": "^27.1.0",
-    "ag-grid-react": "^27.1.0",
+    "ag-grid-community": "^30.0.0",
+    "ag-grid-react": "^30.0.0",
     "axios": "^1.0.0",
     "dayjs": "^1.10.7",
     "draft-js": "^0.11.7",
diff --git a/public/index.html b/public/index.html
index dc5567c4..b0236df8 100644
--- a/public/index.html
+++ b/public/index.html
@@ -12,6 +12,12 @@
       user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
     -->
     <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+    <link
+  rel="stylesheet"
+  href="https://cdn.jsdelivr.net/npm/ag-grid-community@30.1.0/styles/ag-grid.css" />
+    <link
+  rel="stylesheet"
+  href="https://cdn.jsdelivr.net/npm/ag-grid-community@30.1.0/styles/ag-theme-alpine.css" />
     <!--
       Notice the use of %PUBLIC_URL% in the tags above.
       It will be replaced with the URL of the `public` folder during the build.
diff --git a/src/components/Consents/Consents.tsx b/src/components/Consents/Consents.tsx
index 023dfeb7..8b7a7449 100644
--- a/src/components/Consents/Consents.tsx
+++ b/src/components/Consents/Consents.tsx
@@ -5,12 +5,10 @@ import {
   CsvExportParams,
   GridApi,
   GridReadyEvent,
-  RowNode,
+  IRowNode,
   RowSelectedEvent,
   ValueFormatterParams,
 } from 'ag-grid-community'
-import 'ag-grid-community/dist/styles/ag-grid.css'
-import 'ag-grid-community/dist/styles/ag-theme-alpine-dark.css'
 import { AgGridReact } from 'ag-grid-react'
 import { DateTime } from 'luxon'
 import React, { useCallback, useEffect, useMemo, useState } from 'react'
@@ -18,7 +16,7 @@ import { useWhoAmI } from '../../API'
 import { getAxiosXSRFHeader } from '../../axios.config'
 import { IConsent } from '../../models/consent.model'
 import { ConsentService } from '../../services/consent.service'
-import DownloadModal from './DowloadModal'
+import DownloadModal from './DownloadModal'
 import './agGridOverrides.scss'
 import styles from './consents.module.scss'
 import './muiPaginationOverrides.scss'
@@ -26,9 +24,9 @@ import './muiPaginationOverrides.scss'
 const Consents: React.FC = () => {
   const [gridApi, setGridApi] = useState<GridApi | null>(null)
   const [search, setSearch] = useState<string>('')
-  const [selectedNodes, setSelectedNodes] = useState<RowNode[]>([])
+  const [selectedNodes, setSelectedNodes] = useState<IRowNode[]>([])
   const [isShowingSelection, setIsShowingSelection] = useState<boolean>(false)
-  const [openDowloadModal, setOpenDowloadModal] = useState<boolean>(false)
+  const [openDownloadModal, setOpenDownloadModal] = useState<boolean>(false)
   const [consents, setConsents] = useState<IConsent[]>([])
   const [page, setPage] = useState<number>(0)
   const [rowsPerPage, setRowsPerPage] = useState<number>(50)
@@ -39,7 +37,7 @@ const Consents: React.FC = () => {
   }, [])
 
   const toggleOpenModal = useCallback(() => {
-    setOpenDowloadModal(prev => !prev)
+    setOpenDownloadModal(prev => !prev)
   }, [])
 
   const defaultColDef = useMemo(
@@ -141,8 +139,7 @@ const Consents: React.FC = () => {
         .map(node => node.data.ID)
 
       newNodes.forEach(node => {
-        if (idsToCheck.includes(node.data.ID))
-          node.setSelected(true, false, true)
+        if (idsToCheck.includes(node.data.ID)) node.setSelected(true, false)
       })
     }
   }, [gridApi, selectedNodes])
@@ -204,10 +201,10 @@ const Consents: React.FC = () => {
       const newNodes = gridApi.getRenderedNodes()
       // We have to select nodes that have already been selected since we cannot pass a Node array to init AgGrid
       const idsToCheck: string[] = selectedNodes
-        .filter((node: RowNode) => node.isSelected)
-        .map((node: RowNode) => node.data.ID)
+        .filter(node => node.isSelected)
+        .map(node => node.data.ID)
 
-      newNodes.forEach((node: RowNode) => {
+      newNodes.forEach(node => {
         if (idsToCheck.includes(node.data.ID)) node.setSelected(true)
       })
     }
@@ -215,7 +212,7 @@ const Consents: React.FC = () => {
 
   const showCurrentSelection = useCallback(() => {
     setIsShowingSelection(true)
-    const dataFromNode = selectedNodes.map((item: RowNode) => item.data)
+    const dataFromNode = selectedNodes.map(item => item.data)
     selectedNodes && gridApi?.setRowData(dataFromNode)
     gridApi?.selectAll()
   }, [gridApi, selectedNodes])
@@ -226,7 +223,7 @@ const Consents: React.FC = () => {
       columnSeparator: ',',
     }
     gridApi?.exportDataAsCsv(params)
-    setOpenDowloadModal(false)
+    setOpenDownloadModal(false)
     resetSelection()
   }, [gridApi, resetSelection])
 
@@ -306,7 +303,7 @@ const Consents: React.FC = () => {
           )}
         </div>
         <DownloadModal
-          open={openDowloadModal}
+          open={openDownloadModal}
           toggleOpenModal={toggleOpenModal}
           exportData={exportData}
         />
diff --git a/src/components/Consents/DowloadModal.tsx b/src/components/Consents/DownloadModal.tsx
similarity index 100%
rename from src/components/Consents/DowloadModal.tsx
rename to src/components/Consents/DownloadModal.tsx
diff --git a/yarn.lock b/yarn.lock
index cd17f71c..0f3ac928 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3042,15 +3042,15 @@ adjust-sourcemap-loader@^4.0.0:
     loader-utils "^2.0.0"
     regex-parser "^2.2.11"
 
-ag-grid-community@^27.1.0:
-  version "27.3.0"
-  resolved "https://registry.yarnpkg.com/ag-grid-community/-/ag-grid-community-27.3.0.tgz#b1e94a58026aaf2f0cd7920e35833325b5e762c7"
-  integrity sha512-R5oZMXEHXnOLrmhn91J8lR0bv6IAnRcU6maO+wKLMJxffRWaAYFAuw1jt7bdmcKCv8c65F6LEBx4ykSOALa9vA==
-
-ag-grid-react@^27.1.0:
-  version "27.3.0"
-  resolved "https://registry.yarnpkg.com/ag-grid-react/-/ag-grid-react-27.3.0.tgz#fe06647653f8b0b349b8e613aab8ea2e07915562"
-  integrity sha512-2bs9YfJ/shvBZQLLjny4NFvht+ic6VtpTPO0r3bHHOhlL3Fjx2rGvS6AHSwfvu+kJacHCta30PjaEbX8T3UDyw==
+ag-grid-community@^30.0.0:
+  version "30.1.0"
+  resolved "https://registry.yarnpkg.com/ag-grid-community/-/ag-grid-community-30.1.0.tgz#50c532df2e6cc22596300b801651eca76459a189"
+  integrity sha512-D69e63CUALxfgLZSu1rXC8Xiyhu6+17zxzTV8cWsyvt5GeSDv2frQ3BKOqGZbUfVoOCLv2SQoHVTTqw8OjxavA==
+
+ag-grid-react@^30.0.0:
+  version "30.1.0"
+  resolved "https://registry.yarnpkg.com/ag-grid-react/-/ag-grid-react-30.1.0.tgz#9b45b6d9115a0d8a278c112ab1fd2a9d378f26a2"
+  integrity sha512-qnJAWe2yN4fjnFYiyzQu6S3EX0rZVvrZbkTEXVEy55pufTkcmimvCtKSV1aVxGg+TeZFJBw0gkXfXW4aMwTh4Q==
   dependencies:
     prop-types "^15.8.1"
 
-- 
GitLab