UNPKG

iobroker.lovelace

Version:

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

2 lines 16.1 kB
export const __webpack_ids__=["12622"];export const __webpack_modules__={12582:function(i,e,t){t.d(e,{Z:()=>a});t(9359),t(31526),t(70104);function a(i){if(!i||"object"!=typeof i)return i;if("[object Date]"==Object.prototype.toString.call(i))return new Date(i.getTime());if(Array.isArray(i))return i.map(a);var e={};return Object.keys(i).forEach((function(t){e[t]=a(i[t])})),e}},68958:function(i,e,t){t.d(e,{t:()=>o});t(92745),t(9359),t(31526),t(88972);class a{constructor(i=window.localStorage){this.storage=void 0,this._storage={},this._listeners={},this.storage=i,i===window.localStorage&&window.addEventListener("storage",(i=>{i.key&&this.hasKey(i.key)&&(this._storage[i.key]=i.newValue?JSON.parse(i.newValue):i.newValue,this._listeners[i.key]&&this._listeners[i.key].forEach((e=>e(i.oldValue?JSON.parse(i.oldValue):i.oldValue,this._storage[i.key]))))}))}addFromStorage(i){if(!this._storage[i]){const e=this.storage.getItem(i);e&&(this._storage[i]=JSON.parse(e))}}subscribeChanges(i,e){return this._listeners[i]?this._listeners[i].push(e):this._listeners[i]=[e],()=>{this.unsubscribeChanges(i,e)}}unsubscribeChanges(i,e){if(!(i in this._listeners))return;const t=this._listeners[i].indexOf(e);-1!==t&&this._listeners[i].splice(t,1)}hasKey(i){return i in this._storage}getValue(i){return this._storage[i]}setValue(i,e){const t=this._storage[i];this._storage[i]=e;try{void 0===e?this.storage.removeItem(i):this.storage.setItem(i,JSON.stringify(e))}catch(i){}finally{this._listeners[i]&&this._listeners[i].forEach((i=>i(t,e)))}}}const n={},o=i=>e=>{const t=i.storage||"localStorage";let o;t&&t in n?o=n[t]:(o=new a(window[t]),n[t]=o);const d=String(e.key),l=i.key||String(e.key),r=e.initializer?e.initializer():void 0;o.addFromStorage(l);const s=!1!==i.subscribe?i=>o.subscribeChanges(l,((t,a)=>{i.requestUpdate(e.key,t)})):void 0,c=()=>o.hasKey(l)?i.deserializer?i.deserializer(o.getValue(l)):o.getValue(l):r;return{kind:"method",placement:"prototype",key:e.key,descriptor:{set(t){((t,a)=>{let n;i.state&&(n=c()),o.setValue(l,i.serializer?i.serializer(a):a),i.state&&t.requestUpdate(e.key,n)})(this,t)},get:()=>c(),enumerable:!0,configurable:!0},finisher(t){if(i.state&&i.subscribe){const i=t.prototype.connectedCallback,e=t.prototype.disconnectedCallback;t.prototype.connectedCallback=function(){i.call(this),this[`__unbsubLocalStorage${d}`]=s?.(this)},t.prototype.disconnectedCallback=function(){e.call(this),this[`__unbsubLocalStorage${d}`]?.(),this[`__unbsubLocalStorage${d}`]=void 0}}i.state&&t.createProperty(e.key,{noAccessor:!0,...i.stateOptions})}}}},83166:function(i,e,t){var a=t(44249),n=t(72621),o=t(1105),d=t(33990),l=t(57243),r=t(15093),s=t(5111);(0,a.Z)([(0,r.Mo)("ha-textfield")],(function(i,e){class t extends e{constructor(...e){super(...e),i(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:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"iconTrailing",value:()=>!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(i){(0,n.Z)(t,"updated",this,3)([i]),(i.has("invalid")||i.has("errorMessage"))&&(this.setCustomValidity(this.invalid?this.errorMessage||this.validationMessage||"Invalid":""),(this.invalid||this.validateOnInitialRender||i.has("invalid")&&void 0!==i.get("invalid"))&&this.reportValidity()),i.has("autocomplete")&&(this.autocomplete?this.formElement.setAttribute("autocomplete",this.autocomplete):this.formElement.removeAttribute("autocomplete")),i.has("autocorrect")&&(this.autocorrect?this.formElement.setAttribute("autocorrect",this.autocorrect):this.formElement.removeAttribute("autocorrect")),i.has("inputSpellcheck")&&(this.inputSpellcheck?this.formElement.setAttribute("spellcheck",this.inputSpellcheck):this.formElement.removeAttribute("spellcheck"))}},{kind:"method",key:"renderIcon",value:function(i,e=!1){const t=e?"trailing":"leading";return l.dy` <span class="mdc-text-field__icon mdc-text-field__icon--${t}" tabindex="${e?1:-1}"> <slot name="${t}Icon"></slot> </span> `}},{kind:"field",static:!0,key:"styles",value:()=>[d.W,l.iv`.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?l.iv`.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}`:l.iv``]}]}}),o.P)},36841:function(i,e,t){var a=t(44249),n=(t(9359),t(56475),t(57243)),o=t(15093),d=(t(23334),t(37583),t(83166),t(36522));(0,a.Z)([(0,o.Mo)("search-input")],(function(i,e){return{F:class extends e{constructor(...e){super(...e),i(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:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"autofocus",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:String})],key:"label",value:void 0},{kind:"method",key:"focus",value:function(){this._input?.focus()}},{kind:"field",decorators:[(0,o.IO)("ha-textfield",!0)],key:"_input",value:void 0},{kind:"method",key:"render",value:function(){return n.dy` <ha-textfield .autofocus="${this.autofocus}" .label="${this.label||this.hass.localize("ui.common.search")}" .value="${this.filter||""}" icon .iconTrailing="${this.filter||this.suffix}" @input="${this._filterInputChanged}"> <slot name="prefix" slot="leadingIcon"> <ha-svg-icon tabindex="-1" class="prefix" .path="${"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"}"></ha-svg-icon> </slot> <div class="trailing" slot="trailingIcon"> ${this.filter&&n.dy` <ha-icon-button @click="${this._clearSearch}" .label="${this.hass.localize("ui.common.clear")}" .path="${"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"}" class="clear-button"></ha-icon-button> `} <slot name="suffix"></slot> </div> </ha-textfield> `}},{kind:"method",key:"_filterChanged",value:async function(i){(0,d.B)(this,"value-changed",{value:String(i)})}},{kind:"method",key:"_filterInputChanged",value:async function(i){this._filterChanged(i.target.value)}},{kind:"method",key:"_clearSearch",value:async function(){this._filterChanged("")}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`: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(i,e,t){t.a(i,(async function(i,a){try{t.r(e),t.d(e,{HuiConditionalCardEditor:()=>k});var n=t(44249),o=(t(56820),t(99619),t(12582)),d=t(57243),l=t(15093),r=t(62900),s=t(68958),c=t(36522),h=(t(99426),t(59826),t(7285),t(37583),t(91728)),f=t(3054),u=(t(32145),t(43299)),p=t(18200),g=t(10991),v=i([h,f,u]);[h,f,u]=v.then?(await v)():v;const m="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",_="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",x="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",b=(0,r.f0)(p.I,(0,r.Ry)({card:(0,r.Yj)(),conditions:(0,r.jt)((0,r.IX)((0,r.Yj)()))}));let k=(0,n.Z)([(0,l.Mo)("hui-conditional-card-editor")],(function(i,e){return{F:class extends e{constructor(...e){super(...e),i(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:()=>!0},{kind:"field",decorators:[(0,l.SB)()],key:"_guiModeAvailable",value:()=>!0},{kind:"field",decorators:[(0,l.SB)()],key:"_cardTab",value:()=>!1},{kind:"field",decorators:[(0,l.IO)("hui-card-element-editor")],key:"_cardEditorEl",value:void 0},{kind:"method",key:"setConfig",value:function(i){(0,r.hu)(i,b),this._config=i}},{kind:"method",key:"focusYamlEditor",value:function(){this._cardEditorEl?.focusYamlEditor()}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return d.Ld;const i=!this._cardEditorEl||this._GUImode;return d.dy` <mwc-tab-bar .activeIndex="${this._cardTab?1:0}" @MDCTabBar:activated="${this._selectTab}"> <mwc-tab .label="${this.hass.localize("ui.panel.lovelace.editor.card.conditional.conditions")}"></mwc-tab> <mwc-tab .label="${this.hass.localize("ui.panel.lovelace.editor.card.conditional.card")}"></mwc-tab> </mwc-tab-bar> ${this._cardTab?d.dy` <div class="card"> ${void 0!==this._config.card.type?d.dy` <div class="card-options"> <ha-icon-button class="gui-mode-button" @click="${this._toggleMode}" .disabled="${!this._guiModeAvailable}" .label="${this.hass.localize(i?"ui.panel.lovelace.editor.edit_card.show_code_editor":"ui.panel.lovelace.editor.edit_card.show_visual_editor")}" .path="${i?m:x}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.lovelace.editor.edit_card.copy")}" .path="${_}" @click="${this._handleCopyCard}"></ha-icon-button> <mwc-button @click="${this._handleReplaceCard}">${this.hass.localize("ui.panel.lovelace.editor.card.conditional.change_type")}</mwc-button> </div> <hui-card-element-editor .hass="${this.hass}" .value="${this._config.card}" .lovelace="${this.lovelace}" @config-changed="${this._handleCardChanged}" @GUImode-changed="${this._handleGUIModeChanged}"></hui-card-element-editor> `:d.dy` <hui-card-picker .hass="${this.hass}" .lovelace="${this.lovelace}" @config-changed="${this._handleCardPicked}"></hui-card-picker> `} </div> `:d.dy` <ha-alert alert-type="info"> ${this.hass.localize("ui.panel.lovelace.editor.condition-editor.explanation")} </ha-alert> <ha-card-conditions-editor .hass="${this.hass}" .conditions="${this._config.conditions}" @value-changed="${this._conditionChanged}"> </ha-card-conditions-editor> `} `}},{kind:"method",key:"_selectTab",value:function(i){this._cardTab=1===i.detail.index}},{kind:"method",key:"_toggleMode",value:function(){this._cardEditorEl?.toggleMode()}},{kind:"method",key:"_setMode",value:function(i){this._GUImode=i,this._cardEditorEl&&(this._cardEditorEl.GUImode=i)}},{kind:"method",key:"_handleGUIModeChanged",value:function(i){i.stopPropagation(),this._GUImode=i.detail.guiMode,this._guiModeAvailable=i.detail.guiModeAvailable}},{kind:"method",key:"_handleCardPicked",value:function(i){i.stopPropagation(),this._config&&(this._setMode(!0),this._guiModeAvailable=!0,this._config={...this._config,card:i.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(i){i.stopPropagation(),this._config&&(this._config={...this._config,card:i.detail.config},this._guiModeAvailable=i.detail.guiModeAvailable,(0,c.B)(this,"config-changed",{config:this._config}))}},{kind:"method",key:"_handleReplaceCard",value:function(){this._config&&(this._config={...this._config,card:{}},(0,c.B)(this,"config-changed",{config:this._config}))}},{kind:"method",key:"_conditionChanged",value:function(i){if(i.stopPropagation(),!this._config)return;const e=i.detail.value;this._config={...this._config,conditions:e},(0,c.B)(this,"config-changed",{config:this._config})}},{kind:"get",static:!0,key:"styles",value:function(){return[g.A,d.iv`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(i){a(i)}}))},18200:function(i,e,t){t.d(e,{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.d9f90b24a6085c1d.js.map