chore: redraw facets panel if open when changing facetKey

This commit is contained in:
Yohan Boniface 2024-04-18 15:56:06 +02:00
parent 0b1693a1a2
commit 68a22a9177
2 changed files with 15 additions and 3 deletions

View file

@ -51,6 +51,14 @@ export default class Facets {
return properties return properties
} }
redraw() {
if (this.isOpen()) this.open()
}
isOpen() {
return !!document.querySelector('.umap-facet-search')
}
open() { open() {
const container = L.DomUtil.create('div', 'umap-facet-search') const container = L.DomUtil.create('div', 'umap-facet-search')
const title = L.DomUtil.add( const title = L.DomUtil.add(

View file

@ -106,10 +106,13 @@ U.Map = L.Map.extend({
this.options.slideshow && this.options.slideshow &&
this.options.slideshow.delay && this.options.slideshow.delay &&
this.options.slideshow.active === undefined this.options.slideshow.active === undefined
) ) {
this.options.slideshow.active = true this.options.slideshow.active = true
if (this.options.advancedFilterKey) }
if (this.options.advancedFilterKey) {
this.options.facetKey = this.options.advancedFilterKey this.options.facetKey = this.options.advancedFilterKey
delete this.options.advancedFilterKey
}
// Global storage for retrieving datalayers and features // Global storage for retrieving datalayers and features
this.datalayers = {} this.datalayers = {}
@ -251,6 +254,7 @@ U.Map = L.Map.extend({
this.initCaptionBar() this.initCaptionBar()
this.renderEditToolbar() this.renderEditToolbar()
this.renderControls() this.renderControls()
this.facets.redraw()
break break
case 'data': case 'data':
this.redrawVisibleDataLayers() this.redrawVisibleDataLayers()
@ -1235,7 +1239,7 @@ U.Map = L.Map.extend({
[ [
'options.facetKey', 'options.facetKey',
{ {
handler: 'Input', handler: 'BlurInput',
helpEntries: 'facetKey', helpEntries: 'facetKey',
placeholder: L._('Example: key1,key2|Label 2,key3|Label 3|checkbox'), placeholder: L._('Example: key1,key2|Label 2,key3|Label 3|checkbox'),
label: L._('Facet keys'), label: L._('Facet keys'),