From a41b9968ebe0c308381217f9be6093267893ffbb Mon Sep 17 00:00:00 2001 From: Simon Seyock Date: Thu, 6 Jun 2024 17:02:41 +0200 Subject: [PATCH] feat: update coordinate button to use the new result value BREAKING CHANGE: The input of the render function is no longer grouped by featureType but returns an object for each feature that contains the feature, the layer and the feature type. If you need the grouping, you can do the following ``` import { groupBy, mapValues } from 'lodash'; { const grouped = groupBy(features, 'featureType'); const groupedAndMapped = mapValues(grouped, results => results.map(r => r.feature)); // ... }} /> ``` --- package-lock.json | 8 ++++---- package.json | 2 +- src/CoordinateInfo/CoordinateInfo.example.md | 12 +++++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9fdbd129f..6c0608429 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@fortawesome/react-fontawesome": "^0.2.2", "@terrestris/base-util": "^2.0.0", "@terrestris/ol-util": ">=18", - "@terrestris/react-util": "^7.0.0", + "@terrestris/react-util": "^8.0.0", "@types/lodash": "^4.17.4", "ag-grid-community": "^31.3.2", "ag-grid-react": "^31.3.2", @@ -5689,9 +5689,9 @@ } }, "node_modules/@terrestris/react-util": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@terrestris/react-util/-/react-util-7.0.0.tgz", - "integrity": "sha512-UI5ohQVD00T4taieId4efi0cJ1CFVS7Nti8Hbo2zNEiYIBOBO7F02WDQEMRWcMXcu2ZTsFtziDH9TOtulX0ttQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@terrestris/react-util/-/react-util-8.0.0.tgz", + "integrity": "sha512-VlNYxK7Whj7/Z4NCEGOkZ2ANDmHhoD8fp70hIkJz1DARAet/++YBCFZ2wce6E2PB9A7tlMr4INUcKiT/gggd0g==", "dependencies": { "@camptocamp/inkmap": "^1.4.0", "@terrestris/base-util": "^2.0.0", diff --git a/package.json b/package.json index e8ed61ebe..7db868e5e 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "@fortawesome/react-fontawesome": "^0.2.2", "@terrestris/base-util": "^2.0.0", "@terrestris/ol-util": ">=18", - "@terrestris/react-util": "^7.0.0", + "@terrestris/react-util": "^8.0.0", "@types/lodash": "^4.17.4", "ag-grid-community": "^31.3.2", "ag-grid-react": "^31.3.2", diff --git a/src/CoordinateInfo/CoordinateInfo.example.md b/src/CoordinateInfo/CoordinateInfo.example.md index 6e4a859d0..7439e1660 100644 --- a/src/CoordinateInfo/CoordinateInfo.example.md +++ b/src/CoordinateInfo/CoordinateInfo.example.md @@ -109,7 +109,7 @@ const CoordinateInfoExample = () => { }; return ( - Object.keys(features).length === 1 && features[Object.keys(features)[0]].length === 1 ? + features.length > 0 ?
{ > { style={{ marginTop: 16 }} type="primary" onClick={() => { - copy(features[Object.keys(features)[0]][0].get('STATE_NAME')); + copy(features[0].feature.get('STATE_NAME')); }} icon={ {
: - Click on a state to get details about the clicked coordinate. + + Click on a state to get details about the clicked coordinate. + ); }} />