Merge pull request #1509 from umap-project/datalayer-counter
feat(browser): add counter in datalayer headline
This commit is contained in:
commit
08c5d47ee8
3 changed files with 10 additions and 1 deletions
|
@ -62,6 +62,8 @@ L.U.Browser = L.Class.extend({
|
|||
container.id = `browse_data_datalayer_${datalayer.umap_id}`
|
||||
datalayer.renderToolbox(headline)
|
||||
L.DomUtil.add('span', '', headline, datalayer.options.name)
|
||||
const counter = L.DomUtil.add('span', 'datalayer-counter', headline, datalayer.count())
|
||||
counter.title = L._('{count} features in this layer', {count: datalayer.count()})
|
||||
const ul = L.DomUtil.create('ul', '', container)
|
||||
L.DomUtil.classIf(container, 'off', !datalayer.isVisible())
|
||||
|
||||
|
|
|
@ -1482,6 +1482,10 @@ L.U.DataLayer = L.Evented.extend({
|
|||
return !!this.options.browsable && this.canBrowse() && this.isVisible()
|
||||
},
|
||||
|
||||
count: function () {
|
||||
return this._index.length
|
||||
},
|
||||
|
||||
hasData: function () {
|
||||
return !!this._index.length
|
||||
},
|
||||
|
|
|
@ -1086,11 +1086,14 @@ a.add-datalayer:hover,
|
|||
.umap-edit-enabled .show-on-edit.block {
|
||||
display: block!important;
|
||||
}
|
||||
|
||||
.umap-browse-description {
|
||||
font-size: 0.9em;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.datalayer-counter {
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
|
||||
/* ********************************* */
|
||||
|
|
Loading…
Reference in a new issue