iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 17.2 kB
JavaScript
export const __webpack_ids__=["28751"];export const __webpack_modules__={92091:function(e,t,i){function o(e){return!!e&&(e instanceof Date&&!isNaN(e.valueOf()))}i.d(t,{Z:()=>o})},46467:function(e,t,i){i.a(e,(async function(e,o){try{i.d(t,{D_:()=>C,NC:()=>f,Nh:()=>p,U8:()=>w,WB:()=>m,mn:()=>c,p6:()=>s,ud:()=>b,yQ:()=>_});i(9359),i(1331);var a=i(16485),n=i(27486),r=i(20382),d=i(11104),l=e([a,d]);[a,d]=l.then?(await l)():l;(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",month:"long",day:"numeric",timeZone:(0,d.f)(e.time_zone,t)})));const s=(e,t,i)=>u(t,i.time_zone).format(e),u=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",timeZone:(0,d.f)(e.time_zone,t)}))),c=(e,t,i)=>h(t,i.time_zone).format(e),h=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"short",day:"numeric",timeZone:(0,d.f)(e.time_zone,t)}))),m=(e,t,i)=>{const o=v(t,i.time_zone);if(t.date_format===r.t6.language||t.date_format===r.t6.system)return o.format(e);const a=o.formatToParts(e),n=a.find((e=>"literal"===e.type))?.value,d=a.find((e=>"day"===e.type))?.value,l=a.find((e=>"month"===e.type))?.value,s=a.find((e=>"year"===e.type))?.value,u=a.at(a.length-1);let c="literal"===u?.type?u?.value:"";"bg"===t.language&&t.date_format===r.t6.YMD&&(c="");return{[r.t6.DMY]:`${d}${n}${l}${n}${s}${c}`,[r.t6.MDY]:`${l}${n}${d}${n}${s}${c}`,[r.t6.YMD]:`${s}${n}${l}${n}${d}${c}`}[t.date_format]},v=(0,n.Z)(((e,t)=>{const i=e.date_format===r.t6.system?void 0:e.language;return e.date_format===r.t6.language||(e.date_format,r.t6.system),new Intl.DateTimeFormat(i,{year:"numeric",month:"numeric",day:"numeric",timeZone:(0,d.f)(e.time_zone,t)})})),b=(e,t,i)=>y(t,i.time_zone).format(e),y=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{day:"numeric",month:"short",timeZone:(0,d.f)(e.time_zone,t)}))),f=(e,t,i)=>k(t,i.time_zone).format(e),k=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{month:"long",year:"numeric",timeZone:(0,d.f)(e.time_zone,t)}))),p=(e,t,i)=>g(t,i.time_zone).format(e),g=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{month:"long",timeZone:(0,d.f)(e.time_zone,t)}))),_=(e,t,i)=>$(t,i.time_zone).format(e),$=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",timeZone:(0,d.f)(e.time_zone,t)}))),C=(e,t,i)=>x(t,i.time_zone).format(e),x=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",timeZone:(0,d.f)(e.time_zone,t)}))),w=(e,t,i)=>M(t,i.time_zone).format(e),M=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"short",timeZone:(0,d.f)(e.time_zone,t)})));o()}catch(e){o(e)}}))},33570:function(e,t,i){i.a(e,(async function(e,o){try{i.d(t,{Vu:()=>c,Zs:()=>b,mr:()=>s,xO:()=>m});var a=i(16485),n=i(27486),r=i(11104),d=i(16922),l=e([a,r]);[a,r]=l.then?(await l)():l;const s=(e,t,i)=>u(t,i.time_zone).format(e),u=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,d.y)(e)?"h12":"h23",timeZone:(0,r.f)(e.time_zone,t)}))),c=(e,t,i)=>h(t,i.time_zone).format(e),h=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{hour:(0,d.y)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,d.y)(e)?"h12":"h23",timeZone:(0,r.f)(e.time_zone,t)}))),m=(e,t,i)=>v(t,i.time_zone).format(e),v=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:(0,d.y)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,d.y)(e)?"h12":"h23",timeZone:(0,r.f)(e.time_zone,t)}))),b=(e,t,i)=>y(t,i.time_zone).format(e),y=(0,n.Z)(((e,t)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,r.f)(e.time_zone,t)})));o()}catch(e){o(e)}}))},16922:function(e,t,i){i.d(t,{y:()=>n});var o=i(27486),a=i(20382);const n=(0,o.Z)((e=>{if(e.time_format===a.zt.language||e.time_format===a.zt.system){const t=e.time_format===a.zt.language?e.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(t).includes("10")}return e.time_format===a.zt.am_pm}))},87733:function(e,t,i){i.d(t,{f:()=>o});const o=e=>e.charAt(0).toUpperCase()+e.slice(1)},45061:function(e,t,i){i.d(t,{K:()=>o});const o=e=>{switch(e.language){case"cs":case"de":case"fi":case"fr":case"sk":case"sv":return" ";default:return""}}},87974:function(e,t,i){i.d(t,{L:()=>a});var o=i(45061);const a=(e,t)=>"°"===e?"":t&&"%"===e?(0,o.K)(t):" "},80332:function(e,t,i){i.a(e,(async function(e,t){try{var o=i(44249),a=(i(9359),i(56475),i(70104),i(57243)),n=i(15093),r=i(25904),d=(i(94279),e([r]));r=(d.then?(await d)():d)[0];(0,o.Z)([(0,n.Mo)("ha-entity-attribute-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"entityId",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Array,attribute:"hide-attributes"})],key:"hideAttributes",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"autofocus",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"allow-custom-value"})],key:"allowCustomValue",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_opened",value:()=>!1},{kind:"field",decorators:[(0,n.IO)("ha-combo-box",!0)],key:"_comboBox",value:void 0},{kind:"method",key:"shouldUpdate",value:function(e){return!(!e.has("_opened")&&this._opened)}},{kind:"method",key:"updated",value:function(e){if(e.has("_opened")&&this._opened){const e=this.entityId?this.hass.states[this.entityId]:void 0;this._comboBox.items=e?Object.keys(e.attributes).filter((e=>!this.hideAttributes?.includes(e))).map((t=>({value:t,label:(0,r.computeAttributeNameDisplay)(this.hass.localize,e,this.hass.entities,t)}))):[]}}},{kind:"method",key:"render",value:function(){return this.hass?a.dy` <ha-combo-box .hass="${this.hass}" .value="${this.value?(0,r.computeAttributeNameDisplay)(this.hass.localize,this.hass.states[this.entityId],this.hass.entities,this.value):""}" .autofocus="${this.autofocus}" .label="${this.label??this.hass.localize("ui.components.entity.entity-attribute-picker.attribute")}" .disabled="${this.disabled||!this.entityId}" .required="${this.required}" .helper="${this.helper}" .allowCustomValue="${this.allowCustomValue}" item-value-path="value" item-label-path="label" @opened-changed="${this._openedChanged}" @value-changed="${this._valueChanged}"> </ha-combo-box> `:a.Ld}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_valueChanged",value:function(e){this.value=e.detail.value}}]}}),a.oi);t()}catch(e){t(e)}}))},94279:function(e,t,i){var o=i(44249),a=i(72621),n=(i(9359),i(31526),i(2394)),r=(i(30080),i(43631)),d=i(57243),l=i(15093),s=i(20552),u=i(36522);i(23334),i(7285),i(83166);(0,r.hC)("vaadin-combo-box-item",d.iv`:host{padding:0!important}:host([focused]:not([disabled])){background-color:rgba(var(--rgb-primary-text-color,0,0,0),.12)}:host([selected]:not([disabled])){background-color:transparent;color:var(--mdc-theme-primary);--mdc-ripple-color:var(--mdc-theme-primary);--mdc-theme-text-primary-on-background:var(--mdc-theme-primary)}:host([selected]:not([disabled])):before{background-color:var(--mdc-theme-primary);opacity:.12;content:"";position:absolute;top:0;left:0;width:100%;height:100%}:host([selected][focused]:not([disabled])):before{opacity:.24}:host(:hover:not([disabled])){background-color:transparent}[part=content]{width:100%}[part=checkmark]{display:none}`);(0,o.Z)([(0,l.Mo)("ha-combo-box")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"validationMessage",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"invalid",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"icon",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"items",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"filteredItems",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"dataProvider",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:"allow-custom-value",type:Boolean})],key:"allowCustomValue",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({attribute:"item-value-path"})],key:"itemValuePath",value:()=>"value"},{kind:"field",decorators:[(0,l.Cb)({attribute:"item-label-path"})],key:"itemLabelPath",value:()=>"label"},{kind:"field",decorators:[(0,l.Cb)({attribute:"item-id-path"})],key:"itemIdPath",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"renderer",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,reflect:!0})],key:"opened",value:()=>!1},{kind:"field",decorators:[(0,l.IO)("vaadin-combo-box-light",!0)],key:"_comboBox",value:void 0},{kind:"field",decorators:[(0,l.IO)("ha-textfield",!0)],key:"_inputElement",value:void 0},{kind:"field",key:"_overlayMutationObserver",value:void 0},{kind:"field",key:"_bodyMutationObserver",value:void 0},{kind:"method",key:"open",value:async function(){await this.updateComplete,this._comboBox?.open()}},{kind:"method",key:"focus",value:async function(){await this.updateComplete,await(this._inputElement?.updateComplete),this._inputElement?.focus()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(i,"disconnectedCallback",this,3)([]),this._overlayMutationObserver&&(this._overlayMutationObserver.disconnect(),this._overlayMutationObserver=void 0),this._bodyMutationObserver&&(this._bodyMutationObserver.disconnect(),this._bodyMutationObserver=void 0)}},{kind:"get",key:"selectedItem",value:function(){return this._comboBox.selectedItem}},{kind:"method",key:"setInputValue",value:function(e){this._comboBox.value=e}},{kind:"method",key:"render",value:function(){return d.dy` <vaadin-combo-box-light .itemValuePath="${this.itemValuePath}" .itemIdPath="${this.itemIdPath}" .itemLabelPath="${this.itemLabelPath}" .items="${this.items}" .value="${this.value||""}" .filteredItems="${this.filteredItems}" .dataProvider="${this.dataProvider}" .allowCustomValue="${this.allowCustomValue}" .disabled="${this.disabled}" .required="${this.required}" ${(0,n.t)(this.renderer||this._defaultRowRenderer)} @opened-changed="${this._openedChanged}" @filter-changed="${this._filterChanged}" @value-changed="${this._valueChanged}" attr-for-value="value"> <ha-textfield label="${(0,s.o)(this.label)}" placeholder="${(0,s.o)(this.placeholder)}" ?disabled="${this.disabled}" ?required="${this.required}" validationMessage="${(0,s.o)(this.validationMessage)}" .errorMessage="${this.errorMessage}" class="input" autocapitalize="none" autocomplete="off" autocorrect="off" input-spellcheck="false" .suffix="${d.dy`<div style="width:28px" role="none presentation"></div>`}" .icon="${this.icon}" .invalid="${this.invalid}" .helper="${this.helper}" helperPersistent> <slot name="icon" slot="leadingIcon"></slot> </ha-textfield> ${this.value?d.dy`<ha-svg-icon role="button" tabindex="-1" aria-label="${(0,s.o)(this.hass?.localize("ui.common.clear"))}" class="clear-button" .path="${"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"}" @click="${this._clearValue}"></ha-svg-icon>`:""} <ha-svg-icon role="button" tabindex="-1" aria-label="${(0,s.o)(this.label)}" aria-expanded="${this.opened?"true":"false"}" class="toggle-button" .path="${this.opened?"M7,15L12,10L17,15H7Z":"M7,10L12,15L17,10H7Z"}" @click="${this._toggleOpen}"></ha-svg-icon> </vaadin-combo-box-light> `}},{kind:"field",key:"_defaultRowRenderer",value(){return e=>d.dy`<ha-list-item> ${this.itemLabelPath?e[this.itemLabelPath]:e} </ha-list-item>`}},{kind:"method",key:"_clearValue",value:function(e){e.stopPropagation(),(0,u.B)(this,"value-changed",{value:void 0})}},{kind:"method",key:"_toggleOpen",value:function(e){this.opened?(this._comboBox?.close(),e.stopPropagation()):this._comboBox?.inputElement.focus()}},{kind:"method",key:"_openedChanged",value:function(e){e.stopPropagation();const t=e.detail.value;if(setTimeout((()=>{this.opened=t}),0),(0,u.B)(this,"opened-changed",{value:e.detail.value}),t){const e=document.querySelector("vaadin-combo-box-overlay");e&&this._removeInert(e),this._observeBody()}else this._bodyMutationObserver?.disconnect(),this._bodyMutationObserver=void 0}},{kind:"method",key:"_observeBody",value:function(){"MutationObserver"in window&&!this._bodyMutationObserver&&(this._bodyMutationObserver=new MutationObserver((e=>{e.forEach((e=>{e.addedNodes.forEach((e=>{"VAADIN-COMBO-BOX-OVERLAY"===e.nodeName&&this._removeInert(e)})),e.removedNodes.forEach((e=>{"VAADIN-COMBO-BOX-OVERLAY"===e.nodeName&&(this._overlayMutationObserver?.disconnect(),this._overlayMutationObserver=void 0)}))}))})),this._bodyMutationObserver.observe(document.body,{childList:!0}))}},{kind:"method",key:"_removeInert",value:function(e){if(e.inert)return e.inert=!1,this._overlayMutationObserver?.disconnect(),void(this._overlayMutationObserver=void 0);"MutationObserver"in window&&!this._overlayMutationObserver&&(this._overlayMutationObserver=new MutationObserver((e=>{e.forEach((e=>{if("inert"===e.attributeName){const t=e.target;t.inert&&(this._overlayMutationObserver?.disconnect(),this._overlayMutationObserver=void 0,t.inert=!1)}}))})),this._overlayMutationObserver.observe(e,{attributes:!0}))}},{kind:"method",key:"_filterChanged",value:function(e){e.stopPropagation(),(0,u.B)(this,"filter-changed",{value:e.detail.value})}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation(),this.allowCustomValue||(this._comboBox._closeOnBlurIsPrevented=!0);const t=e.detail.value;t!==this.value&&(0,u.B)(this,"value-changed",{value:t||void 0})}},{kind:"field",static:!0,key:"styles",value:()=>d.iv`:host{display:block;width:100%}vaadin-combo-box-light{position:relative;--vaadin-combo-box-overlay-max-height:calc(45vh - 56px)}ha-textfield{width:100%}ha-textfield>ha-icon-button{--mdc-icon-button-size:24px;padding:2px;color:var(--secondary-text-color)}ha-svg-icon{color:var(--input-dropdown-icon-color);position:absolute;cursor:pointer}.toggle-button{right:12px;top:-10px;inset-inline-start:initial;inset-inline-end:12px;direction:var(--direction)}:host([opened]) .toggle-button{color:var(--primary-color)}.clear-button{--mdc-icon-size:20px;top:-7px;right:36px;inset-inline-start:initial;inset-inline-end:36px;direction:var(--direction)}`}]}}),d.oi)},47622:function(e,t,i){i.a(e,(async function(e,o){try{i.r(t),i.d(t,{HaSelectorAttribute:()=>c});var a=i(44249),n=i(72621),r=i(57243),d=i(15093),l=i(36522),s=i(80332),u=e([s]);s=(u.then?(await u)():u)[0];let c=(0,a.Z)([(0,d.Mo)("ha-selector-attribute")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"selector",value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"required",value:()=>!0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"context",value:void 0},{kind:"method",key:"render",value:function(){return r.dy` <ha-entity-attribute-picker .hass="${this.hass}" .entityId="${this.selector.attribute?.entity_id||this.context?.filter_entity}" .hideAttributes="${this.selector.attribute?.hide_attributes}" .value="${this.value}" .label="${this.label}" .helper="${this.helper}" .disabled="${this.disabled}" .required="${this.required}" allow-custom-value></ha-entity-attribute-picker> `}},{kind:"method",key:"updated",value:function(e){if((0,n.Z)(i,"updated",this,3)([e]),!this.value||this.selector.attribute?.entity_id||!e.has("context"))return;const t=e.get("context");if(!this.context||!t||t.filter_entity===this.context.filter_entity)return;let o=!1;if(this.context.filter_entity){const e=this.hass.states[this.context.filter_entity];e&&this.value in e.attributes||(o=!0)}else o=void 0!==this.value;o&&(0,l.B)(this,"value-changed",{value:void 0})}}]}}),r.oi);o()}catch(e){o(e)}}))}};
//# sourceMappingURL=28751.374208ba6605e179.js.map