@antv/l7-component 2.15.2 → 2.15.3

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 -8
  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 -41
  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
@@ -9,120 +9,90 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
11
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
-
13
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
13
  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; } }
16
-
17
14
  import { DOM } from '@antv/l7-utils';
18
15
  import { createL7Icon } from "../utils/icon";
19
16
  import ScreenFull from "../utils/screenfull";
20
17
  import ButtonControl from "./baseControl/buttonControl";
21
18
  export { Fullscreen };
22
-
23
19
  var Fullscreen = /*#__PURE__*/function (_ButtonControl) {
24
20
  _inherits(Fullscreen, _ButtonControl);
25
-
26
21
  var _super = _createSuper(Fullscreen);
27
-
28
22
  function Fullscreen(option) {
29
23
  var _this;
30
-
31
24
  _classCallCheck(this, Fullscreen);
32
-
33
25
  _this = _super.call(this, option);
34
-
35
26
  _defineProperty(_assertThisInitialized(_this), "isFullscreen", false);
36
-
37
27
  _defineProperty(_assertThisInitialized(_this), "toggleFullscreen", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
38
28
  return _regeneratorRuntime.wrap(function _callee$(_context) {
39
- while (1) {
40
- switch (_context.prev = _context.next) {
41
- case 0:
42
- if (!ScreenFull.isEnabled) {
43
- _context.next = 3;
44
- break;
45
- }
46
-
29
+ while (1) switch (_context.prev = _context.next) {
30
+ case 0:
31
+ if (!ScreenFull.isEnabled) {
47
32
  _context.next = 3;
48
- return ScreenFull.toggle(_this.mapContainer);
49
-
50
- case 3:
51
- case "end":
52
- return _context.stop();
53
- }
33
+ break;
34
+ }
35
+ _context.next = 3;
36
+ return ScreenFull.toggle(_this.mapContainer);
37
+ case 3:
38
+ case "end":
39
+ return _context.stop();
54
40
  }
55
41
  }, _callee);
56
42
  })));
57
-
58
43
  _defineProperty(_assertThisInitialized(_this), "onClick", function () {
59
44
  _this.toggleFullscreen();
60
45
  });
61
-
62
46
  _defineProperty(_assertThisInitialized(_this), "onFullscreenChange", function () {
63
47
  _this.isFullscreen = !!document.fullscreenElement;
64
48
  var _this$controlOption = _this.controlOption,
65
- btnText = _this$controlOption.btnText,
66
- btnIcon = _this$controlOption.btnIcon,
67
- title = _this$controlOption.title,
68
- exitBtnText = _this$controlOption.exitBtnText,
69
- exitBtnIcon = _this$controlOption.exitBtnIcon,
70
- exitTitle = _this$controlOption.exitTitle;
71
-
49
+ btnText = _this$controlOption.btnText,
50
+ btnIcon = _this$controlOption.btnIcon,
51
+ title = _this$controlOption.title,
52
+ exitBtnText = _this$controlOption.exitBtnText,
53
+ exitBtnIcon = _this$controlOption.exitBtnIcon,
54
+ exitTitle = _this$controlOption.exitTitle;
72
55
  if (_this.isFullscreen) {
73
56
  _this.setBtnTitle(exitTitle);
74
-
75
57
  _this.setBtnText(exitBtnText);
76
-
77
58
  _this.setBtnIcon(exitBtnIcon);
78
59
  } else {
79
60
  _this.setBtnTitle(title);
80
-
81
61
  _this.setBtnText(btnText);
82
-
83
62
  _this.setBtnIcon(btnIcon);
84
63
  }
85
-
86
64
  _this.emit('fullscreenChange', _this.isFullscreen);
87
65
  });
88
-
89
66
  if (!ScreenFull.isEnabled) {
90
67
  console.warn('当前浏览器环境不支持对地图全屏化');
91
68
  }
92
-
93
69
  return _this;
94
70
  }
95
-
96
71
  _createClass(Fullscreen, [{
97
72
  key: "setOptions",
98
73
  value: function setOptions(newOptions) {
99
74
  var exitBtnText = newOptions.exitBtnText,
100
- exitBtnIcon = newOptions.exitBtnIcon,
101
- exitTitle = newOptions.exitTitle;
102
-
75
+ exitBtnIcon = newOptions.exitBtnIcon,
76
+ exitTitle = newOptions.exitTitle;
103
77
  if (this.isFullscreen) {
104
78
  if (this.checkUpdateOption(newOptions, ['exitBtnIcon'])) {
105
79
  this.setBtnIcon(exitBtnIcon);
106
80
  }
107
-
108
81
  if (this.checkUpdateOption(newOptions, ['exitBtnText'])) {
109
82
  this.setBtnText(exitBtnText);
110
83
  }
111
-
112
84
  if (this.checkUpdateOption(newOptions, ['exitTitle'])) {
113
85
  this.setBtnTitle(exitTitle);
114
86
  }
115
87
  }
116
-
117
88
  _get(_getPrototypeOf(Fullscreen.prototype), "setOptions", this).call(this, newOptions);
118
89
  }
119
90
  }, {
120
91
  key: "onAdd",
121
92
  value: function onAdd() {
122
93
  var button = _get(_getPrototypeOf(Fullscreen.prototype), "onAdd", this).call(this);
123
-
124
- button.addEventListener('click', this.onClick); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
125
-
94
+ button.addEventListener('click', this.onClick);
95
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
126
96
  this.mapContainer = DOM.getContainer(this.scene.getSceneConfig().id);
127
97
  this.mapContainer.addEventListener('fullscreenchange', this.onFullscreenChange);
128
98
  return button;
@@ -131,7 +101,6 @@ var Fullscreen = /*#__PURE__*/function (_ButtonControl) {
131
101
  key: "onRemove",
132
102
  value: function onRemove() {
133
103
  _get(_getPrototypeOf(Fullscreen.prototype), "onRemove", this).call(this);
134
-
135
104
  this.mapContainer.removeEventListener('fullscreenchange', this.onFullscreenChange);
136
105
  }
137
106
  }, {
@@ -145,8 +114,6 @@ var Fullscreen = /*#__PURE__*/function (_ButtonControl) {
145
114
  });
146
115
  }
147
116
  }]);
148
-
149
117
  return Fullscreen;
150
118
  }(ButtonControl);
151
-
152
119
  export { Fullscreen as default };
@@ -9,37 +9,26 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
11
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
-
13
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
13
  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; } }
16
-
17
14
  import { isNaN } from 'lodash';
18
15
  import { createL7Icon } from "../utils/icon";
19
16
  import ButtonControl from "./baseControl/buttonControl";
20
17
  export { GeoLocate };
21
-
22
18
  var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
23
19
  _inherits(GeoLocate, _ButtonControl);
24
-
25
20
  var _super = _createSuper(GeoLocate);
26
-
27
21
  function GeoLocate(option) {
28
22
  var _this;
29
-
30
23
  _classCallCheck(this, GeoLocate);
31
-
32
24
  _this = _super.call(this, option);
33
-
34
25
  _defineProperty(_assertThisInitialized(_this), "getGeoLocation", function () {
35
26
  return new Promise(function (resolve, reject) {
36
27
  window.navigator.geolocation.getCurrentPosition(function (_ref) {
37
28
  var coords = _ref.coords;
38
-
39
29
  var _ref2 = coords !== null && coords !== void 0 ? coords : {},
40
- longitude = _ref2.longitude,
41
- latitude = _ref2.latitude;
42
-
30
+ longitude = _ref2.longitude,
31
+ latitude = _ref2.latitude;
43
32
  if (!isNaN(longitude) && !isNaN(latitude)) {
44
33
  resolve([longitude, latitude]);
45
34
  } else {
@@ -50,67 +39,51 @@ var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
50
39
  });
51
40
  });
52
41
  });
53
-
54
42
  _defineProperty(_assertThisInitialized(_this), "onClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
55
43
  var transform, position, currentZoom;
56
44
  return _regeneratorRuntime.wrap(function _callee$(_context) {
57
- while (1) {
58
- switch (_context.prev = _context.next) {
59
- case 0:
60
- if (window.navigator.geolocation) {
61
- _context.next = 2;
62
- break;
63
- }
64
-
65
- return _context.abrupt("return");
66
-
67
- case 2:
68
- transform = _this.controlOption.transform;
69
- _context.next = 5;
70
- return _this.getGeoLocation();
71
-
72
- case 5:
73
- position = _context.sent;
74
- currentZoom = _this.mapsService.getZoom();
75
- _context.t0 = _this.mapsService;
76
- _context.t1 = currentZoom > 15 ? currentZoom : 15;
77
-
78
- if (!transform) {
79
- _context.next = 15;
80
- break;
81
- }
82
-
83
- _context.next = 12;
84
- return transform(position);
85
-
86
- case 12:
87
- _context.t2 = _context.sent;
88
- _context.next = 16;
45
+ while (1) switch (_context.prev = _context.next) {
46
+ case 0:
47
+ if (window.navigator.geolocation) {
48
+ _context.next = 2;
89
49
  break;
90
-
91
- case 15:
92
- _context.t2 = position;
93
-
94
- case 16:
95
- _context.t3 = _context.t2;
96
-
97
- _context.t0.setZoomAndCenter.call(_context.t0, _context.t1, _context.t3);
98
-
99
- case 18:
100
- case "end":
101
- return _context.stop();
102
- }
50
+ }
51
+ return _context.abrupt("return");
52
+ case 2:
53
+ transform = _this.controlOption.transform;
54
+ _context.next = 5;
55
+ return _this.getGeoLocation();
56
+ case 5:
57
+ position = _context.sent;
58
+ currentZoom = _this.mapsService.getZoom();
59
+ _context.t0 = _this.mapsService;
60
+ _context.t1 = currentZoom > 15 ? currentZoom : 15;
61
+ if (!transform) {
62
+ _context.next = 15;
63
+ break;
64
+ }
65
+ _context.next = 12;
66
+ return transform(position);
67
+ case 12:
68
+ _context.t2 = _context.sent;
69
+ _context.next = 16;
70
+ break;
71
+ case 15:
72
+ _context.t2 = position;
73
+ case 16:
74
+ _context.t3 = _context.t2;
75
+ _context.t0.setZoomAndCenter.call(_context.t0, _context.t1, _context.t3);
76
+ case 18:
77
+ case "end":
78
+ return _context.stop();
103
79
  }
104
80
  }, _callee);
105
81
  })));
106
-
107
82
  if (!window.navigator.geolocation) {
108
83
  console.warn('当前浏览器环境不支持获取地理定位');
109
84
  }
110
-
111
85
  return _this;
112
86
  }
113
-
114
87
  _createClass(GeoLocate, [{
115
88
  key: "getDefault",
116
89
  value: function getDefault(option) {
@@ -123,17 +96,14 @@ var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
123
96
  key: "onAdd",
124
97
  value: function onAdd() {
125
98
  var button = _get(_getPrototypeOf(GeoLocate.prototype), "onAdd", this).call(this);
126
-
127
99
  button.addEventListener('click', this.onClick);
128
100
  return button;
129
101
  }
102
+
130
103
  /**
131
104
  * 通过浏览器 API 获取当前所在经纬度
132
105
  */
133
-
134
106
  }]);
135
-
136
107
  return GeoLocate;
137
108
  }(ButtonControl);
138
-
139
109
  export { GeoLocate as default };
@@ -7,84 +7,61 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
-
11
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
-
13
11
  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; } }
14
-
15
12
  import { createL7Icon } from "../utils/icon";
16
13
  import SelectControl from "./baseControl/selectControl";
17
14
  export { LayerSwitch };
18
-
19
15
  var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
20
16
  _inherits(LayerSwitch, _SelectControl);
21
-
22
17
  var _super = _createSuper(LayerSwitch);
23
-
24
18
  function LayerSwitch() {
25
19
  var _this;
26
-
27
20
  _classCallCheck(this, LayerSwitch);
28
-
29
21
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
22
  args[_key] = arguments[_key];
31
23
  }
32
-
33
24
  _this = _super.call.apply(_super, [this].concat(args));
34
-
35
25
  _defineProperty(_assertThisInitialized(_this), "onLayerChange", function () {
36
26
  var _this$controlOption$l;
37
-
38
27
  if ((_this$controlOption$l = _this.controlOption.layers) !== null && _this$controlOption$l !== void 0 && _this$controlOption$l.length) {
39
28
  return;
40
29
  }
41
-
42
30
  _this.selectValue = _this.getLayerVisible();
43
-
44
31
  _this.setOptions({
45
32
  options: _this.getLayerOptions()
46
33
  });
47
34
  });
48
-
49
35
  _defineProperty(_assertThisInitialized(_this), "onLayerVisibleChane", function () {
50
36
  _this.setSelectValue(_this.getLayerVisible());
51
37
  });
52
-
53
38
  _defineProperty(_assertThisInitialized(_this), "onSelectChange", function () {
54
39
  _this.layers.forEach(function (layer) {
55
40
  var needShow = _this.selectValue.includes(layer.name);
56
-
57
41
  var isShow = layer.isVisible();
58
-
59
42
  if (needShow && !isShow) {
60
43
  layer.show();
61
44
  }
62
-
63
45
  if (!needShow && isShow) {
64
46
  layer.hide();
65
47
  }
66
48
  });
67
49
  });
68
-
69
50
  return _this;
70
51
  }
71
-
72
52
  _createClass(LayerSwitch, [{
73
53
  key: "layers",
74
54
  get: function get() {
75
55
  var layerService = this.layerService;
76
56
  var layers = this.controlOption.layers;
77
-
78
57
  if (Array.isArray(layers) && layers.length) {
79
58
  var layerInstances = [];
80
59
  layers.forEach(function (layer) {
81
60
  if (layer instanceof Object) {
82
61
  layerInstances.push(layer);
83
62
  }
84
-
85
63
  if (typeof layer === 'string') {
86
64
  var targetLayer = layerService.getLayer(layer) || layerService.getLayerByName(layer);
87
-
88
65
  if (targetLayer) {
89
66
  layerInstances.push(targetLayer);
90
67
  }
@@ -92,7 +69,6 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
92
69
  });
93
70
  return layerInstances;
94
71
  }
95
-
96
72
  return layerService.getLayers() || [];
97
73
  }
98
74
  }, {
@@ -127,9 +103,7 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
127
103
  key: "setOptions",
128
104
  value: function setOptions(option) {
129
105
  var isLayerChange = this.checkUpdateOption(option, ['layers']);
130
-
131
106
  _get(_getPrototypeOf(LayerSwitch.prototype), "setOptions", this).call(this, option);
132
-
133
107
  if (isLayerChange) {
134
108
  this.selectValue = this.getLayerVisible();
135
109
  this.controlOption.options = this.getLayerOptions();
@@ -140,15 +114,12 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
140
114
  key: "onAdd",
141
115
  value: function onAdd() {
142
116
  var _this$controlOption$o;
143
-
144
117
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
145
118
  this.controlOption.options = this.getLayerOptions();
146
119
  }
147
-
148
120
  if (!this.controlOption.defaultValue) {
149
121
  this.controlOption.defaultValue = this.getLayerVisible();
150
122
  }
151
-
152
123
  this.on('selectChange', this.onSelectChange);
153
124
  this.layerService.on('layerChange', this.onLayerChange);
154
125
  return _get(_getPrototypeOf(LayerSwitch.prototype), "onAdd", this).call(this);
@@ -165,8 +136,6 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
165
136
  return true;
166
137
  }
167
138
  }]);
168
-
169
139
  return LayerSwitch;
170
140
  }(SelectControl);
171
-
172
141
  export { LayerSwitch as default };
@@ -4,26 +4,18 @@ import _get from "@babel/runtime/helpers/esm/get";
4
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
-
8
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
-
10
8
  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; } }
11
-
12
9
  import { DOM } from '@antv/l7-utils';
13
10
  import { Control, PositionType } from "./baseControl";
14
11
  export { Logo };
15
-
16
12
  var Logo = /*#__PURE__*/function (_Control) {
17
13
  _inherits(Logo, _Control);
18
-
19
14
  var _super = _createSuper(Logo);
20
-
21
15
  function Logo() {
22
16
  _classCallCheck(this, Logo);
23
-
24
17
  return _super.apply(this, arguments);
25
18
  }
26
-
27
19
  _createClass(Logo, [{
28
20
  key: "getDefault",
29
21
  value: function getDefault() {
@@ -50,7 +42,6 @@ var Logo = /*#__PURE__*/function (_Control) {
50
42
  key: "setOptions",
51
43
  value: function setOptions(option) {
52
44
  _get(_getPrototypeOf(Logo.prototype), "setOptions", this).call(this, option);
53
-
54
45
  if (this.checkUpdateOption(option, ['img', 'href'])) {
55
46
  DOM.clearChildren(this.container);
56
47
  this.setLogoContent(this.container);
@@ -60,13 +51,12 @@ var Logo = /*#__PURE__*/function (_Control) {
60
51
  key: "setLogoContent",
61
52
  value: function setLogoContent(container) {
62
53
  var _this$controlOption = this.controlOption,
63
- href = _this$controlOption.href,
64
- img = _this$controlOption.img;
54
+ href = _this$controlOption.href,
55
+ img = _this$controlOption.img;
65
56
  var imgDOM = DOM.create('img');
66
57
  imgDOM.setAttribute('src', img);
67
58
  imgDOM.setAttribute('aria-label', 'AntV logo');
68
59
  DOM.setUnDraggable(imgDOM);
69
-
70
60
  if (href) {
71
61
  var anchorDOM = DOM.create('a', 'l7-control-logo-link');
72
62
  anchorDOM.target = '_blank';
@@ -80,8 +70,6 @@ var Logo = /*#__PURE__*/function (_Control) {
80
70
  }
81
71
  }
82
72
  }]);
83
-
84
73
  return Logo;
85
74
  }(Control);
86
-
87
75
  export { Logo as default };
@@ -8,39 +8,27 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
8
8
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
11
-
12
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
-
14
12
  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; } }
15
-
16
13
  import { GaodeMapStyleConfig, MapboxMapStyleConfig } from "../constants";
17
14
  import { createL7Icon } from "../utils/icon";
18
15
  import SelectControl from "./baseControl/selectControl";
19
16
  export { MapTheme };
20
-
21
17
  var MapTheme = /*#__PURE__*/function (_SelectControl) {
22
18
  _inherits(MapTheme, _SelectControl);
23
-
24
19
  var _super = _createSuper(MapTheme);
25
-
26
20
  function MapTheme() {
27
21
  var _this;
28
-
29
22
  _classCallCheck(this, MapTheme);
30
-
31
23
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
24
  args[_key] = arguments[_key];
33
25
  }
34
-
35
26
  _this = _super.call.apply(_super, [this].concat(args));
36
-
37
27
  _defineProperty(_assertThisInitialized(_this), "onMapThemeChange", function () {
38
28
  _this.mapsService.setMapStyle(_this.selectValue[0]);
39
29
  });
40
-
41
30
  return _this;
42
31
  }
43
-
44
32
  _createClass(MapTheme, [{
45
33
  key: "getDefault",
46
34
  value: function getDefault(option) {
@@ -56,22 +44,18 @@ var MapTheme = /*#__PURE__*/function (_SelectControl) {
56
44
  var mapStyleConfig = this.mapsService.getType() === 'mapbox' ? MapboxMapStyleConfig : GaodeMapStyleConfig;
57
45
  return Object.entries(this.mapsService.getMapStyleConfig()).filter(function (_ref) {
58
46
  var _ref2 = _slicedToArray(_ref, 2),
59
- key = _ref2[0],
60
- value = _ref2[1];
61
-
47
+ key = _ref2[0],
48
+ value = _ref2[1];
62
49
  return typeof value === 'string' && key !== 'blank';
63
50
  }).map(function (_ref3) {
64
51
  var _mapStyleConfig$key;
65
-
66
52
  var _ref4 = _slicedToArray(_ref3, 2),
67
- key = _ref4[0],
68
- value = _ref4[1];
69
-
53
+ key = _ref4[0],
54
+ value = _ref4[1];
70
55
  // @ts-ignore
71
56
  var _ref5 = (_mapStyleConfig$key = mapStyleConfig[key]) !== null && _mapStyleConfig$key !== void 0 ? _mapStyleConfig$key : {},
72
- text = _ref5.text,
73
- img = _ref5.img;
74
-
57
+ text = _ref5.text,
58
+ img = _ref5.img;
75
59
  return {
76
60
  text: text !== null && text !== void 0 ? text : key,
77
61
  value: value,
@@ -89,36 +73,29 @@ var MapTheme = /*#__PURE__*/function (_SelectControl) {
89
73
  key: "onAdd",
90
74
  value: function onAdd() {
91
75
  var _this$controlOption$o,
92
- _this2 = this;
93
-
76
+ _this2 = this;
94
77
  if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
95
78
  this.controlOption.options = this.getStyleOptions();
96
79
  }
97
-
98
80
  if (this.controlOption.defaultValue) {
99
81
  var _this$controlOption$o2, _this$controlOption$o3;
100
-
101
82
  var defaultValue = this.controlOption.defaultValue;
102
83
  this.controlOption.defaultValue = (_this$controlOption$o2 = (_this$controlOption$o3 = this.controlOption.options.find(function (item) {
103
84
  return item.key === defaultValue;
104
85
  })) === null || _this$controlOption$o3 === void 0 ? void 0 : _this$controlOption$o3.value) !== null && _this$controlOption$o2 !== void 0 ? _this$controlOption$o2 : defaultValue;
105
86
  } else {
106
87
  var defaultStyle = this.getMapStyle();
107
-
108
88
  if (defaultStyle) {
109
89
  this.controlOption.defaultValue = defaultStyle;
110
90
  } else {
111
91
  // @ts-ignore
112
92
  this.mapsService.map.once('styledata', function () {
113
93
  var mapboxStyle = _this2.mapsService.getMapStyle();
114
-
115
94
  _this2.controlOption.defaultValue = mapboxStyle;
116
-
117
95
  _this2.setSelectValue(mapboxStyle, false);
118
96
  });
119
97
  }
120
98
  }
121
-
122
99
  this.on('selectChange', this.onMapThemeChange);
123
100
  return _get(_getPrototypeOf(MapTheme.prototype), "onAdd", this).call(this);
124
101
  }
@@ -128,8 +105,6 @@ var MapTheme = /*#__PURE__*/function (_SelectControl) {
128
105
  return false;
129
106
  }
130
107
  }]);
131
-
132
108
  return MapTheme;
133
109
  }(SelectControl);
134
-
135
110
  export { MapTheme as default };