simple-table-core 0.7.43 → 0.7.45
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/dist/components/SimpleTable/RenderCells.d.ts +4 -2
- package/dist/components/SimpleTable/TableBody.d.ts +0 -1
- package/dist/components/SimpleTable/TableHeaderSection.d.ts +1 -1
- package/dist/components/SimpleTable/TableRow.d.ts +4 -3
- package/dist/components/SimpleTable/TableSection.d.ts +4 -2
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/ColumnIndices.d.ts +2 -0
- package/dist/types/RowIndices.d.ts +2 -0
- package/dist/types/TableHeaderSectionProps.d.ts +2 -0
- package/dist/utils/columnIndicesUtils.d.ts +17 -0
- package/package.json +3 -2
|
@@ -2,7 +2,8 @@ import HeaderObject from "../../types/HeaderObject";
|
|
|
2
2
|
import { RowId } from "../../types/RowId";
|
|
3
3
|
import VisibleRow from "../../types/VisibleRow";
|
|
4
4
|
import { Pinned } from "../../types/Pinned";
|
|
5
|
-
import
|
|
5
|
+
import RowIndices from "../../types/RowIndices";
|
|
6
|
+
import ColumnIndices from "../../types/ColumnIndices";
|
|
6
7
|
interface RenderCellsProps {
|
|
7
8
|
columnIndices: ColumnIndices;
|
|
8
9
|
headers: HeaderObject[];
|
|
@@ -11,7 +12,8 @@ interface RenderCellsProps {
|
|
|
11
12
|
onExpandRowClick: (rowId: RowId) => void;
|
|
12
13
|
pinned?: Pinned;
|
|
13
14
|
rowIndex: number;
|
|
15
|
+
rowIndices: RowIndices;
|
|
14
16
|
visibleRow: VisibleRow;
|
|
15
17
|
}
|
|
16
|
-
declare const RenderCells: ({ columnIndices, headers, hiddenColumns, isWidthDragging, onExpandRowClick, pinned, rowIndex, visibleRow, }: RenderCellsProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare const RenderCells: ({ columnIndices, headers, hiddenColumns, isWidthDragging, onExpandRowClick, pinned, rowIndex, rowIndices, visibleRow, }: RenderCellsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export default RenderCells;
|
|
@@ -2,7 +2,6 @@ import { Dispatch, SetStateAction, RefObject } from "react";
|
|
|
2
2
|
import Row from "../../types/Row";
|
|
3
3
|
import VisibleRow from "../../types/VisibleRow";
|
|
4
4
|
import HeaderObject from "../../types/HeaderObject";
|
|
5
|
-
export type ColumnIndices = Record<string, number>;
|
|
6
5
|
interface TableBodyLocalProps {
|
|
7
6
|
centerHeaderRef: RefObject<HTMLDivElement | null>;
|
|
8
7
|
flattenedRows: Row[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import TableHeaderSectionProps from "../../types/TableHeaderSectionProps";
|
|
2
|
-
declare const TableHeaderSection: ({ gridTemplateColumns, handleScroll, headersRef, hiddenColumns, maxDepth, pinned, sectionRef, sort, }: TableHeaderSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const TableHeaderSection: ({ columnIndices, gridTemplateColumns, handleScroll, headersRef, hiddenColumns, maxDepth, pinned, sectionRef, sort, }: TableHeaderSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TableHeaderSection;
|
|
@@ -2,19 +2,20 @@ import { RowId } from "../../types/RowId";
|
|
|
2
2
|
import VisibleRow from "../../types/VisibleRow";
|
|
3
3
|
import { Pinned } from "../../types/Pinned";
|
|
4
4
|
import HeaderObject from "../../types/HeaderObject";
|
|
5
|
-
import
|
|
5
|
+
import ColumnIndices from "../../types/ColumnIndices";
|
|
6
|
+
import RowIndices from "../../types/RowIndices";
|
|
6
7
|
interface TableRowProps {
|
|
7
8
|
columnIndices: ColumnIndices;
|
|
8
|
-
getNextRowIndex: () => number;
|
|
9
9
|
gridTemplateColumns: string;
|
|
10
10
|
index: number;
|
|
11
11
|
pinned?: Pinned;
|
|
12
12
|
rowHeight: number;
|
|
13
|
+
rowIndices: RowIndices;
|
|
13
14
|
visibleRow: VisibleRow;
|
|
14
15
|
headers: HeaderObject[];
|
|
15
16
|
hiddenColumns: Record<string, boolean>;
|
|
16
17
|
isWidthDragging: boolean;
|
|
17
18
|
onExpandRowClick: (rowId: RowId) => void;
|
|
18
19
|
}
|
|
19
|
-
declare const TableRow: ({ columnIndices,
|
|
20
|
+
declare const TableRow: ({ columnIndices, gridTemplateColumns, headers, hiddenColumns, index, isWidthDragging, onExpandRowClick, pinned, rowHeight, rowIndices, visibleRow, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export default TableRow;
|
|
@@ -3,7 +3,8 @@ import VisibleRow from "../../types/VisibleRow";
|
|
|
3
3
|
import { RowId } from "../../types/RowId";
|
|
4
4
|
import { Pinned } from "../../types/Pinned";
|
|
5
5
|
import HeaderObject from "../../types/HeaderObject";
|
|
6
|
-
import
|
|
6
|
+
import ColumnIndices from "../../types/ColumnIndices";
|
|
7
|
+
import RowIndices from "../../types/RowIndices";
|
|
7
8
|
interface TableSectionProps {
|
|
8
9
|
columnIndices: ColumnIndices;
|
|
9
10
|
headerContainerRef: RefObject<HTMLDivElement | null>;
|
|
@@ -13,11 +14,12 @@ interface TableSectionProps {
|
|
|
13
14
|
onExpandRowClick: (rowId: RowId) => void;
|
|
14
15
|
pinned?: Pinned;
|
|
15
16
|
rowHeight: number;
|
|
17
|
+
rowIndices: RowIndices;
|
|
16
18
|
sectionRef?: RefObject<HTMLDivElement | null>;
|
|
17
19
|
templateColumns: string;
|
|
18
20
|
totalHeight: number;
|
|
19
21
|
visibleRows: VisibleRow[];
|
|
20
22
|
width?: number;
|
|
21
23
|
}
|
|
22
|
-
declare const TableSection: ({ columnIndices, headerContainerRef, headers, hiddenColumns, isWidthDragging, onExpandRowClick, pinned, rowHeight, sectionRef, templateColumns, totalHeight, visibleRows, width, }: TableSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const TableSection: ({ columnIndices, headerContainerRef, headers, hiddenColumns, isWidthDragging, onExpandRowClick, pinned, rowHeight, rowIndices, sectionRef, templateColumns, totalHeight, visibleRows, width, }: TableSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
export default TableSection;
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as n,Fragment as r}from"react/jsx-runtime";import{useState as t,useRef as o,useCallback as i,useEffect as a,useMemo as l,createContext as d,useContext as c,forwardRef as s,useLayoutEffect as u,Fragment as h,createRef as f,memo as v,useReducer as g}from"react";var m=function(){return m=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},m.apply(this,arguments)};function w(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var p,C=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},x=function(r){var t=r.currentPage,o=r.hideFooter,i=r.nextIcon,a=r.onPageChange,l=r.onNextPage,d=r.onPreviousPage,c=r.prevIcon,s=r.shouldPaginate,u=r.totalPages;if(o||!s)return null;var h=!(t>1)&&!d,f=!(t<u)&&!l;return e("div",m({className:"st-footer"},{children:[n("button",m({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),d&&d(e-1)},disabled:h},{children:c})),n("button",m({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:f},{children:i})),Array.from({length:u},(function(e,r){return n("button",m({onClick:function(){var e;(e=r+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&d&&d(e-1))},className:"st-page-btn ".concat(t===r+1?"active":"")},{children:r+1}),r)}))]}))},I=function(e){var r=e.className;return n("svg",m({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},R=function(e){var r=e.className;return n("svg",m({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},b=function(e){var r=e.className;return n("svg",m({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},y=function(e){var r=e.className;return n("svg",m({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},M=function(e){return e.position*(e.rowHeight+1)-1},E=function(e){return e.position*(e.rowHeight+1)},S=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},D=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},H=function(r){var t=r.value,o=r.onBlur,i=r.onChange;return e("select",m({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[n("option",m({value:"true"},{children:"True"})),n("option",m({value:"false"},{children:"False"}))]}))},k=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:t,onChange:function(e){var n=e.target.value;i(n)}})},N=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:r.toString(),onBlur:t,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},T=function(e){var t=e.onChange,o=e.setIsEditing,i=e.value,a=function(e){null==t||t(e)},l=function(){o(!1)};return n(r,{children:"string"==typeof i||null==i?n(k,{defaultValue:i,onBlur:l,onChange:a}):"boolean"==typeof i?n(H,{onBlur:l,onChange:a,value:i}):"number"==typeof i?n(N,{defaultValue:i,onBlur:l,onChange:a}):null})},L=0,W=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===L||o-L>=t)&&(L=o,n(r))}},O=Date.now(),B={screenX:0,screenY:0},P=function(e){var n,r,t=e.draggedHeaderRef,i=e.headersRef,l=e.hoveredHeaderRef,d=e.onColumnOrderChange,c=e.onTableHeaderDragEnd,s=(n=i.current,r=o(n),a((function(){r.current=n}),[n]),r.current);return{handleDragStart:function(e){t.current=e,O=Date.now()},handleDragOver:function(e){var n,r=e.event,o=e.hoveredHeader;if(r.preventDefault(),i.current){var a=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),d=r.screenX,u=r.screenY,h=Math.sqrt(Math.pow(d-B.screenX,2)+Math.pow(u-B.screenY,2));l.current=o;var f=w([],i.current,!0),v=f.findIndex((function(e){var n;return e.accessor===(null===(n=t.current)||void 0===n?void 0:n.accessor)})),g=f.findIndex((function(e){return e.accessor===o.accessor})),m=f.splice(v,1)[0];if(f.splice(g,0,m),!(a||o.accessor===(null===(n=t.current)||void 0===n?void 0:n.accessor)||null===t.current||h<10||void 0===v||void 0===g||JSON.stringify(f)===JSON.stringify(i.current))){var p=Date.now();JSON.stringify(f)===JSON.stringify(s)&&p-O<800&&h<50||(O=p,B={screenX:d,screenY:u},c(f))}}},handleDragEnd:function(){t.current=null,l.current=null,null==d||d(i.current)}}},F=d(void 0),A=function(e){var r=e.children,t=e.value;return n(F.Provider,m({value:t},{children:r}))},z=function(){var e=c(F);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},j=s((function(r,o){var i,l,d=r.borderClass,c=r.colIndex,s=r.header,u=r.isHighlighted,h=r.isInitialFocused,f=r.onExpandRowClick,v=r.rowIndex,g=r.visibleRow,w=z(),p=w.draggedHeaderRef,C=w.headersRef,x=w.hoveredHeaderRef,I=w.onCellEdit,b=w.onTableHeaderDragEnd,M=w.handleMouseDown,E=w.handleMouseOver,D=g.depth,H=g.row,k=t(H.rowData[s.accessor]),N=k[0],L=k[1],O=t(!1),B=O[0],F=O[1],A=P({draggedHeaderRef:p,headersRef:C,hoveredHeaderRef:x,onTableHeaderDragEnd:b}).handleDragOver,j=W(),U="cell-".concat(v,"-").concat(c),K=Boolean(null===(l=null===(i=H.rowMeta)||void 0===i?void 0:i.children)||void 0===l?void 0:l.length),V=Boolean(null==s?void 0:s.isEditable),J=v%2==0,X="st-cell ".concat(D>0&&s.expandable?"st-cell-depth-".concat(D):""," ").concat(u?h?"st-cell-selected-first ".concat(d):"st-cell-selected ".concat(d):""," ").concat(J?"st-cell-odd-row":"st-cell-even-row"," ").concat(V?"clickable":"");a((function(){L(H.rowData[s.accessor])}),[s.accessor,H]);return B?n("div",m({className:"st-cell-editing ".concat(J?"st-cell-odd-row":"st-cell-even-row"),id:S({accessor:s.accessor,rowIndex:v+1})},{children:n(T,{onChange:function(e){L(e),null==I||I({accessor:s.accessor,newValue:e,row:H})},setIsEditing:F,value:N})})):e("div",m({className:X,id:U,onDoubleClick:function(){return s.isEditable&&F(!0)},onMouseDown:function(){return M({rowIndex:v,colIndex:c,rowId:H.rowMeta.rowId})},onMouseOver:function(){return E({rowIndex:v,colIndex:c,rowId:H.rowMeta.rowId})},onDragOver:function(e){return j({callback:A,callbackProps:{event:e,hoveredHeader:s},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!s.isEditable||B||(e.preventDefault(),F(!0))},ref:o,"data-row-index":v,"data-col-index":c,"aria-selected":u},{children:[s.expandable&&K?H.rowMeta.isExpanded?n("div",m({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)}},{children:n(y,{className:"st-sort-icon"})})):n("div",m({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)}},{children:n(R,{className:"st-sort-icon"})})):null,n("span",m({className:"st-cell-content ".concat("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"")},{children:s.cellRenderer?s.cellRenderer({accessor:s.accessor,colIndex:c,row:H}):N}))]}))})),U=function(e){var t=e.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(e,["children"]);return z().allowAnimations?n(K,m({},o,{children:t})):n(r,{children:t})},K=function(e){var i=e.children,l=e.isBody,d=e.pauseAnimation,c=e.rowIndex,s=o(!1),h=z(),f=h.draggedHeaderRef,v=h.headersRef,g=h.mainBodyRef,m=h.shouldPaginate,w=t({}),p=w[0],C=w[1],x=o({}),I=v.current;return u((function(){if(I){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(S({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:I,draggedHeaderRef:f,rowIndex:c});JSON.stringify(e)!==JSON.stringify(p)&&(x.current=p,C(e))}}),[p,I,f,l,c]),u((function(){var e=g.current,n=function(){s.current=!0},r=function(){s.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[f,g]),a((function(){d||s.current||Object.keys(x.current).length&&I&&I.forEach((function(e){var n=document.getElementById(S({accessor:e.accessor,rowIndex:c}));if(n){var r=x.current[e.accessor],t=p[e.accessor];if(r&&t){var o=r.left-t.left,i=m?0:r.top-t.top,a=Math.abs(o),l=Math.abs(i);(a>10||l>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[p,I,l,d,x,c,m]),n(r,{children:i})},V=function(e){var r=e.columnIndices,t=e.headers,o=e.hiddenColumns,i=e.isWidthDragging,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.visibleRow,s=t.filter((function(e){return D({hiddenColumns:o,header:e,pinned:l})}));return n(U,m({isBody:!0,pauseAnimation:i,rowIndex:d+1},{children:s.map((function(e){return n(J,{columnIndices:r,header:e,headers:t,hiddenColumns:o,onExpandRowClick:a,pinned:l,rowIndex:d,visibleRow:c},S({accessor:e.accessor,rowIndex:d+1}))}))}))},J=function(e){var r=e.columnIndices,t=e.header,o=e.headers,i=e.hiddenColumns,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.visibleRow,s=z(),u=s.getBorderClass,f=s.isSelected,v=s.isInitialFocusedCell,g=r[t.accessor];if(t.children){var m=t.children.filter((function(e){return D({hiddenColumns:i,header:e,pinned:l})}));return n(h,{children:m.map((function(e){return n(J,{columnIndices:r,header:e,headers:o,hiddenColumns:i,onExpandRowClick:a,pinned:l,rowIndex:d,visibleRow:c},S({accessor:e.accessor,rowIndex:d+1}))}))})}var w=u({rowIndex:d,colIndex:g,rowId:c.row.rowMeta.rowId}),p=f({rowIndex:d,colIndex:g,rowId:c.row.rowMeta.rowId}),C=v({rowIndex:d,colIndex:g,rowId:c.row.rowMeta.rowId});return n(j,{borderClass:w,colIndex:g,header:t,isHighlighted:p,isInitialFocused:C,onExpandRowClick:a,rowIndex:d,visibleRow:c},S({accessor:t.accessor,rowIndex:d+1}))},X=function(e){var r=e.columnIndices,t=e.getNextRowIndex,o=e.gridTemplateColumns,i=e.headers,a=e.hiddenColumns,l=e.index,d=e.isWidthDragging,c=e.onExpandRowClick,s=e.pinned,u=e.rowHeight,h=e.visibleRow,f=h.position,v=t();return n("div",m({className:"st-table-row",style:{gridTemplateColumns:o,top:E({position:f,rowHeight:u}),height:"".concat(u,"px")}},{children:n(V,{columnIndices:r,headers:i,hiddenColumns:a,isWidthDragging:d,onExpandRowClick:c,pinned:s,rowIndex:v,visibleRow:h},l)}))},q=function(e){var r=e.lastGroupRow,t=e.position,o=e.rowHeight,i=e.templateColumns;return n("div",m({className:"st-row-separator ".concat(r?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:i,position:"absolute",top:M({position:t,rowHeight:o}),minWidth:"100%"}},{children:n("div",{style:{gridColumn:"1 / -1"}})}))},Y=function(r){var t=r.columnIndices;r.headerContainerRef;var i=r.headers,l=r.hiddenColumns,d=r.isWidthDragging,c=r.onExpandRowClick,s=r.pinned,u=r.rowHeight,f=r.sectionRef,v=r.templateColumns,g=r.totalHeight,w=r.visibleRows,p=r.width,C=s?"st-table-body-pinned-".concat(s):"st-table-body-main",x=o(0);a((function(){x.current=0}));var I=function(){return x.current++};return n("div",m({className:C,ref:f,style:{position:"relative",height:"".concat(g,"px"),width:p}},{children:w.map((function(r,o){var a,f,g=Boolean(null===(f=null===(a=r.row.rowMeta)||void 0===a?void 0:a.children)||void 0===f?void 0:f.length);return e(h,{children:[n(X,{columnIndices:t,getNextRowIndex:I,gridTemplateColumns:v,headers:i,hiddenColumns:l,index:o,isWidthDragging:d,onExpandRowClick:c,pinned:s,rowHeight:u,visibleRow:r}),0!==o&&n(q,{lastGroupRow:g,position:r.position,rowHeight:u,templateColumns:v})]},o)}))}))},G=function(r){var i,d,c,s,u,h=r.centerHeaderRef,f=r.flattenedRows,v=r.headerContainerRef,g=r.isWidthDragging,w=r.mainTemplateColumns,p=r.pinnedLeftColumns,C=r.pinnedLeftHeaderRef,x=r.pinnedLeftTemplateColumns,I=r.pinnedRightColumns,R=r.pinnedRightHeaderRef,b=r.pinnedRightTemplateColumns,y=r.setFlattenedRows,M=r.setScrollTop,E=r.visibleRows,S=z(),H=S.rowHeight,k=S.scrollbarWidth,N=S.mainBodyRef,T=S.pinnedLeftRef,L=S.pinnedRightRef,W=S.tableBodyContainerRef,O=S.hiddenColumns,B=S.headersRef;!function(e){var n=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,i=t(!1),l=i[0],d=i[1];a((function(){var e=null==n?void 0:n.current;if(l&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[n,l,o]),a((function(){var e=null==n?void 0:n.current,t=null==r?void 0:r.current;if(t&&e){var o=function(){if(t){var e=t.scrollHeight>t.clientHeight;d(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(t),function(){t&&i.unobserve(t)}}}),[n,r])}({headerContainerRef:v,mainSectionRef:W,scrollbarWidth:k});var P,F,A=o(null),j=(P=0,(F=function(e){e.forEach((function(e){P+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&F(e.rowMeta.children)}))})(f),P)*(H+1)-1,U=l((function(){var e={},n=0,r=function(t,o){n++,e[t.accessor]=n,t.children&&t.children.length>0&&t.children.filter((function(e){return D({hiddenColumns:O,header:e})})).forEach((function(e){r(e)}))};return p.forEach((function(e){r(e)})),B.current.filter((function(e){return!e.pinned&&D({hiddenColumns:O,header:e})})).forEach((function(e){r(e)})),I.forEach((function(e){r(e)})),e}),[B,O,p,I]),K=function(e){var n=function(r){return r.rowMeta.rowId===e&&r.rowMeta.children?m(m({},r),{rowMeta:m(m({},r.rowMeta),{isExpanded:!r.rowMeta.isExpanded})}):r.rowMeta.children?m(m({},r),{rowMeta:m(m({},r.rowMeta),{children:r.rowMeta.children.map(n)})}):r};y((function(e){return e.map(n)}))},V=(null===(i=C.current)||void 0===i?void 0:i.clientWidth)?(null===(d=C.current)||void 0===d?void 0:d.clientWidth)+1:0,J=null===(c=h.current)||void 0===c?void 0:c.clientWidth,X=(null===(s=R.current)||void 0===s?void 0:s.clientWidth)?(null===(u=R.current)||void 0===u?void 0:u.clientWidth)+1:0,q={headerContainerRef:v,headers:B.current,hiddenColumns:O,isWidthDragging:g,rowHeight:H,visibleRows:E,columnIndices:U};return e("div",m({className:"st-table-body-container",ref:W,onScroll:function(e){var n=e.currentTarget.scrollTop;A.current&&cancelAnimationFrame(A.current),A.current=requestAnimationFrame((function(){M(n)}))}},{children:[p.length>0&&n(Y,m({},q,{onExpandRowClick:K,pinned:"left",sectionRef:T,templateColumns:x,totalHeight:j,width:V})),n(Y,m({},q,{onExpandRowClick:K,sectionRef:N,templateColumns:w,totalHeight:j,width:J})),I.length>0&&n(Y,m({},q,{onExpandRowClick:K,pinned:"right",sectionRef:L,templateColumns:b,totalHeight:j,width:X}))]}))},$=function(e,n){a((function(){if(e.current){var r=e.current,t=function(){var e,t=null==r?void 0:r.scrollLeft;void 0!==t&&(null===(e=n.current)||void 0===e||e.scrollTo(t,0))};return r.addEventListener("scroll",t),function(){null==r||r.removeEventListener("scroll",t)}}}),[e,n])},_={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return _.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?_.string(e,n,r):"number"==typeof e&&"number"==typeof n?_.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?_.boolean(e,n,r):_.string(String(e),String(n),r)}},Q=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return _.number(i,a,t)}return"date"===r?_.date(String(e),String(n),t):"boolean"===r?_.boolean(Boolean(e),Boolean(n),t):"enum"===r?_.enum(String(e),String(n),t):_.string(String(e),String(n),t)},Z=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction,a=new Map,l=new Map,d="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(a.size)).toString();d=t,l.set(d,e),a.has(d)||a.set(d,[])}else if(d){var o=a.get(d)||[];o.push(e),a.set(d,o)}else{var i="default";a.has(i)||a.set(i,[]),null===(r=a.get(i))||void 0===r||r.push(e)}}));var c=[];return a.forEach((function(e,t){if(l.has(t)){var a=l.get(t);a.rowMeta.children&&a.rowMeta.children.length>0&&(a.rowMeta.children=ee(a.rowMeta.children,n,r)),c.push(a)}var d=w([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return Q(a,l,o,i)}));c.push.apply(c,d.map((function(e){var t=m({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var o=ee(t.rowMeta.children,n,r);t.rowMeta=m(m({},t.rowMeta),{children:o})}return t})))})),c},ee=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction;return w([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return Q(a,l,o,i)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?m(m({},e),{rowMeta:m(m({},e.rowMeta),{children:ee(e.rowMeta.children,n,r)})}):e}))},ne=function(e){var n=e.colIndex,r=e.event,t=e.forceUpdate,o=e.header,i=e.headersRef;e.reverse;var a=e.setIsWidthDragging,l=e.startWidth;a(!0),r.preventDefault();var d=r.clientX;if(o){var c=function(e){var r=Math.max(l+(e.clientX-d),40);o&&i.current&&(i.current[n].width=r,t())},s=function(){document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",s),a(!1)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",s)}},re=s((function(r,o){var i=r.colIndex,l=r.gridColumnEnd,d=r.gridColumnStart,c=r.gridRowEnd,s=r.gridRowStart,u=r.header,h=r.reverse,f=r.sort,v=z(),g=v.columnReordering,p=v.columnResizing,C=v.draggedHeaderRef,x=v.forceUpdate,I=v.headersRef,R=v.hoveredHeaderRef,b=v.onColumnOrderChange,y=v.onSort,M=v.onTableHeaderDragEnd,E=v.rowHeight,D=v.selectColumns,H=v.selectableColumns,k=v.setInitialFocusedCell,N=v.setIsWidthDragging,T=v.setSelectedCells,L=v.setSelectedColumns,O=v.sortDownIcon,B=v.sortUpIcon,F=t(!1),A=F[0],j=F[1],U=Boolean(null==u?void 0:u.isSortable),K="st-header-cell ".concat(u===R.current?"st-hovered":""," ").concat(A?"st-dragging":""," ").concat(U?"clickable":""," ").concat(g&&!U?"columnReordering":""," ").concat("right"===(null==u?void 0:u.align)?"right-aligned":"center"===(null==u?void 0:u.align)?"center-aligned":""),V=P({draggedHeaderRef:C,headersRef:I,hoveredHeaderRef:R,onColumnOrderChange:b,onTableHeaderDragEnd:M}),J=V.handleDragStart,X=V.handleDragEnd,q=V.handleDragOver,Y=W(),G=function(e){var n=e.event,r=e.header;if(H){var t=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,i);return n.shiftKey&&D?L((function(e){if(0===e.size)return new Set(t);var n=t[0],r=Array.from(e).sort((function(e,n){return e-n})),o=r[0],i=Math.abs(n-o);r.forEach((function(e){var r=Math.abs(n-e);r<i&&(i=r,o=e)}));var a,l,d,c,s=w(w([],(a=o,l=n,d=Math.min(a,l),c=Math.max(a,l),Array.from({length:c-d+1},(function(e,n){return d+n}))),!0),t,!0);return new Set(w(w([],Array.from(e),!0),s,!0))})):D&&D(t),T(new Set),void k(null)}r.isSortable&&y(i,r.accessor)};if(a((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!u)return null;var $=p&&n("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;Y({callback:ne,callbackProps:{colIndex:i,event:e,forceUpdate:x,header:u,headersRef:I,setIsWidthDragging:N,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),_=f&&f.key.accessor===u.accessor&&e("div",m({className:"st-sort-icon-container",onClick:function(e){return G({event:e,header:u})}},{children:["ascending"===f.direction&&B&&B,"descending"===f.direction&&O&&O]}));return e("div",m({className:K,id:S({accessor:u.accessor,rowIndex:0}),onDragOver:function(e){Y({callback:q,callbackProps:{event:e,hoveredHeader:u},limit:50})},ref:o,style:m(m({gridRowStart:s,gridRowEnd:c,gridColumnStart:d,gridColumnEnd:l},l-d>1?{}:{width:u.width}),c-s>1?{}:{height:E})},{children:[h&&$,e("div",m({className:"st-header-label ".concat("right"===u.align?"right-aligned":"center"===u.align?"center-aligned":""),draggable:g,onClick:function(e){return G({event:e,header:u})},onDragEnd:function(e){e.preventDefault(),j(!1),X()},onDragStart:function(e){g&&u&&function(e){j(!0),J(e)}(u)}},{children:["right"===u.align&&_,null==u?void 0:u.label,"right"!==u.align&&_]})),!h&&$]}))})),te=function(r){var t=r.depth,o=r.header,i=r.hiddenColumns,a=r.maxDepth,l=r.pinned,d=r.gridPosition,c=r.reverse,s=r.sort;if(!D({hiddenColumns:i,header:o,pinned:l}))return null;var u=d.gridColumnStart,v=d.gridColumnEnd,g=d.gridRowStart,m=d.gridRowEnd,w=d.colIndex;if(o.children){var p=o.children.filter((function(e){return D({hiddenColumns:i,header:e,pinned:l})}));return e(h,{children:[n(re,{colIndex:w,gridColumnEnd:v,gridColumnStart:u,gridRowEnd:m,gridRowStart:g,header:o,ref:f(),reverse:c,sort:s}),p.map((function(e,r){var o,u=null===(o=d.children)||void 0===o?void 0:o[e.accessor];return u?n(te,{depth:t+1,gridPosition:u,header:e,hiddenColumns:i,maxDepth:a,pinned:l,reverse:c,sort:s},e.accessor):null}))]})}return n(re,{colIndex:w,gridColumnEnd:v,gridColumnStart:u,gridRowEnd:m,gridRowStart:g,header:o,ref:f(),reverse:c,sort:s})},oe=function(e){var r=e.gridTemplateColumns,t=e.handleScroll,o=e.headersRef,i=e.hiddenColumns,a=e.maxDepth,d=e.pinned,c=e.sectionRef,s=e.sort,u=o.current.filter((function(e){return D({hiddenColumns:i,header:e,pinned:d})})),h=l((function(){var e,n,r;return e={},n=1,r=function(t,o,l){var c,s;void 0===l&&(l=!1),l||n++;var u=n,h=null!==(s=null===(c=t.children)||void 0===c?void 0:c.filter((function(e){return D({hiddenColumns:i,header:e,pinned:d})})).length)&&void 0!==s?s:0,f={gridColumnStart:u,gridColumnEnd:h>0?u+h:u+1,gridRowStart:o,gridRowEnd:h>0?o+1:a+1,colIndex:u,children:{}};return t.children&&t.children.length>0&&t.children.filter((function(e){return D({hiddenColumns:i,header:e,pinned:d})})).forEach((function(e,n){f.children[e.accessor]=r(e,o+1,0===n)})),e[t.accessor]=f,f},u.forEach((function(e,n){r(e,1,0===n)})),e}),[u,i,a,d]);return n("div",m({className:"st-header-".concat(d?"pinned-".concat(d):"main")},t&&{onScroll:t},{ref:c,style:{gridTemplateColumns:r}},{children:n(U,m({rowIndex:0},{children:u.map((function(e){var r=h[e.accessor];return r?n(te,{depth:1,gridPosition:r,header:e,hiddenColumns:i,maxDepth:a,pinned:d,reverse:"right"===d,sort:s},e.accessor):null}))}))}))},ie=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(ie)):1},ae=function(r){var t=r.centerHeaderRef,o=r.headerContainerRef,i=r.headersRef,a=r.hiddenColumns,d=r.mainTemplateColumns,c=r.pinnedLeftColumns,s=r.pinnedLeftHeaderRef,u=r.pinnedLeftTemplateColumns,h=r.pinnedRightColumns,f=r.pinnedRightHeaderRef,v=r.pinnedRightTemplateColumns,g=r.sort,w=z().mainBodyRef;$(w,t);var p=l((function(){var e=i.current,n=0;return e.forEach((function(e){if(D({hiddenColumns:a,header:e})){var r=ie(e);n=Math.max(n,r)}})),{maxDepth:n}}),[i,a]).maxDepth;return e("div",m({className:"st-header-container",ref:o},{children:[c.length>0&&n(oe,{gridTemplateColumns:u,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:p,pinned:"left",sectionRef:s,sort:g}),n(oe,{gridTemplateColumns:d,handleScroll:function(e){var n,r,o=null===(n=t.current)||void 0===n?void 0:n.scrollLeft;void 0!==o&&(null===(r=w.current)||void 0===r||r.scrollTo(o,0))},headersRef:i,hiddenColumns:a,maxDepth:p,sectionRef:t,sort:g}),h.length>0&&n(oe,{gridTemplateColumns:v,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:p,pinned:"right",sectionRef:f,sort:g})]}))},le=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"minmax(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},de=function(r){var t=r.flattenedRows,i=r.isWidthDragging,a=r.setFlattenedRows,d=r.setScrollTop,c=r.sort,s=r.visibleRows,u=z(),h=u.editColumns,f=u.headersRef,v=u.hiddenColumns,g=o(null),w=o(null),p=o(null),C=o(null),x=f.current.filter((function(e){return!e.pinned})),I=f.current.filter((function(e){return"left"===e.pinned})),R=f.current.filter((function(e){return"right"===e.pinned})),b=l((function(){return le({headers:I,hiddenColumns:v})}),[I,v]),y=l((function(){return le({headers:x,hiddenColumns:v})}),[x,v]),M=l((function(){return le({headers:R,hiddenColumns:v})}),[R,v]),E={centerHeaderRef:p,flattenedRows:t,headerContainerRef:g,isWidthDragging:i,mainTemplateColumns:y,pinnedLeftColumns:I,pinnedLeftHeaderRef:w,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:M,setFlattenedRows:a,setScrollTop:d,visibleRows:s};return e("div",m({className:"st-table-content",style:{width:h?"calc(100% - 27.5px)":"100%"}},{children:[n(ae,m({},{centerHeaderRef:p,headerContainerRef:g,headersRef:f,hiddenColumns:v,mainTemplateColumns:y,pinnedLeftColumns:I,pinnedLeftHeaderRef:w,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:M,sort:c})),n(G,m({},E))]}))},ce=function(e){var n=e.callback,r=e.ref,t=e.widthAttribute;a((function(){var e=r.current;if(e){var o=function(){n(e[t]||0)};o();var i=new ResizeObserver((function(){o()}));return i.observe(e),function(){return i.disconnect()}}}),[n,r,t])},se=function(r){var i=r.mainBodyRef,a=r.pinnedLeftRef,l=r.pinnedRightRef,d=r.tableContentWidth,c=t(0),s=c[0],u=c[1],h=t(0),f=h[0],v=h[1],g=t(0),w=g[0],p=g[1],C=o(null);return ce({widthAttribute:"offsetWidth",callback:u,ref:a}),ce({widthAttribute:"scrollWidth",callback:p,ref:i}),ce({widthAttribute:"offsetWidth",callback:v,ref:l}),$(i,C),!i.current||i.current.scrollWidth<=i.current.clientWidth?null:e("div",m({className:"st-horizontal-scrollbar-container",style:{width:d}},{children:[s>0&&n("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:s}}),w>0&&n("div",m({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&i.current&&i.current.scrollTo({left:n,behavior:"auto"})},ref:C},{children:n("div",{style:{width:w}})})),f>0&&n("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:f}})]}))},ue=function(e){var n=e.headers,r=e.tableRows,o=t(null),i=o[0],a=o[1],d=l((function(){var e={};return n.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[n]),c=t(d),s=c[0],u=c[1],h=l((function(){if(!i)return r;var e=function(e,n,r){return{sortedData:Z(n,r,e),newSortConfig:r}}(n,r,i).sortedData;return e}),[r,i,n]);return{sort:i,setSort:a,updateSort:function(e,r){var t=n.find((function(e){return e.accessor===r}));t&&a((function(e){return e&&e.key.accessor===r?"ascending"===e.direction?{key:t,direction:"descending"}:null:{key:t,direction:"ascending"}}))},sortedRows:h,hiddenColumns:s,setHiddenColumns:u}},he=function(r){var o=r.checked,i=void 0!==o&&o,a=r.children,l=r.onChange,d=t(i),c=d[0],s=d[1];return e("label",m({className:"st-checkbox-label"},{children:[n("input",{checked:c,className:"st-checkbox-input",onChange:function(){var e=!c;s(e),l&&l(e)},type:"checkbox"}),n("span",m({className:"st-checkbox-custom ".concat(c?"st-checked":"")},{children:c&&n("span",{className:"st-checkbox-checkmark"})})),a]}))},fe=function(e){var r=e.headers,t=e.open,o=e.position;e.setOpen;var i=e.setHiddenColumns,a=e.hiddenColumns,l="left"===o?"left":"";return n("div",m({className:"st-column-editor-popout ".concat(t?"open":""," ").concat(l),onClick:function(e){return e.stopPropagation()}},{children:n("div",m({className:"st-column-editor-popout-content"},{children:r.map((function(e,r){return n(he,m({checked:a[e.accessor],onChange:function(n){var r;return i(m(m({},a),((r={})[e.accessor]=n,r)))}},{children:e.label}),r)}))}))}))},ve=function(r){var o=r.columnEditorText,i=r.editColumns,a=r.editColumnsInitOpen,l=r.headers,d=r.position,c=void 0===d?"right":d,s=r.setHiddenColumns,u=r.hiddenColumns,h=t(a),f=h[0],v=h[1];return i?e("div",m({className:"st-column-editor ".concat(f?"open":""," ").concat(c),onClick:function(){return function(e){v(e)}(!f)}},{children:[n("div",m({className:"st-column-editor-text"},{children:o})),n(fe,{headers:l,open:f,position:c,setOpen:v,setHiddenColumns:s,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(p||(p={}));var ge=v((function(r){var d=r.allowAnimations,c=void 0!==d&&d,s=r.columnEditorPosition,h=void 0===s?p.Right:s,f=r.columnEditorText,v=void 0===f?"Columns":f,w=r.columnResizing,M=void 0!==w&&w,E=r.defaultHeaders,S=r.editColumns,D=void 0!==S&&S,H=r.editColumnsInitOpen,k=void 0!==H&&H,N=r.columnReordering,T=void 0!==N&&N,L=r.height,W=r.hideFooter,O=void 0!==W&&W,B=r.nextIcon,P=void 0===B?n(R,{className:"st-next-prev-icon"}):B,F=r.onCellEdit,z=r.onColumnOrderChange,j=r.onNextPage,U=r.onPreviousPage,K=r.prevIcon,V=void 0===K?n(I,{className:"st-next-prev-icon"}):K,J=r.rowHeight,X=void 0===J?40:J,q=r.rows,Y=r.rowsPerPage,G=void 0===Y?10:Y,$=r.selectableCells,_=void 0!==$&&$,Q=r.selectableColumns,Z=void 0!==Q&&Q,ee=r.shouldPaginate,ne=void 0!==ee&&ee,re=r.sortDownIcon,te=void 0===re?n(y,{className:"st-sort-icon"}):re,oe=r.sortUpIcon,ie=void 0===oe?n(b,{className:"st-sort-icon"}):oe,ae=r.theme,le=void 0===ae?"light":ae,ce=r.totalPages,he=o(null),fe=o(E),ge=o(null),me=o(null),we=o(null),pe=o(null),Ce=o(null),xe=t(!1),Ie=xe[0],Re=xe[1],be=t(1),ye=be[0],Me=be[1],Ee=t(0),Se=Ee[0],De=Ee[1],He=t(0),ke=He[0],Ne=He[1],Te=t(0),Le=Te[0],We=Te[1],Oe=ue({headers:fe.current,tableRows:q}),Be=Oe.sort,Pe=Oe.sortedRows,Fe=Oe.hiddenColumns,Ae=Oe.setHiddenColumns,ze=Oe.updateSort,je=l((function(){if(!ne)return Pe;var e=(ye-1)*G,n=e+G;return Pe.slice(e,n)}),[ye,G,ne,Pe]),Ue=t(je),Ke=Ue[0],Ve=Ue[1];a((function(){Ve(je)}),[je]);var Je=l((function(){var e;if(!L)return window.innerHeight-X;var n=document.querySelector(".simple-table-root"),r=0;if(L.endsWith("px"))r=parseInt(L,10);else if(L.endsWith("vh")){var t=parseInt(L,10);r=window.innerHeight*t/100}else if(L.endsWith("%")){var o=parseInt(L,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-X)}),[L,X]),Xe=l((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,d=Math.max(0,i-o*n),c=i+r+o*n,s=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],h=l*o;if(h>=c)break;h+o>d&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&s(u.rowMeta.children,n+1)}};return s(t,0),a}({bufferRowCount:5,contentHeight:Je,flattenedRows:Ke,rowHeight:X,scrollTop:Le})}),[Je,X,Ke,Le]),qe=g((function(e){return e+1}),0)[1],Ye=function(e){var n=e.selectableCells,r=e.headers,d=e.visibleRows,c=t(new Set),s=c[0],u=c[1],h=t(new Set),f=h[0],v=h[1],g=t(null),m=g[0],w=g[1],p=t(null),x=p[0],I=p[1],R=o(!1),b=o(null),y=i((function(){var e=Array.from(s).reduce((function(e,n){var t=n.split("-").map(Number),o=t[0],i=t[1];return e[o]||(e[o]=[]),e[o][i]=d[o].row.rowData[r[i].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");s.size>0&&navigator.clipboard.writeText(n)}),[r,s,d]),M=i((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),o=Math.max(e.rowIndex,n.rowIndex),i=Math.min(e.colIndex,n.colIndex),a=Math.max(e.colIndex,n.colIndex),l=t;l<=o;l++)for(var c=i;c<=a;c++)if(l>=0&&l<d.length){var s=d[l].row.rowMeta.rowId;r.add(C({colIndex:c,rowIndex:l,rowId:s}))}v(new Set),w(null),u(r)}),[d,v,w,u]),E=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<r.length){var n=C(e);v(new Set),w(null),u(new Set([n])),I(e)}}),[r.length,d.length,v,w,u,I]),S=i((function(e,n){void 0===n&&(n=!1),u(new Set),I(null),v((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&w(e[e.length-1])}),[u,I,v,w]);a((function(){var e=function(e){if(n&&x){var t=x.rowIndex,o=x.colIndex,i=x.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(d[t].row.rowMeta.rowId!==i){var a=d.findIndex((function(e){return e.row.rowMeta.rowId===i}));if(-1===a)return;t=a}if("ArrowUp"===e.key){if(e.preventDefault(),t>0){var l={rowIndex:t-1,colIndex:o,rowId:d[t-1].row.rowMeta.rowId};E(l)}}else"ArrowDown"===e.key?(e.preventDefault(),t<d.length-1&&(l={rowIndex:t+1,colIndex:o,rowId:d[t+1].row.rowMeta.rowId},E(l))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(l={rowIndex:t,colIndex:o-1,rowId:d[t].row.rowMeta.rowId},E(l))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<r.length-1&&(l={rowIndex:t,colIndex:o+1,rowId:d[t].row.rowMeta.rowId},E(l))):"Escape"===e.key&&(u(new Set),v(new Set),w(null),b.current=null,I(null))}else y()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[y,r.length,x,M,E,n,d]),console.log(s);var D=i((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=C({colIndex:n,rowIndex:r,rowId:t}),i=s.has(o),a=f.has(n);return i||a}),[s,f]),H=i((function(e){var n,r,t,o,i,a,l=e.colIndex,c=e.rowIndex,s=e.rowId,u=[],h=null===(t=null===(r=null===(n=d[c-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:l,rowIndex:c+1,rowId:null===(a=null===(i=null===(o=d[c+1])||void 0===o?void 0:o.row)||void 0===i?void 0:i.rowMeta)||void 0===a?void 0:a.rowId},g={colIndex:l-1,rowIndex:c,rowId:s},m={colIndex:l+1,rowIndex:c,rowId:s};return(!D({colIndex:l,rowIndex:c-1,rowId:h})||f.has(l)&&0===c)&&u.push("st-selected-top-border"),(!D(v)||f.has(l)&&c===d.length-1)&&u.push("st-selected-bottom-border"),D(g)||u.push("st-selected-left-border"),D(m)||u.push("st-selected-right-border"),u.join(" ")}),[D,d,f]),k=l((function(){return x?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===x.rowIndex&&r===x.colIndex&&t===x.rowId}:function(){return!1}}),[x]);return{getBorderClass:H,handleMouseDown:function(e){var r=e.colIndex,t=e.rowIndex,o=e.rowId;if(n){R.current=!0,b.current={rowIndex:t,colIndex:r,rowId:o},v(new Set),w(null);var i=C({colIndex:r,rowIndex:t,rowId:o});u(new Set([i])),I({rowIndex:t,colIndex:r,rowId:o})}},handleMouseOver:function(e){var r=e.colIndex,t=e.rowIndex;if(e.rowId,n&&R.current&&b.current){for(var o=new Set,i=Math.min(b.current.rowIndex,t),a=Math.max(b.current.rowIndex,t),l=Math.min(b.current.colIndex,r),c=Math.max(b.current.colIndex,r),s=i;s<=a;s++)for(var h=l;h<=c;h++)if(s>=0&&s<d.length){var f=d[s].row.rowMeta.rowId;o.add(C({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){R.current=!1},isInitialFocusedCell:k,isSelected:D,lastSelectedColumnIndex:m,selectColumns:S,selectedCells:s,selectedColumns:f,setInitialFocusedCell:I,setSelectedCells:u,setSelectedColumns:v}}({selectableCells:_,headers:fe.current,visibleRows:Xe}),Ge=Ye.handleMouseDown,$e=Ye.handleMouseOver,_e=Ye.handleMouseUp,Qe=Ye.isSelected,Ze=Ye.getBorderClass,en=Ye.isInitialFocusedCell,nn=Ye.setSelectedCells,rn=Ye.setSelectedColumns,tn=Ye.selectColumns,on=Ye.setInitialFocusedCell,an=i((function(e,n){ze(e,n)}),[ze]),ln=i((function(e){fe.current=e,qe()}),[]);return a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||Z&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(nn(new Set),Z&&rn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[Z,nn,rn]),u((function(){if(Ce.current){var e=Ce.current.offsetWidth-Ce.current.clientWidth,n=Ce.current.clientWidth;De(e),Ne(n)}}),[]),u((function(){var e=function(){if(qe(),Ce.current){var e=Ce.current.offsetWidth-Ce.current.clientWidth,n=Ce.current.clientWidth;De(e),Ne(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n(A,m({value:{allowAnimations:c,columnReordering:T,columnResizing:M,draggedHeaderRef:he,editColumns:D,forceUpdate:qe,getBorderClass:Ze,handleMouseDown:Ge,handleMouseOver:$e,headersRef:fe,hiddenColumns:Fe,hoveredHeaderRef:ge,isInitialFocusedCell:en,isSelected:Qe,mainBodyRef:me,onCellEdit:F,onColumnOrderChange:z,onSort:an,onTableHeaderDragEnd:ln,pinnedLeftRef:we,pinnedRightRef:pe,rowHeight:X,scrollbarWidth:Se,selectColumns:tn,selectableColumns:Z,setInitialFocusedCell:on,setIsWidthDragging:Re,setSelectedCells:nn,setSelectedColumns:rn,shouldPaginate:ne,sortDownIcon:te,sortUpIcon:ie,tableBodyContainerRef:Ce}},{children:e("div",m({className:"simple-table-root st-wrapper theme-".concat(le),style:L?{height:L}:{}},{children:[e("div",m({className:"st-table-wrapper-container"},{children:[e("div",m({className:"st-table-wrapper",onMouseUp:_e,onMouseLeave:_e},{children:[n(de,{flattenedRows:Ke,isWidthDragging:Ie,setFlattenedRows:Ve,setScrollTop:We,sort:Be,visibleRows:Xe}),n(ve,{columnEditorText:v,editColumns:D,editColumnsInitOpen:k,headers:fe.current,hiddenColumns:Fe,position:h,setHiddenColumns:Ae})]})),n(se,{mainBodyRef:me,pinnedLeftRef:we,pinnedRightRef:pe,tableContentWidth:ke})]})),n(x,{currentPage:ye,hideFooter:O,nextIcon:P,onPageChange:Me,onNextPage:j,onPreviousPage:U,prevIcon:V,shouldPaginate:ne,totalPages:ce||Math.ceil(Pe.length/G)})]}))}))}));export{ge as SimpleTable};
|
|
1
|
+
import{jsxs as e,jsx as n,Fragment as r}from"react/jsx-runtime";import{useState as t,useRef as o,useCallback as i,useEffect as a,useMemo as l,createContext as d,useContext as c,forwardRef as s,useLayoutEffect as u,Fragment as h,createRef as f,memo as v,useReducer as m}from"react";var g=function(){return g=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},g.apply(this,arguments)};function w(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var p=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},C=function(r){var t=r.currentPage,o=r.hideFooter,i=r.nextIcon,a=r.onPageChange,l=r.onNextPage,d=r.onPreviousPage,c=r.prevIcon,s=r.shouldPaginate,u=r.totalPages;if(o||!s)return null;var h=!(t>1)&&!d,f=!(t<u)&&!l;return e("div",g({className:"st-footer"},{children:[n("button",g({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),d&&d(e-1)},disabled:h},{children:c})),n("button",g({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:f},{children:i})),Array.from({length:u},(function(e,r){return n("button",g({onClick:function(){var e;(e=r+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&d&&d(e-1))},className:"st-page-btn ".concat(t===r+1?"active":"")},{children:r+1}),r)}))]}))},I=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},x=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},R=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},b=function(e){var r=e.className;return n("svg",g({className:r,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},y=function(e){return e.position*(e.rowHeight+1)-1},E=function(e){return e.position*(e.rowHeight+1)},M=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},S=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},D=function(r){var t=r.value,o=r.onBlur,i=r.onChange;return e("select",g({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[n("option",g({value:"true"},{children:"True"})),n("option",g({value:"false"},{children:"False"}))]}))},H=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=r?r:"",onBlur:t,onChange:function(e){var n=e.target.value;i(n)}})},k=function(e){var r=e.defaultValue,t=e.onBlur,i=e.onChange,a=o(null);return n("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:r.toString(),onBlur:t,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},N=function(e){var t=e.onChange,o=e.setIsEditing,i=e.value,a=function(e){null==t||t(e)},l=function(){o(!1)};return n(r,{children:"string"==typeof i||null==i?n(H,{defaultValue:i,onBlur:l,onChange:a}):"boolean"==typeof i?n(D,{onBlur:l,onChange:a,value:i}):"number"==typeof i?n(k,{defaultValue:i,onBlur:l,onChange:a}):null})},L=0,T=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===L||o-L>=t)&&(L=o,n(r))}},W=Date.now(),O={screenX:0,screenY:0},B=function(e){var n,r,t=e.draggedHeaderRef,i=e.headersRef,l=e.hoveredHeaderRef,d=e.onColumnOrderChange,c=e.onTableHeaderDragEnd,s=(n=i.current,r=o(n),a((function(){r.current=n}),[n]),r.current);return{handleDragStart:function(e){t.current=e,W=Date.now()},handleDragOver:function(e){var n,r=e.event,o=e.hoveredHeader;if(r.preventDefault(),i.current){var a=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),d=r.screenX,u=r.screenY,h=Math.sqrt(Math.pow(d-O.screenX,2)+Math.pow(u-O.screenY,2));l.current=o;var f=w([],i.current,!0),v=f.findIndex((function(e){var n;return e.accessor===(null===(n=t.current)||void 0===n?void 0:n.accessor)})),m=f.findIndex((function(e){return e.accessor===o.accessor})),g=f.splice(v,1)[0];if(f.splice(m,0,g),!(a||o.accessor===(null===(n=t.current)||void 0===n?void 0:n.accessor)||null===t.current||h<10||void 0===v||void 0===m||JSON.stringify(f)===JSON.stringify(i.current))){var p=Date.now();JSON.stringify(f)===JSON.stringify(s)&&p-W<800&&h<50||(W=p,O={screenX:d,screenY:u},c(f))}}},handleDragEnd:function(){t.current=null,l.current=null,null==d||d(i.current)}}},P=d(void 0),F=function(e){var r=e.children,t=e.value;return n(P.Provider,g({value:t},{children:r}))},A=function(){var e=c(P);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},z=s((function(r,o){var i,l,d=r.borderClass,c=r.colIndex,s=r.header,u=r.isHighlighted,h=r.isInitialFocused,f=r.onExpandRowClick,v=r.rowIndex,m=r.visibleRow,w=A(),p=w.draggedHeaderRef,C=w.headersRef,I=w.hoveredHeaderRef,R=w.onCellEdit,y=w.onTableHeaderDragEnd,E=w.handleMouseDown,S=w.handleMouseOver,D=m.depth,H=m.row,k=t(H.rowData[s.accessor]),L=k[0],W=k[1],O=t(!1),P=O[0],F=O[1],z=B({draggedHeaderRef:p,headersRef:C,hoveredHeaderRef:I,onTableHeaderDragEnd:y}).handleDragOver,j=T(),U="cell-".concat(v,"-").concat(c),K=Boolean(null===(l=null===(i=H.rowMeta)||void 0===i?void 0:i.children)||void 0===l?void 0:l.length),V=Boolean(null==s?void 0:s.isEditable),J=v%2==0,X="st-cell ".concat(D>0&&s.expandable?"st-cell-depth-".concat(D):""," ").concat(u?h?"st-cell-selected-first ".concat(d):"st-cell-selected ".concat(d):""," ").concat(J?"st-cell-odd-row":"st-cell-even-row"," ").concat(V?"clickable":"");a((function(){W(H.rowData[s.accessor])}),[s.accessor,H]);return P?n("div",g({className:"st-cell-editing ".concat(J?"st-cell-odd-row":"st-cell-even-row"),id:M({accessor:s.accessor,rowIndex:v+1})},{children:n(N,{onChange:function(e){W(e),null==R||R({accessor:s.accessor,newValue:e,row:H})},setIsEditing:F,value:L})})):e("div",g({className:X,id:U,onDoubleClick:function(){return s.isEditable&&F(!0)},onMouseDown:function(){return E({rowIndex:v,colIndex:c,rowId:H.rowMeta.rowId})},onMouseOver:function(){return S({rowIndex:v,colIndex:c,rowId:H.rowMeta.rowId})},onDragOver:function(e){return j({callback:z,callbackProps:{event:e,hoveredHeader:s},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!s.isEditable||P||(e.preventDefault(),F(!0))},ref:o,"data-row-index":v,"data-col-index":c,"aria-selected":u},{children:[s.expandable&&K?H.rowMeta.isExpanded?n("div",g({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)}},{children:n(b,{className:"st-sort-icon"})})):n("div",g({className:"st-sort-icon-container",onClick:function(){return f(H.rowMeta.rowId)}},{children:n(x,{className:"st-sort-icon"})})):null,n("span",g({className:"st-cell-content ".concat("right"===s.align?"right-aligned":"center"===s.align?"center-aligned":"")},{children:s.cellRenderer?s.cellRenderer({accessor:s.accessor,colIndex:c,row:H}):L}))]}))})),j=function(e){var t=e.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(e,["children"]);return A().allowAnimations?n(U,g({},o,{children:t})):n(r,{children:t})},U=function(e){var i=e.children,l=e.isBody,d=e.pauseAnimation,c=e.rowIndex,s=o(!1),h=A(),f=h.draggedHeaderRef,v=h.headersRef,m=h.mainBodyRef,g=h.shouldPaginate,w=t({}),p=w[0],C=w[1],I=o({}),x=v.current;return u((function(){if(x){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(M({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:x,draggedHeaderRef:f,rowIndex:c});JSON.stringify(e)!==JSON.stringify(p)&&(I.current=p,C(e))}}),[p,x,f,l,c]),u((function(){var e=m.current,n=function(){s.current=!0},r=function(){s.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[f,m]),a((function(){d||s.current||Object.keys(I.current).length&&x&&x.forEach((function(e){var n=document.getElementById(M({accessor:e.accessor,rowIndex:c}));if(n){var r=I.current[e.accessor],t=p[e.accessor];if(r&&t){var o=r.left-t.left,i=g?0:r.top-t.top,a=Math.abs(o),l=Math.abs(i);(a>10||l>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[p,x,l,d,I,c,g]),n(r,{children:i})},K=function(e){var r=e.columnIndices,t=e.headers,o=e.hiddenColumns,i=e.isWidthDragging,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.rowIndices,s=e.visibleRow,u=t.filter((function(e){return S({hiddenColumns:o,header:e,pinned:l})}));return n(j,g({isBody:!0,pauseAnimation:i,rowIndex:d+1},{children:u.map((function(e){return n(V,{columnIndices:r,header:e,headers:t,hiddenColumns:o,onExpandRowClick:a,pinned:l,rowIndex:d,rowIndices:c,visibleRow:s},M({accessor:e.accessor,rowIndex:d+1}))}))}))},V=function(e){var r=e.columnIndices,t=e.header,o=e.headers,i=e.hiddenColumns,a=e.onExpandRowClick,l=e.pinned,d=e.rowIndex,c=e.rowIndices,s=e.visibleRow,u=r[t.accessor],f=A(),v=f.getBorderClass,m=f.isSelected,g=f.isInitialFocusedCell;if(t.children){var w=t.children.filter((function(e){return S({hiddenColumns:i,header:e,pinned:l})}));return n(h,{children:w.map((function(e){return n(V,{columnIndices:r,header:e,headers:o,hiddenColumns:i,onExpandRowClick:a,pinned:l,rowIndex:d,rowIndices:c,visibleRow:s},M({accessor:e.accessor,rowIndex:d+1}))}))})}var p={rowIndex:d,colIndex:u,rowId:s.row.rowMeta.rowId},C=v(p),I=m(p),x=g(p);return n(z,{borderClass:C,colIndex:u,header:t,isHighlighted:I,isInitialFocused:x,onExpandRowClick:a,rowIndex:d,visibleRow:s},M({accessor:t.accessor,rowIndex:d+1}))},J=function(e){var r=e.columnIndices,t=e.gridTemplateColumns,o=e.headers,i=e.hiddenColumns,a=e.index,l=e.isWidthDragging,d=e.onExpandRowClick,c=e.pinned,s=e.rowHeight,u=e.rowIndices,h=e.visibleRow,f=h.position,v=a;return n("div",g({className:"st-table-row",style:{gridTemplateColumns:t,top:E({position:f,rowHeight:s}),height:"".concat(s,"px")}},{children:n(K,{columnIndices:r,headers:o,hiddenColumns:i,isWidthDragging:l,onExpandRowClick:d,pinned:c,rowIndex:v,rowIndices:u,visibleRow:h},a)}))},X=function(e){var r=e.lastGroupRow,t=e.position,o=e.rowHeight,i=e.templateColumns;return n("div",g({className:"st-row-separator ".concat(r?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:i,position:"absolute",top:y({position:t,rowHeight:o}),minWidth:"100%"}},{children:n("div",{style:{gridColumn:"1 / -1"}})}))},q=function(r){var t=r.columnIndices;r.headerContainerRef;var o=r.headers,i=r.hiddenColumns,a=r.isWidthDragging,l=r.onExpandRowClick,d=r.pinned,c=r.rowHeight,s=r.rowIndices,u=r.sectionRef,f=r.templateColumns,v=r.totalHeight,m=r.visibleRows,w=r.width,p=d?"st-table-body-pinned-".concat(d):"st-table-body-main";return n("div",g({className:p,ref:u,style:{position:"relative",height:"".concat(v,"px"),width:w}},{children:m.map((function(r,u){var v,m,g=Boolean(null===(m=null===(v=r.row.rowMeta)||void 0===v?void 0:v.children)||void 0===m?void 0:m.length);return e(h,{children:[n(J,{columnIndices:t,gridTemplateColumns:f,headers:o,hiddenColumns:i,index:u,isWidthDragging:a,onExpandRowClick:l,pinned:d,rowHeight:c,rowIndices:s,visibleRow:r}),0!==u&&n(X,{lastGroupRow:g,position:r.position,rowHeight:c,templateColumns:f})]},u)}))}))};function Y(e){var n=e.headersRef,r=e.hiddenColumns,t=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,l=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return S({hiddenColumns:r,header:e})})).forEach((function(e,n){l(e,0===n)}))};return t.forEach((function(e,n){l(e,0===n)})),n.current.filter((function(e){return!e.pinned&&S({hiddenColumns:r,header:e})})).forEach((function(e,n){var r=0===n&&0===t.length;l(e,r)})),o.forEach((function(e){l(e,!1)})),i}var G,$=function(r){var i,d,c,s,u,h=r.centerHeaderRef,f=r.flattenedRows,v=r.headerContainerRef,m=r.isWidthDragging,w=r.mainTemplateColumns,p=r.pinnedLeftColumns,C=r.pinnedLeftHeaderRef,I=r.pinnedLeftTemplateColumns,x=r.pinnedRightColumns,R=r.pinnedRightHeaderRef,b=r.pinnedRightTemplateColumns,y=r.setFlattenedRows,E=r.setScrollTop,M=r.visibleRows,S=A(),D=S.rowHeight,H=S.scrollbarWidth,k=S.mainBodyRef,N=S.pinnedLeftRef,L=S.pinnedRightRef,T=S.tableBodyContainerRef,W=S.hiddenColumns,O=S.headersRef;!function(e){var n=e.headerContainerRef,r=e.mainSectionRef,o=e.scrollbarWidth,i=t(!1),l=i[0],d=i[1];a((function(){var e=null==n?void 0:n.current;if(l&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[n,l,o]),a((function(){var e=null==n?void 0:n.current,t=null==r?void 0:r.current;if(t&&e){var o=function(){if(t){var e=t.scrollHeight>t.clientHeight;d(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(t),function(){t&&i.unobserve(t)}}}),[n,r])}({headerContainerRef:v,mainSectionRef:T,scrollbarWidth:H});var B,P,F=o(null),z=(B=0,(P=function(e){e.forEach((function(e){B+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&P(e.rowMeta.children)}))})(f),B)*(D+1)-1,j=l((function(){return Y({headersRef:O,hiddenColumns:W,pinnedLeftColumns:p,pinnedRightColumns:x})}),[O,W,p,x]),U=l((function(){var e={};return M.forEach((function(n,r){var t=String(n.row.rowMeta.rowId);e[t]=r})),e}),[M]),K=function(e){var n=function(r){return r.rowMeta.rowId===e&&r.rowMeta.children?g(g({},r),{rowMeta:g(g({},r.rowMeta),{isExpanded:!r.rowMeta.isExpanded})}):r.rowMeta.children?g(g({},r),{rowMeta:g(g({},r.rowMeta),{children:r.rowMeta.children.map(n)})}):r};y((function(e){return e.map(n)}))},V=(null===(i=C.current)||void 0===i?void 0:i.clientWidth)?(null===(d=C.current)||void 0===d?void 0:d.clientWidth)+1:0,J=null===(c=h.current)||void 0===c?void 0:c.clientWidth,X=(null===(s=R.current)||void 0===s?void 0:s.clientWidth)?(null===(u=R.current)||void 0===u?void 0:u.clientWidth)+1:0,G={headerContainerRef:v,headers:O.current,hiddenColumns:W,isWidthDragging:m,rowHeight:D,visibleRows:M,columnIndices:j,rowIndices:U};return e("div",g({className:"st-table-body-container",ref:T,onScroll:function(e){var n=e.currentTarget.scrollTop;F.current&&cancelAnimationFrame(F.current),F.current=requestAnimationFrame((function(){E(n)}))}},{children:[p.length>0&&n(q,g({},G,{onExpandRowClick:K,pinned:"left",sectionRef:N,templateColumns:I,totalHeight:z,width:V})),n(q,g({},G,{onExpandRowClick:K,sectionRef:k,templateColumns:w,totalHeight:z,width:J})),x.length>0&&n(q,g({},G,{onExpandRowClick:K,pinned:"right",sectionRef:L,templateColumns:b,totalHeight:z,width:X}))]}))},_=function(e,n){a((function(){if(e.current){var r=e.current,t=function(){var e,t=null==r?void 0:r.scrollLeft;void 0!==t&&(null===(e=n.current)||void 0===e||e.scrollTo(t,0))};return r.addEventListener("scroll",t),function(){null==r||r.removeEventListener("scroll",t)}}}),[e,n])},Q={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return Q.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?Q.string(e,n,r):"number"==typeof e&&"number"==typeof n?Q.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?Q.boolean(e,n,r):Q.string(String(e),String(n),r)}},Z=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return Q.number(i,a,t)}return"date"===r?Q.date(String(e),String(n),t):"boolean"===r?Q.boolean(Boolean(e),Boolean(n),t):"enum"===r?Q.enum(String(e),String(n),t):Q.string(String(e),String(n),t)},ee=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction,a=new Map,l=new Map,d="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(a.size)).toString();d=t,l.set(d,e),a.has(d)||a.set(d,[])}else if(d){var o=a.get(d)||[];o.push(e),a.set(d,o)}else{var i="default";a.has(i)||a.set(i,[]),null===(r=a.get(i))||void 0===r||r.push(e)}}));var c=[];return a.forEach((function(e,t){if(l.has(t)){var a=l.get(t);a.rowMeta.children&&a.rowMeta.children.length>0&&(a.rowMeta.children=ne(a.rowMeta.children,n,r)),c.push(a)}var d=w([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return Z(a,l,o,i)}));c.push.apply(c,d.map((function(e){var t=g({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var o=ne(t.rowMeta.children,n,r);t.rowMeta=g(g({},t.rowMeta),{children:o})}return t})))})),c},ne=function(e,n,r){var t=r.find((function(e){return e.accessor===n.key.accessor})),o=(null==t?void 0:t.type)||"string",i=n.direction;return w([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,a=e.rowData[t],l=r.rowData[t];return Z(a,l,o,i)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?g(g({},e),{rowMeta:g(g({},e.rowMeta),{children:ne(e.rowMeta.children,n,r)})}):e}))},re=function(e){var n=e.colIndex,r=e.event,t=e.forceUpdate,o=e.header,i=e.headersRef;e.reverse;var a=e.setIsWidthDragging,l=e.startWidth;a(!0),r.preventDefault();var d=r.clientX;if(o){var c=function(e){var r=Math.max(l+(e.clientX-d),40);o&&i.current&&(i.current[n].width=r,t())},s=function(){document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",s),a(!1)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",s)}},te=s((function(r,o){var i=r.colIndex,l=r.gridColumnEnd,d=r.gridColumnStart,c=r.gridRowEnd,s=r.gridRowStart,u=r.header,h=r.reverse,f=r.sort,v=A(),m=v.columnReordering,p=v.columnResizing,C=v.draggedHeaderRef,I=v.forceUpdate,x=v.headersRef,R=v.hoveredHeaderRef,b=v.onColumnOrderChange,y=v.onSort,E=v.onTableHeaderDragEnd,S=v.rowHeight,D=v.selectColumns,H=v.selectableColumns,k=v.setInitialFocusedCell,N=v.setIsWidthDragging,L=v.setSelectedCells,W=v.setSelectedColumns,O=v.sortDownIcon,P=v.sortUpIcon,F=t(!1),z=F[0],j=F[1],U=Boolean(null==u?void 0:u.isSortable),K="st-header-cell ".concat(u===R.current?"st-hovered":""," ").concat(z?"st-dragging":""," ").concat(U?"clickable":""," ").concat(m&&!U?"columnReordering":""," ").concat("right"===(null==u?void 0:u.align)?"right-aligned":"center"===(null==u?void 0:u.align)?"center-aligned":""),V=B({draggedHeaderRef:C,headersRef:x,hoveredHeaderRef:R,onColumnOrderChange:b,onTableHeaderDragEnd:E}),J=V.handleDragStart,X=V.handleDragEnd,q=V.handleDragOver,Y=T(),G=function(e){var n=e.event,r=e.header;if(H){var t=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,i);return n.shiftKey&&D?W((function(e){if(0===e.size)return new Set(t);var n=t[0],r=Array.from(e).sort((function(e,n){return e-n})),o=r[0],i=Math.abs(n-o);r.forEach((function(e){var r=Math.abs(n-e);r<i&&(i=r,o=e)}));var a,l,d,c,s=w(w([],(a=o,l=n,d=Math.min(a,l),c=Math.max(a,l),Array.from({length:c-d+1},(function(e,n){return d+n}))),!0),t,!0);return new Set(w(w([],Array.from(e),!0),s,!0))})):D&&D(t),L(new Set),void k(null)}r.isSortable&&y(i,r.accessor)};if(a((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!u)return null;var $=p&&n("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;Y({callback:re,callbackProps:{colIndex:i,event:e,forceUpdate:I,header:u,headersRef:x,setIsWidthDragging:N,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),_=f&&f.key.accessor===u.accessor&&e("div",g({className:"st-sort-icon-container",onClick:function(e){return G({event:e,header:u})}},{children:["ascending"===f.direction&&P&&P,"descending"===f.direction&&O&&O]}));return e("div",g({className:K,id:M({accessor:u.accessor,rowIndex:0}),onDragOver:function(e){Y({callback:q,callbackProps:{event:e,hoveredHeader:u},limit:50})},ref:o,style:g(g({gridRowStart:s,gridRowEnd:c,gridColumnStart:d,gridColumnEnd:l},l-d>1?{}:{width:u.width}),c-s>1?{}:{height:S})},{children:[h&&$,e("div",g({className:"st-header-label ".concat("right"===u.align?"right-aligned":"center"===u.align?"center-aligned":""),draggable:m,onClick:function(e){return G({event:e,header:u})},onDragEnd:function(e){e.preventDefault(),j(!1),X()},onDragStart:function(e){m&&u&&function(e){j(!0),J(e)}(u)}},{children:["right"===u.align&&_,null==u?void 0:u.label,"right"!==u.align&&_]})),!h&&$]}))})),oe=function(r){var t=r.columnIndices,o=r.depth,i=r.header,a=r.hiddenColumns,l=r.maxDepth,d=r.pinned,c=r.gridPosition,s=r.reverse,u=r.sort;if(!S({hiddenColumns:a,header:i,pinned:d}))return null;var v=c.gridColumnStart,m=c.gridColumnEnd,g=c.gridRowStart,w=c.gridRowEnd,p=t[i.accessor];if(i.children){var C=i.children.filter((function(e){return S({hiddenColumns:a,header:e,pinned:d})}));return e(h,{children:[n(te,{colIndex:p,gridColumnEnd:m,gridColumnStart:v,gridRowEnd:w,gridRowStart:g,header:i,ref:f(),reverse:s,sort:u}),C.map((function(e,r){var i,h=null===(i=c.children)||void 0===i?void 0:i[e.accessor];return h?n(oe,{columnIndices:t,depth:o+1,gridPosition:h,header:e,hiddenColumns:a,maxDepth:l,pinned:d,reverse:s,sort:u},e.accessor):null}))]})}return n(te,{colIndex:p,gridColumnEnd:m,gridColumnStart:v,gridRowEnd:w,gridRowStart:g,header:i,ref:f(),reverse:s,sort:u})},ie=function(e){var r=e.columnIndices,t=e.gridTemplateColumns,o=e.handleScroll,i=e.headersRef,a=e.hiddenColumns,d=e.maxDepth,c=e.pinned,s=e.sectionRef,u=e.sort,h=i.current.filter((function(e){return S({hiddenColumns:a,header:e,pinned:c})})),f=l((function(){var e,n,r;return e={},n=1,r=function(t,o,i){var l,s;void 0===i&&(i=!1),i||n++;var u=null!==(s=null===(l=t.children)||void 0===l?void 0:l.filter((function(e){return S({hiddenColumns:a,header:e,pinned:c})})).length)&&void 0!==s?s:0,h={gridColumnStart:n,gridColumnEnd:u>0?n+u:n+1,gridRowStart:o,gridRowEnd:u>0?o+1:d+1,children:{}};return t.children&&t.children.length>0&&t.children.filter((function(e){return S({hiddenColumns:a,header:e,pinned:c})})).forEach((function(e,n){h.children[e.accessor]=r(e,o+1,0===n)})),e[t.accessor]=h,h},h.forEach((function(e,n){r(e,1,0===n)})),e}),[h,a,d,c]);return n("div",g({className:"st-header-".concat(c?"pinned-".concat(c):"main")},o&&{onScroll:o},{ref:s,style:{gridTemplateColumns:t}},{children:n(j,g({rowIndex:0},{children:h.map((function(e){var t=f[e.accessor];return t?n(oe,{columnIndices:r,depth:1,gridPosition:t,header:e,hiddenColumns:a,maxDepth:d,pinned:c,reverse:"right"===c,sort:u},e.accessor):null}))}))}))},ae=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(ae)):1},le=function(r){var t=r.centerHeaderRef,o=r.headerContainerRef,i=r.headersRef,a=r.hiddenColumns,d=r.mainTemplateColumns,c=r.pinnedLeftColumns,s=r.pinnedLeftHeaderRef,u=r.pinnedLeftTemplateColumns,h=r.pinnedRightColumns,f=r.pinnedRightHeaderRef,v=r.pinnedRightTemplateColumns,m=r.sort,w=A().mainBodyRef;_(w,t);var p=l((function(){return Y({headersRef:i,hiddenColumns:a,pinnedLeftColumns:c,pinnedRightColumns:h})}),[i,a,c,h]),C=l((function(){var e=i.current,n=0;return e.forEach((function(e){if(S({hiddenColumns:a,header:e})){var r=ae(e);n=Math.max(n,r)}})),{maxDepth:n}}),[i,a]).maxDepth;return e("div",g({className:"st-header-container",ref:o},{children:[c.length>0&&n(ie,{columnIndices:p,gridTemplateColumns:u,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:C,pinned:"left",sectionRef:s,sort:m}),n(ie,{columnIndices:p,gridTemplateColumns:d,handleScroll:function(e){var n,r,o=null===(n=t.current)||void 0===n?void 0:n.scrollLeft;void 0!==o&&(null===(r=w.current)||void 0===r||r.scrollTo(o,0))},headersRef:i,hiddenColumns:a,maxDepth:C,sectionRef:t,sort:m}),h.length>0&&n(ie,{columnIndices:p,gridTemplateColumns:v,handleScroll:void 0,headersRef:i,hiddenColumns:a,maxDepth:C,pinned:"right",sectionRef:f,sort:m})]}))},de=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"minmax(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},ce=function(r){var t=r.flattenedRows,i=r.isWidthDragging,a=r.setFlattenedRows,d=r.setScrollTop,c=r.sort,s=r.visibleRows,u=A(),h=u.editColumns,f=u.headersRef,v=u.hiddenColumns,m=o(null),w=o(null),p=o(null),C=o(null),I=f.current.filter((function(e){return!e.pinned})),x=f.current.filter((function(e){return"left"===e.pinned})),R=f.current.filter((function(e){return"right"===e.pinned})),b=l((function(){return de({headers:x,hiddenColumns:v})}),[x,v]),y=l((function(){return de({headers:I,hiddenColumns:v})}),[I,v]),E=l((function(){return de({headers:R,hiddenColumns:v})}),[R,v]),M={centerHeaderRef:p,flattenedRows:t,headerContainerRef:m,isWidthDragging:i,mainTemplateColumns:y,pinnedLeftColumns:x,pinnedLeftHeaderRef:w,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:E,setFlattenedRows:a,setScrollTop:d,visibleRows:s};return e("div",g({className:"st-table-content",style:{width:h?"calc(100% - 27.5px)":"100%"}},{children:[n(le,g({},{centerHeaderRef:p,headerContainerRef:m,headersRef:f,hiddenColumns:v,mainTemplateColumns:y,pinnedLeftColumns:x,pinnedLeftHeaderRef:w,pinnedLeftTemplateColumns:b,pinnedRightColumns:R,pinnedRightHeaderRef:C,pinnedRightTemplateColumns:E,sort:c})),n($,g({},M))]}))},se=function(e){var n=e.callback,r=e.ref,t=e.widthAttribute;a((function(){var e=r.current;if(e){var o=function(){n(e[t]||0)};o();var i=new ResizeObserver((function(){o()}));return i.observe(e),function(){return i.disconnect()}}}),[n,r,t])},ue=function(r){var i=r.mainBodyRef,a=r.pinnedLeftRef,l=r.pinnedRightRef,d=r.tableContentWidth,c=t(0),s=c[0],u=c[1],h=t(0),f=h[0],v=h[1],m=t(0),w=m[0],p=m[1],C=o(null);return se({widthAttribute:"offsetWidth",callback:u,ref:a}),se({widthAttribute:"scrollWidth",callback:p,ref:i}),se({widthAttribute:"offsetWidth",callback:v,ref:l}),_(i,C),!i.current||i.current.scrollWidth<=i.current.clientWidth?null:e("div",g({className:"st-horizontal-scrollbar-container",style:{width:d}},{children:[s>0&&n("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:s}}),w>0&&n("div",g({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&i.current&&i.current.scrollTo({left:n,behavior:"auto"})},ref:C},{children:n("div",{style:{width:w}})})),f>0&&n("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:f}})]}))},he=function(e){var n=e.headers,r=e.tableRows,o=t(null),i=o[0],a=o[1],d=l((function(){var e={};return n.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[n]),c=t(d),s=c[0],u=c[1],h=l((function(){if(!i)return r;var e=function(e,n,r){return{sortedData:ee(n,r,e),newSortConfig:r}}(n,r,i).sortedData;return e}),[r,i,n]);return{sort:i,setSort:a,updateSort:function(e,r){var t=n.find((function(e){return e.accessor===r}));t&&a((function(e){return e&&e.key.accessor===r?"ascending"===e.direction?{key:t,direction:"descending"}:null:{key:t,direction:"ascending"}}))},sortedRows:h,hiddenColumns:s,setHiddenColumns:u}},fe=function(r){var o=r.checked,i=void 0!==o&&o,a=r.children,l=r.onChange,d=t(i),c=d[0],s=d[1];return e("label",g({className:"st-checkbox-label"},{children:[n("input",{checked:c,className:"st-checkbox-input",onChange:function(){var e=!c;s(e),l&&l(e)},type:"checkbox"}),n("span",g({className:"st-checkbox-custom ".concat(c?"st-checked":"")},{children:c&&n("span",{className:"st-checkbox-checkmark"})})),a]}))},ve=function(e){var r=e.headers,t=e.open,o=e.position;e.setOpen;var i=e.setHiddenColumns,a=e.hiddenColumns,l="left"===o?"left":"";return n("div",g({className:"st-column-editor-popout ".concat(t?"open":""," ").concat(l),onClick:function(e){return e.stopPropagation()}},{children:n("div",g({className:"st-column-editor-popout-content"},{children:r.map((function(e,r){return n(fe,g({checked:a[e.accessor],onChange:function(n){var r;return i(g(g({},a),((r={})[e.accessor]=n,r)))}},{children:e.label}),r)}))}))}))},me=function(r){var o=r.columnEditorText,i=r.editColumns,a=r.editColumnsInitOpen,l=r.headers,d=r.position,c=void 0===d?"right":d,s=r.setHiddenColumns,u=r.hiddenColumns,h=t(a),f=h[0],v=h[1];return i?e("div",g({className:"st-column-editor ".concat(f?"open":""," ").concat(c),onClick:function(){return function(e){v(e)}(!f)}},{children:[n("div",g({className:"st-column-editor-text"},{children:o})),n(ve,{headers:l,open:f,position:c,setOpen:v,setHiddenColumns:s,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(G||(G={}));var ge=v((function(r){var d=r.allowAnimations,c=void 0!==d&&d,s=r.columnEditorPosition,h=void 0===s?G.Right:s,f=r.columnEditorText,v=void 0===f?"Columns":f,w=r.columnResizing,y=void 0!==w&&w,E=r.defaultHeaders,M=r.editColumns,S=void 0!==M&&M,D=r.editColumnsInitOpen,H=void 0!==D&&D,k=r.columnReordering,N=void 0!==k&&k,L=r.height,T=r.hideFooter,W=void 0!==T&&T,O=r.nextIcon,B=void 0===O?n(x,{className:"st-next-prev-icon"}):O,P=r.onCellEdit,A=r.onColumnOrderChange,z=r.onNextPage,j=r.onPreviousPage,U=r.prevIcon,K=void 0===U?n(I,{className:"st-next-prev-icon"}):U,V=r.rowHeight,J=void 0===V?40:V,X=r.rows,q=r.rowsPerPage,Y=void 0===q?10:q,$=r.selectableCells,_=void 0!==$&&$,Q=r.selectableColumns,Z=void 0!==Q&&Q,ee=r.shouldPaginate,ne=void 0!==ee&&ee,re=r.sortDownIcon,te=void 0===re?n(b,{className:"st-sort-icon"}):re,oe=r.sortUpIcon,ie=void 0===oe?n(R,{className:"st-sort-icon"}):oe,ae=r.theme,le=void 0===ae?"light":ae,de=r.totalPages,se=o(null),fe=o(E),ve=o(null),ge=o(null),we=o(null),pe=o(null),Ce=o(null),Ie=t(!1),xe=Ie[0],Re=Ie[1],be=t(1),ye=be[0],Ee=be[1],Me=t(0),Se=Me[0],De=Me[1],He=t(0),ke=He[0],Ne=He[1],Le=t(0),Te=Le[0],We=Le[1],Oe=he({headers:fe.current,tableRows:X}),Be=Oe.sort,Pe=Oe.sortedRows,Fe=Oe.hiddenColumns,Ae=Oe.setHiddenColumns,ze=Oe.updateSort,je=l((function(){if(!ne)return Pe;var e=(ye-1)*Y,n=e+Y;return Pe.slice(e,n)}),[ye,Y,ne,Pe]),Ue=t(je),Ke=Ue[0],Ve=Ue[1];a((function(){Ve(je)}),[je]);var Je=l((function(){var e;if(!L)return window.innerHeight-J;var n=document.querySelector(".simple-table-root"),r=0;if(L.endsWith("px"))r=parseInt(L,10);else if(L.endsWith("vh")){var t=parseInt(L,10);r=window.innerHeight*t/100}else if(L.endsWith("%")){var o=parseInt(L,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-J)}),[L,J]),Xe=l((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,d=Math.max(0,i-o*n),c=i+r+o*n,s=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],h=l*o;if(h>=c)break;h+o>d&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&s(u.rowMeta.children,n+1)}};return s(t,0),a}({bufferRowCount:5,contentHeight:Je,flattenedRows:Ke,rowHeight:J,scrollTop:Te})}),[Je,J,Ke,Te]),qe=m((function(e){return e+1}),0)[1],Ye=function(e){var n=e.selectableCells,r=e.headers,d=e.visibleRows,c=t(new Set),s=c[0],u=c[1],h=t(new Set),f=h[0],v=h[1],m=t(null),g=m[0],w=m[1],C=t(null),I=C[0],x=C[1],R=o(!1),b=o(null),y=i((function(){var e=Array.from(s).reduce((function(e,n){var t=n.split("-").map(Number),o=t[0],i=t[1];return e[o]||(e[o]=[]),e[o][i]=d[o].row.rowData[r[i].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");s.size>0&&navigator.clipboard.writeText(n)}),[r,s,d]),E=i((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),o=Math.max(e.rowIndex,n.rowIndex),i=Math.min(e.colIndex,n.colIndex),a=Math.max(e.colIndex,n.colIndex),l=t;l<=o;l++)for(var c=i;c<=a;c++)if(l>=0&&l<d.length){var s=d[l].row.rowMeta.rowId;r.add(p({colIndex:c,rowIndex:l,rowId:s}))}v(new Set),w(null),u(r)}),[d,v,w,u]),M=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<r.length){var n=p(e);v(new Set),w(null),u(new Set([n])),x(e)}}),[r.length,d.length,v,w,u,x]),S=i((function(e,n){void 0===n&&(n=!1),u(new Set),x(null),v((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&w(e[e.length-1])}),[u,x,v,w]);a((function(){var e=function(e){if(n&&I){var t=I.rowIndex,o=I.colIndex,i=I.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(d[t].row.rowMeta.rowId!==i){var a=d.findIndex((function(e){return e.row.rowMeta.rowId===i}));if(-1===a)return;t=a}if("ArrowUp"===e.key){if(e.preventDefault(),t>0){var l={rowIndex:t-1,colIndex:o,rowId:d[t-1].row.rowMeta.rowId};M(l)}}else"ArrowDown"===e.key?(e.preventDefault(),t<d.length-1&&(l={rowIndex:t+1,colIndex:o,rowId:d[t+1].row.rowMeta.rowId},M(l))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(l={rowIndex:t,colIndex:o-1,rowId:d[t].row.rowMeta.rowId},M(l))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<r.length-1&&(l={rowIndex:t,colIndex:o+1,rowId:d[t].row.rowMeta.rowId},M(l))):"Escape"===e.key&&(u(new Set),v(new Set),w(null),b.current=null,x(null))}else y()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[y,r.length,I,E,M,n,d]);var D=i((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=p({colIndex:n,rowIndex:r,rowId:t}),i=s.has(o),a=f.has(n);return i||a}),[s,f]),H=i((function(e){var n,r,t,o,i,a,l=e.colIndex,c=e.rowIndex,s=e.rowId,u=[],h=null===(t=null===(r=null===(n=d[c-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:l,rowIndex:c+1,rowId:null===(a=null===(i=null===(o=d[c+1])||void 0===o?void 0:o.row)||void 0===i?void 0:i.rowMeta)||void 0===a?void 0:a.rowId},m={colIndex:l-1,rowIndex:c,rowId:s},g={colIndex:l+1,rowIndex:c,rowId:s};return(!D({colIndex:l,rowIndex:c-1,rowId:h})||f.has(l)&&0===c)&&u.push("st-selected-top-border"),(!D(v)||f.has(l)&&c===d.length-1)&&u.push("st-selected-bottom-border"),D(m)||u.push("st-selected-left-border"),D(g)||u.push("st-selected-right-border"),u.join(" ")}),[D,d,f]),k=l((function(){return I?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===I.rowIndex&&r===I.colIndex&&t===I.rowId}:function(){return!1}}),[I]);return{getBorderClass:H,handleMouseDown:function(e){var r=e.colIndex,t=e.rowIndex,o=e.rowId;if(n){R.current=!0,b.current={rowIndex:t,colIndex:r,rowId:o},v(new Set),w(null);var i=p({colIndex:r,rowIndex:t,rowId:o});u(new Set([i])),x({rowIndex:t,colIndex:r,rowId:o})}},handleMouseOver:function(e){var r=e.colIndex,t=e.rowIndex;if(e.rowId,n&&R.current&&b.current){for(var o=new Set,i=Math.min(b.current.rowIndex,t),a=Math.max(b.current.rowIndex,t),l=Math.min(b.current.colIndex,r),c=Math.max(b.current.colIndex,r),s=i;s<=a;s++)for(var h=l;h<=c;h++)if(s>=0&&s<d.length){var f=d[s].row.rowMeta.rowId;o.add(p({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){R.current=!1},isInitialFocusedCell:k,isSelected:D,lastSelectedColumnIndex:g,selectColumns:S,selectedCells:s,selectedColumns:f,setInitialFocusedCell:x,setSelectedCells:u,setSelectedColumns:v}}({selectableCells:_,headers:fe.current,visibleRows:Xe}),Ge=Ye.handleMouseDown,$e=Ye.handleMouseOver,_e=Ye.handleMouseUp,Qe=Ye.isSelected,Ze=Ye.getBorderClass,en=Ye.isInitialFocusedCell,nn=Ye.setSelectedCells,rn=Ye.setSelectedColumns,tn=Ye.selectColumns,on=Ye.setInitialFocusedCell,an=i((function(e,n){ze(e,n)}),[ze]),ln=i((function(e){fe.current=e,qe()}),[]);return a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||Z&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(nn(new Set),Z&&rn(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[Z,nn,rn]),u((function(){if(Ce.current){var e=Ce.current.offsetWidth-Ce.current.clientWidth,n=Ce.current.clientWidth;De(e),Ne(n)}}),[]),u((function(){var e=function(){if(qe(),Ce.current){var e=Ce.current.offsetWidth-Ce.current.clientWidth,n=Ce.current.clientWidth;De(e),Ne(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n(F,g({value:{allowAnimations:c,columnReordering:N,columnResizing:y,draggedHeaderRef:se,editColumns:S,forceUpdate:qe,getBorderClass:Ze,handleMouseDown:Ge,handleMouseOver:$e,headersRef:fe,hiddenColumns:Fe,hoveredHeaderRef:ve,isInitialFocusedCell:en,isSelected:Qe,mainBodyRef:ge,onCellEdit:P,onColumnOrderChange:A,onSort:an,onTableHeaderDragEnd:ln,pinnedLeftRef:we,pinnedRightRef:pe,rowHeight:J,scrollbarWidth:Se,selectColumns:tn,selectableColumns:Z,setInitialFocusedCell:on,setIsWidthDragging:Re,setSelectedCells:nn,setSelectedColumns:rn,shouldPaginate:ne,sortDownIcon:te,sortUpIcon:ie,tableBodyContainerRef:Ce}},{children:e("div",g({className:"simple-table-root st-wrapper theme-".concat(le),style:L?{height:L}:{}},{children:[e("div",g({className:"st-table-wrapper-container"},{children:[e("div",g({className:"st-table-wrapper",onMouseUp:_e,onMouseLeave:_e},{children:[n(ce,{flattenedRows:Ke,isWidthDragging:xe,setFlattenedRows:Ve,setScrollTop:We,sort:Be,visibleRows:Xe}),n(me,{columnEditorText:v,editColumns:S,editColumnsInitOpen:H,headers:fe.current,hiddenColumns:Fe,position:h,setHiddenColumns:Ae})]})),n(ue,{mainBodyRef:ge,pinnedLeftRef:we,pinnedRightRef:pe,tableContentWidth:ke})]})),n(C,{currentPage:ye,hideFooter:W,nextIcon:B,onPageChange:Ee,onNextPage:z,onPreviousPage:j,prevIcon:K,shouldPaginate:ne,totalPages:de||Math.ceil(Pe.length/Y)})]}))}))}));export{ge as SimpleTable};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),r=function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},r.apply(this,arguments)};function t(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var o,i=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},a=function(n){var t=n.currentPage,o=n.hideFooter,i=n.nextIcon,a=n.onPageChange,l=n.onNextPage,s=n.onPreviousPage,d=n.prevIcon,c=n.shouldPaginate,u=n.totalPages;if(o||!c)return null;var f=!(t>1)&&!s,h=!(t<u)&&!l;return e.jsxs("div",r({className:"st-footer"},{children:[e.jsx("button",r({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),s&&s(e-1)},disabled:f},{children:d})),e.jsx("button",r({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:h},{children:i})),Array.from({length:u},(function(n,o){return e.jsx("button",r({onClick:function(){var e;(e=o+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&s&&s(e-1))},className:"st-page-btn ".concat(t===o+1?"active":"")},{children:o+1}),o)}))]}))},l=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},s=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},d=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},c=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},u=function(e){return e.position*(e.rowHeight+1)-1},f=function(e){return e.position*(e.rowHeight+1)},h=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},v=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},m=function(n){var t=n.value,o=n.onBlur,i=n.onChange;return e.jsxs("select",r({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[e.jsx("option",r({value:"true"},{children:"True"})),e.jsx("option",r({value:"false"},{children:"False"}))]}))},g=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=t?t:"",onBlur:o,onChange:function(e){var n=e.target.value;i(n)}})},w=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},p=function(n){var r=n.onChange,t=n.setIsEditing,o=n.value,i=function(e){null==r||r(e)},a=function(){t(!1)};return e.jsx(e.Fragment,{children:"string"==typeof o||null==o?e.jsx(g,{defaultValue:o,onBlur:a,onChange:i}):"boolean"==typeof o?e.jsx(m,{onBlur:a,onChange:i,value:o}):"number"==typeof o?e.jsx(w,{defaultValue:o,onBlur:a,onChange:i}):null})},x=0,C=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===x||o-x>=t)&&(x=o,n(r))}},R=Date.now(),I={screenX:0,screenY:0},b=function(e){var r,o,i=e.draggedHeaderRef,a=e.headersRef,l=e.hoveredHeaderRef,s=e.onColumnOrderChange,d=e.onTableHeaderDragEnd,c=(r=a.current,o=n.useRef(r),n.useEffect((function(){o.current=r}),[r]),o.current);return{handleDragStart:function(e){i.current=e,R=Date.now()},handleDragOver:function(e){var n,r=e.event,o=e.hoveredHeader;if(r.preventDefault(),a.current){var s=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=r.screenX,f=r.screenY,h=Math.sqrt(Math.pow(u-I.screenX,2)+Math.pow(f-I.screenY,2));l.current=o;var v=t([],a.current,!0),m=v.findIndex((function(e){var n;return e.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)})),g=v.findIndex((function(e){return e.accessor===o.accessor})),w=v.splice(m,1)[0];if(v.splice(g,0,w),!(s||o.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)||null===i.current||h<10||void 0===m||void 0===g||JSON.stringify(v)===JSON.stringify(a.current))){var p=Date.now();JSON.stringify(v)===JSON.stringify(c)&&p-R<800&&h<50||(R=p,I={screenX:u,screenY:f},d(v))}}},handleDragEnd:function(){i.current=null,l.current=null,null==s||s(a.current)}}},y=n.createContext(void 0),S=function(n){var t=n.children,o=n.value;return e.jsx(y.Provider,r({value:o},{children:t}))},E=function(){var e=n.useContext(y);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},j=n.forwardRef((function(t,o){var i,a,l=t.borderClass,d=t.colIndex,u=t.header,f=t.isHighlighted,v=t.isInitialFocused,m=t.onExpandRowClick,g=t.rowIndex,w=t.visibleRow,x=E(),R=x.draggedHeaderRef,I=x.headersRef,y=x.hoveredHeaderRef,S=x.onCellEdit,j=x.onTableHeaderDragEnd,M=x.handleMouseDown,D=x.handleMouseOver,k=w.depth,H=w.row,N=n.useState(H.rowData[u.accessor]),L=N[0],T=N[1],W=n.useState(!1),O=W[0],P=W[1],B=b({draggedHeaderRef:R,headersRef:I,hoveredHeaderRef:y,onTableHeaderDragEnd:j}).handleDragOver,F=C(),A="cell-".concat(g,"-").concat(d),z=Boolean(null===(a=null===(i=H.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),U=Boolean(null==u?void 0:u.isEditable),q=g%2==0,K="st-cell ".concat(k>0&&u.expandable?"st-cell-depth-".concat(k):""," ").concat(f?v?"st-cell-selected-first ".concat(l):"st-cell-selected ".concat(l):""," ").concat(q?"st-cell-odd-row":"st-cell-even-row"," ").concat(U?"clickable":"");n.useEffect((function(){T(H.rowData[u.accessor])}),[u.accessor,H]);return O?e.jsx("div",r({className:"st-cell-editing ".concat(q?"st-cell-odd-row":"st-cell-even-row"),id:h({accessor:u.accessor,rowIndex:g+1})},{children:e.jsx(p,{onChange:function(e){T(e),null==S||S({accessor:u.accessor,newValue:e,row:H})},setIsEditing:P,value:L})})):e.jsxs("div",r({className:K,id:A,onDoubleClick:function(){return u.isEditable&&P(!0)},onMouseDown:function(){return M({rowIndex:g,colIndex:d,rowId:H.rowMeta.rowId})},onMouseOver:function(){return D({rowIndex:g,colIndex:d,rowId:H.rowMeta.rowId})},onDragOver:function(e){return F({callback:B,callbackProps:{event:e,hoveredHeader:u},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!u.isEditable||O||(e.preventDefault(),P(!0))},ref:o,"data-row-index":g,"data-col-index":d,"aria-selected":f},{children:[u.expandable&&z?H.rowMeta.isExpanded?e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return m(H.rowMeta.rowId)}},{children:e.jsx(c,{className:"st-sort-icon"})})):e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return m(H.rowMeta.rowId)}},{children:e.jsx(s,{className:"st-sort-icon"})})):null,e.jsx("span",r({className:"st-cell-content ".concat("right"===u.align?"right-aligned":"center"===u.align?"center-aligned":"")},{children:u.cellRenderer?u.cellRenderer({accessor:u.accessor,colIndex:d,row:H}):L}))]}))})),M=function(n){var t=n.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(n,["children"]);return E().allowAnimations?e.jsx(D,r({},o,{children:t})):e.jsx(e.Fragment,{children:t})},D=function(r){var t=r.children,o=r.isBody,i=r.pauseAnimation,a=r.rowIndex,l=n.useRef(!1),s=E(),d=s.draggedHeaderRef,c=s.headersRef,u=s.mainBodyRef,f=s.shouldPaginate,v=n.useState({}),m=v[0],g=v[1],w=n.useRef({}),p=c.current;return n.useLayoutEffect((function(){if(p){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(h({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:p,draggedHeaderRef:d,rowIndex:a});JSON.stringify(e)!==JSON.stringify(m)&&(w.current=m,g(e))}}),[m,p,d,o,a]),n.useLayoutEffect((function(){var e=u.current,n=function(){l.current=!0},r=function(){l.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[d,u]),n.useEffect((function(){i||l.current||Object.keys(w.current).length&&p&&p.forEach((function(e){var n=document.getElementById(h({accessor:e.accessor,rowIndex:a}));if(n){var r=w.current[e.accessor],t=m[e.accessor];if(r&&t){var o=r.left-t.left,i=f?0:r.top-t.top,l=Math.abs(o),s=Math.abs(i);(l>10||s>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[m,p,o,i,w,a,f]),e.jsx(e.Fragment,{children:t})},k=function(n){var t=n.columnIndices,o=n.headers,i=n.hiddenColumns,a=n.isWidthDragging,l=n.onExpandRowClick,s=n.pinned,d=n.rowIndex,c=n.visibleRow,u=o.filter((function(e){return v({hiddenColumns:i,header:e,pinned:s})}));return e.jsx(M,r({isBody:!0,pauseAnimation:a,rowIndex:d+1},{children:u.map((function(n){return e.jsx(H,{columnIndices:t,header:n,headers:o,hiddenColumns:i,onExpandRowClick:l,pinned:s,rowIndex:d,visibleRow:c},h({accessor:n.accessor,rowIndex:d+1}))}))}))},H=function(r){var t=r.columnIndices,o=r.header,i=r.headers,a=r.hiddenColumns,l=r.onExpandRowClick,s=r.pinned,d=r.rowIndex,c=r.visibleRow,u=E(),f=u.getBorderClass,m=u.isSelected,g=u.isInitialFocusedCell,w=t[o.accessor];if(o.children){var p=o.children.filter((function(e){return v({hiddenColumns:a,header:e,pinned:s})}));return e.jsx(n.Fragment,{children:p.map((function(n){return e.jsx(H,{columnIndices:t,header:n,headers:i,hiddenColumns:a,onExpandRowClick:l,pinned:s,rowIndex:d,visibleRow:c},h({accessor:n.accessor,rowIndex:d+1}))}))})}var x=f({rowIndex:d,colIndex:w,rowId:c.row.rowMeta.rowId}),C=m({rowIndex:d,colIndex:w,rowId:c.row.rowMeta.rowId}),R=g({rowIndex:d,colIndex:w,rowId:c.row.rowMeta.rowId});return e.jsx(j,{borderClass:x,colIndex:w,header:o,isHighlighted:C,isInitialFocused:R,onExpandRowClick:l,rowIndex:d,visibleRow:c},h({accessor:o.accessor,rowIndex:d+1}))},N=function(n){var t=n.columnIndices,o=n.getNextRowIndex,i=n.gridTemplateColumns,a=n.headers,l=n.hiddenColumns,s=n.index,d=n.isWidthDragging,c=n.onExpandRowClick,u=n.pinned,h=n.rowHeight,v=n.visibleRow,m=v.position,g=o();return e.jsx("div",r({className:"st-table-row",style:{gridTemplateColumns:i,top:f({position:m,rowHeight:h}),height:"".concat(h,"px")}},{children:e.jsx(k,{columnIndices:t,headers:a,hiddenColumns:l,isWidthDragging:d,onExpandRowClick:c,pinned:u,rowIndex:g,visibleRow:v},s)}))},L=function(n){var t=n.lastGroupRow,o=n.position,i=n.rowHeight,a=n.templateColumns;return e.jsx("div",r({className:"st-row-separator ".concat(t?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:a,position:"absolute",top:u({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},T=function(t){var o=t.columnIndices;t.headerContainerRef;var i=t.headers,a=t.hiddenColumns,l=t.isWidthDragging,s=t.onExpandRowClick,d=t.pinned,c=t.rowHeight,u=t.sectionRef,f=t.templateColumns,h=t.totalHeight,v=t.visibleRows,m=t.width,g=d?"st-table-body-pinned-".concat(d):"st-table-body-main",w=n.useRef(0);n.useEffect((function(){w.current=0}));var p=function(){return w.current++};return e.jsx("div",r({className:g,ref:u,style:{position:"relative",height:"".concat(h,"px"),width:m}},{children:v.map((function(r,t){var u,h,v=Boolean(null===(h=null===(u=r.row.rowMeta)||void 0===u?void 0:u.children)||void 0===h?void 0:h.length);return e.jsxs(n.Fragment,{children:[e.jsx(N,{columnIndices:o,getNextRowIndex:p,gridTemplateColumns:f,headers:i,hiddenColumns:a,index:t,isWidthDragging:l,onExpandRowClick:s,pinned:d,rowHeight:c,visibleRow:r}),0!==t&&e.jsx(L,{lastGroupRow:v,position:r.position,rowHeight:c,templateColumns:f})]},t)}))}))},W=function(t){var o,i,a,l,s,d=t.centerHeaderRef,c=t.flattenedRows,u=t.headerContainerRef,f=t.isWidthDragging,h=t.mainTemplateColumns,m=t.pinnedLeftColumns,g=t.pinnedLeftHeaderRef,w=t.pinnedLeftTemplateColumns,p=t.pinnedRightColumns,x=t.pinnedRightHeaderRef,C=t.pinnedRightTemplateColumns,R=t.setFlattenedRows,I=t.setScrollTop,b=t.visibleRows,y=E(),S=y.rowHeight,j=y.scrollbarWidth,M=y.mainBodyRef,D=y.pinnedLeftRef,k=y.pinnedRightRef,H=y.tableBodyContainerRef,N=y.hiddenColumns,L=y.headersRef;!function(e){var r=e.headerContainerRef,t=e.mainSectionRef,o=e.scrollbarWidth,i=n.useState(!1),a=i[0],l=i[1];n.useEffect((function(){var e=null==r?void 0:r.current;if(a&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[r,a,o]),n.useEffect((function(){var e=null==r?void 0:r.current,n=null==t?void 0:t.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;l(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(n),function(){n&&i.unobserve(n)}}}),[r,t])}({headerContainerRef:u,mainSectionRef:H,scrollbarWidth:j});var W,O,P=n.useRef(null),B=(W=0,(O=function(e){e.forEach((function(e){W+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&O(e.rowMeta.children)}))})(c),W)*(S+1)-1,F=n.useMemo((function(){var e={},n=0,r=function(t,o){n++,e[t.accessor]=n,t.children&&t.children.length>0&&t.children.filter((function(e){return v({hiddenColumns:N,header:e})})).forEach((function(e){r(e)}))};return m.forEach((function(e){r(e)})),L.current.filter((function(e){return!e.pinned&&v({hiddenColumns:N,header:e})})).forEach((function(e){r(e)})),p.forEach((function(e){r(e)})),e}),[L,N,m,p]),A=function(e){var n=function(t){return t.rowMeta.rowId===e&&t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{isExpanded:!t.rowMeta.isExpanded})}):t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{children:t.rowMeta.children.map(n)})}):t};R((function(e){return e.map(n)}))},z=(null===(o=g.current)||void 0===o?void 0:o.clientWidth)?(null===(i=g.current)||void 0===i?void 0:i.clientWidth)+1:0,U=null===(a=d.current)||void 0===a?void 0:a.clientWidth,q=(null===(l=x.current)||void 0===l?void 0:l.clientWidth)?(null===(s=x.current)||void 0===s?void 0:s.clientWidth)+1:0,K={headerContainerRef:u,headers:L.current,hiddenColumns:N,isWidthDragging:f,rowHeight:S,visibleRows:b,columnIndices:F};return e.jsxs("div",r({className:"st-table-body-container",ref:H,onScroll:function(e){var n=e.currentTarget.scrollTop;P.current&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame((function(){I(n)}))}},{children:[m.length>0&&e.jsx(T,r({},K,{onExpandRowClick:A,pinned:"left",sectionRef:D,templateColumns:w,totalHeight:B,width:z})),e.jsx(T,r({},K,{onExpandRowClick:A,sectionRef:M,templateColumns:h,totalHeight:B,width:U})),p.length>0&&e.jsx(T,r({},K,{onExpandRowClick:A,pinned:"right",sectionRef:k,templateColumns:C,totalHeight:B,width:q}))]}))},O=function(e,r){n.useEffect((function(){if(e.current){var n=e.current,t=function(){var e,t=null==n?void 0:n.scrollLeft;void 0!==t&&(null===(e=r.current)||void 0===e||e.scrollTo(t,0))};return n.addEventListener("scroll",t),function(){null==n||n.removeEventListener("scroll",t)}}}),[e,r])},P={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return P.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?P.string(e,n,r):"number"==typeof e&&"number"==typeof n?P.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?P.boolean(e,n,r):P.string(String(e),String(n),r)}},B=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return P.number(i,a,t)}return"date"===r?P.date(String(e),String(n),t):"boolean"===r?P.boolean(Boolean(e),Boolean(n),t):"enum"===r?P.enum(String(e),String(n),t):P.string(String(e),String(n),t)},F=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction,s=new Map,d=new Map,c="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(s.size)).toString();c=t,d.set(c,e),s.has(c)||s.set(c,[])}else if(c){var o=s.get(c)||[];o.push(e),s.set(c,o)}else{var i="default";s.has(i)||s.set(i,[]),null===(r=s.get(i))||void 0===r||r.push(e)}}));var u=[];return s.forEach((function(e,i){if(d.has(i)){var s=d.get(i);s.rowMeta.children&&s.rowMeta.children.length>0&&(s.rowMeta.children=A(s.rowMeta.children,n,o)),u.push(s)}var c=t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return B(o,i,a,l)}));u.push.apply(u,c.map((function(e){var t=r({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var i=A(t.rowMeta.children,n,o);t.rowMeta=r(r({},t.rowMeta),{children:i})}return t})))})),u},A=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction;return t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return B(o,i,a,l)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?r(r({},e),{rowMeta:r(r({},e.rowMeta),{children:A(e.rowMeta.children,n,o)})}):e}))},z=function(e){var n=e.colIndex,r=e.event,t=e.forceUpdate,o=e.header,i=e.headersRef;e.reverse;var a=e.setIsWidthDragging,l=e.startWidth;a(!0),r.preventDefault();var s=r.clientX;if(o){var d=function(e){var r=Math.max(l+(e.clientX-s),40);o&&i.current&&(i.current[n].width=r,t())},c=function(){document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",c),a(!1)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",c)}},U=n.forwardRef((function(o,i){var a=o.colIndex,l=o.gridColumnEnd,s=o.gridColumnStart,d=o.gridRowEnd,c=o.gridRowStart,u=o.header,f=o.reverse,v=o.sort,m=E(),g=m.columnReordering,w=m.columnResizing,p=m.draggedHeaderRef,x=m.forceUpdate,R=m.headersRef,I=m.hoveredHeaderRef,y=m.onColumnOrderChange,S=m.onSort,j=m.onTableHeaderDragEnd,M=m.rowHeight,D=m.selectColumns,k=m.selectableColumns,H=m.setInitialFocusedCell,N=m.setIsWidthDragging,L=m.setSelectedCells,T=m.setSelectedColumns,W=m.sortDownIcon,O=m.sortUpIcon,P=n.useState(!1),B=P[0],F=P[1],A=Boolean(null==u?void 0:u.isSortable),U="st-header-cell ".concat(u===I.current?"st-hovered":""," ").concat(B?"st-dragging":""," ").concat(A?"clickable":""," ").concat(g&&!A?"columnReordering":""," ").concat("right"===(null==u?void 0:u.align)?"right-aligned":"center"===(null==u?void 0:u.align)?"center-aligned":""),q=b({draggedHeaderRef:p,headersRef:R,hoveredHeaderRef:I,onColumnOrderChange:y,onTableHeaderDragEnd:j}),K=q.handleDragStart,V=q.handleDragEnd,J=q.handleDragOver,X=C(),Y=function(e){var n=e.event,r=e.header;if(k){var o=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,a);return n.shiftKey&&D?T((function(e){if(0===e.size)return new Set(o);var n=o[0],r=Array.from(e).sort((function(e,n){return e-n})),i=r[0],a=Math.abs(n-i);r.forEach((function(e){var r=Math.abs(n-e);r<a&&(a=r,i=e)}));var l,s,d,c,u=t(t([],(l=i,s=n,d=Math.min(l,s),c=Math.max(l,s),Array.from({length:c-d+1},(function(e,n){return d+n}))),!0),o,!0);return new Set(t(t([],Array.from(e),!0),u,!0))})):D&&D(o),L(new Set),void H(null)}r.isSortable&&S(a,r.accessor)};if(n.useEffect((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!u)return null;var G=w&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;X({callback:z,callbackProps:{colIndex:a,event:e,forceUpdate:x,header:u,headersRef:R,setIsWidthDragging:N,startWidth:"object"==typeof i&&null!==i&&"current"in i?null===(n=i.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),_=v&&v.key.accessor===u.accessor&&e.jsxs("div",r({className:"st-sort-icon-container",onClick:function(e){return Y({event:e,header:u})}},{children:["ascending"===v.direction&&O&&O,"descending"===v.direction&&W&&W]}));return e.jsxs("div",r({className:U,id:h({accessor:u.accessor,rowIndex:0}),onDragOver:function(e){X({callback:J,callbackProps:{event:e,hoveredHeader:u},limit:50})},ref:i,style:r(r({gridRowStart:c,gridRowEnd:d,gridColumnStart:s,gridColumnEnd:l},l-s>1?{}:{width:u.width}),d-c>1?{}:{height:M})},{children:[f&&G,e.jsxs("div",r({className:"st-header-label ".concat("right"===u.align?"right-aligned":"center"===u.align?"center-aligned":""),draggable:g,onClick:function(e){return Y({event:e,header:u})},onDragEnd:function(e){e.preventDefault(),F(!1),V()},onDragStart:function(e){g&&u&&function(e){F(!0),K(e)}(u)}},{children:["right"===u.align&&_,null==u?void 0:u.label,"right"!==u.align&&_]})),!f&&G]}))})),q=function(r){var t=r.depth,o=r.header,i=r.hiddenColumns,a=r.maxDepth,l=r.pinned,s=r.gridPosition,d=r.reverse,c=r.sort;if(!v({hiddenColumns:i,header:o,pinned:l}))return null;var u=s.gridColumnStart,f=s.gridColumnEnd,h=s.gridRowStart,m=s.gridRowEnd,g=s.colIndex;if(o.children){var w=o.children.filter((function(e){return v({hiddenColumns:i,header:e,pinned:l})}));return e.jsxs(n.Fragment,{children:[e.jsx(U,{colIndex:g,gridColumnEnd:f,gridColumnStart:u,gridRowEnd:m,gridRowStart:h,header:o,ref:n.createRef(),reverse:d,sort:c}),w.map((function(n,r){var o,u=null===(o=s.children)||void 0===o?void 0:o[n.accessor];return u?e.jsx(q,{depth:t+1,gridPosition:u,header:n,hiddenColumns:i,maxDepth:a,pinned:l,reverse:d,sort:c},n.accessor):null}))]})}return e.jsx(U,{colIndex:g,gridColumnEnd:f,gridColumnStart:u,gridRowEnd:m,gridRowStart:h,header:o,ref:n.createRef(),reverse:d,sort:c})},K=function(t){var o=t.gridTemplateColumns,i=t.handleScroll,a=t.headersRef,l=t.hiddenColumns,s=t.maxDepth,d=t.pinned,c=t.sectionRef,u=t.sort,f=a.current.filter((function(e){return v({hiddenColumns:l,header:e,pinned:d})})),h=n.useMemo((function(){var e,n,r;return e={},n=1,r=function(t,o,i){var a,c;void 0===i&&(i=!1),i||n++;var u=n,f=null!==(c=null===(a=t.children)||void 0===a?void 0:a.filter((function(e){return v({hiddenColumns:l,header:e,pinned:d})})).length)&&void 0!==c?c:0,h={gridColumnStart:u,gridColumnEnd:f>0?u+f:u+1,gridRowStart:o,gridRowEnd:f>0?o+1:s+1,colIndex:u,children:{}};return t.children&&t.children.length>0&&t.children.filter((function(e){return v({hiddenColumns:l,header:e,pinned:d})})).forEach((function(e,n){h.children[e.accessor]=r(e,o+1,0===n)})),e[t.accessor]=h,h},f.forEach((function(e,n){r(e,1,0===n)})),e}),[f,l,s,d]);return e.jsx("div",r({className:"st-header-".concat(d?"pinned-".concat(d):"main")},i&&{onScroll:i},{ref:c,style:{gridTemplateColumns:o}},{children:e.jsx(M,r({rowIndex:0},{children:f.map((function(n){var r=h[n.accessor];return r?e.jsx(q,{depth:1,gridPosition:r,header:n,hiddenColumns:l,maxDepth:s,pinned:d,reverse:"right"===d,sort:u},n.accessor):null}))}))}))},V=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(V)):1},J=function(t){var o=t.centerHeaderRef,i=t.headerContainerRef,a=t.headersRef,l=t.hiddenColumns,s=t.mainTemplateColumns,d=t.pinnedLeftColumns,c=t.pinnedLeftHeaderRef,u=t.pinnedLeftTemplateColumns,f=t.pinnedRightColumns,h=t.pinnedRightHeaderRef,m=t.pinnedRightTemplateColumns,g=t.sort,w=E().mainBodyRef;O(w,o);var p=n.useMemo((function(){var e=a.current,n=0;return e.forEach((function(e){if(v({hiddenColumns:l,header:e})){var r=V(e);n=Math.max(n,r)}})),{maxDepth:n}}),[a,l]).maxDepth;return e.jsxs("div",r({className:"st-header-container",ref:i},{children:[d.length>0&&e.jsx(K,{gridTemplateColumns:u,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:p,pinned:"left",sectionRef:c,sort:g}),e.jsx(K,{gridTemplateColumns:s,handleScroll:function(e){var n,r,t=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=w.current)||void 0===r||r.scrollTo(t,0))},headersRef:a,hiddenColumns:l,maxDepth:p,sectionRef:o,sort:g}),f.length>0&&e.jsx(K,{gridTemplateColumns:m,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:p,pinned:"right",sectionRef:h,sort:g})]}))},X=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"minmax(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},Y=function(t){var o=t.flattenedRows,i=t.isWidthDragging,a=t.setFlattenedRows,l=t.setScrollTop,s=t.sort,d=t.visibleRows,c=E(),u=c.editColumns,f=c.headersRef,h=c.hiddenColumns,v=n.useRef(null),m=n.useRef(null),g=n.useRef(null),w=n.useRef(null),p=f.current.filter((function(e){return!e.pinned})),x=f.current.filter((function(e){return"left"===e.pinned})),C=f.current.filter((function(e){return"right"===e.pinned})),R=n.useMemo((function(){return X({headers:x,hiddenColumns:h})}),[x,h]),I=n.useMemo((function(){return X({headers:p,hiddenColumns:h})}),[p,h]),b=n.useMemo((function(){return X({headers:C,hiddenColumns:h})}),[C,h]),y={centerHeaderRef:g,headerContainerRef:v,headersRef:f,hiddenColumns:h,mainTemplateColumns:I,pinnedLeftColumns:x,pinnedLeftHeaderRef:m,pinnedLeftTemplateColumns:R,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,sort:s},S={centerHeaderRef:g,flattenedRows:o,headerContainerRef:v,isWidthDragging:i,mainTemplateColumns:I,pinnedLeftColumns:x,pinnedLeftHeaderRef:m,pinnedLeftTemplateColumns:R,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,setFlattenedRows:a,setScrollTop:l,visibleRows:d};return e.jsxs("div",r({className:"st-table-content",style:{width:u?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(J,r({},y)),e.jsx(W,r({},S))]}))},G=function(e){var r=e.callback,t=e.ref,o=e.widthAttribute;n.useEffect((function(){var e=t.current;if(e){var n=function(){r(e[o]||0)};n();var i=new ResizeObserver((function(){n()}));return i.observe(e),function(){return i.disconnect()}}}),[r,t,o])},_=function(t){var o=t.mainBodyRef,i=t.pinnedLeftRef,a=t.pinnedRightRef,l=t.tableContentWidth,s=n.useState(0),d=s[0],c=s[1],u=n.useState(0),f=u[0],h=u[1],v=n.useState(0),m=v[0],g=v[1],w=n.useRef(null);return G({widthAttribute:"offsetWidth",callback:c,ref:i}),G({widthAttribute:"scrollWidth",callback:g,ref:o}),G({widthAttribute:"offsetWidth",callback:h,ref:a}),O(o,w),!o.current||o.current.scrollWidth<=o.current.clientWidth?null:e.jsxs("div",r({className:"st-horizontal-scrollbar-container",style:{width:l}},{children:[d>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:d}}),m>0&&e.jsx("div",r({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&o.current&&o.current.scrollTo({left:n,behavior:"auto"})},ref:w},{children:e.jsx("div",{style:{width:m}})})),f>0&&e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:f}})]}))},$=function(e){var r=e.headers,t=e.tableRows,o=n.useState(null),i=o[0],a=o[1],l=n.useMemo((function(){var e={};return r.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[r]),s=n.useState(l),d=s[0],c=s[1],u=n.useMemo((function(){if(!i)return t;var e=function(e,n,r){return{sortedData:F(n,r,e),newSortConfig:r}}(r,t,i).sortedData;return e}),[t,i,r]);return{sort:i,setSort:a,updateSort:function(e,n){var t=r.find((function(e){return e.accessor===n}));t&&a((function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:t,direction:"descending"}:null:{key:t,direction:"ascending"}}))},sortedRows:u,hiddenColumns:d,setHiddenColumns:c}},Q=function(t){var o=t.checked,i=void 0!==o&&o,a=t.children,l=t.onChange,s=n.useState(i),d=s[0],c=s[1];return e.jsxs("label",r({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:d,className:"st-checkbox-input",onChange:function(){var e=!d;c(e),l&&l(e)},type:"checkbox"}),e.jsx("span",r({className:"st-checkbox-custom ".concat(d?"st-checked":"")},{children:d&&e.jsx("span",{className:"st-checkbox-checkmark"})})),a]}))},Z=function(n){var t=n.headers,o=n.open,i=n.position;n.setOpen;var a=n.setHiddenColumns,l=n.hiddenColumns,s="left"===i?"left":"";return e.jsx("div",r({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(s),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",r({className:"st-column-editor-popout-content"},{children:t.map((function(n,t){return e.jsx(Q,r({checked:l[n.accessor],onChange:function(e){var t;return a(r(r({},l),((t={})[n.accessor]=e,t)))}},{children:n.label}),t)}))}))}))},ee=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,l=t.headers,s=t.position,d=void 0===s?"right":s,c=t.setHiddenColumns,u=t.hiddenColumns,f=n.useState(a),h=f[0],v=f[1];return i?e.jsxs("div",r({className:"st-column-editor ".concat(h?"open":""," ").concat(d),onClick:function(){return function(e){v(e)}(!h)}},{children:[e.jsx("div",r({className:"st-column-editor-text"},{children:o})),e.jsx(Z,{headers:l,open:h,position:d,setOpen:v,setHiddenColumns:c,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(o||(o={}));var ne=n.memo((function(t){var u=t.allowAnimations,f=void 0!==u&&u,h=t.columnEditorPosition,v=void 0===h?o.Right:h,m=t.columnEditorText,g=void 0===m?"Columns":m,w=t.columnResizing,p=void 0!==w&&w,x=t.defaultHeaders,C=t.editColumns,R=void 0!==C&&C,I=t.editColumnsInitOpen,b=void 0!==I&&I,y=t.columnReordering,E=void 0!==y&&y,j=t.height,M=t.hideFooter,D=void 0!==M&&M,k=t.nextIcon,H=void 0===k?e.jsx(s,{className:"st-next-prev-icon"}):k,N=t.onCellEdit,L=t.onColumnOrderChange,T=t.onNextPage,W=t.onPreviousPage,O=t.prevIcon,P=void 0===O?e.jsx(l,{className:"st-next-prev-icon"}):O,B=t.rowHeight,F=void 0===B?40:B,A=t.rows,z=t.rowsPerPage,U=void 0===z?10:z,q=t.selectableCells,K=void 0!==q&&q,V=t.selectableColumns,J=void 0!==V&&V,X=t.shouldPaginate,G=void 0!==X&&X,Q=t.sortDownIcon,Z=void 0===Q?e.jsx(c,{className:"st-sort-icon"}):Q,ne=t.sortUpIcon,re=void 0===ne?e.jsx(d,{className:"st-sort-icon"}):ne,te=t.theme,oe=void 0===te?"light":te,ie=t.totalPages,ae=n.useRef(null),le=n.useRef(x),se=n.useRef(null),de=n.useRef(null),ce=n.useRef(null),ue=n.useRef(null),fe=n.useRef(null),he=n.useState(!1),ve=he[0],me=he[1],ge=n.useState(1),we=ge[0],pe=ge[1],xe=n.useState(0),Ce=xe[0],Re=xe[1],Ie=n.useState(0),be=Ie[0],ye=Ie[1],Se=n.useState(0),Ee=Se[0],je=Se[1],Me=$({headers:le.current,tableRows:A}),De=Me.sort,ke=Me.sortedRows,He=Me.hiddenColumns,Ne=Me.setHiddenColumns,Le=Me.updateSort,Te=n.useMemo((function(){if(!G)return ke;var e=(we-1)*U,n=e+U;return ke.slice(e,n)}),[we,U,G,ke]),We=n.useState(Te),Oe=We[0],Pe=We[1];n.useEffect((function(){Pe(Te)}),[Te]);var Be=n.useMemo((function(){var e;if(!j)return window.innerHeight-F;var n=document.querySelector(".simple-table-root"),r=0;if(j.endsWith("px"))r=parseInt(j,10);else if(j.endsWith("vh")){var t=parseInt(j,10);r=window.innerHeight*t/100}else if(j.endsWith("%")){var o=parseInt(j,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-F)}),[j,F]),Fe=n.useMemo((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,s=Math.max(0,i-o*n),d=i+r+o*n,c=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],f=l*o;if(f>=d)break;f+o>s&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&c(u.rowMeta.children,n+1)}};return c(t,0),a}({bufferRowCount:5,contentHeight:Be,flattenedRows:Oe,rowHeight:F,scrollTop:Ee})}),[Be,F,Oe,Ee]),Ae=n.useReducer((function(e){return e+1}),0)[1],ze=function(e){var r=e.selectableCells,t=e.headers,o=e.visibleRows,a=n.useState(new Set),l=a[0],s=a[1],d=n.useState(new Set),c=d[0],u=d[1],f=n.useState(null),h=f[0],v=f[1],m=n.useState(null),g=m[0],w=m[1],p=n.useRef(!1),x=n.useRef(null),C=n.useCallback((function(){var e=Array.from(l).reduce((function(e,n){var r=n.split("-").map(Number),i=r[0],a=r[1];return e[i]||(e[i]=[]),e[i][a]=o[i].row.rowData[t[a].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");l.size>0&&navigator.clipboard.writeText(n)}),[t,l,o]),R=n.useCallback((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),a=Math.max(e.rowIndex,n.rowIndex),l=Math.min(e.colIndex,n.colIndex),d=Math.max(e.colIndex,n.colIndex),c=t;c<=a;c++)for(var f=l;f<=d;f++)if(c>=0&&c<o.length){var h=o[c].row.rowMeta.rowId;r.add(i({colIndex:f,rowIndex:c,rowId:h}))}u(new Set),v(null),s(r)}),[o,u,v,s]),I=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<t.length){var n=i(e);u(new Set),v(null),s(new Set([n])),w(e)}}),[t.length,o.length,u,v,s,w]),b=n.useCallback((function(e,n){void 0===n&&(n=!1),s(new Set),w(null),u((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&v(e[e.length-1])}),[s,w,u,v]);n.useEffect((function(){var e=function(e){if(r&&g){var n=g.rowIndex,i=g.colIndex,a=g.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(o[n].row.rowMeta.rowId!==a){var l=o.findIndex((function(e){return e.row.rowMeta.rowId===a}));if(-1===l)return;n=l}if("ArrowUp"===e.key){if(e.preventDefault(),n>0){var d={rowIndex:n-1,colIndex:i,rowId:o[n-1].row.rowMeta.rowId};I(d)}}else"ArrowDown"===e.key?(e.preventDefault(),n<o.length-1&&(d={rowIndex:n+1,colIndex:i,rowId:o[n+1].row.rowMeta.rowId},I(d))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(d={rowIndex:n,colIndex:i-1,rowId:o[n].row.rowMeta.rowId},I(d))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<t.length-1&&(d={rowIndex:n,colIndex:i+1,rowId:o[n].row.rowMeta.rowId},I(d))):"Escape"===e.key&&(s(new Set),u(new Set),v(null),x.current=null,w(null))}else C()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[C,t.length,g,R,I,r,o]),console.log(l);var y=n.useCallback((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=i({colIndex:n,rowIndex:r,rowId:t}),a=l.has(o),s=c.has(n);return a||s}),[l,c]),S=n.useCallback((function(e){var n,r,t,i,a,l,s=e.colIndex,d=e.rowIndex,u=e.rowId,f=[],h=null===(t=null===(r=null===(n=o[d-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:s,rowIndex:d+1,rowId:null===(l=null===(a=null===(i=o[d+1])||void 0===i?void 0:i.row)||void 0===a?void 0:a.rowMeta)||void 0===l?void 0:l.rowId},m={colIndex:s-1,rowIndex:d,rowId:u},g={colIndex:s+1,rowIndex:d,rowId:u};return(!y({colIndex:s,rowIndex:d-1,rowId:h})||c.has(s)&&0===d)&&f.push("st-selected-top-border"),(!y(v)||c.has(s)&&d===o.length-1)&&f.push("st-selected-bottom-border"),y(m)||f.push("st-selected-left-border"),y(g)||f.push("st-selected-right-border"),f.join(" ")}),[y,o,c]),E=n.useMemo((function(){return g?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===g.rowIndex&&r===g.colIndex&&t===g.rowId}:function(){return!1}}),[g]);return{getBorderClass:S,handleMouseDown:function(e){var n=e.colIndex,t=e.rowIndex,o=e.rowId;if(r){p.current=!0,x.current={rowIndex:t,colIndex:n,rowId:o},u(new Set),v(null);var a=i({colIndex:n,rowIndex:t,rowId:o});s(new Set([a])),w({rowIndex:t,colIndex:n,rowId:o})}},handleMouseOver:function(e){var n=e.colIndex,t=e.rowIndex;if(e.rowId,r&&p.current&&x.current){for(var a=new Set,l=Math.min(x.current.rowIndex,t),d=Math.max(x.current.rowIndex,t),c=Math.min(x.current.colIndex,n),u=Math.max(x.current.colIndex,n),f=l;f<=d;f++)for(var h=c;h<=u;h++)if(f>=0&&f<o.length){var v=o[f].row.rowMeta.rowId;a.add(i({colIndex:h,rowIndex:f,rowId:v}))}s(a)}},handleMouseUp:function(){p.current=!1},isInitialFocusedCell:E,isSelected:y,lastSelectedColumnIndex:h,selectColumns:b,selectedCells:l,selectedColumns:c,setInitialFocusedCell:w,setSelectedCells:s,setSelectedColumns:u}}({selectableCells:K,headers:le.current,visibleRows:Fe}),Ue=ze.handleMouseDown,qe=ze.handleMouseOver,Ke=ze.handleMouseUp,Ve=ze.isSelected,Je=ze.getBorderClass,Xe=ze.isInitialFocusedCell,Ye=ze.setSelectedCells,Ge=ze.setSelectedColumns,_e=ze.selectColumns,$e=ze.setInitialFocusedCell,Qe=n.useCallback((function(e,n){Le(e,n)}),[Le]),Ze=n.useCallback((function(e){le.current=e,Ae()}),[]);return n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||J&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(Ye(new Set),J&&Ge(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[J,Ye,Ge]),n.useLayoutEffect((function(){if(fe.current){var e=fe.current.offsetWidth-fe.current.clientWidth,n=fe.current.clientWidth;Re(e),ye(n)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Ae(),fe.current){var e=fe.current.offsetWidth-fe.current.clientWidth,n=fe.current.clientWidth;Re(e),ye(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),e.jsx(S,r({value:{allowAnimations:f,columnReordering:E,columnResizing:p,draggedHeaderRef:ae,editColumns:R,forceUpdate:Ae,getBorderClass:Je,handleMouseDown:Ue,handleMouseOver:qe,headersRef:le,hiddenColumns:He,hoveredHeaderRef:se,isInitialFocusedCell:Xe,isSelected:Ve,mainBodyRef:de,onCellEdit:N,onColumnOrderChange:L,onSort:Qe,onTableHeaderDragEnd:Ze,pinnedLeftRef:ce,pinnedRightRef:ue,rowHeight:F,scrollbarWidth:Ce,selectColumns:_e,selectableColumns:J,setInitialFocusedCell:$e,setIsWidthDragging:me,setSelectedCells:Ye,setSelectedColumns:Ge,shouldPaginate:G,sortDownIcon:Z,sortUpIcon:re,tableBodyContainerRef:fe}},{children:e.jsxs("div",r({className:"simple-table-root st-wrapper theme-".concat(oe),style:j?{height:j}:{}},{children:[e.jsxs("div",r({className:"st-table-wrapper-container"},{children:[e.jsxs("div",r({className:"st-table-wrapper",onMouseUp:Ke,onMouseLeave:Ke},{children:[e.jsx(Y,{flattenedRows:Oe,isWidthDragging:ve,setFlattenedRows:Pe,setScrollTop:je,sort:De,visibleRows:Fe}),e.jsx(ee,{columnEditorText:g,editColumns:R,editColumnsInitOpen:b,headers:le.current,hiddenColumns:He,position:v,setHiddenColumns:Ne})]})),e.jsx(_,{mainBodyRef:de,pinnedLeftRef:ce,pinnedRightRef:ue,tableContentWidth:be})]})),e.jsx(a,{currentPage:we,hideFooter:D,nextIcon:H,onPageChange:pe,onNextPage:T,onPreviousPage:W,prevIcon:P,shouldPaginate:G,totalPages:ie||Math.ceil(ke.length/U)})]}))}))}));exports.SimpleTable=ne;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),r=function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},r.apply(this,arguments)};function t(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var o=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},i=function(n){var t=n.currentPage,o=n.hideFooter,i=n.nextIcon,a=n.onPageChange,l=n.onNextPage,s=n.onPreviousPage,d=n.prevIcon,c=n.shouldPaginate,u=n.totalPages;if(o||!c)return null;var f=!(t>1)&&!s,h=!(t<u)&&!l;return e.jsxs("div",r({className:"st-footer"},{children:[e.jsx("button",r({className:"st-next-prev-btn ".concat(f?"disabled":""),onClick:function(){var e=t-1;e>=1&&a(e),s&&s(e-1)},disabled:f},{children:d})),e.jsx("button",r({className:"st-next-prev-btn ".concat(h?"disabled":""),onClick:function(){var e=t+1;(e<=u||l)&&a(e),l&&l(t)},disabled:h},{children:i})),Array.from({length:u},(function(n,o){return e.jsx("button",r({onClick:function(){var e;(e=o+1)>=1&&e<=u&&(a(e),e>t&&l?l(e-1):e<t&&s&&s(e-1))},className:"st-page-btn ".concat(t===o+1?"active":"")},{children:o+1}),o)}))]}))},a=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})}))},l=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})}))},s=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},d=function(n){var t=n.className;return e.jsx("svg",r({className:t,viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M5.41 7.59L10 12.17l4.59-4.58L16 9l-6 6-6-6z"})}))},c=function(e){return e.position*(e.rowHeight+1)-1},u=function(e){return e.position*(e.rowHeight+1)},f=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},h=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},v=function(n){var t=n.value,o=n.onBlur,i=n.onChange;return e.jsxs("select",r({value:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;i("true"===n)}},{children:[e.jsx("option",r({value:"true"},{children:"True"})),e.jsx("option",r({value:"false"},{children:"False"}))]}))},m=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,type:"text",defaultValue:null!=t?t:"",onBlur:o,onChange:function(e){var n=e.target.value;i(n)}})},g=function(r){var t=r.defaultValue,o=r.onBlur,i=r.onChange,a=n.useRef(null);return e.jsx("input",{className:"editable-cell-input",ref:a,autoFocus:!0,defaultValue:t.toString(),onBlur:o,onChange:function(e){var n=e.target.value;/^\d*\.?\d*$/.test(n)&&i(n)}})},w=function(n){var r=n.onChange,t=n.setIsEditing,o=n.value,i=function(e){null==r||r(e)},a=function(){t(!1)};return e.jsx(e.Fragment,{children:"string"==typeof o||null==o?e.jsx(m,{defaultValue:o,onBlur:a,onChange:i}):"boolean"==typeof o?e.jsx(v,{onBlur:a,onChange:i,value:o}):"number"==typeof o?e.jsx(g,{defaultValue:o,onBlur:a,onChange:i}):null})},p=0,x=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===p||o-p>=t)&&(p=o,n(r))}},C=Date.now(),I={screenX:0,screenY:0},R=function(e){var r,o,i=e.draggedHeaderRef,a=e.headersRef,l=e.hoveredHeaderRef,s=e.onColumnOrderChange,d=e.onTableHeaderDragEnd,c=(r=a.current,o=n.useRef(r),n.useEffect((function(){o.current=r}),[r]),o.current);return{handleDragStart:function(e){i.current=e,C=Date.now()},handleDragOver:function(e){var n,r=e.event,o=e.hoveredHeader;if(r.preventDefault(),a.current){var s=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=r.screenX,f=r.screenY,h=Math.sqrt(Math.pow(u-I.screenX,2)+Math.pow(f-I.screenY,2));l.current=o;var v=t([],a.current,!0),m=v.findIndex((function(e){var n;return e.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)})),g=v.findIndex((function(e){return e.accessor===o.accessor})),w=v.splice(m,1)[0];if(v.splice(g,0,w),!(s||o.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)||null===i.current||h<10||void 0===m||void 0===g||JSON.stringify(v)===JSON.stringify(a.current))){var p=Date.now();JSON.stringify(v)===JSON.stringify(c)&&p-C<800&&h<50||(C=p,I={screenX:u,screenY:f},d(v))}}},handleDragEnd:function(){i.current=null,l.current=null,null==s||s(a.current)}}},b=n.createContext(void 0),S=function(n){var t=n.children,o=n.value;return e.jsx(b.Provider,r({value:o},{children:t}))},y=function(){var e=n.useContext(b);if(void 0===e)throw new Error("useTableContext must be used within a TableProvider");return e},E=n.forwardRef((function(t,o){var i,a,s=t.borderClass,c=t.colIndex,u=t.header,h=t.isHighlighted,v=t.isInitialFocused,m=t.onExpandRowClick,g=t.rowIndex,p=t.visibleRow,C=y(),I=C.draggedHeaderRef,b=C.headersRef,S=C.hoveredHeaderRef,E=C.onCellEdit,M=C.onTableHeaderDragEnd,j=C.handleMouseDown,D=C.handleMouseOver,k=p.depth,H=p.row,N=n.useState(H.rowData[u.accessor]),L=N[0],T=N[1],W=n.useState(!1),O=W[0],P=W[1],B=R({draggedHeaderRef:I,headersRef:b,hoveredHeaderRef:S,onTableHeaderDragEnd:M}).handleDragOver,F=x(),A="cell-".concat(g,"-").concat(c),z=Boolean(null===(a=null===(i=H.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),U=Boolean(null==u?void 0:u.isEditable),q=g%2==0,K="st-cell ".concat(k>0&&u.expandable?"st-cell-depth-".concat(k):""," ").concat(h?v?"st-cell-selected-first ".concat(s):"st-cell-selected ".concat(s):""," ").concat(q?"st-cell-odd-row":"st-cell-even-row"," ").concat(U?"clickable":"");n.useEffect((function(){T(H.rowData[u.accessor])}),[u.accessor,H]);return O?e.jsx("div",r({className:"st-cell-editing ".concat(q?"st-cell-odd-row":"st-cell-even-row"),id:f({accessor:u.accessor,rowIndex:g+1})},{children:e.jsx(w,{onChange:function(e){T(e),null==E||E({accessor:u.accessor,newValue:e,row:H})},setIsEditing:P,value:L})})):e.jsxs("div",r({className:K,id:A,onDoubleClick:function(){return u.isEditable&&P(!0)},onMouseDown:function(){return j({rowIndex:g,colIndex:c,rowId:H.rowMeta.rowId})},onMouseOver:function(){return D({rowIndex:g,colIndex:c,rowId:H.rowMeta.rowId})},onDragOver:function(e){return F({callback:B,callbackProps:{event:e,hoveredHeader:u},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!u.isEditable||O||(e.preventDefault(),P(!0))},ref:o,"data-row-index":g,"data-col-index":c,"aria-selected":h},{children:[u.expandable&&z?H.rowMeta.isExpanded?e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return m(H.rowMeta.rowId)}},{children:e.jsx(d,{className:"st-sort-icon"})})):e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return m(H.rowMeta.rowId)}},{children:e.jsx(l,{className:"st-sort-icon"})})):null,e.jsx("span",r({className:"st-cell-content ".concat("right"===u.align?"right-aligned":"center"===u.align?"center-aligned":"")},{children:u.cellRenderer?u.cellRenderer({accessor:u.accessor,colIndex:c,row:H}):L}))]}))})),M=function(n){var t=n.children,o=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}(n,["children"]);return y().allowAnimations?e.jsx(j,r({},o,{children:t})):e.jsx(e.Fragment,{children:t})},j=function(r){var t=r.children,o=r.isBody,i=r.pauseAnimation,a=r.rowIndex,l=n.useRef(!1),s=y(),d=s.draggedHeaderRef,c=s.headersRef,u=s.mainBodyRef,h=s.shouldPaginate,v=n.useState({}),m=v[0],g=v[1],w=n.useRef({}),p=c.current;return n.useLayoutEffect((function(){if(p){var e=function(e){var n=e.currentHeaders,r=e.draggedHeaderRef,t=e.rowIndex,o={};return n.forEach((function(e){var n;if(e){var i=document.getElementById(f({accessor:e.accessor,rowIndex:t}));if(i){var a=i.getAnimations().some((function(e){return"running"===e.playState})),l=i.getBoundingClientRect();a&&(null===(n=null==r?void 0:r.current)||void 0===n?void 0:n.accessor)!==e.accessor?o[e.accessor]=!1:o[e.accessor]=l}}})),o}({currentHeaders:p,draggedHeaderRef:d,rowIndex:a});JSON.stringify(e)!==JSON.stringify(m)&&(w.current=m,g(e))}}),[m,p,d,o,a]),n.useLayoutEffect((function(){var e=u.current,n=function(){l.current=!0},r=function(){l.current=!1};return null==e||e.addEventListener("scroll",n),null==e||e.addEventListener("scrollend",r),function(){null==e||e.removeEventListener("scroll",n),null==e||e.removeEventListener("scrollend",r)}}),[d,u]),n.useEffect((function(){i||l.current||Object.keys(w.current).length&&p&&p.forEach((function(e){var n=document.getElementById(f({accessor:e.accessor,rowIndex:a}));if(n){var r=w.current[e.accessor],t=m[e.accessor];if(r&&t){var o=r.left-t.left,i=h?0:r.top-t.top,l=Math.abs(o),s=Math.abs(i);(l>10||s>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(o,"px, ").concat(i,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[m,p,o,i,w,a,h]),e.jsx(e.Fragment,{children:t})},D=function(n){var t=n.columnIndices,o=n.headers,i=n.hiddenColumns,a=n.isWidthDragging,l=n.onExpandRowClick,s=n.pinned,d=n.rowIndex,c=n.rowIndices,u=n.visibleRow,v=o.filter((function(e){return h({hiddenColumns:i,header:e,pinned:s})}));return e.jsx(M,r({isBody:!0,pauseAnimation:a,rowIndex:d+1},{children:v.map((function(n){return e.jsx(k,{columnIndices:t,header:n,headers:o,hiddenColumns:i,onExpandRowClick:l,pinned:s,rowIndex:d,rowIndices:c,visibleRow:u},f({accessor:n.accessor,rowIndex:d+1}))}))}))},k=function(r){var t=r.columnIndices,o=r.header,i=r.headers,a=r.hiddenColumns,l=r.onExpandRowClick,s=r.pinned,d=r.rowIndex,c=r.rowIndices,u=r.visibleRow,v=t[o.accessor],m=y(),g=m.getBorderClass,w=m.isSelected,p=m.isInitialFocusedCell;if(o.children){var x=o.children.filter((function(e){return h({hiddenColumns:a,header:e,pinned:s})}));return e.jsx(n.Fragment,{children:x.map((function(n){return e.jsx(k,{columnIndices:t,header:n,headers:i,hiddenColumns:a,onExpandRowClick:l,pinned:s,rowIndex:d,rowIndices:c,visibleRow:u},f({accessor:n.accessor,rowIndex:d+1}))}))})}var C={rowIndex:d,colIndex:v,rowId:u.row.rowMeta.rowId},I=g(C),R=w(C),b=p(C);return e.jsx(E,{borderClass:I,colIndex:v,header:o,isHighlighted:R,isInitialFocused:b,onExpandRowClick:l,rowIndex:d,visibleRow:u},f({accessor:o.accessor,rowIndex:d+1}))},H=function(n){var t=n.columnIndices,o=n.gridTemplateColumns,i=n.headers,a=n.hiddenColumns,l=n.index,s=n.isWidthDragging,d=n.onExpandRowClick,c=n.pinned,f=n.rowHeight,h=n.rowIndices,v=n.visibleRow,m=v.position,g=l;return e.jsx("div",r({className:"st-table-row",style:{gridTemplateColumns:o,top:u({position:m,rowHeight:f}),height:"".concat(f,"px")}},{children:e.jsx(D,{columnIndices:t,headers:i,hiddenColumns:a,isWidthDragging:s,onExpandRowClick:d,pinned:c,rowIndex:g,rowIndices:h,visibleRow:v},l)}))},N=function(n){var t=n.lastGroupRow,o=n.position,i=n.rowHeight,a=n.templateColumns;return e.jsx("div",r({className:"st-row-separator ".concat(t?"st-last-group-row":""),style:{display:"grid",gridTemplateColumns:a,position:"absolute",top:c({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},L=function(t){var o=t.columnIndices;t.headerContainerRef;var i=t.headers,a=t.hiddenColumns,l=t.isWidthDragging,s=t.onExpandRowClick,d=t.pinned,c=t.rowHeight,u=t.rowIndices,f=t.sectionRef,h=t.templateColumns,v=t.totalHeight,m=t.visibleRows,g=t.width,w=d?"st-table-body-pinned-".concat(d):"st-table-body-main";return e.jsx("div",r({className:w,ref:f,style:{position:"relative",height:"".concat(v,"px"),width:g}},{children:m.map((function(r,t){var f,v,m=Boolean(null===(v=null===(f=r.row.rowMeta)||void 0===f?void 0:f.children)||void 0===v?void 0:v.length);return e.jsxs(n.Fragment,{children:[e.jsx(H,{columnIndices:o,gridTemplateColumns:h,headers:i,hiddenColumns:a,index:t,isWidthDragging:l,onExpandRowClick:s,pinned:d,rowHeight:c,rowIndices:u,visibleRow:r}),0!==t&&e.jsx(N,{lastGroupRow:m,position:r.position,rowHeight:c,templateColumns:h})]},t)}))}))};function T(e){var n=e.headersRef,r=e.hiddenColumns,t=e.pinnedLeftColumns,o=e.pinnedRightColumns,i={},a=0,l=function(e,n){void 0===n&&(n=!1),n||a++,i[e.accessor]=a,e.children&&e.children.length>0&&e.children.filter((function(e){return h({hiddenColumns:r,header:e})})).forEach((function(e,n){l(e,0===n)}))};return t.forEach((function(e,n){l(e,0===n)})),n.current.filter((function(e){return!e.pinned&&h({hiddenColumns:r,header:e})})).forEach((function(e,n){var r=0===n&&0===t.length;l(e,r)})),o.forEach((function(e){l(e,!1)})),i}var W,O=function(t){var o,i,a,l,s,d=t.centerHeaderRef,c=t.flattenedRows,u=t.headerContainerRef,f=t.isWidthDragging,h=t.mainTemplateColumns,v=t.pinnedLeftColumns,m=t.pinnedLeftHeaderRef,g=t.pinnedLeftTemplateColumns,w=t.pinnedRightColumns,p=t.pinnedRightHeaderRef,x=t.pinnedRightTemplateColumns,C=t.setFlattenedRows,I=t.setScrollTop,R=t.visibleRows,b=y(),S=b.rowHeight,E=b.scrollbarWidth,M=b.mainBodyRef,j=b.pinnedLeftRef,D=b.pinnedRightRef,k=b.tableBodyContainerRef,H=b.hiddenColumns,N=b.headersRef;!function(e){var r=e.headerContainerRef,t=e.mainSectionRef,o=e.scrollbarWidth,i=n.useState(!1),a=i[0],l=i[1];n.useEffect((function(){var e=null==r?void 0:r.current;if(a&&e)return e.classList.add("st-header-scroll-padding"),e.style.setProperty("--st-after-width","".concat(o,"px")),function(){e.classList.remove("st-header-scroll-padding")}}),[r,a,o]),n.useEffect((function(){var e=null==r?void 0:r.current,n=null==t?void 0:t.current;if(n&&e){var o=function(){if(n){var e=n.scrollHeight>n.clientHeight;l(e)}};o();var i=new ResizeObserver((function(){o()}));return i.observe(n),function(){n&&i.unobserve(n)}}}),[r,t])}({headerContainerRef:u,mainSectionRef:k,scrollbarWidth:E});var W,O,P=n.useRef(null),B=(W=0,(O=function(e){e.forEach((function(e){W+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&O(e.rowMeta.children)}))})(c),W)*(S+1)-1,F=n.useMemo((function(){return T({headersRef:N,hiddenColumns:H,pinnedLeftColumns:v,pinnedRightColumns:w})}),[N,H,v,w]),A=n.useMemo((function(){var e={};return R.forEach((function(n,r){var t=String(n.row.rowMeta.rowId);e[t]=r})),e}),[R]),z=function(e){var n=function(t){return t.rowMeta.rowId===e&&t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{isExpanded:!t.rowMeta.isExpanded})}):t.rowMeta.children?r(r({},t),{rowMeta:r(r({},t.rowMeta),{children:t.rowMeta.children.map(n)})}):t};C((function(e){return e.map(n)}))},U=(null===(o=m.current)||void 0===o?void 0:o.clientWidth)?(null===(i=m.current)||void 0===i?void 0:i.clientWidth)+1:0,q=null===(a=d.current)||void 0===a?void 0:a.clientWidth,K=(null===(l=p.current)||void 0===l?void 0:l.clientWidth)?(null===(s=p.current)||void 0===s?void 0:s.clientWidth)+1:0,V={headerContainerRef:u,headers:N.current,hiddenColumns:H,isWidthDragging:f,rowHeight:S,visibleRows:R,columnIndices:F,rowIndices:A};return e.jsxs("div",r({className:"st-table-body-container",ref:k,onScroll:function(e){var n=e.currentTarget.scrollTop;P.current&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame((function(){I(n)}))}},{children:[v.length>0&&e.jsx(L,r({},V,{onExpandRowClick:z,pinned:"left",sectionRef:j,templateColumns:g,totalHeight:B,width:U})),e.jsx(L,r({},V,{onExpandRowClick:z,sectionRef:M,templateColumns:h,totalHeight:B,width:q})),w.length>0&&e.jsx(L,r({},V,{onExpandRowClick:z,pinned:"right",sectionRef:D,templateColumns:x,totalHeight:B,width:K}))]}))},P=function(e,r){n.useEffect((function(){if(e.current){var n=e.current,t=function(){var e,t=null==n?void 0:n.scrollLeft;void 0!==t&&(null===(e=r.current)||void 0===e||e.scrollTo(t,0))};return n.addEventListener("scroll",t),function(){null==n||n.removeEventListener("scroll",t)}}}),[e,r])},B={string:function(e,n,r){if(e===n)return 0;var t=e.localeCompare(n);return"ascending"===r?t:-t},number:function(e,n,r){if(e===n)return 0;var t=e-n;return"ascending"===r?t:-t},boolean:function(e,n,r){if(e===n)return 0;var t=e===n?0:e?-1:1;return"ascending"===r?t:-t},date:function(e,n,r){var t=new Date(e),o=new Date(n);if(t.getTime()===o.getTime())return 0;var i=t.getTime()-o.getTime();return"ascending"===r?i:-i},enum:function(e,n,r){return B.string(e,n,r)},default:function(e,n,r){return e===n?0:null==e?"ascending"===r?-1:1:null==n?"ascending"===r?1:-1:"string"==typeof e&&"string"==typeof n?B.string(e,n,r):"number"==typeof e&&"number"==typeof n?B.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?B.boolean(e,n,r):B.string(String(e),String(n),r)}},F=function(e,n,r,t){if(void 0===r&&(r="string"),null==e||""===e)return"ascending"===t?-1:1;if(null==n||""===n)return"ascending"===t?1:-1;if("number"===r){var o=function(e){var n;if("number"==typeof e)return e;var r=String(e);if("string"==typeof r){var t=r.replace(/[$,]/g,"").match(/^([-+]?\d*\.?\d+)([TBMKtbmk])?/);if(t){var o=parseFloat(t[1]),i=null===(n=t[2])||void 0===n?void 0:n.toUpperCase();return"T"===i?o*=1e12:"B"===i?o*=1e9:"M"===i?o*=1e6:"K"===i&&(o*=1e3),o}}return parseFloat(r)||0},i=o(e),a=o(n);return B.number(i,a,t)}return"date"===r?B.date(String(e),String(n),t):"boolean"===r?B.boolean(Boolean(e),Boolean(n),t):"enum"===r?B.enum(String(e),String(n),t):B.string(String(e),String(n),t)},A=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction,s=new Map,d=new Map,c="";e.forEach((function(e){var r;if(e.rowData&&!e.rowData[n.key.accessor]&&void 0!==e.rowMeta.isExpanded){var t=(e.rowData.sector||"group_".concat(s.size)).toString();c=t,d.set(c,e),s.has(c)||s.set(c,[])}else if(c){var o=s.get(c)||[];o.push(e),s.set(c,o)}else{var i="default";s.has(i)||s.set(i,[]),null===(r=s.get(i))||void 0===r||r.push(e)}}));var u=[];return s.forEach((function(e,i){if(d.has(i)){var s=d.get(i);s.rowMeta.children&&s.rowMeta.children.length>0&&(s.rowMeta.children=z(s.rowMeta.children,n,o)),u.push(s)}var c=t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return F(o,i,a,l)}));u.push.apply(u,c.map((function(e){var t=r({},e);if(t.rowMeta.children&&t.rowMeta.children.length>0){var i=z(t.rowMeta.children,n,o);t.rowMeta=r(r({},t.rowMeta),{children:i})}return t})))})),u},z=function(e,n,o){var i=o.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction;return t([],e,!0).sort((function(e,r){if(!(null==e?void 0:e.rowData)||!(null==r?void 0:r.rowData))return 0;var t=n.key.accessor,o=e.rowData[t],i=r.rowData[t];return F(o,i,a,l)})).map((function(e){return e.rowMeta.children&&e.rowMeta.children.length>0?r(r({},e),{rowMeta:r(r({},e.rowMeta),{children:z(e.rowMeta.children,n,o)})}):e}))},U=function(e){var n=e.colIndex,r=e.event,t=e.forceUpdate,o=e.header,i=e.headersRef;e.reverse;var a=e.setIsWidthDragging,l=e.startWidth;a(!0),r.preventDefault();var s=r.clientX;if(o){var d=function(e){var r=Math.max(l+(e.clientX-s),40);o&&i.current&&(i.current[n].width=r,t())},c=function(){document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",c),a(!1)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",c)}},q=n.forwardRef((function(o,i){var a=o.colIndex,l=o.gridColumnEnd,s=o.gridColumnStart,d=o.gridRowEnd,c=o.gridRowStart,u=o.header,h=o.reverse,v=o.sort,m=y(),g=m.columnReordering,w=m.columnResizing,p=m.draggedHeaderRef,C=m.forceUpdate,I=m.headersRef,b=m.hoveredHeaderRef,S=m.onColumnOrderChange,E=m.onSort,M=m.onTableHeaderDragEnd,j=m.rowHeight,D=m.selectColumns,k=m.selectableColumns,H=m.setInitialFocusedCell,N=m.setIsWidthDragging,L=m.setSelectedCells,T=m.setSelectedColumns,W=m.sortDownIcon,O=m.sortUpIcon,P=n.useState(!1),B=P[0],F=P[1],A=Boolean(null==u?void 0:u.isSortable),z="st-header-cell ".concat(u===b.current?"st-hovered":""," ").concat(B?"st-dragging":""," ").concat(A?"clickable":""," ").concat(g&&!A?"columnReordering":""," ").concat("right"===(null==u?void 0:u.align)?"right-aligned":"center"===(null==u?void 0:u.align)?"center-aligned":""),q=R({draggedHeaderRef:p,headersRef:I,hoveredHeaderRef:b,onColumnOrderChange:S,onTableHeaderDragEnd:M}),K=q.handleDragStart,V=q.handleDragEnd,J=q.handleDragOver,X=x(),Y=function(e){var n=e.event,r=e.header;if(k){var o=function(e,n){if(!e.children||0===e.children.length)return[n];var r=[],t=function(e,n){if(!e.children||0===e.children.length)return r.push(n),n+1;for(var o=n,i=0,a=e.children;i<a.length;i++){var l=a[i];o=t(l,o)}return o};return t(e,n),r}(r,a);return n.shiftKey&&D?T((function(e){if(0===e.size)return new Set(o);var n=o[0],r=Array.from(e).sort((function(e,n){return e-n})),i=r[0],a=Math.abs(n-i);r.forEach((function(e){var r=Math.abs(n-e);r<a&&(a=r,i=e)}));var l,s,d,c,u=t(t([],(l=i,s=n,d=Math.min(l,s),c=Math.max(l,s),Array.from({length:c-d+1},(function(e,n){return d+n}))),!0),o,!0);return new Set(t(t([],Array.from(e),!0),u,!0))})):D&&D(o),L(new Set),void H(null)}r.isSortable&&E(a,r.accessor)};if(n.useEffect((function(){var e=function(e){e.preventDefault(),e.dataTransfer.dropEffect="move"};return document.addEventListener("dragover",e),function(){document.removeEventListener("dragover",e)}}),[]),!u)return null;var G=w&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;X({callback:U,callbackProps:{colIndex:a,event:e,forceUpdate:C,header:u,headersRef:I,setIsWidthDragging:N,startWidth:"object"==typeof i&&null!==i&&"current"in i?null===(n=i.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),_=v&&v.key.accessor===u.accessor&&e.jsxs("div",r({className:"st-sort-icon-container",onClick:function(e){return Y({event:e,header:u})}},{children:["ascending"===v.direction&&O&&O,"descending"===v.direction&&W&&W]}));return e.jsxs("div",r({className:z,id:f({accessor:u.accessor,rowIndex:0}),onDragOver:function(e){X({callback:J,callbackProps:{event:e,hoveredHeader:u},limit:50})},ref:i,style:r(r({gridRowStart:c,gridRowEnd:d,gridColumnStart:s,gridColumnEnd:l},l-s>1?{}:{width:u.width}),d-c>1?{}:{height:j})},{children:[h&&G,e.jsxs("div",r({className:"st-header-label ".concat("right"===u.align?"right-aligned":"center"===u.align?"center-aligned":""),draggable:g,onClick:function(e){return Y({event:e,header:u})},onDragEnd:function(e){e.preventDefault(),F(!1),V()},onDragStart:function(e){g&&u&&function(e){F(!0),K(e)}(u)}},{children:["right"===u.align&&_,null==u?void 0:u.label,"right"!==u.align&&_]})),!h&&G]}))})),K=function(r){var t=r.columnIndices,o=r.depth,i=r.header,a=r.hiddenColumns,l=r.maxDepth,s=r.pinned,d=r.gridPosition,c=r.reverse,u=r.sort;if(!h({hiddenColumns:a,header:i,pinned:s}))return null;var f=d.gridColumnStart,v=d.gridColumnEnd,m=d.gridRowStart,g=d.gridRowEnd,w=t[i.accessor];if(i.children){var p=i.children.filter((function(e){return h({hiddenColumns:a,header:e,pinned:s})}));return e.jsxs(n.Fragment,{children:[e.jsx(q,{colIndex:w,gridColumnEnd:v,gridColumnStart:f,gridRowEnd:g,gridRowStart:m,header:i,ref:n.createRef(),reverse:c,sort:u}),p.map((function(n,r){var i,f=null===(i=d.children)||void 0===i?void 0:i[n.accessor];return f?e.jsx(K,{columnIndices:t,depth:o+1,gridPosition:f,header:n,hiddenColumns:a,maxDepth:l,pinned:s,reverse:c,sort:u},n.accessor):null}))]})}return e.jsx(q,{colIndex:w,gridColumnEnd:v,gridColumnStart:f,gridRowEnd:g,gridRowStart:m,header:i,ref:n.createRef(),reverse:c,sort:u})},V=function(t){var o=t.columnIndices,i=t.gridTemplateColumns,a=t.handleScroll,l=t.headersRef,s=t.hiddenColumns,d=t.maxDepth,c=t.pinned,u=t.sectionRef,f=t.sort,v=l.current.filter((function(e){return h({hiddenColumns:s,header:e,pinned:c})})),m=n.useMemo((function(){var e,n,r;return e={},n=1,r=function(t,o,i){var a,l;void 0===i&&(i=!1),i||n++;var u=null!==(l=null===(a=t.children)||void 0===a?void 0:a.filter((function(e){return h({hiddenColumns:s,header:e,pinned:c})})).length)&&void 0!==l?l:0,f={gridColumnStart:n,gridColumnEnd:u>0?n+u:n+1,gridRowStart:o,gridRowEnd:u>0?o+1:d+1,children:{}};return t.children&&t.children.length>0&&t.children.filter((function(e){return h({hiddenColumns:s,header:e,pinned:c})})).forEach((function(e,n){f.children[e.accessor]=r(e,o+1,0===n)})),e[t.accessor]=f,f},v.forEach((function(e,n){r(e,1,0===n)})),e}),[v,s,d,c]);return e.jsx("div",r({className:"st-header-".concat(c?"pinned-".concat(c):"main")},a&&{onScroll:a},{ref:u,style:{gridTemplateColumns:i}},{children:e.jsx(M,r({rowIndex:0},{children:v.map((function(n){var r=m[n.accessor];return r?e.jsx(K,{columnIndices:o,depth:1,gridPosition:r,header:n,hiddenColumns:s,maxDepth:d,pinned:c,reverse:"right"===c,sort:f},n.accessor):null}))}))}))},J=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(J)):1},X=function(t){var o=t.centerHeaderRef,i=t.headerContainerRef,a=t.headersRef,l=t.hiddenColumns,s=t.mainTemplateColumns,d=t.pinnedLeftColumns,c=t.pinnedLeftHeaderRef,u=t.pinnedLeftTemplateColumns,f=t.pinnedRightColumns,v=t.pinnedRightHeaderRef,m=t.pinnedRightTemplateColumns,g=t.sort,w=y().mainBodyRef;P(w,o);var p=n.useMemo((function(){return T({headersRef:a,hiddenColumns:l,pinnedLeftColumns:d,pinnedRightColumns:f})}),[a,l,d,f]),x=n.useMemo((function(){var e=a.current,n=0;return e.forEach((function(e){if(h({hiddenColumns:l,header:e})){var r=J(e);n=Math.max(n,r)}})),{maxDepth:n}}),[a,l]).maxDepth;return e.jsxs("div",r({className:"st-header-container",ref:i},{children:[d.length>0&&e.jsx(V,{columnIndices:p,gridTemplateColumns:u,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:x,pinned:"left",sectionRef:c,sort:g}),e.jsx(V,{columnIndices:p,gridTemplateColumns:s,handleScroll:function(e){var n,r,t=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=w.current)||void 0===r||r.scrollTo(t,0))},headersRef:a,hiddenColumns:l,maxDepth:x,sectionRef:o,sort:g}),f.length>0&&e.jsx(V,{columnIndices:p,gridTemplateColumns:m,handleScroll:void 0,headersRef:a,hiddenColumns:l,maxDepth:x,pinned:"right",sectionRef:v,sort:g})]}))},Y=function(e){var n=e.headers,r=e.hiddenColumns,t=function(e){var n=e.headers,o=e.flattenedHeaders;return n.forEach((function(e){!0!==r[e.accessor]&&(e.children?t({headers:e.children,flattenedHeaders:o}):o.push(e))})),o},o=t({headers:n,flattenedHeaders:[]});return"".concat(o.map((function(e){return function(e){var n=e.minWidth,r=e.width;return"number"==typeof r&&(r="".concat(r,"px")),n&&"number"==typeof n&&(n="".concat(n,"px")),void 0!==n?"minmax(".concat(n,", ").concat(r,")"):r}(e)})).join(" "))},G=function(t){var o=t.flattenedRows,i=t.isWidthDragging,a=t.setFlattenedRows,l=t.setScrollTop,s=t.sort,d=t.visibleRows,c=y(),u=c.editColumns,f=c.headersRef,h=c.hiddenColumns,v=n.useRef(null),m=n.useRef(null),g=n.useRef(null),w=n.useRef(null),p=f.current.filter((function(e){return!e.pinned})),x=f.current.filter((function(e){return"left"===e.pinned})),C=f.current.filter((function(e){return"right"===e.pinned})),I=n.useMemo((function(){return Y({headers:x,hiddenColumns:h})}),[x,h]),R=n.useMemo((function(){return Y({headers:p,hiddenColumns:h})}),[p,h]),b=n.useMemo((function(){return Y({headers:C,hiddenColumns:h})}),[C,h]),S={centerHeaderRef:g,headerContainerRef:v,headersRef:f,hiddenColumns:h,mainTemplateColumns:R,pinnedLeftColumns:x,pinnedLeftHeaderRef:m,pinnedLeftTemplateColumns:I,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,sort:s},E={centerHeaderRef:g,flattenedRows:o,headerContainerRef:v,isWidthDragging:i,mainTemplateColumns:R,pinnedLeftColumns:x,pinnedLeftHeaderRef:m,pinnedLeftTemplateColumns:I,pinnedRightColumns:C,pinnedRightHeaderRef:w,pinnedRightTemplateColumns:b,setFlattenedRows:a,setScrollTop:l,visibleRows:d};return e.jsxs("div",r({className:"st-table-content",style:{width:u?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(X,r({},S)),e.jsx(O,r({},E))]}))},_=function(e){var r=e.callback,t=e.ref,o=e.widthAttribute;n.useEffect((function(){var e=t.current;if(e){var n=function(){r(e[o]||0)};n();var i=new ResizeObserver((function(){n()}));return i.observe(e),function(){return i.disconnect()}}}),[r,t,o])},$=function(t){var o=t.mainBodyRef,i=t.pinnedLeftRef,a=t.pinnedRightRef,l=t.tableContentWidth,s=n.useState(0),d=s[0],c=s[1],u=n.useState(0),f=u[0],h=u[1],v=n.useState(0),m=v[0],g=v[1],w=n.useRef(null);return _({widthAttribute:"offsetWidth",callback:c,ref:i}),_({widthAttribute:"scrollWidth",callback:g,ref:o}),_({widthAttribute:"offsetWidth",callback:h,ref:a}),P(o,w),!o.current||o.current.scrollWidth<=o.current.clientWidth?null:e.jsxs("div",r({className:"st-horizontal-scrollbar-container",style:{width:l}},{children:[d>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:d}}),m>0&&e.jsx("div",r({className:"st-horizontal-scrollbar-middle",onScroll:function(e){var n=e.target.scrollLeft;void 0!==n&&o.current&&o.current.scrollTo({left:n,behavior:"auto"})},ref:w},{children:e.jsx("div",{style:{width:m}})})),f>0&&e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:f}})]}))},Q=function(e){var r=e.headers,t=e.tableRows,o=n.useState(null),i=o[0],a=o[1],l=n.useMemo((function(){var e={};return r.forEach((function(n){!0===n.hide&&(e[n.accessor]=!0)})),e}),[r]),s=n.useState(l),d=s[0],c=s[1],u=n.useMemo((function(){if(!i)return t;var e=function(e,n,r){return{sortedData:A(n,r,e),newSortConfig:r}}(r,t,i).sortedData;return e}),[t,i,r]);return{sort:i,setSort:a,updateSort:function(e,n){var t=r.find((function(e){return e.accessor===n}));t&&a((function(e){return e&&e.key.accessor===n?"ascending"===e.direction?{key:t,direction:"descending"}:null:{key:t,direction:"ascending"}}))},sortedRows:u,hiddenColumns:d,setHiddenColumns:c}},Z=function(t){var o=t.checked,i=void 0!==o&&o,a=t.children,l=t.onChange,s=n.useState(i),d=s[0],c=s[1];return e.jsxs("label",r({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:d,className:"st-checkbox-input",onChange:function(){var e=!d;c(e),l&&l(e)},type:"checkbox"}),e.jsx("span",r({className:"st-checkbox-custom ".concat(d?"st-checked":"")},{children:d&&e.jsx("span",{className:"st-checkbox-checkmark"})})),a]}))},ee=function(n){var t=n.headers,o=n.open,i=n.position;n.setOpen;var a=n.setHiddenColumns,l=n.hiddenColumns,s="left"===i?"left":"";return e.jsx("div",r({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(s),onClick:function(e){return e.stopPropagation()}},{children:e.jsx("div",r({className:"st-column-editor-popout-content"},{children:t.map((function(n,t){return e.jsx(Z,r({checked:l[n.accessor],onChange:function(e){var t;return a(r(r({},l),((t={})[n.accessor]=e,t)))}},{children:n.label}),t)}))}))}))},ne=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,l=t.headers,s=t.position,d=void 0===s?"right":s,c=t.setHiddenColumns,u=t.hiddenColumns,f=n.useState(a),h=f[0],v=f[1];return i?e.jsxs("div",r({className:"st-column-editor ".concat(h?"open":""," ").concat(d),onClick:function(){return function(e){v(e)}(!h)}},{children:[e.jsx("div",r({className:"st-column-editor-text"},{children:o})),e.jsx(ee,{headers:l,open:h,position:d,setOpen:v,setHiddenColumns:c,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(W||(W={}));var re=n.memo((function(t){var c=t.allowAnimations,u=void 0!==c&&c,f=t.columnEditorPosition,h=void 0===f?W.Right:f,v=t.columnEditorText,m=void 0===v?"Columns":v,g=t.columnResizing,w=void 0!==g&&g,p=t.defaultHeaders,x=t.editColumns,C=void 0!==x&&x,I=t.editColumnsInitOpen,R=void 0!==I&&I,b=t.columnReordering,y=void 0!==b&&b,E=t.height,M=t.hideFooter,j=void 0!==M&&M,D=t.nextIcon,k=void 0===D?e.jsx(l,{className:"st-next-prev-icon"}):D,H=t.onCellEdit,N=t.onColumnOrderChange,L=t.onNextPage,T=t.onPreviousPage,O=t.prevIcon,P=void 0===O?e.jsx(a,{className:"st-next-prev-icon"}):O,B=t.rowHeight,F=void 0===B?40:B,A=t.rows,z=t.rowsPerPage,U=void 0===z?10:z,q=t.selectableCells,K=void 0!==q&&q,V=t.selectableColumns,J=void 0!==V&&V,X=t.shouldPaginate,Y=void 0!==X&&X,_=t.sortDownIcon,Z=void 0===_?e.jsx(d,{className:"st-sort-icon"}):_,ee=t.sortUpIcon,re=void 0===ee?e.jsx(s,{className:"st-sort-icon"}):ee,te=t.theme,oe=void 0===te?"light":te,ie=t.totalPages,ae=n.useRef(null),le=n.useRef(p),se=n.useRef(null),de=n.useRef(null),ce=n.useRef(null),ue=n.useRef(null),fe=n.useRef(null),he=n.useState(!1),ve=he[0],me=he[1],ge=n.useState(1),we=ge[0],pe=ge[1],xe=n.useState(0),Ce=xe[0],Ie=xe[1],Re=n.useState(0),be=Re[0],Se=Re[1],ye=n.useState(0),Ee=ye[0],Me=ye[1],je=Q({headers:le.current,tableRows:A}),De=je.sort,ke=je.sortedRows,He=je.hiddenColumns,Ne=je.setHiddenColumns,Le=je.updateSort,Te=n.useMemo((function(){if(!Y)return ke;var e=(we-1)*U,n=e+U;return ke.slice(e,n)}),[we,U,Y,ke]),We=n.useState(Te),Oe=We[0],Pe=We[1];n.useEffect((function(){Pe(Te)}),[Te]);var Be=n.useMemo((function(){var e;if(!E)return window.innerHeight-F;var n=document.querySelector(".simple-table-root"),r=0;if(E.endsWith("px"))r=parseInt(E,10);else if(E.endsWith("vh")){var t=parseInt(E,10);r=window.innerHeight*t/100}else if(E.endsWith("%")){var o=parseInt(E,10);r=((null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.clientHeight)||window.innerHeight)*o/100}else r=window.innerHeight;return Math.max(0,r-F)}),[E,F]),Fe=n.useMemo((function(){return function(e){var n=e.bufferRowCount,r=e.contentHeight,t=e.flattenedRows,o=e.rowHeight,i=e.scrollTop,a=[],l=0,s=Math.max(0,i-o*n),d=i+r+o*n,c=function(e,n){for(var r,t=0,i=e;t<i.length;t++){var u=i[t],f=l*o;if(f>=d)break;f+o>s&&a.push({row:u,depth:n,position:l,isLastGroupRow:Boolean(null===(r=u.rowMeta.children)||void 0===r?void 0:r.length)&&n>1}),l+=1,u.rowMeta.isExpanded&&u.rowMeta.children&&c(u.rowMeta.children,n+1)}};return c(t,0),a}({bufferRowCount:5,contentHeight:Be,flattenedRows:Oe,rowHeight:F,scrollTop:Ee})}),[Be,F,Oe,Ee]),Ae=n.useReducer((function(e){return e+1}),0)[1],ze=function(e){var r=e.selectableCells,t=e.headers,i=e.visibleRows,a=n.useState(new Set),l=a[0],s=a[1],d=n.useState(new Set),c=d[0],u=d[1],f=n.useState(null),h=f[0],v=f[1],m=n.useState(null),g=m[0],w=m[1],p=n.useRef(!1),x=n.useRef(null),C=n.useCallback((function(){var e=Array.from(l).reduce((function(e,n){var r=n.split("-").map(Number),o=r[0],a=r[1];return e[o]||(e[o]=[]),e[o][a]=i[o].row.rowData[t[a].accessor],e}),{}),n=Object.values(e).map((function(e){return Object.values(e).join("\t")})).join("\n");l.size>0&&navigator.clipboard.writeText(n)}),[t,l,i]),I=n.useCallback((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),a=Math.max(e.rowIndex,n.rowIndex),l=Math.min(e.colIndex,n.colIndex),d=Math.max(e.colIndex,n.colIndex),c=t;c<=a;c++)for(var f=l;f<=d;f++)if(c>=0&&c<i.length){var h=i[c].row.rowMeta.rowId;r.add(o({colIndex:f,rowIndex:c,rowId:h}))}u(new Set),v(null),s(r)}),[i,u,v,s]),R=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<i.length&&e.colIndex>=0&&e.colIndex<t.length){var n=o(e);u(new Set),v(null),s(new Set([n])),w(e)}}),[t.length,i.length,u,v,s,w]),b=n.useCallback((function(e,n){void 0===n&&(n=!1),s(new Set),w(null),u((function(r){var t=new Set(n?r:[]);return e.forEach((function(e){return t.add(e)})),t})),e.length>0&&v(e[e.length-1])}),[s,w,u,v]);n.useEffect((function(){var e=function(e){if(r&&g){var n=g.rowIndex,o=g.colIndex,a=g.rowId;if(!e.ctrlKey&&!e.metaKey||"c"!==e.key){if(i[n].row.rowMeta.rowId!==a){var l=i.findIndex((function(e){return e.row.rowMeta.rowId===a}));if(-1===l)return;n=l}if("ArrowUp"===e.key){if(e.preventDefault(),n>0){var d={rowIndex:n-1,colIndex:o,rowId:i[n-1].row.rowMeta.rowId};R(d)}}else"ArrowDown"===e.key?(e.preventDefault(),n<i.length-1&&(d={rowIndex:n+1,colIndex:o,rowId:i[n+1].row.rowMeta.rowId},R(d))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),o>0&&(d={rowIndex:n,colIndex:o-1,rowId:i[n].row.rowMeta.rowId},R(d))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),o<t.length-1&&(d={rowIndex:n,colIndex:o+1,rowId:i[n].row.rowMeta.rowId},R(d))):"Escape"===e.key&&(s(new Set),u(new Set),v(null),x.current=null,w(null))}else C()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[C,t.length,g,I,R,r,i]);var S=n.useCallback((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,i=o({colIndex:n,rowIndex:r,rowId:t}),a=l.has(i),s=c.has(n);return a||s}),[l,c]),y=n.useCallback((function(e){var n,r,t,o,a,l,s=e.colIndex,d=e.rowIndex,u=e.rowId,f=[],h=null===(t=null===(r=null===(n=i[d-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,v={colIndex:s,rowIndex:d+1,rowId:null===(l=null===(a=null===(o=i[d+1])||void 0===o?void 0:o.row)||void 0===a?void 0:a.rowMeta)||void 0===l?void 0:l.rowId},m={colIndex:s-1,rowIndex:d,rowId:u},g={colIndex:s+1,rowIndex:d,rowId:u};return(!S({colIndex:s,rowIndex:d-1,rowId:h})||c.has(s)&&0===d)&&f.push("st-selected-top-border"),(!S(v)||c.has(s)&&d===i.length-1)&&f.push("st-selected-bottom-border"),S(m)||f.push("st-selected-left-border"),S(g)||f.push("st-selected-right-border"),f.join(" ")}),[S,i,c]),E=n.useMemo((function(){return g?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===g.rowIndex&&r===g.colIndex&&t===g.rowId}:function(){return!1}}),[g]);return{getBorderClass:y,handleMouseDown:function(e){var n=e.colIndex,t=e.rowIndex,i=e.rowId;if(r){p.current=!0,x.current={rowIndex:t,colIndex:n,rowId:i},u(new Set),v(null);var a=o({colIndex:n,rowIndex:t,rowId:i});s(new Set([a])),w({rowIndex:t,colIndex:n,rowId:i})}},handleMouseOver:function(e){var n=e.colIndex,t=e.rowIndex;if(e.rowId,r&&p.current&&x.current){for(var a=new Set,l=Math.min(x.current.rowIndex,t),d=Math.max(x.current.rowIndex,t),c=Math.min(x.current.colIndex,n),u=Math.max(x.current.colIndex,n),f=l;f<=d;f++)for(var h=c;h<=u;h++)if(f>=0&&f<i.length){var v=i[f].row.rowMeta.rowId;a.add(o({colIndex:h,rowIndex:f,rowId:v}))}s(a)}},handleMouseUp:function(){p.current=!1},isInitialFocusedCell:E,isSelected:S,lastSelectedColumnIndex:h,selectColumns:b,selectedCells:l,selectedColumns:c,setInitialFocusedCell:w,setSelectedCells:s,setSelectedColumns:u}}({selectableCells:K,headers:le.current,visibleRows:Fe}),Ue=ze.handleMouseDown,qe=ze.handleMouseOver,Ke=ze.handleMouseUp,Ve=ze.isSelected,Je=ze.getBorderClass,Xe=ze.isInitialFocusedCell,Ye=ze.setSelectedCells,Ge=ze.setSelectedColumns,_e=ze.selectColumns,$e=ze.setInitialFocusedCell,Qe=n.useCallback((function(e,n){Le(e,n)}),[Le]),Ze=n.useCallback((function(e){le.current=e,Ae()}),[]);return n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||J&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||(Ye(new Set),J&&Ge(new Set))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[J,Ye,Ge]),n.useLayoutEffect((function(){if(fe.current){var e=fe.current.offsetWidth-fe.current.clientWidth,n=fe.current.clientWidth;Ie(e),Se(n)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Ae(),fe.current){var e=fe.current.offsetWidth-fe.current.clientWidth,n=fe.current.clientWidth;Ie(e),Se(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),e.jsx(S,r({value:{allowAnimations:u,columnReordering:y,columnResizing:w,draggedHeaderRef:ae,editColumns:C,forceUpdate:Ae,getBorderClass:Je,handleMouseDown:Ue,handleMouseOver:qe,headersRef:le,hiddenColumns:He,hoveredHeaderRef:se,isInitialFocusedCell:Xe,isSelected:Ve,mainBodyRef:de,onCellEdit:H,onColumnOrderChange:N,onSort:Qe,onTableHeaderDragEnd:Ze,pinnedLeftRef:ce,pinnedRightRef:ue,rowHeight:F,scrollbarWidth:Ce,selectColumns:_e,selectableColumns:J,setInitialFocusedCell:$e,setIsWidthDragging:me,setSelectedCells:Ye,setSelectedColumns:Ge,shouldPaginate:Y,sortDownIcon:Z,sortUpIcon:re,tableBodyContainerRef:fe}},{children:e.jsxs("div",r({className:"simple-table-root st-wrapper theme-".concat(oe),style:E?{height:E}:{}},{children:[e.jsxs("div",r({className:"st-table-wrapper-container"},{children:[e.jsxs("div",r({className:"st-table-wrapper",onMouseUp:Ke,onMouseLeave:Ke},{children:[e.jsx(G,{flattenedRows:Oe,isWidthDragging:ve,setFlattenedRows:Pe,setScrollTop:Me,sort:De,visibleRows:Fe}),e.jsx(ne,{columnEditorText:m,editColumns:C,editColumnsInitOpen:R,headers:le.current,hiddenColumns:He,position:h,setHiddenColumns:Ne})]})),e.jsx($,{mainBodyRef:de,pinnedLeftRef:ce,pinnedRightRef:ue,tableContentWidth:be})]})),e.jsx(i,{currentPage:we,hideFooter:j,nextIcon:k,onPageChange:pe,onNextPage:L,onPreviousPage:T,prevIcon:P,shouldPaginate:Y,totalPages:ie||Math.ceil(ke.length/U)})]}))}))}));exports.SimpleTable=re;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,7 +3,9 @@ import { Pinned } from "./Pinned";
|
|
|
3
3
|
import { SortConfig } from "..";
|
|
4
4
|
import { HeaderObject } from "..";
|
|
5
5
|
import { RefObject } from "react";
|
|
6
|
+
import { ColumnIndices } from "../utils/columnIndicesUtils";
|
|
6
7
|
interface TableHeaderSectionProps {
|
|
8
|
+
columnIndices: ColumnIndices;
|
|
7
9
|
gridTemplateColumns: string;
|
|
8
10
|
handleScroll?: UIEventHandler<HTMLDivElement>;
|
|
9
11
|
headersRef: RefObject<HeaderObject[]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import HeaderObject from "../types/HeaderObject";
|
|
2
|
+
export type ColumnIndices = Record<string, number>;
|
|
3
|
+
/**
|
|
4
|
+
* Calculates column indices for all headers to ensure consistent colIndex values
|
|
5
|
+
* This function is used in both TableBody and TableHeader components
|
|
6
|
+
*
|
|
7
|
+
* Note: In hierarchical headers, a parent header and its first child can share
|
|
8
|
+
* the same column index, which is needed for proper alignment in the grid.
|
|
9
|
+
*/
|
|
10
|
+
export declare function calculateColumnIndices({ headersRef, hiddenColumns, pinnedLeftColumns, pinnedRightColumns, }: {
|
|
11
|
+
headersRef: {
|
|
12
|
+
current: HeaderObject[];
|
|
13
|
+
};
|
|
14
|
+
hiddenColumns: Record<string, boolean>;
|
|
15
|
+
pinnedLeftColumns: HeaderObject[];
|
|
16
|
+
pinnedRightColumns: HeaderObject[];
|
|
17
|
+
}): ColumnIndices;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-table-core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.45",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"publish-fast": "npm run build && git add . && git commit -m \"$npm_config_message\" && npm publish && git push",
|
|
70
70
|
"build": "rollup -c",
|
|
71
71
|
"start": "storybook dev -p 6006",
|
|
72
|
-
"build-storybook": "storybook build"
|
|
72
|
+
"build-storybook": "storybook build",
|
|
73
|
+
"preview": "rollup -c -w"
|
|
73
74
|
},
|
|
74
75
|
"eslintConfig": {
|
|
75
76
|
"extends": [
|