homeassistant/custom_components/hacs/hacs_frontend_experimental/frontend_latest/2722.wFE90sKscgY.js

2 lines
11 KiB
JavaScript
Raw Permalink Normal View History

2025-01-10 21:08:35 -08:00
export const id=2722;export const ids=[2722];export const modules={27056:(e,i,t)=>{var s=t(309),d=t(5095),a=t(95260),l=t(14516),n=t(18394),r=t(36655),o=t(28858),c=t(1913),u=t(16061);t(16591),t(90532);const v=e=>d.dy`<ha-list-item .twoline="${!!e.area}"> <span>${e.name}</span> <span slot="secondary">${e.area}</span> </ha-list-item>`;(0,s.Z)([(0,a.Mo)("ha-device-picker")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Array,attribute:"exclude-devices"})],key:"excludeDevices",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,a.SB)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,a.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_init",value:()=>!1},{kind:"field",key:"_getDevices",value(){return(0,l.Z)(((e,i,t,s,d,a,l,n,c)=>{if(!e.length)return[{id:"no_devices",area:"",name:this.hass.localize("ui.components.device-picker.no_devices"),strings:[]}];let v={};(s||d||a||n)&&(v=(0,u.R6)(t));let h=e.filter((e=>e.id===this.value||!e.disabled_by));s&&(h=h.filter((e=>{const i=v[e.id];return!(!i||!i.length)&&v[e.id].some((e=>s.includes((0,r.M)(e.entity_id))))}))),d&&(h=h.filter((e=>{const i=v[e.id];return!i||!i.length||t.every((e=>!d.includes((0,r.M)(e.entity_id))))}))),c&&(h=h.filter((e=>!c.includes(e.id)))),a&&(h=h.filter((e=>{const i=v[e.id];return!(!i||!i.length)&&v[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&(i.attributes.device_class&&a.includes(i.attributes.device_class))}))}))),n&&(h=h.filter((e=>{const i=v[e.id];return!(!i||!i.length)&&i.some((e=>{const i=this.hass.states[e.entity_id];return!!i&&n(i)}))}))),l&&(h=h.filter((e=>e.id===this.value||l(e))));const k=h.map((e=>{const t=(0,u.jL)(e,this.hass,v[e.id]);return{id:e.id,name:t,area:e.area_id&&i[e.area_id]?i[e.area_id].name:this.hass.localize("ui.components.device-picker.no_area"),strings:[t||""]}}));return k.length?1===k.length?k:k.sort(((e,i)=>(0,o.$)(e.name||"",i.name||"",this.hass.locale.language))):[{id:"no_devices",area:"",name:this.hass.localize("ui.components.device-picker.no_match"),strings:[]}]}))}},{kind:"method",key:"open",value:async function(){var e;await this.updateComplete,await(null===(e=this.comboBox)||void 0===e?void 0:e.open())}},{kind:"method",key:"focus",value:async function(){var e;await this.updateComplete,await(null===(e=this.comboBox)||void 0===e?void 0:e.focus())}},{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._getDevices(Object.values(this.hass.devices),this.hass.areas,Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeDevices);this.comboBox.items=e,this.comboBox.filteredItems=e}}},{kind:"method",key:"render",value:function(){return d.dy` <ha-combo-box .hass="${this.hass}" .label="${void 0===this.label&&this.hass?this.hass.localize("ui.components.device-picker.device"):this.label}" .value="${this._value}" .helper="${this.helper}" .renderer="${v}" .disabled="${this.disabled}" .required="${this.required}" item-id-path="id" i
//# sourceMappingURL=2722.wFE90sKscgY.js.map