fix: keep Symcon binding paths compact and allow direct unlinking
This commit is contained in:
1 parent
00fca890de
commit
b9a095bc6e
12 files changed
+131
-46
No files matched your search
@@ -203,7 +203,7 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;var{I:tb}=ic,Md=t=>t;var Ed=t=>t.strings===void 0,Rd=()=>document.createComment(""),Fn=(t,e,n)=>{let r=t._$AA.parentNode,o=e===void 0?t._$AB:e._$AA;if(n===void 0){let i=r.insertBefore(Rd(),o),s=r.insertBefore(Rd(),o);n=new tb(i,s,t,t.options)}else{let i=n._$AB.nextSibling,s=n._$AM,l=s!==t;if(l){let a;n._$AQ?.(t),n._$AM=t,n._$AP!==void 0&&(a=t._$AU)!==s._$AU&&n._$AP(a)}if(i!==o||l){let a=n._$AA;for(;a!==i;){let c=Md(a).nextSibling;Md(r).insertBefore(a,o),a=c}}}return n},It=(t,e,n=t)=>(t._$AI(e,n),t),nb={},Ad=(t,e=nb)=>t._$AH=e,Fd=t=>t._$AH,Yo=t=>{t._$AR(),t._$AA.remove()};var Td=(t,e,n)=>{let r=new Map;for(let o=e;o<=n;o++)r.set(t[o],o);return r},zd=Qt(class extends Pt{constructor(t){if(super(t),t.type!==En.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,n){let r;n===void 0?n=e:e!==void 0&&(r=e);let o=[],i=[],s=0;for(let l of t)o[s]=r?r(l,s):s,i[s]=n(l,s),s++;return{values:i,keys:o}}render(t,e,n){return this.dt(t,e,n).values}update(t,[e,n,r]){let o=Fd(t),{values:i,keys:s}=this.dt(e,n,r);if(!Array.isArray(o))return this.ut=s,i;let l=this.ut??=[],a=[],c,d,u=0,p=o.length-1,h=0,f=i.length-1;for(;u<=p&&h<=f;)if(o[u]===null)u++;else if(o[p]===null)p--;else if(l[u]===s[h])a[h]=It(o[u],i[h]),u++,h++;else if(l[p]===s[f])a[f]=It(o[p],i[f]),p--,f--;else if(l[u]===s[f])a[f]=It(o[u],i[f]),Fn(t,a[f+1],o[u]),u++,f--;else if(l[p]===s[h])a[h]=It(o[p],i[h]),Fn(t,o[u],o[p]),p--,h++;else if(c===void 0&&(c=Td(s,h,f),d=Td(l,u,p)),c.has(l[u]))if(c.has(l[p])){let g=d.get(s[h]),y=g!==void 0?o[g]:null;if(y===null){let b=Fn(t,o[u]);It(b,i[h]),a[h]=b}else a[h]=It(y,i[h]),Fn(t,o[u],y),o[g]=null;h++}else Yo(o[p]),p--;else Yo(o[u]),u++;for(;h<=f;){let g=Fn(t,a[f+1]);It(g,i[h]),a[h++]=g}for(;u<=p;){let g=o[u++];g!==null&&Yo(g)}return this.ut=s,Ad(t,a),Qe}});var rb=new Intl.Collator("de",{numeric:!0,sensitivity:"base"}),zs=-1,Id=[{type:1,name:"I/O"},{type:2,name:"Splitter"},{type:0,name:"Kerninstanzen"},{type:4,name:"Konfiguratoren"},{type:5,name:"Discovery"},{type:6,name:"Visualisierungen"}],Pd=t=>t.object_type===1&&Id.some(e=>e.type===t.module_type);function ob(t){let e=new Map(t.map(a=>[a.object_id,a])),n=t.filter(a=>{if(!Pd(a))return!1;let c=new Set([a.object_id]),d=e.get(a.parent_id);for(;d&&!c.has(d.object_id);){if(Pd(d))return!1;c.add(d.object_id),d=e.get(d.parent_id)}return!0});if(!n.length)return t;let r=new Map(e),o=new Map;for(let a of t){let c=o.get(a.parent_id)??[];c.push(a),o.set(a.parent_id,c)}let i=(a,c,d,u,p)=>({object_id:a,parent_id:c,name:d,path:u,position:p,object_type:0,hidden:!1,icon:"",virtual:!0});r.set(zs,i(zs,0,"System","System",Number.MAX_SAFE_INTEGER));let s=new Set,l=(a,c,d)=>{if(s.has(a.object_id))return;s.add(a.object_id);let u={...a,parent_id:c,path:`${d} / ${a.name}`};r.set(a.object_id,u);for(let p of o.get(a.object_id)??[])l(p,a.object_id,u.path)};return Id.forEach((a,c)=>{let d=n.filter(h=>h.module_type===a.type);if(!d.length)return;let u=-10-a.type,p=`System / ${a.name}`;r.set(u,i(u,zs,a.name,p,c));for(let h of d)l(h,u,p)}),[...r.values()]}function Ps(t){let e=ob(t),n=new Map(e.map(o=>[o.object_id,o])),r=new Map;for(let o of e){let i=n.has(o.parent_id)?o.parent_id:0,s=r.get(i)??[];s.push(o),r.set(i,s)}for(let o of r.values())o.sort((i,s)=>i.position-s.position||i.object_type-s.object_type||rb.compare(i.name,s.name));return{nodes:n,children:r}}function Is(t,e){let n=[],r=new Set([e]),o=t.nodes.get(e)?.parent_id;for(;o&&!r.has(o)&&t.nodes.has(o);)n.push(o),r.add(o),o=t.nodes.get(o)?.parent_id;return n}function Ds(t,e,n=""){let r=n.trim().toLocaleLowerCase("de").split(/\s+/).filter(Boolean),o=r.length?new Set:null;if(o){for(let a of t.nodes.values())if(r.every(c=>`${a.name} ${a.path}`.toLocaleLowerCase("de").includes(c))){o.add(a.object_id);for(let c of Is(t,a.object_id))o.add(c)}}let i=[],s=new Set,l=(a,c)=>{let d=(t.children.get(a)??[]).filter(u=>!o||o.has(u.object_id));d.forEach((u,p)=>{if(s.has(u.object_id))return;s.add(u.object_id);let h=(t.children.get(u.object_id)?.length??0)>0,f=h&&(!!o||e.has(u.object_id));i.push({node:u,depth:c,hasChildren:h,expanded:f,index:p+1,siblings:d.length}),f&&l(u.object_id,c+1)})};return l(0,0),i}var ib=["Kategorie","Instanz","Variable","Skript","Ereignis","Medium","Link"],Os=class extends Q{static properties={objects:{attribute:!1},options:{attribute:!1},fixed:{attribute:!1},value:{attribute:!1},disabled:{type:Boolean},placeholder:{attribute:!1},_query:{state:!0},_expanded:{state:!0},_pending:{state:!0},_active:{state:!0},_selected:{state:!0}};tree=Ps([]);allowed=new Map;allowedSources=new Map;constructor(){super(),this.objects=[],this.options=[],this.fixed=[],this.value=null,this.disabled=!1,this.placeholder="Datenpunkt ausw\xE4hlen",this._query="",this._expanded=new Set,this._pending=null,this._active=null,this._selected=null}willUpdate(e){e.has("objects")&&(this.tree=Ps(this.objects)),(e.has("options")||e.has("fixed"))&&(this.allowed=new Map([...this.fixed,...this.options].map(n=>[n.id,n])),this.allowedSources=new Map(this.options.filter(n=
Line truncated
|
||||
`;var{I:tb}=ic,Md=t=>t;var Ed=t=>t.strings===void 0,Rd=()=>document.createComment(""),Fn=(t,e,n)=>{let r=t._$AA.parentNode,o=e===void 0?t._$AB:e._$AA;if(n===void 0){let i=r.insertBefore(Rd(),o),s=r.insertBefore(Rd(),o);n=new tb(i,s,t,t.options)}else{let i=n._$AB.nextSibling,s=n._$AM,l=s!==t;if(l){let a;n._$AQ?.(t),n._$AM=t,n._$AP!==void 0&&(a=t._$AU)!==s._$AU&&n._$AP(a)}if(i!==o||l){let a=n._$AA;for(;a!==i;){let c=Md(a).nextSibling;Md(r).insertBefore(a,o),a=c}}}return n},It=(t,e,n=t)=>(t._$AI(e,n),t),nb={},Ad=(t,e=nb)=>t._$AH=e,Fd=t=>t._$AH,Yo=t=>{t._$AR(),t._$AA.remove()};var Td=(t,e,n)=>{let r=new Map;for(let o=e;o<=n;o++)r.set(t[o],o);return r},zd=Qt(class extends Pt{constructor(t){if(super(t),t.type!==En.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,n){let r;n===void 0?n=e:e!==void 0&&(r=e);let o=[],i=[],s=0;for(let l of t)o[s]=r?r(l,s):s,i[s]=n(l,s),s++;return{values:i,keys:o}}render(t,e,n){return this.dt(t,e,n).values}update(t,[e,n,r]){let o=Fd(t),{values:i,keys:s}=this.dt(e,n,r);if(!Array.isArray(o))return this.ut=s,i;let l=this.ut??=[],a=[],c,d,u=0,p=o.length-1,h=0,f=i.length-1;for(;u<=p&&h<=f;)if(o[u]===null)u++;else if(o[p]===null)p--;else if(l[u]===s[h])a[h]=It(o[u],i[h]),u++,h++;else if(l[p]===s[f])a[f]=It(o[p],i[f]),p--,f--;else if(l[u]===s[f])a[f]=It(o[u],i[f]),Fn(t,a[f+1],o[u]),u++,f--;else if(l[p]===s[h])a[h]=It(o[p],i[h]),Fn(t,o[u],o[p]),p--,h++;else if(c===void 0&&(c=Td(s,h,f),d=Td(l,u,p)),c.has(l[u]))if(c.has(l[p])){let g=d.get(s[h]),y=g!==void 0?o[g]:null;if(y===null){let b=Fn(t,o[u]);It(b,i[h]),a[h]=b}else a[h]=It(y,i[h]),Fn(t,o[u],y),o[g]=null;h++}else Yo(o[p]),p--;else Yo(o[u]),u++;for(;h<=f;){let g=Fn(t,a[f+1]);It(g,i[h]),a[h++]=g}for(;u<=p;){let g=o[u++];g!==null&&Yo(g)}return this.ut=s,Ad(t,a),Qe}});var rb=new Intl.Collator("de",{numeric:!0,sensitivity:"base"}),zs=-1,Id=[{type:1,name:"I/O"},{type:2,name:"Splitter"},{type:0,name:"Kerninstanzen"},{type:4,name:"Konfiguratoren"},{type:5,name:"Discovery"},{type:6,name:"Visualisierungen"}],Pd=t=>t.object_type===1&&Id.some(e=>e.type===t.module_type);function ob(t){let e=new Map(t.map(a=>[a.object_id,a])),n=t.filter(a=>{if(!Pd(a))return!1;let c=new Set([a.object_id]),d=e.get(a.parent_id);for(;d&&!c.has(d.object_id);){if(Pd(d))return!1;c.add(d.object_id),d=e.get(d.parent_id)}return!0});if(!n.length)return t;let r=new Map(e),o=new Map;for(let a of t){let c=o.get(a.parent_id)??[];c.push(a),o.set(a.parent_id,c)}let i=(a,c,d,u,p)=>({object_id:a,parent_id:c,name:d,path:u,position:p,object_type:0,hidden:!1,icon:"",virtual:!0});r.set(zs,i(zs,0,"System","System",Number.MAX_SAFE_INTEGER));let s=new Set,l=(a,c,d)=>{if(s.has(a.object_id))return;s.add(a.object_id);let u={...a,parent_id:c,path:`${d} / ${a.name}`};r.set(a.object_id,u);for(let p of o.get(a.object_id)??[])l(p,a.object_id,u.path)};return Id.forEach((a,c)=>{let d=n.filter(h=>h.module_type===a.type);if(!d.length)return;let u=-10-a.type,p=`System / ${a.name}`;r.set(u,i(u,zs,a.name,p,c));for(let h of d)l(h,u,p)}),[...r.values()]}function Ps(t){let e=ob(t),n=new Map(e.map(o=>[o.object_id,o])),r=new Map;for(let o of e){let i=n.has(o.parent_id)?o.parent_id:0,s=r.get(i)??[];s.push(o),r.set(i,s)}for(let o of r.values())o.sort((i,s)=>i.position-s.position||i.object_type-s.object_type||rb.compare(i.name,s.name));return{nodes:n,children:r}}function Is(t,e){let n=[],r=new Set([e]),o=t.nodes.get(e)?.parent_id;for(;o&&!r.has(o)&&t.nodes.has(o);)n.push(o),r.add(o),o=t.nodes.get(o)?.parent_id;return n}function Ds(t,e,n=""){let r=n.trim().toLocaleLowerCase("de").split(/\s+/).filter(Boolean),o=r.length?new Set:null;if(o){for(let a of t.nodes.values())if(r.every(c=>`${a.name} ${a.path}`.toLocaleLowerCase("de").includes(c))){o.add(a.object_id);for(let c of Is(t,a.object_id))o.add(c)}}let i=[],s=new Set,l=(a,c)=>{let d=(t.children.get(a)??[]).filter(u=>!o||o.has(u.object_id));d.forEach((u,p)=>{if(s.has(u.object_id))return;s.add(u.object_id);let h=(t.children.get(u.object_id)?.length??0)>0,f=h&&(!!o||e.has(u.object_id));i.push({node:u,depth:c,hasChildren:h,expanded:f,index:p+1,siblings:d.length}),f&&l(u.object_id,c+1)})};return l(0,0),i}var ib=["Kategorie","Instanz","Variable","Skript","Ereignis","Medium","Link"],Os=class extends Q{static properties={objects:{attribute:!1},options:{attribute:!1},fixed:{attribute:!1},value:{attribute:!1},disabled:{type:Boolean},placeholder:{attribute:!1},_query:{state:!0},_expanded:{state:!0},_pending:{state:!0},_active:{state:!0},_selected:{state:!0}};tree=Ps([]);allowed=new Map;allowedSources=new Map;constructor(){super(),this.objects=[],this.options=[],this.fixed=[],this.value=null,this.disabled=!1,this.placeholder="Datenpunkt ausw\xE4hlen",this._query="",this._expanded=new Set,this._pending=null,this._active=null,this._selected=null}willUpdate(e){e.has("objects")&&(this.tree=Ps(this.objects)),(e.has("options")||e.has("fixed"))&&(this.allowed=new Map([...this.fixed,...this.options].map(n=>[n.id,n])),this.allowedSources=new Map(this.options.filter(n=
Line truncated
|
||||
aria-level=${e.depth+1} aria-posinset=${e.index} aria-setsize=${e.siblings}
|
||||
aria-expanded=${e.hasChildren?String(e.expanded):_}
|
||||
aria-selected=${o?String(n.object_id===this._selected&&r===this._pending):_}
|
||||
@@ -219,22 +219,22 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
||||
${this.icon(n.object_type)}<span class="node-name">${n.name||"(Ohne Namen)"}</span>
|
||||
<small>${n.virtual?"Systembereich":ib[n.object_type]??"Objekt"}${n.hidden?" \xB7 ausgeblendet":""}</small>
|
||||
${o&&n.object_id===this._selected&&r===this._pending?m`<span class="selected-mark" aria-hidden="true">✓</span>`:_}
|
||||
</div>`}render(){let e=this.allowed.get(this.value??""),n=this.variableNode(this.value),r=this.allowed.get(this._pending??""),o=this._selected===null?void 0:this.tree.nodes.get(this._selected),i=(o&&this.entityFor(o)===this._pending?o:void 0)??this.variableNode(this._pending),s=Ds(this.tree,this._expanded,this._query),l=s.find(a=>a.node.object_id===this._active);return m`<button type="button" class="trigger" ?disabled=${this.disabled} aria-haspopup="dialog" @click=${this.open}>
|
||||
<span><strong>${n?.name??e?.label??"Datenpunkt ausw\xE4hlen"}</strong>
|
||||
${n?m`<small>${n.path}</small>`:_}</span><span aria-hidden="true">⌘</span>
|
||||
</button>
|
||||
<dialog aria-labelledby="picker-title" @click=${a=>{if(a.stopPropagation(),a.target===this.dialog){let c=this.dialog.getBoundingClientRect();(a.clientX<c.left||a.clientX>c.right||a.clientY<c.top||a.clientY>c.bottom)&&this.close()}}} @keydown=${a=>a.stopPropagation()} @change=${a=>a.stopPropagation()}>
|
||||
</div>`}render(){let e=this.allowed.get(this.value??""),n=this.variableNode(this.value),r=this.allowed.get(this._pending??""),o=this._selected===null?void 0:this.tree.nodes.get(this._selected),i=(o&&this.entityFor(o)===this._pending?o:void 0)??this.variableNode(this._pending),s=Ds(this.tree,this._expanded,this._query),l=s.find(c=>c.node.object_id===this._active),a=!!this.value&&!this.fixed.some(c=>c.id===this.value);return m`<div class="field"><button type="button" class="trigger" ?disabled=${this.disabled} aria-haspopup="dialog" @click=${this.open}>
|
||||
<span class="trigger-text"><strong>${n?.name??e?.label??"Datenpunkt ausw\xE4hlen"}</strong>
|
||||
${n?m`<small title=${n.path}>${n.path}</small>`:_}</span><span class="picker-icon" aria-hidden="true">⌘</span>
|
||||
</button>${a?m`<button class="clear" type="button" ?disabled=${this.disabled} aria-label="Verknüpfung entfernen" title="Verknüpfung entfernen" @click=${this.clear}>×</button>`:_}</div>
|
||||
<dialog aria-labelledby="picker-title" @click=${c=>{if(c.stopPropagation(),c.target===this.dialog){let d=this.dialog.getBoundingClientRect();(c.clientX<d.left||c.clientX>d.right||c.clientY<d.top||c.clientY>d.bottom)&&this.close()}}} @keydown=${c=>c.stopPropagation()} @change=${c=>c.stopPropagation()}>
|
||||
<header><div><h2 id="picker-title">Datenpunkt auswählen</h2><p>IP-Symcon · Objektbaum</p></div>
|
||||
<button class="close" type="button" aria-label="Schließen" @click=${this.close}>×</button></header>
|
||||
<div class="search-bar"><input class="search" type="search" placeholder="Im Objektbaum suchen …" aria-label="Objektbaum durchsuchen"
|
||||
.value=${this._query} @input=${a=>{this._query=a.target.value,this._active=null}}>
|
||||
.value=${this._query} @input=${c=>{this._query=c.target.value,this._active=null}}>
|
||||
<button class="text-button" type="button" @click=${()=>{this._query="",this._expanded=new Set,this._active=null}}>Alles zuklappen</button>
|
||||
</div>
|
||||
${this.fixed.length?m`<div class="fixed" aria-label="Weitere Auswahlmöglichkeiten">${this.fixed.map(a=>m`
|
||||
<button type="button" aria-pressed=${a.id===this._pending} @click=${()=>{this._pending=a.id,this._active=null,this._selected=null}}>${a.label}</button>`)}</div>`:_}
|
||||
${this.fixed.length?m`<div class="fixed" aria-label="Weitere Auswahlmöglichkeiten">${this.fixed.map(c=>m`
|
||||
<button type="button" aria-pressed=${c.id===this._pending} @click=${()=>{this._pending=c.id,this._active=null,this._selected=null}}>${c.label}</button>`)}</div>`:_}
|
||||
<div class="tree" role="tree" tabindex="0" aria-label="Symcon-Objektbaum" aria-activedescendant=${l?`object-${l.node.object_id}`:_}
|
||||
@keydown=${this.onTreeKey}>
|
||||
${zd(s,a=>a.node.object_id,a=>this.renderRow(a))}
|
||||
${zd(s,c=>c.node.object_id,c=>this.renderRow(c))}
|
||||
${s.length?_:m`<p class="empty">${this.objects.length?"Keine Objekte gefunden.":"Kein Objektbaum verf\xFCgbar. Bitte das Symcon-Modul aktualisieren und den Designer neu laden."}</p>`}
|
||||
</div>
|
||||
<footer><div class="selection"><strong>${i?.name??r?.label??"Noch kein Datenpunkt ausgew\xE4hlt"}</strong>
|
||||
@@ -243,13 +243,17 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
||||
<button class="apply" type="button" ?disabled=${this.disabled||!r} @click=${this.commit}>Übernehmen</button></div>
|
||||
</footer>
|
||||
</dialog>`}static styles=[ye,re`
|
||||
:host { display:block; min-width:0; font:inherit; color:var(--nf-text); }
|
||||
:host { display:block; min-width:0; max-width:100%; font:inherit; color:var(--nf-text); }
|
||||
button,input { font:inherit; box-sizing:border-box; }
|
||||
button { cursor:pointer; color:var(--nf-text); border:1px solid var(--nf-line); background:var(--nf-chrome-solid); border-radius:9px; padding:8px 12px; }
|
||||
button:disabled { opacity:.45; cursor:default; }
|
||||
button:focus-visible,input:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; }
|
||||
.trigger { width:100%; display:flex; align-items:center; justify-content:space-between; text-align:left; gap:12px; padding:9px 11px; }
|
||||
.trigger>span:first-child { min-width:0; }
|
||||
.field { display:flex; gap:6px; min-width:0; }
|
||||
.trigger { flex:1; min-width:0; width:100%; display:flex; align-items:center; justify-content:space-between; text-align:left; gap:12px; padding:9px 11px; }
|
||||
.trigger-text { flex:1; min-width:0; overflow:hidden; }
|
||||
.trigger strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||
.picker-icon { flex:none; }
|
||||
.clear { flex:none; width:32px; padding:0; font-size:22px; }
|
||||
strong { font-weight:500; } small { display:block; color:var(--nf-muted); font-size:11px; }
|
||||
.trigger small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-top:3px; }
|
||||
dialog { width:min(780px,calc(100vw - 32px)); max-width:none; height:min(690px,calc(100dvh - 32px)); max-height:none; box-sizing:border-box; padding:0; border:1px solid var(--nf-line); border-radius:16px; color:var(--nf-text); background:var(--nf-chrome-solid); box-shadow:0 24px 80px #0008; font:14px system-ui,sans-serif; }
|
||||
@@ -322,6 +326,8 @@ var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
@@ -986,7 +992,7 @@ ${i}`}else o=eh(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
|
||||
${M(t.t("devices_panel_hint"))}
|
||||
${t.admin?m`<div class="nf-seg nf-dev-source">${d.map(([p,h])=>m`<button aria-pressed=${a===p} @click=${()=>e.deviceSource=p}>${h}</button>`)}</div>`:_}
|
||||
${a!=="area"?m`${u}${Ov(t,e,n,l,a)}`:Hv(t,e,n,l,s,i,r)}
|
||||
</section>`}function Np(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=cd(r,t.floor??null,{...e,climate:null},l),d=[e.climate?.[l]??null].flat(),u=L(r,y=>As(r,y,l,!0)&&(!r.states[y]?.attributes.symcon_source_entity||d.includes(y))),p=Lp(u,y=>(Ft(r,y)===e.area_id?0:1)+(Fs(r,y)?0:2)),h=y=>{let b=y.filter(w=>!!w&&w!=="none");i(l,y[0]==="none"?"none":b.length>1?b:b[0]??null)},g=d[0]&&d[0]!=="none"?[...d,null]:d;return g.map((y,b)=>z(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,p,w=>h(g.map((v,x)=>x===b?w:v))))};return m`<details class="nf-points" ?open=${o||!!e.climate_card}>
|
||||
</section>`}function Np(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=cd(r,t.floor??null,{...e,climate:null},l),d=[e.climate?.[l]??null].flat(),u=L(r,y=>As(r,y,l,!0)&&(!r.states[y]?.attributes.symcon_source_entity||d.includes(y))),p=Lp(u,y=>(Ft(r,y)===e.area_id?0:1)+(Fs(r,y)?0:2)),h=y=>{let b=y.filter(w=>!!w&&w!=="none");i(l,b.length>1?b:b[0]??(y.includes("none")?"none":null))},g=d[0]&&d[0]!=="none"?[...d,null]:d;return g.map((y,b)=>z(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,p,w=>h(g.map((v,x)=>x===b?w:v))))};return m`<details class="nf-points" ?open=${o||!!e.climate_card}>
|
||||
<summary>${t.t("climate")}</summary>
|
||||
<div class="nf-form">${s("temperature",t.t("climate_temperature"))} ${s("humidity",t.t("climate_humidity"))} ${s("co2",t.t("climate_co2"))} ${s("illuminance",t.t("climate_illuminance"))}</div>
|
||||
${O(t,t.t("climate_card"),!!e.climate_card,l=>n({climate_card:l||void 0}))}
|
||||
|
||||
Reference in new issue
Block a user