UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

2 lines 16.6 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[528],{33785:function(e,t,i){"use strict";i.r(t),i.d(t,{HuiPictureGlanceCardEditor:function(){return S}});i(8878),i(30879),i(53973),i(51095);var n=i(15652),r=i(4268),o=i(47181),a=(i(74535),i(10544),i(1528),i(24673),i(14748)),s=i(51598),c=i(45890);function l(e){return(l="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 u(){var e=h([" <paper-item>","</paper-item> "]);return u=function(){return e},e}function f(){var e=h(['\n <div class="card-config">\n <paper-input\n .label="'," (",')"\n .value="','"\n .configValue="','"\n @value-changed="','"\n ></paper-input>\n <paper-input\n .label="'," (",')"\n .value="','"\n .configValue="','"\n @value-changed="','"\n ></paper-input>\n <ha-entity-picker\n .label="'," (",')"\n .hass=','\n .value="','"\n .configValue=','\n @value-changed="','"\n allow-custom-entity\n .includeDomains=','\n ></ha-entity-picker>\n <div class="side-by-side">\n <paper-dropdown-menu\n .label="'," (",')"\n .configValue="','"\n @value-changed="','"\n >\n <paper-listbox\n slot="dropdown-content"\n .selected="','"\n >\n ','\n </paper-listbox>\n </paper-dropdown-menu>\n <paper-input\n .label="'," (",')"\n .value="','"\n .configValue="','"\n @value-changed="','"\n ></paper-input>\n </div>\n <ha-entity-picker\n .label="'," (",')"\n .hass=','\n .value="','"\n .configValue=','\n @value-changed="','"\n allow-custom-entity\n ></ha-entity-picker>\n <div class="side-by-side">\n <hui-action-editor\n .label="'," (",')"\n .hass=','\n .config="','"\n .actions="','"\n .configValue="','"\n @value-changed="','"\n ></hui-action-editor>\n <hui-action-editor\n .label="'," (",')"\n .hass=','\n .config="','"\n .actions="','"\n .configValue="','"\n @value-changed="','"\n ></hui-action-editor>\n </div>\n <hui-entity-editor\n .hass=','\n .entities="','"\n @entities-changed="','"\n ></hui-entity-editor>\n <hui-theme-select-editor\n .hass=','\n .value="','"\n .configValue="','"\n @value-changed="','"\n ></hui-theme-select-editor>\n </div>\n ']);return f=function(){return e},e}function d(){var e=h([""]);return d=function(){return e},e}function h(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){return(m=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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=_(e);if(t){var r=_(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return v(this,i)}}function v(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?y(e):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(){b=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(i){t.forEach((function(t){t.kind===i&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var i=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var r=t.placement;if(t.kind===n&&("static"===r||"prototype"===r)){var o="static"===r?e:i;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var i=t.descriptor;if("field"===t.kind){var n=t.initializer;i={enumerable:i.enumerable,writable:i.writable,configurable:i.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,i)},decorateClass:function(e,t){var i=[],n=[],r={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,r)}),this),e.forEach((function(e){if(!E(e))return i.push(e);var t=this.decorateElement(e,r);i.push(t.element),i.push.apply(i,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:i,finishers:n};var o=this.decorateConstructor(i,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,i){var n=t[e.placement];if(!i&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var i=[],n=[],r=e.decorators,o=r.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,r[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&n.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],t);i.push.apply(i,l)}}return{element:e,finishers:n,extras:i}},decorateConstructor:function(e,t){for(var i=[],n=t.length-1;n>=0;n--){var r=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(r)||r);if(void 0!==o.finisher&&i.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:i}},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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?P(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 i=z(e.key),n=String(e.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 r=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:i,placement:n,descriptor:Object.assign({},r)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(r,"get","The property descriptor of a field descriptor"),this.disallowProperty(r,"set","The property descriptor of a field descriptor"),this.disallowProperty(r,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:j(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 i=j(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:i}},runClassFinishers:function(e,t){for(var i=0;i<t.length;i++){var n=(0,t[i])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,t,i){if(void 0!==e[t])throw new TypeError(i+" can't have a ."+t+" property.")}};return e}function k(e){var t,i=z(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 n={kind:"field"===e.kind?"field":"method",key:i,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function w(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function E(e){return e.decorators&&e.decorators.length}function C(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function j(e,t){var i=e[t];if(void 0!==i&&"function"!=typeof i)throw new TypeError("Expected '"+t+"' to be a function");return i}function z(e){var t=function(e,t){if("object"!==l(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===l(t)?t:String(t)}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var O=(0,r.Ry)({type:(0,r.Z_)(),title:(0,r.jt)((0,r.Z_)()),entity:(0,r.jt)((0,r.Z_)()),image:(0,r.jt)((0,r.Z_)()),camera_image:(0,r.jt)((0,r.Z_)()),camera_view:(0,r.jt)((0,r.Z_)()),aspect_ratio:(0,r.jt)((0,r.Z_)()),tap_action:(0,r.jt)(s.f),hold_action:(0,r.jt)(s.f),entities:(0,r.IX)(s.K),theme:(0,r.jt)((0,r.Z_)())}),D=["camera"],S=function(e,t,i,n){var r=b();if(n)for(var o=0;o<n.length;o++)r=n[o](r);var a=t((function(e){r.initializeInstanceElements(e,s.elements)}),i),s=r.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var r,o=e[n];if("method"===o.kind&&(r=t.find(i)))if(C(o.descriptor)||C(r.descriptor)){if(E(o)||E(r))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");r.descriptor=o.descriptor}else{if(E(o)){if(E(r))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");r.decorators=o.decorators}w(o,r)}else t.push(o)}return t}(a.d.map(k)),e);return r.initializeClassElements(a.F,s.elements),r.runClassFinishers(a.F,s.finishers)}([(0,n.Mo)("hui-picture-glance-card-editor")],(function(e,t){return{F: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&&m(e,t)}(n,t);var i=g(n);function n(){var t;p(this,n);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return t=i.call.apply(i,[this].concat(o)),e(y(t)),t}return n}(t),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:"field",decorators:[(0,n.sz)()],key:"_configEntities",value:void 0},{kind:"method",key:"setConfig",value:function(e){(0,r.hu)(e,O),this._config=e,this._configEntities=(0,a.Q)(e.entities)}},{kind:"get",key:"_entity",value:function(){return this._config.entity||""}},{kind:"get",key:"_title",value:function(){return this._config.title||""}},{kind:"get",key:"_image",value:function(){return this._config.image||this._camera_image?"":"/images/image.jpg"}},{kind:"get",key:"_camera_image",value:function(){return this._config.camera_image||""}},{kind:"get",key:"_camera_view",value:function(){return this._config.camera_view||"auto"}},{kind:"get",key:"_state_image",value:function(){return this._config.state_image||{}}},{kind:"get",key:"_aspect_ratio",value:function(){return this._config.aspect_ratio||""}},{kind:"get",key:"_tap_action",value:function(){return this._config.tap_action||{action:"toggle"}}},{kind:"get",key:"_hold_action",value:function(){return this._config.hold_action||{action:"more-info"}}},{kind:"get",key:"_theme",value:function(){return this._config.theme||""}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return(0,n.dy)(d());var e=["more-info","toggle","navigate","call-service","none"],t=["auto","live"];return(0,n.dy)(f(),this.hass.localize("ui.panel.lovelace.editor.card.generic.title"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this._title,"title",this._valueChanged,this.hass.localize("ui.panel.lovelace.editor.card.generic.image"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this._image,"image",this._valueChanged,this.hass.localize("ui.panel.lovelace.editor.card.generic.camera_image"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this.hass,this._camera_image,"camera_image",this._valueChanged,D,this.hass.localize("ui.panel.lovelace.editor.card.generic.camera_view"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),"camera_view",this._valueChanged,t.indexOf(this._camera_view),t.map((function(e){return(0,n.dy)(u(),e)})),this.hass.localize("ui.panel.lovelace.editor.card.generic.aspect_ratio"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this._aspect_ratio,"aspect_ratio",this._valueChanged,this.hass.localize("ui.panel.lovelace.editor.card.generic.entity"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this.hass,this._entity,"entity",this._valueChanged,this.hass.localize("ui.panel.lovelace.editor.card.generic.tap_action"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this.hass,this._tap_action,e,"tap_action",this._valueChanged,this.hass.localize("ui.panel.lovelace.editor.card.generic.hold_action"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this.hass,this._hold_action,e,"hold_action",this._valueChanged,this.hass,this._configEntities,this._valueChanged,this.hass,this._theme,"theme",this._valueChanged)}},{kind:"method",key:"_valueChanged",value:function(e){if(this._config&&this.hass){var t=e.target,i=e.detail.value;if(e.detail&&e.detail.entities)this._config=Object.assign({},this._config,{entities:e.detail.entities}),this._configEntities=(0,a.Q)(this._config.entities);else if(t.configValue){if(this["_".concat(t.configValue)]===i)return;!1===i||i?this._config=Object.assign({},this._config,function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}({},t.configValue,i)):(this._config=Object.assign({},this._config),delete this._config[t.configValue])}(0,o.B)(this,"config-changed",{config:this._config})}}},{kind:"get",static:!0,key:"styles",value:function(){return c.A}}]}}),n.oi)},14748:function(e,t,i){"use strict";function n(e){return e.map((function(e){return"string"==typeof e?{entity:e}:e}))}i.d(t,{Q:function(){return n}})}}]); //# sourceMappingURL=chunk.5e1db6cd74281f636e51.js.map