@antv/l7-component 2.10.3 → 2.10.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.
- package/es/control/baseControl/buttonControl.d.ts +3 -3
- 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/control/zoom.d.ts +3 -3
- package/es/popup/layerPopup.d.ts +12 -11
- package/es/popup/layerPopup.js +33 -22
- 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 +33 -20
- package/lib/popup/popup.js +1 -3
- package/package.json +5 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DOM } from '@antv/l7-utils';
|
|
2
2
|
import Control, { IControlOption } from './control';
|
|
3
3
|
export { ButtonControl };
|
|
4
4
|
export interface IButtonControlOption extends IControlOption {
|
|
5
|
-
btnIcon?: ELType | DocumentFragment;
|
|
5
|
+
btnIcon?: DOM.ELType | DocumentFragment;
|
|
6
6
|
btnText?: string;
|
|
7
7
|
title?: string;
|
|
8
8
|
vertical?: boolean;
|
|
@@ -27,7 +27,7 @@ export default class ButtonControl<O extends IButtonControlOption = IButtonContr
|
|
|
27
27
|
* 按钮中图标对应的 DOM
|
|
28
28
|
* @protected
|
|
29
29
|
*/
|
|
30
|
-
protected buttonIcon?: ELType | DocumentFragment;
|
|
30
|
+
protected buttonIcon?: DOM.ELType | DocumentFragment;
|
|
31
31
|
/**
|
|
32
32
|
* 设置当前按钮
|
|
33
33
|
* @param newIsDisable
|
|
@@ -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/control/zoom.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PositionType } from '@antv/l7-core';
|
|
2
|
-
import {
|
|
2
|
+
import { DOM } from '@antv/l7-utils';
|
|
3
3
|
import { Control, IControlOption } from './baseControl';
|
|
4
4
|
export interface IZoomControlOption extends IControlOption {
|
|
5
|
-
zoomInText: ELType | string;
|
|
5
|
+
zoomInText: DOM.ELType | string;
|
|
6
6
|
zoomInTitle: string;
|
|
7
|
-
zoomOutText: ELType | string;
|
|
7
|
+
zoomOutText: DOM.ELType | string;
|
|
8
8
|
zoomOutTitle: string;
|
|
9
9
|
}
|
|
10
10
|
export { Zoom };
|
package/es/popup/layerPopup.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
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 = {
|
|
6
5
|
field: string;
|
|
7
|
-
formatField?: (field: string) => string;
|
|
8
|
-
formatValue?: (value: any) => any;
|
|
6
|
+
formatField?: ((field: string) => string) | string;
|
|
7
|
+
formatValue?: ((value: any) => any) | string;
|
|
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 {
|
|
16
|
-
config
|
|
15
|
+
config?: LayerPopupConfigItem[];
|
|
16
|
+
items?: LayerPopupConfigItem[];
|
|
17
17
|
trigger: 'hover' | 'click';
|
|
18
18
|
}
|
|
19
19
|
declare type LayerMapInfo = {
|
|
20
|
-
onMouseMove?: (layer:
|
|
21
|
-
onMouseOut?: (layer:
|
|
22
|
-
onClick?: (layer:
|
|
23
|
-
onSourceUpdate?: (layer:
|
|
20
|
+
onMouseMove?: (layer: ILayer, e: any) => void;
|
|
21
|
+
onMouseOut?: (layer: ILayer, e: any) => void;
|
|
22
|
+
onClick?: (layer: ILayer, e: any) => void;
|
|
23
|
+
onSourceUpdate?: (layer: ILayer) => void;
|
|
24
24
|
} & Partial<LayerPopupConfigItem>;
|
|
25
25
|
export { LayerPopup };
|
|
26
26
|
export default class LayerPopup extends Popup<ILayerPopupOption> {
|
|
@@ -37,6 +37,7 @@ export default class LayerPopup extends Popup<ILayerPopupOption> {
|
|
|
37
37
|
layer: ILayer;
|
|
38
38
|
featureId: number;
|
|
39
39
|
};
|
|
40
|
+
protected get layerConfigItems(): LayerPopupConfigItem[];
|
|
40
41
|
addTo(scene: Container): this;
|
|
41
42
|
remove(): this;
|
|
42
43
|
setOptions(option: Partial<ILayerPopupOption>): this;
|
|
@@ -64,10 +65,10 @@ export default class LayerPopup extends Popup<ILayerPopupOption> {
|
|
|
64
65
|
protected getLayerInfoFrag(layer: ILayer, e: any): DocumentFragment;
|
|
65
66
|
/**
|
|
66
67
|
* 通过 Layer 配置访问到真实的 Layer 实例
|
|
67
|
-
* @param
|
|
68
|
+
* @param configItem
|
|
68
69
|
* @protected
|
|
69
70
|
*/
|
|
70
|
-
protected getLayerByConfig(
|
|
71
|
+
protected getLayerByConfig(configItem: LayerPopupConfigItem): ILayer | undefined;
|
|
71
72
|
/**
|
|
72
73
|
* 判断当前展示的 Feature 是否和上一次查看的一致
|
|
73
74
|
* @param layer
|
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
|
|
|
@@ -42,6 +40,16 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
_createClass(LayerPopup, [{
|
|
43
|
+
key: "layerConfigItems",
|
|
44
|
+
get: function get() {
|
|
45
|
+
var _ref;
|
|
46
|
+
|
|
47
|
+
var _this$popupOption = this.popupOption,
|
|
48
|
+
config = _this$popupOption.config,
|
|
49
|
+
items = _this$popupOption.items;
|
|
50
|
+
return (_ref = config !== null && config !== void 0 ? config : items) !== null && _ref !== void 0 ? _ref : [];
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
45
53
|
key: "addTo",
|
|
46
54
|
value: function addTo(scene) {
|
|
47
55
|
_get(_getPrototypeOf(LayerPopup.prototype), "addTo", this).call(this, scene);
|
|
@@ -96,10 +104,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
96
104
|
value: function bindLayerEvent() {
|
|
97
105
|
var _this2 = this;
|
|
98
106
|
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
var trigger = this.popupOption.trigger;
|
|
108
|
+
this.layerConfigItems.forEach(function (configItem) {
|
|
109
|
+
var _layer$getSource;
|
|
110
|
+
|
|
103
111
|
var layer = _this2.getLayerByConfig(configItem);
|
|
104
112
|
|
|
105
113
|
if (!layer) {
|
|
@@ -124,7 +132,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
124
132
|
layer === null || layer === void 0 ? void 0 : layer.on('click', onClick);
|
|
125
133
|
}
|
|
126
134
|
|
|
127
|
-
var source = layer.getSource();
|
|
135
|
+
var source = layer === null || layer === void 0 ? void 0 : (_layer$getSource = layer.getSource) === null || _layer$getSource === void 0 ? void 0 : _layer$getSource.call(layer);
|
|
128
136
|
|
|
129
137
|
var onSourceUpdate = _this2.onSourceUpdate.bind(_this2, layer);
|
|
130
138
|
|
|
@@ -144,8 +152,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
144
152
|
value: function unbindLayerEvent() {
|
|
145
153
|
var _this3 = this;
|
|
146
154
|
|
|
147
|
-
|
|
148
|
-
config.forEach(function (configItem) {
|
|
155
|
+
this.layerConfigItems.forEach(function (configItem) {
|
|
149
156
|
var layer = _this3.getLayerByConfig(configItem);
|
|
150
157
|
|
|
151
158
|
var layerInfo = layer && _this3.layerConfigMap.get(layer);
|
|
@@ -172,9 +179,9 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
172
179
|
}
|
|
173
180
|
|
|
174
181
|
if (onSourceUpdate) {
|
|
175
|
-
var _layer$
|
|
182
|
+
var _layer$getSource2;
|
|
176
183
|
|
|
177
|
-
layer === null || layer === void 0 ? void 0 : (_layer$
|
|
184
|
+
layer === null || layer === void 0 ? void 0 : (_layer$getSource2 = layer.getSource()) === null || _layer$getSource2 === void 0 ? void 0 : _layer$getSource2.off('update', onSourceUpdate);
|
|
178
185
|
}
|
|
179
186
|
});
|
|
180
187
|
}
|
|
@@ -193,8 +200,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
193
200
|
if (!this.isShow) {
|
|
194
201
|
this.show();
|
|
195
202
|
}
|
|
196
|
-
}
|
|
197
|
-
|
|
203
|
+
}
|
|
198
204
|
}, {
|
|
199
205
|
key: "onLayerMouseOut",
|
|
200
206
|
value: function onLayerMouseOut(layer, e) {
|
|
@@ -252,17 +258,22 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
252
258
|
|
|
253
259
|
var fields = layerInfo.fields;
|
|
254
260
|
fields === null || fields === void 0 ? void 0 : fields.forEach(function (fieldConfig) {
|
|
255
|
-
var
|
|
261
|
+
var _ref3, _ref4;
|
|
262
|
+
|
|
263
|
+
var _ref2 = typeof fieldConfig === 'string' ? // tslint:disable-next-line:no-object-literal-type-assertion
|
|
264
|
+
{
|
|
256
265
|
field: fieldConfig
|
|
257
266
|
} : fieldConfig,
|
|
258
|
-
field =
|
|
259
|
-
formatField =
|
|
260
|
-
formatValue =
|
|
261
|
-
getValue =
|
|
267
|
+
field = _ref2.field,
|
|
268
|
+
formatField = _ref2.formatField,
|
|
269
|
+
formatValue = _ref2.formatValue,
|
|
270
|
+
getValue = _ref2.getValue;
|
|
262
271
|
|
|
263
272
|
var row = DOM.create('div', 'l7-layer-popup__row');
|
|
264
273
|
var value = getValue ? getValue(e.feature) : get(_feature, field);
|
|
265
|
-
|
|
274
|
+
var fieldText = (_ref3 = formatField instanceof Function ? formatField(field) : formatField) !== null && _ref3 !== void 0 ? _ref3 : field;
|
|
275
|
+
var valueText = (_ref4 = formatValue instanceof Function ? formatValue(value) : formatValue) !== null && _ref4 !== void 0 ? _ref4 : value;
|
|
276
|
+
row.innerHTML = "<span class=\"l7-layer-popup__key\">".concat(fieldText, "</span>: <span class=\"l7-layer-popup__value\">").concat(valueText, "</span>");
|
|
266
277
|
frag.appendChild(row);
|
|
267
278
|
});
|
|
268
279
|
}
|
|
@@ -271,14 +282,14 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
271
282
|
}
|
|
272
283
|
/**
|
|
273
284
|
* 通过 Layer 配置访问到真实的 Layer 实例
|
|
274
|
-
* @param
|
|
285
|
+
* @param configItem
|
|
275
286
|
* @protected
|
|
276
287
|
*/
|
|
277
288
|
|
|
278
289
|
}, {
|
|
279
290
|
key: "getLayerByConfig",
|
|
280
|
-
value: function getLayerByConfig(
|
|
281
|
-
var layer =
|
|
291
|
+
value: function getLayerByConfig(configItem) {
|
|
292
|
+
var layer = configItem.layer;
|
|
282
293
|
|
|
283
294
|
if (layer instanceof Object) {
|
|
284
295
|
return layer;
|
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
|
@@ -55,6 +55,16 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
(0, _createClass2.default)(LayerPopup, [{
|
|
58
|
+
key: "layerConfigItems",
|
|
59
|
+
get: function get() {
|
|
60
|
+
var _ref;
|
|
61
|
+
|
|
62
|
+
var _this$popupOption = this.popupOption,
|
|
63
|
+
config = _this$popupOption.config,
|
|
64
|
+
items = _this$popupOption.items;
|
|
65
|
+
return (_ref = config !== null && config !== void 0 ? config : items) !== null && _ref !== void 0 ? _ref : [];
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
58
68
|
key: "addTo",
|
|
59
69
|
value: function addTo(scene) {
|
|
60
70
|
(0, _get2.default)((0, _getPrototypeOf2.default)(LayerPopup.prototype), "addTo", this).call(this, scene);
|
|
@@ -105,10 +115,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
105
115
|
value: function bindLayerEvent() {
|
|
106
116
|
var _this2 = this;
|
|
107
117
|
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
var trigger = this.popupOption.trigger;
|
|
119
|
+
this.layerConfigItems.forEach(function (configItem) {
|
|
120
|
+
var _layer$getSource;
|
|
121
|
+
|
|
112
122
|
var layer = _this2.getLayerByConfig(configItem);
|
|
113
123
|
|
|
114
124
|
if (!layer) {
|
|
@@ -133,7 +143,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
133
143
|
layer === null || layer === void 0 ? void 0 : layer.on('click', onClick);
|
|
134
144
|
}
|
|
135
145
|
|
|
136
|
-
var source = layer.getSource();
|
|
146
|
+
var source = layer === null || layer === void 0 ? void 0 : (_layer$getSource = layer.getSource) === null || _layer$getSource === void 0 ? void 0 : _layer$getSource.call(layer);
|
|
137
147
|
|
|
138
148
|
var onSourceUpdate = _this2.onSourceUpdate.bind(_this2, layer);
|
|
139
149
|
|
|
@@ -153,8 +163,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
153
163
|
value: function unbindLayerEvent() {
|
|
154
164
|
var _this3 = this;
|
|
155
165
|
|
|
156
|
-
|
|
157
|
-
config.forEach(function (configItem) {
|
|
166
|
+
this.layerConfigItems.forEach(function (configItem) {
|
|
158
167
|
var layer = _this3.getLayerByConfig(configItem);
|
|
159
168
|
|
|
160
169
|
var layerInfo = layer && _this3.layerConfigMap.get(layer);
|
|
@@ -181,9 +190,9 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
181
190
|
}
|
|
182
191
|
|
|
183
192
|
if (onSourceUpdate) {
|
|
184
|
-
var _layer$
|
|
193
|
+
var _layer$getSource2;
|
|
185
194
|
|
|
186
|
-
layer === null || layer === void 0 ? void 0 : (_layer$
|
|
195
|
+
layer === null || layer === void 0 ? void 0 : (_layer$getSource2 = layer.getSource()) === null || _layer$getSource2 === void 0 ? void 0 : _layer$getSource2.off('update', onSourceUpdate);
|
|
187
196
|
}
|
|
188
197
|
});
|
|
189
198
|
}
|
|
@@ -202,8 +211,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
202
211
|
if (!this.isShow) {
|
|
203
212
|
this.show();
|
|
204
213
|
}
|
|
205
|
-
}
|
|
206
|
-
|
|
214
|
+
}
|
|
207
215
|
}, {
|
|
208
216
|
key: "onLayerMouseOut",
|
|
209
217
|
value: function onLayerMouseOut(layer, e) {
|
|
@@ -261,18 +269,23 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
261
269
|
|
|
262
270
|
var fields = layerInfo.fields;
|
|
263
271
|
fields === null || fields === void 0 ? void 0 : fields.forEach(function (fieldConfig) {
|
|
264
|
-
var
|
|
272
|
+
var _ref3, _ref4;
|
|
273
|
+
|
|
274
|
+
var _ref2 = typeof fieldConfig === 'string' ? // tslint:disable-next-line:no-object-literal-type-assertion
|
|
275
|
+
{
|
|
265
276
|
field: fieldConfig
|
|
266
277
|
} : fieldConfig,
|
|
267
|
-
field =
|
|
268
|
-
formatField =
|
|
269
|
-
formatValue =
|
|
270
|
-
getValue =
|
|
278
|
+
field = _ref2.field,
|
|
279
|
+
formatField = _ref2.formatField,
|
|
280
|
+
formatValue = _ref2.formatValue,
|
|
281
|
+
getValue = _ref2.getValue;
|
|
271
282
|
|
|
272
283
|
var row = _l7Utils.DOM.create('div', 'l7-layer-popup__row');
|
|
273
284
|
|
|
274
285
|
var value = getValue ? getValue(e.feature) : (0, _lodash.get)(_feature, field);
|
|
275
|
-
|
|
286
|
+
var fieldText = (_ref3 = formatField instanceof Function ? formatField(field) : formatField) !== null && _ref3 !== void 0 ? _ref3 : field;
|
|
287
|
+
var valueText = (_ref4 = formatValue instanceof Function ? formatValue(value) : formatValue) !== null && _ref4 !== void 0 ? _ref4 : value;
|
|
288
|
+
row.innerHTML = "<span class=\"l7-layer-popup__key\">".concat(fieldText, "</span>: <span class=\"l7-layer-popup__value\">").concat(valueText, "</span>");
|
|
276
289
|
frag.appendChild(row);
|
|
277
290
|
});
|
|
278
291
|
}
|
|
@@ -281,14 +294,14 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
281
294
|
}
|
|
282
295
|
/**
|
|
283
296
|
* 通过 Layer 配置访问到真实的 Layer 实例
|
|
284
|
-
* @param
|
|
297
|
+
* @param configItem
|
|
285
298
|
* @protected
|
|
286
299
|
*/
|
|
287
300
|
|
|
288
301
|
}, {
|
|
289
302
|
key: "getLayerByConfig",
|
|
290
|
-
value: function getLayerByConfig(
|
|
291
|
-
var layer =
|
|
303
|
+
value: function getLayerByConfig(configItem) {
|
|
304
|
+
var layer = configItem.layer;
|
|
292
305
|
|
|
293
306
|
if (layer instanceof Object) {
|
|
294
307
|
return layer;
|
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.5",
|
|
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.5",
|
|
30
|
+
"@antv/l7-utils": "2.10.5",
|
|
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.5",
|
|
40
40
|
"gcoord": "^0.3.2",
|
|
41
41
|
"less": "^4.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "64bee613c3e1daedad46cb78de9a85b992392209",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|