iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 9.91 kB
JavaScript
export const __webpack_ids__=["30247"];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)} 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),l=t(51408),s=t(57243),d=t(15093),c=t(76525);t(23334);const r=["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,d.Mo)("ha-dialog")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",key:c.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,r].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:()=>[l.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)},44111:function(e,i,t){t.a(e,(async function(e,a){try{t.r(i),t.d(i,{HuiSaveConfig:()=>v});var o=t(44249),n=(t(31622),t(57243)),l=t(15093),s=t(36522),d=t(17170),c=(t(73729),t(95198),t(55486),t(23334),t(1888),t(64889),t(28008)),r=t(73192),h=t(28421),p=e([d]);d=(p.then?(await p)():p)[0];const g="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",u="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",m={views:[{title:"Home"}]};let v=(0,o.Z)([(0,l.Mo)("hui-dialog-save-config")],(function(e,i){return{F:class extends i{constructor(){super(),e(this),this._saving=!1}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_emptyConfig",value:()=>!1},{kind:"field",decorators:[(0,l.SB)()],key:"_saving",value:void 0},{kind:"method",key:"showDialog",value:function(e){this._params=e,this._emptyConfig=!1}},{kind:"method",key:"closeDialog",value:function(){return this._params=void 0,(0,s.B)(this,"dialog-closed",{dialog:this.localName}),!0}},{kind:"method",key:"render",value:function(){if(!this._params)return n.Ld;const e=this.hass.localize("ui.panel.lovelace.editor.save_config.header");return n.dy` <ha-dialog open scrimClickAction escapeKeyAction ="${this._close}" .heading="${e}"> <ha-dialog-header slot="heading"> <ha-icon-button slot="navigationIcon" dialogAction="cancel" .label="${this.hass.localize("ui.common.close")}" .path="${g}"></ha-icon-button> <span slot="title">${e}</span> <a href="${(0,r.R)(this.hass,"/lovelace/")}" title="${this.hass.localize("ui.panel.lovelace.menu.help")}" target="_blank" rel="noreferrer" slot="actionItems"> <ha-icon-button .path="${u}" .label="${this.hass.localize("ui.common.help")}"></ha-icon-button> </a> </ha-dialog-header> <div> <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.para")} </p> ${"storage"===this._params.mode?n.dy` <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.para_sure")} </p> <ha-formfield .label="${this.hass.localize("ui.panel.lovelace.editor.save_config.empty_config")}"> <ha-switch .checked="${this._emptyConfig}" ="${this._emptyConfigChanged}" dialogInitialFocus></ha-switch></ha-formfield> `:n.dy` <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.yaml_mode")} </p> <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.yaml_control")} </p> <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.yaml_config")} </p> <ha-yaml-editor .hass="${this.hass}" .defaultValue="${this._params.lovelace.config}" dialogInitialFocus></ha-yaml-editor> `} </div> ${"storage"===this._params.mode?n.dy` <mwc-button slot="primaryAction" ="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </mwc-button> <mwc-button slot="primaryAction" ?disabled="${this._saving}" ="${this._saveConfig}"> ${this._saving?n.dy`<ha-spinner size="small" aria-label="Saving"></ha-spinner>`:""} ${this.hass.localize("ui.panel.lovelace.editor.save_config.save")} </mwc-button> `:n.dy` <mwc-button slot="primaryAction" ="${this.closeDialog}"> ${this.hass.localize("ui.panel.lovelace.editor.save_config.close")}</mwc-button> `} </ha-dialog> `}},{kind:"method",key:"_close",value:function(e){e&&e.stopPropagation(),this.closeDialog()}},{kind:"method",key:"_emptyConfigChanged",value:function(e){this._emptyConfig=e.target.checked}},{kind:"method",key:"_saveConfig",value:async function(){if(this.hass&&this._params){this._saving=!0;try{const e=this._params.lovelace;await e.saveConfig(this._emptyConfig?m:await(0,h.mQ)(e.config,this.hass)),e.setEditMode(!0),this._saving=!1,this.closeDialog()}catch(e){alert(`Saving failed: ${e.message}`),this._saving=!1}}}},{kind:"get",static:!0,key:"styles",value:function(){return[c.yu,n.iv`ha-dialog{--dialog-content-padding:0 24px 24px 24px}ha-dialog-header a{color:inherit;text-decoration:none}`]}}]}}),n.oi);a()}catch(e){a(e)}}))}};
//# sourceMappingURL=30247.f3a5f1555a0afed3.js.map