@antv/l7-component 2.9.32-alpha.2 → 2.9.32-alpha.4
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 +53 -0
- package/es/constants/index.d.ts +60 -0
- package/es/constants/index.js +60 -0
- package/es/control/baseControl/buttonControl.d.ts +59 -0
- package/es/control/baseControl/buttonControl.js +191 -0
- package/es/control/baseControl/control.d.ts +107 -0
- package/es/control/baseControl/control.js +288 -0
- package/es/control/baseControl/index.d.ts +4 -0
- package/es/control/baseControl/index.js +4 -0
- package/es/control/baseControl/popperControl.d.ts +26 -0
- package/es/control/baseControl/popperControl.js +131 -0
- package/es/control/baseControl/selectControl.d.ts +46 -0
- package/es/control/baseControl/selectControl.js +227 -0
- package/es/control/exportImage.d.ts +18 -0
- package/es/control/exportImage.js +163 -0
- package/es/control/fullscreen.d.ts +19 -0
- package/es/control/fullscreen.js +151 -0
- package/es/control/geoLocate.d.ts +16 -0
- package/es/control/geoLocate.js +139 -0
- package/es/control/layerControl.d.ts +21 -0
- package/es/control/layerControl.js +172 -0
- package/es/control/logo.d.ts +13 -0
- package/es/control/logo.js +87 -0
- package/es/control/mapTheme.d.ts +10 -0
- package/es/control/mapTheme.js +135 -0
- package/es/control/mouseLocation.d.ts +15 -0
- package/es/control/mouseLocation.js +104 -0
- package/es/control/scale.d.ts +34 -0
- package/es/control/scale.js +172 -0
- package/es/control/zoom.d.ts +34 -0
- package/es/control/zoom.js +146 -0
- package/es/css/button.less +70 -0
- package/es/css/control.less +71 -0
- package/es/css/index.css +567 -0
- package/es/css/index.less +12 -0
- package/es/css/l7.less +60 -0
- package/es/css/layerPopup.less +8 -0
- package/es/css/logo.less +18 -0
- package/es/css/mouseLocation.less +9 -0
- package/es/css/popper.less +64 -0
- package/es/css/popup.less +169 -0
- package/es/css/scale.less +34 -0
- package/es/css/select.less +86 -0
- package/es/css/variables.less +28 -0
- package/es/css/zoom.less +21 -0
- package/es/images/layers.png +0 -0
- package/es/images/layers.svg +1 -0
- package/es/images/logo.png +0 -0
- package/es/images/quanping.svg +12 -0
- package/es/index.d.ts +18 -0
- package/es/index.js +59 -0
- package/es/interface.d.ts +18 -0
- package/es/interface.js +1 -0
- package/es/marker-layer.d.ts +53 -0
- package/es/marker-layer.js +363 -0
- package/es/marker.d.ts +49 -0
- package/es/marker.js +434 -0
- package/es/popup/layerPopup.d.ts +78 -0
- package/es/popup/layerPopup.js +308 -0
- package/es/popup/popup.d.ts +147 -0
- package/es/popup/popup.js +636 -0
- package/es/utils/anchor.d.ts +22 -0
- package/es/utils/anchor.js +35 -0
- package/es/utils/icon.d.ts +1 -0
- package/es/utils/icon.js +9 -0
- package/es/utils/popper.d.ts +75 -0
- package/es/utils/popper.js +286 -0
- package/es/utils/screenfull.d.ts +2 -0
- package/es/utils/screenfull.js +157 -0
- package/lib/assets/iconfont/iconfont.js +39 -0
- package/lib/constants/index.js +90 -0
- package/lib/control/baseControl/buttonControl.js +118 -0
- package/lib/control/baseControl/control.js +172 -0
- package/lib/control/baseControl/index.js +22 -0
- package/lib/control/baseControl/popperControl.js +108 -0
- package/lib/control/baseControl/selectControl.js +153 -0
- package/lib/control/exportImage.js +83 -0
- package/lib/control/fullscreen.js +109 -0
- package/lib/control/geoLocate.js +78 -0
- package/lib/control/layerControl.js +136 -0
- package/lib/control/logo.js +74 -0
- package/lib/control/mapTheme.js +92 -0
- package/lib/control/mouseLocation.js +79 -0
- package/lib/control/scale.js +136 -0
- package/lib/control/zoom.js +119 -0
- package/lib/css/button.less +70 -0
- package/lib/css/control.less +71 -0
- package/lib/css/index.css +567 -0
- package/lib/css/index.less +12 -0
- package/lib/css/l7.less +60 -0
- package/lib/css/layerPopup.less +8 -0
- package/lib/css/logo.less +18 -0
- package/lib/css/mouseLocation.less +9 -0
- package/lib/css/popper.less +64 -0
- package/lib/css/popup.less +169 -0
- package/lib/css/scale.less +34 -0
- package/lib/css/select.less +86 -0
- package/lib/css/variables.less +28 -0
- package/lib/css/zoom.less +21 -0
- package/lib/images/layers.png +0 -0
- package/lib/images/layers.svg +1 -0
- package/lib/images/logo.png +0 -0
- package/lib/images/quanping.svg +12 -0
- package/lib/index.js +51 -0
- package/lib/interface.js +17 -0
- package/lib/marker-layer.js +263 -0
- package/lib/marker.js +307 -0
- package/lib/popup/layerPopup.js +200 -0
- package/lib/popup/popup.js +388 -0
- package/lib/utils/anchor.js +63 -0
- package/lib/utils/icon.js +37 -0
- package/lib/utils/popper.js +209 -0
- package/lib/utils/screenfull.js +160 -0
- package/package.json +5 -5
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/control/exportImage.ts
|
|
23
|
+
var exportImage_exports = {};
|
|
24
|
+
__export(exportImage_exports, {
|
|
25
|
+
ExportImage: () => ExportImage,
|
|
26
|
+
default: () => ExportImage
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(exportImage_exports);
|
|
29
|
+
var import_icon = require("../utils/icon");
|
|
30
|
+
var import_buttonControl = __toESM(require("./baseControl/buttonControl"));
|
|
31
|
+
var ExportImage = class extends import_buttonControl.default {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.onClick = async () => {
|
|
35
|
+
const { onExport } = this.controlOption;
|
|
36
|
+
onExport == null ? void 0 : onExport(await this.getImage());
|
|
37
|
+
};
|
|
38
|
+
this.mergeImage = async (...base64List) => {
|
|
39
|
+
var _a;
|
|
40
|
+
const { imageType } = this.controlOption;
|
|
41
|
+
const { width = 0, height = 0 } = ((_a = this.mapsService.getContainer()) == null ? void 0 : _a.getBoundingClientRect()) ?? {};
|
|
42
|
+
const canvas = document.createElement("canvas");
|
|
43
|
+
canvas.width = width;
|
|
44
|
+
canvas.height = height;
|
|
45
|
+
const context = canvas.getContext("2d");
|
|
46
|
+
const imgList = await Promise.all(base64List.map((base64) => {
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
const img = new Image();
|
|
49
|
+
img.onload = () => {
|
|
50
|
+
resolve(img);
|
|
51
|
+
};
|
|
52
|
+
img.src = base64;
|
|
53
|
+
});
|
|
54
|
+
}));
|
|
55
|
+
imgList.forEach((img) => {
|
|
56
|
+
context == null ? void 0 : context.drawImage(img, 0, 0, width, height);
|
|
57
|
+
});
|
|
58
|
+
return canvas.toDataURL(`image/${imageType}`);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
onAdd() {
|
|
62
|
+
const button = super.onAdd();
|
|
63
|
+
button.addEventListener("click", this.onClick);
|
|
64
|
+
return button;
|
|
65
|
+
}
|
|
66
|
+
getDefault(option) {
|
|
67
|
+
return {
|
|
68
|
+
...super.getDefault(option),
|
|
69
|
+
title: "\u5BFC\u51FA\u56FE\u7247",
|
|
70
|
+
btnIcon: (0, import_icon.createL7Icon)("l7-icon-export-picture"),
|
|
71
|
+
imageType: "png"
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
getImage() {
|
|
75
|
+
const mapImage = this.mapsService.exportMap("png");
|
|
76
|
+
const layerImage = this.scene.exportPng("png");
|
|
77
|
+
return this.mergeImage(mapImage, layerImage);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
ExportImage
|
|
83
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/control/fullscreen.ts
|
|
23
|
+
var fullscreen_exports = {};
|
|
24
|
+
__export(fullscreen_exports, {
|
|
25
|
+
Fullscreen: () => Fullscreen,
|
|
26
|
+
default: () => Fullscreen
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(fullscreen_exports);
|
|
29
|
+
var import_l7_utils = require("@antv/l7-utils");
|
|
30
|
+
var import_icon = require("../utils/icon");
|
|
31
|
+
var import_screenfull = __toESM(require("../utils/screenfull"));
|
|
32
|
+
var import_buttonControl = __toESM(require("./baseControl/buttonControl"));
|
|
33
|
+
var Fullscreen = class extends import_buttonControl.default {
|
|
34
|
+
constructor(option) {
|
|
35
|
+
super(option);
|
|
36
|
+
this.isFullscreen = false;
|
|
37
|
+
this.toggleFullscreen = async () => {
|
|
38
|
+
if (import_screenfull.default.isEnabled) {
|
|
39
|
+
await import_screenfull.default.toggle(this.mapContainer);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
this.onClick = () => {
|
|
43
|
+
this.toggleFullscreen();
|
|
44
|
+
};
|
|
45
|
+
this.onFullscreenChange = () => {
|
|
46
|
+
this.isFullscreen = !!document.fullscreenElement;
|
|
47
|
+
const {
|
|
48
|
+
btnText,
|
|
49
|
+
btnIcon,
|
|
50
|
+
title,
|
|
51
|
+
exitBtnText,
|
|
52
|
+
exitBtnIcon,
|
|
53
|
+
exitTitle
|
|
54
|
+
} = this.controlOption;
|
|
55
|
+
if (this.isFullscreen) {
|
|
56
|
+
this.setBtnTitle(exitTitle);
|
|
57
|
+
this.setBtnText(exitBtnText);
|
|
58
|
+
this.setBtnIcon(exitBtnIcon);
|
|
59
|
+
} else {
|
|
60
|
+
this.setBtnTitle(title);
|
|
61
|
+
this.setBtnText(btnText);
|
|
62
|
+
this.setBtnIcon(btnIcon);
|
|
63
|
+
}
|
|
64
|
+
this.emit("fullscreenChange", this.isFullscreen);
|
|
65
|
+
};
|
|
66
|
+
if (!import_screenfull.default.isEnabled) {
|
|
67
|
+
console.warn("\u5F53\u524D\u6D4F\u89C8\u5668\u73AF\u5883\u4E0D\u652F\u6301\u5BF9\u5730\u56FE\u5168\u5C4F\u5316");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
setOptions(newOptions) {
|
|
71
|
+
const { exitBtnText, exitBtnIcon, exitTitle } = newOptions;
|
|
72
|
+
if (this.isFullscreen) {
|
|
73
|
+
if (this.checkUpdateOption(newOptions, ["exitBtnIcon"])) {
|
|
74
|
+
this.setBtnIcon(exitBtnIcon);
|
|
75
|
+
}
|
|
76
|
+
if (this.checkUpdateOption(newOptions, ["exitBtnText"])) {
|
|
77
|
+
this.setBtnText(exitBtnText);
|
|
78
|
+
}
|
|
79
|
+
if (this.checkUpdateOption(newOptions, ["exitTitle"])) {
|
|
80
|
+
this.setBtnTitle(exitTitle);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
super.setOptions(newOptions);
|
|
84
|
+
}
|
|
85
|
+
onAdd() {
|
|
86
|
+
const button = super.onAdd();
|
|
87
|
+
button.addEventListener("click", this.onClick);
|
|
88
|
+
this.mapContainer = import_l7_utils.DOM.getContainer(this.scene.getSceneConfig().id);
|
|
89
|
+
this.mapContainer.addEventListener("fullscreenchange", this.onFullscreenChange);
|
|
90
|
+
return button;
|
|
91
|
+
}
|
|
92
|
+
onRemove() {
|
|
93
|
+
super.onRemove();
|
|
94
|
+
this.mapContainer.removeEventListener("fullscreenchange", this.onFullscreenChange);
|
|
95
|
+
}
|
|
96
|
+
getDefault(option) {
|
|
97
|
+
return {
|
|
98
|
+
...super.getDefault(option),
|
|
99
|
+
title: "\u5168\u5C4F",
|
|
100
|
+
btnIcon: (0, import_icon.createL7Icon)("l7-icon-fullscreen"),
|
|
101
|
+
exitTitle: "\u9000\u51FA\u5168\u5C4F",
|
|
102
|
+
exitBtnIcon: (0, import_icon.createL7Icon)("l7-icon-exit-fullscreen")
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
Fullscreen
|
|
109
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/control/geoLocate.ts
|
|
23
|
+
var geoLocate_exports = {};
|
|
24
|
+
__export(geoLocate_exports, {
|
|
25
|
+
GeoLocate: () => GeoLocate,
|
|
26
|
+
default: () => GeoLocate
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(geoLocate_exports);
|
|
29
|
+
var import_lodash = require("lodash");
|
|
30
|
+
var import_icon = require("../utils/icon");
|
|
31
|
+
var import_buttonControl = __toESM(require("./baseControl/buttonControl"));
|
|
32
|
+
var GeoLocate = class extends import_buttonControl.default {
|
|
33
|
+
constructor(option) {
|
|
34
|
+
super(option);
|
|
35
|
+
this.getGeoLocation = () => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
window.navigator.geolocation.getCurrentPosition(({ coords }) => {
|
|
38
|
+
const { longitude, latitude } = coords ?? {};
|
|
39
|
+
if (!(0, import_lodash.isNaN)(longitude) && !(0, import_lodash.isNaN)(latitude)) {
|
|
40
|
+
resolve([longitude, latitude]);
|
|
41
|
+
} else {
|
|
42
|
+
reject();
|
|
43
|
+
}
|
|
44
|
+
}, (e) => {
|
|
45
|
+
reject(e);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
this.onClick = async () => {
|
|
50
|
+
if (!window.navigator.geolocation) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const { transform } = this.controlOption;
|
|
54
|
+
const position = await this.getGeoLocation();
|
|
55
|
+
const currentZoom = this.mapsService.getZoom();
|
|
56
|
+
this.mapsService.setZoomAndCenter(currentZoom > 15 ? currentZoom : 15, transform ? await transform(position) : position);
|
|
57
|
+
};
|
|
58
|
+
if (!window.navigator.geolocation) {
|
|
59
|
+
console.warn("\u5F53\u524D\u6D4F\u89C8\u5668\u73AF\u5883\u4E0D\u652F\u6301\u83B7\u53D6\u5730\u7406\u5B9A\u4F4D");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
getDefault(option) {
|
|
63
|
+
return {
|
|
64
|
+
...super.getDefault(option),
|
|
65
|
+
title: "\u5B9A\u4F4D",
|
|
66
|
+
btnIcon: (0, import_icon.createL7Icon)("l7-icon-reposition")
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
onAdd() {
|
|
70
|
+
const button = super.onAdd();
|
|
71
|
+
button.addEventListener("click", this.onClick);
|
|
72
|
+
return button;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
GeoLocate
|
|
78
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/control/layerControl.ts
|
|
23
|
+
var layerControl_exports = {};
|
|
24
|
+
__export(layerControl_exports, {
|
|
25
|
+
LayerControl: () => LayerControl,
|
|
26
|
+
default: () => LayerControl
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(layerControl_exports);
|
|
29
|
+
var import_icon = require("../utils/icon");
|
|
30
|
+
var import_selectControl = __toESM(require("./baseControl/selectControl"));
|
|
31
|
+
var LayerControl = class extends import_selectControl.default {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.bindLayerVisibleCallback = () => {
|
|
35
|
+
this.layers.forEach((layer) => {
|
|
36
|
+
layer.on("show", this.onLayerVisibleChane);
|
|
37
|
+
layer.on("hide", this.onLayerVisibleChane);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
this.unbindLayerVisibleCallback = () => {
|
|
41
|
+
this.layers.forEach((layer) => {
|
|
42
|
+
layer.off("show", this.onLayerVisibleChane);
|
|
43
|
+
layer.off("hide", this.onLayerVisibleChane);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
this.onLayerChange = () => {
|
|
47
|
+
var _a;
|
|
48
|
+
if ((_a = this.controlOption.layers) == null ? void 0 : _a.length) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.selectValue = this.getLayerVisible();
|
|
52
|
+
this.setOptions({
|
|
53
|
+
options: this.getLayerOptions()
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
this.onLayerVisibleChane = () => {
|
|
57
|
+
this.setSelectValue(this.getLayerVisible());
|
|
58
|
+
};
|
|
59
|
+
this.onSelectChange = () => {
|
|
60
|
+
this.layers.forEach((layer) => {
|
|
61
|
+
const needShow = this.selectValue.includes(layer.name);
|
|
62
|
+
const isShow = layer.isVisible();
|
|
63
|
+
if (needShow && !isShow) {
|
|
64
|
+
layer.show();
|
|
65
|
+
}
|
|
66
|
+
if (!needShow && isShow) {
|
|
67
|
+
layer.hide();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
get layers() {
|
|
73
|
+
return this.controlOption.layers || this.layerService.getLayers() || [];
|
|
74
|
+
}
|
|
75
|
+
getDefault(option) {
|
|
76
|
+
return {
|
|
77
|
+
...super.getDefault(option),
|
|
78
|
+
title: "\u56FE\u5C42\u63A7\u5236",
|
|
79
|
+
btnIcon: (0, import_icon.createL7Icon)("l7-icon-layer"),
|
|
80
|
+
options: []
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
getLayerVisible() {
|
|
84
|
+
return this.layers.filter((layer) => {
|
|
85
|
+
return layer.isVisible();
|
|
86
|
+
}).map((layer) => {
|
|
87
|
+
return layer.name;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
getLayerOptions() {
|
|
91
|
+
return this.layers.map((layer) => {
|
|
92
|
+
return {
|
|
93
|
+
text: layer.name,
|
|
94
|
+
value: layer.name
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
setOptions(option) {
|
|
99
|
+
const isLayerChange = this.checkUpdateOption(option, ["layers"]);
|
|
100
|
+
if (isLayerChange) {
|
|
101
|
+
this.unbindLayerVisibleCallback();
|
|
102
|
+
}
|
|
103
|
+
super.setOptions(option);
|
|
104
|
+
if (isLayerChange) {
|
|
105
|
+
this.bindLayerVisibleCallback();
|
|
106
|
+
this.selectValue = this.getLayerVisible();
|
|
107
|
+
this.controlOption.options = this.getLayerOptions();
|
|
108
|
+
this.popper.setContent(this.getPopperContent(this.controlOption.options));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
onAdd() {
|
|
112
|
+
var _a;
|
|
113
|
+
if (!((_a = this.controlOption.options) == null ? void 0 : _a.length)) {
|
|
114
|
+
this.controlOption.options = this.getLayerOptions();
|
|
115
|
+
}
|
|
116
|
+
if (!this.controlOption.defaultValue) {
|
|
117
|
+
this.controlOption.defaultValue = this.getLayerVisible();
|
|
118
|
+
}
|
|
119
|
+
this.on("selectChange", this.onSelectChange);
|
|
120
|
+
this.layerService.on("layerChange", this.onLayerChange);
|
|
121
|
+
this.bindLayerVisibleCallback();
|
|
122
|
+
return super.onAdd();
|
|
123
|
+
}
|
|
124
|
+
onRemove() {
|
|
125
|
+
this.off("selectChange", this.onSelectChange);
|
|
126
|
+
this.layerService.off("layerChange", this.onLayerChange);
|
|
127
|
+
this.unbindLayerVisibleCallback();
|
|
128
|
+
}
|
|
129
|
+
getIsMultiple() {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
LayerControl
|
|
136
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/control/logo.ts
|
|
20
|
+
var logo_exports = {};
|
|
21
|
+
__export(logo_exports, {
|
|
22
|
+
Logo: () => Logo,
|
|
23
|
+
default: () => Logo
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(logo_exports);
|
|
26
|
+
var import_l7_utils = require("@antv/l7-utils");
|
|
27
|
+
var import_baseControl = require("./baseControl");
|
|
28
|
+
var Logo = class extends import_baseControl.Control {
|
|
29
|
+
getDefault() {
|
|
30
|
+
return {
|
|
31
|
+
position: import_baseControl.PositionType.BOTTOMLEFT,
|
|
32
|
+
name: "logo",
|
|
33
|
+
href: "https://l7.antv.vision/",
|
|
34
|
+
img: "https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*GRb1TKp4HcMAAAAAAAAAAAAAARQnAQ"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
onAdd() {
|
|
38
|
+
const container = import_l7_utils.DOM.create("div", "l7-control-logo");
|
|
39
|
+
this.setLogoContent(container);
|
|
40
|
+
return container;
|
|
41
|
+
}
|
|
42
|
+
onRemove() {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
setOptions(option) {
|
|
46
|
+
super.setOptions(option);
|
|
47
|
+
if (this.checkUpdateOption(option, ["img", "href"])) {
|
|
48
|
+
import_l7_utils.DOM.clearChildren(this.container);
|
|
49
|
+
this.setLogoContent(this.container);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
setLogoContent(container) {
|
|
53
|
+
const { href, img } = this.controlOption;
|
|
54
|
+
const imgDOM = import_l7_utils.DOM.create("img");
|
|
55
|
+
imgDOM.setAttribute("src", img);
|
|
56
|
+
imgDOM.setAttribute("aria-label", "AntV logo");
|
|
57
|
+
import_l7_utils.DOM.setUnDraggable(imgDOM);
|
|
58
|
+
if (href) {
|
|
59
|
+
const anchorDOM = import_l7_utils.DOM.create("a", "l7-control-logo-link");
|
|
60
|
+
anchorDOM.target = "_blank";
|
|
61
|
+
anchorDOM.href = href;
|
|
62
|
+
anchorDOM.rel = "noopener nofollow";
|
|
63
|
+
anchorDOM.setAttribute("rel", "noopener nofollow");
|
|
64
|
+
anchorDOM.appendChild(imgDOM);
|
|
65
|
+
container.appendChild(anchorDOM);
|
|
66
|
+
} else {
|
|
67
|
+
container.appendChild(imgDOM);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
Logo
|
|
74
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/control/mapTheme.ts
|
|
23
|
+
var mapTheme_exports = {};
|
|
24
|
+
__export(mapTheme_exports, {
|
|
25
|
+
MapTheme: () => MapTheme,
|
|
26
|
+
default: () => MapTheme
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(mapTheme_exports);
|
|
29
|
+
var import_constants = require("../constants");
|
|
30
|
+
var import_icon = require("../utils/icon");
|
|
31
|
+
var import_selectControl = __toESM(require("./baseControl/selectControl"));
|
|
32
|
+
var MapTheme = class extends import_selectControl.default {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.onMapThemeChange = () => {
|
|
36
|
+
this.mapsService.setMapStyle(this.selectValue[0]);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
getDefault(option) {
|
|
40
|
+
return {
|
|
41
|
+
...super.getDefault(option),
|
|
42
|
+
title: "\u5730\u56FE\u6837\u5F0F",
|
|
43
|
+
btnIcon: (0, import_icon.createL7Icon)("l7-icon-color"),
|
|
44
|
+
options: []
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
getStyleOptions() {
|
|
48
|
+
const mapStyleConfig = this.mapsService.getType() === "mapbox" ? import_constants.MapboxMapStyleConfig : import_constants.GaodeMapStyleConfig;
|
|
49
|
+
return Object.entries(this.mapsService.getMapStyleConfig()).filter(([key, value]) => typeof value === "string" && key !== "blank").map(([key, value]) => {
|
|
50
|
+
const { text, img } = mapStyleConfig[key] ?? {};
|
|
51
|
+
return {
|
|
52
|
+
text: text ?? key,
|
|
53
|
+
value,
|
|
54
|
+
img,
|
|
55
|
+
key
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getMapStyle() {
|
|
60
|
+
return this.mapsService.getMapStyle();
|
|
61
|
+
}
|
|
62
|
+
onAdd() {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
if (!((_a = this.controlOption.options) == null ? void 0 : _a.length)) {
|
|
65
|
+
this.controlOption.options = this.getStyleOptions();
|
|
66
|
+
}
|
|
67
|
+
if (this.controlOption.defaultValue) {
|
|
68
|
+
const defaultValue = this.controlOption.defaultValue;
|
|
69
|
+
this.controlOption.defaultValue = ((_b = this.controlOption.options.find((item) => item.key === defaultValue)) == null ? void 0 : _b.value) ?? defaultValue;
|
|
70
|
+
} else {
|
|
71
|
+
const defaultStyle = this.getMapStyle();
|
|
72
|
+
if (defaultStyle) {
|
|
73
|
+
this.controlOption.defaultValue = defaultStyle;
|
|
74
|
+
} else {
|
|
75
|
+
this.mapsService.map.once("styledata", () => {
|
|
76
|
+
const mapboxStyle = this.mapsService.getMapStyle();
|
|
77
|
+
this.controlOption.defaultValue = mapboxStyle;
|
|
78
|
+
this.setSelectValue(mapboxStyle, false);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.on("selectChange", this.onMapThemeChange);
|
|
83
|
+
return super.onAdd();
|
|
84
|
+
}
|
|
85
|
+
getIsMultiple() {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
MapTheme
|
|
92
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/control/mouseLocation.ts
|
|
23
|
+
var mouseLocation_exports = {};
|
|
24
|
+
__export(mouseLocation_exports, {
|
|
25
|
+
MouseLocation: () => MouseLocation,
|
|
26
|
+
default: () => MouseLocation
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(mouseLocation_exports);
|
|
29
|
+
var import_l7_core = require("@antv/l7-core");
|
|
30
|
+
var import_l7_utils = require("@antv/l7-utils");
|
|
31
|
+
var import_control = __toESM(require("./baseControl/control"));
|
|
32
|
+
var MouseLocation = class extends import_control.default {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.location = [0, 0];
|
|
36
|
+
this.onMouseMove = (e) => {
|
|
37
|
+
let position = this.location;
|
|
38
|
+
const lngLat = e.lngLat || e.lnglat;
|
|
39
|
+
const { transform } = this.controlOption;
|
|
40
|
+
if (lngLat) {
|
|
41
|
+
position = [lngLat.lng, lngLat.lat];
|
|
42
|
+
}
|
|
43
|
+
this.location = position;
|
|
44
|
+
if (transform) {
|
|
45
|
+
position = transform(position);
|
|
46
|
+
}
|
|
47
|
+
this.insertLocation2HTML(position);
|
|
48
|
+
this.emit("locationChange", position);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
getLocation() {
|
|
52
|
+
return this.location;
|
|
53
|
+
}
|
|
54
|
+
getDefault(option) {
|
|
55
|
+
return {
|
|
56
|
+
...super.getDefault(option),
|
|
57
|
+
position: import_l7_core.PositionType.BOTTOMLEFT,
|
|
58
|
+
transform: ([lng, lat]) => {
|
|
59
|
+
return [+(+lng).toFixed(6), +(+lat).toFixed(6)];
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
onAdd() {
|
|
64
|
+
const container = import_l7_utils.DOM.create("div", "l7-control-mouse-location");
|
|
65
|
+
container.innerHTML = " ";
|
|
66
|
+
this.mapsService.on("mousemove", this.onMouseMove);
|
|
67
|
+
return container;
|
|
68
|
+
}
|
|
69
|
+
onRemove() {
|
|
70
|
+
this.mapsService.off("mousemove", this.onMouseMove);
|
|
71
|
+
}
|
|
72
|
+
insertLocation2HTML(position) {
|
|
73
|
+
this.container.innerText = position.join(", ");
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
MouseLocation
|
|
79
|
+
});
|