dtable-ui-component 6.0.38-alpha.1 → 6.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/DTableFiltersPopover/constants/index.js +2 -30
- package/lib/DTableFiltersPopover/index.css +17 -36
- package/lib/DTableFiltersPopover/index.js +136 -118
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +4 -10
- package/lib/DTableFiltersPopover/utils/index.js +82 -358
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.css +0 -0
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +4 -6
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +2 -13
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +6 -18
- package/lib/DTableFiltersPopover/widgets/filter-item.js +53 -138
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +16 -113
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +39 -226
- package/lib/GeolocationEditor/mb-editor/map-editor/index.css +5 -2
- package/lib/GeolocationEditor/mb-editor/map-editor/index.js +93 -51
- package/lib/GeolocationEditor/pc-editor/index.css +6 -15
- package/lib/GeolocationEditor/pc-editor/index.js +4 -1
- package/lib/GeolocationEditor/pc-editor/map-editor/index.css +33 -0
- package/lib/GeolocationEditor/pc-editor/map-editor/index.js +143 -99
- package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.css +13 -11
- package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.js +100 -70
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/index.js +20 -11
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/large-editor/index.js +2 -2
- package/lib/RowExpandEditor/geolocation-editor/pc-editor/index.js +19 -5
- package/lib/locales/de.json +5 -3
- package/lib/locales/en.json +5 -8
- package/lib/locales/es.json +5 -3
- package/lib/locales/fr.json +5 -3
- package/lib/locales/pt.json +5 -3
- package/lib/locales/ru.json +5 -3
- package/lib/locales/zh-CN.json +5 -8
- package/lib/utils/column-utils.js +2 -21
- package/package.json +2 -2
- package/lib/DTableFiltersPopover/widgets/filter-group.js +0 -185
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _dtableUtils = require("dtable-utils");
|
|
9
10
|
var _InputItem = _interopRequireDefault(require("../../../InputItem"));
|
|
10
11
|
var _toaster = _interopRequireDefault(require("../../../toaster"));
|
|
11
12
|
var _MobileFullScreenPage = _interopRequireDefault(require("../../../MobileFullScreenPage"));
|
|
@@ -184,8 +185,7 @@ class MapEditor extends _react.default.Component {
|
|
|
184
185
|
value: {
|
|
185
186
|
lng: point.lng,
|
|
186
187
|
lat: point.lat
|
|
187
|
-
}
|
|
188
|
-
inputValue: _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? "".concat(point.lng, ", ").concat(point.lat) : "".concat(point.lat, ", ").concat(point.lng)
|
|
188
|
+
}
|
|
189
189
|
});
|
|
190
190
|
};
|
|
191
191
|
this.addMarkerByPosition = (lng, lat) => {
|
|
@@ -252,46 +252,14 @@ class MapEditor extends _react.default.Component {
|
|
|
252
252
|
if (!_objectUtils.default.isSameObject(value, this.props.value)) {
|
|
253
253
|
this.props.onCommit(value);
|
|
254
254
|
}
|
|
255
|
+
const {
|
|
256
|
+
lng,
|
|
257
|
+
lat
|
|
258
|
+
} = this.getNumericValue(value);
|
|
259
|
+
const newValue = !(0, _dtableUtils.isNumber)(lng) || !(0, _dtableUtils.isNumber)(lat) ? null : value;
|
|
260
|
+
this.props.onCommit(newValue);
|
|
255
261
|
this.onClose();
|
|
256
262
|
};
|
|
257
|
-
this.onChange = inputValue => {
|
|
258
|
-
this.setState({
|
|
259
|
-
inputValue
|
|
260
|
-
});
|
|
261
|
-
const enSplitCodeIndex = inputValue.indexOf(',');
|
|
262
|
-
const cnSplitCodeIndex = inputValue.indexOf(',');
|
|
263
|
-
if (enSplitCodeIndex > 0 || cnSplitCodeIndex > 0) {
|
|
264
|
-
let lng;
|
|
265
|
-
let lat;
|
|
266
|
-
const splitCodeIndex = enSplitCodeIndex > 0 ? enSplitCodeIndex : cnSplitCodeIndex;
|
|
267
|
-
if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
|
|
268
|
-
lat = parseFloat(inputValue.slice(0, splitCodeIndex).trim());
|
|
269
|
-
lng = parseFloat(inputValue.slice(splitCodeIndex + 1).trim());
|
|
270
|
-
} else {
|
|
271
|
-
lng = parseFloat(inputValue.slice(0, splitCodeIndex).trim());
|
|
272
|
-
lat = parseFloat(inputValue.slice(splitCodeIndex + 1).trim());
|
|
273
|
-
}
|
|
274
|
-
if (!Number.isNaN(lng) && !Number.isNaN(lat)) {
|
|
275
|
-
this.setState({
|
|
276
|
-
value: {
|
|
277
|
-
lng,
|
|
278
|
-
lat
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
if (this.map) {
|
|
282
|
-
if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP || this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
|
|
283
|
-
this.map.setCenter({
|
|
284
|
-
lng,
|
|
285
|
-
lat
|
|
286
|
-
});
|
|
287
|
-
} else {
|
|
288
|
-
this.map.setCenter(new window.BMap.Point(lng, lat));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
this.addMarkerByPosition(lng, lat);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
263
|
this.onZoomIn = () => {
|
|
296
264
|
if (!this.map) return;
|
|
297
265
|
const currentZoom = this.map.getZoom();
|
|
@@ -326,11 +294,65 @@ class MapEditor extends _react.default.Component {
|
|
|
326
294
|
this.onClose = () => {
|
|
327
295
|
this.props.onToggle();
|
|
328
296
|
};
|
|
297
|
+
this.getNumericValue = value => {
|
|
298
|
+
const {
|
|
299
|
+
lng,
|
|
300
|
+
lat
|
|
301
|
+
} = value || {};
|
|
302
|
+
const numLng = typeof lng === 'string' ? parseFloat(lng.trim()) : lng;
|
|
303
|
+
const numLat = typeof lat === 'string' ? parseFloat(lat.trim()) : lat;
|
|
304
|
+
return {
|
|
305
|
+
lng: numLng,
|
|
306
|
+
lat: numLat
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
this.handleLatitudeChange = value => {
|
|
310
|
+
this.setState({
|
|
311
|
+
value: {
|
|
312
|
+
...this.state.value,
|
|
313
|
+
lat: value
|
|
314
|
+
}
|
|
315
|
+
}, () => {
|
|
316
|
+
const numericValue = this.getNumericValue(this.state.value);
|
|
317
|
+
this.rerenderMapMarker(numericValue);
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
this.handleLongitudeChange = value => {
|
|
321
|
+
this.setState({
|
|
322
|
+
value: {
|
|
323
|
+
...this.state.value,
|
|
324
|
+
lng: value
|
|
325
|
+
}
|
|
326
|
+
}, () => {
|
|
327
|
+
const numericValue = this.getNumericValue(this.state.value);
|
|
328
|
+
this.rerenderMapMarker(numericValue);
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
this.rerenderMapMarker = _ref => {
|
|
332
|
+
let {
|
|
333
|
+
lng,
|
|
334
|
+
lat
|
|
335
|
+
} = _ref;
|
|
336
|
+
if (!(0, _dtableUtils.isNumber)(lng) || !(0, _dtableUtils.isNumber)(lat)) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (this.map) {
|
|
340
|
+
if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP || this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
|
|
341
|
+
this.map.setCenter({
|
|
342
|
+
lng,
|
|
343
|
+
lat
|
|
344
|
+
});
|
|
345
|
+
} else {
|
|
346
|
+
this.map.setCenter(new window.BMap.Point(lng, lat));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
this.addMarkerByPosition(lng, lat);
|
|
350
|
+
};
|
|
329
351
|
this.renderMap = () => {
|
|
330
352
|
const {
|
|
331
353
|
isLoading,
|
|
332
|
-
|
|
333
|
-
|
|
354
|
+
mode,
|
|
355
|
+
value
|
|
334
356
|
} = this.state;
|
|
335
357
|
if (isLoading) return /*#__PURE__*/_react.default.createElement("div", {
|
|
336
358
|
className: "w-100 h-100 d-flex align-items-center justify-content-center"
|
|
@@ -343,18 +365,36 @@ class MapEditor extends _react.default.Component {
|
|
|
343
365
|
}, (0, _lang.getLocale)('The_map_plugin_is_not_properly_configured_contact_the_administrator')));
|
|
344
366
|
}
|
|
345
367
|
const isEdit = mode === 'edit';
|
|
368
|
+
const {
|
|
369
|
+
lat,
|
|
370
|
+
lng
|
|
371
|
+
} = value;
|
|
346
372
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
347
373
|
className: "dtable-ui-mobile-geolocation-map-editor-input-container"
|
|
348
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
374
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
375
|
+
className: "view-subtitle"
|
|
376
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Latitude_abbr'))), /*#__PURE__*/_react.default.createElement(_InputItem.default, {
|
|
349
377
|
type: "text",
|
|
350
378
|
className: "dtable-ui-mobile-geolocation-map-editor-input",
|
|
351
379
|
style: {
|
|
352
380
|
marginTop: 0
|
|
353
381
|
},
|
|
354
|
-
value:
|
|
382
|
+
value: lat,
|
|
355
383
|
editable: isEdit,
|
|
356
|
-
onChange: this.
|
|
357
|
-
placeholder:
|
|
384
|
+
onChange: this.handleLatitudeChange,
|
|
385
|
+
placeholder: (0, _lang.getLocale)('Enter_latitude')
|
|
386
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
387
|
+
className: "view-subtitle"
|
|
388
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Longitude_abbr'))), /*#__PURE__*/_react.default.createElement(_InputItem.default, {
|
|
389
|
+
type: "text",
|
|
390
|
+
className: "dtable-ui-mobile-geolocation-map-editor-input",
|
|
391
|
+
style: {
|
|
392
|
+
marginTop: 0
|
|
393
|
+
},
|
|
394
|
+
value: lng,
|
|
395
|
+
editable: isEdit,
|
|
396
|
+
onChange: this.handleLongitudeChange,
|
|
397
|
+
placeholder: (0, _lang.getLocale)('Enter_longitude')
|
|
358
398
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
359
399
|
className: "dtable-ui-mobile-geolocation-map-editor-map"
|
|
360
400
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -384,23 +424,25 @@ class MapEditor extends _react.default.Component {
|
|
|
384
424
|
className: "dtable-font dtable-icon-narrow"
|
|
385
425
|
}))))));
|
|
386
426
|
};
|
|
387
|
-
const _value = props.value || {
|
|
427
|
+
const _value = props.value || {
|
|
428
|
+
lng: '',
|
|
429
|
+
lat: ''
|
|
430
|
+
};
|
|
388
431
|
const {
|
|
389
432
|
mapType,
|
|
390
433
|
mapKey
|
|
391
434
|
} = (0, _mapEditorUtils.getMapInfo)(props.config);
|
|
392
435
|
this.mapType = mapType;
|
|
393
436
|
this.mapKey = mapKey;
|
|
437
|
+
this.map = null;
|
|
394
438
|
const {
|
|
395
439
|
lng: _lng,
|
|
396
440
|
lat: _lat
|
|
397
441
|
} = _value;
|
|
398
|
-
this.map = null;
|
|
399
442
|
this.state = {
|
|
400
|
-
mode: 'preview',
|
|
443
|
+
mode: (0, _cell.isValidPosition)(_lng, _lat) ? 'preview' : 'edit',
|
|
401
444
|
isLoading: true,
|
|
402
|
-
value: _value
|
|
403
|
-
inputValue: (0, _cell.isValidPosition)(_lng, _lat) ? _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? "".concat(_lng, ", ").concat(_lat) : "".concat(_lat, ", ").concat(_lng) : ''
|
|
445
|
+
value: _value
|
|
404
446
|
};
|
|
405
447
|
}
|
|
406
448
|
componentDidMount() {
|
|
@@ -204,22 +204,22 @@
|
|
|
204
204
|
width: 92%;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
.dtable-ui-geolocation-map-editor .
|
|
207
|
+
.dtable-ui-geolocation-map-editor .selection-input {
|
|
208
208
|
padding-right: 30px;
|
|
209
209
|
border-bottom: 0;
|
|
210
210
|
background: #fff;
|
|
211
|
-
border-radius: 3px;
|
|
212
211
|
border: 1px solid #dedede;
|
|
213
|
-
box-shadow: 0 -0 12px rgb(0 0 0 / 30%);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.dtable-ui-geolocation-map-editor .search-tables-input.selection-input {
|
|
217
212
|
width: 88%;
|
|
218
213
|
box-shadow: 0 -0 2px rgb(0 0 0 / 30%);
|
|
219
214
|
border-radius: 3px 0px 0px 3px;
|
|
220
215
|
border-right: none;
|
|
221
216
|
}
|
|
222
217
|
|
|
218
|
+
.dtable-ui-geolocation-map-editor .selection-input:focus {
|
|
219
|
+
border-color: #bdbdbd;
|
|
220
|
+
box-shadow: 0 -0 3px rgb(0 0 0 / 30%);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
223
|
.dtable-ui-geolocation-submit-map-editor {
|
|
224
224
|
display: inline-block;
|
|
225
225
|
height: 38px;
|
|
@@ -425,15 +425,6 @@
|
|
|
425
425
|
text-align: center;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
.dtable-ui-geolocation-map-editor .search-tables-input:focus {
|
|
429
|
-
border-color: #bdbdbd;
|
|
430
|
-
box-shadow: 0 -0 12px rgb(0 0 0 / 30%);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
.dtable-ui-geolocation-map-editor .selection-input:focus {
|
|
434
|
-
box-shadow: 0 -0 3px rgb(0 0 0 / 30%);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
428
|
.dtable-ui-geolocation-map-editor-error-message {
|
|
438
429
|
word-break: break-all;
|
|
439
430
|
padding: 10px;
|
|
@@ -157,7 +157,8 @@ class PCGeolocationEditor extends _react.default.Component {
|
|
|
157
157
|
config,
|
|
158
158
|
column,
|
|
159
159
|
getCountryData,
|
|
160
|
-
getLocationData
|
|
160
|
+
getLocationData,
|
|
161
|
+
toggleLargeMap
|
|
161
162
|
} = this.props;
|
|
162
163
|
const props = {
|
|
163
164
|
column,
|
|
@@ -171,12 +172,14 @@ class PCGeolocationEditor extends _react.default.Component {
|
|
|
171
172
|
case _dtableUtils.GEOLOCATION_FORMAT.LNG_LAT:
|
|
172
173
|
{
|
|
173
174
|
return /*#__PURE__*/_react.default.createElement(_mapEditor.default, Object.assign({}, props, {
|
|
175
|
+
toggleLargeMap: toggleLargeMap,
|
|
174
176
|
ref: ref => this.editor = ref
|
|
175
177
|
}));
|
|
176
178
|
}
|
|
177
179
|
case _dtableUtils.GEOLOCATION_FORMAT.MAP_SELECTION:
|
|
178
180
|
{
|
|
179
181
|
return /*#__PURE__*/_react.default.createElement(_mapSelectionEditor.default, Object.assign({}, props, {
|
|
182
|
+
toggleLargeMap: toggleLargeMap,
|
|
180
183
|
ref: ref => this.editor = ref
|
|
181
184
|
}));
|
|
182
185
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.dtable-ui-geolocation-map-lng-lat-editor-header {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
padding: 1rem;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dtable-ui-geolocation-map-lng-lat-editor-header .dtable-ui-geolocation-map-lng-lat-input-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex: 1 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dtable-ui-geolocation-map-lng-lat-input-label {
|
|
15
|
+
align-items: center;
|
|
16
|
+
background-color: #f8f9fa;
|
|
17
|
+
border: 1px solid #0028641f;
|
|
18
|
+
border-bottom-left-radius: 3px;
|
|
19
|
+
border-right: none;
|
|
20
|
+
border-top-left-radius: 3px;
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
padding: .375rem .75rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dtable-ui-geolocation-map-lng-lat-input-container input {
|
|
27
|
+
border-bottom-left-radius: 0;
|
|
28
|
+
border-top-left-radius: 0;
|
|
29
|
+
flex: 1 1;
|
|
30
|
+
position: relative;
|
|
31
|
+
z-index: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _dtableUtils = require("dtable-utils");
|
|
10
11
|
var _toaster = _interopRequireDefault(require("../../../toaster"));
|
|
11
12
|
var _Loading = _interopRequireDefault(require("../../../Loading"));
|
|
12
13
|
var _constants = require("../../../constants");
|
|
@@ -14,9 +15,36 @@ var _cell = require("../../../utils/cell");
|
|
|
14
15
|
var _mapEditorUtils = require("../../map-editor-utils");
|
|
15
16
|
var _largeEditor = _interopRequireDefault(require("./large-editor"));
|
|
16
17
|
var _lang = require("../../../lang");
|
|
18
|
+
require("./index.css");
|
|
17
19
|
class MapEditor extends _react.Component {
|
|
18
20
|
constructor(props) {
|
|
19
21
|
super(props);
|
|
22
|
+
this.initMap = () => {
|
|
23
|
+
if (this.mapType === _mapEditorUtils.MAP_TYPES.B_MAP) {
|
|
24
|
+
if (!window.BMap) {
|
|
25
|
+
window.renderBaiduMap = () => this.renderBaiduMap();
|
|
26
|
+
(0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey);
|
|
27
|
+
} else {
|
|
28
|
+
this.renderBaiduMap();
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
} else if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
|
|
32
|
+
if (!window.google) {
|
|
33
|
+
window.renderGoogleMap = () => this.renderGoogleMap();
|
|
34
|
+
(0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey);
|
|
35
|
+
} else {
|
|
36
|
+
this.renderGoogleMap();
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
} else if (this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
|
|
40
|
+
if (!window.minemap) {
|
|
41
|
+
(0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey, this.loadMineMapCallBack);
|
|
42
|
+
} else {
|
|
43
|
+
this.renderMineMap();
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
20
48
|
this.loadMineMapCallBack = () => {
|
|
21
49
|
if (!this.timer) {
|
|
22
50
|
this.timer = setTimeout(() => {
|
|
@@ -171,16 +199,48 @@ class MapEditor extends _react.Component {
|
|
|
171
199
|
});
|
|
172
200
|
};
|
|
173
201
|
this.setValue = point => {
|
|
202
|
+
const value = point ? {
|
|
203
|
+
lng: point.lng,
|
|
204
|
+
lat: point.lat
|
|
205
|
+
} : null;
|
|
174
206
|
this.setState({
|
|
175
|
-
value
|
|
176
|
-
lng: point.lng,
|
|
177
|
-
lat: point.lat
|
|
178
|
-
},
|
|
179
|
-
inputValue: _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? "".concat(point.lng, ", ").concat(point.lat) : "".concat(point.lat, ", ").concat(point.lng)
|
|
207
|
+
value
|
|
180
208
|
}, () => {
|
|
181
|
-
this.
|
|
209
|
+
const numericValue = this.getNumericValue(this.state.value);
|
|
210
|
+
this.setPropsValue(numericValue);
|
|
182
211
|
});
|
|
183
212
|
};
|
|
213
|
+
this.getNumericValue = value => {
|
|
214
|
+
const {
|
|
215
|
+
lng,
|
|
216
|
+
lat
|
|
217
|
+
} = value || {};
|
|
218
|
+
const numLng = typeof lng === 'string' ? parseFloat(lng.trim()) : lng;
|
|
219
|
+
const numLat = typeof lat === 'string' ? parseFloat(lat.trim()) : lat;
|
|
220
|
+
return {
|
|
221
|
+
lng: numLng,
|
|
222
|
+
lat: numLat
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
this.setPropsValue = _ref => {
|
|
226
|
+
let {
|
|
227
|
+
lng,
|
|
228
|
+
lat
|
|
229
|
+
} = _ref;
|
|
230
|
+
if (!(0, _dtableUtils.isNumber)(lng) || !(0, _dtableUtils.isNumber)(lat)) {
|
|
231
|
+
this.props.setValue(null);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const newValue = {
|
|
235
|
+
lng,
|
|
236
|
+
lat
|
|
237
|
+
};
|
|
238
|
+
this.setState({
|
|
239
|
+
value: newValue
|
|
240
|
+
});
|
|
241
|
+
this.props.setValue(newValue);
|
|
242
|
+
this.rerenderMapMarker(newValue);
|
|
243
|
+
};
|
|
184
244
|
this.addMarkerByPosition = (lng, lat) => {
|
|
185
245
|
if (this.mapType === _mapEditorUtils.MAP_TYPES.B_MAP) {
|
|
186
246
|
let point = new window.BMap.Point(lng, lat);
|
|
@@ -233,62 +293,60 @@ class MapEditor extends _react.Component {
|
|
|
233
293
|
const {
|
|
234
294
|
value
|
|
235
295
|
} = this.state;
|
|
236
|
-
this.
|
|
296
|
+
const numericValue = this.getNumericValue(value);
|
|
297
|
+
this.setPropsValue(numericValue);
|
|
237
298
|
this.setState({
|
|
238
299
|
isShowLargeEditor: !this.state.isShowLargeEditor
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
300
|
+
}, () => {
|
|
301
|
+
const nextState = this.state.isShowLargeEditor;
|
|
302
|
+
if (!nextState) {
|
|
303
|
+
this.initMap();
|
|
304
|
+
}
|
|
305
|
+
this.props.toggleLargeMap && this.props.toggleLargeMap(nextState);
|
|
245
306
|
});
|
|
246
307
|
};
|
|
247
308
|
this.onSubmit = () => {
|
|
248
|
-
const {
|
|
249
|
-
value
|
|
250
|
-
} = this.state;
|
|
251
|
-
this.props.setValue(value);
|
|
252
309
|
this.props.onSubmit();
|
|
253
310
|
};
|
|
254
|
-
this.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
|
|
266
|
-
lat = parseFloat(inputValue.slice(0, splitCodeIndex).trim());
|
|
267
|
-
lng = parseFloat(inputValue.slice(splitCodeIndex + 1).trim());
|
|
268
|
-
} else {
|
|
269
|
-
lng = parseFloat(inputValue.slice(0, splitCodeIndex).trim());
|
|
270
|
-
lat = parseFloat(inputValue.slice(splitCodeIndex + 1).trim());
|
|
271
|
-
}
|
|
272
|
-
if (!Number.isNaN(lng) && !Number.isNaN(lat)) {
|
|
273
|
-
this.setState({
|
|
274
|
-
value: {
|
|
275
|
-
lng,
|
|
276
|
-
lat
|
|
277
|
-
}
|
|
311
|
+
this.rerenderMapMarker = _ref2 => {
|
|
312
|
+
let {
|
|
313
|
+
lng,
|
|
314
|
+
lat
|
|
315
|
+
} = _ref2;
|
|
316
|
+
if (!(0, _dtableUtils.isNumber)(lng) || !(0, _dtableUtils.isNumber)(lat)) return;
|
|
317
|
+
if (this.map) {
|
|
318
|
+
if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP || this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
|
|
319
|
+
this.map.setCenter({
|
|
320
|
+
lng,
|
|
321
|
+
lat
|
|
278
322
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
this.map.setCenter({
|
|
282
|
-
lng,
|
|
283
|
-
lat
|
|
284
|
-
});
|
|
285
|
-
} else {
|
|
286
|
-
this.map.setCenter(new window.BMap.Point(lng, lat));
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
this.addMarkerByPosition(lng, lat);
|
|
323
|
+
} else {
|
|
324
|
+
this.map.setCenter(new window.BMap.Point(lng, lat));
|
|
290
325
|
}
|
|
291
326
|
}
|
|
327
|
+
this.addMarkerByPosition(lng, lat);
|
|
328
|
+
};
|
|
329
|
+
this.onChangeLatitude = event => {
|
|
330
|
+
this.setState({
|
|
331
|
+
value: {
|
|
332
|
+
...this.state.value,
|
|
333
|
+
lat: event.target.value
|
|
334
|
+
}
|
|
335
|
+
}, () => {
|
|
336
|
+
const numericValue = this.getNumericValue(this.state.value);
|
|
337
|
+
this.setPropsValue(numericValue);
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
this.onChangeLongitude = event => {
|
|
341
|
+
this.setState({
|
|
342
|
+
value: {
|
|
343
|
+
...this.state.value,
|
|
344
|
+
lng: event.target.value
|
|
345
|
+
}
|
|
346
|
+
}, () => {
|
|
347
|
+
const numericValue = this.getNumericValue(this.state.value);
|
|
348
|
+
this.setPropsValue(numericValue);
|
|
349
|
+
});
|
|
292
350
|
};
|
|
293
351
|
this.onKeyDown = event => {
|
|
294
352
|
event.stopPropagation();
|
|
@@ -310,7 +368,10 @@ class MapEditor extends _react.Component {
|
|
|
310
368
|
this.onLocateCurrentPosition = () => {
|
|
311
369
|
(0, _mapEditorUtils.locateCurrentPosition)(this.map, this.mapType, this.geolocationCallback);
|
|
312
370
|
};
|
|
313
|
-
const _value = props.value || {
|
|
371
|
+
const _value = props.value || {
|
|
372
|
+
lng: '',
|
|
373
|
+
lat: ''
|
|
374
|
+
};
|
|
314
375
|
const {
|
|
315
376
|
mapType,
|
|
316
377
|
mapKey
|
|
@@ -318,44 +379,15 @@ class MapEditor extends _react.Component {
|
|
|
318
379
|
this.mapType = mapType;
|
|
319
380
|
this.mapKey = mapKey;
|
|
320
381
|
this.readOnly = props.readOnly;
|
|
321
|
-
const {
|
|
322
|
-
lng: _lng,
|
|
323
|
-
lat: _lat
|
|
324
|
-
} = _value;
|
|
325
|
-
const _inputValue = (0, _cell.isValidPosition)(_lng, _lat) ? _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? "".concat(_lng, ", ").concat(_lat) : "".concat(_lat, ", ").concat(_lng) : '';
|
|
326
382
|
this.map = null;
|
|
327
383
|
this.state = {
|
|
328
384
|
isLoading: true,
|
|
329
|
-
value:
|
|
330
|
-
inputValue: _inputValue,
|
|
385
|
+
value: _value,
|
|
331
386
|
isShowLargeEditor: false
|
|
332
387
|
};
|
|
333
388
|
}
|
|
334
389
|
componentDidMount() {
|
|
335
|
-
|
|
336
|
-
if (!window.BMap) {
|
|
337
|
-
window.renderBaiduMap = () => this.renderBaiduMap();
|
|
338
|
-
(0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey);
|
|
339
|
-
} else {
|
|
340
|
-
this.renderBaiduMap();
|
|
341
|
-
}
|
|
342
|
-
return;
|
|
343
|
-
} else if (this.mapType === _mapEditorUtils.MAP_TYPES.G_MAP) {
|
|
344
|
-
if (!window.google) {
|
|
345
|
-
window.renderGoogleMap = () => this.renderGoogleMap();
|
|
346
|
-
(0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey);
|
|
347
|
-
} else {
|
|
348
|
-
this.renderGoogleMap();
|
|
349
|
-
}
|
|
350
|
-
return;
|
|
351
|
-
} else if (this.mapType === _mapEditorUtils.MAP_TYPES.M_MAP) {
|
|
352
|
-
if (!window.minemap) {
|
|
353
|
-
(0, _mapEditorUtils.loadMapSource)(this.mapType, this.mapKey, this.loadMineMapCallBack);
|
|
354
|
-
} else {
|
|
355
|
-
this.renderMineMap();
|
|
356
|
-
}
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
390
|
+
this.initMap();
|
|
359
391
|
}
|
|
360
392
|
componentWillUnmount() {
|
|
361
393
|
let center = {};
|
|
@@ -376,13 +408,16 @@ class MapEditor extends _react.Component {
|
|
|
376
408
|
localStorage.setItem('geolocation-map-center', JSON.stringify(center));
|
|
377
409
|
this.map = null;
|
|
378
410
|
this.props.toggleLargeMap && this.props.toggleLargeMap(false);
|
|
411
|
+
this.onSubmit();
|
|
379
412
|
}
|
|
380
413
|
render() {
|
|
381
414
|
const {
|
|
382
415
|
isLoading,
|
|
383
|
-
|
|
416
|
+
value,
|
|
384
417
|
isShowLargeEditor
|
|
385
418
|
} = this.state;
|
|
419
|
+
const lat = value ? value.lat : '';
|
|
420
|
+
const lng = value ? value.lng : '';
|
|
386
421
|
if (!isShowLargeEditor) {
|
|
387
422
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
388
423
|
className: "dtable-ui-geolocation-map-editor-header"
|
|
@@ -398,24 +433,31 @@ class MapEditor extends _react.Component {
|
|
|
398
433
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
399
434
|
className: "dtable-ui-geolocation-map-editor"
|
|
400
435
|
}, !this.readOnly && /*#__PURE__*/_react.default.createElement("div", {
|
|
401
|
-
className: "map-editor-header"
|
|
436
|
+
className: "dtable-ui-geolocation-map-lng-lat-editor-header"
|
|
437
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
438
|
+
className: "dtable-ui-geolocation-map-lng-lat-input-container map-lat-input-container"
|
|
402
439
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
403
|
-
className: "
|
|
404
|
-
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
440
|
+
className: "dtable-ui-geolocation-map-lng-lat-input-label"
|
|
441
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Latitude_abbr'))), /*#__PURE__*/_react.default.createElement("input", {
|
|
405
442
|
type: "text",
|
|
406
|
-
value:
|
|
443
|
+
value: lat,
|
|
444
|
+
onChange: this.onChangeLatitude,
|
|
407
445
|
onKeyDown: this.onKeyDown,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
placeholder: _mapEditorUtils.DOMESTIC_MAP_TYPE.includes(this.mapType) ? (0, _lang.getLocale)('Enter_longitude_and_latitude') : (0, _lang.getLocale)('Enter_latitude_and_longitude'),
|
|
446
|
+
className: "form-control",
|
|
447
|
+
placeholder: (0, _lang.getLocale)('Enter_latitude'),
|
|
411
448
|
autoFocus: true
|
|
412
|
-
}),
|
|
413
|
-
className: "
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
449
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
450
|
+
className: "dtable-ui-geolocation-map-lng-lat-input-container map-lng-input-container"
|
|
451
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
452
|
+
className: "dtable-ui-geolocation-map-lng-lat-input-label"
|
|
453
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Longitude_abbr'))), /*#__PURE__*/_react.default.createElement("input", {
|
|
454
|
+
type: "text",
|
|
455
|
+
value: lng,
|
|
456
|
+
onChange: this.onChangeLongitude,
|
|
457
|
+
onKeyDown: this.onKeyDown,
|
|
458
|
+
className: "form-control",
|
|
459
|
+
placeholder: (0, _lang.getLocale)('Enter_longitude')
|
|
460
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
419
461
|
className: this.readOnly ? 'geolocation-map-read-only-container' : 'geolocation-map-container'
|
|
420
462
|
}, this.mapType && isLoading && /*#__PURE__*/_react.default.createElement(_Loading.default, null), !this.mapType && /*#__PURE__*/_react.default.createElement("div", {
|
|
421
463
|
className: "error-message d-flex justify-content-center mt-9"
|
|
@@ -449,6 +491,8 @@ class MapEditor extends _react.Component {
|
|
|
449
491
|
}))))));
|
|
450
492
|
}
|
|
451
493
|
return /*#__PURE__*/_react.default.createElement(_largeEditor.default, Object.assign({}, this.props, {
|
|
494
|
+
value: value,
|
|
495
|
+
setValue: this.setValue,
|
|
452
496
|
toggleFullScreen: this.toggleFullScreen
|
|
453
497
|
}));
|
|
454
498
|
}
|