zigbee2mqtt-windfront
Version:
[](https://npmjs.org/package/zigbee2mqtt-windfront) [](https://github.com/Nerivec/zigbee2mqtt-windf
3 lines (2 loc) • 3.51 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-DQMExlfM.js","./index-Cg_dwqpD.js","./envs-CSqIi4cL.js","./index-UjZc6d-V.css","./RecallRemove-BrzsS3Vg.js","./DashboardFeatureWrapper-DAZ17bMu.js","./Feature-CgMuzQp3.js","./DisplayValue-DcXMP9Gf.js","./isObject--vsEa_js.js","./_createCompounder-Dcznv9Az.js","./isArray-uIIfUpwr.js","./index-BwjSpuUu.js","./InputField-D9KJc30P.js","./SelectField-dfeWrxvV.js","./DevicePicker-BKPECTmF.js","./EndpointPicker-Dnt0o2EO.js","./useColumnCount-B-PyuU0g.js","./DeviceCard-BQTqTIzx.js","./LastSeen-F90Gw0JI.js","./format-BHlbVbae.js","./Lqi-OUPQk-S2.js","./PowerSource-BDEov_ab.js","./snakeCase-CrKq36vi.js","./DeviceImage-CHwoOcls.js","./index-BbB5QEu8.js","./GroupSettings-DnkJ0ONP.js","./InfoAlert-B2RwtOeQ.js","./SettingsList-CDX9ME9V.js","./CheckboxField-D0wHGmUZ.js","./NumberField-Bz4sSMOV.js"])))=>i.map(i=>d[i]);
import{r as d,b as j,a as _,A as b,j as e,L as y,S as f,D as N,F as g,e as $,u as S,h as k,i as w,k as T,N as D,l as x,y as I,q as A,_ as v}from"./index-Cg_dwqpD.js";import{u as C}from"./useSearch-DX_EYdJN.js";import{D as E}from"./DebouncedInput-E4d1IUlA.js";import"./envs-CSqIi4cL.js";const L=d.memo(({currentSourceIdx:a,currentGroup:n,tab:t="devices"})=>{const[i,r,c]=C(),{t:u}=j("common"),p=_(s=>s.groups),l=d.useMemo(()=>{const s=[];for(let o=0;o<b.length;o++)for(const m of p[o])o===a&&m.id===n?.id||r.length>0&&!m.friendly_name.toLowerCase().includes(r)||s.push(e.jsx("li",{children:e.jsxs(y,{to:`/group/${o}/${m.id}/${t}`,onClick:()=>c(""),className:"dropdown-item",children:[e.jsx(f,{idx:o,autoHide:!0,namePostfix:" - "})," ",m.friendly_name]})},`${m.friendly_name}-${m.id}-${o}`));return s.sort((o,m)=>o.key.localeCompare(m.key)),s},[p,r,a,n,t,c]);return e.jsxs(N,{buttonChildren:e.jsxs(e.Fragment,{children:[a!==void 0&&e.jsx(f,{idx:a,autoHide:!0}),n?n.friendly_name:u(s=>s.unknown_group)]}),children:[e.jsxs("label",{className:"input min-h-10",children:[e.jsx(g,{icon:$}),e.jsx(E,{onChange:c,placeholder:u(s=>s.type_to_filter),value:i,title:u(s=>s.type_to_filter)})]},"search"),l]})}),P=d.lazy(async()=>await v(()=>import("./Devices-DQMExlfM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url)),F=d.lazy(async()=>await v(()=>import("./GroupSettings-DnkJ0ONP.js"),__vite__mapDeps([25,1,2,3,26,27,28,12,29,13]),import.meta.url));function R(a,n,t){const i=`${a}-${t.id}`;switch(n){case"devices":return e.jsx(P,{sourceIdx:a,group:t},i);case"settings":return e.jsx(F,{sourceIdx:a,group:t},i)}}const h=({isActive:a})=>a?"tab tab-active":"tab";function V(){const a=S(),{t:n}=j(["groups","common"]),{sourceIdx:t,groupId:i,tab:r}=k(),[c,u]=w(t),p=Number.parseInt(i,10),l=_(T(s=>i?s.groups[c].find(o=>o.id===p):void 0));return d.useEffect(()=>{t&&u&&l?r||a(`/group/${t}/${l.id}/devices`,{replace:!0}):a("/groups",{replace:!0})},[t,u,r,l,a]),e.jsxs(e.Fragment,{children:[e.jsx(D,{children:e.jsx(L,{currentSourceIdx:c,currentGroup:l,tab:r})}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(x,{to:`/group/${c}/${i}/devices`,className:h,children:[e.jsx(g,{icon:I,className:"me-2"}),n(s=>s.devices,{ns:"common"})]}),e.jsxs(x,{to:`/group/${c}/${i}/settings`,className:h,children:[e.jsx(g,{icon:A,className:"me-2"}),n(s=>s.settings)]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:r&&l?R(c,r,l):e.jsx("div",{className:"flex-auto justify-center items-center",children:n(s=>s.unknown_group,{ns:"common"})})})]})}export{V as default};