@geogirafe/lib-geoportal 1.1.0-dev.2321895443 → 1.1.0-dev.2334458755
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/assets/i18n/de.json +1 -0
- package/assets/i18n/en.json +1 -0
- package/assets/i18n/fr.json +1 -0
- package/assets/i18n/it.json +1 -0
- package/components/search/component.d.ts +1 -0
- package/components/search/component.js +37 -2
- package/components/selectiongrid/tools/selectiontabulatormanager.js +5 -1
- package/package.json +1 -1
- package/templates/index.html +7 -1
- package/templates/public/about.json +1 -1
- package/tools/utils/utils.js +1 -1
- package/tools/utils/utils.spec.js +5 -0
package/assets/i18n/de.json
CHANGED
|
@@ -352,6 +352,7 @@
|
|
|
352
352
|
"Search visible": "Suche sichtbar",
|
|
353
353
|
"Search...": "Suchen...",
|
|
354
354
|
"search_tip": "Ort, Objekt oder Karte suchen",
|
|
355
|
+
"search_tooltip": "Suchen Sie nach einem Ort, einer Adresse, einer Karte oder geografischen Daten",
|
|
355
356
|
"searchFillColor": "Suchresultat Füllfarbe",
|
|
356
357
|
"searchStrokeColor": "Suchresultat Strichfarbe",
|
|
357
358
|
"Select all": "Alles auswählen",
|
package/assets/i18n/en.json
CHANGED
|
@@ -353,6 +353,7 @@
|
|
|
353
353
|
"Search visible": "Search visible",
|
|
354
354
|
"Search...": "Search...",
|
|
355
355
|
"search_tip": "Search for a place, object or map",
|
|
356
|
+
"search_tooltip": "Search for a place, address, map, or geographic data",
|
|
356
357
|
"searchFillColor": "Search result fill color",
|
|
357
358
|
"searchStrokeColor": "Search result stroke color",
|
|
358
359
|
"Select all": "Select all",
|
package/assets/i18n/fr.json
CHANGED
|
@@ -352,6 +352,7 @@
|
|
|
352
352
|
"Search visible": "Recherche visible",
|
|
353
353
|
"Search...": "Rechercher...",
|
|
354
354
|
"search_tip": "Rechercher un lieu, un objet ou une carte",
|
|
355
|
+
"search_tooltip": "Rechercher un lieu, une adresse, une carte ou une donnée géographique",
|
|
355
356
|
"searchFillColor": "Couleur de remplissage des résultats de recherche",
|
|
356
357
|
"searchStrokeColor": "Couleur du trait des résultats de recherche",
|
|
357
358
|
"Select all": "Tout sélectionner",
|
package/assets/i18n/it.json
CHANGED
|
@@ -352,6 +352,7 @@
|
|
|
352
352
|
"Search visible": "Ricerca visibile",
|
|
353
353
|
"Search...": "Cerca...",
|
|
354
354
|
"search_tip": "Cerca un luogo, un oggetto o una mappa",
|
|
355
|
+
"search_tooltip": "Cerca un luogo, un indirizzo, una mappa o un dato geografico",
|
|
355
356
|
"searchFillColor": "Colore di riempimento dei risultati della ricerca",
|
|
356
357
|
"searchStrokeColor": "Colore del tratto dei risultati della ricerca",
|
|
357
358
|
"Select all": "Seleziona tutto",
|
|
@@ -68,6 +68,7 @@ declare class SearchComponent extends GirafeHTMLElement {
|
|
|
68
68
|
onMouseMove(): void;
|
|
69
69
|
onKeyDown(e: KeyboardEvent): void;
|
|
70
70
|
private navigateToResult;
|
|
71
|
+
private createTooltip;
|
|
71
72
|
private initColorPicker;
|
|
72
73
|
private updatePreviewLayerStyle;
|
|
73
74
|
private defaultColorHasChanged;
|
|
@@ -2,6 +2,7 @@ import { html as uHtml } from 'uhtml';
|
|
|
2
2
|
import Collection from 'ol/Collection.js';
|
|
3
3
|
import Feature from 'ol/Feature.js';
|
|
4
4
|
import GeoJSON from 'ol/format/GeoJSON.js';
|
|
5
|
+
import tippy from 'tippy.js';
|
|
5
6
|
import VectorSource from 'ol/source/Vector.js';
|
|
6
7
|
import VectorLayer from 'ol/layer/Vector.js';
|
|
7
8
|
import { Point } from 'ol/geom.js';
|
|
@@ -20,9 +21,9 @@ class SearchComponent extends GirafeHTMLElement {
|
|
|
20
21
|
return uHtml `<style>
|
|
21
22
|
*{font-family:Arial,sans-serif}.hidden{display:none!important}.gg-rotate90{transform:rotate(90deg)}.gg-rotate180{transform:rotate(180deg)}.gg-rotate270{transform:rotate(270deg)}img{filter:var(--svg-filter)}img.legend-image{filter:var(--svg-map-filter);background:var(--svg-legend-bkg)}div{scrollbar-width:thin}a,a:visited{color:var(--link-color)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin-wait{0%{transform:rotate(0)}7%{transform:rotate(360deg)}to{transform:rotate(360deg)}}.gg-spin{animation-name:spin;animation-duration:2s;animation-timing-function:linear;animation-iteration-count:infinite}.gg-spin-wait{animation-name:spin-wait;animation-duration:10s;animation-timing-function:linear;animation-iteration-count:infinite}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:#999}.gg-button,.gg-select,.gg-input,.gg-textarea{background-color:var(--bkg-color);color:var(--text-color);border:var(--app-standard-border);box-sizing:border-box;cursor:pointer;border-radius:3px;outline:0;margin:0;padding:0 0 0 .5rem;display:inline-block}.gg-label{background-color:var(--bkg-color);color:var(--text-color);border:none;align-items:center;margin:0;padding:0;display:flex}.gg-button,.gg-select,.gg-input,.gg-label{min-height:calc(var(--app-standard-height)/1.5)}.gg-textarea{max-height:initial;resize:vertical;height:6rem;padding:.5rem;line-height:1.3rem}.gg-input{cursor:text}.gg-checkbox{accent-color:var(--text-color);width:1.2rem}.gg-range{accent-color:var(--text-color)}.gg-button{padding:0 .5rem}.gg-button.active{border:solid 1px var(--text-color-grad2);background-color:var(--text-color-grad2);color:var(--bkg-color)}.gg-button:disabled{color:gray;cursor:not-allowed;background-color:#d3d3d3;border:none}.gg-input:disabled,.gg-select:disabled,.gg-textarea:disabled{color:gray;cursor:not-allowed;background-color:#d3d3d3}.gg-button>img{vertical-align:middle}.gg-icon-button{color:var(--text-color);cursor:pointer;background-color:#0000;border:none;flex-direction:column;justify-content:center;align-items:center;padding:0;display:flex}.gg-icon{justify-content:center;align-items:center;display:flex}.gg-big,.gg-big-withtext{min-width:var(--app-standard-height);min-height:var(--app-standard-height);max-height:var(--app-standard-height)}.gg-big img,.gg-big-withtext img{width:calc(var(--app-standard-height) - 1.5rem);margin:0}.gg-big-withtext span{font-variant:small-caps;padding:0 1rem;font-size:.9rem}.gg-medium,.gg-medium-withtext{min-width:calc(var(--app-standard-height)/1.2);min-height:calc(var(--app-standard-height)/1.2);max-height:calc(var(--app-standard-height)/1.2);flex-direction:row}.gg-medium img{width:calc(var(--app-standard-height)/2.4);margin:0}.gg-medium-withtext img{width:calc(var(--app-standard-height)/2.4);margin-left:.5rem}.gg-medium-withtext span{padding:0 1rem 0 .5rem;font-size:.9rem}.gg-small,.gg-small-withtext{min-width:calc(var(--app-standard-height)/2);min-height:calc(var(--app-standard-height)/2);max-height:calc(var(--app-standard-height)/2);flex-direction:row}.gg-small img{width:calc(var(--app-standard-height)/3);margin:0}.gg-small-withtext img{width:calc(var(--app-standard-height)/3);margin-left:.5rem}.gg-small-withtext span{padding:0 .5rem 0 .3rem;font-size:.9rem}.gg-button:hover,.gg-select:hover,.gg-input:hover,.gg-textarea:hover,.gg-icon-button:hover{background-color:var(--bkg-color-grad1)}.gg-opacity{opacity:.5}.gg-opacity:hover{opacity:1;background-color:#0000}.gg-tabs{cursor:pointer;grid-auto-flow:column;padding-bottom:1rem;font-size:1rem;display:grid}.gg-tab{border:none;border-bottom:var(--app-standard-border);cursor:pointer;color:var(--text-color);background:0 0;padding:.5rem}.gg-tab.active{border-bottom:solid 1px var(--text-color)}.girafe-button-big,.girafe-button-large,.girafe-button-small,.girafe-button-tiny{color:var(--text-color);background-color:#0000;border:none;flex-direction:column;display:flex}.girafe-button-big:hover,.girafe-button-large:hover,.girafe-button-small:hover,.girafe-button-tiny:hover{background-color:var(--bkg-color-grad1);cursor:pointer}.girafe-button-big.dark,.girafe-button-large.dark,.girafe-button-small.dark,.girafe-button-tiny.dark{background-color:var(--bkg-color);filter:invert()}.girafe-button-big{width:var(--app-standard-height);height:var(--app-standard-height);align-items:center;padding:1rem}.girafe-button-big img{overflow:hidden}.girafe-button-large{flex-direction:row}.girafe-button-large img{height:2rem;margin:.3rem}.girafe-button-large span{height:2rem;margin:.3rem;line-height:2rem}.girafe-button-small{min-width:calc(var(--app-standard-height)/2);height:calc(var(--app-standard-height)/2);align-items:center;padding:.5rem}.girafe-button-small img{overflow:hidden}.girafe-button-small span{text-align:left;text-overflow:ellipsis;width:100%;overflow:hidden}.girafe-button-tiny{align-items:center;width:1rem;height:1rem;padding:0}.girafe-button-tiny img{overflow:hidden}.girafe-onboarding-theme{background-color:var(--bkg-color)!important;color:var(--text-color)!important}.girafe-onboarding-theme button{background-color:var(--bkg-color)!important;color:var(--text-color)!important;text-shadow:none!important}.girafe-onboarding-theme button.driver-popover-close-btn{z-index:10000}
|
|
22
23
|
</style><style>
|
|
23
|
-
.hidden{display:none}#searchbox{background-color:var(--bkg-color);border:1px solid #cfd6dd;border-radius:4px;flex-direction:row;width:100%;height:2.25rem;display:flex}#search{-webkit-appearance:none;width:auto;height:2.25rem;color:var(--text-color);background:0 0;border:0;outline:none;-webkit-flex:auto;-ms-flex:auto;flex:auto;margin:0 0 0 .5rem;padding-left:.8rem;font-size:1rem}.search-icon,.close-icon,.select-color-icon{width:14px;color:var(--text-color);padding:0 1rem}.close-button,.select-color-button{cursor:pointer;background-color:#0000;border:none;padding:0}#results{z-index:1000;background-color:var(--bkg-color);scrollbar-width:thin;width:36rem;max-height:31rem;margin-top:.1rem;margin-bottom:.5rem;position:absolute;top:3.5rem;overflow-x:hidden}.result,.title{width:34rem;padding:.3rem 1rem;line-height:1.3rem;display:inline-block}.title{color:var(--text-color);padding-top:1.5rem;font-size:1.3rem;font-weight:600;line-height:2.5rem}.result{cursor:pointer;text-align:left;width:100%;color:var(--text-color);background:0 0;border:none;border-top:1px solid #ccc}.title img{width:14px;margin-right:1rem}.title span{text-transform:uppercase}.result.selected{color:var(--text-color);background-color:#aaa!important}#no-result{background:var(--warning-color);opacity:.75;visibility:hidden;pointer-events:none;border-radius:6px;width:fit-content;margin:auto;padding:.5rem 0;font-size:1rem;position:absolute;top:3.5rem;left:0;right:0}#no-result>span{padding:1.3rem}@keyframes fadeOut{0%{opacity:1}80%{opacity:1}to{opacity:0}}.shown-then-fadeout{animation:2s ease-in-out forwards fadeOut;visibility:visible!important}
|
|
24
|
+
.hidden{display:none}#searchbox{background-color:var(--bkg-color);border:1px solid #cfd6dd;border-radius:4px;flex-direction:row;width:100%;height:2.25rem;display:flex;& slot[name=search-tooltip]{display:none}}#search{-webkit-appearance:none;width:auto;height:2.25rem;color:var(--text-color);background:0 0;border:0;outline:none;-webkit-flex:auto;-ms-flex:auto;flex:auto;margin:0 0 0 .5rem;padding-left:.8rem;font-size:1rem}.search-icon,.close-icon,.select-color-icon{width:14px;color:var(--text-color);padding:0 1rem}.close-button,.select-color-button{cursor:pointer;background-color:#0000;border:none;padding:0}#results{z-index:1000;background-color:var(--bkg-color);scrollbar-width:thin;width:36rem;max-height:31rem;margin-top:.1rem;margin-bottom:.5rem;position:absolute;top:3.5rem;overflow-x:hidden}.result,.title{width:34rem;padding:.3rem 1rem;line-height:1.3rem;display:inline-block}.title{color:var(--text-color);padding-top:1.5rem;font-size:1.3rem;font-weight:600;line-height:2.5rem}.result{cursor:pointer;text-align:left;width:100%;color:var(--text-color);background:0 0;border:none;border-top:1px solid #ccc}.title img{width:14px;margin-right:1rem}.title span{text-transform:uppercase}.result.selected{color:var(--text-color);background-color:#aaa!important}#no-result{background:var(--warning-color);opacity:.75;visibility:hidden;pointer-events:none;border-radius:6px;width:fit-content;margin:auto;padding:.5rem 0;font-size:1rem;position:absolute;top:3.5rem;left:0;right:0}#no-result>span{padding:1.3rem}@keyframes fadeOut{0%{opacity:1}80%{opacity:1}to{opacity:0}}.shown-then-fadeout{animation:2s ease-in-out forwards fadeOut;visibility:visible!important}
|
|
24
25
|
</style>
|
|
25
|
-
<link rel="stylesheet" href="lib/vanilla-picker/vanilla-picker.csp.css"><link rel="stylesheet" href="styles/girafecolorpicker.css"><div id="searchbox"><
|
|
26
|
+
<link rel="stylesheet" href="lib/vanilla-picker/vanilla-picker.csp.css"><link rel="stylesheet" href="styles/girafecolorpicker.css"><div id="searchbox"><slot name="search-tooltip"></slot><input id="search" class="gg-input" length="20" maxlength="1000" autocomplete="off" autocorrect="off" i18n="Search..." placeholder="Search..." oninput="${(e) => this.doSearchDebounced(e)}" onfocusin="${() => this.onFocusIn()}" onfocusout="${() => this.onFocusOut()}" onkeydown="${(e) => this.onKeyDown(e)}"> <img class="${this.allResults.length > 0 ? 'hidden' : 'search-icon'}" alt="search-icon" src="${this.searchIcon}"> <button class="${this.allResults.length > 0 ? 'close-button' : 'hidden'}" onclick="${() => this.clearSearch(true)}"><img class="close-icon" alt="close-icon" src="icons/close.svg"></button> <button tip="change_search_result_color" id="colorPickerBtn" class="${this.paintSearchResults ? 'select-color-button' : 'hidden'}"><img class="select-color-icon" alt="select-color-icon" src="${this.paintbrushIcon}"></button><div id="results" class="${Object.keys(this.groupedResults).length === 0 || this.forceHide ? 'hidden' : ''}" onmousemove="${() => this.onMouseMove()}">${Object.keys(this.groupedResults).map(group => uHtml `<div class="title"><img alt="result icon" src="${this.getIcon(group)}"> <span i18n="${group}"></span></div>${this.groupedResults[group].map(result => uHtml ` <button class="${result.get('selected') ? 'result selected' : 'result'}" onmousedown="${() => this.onMouseDown()}" onclick="${() => this.onSelect(result)}" onmouseover="${() => this.onMouseOver(result)}" onmouseleave="${() => this.onMouseLeave()}">${result.get('label')}</button> `)} `)}</div><div id="no-result" class="${this.showNoResultWarning ? 'shown-then-fadeout' : ''}"><span i18n="${'No match found'}"></span></div></div>`;
|
|
26
27
|
};
|
|
27
28
|
searchIcon = SearchIcon;
|
|
28
29
|
paintbrushIcon = PaintbrushIcon;
|
|
@@ -116,6 +117,7 @@ class SearchComponent extends GirafeHTMLElement {
|
|
|
116
117
|
this.render();
|
|
117
118
|
super.girafeTranslate();
|
|
118
119
|
this.registerEvents();
|
|
120
|
+
this.createTooltip();
|
|
119
121
|
if (this.context.permalinkManager.hasSearch()) {
|
|
120
122
|
this.subscribe('application.isReady', () => {
|
|
121
123
|
if (this.state.application.isReady) {
|
|
@@ -454,6 +456,39 @@ class SearchComponent extends GirafeHTMLElement {
|
|
|
454
456
|
break;
|
|
455
457
|
}
|
|
456
458
|
}
|
|
459
|
+
createTooltip() {
|
|
460
|
+
const searchInput = this.shadowRoot?.getElementById('search');
|
|
461
|
+
if (searchInput) {
|
|
462
|
+
// Create a tooltip using tippy.js
|
|
463
|
+
tippy(searchInput, {
|
|
464
|
+
content: () => {
|
|
465
|
+
// Check if there's a slot named "search-tooltip"
|
|
466
|
+
const slot = this.shadow.querySelector('slot[name="search-tooltip"]');
|
|
467
|
+
if (slot) {
|
|
468
|
+
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
469
|
+
if (assignedNodes.length > 0) {
|
|
470
|
+
// Create a temporary div to hold the content
|
|
471
|
+
const tooltipContent = document.createElement('div');
|
|
472
|
+
assignedNodes.forEach((node) => {
|
|
473
|
+
tooltipContent.appendChild(node.cloneNode(true));
|
|
474
|
+
});
|
|
475
|
+
return tooltipContent;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
// Fallback to the default tooltip text if no slot content is found
|
|
479
|
+
return this.context.i18nManager.getTranslation('search_tooltip') || 'Search...';
|
|
480
|
+
},
|
|
481
|
+
trigger: 'mouseenter',
|
|
482
|
+
hideOnClick: false,
|
|
483
|
+
interactive: true,
|
|
484
|
+
theme: 'light',
|
|
485
|
+
placement: 'bottom',
|
|
486
|
+
arrow: true,
|
|
487
|
+
appendTo: document.body,
|
|
488
|
+
maxWidth: '300px'
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
457
492
|
initColorPicker() {
|
|
458
493
|
super.render();
|
|
459
494
|
const colorPicker = this.shadowRoot?.getElementById('colorPickerBtn');
|
|
@@ -2,6 +2,7 @@ import FeatureToGridDataById from '../../../tools/featuretogriddatabyid.js';
|
|
|
2
2
|
import { TabulatorFull as Tabulator } from 'tabulator-tables';
|
|
3
3
|
import { getUid } from 'ol/util.js';
|
|
4
4
|
import ColumnAliasHelper from '../../../tools/utils/aliases.js';
|
|
5
|
+
import { linkify } from '../../../tools/utils/utils.js';
|
|
5
6
|
const geometryColumns = new Set(['geom', 'the_geom', 'geometry']);
|
|
6
7
|
export default class SelectionTabulatorManager {
|
|
7
8
|
featureToGridData;
|
|
@@ -140,10 +141,13 @@ export default class SelectionTabulatorManager {
|
|
|
140
141
|
const columns = entry.columns;
|
|
141
142
|
const notOlProperties = entry.notOlProperties;
|
|
142
143
|
for (const [_, row] of Object.entries(notOlProperties)) {
|
|
143
|
-
for (const [key,
|
|
144
|
+
for (const [key, value] of Object.entries(row)) {
|
|
144
145
|
if (!columns.includes(key)) {
|
|
145
146
|
delete row[key];
|
|
146
147
|
}
|
|
148
|
+
else if (typeof value === 'string') {
|
|
149
|
+
row[key] = linkify(value);
|
|
150
|
+
}
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
}
|
package/package.json
CHANGED
package/templates/index.html
CHANGED
|
@@ -86,7 +86,13 @@
|
|
|
86
86
|
<header>
|
|
87
87
|
<girafe-theme-select data-tour="theme-selection"></girafe-theme-select>
|
|
88
88
|
<img class="logo" alt="geogirafe-logo" src="images/logo/horizontal_black.svg" />
|
|
89
|
-
<girafe-search id="search"
|
|
89
|
+
<girafe-search id="search">
|
|
90
|
+
<!-- <div slot="search-tooltip">
|
|
91
|
+
<p>
|
|
92
|
+
Create a custom tooltip
|
|
93
|
+
</p>
|
|
94
|
+
</div> -->
|
|
95
|
+
</girafe-search>
|
|
90
96
|
<girafe-oauth></girafe-oauth>
|
|
91
97
|
<girafe-nav-history></girafe-nav-history>
|
|
92
98
|
<girafe-video-record></girafe-video-record>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.1.0-dev.
|
|
1
|
+
{"version":"1.1.0-dev.2334458755", "build":"2334458755", "date":"18/02/2026"}
|
package/tools/utils/utils.js
CHANGED
|
@@ -168,7 +168,7 @@ export const applyFeaturesToSelection = (features, state) => {
|
|
|
168
168
|
state.selection.highlightedFeatures = [];
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
const urlRegExp = /(https?:\/\/[^"<]*?(?=\s|$|<\/[^a]>))/gi;
|
|
171
|
+
const urlRegExp = /(https?:\/\/[^"'<]*?(?=\s|$|<\/[^a]>))/gi;
|
|
172
172
|
const telRegExp = /((\b(0041|0)|\B\+41)(\s?\(0\))?(\s)?[1-9]{2}(\s)?\d{3}(\s)?\d{2}(\s)?\d{2}\b)/gi;
|
|
173
173
|
const mailRegExp = /(^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$)/gi; //NOSONAR(typescript:S5843) As this is the official Regular Expression, we will not mess around with it
|
|
174
174
|
export const linkify = (str) => {
|
|
@@ -69,6 +69,11 @@ it('should return already wrapped link unchanged', () => {
|
|
|
69
69
|
const linkifiedLink = linkify(alreadyWrappedLink);
|
|
70
70
|
expect(linkifiedLink).toEqual(alreadyWrappedLink);
|
|
71
71
|
});
|
|
72
|
+
it('should return already wrapped link using single quotation mark instead of quotation mark unchanged', () => {
|
|
73
|
+
const alreadyWrappedLink = "<a href='https://intercapi.vd.ch/territoire/intercapi/faces?type=grundstueck_grundbuch_auszug&bfs=5890&n1=210' target='_blank'>Cliquer ici</a>";
|
|
74
|
+
const linkifiedLink = linkify(alreadyWrappedLink);
|
|
75
|
+
expect(linkifiedLink).toEqual(alreadyWrappedLink);
|
|
76
|
+
});
|
|
72
77
|
it('should return phone number with country code wrapped in Anchor-Element', () => {
|
|
73
78
|
const phoneNumber = '+41 61 267 99 53';
|
|
74
79
|
const linkifiedPhoneNumber = linkify(phoneNumber);
|