UNPKG

iobroker.lovelace

Version:

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

2 lines 16.9 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["12622"],{12582:function(e,i,t){t.d(i,{Z:()=>a});t(9359),t(31526),t(70104),t(11740);function a(e){if(!e||"object"!=typeof e)return e;if("[object Date]"==Object.prototype.toString.call(e))return new Date(e.getTime());if(Array.isArray(e))return e.map(a);var i={};return Object.keys(e).forEach((function(t){i[t]=a(e[t])})),i}},68958:function(e,i,t){t.d(i,{t:()=>o});t(92745),t(9359),t(31526),t(77439),t(19423),t(88972);class a{constructor(e=window.localStorage){this.storage=void 0,this._storage={},this._listeners={},this.storage=e,e===window.localStorage&&window.addEventListener("storage",(e=>{e.key&&this.hasKey(e.key)&&(this._storage[e.key]=e.newValue?JSON.parse(e.newValue):e.newValue,this._listeners[e.key]&&this._listeners[e.key].forEach((i=>i(e.oldValue?JSON.parse(e.oldValue):e.oldValue,this._storage[e.key]))))}))}addFromStorage(e){if(!this._storage[e]){const i=this.storage.getItem(e);i&&(this._storage[e]=JSON.parse(i))}}subscribeChanges(e,i){return this._listeners[e]?this._listeners[e].push(i):this._listeners[e]=[i],()=>{this.unsubscribeChanges(e,i)}}unsubscribeChanges(e,i){if(!(e in this._listeners))return;const t=this._listeners[e].indexOf(i);-1!==t&&this._listeners[e].splice(t,1)}hasKey(e){return e in this._storage}getValue(e){return this._storage[e]}setValue(e,i){const t=this._storage[e];this._storage[e]=i;try{void 0===i?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify(i))}catch(a){}finally{this._listeners[e]&&this._listeners[e].forEach((e=>e(t,i)))}}}const n={},o=e=>i=>{const t=e.storage||"localStorage";let o;t&&t in n?o=n[t]:(o=new a(window[t]),n[t]=o);const d=String(i.key),l=e.key||String(i.key),r=i.initializer?i.initializer():void 0;o.addFromStorage(l);const s=!1!==e.subscribe?e=>o.subscribeChanges(l,((t,a)=>{e.requestUpdate(i.key,t)})):void 0,c=()=>o.hasKey(l)?e.deserializer?e.deserializer(o.getValue(l)):o.getValue(l):r;return{kind:"method",placement:"prototype",key:i.key,descriptor:{set(t){((t,a)=>{let n;e.state&&(n=c()),o.setValue(l,e.serializer?e.serializer(a):a),e.state&&t.requestUpdate(i.key,n)})(this,t)},get(){return c()},enumerable:!0,configurable:!0},finisher(t){if(e.state&&e.subscribe){const e=t.prototype.connectedCallback,i=t.prototype.disconnectedCallback;t.prototype.connectedCallback=function(){e.call(this),this[`__unbsubLocalStorage${d}`]=null==s?void 0:s(this)},t.prototype.disconnectedCallback=function(){var e;i.call(this),null===(e=this[`__unbsubLocalStorage${d}`])||void 0===e||e.call(this),this[`__unbsubLocalStorage${d}`]=void 0}}e.state&&t.createProperty(i.key,Object.assign({noAccessor:!0},e.stateOptions))}}}},83166:function(e,i,t){var a=t(61701),n=t(72621),o=(t(71695),t(47021),t(1105)),d=t(33990),l=t(57243),r=t(50778),s=t(5111);let c,h,u,f,g=e=>e;(0,a.Z)([(0,r.Mo)("ha-textfield")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"iconTrailing",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,r.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,r.IO)("input")],key:"formElement",value:void 0},{kind:"method",key:"updated",value:function(e){(0,n.Z)(t,"updated",this,3)([e]),(e.has("invalid")||e.has("errorMessage"))&&(this.setCustomValidity(this.invalid?this.errorMessage||this.validationMessage||"Invalid":""),(this.invalid||this.validateOnInitialRender||e.has("invalid")&&void 0!==e.get("invalid"))&&this.reportValidity()),e.has("autocomplete")&&(this.autocomplete?this.formElement.setAttribute("autocomplete",this.autocomplete):this.formElement.removeAttribute("autocomplete")),e.has("autocorrect")&&(this.autocorrect?this.formElement.setAttribute("autocorrect",this.autocorrect):this.formElement.removeAttribute("autocorrect")),e.has("inputSpellcheck")&&(this.inputSpellcheck?this.formElement.setAttribute("spellcheck",this.inputSpellcheck):this.formElement.removeAttribute("spellcheck"))}},{kind:"method",key:"renderIcon",value:function(e,i=!1){const t=i?"trailing":"leading";return(0,l.dy)(c||(c=g` <span class="mdc-text-field__icon mdc-text-field__icon--${0}" tabindex="${0}"> <slot name="${0}Icon"></slot> </span> `),t,i?1:-1,t)}},{kind:"field",static:!0,key:"styles",value(){return[d.W,(0,l.iv)(h||(h=g`.mdc-text-field__input{width:var(--ha-textfield-input-width,100%)}.mdc-text-field:not(.mdc-text-field--with-leading-icon){padding:var(--text-field-padding,0px 16px)}.mdc-text-field__affix--suffix{padding-left:var(--text-field-suffix-padding-left,12px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,12px);padding-inline-end:var(--text-field-suffix-padding-right,0px);direction:ltr}.mdc-text-field--with-leading-icon{padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,16px);direction:var(--direction)}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon{padding-left:var(--text-field-suffix-padding-left,0px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,0px)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--suffix{color:var(--secondary-text-color)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon{color:var(--secondary-text-color)}.mdc-text-field__icon--leading{margin-inline-start:16px;margin-inline-end:8px;direction:var(--direction)}.mdc-text-field__icon--trailing{padding:var(--textfield-icon-trailing-padding,12px)}.mdc-floating-label:not(.mdc-floating-label--float-above){text-overflow:ellipsis;width:inherit;padding-right:30px;padding-inline-end:30px;padding-inline-start:initial;box-sizing:border-box;direction:var(--direction)}input{text-align:var(--text-field-text-align,start)}input[type=color]{height:20px}::-ms-reveal{display:none}:host([no-spinner]) input::-webkit-inner-spin-button,:host([no-spinner]) input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=color]::-webkit-color-swatch-wrapper{padding:0}:host([no-spinner]) input[type=number]{-moz-appearance:textfield}.mdc-text-field__ripple{overflow:hidden}.mdc-text-field{overflow:var(--text-field-overflow)}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start);direction:var(--direction);text-align:var(--float-start)}.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 48px - var(--text-field-suffix-padding-left,0px));inset-inline-start:calc(48px + var(--text-field-suffix-padding-left,0px))!important;inset-inline-end:initial!important;direction:var(--direction)}.mdc-text-field__input[type=number]{direction:var(--direction)}.mdc-text-field__affix--prefix{padding-right:var(--text-field-prefix-padding-right,2px);padding-inline-end:var(--text-field-prefix-padding-right,2px);padding-inline-start:initial}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--prefix{color:var(--mdc-text-field-label-ink-color)}#helper-text ha-markdown{display:inline-block}`)),"rtl"===s.E.document.dir?(0,l.iv)(u||(u=g`.mdc-floating-label,.mdc-text-field--with-leading-icon,.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label,.mdc-text-field__icon--leading,.mdc-text-field__input[type=number]{direction:rtl;--direction:rtl}`)):(0,l.iv)(f||(f=g``))]}}]}}),o.P)},36841:function(e,i,t){var a=t(61701),n=(t(71695),t(9359),t(56475),t(40251),t(47021),t(57243)),o=t(50778),d=(t(23334),t(37583),t(83166),t(36522));let l,r,s,c=e=>e;(0,a.Z)([(0,o.Mo)("search-input")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"filter",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"suffix",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"autofocus",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:String})],key:"label",value:void 0},{kind:"method",key:"focus",value:function(){var e;null===(e=this._input)||void 0===e||e.focus()}},{kind:"field",decorators:[(0,o.IO)("ha-textfield",!0)],key:"_input",value:void 0},{kind:"method",key:"render",value:function(){return(0,n.dy)(l||(l=c` <ha-textfield .autofocus="${0}" .label="${0}" .value="${0}" icon .iconTrailing="${0}" @input="${0}"> <slot name="prefix" slot="leadingIcon"> <ha-svg-icon tabindex="-1" class="prefix" .path="${0}"></ha-svg-icon> </slot> <div class="trailing" slot="trailingIcon"> ${0} <slot name="suffix"></slot> </div> </ha-textfield> `),this.autofocus,this.label||this.hass.localize("ui.common.search"),this.filter||"",this.filter||this.suffix,this._filterInputChanged,"M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",this.filter&&(0,n.dy)(r||(r=c` <ha-icon-button @click="${0}" .label="${0}" .path="${0}" class="clear-button"></ha-icon-button> `),this._clearSearch,this.hass.localize("ui.common.clear"),"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"))}},{kind:"method",key:"_filterChanged",value:async function(e){(0,d.B)(this,"value-changed",{value:String(e)})}},{kind:"method",key:"_filterInputChanged",value:async function(e){this._filterChanged(e.target.value)}},{kind:"method",key:"_clearSearch",value:async function(){this._filterChanged("")}},{kind:"field",static:!0,key:"styles",value(){return(0,n.iv)(s||(s=c`:host{display:inline-flex}ha-icon-button,ha-svg-icon{color:var(--primary-text-color)}ha-svg-icon{outline:0}.clear-button{--mdc-icon-size:20px}ha-textfield{display:inherit}.trailing{display:flex;align-items:center}`))}}]}}),n.oi)},38327:function(e,i,t){t.a(e,(async function(e,a){try{t.r(i),t.d(i,{HuiConditionalCardEditor:()=>A});var n=t(61701),o=(t(71695),t(19423),t(47021),t(56820),t(99619),t(12582)),d=t(57243),l=t(50778),r=t(62900),s=t(68958),c=t(36522),h=(t(99426),t(59826),t(7285),t(37583),t(91728)),u=t(3054),f=(t(32145),t(43299)),g=t(18200),p=t(10991),v=e([h,u,f]);[h,u,f]=v.then?(await v)():v;let m,b,x,_,k,y,C=e=>e;const w="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",V="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",$="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z",M=(0,r.f0)(g.I,(0,r.Ry)({card:(0,r.Yj)(),conditions:(0,r.jt)((0,r.IX)((0,r.Yj)()))}));let A=(0,n.Z)([(0,l.Mo)("hui-conditional-card-editor")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,s.t)({key:"dashboardCardClipboard",state:!1,subscribe:!1,storage:"sessionStorage"})],key:"_clipboard",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_GUImode",value(){return!0}},{kind:"field",decorators:[(0,l.SB)()],key:"_guiModeAvailable",value(){return!0}},{kind:"field",decorators:[(0,l.SB)()],key:"_cardTab",value(){return!1}},{kind:"field",decorators:[(0,l.IO)("hui-card-element-editor")],key:"_cardEditorEl",value:void 0},{kind:"method",key:"setConfig",value:function(e){(0,r.hu)(e,M),this._config=e}},{kind:"method",key:"focusYamlEditor",value:function(){var e;null===(e=this._cardEditorEl)||void 0===e||e.focusYamlEditor()}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return d.Ld;const e=!this._cardEditorEl||this._GUImode;return(0,d.dy)(m||(m=C` <mwc-tab-bar .activeIndex="${0}" @MDCTabBar:activated="${0}"> <mwc-tab .label="${0}"></mwc-tab> <mwc-tab .label="${0}"></mwc-tab> </mwc-tab-bar> ${0} `),this._cardTab?1:0,this._selectTab,this.hass.localize("ui.panel.lovelace.editor.card.conditional.conditions"),this.hass.localize("ui.panel.lovelace.editor.card.conditional.card"),this._cardTab?(0,d.dy)(b||(b=C` <div class="card"> ${0} </div> `),void 0!==this._config.card.type?(0,d.dy)(x||(x=C` <div class="card-options"> <ha-icon-button class="gui-mode-button" @click="${0}" .disabled="${0}" .label="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .label="${0}" .path="${0}" @click="${0}"></ha-icon-button> <mwc-button @click="${0}">${0}</mwc-button> </div> <hui-card-element-editor .hass="${0}" .value="${0}" .lovelace="${0}" @config-changed="${0}" @GUImode-changed="${0}"></hui-card-element-editor> `),this._toggleMode,!this._guiModeAvailable,this.hass.localize(e?"ui.panel.lovelace.editor.edit_card.show_code_editor":"ui.panel.lovelace.editor.edit_card.show_visual_editor"),e?w:$,this.hass.localize("ui.panel.lovelace.editor.edit_card.copy"),V,this._handleCopyCard,this._handleReplaceCard,this.hass.localize("ui.panel.lovelace.editor.card.conditional.change_type"),this.hass,this._config.card,this.lovelace,this._handleCardChanged,this._handleGUIModeChanged):(0,d.dy)(_||(_=C` <hui-card-picker .hass="${0}" .lovelace="${0}" @config-changed="${0}"></hui-card-picker> `),this.hass,this.lovelace,this._handleCardPicked)):(0,d.dy)(k||(k=C` <ha-alert alert-type="info"> ${0} </ha-alert> <ha-card-conditions-editor .hass="${0}" .conditions="${0}" @value-changed="${0}"> </ha-card-conditions-editor> `),this.hass.localize("ui.panel.lovelace.editor.condition-editor.explanation"),this.hass,this._config.conditions,this._conditionChanged))}},{kind:"method",key:"_selectTab",value:function(e){this._cardTab=1===e.detail.index}},{kind:"method",key:"_toggleMode",value:function(){var e;null===(e=this._cardEditorEl)||void 0===e||e.toggleMode()}},{kind:"method",key:"_setMode",value:function(e){this._GUImode=e,this._cardEditorEl&&(this._cardEditorEl.GUImode=e)}},{kind:"method",key:"_handleGUIModeChanged",value:function(e){e.stopPropagation(),this._GUImode=e.detail.guiMode,this._guiModeAvailable=e.detail.guiModeAvailable}},{kind:"method",key:"_handleCardPicked",value:function(e){e.stopPropagation(),this._config&&(this._setMode(!0),this._guiModeAvailable=!0,this._config=Object.assign(Object.assign({},this._config),{},{card:e.detail.config}),(0,c.B)(this,"config-changed",{config:this._config}))}},{kind:"method",key:"_handleCopyCard",value:function(){this._config&&(this._clipboard=(0,o.Z)(this._config.card))}},{kind:"method",key:"_handleCardChanged",value:function(e){e.stopPropagation(),this._config&&(this._config=Object.assign(Object.assign({},this._config),{},{card:e.detail.config}),this._guiModeAvailable=e.detail.guiModeAvailable,(0,c.B)(this,"config-changed",{config:this._config}))}},{kind:"method",key:"_handleReplaceCard",value:function(){this._config&&(this._config=Object.assign(Object.assign({},this._config),{},{card:{}}),(0,c.B)(this,"config-changed",{config:this._config}))}},{kind:"method",key:"_conditionChanged",value:function(e){if(e.stopPropagation(),!this._config)return;const i=e.detail.value;this._config=Object.assign(Object.assign({},this._config),{},{conditions:i}),(0,c.B)(this,"config-changed",{config:this._config})}},{kind:"get",static:!0,key:"styles",value:function(){return[p.A,(0,d.iv)(y||(y=C`mwc-tab-bar{border-bottom:1px solid var(--divider-color)}ha-alert{display:block;margin-top:12px}.card{margin-top:8px;border:1px solid var(--divider-color);padding:12px}@media (max-width:450px){.card,.condition{margin:8px -12px 0}}.card .card-options{display:flex;justify-content:flex-end;width:100%}.gui-mode-button{margin-right:auto;margin-inline-end:auto;margin-inline-start:initial}`))]}}]}}),d.oi);a()}catch(m){a(m)}}))},18200:function(e,i,t){t.d(i,{I:()=>n});var a=t(62900);const n=(0,a.Ry)({type:(0,a.Z_)(),view_layout:(0,a.Yj)(),layout_options:(0,a.Yj)(),grid_options:(0,a.Yj)(),visibility:(0,a.Yj)()})}}]); //# sourceMappingURL=12622.d4d2b679bc536f11.js.map