UNPKG

iobroker.lovelace

Version:

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

2 lines 19.6 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["669"],{62801:function(e,t,i){var n=i(61701),a=i(72621),d=(i(71695),i(9359),i(56475),i(19423),i(40251),i(22139),i(47021),i(57243)),o=i(50778),l=i(36522);let r,s=e=>e;(0,n.Z)([(0,o.Mo)("ha-sortable")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",key:"_sortable",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"no-style"})],key:"noStyle",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:String,attribute:"draggable-selector"})],key:"draggableSelector",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:String,attribute:"handle-selector"})],key:"handleSelector",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:String,attribute:"filter"})],key:"filter",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:String})],key:"group",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"invert-swap"})],key:"invertSwap",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"options",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"rollback",value(){return!0}},{kind:"method",key:"updated",value:function(e){e.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}},{kind:"field",key:"_shouldBeDestroy",value(){return!1}},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(n,"disconnectedCallback",this,3)([]),this._shouldBeDestroy=!0,setTimeout((()=>{this._shouldBeDestroy&&(this._destroySortable(),this._shouldBeDestroy=!1)}),1)}},{kind:"method",key:"connectedCallback",value:function(){(0,a.Z)(n,"connectedCallback",this,3)([]),this._shouldBeDestroy=!1,this.hasUpdated&&!this.disabled&&this._createSortable()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"render",value:function(){return this.noStyle?d.Ld:(0,d.dy)(r||(r=s` <style>.sortable-fallback{display:none!important}.sortable-ghost{box-shadow:0 0 0 2px var(--primary-color);background:rgba(var(--rgb-primary-color),.25);border-radius:4px;opacity:.4}.sortable-drag{border-radius:4px;opacity:1;background:var(--card-background-color);box-shadow:0px 4px 8px 3px #00000026;cursor:grabbing}</style> `))}},{kind:"method",key:"_createSortable",value:async function(){if(this._sortable)return;const e=this.children[0];if(!e)return;const t=(await Promise.all([i.e("34153"),i.e("467")]).then(i.bind(i,59807))).default,n=Object.assign(Object.assign({scroll:!0,forceAutoScrollFallback:!0,scrollSpeed:20,animation:150},this.options),{},{onChoose:this._handleChoose,onStart:this._handleStart,onEnd:this._handleEnd,onUpdate:this._handleUpdate,onAdd:this._handleAdd,onRemove:this._handleRemove});this.draggableSelector&&(n.draggable=this.draggableSelector),this.handleSelector&&(n.handle=this.handleSelector),void 0!==this.invertSwap&&(n.invertSwap=this.invertSwap),this.group&&(n.group=this.group),this.filter&&(n.filter=this.filter),this._sortable=new t(e,n)}},{kind:"field",key:"_handleUpdate",value(){return e=>{(0,l.B)(this,"item-moved",{newIndex:e.newIndex,oldIndex:e.oldIndex})}}},{kind:"field",key:"_handleAdd",value(){return e=>{(0,l.B)(this,"item-added",{index:e.newIndex,data:e.item.sortableData})}}},{kind:"field",key:"_handleRemove",value(){return e=>{(0,l.B)(this,"item-removed",{index:e.oldIndex})}}},{kind:"field",key:"_handleEnd",value(){return async e=>{(0,l.B)(this,"drag-end"),this.rollback&&e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder)}}},{kind:"field",key:"_handleStart",value(){return()=>{(0,l.B)(this,"drag-start")}}},{kind:"field",key:"_handleChoose",value(){return e=>{this.rollback&&(e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder))}}},{kind:"method",key:"_destroySortable",value:function(){this._sortable&&(this._sortable.destroy(),this._sortable=void 0)}}]}}),d.oi)},83166:function(e,t,i){var n=i(61701),a=i(72621),d=(i(71695),i(47021),i(1105)),o=i(33990),l=i(57243),r=i(50778),s=i(5111);let c,h,u,p,f=e=>e;(0,n.Z)([(0,r.Mo)("ha-textfield")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,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,a.Z)(i,"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,t=!1){const i=t?"trailing":"leading";return(0,l.dy)(c||(c=f` <span class="mdc-text-field__icon mdc-text-field__icon--${0}" tabindex="${0}"> <slot name="${0}Icon"></slot> </span> `),i,t?1:-1,i)}},{kind:"field",static:!0,key:"styles",value(){return[o.W,(0,l.iv)(h||(h=f`.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=f`.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)(p||(p=f``))]}}]}}),d.P)},4567:function(e,t,i){i.a(e,(async function(e,t){try{var n=i(61701),a=(i(71695),i(40251),i(11740),i(46692),i(47021),i(57243)),d=i(50778),o=i(91583),l=i(36522),r=i(88128),s=i(49976),c=i(47194),h=i(58725),u=(i(59826),i(23334),i(7285),i(62801),i(37583),e([h]));h=(u.then?(await u)():u)[0];let p,f,g,v,b,m=e=>e;const k="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",y="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z",x="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",_="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";(0,n.Z)([(0,d.Mo)("hui-heading-badges-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"badges",value:void 0},{kind:"field",decorators:[(0,d.IO)(".add-container",!0)],key:"_addContainer",value:void 0},{kind:"field",decorators:[(0,d.IO)("ha-entity-picker")],key:"_entityPicker",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_addMode",value(){return!1}},{kind:"field",key:"_opened",value(){return!1}},{kind:"field",key:"_badgesKeys",value(){return new WeakMap}},{kind:"method",key:"_getKey",value:function(e){return this._badgesKeys.has(e)||this._badgesKeys.set(e,Math.random().toString()),this._badgesKeys.get(e)}},{kind:"method",key:"_computeBadgeLabel",value:function(e){var t;const i=null!==(t=e.type)&&void 0!==t?t:"entity";if("entity"===i){const t="entity"in e?e.entity:void 0,n=t?this.hass.states[t]:void 0;return n&&(0,c.C)(n)||t||i||"Unknown badge"}return i}},{kind:"method",key:"render",value:function(){return this.hass?(0,a.dy)(p||(p=m` ${0} <div class="add-container"> <ha-button data-add-entity outlined .label="${0}" @click="${0}"> <ha-svg-icon .path="${0}" slot="icon"></ha-svg-icon> </ha-button> ${0} </div> `),this.badges?(0,a.dy)(f||(f=m` <ha-sortable handle-selector=".handle" @item-moved="${0}"> <div class="entities"> ${0} </div> </ha-sortable> `),this._badgeMoved,(0,o.r)(this.badges,(e=>this._getKey(e)),((e,t)=>{const i=this._computeBadgeLabel(e);return(0,a.dy)(g||(g=m` <div class="badge"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <div class="badge-content"> <span>${0}</span> </div> <ha-icon-button .label="${0}" .path="${0}" class="edit-icon" .index="${0}" @click="${0}"></ha-icon-button> <ha-icon-button .label="${0}" .path="${0}" class="remove-icon" .index="${0}" @click="${0}"></ha-icon-button> </div> `),y,i,this.hass.localize("ui.panel.lovelace.editor.entities.edit"),x,t,this._editBadge,this.hass.localize("ui.panel.lovelace.editor.entities.remove"),k,t,this._removeEntity)}))):a.Ld,this.hass.localize("ui.panel.lovelace.editor.entities.add"),this._addEntity,_,this._renderPicker()):a.Ld}},{kind:"method",key:"_renderPicker",value:function(){return this._addMode?(0,a.dy)(v||(v=m` <mwc-menu-surface open .anchor="${0}" @closed="${0}" @opened="${0}" @opened-changed="${0}" @input="${0}"> <ha-entity-picker .hass="${0}" id="input" .type="${0}" .label="${0}" @value-changed="${0}" @click="${0}" allow-custom-entity></ha-entity-picker> </mwc-menu-surface> `),this._addContainer,this._onClosed,this._onOpened,this._openedChanged,s.U,this.hass,"entity_id",this.hass.localize("ui.components.target-picker.add_entity_id"),this._entityPicked,r.P):a.Ld}},{kind:"method",key:"_onClosed",value:function(e){e.stopPropagation(),e.target.open=!0}},{kind:"method",key:"_onOpened",value:async function(){var e,t;this._addMode&&(await(null===(e=this._entityPicker)||void 0===e?void 0:e.focus()),await(null===(t=this._entityPicker)||void 0===t?void 0:t.open()),this._opened=!0)}},{kind:"method",key:"_openedChanged",value:function(e){this._opened&&!e.detail.value&&(this._opened=!1,this._addMode=!1)}},{kind:"method",key:"_addEntity",value:async function(e){e.stopPropagation(),this._addMode=!0}},{kind:"method",key:"_entityPicked",value:function(e){if(e.stopPropagation(),!e.detail.value)return;const t={type:"entity",entity:e.detail.value},i=(this.badges||[]).concat(t);(0,l.B)(this,"heading-badges-changed",{badges:i})}},{kind:"method",key:"_badgeMoved",value:function(e){e.stopPropagation();const{oldIndex:t,newIndex:i}=e.detail,n=(this.badges||[]).concat();n.splice(i,0,n.splice(t,1)[0]),(0,l.B)(this,"heading-badges-changed",{badges:n})}},{kind:"method",key:"_removeEntity",value:function(e){const t=e.currentTarget.index,i=(this.badges||[]).concat();i.splice(t,1),(0,l.B)(this,"heading-badges-changed",{badges:i})}},{kind:"method",key:"_editBadge",value:function(e){const t=e.currentTarget.index;(0,l.B)(this,"edit-heading-badge",{index:t})}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(b||(b=m`:host{display:flex!important;flex-direction:column}ha-button{margin-top:8px}.badge{display:flex;align-items:center}.badge .handle{cursor:move;cursor:grab;padding-right:8px;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.badge .handle>*{pointer-events:none}.badge-content{height:60px;font-size:16px;display:flex;align-items:center;justify-content:space-between;flex-grow:1}.badge-content div{display:flex;flex-direction:column}.edit-icon,.remove-icon{--mdc-icon-button-size:36px;color:var(--secondary-text-color)}.secondary{font-size:12px;color:var(--secondary-text-color)}li[divider]{border-bottom-color:var(--divider-color)}.add-container{position:relative;width:100%}mwc-menu-surface{--mdc-menu-min-width:100%}ha-entity-picker{display:block;width:100%}`))}}]}}),a.oi);t()}catch(p){t(p)}}))},33405:function(e,t,i){i.a(e,(async function(e,n){try{i.r(t),i.d(t,{HuiHeadingCardEditor:()=>C});var a=i(61701),d=(i(71695),i(19423),i(47021),i(57243)),o=i(50778),l=i(27486),r=i(62900),s=i(36522),c=(i(41307),i(29073),i(37583),i(50625)),h=i(30571),u=i(18200),p=i(10991),f=i(4567),g=e([f,c]);[f,c]=g.then?(await g)():g;let v,b,m=e=>e;const k="M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5Z",y="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M7 7H9V9H7V7M7 11H9V13H7V11M7 15H9V17H7V15M17 17H11V15H17V17M17 13H11V11H17V13M17 9H11V7H17V9Z",x=["navigate","url","perform-action","none"],_=(0,r.f0)(u.I,(0,r.Ry)({heading_style:(0,r.jt)((0,r.kE)(["title","subtitle"])),heading:(0,r.jt)((0,r.Z_)()),icon:(0,r.jt)((0,r.Z_)()),tap_action:(0,r.jt)(h.fJ),badges:(0,r.jt)((0,r.IX)((0,r.Yj)()))}));let C=(0,a.Z)([(0,o.Mo)("hui-heading-card-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(e){this._config=(0,c.Q)(e),(0,r.hu)(this._config,_)}},{kind:"field",key:"_schema",value(){return(0,l.Z)((e=>[{name:"heading_style",selector:{select:{mode:"list",options:["title","subtitle"].map((t=>({label:e(`ui.panel.lovelace.editor.card.heading.heading_style_options.${t}`),value:t})))}}},{name:"heading",selector:{text:{}}},{name:"icon",selector:{icon:{}}},{name:"interactions",type:"expandable",flatten:!0,iconPath:k,schema:[{name:"tap_action",selector:{ui_action:{default_action:"none",actions:x}}}]}]))}},{kind:"field",key:"_badges",value(){return(0,l.Z)((e=>e||[]))}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return d.Ld;const e=Object.assign({},this._config);e.heading_style||(e.heading_style="title");const t=this._schema(this.hass.localize);return(0,d.dy)(v||(v=m` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> <ha-expansion-panel outlined> <ha-svg-icon slot="leading-icon" .path="${0}"></ha-svg-icon> <h3 slot="header"> ${0} </h3> <div class="content"> <hui-heading-badges-editor .hass="${0}" .badges="${0}" @heading-badges-changed="${0}" @edit-heading-badge="${0}"> </hui-heading-badges-editor> </div> </ha-expansion-panel> `),this.hass,e,t,this._computeLabelCallback,this._valueChanged,y,this.hass.localize("ui.panel.lovelace.editor.card.heading.entities"),this.hass,this._badges(this._config.badges),this._badgesChanged,this._editBadge)}},{kind:"method",key:"_badgesChanged",value:function(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=Object.assign(Object.assign({},this._config),{},{badges:e.detail.badges});(0,s.B)(this,"config-changed",{config:t})}},{kind:"method",key:"_valueChanged",value:function(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=e.detail.value;(0,s.B)(this,"config-changed",{config:t})}},{kind:"method",key:"_editBadge",value:function(e){e.stopPropagation();const t=e.detail.index,i=this._badges(this._config.badges)[t];(0,s.B)(this,"edit-sub-element",{config:i,saveConfig:e=>this._updateBadge(t,e),type:"heading-badge"})}},{kind:"method",key:"_updateBadge",value:function(e,t){const i=this._config.badges.concat();i[e]=t;const n=Object.assign(Object.assign({},this._config),{},{badges:i});(0,s.B)(this,"config-changed",{config:n})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"heading_style":case"heading":return this.hass.localize(`ui.panel.lovelace.editor.card.heading.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}},{kind:"get",static:!0,key:"styles",value:function(){return[p.A,(0,d.iv)(b||(b=m`.container{display:flex;flex-direction:column}ha-form{display:block;margin-bottom:24px}`))]}}]}}),d.oi);n()}catch(v){n(v)}}))},18200:function(e,t,i){i.d(t,{I:()=>a});var n=i(62900);const a=(0,n.Ry)({type:(0,n.Z_)(),view_layout:(0,n.Yj)(),layout_options:(0,n.Yj)(),grid_options:(0,n.Yj)(),visibility:(0,n.Yj)()})}}]); //# sourceMappingURL=669.7444a17ba9c41edb.js.map