iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 34.7 kB
JavaScript
export const __webpack_ids__=["20123"];export const __webpack_modules__={95198:function(e,i,t){var a=t(44249),n=t(57243),o=t(15093);(0,a.Z)([(0,o.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 n.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[n.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}`]}}]}}),n.oi)},73729:function(e,i,t){t.d(i,{i:()=>h});var a=t(44249),n=t(72621),o=t(74966),s=t(51408),l=t(57243),d=t(15093),r=t(76525);t(23334);const c=["button","ha-list-item"],h=(e,i)=>l.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: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 l.dy`<slot name="heading"> ${(0,n.Z)(t,"renderHeading",this,3)([])} </slot>`}},{kind:"method",key:"firstUpdated",value:function(){(0,n.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,n.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:()=>[s.W,l.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)}`]}]}}),o.M)},83166:function(e,i,t){var a=t(44249),n=t(72621),o=t(1105),s=t(33990),l=t(57243),d=t(15093),r=t(5111);(0,a.Z)([(0,d.Mo)("ha-textfield")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"icon",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"iconTrailing",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,d.IO)("input")],key:"formElement",value:void 0},{kind:"method",key:"updated",value:function(e){(0,n.Z)(t,"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,i=!1){const t=i?"trailing":"leading";return l.dy` <span class="mdc-text-field__icon mdc-text-field__icon--${t}" tabindex="${i?1:-1}"> <slot name="${t}Icon"></slot> </span> `}},{kind:"field",static:!0,key:"styles",value:()=>[s.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``]}]}}),o.P)},84097:function(e,i,t){t.a(e,(async function(e,i){try{var a=t(44249),n=t(57243),o=t(15093),s=t(91583),l=t(36522),d=t(58725),r=(t(23334),t(62801),e([d]));d=(r.then?(await r)():r)[0];const c="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z";(0,a.Z)([(0,o.Mo)("hui-entity-editor")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"entities",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"label",value:void 0},{kind:"field",key:"_entityKeys",value:()=>new WeakMap},{kind:"method",key:"_getKey",value:function(e){return this._entityKeys.has(e)||this._entityKeys.set(e,Math.random().toString()),this._entityKeys.get(e)}},{kind:"method",key:"render",value:function(){return this.entities?n.dy` <h3> ${this.label||this.hass.localize("ui.panel.lovelace.editor.card.generic.entities")+" ("+this.hass.localize("ui.panel.lovelace.editor.card.config.required")+")"} </h3> <ha-sortable handle-selector=".handle" -moved="${this._entityMoved}"> <div class="entities"> ${(0,s.r)(this.entities,(e=>this._getKey(e)),((e,i)=>n.dy` <div class="entity" data-entity-id="${e.entity}"> <div class="handle"> <ha-svg-icon .path="${c}"></ha-svg-icon> </div> <ha-entity-picker .hass="${this.hass}" .value="${e.entity}" .index="${i}" .entityFilter="${this.entityFilter}" -changed="${this._valueChanged}" allow-custom-entity></ha-entity-picker> </div> `))} </div> </ha-sortable> <ha-entity-picker class="add-entity" .hass="${this.hass}" .entityFilter="${this.entityFilter}" -changed="${this._addEntity}"></ha-entity-picker> `:n.Ld}},{kind:"method",key:"_addEntity",value:async function(e){const i=e.detail.value;if(""===i)return;const t=this.entities.concat({entity:i});e.target.value="",(0,l.B)(this,"entities-changed",{entities:t})}},{kind:"method",key:"_entityMoved",value:function(e){e.stopPropagation();const{oldIndex:i,newIndex:t}=e.detail,a=this.entities.concat();a.splice(t,0,a.splice(i,1)[0]),(0,l.B)(this,"entities-changed",{entities:a})}},{kind:"method",key:"_valueChanged",value:function(e){const i=e.detail.value,t=e.target.index,a=this.entities.concat();""===i||void 0===i?a.splice(t,1):a[t]={...a[t],entity:i},(0,l.B)(this,"entities-changed",{entities:a})}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`ha-entity-picker{margin-top:8px}.add-entity{display:block;margin-left:31px;margin-inline-start:31px;margin-inline-end:initial;direction:var(--direction)}.entity{display:flex;align-items:center}.entity .handle{padding-right:8px;cursor:move;cursor:grab;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.entity .handle>*{pointer-events:none}.entity ha-entity-picker{flex-grow:1}`}]}}),n.oi);i()}catch(e){i(e)}}))},7883:function(e,i,t){t.d(i,{e:()=>n});var a=t(36522);const n=(e,i)=>{(0,a.B)(e,"show-dialog",{dialogTag:"hui-dialog-select-dashboard",dialogImport:()=>Promise.all([t.e("5080"),t.e("50408"),t.e("81465"),t.e("7442"),t.e("86628"),t.e("40648")]).then(t.bind(t,38321)),dialogParams:i})}},29809:function(e,i,t){t.a(e,(async function(e,a){try{t.r(i),t.d(i,{HuiDialogEditView:()=>L});var n=t(44249),o=(t(56820),t(99619),t(57243)),s=t(15093),l=t(35359),d=t(36522),r=t(49976),c=t(83523),h=t(48045),u=(t(99426),t(59826),t(17170)),v=(t(73729),t(95198),t(64889),t(10571)),p=t(76131),g=t(28008),f=t(84097),m=t(82747),_=t(80714),y=t(18461),k=t(27353),b=(t(68658),t(83849),t(91551),t(7883)),x=t(48977),w=e([u,f]);[u,f]=w.then?(await w)():w;const $="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",C="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",z="M14 2H6C4.9 2 4 2.9 4 4V20C4 20.41 4.12 20.8 4.34 21.12C4.41 21.23 4.5 21.33 4.59 21.41C4.95 21.78 5.45 22 6 22H13.53C13 21.42 12.61 20.75 12.35 20H6V4H13V9H18V12C18.7 12 19.37 12.12 20 12.34V8L14 2M18 23L23 18.5L20 15.8L18 14V17H14V20H18V23Z",V="M3 6V8H14V6H3M3 10V12H14V10H3M20 10.1C19.9 10.1 19.7 10.2 19.6 10.3L18.6 11.3L20.7 13.4L21.7 12.4C21.9 12.2 21.9 11.8 21.7 11.6L20.4 10.3C20.3 10.2 20.2 10.1 20 10.1M18.1 11.9L12 17.9V20H14.1L20.2 13.9L18.1 11.9M3 14V16H10V14H3Z",M=["tab-settings","tab-background","tab-visibility"];let L=(0,n.Z)([(0,s.Mo)("hui-dialog-edit-view")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_lovelace",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_saving",value:()=>!1},{kind:"field",decorators:[(0,s.SB)()],key:"_currTab",value:()=>M[0]},{kind:"field",decorators:[(0,s.SB)()],key:"_dirty",value:()=>!1},{kind:"field",decorators:[(0,s.SB)()],key:"_yamlMode",value:()=>!1},{kind:"field",decorators:[(0,s.IO)("ha-yaml-editor")],key:"_editor",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_currentType",value:()=>(0,y.W)()},{kind:"get",key:"_type",value:function(){return(0,y.W)(this._config)}},{kind:"method",key:"updated",value:function(e){if(this._yamlMode&&e.has("_yamlMode")){const e={...this._config};this._editor?.setValue(e)}}},{kind:"method",key:"showDialog",value:function(e){if(this._params=e,void 0===this._params.viewIndex)return this._config={type:m.zh},void(this._dirty=!1);this._lovelace=this._params.lovelace;const i=this._lovelace.config.views[this._params.viewIndex];if((0,v.s)(i)){const{strategy:e,...t}=i;this._config=t}else this._config=i,this._currentType=this._type}},{kind:"method",key:"closeDialog",value:function(){this._params=void 0,this._config={},this._yamlMode=!1,this._dirty=!1,this._currTab=M[0],(0,d.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"get",key:"_viewConfigTitle",value:function(){return this._config&&this._config.title?this.hass.localize("ui.panel.lovelace.editor.edit_view.header_name",{name:this._config.title}):this.hass.localize("ui.panel.lovelace.editor.edit_view.header")}},{kind:"method",key:"render",value:function(){if(!this._params)return o.Ld;let e;if(this._yamlMode)e=o.dy` <ha-yaml-editor .hass="${this.hass}" dialogInitialFocus -changed="${this._viewYamlChanged}"></ha-yaml-editor> `;else switch(this._currTab){case"tab-settings":e=o.dy` <hui-view-editor .isNew="${void 0===this._params.viewIndex}" .hass="${this.hass}" .config="${this._config}" -config-changed="${this._viewConfigChanged}"></hui-view-editor> `;break;case"tab-background":e=o.dy` <hui-view-background-editor .hass="${this.hass}" .config="${this._config}" -config-changed="${this._viewConfigChanged}"></hui-view-background-editor> `;break;case"tab-visibility":e=o.dy` <hui-view-visibility-editor .hass="${this.hass}" .config="${this._config}" -visibility-changed="${this._viewVisibilityChanged}"></hui-view-visibility-editor> `}const i=this._type===m.zh&&this._currentType!==m.zh&&this._config?.cards?.length,t=this._type!==m.zh&&this._currentType===m.zh&&this._config?.sections?.length;return o.dy` <ha-dialog open scrimClickAction escapeKeyAction ="${this.closeDialog}" .heading="${this._viewConfigTitle}" class="${(0,l.$)({"yaml-mode":this._yamlMode})}"> <ha-dialog-header show-border slot="heading"> <ha-icon-button slot="navigationIcon" dialogAction="cancel" .label="${this.hass.localize("ui.common.close")}" .path="${$}"></ha-icon-button> <h2 slot="title">${this._viewConfigTitle}</h2> <ha-button-menu slot="actionItems" fixed corner="BOTTOM_END" menu-corner="END" ="${this._handleAction}" ="${r.U}"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${C}"></ha-icon-button> <ha-list-item graphic="icon"> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.edit_"+(this._yamlMode?"ui":"yaml"))} <ha-svg-icon slot="graphic" .path="${V}"></ha-svg-icon> </ha-list-item> <ha-list-item graphic="icon"> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.move_to_dashboard")} <ha-svg-icon slot="graphic" .path="${z}"></ha-svg-icon> </ha-list-item> </ha-button-menu> ${i?o.dy` <ha-alert alert-type="info"> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.card_to_section_convert")} <ha-button slot="action" .label="${this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view")}" ="${this._convertToSection}"> </ha-button> </ha-alert> `:o.Ld} ${t?o.dy` <ha-alert alert-type="warning"> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.section_to_card_not_supported")} </ha-alert> `:o.Ld} ${this._yamlMode?o.Ld:o.dy`<mwc-tab-bar .activeIndex="${M.indexOf(this._currTab)}" :activated="${this._handleTabChanged}"> ${M.map((e=>o.dy` <mwc-tab .label="${this.hass.localize(`ui.panel.lovelace.editor.edit_view.${e.replace("-","_")}`)}"> </mwc-tab> `))} </mwc-tab-bar>`} </ha-dialog-header> ${e} ${void 0!==this._params.viewIndex?o.dy` <ha-button class="warning" slot="secondaryAction" ="${this._deleteConfirm}"> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.delete")} </ha-button> `:o.Ld} <ha-button slot="primaryAction" ?disabled="${!this._config||this._saving||!this._dirty||i||t}" ="${this._save}"> ${this._saving?o.dy`<ha-spinner size="small" aria-label="Saving"></ha-spinner>`:o.Ld} ${this.hass.localize("ui.common.save")}</ha-button> </ha-dialog> `}},{kind:"method",key:"_handleAction",value:async function(e){switch(e.stopPropagation(),e.preventDefault(),e.detail.index){case 0:this._yamlMode=!this._yamlMode;break;case 1:this._openSelectDashboard()}}},{kind:"method",key:"_openSelectDashboard",value:function(){(0,b.e)(this,{lovelaceConfig:this._lovelace.config,dashboardSelectedCallback:this._moveViewToDashboard,urlPath:this._lovelace.urlPath})}},{kind:"field",key:"_moveViewToDashboard",value(){return async e=>{let i,t,a;try{t=await(0,x.Q2)(this.hass.connection,e,!1)}catch(e){i=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.get_config_failed"),console.error(e)}if(t&&(0,x.Tx)(t)&&(i=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.cannot_move_to_strategy")),!i){const[n,o]=(0,k.K_)(this.hass,this._lovelace.config,t,this._params.viewIndex),s=this._lovelace.config,l=t;a=async()=>{await(0,x.Oh)(this.hass,e,l),await this._lovelace.saveConfig(s)};try{await this._lovelace.saveConfig(n),await(0,x.Oh)(this.hass,e,o)}catch(e){console.error(e);try{await a(),i=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.move_failed")}catch(e){console.error(e),i=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.revert_failed")}}}i?(0,p.showAlertDialog)(this,{text:i}):(this._lovelace.showToast({message:this.hass.localize("ui.panel.lovelace.editor.select_dashboard.success"),duration:4e3,action:{action:a,text:this.hass.localize("ui.common.undo")}}),this.closeDialog(),(0,c.c)(`/${window.location.pathname.split("/")[1]}`))}}},{kind:"method",key:"_convertToSection",value:async function(){if(!this._params||!this._config)return;if(!await(0,p.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view_title"),text:this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view_text"),confirmText:this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view_action"),dismissText:this.hass.localize("ui.common.cancel")}))return;const e={...this._config};e.type=m.zh,e.sections=[(0,_.d)(this.hass.localize)],e.path=void 0;const i=this._params.lovelace;try{await i.saveConfig((0,k.Uo)(this.hass,i.config,e)),this._params.saveCallback&&this._params.saveCallback(i.config.views.length,e),this.closeDialog()}catch(e){(0,p.showAlertDialog)(this,{text:`${this.hass.localize("ui.panel.lovelace.editor.edit_view.saving_failed")}: ${e.message}`})}finally{this._saving=!1}}},{kind:"method",key:"_delete",value:async function(){if(this._params)try{await this._params.lovelace.saveConfig((0,k.PT)(this._params.lovelace.config,this._params.viewIndex)),this.closeDialog(),(0,c.c)(`/${window.location.pathname.split("/")[1]}`)}catch(e){(0,p.showAlertDialog)(this,{text:`Deleting failed: ${e.message}`})}}},{kind:"method",key:"_deleteConfirm",value:async function(){const e=this._config?.sections?.length?"sections":this._config?.cards?.length?"cards":"only",i=this._config?.title?"named":"unnamed";await(0,p.showConfirmationDialog)(this,{title:this.hass.localize("ui.panel.lovelace.views.delete_title"),text:this.hass.localize(`ui.panel.lovelace.views.delete_${i}_view_${e}`,{name:this._config?.title}),confirmText:this.hass.localize("ui.common.delete"),destructive:!0})&&this._delete()}},{kind:"method",key:"_handleTabChanged",value:function(e){const i=M[e.detail.index];i!==this._currTab&&(this._currTab=i)}},{kind:"method",key:"_save",value:async function(){if(!this._params||!this._config)return;if(!this._isConfigChanged())return void this.closeDialog();this._saving=!0;const e={...this._config};e.type!==m.zh||e.sections?.length?e.cards?.length||(e.cards=[]):e.sections=[(0,_.d)(this.hass.localize)];const i=this._params.lovelace;try{await i.saveConfig(this._creatingView?(0,k.Uo)(this.hass,i.config,e):(0,k.YI)(this.hass,i.config,this._params.viewIndex,e)),this._params.saveCallback&&this._creatingView&&this._params.saveCallback(this._params.viewIndex||i.config.views.length,e),this.closeDialog()}catch(e){(0,p.showAlertDialog)(this,{text:`${this.hass.localize("ui.panel.lovelace.editor.edit_view.saving_failed")}: ${e.message}`})}finally{this._saving=!1}}},{kind:"method",key:"_viewConfigChanged",value:function(e){e.detail&&e.detail.config&&!(0,h.v)(this._config,e.detail.config)&&(this._config=e.detail.config,this._dirty=!0)}},{kind:"method",key:"_viewVisibilityChanged",value:function(e){e.detail.visible&&this._config&&(this._config={...this._config,visible:e.detail.visible}),this._dirty=!0}},{kind:"method",key:"_viewYamlChanged",value:function(e){e.stopPropagation(),e.detail.isValid&&(this._config=e.detail.value,this._dirty=!0)}},{kind:"method",key:"_isConfigChanged",value:function(){return this._creatingView||JSON.stringify(this._config)!==JSON.stringify(this._params.lovelace.config.views[this._params.viewIndex])}},{kind:"get",key:"_creatingView",value:function(){return void 0===this._params.viewIndex}},{kind:"get",static:!0,key:"styles",value:function(){return[g.yu,o.iv`ha-dialog{--vertical-align-dialog:flex-start;--dialog-surface-margin-top:40px} all and (max-width:450px),all and (max-height:500px){ha-dialog{--dialog-surface-margin-top:0px}}ha-dialog.yaml-mode{--dialog-content-padding:0}h2{margin:0;font-size:inherit;font-weight:inherit}mwc-tab-bar{color:var(--primary-text-color);text-transform:uppercase;padding:0 20px}ha-button.warning{margin-right:auto;margin-inline-end:auto;margin-inline-start:initial}.hidden{display:none}.error{color:var(--error-color);border-bottom:1px solid var(--error-color)}ha-alert{display:block}ha-alert ha-button{display:block} all and (min-width:600px){ha-dialog{--mdc-dialog-min-width:600px}}`]}}]}}),o.oi);a()}catch(e){a(e)}}))},68658:function(e,i,t){var a=t(44249),n=(t(87319),t(27486)),o=t(57243),s=t(15093),l=t(36522);t(29073),t(24730);(0,a.Z)([(0,s.Mo)("hui-view-background-editor")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_config",value:void 0},{kind:"set",key:"config",value:function(e){this._config=e}},{kind:"field",key:"_localizeValueCallback",value(){return e=>this.hass.localize(e)}},{kind:"field",key:"_schema",value:()=>(0,n.Z)((e=>[{name:"image",selector:{background:{original:!0}}},...e?[{name:"settings",flatten:!0,expanded:!0,type:"expandable",schema:[{name:"opacity",selector:{number:{min:0,max:100,mode:"slider"}}},{name:"attachment",selector:{button_toggle:{translation_key:"ui.panel.lovelace.editor.edit_view.background.attachment",options:["scroll","fixed"]}}},{name:"size",required:!0,selector:{select:{translation_key:"ui.panel.lovelace.editor.edit_view.background.size",options:["auto","cover","contain"],mode:"dropdown"}}},{name:"alignment",required:!0,selector:{select:{translation_key:"ui.panel.lovelace.editor.edit_view.background.alignment",options:["top left","top center","top right","center left","center","center right","bottom left","bottom center","bottom right"],mode:"dropdown"}}},{name:"repeat",required:!0,selector:{select:{translation_key:"ui.panel.lovelace.editor.edit_view.background.repeat",options:["repeat","no-repeat"],mode:"dropdown"}}}]}]:[]]))},{kind:"method",key:"render",value:function(){if(!this.hass)return o.Ld;let e=this._config?.background;if("string"==typeof e){const i=e.match(/url\(['"]?([^'"]+)['"]?\)/)?.[1];e={image:i}}return e=e?{opacity:100,alignment:"center",size:"cover",repeat:"no-repeat",attachment:"scroll",...e}:{opacity:33,alignment:"center",size:"cover",repeat:"repeat",attachment:"fixed"},o.dy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${this._schema(!0)}" .computeLabel="${this._computeLabelCallback}" -changed="${this._valueChanged}" .localizeValue="${this._localizeValueCallback}" style="${`--picture-opacity: ${(e.opacity??100)/100};`}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){const i={...this._config,background:e.detail.value};(0,l.B)(this,"view-config-changed",{config:i})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"image":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.image");case"opacity":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.opacity");case"alignment":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.alignment.name");case"size":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.size.name");case"repeat":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.repeat.name");case"attachment":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.attachment.name");default:return this.hass.localize(`ui.panel.lovelace.editor.edit_view.background.${e.name}`)}}}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{display:block;--file-upload-image-border-radius:4px}`}]}}),o.oi)},83849:function(e,i,t){var a=t(44249),n=(t(9359),t(70104),t(57243)),o=t(15093),s=t(27486),l=t(36522),d=t(34798),r=(t(29073),t(82747)),c=t(18461);(0,a.Z)([(0,o.Mo)("hui-view-editor")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"isNew",value:()=>!1},{kind:"field",decorators:[(0,o.SB)()],key:"_config",value:void 0},{kind:"field",key:"_suggestedPath",value:()=>!1},{kind:"field",key:"_schema",value:()=>(0,s.Z)(((e,i)=>[{name:"type",selector:{select:{options:[r.zh,r.e4,r.rQ,r.Jh].map((i=>({value:i,label:e(`ui.panel.lovelace.editor.edit_view.types.${i}`)})))}}},{name:"title",selector:{text:{}}},{name:"icon",selector:{icon:{}}},{name:"path",selector:{text:{}}},{name:"theme",selector:{theme:{}}},{name:"subview",selector:{boolean:{}}},...i===r.zh?[{name:"section_specifics",type:"expandable",flatten:!0,expanded:!0,schema:[{name:"max_columns",selector:{number:{min:1,max:10,mode:"slider",slider_ticks:!0}}},{name:"dense_section_placement",selector:{boolean:{}}},{name:"top_margin",selector:{boolean:{}}}]}]:[]]))},{kind:"set",key:"config",value:function(e){this._config=e}},{kind:"get",key:"_type",value:function(){return(0,c.W)(this._config)}},{kind:"method",key:"render",value:function(){if(!this.hass)return n.Ld;const e=this._schema(this.hass.localize,this._type),i={...this._config,type:this._type};return void 0===i.max_columns&&this._type===r.zh&&(i.max_columns=4),n.dy` <ha-form .hass="${this.hass}" .data="${i}" .schema="${e}" .computeLabel="${this._computeLabel}" .computeHelper="${this._computeHelper}" -changed="${this._valueChanged}"></ha-form> `}},{kind:"method",key:"_valueChanged",value:function(e){const i=e.detail.value;i.type!==r.zh&&(delete i.max_columns,delete i.dense_section_placement,delete i.top_margin),!this.isNew||this._suggestedPath||this._config.path!==i.path||this._config.path&&i.path!==(0,d.l)(this._config.title||"","-")||(i.path=(0,d.l)(i.title||"","-")),(0,l.B)(this,"view-config-changed",{config:i})}},{kind:"field",key:"_computeLabel",value(){return e=>{switch(e.name){case"path":return this.hass.localize("ui.panel.lovelace.editor.card.generic.url");case"type":case"subview":case"max_columns":case"dense_section_placement":case"top_margin":case"section_specifics":return this.hass.localize(`ui.panel.lovelace.editor.edit_view.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}},{kind:"field",key:"_computeHelper",value(){return e=>{switch(e.name){case"subview":case"dense_section_placement":case"top_margin":return this.hass.localize(`ui.panel.lovelace.editor.edit_view.${e.name}_helper`);default:return}}}}]}}),n.oi)},91551:function(e,i,t){var a=t(44249),n=t(72621),o=(t(92745),t(9359),t(56475),t(70104),t(52924),t(87319),t(57243)),s=t(15093),l=t(27486),d=t(36522),r=t(1416),c=(t(45801),t(7285),t(1888),t(4242));(0,a.Z)([(0,s.Mo)("hui-view-visibility-editor")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"set",key:"config",value:function(e){this._config=e,this._visible=void 0===this._config.visible||this._config.visible}},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_users",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_visible",value:void 0},{kind:"field",key:"_sortedUsers",value(){return(0,l.Z)((e=>e.sort(((e,i)=>(0,r.$K)(e.name,i.name,this.hass.locale.language)))))}},{kind:"method",key:"firstUpdated",value:function(e){(0,n.Z)(t,"firstUpdated",this,3)([e]),(0,c.uh)(this.hass).then((e=>{this._users=e.filter((e=>!e.system_generated))}))}},{kind:"method",key:"render",value:function(){return this.hass&&this._users?o.dy` <p> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.visibility.select_users")} </p> ${this._sortedUsers(this._users).map((e=>o.dy` <ha-list-item graphic="avatar" hasMeta> <ha-user-badge slot="graphic" .hass="${this.hass}" .user="${e}"></ha-user-badge> <span>${e.name}</span> <ha-switch slot="meta" .userId="${e.id}" ="${this._valChange}" .checked="${this.checkUser(e.id)}"></ha-switch> </ha-list-item> `))} `:o.Ld}},{kind:"method",key:"checkUser",value:function(e){return void 0===this._visible||("boolean"==typeof this._visible?this._visible:this._visible.some((i=>i.user===e)))}},{kind:"method",key:"_valChange",value:function(e){const i=e.currentTarget.userId,t=e.currentTarget.checked;let a=[];if("boolean"==typeof this._visible){this._visible&&(a=this._users.map((e=>({user:e.id}))))}else a=[...this._visible];if(!0===t){const e={user:i};a.push(e)}else a=a.filter((e=>e.user!==i));this._visible=a.filter((e=>this._users.some((i=>i.id===e.user)))),(0,d.B)(this,"view-visibility-changed",{visible:this._visible})}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{display:block}`}]}}),o.oi)},80714:function(e,i,t){t.d(i,{d:()=>a});const a=e=>({type:"grid",cards:[{type:"heading",heading:e("ui.panel.lovelace.editor.section.default_section_title")}]})}};
//# sourceMappingURL=20123.9cc1fcf8c404cf9f.js.map