@antv/l7-component 2.21.1 → 2.21.3
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/assets/iconfont/iconfont.js +6 -6
- package/es/constants/index.js +2 -2
- package/es/control/baseControl/buttonControl.js +109 -144
- package/es/control/baseControl/control.js +212 -258
- package/es/control/baseControl/popperControl.js +67 -95
- package/es/control/baseControl/selectControl.js +132 -178
- package/es/control/exportImage.js +59 -142
- package/es/control/fullscreen.js +69 -100
- package/es/control/geoLocate.js +37 -84
- package/es/control/layerSwitch.js +111 -154
- package/es/control/logo.js +43 -69
- package/es/control/mapTheme.js +57 -98
- package/es/control/mouseLocation.js +37 -69
- package/es/control/scale.js +107 -135
- package/es/control/swipe.js +297 -389
- package/es/control/zoom.js +80 -112
- package/es/css/index.css +10 -7
- package/es/index.js +675 -1
- package/es/marker-layer.js +275 -326
- package/es/marker.js +394 -446
- package/es/popup/layerPopup.js +277 -321
- package/es/popup/popup.js +422 -482
- package/es/utils/anchor.js +6 -6
- package/es/utils/icon.js +4 -4
- package/es/utils/popper.js +180 -196
- package/es/utils/screenfull.js +29 -51
- package/lib/assets/iconfont/iconfont.js +6 -6
- package/lib/constants/index.d.ts +60 -0
- package/lib/constants/index.js +2 -2
- package/lib/control/baseControl/buttonControl.d.ts +60 -0
- package/lib/control/baseControl/buttonControl.js +110 -143
- package/lib/control/baseControl/control.d.ts +112 -0
- package/lib/control/baseControl/control.js +213 -257
- package/lib/control/baseControl/index.d.ts +4 -0
- package/lib/control/baseControl/index.js +5 -5
- package/lib/control/baseControl/popperControl.d.ts +28 -0
- package/lib/control/baseControl/popperControl.js +68 -94
- package/lib/control/baseControl/selectControl.d.ts +53 -0
- package/lib/control/baseControl/selectControl.js +133 -177
- package/lib/control/exportImage.d.ts +19 -0
- package/lib/control/exportImage.js +60 -141
- package/lib/control/fullscreen.d.ts +20 -0
- package/lib/control/fullscreen.js +70 -99
- package/lib/control/geoLocate.d.ts +17 -0
- package/lib/control/geoLocate.js +38 -83
- package/lib/control/layerSwitch.d.ts +27 -0
- package/lib/control/layerSwitch.js +112 -153
- package/lib/control/logo.d.ts +14 -0
- package/lib/control/logo.js +44 -69
- package/lib/control/mapTheme.d.ts +11 -0
- package/lib/control/mapTheme.js +58 -97
- package/lib/control/mouseLocation.d.ts +16 -0
- package/lib/control/mouseLocation.js +38 -68
- package/lib/control/scale.d.ts +35 -0
- package/lib/control/scale.js +108 -134
- package/lib/control/swipe.d.ts +66 -0
- package/lib/control/swipe.js +298 -388
- package/lib/control/zoom.d.ts +39 -0
- package/lib/control/zoom.js +81 -111
- package/lib/css/index.css +10 -7
- package/lib/index.d.ts +19 -0
- package/lib/index.js +691 -17
- package/lib/interface.d.ts +18 -0
- package/lib/marker-layer.d.ts +55 -0
- package/lib/marker-layer.js +277 -324
- package/lib/marker.d.ts +58 -0
- package/lib/marker.js +395 -445
- package/lib/popup/layerPopup.d.ts +99 -0
- package/lib/popup/layerPopup.js +278 -320
- package/lib/popup/popup.d.ts +142 -0
- package/lib/popup/popup.js +423 -481
- package/lib/utils/anchor.d.ts +22 -0
- package/lib/utils/anchor.js +6 -6
- package/lib/utils/icon.d.ts +1 -0
- package/lib/utils/icon.js +6 -5
- package/lib/utils/popper.d.ts +76 -0
- package/lib/utils/popper.js +184 -196
- package/lib/utils/screenfull.d.ts +2 -0
- package/lib/utils/screenfull.js +29 -52
- package/package.json +16 -20
package/lib/utils/screenfull.js
CHANGED
|
@@ -1,105 +1,86 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
7
|
// @ts-nocheck
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
const methodMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
|
|
15
10
|
// New WebKit
|
|
16
11
|
['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
|
|
17
12
|
// Old WebKit
|
|
18
13
|
['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
|
|
19
|
-
|
|
14
|
+
const nativeAPI = (() => {
|
|
20
15
|
if (typeof document === 'undefined') {
|
|
21
16
|
return false;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for (
|
|
26
|
-
|
|
27
|
-
var exitFullscreenMethod = methodList === null || methodList === void 0 ? void 0 : methodList[1];
|
|
18
|
+
const unprefixedMethods = methodMap[0];
|
|
19
|
+
const returnValue = {};
|
|
20
|
+
for (const methodList of methodMap) {
|
|
21
|
+
const exitFullscreenMethod = methodList === null || methodList === void 0 ? void 0 : methodList[1];
|
|
28
22
|
if (exitFullscreenMethod in document) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
33
|
-
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
|
|
34
|
-
index = _step$value[0],
|
|
35
|
-
method = _step$value[1];
|
|
36
|
-
returnValue[unprefixedMethods[index]] = method;
|
|
37
|
-
}
|
|
38
|
-
} catch (err) {
|
|
39
|
-
_iterator.e(err);
|
|
40
|
-
} finally {
|
|
41
|
-
_iterator.f();
|
|
23
|
+
for (const [index, method] of methodList.entries()) {
|
|
24
|
+
returnValue[unprefixedMethods[index]] = method;
|
|
42
25
|
}
|
|
43
26
|
return returnValue;
|
|
44
27
|
}
|
|
45
28
|
}
|
|
46
29
|
return false;
|
|
47
|
-
}();
|
|
48
|
-
|
|
30
|
+
})();
|
|
31
|
+
const eventNameMap = {
|
|
49
32
|
change: nativeAPI.fullscreenchange,
|
|
50
33
|
error: nativeAPI.fullscreenerror
|
|
51
34
|
};
|
|
52
|
-
|
|
35
|
+
let screenfull = {
|
|
53
36
|
// eslint-disable-next-line default-param-last
|
|
54
|
-
request
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return new Promise(function (resolve, reject) {
|
|
58
|
-
var onFullScreenEntered = function onFullScreenEntered() {
|
|
37
|
+
request(element = document.documentElement, options) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const onFullScreenEntered = () => {
|
|
59
40
|
screenfull.off('change', onFullScreenEntered);
|
|
60
41
|
resolve();
|
|
61
42
|
};
|
|
62
43
|
screenfull.on('change', onFullScreenEntered);
|
|
63
|
-
|
|
44
|
+
const returnPromise = element[nativeAPI.requestFullscreen](options);
|
|
64
45
|
if (returnPromise instanceof Promise) {
|
|
65
46
|
returnPromise.then(onFullScreenEntered).catch(reject);
|
|
66
47
|
}
|
|
67
48
|
});
|
|
68
49
|
},
|
|
69
|
-
exit
|
|
70
|
-
return new Promise(
|
|
50
|
+
exit() {
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
71
52
|
if (!screenfull.isFullscreen) {
|
|
72
53
|
resolve();
|
|
73
54
|
return;
|
|
74
55
|
}
|
|
75
|
-
|
|
56
|
+
const onFullScreenExit = () => {
|
|
76
57
|
screenfull.off('change', onFullScreenExit);
|
|
77
58
|
resolve();
|
|
78
59
|
};
|
|
79
60
|
screenfull.on('change', onFullScreenExit);
|
|
80
|
-
|
|
61
|
+
const returnPromise = document[nativeAPI.exitFullscreen]();
|
|
81
62
|
if (returnPromise instanceof Promise) {
|
|
82
63
|
returnPromise.then(onFullScreenExit).catch(reject);
|
|
83
64
|
}
|
|
84
65
|
});
|
|
85
66
|
},
|
|
86
|
-
toggle
|
|
67
|
+
toggle(element, options) {
|
|
87
68
|
return screenfull.isFullscreen ? screenfull.exit() : screenfull.request(element, options);
|
|
88
69
|
},
|
|
89
|
-
onchange
|
|
70
|
+
onchange(callback) {
|
|
90
71
|
screenfull.on('change', callback);
|
|
91
72
|
},
|
|
92
|
-
onerror
|
|
73
|
+
onerror(callback) {
|
|
93
74
|
screenfull.on('error', callback);
|
|
94
75
|
},
|
|
95
|
-
on
|
|
96
|
-
|
|
76
|
+
on(event, callback) {
|
|
77
|
+
const eventName = eventNameMap[event];
|
|
97
78
|
if (eventName) {
|
|
98
79
|
document.addEventListener(eventName, callback, false);
|
|
99
80
|
}
|
|
100
81
|
},
|
|
101
|
-
off
|
|
102
|
-
|
|
82
|
+
off(event, callback) {
|
|
83
|
+
const eventName = eventNameMap[event];
|
|
103
84
|
if (eventName) {
|
|
104
85
|
document.removeEventListener(eventName, callback, false);
|
|
105
86
|
}
|
|
@@ -108,13 +89,11 @@ var screenfull = {
|
|
|
108
89
|
};
|
|
109
90
|
Object.defineProperties(screenfull, {
|
|
110
91
|
isFullscreen: {
|
|
111
|
-
get:
|
|
112
|
-
return Boolean(document[nativeAPI.fullscreenElement]);
|
|
113
|
-
}
|
|
92
|
+
get: () => Boolean(document[nativeAPI.fullscreenElement])
|
|
114
93
|
},
|
|
115
94
|
element: {
|
|
116
95
|
enumerable: true,
|
|
117
|
-
get:
|
|
96
|
+
get: () => {
|
|
118
97
|
var _document$nativeAPI$f;
|
|
119
98
|
return (_document$nativeAPI$f = document[nativeAPI.fullscreenElement]) !== null && _document$nativeAPI$f !== void 0 ? _document$nativeAPI$f : undefined;
|
|
120
99
|
}
|
|
@@ -122,9 +101,7 @@ Object.defineProperties(screenfull, {
|
|
|
122
101
|
isEnabled: {
|
|
123
102
|
enumerable: true,
|
|
124
103
|
// Coerce to boolean in case of old WebKit.
|
|
125
|
-
get:
|
|
126
|
-
return Boolean(document[nativeAPI.fullscreenEnabled]);
|
|
127
|
-
}
|
|
104
|
+
get: () => Boolean(document[nativeAPI.fullscreenEnabled])
|
|
128
105
|
}
|
|
129
106
|
});
|
|
130
107
|
if (!nativeAPI) {
|
package/package.json
CHANGED
|
@@ -1,45 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-component",
|
|
3
|
-
"version": "2.21.
|
|
4
|
-
"description": "",
|
|
5
|
-
"license": "
|
|
6
|
-
"author": "
|
|
3
|
+
"version": "2.21.3",
|
|
4
|
+
"description": "Component for L7",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "https://github.com/orgs/antvis/people",
|
|
7
7
|
"sideEffects": true,
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"module": "es/index.js",
|
|
10
10
|
"types": "es/index.d.ts",
|
|
11
11
|
"files": [
|
|
12
12
|
"lib",
|
|
13
|
-
"es"
|
|
14
|
-
"README.md"
|
|
13
|
+
"es"
|
|
15
14
|
],
|
|
16
15
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"build
|
|
19
|
-
"
|
|
20
|
-
"
|
|
16
|
+
"dev": "father dev",
|
|
17
|
+
"build": "npm run clean && father build",
|
|
18
|
+
"check-deps": "father doctor",
|
|
19
|
+
"lint": "eslint src __tests__",
|
|
20
|
+
"clean": "rimraf dist es lib",
|
|
21
21
|
"less": "lessc src/css/index.less src/css/index.css",
|
|
22
|
-
"
|
|
23
|
-
"sync": "tnpm sync",
|
|
24
|
-
"test": "umi-test --passWithNoTests",
|
|
25
|
-
"tsc": "tsc --project tsconfig.build.json",
|
|
26
|
-
"watch": "BABEL_ENV=cjs babel src --watch --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments"
|
|
22
|
+
"sync": "tnpm sync"
|
|
27
23
|
},
|
|
28
24
|
"dependencies": {
|
|
29
|
-
"@antv/l7-core": "2.21.
|
|
30
|
-
"@antv/l7-
|
|
25
|
+
"@antv/l7-core": "^2.21.3",
|
|
26
|
+
"@antv/l7-layers": "^2.21.3",
|
|
27
|
+
"@antv/l7-utils": "^2.21.3",
|
|
31
28
|
"@babel/runtime": "^7.7.7",
|
|
32
29
|
"eventemitter3": "^4.0.0",
|
|
33
30
|
"supercluster": "^7.0.0"
|
|
34
31
|
},
|
|
35
32
|
"devDependencies": {
|
|
36
|
-
"@antv/l7-
|
|
37
|
-
"@antv/l7-test-utils": "2.21.1",
|
|
33
|
+
"@antv/l7-test-utils": "^2.21.3",
|
|
38
34
|
"gcoord": "^0.3.2",
|
|
39
35
|
"less": "^4.1.3"
|
|
40
36
|
},
|
|
41
37
|
"publishConfig": {
|
|
42
38
|
"access": "public"
|
|
43
39
|
},
|
|
44
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "522dec125e1d49bfe3b7325239bb6c9103311b2d"
|
|
45
41
|
}
|