dtable-ui-component 6.0.43 → 6.0.44

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.
@@ -170,22 +170,19 @@ class MapEditor extends _react.default.Component {
170
170
  this.map.addListener('mousedown', event => {
171
171
  const lng = event.latLng.lng();
172
172
  const lat = event.latLng.lat();
173
- const point = {
173
+ this.setValue({
174
174
  lng,
175
175
  lat
176
- };
177
- this.setValue(point);
176
+ });
178
177
  this.addMarkerByPosition(lng, lat);
179
178
  });
180
179
  }, 1);
181
180
  });
182
181
  };
183
182
  this.setValue = point => {
183
+ const value = (0, _dtableUtils.normalizeMapPoint)(point);
184
184
  this.setState({
185
- value: {
186
- lng: point.lng,
187
- lat: point.lat
188
- }
185
+ value
189
186
  });
190
187
  };
191
188
  this.addMarkerByPosition = (lng, lat) => {
@@ -255,7 +252,7 @@ class MapEditor extends _react.default.Component {
255
252
  const {
256
253
  lng,
257
254
  lat
258
- } = this.getNumericValue(value);
255
+ } = (0, _dtableUtils.normalizeMapPoint)(value);
259
256
  const newValue = !(0, _dtableUtils.isNumber)(lng) || !(0, _dtableUtils.isNumber)(lat) ? null : value;
260
257
  this.props.onCommit(newValue);
261
258
  this.onClose();
@@ -294,37 +291,36 @@ class MapEditor extends _react.default.Component {
294
291
  this.onClose = () => {
295
292
  this.props.onToggle();
296
293
  };
297
- this.getNumericValue = value => {
294
+ this.onBlur = () => {
298
295
  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
- };
296
+ value
297
+ } = this.state;
298
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(value);
299
+ this.setState({
300
+ value: numericValue
301
+ });
308
302
  };
309
303
  this.handleLatitudeChange = value => {
304
+ const newValue = {
305
+ ...this.state.value,
306
+ lat: value
307
+ };
310
308
  this.setState({
311
- value: {
312
- ...this.state.value,
313
- lat: value
314
- }
309
+ value: newValue
315
310
  }, () => {
316
- const numericValue = this.getNumericValue(this.state.value);
311
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(newValue);
317
312
  this.rerenderMapMarker(numericValue);
318
313
  });
319
314
  };
320
315
  this.handleLongitudeChange = value => {
316
+ const newValue = {
317
+ ...this.state.value,
318
+ lng: value
319
+ };
321
320
  this.setState({
322
- value: {
323
- ...this.state.value,
324
- lng: value
325
- }
321
+ value: newValue
326
322
  }, () => {
327
- const numericValue = this.getNumericValue(this.state.value);
323
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(newValue);
328
324
  this.rerenderMapMarker(numericValue);
329
325
  });
330
326
  };
@@ -352,7 +348,7 @@ class MapEditor extends _react.default.Component {
352
348
  const {
353
349
  isLoading,
354
350
  mode,
355
- value
351
+ value: lng_lat
356
352
  } = this.state;
357
353
  if (isLoading) return /*#__PURE__*/_react.default.createElement("div", {
358
354
  className: "w-100 h-100 d-flex align-items-center justify-content-center"
@@ -365,10 +361,8 @@ class MapEditor extends _react.default.Component {
365
361
  }, (0, _lang.getLocale)('The_map_plugin_is_not_properly_configured_contact_the_administrator')));
366
362
  }
367
363
  const isEdit = mode === 'edit';
368
- const {
369
- lat,
370
- lng
371
- } = value;
364
+ const lat = lng_lat && !(0, _dtableUtils.isEmpty)(lng_lat.lat) ? lng_lat.lat : '';
365
+ const lng = lng_lat && !(0, _dtableUtils.isEmpty)(lng_lat.lng) ? lng_lat.lng : '';
372
366
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
373
367
  className: "dtable-ui-mobile-geolocation-map-editor-input-container"
374
368
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -381,6 +375,7 @@ class MapEditor extends _react.default.Component {
381
375
  },
382
376
  value: lat,
383
377
  editable: isEdit,
378
+ onBlur: this.onBlur,
384
379
  onChange: this.handleLatitudeChange,
385
380
  placeholder: (0, _lang.getLocale)('Latitude')
386
381
  }), /*#__PURE__*/_react.default.createElement("div", {
@@ -393,6 +388,7 @@ class MapEditor extends _react.default.Component {
393
388
  },
394
389
  value: lng,
395
390
  editable: isEdit,
391
+ onBlur: this.onBlur,
396
392
  onChange: this.handleLongitudeChange,
397
393
  placeholder: (0, _lang.getLocale)('Longitude')
398
394
  })), /*#__PURE__*/_react.default.createElement("div", {
@@ -206,22 +206,10 @@ class MapEditor extends _react.Component {
206
206
  this.setState({
207
207
  value
208
208
  }, () => {
209
- const numericValue = this.getNumericValue(this.state.value);
209
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(this.state.value);
210
210
  this.setPropsValue(numericValue);
211
211
  });
212
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
213
  this.setPropsValue = _ref => {
226
214
  let {
227
215
  lng,
@@ -293,7 +281,7 @@ class MapEditor extends _react.Component {
293
281
  const {
294
282
  value
295
283
  } = this.state;
296
- const numericValue = this.getNumericValue(value);
284
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(value);
297
285
  this.setPropsValue(numericValue);
298
286
  this.setState({
299
287
  isShowLargeEditor: !this.state.isShowLargeEditor
@@ -326,25 +314,36 @@ class MapEditor extends _react.Component {
326
314
  }
327
315
  this.addMarkerByPosition(lng, lat);
328
316
  };
317
+ this.onBlur = () => {
318
+ const {
319
+ value
320
+ } = this.state;
321
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(value);
322
+ this.setState({
323
+ value: numericValue
324
+ });
325
+ };
329
326
  this.onChangeLatitude = event => {
327
+ const newValue = {
328
+ ...this.state.value,
329
+ lat: event.target.value
330
+ };
330
331
  this.setState({
331
- value: {
332
- ...this.state.value,
333
- lat: event.target.value
334
- }
332
+ value: newValue
335
333
  }, () => {
336
- const numericValue = this.getNumericValue(this.state.value);
334
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(newValue);
337
335
  this.setPropsValue(numericValue);
338
336
  });
339
337
  };
340
338
  this.onChangeLongitude = event => {
339
+ const newValue = {
340
+ ...this.state.value,
341
+ lng: event.target.value
342
+ };
341
343
  this.setState({
342
- value: {
343
- ...this.state.value,
344
- lng: event.target.value
345
- }
344
+ value: newValue
346
345
  }, () => {
347
- const numericValue = this.getNumericValue(this.state.value);
346
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(newValue);
348
347
  this.setPropsValue(numericValue);
349
348
  });
350
349
  };
@@ -413,11 +412,11 @@ class MapEditor extends _react.Component {
413
412
  render() {
414
413
  const {
415
414
  isLoading,
416
- value,
415
+ value: lng_lat,
417
416
  isShowLargeEditor
418
417
  } = this.state;
419
- const lat = value ? value.lat : '';
420
- const lng = value ? value.lng : '';
418
+ const lat = lng_lat && !(0, _dtableUtils.isEmpty)(lng_lat.lat) ? lng_lat.lat : '';
419
+ const lng = lng_lat && !(0, _dtableUtils.isEmpty)(lng_lat.lng) ? lng_lat.lng : '';
421
420
  if (!isShowLargeEditor) {
422
421
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
423
422
  className: "dtable-ui-geolocation-map-editor-header"
@@ -441,6 +440,7 @@ class MapEditor extends _react.Component {
441
440
  }, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Latitude_abbr'))), /*#__PURE__*/_react.default.createElement("input", {
442
441
  type: "text",
443
442
  value: lat,
443
+ onBlur: this.onBlur,
444
444
  onChange: this.onChangeLatitude,
445
445
  onKeyDown: this.onKeyDown,
446
446
  className: "form-control",
@@ -453,6 +453,7 @@ class MapEditor extends _react.Component {
453
453
  }, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Longitude_abbr'))), /*#__PURE__*/_react.default.createElement("input", {
454
454
  type: "text",
455
455
  value: lng,
456
+ onBlur: this.onBlur,
456
457
  onChange: this.onChangeLongitude,
457
458
  onKeyDown: this.onKeyDown,
458
459
  className: "form-control",
@@ -169,18 +169,6 @@ class LargeMapEditorDialog extends _react.default.Component {
169
169
  _toaster.default.danger((0, _lang.getLocale)('Positioning_failed'));
170
170
  }
171
171
  };
172
- this.getNumericValue = value => {
173
- const {
174
- lng,
175
- lat
176
- } = value || {};
177
- const numLng = typeof lng === 'string' ? parseFloat(lng.trim()) : lng;
178
- const numLat = typeof lat === 'string' ? parseFloat(lat.trim()) : lat;
179
- return {
180
- lng: numLng,
181
- lat: numLat
182
- };
183
- };
184
172
  this.setPropsValue = _ref => {
185
173
  let {
186
174
  lng,
@@ -203,7 +191,7 @@ class LargeMapEditorDialog extends _react.default.Component {
203
191
  this.setState({
204
192
  value
205
193
  }, () => {
206
- const numericValue = this.getNumericValue(this.state.value);
194
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(this.state.value);
207
195
  this.setPropsValue(numericValue);
208
196
  });
209
197
  };
@@ -270,26 +258,37 @@ class LargeMapEditorDialog extends _react.default.Component {
270
258
  }
271
259
  this.addMarkerByPosition(lng, lat);
272
260
  };
261
+ this.onBlur = () => {
262
+ const {
263
+ value
264
+ } = this.state;
265
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(value);
266
+ this.setState({
267
+ value: numericValue
268
+ });
269
+ };
273
270
  this.onChangeLatitude = event => {
271
+ const newValue = {
272
+ ...this.state.value,
273
+ lat: event.target.value
274
+ };
274
275
  this.setState({
275
- value: {
276
- ...this.state.value,
277
- lat: event.target.value
278
- }
276
+ value: newValue
279
277
  }, () => {
280
- const numericValue = this.getNumericValue(this.state.value);
278
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(newValue);
281
279
  this.setPropsValue(numericValue);
282
280
  this.rerenderMapMarker(numericValue);
283
281
  });
284
282
  };
285
283
  this.onChangeLongitude = event => {
284
+ const newValue = {
285
+ ...this.state.value,
286
+ lng: event.target.value
287
+ };
286
288
  this.setState({
287
- value: {
288
- ...this.state.value,
289
- lng: event.target.value
290
- }
289
+ value: newValue
291
290
  }, () => {
292
- const numericValue = this.getNumericValue(this.state.value);
291
+ const numericValue = (0, _dtableUtils.normalizeMapPoint)(newValue);
293
292
  this.setPropsValue(numericValue);
294
293
  this.rerenderMapMarker(numericValue);
295
294
  });
@@ -405,10 +404,10 @@ class LargeMapEditorDialog extends _react.default.Component {
405
404
  render() {
406
405
  const {
407
406
  isLoading,
408
- value
407
+ value: lng_lat
409
408
  } = this.state;
410
- const lat = value ? value.lat : '';
411
- const lng = value ? value.lng : '';
409
+ const lat = lng_lat && !(0, _dtableUtils.isEmpty)(lng_lat.lat) ? lng_lat.lat : '';
410
+ const lng = lng_lat && !(0, _dtableUtils.isEmpty)(lng_lat.lng) ? lng_lat.lng : '';
412
411
  return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
413
412
  size: "lg",
414
413
  isOpen: true,
@@ -438,6 +437,7 @@ class LargeMapEditorDialog extends _react.default.Component {
438
437
  }, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Latitude_abbr'))), /*#__PURE__*/_react.default.createElement("input", {
439
438
  type: "text",
440
439
  value: lat,
440
+ onBlur: this.onBlur,
441
441
  onChange: this.onChangeLatitude,
442
442
  onKeyDown: this.onKeyDown,
443
443
  className: "form-control",
@@ -450,6 +450,7 @@ class LargeMapEditorDialog extends _react.default.Component {
450
450
  }, /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Longitude_abbr'))), /*#__PURE__*/_react.default.createElement("input", {
451
451
  type: "text",
452
452
  value: lng,
453
+ onBlur: this.onBlur,
453
454
  onChange: this.onChangeLongitude,
454
455
  onKeyDown: this.onKeyDown,
455
456
  className: "form-control",
@@ -101,3 +101,8 @@
101
101
  .option-group-dtable-ui-multiple-select-selector .option.option-active {
102
102
  background-color: #f5f5f5;
103
103
  }
104
+
105
+ .option-group-selector-single-select .option.option-active .select-option-name,
106
+ .option-group-selector-multiple-select .option.option-active .select-option-name {
107
+ color: #212529;
108
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.43",
3
+ "version": "6.0.44",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "4.0.2",
@@ -8,7 +8,7 @@
8
8
  "@seafile/seafile-editor": "~2.0.6",
9
9
  "classnames": "2.3.2",
10
10
  "dayjs": "1.10.7",
11
- "dtable-utils": "~5.0.21",
11
+ "dtable-utils": "~5.0.22",
12
12
  "is-hotkey": "0.2.0",
13
13
  "rc-checkbox": "3.5.0",
14
14
  "react-color": "2.19.3",