Files
iD/modules/ui/data_header.js
Quincy Morgan a1af118f0e Ensure locales and presets are loaded before the UI loads (close #7406)
Consolidate localization behavior and init to a coreLocalizer function and singleton
Explicitly support `en-US` locale
Rename coreData to coreFileFetcher and export a singleton rather than using a property of coreContext
Add `apiConnections` property of coreContext to simplify adding a source switcher
Replace some init functions with re-callable, promise-supporting `ensureLoaded` functions
Make coreContext itself load the UI if a container has been specified at init time
Fix code tests
2020-03-31 12:23:31 -07:00

48 lines
1.1 KiB
JavaScript

import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
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;
}