react-shadcn-table 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +15 -10
- package/dist/package/features/index.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A feature-rich, headless-powered data grid for React — built on [TanStack Tabl
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- Global search + per-column filtering (text, range)
|
|
9
|
+
- Global search + per-column filtering (text, range, select)
|
|
10
10
|
- Multi-column sorting
|
|
11
11
|
- Client-side & manual (server-side) pagination
|
|
12
12
|
- Row selection with checkboxes
|
|
@@ -102,6 +102,68 @@ const { data, isLoading, isError, refetch, isFetching } = useUsersQuery({
|
|
|
102
102
|
/>;
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
## Column Filters
|
|
106
|
+
|
|
107
|
+
Each column opts into a filter UI via `meta.filterVariant`. Supported variants: `text`, `number`, `tel`, `url`, `color`, `range`, `select`, `dateRange`, `date`, `datetime-local`, `month`, `time`, `week`, `search`.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
{
|
|
111
|
+
id: 'status',
|
|
112
|
+
accessorKey: 'status',
|
|
113
|
+
filterFn: 'equalsString',
|
|
114
|
+
header: () => <div>Status</div>,
|
|
115
|
+
meta: {
|
|
116
|
+
filterVariant: 'text',
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Select Filters with `options`
|
|
122
|
+
|
|
123
|
+
For `filterVariant: 'select'`, provide a static `options` array in `meta` to control exactly what appears in the dropdown — instead of the grid deriving choices from the values currently loaded in the table (via faceted unique values). This is the recommended approach whenever you know the fixed set of values up front (enums, statuses, categories), especially with `manualFiltering`, where the faceted values are only ever a subset of what's on the server.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
{
|
|
127
|
+
id: 'status',
|
|
128
|
+
accessorKey: 'status',
|
|
129
|
+
filterFn: 'equalsString',
|
|
130
|
+
header: () => <div>Status</div>,
|
|
131
|
+
meta: {
|
|
132
|
+
filterVariant: 'select',
|
|
133
|
+
options: [
|
|
134
|
+
{ label: 'Pending', value: 'pending' },
|
|
135
|
+
{ label: 'Preparing', value: 'preparing' },
|
|
136
|
+
{ label: 'Ready', value: 'ready' },
|
|
137
|
+
{ label: 'Completed', value: 'completed' },
|
|
138
|
+
{ label: 'Cancelled', value: 'cancelled' },
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Shape:**
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
options?: { label: string; value: string }[];
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- `label` — text shown in the dropdown item.
|
|
151
|
+
- `value` — value sent through `column.setFilterValue(...)` and applied by your `filterFn`.
|
|
152
|
+
|
|
153
|
+
**Fallback behavior:** if `options` is omitted (or empty) on a `select` column, the grid falls back to deriving choices from `column.getFacetedUniqueValues()` — useful for ad hoc/free-form columns where the value set isn't known ahead of time, but only reliable for values present in the currently loaded page of data.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
// No static options — dropdown is populated from values seen in loaded rows
|
|
157
|
+
{
|
|
158
|
+
id: 'driver',
|
|
159
|
+
accessorKey: 'driver',
|
|
160
|
+
header: () => <div>Driver</div>,
|
|
161
|
+
meta: {
|
|
162
|
+
filterVariant: 'select',
|
|
163
|
+
},
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
105
167
|
## Toolbar Actions
|
|
106
168
|
|
|
107
169
|
Add custom action buttons to the toolbar via `topRightSlot`:
|
|
@@ -171,6 +233,13 @@ const selectedIds = pluckSelected(data, rowSelection, 'id');
|
|
|
171
233
|
| `name` | `string` | `'munza'` | Storage key for persisting per-grid layout |
|
|
172
234
|
| `topRightSlot` | `React.ReactNode` | — | Custom content on the right of the toolbar (e.g. action buttons) |
|
|
173
235
|
|
|
236
|
+
### Column `meta` (`MyColumnMeta`)
|
|
237
|
+
|
|
238
|
+
| Field | Type | Description |
|
|
239
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
240
|
+
| `filterVariant` | `'text' \| 'number' \| 'tel' \| 'url' \| 'color' \| 'range' \| 'select' \| 'dateRange' \| 'date' \| 'datetime-local' \| 'month' \| 'time' \| 'week' \| 'search'` | Which filter UI to render in the column header |
|
|
241
|
+
| `options` | `{ label: string; value: string }[]` | Static choices for `filterVariant: 'select'`. Falls back to `getFacetedUniqueValues()` when omitted. |
|
|
242
|
+
|
|
174
243
|
### `useGridState()`
|
|
175
244
|
|
|
176
245
|
Manages all controlled state required by `<Grid />`.
|
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
transform: rotate(360deg);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`}),(0,f.jsx)(p.Loader,{size:16,style:{animation:`grid-skeleton-spin 1s linear infinite`}})]}):[`actions`,`pin`,`drag-handle`,`rowNumber`].includes(e.id)?(0,f.jsx)(Qn,{style:{width:`100%`,height:`16px`}}):(0,f.jsx)(Qn,{style:{width:`${$n[(t+n)%$n.length]}px`,height:`16px`}})}),tr=()=>{let{table:e,isSplit:t}=L(),n=(t?e.getCenterHeaderGroups():e.getHeaderGroups()).map(e=>e.headers.filter(e=>!e.isPlaceholder&&!e.subHeaders?.length).map(e=>e.column)).flat();return(0,f.jsx)(Y,{style:{width:e.getCenterTotalSize()},children:(0,f.jsx)(X,{children:[...Array(20)].map((r,i)=>(0,f.jsx)(Z,{children:n.map((n,r)=>(0,f.jsx)(Q,{style:{width:n.getSize(),minWidth:n.getSize(),maxWidth:n.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,transition:`padding 0.2s`,padding:e.state.density===`sm`?`4px`:e.state.density===`md`?`8px`:`16px`,...Fn(n,t)},children:(0,f.jsx)(er,{column:n,i,j:r})},r))},i))})})};function nr({row:e}){"use no memo";let{table:t,isSplit:n}=L();return(0,f.jsx)(Z,{style:{backgroundColor:`blue`,position:`sticky`,zIndex:10,top:e.getIsPinned()===`top`?`calc(${e.getPinnedIndex()} * var(--cell-h))`:void 0,bottom:e.getIsPinned()===`bottom`?`calc(${t.getBottomRows().length-1-e.getPinnedIndex()} * var(--cell-h))`:void 0},children:(n?e.getCenterVisibleCells():e.getVisibleCells()).map(e=>(0,f.jsx)(Ln,{cell:e},e.id))})}var rr=()=>{"use no memo";let{table:e,isSplit:t,isLoading:n,isError:r,renderSubComponent:i}=L();return n?(0,f.jsx)(tr,{}):r?(0,f.jsx)(Zn,{}):e.getRowModel().rows.length===0?(0,f.jsx)(Jn,{}):(0,f.jsxs)(Y,{style:{width:e.getCenterTotalSize()},children:[e.getTopRows().map(e=>(0,f.jsx)(nr,{row:e},e.id)),(0,f.jsx)(X,{children:e.getRowModel().rows.map(e=>(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Z,{"data-state":e.getIsSelected()&&`selected`,children:(t?e.getCenterVisibleCells():e.getVisibleCells()).map(e=>(0,f.jsx)(Ln,{cell:e},e.id))}),i&&e.getIsExpanded()&&(0,f.jsx)(Z,{children:(0,f.jsx)(Q,{colSpan:e.getVisibleCells().length,children:i({row:e})})})]},e.id))}),e.getBottomRows().map(e=>(0,f.jsx)(nr,{row:e},e.id))]})};function ir({...e}){return(0,f.jsx)(m.Select.Root,{"data-slot":`select`,...e})}function ar({className:e,...t}){return(0,f.jsx)(m.Select.Group,{"data-slot":`select-group`,className:q(`scroll-my-1 p-1`,e),...t})}function or({...e}){return(0,f.jsx)(m.Select.Value,{"data-slot":`select-value`,...e})}function sr({className:e,size:t=`default`,children:n,...r}){return(0,f.jsxs)(m.Select.Trigger,{"data-slot":`select-trigger`,"data-size":t,className:q(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,f.jsx)(m.Select.Icon,{asChild:!0,children:(0,f.jsx)(p.ChevronDownIcon,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function cr({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,f.jsx)(m.Select.Portal,{children:(0,f.jsxs)(m.Select.Content,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:q(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,f.jsx)(ur,{}),(0,f.jsx)(m.Select.Viewport,{"data-position":n,className:q(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,f.jsx)(dr,{})]})})}function lr({className:e,children:t,...n}){return(0,f.jsxs)(m.Select.Item,{"data-slot":`select-item`,className:q(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,f.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,f.jsx)(m.Select.ItemIndicator,{children:(0,f.jsx)(p.CheckIcon,{className:`pointer-events-none`})})}),(0,f.jsx)(m.Select.ItemText,{children:t})]})}function ur({className:e,...t}){return(0,f.jsx)(m.Select.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:q(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,f.jsx)(p.ChevronUpIcon,{})})}function dr({className:e,...t}){return(0,f.jsx)(m.Select.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:q(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,f.jsx)(p.ChevronDownIcon,{})})}var fr=({column:e})=>{"use no memo";let t=e.getFilterValue(),{filterVariant:n}=e.columnDef.meta??{},{isFetching:r}=L(),i=!r&&n===`select`?Array.from(e.getFacetedUniqueValues().keys()).sort().slice(0,5e3):[];return e.getCanFilter()?(0,f.jsx)(`div`,{style:{padding:`4px`,width:`100%`,borderTop:`1px solid var(--border)`},children:n===`range`?(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`4px`},children:[(0,f.jsx)(J,{style:{height:`28px`},type:`number`,value:t?.[0]??``,onChange:t=>e.setFilterValue(e=>[t,e?.[1]]),placeholder:`Min`}),(0,f.jsx)(J,{style:{height:`28px`},type:`number`,value:t?.[1]??``,onChange:t=>e.setFilterValue(e=>[e?.[0],t]),placeholder:`Max`})]}):n===`select`?(0,f.jsxs)(ir,{value:t?.toString()??`all`,onValueChange:t=>e.setFilterValue(t===`all`?void 0:t),children:[(0,f.jsx)(sr,{style:{width:`100%`},size:`sm`,children:(0,f.jsx)(or,{})}),(0,f.jsx)(cr,{children:(0,f.jsxs)(ar,{children:[(0,f.jsx)(lr,{value:`all`,children:`All`}),i.map(e=>(0,f.jsx)(lr,{value:String(e),children:String(e)},String(e)))]})})]}):n&&[`text`,`time`,`date`,`datetime-local`,`month`,`week`,`number`,`tel`,`url`,`color`,`search`].includes(n)?(0,f.jsx)(J,{style:{height:`28px`},onChange:t=>e.setFilterValue(t),placeholder:`Search...`,type:n,value:t??``}):(0,f.jsx)(`div`,{style:{height:`28px`,opacity:0,visibility:`hidden`}})}):null};function pr({...e}){return(0,f.jsx)(m.DropdownMenu.Root,{"data-slot":`dropdown-menu`,...e})}function mr({...e}){return(0,f.jsx)(m.DropdownMenu.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function hr({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,f.jsx)(m.DropdownMenu.Portal,{children:(0,f.jsx)(m.DropdownMenu.Content,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:q(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function gr({...e}){return(0,f.jsx)(m.DropdownMenu.Group,{"data-slot":`dropdown-menu-group`,...e})}function _r({className:e,inset:t,variant:n=`default`,...r}){return(0,f.jsx)(m.DropdownMenu.Item,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:q(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function vr({className:e,...t}){return(0,f.jsx)(m.DropdownMenu.Separator,{"data-slot":`dropdown-menu-separator`,className:q(`-mx-1 my-1 h-px bg-border`,e),...t})}function yr({className:e,...t}){return(0,f.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:q(`ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground`,e),...t})}var br=({header:e})=>{"use no memo";let{isLoading:t,isError:n}=L();return e.column.getCanFilter()?(0,f.jsxs)(pr,{children:[(0,f.jsx)(mr,{asChild:!0,children:(0,f.jsx)($,{size:`icon-xs`,variant:`ghost`,disabled:t||n,children:(0,f.jsx)(p.EllipsisVertical,{})})}),(0,f.jsxs)(hr,{align:`end`,children:[(0,f.jsxs)(gr,{children:[(0,f.jsxs)(_r,{onClick:()=>{e.column.toggleSorting(!1)},disabled:!e.column.getCanSort(),children:[`Sort ASC`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.ArrowUp,{})})]}),(0,f.jsxs)(_r,{onClick:()=>{e.column.toggleSorting(!0)},disabled:!e.column.getCanSort(),children:[`Sort DESC`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.ArrowDown,{})})]})]}),(0,f.jsx)(vr,{}),!e.isPlaceholder&&e.column.getCanPin()&&(0,f.jsxs)(gr,{children:[e.column.getIsPinned()!==`start`&&(0,f.jsxs)(_r,{onClick:()=>{e.column.pin(`start`)},children:[`Pin to left`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.PinIcon,{style:{transform:`rotate(45deg)`}})})]}),e.column.getIsPinned()&&(0,f.jsxs)(_r,{onClick:()=>{e.column.pin(!1)},children:[`Unpin`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.PinOff,{})})]}),e.column.getIsPinned()!==`end`&&(0,f.jsxs)(_r,{onClick:()=>{e.column.pin(`end`)},children:[`Pin to right`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.PinIcon,{style:{transform:`rotate(-45deg)`}})})]})]}),(0,f.jsx)(vr,{}),(0,f.jsx)(gr,{children:(0,f.jsxs)(_r,{onClick:()=>{e.column.toggleVisibility(!1)},disabled:!e.column.getCanHide(),children:[`Hide column`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.EyeOff,{})})]})})]})]}):null},xr=({header:e})=>{"use no memo";let t=e.column.getIsResizing();return(0,f.jsx)(`div`,{className:`header-resizer`,onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),style:{position:`absolute`,top:0,right:0,height:`100%`,width:`5px`,backgroundColor:t?`var(--primary)`:`rgba(0, 0, 0, 0.5)`,cursor:`col-resize`,userSelect:`none`,touchAction:`none`,opacity:+!!t}})},Sr=({header:e})=>{"use no memo";let{table:t}=L(),n=e.column.getCanSort();return(0,f.jsxs)(`div`,{onClick:e.column.getToggleSortingHandler(),title:e.column.getCanSort()?e.column.getNextSortingOrder()===`asc`?`Sort ascending`:e.column.getNextSortingOrder()===`desc`?`Sort descending`:`Clear sort`:void 0,style:{display:`flex`,alignItems:`center`,gap:1,cursor:n?`pointer`:`default`,userSelect:n?`none`:`auto`},children:[(0,f.jsx)(t.FlexRender,{header:e}),{asc:(0,f.jsx)(p.ChevronUpIcon,{style:{width:16,height:16}}),desc:(0,f.jsx)(p.ChevronDownIcon,{style:{width:16,height:16}})}[e.column.getIsSorted()]??null]})},Cr=({header:e})=>{"use no memo";let{isSplit:t}=L(),n={position:`relative`,whiteSpace:`nowrap`,width:e.getSize(),minWidth:e.getSize(),maxWidth:e.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,padding:0,...Fn(e.column,t)};return(0,f.jsxs)(Pn,{colSpan:e.colSpan,style:n,children:[e.isPlaceholder?null:(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,f.jsxs)(`div`,{style:{padding:`8px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`4px`},children:[(0,f.jsx)(Sr,{header:e}),(0,f.jsx)(br,{header:e})]}),(0,f.jsx)(fr,{column:e.column})]}),(0,f.jsx)(xr,{header:e})]})},wr=()=>{"use no memo";let{table:e,isSplit:t}=L();return(0,f.jsx)(Y,{style:{width:e.getCenterTotalSize()},children:(0,f.jsx)(Nn,{children:(t?e.getCenterHeaderGroups():e.getHeaderGroups()).map(e=>(0,f.jsx)(Z,{children:e.headers.map(e=>(0,f.jsx)(Cr,{header:e},e.id))},e.id))})})},Tr=()=>{"use no memo";let{paneRef1:e,paneRef2:t,height:n}=L();return(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Mn,{}),(0,f.jsx)(`div`,{style:{width:`100%`,overflowY:`scroll`,overflowX:`hidden`,scrollbarColor:`transparent transparent`},ref:e,children:(0,f.jsx)(wr,{})}),(0,f.jsx)(`div`,{style:{width:`100%`,overflow:`scroll`,height:n},ref:t,children:(0,f.jsx)(rr,{})})]})},Er=()=>{let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsx)(Z,{children:e.getEndVisibleLeafColumns().map((e,t)=>(0,f.jsx)(Q,{style:{width:e.getSize(),minWidth:e.getSize(),maxWidth:e.getSize()}},t))})})})},Dr=()=>{let{table:e,isSplit:t}=L(),n=e.getStartHeaderGroups().map(e=>e.headers.filter(e=>!e.isPlaceholder&&!e.subHeaders?.length).map(e=>e.column)).flat();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:[...Array(20)].map((r,i)=>(0,f.jsx)(Z,{children:n.map((n,r)=>(0,f.jsx)(Q,{style:{width:n.getSize(),minWidth:n.getSize(),maxWidth:n.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,transition:`padding 0.2s`,padding:e.state.density===`sm`?`4px`:e.state.density===`md`?`8px`:`16px`,...Fn(n,t)},children:(0,f.jsx)(er,{column:n,i,j:r})},r))},i))})})};function Or({row:e}){"use no memo";let{table:t}=L();return(0,f.jsx)(Z,{style:{backgroundColor:`blue`,position:`sticky`,zIndex:10,top:e.getIsPinned()===`top`?`calc(${e.getPinnedIndex()} * var(--cell-h))`:void 0,bottom:e.getIsPinned()===`bottom`?`calc(${t.getBottomRows().length-1-e.getPinnedIndex()} * var(--cell-h))`:void 0},children:e.getEndVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))})}var kr=()=>{"use no memo";let{table:e,isLoading:t,isError:n,renderSubComponent:r}=L();return t?(0,f.jsx)(Dr,{}):n?(0,f.jsx)(`div`,{children:`Error`}):e.getRowModel().rows.length===0?(0,f.jsx)(Er,{}):(0,f.jsx)(Y,{children:(0,f.jsxs)(X,{children:[e.getTopRows().map(e=>(0,f.jsx)(Or,{row:e},e.id)),e.getRowModel().rows.map(e=>(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Z,{"data-state":e.getIsSelected()&&`selected`,children:e.getEndVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))}),r&&e.getIsExpanded()&&(0,f.jsx)(Z,{children:(0,f.jsx)(Q,{colSpan:e.getVisibleCells().length,children:r({row:e})})})]},e.id)),e.getTopRows().map(e=>(0,f.jsx)(Or,{row:e},e.id))]})})},Ar=()=>{"use no memo";let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(Nn,{children:e.getEndHeaderGroups().map(e=>(0,f.jsx)(Z,{children:e.headers.map(e=>(0,f.jsx)(Cr,{header:e},e.id))},e.id))})})},jr=()=>{"use no memo";let{paneRef5:e,paneRef6:t,height:n,isError:r,isSplit:i,table:a}=L();return(0,f.jsx)(f.Fragment,{children:!r&&i&&(a.state.columnPinning?.end?.length??0)>0?(0,f.jsxs)(`div`,{style:{maxWidth:`220px`,overflow:`hidden`},children:[(0,f.jsx)(`div`,{style:{height:`64px`,borderBottom:`1px solid var(--border)`}}),(0,f.jsx)(`div`,{style:{width:`100%`,overflowY:`scroll`,overflowX:`hidden`,scrollbarColor:`transparent transparent`},ref:e,children:(0,f.jsx)(Ar,{})}),(0,f.jsx)(`div`,{style:{width:`100%`,overflow:`scroll`,height:n},ref:t,children:(0,f.jsx)(kr,{})})]}):null})},Mr=()=>{let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsx)(Z,{children:e.getStartVisibleLeafColumns().map((e,t)=>(0,f.jsx)(Q,{style:{width:e.getSize(),minWidth:e.getSize(),maxWidth:e.getSize()}},t))})})})},Nr=()=>{let{table:e,isSplit:t}=L(),n=e.getStartHeaderGroups().map(e=>e.headers.filter(e=>!e.isPlaceholder&&!e.subHeaders?.length).map(e=>e.column)).flat();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:[...Array(20)].map((r,i)=>(0,f.jsx)(Z,{children:n.map((n,r)=>(0,f.jsx)(Q,{style:{width:n.getSize(),minWidth:n.getSize(),maxWidth:n.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,transition:`padding 0.2s`,padding:e.state.density===`sm`?`4px`:e.state.density===`md`?`8px`:`16px`,...Fn(n,t)},children:(0,f.jsx)(er,{column:n,i,j:r})},r))},i))})})};function Pr({row:e}){"use no memo";let{table:t}=L();return(0,f.jsx)(Z,{style:{backgroundColor:`blue`,position:`sticky`,zIndex:10,top:e.getIsPinned()===`top`?`calc(${e.getPinnedIndex()} * var(--cell-h))`:void 0,bottom:e.getIsPinned()===`bottom`?`calc(${t.getBottomRows().length-1-e.getPinnedIndex()} * var(--cell-h))`:void 0},children:e.getStartVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))})}var Fr=()=>{"use no memo";let{table:e,isLoading:t,isError:n,renderSubComponent:r}=L();return t?(0,f.jsx)(Nr,{}):n?(0,f.jsx)(`div`,{children:`Error`}):e.getRowModel().rows.length===0?(0,f.jsx)(Mr,{}):(0,f.jsx)(Y,{children:(0,f.jsxs)(X,{children:[e.getTopRows().map(e=>(0,f.jsx)(Pr,{row:e},e.id)),e.getRowModel().rows.map(e=>(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Z,{"data-state":e.getIsSelected()&&`selected`,children:e.getStartVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))}),r&&e.getIsExpanded()&&(0,f.jsx)(Z,{children:(0,f.jsx)(Q,{colSpan:e.getVisibleCells().length,children:r({row:e})})})]},e.id)),e.getBottomRows().map(e=>(0,f.jsx)(Pr,{row:e},e.id))]})})},Ir=()=>{"use no memo";let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(Nn,{children:e.getStartHeaderGroups().map(e=>(0,f.jsx)(Z,{children:e.headers.map(e=>(0,f.jsx)(Cr,{header:e},e.id))},e.id))})})},Lr=()=>{"use no memo";let{paneRef3:e,paneRef4:t,height:n,isError:r,isSplit:i,table:a}=L();return(0,f.jsx)(f.Fragment,{children:!r&&i&&(a.state.columnPinning?.start?.length??0)>0?(0,f.jsxs)(`div`,{style:{maxWidth:`220px`,overflow:`hidden`},children:[(0,f.jsx)(`div`,{style:{height:`64px`,borderBottom:`1px solid var(--border)`}}),(0,f.jsx)(`div`,{style:{width:`100%`,overflowY:`scroll`,overflowX:`hidden`,scrollbarColor:`transparent transparent`},ref:e,children:(0,f.jsx)(Ir,{})}),(0,f.jsx)(`div`,{style:{width:`100%`,overflow:`scroll`,height:n},ref:t,children:(0,f.jsx)(Fr,{})})]}):null})},Rr=()=>{let{table:e}=L();return(0,f.jsxs)(`div`,{style:{minHeight:`50px`,padding:`16px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexWrap:`wrap`,gap:`16px`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`16px`,fontSize:`14px`,color:`var(--muted-foreground)`},children:[(0,f.jsxs)(`span`,{children:[`Showing `,e.getRowModel().rows.length.toLocaleString(),` of`,` `,e.getRowCount().toLocaleString(),` Rows`]}),e.getSelectedRowModel().rows.length>0&&(0,f.jsxs)(`span`,{children:[e.getSelectedRowModel().rows.length.toLocaleString(),` selected`]}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>e.getSelectedCellCount()>0?(0,f.jsxs)(`span`,{children:[e.getSelectedCellCount().toLocaleString(),` cells selected across `,e.getCellSelectionRowIds().length.toLocaleString(),` `,`rows and `,e.getCellSelectionColumnIds().length,` columns`]}):null})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,fontSize:`14px`},children:[`Page`,` `,(0,f.jsxs)(`strong`,{children:[(e.state.pagination.pageIndex+1).toLocaleString(),` of`,` `,e.getPageCount().toLocaleString()]})]}),(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,fontSize:`14px`},children:[`Go to page:`,(0,f.jsx)(jn,{type:`number`,min:`1`,max:e.getPageCount(),value:e.state.pagination.pageIndex+1,onChange:t=>{let n=t.target.value?Number(t.target.value)-1:0;e.setPageIndex(n)},style:{height:`28px`,width:`64px`}})]}),(0,f.jsxs)(ir,{value:String(e.state.pagination.pageSize),onValueChange:t=>e.setPageSize(Number(t)),children:[(0,f.jsx)(sr,{size:`sm`,children:(0,f.jsx)(or,{})}),(0,f.jsx)(cr,{children:[20,30,40,50,60,70,80,90,100].map(e=>(0,f.jsxs)(lr,{value:String(e),children:[`Show `,e]},e))})]}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.firstPage(),disabled:!e.getCanPreviousPage(),children:(0,f.jsx)(p.ChevronsLeft,{size:16})}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:(0,f.jsx)(p.ChevronLeft,{size:16})}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:(0,f.jsx)(p.ChevronRight,{size:16})}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.lastPage(),disabled:!e.getCanLastPage(),children:(0,f.jsx)(p.ChevronsRight,{size:16})})]})]})},zr=Bn(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function Br({className:e,orientation:t,...n}){return(0,f.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:q(zr({orientation:t}),e),...n})}function Vr({className:e,...t}){return(0,f.jsx)(m.Checkbox.Root,{"data-slot":`checkbox`,className:q(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,f.jsx)(m.Checkbox.Indicator,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,f.jsx)(p.CheckIcon,{})})})}function Hr({className:e,...t}){return(0,f.jsx)(m.Label.Root,{"data-slot":`label`,className:q(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var Ur=()=>{let{table:e,isSplit:t,setIsSplit:n}=L(),[r,i]=(0,c.useState)(``),a=(0,c.useMemo)(()=>e.getAllLeafColumns().filter(e=>![`rowNumber`].includes(e.id)).filter(e=>e.id.toLowerCase().includes(r.toLowerCase())),[r,e]),o=()=>{let t=e.getAllLeafColumns().map(e=>e.id);for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}e.setColumnOrder(t)};return(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsxs)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:[`Columns (`,e.getAllLeafColumns().length,`)`]}),(0,f.jsx)($,{title:`Restore`,variant:`ghost`,size:`icon-sm`,onClick:()=>{e.resetColumnVisibility()},children:(0,f.jsx)(p.RotateCcw,{})})]}),(0,f.jsx)(`div`,{style:{paddingInline:`8px`},children:(0,f.jsx)(jn,{type:`search`,placeholder:`Search columns...`,value:r,onChange:e=>i(e.target.value)})}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflowY:`auto`,paddingInline:`8px`},children:(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:a.length>0?(0,f.jsx)(c.default.Fragment,{children:a.map(e=>(0,f.jsxs)(Hr,{style:{display:`flex`,alignItems:`center`,minWidth:0},title:e.id.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()),children:[(0,f.jsx)(Vr,{checked:e.getIsVisible(),onCheckedChange:t=>e.toggleVisibility(t===!0)}),(0,f.jsx)(`span`,{style:{overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,minWidth:0,flex:1},children:e.id.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())})]},e.id))}):(0,f.jsx)(`div`,{className:`text-center`,children:`No columns found`})})}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,paddingInline:`8px`},children:[(0,f.jsxs)(Br,{style:{width:`100%`},children:[(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Shuffle`,style:{flex:1},onClick:()=>o(),children:(0,f.jsx)(p.Shuffle,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reset Order`,style:{flex:1},onClick:()=>e.resetColumnOrder(),disabled:e.state.columnOrder.length===0,children:(0,f.jsx)(p.RotateCcw,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reverse Order`,style:{flex:1},onClick:()=>e.setColumnOrder([...e.getAllLeafColumns().map(e=>e.id)].reverse()),children:(0,f.jsx)(p.ArrowLeftRight,{})})]}),(0,f.jsxs)(Br,{style:{width:`100%`},children:[(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reset Pinning`,style:{flex:1},onClick:()=>{e.resetColumnPinning(),n(!1)},disabled:!e.getIsSomeColumnsPinned(),children:(0,f.jsx)(p.PinOff,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reset Sizing`,style:{flex:1},onClick:()=>e.resetColumnSizing(),disabled:Object.keys(e.state.columnSizing).length===0,children:(0,f.jsx)(p.Ruler,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:t?`Exit Split`:`Split View`,style:{flex:1},disabled:!e.getIsSomeColumnsPinned(),onClick:()=>n(!t),children:(0,f.jsx)(p.SquareSplitHorizontal,{})})]})]})]})};function Wr({className:e,...t}){return(0,f.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:q(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Gr=Bn(`group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function Kr({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?m.Slot.Root:`div`;return(0,f.jsx)(a,{"data-slot":`item`,"data-variant":t,"data-size":n,className:q(Gr({variant:t,size:n,className:e})),...i})}var qr=Bn(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function Jr({className:e,variant:t=`default`,...n}){return(0,f.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:q(qr({variant:t,className:e})),...n})}function Yr({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`item-content`,className:q(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none`,e),...t})}function Xr({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`item-title`,className:q(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}var Zr=({columnId:e,label:t})=>{"use no memo";let{attributes:n,isDragging:r,listeners:i,setNodeRef:a,transform:o,transition:s}=(0,_.useSortable)({id:e}),c={opacity:r?.8:1,transform:ee.CSS.Translate.toString(o),transition:s,zIndex:+!!r};return(0,f.jsxs)(Kr,{ref:a,style:c,variant:`outline`,size:`sm`,title:t.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()),children:[(0,f.jsx)(Jr,{variant:`icon`,...n,...i,style:{cursor:`grab`,color:`var(--muted-foreground)`},children:(0,f.jsx)(p.GripVertical,{})}),(0,f.jsx)(Yr,{style:{minWidth:0},children:(0,f.jsx)(Xr,{style:{width:`100%`,minWidth:0},children:(0,f.jsx)(`span`,{style:{display:`block`,width:`100%`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())})})})]})},Qr=()=>{"use no memo";let{table:e}=L(),t=e.state.columnOrder.length?e.state.columnOrder:e.getAllLeafColumns().map(e=>e.id),n=n=>{let{active:r,over:i}=n;if(r&&i&&r.id!==i.id){let n=t.indexOf(r.id),a=t.indexOf(i.id);e.setColumnOrder((0,_.arrayMove)(t,n,a))}},r=(0,h.useSensors)((0,h.useSensor)(h.MouseSensor,{}),(0,h.useSensor)(h.TouchSensor,{}),(0,h.useSensor)(h.KeyboardSensor,{}));return(0,f.jsx)(h.DndContext,{collisionDetection:h.closestCenter,modifiers:[g.restrictToVerticalAxis],onDragEnd:n,sensors:r,children:(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsxs)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:[`Columns DND (`,e.getAllLeafColumns().length,`)`]}),(0,f.jsx)($,{variant:`ghost`,size:`icon-sm`,title:`Reset`,onClick:()=>e.resetColumnOrder(),children:(0,f.jsx)(p.RotateCcw,{})})]}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflowY:`auto`,paddingInline:`8px`},children:(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:(0,f.jsx)(_.SortableContext,{items:t,strategy:_.verticalListSortingStrategy,children:(0,f.jsx)(Wr,{children:t.map(t=>{let n=e.getColumn(t);return n?(0,f.jsx)(Zr,{columnId:t,label:typeof n.columnDef.header==`string`?n.columnDef.header:t},t):null})})})})})]})})};function $r({...e}){return(0,f.jsx)(m.Collapsible.Root,{"data-slot":`collapsible`,...e})}function ei({...e}){return(0,f.jsx)(m.Collapsible.CollapsibleContent,{"data-slot":`collapsible-content`,...e})}var ti=({column:e})=>{"use no memo";let t=(0,c.useMemo)(()=>e.getCanFilter()?{id:e.id.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()),uniqueValues:Array.from(e.getFacetedUniqueValues().keys())}:null,[e]),n=e.getFilterValue(),{filterVariant:r}=e.columnDef.meta??{},[i,a]=(0,c.useState)(!1);return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{onClick:()=>a(!i),style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,whiteSpace:`nowrap`},children:[(0,f.jsx)(`div`,{style:{width:`28px`,height:`28px`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`4px`,transition:`all 0.2s`,transform:i?`rotate(90deg)`:`none`},children:(0,f.jsx)(p.ChevronRight,{size:16})}),(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,whiteSpace:`nowrap`},children:t?.id&&t.id.length>15?`${t.id.slice(0,15)}...`:t?.id})]}),(0,f.jsx)($r,{open:i,children:(0,f.jsx)(ei,{children:(0,f.jsxs)(`div`,{style:{padding:`12px`,paddingRight:0},children:[(0,f.jsx)(`datalist`,{id:e.id+`list`,children:t?.uniqueValues.map((e,t)=>(0,f.jsx)(`option`,{value:e},t))}),r===`range`?(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,f.jsx)(J,{type:`number`,value:n?.[0]??``,onChange:t=>e.setFilterValue(e=>[t,e?.[1]]),placeholder:`Min`}),(0,f.jsx)(J,{type:`number`,value:n?.[1]??``,onChange:t=>e.setFilterValue(e=>[e?.[0],t]),placeholder:`Max`})]}):(0,f.jsx)(J,{type:`text`,value:n??``,onChange:t=>e.setFilterValue(t),placeholder:`Search... (${e.getFacetedUniqueValues().size})`,list:e.id+`list`,disabled:r===void 0})]})})})]})},ni=()=>{"use no memo";let{table:e,globalFilter:t,setGlobalFilter:n}=L();return(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:(0,f.jsx)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:`Filters`})}),(0,f.jsx)(`div`,{style:{paddingInline:`8px`},children:(0,f.jsx)(J,{style:{width:`100%`},type:`search`,value:String(t),onChange:e=>{n?.(String(e))},placeholder:`Search all columns...`})}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflowY:`auto`,paddingInline:`8px`},children:(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:e.getHeaderGroups().map(e=>(0,f.jsx)(c.default.Fragment,{children:e.headers.filter(e=>![`rowNumber`,`select`,`pin`,`actions`].includes(e.column.id)).map(e=>(0,f.jsx)(ti,{column:e.column},e.id))},e.id))})}),(0,f.jsx)(`div`,{style:{paddingInline:`8px`},children:(0,f.jsxs)($,{variant:`outline`,size:`sm`,style:{width:`100%`},onClick:()=>e.setColumnFilters([]),children:[(0,f.jsx)(p.RotateCcw,{size:16}),`Reset Filters`]})})]})};function ri(e,t,n){let r=window.open(``,`_blank`);if(!r){window.alert(`Print window was blocked. Please allow popups for this site and try again.`);return}let i=e=>(e==null?``:String(e)).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),a=t.map(e=>`<th>${i(e)}</th>`).join(``),o=n.map(e=>`<tr>${e.map(e=>`<td>${i(e)}</td>`).join(``)}</tr>`).join(``);r.document.open(),r.document.write(`
|
|
13
|
+
`}),(0,f.jsx)(p.Loader,{size:16,style:{animation:`grid-skeleton-spin 1s linear infinite`}})]}):[`actions`,`pin`,`drag-handle`,`rowNumber`].includes(e.id)?(0,f.jsx)(Qn,{style:{width:`100%`,height:`16px`}}):(0,f.jsx)(Qn,{style:{width:`${$n[(t+n)%$n.length]}px`,height:`16px`}})}),tr=()=>{let{table:e,isSplit:t}=L(),n=(t?e.getCenterHeaderGroups():e.getHeaderGroups()).map(e=>e.headers.filter(e=>!e.isPlaceholder&&!e.subHeaders?.length).map(e=>e.column)).flat();return(0,f.jsx)(Y,{style:{width:e.getCenterTotalSize()},children:(0,f.jsx)(X,{children:[...Array(20)].map((r,i)=>(0,f.jsx)(Z,{children:n.map((n,r)=>(0,f.jsx)(Q,{style:{width:n.getSize(),minWidth:n.getSize(),maxWidth:n.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,transition:`padding 0.2s`,padding:e.state.density===`sm`?`4px`:e.state.density===`md`?`8px`:`16px`,...Fn(n,t)},children:(0,f.jsx)(er,{column:n,i,j:r})},r))},i))})})};function nr({row:e}){"use no memo";let{table:t,isSplit:n}=L();return(0,f.jsx)(Z,{style:{backgroundColor:`blue`,position:`sticky`,zIndex:10,top:e.getIsPinned()===`top`?`calc(${e.getPinnedIndex()} * var(--cell-h))`:void 0,bottom:e.getIsPinned()===`bottom`?`calc(${t.getBottomRows().length-1-e.getPinnedIndex()} * var(--cell-h))`:void 0},children:(n?e.getCenterVisibleCells():e.getVisibleCells()).map(e=>(0,f.jsx)(Ln,{cell:e},e.id))})}var rr=()=>{"use no memo";let{table:e,isSplit:t,isLoading:n,isError:r,renderSubComponent:i}=L();return n?(0,f.jsx)(tr,{}):r?(0,f.jsx)(Zn,{}):e.getRowModel().rows.length===0?(0,f.jsx)(Jn,{}):(0,f.jsxs)(Y,{style:{width:e.getCenterTotalSize()},children:[e.getTopRows().map(e=>(0,f.jsx)(nr,{row:e},e.id)),(0,f.jsx)(X,{children:e.getRowModel().rows.map(e=>(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Z,{"data-state":e.getIsSelected()&&`selected`,children:(t?e.getCenterVisibleCells():e.getVisibleCells()).map(e=>(0,f.jsx)(Ln,{cell:e},e.id))}),i&&e.getIsExpanded()&&(0,f.jsx)(Z,{children:(0,f.jsx)(Q,{colSpan:e.getVisibleCells().length,children:i({row:e})})})]},e.id))}),e.getBottomRows().map(e=>(0,f.jsx)(nr,{row:e},e.id))]})};function ir({...e}){return(0,f.jsx)(m.Select.Root,{"data-slot":`select`,...e})}function ar({className:e,...t}){return(0,f.jsx)(m.Select.Group,{"data-slot":`select-group`,className:q(`scroll-my-1 p-1`,e),...t})}function or({...e}){return(0,f.jsx)(m.Select.Value,{"data-slot":`select-value`,...e})}function sr({className:e,size:t=`default`,children:n,...r}){return(0,f.jsxs)(m.Select.Trigger,{"data-slot":`select-trigger`,"data-size":t,className:q(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,f.jsx)(m.Select.Icon,{asChild:!0,children:(0,f.jsx)(p.ChevronDownIcon,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function cr({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,f.jsx)(m.Select.Portal,{children:(0,f.jsxs)(m.Select.Content,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:q(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,f.jsx)(ur,{}),(0,f.jsx)(m.Select.Viewport,{"data-position":n,className:q(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,f.jsx)(dr,{})]})})}function lr({className:e,children:t,...n}){return(0,f.jsxs)(m.Select.Item,{"data-slot":`select-item`,className:q(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,f.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,f.jsx)(m.Select.ItemIndicator,{children:(0,f.jsx)(p.CheckIcon,{className:`pointer-events-none`})})}),(0,f.jsx)(m.Select.ItemText,{children:t})]})}function ur({className:e,...t}){return(0,f.jsx)(m.Select.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:q(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,f.jsx)(p.ChevronUpIcon,{})})}function dr({className:e,...t}){return(0,f.jsx)(m.Select.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:q(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,f.jsx)(p.ChevronDownIcon,{})})}var fr=({column:e})=>{"use no memo";let t=e.getFilterValue(),{filterVariant:n,options:r}=e.columnDef.meta??{},{isFetching:i}=L(),a=r&&r.length>0?r:!i&&n===`select`?Array.from(e.getFacetedUniqueValues().keys()).sort().slice(0,5e3).map(e=>({label:String(e),value:String(e)})):[];return e.getCanFilter()?(0,f.jsx)(`div`,{style:{padding:`4px`,width:`100%`,borderTop:`1px solid var(--border)`},children:n===`range`?(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`4px`},children:[(0,f.jsx)(J,{style:{height:`28px`},type:`number`,value:t?.[0]??``,onChange:t=>e.setFilterValue(e=>[t,e?.[1]]),placeholder:`Min`}),(0,f.jsx)(J,{style:{height:`28px`},type:`number`,value:t?.[1]??``,onChange:t=>e.setFilterValue(e=>[e?.[0],t]),placeholder:`Max`})]}):n===`select`?(0,f.jsxs)(ir,{value:t?.toString()??`all`,onValueChange:t=>e.setFilterValue(t===`all`?void 0:t),children:[(0,f.jsx)(sr,{style:{width:`100%`},size:`sm`,children:(0,f.jsx)(or,{})}),(0,f.jsx)(cr,{children:(0,f.jsxs)(ar,{children:[(0,f.jsx)(lr,{value:`all`,children:`All`}),a.map(e=>(0,f.jsx)(lr,{value:e.value,children:e.label},e.value))]})})]}):n&&[`text`,`time`,`date`,`datetime-local`,`month`,`week`,`number`,`tel`,`url`,`color`,`search`].includes(n)?(0,f.jsx)(J,{style:{height:`28px`},onChange:t=>e.setFilterValue(t),placeholder:`Search...`,type:n,value:t??``}):(0,f.jsx)(`div`,{style:{height:`28px`,opacity:0,visibility:`hidden`}})}):null};function pr({...e}){return(0,f.jsx)(m.DropdownMenu.Root,{"data-slot":`dropdown-menu`,...e})}function mr({...e}){return(0,f.jsx)(m.DropdownMenu.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function hr({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,f.jsx)(m.DropdownMenu.Portal,{children:(0,f.jsx)(m.DropdownMenu.Content,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:q(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function gr({...e}){return(0,f.jsx)(m.DropdownMenu.Group,{"data-slot":`dropdown-menu-group`,...e})}function _r({className:e,inset:t,variant:n=`default`,...r}){return(0,f.jsx)(m.DropdownMenu.Item,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:q(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function vr({className:e,...t}){return(0,f.jsx)(m.DropdownMenu.Separator,{"data-slot":`dropdown-menu-separator`,className:q(`-mx-1 my-1 h-px bg-border`,e),...t})}function yr({className:e,...t}){return(0,f.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:q(`ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground`,e),...t})}var br=({header:e})=>{"use no memo";let{isLoading:t,isError:n}=L();return e.column.getCanFilter()?(0,f.jsxs)(pr,{children:[(0,f.jsx)(mr,{asChild:!0,children:(0,f.jsx)($,{size:`icon-xs`,variant:`ghost`,disabled:t||n,children:(0,f.jsx)(p.EllipsisVertical,{})})}),(0,f.jsxs)(hr,{align:`end`,children:[(0,f.jsxs)(gr,{children:[(0,f.jsxs)(_r,{onClick:()=>{e.column.toggleSorting(!1)},disabled:!e.column.getCanSort(),children:[`Sort ASC`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.ArrowUp,{})})]}),(0,f.jsxs)(_r,{onClick:()=>{e.column.toggleSorting(!0)},disabled:!e.column.getCanSort(),children:[`Sort DESC`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.ArrowDown,{})})]})]}),(0,f.jsx)(vr,{}),!e.isPlaceholder&&e.column.getCanPin()&&(0,f.jsxs)(gr,{children:[e.column.getIsPinned()!==`start`&&(0,f.jsxs)(_r,{onClick:()=>{e.column.pin(`start`)},children:[`Pin to left`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.PinIcon,{style:{transform:`rotate(45deg)`}})})]}),e.column.getIsPinned()&&(0,f.jsxs)(_r,{onClick:()=>{e.column.pin(!1)},children:[`Unpin`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.PinOff,{})})]}),e.column.getIsPinned()!==`end`&&(0,f.jsxs)(_r,{onClick:()=>{e.column.pin(`end`)},children:[`Pin to right`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.PinIcon,{style:{transform:`rotate(-45deg)`}})})]})]}),(0,f.jsx)(vr,{}),(0,f.jsx)(gr,{children:(0,f.jsxs)(_r,{onClick:()=>{e.column.toggleVisibility(!1)},disabled:!e.column.getCanHide(),children:[`Hide column`,(0,f.jsx)(yr,{children:(0,f.jsx)(p.EyeOff,{})})]})})]})]}):null},xr=({header:e})=>{"use no memo";let t=e.column.getIsResizing();return(0,f.jsx)(`div`,{className:`header-resizer`,onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),style:{position:`absolute`,top:0,right:0,height:`100%`,width:`5px`,backgroundColor:t?`var(--primary)`:`rgba(0, 0, 0, 0.5)`,cursor:`col-resize`,userSelect:`none`,touchAction:`none`,opacity:+!!t}})},Sr=({header:e})=>{"use no memo";let{table:t}=L(),n=e.column.getCanSort();return(0,f.jsxs)(`div`,{onClick:e.column.getToggleSortingHandler(),title:e.column.getCanSort()?e.column.getNextSortingOrder()===`asc`?`Sort ascending`:e.column.getNextSortingOrder()===`desc`?`Sort descending`:`Clear sort`:void 0,style:{display:`flex`,alignItems:`center`,gap:1,cursor:n?`pointer`:`default`,userSelect:n?`none`:`auto`},children:[(0,f.jsx)(t.FlexRender,{header:e}),{asc:(0,f.jsx)(p.ChevronUpIcon,{style:{width:16,height:16}}),desc:(0,f.jsx)(p.ChevronDownIcon,{style:{width:16,height:16}})}[e.column.getIsSorted()]??null]})},Cr=({header:e})=>{"use no memo";let{isSplit:t}=L(),n={position:`relative`,whiteSpace:`nowrap`,width:e.getSize(),minWidth:e.getSize(),maxWidth:e.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,padding:0,...Fn(e.column,t)};return(0,f.jsxs)(Pn,{colSpan:e.colSpan,style:n,children:[e.isPlaceholder?null:(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,f.jsxs)(`div`,{style:{padding:`8px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`4px`},children:[(0,f.jsx)(Sr,{header:e}),(0,f.jsx)(br,{header:e})]}),(0,f.jsx)(fr,{column:e.column})]}),(0,f.jsx)(xr,{header:e})]})},wr=()=>{"use no memo";let{table:e,isSplit:t}=L();return(0,f.jsx)(Y,{style:{width:e.getCenterTotalSize()},children:(0,f.jsx)(Nn,{children:(t?e.getCenterHeaderGroups():e.getHeaderGroups()).map(e=>(0,f.jsx)(Z,{children:e.headers.map(e=>(0,f.jsx)(Cr,{header:e},e.id))},e.id))})})},Tr=()=>{"use no memo";let{paneRef1:e,paneRef2:t,height:n}=L();return(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Mn,{}),(0,f.jsx)(`div`,{style:{width:`100%`,overflowY:`scroll`,overflowX:`hidden`,scrollbarColor:`transparent transparent`},ref:e,children:(0,f.jsx)(wr,{})}),(0,f.jsx)(`div`,{style:{width:`100%`,overflow:`scroll`,height:n},ref:t,children:(0,f.jsx)(rr,{})})]})},Er=()=>{let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsx)(Z,{children:e.getEndVisibleLeafColumns().map((e,t)=>(0,f.jsx)(Q,{style:{width:e.getSize(),minWidth:e.getSize(),maxWidth:e.getSize()}},t))})})})},Dr=()=>{let{table:e,isSplit:t}=L(),n=e.getStartHeaderGroups().map(e=>e.headers.filter(e=>!e.isPlaceholder&&!e.subHeaders?.length).map(e=>e.column)).flat();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:[...Array(20)].map((r,i)=>(0,f.jsx)(Z,{children:n.map((n,r)=>(0,f.jsx)(Q,{style:{width:n.getSize(),minWidth:n.getSize(),maxWidth:n.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,transition:`padding 0.2s`,padding:e.state.density===`sm`?`4px`:e.state.density===`md`?`8px`:`16px`,...Fn(n,t)},children:(0,f.jsx)(er,{column:n,i,j:r})},r))},i))})})};function Or({row:e}){"use no memo";let{table:t}=L();return(0,f.jsx)(Z,{style:{backgroundColor:`blue`,position:`sticky`,zIndex:10,top:e.getIsPinned()===`top`?`calc(${e.getPinnedIndex()} * var(--cell-h))`:void 0,bottom:e.getIsPinned()===`bottom`?`calc(${t.getBottomRows().length-1-e.getPinnedIndex()} * var(--cell-h))`:void 0},children:e.getEndVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))})}var kr=()=>{"use no memo";let{table:e,isLoading:t,isError:n,renderSubComponent:r}=L();return t?(0,f.jsx)(Dr,{}):n?(0,f.jsx)(`div`,{children:`Error`}):e.getRowModel().rows.length===0?(0,f.jsx)(Er,{}):(0,f.jsx)(Y,{children:(0,f.jsxs)(X,{children:[e.getTopRows().map(e=>(0,f.jsx)(Or,{row:e},e.id)),e.getRowModel().rows.map(e=>(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Z,{"data-state":e.getIsSelected()&&`selected`,children:e.getEndVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))}),r&&e.getIsExpanded()&&(0,f.jsx)(Z,{children:(0,f.jsx)(Q,{colSpan:e.getVisibleCells().length,children:r({row:e})})})]},e.id)),e.getTopRows().map(e=>(0,f.jsx)(Or,{row:e},e.id))]})})},Ar=()=>{"use no memo";let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(Nn,{children:e.getEndHeaderGroups().map(e=>(0,f.jsx)(Z,{children:e.headers.map(e=>(0,f.jsx)(Cr,{header:e},e.id))},e.id))})})},jr=()=>{"use no memo";let{paneRef5:e,paneRef6:t,height:n,isError:r,isSplit:i,table:a}=L();return(0,f.jsx)(f.Fragment,{children:!r&&i&&(a.state.columnPinning?.end?.length??0)>0?(0,f.jsxs)(`div`,{style:{maxWidth:`220px`,overflow:`hidden`},children:[(0,f.jsx)(`div`,{style:{height:`64px`,borderBottom:`1px solid var(--border)`}}),(0,f.jsx)(`div`,{style:{width:`100%`,overflowY:`scroll`,overflowX:`hidden`,scrollbarColor:`transparent transparent`},ref:e,children:(0,f.jsx)(Ar,{})}),(0,f.jsx)(`div`,{style:{width:`100%`,overflow:`scroll`,height:n},ref:t,children:(0,f.jsx)(kr,{})})]}):null})},Mr=()=>{let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsx)(Z,{children:e.getStartVisibleLeafColumns().map((e,t)=>(0,f.jsx)(Q,{style:{width:e.getSize(),minWidth:e.getSize(),maxWidth:e.getSize()}},t))})})})},Nr=()=>{let{table:e,isSplit:t}=L(),n=e.getStartHeaderGroups().map(e=>e.headers.filter(e=>!e.isPlaceholder&&!e.subHeaders?.length).map(e=>e.column)).flat();return(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:[...Array(20)].map((r,i)=>(0,f.jsx)(Z,{children:n.map((n,r)=>(0,f.jsx)(Q,{style:{width:n.getSize(),minWidth:n.getSize(),maxWidth:n.getSize(),borderRight:`1px solid`,borderColor:`var(--border)`,transition:`padding 0.2s`,padding:e.state.density===`sm`?`4px`:e.state.density===`md`?`8px`:`16px`,...Fn(n,t)},children:(0,f.jsx)(er,{column:n,i,j:r})},r))},i))})})};function Pr({row:e}){"use no memo";let{table:t}=L();return(0,f.jsx)(Z,{style:{backgroundColor:`blue`,position:`sticky`,zIndex:10,top:e.getIsPinned()===`top`?`calc(${e.getPinnedIndex()} * var(--cell-h))`:void 0,bottom:e.getIsPinned()===`bottom`?`calc(${t.getBottomRows().length-1-e.getPinnedIndex()} * var(--cell-h))`:void 0},children:e.getStartVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))})}var Fr=()=>{"use no memo";let{table:e,isLoading:t,isError:n,renderSubComponent:r}=L();return t?(0,f.jsx)(Nr,{}):n?(0,f.jsx)(`div`,{children:`Error`}):e.getRowModel().rows.length===0?(0,f.jsx)(Mr,{}):(0,f.jsx)(Y,{children:(0,f.jsxs)(X,{children:[e.getTopRows().map(e=>(0,f.jsx)(Pr,{row:e},e.id)),e.getRowModel().rows.map(e=>(0,f.jsxs)(c.default.Fragment,{children:[(0,f.jsx)(Z,{"data-state":e.getIsSelected()&&`selected`,children:e.getStartVisibleCells().map(e=>(0,f.jsx)(Ln,{cell:e},e.id))}),r&&e.getIsExpanded()&&(0,f.jsx)(Z,{children:(0,f.jsx)(Q,{colSpan:e.getVisibleCells().length,children:r({row:e})})})]},e.id)),e.getBottomRows().map(e=>(0,f.jsx)(Pr,{row:e},e.id))]})})},Ir=()=>{"use no memo";let{table:e}=L();return(0,f.jsx)(Y,{children:(0,f.jsx)(Nn,{children:e.getStartHeaderGroups().map(e=>(0,f.jsx)(Z,{children:e.headers.map(e=>(0,f.jsx)(Cr,{header:e},e.id))},e.id))})})},Lr=()=>{"use no memo";let{paneRef3:e,paneRef4:t,height:n,isError:r,isSplit:i,table:a}=L();return(0,f.jsx)(f.Fragment,{children:!r&&i&&(a.state.columnPinning?.start?.length??0)>0?(0,f.jsxs)(`div`,{style:{maxWidth:`220px`,overflow:`hidden`},children:[(0,f.jsx)(`div`,{style:{height:`64px`,borderBottom:`1px solid var(--border)`}}),(0,f.jsx)(`div`,{style:{width:`100%`,overflowY:`scroll`,overflowX:`hidden`,scrollbarColor:`transparent transparent`},ref:e,children:(0,f.jsx)(Ir,{})}),(0,f.jsx)(`div`,{style:{width:`100%`,overflow:`scroll`,height:n},ref:t,children:(0,f.jsx)(Fr,{})})]}):null})},Rr=()=>{let{table:e}=L();return(0,f.jsxs)(`div`,{style:{minHeight:`50px`,padding:`16px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexWrap:`wrap`,gap:`16px`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`16px`,fontSize:`14px`,color:`var(--muted-foreground)`},children:[(0,f.jsxs)(`span`,{children:[`Showing `,e.getRowModel().rows.length.toLocaleString(),` of`,` `,e.getRowCount().toLocaleString(),` Rows`]}),e.getSelectedRowModel().rows.length>0&&(0,f.jsxs)(`span`,{children:[e.getSelectedRowModel().rows.length.toLocaleString(),` selected`]}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>e.getSelectedCellCount()>0?(0,f.jsxs)(`span`,{children:[e.getSelectedCellCount().toLocaleString(),` cells selected across `,e.getCellSelectionRowIds().length.toLocaleString(),` `,`rows and `,e.getCellSelectionColumnIds().length,` columns`]}):null})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,fontSize:`14px`},children:[`Page`,` `,(0,f.jsxs)(`strong`,{children:[(e.state.pagination.pageIndex+1).toLocaleString(),` of`,` `,e.getPageCount().toLocaleString()]})]}),(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,fontSize:`14px`},children:[`Go to page:`,(0,f.jsx)(jn,{type:`number`,min:`1`,max:e.getPageCount(),value:e.state.pagination.pageIndex+1,onChange:t=>{let n=t.target.value?Number(t.target.value)-1:0;e.setPageIndex(n)},style:{height:`28px`,width:`64px`}})]}),(0,f.jsxs)(ir,{value:String(e.state.pagination.pageSize),onValueChange:t=>e.setPageSize(Number(t)),children:[(0,f.jsx)(sr,{size:`sm`,children:(0,f.jsx)(or,{})}),(0,f.jsx)(cr,{children:[20,30,40,50,60,70,80,90,100].map(e=>(0,f.jsxs)(lr,{value:String(e),children:[`Show `,e]},e))})]}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.firstPage(),disabled:!e.getCanPreviousPage(),children:(0,f.jsx)(p.ChevronsLeft,{size:16})}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:(0,f.jsx)(p.ChevronLeft,{size:16})}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:(0,f.jsx)(p.ChevronRight,{size:16})}),(0,f.jsx)($,{variant:`outline`,size:`icon-sm`,onClick:()=>e.lastPage(),disabled:!e.getCanLastPage(),children:(0,f.jsx)(p.ChevronsRight,{size:16})})]})]})},zr=Bn(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function Br({className:e,orientation:t,...n}){return(0,f.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:q(zr({orientation:t}),e),...n})}function Vr({className:e,...t}){return(0,f.jsx)(m.Checkbox.Root,{"data-slot":`checkbox`,className:q(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,f.jsx)(m.Checkbox.Indicator,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,f.jsx)(p.CheckIcon,{})})})}function Hr({className:e,...t}){return(0,f.jsx)(m.Label.Root,{"data-slot":`label`,className:q(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var Ur=()=>{let{table:e,isSplit:t,setIsSplit:n}=L(),[r,i]=(0,c.useState)(``),a=(0,c.useMemo)(()=>e.getAllLeafColumns().filter(e=>![`rowNumber`].includes(e.id)).filter(e=>e.id.toLowerCase().includes(r.toLowerCase())),[r,e]),o=()=>{let t=e.getAllLeafColumns().map(e=>e.id);for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}e.setColumnOrder(t)};return(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsxs)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:[`Columns (`,e.getAllLeafColumns().length,`)`]}),(0,f.jsx)($,{title:`Restore`,variant:`ghost`,size:`icon-sm`,onClick:()=>{e.resetColumnVisibility()},children:(0,f.jsx)(p.RotateCcw,{})})]}),(0,f.jsx)(`div`,{style:{paddingInline:`8px`},children:(0,f.jsx)(jn,{type:`search`,placeholder:`Search columns...`,value:r,onChange:e=>i(e.target.value)})}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflowY:`auto`,paddingInline:`8px`},children:(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:a.length>0?(0,f.jsx)(c.default.Fragment,{children:a.map(e=>(0,f.jsxs)(Hr,{style:{display:`flex`,alignItems:`center`,minWidth:0},title:e.id.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()),children:[(0,f.jsx)(Vr,{checked:e.getIsVisible(),onCheckedChange:t=>e.toggleVisibility(t===!0)}),(0,f.jsx)(`span`,{style:{overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,minWidth:0,flex:1},children:e.id.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())})]},e.id))}):(0,f.jsx)(`div`,{className:`text-center`,children:`No columns found`})})}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,paddingInline:`8px`},children:[(0,f.jsxs)(Br,{style:{width:`100%`},children:[(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Shuffle`,style:{flex:1},onClick:()=>o(),children:(0,f.jsx)(p.Shuffle,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reset Order`,style:{flex:1},onClick:()=>e.resetColumnOrder(),disabled:e.state.columnOrder.length===0,children:(0,f.jsx)(p.RotateCcw,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reverse Order`,style:{flex:1},onClick:()=>e.setColumnOrder([...e.getAllLeafColumns().map(e=>e.id)].reverse()),children:(0,f.jsx)(p.ArrowLeftRight,{})})]}),(0,f.jsxs)(Br,{style:{width:`100%`},children:[(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reset Pinning`,style:{flex:1},onClick:()=>{e.resetColumnPinning(),n(!1)},disabled:!e.getIsSomeColumnsPinned(),children:(0,f.jsx)(p.PinOff,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:`Reset Sizing`,style:{flex:1},onClick:()=>e.resetColumnSizing(),disabled:Object.keys(e.state.columnSizing).length===0,children:(0,f.jsx)(p.Ruler,{})}),(0,f.jsx)($,{variant:`outline`,size:`icon`,title:t?`Exit Split`:`Split View`,style:{flex:1},disabled:!e.getIsSomeColumnsPinned(),onClick:()=>n(!t),children:(0,f.jsx)(p.SquareSplitHorizontal,{})})]})]})]})};function Wr({className:e,...t}){return(0,f.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:q(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Gr=Bn(`group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function Kr({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?m.Slot.Root:`div`;return(0,f.jsx)(a,{"data-slot":`item`,"data-variant":t,"data-size":n,className:q(Gr({variant:t,size:n,className:e})),...i})}var qr=Bn(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function Jr({className:e,variant:t=`default`,...n}){return(0,f.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:q(qr({variant:t,className:e})),...n})}function Yr({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`item-content`,className:q(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none`,e),...t})}function Xr({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`item-title`,className:q(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}var Zr=({columnId:e,label:t})=>{"use no memo";let{attributes:n,isDragging:r,listeners:i,setNodeRef:a,transform:o,transition:s}=(0,_.useSortable)({id:e}),c={opacity:r?.8:1,transform:ee.CSS.Translate.toString(o),transition:s,zIndex:+!!r};return(0,f.jsxs)(Kr,{ref:a,style:c,variant:`outline`,size:`sm`,title:t.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()),children:[(0,f.jsx)(Jr,{variant:`icon`,...n,...i,style:{cursor:`grab`,color:`var(--muted-foreground)`},children:(0,f.jsx)(p.GripVertical,{})}),(0,f.jsx)(Yr,{style:{minWidth:0},children:(0,f.jsx)(Xr,{style:{width:`100%`,minWidth:0},children:(0,f.jsx)(`span`,{style:{display:`block`,width:`100%`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())})})})]})},Qr=()=>{"use no memo";let{table:e}=L(),t=e.state.columnOrder.length?e.state.columnOrder:e.getAllLeafColumns().map(e=>e.id),n=n=>{let{active:r,over:i}=n;if(r&&i&&r.id!==i.id){let n=t.indexOf(r.id),a=t.indexOf(i.id);e.setColumnOrder((0,_.arrayMove)(t,n,a))}},r=(0,h.useSensors)((0,h.useSensor)(h.MouseSensor,{}),(0,h.useSensor)(h.TouchSensor,{}),(0,h.useSensor)(h.KeyboardSensor,{}));return(0,f.jsx)(h.DndContext,{collisionDetection:h.closestCenter,modifiers:[g.restrictToVerticalAxis],onDragEnd:n,sensors:r,children:(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsxs)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:[`Columns DND (`,e.getAllLeafColumns().length,`)`]}),(0,f.jsx)($,{variant:`ghost`,size:`icon-sm`,title:`Reset`,onClick:()=>e.resetColumnOrder(),children:(0,f.jsx)(p.RotateCcw,{})})]}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflowY:`auto`,paddingInline:`8px`},children:(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:(0,f.jsx)(_.SortableContext,{items:t,strategy:_.verticalListSortingStrategy,children:(0,f.jsx)(Wr,{children:t.map(t=>{let n=e.getColumn(t);return n?(0,f.jsx)(Zr,{columnId:t,label:typeof n.columnDef.header==`string`?n.columnDef.header:t},t):null})})})})})]})})};function $r({...e}){return(0,f.jsx)(m.Collapsible.Root,{"data-slot":`collapsible`,...e})}function ei({...e}){return(0,f.jsx)(m.Collapsible.CollapsibleContent,{"data-slot":`collapsible-content`,...e})}var ti=({column:e})=>{"use no memo";let t=(0,c.useMemo)(()=>e.getCanFilter()?{id:e.id.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()),uniqueValues:Array.from(e.getFacetedUniqueValues().keys())}:null,[e]),n=e.getFilterValue(),{filterVariant:r}=e.columnDef.meta??{},[i,a]=(0,c.useState)(!1);return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{onClick:()=>a(!i),style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,whiteSpace:`nowrap`},children:[(0,f.jsx)(`div`,{style:{width:`28px`,height:`28px`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`4px`,transition:`all 0.2s`,transform:i?`rotate(90deg)`:`none`},children:(0,f.jsx)(p.ChevronRight,{size:16})}),(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,whiteSpace:`nowrap`},children:t?.id&&t.id.length>15?`${t.id.slice(0,15)}...`:t?.id})]}),(0,f.jsx)($r,{open:i,children:(0,f.jsx)(ei,{children:(0,f.jsxs)(`div`,{style:{padding:`12px`,paddingRight:0},children:[(0,f.jsx)(`datalist`,{id:e.id+`list`,children:t?.uniqueValues.map((e,t)=>(0,f.jsx)(`option`,{value:e},t))}),r===`range`?(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,f.jsx)(J,{type:`number`,value:n?.[0]??``,onChange:t=>e.setFilterValue(e=>[t,e?.[1]]),placeholder:`Min`}),(0,f.jsx)(J,{type:`number`,value:n?.[1]??``,onChange:t=>e.setFilterValue(e=>[e?.[0],t]),placeholder:`Max`})]}):(0,f.jsx)(J,{type:`text`,value:n??``,onChange:t=>e.setFilterValue(t),placeholder:`Search... (${e.getFacetedUniqueValues().size})`,list:e.id+`list`,disabled:r===void 0})]})})})]})},ni=()=>{"use no memo";let{table:e,globalFilter:t,setGlobalFilter:n}=L();return(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:(0,f.jsx)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:`Filters`})}),(0,f.jsx)(`div`,{style:{paddingInline:`8px`},children:(0,f.jsx)(J,{style:{width:`100%`},type:`search`,value:String(t),onChange:e=>{n?.(String(e))},placeholder:`Search all columns...`})}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflowY:`auto`,paddingInline:`8px`},children:(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:e.getHeaderGroups().map(e=>(0,f.jsx)(c.default.Fragment,{children:e.headers.filter(e=>![`rowNumber`,`select`,`pin`,`actions`].includes(e.column.id)).map(e=>(0,f.jsx)(ti,{column:e.column},e.id))},e.id))})}),(0,f.jsx)(`div`,{style:{paddingInline:`8px`},children:(0,f.jsxs)($,{variant:`outline`,size:`sm`,style:{width:`100%`},onClick:()=>{e.setColumnFilters([]),n&&n(``)},children:[(0,f.jsx)(p.RotateCcw,{size:16}),`Reset Filters`]})})]})};function ri(e,t,n){let r=window.open(``,`_blank`);if(!r){window.alert(`Print window was blocked. Please allow popups for this site and try again.`);return}let i=e=>(e==null?``:String(e)).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),a=t.map(e=>`<th>${i(e)}</th>`).join(``),o=n.map(e=>`<tr>${e.map(e=>`<td>${i(e)}</td>`).join(``)}</tr>`).join(``);r.document.open(),r.document.write(`
|
|
14
14
|
<!DOCTYPE html>
|
|
15
15
|
<html>
|
|
16
16
|
<head>
|
|
@@ -34,4 +34,4 @@
|
|
|
34
34
|
</body>
|
|
35
35
|
</html>
|
|
36
36
|
`),r.document.close();let s=()=>{r.focus(),r.print()};r.document.readyState===`complete`?setTimeout(s,100):(r.onload=()=>setTimeout(s,100),setTimeout(s,500))}var ii=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()),ai=()=>{let{table:e,name:t}=L(),n=()=>{let t=e.getCellSelectionRowIds(),n=e.getCellSelectionColumnIds();if(t.length===0||n.length===0)return null;let r=new Set(t),i=new Set(n),a=e.getRowModel().rows.filter(e=>r.has(e.id)),o=e.getVisibleLeafColumns().filter(e=>i.has(e.id));return{header:o.map(e=>{let t=e.columnDef.header;return typeof t==`string`?t:ii(e.id)}),body:a.map(e=>{let t=new Map(e.getAllCells().map(e=>[e.column.id,e]));return o.map(e=>{let n=t.get(e.id);return n?.getIsSelected()?n.getValue():``})})}},r=()=>{let e=n();if(!e)return;let{header:r,body:i}=e,a=[r,...i],o=b.utils.aoa_to_sheet(a);o[`!cols`]=r.map((e,t)=>({wch:a.reduce((e,n)=>{let r=n[t],i=r==null?0:String(r).length;return Math.max(e,i)},0)+2}));let s=b.utils.book_new();b.utils.book_append_sheet(s,o,`Selection`),b.writeFile(s,`${t??`export`}-${Date.now()}.xlsx`)},i=()=>{let e=n();if(!e)return;let{header:r,body:i}=e,a=t??`Grid`,o=new v.default({orientation:`landscape`});o.setFontSize(12),o.text(a,14,14),(0,y.default)(o,{head:[r],body:i.map(e=>e.map(e=>e==null?``:String(e))),startY:20,styles:{fontSize:8},headStyles:{fillColor:[51,51,51]}}),o.save(`${a}-${Date.now()}.pdf`)},a=()=>{let e=n();if(!e)return;let{header:r,body:i}=e,a=t??`Grid`,o=i.map(e=>Object.fromEntries(r.map((t,n)=>[t,e[n]]))),s=new Blob([JSON.stringify(o,null,2)],{type:`application/json`}),c=URL.createObjectURL(s),l=document.createElement(`a`);l.href=c,l.download=`${a}-${Date.now()}.json`,l.click(),URL.revokeObjectURL(c)},o=()=>{let e=n();e&&ri(t??`Grid`,e.header,e.body)},s=async()=>{let e=n();if(!e)return;let t=e.body.map(e=>e.map(e=>e==null?``:String(e)).join(` `)).join(`
|
|
37
|
-
`);await navigator.clipboard.writeText(t)},l=()=>({columnOrder:e.state.columnOrder,columnPinning:e.state.columnPinning,columnVisibility:e.state.columnVisibility,columnSizing:e.state.columnSizing,sorting:e.state.sorting,columnFilters:e.state.columnFilters}),u=(0,c.useRef)([]),d=(0,c.useRef)([]),m=(0,c.useRef)(!1),h=(0,c.useRef)(``),[,g]=(0,c.useState)(0),_=t=>{m.current=!0,e.setColumnOrder(t.columnOrder),e.setColumnPinning(t.columnPinning),e.setColumnVisibility(t.columnVisibility),e.setColumnSizing(t.columnSizing),e.setSorting(t.sorting),e.setColumnFilters(t.columnFilters),h.current=JSON.stringify(t),setTimeout(()=>{m.current=!1},0)};return(0,c.useEffect)(()=>{let e=l(),t=JSON.stringify(e);if(h.current===``){h.current=t;return}if(t===h.current)return;if(m.current){h.current=t;return}let n=JSON.parse(h.current);u.current.push(n),d.current=[],h.current=t,g(e=>e+1)},[e.state.columnOrder,e.state.columnPinning,e.state.columnVisibility,e.state.columnSizing,e.state.sorting,e.state.columnFilters]),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`,position:`relative`},children:[(0,f.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:(0,f.jsx)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:`Rows`})}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,paddingInline:`8px`},children:[(0,f.jsx)(Hr,{children:`History`}),(0,f.jsxs)(Br,{children:[(0,f.jsx)($,{size:`icon`,variant:`outline`,title:`Undo`,disabled:u.current.length===0,onClick:()=>{let e=u.current.pop();e&&(d.current.push(l()),_(e),g(e=>e+1))},children:(0,f.jsx)(p.Undo2,{})}),(0,f.jsx)($,{size:`icon`,variant:`outline`,title:`Redo`,disabled:d.current.length===0,onClick:()=>{let e=d.current.pop();e&&(u.current.push(l()),_(e),g(e=>e+1))},children:(0,f.jsx)(p.Redo2,{})})]})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,paddingInline:`8px`},children:[(0,f.jsx)(Hr,{children:`Density`}),(0,f.jsxs)(Br,{children:[(0,f.jsx)($,{size:`icon`,variant:e.state.density===`sm`?`default`:`outline`,onClick:()=>e.setDensity(`sm`),title:`Small`,children:(0,f.jsx)(p.Rows4,{})}),(0,f.jsx)($,{size:`icon`,variant:e.state.density===`md`?`default`:`outline`,onClick:()=>e.setDensity(`md`),title:`Default`,children:(0,f.jsx)(p.Rows3,{})}),(0,f.jsx)($,{size:`icon`,variant:e.state.density===`lg`?`default`:`outline`,onClick:()=>e.setDensity(`lg`),title:`Large`,children:(0,f.jsx)(p.Rows2,{})})]})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,paddingInline:`8px`},children:[(0,f.jsx)(Hr,{children:`Selection`}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,f.jsxs)(Br,{children:[(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Copy Selection`,onClick:s,children:(0,f.jsx)(p.Copy,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Export to Excel`,onClick:r,children:(0,f.jsx)(p.FileSpreadsheet,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Export to PDF`,onClick:i,children:(0,f.jsx)(p.FileText,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Export to JSON`,onClick:a,children:(0,f.jsx)(p.FileJson,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Print Selection`,onClick:o,children:(0,f.jsx)(p.Printer,{})})}),(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getRowModel().rows.length===0,title:`Select All Cells`,onClick:()=>e.selectAllCells(),children:(0,f.jsx)(p.MousePointerClick,{})})]}),(0,f.jsx)(Br,{children:(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Clear Selection`,onClick:()=>e.resetCellSelection(!0),children:(0,f.jsx)(p.X,{})})})})]})]})]})};function oi({className:e,...t}){return(0,f.jsx)(p.Loader2Icon,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:q(`size-4 animate-spin`,e),...t})}var si=()=>{"use no memo";let{table:e,setIsSplit:t,gridWrapperRef:n,isFetching:r,refetch:i}=L(),[a,o]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let e=()=>{o(document.fullscreenElement===n.current)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[n]),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:(0,f.jsx)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:`Settings`})}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,paddingInline:`8px`,flex:1,gap:`8px`},children:[(0,f.jsxs)($,{variant:`outline`,onClick:()=>{n.current&&(document.fullscreenElement?document.exitFullscreen():n.current.requestFullscreen())},children:[a?(0,f.jsx)(p.Shrink,{}):(0,f.jsx)(p.Expand,{}),a?`Exit Fullscreen`:`Fullscreen`]}),(0,f.jsxs)($,{variant:`outline`,onClick:()=>i?.(),disabled:r,children:[r&&(0,f.jsx)(oi,{}),r?`Refreshing...`:`Refresh Data`]}),(0,f.jsx)($,{variant:`outline`,onClick:()=>{window.confirm(`Are you sure you want to reset all settings to default?`)&&(e.resetColumnPinning(),e.resetRowPinning(),e.resetColumnVisibility(),e.resetColumnOrder(),e.resetColumnSizing(),e.resetColumnFilters(),e.resetGlobalFilter(),e.resetSorting(),e.resetRowSelection(),e.resetCellSelection(!0),e.resetPagination(),e.setDensity(`md`),t(!1),window.alert(`Settings have been reset to default.`))},children:`Reset to Default`})]})]})},ci=({height:e})=>{"use no memo";let[t,n]=(0,c.useState)(null),r=e=>{n(t===e?null:e)},i={width:208,borderLeft:`1px solid var(--border)`,height:`100%`};return(0,f.jsxs)(`div`,{style:{display:`flex`,overflow:`hidden`,height:e,borderBottom:`1px solid var(--border)`},children:[t===`columns`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(Ur,{})}),t===`rows`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(ai,{})}),t===`filter`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(ni,{})}),t===`dnd`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(Qr,{})}),t===`settings`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(si,{})}),(0,f.jsx)(`div`,{style:{width:28,borderLeft:`1px solid var(--border)`},children:[{value:`columns`,label:`Columns`,icon:p.Columns3},{value:`rows`,label:`Rows`,icon:p.Rows3},{value:`filter`,label:`Filter`,icon:p.Filter},{value:`dnd`,label:`Dnd`,icon:p.GripVertical},{value:`settings`,label:`Settings`,icon:p.Settings}].map(({value:e,label:n,icon:i})=>(0,f.jsxs)($,{onClick:()=>r(e),variant:t===e?`secondary`:`ghost`,style:{writingMode:`vertical-rl`,minWidth:28,width:28,fontSize:12,height:`auto`,borderRadius:`none`},children:[(0,f.jsx)(i,{size:14}),n]},e))})]})},li=({payload:e,columns:t,name:n,state:r,onColumnFiltersChange:i,onPaginationChange:a,onSortingChange:o,onRowSelectionChange:s,setGlobalFilter:c,manualPagination:l,manualFiltering:u,manualSorting:d,isLoading:p,isError:m,isFetching:h,refetch:g,height:_,getRowCanExpand:ee,renderSubComponent:v,enableCellSelection:y,enableCellSpanning:b,enableRowSelection:x,topRightSlot:te})=>{"use no memo";return(0,f.jsx)(we,{payload:e,columns:t,name:n,state:r,onColumnFiltersChange:i,onPaginationChange:a,onSortingChange:o,onRowSelectionChange:s,setGlobalFilter:c,manualPagination:l,manualFiltering:u,manualSorting:d,isLoading:p,isError:m,isFetching:h,refetch:g,height:_,getRowCanExpand:ee,renderSubComponent:v,enableCellSelection:y,enableCellSpanning:b,enableRowSelection:x,topRightSlot:te,children:(0,f.jsx)(ui,{})})},ui=()=>{"use no memo";let{gridWrapperRef:e}=L(),t=(0,c.useRef)(null),[n,r]=(0,c.useState)(0);return(0,c.useLayoutEffect)(()=>{t.current&&r(t.current.getBoundingClientRect().height)},[]),(0,c.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{r(e.getBoundingClientRect().height)},i=new ResizeObserver(n);return i.observe(e),document.addEventListener(`fullscreenchange`,n),window.addEventListener(`resize`,n),()=>{i.disconnect(),document.removeEventListener(`fullscreenchange`,n),window.removeEventListener(`resize`,n)}},[]),(0,f.jsxs)(`div`,{style:{position:`relative`,background:`color-mix(in srgb, var(--muted) 50%, transparent)`,border:`1px solid var(--border)`,borderRadius:`6px`},ref:e,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,overflow:`hidden`,width:`100%`},children:[(0,f.jsx)(Lr,{}),(0,f.jsx)(`div`,{style:{overflow:`hidden`,flex:1},ref:t,children:(0,f.jsx)(Tr,{})}),(0,f.jsx)(jr,{}),(0,f.jsx)(ci,{height:n})]}),(0,f.jsx)(Rr,{})]})},di=()=>{let[e,t]=c.default.useState([]),[n,r]=c.default.useState({pageIndex:0,pageSize:20}),[i,a]=c.default.useState([]),[o,s]=c.default.useState({}),[l,u]=c.default.useState(``);return{state:{columnFilters:e,globalFilter:l,pagination:n,sorting:i,rowSelection:o},handlers:{onColumnFiltersChange:t,onPaginationChange:r,onSortingChange:a,setGlobalFilter:u,onRowSelectionChange:s},rowSelection:o}},fi=e=>new URLSearchParams(e.flatMap(({id:e,value:t})=>{let n=e.replace(/_/g,`.`);return Array.isArray(t)&&t.length===2?[...t[0]!=null&&t[0]!==``?[[`${n}[gte]`,String(t[0])]]:[],...t[1]!=null&&t[1]!==``?[[`${n}[lte]`,String(t[1])]]:[]]:typeof t==`object`&&t?Object.entries(t).flatMap(([e,t])=>`eq.ne.gt.gte.lt.lte.in.nin.regex.exists.all.size.elemMatch.type.mod.not.and.or.nor.text.where.geoWithin.geoIntersects.near.nearSphere.expr.jsonSchema.bitsAllClear.bitsAllSet.bitsAnyClear.bitsAnySet.rand`.split(`.`).includes(e)&&t!=null&&t!==``?[[`${n}[${e}]`,String(t)]]:[]):t!=null&&t!==``?[[n,String(t)]]:[]})).toString();function pi(e){if(!e||e.length===0)return``;let t=e.filter(e=>e.id!=null&&e.id.trim()!==``).map(e=>e.desc?e.id:`-${e.id}`);return t.length===0?``:`sort=${t.join(`,`)}`}var mi=e=>(0,c.useMemo)(()=>({pagination:e.pagination,queryParams:fi(e.columnFilters),sort:pi(e.sorting),globalFilter:e.globalFilter}),[e]);function hi(e,t,n){return Object.entries(t).filter(([,e])=>e).map(([t])=>e[Number(t)]).filter(e=>e!==void 0).map(e=>e[n])}var gi=`eq.ne.gt.gte.lt.lte.in.nin.regex.exists.all.size.elemMatch.type.mod.not.and.or.nor.text.where.geoWithin.geoIntersects.near.nearSphere.expr.jsonSchema.bitsAllClear.bitsAllSet.bitsAnyClear.bitsAnySet.rand`.split(`.`);function _i(e,t){let{id:n,value:r}=t,i=n.replace(/_/g,`.`);if(Array.isArray(r)&&r.length===2){r[0]!=null&&r[0]!==``&&e.set(`${i}[gte]`,String(r[0])),r[1]!=null&&r[1]!==``&&e.set(`${i}[lte]`,String(r[1]));return}if(typeof r==`object`&&r){Object.entries(r).forEach(([t,n])=>{gi.includes(t)&&n!=null&&n!==``&&e.set(`${i}[${t}]`,String(n))});return}r!=null&&r!==``&&e.set(i,String(r))}function vi(e){let t=new URLSearchParams;if(t.set(`page`,String(e.pagination.pageIndex+1)),t.set(`limit`,String(e.pagination.pageSize)),e.columnFilters.forEach(e=>{_i(t,e)}),e.sorting.length>0){let n=e.sorting.map(e=>e.desc?`-${e.id}`:e.id).join(`,`);t.set(`sort`,n)}return e.globalFilter&&t.set(`q`,e.globalFilter),`?${t.toString()}`}exports.Grid=li,exports.URLSearch=vi,exports.pluckSelected=hi,exports.useGrid=L,exports.useGridState=di,exports.useQueryArgs=mi;
|
|
37
|
+
`);await navigator.clipboard.writeText(t)},l=()=>({columnOrder:e.state.columnOrder,columnPinning:e.state.columnPinning,columnVisibility:e.state.columnVisibility,columnSizing:e.state.columnSizing,sorting:e.state.sorting,columnFilters:e.state.columnFilters}),u=(0,c.useRef)([]),d=(0,c.useRef)([]),m=(0,c.useRef)(!1),h=(0,c.useRef)(``),[,g]=(0,c.useState)(0),_=t=>{m.current=!0,e.setColumnOrder(t.columnOrder),e.setColumnPinning(t.columnPinning),e.setColumnVisibility(t.columnVisibility),e.setColumnSizing(t.columnSizing),e.setSorting(t.sorting),e.setColumnFilters(t.columnFilters),h.current=JSON.stringify(t),setTimeout(()=>{m.current=!1},0)};return(0,c.useEffect)(()=>{let e=l(),t=JSON.stringify(e);if(h.current===``){h.current=t;return}if(t===h.current)return;if(m.current){h.current=t;return}let n=JSON.parse(h.current);u.current.push(n),d.current=[],h.current=t,g(e=>e+1)},[e.state.columnOrder,e.state.columnPinning,e.state.columnVisibility,e.state.columnSizing,e.state.sorting,e.state.columnFilters]),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`,position:`relative`},children:[(0,f.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:(0,f.jsx)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:`Rows`})}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,paddingInline:`8px`},children:[(0,f.jsx)(Hr,{children:`History`}),(0,f.jsxs)(Br,{children:[(0,f.jsx)($,{size:`icon`,variant:`outline`,title:`Undo`,disabled:u.current.length===0,onClick:()=>{let e=u.current.pop();e&&(d.current.push(l()),_(e),g(e=>e+1))},children:(0,f.jsx)(p.Undo2,{})}),(0,f.jsx)($,{size:`icon`,variant:`outline`,title:`Redo`,disabled:d.current.length===0,onClick:()=>{let e=d.current.pop();e&&(u.current.push(l()),_(e),g(e=>e+1))},children:(0,f.jsx)(p.Redo2,{})})]})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,paddingInline:`8px`},children:[(0,f.jsx)(Hr,{children:`Density`}),(0,f.jsxs)(Br,{children:[(0,f.jsx)($,{size:`icon`,variant:e.state.density===`sm`?`default`:`outline`,onClick:()=>e.setDensity(`sm`),title:`Small`,children:(0,f.jsx)(p.Rows4,{})}),(0,f.jsx)($,{size:`icon`,variant:e.state.density===`md`?`default`:`outline`,onClick:()=>e.setDensity(`md`),title:`Default`,children:(0,f.jsx)(p.Rows3,{})}),(0,f.jsx)($,{size:`icon`,variant:e.state.density===`lg`?`default`:`outline`,onClick:()=>e.setDensity(`lg`),title:`Large`,children:(0,f.jsx)(p.Rows2,{})})]})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,paddingInline:`8px`},children:[(0,f.jsx)(Hr,{children:`Selection`}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,f.jsxs)(Br,{children:[(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Copy Selection`,onClick:s,children:(0,f.jsx)(p.Copy,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Export to Excel`,onClick:r,children:(0,f.jsx)(p.FileSpreadsheet,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Export to PDF`,onClick:i,children:(0,f.jsx)(p.FileText,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Export to JSON`,onClick:a,children:(0,f.jsx)(p.FileJson,{})})}),(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Print Selection`,onClick:o,children:(0,f.jsx)(p.Printer,{})})}),(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getRowModel().rows.length===0,title:`Select All Cells`,onClick:()=>e.selectAllCells(),children:(0,f.jsx)(p.MousePointerClick,{})})]}),(0,f.jsx)(Br,{children:(0,f.jsx)(e.Subscribe,{source:e.atoms.cellSelection,children:()=>(0,f.jsx)($,{size:`icon`,variant:`outline`,disabled:e.getSelectedCellCount()===0,title:`Clear Selection`,onClick:()=>e.resetCellSelection(!0),children:(0,f.jsx)(p.X,{})})})})]})]})]})};function oi({className:e,...t}){return(0,f.jsx)(p.Loader2Icon,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:q(`size-4 animate-spin`,e),...t})}var si=()=>{"use no memo";let{table:e,setIsSplit:t,gridWrapperRef:n,isFetching:r,refetch:i,setGlobalFilter:a}=L(),[o,s]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let e=()=>{s(document.fullscreenElement===n.current)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[n]),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,paddingBlock:`8px`,gap:`8px`},children:[(0,f.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingInline:`8px`,paddingBottom:`8px`,height:`36px`,borderBottom:`1px solid var(--border)`},children:(0,f.jsx)(`h1`,{style:{fontSize:`14px`,fontWeight:`500`},children:`Settings`})}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,paddingInline:`8px`,flex:1,gap:`8px`},children:[(0,f.jsxs)($,{variant:`outline`,onClick:()=>{n.current&&(document.fullscreenElement?document.exitFullscreen():n.current.requestFullscreen())},children:[o?(0,f.jsx)(p.Shrink,{}):(0,f.jsx)(p.Expand,{}),o?`Exit Fullscreen`:`Fullscreen`]}),(0,f.jsxs)($,{variant:`outline`,onClick:()=>i?.(),disabled:r,children:[r&&(0,f.jsx)(oi,{}),r?`Refreshing...`:`Refresh Data`]}),(0,f.jsx)($,{variant:`outline`,onClick:()=>{window.confirm(`Are you sure you want to reset all settings to default?`)&&(e.resetColumnPinning(),e.resetRowPinning(),e.resetColumnVisibility(),e.resetColumnOrder(),e.resetColumnSizing(),e.resetColumnFilters(),e.resetGlobalFilter(),e.resetSorting(),e.resetRowSelection(),e.resetCellSelection(!0),e.resetPagination(),e.setDensity(`md`),t(!1),a&&a(``),window.alert(`Settings have been reset to default.`))},children:`Reset to Default`})]})]})},ci=({height:e})=>{"use no memo";let[t,n]=(0,c.useState)(null),r=e=>{n(t===e?null:e)},i={width:208,borderLeft:`1px solid var(--border)`,height:`100%`};return(0,f.jsxs)(`div`,{style:{display:`flex`,overflow:`hidden`,height:e,borderBottom:`1px solid var(--border)`},children:[t===`columns`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(Ur,{})}),t===`rows`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(ai,{})}),t===`filter`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(ni,{})}),t===`dnd`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(Qr,{})}),t===`settings`&&(0,f.jsx)(`div`,{style:i,children:(0,f.jsx)(si,{})}),(0,f.jsx)(`div`,{style:{width:28,borderLeft:`1px solid var(--border)`},children:[{value:`columns`,label:`Columns`,icon:p.Columns3},{value:`rows`,label:`Rows`,icon:p.Rows3},{value:`filter`,label:`Filter`,icon:p.Filter},{value:`dnd`,label:`Dnd`,icon:p.GripVertical},{value:`settings`,label:`Settings`,icon:p.Settings}].map(({value:e,label:n,icon:i})=>(0,f.jsxs)($,{onClick:()=>r(e),variant:t===e?`secondary`:`ghost`,style:{writingMode:`vertical-rl`,minWidth:28,width:28,fontSize:12,height:`auto`,borderRadius:`none`},children:[(0,f.jsx)(i,{size:14}),n]},e))})]})},li=({payload:e,columns:t,name:n,state:r,onColumnFiltersChange:i,onPaginationChange:a,onSortingChange:o,onRowSelectionChange:s,setGlobalFilter:c,manualPagination:l,manualFiltering:u,manualSorting:d,isLoading:p,isError:m,isFetching:h,refetch:g,height:_,getRowCanExpand:ee,renderSubComponent:v,enableCellSelection:y,enableCellSpanning:b,enableRowSelection:x,topRightSlot:te})=>{"use no memo";return(0,f.jsx)(we,{payload:e,columns:t,name:n,state:r,onColumnFiltersChange:i,onPaginationChange:a,onSortingChange:o,onRowSelectionChange:s,setGlobalFilter:c,manualPagination:l,manualFiltering:u,manualSorting:d,isLoading:p,isError:m,isFetching:h,refetch:g,height:_,getRowCanExpand:ee,renderSubComponent:v,enableCellSelection:y,enableCellSpanning:b,enableRowSelection:x,topRightSlot:te,children:(0,f.jsx)(ui,{})})},ui=()=>{"use no memo";let{gridWrapperRef:e}=L(),t=(0,c.useRef)(null),[n,r]=(0,c.useState)(0);return(0,c.useLayoutEffect)(()=>{t.current&&r(t.current.getBoundingClientRect().height)},[]),(0,c.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{r(e.getBoundingClientRect().height)},i=new ResizeObserver(n);return i.observe(e),document.addEventListener(`fullscreenchange`,n),window.addEventListener(`resize`,n),()=>{i.disconnect(),document.removeEventListener(`fullscreenchange`,n),window.removeEventListener(`resize`,n)}},[]),(0,f.jsxs)(`div`,{style:{position:`relative`,background:`color-mix(in srgb, var(--muted) 50%, transparent)`,border:`1px solid var(--border)`,borderRadius:`6px`},ref:e,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,overflow:`hidden`,width:`100%`},children:[(0,f.jsx)(Lr,{}),(0,f.jsx)(`div`,{style:{overflow:`hidden`,flex:1},ref:t,children:(0,f.jsx)(Tr,{})}),(0,f.jsx)(jr,{}),(0,f.jsx)(ci,{height:n})]}),(0,f.jsx)(Rr,{})]})},di=()=>{let[e,t]=c.default.useState([]),[n,r]=c.default.useState({pageIndex:0,pageSize:20}),[i,a]=c.default.useState([]),[o,s]=c.default.useState({}),[l,u]=c.default.useState(``);return{state:{columnFilters:e,globalFilter:l,pagination:n,sorting:i,rowSelection:o},handlers:{onColumnFiltersChange:t,onPaginationChange:r,onSortingChange:a,setGlobalFilter:u,onRowSelectionChange:s},rowSelection:o}},fi=e=>new URLSearchParams(e.flatMap(({id:e,value:t})=>{let n=e.replace(/_/g,`.`);return Array.isArray(t)&&t.length===2?[...t[0]!=null&&t[0]!==``?[[`${n}[gte]`,String(t[0])]]:[],...t[1]!=null&&t[1]!==``?[[`${n}[lte]`,String(t[1])]]:[]]:typeof t==`object`&&t?Object.entries(t).flatMap(([e,t])=>`eq.ne.gt.gte.lt.lte.in.nin.regex.exists.all.size.elemMatch.type.mod.not.and.or.nor.text.where.geoWithin.geoIntersects.near.nearSphere.expr.jsonSchema.bitsAllClear.bitsAllSet.bitsAnyClear.bitsAnySet.rand`.split(`.`).includes(e)&&t!=null&&t!==``?[[`${n}[${e}]`,String(t)]]:[]):t!=null&&t!==``?[[n,String(t)]]:[]})).toString();function pi(e){if(!e||e.length===0)return``;let t=e.filter(e=>e.id!=null&&e.id.trim()!==``).map(e=>e.desc?e.id:`-${e.id}`);return t.length===0?``:`sort=${t.join(`,`)}`}var mi=e=>(0,c.useMemo)(()=>({pagination:e.pagination,queryParams:fi(e.columnFilters),sort:pi(e.sorting),globalFilter:e.globalFilter}),[e]);function hi(e,t,n){return Object.entries(t).filter(([,e])=>e).map(([t])=>e[Number(t)]).filter(e=>e!==void 0).map(e=>e[n])}var gi=`eq.ne.gt.gte.lt.lte.in.nin.regex.exists.all.size.elemMatch.type.mod.not.and.or.nor.text.where.geoWithin.geoIntersects.near.nearSphere.expr.jsonSchema.bitsAllClear.bitsAllSet.bitsAnyClear.bitsAnySet.rand`.split(`.`);function _i(e,t){let{id:n,value:r}=t,i=n.replace(/_/g,`.`);if(Array.isArray(r)&&r.length===2){r[0]!=null&&r[0]!==``&&e.set(`${i}[gte]`,String(r[0])),r[1]!=null&&r[1]!==``&&e.set(`${i}[lte]`,String(r[1]));return}if(typeof r==`object`&&r){Object.entries(r).forEach(([t,n])=>{gi.includes(t)&&n!=null&&n!==``&&e.set(`${i}[${t}]`,String(n))});return}r!=null&&r!==``&&e.set(i,String(r))}function vi(e){let t=new URLSearchParams;if(t.set(`page`,String(e.pagination.pageIndex+1)),t.set(`limit`,String(e.pagination.pageSize)),e.columnFilters.forEach(e=>{_i(t,e)}),e.sorting.length>0){let n=e.sorting.map(e=>e.desc?`-${e.id}`:e.id).join(`,`);t.set(`sort`,n)}return e.globalFilter&&t.set(`q`,e.globalFilter),`?${t.toString()}`}exports.Grid=li,exports.URLSearch=vi,exports.pluckSelected=hi,exports.useGrid=L,exports.useGridState=di,exports.useQueryArgs=mi;
|
package/dist/index.js
CHANGED
|
@@ -3318,7 +3318,10 @@ function qi({ className: e, ...t }) {
|
|
|
3318
3318
|
//#region src/package/ui/header/HeaderFilter.tsx
|
|
3319
3319
|
var Ji = ({ column: e }) => {
|
|
3320
3320
|
"use no memo";
|
|
3321
|
-
let t = e.getFilterValue(), { filterVariant: n } = e.columnDef.meta ?? {}, { isFetching:
|
|
3321
|
+
let t = e.getFilterValue(), { filterVariant: n, options: r } = e.columnDef.meta ?? {}, { isFetching: i } = I(), a = r && r.length > 0 ? r : !i && n === "select" ? Array.from(e.getFacetedUniqueValues().keys()).sort().slice(0, 5e3).map((e) => ({
|
|
3322
|
+
label: String(e),
|
|
3323
|
+
value: String(e)
|
|
3324
|
+
})) : [];
|
|
3322
3325
|
return e.getCanFilter() ? /* @__PURE__ */ j("div", {
|
|
3323
3326
|
style: {
|
|
3324
3327
|
padding: "4px",
|
|
@@ -3353,10 +3356,10 @@ var Ji = ({ column: e }) => {
|
|
|
3353
3356
|
}), /* @__PURE__ */ j(Wi, { children: /* @__PURE__ */ M(Vi, { children: [/* @__PURE__ */ j(Gi, {
|
|
3354
3357
|
value: "all",
|
|
3355
3358
|
children: "All"
|
|
3356
|
-
}),
|
|
3357
|
-
value:
|
|
3358
|
-
children:
|
|
3359
|
-
},
|
|
3359
|
+
}), a.map((e) => /* @__PURE__ */ j(Gi, {
|
|
3360
|
+
value: e.value,
|
|
3361
|
+
children: e.label
|
|
3362
|
+
}, e.value))] }) })]
|
|
3360
3363
|
}) : n && [
|
|
3361
3364
|
"text",
|
|
3362
3365
|
"time",
|
|
@@ -4508,7 +4511,9 @@ var La = ({ column: e }) => {
|
|
|
4508
4511
|
variant: "outline",
|
|
4509
4512
|
size: "sm",
|
|
4510
4513
|
style: { width: "100%" },
|
|
4511
|
-
onClick: () =>
|
|
4514
|
+
onClick: () => {
|
|
4515
|
+
t.setColumnFilters([]), r && r("");
|
|
4516
|
+
},
|
|
4512
4517
|
children: [/* @__PURE__ */ j(We, { size: 16 }), "Reset Filters"]
|
|
4513
4518
|
})
|
|
4514
4519
|
})
|
|
@@ -4838,10 +4843,10 @@ function Ha({ className: e, ...t }) {
|
|
|
4838
4843
|
//#region src/package/ui/toolbar/right/ToolbarRightSettings.tsx
|
|
4839
4844
|
var Ua = () => {
|
|
4840
4845
|
"use no memo";
|
|
4841
|
-
let { table: e, setIsSplit: t, gridWrapperRef: n, isFetching: r, refetch: a } = I(), [
|
|
4846
|
+
let { table: e, setIsSplit: t, gridWrapperRef: n, isFetching: r, refetch: a, setGlobalFilter: o } = I(), [s, l] = c(!1);
|
|
4842
4847
|
return i(() => {
|
|
4843
4848
|
let e = () => {
|
|
4844
|
-
|
|
4849
|
+
l(document.fullscreenElement === n.current);
|
|
4845
4850
|
};
|
|
4846
4851
|
return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
|
|
4847
4852
|
}, [n]), /* @__PURE__ */ M("div", {
|
|
@@ -4883,7 +4888,7 @@ var Ua = () => {
|
|
|
4883
4888
|
onClick: () => {
|
|
4884
4889
|
n.current && (document.fullscreenElement ? document.exitFullscreen() : n.current.requestFullscreen());
|
|
4885
4890
|
},
|
|
4886
|
-
children: [j(
|
|
4891
|
+
children: [j(s ? Ze : Ae, {}), s ? "Exit Fullscreen" : "Fullscreen"]
|
|
4887
4892
|
}),
|
|
4888
4893
|
/* @__PURE__ */ M($, {
|
|
4889
4894
|
variant: "outline",
|
|
@@ -4894,7 +4899,7 @@ var Ua = () => {
|
|
|
4894
4899
|
/* @__PURE__ */ j($, {
|
|
4895
4900
|
variant: "outline",
|
|
4896
4901
|
onClick: () => {
|
|
4897
|
-
window.confirm("Are you sure you want to reset all settings to default?") && (e.resetColumnPinning(), e.resetRowPinning(), e.resetColumnVisibility(), e.resetColumnOrder(), e.resetColumnSizing(), e.resetColumnFilters(), e.resetGlobalFilter(), e.resetSorting(), e.resetRowSelection(), e.resetCellSelection(!0), e.resetPagination(), e.setDensity("md"), t(!1), window.alert("Settings have been reset to default."));
|
|
4902
|
+
window.confirm("Are you sure you want to reset all settings to default?") && (e.resetColumnPinning(), e.resetRowPinning(), e.resetColumnVisibility(), e.resetColumnOrder(), e.resetColumnSizing(), e.resetColumnFilters(), e.resetGlobalFilter(), e.resetSorting(), e.resetRowSelection(), e.resetCellSelection(!0), e.resetPagination(), e.setDensity("md"), t(!1), o && o(""), window.alert("Settings have been reset to default."));
|
|
4898
4903
|
},
|
|
4899
4904
|
children: "Reset to Default"
|
|
4900
4905
|
})
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
interface MyColumnMeta {
|
|
2
2
|
filterVariant?: 'text' | 'number' | 'tel' | 'url' | 'color' | 'range' | 'select' | 'dateRange' | 'date' | 'datetime-local' | 'month' | 'time' | 'week' | 'search';
|
|
3
|
+
options?: {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}[];
|
|
3
7
|
}
|
|
4
8
|
export declare const features: {
|
|
5
9
|
rowExpandingFeature: import('@tanstack/react-table').TableFeature;
|