@antv/l7-component 2.20.12 → 2.20.14
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.
|
@@ -17,7 +17,7 @@ export default class LayerSwitch extends SelectControl<ILayerSwitchOption> {
|
|
|
17
17
|
getLayerVisible(): string[];
|
|
18
18
|
getLayerOptions(): ControlOptionItem[];
|
|
19
19
|
setOptions(option: Partial<ILayerSwitchOption>): void;
|
|
20
|
-
private
|
|
20
|
+
private handleSingleSelection;
|
|
21
21
|
onAdd(): HTMLElement;
|
|
22
22
|
onRemove(): void;
|
|
23
23
|
protected onLayerChange: () => void;
|
|
@@ -143,7 +143,7 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
|
|
|
143
143
|
_get(_getPrototypeOf(LayerSwitch.prototype), "setOptions", this).call(this, option);
|
|
144
144
|
if (isLayerChange) {
|
|
145
145
|
if (this.controlOption.multiple === false) {
|
|
146
|
-
this.
|
|
146
|
+
this.handleSingleSelection();
|
|
147
147
|
}
|
|
148
148
|
this.selectValue = this.getLayerVisible();
|
|
149
149
|
this.controlOption.options = this.getLayerOptions();
|
|
@@ -154,8 +154,8 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
|
|
|
154
154
|
// TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
|
|
155
155
|
// 如果是单选模式,则只显示第一个图层
|
|
156
156
|
}, {
|
|
157
|
-
key: "
|
|
158
|
-
value: function
|
|
157
|
+
key: "handleSingleSelection",
|
|
158
|
+
value: function handleSingleSelection() {
|
|
159
159
|
this.layers.forEach(function (layer, index) {
|
|
160
160
|
index === 0 ? layer.show() : layer.hide();
|
|
161
161
|
});
|
|
@@ -165,7 +165,7 @@ var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
|
|
|
165
165
|
value: function onAdd() {
|
|
166
166
|
var _this$controlOption$o;
|
|
167
167
|
if (this.controlOption.multiple === false) {
|
|
168
|
-
this.
|
|
168
|
+
this.handleSingleSelection();
|
|
169
169
|
}
|
|
170
170
|
if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
|
|
171
171
|
this.controlOption.options = this.getLayerOptions();
|
package/es/popup/layerPopup.d.ts
CHANGED
|
@@ -88,6 +88,11 @@ export default class LayerPopup extends Popup<ILayerPopupOption> {
|
|
|
88
88
|
* @protected
|
|
89
89
|
*/
|
|
90
90
|
protected isSameFeature(layer: ILayer, featureId: number): boolean | undefined;
|
|
91
|
+
protected setDisplayFeatureInfo(displayFeatureInfo?: {
|
|
92
|
+
layer: ILayer;
|
|
93
|
+
featureId: number;
|
|
94
|
+
}): void;
|
|
95
|
+
protected onLayerHide: () => void;
|
|
91
96
|
/**
|
|
92
97
|
* 覆盖 Popup 中的默认的 closeOnClick 行为
|
|
93
98
|
*/
|
package/es/popup/layerPopup.js
CHANGED
|
@@ -46,10 +46,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
46
46
|
_this.setDOMContent(content);
|
|
47
47
|
_this.setLnglat(e.lngLat);
|
|
48
48
|
_this.setTitle(title);
|
|
49
|
-
_this.
|
|
49
|
+
_this.setDisplayFeatureInfo({
|
|
50
50
|
layer: layer,
|
|
51
51
|
featureId: e.featureId
|
|
52
|
-
};
|
|
52
|
+
});
|
|
53
53
|
_this.show();
|
|
54
54
|
}
|
|
55
55
|
});
|
|
@@ -62,6 +62,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "onLayerHide", function () {
|
|
66
|
+
_this.hide();
|
|
67
|
+
_this.setDisplayFeatureInfo(undefined);
|
|
68
|
+
});
|
|
65
69
|
/**
|
|
66
70
|
* 覆盖 Popup 中的默认的 closeOnClick 行为
|
|
67
71
|
*/
|
|
@@ -224,10 +228,10 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
224
228
|
content = _this$getLayerInfoFra2.content;
|
|
225
229
|
this.setDOMContent(content);
|
|
226
230
|
this.setTitle(title);
|
|
227
|
-
this.
|
|
231
|
+
this.setDisplayFeatureInfo({
|
|
228
232
|
layer: layer,
|
|
229
233
|
featureId: e.featureId
|
|
230
|
-
};
|
|
234
|
+
});
|
|
231
235
|
this.show();
|
|
232
236
|
}
|
|
233
237
|
}
|
|
@@ -236,7 +240,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
236
240
|
}, {
|
|
237
241
|
key: "onLayerMouseOut",
|
|
238
242
|
value: function onLayerMouseOut(layer, e) {
|
|
239
|
-
this.
|
|
243
|
+
this.setDisplayFeatureInfo(undefined);
|
|
240
244
|
if (this.isShow) {
|
|
241
245
|
this.hide();
|
|
242
246
|
}
|
|
@@ -245,7 +249,7 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
245
249
|
key: "onSourceUpdate",
|
|
246
250
|
value: function onSourceUpdate() {
|
|
247
251
|
this.hide();
|
|
248
|
-
this.
|
|
252
|
+
this.setDisplayFeatureInfo(undefined);
|
|
249
253
|
}
|
|
250
254
|
|
|
251
255
|
/**
|
|
@@ -345,6 +349,18 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
345
349
|
var displayFeatureInfo = this.displayFeatureInfo;
|
|
346
350
|
return displayFeatureInfo && layer === displayFeatureInfo.layer && featureId === displayFeatureInfo.featureId;
|
|
347
351
|
}
|
|
352
|
+
}, {
|
|
353
|
+
key: "setDisplayFeatureInfo",
|
|
354
|
+
value: function setDisplayFeatureInfo(displayFeatureInfo) {
|
|
355
|
+
var oldDisplayFeatureInfo = this.displayFeatureInfo;
|
|
356
|
+
if (oldDisplayFeatureInfo) {
|
|
357
|
+
oldDisplayFeatureInfo.layer.off('hide', this.onLayerHide);
|
|
358
|
+
}
|
|
359
|
+
if (displayFeatureInfo) {
|
|
360
|
+
displayFeatureInfo.layer.on('hide', this.onLayerHide);
|
|
361
|
+
}
|
|
362
|
+
this.displayFeatureInfo = displayFeatureInfo;
|
|
363
|
+
}
|
|
348
364
|
}]);
|
|
349
365
|
return LayerPopup;
|
|
350
366
|
}(Popup);
|
|
@@ -149,7 +149,7 @@ var LayerSwitch = exports.default = exports.LayerSwitch = /*#__PURE__*/function
|
|
|
149
149
|
(0, _get2.default)((0, _getPrototypeOf2.default)(LayerSwitch.prototype), "setOptions", this).call(this, option);
|
|
150
150
|
if (isLayerChange) {
|
|
151
151
|
if (this.controlOption.multiple === false) {
|
|
152
|
-
this.
|
|
152
|
+
this.handleSingleSelection();
|
|
153
153
|
}
|
|
154
154
|
this.selectValue = this.getLayerVisible();
|
|
155
155
|
this.controlOption.options = this.getLayerOptions();
|
|
@@ -160,8 +160,8 @@ var LayerSwitch = exports.default = exports.LayerSwitch = /*#__PURE__*/function
|
|
|
160
160
|
// TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
|
|
161
161
|
// 如果是单选模式,则只显示第一个图层
|
|
162
162
|
}, {
|
|
163
|
-
key: "
|
|
164
|
-
value: function
|
|
163
|
+
key: "handleSingleSelection",
|
|
164
|
+
value: function handleSingleSelection() {
|
|
165
165
|
this.layers.forEach(function (layer, index) {
|
|
166
166
|
index === 0 ? layer.show() : layer.hide();
|
|
167
167
|
});
|
|
@@ -171,7 +171,7 @@ var LayerSwitch = exports.default = exports.LayerSwitch = /*#__PURE__*/function
|
|
|
171
171
|
value: function onAdd() {
|
|
172
172
|
var _this$controlOption$o;
|
|
173
173
|
if (this.controlOption.multiple === false) {
|
|
174
|
-
this.
|
|
174
|
+
this.handleSingleSelection();
|
|
175
175
|
}
|
|
176
176
|
if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
|
|
177
177
|
this.controlOption.options = this.getLayerOptions();
|
package/lib/popup/layerPopup.js
CHANGED
|
@@ -52,10 +52,10 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
|
|
|
52
52
|
_this.setDOMContent(content);
|
|
53
53
|
_this.setLnglat(e.lngLat);
|
|
54
54
|
_this.setTitle(title);
|
|
55
|
-
_this.
|
|
55
|
+
_this.setDisplayFeatureInfo({
|
|
56
56
|
layer: layer,
|
|
57
57
|
featureId: e.featureId
|
|
58
|
-
};
|
|
58
|
+
});
|
|
59
59
|
_this.show();
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -68,6 +68,10 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onLayerHide", function () {
|
|
72
|
+
_this.hide();
|
|
73
|
+
_this.setDisplayFeatureInfo(undefined);
|
|
74
|
+
});
|
|
71
75
|
/**
|
|
72
76
|
* 覆盖 Popup 中的默认的 closeOnClick 行为
|
|
73
77
|
*/
|
|
@@ -230,10 +234,10 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
|
|
|
230
234
|
content = _this$getLayerInfoFra2.content;
|
|
231
235
|
this.setDOMContent(content);
|
|
232
236
|
this.setTitle(title);
|
|
233
|
-
this.
|
|
237
|
+
this.setDisplayFeatureInfo({
|
|
234
238
|
layer: layer,
|
|
235
239
|
featureId: e.featureId
|
|
236
|
-
};
|
|
240
|
+
});
|
|
237
241
|
this.show();
|
|
238
242
|
}
|
|
239
243
|
}
|
|
@@ -242,7 +246,7 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
|
|
|
242
246
|
}, {
|
|
243
247
|
key: "onLayerMouseOut",
|
|
244
248
|
value: function onLayerMouseOut(layer, e) {
|
|
245
|
-
this.
|
|
249
|
+
this.setDisplayFeatureInfo(undefined);
|
|
246
250
|
if (this.isShow) {
|
|
247
251
|
this.hide();
|
|
248
252
|
}
|
|
@@ -251,7 +255,7 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
|
|
|
251
255
|
key: "onSourceUpdate",
|
|
252
256
|
value: function onSourceUpdate() {
|
|
253
257
|
this.hide();
|
|
254
|
-
this.
|
|
258
|
+
this.setDisplayFeatureInfo(undefined);
|
|
255
259
|
}
|
|
256
260
|
|
|
257
261
|
/**
|
|
@@ -351,6 +355,18 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
|
|
|
351
355
|
var displayFeatureInfo = this.displayFeatureInfo;
|
|
352
356
|
return displayFeatureInfo && layer === displayFeatureInfo.layer && featureId === displayFeatureInfo.featureId;
|
|
353
357
|
}
|
|
358
|
+
}, {
|
|
359
|
+
key: "setDisplayFeatureInfo",
|
|
360
|
+
value: function setDisplayFeatureInfo(displayFeatureInfo) {
|
|
361
|
+
var oldDisplayFeatureInfo = this.displayFeatureInfo;
|
|
362
|
+
if (oldDisplayFeatureInfo) {
|
|
363
|
+
oldDisplayFeatureInfo.layer.off('hide', this.onLayerHide);
|
|
364
|
+
}
|
|
365
|
+
if (displayFeatureInfo) {
|
|
366
|
+
displayFeatureInfo.layer.on('hide', this.onLayerHide);
|
|
367
|
+
}
|
|
368
|
+
this.displayFeatureInfo = displayFeatureInfo;
|
|
369
|
+
}
|
|
354
370
|
}]);
|
|
355
371
|
return LayerPopup;
|
|
356
372
|
}(_popup.default);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.14",
|
|
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.20.
|
|
30
|
-
"@antv/l7-utils": "2.20.
|
|
29
|
+
"@antv/l7-core": "2.20.14",
|
|
30
|
+
"@antv/l7-utils": "2.20.14",
|
|
31
31
|
"@babel/runtime": "^7.7.7",
|
|
32
32
|
"eventemitter3": "^4.0.0",
|
|
33
33
|
"inversify": "^5.0.1",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"supercluster": "^7.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@antv/l7-layers": "2.20.
|
|
39
|
-
"@antv/l7-test-utils": "2.20.
|
|
38
|
+
"@antv/l7-layers": "2.20.14",
|
|
39
|
+
"@antv/l7-test-utils": "2.20.14",
|
|
40
40
|
"gcoord": "^0.3.2",
|
|
41
41
|
"less": "^4.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ad997ac14616fa503fec4022f1a1a48747524f87",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|