From 067fde7a7ec0087aff6df357cbec26a6edc88554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giovanni=20Borella?= Date: Thu, 27 Mar 2025 12:02:16 +0000 Subject: [PATCH 1/4] relation-info in info-click, singular --- browser/modules/sqlQuery.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/browser/modules/sqlQuery.js b/browser/modules/sqlQuery.js index ebe276b40..e41a7037c 100644 --- a/browser/modules/sqlQuery.js +++ b/browser/modules/sqlQuery.js @@ -742,6 +742,7 @@ module.exports = { }); } else { $.each(sortObject(fieldConf), (name, property) => { + let metaDataForField = metaDataKeys[keyWithOutPrefix].fields[property.key] ? metaDataKeys[keyWithOutPrefix].fields[property.key] : null; if (property.value.querable) { let value = feature.properties[property.key]; // Only set field template if property is set or not empty string OR if 'replaceNull' helper is used, which will replace nulls @@ -834,6 +835,15 @@ module.exports = { } } } + // If metaDataForField.restrictions has an array, we get the related values + else if (metaDataForField && metaDataForField.restriction && Array.isArray(metaDataForField.restriction)) { + let restrictions = metaDataForField.restriction; + let restriction = restrictions.find(restriction => restriction.value === value); + if (restriction) { + value = restriction.alias; + } + } + fields.push({title: property.value.alias || property.key, value}); fieldLabel = (property.value.alias !== null && property.value.alias !== "") ? property.value.alias : property.key; if (feature.properties[property.key] !== undefined) { From 9279a08c3318e613c8f79d8fcddf3ef9d5d9cd16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giovanni=20Borella?= Date: Thu, 27 Mar 2025 13:11:34 +0000 Subject: [PATCH 2/4] Carry over alias to table --- browser/modules/sqlQuery.js | 9 +++++---- public/js/gc2/gc2table.js | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/browser/modules/sqlQuery.js b/browser/modules/sqlQuery.js index e41a7037c..215b76352 100644 --- a/browser/modules/sqlQuery.js +++ b/browser/modules/sqlQuery.js @@ -9,6 +9,7 @@ import {LAYER, MAP_RESOLUTIONS, SYSTEM_FIELD_PREFIX} from './layerTree/constants'; import {GEOJSON_PRECISION, MIME_TYPES_APPS, MIME_TYPES_IMAGES} from './constants'; import dayjs from 'dayjs'; +import { PropertyValue } from 'maplibre-gl'; const layerTreeUtils = require('./layerTree/utils'); @@ -837,17 +838,16 @@ module.exports = { } // If metaDataForField.restrictions has an array, we get the related values else if (metaDataForField && metaDataForField.restriction && Array.isArray(metaDataForField.restriction)) { - let restrictions = metaDataForField.restriction; - let restriction = restrictions.find(restriction => restriction.value === value); + property.restrictions = metaDataForField.restriction; + let restriction = property.restrictions.find(restriction => restriction.value === value); if (restriction) { value = restriction.alias; } } - fields.push({title: property.value.alias || property.key, value}); fieldLabel = (property.value.alias !== null && property.value.alias !== "") ? property.value.alias : property.key; if (feature.properties[property.key] !== undefined) { - out.push([property.key, property.value.sort_id, fieldLabel, property.value.link, property.value.template, property.value.content]); + out.push([property.key, property.value.sort_id, fieldLabel, property.value.link, property.value.template, property.value.content, property.restrictions || null]); } } }); @@ -869,6 +869,7 @@ module.exports = { link: property[3], template: property[4], content: property[5], + restrictions: property[6] }) }); first = false; diff --git a/public/js/gc2/gc2table.js b/public/js/gc2/gc2table.js index cec23bc1c..89ffbe8e5 100644 --- a/public/js/gc2/gc2table.js +++ b/public/js/gc2/gc2table.js @@ -450,6 +450,12 @@ var gc2table = (function () { layerClone[n] = `
` + } else if (k.dataIndex === n && (k?.restrictions && (layerClone[n] && layerClone[n] !== ''))) { + let restriction = k.restrictions.find(restriction => restriction.value === layerClone[n]); + if (restriction) { + // replace value with alias + layerClone[n] = restriction.alias; + } } }); }); From a791d599e159e1c213e749e5abd7a41d4888d672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giovanni=20Borella?= Date: Thu, 27 Mar 2025 13:12:49 +0000 Subject: [PATCH 3/4] remove autoimport --- browser/modules/sqlQuery.js | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/modules/sqlQuery.js b/browser/modules/sqlQuery.js index 215b76352..21c0b6df6 100644 --- a/browser/modules/sqlQuery.js +++ b/browser/modules/sqlQuery.js @@ -9,7 +9,6 @@ import {LAYER, MAP_RESOLUTIONS, SYSTEM_FIELD_PREFIX} from './layerTree/constants'; import {GEOJSON_PRECISION, MIME_TYPES_APPS, MIME_TYPES_IMAGES} from './constants'; import dayjs from 'dayjs'; -import { PropertyValue } from 'maplibre-gl'; const layerTreeUtils = require('./layerTree/utils'); From b6f2ef89a8d4f00faa900a8d3e7529ecd857e72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giovanni=20Borella?= Date: Wed, 2 Apr 2025 16:08:45 +0200 Subject: [PATCH 4/4] fix draggable --- browser/modules/sqlQuery.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/browser/modules/sqlQuery.js b/browser/modules/sqlQuery.js index 21c0b6df6..2ee79a1da 100644 --- a/browser/modules/sqlQuery.js +++ b/browser/modules/sqlQuery.js @@ -944,17 +944,29 @@ module.exports = { */ makeDraggable: (popup) => { const map = cloud.get().map + const wrapper = '.leaflet-popup-content-wrapper' + const popupContent = popup._container.querySelector(wrapper); + + // Only apply dragging behavior to content wrapper, not children + popupContent.style.cursor = 'move'; + popupContent.children[0].style.cursor = 'auto'; + const draggable = new L.Draggable(popup._container, popup._wrapper); - // change cursor class - $(".leaflet-popup-content-wrapper").css('cursor', 'move'); + + // Handle mousedown event to check if it should start dragging + popup._container.addEventListener('mousedown', function(e) { + // drag only on the wrapper class + if (!e.target.classList.contains(wrapper.replace('.', ''))) { + draggable.disable(); + setTimeout(() => draggable.enable(), 100); // Re-enable after interaction + } + }); draggable.on('dragstart', function (e) { - //on first drag, remove the pop-up tip $(".leaflet-popup-tip-container").hide(); }); draggable.on('dragend', function (e) { - // set the new position popup.setLatLng(map.layerPointToLatLng(e.target._newPos)); - }); + }); draggable.enable(); },