Update country-coder to 2.0.0 (close #7029)

Localize address field in walkthrough without overwriting country coder function
This commit is contained in:
Quincy Morgan
2019-11-07 18:45:46 +01:00
parent 2a4841f517
commit d89996e52c
8 changed files with 21 additions and 22 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
import { dispatch as d3_dispatch } from 'd3-dispatch';
import { select as d3_select, event as d3_event } from 'd3-selection';
import * as countryCoder from 'country-coder';
import { t, textDirection } from '../../util/locale';
import { dataPhoneFormats } from '../../../data';
@@ -55,9 +56,9 @@ export function uiFieldText(field, context) {
.on('change', change());
if (field.type === 'tel' && services.countryCoder && _entity) {
if (field.type === 'tel' && _entity) {
var center = _entity.extent(context.graph()).center();
var countryCode = services.countryCoder.iso1A2Code(center);
var countryCode = countryCoder.iso1A2Code(center);
var format = countryCode && dataPhoneFormats[countryCode.toLowerCase()];
if (format) {
wrap.selectAll('#' + fieldID)