@antv/l7-component 2.17.4 → 2.17.5

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,77 +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.Popup = 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 _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
16
  var _l7Core = require("@antv/l7-core");
27
-
28
17
  var _l7Utils = require("@antv/l7-utils");
29
-
30
18
  var _eventemitter = require("eventemitter3");
31
-
32
19
  var _icon = require("../utils/icon");
33
-
34
20
  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); }; }
35
-
36
21
  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; } }
37
-
38
22
  var Popup = /*#__PURE__*/function (_EventEmitter) {
39
23
  (0, _inherits2.default)(Popup, _EventEmitter);
40
-
41
24
  var _super = _createSuper(Popup);
42
-
43
25
  function Popup(cfg) {
44
26
  var _this;
45
-
46
27
  (0, _classCallCheck2.default)(this, Popup);
47
28
  _this = _super.call(this);
48
29
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isShow", true);
49
30
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseMove", function (e) {
50
31
  var _container$getBoundin;
51
-
52
32
  var container = _this.mapsService.getMapContainer();
53
-
54
33
  var _ref = (_container$getBoundin = container === null || container === void 0 ? void 0 : container.getBoundingClientRect()) !== null && _container$getBoundin !== void 0 ? _container$getBoundin : {},
55
- _ref$left = _ref.left,
56
- left = _ref$left === void 0 ? 0 : _ref$left,
57
- _ref$top = _ref.top,
58
- top = _ref$top === void 0 ? 0 : _ref$top;
59
-
34
+ _ref$left = _ref.left,
35
+ left = _ref$left === void 0 ? 0 : _ref$left,
36
+ _ref$top = _ref.top,
37
+ top = _ref$top === void 0 ? 0 : _ref$top;
60
38
  _this.setPopupPosition(e.clientX - left, e.clientY - top);
61
39
  });
62
40
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateLngLatPosition", function () {
63
41
  if (!_this.mapsService || _this.popupOption.followCursor) {
64
42
  return;
65
43
  }
66
-
67
44
  var _this$lngLat = _this.lngLat,
68
- lng = _this$lngLat.lng,
69
- lat = _this$lngLat.lat;
70
-
45
+ lng = _this$lngLat.lng,
46
+ lat = _this$lngLat.lat;
71
47
  var _this$mapsService$lng = _this.mapsService.lngLatToContainer([lng, lat]),
72
- x = _this$mapsService$lng.x,
73
- y = _this$mapsService$lng.y;
74
-
48
+ x = _this$mapsService$lng.x,
49
+ y = _this$mapsService$lng.y;
75
50
  _this.setPopupPosition(x, y);
76
51
  });
77
52
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (e) {
@@ -83,37 +58,30 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
83
58
  if (e.stopPropagation) {
84
59
  e.stopPropagation();
85
60
  }
86
-
87
61
  _this.hide();
88
62
  });
89
63
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "update", function () {
90
64
  var hasPosition = !!_this.lngLat;
91
65
  var _this$popupOption = _this.popupOption,
92
- className = _this$popupOption.className,
93
- style = _this$popupOption.style,
94
- maxWidth = _this$popupOption.maxWidth,
95
- anchor = _this$popupOption.anchor,
96
- stopPropagation = _this$popupOption.stopPropagation;
97
-
66
+ className = _this$popupOption.className,
67
+ style = _this$popupOption.style,
68
+ maxWidth = _this$popupOption.maxWidth,
69
+ anchor = _this$popupOption.anchor,
70
+ stopPropagation = _this$popupOption.stopPropagation;
98
71
  if (!_this.mapsService || !hasPosition || !_this.content) {
99
72
  return;
100
73
  }
101
-
102
- var popupContainer = _this.mapsService.getMarkerContainer(); // 如果当前没有创建 Popup 容器则创建
103
-
104
-
74
+ var popupContainer = _this.mapsService.getMarkerContainer();
75
+ // 如果当前没有创建 Popup 容器则创建
105
76
  if (!_this.container && popupContainer) {
106
77
  _this.container = _l7Utils.DOM.create('div', "l7-popup ".concat(className !== null && className !== void 0 ? className : '', " ").concat(!_this.isShow ? 'l7-popup-hide' : ''), popupContainer);
107
-
108
78
  if (style) {
109
79
  _this.container.setAttribute('style', style);
110
80
  }
111
-
112
81
  _this.tip = _l7Utils.DOM.create('div', 'l7-popup-tip', _this.container);
82
+ _this.container.appendChild(_this.content);
113
83
 
114
- _this.container.appendChild(_this.content); // 高德地图需要阻止事件冒泡 // 测试mapbox 地图不需要添加
115
-
116
-
84
+ // 高德地图需要阻止事件冒泡 // 测试mapbox 地图不需要添加
117
85
  if (stopPropagation) {
118
86
  ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(function (type) {
119
87
  _this.container.addEventListener(type, function (e) {
@@ -121,20 +89,14 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
121
89
  });
122
90
  });
123
91
  }
124
-
125
92
  _this.container.style.whiteSpace = 'nowrap';
126
93
  }
127
-
128
94
  _this.updateLngLatPosition();
129
-
130
95
  _l7Utils.DOM.setTransform(_this.container, "".concat(_l7Utils.anchorTranslate[anchor]));
131
-
132
96
  (0, _l7Utils.applyAnchorClass)(_this.container, anchor, 'popup');
133
-
134
97
  if (maxWidth) {
135
98
  var _this$container$getBo = _this.container.getBoundingClientRect(),
136
- width = _this$container$getBo.width;
137
-
99
+ width = _this$container$getBo.width;
138
100
  if (width > parseFloat(maxWidth)) {
139
101
  _this.container.style.width = maxWidth;
140
102
  }
@@ -144,14 +106,11 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
144
106
  });
145
107
  _this.popupOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _this.getDefault(cfg !== null && cfg !== void 0 ? cfg : {})), cfg);
146
108
  var lngLat = _this.popupOption.lngLat;
147
-
148
109
  if (lngLat) {
149
110
  _this.lngLat = lngLat;
150
111
  }
151
-
152
112
  return _this;
153
113
  }
154
-
155
114
  (0, _createClass2.default)(Popup, [{
156
115
  key: "lngLat",
157
116
  get:
@@ -194,9 +153,9 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
194
153
  * 当前是否展示
195
154
  * @protected
196
155
  */
156
+
197
157
  function get() {
198
158
  var _this$popupOption$lng;
199
-
200
159
  return (_this$popupOption$lng = this.popupOption.lngLat) !== null && _this$popupOption$lng !== void 0 ? _this$popupOption$lng : {
201
160
  lng: 0,
202
161
  lat: 0
@@ -219,66 +178,59 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
219
178
  this.mapsService.on('camerachange', this.update);
220
179
  this.mapsService.on('viewchange', this.update);
221
180
  this.scene = scene;
222
- this.update(); // 临时关闭
223
-
181
+ this.update();
182
+ // 临时关闭
224
183
  this.updateCloseOnClick();
225
184
  this.updateCloseOnEsc();
226
185
  this.updateFollowCursor();
227
186
  var _this$popupOption2 = this.popupOption,
228
- html = _this$popupOption2.html,
229
- text = _this$popupOption2.text,
230
- title = _this$popupOption2.title;
231
-
187
+ html = _this$popupOption2.html,
188
+ text = _this$popupOption2.text,
189
+ title = _this$popupOption2.title;
232
190
  if (html) {
233
191
  this.setHTML(html);
234
192
  } else if (text) {
235
193
  this.setText(text);
236
194
  }
237
-
238
195
  if (title) {
239
196
  this.setTitle(title);
240
197
  }
241
-
242
198
  this.emit('open');
243
199
  return this;
244
- } // 移除popup
200
+ }
245
201
 
202
+ // 移除popup
246
203
  }, {
247
204
  key: "remove",
248
205
  value: function remove() {
249
206
  if (!(this !== null && this !== void 0 && this.isOpen())) {
250
207
  return;
251
208
  }
252
-
253
209
  if (this.content) {
254
210
  _l7Utils.DOM.remove(this.content);
255
211
  }
256
-
257
212
  if (this.container) {
258
- _l7Utils.DOM.remove(this.container); // @ts-ignore
259
-
260
-
213
+ _l7Utils.DOM.remove(this.container);
214
+ // @ts-ignore
261
215
  delete this.container;
262
216
  }
263
-
264
217
  if (this.mapsService) {
265
218
  // TODO: mapbox AMap 事件同步
266
219
  this.mapsService.off('camerachange', this.update);
267
220
  this.mapsService.off('viewchange', this.update);
268
221
  this.updateCloseOnClick(true);
269
222
  this.updateCloseOnEsc(true);
270
- this.updateFollowCursor(true); // @ts-ignore
271
-
223
+ this.updateFollowCursor(true);
224
+ // @ts-ignore
272
225
  delete this.mapsService;
273
226
  }
274
-
275
227
  this.emit('close');
276
228
  return this;
277
229
  }
230
+
278
231
  /**
279
232
  * 获取 option 配置
280
233
  */
281
-
282
234
  }, {
283
235
  key: "getOptions",
284
236
  value: function getOptions() {
@@ -289,48 +241,38 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
289
241
  value: function setOptions(option) {
290
242
  this.show();
291
243
  this.popupOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.popupOption), option);
292
-
293
244
  if (this.checkUpdateOption(option, ['html', 'text', 'title', 'closeButton', 'closeButtonOffsets', 'maxWidth', 'anchor', 'stopPropagation', 'className', 'style', 'lngLat', 'offsets'])) {
294
245
  if (this.container) {
295
- _l7Utils.DOM.remove(this.container); // @ts-ignore
296
-
297
-
246
+ _l7Utils.DOM.remove(this.container);
247
+ // @ts-ignore
298
248
  this.container = undefined;
299
249
  }
300
-
301
250
  if (this.popupOption.html) {
302
251
  this.setHTML(this.popupOption.html);
303
252
  } else if (this.popupOption.text) {
304
253
  this.setText(this.popupOption.text);
305
254
  }
306
-
307
255
  if (this.popupOption.title) {
308
256
  this.setTitle(this.popupOption.title);
309
257
  }
310
258
  }
311
-
312
259
  if (this.checkUpdateOption(option, ['closeOnEsc'])) {
313
260
  this.updateCloseOnEsc();
314
261
  }
315
-
316
262
  if (this.checkUpdateOption(option, ['closeOnClick'])) {
317
263
  this.updateCloseOnClick();
318
264
  }
319
-
320
265
  if (this.checkUpdateOption(option, ['followCursor'])) {
321
266
  this.updateFollowCursor();
322
267
  }
323
-
324
268
  if (this.checkUpdateOption(option, ['html']) && option.html) {
325
269
  this.setHTML(option.html);
326
270
  } else if (this.checkUpdateOption(option, ['text']) && option.text) {
327
271
  this.setText(option.text);
328
272
  }
329
-
330
273
  if (this.checkUpdateOption(option, ['lngLat']) && option.lngLat) {
331
274
  this.setLnglat(option.lngLat);
332
275
  }
333
-
334
276
  return this;
335
277
  }
336
278
  }, {
@@ -351,11 +293,9 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
351
293
  if (this.isShow) {
352
294
  return;
353
295
  }
354
-
355
296
  if (this.container) {
356
297
  _l7Utils.DOM.removeClass(this.container, 'l7-popup-hide');
357
298
  }
358
-
359
299
  this.isShow = true;
360
300
  this.emit('show');
361
301
  return this;
@@ -366,31 +306,29 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
366
306
  if (!this.isShow) {
367
307
  return;
368
308
  }
369
-
370
309
  if (this.container) {
371
310
  _l7Utils.DOM.addClass(this.container, 'l7-popup-hide');
372
311
  }
373
-
374
312
  this.isShow = false;
375
313
  this.emit('hide');
376
314
  return this;
377
315
  }
316
+
378
317
  /**
379
318
  * 设置 HTML 内容
380
319
  * @param html
381
320
  */
382
-
383
321
  }, {
384
322
  key: "setHTML",
385
323
  value: function setHTML(html) {
386
324
  this.popupOption.html = html;
387
325
  return this.setDOMContent(html);
388
326
  }
327
+
389
328
  /**
390
329
  * 设置 Popup 展示文本
391
330
  * @param text
392
331
  */
393
-
394
332
  }, {
395
333
  key: "setText",
396
334
  value: function setText(text) {
@@ -402,42 +340,35 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
402
340
  value: function setTitle(title) {
403
341
  this.show();
404
342
  this.popupOption.title = title;
405
-
406
343
  if (title) {
407
344
  if (!this.contentTitle) {
408
345
  this.contentTitle = _l7Utils.DOM.create('div', 'l7-popup-content__title');
409
-
410
346
  if (this.content.firstChild) {
411
347
  this.content.insertBefore(this.contentTitle, this.content.firstChild);
412
348
  } else {
413
349
  this.content.append(this.contentTitle);
414
350
  }
415
351
  }
416
-
417
352
  _l7Utils.DOM.clearChildren(this.contentTitle);
418
-
419
353
  _l7Utils.DOM.appendElementType(this.contentTitle, title);
420
354
  } else if (this.contentTitle) {
421
355
  _l7Utils.DOM.remove(this.contentTitle);
422
-
423
356
  this.contentTitle = undefined;
424
357
  }
425
358
  }
359
+
426
360
  /**
427
361
  * 将地图自动平移到气泡位置
428
362
  */
429
-
430
363
  }, {
431
364
  key: "panToPopup",
432
365
  value: function panToPopup() {
433
366
  var _this$lngLat2 = this.lngLat,
434
- lng = _this$lngLat2.lng,
435
- lat = _this$lngLat2.lat;
436
-
367
+ lng = _this$lngLat2.lng,
368
+ lat = _this$lngLat2.lat;
437
369
  if (this.popupOption.autoPan) {
438
370
  this.mapsService.panTo([lng, lat]);
439
371
  }
440
-
441
372
  return this;
442
373
  }
443
374
  }, {
@@ -445,26 +376,23 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
445
376
  value: function setLngLat(lngLat) {
446
377
  return this.setLnglat(lngLat);
447
378
  }
379
+
448
380
  /**
449
381
  * 设置 Popup 所在经纬度
450
382
  * @param lngLat
451
383
  */
452
-
453
384
  }, {
454
385
  key: "setLnglat",
455
386
  value: function setLnglat(lngLat) {
456
387
  var _this2 = this;
457
-
458
388
  this.show();
459
389
  this.lngLat = lngLat;
460
-
461
390
  if (Array.isArray(lngLat)) {
462
391
  this.lngLat = {
463
392
  lng: lngLat[0],
464
393
  lat: lngLat[1]
465
394
  };
466
395
  }
467
-
468
396
  if (this.mapsService) {
469
397
  // 防止事件重复监听
470
398
  this.mapsService.off('camerachange', this.update);
@@ -472,31 +400,28 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
472
400
  this.mapsService.on('camerachange', this.update);
473
401
  this.mapsService.on('viewchange', this.update);
474
402
  }
475
-
476
403
  this.update();
477
-
478
404
  if (this.popupOption.autoPan) {
479
405
  setTimeout(function () {
480
406
  _this2.panToPopup();
481
407
  }, 0);
482
408
  }
483
-
484
409
  return this;
485
410
  }
411
+
486
412
  /**
487
413
  * 获取 Popup 所在经纬度
488
414
  */
489
-
490
415
  }, {
491
416
  key: "getLnglat",
492
417
  value: function getLnglat() {
493
418
  return this.lngLat;
494
419
  }
420
+
495
421
  /**
496
422
  * 设置 Popup 最大宽度
497
423
  * @param maxWidth
498
424
  */
499
-
500
425
  }, {
501
426
  key: "setMaxWidth",
502
427
  value: function setMaxWidth(maxWidth) {
@@ -511,7 +436,8 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
511
436
  }
512
437
  }, {
513
438
  key: "getDefault",
514
- value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
439
+ value:
440
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
515
441
  function getDefault(option) {
516
442
  // tslint:disable-next-line:no-object-literal-type-assertion
517
443
  return {
@@ -527,37 +453,32 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
527
453
  followCursor: false
528
454
  };
529
455
  }
456
+
530
457
  /**
531
458
  * 设置 Popup 内容 HTML
532
459
  * @param element
533
460
  */
534
-
535
461
  }, {
536
462
  key: "setDOMContent",
537
463
  value: function setDOMContent(element) {
538
464
  this.show();
539
465
  this.createContent();
540
-
541
466
  _l7Utils.DOM.appendElementType(this.contentPanel, element);
542
-
543
467
  this.update();
544
468
  return this;
545
469
  }
470
+
546
471
  /**
547
472
  * 绑定地图点击事件触发销毁 Popup
548
473
  * @protected
549
474
  */
550
-
551
475
  }, {
552
476
  key: "updateCloseOnClick",
553
477
  value: function updateCloseOnClick(onlyClear) {
554
478
  var _this3 = this;
555
-
556
479
  var mapsService = this.mapsService;
557
-
558
480
  if (mapsService) {
559
481
  mapsService === null || mapsService === void 0 ? void 0 : mapsService.off('click', this.onCloseButtonClick);
560
-
561
482
  if (this.popupOption.closeOnClick && !onlyClear) {
562
483
  requestAnimationFrame(function () {
563
484
  mapsService === null || mapsService === void 0 ? void 0 : mapsService.on('click', _this3.onCloseButtonClick);
@@ -569,7 +490,6 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
569
490
  key: "updateCloseOnEsc",
570
491
  value: function updateCloseOnEsc(onlyClear) {
571
492
  window.removeEventListener('keydown', this.onKeyDown);
572
-
573
493
  if (this.popupOption.closeOnEsc && !onlyClear) {
574
494
  window.addEventListener('keydown', this.onKeyDown);
575
495
  }
@@ -578,12 +498,9 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
578
498
  key: "updateFollowCursor",
579
499
  value: function updateFollowCursor(onlyClear) {
580
500
  var _this$mapsService;
581
-
582
501
  var container = (_this$mapsService = this.mapsService) === null || _this$mapsService === void 0 ? void 0 : _this$mapsService.getContainer();
583
-
584
502
  if (container) {
585
503
  container === null || container === void 0 ? void 0 : container.removeEventListener('mousemove', this.onMouseMove);
586
-
587
504
  if (this.popupOption.followCursor && !onlyClear) {
588
505
  container === null || container === void 0 ? void 0 : container.addEventListener('mousemove', this.onMouseMove);
589
506
  }
@@ -598,29 +515,23 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
598
515
  */
599
516
  function createContent() {
600
517
  var _this4 = this;
601
-
602
518
  if (this.content) {
603
519
  _l7Utils.DOM.remove(this.content);
604
520
  }
605
-
606
521
  this.contentTitle = undefined;
607
522
  this.content = _l7Utils.DOM.create('div', 'l7-popup-content', this.container);
608
523
  this.setTitle(this.popupOption.title);
609
-
610
524
  if (this.popupOption.closeButton) {
611
525
  var closeButton = (0, _icon.createL7Icon)('l7-icon-guanbi');
612
-
613
526
  _l7Utils.DOM.addClass(closeButton, 'l7-popup-close-button');
614
-
615
527
  this.content.appendChild(closeButton);
616
-
617
528
  if (this.popupOption.closeButtonOffsets) {
618
529
  // 关闭按钮的偏移
619
530
  closeButton.style.right = this.popupOption.closeButtonOffsets[0] + 'px';
620
531
  closeButton.style.top = this.popupOption.closeButtonOffsets[1] + 'px';
621
- } // this.closeButton.type = 'button';
622
-
532
+ }
623
533
 
534
+ // this.closeButton.type = 'button';
624
535
  closeButton.setAttribute('aria-label', 'Close popup');
625
536
  closeButton.addEventListener('click', function () {
626
537
  _this4.hide();
@@ -629,7 +540,6 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
629
540
  } else {
630
541
  this.closeButton = undefined;
631
542
  }
632
-
633
543
  this.contentPanel = _l7Utils.DOM.create('div', 'l7-popup-content__panel', this.content);
634
544
  }
635
545
  }, {
@@ -648,13 +558,13 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
648
558
  this.container.style.top = top - offsets[1] + 'px';
649
559
  }
650
560
  }
561
+
651
562
  /**
652
563
  * 检查当前传入 option 是否包含 keys 字段
653
564
  * @param option
654
565
  * @param keys
655
566
  * @protected
656
567
  */
657
-
658
568
  }, {
659
569
  key: "checkUpdateOption",
660
570
  value: function checkUpdateOption(option, keys) {
@@ -665,5 +575,4 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
665
575
  }]);
666
576
  return Popup;
667
577
  }(_eventemitter.EventEmitter);
668
-
669
578
  exports.default = exports.Popup = Popup;
@@ -5,10 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.anchorType = exports.anchorTranslate = void 0;
7
7
  exports.applyAnchorClass = applyAnchorClass;
8
- var anchorType;
9
- exports.anchorType = anchorType;
10
-
11
- (function (anchorType) {
8
+ var anchorType = /*#__PURE__*/function (anchorType) {
12
9
  anchorType["CENTER"] = "center";
13
10
  anchorType["TOP"] = "top";
14
11
  anchorType["TOP-LEFT"] = "top-left";
@@ -17,8 +14,9 @@ exports.anchorType = anchorType;
17
14
  anchorType["BOTTOM-LEFT"] = "bottom-left";
18
15
  anchorType["LEFT"] = "left";
19
16
  anchorType["RIGHT"] = "right";
20
- })(anchorType || (exports.anchorType = anchorType = {}));
21
-
17
+ return anchorType;
18
+ }({});
19
+ exports.anchorType = anchorType;
22
20
  var anchorTranslate = {
23
21
  center: 'translate(-50%,-50%)',
24
22
  top: 'translate(-50%,0)',
@@ -31,15 +29,12 @@ var anchorTranslate = {
31
29
  right: 'translate(-100%,-50%)'
32
30
  };
33
31
  exports.anchorTranslate = anchorTranslate;
34
-
35
32
  function applyAnchorClass(element, anchor, prefix) {
36
33
  var classList = element.classList;
37
-
38
34
  for (var key in anchorTranslate) {
39
35
  if (anchorTranslate.hasOwnProperty(key)) {
40
36
  classList.remove("l7-".concat(prefix, "-anchor-").concat(key));
41
37
  }
42
38
  }
43
-
44
39
  classList.add("l7-".concat(prefix, "-anchor-").concat(anchor));
45
40
  }
package/lib/utils/icon.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createL7Icon = void 0;
7
-
8
7
  var createL7Icon = function createL7Icon(className) {
9
8
  var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
10
9
  svg.classList.add('l7-iconfont');
@@ -14,5 +13,4 @@ var createL7Icon = function createL7Icon(className) {
14
13
  svg.appendChild(use);
15
14
  return svg;
16
15
  };
17
-
18
16
  exports.createL7Icon = createL7Icon;