iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 7.34 kB
JavaScript
export const __rspack_esm_id=87448;export const __rspack_esm_ids=[87448];export const __webpack_modules__={45100(t,e,o){o.a(t,async function(t,i){try{o.r(e),o.d(e,{HaIconButtonPrev:()=>d});var n=o(62826),a=o(5124),s=o(22441),c=o(63091),r=o(26300),p=t([r]);r=(p.then?(await p)():p)[0];const h="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",l="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z";class d extends a.WF{render(){return a.qy` <ha-icon-button .disabled="${this.disabled}" .label="${this.label||this.hass?.localize("ui.common.back")||"Back"}" .path="${this._icon}" .href="${this.href}" .target="${this.target}" .rel="${this.rel}" .download="${this.download}"></ha-icon-button> `}constructor(...t){super(...t),this.disabled=!1,this._icon="rtl"===c.G.document.dir?l:h}}(0,n.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,n.Cg)([(0,s.MZ)({type:Boolean})],d.prototype,"disabled",void 0),(0,n.Cg)([(0,s.MZ)()],d.prototype,"label",void 0),(0,n.Cg)([(0,s.MZ)()],d.prototype,"href",void 0),(0,n.Cg)([(0,s.MZ)()],d.prototype,"target",void 0),(0,n.Cg)([(0,s.MZ)()],d.prototype,"rel",void 0),(0,n.Cg)([(0,s.MZ)()],d.prototype,"download",void 0),(0,n.Cg)([(0,s.wk)()],d.prototype,"_icon",void 0),d=(0,n.Cg)([(0,s.EM)("ha-icon-button-prev")],d),i()}catch(t){i(t)}})},6891(t,e,o){o.a(t,async function(t,i){try{o.r(e);var n=o(62826),a=o(5124),s=o(22441),c=o(1087),r=o(63130),p=o(18350),h=o(72554),l=(o(93444),o(26300)),d=o(45100),y=(o(83892),o(31420)),_=o(14503),g=o(81619),u=t([p,h,l,d,y]);[p,h,l,d,y]=u.then?(await u)():u;const b="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",m="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",k="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",v=["current","new","done"];class w extends a.WF{showDialog(t){this._params=t,this._step=v[0],this._open=!0,this._newEncryptionKey=(0,y.cq)()}closeDialog(){return this._params.cancel&&this._params.cancel(),this._open&&(0,c.r)(this,"dialog-closed",{dialog:this.localName}),this._open=!1,this._step=void 0,this._params=void 0,this._newEncryptionKey=void 0,!0}_done(){this._params?.submit(!0),this.closeDialog()}_previousStep(){const t=v.indexOf(this._step);0!==t&&(this._step=v[t-1])}_nextStep(){const t=v.indexOf(this._step);t!==v.length-1&&(this._step=v[t+1])}render(){const t="current"===this._step||"new"===this._step?this.hass.localize(`ui.panel.config.backup.dialogs.change_encryption_key.${this._step}.title`):"";return a.qy` <ha-dialog .open="${this._open}" header-title="${t}" prevent-scrim-close ="${this.closeDialog}"> ${"new"===this._step?a.qy` <ha-icon-button-prev slot="headerNavigationIcon" ="${this._previousStep}"></ha-icon-button-prev> `:a.qy` <ha-icon-button slot="headerNavigationIcon" data-dialog="close" .label="${this.hass.localize("ui.common.close")}" .path="${b}"></ha-icon-button> `} ${this._renderStepContent()} <ha-dialog-footer slot="footer"> ${"current"===this._step?a.qy` <ha-button slot="primaryAction" ="${this._nextStep}"> ${this.hass.localize("ui.common.next")} </ha-button> `:"new"===this._step?a.qy` <ha-button slot="primaryAction" ="${this._submit}" .disabled="${!this._newEncryptionKey}" variant="danger"> ${this.hass.localize("ui.panel.config.backup.dialogs.change_encryption_key.actions.change")} </ha-button> `:a.qy` <ha-button slot="primaryAction" ="${this._done}"> ${this.hass.localize("ui.panel.config.backup.dialogs.change_encryption_key.actions.done")} </ha-button> `} </ha-dialog-footer> </ha-dialog> `}_renderStepContent(){switch(this._step){case"current":return a.qy` <p> ${this.hass.localize("ui.panel.config.backup.dialogs.change_encryption_key.current.description")} </p> <div class="encryption-key"> <p>${this._params?.currentKey}</p> <ha-icon-button .path="${m}" ="${this._copyOldKeyToClipboard}"></ha-icon-button> </div> <ha-row-item> <span slot="headline"> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_old_emergency_kit")} </span> <span slot="supporting-text"> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_old_emergency_kit_description")} </span> <ha-button slot="end" appearance="filled" ="${this._downloadOld}"> <ha-svg-icon .path="${k}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_old_emergency_kit_action")} </ha-button> </ha-row-item> `;case"new":return a.qy` <p> ${this.hass.localize("ui.panel.config.backup.dialogs.change_encryption_key.new.description")} </p> <div class="encryption-key"> <p>${this._newEncryptionKey}</p> <ha-icon-button .path="${m}" ="${this._copyKeyToClipboard}"></ha-icon-button> </div> <ha-row-item> <span slot="headline"> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_emergency_kit")} </span> <span slot="supporting-text"> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_emergency_kit_description")} </span> <ha-button slot="end" appearance="filled" ="${this._downloadNew}"> <ha-svg-icon .path="${k}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_emergency_kit_action")} </ha-button> </ha-row-item> `;case"done":return a.qy` <div class="done"> <img src="/static/images/voice-assistant/hi.png" alt="Casita ioBroker logo"> <h1> ${this.hass.localize("ui.panel.config.backup.dialogs.change_encryption_key.done.title")} </h1> </div> `}return a.s6}async _copyKeyToClipboard(){await(0,r.l)(this._newEncryptionKey,this._copyContainer),(0,g.P)(this,{message:this.hass.localize("ui.common.copied_clipboard")})}async _copyOldKeyToClipboard(){this._params?.currentKey&&(await(0,r.l)(this._params.currentKey,this._copyContainer),(0,g.P)(this,{message:this.hass.localize("ui.common.copied_clipboard")}))}_downloadOld(){this._params?.currentKey&&(0,y.Sx)(this.hass,this._params.currentKey,"old")}_downloadNew(){this._newEncryptionKey&&(0,y.Sx)(this.hass,this._newEncryptionKey)}async _submit(){this._newEncryptionKey&&(this._params.saveKey(this._newEncryptionKey),this._nextStep())}static get styles(){return[_.RF,_.nA,a.AH`ha-dialog{--dialog-content-padding:var(--ha-space-2) var(--ha-space-6)}ha-row-item{--ha-row-item-padding-inline:0}.encryption-key{border:1px solid var(--divider-color);background-color:var(--primary-background-color);border-radius:var(--ha-border-radius-md);padding:16px;display:flex;flex-direction:row;align-items:center;gap:var(--ha-space-6)}.encryption-key p{margin:0;flex:1;font-size:var(--ha-font-size-xl);font-family:var(--ha-font-family-code);font-style:normal;font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);text-align:center}.encryption-key ha-icon-button{flex:none;margin:-16px}p{margin-top:0}.done{text-align:center}`]}constructor(...t){super(...t),this._open=!1}}(0,n.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,n.Cg)([(0,s.wk)()],w.prototype,"_open",void 0),(0,n.Cg)([(0,s.wk)()],w.prototype,"_step",void 0),(0,n.Cg)([(0,s.wk)()],w.prototype,"_params",void 0),(0,n.Cg)([(0,s.wk)()],w.prototype,"_newEncryptionKey",void 0),(0,n.Cg)([(0,s.P)("div")],w.prototype,"_copyContainer",void 0),w=(0,n.Cg)([(0,s.EM)("ha-dialog-change-backup-encryption-key")],w),i()}catch(t){i(t)}})}};