@tianditu/wc
Version:
Web components for tianditu, powered by Demo Macro.
66 lines (62 loc) • 2.1 kB
JavaScript
/*!
* MIT © Demo Macro
*/
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { o as onload } from './use.js';
const TdtControlCopyright$1 = /*@__PURE__*/ proxyCustomElement(class TdtControlCopyright extends HTMLElement {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
this.position = "topright";
this.content = undefined;
this.uniqueId = undefined;
this.control = undefined;
this.map = undefined;
}
connectedCallback() {
onload(() => {
this.map = globalThis[this.uniqueId];
this.control = new T.Control.Copyright({
position: this.position,
});
this.map.addControl(this.control);
});
}
componentWillRender() {
onload(() => {
this.content &&
this.control.addCopyright({
id: new Date().getTime().toString(),
content: this.content,
bounds: this.map.getBounds(),
});
});
}
render() {
return (h(Host, { key: 'c47393902b2702af1fa363f28d9fa73a462bbd6a' }, h("slot", { key: 'b68b8a93d66f05646cdd389cd923f5b10a05229d' })));
}
}, [1, "tdt-control-copyright", {
"position": [513],
"content": [513],
"uniqueId": [513, "unique-id"],
"control": [32],
"map": [32]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["tdt-control-copyright"];
components.forEach(tagName => { switch (tagName) {
case "tdt-control-copyright":
if (!customElements.get(tagName)) {
customElements.define(tagName, TdtControlCopyright$1);
}
break;
} });
}
const TdtControlCopyright = TdtControlCopyright$1;
const defineCustomElement = defineCustomElement$1;
export { TdtControlCopyright, defineCustomElement };
//# sourceMappingURL=tdt-control-copyright.js.map