Convert lodah-es and d3 to named imports for util

This commit is contained in:
Bryan Housel
2017-09-25 23:31:58 -04:00
parent 9edae82673
commit 50b7e2e2a8
3 changed files with 13 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
import * as d3 from 'd3';
import { select as d3_select } from 'd3-selection';
var jsonpCache = {};
window.jsonpCache = jsonpCache;
@@ -35,7 +36,7 @@ export function jsonpRequest(url, callback) {
}
var cb = create(url),
script = d3.select('head')
script = d3_select('head')
.append('script')
.attr('type', 'text/javascript')
.attr('src', url.replace(/(\{|%7B)callback(\}|%7D)/, cb));

View File

@@ -1,6 +1,7 @@
import * as d3 from 'd3';
import { select as d3_select } from 'd3-selection';
import { utilFunctor } from './index';
export function tooltip() {
var tooltip = function(selection) {
selection.each(setup);
@@ -82,7 +83,7 @@ export function tooltip() {
function setup() {
var root = d3.select(this),
var root = d3_select(this),
animate = animation.apply(this, arguments),
tip = root.selectAll('.tooltip').data([0]);
@@ -114,7 +115,7 @@ export function tooltip() {
function show() {
var root = d3.select(this),
var root = d3_select(this),
content = title.apply(this, arguments),
tip = root.selectAll('.tooltip')
.classed('in', true),
@@ -152,7 +153,7 @@ export function tooltip() {
function hide() {
d3.select(this).selectAll('.tooltip')
d3_select(this).selectAll('.tooltip')
.classed('in', false);
this.tooltipVisible = false;
@@ -172,7 +173,7 @@ export function tooltip() {
function getPosition(node) {
var mode = d3.select(node).style('position');
var mode = d3_select(node).style('position');
if (mode === 'absolute' || mode === 'static') {
return {
x: node.offsetLeft,

View File

@@ -1,4 +1,5 @@
import * as d3 from 'd3';
import _map from 'lodash-es/map';
import { t, textDirection } from './locale';
import { utilDetect } from './detect';
import { remove as removeDiacritics } from 'diacritics';
@@ -6,8 +7,8 @@ import { fixRTLTextForSvg, rtlRegex } from './svg_paths_rtl_fix';
export function utilTagText(entity) {
return d3.entries(entity.tags).map(function(e) {
return e.key + '=' + e.value;
return _map(entity.tags, function(v, k) {
return k + '=' + v;
}).join(', ');
}