UNPKG

iobroker.lovelace

Version:

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

2 lines 19 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[612],{69470:function(e,t,r){"use strict";r.d(t,{j:function(){return i},fs:function(){return o},$y:function(){return s}});var n=function(e,t,r){return new Promise((function(n,i){var o=document.createElement(e),s="src",a="body";switch(o.onload=function(){return n(t)},o.onerror=function(){return i(t)},e){case"script":o.async=!0,r&&(o.type=r);break;case"link":o.type="text/css",o.rel="stylesheet",s="href",a="head"}o[s]=t,document[a].appendChild(o)}))},i=function(e){return n("link",e)},o=function(e){return n("script",e)},s=function(e){return n("script",e,"module")}},85415:function(e,t,r){"use strict";r.d(t,{q:function(){return n},w:function(){return i}});var n=function(e,t){return e<t?-1:e>t?1:0},i=function(e,t){return n(e.toLowerCase(),t.toLowerCase())}},15327:function(e,t,r){"use strict";r.d(t,{eL:function(){return n},SN:function(){return i},id:function(){return o},fg:function(){return s},j2:function(){return a},JR:function(){return c},Y:function(){return u},iM:function(){return l},Q2:function(){return f},Oh:function(){return d},vj:function(){return p},Gc:function(){return h}});var n=function(e){return e.sendMessagePromise({type:"lovelace/resources"})},i=function(e,t){return e.callWS(Object.assign({type:"lovelace/resources/create"},t))},o=function(e,t,r){return e.callWS(Object.assign({type:"lovelace/resources/update",resource_id:t},r))},s=function(e,t){return e.callWS({type:"lovelace/resources/delete",resource_id:t})},a=function(e){return e.callWS({type:"lovelace/dashboards/list"})},c=function(e,t){return e.callWS(Object.assign({type:"lovelace/dashboards/create"},t))},u=function(e,t,r){return e.callWS(Object.assign({type:"lovelace/dashboards/update",dashboard_id:t},r))},l=function(e,t){return e.callWS({type:"lovelace/dashboards/delete",dashboard_id:t})},f=function(e,t,r){return e.sendMessagePromise({type:"lovelace/config",url_path:t,force:r})},d=function(e,t,r){return e.callWS({type:"lovelace/config/save",url_path:t,config:r})},p=function(e,t){return e.callWS({type:"lovelace/config/delete",url_path:t})},h=function(e,t,r){return e.subscribeEvents((function(e){e.data.url_path===t&&r()}),"lovelace_updated")}},26765:function(e,t,r){"use strict";r.d(t,{Ys:function(){return s},g7:function(){return a},D9:function(){return c}});var n=r(47181),i=function(){return Promise.all([r.e(8200),r.e(879),r.e(6372),r.e(6547),r.e(6509),r.e(4821),r.e(7230)]).then(r.bind(r,1281))},o=function(e,t,r){return new Promise((function(o){var s=t.cancel,a=t.confirm;(0,n.B)(e,"show-dialog",{dialogTag:"dialog-box",dialogImport:i,dialogParams:Object.assign({},t,r,{cancel:function(){o(!!(null==r?void 0:r.prompt)&&null),s&&s()},confirm:function(e){o(!(null==r?void 0:r.prompt)||e),a&&a(e)}})})}))},s=function(e,t){return o(e,t)},a=function(e,t){return o(e,t,{confirmation:!0})},c=function(e,t){return o(e,t,{prompt:!0})}},47917:function(e,t,r){"use strict";r.r(t),r.d(t,{HaConfigLovelaceRescources:function(){return W}});r(29119);var n=r(55317),i=(r(32296),r(8878),r(25782),r(51095),r(15652)),o=r(14516),s=r(85415),a=(r(16509),r(52039),r(15327)),c=r(26765),u=(r(15291),r(96551),r(68500)),l=r(52730),f=r(47181),d=function(){return Promise.all([r.e(6372),r.e(4821),r.e(7407)]).then(r.bind(r,75682))};function p(e){return(p="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 h(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(u){return void r(u)}a.done?t(c):Promise.resolve(c).then(n,i)}function m(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){h(o,n,i,s,a,"next",e)}function a(e){h(o,n,i,s,a,"throw",e)}s(void 0)}))}}function v(){var e=g(["\n <hass-tabs-subpage-data-table\n .hass=","\n .narrow=",'\n back-path="/config"\n .route=',"\n .tabs=","\n .columns=","\n .data=","\n .noDataText=","\n @row-click=",'\n hasFab\n clickable\n >\n <mwc-fab\n slot="fab"\n title=',"\n @click=",'\n >\n <ha-svg-icon slot="icon" .path=',"></ha-svg-icon>\n </mwc-fab>\n </hass-tabs-subpage-data-table>\n "]);return v=function(){return e},e}function y(){var e=g([" <hass-loading-screen></hass-loading-screen> "]);return y=function(){return e},e}function b(){var e=g(["\n ","\n "]);return b=function(){return e},e}function g(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(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 r,n=A(e);if(t){var i=A(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return E(this,r)}}function E(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?P(e):t}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(){R=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var i=t.placement;if(t.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!O(e))return r.push(e);var t=this.decorateElement(e,i);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var o=this.decorateConstructor(r,t);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],i=e.decorators,o=i.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,i[o])(a)||a);e=c.element,this.addElementPlacement(e,t),c.finisher&&n.push(c.finisher);var u=c.extras;if(u){for(var l=0;l<u.length;l++)this.addElementPlacement(u[l],t);r.push.apply(r,u)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[n])(i)||i);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var s=0;s<e.length-1;s++)for(var a=s+1;a<e.length;a++)if(e[s].key===e[a].key&&e[s].placement===e[a].placement)throw new TypeError("Duplicated element ("+e[s].key+")")}}return{elements:e,finishers:r}},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 z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(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 r=C(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 i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:n,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:D(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 r=D(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(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,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function S(e){var t,r=C(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:r,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 x(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 j(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function D(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function C(e){var t=function(e,t){if("object"!==p(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===p(t)?t:String(t)}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t,r){return(T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=A(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var W=function(e,t,r,n){var i=R();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var s=t((function(e){i.initializeInstanceElements(e,a.elements)}),r),a=i.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},n=0;n<e.length;n++){var i,o=e[n];if("method"===o.kind&&(i=t.find(r)))if(j(o.descriptor)||j(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}x(o,i)}else t.push(o)}return t}(s.d.map(S)),e);return i.initializeClassElements(s.F,a.elements),i.runClassFinishers(s.F,a.finishers)}([(0,i.Mo)("ha-config-lovelace-resources")],(function(e,t){var r,p,h=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&&w(e,t)}(n,t);var r=_(n);function n(){var t;k(this,n);for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return t=r.call.apply(r,[this].concat(o)),e(P(t)),t}return n}(t);return{F:h,d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.Cb)()],key:"isWide",value:void 0},{kind:"field",decorators:[(0,i.Cb)()],key:"narrow",value:void 0},{kind:"field",decorators:[(0,i.Cb)()],key:"route",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_resources",value:function(){return[]}},{kind:"field",key:"_columns",value:function(){var e=this;return(0,o.Z)((function(t){return{url:{title:e.hass.localize("ui.panel.config.lovelace.resources.picker.headers.url"),sortable:!0,filterable:!0,direction:"asc",grows:!0,forceLTR:!0},type:{title:e.hass.localize("ui.panel.config.lovelace.resources.picker.headers.type"),sortable:!0,filterable:!0,width:"30%",template:function(t){return(0,i.dy)(b(),e.hass.localize("ui.panel.config.lovelace.resources.types.".concat(t))||t)}}}}))}},{kind:"method",key:"render",value:function(){return this.hass&&void 0!==this._resources?(0,i.dy)(v(),this.hass,this.narrow,this.route,l.lovelaceTabs,this._columns(this.hass.language),this._resources,this.hass.localize("ui.panel.config.lovelace.resources.picker.no_resources"),this._editResource,this.hass.localize("ui.panel.config.lovelace.resources.picker.add_resource"),this._addResource,n.qX5):(0,i.dy)(y())}},{kind:"method",key:"firstUpdated",value:function(e){T(A(h.prototype),"firstUpdated",this).call(this,e),this._getResources()}},{kind:"method",key:"_getResources",value:(p=m(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,a.eL)(this.hass.connection);case 2:this._resources=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{kind:"method",key:"_editResource",value:function(e){var t,r;if("storage"===(null===(t=this.hass.panels.lovelace)||void 0===t||null===(r=t.config)||void 0===r?void 0:r.mode)){var n=e.detail.id,i=this._resources.find((function(e){return e.id===n}));this._openDialog(i)}else(0,c.Ys)(this,{text:this.hass.localize("ui.panel.config.lovelace.resources.cant_edit_yaml")})}},{kind:"method",key:"_addResource",value:function(){var e,t;"storage"===(null===(e=this.hass.panels.lovelace)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mode)?this._openDialog():(0,c.Ys)(this,{text:this.hass.localize("ui.panel.config.lovelace.resources.cant_edit_yaml")})}},{kind:"method",key:"_openDialog",value:(r=m(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=this,i={resource:t,createResource:function(){var e=m(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,a.SN)(r.hass,t);case 2:n=e.sent,r._resources=r._resources.concat(n).sort((function(e,t){return(0,s.q)(e.url,t.url)})),(0,u.k)([n],r.hass.auth.data.hassUrl);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),updateResource:function(){var e=m(regeneratorRuntime.mark((function e(n){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,a.id)(r.hass,t.id,n);case 2:i=e.sent,r._resources=r._resources.map((function(e){return e===t?i:e})),(0,u.k)([i],r.hass.auth.data.hassUrl);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),removeResource:function(){var e=m(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,c.g7)(r,{text:r.hass.localize("ui.panel.config.lovelace.resources.confirm_delete")});case 2:if(e.sent){e.next=4;break}return e.abrupt("return",!1);case 4:return e.prev=4,e.next=7,(0,a.fg)(r.hass,t.id);case 7:return r._resources=r._resources.filter((function(e){return e!==t})),(0,c.g7)(r,{title:r.hass.localize("ui.panel.config.lovelace.resources.refresh_header"),text:r.hass.localize("ui.panel.config.lovelace.resources.refresh_body"),confirm:function(){return location.reload()}}),e.abrupt("return",!0);case 12:return e.prev=12,e.t0=e.catch(4),e.abrupt("return",!1);case 15:case"end":return e.stop()}}),e,null,[[4,12]])})));return function(){return e.apply(this,arguments)}}()},(0,f.B)(n,"show-dialog",{dialogTag:"dialog-lovelace-resource-detail",dialogImport:d,dialogParams:i});case 1:case"end":return e.stop()}var n,i}),e,this)}))),function(e){return r.apply(this,arguments)})}]}}),i.oi)},68500:function(e,t,r){"use strict";r.d(t,{k:function(){return s}});var n=r(69470),i={},o={},s=function(e,t){return e.forEach((function(e){var r=new URL(e.url,t).toString();switch(e.type){case"css":if(r in i)break;i[r]=(0,n.j)(r);break;case"js":if(r in o)break;o[r]=(0,n.fs)(r);break;case"module":(0,n.$y)(r);break;default:console.warn("Unknown resource type specified: ".concat(e.type))}}))}}}]); //# sourceMappingURL=chunk.b5e4483ce1cc1931b693.js.map