@collana-solutions/react-data-table 0.0.0-stage → 6.3.0
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/LICENSE +21 -0
- package/README.md +52 -3
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +2 -0
- package/dist/index.modern.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/lib/ReactDataTable/DragAndDropOptions.d.ts +15 -0
- package/dist/lib/ReactDataTable/ReactDataTable.d.ts +9 -0
- package/dist/lib/ReactDataTable/ReactDataTableProps.d.ts +116 -0
- package/dist/lib/ReactDataTable/TableBody.d.ts +13 -0
- package/dist/lib/ReactDataTable/TableRows.d.ts +16 -0
- package/dist/lib/ReactDataTable/VirtualizationOptions.d.ts +15 -0
- package/dist/lib/hooks/useVirtualizationTableHeight.d.ts +12 -0
- package/dist/lib/translations/translations.d.ts +15 -0
- package/dist/lib/types/ColumnFilterState.d.ts +5 -0
- package/dist/lib/types/NullableTypes.d.ts +27 -0
- package/dist/lib/types/SortingState.d.ts +13 -0
- package/dist/lib/types/TableState.d.ts +26 -0
- package/dist/lib/useFullyControlledReactDataTable/useFullyControlledReactDataTable.d.ts +23 -0
- package/dist/lib/useReactDataTable/useReactDataTable.d.ts +10 -0
- package/dist/lib/useReactDataTable/useReactDataTableProps.d.ts +74 -0
- package/dist/lib/useReactDataTable/useReactDataTableResult.d.ts +62 -0
- package/dist/lib/useReactDataTableState/usePersistentReactDataTableState.d.ts +22 -0
- package/dist/lib/useReactDataTableState/useReactDataTableState.d.ts +11 -0
- package/dist/lib/useReactDataTableState/useReactDataTableStateProps.d.ts +37 -0
- package/dist/lib/useReactDataTableState/useReactDataTableStateResult.d.ts +64 -0
- package/dist/lib/utils/createReactDataTableColumnHelper.d.ts +9 -0
- package/dist/lib/utils/customFilterMethods.d.ts +4 -0
- package/dist/lib/utils/getColumnFilterFromModel.d.ts +4 -0
- package/dist/lib/utils/getCommonPinningStyles.d.ts +4 -0
- package/dist/lib/utils/getModelFromColumnFilter.d.ts +4 -0
- package/dist/lib/utils/getModelFromSortingState.d.ts +4 -0
- package/dist/lib/utils/getSortingStateFromModel.d.ts +4 -0
- package/dist/lib/utils/getStronglyTypedColumnFilter.d.ts +3 -0
- package/dist/react-table.d.ts +85 -0
- package/package.json +129 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 collana solutions AG (formerly Neolution AG)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
This
|
|
1
|
+
# react-data-table
|
|
2
|
+
|
|
3
|
+
This package relies heavly on `tanstack/react-table` and `reactstrap` to provide a simple and easy to use data table.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @collana-solutions/react-data-table
|
|
9
|
+
or
|
|
10
|
+
yarn add @collana-solutions/react-data-table
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### CSS
|
|
14
|
+
|
|
15
|
+
The skeletons are provided by `react-loading-skeleton` so you need to import the css file in your project.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import "react-loading-skeleton/dist/skeleton.css";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Peer dependencies
|
|
22
|
+
|
|
23
|
+
todo
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
The main entry point for everything is the `ReactDataTable` component.
|
|
28
|
+
|
|
29
|
+
The props that you provide will determine if the table is sorted, filtered, paginated, etc. on the client or if the consumer of this package has to provide the data and the functions to update the data.
|
|
30
|
+
|
|
31
|
+
### Fully Static / Client Side Example
|
|
32
|
+
|
|
33
|
+
In this configuration the table is fully static meaning that the data will be sorted, filtered, paginated, etc. on the client.
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<ReactDataTable<Person, string> data={data} columns={columns} />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Fully Dynamic / Server Side Example
|
|
40
|
+
|
|
41
|
+
In this configuration the table is fully dynamic meaning that the consumer of this package has to provide the data and the functions to update the data.
|
|
42
|
+
|
|
43
|
+
| use case | onSorting | sorting |
|
|
44
|
+
| ---------------------------------------------------------------------------------------------------------- | --------- | ------- |
|
|
45
|
+
| you want to manually sort your data (possible server side) but you don't want to manage the state yourself | yes | no |
|
|
46
|
+
| you want the data table to handle the sorting but would like to influence the sorting from the outside | no | yes |
|
|
47
|
+
| you want to manually sort your data AND you want to mange the state yourself | yes | yes |
|
|
48
|
+
| you want the data table to handle the sorting and you don't want to manually influence the state | no | no |
|
|
49
|
+
|
|
50
|
+
### Documentation
|
|
51
|
+
|
|
52
|
+
Detailed documentation can be found at [ReactDataTable Wiki](https://github.com/collana-solutions/react-data-table/wiki/React-DataTable)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./lib/translations/translations";
|
|
2
|
+
export * from "./lib/useReactDataTableState/useReactDataTableState";
|
|
3
|
+
export * from "./lib/useReactDataTableState/useReactDataTableStateProps";
|
|
4
|
+
export * from "./lib/useReactDataTableState/usePersistentReactDataTableState";
|
|
5
|
+
export * from "./lib/useReactDataTable/useReactDataTable";
|
|
6
|
+
export * from "./lib/useReactDataTable/useReactDataTableProps";
|
|
7
|
+
export * from "./lib/useReactDataTable/useReactDataTableResult";
|
|
8
|
+
export * from "./lib/ReactDataTable/ReactDataTable";
|
|
9
|
+
export * from "./lib/ReactDataTable/ReactDataTableProps";
|
|
10
|
+
export * from "./lib/utils/getStronglyTypedColumnFilter";
|
|
11
|
+
export * from "./lib/useFullyControlledReactDataTable/useFullyControlledReactDataTable";
|
|
12
|
+
export * from "./lib/utils/createReactDataTableColumnHelper";
|
|
13
|
+
export * from "./lib/utils/getColumnFilterFromModel";
|
|
14
|
+
export * from "./lib/utils/getModelFromColumnFilter";
|
|
15
|
+
export * from "./lib/types/TableState";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("@neolution-ch/javascript-utils"),n=require("react/jsx-runtime"),o=require("@tanstack/react-table"),i=require("react-loading-skeleton"),a=require("@fortawesome/free-solid-svg-icons"),r=require("@fortawesome/react-fontawesome"),l=require("@neolution-ch/react-pattern-ui"),s=require("@neolution-ch/reactstrap"),c=require("@dnd-kit/core"),u=require("@dnd-kit/modifiers"),g=require("@tanstack/react-virtual"),d=require("@dnd-kit/sortable"),m=require("@dnd-kit/utilities");function p(e){return e&&e.__esModule?e:{default:e}}var S=p(i);exports.reactDataTableTranslations={actionTitle:"Aktionen",clearSearchToolTip:"Suche zurücksetzen",searchToolTip:"Suchen",showedItemsText:"Zeige {from} bis {to} von insgesamt {total} Resultaten",itemsPerPageDropdown:"Anzahl pro Seite",noEntries:"Keine Einträge vorhanden"};const f=t=>{const{initialColumnFilters:n,initialSorting:o,initialPagination:i,initialRowSelection:a,initialExpanded:r,initialColumnPinning:l,initialAfterSearchFilter:s}=t,[c,u]=e.useState(n??{}),[g,d]=e.useState(s??n??{}),[m,p]=e.useState(o),[S,f]=e.useState(a??{}),[h,x]=e.useState(r??{}),[w,b]=e.useState(l??{}),[C,F]=e.useState({pageIndex:i?.pageIndex??0,pageSize:i?.pageSize??10});return{sorting:m,pagination:C,columnFilters:c,afterSearchFilter:g,rowSelection:S,expanded:h,columnPinning:w,setSorting:p,setColumnFilters:u,setPagination:F,setAfterSearchFilter:d,setRowSelection:f,setExpanded:x,setColumnPinning:b}},h=e=>Object.entries(e).map(([e,t])=>({id:e,value:t})),x=e=>Object.fromEntries(e.map(({id:e,value:t})=>[e,t])),w=e=>e?[{id:String(e.id),desc:e.desc}]:[],b=t=>{const{data:i=[],columns:a,isLoading:r,initialState:l,manualFiltering:s,manualPagination:c,manualSorting:u,state:g,onColumnFiltersChange:d,onPaginationChange:m,onSortingChange:p,onRowSelectionChange:b,onExpandedChange:C,onColumnPinningChange:F,reactTableOptions:R}=t,{columnFilters:P,sorting:y,pagination:j,rowSelection:v,expanded:D,columnPinning:E}=l??{},{columnFilters:I,pagination:k,sorting:T,rowSelection:z,expanded:A,columnPinning:M}=g??{},{columnFilters:N,pagination:$,sorting:H,rowSelection:L,expanded:q,columnPinning:V,setColumnFilters:_,setPagination:O,setSorting:G,setRowSelection:K,setExpanded:B,setColumnPinning:U}=f({initialColumnFilters:P,initialPagination:j,initialSorting:y}),Y=I??N,Z=k??$,J=T??H,Q=z??L,W=A??q,X=M??V,ee=d??_,te=m??O,ne=p??G,oe=b??K,ie=C??B,ae=F??U;if(s)for(const e of a)e.filterFn=void 0;const re=a.filter(e=>!0!==e.meta?.isHidden),le=re.map(e=>({...e,cell:()=>n.jsx(S.default,{})})),se=Array.from({length:$.pageSize},()=>({})),ce=e.useMemo(()=>h(Y),[Y]),ue=e.useMemo(()=>w(J),[J]);return{table:o.useReactTable({data:r?se:i,columns:r?le:re,onColumnFiltersChange:e=>{const t="function"==typeof e?e(ce):e;return ee(x(t))},onPaginationChange:e=>{const t="function"==typeof e?e(Z):e;return te(t)},onSortingChange:e=>{const t="function"==typeof e?e(ue):e;return ne((e=>{const[t]=e;return t?{id:t.id,desc:t.desc}:void 0})(t))},onRowSelectionChange:e=>{const t="function"==typeof e?e(Q):e;return oe(t)},onExpandedChange:e=>{const t="function"==typeof e?e(W):e;return ie(t)},onColumnPinningChange:e=>{const t="function"==typeof e?e(X):e;return ae(t)},state:{columnFilters:ce,pagination:Z,sorting:ue,rowSelection:Q,expanded:W,columnPinning:X},initialState:{columnFilters:h(P??I??{}),pagination:j??k,sorting:w(y??T),expanded:D??A,columnPinning:E??M},getCoreRowModel:o.getCoreRowModel(),getFilteredRowModel:o.getFilteredRowModel(),getSortedRowModel:o.getSortedRowModel(),getPaginationRowModel:o.getPaginationRowModel(),getExpandedRowModel:o.getExpandedRowModel(),manualFiltering:s,manualPagination:c,manualSorting:u,enableMultiSort:!1,enableMultiRowSelection:!1,enableSubRowSelection:!1,enableRowSelection:R?.enableRowSelection??!1,defaultColumn:{enableColumnFilter:!1,enableSorting:!1},enableExpanding:R?.enableExpanding??!1,...R}),columnFilters:Y,pagination:Z,sorting:J,rowSelection:Q,expanded:W,columnPinning:X,setColumnFilters:ee,setPagination:te,setSorting:ne,setRowSelection:oe,setExpanded:ie,setColumnPinning:ae}},C=e=>{const t=e.getIsPinned();return{left:"left"===t?`${e.getStart("left")}px`:void 0,right:"right"===t?`${e.getAfter("right")}px`:void 0,position:t?"sticky":"relative",width:e.getSize(),zIndex:t?1:0}},F=(e,t,n)=>{const o=e.columnDef.meta?.customFilterName;o?t.setColumnFilters(e=>[...e.filter(e=>e.id!==o),{id:o,value:n}]):e.setFilterValue(n)},R=(e,t)=>{const n=e.columnDef.meta?.customFilterName;return n?t.getState().columnFilters.find(e=>e.id===n)?.value:e.getFilterValue()},P=e=>{const{row:t,rowStyle:i,setNodeRef:a,enableRowSelection:r=!1,fullRowSelectable:l=!0,onRowClick:s,enableRowClick:c,hasPinnedColumns:u,subRowComponent:g}=e,d=("function"==typeof r?r(t):r)&&l,m="function"==typeof c?c(t):c;return n.jsxs(n.Fragment,{children:[n.jsx("tr",{ref:a,onClick:async()=>{d?t.toggleSelected():m&&s&&await s(t)},className:d||m?"cursor-pointer":void 0,style:i,children:t.getVisibleCells().map(e=>n.jsx("td",{style:{...e.column.columnDef.meta?.cellStyle,...u?C(e.column):{}},className:e.column.columnDef.meta?.cellClassName,children:o.flexRender(e.column.columnDef.cell,e.getContext())},e.id))},t.id),g&&t.getIsExpanded()&&g(t)]})},y=e=>{const{row:t,rowStyle:o}=e,{transform:i,transition:a,setNodeRef:r,isDragging:l}=d.useSortable({id:t.id}),s={transform:m.CSS.Transform.toString(i),transition:a,opacity:l?.8:1,zIndex:l?1:0,position:"relative"};return n.jsx(P,{...e,setNodeRef:r,rowStyle:o?{...o,...s}:s})},j=t=>{const{enableDragAndDrop:o,table:i,rowStyle:a,enableRowClick:r,onRowClick:l,virtualizer:s,subRowComponent:c}=t;if(o&&!i.options.getRowId)throw new Error("You must provide 'getRowId()' to data-table options in order to use the drag-and-drop feature.");const{options:{enableRowSelection:u,enableExpanding:g,fullRowSelectable:m}}=i,{rows:p}=i.getRowModel(),S=s?.getVirtualItems(),f=e.useMemo(()=>S?S.map((e,t)=>({row:p[e.index],rowStyle:{height:`${e.size}px`,transform:`translateY(${e.start-t*e.size}px)`}})):p.map(e=>({row:e})),[p,S]);return o?n.jsx(d.SortableContext,{items:i.getRowModel().rows.map(e=>e.id),strategy:d.verticalListSortingStrategy,children:f.map((e,t)=>{const{row:o}=e;return n.jsx(y,{row:o,enableRowClick:r,onRowClick:l,enableRowSelection:u,enableExpanding:g,rowStyle:{...e.rowStyle,...a?a(o.original):{}},fullRowSelectable:m,subRowComponent:c},t)})}):n.jsx(n.Fragment,{children:f.map((e,t)=>{const{row:o}=e;return n.jsx(P,{row:o,enableRowClick:r,onRowClick:l,enableRowSelection:u,enableExpanding:g,rowStyle:{...e.rowStyle,...a?a(o.original):{}},fullRowSelectable:m,hasPinnedColumns:i.getIsSomeColumnsPinned(),subRowComponent:c},t)})})},v=t=>{const{parentRef:n,virtualizer:o,enabled:i,onPseudoHeightChange:a}=t,r=e.useRef(null),l=e.useRef(null),[s,c]=e.useState(!1),u=i?o.getVirtualItems():[],g=i?o.getTotalSize():0,d=e.useCallback(()=>((e,t,n)=>{if(!e.current)return;const o=window.getComputedStyle(e.current,"::after"),i=Number.parseFloat(o.height)||0,a=e.current.clientHeight-i,r=Math.max(t-a,0);return n?.(r),r})(l,g,a),[l,g,a]),m=e.useCallback(()=>{if(n.current){const e=n.current?.scrollTop,t=n.current?.clientHeight;c(e>.95*g-t)}},[n,g]);return e.useEffect(()=>{if(!i)return;const e=n.current;return e&&e.addEventListener("scroll",m),d(),()=>{e&&e.removeEventListener("scroll",m)}},[m,d,n,i]),e.useEffect(()=>{i&&s&&d()},[s,u.length,d,i]),{scrollableRef:r,tableRef:l}},D=t=>{const{virtualizer:i,isLoading:l,isFetching:c,table:u,tableClassName:g,tableStyle:d,rowStyle:m,onEnter:p,withoutHeaders:S=!1,withoutHeaderFilters:f=!1,dragAndDropOptions:h,noEntriesMessage:w,isStriped:b=!0,showClearSearchButton:P=!0,tableRef:y,tableHeaderStyle:v}=t,{options:{manualPagination:D},resetPageIndex:E}=u;return n.jsxs(s.Table,{striped:b,hover:!0,size:"sm",className:g,style:!l&&c?{...d,background:"linear-gradient(90deg, #E8E8E8, #ffffff, #E8E8E8)",backgroundSize:"200% 200%",animation:"reloadingAnimation 3s linear infinite"}:d,innerRef:y,children:[!S&&n.jsx("thead",{style:v,children:u.getHeaderGroups().map(t=>n.jsxs(e.Fragment,{children:[n.jsx("tr",{children:t.headers.map(e=>n.jsxs("th",{onClick:e.column.getToggleSortingHandler(),style:{...e.column.columnDef.meta?.headerStyle,...e.column.getCanSort()?{cursor:"pointer"}:{},...u.getIsSomeColumnsPinned()?C(e.subHeaders.length>0?e.subHeaders[0].column:e.column):{}},className:e.column.columnDef.meta?.headerClassName,colSpan:e.colSpan,children:[e.isPlaceholder?null:o.flexRender(e.column.columnDef.header,e.getContext()),"desc"===e.column.getIsSorted()?n.jsx(r.FontAwesomeIcon,{icon:a.faSortDown,className:"ms-1"}):"asc"===e.column.getIsSorted()?n.jsx(r.FontAwesomeIcon,{icon:a.faSortUp,className:"ms-1"}):e.column.getCanSort()?n.jsx(r.FontAwesomeIcon,{icon:a.faSort,className:"ms-1"}):""]},e.id))},`${t.id}-col-header`),!f&&!t.headers.every(e=>!!e.column.columnDef.meta?.hideHeaderFilters)&&n.jsx("tr",{children:t.headers.map(e=>{const{column:{columnDef:{meta:t}}}=e;return n.jsxs("th",{style:{...e.column.columnDef.meta?.headerFilterStyle,...u.getIsSomeColumnsPinned()?C(e.column):{}},children:[0===e.index&&n.jsxs(n.Fragment,{children:[p&&n.jsx(r.FontAwesomeIcon,{style:{cursor:"pointer",marginBottom:"4px",marginRight:"5px"},icon:a.faSearch,onClick:()=>{D&&E(!0),p(x(u.getState().columnFilters))}}),P&&n.jsx(r.FontAwesomeIcon,{style:{cursor:"pointer",marginBottom:"4px",marginRight:"5px"},icon:a.faTimes,onClick:()=>{p&&p(x(u.initialState.columnFilters)),u.setColumnFilters(u.initialState.columnFilters),D&&E(!0)}})]}),e.column.getCanFilter()&&n.jsx(n.Fragment,{children:t?.customFilter?t?.customFilter(R(e.column,u),t=>F(e.column,u,t),u):t?.dropdownFilter?n.jsx(s.Input,{type:"select",value:R(e.column,u)??"",onChange:n=>{F(e.column,u,t.dropdownFilter?.options[n.target.selectedIndex]?.value??n.target.value),!p&&D&&E(!0)},onKeyUp:({key:e})=>{"Enter"===e&&p&&(D&&E(!0),p(x(u.getState().columnFilters)))},bsSize:"sm",children:t.dropdownFilter.options.map(({label:e,value:t,disabled:o},i)=>n.jsx("option",{value:t,disabled:o,children:e},i))}):n.jsx(s.Input,{type:"text",value:R(e.column,u)??"",onChange:t=>{F(e.column,u,t.target.value),!p&&D&&E(!0)},onKeyUp:({key:e})=>{"Enter"===e&&p&&(D&&E(!0),p(x(u.getState().columnFilters)))},bsSize:"sm"})})]},`${e.id}-col-filter`)})},`${t.id}-col-filters`)]},t.id))}),n.jsx("tbody",{children:0===u.getRowModel().rows.length?n.jsx("tr",{children:n.jsx("td",{colSpan:u.getVisibleFlatColumns().length,children:w??exports.reactDataTableTranslations.noEntries})}):n.jsx(j,{...t,table:u,enableDragAndDrop:!!h?.enableDragAndDrop,rowStyle:m,virtualizer:i})}),u.getFooterGroups().length>0&&u.getFooterGroups().some(e=>e.headers.some(e=>!e.isPlaceholder&&e.column.columnDef.footer))&&n.jsx("tfoot",{children:u.getFooterGroups().map(e=>n.jsx("tr",{children:e.headers.map(e=>n.jsx("th",{style:e.column.columnDef.meta?.footerStyle,className:e.column.columnDef.meta?.footerClassName,children:e.isPlaceholder?null:o.flexRender(e.column.columnDef.footer,e.getContext())},e.id))},e.id))})]})};exports.ReactDataTable=t=>{const{virtualizerOptions:o={count:0,enabled:!1,estimateSize:()=>0},table:i,pageSizes:a,showPaging:r,hidePageSizeChange:s,totalRecords:d=i.getCoreRowModel().rows.length,dragAndDropOptions:m,pagingNavigationComponents:p,isLoading:f,isFetching:h,onPseudoHeightChange:x}=t,{pagination:w}=i.getState(),b=e.useRef(null),C=g.useVirtualizer({...o,count:d,getScrollElement:()=>b.current}),F=c.useSensors(c.useSensor(c.MouseSensor,{}),c.useSensor(c.TouchSensor,{}),c.useSensor(c.KeyboardSensor,{})),{scrollableRef:R,tableRef:P}=v({parentRef:b,virtualizer:C,enabled:o.enabled??!1,onPseudoHeightChange:x});return n.jsxs(n.Fragment,{children:[n.jsxs(c.DndContext,{collisionDetection:c.closestCenter,modifiers:[u.restrictToVerticalAxis],onDragEnd:m?.onDragEnd,sensors:F,children:[n.jsx("style",{children:" \n @-webkit-keyframes reloadingAnimation {\n 0%{\n background-position-x: 200%\n }\n 100%{\n background-position-x: 0%\n }\n }"}),o.enabled?n.jsx("div",{ref:b,style:{height:o.height??600,overflow:"auto"},children:n.jsx("div",{ref:R,style:{height:`${C.getTotalSize()}px`},children:n.jsx(D,{...t,virtualizer:C,tableRef:P})})}):n.jsx(D,{...t})]}),r&&n.jsx(n.Fragment,{children:f||h?n.jsx(S.default,{count:1,height:20}):n.jsx(l.Paging,{currentItemsPerPage:w.pageSize,currentPage:w.pageIndex+1,totalRecords:d,currentRecordCount:i.getRowModel().rows.length,setItemsPerPage:e=>{i.setPageSize(e)},setCurrentPage:e=>i.setPageIndex(e-1),possiblePageItemCounts:a,translations:{itemsPerPageDropdown:exports.reactDataTableTranslations.itemsPerPageDropdown,showedItemsText:exports.reactDataTableTranslations.showedItemsText},pagingPossible:!0,changePageSizePossible:!s,navigationComponents:p})})]})},exports.createReactDataTableColumnHelper=()=>{const e=o.createColumnHelper();return{...e,createDraggableColumn:(t,o,i,l)=>{const s=({row:e})=>{const t=void 0===i||("function"==typeof i?i(e):i),{attributes:o,listeners:s,isDragging:c}=d.useSortable({id:e.id,disabled:!t});return n.jsx("span",{...o,...s,className:!1===t?"opacity-25":"opacity-100",style:{cursor:!1===t?"auto":c?"grabbing":"grab"},children:l??n.jsx(r.FontAwesomeIcon,{icon:a.faGripLines})})};return e.display({...o,id:t,cell:({row:e})=>n.jsx(s,{row:e})})},createEnumColumn:(t,n,o)=>e.accessor(t,{cell:e=>Array.isArray(n)?n.find(t=>t.value===e.getValue())?.label:n[e.getValue()],enableColumnFilter:!0,meta:{dropdownFilter:{options:Array.isArray(n)?n:Object.entries(n).map(([e,t])=>({label:t,value:e}))}},...o})}},exports.getColumnFilterFromModel=h,exports.getModelFromColumnFilter=x,exports.getStronglyTypedColumnFilter=(e,t,n)=>{const o=e.find(e=>e.id===t);if(o){if("string"===n)return o.value;if("number"===n){const e=Number.parseFloat(o.value);return Number.isNaN(e)?void 0:e}}},exports.setDataTableTranslations=function(e){exports.reactDataTableTranslations=e},exports.useFullyControlledReactDataTable=e=>b({manualFiltering:!0,manualPagination:!0,manualSorting:!0,...e}),exports.usePersistentReactDataTableState=n=>{const{initialColumnFilters:o,initialSorting:i,initialPagination:a,initialRowSelection:r,initialExpanded:l,initialColumnPinning:s,initialAfterSearchFilter:c,localStorageKey:u,getExpirationDate:g}=n,d=e.useRef(g);e.useInsertionEffect(()=>{d.current=g},[g]);const{pagination:m,setPagination:p,columnFilters:S,columnPinning:h,expanded:x,rowSelection:w,sorting:b,setColumnFilters:C,afterSearchFilter:F,setAfterSearchFilter:R,setColumnPinning:P,setExpanded:y,setRowSelection:j,setSorting:v}=f({initialColumnPinning:t.getLocalStorageItem(`${u}_columnPinning`)??s,initialExpanded:t.getLocalStorageItem(`${u}_expanded`)??l,initialPagination:t.getLocalStorageItem(`${u}_pagination`)??a,initialRowSelection:t.getLocalStorageItem(`${u}_rowSelection`)??r,initialSorting:t.getLocalStorageItem(`${u}_sorting`)??i,initialColumnFilters:t.getLocalStorageItem(`${u}_columnFilters`)??o,initialAfterSearchFilter:t.getLocalStorageItem(`${u}_afterSearchFilter`)??c}),D=e.useRef({pagination:m,columnFilters:S,afterSearchFilter:F,columnPinning:h,expanded:x,rowSelection:w,sorting:b}),E=e.useCallback((e,n,o)=>{const i="function"==typeof o?o(D.current[e]):o;D.current[e]=i,t.setLocalStorageItem(`${u}_${e}`,i,d.current?.()),n(o)},[u]);return{pagination:m,setPagination:e.useCallback(e=>E("pagination",p,e),[E,p]),columnFilters:S,setColumnFilters:e.useCallback(e=>E("columnFilters",C,e),[E,C]),afterSearchFilter:F,setAfterSearchFilter:e.useCallback(e=>E("afterSearchFilter",R,e),[E,R]),columnPinning:h,setColumnPinning:e.useCallback(e=>E("columnPinning",P,e),[E,P]),expanded:x,setExpanded:e.useCallback(e=>E("expanded",y,e),[E,y]),rowSelection:w,setRowSelection:e.useCallback(e=>E("rowSelection",j,e),[E,j]),sorting:b,setSorting:e.useCallback(e=>E("sorting",v,e),[E,v])}},exports.useReactDataTable=b,exports.useReactDataTableState=f;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/lib/translations/translations.ts","../src/lib/useReactDataTableState/useReactDataTableState.ts","../src/lib/utils/getColumnFilterFromModel.ts","../src/lib/utils/getModelFromColumnFilter.ts","../src/lib/utils/getSortingStateFromModel.ts","../src/lib/useReactDataTable/useReactDataTable.tsx","../src/lib/utils/getModelFromSortingState.ts","../src/lib/utils/getCommonPinningStyles.ts","../src/lib/utils/customFilterMethods.ts","../src/lib/ReactDataTable/TableRows.tsx","../src/lib/ReactDataTable/TableBody.tsx","../src/lib/hooks/useVirtualizationTableHeight.tsx","../src/lib/ReactDataTable/ReactDataTable.tsx","../src/lib/utils/createReactDataTableColumnHelper.tsx","../src/lib/utils/getStronglyTypedColumnFilter.ts","../src/lib/useFullyControlledReactDataTable/useFullyControlledReactDataTable.tsx","../src/lib/useReactDataTableState/usePersistentReactDataTableState.ts"],"sourcesContent":["/**\r\n * This are the possible translations for the data table\r\n * @interface DataTableTranslations\r\n * @property {string} clearSearchToolTip is used to print out the bottom text, possible placeholders are: {from}, {to} and {total}\r\n */\r\nexport interface ReactDataTableTranslations {\r\n actionTitle: string;\r\n showedItemsText: string;\r\n searchToolTip: string;\r\n clearSearchToolTip: string;\r\n itemsPerPageDropdown: string;\r\n noEntries: string;\r\n}\r\n\r\nexport let reactDataTableTranslations: ReactDataTableTranslations = {\r\n actionTitle: \"Aktionen\",\r\n clearSearchToolTip: \"Suche zurücksetzen\",\r\n searchToolTip: \"Suchen\",\r\n showedItemsText: \"Zeige {from} bis {to} von insgesamt {total} Resultaten\",\r\n itemsPerPageDropdown: \"Anzahl pro Seite\",\r\n noEntries: \"Keine Einträge vorhanden\",\r\n};\r\n\r\nexport function setDataTableTranslations(translations: ReactDataTableTranslations) {\r\n reactDataTableTranslations = translations;\r\n}\r\n","import { useState } from \"react\";\r\nimport { ColumnPinningState, ExpandedState, PaginationState, RowSelectionState } from \"@tanstack/react-table\";\r\nimport { useReactDataTableStateProps } from \"./useReactDataTableStateProps\";\r\nimport { useReactDataTableStateResult } from \"./useReactDataTableStateResult\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { SortingState } from \"../types/SortingState\";\r\nimport { OptionalNullable } from \"../types/NullableTypes\";\r\n\r\n/**\r\n * A custom hook that will initialize all the state needed for the react data table\r\n * @param props The properties to configure the initial state\r\n * @returns the state and the setters\r\n */\r\nconst useReactDataTableState = <TData, TFilter extends FilterModel = Record<string, never>>(\r\n props: OptionalNullable<useReactDataTableStateProps<TData, TFilter>>,\r\n): useReactDataTableStateResult<TData, TFilter> => {\r\n const {\r\n initialColumnFilters,\r\n initialSorting,\r\n initialPagination,\r\n initialRowSelection,\r\n initialExpanded,\r\n initialColumnPinning,\r\n initialAfterSearchFilter,\r\n } = props as useReactDataTableStateProps<TData, TFilter>;\r\n\r\n const [columnFilters, setColumnFilters] = useState<TFilter>((initialColumnFilters ?? {}) as TFilter);\r\n const [afterSearchFilter, setAfterSearchFilter] = useState<TFilter>((initialAfterSearchFilter ?? initialColumnFilters ?? {}) as TFilter);\r\n const [sorting, setSorting] = useState<SortingState<TData> | undefined>(initialSorting);\r\n const [rowSelection, setRowSelection] = useState<RowSelectionState>(initialRowSelection ?? ({} as RowSelectionState));\r\n const [expanded, setExpanded] = useState<ExpandedState>(initialExpanded ?? ({} as ExpandedState));\r\n const [columnPinning, setColumnPinning] = useState<ColumnPinningState>(initialColumnPinning ?? ({} as ColumnPinningState));\r\n\r\n const [pagination, setPagination] = useState<PaginationState>({\r\n pageIndex: initialPagination?.pageIndex ?? 0,\r\n pageSize: initialPagination?.pageSize ?? 10,\r\n });\r\n\r\n return {\r\n sorting,\r\n pagination,\r\n columnFilters,\r\n afterSearchFilter,\r\n rowSelection,\r\n expanded,\r\n columnPinning,\r\n setSorting,\r\n setColumnFilters,\r\n setPagination,\r\n setAfterSearchFilter,\r\n setRowSelection,\r\n setExpanded,\r\n setColumnPinning,\r\n };\r\n};\r\n\r\nexport { useReactDataTableState };\r\n","import { ColumnFiltersState } from \"@tanstack/react-table\";\r\nimport { FilterModel } from \"../types/TableState\";\r\n\r\nconst getColumnFilterFromModel = <TFilter extends FilterModel>(filter: TFilter): ColumnFiltersState =>\r\n Object.entries(filter).map(([id, value]) => ({ id, value: value as unknown }));\r\n\r\nexport { getColumnFilterFromModel };\r\n","import { ColumnFilter, ColumnFiltersState } from \"@tanstack/react-table\";\r\nimport { FilterModel } from \"../types/TableState\";\r\n\r\nconst getModelFromColumnFilter = <TFilter extends FilterModel>(filter: ColumnFiltersState): TFilter =>\r\n Object.fromEntries(filter.map(({ id, value }: ColumnFilter) => [id, value])) as TFilter;\r\n\r\nexport { getModelFromColumnFilter };\r\n","import { SortingState } from \"@tanstack/react-table\";\r\nimport { SortingState as CustomSortingState } from \"../types/SortingState\";\r\n\r\nconst getSortingStateFromModel = <TData>(sortingState?: CustomSortingState<TData>): SortingState =>\r\n sortingState ? [{ id: String(sortingState.id), desc: sortingState.desc }] : [];\r\n\r\nexport { getSortingStateFromModel };\r\n","import {\r\n getCoreRowModel,\r\n getExpandedRowModel,\r\n getFilteredRowModel,\r\n getPaginationRowModel,\r\n getSortedRowModel,\r\n useReactTable,\r\n} from \"@tanstack/react-table\";\r\nimport { useReactDataTableState } from \"../useReactDataTableState/useReactDataTableState\";\r\nimport Skeleton from \"react-loading-skeleton\";\r\nimport { useReactDataTableProps } from \"./useReactDataTableProps\";\r\nimport { useReactDataTableResult } from \"./useReactDataTableResult\";\r\nimport { getColumnFilterFromModel } from \"../utils/getColumnFilterFromModel\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { getModelFromColumnFilter } from \"../utils/getModelFromColumnFilter\";\r\nimport { getSortingStateFromModel } from \"../utils/getSortingStateFromModel\";\r\nimport { getModelFromSortingState } from \"../utils/getModelFromSortingState\";\r\nimport { OptionalNullable } from \"../types/NullableTypes\";\r\nimport { useMemo } from \"react\";\r\nimport { useReactDataTableStateProps } from \"../useReactDataTableState/useReactDataTableStateProps\";\r\n\r\n/**\r\n * A react hook that returns a react table instance and the state of the table\r\n * @param props The properties to configure the table\r\n * @returns The table instance and the state of the table\r\n */\r\n\r\nconst useReactDataTable = <TData, TFilter extends FilterModel = Record<string, never>>(\r\n props: useReactDataTableProps<TData, TFilter>,\r\n): useReactDataTableResult<TData, TFilter> => {\r\n const {\r\n data = [],\r\n columns,\r\n isLoading,\r\n initialState,\r\n manualFiltering,\r\n manualPagination,\r\n manualSorting,\r\n state,\r\n onColumnFiltersChange,\r\n onPaginationChange,\r\n onSortingChange,\r\n onRowSelectionChange,\r\n onExpandedChange,\r\n onColumnPinningChange,\r\n reactTableOptions,\r\n } = props;\r\n\r\n const {\r\n columnFilters: columnFiltersInitial,\r\n sorting: sortingInitial,\r\n pagination: paginationInitial,\r\n rowSelection: rowSelectionInitial,\r\n expanded: expandedInitial,\r\n columnPinning: columnPinningInitial,\r\n } = initialState ?? {};\r\n const {\r\n columnFilters: columnFiltersExternal,\r\n pagination: paginationExternal,\r\n sorting: sortingExternal,\r\n rowSelection: rowSelectionExternal,\r\n expanded: expandedExternal,\r\n columnPinning: columnPinningExternal,\r\n } = state ?? {};\r\n\r\n const {\r\n columnFilters: columnFiltersInternal,\r\n pagination: paginationInternal,\r\n sorting: sortingInternal,\r\n rowSelection: rowSelectionInteral,\r\n expanded: expandedInternal,\r\n columnPinning: columnPinningInternal,\r\n setColumnFilters: setColumnFiltersInternal,\r\n setPagination: setPaginationInternal,\r\n setSorting: setSortingInternal,\r\n setRowSelection: setRowSelectionInternal,\r\n setExpanded: setExpandedInternal,\r\n setColumnPinning: setColumnPinningInternal,\r\n } = useReactDataTableState<TData, TFilter>({\r\n initialColumnFilters: columnFiltersInitial as TFilter,\r\n initialPagination: paginationInitial,\r\n initialSorting: sortingInitial,\r\n rowSelection: rowSelectionInitial,\r\n expanded: expandedInitial,\r\n columnPinning: columnPinningInitial,\r\n } as unknown as OptionalNullable<useReactDataTableStateProps<TData, TFilter>>);\r\n\r\n const effectiveColumnFilters = columnFiltersExternal ?? columnFiltersInternal;\r\n const effectivePagination = paginationExternal ?? paginationInternal;\r\n const effectiveSorting = sortingExternal ?? sortingInternal;\r\n const effectiveRowSelection = rowSelectionExternal ?? rowSelectionInteral;\r\n const effectiveExpanded = expandedExternal ?? expandedInternal;\r\n const effectiveColumnPinning = columnPinningExternal ?? columnPinningInternal;\r\n const effectiveOnColumnFiltersChange = onColumnFiltersChange ?? setColumnFiltersInternal;\r\n const effectiveOnPaginationChange = onPaginationChange ?? setPaginationInternal;\r\n const effectiveOnSortingChange = onSortingChange ?? setSortingInternal;\r\n const effectiveOnRowSelectionChange = onRowSelectionChange ?? setRowSelectionInternal;\r\n const effectiveOnExpandedChange = onExpandedChange ?? setExpandedInternal;\r\n const effectiveOnColumnPinningChange = onColumnPinningChange ?? setColumnPinningInternal;\r\n\r\n // If we active the manual filtering, we have to unset the filter function, else it still does automatic filtering\r\n if (manualFiltering) for (const x of columns) x.filterFn = undefined;\r\n\r\n const internalColumns = columns.filter((x) => x.meta?.isHidden !== true);\r\n const skeletonColumns = internalColumns.map((column) => ({\r\n ...column,\r\n cell: () => <Skeleton />,\r\n }));\r\n const skeletonData = Array.from({ length: paginationInternal.pageSize }, () => ({}) as TData);\r\n\r\n const columnFilters = useMemo(() => getColumnFilterFromModel(effectiveColumnFilters), [effectiveColumnFilters]);\r\n const sorting = useMemo(() => getSortingStateFromModel(effectiveSorting), [effectiveSorting]);\r\n\r\n // known issue for tanstack with open ticket: https://github.com/facebook/react/issues/33057\r\n // eslint-disable-next-line react-hooks/incompatible-library\r\n const table = useReactTable<TData>({\r\n data: isLoading ? skeletonData : data,\r\n columns: isLoading ? skeletonColumns : internalColumns,\r\n\r\n onColumnFiltersChange: (filtersOrUpdaterFn) => {\r\n const newFilter = typeof filtersOrUpdaterFn === \"function\" ? filtersOrUpdaterFn(columnFilters) : filtersOrUpdaterFn;\r\n return effectiveOnColumnFiltersChange(getModelFromColumnFilter(newFilter));\r\n },\r\n onPaginationChange: (paginationOrUpdaterFn) => {\r\n const newFilter = typeof paginationOrUpdaterFn === \"function\" ? paginationOrUpdaterFn(effectivePagination) : paginationOrUpdaterFn;\r\n return effectiveOnPaginationChange(newFilter);\r\n },\r\n onSortingChange: (sortingOrUpdaterFn) => {\r\n const newFilter = typeof sortingOrUpdaterFn === \"function\" ? sortingOrUpdaterFn(sorting) : sortingOrUpdaterFn;\r\n return effectiveOnSortingChange(getModelFromSortingState(newFilter));\r\n },\r\n onRowSelectionChange: (rowSelectionOrUpdaterFn) => {\r\n const newRowSelection =\r\n typeof rowSelectionOrUpdaterFn === \"function\" ? rowSelectionOrUpdaterFn(effectiveRowSelection) : rowSelectionOrUpdaterFn;\r\n return effectiveOnRowSelectionChange(newRowSelection);\r\n },\r\n onExpandedChange: (expandedOrUpdaterFn) => {\r\n const newExpanded = typeof expandedOrUpdaterFn === \"function\" ? expandedOrUpdaterFn(effectiveExpanded) : expandedOrUpdaterFn;\r\n return effectiveOnExpandedChange(newExpanded);\r\n },\r\n onColumnPinningChange: (columnPinningOrUpdaterFn) => {\r\n const newColumnPinning =\r\n typeof columnPinningOrUpdaterFn === \"function\" ? columnPinningOrUpdaterFn(effectiveColumnPinning) : columnPinningOrUpdaterFn;\r\n return effectiveOnColumnPinningChange(newColumnPinning);\r\n },\r\n\r\n state: {\r\n columnFilters,\r\n pagination: effectivePagination,\r\n sorting,\r\n rowSelection: effectiveRowSelection,\r\n expanded: effectiveExpanded,\r\n columnPinning: effectiveColumnPinning,\r\n },\r\n\r\n initialState: {\r\n columnFilters: getColumnFilterFromModel(columnFiltersInitial ?? columnFiltersExternal ?? {}),\r\n pagination: paginationInitial ?? paginationExternal,\r\n sorting: getSortingStateFromModel(sortingInitial ?? sortingExternal),\r\n expanded: expandedInitial ?? expandedExternal,\r\n columnPinning: columnPinningInitial ?? columnPinningExternal,\r\n },\r\n\r\n getCoreRowModel: getCoreRowModel(),\r\n getFilteredRowModel: getFilteredRowModel(),\r\n getSortedRowModel: getSortedRowModel(),\r\n getPaginationRowModel: getPaginationRowModel(),\r\n getExpandedRowModel: getExpandedRowModel(),\r\n\r\n manualFiltering,\r\n manualPagination,\r\n manualSorting,\r\n\r\n enableMultiSort: false,\r\n enableMultiRowSelection: false,\r\n enableSubRowSelection: false,\r\n\r\n // The row selection is enabled by default in Tanstack API. We don't want it per default\r\n enableRowSelection: reactTableOptions?.enableRowSelection ?? false,\r\n defaultColumn: {\r\n enableColumnFilter: false,\r\n enableSorting: false,\r\n },\r\n\r\n enableExpanding: reactTableOptions?.enableExpanding ?? false,\r\n\r\n ...reactTableOptions,\r\n });\r\n\r\n return {\r\n table,\r\n columnFilters: effectiveColumnFilters,\r\n pagination: effectivePagination,\r\n sorting: effectiveSorting,\r\n rowSelection: effectiveRowSelection,\r\n expanded: effectiveExpanded,\r\n columnPinning: effectiveColumnPinning,\r\n setColumnFilters: effectiveOnColumnFiltersChange,\r\n setPagination: effectiveOnPaginationChange,\r\n setSorting: effectiveOnSortingChange,\r\n setRowSelection: effectiveOnRowSelectionChange,\r\n setExpanded: effectiveOnExpandedChange,\r\n setColumnPinning: effectiveOnColumnPinningChange,\r\n };\r\n};\r\n\r\nexport { useReactDataTable };\r\n","import { SortingState as CustomSortingState } from \"../types/SortingState\";\r\nimport { SortingState } from \"@tanstack/react-table\";\r\n\r\nconst getModelFromSortingState = <TData>(sortingState: SortingState): CustomSortingState<TData> | undefined => {\r\n const [first] = sortingState;\r\n return first ? { id: first.id as keyof TData, desc: first.desc } : undefined;\r\n};\r\n\r\nexport { getModelFromSortingState };\r\n","import { Column } from \"@tanstack/react-table\";\r\nimport { CSSProperties } from \"react\";\r\n\r\n// These are the important styles to make sticky column pinning work!\r\nconst getCommonPinningStyles = <TData>(column: Column<TData>): CSSProperties => {\r\n const isPinned = column.getIsPinned();\r\n\r\n return {\r\n left: isPinned === \"left\" ? `${column.getStart(\"left\")}px` : undefined,\r\n right: isPinned === \"right\" ? `${column.getAfter(\"right\")}px` : undefined,\r\n position: isPinned ? \"sticky\" : \"relative\",\r\n width: column.getSize(),\r\n zIndex: isPinned ? 1 : 0,\r\n };\r\n};\r\n\r\nexport { getCommonPinningStyles };\r\n","import { Column, Table } from \"@tanstack/react-table\";\r\n\r\nconst setFilterValue = <TData>(column: Column<TData, unknown>, table: Table<TData>, value: unknown) => {\r\n const customFilterName = column.columnDef.meta?.customFilterName;\r\n\r\n if (customFilterName) {\r\n table.setColumnFilters((prev) => [...prev.filter((x) => x.id !== customFilterName), { id: customFilterName, value }]);\r\n } else {\r\n column.setFilterValue(value);\r\n }\r\n};\r\n\r\nconst getFilterValue = <TData>(column: Column<TData, unknown>, table: Table<TData>): unknown => {\r\n const customFilterName = column.columnDef.meta?.customFilterName;\r\n\r\n if (customFilterName) {\r\n return table.getState().columnFilters.find((x) => x.id === customFilterName)?.value;\r\n }\r\n return column.getFilterValue();\r\n};\r\n\r\nexport { setFilterValue, getFilterValue };\r\n","import { useSortable } from \"@dnd-kit/sortable\";\r\nimport { Row, flexRender } from \"@tanstack/react-table\";\r\nimport { CSSProperties } from \"react\";\r\nimport { CSS } from \"@dnd-kit/utilities\";\r\nimport { getCommonPinningStyles } from \"../utils/getCommonPinningStyles\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { ReactDataTableProps } from \"./ReactDataTableProps\";\r\n\r\ninterface TableRowProps<TData, TFilter extends FilterModel = Record<string, never>> extends Pick<\r\n ReactDataTableProps<TData, TFilter>,\r\n \"onRowClick\" | \"enableRowClick\" | \"subRowComponent\"\r\n> {\r\n row: Row<TData>;\r\n enableRowSelection?: boolean | ((row: Row<TData>) => boolean);\r\n fullRowSelectable?: boolean;\r\n enableExpanding?: boolean | ((row: Row<TData>) => boolean);\r\n rowStyle?: CSSProperties;\r\n setNodeRef?: (node: HTMLElement | null) => void;\r\n hasPinnedColumns?: boolean;\r\n}\r\n\r\nconst InternalTableRow = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableRowProps<TData, TFilter>) => {\r\n const {\r\n row,\r\n rowStyle,\r\n setNodeRef,\r\n enableRowSelection = false,\r\n fullRowSelectable = true,\r\n onRowClick,\r\n enableRowClick,\r\n hasPinnedColumns,\r\n subRowComponent,\r\n } = props;\r\n const isRowSelectionEnabled =\r\n (typeof enableRowSelection === \"function\" ? enableRowSelection(row) : enableRowSelection) && fullRowSelectable;\r\n const isRowClickable = typeof enableRowClick === \"function\" ? enableRowClick(row) : enableRowClick;\r\n return (\r\n <>\r\n <tr\r\n key={row.id}\r\n ref={setNodeRef}\r\n onClick={async () => {\r\n if (isRowSelectionEnabled) {\r\n row.toggleSelected();\r\n } else if (isRowClickable && onRowClick) {\r\n await onRowClick(row);\r\n } else {\r\n // Nothing to execute\r\n }\r\n }}\r\n className={isRowSelectionEnabled || isRowClickable ? \"cursor-pointer\" : undefined}\r\n style={rowStyle}\r\n >\r\n {row.getVisibleCells().map((cell) => (\r\n <td\r\n key={cell.id}\r\n style={{\r\n ...cell.column.columnDef.meta?.cellStyle,\r\n ...(hasPinnedColumns ? getCommonPinningStyles(cell.column) : {}),\r\n }}\r\n className={cell.column.columnDef.meta?.cellClassName}\r\n >\r\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\r\n </td>\r\n ))}\r\n </tr>\r\n {subRowComponent && row.getIsExpanded() && subRowComponent(row)}\r\n </>\r\n );\r\n};\r\n\r\nconst DraggableRow = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableRowProps<TData, TFilter>) => {\r\n const { row, rowStyle } = props;\r\n const { transform, transition, setNodeRef, isDragging } = useSortable({ id: row.id });\r\n const draggableStyle: CSSProperties = {\r\n transform: CSS.Transform.toString(transform),\r\n transition: transition,\r\n opacity: isDragging ? 0.8 : 1,\r\n zIndex: isDragging ? 1 : 0,\r\n position: \"relative\",\r\n };\r\n return (\r\n <InternalTableRow<TData, TFilter>\r\n {...props}\r\n setNodeRef={setNodeRef}\r\n rowStyle={rowStyle ? { ...rowStyle, ...draggableStyle } : draggableStyle}\r\n />\r\n );\r\n};\r\n\r\nexport { InternalTableRow, DraggableRow };\r\n","import { DraggableRow, InternalTableRow } from \"./TableRows\";\r\nimport { SortableContext, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\r\nimport { Row, Table } from \"@tanstack/react-table\";\r\nimport { CSSProperties, useMemo } from \"react\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { ReactDataTableProps } from \"./ReactDataTableProps\";\r\nimport { Virtualizer } from \"@tanstack/react-virtual\";\r\n\r\ninterface TableBodyProps<TData, TFilter extends FilterModel = Record<string, never>> extends Pick<\r\n ReactDataTableProps<TData, TFilter>,\r\n \"enableRowClick\" | \"onRowClick\" | \"subRowComponent\"\r\n> {\r\n enableDragAndDrop: boolean;\r\n table: Table<TData>;\r\n rowStyle?: (row: TData) => CSSProperties;\r\n virtualizer?: Virtualizer<HTMLDivElement, Element>;\r\n}\r\n\r\ninterface InternalRow<TData> {\r\n row: Row<TData>;\r\n rowStyle?: CSSProperties;\r\n}\r\n\r\nconst TableBody = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableBodyProps<TData, TFilter>) => {\r\n const { enableDragAndDrop, table, rowStyle, enableRowClick, onRowClick, virtualizer, subRowComponent } = props;\r\n\r\n if (enableDragAndDrop && !table.options.getRowId) {\r\n throw new Error(\"You must provide 'getRowId()' to data-table options in order to use the drag-and-drop feature.\");\r\n }\r\n\r\n const {\r\n options: { enableRowSelection, enableExpanding, fullRowSelectable },\r\n } = table;\r\n\r\n const { rows } = table.getRowModel();\r\n\r\n const virtualizerRows = virtualizer?.getVirtualItems();\r\n\r\n const rowsToRender: InternalRow<TData>[] = useMemo(\r\n () =>\r\n virtualizerRows\r\n ? virtualizerRows.map((virtualRow, index) => ({\r\n row: rows[virtualRow.index],\r\n rowStyle: {\r\n height: `${virtualRow.size}px`,\r\n transform: `translateY(${virtualRow.start - index * virtualRow.size}px)`,\r\n },\r\n }))\r\n : rows.map((row) => ({ row })),\r\n [rows, virtualizerRows],\r\n );\r\n\r\n return enableDragAndDrop ? (\r\n <SortableContext items={table.getRowModel().rows.map((row) => row.id)} strategy={verticalListSortingStrategy}>\r\n {rowsToRender.map((x, index) => {\r\n const { row } = x;\r\n return (\r\n <DraggableRow<TData, TFilter>\r\n key={index}\r\n row={row}\r\n enableRowClick={enableRowClick}\r\n onRowClick={onRowClick}\r\n enableRowSelection={enableRowSelection as boolean | ((row: Row<TData>) => boolean)}\r\n enableExpanding={enableExpanding as boolean | ((row: Row<TData>) => boolean)}\r\n rowStyle={{\r\n ...x.rowStyle,\r\n ...(rowStyle ? rowStyle(row.original) : {}),\r\n }}\r\n fullRowSelectable={fullRowSelectable}\r\n subRowComponent={subRowComponent}\r\n />\r\n );\r\n })}\r\n </SortableContext>\r\n ) : (\r\n <>\r\n {rowsToRender.map((x, index) => {\r\n const { row } = x;\r\n return (\r\n <InternalTableRow<TData, TFilter>\r\n key={index}\r\n row={row}\r\n enableRowClick={enableRowClick}\r\n onRowClick={onRowClick}\r\n enableRowSelection={enableRowSelection as boolean | ((row: Row<TData>) => boolean)}\r\n enableExpanding={enableExpanding as boolean | ((row: Row<TData>) => boolean)}\r\n rowStyle={{\r\n ...x.rowStyle,\r\n ...(rowStyle ? rowStyle(row.original) : {}),\r\n }}\r\n fullRowSelectable={fullRowSelectable}\r\n hasPinnedColumns={table.getIsSomeColumnsPinned()}\r\n subRowComponent={subRowComponent}\r\n />\r\n );\r\n })}\r\n </>\r\n );\r\n};\r\n\r\nexport { TableBody };\r\n","import { Virtualizer } from \"@tanstack/react-virtual\";\r\nimport { useCallback, useEffect, useRef, useState } from \"react\";\r\n\r\nconst adjustTableHeight = (\r\n tableRef: React.RefObject<HTMLTableElement | null>,\r\n virtualHeight: number,\r\n onPseudoHeightChange: useVirtualizationTableHeightProps[\"onPseudoHeightChange\"],\r\n) => {\r\n if (!tableRef.current) return;\r\n\r\n // calculate the height for the pseudo element after the table\r\n const existingPseudoElement = window.getComputedStyle(tableRef.current, \"::after\");\r\n const existingPseudoHeight = Number.parseFloat(existingPseudoElement.height) || 0;\r\n const tableHeight = tableRef.current.clientHeight - existingPseudoHeight;\r\n const pseudoHeight = Math.max(virtualHeight - tableHeight, 0);\r\n onPseudoHeightChange?.(pseudoHeight);\r\n\r\n return pseudoHeight;\r\n};\r\n\r\nexport interface useVirtualizationTableHeightProps {\r\n parentRef: React.RefObject<HTMLDivElement | null>;\r\n virtualizer: Virtualizer<HTMLDivElement, Element>;\r\n enabled: boolean;\r\n onPseudoHeightChange?: (height: number) => void;\r\n}\r\n\r\n// https://github.com/TanStack/virtual/issues/640\r\nconst useVirtualizationTableHeight = (props: useVirtualizationTableHeightProps) => {\r\n const { parentRef, virtualizer, enabled, onPseudoHeightChange } = props;\r\n const scrollableRef = useRef<HTMLDivElement>(null);\r\n const tableRef = useRef<HTMLTableElement>(null);\r\n const [isScrollNearBottom, setIsScrollNearBottom] = useState(false);\r\n\r\n // avoid calling virtualizer methods when virtualization is disabled\r\n const virtualItems = enabled ? virtualizer.getVirtualItems() : [];\r\n const virtualSize = enabled ? virtualizer.getTotalSize() : 0;\r\n\r\n // callback to adjust the height of the pseudo element\r\n const handlePseudoResize = useCallback(\r\n () => adjustTableHeight(tableRef, virtualSize, onPseudoHeightChange),\r\n [tableRef, virtualSize, onPseudoHeightChange],\r\n );\r\n\r\n // callback to handle scrolling, checking if we are near the bottom\r\n const handleScroll = useCallback(() => {\r\n if (parentRef.current) {\r\n const scrollPosition = parentRef.current?.scrollTop;\r\n const visibleHeight = parentRef.current?.clientHeight;\r\n setIsScrollNearBottom(scrollPosition > virtualSize * 0.95 - visibleHeight);\r\n }\r\n }, [parentRef, virtualSize]);\r\n\r\n // add an event listener on the scrollable parent container and resize the\r\n // pseudo element whenever the table renders with new data\r\n useEffect(() => {\r\n if (!enabled) {\r\n return;\r\n }\r\n\r\n const scrollable = parentRef.current;\r\n if (scrollable) scrollable.addEventListener(\"scroll\", handleScroll);\r\n handlePseudoResize();\r\n\r\n return () => {\r\n if (scrollable) scrollable.removeEventListener(\"scroll\", handleScroll);\r\n };\r\n }, [handleScroll, handlePseudoResize, parentRef, enabled]);\r\n\r\n // if we are near the bottom of the table, resize the pseudo element each time\r\n // the length of virtual items changes (which is effectively the number of table\r\n // rows rendered to the DOM). This ensures we don't scroll too far or too short.\r\n useEffect(() => {\r\n if (!enabled) {\r\n return;\r\n }\r\n\r\n if (isScrollNearBottom) handlePseudoResize();\r\n }, [isScrollNearBottom, virtualItems.length, handlePseudoResize, enabled]);\r\n\r\n return { scrollableRef, tableRef };\r\n};\r\n\r\nexport { useVirtualizationTableHeight };\r\n","/* eslint max-lines: [\"error\", 400] */\r\nimport { faSortDown, faSortUp, faSearch, faTimes, faSort } from \"@fortawesome/free-solid-svg-icons\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { Paging } from \"@neolution-ch/react-pattern-ui\";\r\nimport { flexRender } from \"@tanstack/react-table\";\r\nimport { Table as ReactStrapTable, Input } from \"@neolution-ch/reactstrap\";\r\nimport { reactDataTableTranslations } from \"../translations/translations\";\r\nimport { ReactDataTableProps } from \"./ReactDataTableProps\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { getModelFromColumnFilter } from \"../utils/getModelFromColumnFilter\";\r\nimport { Fragment, useRef } from \"react\";\r\nimport { DndContext, KeyboardSensor, MouseSensor, TouchSensor, closestCenter, useSensor, useSensors } from \"@dnd-kit/core\";\r\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\r\nimport { getCommonPinningStyles } from \"../utils/getCommonPinningStyles\";\r\nimport { getFilterValue, setFilterValue } from \"../utils/customFilterMethods\";\r\nimport { useVirtualizer, Virtualizer } from \"@tanstack/react-virtual\";\r\nimport { TableBody } from \"./TableBody\";\r\nimport { useVirtualizationTableHeight } from \"../hooks/useVirtualizationTableHeight\";\r\nimport Skeleton from \"react-loading-skeleton\";\r\n\r\ninterface TableInternalProps<TData, TFilter extends FilterModel = Record<string, never>> extends ReactDataTableProps<TData, TFilter> {\r\n virtualizer?: Virtualizer<HTMLDivElement, Element>;\r\n tableRef?: React.RefObject<HTMLTableElement | null>;\r\n}\r\n\r\nconst TableInternal = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableInternalProps<TData, TFilter>) => {\r\n const {\r\n virtualizer,\r\n isLoading,\r\n isFetching,\r\n table,\r\n tableClassName,\r\n tableStyle,\r\n rowStyle,\r\n onEnter,\r\n withoutHeaders = false,\r\n withoutHeaderFilters = false,\r\n dragAndDropOptions,\r\n noEntriesMessage,\r\n isStriped = true,\r\n showClearSearchButton = true,\r\n tableRef,\r\n tableHeaderStyle,\r\n } = props;\r\n\r\n const {\r\n options: { manualPagination },\r\n resetPageIndex,\r\n } = table;\r\n\r\n return (\r\n <ReactStrapTable\r\n striped={isStriped}\r\n hover\r\n size=\"sm\"\r\n className={tableClassName}\r\n style={\r\n !isLoading && isFetching\r\n ? {\r\n ...tableStyle,\r\n background: \"linear-gradient(90deg, #E8E8E8, #ffffff, #E8E8E8)\",\r\n backgroundSize: \"200% 200%\",\r\n animation: \"reloadingAnimation 3s linear infinite\",\r\n }\r\n : tableStyle\r\n }\r\n innerRef={tableRef}\r\n >\r\n {!withoutHeaders && (\r\n <thead style={tableHeaderStyle}>\r\n {table.getHeaderGroups().map((headerGroup) => (\r\n <Fragment key={headerGroup.id}>\r\n <tr key={`${headerGroup.id}-col-header`}>\r\n {headerGroup.headers.map((header) => (\r\n <th\r\n key={header.id}\r\n onClick={header.column.getToggleSortingHandler()}\r\n style={{\r\n ...header.column.columnDef.meta?.headerStyle,\r\n ...(header.column.getCanSort() ? { cursor: \"pointer\" } : {}),\r\n ...(table.getIsSomeColumnsPinned()\r\n ? getCommonPinningStyles(header.subHeaders.length > 0 ? header.subHeaders[0].column : header.column)\r\n : {}),\r\n }}\r\n className={header.column.columnDef.meta?.headerClassName}\r\n colSpan={header.colSpan}\r\n >\r\n {header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}\r\n\r\n {header.column.getIsSorted() === \"desc\" ? (\r\n <FontAwesomeIcon icon={faSortDown} className=\"ms-1\" />\r\n ) : header.column.getIsSorted() === \"asc\" ? (\r\n <FontAwesomeIcon icon={faSortUp} className=\"ms-1\" />\r\n ) : header.column.getCanSort() ? (\r\n <FontAwesomeIcon icon={faSort} className=\"ms-1\" />\r\n ) : (\r\n \"\"\r\n )}\r\n </th>\r\n ))}\r\n </tr>\r\n {!withoutHeaderFilters && !headerGroup.headers.every((x) => !!x.column.columnDef.meta?.hideHeaderFilters) && (\r\n <tr key={`${headerGroup.id}-col-filters`}>\r\n {headerGroup.headers.map((header) => {\r\n const {\r\n column: {\r\n columnDef: { meta },\r\n },\r\n } = header;\r\n\r\n return (\r\n <th\r\n key={`${header.id}-col-filter`}\r\n style={{\r\n ...header.column.columnDef.meta?.headerFilterStyle,\r\n ...(table.getIsSomeColumnsPinned() ? getCommonPinningStyles(header.column) : {}),\r\n }}\r\n >\r\n {header.index === 0 && (\r\n <>\r\n {onEnter && (\r\n <FontAwesomeIcon\r\n style={{ cursor: \"pointer\", marginBottom: \"4px\", marginRight: \"5px\" }}\r\n icon={faSearch}\r\n onClick={() => {\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n onEnter(getModelFromColumnFilter(table.getState().columnFilters));\r\n }}\r\n />\r\n )}\r\n\r\n {showClearSearchButton && (\r\n <FontAwesomeIcon\r\n style={{ cursor: \"pointer\", marginBottom: \"4px\", marginRight: \"5px\" }}\r\n icon={faTimes}\r\n onClick={() => {\r\n if (onEnter) {\r\n onEnter(getModelFromColumnFilter(table.initialState.columnFilters));\r\n }\r\n\r\n table.setColumnFilters(table.initialState.columnFilters);\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n }}\r\n />\r\n )}\r\n </>\r\n )}\r\n {header.column.getCanFilter() && (\r\n <>\r\n {meta?.customFilter ? (\r\n meta?.customFilter(\r\n getFilterValue(header.column, table),\r\n (value) => setFilterValue(header.column, table, value),\r\n table,\r\n )\r\n ) : meta?.dropdownFilter ? (\r\n <Input\r\n type=\"select\"\r\n value={(getFilterValue(header.column, table) as string) ?? \"\"}\r\n onChange={(e) => {\r\n setFilterValue(\r\n header.column,\r\n table,\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n meta.dropdownFilter?.options[(e.target as any as HTMLSelectElement).selectedIndex]?.value ??\r\n e.target.value,\r\n );\r\n if (!onEnter && manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n }}\r\n onKeyUp={({ key }) => {\r\n if (key === \"Enter\" && onEnter) {\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n onEnter(getModelFromColumnFilter(table.getState().columnFilters));\r\n }\r\n }}\r\n bsSize=\"sm\"\r\n >\r\n {meta.dropdownFilter.options.map(({ label, value, disabled }, i) => (\r\n <option key={i} value={value} disabled={disabled}>\r\n {label}\r\n </option>\r\n ))}\r\n </Input>\r\n ) : (\r\n <Input\r\n type=\"text\"\r\n value={(getFilterValue(header.column, table) as string) ?? \"\"}\r\n onChange={(e) => {\r\n setFilterValue(header.column, table, e.target.value);\r\n if (!onEnter && manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n }}\r\n onKeyUp={({ key }) => {\r\n if (key === \"Enter\" && onEnter) {\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n onEnter(getModelFromColumnFilter(table.getState().columnFilters));\r\n }\r\n }}\r\n bsSize=\"sm\"\r\n ></Input>\r\n )}\r\n </>\r\n )}\r\n </th>\r\n );\r\n })}\r\n </tr>\r\n )}\r\n </Fragment>\r\n ))}\r\n </thead>\r\n )}\r\n <tbody>\r\n {table.getRowModel().rows.length === 0 ? (\r\n <tr>\r\n <td colSpan={table.getVisibleFlatColumns().length}>{noEntriesMessage ?? reactDataTableTranslations.noEntries}</td>\r\n </tr>\r\n ) : (\r\n <TableBody<TData>\r\n {...props}\r\n table={table}\r\n enableDragAndDrop={!!dragAndDropOptions?.enableDragAndDrop}\r\n rowStyle={rowStyle}\r\n virtualizer={virtualizer}\r\n />\r\n )}\r\n </tbody>\r\n {table.getFooterGroups().length > 0 &&\r\n table.getFooterGroups().some((x) => x.headers.some((y) => !y.isPlaceholder && y.column.columnDef.footer)) && (\r\n <tfoot>\r\n {table.getFooterGroups().map((footerGroup) => (\r\n <tr key={footerGroup.id}>\r\n {footerGroup.headers.map((header) => (\r\n <th\r\n key={header.id}\r\n style={header.column.columnDef.meta?.footerStyle}\r\n className={header.column.columnDef.meta?.footerClassName}\r\n >\r\n {header.isPlaceholder ? null : flexRender(header.column.columnDef.footer, header.getContext())}\r\n </th>\r\n ))}\r\n </tr>\r\n ))}\r\n </tfoot>\r\n )}\r\n </ReactStrapTable>\r\n );\r\n};\r\n\r\n/**\r\n * The table renderer for the react data table\r\n * @param props according to {@link ReactDataTableProps}\r\n * @returns The rendered ReactDataTable component\r\n */\r\nconst ReactDataTable = <TData, TFilter extends FilterModel = Record<string, never>>(props: ReactDataTableProps<TData, TFilter>) => {\r\n const {\r\n virtualizerOptions = { count: 0, enabled: false, estimateSize: () => 0 },\r\n table,\r\n pageSizes,\r\n showPaging,\r\n hidePageSizeChange,\r\n totalRecords = table.getCoreRowModel().rows.length,\r\n dragAndDropOptions,\r\n pagingNavigationComponents,\r\n isLoading,\r\n isFetching,\r\n onPseudoHeightChange,\r\n } = props;\r\n\r\n const { pagination } = table.getState();\r\n\r\n const loadingCss = ` \r\n @-webkit-keyframes reloadingAnimation {\r\n 0%{\r\n background-position-x: 200%\r\n }\r\n 100%{\r\n background-position-x: 0%\r\n }\r\n }`;\r\n\r\n const parentRef = useRef<HTMLDivElement>(null);\r\n\r\n const virtualizer = useVirtualizer({\r\n ...virtualizerOptions,\r\n count: totalRecords,\r\n getScrollElement: () => parentRef.current,\r\n });\r\n\r\n const sensors = useSensors(useSensor(MouseSensor, {}), useSensor(TouchSensor, {}), useSensor(KeyboardSensor, {}));\r\n\r\n const { scrollableRef, tableRef } = useVirtualizationTableHeight({\r\n parentRef,\r\n virtualizer,\r\n enabled: virtualizerOptions.enabled ?? false,\r\n onPseudoHeightChange,\r\n });\r\n\r\n return (\r\n <>\r\n <DndContext\r\n collisionDetection={closestCenter}\r\n modifiers={[restrictToVerticalAxis]}\r\n onDragEnd={dragAndDropOptions?.onDragEnd}\r\n sensors={sensors}\r\n >\r\n <style>{loadingCss}</style>\r\n\r\n {virtualizerOptions.enabled ? (\r\n <div ref={parentRef} style={{ height: virtualizerOptions.height ?? 600, overflow: \"auto\" }}>\r\n <div ref={scrollableRef} style={{ height: `${virtualizer.getTotalSize()}px` }}>\r\n <TableInternal<TData, TFilter> {...props} virtualizer={virtualizer} tableRef={tableRef} />\r\n </div>\r\n </div>\r\n ) : (\r\n <TableInternal<TData, TFilter> {...props} />\r\n )}\r\n </DndContext>\r\n\r\n {showPaging && (\r\n <>\r\n {isLoading || isFetching ? (\r\n <Skeleton count={1} height={20} />\r\n ) : (\r\n <Paging\r\n currentItemsPerPage={pagination.pageSize}\r\n currentPage={pagination.pageIndex + 1}\r\n totalRecords={totalRecords}\r\n currentRecordCount={table.getRowModel().rows.length}\r\n setItemsPerPage={(x) => {\r\n table.setPageSize(x);\r\n }}\r\n setCurrentPage={(x) => table.setPageIndex(x - 1)}\r\n possiblePageItemCounts={pageSizes}\r\n translations={{\r\n itemsPerPageDropdown: reactDataTableTranslations.itemsPerPageDropdown,\r\n showedItemsText: reactDataTableTranslations.showedItemsText,\r\n }}\r\n pagingPossible={true}\r\n changePageSizePossible={!hidePageSizeChange}\r\n navigationComponents={pagingNavigationComponents}\r\n />\r\n )}\r\n </>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nexport { ReactDataTable };\r\n","import { useSortable } from \"@dnd-kit/sortable\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { ColumnDef, ColumnHelper, DeepKeys, DisplayColumnDef, RowData, Row, createColumnHelper } from \"@tanstack/react-table\";\r\nimport { ReactNode } from \"react\";\r\nimport type { DropdownColumnFilterOption } from \"src/react-table\";\r\nimport { faGripLines } from \"@fortawesome/free-solid-svg-icons\";\r\n\r\ninterface ReactDataTableColumnHelper<TData extends RowData> extends ColumnHelper<TData> {\r\n createEnumColumn: <TEnum extends string | number>(\r\n columnKey: DeepKeys<TData>,\r\n enumTranslations: Record<TEnum, string> | DropdownColumnFilterOption[],\r\n columndDef?: Partial<ColumnDef<TData, TEnum>>,\r\n ) => ColumnDef<TData, TEnum>;\r\n createDraggableColumn: (\r\n columnKey: DeepKeys<TData>,\r\n columndDef: Omit<DisplayColumnDef<TData>, \"id\" | \"cell\">,\r\n isEnabled?: boolean | ((row: Row<TData>) => boolean),\r\n draggableElement?: ReactNode,\r\n ) => ColumnDef<TData>;\r\n}\r\n\r\nconst createReactDataTableColumnHelper = <TData extends RowData>(): ReactDataTableColumnHelper<TData> => {\r\n const columnHelper = createColumnHelper<TData>();\r\n\r\n const createDraggableColumn: ReactDataTableColumnHelper<TData>[\"createDraggableColumn\"] = (\r\n columnKey,\r\n columndDef,\r\n isEnabled,\r\n draggableElement,\r\n ) => {\r\n const RowDragHandleCell = ({ row }: { row: Row<TData> }) => {\r\n const isEnabledInternal = isEnabled === undefined ? true : typeof isEnabled === \"function\" ? isEnabled(row) : isEnabled;\r\n const { attributes, listeners, isDragging } = useSortable({ id: row.id, disabled: !isEnabledInternal });\r\n\r\n return (\r\n <span\r\n {...attributes}\r\n {...listeners}\r\n className={isEnabledInternal === false ? \"opacity-25\" : \"opacity-100\"}\r\n style={{ cursor: isEnabledInternal === false ? \"auto\" : isDragging ? \"grabbing\" : \"grab\" }}\r\n >\r\n {draggableElement ?? <FontAwesomeIcon icon={faGripLines} />}\r\n </span>\r\n );\r\n };\r\n\r\n return columnHelper.display({\r\n ...columndDef,\r\n id: columnKey as string,\r\n cell: ({ row }) => <RowDragHandleCell row={row} />,\r\n });\r\n };\r\n\r\n const res: ReactDataTableColumnHelper<TData> = {\r\n ...columnHelper,\r\n createDraggableColumn,\r\n createEnumColumn: (columnKey, enumTranslations, columndDef) =>\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n columnHelper.accessor(columnKey as any, {\r\n cell: (cell) =>\r\n Array.isArray(enumTranslations)\r\n ? enumTranslations.find((x) => x.value === cell.getValue())?.label\r\n : enumTranslations[cell.getValue()],\r\n enableColumnFilter: true,\r\n meta: {\r\n dropdownFilter: {\r\n options: Array.isArray(enumTranslations)\r\n ? enumTranslations\r\n : Object.entries(enumTranslations).map(([key, value]) => ({\r\n label: value as string,\r\n value: key,\r\n })),\r\n },\r\n },\r\n ...columndDef,\r\n }),\r\n };\r\n\r\n return res;\r\n};\r\n\r\nexport { createReactDataTableColumnHelper };\r\n","import { ColumnFiltersState } from \"@tanstack/react-table\";\r\n\r\nconst getStronglyTypedColumnFilter = <TData, TResult extends string | number>(\r\n columnFilters: ColumnFiltersState,\r\n id: keyof TData,\r\n targetType: \"string\" | \"number\",\r\n): TResult | undefined => {\r\n const item = columnFilters.find((element) => element.id === id);\r\n\r\n if (!item) {\r\n return undefined;\r\n }\r\n\r\n if (targetType === \"string\") {\r\n return item.value as TResult;\r\n } else if (targetType === \"number\") {\r\n const parsedValue = Number.parseFloat(item.value as string);\r\n return Number.isNaN(parsedValue) ? undefined : (parsedValue as TResult);\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport { getStronglyTypedColumnFilter };\r\n","import { useReactDataTable } from \"../useReactDataTable/useReactDataTable\";\r\nimport { useReactDataTableProps } from \"../useReactDataTable/useReactDataTableProps\";\r\nimport { useReactDataTableResult } from \"../useReactDataTable/useReactDataTableResult\";\r\nimport { FilterModel, TableState } from \"../types/TableState\";\r\n\r\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\r\n\r\ninterface useFullyControlledReactDataTableProps<TData, TFilter extends FilterModel> extends WithRequired<\r\n Omit<useReactDataTableProps<TData, TFilter>, \"manualFiltering\" | \"manualPagination\" | \"manualSorting\">,\r\n \"onColumnFiltersChange\" | \"onPaginationChange\" | \"onSortingChange\"\r\n> {\r\n state: {\r\n columnFilters: TableState<TData, TFilter>[\"columnFilters\"];\r\n pagination: TableState<TData, TFilter>[\"pagination\"];\r\n sorting: TableState<TData, TFilter>[\"sorting\"];\r\n expanded: TableState<TData, TFilter>[\"expanded\"];\r\n rowSelection?: TableState<TData, TFilter>[\"rowSelection\"];\r\n columnPinning?: TableState<TData, TFilter>[\"columnPinning\"];\r\n };\r\n}\r\n\r\n/**\r\n * A helper hook to use the useReactDataTable hook which is fully controlled. Usefull for server side filtering, sorting and pagination.\r\n * @param props The properties to configure the table\r\n * @returns The table instance and the state of the table\r\n */\r\nconst useFullyControlledReactDataTable = <TData, TFilter extends FilterModel>(\r\n props: useFullyControlledReactDataTableProps<TData, TFilter>,\r\n): useReactDataTableResult<TData, TFilter> =>\r\n useReactDataTable<TData, TFilter>({ manualFiltering: true, manualPagination: true, manualSorting: true, ...props });\r\n\r\nexport { useFullyControlledReactDataTable };\r\n","import { getLocalStorageItem, setLocalStorageItem } from \"@neolution-ch/javascript-utils\";\r\nimport { OptionalNullable } from \"../types/NullableTypes\";\r\nimport { useReactDataTableStateProps } from \"./useReactDataTableStateProps\";\r\nimport { useReactDataTableStateResult } from \"./useReactDataTableStateResult\";\r\nimport { useReactDataTableState } from \"./useReactDataTableState\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { Dispatch, SetStateAction, useCallback, useInsertionEffect, useRef } from \"react\";\r\n\r\ninterface PersistentReactDataTableStateProps {\r\n /**\r\n * The prefix of the local storage keys the state is persisted under\r\n */\r\n localStorageKey: string;\r\n /**\r\n * Returns the date the persisted state expires, called on every write (e.g. `() => getEndOfDay(new Date())`).\r\n * Expired state is ignored and the initial state is used instead. Without it, the persisted state never expires.\r\n */\r\n getExpirationDate?: () => Date;\r\n}\r\n\r\ntype PersistedState<TData, TFilter> = Pick<\r\n useReactDataTableStateResult<TData, TFilter>,\r\n \"pagination\" | \"columnFilters\" | \"afterSearchFilter\" | \"columnPinning\" | \"expanded\" | \"rowSelection\" | \"sorting\"\r\n>;\r\n\r\n/**\r\n * A custom hook that will initialize all the state needed for the react data table and will persist it to local storage\r\n * @param props The properties to configure the initial state\r\n * @returns the state and the setters\r\n */\r\nconst usePersistentReactDataTableState = <TData, TFilter extends FilterModel = Record<string, never>>(\r\n props: OptionalNullable<useReactDataTableStateProps<TData, TFilter>> & PersistentReactDataTableStateProps,\r\n): useReactDataTableStateResult<TData, TFilter> => {\r\n const {\r\n initialColumnFilters,\r\n initialSorting,\r\n initialPagination,\r\n initialRowSelection,\r\n initialExpanded,\r\n initialColumnPinning,\r\n initialAfterSearchFilter,\r\n localStorageKey,\r\n getExpirationDate,\r\n } = props as useReactDataTableStateProps<TData, TFilter> & PersistentReactDataTableStateProps;\r\n\r\n // kept in a ref, so an inline function does not make the setters change on every render. Updated in an insertion effect, which\r\n // React runs for the whole tree before any layout effect, so it is already up to date when a setter is called from a layout\r\n // effect in the same commit (also from a child component).\r\n const getExpirationDateRef = useRef(getExpirationDate);\r\n useInsertionEffect(() => {\r\n getExpirationDateRef.current = getExpirationDate;\r\n }, [getExpirationDate]);\r\n\r\n const {\r\n pagination,\r\n setPagination,\r\n columnFilters,\r\n columnPinning,\r\n expanded,\r\n rowSelection,\r\n sorting,\r\n setColumnFilters,\r\n afterSearchFilter,\r\n setAfterSearchFilter,\r\n setColumnPinning,\r\n setExpanded,\r\n setRowSelection,\r\n setSorting,\r\n } = useReactDataTableState<TData, TFilter>({\r\n initialColumnPinning:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialColumnPinning\"]>(`${localStorageKey}_columnPinning`) ??\r\n initialColumnPinning,\r\n initialExpanded:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialExpanded\"]>(`${localStorageKey}_expanded`) ?? initialExpanded,\r\n initialPagination:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialPagination\"]>(`${localStorageKey}_pagination`) ??\r\n initialPagination,\r\n initialRowSelection:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialRowSelection\"]>(`${localStorageKey}_rowSelection`) ??\r\n initialRowSelection,\r\n initialSorting:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialSorting\"]>(`${localStorageKey}_sorting`) ?? initialSorting,\r\n initialColumnFilters:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialColumnFilters\"]>(`${localStorageKey}_columnFilters`) ??\r\n initialColumnFilters,\r\n initialAfterSearchFilter:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialAfterSearchFilter\"]>(\r\n `${localStorageKey}_afterSearchFilter`,\r\n ) ?? initialAfterSearchFilter,\r\n } as useReactDataTableStateProps<TData, TFilter> as OptionalNullable<useReactDataTableStateProps<TData, TFilter>>);\r\n\r\n // The state of every persisted part after all updates so far. All state changes go through the setters below, so React's\r\n // state ends up at the same value once it has processed them. It lets update functions (e.g. `setSorting(previous => ...)`)\r\n // be resolved synchronously for persisting, also when several of them are called in a row.\r\n const latestStateRef = useRef<PersistedState<TData, TFilter>>({\r\n pagination,\r\n columnFilters,\r\n afterSearchFilter,\r\n columnPinning,\r\n expanded,\r\n rowSelection,\r\n sorting,\r\n });\r\n\r\n // Resolves the new state and persists it right away, outside of React's updater, so that it is neither lost when the\r\n // component unmounts before the next render nor written for a render React discards. React still gets the original action,\r\n // so it can schedule update functions by their priority (e.g. an urgent update while a transition is pending).\r\n const setAndPersistState = useCallback(\r\n <TKey extends keyof PersistedState<TData, TFilter>>(\r\n key: TKey,\r\n setState: Dispatch<SetStateAction<PersistedState<TData, TFilter>[TKey]>>,\r\n newState: SetStateAction<PersistedState<TData, TFilter>[TKey]>,\r\n ) => {\r\n const resolvedState =\r\n typeof newState === \"function\"\r\n ? (newState as (previousState: PersistedState<TData, TFilter>[TKey]) => PersistedState<TData, TFilter>[TKey])(\r\n latestStateRef.current[key],\r\n )\r\n : newState;\r\n\r\n latestStateRef.current[key] = resolvedState;\r\n setLocalStorageItem(`${localStorageKey}_${key}`, resolvedState, getExpirationDateRef.current?.());\r\n setState(newState);\r\n },\r\n [localStorageKey],\r\n );\r\n\r\n return {\r\n pagination,\r\n setPagination: useCallback(\r\n (newPagination) => setAndPersistState(\"pagination\", setPagination, newPagination),\r\n [setAndPersistState, setPagination],\r\n ),\r\n columnFilters,\r\n setColumnFilters: useCallback(\r\n (newColumnFilters) => setAndPersistState(\"columnFilters\", setColumnFilters, newColumnFilters),\r\n [setAndPersistState, setColumnFilters],\r\n ),\r\n afterSearchFilter,\r\n setAfterSearchFilter: useCallback(\r\n (newAfterSearchFilter) => setAndPersistState(\"afterSearchFilter\", setAfterSearchFilter, newAfterSearchFilter),\r\n [setAndPersistState, setAfterSearchFilter],\r\n ),\r\n columnPinning,\r\n setColumnPinning: useCallback(\r\n (newColumnPinning) => setAndPersistState(\"columnPinning\", setColumnPinning, newColumnPinning),\r\n [setAndPersistState, setColumnPinning],\r\n ),\r\n expanded,\r\n setExpanded: useCallback((newExpanded) => setAndPersistState(\"expanded\", setExpanded, newExpanded), [setAndPersistState, setExpanded]),\r\n rowSelection,\r\n setRowSelection: useCallback(\r\n (newRowSelection) => setAndPersistState(\"rowSelection\", setRowSelection, newRowSelection),\r\n [setAndPersistState, setRowSelection],\r\n ),\r\n sorting,\r\n setSorting: useCallback((newSorting) => setAndPersistState(\"sorting\", setSorting, newSorting), [setAndPersistState, setSorting]),\r\n };\r\n};\r\n\r\nexport { usePersistentReactDataTableState };\r\n"],"names":["reactDataTableTranslations","actionTitle","clearSearchToolTip","searchToolTip","showedItemsText","itemsPerPageDropdown","noEntries","useReactDataTableState","props","initialColumnFilters","initialSorting","initialPagination","initialRowSelection","initialExpanded","initialColumnPinning","initialAfterSearchFilter","columnFilters","setColumnFilters","useState","afterSearchFilter","setAfterSearchFilter","sorting","setSorting","rowSelection","setRowSelection","expanded","setExpanded","columnPinning","setColumnPinning","pagination","setPagination","pageIndex","pageSize","getColumnFilterFromModel","filter","Object","entries","map","id","value","getModelFromColumnFilter","fromEntries","getSortingStateFromModel","sortingState","String","desc","useReactDataTable","data","columns","isLoading","initialState","manualFiltering","manualPagination","manualSorting","state","onColumnFiltersChange","onPaginationChange","onSortingChange","onRowSelectionChange","onExpandedChange","onColumnPinningChange","reactTableOptions","columnFiltersInitial","sortingInitial","paginationInitial","rowSelectionInitial","expandedInitial","columnPinningInitial","columnFiltersExternal","paginationExternal","sortingExternal","rowSelectionExternal","expandedExternal","columnPinningExternal","columnFiltersInternal","paginationInternal","sortingInternal","rowSelectionInteral","expandedInternal","columnPinningInternal","setColumnFiltersInternal","setPaginationInternal","setSortingInternal","setRowSelectionInternal","setExpandedInternal","setColumnPinningInternal","effectiveColumnFilters","effectivePagination","effectiveSorting","effectiveRowSelection","effectiveExpanded","effectiveColumnPinning","effectiveOnColumnFiltersChange","effectiveOnPaginationChange","effectiveOnSortingChange","effectiveOnRowSelectionChange","effectiveOnExpandedChange","effectiveOnColumnPinningChange","x","filterFn","undefined","internalColumns","meta","isHidden","skeletonColumns","column","cell","_jsx","Skeleton","skeletonData","Array","from","length","useMemo","table","useReactTable","filtersOrUpdaterFn","newFilter","paginationOrUpdaterFn","sortingOrUpdaterFn","first","getModelFromSortingState","rowSelectionOrUpdaterFn","newRowSelection","expandedOrUpdaterFn","newExpanded","columnPinningOrUpdaterFn","newColumnPinning","getCoreRowModel","getFilteredRowModel","getSortedRowModel","getPaginationRowModel","getExpandedRowModel","enableMultiSort","enableMultiRowSelection","enableSubRowSelection","enableRowSelection","defaultColumn","enableColumnFilter","enableSorting","enableExpanding","getCommonPinningStyles","isPinned","getIsPinned","left","getStart","right","getAfter","position","width","getSize","zIndex","setFilterValue","customFilterName","columnDef","prev","getFilterValue","getState","find","InternalTableRow","row","rowStyle","setNodeRef","fullRowSelectable","onRowClick","enableRowClick","hasPinnedColumns","subRowComponent","isRowSelectionEnabled","isRowClickable","_jsxs","_Fragment","children","ref","onClick","async","toggleSelected","className","style","getVisibleCells","cellStyle","cellClassName","flexRender","getContext","getIsExpanded","DraggableRow","transform","transition","isDragging","useSortable","draggableStyle","CSS","Transform","toString","opacity","TableBody","enableDragAndDrop","virtualizer","options","getRowId","Error","rows","getRowModel","virtualizerRows","getVirtualItems","rowsToRender","virtualRow","index","height","size","start","SortableContext","items","strategy","verticalListSortingStrategy","original","getIsSomeColumnsPinned","useVirtualizationTableHeight","parentRef","enabled","onPseudoHeightChange","scrollableRef","useRef","tableRef","isScrollNearBottom","setIsScrollNearBottom","virtualItems","virtualSize","getTotalSize","handlePseudoResize","useCallback","virtualHeight","current","existingPseudoElement","window","getComputedStyle","existingPseudoHeight","Number","parseFloat","tableHeight","clientHeight","pseudoHeight","Math","max","adjustTableHeight","handleScroll","scrollPosition","scrollTop","visibleHeight","useEffect","scrollable","addEventListener","removeEventListener","TableInternal","isFetching","tableClassName","tableStyle","onEnter","withoutHeaders","withoutHeaderFilters","dragAndDropOptions","noEntriesMessage","isStriped","showClearSearchButton","tableHeaderStyle","resetPageIndex","ReactStrapTable","striped","hover","background","backgroundSize","animation","innerRef","getHeaderGroups","headerGroup","Fragment","headers","header","getToggleSortingHandler","headerStyle","getCanSort","cursor","subHeaders","headerClassName","colSpan","isPlaceholder","getIsSorted","FontAwesomeIcon","icon","faSortDown","faSortUp","faSort","every","hideHeaderFilters","headerFilterStyle","marginBottom","marginRight","faSearch","faTimes","getCanFilter","customFilter","dropdownFilter","Input","type","onChange","e","target","selectedIndex","onKeyUp","key","bsSize","label","disabled","i","getVisibleFlatColumns","getFooterGroups","some","y","footer","footerGroup","footerStyle","footerClassName","virtualizerOptions","count","estimateSize","pageSizes","showPaging","hidePageSizeChange","totalRecords","pagingNavigationComponents","useVirtualizer","getScrollElement","sensors","useSensors","useSensor","MouseSensor","TouchSensor","KeyboardSensor","DndContext","collisionDetection","closestCenter","modifiers","restrictToVerticalAxis","onDragEnd","overflow","Paging","currentItemsPerPage","currentPage","currentRecordCount","setItemsPerPage","setPageSize","setCurrentPage","setPageIndex","possiblePageItemCounts","translations","pagingPossible","changePageSizePossible","navigationComponents","columnHelper","createColumnHelper","createDraggableColumn","columnKey","columndDef","isEnabled","draggableElement","RowDragHandleCell","isEnabledInternal","attributes","listeners","faGripLines","display","createEnumColumn","enumTranslations","accessor","isArray","getValue","targetType","item","element","parsedValue","isNaN","localStorageKey","getExpirationDate","getExpirationDateRef","useInsertionEffect","getLocalStorageItem","latestStateRef","setAndPersistState","setState","newState","resolvedState","setLocalStorageItem","newPagination","newColumnFilters","newAfterSearchFilter","newSorting"],"mappings":"gkBAcWA,QAAAA,2BAAyD,CAClEC,YAAa,WACbC,mBAAoB,qBACpBC,cAAe,SACfC,gBAAiB,yDACjBC,qBAAsB,mBACtBC,UAAW,4BCPb,MAAMC,EACJC,IAEA,MAAMC,qBACJA,EAAoBC,eACpBA,EAAcC,kBACdA,EAAiBC,oBACjBA,EAAmBC,gBACnBA,EAAeC,qBACfA,EAAoBC,yBACpBA,GACEP,GAEGQ,EAAeC,GAAoBC,EAAAA,SAAmBT,GAAwB,CAAA,IAC9EU,EAAmBC,GAAwBF,EAAAA,SAAmBH,GAA4BN,GAAwB,KAClHY,EAASC,GAAcJ,EAAAA,SAA0CR,IACjEa,EAAcC,GAAmBN,EAAAA,SAA4BN,GAAwB,CAAA,IACrFa,EAAUC,GAAeR,EAAAA,SAAwBL,GAAoB,CAAA,IACrEc,EAAeC,GAAoBV,EAAAA,SAA6BJ,GAAyB,CAAA,IAEzFe,EAAYC,GAAiBZ,WAA0B,CAC5Da,UAAWpB,GAAmBoB,WAAa,EAC3CC,SAAUrB,GAAmBqB,UAAY,KAG3C,MAAO,CACL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,IACzHH,eACAC,gBAAiB8M,EAAAA,YACd3G,GAAoBwQ,EAAmB,eAAgB3W,EAAiBmG,GACzE,CAACwQ,EAAoB3W,IAEvBH,UACAC,WAAYgN,EAAAA,YAAaqK,GAAeR,EAAmB,UAAW7W,EAAYqX,GAAa,CAACR,EAAoB7W"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useState as e,useRef as n,useInsertionEffect as t,useCallback as o,useMemo as i,useEffect as l,Fragment as r}from"react";import{getLocalStorageItem as a,setLocalStorageItem as s}from"@neolution-ch/javascript-utils";import{jsx as c,jsxs as u,Fragment as d}from"react/jsx-runtime";import{useReactTable as g,getExpandedRowModel as m,getPaginationRowModel as p,getSortedRowModel as h,getFilteredRowModel as f,getCoreRowModel as S,flexRender as w,createColumnHelper as b}from"@tanstack/react-table";import C from"react-loading-skeleton";import{faSortDown as F,faSortUp as P,faSort as R,faSearch as y,faTimes as x,faGripLines as v}from"@fortawesome/free-solid-svg-icons";import{FontAwesomeIcon as E}from"@fortawesome/react-fontawesome";import{Paging as D}from"@neolution-ch/react-pattern-ui";import{Table as k,Input as z}from"@neolution-ch/reactstrap";import{useSensors as I,useSensor as N,MouseSensor as A,TouchSensor as $,KeyboardSensor as H,DndContext as M,closestCenter as T}from"@dnd-kit/core";import{restrictToVerticalAxis as V}from"@dnd-kit/modifiers";import{useVirtualizer as _}from"@tanstack/react-virtual";import{useSortable as O,SortableContext as j,verticalListSortingStrategy as L}from"@dnd-kit/sortable";import{CSS as G}from"@dnd-kit/utilities";let K={actionTitle:"Aktionen",clearSearchToolTip:"Suche zurücksetzen",searchToolTip:"Suchen",showedItemsText:"Zeige {from} bis {to} von insgesamt {total} Resultaten",itemsPerPageDropdown:"Anzahl pro Seite",noEntries:"Keine Einträge vorhanden"};function B(e){K=e}const U=n=>{const{initialColumnFilters:t,initialSorting:o,initialPagination:i,initialRowSelection:l,initialExpanded:r,initialColumnPinning:a,initialAfterSearchFilter:s}=n,[c,u]=e(t??{}),[d,g]=e(s??t??{}),[m,p]=e(o),[h,f]=e(l??{}),[S,w]=e(r??{}),[b,C]=e(a??{}),[F,P]=e({pageIndex:i?.pageIndex??0,pageSize:i?.pageSize??10});return{sorting:m,pagination:F,columnFilters:c,afterSearchFilter:d,rowSelection:h,expanded:S,columnPinning:b,setSorting:p,setColumnFilters:u,setPagination:P,setAfterSearchFilter:g,setRowSelection:f,setExpanded:w,setColumnPinning:C}},Y=e=>{const{initialColumnFilters:i,initialSorting:l,initialPagination:r,initialRowSelection:c,initialExpanded:u,initialColumnPinning:d,initialAfterSearchFilter:g,localStorageKey:m,getExpirationDate:p}=e,h=n(p);t(()=>{h.current=p},[p]);const{pagination:f,setPagination:S,columnFilters:w,columnPinning:b,expanded:C,rowSelection:F,sorting:P,setColumnFilters:R,afterSearchFilter:y,setAfterSearchFilter:x,setColumnPinning:v,setExpanded:E,setRowSelection:D,setSorting:k}=U({initialColumnPinning:a(`${m}_columnPinning`)??d,initialExpanded:a(`${m}_expanded`)??u,initialPagination:a(`${m}_pagination`)??r,initialRowSelection:a(`${m}_rowSelection`)??c,initialSorting:a(`${m}_sorting`)??l,initialColumnFilters:a(`${m}_columnFilters`)??i,initialAfterSearchFilter:a(`${m}_afterSearchFilter`)??g}),z=n({pagination:f,columnFilters:w,afterSearchFilter:y,columnPinning:b,expanded:C,rowSelection:F,sorting:P}),I=o((e,n,t)=>{const o="function"==typeof t?t(z.current[e]):t;z.current[e]=o,s(`${m}_${e}`,o,h.current?.()),n(t)},[m]);return{pagination:f,setPagination:o(e=>I("pagination",S,e),[I,S]),columnFilters:w,setColumnFilters:o(e=>I("columnFilters",R,e),[I,R]),afterSearchFilter:y,setAfterSearchFilter:o(e=>I("afterSearchFilter",x,e),[I,x]),columnPinning:b,setColumnPinning:o(e=>I("columnPinning",v,e),[I,v]),expanded:C,setExpanded:o(e=>I("expanded",E,e),[I,E]),rowSelection:F,setRowSelection:o(e=>I("rowSelection",D,e),[I,D]),sorting:P,setSorting:o(e=>I("sorting",k,e),[I,k])}},Z=e=>Object.entries(e).map(([e,n])=>({id:e,value:n})),q=e=>Object.fromEntries(e.map(({id:e,value:n})=>[e,n])),J=e=>e?[{id:String(e.id),desc:e.desc}]:[],Q=e=>{const{data:n=[],columns:t,isLoading:o,initialState:l,manualFiltering:r,manualPagination:a,manualSorting:s,state:u,onColumnFiltersChange:d,onPaginationChange:w,onSortingChange:b,onRowSelectionChange:F,onExpandedChange:P,onColumnPinningChange:R,reactTableOptions:y}=e,{columnFilters:x,sorting:v,pagination:E,rowSelection:D,expanded:k,columnPinning:z}=l??{},{columnFilters:I,pagination:N,sorting:A,rowSelection:$,expanded:H,columnPinning:M}=u??{},{columnFilters:T,pagination:V,sorting:_,rowSelection:O,expanded:j,columnPinning:L,setColumnFilters:G,setPagination:K,setSorting:B,setRowSelection:Y,setExpanded:Q,setColumnPinning:W}=U({initialColumnFilters:x,initialPagination:E,initialSorting:v}),X=I??T,ee=N??V,ne=A??_,te=$??O,oe=H??j,ie=M??L,le=d??G,re=w??K,ae=b??B,se=F??Y,ce=P??Q,ue=R??W;if(r)for(const e of t)e.filterFn=void 0;const de=t.filter(e=>!0!==e.meta?.isHidden),ge=de.map(e=>({...e,cell:()=>c(C,{})})),me=Array.from({length:V.pageSize},()=>({})),pe=i(()=>Z(X),[X]),he=i(()=>J(ne),[ne]);return{table:g({data:o?me:n,columns:o?ge:de,onColumnFiltersChange:e=>{const n="function"==typeof e?e(pe):e;return le(q(n))},onPaginationChange:e=>{const n="function"==typeof e?e(ee):e;return re(n)},onSortingChange:e=>{const n="function"==typeof e?e(he):e;return ae((e=>{const[n]=e;return n?{id:n.id,desc:n.desc}:void 0})(n))},onRowSelectionChange:e=>{const n="function"==typeof e?e(te):e;return se(n)},onExpandedChange:e=>{const n="function"==typeof e?e(oe):e;return ce(n)},onColumnPinningChange:e=>{const n="function"==typeof e?e(ie):e;return ue(n)},state:{columnFilters:pe,pagination:ee,sorting:he,rowSelection:te,expanded:oe,columnPinning:ie},initialState:{columnFilters:Z(x??I??{}),pagination:E??N,sorting:J(v??A),expanded:k??H,columnPinning:z??M},getCoreRowModel:S(),getFilteredRowModel:f(),getSortedRowModel:h(),getPaginationRowModel:p(),getExpandedRowModel:m(),manualFiltering:r,manualPagination:a,manualSorting:s,enableMultiSort:!1,enableMultiRowSelection:!1,enableSubRowSelection:!1,enableRowSelection:y?.enableRowSelection??!1,defaultColumn:{enableColumnFilter:!1,enableSorting:!1},enableExpanding:y?.enableExpanding??!1,...y}),columnFilters:X,pagination:ee,sorting:ne,rowSelection:te,expanded:oe,columnPinning:ie,setColumnFilters:le,setPagination:re,setSorting:ae,setRowSelection:se,setExpanded:ce,setColumnPinning:ue}},W=e=>{const n=e.getIsPinned();return{left:"left"===n?`${e.getStart("left")}px`:void 0,right:"right"===n?`${e.getAfter("right")}px`:void 0,position:n?"sticky":"relative",width:e.getSize(),zIndex:n?1:0}},X=(e,n,t)=>{const o=e.columnDef.meta?.customFilterName;o?n.setColumnFilters(e=>[...e.filter(e=>e.id!==o),{id:o,value:t}]):e.setFilterValue(t)},ee=(e,n)=>{const t=e.columnDef.meta?.customFilterName;return t?n.getState().columnFilters.find(e=>e.id===t)?.value:e.getFilterValue()},ne=e=>{const{row:n,rowStyle:t,setNodeRef:o,enableRowSelection:i=!1,fullRowSelectable:l=!0,onRowClick:r,enableRowClick:a,hasPinnedColumns:s,subRowComponent:g}=e,m=("function"==typeof i?i(n):i)&&l,p="function"==typeof a?a(n):a;return u(d,{children:[c("tr",{ref:o,onClick:async()=>{m?n.toggleSelected():p&&r&&await r(n)},className:m||p?"cursor-pointer":void 0,style:t,children:n.getVisibleCells().map(e=>c("td",{style:{...e.column.columnDef.meta?.cellStyle,...s?W(e.column):{}},className:e.column.columnDef.meta?.cellClassName,children:w(e.column.columnDef.cell,e.getContext())},e.id))},n.id),g&&n.getIsExpanded()&&g(n)]})},te=e=>{const{row:n,rowStyle:t}=e,{transform:o,transition:i,setNodeRef:l,isDragging:r}=O({id:n.id}),a={transform:G.Transform.toString(o),transition:i,opacity:r?.8:1,zIndex:r?1:0,position:"relative"};return c(ne,{...e,setNodeRef:l,rowStyle:t?{...t,...a}:a})},oe=e=>{const{enableDragAndDrop:n,table:t,rowStyle:o,enableRowClick:l,onRowClick:r,virtualizer:a,subRowComponent:s}=e;if(n&&!t.options.getRowId)throw new Error("You must provide 'getRowId()' to data-table options in order to use the drag-and-drop feature.");const{options:{enableRowSelection:u,enableExpanding:g,fullRowSelectable:m}}=t,{rows:p}=t.getRowModel(),h=a?.getVirtualItems(),f=i(()=>h?h.map((e,n)=>({row:p[e.index],rowStyle:{height:`${e.size}px`,transform:`translateY(${e.start-n*e.size}px)`}})):p.map(e=>({row:e})),[p,h]);return n?c(j,{items:t.getRowModel().rows.map(e=>e.id),strategy:L,children:f.map((e,n)=>{const{row:t}=e;return c(te,{row:t,enableRowClick:l,onRowClick:r,enableRowSelection:u,enableExpanding:g,rowStyle:{...e.rowStyle,...o?o(t.original):{}},fullRowSelectable:m,subRowComponent:s},n)})}):c(d,{children:f.map((e,n)=>{const{row:i}=e;return c(ne,{row:i,enableRowClick:l,onRowClick:r,enableRowSelection:u,enableExpanding:g,rowStyle:{...e.rowStyle,...o?o(i.original):{}},fullRowSelectable:m,hasPinnedColumns:t.getIsSomeColumnsPinned(),subRowComponent:s},n)})})},ie=t=>{const{parentRef:i,virtualizer:r,enabled:a,onPseudoHeightChange:s}=t,c=n(null),u=n(null),[d,g]=e(!1),m=a?r.getVirtualItems():[],p=a?r.getTotalSize():0,h=o(()=>((e,n,t)=>{if(!e.current)return;const o=window.getComputedStyle(e.current,"::after"),i=Number.parseFloat(o.height)||0,l=e.current.clientHeight-i,r=Math.max(n-l,0);return t?.(r),r})(u,p,s),[u,p,s]),f=o(()=>{if(i.current){const e=i.current?.scrollTop,n=i.current?.clientHeight;g(e>.95*p-n)}},[i,p]);return l(()=>{if(!a)return;const e=i.current;return e&&e.addEventListener("scroll",f),h(),()=>{e&&e.removeEventListener("scroll",f)}},[f,h,i,a]),l(()=>{a&&d&&h()},[d,m.length,h,a]),{scrollableRef:c,tableRef:u}},le=e=>{const{virtualizer:n,isLoading:t,isFetching:o,table:i,tableClassName:l,tableStyle:a,rowStyle:s,onEnter:g,withoutHeaders:m=!1,withoutHeaderFilters:p=!1,dragAndDropOptions:h,noEntriesMessage:f,isStriped:S=!0,showClearSearchButton:b=!0,tableRef:C,tableHeaderStyle:v}=e,{options:{manualPagination:D},resetPageIndex:I}=i;return u(k,{striped:S,hover:!0,size:"sm",className:l,style:!t&&o?{...a,background:"linear-gradient(90deg, #E8E8E8, #ffffff, #E8E8E8)",backgroundSize:"200% 200%",animation:"reloadingAnimation 3s linear infinite"}:a,innerRef:C,children:[!m&&c("thead",{style:v,children:i.getHeaderGroups().map(e=>u(r,{children:[c("tr",{children:e.headers.map(e=>u("th",{onClick:e.column.getToggleSortingHandler(),style:{...e.column.columnDef.meta?.headerStyle,...e.column.getCanSort()?{cursor:"pointer"}:{},...i.getIsSomeColumnsPinned()?W(e.subHeaders.length>0?e.subHeaders[0].column:e.column):{}},className:e.column.columnDef.meta?.headerClassName,colSpan:e.colSpan,children:[e.isPlaceholder?null:w(e.column.columnDef.header,e.getContext()),"desc"===e.column.getIsSorted()?c(E,{icon:F,className:"ms-1"}):"asc"===e.column.getIsSorted()?c(E,{icon:P,className:"ms-1"}):e.column.getCanSort()?c(E,{icon:R,className:"ms-1"}):""]},e.id))},`${e.id}-col-header`),!p&&!e.headers.every(e=>!!e.column.columnDef.meta?.hideHeaderFilters)&&c("tr",{children:e.headers.map(e=>{const{column:{columnDef:{meta:n}}}=e;return u("th",{style:{...e.column.columnDef.meta?.headerFilterStyle,...i.getIsSomeColumnsPinned()?W(e.column):{}},children:[0===e.index&&u(d,{children:[g&&c(E,{style:{cursor:"pointer",marginBottom:"4px",marginRight:"5px"},icon:y,onClick:()=>{D&&I(!0),g(q(i.getState().columnFilters))}}),b&&c(E,{style:{cursor:"pointer",marginBottom:"4px",marginRight:"5px"},icon:x,onClick:()=>{g&&g(q(i.initialState.columnFilters)),i.setColumnFilters(i.initialState.columnFilters),D&&I(!0)}})]}),e.column.getCanFilter()&&c(d,{children:n?.customFilter?n?.customFilter(ee(e.column,i),n=>X(e.column,i,n),i):c(z,n?.dropdownFilter?{type:"select",value:ee(e.column,i)??"",onChange:t=>{X(e.column,i,n.dropdownFilter?.options[t.target.selectedIndex]?.value??t.target.value),!g&&D&&I(!0)},onKeyUp:({key:e})=>{"Enter"===e&&g&&(D&&I(!0),g(q(i.getState().columnFilters)))},bsSize:"sm",children:n.dropdownFilter.options.map(({label:e,value:n,disabled:t},o)=>c("option",{value:n,disabled:t,children:e},o))}:{type:"text",value:ee(e.column,i)??"",onChange:n=>{X(e.column,i,n.target.value),!g&&D&&I(!0)},onKeyUp:({key:e})=>{"Enter"===e&&g&&(D&&I(!0),g(q(i.getState().columnFilters)))},bsSize:"sm"})})]},`${e.id}-col-filter`)})},`${e.id}-col-filters`)]},e.id))}),c("tbody",{children:0===i.getRowModel().rows.length?c("tr",{children:c("td",{colSpan:i.getVisibleFlatColumns().length,children:f??K.noEntries})}):c(oe,{...e,table:i,enableDragAndDrop:!!h?.enableDragAndDrop,rowStyle:s,virtualizer:n})}),i.getFooterGroups().length>0&&i.getFooterGroups().some(e=>e.headers.some(e=>!e.isPlaceholder&&e.column.columnDef.footer))&&c("tfoot",{children:i.getFooterGroups().map(e=>c("tr",{children:e.headers.map(e=>c("th",{style:e.column.columnDef.meta?.footerStyle,className:e.column.columnDef.meta?.footerClassName,children:e.isPlaceholder?null:w(e.column.columnDef.footer,e.getContext())},e.id))},e.id))})]})},re=e=>{const{virtualizerOptions:t={count:0,enabled:!1,estimateSize:()=>0},table:o,pageSizes:i,showPaging:l,hidePageSizeChange:r,totalRecords:a=o.getCoreRowModel().rows.length,dragAndDropOptions:s,pagingNavigationComponents:g,isLoading:m,isFetching:p,onPseudoHeightChange:h}=e,{pagination:f}=o.getState(),S=n(null),w=_({...t,count:a,getScrollElement:()=>S.current}),b=I(N(A,{}),N($,{}),N(H,{})),{scrollableRef:F,tableRef:P}=ie({parentRef:S,virtualizer:w,enabled:t.enabled??!1,onPseudoHeightChange:h});return u(d,{children:[u(M,{collisionDetection:T,modifiers:[V],onDragEnd:s?.onDragEnd,sensors:b,children:[c("style",{children:" \n @-webkit-keyframes reloadingAnimation {\n 0%{\n background-position-x: 200%\n }\n 100%{\n background-position-x: 0%\n }\n }"}),t.enabled?c("div",{ref:S,style:{height:t.height??600,overflow:"auto"},children:c("div",{ref:F,style:{height:`${w.getTotalSize()}px`},children:c(le,{...e,virtualizer:w,tableRef:P})})}):c(le,{...e})]}),l&&c(d,{children:m||p?c(C,{count:1,height:20}):c(D,{currentItemsPerPage:f.pageSize,currentPage:f.pageIndex+1,totalRecords:a,currentRecordCount:o.getRowModel().rows.length,setItemsPerPage:e=>{o.setPageSize(e)},setCurrentPage:e=>o.setPageIndex(e-1),possiblePageItemCounts:i,translations:{itemsPerPageDropdown:K.itemsPerPageDropdown,showedItemsText:K.showedItemsText},pagingPossible:!0,changePageSizePossible:!r,navigationComponents:g})})]})},ae=(e,n,t)=>{const o=e.find(e=>e.id===n);if(o){if("string"===t)return o.value;if("number"===t){const e=Number.parseFloat(o.value);return Number.isNaN(e)?void 0:e}}},se=e=>Q({manualFiltering:!0,manualPagination:!0,manualSorting:!0,...e}),ce=()=>{const e=b();return{...e,createDraggableColumn:(n,t,o,i)=>{const l=({row:e})=>{const n=void 0===o||("function"==typeof o?o(e):o),{attributes:t,listeners:l,isDragging:r}=O({id:e.id,disabled:!n});return c("span",{...t,...l,className:!1===n?"opacity-25":"opacity-100",style:{cursor:!1===n?"auto":r?"grabbing":"grab"},children:i??c(E,{icon:v})})};return e.display({...t,id:n,cell:({row:e})=>c(l,{row:e})})},createEnumColumn:(n,t,o)=>e.accessor(n,{cell:e=>Array.isArray(t)?t.find(n=>n.value===e.getValue())?.label:t[e.getValue()],enableColumnFilter:!0,meta:{dropdownFilter:{options:Array.isArray(t)?t:Object.entries(t).map(([e,n])=>({label:n,value:e}))}},...o})}};export{re as ReactDataTable,ce as createReactDataTableColumnHelper,Z as getColumnFilterFromModel,q as getModelFromColumnFilter,ae as getStronglyTypedColumnFilter,K as reactDataTableTranslations,B as setDataTableTranslations,se as useFullyControlledReactDataTable,Y as usePersistentReactDataTableState,Q as useReactDataTable,U as useReactDataTableState};
|
|
2
|
+
//# sourceMappingURL=index.modern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.modern.js","sources":["../src/lib/translations/translations.ts","../src/lib/useReactDataTableState/useReactDataTableState.ts","../src/lib/useReactDataTableState/usePersistentReactDataTableState.ts","../src/lib/utils/getColumnFilterFromModel.ts","../src/lib/utils/getModelFromColumnFilter.ts","../src/lib/utils/getSortingStateFromModel.ts","../src/lib/useReactDataTable/useReactDataTable.tsx","../src/lib/utils/getModelFromSortingState.ts","../src/lib/utils/getCommonPinningStyles.ts","../src/lib/utils/customFilterMethods.ts","../src/lib/ReactDataTable/TableRows.tsx","../src/lib/ReactDataTable/TableBody.tsx","../src/lib/hooks/useVirtualizationTableHeight.tsx","../src/lib/ReactDataTable/ReactDataTable.tsx","../src/lib/utils/getStronglyTypedColumnFilter.ts","../src/lib/useFullyControlledReactDataTable/useFullyControlledReactDataTable.tsx","../src/lib/utils/createReactDataTableColumnHelper.tsx"],"sourcesContent":["/**\r\n * This are the possible translations for the data table\r\n * @interface DataTableTranslations\r\n * @property {string} clearSearchToolTip is used to print out the bottom text, possible placeholders are: {from}, {to} and {total}\r\n */\r\nexport interface ReactDataTableTranslations {\r\n actionTitle: string;\r\n showedItemsText: string;\r\n searchToolTip: string;\r\n clearSearchToolTip: string;\r\n itemsPerPageDropdown: string;\r\n noEntries: string;\r\n}\r\n\r\nexport let reactDataTableTranslations: ReactDataTableTranslations = {\r\n actionTitle: \"Aktionen\",\r\n clearSearchToolTip: \"Suche zurücksetzen\",\r\n searchToolTip: \"Suchen\",\r\n showedItemsText: \"Zeige {from} bis {to} von insgesamt {total} Resultaten\",\r\n itemsPerPageDropdown: \"Anzahl pro Seite\",\r\n noEntries: \"Keine Einträge vorhanden\",\r\n};\r\n\r\nexport function setDataTableTranslations(translations: ReactDataTableTranslations) {\r\n reactDataTableTranslations = translations;\r\n}\r\n","import { useState } from \"react\";\r\nimport { ColumnPinningState, ExpandedState, PaginationState, RowSelectionState } from \"@tanstack/react-table\";\r\nimport { useReactDataTableStateProps } from \"./useReactDataTableStateProps\";\r\nimport { useReactDataTableStateResult } from \"./useReactDataTableStateResult\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { SortingState } from \"../types/SortingState\";\r\nimport { OptionalNullable } from \"../types/NullableTypes\";\r\n\r\n/**\r\n * A custom hook that will initialize all the state needed for the react data table\r\n * @param props The properties to configure the initial state\r\n * @returns the state and the setters\r\n */\r\nconst useReactDataTableState = <TData, TFilter extends FilterModel = Record<string, never>>(\r\n props: OptionalNullable<useReactDataTableStateProps<TData, TFilter>>,\r\n): useReactDataTableStateResult<TData, TFilter> => {\r\n const {\r\n initialColumnFilters,\r\n initialSorting,\r\n initialPagination,\r\n initialRowSelection,\r\n initialExpanded,\r\n initialColumnPinning,\r\n initialAfterSearchFilter,\r\n } = props as useReactDataTableStateProps<TData, TFilter>;\r\n\r\n const [columnFilters, setColumnFilters] = useState<TFilter>((initialColumnFilters ?? {}) as TFilter);\r\n const [afterSearchFilter, setAfterSearchFilter] = useState<TFilter>((initialAfterSearchFilter ?? initialColumnFilters ?? {}) as TFilter);\r\n const [sorting, setSorting] = useState<SortingState<TData> | undefined>(initialSorting);\r\n const [rowSelection, setRowSelection] = useState<RowSelectionState>(initialRowSelection ?? ({} as RowSelectionState));\r\n const [expanded, setExpanded] = useState<ExpandedState>(initialExpanded ?? ({} as ExpandedState));\r\n const [columnPinning, setColumnPinning] = useState<ColumnPinningState>(initialColumnPinning ?? ({} as ColumnPinningState));\r\n\r\n const [pagination, setPagination] = useState<PaginationState>({\r\n pageIndex: initialPagination?.pageIndex ?? 0,\r\n pageSize: initialPagination?.pageSize ?? 10,\r\n });\r\n\r\n return {\r\n sorting,\r\n pagination,\r\n columnFilters,\r\n afterSearchFilter,\r\n rowSelection,\r\n expanded,\r\n columnPinning,\r\n setSorting,\r\n setColumnFilters,\r\n setPagination,\r\n setAfterSearchFilter,\r\n setRowSelection,\r\n setExpanded,\r\n setColumnPinning,\r\n };\r\n};\r\n\r\nexport { useReactDataTableState };\r\n","import { getLocalStorageItem, setLocalStorageItem } from \"@neolution-ch/javascript-utils\";\r\nimport { OptionalNullable } from \"../types/NullableTypes\";\r\nimport { useReactDataTableStateProps } from \"./useReactDataTableStateProps\";\r\nimport { useReactDataTableStateResult } from \"./useReactDataTableStateResult\";\r\nimport { useReactDataTableState } from \"./useReactDataTableState\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { Dispatch, SetStateAction, useCallback, useInsertionEffect, useRef } from \"react\";\r\n\r\ninterface PersistentReactDataTableStateProps {\r\n /**\r\n * The prefix of the local storage keys the state is persisted under\r\n */\r\n localStorageKey: string;\r\n /**\r\n * Returns the date the persisted state expires, called on every write (e.g. `() => getEndOfDay(new Date())`).\r\n * Expired state is ignored and the initial state is used instead. Without it, the persisted state never expires.\r\n */\r\n getExpirationDate?: () => Date;\r\n}\r\n\r\ntype PersistedState<TData, TFilter> = Pick<\r\n useReactDataTableStateResult<TData, TFilter>,\r\n \"pagination\" | \"columnFilters\" | \"afterSearchFilter\" | \"columnPinning\" | \"expanded\" | \"rowSelection\" | \"sorting\"\r\n>;\r\n\r\n/**\r\n * A custom hook that will initialize all the state needed for the react data table and will persist it to local storage\r\n * @param props The properties to configure the initial state\r\n * @returns the state and the setters\r\n */\r\nconst usePersistentReactDataTableState = <TData, TFilter extends FilterModel = Record<string, never>>(\r\n props: OptionalNullable<useReactDataTableStateProps<TData, TFilter>> & PersistentReactDataTableStateProps,\r\n): useReactDataTableStateResult<TData, TFilter> => {\r\n const {\r\n initialColumnFilters,\r\n initialSorting,\r\n initialPagination,\r\n initialRowSelection,\r\n initialExpanded,\r\n initialColumnPinning,\r\n initialAfterSearchFilter,\r\n localStorageKey,\r\n getExpirationDate,\r\n } = props as useReactDataTableStateProps<TData, TFilter> & PersistentReactDataTableStateProps;\r\n\r\n // kept in a ref, so an inline function does not make the setters change on every render. Updated in an insertion effect, which\r\n // React runs for the whole tree before any layout effect, so it is already up to date when a setter is called from a layout\r\n // effect in the same commit (also from a child component).\r\n const getExpirationDateRef = useRef(getExpirationDate);\r\n useInsertionEffect(() => {\r\n getExpirationDateRef.current = getExpirationDate;\r\n }, [getExpirationDate]);\r\n\r\n const {\r\n pagination,\r\n setPagination,\r\n columnFilters,\r\n columnPinning,\r\n expanded,\r\n rowSelection,\r\n sorting,\r\n setColumnFilters,\r\n afterSearchFilter,\r\n setAfterSearchFilter,\r\n setColumnPinning,\r\n setExpanded,\r\n setRowSelection,\r\n setSorting,\r\n } = useReactDataTableState<TData, TFilter>({\r\n initialColumnPinning:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialColumnPinning\"]>(`${localStorageKey}_columnPinning`) ??\r\n initialColumnPinning,\r\n initialExpanded:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialExpanded\"]>(`${localStorageKey}_expanded`) ?? initialExpanded,\r\n initialPagination:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialPagination\"]>(`${localStorageKey}_pagination`) ??\r\n initialPagination,\r\n initialRowSelection:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialRowSelection\"]>(`${localStorageKey}_rowSelection`) ??\r\n initialRowSelection,\r\n initialSorting:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialSorting\"]>(`${localStorageKey}_sorting`) ?? initialSorting,\r\n initialColumnFilters:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialColumnFilters\"]>(`${localStorageKey}_columnFilters`) ??\r\n initialColumnFilters,\r\n initialAfterSearchFilter:\r\n getLocalStorageItem<useReactDataTableStateProps<TData, TFilter>[\"initialAfterSearchFilter\"]>(\r\n `${localStorageKey}_afterSearchFilter`,\r\n ) ?? initialAfterSearchFilter,\r\n } as useReactDataTableStateProps<TData, TFilter> as OptionalNullable<useReactDataTableStateProps<TData, TFilter>>);\r\n\r\n // The state of every persisted part after all updates so far. All state changes go through the setters below, so React's\r\n // state ends up at the same value once it has processed them. It lets update functions (e.g. `setSorting(previous => ...)`)\r\n // be resolved synchronously for persisting, also when several of them are called in a row.\r\n const latestStateRef = useRef<PersistedState<TData, TFilter>>({\r\n pagination,\r\n columnFilters,\r\n afterSearchFilter,\r\n columnPinning,\r\n expanded,\r\n rowSelection,\r\n sorting,\r\n });\r\n\r\n // Resolves the new state and persists it right away, outside of React's updater, so that it is neither lost when the\r\n // component unmounts before the next render nor written for a render React discards. React still gets the original action,\r\n // so it can schedule update functions by their priority (e.g. an urgent update while a transition is pending).\r\n const setAndPersistState = useCallback(\r\n <TKey extends keyof PersistedState<TData, TFilter>>(\r\n key: TKey,\r\n setState: Dispatch<SetStateAction<PersistedState<TData, TFilter>[TKey]>>,\r\n newState: SetStateAction<PersistedState<TData, TFilter>[TKey]>,\r\n ) => {\r\n const resolvedState =\r\n typeof newState === \"function\"\r\n ? (newState as (previousState: PersistedState<TData, TFilter>[TKey]) => PersistedState<TData, TFilter>[TKey])(\r\n latestStateRef.current[key],\r\n )\r\n : newState;\r\n\r\n latestStateRef.current[key] = resolvedState;\r\n setLocalStorageItem(`${localStorageKey}_${key}`, resolvedState, getExpirationDateRef.current?.());\r\n setState(newState);\r\n },\r\n [localStorageKey],\r\n );\r\n\r\n return {\r\n pagination,\r\n setPagination: useCallback(\r\n (newPagination) => setAndPersistState(\"pagination\", setPagination, newPagination),\r\n [setAndPersistState, setPagination],\r\n ),\r\n columnFilters,\r\n setColumnFilters: useCallback(\r\n (newColumnFilters) => setAndPersistState(\"columnFilters\", setColumnFilters, newColumnFilters),\r\n [setAndPersistState, setColumnFilters],\r\n ),\r\n afterSearchFilter,\r\n setAfterSearchFilter: useCallback(\r\n (newAfterSearchFilter) => setAndPersistState(\"afterSearchFilter\", setAfterSearchFilter, newAfterSearchFilter),\r\n [setAndPersistState, setAfterSearchFilter],\r\n ),\r\n columnPinning,\r\n setColumnPinning: useCallback(\r\n (newColumnPinning) => setAndPersistState(\"columnPinning\", setColumnPinning, newColumnPinning),\r\n [setAndPersistState, setColumnPinning],\r\n ),\r\n expanded,\r\n setExpanded: useCallback((newExpanded) => setAndPersistState(\"expanded\", setExpanded, newExpanded), [setAndPersistState, setExpanded]),\r\n rowSelection,\r\n setRowSelection: useCallback(\r\n (newRowSelection) => setAndPersistState(\"rowSelection\", setRowSelection, newRowSelection),\r\n [setAndPersistState, setRowSelection],\r\n ),\r\n sorting,\r\n setSorting: useCallback((newSorting) => setAndPersistState(\"sorting\", setSorting, newSorting), [setAndPersistState, setSorting]),\r\n };\r\n};\r\n\r\nexport { usePersistentReactDataTableState };\r\n","import { ColumnFiltersState } from \"@tanstack/react-table\";\r\nimport { FilterModel } from \"../types/TableState\";\r\n\r\nconst getColumnFilterFromModel = <TFilter extends FilterModel>(filter: TFilter): ColumnFiltersState =>\r\n Object.entries(filter).map(([id, value]) => ({ id, value: value as unknown }));\r\n\r\nexport { getColumnFilterFromModel };\r\n","import { ColumnFilter, ColumnFiltersState } from \"@tanstack/react-table\";\r\nimport { FilterModel } from \"../types/TableState\";\r\n\r\nconst getModelFromColumnFilter = <TFilter extends FilterModel>(filter: ColumnFiltersState): TFilter =>\r\n Object.fromEntries(filter.map(({ id, value }: ColumnFilter) => [id, value])) as TFilter;\r\n\r\nexport { getModelFromColumnFilter };\r\n","import { SortingState } from \"@tanstack/react-table\";\r\nimport { SortingState as CustomSortingState } from \"../types/SortingState\";\r\n\r\nconst getSortingStateFromModel = <TData>(sortingState?: CustomSortingState<TData>): SortingState =>\r\n sortingState ? [{ id: String(sortingState.id), desc: sortingState.desc }] : [];\r\n\r\nexport { getSortingStateFromModel };\r\n","import {\r\n getCoreRowModel,\r\n getExpandedRowModel,\r\n getFilteredRowModel,\r\n getPaginationRowModel,\r\n getSortedRowModel,\r\n useReactTable,\r\n} from \"@tanstack/react-table\";\r\nimport { useReactDataTableState } from \"../useReactDataTableState/useReactDataTableState\";\r\nimport Skeleton from \"react-loading-skeleton\";\r\nimport { useReactDataTableProps } from \"./useReactDataTableProps\";\r\nimport { useReactDataTableResult } from \"./useReactDataTableResult\";\r\nimport { getColumnFilterFromModel } from \"../utils/getColumnFilterFromModel\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { getModelFromColumnFilter } from \"../utils/getModelFromColumnFilter\";\r\nimport { getSortingStateFromModel } from \"../utils/getSortingStateFromModel\";\r\nimport { getModelFromSortingState } from \"../utils/getModelFromSortingState\";\r\nimport { OptionalNullable } from \"../types/NullableTypes\";\r\nimport { useMemo } from \"react\";\r\nimport { useReactDataTableStateProps } from \"../useReactDataTableState/useReactDataTableStateProps\";\r\n\r\n/**\r\n * A react hook that returns a react table instance and the state of the table\r\n * @param props The properties to configure the table\r\n * @returns The table instance and the state of the table\r\n */\r\n\r\nconst useReactDataTable = <TData, TFilter extends FilterModel = Record<string, never>>(\r\n props: useReactDataTableProps<TData, TFilter>,\r\n): useReactDataTableResult<TData, TFilter> => {\r\n const {\r\n data = [],\r\n columns,\r\n isLoading,\r\n initialState,\r\n manualFiltering,\r\n manualPagination,\r\n manualSorting,\r\n state,\r\n onColumnFiltersChange,\r\n onPaginationChange,\r\n onSortingChange,\r\n onRowSelectionChange,\r\n onExpandedChange,\r\n onColumnPinningChange,\r\n reactTableOptions,\r\n } = props;\r\n\r\n const {\r\n columnFilters: columnFiltersInitial,\r\n sorting: sortingInitial,\r\n pagination: paginationInitial,\r\n rowSelection: rowSelectionInitial,\r\n expanded: expandedInitial,\r\n columnPinning: columnPinningInitial,\r\n } = initialState ?? {};\r\n const {\r\n columnFilters: columnFiltersExternal,\r\n pagination: paginationExternal,\r\n sorting: sortingExternal,\r\n rowSelection: rowSelectionExternal,\r\n expanded: expandedExternal,\r\n columnPinning: columnPinningExternal,\r\n } = state ?? {};\r\n\r\n const {\r\n columnFilters: columnFiltersInternal,\r\n pagination: paginationInternal,\r\n sorting: sortingInternal,\r\n rowSelection: rowSelectionInteral,\r\n expanded: expandedInternal,\r\n columnPinning: columnPinningInternal,\r\n setColumnFilters: setColumnFiltersInternal,\r\n setPagination: setPaginationInternal,\r\n setSorting: setSortingInternal,\r\n setRowSelection: setRowSelectionInternal,\r\n setExpanded: setExpandedInternal,\r\n setColumnPinning: setColumnPinningInternal,\r\n } = useReactDataTableState<TData, TFilter>({\r\n initialColumnFilters: columnFiltersInitial as TFilter,\r\n initialPagination: paginationInitial,\r\n initialSorting: sortingInitial,\r\n rowSelection: rowSelectionInitial,\r\n expanded: expandedInitial,\r\n columnPinning: columnPinningInitial,\r\n } as unknown as OptionalNullable<useReactDataTableStateProps<TData, TFilter>>);\r\n\r\n const effectiveColumnFilters = columnFiltersExternal ?? columnFiltersInternal;\r\n const effectivePagination = paginationExternal ?? paginationInternal;\r\n const effectiveSorting = sortingExternal ?? sortingInternal;\r\n const effectiveRowSelection = rowSelectionExternal ?? rowSelectionInteral;\r\n const effectiveExpanded = expandedExternal ?? expandedInternal;\r\n const effectiveColumnPinning = columnPinningExternal ?? columnPinningInternal;\r\n const effectiveOnColumnFiltersChange = onColumnFiltersChange ?? setColumnFiltersInternal;\r\n const effectiveOnPaginationChange = onPaginationChange ?? setPaginationInternal;\r\n const effectiveOnSortingChange = onSortingChange ?? setSortingInternal;\r\n const effectiveOnRowSelectionChange = onRowSelectionChange ?? setRowSelectionInternal;\r\n const effectiveOnExpandedChange = onExpandedChange ?? setExpandedInternal;\r\n const effectiveOnColumnPinningChange = onColumnPinningChange ?? setColumnPinningInternal;\r\n\r\n // If we active the manual filtering, we have to unset the filter function, else it still does automatic filtering\r\n if (manualFiltering) for (const x of columns) x.filterFn = undefined;\r\n\r\n const internalColumns = columns.filter((x) => x.meta?.isHidden !== true);\r\n const skeletonColumns = internalColumns.map((column) => ({\r\n ...column,\r\n cell: () => <Skeleton />,\r\n }));\r\n const skeletonData = Array.from({ length: paginationInternal.pageSize }, () => ({}) as TData);\r\n\r\n const columnFilters = useMemo(() => getColumnFilterFromModel(effectiveColumnFilters), [effectiveColumnFilters]);\r\n const sorting = useMemo(() => getSortingStateFromModel(effectiveSorting), [effectiveSorting]);\r\n\r\n // known issue for tanstack with open ticket: https://github.com/facebook/react/issues/33057\r\n // eslint-disable-next-line react-hooks/incompatible-library\r\n const table = useReactTable<TData>({\r\n data: isLoading ? skeletonData : data,\r\n columns: isLoading ? skeletonColumns : internalColumns,\r\n\r\n onColumnFiltersChange: (filtersOrUpdaterFn) => {\r\n const newFilter = typeof filtersOrUpdaterFn === \"function\" ? filtersOrUpdaterFn(columnFilters) : filtersOrUpdaterFn;\r\n return effectiveOnColumnFiltersChange(getModelFromColumnFilter(newFilter));\r\n },\r\n onPaginationChange: (paginationOrUpdaterFn) => {\r\n const newFilter = typeof paginationOrUpdaterFn === \"function\" ? paginationOrUpdaterFn(effectivePagination) : paginationOrUpdaterFn;\r\n return effectiveOnPaginationChange(newFilter);\r\n },\r\n onSortingChange: (sortingOrUpdaterFn) => {\r\n const newFilter = typeof sortingOrUpdaterFn === \"function\" ? sortingOrUpdaterFn(sorting) : sortingOrUpdaterFn;\r\n return effectiveOnSortingChange(getModelFromSortingState(newFilter));\r\n },\r\n onRowSelectionChange: (rowSelectionOrUpdaterFn) => {\r\n const newRowSelection =\r\n typeof rowSelectionOrUpdaterFn === \"function\" ? rowSelectionOrUpdaterFn(effectiveRowSelection) : rowSelectionOrUpdaterFn;\r\n return effectiveOnRowSelectionChange(newRowSelection);\r\n },\r\n onExpandedChange: (expandedOrUpdaterFn) => {\r\n const newExpanded = typeof expandedOrUpdaterFn === \"function\" ? expandedOrUpdaterFn(effectiveExpanded) : expandedOrUpdaterFn;\r\n return effectiveOnExpandedChange(newExpanded);\r\n },\r\n onColumnPinningChange: (columnPinningOrUpdaterFn) => {\r\n const newColumnPinning =\r\n typeof columnPinningOrUpdaterFn === \"function\" ? columnPinningOrUpdaterFn(effectiveColumnPinning) : columnPinningOrUpdaterFn;\r\n return effectiveOnColumnPinningChange(newColumnPinning);\r\n },\r\n\r\n state: {\r\n columnFilters,\r\n pagination: effectivePagination,\r\n sorting,\r\n rowSelection: effectiveRowSelection,\r\n expanded: effectiveExpanded,\r\n columnPinning: effectiveColumnPinning,\r\n },\r\n\r\n initialState: {\r\n columnFilters: getColumnFilterFromModel(columnFiltersInitial ?? columnFiltersExternal ?? {}),\r\n pagination: paginationInitial ?? paginationExternal,\r\n sorting: getSortingStateFromModel(sortingInitial ?? sortingExternal),\r\n expanded: expandedInitial ?? expandedExternal,\r\n columnPinning: columnPinningInitial ?? columnPinningExternal,\r\n },\r\n\r\n getCoreRowModel: getCoreRowModel(),\r\n getFilteredRowModel: getFilteredRowModel(),\r\n getSortedRowModel: getSortedRowModel(),\r\n getPaginationRowModel: getPaginationRowModel(),\r\n getExpandedRowModel: getExpandedRowModel(),\r\n\r\n manualFiltering,\r\n manualPagination,\r\n manualSorting,\r\n\r\n enableMultiSort: false,\r\n enableMultiRowSelection: false,\r\n enableSubRowSelection: false,\r\n\r\n // The row selection is enabled by default in Tanstack API. We don't want it per default\r\n enableRowSelection: reactTableOptions?.enableRowSelection ?? false,\r\n defaultColumn: {\r\n enableColumnFilter: false,\r\n enableSorting: false,\r\n },\r\n\r\n enableExpanding: reactTableOptions?.enableExpanding ?? false,\r\n\r\n ...reactTableOptions,\r\n });\r\n\r\n return {\r\n table,\r\n columnFilters: effectiveColumnFilters,\r\n pagination: effectivePagination,\r\n sorting: effectiveSorting,\r\n rowSelection: effectiveRowSelection,\r\n expanded: effectiveExpanded,\r\n columnPinning: effectiveColumnPinning,\r\n setColumnFilters: effectiveOnColumnFiltersChange,\r\n setPagination: effectiveOnPaginationChange,\r\n setSorting: effectiveOnSortingChange,\r\n setRowSelection: effectiveOnRowSelectionChange,\r\n setExpanded: effectiveOnExpandedChange,\r\n setColumnPinning: effectiveOnColumnPinningChange,\r\n };\r\n};\r\n\r\nexport { useReactDataTable };\r\n","import { SortingState as CustomSortingState } from \"../types/SortingState\";\r\nimport { SortingState } from \"@tanstack/react-table\";\r\n\r\nconst getModelFromSortingState = <TData>(sortingState: SortingState): CustomSortingState<TData> | undefined => {\r\n const [first] = sortingState;\r\n return first ? { id: first.id as keyof TData, desc: first.desc } : undefined;\r\n};\r\n\r\nexport { getModelFromSortingState };\r\n","import { Column } from \"@tanstack/react-table\";\r\nimport { CSSProperties } from \"react\";\r\n\r\n// These are the important styles to make sticky column pinning work!\r\nconst getCommonPinningStyles = <TData>(column: Column<TData>): CSSProperties => {\r\n const isPinned = column.getIsPinned();\r\n\r\n return {\r\n left: isPinned === \"left\" ? `${column.getStart(\"left\")}px` : undefined,\r\n right: isPinned === \"right\" ? `${column.getAfter(\"right\")}px` : undefined,\r\n position: isPinned ? \"sticky\" : \"relative\",\r\n width: column.getSize(),\r\n zIndex: isPinned ? 1 : 0,\r\n };\r\n};\r\n\r\nexport { getCommonPinningStyles };\r\n","import { Column, Table } from \"@tanstack/react-table\";\r\n\r\nconst setFilterValue = <TData>(column: Column<TData, unknown>, table: Table<TData>, value: unknown) => {\r\n const customFilterName = column.columnDef.meta?.customFilterName;\r\n\r\n if (customFilterName) {\r\n table.setColumnFilters((prev) => [...prev.filter((x) => x.id !== customFilterName), { id: customFilterName, value }]);\r\n } else {\r\n column.setFilterValue(value);\r\n }\r\n};\r\n\r\nconst getFilterValue = <TData>(column: Column<TData, unknown>, table: Table<TData>): unknown => {\r\n const customFilterName = column.columnDef.meta?.customFilterName;\r\n\r\n if (customFilterName) {\r\n return table.getState().columnFilters.find((x) => x.id === customFilterName)?.value;\r\n }\r\n return column.getFilterValue();\r\n};\r\n\r\nexport { setFilterValue, getFilterValue };\r\n","import { useSortable } from \"@dnd-kit/sortable\";\r\nimport { Row, flexRender } from \"@tanstack/react-table\";\r\nimport { CSSProperties } from \"react\";\r\nimport { CSS } from \"@dnd-kit/utilities\";\r\nimport { getCommonPinningStyles } from \"../utils/getCommonPinningStyles\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { ReactDataTableProps } from \"./ReactDataTableProps\";\r\n\r\ninterface TableRowProps<TData, TFilter extends FilterModel = Record<string, never>> extends Pick<\r\n ReactDataTableProps<TData, TFilter>,\r\n \"onRowClick\" | \"enableRowClick\" | \"subRowComponent\"\r\n> {\r\n row: Row<TData>;\r\n enableRowSelection?: boolean | ((row: Row<TData>) => boolean);\r\n fullRowSelectable?: boolean;\r\n enableExpanding?: boolean | ((row: Row<TData>) => boolean);\r\n rowStyle?: CSSProperties;\r\n setNodeRef?: (node: HTMLElement | null) => void;\r\n hasPinnedColumns?: boolean;\r\n}\r\n\r\nconst InternalTableRow = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableRowProps<TData, TFilter>) => {\r\n const {\r\n row,\r\n rowStyle,\r\n setNodeRef,\r\n enableRowSelection = false,\r\n fullRowSelectable = true,\r\n onRowClick,\r\n enableRowClick,\r\n hasPinnedColumns,\r\n subRowComponent,\r\n } = props;\r\n const isRowSelectionEnabled =\r\n (typeof enableRowSelection === \"function\" ? enableRowSelection(row) : enableRowSelection) && fullRowSelectable;\r\n const isRowClickable = typeof enableRowClick === \"function\" ? enableRowClick(row) : enableRowClick;\r\n return (\r\n <>\r\n <tr\r\n key={row.id}\r\n ref={setNodeRef}\r\n onClick={async () => {\r\n if (isRowSelectionEnabled) {\r\n row.toggleSelected();\r\n } else if (isRowClickable && onRowClick) {\r\n await onRowClick(row);\r\n } else {\r\n // Nothing to execute\r\n }\r\n }}\r\n className={isRowSelectionEnabled || isRowClickable ? \"cursor-pointer\" : undefined}\r\n style={rowStyle}\r\n >\r\n {row.getVisibleCells().map((cell) => (\r\n <td\r\n key={cell.id}\r\n style={{\r\n ...cell.column.columnDef.meta?.cellStyle,\r\n ...(hasPinnedColumns ? getCommonPinningStyles(cell.column) : {}),\r\n }}\r\n className={cell.column.columnDef.meta?.cellClassName}\r\n >\r\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\r\n </td>\r\n ))}\r\n </tr>\r\n {subRowComponent && row.getIsExpanded() && subRowComponent(row)}\r\n </>\r\n );\r\n};\r\n\r\nconst DraggableRow = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableRowProps<TData, TFilter>) => {\r\n const { row, rowStyle } = props;\r\n const { transform, transition, setNodeRef, isDragging } = useSortable({ id: row.id });\r\n const draggableStyle: CSSProperties = {\r\n transform: CSS.Transform.toString(transform),\r\n transition: transition,\r\n opacity: isDragging ? 0.8 : 1,\r\n zIndex: isDragging ? 1 : 0,\r\n position: \"relative\",\r\n };\r\n return (\r\n <InternalTableRow<TData, TFilter>\r\n {...props}\r\n setNodeRef={setNodeRef}\r\n rowStyle={rowStyle ? { ...rowStyle, ...draggableStyle } : draggableStyle}\r\n />\r\n );\r\n};\r\n\r\nexport { InternalTableRow, DraggableRow };\r\n","import { DraggableRow, InternalTableRow } from \"./TableRows\";\r\nimport { SortableContext, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\r\nimport { Row, Table } from \"@tanstack/react-table\";\r\nimport { CSSProperties, useMemo } from \"react\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { ReactDataTableProps } from \"./ReactDataTableProps\";\r\nimport { Virtualizer } from \"@tanstack/react-virtual\";\r\n\r\ninterface TableBodyProps<TData, TFilter extends FilterModel = Record<string, never>> extends Pick<\r\n ReactDataTableProps<TData, TFilter>,\r\n \"enableRowClick\" | \"onRowClick\" | \"subRowComponent\"\r\n> {\r\n enableDragAndDrop: boolean;\r\n table: Table<TData>;\r\n rowStyle?: (row: TData) => CSSProperties;\r\n virtualizer?: Virtualizer<HTMLDivElement, Element>;\r\n}\r\n\r\ninterface InternalRow<TData> {\r\n row: Row<TData>;\r\n rowStyle?: CSSProperties;\r\n}\r\n\r\nconst TableBody = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableBodyProps<TData, TFilter>) => {\r\n const { enableDragAndDrop, table, rowStyle, enableRowClick, onRowClick, virtualizer, subRowComponent } = props;\r\n\r\n if (enableDragAndDrop && !table.options.getRowId) {\r\n throw new Error(\"You must provide 'getRowId()' to data-table options in order to use the drag-and-drop feature.\");\r\n }\r\n\r\n const {\r\n options: { enableRowSelection, enableExpanding, fullRowSelectable },\r\n } = table;\r\n\r\n const { rows } = table.getRowModel();\r\n\r\n const virtualizerRows = virtualizer?.getVirtualItems();\r\n\r\n const rowsToRender: InternalRow<TData>[] = useMemo(\r\n () =>\r\n virtualizerRows\r\n ? virtualizerRows.map((virtualRow, index) => ({\r\n row: rows[virtualRow.index],\r\n rowStyle: {\r\n height: `${virtualRow.size}px`,\r\n transform: `translateY(${virtualRow.start - index * virtualRow.size}px)`,\r\n },\r\n }))\r\n : rows.map((row) => ({ row })),\r\n [rows, virtualizerRows],\r\n );\r\n\r\n return enableDragAndDrop ? (\r\n <SortableContext items={table.getRowModel().rows.map((row) => row.id)} strategy={verticalListSortingStrategy}>\r\n {rowsToRender.map((x, index) => {\r\n const { row } = x;\r\n return (\r\n <DraggableRow<TData, TFilter>\r\n key={index}\r\n row={row}\r\n enableRowClick={enableRowClick}\r\n onRowClick={onRowClick}\r\n enableRowSelection={enableRowSelection as boolean | ((row: Row<TData>) => boolean)}\r\n enableExpanding={enableExpanding as boolean | ((row: Row<TData>) => boolean)}\r\n rowStyle={{\r\n ...x.rowStyle,\r\n ...(rowStyle ? rowStyle(row.original) : {}),\r\n }}\r\n fullRowSelectable={fullRowSelectable}\r\n subRowComponent={subRowComponent}\r\n />\r\n );\r\n })}\r\n </SortableContext>\r\n ) : (\r\n <>\r\n {rowsToRender.map((x, index) => {\r\n const { row } = x;\r\n return (\r\n <InternalTableRow<TData, TFilter>\r\n key={index}\r\n row={row}\r\n enableRowClick={enableRowClick}\r\n onRowClick={onRowClick}\r\n enableRowSelection={enableRowSelection as boolean | ((row: Row<TData>) => boolean)}\r\n enableExpanding={enableExpanding as boolean | ((row: Row<TData>) => boolean)}\r\n rowStyle={{\r\n ...x.rowStyle,\r\n ...(rowStyle ? rowStyle(row.original) : {}),\r\n }}\r\n fullRowSelectable={fullRowSelectable}\r\n hasPinnedColumns={table.getIsSomeColumnsPinned()}\r\n subRowComponent={subRowComponent}\r\n />\r\n );\r\n })}\r\n </>\r\n );\r\n};\r\n\r\nexport { TableBody };\r\n","import { Virtualizer } from \"@tanstack/react-virtual\";\r\nimport { useCallback, useEffect, useRef, useState } from \"react\";\r\n\r\nconst adjustTableHeight = (\r\n tableRef: React.RefObject<HTMLTableElement | null>,\r\n virtualHeight: number,\r\n onPseudoHeightChange: useVirtualizationTableHeightProps[\"onPseudoHeightChange\"],\r\n) => {\r\n if (!tableRef.current) return;\r\n\r\n // calculate the height for the pseudo element after the table\r\n const existingPseudoElement = window.getComputedStyle(tableRef.current, \"::after\");\r\n const existingPseudoHeight = Number.parseFloat(existingPseudoElement.height) || 0;\r\n const tableHeight = tableRef.current.clientHeight - existingPseudoHeight;\r\n const pseudoHeight = Math.max(virtualHeight - tableHeight, 0);\r\n onPseudoHeightChange?.(pseudoHeight);\r\n\r\n return pseudoHeight;\r\n};\r\n\r\nexport interface useVirtualizationTableHeightProps {\r\n parentRef: React.RefObject<HTMLDivElement | null>;\r\n virtualizer: Virtualizer<HTMLDivElement, Element>;\r\n enabled: boolean;\r\n onPseudoHeightChange?: (height: number) => void;\r\n}\r\n\r\n// https://github.com/TanStack/virtual/issues/640\r\nconst useVirtualizationTableHeight = (props: useVirtualizationTableHeightProps) => {\r\n const { parentRef, virtualizer, enabled, onPseudoHeightChange } = props;\r\n const scrollableRef = useRef<HTMLDivElement>(null);\r\n const tableRef = useRef<HTMLTableElement>(null);\r\n const [isScrollNearBottom, setIsScrollNearBottom] = useState(false);\r\n\r\n // avoid calling virtualizer methods when virtualization is disabled\r\n const virtualItems = enabled ? virtualizer.getVirtualItems() : [];\r\n const virtualSize = enabled ? virtualizer.getTotalSize() : 0;\r\n\r\n // callback to adjust the height of the pseudo element\r\n const handlePseudoResize = useCallback(\r\n () => adjustTableHeight(tableRef, virtualSize, onPseudoHeightChange),\r\n [tableRef, virtualSize, onPseudoHeightChange],\r\n );\r\n\r\n // callback to handle scrolling, checking if we are near the bottom\r\n const handleScroll = useCallback(() => {\r\n if (parentRef.current) {\r\n const scrollPosition = parentRef.current?.scrollTop;\r\n const visibleHeight = parentRef.current?.clientHeight;\r\n setIsScrollNearBottom(scrollPosition > virtualSize * 0.95 - visibleHeight);\r\n }\r\n }, [parentRef, virtualSize]);\r\n\r\n // add an event listener on the scrollable parent container and resize the\r\n // pseudo element whenever the table renders with new data\r\n useEffect(() => {\r\n if (!enabled) {\r\n return;\r\n }\r\n\r\n const scrollable = parentRef.current;\r\n if (scrollable) scrollable.addEventListener(\"scroll\", handleScroll);\r\n handlePseudoResize();\r\n\r\n return () => {\r\n if (scrollable) scrollable.removeEventListener(\"scroll\", handleScroll);\r\n };\r\n }, [handleScroll, handlePseudoResize, parentRef, enabled]);\r\n\r\n // if we are near the bottom of the table, resize the pseudo element each time\r\n // the length of virtual items changes (which is effectively the number of table\r\n // rows rendered to the DOM). This ensures we don't scroll too far or too short.\r\n useEffect(() => {\r\n if (!enabled) {\r\n return;\r\n }\r\n\r\n if (isScrollNearBottom) handlePseudoResize();\r\n }, [isScrollNearBottom, virtualItems.length, handlePseudoResize, enabled]);\r\n\r\n return { scrollableRef, tableRef };\r\n};\r\n\r\nexport { useVirtualizationTableHeight };\r\n","/* eslint max-lines: [\"error\", 400] */\r\nimport { faSortDown, faSortUp, faSearch, faTimes, faSort } from \"@fortawesome/free-solid-svg-icons\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { Paging } from \"@neolution-ch/react-pattern-ui\";\r\nimport { flexRender } from \"@tanstack/react-table\";\r\nimport { Table as ReactStrapTable, Input } from \"@neolution-ch/reactstrap\";\r\nimport { reactDataTableTranslations } from \"../translations/translations\";\r\nimport { ReactDataTableProps } from \"./ReactDataTableProps\";\r\nimport { FilterModel } from \"../types/TableState\";\r\nimport { getModelFromColumnFilter } from \"../utils/getModelFromColumnFilter\";\r\nimport { Fragment, useRef } from \"react\";\r\nimport { DndContext, KeyboardSensor, MouseSensor, TouchSensor, closestCenter, useSensor, useSensors } from \"@dnd-kit/core\";\r\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\r\nimport { getCommonPinningStyles } from \"../utils/getCommonPinningStyles\";\r\nimport { getFilterValue, setFilterValue } from \"../utils/customFilterMethods\";\r\nimport { useVirtualizer, Virtualizer } from \"@tanstack/react-virtual\";\r\nimport { TableBody } from \"./TableBody\";\r\nimport { useVirtualizationTableHeight } from \"../hooks/useVirtualizationTableHeight\";\r\nimport Skeleton from \"react-loading-skeleton\";\r\n\r\ninterface TableInternalProps<TData, TFilter extends FilterModel = Record<string, never>> extends ReactDataTableProps<TData, TFilter> {\r\n virtualizer?: Virtualizer<HTMLDivElement, Element>;\r\n tableRef?: React.RefObject<HTMLTableElement | null>;\r\n}\r\n\r\nconst TableInternal = <TData, TFilter extends FilterModel = Record<string, never>>(props: TableInternalProps<TData, TFilter>) => {\r\n const {\r\n virtualizer,\r\n isLoading,\r\n isFetching,\r\n table,\r\n tableClassName,\r\n tableStyle,\r\n rowStyle,\r\n onEnter,\r\n withoutHeaders = false,\r\n withoutHeaderFilters = false,\r\n dragAndDropOptions,\r\n noEntriesMessage,\r\n isStriped = true,\r\n showClearSearchButton = true,\r\n tableRef,\r\n tableHeaderStyle,\r\n } = props;\r\n\r\n const {\r\n options: { manualPagination },\r\n resetPageIndex,\r\n } = table;\r\n\r\n return (\r\n <ReactStrapTable\r\n striped={isStriped}\r\n hover\r\n size=\"sm\"\r\n className={tableClassName}\r\n style={\r\n !isLoading && isFetching\r\n ? {\r\n ...tableStyle,\r\n background: \"linear-gradient(90deg, #E8E8E8, #ffffff, #E8E8E8)\",\r\n backgroundSize: \"200% 200%\",\r\n animation: \"reloadingAnimation 3s linear infinite\",\r\n }\r\n : tableStyle\r\n }\r\n innerRef={tableRef}\r\n >\r\n {!withoutHeaders && (\r\n <thead style={tableHeaderStyle}>\r\n {table.getHeaderGroups().map((headerGroup) => (\r\n <Fragment key={headerGroup.id}>\r\n <tr key={`${headerGroup.id}-col-header`}>\r\n {headerGroup.headers.map((header) => (\r\n <th\r\n key={header.id}\r\n onClick={header.column.getToggleSortingHandler()}\r\n style={{\r\n ...header.column.columnDef.meta?.headerStyle,\r\n ...(header.column.getCanSort() ? { cursor: \"pointer\" } : {}),\r\n ...(table.getIsSomeColumnsPinned()\r\n ? getCommonPinningStyles(header.subHeaders.length > 0 ? header.subHeaders[0].column : header.column)\r\n : {}),\r\n }}\r\n className={header.column.columnDef.meta?.headerClassName}\r\n colSpan={header.colSpan}\r\n >\r\n {header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}\r\n\r\n {header.column.getIsSorted() === \"desc\" ? (\r\n <FontAwesomeIcon icon={faSortDown} className=\"ms-1\" />\r\n ) : header.column.getIsSorted() === \"asc\" ? (\r\n <FontAwesomeIcon icon={faSortUp} className=\"ms-1\" />\r\n ) : header.column.getCanSort() ? (\r\n <FontAwesomeIcon icon={faSort} className=\"ms-1\" />\r\n ) : (\r\n \"\"\r\n )}\r\n </th>\r\n ))}\r\n </tr>\r\n {!withoutHeaderFilters && !headerGroup.headers.every((x) => !!x.column.columnDef.meta?.hideHeaderFilters) && (\r\n <tr key={`${headerGroup.id}-col-filters`}>\r\n {headerGroup.headers.map((header) => {\r\n const {\r\n column: {\r\n columnDef: { meta },\r\n },\r\n } = header;\r\n\r\n return (\r\n <th\r\n key={`${header.id}-col-filter`}\r\n style={{\r\n ...header.column.columnDef.meta?.headerFilterStyle,\r\n ...(table.getIsSomeColumnsPinned() ? getCommonPinningStyles(header.column) : {}),\r\n }}\r\n >\r\n {header.index === 0 && (\r\n <>\r\n {onEnter && (\r\n <FontAwesomeIcon\r\n style={{ cursor: \"pointer\", marginBottom: \"4px\", marginRight: \"5px\" }}\r\n icon={faSearch}\r\n onClick={() => {\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n onEnter(getModelFromColumnFilter(table.getState().columnFilters));\r\n }}\r\n />\r\n )}\r\n\r\n {showClearSearchButton && (\r\n <FontAwesomeIcon\r\n style={{ cursor: \"pointer\", marginBottom: \"4px\", marginRight: \"5px\" }}\r\n icon={faTimes}\r\n onClick={() => {\r\n if (onEnter) {\r\n onEnter(getModelFromColumnFilter(table.initialState.columnFilters));\r\n }\r\n\r\n table.setColumnFilters(table.initialState.columnFilters);\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n }}\r\n />\r\n )}\r\n </>\r\n )}\r\n {header.column.getCanFilter() && (\r\n <>\r\n {meta?.customFilter ? (\r\n meta?.customFilter(\r\n getFilterValue(header.column, table),\r\n (value) => setFilterValue(header.column, table, value),\r\n table,\r\n )\r\n ) : meta?.dropdownFilter ? (\r\n <Input\r\n type=\"select\"\r\n value={(getFilterValue(header.column, table) as string) ?? \"\"}\r\n onChange={(e) => {\r\n setFilterValue(\r\n header.column,\r\n table,\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n meta.dropdownFilter?.options[(e.target as any as HTMLSelectElement).selectedIndex]?.value ??\r\n e.target.value,\r\n );\r\n if (!onEnter && manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n }}\r\n onKeyUp={({ key }) => {\r\n if (key === \"Enter\" && onEnter) {\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n onEnter(getModelFromColumnFilter(table.getState().columnFilters));\r\n }\r\n }}\r\n bsSize=\"sm\"\r\n >\r\n {meta.dropdownFilter.options.map(({ label, value, disabled }, i) => (\r\n <option key={i} value={value} disabled={disabled}>\r\n {label}\r\n </option>\r\n ))}\r\n </Input>\r\n ) : (\r\n <Input\r\n type=\"text\"\r\n value={(getFilterValue(header.column, table) as string) ?? \"\"}\r\n onChange={(e) => {\r\n setFilterValue(header.column, table, e.target.value);\r\n if (!onEnter && manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n }}\r\n onKeyUp={({ key }) => {\r\n if (key === \"Enter\" && onEnter) {\r\n if (manualPagination) {\r\n resetPageIndex(true);\r\n }\r\n onEnter(getModelFromColumnFilter(table.getState().columnFilters));\r\n }\r\n }}\r\n bsSize=\"sm\"\r\n ></Input>\r\n )}\r\n </>\r\n )}\r\n </th>\r\n );\r\n })}\r\n </tr>\r\n )}\r\n </Fragment>\r\n ))}\r\n </thead>\r\n )}\r\n <tbody>\r\n {table.getRowModel().rows.length === 0 ? (\r\n <tr>\r\n <td colSpan={table.getVisibleFlatColumns().length}>{noEntriesMessage ?? reactDataTableTranslations.noEntries}</td>\r\n </tr>\r\n ) : (\r\n <TableBody<TData>\r\n {...props}\r\n table={table}\r\n enableDragAndDrop={!!dragAndDropOptions?.enableDragAndDrop}\r\n rowStyle={rowStyle}\r\n virtualizer={virtualizer}\r\n />\r\n )}\r\n </tbody>\r\n {table.getFooterGroups().length > 0 &&\r\n table.getFooterGroups().some((x) => x.headers.some((y) => !y.isPlaceholder && y.column.columnDef.footer)) && (\r\n <tfoot>\r\n {table.getFooterGroups().map((footerGroup) => (\r\n <tr key={footerGroup.id}>\r\n {footerGroup.headers.map((header) => (\r\n <th\r\n key={header.id}\r\n style={header.column.columnDef.meta?.footerStyle}\r\n className={header.column.columnDef.meta?.footerClassName}\r\n >\r\n {header.isPlaceholder ? null : flexRender(header.column.columnDef.footer, header.getContext())}\r\n </th>\r\n ))}\r\n </tr>\r\n ))}\r\n </tfoot>\r\n )}\r\n </ReactStrapTable>\r\n );\r\n};\r\n\r\n/**\r\n * The table renderer for the react data table\r\n * @param props according to {@link ReactDataTableProps}\r\n * @returns The rendered ReactDataTable component\r\n */\r\nconst ReactDataTable = <TData, TFilter extends FilterModel = Record<string, never>>(props: ReactDataTableProps<TData, TFilter>) => {\r\n const {\r\n virtualizerOptions = { count: 0, enabled: false, estimateSize: () => 0 },\r\n table,\r\n pageSizes,\r\n showPaging,\r\n hidePageSizeChange,\r\n totalRecords = table.getCoreRowModel().rows.length,\r\n dragAndDropOptions,\r\n pagingNavigationComponents,\r\n isLoading,\r\n isFetching,\r\n onPseudoHeightChange,\r\n } = props;\r\n\r\n const { pagination } = table.getState();\r\n\r\n const loadingCss = ` \r\n @-webkit-keyframes reloadingAnimation {\r\n 0%{\r\n background-position-x: 200%\r\n }\r\n 100%{\r\n background-position-x: 0%\r\n }\r\n }`;\r\n\r\n const parentRef = useRef<HTMLDivElement>(null);\r\n\r\n const virtualizer = useVirtualizer({\r\n ...virtualizerOptions,\r\n count: totalRecords,\r\n getScrollElement: () => parentRef.current,\r\n });\r\n\r\n const sensors = useSensors(useSensor(MouseSensor, {}), useSensor(TouchSensor, {}), useSensor(KeyboardSensor, {}));\r\n\r\n const { scrollableRef, tableRef } = useVirtualizationTableHeight({\r\n parentRef,\r\n virtualizer,\r\n enabled: virtualizerOptions.enabled ?? false,\r\n onPseudoHeightChange,\r\n });\r\n\r\n return (\r\n <>\r\n <DndContext\r\n collisionDetection={closestCenter}\r\n modifiers={[restrictToVerticalAxis]}\r\n onDragEnd={dragAndDropOptions?.onDragEnd}\r\n sensors={sensors}\r\n >\r\n <style>{loadingCss}</style>\r\n\r\n {virtualizerOptions.enabled ? (\r\n <div ref={parentRef} style={{ height: virtualizerOptions.height ?? 600, overflow: \"auto\" }}>\r\n <div ref={scrollableRef} style={{ height: `${virtualizer.getTotalSize()}px` }}>\r\n <TableInternal<TData, TFilter> {...props} virtualizer={virtualizer} tableRef={tableRef} />\r\n </div>\r\n </div>\r\n ) : (\r\n <TableInternal<TData, TFilter> {...props} />\r\n )}\r\n </DndContext>\r\n\r\n {showPaging && (\r\n <>\r\n {isLoading || isFetching ? (\r\n <Skeleton count={1} height={20} />\r\n ) : (\r\n <Paging\r\n currentItemsPerPage={pagination.pageSize}\r\n currentPage={pagination.pageIndex + 1}\r\n totalRecords={totalRecords}\r\n currentRecordCount={table.getRowModel().rows.length}\r\n setItemsPerPage={(x) => {\r\n table.setPageSize(x);\r\n }}\r\n setCurrentPage={(x) => table.setPageIndex(x - 1)}\r\n possiblePageItemCounts={pageSizes}\r\n translations={{\r\n itemsPerPageDropdown: reactDataTableTranslations.itemsPerPageDropdown,\r\n showedItemsText: reactDataTableTranslations.showedItemsText,\r\n }}\r\n pagingPossible={true}\r\n changePageSizePossible={!hidePageSizeChange}\r\n navigationComponents={pagingNavigationComponents}\r\n />\r\n )}\r\n </>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nexport { ReactDataTable };\r\n","import { ColumnFiltersState } from \"@tanstack/react-table\";\r\n\r\nconst getStronglyTypedColumnFilter = <TData, TResult extends string | number>(\r\n columnFilters: ColumnFiltersState,\r\n id: keyof TData,\r\n targetType: \"string\" | \"number\",\r\n): TResult | undefined => {\r\n const item = columnFilters.find((element) => element.id === id);\r\n\r\n if (!item) {\r\n return undefined;\r\n }\r\n\r\n if (targetType === \"string\") {\r\n return item.value as TResult;\r\n } else if (targetType === \"number\") {\r\n const parsedValue = Number.parseFloat(item.value as string);\r\n return Number.isNaN(parsedValue) ? undefined : (parsedValue as TResult);\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport { getStronglyTypedColumnFilter };\r\n","import { useReactDataTable } from \"../useReactDataTable/useReactDataTable\";\r\nimport { useReactDataTableProps } from \"../useReactDataTable/useReactDataTableProps\";\r\nimport { useReactDataTableResult } from \"../useReactDataTable/useReactDataTableResult\";\r\nimport { FilterModel, TableState } from \"../types/TableState\";\r\n\r\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\r\n\r\ninterface useFullyControlledReactDataTableProps<TData, TFilter extends FilterModel> extends WithRequired<\r\n Omit<useReactDataTableProps<TData, TFilter>, \"manualFiltering\" | \"manualPagination\" | \"manualSorting\">,\r\n \"onColumnFiltersChange\" | \"onPaginationChange\" | \"onSortingChange\"\r\n> {\r\n state: {\r\n columnFilters: TableState<TData, TFilter>[\"columnFilters\"];\r\n pagination: TableState<TData, TFilter>[\"pagination\"];\r\n sorting: TableState<TData, TFilter>[\"sorting\"];\r\n expanded: TableState<TData, TFilter>[\"expanded\"];\r\n rowSelection?: TableState<TData, TFilter>[\"rowSelection\"];\r\n columnPinning?: TableState<TData, TFilter>[\"columnPinning\"];\r\n };\r\n}\r\n\r\n/**\r\n * A helper hook to use the useReactDataTable hook which is fully controlled. Usefull for server side filtering, sorting and pagination.\r\n * @param props The properties to configure the table\r\n * @returns The table instance and the state of the table\r\n */\r\nconst useFullyControlledReactDataTable = <TData, TFilter extends FilterModel>(\r\n props: useFullyControlledReactDataTableProps<TData, TFilter>,\r\n): useReactDataTableResult<TData, TFilter> =>\r\n useReactDataTable<TData, TFilter>({ manualFiltering: true, manualPagination: true, manualSorting: true, ...props });\r\n\r\nexport { useFullyControlledReactDataTable };\r\n","import { useSortable } from \"@dnd-kit/sortable\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { ColumnDef, ColumnHelper, DeepKeys, DisplayColumnDef, RowData, Row, createColumnHelper } from \"@tanstack/react-table\";\r\nimport { ReactNode } from \"react\";\r\nimport type { DropdownColumnFilterOption } from \"src/react-table\";\r\nimport { faGripLines } from \"@fortawesome/free-solid-svg-icons\";\r\n\r\ninterface ReactDataTableColumnHelper<TData extends RowData> extends ColumnHelper<TData> {\r\n createEnumColumn: <TEnum extends string | number>(\r\n columnKey: DeepKeys<TData>,\r\n enumTranslations: Record<TEnum, string> | DropdownColumnFilterOption[],\r\n columndDef?: Partial<ColumnDef<TData, TEnum>>,\r\n ) => ColumnDef<TData, TEnum>;\r\n createDraggableColumn: (\r\n columnKey: DeepKeys<TData>,\r\n columndDef: Omit<DisplayColumnDef<TData>, \"id\" | \"cell\">,\r\n isEnabled?: boolean | ((row: Row<TData>) => boolean),\r\n draggableElement?: ReactNode,\r\n ) => ColumnDef<TData>;\r\n}\r\n\r\nconst createReactDataTableColumnHelper = <TData extends RowData>(): ReactDataTableColumnHelper<TData> => {\r\n const columnHelper = createColumnHelper<TData>();\r\n\r\n const createDraggableColumn: ReactDataTableColumnHelper<TData>[\"createDraggableColumn\"] = (\r\n columnKey,\r\n columndDef,\r\n isEnabled,\r\n draggableElement,\r\n ) => {\r\n const RowDragHandleCell = ({ row }: { row: Row<TData> }) => {\r\n const isEnabledInternal = isEnabled === undefined ? true : typeof isEnabled === \"function\" ? isEnabled(row) : isEnabled;\r\n const { attributes, listeners, isDragging } = useSortable({ id: row.id, disabled: !isEnabledInternal });\r\n\r\n return (\r\n <span\r\n {...attributes}\r\n {...listeners}\r\n className={isEnabledInternal === false ? \"opacity-25\" : \"opacity-100\"}\r\n style={{ cursor: isEnabledInternal === false ? \"auto\" : isDragging ? \"grabbing\" : \"grab\" }}\r\n >\r\n {draggableElement ?? <FontAwesomeIcon icon={faGripLines} />}\r\n </span>\r\n );\r\n };\r\n\r\n return columnHelper.display({\r\n ...columndDef,\r\n id: columnKey as string,\r\n cell: ({ row }) => <RowDragHandleCell row={row} />,\r\n });\r\n };\r\n\r\n const res: ReactDataTableColumnHelper<TData> = {\r\n ...columnHelper,\r\n createDraggableColumn,\r\n createEnumColumn: (columnKey, enumTranslations, columndDef) =>\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n columnHelper.accessor(columnKey as any, {\r\n cell: (cell) =>\r\n Array.isArray(enumTranslations)\r\n ? enumTranslations.find((x) => x.value === cell.getValue())?.label\r\n : enumTranslations[cell.getValue()],\r\n enableColumnFilter: true,\r\n meta: {\r\n dropdownFilter: {\r\n options: Array.isArray(enumTranslations)\r\n ? enumTranslations\r\n : Object.entries(enumTranslations).map(([key, value]) => ({\r\n label: value as string,\r\n value: key,\r\n })),\r\n },\r\n },\r\n ...columndDef,\r\n }),\r\n };\r\n\r\n return res;\r\n};\r\n\r\nexport { createReactDataTableColumnHelper };\r\n"],"names":["reactDataTableTranslations","actionTitle","clearSearchToolTip","searchToolTip","showedItemsText","itemsPerPageDropdown","noEntries","setDataTableTranslations","translations","useReactDataTableState","props","initialColumnFilters","initialSorting","initialPagination","initialRowSelection","initialExpanded","initialColumnPinning","initialAfterSearchFilter","columnFilters","setColumnFilters","useState","afterSearchFilter","setAfterSearchFilter","sorting","setSorting","rowSelection","setRowSelection","expanded","setExpanded","columnPinning","setColumnPinning","pagination","setPagination","pageIndex","pageSize","usePersistentReactDataTableState","localStorageKey","getExpirationDate","getExpirationDateRef","useRef","useInsertionEffect","current","getLocalStorageItem","latestStateRef","setAndPersistState","useCallback","key","setState","newState","resolvedState","setLocalStorageItem","newPagination","newColumnFilters","newAfterSearchFilter","newColumnPinning","newExpanded","newRowSelection","newSorting","getColumnFilterFromModel","filter","Object","entries","map","id","value","getModelFromColumnFilter","fromEntries","getSortingStateFromModel","sortingState","String","desc","useReactDataTable","data","columns","isLoading","initialState","manualFiltering","manualPagination","manualSorting","state","onColumnFiltersChange","onPaginationChange","onSortingChange","onRowSelectionChange","onExpandedChange","onColumnPinningChange","reactTableOptions","columnFiltersInitial","sortingInitial","paginationInitial","rowSelectionInitial","expandedInitial","columnPinningInitial","columnFiltersExternal","paginationExternal","sortingExternal","rowSelectionExternal","expandedExternal","columnPinningExternal","columnFiltersInternal","paginationInternal","sortingInternal","rowSelectionInteral","expandedInternal","columnPinningInternal","setColumnFiltersInternal","setPaginationInternal","setSortingInternal","setRowSelectionInternal","setExpandedInternal","setColumnPinningInternal","effectiveColumnFilters","effectivePagination","effectiveSorting","effectiveRowSelection","effectiveExpanded","effectiveColumnPinning","effectiveOnColumnFiltersChange","effectiveOnPaginationChange","effectiveOnSortingChange","effectiveOnRowSelectionChange","effectiveOnExpandedChange","effectiveOnColumnPinningChange","x","filterFn","undefined","internalColumns","meta","isHidden","skeletonColumns","column","cell","_jsx","Skeleton","skeletonData","Array","from","length","useMemo","table","useReactTable","filtersOrUpdaterFn","newFilter","paginationOrUpdaterFn","sortingOrUpdaterFn","first","getModelFromSortingState","rowSelectionOrUpdaterFn","expandedOrUpdaterFn","columnPinningOrUpdaterFn","getCoreRowModel","getFilteredRowModel","getSortedRowModel","getPaginationRowModel","getExpandedRowModel","enableMultiSort","enableMultiRowSelection","enableSubRowSelection","enableRowSelection","defaultColumn","enableColumnFilter","enableSorting","enableExpanding","getCommonPinningStyles","isPinned","getIsPinned","left","getStart","right","getAfter","position","width","getSize","zIndex","setFilterValue","customFilterName","columnDef","prev","getFilterValue","getState","find","InternalTableRow","row","rowStyle","setNodeRef","fullRowSelectable","onRowClick","enableRowClick","hasPinnedColumns","subRowComponent","isRowSelectionEnabled","isRowClickable","_jsxs","_Fragment","children","ref","onClick","async","toggleSelected","className","style","getVisibleCells","cellStyle","cellClassName","flexRender","getContext","getIsExpanded","DraggableRow","transform","transition","isDragging","useSortable","draggableStyle","CSS","Transform","toString","opacity","TableBody","enableDragAndDrop","virtualizer","options","getRowId","Error","rows","getRowModel","virtualizerRows","getVirtualItems","rowsToRender","virtualRow","index","height","size","start","SortableContext","items","strategy","verticalListSortingStrategy","original","getIsSomeColumnsPinned","useVirtualizationTableHeight","parentRef","enabled","onPseudoHeightChange","scrollableRef","tableRef","isScrollNearBottom","setIsScrollNearBottom","virtualItems","virtualSize","getTotalSize","handlePseudoResize","virtualHeight","existingPseudoElement","window","getComputedStyle","existingPseudoHeight","Number","parseFloat","tableHeight","clientHeight","pseudoHeight","Math","max","adjustTableHeight","handleScroll","scrollPosition","scrollTop","visibleHeight","useEffect","scrollable","addEventListener","removeEventListener","TableInternal","isFetching","tableClassName","tableStyle","onEnter","withoutHeaders","withoutHeaderFilters","dragAndDropOptions","noEntriesMessage","isStriped","showClearSearchButton","tableHeaderStyle","resetPageIndex","ReactStrapTable","striped","hover","background","backgroundSize","animation","innerRef","getHeaderGroups","headerGroup","Fragment","headers","header","getToggleSortingHandler","headerStyle","getCanSort","cursor","subHeaders","headerClassName","colSpan","isPlaceholder","getIsSorted","FontAwesomeIcon","icon","faSortDown","faSortUp","faSort","every","hideHeaderFilters","headerFilterStyle","marginBottom","marginRight","faSearch","faTimes","getCanFilter","customFilter","Input","dropdownFilter","type","onChange","e","target","selectedIndex","onKeyUp","bsSize","label","disabled","i","getVisibleFlatColumns","getFooterGroups","some","y","footer","footerGroup","footerStyle","footerClassName","ReactDataTable","virtualizerOptions","count","estimateSize","pageSizes","showPaging","hidePageSizeChange","totalRecords","pagingNavigationComponents","useVirtualizer","getScrollElement","sensors","useSensors","useSensor","MouseSensor","TouchSensor","KeyboardSensor","DndContext","collisionDetection","closestCenter","modifiers","restrictToVerticalAxis","onDragEnd","overflow","Paging","currentItemsPerPage","currentPage","currentRecordCount","setItemsPerPage","setPageSize","setCurrentPage","setPageIndex","possiblePageItemCounts","pagingPossible","changePageSizePossible","navigationComponents","getStronglyTypedColumnFilter","targetType","item","element","parsedValue","isNaN","useFullyControlledReactDataTable","createReactDataTableColumnHelper","columnHelper","createColumnHelper","createDraggableColumn","columnKey","columndDef","isEnabled","draggableElement","RowDragHandleCell","isEnabledInternal","attributes","listeners","faGripLines","display","createEnumColumn","enumTranslations","accessor","isArray","getValue"],"mappings":"4uCAcO,IAAIA,EAAyD,CAClEC,YAAa,WACbC,mBAAoB,qBACpBC,cAAe,SACfC,gBAAiB,yDACjBC,qBAAsB,mBACtBC,UAAW,4BAGP,SAAUC,EAAyBC,GACvCR,EAA6BQ,CAC/B,CCZA,MAAMC,EACJC,IAEA,MAAMC,qBACJA,EAAoBC,eACpBA,EAAcC,kBACdA,EAAiBC,oBACjBA,EAAmBC,gBACnBA,EAAeC,qBACfA,EAAoBC,yBACpBA,GACEP,GAEGQ,EAAeC,GAAoBC,EAAmBT,GAAwB,CAAA,IAC9EU,EAAmBC,GAAwBF,EAAmBH,GAA4BN,GAAwB,KAClHY,EAASC,GAAcJ,EAA0CR,IACjEa,EAAcC,GAAmBN,EAA4BN,GAAwB,CAAA,IACrFa,EAAUC,GAAeR,EAAwBL,GAAoB,CAAA,IACrEc,EAAeC,GAAoBV,EAA6BJ,GAAyB,CAAA,IAEzFe,EAAYC,GAAiBZ,EAA0B,CAC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