iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 8.62 kB
JavaScript
/*! For license information please see 7457.199f3986a198e2fb.js.LICENSE.txt */
export const __rspack_esm_id=7457;export const __rspack_esm_ids=[7457];export const __webpack_modules__={81816(e,t,r){r.d(t,{aH:()=>n,cx:()=>s,es:()=>l});var a=r(37981),o=r(28978),i=r(79461);const n=(e,t,r)=>{const a=t[e.entity_id];return a?s(a,r):(0,o.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,o.u)(r):void 0);const l=(0,a.xn)(s);return l!==n?l&&n&&(0,i.p)(n,l)||n:void 0},l=(e,t,r)=>!n(e,t,r)},74705(e,t,r){r.d(t,{Bj:()=>v,Cf:()=>u,uU:()=>h});r(18111),r(81148),r(22489),r(61701),r(13579);if(66649!=r.j)var a=r(44537);var o=r(15638),i=r(65522),n=r(37981),s=r(81816),l=r(55931);if(66649!=r.j)var c=r(28978);var d=r(28455);const h=(e,t,r,o,i,n,l)=>{if("string"==typeof t)return t;if(!t)return(0,c.u)(e);let d=(0,a.e)(t);const h=l?.separator??" ";if(d.every(e=>"text"===e.type))return d.map(e=>e.text).join(h);if((0,s.es)(e,r,o)){d.some(e=>"device"===e.type)||(d=d.map(e=>"entity"===e.type?{type:"device"}:e))}const v=u(e,d,r,o,i,n);return 1===v.length?v[0]||"":v.filter(e=>e).join(h)},u=(e,t,r,a,o,c)=>{const{device:h,area:u,floor:v}=(0,d.ln)(e,r,a,o,c);return t.map(t=>{switch(t.type){case"entity":return(0,s.aH)(e,r,a);case"device":return h?(0,n.xn)(h):void 0;case"area":return u?(0,i.A)(u):void 0;case"floor":return v?(0,l.X)(v):void 0;case"text":return t.text;default:return""}})},v=(e,t)=>{const[r,a,i]=u(t,[{type:"entity"},{type:"device"},{type:"area"}],e.entities,e.devices,e.areas,e.floors),n=(0,o.qC)(e.language,e.translationMetadata.translations);return{primary:r||a||t.entity_id,secondary:[i,r?a:void 0].filter(Boolean).join(n?" ◂ ":" ▸ ")||void 0}}},38355(e,t,r){r.a(e,async function(e,a){try{r.r(t),r.d(t,{HuiLogbookCardEditor:()=>k});var o=r(62826),i=r(5124),n=r(22441),s=r(22786),l=r(63533),c=r(1087),d=r(77122),h=r(52763),u=r(79286),v=r(86531),p=r(84025),m=r(95311),g=r(64808),_=r(42526),b=r(84698),f=e([d,h,u,_,v]);[d,h,u,_,v]=f.then?(await f)():f;const w=(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)()))})),y=[{name:"title",selector:{text:{}}},{name:"",type:"grid",schema:[{name:"theme",selector:{theme:{}}},{name:"hours_to_show",default:_.DEFAULT_HOURS_TO_SHOW,selector:{number:{mode:"box",min:1}}}]},{name:"state_filter",context:{filter_entity:"context_entities"},selector:{state:{multiple:!0}}}];class k extends i.WF{setConfig(e){(0,l.vA)(e,w),this._config=e}get _targetPicker(){const e=this._config.entities||[];return this._config.entities&&(this._config={...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?i.qy` <ha-form .hass="${this.hass}" .data="${this._data(this._config,this._targetPicker,this.hass.entities,this.hass.devices,this.hass.areas)}" .schema="${y}" .computeLabel="${this._computeLabelCallback}" -changed="${this._valueChanged}"></ha-form> <ha-target-picker .hass="${this.hass}" .entityFilter="${this._filterFunc}" .value="${this._targetPicker}" -changed="${this._entitiesChanged}"></ha-target-picker> `:i.s6}_entitiesChanged(e){this._config={...this._config,target:e.detail.value},(0,c.r)(this,"config-changed",{config:this._config})}_valueChanged(e){const t={...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,a,o)=>({...e,context_entities:(0,m.wY)(this.hass,t,r,a,o)})),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}`)}}}}k.styles=i.AH`ha-target-picker{display:block;margin-top:var(--ha-space-4)}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],k.prototype,"hass",void 0),(0,o.Cg)([(0,n.wk)()],k.prototype,"_config",void 0),(0,o.Cg)([(0,n.wk)()],k.prototype,"_sensorNumericDeviceClasses",void 0),k=(0,o.Cg)([(0,n.EM)("hui-logbook-card-editor")],k),a()}catch(e){a(e)}})},84698(e,t,r){r.d(t,{H:()=>o});var a=r(63533);const o=(0,a.Ik)({type:(0,a.Yj)(),view_layout:(0,a.bz)(),layout_options:(0,a.bz)(),grid_options:(0,a.bz)(),visibility:(0,a.bz)(),disabled:(0,a.lq)((0,a.zM)())})},10058(e,t,r){r.a(e,async function(e,t){try{var a=r(5124),o=r(22441),i=r(26638),n=r(40991),s=r(9395),l=r(717),c=r(31896),d=r(93137),h=r(17060),u=r(88496),v=r(23852),p=e([u,h]);[u,h]=p.then?(await p)():p;var m=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=(e,t,r,a)=>{for(var o,i=a>1?void 0:a?g(t,r):t,n=e.length-1;n>=0;n--)(o=e[n])&&(i=(a?o(t,r,i):o(i))||i);return a&&i&&m(t,r,i),i};let b=class extends l.A{handleSizeChange(){(0,n.b)(this.localName,this.size)}handleRemoveClick(){this.dispatchEvent(new i.x)}render(){return a.qy` <slot part="content" class="content"></slot> ${this.withRemove?a.qy` <wa-button part="remove-button" exportparts="base:remove-button__base" class="remove" appearance="plain" ="${this.handleRemoveClick}" tabindex="-1"> <wa-icon name="xmark" library="system" variant="solid" label="${this.localize.term("remove")}"></wa-icon> </wa-button> `:""} `}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}};b.css=[v.A,d.A,c.A],_([(0,o.MZ)({reflect:!0})],b.prototype,"variant",2),_([(0,o.MZ)({reflect:!0})],b.prototype,"appearance",2),_([(0,o.MZ)({reflect:!0})],b.prototype,"size",2),_([(0,s.w)("size")],b.prototype,"handleSizeChange",1),_([(0,o.MZ)({type:Boolean,reflect:!0})],b.prototype,"pill",2),_([(0,o.MZ)({attribute:"with-remove",type:Boolean})],b.prototype,"withRemove",2),b=_([(0,o.EM)("wa-tag")],b),t()}catch(e){t(e)}})},23852(e,t,r){r.d(t,{A:()=>a});var a=r(5124).AH` 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} (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(e,t,r){r.d(t,{x:()=>a});class a extends Event{constructor(){super("wa-remove",{bubbles:!0,cancelable:!1,composed:!0})}}}};