@antv/l7-component 2.17.12 → 2.18.2

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 (114) hide show
  1. package/package.json +6 -7
  2. package/es/assets/iconfont/iconfont.js +0 -46
  3. package/es/constants/index.d.ts +0 -60
  4. package/es/constants/index.js +0 -60
  5. package/es/control/baseControl/buttonControl.d.ts +0 -59
  6. package/es/control/baseControl/buttonControl.js +0 -177
  7. package/es/control/baseControl/control.d.ts +0 -112
  8. package/es/control/baseControl/control.js +0 -302
  9. package/es/control/baseControl/index.d.ts +0 -4
  10. package/es/control/baseControl/index.js +0 -4
  11. package/es/control/baseControl/popperControl.d.ts +0 -26
  12. package/es/control/baseControl/popperControl.js +0 -120
  13. package/es/control/baseControl/selectControl.d.ts +0 -46
  14. package/es/control/baseControl/selectControl.js +0 -204
  15. package/es/control/exportImage.d.ts +0 -18
  16. package/es/control/exportImage.js +0 -159
  17. package/es/control/fullscreen.d.ts +0 -19
  18. package/es/control/fullscreen.js +0 -119
  19. package/es/control/geoLocate.d.ts +0 -16
  20. package/es/control/geoLocate.js +0 -108
  21. package/es/control/layerSwitch.d.ts +0 -19
  22. package/es/control/layerSwitch.js +0 -141
  23. package/es/control/logo.d.ts +0 -13
  24. package/es/control/logo.js +0 -75
  25. package/es/control/mapTheme.d.ts +0 -10
  26. package/es/control/mapTheme.js +0 -110
  27. package/es/control/mouseLocation.d.ts +0 -15
  28. package/es/control/mouseLocation.js +0 -83
  29. package/es/control/scale.d.ts +0 -34
  30. package/es/control/scale.js +0 -149
  31. package/es/control/zoom.d.ts +0 -38
  32. package/es/control/zoom.js +0 -132
  33. package/es/css/button.less +0 -70
  34. package/es/css/control.less +0 -71
  35. package/es/css/index.css +0 -594
  36. package/es/css/index.less +0 -12
  37. package/es/css/l7.less +0 -60
  38. package/es/css/layerPopup.less +0 -8
  39. package/es/css/logo.less +0 -18
  40. package/es/css/mouseLocation.less +0 -9
  41. package/es/css/popper.less +0 -64
  42. package/es/css/popup.less +0 -185
  43. package/es/css/scale.less +0 -34
  44. package/es/css/select.less +0 -86
  45. package/es/css/variables.less +0 -28
  46. package/es/css/zoom.less +0 -29
  47. package/es/images/layers.png +0 -0
  48. package/es/images/layers.svg +0 -1
  49. package/es/images/logo.png +0 -0
  50. package/es/images/quanping.svg +0 -12
  51. package/es/index.d.ts +0 -18
  52. package/es/index.js +0 -49
  53. package/es/interface.d.ts +0 -18
  54. package/es/interface.js +0 -1
  55. package/es/marker-layer.d.ts +0 -54
  56. package/es/marker-layer.js +0 -343
  57. package/es/marker.d.ts +0 -55
  58. package/es/marker.js +0 -410
  59. package/es/popup/layerPopup.d.ts +0 -86
  60. package/es/popup/layerPopup.js +0 -312
  61. package/es/popup/popup.d.ts +0 -139
  62. package/es/popup/popup.js +0 -567
  63. package/es/utils/anchor.d.ts +0 -22
  64. package/es/utils/anchor.js +0 -31
  65. package/es/utils/icon.d.ts +0 -1
  66. package/es/utils/icon.js +0 -9
  67. package/es/utils/popper.d.ts +0 -75
  68. package/es/utils/popper.js +0 -259
  69. package/es/utils/screenfull.d.ts +0 -2
  70. package/es/utils/screenfull.js +0 -128
  71. package/lib/assets/iconfont/iconfont.js +0 -48
  72. package/lib/constants/index.js +0 -68
  73. package/lib/control/baseControl/buttonControl.js +0 -183
  74. package/lib/control/baseControl/control.js +0 -314
  75. package/lib/control/baseControl/index.js +0 -39
  76. package/lib/control/baseControl/popperControl.js +0 -126
  77. package/lib/control/baseControl/selectControl.js +0 -210
  78. package/lib/control/exportImage.js +0 -165
  79. package/lib/control/fullscreen.js +0 -125
  80. package/lib/control/geoLocate.js +0 -114
  81. package/lib/control/layerSwitch.js +0 -147
  82. package/lib/control/logo.js +0 -81
  83. package/lib/control/mapTheme.js +0 -116
  84. package/lib/control/mouseLocation.js +0 -89
  85. package/lib/control/scale.js +0 -155
  86. package/lib/control/zoom.js +0 -138
  87. package/lib/css/button.less +0 -70
  88. package/lib/css/control.less +0 -71
  89. package/lib/css/index.css +0 -594
  90. package/lib/css/index.less +0 -12
  91. package/lib/css/l7.less +0 -60
  92. package/lib/css/layerPopup.less +0 -8
  93. package/lib/css/logo.less +0 -18
  94. package/lib/css/mouseLocation.less +0 -9
  95. package/lib/css/popper.less +0 -64
  96. package/lib/css/popup.less +0 -185
  97. package/lib/css/scale.less +0 -34
  98. package/lib/css/select.less +0 -86
  99. package/lib/css/variables.less +0 -28
  100. package/lib/css/zoom.less +0 -29
  101. package/lib/images/layers.png +0 -0
  102. package/lib/images/layers.svg +0 -1
  103. package/lib/images/logo.png +0 -0
  104. package/lib/images/quanping.svg +0 -12
  105. package/lib/index.js +0 -169
  106. package/lib/interface.js +0 -5
  107. package/lib/marker-layer.js +0 -349
  108. package/lib/marker.js +0 -417
  109. package/lib/popup/layerPopup.js +0 -317
  110. package/lib/popup/popup.js +0 -573
  111. package/lib/utils/anchor.js +0 -40
  112. package/lib/utils/icon.js +0 -16
  113. package/lib/utils/popper.js +0 -263
  114. package/lib/utils/screenfull.js +0 -136
package/es/popup/popup.js DELETED
@@ -1,567 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
- 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); }; }
10
- 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
- import { TYPES } from '@antv/l7-core';
12
- import { anchorTranslate, anchorType, applyAnchorClass, DOM } from '@antv/l7-utils';
13
- import { EventEmitter } from 'eventemitter3';
14
- import { createL7Icon } from "../utils/icon";
15
- export { Popup };
16
- var Popup = /*#__PURE__*/function (_EventEmitter) {
17
- _inherits(Popup, _EventEmitter);
18
- var _super = _createSuper(Popup);
19
- function Popup(cfg) {
20
- var _this;
21
- _classCallCheck(this, Popup);
22
- _this = _super.call(this);
23
- /**
24
- * 配置
25
- * @protected
26
- */
27
- /**
28
- * 关闭按钮对应的 DOM
29
- * @protected
30
- */
31
- /**
32
- * Popup 的总容器 DOM,包含 content 和 tip
33
- * @protected
34
- */
35
- /**
36
- * popup 气泡容器
37
- * @protected
38
- */
39
- /**
40
- * popup 气泡标题
41
- * @protected
42
- */
43
- /**
44
- * popup 内容容器
45
- * @protected
46
- */
47
- /**
48
- * 气泡箭头对应的 DOM
49
- * @protected
50
- */
51
- /**
52
- * 当前是否展示
53
- * @protected
54
- */
55
- _defineProperty(_assertThisInitialized(_this), "isShow", true);
56
- _defineProperty(_assertThisInitialized(_this), "onMouseMove", function (e) {
57
- var _container$getBoundin;
58
- var container = _this.mapsService.getMapContainer();
59
- var _ref = (_container$getBoundin = container === null || container === void 0 ? void 0 : container.getBoundingClientRect()) !== null && _container$getBoundin !== void 0 ? _container$getBoundin : {},
60
- _ref$left = _ref.left,
61
- left = _ref$left === void 0 ? 0 : _ref$left,
62
- _ref$top = _ref.top,
63
- top = _ref$top === void 0 ? 0 : _ref$top;
64
- _this.setPopupPosition(e.clientX - left, e.clientY - top);
65
- });
66
- /**
67
- * 将经纬度转换成对应的像素偏移位置
68
- * @protected
69
- */
70
- _defineProperty(_assertThisInitialized(_this), "updateLngLatPosition", function () {
71
- if (!_this.mapsService || _this.popupOption.followCursor) {
72
- return;
73
- }
74
- var _this$lngLat = _this.lngLat,
75
- lng = _this$lngLat.lng,
76
- lat = _this$lngLat.lat;
77
- var _this$mapsService$lng = _this.mapsService.lngLatToContainer([lng, lat]),
78
- x = _this$mapsService$lng.x,
79
- y = _this$mapsService$lng.y;
80
- _this.setPopupPosition(x, y);
81
- });
82
- _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (e) {
83
- if (e.keyCode === 27) {
84
- _this.remove();
85
- }
86
- });
87
- _defineProperty(_assertThisInitialized(_this), "onCloseButtonClick", function (e) {
88
- if (e.stopPropagation) {
89
- e.stopPropagation();
90
- }
91
- _this.hide();
92
- });
93
- _defineProperty(_assertThisInitialized(_this), "update", function () {
94
- var hasPosition = !!_this.lngLat;
95
- var _this$popupOption = _this.popupOption,
96
- className = _this$popupOption.className,
97
- style = _this$popupOption.style,
98
- maxWidth = _this$popupOption.maxWidth,
99
- anchor = _this$popupOption.anchor,
100
- stopPropagation = _this$popupOption.stopPropagation;
101
- if (!_this.mapsService || !hasPosition || !_this.content) {
102
- return;
103
- }
104
- var popupContainer = _this.mapsService.getMarkerContainer();
105
- // 如果当前没有创建 Popup 容器则创建
106
- if (!_this.container && popupContainer) {
107
- _this.container = DOM.create('div', "l7-popup ".concat(className !== null && className !== void 0 ? className : '', " ").concat(!_this.isShow ? 'l7-popup-hide' : ''), popupContainer);
108
- if (style) {
109
- _this.container.setAttribute('style', style);
110
- }
111
- _this.tip = DOM.create('div', 'l7-popup-tip', _this.container);
112
- _this.container.appendChild(_this.content);
113
-
114
- // 高德地图需要阻止事件冒泡 // 测试mapbox 地图不需要添加
115
- if (stopPropagation) {
116
- ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(function (type) {
117
- _this.container.addEventListener(type, function (e) {
118
- e.stopPropagation();
119
- });
120
- });
121
- }
122
- _this.container.style.whiteSpace = 'nowrap';
123
- }
124
- _this.updateLngLatPosition();
125
- DOM.setTransform(_this.container, "".concat(anchorTranslate[anchor]));
126
- applyAnchorClass(_this.container, anchor, 'popup');
127
- if (maxWidth) {
128
- var _this$container$getBo = _this.container.getBoundingClientRect(),
129
- width = _this$container$getBo.width;
130
- if (width > parseFloat(maxWidth)) {
131
- _this.container.style.width = maxWidth;
132
- }
133
- } else {
134
- _this.container.style.removeProperty('width');
135
- }
136
- });
137
- _this.popupOption = _objectSpread(_objectSpread({}, _this.getDefault(cfg !== null && cfg !== void 0 ? cfg : {})), cfg);
138
- var lngLat = _this.popupOption.lngLat;
139
- if (lngLat) {
140
- _this.lngLat = lngLat;
141
- }
142
- return _this;
143
- }
144
- _createClass(Popup, [{
145
- key: "lngLat",
146
- get: function get() {
147
- var _this$popupOption$lng;
148
- return (_this$popupOption$lng = this.popupOption.lngLat) !== null && _this$popupOption$lng !== void 0 ? _this$popupOption$lng : {
149
- lng: 0,
150
- lat: 0
151
- };
152
- },
153
- set: function set(newLngLat) {
154
- this.popupOption.lngLat = newLngLat;
155
- }
156
- }, {
157
- key: "getIsShow",
158
- value: function getIsShow() {
159
- return this.isShow;
160
- }
161
- }, {
162
- key: "addTo",
163
- value: function addTo(scene) {
164
- this.mapsService = scene.get(TYPES.IMapService);
165
- this.sceneService = scene.get(TYPES.ISceneService);
166
- this.layerService = scene.get(TYPES.ILayerService);
167
- this.mapsService.on('camerachange', this.update);
168
- this.mapsService.on('viewchange', this.update);
169
- this.scene = scene;
170
- this.update();
171
- // 临时关闭
172
- this.updateCloseOnClick();
173
- this.updateCloseOnEsc();
174
- this.updateFollowCursor();
175
- var _this$popupOption2 = this.popupOption,
176
- html = _this$popupOption2.html,
177
- text = _this$popupOption2.text,
178
- title = _this$popupOption2.title;
179
- if (html) {
180
- this.setHTML(html);
181
- } else if (text) {
182
- this.setText(text);
183
- }
184
- if (title) {
185
- this.setTitle(title);
186
- }
187
- this.emit('open');
188
- return this;
189
- }
190
-
191
- // 移除popup
192
- }, {
193
- key: "remove",
194
- value: function remove() {
195
- if (!(this !== null && this !== void 0 && this.isOpen())) {
196
- return;
197
- }
198
- if (this.content) {
199
- DOM.remove(this.content);
200
- }
201
- if (this.container) {
202
- DOM.remove(this.container);
203
- // @ts-ignore
204
- delete this.container;
205
- }
206
- if (this.mapsService) {
207
- // TODO: mapbox AMap 事件同步
208
- this.mapsService.off('camerachange', this.update);
209
- this.mapsService.off('viewchange', this.update);
210
- this.updateCloseOnClick(true);
211
- this.updateCloseOnEsc(true);
212
- this.updateFollowCursor(true);
213
- // @ts-ignore
214
- delete this.mapsService;
215
- }
216
- this.emit('close');
217
- return this;
218
- }
219
-
220
- /**
221
- * 获取 option 配置
222
- */
223
- }, {
224
- key: "getOptions",
225
- value: function getOptions() {
226
- return this.popupOption;
227
- }
228
- }, {
229
- key: "setOptions",
230
- value: function setOptions(option) {
231
- this.show();
232
- this.popupOption = _objectSpread(_objectSpread({}, this.popupOption), option);
233
- if (this.checkUpdateOption(option, ['html', 'text', 'title', 'closeButton', 'closeButtonOffsets', 'maxWidth', 'anchor', 'stopPropagation', 'className', 'style', 'lngLat', 'offsets'])) {
234
- if (this.container) {
235
- DOM.remove(this.container);
236
- // @ts-ignore
237
- this.container = undefined;
238
- }
239
- if (this.popupOption.html) {
240
- this.setHTML(this.popupOption.html);
241
- } else if (this.popupOption.text) {
242
- this.setText(this.popupOption.text);
243
- }
244
- if (this.popupOption.title) {
245
- this.setTitle(this.popupOption.title);
246
- }
247
- }
248
- if (this.checkUpdateOption(option, ['closeOnEsc'])) {
249
- this.updateCloseOnEsc();
250
- }
251
- if (this.checkUpdateOption(option, ['closeOnClick'])) {
252
- this.updateCloseOnClick();
253
- }
254
- if (this.checkUpdateOption(option, ['followCursor'])) {
255
- this.updateFollowCursor();
256
- }
257
- if (this.checkUpdateOption(option, ['html']) && option.html) {
258
- this.setHTML(option.html);
259
- } else if (this.checkUpdateOption(option, ['text']) && option.text) {
260
- this.setText(option.text);
261
- }
262
- if (this.checkUpdateOption(option, ['lngLat']) && option.lngLat) {
263
- this.setLnglat(option.lngLat);
264
- }
265
- return this;
266
- }
267
- }, {
268
- key: "open",
269
- value: function open() {
270
- this.addTo(this.scene);
271
- return this;
272
- }
273
- }, {
274
- key: "close",
275
- value: function close() {
276
- this.remove();
277
- return this;
278
- }
279
- }, {
280
- key: "show",
281
- value: function show() {
282
- if (this.isShow) {
283
- return;
284
- }
285
- if (this.container) {
286
- DOM.removeClass(this.container, 'l7-popup-hide');
287
- }
288
- this.isShow = true;
289
- this.emit('show');
290
- return this;
291
- }
292
- }, {
293
- key: "hide",
294
- value: function hide() {
295
- if (!this.isShow) {
296
- return;
297
- }
298
- if (this.container) {
299
- DOM.addClass(this.container, 'l7-popup-hide');
300
- }
301
- this.isShow = false;
302
- this.emit('hide');
303
- return this;
304
- }
305
-
306
- /**
307
- * 设置 HTML 内容
308
- * @param html
309
- */
310
- }, {
311
- key: "setHTML",
312
- value: function setHTML(html) {
313
- this.popupOption.html = html;
314
- return this.setDOMContent(html);
315
- }
316
-
317
- /**
318
- * 设置 Popup 展示文本
319
- * @param text
320
- */
321
- }, {
322
- key: "setText",
323
- value: function setText(text) {
324
- this.popupOption.text = text;
325
- return this.setDOMContent(window.document.createTextNode(text));
326
- }
327
- }, {
328
- key: "setTitle",
329
- value: function setTitle(title) {
330
- this.show();
331
- this.popupOption.title = title;
332
- if (title) {
333
- if (!this.contentTitle) {
334
- this.contentTitle = DOM.create('div', 'l7-popup-content__title');
335
- if (this.content.firstChild) {
336
- this.content.insertBefore(this.contentTitle, this.content.firstChild);
337
- } else {
338
- this.content.append(this.contentTitle);
339
- }
340
- }
341
- DOM.clearChildren(this.contentTitle);
342
- DOM.appendElementType(this.contentTitle, title);
343
- } else if (this.contentTitle) {
344
- DOM.remove(this.contentTitle);
345
- this.contentTitle = undefined;
346
- }
347
- }
348
-
349
- /**
350
- * 将地图自动平移到气泡位置
351
- */
352
- }, {
353
- key: "panToPopup",
354
- value: function panToPopup() {
355
- var _this$lngLat2 = this.lngLat,
356
- lng = _this$lngLat2.lng,
357
- lat = _this$lngLat2.lat;
358
- if (this.popupOption.autoPan) {
359
- this.mapsService.panTo([lng, lat]);
360
- }
361
- return this;
362
- }
363
- }, {
364
- key: "setLngLat",
365
- value: function setLngLat(lngLat) {
366
- return this.setLnglat(lngLat);
367
- }
368
-
369
- /**
370
- * 设置 Popup 所在经纬度
371
- * @param lngLat
372
- */
373
- }, {
374
- key: "setLnglat",
375
- value: function setLnglat(lngLat) {
376
- var _this2 = this;
377
- this.show();
378
- this.lngLat = lngLat;
379
- if (Array.isArray(lngLat)) {
380
- this.lngLat = {
381
- lng: lngLat[0],
382
- lat: lngLat[1]
383
- };
384
- }
385
- if (this.mapsService) {
386
- // 防止事件重复监听
387
- this.mapsService.off('camerachange', this.update);
388
- this.mapsService.off('viewchange', this.update);
389
- this.mapsService.on('camerachange', this.update);
390
- this.mapsService.on('viewchange', this.update);
391
- }
392
- this.update();
393
- if (this.popupOption.autoPan) {
394
- setTimeout(function () {
395
- _this2.panToPopup();
396
- }, 0);
397
- }
398
- return this;
399
- }
400
-
401
- /**
402
- * 获取 Popup 所在经纬度
403
- */
404
- }, {
405
- key: "getLnglat",
406
- value: function getLnglat() {
407
- return this.lngLat;
408
- }
409
-
410
- /**
411
- * 设置 Popup 最大宽度
412
- * @param maxWidth
413
- */
414
- }, {
415
- key: "setMaxWidth",
416
- value: function setMaxWidth(maxWidth) {
417
- this.popupOption.maxWidth = maxWidth;
418
- this.update();
419
- return this;
420
- }
421
- }, {
422
- key: "isOpen",
423
- value: function isOpen() {
424
- return !!this.mapsService;
425
- }
426
- }, {
427
- key: "getDefault",
428
- value:
429
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
430
- function getDefault(option) {
431
- // tslint:disable-next-line:no-object-literal-type-assertion
432
- return {
433
- closeButton: true,
434
- closeOnClick: false,
435
- maxWidth: '240px',
436
- offsets: [0, 0],
437
- anchor: anchorType.BOTTOM,
438
- stopPropagation: true,
439
- autoPan: false,
440
- autoClose: true,
441
- closeOnEsc: false,
442
- followCursor: false
443
- };
444
- }
445
-
446
- /**
447
- * 设置 Popup 内容 HTML
448
- * @param element
449
- */
450
- }, {
451
- key: "setDOMContent",
452
- value: function setDOMContent(element) {
453
- this.show();
454
- this.createContent();
455
- DOM.appendElementType(this.contentPanel, element);
456
- this.update();
457
- return this;
458
- }
459
-
460
- /**
461
- * 绑定地图点击事件触发销毁 Popup
462
- * @protected
463
- */
464
- }, {
465
- key: "updateCloseOnClick",
466
- value: function updateCloseOnClick(onlyClear) {
467
- var _this3 = this;
468
- var mapsService = this.mapsService;
469
- if (mapsService) {
470
- mapsService === null || mapsService === void 0 ? void 0 : mapsService.off('click', this.onCloseButtonClick);
471
- if (this.popupOption.closeOnClick && !onlyClear) {
472
- requestAnimationFrame(function () {
473
- mapsService === null || mapsService === void 0 ? void 0 : mapsService.on('click', _this3.onCloseButtonClick);
474
- });
475
- }
476
- }
477
- }
478
- }, {
479
- key: "updateCloseOnEsc",
480
- value: function updateCloseOnEsc(onlyClear) {
481
- window.removeEventListener('keydown', this.onKeyDown);
482
- if (this.popupOption.closeOnEsc && !onlyClear) {
483
- window.addEventListener('keydown', this.onKeyDown);
484
- }
485
- }
486
- }, {
487
- key: "updateFollowCursor",
488
- value: function updateFollowCursor(onlyClear) {
489
- var _this$mapsService;
490
- var container = (_this$mapsService = this.mapsService) === null || _this$mapsService === void 0 ? void 0 : _this$mapsService.getContainer();
491
- if (container) {
492
- container === null || container === void 0 ? void 0 : container.removeEventListener('mousemove', this.onMouseMove);
493
- if (this.popupOption.followCursor && !onlyClear) {
494
- container === null || container === void 0 ? void 0 : container.addEventListener('mousemove', this.onMouseMove);
495
- }
496
- }
497
- }
498
- }, {
499
- key: "createContent",
500
- value:
501
- /**
502
- * 创建 Popup 内容容器的 DOM (在每次 setHTML 或 setText 时都会被调用)
503
- * @protected
504
- */
505
- function createContent() {
506
- var _this4 = this;
507
- if (this.content) {
508
- DOM.remove(this.content);
509
- }
510
- this.contentTitle = undefined;
511
- this.content = DOM.create('div', 'l7-popup-content', this.container);
512
- this.setTitle(this.popupOption.title);
513
- if (this.popupOption.closeButton) {
514
- var closeButton = createL7Icon('l7-icon-guanbi');
515
- DOM.addClass(closeButton, 'l7-popup-close-button');
516
- this.content.appendChild(closeButton);
517
- if (this.popupOption.closeButtonOffsets) {
518
- // 关闭按钮的偏移
519
- closeButton.style.right = this.popupOption.closeButtonOffsets[0] + 'px';
520
- closeButton.style.top = this.popupOption.closeButtonOffsets[1] + 'px';
521
- }
522
-
523
- // this.closeButton.type = 'button';
524
- closeButton.setAttribute('aria-label', 'Close popup');
525
- closeButton.addEventListener('click', function () {
526
- _this4.hide();
527
- });
528
- this.closeButton = closeButton;
529
- } else {
530
- this.closeButton = undefined;
531
- }
532
- this.contentPanel = DOM.create('div', 'l7-popup-content__panel', this.content);
533
- }
534
- }, {
535
- key: "setPopupPosition",
536
- value:
537
- /**
538
- * 设置 Popup 相对于地图容器的 Position
539
- * @param left
540
- * @param top
541
- * @protected
542
- */
543
- function setPopupPosition(left, top) {
544
- if (this.container) {
545
- var offsets = this.popupOption.offsets;
546
- this.container.style.left = left + offsets[0] + 'px';
547
- this.container.style.top = top - offsets[1] + 'px';
548
- }
549
- }
550
-
551
- /**
552
- * 检查当前传入 option 是否包含 keys 字段
553
- * @param option
554
- * @param keys
555
- * @protected
556
- */
557
- }, {
558
- key: "checkUpdateOption",
559
- value: function checkUpdateOption(option, keys) {
560
- return keys.some(function (key) {
561
- return key in option;
562
- });
563
- }
564
- }]);
565
- return Popup;
566
- }(EventEmitter);
567
- export { Popup as default };
@@ -1,22 +0,0 @@
1
- export declare enum anchorType {
2
- 'CENTER' = "center",
3
- 'TOP' = "top",
4
- 'TOP-LEFT' = "top-left",
5
- 'TOP-RIGHT' = "top-right",
6
- 'BOTTOM' = "bottom",
7
- 'BOTTOM-LEFT' = "bottom-left",
8
- 'LEFT' = "left",
9
- 'RIGHT' = "right"
10
- }
11
- export declare const anchorTranslate: {
12
- center: string;
13
- top: string;
14
- 'top-left': string;
15
- 'top-right': string;
16
- bottom: string;
17
- 'bottom-left': string;
18
- 'bottom-right': string;
19
- left: string;
20
- right: string;
21
- };
22
- export declare function applyAnchorClass(element: HTMLElement, anchor: string, prefix: string): void;
@@ -1,31 +0,0 @@
1
- export var anchorType = /*#__PURE__*/function (anchorType) {
2
- anchorType["CENTER"] = "center";
3
- anchorType["TOP"] = "top";
4
- anchorType["TOP-LEFT"] = "top-left";
5
- anchorType["TOP-RIGHT"] = "top-right";
6
- anchorType["BOTTOM"] = "bottom";
7
- anchorType["BOTTOM-LEFT"] = "bottom-left";
8
- anchorType["LEFT"] = "left";
9
- anchorType["RIGHT"] = "right";
10
- return anchorType;
11
- }({});
12
- export var anchorTranslate = {
13
- center: 'translate(-50%,-50%)',
14
- top: 'translate(-50%,0)',
15
- 'top-left': 'translate(0,0)',
16
- 'top-right': 'translate(-100%,0)',
17
- bottom: 'translate(-50%,-100%)',
18
- 'bottom-left': 'translate(0,-100%)',
19
- 'bottom-right': 'translate(-100%,-100%)',
20
- left: 'translate(0,-50%)',
21
- right: 'translate(-100%,-50%)'
22
- };
23
- export function applyAnchorClass(element, anchor, prefix) {
24
- var classList = element.classList;
25
- for (var key in anchorTranslate) {
26
- if (anchorTranslate.hasOwnProperty(key)) {
27
- classList.remove("l7-".concat(prefix, "-anchor-").concat(key));
28
- }
29
- }
30
- classList.add("l7-".concat(prefix, "-anchor-").concat(anchor));
31
- }
@@ -1 +0,0 @@
1
- export declare const createL7Icon: (className: string) => SVGSVGElement;
package/es/utils/icon.js DELETED
@@ -1,9 +0,0 @@
1
- export var createL7Icon = function createL7Icon(className) {
2
- var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
3
- svg.classList.add('l7-iconfont');
4
- svg.setAttribute('aria-hidden', 'true');
5
- var use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
6
- use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', "#".concat(className));
7
- svg.appendChild(use);
8
- return svg;
9
- };