Picto field: only add category when at least one picto matches search

This commit is contained in:
Yohan Boniface 2023-11-13 17:11:40 +01:00
parent 2026a2c7e6
commit eaf6c17db4

View file

@ -631,6 +631,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
}, },
this this
) )
return true // Icon has been added (not filtered)
}, },
clear: function () { clear: function () {
@ -645,13 +646,14 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
const parent = L.DomUtil.create( const parent = L.DomUtil.create(
'div', 'div',
'umap-pictogram-category', 'umap-pictogram-category',
this.gridContainer
), ),
title = L.DomUtil.add('h6', '', parent, category), title = L.DomUtil.add('h6', '', parent, category),
grid = L.DomUtil.create('div', 'umap-pictogram-grid', parent) grid = L.DomUtil.create('div', 'umap-pictogram-grid', parent)
let status = false
for (let item of items) { for (let item of items) {
this.addIconPreview(item, grid) status = this.addIconPreview(item, grid) || status
} }
if (status) this.gridContainer.appendChild(parent)
}, },
buildSymbolsList: function () { buildSymbolsList: function () {