UNPKG

iobroker.lovelace

Version:

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

2 lines 9.15 kB
/*! For license information please see 7457.e149d9b5c7a91ed1.js.LICENSE.txt */ "use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[7457],{81816:function(e,t,r){r.d(t,{aH:function(){return n},cx:function(){return s},es:function(){return l}});var o=r(37981),a=r(28978),i=r(79461);const n=(e,t,r)=>{const o=t[e.entity_id];return o?s(o,r):(0,a.u)(e)},s=(e,t,r)=>{const n=e.name||("original_name"in e&&null!=e.original_name?String(e.original_name):void 0),s=e.device_id?t[e.device_id]:void 0;if(!s)return n||(r?(0,a.u)(r):void 0);const l=(0,o.xn)(s);return l!==n?l&&n&&(0,i.p)(n,l)||n:void 0},l=(e,t,r)=>!n(e,t,r)},74705:function(e,t,r){r.d(t,{Bj:function(){return v},Cf:function(){return d},uU:function(){return h}});r(18111),r(81148),r(22489),r(61701),r(13579),r(62953);if(66649!=r.j)var o=r(44537);var a=r(15638),i=r(65522),n=r(37981),s=r(81816),l=r(55931),c=r(28978),u=r(28455);const h=(e,t,r,a,i,n,l)=>{var u;if("string"==typeof t)return t;if(!t)return(0,c.u)(e);let h=(0,o.e)(t);const v=null!==(u=null==l?void 0:l.separator)&&void 0!==u?u:" ";if(h.every(e=>"text"===e.type))return h.map(e=>e.text).join(v);if((0,s.es)(e,r,a)){h.some(e=>"device"===e.type)||(h=h.map(e=>"entity"===e.type?{type:"device"}:e))}const p=d(e,h,r,a,i,n);return 1===p.length?p[0]||"":p.filter(e=>e).join(v)},d=(e,t,r,o,a,c)=>{const{device:h,area:d,floor:v}=(0,u.ln)(e,r,o,a,c);return t.map(t=>{switch(t.type){case"entity":return(0,s.aH)(e,r,o);case"device":return h?(0,n.xn)(h):void 0;case"area":return d?(0,i.A)(d):void 0;case"floor":return v?(0,l.X)(v):void 0;case"text":return t.text;default:return""}})},v=(e,t)=>{const[r,o,i]=d(t,[{type:"entity"},{type:"device"},{type:"area"}],e.entities,e.devices,e.areas,e.floors),n=(0,a.qC)(e.language,e.translationMetadata.translations);return{primary:r||o||t.entity_id,secondary:[i,r?o:void 0].filter(Boolean).join(n?" ◂ ":" ▸ ")||void 0}}},38355:function(e,t,r){r.a(e,async function(e,o){try{r.r(t),r.d(t,{HuiLogbookCardEditor:function(){return q}});r(3362),r(62953);var a=r(40445),i=r(5124),n=r(67576),s=r(22786),l=r(63533),c=r(1087),u=r(77122),h=r(52763),d=r(79286),v=r(86531),p=r(84025),f=r(95311),g=r(64808),m=r(42526),b=r(84698),w=e([u,h,d,m,v]);[u,h,d,m,v]=w.then?(await w)():w;let _,y,k=e=>e;const C=(0,l.kp)(b.H,(0,l.Ik)({entities:(0,l.lq)((0,l.YO)((0,l.Yj)())),title:(0,l.lq)((0,l.Yj)()),hours_to_show:(0,l.lq)((0,l.ai)()),theme:(0,l.lq)((0,l.Yj)()),target:(0,l.lq)(p.dW),state_filter:(0,l.lq)((0,l.YO)((0,l.Yj)()))})),x=[{name:"title",selector:{text:{}}},{name:"",type:"grid",schema:[{name:"theme",selector:{theme:{}}},{name:"hours_to_show",default:m.DEFAULT_HOURS_TO_SHOW,selector:{number:{mode:"box",min:1}}}]},{name:"state_filter",context:{filter_entity:"context_entities"},selector:{state:{multiple:!0}}}];class q extends i.WF{setConfig(e){(0,l.vA)(e,C),this._config=e}get _targetPicker(){const e=this._config.entities||[];return this._config.entities&&(this._config=Object.assign(Object.assign({},this._config),{},{entities:void 0,target:{entity_id:e}})),this._config.target||{entity_id:e}}async _loadNumericDeviceClasses(e){this._sensorNumericDeviceClasses=[];const t=await(0,g.KL)(e);this._sensorNumericDeviceClasses=t.numeric_device_classes}updated(){this.hass&&!this._sensorNumericDeviceClasses&&this._loadNumericDeviceClasses(this.hass)}render(){return this.hass&&this._config?(0,i.qy)(_||(_=k` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> <ha-target-picker .hass="${0}" .entityFilter="${0}" .value="${0}" @value-changed="${0}"></ha-target-picker> `),this.hass,this._data(this._config,this._targetPicker,this.hass.entities,this.hass.devices,this.hass.areas),x,this._computeLabelCallback,this._valueChanged,this.hass,this._filterFunc,this._targetPicker,this._entitiesChanged):i.s6}_entitiesChanged(e){this._config=Object.assign(Object.assign({},this._config),{},{target:e.detail.value}),(0,c.r)(this,"config-changed",{config:this._config})}_valueChanged(e){const t=Object.assign({},e.detail.value);delete t.context_entities,(0,c.r)(this,"config-changed",{config:t})}constructor(...e){super(...e),this._data=(0,s.A)((e,t,r,o,a)=>Object.assign(Object.assign({},e),{},{context_entities:(0,f.wY)(this.hass,t,r,o,a)})),this._filterFunc=e=>(0,v.rc)(e,this._sensorNumericDeviceClasses),this._computeLabelCallback=e=>{switch(e.name){case"theme":return`${this.hass.localize("ui.panel.lovelace.editor.card.generic.theme")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`;case"state_filter":return this.hass.localize("ui.panel.lovelace.editor.card.logbook.state_filter");default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}}q.styles=(0,i.AH)(y||(y=k`ha-target-picker{display:block;margin-top:var(--ha-space-4)}`)),(0,a.Cg)([(0,n.MZ)({attribute:!1})],q.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],q.prototype,"_config",void 0),(0,a.Cg)([(0,n.wk)()],q.prototype,"_sensorNumericDeviceClasses",void 0),q=(0,a.Cg)([(0,n.EM)("hui-logbook-card-editor")],q),o()}catch(_){o(_)}})},84698:function(e,t,r){r.d(t,{H:function(){return a}});var o=r(63533);const a=(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)())})},10058:function(e,t,r){r.a(e,async function(e,t){try{r(62953);var o=r(5124),a=r(67576),i=r(26638),n=r(40991),s=r(9395),l=r(717),c=r(31896),u=r(93137),h=r(17060),d=r(88496),v=r(23852),p=e([d,h]);[d,h]=p.then?(await p)():p;let b,w,_=e=>e;var f=Object.defineProperty,g=Object.getOwnPropertyDescriptor,m=(e,t,r,o)=>{for(var a,i=o>1?void 0:o?g(t,r):t,n=e.length-1;n>=0;n--)(a=e[n])&&(i=(o?a(t,r,i):a(i))||i);return o&&i&&f(t,r,i),i};let y=class extends l.A{handleSizeChange(){(0,n.b)(this.localName,this.size)}handleRemoveClick(){this.dispatchEvent(new i.x)}render(){return(0,o.qy)(b||(b=_` <slot part="content" class="content"></slot> ${0} `),this.withRemove?(0,o.qy)(w||(w=_` <wa-button part="remove-button" exportparts="base:remove-button__base" class="remove" appearance="plain" @click="${0}" tabindex="-1"> <wa-icon name="xmark" library="system" variant="solid" label="${0}"></wa-icon> </wa-button> `),this.handleRemoveClick,this.localize.term("remove")):"")}constructor(){super(...arguments),this.localize=new h.c(this),this.variant="neutral",this.appearance="filled-outlined",this.size="m",this.pill=!1,this.withRemove=!1}};y.css=[v.A,u.A,c.A],m([(0,a.MZ)({reflect:!0})],y.prototype,"variant",2),m([(0,a.MZ)({reflect:!0})],y.prototype,"appearance",2),m([(0,a.MZ)({reflect:!0})],y.prototype,"size",2),m([(0,s.w)("size")],y.prototype,"handleSizeChange",1),m([(0,a.MZ)({type:Boolean,reflect:!0})],y.prototype,"pill",2),m([(0,a.MZ)({attribute:"with-remove",type:Boolean})],y.prototype,"withRemove",2),y=m([(0,a.EM)("wa-tag")],y),t()}catch(b){t(b)}})},23852:function(e,t,r){r.d(t,{A:function(){return a}});let o;var a=(0,r(5124).AH)(o||(o=(e=>e)`@layer wa-component{:host{display:inline-flex;gap:.5em;border-radius:var(--wa-border-radius-m);align-items:center;background-color:var(--wa-color-fill-quiet,var(--wa-color-neutral-fill-quiet));border-color:var(--wa-color-border-normal,var(--wa-color-neutral-border-normal));border-style:var(--wa-border-style);border-width:var(--wa-border-width-s);color:var(--wa-color-on-quiet,var(--wa-color-neutral-on-quiet));font-size:inherit;line-height:1;white-space:nowrap;user-select:none;-webkit-user-select:none;height:calc(var(--wa-form-control-height) * .8);line-height:calc(var(--wa-form-control-height) - var(--wa-form-control-border-width) * 2);padding:0 .75em}:host([appearance=outlined]){color:var(--wa-color-on-quiet,var(--wa-color-neutral-on-quiet));background-color:transparent;border-color:var(--wa-color-border-loud,var(--wa-color-neutral-border-loud))}:host([appearance=filled]){color:var(--wa-color-on-quiet,var(--wa-color-neutral-on-quiet));background-color:var(--wa-color-fill-quiet,var(--wa-color-neutral-fill-quiet));border-color:transparent}:host([appearance=filled-outlined]){color:var(--wa-color-on-quiet,var(--wa-color-neutral-on-quiet));background-color:var(--wa-color-fill-quiet,var(--wa-color-neutral-fill-quiet));border-color:var(--wa-color-border-normal,var(--wa-color-neutral-border-normal))}:host([appearance=accent]){color:var(--wa-color-on-loud,var(--wa-color-neutral-on-loud));background-color:var(--wa-color-fill-loud,var(--wa-color-neutral-fill-loud));border-color:transparent}}.content{font-size:var(--wa-font-size-smaller)}[part=remove-button]{line-height:1}[part=remove-button]::part(base){padding:0;height:1em;width:1em;color:currentColor}@media (hover:hover){:host(:hover)>[part=remove-button]::part(base){background-color:transparent;color:color-mix(in oklab,currentColor,var(--wa-color-mix-hover))}}:host(:active)>[part=remove-button]::part(base){background-color:transparent;color:color-mix(in oklab,currentColor,var(--wa-color-mix-active))}:host([pill]){border-radius:var(--wa-border-radius-pill)}`))},26638:function(e,t,r){r.d(t,{x:function(){return o}});class o extends Event{constructor(){super("wa-remove",{bubbles:!0,cancelable:!1,composed:!0})}}}}]);