iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
3 lines • 19.3 kB
JavaScript
/*! For license information please see chunk.d25c6cb0164d85ae3245.js.LICENSE.txt */
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[9307],{25782:function(t,e,n){"use strict";n(43437),n(65660),n(47686),n(97968);var r=n(9672),o=n(50856),i=n(33760);function a(){var t=function(t,e){e||(e=t.slice(0));return Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}(['\n <style include="paper-item-shared-styles"></style>\n <style>\n :host {\n @apply --layout-horizontal;\n @apply --layout-center;\n @apply --paper-font-subhead;\n\n @apply --paper-item;\n @apply --paper-icon-item;\n }\n\n .content-icon {\n @apply --layout-horizontal;\n @apply --layout-center;\n\n width: var(--paper-item-icon-width, 56px);\n @apply --paper-item-icon;\n }\n </style>\n\n <div id="contentIcon" class="content-icon">\n <slot name="item-icon"></slot>\n </div>\n <slot></slot>\n']);return a=function(){return t},t}(0,r.k)({_template:(0,o.d)(a()),is:"paper-icon-item",behaviors:[i.U]})},33760:function(t,e,n){"use strict";n.d(e,{U:function(){return i}});n(43437);var r=n(51644),o=n(26110),i=[r.P,o.a,{hostAttributes:{role:"option",tabindex:"0"}}]},89194:function(t,e,n){"use strict";n(43437),n(65660),n(1656),n(47686);var r=n(9672),o=n(50856);function i(){var t=function(t,e){e||(e=t.slice(0));return Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}(["\n <style>\n :host {\n overflow: hidden; /* needed for text-overflow: ellipsis to work on ff */\n @apply --layout-vertical;\n @apply --layout-center-justified;\n @apply --layout-flex;\n }\n\n :host([two-line]) {\n min-height: var(--paper-item-body-two-line-min-height, 72px);\n }\n\n :host([three-line]) {\n min-height: var(--paper-item-body-three-line-min-height, 88px);\n }\n\n :host > ::slotted(*) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n :host > ::slotted([secondary]) {\n @apply --paper-font-body1;\n\n color: var(--paper-item-body-secondary-color, var(--secondary-text-color));\n\n @apply --paper-item-body-secondary;\n }\n </style>\n\n <slot></slot>\n"]);return i=function(){return t},t}(0,r.k)({_template:(0,o.d)(i()),is:"paper-item-body"})},97968:function(t,e,n){"use strict";n(65660),n(15495),n(1656),n(47686);var r=document.createElement("template");r.setAttribute("style","display: none;"),r.innerHTML="<dom-module id=\"paper-item-shared-styles\">\n <template>\n <style>\n :host, .paper-item {\n display: block;\n position: relative;\n min-height: var(--paper-item-min-height, 48px);\n padding: 0px 16px;\n }\n\n .paper-item {\n @apply --paper-font-subhead;\n border:none;\n outline: none;\n background: white;\n width: 100%;\n text-align: left;\n }\n\n :host([hidden]), .paper-item[hidden] {\n display: none !important;\n }\n\n :host(.iron-selected), .paper-item.iron-selected {\n font-weight: var(--paper-item-selected-weight, bold);\n\n @apply --paper-item-selected;\n }\n\n :host([disabled]), .paper-item[disabled] {\n color: var(--paper-item-disabled-color, var(--disabled-text-color));\n\n @apply --paper-item-disabled;\n }\n\n :host(:focus), .paper-item:focus {\n position: relative;\n outline: 0;\n\n @apply --paper-item-focused;\n }\n\n :host(:focus):before, .paper-item:focus:before {\n @apply --layout-fit;\n\n background: currentColor;\n content: '';\n opacity: var(--dark-divider-opacity);\n pointer-events: none;\n\n @apply --paper-item-focused-before;\n }\n </style>\n </template>\n</dom-module>",document.head.appendChild(r.content)},22311:function(t,e,n){"use strict";n.d(e,{N:function(){return o}});var r=n(58831),o=function(t){return(0,r.M)(t.entity_id)}},26765:function(t,e,n){"use strict";n.d(e,{Ys:function(){return a},g7:function(){return u},D9:function(){return s}});var r=n(47181),o=function(){return Promise.all([n.e(8200),n.e(879),n.e(6372),n.e(6547),n.e(6509),n.e(4821),n.e(7230)]).then(n.bind(n,1281))},i=function(t,e,n){return new Promise((function(i){var a=e.cancel,u=e.confirm;(0,r.B)(t,"show-dialog",{dialogTag:"dialog-box",dialogImport:o,dialogParams:Object.assign({},e,n,{cancel:function(){i(!!(null==n?void 0:n.prompt)&&null),a&&a()},confirm:function(t){i(!(null==n?void 0:n.prompt)||t),u&&u(t)}})})}))},a=function(t,e){return i(t,e)},u=function(t,e){return i(t,e,{confirmation:!0})},s=function(t,e){return i(t,e,{prompt:!0})}},11052:function(t,e,n){"use strict";n.d(e,{I:function(){return f}});var r=n(76389),o=n(47181);function i(t){return(i="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 a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(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 n,r=p(t);if(e){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(t,e){return!e||"object"!==i(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 p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=(0,r.o)((function(t){return 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&&s(t,e)}(c,t);var e,n,r,i=l(c);function c(){return a(this,c),i.apply(this,arguments)}return e=c,(n=[{key:"fire",value:function(t,e,n){return n=n||{},(0,o.B)(n.node||this,t,e,n)}}])&&u(e.prototype,n),r&&u(e,r),c}(t)}))},1265:function(t,e,n){"use strict";var r=n(76389);function o(t){return(o="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 a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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 n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){return!e||"object"!==o(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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}e.Z=(0,r.o)((function(t){return 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&&u(t,e)}(l,t);var e,n,r,o=s(l);function l(){return i(this,l),o.apply(this,arguments)}return e=l,r=[{key:"properties",get:function(){return{hass:Object,localize:{type:Function,computed:"__computeLocalize(hass.localize)"}}}}],(n=[{key:"__computeLocalize",value:function(t){return t}}])&&a(e.prototype,n),r&&a(e,r),l}(t)}))},89875:function(t,e,n){"use strict";n.r(e);n(53918),n(32296),n(30879);var r=n(50856),o=n(28426),i=n(50947),a=(n(74535),n(52039),n(53822),n(26765)),u=n(11052),s=n(1265),l=(n(3426),n(55317)),c=n(87744);function p(t){return(p="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 f(){var t=function(t,e){e||(e=t.slice(0));return Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}(['\n <style include="ha-style">\n :host {\n -ms-user-select: initial;\n -webkit-user-select: initial;\n -moz-user-select: initial;\n display: block;\n padding: 16px;\n }\n\n .inputs {\n max-width: 400px;\n }\n\n mwc-button {\n margin-top: 8px;\n }\n\n .entities th {\n text-align: left;\n }\n\n :host([rtl]) .entities th {\n text-align: right;\n }\n\n .entities tr {\n vertical-align: top;\n direction: ltr;\n }\n\n .entities tr:nth-child(odd) {\n background-color: var(--table-row-background-color, #fff);\n }\n\n .entities tr:nth-child(even) {\n background-color: var(--table-row-alternative-background-color, #eee);\n }\n .entities td {\n padding: 4px;\n min-width: 200px;\n word-break: break-word;\n }\n .entities ha-svg-icon {\n --mdc-icon-size: 20px;\n padding: 4px;\n cursor: pointer;\n }\n .entities td:nth-child(3) {\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .entities a {\n color: var(--primary-color);\n }\n </style>\n\n <div class="inputs">\n <p>\n [[localize(\'ui.panel.developer-tools.tabs.states.description1\')]]<br />\n [[localize(\'ui.panel.developer-tools.tabs.states.description2\')]]\n </p>\n\n <ha-entity-picker\n autofocus\n hass="[[hass]]"\n value="{{_entityId}}"\n on-change="entityIdChanged"\n allow-custom-entity\n ></ha-entity-picker>\n <paper-input\n label="[[localize(\'ui.panel.developer-tools.tabs.states.state\')]]"\n required\n autocapitalize="none"\n autocomplete="off"\n autocorrect="off"\n spellcheck="false"\n value="{{_state}}"\n class="state-input"\n ></paper-input>\n <p>\n [[localize(\'ui.panel.developer-tools.tabs.states.state_attributes\')]]\n </p>\n <ha-code-editor\n mode="yaml"\n value="[[_stateAttributes]]"\n error="[[!validJSON]]"\n on-value-changed="_yamlChanged"\n ></ha-code-editor>\n <mwc-button on-click="handleSetState" disabled="[[!validJSON]]" raised\n >[[localize(\'ui.panel.developer-tools.tabs.states.set_state\')]]</mwc-button\n >\n </div>\n\n <h1>\n [[localize(\'ui.panel.developer-tools.tabs.states.current_entities\')]]\n </h1>\n <table class="entities">\n <tr>\n <th>[[localize(\'ui.panel.developer-tools.tabs.states.entity\')]]</th>\n <th>[[localize(\'ui.panel.developer-tools.tabs.states.state\')]]</th>\n <th hidden$="[[narrow]]">\n [[localize(\'ui.panel.developer-tools.tabs.states.attributes\')]]\n <paper-checkbox checked="{{_showAttributes}}"></paper-checkbox>\n </th>\n </tr>\n <tr>\n <th>\n <paper-input\n label="[[localize(\'ui.panel.developer-tools.tabs.states.filter_entities\')]]"\n type="search"\n value="{{_entityFilter}}"\n ></paper-input>\n </th>\n <th>\n <paper-input\n label="[[localize(\'ui.panel.developer-tools.tabs.states.filter_states\')]]"\n type="search"\n value="{{_stateFilter}}"\n ></paper-input>\n </th>\n <th hidden$="[[!computeShowAttributes(narrow, _showAttributes)]]">\n <paper-input\n label="[[localize(\'ui.panel.developer-tools.tabs.states.filter_attributes\')]]"\n type="search"\n value="{{_attributeFilter}}"\n ></paper-input>\n </th>\n </tr>\n <tr hidden$="[[!computeShowEntitiesPlaceholder(_entities)]]">\n <td colspan="3">\n [[localize(\'ui.panel.developer-tools.tabs.states.no_entities\')]]\n </td>\n </tr>\n <template is="dom-repeat" items="[[_entities]]" as="entity">\n <tr>\n <td>\n <ha-svg-icon\n on-click="entityMoreInfo"\n alt="[[localize(\'ui.panel.developer-tools.tabs.states.more_info\')]]"\n title="[[localize(\'ui.panel.developer-tools.tabs.states.more_info\')]]"\n path="[[informationOutlineIcon()]]"\n ></ha-svg-icon>\n <a href="#" on-click="entitySelected">[[entity.entity_id]]</a>\n </td>\n <td>[[entity.state]]</td>\n <template\n is="dom-if"\n if="[[computeShowAttributes(narrow, _showAttributes)]]"\n >\n <td>[[attributeString(entity)]]</td>\n </template>\n </tr>\n </template>\n </table>\n ']);return f=function(){return t},t}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(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 n,r=v(t);if(e){var o=v(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m(this,n)}}function m(t,e){return!e||"object"!==p(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 v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var _={},w=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&&h(t,e)}(s,t);var e,n,o,u=b(s);function s(){return d(this,s),u.apply(this,arguments)}return e=s,o=[{key:"template",get:function(){return(0,r.d)(f())}},{key:"properties",get:function(){return{hass:{type:Object},parsedJSON:{type:Object,computed:"_computeParsedStateAttributes(_stateAttributes)"},validJSON:{type:Boolean,computed:"_computeValidJSON(parsedJSON)"},_entityId:{type:String,value:""},_entityFilter:{type:String,value:""},_stateFilter:{type:String,value:""},_attributeFilter:{type:String,value:""},_state:{type:String,value:""},_stateAttributes:{type:String,value:""},_showAttributes:{type:Boolean,value:!0},_entities:{type:Array,computed:"computeEntities(hass, _entityFilter, _stateFilter, _attributeFilter)"},rtl:{reflectToAttribute:!0,computed:"_computeRTL(hass)"}}}}],(n=[{key:"entitySelected",value:function(t){var e=t.model.entity;this._entityId=e.entity_id,this._state=e.state,this._stateAttributes=(0,i.safeDump)(e.attributes),t.preventDefault()}},{key:"entityIdChanged",value:function(){if(""===this._entityId)return this._state="",void(this._stateAttributes="");var t=this.hass.states[this._entityId];t&&(this._state=t.state,this._stateAttributes=(0,i.safeDump)(t.attributes))}},{key:"entityMoreInfo",value:function(t){t.preventDefault(),this.fire("hass-more-info",{entityId:t.model.entity.entity_id})}},{key:"handleSetState",value:function(){this._entityId?this.hass.callApi("POST","states/"+this._entityId,{state:this._state,attributes:this.parsedJSON}):(0,a.Ys)(this,{text:this.hass.localize("ui.panel.developer-tools.tabs.states.alert_entity_field")})}},{key:"informationOutlineIcon",value:function(){return l.EaN}},{key:"computeEntities",value:function(t,e,n,r){return Object.keys(t.states).map((function(e){return t.states[e]})).filter((function(t){if(!t.entity_id.includes(e.toLowerCase()))return!1;if(!t.state.includes(n.toLowerCase()))return!1;if(""!==r){var o=r.toLowerCase(),i=o.indexOf(":"),a=-1!==i,u=o,s=o;a&&(u=o.substring(0,i).trim(),s=o.substring(i+1).trim());for(var l=Object.keys(t.attributes),c=0;c<l.length;c++){var p=l[c];if(p.includes(u)&&!a)return!0;if(p.includes(u)||!a){var f=t.attributes[p];if(null!==f&&JSON.stringify(f).toLowerCase().includes(s))return!0}}return!1}return!0})).sort((function(t,e){return t.entity_id<e.entity_id?-1:t.entity_id>e.entity_id?1:0}))}},{key:"computeShowEntitiesPlaceholder",value:function(t){return 0===t.length}},{key:"computeShowAttributes",value:function(t,e){return!t&&e}},{key:"attributeString",value:function(t){var e,n,r,o,i="";for(e=0,n=Object.keys(t.attributes);e<n.length;e++)r=n[e],o=this.formatAttributeValue(t.attributes[r]),i+="".concat(r,": ").concat(o,"\n");return i}},{key:"formatAttributeValue",value:function(t){return Array.isArray(t)&&t.some((function(t){return t instanceof Object}))||!Array.isArray(t)&&t instanceof Object?"\n".concat((0,i.safeDump)(t)):Array.isArray(t)?t.join(", "):t}},{key:"_computeParsedStateAttributes",value:function(t){try{return t.trim()?(0,i.safeLoad)(t):{}}catch(e){return _}}},{key:"_computeValidJSON",value:function(t){return t!==_}},{key:"_yamlChanged",value:function(t){this._stateAttributes=t.detail.value}},{key:"_computeRTL",value:function(t){return(0,c.HE)(t)}}])&&y(e.prototype,n),o&&y(e,o),s}((0,u.I)((0,s.Z)(o.H3)));customElements.define("developer-tools-state",w)},3426:function(t,e,n){"use strict";n(21384);var r=n(11654),o=document.createElement("template");o.setAttribute("style","display: none;"),o.innerHTML='<dom-module id="ha-style">\n <template>\n <style>\n '.concat(r.Qx.cssText,"\n </style>\n </template>\n</dom-module>"),document.head.appendChild(o.content)}}]);
//# sourceMappingURL=chunk.d25c6cb0164d85ae3245.js.map