UNPKG

@tianditu/wc

Version:

Web components for tianditu, powered by Demo Macro.

107 lines (106 loc) 3.32 kB
/*! * MIT © Demo Macro */ import { Host, h } from "@stencil/core"; import { onload } from "../../utils/use"; export class TdtControlCopyright { constructor() { 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' }))); } static get is() { return "tdt-control-copyright"; } static get encapsulation() { return "shadow"; } static get properties() { return { "position": { "type": "string", "mutable": false, "complexType": { "original": "T.ControlPosition", "resolved": "\"bottomleft\" | \"bottomright\" | \"topleft\" | \"topright\"", "references": { "T": { "location": "global", "id": "global::T" } } }, "required": false, "optional": false, "docs": { "tags": [], "text": "" }, "attribute": "position", "reflect": true, "defaultValue": "\"topright\"" }, "content": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string | undefined", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "attribute": "content", "reflect": true }, "uniqueId": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": true, "optional": false, "docs": { "tags": [], "text": "" }, "attribute": "unique-id", "reflect": true } }; } static get states() { return { "control": {}, "map": {} }; } } //# sourceMappingURL=tdt-control-copyright.js.map