@tianditu/wc
Version:
Web components for tianditu, powered by Demo Macro.
168 lines (167 loc) • 5.34 kB
JavaScript
/*!
* MIT © Demo Macro
*/
import { Host, h } from "@stencil/core";
import { onload } from "../../utils/use";
export class TdtControl {
constructor() {
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' })));
}
static get is() { return "tdt-control"; }
static get encapsulation() { return "shadow"; }
static get properties() {
return {
"control": {
"type": "unknown",
"mutable": false,
"complexType": {
"original": "T.Control",
"resolved": "Control",
"references": {
"T": {
"location": "global",
"id": "global::T"
}
}
},
"required": true,
"optional": false,
"docs": {
"tags": [],
"text": ""
}
},
"position": {
"type": "string",
"mutable": false,
"complexType": {
"original": "T.ControlPosition",
"resolved": "\"bottomleft\" | \"bottomright\" | \"topleft\" | \"topright\" | undefined",
"references": {
"T": {
"location": "global",
"id": "global::T"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
},
"attribute": "position",
"reflect": true
},
"visible": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "visible",
"reflect": true,
"defaultValue": "true"
},
"offset": {
"type": "unknown",
"mutable": false,
"complexType": {
"original": "T.Point",
"resolved": "Point | undefined",
"references": {
"T": {
"location": "global",
"id": "global::T"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
}
},
"options": {
"type": "unknown",
"mutable": false,
"complexType": {
"original": "T.ControlOptions",
"resolved": "ControlOptions | undefined",
"references": {
"T": {
"location": "global",
"id": "global::T"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
}
},
"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 {
"map": {}
};
}
}
//# sourceMappingURL=tdt-control.js.map