UNPKG

iobroker.lovelace

Version:

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

2 lines 9.89 kB
/*! For license information please see 93934.9c7ba2818b245ce5.js.LICENSE.txt */ "use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[93934],{24790:function(t,e,o){o.d(e,{F:function(){return a},r:function(){return s}});o(18111),o(13579),o(27495);const i=/{%|{{/,a=t=>i.test(t),s=t=>{if(!t)return!1;if("string"==typeof t)return a(t);if("object"==typeof t){return(Array.isArray(t)?t:Object.values(t)).some(t=>t&&s(t))}return!1}},89865:function(t,e,o){o.a(t,async function(t,e){try{o(18111),o(61701),o(62953);var i=o(40445),a=(o(22395),o(5124)),s=o(67576),r=o(1087),n=o(18350),c=(o(67094),t([n]));n=(c.then?(await c)():c)[0];let l,h,u,d,v=t=>t;class p extends a.WF{render(){return(0,a.qy)(l||(l=v` <wa-button-group childSelector="ha-button"> ${0} </wa-button-group> `),this.buttons.map(t=>(0,a.qy)(h||(h=v`<ha-button iconTag="ha-svg-icon" class="icon" .variant="${0}" .size="${0}" .value="${0}" @click="${0}" .title="${0}" .appearance="${0}"> ${0} </ha-button>`),this.active===t.value&&this.activeVariant?this.activeVariant:this.variant,this.size,t.value,this._handleClick,t.label,this.active===t.value?"accent":"filled",t.iconPath?(0,a.qy)(u||(u=v`<ha-svg-icon aria-label="${0}" .path="${0}"></ha-svg-icon>`),t.label,t.iconPath):t.label)))}_handleClick(t){this.active=t.currentTarget.value,(0,r.r)(this,"value-changed",{value:this.active})}constructor(...t){super(...t),this.size="medium",this.nowrap=!1,this.fullWidth=!1,this.variant="brand"}}p.styles=(0,a.AH)(d||(d=v`:host{--mdc-icon-size:var(--button-toggle-icon-size, 20px)}:host([no-wrap]) wa-button-group::part(base){flex-wrap:nowrap}wa-button-group{padding:var(--ha-button-toggle-group-padding)}:host([full-width]) wa-button-group,:host([full-width]) wa-button-group::part(base){width:100%}:host([full-width]) ha-button{flex:1}`)),(0,i.Cg)([(0,s.MZ)({attribute:!1})],p.prototype,"buttons",void 0),(0,i.Cg)([(0,s.MZ)()],p.prototype,"active",void 0),(0,i.Cg)([(0,s.MZ)({reflect:!0})],p.prototype,"size",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0,attribute:"no-wrap"})],p.prototype,"nowrap",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0,attribute:"full-width"})],p.prototype,"fullWidth",void 0),(0,i.Cg)([(0,s.MZ)()],p.prototype,"variant",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"active-variant"})],p.prototype,"activeVariant",void 0),p=(0,i.Cg)([(0,s.EM)("ha-button-toggle-group")],p),e()}catch(l){e(l)}})},58141:function(t,e,o){o.a(t,async function(t,i){try{o.r(e),o.d(e,{HaChooseSelector:function(){return b}});o(74423),o(18111),o(61701),o(62953);var a=o(40445),s=o(5124),r=o(67576),n=o(22786),c=o(1087),l=o(24790),h=o(89865),u=(o(11399),t([h]));h=(u.then?(await u)():u)[0];let d,v,p=t=>t;class b extends s.WF{willUpdate(t){var e,o;!t.has("selector")||this._activeChoice&&this._activeChoice in this.selector.choose.choices||this._setActiveChoice(),t.has("value")&&null!==(e=t.get("value"))&&void 0!==e&&e.active_choice&&(null===(o=t.get("value"))||void 0===o?void 0:o.active_choice)!==this._activeChoice&&this._setActiveChoice()}render(){if(!this._activeChoice)return s.s6;const t=this._selector(this._activeChoice),e=this._value(this._activeChoice);return(0,s.qy)(d||(d=p`<div class="multi-header"> <span>${0}${0}</span> <ha-button-toggle-group size="small" .buttons="${0}" .active="${0}" @value-changed="${0}"></ha-button-toggle-group> </div> <ha-selector .hass="${0}" .selector="${0}" .value="${0}" .disabled="${0}" .required="${0}" @value-changed="${0}" .helper="${0}"></ha-selector>`),this.label,this.required?"*":"",this._toggleButtons(this.selector.choose.choices,this.selector.choose.translation_key,this.hass.localize),this._activeChoice,this._choiceChanged,this.hass,t,e,this.disabled,this.required,this._handleValueChanged,this.helper)}_choiceChanged(t){var e;t.stopPropagation();const o="object"==typeof this.value?this.value:{[this._activeChoice]:this.value};this._activeChoice=(null===(e=t.detail)||void 0===e?void 0:e.value)||t.target.value,(0,c.r)(this,"value-changed",{value:Object.assign(Object.assign({},o),{},{active_choice:this._activeChoice})})}_handleValueChanged(t){t.stopPropagation();const e="object"==typeof this.value?this.value:{};(0,c.r)(this,"value-changed",{value:Object.assign(Object.assign({},e),{},{[this._activeChoice]:t.detail.value,active_choice:this._activeChoice})})}_selector(t){var e;const o=this.selector.choose.choices;return(t=t||(null===(e=this.value)||void 0===e?void 0:e.active_choice))&&t in o?o[t].selector:o[Object.keys(o)[0]].selector}_value(t){if(this.value)return"object"==typeof this.value?this.value[t||this.value.active_choice]:this.value}_setActiveChoice(){if(this.value)if("object"==typeof this.value){if(this.value.active_choice in this.selector.choose.choices)return void(this._activeChoice=this.value.active_choice)}else{const t=typeof this.value,e=Object.values(this.selector.choose.choices).map(t=>Object.keys(t.selector)[0]);if("number"===t&&e.includes("number"))return void(this._activeChoice=Object.keys(this.selector.choose.choices)[e.indexOf("number")]);if("string"===t&&(0,l.F)(this.value)&&e.includes("template"))return void(this._activeChoice=Object.keys(this.selector.choose.choices)[e.indexOf("template")]);if("string"===t&&this.value.includes(".")&&e.includes("entity"))return void(this._activeChoice=Object.keys(this.selector.choose.choices)[e.indexOf("entity")]);if("string"===t&&e.includes("text"))return void(this._activeChoice=Object.keys(this.selector.choose.choices)[e.indexOf("text")])}this._activeChoice=Object.keys(this.selector.choose.choices)[0]}constructor(...t){super(...t),this.disabled=!1,this.required=!0,this._toggleButtons=(0,n.A)((t,e,o)=>Object.keys(t).map(t=>({label:this.localizeValue&&e?this.localizeValue(`${e}.choices.${t}`):t,value:t})))}}b.styles=(0,s.AH)(v||(v=p`.multi-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--ha-space-2)}ha-button-toggle-group{display:block;justify-self:end}`)),(0,a.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"selector",void 0),(0,a.Cg)([(0,r.MZ)()],b.prototype,"value",void 0),(0,a.Cg)([(0,r.MZ)()],b.prototype,"label",void 0),(0,a.Cg)([(0,r.MZ)()],b.prototype,"helper",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"localizeValue",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],b.prototype,"disabled",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],b.prototype,"required",void 0),(0,a.Cg)([(0,r.wk)()],b.prototype,"_activeChoice",void 0),b=(0,a.Cg)([(0,r.EM)("ha-selector-choose")],b),i()}catch(d){i(d)}})},22395:function(t,e,o){o(62953);var i=o(5124),a=o(67576),s=o(717);let r;var n=(0,i.AH)(r||(r=(t=>t)`:host{display:inline-flex}.button-group{display:flex;position:relative;isolation:isolate;flex-wrap:wrap}@media (hover:hover){.button-group::slotted(:hover),.button-group>:hover{z-index:1}}.button-group::slotted(:focus),.button-group::slotted([aria-checked=true]),.button-group::slotted([checked]),.button-group>:focus,.button-group>[aria-checked=true],.button-group>[checked]{z-index:2!important}:host([orientation=horizontal]) .button-group{flex-direction:row}:host([orientation=vertical]) .button-group{flex-direction:column}:host([orientation=horizontal]){--_button-horizontal-indent:var(--wa-form-control-border-width);--_button-horizontal-indent-outlined:calc(var(--wa-form-control-border-width) * -1)}:host([orientation=vertical]){--_button-vertical-indent:var(--wa-form-control-border-width);--_button-vertical-indent-outlined:calc(var(--wa-form-control-border-width) * -1)}::slotted(:not(:first-child):not(:last-child)){--_button-start-start-radius:0;--_button-start-end-radius:0;--_button-end-start-radius:0;--_button-end-end-radius:0}:host([orientation=horizontal]) ::slotted(:first-child:not(:last-child)){--_button-start-end-radius:0;--_button-end-end-radius:0}:host([orientation=horizontal]) ::slotted(:last-child:not(:first-child)){--_button-start-start-radius:0;--_button-end-start-radius:0}:host([orientation=vertical]) ::slotted(:first-child:not(:last-child)){--_button-end-start-radius:0;--_button-end-end-radius:0}:host([orientation=vertical]) ::slotted(:last-child:not(:first-child)){--_button-start-start-radius:0;--_button-start-end-radius:0}`));let c,l=t=>t;var h=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=(t,e,o,i)=>{for(var a,s=i>1?void 0:i?u(e,o):e,r=t.length-1;r>=0;r--)(a=t[r])&&(s=(i?a(e,o,s):a(s))||s);return i&&s&&h(e,o,s),s};let v=class extends s.A{updated(t){super.updated(t),t.has("orientation")&&this.setAttribute("aria-orientation",this.orientation)}handleFocus(t){const e=p(t.target,this.childSelector);null==e||e.classList.add("button-focus")}handleBlur(t){const e=p(t.target,this.childSelector);null==e||e.classList.remove("button-focus")}handleMouseOver(t){const e=p(t.target,this.childSelector);null==e||e.classList.add("button-hover")}handleMouseOut(t){const e=p(t.target,this.childSelector);null==e||e.classList.remove("button-hover")}render(){return(0,i.qy)(c||(c=l` <slot part="base" class="button-group" role="${0}" aria-label="${0}" aria-orientation="${0}" @focusout="${0}" @focusin="${0}" @mouseover="${0}" @mouseout="${0}"></slot> `),this.disableRole?"presentation":"group",this.label,this.orientation,this.handleBlur,this.handleFocus,this.handleMouseOver,this.handleMouseOut)}constructor(){super(...arguments),this.disableRole=!1,this.hasOutlined=!1,this.label="",this.orientation="horizontal",this.childSelector="wa-button, wa-radio-button"}};function p(t,e){var o;return null!==(o=t.closest(e))&&void 0!==o?o:t.querySelector(e)}v.css=[n],d([(0,a.P)("slot")],v.prototype,"defaultSlot",2),d([(0,a.wk)()],v.prototype,"disableRole",2),d([(0,a.wk)()],v.prototype,"hasOutlined",2),d([(0,a.MZ)()],v.prototype,"label",2),d([(0,a.MZ)({reflect:!0})],v.prototype,"orientation",2),d([(0,a.MZ)()],v.prototype,"childSelector",2),v=d([(0,a.EM)("wa-button-group")],v)}}]);