iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 5.13 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[42364],{94039:function(t,i,o){o.a(t,async function(t,e){try{o.r(i),o.d(i,{HuiDialogEditViewFooter:function(){return b}});o(3362),o(62953);var a=o(40445),s=o(5124),n=o(67576),h=o(1087),d=o(19459),l=o(18350),r=o(72554),c=(o(93444),o(29823)),g=(o(70947),o(65829)),_=o(10763),m=o(65063),p=o(14503),u=o(15401),f=t([l,r,c,g,_,u]);[l,r,c,g,_,u]=f.then?(await f)():f;let v,y,w,C,$=t=>t;const M="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",A="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";class b extends s.WF{updated(t){if(this._yamlMode&&t.has("_yamlMode")){var i;const t=Object.assign({},this._config);null===(i=this._editor)||void 0===i||i.setValue(t)}}showDialog(t){this._params=t,this._dirty=!1,this._config=this._params.config,this._open=!0}closeDialog(){this._open=!1}_dialogClosed(){this._params=void 0,this._config=void 0,this._yamlMode=!1,this._dirty=!1,this._saving=!1,(0,h.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params||!this.hass)return s.s6;let t;t=this._yamlMode?(0,s.qy)(v||(v=$` <ha-yaml-editor autofocus -changed="${0}"></ha-yaml-editor> `),this._viewYamlChanged):(0,s.qy)(y||(y=$` <hui-view-footer-settings-editor .hass="${0}" .config="${0}" -changed="${0}"></hui-view-footer-settings-editor> `),this.hass,this._config,this._configChanged);const i=this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.header");return(0,s.qy)(w||(w=$` <ha-dialog .open="${0}" header-title="${0}" width="medium" ="${0}" class="${0}"> <ha-dropdown slot="headerActionItems" placement="bottom-end" -select="${0}"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}"></ha-icon-button> <ha-dropdown-item value="toggle-mode"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </ha-dropdown-item> </ha-dropdown> ${0} <ha-dialog-footer slot="footer"> <ha-button slot="primaryAction" .disabled="${0}" ="${0}" .loading="${0}"> ${0}</ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,i,this._dialogClosed,this._yamlMode?"yaml-mode":"",this._handleAction,this.hass.localize("ui.common.menu"),M,this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.edit_"+(this._yamlMode?"ui":"yaml")),A,t,!this._config||!this._dirty,this._save,this._saving,this.hass.localize("ui.common.save"))}async _handleAction(t){"toggle-mode"===t.detail.item.value&&(this._yamlMode=!this._yamlMode)}_configChanged(t){t.detail&&t.detail.config&&!(0,d.b)(this._config,t.detail.config)&&(this._config=t.detail.config,this._dirty=!0)}_viewYamlChanged(t){t.stopPropagation(),t.detail.isValid&&(this._config=t.detail.value,this._dirty=!0)}async _save(){if(this._params&&this._config){this._saving=!0;try{await this._params.saveConfig(this._config),this.closeDialog()}catch(t){(0,m.showAlertDialog)(this,{text:`${this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.saving_failed")}: ${t.message}`})}finally{this._saving=!1}}}static get styles(){return[p.nA,p.kO,(0,s.AH)(C||(C=$`ha-dialog.yaml-mode{--dialog-content-padding:0}`))]}constructor(...t){super(...t),this._saving=!1,this._dirty=!1,this._yamlMode=!1,this._open=!1}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],b.prototype,"_params",void 0),(0,a.Cg)([(0,n.wk)()],b.prototype,"_config",void 0),(0,a.Cg)([(0,n.wk)()],b.prototype,"_saving",void 0),(0,a.Cg)([(0,n.wk)()],b.prototype,"_dirty",void 0),(0,a.Cg)([(0,n.wk)()],b.prototype,"_yamlMode",void 0),(0,a.Cg)([(0,n.P)("ha-yaml-editor")],b.prototype,"_editor",void 0),(0,a.Cg)([(0,n.wk)()],b.prototype,"_open",void 0),b=(0,a.Cg)([(0,n.EM)("hui-dialog-edit-view-footer")],b),e()}catch(v){e(v)}})},15401:function(t,i,o){o.a(t,async function(t,i){try{o(62953);var e=o(40445),a=o(5124),s=o(67576),n=o(1087),h=o(52763),d=(o(91984),t([h]));h=(d.then?(await d)():d)[0];let l,r=t=>t;const c=[{name:"max_width",selector:{number:{min:100,max:1600,step:10,unit_of_measurement:"px"}}}];class g extends a.WF{render(){var t;const i={max_width:(null===(t=this.config)||void 0===t?void 0:t.max_width)||600};return(0,a.qy)(l||(l=r` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" -changed="${0}"></ha-form> `),this.hass,i,c,this._computeLabel,this._valueChanged)}_valueChanged(t){t.stopPropagation();const i=t.detail.value,o=Object.assign(Object.assign({},this.config),i);(0,n.r)(this,"config-changed",{config:o})}constructor(...t){super(...t),this._computeLabel=t=>this.hass.localize(`ui.panel.lovelace.editor.edit_view_footer.settings.${t.name}`)}}(0,e.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,e.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"config",void 0),g=(0,e.Cg)([(0,s.EM)("hui-view-footer-settings-editor")],g),i()}catch(l){i(l)}})}}]);