@antv/l7-component 2.17.4 → 2.17.6

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.
Files changed (47) hide show
  1. package/es/assets/iconfont/iconfont.js +10 -17
  2. package/es/control/baseControl/buttonControl.js +9 -42
  3. package/es/control/baseControl/control.js +24 -53
  4. package/es/control/baseControl/popperControl.js +10 -24
  5. package/es/control/baseControl/selectControl.js +6 -45
  6. package/es/control/exportImage.js +76 -116
  7. package/es/control/fullscreen.js +20 -53
  8. package/es/control/geoLocate.js +36 -66
  9. package/es/control/layerSwitch.js +0 -31
  10. package/es/control/logo.js +2 -14
  11. package/es/control/mapTheme.js +7 -32
  12. package/es/control/mouseLocation.js +2 -23
  13. package/es/control/scale.js +6 -29
  14. package/es/control/zoom.js +0 -23
  15. package/es/index.js +2 -12
  16. package/es/marker-layer.js +41 -75
  17. package/es/marker.js +29 -83
  18. package/es/popup/layerPopup.js +31 -82
  19. package/es/popup/popup.js +48 -127
  20. package/es/utils/anchor.js +3 -7
  21. package/es/utils/popper.js +15 -64
  22. package/es/utils/screenfull.js +23 -52
  23. package/lib/assets/iconfont/iconfont.js +10 -17
  24. package/lib/control/baseControl/buttonControl.js +9 -52
  25. package/lib/control/baseControl/control.js +24 -68
  26. package/lib/control/baseControl/index.js +0 -4
  27. package/lib/control/baseControl/popperControl.js +10 -29
  28. package/lib/control/baseControl/selectControl.js +6 -60
  29. package/lib/control/exportImage.js +76 -125
  30. package/lib/control/fullscreen.js +20 -60
  31. package/lib/control/geoLocate.js +36 -75
  32. package/lib/control/layerSwitch.js +0 -36
  33. package/lib/control/logo.js +2 -26
  34. package/lib/control/mapTheme.js +7 -42
  35. package/lib/control/mouseLocation.js +2 -33
  36. package/lib/control/scale.js +6 -40
  37. package/lib/control/zoom.js +0 -33
  38. package/lib/index.js +0 -30
  39. package/lib/marker-layer.js +39 -86
  40. package/lib/marker.js +29 -91
  41. package/lib/popup/layerPopup.js +29 -94
  42. package/lib/popup/popup.js +48 -139
  43. package/lib/utils/anchor.js +4 -9
  44. package/lib/utils/icon.js +0 -2
  45. package/lib/utils/popper.js +14 -71
  46. package/lib/utils/screenfull.js +23 -54
  47. package/package.json +6 -6
@@ -1,63 +1,40 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.GeoLocate = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
-
16
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
13
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
21
-
22
14
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
23
-
24
15
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
25
-
26
16
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
27
-
28
17
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
29
-
30
18
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
31
-
32
19
  var _lodash = require("lodash");
33
-
34
20
  var _icon = require("../utils/icon");
35
-
36
21
  var _buttonControl = _interopRequireDefault(require("./baseControl/buttonControl"));
37
-
38
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
39
-
40
23
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
-
42
24
  var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
43
25
  (0, _inherits2.default)(GeoLocate, _ButtonControl);
44
-
45
26
  var _super = _createSuper(GeoLocate);
46
-
47
27
  function GeoLocate(option) {
48
28
  var _this;
49
-
50
29
  (0, _classCallCheck2.default)(this, GeoLocate);
51
30
  _this = _super.call(this, option);
52
31
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getGeoLocation", function () {
53
32
  return new Promise(function (resolve, reject) {
54
33
  window.navigator.geolocation.getCurrentPosition(function (_ref) {
55
34
  var coords = _ref.coords;
56
-
57
35
  var _ref2 = coords !== null && coords !== void 0 ? coords : {},
58
- longitude = _ref2.longitude,
59
- latitude = _ref2.latitude;
60
-
36
+ longitude = _ref2.longitude,
37
+ latitude = _ref2.latitude;
61
38
  if (!(0, _lodash.isNaN)(longitude) && !(0, _lodash.isNaN)(latitude)) {
62
39
  resolve([longitude, latitude]);
63
40
  } else {
@@ -71,63 +48,48 @@ var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
71
48
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClick", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
72
49
  var transform, position, currentZoom;
73
50
  return _regenerator.default.wrap(function _callee$(_context) {
74
- while (1) {
75
- switch (_context.prev = _context.next) {
76
- case 0:
77
- if (window.navigator.geolocation) {
78
- _context.next = 2;
79
- break;
80
- }
81
-
82
- return _context.abrupt("return");
83
-
84
- case 2:
85
- transform = _this.controlOption.transform;
86
- _context.next = 5;
87
- return _this.getGeoLocation();
88
-
89
- case 5:
90
- position = _context.sent;
91
- currentZoom = _this.mapsService.getZoom();
92
- _context.t0 = _this.mapsService;
93
- _context.t1 = currentZoom > 15 ? currentZoom : 15;
94
-
95
- if (!transform) {
96
- _context.next = 15;
97
- break;
98
- }
99
-
100
- _context.next = 12;
101
- return transform(position);
102
-
103
- case 12:
104
- _context.t2 = _context.sent;
105
- _context.next = 16;
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ if (window.navigator.geolocation) {
54
+ _context.next = 2;
106
55
  break;
107
-
108
- case 15:
109
- _context.t2 = position;
110
-
111
- case 16:
112
- _context.t3 = _context.t2;
113
-
114
- _context.t0.setZoomAndCenter.call(_context.t0, _context.t1, _context.t3);
115
-
116
- case 18:
117
- case "end":
118
- return _context.stop();
119
- }
56
+ }
57
+ return _context.abrupt("return");
58
+ case 2:
59
+ transform = _this.controlOption.transform;
60
+ _context.next = 5;
61
+ return _this.getGeoLocation();
62
+ case 5:
63
+ position = _context.sent;
64
+ currentZoom = _this.mapsService.getZoom();
65
+ _context.t0 = _this.mapsService;
66
+ _context.t1 = currentZoom > 15 ? currentZoom : 15;
67
+ if (!transform) {
68
+ _context.next = 15;
69
+ break;
70
+ }
71
+ _context.next = 12;
72
+ return transform(position);
73
+ case 12:
74
+ _context.t2 = _context.sent;
75
+ _context.next = 16;
76
+ break;
77
+ case 15:
78
+ _context.t2 = position;
79
+ case 16:
80
+ _context.t3 = _context.t2;
81
+ _context.t0.setZoomAndCenter.call(_context.t0, _context.t1, _context.t3);
82
+ case 18:
83
+ case "end":
84
+ return _context.stop();
120
85
  }
121
86
  }, _callee);
122
87
  })));
123
-
124
88
  if (!window.navigator.geolocation) {
125
89
  console.warn('当前浏览器环境不支持获取地理定位');
126
90
  }
127
-
128
91
  return _this;
129
92
  }
130
-
131
93
  (0, _createClass2.default)(GeoLocate, [{
132
94
  key: "getDefault",
133
95
  value: function getDefault(option) {
@@ -143,12 +105,11 @@ var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
143
105
  button.addEventListener('click', this.onClick);
144
106
  return button;
145
107
  }
108
+
146
109
  /**
147
110
  * 通过浏览器 API 获取当前所在经纬度
148
111
  */
149
-
150
112
  }]);
151
113
  return GeoLocate;
152
114
  }(_buttonControl.default);
153
-
154
115
  exports.default = exports.GeoLocate = GeoLocate;
@@ -1,62 +1,39 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.LayerSwitch = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
12
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
-
20
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
-
22
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
-
24
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
-
26
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
-
28
17
  var _icon = require("../utils/icon");
29
-
30
18
  var _selectControl = _interopRequireDefault(require("./baseControl/selectControl"));
31
-
32
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
-
34
20
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35
-
36
21
  var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
37
22
  (0, _inherits2.default)(LayerSwitch, _SelectControl);
38
-
39
23
  var _super = _createSuper(LayerSwitch);
40
-
41
24
  function LayerSwitch() {
42
25
  var _this;
43
-
44
26
  (0, _classCallCheck2.default)(this, LayerSwitch);
45
-
46
27
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
28
  args[_key] = arguments[_key];
48
29
  }
49
-
50
30
  _this = _super.call.apply(_super, [this].concat(args));
51
31
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onLayerChange", function () {
52
32
  var _this$controlOption$l;
53
-
54
33
  if ((_this$controlOption$l = _this.controlOption.layers) !== null && _this$controlOption$l !== void 0 && _this$controlOption$l.length) {
55
34
  return;
56
35
  }
57
-
58
36
  _this.selectValue = _this.getLayerVisible();
59
-
60
37
  _this.setOptions({
61
38
  options: _this.getLayerOptions()
62
39
  });
@@ -67,13 +44,10 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
67
44
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSelectChange", function () {
68
45
  _this.layers.forEach(function (layer) {
69
46
  var needShow = _this.selectValue.includes(layer.name);
70
-
71
47
  var isShow = layer.isVisible();
72
-
73
48
  if (needShow && !isShow) {
74
49
  layer.show();
75
50
  }
76
-
77
51
  if (!needShow && isShow) {
78
52
  layer.hide();
79
53
  }
@@ -81,23 +55,19 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
81
55
  });
82
56
  return _this;
83
57
  }
84
-
85
58
  (0, _createClass2.default)(LayerSwitch, [{
86
59
  key: "layers",
87
60
  get: function get() {
88
61
  var layerService = this.layerService;
89
62
  var layers = this.controlOption.layers;
90
-
91
63
  if (Array.isArray(layers) && layers.length) {
92
64
  var layerInstances = [];
93
65
  layers.forEach(function (layer) {
94
66
  if (layer instanceof Object) {
95
67
  layerInstances.push(layer);
96
68
  }
97
-
98
69
  if (typeof layer === 'string') {
99
70
  var targetLayer = layerService.getLayer(layer) || layerService.getLayerByName(layer);
100
-
101
71
  if (targetLayer) {
102
72
  layerInstances.push(targetLayer);
103
73
  }
@@ -105,7 +75,6 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
105
75
  });
106
76
  return layerInstances;
107
77
  }
108
-
109
78
  return layerService.getLayers() || [];
110
79
  }
111
80
  }, {
@@ -141,7 +110,6 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
141
110
  value: function setOptions(option) {
142
111
  var isLayerChange = this.checkUpdateOption(option, ['layers']);
143
112
  (0, _get2.default)((0, _getPrototypeOf2.default)(LayerSwitch.prototype), "setOptions", this).call(this, option);
144
-
145
113
  if (isLayerChange) {
146
114
  this.selectValue = this.getLayerVisible();
147
115
  this.controlOption.options = this.getLayerOptions();
@@ -152,15 +120,12 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
152
120
  key: "onAdd",
153
121
  value: function onAdd() {
154
122
  var _this$controlOption$o;
155
-
156
123
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
157
124
  this.controlOption.options = this.getLayerOptions();
158
125
  }
159
-
160
126
  if (!this.controlOption.defaultValue) {
161
127
  this.controlOption.defaultValue = this.getLayerVisible();
162
128
  }
163
-
164
129
  this.on('selectChange', this.onSelectChange);
165
130
  this.layerService.on('layerChange', this.onLayerChange);
166
131
  return (0, _get2.default)((0, _getPrototypeOf2.default)(LayerSwitch.prototype), "onAdd", this).call(this);
@@ -179,5 +144,4 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
179
144
  }]);
180
145
  return LayerSwitch;
181
146
  }(_selectControl.default);
182
-
183
147
  exports.default = exports.LayerSwitch = LayerSwitch;
@@ -1,42 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.Logo = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
-
16
11
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
14
  var _l7Utils = require("@antv/l7-utils");
23
-
24
15
  var _baseControl = require("./baseControl");
25
-
26
16
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
27
-
28
17
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
-
30
18
  var Logo = /*#__PURE__*/function (_Control) {
31
19
  (0, _inherits2.default)(Logo, _Control);
32
-
33
20
  var _super = _createSuper(Logo);
34
-
35
21
  function Logo() {
36
22
  (0, _classCallCheck2.default)(this, Logo);
37
23
  return _super.apply(this, arguments);
38
24
  }
39
-
40
25
  (0, _createClass2.default)(Logo, [{
41
26
  key: "getDefault",
42
27
  value: function getDefault() {
@@ -51,7 +36,6 @@ var Logo = /*#__PURE__*/function (_Control) {
51
36
  key: "onAdd",
52
37
  value: function onAdd() {
53
38
  var container = _l7Utils.DOM.create('div', 'l7-control-logo');
54
-
55
39
  this.setLogoContent(container);
56
40
  return container;
57
41
  }
@@ -64,10 +48,8 @@ var Logo = /*#__PURE__*/function (_Control) {
64
48
  key: "setOptions",
65
49
  value: function setOptions(option) {
66
50
  (0, _get2.default)((0, _getPrototypeOf2.default)(Logo.prototype), "setOptions", this).call(this, option);
67
-
68
51
  if (this.checkUpdateOption(option, ['img', 'href'])) {
69
52
  _l7Utils.DOM.clearChildren(this.container);
70
-
71
53
  this.setLogoContent(this.container);
72
54
  }
73
55
  }
@@ -75,19 +57,14 @@ var Logo = /*#__PURE__*/function (_Control) {
75
57
  key: "setLogoContent",
76
58
  value: function setLogoContent(container) {
77
59
  var _this$controlOption = this.controlOption,
78
- href = _this$controlOption.href,
79
- img = _this$controlOption.img;
80
-
60
+ href = _this$controlOption.href,
61
+ img = _this$controlOption.img;
81
62
  var imgDOM = _l7Utils.DOM.create('img');
82
-
83
63
  imgDOM.setAttribute('src', img);
84
64
  imgDOM.setAttribute('aria-label', 'AntV logo');
85
-
86
65
  _l7Utils.DOM.setUnDraggable(imgDOM);
87
-
88
66
  if (href) {
89
67
  var anchorDOM = _l7Utils.DOM.create('a', 'l7-control-logo-link');
90
-
91
68
  anchorDOM.target = '_blank';
92
69
  anchorDOM.href = href;
93
70
  anchorDOM.rel = 'noopener nofollow';
@@ -101,5 +78,4 @@ var Logo = /*#__PURE__*/function (_Control) {
101
78
  }]);
102
79
  return Logo;
103
80
  }(_baseControl.Control);
104
-
105
81
  exports.default = exports.Logo = Logo;
@@ -1,63 +1,40 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.MapTheme = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
12
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
-
20
13
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
21
-
22
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
15
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
-
26
16
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
-
28
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
-
30
18
  var _constants = require("../constants");
31
-
32
19
  var _icon = require("../utils/icon");
33
-
34
20
  var _selectControl = _interopRequireDefault(require("./baseControl/selectControl"));
35
-
36
21
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
37
-
38
22
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
-
40
23
  var MapTheme = /*#__PURE__*/function (_SelectControl) {
41
24
  (0, _inherits2.default)(MapTheme, _SelectControl);
42
-
43
25
  var _super = _createSuper(MapTheme);
44
-
45
26
  function MapTheme() {
46
27
  var _this;
47
-
48
28
  (0, _classCallCheck2.default)(this, MapTheme);
49
-
50
29
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
30
  args[_key] = arguments[_key];
52
31
  }
53
-
54
32
  _this = _super.call.apply(_super, [this].concat(args));
55
33
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMapThemeChange", function () {
56
34
  _this.mapsService.setMapStyle(_this.selectValue[0]);
57
35
  });
58
36
  return _this;
59
37
  }
60
-
61
38
  (0, _createClass2.default)(MapTheme, [{
62
39
  key: "getDefault",
63
40
  value: function getDefault(option) {
@@ -73,22 +50,18 @@ var MapTheme = /*#__PURE__*/function (_SelectControl) {
73
50
  var mapStyleConfig = this.mapsService.getType() === 'mapbox' ? _constants.MapboxMapStyleConfig : _constants.GaodeMapStyleConfig;
74
51
  return Object.entries(this.mapsService.getMapStyleConfig()).filter(function (_ref) {
75
52
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
76
- key = _ref2[0],
77
- value = _ref2[1];
78
-
53
+ key = _ref2[0],
54
+ value = _ref2[1];
79
55
  return typeof value === 'string' && key !== 'blank';
80
56
  }).map(function (_ref3) {
81
57
  var _mapStyleConfig$key;
82
-
83
58
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
84
- key = _ref4[0],
85
- value = _ref4[1];
86
-
59
+ key = _ref4[0],
60
+ value = _ref4[1];
87
61
  // @ts-ignore
88
62
  var _ref5 = (_mapStyleConfig$key = mapStyleConfig[key]) !== null && _mapStyleConfig$key !== void 0 ? _mapStyleConfig$key : {},
89
- text = _ref5.text,
90
- img = _ref5.img;
91
-
63
+ text = _ref5.text,
64
+ img = _ref5.img;
92
65
  return {
93
66
  text: text !== null && text !== void 0 ? text : key,
94
67
  value: value,
@@ -106,36 +79,29 @@ var MapTheme = /*#__PURE__*/function (_SelectControl) {
106
79
  key: "onAdd",
107
80
  value: function onAdd() {
108
81
  var _this$controlOption$o,
109
- _this2 = this;
110
-
82
+ _this2 = this;
111
83
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
112
84
  this.controlOption.options = this.getStyleOptions();
113
85
  }
114
-
115
86
  if (this.controlOption.defaultValue) {
116
87
  var _this$controlOption$o2, _this$controlOption$o3;
117
-
118
88
  var defaultValue = this.controlOption.defaultValue;
119
89
  this.controlOption.defaultValue = (_this$controlOption$o2 = (_this$controlOption$o3 = this.controlOption.options.find(function (item) {
120
90
  return item.key === defaultValue;
121
91
  })) === null || _this$controlOption$o3 === void 0 ? void 0 : _this$controlOption$o3.value) !== null && _this$controlOption$o2 !== void 0 ? _this$controlOption$o2 : defaultValue;
122
92
  } else {
123
93
  var defaultStyle = this.getMapStyle();
124
-
125
94
  if (defaultStyle) {
126
95
  this.controlOption.defaultValue = defaultStyle;
127
96
  } else {
128
97
  // @ts-ignore
129
98
  this.mapsService.map.once('styledata', function () {
130
99
  var mapboxStyle = _this2.mapsService.getMapStyle();
131
-
132
100
  _this2.controlOption.defaultValue = mapboxStyle;
133
-
134
101
  _this2.setSelectValue(mapboxStyle, false);
135
102
  });
136
103
  }
137
104
  }
138
-
139
105
  this.on('selectChange', this.onMapThemeChange);
140
106
  return (0, _get2.default)((0, _getPrototypeOf2.default)(MapTheme.prototype), "onAdd", this).call(this);
141
107
  }
@@ -147,5 +113,4 @@ var MapTheme = /*#__PURE__*/function (_SelectControl) {
147
113
  }]);
148
114
  return MapTheme;
149
115
  }(_selectControl.default);
150
-
151
116
  exports.default = exports.MapTheme = MapTheme;
@@ -1,80 +1,52 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.MouseLocation = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
12
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
-
20
13
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
21
-
22
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
15
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
-
26
16
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
-
28
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
-
30
18
  var _l7Core = require("@antv/l7-core");
31
-
32
19
  var _l7Utils = require("@antv/l7-utils");
33
-
34
20
  var _control = _interopRequireDefault(require("./baseControl/control"));
35
-
36
21
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
37
-
38
22
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
-
40
23
  var MouseLocation = /*#__PURE__*/function (_Control) {
41
24
  (0, _inherits2.default)(MouseLocation, _Control);
42
-
43
25
  var _super = _createSuper(MouseLocation);
44
-
45
26
  function MouseLocation() {
46
27
  var _this;
47
-
48
28
  (0, _classCallCheck2.default)(this, MouseLocation);
49
-
50
29
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
30
  args[_key] = arguments[_key];
52
31
  }
53
-
54
32
  _this = _super.call.apply(_super, [this].concat(args));
55
33
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "location", [0, 0]);
56
34
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseMove", function (e) {
57
35
  var position = _this.location;
58
36
  var lngLat = e.lngLat || e.lnglat;
59
37
  var transform = _this.controlOption.transform;
60
-
61
38
  if (lngLat) {
62
39
  position = [lngLat.lng, lngLat.lat];
63
40
  }
64
-
65
41
  _this.location = position;
66
-
67
42
  if (transform) {
68
43
  position = transform(position);
69
44
  }
70
-
71
45
  _this.insertLocation2HTML(position);
72
-
73
46
  _this.emit('locationChange', position);
74
47
  });
75
48
  return _this;
76
49
  }
77
-
78
50
  (0, _createClass2.default)(MouseLocation, [{
79
51
  key: "getLocation",
80
52
  value: function getLocation() {
@@ -87,9 +59,8 @@ var MouseLocation = /*#__PURE__*/function (_Control) {
87
59
  position: _l7Core.PositionType.BOTTOMLEFT,
88
60
  transform: function transform(_ref) {
89
61
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
90
- lng = _ref2[0],
91
- lat = _ref2[1];
92
-
62
+ lng = _ref2[0],
63
+ lat = _ref2[1];
93
64
  return [+(+lng).toFixed(6), +(+lat).toFixed(6)];
94
65
  }
95
66
  });
@@ -98,7 +69,6 @@ var MouseLocation = /*#__PURE__*/function (_Control) {
98
69
  key: "onAdd",
99
70
  value: function onAdd() {
100
71
  var container = _l7Utils.DOM.create('div', 'l7-control-mouse-location');
101
-
102
72
  container.innerHTML = '&nbsp;';
103
73
  this.mapsService.on('mousemove', this.onMouseMove);
104
74
  return container;
@@ -116,5 +86,4 @@ var MouseLocation = /*#__PURE__*/function (_Control) {
116
86
  }]);
117
87
  return MouseLocation;
118
88
  }(_control.default);
119
-
120
89
  exports.default = exports.MouseLocation = MouseLocation;