mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
import { t } from '../util/locale';
|
|
import { svgIcon } from '../svg';
|
|
|
|
|
|
export function uiDataHeader() {
|
|
var _datum;
|
|
|
|
|
|
function dataHeader(selection) {
|
|
var header = selection.selectAll('.data-header')
|
|
.data(
|
|
(_datum ? [_datum] : []),
|
|
function(d) { return d.__featurehash__; }
|
|
);
|
|
|
|
header.exit()
|
|
.remove();
|
|
|
|
var headerEnter = header.enter()
|
|
.append('div')
|
|
.attr('class', 'data-header');
|
|
|
|
var iconEnter = headerEnter
|
|
.append('div')
|
|
.attr('class', 'data-header-icon');
|
|
|
|
iconEnter
|
|
.append('div')
|
|
.attr('class', 'preset-icon-28')
|
|
.call(svgIcon('#iD-icon-data', 'note-fill'));
|
|
|
|
headerEnter
|
|
.append('div')
|
|
.attr('class', 'data-header-label')
|
|
.text(t('map_data.layers.custom.title'));
|
|
}
|
|
|
|
|
|
dataHeader.datum = function(val) {
|
|
if (!arguments.length) return _datum;
|
|
_datum = val;
|
|
return this;
|
|
};
|
|
|
|
|
|
return dataHeader;
|
|
}
|