@defra/forms-engine-plugin 4.2.0 → 4.4.0
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/javascripts/application.min.js.map +1 -1
- package/.public/javascripts/shared.min.js +1 -1
- package/.public/javascripts/shared.min.js.map +1 -1
- package/.public/javascripts/vendor/accessible-autocomplete.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.d.ts +189 -0
- package/.server/client/javascripts/geospatial-map.js +1068 -0
- package/.server/client/javascripts/geospatial-map.js.map +1 -0
- package/.server/client/javascripts/location-map.d.ts +6 -91
- package/.server/client/javascripts/location-map.js +78 -385
- package/.server/client/javascripts/location-map.js.map +1 -1
- package/.server/client/javascripts/map.d.ts +199 -0
- package/.server/client/javascripts/map.js +384 -0
- package/.server/client/javascripts/map.js.map +1 -0
- package/.server/client/javascripts/shared.d.ts +3 -1
- package/.server/client/javascripts/shared.js +3 -1
- package/.server/client/javascripts/shared.js.map +1 -1
- package/.server/client/stylesheets/shared.scss +7 -0
- package/.server/server/plugins/engine/components/ComponentBase.d.ts +1 -0
- package/.server/server/plugins/engine/components/ComponentBase.js +2 -0
- package/.server/server/plugins/engine/components/ComponentBase.js.map +1 -1
- package/.server/server/plugins/engine/components/FormComponent.d.ts +9 -1
- package/.server/server/plugins/engine/components/FormComponent.js +22 -0
- package/.server/server/plugins/engine/components/FormComponent.js.map +1 -1
- package/.server/server/plugins/engine/components/GeospatialField.d.ts +77 -0
- package/.server/server/plugins/engine/components/GeospatialField.js +102 -0
- package/.server/server/plugins/engine/components/GeospatialField.js.map +1 -0
- package/.server/server/plugins/engine/components/helpers/__stubs__/geospatial.d.ts +3 -0
- package/.server/server/plugins/engine/components/helpers/__stubs__/geospatial.js +63 -0
- package/.server/server/plugins/engine/components/helpers/__stubs__/geospatial.js.map +1 -0
- package/.server/server/plugins/engine/components/helpers/components.d.ts +1 -1
- package/.server/server/plugins/engine/components/helpers/components.js +7 -0
- package/.server/server/plugins/engine/components/helpers/components.js.map +1 -1
- package/.server/server/plugins/engine/components/helpers/geospatial.d.ts +6 -0
- package/.server/server/plugins/engine/components/helpers/geospatial.js +71 -0
- package/.server/server/plugins/engine/components/helpers/geospatial.js.map +1 -0
- package/.server/server/plugins/engine/components/helpers/geospatial.test.js +42 -0
- package/.server/server/plugins/engine/components/helpers/geospatial.test.js.map +1 -0
- package/.server/server/plugins/engine/components/index.d.ts +1 -0
- package/.server/server/plugins/engine/components/index.js +1 -0
- package/.server/server/plugins/engine/components/index.js.map +1 -1
- package/.server/server/plugins/engine/models/FormModel.js +0 -4
- package/.server/server/plugins/engine/models/FormModel.js.map +1 -1
- package/.server/server/plugins/engine/pageControllers/PageController.d.ts +1 -0
- package/.server/server/plugins/engine/pageControllers/PageController.js +2 -0
- package/.server/server/plugins/engine/pageControllers/PageController.js.map +1 -1
- package/.server/server/plugins/engine/pageControllers/QuestionPageController.js +2 -4
- package/.server/server/plugins/engine/pageControllers/QuestionPageController.js.map +1 -1
- package/.server/server/plugins/engine/pageControllers/helpers/state.d.ts +8 -7
- package/.server/server/plugins/engine/pageControllers/helpers/state.js +39 -12
- package/.server/server/plugins/engine/pageControllers/helpers/state.js.map +1 -1
- package/.server/server/plugins/engine/pageControllers/helpers/submission.js +13 -1
- package/.server/server/plugins/engine/pageControllers/helpers/submission.js.map +1 -1
- package/.server/server/plugins/engine/pageControllers/validationOptions.js +2 -1
- package/.server/server/plugins/engine/pageControllers/validationOptions.js.map +1 -1
- package/.server/server/plugins/engine/routes/index.js +8 -1
- package/.server/server/plugins/engine/routes/index.js.map +1 -1
- package/.server/server/plugins/engine/types.d.ts +63 -2
- package/.server/server/plugins/engine/types.js +33 -0
- package/.server/server/plugins/engine/types.js.map +1 -1
- package/.server/server/plugins/engine/views/components/geospatialfield.html +7 -0
- package/.server/server/plugins/nunjucks/context.test.js.map +1 -1
- package/.server/server/plugins/nunjucks/filters/field.d.ts +1 -1
- package/.server/server/routes/types.js.map +1 -1
- package/.server/server/services/cacheService.js +3 -0
- package/.server/server/services/cacheService.js.map +1 -1
- package/package.json +9 -5
- package/src/client/javascripts/geospatial-map.js +1023 -0
- package/src/client/javascripts/location-map.js +94 -390
- package/src/client/javascripts/map.js +389 -0
- package/src/client/javascripts/shared.js +3 -1
- package/src/client/stylesheets/shared.scss +7 -0
- package/src/server/plugins/engine/components/ComponentBase.ts +2 -0
- package/src/server/plugins/engine/components/FormComponent.ts +29 -0
- package/src/server/plugins/engine/components/GeospatialField.test.ts +380 -0
- package/src/server/plugins/engine/components/GeospatialField.ts +145 -0
- package/src/server/plugins/engine/components/helpers/__stubs__/geospatial.ts +85 -0
- package/src/server/plugins/engine/components/helpers/components.test.ts +44 -0
- package/src/server/plugins/engine/components/helpers/components.ts +10 -0
- package/src/server/plugins/engine/components/helpers/geospatial.test.js +55 -0
- package/src/server/plugins/engine/components/helpers/geospatial.ts +93 -0
- package/src/server/plugins/engine/components/index.ts +1 -0
- package/src/server/plugins/engine/models/FormModel.ts +0 -4
- package/src/server/plugins/engine/pageControllers/PageController.ts +2 -0
- package/src/server/plugins/engine/pageControllers/QuestionPageController.ts +2 -6
- package/src/server/plugins/engine/pageControllers/helpers/state.test.ts +80 -16
- package/src/server/plugins/engine/pageControllers/helpers/state.ts +57 -17
- package/src/server/plugins/engine/pageControllers/helpers/submission.test.ts +74 -0
- package/src/server/plugins/engine/pageControllers/helpers/submission.ts +17 -1
- package/src/server/plugins/engine/pageControllers/validationOptions.ts +3 -1
- package/src/server/plugins/engine/routes/index.test.ts +4 -2
- package/src/server/plugins/engine/routes/index.ts +13 -1
- package/src/server/plugins/engine/types.ts +77 -4
- package/src/server/plugins/engine/views/components/geospatialfield.html +7 -0
- package/src/server/plugins/nunjucks/context.test.js +2 -3
- package/src/server/routes/types.ts +4 -2
- package/src/server/services/cacheService.ts +2 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts lat long to easting and northing
|
|
3
|
+
* @param {object} param
|
|
4
|
+
* @param {number} param.lat
|
|
5
|
+
* @param {number} param.long
|
|
6
|
+
* @returns {{ easting: number, northing: number }}
|
|
7
|
+
*/
|
|
8
|
+
export function latLongToEastingNorthing({ lat, long }: {
|
|
9
|
+
lat: number;
|
|
10
|
+
long: number;
|
|
11
|
+
}): {
|
|
12
|
+
easting: number;
|
|
13
|
+
northing: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Converts easting and northing to lat long
|
|
17
|
+
* @param {object} param
|
|
18
|
+
* @param {number} param.easting
|
|
19
|
+
* @param {number} param.northing
|
|
20
|
+
* @returns {{ lat: number, long: number }}
|
|
21
|
+
*/
|
|
22
|
+
export function eastingNorthingToLatLong({ easting, northing }: {
|
|
23
|
+
easting: number;
|
|
24
|
+
northing: number;
|
|
25
|
+
}): {
|
|
26
|
+
lat: number;
|
|
27
|
+
long: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Converts lat long to an ordnance survey grid reference
|
|
31
|
+
* @param {object} param
|
|
32
|
+
* @param {number} param.lat
|
|
33
|
+
* @param {number} param.long
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
export function latLongToOsGridRef({ lat, long }: {
|
|
37
|
+
lat: number;
|
|
38
|
+
long: number;
|
|
39
|
+
}): string;
|
|
40
|
+
/**
|
|
41
|
+
* Converts an ordnance survey grid reference to lat long
|
|
42
|
+
* @param {string} osGridRef
|
|
43
|
+
* @returns {{ lat: number, long: number }}
|
|
44
|
+
*/
|
|
45
|
+
export function osGridRefToLatLong(osGridRef: string): {
|
|
46
|
+
lat: number;
|
|
47
|
+
long: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Get the grid ref from the first coordinate of a long/lat feature
|
|
51
|
+
* @param {Feature} feature
|
|
52
|
+
*/
|
|
53
|
+
export function getCoordinateGridRef(feature: Feature): any;
|
|
54
|
+
/**
|
|
55
|
+
* Get the centroid grid ref from a long/lat feature
|
|
56
|
+
* @param {Feature} feature
|
|
57
|
+
*/
|
|
58
|
+
export function getCentroidGridRef(feature: Feature): any;
|
|
59
|
+
/**
|
|
60
|
+
* Make a form submit handler that only allows submissions from allowed buttons
|
|
61
|
+
* @param {HTMLButtonElement[]} buttons - the form buttons to allow submissions
|
|
62
|
+
*/
|
|
63
|
+
export function formSubmitFactory(buttons: HTMLButtonElement[]): (e: SubmitEvent) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Initialise location maps
|
|
66
|
+
* @param {Partial<MapsEnvironmentConfig>} config - the map configuration
|
|
67
|
+
*/
|
|
68
|
+
export function initMaps(config?: Partial<MapsEnvironmentConfig>): void;
|
|
69
|
+
/**
|
|
70
|
+
* OS API request proxy factory
|
|
71
|
+
* @param {string} apiPath - the root API path
|
|
72
|
+
*/
|
|
73
|
+
export function makeTileRequestTransformer(apiPath: string): (url: string, resourceType: string) => {
|
|
74
|
+
url: string;
|
|
75
|
+
headers: {};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Create a Defra map instance
|
|
79
|
+
* @param {string} mapId - the map id
|
|
80
|
+
* @param {InteractiveMapInitConfig} initConfig - the map initial configuration
|
|
81
|
+
* @param {MapsEnvironmentConfig} mapsConfig - the map environment params
|
|
82
|
+
*/
|
|
83
|
+
export function createMap(mapId: string, initConfig: InteractiveMapInitConfig, mapsConfig: MapsEnvironmentConfig): {
|
|
84
|
+
map: InteractiveMap;
|
|
85
|
+
interactPlugin: any;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Updates the marker position and moves the map view port the new location
|
|
89
|
+
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
|
|
90
|
+
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
|
|
91
|
+
* @param {MapCenter} center - the point
|
|
92
|
+
*/
|
|
93
|
+
export function centerMap(map: InteractiveMap, mapProvider: MapLibreMap, center: MapCenter): void;
|
|
94
|
+
/** @type {InteractiveMapInitConfig} */
|
|
95
|
+
export const defaultConfig: InteractiveMapInitConfig;
|
|
96
|
+
export namespace EVENTS {
|
|
97
|
+
let mapReady: string;
|
|
98
|
+
let interactMarkerChange: string;
|
|
99
|
+
let drawReady: string;
|
|
100
|
+
let drawCreated: string;
|
|
101
|
+
let drawEdited: string;
|
|
102
|
+
let drawCancelled: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* - an instance of a InteractiveMap
|
|
106
|
+
*/
|
|
107
|
+
export type InteractiveMap = {
|
|
108
|
+
/**
|
|
109
|
+
* - register callback listeners to map events
|
|
110
|
+
*/
|
|
111
|
+
on: Function;
|
|
112
|
+
/**
|
|
113
|
+
* - adds a new panel to the map
|
|
114
|
+
*/
|
|
115
|
+
addPanel: Function;
|
|
116
|
+
/**
|
|
117
|
+
* - adds/updates a marker
|
|
118
|
+
*/
|
|
119
|
+
addMarker: Function;
|
|
120
|
+
/**
|
|
121
|
+
* - removes a marker
|
|
122
|
+
*/
|
|
123
|
+
removeMarker: Function;
|
|
124
|
+
/**
|
|
125
|
+
* - adds/updates a button
|
|
126
|
+
*/
|
|
127
|
+
addButton: Function;
|
|
128
|
+
/**
|
|
129
|
+
* - toggle the state of a button
|
|
130
|
+
*/
|
|
131
|
+
toggleButtonState: Function;
|
|
132
|
+
};
|
|
133
|
+
export type MapLibreMap = {
|
|
134
|
+
/**
|
|
135
|
+
* - pans/zooms to a new location
|
|
136
|
+
*/
|
|
137
|
+
flyTo: Function;
|
|
138
|
+
/**
|
|
139
|
+
* - fits the my to the new bounds
|
|
140
|
+
*/
|
|
141
|
+
fitBounds: Function;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* - Map center point as [long, lat]
|
|
145
|
+
*/
|
|
146
|
+
export type MapCenter = [number, number];
|
|
147
|
+
/**
|
|
148
|
+
* - additional config that can be provided to InteractiveMap
|
|
149
|
+
*/
|
|
150
|
+
export type InteractiveMapInitConfig = {
|
|
151
|
+
/**
|
|
152
|
+
* - the zoom level of the map
|
|
153
|
+
*/
|
|
154
|
+
zoom: string;
|
|
155
|
+
/**
|
|
156
|
+
* - the center point of the map
|
|
157
|
+
*/
|
|
158
|
+
center: MapCenter;
|
|
159
|
+
/**
|
|
160
|
+
* - the markers to add to the map
|
|
161
|
+
*/
|
|
162
|
+
markers?: {
|
|
163
|
+
id: string;
|
|
164
|
+
coords: MapCenter;
|
|
165
|
+
}[] | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* - additional plugins
|
|
168
|
+
*/
|
|
169
|
+
plugins?: any[] | undefined;
|
|
170
|
+
};
|
|
171
|
+
export type TileData = {
|
|
172
|
+
/**
|
|
173
|
+
* - the outdoor tile URL
|
|
174
|
+
*/
|
|
175
|
+
VTS_OUTDOOR_URL: string;
|
|
176
|
+
/**
|
|
177
|
+
* - the dark tile URL
|
|
178
|
+
*/
|
|
179
|
+
VTS_DARK_URL: string;
|
|
180
|
+
/**
|
|
181
|
+
* - the black and white tile URL
|
|
182
|
+
*/
|
|
183
|
+
VTS_BLACK_AND_WHITE_URL: string;
|
|
184
|
+
};
|
|
185
|
+
export type MapsEnvironmentConfig = {
|
|
186
|
+
/**
|
|
187
|
+
* - the root asset path
|
|
188
|
+
*/
|
|
189
|
+
assetPath: string;
|
|
190
|
+
/**
|
|
191
|
+
* - the root API path
|
|
192
|
+
*/
|
|
193
|
+
apiPath: string;
|
|
194
|
+
/**
|
|
195
|
+
* - the tile data config
|
|
196
|
+
*/
|
|
197
|
+
data: TileData;
|
|
198
|
+
};
|
|
199
|
+
import type { Feature } from '~/src/server/plugins/engine/types.js';
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { centroid } from '@turf/centroid';
|
|
2
|
+
// @ts-expect-error - no types
|
|
3
|
+
import OsGridRef, { LatLon } from 'geodesy/osgridref.js';
|
|
4
|
+
import { processGeospatial } from "./geospatial-map.js";
|
|
5
|
+
import { processLocation } from "./location-map.js";
|
|
6
|
+
|
|
7
|
+
// Center of UK
|
|
8
|
+
const DEFAULT_LAT = 53.825564;
|
|
9
|
+
const DEFAULT_LONG = -2.421975;
|
|
10
|
+
const COMPANY_SYMBOL_CODE = 169;
|
|
11
|
+
const defaultData = {
|
|
12
|
+
VTS_OUTDOOR_URL: '/api/maps/vts/OS_VTS_3857_Outdoor.json',
|
|
13
|
+
VTS_DARK_URL: '/api/maps/vts/OS_VTS_3857_Dark.json',
|
|
14
|
+
VTS_BLACK_AND_WHITE_URL: '/api/maps/vts/OS_VTS_3857_Black_and_White.json'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Converts lat long to easting and northing
|
|
19
|
+
* @param {object} param
|
|
20
|
+
* @param {number} param.lat
|
|
21
|
+
* @param {number} param.long
|
|
22
|
+
* @returns {{ easting: number, northing: number }}
|
|
23
|
+
*/
|
|
24
|
+
export function latLongToEastingNorthing({
|
|
25
|
+
lat,
|
|
26
|
+
long
|
|
27
|
+
}) {
|
|
28
|
+
const point = new LatLon(lat, long);
|
|
29
|
+
return point.toOsGrid();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Converts easting and northing to lat long
|
|
34
|
+
* @param {object} param
|
|
35
|
+
* @param {number} param.easting
|
|
36
|
+
* @param {number} param.northing
|
|
37
|
+
* @returns {{ lat: number, long: number }}
|
|
38
|
+
*/
|
|
39
|
+
export function eastingNorthingToLatLong({
|
|
40
|
+
easting,
|
|
41
|
+
northing
|
|
42
|
+
}) {
|
|
43
|
+
const point = new OsGridRef(easting, northing);
|
|
44
|
+
const latLong = point.toLatLon();
|
|
45
|
+
return {
|
|
46
|
+
lat: latLong.latitude,
|
|
47
|
+
long: latLong.longitude
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Converts lat long to an ordnance survey grid reference
|
|
53
|
+
* @param {object} param
|
|
54
|
+
* @param {number} param.lat
|
|
55
|
+
* @param {number} param.long
|
|
56
|
+
* @returns {string}
|
|
57
|
+
*/
|
|
58
|
+
export function latLongToOsGridRef({
|
|
59
|
+
lat,
|
|
60
|
+
long
|
|
61
|
+
}) {
|
|
62
|
+
const point = new LatLon(lat, long);
|
|
63
|
+
return point.toOsGrid().toString();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Converts an ordnance survey grid reference to lat long
|
|
68
|
+
* @param {string} osGridRef
|
|
69
|
+
* @returns {{ lat: number, long: number }}
|
|
70
|
+
*/
|
|
71
|
+
export function osGridRefToLatLong(osGridRef) {
|
|
72
|
+
const point = OsGridRef.parse(osGridRef);
|
|
73
|
+
const latLong = point.toLatLon();
|
|
74
|
+
return {
|
|
75
|
+
lat: latLong.latitude,
|
|
76
|
+
long: latLong.longitude
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get the grid ref from the first coordinate of a long/lat feature
|
|
82
|
+
* @param {Feature} feature
|
|
83
|
+
*/
|
|
84
|
+
export function getCoordinateGridRef(feature) {
|
|
85
|
+
if (feature.geometry.type === 'Point') {
|
|
86
|
+
const [long, lat] = feature.geometry.coordinates;
|
|
87
|
+
const point = new LatLon(lat, long);
|
|
88
|
+
return point.toOsGrid().toString();
|
|
89
|
+
} else if (feature.geometry.type === 'LineString') {
|
|
90
|
+
const [long, lat] = feature.geometry.coordinates[0];
|
|
91
|
+
const point = new LatLon(lat, long);
|
|
92
|
+
return point.toOsGrid().toString();
|
|
93
|
+
} else {
|
|
94
|
+
const [long, lat] = feature.geometry.coordinates[0][0];
|
|
95
|
+
const point = new LatLon(lat, long);
|
|
96
|
+
return point.toOsGrid().toString();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get the centroid grid ref from a long/lat feature
|
|
102
|
+
* @param {Feature} feature
|
|
103
|
+
*/
|
|
104
|
+
export function getCentroidGridRef(feature) {
|
|
105
|
+
if (feature.geometry.type === 'Point') {
|
|
106
|
+
const [long, lat] = feature.geometry.coordinates;
|
|
107
|
+
const point = new LatLon(lat, long);
|
|
108
|
+
return point.toOsGrid().toString();
|
|
109
|
+
} else {
|
|
110
|
+
const centre = centroid(feature);
|
|
111
|
+
const [long, lat] = centre.geometry.coordinates;
|
|
112
|
+
const point = new LatLon(lat, long);
|
|
113
|
+
return point.toOsGrid().toString();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** @type {InteractiveMapInitConfig} */
|
|
118
|
+
export const defaultConfig = {
|
|
119
|
+
zoom: '6',
|
|
120
|
+
center: [DEFAULT_LONG, DEFAULT_LAT]
|
|
121
|
+
};
|
|
122
|
+
export const EVENTS = {
|
|
123
|
+
mapReady: 'map:ready',
|
|
124
|
+
interactMarkerChange: 'interact:markerchange',
|
|
125
|
+
drawReady: 'draw:ready',
|
|
126
|
+
drawCreated: 'draw:created',
|
|
127
|
+
drawEdited: 'draw:edited',
|
|
128
|
+
drawCancelled: 'draw:cancelled'
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Make a form submit handler that only allows submissions from allowed buttons
|
|
133
|
+
* @param {HTMLButtonElement[]} buttons - the form buttons to allow submissions
|
|
134
|
+
*/
|
|
135
|
+
export function formSubmitFactory(buttons) {
|
|
136
|
+
/**
|
|
137
|
+
* The submit handler
|
|
138
|
+
* @param {SubmitEvent} e
|
|
139
|
+
*/
|
|
140
|
+
const onFormSubmit = function (e) {
|
|
141
|
+
if (!(e.submitter instanceof HTMLButtonElement) || !buttons.includes(e.submitter)) {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
return onFormSubmit;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Initialise location maps
|
|
150
|
+
* @param {Partial<MapsEnvironmentConfig>} config - the map configuration
|
|
151
|
+
*/
|
|
152
|
+
export function initMaps(config = {}) {
|
|
153
|
+
const {
|
|
154
|
+
assetPath = '/assets',
|
|
155
|
+
apiPath = '/form/api',
|
|
156
|
+
data = defaultData
|
|
157
|
+
} = config;
|
|
158
|
+
const locations = document.querySelectorAll('.app-location-field');
|
|
159
|
+
const geospatials = document.querySelectorAll('.app-geospatial-field');
|
|
160
|
+
|
|
161
|
+
// TODO: Fix this in `interactive-map`
|
|
162
|
+
// If there are location components on the page fix up the main form submit
|
|
163
|
+
// handler so it doesn't fire when using the integrated map search feature
|
|
164
|
+
if (locations.length) {
|
|
165
|
+
const form = locations[0].closest('form');
|
|
166
|
+
if (form === null) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const buttons = Array.from(form.querySelectorAll('button'));
|
|
170
|
+
form.addEventListener('submit', formSubmitFactory(buttons), false);
|
|
171
|
+
}
|
|
172
|
+
if (geospatials.length) {
|
|
173
|
+
const form = geospatials[0].closest('form');
|
|
174
|
+
if (form === null) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const buttons = Array.from(form.querySelectorAll('button'));
|
|
178
|
+
form.addEventListener('submit', formSubmitFactory(buttons), false);
|
|
179
|
+
}
|
|
180
|
+
locations.forEach((location, index) => {
|
|
181
|
+
processLocation({
|
|
182
|
+
assetPath,
|
|
183
|
+
apiPath,
|
|
184
|
+
data
|
|
185
|
+
}, location, index);
|
|
186
|
+
});
|
|
187
|
+
geospatials.forEach((geospatial, index) => {
|
|
188
|
+
processGeospatial({
|
|
189
|
+
assetPath,
|
|
190
|
+
apiPath,
|
|
191
|
+
data
|
|
192
|
+
}, geospatial, index);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* OS API request proxy factory
|
|
198
|
+
* @param {string} apiPath - the root API path
|
|
199
|
+
*/
|
|
200
|
+
export function makeTileRequestTransformer(apiPath) {
|
|
201
|
+
/**
|
|
202
|
+
* Proxy OS API requests via our server
|
|
203
|
+
* @param {string} url - the request URL
|
|
204
|
+
* @param {string} resourceType - the resource type
|
|
205
|
+
*/
|
|
206
|
+
return function transformTileRequest(url, resourceType) {
|
|
207
|
+
if (url.startsWith('https://api.os.uk')) {
|
|
208
|
+
if (resourceType === 'Tile') {
|
|
209
|
+
return {
|
|
210
|
+
url: url.replace('https://api.os.uk/maps/vector/v1/vts', `${window.location.origin}${apiPath}`),
|
|
211
|
+
headers: {}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
if (resourceType !== 'Style') {
|
|
215
|
+
return {
|
|
216
|
+
url: `${apiPath}/map-proxy?url=${encodeURIComponent(url)}`,
|
|
217
|
+
headers: {}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const spritesPath = 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main';
|
|
222
|
+
|
|
223
|
+
// Proxy sprite requests
|
|
224
|
+
if (url.startsWith(spritesPath)) {
|
|
225
|
+
const path = url.substring(spritesPath.length);
|
|
226
|
+
return {
|
|
227
|
+
url: `${apiPath}/maps/vts${path}`,
|
|
228
|
+
headers: {}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
url,
|
|
233
|
+
headers: {}
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Create a Defra map instance
|
|
240
|
+
* @param {string} mapId - the map id
|
|
241
|
+
* @param {InteractiveMapInitConfig} initConfig - the map initial configuration
|
|
242
|
+
* @param {MapsEnvironmentConfig} mapsConfig - the map environment params
|
|
243
|
+
*/
|
|
244
|
+
export function createMap(mapId, initConfig, mapsConfig) {
|
|
245
|
+
const {
|
|
246
|
+
assetPath,
|
|
247
|
+
apiPath,
|
|
248
|
+
data = defaultData
|
|
249
|
+
} = mapsConfig;
|
|
250
|
+
const logoAltText = 'Ordnance survey logo';
|
|
251
|
+
|
|
252
|
+
// @ts-expect-error - Defra namespace currently comes from UMD support files
|
|
253
|
+
const defra = window.defra;
|
|
254
|
+
const interactPlugin = defra.interactPlugin({
|
|
255
|
+
markerColor: {
|
|
256
|
+
outdoor: '#ff0000',
|
|
257
|
+
dark: '#00ff00'
|
|
258
|
+
},
|
|
259
|
+
interactionMode: 'marker',
|
|
260
|
+
multiSelect: false
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
/** @type {InteractiveMap} */
|
|
264
|
+
const map = new defra.InteractiveMap(mapId, {
|
|
265
|
+
enableFullscreen: true,
|
|
266
|
+
autoColorScheme: false,
|
|
267
|
+
mapProvider: defra.maplibreProvider(),
|
|
268
|
+
reverseGeocodeProvider: defra.openNamesProvider({
|
|
269
|
+
url: `${apiPath}/reverse-geocode-proxy?easting={easting}&northing={northing}`
|
|
270
|
+
}),
|
|
271
|
+
behaviour: 'inline',
|
|
272
|
+
minZoom: 6,
|
|
273
|
+
maxZoom: 18,
|
|
274
|
+
containerHeight: '400px',
|
|
275
|
+
enableZoomControls: true,
|
|
276
|
+
transformRequest: makeTileRequestTransformer(apiPath),
|
|
277
|
+
...initConfig,
|
|
278
|
+
plugins: [defra.mapStylesPlugin({
|
|
279
|
+
mapStyles: [{
|
|
280
|
+
id: 'outdoor',
|
|
281
|
+
label: 'Outdoor',
|
|
282
|
+
url: data.VTS_OUTDOOR_URL,
|
|
283
|
+
thumbnail: `${assetPath}/interactive-map/assets/images/outdoor-map-thumb.jpg`,
|
|
284
|
+
logo: `${assetPath}/interactive-map/assets/images/os-logo.svg`,
|
|
285
|
+
logoAltText,
|
|
286
|
+
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`,
|
|
287
|
+
backgroundColor: '#f5f5f0'
|
|
288
|
+
}, {
|
|
289
|
+
id: 'dark',
|
|
290
|
+
label: 'Dark',
|
|
291
|
+
url: data.VTS_DARK_URL,
|
|
292
|
+
mapColorScheme: 'dark',
|
|
293
|
+
appColorScheme: 'dark',
|
|
294
|
+
thumbnail: `${assetPath}/interactive-map/assets/images/dark-map-thumb.jpg`,
|
|
295
|
+
logo: `${assetPath}/interactive-map/assets/images/os-logo-white.svg`,
|
|
296
|
+
logoAltText,
|
|
297
|
+
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`
|
|
298
|
+
}, {
|
|
299
|
+
id: 'black-and-white',
|
|
300
|
+
label: 'Black/White',
|
|
301
|
+
url: data.VTS_BLACK_AND_WHITE_URL,
|
|
302
|
+
thumbnail: `${assetPath}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,
|
|
303
|
+
logo: `${assetPath}/interactive-map/assets/images/os-logo-black.svg`,
|
|
304
|
+
logoAltText,
|
|
305
|
+
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`
|
|
306
|
+
}]
|
|
307
|
+
}), interactPlugin, defra.searchPlugin({
|
|
308
|
+
osNamesURL: `${apiPath}/geocode-proxy?query={query}`,
|
|
309
|
+
width: '300px',
|
|
310
|
+
showMarker: false
|
|
311
|
+
}), defra.scaleBarPlugin({
|
|
312
|
+
units: 'metric'
|
|
313
|
+
}), ...(initConfig.plugins ?? [])]
|
|
314
|
+
});
|
|
315
|
+
return {
|
|
316
|
+
map,
|
|
317
|
+
interactPlugin
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Updates the marker position and moves the map view port the new location
|
|
323
|
+
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
|
|
324
|
+
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
|
|
325
|
+
* @param {MapCenter} center - the point
|
|
326
|
+
*/
|
|
327
|
+
export function centerMap(map, mapProvider, center) {
|
|
328
|
+
// Move the 'location' marker to the new point
|
|
329
|
+
map.addMarker('location', center);
|
|
330
|
+
|
|
331
|
+
// Pan & zoom the map to the new valid location
|
|
332
|
+
mapProvider.flyTo({
|
|
333
|
+
center,
|
|
334
|
+
zoom: 14,
|
|
335
|
+
essential: true
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* @typedef {object} InteractiveMap - an instance of a InteractiveMap
|
|
341
|
+
* @property {Function} on - register callback listeners to map events
|
|
342
|
+
* @property {Function} addPanel - adds a new panel to the map
|
|
343
|
+
* @property {Function} addMarker - adds/updates a marker
|
|
344
|
+
* @property {Function} removeMarker - removes a marker
|
|
345
|
+
* @property {Function} addButton - adds/updates a button
|
|
346
|
+
* @property {Function} toggleButtonState - toggle the state of a button
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* @typedef {object} MapLibreMap
|
|
351
|
+
* @property {Function} flyTo - pans/zooms to a new location
|
|
352
|
+
* @property {Function} fitBounds - fits the my to the new bounds
|
|
353
|
+
*/
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* @typedef {[number, number]} MapCenter - Map center point as [long, lat]
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* @typedef {object} InteractiveMapInitConfig - additional config that can be provided to InteractiveMap
|
|
361
|
+
* @property {string} zoom - the zoom level of the map
|
|
362
|
+
* @property {MapCenter} center - the center point of the map
|
|
363
|
+
* @property {{ id: string, coords: MapCenter }[]} [markers] - the markers to add to the map
|
|
364
|
+
* @property {any[]} [plugins] - additional plugins
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @typedef {object} TileData
|
|
369
|
+
* @property {string} VTS_OUTDOOR_URL - the outdoor tile URL
|
|
370
|
+
* @property {string} VTS_DARK_URL - the dark tile URL
|
|
371
|
+
* @property {string} VTS_BLACK_AND_WHITE_URL - the black and white tile URL
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* @typedef {object} MapsEnvironmentConfig
|
|
376
|
+
* @property {string} assetPath - the root asset path
|
|
377
|
+
* @property {string} apiPath - the root API path
|
|
378
|
+
* @property {TileData} data - the tile data config
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* @import { Feature } from '~/src/server/plugins/engine/types.js'
|
|
383
|
+
*/
|
|
384
|
+
//# sourceMappingURL=map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","names":["centroid","OsGridRef","LatLon","processGeospatial","processLocation","DEFAULT_LAT","DEFAULT_LONG","COMPANY_SYMBOL_CODE","defaultData","VTS_OUTDOOR_URL","VTS_DARK_URL","VTS_BLACK_AND_WHITE_URL","latLongToEastingNorthing","lat","long","point","toOsGrid","eastingNorthingToLatLong","easting","northing","latLong","toLatLon","latitude","longitude","latLongToOsGridRef","toString","osGridRefToLatLong","osGridRef","parse","getCoordinateGridRef","feature","geometry","type","coordinates","getCentroidGridRef","centre","defaultConfig","zoom","center","EVENTS","mapReady","interactMarkerChange","drawReady","drawCreated","drawEdited","drawCancelled","formSubmitFactory","buttons","onFormSubmit","e","submitter","HTMLButtonElement","includes","preventDefault","initMaps","config","assetPath","apiPath","data","locations","document","querySelectorAll","geospatials","length","form","closest","Array","from","addEventListener","forEach","location","index","geospatial","makeTileRequestTransformer","transformTileRequest","url","resourceType","startsWith","replace","window","origin","headers","encodeURIComponent","spritesPath","path","substring","createMap","mapId","initConfig","mapsConfig","logoAltText","defra","interactPlugin","markerColor","outdoor","dark","interactionMode","multiSelect","map","InteractiveMap","enableFullscreen","autoColorScheme","mapProvider","maplibreProvider","reverseGeocodeProvider","openNamesProvider","behaviour","minZoom","maxZoom","containerHeight","enableZoomControls","transformRequest","plugins","mapStylesPlugin","mapStyles","id","label","thumbnail","logo","attribution","String","fromCodePoint","Date","getFullYear","backgroundColor","mapColorScheme","appColorScheme","searchPlugin","osNamesURL","width","showMarker","scaleBarPlugin","units","centerMap","addMarker","flyTo","essential"],"sources":["../../../src/client/javascripts/map.js"],"sourcesContent":["import { centroid } from '@turf/centroid'\n// @ts-expect-error - no types\nimport OsGridRef, { LatLon } from 'geodesy/osgridref.js'\n\nimport { processGeospatial } from '~/src/client/javascripts/geospatial-map.js'\nimport { processLocation } from '~/src/client/javascripts/location-map.js'\n\n// Center of UK\nconst DEFAULT_LAT = 53.825564\nconst DEFAULT_LONG = -2.421975\nconst COMPANY_SYMBOL_CODE = 169\n\nconst defaultData = {\n VTS_OUTDOOR_URL: '/api/maps/vts/OS_VTS_3857_Outdoor.json',\n VTS_DARK_URL: '/api/maps/vts/OS_VTS_3857_Dark.json',\n VTS_BLACK_AND_WHITE_URL: '/api/maps/vts/OS_VTS_3857_Black_and_White.json'\n}\n\n/**\n * Converts lat long to easting and northing\n * @param {object} param\n * @param {number} param.lat\n * @param {number} param.long\n * @returns {{ easting: number, northing: number }}\n */\nexport function latLongToEastingNorthing({ lat, long }) {\n const point = new LatLon(lat, long)\n\n return point.toOsGrid()\n}\n\n/**\n * Converts easting and northing to lat long\n * @param {object} param\n * @param {number} param.easting\n * @param {number} param.northing\n * @returns {{ lat: number, long: number }}\n */\nexport function eastingNorthingToLatLong({ easting, northing }) {\n const point = new OsGridRef(easting, northing)\n const latLong = point.toLatLon()\n\n return { lat: latLong.latitude, long: latLong.longitude }\n}\n\n/**\n * Converts lat long to an ordnance survey grid reference\n * @param {object} param\n * @param {number} param.lat\n * @param {number} param.long\n * @returns {string}\n */\nexport function latLongToOsGridRef({ lat, long }) {\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n}\n\n/**\n * Converts an ordnance survey grid reference to lat long\n * @param {string} osGridRef\n * @returns {{ lat: number, long: number }}\n */\nexport function osGridRefToLatLong(osGridRef) {\n const point = OsGridRef.parse(osGridRef)\n const latLong = point.toLatLon()\n\n return { lat: latLong.latitude, long: latLong.longitude }\n}\n\n/**\n * Get the grid ref from the first coordinate of a long/lat feature\n * @param {Feature} feature\n */\nexport function getCoordinateGridRef(feature) {\n if (feature.geometry.type === 'Point') {\n const [long, lat] = feature.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else if (feature.geometry.type === 'LineString') {\n const [long, lat] = feature.geometry.coordinates[0]\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else {\n const [long, lat] = feature.geometry.coordinates[0][0]\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n }\n}\n\n/**\n * Get the centroid grid ref from a long/lat feature\n * @param {Feature} feature\n */\nexport function getCentroidGridRef(feature) {\n if (feature.geometry.type === 'Point') {\n const [long, lat] = feature.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else {\n const centre = centroid(feature)\n const [long, lat] = centre.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n }\n}\n\n/** @type {InteractiveMapInitConfig} */\nexport const defaultConfig = {\n zoom: '6',\n center: [DEFAULT_LONG, DEFAULT_LAT]\n}\n\nexport const EVENTS = {\n mapReady: 'map:ready',\n interactMarkerChange: 'interact:markerchange',\n drawReady: 'draw:ready',\n drawCreated: 'draw:created',\n drawEdited: 'draw:edited',\n drawCancelled: 'draw:cancelled'\n}\n\n/**\n * Make a form submit handler that only allows submissions from allowed buttons\n * @param {HTMLButtonElement[]} buttons - the form buttons to allow submissions\n */\nexport function formSubmitFactory(buttons) {\n /**\n * The submit handler\n * @param {SubmitEvent} e\n */\n const onFormSubmit = function (e) {\n if (\n !(e.submitter instanceof HTMLButtonElement) ||\n !buttons.includes(e.submitter)\n ) {\n e.preventDefault()\n }\n }\n\n return onFormSubmit\n}\n\n/**\n * Initialise location maps\n * @param {Partial<MapsEnvironmentConfig>} config - the map configuration\n */\nexport function initMaps(config = {}) {\n const {\n assetPath = '/assets',\n apiPath = '/form/api',\n data = defaultData\n } = config\n const locations = document.querySelectorAll('.app-location-field')\n const geospatials = document.querySelectorAll('.app-geospatial-field')\n\n // TODO: Fix this in `interactive-map`\n // If there are location components on the page fix up the main form submit\n // handler so it doesn't fire when using the integrated map search feature\n if (locations.length) {\n const form = locations[0].closest('form')\n\n if (form === null) {\n return\n }\n\n const buttons = Array.from(form.querySelectorAll('button'))\n form.addEventListener('submit', formSubmitFactory(buttons), false)\n }\n\n if (geospatials.length) {\n const form = geospatials[0].closest('form')\n\n if (form === null) {\n return\n }\n\n const buttons = Array.from(form.querySelectorAll('button'))\n form.addEventListener('submit', formSubmitFactory(buttons), false)\n }\n\n locations.forEach((location, index) => {\n processLocation({ assetPath, apiPath, data }, location, index)\n })\n\n geospatials.forEach((geospatial, index) => {\n processGeospatial({ assetPath, apiPath, data }, geospatial, index)\n })\n}\n\n/**\n * OS API request proxy factory\n * @param {string} apiPath - the root API path\n */\nexport function makeTileRequestTransformer(apiPath) {\n /**\n * Proxy OS API requests via our server\n * @param {string} url - the request URL\n * @param {string} resourceType - the resource type\n */\n return function transformTileRequest(url, resourceType) {\n if (url.startsWith('https://api.os.uk')) {\n if (resourceType === 'Tile') {\n return {\n url: url.replace(\n 'https://api.os.uk/maps/vector/v1/vts',\n `${window.location.origin}${apiPath}`\n ),\n headers: {}\n }\n }\n\n if (resourceType !== 'Style') {\n return {\n url: `${apiPath}/map-proxy?url=${encodeURIComponent(url)}`,\n headers: {}\n }\n }\n }\n\n const spritesPath =\n 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main'\n\n // Proxy sprite requests\n if (url.startsWith(spritesPath)) {\n const path = url.substring(spritesPath.length)\n return {\n url: `${apiPath}/maps/vts${path}`,\n headers: {}\n }\n }\n\n return { url, headers: {} }\n }\n}\n\n/**\n * Create a Defra map instance\n * @param {string} mapId - the map id\n * @param {InteractiveMapInitConfig} initConfig - the map initial configuration\n * @param {MapsEnvironmentConfig} mapsConfig - the map environment params\n */\nexport function createMap(mapId, initConfig, mapsConfig) {\n const { assetPath, apiPath, data = defaultData } = mapsConfig\n const logoAltText = 'Ordnance survey logo'\n\n // @ts-expect-error - Defra namespace currently comes from UMD support files\n const defra = window.defra\n\n const interactPlugin = defra.interactPlugin({\n markerColor: { outdoor: '#ff0000', dark: '#00ff00' },\n interactionMode: 'marker',\n multiSelect: false\n })\n\n /** @type {InteractiveMap} */\n const map = new defra.InteractiveMap(mapId, {\n enableFullscreen: true,\n autoColorScheme: false,\n mapProvider: defra.maplibreProvider(),\n reverseGeocodeProvider: defra.openNamesProvider({\n url: `${apiPath}/reverse-geocode-proxy?easting={easting}&northing={northing}`\n }),\n behaviour: 'inline',\n minZoom: 6,\n maxZoom: 18,\n containerHeight: '400px',\n enableZoomControls: true,\n transformRequest: makeTileRequestTransformer(apiPath),\n ...initConfig,\n plugins: [\n defra.mapStylesPlugin({\n mapStyles: [\n {\n id: 'outdoor',\n label: 'Outdoor',\n url: data.VTS_OUTDOOR_URL,\n thumbnail: `${assetPath}/interactive-map/assets/images/outdoor-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`,\n backgroundColor: '#f5f5f0'\n },\n {\n id: 'dark',\n label: 'Dark',\n url: data.VTS_DARK_URL,\n mapColorScheme: 'dark',\n appColorScheme: 'dark',\n thumbnail: `${assetPath}/interactive-map/assets/images/dark-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo-white.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`\n },\n {\n id: 'black-and-white',\n label: 'Black/White',\n url: data.VTS_BLACK_AND_WHITE_URL,\n thumbnail: `${assetPath}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo-black.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`\n }\n ]\n }),\n interactPlugin,\n defra.searchPlugin({\n osNamesURL: `${apiPath}/geocode-proxy?query={query}`,\n width: '300px',\n showMarker: false\n }),\n defra.scaleBarPlugin({\n units: 'metric'\n }),\n ...(initConfig.plugins ?? [])\n ]\n })\n\n return { map, interactPlugin }\n}\n\n/**\n * Updates the marker position and moves the map view port the new location\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n * @param {MapCenter} center - the point\n */\nexport function centerMap(map, mapProvider, center) {\n // Move the 'location' marker to the new point\n map.addMarker('location', center)\n\n // Pan & zoom the map to the new valid location\n mapProvider.flyTo({\n center,\n zoom: 14,\n essential: true\n })\n}\n\n/**\n * @typedef {object} InteractiveMap - an instance of a InteractiveMap\n * @property {Function} on - register callback listeners to map events\n * @property {Function} addPanel - adds a new panel to the map\n * @property {Function} addMarker - adds/updates a marker\n * @property {Function} removeMarker - removes a marker\n * @property {Function} addButton - adds/updates a button\n * @property {Function} toggleButtonState - toggle the state of a button\n */\n\n/**\n * @typedef {object} MapLibreMap\n * @property {Function} flyTo - pans/zooms to a new location\n * @property {Function} fitBounds - fits the my to the new bounds\n */\n\n/**\n * @typedef {[number, number]} MapCenter - Map center point as [long, lat]\n */\n\n/**\n * @typedef {object} InteractiveMapInitConfig - additional config that can be provided to InteractiveMap\n * @property {string} zoom - the zoom level of the map\n * @property {MapCenter} center - the center point of the map\n * @property {{ id: string, coords: MapCenter }[]} [markers] - the markers to add to the map\n * @property {any[]} [plugins] - additional plugins\n */\n\n/**\n * @typedef {object} TileData\n * @property {string} VTS_OUTDOOR_URL - the outdoor tile URL\n * @property {string} VTS_DARK_URL - the dark tile URL\n * @property {string} VTS_BLACK_AND_WHITE_URL - the black and white tile URL\n */\n\n/**\n * @typedef {object} MapsEnvironmentConfig\n * @property {string} assetPath - the root asset path\n * @property {string} apiPath - the root API path\n * @property {TileData} data - the tile data config\n */\n\n/**\n * @import { Feature } from '~/src/server/plugins/engine/types.js'\n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EAAe,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyC,SAASA,CAACnC,GAAG,EAAEI,WAAW,EAAEhE,MAAM,EAAE;EAClD;EACA4D,GAAG,CAACoC,SAAS,CAAC,UAAU,EAAEhG,MAAM,CAAC;;EAEjC;EACAgE,WAAW,CAACiC,KAAK,CAAC;IAChBjG,MAAM;IACND,IAAI,EAAE,EAAE;IACRmG,SAAS,EAAE;EACb,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","ignoreList":[]}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* Initialise all clientside components (but not maps as this will be an opt-in for now given the additional UMD assets that are required)
|
|
3
3
|
*/
|
|
4
4
|
export function initAll(): void;
|
|
5
|
-
export { initMaps } from "~/src/client/javascripts/
|
|
5
|
+
export { initMaps } from "~/src/client/javascripts/map.js";
|
|
6
|
+
export * as map from "~/src/client/javascripts/map.js";
|
|
7
|
+
export * as geospatialMap from "~/src/client/javascripts/geospatial-map.js";
|
|
6
8
|
export const initAllGovuk: typeof initAllGovukImp;
|
|
7
9
|
export const initAllAutocomplete: typeof initAllAutocompleteImp;
|
|
8
10
|
export const initFileUpload: typeof initFileUploadImp;
|
|
@@ -2,7 +2,9 @@ import { initAllAutocomplete as initAllAutocompleteImp } from "./autocomplete.js
|
|
|
2
2
|
import { initFileUpload as initFileUploadImp } from "./file-upload.js";
|
|
3
3
|
import { initAllGovuk as initAllGovukImp } from "./govuk.js";
|
|
4
4
|
import { initPreviewCloseLink as initPreviewCloseLinkImp } from "./preview-close-link.js";
|
|
5
|
-
export { initMaps } from "./
|
|
5
|
+
export { initMaps } from "./map.js";
|
|
6
|
+
export * as map from "./map.js";
|
|
7
|
+
export * as geospatialMap from "./geospatial-map.js";
|
|
6
8
|
export const initAllGovuk = initAllGovukImp;
|
|
7
9
|
export const initAllAutocomplete = initAllAutocompleteImp;
|
|
8
10
|
export const initFileUpload = initFileUploadImp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":["initAllAutocomplete","initAllAutocompleteImp","initFileUpload","initFileUploadImp","initAllGovuk","initAllGovukImp","initPreviewCloseLink","initPreviewCloseLinkImp","initMaps","initAll"],"sources":["../../../src/client/javascripts/shared.js"],"sourcesContent":["import { initAllAutocomplete as initAllAutocompleteImp } from '~/src/client/javascripts/autocomplete.js'\nimport { initFileUpload as initFileUploadImp } from '~/src/client/javascripts/file-upload.js'\nimport { initAllGovuk as initAllGovukImp } from '~/src/client/javascripts/govuk.js'\nimport { initPreviewCloseLink as initPreviewCloseLinkImp } from '~/src/client/javascripts/preview-close-link.js'\nexport { initMaps } from '~/src/client/javascripts/
|
|
1
|
+
{"version":3,"file":"shared.js","names":["initAllAutocomplete","initAllAutocompleteImp","initFileUpload","initFileUploadImp","initAllGovuk","initAllGovukImp","initPreviewCloseLink","initPreviewCloseLinkImp","initMaps","map","geospatialMap","initAll"],"sources":["../../../src/client/javascripts/shared.js"],"sourcesContent":["import { initAllAutocomplete as initAllAutocompleteImp } from '~/src/client/javascripts/autocomplete.js'\nimport { initFileUpload as initFileUploadImp } from '~/src/client/javascripts/file-upload.js'\nimport { initAllGovuk as initAllGovukImp } from '~/src/client/javascripts/govuk.js'\nimport { initPreviewCloseLink as initPreviewCloseLinkImp } from '~/src/client/javascripts/preview-close-link.js'\nexport { initMaps } from '~/src/client/javascripts/map.js'\nexport * as map from '~/src/client/javascripts/map.js'\nexport * as geospatialMap from '~/src/client/javascripts/geospatial-map.js'\n\nexport const initAllGovuk = initAllGovukImp\nexport const initAllAutocomplete = initAllAutocompleteImp\nexport const initFileUpload = initFileUploadImp\nexport const initPreviewCloseLink = initPreviewCloseLinkImp\n\n/**\n * Initialise all clientside components (but not maps as this will be an opt-in for now given the additional UMD assets that are required)\n */\nexport function initAll() {\n initAllGovuk()\n initAllAutocomplete()\n initFileUpload()\n initPreviewCloseLink()\n}\n"],"mappings":"AAAA,SAASA,mBAAmB,IAAIC,sBAAsB;AACtD,SAASC,cAAc,IAAIC,iBAAiB;AAC5C,SAASC,YAAY,IAAIC,eAAe;AACxC,SAASC,oBAAoB,IAAIC,uBAAuB;AACxD,SAASC,QAAQ;AACjB,OAAO,KAAKC,GAAG;AACf,OAAO,KAAKC,aAAa;AAEzB,OAAO,MAAMN,YAAY,GAAGC,eAAe;AAC3C,OAAO,MAAML,mBAAmB,GAAGC,sBAAsB;AACzD,OAAO,MAAMC,cAAc,GAAGC,iBAAiB;AAC/C,OAAO,MAAMG,oBAAoB,GAAGC,uBAAuB;;AAE3D;AACA;AACA;AACA,OAAO,SAASI,OAAOA,CAAA,EAAG;EACxBP,YAAY,CAAC,CAAC;EACdJ,mBAAmB,CAAC,CAAC;EACrBE,cAAc,CAAC,CAAC;EAChBI,oBAAoB,CAAC,CAAC;AACxB","ignoreList":[]}
|