@antv/l7-component 2.10.15 → 2.11.1
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.
- package/es/control/baseControl/selectControl.d.ts +4 -4
- package/es/interface.d.ts +1 -1
- package/es/marker.js +6 -7
- package/es/popup/layerPopup.d.ts +3 -3
- package/es/popup/layerPopup.js +0 -1
- package/es/popup/popup.js +16 -17
- package/es/utils/popper.d.ts +3 -3
- package/lib/marker.js +6 -7
- package/lib/popup/layerPopup.js +0 -1
- package/lib/popup/popup.js +16 -17
- package/package.json +5 -5
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { IPopperControlOption, PopperControl } from './popperControl';
|
|
2
|
-
|
|
2
|
+
type BaseOptionItem = {
|
|
3
3
|
value: string;
|
|
4
4
|
text: string;
|
|
5
5
|
[key: string]: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type NormalOptionItem = BaseOptionItem & {
|
|
8
8
|
icon?: HTMLElement;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type ImageOptionItem = BaseOptionItem & {
|
|
11
11
|
img: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type ControlOptionItem = ImageOptionItem | NormalOptionItem;
|
|
14
14
|
export interface ISelectControlOption extends IPopperControlOption {
|
|
15
15
|
options: ControlOptionItem[];
|
|
16
16
|
defaultValue?: string | string[];
|
package/es/interface.d.ts
CHANGED
package/es/marker.js
CHANGED
|
@@ -39,7 +39,7 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
_this.markerOption = _objectSpread(_objectSpread({}, _this.getDefault()), option);
|
|
42
|
-
bindAll(['update', 'onMove', '
|
|
42
|
+
bindAll(['update', 'onMove', 'onMapClick'], _assertThisInitialized(_this));
|
|
43
43
|
|
|
44
44
|
_this.init();
|
|
45
45
|
|
|
@@ -87,11 +87,10 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
87
87
|
if (this.mapsService) {
|
|
88
88
|
this.mapsService.off('click', this.onMapClick);
|
|
89
89
|
this.mapsService.off('move', this.update);
|
|
90
|
-
this.mapsService.off('moveend', this.update);
|
|
91
|
-
this.mapsService.off('
|
|
92
|
-
this.mapsService.off('
|
|
93
|
-
this.mapsService.off('
|
|
94
|
-
this.mapsService.off('touchend', this.onUp);
|
|
90
|
+
this.mapsService.off('moveend', this.update); // this.mapsService.off('mousedown', this.addDragHandler);
|
|
91
|
+
// this.mapsService.off('touchstart', this.addDragHandler);
|
|
92
|
+
// this.mapsService.off('mouseup', this.onUp);
|
|
93
|
+
// this.mapsService.off('touchend', this.onUp);
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
this.unRegisterMarkerEvent();
|
|
@@ -418,7 +417,7 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
418
417
|
key: "addDragHandler",
|
|
419
418
|
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
420
419
|
function addDragHandler(e) {
|
|
421
|
-
|
|
420
|
+
return null;
|
|
422
421
|
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
423
422
|
|
|
424
423
|
}, {
|
package/es/popup/layerPopup.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ILayer, IPopupOption } from '@antv/l7-core';
|
|
2
2
|
import { Container } from 'inversify';
|
|
3
3
|
import Popup from './popup';
|
|
4
|
-
export
|
|
4
|
+
export type LayerField = {
|
|
5
5
|
field: string;
|
|
6
6
|
formatField?: ((field: string) => string) | string;
|
|
7
7
|
formatValue?: ((value: any) => any) | string;
|
|
8
8
|
getValue?: (feature: any) => any;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type LayerPopupConfigItem = {
|
|
11
11
|
layer: ILayer | string;
|
|
12
12
|
fields: Array<LayerField | string>;
|
|
13
13
|
};
|
|
@@ -16,7 +16,7 @@ export interface ILayerPopupOption extends IPopupOption {
|
|
|
16
16
|
items?: LayerPopupConfigItem[];
|
|
17
17
|
trigger: 'hover' | 'click';
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
type LayerMapInfo = {
|
|
20
20
|
onMouseMove?: (layer: ILayer, e: any) => void;
|
|
21
21
|
onMouseOut?: (layer: ILayer, e: any) => void;
|
|
22
22
|
onClick?: (layer: ILayer, e: any) => void;
|
package/es/popup/layerPopup.js
CHANGED
package/es/popup/popup.js
CHANGED
|
@@ -73,7 +73,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
73
73
|
e.stopPropagation();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
_this.
|
|
76
|
+
_this.hide();
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
_defineProperty(_assertThisInitialized(_this), "update", function () {
|
|
@@ -208,7 +208,8 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
208
208
|
this.mapsService.on('camerachange', this.update);
|
|
209
209
|
this.mapsService.on('viewchange', this.update);
|
|
210
210
|
this.scene = scene;
|
|
211
|
-
this.update();
|
|
211
|
+
this.update(); // 临时关闭
|
|
212
|
+
|
|
212
213
|
this.updateCloseOnClick();
|
|
213
214
|
this.updateCloseOnEsc();
|
|
214
215
|
this.updateFollowCursor();
|
|
@@ -305,6 +306,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
305
306
|
|
|
306
307
|
if (this.checkUpdateOption(option, ['lngLat']) && option.lngLat) {
|
|
307
308
|
this.setLnglat(option.lngLat);
|
|
309
|
+
this.show();
|
|
308
310
|
}
|
|
309
311
|
|
|
310
312
|
return this;
|
|
@@ -465,7 +467,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
465
467
|
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
466
468
|
return {
|
|
467
469
|
closeButton: true,
|
|
468
|
-
closeOnClick:
|
|
470
|
+
closeOnClick: false,
|
|
469
471
|
maxWidth: '240px',
|
|
470
472
|
offsets: [0, 0],
|
|
471
473
|
anchor: anchorType.BOTTOM,
|
|
@@ -502,11 +504,11 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
502
504
|
var mapsService = this.mapsService;
|
|
503
505
|
|
|
504
506
|
if (mapsService) {
|
|
505
|
-
|
|
507
|
+
mapsService === null || mapsService === void 0 ? void 0 : mapsService.off('click', this.onCloseButtonClick);
|
|
506
508
|
|
|
507
509
|
if (this.popupOption.closeOnClick && !onlyClear) {
|
|
508
510
|
requestAnimationFrame(function () {
|
|
509
|
-
|
|
511
|
+
mapsService === null || mapsService === void 0 ? void 0 : mapsService.on('click', _this3.onCloseButtonClick);
|
|
510
512
|
});
|
|
511
513
|
}
|
|
512
514
|
}
|
|
@@ -514,31 +516,24 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
514
516
|
}, {
|
|
515
517
|
key: "updateCloseOnEsc",
|
|
516
518
|
value: function updateCloseOnEsc(onlyClear) {
|
|
517
|
-
var _this4 = this;
|
|
518
|
-
|
|
519
519
|
window.removeEventListener('keydown', this.onKeyDown);
|
|
520
520
|
|
|
521
521
|
if (this.popupOption.closeOnEsc && !onlyClear) {
|
|
522
|
-
|
|
523
|
-
window.addEventListener('keydown', _this4.onKeyDown);
|
|
524
|
-
});
|
|
522
|
+
window.addEventListener('keydown', this.onKeyDown);
|
|
525
523
|
}
|
|
526
524
|
}
|
|
527
525
|
}, {
|
|
528
526
|
key: "updateFollowCursor",
|
|
529
527
|
value: function updateFollowCursor(onlyClear) {
|
|
530
|
-
var _this$mapsService
|
|
531
|
-
_this5 = this;
|
|
528
|
+
var _this$mapsService;
|
|
532
529
|
|
|
533
530
|
var container = (_this$mapsService = this.mapsService) === null || _this$mapsService === void 0 ? void 0 : _this$mapsService.getContainer();
|
|
534
531
|
|
|
535
532
|
if (container) {
|
|
536
|
-
container.removeEventListener('mousemove', this.onMouseMove);
|
|
533
|
+
container === null || container === void 0 ? void 0 : container.removeEventListener('mousemove', this.onMouseMove);
|
|
537
534
|
|
|
538
535
|
if (this.popupOption.followCursor && !onlyClear) {
|
|
539
|
-
|
|
540
|
-
container.addEventListener('mousemove', _this5.onMouseMove);
|
|
541
|
-
});
|
|
536
|
+
container === null || container === void 0 ? void 0 : container.addEventListener('mousemove', this.onMouseMove);
|
|
542
537
|
}
|
|
543
538
|
}
|
|
544
539
|
}
|
|
@@ -550,6 +545,8 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
550
545
|
* @protected
|
|
551
546
|
*/
|
|
552
547
|
function createContent() {
|
|
548
|
+
var _this4 = this;
|
|
549
|
+
|
|
553
550
|
if (this.content) {
|
|
554
551
|
DOM.remove(this.content);
|
|
555
552
|
}
|
|
@@ -578,7 +575,9 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
578
575
|
|
|
579
576
|
|
|
580
577
|
closeButton.setAttribute('aria-label', 'Close popup');
|
|
581
|
-
closeButton.addEventListener('click',
|
|
578
|
+
closeButton.addEventListener('click', function () {
|
|
579
|
+
_this4.hide();
|
|
580
|
+
});
|
|
582
581
|
this.closeButton = closeButton;
|
|
583
582
|
} else {
|
|
584
583
|
this.closeButton = undefined;
|
package/es/utils/popper.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { EventEmitter } from 'eventemitter3';
|
|
|
2
2
|
/**
|
|
3
3
|
* 气泡位置枚举
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type PopperPlacement = 'top-start' | 'top' | 'top-end' | 'left-start' | 'left' | 'left-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'right-start' | 'right' | 'right-end';
|
|
6
6
|
/**
|
|
7
7
|
* 气泡触发类型,当前支持 click 和 hover 两种类型
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type PopperTrigger = 'click' | 'hover';
|
|
10
10
|
/**
|
|
11
11
|
* 气泡内容类型
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type PopperContent = string | HTMLElement | null;
|
|
14
14
|
export interface IPopperOption {
|
|
15
15
|
placement: PopperPlacement;
|
|
16
16
|
trigger: PopperTrigger;
|
package/lib/marker.js
CHANGED
|
@@ -53,7 +53,7 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
_this.markerOption = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _this.getDefault()), option);
|
|
56
|
-
(0, _l7Utils.bindAll)(['update', 'onMove', '
|
|
56
|
+
(0, _l7Utils.bindAll)(['update', 'onMove', 'onMapClick'], (0, _assertThisInitialized2.default)(_this));
|
|
57
57
|
|
|
58
58
|
_this.init();
|
|
59
59
|
|
|
@@ -101,11 +101,10 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
101
101
|
if (this.mapsService) {
|
|
102
102
|
this.mapsService.off('click', this.onMapClick);
|
|
103
103
|
this.mapsService.off('move', this.update);
|
|
104
|
-
this.mapsService.off('moveend', this.update);
|
|
105
|
-
this.mapsService.off('
|
|
106
|
-
this.mapsService.off('
|
|
107
|
-
this.mapsService.off('
|
|
108
|
-
this.mapsService.off('touchend', this.onUp);
|
|
104
|
+
this.mapsService.off('moveend', this.update); // this.mapsService.off('mousedown', this.addDragHandler);
|
|
105
|
+
// this.mapsService.off('touchstart', this.addDragHandler);
|
|
106
|
+
// this.mapsService.off('mouseup', this.onUp);
|
|
107
|
+
// this.mapsService.off('touchend', this.onUp);
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
this.unRegisterMarkerEvent();
|
|
@@ -434,7 +433,7 @@ var Marker = /*#__PURE__*/function (_EventEmitter) {
|
|
|
434
433
|
key: "addDragHandler",
|
|
435
434
|
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
436
435
|
function addDragHandler(e) {
|
|
437
|
-
|
|
436
|
+
return null;
|
|
438
437
|
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
439
438
|
|
|
440
439
|
}, {
|
package/lib/popup/layerPopup.js
CHANGED
package/lib/popup/popup.js
CHANGED
|
@@ -86,7 +86,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
86
86
|
e.stopPropagation();
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
_this.
|
|
89
|
+
_this.hide();
|
|
90
90
|
});
|
|
91
91
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "update", function () {
|
|
92
92
|
var hasPosition = !!_this.lngLat;
|
|
@@ -220,7 +220,8 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
220
220
|
this.mapsService.on('camerachange', this.update);
|
|
221
221
|
this.mapsService.on('viewchange', this.update);
|
|
222
222
|
this.scene = scene;
|
|
223
|
-
this.update();
|
|
223
|
+
this.update(); // 临时关闭
|
|
224
|
+
|
|
224
225
|
this.updateCloseOnClick();
|
|
225
226
|
this.updateCloseOnEsc();
|
|
226
227
|
this.updateFollowCursor();
|
|
@@ -319,6 +320,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
319
320
|
|
|
320
321
|
if (this.checkUpdateOption(option, ['lngLat']) && option.lngLat) {
|
|
321
322
|
this.setLnglat(option.lngLat);
|
|
323
|
+
this.show();
|
|
322
324
|
}
|
|
323
325
|
|
|
324
326
|
return this;
|
|
@@ -479,7 +481,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
479
481
|
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
480
482
|
return {
|
|
481
483
|
closeButton: true,
|
|
482
|
-
closeOnClick:
|
|
484
|
+
closeOnClick: false,
|
|
483
485
|
maxWidth: '240px',
|
|
484
486
|
offsets: [0, 0],
|
|
485
487
|
anchor: _l7Utils.anchorType.BOTTOM,
|
|
@@ -516,11 +518,11 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
516
518
|
var mapsService = this.mapsService;
|
|
517
519
|
|
|
518
520
|
if (mapsService) {
|
|
519
|
-
|
|
521
|
+
mapsService === null || mapsService === void 0 ? void 0 : mapsService.off('click', this.onCloseButtonClick);
|
|
520
522
|
|
|
521
523
|
if (this.popupOption.closeOnClick && !onlyClear) {
|
|
522
524
|
requestAnimationFrame(function () {
|
|
523
|
-
|
|
525
|
+
mapsService === null || mapsService === void 0 ? void 0 : mapsService.on('click', _this3.onCloseButtonClick);
|
|
524
526
|
});
|
|
525
527
|
}
|
|
526
528
|
}
|
|
@@ -528,31 +530,24 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
528
530
|
}, {
|
|
529
531
|
key: "updateCloseOnEsc",
|
|
530
532
|
value: function updateCloseOnEsc(onlyClear) {
|
|
531
|
-
var _this4 = this;
|
|
532
|
-
|
|
533
533
|
window.removeEventListener('keydown', this.onKeyDown);
|
|
534
534
|
|
|
535
535
|
if (this.popupOption.closeOnEsc && !onlyClear) {
|
|
536
|
-
|
|
537
|
-
window.addEventListener('keydown', _this4.onKeyDown);
|
|
538
|
-
});
|
|
536
|
+
window.addEventListener('keydown', this.onKeyDown);
|
|
539
537
|
}
|
|
540
538
|
}
|
|
541
539
|
}, {
|
|
542
540
|
key: "updateFollowCursor",
|
|
543
541
|
value: function updateFollowCursor(onlyClear) {
|
|
544
|
-
var _this$mapsService
|
|
545
|
-
_this5 = this;
|
|
542
|
+
var _this$mapsService;
|
|
546
543
|
|
|
547
544
|
var container = (_this$mapsService = this.mapsService) === null || _this$mapsService === void 0 ? void 0 : _this$mapsService.getContainer();
|
|
548
545
|
|
|
549
546
|
if (container) {
|
|
550
|
-
container.removeEventListener('mousemove', this.onMouseMove);
|
|
547
|
+
container === null || container === void 0 ? void 0 : container.removeEventListener('mousemove', this.onMouseMove);
|
|
551
548
|
|
|
552
549
|
if (this.popupOption.followCursor && !onlyClear) {
|
|
553
|
-
|
|
554
|
-
container.addEventListener('mousemove', _this5.onMouseMove);
|
|
555
|
-
});
|
|
550
|
+
container === null || container === void 0 ? void 0 : container.addEventListener('mousemove', this.onMouseMove);
|
|
556
551
|
}
|
|
557
552
|
}
|
|
558
553
|
}
|
|
@@ -564,6 +559,8 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
564
559
|
* @protected
|
|
565
560
|
*/
|
|
566
561
|
function createContent() {
|
|
562
|
+
var _this4 = this;
|
|
563
|
+
|
|
567
564
|
if (this.content) {
|
|
568
565
|
_l7Utils.DOM.remove(this.content);
|
|
569
566
|
}
|
|
@@ -594,7 +591,9 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
594
591
|
|
|
595
592
|
|
|
596
593
|
closeButton.setAttribute('aria-label', 'Close popup');
|
|
597
|
-
closeButton.addEventListener('click',
|
|
594
|
+
closeButton.addEventListener('click', function () {
|
|
595
|
+
_this4.hide();
|
|
596
|
+
});
|
|
598
597
|
this.closeButton = closeButton;
|
|
599
598
|
} else {
|
|
600
599
|
this.closeButton = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"author": "lzxue",
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@antv/l7-core": "2.
|
|
30
|
-
"@antv/l7-utils": "2.
|
|
29
|
+
"@antv/l7-core": "2.11.1",
|
|
30
|
+
"@antv/l7-utils": "2.11.1",
|
|
31
31
|
"@babel/runtime": "^7.7.7",
|
|
32
32
|
"eventemitter3": "^4.0.0",
|
|
33
33
|
"inversify": "^5.0.1",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"supercluster": "^7.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@antv/l7-test-utils": "2.
|
|
39
|
+
"@antv/l7-test-utils": "2.11.1",
|
|
40
40
|
"gcoord": "^0.3.2",
|
|
41
41
|
"less": "^4.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "e86da32e1999fdc36668de531d16ab14bce56279",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|