@antv/l7-component 2.20.0 → 2.20.2
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.
|
@@ -13,7 +13,9 @@ import { createL7Icon } from "../utils/icon";
|
|
|
13
13
|
import SelectControl from "./baseControl/selectControl";
|
|
14
14
|
export { LayerSwitch };
|
|
15
15
|
function isLayerSwitchItem(obj) {
|
|
16
|
-
return obj && obj.
|
|
16
|
+
return Object.keys(obj !== null && obj !== void 0 ? obj : {}).every(function (key) {
|
|
17
|
+
return ['layer', 'name', 'img'].includes(key);
|
|
18
|
+
});
|
|
17
19
|
}
|
|
18
20
|
var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
|
|
19
21
|
_inherits(LayerSwitch, _SelectControl);
|
package/es/popup/layerPopup.js
CHANGED
|
@@ -102,24 +102,26 @@ var LayerPopup = /*#__PURE__*/function (_Popup) {
|
|
|
102
102
|
}, {
|
|
103
103
|
key: "setOptions",
|
|
104
104
|
value: function setOptions(option) {
|
|
105
|
-
var _newOption$items;
|
|
106
105
|
this.unbindLayerEvent();
|
|
107
106
|
var newOption = _objectSpread({}, option);
|
|
108
|
-
var trigger =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
var trigger = newOption.trigger || this.popupOption.trigger;
|
|
108
|
+
var items = newOption.items || this.popupOption.items;
|
|
109
|
+
var isEmptyItems = (items === null || items === void 0 ? void 0 : items.length) === 0;
|
|
110
|
+
newOption.followCursor = trigger === 'hover' && !isEmptyItems;
|
|
112
111
|
_get(_getPrototypeOf(LayerPopup.prototype), "setOptions", this).call(this, newOption);
|
|
113
112
|
this.bindLayerEvent();
|
|
113
|
+
if (isEmptyItems) {
|
|
114
|
+
this.hide();
|
|
115
|
+
}
|
|
114
116
|
return this;
|
|
115
117
|
}
|
|
116
118
|
}, {
|
|
117
119
|
key: "getDefault",
|
|
118
120
|
value: function getDefault(option) {
|
|
119
|
-
var
|
|
121
|
+
var isHoverTrigger = option.trigger === 'hover';
|
|
120
122
|
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(LayerPopup.prototype), "getDefault", this).call(this, option)), {}, {
|
|
121
123
|
trigger: 'hover',
|
|
122
|
-
followCursor:
|
|
124
|
+
followCursor: isHoverTrigger,
|
|
123
125
|
lngLat: {
|
|
124
126
|
lng: 0,
|
|
125
127
|
lat: 0
|
|
@@ -19,7 +19,9 @@ var _selectControl = _interopRequireDefault(require("./baseControl/selectControl
|
|
|
19
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
20
|
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; } }
|
|
21
21
|
function isLayerSwitchItem(obj) {
|
|
22
|
-
return obj && obj.
|
|
22
|
+
return Object.keys(obj !== null && obj !== void 0 ? obj : {}).every(function (key) {
|
|
23
|
+
return ['layer', 'name', 'img'].includes(key);
|
|
24
|
+
});
|
|
23
25
|
}
|
|
24
26
|
var LayerSwitch = exports.default = exports.LayerSwitch = /*#__PURE__*/function (_SelectControl) {
|
|
25
27
|
(0, _inherits2.default)(LayerSwitch, _SelectControl);
|
package/lib/popup/layerPopup.js
CHANGED
|
@@ -108,24 +108,26 @@ var LayerPopup = exports.default = exports.LayerPopup = /*#__PURE__*/function (_
|
|
|
108
108
|
}, {
|
|
109
109
|
key: "setOptions",
|
|
110
110
|
value: function setOptions(option) {
|
|
111
|
-
var _newOption$items;
|
|
112
111
|
this.unbindLayerEvent();
|
|
113
112
|
var newOption = (0, _objectSpread2.default)({}, option);
|
|
114
|
-
var trigger =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
var trigger = newOption.trigger || this.popupOption.trigger;
|
|
114
|
+
var items = newOption.items || this.popupOption.items;
|
|
115
|
+
var isEmptyItems = (items === null || items === void 0 ? void 0 : items.length) === 0;
|
|
116
|
+
newOption.followCursor = trigger === 'hover' && !isEmptyItems;
|
|
118
117
|
(0, _get2.default)((0, _getPrototypeOf2.default)(LayerPopup.prototype), "setOptions", this).call(this, newOption);
|
|
119
118
|
this.bindLayerEvent();
|
|
119
|
+
if (isEmptyItems) {
|
|
120
|
+
this.hide();
|
|
121
|
+
}
|
|
120
122
|
return this;
|
|
121
123
|
}
|
|
122
124
|
}, {
|
|
123
125
|
key: "getDefault",
|
|
124
126
|
value: function getDefault(option) {
|
|
125
|
-
var
|
|
127
|
+
var isHoverTrigger = option.trigger === 'hover';
|
|
126
128
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(LayerPopup.prototype), "getDefault", this).call(this, option)), {}, {
|
|
127
129
|
trigger: 'hover',
|
|
128
|
-
followCursor:
|
|
130
|
+
followCursor: isHoverTrigger,
|
|
129
131
|
lngLat: {
|
|
130
132
|
lng: 0,
|
|
131
133
|
lat: 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.2",
|
|
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.2",
|
|
30
|
+
"@antv/l7-utils": "2.20.2",
|
|
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.2",
|
|
39
|
+
"@antv/l7-test-utils": "2.20.2",
|
|
40
40
|
"gcoord": "^0.3.2",
|
|
41
41
|
"less": "^4.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "c0e21cc20d1530aa586623484a9511636800839f",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|