@antv/l7-component 2.10.3 → 2.10.4
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/control.d.ts +2 -2
- package/es/control/baseControl/control.js +10 -5
- package/es/control/baseControl/popperControl.js +4 -7
- package/es/control/baseControl/selectControl.js +0 -1
- package/es/control/fullscreen.js +1 -2
- package/es/popup/layerPopup.d.ts +5 -6
- package/es/popup/layerPopup.js +1 -4
- package/es/popup/popup.js +1 -3
- package/lib/control/baseControl/control.js +10 -5
- package/lib/control/baseControl/popperControl.js +4 -7
- package/lib/control/baseControl/selectControl.js +0 -1
- package/lib/control/fullscreen.js +1 -2
- package/lib/popup/layerPopup.js +1 -2
- package/lib/popup/popup.js +1 -3
- package/package.json +5 -5
|
@@ -6,7 +6,7 @@ export { PositionType } from '@antv/l7-core';
|
|
|
6
6
|
export { Control };
|
|
7
7
|
export interface IControlOption {
|
|
8
8
|
name: string;
|
|
9
|
-
position: PositionName;
|
|
9
|
+
position: PositionName | Element;
|
|
10
10
|
className?: string;
|
|
11
11
|
style?: string;
|
|
12
12
|
[key: string]: any;
|
|
@@ -87,7 +87,7 @@ export default class Control<O extends IControlOption = IControlOption> extends
|
|
|
87
87
|
* 设置当前控件位置
|
|
88
88
|
* @param position
|
|
89
89
|
*/
|
|
90
|
-
setPosition(position?: PositionType |
|
|
90
|
+
setPosition(position?: PositionType | IControlOption['position']): this;
|
|
91
91
|
/**
|
|
92
92
|
* 设置容器 container 的样式相关位置,包含 className
|
|
93
93
|
* @param className
|
|
@@ -279,14 +279,19 @@ var Control = /*#__PURE__*/function (_ref) {
|
|
|
279
279
|
}, {
|
|
280
280
|
key: "insertContainer",
|
|
281
281
|
value: function insertContainer() {
|
|
282
|
-
var container = this.container;
|
|
283
282
|
var position = this.controlOption.position;
|
|
284
|
-
var
|
|
283
|
+
var container = this.container;
|
|
285
284
|
|
|
286
|
-
if (position
|
|
287
|
-
|
|
285
|
+
if (position instanceof Element) {
|
|
286
|
+
position.appendChild(container);
|
|
288
287
|
} else {
|
|
289
|
-
corner.
|
|
288
|
+
var corner = this.controlService.controlCorners[position];
|
|
289
|
+
|
|
290
|
+
if (position.indexOf('bottom') !== -1) {
|
|
291
|
+
corner.insertBefore(container, corner.firstChild);
|
|
292
|
+
} else {
|
|
293
|
+
corner.appendChild(container);
|
|
294
|
+
}
|
|
290
295
|
}
|
|
291
296
|
}
|
|
292
297
|
/**
|
|
@@ -66,12 +66,11 @@ 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);
|
|
70
|
-
|
|
69
|
+
var defaultOption = _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option);
|
|
71
70
|
|
|
72
71
|
var position = (_option$position = option === null || option === void 0 ? void 0 : option.position) !== null && _option$position !== void 0 ? _option$position : defaultOption.position;
|
|
73
72
|
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option)), {}, {
|
|
74
|
-
popperPlacement: PopperPlacementMap[position],
|
|
73
|
+
popperPlacement: position instanceof Element ? 'bottom' : PopperPlacementMap[position],
|
|
75
74
|
popperTrigger: 'click'
|
|
76
75
|
});
|
|
77
76
|
}
|
|
@@ -96,10 +95,8 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
|
|
|
96
95
|
var _this$controlOption = this.controlOption,
|
|
97
96
|
popperClassName = _this$controlOption.popperClassName,
|
|
98
97
|
popperPlacement = _this$controlOption.popperPlacement,
|
|
99
|
-
popperTrigger = _this$controlOption.popperTrigger;
|
|
100
|
-
|
|
101
|
-
var popperContainer = this.mapsService.getMapContainer(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
102
|
-
|
|
98
|
+
popperTrigger = _this$controlOption.popperTrigger;
|
|
99
|
+
var popperContainer = this.mapsService.getMapContainer();
|
|
103
100
|
this.popper = new Popper(this.button, {
|
|
104
101
|
className: popperClassName,
|
|
105
102
|
placement: popperPlacement,
|
|
@@ -119,7 +119,6 @@ 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
|
|
123
122
|
var optionValue = optionDOM.getAttribute(SelectControlConstant.OptionValueAttrKey);
|
|
124
123
|
var checkboxDOM = _this2.getIsMultiple() ? optionDOM.querySelector('input[type=checkbox]') : undefined;
|
|
125
124
|
|
package/es/control/fullscreen.js
CHANGED
|
@@ -121,8 +121,7 @@ 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);
|
|
125
|
-
|
|
124
|
+
button.addEventListener('click', this.onClick);
|
|
126
125
|
this.mapContainer = DOM.getContainer(this.scene.getSceneConfig().id);
|
|
127
126
|
this.mapContainer.addEventListener('fullscreenchange', this.onFullscreenChange);
|
|
128
127
|
return button;
|
package/es/popup/layerPopup.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ILayer, IPopupOption } from '@antv/l7-core';
|
|
2
|
-
import { BaseLayer } from '@antv/l7-layers';
|
|
3
2
|
import { Container } from 'inversify';
|
|
4
3
|
import Popup from './popup';
|
|
5
4
|
export declare type LayerField = {
|
|
@@ -9,7 +8,7 @@ export declare type LayerField = {
|
|
|
9
8
|
getValue?: (feature: any) => any;
|
|
10
9
|
};
|
|
11
10
|
export declare type LayerPopupConfigItem = {
|
|
12
|
-
layer:
|
|
11
|
+
layer: ILayer | string;
|
|
13
12
|
fields: Array<LayerField | string>;
|
|
14
13
|
};
|
|
15
14
|
export interface ILayerPopupOption extends IPopupOption {
|
|
@@ -17,10 +16,10 @@ export interface ILayerPopupOption extends IPopupOption {
|
|
|
17
16
|
trigger: 'hover' | 'click';
|
|
18
17
|
}
|
|
19
18
|
declare type LayerMapInfo = {
|
|
20
|
-
onMouseMove?: (layer:
|
|
21
|
-
onMouseOut?: (layer:
|
|
22
|
-
onClick?: (layer:
|
|
23
|
-
onSourceUpdate?: (layer:
|
|
19
|
+
onMouseMove?: (layer: ILayer, e: any) => void;
|
|
20
|
+
onMouseOut?: (layer: ILayer, e: any) => void;
|
|
21
|
+
onClick?: (layer: ILayer, e: any) => void;
|
|
22
|
+
onSourceUpdate?: (layer: ILayer) => void;
|
|
24
23
|
} & Partial<LayerPopupConfigItem>;
|
|
25
24
|
export { LayerPopup };
|
|
26
25
|
export default class LayerPopup extends Popup<ILayerPopupOption> {
|
package/es/popup/layerPopup.js
CHANGED
|
@@ -12,8 +12,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
|
|
13
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; } }
|
|
14
14
|
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
// tslint:disable-next-line:no-implicit-dependencies
|
|
17
15
|
import { DOM } from '@antv/l7-utils';
|
|
18
16
|
import { get } from 'lodash'; // import { Container } from 'inversify';
|
|
19
17
|
|
|
@@ -193,8 +191,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
193
191
|
if (!this.isShow) {
|
|
194
192
|
this.show();
|
|
195
193
|
}
|
|
196
|
-
}
|
|
197
|
-
|
|
194
|
+
}
|
|
198
195
|
}, {
|
|
199
196
|
key: "onLayerMouseOut",
|
|
200
197
|
value: function onLayerMouseOut(layer, e) {
|
package/es/popup/popup.js
CHANGED
|
@@ -460,8 +460,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
460
460
|
}
|
|
461
461
|
}, {
|
|
462
462
|
key: "getDefault",
|
|
463
|
-
value:
|
|
464
|
-
function getDefault(option) {
|
|
463
|
+
value: function getDefault(option) {
|
|
465
464
|
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
466
465
|
return {
|
|
467
466
|
closeButton: true,
|
|
@@ -515,7 +514,6 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
515
514
|
}, {
|
|
516
515
|
key: "updateFollowCursor",
|
|
517
516
|
value: function updateFollowCursor(onlyClear) {
|
|
518
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
519
517
|
var container = this.mapsService.getContainer();
|
|
520
518
|
container.removeEventListener('mousemove', this.onMouseMove);
|
|
521
519
|
|
|
@@ -308,14 +308,19 @@ var Control = /*#__PURE__*/function (_ref) {
|
|
|
308
308
|
}, {
|
|
309
309
|
key: "insertContainer",
|
|
310
310
|
value: function insertContainer() {
|
|
311
|
-
var container = this.container;
|
|
312
311
|
var position = this.controlOption.position;
|
|
313
|
-
var
|
|
312
|
+
var container = this.container;
|
|
314
313
|
|
|
315
|
-
if (position
|
|
316
|
-
|
|
314
|
+
if (position instanceof Element) {
|
|
315
|
+
position.appendChild(container);
|
|
317
316
|
} else {
|
|
318
|
-
corner.
|
|
317
|
+
var corner = this.controlService.controlCorners[position];
|
|
318
|
+
|
|
319
|
+
if (position.indexOf('bottom') !== -1) {
|
|
320
|
+
corner.insertBefore(container, corner.firstChild);
|
|
321
|
+
} else {
|
|
322
|
+
corner.appendChild(container);
|
|
323
|
+
}
|
|
319
324
|
}
|
|
320
325
|
}
|
|
321
326
|
/**
|
|
@@ -80,11 +80,10 @@ 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);
|
|
84
|
-
|
|
83
|
+
var defaultOption = (0, _get2.default)((0, _getPrototypeOf2.default)(PopperControl.prototype), "getDefault", this).call(this, option);
|
|
85
84
|
var position = (_option$position = option === null || option === void 0 ? void 0 : option.position) !== null && _option$position !== void 0 ? _option$position : defaultOption.position;
|
|
86
85
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(PopperControl.prototype), "getDefault", this).call(this, option)), {}, {
|
|
87
|
-
popperPlacement: PopperPlacementMap[position],
|
|
86
|
+
popperPlacement: position instanceof Element ? 'bottom' : PopperPlacementMap[position],
|
|
88
87
|
popperTrigger: 'click'
|
|
89
88
|
});
|
|
90
89
|
}
|
|
@@ -108,10 +107,8 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
|
|
|
108
107
|
var _this$controlOption = this.controlOption,
|
|
109
108
|
popperClassName = _this$controlOption.popperClassName,
|
|
110
109
|
popperPlacement = _this$controlOption.popperPlacement,
|
|
111
|
-
popperTrigger = _this$controlOption.popperTrigger;
|
|
112
|
-
|
|
113
|
-
var popperContainer = this.mapsService.getMapContainer(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
114
|
-
|
|
110
|
+
popperTrigger = _this$controlOption.popperTrigger;
|
|
111
|
+
var popperContainer = this.mapsService.getMapContainer();
|
|
115
112
|
this.popper = new _popper.Popper(this.button, {
|
|
116
113
|
className: popperClassName,
|
|
117
114
|
placement: popperPlacement,
|
|
@@ -132,7 +132,6 @@ 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
|
|
136
135
|
var optionValue = optionDOM.getAttribute(SelectControlConstant.OptionValueAttrKey);
|
|
137
136
|
var checkboxDOM = _this2.getIsMultiple() ? optionDOM.querySelector('input[type=checkbox]') : undefined;
|
|
138
137
|
|
|
@@ -136,8 +136,7 @@ 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);
|
|
140
|
-
|
|
139
|
+
button.addEventListener('click', this.onClick);
|
|
141
140
|
this.mapContainer = _l7Utils.DOM.getContainer(this.scene.getSceneConfig().id);
|
|
142
141
|
this.mapContainer.addEventListener('fullscreenchange', this.onFullscreenChange);
|
|
143
142
|
return button;
|
package/lib/popup/layerPopup.js
CHANGED
|
@@ -202,8 +202,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
202
202
|
if (!this.isShow) {
|
|
203
203
|
this.show();
|
|
204
204
|
}
|
|
205
|
-
}
|
|
206
|
-
|
|
205
|
+
}
|
|
207
206
|
}, {
|
|
208
207
|
key: "onLayerMouseOut",
|
|
209
208
|
value: function onLayerMouseOut(layer, e) {
|
package/lib/popup/popup.js
CHANGED
|
@@ -474,8 +474,7 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
474
474
|
}
|
|
475
475
|
}, {
|
|
476
476
|
key: "getDefault",
|
|
477
|
-
value:
|
|
478
|
-
function getDefault(option) {
|
|
477
|
+
value: function getDefault(option) {
|
|
479
478
|
// tslint:disable-next-line:no-object-literal-type-assertion
|
|
480
479
|
return {
|
|
481
480
|
closeButton: true,
|
|
@@ -529,7 +528,6 @@ var Popup = /*#__PURE__*/function (_EventEmitter) {
|
|
|
529
528
|
}, {
|
|
530
529
|
key: "updateFollowCursor",
|
|
531
530
|
value: function updateFollowCursor(onlyClear) {
|
|
532
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
533
531
|
var container = this.mapsService.getContainer();
|
|
534
532
|
container.removeEventListener('mousemove', this.onMouseMove);
|
|
535
533
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.4",
|
|
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.4",
|
|
30
|
+
"@antv/l7-utils": "2.10.4",
|
|
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.4",
|
|
40
40
|
"gcoord": "^0.3.2",
|
|
41
41
|
"less": "^4.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "4b25604adb5e066ef9779b3c52ae759a76c563c1",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|