UNPKG

@senx/discovery-widgets

Version:

Discovery Widgets Elements

93 lines (89 loc) 3.78 kB
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client'; import { P as Param, U as Utils, L as Logger } from './utils.js'; const discoveryHiddenCss = "/*!\n * Copyright 2022 SenX S.A.S.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */:host{display:none}"; const DiscoveryHiddenStyle0 = discoveryHiddenCss; const DiscoveryHidden = /*@__PURE__*/ proxyCustomElement(class DiscoveryHidden extends HTMLElement { constructor() { super(); this.__registerHost(); this.__attachShadow(); this.draw = createEvent(this, "draw", 7); this.options = new Param(); this.debug = false; this.unit = ''; } optionsUpdate(newValue, oldValue) { var _a, _b; (_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['optionsUpdate'], newValue, oldValue); let opts = newValue; if (!!newValue && typeof newValue === 'string') { opts = JSON.parse(newValue); } if (!Utils.deepEqual(opts, this.innerOptions)) { this.innerOptions = Utils.clone(opts); (_b = this.LOG) === null || _b === void 0 ? void 0 : _b.debug(['optionsUpdate 2'], { options: this.innerOptions, newValue, oldValue }); } } // noinspection JSUnusedGlobalSymbols componentWillLoad() { var _a; this.LOG = new Logger(DiscoveryHidden, this.debug); if (typeof this.options === 'string') { this.innerOptions = JSON.parse(this.options); } else { this.innerOptions = this.options; } (_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['componentWillLoad'], { type: this.type, options: this.innerOptions, }); } // noinspection JSUnusedGlobalSymbols componentDidLoad() { setTimeout(() => { this.height = Utils.getContentBounds(this.el.parentElement).h; setTimeout(() => this.draw.emit(), 100); }); } async resize() { // empty } render() { return h("div", { key: '13471cfb0a17d88f0103498e8bf72b75479ca15d', style: { display: 'hidden' } }); } get el() { return this; } static get watchers() { return { "options": ["optionsUpdate"] }; } static get style() { return DiscoveryHiddenStyle0; } }, [1, "discovery-hidden", { "result": [1025], "type": [1], "options": [1], "width": [32], "height": [32], "debug": [4], "unit": [1], "message": [32], "innerStyle": [32], "innerOptions": [32], "resize": [64] }, undefined, { "options": ["optionsUpdate"] }]); function defineCustomElement() { if (typeof customElements === "undefined") { return; } const components = ["discovery-hidden"]; components.forEach(tagName => { switch (tagName) { case "discovery-hidden": if (!customElements.get(tagName)) { customElements.define(tagName, DiscoveryHidden); } break; } }); } export { DiscoveryHidden as D, defineCustomElement as d }; //# sourceMappingURL=discovery-hidden2.js.map