@antv/l7-component 2.10.6 → 2.10.9
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/popperControl.js +6 -3
- package/es/control/baseControl/selectControl.d.ts +4 -4
- package/es/control/baseControl/selectControl.js +1 -0
- package/es/control/fullscreen.js +2 -1
- package/es/interface.d.ts +1 -1
- package/es/marker-layer.d.ts +1 -0
- package/es/marker-layer.js +4 -1
- package/es/popup/layerPopup.d.ts +3 -3
- package/es/popup/layerPopup.js +2 -1
- package/es/popup/popup.js +22 -13
- package/es/utils/popper.d.ts +3 -3
- package/lib/control/baseControl/popperControl.js +6 -3
- package/lib/control/baseControl/selectControl.js +1 -0
- package/lib/control/fullscreen.js +2 -1
- package/lib/marker-layer.js +4 -1
- package/lib/popup/layerPopup.js +2 -1
- package/lib/popup/popup.js +22 -13
- package/package.json +5 -5
|
@@ -66,7 +66,8 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
|
|
|
66
66
|
value: function getDefault(option) {
|
|
67
67
|
var _option$position;
|
|
68
68
|
|
|
69
|
-
var defaultOption = _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option);
|
|
69
|
+
var defaultOption = _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
70
|
+
|
|
70
71
|
|
|
71
72
|
var position = (_option$position = option === null || option === void 0 ? void 0 : option.position) !== null && _option$position !== void 0 ? _option$position : defaultOption.position;
|
|
72
73
|
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option)), {}, {
|
|
@@ -95,8 +96,10 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
|
|
|
95
96
|
var _this$controlOption = this.controlOption,
|
|
96
97
|
popperClassName = _this$controlOption.popperClassName,
|
|
97
98
|
popperPlacement = _this$controlOption.popperPlacement,
|
|
98
|
-
popperTrigger = _this$controlOption.popperTrigger;
|
|
99
|
-
|
|
99
|
+
popperTrigger = _this$controlOption.popperTrigger; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
100
|
+
|
|
101
|
+
var popperContainer = this.mapsService.getMapContainer(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
102
|
+
|
|
100
103
|
this.popper = new Popper(this.button, {
|
|
101
104
|
className: popperClassName,
|
|
102
105
|
placement: popperPlacement,
|
|
@@ -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[];
|
|
@@ -119,6 +119,7 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
|
|
|
119
119
|
var emitEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
120
120
|
var finalValue = this.transSelectValue(value);
|
|
121
121
|
this.optionDOMList.forEach(function (optionDOM) {
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
122
123
|
var optionValue = optionDOM.getAttribute(SelectControlConstant.OptionValueAttrKey);
|
|
123
124
|
var checkboxDOM = _this2.getIsMultiple() ? optionDOM.querySelector('input[type=checkbox]') : undefined;
|
|
124
125
|
|
package/es/control/fullscreen.js
CHANGED
|
@@ -121,7 +121,8 @@ var Fullscreen = /*#__PURE__*/function (_ButtonControl) {
|
|
|
121
121
|
value: function onAdd() {
|
|
122
122
|
var button = _get(_getPrototypeOf(Fullscreen.prototype), "onAdd", this).call(this);
|
|
123
123
|
|
|
124
|
-
button.addEventListener('click', this.onClick);
|
|
124
|
+
button.addEventListener('click', this.onClick); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
125
|
+
|
|
125
126
|
this.mapContainer = DOM.getContainer(this.scene.getSceneConfig().id);
|
|
126
127
|
this.mapContainer.addEventListener('fullscreenchange', this.onFullscreenChange);
|
|
127
128
|
return button;
|
package/es/interface.d.ts
CHANGED
package/es/marker-layer.d.ts
CHANGED
package/es/marker-layer.js
CHANGED
|
@@ -83,6 +83,7 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
|
|
|
83
83
|
this.mapsService.on('viewchange', this.setContainerSize.bind(this)); // amap2.0 更新事件
|
|
84
84
|
|
|
85
85
|
this.addMarkers();
|
|
86
|
+
this.inited = true;
|
|
86
87
|
return this;
|
|
87
88
|
} // 设置容器大小
|
|
88
89
|
|
|
@@ -123,7 +124,9 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
this.markers.push(marker);
|
|
127
|
+
this.markers.push(marker); // if(this.inited) {
|
|
128
|
+
// marker.addTo(this.scene);
|
|
129
|
+
// }
|
|
127
130
|
}
|
|
128
131
|
}, {
|
|
129
132
|
key: "removeMarker",
|
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
|
@@ -200,7 +200,8 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
200
200
|
if (!this.isShow) {
|
|
201
201
|
this.show();
|
|
202
202
|
}
|
|
203
|
-
}
|
|
203
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
204
|
+
|
|
204
205
|
}, {
|
|
205
206
|
key: "onLayerMouseOut",
|
|
206
207
|
value: function onLayerMouseOut(layer, e) {
|
package/es/popup/popup.js
CHANGED
|
@@ -460,7 +460,8 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
460
460
|
}
|
|
461
461
|
}, {
|
|
462
462
|
key: "getDefault",
|
|
463
|
-
value:
|
|
463
|
+
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
464
|
+
function getDefault(option) {
|
|
464
465
|
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
465
466
|
return {
|
|
466
467
|
closeButton: true,
|
|
@@ -498,12 +499,16 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
498
499
|
value: function updateCloseOnClick(onlyClear) {
|
|
499
500
|
var _this3 = this;
|
|
500
501
|
|
|
501
|
-
|
|
502
|
+
var mapsService = this.mapsService;
|
|
502
503
|
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
504
|
+
if (mapsService) {
|
|
505
|
+
this.mapsService.off('click', this.onCloseButtonClick);
|
|
506
|
+
|
|
507
|
+
if (this.popupOption.closeOnClick && !onlyClear) {
|
|
508
|
+
requestAnimationFrame(function () {
|
|
509
|
+
_this3.mapsService.on('click', _this3.onCloseButtonClick);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
507
512
|
}
|
|
508
513
|
}
|
|
509
514
|
}, {
|
|
@@ -522,15 +527,19 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
522
527
|
}, {
|
|
523
528
|
key: "updateFollowCursor",
|
|
524
529
|
value: function updateFollowCursor(onlyClear) {
|
|
525
|
-
var
|
|
530
|
+
var _this$mapsService,
|
|
531
|
+
_this5 = this;
|
|
526
532
|
|
|
527
|
-
var container = this.mapsService.getContainer();
|
|
528
|
-
container.removeEventListener('mousemove', this.onMouseMove);
|
|
533
|
+
var container = (_this$mapsService = this.mapsService) === null || _this$mapsService === void 0 ? void 0 : _this$mapsService.getContainer();
|
|
529
534
|
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
535
|
+
if (container) {
|
|
536
|
+
container.removeEventListener('mousemove', this.onMouseMove);
|
|
537
|
+
|
|
538
|
+
if (this.popupOption.followCursor && !onlyClear) {
|
|
539
|
+
requestAnimationFrame(function () {
|
|
540
|
+
container.addEventListener('mousemove', _this5.onMouseMove);
|
|
541
|
+
});
|
|
542
|
+
}
|
|
534
543
|
}
|
|
535
544
|
}
|
|
536
545
|
}, {
|
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;
|
|
@@ -80,7 +80,8 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
|
|
|
80
80
|
value: function getDefault(option) {
|
|
81
81
|
var _option$position;
|
|
82
82
|
|
|
83
|
-
var defaultOption = (0, _get2.default)((0, _getPrototypeOf2.default)(PopperControl.prototype), "getDefault", this).call(this, option);
|
|
83
|
+
var defaultOption = (0, _get2.default)((0, _getPrototypeOf2.default)(PopperControl.prototype), "getDefault", this).call(this, option); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
84
|
+
|
|
84
85
|
var position = (_option$position = option === null || option === void 0 ? void 0 : option.position) !== null && _option$position !== void 0 ? _option$position : defaultOption.position;
|
|
85
86
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(PopperControl.prototype), "getDefault", this).call(this, option)), {}, {
|
|
86
87
|
popperPlacement: position instanceof Element ? 'bottom' : PopperPlacementMap[position],
|
|
@@ -107,8 +108,10 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
|
|
|
107
108
|
var _this$controlOption = this.controlOption,
|
|
108
109
|
popperClassName = _this$controlOption.popperClassName,
|
|
109
110
|
popperPlacement = _this$controlOption.popperPlacement,
|
|
110
|
-
popperTrigger = _this$controlOption.popperTrigger;
|
|
111
|
-
|
|
111
|
+
popperTrigger = _this$controlOption.popperTrigger; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
112
|
+
|
|
113
|
+
var popperContainer = this.mapsService.getMapContainer(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
114
|
+
|
|
112
115
|
this.popper = new _popper.Popper(this.button, {
|
|
113
116
|
className: popperClassName,
|
|
114
117
|
placement: popperPlacement,
|
|
@@ -132,6 +132,7 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
|
|
|
132
132
|
var emitEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
133
133
|
var finalValue = this.transSelectValue(value);
|
|
134
134
|
this.optionDOMList.forEach(function (optionDOM) {
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
135
136
|
var optionValue = optionDOM.getAttribute(SelectControlConstant.OptionValueAttrKey);
|
|
136
137
|
var checkboxDOM = _this2.getIsMultiple() ? optionDOM.querySelector('input[type=checkbox]') : undefined;
|
|
137
138
|
|
|
@@ -136,7 +136,8 @@ var Fullscreen = /*#__PURE__*/function (_ButtonControl) {
|
|
|
136
136
|
key: "onAdd",
|
|
137
137
|
value: function onAdd() {
|
|
138
138
|
var button = (0, _get2.default)((0, _getPrototypeOf2.default)(Fullscreen.prototype), "onAdd", this).call(this);
|
|
139
|
-
button.addEventListener('click', this.onClick);
|
|
139
|
+
button.addEventListener('click', this.onClick); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
140
|
+
|
|
140
141
|
this.mapContainer = _l7Utils.DOM.getContainer(this.scene.getSceneConfig().id);
|
|
141
142
|
this.mapContainer.addEventListener('fullscreenchange', this.onFullscreenChange);
|
|
142
143
|
return button;
|
package/lib/marker-layer.js
CHANGED
|
@@ -97,6 +97,7 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
|
|
|
97
97
|
this.mapsService.on('viewchange', this.setContainerSize.bind(this)); // amap2.0 更新事件
|
|
98
98
|
|
|
99
99
|
this.addMarkers();
|
|
100
|
+
this.inited = true;
|
|
100
101
|
return this;
|
|
101
102
|
} // 设置容器大小
|
|
102
103
|
|
|
@@ -137,7 +138,9 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
this.markers.push(marker);
|
|
141
|
+
this.markers.push(marker); // if(this.inited) {
|
|
142
|
+
// marker.addTo(this.scene);
|
|
143
|
+
// }
|
|
141
144
|
}
|
|
142
145
|
}, {
|
|
143
146
|
key: "removeMarker",
|
package/lib/popup/layerPopup.js
CHANGED
|
@@ -211,7 +211,8 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
211
211
|
if (!this.isShow) {
|
|
212
212
|
this.show();
|
|
213
213
|
}
|
|
214
|
-
}
|
|
214
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
215
|
+
|
|
215
216
|
}, {
|
|
216
217
|
key: "onLayerMouseOut",
|
|
217
218
|
value: function onLayerMouseOut(layer, e) {
|
package/lib/popup/popup.js
CHANGED
|
@@ -474,7 +474,8 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
474
474
|
}
|
|
475
475
|
}, {
|
|
476
476
|
key: "getDefault",
|
|
477
|
-
value:
|
|
477
|
+
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
478
|
+
function getDefault(option) {
|
|
478
479
|
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
479
480
|
return {
|
|
480
481
|
closeButton: true,
|
|
@@ -512,12 +513,16 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
512
513
|
value: function updateCloseOnClick(onlyClear) {
|
|
513
514
|
var _this3 = this;
|
|
514
515
|
|
|
515
|
-
|
|
516
|
+
var mapsService = this.mapsService;
|
|
516
517
|
|
|
517
|
-
if (
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
518
|
+
if (mapsService) {
|
|
519
|
+
this.mapsService.off('click', this.onCloseButtonClick);
|
|
520
|
+
|
|
521
|
+
if (this.popupOption.closeOnClick && !onlyClear) {
|
|
522
|
+
requestAnimationFrame(function () {
|
|
523
|
+
_this3.mapsService.on('click', _this3.onCloseButtonClick);
|
|
524
|
+
});
|
|
525
|
+
}
|
|
521
526
|
}
|
|
522
527
|
}
|
|
523
528
|
}, {
|
|
@@ -536,15 +541,19 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
536
541
|
}, {
|
|
537
542
|
key: "updateFollowCursor",
|
|
538
543
|
value: function updateFollowCursor(onlyClear) {
|
|
539
|
-
var
|
|
544
|
+
var _this$mapsService,
|
|
545
|
+
_this5 = this;
|
|
540
546
|
|
|
541
|
-
var container = this.mapsService.getContainer();
|
|
542
|
-
container.removeEventListener('mousemove', this.onMouseMove);
|
|
547
|
+
var container = (_this$mapsService = this.mapsService) === null || _this$mapsService === void 0 ? void 0 : _this$mapsService.getContainer();
|
|
543
548
|
|
|
544
|
-
if (
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
549
|
+
if (container) {
|
|
550
|
+
container.removeEventListener('mousemove', this.onMouseMove);
|
|
551
|
+
|
|
552
|
+
if (this.popupOption.followCursor && !onlyClear) {
|
|
553
|
+
requestAnimationFrame(function () {
|
|
554
|
+
container.addEventListener('mousemove', _this5.onMouseMove);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
548
557
|
}
|
|
549
558
|
}
|
|
550
559
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.9",
|
|
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.10.
|
|
30
|
-
"@antv/l7-utils": "2.10.
|
|
29
|
+
"@antv/l7-core": "2.10.9",
|
|
30
|
+
"@antv/l7-utils": "2.10.9",
|
|
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.10.
|
|
39
|
+
"@antv/l7-test-utils": "2.10.9",
|
|
40
40
|
"gcoord": "^0.3.2",
|
|
41
41
|
"less": "^4.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9fe64ef00875f4d96771542c16842468e61a8ef4",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|