UNPKG

iobroker.lovelace

Version:

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

8 lines 13.3 kB
export const __webpack_ids__=["20309"];export const __webpack_modules__={95198:function(e,i,t){var a=t(44249),o=t(57243),n=t(15093);(0,a.Z)([(0,n.Mo)("ha-dialog-header")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"method",key:"render",value:function(){return o.dy` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> <div class="header-title"> <slot name="title"></slot> </div> <div class="header-subtitle"> <slot name="subtitle"></slot> </div> </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `}},{kind:"get",static:!0,key:"styles",value:function(){return[o.iv`:host{display:block}:host([show-border]){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.header-bar{display:flex;flex-direction:row;align-items:flex-start;padding:4px;box-sizing:border-box}.header-content{flex:1;padding:10px 4px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{font-size:22px;line-height:28px;font-weight:400}.header-subtitle{font-size:14px;line-height:20px;color:var(--secondary-text-color)}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:12px}}.header-navigation-icon{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}`]}}]}}),o.oi)},73729:function(e,i,t){t.d(i,{i:()=>h});var a=t(44249),o=t(72621),n=t(74966),d=t(51408),s=t(57243),l=t(15093),r=t(76525);t(23334);const c=["button","ha-list-item"],h=(e,i)=>s.dy` <div class="header_title"> <ha-icon-button .label="${e?.localize("ui.common.close")??"Close"}" .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"}" dialogAction="close" class="header_button"></ha-icon-button> <span>${i}</span> </div> `;(0,a.Z)([(0,l.Mo)("ha-dialog")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",key:r.gA,value:void 0},{kind:"method",key:"scrollToPos",value:function(e,i){this.contentElement?.scrollTo(e,i)}},{kind:"method",key:"renderHeading",value:function(){return s.dy`<slot name="heading"> ${(0,o.Z)(t,"renderHeading",this,3)([])} </slot>`}},{kind:"method",key:"firstUpdated",value:function(){(0,o.Z)(t,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,c].join(", "),this._updateScrolledAttribute(),this.contentElement?.addEventListener("scroll",this._onScroll,{passive:!0})}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(t,"disconnectedCallback",this,3)([]),this.contentElement.removeEventListener("scroll",this._onScroll)}},{kind:"field",key:"_onScroll",value(){return()=>{this._updateScrolledAttribute()}}},{kind:"method",key:"_updateScrolledAttribute",value:function(){this.contentElement&&this.toggleAttribute("scrolled",0!==this.contentElement.scrollTop)}},{kind:"field",static:!0,key:"styles",value:()=>[d.W,s.iv`:host([scrolled]) ::slotted(ha-dialog-header){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.mdc-dialog{--mdc-dialog-scroll-divider-color:var( --dialog-scroll-divider-color, var(--divider-color) );z-index:var(--dialog-z-index,8);-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));--mdc-dialog-box-shadow:var(--dialog-box-shadow, none);--mdc-typography-headline6-font-weight:400;--mdc-typography-headline6-font-size:1.574rem}.mdc-dialog__actions{justify-content:var(--justify-action-buttons,flex-end);padding-bottom:max(env(safe-area-inset-bottom),24px)}.mdc-dialog__actions span:first-child{flex:var(--secondary-action-button-flex,unset)}.mdc-dialog__actions span:nth-child(2){flex:var(--primary-action-button-flex,unset)}.mdc-dialog__container{align-items:var(--vertical-align-dialog,center)}.mdc-dialog__title{padding:24px 24px 0 24px}.mdc-dialog__title:has(span){padding:12px 12px 0}.mdc-dialog__actions{padding:12px 24px 12px 24px}.mdc-dialog__title::before{content:unset}.mdc-dialog .mdc-dialog__content{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,24px)}:host([hideactions]) .mdc-dialog .mdc-dialog__content{padding-bottom:max(var(--dialog-content-padding,24px),env(safe-area-inset-bottom))}.mdc-dialog .mdc-dialog__surface{position:var(--dialog-surface-position,relative);top:var(--dialog-surface-top);margin-top:var(--dialog-surface-margin-top);min-height:var(--mdc-dialog-min-height,auto);border-radius:var(--ha-dialog-border-radius,28px);-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);background:var(--ha-dialog-surface-background,var(--mdc-theme-surface,#fff))}:host([flexContent]) .mdc-dialog .mdc-dialog__content{display:flex;flex-direction:column}.header_title{display:flex;align-items:center;direction:var(--direction)}.header_title span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding-left:4px}.header_button{text-decoration:none;color:inherit;inset-inline-start:initial;inset-inline-end:-12px;direction:var(--direction)}.dialog-actions{inset-inline-start:initial!important;inset-inline-end:0px!important;direction:var(--direction)}`]}]}}),n.M)},17170:function(e,i,t){t.a(e,(async function(e,a){try{t.r(i),t.d(i,{HaSpinner:()=>h});var o=t(44249),n=t(72621),d=t(97677),s=t(43580),l=t(57243),r=t(15093),c=e([d]);d=(c.then?(await c)():c)[0];let h=(0,o.Z)([(0,r.Mo)("ha-spinner")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,r.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(e){if((0,n.Z)(t,"updated",this,3)([e]),e.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-spinner-size","16px");break;case"small":this.style.setProperty("--ha-spinner-size","28px");break;case"medium":this.style.setProperty("--ha-spinner-size","48px");break;case"large":this.style.setProperty("--ha-spinner-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}},{kind:"field",static:!0,key:"styles",value:()=>[s.Z,l.iv`:host{--indicator-color:var( --ha-spinner-indicator-color, var(--primary-color) );--track-color:var(--ha-spinner-divider-color, var(--divider-color));--track-width:4px;--speed:3.5s;font-size:var(--ha-spinner-size, 48px)}`]}]}}),d.Z);a()}catch(e){a(e)}}))},95249:function(e,i,t){t.a(e,(async function(e,a){try{t.r(i),t.d(i,{HuiCreateDialogCard:()=>$});var o=t(44249),n=(t(9359),t(70104),t(56820),t(99619),t(57243)),d=t(15093),s=t(67064),l=t(35359),r=t(20552),c=t(27486),h=t(36522),p=t(73850),g=t(47194),u=(t(73729),t(95198),t(54305)),m=t(28008),v=t(20526),f=t(27353),x=t(2593),_=t(3054),b=t(71971),k=t(77711),y=t(53380),w=e([_,b]);[_,b]=w.then?(await w)():w;const C="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";let $=(0,o.Z)([(0,d.Mo)("hui-dialog-create-card")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_containerConfig",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_selectedEntities",value:()=>[]},{kind:"field",decorators:[(0,d.SB)()],key:"_currTabIndex",value:()=>0},{kind:"field",decorators:[(0,d.SB)()],key:"_narrow",value:()=>!1},{kind:"method",key:"showDialog",value:async function(e){this._params=e,this._narrow=matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches;const i=(0,x.an)(e.lovelaceConfig,e.path);if("strategy"in i)throw new Error("Can't edit strategy");this._containerConfig=i}},{kind:"method",key:"closeDialog",value:function(){return this._params=void 0,this._currTabIndex=0,this._selectedEntities=[],(0,h.B)(this,"dialog-closed",{dialog:this.localName}),!0}},{kind:"method",key:"render",value:function(){if(!this._params)return n.Ld;const e=this._containerConfig.title?this.hass.localize("ui.panel.lovelace.editor.edit_card.pick_card_title",{name:`"${this._containerConfig.title}"`}):this.hass.localize("ui.panel.lovelace.editor.edit_card.pick_card");return n.dy` <ha-dialog open scrimClickAction @keydown="${this._ignoreKeydown}" @closed="${this._cancel}" .heading="${e}" class="${(0,l.$)({table:1===this._currTabIndex})}"> <ha-dialog-header show-border slot="heading"> <ha-icon-button slot="navigationIcon" dialogAction="cancel" .label="${this.hass.localize("ui.common.close")}" .path="${C}"></ha-icon-button> <span slot="title"> ${e} </span> <mwc-tab-bar .activeIndex="${this._currTabIndex}" @MDCTabBar:activated="${this._handleTabChanged}"> <mwc-tab .label="${this.hass.localize("ui.panel.lovelace.editor.cardpicker.by_card")}" dialogInitialFocus="${(0,r.o)(this._narrow?"":void 0)}"></mwc-tab> <mwc-tab .label="${this.hass.localize("ui.panel.lovelace.editor.cardpicker.by_entity")}"></mwc-tab> </mwc-tab-bar> </ha-dialog-header> ${(0,s.F)(0===this._currTabIndex?n.dy` <hui-card-picker dialogInitialFocus="${(0,r.o)(this._narrow?void 0:"")}" .suggestedCards="${this._params.suggestedCards}" .lovelace="${this._params.lovelaceConfig}" .hass="${this.hass}" @config-changed="${this._handleCardPicked}"></hui-card-picker> `:n.dy` <hui-entity-picker-table no-label-float .hass="${this.hass}" narrow .entities="${this._allEntities(this.hass.states)}" @selected-changed="${this._handleSelectedChanged}"></hui-entity-picker-table> `)} <div slot="primaryAction"> <mwc-button @click="${this._cancel}"> ${this.hass.localize("ui.common.cancel")} </mwc-button> ${this._selectedEntities.length?n.dy` <mwc-button @click="${this._suggestCards}"> ${this.hass.localize("ui.common.continue")} </mwc-button> `:""} </div> </ha-dialog> `}},{kind:"method",key:"_ignoreKeydown",value:function(e){e.stopPropagation()}},{kind:"get",static:!0,key:"styles",value:function(){return[m.yu,n.iv`@media all and (max-width:450px),all and (max-height:500px){ha-dialog{--mdc-dialog-max-height:100%;height:100%}}@media all and (min-width:850px){ha-dialog{--mdc-dialog-min-width:845px}}ha-dialog{--mdc-dialog-max-width:845px;--dialog-content-padding:0 24px 20px 24px;--dialog-z-index:6}ha-dialog.table{--dialog-content-padding:0}@media (min-width:1200px){ha-dialog{--mdc-dialog-max-width:calc(100vw - 32px);--mdc-dialog-min-width:1000px}}hui-card-picker{--card-picker-search-shape:0;--card-picker-search-margin:-2px -24px 0}hui-entity-picker-table{display:block;height:calc(100vh - 198px);--mdc-shape-small:0}@media all and (max-width:450px),all and (max-height:500px){hui-entity-picker-table{height:calc(100vh - 158px)}}`]}},{kind:"method",key:"_handleCardPicked",value:function(e){const i=e.detail.config;this._params.entities&&this._params.entities.length&&(Object.keys(i).includes("entities")?i.entities=this._params.entities:Object.keys(i).includes("entity")&&(i.entity=this._params.entities[0]));const t=this._params.lovelaceConfig,a=this._params.path,o=this._params.saveConfig,n=2===a.length?(0,x.an)(t,a):void 0;(0,k.x)(this,{lovelaceConfig:t,saveCardConfig:async e=>{const i=(0,f.Z0)(t,a,e);await o(i)},cardConfig:i,sectionConfig:n,isNew:!0}),this.closeDialog()}},{kind:"method",key:"_handleTabChanged",value:function(e){e.detail.index!==this._currTabIndex&&(this._currTabIndex=e.detail.index,this._selectedEntities=[])}},{kind:"method",key:"_handleSelectedChanged",value:function(e){this._selectedEntities=e.detail.selectedEntities}},{kind:"method",key:"_cancel",value:function(e){e&&e.stopPropagation(),this.closeDialog()}},{kind:"method",key:"_suggestCards",value:function(){const e=(0,v.VG)(this.hass.states,this._selectedEntities,{});let i={};const{viewIndex:t,sectionIndex:a}=(0,x.jb)(this._params.path);if(void 0!==a){const e=(0,x.an)(this._params.lovelaceConfig,[t,a]);if(!(0,u.N)(e)){const{cards:t,title:a,...o}=e;i=o}}const o=(0,v.lY)(this._selectedEntities,i);(0,y.f)(this,{lovelaceConfig:this._params.lovelaceConfig,saveConfig:this._params.saveConfig,path:this._params.path,entities:this._selectedEntities,cardConfig:e,sectionConfig:o}),this.closeDialog()}},{kind:"field",key:"_allEntities",value(){return(0,c.Z)((e=>Object.keys(e).map((e=>{const i=this.hass.states[e];return{icon:"",entity_id:e,stateObj:i,name:(0,g.C)(i),domain:(0,p.M)(e),last_changed:i.last_changed}}))))}}]}}),n.oi);a()}catch(e){a(e)}}))},53380:function(e,i,t){t.d(i,{f:()=>n});var a=t(36522);const o=()=>Promise.all([t.e("35671"),t.e("83895"),t.e("29570"),t.e("65505"),t.e("8795"),t.e("71588"),t.e("92139"),t.e("32146"),t.e("7068"),t.e("47399"),t.e("79346"),t.e("63055"),t.e("52358"),t.e("44251"),t.e("65005"),t.e("60487"),t.e("92691"),t.e("38326"),t.e("16912"),t.e("70639"),t.e("92368"),t.e("37316"),t.e("80312"),t.e("34482")]).then(t.bind(t,22958)),n=(e,i)=>{(0,a.B)(e,"show-dialog",{dialogTag:"hui-dialog-suggest-card",dialogImport:o,dialogParams:i})}}}; //# sourceMappingURL=20309.2dc0c7fcf8785436.js.map