react-spatial 2.0.2 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +79 -70
  3. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +2 -2
  4. package/components/BasicMap/BasicMap.js +2 -1
  5. package/components/BasicMap/BasicMap.js.map +1 -1
  6. package/components/CanvasSaveButton/CanvasSaveButton.js +10 -7
  7. package/components/CanvasSaveButton/CanvasSaveButton.js.map +2 -2
  8. package/components/Copyright/Copyright.js +5 -2
  9. package/components/Copyright/Copyright.js.map +2 -2
  10. package/components/FeatureExportButton/FeatureExportButton.js +5 -4
  11. package/components/FeatureExportButton/FeatureExportButton.js.map +2 -2
  12. package/components/FitExtent/FitExtent.js +5 -4
  13. package/components/FitExtent/FitExtent.js.map +2 -2
  14. package/components/Geolocation/Geolocation.js +6 -5
  15. package/components/Geolocation/Geolocation.js.map +2 -2
  16. package/components/LayerTree/LayerTree.js +68 -50
  17. package/components/LayerTree/LayerTree.js.map +2 -2
  18. package/components/MousePosition/MousePosition.js +12 -11
  19. package/components/MousePosition/MousePosition.js.map +2 -2
  20. package/components/NorthArrow/NorthArrow.js +5 -4
  21. package/components/NorthArrow/NorthArrow.js.map +2 -2
  22. package/components/Overlay/Overlay.js +43 -39
  23. package/components/Overlay/Overlay.js.map +1 -1
  24. package/components/Permalink/Permalink.js +1 -1
  25. package/components/Permalink/Permalink.js.map +2 -2
  26. package/components/Popup/Popup.js +28 -22
  27. package/components/Popup/Popup.js.map +2 -2
  28. package/components/ResizeHandler/ResizeHandler.js.map +1 -1
  29. package/components/RouteSchedule/RouteSchedule.js +82 -52
  30. package/components/RouteSchedule/RouteSchedule.js.map +2 -2
  31. package/components/ScaleLine/ScaleLine.js +2 -1
  32. package/components/ScaleLine/ScaleLine.js.map +2 -2
  33. package/components/StopsFinder/StopsFinder.js +23 -17
  34. package/components/StopsFinder/StopsFinder.js.map +2 -2
  35. package/components/StopsFinder/StopsFinderOption.js +18 -12
  36. package/components/StopsFinder/StopsFinderOption.js.map +2 -2
  37. package/components/Zoom/Zoom.js +16 -14
  38. package/components/Zoom/Zoom.js.map +2 -2
  39. package/package.json +59 -71
  40. package/setupTests.js +10 -1
  41. package/setupTests.js.map +2 -2
  42. package/utils/KML.js +3 -3
  43. package/utils/KML.js.map +2 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/MousePosition/MousePosition.js"],
4
- "sourcesContent": ["import OLMousePosition from \"ol/control/MousePosition\";\nimport { createStringXY } from \"ol/coordinate\";\nimport OLMap from \"ol/Map\";\nimport PropTypes from \"prop-types\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nconst propTypes = {\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Function triggered on projection's change event.\n * @param {Event} event The change event object.\n * @param {Object} projection The selected projection object.\n */\n onChange: PropTypes.func,\n\n /**\n * List of projections to display.\n */\n projections: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * A function following the [CoordinateFormat](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~CoordinateFormat).\n */\n format: PropTypes.func,\n\n /**\n * The label to display in the select box.\n */\n label: PropTypes.string.isRequired,\n\n /**\n * The value used to create the options\u00B4s projection of the MousePosition control.\n * See [doc](https://openlayers.org/en/latest/apidoc/module-ol_control_MousePosition.html).\n */\n value: PropTypes.string.isRequired,\n }),\n ),\n\n /**\n * The initially selected projection\n */\n projectionValue: PropTypes.shape({\n /**\n * A function following the [CoordinateFormat](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~CoordinateFormat).\n */\n format: PropTypes.func,\n\n /**\n * The label to display in the select box.\n */\n label: PropTypes.string.isRequired,\n\n /**\n * The value used to create the options\u00B4s projection of the MousePosition control.\n * See [doc](https://openlayers.org/en/latest/apidoc/module-ol_control_MousePosition.html).\n */\n value: PropTypes.string.isRequired,\n }),\n};\n\nconst defaultProps = {\n onChange: () => {},\n projections: [\n {\n label: \"EPSG:4326\",\n value: \"EPSG:4326\",\n },\n {\n label: \"EPSG:3857\",\n value: \"EPSG:3857\",\n },\n ],\n projectionValue: null,\n};\n\n/**\n * The MousePosition component renders a select box with map projection options\n * and the cursor position in coordinates using the selected projection.\n */\nfunction MousePosition({\n map,\n onChange = defaultProps.onChange,\n projections = defaultProps.projections,\n projectionValue = defaultProps.projectionValue,\n ...other\n}) {\n const [projection, setProjection] = useState(\n projections &&\n ((projectionValue &&\n projections.find((p) => {\n return p.value === projectionValue.value;\n })) ||\n projections[0]),\n );\n const [control, setControl] = useState();\n const ref = useRef();\n\n useEffect(() => {\n const mousePosition = new OLMousePosition({\n className: \"\",\n placeholder: \"&nbsp;\",\n target: ref.current,\n });\n map.addControl(mousePosition);\n setControl(mousePosition);\n\n return () => {\n map.removeControl(mousePosition);\n };\n }, [map]);\n\n useEffect(() => {\n if (!projection || !control) {\n return;\n }\n control.setProjection(projection.value);\n control.setCoordinateFormat(projection.format || createStringXY(4));\n }, [projection, control]);\n\n useEffect(() => {\n if (projections) {\n const proj =\n (projectionValue &&\n projections.find((p) => {\n return p.value === projectionValue.value;\n })) ||\n projections[0];\n setProjection(proj);\n }\n }, [projections, projectionValue]);\n\n const onChangeCb = useCallback(\n (evt) => {\n const newProj = projections.find((opt) => {\n return evt.target.value === opt.value;\n });\n setProjection(newProj);\n onChange(evt, newProj);\n },\n [onChange, projections],\n );\n\n if (!projection || !projections || !projections.length) {\n return null;\n }\n\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <div className=\"rs-mouse-position\" {...other}>\n <select\n className=\"rs-select\"\n onChange={onChangeCb}\n value={projection.value}\n >\n {projections.map((option) => {\n return (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n );\n })}\n </select>\n <span className=\"rs-coordinates\" ref={ref} />\n </div>\n );\n}\n\nMousePosition.propTypes = propTypes;\n\nexport default React.memo(MousePosition);\n"],
5
- "mappings": "AAAA,OAAO,qBAAqB;AAC5B,SAAS,sBAAsB;AAC/B,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAEhE,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjC,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA,EAKpB,aAAa,UAAU;AAAA,IACrB,UAAU,MAAM;AAAA;AAAA;AAAA;AAAA,MAId,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA,MAKlB,OAAO,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,MAMxB,OAAO,UAAU,OAAO;AAAA,IAC1B,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAiB,UAAU,MAAM;AAAA;AAAA;AAAA;AAAA,IAI/B,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA,IAKlB,OAAO,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAMxB,OAAO,UAAU,OAAO;AAAA,EAC1B,CAAC;AACH;AAEA,MAAM,eAAe;AAAA,EACnB,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,aAAa;AAAA,IACX;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,iBAAiB;AACnB;AAMA,SAAS,cAAc;AAAA,EACrB;AAAA,EACA,WAAW,aAAa;AAAA,EACxB,cAAc,aAAa;AAAA,EAC3B,kBAAkB,aAAa;AAAA,EAC/B,GAAG;AACL,GAAG;AACD,QAAM,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC,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AA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,UAAU;AAAA,QACV,OAAO,WAAW;AAAA;AAAA,MAEjB,YAAY,IAAI,CAAC,WAAW;AAC3B,eACE,oCAAC,YAAO,KAAK,OAAO,OAAO,OAAO,OAAO,SACtC,OAAO,KACV;AAAA,MAEJ,CAAC;AAAA,IACH,GACA,oCAAC,UAAK,WAAU,kBAAiB,KAAU,CAC7C;AAAA;AAEJ;AAEA,cAAc,YAAY;AAE1B,eAAe,MAAM,KAAK,aAAa;",
4
+ "sourcesContent": ["import OLMousePosition from \"ol/control/MousePosition\";\nimport { createStringXY } from \"ol/coordinate\";\nimport OLMap from \"ol/Map\";\nimport PropTypes from \"prop-types\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nconst propTypes = {\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Function triggered on projection's change event.\n * @param {Event} event The change event object.\n * @param {Object} projection The selected projection object.\n */\n onChange: PropTypes.func,\n\n /**\n * List of projections to display.\n */\n projections: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * A function following the [CoordinateFormat](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~CoordinateFormat).\n */\n format: PropTypes.func,\n\n /**\n * The label to display in the select box.\n */\n label: PropTypes.string.isRequired,\n\n /**\n * The value used to create the options\u00B4s projection of the MousePosition control.\n * See [doc](https://openlayers.org/en/latest/apidoc/module-ol_control_MousePosition.html).\n */\n value: PropTypes.string.isRequired,\n }),\n ),\n\n /**\n * The initially selected projection\n */\n projectionValue: PropTypes.shape({\n /**\n * A function following the [CoordinateFormat](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~CoordinateFormat).\n */\n format: PropTypes.func,\n\n /**\n * The label to display in the select box.\n */\n label: PropTypes.string.isRequired,\n\n /**\n * The value used to create the options\u00B4s projection of the MousePosition control.\n * See [doc](https://openlayers.org/en/latest/apidoc/module-ol_control_MousePosition.html).\n */\n value: PropTypes.string.isRequired,\n }),\n};\n\nconst defaultProps = {\n onChange: () => {},\n projections: [\n {\n label: \"EPSG:4326\",\n value: \"EPSG:4326\",\n },\n {\n label: \"EPSG:3857\",\n value: \"EPSG:3857\",\n },\n ],\n projectionValue: null,\n};\n\n/**\n * The MousePosition component renders a select box with map projection options\n * and the cursor position in coordinates using the selected projection.\n */\nfunction MousePosition({\n map,\n onChange = defaultProps.onChange,\n projections = defaultProps.projections,\n projectionValue = defaultProps.projectionValue,\n ...other\n}) {\n const [projection, setProjection] = useState(\n projections &&\n ((projectionValue &&\n projections.find((p) => {\n return p.value === projectionValue.value;\n })) ||\n projections[0]),\n );\n const [control, setControl] = useState();\n const ref = useRef();\n\n useEffect(() => {\n const mousePosition = new OLMousePosition({\n className: \"\",\n placeholder: \"&nbsp;\",\n target: ref.current,\n });\n map.addControl(mousePosition);\n setControl(mousePosition);\n\n return () => {\n map.removeControl(mousePosition);\n };\n }, [map]);\n\n useEffect(() => {\n if (!projection || !control) {\n return;\n }\n control.setProjection(projection.value);\n control.setCoordinateFormat(projection.format || createStringXY(4));\n }, [projection, control]);\n\n useEffect(() => {\n if (projections) {\n const proj =\n (projectionValue &&\n projections.find((p) => {\n return p.value === projectionValue.value;\n })) ||\n projections[0];\n setProjection(proj);\n }\n }, [projections, projectionValue]);\n\n const onChangeCb = useCallback(\n (evt) => {\n const newProj = projections.find((opt) => {\n return evt.target.value === opt.value;\n });\n setProjection(newProj);\n onChange(evt, newProj);\n },\n [onChange, projections],\n );\n\n if (!projection || !projections?.length) {\n return null;\n }\n\n return (\n <div className=\"rs-mouse-position\" {...other}>\n <select\n className=\"rs-select\"\n onChange={onChangeCb}\n value={projection.value}\n >\n {projections.map((option) => {\n return (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n );\n })}\n </select>\n <span className=\"rs-coordinates\" ref={ref} />\n </div>\n );\n}\n\nMousePosition.propTypes = propTypes;\n\nexport default React.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;AAAA,QAEjB,sBAAY,IAAI,CAAC,WAAW;AAC3B,iBACE,oBAAC,YAA0B,OAAO,OAAO,OACtC,iBAAO,SADG,OAAO,KAEpB;AAAA,QAEJ,CAAC;AAAA;AAAA,IACH;AAAA,IACA,oBAAC,UAAK,WAAU,kBAAiB,KAAU;AAAA,KAC7C;AAEJ;AAEA,cAAc,YAAY;AAE1B,eAAe,MAAM,KAAK,aAAa;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { jsx } from "react/jsx-runtime";
1
2
  import OLMap from "ol/Map";
2
3
  import { toDegrees } from "ol/math";
3
4
  import { unByKey } from "ol/Observable";
@@ -45,14 +46,14 @@ function NorthArrow({
45
46
  unByKey(key);
46
47
  };
47
48
  }, [map, rotationOffset]);
48
- return /* @__PURE__ */ React.createElement(
49
+ return /* @__PURE__ */ jsx(
49
50
  "div",
50
51
  {
51
52
  className: "rs-north-arrow",
52
53
  ...other,
53
- style: { transform: `rotate(${rotation}deg)` }
54
- },
55
- children || (circled ? /* @__PURE__ */ React.createElement(NorthArrowCircle, null) : /* @__PURE__ */ React.createElement(NorthArrowSimple, null))
54
+ style: { transform: `rotate(${rotation}deg)` },
55
+ children: children || (circled ? /* @__PURE__ */ jsx(NorthArrowCircle, {}) : /* @__PURE__ */ jsx(NorthArrowSimple, {}))
56
+ }
56
57
  );
57
58
  }
58
59
  NorthArrow.propTypes = propTypes;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/NorthArrow/NorthArrow.js"],
4
- "sourcesContent": ["import OLMap from \"ol/Map\";\nimport { toDegrees } from \"ol/math\";\nimport { unByKey } from \"ol/Observable\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useState } from \"react\";\n\nimport NorthArrowSimple from \"../../images/northArrow.svg\";\nimport NorthArrowCircle from \"../../images/northArrowCircle.svg\";\n\nconst propTypes = {\n /**\n * Children content of the north arrow.\n */\n children: PropTypes.node,\n\n /**\n * Display circle around the north arrow. Not used if pass children.\n */\n circled: PropTypes.bool,\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Rotation of the north arrow in degrees.\n */\n rotationOffset: PropTypes.number,\n};\n\nconst getRotation = (map, rotationOffset) => {\n return toDegrees(map.getView().getRotation()) + rotationOffset;\n};\n\n/**\n * This NorthArrow component inserts an arrow pointing north into an\n * [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction NorthArrow({\n children = null,\n circled = false,\n map,\n rotationOffset = 0,\n ...other\n}) {\n const [rotation, setRotation] = useState(rotationOffset);\n\n useEffect(() => {\n if (!map) {\n return null;\n }\n const key = map.on(\"postrender\", () => {\n setRotation(getRotation(map, rotationOffset));\n });\n return () => {\n unByKey(key);\n };\n }, [map, rotationOffset]);\n\n return (\n <div\n className=\"rs-north-arrow\"\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n style={{ transform: `rotate(${rotation}deg)` }}\n >\n {children || (circled ? <NorthArrowCircle /> : <NorthArrowSimple />)}\n </div>\n );\n}\n\nNorthArrow.propTypes = propTypes;\n\nexport default React.memo(NorthArrow);\n"],
5
- "mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,gBAAgB;AAE3C,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAE7B,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA,EAKpB,SAAS,UAAU;AAAA;AAAA;AAAA;AAAA,EAKnB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKjC,gBAAgB,UAAU;AAC5B;AAEA,MAAM,cAAc,CAAC,KAAK,mBAAmB;AAC3C,SAAO,UAAU,IAAI,QAAQ,EAAE,YAAY,CAAC,IAAI;AAClD;AAMA,SAAS,WAAW;AAAA,EAClB,WAAW;AAAA,EACX,UAAU;AAAA,EACV;AAAA,EACA,iBAAiB;AAAA,EACjB,GAAG;AACL,GAAG;AACD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,cAAc;AAEvD,YAAU,MAAM;AACd,QAAI,CAAC,KAAK;AACR,aAAO;AAAA,IACT;AACA,UAAM,MAAM,IAAI,GAAG,cAAc,MAAM;AACrC,kBAAY,YAAY,KAAK,cAAc,CAAC;AAAA,IAC9C,CAAC;AACD,WAAO,MAAM;AACX,cAAQ,GAAG;AAAA,IACb;AAAA,EACF,GAAG,CAAC,KAAK,cAAc,CAAC;AAExB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MAET,GAAG;AAAA,MACJ,OAAO,EAAE,WAAW,UAAU,QAAQ,OAAO;AAAA;AAAA,IAE5C,aAAa,UAAU,oCAAC,sBAAiB,IAAK,oCAAC,sBAAiB;AAAA,EACnE;AAEJ;AAEA,WAAW,YAAY;AAEvB,eAAe,MAAM,KAAK,UAAU;",
4
+ "sourcesContent": ["import OLMap from \"ol/Map\";\nimport { toDegrees } from \"ol/math\";\nimport { unByKey } from \"ol/Observable\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useState } from \"react\";\n\nimport NorthArrowSimple from \"../../images/northArrow.svg\";\nimport NorthArrowCircle from \"../../images/northArrowCircle.svg\";\n\nconst propTypes = {\n /**\n * Children content of the north arrow.\n */\n children: PropTypes.node,\n\n /**\n * Display circle around the north arrow. Not used if pass children.\n */\n circled: PropTypes.bool,\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Rotation of the north arrow in degrees.\n */\n rotationOffset: PropTypes.number,\n};\n\nconst getRotation = (map, rotationOffset) => {\n return toDegrees(map.getView().getRotation()) + rotationOffset;\n};\n\n/**\n * This NorthArrow component inserts an arrow pointing north into an\n * [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction NorthArrow({\n children = null,\n circled = false,\n map,\n rotationOffset = 0,\n ...other\n}) {\n const [rotation, setRotation] = useState(rotationOffset);\n\n useEffect(() => {\n if (!map) {\n return null;\n }\n const key = map.on(\"postrender\", () => {\n setRotation(getRotation(map, rotationOffset));\n });\n return () => {\n unByKey(key);\n };\n }, [map, rotationOffset]);\n\n return (\n <div\n className=\"rs-north-arrow\"\n {...other}\n style={{ transform: `rotate(${rotation}deg)` }}\n >\n {children || (circled ? <NorthArrowCircle /> : <NorthArrowSimple />)}\n </div>\n );\n}\n\nNorthArrow.propTypes = propTypes;\n\nexport default React.memo(NorthArrow);\n"],
5
+ "mappings": "AAkE8B;AAlE9B,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,gBAAgB;AAE3C,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAE7B,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA,EAKpB,SAAS,UAAU;AAAA;AAAA;AAAA;AAAA,EAKnB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKjC,gBAAgB,UAAU;AAC5B;AAEA,MAAM,cAAc,CAAC,KAAK,mBAAmB;AAC3C,SAAO,UAAU,IAAI,QAAQ,EAAE,YAAY,CAAC,IAAI;AAClD;AAMA,SAAS,WAAW;AAAA,EAClB,WAAW;AAAA,EACX,UAAU;AAAA,EACV;AAAA,EACA,iBAAiB;AAAA,EACjB,GAAG;AACL,GAAG;AACD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,cAAc;AAEvD,YAAU,MAAM;AACd,QAAI,CAAC,KAAK;AACR,aAAO;AAAA,IACT;AACA,UAAM,MAAM,IAAI,GAAG,cAAc,MAAM;AACrC,kBAAY,YAAY,KAAK,cAAc,CAAC;AAAA,IAC9C,CAAC;AACD,WAAO,MAAM;AACX,cAAQ,GAAG;AAAA,IACb;AAAA,EACF,GAAG,CAAC,KAAK,cAAc,CAAC;AAExB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,OAAO,EAAE,WAAW,UAAU,QAAQ,OAAO;AAAA,MAE5C,uBAAa,UAAU,oBAAC,oBAAiB,IAAK,oBAAC,oBAAiB;AAAA;AAAA,EACnE;AAEJ;AAEA,WAAW,YAAY;AAEvB,eAAe,MAAM,KAAK,UAAU;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
2
  import PropTypes from "prop-types";
2
3
  import { Resizable } from "re-resizable";
3
4
  import React, { Component, useState } from "react";
@@ -94,46 +95,49 @@ function Overlay({
94
95
  if (mobileSize) {
95
96
  resizableMobileSize = { ...defaultMobileSize, ...mobileSize };
96
97
  }
97
- return /* @__PURE__ */ React.createElement(React.Fragment, null, observe ? /* @__PURE__ */ React.createElement(ResizeHandler, { observe, onResize }) : null, isMobile ? /* @__PURE__ */ React.createElement(
98
- Resizable,
99
- {
100
- className: `tm-overlay-mobile${className ? ` ${className}` : ""}`,
101
- defaultSize: mobileSize && resizableMobileSize.defaultSize,
102
- enable: {
103
- bottom: false,
104
- bottomLeft: false,
105
- bottomRight: false,
106
- left: false,
107
- right: false,
108
- top: isMobileResizable,
109
- topLeft: false,
110
- topRight: false
111
- },
112
- handleComponent: {
113
- top: /* @__PURE__ */ React.createElement("div", { className: "tm-overlay-handler" }, "\u2014")
114
- },
115
- handleStyles: {
116
- top: {
117
- alignItems: "center",
118
- display: "flex",
119
- height: "20px",
120
- justifyContent: "center",
121
- padding: "20px 0",
122
- top: "-20px",
123
- width: "100%"
124
- }
125
- },
126
- maxHeight: mobileSize && resizableMobileSize.maximalHeight,
127
- minHeight: mobileSize && resizableMobileSize.minimalHeight,
128
- onResizeStart,
129
- onResizeStop,
130
- size: resizableMobileSize.size,
131
- style: {
132
- position: "absolute"
98
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
99
+ observe ? /* @__PURE__ */ jsx(ResizeHandler, { observe, onResize }) : null,
100
+ isMobile ? /* @__PURE__ */ jsx(
101
+ Resizable,
102
+ {
103
+ className: `tm-overlay-mobile${className ? ` ${className}` : ""}`,
104
+ defaultSize: mobileSize && resizableMobileSize.defaultSize,
105
+ enable: {
106
+ bottom: false,
107
+ bottomLeft: false,
108
+ bottomRight: false,
109
+ left: false,
110
+ right: false,
111
+ top: isMobileResizable,
112
+ topLeft: false,
113
+ topRight: false
114
+ },
115
+ handleComponent: {
116
+ top: /* @__PURE__ */ jsx("div", { className: "tm-overlay-handler", children: "\u2014" })
117
+ },
118
+ handleStyles: {
119
+ top: {
120
+ alignItems: "center",
121
+ display: "flex",
122
+ height: "20px",
123
+ justifyContent: "center",
124
+ padding: "20px 0",
125
+ top: "-20px",
126
+ width: "100%"
127
+ }
128
+ },
129
+ maxHeight: mobileSize && resizableMobileSize.maximalHeight,
130
+ minHeight: mobileSize && resizableMobileSize.minimalHeight,
131
+ onResizeStart,
132
+ onResizeStop,
133
+ size: resizableMobileSize.size,
134
+ style: {
135
+ position: "absolute"
136
+ },
137
+ children: /* @__PURE__ */ jsx("div", { className: "tm-overlay-mobile-content", children })
133
138
  }
134
- },
135
- /* @__PURE__ */ React.createElement("div", { className: "tm-overlay-mobile-content" }, children)
136
- ) : /* @__PURE__ */ React.createElement("div", { className: `tm-overlay${className ? ` ${className}` : ""}` }, children));
139
+ ) : /* @__PURE__ */ jsx("div", { className: `tm-overlay${className ? ` ${className}` : ""}`, children })
140
+ ] });
137
141
  }
138
142
  Overlay.propTypes = propTypes;
139
143
  export default Overlay;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Overlay/Overlay.js"],
4
4
  "sourcesContent": ["import PropTypes from \"prop-types\";\nimport { Resizable } from \"re-resizable\";\nimport React, { Component, useState } from \"react\";\n\nimport ResizeHandler from \"../ResizeHandler\";\n\nconst propTypes = {\n /**\n * Children content of the overlay.\n */\n children: PropTypes.node,\n\n /**\n * CSS class added to container.\n */\n className: PropTypes.string,\n\n /**\n * Deactivate the ability to resize the overlay on mobile.\n * /!\\ This prop is only used if isMobile (observer width < 768px).\n */\n isMobileResizable: PropTypes.bool,\n\n /**\n * Size parameters to the Resizable component on mobile.\n * Pass following prop to re-resizable component: 'size', 'defaultSize', 'minHeight' & 'maxHeight'\n * (https://github.com/bokuweb/re-resizable)\n * /!\\ This prop is only used if isMobile (observer width < 768px).\n */\n mobileSize: PropTypes.shape({\n defaultSize: PropTypes.shape({\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n }),\n maximalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n minimalHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n size: PropTypes.shape({\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n }),\n }),\n\n /**\n * Observed element to define screen size.\n */\n observe: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.node,\n PropTypes.instanceOf(Component),\n PropTypes.shape({ current: PropTypes.node }),\n PropTypes.shape({ current: PropTypes.instanceOf(Component) }),\n ]),\n\n /**\n * Callback when start resizing\n * Pass following prop to re-resizable component\n * (https://github.com/bokuweb/re-resizable)\n */\n onResizeStart: PropTypes.func,\n\n /**\n * Callback when stop resizing\n * Pass following prop to re-resizable component\n * (https://github.com/bokuweb/re-resizable)\n */\n onResizeStop: PropTypes.func,\n\n /**\n * Minimal width to consider the observed as mobile.\n * Default is 768px.\n */\n thresholdWidthForMobile: PropTypes.number,\n};\n\nconst defaultMobileSize = {\n defaultSize: {\n height: \"25%\",\n width: \"100%\",\n },\n maximalHeight: \"100%\",\n minimalHeight: \"25%\",\n size: undefined,\n};\n\nconst emptyFunc = () => {};\n/**\n * The Overlay component creates a resizable, swipable overlay <div\\>\n */\nfunction Overlay({\n children = null,\n className = null,\n isMobileResizable = true,\n mobileSize = defaultMobileSize,\n observe = null,\n onResizeStart = emptyFunc,\n onResizeStop = emptyFunc,\n thresholdWidthForMobile = 768,\n}) {\n const [isMobile, setIsMobile] = useState();\n\n const onResize = (entries) => {\n for (let i = 0; i < entries.length; i += 1) {\n const { width } = entries[i].contentRect;\n setIsMobile(width <= thresholdWidthForMobile);\n }\n };\n\n let resizableMobileSize;\n if (mobileSize) {\n resizableMobileSize = { ...defaultMobileSize, ...mobileSize };\n }\n\n return (\n <>\n {observe ? <ResizeHandler observe={observe} onResize={onResize} /> : null}\n {isMobile ? (\n <Resizable\n className={`tm-overlay-mobile${className ? ` ${className}` : \"\"}`}\n defaultSize={mobileSize && resizableMobileSize.defaultSize}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: false,\n right: false,\n top: isMobileResizable,\n topLeft: false,\n topRight: false,\n }}\n handleComponent={{\n top: <div className=\"tm-overlay-handler\">&mdash;</div>,\n }}\n handleStyles={{\n top: {\n alignItems: \"center\",\n display: \"flex\",\n height: \"20px\",\n justifyContent: \"center\",\n padding: \"20px 0\",\n top: \"-20px\",\n width: \"100%\",\n },\n }}\n maxHeight={mobileSize && resizableMobileSize.maximalHeight}\n minHeight={mobileSize && resizableMobileSize.minimalHeight}\n onResizeStart={onResizeStart}\n onResizeStop={onResizeStop}\n size={resizableMobileSize.size}\n style={{\n position: \"absolute\",\n }}\n >\n <div className=\"tm-overlay-mobile-content\">{children}</div>\n </Resizable>\n ) : (\n <div className={`tm-overlay${className ? ` ${className}` : \"\"}`}>\n {children}\n </div>\n )}\n </>\n );\n}\n\nOverlay.propTypes = propTypes;\n\nexport default Overlay;\n"],
5
- "mappings": "AAAA,OAAO,eAAe;AACtB,SAAS,iBAAiB;AAC1B,OAAO,SAAS,WAAW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AI,SAAS,KAAK,EAAE;AAAA,QAC/D,aAAa,cAAc,oBAAoB;AAAA,QAC/C,QAAQ;AAAA,UACN,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,MAAM;AAAA,UACN,OAAO;AAAA,UACP,KAAK;AAAA,UACL,SAAS;AAAA,UACT,UAAU;AAAA,QACZ;AAAA,QACA,iBAAiB;AAAA,UACf,KAAK,oBAAC,SAAI,WAAU,sBAAqB,oBAAO;AAAA,QAClD;AAAA,QACA,cAAc;AAAA,UACZ,KAAK;AAAA,YACH,YAAY;AAAA,YACZ,SAAS;AAAA,YACT,QAAQ;AAAA,YACR,gBAAgB;AAAA,YAChB,SAAS;AAAA,YACT,KAAK;AAAA,YACL,OAAO;AAAA,UACT;AAAA,QACF;AAAA,QACA,WAAW,cAAc,oBAAoB;AAAA,QAC7C,WAAW,cAAc,oBAAoB;AAAA,QAC7C;AAAA,QACA;AAAA,QACA,MAAM,oBAAoB;AAAA,QAC1B,OAAO;AAAA,UACL,UAAU;AAAA,QACZ;AAAA,QAEA,8BAAC,SAAI,WAAU,6BAA6B,UAAS;AAAA;AAAA,IACvD,IAEA,oBAAC,SAAI,WAAW,aAAa,YAAY,IAAI,SAAS,KAAK,EAAE,IAC1D,UACH;AAAA,KAEJ;AAEJ;AAEA,QAAQ,YAAY;AAEpB,eAAe;",
6
6
  "names": []
7
7
  }
@@ -90,7 +90,7 @@ class Permalink extends PureComponent {
90
90
  } else {
91
91
  l.visible = true;
92
92
  }
93
- } else if (!isBaseLayer(l) && !isLayerHidden(l) && !(l.children || l.get("children")).some((ll) => {
93
+ } else if (!isBaseLayer(l) && !isLayerHidden(l) && !(l.children || l.get("children"))?.some((ll) => {
94
94
  return ll.getVisible ? ll.getVisible() : ll.visible;
95
95
  })) {
96
96
  if (l.setVisible) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Permalink/Permalink.js"],
4
- "sourcesContent": ["import Layer from \"ol/layer/Layer\";\nimport OLMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport PropTypes from \"prop-types\";\nimport { PureComponent } from \"react\";\n\nimport getLayersAsFlatArray from \"../../utils/getLayersAsFlatArray\";\n\nconst propTypes = {\n /**\n * Maximum number of decimals allowed for coordinates.\n */\n coordinateDecimals: PropTypes.number,\n\n /**\n * Either 'react-router' history object:\n * https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/history.md<br>\n * or default fallback as HTML5 History:\n * https://developer.mozilla.org/en-US/docs/Web/API/History\n */\n history: PropTypes.shape({\n replace: PropTypes.func,\n }),\n\n /**\n * Determine if the layer appears in the baselayers permalink parameter or not.\n *\n * @param {object} item The item to hide or not.\n *\n * @return {bool} true if the item is not displayed in the baselayers permalink parameter\n */\n isBaseLayer: PropTypes.func,\n\n /**\n * Determine if the layer is hidden in the permalink or not.\n *\n * @param {object} item The item to hide or not.\n *\n * @return {bool} true if the item is not displayed in the permalink\n */\n isLayerHidden: PropTypes.func,\n\n /**\n * Layers provider.\n */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)),\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Params to be written in url.\n */\n params: PropTypes.object,\n\n /**\n * Custom function to be called when the permalink is updated.\n * This property has priority over the history parameter and window.history.replaceState calls.\n */\n replace: PropTypes.func,\n};\n\nconst defaultProps = {\n coordinateDecimals: 2,\n history: null,\n isBaseLayer: (layer) => {\n return layer.get(\"isBaseLayer\");\n },\n isLayerHidden: () => {\n return false;\n },\n layers: [],\n map: null,\n params: {},\n replace: null,\n};\n\n/**\n * This component handles permalink logic. Injecting an\n * __[ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)__\n * will add the *map center* (x, y) and the *zoom* (z) parameters to the permalink.\n * Injecting layers will add the *baselayers* and/or *layers* parameters. Further parameters can\n * be added using __params__.\n */\nclass Permalink extends PureComponent {\n constructor(props) {\n super(props);\n this.state = { revision: 0 };\n this.onPropertyChangeKeys = [];\n }\n\n componentDidMount() {\n const { isBaseLayer, isLayerHidden, layers, map } = this.props;\n if (map) {\n this.moveEndRef = map.on(\"moveend\", () => {\n this.onMapMoved();\n });\n }\n\n if (layers) {\n // set layer visibility based on 'layers' parameter.\n const urlParams = new URLSearchParams(window.location.search);\n\n if (urlParams.get(\"layers\")) {\n const visibleLayers = urlParams.get(\"layers\").split(\",\");\n getLayersAsFlatArray(layers).forEach((l) => {\n if (visibleLayers.includes(l.key || l.get(\"key\"))) {\n if (l.setVisible) {\n l.setVisible(true);\n } else {\n // eslint-disable-next-line no-param-reassign\n l.visible = true;\n }\n } else if (\n !isBaseLayer(l) &&\n !isLayerHidden(l) &&\n !(l.children || l.get(\"children\")).some((ll) => {\n return ll.getVisible ? ll.getVisible() : ll.visible;\n })\n ) {\n if (l.setVisible) {\n l.setVisible(false);\n } else {\n // eslint-disable-next-line no-param-reassign\n l.visible = false;\n }\n }\n });\n }\n\n // Set baser layer visibility based on 'baseLayers' parameter.\n // Show the first of the list then hide the others\n const visibleBaseLayer = (urlParams.get(\"baselayers\") || \"\").split(\n \",\",\n )[0];\n if (visibleBaseLayer) {\n getLayersAsFlatArray(layers)\n .filter(isBaseLayer)\n .forEach((baseLayer) => {\n const key = baseLayer.key || baseLayer.get(\"key\");\n const visible = key === visibleBaseLayer;\n if (baseLayer.setVisible) {\n baseLayer.setVisible(visible);\n } else {\n // eslint-disable-next-line no-param-reassign\n baseLayer.visible = visible;\n }\n });\n }\n this.updateLayers();\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { layers, map } = this.props;\n const { revision } = this.state;\n\n if (layers !== prevProps.layers || revision !== prevState.revision) {\n this.updateLayers();\n }\n\n if (map !== prevProps.map) {\n unByKey(this.moveEndRef);\n this.moveEndRef = map.on(\"moveend\", () => {\n return this.onMapMoved();\n });\n }\n\n this.updateHistory();\n }\n\n componentWillUnmount() {\n const { map } = this.props;\n\n if (map) {\n unByKey(this.moveEndRef);\n }\n unByKey(this.onPropertyChangeKeys);\n this.onPropertyChangeKeys = [];\n }\n\n onMapMoved() {\n const { map } = this.props;\n const mapView = map.getView();\n const center = mapView.getCenter();\n const params = {};\n\n if (\n center !== undefined &&\n center[0] !== undefined &&\n center[1] !== undefined\n ) {\n params.x = this.roundCoord(center[0]);\n params.y = this.roundCoord(center[1]);\n }\n\n this.setState({\n ...params,\n // rounds zoom to two digits max.\n z: +`${Math.round(`${parseFloat(mapView.getZoom())}e+2`)}e-2`,\n });\n }\n\n render() {\n return null;\n }\n\n roundCoord(val) {\n const { coordinateDecimals } = this.props;\n return parseFloat(val.toFixed(coordinateDecimals));\n }\n\n updateHistory() {\n const { history, params, replace } = this.props;\n const oldParams = new URLSearchParams(window.location.search);\n const parameters = {\n ...Object.fromEntries(oldParams.entries()),\n ...this.state,\n ...params,\n };\n\n delete parameters.revision;\n\n // Remove parameters that are undefined or null\n Object.entries(parameters).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n delete parameters[key];\n }\n });\n\n // We don't encode the , to leave the permalink lisible\n const qStr = new URLSearchParams(parameters)\n .toString()\n .replace(/%2C/g, \",\");\n const search = qStr ? `?${qStr}` : \"\";\n\n if (\n (!qStr && window.location.search) ||\n (qStr && search !== window.location.search)\n ) {\n if (replace) {\n replace({ parameters, search });\n } else if (history) {\n history.replace({ search });\n } else {\n const { hash } = window.location;\n window.history.replaceState(\n undefined,\n undefined,\n `${search}${hash || \"\"}`,\n );\n }\n }\n }\n\n updateLayers() {\n const { isBaseLayer, isLayerHidden, layers } = this.props;\n const { revision } = this.state;\n\n unByKey(this.onPropertyChangeKeys);\n this.onPropertyChangeKeys = getLayersAsFlatArray(layers).map((layer) => {\n return layer.on(\"change:visible\", () => {\n this.setState({ revision: revision + 1 });\n });\n });\n\n // layers param\n let layersParam;\n if (layers.length) {\n layersParam = getLayersAsFlatArray(layers)\n .filter((l) => {\n const children = l.get(\"children\") || l.children || [];\n const allChildrenHidden = children.every((child) => {\n return isLayerHidden(child);\n });\n const hasVisibleChildren = children.some((child) => {\n return child.getVisible ? child.getVisible() : child.visible;\n });\n const isVisible = l.getVisible ? l.getVisible() : l.visible;\n return (\n !isBaseLayer(l) &&\n !isLayerHidden(l) &&\n isVisible &&\n (!hasVisibleChildren || allChildrenHidden)\n );\n })\n .map((l) => {\n return l.key || l.get(\"key\");\n })\n .join();\n }\n\n // baselayers param\n let baseLayersParam;\n const baseLayers = getLayersAsFlatArray(layers).filter(isBaseLayer);\n if (baseLayers.length) {\n // First baselayers in order of visibility, top layer is first\n const visibleBaseLayers = (\n baseLayers.filter((l) => {\n return l.getVisible ? l.getVisible() : l.visible;\n }) || []\n ).reverse();\n const nonVisibleBaseLayers =\n baseLayers.filter((l) => {\n return !(l.getVisible ? l.getVisible() : l.visible);\n }) || [];\n baseLayersParam = [...visibleBaseLayers, ...nonVisibleBaseLayers]\n .sort((a, b) => {\n const aVisible = a.getVisible ? a.getVisible() : a.visible;\n const bVisible = b.getVisible ? b.getVisible() : b.visible;\n if (aVisible === bVisible) {\n return 0;\n }\n if (aVisible && !bVisible) {\n return -1;\n }\n return 1;\n })\n .map((l) => {\n return l.key || l.get(\"key\");\n })\n .join();\n }\n\n // Only add parameters if there is actually some layers added.\n this.setState({\n baselayers: baseLayersParam,\n layers: layersParam,\n });\n }\n}\n\nPermalink.propTypes = propTypes;\nPermalink.defaultProps = defaultProps;\n\nexport default Permalink;\n"],
5
- "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,eAAe;AACtB,SAAS,qBAAqB;AAE9B,OAAO,0BAA0B;AAEjC,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,oBAAoB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,SAAS,UAAU,MAAM;AAAA,IACvB,SAAS,UAAU;AAAA,EACrB,CAAC;AAAA;A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AC,KAChB,cACC,CAAC,sBAAsB;AAAA,MAE5B,CAAC,EACA,IAAI,CAAC,MAAM;AACV,eAAO,EAAE,OAAO,EAAE,IAAI,KAAK;AAAA,MAC7B,CAAC,EACA,KAAK;AAAA,IACV;AAGA,QAAI;AACJ,UAAM,aAAa,qBAAqB,MAAM,EAAE,OAAO,WAAW;AAClE,QAAI,WAAW,QAAQ;AAErB,YAAM,qBACJ,WAAW,OAAO,CAAC,MAAM;AACvB,eAAO,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AAAA,MAC3C,CAAC,KAAK,CAAC,GACP,QAAQ;AACV,YAAM,uBACJ,WAAW,OAAO,CAAC,MAAM;AACvB,eAAO,EAAE,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AAAA,MAC7C,CAAC,KAAK,CAAC;AACT,wBAAkB,CAAC,GAAG,mBAAmB,GAAG,oBAAoB,EAC7D,KAAK,CAAC,GAAG,MAAM;AACd,cAAM,WAAW,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AACnD,cAAM,WAAW,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AACnD,YAAI,aAAa,UAAU;AACzB,iBAAO;AAAA,QACT;AACA,YAAI,YAAY,CAAC,UAAU;AACzB,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,CAAC,EACA,IAAI,CAAC,MAAM;AACV,eAAO,EAAE,OAAO,EAAE,IAAI,KAAK;AAAA,MAC7B,CAAC,EACA,KAAK;AAAA,IACV;AAGA,SAAK,SAAS;AAAA,MACZ,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe;AAEzB,eAAe;",
4
+ "sourcesContent": ["import Layer from \"ol/layer/Layer\";\nimport OLMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport PropTypes from \"prop-types\";\nimport { PureComponent } from \"react\";\n\nimport getLayersAsFlatArray from \"../../utils/getLayersAsFlatArray\";\n\nconst propTypes = {\n /**\n * Maximum number of decimals allowed for coordinates.\n */\n coordinateDecimals: PropTypes.number,\n\n /**\n * Either 'react-router' history object:\n * https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/history.md<br>\n * or default fallback as HTML5 History:\n * https://developer.mozilla.org/en-US/docs/Web/API/History\n */\n history: PropTypes.shape({\n replace: PropTypes.func,\n }),\n\n /**\n * Determine if the layer appears in the baselayers permalink parameter or not.\n *\n * @param {object} item The item to hide or not.\n *\n * @return {bool} true if the item is not displayed in the baselayers permalink parameter\n */\n isBaseLayer: PropTypes.func,\n\n /**\n * Determine if the layer is hidden in the permalink or not.\n *\n * @param {object} item The item to hide or not.\n *\n * @return {bool} true if the item is not displayed in the permalink\n */\n isLayerHidden: PropTypes.func,\n\n /**\n * Layers provider.\n */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)),\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Params to be written in url.\n */\n params: PropTypes.object,\n\n /**\n * Custom function to be called when the permalink is updated.\n * This property has priority over the history parameter and window.history.replaceState calls.\n */\n replace: PropTypes.func,\n};\n\nconst defaultProps = {\n coordinateDecimals: 2,\n history: null,\n isBaseLayer: (layer) => {\n return layer.get(\"isBaseLayer\");\n },\n isLayerHidden: () => {\n return false;\n },\n layers: [],\n map: null,\n params: {},\n replace: null,\n};\n\n/**\n * This component handles permalink logic. Injecting an\n * __[ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)__\n * will add the *map center* (x, y) and the *zoom* (z) parameters to the permalink.\n * Injecting layers will add the *baselayers* and/or *layers* parameters. Further parameters can\n * be added using __params__.\n */\nclass Permalink extends PureComponent {\n constructor(props) {\n super(props);\n this.state = { revision: 0 };\n this.onPropertyChangeKeys = [];\n }\n\n componentDidMount() {\n const { isBaseLayer, isLayerHidden, layers, map } = this.props;\n if (map) {\n this.moveEndRef = map.on(\"moveend\", () => {\n this.onMapMoved();\n });\n }\n\n if (layers) {\n // set layer visibility based on 'layers' parameter.\n const urlParams = new URLSearchParams(window.location.search);\n\n if (urlParams.get(\"layers\")) {\n const visibleLayers = urlParams.get(\"layers\").split(\",\");\n getLayersAsFlatArray(layers).forEach((l) => {\n if (visibleLayers.includes(l.key || l.get(\"key\"))) {\n if (l.setVisible) {\n l.setVisible(true);\n } else {\n l.visible = true;\n }\n } else if (\n !isBaseLayer(l) &&\n !isLayerHidden(l) &&\n !(l.children || l.get(\"children\"))?.some((ll) => {\n return ll.getVisible ? ll.getVisible() : ll.visible;\n })\n ) {\n if (l.setVisible) {\n l.setVisible(false);\n } else {\n l.visible = false;\n }\n }\n });\n }\n\n // Set baser layer visibility based on 'baseLayers' parameter.\n // Show the first of the list then hide the others\n const visibleBaseLayer = (urlParams.get(\"baselayers\") || \"\").split(\n \",\",\n )[0];\n if (visibleBaseLayer) {\n getLayersAsFlatArray(layers)\n .filter(isBaseLayer)\n .forEach((baseLayer) => {\n const key = baseLayer.key || baseLayer.get(\"key\");\n const visible = key === visibleBaseLayer;\n if (baseLayer.setVisible) {\n baseLayer.setVisible(visible);\n } else {\n baseLayer.visible = visible;\n }\n });\n }\n this.updateLayers();\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { layers, map } = this.props;\n const { revision } = this.state;\n\n if (layers !== prevProps.layers || revision !== prevState.revision) {\n this.updateLayers();\n }\n\n if (map !== prevProps.map) {\n unByKey(this.moveEndRef);\n this.moveEndRef = map.on(\"moveend\", () => {\n return this.onMapMoved();\n });\n }\n\n this.updateHistory();\n }\n\n componentWillUnmount() {\n const { map } = this.props;\n\n if (map) {\n unByKey(this.moveEndRef);\n }\n unByKey(this.onPropertyChangeKeys);\n this.onPropertyChangeKeys = [];\n }\n\n onMapMoved() {\n const { map } = this.props;\n const mapView = map.getView();\n const center = mapView.getCenter();\n const params = {};\n\n if (\n center !== undefined &&\n center[0] !== undefined &&\n center[1] !== undefined\n ) {\n params.x = this.roundCoord(center[0]);\n params.y = this.roundCoord(center[1]);\n }\n\n this.setState({\n ...params,\n // rounds zoom to two digits max.\n z: +`${Math.round(`${parseFloat(mapView.getZoom())}e+2`)}e-2`,\n });\n }\n\n render() {\n return null;\n }\n\n roundCoord(val) {\n const { coordinateDecimals } = this.props;\n return parseFloat(val.toFixed(coordinateDecimals));\n }\n\n updateHistory() {\n const { history, params, replace } = this.props;\n const oldParams = new URLSearchParams(window.location.search);\n const parameters = {\n ...Object.fromEntries(oldParams.entries()),\n ...this.state,\n ...params,\n };\n\n delete parameters.revision;\n\n // Remove parameters that are undefined or null\n Object.entries(parameters).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n delete parameters[key];\n }\n });\n\n // We don't encode the , to leave the permalink lisible\n const qStr = new URLSearchParams(parameters)\n .toString()\n .replace(/%2C/g, \",\");\n const search = qStr ? `?${qStr}` : \"\";\n\n if (\n (!qStr && window.location.search) ||\n (qStr && search !== window.location.search)\n ) {\n if (replace) {\n replace({ parameters, search });\n } else if (history) {\n history.replace({ search });\n } else {\n const { hash } = window.location;\n window.history.replaceState(\n undefined,\n undefined,\n `${search}${hash || \"\"}`,\n );\n }\n }\n }\n\n updateLayers() {\n const { isBaseLayer, isLayerHidden, layers } = this.props;\n const { revision } = this.state;\n\n unByKey(this.onPropertyChangeKeys);\n this.onPropertyChangeKeys = getLayersAsFlatArray(layers).map((layer) => {\n return layer.on(\"change:visible\", () => {\n this.setState({ revision: revision + 1 });\n });\n });\n\n // layers param\n let layersParam;\n if (layers.length) {\n layersParam = getLayersAsFlatArray(layers)\n .filter((l) => {\n const children = l.get(\"children\") || l.children || [];\n const allChildrenHidden = children.every((child) => {\n return isLayerHidden(child);\n });\n const hasVisibleChildren = children.some((child) => {\n return child.getVisible ? child.getVisible() : child.visible;\n });\n const isVisible = l.getVisible ? l.getVisible() : l.visible;\n return (\n !isBaseLayer(l) &&\n !isLayerHidden(l) &&\n isVisible &&\n (!hasVisibleChildren || allChildrenHidden)\n );\n })\n .map((l) => {\n return l.key || l.get(\"key\");\n })\n .join();\n }\n\n // baselayers param\n let baseLayersParam;\n const baseLayers = getLayersAsFlatArray(layers).filter(isBaseLayer);\n if (baseLayers.length) {\n // First baselayers in order of visibility, top layer is first\n const visibleBaseLayers = (\n baseLayers.filter((l) => {\n return l.getVisible ? l.getVisible() : l.visible;\n }) || []\n ).reverse();\n const nonVisibleBaseLayers =\n baseLayers.filter((l) => {\n return !(l.getVisible ? l.getVisible() : l.visible);\n }) || [];\n baseLayersParam = [...visibleBaseLayers, ...nonVisibleBaseLayers]\n .sort((a, b) => {\n const aVisible = a.getVisible ? a.getVisible() : a.visible;\n const bVisible = b.getVisible ? b.getVisible() : b.visible;\n if (aVisible === bVisible) {\n return 0;\n }\n if (aVisible && !bVisible) {\n return -1;\n }\n return 1;\n })\n .map((l) => {\n return l.key || l.get(\"key\");\n })\n .join();\n }\n\n // Only add parameters if there is actually some layers added.\n this.setState({\n baselayers: baseLayersParam,\n layers: layersParam,\n });\n }\n}\n\nPermalink.propTypes = propTypes;\nPermalink.defaultProps = defaultProps;\n\nexport default Permalink;\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,eAAe;AACtB,SAAS,qBAAqB;AAE9B,OAAO,0BAA0B;AAEjC,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,oBAAoB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,SAAS,UAAU,MAAM;AAAA,IACvB,SAAS,UAAU;AAAA,EACrB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASD,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASvB,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA,EAKzB,QAAQ,UAAU,QAAQ,UAAU,WAAW,KAAK,CAAC;AAAA;AAAA;AAAA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,QAAI,WAAW,QAAQ;AAErB,YAAM,qBACJ,WAAW,OAAO,CAAC,MAAM;AACvB,eAAO,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AAAA,MAC3C,CAAC,KAAK,CAAC,GACP,QAAQ;AACV,YAAM,uBACJ,WAAW,OAAO,CAAC,MAAM;AACvB,eAAO,EAAE,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AAAA,MAC7C,CAAC,KAAK,CAAC;AACT,wBAAkB,CAAC,GAAG,mBAAmB,GAAG,oBAAoB,EAC7D,KAAK,CAAC,GAAG,MAAM;AACd,cAAM,WAAW,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AACnD,cAAM,WAAW,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE;AACnD,YAAI,aAAa,UAAU;AACzB,iBAAO;AAAA,QACT;AACA,YAAI,YAAY,CAAC,UAAU;AACzB,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,CAAC,EACA,IAAI,CAAC,MAAM;AACV,eAAO,EAAE,OAAO,EAAE,IAAI,KAAK;AAAA,MAC7B,CAAC,EACA,KAAK;AAAA,IACV;AAGA,SAAK,SAAS;AAAA,MACZ,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe;AAEzB,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
1
2
  import { getCenter } from "ol/extent";
2
3
  import Feature from "ol/Feature";
3
4
  import OLMap from "ol/Map";
@@ -94,7 +95,7 @@ class Popup extends PureComponent {
94
95
  this.postrenderKey = null;
95
96
  }
96
97
  static renderCloseButton({ onCloseClick, titles }) {
97
- return /* @__PURE__ */ React.createElement(
98
+ return /* @__PURE__ */ jsx(
98
99
  "div",
99
100
  {
100
101
  "aria-label": titles.closeButton,
@@ -107,14 +108,17 @@ class Popup extends PureComponent {
107
108
  },
108
109
  role: "button",
109
110
  tabIndex: 0,
110
- title: titles.closeButton
111
- },
112
- /* @__PURE__ */ React.createElement(MdClose, { focusable: false })
111
+ title: titles.closeButton,
112
+ children: /* @__PURE__ */ jsx(MdClose, { focusable: false })
113
+ }
113
114
  );
114
115
  }
115
116
  static renderHeader(props) {
116
117
  const { header, renderCloseButton } = props;
117
- return /* @__PURE__ */ React.createElement("div", { className: "rs-popup-header" }, header, (renderCloseButton || Popup.renderCloseButton)(props));
118
+ return /* @__PURE__ */ jsxs("div", { className: "rs-popup-header", children: [
119
+ header,
120
+ (renderCloseButton || Popup.renderCloseButton)(props)
121
+ ] });
118
122
  }
119
123
  componentDidMount() {
120
124
  const { map } = this.props;
@@ -183,7 +187,7 @@ class Popup extends PureComponent {
183
187
  delete other.renderCloseButton;
184
188
  const { left, top } = this.state;
185
189
  const key = feature ? feature.getId() : popupCoordinate.join();
186
- return /* @__PURE__ */ React.createElement(
190
+ return /* @__PURE__ */ jsx(
187
191
  "div",
188
192
  {
189
193
  className: "rs-popup",
@@ -191,22 +195,24 @@ class Popup extends PureComponent {
191
195
  left,
192
196
  top
193
197
  },
194
- ...other
195
- },
196
- /* @__PURE__ */ React.createElement(
197
- "div",
198
- {
199
- className: "rs-popup-container",
200
- key,
201
- ref: (popupElement) => {
202
- this.setState({ popupElement });
198
+ ...other,
199
+ children: /* @__PURE__ */ jsxs(
200
+ "div",
201
+ {
202
+ className: "rs-popup-container",
203
+ ref: (popupElement) => {
204
+ this.setState({ popupElement });
205
+ },
206
+ tabIndex,
207
+ children: [
208
+ (renderHeader || Popup.renderHeader)(this.props),
209
+ /* @__PURE__ */ jsx("div", { className: "rs-popup-body", children }),
210
+ renderFooter(this.props)
211
+ ]
203
212
  },
204
- tabIndex
205
- },
206
- (renderHeader || Popup.renderHeader)(this.props),
207
- /* @__PURE__ */ React.createElement("div", { className: "rs-popup-body" }, children),
208
- renderFooter(this.props)
209
- )
213
+ key
214
+ )
215
+ }
210
216
  );
211
217
  }
212
218
  updatePixelPosition() {
@@ -217,7 +223,7 @@ class Popup extends PureComponent {
217
223
  }
218
224
  if (coord) {
219
225
  const pos = map.getPixelFromCoordinate(coord);
220
- if (pos && pos.length === 2) {
226
+ if (pos?.length === 2) {
221
227
  this.setState({
222
228
  left: pos[0],
223
229
  top: pos[1]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Popup/Popup.js"],
4
- "sourcesContent": ["import { getCenter } from \"ol/extent\";\nimport Feature from \"ol/Feature\";\nimport OLMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport PropTypes from \"prop-types\";\nimport React, { PureComponent } from \"react\";\nimport { MdClose } from \"react-icons/md\";\n\nconst propTypes = {\n /**\n * React Children.\n */\n children: PropTypes.node.isRequired,\n\n /**\n * Class name of the popup.\n */\n className: PropTypes.string,\n\n /**\n * An [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n */\n feature: PropTypes.instanceOf(Feature),\n\n /**\n * Popup title.\n */\n header: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Function triggered on close button click.\n */\n onCloseClick: PropTypes.func,\n\n /**\n * If true, the popup is panned in the map's viewport.\n */\n panIntoView: PropTypes.bool,\n\n /**\n * Custom BoundingClientRect to fit popup into.\n * Use if panIntoView is true. Default is the map's BoundingClientRect.\n */\n panRect: PropTypes.objectOf(PropTypes.number),\n\n /**\n * Coordinate position of the popup.\n */\n popupCoordinate: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Render the close button\n */\n renderCloseButton: PropTypes.func,\n\n /**\n * Render the footer\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render the header\n */\n renderHeader: PropTypes.func,\n\n /**\n * HTML tabIndex attribute.\n */\n tabIndex: PropTypes.string,\n\n /**\n * Title HTML attributes.\n */\n titles: PropTypes.shape({\n closeButton: PropTypes.string,\n }),\n};\n\nconst defaultProps = {\n className: \"rs-popup\",\n feature: null,\n header: null,\n onCloseClick: () => {},\n panIntoView: false,\n panRect: null,\n popupCoordinate: null,\n renderCloseButton: null,\n renderFooter: () => {\n return null;\n },\n renderHeader: null,\n tabIndex: \"\",\n titles: { closeButton: \"Close\" },\n};\n\n/**\n * The Popup component renders a popup over an\n * [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html)\n * on click.\n */\nclass Popup extends PureComponent {\n constructor(props) {\n super(props);\n this.state = {\n left: 0,\n popupElement: null,\n top: 0,\n };\n this.postrenderKey = null;\n }\n\n static renderCloseButton({ onCloseClick, titles }) {\n return (\n <div\n aria-label={titles.closeButton}\n className=\"rs-popup-close-bt\"\n onClick={() => {\n return onCloseClick();\n }}\n onKeyPress={(evt) => {\n return evt.which === 13 && onCloseClick();\n }}\n role=\"button\"\n tabIndex={0}\n title={titles.closeButton}\n >\n <MdClose focusable={false} />\n </div>\n );\n }\n\n static renderHeader(props) {\n const { header, renderCloseButton } = props;\n return (\n <div className=\"rs-popup-header\">\n {header}\n {(renderCloseButton || Popup.renderCloseButton)(props)}\n </div>\n );\n }\n\n componentDidMount() {\n const { map } = this.props;\n this.updatePixelPosition();\n\n this.postrenderKey = map.on(\"postrender\", () => {\n this.updatePixelPosition();\n });\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { feature, panIntoView, popupCoordinate } = this.props;\n const { popupElement } = this.state;\n if (\n feature !== prevProps.feature ||\n popupCoordinate !== prevProps.popupCoordinate\n ) {\n this.updatePixelPosition();\n }\n\n if (\n panIntoView &&\n popupElement &&\n popupElement !== prevState.popupElement\n ) {\n this.panIntoView();\n }\n }\n\n componentWillUnmount() {\n unByKey(this.postrenderKey);\n }\n\n panIntoView() {\n const { map, panRect } = this.props;\n const { popupElement } = this.state;\n\n const mapRect = panRect || map.getTarget().getBoundingClientRect();\n const popupRect = popupElement.getBoundingClientRect();\n const [x, y] = map.getView().getCenter();\n const res = map.getView().getResolution();\n const newCenter = [x, y];\n\n if (mapRect.top > popupRect.top) {\n newCenter[1] = y + (mapRect.top - popupRect.top) * res;\n }\n\n if (mapRect.left > popupRect.left) {\n newCenter[0] = x - (mapRect.left - popupRect.left) * res;\n }\n\n if (mapRect.right < popupRect.right) {\n newCenter[0] = x + (popupRect.right - mapRect.right) * res;\n }\n\n if (mapRect.bottom < popupRect.bottom) {\n newCenter[1] = y - (popupRect.bottom - mapRect.bottom) * res;\n }\n\n if (newCenter[0] !== x || newCenter[1] !== y) {\n map.getView().animate({ center: newCenter, duration: 500 });\n }\n }\n\n render() {\n const {\n children,\n feature,\n header,\n popupCoordinate,\n renderFooter,\n renderHeader,\n tabIndex,\n titles,\n ...other\n } = this.props;\n\n if (!feature && !popupCoordinate) {\n return null;\n }\n\n delete other.panIntoView;\n delete other.panRect;\n delete other.map;\n delete other.header;\n delete other.onCloseClick;\n delete other.renderCloseButton;\n\n const { left, top } = this.state;\n\n // force re-render if the feature or the coordinate changes.\n // this is needed to update the popupElement ref\n const key = feature ? feature.getId() : popupCoordinate.join();\n return (\n <div\n className=\"rs-popup\"\n style={{\n left,\n top,\n }}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n >\n <div\n className=\"rs-popup-container\"\n key={key}\n ref={(popupElement) => {\n this.setState({ popupElement });\n }}\n tabIndex={tabIndex}\n >\n {(renderHeader || Popup.renderHeader)(this.props)}\n <div className=\"rs-popup-body\">{children}</div>\n {renderFooter(this.props)}\n </div>\n </div>\n );\n }\n\n updatePixelPosition() {\n const { feature, map, popupCoordinate } = this.props;\n let coord = popupCoordinate;\n\n if (feature && !coord) {\n coord = getCenter(feature.getGeometry().getExtent());\n }\n\n if (coord) {\n const pos = map.getPixelFromCoordinate(coord);\n\n if (pos && pos.length === 2) {\n this.setState({\n left: pos[0],\n top: pos[1],\n });\n }\n }\n }\n}\n\nPopup.propTypes = propTypes;\nPopup.defaultProps = defaultProps;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M;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AAEb,UAAM,EAAE,MAAM,IAAI,IAAI,KAAK;AAI3B,UAAM,MAAM,UAAU,QAAQ,MAAM,IAAI,gBAAgB,KAAK;AAC7D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF;AAAA,QAEC,GAAG;AAAA;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV;AAAA,UACA,KAAK,CAAC,iBAAiB;AACrB,iBAAK,SAAS,EAAE,aAAa,CAAC;AAAA,UAChC;AAAA,UACA;AAAA;AAAA,SAEE,gBAAgB,MAAM,cAAc,KAAK,KAAK;AAAA,QAChD,oCAAC,SAAI,WAAU,mBAAiB,QAAS;AAAA,QACxC,aAAa,KAAK,KAAK;AAAA,MAC1B;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,sBAAsB;AACpB,UAAM,EAAE,SAAS,KAAK,gBAAgB,IAAI,KAAK;AAC/C,QAAI,QAAQ;AAEZ,QAAI,WAAW,CAAC,OAAO;AACrB,cAAQ,UAAU,QAAQ,YAAY,EAAE,UAAU,CAAC;AAAA,IACrD;AAEA,QAAI,OAAO;AACT,YAAM,MAAM,IAAI,uBAAuB,KAAK;AAE5C,UAAI,OAAO,IAAI,WAAW,GAAG;AAC3B,aAAK,SAAS;AAAA,UACZ,MAAM,IAAI,CAAC;AAAA,UACX,KAAK,IAAI,CAAC;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAEA,MAAM,YAAY;AAClB,MAAM,eAAe;AAErB,eAAe;",
4
+ "sourcesContent": ["import { getCenter } from \"ol/extent\";\nimport Feature from \"ol/Feature\";\nimport OLMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport PropTypes from \"prop-types\";\nimport React, { PureComponent } from \"react\";\nimport { MdClose } from \"react-icons/md\";\n\nconst propTypes = {\n /**\n * React Children.\n */\n children: PropTypes.node.isRequired,\n\n /**\n * Class name of the popup.\n */\n className: PropTypes.string,\n\n /**\n * An [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n */\n feature: PropTypes.instanceOf(Feature),\n\n /**\n * Popup title.\n */\n header: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Function triggered on close button click.\n */\n onCloseClick: PropTypes.func,\n\n /**\n * If true, the popup is panned in the map's viewport.\n */\n panIntoView: PropTypes.bool,\n\n /**\n * Custom BoundingClientRect to fit popup into.\n * Use if panIntoView is true. Default is the map's BoundingClientRect.\n */\n panRect: PropTypes.objectOf(PropTypes.number),\n\n /**\n * Coordinate position of the popup.\n */\n popupCoordinate: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Render the close button\n */\n renderCloseButton: PropTypes.func,\n\n /**\n * Render the footer\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render the header\n */\n renderHeader: PropTypes.func,\n\n /**\n * HTML tabIndex attribute.\n */\n tabIndex: PropTypes.string,\n\n /**\n * Title HTML attributes.\n */\n titles: PropTypes.shape({\n closeButton: PropTypes.string,\n }),\n};\n\nconst defaultProps = {\n className: \"rs-popup\",\n feature: null,\n header: null,\n onCloseClick: () => {},\n panIntoView: false,\n panRect: null,\n popupCoordinate: null,\n renderCloseButton: null,\n renderFooter: () => {\n return null;\n },\n renderHeader: null,\n tabIndex: \"\",\n titles: { closeButton: \"Close\" },\n};\n\n/**\n * The Popup component renders a popup over an\n * [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html)\n * on click.\n */\nclass Popup extends PureComponent {\n constructor(props) {\n super(props);\n this.state = {\n left: 0,\n popupElement: null,\n top: 0,\n };\n this.postrenderKey = null;\n }\n\n static renderCloseButton({ onCloseClick, titles }) {\n return (\n <div\n aria-label={titles.closeButton}\n className=\"rs-popup-close-bt\"\n onClick={() => {\n return onCloseClick();\n }}\n onKeyPress={(evt) => {\n return evt.which === 13 && onCloseClick();\n }}\n role=\"button\"\n tabIndex={0}\n title={titles.closeButton}\n >\n <MdClose focusable={false} />\n </div>\n );\n }\n\n static renderHeader(props) {\n const { header, renderCloseButton } = props;\n return (\n <div className=\"rs-popup-header\">\n {header}\n {(renderCloseButton || Popup.renderCloseButton)(props)}\n </div>\n );\n }\n\n componentDidMount() {\n const { map } = this.props;\n this.updatePixelPosition();\n\n this.postrenderKey = map.on(\"postrender\", () => {\n this.updatePixelPosition();\n });\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { feature, panIntoView, popupCoordinate } = this.props;\n const { popupElement } = this.state;\n if (\n feature !== prevProps.feature ||\n popupCoordinate !== prevProps.popupCoordinate\n ) {\n this.updatePixelPosition();\n }\n\n if (\n panIntoView &&\n popupElement &&\n popupElement !== prevState.popupElement\n ) {\n this.panIntoView();\n }\n }\n\n componentWillUnmount() {\n unByKey(this.postrenderKey);\n }\n\n panIntoView() {\n const { map, panRect } = this.props;\n const { popupElement } = this.state;\n\n const mapRect = panRect || map.getTarget().getBoundingClientRect();\n const popupRect = popupElement.getBoundingClientRect();\n const [x, y] = map.getView().getCenter();\n const res = map.getView().getResolution();\n const newCenter = [x, y];\n\n if (mapRect.top > popupRect.top) {\n newCenter[1] = y + (mapRect.top - popupRect.top) * res;\n }\n\n if (mapRect.left > popupRect.left) {\n newCenter[0] = x - (mapRect.left - popupRect.left) * res;\n }\n\n if (mapRect.right < popupRect.right) {\n newCenter[0] = x + (popupRect.right - mapRect.right) * res;\n }\n\n if (mapRect.bottom < popupRect.bottom) {\n newCenter[1] = y - (popupRect.bottom - mapRect.bottom) * res;\n }\n\n if (newCenter[0] !== x || newCenter[1] !== y) {\n map.getView().animate({ center: newCenter, duration: 500 });\n }\n }\n\n render() {\n const {\n children,\n feature,\n header,\n popupCoordinate,\n renderFooter,\n renderHeader,\n tabIndex,\n titles,\n ...other\n } = this.props;\n\n if (!feature && !popupCoordinate) {\n return null;\n }\n\n delete other.panIntoView;\n delete other.panRect;\n delete other.map;\n delete other.header;\n delete other.onCloseClick;\n delete other.renderCloseButton;\n\n const { left, top } = this.state;\n\n // force re-render if the feature or the coordinate changes.\n // this is needed to update the popupElement ref\n const key = feature ? feature.getId() : popupCoordinate.join();\n return (\n <div\n className=\"rs-popup\"\n style={{\n left,\n top,\n }}\n {...other}\n >\n <div\n className=\"rs-popup-container\"\n key={key}\n ref={(popupElement) => {\n this.setState({ popupElement });\n }}\n tabIndex={tabIndex}\n >\n {(renderHeader || Popup.renderHeader)(this.props)}\n <div className=\"rs-popup-body\">{children}</div>\n {renderFooter(this.props)}\n </div>\n </div>\n );\n }\n\n updatePixelPosition() {\n const { feature, map, popupCoordinate } = this.props;\n let coord = popupCoordinate;\n\n if (feature && !coord) {\n coord = getCenter(feature.getGeometry().getExtent());\n }\n\n if (coord) {\n const pos = map.getPixelFromCoordinate(coord);\n\n if (pos?.length === 2) {\n this.setState({\n left: pos[0],\n top: pos[1],\n });\n }\n }\n }\n}\n\nPopup.propTypes = propTypes;\nPopup.defaultProps = defaultProps;\n\nexport default Popup;\n"],
5
+ "mappings": "AAmIQ,cAQF,YARE;AAnIR,SAAS,iBAAiB;AAC1B,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,eAAe;AACtB,OAAO,SAAS,qBAAqB;AACrC,SAAS,eAAe;AAExB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,UAAU,UAAU,KAAK;AAAA;AAAA;AAAA;AAAA,EAKzB,WAAW,UAAU;AAAA;AAAA;AAAA;AAAA,EAKrB,SAAS,UAAU,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA,EAKrC,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA,EAKjE,KA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M,cAAc,KAAK,KAAK;AAAA,cAChD,oBAAC,SAAI,WAAU,iBAAiB,UAAS;AAAA,cACxC,aAAa,KAAK,KAAK;AAAA;AAAA;AAAA,UARnB;AAAA,QASP;AAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,sBAAsB;AACpB,UAAM,EAAE,SAAS,KAAK,gBAAgB,IAAI,KAAK;AAC/C,QAAI,QAAQ;AAEZ,QAAI,WAAW,CAAC,OAAO;AACrB,cAAQ,UAAU,QAAQ,YAAY,EAAE,UAAU,CAAC;AAAA,IACrD;AAEA,QAAI,OAAO;AACT,YAAM,MAAM,IAAI,uBAAuB,KAAK;AAE5C,UAAI,KAAK,WAAW,GAAG;AACrB,aAAK,SAAS;AAAA,UACZ,MAAM,IAAI,CAAC;AAAA,UACX,KAAK,IAAI,CAAC;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAEA,MAAM,YAAY;AAClB,MAAM,eAAe;AAErB,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/ResizeHandler/ResizeHandler.js"],
4
- "sourcesContent": ["import PropTypes from \"prop-types\";\nimport { Component, PureComponent } from \"react\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\nconst propTypes = {\n // This property is used to re-apply the classes, for example when the className of the observed node changes.\n forceUpdate: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.number,\n PropTypes.bool,\n ]),\n maxHeightBrkpts: PropTypes.objectOf(PropTypes.number),\n maxWidthBrkpts: PropTypes.objectOf(PropTypes.number),\n observe: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.node,\n PropTypes.instanceOf(Component),\n PropTypes.shape({ current: PropTypes.node }),\n PropTypes.shape({ current: PropTypes.instanceOf(Component) }),\n ]),\n onResize: PropTypes.func,\n\n stylePropHeight: PropTypes.string,\n};\n\n// Same as bootstrap\nconst defaultProps = {\n forceUpdate: null,\n /* eslint-disable perfectionist/sort-objects */\n maxHeightBrkpts: {\n xs: 576,\n s: 768,\n m: 992,\n l: 1200,\n xl: Infinity,\n },\n maxWidthBrkpts: {\n xs: 576,\n s: 768,\n m: 992,\n l: 1200,\n xl: Infinity,\n },\n /* eslint-enable perfectionist/sort-objects */\n observe: null,\n onResize: null,\n stylePropHeight: null,\n};\n/**\n * This component adds css class to an element depending on his size.\n */\nclass ResizeHandler extends PureComponent {\n constructor(props) {\n super(props);\n this.observer = new ResizeObserver((entries) => {\n return this.onResize(entries);\n });\n this.nodes = [];\n }\n\n static applyBreakpoints(entry, breakpoints, size, direction) {\n let found = false;\n let screenSize;\n Object.entries(breakpoints).forEach((brkpt) => {\n const cssClass = `rs-${direction}-${brkpt[0]}`;\n entry.target.classList.remove(cssClass);\n if (!found && size <= brkpt[1]) {\n found = true;\n [screenSize] = brkpt;\n entry.target.classList.add(cssClass);\n }\n });\n return screenSize;\n }\n\n componentDidMount() {\n this.observe();\n }\n\n componentDidUpdate(prevProps) {\n const { forceUpdate, observe } = this.props;\n\n if (\n observe !== prevProps.observe ||\n forceUpdate !== prevProps.forceUpdate\n ) {\n this.observe();\n }\n }\n\n componentWillUnmount() {\n this.observer.disconnect();\n }\n\n observe() {\n this.observer.disconnect();\n const { observe } = this.props;\n\n if (!observe) {\n return;\n }\n\n if (typeof observe === \"string\" || observe instanceof String) {\n this.nodes = document.querySelectorAll(observe);\n } else if (observe instanceof Component) {\n // eslint-disable-next-line no-console\n console.warn(\n \"observe attribute as a Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component.\",\n );\n // eslint-disable-next-line react/no-find-dom-node\n // this.nodes.push(ReactDOM.findDOMNode(observe));\n } else if (observe instanceof Element) {\n this.nodes.push(observe);\n } else if (observe.current instanceof Element) {\n // observe value created with React.createRef() on a html node.\n this.nodes.push(observe.current);\n } else if (observe.current instanceof Component) {\n // eslint-disable-next-line no-console\n console.warn(\n \"observe attribute as a ref to Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component.\",\n );\n // observe value created with React.createRef() on a React component.\n // eslint-disable-next-line react/no-find-dom-node\n // this.nodes.push(ReactDOM.findDOMNode(observe.current));\n }\n\n if (this.nodes.length) {\n this.nodes.forEach((node) => {\n return this.observer.observe(node);\n });\n }\n }\n\n onResize(entries) {\n const { maxHeightBrkpts, maxWidthBrkpts, onResize, stylePropHeight } =\n this.props;\n\n if (stylePropHeight) {\n const vh = window.innerHeight * 0.01;\n document.documentElement.style.setProperty(stylePropHeight, `${vh}px`);\n }\n\n if (!maxWidthBrkpts && !maxHeightBrkpts) {\n onResize(entries);\n return;\n }\n\n let newScreenWidth;\n let newScreenHeight;\n\n for (let i = 0; i < entries.length; i += 1) {\n const entry = entries[i];\n const rect = entry.contentRect;\n const { height, width } = rect;\n\n if (maxWidthBrkpts) {\n newScreenWidth = ResizeHandler.applyBreakpoints(\n entry,\n maxWidthBrkpts,\n width,\n \"w\",\n );\n }\n if (maxHeightBrkpts) {\n newScreenHeight = ResizeHandler.applyBreakpoints(\n entry,\n maxHeightBrkpts,\n height,\n \"h\",\n );\n }\n }\n\n if (onResize) {\n onResize(entries, newScreenWidth, newScreenHeight);\n }\n }\n\n render() {\n return null;\n }\n}\n\nResizeHandler.propTypes = propTypes;\nResizeHandler.defaultProps = defaultProps;\n\nexport default ResizeHandler;\n"],
4
+ "sourcesContent": ["import PropTypes from \"prop-types\";\nimport { Component, PureComponent } from \"react\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\nconst propTypes = {\n // This property is used to re-apply the classes, for example when the className of the observed node changes.\n forceUpdate: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.number,\n PropTypes.bool,\n ]),\n maxHeightBrkpts: PropTypes.objectOf(PropTypes.number),\n maxWidthBrkpts: PropTypes.objectOf(PropTypes.number),\n observe: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.node,\n PropTypes.instanceOf(Component),\n PropTypes.shape({ current: PropTypes.node }),\n PropTypes.shape({ current: PropTypes.instanceOf(Component) }),\n ]),\n onResize: PropTypes.func,\n\n stylePropHeight: PropTypes.string,\n};\n\n// Same as bootstrap\nconst defaultProps = {\n forceUpdate: null,\n /* eslint-disable perfectionist/sort-objects */\n maxHeightBrkpts: {\n xs: 576,\n s: 768,\n m: 992,\n l: 1200,\n xl: Infinity,\n },\n maxWidthBrkpts: {\n xs: 576,\n s: 768,\n m: 992,\n l: 1200,\n xl: Infinity,\n },\n /* eslint-enable perfectionist/sort-objects */\n observe: null,\n onResize: null,\n stylePropHeight: null,\n};\n/**\n * This component adds css class to an element depending on his size.\n */\nclass ResizeHandler extends PureComponent {\n constructor(props) {\n super(props);\n this.observer = new ResizeObserver((entries) => {\n return this.onResize(entries);\n });\n this.nodes = [];\n }\n\n static applyBreakpoints(entry, breakpoints, size, direction) {\n let found = false;\n let screenSize;\n Object.entries(breakpoints).forEach((brkpt) => {\n const cssClass = `rs-${direction}-${brkpt[0]}`;\n entry.target.classList.remove(cssClass);\n if (!found && size <= brkpt[1]) {\n found = true;\n [screenSize] = brkpt;\n entry.target.classList.add(cssClass);\n }\n });\n return screenSize;\n }\n\n componentDidMount() {\n this.observe();\n }\n\n componentDidUpdate(prevProps) {\n const { forceUpdate, observe } = this.props;\n\n if (\n observe !== prevProps.observe ||\n forceUpdate !== prevProps.forceUpdate\n ) {\n this.observe();\n }\n }\n\n componentWillUnmount() {\n this.observer.disconnect();\n }\n\n observe() {\n this.observer.disconnect();\n const { observe } = this.props;\n\n if (!observe) {\n return;\n }\n\n if (typeof observe === \"string\" || observe instanceof String) {\n this.nodes = document.querySelectorAll(observe);\n } else if (observe instanceof Component) {\n // eslint-disable-next-line no-console\n console.warn(\n \"observe attribute as a Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component.\",\n );\n\n // this.nodes.push(ReactDOM.findDOMNode(observe));\n } else if (observe instanceof Element) {\n this.nodes.push(observe);\n } else if (observe.current instanceof Element) {\n // observe value created with React.createRef() on a html node.\n this.nodes.push(observe.current);\n } else if (observe.current instanceof Component) {\n // eslint-disable-next-line no-console\n console.warn(\n \"observe attribute as a ref to Component is deprecated: Please use React.createRef() or React.useRef() instead of a React component.\",\n );\n // observe value created with React.createRef() on a React component.\n\n // this.nodes.push(ReactDOM.findDOMNode(observe.current));\n }\n\n if (this.nodes.length) {\n this.nodes.forEach((node) => {\n return this.observer.observe(node);\n });\n }\n }\n\n onResize(entries) {\n const { maxHeightBrkpts, maxWidthBrkpts, onResize, stylePropHeight } =\n this.props;\n\n if (stylePropHeight) {\n const vh = window.innerHeight * 0.01;\n document.documentElement.style.setProperty(stylePropHeight, `${vh}px`);\n }\n\n if (!maxWidthBrkpts && !maxHeightBrkpts) {\n onResize(entries);\n return;\n }\n\n let newScreenWidth;\n let newScreenHeight;\n\n for (let i = 0; i < entries.length; i += 1) {\n const entry = entries[i];\n const rect = entry.contentRect;\n const { height, width } = rect;\n\n if (maxWidthBrkpts) {\n newScreenWidth = ResizeHandler.applyBreakpoints(\n entry,\n maxWidthBrkpts,\n width,\n \"w\",\n );\n }\n if (maxHeightBrkpts) {\n newScreenHeight = ResizeHandler.applyBreakpoints(\n entry,\n maxHeightBrkpts,\n height,\n \"h\",\n );\n }\n }\n\n if (onResize) {\n onResize(entries, newScreenWidth, newScreenHeight);\n }\n }\n\n render() {\n return null;\n }\n}\n\nResizeHandler.propTypes = propTypes;\nResizeHandler.defaultProps = defaultProps;\n\nexport default ResizeHandler;\n"],
5
5
  "mappings": "AAAA,OAAO,eAAe;AACtB,SAAS,WAAW,qBAAqB;AACzC,OAAO,oBAAoB;AAE3B,MAAM,YAAY;AAAA;AAAA,EAEhB,aAAa,UAAU,UAAU;AAAA,IAC/B,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,EACZ,CAAC;AAAA,EACD,iBAAiB,UAAU,SAAS,UAAU,MAAM;AAAA,EACpD,gBAAgB,UAAU,SAAS,UAAU,MAAM;AAAA,EACnD,SAAS,UAAU,UAAU;AAAA,IAC3B,UAAU;AAAA,IACV,UAA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