@tianditu/wc
Version:
Web components for tianditu, powered by Demo Macro.
70 lines (66 loc) • 2.19 kB
JavaScript
/*!
* MIT © Demo Macro
*/
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { o as onload } from './use.js';
const TdtControl$1 = /*@__PURE__*/ proxyCustomElement(class TdtControl extends HTMLElement {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
this.control = undefined;
this.position = undefined;
this.visible = true;
this.offset = undefined;
this.options = undefined;
this.uniqueId = undefined;
this.map = undefined;
}
connectedCallback() {
onload(() => {
this.map = globalThis[this.uniqueId];
if (!this.control) {
this.control = new T.Control({
position: this.position,
});
}
this.map.addControl(this.control);
});
}
componentWillRender() {
onload(() => {
this.position && this.control.setPosition(this.position);
this.visible ? this.control.show() : this.control.hide();
this.offset && this.control.setOffset(this.offset);
this.options && this.control.setOptions(this.options);
});
}
render() {
return (h(Host, { key: '5d37e1f2f893daf89cb9abafb80b3067b277d28c' }, h("slot", { key: '9a7c7f4ea1320a1f48045b26cc9fcd170eaf8ebc' })));
}
}, [1, "tdt-control", {
"control": [16],
"position": [513],
"visible": [516],
"offset": [16],
"options": [16],
"uniqueId": [513, "unique-id"],
"map": [32]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["tdt-control"];
components.forEach(tagName => { switch (tagName) {
case "tdt-control":
if (!customElements.get(tagName)) {
customElements.define(tagName, TdtControl$1);
}
break;
} });
}
const TdtControl = TdtControl$1;
const defineCustomElement = defineCustomElement$1;
export { TdtControl, defineCustomElement };
//# sourceMappingURL=tdt-control.js.map