iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 17.5 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[6902],{1528:function(e,t,n){"use strict";var r,i,o,a,s=n(68546),l=n(50424),c=n(55358),d=n(40417),u=n(56087),f=n(47181),p=(n(74535),n(10983),n(70651));function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(c){return void n(c)}s.done?t(l):Promise.resolve(l).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){m(o,r,i,a,s,"next",e)}function s(e){m(o,r,i,a,s,"throw",e)}a(void 0)}))}}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=D(e);if(t){var i=D(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?E(e):t}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(){x=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(n){t.forEach((function(t){t.kind===n&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var n=e.prototype;["method","field"].forEach((function(r){t.forEach((function(t){var i=t.placement;if(t.kind===r&&("static"===i||"prototype"===i)){var o="static"===i?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var r=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],r=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!O(e))return n.push(e);var t=this.decorateElement(e,i);n.push(t.element),n.push.apply(n,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:n,finishers:r};var o=this.decorateConstructor(n,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,n){var r=t[e.placement];if(!n&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var n=[],r=[],i=e.decorators,o=i.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,i[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&r.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);n.push.apply(n,c)}}return{element:e,finishers:r,extras:n}},decorateConstructor:function(e,t){for(var n=[],r=t.length-1;r>=0;r--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(i)||i);if(void 0!==o.finisher&&n.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:n}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}(t)||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(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var n=j(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)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 "'+r+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:r,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"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=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:S(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var n=S(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var r=(0,t[n])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}return e},disallowProperty:function(e,t,n){if(void 0!==e[t])throw new TypeError(n+" can't have a ."+t+" property.")}};return e}function _(e){var t,n=j(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var r={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function C(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function O(e){return e.decorators&&e.decorators.length}function P(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function S(e,t){var n=e[t];if(void 0!==n&&"function"!=typeof n)throw new TypeError("Expected '"+t+"' to be a function");return n}function j(e){var t=function(e,t){if("object"!==h(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===h(t)?t:String(t)}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t,n){return(z="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=D(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,n,r){var i=x();if(r)for(var o=0;o<r.length;o++)i=r[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),n),s=i.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var i,o=e[r];if("method"===o.kind&&(i=t.find(n)))if(P(o.descriptor)||P(i.descriptor)){if(O(o)||O(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(O(o)){if(O(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}C(o,i)}else t.push(o)}return t}(a.d.map(_)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,c.Mo)("hui-entity-editor")],(function(e,t){var n,h,m=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(r,t);var n=g(r);function r(){var t;b(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(E(t)),t}return r}(t);return{F:m,d:[{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,c.Cb)({attribute:!1})],key:"entities",value:void 0},{kind:"field",decorators:[(0,c.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,c.SB)()],key:"_attached",value:function(){return!1}},{kind:"field",decorators:[(0,c.SB)()],key:"_renderEmptySortable",value:function(){return!1}},{kind:"field",key:"_sortable",value:void 0},{kind:"method",key:"connectedCallback",value:function(){z(D(m.prototype),"connectedCallback",this).call(this),this._attached=!0}},{kind:"method",key:"disconnectedCallback",value:function(){z(D(m.prototype),"disconnectedCallback",this).call(this),this._attached=!1}},{kind:"method",key:"render",value:function(){var e=this;return this.entities?(0,l.dy)(i||(i=v(["\n <h3>\n ",'\n </h3>\n <div class="entities">\n ',"\n </div>\n <ha-entity-picker\n .hass=","\n @value-changed=","\n ></ha-entity-picker>\n "])),this.label||this.hass.localize("ui.panel.lovelace.editor.card.generic.entities")+" ("+this.hass.localize("ui.panel.lovelace.editor.card.config.required")+")",(0,d.l)([this.entities,this._renderEmptySortable],(function(){return e._renderEmptySortable?"":e.entities.map((function(t,n){return(0,l.dy)(o||(o=v(['\n <div class="entity" data-entity-id=',">\n <ha-svg-icon .path=","></ha-svg-icon>\n <ha-entity-picker\n .hass=","\n .value=","\n .index=","\n @value-changed=","\n allow-custom-entity\n ></ha-entity-picker>\n </div>\n "])),t.entity,s.Apr,e.hass,t.entity,n,e._valueChanged)}))})),this.hass,this._addEntity):(0,l.dy)(r||(r=v([""])))}},{kind:"method",key:"firstUpdated",value:function(){u.default.mount(u.OnSpill),u.default.mount(new u.AutoScroll)}},{kind:"method",key:"updated",value:function(e){z(D(m.prototype),"updated",this).call(this,e);var t=e.has("_attached"),n=e.has("entities");if(n||t){var r;if(t&&!this._attached)return null===(r=this._sortable)||void 0===r||r.destroy(),void(this._sortable=void 0);this._sortable||!this.entities?n&&this._handleEntitiesChanged():this._createSortable()}}},{kind:"method",key:"_handleEntitiesChanged",value:(h=y(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._renderEmptySortable=!0,e.next=3,this.updateComplete;case 3:for(t=this.shadowRoot.querySelector(".entities");t.lastElementChild;)t.removeChild(t.lastElementChild);this._renderEmptySortable=!1;case 6:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{kind:"method",key:"_createSortable",value:function(){var e,t=this;this._sortable=new u.default(this.shadowRoot.querySelector(".entities"),{animation:150,fallbackClass:"sortable-fallback",handle:"ha-svg-icon",dataIdAttr:"data-entity-id",onEnd:(e=y(regeneratorRuntime.mark((function e(n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t._entityMoved(n));case 1:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)})})}},{kind:"method",key:"_addEntity",value:(n=y(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==(n=t.detail.value)){e.next=3;break}return e.abrupt("return");case 3:r=this.entities.concat({entity:n}),t.target.value="",(0,f.B)(this,"entities-changed",{entities:r});case 6:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{kind:"method",key:"_entityMoved",value:function(e){if(e.oldIndex!==e.newIndex){var t=this.entities.concat();t.splice(e.newIndex,0,t.splice(e.oldIndex,1)[0]),(0,f.B)(this,"entities-changed",{entities:t})}}},{kind:"method",key:"_valueChanged",value:function(e){var t=e.detail.value,n=e.target.index,r=this.entities.concat();""===t?r.splice(n,1):r[n]=Object.assign({},r[n],{entity:t}),(0,f.B)(this,"entities-changed",{entities:r})}},{kind:"get",static:!0,key:"styles",value:function(){return[p.Y,(0,l.iv)(a||(a=v(["\n .entity {\n display: flex;\n align-items: center;\n }\n .entity ha-svg-icon {\n padding-right: 8px;\n cursor: move;\n }\n .entity ha-entity-picker {\n flex-grow: 1;\n }\n "])))]}}]}}),l.oi)},45890:function(e,t,n){"use strict";var r;n.d(t,{A:function(){return a}});var i,o,a=(0,n(50424).iv)(r||(i=["\n ha-switch {\n padding: 16px 6px;\n }\n .side-by-side {\n display: flex;\n }\n .side-by-side > * {\n flex: 1;\n padding-right: 8px;\n }\n .side-by-side > *:last-child {\n flex: 1;\n padding-right: 0;\n }\n .suffix {\n margin: 0 8px;\n }\n"],o||(o=i.slice(0)),r=Object.freeze(Object.defineProperties(i,{raw:{value:Object.freeze(o)}}))))},70651:function(e,t,n){"use strict";var r;n.d(t,{Y:function(){return a}});var i,o,a=(0,n(50424).iv)(r||(i=['\n #sortable a:nth-of-type(2n) paper-icon-item {\n animation-name: keyframes1;\n animation-iteration-count: infinite;\n transform-origin: 50% 10%;\n animation-delay: -0.75s;\n animation-duration: 0.25s;\n }\n\n #sortable a:nth-of-type(2n-1) paper-icon-item {\n animation-name: keyframes2;\n animation-iteration-count: infinite;\n animation-direction: alternate;\n transform-origin: 30% 5%;\n animation-delay: -0.5s;\n animation-duration: 0.33s;\n }\n\n #sortable a {\n height: 48px;\n display: flex;\n }\n\n #sortable {\n outline: none;\n display: block !important;\n }\n\n .hidden-panel {\n display: flex !important;\n }\n\n .sortable-fallback {\n display: none;\n }\n\n .sortable-ghost {\n opacity: 0.4;\n }\n\n .sortable-fallback {\n opacity: 0;\n }\n\n @keyframes keyframes1 {\n 0% {\n transform: rotate(-1deg);\n animation-timing-function: ease-in;\n }\n\n 50% {\n transform: rotate(1.5deg);\n animation-timing-function: ease-out;\n }\n }\n\n @keyframes keyframes2 {\n 0% {\n transform: rotate(1deg);\n animation-timing-function: ease-in;\n }\n\n 50% {\n transform: rotate(-1.5deg);\n animation-timing-function: ease-out;\n }\n }\n\n .show-panel,\n .hide-panel {\n display: none;\n position: absolute;\n top: 0;\n right: 4px;\n --mdc-icon-button-size: 40px;\n }\n\n :host([rtl]) .show-panel {\n right: initial;\n left: 4px;\n }\n\n .hide-panel {\n top: 4px;\n right: 8px;\n }\n\n :host([rtl]) .hide-panel {\n right: initial;\n left: 8px;\n }\n\n :host([expanded]) .hide-panel {\n display: block;\n }\n\n :host([expanded]) .show-panel {\n display: inline-flex;\n }\n\n paper-icon-item.hidden-panel,\n paper-icon-item.hidden-panel span,\n paper-icon-item.hidden-panel ha-icon[slot="item-icon"] {\n color: var(--secondary-text-color);\n cursor: pointer;\n }\n'],o||(o=i.slice(0)),r=Object.freeze(Object.defineProperties(i,{raw:{value:Object.freeze(o)}}))))}}]);
//# sourceMappingURL=chunk.08403f6a22d1aa6f222d.js.map