qc-ui-lit 0.0.2 → 0.0.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/dist/components/AMap/a-map.d.ts +3 -1
- package/dist/qc-ui-lit.js +15 -7
- package/package.json +1 -1
|
@@ -24,13 +24,15 @@ export declare class AMap extends LitElement {
|
|
|
24
24
|
};
|
|
25
25
|
protected createRenderRoot(): this;
|
|
26
26
|
constructor();
|
|
27
|
+
connectedCallback(): Promise<void>;
|
|
27
28
|
firstUpdated(): Promise<void>;
|
|
29
|
+
disconnectedCallback(): void;
|
|
28
30
|
initAMap(): void;
|
|
29
31
|
oncomplete: () => void;
|
|
30
32
|
onStartOperating: () => void;
|
|
31
33
|
onEndOperating_timeout: () => void;
|
|
32
34
|
onzoomchange: () => void;
|
|
33
35
|
addEventListeners(): void;
|
|
34
|
-
removeEventListener
|
|
36
|
+
removeEventListener(): void;
|
|
35
37
|
render(): import("lit-html").TemplateResult<1>;
|
|
36
38
|
}
|
package/dist/qc-ui-lit.js
CHANGED
|
@@ -767,7 +767,7 @@ var ke = async (e) => {
|
|
|
767
767
|
AMap: this.AMap
|
|
768
768
|
} })), this.dispatchEvent(new CustomEvent("zoomChange", { detail: { zoom: this.map.getZoom() } })), setTimeout(() => {
|
|
769
769
|
this.loading = !1;
|
|
770
|
-
},
|
|
770
|
+
}, 100);
|
|
771
771
|
}, this.onStartOperating = () => {
|
|
772
772
|
this.dispatchEvent(new CustomEvent("startOperating"));
|
|
773
773
|
}, this.onEndOperating_timeout = () => {
|
|
@@ -776,12 +776,10 @@ var ke = async (e) => {
|
|
|
776
776
|
}, 400);
|
|
777
777
|
}, this.onzoomchange = () => {
|
|
778
778
|
this.dispatchEvent(new CustomEvent("zoomChange", { detail: { zoom: this.map.getZoom() } }));
|
|
779
|
-
}, this.removeEventListener = () => {
|
|
780
|
-
this.map.off("complete", this.oncomplete), this.map.off("zoomstart", this.onStartOperating), this.map.off("zoomend", this.onEndOperating_timeout), this.map.off("zoomchange", this.onzoomchange), this.map.off("mousedown", this.onStartOperating), this.map.off("mouseup", this.onEndOperating_timeout), this.map.off("touchstart", this.onStartOperating), this.map.off("touchend", this.onEndOperating_timeout);
|
|
781
779
|
};
|
|
782
780
|
}
|
|
783
|
-
async
|
|
784
|
-
await ke({
|
|
781
|
+
async connectedCallback() {
|
|
782
|
+
super.connectedCallback(), await ke({
|
|
785
783
|
key: this.key,
|
|
786
784
|
secret: this.secret,
|
|
787
785
|
version: this.version,
|
|
@@ -792,11 +790,18 @@ var ke = async (e) => {
|
|
|
792
790
|
this.AMap = window.AMap, this.initAMap();
|
|
793
791
|
},
|
|
794
792
|
onError: (e) => {
|
|
795
|
-
console.error("AMap load error", e);
|
|
793
|
+
console.error("AMap load error", e), this.loading = !1;
|
|
796
794
|
}
|
|
797
795
|
});
|
|
798
796
|
}
|
|
797
|
+
async firstUpdated() {
|
|
798
|
+
this.initAMap();
|
|
799
|
+
}
|
|
800
|
+
disconnectedCallback() {
|
|
801
|
+
super.disconnectedCallback(), this.removeEventListener(), this.operatingData.timeoutFlag && (clearTimeout(this.operatingData.timeoutFlag), this.operatingData.timeoutFlag = null), this.map &&= (this.map.destroy(), null);
|
|
802
|
+
}
|
|
799
803
|
initAMap() {
|
|
804
|
+
if (!this.AMap) return;
|
|
800
805
|
let e = this.querySelector(".a-map-container");
|
|
801
806
|
e && (this.map = new this.AMap.Map(e, {
|
|
802
807
|
resizeEnable: !0,
|
|
@@ -811,7 +816,10 @@ var ke = async (e) => {
|
|
|
811
816
|
} })));
|
|
812
817
|
}
|
|
813
818
|
addEventListeners() {
|
|
814
|
-
this.map.on("complete", this.oncomplete), this.map.on("zoomstart", this.onStartOperating), this.map.on("zoomend", this.onEndOperating_timeout), this.map.on("zoomchange", this.onzoomchange), this.map.on("mousedown", this.onStartOperating), this.map.on("mouseup", this.onEndOperating_timeout), this.map.on("touchstart", this.onStartOperating), this.map.on("touchend", this.onEndOperating_timeout);
|
|
819
|
+
this.map && (this.map.on("complete", this.oncomplete), this.map.on("zoomstart", this.onStartOperating), this.map.on("zoomend", this.onEndOperating_timeout), this.map.on("zoomchange", this.onzoomchange), this.map.on("mousedown", this.onStartOperating), this.map.on("mouseup", this.onEndOperating_timeout), this.map.on("touchstart", this.onStartOperating), this.map.on("touchend", this.onEndOperating_timeout));
|
|
820
|
+
}
|
|
821
|
+
removeEventListener() {
|
|
822
|
+
this.map && (this.map.off("complete", this.oncomplete), this.map.off("zoomstart", this.onStartOperating), this.map.off("zoomend", this.onEndOperating_timeout), this.map.off("zoomchange", this.onzoomchange), this.map.off("mousedown", this.onStartOperating), this.map.off("mouseup", this.onEndOperating_timeout), this.map.off("touchstart", this.onStartOperating), this.map.off("touchend", this.onEndOperating_timeout));
|
|
815
823
|
}
|
|
816
824
|
render() {
|
|
817
825
|
return F`<section id="a-map">
|