UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 6.75 kB
export const __rspack_esm_id=79521;export const __rspack_esm_ids=[79521];export const __webpack_modules__={31580(e,a,s){s.d(a,{J8:()=>t,Rr:()=>r,b9:()=>i,iV:()=>o});const i=e=>{let a=e;return"string"==typeof e&&(a=parseInt(e,16)),"0x"+a.toString(16).padStart(4,"0")},t=(e,a)=>{const s=e.user_given_name?e.user_given_name:e.name,i=a.user_given_name?a.user_given_name:a.name;return s.localeCompare(i)},o=(e,a)=>{const s=e.name,i=a.name;return s.localeCompare(i)},r=e=>`${e.name} (Endpoint id: ${e.endpoint_id}, Id: ${i(e.id)}, Type: ${e.type})`},13843(e,a,s){s.d(a,{C:()=>o});var i=s(1087);const t=()=>s.e(56740).then(s.bind(s,81199)),o=(e,a)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-zha-add-group-members",dialogImport:t,dialogParams:a})}},80216(e,a,s){s.a(e,async function(e,i){try{s.r(a),s.d(a,{ZHAGroupPage:()=>y});s(18111),s(61701),s(46058);var t=s(62826),o=s(5124),r=s(22441),n=s(91926),h=s(18350),c=(s(76776),s(26300)),p=(s(67094),s(84621)),l=s(28794),d=s(81310),m=s(31580),g=s(92834),u=s(13843),v=e([h,c,l,d,g]);[h,c,l,d,g]=v.then?(await v)():v;const _="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",b="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class y extends o.WF{connectedCallback(){super.connectedCallback(),this.hass&&this._firstUpdatedCalled&&this._fetchData()}disconnectedCallback(){super.disconnectedCallback(),this._processingRemove=!1,this._selectedDevicesToRemove=[]}firstUpdated(e){super.firstUpdated(e),this.hass&&this._fetchData(),this._firstUpdatedCalled=!0}render(){return this.group?o.qy` <hass-subpage .hass="${this.hass}" .narrow="${this.narrow}" .header="${this.group.name}" back-path="/config/zha/groups"> <ha-icon-button slot="toolbar-icon" .path="${_}" @click="${this._deleteGroup}" .label="${this.hass.localize("ui.panel.config.zha.groups.delete")}"></ha-icon-button> <div class="container"> <ha-card> <div class="card-header"> ${this.hass.localize("ui.panel.config.zha.groups.group_info")} </div> <div class="summary-grid"> <div> <span class="summary-label">${this.hass.localize("ui.common.name")}</span> <span class="summary-value">${this.group.name}</span> </div> <div> <span class="summary-label">${this.hass.localize("ui.panel.config.zha.groups.group_id")}</span> <span class="summary-value">${(0,m.b9)(this.group.group_id)}</span> </div> <div> <span class="summary-label">${this.hass.localize("ui.panel.config.zha.groups.members")}</span> <span class="summary-value">${this.group.members.length}</span> </div> </div> </ha-card> <div class="members-section"> <h2>${this.hass.localize("ui.panel.config.zha.groups.members")}</h2> ${this.group.members.length?o.qy` <zha-device-endpoint-list id="removeMembers" scrollable show-device-link selectable .deviceEndpoints="${this.group.members}" .narrow="${this.narrow}" .emptyText="${this.hass.localize("ui.panel.config.zha.groups.no_members")}" @selection-changed="${this._handleRemoveSelectionChanged}"></zha-device-endpoint-list> `:o.qy` <ha-card class="empty-card"> ${this.hass.localize("ui.panel.config.zha.groups.no_members")} </ha-card> `} <div class="buttons"> ${this.group.members.length?o.qy` <ha-button appearance="plain" variant="danger" .disabled="${!this._selectedDevicesToRemove.length||this._processingRemove}" @click="${this._removeMembersFromGroup}" .loading="${this._processingRemove}"> ${this.hass.localize("ui.panel.config.zha.groups.remove_members")} </ha-button> `:o.s6} <ha-button @click="${this._showAddMembersDialog}"> <ha-svg-icon slot="start" .path="${b}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.zha.groups.add_members")} </ha-button> </div> </div> </div> </hass-subpage> `:o.qy` <hass-error-screen .hass="${this.hass}" .error="${this.hass.localize("ui.panel.config.zha.groups.group_not_found")}"></hass-error-screen> `}_showAddMembersDialog(){(0,u.C)(this,{groupId:this.groupId,groupName:this.group.name,devicesAddedCallback:e=>{this.group=e,this._selectedDevicesToRemove=[],this._zhaRemoveMembersList?.clearSelection()}})}async _fetchData(){null!==this.groupId&&void 0!==this.groupId&&(this.group=await(0,p.Ui)(this.hass,this.groupId))}_handleRemoveSelectionChanged(e){this._selectedDevicesToRemove=e.detail.value}async _removeMembersFromGroup(){this._processingRemove=!0;const e=this._selectedDevicesToRemove.map(e=>{const a=e.split("_");return{ieee:a[0],endpoint_id:a[1]}});this.group=await(0,p.tv)(this.hass,this.groupId,e),this._selectedDevicesToRemove=[],this._zhaRemoveMembersList.clearSelection(),this._processingRemove=!1}async _deleteGroup(){await(0,p.rv)(this.hass,[this.groupId]),(0,n.oo)("/config/zha/groups",{replace:!0})}static get styles(){return[o.AH`hass-subpage{--app-header-text-color:var(--sidebar-icon-color)}.container{box-sizing:border-box;max-width:720px;margin:0 auto;padding:var(--ha-space-4) var(--ha-space-4) calc(var(--ha-space-20) + var(--safe-area-inset-bottom,0px))}.card-header{padding:var(--ha-space-4) var(--ha-space-4) 0;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-condensed)}.summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--ha-space-4);padding:var(--ha-space-4)}.summary-label,.summary-value{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.summary-label{color:var(--secondary-text-color);font-size:var(--ha-font-size-s);line-height:var(--ha-line-height-condensed)}.summary-value{margin-top:var(--ha-space-1);font-size:var(--ha-font-size-l);line-height:var(--ha-line-height-condensed)}.members-section{margin-top:var(--ha-space-6)}h2{margin:0 0 var(--ha-space-3);font-size:var(--ha-font-size-2xl);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-condensed)}.buttons{display:flex;gap:var(--ha-space-2);justify-content:flex-end;padding:var(--ha-space-4) 0 0}.empty-card{padding:var(--ha-space-6);color:var(--secondary-text-color);text-align:center}@media (max-width:600px){.summary-grid{grid-template-columns:1fr;gap:var(--ha-space-2)}}`]}constructor(...e){super(...e),this.narrow=!1,this.isWide=!1,this._processingRemove=!1,this._selectedDevicesToRemove=[],this._firstUpdatedCalled=!1}}(0,t.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,t.Cg)([(0,r.MZ)({type:Object})],y.prototype,"group",void 0),(0,t.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"groupId",void 0),(0,t.Cg)([(0,r.MZ)({type:Boolean})],y.prototype,"narrow",void 0),(0,t.Cg)([(0,r.MZ)({attribute:"is-wide",type:Boolean})],y.prototype,"isWide",void 0),(0,t.Cg)([(0,r.wk)()],y.prototype,"_processingRemove",void 0),(0,t.Cg)([(0,r.wk)()],y.prototype,"_selectedDevicesToRemove",void 0),(0,t.Cg)([(0,r.P)("#removeMembers")],y.prototype,"_zhaRemoveMembersList",void 0),y=(0,t.Cg)([(0,r.EM)("zha-group-page")],y),i()}catch(e){i(e)}})}};