@geogirafe/lib-geoportal 1.1.0-dev.2597268561 → 1.1.0-dev.2605752849
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/LICENSE +4 -0
- package/api/apicontext.d.ts +2 -0
- package/api/apicontext.js +4 -0
- package/api/apigeogirafeapp.js +5 -6
- package/assets/i18n/de.json +5 -0
- package/assets/i18n/en.json +7 -2
- package/assets/i18n/fr.json +5 -0
- package/assets/i18n/it.json +5 -0
- package/assets/icons/feedback-comment-add.svg +1 -0
- package/assets/icons/feedback-comment.svg +1 -0
- package/assets/icons/feedback-thumb-down.svg +1 -0
- package/assets/icons/feedback-thumb-up.svg +1 -0
- package/base/GirafeHTMLElement.d.ts +2 -0
- package/base/GirafeHTMLElement.js +4 -0
- package/buildtools/tools.js +2 -1
- package/components/about/component.js +2 -1
- package/components/addbookmark/component.js +2 -1
- package/components/advancedfilter/component.js +2 -1
- package/components/alignnorthbutton-mobile/component.js +2 -1
- package/components/auth/component.js +2 -1
- package/components/auth-mobile/component.js +2 -1
- package/components/basemap/component.js +2 -1
- package/components/contact/component.js +2 -1
- package/components/context-menu/custom-context-menu/component.js +2 -1
- package/components/context-menu/custom-context-menu/style.css +19 -18
- package/components/context-menu/default-context-menu/component.js +2 -1
- package/components/coordinate/component.js +2 -1
- package/components/cross-section/cross-section-settings/component.js +2 -1
- package/components/cross-section/cross-section-viewer/component.js +2 -1
- package/components/displaymenubutton-mobile/component.js +2 -1
- package/components/displayselectorbutton-mobile/component.js +2 -1
- package/components/drawing/component-mobile.js +2 -1
- package/components/drawing/component.js +2 -1
- package/components/drawing/fixed-dimension/component.js +2 -1
- package/components/drawing/style.css +5 -5
- package/components/drawing-container-mobile/component.js +2 -1
- package/components/drawing-toolbar/component.js +2 -1
- package/components/edit/component.js +2 -1
- package/components/edit/editform/component.js +2 -1
- package/components/extlayers/component.js +2 -1
- package/components/feedbackbutton/component.d.ts +28 -0
- package/components/feedbackbutton/component.js +195 -0
- package/components/feedbackbutton/style.css +23 -0
- package/components/geolocation-mobile/component.js +2 -1
- package/components/getdirections/component.d.ts +0 -1
- package/components/getdirections/component.js +2 -2
- package/components/help/component.js +2 -1
- package/components/infobox/component.js +2 -1
- package/components/infowindow/component.js +2 -1
- package/components/layout/component.js +2 -1
- package/components/lr-panel/component.js +2 -1
- package/components/main.d.ts +1 -0
- package/components/main.js +1 -0
- package/components/map/component.js +5 -2
- package/components/menu-buttons-mobile/MenuMobile3dButton.js +2 -1
- package/components/menu-buttons-mobile/MenuMobileDrawingButton.js +2 -1
- package/components/menu-buttons-mobile/MenuMobileOfflineButton.js +2 -1
- package/components/menu-mobile/component.js +2 -1
- package/components/menubutton/component.js +2 -1
- package/components/modals/component.js +2 -1
- package/components/navigation/component.js +2 -1
- package/components/news/news-button/component.js +2 -1
- package/components/news/news-panel/component.js +2 -1
- package/components/offline/component.js +2 -1
- package/components/print/component.js +2 -1
- package/components/prototypebanner/component.js +2 -1
- package/components/querybuilder/component.js +2 -1
- package/components/scale/component.js +2 -1
- package/components/search/component.js +2 -1
- package/components/search-mobile/component.js +2 -1
- package/components/selectiongrid/component.js +2 -1
- package/components/selectiongrid/style.css +1 -1
- package/components/selectionpanel-mobile/component.js +2 -1
- package/components/selectiontool/component.js +2 -1
- package/components/selectionwindow/component.js +2 -1
- package/components/share/component.js +2 -1
- package/components/swipe-up-panel-mobile/component.js +2 -1
- package/components/themes/component.js +2 -1
- package/components/themes-mobile/group/component.js +2 -1
- package/components/themes-mobile/layer/component.js +2 -1
- package/components/themes-mobile/layer-selected/component.js +2 -1
- package/components/themes-mobile/theme/component.js +2 -1
- package/components/themes-mobile/themes-select/component.js +2 -1
- package/components/timerestriction/component.js +2 -1
- package/components/timerestriction/timepicker/component.js +2 -1
- package/components/timerestriction/timeslider/component.js +2 -1
- package/components/treeview/treeviewgroup/component.js +2 -1
- package/components/treeview/treeviewitem/component.js +7 -4
- package/components/treeview/treeviewroot/component.js +2 -1
- package/components/treeview/treeviewroot/style.css +1 -1
- package/components/treeview/treeviewtheme/component.js +2 -1
- package/components/userpreferences/component.js +2 -1
- package/components/videorecord/component.js +2 -1
- package/package.json +3 -3
- package/styles/index.css +2 -2
- package/templates/api.html +4 -1
- package/templates/index.html +5 -2
- package/templates/public/about.json +1 -1
- package/tools/app/geogirafeapp.js +2 -0
- package/tools/configuration/girafeconfig.d.ts +11 -0
- package/tools/configuration/girafeconfig.js +27 -22
- package/tools/context/context.d.ts +2 -0
- package/tools/context/context.js +4 -0
- package/tools/context/icontext.d.ts +2 -0
- package/tools/feedback/feedbackmanager.d.ts +16 -0
- package/tools/feedback/feedbackmanager.js +73 -0
- package/tools/main.d.ts +2 -0
- package/tools/main.js +1 -0
- package/tools/state/componentManager.d.ts +5 -3
- package/tools/state/componentManager.js +5 -3
- package/tools/state/mapposition.js +1 -1
- package/tools/tests/mockcontext.d.ts +2 -0
- package/tools/tests/mockcontext.js +4 -0
- package/tools/utils/utils.js +6 -4
- package/components/addbookmark/style.css +0 -0
|
@@ -16,7 +16,8 @@ class TreeViewRootComponent extends GirafeHTMLElement {
|
|
|
16
16
|
*{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}
|
|
17
17
|
</style>
|
|
18
18
|
<style>${this.customStyle}</style>
|
|
19
|
-
<link rel="stylesheet" href="lib/tippy.js/tippy.css"><link rel="stylesheet" href="lib/tippy.js/backdrop.css"><link rel="stylesheet" href="lib/tippy.js/border.css"><link rel="stylesheet" href="lib/tippy.js/svg-arrow.css"><div id="panel" class="panel"><div class="menu"><button class="gg-icon-button gg-medium" tip="Expand / Collapse all" onclick="${() => this.expandAll()}"><img class="${this.isAllExpanded ? '' : 'hidden'}" alt="Collapse all icon" src="icons/collapse-all.svg"> <img class="${this.isAllExpanded ? 'hidden' : ''}" alt="Expand all icon" src="icons/expand-all.svg"></button> <button class="gg-icon-button gg-medium" tip="Toggle all legends" onclick="${() => this.toggleAllLegends()}"><img alt="Toggle all legends icon" src="icons/legend.svg"></button> <button class="gg-icon-button gg-medium" tip="Remove all layers" onclick="${() => this.removeAll()}"><img alt="Remove all layers icon" src="icons/trash.svg"></button><div class="treeview-search" data-tour="treeview-filter"><img class="filter-icon" alt="filter-button-icon" src="icons/filter.svg"> <input id="treeview-search-field" class="gg-input" placeholder="Filter layer tree..." i18n="Filter layer tree..." autocomplete="off" autocorrect="off" oninput="${(e) => this.filterTree(e.target.value)}"> <button class="${this.isTreeFiltered ? 'delete-button' : 'hidden'}" onclick="${() => this.clearFilter()}"><img class="delete-icon" alt="delete-button-icon" tip="Reset filter" i18n="Reset filter" src="icons/trash.svg"></button></div></div><div class="${this.state.layers.layersList.length > 0 ? 'treeview-list' : 'hidden'}">${this.sortedLayers().filter(layer => layer.isVisible).map(layer => (layer instanceof ThemeLayer) ? uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-theme themeid="${layer.treeItemId}"></girafe-tree-view-theme>` : (layer instanceof GroupLayer) ? uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-group groupid="${layer.treeItemId}"></girafe-tree-view-group>` : uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-item layerid="${layer.treeItemId}"></girafe-tree-view-item>`)}</div><div class="${this.state.layers.layersList.length > 0 ? 'hidden' : 'treeview-no-data'}"><div class="${this.state.themes.isLoaded ? 'hidden' : 'treeview-loading'}"><img loading="eager" src="icons/progress.svg" class="gg-spin gg-big" alt="${this.context.i18nManager.getTranslation('Loading')}"><div><span i18n="Loading">Loading...</span></div></div><div class="${this.state.themes.isLoaded ? 'no-data' : 'hidden'}"><span i18n="Nothing here yet!">Nothing here yet!</span> <span>-</span> <span i18n="Add your first items">Add your first items</span> <span i18n="by selecting a theme">by selecting a theme</span> <span i18n="or">or</span> <span i18n="using the search bar">using the search bar</span></div></div></div
|
|
19
|
+
<link rel="stylesheet" href="lib/tippy.js/tippy.css"><link rel="stylesheet" href="lib/tippy.js/backdrop.css"><link rel="stylesheet" href="lib/tippy.js/border.css"><link rel="stylesheet" href="lib/tippy.js/svg-arrow.css"><div id="panel" class="panel"><div class="menu"><button class="gg-icon-button gg-medium" tip="Expand / Collapse all" onclick="${() => this.expandAll()}"><img class="${this.isAllExpanded ? '' : 'hidden'}" alt="Collapse all icon" src="icons/collapse-all.svg"> <img class="${this.isAllExpanded ? 'hidden' : ''}" alt="Expand all icon" src="icons/expand-all.svg"></button> <button class="gg-icon-button gg-medium" tip="Toggle all legends" onclick="${() => this.toggleAllLegends()}"><img alt="Toggle all legends icon" src="icons/legend.svg"></button> <button class="gg-icon-button gg-medium" tip="Remove all layers" onclick="${() => this.removeAll()}"><img alt="Remove all layers icon" src="icons/trash.svg"></button><div class="treeview-search" data-tour="treeview-filter"><img class="filter-icon" alt="filter-button-icon" src="icons/filter.svg"> <input id="treeview-search-field" class="gg-input" placeholder="Filter layer tree..." i18n="Filter layer tree..." autocomplete="off" autocorrect="off" oninput="${(e) => this.filterTree(e.target.value)}"> <button class="${this.isTreeFiltered ? 'delete-button' : 'hidden'}" onclick="${() => this.clearFilter()}"><img class="delete-icon" alt="delete-button-icon" tip="Reset filter" i18n="Reset filter" src="icons/trash.svg"></button></div></div><div class="${this.state.layers.layersList.length > 0 ? 'treeview-list' : 'hidden'}">${this.sortedLayers().filter(layer => layer.isVisible).map(layer => (layer instanceof ThemeLayer) ? uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-theme themeid="${layer.treeItemId}"></girafe-tree-view-theme>` : (layer instanceof GroupLayer) ? uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-group groupid="${layer.treeItemId}"></girafe-tree-view-group>` : uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-item layerid="${layer.treeItemId}"></girafe-tree-view-item>`)}</div><div class="${this.state.layers.layersList.length > 0 ? 'hidden' : 'treeview-no-data'}"><div class="${this.state.themes.isLoaded ? 'hidden' : 'treeview-loading'}"><img loading="eager" src="icons/progress.svg" class="gg-spin gg-big" alt="${this.context.i18nManager.getTranslation('Loading')}"><div><span i18n="Loading">Loading...</span></div></div><div class="${this.state.themes.isLoaded ? 'no-data' : 'hidden'}"><span i18n="Nothing here yet!">Nothing here yet!</span> <span>-</span> <span i18n="Add your first items">Add your first items</span> <span i18n="by selecting a theme">by selecting a theme</span> <span i18n="or">or</span> <span i18n="using the search bar">using the search bar</span></div></div></div>
|
|
20
|
+
${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
20
21
|
};
|
|
21
22
|
filterHelper;
|
|
22
23
|
isAllExpanded = false;
|
|
@@ -17,7 +17,8 @@ header{border-top:1px solid #ddd;align-items:center;height:2rem;display:flex}.to
|
|
|
17
17
|
header{border:none;flex-direction:row-reverse;margin-top:.5rem;margin-bottom:.5rem;position:relative}.theme-button{font-size:1.2rem;font-weight:600}.theme-button span{margin-left:.5rem}.theme-button:hover{cursor:default;background-color:#0000;border:none}.children{padding-left:.5rem}.children:first-child{border:none}.label-container{position:absolute;inset:0}.label-container button{text-align:center;flex-grow:1}.tool{z-index:1}
|
|
18
18
|
</style>
|
|
19
19
|
<style>${this.customStyle}</style>
|
|
20
|
-
<link rel="stylesheet" href="lib/tippy.js/tippy.css"><link rel="stylesheet" href="lib/tippy.js/backdrop.css"><link rel="stylesheet" href="lib/tippy.js/border.css"><link rel="stylesheet" href="lib/tippy.js/svg-arrow.css"><div id="container"><header><div class="label-container"><button class="gg-icon-button gg-small theme-button" onclick="${() => this.layer.isExpanded = !this.layer.isExpanded}"><img alt="theme-icon" src="icons/theme.svg"> <span i18n="${this.layer.name}" class="gg-tree-label">${this.layer.name}</span></button></div><button class="${this.getButtonClass('removable')}" tip="Remove theme" onclick="${() => this.deleteTheme()}"><img alt="Remove theme" src="icons/trash.svg"></button> <button id="drag-button" class="${this.getButtonClass('draggable')}" tip="Move"><img alt="Move layer" src="icons/drag.svg"></button></header><div class="${((this.layer.isExpanded && this.layer.isVisible) ? 'children' : 'hidden')}">${this.sortedChildren().filter(layer => layer.isVisible).map(layer => (layer instanceof GroupLayer) ? uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-group groupid="${layer.treeItemId}"></girafe-tree-view-group>` : uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-item layerid="${layer.treeItemId}"></girafe-tree-view-item>`)}</div></div
|
|
20
|
+
<link rel="stylesheet" href="lib/tippy.js/tippy.css"><link rel="stylesheet" href="lib/tippy.js/backdrop.css"><link rel="stylesheet" href="lib/tippy.js/border.css"><link rel="stylesheet" href="lib/tippy.js/svg-arrow.css"><div id="container"><header><div class="label-container"><button class="gg-icon-button gg-small theme-button" onclick="${() => this.layer.isExpanded = !this.layer.isExpanded}"><img alt="theme-icon" src="icons/theme.svg"> <span i18n="${this.layer.name}" class="gg-tree-label">${this.layer.name}</span></button></div><button class="${this.getButtonClass('removable')}" tip="Remove theme" onclick="${() => this.deleteTheme()}"><img alt="Remove theme" src="icons/trash.svg"></button> <button id="drag-button" class="${this.getButtonClass('draggable')}" tip="Move"><img alt="Move layer" src="icons/drag.svg"></button></header><div class="${((this.layer.isExpanded && this.layer.isVisible) ? 'children' : 'hidden')}">${this.sortedChildren().filter(layer => layer.isVisible).map(layer => (layer instanceof GroupLayer) ? uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-group groupid="${layer.treeItemId}"></girafe-tree-view-group>` : uHtmlFor(layer, layer.treeItemId) `<girafe-tree-view-item layerid="${layer.treeItemId}"></girafe-tree-view-item>`)}</div></div>
|
|
21
|
+
${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
21
22
|
};
|
|
22
23
|
layer;
|
|
23
24
|
constructor(theme) {
|
|
@@ -20,7 +20,8 @@ export default class UserPreferencesComponent extends GirafeHTMLElement {
|
|
|
20
20
|
#content{background:var(--bkg-color);color:var(--text-color);margin:0;padding:1rem}.preference-group{padding-bottom:1rem}.preference-group-title{padding-bottom:10px;font-weight:700}.preference-row{flex-direction:column;padding-bottom:8px;display:flex}.with-checkbox,.with-colorpicker{flex-direction:row;justify-content:space-between;align-items:center;height:2rem}.colorpicker{border:solid 1px var(--text-color);cursor:pointer;border-radius:3px;width:1.5rem;height:1.5rem}#reset-all{justify-self:end}#footer{margin-top:2rem}
|
|
21
21
|
</style>
|
|
22
22
|
<style>${this.customStyle}</style>
|
|
23
|
-
<link rel="stylesheet" href="lib/vanilla-picker/vanilla-picker.csp.css"><link rel="stylesheet" href="styles/girafecolorpicker.css"><div id="panel"><div id="content">${this.preferenceGroups.map(group => uHtml `<div class="preference-group"><div class="preference-group-title" i18n="${group}">${group}</div>${this.getPreferencesByGroup(group).map(([preference, key]) => uHtmlFor(preference, key) ` ${preference.uiElement === 'select' ? uHtml `<div class="preference-row" hidden="${!preference.visible}"><label for="${key}" class="gg-label" i18n="${key}">${key}</label> <select id="${key}" class="gg-select" onchange="${(evt) => this.onSelectOption(key, evt)}" onmousedown="${() => this.onOpenSelectOption(key)}">${preference.options.map(option => uHtml `<option i18n="${option.label}" ?selected="${preference.currentValue === option.value}" value="${option.label}">${option.label}</option>`)}</select></div>` : uHtml ``} ${preference.uiElement === 'checkbox' ? uHtml `<div class="preference-row with-checkbox" hidden="${!preference.visible}"><label for="${key}" i18n="${key}">${key}</label> <input id="${key}" type="checkbox" class="gg-checkbox" ?checked="${preference.currentValue}" onchange="${() => this.changePreference(key, !preference.currentValue)}"></div>` : uHtml ``} ${preference.uiElement === 'color' ? uHtml `<div class="preference-row with-colorpicker" hidden="${!preference.visible}"><label for="${key}" i18n="${key}">${key}</label> <button class="colorpicker" id="${key}"></button></div>` : uHtml ``} `)}</div>`)}<div id="footer"><button id="reset-all" class="gg-button" tip="Reset all preferences back to the default value" i18n="Reset All" onclick="${() => this.onResetAll()}">Reset All</button></div></div></div
|
|
23
|
+
<link rel="stylesheet" href="lib/vanilla-picker/vanilla-picker.csp.css"><link rel="stylesheet" href="styles/girafecolorpicker.css"><div id="panel"><div id="content">${this.preferenceGroups.map(group => uHtml `<div class="preference-group"><div class="preference-group-title" i18n="${group}">${group}</div>${this.getPreferencesByGroup(group).map(([preference, key]) => uHtmlFor(preference, key) ` ${preference.uiElement === 'select' ? uHtml `<div class="preference-row" hidden="${!preference.visible}"><label for="${key}" class="gg-label" i18n="${key}">${key}</label> <select id="${key}" class="gg-select" onchange="${(evt) => this.onSelectOption(key, evt)}" onmousedown="${() => this.onOpenSelectOption(key)}">${preference.options.map(option => uHtml `<option i18n="${option.label}" ?selected="${preference.currentValue === option.value}" value="${option.label}">${option.label}</option>`)}</select></div>` : uHtml ``} ${preference.uiElement === 'checkbox' ? uHtml `<div class="preference-row with-checkbox" hidden="${!preference.visible}"><label for="${key}" i18n="${key}">${key}</label> <input id="${key}" type="checkbox" class="gg-checkbox" ?checked="${preference.currentValue}" onchange="${() => this.changePreference(key, !preference.currentValue)}"></div>` : uHtml ``} ${preference.uiElement === 'color' ? uHtml `<div class="preference-row with-colorpicker" hidden="${!preference.visible}"><label for="${key}" i18n="${key}">${key}</label> <button class="colorpicker" id="${key}"></button></div>` : uHtml ``} `)}</div>`)}<div id="footer"><button id="reset-all" class="gg-button" tip="Reset all preferences back to the default value" i18n="Reset All" onclick="${() => this.onResetAll()}">Reset All</button></div></div></div>
|
|
24
|
+
${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
24
25
|
};
|
|
25
26
|
isPanelVisible = false;
|
|
26
27
|
panelTitle = 'user-preferences-panel';
|
|
@@ -12,7 +12,8 @@ class VideoRecordComponent extends GirafeHTMLElement {
|
|
|
12
12
|
button img{width:1.5rem}
|
|
13
13
|
</style>
|
|
14
14
|
<style>${this.customStyle}</style>
|
|
15
|
-
<button tip="record_video" class="${this.status === 'downloaded' ? 'gg-icon-button gg-big' : 'hidden'}" onclick="${() => this.startRecording()}"><img alt="help-icon" src="icons/video-record.svg"></button> <button tip="stop_video" class="${this.status === 'recording' ? 'gg-icon-button gg-big' : 'hidden'}" onclick="${() => this.stopRecording()}"><img alt="help-icon" src="icons/video-stop.svg"></button> <button tip="download_video" class="${this.status === 'recorded' ? 'gg-icon-button gg-big' : 'hidden'}" onclick="${() => this.downloadRecord()}"><img alt="help-icon" src="icons/video-download.svg"></button
|
|
15
|
+
<button tip="record_video" class="${this.status === 'downloaded' ? 'gg-icon-button gg-big' : 'hidden'}" onclick="${() => this.startRecording()}"><img alt="help-icon" src="icons/video-record.svg"></button> <button tip="stop_video" class="${this.status === 'recording' ? 'gg-icon-button gg-big' : 'hidden'}" onclick="${() => this.stopRecording()}"><img alt="help-icon" src="icons/video-stop.svg"></button> <button tip="download_video" class="${this.status === 'recorded' ? 'gg-icon-button gg-big' : 'hidden'}" onclick="${() => this.downloadRecord()}"><img alt="help-icon" src="icons/video-download.svg"></button>
|
|
16
|
+
${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
16
17
|
};
|
|
17
18
|
status = 'downloaded';
|
|
18
19
|
mediaRecorder = null;
|
package/package.json
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"description": "GeoGirafe is a flexible application to build online geoportals.",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "GeoGirafe PSC",
|
|
6
|
-
"url": "https://doc.
|
|
6
|
+
"url": "https://doc.geogirafe.org"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.1.0-dev.
|
|
8
|
+
"version": "1.1.0-dev.2605752849",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=20.19.0"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"websig"
|
|
32
32
|
],
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
|
-
"homepage": "https://doc.
|
|
34
|
+
"homepage": "https://doc.geogirafe.org",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"buffer": "6.0.3",
|
|
37
37
|
"d3": "7.9.0",
|
package/styles/index.css
CHANGED
|
@@ -228,7 +228,7 @@ girafe-prototype-banner {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
/* For showing a Popup of an Image found in Selection */
|
|
231
|
-
div.tippy-box[data-theme=image-popup] {
|
|
231
|
+
div.tippy-box[data-theme='image-popup'] {
|
|
232
232
|
border: var(--app-standard-border) !important;
|
|
233
233
|
div.tippy-content {
|
|
234
234
|
background-color: var(--bkg-color) !important;
|
|
@@ -240,4 +240,4 @@ div.tippy-box[data-theme=image-popup] {
|
|
|
240
240
|
div.tippy-arrow {
|
|
241
241
|
color: var(--bkg-color) !important;
|
|
242
242
|
}
|
|
243
|
-
}
|
|
243
|
+
}
|
package/templates/api.html
CHANGED
|
@@ -323,7 +323,10 @@
|
|
|
323
323
|
<ul>
|
|
324
324
|
<li><strong>point</strong>: coordinates where the marker should be added.</li>
|
|
325
325
|
<li><strong>title</strong> (optional): the title for the popup shown when clicking on the marker.</li>
|
|
326
|
-
<li
|
|
326
|
+
<li>
|
|
327
|
+
<strong>description</strong> (optional): the description (content) of the popup shown when clicking on the
|
|
328
|
+
marker.
|
|
329
|
+
</li>
|
|
327
330
|
<li><strong>icon</strong>: url to the marker image</li>
|
|
328
331
|
<li><strong>iconSize</strong> (optional): size if the marker should be resized</li>
|
|
329
332
|
<li><strong>iconOffset</strong> (optional): offset if the marker should be shifted</li>
|
package/templates/index.html
CHANGED
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
<span i18n="Information without public faith">Information without public faith</span>
|
|
153
153
|
<span>
|
|
154
154
|
©
|
|
155
|
-
<a href="https://doc.
|
|
155
|
+
<a href="https://doc.geogirafe.org" target="_blank">GeoGirafe</a>,
|
|
156
156
|
<a href="https://www.swisstopo.admin.ch/en/legal-basis" target="_blank">swisstopo</a>,
|
|
157
157
|
<a href="http://www.openstreetmap.org/copyright" target="_blank">OSM</a>
|
|
158
158
|
</span>
|
|
@@ -240,7 +240,10 @@
|
|
|
240
240
|
tip="advanced-filter-panel"
|
|
241
241
|
slot="menu-content"
|
|
242
242
|
class="gg-icon-button gg-big"
|
|
243
|
-
onclick="
|
|
243
|
+
onclick="
|
|
244
|
+
document.geogirafe.state.interface.advancedFilterPanelVisible =
|
|
245
|
+
!document.geogirafe.state.interface.advancedFilterPanelVisible
|
|
246
|
+
">
|
|
244
247
|
<img alt="advanced-filter-icon" src="icons/advanced-filter.svg" />
|
|
245
248
|
</button>
|
|
246
249
|
<button
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.1.0-dev.
|
|
1
|
+
{"version":"1.1.0-dev.2605752849", "build":"2605752849", "date":"16/06/2026"}
|
|
@@ -50,6 +50,7 @@ import SelectionToolComponent from '../../components/selectiontool/component.js'
|
|
|
50
50
|
import AdvancedFilterComponent from '../../components/advancedfilter/component.js';
|
|
51
51
|
import FixedDimensionComponent from '../../components/drawing/fixed-dimension/component.js';
|
|
52
52
|
import GetDirectionsArtifact from '../../components/getdirections/component.js';
|
|
53
|
+
import FeedbackButtonComponent from '../../components/feedbackbutton/component.js';
|
|
53
54
|
import AddBookmarkComponent from '../../components/addbookmark/component.js';
|
|
54
55
|
import DrawingToolbarComponent from '../../components/drawing-toolbar/component.js';
|
|
55
56
|
export default class GeoGirafeApp {
|
|
@@ -147,6 +148,7 @@ export default class GeoGirafeApp {
|
|
|
147
148
|
customElements.define('girafe-video-record', VideoRecordComponent);
|
|
148
149
|
customElements.define('girafe-fixed-dimension', FixedDimensionComponent);
|
|
149
150
|
customElements.define('girafe-get-directions', GetDirectionsArtifact);
|
|
151
|
+
customElements.define('girafe-feedback-button', FeedbackButtonComponent);
|
|
150
152
|
customElements.define('girafe-add-bookmark', AddBookmarkComponent);
|
|
151
153
|
}
|
|
152
154
|
async initializeServiceWorker() {
|
|
@@ -246,6 +246,16 @@ declare class GirafeConfig {
|
|
|
246
246
|
layersWithConfigCenter: string;
|
|
247
247
|
};
|
|
248
248
|
};
|
|
249
|
+
feedback?: {
|
|
250
|
+
url: string;
|
|
251
|
+
method: 'POST' | 'GET';
|
|
252
|
+
components: {
|
|
253
|
+
name: string;
|
|
254
|
+
question: string;
|
|
255
|
+
placement: 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center-center' | 'center-right';
|
|
256
|
+
margins: string;
|
|
257
|
+
}[];
|
|
258
|
+
};
|
|
249
259
|
filtering?: {
|
|
250
260
|
gmfLayerMetadataUrl?: string;
|
|
251
261
|
};
|
|
@@ -290,6 +300,7 @@ declare class GirafeConfig {
|
|
|
290
300
|
private initExternalLayers;
|
|
291
301
|
private initExtendedConfig;
|
|
292
302
|
private initOnboarding;
|
|
303
|
+
private initFeedback;
|
|
293
304
|
private initApiConfig;
|
|
294
305
|
private initConfigFiltering;
|
|
295
306
|
private initPermalinkConfig;
|
|
@@ -35,6 +35,7 @@ class GirafeConfig {
|
|
|
35
35
|
contact;
|
|
36
36
|
onboarding;
|
|
37
37
|
api;
|
|
38
|
+
feedback;
|
|
38
39
|
filtering;
|
|
39
40
|
permalink;
|
|
40
41
|
// The extended configuration can be used by third-party components or extensions
|
|
@@ -48,7 +49,7 @@ class GirafeConfig {
|
|
|
48
49
|
* @param config the configuration
|
|
49
50
|
*/
|
|
50
51
|
constructor(config) {
|
|
51
|
-
// Default values are documented here : https://doc.
|
|
52
|
+
// Default values are documented here : https://doc.geogirafe.org/docs/configuration
|
|
52
53
|
// NOTE: Please adapt the documentation if necessary when doing changes here.
|
|
53
54
|
this.general = this.initConfigGeneral(config);
|
|
54
55
|
this.languages = this.initConfigLanguages(config);
|
|
@@ -75,6 +76,7 @@ class GirafeConfig {
|
|
|
75
76
|
this.contact = this.initConfigContact(config);
|
|
76
77
|
this.extendedConfig = this.initExtendedConfig(config);
|
|
77
78
|
this.onboarding = this.initOnboarding(config);
|
|
79
|
+
this.feedback = this.initFeedback(config);
|
|
78
80
|
this.api = this.initApiConfig(config);
|
|
79
81
|
this.filtering = this.initConfigFiltering(config);
|
|
80
82
|
this.permalink = this.initPermalinkConfig(config);
|
|
@@ -125,7 +127,7 @@ class GirafeConfig {
|
|
|
125
127
|
}
|
|
126
128
|
initConfigProjections(config) {
|
|
127
129
|
if (!config.projections) {
|
|
128
|
-
throw new Error(`Configuration for projections is required. See https://doc.
|
|
130
|
+
throw new Error(`Configuration for projections is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
129
131
|
}
|
|
130
132
|
return config.projections;
|
|
131
133
|
}
|
|
@@ -135,16 +137,16 @@ class GirafeConfig {
|
|
|
135
137
|
initConfigMap(config) {
|
|
136
138
|
// Map
|
|
137
139
|
if (!config.map?.srid) {
|
|
138
|
-
throw new Error(`Configuration for projections is required. See https://doc.
|
|
140
|
+
throw new Error(`Configuration for projections is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
139
141
|
}
|
|
140
142
|
if (!config.map?.scales) {
|
|
141
|
-
throw new Error(`Configuration for projections is required. See https://doc.
|
|
143
|
+
throw new Error(`Configuration for projections is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
142
144
|
}
|
|
143
145
|
if (!config.map?.startPosition) {
|
|
144
|
-
throw new Error(`Configuration for projections is required. See https://doc.
|
|
146
|
+
throw new Error(`Configuration for projections is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
145
147
|
}
|
|
146
148
|
if (!config.map?.startZoom) {
|
|
147
|
-
throw new Error(`Configuration for projections is required. See https://doc.
|
|
149
|
+
throw new Error(`Configuration for projections is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
148
150
|
}
|
|
149
151
|
return {
|
|
150
152
|
srid: config.map.srid,
|
|
@@ -177,10 +179,10 @@ class GirafeConfig {
|
|
|
177
179
|
}
|
|
178
180
|
initConfigShare(config) {
|
|
179
181
|
if (!config.share?.createUrl) {
|
|
180
|
-
throw new Error(`Configuration for share.createUrl is required. See https://doc.
|
|
182
|
+
throw new Error(`Configuration for share.createUrl is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
181
183
|
}
|
|
182
184
|
if (config.share?.service === 'geogirafe' && !config.share?.getUrl) {
|
|
183
|
-
throw new Error(`Configuration for share.getUrl is required if service type is 'geogirafe'. See https://doc.
|
|
185
|
+
throw new Error(`Configuration for share.getUrl is required if service type is 'geogirafe'. See https://doc.geogirafe.org/docs/configuration`);
|
|
184
186
|
}
|
|
185
187
|
return {
|
|
186
188
|
service: config.share?.service ?? 'gmf',
|
|
@@ -202,7 +204,7 @@ class GirafeConfig {
|
|
|
202
204
|
}
|
|
203
205
|
initConfigPrint(config) {
|
|
204
206
|
if (!config.print?.url) {
|
|
205
|
-
throw new Error(`Configuration for print.url is required. See https://doc.
|
|
207
|
+
throw new Error(`Configuration for print.url is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
206
208
|
}
|
|
207
209
|
config.print.attributeNames ??= ['title', 'comments', 'legend'];
|
|
208
210
|
config.print.formats ??= ['pdf', 'png'];
|
|
@@ -210,10 +212,10 @@ class GirafeConfig {
|
|
|
210
212
|
}
|
|
211
213
|
initConfigSearch(config) {
|
|
212
214
|
if (!config.search?.url) {
|
|
213
|
-
throw new Error(`Configuration for search.url is required. See https://doc.
|
|
215
|
+
throw new Error(`Configuration for search.url is required. See https://doc.geogirafe.org/docs/configuration`);
|
|
214
216
|
}
|
|
215
217
|
if (!config.search.url.includes('###SEARCHTERM###')) {
|
|
216
|
-
throw new Error(`search.url is missing the expected pattern. See https://doc.
|
|
218
|
+
throw new Error(`search.url is missing the expected pattern. See https://doc.geogirafe.org/docs/configuration`);
|
|
217
219
|
}
|
|
218
220
|
return {
|
|
219
221
|
url: config.search.url,
|
|
@@ -299,7 +301,7 @@ class GirafeConfig {
|
|
|
299
301
|
}
|
|
300
302
|
initConfigThemes(config) {
|
|
301
303
|
if (!config.themes?.url) {
|
|
302
|
-
throw new Error(`Configuration for themes.url is required. See https://doc.
|
|
304
|
+
throw new Error(`Configuration for themes.url is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
303
305
|
}
|
|
304
306
|
return {
|
|
305
307
|
url: config.themes.url,
|
|
@@ -311,7 +313,7 @@ class GirafeConfig {
|
|
|
311
313
|
}
|
|
312
314
|
initConfigLanguages(config) {
|
|
313
315
|
if (!config.languages) {
|
|
314
|
-
throw new Error(`Configuration for languages is required. See https://doc.
|
|
316
|
+
throw new Error(`Configuration for languages is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
315
317
|
}
|
|
316
318
|
return config.languages;
|
|
317
319
|
}
|
|
@@ -341,14 +343,14 @@ class GirafeConfig {
|
|
|
341
343
|
return undefined;
|
|
342
344
|
}
|
|
343
345
|
if (!config.gmfauth.url) {
|
|
344
|
-
throw new Error(`Configuration for gmfauth.url is required. See https://doc.
|
|
346
|
+
throw new Error(`Configuration for gmfauth.url is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
345
347
|
}
|
|
346
348
|
let gmfauthUrl = config.gmfauth.url;
|
|
347
349
|
if (!config.gmfauth.url.endsWith('/')) {
|
|
348
350
|
gmfauthUrl = `${config.gmfauth.url}/`;
|
|
349
351
|
}
|
|
350
352
|
if (!config.gmfauth.audience) {
|
|
351
|
-
throw new Error(`Configuration for gmfauth.audience is required. See https://doc.
|
|
353
|
+
throw new Error(`Configuration for gmfauth.audience is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
352
354
|
}
|
|
353
355
|
return {
|
|
354
356
|
url: gmfauthUrl,
|
|
@@ -366,16 +368,16 @@ class GirafeConfig {
|
|
|
366
368
|
return undefined;
|
|
367
369
|
}
|
|
368
370
|
if (!config.oauth.issuer.url) {
|
|
369
|
-
throw new Error(`Configuration for oauth.issuer.url is required. See https://doc.
|
|
371
|
+
throw new Error(`Configuration for oauth.issuer.url is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
370
372
|
}
|
|
371
373
|
if (!config.oauth.issuer.clientId) {
|
|
372
|
-
throw new Error(`Configuration for oauth.issuer.clientId is required. See https://doc.
|
|
374
|
+
throw new Error(`Configuration for oauth.issuer.clientId is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
373
375
|
}
|
|
374
376
|
if (!config.oauth.issuer.audience) {
|
|
375
|
-
throw new Error(`Configuration for oauth.issuer.audience is required. See https://doc.
|
|
377
|
+
throw new Error(`Configuration for oauth.issuer.audience is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
376
378
|
}
|
|
377
379
|
if (!config.oauth.geomapfish.userInfoUrl) {
|
|
378
|
-
throw new Error(`Configuration for oauth.geomapfish.userInfoUrl is required. See https://doc.
|
|
380
|
+
throw new Error(`Configuration for oauth.geomapfish.userInfoUrl is required. See https://doc.geogirafe.org/docs/configuration.`);
|
|
379
381
|
}
|
|
380
382
|
const issuerConfig = {
|
|
381
383
|
url: config.oauth.issuer.url,
|
|
@@ -433,6 +435,9 @@ class GirafeConfig {
|
|
|
433
435
|
initOnboarding(config) {
|
|
434
436
|
return config.onboarding ?? undefined;
|
|
435
437
|
}
|
|
438
|
+
initFeedback(config) {
|
|
439
|
+
return config.feedback ?? undefined;
|
|
440
|
+
}
|
|
436
441
|
initApiConfig(config) {
|
|
437
442
|
return config.api ?? undefined;
|
|
438
443
|
}
|
|
@@ -440,14 +445,14 @@ class GirafeConfig {
|
|
|
440
445
|
if (config.filtering?.gmfLayerMetadataUrl &&
|
|
441
446
|
!(config.filtering.gmfLayerMetadataUrl.includes('###LAYERNAME###') &&
|
|
442
447
|
config.filtering.gmfLayerMetadataUrl.includes('###ATTRIBUTENAME###'))) {
|
|
443
|
-
throw new Error(`Configuration for filtering.gmfLayerMetadataUrl is missing the expected pattern. See https://doc.
|
|
448
|
+
throw new Error(`Configuration for filtering.gmfLayerMetadataUrl is missing the expected pattern. See https://doc.geogirafe.org/docs/configuration`);
|
|
444
449
|
}
|
|
445
450
|
return config.filtering ?? undefined;
|
|
446
451
|
}
|
|
447
452
|
initPermalinkConfig(config) {
|
|
448
|
-
return config.permalink ?? {
|
|
453
|
+
return (config.permalink ?? {
|
|
449
454
|
sanitizeConfig: defaultPermalinkSanitizeConfig
|
|
450
|
-
};
|
|
455
|
+
});
|
|
451
456
|
}
|
|
452
457
|
}
|
|
453
458
|
export default GirafeConfig;
|
|
@@ -31,6 +31,7 @@ import WfsManager from '../wfs/wfsmanager.js';
|
|
|
31
31
|
import WmsManager from '../wms/wmsmanager.js';
|
|
32
32
|
import IGirafeContext from './icontext.js';
|
|
33
33
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager.js';
|
|
34
|
+
import FeedbackManager from '../feedback/feedbackmanager.js';
|
|
34
35
|
export default class GirafeContext implements IGirafeContext {
|
|
35
36
|
readonly userDataManager: UserDataManager;
|
|
36
37
|
readonly configManager: ConfigManager;
|
|
@@ -64,6 +65,7 @@ export default class GirafeContext implements IGirafeContext {
|
|
|
64
65
|
readonly localFileManager: LocalFileManager;
|
|
65
66
|
readonly onBoardingManager: OnBoardingManager;
|
|
66
67
|
readonly themeFavoritesManager: ThemeFavoritesManager;
|
|
68
|
+
readonly feedbackManager: FeedbackManager;
|
|
67
69
|
constructor();
|
|
68
70
|
initialize(): Promise<void>;
|
|
69
71
|
}
|
package/tools/context/context.js
CHANGED
|
@@ -31,6 +31,7 @@ import UserDataManager from '../userdata/userdatamanager.js';
|
|
|
31
31
|
import WfsManager from '../wfs/wfsmanager.js';
|
|
32
32
|
import WmsManager from '../wms/wmsmanager.js';
|
|
33
33
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager.js';
|
|
34
|
+
import FeedbackManager from '../feedback/feedbackmanager.js';
|
|
34
35
|
export default class GirafeContext {
|
|
35
36
|
userDataManager;
|
|
36
37
|
configManager;
|
|
@@ -64,6 +65,7 @@ export default class GirafeContext {
|
|
|
64
65
|
localFileManager;
|
|
65
66
|
onBoardingManager;
|
|
66
67
|
themeFavoritesManager;
|
|
68
|
+
feedbackManager;
|
|
67
69
|
constructor() {
|
|
68
70
|
this.componentManager = new ComponentManager(this);
|
|
69
71
|
this.userDataManager = new UserDataManager(this);
|
|
@@ -97,6 +99,7 @@ export default class GirafeContext {
|
|
|
97
99
|
this.ogcApiFeaturesManager = new OgcApiFeaturesManager(this);
|
|
98
100
|
this.onBoardingManager = new OnBoardingManager(this);
|
|
99
101
|
this.themeFavoritesManager = new ThemeFavoritesManager(this);
|
|
102
|
+
this.feedbackManager = new FeedbackManager(this);
|
|
100
103
|
}
|
|
101
104
|
async initialize() {
|
|
102
105
|
// NOTE : This initialization order is important, because some singleton will need other ones !
|
|
@@ -134,5 +137,6 @@ export default class GirafeContext {
|
|
|
134
137
|
this.ogcApiFeaturesManager.initializeSingleton();
|
|
135
138
|
this.onBoardingManager.initializeSingleton();
|
|
136
139
|
this.themeFavoritesManager.initializeSingleton();
|
|
140
|
+
this.feedbackManager.initializeSingleton();
|
|
137
141
|
}
|
|
138
142
|
}
|
|
@@ -30,6 +30,7 @@ import UserDataManager from '../userdata/userdatamanager.js';
|
|
|
30
30
|
import WfsManager from '../wfs/wfsmanager.js';
|
|
31
31
|
import WmsManager from '../wms/wmsmanager.js';
|
|
32
32
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager.js';
|
|
33
|
+
import FeedbackManager from '../feedback/feedbackmanager.js';
|
|
33
34
|
export default interface IGirafeContext {
|
|
34
35
|
readonly userDataManager: UserDataManager;
|
|
35
36
|
readonly configManager: ConfigManager;
|
|
@@ -63,5 +64,6 @@ export default interface IGirafeContext {
|
|
|
63
64
|
readonly localFileManager: LocalFileManager;
|
|
64
65
|
readonly onBoardingManager: OnBoardingManager;
|
|
65
66
|
readonly themeFavoritesManager: ThemeFavoritesManager;
|
|
67
|
+
readonly feedbackManager: FeedbackManager;
|
|
66
68
|
initialize(): Promise<void>;
|
|
67
69
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
2
|
+
export declare enum FeedbackResult {
|
|
3
|
+
POSITIVE = "positive",
|
|
4
|
+
NEGATIVE = "negative",
|
|
5
|
+
NEUTRAL = "neutral"
|
|
6
|
+
}
|
|
7
|
+
declare class FeedbackManager extends GirafeSingleton {
|
|
8
|
+
private get config();
|
|
9
|
+
private readonly STORAGE_PATH;
|
|
10
|
+
private gaveFeedbackFor;
|
|
11
|
+
initializeSingleton(): void;
|
|
12
|
+
resetGivenFeedback(): void;
|
|
13
|
+
giveFeedback(componentName: string, feedbackResult: FeedbackResult): Promise<void>;
|
|
14
|
+
private initializeFeedbackOnComponents;
|
|
15
|
+
}
|
|
16
|
+
export default FeedbackManager;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
3
|
+
import TreeViewRootComponent from '../../components/treeview/treeviewroot/component.js';
|
|
4
|
+
const HTML_TEMPLATE = '<girafe-feedback-button question="${question}" component-name="${component-name}" margins="${margins}" placement="${placement}"></girafe-feedback-button>';
|
|
5
|
+
export var FeedbackResult;
|
|
6
|
+
(function (FeedbackResult) {
|
|
7
|
+
FeedbackResult["POSITIVE"] = "positive";
|
|
8
|
+
FeedbackResult["NEGATIVE"] = "negative";
|
|
9
|
+
FeedbackResult["NEUTRAL"] = "neutral";
|
|
10
|
+
})(FeedbackResult || (FeedbackResult = {}));
|
|
11
|
+
class FeedbackManager extends GirafeSingleton {
|
|
12
|
+
get config() {
|
|
13
|
+
return this.context.configManager.Config;
|
|
14
|
+
}
|
|
15
|
+
STORAGE_PATH = 'alreadyGaveFeedbackFor';
|
|
16
|
+
gaveFeedbackFor = {};
|
|
17
|
+
initializeSingleton() {
|
|
18
|
+
super.initializeSingleton();
|
|
19
|
+
this.context.componentManager.registerComponentCallback(TreeViewRootComponent, () => {
|
|
20
|
+
console.log('FeedbackManager: TreeViewRootComponent registered');
|
|
21
|
+
this.initializeFeedbackOnComponents();
|
|
22
|
+
});
|
|
23
|
+
this.gaveFeedbackFor = this.context.userDataManager.getUserData(this.STORAGE_PATH) || {};
|
|
24
|
+
}
|
|
25
|
+
resetGivenFeedback() {
|
|
26
|
+
this.gaveFeedbackFor = {};
|
|
27
|
+
this.context.userDataManager.saveUserData(this.STORAGE_PATH, this.gaveFeedbackFor);
|
|
28
|
+
}
|
|
29
|
+
async giveFeedback(componentName, feedbackResult) {
|
|
30
|
+
const url = this.config.feedback?.url;
|
|
31
|
+
if (!url) {
|
|
32
|
+
console.error('Feedback URL is not defined in the configuration.');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const response = await fetch(url, {
|
|
37
|
+
method: this.config.feedback?.method || 'POST',
|
|
38
|
+
headers: {
|
|
39
|
+
'Content-Type': 'application/json'
|
|
40
|
+
},
|
|
41
|
+
body: JSON.stringify({
|
|
42
|
+
componentName: componentName,
|
|
43
|
+
result: feedbackResult
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
throw new Error(`Response status: ${response.status}`);
|
|
48
|
+
}
|
|
49
|
+
const result = await response.json();
|
|
50
|
+
console.log('Success:', result);
|
|
51
|
+
this.gaveFeedbackFor[componentName] = true;
|
|
52
|
+
this.context.userDataManager.saveUserData(this.STORAGE_PATH, this.gaveFeedbackFor);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.error('Error:', error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
initializeFeedbackOnComponents() {
|
|
59
|
+
this.config.feedback?.components?.forEach((component) => {
|
|
60
|
+
if (this.gaveFeedbackFor[component.name]) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const componentsByName = this.context.componentManager.getComponentsByName(component.name);
|
|
64
|
+
for (const girafeHTMLElement of componentsByName) {
|
|
65
|
+
girafeHTMLElement.insertFeedbackTemplate(HTML_TEMPLATE.replace('${component-name}', component.name)
|
|
66
|
+
.replace('${question}', component.question)
|
|
67
|
+
.replace('${placement}', component.placement)
|
|
68
|
+
.replace('${margins}', component.margins ?? ''));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export default FeedbackManager;
|
package/tools/main.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export { default as CsvManager } from './export/csvmanager.js';
|
|
|
26
26
|
export { download } from './export/download.js';
|
|
27
27
|
export type { GridDataById, GridData, FeatureToGridDataOptions } from './featuretogriddatabyid.js';
|
|
28
28
|
export { default as FeatureToGridDataById } from './featuretogriddatabyid.js';
|
|
29
|
+
export type { FeedbackResult } from './feedback/feedbackmanager.js';
|
|
30
|
+
export { default as FeedbackManager } from './feedback/feedbackmanager.js';
|
|
29
31
|
export { BaseFilterCondition } from './filter/basefilter.js';
|
|
30
32
|
export { KNOWN_FUNCTIONALITIES } from './functionalities.js';
|
|
31
33
|
export { default as GeoConsts } from './geoconsts.js';
|
package/tools/main.js
CHANGED
|
@@ -22,6 +22,7 @@ export { default as ErrorManager } from './error/errormanager.js';
|
|
|
22
22
|
export { default as CsvManager } from './export/csvmanager.js';
|
|
23
23
|
export { download } from './export/download.js';
|
|
24
24
|
export { default as FeatureToGridDataById } from './featuretogriddatabyid.js';
|
|
25
|
+
export { default as FeedbackManager } from './feedback/feedbackmanager.js';
|
|
25
26
|
export { BaseFilterCondition } from './filter/basefilter.js';
|
|
26
27
|
export { KNOWN_FUNCTIONALITIES } from './functionalities.js';
|
|
27
28
|
export { default as GeoConsts } from './geoconsts.js';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import GirafeHTMLElement from '../../base/GirafeHTMLElement.js';
|
|
2
2
|
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
3
|
+
type Callback = (elem: GirafeHTMLElement) => unknown;
|
|
3
4
|
type Constructor<T> = new (...args: unknown[]) => T;
|
|
4
5
|
export default class ComponentManager extends GirafeSingleton {
|
|
5
|
-
private components;
|
|
6
|
-
private registeredCallbacks;
|
|
7
|
-
private registeredCallbacksClasses;
|
|
6
|
+
private readonly components;
|
|
7
|
+
private readonly registeredCallbacks;
|
|
8
|
+
private readonly registeredCallbacksClasses;
|
|
8
9
|
registerComponent(component: GirafeHTMLElement): void;
|
|
10
|
+
registerComponentCallback(component: Constructor<GirafeHTMLElement>, callback: Callback): void;
|
|
9
11
|
getComponents<T extends GirafeHTMLElement>(type: Constructor<T>): T[];
|
|
10
12
|
getComponentsByName(name: string): GirafeHTMLElement[];
|
|
11
13
|
}
|
|
@@ -4,9 +4,7 @@ export default class ComponentManager extends GirafeSingleton {
|
|
|
4
4
|
registeredCallbacks = [];
|
|
5
5
|
registeredCallbacksClasses = [];
|
|
6
6
|
registerComponent(component) {
|
|
7
|
-
|
|
8
|
-
this.components[component.name] = [];
|
|
9
|
-
}
|
|
7
|
+
this.components[component.name] ??= [];
|
|
10
8
|
this.components[component.name].push(component);
|
|
11
9
|
for (let i = 0; i < this.registeredCallbacksClasses.length; i++) {
|
|
12
10
|
if (component instanceof this.registeredCallbacksClasses[i]) {
|
|
@@ -14,6 +12,10 @@ export default class ComponentManager extends GirafeSingleton {
|
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
}
|
|
15
|
+
registerComponentCallback(component, callback) {
|
|
16
|
+
this.registeredCallbacksClasses.push(component);
|
|
17
|
+
this.registeredCallbacks.push([callback]);
|
|
18
|
+
}
|
|
17
19
|
getComponents(type) {
|
|
18
20
|
return Object.values(this.components)
|
|
19
21
|
.flat()
|
|
@@ -31,6 +31,7 @@ import WfsManager from '../wfs/wfsmanager';
|
|
|
31
31
|
import WmsManager from '../wms/wmsmanager';
|
|
32
32
|
import OnBoardingManager from '../onboarding/onboardingmanager';
|
|
33
33
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager';
|
|
34
|
+
import FeedbackManager from '../feedback/feedbackmanager';
|
|
34
35
|
export default class MockGirafeContext implements IGirafeContext {
|
|
35
36
|
readonly userDataManager: UserDataManager;
|
|
36
37
|
readonly configManager: ConfigManager;
|
|
@@ -64,6 +65,7 @@ export default class MockGirafeContext implements IGirafeContext {
|
|
|
64
65
|
readonly localFileManager: LocalFileManager;
|
|
65
66
|
readonly onBoardingManager: OnBoardingManager;
|
|
66
67
|
readonly themeFavoritesManager: ThemeFavoritesManager;
|
|
68
|
+
readonly feedbackManager: FeedbackManager;
|
|
67
69
|
constructor();
|
|
68
70
|
initialize(): Promise<void>;
|
|
69
71
|
}
|