iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 17.5 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["37007"],{96814:function(i,e,t){t(9359),t(31526),i.exports=function i(e){return Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(t){!e.hasOwnProperty(t)||null===e[t]||"object"!=typeof e[t]&&"function"!=typeof e[t]||Object.isFrozen(e[t])||i(e[t])})),e}},95198:function(i,e,t){"use strict";var a=t(61701),o=(t(71695),t(47021),t(57243)),n=t(50778);let d,s,l=i=>i;(0,a.Z)([(0,n.Mo)("ha-dialog-header")],(function(i,e){return{F:class extends e{constructor(...e){super(...e),i(this)}},d:[{kind:"method",key:"render",value:function(){return(0,o.dy)(d||(d=l` <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[(0,o.iv)(s||(s=l`: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)} 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(i,e,t){"use strict";t.d(e,{i:()=>v});var a=t(61701),o=t(72621),n=(t(22152),t(71695),t(47021),t(74966)),d=t(51408),s=t(57243),l=t(50778),r=t(76525);t(23334);let c,h,u,g=i=>i;const p=["button","ha-list-item"],v=(i,e)=>{var t;return(0,s.dy)(c||(c=g` <div class="header_title"> <ha-icon-button .label="${0}" .path="${0}" dialogAction="close" class="header_button"></ha-icon-button> <span>${0}</span> </div> `),null!==(t=null==i?void 0:i.localize("ui.common.close"))&&void 0!==t?t:"Close","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",e)};(0,a.Z)([(0,l.Mo)("ha-dialog")],(function(i,e){class t extends e{constructor(...e){super(...e),i(this)}}return{F:t,d:[{kind:"field",key:r.gA,value:void 0},{kind:"method",key:"scrollToPos",value:function(i,e){var t;null===(t=this.contentElement)||void 0===t||t.scrollTo(i,e)}},{kind:"method",key:"renderHeading",value:function(){return(0,s.dy)(h||(h=g`<slot name="heading"> ${0} </slot>`),(0,o.Z)(t,"renderHeading",this,3)([]))}},{kind:"method",key:"firstUpdated",value:function(){var i;(0,o.Z)(t,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,p].join(", "),this._updateScrolledAttribute(),null===(i=this.contentElement)||void 0===i||i.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(){return[d.W,(0,s.iv)(u||(u=g`: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)},8502:function(i,e,t){"use strict";t.a(i,(async function(i,a){try{t.r(e),t.d(e,{HuiDialogEditCard:()=>j});var o=t(58814),n=t(61701),d=(t(71695),t(19423),t(40251),t(97499),t(47021),t(96814)),s=t.n(d),l=t(57243),r=t(50778),c=t(27486),h=t(36522),u=t(20172),g=t(17170),p=(t(73729),t(95198),t(23334),t(17951)),v=t(76131),m=t(28008),f=t(72473),_=t(58885),x=t(11734),b=t(80373),y=t(26197),k=t(91728),w=i([g,x,b,k]);[g,x,b,k]=w.then?(await w)():w;const C=["cards","title"];let $,E,L,z,A,S,M,I,U,B=i=>i;const R="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",Z="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z";let j=(0,n.Z)([(0,r.Mo)("hui-dialog-edit-card")],(function(i,e){return{F:class extends e{constructor(...e){super(...e),i(this)}},d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"large",value(){return!1}},{kind:"field",decorators:[(0,r.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_cardConfig",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_sectionConfig",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_saving",value(){return!1}},{kind:"field",decorators:[(0,r.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_guiModeAvailable",value(){return!0}},{kind:"field",decorators:[(0,r.IO)("hui-card-element-editor")],key:"_cardEditorEl",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_GUImode",value(){return!0}},{kind:"field",decorators:[(0,r.SB)()],key:"_documentationURL",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_dirty",value(){return!1}},{kind:"field",decorators:[(0,r.SB)()],key:"_isEscapeEnabled",value(){return!0}},{kind:"method",key:"showDialog",value:async function(i){this._params=i,this._GUImode=!0,this._guiModeAvailable=!0,this._sectionConfig=this._params.sectionConfig,this._cardConfig=i.cardConfig,this._dirty=Boolean(this._params.isNew),this.large=!1,this._cardConfig&&!Object.isFrozen(this._cardConfig)&&(this._cardConfig=s()(this._cardConfig))}},{kind:"method",key:"closeDialog",value:function(){return this._isEscapeEnabled=!0,window.removeEventListener("dialog-closed",this._enableEscapeKeyClose),window.removeEventListener("hass-more-info",this._disableEscapeKeyClose),this._dirty?(this._confirmCancel(),!1):(this._params=void 0,this._cardConfig=void 0,this._error=void 0,this._documentationURL=void 0,this._dirty=!1,(0,h.B)(this,"dialog-closed",{dialog:this.localName}),!0)}},{kind:"method",key:"updated",value:function(i){if(!this._cardConfig||void 0!==this._documentationURL||!i.has("_cardConfig"))return;const e=i.get("_cardConfig");(null==e?void 0:e.type)!==this._cardConfig.type&&(this._documentationURL=(0,y.Q)(this.hass,this._cardConfig.type))}},{kind:"field",key:"_enableEscapeKeyClose",value(){return i=>{"ha-more-info-dialog"===i.detail.dialog&&(this._isEscapeEnabled=!0)}}},{kind:"field",key:"_disableEscapeKeyClose",value(){return()=>{this._isEscapeEnabled=!1}}},{kind:"method",key:"render",value:function(){if(!this._params||!this._cardConfig)return l.Ld;let i;if(this._cardConfig.type){let a;var e,t;if((0,p.IT)(this._cardConfig.type))a=null===(e=(0,p.cs)((0,p.V0)(this._cardConfig.type)))||void 0===e?void 0:e.name,null!==(t=a)&&void 0!==t&&t.toLowerCase().endsWith(" card")&&(a=a.substring(0,a.length-5));else a=this.hass.localize(`ui.panel.lovelace.editor.card.${this._cardConfig.type}.name`);i=this.hass.localize("ui.panel.lovelace.editor.edit_card.typed_header",{type:a})}else i=this.hass.localize("ui.panel.lovelace.editor.edit_card.header");return(0,l.dy)($||($=B` <ha-dialog open scrimClickAction .escapeKeyAction="${0}" ="${0}" ="${0}" ="${0}" .heading="${0}"> <ha-dialog-header slot="heading"> <ha-icon-button slot="navigationIcon" dialogAction="cancel" .label="${0}" .path="${0}"></ha-icon-button> <span slot="title" ="${0}">${0}</span> ${0} </ha-dialog-header> <div class="content"> <div class="element-editor"> <hui-card-element-editor .showVisibilityTab="${0}" .sectionConfig="${0}" .hass="${0}" .lovelace="${0}" .value="${0}" -changed="${0}" -changed="${0}" -save="${0}" dialogInitialFocus></hui-card-element-editor> </div> <div class="element-preview"> ${0} ${0} </div> </div> ${0} <div slot="primaryAction" ="${0}"> <mwc-button ="${0}" dialogInitialFocus> ${0} </mwc-button> ${0} </div> </ha-dialog> `),this._isEscapeEnabled?void 0:"",this._ignoreKeydown,this._cancel,this._opened,i,this.hass.localize("ui.common.close"),R,this._enlarge,i,void 0!==this._documentationURL?(0,l.dy)(E||(E=B` <a slot="actionItems" href="${0}" title="${0}" target="_blank" rel="noreferrer" dir="${0}"> <ha-icon-button .path="${0}"></ha-icon-button> </a> `),this._documentationURL,this.hass.localize("ui.panel.lovelace.menu.help"),(0,u.Zu)(this.hass),Z):l.Ld,"conditional"!==this._cardConfig.type,this._sectionConfig,this.hass,this._params.lovelaceConfig,this._cardConfig,this._handleConfigChanged,this._handleGUIModeChanged,this._save,this._sectionConfig?(0,l.dy)(L||(L=B` <hui-section .hass="${0}" .config="${0}" preview class="${0}"></hui-section> `),this.hass,this._cardConfigInSection(this._cardConfig),this._error?"blur":""):(0,l.dy)(z||(z=B` <hui-card .hass="${0}" .config="${0}" preview class="${0}"></hui-card> `),this.hass,this._cardConfig,this._error?"blur":""),this._error?(0,l.dy)(A||(A=B` <ha-spinner aria-label="Can't update card"></ha-spinner> `)):"",void 0!==this._cardConfig?(0,l.dy)(S||(S=B` <mwc-button slot="secondaryAction" ="${0}" .disabled="${0}" class="gui-mode-button"> ${0} </mwc-button> `),this._toggleMode,!this._guiModeAvailable,this.hass.localize(!this._cardEditorEl||this._GUImode?"ui.panel.lovelace.editor.edit_card.show_code_editor":"ui.panel.lovelace.editor.edit_card.show_visual_editor")):"",this._save,this._cancel,this.hass.localize("ui.common.cancel"),void 0!==this._cardConfig&&this._dirty?(0,l.dy)(M||(M=B` <mwc-button ?disabled="${0}" ="${0}"> ${0} </mwc-button> `),!this._canSave||this._saving,this._save,this._saving?(0,l.dy)(I||(I=B` <ha-spinner aria-label="Saving" size="small"></ha-spinner> `)):this.hass.localize("ui.common.save")):"")}},{kind:"method",key:"_enlarge",value:function(){this.large=!this.large}},{kind:"method",key:"_ignoreKeydown",value:function(i){i.stopPropagation()}},{kind:"method",key:"_handleConfigChanged",value:function(i){this._cardConfig=s()(i.detail.config),this._error=i.detail.error,this._guiModeAvailable=i.detail.guiModeAvailable,this._dirty=!0}},{kind:"method",key:"_handleGUIModeChanged",value:function(i){i.stopPropagation(),this._GUImode=i.detail.guiMode,this._guiModeAvailable=i.detail.guiModeAvailable}},{kind:"method",key:"_toggleMode",value:function(){var i;null===(i=this._cardEditorEl)||void 0===i||i.toggleMode()}},{kind:"method",key:"_opened",value:function(){var i;window.addEventListener("dialog-closed",this._enableEscapeKeyClose),window.addEventListener("hass-more-info",this._disableEscapeKeyClose),null===(i=this._cardEditorEl)||void 0===i||i.focusYamlEditor()}},{kind:"field",key:"_cardConfigInSection",value(){return(0,c.Z)((i=>{const e=this._sectionConfig,{cards:t,title:a}=e,n=(0,o.Z)(e,C);return Object.assign(Object.assign({},n),{},{cards:i?[i]:[]})}))}},{kind:"get",key:"_canSave",value:function(){return!this._saving&&(void 0!==this._cardConfig&&(!this._cardEditorEl||!this._cardEditorEl.hasError))}},{kind:"method",key:"_confirmCancel",value:async function(){await new Promise((i=>{setTimeout(i,0)}));await(0,v.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.lovelace.editor.edit_card.unsaved_changes"),text:this.hass.localize("ui.panel.lovelace.editor.edit_card.confirm_cancel"),dismissText:this.hass.localize("ui.common.stay"),confirmText:this.hass.localize("ui.common.leave")})&&this._cancel()}},{kind:"method",key:"_cancel",value:function(i){i&&i.stopPropagation(),this._dirty=!1,this.closeDialog()}},{kind:"method",key:"_save",value:async function(){if(this._canSave)if(this._dirty){this._saving=!0;try{await this._params.saveCardConfig(this._cardConfig),this._saving=!1,this._dirty=!1,(0,_.f)(this,this.hass),this.closeDialog()}catch(i){(0,f.C)(this,{message:i.message}),this._saving=!1}}else this.closeDialog()}},{kind:"get",static:!0,key:"styles",value:function(){return[m.yu,(0,l.iv)(U||(U=B`:host{--code-mirror-max-height:calc(100vh - 176px)}ha-dialog{--mdc-dialog-max-width:100px;--dialog-z-index:6;--dialog-surface-position:fixed;--dialog-surface-top:40px;--mdc-dialog-max-width:90vw;--dialog-content-padding:24px 12px}.content{width:calc(90vw - 48px);max-width:1000px} all and (max-width:450px),all and (max-height:500px){ha-dialog{height:100%;--mdc-dialog-max-height:100%;--dialog-surface-top:0px;--mdc-dialog-max-width:100vw}.content{width:100%;max-width:100%}} all and (min-width:451px) and (min-height:501px){:host([large]) .content{max-width:none}}.center{margin-left:auto;margin-right:auto}.content{display:flex;flex-direction:column}.content hui-card{display:block;padding:4px;margin:0 auto;max-width:390px}.content hui-section{display:block;padding:4px;margin:0 auto;max-width:var(--ha-view-sections-column-max-width,500px)}.content .element-editor{margin:0 10px} (min-width:1000px){.content{flex-direction:row}.content>*{flex-basis:0;flex-grow:1;flex-shrink:1;min-width:0}.content hui-card{padding:8px 10px;margin:auto 0px;max-width:500px}.content hui-section{padding:8px 10px;margin:auto 0px;max-width:var(--ha-view-sections-column-max-width,500px)}}.hidden{display:none}.element-editor{margin-bottom:8px}.blur{filter:blur(2px) grayscale(100%)}.element-preview{position:relative;height:max-content;background:var(--primary-background-color);padding:4px;border-radius:4px;position:sticky;top:0}.element-preview ha-spinner{top:calc(50% - 24px);left:calc(50% - 24px);position:absolute;z-index:10}hui-card{padding-top:8px;margin-bottom:4px;display:block;width:100%;box-sizing:border-box}.gui-mode-button{margin-right:auto;margin-inline-end:auto;margin-inline-start:initial}.header{display:flex;align-items:center;justify-content:space-between}ha-dialog-header a{color:inherit;text-decoration:none}`))]}}]}}),l.oi);a()}catch(C){a(C)}}))},26197:function(i,e,t){"use strict";t.d(e,{$:()=>d,Q:()=>n});var a=t(17951),o=t(73192);const n=(i,e)=>{var t;return(0,a.IT)(e)?null===(t=(0,a.cs)((0,a.V0)(e)))||void 0===t?void 0:t.documentationURL:`${(0,o.R)(i,"/dashboards/")}${e}`},d=(i,e)=>{var t;return(0,a.IT)(e)?null===(t=(0,a.bm)((0,a.V0)(e)))||void 0===t?void 0:t.documentationURL:`${(0,o.R)(i,"/dashboards/badges")}`}},73192:function(i,e,t){"use strict";t.d(e,{R:()=>a});const a=(i,e)=>`https://www.iobroker.net/#${i.language&&i.language.split("-")[0]||"en"}/adapters/adapterref/iobroker.lovelace/README.md#`},58885:function(i,e,t){"use strict";t.d(e,{f:()=>o});var a=t(72473);const o=(i,e)=>(0,a.C)(i,{message:e.localize("ui.common.successfully_saved")})}}]);
//# sourceMappingURL=37007.e0f4e43bfe4f6dce.js.map