9 lines
23 KiB
JavaScript
9 lines
23 KiB
JavaScript
/*! For license information please see 1244.e67e8a4b61e2436d.js.LICENSE.txt */
|
|
export const ids=["1244"];export const modules={84573:function(e,i,t){var a=t(44249),s=t(74763),o=t(50778);(0,a.Z)([(0,o.Mo)("ha-chip-set")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[]}}),s.l)},13978:function(e,i,t){var a=t(44249),s=t(72621),o=t(74514),l=t(57243),d=t(50778);(0,a.Z)([(0,d.Mo)("ha-input-chip")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",static:!0,key:"styles",value(){return[...(0,s.Z)(t,"styles",this),l.iv`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--primary-text-color);--md-sys-color-on-secondary-container:var(--primary-text-color);--md-input-chip-container-shape:16px;--md-input-chip-outline-color:var(--outline-color);--md-input-chip-selected-container-color:rgba(
|
|
var(--rgb-primary-text-color),
|
|
0.15
|
|
);--ha-input-chip-selected-container-opacity:1;--md-input-chip-label-text-font:Roboto,sans-serif}::slotted([slot=icon]){display:flex;--mdc-icon-size:var(--md-input-chip-icon-size, 18px)}.selected::before{opacity:var(--ha-input-chip-selected-container-opacity)}`]}}]}}),o.W)},62304:function(e,i,t){var a=t(44249),s=t(57243),o=t(50778),l=t(11297);t(26375);(0,a.Z)([(0,o.Mo)("ha-aliases-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)({type:Array})],key:"aliases",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"method",key:"render",value:function(){return this.aliases?s.dy` <ha-multi-textfield .hass="${this.hass}" .value="${this.aliases}" .disabled="${this.disabled}" .label="${this.hass.localize("ui.dialogs.aliases.label")}" .removeLabel="${this.hass.localize("ui.dialogs.aliases.remove")}" .addLabel="${this.hass.localize("ui.dialogs.aliases.add")}" item-index @value-changed="${this._aliasesChanged}"> </ha-multi-textfield> `:s.Ld}},{kind:"method",key:"_aliasesChanged",value:function(e){(0,l.B)(this,"value-changed",{value:e})}}]}}),s.oi)},69181:function(e,i,t){var a=t(44249),s=(t(39527),t(92181),t(99790),t(13334),t(36993),t(57243)),o=t(50778),l=t(35359),d=t(27486),n=t(11297),r=t(79575),c=t(59848),h=t(71656),u=t(99523),v=t(4557),m=t(88233);t(69484),t(59897),t(74064),t(10508);const p=e=>s.dy`<ha-list-item graphic="icon" class="${(0,l.$)({"add-new":e.area_id===f})}"> ${e.icon?s.dy`<ha-icon slot="graphic" .icon="${e.icon}"></ha-icon>`:s.dy`<ha-svg-icon slot="graphic" .path="${"M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z"}"></ha-svg-icon>`} ${e.name} </ha-list-item>`,f="___ADD_NEW___",_="___NO_ITEMS___",y="___ADD_NEW_SUGGESTION___";(0,a.Z)([(0,o.Mo)("ha-area-picker")],(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)()],key:"label",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"no-add"})],key:"noAdd",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"exclude-areas"})],key:"excludeAreas",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,o.SB)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,o.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_suggestion",value:void 0},{kind:"field",key:"_init",value:()=>!1},{kind:"method",key:"open",value:async function(){await this.updateComplete,await(this.comboBox?.open())}},{kind:"method",key:"focus",value:async function(){await this.updateComplete,await(this.comboBox?.focus())}},{kind:"field",key:"_getAreas",value(){return(0,d.Z)(((e,i,t,a,s,o,l,d,n,c)=>{let h,v,m={};(a||s||o||l||d)&&(m=(0,u.R6)(t),h=i,v=t.filter((e=>e.area_id)),a&&(h=h.filter((e=>{const i=m[e.id];return!(!i||!i.length)&&m[e.id].some((e=>a.includes((0,r.M)(e.entity_id))))})),v=v.filter((e=>a.includes((0,r.M)(e.entity_id))))),s&&(h=h.filter((e=>{const i=m[e.id];return!i||!i.length||t.every((e=>!s.includes((0,r.M)(e.entity_id))))})),v=v.filter((e=>!s.includes((0,r.M)(e.entity_id))))),o&&(h=h.filter((e=>{const i=m[e.id];return!(!i||!i.length)&&m[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&(i.attributes.device_class&&o.includes(i.attributes.device_class))}))})),v=v.filter((e=>{const i=this.hass.states[e.entity_id];return i.attributes.device_class&&o.includes(i.attributes.device_class)}))),l&&(h=h.filter((e=>l(e)))),d&&(h=h.filter((e=>{const i=m[e.id];return!(!i||!i.length)&&m[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&d(i)}))})),v=v.filter((e=>{const i=this.hass.states[e.entity_id];return!!i&&d(i)}))));let p,y=e;return h&&(p=h.filter((e=>e.area_id)).map((e=>e.area_id))),v&&(p=(p??[]).concat(v.filter((e=>e.area_id)).map((e=>e.area_id)))),p&&(y=y.filter((e=>p.includes(e.area_id)))),c&&(y=y.filter((e=>!c.includes(e.area_id)))),y.length||(y=[{area_id:_,floor_id:null,name:this.hass.localize("ui.components.area-picker.no_areas"),picture:null,icon:null,aliases:[],labels:[],created_at:0,modified_at:0}]),n?y:[...y,{area_id:f,floor_id:null,name:this.hass.localize("ui.components.area-picker.add_new"),picture:null,icon:"mdi:plus",aliases:[],labels:[],created_at:0,modified_at:0}]}))}},{kind:"method",key:"updated",value:function(e){if(!this._init&&this.hass||this._init&&e.has("_opened")&&this._opened){this._init=!0;const e=this._getAreas(Object.values(this.hass.areas),Object.values(this.hass.devices),Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.noAdd,this.excludeAreas).map((e=>({...e,strings:[e.area_id,...e.aliases,e.name]})));this.comboBox.items=e,this.comboBox.filteredItems=e}}},{kind:"method",key:"render",value:function(){return s.dy` <ha-combo-box .hass="${this.hass}" .helper="${this.helper}" item-value-path="area_id" item-id-path="area_id" item-label-path="name" .value="${this._value}" .disabled="${this.disabled}" .required="${this.required}" .label="${void 0===this.label&&this.hass?this.hass.localize("ui.components.area-picker.area"):this.label}" .placeholder="${this.placeholder?this.hass.areas[this.placeholder]?.name:void 0}" .renderer="${p}" @filter-changed="${this._filterChanged}" @opened-changed="${this._openedChanged}" @value-changed="${this._areaChanged}"> </ha-combo-box> `}},{kind:"method",key:"_filterChanged",value:function(e){const i=e.target,t=e.detail.value;if(!t)return void(this.comboBox.filteredItems=this.comboBox.items);const a=(0,c.q)(t,i.items?.filter((e=>![_,f].includes(e.label_id)))||[]);0===a.length?this.noAdd?(this._suggestion=t,this.comboBox.filteredItems=[{area_id:y,floor_id:null,name:this.hass.localize("ui.components.area-picker.add_new_sugestion",{name:this._suggestion}),icon:"mdi:plus",picture:null,labels:[],aliases:[],created_at:0,modified_at:0}]):this.comboBox.filteredItems=[{area_id:_,floor_id:null,name:this.hass.localize("ui.components.area-picker.no_match"),icon:null,picture:null,labels:[],aliases:[],created_at:0,modified_at:0}]:this.comboBox.filteredItems=a}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_areaChanged",value:function(e){e.stopPropagation();let i=e.detail.value;if(i===_)return i="",void this.comboBox.setInputValue("");[y,f].includes(i)?(e.target.value=this._value,this.hass.loadFragmentTranslation("config"),(0,m.E)(this,{suggestedName:i===y?this._suggestion:"",createEntry:async e=>{try{const i=await(0,h.Lo)(this.hass,e),t=[...Object.values(this.hass.areas),i];this.comboBox.filteredItems=this._getAreas(t,Object.values(this.hass.devices),Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.noAdd,this.excludeAreas),await this.updateComplete,await this.comboBox.updateComplete,this._setValue(i.area_id)}catch(e){(0,v.Ys)(this,{title:this.hass.localize("ui.components.area-picker.failed_create_area"),text:e.message})}}}),this._suggestion=void 0,this.comboBox.setInputValue("")):i!==this._value&&this._setValue(i)}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,n.B)(this,"value-changed",{value:e}),(0,n.B)(this,"change")}),0)}}]}}),s.oi)},26375:function(e,i,t){var a=t(44249),s=(t(13334),t(57243)),o=t(50778),l=t(11297),d=t(66193);t(20095),t(59897),t(70596);(0,a.Z)([(0,o.Mo)("ha-multi-textfield")],(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:"value",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"inputType",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"inputSuffix",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"inputPrefix",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"addLabel",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"removeLabel",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"item-index",type:Boolean})],key:"itemIndex",value:()=>!1},{kind:"method",key:"render",value:function(){return s.dy` ${this._items.map(((e,i)=>{const t=""+(this.itemIndex?` ${i+1}`:"");return s.dy` <div class="layout horizontal center-center row"> <ha-textfield .suffix="${this.inputSuffix}" .prefix="${this.inputPrefix}" .type="${this.inputType}" .autocomplete="${this.autocomplete}" .disabled="${this.disabled}" dialogInitialFocus="${i}" .index="${i}" class="flex-auto" .label="${""+(this.label?`${this.label}${t}`:"")}" .value="${e}" ?data-last="${i===this._items.length-1}" @input="${this._editItem}" @keydown="${this._keyDown}"></ha-textfield> <ha-icon-button .disabled="${this.disabled}" .index="${i}" slot="navigationIcon" .label="${this.removeLabel??this.hass?.localize("ui.common.remove")??"Remove"}" @click="${this._removeItem}" .path="${"M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19M8,9H16V19H8V9M15.5,4L14.5,3H9.5L8.5,4H5V6H19V4H15.5Z"}"></ha-icon-button> </div> `}))} <div class="layout horizontal center-center"> <ha-button @click="${this._addItem}" .disabled="${this.disabled}"> ${this.addLabel??this.hass?.localize("ui.common.add")??"Add"} <ha-svg-icon slot="icon" .path="${"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}"></ha-svg-icon> </ha-button> </div> `}},{kind:"get",key:"_items",value:function(){return this.value??[]}},{kind:"method",key:"_addItem",value:async function(){const e=[...this._items,""];this._fireChanged(e),await this.updateComplete;const i=this.shadowRoot?.querySelector("ha-textfield[data-last]");i?.focus()}},{kind:"method",key:"_editItem",value:async function(e){const i=e.target.index,t=[...this._items];t[i]=e.target.value,this._fireChanged(t)}},{kind:"method",key:"_keyDown",value:async function(e){"Enter"===e.key&&(e.stopPropagation(),this._addItem())}},{kind:"method",key:"_removeItem",value:async function(e){const i=e.target.index,t=[...this._items];t.splice(i,1),this._fireChanged(t)}},{kind:"method",key:"_fireChanged",value:function(e){this.value=e,(0,l.B)(this,"value-changed",{value:e})}},{kind:"get",static:!0,key:"styles",value:function(){return[d.Qx,s.iv`.row{margin-bottom:8px}ha-textfield{display:block}ha-icon-button{display:block}ha-button{margin-left:8px;margin-inline-start:8px;margin-inline-end:initial}`]}}]}}),s.oi)},18805:function(e,i,t){var a=t(44249),s=t(57243),o=t(50778);(0,a.Z)([(0,o.Mo)("ha-settings-row")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,reflect:!0})],key:"slim",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"three-line"})],key:"threeLine",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"wrap-heading",reflect:!0})],key:"wrapHeading",value:()=>!1},{kind:"method",key:"render",value:function(){return s.dy` <div class="prefix-wrap"> <slot name="prefix"></slot> <div class="body" ?two-line="${!this.threeLine}" ?three-line="${this.threeLine}"> <slot name="heading"></slot> <div class="secondary"><slot name="description"></slot></div> </div> </div> <div class="content"><slot></slot></div> `}},{kind:"get",static:!0,key:"styles",value:function(){return s.iv`:host{display:flex;padding:0 16px;align-content:normal;align-self:auto;align-items:center}.body{padding-top:8px;padding-bottom:8px;padding-left:0;padding-inline-start:0;padding-right:16px;padding-inline-end:16px;overflow:hidden;display:var(--layout-vertical_-_display,flex);flex-direction:var(--layout-vertical_-_flex-direction,column);justify-content:var(--layout-center-justified_-_justify-content,center);flex:var(--layout-flex_-_flex,1);flex-basis:var(--layout-flex_-_flex-basis,0.000000001px)}.body[three-line]{min-height:var(--paper-item-body-three-line-min-height,88px)}:host(:not([wrap-heading])) body>*{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.body>.secondary{display:block;padding-top:4px;font-family:var(
|
|
--mdc-typography-body2-font-family,
|
|
var(--mdc-typography-font-family, Roboto, sans-serif)
|
|
);-webkit-font-smoothing:antialiased;font-size:var(--mdc-typography-body2-font-size, .875rem);font-weight:var(--mdc-typography-body2-font-weight,400);line-height:normal;color:var(--secondary-text-color)}.body[two-line]{min-height:calc(var(--paper-item-body-two-line-min-height,72px) - 16px);flex:1}.content{display:contents}:host(:not([narrow])) .content{display:var(--settings-row-content-display,flex);justify-content:flex-end;flex:1;padding:16px 0}.content ::slotted(*){width:var(--settings-row-content-width)}:host([narrow]){align-items:normal;flex-direction:column;border-top:1px solid var(--divider-color);padding-bottom:8px}::slotted(ha-switch){padding:16px 0}.secondary{white-space:normal}.prefix-wrap{display:var(--settings-row-prefix-display)}:host([narrow]) .prefix-wrap{display:flex;align-items:center}:host([slim]),:host([slim]) .content,:host([slim]) ::slotted(ha-switch){padding:0}:host([slim]) .body{min-height:0}`}}]}}),s.oi)},89073:function(e,i,t){t.r(i);var a=t(44249),s=(t(92519),t(42179),t(89256),t(24931),t(88463),t(57449),t(19814),t(39527),t(99790),t(13334),t(31622),t(2060),t(57243)),o=t(50778),l=t(91583),d=t(27486),n=t(11297),r=(t(84573),t(13978),t(17949),t(62304),t(44118)),c=(t(41600),t(18805),t(10508),t(70596),t(69181),t(66193)),h=t(88233),u=t(71656);let v=(0,a.Z)(null,(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.SB)()],key:"_name",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_aliases",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_icon",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_level",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_submitting",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_addedAreas",value:()=>new Set},{kind:"field",decorators:[(0,o.SB)()],key:"_removedAreas",value:()=>new Set},{kind:"method",key:"showDialog",value:function(e){this._params=e,this._error=void 0,this._name=this._params.entry?this._params.entry.name:this._params.suggestedName||"",this._aliases=this._params.entry?.aliases||[],this._icon=this._params.entry?.icon||null,this._level=this._params.entry?.level??null,this._addedAreas.clear(),this._removedAreas.clear()}},{kind:"method",key:"closeDialog",value:function(){this._error="",this._params=void 0,this._addedAreas.clear(),this._removedAreas.clear(),(0,n.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"field",key:"_floorAreas",value:()=>(0,d.Z)(((e,i,t,a)=>Object.values(i).filter((i=>(i.floor_id===e?.floor_id||t.has(i.area_id))&&!a.has(i.area_id)))))},{kind:"method",key:"render",value:function(){const e=this._floorAreas(this._params?.entry,this.hass.areas,this._addedAreas,this._removedAreas);if(!this._params)return s.Ld;const i=this._params.entry,t=!this._isNameValid();return s.dy` <ha-dialog open @closed="${this.closeDialog}" .heading="${(0,r.i)(this.hass,i?this.hass.localize("ui.panel.config.floors.editor.update_floor"):this.hass.localize("ui.panel.config.floors.editor.create_floor"))}"> <div> ${this._error?s.dy`<ha-alert alert-type="error">${this._error}</ha-alert>`:""} <div class="form"> ${i?s.dy` <ha-settings-row> <span slot="heading"> ${this.hass.localize("ui.panel.config.floors.editor.floor_id")} </span> <span slot="description">${i.floor_id}</span> </ha-settings-row> `:s.Ld} <ha-textfield .value="${this._name}" @input="${this._nameChanged}" .label="${this.hass.localize("ui.panel.config.floors.editor.name")}" .validationMessage="${this.hass.localize("ui.panel.config.floors.editor.name_required")}" required dialogInitialFocus></ha-textfield> <ha-textfield .value="${this._level}" @input="${this._levelChanged}" .label="${this.hass.localize("ui.panel.config.floors.editor.level")}" type="number"></ha-textfield> <ha-icon-picker .hass="${this.hass}" .value="${this._icon}" @value-changed="${this._iconChanged}" .label="${this.hass.localize("ui.panel.config.areas.editor.icon")}"> ${this._icon?s.Ld:s.dy` <ha-floor-icon slot="fallback" .floor="${{level:this._level}}"></ha-floor-icon> `} </ha-icon-picker> <h3 class="header"> ${this.hass.localize("ui.panel.config.floors.editor.areas_section")} </h3> <p class="description"> ${this.hass.localize("ui.panel.config.floors.editor.areas_description")} </p> ${e.length?s.dy`<ha-chip-set> ${(0,l.r)(e,(e=>e.area_id),(e=>s.dy`<ha-input-chip .area="${e}" @click="${this._openArea}" @remove="${this._removeArea}" .label="${e?.name}"> ${e.icon?s.dy`<ha-icon slot="icon" .icon="${e.icon}"></ha-icon>`:s.dy`<ha-svg-icon slot="icon" .path="${"M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z"}"></ha-svg-icon>`} </ha-input-chip>`))} </ha-chip-set>`:s.Ld} <ha-area-picker no-add .hass="${this.hass}" @value-changed="${this._addArea}" .excludeAreas="${e.map((e=>e.area_id))}" .label="${this.hass.localize("ui.panel.config.floors.editor.add_area")}"></ha-area-picker> <h3 class="header"> ${this.hass.localize("ui.panel.config.floors.editor.aliases_section")} </h3> <p class="description"> ${this.hass.localize("ui.panel.config.floors.editor.aliases_description")} </p> <ha-aliases-editor .hass="${this.hass}" .aliases="${this._aliases}" @value-changed="${this._aliasesChanged}"></ha-aliases-editor> </div> </div> <mwc-button slot="secondaryAction" @click="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </mwc-button> <mwc-button slot="primaryAction" @click="${this._updateEntry}" .disabled="${t||this._submitting}"> ${i?this.hass.localize("ui.common.save"):this.hass.localize("ui.common.create")} </mwc-button> </ha-dialog> `}},{kind:"method",key:"_openArea",value:function(e){const i=e.target.area;(0,h.E)(this,{entry:i,updateEntry:e=>(0,u.IO)(this.hass,i.area_id,e)})}},{kind:"method",key:"_removeArea",value:function(e){const i=e.target.area.area_id;if(this._addedAreas.has(i))return this._addedAreas.delete(i),void(this._addedAreas=new Set(this._addedAreas));this._removedAreas.add(i),this._removedAreas=new Set(this._removedAreas)}},{kind:"method",key:"_addArea",value:function(e){const i=e.detail.value;if(i){if(e.target.value="",this._removedAreas.has(i))return this._removedAreas.delete(i),void(this._removedAreas=new Set(this._removedAreas));this._addedAreas.add(i),this._addedAreas=new Set(this._addedAreas)}}},{kind:"method",key:"_isNameValid",value:function(){return""!==this._name.trim()}},{kind:"method",key:"_nameChanged",value:function(e){this._error=void 0,this._name=e.target.value}},{kind:"method",key:"_levelChanged",value:function(e){this._error=void 0,this._level=""===e.target.value?null:Number(e.target.value)}},{kind:"method",key:"_iconChanged",value:function(e){this._error=void 0,this._icon=e.detail.value}},{kind:"method",key:"_updateEntry",value:async function(){this._submitting=!0;const e=!this._params.entry;try{const i={name:this._name.trim(),icon:this._icon||(e?void 0:null),level:this._level,aliases:this._aliases};e?await this._params.createEntry(i,this._addedAreas):await this._params.updateEntry(i,this._addedAreas,this._removedAreas),this.closeDialog()}catch(e){this._error=e.message||this.hass.localize("ui.panel.config.floors.editor.unknown_error")}finally{this._submitting=!1}}},{kind:"method",key:"_aliasesChanged",value:function(e){this._aliases=e.detail.value}},{kind:"get",static:!0,key:"styles",value:function(){return[c.Qx,c.yu,s.iv`ha-textfield{display:block;margin-bottom:16px}ha-floor-icon{color:var(--secondary-text-color)}ha-chip-set{margin-bottom:8px}`]}}]}}),s.oi);customElements.define("dialog-floor-registry-detail",v)},88233:function(e,i,t){t.d(i,{E:function(){return o}});var a=t(11297);const s=()=>Promise.all([t.e("1552"),t.e("8006"),t.e("6343"),t.e("8963"),t.e("1854"),t.e("9616")]).then(t.bind(t,40600)),o=(e,i)=>{(0,a.B)(e,"show-dialog",{dialogTag:"dialog-area-registry-detail",dialogImport:s,dialogParams:i})}},87319:function(e,i,t){var a=t(9065),s=t(50778),o=t(65703),l=t(46289);let d=class extends o.K{};d.styles=[l.W],d=(0,a.gn)([(0,s.Mo)("mwc-list-item")],d)}};
|
|
//# sourceMappingURL=1244.e67e8a4b61e2436d.js.map
|