UNPKG

iobroker.lovelace

Version:

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

4 lines 15.9 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[39005],{38508:function(e,t,o){o.a(e,async function(e,t){try{o(18111),o(13579),o(3362),o(62953);var i=o(40445),a=o(61366),r=o(35211),s=o(5124),l=o(67576),n=o(63672),h=o(91335),d=o(1087),p=o(22792),c=o(17894),u=o(22348),b=o(99611),v=o(18350),m=(o(75064),o(3449),o(49639)),g=o(88285),y=(o(67094),e([a,b,v,m,g]));[a,b,v,m,g]=y.then?(await y)():y;let w,_,x,k,$,C,f,M,V,Z=e=>e;const L="M3 16H10V14H3M18 14V10H16V14H12V16H16V20H18V16H22V14M14 6H3V8H14M14 10H3V12H14V10Z";class q extends((0,c.c)(s.WF)){willUpdate(e){e.has("value")&&this._setUnknownValue()}setFieldValue(e){this._comboBox?this._comboBox.setFieldValue(e):this._initialFieldValue=e}render(){var e;const t=this.useTopLabel&&this.value?void 0:this.label;return(0,s.qy)(w||(w=Z`<div class="container"> ${0} <div id="picker"> <slot name="field"> ${0} </slot> </div> ${0} </div> ${0}`),this.useTopLabel&&this.label?(0,s.qy)(_||(_=Z`<label ?disabled="${0}">${0}</label>`),this.disabled,this.label):s.s6,this.addButtonLabel&&!this.value?(0,s.qy)(x||(x=Z`<ha-button size="small" appearance="filled" @click="${0}" .disabled="${0}"> <ha-svg-icon .path="${0}" slot="start"></ha-svg-icon> ${0} </ha-button>`),this.open,this.disabled,L,this.addButtonLabel):(0,s.qy)(k||(k=Z`<ha-picker-field type="button" class="${0}" compact="compact" .unknown="${0}" .unknownItemText="${0}" aria-label="${0}" @click="${0}" @clear="${0}" .icon="${0}" .image="${0}" .label="${0}" .placeholder="${0}" .value="${0}" .valueRenderer="${0}" .required="${0}" .disabled="${0}" .invalid="${0}" .hideClearIcon="${0}"> <slot name="start"></slot> </ha-picker-field>`),this._opened?"opened":"",this._unknownValue,this.unknownItemText,(0,n.J)(this.label),this.open,this._clear,this.icon,this.image,t,this.placeholder,this.value,this.valueRenderer,this.required,this.disabled,this.invalid,this.hideClearIcon),this._pickerWrapperOpen||this._opened?this._openedNarrow?(0,s.qy)($||($=Z` <ha-bottom-sheet flexcontent .open="${0}" @wa-after-show="${0}" @closed="${0}" role="dialog" aria-modal="true" aria-label="${0}"> ${0} </ha-bottom-sheet> `),this._pickerWrapperOpen,this._dialogOpened,this._hidePicker,this.label||"Select option",this._renderComboBox(!0)):(0,s.qy)(C||(C=Z` <wa-popover .open="${0}" style="--body-width:${0}px" without-arrow distance="-4" .placement="${0}" .for="${0}" .anchor="${0}" auto-size="vertical" auto-size-padding="16" @wa-after-show="${0}" @wa-after-hide="${0}" trap-focus role="dialog" aria-modal="true" aria-label="${0}"> ${0} </wa-popover> `),this._pickerWrapperOpen,this._popoverWidth,this.popoverPlacement,this.popoverAnchor?null:"picker",null!==(e=this.popoverAnchor)&&void 0!==e?e:null,this._dialogOpened,this._hidePicker,this.label||"Select option",this._renderComboBox()):s.s6,this._renderHelper())}_renderComboBox(e=!1){var t;return this._opened?(0,s.qy)(f||(f=Z` <ha-picker-combo-box id="combo-box" .allowCustomValue="${0}" .label="${0}" .value="${0}" @value-changed="${0}" .rowRenderer="${0}" .notFoundLabel="${0}" .emptyLabel="${0}" .getItems="${0}" .getAdditionalItems="${0}" .searchFn="${0}" .mode="${0}" .sections="${0}" .sectionTitleFunction="${0}" .selectedSection="${0}" .searchKeys="${0}" .customValueLabel="${0}" .noSort="${0}"></ha-picker-combo-box> `),this.allowCustomValue,this.searchLabel,null!==(t=this._selectedValue)&&void 0!==t?t:this.value,this._valueChanged,this.rowRenderer,this.notFoundLabel,this.emptyLabel,this.getItems,this.getAdditionalItems,this.searchFn,e?"dialog":"popover",this.sections,this.sectionTitleFunction,this.selectedSection,this.searchKeys,this.customValueLabel,this.noSort):s.s6}_renderHelper(){const e=this.invalid&&this.errorMessage,t=!e&&this.helper;return e||t?(0,s.qy)(M||(M=Z`<ha-input-helper-text .disabled="${0}"> ${0} </ha-input-helper-text>`),this.disabled,e?this.errorMessage:this.helper):s.s6}refreshItems(){var e;null===(e=this._comboBox)||void 0===e||e.refreshItems()}_hidePicker(e){var t;e.stopPropagation(),this._newValue&&((0,d.r)(this,"value-changed",{value:this._newValue}),this._newValue=void 0),this._opened=!1,this._pickerWrapperOpen=!1,this._selectedValue=void 0,null===(t=this._unsubscribeTinyKeys)||void 0===t||t.call(this),(0,d.r)(this,"picker-closed")}_valueChanged(e){e.stopPropagation();const t=e.detail.value;t&&(this._pickerWrapperOpen=!1,this._newValue=t)}_clear(e){e.stopPropagation(),this._setValue(void 0)}_setValue(e){this.value=e,(0,d.r)(this,"value-changed",{value:e})}async open(e,t){var o;null==e||e.stopPropagation(),this.disabled||(this._selectedValue=null==t?void 0:t.selectedValue,this._openedNarrow=this._narrow,this._popoverWidth=(null===(o=this._containerElement)||void 0===o?void 0:o.offsetWidth)||250,this._pickerWrapperOpen=!0,this._unsubscribeTinyKeys=(0,h.Tc)(this,{Escape:this._handleEscClose}))}connectedCallback(){super.connectedCallback(),this._handleResize(),window.addEventListener("resize",this._handleResize)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize),null===(e=this._unsubscribeTinyKeys)||void 0===e||e.call(this)}static get styles(){return[(0,s.AH)(V||(V=Z`.container{position:relative;display:block;max-width:100%}label[disabled]{color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}label{display:block;margin:0 0 8px}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}:host([invalid]) ha-input-helper-text{color:var(--mdc-theme-error,var(--error-color,#b00020))}wa-popover{--wa-space-l:0}wa-popover::part(dialog)::backdrop{background:0 0}wa-popover::part(body){width:var(--ha-generic-picker-width,max(var(--body-width),250px));max-width:var(--ha-generic-picker-max-width,var(--ha-generic-picker-width,max(var(--body-width),250px)));max-height:500px;height:70vh;overflow:hidden}@media (max-height:1000px){wa-popover::part(body){max-height:400px}}ha-bottom-sheet{--ha-bottom-sheet-height:90vh;--ha-bottom-sheet-height:calc(100dvh - var(--ha-space-12));--ha-bottom-sheet-max-height:var(--ha-bottom-sheet-height);--ha-bottom-sheet-max-width:600px;--ha-bottom-sheet-padding:0;--ha-bottom-sheet-surface-background:var(--card-background-color);--ha-bottom-sheet-border-radius:var(--ha-border-radius-2xl);--ha-bottom-sheet-content-padding:0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}`))]}constructor(...e){super(...e),this.popoverPlacement="bottom",this.useTopLabel=!1,this.noSort=!1,this._opened=!1,this._pickerWrapperOpen=!1,this._popoverWidth=0,this._openedNarrow=!1,this._unknownValue=!1,this._narrow=!1,this.invalid=!1,this._setUnknownValue=()=>{const e=this.getItems();!this.allowCustomValue&&void 0!==this.value&&null!==this.value&&""!==this.value&&e?this._unknownValue=!e.some(e=>"string"!=typeof e&&e.id===this.value):this._unknownValue=!1},this._dialogOpened=()=>{this._opened=!0,(0,d.r)(this,"picker-opened"),requestAnimationFrame(()=>{var e,t,o;this._initialFieldValue&&(null===(o=this._comboBox)||void 0===o||o.setFieldValue(this._initialFieldValue),this._initialFieldValue=void 0);null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,u.V)(this._hassConfig.auth.external)?this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:"combo-box"}}):null===(t=this._comboBox)||void 0===t||t.focus()})},this._handleResize=()=>{var e;(this._narrow=window.matchMedia("(max-width: 870px)").matches||window.matchMedia("(max-height: 500px)").matches,!this._openedNarrow&&this._pickerWrapperOpen)&&(this._popoverWidth=(null===(e=this._containerElement)||void 0===e?void 0:e.offsetWidth)||250)},this._handleEscClose=e=>{e.stopPropagation()}}}q.shadowRootOptions=Object.assign(Object.assign({},s.WF.shadowRootOptions),{},{delegatesFocus:!0}),(0,i.Cg)([(0,l.MZ)({type:Boolean,attribute:"allow-custom-value"})],q.prototype,"allowCustomValue",void 0),(0,i.Cg)([(0,l.MZ)({type:String,attribute:"search-label"})],q.prototype,"searchLabel",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"getItems",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"getAdditionalItems",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"rowRenderer",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"searchFn",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"searchKeys",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"notFoundLabel",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"empty-label"})],q.prototype,"emptyLabel",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"popover-placement"})],q.prototype,"popoverPlacement",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"add-button-label"})],q.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"sections",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"sectionTitleFunction",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"selected-section"})],q.prototype,"selectedSection",void 0),(0,i.Cg)([(0,l.MZ)({attribute:!1})],q.prototype,"popoverAnchor",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,attribute:"use-top-label"})],q.prototype,"useTopLabel",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"custom-value-label"})],q.prototype,"customValueLabel",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,attribute:"no-sort"})],q.prototype,"noSort",void 0),(0,i.Cg)([(0,l.P)(".container")],q.prototype,"_containerElement",void 0),(0,i.Cg)([(0,l.P)("ha-picker-combo-box")],q.prototype,"_comboBox",void 0),(0,i.Cg)([(0,l.wk)(),(0,r.Fg)({context:p.WF,subscribe:!0})],q.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,l.wk)()],q.prototype,"_opened",void 0),(0,i.Cg)([(0,l.wk)()],q.prototype,"_pickerWrapperOpen",void 0),(0,i.Cg)([(0,l.wk)()],q.prototype,"_popoverWidth",void 0),(0,i.Cg)([(0,l.wk)()],q.prototype,"_openedNarrow",void 0),(0,i.Cg)([(0,l.wk)()],q.prototype,"_unknownValue",void 0),(0,i.Cg)([(0,l.wk)()],q.prototype,"_selectedValue",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"error-message"})],q.prototype,"errorMessage",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,reflect:!0})],q.prototype,"invalid",void 0),q=(0,i.Cg)([(0,l.EM)("ha-generic-picker")],q),t()}catch(w){t(w)}})},3449:function(e,t,o){o(62953);var i=o(40445),a=o(5124),r=o(67576);let s,l,n=e=>e;class h extends a.WF{render(){return(0,a.qy)(s||(s=n`<slot></slot>`))}constructor(...e){super(...e),this.disabled=!1}}h.styles=(0,a.AH)(l||(l=n`:host{display:block;color:var(--mdc-text-field-label-ink-color,rgba(0,0,0,.6));font-size:var(--ha-font-size-s);padding-left:16px;padding-right:16px;padding-inline-start:16px;padding-inline-end:16px;letter-spacing:var( --mdc-typography-caption-letter-spacing, .0333333333em );line-height:normal}:host([disabled]){color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}`)),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],h.prototype,"disabled",void 0),h=(0,i.Cg)([(0,r.EM)("ha-input-helper-text")],h)},88285:function(e,t,o){o.a(e,async function(e,t){try{o(3362),o(62953);var i=o(40445),a=o(35211),r=o(5124),s=o(67576),l=o(63672),n=o(1087),h=o(22792),d=o(17894),p=(o(75064),o(47680),o(26300)),c=e([p]);p=(c.then?(await c)():c)[0];let u,b,v,m,g,y,w,_,x,k,$=e=>e;const C="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",f="M7,10L12,15L17,10H7Z";class M extends((0,d.c)(r.WF)){async focus(){var e;await this.updateComplete,await(null===(e=this.item)||void 0===e?void 0:e.focus())}render(){var e,t,o,i;const a=!!this.value,s=!(!this.value||this.required||this.disabled||this.hideClearIcon),n=null!==(e=this.placeholder)&&void 0!==e?e:this.label,h=this.label&&a?(0,r.qy)(u||(u=$`<span slot="overline">${0}${0}</span>`),this.label,this.required?" *":""):r.s6,d=a?this.valueRenderer?this.valueRenderer(null!==(t=this.value)&&void 0!==t?t:""):(0,r.qy)(b||(b=$`<span slot="headline">${0}</span>`),this.value):n?(0,r.qy)(v||(v=$`<span slot="headline" class="placeholder"> ${0}${0} </span>`),n,this.required?" *":""):r.s6;return(0,r.qy)(m||(m=$` <ha-combo-box-item aria-label="${0}" .disabled="${0}" type="button" compact="compact"> ${0} ${0}${0} ${0} ${0} <ha-svg-icon class="arrow" slot="end" .path="${0}"></ha-svg-icon> </ha-combo-box-item> `),(0,l.J)(this.label||this.placeholder),this.disabled,this.image?(0,r.qy)(g||(g=$`<img alt="${0}" slot="start" .src="${0}" crossorigin="anonymous" referrerpolicy="no-referrer">`),null!==(o=this.label)&&void 0!==o?o:"",this.image):this.icon?(0,r.qy)(y||(y=$`<ha-icon slot="start" .icon="${0}"></ha-icon>`),this.icon):(0,r.qy)(w||(w=$`<slot name="start"></slot>`)),h,d,this.unknown?(0,r.qy)(_||(_=$`<div slot="supporting-text" class="unknown"> ${0} </div>`),this.unknownItemText||(null===(i=this._i18n)||void 0===i?void 0:i.localize("ui.components.combo-box.unknown_item"))):r.s6,s?(0,r.qy)(x||(x=$` <ha-icon-button class="clear" slot="end" @click="${0}" .path="${0}"></ha-icon-button> `),this._clear,C):r.s6,f)}_clear(e){e.stopPropagation(),(0,n.r)(this,"clear")}static get styles(){return[(0,r.AH)(k||(k=$`ha-combo-box-item[disabled]{background-color:var(--ha-color-form-background-disabled);--md-list-item-disabled-opacity:0.5;opacity:.5;cursor:not-allowed}ha-combo-box-item{position:relative;background-color:var(--ha-color-form-background);border-radius:var(--ha-border-radius-sm);border-end-end-radius:0;border-end-start-radius:0;--md-list-item-one-line-container-height:56px;--md-list-item-two-line-container-height:56px;--md-list-item-top-space:0px;--md-list-item-bottom-space:0px;--md-list-item-leading-space:var(--ha-space-4);--md-list-item-trailing-space:var(--ha-space-2);--ha-md-list-item-gap:var(--ha-space-2);--md-focus-ring-width:0px;--md-focus-ring-duration:0s}ha-combo-box-item:after{display:block;content:"";position:absolute;pointer-events:none;bottom:0;left:0;right:0;height:1px;width:100%;background-color:var(--ha-color-border-neutral-loud);transform:height 180ms ease-in-out,background-color 180ms ease-in-out}ha-combo-box-item:focus:after{height:2px;background-color:var(--mdc-theme-primary)}:host([unknown]) ha-combo-box-item{background-color:var(--ha-color-fill-warning-quiet-resting)}:host([invalid]) ha-combo-box-item:after{height:2px;background-color:var(--mdc-theme-error,var(--error-color,#b00020))}.clear{margin:0 -8px;--ha-icon-button-size:32px;--ha-icon-button-padding-inline:var(--ha-space-1)}.arrow{--mdc-icon-size:20px;width:32px}.placeholder{color:var(--secondary-text-color)}:host([invalid]) .placeholder{color:var(--mdc-theme-error,var(--error-color,#b00020))}.unknown{color:var(--ha-color-on-warning-normal)}`))]}constructor(...e){super(...e),this.invalid=!1}}(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],M.prototype,"invalid",void 0),(0,i.Cg)([(0,s.P)("ha-combo-box-item",!0)],M.prototype,"item",void 0),(0,i.Cg)([(0,s.wk)(),(0,a.Fg)({context:h.D5,subscribe:!0})],M.prototype,"_i18n",void 0),M=(0,i.Cg)([(0,s.EM)("ha-picker-field")],M),t()}catch(u){t(u)}})},17894:function(e,t,o){o.d(t,{c:function(){return r}});o(62953);var i=o(40445),a=o(67576);const r=e=>{class t extends e{constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.unknown=!1,this.hideClearIcon=!1}}return(0,i.Cg)([(0,a.MZ)({type:Boolean})],t.prototype,"disabled",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean})],t.prototype,"required",void 0),(0,i.Cg)([(0,a.MZ)()],t.prototype,"icon",void 0),(0,i.Cg)([(0,a.MZ)()],t.prototype,"image",void 0),(0,i.Cg)([(0,a.MZ)()],t.prototype,"label",void 0),(0,i.Cg)([(0,a.MZ)()],t.prototype,"placeholder",void 0),(0,i.Cg)([(0,a.MZ)()],t.prototype,"helper",void 0),(0,i.Cg)([(0,a.MZ)()],t.prototype,"value",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],t.prototype,"unknown",void 0),(0,i.Cg)([(0,a.MZ)({attribute:"unknown-item-text"})],t.prototype,"unknownItemText",void 0),(0,i.Cg)([(0,a.MZ)({attribute:"hide-clear-icon",type:Boolean})],t.prototype,"hideClearIcon",void 0),(0,i.Cg)([(0,a.MZ)({attribute:!1})],t.prototype,"valueRenderer",void 0),t}}}]);