UNPKG

iobroker.lovelace

Version:

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

2 lines 18.9 kB
export const __webpack_ids__=["669"];export const __webpack_modules__={62801:function(e,t,i){var n=i(44249),a=i(72621),d=(i(9359),i(56475),i(22139),i(57243)),o=i(15093),l=i(36522);(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:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"no-style"})],key:"noStyle",value:()=>!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:()=>!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:()=>!0},{kind:"method",key:"updated",value:function(e){e.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}},{kind:"field",key:"_shouldBeDestroy",value:()=>!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:d.dy` <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={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(44249),a=i(72621),d=i(1105),o=i(33990),l=i(57243),s=i(15093),r=i(5111);(0,n.Z)([(0,s.Mo)("ha-textfield")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"icon",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"iconTrailing",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,s.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 l.dy` <span class="mdc-text-field__icon mdc-text-field__icon--${i}" tabindex="${t?1:-1}"> <slot name="${i}Icon"></slot> </span> `}},{kind:"field",static:!0,key:"styles",value:()=>[o.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"===r.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``]}]}}),d.P)},4567:function(e,t,i){i.a(e,(async function(e,t){try{var n=i(44249),a=i(57243),d=i(15093),o=i(91583),l=i(36522),s=i(88128),r=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];const p="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",f="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z",g="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",v="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:()=>!1},{kind:"field",key:"_opened",value:()=>!1},{kind:"field",key:"_badgesKeys",value:()=>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){const t=e.type??"entity";if("entity"===t){const i="entity"in e?e.entity:void 0,n=i?this.hass.states[i]:void 0;return n&&(0,c.C)(n)||i||t||"Unknown badge"}return t}},{kind:"method",key:"render",value:function(){return this.hass?a.dy` ${this.badges?a.dy` <ha-sortable handle-selector=".handle" @item-moved="${this._badgeMoved}"> <div class="entities"> ${(0,o.r)(this.badges,(e=>this._getKey(e)),((e,t)=>{const i=this._computeBadgeLabel(e);return a.dy` <div class="badge"> <div class="handle"> <ha-svg-icon .path="${f}"></ha-svg-icon> </div> <div class="badge-content"> <span>${i}</span> </div> <ha-icon-button .label="${this.hass.localize("ui.panel.lovelace.editor.entities.edit")}" .path="${g}" class="edit-icon" .index="${t}" @click="${this._editBadge}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.lovelace.editor.entities.remove")}" .path="${p}" class="remove-icon" .index="${t}" @click="${this._removeEntity}"></ha-icon-button> </div> `}))} </div> </ha-sortable> `:a.Ld} <div class="add-container"> <ha-button data-add-entity outlined .label="${this.hass.localize("ui.panel.lovelace.editor.entities.add")}" @click="${this._addEntity}"> <ha-svg-icon .path="${v}" slot="icon"></ha-svg-icon> </ha-button> ${this._renderPicker()} </div> `:a.Ld}},{kind:"method",key:"_renderPicker",value:function(){return this._addMode?a.dy` <mwc-menu-surface open .anchor="${this._addContainer}" @closed="${this._onClosed}" @opened="${this._onOpened}" @opened-changed="${this._openedChanged}" @input="${r.U}"> <ha-entity-picker .hass="${this.hass}" id="input" .type="${"entity_id"}" .label="${this.hass.localize("ui.components.target-picker.add_entity_id")}" @value-changed="${this._entityPicked}" @click="${s.P}" allow-custom-entity></ha-entity-picker> </mwc-menu-surface> `:a.Ld}},{kind:"method",key:"_onClosed",value:function(e){e.stopPropagation(),e.target.open=!0}},{kind:"method",key:"_onOpened",value:async function(){this._addMode&&(await(this._entityPicker?.focus()),await(this._entityPicker?.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:()=>a.iv`: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(e){t(e)}}))},33405:function(e,t,i){i.a(e,(async function(e,n){try{i.r(t),i.d(t,{HuiHeadingCardEditor:()=>y});var a=i(44249),d=i(57243),o=i(15093),l=i(27486),s=i(62900),r=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;const v="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",b="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",m=["navigate","url","perform-action","none"],k=(0,s.f0)(u.I,(0,s.Ry)({heading_style:(0,s.jt)((0,s.kE)(["title","subtitle"])),heading:(0,s.jt)((0,s.Z_)()),icon:(0,s.jt)((0,s.Z_)()),tap_action:(0,s.jt)(h.fJ),badges:(0,s.jt)((0,s.IX)((0,s.Yj)()))}));let y=(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,s.hu)(this._config,k)}},{kind:"field",key:"_schema",value:()=>(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:v,schema:[{name:"tap_action",selector:{ui_action:{default_action:"none",actions:m}}}]}]))},{kind:"field",key:"_badges",value:()=>(0,l.Z)((e=>e||[]))},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return d.Ld;const e={...this._config};e.heading_style||(e.heading_style="title");const t=this._schema(this.hass.localize);return d.dy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${t}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> <ha-expansion-panel outlined> <ha-svg-icon slot="leading-icon" .path="${b}"></ha-svg-icon> <h3 slot="header"> ${this.hass.localize("ui.panel.lovelace.editor.card.heading.entities")} </h3> <div class="content"> <hui-heading-badges-editor .hass="${this.hass}" .badges="${this._badges(this._config.badges)}" @heading-badges-changed="${this._badgesChanged}" @edit-heading-badge="${this._editBadge}"> </hui-heading-badges-editor> </div> </ha-expansion-panel> `}},{kind:"method",key:"_badgesChanged",value:function(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t={...this._config,badges:e.detail.badges};(0,r.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,r.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,r.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={...this._config,badges:i};(0,r.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,d.iv`.container{display:flex;flex-direction:column}ha-form{display:block;margin-bottom:24px}`]}}]}}),d.oi);n()}catch(e){n(e)}}))},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.9d2a716a21708110.js.map