iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 6.19 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[91793],{82632:function(i,a,t){t.a(i,async function(i,o){try{t.r(a),t.d(a,{HuiConditionalCardEditor:function(){return j}});t(62953);var e=t(40445),s=t(34271),n=t(5124),d=t(67576),c=t(63533),r=t(93905),h=t(1087),l=t(18350),g=(t(67094),t(66289)),_=(t(62647),t(97962)),p=t(81797),u=t(13898),b=t(30461),v=t(91322),f=t(84698),H=t(7382),C=i([l,g,_,p,u,b,v]);[l,g,_,p,u,b,v]=C.then?(await C)():C;let V,M,y,m,$,A,k=i=>i;const E="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",w="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",z="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z",I=(0,c.kp)(f.H,(0,c.Ik)({card:(0,c.bz)(),conditions:(0,c.lq)((0,c.YO)((0,c.bz)()))}));class j extends n.WF{setConfig(i){(0,c.vA)(i,I),this._config=i}focusYamlEditor(){var i;null===(i=this._cardEditorEl)||void 0===i||i.focusYamlEditor()}render(){var i;if(!this.hass||!this._config)return n.s6;const a=!this._cardEditorEl||this._GUImode;return(0,n.qy)(V||(V=k` <ha-tab-group -tab-show="${0}"> <ha-tab-group-tab slot="nav" panel="conditions" .active="${0}"> ${0} </ha-tab-group-tab> <ha-tab-group-tab slot="nav" panel="card" .active="${0}"> ${0} </ha-tab-group-tab> </ha-tab-group> ${0} `),this._selectTab,!this._cardTab,this.hass.localize("ui.panel.lovelace.editor.card.conditional.conditions"),this._cardTab,this.hass.localize("ui.panel.lovelace.editor.card.conditional.card"),this._cardTab?(0,n.qy)(M||(M=k` <div class="card"> ${0} </div> `),void 0!==this._config.card.type?(0,n.qy)(y||(y=k` <div class="card-options"> <ha-icon-button class="gui-mode-button" ="${0}" .disabled="${0}" .label="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .label="${0}" .path="${0}" ="${0}"></ha-icon-button> <ha-button appearance="plain" size="small" ="${0}">${0}</ha-button> </div> <hui-card-element-editor .hass="${0}" .value="${0}" .lovelace="${0}" -changed="${0}" -changed="${0}"></hui-card-element-editor> `),this._toggleMode,!this._guiModeAvailable,this.hass.localize(a?"ui.panel.lovelace.editor.edit_card.show_code_editor":"ui.panel.lovelace.editor.edit_card.show_visual_editor"),a?E:z,this.hass.localize("ui.panel.lovelace.editor.edit_card.copy"),w,this._handleCopyCard,this._handleReplaceCard,this.hass.localize("ui.panel.lovelace.editor.card.conditional.change_type"),this.hass,this._config.card,this.lovelace,this._handleCardChanged,this._handleGUIModeChanged):(0,n.qy)(m||(m=k` <hui-card-picker .hass="${0}" .lovelace="${0}" -changed="${0}"></hui-card-picker> `),this.hass,this.lovelace,this._handleCardPicked)):(0,n.qy)($||($=k` <ha-visibility-status .hass="${0}" .conditions="${0}"></ha-visibility-status> <ha-card-conditions-editor .hass="${0}" .conditions="${0}" -changed="${0}"> </ha-card-conditions-editor> `),this.hass,null!==(i=this._config.conditions)&&void 0!==i?i:[],this.hass,this._config.conditions,this._conditionChanged))}_selectTab(i){this._cardTab="card"===i.detail.name}_toggleMode(){var i;null===(i=this._cardEditorEl)||void 0===i||i.toggleMode()}_setMode(i){this._GUImode=i,this._cardEditorEl&&(this._cardEditorEl.GUImode=i)}_handleGUIModeChanged(i){i.stopPropagation(),this._GUImode=i.detail.guiMode,this._guiModeAvailable=i.detail.guiModeAvailable}_handleCardPicked(i){i.stopPropagation(),this._config&&(this._setMode(!0),this._guiModeAvailable=!0,this._config=Object.assign(Object.assign({},this._config),{},{card:i.detail.config}),(0,h.r)(this,"config-changed",{config:this._config}))}_handleCopyCard(){this._config&&(this._clipboard=(0,s.A)(this._config.card))}_handleCardChanged(i){i.stopPropagation(),this._config&&(this._config=Object.assign(Object.assign({},this._config),{},{card:i.detail.config}),this._guiModeAvailable=i.detail.guiModeAvailable,(0,h.r)(this,"config-changed",{config:this._config}))}_handleReplaceCard(){this._config&&(this._config=Object.assign(Object.assign({},this._config),{},{card:{}}),(0,h.r)(this,"config-changed",{config:this._config}))}_conditionChanged(i){if(i.stopPropagation(),!this._config)return;const a=i.detail.value;this._config=Object.assign(Object.assign({},this._config),{},{conditions:a}),(0,h.r)(this,"config-changed",{config:this._config})}static get styles(){return[H.U,(0,n.AH)(A||(A=k`ha-tab-group-tab{flex:1}ha-tab-group-tab::part(base){width:100%;justify-content:center}ha-visibility-status{margin-top:var(--ha-space-3);margin-bottom:var(--ha-space-3)}.card{margin-top:8px;border:1px solid var(--divider-color);padding:12px} (max-width:450px){.card,.condition{margin:8px -12px 0}}.card .card-options{display:flex;justify-content:flex-end;width:100%}.card-options{align-items:center}.gui-mode-button{margin-right:auto;margin-inline-end:auto;margin-inline-start:initial}`))]}constructor(...i){super(...i),this._GUImode=!0,this._guiModeAvailable=!0,this._cardTab=!1}}(0,e.Cg)([(0,d.MZ)({attribute:!1})],j.prototype,"hass",void 0),(0,e.Cg)([(0,d.MZ)({attribute:!1})],j.prototype,"lovelace",void 0),(0,e.Cg)([(0,r.I)({key:"dashboardCardClipboard",state:!1,subscribe:!1,storage:"sessionStorage"})],j.prototype,"_clipboard",void 0),(0,e.Cg)([(0,d.wk)()],j.prototype,"_config",void 0),(0,e.Cg)([(0,d.wk)()],j.prototype,"_GUImode",void 0),(0,e.Cg)([(0,d.wk)()],j.prototype,"_guiModeAvailable",void 0),(0,e.Cg)([(0,d.wk)()],j.prototype,"_cardTab",void 0),(0,e.Cg)([(0,d.P)("hui-card-element-editor")],j.prototype,"_cardEditorEl",void 0),j=(0,e.Cg)([(0,d.EM)("hui-conditional-card-editor")],j),o()}catch(V){o(V)}})},84698:function(i,a,t){t.d(a,{H:function(){return e}});var o=t(63533);const e=(0,o.Ik)({type:(0,o.Yj)(),view_layout:(0,o.bz)(),layout_options:(0,o.bz)(),grid_options:(0,o.bz)(),visibility:(0,o.bz)(),disabled:(0,o.lq)((0,o.zM)())})}}]);