@defra/forms-engine-plugin 5.0.0-alpha.27 → 5.0.0-alpha.29
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.
- package/.public/37c964ca545c240f010a.mjs +2 -0
- package/.public/37c964ca545c240f010a.mjs.LICENSE.txt +4 -0
- package/.public/assets-manifest.json +3 -0
- package/.public/javascripts/shared.min.js +1 -1
- package/.public/javascripts/shared.min.js.LICENSE.txt +2 -0
- package/.public/javascripts/shared.min.js.map +1 -1
- package/.public/javascripts/vendor/@defra.min.js +1 -1
- package/.public/javascripts/vendor/@defra.min.js.map +1 -1
- package/.public/javascripts/vendor/maplibre-gl.min.js +1 -1
- package/.public/javascripts/vendor/maplibre-gl.min.js.LICENSE.txt +3 -3
- package/.public/javascripts/vendor/maplibre-gl.min.js.map +1 -1
- package/.public/stylesheets/application.min.css +1 -1
- package/.public/stylesheets/application.min.css.map +1 -1
- package/.server/client/javascripts/geospatial-map.js +3 -3
- package/.server/client/javascripts/geospatial-map.js.map +1 -1
- package/.server/client/javascripts/location-map.js +2 -2
- package/.server/client/javascripts/location-map.js.map +1 -1
- package/.server/client/javascripts/map.d.ts +5 -2
- package/.server/client/javascripts/map.js +17 -5
- package/.server/client/javascripts/map.js.map +1 -1
- package/.server/server/plugins/engine/components/AutocompleteField.d.ts +1 -2
- package/.server/server/plugins/engine/components/AutocompleteField.js +9 -4
- package/.server/server/plugins/engine/components/AutocompleteField.js.map +1 -1
- package/.server/server/plugins/engine/components/CheckboxesField.d.ts +2 -2
- package/.server/server/plugins/engine/components/CheckboxesField.js.map +1 -1
- package/.server/server/plugins/engine/components/ComponentBase.d.ts +1 -1
- package/.server/server/plugins/engine/components/ComponentBase.js.map +1 -1
- package/.server/server/plugins/engine/components/DeclarationField.d.ts +2 -2
- package/.server/server/plugins/engine/components/DeclarationField.js.map +1 -1
- package/.server/server/plugins/engine/components/FileUploadField.d.ts +2 -2
- package/.server/server/plugins/engine/components/FileUploadField.js.map +1 -1
- package/.server/server/plugins/engine/components/ListFormComponent.d.ts +2 -2
- package/.server/server/plugins/engine/components/ListFormComponent.js.map +1 -1
- package/.server/server/plugins/engine/components/LocationFieldBase.js +11 -6
- package/.server/server/plugins/engine/components/LocationFieldBase.js.map +1 -1
- package/.server/server/plugins/engine/components/NumberField.js +14 -8
- package/.server/server/plugins/engine/components/NumberField.js.map +1 -1
- package/.server/server/plugins/engine/components/YesNoField.d.ts +1 -3
- package/.server/server/plugins/engine/components/YesNoField.js +9 -4
- package/.server/server/plugins/engine/components/YesNoField.js.map +1 -1
- package/.server/server/plugins/engine/components/helpers/index.d.ts +14 -1
- package/.server/server/plugins/engine/components/helpers/index.js +32 -0
- package/.server/server/plugins/engine/components/helpers/index.js.map +1 -1
- package/package.json +6 -6
- package/src/client/javascripts/geospatial-map.js +3 -3
- package/src/client/javascripts/location-map.js +2 -2
- package/src/client/javascripts/map.js +19 -8
- package/src/server/plugins/engine/components/AutocompleteField.ts +12 -5
- package/src/server/plugins/engine/components/CheckboxesField.ts +3 -3
- package/src/server/plugins/engine/components/ComponentBase.ts +4 -4
- package/src/server/plugins/engine/components/DeclarationField.ts +3 -4
- package/src/server/plugins/engine/components/FileUploadField.ts +2 -2
- package/src/server/plugins/engine/components/ListFormComponent.ts +4 -4
- package/src/server/plugins/engine/components/LocationFieldBase.ts +18 -8
- package/src/server/plugins/engine/components/NumberField.ts +17 -13
- package/src/server/plugins/engine/components/YesNoField.ts +14 -4
- package/src/server/plugins/engine/components/helpers/index.ts +45 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @ts-expect-error - no types
|
|
2
2
|
import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets';
|
|
3
3
|
// @ts-expect-error - no types
|
|
4
|
-
import createDrawPlugin from '@defra/interactive-map/plugins/draw
|
|
4
|
+
import createDrawPlugin from '@defra/interactive-map/plugins/draw';
|
|
5
5
|
import { bbox } from '@turf/bbox';
|
|
6
6
|
import { DEFAULT_LANG, ENGLISH_LANG, WELSH_LANG } from "./map-constants.js";
|
|
7
|
-
import { EVENTS, createMap,
|
|
7
|
+
import { EVENTS, createMap, getCentroidGridRef, getCoordinateGridRef, getDefaultConfig, getMapCountryLayers, getMapLayers } from "./map.js";
|
|
8
8
|
import sssiDataset from "./sssi-dataset.js";
|
|
9
9
|
import { formatDelimtedList } from "./utils.js";
|
|
10
10
|
import cy from "../../server/plugins/engine/i18n/translations/cy.json" with { type: 'json' };
|
|
@@ -193,7 +193,7 @@ export function processGeospatial(config, geospatial, index) {
|
|
|
193
193
|
}));
|
|
194
194
|
}
|
|
195
195
|
const initConfig = {
|
|
196
|
-
...
|
|
196
|
+
...getDefaultConfig(),
|
|
197
197
|
bounds,
|
|
198
198
|
plugins
|
|
199
199
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geospatial-map.js","names":["createDatasetsPlugin","createDrawPlugin","bbox","DEFAULT_LANG","ENGLISH_LANG","WELSH_LANG","EVENTS","createMap","defaultConfig","getCentroidGridRef","getCoordinateGridRef","getMapCountryLayers","getMapLayers","sssiDataset","formatDelimtedList","cy","type","enGB","englishTranslations","components","geospatialField","map","welshTranslations","languageTexts","getTexts","lang","helpPanelConfig","focus","showLabel","mobile","slot","open","dismissible","modal","tablet","desktop","getLineOrShapeText","texts","allowLine","allowShape","lineOrShapeText","lineText","shapeText","getAllowedTypesPhrase","allowPoint","items","push","typesPhrasePoint","typesPhraseLine","typesPhraseShape","typesPhraseOr","getTypeDescription","feature","typeDescriptions","geometry","point","line","polygon","getHelpPanelHtml","point3","allowedTypesText","ledeIntro","ledeOutro","point1","point2","point4","lineFeatureProperties","stroke","fill","strokeWidth","polygonFeatureProperties","POINT_SVG","POLYGON_SVG","LINE_SVG","getGeoJSON","geospatialInput","value","trim","hasValue","features","JSON","parse","geojson","getBoundingBox","processGeospatial","config","geospatial","index","HTMLDivElement","querySelector","HTMLTextAreaElement","listEl","mapId","createContainers","bounds","length","undefined","drawPlugin","plugins","country","dataset","mapLayers","maplayers","datasets","apiPath","includes","initConfig","interactPlugin","featuresManager","getFeaturesManager","activeFeatureManager","getActiveFeatureManager","geometryTypes","geometrytypes","options","uiManager","getUIManager","languageManager","context","addEventListeners","addFeatureToMap","addFeature","addMarker","id","coordinates","createFeaturesHTML","disabled","readonly","createFeatureHTML","join","focusFeature","mapProvider","fitBounds","flattened","flat","points","i","slice","p","description","properties","changeAction","itemUpdateLink","itemVisuallyHidden","deleteAction","itemDeleteLink","focusAction","itemFocusLink","links","actions","typeDescription","itemLabel1","itemLabel2","details","summary","centroidGridReference","firstPointGridReference","coordinateGridReference","detailedCoordinates","generateID","window","crypto","randomUUID","activeFeature","getActiveFeature","setActiveFeature","resetActiveFeature","prepareGeometry","maxPrecision","formatPrecision","toFixed","forEach","getFeatures","getFeature","find","f","updateFeature","removeFeature","idx","findIndex","splice","getListRenderer","renderValue","renderList","html","innerHTML","getValueRenderer","stringify","getAllowableGeometryTypes","split","toggleActionButtons","hidden","types","toggleButtonState","focusDescriptionInput","inputs","querySelectorAll","lastInput","item","select","on","mapReady","onMapReadyFactory","mapEl","document","createElement","setAttribute","listId","after","classList","add","onMapReady","e","addPanel","label","helpPanel","addButton","variant","buttons","iconSvgContent","onClick","enable","newPolygon","newLine","drawReady","onDrawReadyFactory","drawCreated","onDrawCreatedFactory","drawEdited","onDrawEditedFactory","drawCancelled","onDrawCancelledFactory","interactMarkerChange","onInteractMarkerChangedFactory","addEventListener","onListElClickFactory","onListElChangeFactory","onListElKeydownFactory","onDrawReady","onDrawCreated","onDrawEdited","changedFeature","featureId","onDrawCancelled","onInteractMarkerChange","activeFeatureId","coords","removeMarker","disable","deleteFeature","editFeature","selectFeature","target","HTMLElement","preventDefault","stopPropagation","tagName","action","HTMLInputElement","code"],"sources":["../../../src/client/javascripts/geospatial-map.js"],"sourcesContent":["// @ts-expect-error - no types\nimport createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'\n// @ts-expect-error - no types\nimport createDrawPlugin from '@defra/interactive-map/plugins/draw-ml'\nimport { bbox } from '@turf/bbox'\n\nimport {\n DEFAULT_LANG,\n ENGLISH_LANG,\n WELSH_LANG\n} from '~/src/client/javascripts/map-constants.js'\nimport {\n EVENTS,\n createMap,\n defaultConfig,\n getCentroidGridRef,\n getCoordinateGridRef,\n getMapCountryLayers,\n getMapLayers\n} from '~/src/client/javascripts/map.js'\nimport sssiDataset from '~/src/client/javascripts/sssi-dataset.js'\nimport { formatDelimtedList } from '~/src/client/javascripts/utils.js'\nimport cy from '~/src/server/plugins/engine/i18n/translations/cy.json' with { type: 'json' }\nimport enGB from '~/src/server/plugins/engine/i18n/translations/en-GB.json' with { type: 'json' }\n\nconst englishTranslations = enGB.components.geospatialField.map\nconst welshTranslations = cy.components.geospatialField.map\n\n/**\n * @type {Record<LanguageCode, GeospatialLanguageTexts>}\n */\nexport const languageTexts = {\n [ENGLISH_LANG]: englishTranslations,\n [WELSH_LANG]: welshTranslations\n}\n\n/**\n * Get the map texts for the given language code\n * @param {LanguageCode} lang - the lanugae code\n */\nexport function getTexts(lang = DEFAULT_LANG) {\n return languageTexts[lang]\n}\n\nconst helpPanelConfig = {\n focus: false,\n showLabel: true,\n mobile: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n tablet: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n desktop: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n }\n}\n\n/**\n * @param {GeospatialPanelTexts} texts\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nfunction getLineOrShapeText(texts, allowLine, allowShape) {\n if (allowLine && allowShape) {\n return texts.lineOrShapeText\n }\n if (allowLine) {\n return texts.lineText\n }\n if (allowShape) {\n return texts.shapeText\n }\n return ''\n}\n\n/**\n * @param {GeospatialPanelTexts} texts\n * @param {boolean} allowPoint\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nfunction getAllowedTypesPhrase(texts, allowPoint, allowLine, allowShape) {\n const items = []\n\n if (allowPoint) {\n items.push(texts.typesPhrasePoint)\n }\n if (allowLine) {\n items.push(texts.typesPhraseLine)\n }\n if (allowShape) {\n items.push(texts.typesPhraseShape)\n }\n\n return formatDelimtedList(items, ',', texts.typesPhraseOr)\n}\n\n/**\n * Gets the type description for a given feature\n * @param {Feature} feature - the geojson feature\n * @param {GeometryTexts} typeDescriptions\n */\nfunction getTypeDescription(feature, typeDescriptions) {\n switch (feature.geometry.type) {\n case 'Point':\n return typeDescriptions.point\n case 'LineString':\n return typeDescriptions.line\n case 'Polygon':\n return typeDescriptions.polygon\n }\n}\n\n/**\n * @param {GeospatialPanelTexts} texts\n * @param {boolean} allowPoint\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nexport function getHelpPanelHtml(texts, allowPoint, allowLine, allowShape) {\n const lineOrShapeText = getLineOrShapeText(texts, allowLine, allowShape)\n const point3 = lineOrShapeText\n ? `<li>${texts.point3} ${lineOrShapeText}</li>`\n : ''\n const allowedTypesText = getAllowedTypesPhrase(\n texts,\n allowPoint,\n allowLine,\n allowShape\n )\n return `<p class=\"govuk-body-s govuk-!-margin-bottom-2\">${texts.ledeIntro} ${allowedTypesText} ${texts.ledeOutro}</p><ul class=\"govuk-list govuk-list--number govuk-body-s\"><li>${texts.point1}</li><li>${texts.point2}</li>${point3}<li>${texts.point4}</li></ul>`\n}\n\nconst lineFeatureProperties = {\n stroke: 'rgba(0, 11, 112, 1)',\n fill: 'rgba(0, 11, 112, 0.2)',\n strokeWidth: 2\n}\n\nconst polygonFeatureProperties = {\n stroke: 'rgb(0, 0, 0)',\n fill: 'rgba(255, 221, 0, 0.2)',\n strokeWidth: 2\n}\n\nconst POINT_SVG =\n '<path d=\"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0\" /><circle cx=\"12\" cy=\"10\" r=\"3\" />'\nconst POLYGON_SVG =\n '<path d=\"M19.5 7v10M4.5 7v10M7 19.5h10M7 4.5h10\"/><path d=\"M22 18v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm0-15v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 18v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 3v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1z\"/>'\nconst LINE_SVG =\n '<path d=\"M5.706 16.294L16.294 5.706\"/><path d=\"M21 2v3c0 .549-.451 1-1 1h-3c-.549 0-1-.451-1-1V2c0-.549.451-1 1-1h3c.549 0 1 .451 1 1zM6 17v3c0 .549-.451 1-1 1H2c-.549 0-1-.451-1-1v-3c0-.549.451-1 1-1h3c.549 0 1 .451 1 1z\"/>'\n\n/**\n * Extract and parses the GeoJSON from the textarea\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n */\nexport function getGeoJSON(geospatialInput) {\n const value = geospatialInput.value.trim()\n const hasValue = !!value\n\n /** @type {FeatureCollection} */\n const features = hasValue ? JSON.parse(value) : []\n\n /** @type {GeoJSON} */\n const geojson = {\n type: 'FeatureCollection',\n features\n }\n\n return geojson\n}\n\n/**\n * Gets the bounding box covering a feature collection\n * @param {GeoJSON} geojson - the geojson\n */\nexport function getBoundingBox(geojson) {\n return bbox(geojson)\n}\n\n/**\n * Processes a geospatial field to add map capability\n * @param {MapsEnvironmentConfig} config - the geospatial field element\n * @param {Element} geospatial - the geospatial field element\n * @param {number} index - the 0-based index\n */\nexport function processGeospatial(config, geospatial, index) {\n if (!(geospatial instanceof HTMLDivElement)) {\n return\n }\n\n const geospatialInput = geospatial.querySelector('.govuk-textarea')\n if (!(geospatialInput instanceof HTMLTextAreaElement)) {\n return\n }\n\n const { listEl, mapId } = createContainers(geospatialInput, index)\n const geojson = getGeoJSON(geospatialInput)\n const bounds = geojson.features.length ? getBoundingBox(geojson) : undefined\n const drawPlugin = createDrawPlugin()\n const plugins = [drawPlugin]\n const country = geospatial.dataset.country\n const mapLayers = getMapLayers(geospatial.dataset.maplayers)\n const datasets = getMapCountryLayers(config.apiPath, country)\n\n if (mapLayers.includes('sssi')) {\n datasets.push(...sssiDataset)\n }\n\n // Create a map dataset plugin if there are any present\n if (datasets.length) {\n plugins.push(createDatasetsPlugin({ datasets }))\n }\n\n const initConfig = {\n ...defaultConfig,\n bounds,\n plugins\n }\n\n const { map, interactPlugin } = createMap(mapId, initConfig, config)\n const featuresManager = getFeaturesManager(geojson)\n const activeFeatureManager = getActiveFeatureManager()\n const geometryTypes = geospatial.dataset.geometrytypes\n const options = {\n geometryTypes\n }\n const lang = /** @type {LanguageCode} */ (\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n geospatial.dataset.lang || DEFAULT_LANG\n )\n const uiManager = getUIManager(\n geojson,\n map,\n mapId,\n listEl,\n geospatialInput,\n options,\n lang\n )\n\n const languageManager = {\n lang,\n texts: getTexts(lang)\n }\n\n /**\n * @type {Context}\n */\n const context = {\n languageManager,\n map,\n featuresManager,\n activeFeatureManager,\n uiManager,\n interactPlugin,\n drawPlugin\n }\n\n addEventListeners(context)\n}\n\n/**\n * Adds a feature to the map\n * @param {Feature} feature - the geojson feature\n * @param {any} drawPlugin - the map draw plugin\n * @param {InteractiveMap} map - the interactive map\n */\nexport function addFeatureToMap(feature, drawPlugin, map) {\n switch (feature.geometry.type) {\n case 'Polygon':\n drawPlugin.addFeature({ ...feature, ...polygonFeatureProperties })\n break\n case 'LineString':\n drawPlugin.addFeature({ ...feature, ...lineFeatureProperties })\n break\n case 'Point':\n map.addMarker(feature.id, feature.geometry.coordinates)\n break\n default:\n break\n }\n}\n\n/**\n * Returns HTML summary list for the features\n * @param {FeatureCollection} features - the features\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list in readonly mode\n * @param {LanguageCode} [lang] - the language for the feature details\n */\nexport function createFeaturesHTML(\n features,\n mapId,\n disabled = false,\n readonly = false,\n lang = DEFAULT_LANG\n) {\n return `<dl class=\"govuk-summary-list\">\n ${features.map((feature, index) => createFeatureHTML(feature, index, mapId, disabled, readonly, lang)).join('\\n')}\n </dl>`\n}\n\n/**\n * Focus feature\n * @param {Feature} feature - the feature\n * @param {MapLibreMap} mapProvider - the feature id\n */\nexport function focusFeature(feature, mapProvider) {\n mapProvider.fitBounds(bbox(feature))\n}\n\n/**\n * Returns HTML summary row for an single feature\n * @param {Feature} feature - the geo feature\n * @param {number} index - the feature index\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list item in readonly mode\n * @param {LanguageCode} [lang] - the language for the feature details\n */\nexport function createFeatureHTML(\n feature,\n index,\n mapId,\n disabled = false,\n readonly = false,\n lang = DEFAULT_LANG\n) {\n const texts = getTexts(lang)\n const flattened = feature.geometry.coordinates.flat(2)\n\n const points = []\n for (let i = 0; i < flattened.length; i += 2) {\n points.push(flattened.slice(i, i + 2).join(', '))\n }\n const coordinates = points.map((p) => `<li>${p}</li>`).join('')\n\n const description = readonly\n ? `<p class=\"govuk-body govuk-!-margin-bottom-0\">${feature.properties.description}</p>`\n : `<input class=\"govuk-input govuk-!-width-two-thirds\" type=\"text\" id=\"description_${index}\" value=\"${feature.properties.description}\" data-id=\"${feature.id}\">`\n\n // Change action link\n const changeAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#${mapId}\" data-action=\"edit\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">${texts.itemUpdateLink}<span class=\"govuk-visually-hidden\"> ${texts.itemVisuallyHidden}</span></a>\n</li>`\n\n // Delete action link\n const deleteAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#\" data-action=\"delete\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">${texts.itemDeleteLink}<span class=\"govuk-visually-hidden\"> ${texts.itemVisuallyHidden}</span></a>\n</li>`\n\n // Focus action link\n const focusAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state\" href=\"#${mapId}\" data-action=\"focus\" data-id=\"${feature.id}\">${texts.itemFocusLink}<span class=\"govuk-visually-hidden\"> ${texts.itemVisuallyHidden}</span></a>\n</li>`\n\n const links = readonly ? focusAction() : `${changeAction()}${deleteAction()}`\n const actions = `<ul class=\"govuk-summary-list__actions-list\">${links}</ul>`\n const typeDescription = getTypeDescription(feature, texts.typeDescriptions)\n\n return `<div class=\"govuk-summary-list__row govuk-summary-list__row--no-border\">\n <dt class=\"govuk-summary-list__key\">\n <div class=\"govuk-form-group\">\n <label class=\"govuk-label govuk-label--s\" ${readonly ? '' : `for=\"description_${index}\"`}>${texts.itemLabel1} ${index + 1} ${texts.itemLabel2}</label>\n ${description}\n </div>\n </dt>\n <dd class=\"govuk-summary-list__actions\">\n ${actions}\n </dd>\n</div>\n<div class=\"govuk-summary-list__row\">\n <details class=\"govuk-details govuk-!-margin-bottom-2\">\n <summary class=\"govuk-details__summary\">\n <span class=\"govuk-details__summary-text\">${texts.details.summary}</span>\n </summary>\n <div class=\"govuk-details__text\">\n <dl class=\"govuk-summary-list\">\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.type}</dt>\n <dd class=\"govuk-summary-list__value\">${typeDescription}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.centroidGridReference}</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.centroidGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.firstPointGridReference}</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.coordinateGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.detailedCoordinates}</dt>\n <dd class=\"govuk-summary-list__value\">\n <ol class=\"govuk-list govuk-list--number\">${coordinates}</ol>\n </dd>\n </div>\n </dl>\n </div>\n </details>\n</div>`\n}\n\n/**\n * Generate a random id\n */\nfunction generateID() {\n return window.crypto.randomUUID()\n}\n\n/**\n * Factory closure to track the active feature id\n * @returns {ActiveFeatureManager}\n */\nfunction getActiveFeatureManager() {\n /** @type {string | undefined} */\n let activeFeature\n\n /**\n * Returns the active feature id\n * @type {GetActiveFeature}\n */\n function getActiveFeature() {\n return activeFeature\n }\n\n /**\n * Sets the active feature id\n * @type {SetActiveFeature}\n */\n function setActiveFeature(id) {\n activeFeature = id\n }\n\n /**\n * Resets the active feature id\n * @type {ResetActiveFeature}\n */\n function resetActiveFeature() {\n activeFeature = undefined\n }\n\n return {\n getActiveFeature,\n setActiveFeature,\n resetActiveFeature\n }\n}\n\n/**\n * Reduce coordinate precision to 7 dps\n * @param {Feature} feature\n */\nfunction prepareGeometry(feature) {\n const { geometry } = feature\n const maxPrecision = 7\n\n /**\n * @param {Coordinates} coordinates\n */\n function formatPrecision(coordinates) {\n coordinates[0] = +coordinates[0].toFixed(maxPrecision)\n coordinates[1] = +coordinates[1].toFixed(maxPrecision)\n }\n\n if (geometry.type === 'Point') {\n formatPrecision(geometry.coordinates)\n } else if (geometry.type === 'LineString') {\n geometry.coordinates.forEach(formatPrecision)\n } else {\n geometry.coordinates.flat().forEach(formatPrecision)\n }\n}\n\n/**\n * Factory closure to return a features manager\n * @param {GeoJSON} geojson\n * @returns {FeaturesManager}\n */\nexport function getFeaturesManager(geojson) {\n /**\n * Get a feature from the geojson by id\n * @type {GetFeatures}\n */\n function getFeatures() {\n return geojson.features\n }\n\n /**\n * Get a feature from the geojson by id\n * @type {GetFeature}\n */\n function getFeature(id) {\n return geojson.features.find((f) => f.id === id)\n }\n\n /**\n * Add a feature to the geojson\n * @type {AddFeature}\n */\n function addFeature(feature) {\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n prepareGeometry(feature)\n\n geojson.features.push(feature)\n }\n\n /**\n * Updates a feature in the geojson\n * @type {UpdateFeature}\n */\n function updateFeature(id, geometry) {\n const feature = getFeature(id)\n\n // Ensure the feature exists in the geojson\n if (feature) {\n feature.geometry = geometry\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n prepareGeometry(feature)\n }\n\n return feature\n }\n\n /**\n * Removes a feature from the geojson\n * @type {RemoveFeature}\n */\n function removeFeature(id) {\n const idx = geojson.features.findIndex((f) => f.id === id)\n\n return idx > -1 ? geojson.features.splice(idx, 1) : undefined\n }\n\n return {\n getFeatures,\n getFeature,\n addFeature,\n updateFeature,\n removeFeature\n }\n}\n\n/**\n * Factory to render features into the list and hidden textarea\n * @param {GeoJSON} geojson - the geojson of features\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {Function} renderValue - function that renders the features JSON into the hidden textarea\n * @param {LanguageCode} [lang] - the language for the feature details\n * @returns {RenderList}\n */\nfunction getListRenderer(\n geojson,\n mapId,\n listEl,\n renderValue,\n lang = DEFAULT_LANG\n) {\n return function renderList(disabled = false) {\n const html = createFeaturesHTML(\n geojson.features,\n mapId,\n disabled,\n false,\n lang\n )\n\n listEl.innerHTML = html\n\n renderValue()\n }\n}\n\n/**\n * Factory to render features JSON into the hidden textarea\n * @param {GeoJSON} geojson - the features\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n * @returns {RenderValue}\n */\nfunction getValueRenderer(geojson, geospatialInput) {\n return function renderValue() {\n geospatialInput.value = JSON.stringify(geojson.features, null, 2)\n }\n}\n\n/**\n * Factory closure to manage the UI\n * @param {GeoJSON} geojson - the features\n * @param {InteractiveMap} map - the map\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n * @param { UIManagerOptions | undefined } options - extra options such as allowable geometry types\n * @param {LanguageCode} [lang] - the language for the feature details\n */\nexport function getUIManager(\n geojson,\n map,\n mapId,\n listEl,\n geospatialInput,\n options,\n lang = DEFAULT_LANG\n) {\n /**\n * Get a CSV list of geometry types the user can create\n * @returns {string[]}\n */\n function getAllowableGeometryTypes() {\n return options?.geometryTypes\n ? options.geometryTypes.split(',')\n : ['point', 'line', 'shape']\n }\n\n /**\n * Toggle the hidden state of the action buttons\n * @type {ToggleActionButtons}\n */\n function toggleActionButtons(hidden) {\n const types = getAllowableGeometryTypes()\n if (types.includes('point')) {\n map.toggleButtonState('btnAddPoint', 'hidden', hidden)\n }\n if (types.includes('shape')) {\n map.toggleButtonState('btnAddPolygon', 'hidden', hidden)\n }\n if (types.includes('line')) {\n map.toggleButtonState('btnAddLine', 'hidden', hidden)\n }\n }\n\n /**\n * Set focus to the last description input\n * @type {FocusDescriptionInput}\n */\n function focusDescriptionInput() {\n const inputs = listEl.querySelectorAll('input')\n if (inputs.length) {\n const lastInput = /** @type {HTMLInputElement} */ inputs.item(\n inputs.length - 1\n )\n lastInput.focus()\n lastInput.select()\n }\n }\n\n const renderValue = getValueRenderer(geojson, geospatialInput)\n const renderList = getListRenderer(geojson, mapId, listEl, renderValue, lang)\n\n /** @type {UIManager} */\n return {\n renderList,\n renderValue,\n listEl,\n toggleActionButtons,\n focusDescriptionInput,\n getAllowableGeometryTypes\n }\n}\n\n/**\n * Setup the UI event listeners\n * @param {Context} context - the context\n */\nfunction addEventListeners(context) {\n const { map } = context\n\n map.on(EVENTS.mapReady, onMapReadyFactory(context))\n}\n\n/**\n * Create the map and list containers and adds them to the DOM\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n * @param {number} index - the 0 based index\n */\nfunction createContainers(geospatialInput, index) {\n const mapEl = document.createElement('div')\n const mapId = `geospatialmap_${index}`\n\n mapEl.setAttribute('id', mapId)\n mapEl.setAttribute('class', 'map-container')\n\n const listEl = document.createElement('div')\n const listId = `${mapId}_list`\n listEl.setAttribute('id', listId)\n\n geospatialInput.after(mapEl)\n mapEl.after(listEl)\n geospatialInput.classList.add('js-hidden')\n\n return { mapEl, listEl, mapId }\n}\n\n/**\n * Callback factory function which fires when the map is ready\n * @param {Context} context - the UI context\n */\nfunction onMapReadyFactory(context) {\n const { map, activeFeatureManager, uiManager, interactPlugin, drawPlugin } =\n context\n const { toggleActionButtons, renderList, getAllowableGeometryTypes } =\n uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback function which fires when the map is ready\n * @param {object} e - the event\n * @param {MapLibreMap} e.map - the map provider instance\n */\n return function onMapReady(e) {\n const types = getAllowableGeometryTypes()\n const allowPoint = types.includes('point')\n const allowLine = types.includes('line')\n const allowShape = types.includes('shape')\n const { texts } = context.languageManager\n\n // Add info panel\n map.addPanel('info', {\n ...helpPanelConfig,\n label: texts.helpPanel.label,\n html: getHelpPanelHtml(texts.helpPanel, allowPoint, allowLine, allowShape)\n })\n\n if (allowPoint) {\n map.addButton('btnAddPoint', {\n variant: 'tertiary',\n label: texts.buttons.point,\n iconSvgContent: POINT_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n interactPlugin.enable()\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n if (allowShape) {\n map.addButton('btnAddPolygon', {\n variant: 'tertiary',\n label: texts.buttons.polygon,\n iconSvgContent: POLYGON_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newPolygon(generateID(), polygonFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n if (allowLine) {\n map.addButton('btnAddLine', {\n variant: 'tertiary',\n label: texts.buttons.line,\n iconSvgContent: LINE_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newLine(generateID(), lineFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n // Set the map provider on the context\n context.mapProvider = e.map\n\n map.on(EVENTS.drawReady, onDrawReadyFactory(context))\n map.on(EVENTS.drawCreated, onDrawCreatedFactory(context))\n map.on(EVENTS.drawEdited, onDrawEditedFactory(context))\n map.on(EVENTS.drawCancelled, onDrawCancelledFactory(context))\n map.on(EVENTS.interactMarkerChange, onInteractMarkerChangedFactory(context))\n\n const { listEl } = uiManager\n listEl.addEventListener('click', onListElClickFactory(context), false)\n listEl.addEventListener('change', onListElChangeFactory(context), false)\n listEl.addEventListener('keydown', onListElKeydownFactory(), false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin is ready\n * @param {Context} context - the UI context\n */\nfunction onDrawReadyFactory(context) {\n const { featuresManager, uiManager, drawPlugin, map } = context\n const { renderList } = uiManager\n const { getFeatures } = featuresManager\n\n /**\n * Callback when the draw plugin is ready\n */\n return function onDrawReady() {\n getFeatures().forEach((feature) =>\n addFeatureToMap(feature, drawPlugin, map)\n )\n\n // Update the features\n renderList()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin creates a new feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCreatedFactory(context) {\n const { featuresManager, uiManager } = context\n const { addFeature } = featuresManager\n const { renderList, toggleActionButtons, focusDescriptionInput } = uiManager\n\n /**\n * Callback when a draw feature has been created\n * @param {Feature} e\n */\n return function onDrawCreated(e) {\n // New feature\n addFeature({\n ...e,\n properties: {\n description: ''\n }\n })\n\n // Update the features\n renderList()\n toggleActionButtons(false)\n focusDescriptionInput()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin edits a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawEditedFactory(context) {\n const { featuresManager, activeFeatureManager, uiManager } = context\n const { updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Callback when a draw feature has been edited\n * @param {{ id: string, geometry: Geometry }} e\n */\n return function onDrawEdited(e) {\n const changedFeature = e\n const featureId = changedFeature.id\n\n if (getActiveFeature() === featureId) {\n updateFeature(featureId, changedFeature.geometry)\n\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin cancels the editing of a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCancelledFactory(context) {\n const { uiManager, activeFeatureManager } = context\n const { toggleActionButtons, renderList } = uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback when a draw feature has been cancelled\n */\n return function onDrawCancelled() {\n toggleActionButtons(false)\n resetActiveFeature()\n renderList()\n }\n}\n\n/**\n * Callback factory function that fires when an interact marker has been changed\n * @param {Context} context - the UI context\n */\nfunction onInteractMarkerChangedFactory(context) {\n const {\n featuresManager,\n activeFeatureManager,\n map,\n interactPlugin,\n uiManager\n } = context\n const { addFeature, updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, focusDescriptionInput, toggleActionButtons } = uiManager\n\n /**\n * Callback when an interact marker has been changed\n * @param {{ coords: Coordinates }} e\n */\n return function onInteractMarkerChange(e) {\n const activeFeatureId = getActiveFeature()\n\n if (activeFeatureId) {\n // Editing an existing point\n const feature = updateFeature(activeFeatureId, {\n type: 'Point',\n coordinates: e.coords\n })\n\n map.addMarker(activeFeatureId, e.coords)\n\n if (feature) {\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n } else {\n // Adding a new point\n const id = generateID()\n addFeature({\n type: 'Feature',\n properties: {\n description: ''\n },\n geometry: {\n type: 'Point',\n coordinates: e.coords\n },\n id\n })\n\n map.addMarker(id, e.coords)\n\n // Update the features\n renderList()\n\n focusDescriptionInput()\n }\n map.removeMarker('location')\n\n interactPlugin.disable()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function that fires a 'click' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElClickFactory(context) {\n const {\n map,\n mapProvider,\n featuresManager,\n activeFeatureManager,\n interactPlugin,\n uiManager,\n drawPlugin\n } = context\n const { getFeature, removeFeature } = featuresManager\n const { getActiveFeature, setActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Delete a feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function deleteFeature(id, type) {\n if (type === 'Point') {\n map.removeMarker(id)\n removeFeature(id)\n } else {\n drawPlugin.deleteFeature(id)\n removeFeature(id)\n }\n\n renderList()\n }\n\n /**\n * Start editing feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function editFeature(id, type) {\n setActiveFeature(id)\n\n // \"Change\" feature link was clicked\n if (type === 'Point') {\n interactPlugin.selectFeature({ featureId: id })\n interactPlugin.enable()\n } else {\n drawPlugin.editFeature(id)\n }\n\n const feature = getFeature(id)\n if (feature && mapProvider) {\n focusFeature(feature, mapProvider)\n }\n\n toggleActionButtons(true)\n renderList(true)\n }\n\n /**\n * List container delegated 'click' events handler\n * @param {MouseEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n if (getActiveFeature()) {\n e.preventDefault()\n e.stopPropagation()\n return\n }\n\n if (\n target.tagName === 'A' &&\n target.dataset.action &&\n target.dataset.id &&\n target.dataset.type\n ) {\n const { action, id, type } = target.dataset\n\n if (action === 'edit') {\n // \"Update\" feature link was clicked\n editFeature(id, type)\n } else {\n e.preventDefault()\n e.stopPropagation()\n\n if (action === 'delete') {\n // \"Remove\" feature link was clicked\n deleteFeature(id, type)\n }\n }\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'change' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElChangeFactory(context) {\n const { featuresManager, uiManager } = context\n const { getFeature } = featuresManager\n const { renderValue } = uiManager\n\n /**\n * List container delegated 'change' events handler\n * Used to update the description of features\n * @param {Event} e\n */\n return function (e) {\n e.preventDefault()\n e.stopPropagation()\n\n const target = e.target\n if (!(target instanceof HTMLInputElement) || !target.dataset.id) {\n return\n }\n\n const { id } = target.dataset\n const feature = getFeature(id)\n\n if (feature) {\n feature.properties.description = target.value.trim()\n renderValue()\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'keydown' event is fired on the list container\n */\nfunction onListElKeydownFactory() {\n /**\n * List container delegated 'keydown' events handler\n * Fixes the issue of pressing \"Enter\" key in the description input triggering the map search\n * @param {KeyboardEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLInputElement)) {\n return\n }\n\n if (e.code === 'Enter' || e.code === 'NumpadEnter') {\n e.preventDefault()\n e.stopPropagation()\n }\n }\n}\n\n/**\n * @import { MapsEnvironmentConfig, InteractiveMap } from '~/src/client/javascripts/map.js'\n */\n\n/**\n * @import { Geometry, FeatureCollection, Feature, Coordinates } from '~/src/server/plugins/engine/types.js'\n */\n\n/**\n * @typedef {object} GeoJSON\n * @property {'FeatureCollection'} type - the GeoJSON type string\n * @property {FeatureCollection} features - the features\n */\n\n/**\n * Gets all the features\n * @callback GetFeatures\n * @returns {FeatureCollection}\n */\n\n/**\n * Gets a feature from the geojson by id\n * @callback GetFeature\n * @param {string} id - the feature id\n * @returns {Feature | undefined}\n */\n\n/**\n * Add a feature to the geojson\n * @callback AddFeature\n * @param {Feature} feature - the feature to add\n */\n\n/**\n * Update a feature in the geojson\n * @callback UpdateFeature\n * @param {string} id - the feature id\n * @param {Geometry} geometry - the feature geometry\n * @returns {Feature | undefined}\n */\n\n/**\n * Removes a feature from the geojson\n * @callback RemoveFeature\n * @param {string} id - the feature id\n */\n\n/**\n * Gets the active feature id\n * @callback GetActiveFeature\n * @returns {string | undefined}\n */\n\n/**\n * Set the active feature id\n * @callback SetActiveFeature\n * @param {string} id - the feature id\n * @returns {void}\n */\n\n/**\n * Resets the active feature id\n * @callback ResetActiveFeature\n * @returns {void}\n */\n\n/**\n * Renders the features into the list\n * @callback RenderList\n * @param {boolean} [disabled] - whether to render the list with disabled links\n * @param {LanguageCode} [lang] - the language for the feature details\n * @returns {void}\n */\n\n/**\n * Renders the features JSON into the hidden textarea\n * @callback RenderValue\n * @returns {void}\n */\n\n/**\n * Toggles the action button hidden state\n * @callback ToggleActionButtons\n * @param {boolean} hidden - whether to hide the action buttons\n * @returns {void}\n */\n\n/**\n * Returns the list of geometry types a user can create\n * @callback GetAllowableGeometryTypes\n * @returns {string[]}\n */\n\n/**\n * Set focus to the last description input\n * @callback FocusDescriptionInput\n * @returns {void}\n */\n\n/**\n * @typedef {object} FeaturesManager\n * @property {GetFeatures} getFeatures - function that gets all the features\n * @property {GetFeature} getFeature - function that gets a feature from the geojson\n * @property {AddFeature} addFeature - function that adds feature to the geojson\n * @property {UpdateFeature} updateFeature - function that updates a feature in the geojson\n * @property {RemoveFeature} removeFeature - function that removes a feature from the geojson\n */\n\n/**\n * @typedef {object} ActiveFeatureManager\n * @property {GetActiveFeature} getActiveFeature - function that returns the current active feature id\n * @property {SetActiveFeature} setActiveFeature - function that sets the current active feature id\n * @property {ResetActiveFeature} resetActiveFeature - function that resets the current active feature id\n */\n\n/**\n * @typedef {object} UIManager\n * @property {RenderValue} renderValue - function that renders the features JSON into the hidden textarea\n * @property {RenderList} renderList - function that renders the features into the list\n * @property {HTMLDivElement} listEl - the summary list of features\n * @property {ToggleActionButtons} toggleActionButtons - function that toggles the action buttons\n * @property {FocusDescriptionInput} focusDescriptionInput - function that sets focus to a description input element\n * @property {GetAllowableGeometryTypes} getAllowableGeometryTypes - function that returns the array of geometry types a user can create\n */\n\n/**\n * @typedef {object} GeometryTexts\n * @property {string} point - the label for a point feature in the list\n * @property {string} line - the label for a line string feature in the list\n * @property {string} polygon - the label for a polygon feature in the list\n */\n\n/**\n * @typedef {object} GeospatialPanelTexts\n * @property {string} label - the label for the info panel\n * @property {string} ledeIntro - the lede intro text for the info panel\n * @property {string} ledeOutro - the lede outro text for the info panel\n * @property {string} lineText - the label for the info panel line text\n * @property {string} shapeText - the label for the info panel shape text\n * @property {string} point1 - the text for bullet point 1 in the info panel\n * @property {string} point2 - the text for bullet point 2 in the info panel\n * @property {string} point3 - the text for bullet point 3 in the info panel\n * @property {string} point4 - the text for bullet point 4 in the info panel\n * @property {string} lineOrShapeText - the label for the info panel line or shape text\n * @property {string} typesPhrasePoint - the label for the info panel types phrase point\n * @property {string} typesPhraseLine - the label for the info panel types phrase line\n * @property {string} typesPhraseShape - the label for the info panel types phrase shape\n * @property {string} typesPhraseOr - the label for the info panel types phrase \"or\"\n */\n\n/**\n * @typedef {object} GeospatialLanguageTexts\n * @property {GeometryTexts} typeDescriptions - the descriptions of the geometry types\n * @property {GeospatialPanelTexts} helpPanel - texts for the info panel\n * @property {GeometryTexts} buttons - the labels for the action buttons\n * @property {string} itemLabel1 - the first part of the label for a feature in the list\n * @property {string} itemLabel2 - the second part of the label for a feature in the list\n * @property {string} itemUpdateLink - the label for the \"update\" link for a feature in the list\n * @property {string} itemDeleteLink - the label for the \"delete\" link for a feature in the list\n * @property {string} itemFocusLink - the label for the \"focus\" link for a feature in the list\n * @property {string} itemVisuallyHidden - visually hidden text to add context to action links\n * @property {object} details - labels for the details section of a feature in the list\n * @property {string} details.summary - label for the summary of a feature in the list\n * @property {string} details.type - label for the type of a feature in the list\n * @property {string} details.centroidGridReference - label for the centroid grid reference of a feature in the list\n * @property {string} details.firstPointGridReference - label for the first point grid reference of a feature in the list\n * @property {string} details.detailedCoordinates - label for the detailed coordinates of a feature in the list\n */\n\n/**\n * @typedef {object} LanguageManager\n * @property {LanguageCode} lang - the language for the interactive map\n * @property {GeospatialLanguageTexts} texts - the descriptions of the geometry types\n */\n\n/**\n * @typedef {object} Context\n * @property {LanguageManager} languageManager - the language manager for the interactive map\n * @property {InteractiveMap} map - the interactive map\n * @property {MapLibreMap} [mapProvider] - the interactive map provider\n * @property {FeaturesManager} featuresManager - the features manager\n * @property {ActiveFeatureManager} activeFeatureManager - the active feature manager\n * @property {UIManager} uiManager - the UI manager\n * @property {any} interactPlugin - the map interact plugin\n * @property {any} drawPlugin - the map draw plugin\n */\n\n/**\n * @import { LanguageCode } from '~/src/client/javascripts/map.js'\n * @import { MapLibreMap, UIManagerOptions } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA;AACA,OAAOA,oBAAoB,MAAM,yCAAyC;AAC1E;AACA,OAAOC,gBAAgB,MAAM,wCAAwC;AACrE,SAASC,IAAI,QAAQ,YAAY;AAEjC,SACEC,YAAY,EACZC,YAAY,EACZC,UAAU;AAEZ,SACEC,MAAM,EACNC,SAAS,EACTC,aAAa,EACbC,kBAAkB,EAClBC,oBAAoB,EACpBC,mBAAmB,EACnBC,YAAY;AAEd,OAAOC,WAAW;AAClB,SAASC,kBAAkB;AAC3B,OAAOC,EAAE,qEAAqEC,IAAI,EAAE,MAAM;AAC1F,OAAOC,IAAI,wEAAwED,IAAI,EAAE,MAAM;AAE/F,MAAME,mBAAmB,GAAGD,IAAI,CAACE,UAAU,CAACC,eAAe,CAACC,GAAG;AAC/D,MAAMC,iBAAiB,GAAGP,EAAE,CAACI,UAAU,CAACC,eAAe,CAACC,GAAG;;AAE3D;AACA;AACA;AACA,OAAO,MAAME,aAAa,GAAG;EAC3B,CAACnB,YAAY,GAAGc,mBAAmB;EACnC,CAACb,UAAU,GAAGiB;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASE,QAAQA,CAACC,IAAI,GAAGtB,YAAY,EAAE;EAC5C,OAAOoB,aAAa,CAACE,IAAI,CAAC;AAC5B;AAEA,MAAMC,eAAe,GAAG;EACtBC,KAAK,EAAE,KAAK;EACZC,SAAS,EAAE,IAAI;EACfC,MAAM,EAAE;IACNC,IAAI,EAAE,QAAQ;IACdC,IAA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AK,OAAO,IAAI/C,CAAC,CAAC+C,IAAI,KAAK,aAAa,EAAE;MAClD/C,CAAC,CAAC0C,cAAc,CAAC,CAAC;MAClB1C,CAAC,CAAC2C,eAAe,CAAC,CAAC;IACrB;EACF,CAAC;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"geospatial-map.js","names":["createDatasetsPlugin","createDrawPlugin","bbox","DEFAULT_LANG","ENGLISH_LANG","WELSH_LANG","EVENTS","createMap","getCentroidGridRef","getCoordinateGridRef","getDefaultConfig","getMapCountryLayers","getMapLayers","sssiDataset","formatDelimtedList","cy","type","enGB","englishTranslations","components","geospatialField","map","welshTranslations","languageTexts","getTexts","lang","helpPanelConfig","focus","showLabel","mobile","slot","open","dismissible","modal","tablet","desktop","getLineOrShapeText","texts","allowLine","allowShape","lineOrShapeText","lineText","shapeText","getAllowedTypesPhrase","allowPoint","items","push","typesPhrasePoint","typesPhraseLine","typesPhraseShape","typesPhraseOr","getTypeDescription","feature","typeDescriptions","geometry","point","line","polygon","getHelpPanelHtml","point3","allowedTypesText","ledeIntro","ledeOutro","point1","point2","point4","lineFeatureProperties","stroke","fill","strokeWidth","polygonFeatureProperties","POINT_SVG","POLYGON_SVG","LINE_SVG","getGeoJSON","geospatialInput","value","trim","hasValue","features","JSON","parse","geojson","getBoundingBox","processGeospatial","config","geospatial","index","HTMLDivElement","querySelector","HTMLTextAreaElement","listEl","mapId","createContainers","bounds","length","undefined","drawPlugin","plugins","country","dataset","mapLayers","maplayers","datasets","apiPath","includes","initConfig","interactPlugin","featuresManager","getFeaturesManager","activeFeatureManager","getActiveFeatureManager","geometryTypes","geometrytypes","options","uiManager","getUIManager","languageManager","context","addEventListeners","addFeatureToMap","addFeature","addMarker","id","coordinates","createFeaturesHTML","disabled","readonly","createFeatureHTML","join","focusFeature","mapProvider","fitBounds","flattened","flat","points","i","slice","p","description","properties","changeAction","itemUpdateLink","itemVisuallyHidden","deleteAction","itemDeleteLink","focusAction","itemFocusLink","links","actions","typeDescription","itemLabel1","itemLabel2","details","summary","centroidGridReference","firstPointGridReference","coordinateGridReference","detailedCoordinates","generateID","window","crypto","randomUUID","activeFeature","getActiveFeature","setActiveFeature","resetActiveFeature","prepareGeometry","maxPrecision","formatPrecision","toFixed","forEach","getFeatures","getFeature","find","f","updateFeature","removeFeature","idx","findIndex","splice","getListRenderer","renderValue","renderList","html","innerHTML","getValueRenderer","stringify","getAllowableGeometryTypes","split","toggleActionButtons","hidden","types","toggleButtonState","focusDescriptionInput","inputs","querySelectorAll","lastInput","item","select","on","mapReady","onMapReadyFactory","mapEl","document","createElement","setAttribute","listId","after","classList","add","onMapReady","e","addPanel","label","helpPanel","addButton","variant","buttons","iconSvgContent","onClick","enable","newPolygon","newLine","drawReady","onDrawReadyFactory","drawCreated","onDrawCreatedFactory","drawEdited","onDrawEditedFactory","drawCancelled","onDrawCancelledFactory","interactMarkerChange","onInteractMarkerChangedFactory","addEventListener","onListElClickFactory","onListElChangeFactory","onListElKeydownFactory","onDrawReady","onDrawCreated","onDrawEdited","changedFeature","featureId","onDrawCancelled","onInteractMarkerChange","activeFeatureId","coords","removeMarker","disable","deleteFeature","editFeature","selectFeature","target","HTMLElement","preventDefault","stopPropagation","tagName","action","HTMLInputElement","code"],"sources":["../../../src/client/javascripts/geospatial-map.js"],"sourcesContent":["// @ts-expect-error - no types\nimport createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'\n// @ts-expect-error - no types\nimport createDrawPlugin from '@defra/interactive-map/plugins/draw'\nimport { bbox } from '@turf/bbox'\n\nimport {\n DEFAULT_LANG,\n ENGLISH_LANG,\n WELSH_LANG\n} from '~/src/client/javascripts/map-constants.js'\nimport {\n EVENTS,\n createMap,\n getCentroidGridRef,\n getCoordinateGridRef,\n getDefaultConfig,\n getMapCountryLayers,\n getMapLayers\n} from '~/src/client/javascripts/map.js'\nimport sssiDataset from '~/src/client/javascripts/sssi-dataset.js'\nimport { formatDelimtedList } from '~/src/client/javascripts/utils.js'\nimport cy from '~/src/server/plugins/engine/i18n/translations/cy.json' with { type: 'json' }\nimport enGB from '~/src/server/plugins/engine/i18n/translations/en-GB.json' with { type: 'json' }\n\nconst englishTranslations = enGB.components.geospatialField.map\nconst welshTranslations = cy.components.geospatialField.map\n\n/**\n * @type {Record<LanguageCode, GeospatialLanguageTexts>}\n */\nexport const languageTexts = {\n [ENGLISH_LANG]: englishTranslations,\n [WELSH_LANG]: welshTranslations\n}\n\n/**\n * Get the map texts for the given language code\n * @param {LanguageCode} lang - the lanugae code\n */\nexport function getTexts(lang = DEFAULT_LANG) {\n return languageTexts[lang]\n}\n\nconst helpPanelConfig = {\n focus: false,\n showLabel: true,\n mobile: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n tablet: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n desktop: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n }\n}\n\n/**\n * @param {GeospatialPanelTexts} texts\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nfunction getLineOrShapeText(texts, allowLine, allowShape) {\n if (allowLine && allowShape) {\n return texts.lineOrShapeText\n }\n if (allowLine) {\n return texts.lineText\n }\n if (allowShape) {\n return texts.shapeText\n }\n return ''\n}\n\n/**\n * @param {GeospatialPanelTexts} texts\n * @param {boolean} allowPoint\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nfunction getAllowedTypesPhrase(texts, allowPoint, allowLine, allowShape) {\n const items = []\n\n if (allowPoint) {\n items.push(texts.typesPhrasePoint)\n }\n if (allowLine) {\n items.push(texts.typesPhraseLine)\n }\n if (allowShape) {\n items.push(texts.typesPhraseShape)\n }\n\n return formatDelimtedList(items, ',', texts.typesPhraseOr)\n}\n\n/**\n * Gets the type description for a given feature\n * @param {Feature} feature - the geojson feature\n * @param {GeometryTexts} typeDescriptions\n */\nfunction getTypeDescription(feature, typeDescriptions) {\n switch (feature.geometry.type) {\n case 'Point':\n return typeDescriptions.point\n case 'LineString':\n return typeDescriptions.line\n case 'Polygon':\n return typeDescriptions.polygon\n }\n}\n\n/**\n * @param {GeospatialPanelTexts} texts\n * @param {boolean} allowPoint\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nexport function getHelpPanelHtml(texts, allowPoint, allowLine, allowShape) {\n const lineOrShapeText = getLineOrShapeText(texts, allowLine, allowShape)\n const point3 = lineOrShapeText\n ? `<li>${texts.point3} ${lineOrShapeText}</li>`\n : ''\n const allowedTypesText = getAllowedTypesPhrase(\n texts,\n allowPoint,\n allowLine,\n allowShape\n )\n return `<p class=\"govuk-body-s govuk-!-margin-bottom-2\">${texts.ledeIntro} ${allowedTypesText} ${texts.ledeOutro}</p><ul class=\"govuk-list govuk-list--number govuk-body-s\"><li>${texts.point1}</li><li>${texts.point2}</li>${point3}<li>${texts.point4}</li></ul>`\n}\n\nconst lineFeatureProperties = {\n stroke: 'rgba(0, 11, 112, 1)',\n fill: 'rgba(0, 11, 112, 0.2)',\n strokeWidth: 2\n}\n\nconst polygonFeatureProperties = {\n stroke: 'rgb(0, 0, 0)',\n fill: 'rgba(255, 221, 0, 0.2)',\n strokeWidth: 2\n}\n\nconst POINT_SVG =\n '<path d=\"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0\" /><circle cx=\"12\" cy=\"10\" r=\"3\" />'\nconst POLYGON_SVG =\n '<path d=\"M19.5 7v10M4.5 7v10M7 19.5h10M7 4.5h10\"/><path d=\"M22 18v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm0-15v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 18v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 3v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1z\"/>'\nconst LINE_SVG =\n '<path d=\"M5.706 16.294L16.294 5.706\"/><path d=\"M21 2v3c0 .549-.451 1-1 1h-3c-.549 0-1-.451-1-1V2c0-.549.451-1 1-1h3c.549 0 1 .451 1 1zM6 17v3c0 .549-.451 1-1 1H2c-.549 0-1-.451-1-1v-3c0-.549.451-1 1-1h3c.549 0 1 .451 1 1z\"/>'\n\n/**\n * Extract and parses the GeoJSON from the textarea\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n */\nexport function getGeoJSON(geospatialInput) {\n const value = geospatialInput.value.trim()\n const hasValue = !!value\n\n /** @type {FeatureCollection} */\n const features = hasValue ? JSON.parse(value) : []\n\n /** @type {GeoJSON} */\n const geojson = {\n type: 'FeatureCollection',\n features\n }\n\n return geojson\n}\n\n/**\n * Gets the bounding box covering a feature collection\n * @param {GeoJSON} geojson - the geojson\n */\nexport function getBoundingBox(geojson) {\n return bbox(geojson)\n}\n\n/**\n * Processes a geospatial field to add map capability\n * @param {MapsEnvironmentConfig} config - the geospatial field element\n * @param {Element} geospatial - the geospatial field element\n * @param {number} index - the 0-based index\n */\nexport function processGeospatial(config, geospatial, index) {\n if (!(geospatial instanceof HTMLDivElement)) {\n return\n }\n\n const geospatialInput = geospatial.querySelector('.govuk-textarea')\n if (!(geospatialInput instanceof HTMLTextAreaElement)) {\n return\n }\n\n const { listEl, mapId } = createContainers(geospatialInput, index)\n const geojson = getGeoJSON(geospatialInput)\n const bounds = geojson.features.length ? getBoundingBox(geojson) : undefined\n const drawPlugin = createDrawPlugin()\n const plugins = [drawPlugin]\n const country = geospatial.dataset.country\n const mapLayers = getMapLayers(geospatial.dataset.maplayers)\n const datasets = getMapCountryLayers(config.apiPath, country)\n\n if (mapLayers.includes('sssi')) {\n datasets.push(...sssiDataset)\n }\n\n // Create a map dataset plugin if there are any present\n if (datasets.length) {\n plugins.push(createDatasetsPlugin({ datasets }))\n }\n\n const initConfig = {\n ...getDefaultConfig(),\n bounds,\n plugins\n }\n\n const { map, interactPlugin } = createMap(mapId, initConfig, config)\n const featuresManager = getFeaturesManager(geojson)\n const activeFeatureManager = getActiveFeatureManager()\n const geometryTypes = geospatial.dataset.geometrytypes\n const options = {\n geometryTypes\n }\n const lang = /** @type {LanguageCode} */ (\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n geospatial.dataset.lang || DEFAULT_LANG\n )\n const uiManager = getUIManager(\n geojson,\n map,\n mapId,\n listEl,\n geospatialInput,\n options,\n lang\n )\n\n const languageManager = {\n lang,\n texts: getTexts(lang)\n }\n\n /**\n * @type {Context}\n */\n const context = {\n languageManager,\n map,\n featuresManager,\n activeFeatureManager,\n uiManager,\n interactPlugin,\n drawPlugin\n }\n\n addEventListeners(context)\n}\n\n/**\n * Adds a feature to the map\n * @param {Feature} feature - the geojson feature\n * @param {any} drawPlugin - the map draw plugin\n * @param {InteractiveMap} map - the interactive map\n */\nexport function addFeatureToMap(feature, drawPlugin, map) {\n switch (feature.geometry.type) {\n case 'Polygon':\n drawPlugin.addFeature({ ...feature, ...polygonFeatureProperties })\n break\n case 'LineString':\n drawPlugin.addFeature({ ...feature, ...lineFeatureProperties })\n break\n case 'Point':\n map.addMarker(feature.id, feature.geometry.coordinates)\n break\n default:\n break\n }\n}\n\n/**\n * Returns HTML summary list for the features\n * @param {FeatureCollection} features - the features\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list in readonly mode\n * @param {LanguageCode} [lang] - the language for the feature details\n */\nexport function createFeaturesHTML(\n features,\n mapId,\n disabled = false,\n readonly = false,\n lang = DEFAULT_LANG\n) {\n return `<dl class=\"govuk-summary-list\">\n ${features.map((feature, index) => createFeatureHTML(feature, index, mapId, disabled, readonly, lang)).join('\\n')}\n </dl>`\n}\n\n/**\n * Focus feature\n * @param {Feature} feature - the feature\n * @param {MapLibreMap} mapProvider - the feature id\n */\nexport function focusFeature(feature, mapProvider) {\n mapProvider.fitBounds(bbox(feature))\n}\n\n/**\n * Returns HTML summary row for an single feature\n * @param {Feature} feature - the geo feature\n * @param {number} index - the feature index\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list item in readonly mode\n * @param {LanguageCode} [lang] - the language for the feature details\n */\nexport function createFeatureHTML(\n feature,\n index,\n mapId,\n disabled = false,\n readonly = false,\n lang = DEFAULT_LANG\n) {\n const texts = getTexts(lang)\n const flattened = feature.geometry.coordinates.flat(2)\n\n const points = []\n for (let i = 0; i < flattened.length; i += 2) {\n points.push(flattened.slice(i, i + 2).join(', '))\n }\n const coordinates = points.map((p) => `<li>${p}</li>`).join('')\n\n const description = readonly\n ? `<p class=\"govuk-body govuk-!-margin-bottom-0\">${feature.properties.description}</p>`\n : `<input class=\"govuk-input govuk-!-width-two-thirds\" type=\"text\" id=\"description_${index}\" value=\"${feature.properties.description}\" data-id=\"${feature.id}\">`\n\n // Change action link\n const changeAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#${mapId}\" data-action=\"edit\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">${texts.itemUpdateLink}<span class=\"govuk-visually-hidden\"> ${texts.itemVisuallyHidden}</span></a>\n</li>`\n\n // Delete action link\n const deleteAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#\" data-action=\"delete\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">${texts.itemDeleteLink}<span class=\"govuk-visually-hidden\"> ${texts.itemVisuallyHidden}</span></a>\n</li>`\n\n // Focus action link\n const focusAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state\" href=\"#${mapId}\" data-action=\"focus\" data-id=\"${feature.id}\">${texts.itemFocusLink}<span class=\"govuk-visually-hidden\"> ${texts.itemVisuallyHidden}</span></a>\n</li>`\n\n const links = readonly ? focusAction() : `${changeAction()}${deleteAction()}`\n const actions = `<ul class=\"govuk-summary-list__actions-list\">${links}</ul>`\n const typeDescription = getTypeDescription(feature, texts.typeDescriptions)\n\n return `<div class=\"govuk-summary-list__row govuk-summary-list__row--no-border\">\n <dt class=\"govuk-summary-list__key\">\n <div class=\"govuk-form-group\">\n <label class=\"govuk-label govuk-label--s\" ${readonly ? '' : `for=\"description_${index}\"`}>${texts.itemLabel1} ${index + 1} ${texts.itemLabel2}</label>\n ${description}\n </div>\n </dt>\n <dd class=\"govuk-summary-list__actions\">\n ${actions}\n </dd>\n</div>\n<div class=\"govuk-summary-list__row\">\n <details class=\"govuk-details govuk-!-margin-bottom-2\">\n <summary class=\"govuk-details__summary\">\n <span class=\"govuk-details__summary-text\">${texts.details.summary}</span>\n </summary>\n <div class=\"govuk-details__text\">\n <dl class=\"govuk-summary-list\">\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.type}</dt>\n <dd class=\"govuk-summary-list__value\">${typeDescription}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.centroidGridReference}</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.centroidGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.firstPointGridReference}</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.coordinateGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">${texts.details.detailedCoordinates}</dt>\n <dd class=\"govuk-summary-list__value\">\n <ol class=\"govuk-list govuk-list--number\">${coordinates}</ol>\n </dd>\n </div>\n </dl>\n </div>\n </details>\n</div>`\n}\n\n/**\n * Generate a random id\n */\nfunction generateID() {\n return window.crypto.randomUUID()\n}\n\n/**\n * Factory closure to track the active feature id\n * @returns {ActiveFeatureManager}\n */\nfunction getActiveFeatureManager() {\n /** @type {string | undefined} */\n let activeFeature\n\n /**\n * Returns the active feature id\n * @type {GetActiveFeature}\n */\n function getActiveFeature() {\n return activeFeature\n }\n\n /**\n * Sets the active feature id\n * @type {SetActiveFeature}\n */\n function setActiveFeature(id) {\n activeFeature = id\n }\n\n /**\n * Resets the active feature id\n * @type {ResetActiveFeature}\n */\n function resetActiveFeature() {\n activeFeature = undefined\n }\n\n return {\n getActiveFeature,\n setActiveFeature,\n resetActiveFeature\n }\n}\n\n/**\n * Reduce coordinate precision to 7 dps\n * @param {Feature} feature\n */\nfunction prepareGeometry(feature) {\n const { geometry } = feature\n const maxPrecision = 7\n\n /**\n * @param {Coordinates} coordinates\n */\n function formatPrecision(coordinates) {\n coordinates[0] = +coordinates[0].toFixed(maxPrecision)\n coordinates[1] = +coordinates[1].toFixed(maxPrecision)\n }\n\n if (geometry.type === 'Point') {\n formatPrecision(geometry.coordinates)\n } else if (geometry.type === 'LineString') {\n geometry.coordinates.forEach(formatPrecision)\n } else {\n geometry.coordinates.flat().forEach(formatPrecision)\n }\n}\n\n/**\n * Factory closure to return a features manager\n * @param {GeoJSON} geojson\n * @returns {FeaturesManager}\n */\nexport function getFeaturesManager(geojson) {\n /**\n * Get a feature from the geojson by id\n * @type {GetFeatures}\n */\n function getFeatures() {\n return geojson.features\n }\n\n /**\n * Get a feature from the geojson by id\n * @type {GetFeature}\n */\n function getFeature(id) {\n return geojson.features.find((f) => f.id === id)\n }\n\n /**\n * Add a feature to the geojson\n * @type {AddFeature}\n */\n function addFeature(feature) {\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n prepareGeometry(feature)\n\n geojson.features.push(feature)\n }\n\n /**\n * Updates a feature in the geojson\n * @type {UpdateFeature}\n */\n function updateFeature(id, geometry) {\n const feature = getFeature(id)\n\n // Ensure the feature exists in the geojson\n if (feature) {\n feature.geometry = geometry\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n prepareGeometry(feature)\n }\n\n return feature\n }\n\n /**\n * Removes a feature from the geojson\n * @type {RemoveFeature}\n */\n function removeFeature(id) {\n const idx = geojson.features.findIndex((f) => f.id === id)\n\n return idx > -1 ? geojson.features.splice(idx, 1) : undefined\n }\n\n return {\n getFeatures,\n getFeature,\n addFeature,\n updateFeature,\n removeFeature\n }\n}\n\n/**\n * Factory to render features into the list and hidden textarea\n * @param {GeoJSON} geojson - the geojson of features\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {Function} renderValue - function that renders the features JSON into the hidden textarea\n * @param {LanguageCode} [lang] - the language for the feature details\n * @returns {RenderList}\n */\nfunction getListRenderer(\n geojson,\n mapId,\n listEl,\n renderValue,\n lang = DEFAULT_LANG\n) {\n return function renderList(disabled = false) {\n const html = createFeaturesHTML(\n geojson.features,\n mapId,\n disabled,\n false,\n lang\n )\n\n listEl.innerHTML = html\n\n renderValue()\n }\n}\n\n/**\n * Factory to render features JSON into the hidden textarea\n * @param {GeoJSON} geojson - the features\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n * @returns {RenderValue}\n */\nfunction getValueRenderer(geojson, geospatialInput) {\n return function renderValue() {\n geospatialInput.value = JSON.stringify(geojson.features, null, 2)\n }\n}\n\n/**\n * Factory closure to manage the UI\n * @param {GeoJSON} geojson - the features\n * @param {InteractiveMap} map - the map\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n * @param { UIManagerOptions | undefined } options - extra options such as allowable geometry types\n * @param {LanguageCode} [lang] - the language for the feature details\n */\nexport function getUIManager(\n geojson,\n map,\n mapId,\n listEl,\n geospatialInput,\n options,\n lang = DEFAULT_LANG\n) {\n /**\n * Get a CSV list of geometry types the user can create\n * @returns {string[]}\n */\n function getAllowableGeometryTypes() {\n return options?.geometryTypes\n ? options.geometryTypes.split(',')\n : ['point', 'line', 'shape']\n }\n\n /**\n * Toggle the hidden state of the action buttons\n * @type {ToggleActionButtons}\n */\n function toggleActionButtons(hidden) {\n const types = getAllowableGeometryTypes()\n if (types.includes('point')) {\n map.toggleButtonState('btnAddPoint', 'hidden', hidden)\n }\n if (types.includes('shape')) {\n map.toggleButtonState('btnAddPolygon', 'hidden', hidden)\n }\n if (types.includes('line')) {\n map.toggleButtonState('btnAddLine', 'hidden', hidden)\n }\n }\n\n /**\n * Set focus to the last description input\n * @type {FocusDescriptionInput}\n */\n function focusDescriptionInput() {\n const inputs = listEl.querySelectorAll('input')\n if (inputs.length) {\n const lastInput = /** @type {HTMLInputElement} */ inputs.item(\n inputs.length - 1\n )\n lastInput.focus()\n lastInput.select()\n }\n }\n\n const renderValue = getValueRenderer(geojson, geospatialInput)\n const renderList = getListRenderer(geojson, mapId, listEl, renderValue, lang)\n\n /** @type {UIManager} */\n return {\n renderList,\n renderValue,\n listEl,\n toggleActionButtons,\n focusDescriptionInput,\n getAllowableGeometryTypes\n }\n}\n\n/**\n * Setup the UI event listeners\n * @param {Context} context - the context\n */\nfunction addEventListeners(context) {\n const { map } = context\n\n map.on(EVENTS.mapReady, onMapReadyFactory(context))\n}\n\n/**\n * Create the map and list containers and adds them to the DOM\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n * @param {number} index - the 0 based index\n */\nfunction createContainers(geospatialInput, index) {\n const mapEl = document.createElement('div')\n const mapId = `geospatialmap_${index}`\n\n mapEl.setAttribute('id', mapId)\n mapEl.setAttribute('class', 'map-container')\n\n const listEl = document.createElement('div')\n const listId = `${mapId}_list`\n listEl.setAttribute('id', listId)\n\n geospatialInput.after(mapEl)\n mapEl.after(listEl)\n geospatialInput.classList.add('js-hidden')\n\n return { mapEl, listEl, mapId }\n}\n\n/**\n * Callback factory function which fires when the map is ready\n * @param {Context} context - the UI context\n */\nfunction onMapReadyFactory(context) {\n const { map, activeFeatureManager, uiManager, interactPlugin, drawPlugin } =\n context\n const { toggleActionButtons, renderList, getAllowableGeometryTypes } =\n uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback function which fires when the map is ready\n * @param {object} e - the event\n * @param {MapLibreMap} e.map - the map provider instance\n */\n return function onMapReady(e) {\n const types = getAllowableGeometryTypes()\n const allowPoint = types.includes('point')\n const allowLine = types.includes('line')\n const allowShape = types.includes('shape')\n const { texts } = context.languageManager\n\n // Add info panel\n map.addPanel('info', {\n ...helpPanelConfig,\n label: texts.helpPanel.label,\n html: getHelpPanelHtml(texts.helpPanel, allowPoint, allowLine, allowShape)\n })\n\n if (allowPoint) {\n map.addButton('btnAddPoint', {\n variant: 'tertiary',\n label: texts.buttons.point,\n iconSvgContent: POINT_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n interactPlugin.enable()\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n if (allowShape) {\n map.addButton('btnAddPolygon', {\n variant: 'tertiary',\n label: texts.buttons.polygon,\n iconSvgContent: POLYGON_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newPolygon(generateID(), polygonFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n if (allowLine) {\n map.addButton('btnAddLine', {\n variant: 'tertiary',\n label: texts.buttons.line,\n iconSvgContent: LINE_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newLine(generateID(), lineFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n // Set the map provider on the context\n context.mapProvider = e.map\n\n map.on(EVENTS.drawReady, onDrawReadyFactory(context))\n map.on(EVENTS.drawCreated, onDrawCreatedFactory(context))\n map.on(EVENTS.drawEdited, onDrawEditedFactory(context))\n map.on(EVENTS.drawCancelled, onDrawCancelledFactory(context))\n map.on(EVENTS.interactMarkerChange, onInteractMarkerChangedFactory(context))\n\n const { listEl } = uiManager\n listEl.addEventListener('click', onListElClickFactory(context), false)\n listEl.addEventListener('change', onListElChangeFactory(context), false)\n listEl.addEventListener('keydown', onListElKeydownFactory(), false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin is ready\n * @param {Context} context - the UI context\n */\nfunction onDrawReadyFactory(context) {\n const { featuresManager, uiManager, drawPlugin, map } = context\n const { renderList } = uiManager\n const { getFeatures } = featuresManager\n\n /**\n * Callback when the draw plugin is ready\n */\n return function onDrawReady() {\n getFeatures().forEach((feature) =>\n addFeatureToMap(feature, drawPlugin, map)\n )\n\n // Update the features\n renderList()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin creates a new feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCreatedFactory(context) {\n const { featuresManager, uiManager } = context\n const { addFeature } = featuresManager\n const { renderList, toggleActionButtons, focusDescriptionInput } = uiManager\n\n /**\n * Callback when a draw feature has been created\n * @param {Feature} e\n */\n return function onDrawCreated(e) {\n // New feature\n addFeature({\n ...e,\n properties: {\n description: ''\n }\n })\n\n // Update the features\n renderList()\n toggleActionButtons(false)\n focusDescriptionInput()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin edits a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawEditedFactory(context) {\n const { featuresManager, activeFeatureManager, uiManager } = context\n const { updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Callback when a draw feature has been edited\n * @param {{ id: string, geometry: Geometry }} e\n */\n return function onDrawEdited(e) {\n const changedFeature = e\n const featureId = changedFeature.id\n\n if (getActiveFeature() === featureId) {\n updateFeature(featureId, changedFeature.geometry)\n\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin cancels the editing of a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCancelledFactory(context) {\n const { uiManager, activeFeatureManager } = context\n const { toggleActionButtons, renderList } = uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback when a draw feature has been cancelled\n */\n return function onDrawCancelled() {\n toggleActionButtons(false)\n resetActiveFeature()\n renderList()\n }\n}\n\n/**\n * Callback factory function that fires when an interact marker has been changed\n * @param {Context} context - the UI context\n */\nfunction onInteractMarkerChangedFactory(context) {\n const {\n featuresManager,\n activeFeatureManager,\n map,\n interactPlugin,\n uiManager\n } = context\n const { addFeature, updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, focusDescriptionInput, toggleActionButtons } = uiManager\n\n /**\n * Callback when an interact marker has been changed\n * @param {{ coords: Coordinates }} e\n */\n return function onInteractMarkerChange(e) {\n const activeFeatureId = getActiveFeature()\n\n if (activeFeatureId) {\n // Editing an existing point\n const feature = updateFeature(activeFeatureId, {\n type: 'Point',\n coordinates: e.coords\n })\n\n map.addMarker(activeFeatureId, e.coords)\n\n if (feature) {\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n } else {\n // Adding a new point\n const id = generateID()\n addFeature({\n type: 'Feature',\n properties: {\n description: ''\n },\n geometry: {\n type: 'Point',\n coordinates: e.coords\n },\n id\n })\n\n map.addMarker(id, e.coords)\n\n // Update the features\n renderList()\n\n focusDescriptionInput()\n }\n map.removeMarker('location')\n\n interactPlugin.disable()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function that fires a 'click' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElClickFactory(context) {\n const {\n map,\n mapProvider,\n featuresManager,\n activeFeatureManager,\n interactPlugin,\n uiManager,\n drawPlugin\n } = context\n const { getFeature, removeFeature } = featuresManager\n const { getActiveFeature, setActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Delete a feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function deleteFeature(id, type) {\n if (type === 'Point') {\n map.removeMarker(id)\n removeFeature(id)\n } else {\n drawPlugin.deleteFeature(id)\n removeFeature(id)\n }\n\n renderList()\n }\n\n /**\n * Start editing feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function editFeature(id, type) {\n setActiveFeature(id)\n\n // \"Change\" feature link was clicked\n if (type === 'Point') {\n interactPlugin.selectFeature({ featureId: id })\n interactPlugin.enable()\n } else {\n drawPlugin.editFeature(id)\n }\n\n const feature = getFeature(id)\n if (feature && mapProvider) {\n focusFeature(feature, mapProvider)\n }\n\n toggleActionButtons(true)\n renderList(true)\n }\n\n /**\n * List container delegated 'click' events handler\n * @param {MouseEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n if (getActiveFeature()) {\n e.preventDefault()\n e.stopPropagation()\n return\n }\n\n if (\n target.tagName === 'A' &&\n target.dataset.action &&\n target.dataset.id &&\n target.dataset.type\n ) {\n const { action, id, type } = target.dataset\n\n if (action === 'edit') {\n // \"Update\" feature link was clicked\n editFeature(id, type)\n } else {\n e.preventDefault()\n e.stopPropagation()\n\n if (action === 'delete') {\n // \"Remove\" feature link was clicked\n deleteFeature(id, type)\n }\n }\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'change' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElChangeFactory(context) {\n const { featuresManager, uiManager } = context\n const { getFeature } = featuresManager\n const { renderValue } = uiManager\n\n /**\n * List container delegated 'change' events handler\n * Used to update the description of features\n * @param {Event} e\n */\n return function (e) {\n e.preventDefault()\n e.stopPropagation()\n\n const target = e.target\n if (!(target instanceof HTMLInputElement) || !target.dataset.id) {\n return\n }\n\n const { id } = target.dataset\n const feature = getFeature(id)\n\n if (feature) {\n feature.properties.description = target.value.trim()\n renderValue()\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'keydown' event is fired on the list container\n */\nfunction onListElKeydownFactory() {\n /**\n * List container delegated 'keydown' events handler\n * Fixes the issue of pressing \"Enter\" key in the description input triggering the map search\n * @param {KeyboardEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLInputElement)) {\n return\n }\n\n if (e.code === 'Enter' || e.code === 'NumpadEnter') {\n e.preventDefault()\n e.stopPropagation()\n }\n }\n}\n\n/**\n * @import { MapsEnvironmentConfig, InteractiveMap } from '~/src/client/javascripts/map.js'\n */\n\n/**\n * @import { Geometry, FeatureCollection, Feature, Coordinates } from '~/src/server/plugins/engine/types.js'\n */\n\n/**\n * @typedef {object} GeoJSON\n * @property {'FeatureCollection'} type - the GeoJSON type string\n * @property {FeatureCollection} features - the features\n */\n\n/**\n * Gets all the features\n * @callback GetFeatures\n * @returns {FeatureCollection}\n */\n\n/**\n * Gets a feature from the geojson by id\n * @callback GetFeature\n * @param {string} id - the feature id\n * @returns {Feature | undefined}\n */\n\n/**\n * Add a feature to the geojson\n * @callback AddFeature\n * @param {Feature} feature - the feature to add\n */\n\n/**\n * Update a feature in the geojson\n * @callback UpdateFeature\n * @param {string} id - the feature id\n * @param {Geometry} geometry - the feature geometry\n * @returns {Feature | undefined}\n */\n\n/**\n * Removes a feature from the geojson\n * @callback RemoveFeature\n * @param {string} id - the feature id\n */\n\n/**\n * Gets the active feature id\n * @callback GetActiveFeature\n * @returns {string | undefined}\n */\n\n/**\n * Set the active feature id\n * @callback SetActiveFeature\n * @param {string} id - the feature id\n * @returns {void}\n */\n\n/**\n * Resets the active feature id\n * @callback ResetActiveFeature\n * @returns {void}\n */\n\n/**\n * Renders the features into the list\n * @callback RenderList\n * @param {boolean} [disabled] - whether to render the list with disabled links\n * @param {LanguageCode} [lang] - the language for the feature details\n * @returns {void}\n */\n\n/**\n * Renders the features JSON into the hidden textarea\n * @callback RenderValue\n * @returns {void}\n */\n\n/**\n * Toggles the action button hidden state\n * @callback ToggleActionButtons\n * @param {boolean} hidden - whether to hide the action buttons\n * @returns {void}\n */\n\n/**\n * Returns the list of geometry types a user can create\n * @callback GetAllowableGeometryTypes\n * @returns {string[]}\n */\n\n/**\n * Set focus to the last description input\n * @callback FocusDescriptionInput\n * @returns {void}\n */\n\n/**\n * @typedef {object} FeaturesManager\n * @property {GetFeatures} getFeatures - function that gets all the features\n * @property {GetFeature} getFeature - function that gets a feature from the geojson\n * @property {AddFeature} addFeature - function that adds feature to the geojson\n * @property {UpdateFeature} updateFeature - function that updates a feature in the geojson\n * @property {RemoveFeature} removeFeature - function that removes a feature from the geojson\n */\n\n/**\n * @typedef {object} ActiveFeatureManager\n * @property {GetActiveFeature} getActiveFeature - function that returns the current active feature id\n * @property {SetActiveFeature} setActiveFeature - function that sets the current active feature id\n * @property {ResetActiveFeature} resetActiveFeature - function that resets the current active feature id\n */\n\n/**\n * @typedef {object} UIManager\n * @property {RenderValue} renderValue - function that renders the features JSON into the hidden textarea\n * @property {RenderList} renderList - function that renders the features into the list\n * @property {HTMLDivElement} listEl - the summary list of features\n * @property {ToggleActionButtons} toggleActionButtons - function that toggles the action buttons\n * @property {FocusDescriptionInput} focusDescriptionInput - function that sets focus to a description input element\n * @property {GetAllowableGeometryTypes} getAllowableGeometryTypes - function that returns the array of geometry types a user can create\n */\n\n/**\n * @typedef {object} GeometryTexts\n * @property {string} point - the label for a point feature in the list\n * @property {string} line - the label for a line string feature in the list\n * @property {string} polygon - the label for a polygon feature in the list\n */\n\n/**\n * @typedef {object} GeospatialPanelTexts\n * @property {string} label - the label for the info panel\n * @property {string} ledeIntro - the lede intro text for the info panel\n * @property {string} ledeOutro - the lede outro text for the info panel\n * @property {string} lineText - the label for the info panel line text\n * @property {string} shapeText - the label for the info panel shape text\n * @property {string} point1 - the text for bullet point 1 in the info panel\n * @property {string} point2 - the text for bullet point 2 in the info panel\n * @property {string} point3 - the text for bullet point 3 in the info panel\n * @property {string} point4 - the text for bullet point 4 in the info panel\n * @property {string} lineOrShapeText - the label for the info panel line or shape text\n * @property {string} typesPhrasePoint - the label for the info panel types phrase point\n * @property {string} typesPhraseLine - the label for the info panel types phrase line\n * @property {string} typesPhraseShape - the label for the info panel types phrase shape\n * @property {string} typesPhraseOr - the label for the info panel types phrase \"or\"\n */\n\n/**\n * @typedef {object} GeospatialLanguageTexts\n * @property {GeometryTexts} typeDescriptions - the descriptions of the geometry types\n * @property {GeospatialPanelTexts} helpPanel - texts for the info panel\n * @property {GeometryTexts} buttons - the labels for the action buttons\n * @property {string} itemLabel1 - the first part of the label for a feature in the list\n * @property {string} itemLabel2 - the second part of the label for a feature in the list\n * @property {string} itemUpdateLink - the label for the \"update\" link for a feature in the list\n * @property {string} itemDeleteLink - the label for the \"delete\" link for a feature in the list\n * @property {string} itemFocusLink - the label for the \"focus\" link for a feature in the list\n * @property {string} itemVisuallyHidden - visually hidden text to add context to action links\n * @property {object} details - labels for the details section of a feature in the list\n * @property {string} details.summary - label for the summary of a feature in the list\n * @property {string} details.type - label for the type of a feature in the list\n * @property {string} details.centroidGridReference - label for the centroid grid reference of a feature in the list\n * @property {string} details.firstPointGridReference - label for the first point grid reference of a feature in the list\n * @property {string} details.detailedCoordinates - label for the detailed coordinates of a feature in the list\n */\n\n/**\n * @typedef {object} LanguageManager\n * @property {LanguageCode} lang - the language for the interactive map\n * @property {GeospatialLanguageTexts} texts - the descriptions of the geometry types\n */\n\n/**\n * @typedef {object} Context\n * @property {LanguageManager} languageManager - the language manager for the interactive map\n * @property {InteractiveMap} map - the interactive map\n * @property {MapLibreMap} [mapProvider] - the interactive map provider\n * @property {FeaturesManager} featuresManager - the features manager\n * @property {ActiveFeatureManager} activeFeatureManager - the active feature manager\n * @property {UIManager} uiManager - the UI manager\n * @property {any} interactPlugin - the map interact plugin\n * @property {any} drawPlugin - the map draw plugin\n */\n\n/**\n * @import { LanguageCode } from '~/src/client/javascripts/map.js'\n * @import { MapLibreMap, UIManagerOptions } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA;AACA,OAAOA,oBAAoB,MAAM,yCAAyC;AAC1E;AACA,OAAOC,gBAAgB,MAAM,qCAAqC;AAClE,SAASC,IAAI,QAAQ,YAAY;AAEjC,SACEC,YAAY,EACZC,YAAY,EACZC,UAAU;AAEZ,SACEC,MAAM,EACNC,SAAS,EACTC,kBAAkB,EAClBC,oBAAoB,EACpBC,gBAAgB,EAChBC,mBAAmB,EACnBC,YAAY;AAEd,OAAOC,WAAW;AAClB,SAASC,kBAAkB;AAC3B,OAAOC,EAAE,qEAAqEC,IAAI,EAAE,MAAM;AAC1F,OAAOC,IAAI,w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,EAAE;MAC/D;IACF;IAEA,MAAM;MAAEA;IAAG,CAAC,GAAGiI,MAAM,CAACxJ,OAAO;IAC7B,MAAMhD,OAAO,GAAGyH,UAAU,CAAClD,EAAE,CAAC;IAE9B,IAAIvE,OAAO,EAAE;MACXA,OAAO,CAACwF,UAAU,CAACD,WAAW,GAAGiH,MAAM,CAAChL,KAAK,CAACC,IAAI,CAAC,CAAC;MACpDyG,WAAW,CAAC,CAAC;IACf;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,SAASuD,sBAAsBA,CAAA,EAAG;EAChC;AACF;AACA;AACA;AACA;EACE,OAAO,UAAUzB,CAAC,EAAE;IAClB,MAAMwC,MAAM,GAAGxC,CAAC,CAACwC,MAAM;IAEvB,IAAI,EAAEA,MAAM,YAAYM,gBAAgB,CAAC,EAAE;MACzC;IACF;IAEA,IAAI9C,CAAC,CAAC+C,IAAI,KAAK,OAAO,IAAI/C,CAAC,CAAC+C,IAAI,KAAK,aAAa,EAAE;MAClD/C,CAAC,CAAC0C,cAAc,CAAC,CAAC;MAClB1C,CAAC,CAAC2C,eAAe,CAAC,CAAC;IACrB;EACF,CAAC;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-expect-error - no types
|
|
2
2
|
import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets';
|
|
3
3
|
import { DEFAULT_LANG, ENGLISH_LANG, WELSH_LANG } from "./map-constants.js";
|
|
4
|
-
import { EVENTS, centerMap, createMap,
|
|
4
|
+
import { EVENTS, centerMap, createMap, eastingNorthingToLatLong, getDefaultConfig, getMapCountryLayers, getMapLayers, latLongToEastingNorthing, latLongToOsGridRef, osGridRefToLatLong } from "./map.js";
|
|
5
5
|
import sssiDataset from "./sssi-dataset.js";
|
|
6
6
|
import cy from "../../server/plugins/engine/i18n/translations/cy.json" with { type: 'json' };
|
|
7
7
|
import enGB from "../../server/plugins/engine/i18n/translations/en-GB.json" with { type: 'json' };
|
|
@@ -403,7 +403,7 @@ export function processLocation(config, location, index) {
|
|
|
403
403
|
const mapId = `map_${index}`;
|
|
404
404
|
mapContainer.setAttribute('id', mapId);
|
|
405
405
|
mapContainer.setAttribute('class', 'map-container');
|
|
406
|
-
const initConfig = getInitMapConfig(location) ??
|
|
406
|
+
const initConfig = getInitMapConfig(location) ?? getDefaultConfig();
|
|
407
407
|
locationInputs.after(mapContainer);
|
|
408
408
|
const country = location.dataset.country;
|
|
409
409
|
const mapLayers = getMapLayers(location.dataset.maplayers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location-map.js","names":["createDatasetsPlugin","DEFAULT_LANG","ENGLISH_LANG","WELSH_LANG","EVENTS","centerMap","createMap","defaultConfig","eastingNorthingToLatLong","getMapCountryLayers","getMapLayers","latLongToEastingNorthing","latLongToOsGridRef","osGridRefToLatLong","sssiDataset","cy","type","enGB","englishTranslations","components","locationFieldBase","map","welshTranslations","LOCATION_FIELD_SELECTOR","languageTexts","getTexts","lang","getInitMapConfig","locationField","locationType","dataset","locationtype","getInitLatLongMapConfig","getInitEastingNorthingMapConfig","getInitOsGridRefMapConfig","Error","validateLatLong","strLat","strLong","lat","trim","Number","long","valid","latMin","latMax","longMin","longMax","latInBounds","longInBounds","value","validateEastingNorthing","strEasting","strNorthing","easting","northing","eastingMin","eastingMax","northingMin","northingMax","validateOsGridRef","osGridRef","pattern","match","exec","getLatLongInputs","inputs","querySelectorAll","length","latInput","longInput","getEastingNorthingInputs","eastingInput","northingInput","getOsGridRefInput","input","querySelector","getInitMapCenterConfig","center","zoom","markers","id","coords","result","undefined","latlong","osGridRefInput","bindLatLongField","mapProvider","on","interactMarkerChange","onInteractMarkerChange","e","maxPrecision","toFixed","onUpdateInputs","addEventListener","bindEastingNorthingField","point","bindOsGridRefField","onUpdateInput","processLocation","config","location","index","HTMLDivElement","locationInputs","supportedLocations","includes","mapContainer","document","createElement","mapId","setAttribute","initConfig","after","country","mapLayers","maplayers","datasets","apiPath","push","plugins","interactPlugin","mapReady","onMapReady","texts","addPanel","focus","showLabel","label","helpPanel","mobile","slot","open","dismissible","modal","tablet","desktop","html","point1","point2","point3","point4","enable"],"sources":["../../../src/client/javascripts/location-map.js"],"sourcesContent":["// @ts-expect-error - no types\nimport createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'\n\nimport {\n DEFAULT_LANG,\n ENGLISH_LANG,\n WELSH_LANG\n} from '~/src/client/javascripts/map-constants.js'\nimport {\n EVENTS,\n centerMap,\n createMap,\n defaultConfig,\n eastingNorthingToLatLong,\n getMapCountryLayers,\n getMapLayers,\n latLongToEastingNorthing,\n latLongToOsGridRef,\n osGridRefToLatLong\n} from '~/src/client/javascripts/map.js'\nimport sssiDataset from '~/src/client/javascripts/sssi-dataset.js'\nimport cy from '~/src/server/plugins/engine/i18n/translations/cy.json' with { type: 'json' }\nimport enGB from '~/src/server/plugins/engine/i18n/translations/en-GB.json' with { type: 'json' }\n\nconst englishTranslations = enGB.components.locationFieldBase.map\nconst welshTranslations = cy.components.locationFieldBase.map\n\nconst LOCATION_FIELD_SELECTOR = 'input.govuk-input'\n\n/**\n * @type {Record<LanguageCode, LocationLanguageTexts>}\n */\nexport const languageTexts = {\n [ENGLISH_LANG]: englishTranslations,\n [WELSH_LANG]: welshTranslations\n}\n\n/**\n * Get the map texts for the given language code\n * @param {LanguageCode} lang - the lanugae code\n */\nexport function getTexts(lang = DEFAULT_LANG) {\n return languageTexts[lang]\n}\n\n/**\n * Gets initial map config for a location field\n * @param {HTMLDivElement} locationField - the location field element\n */\nexport function getInitMapConfig(locationField) {\n const locationType = locationField.dataset.locationtype\n\n switch (locationType) {\n case 'latlongfield':\n return getInitLatLongMapConfig(locationField)\n case 'eastingnorthingfield':\n return getInitEastingNorthingMapConfig(locationField)\n case 'osgridreffield':\n return getInitOsGridRefMapConfig(locationField)\n default:\n throw new Error('Not implemented')\n }\n}\n\n/**\n * Validates lat and long is numeric and within UK bounds\n * @param {string} strLat - the latitude string\n * @param {string} strLong - the longitude string\n * @returns {{ valid: false } | { valid: true, value: { lat: number, long: number } }}\n */\nfunction validateLatLong(strLat, strLong) {\n const lat = strLat.trim() && Number(strLat.trim())\n const long = strLong.trim() && Number(strLong.trim())\n\n if (!lat || !long) {\n return { valid: false }\n }\n\n const latMin = 49.85\n const latMax = 60.859\n const longMin = -13.687\n const longMax = 1.767\n\n const latInBounds = lat >= latMin && lat <= latMax\n const longInBounds = long >= longMin && long <= longMax\n\n if (!latInBounds || !longInBounds) {\n return { valid: false }\n }\n\n return { valid: true, value: { lat, long } }\n}\n\n/**\n * Validates easting and northing is numeric and within UK bounds\n * @param {string} strEasting - the easting string\n * @param {string} strNorthing - the northing string\n * @returns {{ valid: false } | { valid: true, value: { easting: number, northing: number } }}\n */\nfunction validateEastingNorthing(strEasting, strNorthing) {\n const easting = strEasting.trim() && Number(strEasting.trim())\n const northing = strNorthing.trim() && Number(strNorthing.trim())\n\n if (!easting || !northing) {\n return { valid: false }\n }\n\n const eastingMin = 0\n const eastingMax = 700000\n const northingMin = 0\n const northingMax = 1300000\n\n const latInBounds = easting >= eastingMin && easting <= eastingMax\n const longInBounds = northing >= northingMin && northing <= northingMax\n\n if (!latInBounds || !longInBounds) {\n return { valid: false }\n }\n\n return { valid: true, value: { easting, northing } }\n}\n\n/**\n * Validates OS grid reference is correct\n * @param {string} osGridRef - the OsGridRef\n * @returns {{ valid: false } | { valid: true, value: string }}\n */\nfunction validateOsGridRef(osGridRef) {\n if (!osGridRef) {\n return { valid: false }\n }\n\n const pattern =\n /^((([sS]|[nN])[a-hA-Hj-zJ-Z])|(([tT]|[oO])[abfglmqrvwABFGLMQRVW])|([hH][l-zL-Z])|([jJ][lmqrvwLMQRVW]))\\s?(([0-9]{3})\\s?([0-9]{3})|([0-9]{4})\\s?([0-9]{4})|([0-9]{5})\\s?([0-9]{5}))$/\n\n const match = pattern.exec(osGridRef)\n\n if (match === null) {\n return { valid: false }\n }\n\n return { valid: true, value: match[0] }\n}\n\n/**\n * Gets the inputs for a latlong location field\n * @param {HTMLDivElement} locationField - the latlong location field element\n */\nfunction getLatLongInputs(locationField) {\n const inputs = locationField.querySelectorAll(LOCATION_FIELD_SELECTOR)\n\n if (inputs.length !== 2) {\n throw new Error('Expected 2 inputs for lat and long')\n }\n\n const latInput = /** @type {HTMLInputElement} */ (inputs[0])\n const longInput = /** @type {HTMLInputElement} */ (inputs[1])\n\n return { latInput, longInput }\n}\n\n/**\n * Gets the inputs for a easting/northing location field\n * @param {HTMLDivElement} locationField - the eastingnorthing location field element\n */\nfunction getEastingNorthingInputs(locationField) {\n const inputs = locationField.querySelectorAll(LOCATION_FIELD_SELECTOR)\n\n if (inputs.length !== 2) {\n throw new Error('Expected 2 inputs for easting and northing')\n }\n\n const eastingInput = /** @type {HTMLInputElement} */ (inputs[0])\n const northingInput = /** @type {HTMLInputElement} */ (inputs[1])\n\n return { eastingInput, northingInput }\n}\n\n/**\n * Gets the input for a OS grid reference location field\n * @param {HTMLDivElement} locationField - the osgridref location field element\n */\nfunction getOsGridRefInput(locationField) {\n const input = locationField.querySelector(LOCATION_FIELD_SELECTOR)\n\n if (input === null) {\n throw new Error('Expected 1 input for osgridref')\n }\n\n return /** @type {HTMLInputElement} */ (input)\n}\n\n/**\n * Get the initial map config for a center point\n * @param {MapCenter} center - the point\n */\nfunction getInitMapCenterConfig(center) {\n return {\n zoom: '16',\n center,\n markers: [\n {\n id: 'location',\n coords: center\n }\n ]\n }\n}\n\n/**\n * Gets initial map config for a latlong location field\n * @param {HTMLDivElement} locationField - the latlong location field element\n * @returns {InteractiveMapInitConfig | undefined}\n */\nfunction getInitLatLongMapConfig(locationField) {\n const { latInput, longInput } = getLatLongInputs(locationField)\n const result = validateLatLong(latInput.value, longInput.value)\n\n if (!result.valid) {\n return undefined\n }\n\n /** @type {MapCenter} */\n const center = [result.value.long, result.value.lat]\n\n return getInitMapCenterConfig(center)\n}\n\n/**\n * Gets initial map config for a easting/northing location field\n * @param {HTMLDivElement} locationField - the eastingnorthing location field element\n * @returns {InteractiveMapInitConfig | undefined}\n */\nfunction getInitEastingNorthingMapConfig(locationField) {\n const { eastingInput, northingInput } =\n getEastingNorthingInputs(locationField)\n const result = validateEastingNorthing(\n eastingInput.value,\n northingInput.value\n )\n\n if (!result.valid) {\n return undefined\n }\n\n const latlong = eastingNorthingToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n return getInitMapCenterConfig(center)\n}\n\n/**\n * Gets initial map config for an OS grid reference location field\n * @param {HTMLDivElement} locationField - the osgridref location field element\n * @returns {InteractiveMapInitConfig | undefined}\n */\nfunction getInitOsGridRefMapConfig(locationField) {\n const osGridRefInput = getOsGridRefInput(locationField)\n const result = validateOsGridRef(osGridRefInput.value)\n\n if (!result.valid) {\n return undefined\n }\n\n const latlong = osGridRefToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n return getInitMapCenterConfig(center)\n}\n\n/**\n * Bind a latlong field to the map\n * @param {HTMLDivElement} locationField - the latlong location field\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n */\nfunction bindLatLongField(locationField, map, mapProvider) {\n const { latInput, longInput } = getLatLongInputs(locationField)\n\n map.on(\n EVENTS.interactMarkerChange,\n /**\n * Callback function which fires when the map marker changes\n * @param {object} e - the event\n * @param {[number, number]} e.coords - the map marker coordinates\n */\n function onInteractMarkerChange(e) {\n const maxPrecision = 7\n latInput.value = e.coords[1].toFixed(maxPrecision)\n longInput.value = e.coords[0].toFixed(maxPrecision)\n }\n )\n\n /**\n * Lat & long input change event listener\n * Update the map view location when the inputs are changed\n */\n function onUpdateInputs() {\n const result = validateLatLong(latInput.value, longInput.value)\n\n if (result.valid) {\n /** @type {MapCenter} */\n const center = [result.value.long, result.value.lat]\n\n centerMap(map, mapProvider, center)\n }\n }\n\n latInput.addEventListener('change', onUpdateInputs, false)\n longInput.addEventListener('change', onUpdateInputs, false)\n}\n\n/**\n * Bind an eastingnorthing field to the map\n * @param {HTMLDivElement} locationField - the eastingnorthing location field\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n */\nfunction bindEastingNorthingField(locationField, map, mapProvider) {\n const { eastingInput, northingInput } =\n getEastingNorthingInputs(locationField)\n\n map.on(\n EVENTS.interactMarkerChange,\n /**\n * Callback function which fires when the map marker changes\n * @param {object} e - the event\n * @param {[number, number]} e.coords - the map marker coordinates\n */\n function onInteractMarkerChange(e) {\n const maxPrecision = 0\n const point = latLongToEastingNorthing({\n lat: e.coords[1],\n long: e.coords[0]\n })\n\n eastingInput.value = point.easting.toFixed(maxPrecision)\n northingInput.value = point.northing.toFixed(maxPrecision)\n }\n )\n\n /**\n * Easting & northing input change event listener\n * Update the map view location when the inputs are changed\n */\n function onUpdateInputs() {\n const result = validateEastingNorthing(\n eastingInput.value,\n northingInput.value\n )\n\n if (result.valid) {\n const latlong = eastingNorthingToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n centerMap(map, mapProvider, center)\n }\n }\n\n eastingInput.addEventListener('change', onUpdateInputs, false)\n northingInput.addEventListener('change', onUpdateInputs, false)\n}\n\n/**\n * Bind an OS grid reference field to the map\n * @param {HTMLDivElement} locationField - the osgridref location field\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n */\nfunction bindOsGridRefField(locationField, map, mapProvider) {\n const osGridRefInput = getOsGridRefInput(locationField)\n\n map.on(\n EVENTS.interactMarkerChange,\n /**\n * Callback function which fires when the map marker changes\n * @param {object} e - the event\n * @param {[number, number]} e.coords - the map marker coordinates\n */\n function onInteractMarkerChange(e) {\n const point = latLongToOsGridRef({\n lat: e.coords[1],\n long: e.coords[0]\n })\n\n osGridRefInput.value = point\n }\n )\n\n /**\n * OS grid reference input change event listener\n * Update the map view location when the input is changed\n */\n function onUpdateInput() {\n const result = validateOsGridRef(osGridRefInput.value)\n\n if (result.valid) {\n const latlong = osGridRefToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n centerMap(map, mapProvider, center)\n }\n }\n\n osGridRefInput.addEventListener('change', onUpdateInput, false)\n}\n\n/**\n * Processes a location field to add map capability\n * @param {MapsEnvironmentConfig} config - the location field element\n * @param {Element} location - the location field element\n * @param {number} index - the 0-based index\n */\nexport function processLocation(config, location, index) {\n if (!(location instanceof HTMLDivElement)) {\n return\n }\n\n const locationInputs = location.querySelector('.app-location-field-inputs')\n if (!(locationInputs instanceof HTMLDivElement)) {\n return\n }\n const locationType = location.dataset.locationtype\n\n // Check for support\n const supportedLocations = [\n 'latlongfield',\n 'eastingnorthingfield',\n 'osgridreffield'\n ]\n if (!locationType || !supportedLocations.includes(locationType)) {\n return\n }\n\n const mapContainer = document.createElement('div')\n const mapId = `map_${index}`\n\n mapContainer.setAttribute('id', mapId)\n mapContainer.setAttribute('class', 'map-container')\n\n const initConfig = getInitMapConfig(location) ?? defaultConfig\n\n locationInputs.after(mapContainer)\n\n const country = location.dataset.country\n const mapLayers = getMapLayers(location.dataset.maplayers)\n const datasets = getMapCountryLayers(config.apiPath, country)\n\n if (mapLayers.includes('sssi')) {\n datasets.push(...sssiDataset)\n }\n\n // Create a map dataset plugin if there are any present\n if (datasets.length) {\n initConfig.plugins = [createDatasetsPlugin({ datasets })]\n }\n\n const lang = /** @type {LanguageCode} */ (\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n location.dataset.lang || DEFAULT_LANG\n )\n\n const { map, interactPlugin } = createMap(mapId, initConfig, config)\n\n map.on(\n EVENTS.mapReady,\n /**\n * Callback function which fires when the map is ready\n * @param {object} e - the event\n * @param {MapLibreMap} e.map - the map provider instance\n */\n function onMapReady(e) {\n switch (locationType) {\n case 'latlongfield':\n bindLatLongField(location, map, e.map)\n break\n case 'eastingnorthingfield':\n bindEastingNorthingField(location, map, e.map)\n break\n case 'osgridreffield':\n bindOsGridRefField(location, map, e.map)\n break\n default:\n throw new Error('Not implemented')\n }\n\n const texts = getTexts(lang)\n\n // Add info panel\n map.addPanel('info', {\n focus: false,\n showLabel: true,\n label: texts.helpPanel.label,\n mobile: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n tablet: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n desktop: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n html: `<ul><li>${texts.helpPanel.point1}</li><li>${texts.helpPanel.point2}</li><li>${texts.helpPanel.point3}</li><li>${texts.helpPanel.point4}</li></ul>`\n })\n\n // Enable the interact plugin\n interactPlugin.enable()\n }\n )\n}\n\n/**\n * @typedef {object} LocationPanelTexts\n * @property {string} label - the label for the info panel\n * @property {string} point1 - the text for bullet point 1 in the info panel\n * @property {string} point2 - the text for bullet point 2 in the info panel\n * @property {string} point3 - the text for bullet point 3 in the info panel\n * @property {string} point4 - the text for bullet point 4 in the info panel\n */\n\n/**\n * @typedef {object} LocationLanguageTexts\n * @property {LocationPanelTexts} helpPanel - texts for the info panel\n */\n\n/**\n * @import { LanguageCode } from '~/src/client/javascripts/map.js'\n * @import { InteractiveMap, InteractiveMapInitConfig, MapCenter, MapLibreMap, MapsEnvironmentConfig } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA;AACA,OAAOA,oBAAoB,MAAM,yCAAyC;AAE1E,SACEC,YAAY,EACZC,YAAY,EACZC,UAAU;AAEZ,SACEC,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,wBAAwB,EACxBC,mBAAmB,EACnBC,YAAY,EACZC,wBAAwB,EACxBC,kBAAkB,EAClBC,kBAAkB;AAEpB,OAAOC,WAAW;AAClB,OAAOC,EAAE,qEAAqEC,IAAI,EAAE,MAAM;AAC1F,OAAOC,IAAI,wEAAwED,IAAI,EAAE,MAAM;AAE/F,MAAME,mBAAmB,GAAGD,IAAI,CAACE,UAAU,CAACC,iBAAiB,CAACC,GAAG;AACjE,MAAMC,iBAAiB,GAAGP,EAAE,CAACI,UAAU,CAACC,iBAAiB,CAACC,GAAG;AAE7D,MAAME,uBAAuB,GAAG,mBAAmB;;AAEnD;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG;EAC3B,CAACtB,YAAY,GAAGgB,mBAAmB;EACnC,CAACf,UAAU,GAAGmB;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASG,QAAQA,CAACC,IAAI,GAAGzB,YAAY,EAAE;EAC5C,OA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AAI,EAAE,IAAI;QACVC,WAAW,EAAE,IAAI;QACjBC,KAAK,EAAE;MACT,CAAC;MACDC,MAAM,EAAE;QACNJ,IAAI,EAAE,QAAQ;QACdC,IAAI,EAAE,IAAI;QACVC,WAAW,EAAE,IAAI;QACjBC,KAAK,EAAE;MACT,CAAC;MACDE,OAAO,EAAE;QACPL,IAAI,EAAE,QAAQ;QACdC,IAAI,EAAE,IAAI;QACVC,WAAW,EAAE,IAAI;QACjBC,KAAK,EAAE;MACT,CAAC;MACDG,IAAI,EAAE,WAAWb,KAAK,CAACK,SAAS,CAACS,MAAM,YAAYd,KAAK,CAACK,SAAS,CAACU,MAAM,YAAYf,KAAK,CAACK,SAAS,CAACW,MAAM,YAAYhB,KAAK,CAACK,SAAS,CAACY,MAAM;IAC/I,CAAC,CAAC;;IAEF;IACApB,cAAc,CAACqB,MAAM,CAAC,CAAC;EACzB,CACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"location-map.js","names":["createDatasetsPlugin","DEFAULT_LANG","ENGLISH_LANG","WELSH_LANG","EVENTS","centerMap","createMap","eastingNorthingToLatLong","getDefaultConfig","getMapCountryLayers","getMapLayers","latLongToEastingNorthing","latLongToOsGridRef","osGridRefToLatLong","sssiDataset","cy","type","enGB","englishTranslations","components","locationFieldBase","map","welshTranslations","LOCATION_FIELD_SELECTOR","languageTexts","getTexts","lang","getInitMapConfig","locationField","locationType","dataset","locationtype","getInitLatLongMapConfig","getInitEastingNorthingMapConfig","getInitOsGridRefMapConfig","Error","validateLatLong","strLat","strLong","lat","trim","Number","long","valid","latMin","latMax","longMin","longMax","latInBounds","longInBounds","value","validateEastingNorthing","strEasting","strNorthing","easting","northing","eastingMin","eastingMax","northingMin","northingMax","validateOsGridRef","osGridRef","pattern","match","exec","getLatLongInputs","inputs","querySelectorAll","length","latInput","longInput","getEastingNorthingInputs","eastingInput","northingInput","getOsGridRefInput","input","querySelector","getInitMapCenterConfig","center","zoom","markers","id","coords","result","undefined","latlong","osGridRefInput","bindLatLongField","mapProvider","on","interactMarkerChange","onInteractMarkerChange","e","maxPrecision","toFixed","onUpdateInputs","addEventListener","bindEastingNorthingField","point","bindOsGridRefField","onUpdateInput","processLocation","config","location","index","HTMLDivElement","locationInputs","supportedLocations","includes","mapContainer","document","createElement","mapId","setAttribute","initConfig","after","country","mapLayers","maplayers","datasets","apiPath","push","plugins","interactPlugin","mapReady","onMapReady","texts","addPanel","focus","showLabel","label","helpPanel","mobile","slot","open","dismissible","modal","tablet","desktop","html","point1","point2","point3","point4","enable"],"sources":["../../../src/client/javascripts/location-map.js"],"sourcesContent":["// @ts-expect-error - no types\nimport createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'\n\nimport {\n DEFAULT_LANG,\n ENGLISH_LANG,\n WELSH_LANG\n} from '~/src/client/javascripts/map-constants.js'\nimport {\n EVENTS,\n centerMap,\n createMap,\n eastingNorthingToLatLong,\n getDefaultConfig,\n getMapCountryLayers,\n getMapLayers,\n latLongToEastingNorthing,\n latLongToOsGridRef,\n osGridRefToLatLong\n} from '~/src/client/javascripts/map.js'\nimport sssiDataset from '~/src/client/javascripts/sssi-dataset.js'\nimport cy from '~/src/server/plugins/engine/i18n/translations/cy.json' with { type: 'json' }\nimport enGB from '~/src/server/plugins/engine/i18n/translations/en-GB.json' with { type: 'json' }\n\nconst englishTranslations = enGB.components.locationFieldBase.map\nconst welshTranslations = cy.components.locationFieldBase.map\n\nconst LOCATION_FIELD_SELECTOR = 'input.govuk-input'\n\n/**\n * @type {Record<LanguageCode, LocationLanguageTexts>}\n */\nexport const languageTexts = {\n [ENGLISH_LANG]: englishTranslations,\n [WELSH_LANG]: welshTranslations\n}\n\n/**\n * Get the map texts for the given language code\n * @param {LanguageCode} lang - the lanugae code\n */\nexport function getTexts(lang = DEFAULT_LANG) {\n return languageTexts[lang]\n}\n\n/**\n * Gets initial map config for a location field\n * @param {HTMLDivElement} locationField - the location field element\n */\nexport function getInitMapConfig(locationField) {\n const locationType = locationField.dataset.locationtype\n\n switch (locationType) {\n case 'latlongfield':\n return getInitLatLongMapConfig(locationField)\n case 'eastingnorthingfield':\n return getInitEastingNorthingMapConfig(locationField)\n case 'osgridreffield':\n return getInitOsGridRefMapConfig(locationField)\n default:\n throw new Error('Not implemented')\n }\n}\n\n/**\n * Validates lat and long is numeric and within UK bounds\n * @param {string} strLat - the latitude string\n * @param {string} strLong - the longitude string\n * @returns {{ valid: false } | { valid: true, value: { lat: number, long: number } }}\n */\nfunction validateLatLong(strLat, strLong) {\n const lat = strLat.trim() && Number(strLat.trim())\n const long = strLong.trim() && Number(strLong.trim())\n\n if (!lat || !long) {\n return { valid: false }\n }\n\n const latMin = 49.85\n const latMax = 60.859\n const longMin = -13.687\n const longMax = 1.767\n\n const latInBounds = lat >= latMin && lat <= latMax\n const longInBounds = long >= longMin && long <= longMax\n\n if (!latInBounds || !longInBounds) {\n return { valid: false }\n }\n\n return { valid: true, value: { lat, long } }\n}\n\n/**\n * Validates easting and northing is numeric and within UK bounds\n * @param {string} strEasting - the easting string\n * @param {string} strNorthing - the northing string\n * @returns {{ valid: false } | { valid: true, value: { easting: number, northing: number } }}\n */\nfunction validateEastingNorthing(strEasting, strNorthing) {\n const easting = strEasting.trim() && Number(strEasting.trim())\n const northing = strNorthing.trim() && Number(strNorthing.trim())\n\n if (!easting || !northing) {\n return { valid: false }\n }\n\n const eastingMin = 0\n const eastingMax = 700000\n const northingMin = 0\n const northingMax = 1300000\n\n const latInBounds = easting >= eastingMin && easting <= eastingMax\n const longInBounds = northing >= northingMin && northing <= northingMax\n\n if (!latInBounds || !longInBounds) {\n return { valid: false }\n }\n\n return { valid: true, value: { easting, northing } }\n}\n\n/**\n * Validates OS grid reference is correct\n * @param {string} osGridRef - the OsGridRef\n * @returns {{ valid: false } | { valid: true, value: string }}\n */\nfunction validateOsGridRef(osGridRef) {\n if (!osGridRef) {\n return { valid: false }\n }\n\n const pattern =\n /^((([sS]|[nN])[a-hA-Hj-zJ-Z])|(([tT]|[oO])[abfglmqrvwABFGLMQRVW])|([hH][l-zL-Z])|([jJ][lmqrvwLMQRVW]))\\s?(([0-9]{3})\\s?([0-9]{3})|([0-9]{4})\\s?([0-9]{4})|([0-9]{5})\\s?([0-9]{5}))$/\n\n const match = pattern.exec(osGridRef)\n\n if (match === null) {\n return { valid: false }\n }\n\n return { valid: true, value: match[0] }\n}\n\n/**\n * Gets the inputs for a latlong location field\n * @param {HTMLDivElement} locationField - the latlong location field element\n */\nfunction getLatLongInputs(locationField) {\n const inputs = locationField.querySelectorAll(LOCATION_FIELD_SELECTOR)\n\n if (inputs.length !== 2) {\n throw new Error('Expected 2 inputs for lat and long')\n }\n\n const latInput = /** @type {HTMLInputElement} */ (inputs[0])\n const longInput = /** @type {HTMLInputElement} */ (inputs[1])\n\n return { latInput, longInput }\n}\n\n/**\n * Gets the inputs for a easting/northing location field\n * @param {HTMLDivElement} locationField - the eastingnorthing location field element\n */\nfunction getEastingNorthingInputs(locationField) {\n const inputs = locationField.querySelectorAll(LOCATION_FIELD_SELECTOR)\n\n if (inputs.length !== 2) {\n throw new Error('Expected 2 inputs for easting and northing')\n }\n\n const eastingInput = /** @type {HTMLInputElement} */ (inputs[0])\n const northingInput = /** @type {HTMLInputElement} */ (inputs[1])\n\n return { eastingInput, northingInput }\n}\n\n/**\n * Gets the input for a OS grid reference location field\n * @param {HTMLDivElement} locationField - the osgridref location field element\n */\nfunction getOsGridRefInput(locationField) {\n const input = locationField.querySelector(LOCATION_FIELD_SELECTOR)\n\n if (input === null) {\n throw new Error('Expected 1 input for osgridref')\n }\n\n return /** @type {HTMLInputElement} */ (input)\n}\n\n/**\n * Get the initial map config for a center point\n * @param {MapCenter} center - the point\n */\nfunction getInitMapCenterConfig(center) {\n return {\n zoom: '16',\n center,\n markers: [\n {\n id: 'location',\n coords: center\n }\n ]\n }\n}\n\n/**\n * Gets initial map config for a latlong location field\n * @param {HTMLDivElement} locationField - the latlong location field element\n * @returns {InteractiveMapInitConfig | undefined}\n */\nfunction getInitLatLongMapConfig(locationField) {\n const { latInput, longInput } = getLatLongInputs(locationField)\n const result = validateLatLong(latInput.value, longInput.value)\n\n if (!result.valid) {\n return undefined\n }\n\n /** @type {MapCenter} */\n const center = [result.value.long, result.value.lat]\n\n return getInitMapCenterConfig(center)\n}\n\n/**\n * Gets initial map config for a easting/northing location field\n * @param {HTMLDivElement} locationField - the eastingnorthing location field element\n * @returns {InteractiveMapInitConfig | undefined}\n */\nfunction getInitEastingNorthingMapConfig(locationField) {\n const { eastingInput, northingInput } =\n getEastingNorthingInputs(locationField)\n const result = validateEastingNorthing(\n eastingInput.value,\n northingInput.value\n )\n\n if (!result.valid) {\n return undefined\n }\n\n const latlong = eastingNorthingToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n return getInitMapCenterConfig(center)\n}\n\n/**\n * Gets initial map config for an OS grid reference location field\n * @param {HTMLDivElement} locationField - the osgridref location field element\n * @returns {InteractiveMapInitConfig | undefined}\n */\nfunction getInitOsGridRefMapConfig(locationField) {\n const osGridRefInput = getOsGridRefInput(locationField)\n const result = validateOsGridRef(osGridRefInput.value)\n\n if (!result.valid) {\n return undefined\n }\n\n const latlong = osGridRefToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n return getInitMapCenterConfig(center)\n}\n\n/**\n * Bind a latlong field to the map\n * @param {HTMLDivElement} locationField - the latlong location field\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n */\nfunction bindLatLongField(locationField, map, mapProvider) {\n const { latInput, longInput } = getLatLongInputs(locationField)\n\n map.on(\n EVENTS.interactMarkerChange,\n /**\n * Callback function which fires when the map marker changes\n * @param {object} e - the event\n * @param {[number, number]} e.coords - the map marker coordinates\n */\n function onInteractMarkerChange(e) {\n const maxPrecision = 7\n latInput.value = e.coords[1].toFixed(maxPrecision)\n longInput.value = e.coords[0].toFixed(maxPrecision)\n }\n )\n\n /**\n * Lat & long input change event listener\n * Update the map view location when the inputs are changed\n */\n function onUpdateInputs() {\n const result = validateLatLong(latInput.value, longInput.value)\n\n if (result.valid) {\n /** @type {MapCenter} */\n const center = [result.value.long, result.value.lat]\n\n centerMap(map, mapProvider, center)\n }\n }\n\n latInput.addEventListener('change', onUpdateInputs, false)\n longInput.addEventListener('change', onUpdateInputs, false)\n}\n\n/**\n * Bind an eastingnorthing field to the map\n * @param {HTMLDivElement} locationField - the eastingnorthing location field\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n */\nfunction bindEastingNorthingField(locationField, map, mapProvider) {\n const { eastingInput, northingInput } =\n getEastingNorthingInputs(locationField)\n\n map.on(\n EVENTS.interactMarkerChange,\n /**\n * Callback function which fires when the map marker changes\n * @param {object} e - the event\n * @param {[number, number]} e.coords - the map marker coordinates\n */\n function onInteractMarkerChange(e) {\n const maxPrecision = 0\n const point = latLongToEastingNorthing({\n lat: e.coords[1],\n long: e.coords[0]\n })\n\n eastingInput.value = point.easting.toFixed(maxPrecision)\n northingInput.value = point.northing.toFixed(maxPrecision)\n }\n )\n\n /**\n * Easting & northing input change event listener\n * Update the map view location when the inputs are changed\n */\n function onUpdateInputs() {\n const result = validateEastingNorthing(\n eastingInput.value,\n northingInput.value\n )\n\n if (result.valid) {\n const latlong = eastingNorthingToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n centerMap(map, mapProvider, center)\n }\n }\n\n eastingInput.addEventListener('change', onUpdateInputs, false)\n northingInput.addEventListener('change', onUpdateInputs, false)\n}\n\n/**\n * Bind an OS grid reference field to the map\n * @param {HTMLDivElement} locationField - the osgridref location field\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n */\nfunction bindOsGridRefField(locationField, map, mapProvider) {\n const osGridRefInput = getOsGridRefInput(locationField)\n\n map.on(\n EVENTS.interactMarkerChange,\n /**\n * Callback function which fires when the map marker changes\n * @param {object} e - the event\n * @param {[number, number]} e.coords - the map marker coordinates\n */\n function onInteractMarkerChange(e) {\n const point = latLongToOsGridRef({\n lat: e.coords[1],\n long: e.coords[0]\n })\n\n osGridRefInput.value = point\n }\n )\n\n /**\n * OS grid reference input change event listener\n * Update the map view location when the input is changed\n */\n function onUpdateInput() {\n const result = validateOsGridRef(osGridRefInput.value)\n\n if (result.valid) {\n const latlong = osGridRefToLatLong(result.value)\n\n /** @type {MapCenter} */\n const center = [latlong.long, latlong.lat]\n\n centerMap(map, mapProvider, center)\n }\n }\n\n osGridRefInput.addEventListener('change', onUpdateInput, false)\n}\n\n/**\n * Processes a location field to add map capability\n * @param {MapsEnvironmentConfig} config - the location field element\n * @param {Element} location - the location field element\n * @param {number} index - the 0-based index\n */\nexport function processLocation(config, location, index) {\n if (!(location instanceof HTMLDivElement)) {\n return\n }\n\n const locationInputs = location.querySelector('.app-location-field-inputs')\n if (!(locationInputs instanceof HTMLDivElement)) {\n return\n }\n const locationType = location.dataset.locationtype\n\n // Check for support\n const supportedLocations = [\n 'latlongfield',\n 'eastingnorthingfield',\n 'osgridreffield'\n ]\n if (!locationType || !supportedLocations.includes(locationType)) {\n return\n }\n\n const mapContainer = document.createElement('div')\n const mapId = `map_${index}`\n\n mapContainer.setAttribute('id', mapId)\n mapContainer.setAttribute('class', 'map-container')\n\n const initConfig = getInitMapConfig(location) ?? getDefaultConfig()\n\n locationInputs.after(mapContainer)\n\n const country = location.dataset.country\n const mapLayers = getMapLayers(location.dataset.maplayers)\n const datasets = getMapCountryLayers(config.apiPath, country)\n\n if (mapLayers.includes('sssi')) {\n datasets.push(...sssiDataset)\n }\n\n // Create a map dataset plugin if there are any present\n if (datasets.length) {\n initConfig.plugins = [createDatasetsPlugin({ datasets })]\n }\n\n const lang = /** @type {LanguageCode} */ (\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n location.dataset.lang || DEFAULT_LANG\n )\n\n const { map, interactPlugin } = createMap(mapId, initConfig, config)\n\n map.on(\n EVENTS.mapReady,\n /**\n * Callback function which fires when the map is ready\n * @param {object} e - the event\n * @param {MapLibreMap} e.map - the map provider instance\n */\n function onMapReady(e) {\n switch (locationType) {\n case 'latlongfield':\n bindLatLongField(location, map, e.map)\n break\n case 'eastingnorthingfield':\n bindEastingNorthingField(location, map, e.map)\n break\n case 'osgridreffield':\n bindOsGridRefField(location, map, e.map)\n break\n default:\n throw new Error('Not implemented')\n }\n\n const texts = getTexts(lang)\n\n // Add info panel\n map.addPanel('info', {\n focus: false,\n showLabel: true,\n label: texts.helpPanel.label,\n mobile: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n tablet: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n desktop: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n html: `<ul><li>${texts.helpPanel.point1}</li><li>${texts.helpPanel.point2}</li><li>${texts.helpPanel.point3}</li><li>${texts.helpPanel.point4}</li></ul>`\n })\n\n // Enable the interact plugin\n interactPlugin.enable()\n }\n )\n}\n\n/**\n * @typedef {object} LocationPanelTexts\n * @property {string} label - the label for the info panel\n * @property {string} point1 - the text for bullet point 1 in the info panel\n * @property {string} point2 - the text for bullet point 2 in the info panel\n * @property {string} point3 - the text for bullet point 3 in the info panel\n * @property {string} point4 - the text for bullet point 4 in the info panel\n */\n\n/**\n * @typedef {object} LocationLanguageTexts\n * @property {LocationPanelTexts} helpPanel - texts for the info panel\n */\n\n/**\n * @import { LanguageCode } from '~/src/client/javascripts/map.js'\n * @import { InteractiveMap, InteractiveMapInitConfig, MapCenter, MapLibreMap, MapsEnvironmentConfig } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA;AACA,OAAOA,oBAAoB,MAAM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;IACApB,cAAc,CAACqB,MAAM,CAAC,CAAC;EACzB,CACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -103,8 +103,7 @@ export function getMapLayers(layers: string | undefined): string[];
|
|
|
103
103
|
* @param {string} [country]
|
|
104
104
|
*/
|
|
105
105
|
export function getMapCountryLayers(apiPath: string, country?: string): any[];
|
|
106
|
-
|
|
107
|
-
export const defaultConfig: InteractiveMapInitConfig;
|
|
106
|
+
export function getDefaultConfig(): InteractiveMapInitConfig;
|
|
108
107
|
export namespace EVENTS {
|
|
109
108
|
let mapReady: string;
|
|
110
109
|
let interactMarkerChange: string;
|
|
@@ -207,6 +206,10 @@ export type MapsEnvironmentConfig = {
|
|
|
207
206
|
* - the root API path
|
|
208
207
|
*/
|
|
209
208
|
apiPath: string;
|
|
209
|
+
/**
|
|
210
|
+
* - the maplibre worker path
|
|
211
|
+
*/
|
|
212
|
+
workerPath: string;
|
|
210
213
|
/**
|
|
211
214
|
* - the tile data config
|
|
212
215
|
*/
|