Skip to content

Commit 9e5cbff

Browse files
committed
trying to resolve leaflet
1 parent ac2a190 commit 9e5cbff

File tree

11 files changed

+3577
-2459
lines changed

11 files changed

+3577
-2459
lines changed

package-lock.json

Lines changed: 3555 additions & 2233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tdb-documents-ui/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"test": "jest"
2828
},
2929
"jest": {
30+
"testEnvironment": "jsdom",
3031
"transformIgnorePatterns": [
3132
"<rootDir>/node_modules/(?!react-dnd|dnd-core|@react-dnd)"
3233
]
@@ -110,6 +111,7 @@
110111
"bootstrap": "^5.1.3",
111112
"chroma-js": "^2.4.2",
112113
"html-react-parser": "^3.0.4",
114+
"jest-transform-css": "^6.0.1",
113115
"leaflet": "^1.9.4",
114116
"leaflet-arrowheads": "^1.4.0",
115117
"mermaid": "^9.3.0",
@@ -120,8 +122,9 @@
120122
"react-diff-viewer": "^3.1.1",
121123
"react-icons": "^4.3.1",
122124
"react-json-editor-ajrm": "^2.5.13",
123-
"react-leaflet": "^3.2.5",
125+
"react-leaflet": "^4.2.1",
124126
"react-leaflet-fullscreen": "^2.0.2",
127+
"react-leaflet-universal": "^2.2.1",
125128
"react-select": "^5.2.2",
126129
"react-syntax-highlighter": "^15.5.0",
127130
"uuid": "^9.0.0"

packages/tdb-documents-ui/src/arrayHelpers/geoJSONTemplates.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { TDBLabel } from "../components/LabelComponent"
1111
import { getDisplay } from "../helpers/fieldDisplay"
1212
import { getPlaceholder } from "../helpers/placeholderHelper"
1313
import { TDBInput } from "../widgets/inputWidgets"
14-
import { Polygon } from "react-leaflet"
1514

1615
// Move down button
1716
const MoveDownButton = ({ element, variant }) => {

packages/tdb-documents-ui/src/constants.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22
// map icon component
33
import L from "leaflet";
44

5+
6+
7+
export default L.icon({
8+
iconSize: [25, 41],
9+
iconAnchor: [10, 41],
10+
popupAnchor: [2, -40],
11+
iconUrl: "https://unpkg.com/[email protected]/dist/images/marker-icon.png",
12+
shadowUrl: "https://unpkg.com/[email protected]/dist/images/marker-shadow.png"
13+
})
14+
515
// constants
616
export const TYPE="@type"
717
export const CLASS="@class"
8-
export const INHERITS="@inherits"
18+
export const INHERITS="@inherits"
919

1020
// info constanst to help with rjsf forms
1121
export const PLACEHOLDER="@placeholder"
@@ -145,14 +155,6 @@ export const GEOMETRY_ARRAY=[
145155
]
146156

147157

148-
export default L.icon({
149-
iconSize: [25, 41],
150-
iconAnchor: [10, 41],
151-
popupAnchor: [2, -40],
152-
iconUrl: "https://unpkg.com/[email protected]/dist/images/marker-icon.png",
153-
shadowUrl: "https://unpkg.com/[email protected]/dist/images/marker-shadow.png"
154-
})
155-
156158
// MIN ITEMS PER DIMENSIONS
157159
export const BBOX_MIN_ITEMS=4
158160
export const POINT_MIN_ITEMS=2

packages/tdb-documents-ui/src/helpers/displayHelper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { TDBSubDocument, populateSubDocumentData } from "../widgets/subDocumentW
99
import { TDBDocument } from "../widgets/documentWidget"
1010
import { TDBJSON } from "../widgets/JSONWidget"
1111
import * as CONST from "../constants"
12-
import { TDBGeoCollectionDocuments } from "../mapComponents/geoCollectionWidget"
1312
import { TDBFeatureCollectionDocuments } from "../mapComponents/featureCollectionWidget"
1413
import { TDBBBoxDocuments } from "../widgets/bboxGeoJSONWidget"
1514
import { extractPropertyDocumentation } from "./widgetHelper"
@@ -341,7 +340,6 @@ export function displayCollectionDocument (args, property, id) {
341340
bounds: bounds
342341
}
343342
return <TDBFeatureCollectionDocuments config={config}/>
344-
return <TDBGeoCollectionDocuments config={config}/>
345343
}
346344

347345
export function displayFeatureCollectionDocument (args, property, id, featureData) {

packages/tdb-documents-ui/src/mapComponents/featureCollectionWidget.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useRef } from "react"
22
import Stack from "react-bootstrap/Stack"
33
import { FullscreenControl } from "react-leaflet-fullscreen";
4-
import "react-leaflet-fullscreen/dist/styles.css";
4+
import "react-leaflet-fullscreen/dist/styles.css";
55
import { TDBLabel } from "../components/LabelComponent"
66
import { v4 as uuidv4 } from 'uuid';
77
import "leaflet-arrowheads"
@@ -12,11 +12,12 @@ import * as CONST from "../constants"
1212
import { customMapOptions, customMarkerOptions, getCenterFromData } from "./markers"
1313
import * as util from "../utils"
1414

15+
1516
export const TDBFeatureCollectionDocuments = ({ config }) => {
1617
const mapRef = useRef(null);
1718

1819
let mapID=uuidv4()
19-
20+
2021
const map = () => {
2122
let zoom=MAP_OPTION.zoom
2223
//let bounds=util.setBounds(config.documents.hasOwnProperty(CONST.B_BOX) ? config.documents[CONST.B_BOX] : [])
@@ -57,7 +58,7 @@ export const TDBFeatureCollectionDocuments = ({ config }) => {
5758
return <Stack direction="horizontal" className="mb-3">
5859
<TDBLabel name={config.label ? config.label : config.name}
5960
required={config.required}
60-
id={config.id}/>
61+
id={config.id}/>
6162
<div ref={mapRef} id={`tdb__map__geojson__leaflet_${mapID}`} className="rounded" data-testid={`map-leaflet-id`}></div>
6263
</Stack>
6364
}

packages/tdb-documents-ui/src/mapComponents/geoCollectionWidget.js

Lines changed: 0 additions & 99 deletions
This file was deleted.

packages/tdb-documents-ui/src/mapComponents/geometryCollectionMapView.js

Lines changed: 0 additions & 109 deletions
This file was deleted.

packages/tdb-documents-ui/src/mapComponents/lineStringMapView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "leaflet-arrowheads"
77
import L from "leaflet"
88
import { v4 as uuidv4 } from 'uuid';
99
import { MARKER_OPTION } from "./map.constants"
10-
10+
1111
export const lineStringMapViewer = (args) => {
1212
let { documents, zoom, onMarkerClick, center, bounds }=args
1313

packages/tdb-documents-ui/src/tests/createSetInput.datatypes.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {logRoles} from '@testing-library/dom';
1212
* @returns submitted data from <FrameViewer/>
1313
*/
1414
const setupCreate = async(config) => {
15+
1516
// submitted data via <FrameViewer/>
1617
let data=false
1718

0 commit comments

Comments
 (0)