@defra/forms-engine-plugin 4.11.2 → 4.11.3

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.
@@ -428,7 +428,7 @@ export function processLocation(config, location, index) {
428
428
  dismissible: true,
429
429
  modal: false
430
430
  },
431
- html: 'If using a map click on a point to update the location.<br><br>If using a keyboard, navigate to the point, centering the crosshair at the location and press enter.'
431
+ html: '<ul><li>Search for a place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Use a mouse or keyboard to centre the point at the location</li><li>Click to add the location to the map</li></ul>'
432
432
  });
433
433
 
434
434
  // Enable the interact plugin
@@ -1 +1 @@
1
- {"version":3,"file":"location-map.js","names":["EVENTS","centerMap","createMap","defaultConfig","eastingNorthingToLatLong","latLongToEastingNorthing","latLongToOsGridRef","osGridRefToLatLong","LOCATION_FIELD_SELECTOR","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","map","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","interactPlugin","mapReady","onMapReady","addPanel","showLabel","label","mobile","slot","open","dismissible","modal","tablet","desktop","html","enable"],"sources":["../../../src/client/javascripts/location-map.js"],"sourcesContent":["import {\n EVENTS,\n centerMap,\n createMap,\n defaultConfig,\n eastingNorthingToLatLong,\n latLongToEastingNorthing,\n latLongToOsGridRef,\n osGridRefToLatLong\n} from '~/src/client/javascripts/map.js'\n\nconst LOCATION_FIELD_SELECTOR = 'input.govuk-input'\n\n/**\n * Gets initial map config for a location field\n * @param {HTMLDivElement} locationField - the location field element\n */\nfunction 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 { 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 // Add info panel\n map.addPanel('info', {\n showLabel: true,\n label: 'How to use the map',\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: 'If using a map click on a point to update the location.<br><br>If using a keyboard, navigate to the point, centering the crosshair at the location and press enter.'\n })\n\n // Enable the interact plugin\n interactPlugin.enable()\n }\n )\n}\n\n/**\n * @import { InteractiveMap, InteractiveMapInitConfig, MapCenter, MapLibreMap, MapsEnvironmentConfig } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA,SACEA,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,wBAAwB,EACxBC,wBAAwB,EACxBC,kBAAkB,EAClBC,kBAAkB;AAGpB,MAAMC,uBAAuB,GAAG,mBAAmB;;AAEnD;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAACC,aAAa,EAAE;EACvC,MAAMC,YAAY,GAAGD,aAAa,CAACE,OAAO,CAACC,YAAY;EAEvD,QAAQF,YAAY;IAClB,KAAK,cAAc;MACjB,OAAOG,uBAAuB,CAACJ,aAAa,CAAC;IAC/C,KAAK,sBAAsB;MACzB,OAAOK,+BAA+B,CAACL,aAAa,CAAC;IACvD,KAAK,gBAAgB;MACnB,OAAOM,yBAAyB,CAACN,aAAa,CAAC;IACjD;MACE,MAAM,IAAIO,KAAK,CAAC,iBA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gC,QAAQ,CAAC,MAAM,EAAE;MACnBC,SAAS,EAAE,IAAI;MACfC,KAAK,EAAE,oBAAoB;MAC3BC,MAAM,EAAE;QACNC,IAAI,EAAE,QAAQ;QACdC,IAAI,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;IACR,CAAC,CAAC;;IAEF;IACAb,cAAc,CAACc,MAAM,CAAC,CAAC;EACzB,CACF,CAAC;AACH;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"location-map.js","names":["EVENTS","centerMap","createMap","defaultConfig","eastingNorthingToLatLong","latLongToEastingNorthing","latLongToOsGridRef","osGridRefToLatLong","LOCATION_FIELD_SELECTOR","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","map","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","interactPlugin","mapReady","onMapReady","addPanel","showLabel","label","mobile","slot","open","dismissible","modal","tablet","desktop","html","enable"],"sources":["../../../src/client/javascripts/location-map.js"],"sourcesContent":["import {\n EVENTS,\n centerMap,\n createMap,\n defaultConfig,\n eastingNorthingToLatLong,\n latLongToEastingNorthing,\n latLongToOsGridRef,\n osGridRefToLatLong\n} from '~/src/client/javascripts/map.js'\n\nconst LOCATION_FIELD_SELECTOR = 'input.govuk-input'\n\n/**\n * Gets initial map config for a location field\n * @param {HTMLDivElement} locationField - the location field element\n */\nfunction 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 { 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 // Add info panel\n map.addPanel('info', {\n showLabel: true,\n label: 'How to use the map',\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>Search for a place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Use a mouse or keyboard to centre the point at the location</li><li>Click to add the location to the map</li></ul>'\n })\n\n // Enable the interact plugin\n interactPlugin.enable()\n }\n )\n}\n\n/**\n * @import { InteractiveMap, InteractiveMapInitConfig, MapCenter, MapLibreMap, MapsEnvironmentConfig } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA,SACEA,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,wBAAwB,EACxBC,wBAAwB,EACxBC,kBAAkB,EAClBC,kBAAkB;AAGpB,MAAMC,uBAAuB,GAAG,mBAAmB;;AAEnD;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAACC,aAAa,EAAE;EACvC,MAAMC,YAAY,GAAGD,aAAa,CAACE,OAAO,CAACC,YAAY;EAEvD,QAAQF,YAAY;IAClB,KAAK,cAAc;M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,GAAG,CAAC;QAC9C;MACF,KAAK,gBAAgB;QACnBY,kBAAkB,CAACI,QAAQ,EAAEhB,GAAG,EAAEK,CAAC,CAACL,GAAG,CAAC;QACxC;MACF;QACE,MAAM,IAAIrD,KAAK,CAAC,iBAAiB,CAAC;IACtC;;IAEA;IACAqD,GAAG,CAACgC,QAAQ,CAAC,MAAM,EAAE;MACnBC,SAAS,EAAE,IAAI;MACfC,KAAK,EAAE,oBAAoB;MAC3BC,MAAM,EAAE;QACNC,IAAI,EAAE,QAAQ;QACdC,IAAI,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;IACR,CAAC,CAAC;;IAEF;IACAb,cAAc,CAACc,MAAM,CAAC,CAAC;EACzB,CACF,CAAC;AACH;;AAEA;AACA;AACA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-engine-plugin",
3
- "version": "4.11.2",
3
+ "version": "4.11.3",
4
4
  "description": "Defra forms engine",
5
5
  "type": "module",
6
6
  "files": [
@@ -464,7 +464,7 @@ export function processLocation(config, location, index) {
464
464
  dismissible: true,
465
465
  modal: false
466
466
  },
467
- html: 'If using a map click on a point to update the location.<br><br>If using a keyboard, navigate to the point, centering the crosshair at the location and press enter.'
467
+ html: '<ul><li>Search for a place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Use a mouse or keyboard to centre the point at the location</li><li>Click to add the location to the map</li></ul>'
468
468
  })
469
469
 
470
470
  // Enable the interact plugin