iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 16.3 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[5675],{32594:function(t,e,r){"use strict";r.d(e,{U:function(){return n}});var n=function(t){return t.stopPropagation()}},81303:function(t,e,r){"use strict";r(8878);function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,r){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(f,t);var e,r,n,u=a(f);function f(){return i(this,f),u.apply(this,arguments)}return e=f,(r=[{key:"ready",value:function(){var t=this;s(l(f.prototype),"ready",this).call(this),setTimeout((function(){"rtl"===window.getComputedStyle(t).direction&&(t.style.textAlign="right")}),100)}}])&&o(e.prototype,r),n&&o(e,n),f}(customElements.get("paper-dropdown-menu"));customElements.define("ha-paper-dropdown-menu",f)},74725:function(t,e,r){"use strict";r.d(e,{cv:function(){return n},LN:function(){return i},Ek:function(){return o},ON:function(){return s},H3:function(){return c}});var n=function(t,e,r){return t.callService("input_select","select_option",{option:r,entity_id:e})},i=function(t){return t.callWS({type:"input_select/list"})},o=function(t,e){return t.callWS(Object.assign({type:"input_select/create"},e))},s=function(t,e,r){return t.callWS(Object.assign({type:"input_select/update",input_select_id:e},r))},c=function(t,e){return t.callWS({type:"input_select/delete",input_select_id:e})}},25675:function(t,e,r){"use strict";r.r(e);r(53973),r(51095);var n=r(15652),i=r(81471),o=r(49629),s=r(49706),c=r(32594),a=r(58831),u=r(91741),l=(r(3143),r(81303),r(56007)),f=r(62359),p=r(74725),d=r(93491),h=r(22503),y=r(22193),m=r(53658),v=r(75502);function b(t){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function g(){var t=O(["\n :host {\n display: flex;\n align-items: center;\n }\n ha-paper-dropdown-menu {\n margin-left: 16px;\n flex: 1;\n }\n paper-item {\n cursor: pointer;\n min-width: 200px;\n }\n .pointer {\n cursor: pointer;\n }\n state-badge:focus {\n outline: none;\n background: var(--divider-color);\n border-radius: 100%;\n }\n "]);return g=function(){return t},t}function w(){var t=O([" <paper-item>","</paper-item> "]);return w=function(){return t},t}function k(){var t=O(["\n <state-badge\n .stateObj=","\n .stateColor=","\n .overrideIcon=","\n .overrideImage=","\n class=","\n @action=","\n .actionHandler=","\n tabindex=","\n ></state-badge>\n <ha-paper-dropdown-menu\n .label=","\n .value=","\n .disabled=","\n @iron-select=","\n @click=",'\n >\n <paper-listbox slot="dropdown-content">\n ',"\n </paper-listbox>\n </ha-paper-dropdown-menu>\n "]);return k=function(){return t},t}function _(){var t=O(["\n <hui-warning>\n ","\n </hui-warning>\n "]);return _=function(){return t},t}function E(){var t=O([""]);return E=function(){return t},t}function O(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function P(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function S(t,e){return(S=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function j(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=H(t);if(e){var i=H(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return C(this,r)}}function C(t,e){return!e||"object"!==b(e)&&"function"!=typeof e?x(t):e}function x(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function D(){D=function(){return t};var t={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(t,e){["method","field"].forEach((function(r){e.forEach((function(e){e.kind===r&&"own"===e.placement&&this.defineClassElement(t,e)}),this)}),this)},initializeClassElements:function(t,e){var r=t.prototype;["method","field"].forEach((function(n){e.forEach((function(e){var i=e.placement;if(e.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?t:r;this.defineClassElement(o,e)}}),this)}),this)},defineClassElement:function(t,e){var r=e.descriptor;if("field"===e.kind){var n=e.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(t)}}Object.defineProperty(t,e.key,r)},decorateClass:function(t,e){var r=[],n=[],i={static:[],prototype:[],own:[]};if(t.forEach((function(t){this.addElementPlacement(t,i)}),this),t.forEach((function(t){if(!T(t))return r.push(t);var e=this.decorateElement(t,i);r.push(e.element),r.push.apply(r,e.extras),n.push.apply(n,e.finishers)}),this),!e)return{elements:r,finishers:n};var o=this.decorateConstructor(r,e);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(t,e,r){var n=e[t.placement];if(!r&&-1!==n.indexOf(t.key))throw new TypeError("Duplicated element ("+t.key+")");n.push(t.key)},decorateElement:function(t,e){for(var r=[],n=[],i=t.decorators,o=i.length-1;o>=0;o--){var s=e[t.placement];s.splice(s.indexOf(t.key),1);var c=this.fromElementDescriptor(t),a=this.toElementFinisherExtras((0,i[o])(c)||c);t=a.element,this.addElementPlacement(t,e),a.finisher&&n.push(a.finisher);var u=a.extras;if(u){for(var l=0;l<u.length;l++)this.addElementPlacement(u[l],e);r.push.apply(r,u)}}return{element:t,finishers:n,extras:r}},decorateConstructor:function(t,e){for(var r=[],n=e.length-1;n>=0;n--){var i=this.fromClassDescriptor(t),o=this.toClassDescriptor((0,e[n])(i)||i);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){t=o.elements;for(var s=0;s<t.length-1;s++)for(var c=s+1;c<t.length;c++)if(t[s].key===t[c].key&&t[s].placement===t[c].placement)throw new TypeError("Duplicated element ("+t[s].key+")")}}return{elements:t,finishers:r}},fromElementDescriptor:function(t){var e={kind:t.kind,key:t.key,placement:t.placement,descriptor:t.descriptor};return Object.defineProperty(e,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===t.kind&&(e.initializer=t.initializer),e},toElementDescriptors:function(t){var e;if(void 0!==t)return(e=t,function(t){if(Array.isArray(t))return t}(e)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?U(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(t){var e=this.toElementDescriptor(t);return this.disallowProperty(t,"finisher","An element descriptor"),this.disallowProperty(t,"extras","An element descriptor"),e}),this)},toElementDescriptor:function(t){var e=String(t.kind);if("method"!==e&&"field"!==e)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+e+'"');var r=F(t.key),n=String(t.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var i=t.descriptor;this.disallowProperty(t,"elements","An element descriptor");var o={kind:e,key:r,placement:n,descriptor:Object.assign({},i)};return"field"!==e?this.disallowProperty(t,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=t.initializer),o},toElementFinisherExtras:function(t){return{element:this.toElementDescriptor(t),finisher:I(t,"finisher"),extras:this.toElementDescriptors(t.extras)}},fromClassDescriptor:function(t){var e={kind:"class",elements:t.map(this.fromElementDescriptor,this)};return Object.defineProperty(e,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),e},toClassDescriptor:function(t){var e=String(t.kind);if("class"!==e)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+e+'"');this.disallowProperty(t,"key","A class descriptor"),this.disallowProperty(t,"placement","A class descriptor"),this.disallowProperty(t,"descriptor","A class descriptor"),this.disallowProperty(t,"initializer","A class descriptor"),this.disallowProperty(t,"extras","A class descriptor");var r=I(t,"finisher");return{elements:this.toElementDescriptors(t.elements),finisher:r}},runClassFinishers:function(t,e){for(var r=0;r<e.length;r++){var n=(0,e[r])(t);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");t=n}}return t},disallowProperty:function(t,e,r){if(void 0!==t[e])throw new TypeError(r+" can't have a ."+e+" property.")}};return t}function A(t){var e,r=F(t.key);"method"===t.kind?e={value:t.value,writable:!0,configurable:!0,enumerable:!1}:"get"===t.kind?e={get:t.value,configurable:!0,enumerable:!1}:"set"===t.kind?e={set:t.value,configurable:!0,enumerable:!1}:"field"===t.kind&&(e={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===t.kind?"field":"method",key:r,placement:t.static?"static":"field"===t.kind?"own":"prototype",descriptor:e};return t.decorators&&(n.decorators=t.decorators),"field"===t.kind&&(n.initializer=t.value),n}function R(t,e){void 0!==t.descriptor.get?e.descriptor.get=t.descriptor.get:e.descriptor.set=t.descriptor.set}function T(t){return t.decorators&&t.decorators.length}function z(t){return void 0!==t&&!(void 0===t.value&&void 0===t.writable)}function I(t,e){var r=t[e];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+e+"' to be a function");return r}function F(t){var e=function(t,e){if("object"!==b(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===b(e)?e:String(e)}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function W(t,e,r){return(W="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=H(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function H(t){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}!function(t,e,r,n){var i=D();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var s=e((function(t){i.initializeInstanceElements(t,c.elements)}),r),c=i.decorateClass(function(t){for(var e=[],r=function(t){return"method"===t.kind&&t.key===o.key&&t.placement===o.placement},n=0;n<t.length;n++){var i,o=t[n];if("method"===o.kind&&(i=e.find(r)))if(z(o.descriptor)||z(i.descriptor)){if(T(o)||T(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(T(o)){if(T(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}R(o,i)}else e.push(o)}return e}(s.d.map(A)),t);i.initializeClassElements(s.F,c.elements),i.runClassFinishers(s.F,c.finishers)}([(0,n.Mo)("hui-input-select-entity-row")],(function(t,e){var r=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&S(t,e)}(n,e);var r=j(n);function n(){var e;P(this,n);for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return e=r.call.apply(r,[this].concat(o)),t(x(e)),e}return n}(e);return{F:r,d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.sz)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(t){if(!t||!t.entity)throw new Error("Invalid Configuration: 'entity' required");this._config=t}},{kind:"method",key:"shouldUpdate",value:function(t){return(0,m.G)(this,t)}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return(0,n.dy)(E());var t=this.hass.states[this._config.entity];if(!t)return(0,n.dy)(_(),(0,v.i)(this.hass,this._config.entity));var e=this._config.tap_action&&"none"!==this._config.tap_action.action||this._config.entity&&!s.ht.includes((0,a.M)(this._config.entity));return(0,n.dy)(k(),t,this._config.state_color,this._config.icon,this._config.image,(0,i.$)({pointer:e}),this._handleAction,(0,d.K)({hasHold:(0,y._)(this._config.hold_action),hasDoubleClick:(0,y._)(this._config.double_tap_action)}),(0,o.o)(e?"0":void 0),this._config.name||(0,u.C)(t),t.state,l.V_.includes(t.state),this._selectedChanged,c.U,t.attributes.options?t.attributes.options.map((function(t){return(0,n.dy)(w(),t)})):"")}},{kind:"method",key:"updated",value:function(t){if(W(H(r.prototype),"updated",this).call(this,t),this.hass&&this._config){var e=this.hass.states[this._config.entity];e&&e.attributes.options&&(this.shadowRoot.querySelector("paper-listbox").selected=e.attributes.options.indexOf(e.state))}}},{kind:"method",key:"_handleAction",value:function(t){(0,h.G)(this,this.hass,this._config,t.detail.action)}},{kind:"get",static:!0,key:"styles",value:function(){return(0,n.iv)(g())}},{kind:"method",key:"_selectedChanged",value:function(t){var e=this.hass.states[this._config.entity],r=t.target.selectedItem.innerText.trim();r!==e.state&&((0,f.j)("light"),(0,p.cv)(this.hass,e.entity_id,r))}}]}}),n.oi)}}]);
//# sourceMappingURL=chunk.65d0ff9fb88cdc975e77.js.map