diff --git a/src/GeolocationEditor/mb-editor/index.js b/src/GeolocationEditor/mb-editor/index.js
index ec99e0be..928d2873 100644
--- a/src/GeolocationEditor/mb-editor/index.js
+++ b/src/GeolocationEditor/mb-editor/index.js
@@ -1,6 +1,6 @@
import React, { useCallback, useMemo } from 'react';
import PropTypes from 'prop-types';
-import { GEOLOCATION_FORMAT, DEFAULT_GEOLOCATION_FORMAT } from 'dtable-utils';
+import { GEOLOCATION_FORMAT, DEFAULT_GEOLOCATION_FORMAT, HIDDEN_DISTRICTS } from 'dtable-utils';
import CountryEditor from './country-editor';
import ProvinceEditor from './province-editor';
import ProvinceCityEditor from './province-city-editor';
@@ -17,6 +17,8 @@ const transLocationData = (data) => {
data.value = name;
data.name = null;
if (data.children) {
+ // Filter out hidden districts at the district level (children of city nodes)
+ data.children = data.children.filter((child) => !HIDDEN_DISTRICTS.includes(child.name));
data.children.map(child => {
return transLocationData(child);
});
@@ -71,25 +73,25 @@ const MBGeolocationEditor = ({
switch (format) {
case GEOLOCATION_FORMAT.LNG_LAT: {
- return ();
+ return ();
}
case GEOLOCATION_FORMAT.MAP_SELECTION: {
return ();
}
case GEOLOCATION_FORMAT.COUNTRY_REGION: {
- return ();
+ return ();
}
case GEOLOCATION_FORMAT.PROVINCE: {
- return ();
+ return ();
}
case GEOLOCATION_FORMAT.PROVINCE_CITY: {
- return ();
+ return ();
}
case GEOLOCATION_FORMAT.PROVINCE_CITY_DISTRICT: {
- return ();
+ return ();
}
default: {
- return ();
+ return ();
}
}
};
diff --git a/src/GeolocationEditor/pc-editor/selector-list.js b/src/GeolocationEditor/pc-editor/selector-list.js
index c299bd9d..faf693f2 100644
--- a/src/GeolocationEditor/pc-editor/selector-list.js
+++ b/src/GeolocationEditor/pc-editor/selector-list.js
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { HIDDEN_DISTRICTS } from 'dtable-utils';
const SelectorListPropTypes = {
type: PropTypes.string,
@@ -9,13 +10,19 @@ const SelectorListPropTypes = {
doubleClickHandler: PropTypes.oneOfType([PropTypes.func])
};
-
class SelectorList extends React.Component {
+
+ getVisibleChildren = (parent) => {
+ if (!Array.isArray(parent.children)) return [];
+ return parent.children.filter((item) => !HIDDEN_DISTRICTS.includes(item.name));
+ };
+
render() {
const { clickHandler, type, selectedItem, parent, doubleClickHandler } = this.props;
+ const visibleChildren = this.getVisibleChildren(parent);
return (
- {parent.children.map((item, index) => {
+ {visibleChildren.map((item, index) => {
const isSelected = selectedItem && (item.name === selectedItem.name);
return (
-
{item.name}