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