@conduction/nextcloud-vue 2.182.0 → 2.183.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.
@@ -23945,12 +23945,12 @@ svg.leaflet-image-layer.leaflet-interactive path {
23945
23945
  line-height: 30px;
23946
23946
  }
23947
23947
 
23948
- .cn-map-widget[data-v-356bff56] {
23948
+ .cn-map-widget[data-v-1fc9cf51] {
23949
23949
  position: relative;
23950
23950
  width: 100%;
23951
23951
  min-height: 200px;
23952
23952
  }
23953
- .cn-map-widget__leaflet[data-v-356bff56] {
23953
+ .cn-map-widget__leaflet[data-v-1fc9cf51] {
23954
23954
  width: 100%;
23955
23955
  height: 100%;
23956
23956
  /* Leaflet paints its container #ddd, which reads as a white flash before the
@@ -23959,16 +23959,16 @@ svg.leaflet-image-layer.leaflet-interactive path {
23959
23959
  }
23960
23960
 
23961
23961
  /* With a caption the map keeps its own height and the caption sits under it. */
23962
- .cn-map-widget__leaflet--captioned[data-v-356bff56] {
23962
+ .cn-map-widget__leaflet--captioned[data-v-1fc9cf51] {
23963
23963
  min-height: 200px;
23964
23964
  }
23965
- .cn-map-widget__caption[data-v-356bff56] {
23965
+ .cn-map-widget__caption[data-v-1fc9cf51] {
23966
23966
  margin: 12px 0 0;
23967
23967
  font-size: 15px;
23968
23968
  line-height: 1.2;
23969
23969
  color: var(--color-main-text);
23970
23970
  }
23971
- .cn-map-widget__toggles[data-v-356bff56] {
23971
+ .cn-map-widget__toggles[data-v-1fc9cf51] {
23972
23972
  display: flex;
23973
23973
  flex-wrap: wrap;
23974
23974
  gap: 6px 16px;
@@ -23977,31 +23977,31 @@ svg.leaflet-image-layer.leaflet-interactive path {
23977
23977
  border: 0;
23978
23978
  font-size: 14px;
23979
23979
  }
23980
- .cn-map-widget__toggles-title[data-v-356bff56] {
23980
+ .cn-map-widget__toggles-title[data-v-1fc9cf51] {
23981
23981
  width: 100%;
23982
23982
  margin-bottom: 2px;
23983
23983
  padding: 0;
23984
23984
  font-weight: 600;
23985
23985
  }
23986
- .cn-map-widget__toggle[data-v-356bff56] {
23986
+ .cn-map-widget__toggle[data-v-1fc9cf51] {
23987
23987
  display: inline-flex;
23988
23988
  align-items: center;
23989
23989
  gap: 6px;
23990
23990
  }
23991
- .cn-map-widget__note[data-v-356bff56] {
23991
+ .cn-map-widget__note[data-v-1fc9cf51] {
23992
23992
  margin: 4px 0 0;
23993
23993
  font-size: 13px;
23994
23994
  color: var(--color-text-maxcontrast);
23995
23995
  }
23996
23996
 
23997
23997
  /* Why the map shows no markers: the card's own text size, on its inset. */
23998
- .cn-map-widget__note--status[data-v-356bff56] {
23998
+ .cn-map-widget__note--status[data-v-1fc9cf51] {
23999
23999
  font-size: 14px;
24000
24000
  }
24001
- .cn-map-widget__note--error[data-v-356bff56] {
24001
+ .cn-map-widget__note--error[data-v-1fc9cf51] {
24002
24002
  color: var(--color-error-text, var(--color-error));
24003
24003
  }
24004
- .cn-map-widget__fallback[data-v-356bff56] {
24004
+ .cn-map-widget__fallback[data-v-1fc9cf51] {
24005
24005
  display: flex;
24006
24006
  align-items: center;
24007
24007
  justify-content: center;
@@ -24009,11 +24009,11 @@ svg.leaflet-image-layer.leaflet-interactive path {
24009
24009
  min-height: 150px;
24010
24010
  color: var(--color-text-maxcontrast);
24011
24011
  }
24012
- .cn-map-widget__error[data-v-356bff56] {
24012
+ .cn-map-widget__error[data-v-1fc9cf51] {
24013
24013
  font-size: 14px;
24014
24014
  margin: 0;
24015
24015
  }
24016
- .cn-map-widget__legend[data-v-356bff56] {
24016
+ .cn-map-widget__legend[data-v-1fc9cf51] {
24017
24017
  position: absolute;
24018
24018
  top: 12px;
24019
24019
  right: 12px;
@@ -24026,7 +24026,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
24026
24026
 
24027
24027
  /* Fullscreen overlay. A CSS-fixed box rather than the Fullscreen API, so it needs
24028
24028
  no permission prompt; the z-index clears the Nextcloud header. */
24029
- .cn-map-widget--fullscreen[data-v-356bff56] {
24029
+ .cn-map-widget--fullscreen[data-v-1fc9cf51] {
24030
24030
  position: fixed;
24031
24031
  top: 0;
24032
24032
  left: 0;
@@ -24039,7 +24039,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
24039
24039
  Leaflet's default white-on-grey buttons.
24040
24040
  ::v-deep is required — Leaflet builds the control DOM via L.DomUtil.create, so
24041
24041
  those nodes never receive this SFC's scoped data-v attribute. */
24042
- .cn-map-widget[data-v-356bff56] .cn-map-widget__control {
24042
+ .cn-map-widget[data-v-1fc9cf51] .cn-map-widget__control {
24043
24043
  display: flex;
24044
24044
  align-items: center;
24045
24045
  justify-content: center;
@@ -24048,8 +24048,8 @@ svg.leaflet-image-layer.leaflet-interactive path {
24048
24048
  color: var(--color-main-text);
24049
24049
  background: var(--color-main-background);
24050
24050
  }
24051
- .cn-map-widget[data-v-356bff56] .cn-map-widget__control:hover,
24052
- .cn-map-widget[data-v-356bff56] .cn-map-widget__control:focus-visible {
24051
+ .cn-map-widget[data-v-1fc9cf51] .cn-map-widget__control:hover,
24052
+ .cn-map-widget[data-v-1fc9cf51] .cn-map-widget__control:focus-visible {
24053
24053
  background: var(--color-background-hover);
24054
24054
  }
24055
24055
 
@@ -42816,6 +42816,137 @@ function hasImagePosition(row, xField, yField) {
42816
42816
  return !!row && Number.isFinite(row[xField]) && Number.isFinite(row[yField])
42817
42817
  }
42818
42818
 
42819
+ /**
42820
+ * SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
42821
+ * SPDX-License-Identifier: EUPL-1.2
42822
+ *
42823
+ * Spatial filters and detail links for a map that plots OpenRegister objects.
42824
+ *
42825
+ * `markers.dataSource.spatialFilter` narrows the objects to an area, through
42826
+ * OpenRegister's geo filters:
42827
+ * - `{ bbox: [west, south, east, north] }` → `GET ?geo.bbox=w,s,e,n`
42828
+ * - `{ near: [lon, lat], radius: meters }` → `GET ?geo.near=lon,lat&geo.radius=m`
42829
+ * - `{ within: <GeoJSON Polygon|MultiPolygon> }` → `POST …/geo-search`
42830
+ * The map's `markers.geoProperty`, when set, is sent as `geo.property` so the
42831
+ * filter reads the same property the map draws.
42832
+ *
42833
+ * `markers.detailLink` is the address a clicked feature opens in a new tab: a
42834
+ * template whose `{id}`, `{register}`, `{schema}` and `{<property>}` tokens are
42835
+ * filled from the object. Without a template, a `url` the object carries (the
42836
+ * address OpenRegister's deep-link registry stamps) is opened instead. An
42837
+ * app-absolute path gets the instance's webroot.
42838
+ */
42839
+
42840
+
42841
+ const POLYGON_TYPES = ['Polygon', 'MultiPolygon'];
42842
+
42843
+ /**
42844
+ * Whether every entry is a finite number and there are `length` of them.
42845
+ *
42846
+ * @param {unknown} list The value.
42847
+ * @param {number} length The expected length.
42848
+ * @return {boolean}
42849
+ */
42850
+ function isNumberTuple(list, length) {
42851
+ return Array.isArray(list) && list.length === length && list.every((n) => Number.isFinite(Number(n)) && n !== '' && n !== null)
42852
+ }
42853
+
42854
+ /**
42855
+ * The OpenRegister request a spatial filter makes, or null when there is no
42856
+ * usable filter. A malformed filter is ignored rather than sent, so a typo in
42857
+ * a widget's config never empties the map with a 422.
42858
+ *
42859
+ * @param {object|null|undefined} spatialFilter The `dataSource.spatialFilter` block.
42860
+ * @param {string} [geoProperty] The property the map draws, sent as `geo.property`.
42861
+ * @return {{params: object}|{body: object}|null} Query params for the listing, or a geo-search body.
42862
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-map-can-narrow-its-objects-to-an-area
42863
+ */
42864
+ function spatialFilterRequest(spatialFilter, geoProperty) {
42865
+ if (!spatialFilter || typeof spatialFilter !== 'object') {
42866
+ return null
42867
+ }
42868
+ const property = typeof geoProperty === 'string' && geoProperty !== '' ? { 'geo.property': geoProperty } : {};
42869
+
42870
+ const within = spatialFilter.within;
42871
+ if (within && typeof within === 'object' && POLYGON_TYPES.includes(within.type) && Array.isArray(within.coordinates)) {
42872
+ const body = { geometry: { within } };
42873
+ if (property['geo.property']) {
42874
+ body.property = property['geo.property'];
42875
+ }
42876
+ return { body }
42877
+ }
42878
+ if (isNumberTuple(spatialFilter.bbox, 4)) {
42879
+ return { params: { 'geo.bbox': spatialFilter.bbox.map(Number).join(','), ...property } }
42880
+ }
42881
+ if (isNumberTuple(spatialFilter.near, 2) && Number(spatialFilter.radius) > 0) {
42882
+ return {
42883
+ params: {
42884
+ 'geo.near': spatialFilter.near.map(Number).join(','),
42885
+ 'geo.radius': String(Number(spatialFilter.radius)),
42886
+ ...property,
42887
+ },
42888
+ }
42889
+ }
42890
+ return null
42891
+ }
42892
+
42893
+ /**
42894
+ * The value a detail-link token reads from an object.
42895
+ *
42896
+ * @param {object} object The feature's properties (the OpenRegister object).
42897
+ * @param {string} token The token name.
42898
+ * @return {unknown}
42899
+ */
42900
+ function tokenValue(object, token) {
42901
+ const self = object['@self'] && typeof object['@self'] === 'object' ? object['@self'] : {};
42902
+ if (token === 'id') {
42903
+ return self.id ?? object.id ?? object.uuid
42904
+ }
42905
+ if (token === 'register' || token === 'schema') {
42906
+ return self[token] ?? object[token]
42907
+ }
42908
+ return object[token]
42909
+ }
42910
+
42911
+ /**
42912
+ * The address a clicked feature opens, or null when it has none. A template
42913
+ * with a token the object cannot fill gives null, so a click never opens a
42914
+ * half-built address.
42915
+ *
42916
+ * @param {object|null} feature The clicked GeoJSON feature.
42917
+ * @param {string} [template] The `markers.detailLink` template.
42918
+ * @return {string|null} A safe href, or null.
42919
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-clicked-object-opens-its-detail-page
42920
+ */
42921
+ function featureDetailUrl(feature, template) {
42922
+ const object = feature && feature.properties && typeof feature.properties === 'object' ? feature.properties : null;
42923
+ if (object === null) {
42924
+ return null
42925
+ }
42926
+ let href = null;
42927
+ if (typeof template === 'string' && template !== '') {
42928
+ let missing = false;
42929
+ href = template.replace(/\{([\w@.-]+)\}/g, (_match, token) => {
42930
+ const value = tokenValue(object, token);
42931
+ if (value === undefined || value === null || value === '' || typeof value === 'object') {
42932
+ missing = true;
42933
+ return ''
42934
+ }
42935
+ return encodeURIComponent(String(value))
42936
+ });
42937
+ if (missing) {
42938
+ return null
42939
+ }
42940
+ } else if (typeof object.url === 'string' && object.url !== '') {
42941
+ href = object.url;
42942
+ }
42943
+ if (href === null) {
42944
+ return null
42945
+ }
42946
+ const safe = safeHref(href);
42947
+ return safe === '#' ? null : prefixUrl(safe)
42948
+ }
42949
+
42819
42950
  const ALLOWED_LAYER_TYPES = ['tile', 'wms', 'wfs', 'geojson', 'image'];
42820
42951
 
42821
42952
  // Raw input on the map container, which is what tells a user's pan or zoom from
@@ -43004,14 +43135,16 @@ var script$8S = {
43004
43135
 
43005
43136
  /**
43006
43137
  * Marker config. `{ features?, dataSource?, geoProperty?, latField?, lngField?, xField?, yField?,
43007
- * popupField?, clustering?, iconColor?, iconUrl?, centerMarker? }`. On an image map
43138
+ * popupField?, clustering?, iconColor?, iconUrl?, centerMarker?, detailLink? }`. On an image map
43008
43139
  * (a layer of type `image`) markers read `xField` / `yField` (default `x` / `y`,
43009
43140
  * pixels from the picture's top left) instead of `latField` / `lngField`. `features[]` is inline;
43010
43141
  * `dataSource.url` is HTTP-fetched on mount; `dataSource.{register, schema}`
43011
43142
  * plots the objects of an OpenRegister register/schema via `geoProperty` (a property
43012
43143
  * holding a GeoJSON geometry of any type, or a point) when set, else `@self.geo`.
43013
43144
  * `centerMarker: true` adds an extra pin at the map's `center`, alongside any
43014
- * source markers.
43145
+ * source markers. `dataSource.spatialFilter` (`{ bbox }`, `{ near, radius }` or
43146
+ * `{ within }`) narrows a register source to an area; `detailLink` is the address
43147
+ * a clicked object opens in a new tab (see spatialFilter.js).
43015
43148
  *
43016
43149
  * @type {object|null}
43017
43150
  */
@@ -43419,14 +43552,18 @@ var script$8S = {
43419
43552
  },
43420
43553
 
43421
43554
  /**
43422
- * The data-source filter with its tokens resolved, serialised so a new
43423
- * record re-reads the markers.
43555
+ * The data-source filter with its tokens resolved, and the spatial
43556
+ * filter, serialised so a new record or a new area re-reads the markers.
43424
43557
  *
43425
43558
  * @return {string}
43559
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-map-can-narrow-its-objects-to-an-area
43426
43560
  */
43427
43561
  filterKey() {
43428
43562
  const ds = this.cfg.markers && this.cfg.markers.dataSource;
43429
- return ds && ds.filter ? JSON.stringify(this.sourceFilter(ds)) : ''
43563
+ if (!ds || (!ds.filter && !ds.spatialFilter)) {
43564
+ return ''
43565
+ }
43566
+ return JSON.stringify([ds.filter ? this.sourceFilter(ds) : null, ds.spatialFilter || null])
43430
43567
  },
43431
43568
 
43432
43569
  unplottedLabel() {
@@ -43969,6 +44106,7 @@ var script$8S = {
43969
44106
  * @type {{feature: object, latlng: object}}
43970
44107
  */
43971
44108
  this.$emit('marker-click', { feature, latlng: e.latlng });
44109
+ this.openFeatureDetail(feature);
43972
44110
  });
43973
44111
  },
43974
44112
  });
@@ -44466,8 +44604,11 @@ var script$8S = {
44466
44604
  * skipped rather than dropped at (0, 0) — an invisible wrong marker is worse
44467
44605
  * than an absent one.
44468
44606
  *
44469
- * @param {{register: string, schema: string, limit?: number}} ds The data source.
44607
+ * A `spatialFilter` narrows the objects to an area (see spatialFilter.js).
44608
+ *
44609
+ * @param {{register: string, schema: string, limit?: number, spatialFilter?: object}} ds The data source.
44470
44610
  * @return {Promise<Array<object>>} GeoJSON Feature array.
44611
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-map-can-narrow-its-objects-to-an-area
44471
44612
  */
44472
44613
  async fetchRegisterFeatures(ds) {
44473
44614
  try {
@@ -44479,7 +44620,11 @@ var script$8S = {
44479
44620
  '/apps/openregister/api/objects/{register}/{schema}',
44480
44621
  { register: ds.register, schema: ds.schema },
44481
44622
  );
44482
- const res = await axios.get(url, { params: { ...this.sourceFilter(ds), _limit: ds.limit || 500 } });
44623
+ const params = { ...this.sourceFilter(ds), _limit: ds.limit || 500 };
44624
+ const spatial = spatialFilterRequest(ds.spatialFilter, this.cfg.markers && this.cfg.markers.geoProperty);
44625
+ const res = spatial && spatial.body
44626
+ ? await axios.post(url + '/geo-search', spatial.body, { params })
44627
+ : await axios.get(url, { params: { ...params, ...(spatial ? spatial.params : {}) } });
44483
44628
  const rows = (res && res.data && res.data.results) || [];
44484
44629
 
44485
44630
  const latField = this.cfg.markers && this.cfg.markers.latField;
@@ -44499,6 +44644,20 @@ var script$8S = {
44499
44644
  }
44500
44645
  },
44501
44646
 
44647
+ /**
44648
+ * Open a clicked object's detail address in a new tab, when it has one.
44649
+ *
44650
+ * @param {object} feature The clicked GeoJSON feature.
44651
+ * @return {void}
44652
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-clicked-object-opens-its-detail-page
44653
+ */
44654
+ openFeatureDetail(feature) {
44655
+ const href = featureDetailUrl(feature, this.cfg.markers && this.cfg.markers.detailLink);
44656
+ if (href !== null) {
44657
+ window.open(href, '_blank', 'noopener,noreferrer');
44658
+ }
44659
+ },
44660
+
44502
44661
  /**
44503
44662
  * Normalise a fetched payload into a GeoJSON Feature array.
44504
44663
  * Accepts FeatureCollection, raw Feature[], or flat rows that
@@ -44625,7 +44784,7 @@ function render$8Q(_ctx, _cache, $props, $setup, $data, $options) {
44625
44784
  }
44626
44785
 
44627
44786
  script$8S.render = render$8Q;
44628
- script$8S.__scopeId = "data-v-356bff56";
44787
+ script$8S.__scopeId = "data-v-1fc9cf51";
44629
44788
  const __sfc_main$8M = script$8S;
44630
44789
 
44631
44790
  /**
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/nextcloud-vue.cjs.js.map
3
- size: 53743152 bytes
4
- sha256: 1d542dc533f09e1585e988401d043577fcd319f05237fa857a6ca90c1a2fb424
3
+ size: 53756679 bytes
4
+ sha256: 504642566e85d8556b1f782e1ff66647a0a2e0cb1b346e17a73f7a0402363aea
@@ -23945,12 +23945,12 @@ svg.leaflet-image-layer.leaflet-interactive path {
23945
23945
  line-height: 30px;
23946
23946
  }
23947
23947
 
23948
- .cn-map-widget[data-v-356bff56] {
23948
+ .cn-map-widget[data-v-1fc9cf51] {
23949
23949
  position: relative;
23950
23950
  width: 100%;
23951
23951
  min-height: 200px;
23952
23952
  }
23953
- .cn-map-widget__leaflet[data-v-356bff56] {
23953
+ .cn-map-widget__leaflet[data-v-1fc9cf51] {
23954
23954
  width: 100%;
23955
23955
  height: 100%;
23956
23956
  /* Leaflet paints its container #ddd, which reads as a white flash before the
@@ -23959,16 +23959,16 @@ svg.leaflet-image-layer.leaflet-interactive path {
23959
23959
  }
23960
23960
 
23961
23961
  /* With a caption the map keeps its own height and the caption sits under it. */
23962
- .cn-map-widget__leaflet--captioned[data-v-356bff56] {
23962
+ .cn-map-widget__leaflet--captioned[data-v-1fc9cf51] {
23963
23963
  min-height: 200px;
23964
23964
  }
23965
- .cn-map-widget__caption[data-v-356bff56] {
23965
+ .cn-map-widget__caption[data-v-1fc9cf51] {
23966
23966
  margin: 12px 0 0;
23967
23967
  font-size: 15px;
23968
23968
  line-height: 1.2;
23969
23969
  color: var(--color-main-text);
23970
23970
  }
23971
- .cn-map-widget__toggles[data-v-356bff56] {
23971
+ .cn-map-widget__toggles[data-v-1fc9cf51] {
23972
23972
  display: flex;
23973
23973
  flex-wrap: wrap;
23974
23974
  gap: 6px 16px;
@@ -23977,31 +23977,31 @@ svg.leaflet-image-layer.leaflet-interactive path {
23977
23977
  border: 0;
23978
23978
  font-size: 14px;
23979
23979
  }
23980
- .cn-map-widget__toggles-title[data-v-356bff56] {
23980
+ .cn-map-widget__toggles-title[data-v-1fc9cf51] {
23981
23981
  width: 100%;
23982
23982
  margin-bottom: 2px;
23983
23983
  padding: 0;
23984
23984
  font-weight: 600;
23985
23985
  }
23986
- .cn-map-widget__toggle[data-v-356bff56] {
23986
+ .cn-map-widget__toggle[data-v-1fc9cf51] {
23987
23987
  display: inline-flex;
23988
23988
  align-items: center;
23989
23989
  gap: 6px;
23990
23990
  }
23991
- .cn-map-widget__note[data-v-356bff56] {
23991
+ .cn-map-widget__note[data-v-1fc9cf51] {
23992
23992
  margin: 4px 0 0;
23993
23993
  font-size: 13px;
23994
23994
  color: var(--color-text-maxcontrast);
23995
23995
  }
23996
23996
 
23997
23997
  /* Why the map shows no markers: the card's own text size, on its inset. */
23998
- .cn-map-widget__note--status[data-v-356bff56] {
23998
+ .cn-map-widget__note--status[data-v-1fc9cf51] {
23999
23999
  font-size: 14px;
24000
24000
  }
24001
- .cn-map-widget__note--error[data-v-356bff56] {
24001
+ .cn-map-widget__note--error[data-v-1fc9cf51] {
24002
24002
  color: var(--color-error-text, var(--color-error));
24003
24003
  }
24004
- .cn-map-widget__fallback[data-v-356bff56] {
24004
+ .cn-map-widget__fallback[data-v-1fc9cf51] {
24005
24005
  display: flex;
24006
24006
  align-items: center;
24007
24007
  justify-content: center;
@@ -24009,11 +24009,11 @@ svg.leaflet-image-layer.leaflet-interactive path {
24009
24009
  min-height: 150px;
24010
24010
  color: var(--color-text-maxcontrast);
24011
24011
  }
24012
- .cn-map-widget__error[data-v-356bff56] {
24012
+ .cn-map-widget__error[data-v-1fc9cf51] {
24013
24013
  font-size: 14px;
24014
24014
  margin: 0;
24015
24015
  }
24016
- .cn-map-widget__legend[data-v-356bff56] {
24016
+ .cn-map-widget__legend[data-v-1fc9cf51] {
24017
24017
  position: absolute;
24018
24018
  top: 12px;
24019
24019
  right: 12px;
@@ -24026,7 +24026,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
24026
24026
 
24027
24027
  /* Fullscreen overlay. A CSS-fixed box rather than the Fullscreen API, so it needs
24028
24028
  no permission prompt; the z-index clears the Nextcloud header. */
24029
- .cn-map-widget--fullscreen[data-v-356bff56] {
24029
+ .cn-map-widget--fullscreen[data-v-1fc9cf51] {
24030
24030
  position: fixed;
24031
24031
  top: 0;
24032
24032
  left: 0;
@@ -24039,7 +24039,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
24039
24039
  Leaflet's default white-on-grey buttons.
24040
24040
  ::v-deep is required — Leaflet builds the control DOM via L.DomUtil.create, so
24041
24041
  those nodes never receive this SFC's scoped data-v attribute. */
24042
- .cn-map-widget[data-v-356bff56] .cn-map-widget__control {
24042
+ .cn-map-widget[data-v-1fc9cf51] .cn-map-widget__control {
24043
24043
  display: flex;
24044
24044
  align-items: center;
24045
24045
  justify-content: center;
@@ -24048,8 +24048,8 @@ svg.leaflet-image-layer.leaflet-interactive path {
24048
24048
  color: var(--color-main-text);
24049
24049
  background: var(--color-main-background);
24050
24050
  }
24051
- .cn-map-widget[data-v-356bff56] .cn-map-widget__control:hover,
24052
- .cn-map-widget[data-v-356bff56] .cn-map-widget__control:focus-visible {
24051
+ .cn-map-widget[data-v-1fc9cf51] .cn-map-widget__control:hover,
24052
+ .cn-map-widget[data-v-1fc9cf51] .cn-map-widget__control:focus-visible {
24053
24053
  background: var(--color-background-hover);
24054
24054
  }
24055
24055
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/nextcloud-vue",
3
- "version": "2.182.0",
3
+ "version": "2.183.0",
4
4
  "description": "Shared Vue component library for Conduction Nextcloud apps — complements @nextcloud/vue with higher-level components, OpenRegister integration, and NL Design System support",
5
5
  "homepage": "https://github.com/ConductionNL/nextcloud-vue#readme",
6
6
  "bugs": {
@@ -18,6 +18,11 @@
18
18
  OpenRegister register/schema, reading each one's `@self.geo`
19
19
  (falling back to `latField` / `lngField` on the object itself).
20
20
  Objects with no usable location are skipped, not plotted at (0, 0).
21
+ `dataSource.spatialFilter` narrows them to a bbox, a radius around a
22
+ point, or a polygon, through OpenRegister's geo filters.
23
+ - `markers.detailLink` — a clicked object opens this address (with
24
+ `{id}`, `{register}`, `{schema}`, `{<property>}` tokens) in a new
25
+ tab; without it, a `url` the object carries is opened.
21
26
 
22
27
  `leaflet.markercluster`'s JS lazy-loads only when `clustering: true`
23
28
  (or `markers.clustering: true`), so a consumer without clustering does
@@ -110,6 +115,7 @@ import { resolveFilterTokens } from '../../utils/resolveFilterTokens.js'
110
115
  import { safeHref } from '../../utils/safeHref.js'
111
116
  import { SAFE_MARKDOWN_DOMPURIFY_CONFIG } from '../../utils/safeMarkdownDompurifyConfig.js'
112
117
  import { fromImagePoint, hasImagePosition, imageBounds, paddedImageBounds, toImagePoint } from './imageCoordinates.js'
118
+ import { featureDetailUrl, spatialFilterRequest } from './spatialFilter.js'
113
119
 
114
120
  // Leaflet's own stylesheet positions the map panes, tiles the tile
115
121
  // images, and places the zoom/attribution controls. The JS is lazy-loaded
@@ -314,14 +320,16 @@ export default {
314
320
 
315
321
  /**
316
322
  * Marker config. `{ features?, dataSource?, geoProperty?, latField?, lngField?, xField?, yField?,
317
- * popupField?, clustering?, iconColor?, iconUrl?, centerMarker? }`. On an image map
323
+ * popupField?, clustering?, iconColor?, iconUrl?, centerMarker?, detailLink? }`. On an image map
318
324
  * (a layer of type `image`) markers read `xField` / `yField` (default `x` / `y`,
319
325
  * pixels from the picture's top left) instead of `latField` / `lngField`. `features[]` is inline;
320
326
  * `dataSource.url` is HTTP-fetched on mount; `dataSource.{register, schema}`
321
327
  * plots the objects of an OpenRegister register/schema via `geoProperty` (a property
322
328
  * holding a GeoJSON geometry of any type, or a point) when set, else `@self.geo`.
323
329
  * `centerMarker: true` adds an extra pin at the map's `center`, alongside any
324
- * source markers.
330
+ * source markers. `dataSource.spatialFilter` (`{ bbox }`, `{ near, radius }` or
331
+ * `{ within }`) narrows a register source to an area; `detailLink` is the address
332
+ * a clicked object opens in a new tab (see spatialFilter.js).
325
333
  *
326
334
  * @type {object|null}
327
335
  */
@@ -729,14 +737,18 @@ export default {
729
737
  },
730
738
 
731
739
  /**
732
- * The data-source filter with its tokens resolved, serialised so a new
733
- * record re-reads the markers.
740
+ * The data-source filter with its tokens resolved, and the spatial
741
+ * filter, serialised so a new record or a new area re-reads the markers.
734
742
  *
735
743
  * @return {string}
744
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-map-can-narrow-its-objects-to-an-area
736
745
  */
737
746
  filterKey() {
738
747
  const ds = this.cfg.markers && this.cfg.markers.dataSource
739
- return ds && ds.filter ? JSON.stringify(this.sourceFilter(ds)) : ''
748
+ if (!ds || (!ds.filter && !ds.spatialFilter)) {
749
+ return ''
750
+ }
751
+ return JSON.stringify([ds.filter ? this.sourceFilter(ds) : null, ds.spatialFilter || null])
740
752
  },
741
753
 
742
754
  unplottedLabel() {
@@ -1279,6 +1291,7 @@ export default {
1279
1291
  * @type {{feature: object, latlng: object}}
1280
1292
  */
1281
1293
  this.$emit('marker-click', { feature, latlng: e.latlng })
1294
+ this.openFeatureDetail(feature)
1282
1295
  })
1283
1296
  },
1284
1297
  })
@@ -1776,8 +1789,11 @@ export default {
1776
1789
  * skipped rather than dropped at (0, 0) — an invisible wrong marker is worse
1777
1790
  * than an absent one.
1778
1791
  *
1779
- * @param {{register: string, schema: string, limit?: number}} ds The data source.
1792
+ * A `spatialFilter` narrows the objects to an area (see spatialFilter.js).
1793
+ *
1794
+ * @param {{register: string, schema: string, limit?: number, spatialFilter?: object}} ds The data source.
1780
1795
  * @return {Promise<Array<object>>} GeoJSON Feature array.
1796
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-map-can-narrow-its-objects-to-an-area
1781
1797
  */
1782
1798
  async fetchRegisterFeatures(ds) {
1783
1799
  try {
@@ -1789,7 +1805,11 @@ export default {
1789
1805
  '/apps/openregister/api/objects/{register}/{schema}',
1790
1806
  { register: ds.register, schema: ds.schema },
1791
1807
  )
1792
- const res = await axios.get(url, { params: { ...this.sourceFilter(ds), _limit: ds.limit || 500 } })
1808
+ const params = { ...this.sourceFilter(ds), _limit: ds.limit || 500 }
1809
+ const spatial = spatialFilterRequest(ds.spatialFilter, this.cfg.markers && this.cfg.markers.geoProperty)
1810
+ const res = spatial && spatial.body
1811
+ ? await axios.post(url + '/geo-search', spatial.body, { params })
1812
+ : await axios.get(url, { params: { ...params, ...(spatial ? spatial.params : {}) } })
1793
1813
  const rows = (res && res.data && res.data.results) || []
1794
1814
 
1795
1815
  const latField = this.cfg.markers && this.cfg.markers.latField
@@ -1809,6 +1829,20 @@ export default {
1809
1829
  }
1810
1830
  },
1811
1831
 
1832
+ /**
1833
+ * Open a clicked object's detail address in a new tab, when it has one.
1834
+ *
1835
+ * @param {object} feature The clicked GeoJSON feature.
1836
+ * @return {void}
1837
+ * @spec openspec/changes/map-spatial-filter-and-detail-link/specs/map-spatial-filter-and-detail-link/spec.md#requirement-a-clicked-object-opens-its-detail-page
1838
+ */
1839
+ openFeatureDetail(feature) {
1840
+ const href = featureDetailUrl(feature, this.cfg.markers && this.cfg.markers.detailLink)
1841
+ if (href !== null) {
1842
+ window.open(href, '_blank', 'noopener,noreferrer')
1843
+ }
1844
+ },
1845
+
1812
1846
  /**
1813
1847
  * Normalise a fetched payload into a GeoJSON Feature array.
1814
1848
  * Accepts FeatureCollection, raw Feature[], or flat rows that