simple-table-core 0.7.26 → 0.7.28

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.
@@ -2,7 +2,7 @@ import HeaderObject from "../../types/HeaderObject";
2
2
  import TableBodyProps from "../../types/TableBodyProps";
3
3
  import { RowId } from "../../types/RowId";
4
4
  import VisibleRow from "../../types/VisibleRow";
5
- import { Pinned } from "../../enums/Pinned";
5
+ import { Pinned } from "../../types/Pinned";
6
6
  type RenderCellsProps = {
7
7
  headers: HeaderObject[];
8
8
  hiddenColumns: Record<string, boolean>;
@@ -1,7 +1,7 @@
1
1
  import { RowId } from "../../types/RowId";
2
2
  import TableBodyProps from "../../types/TableBodyProps";
3
3
  import VisibleRow from "../../types/VisibleRow";
4
- import { Pinned } from "../../enums/Pinned";
4
+ import { Pinned } from "../../types/Pinned";
5
5
  declare const TableRow: ({ getNextRowIndex, gridTemplateColumns, index, pinned, props, rowHeight, visibleRow, }: {
6
6
  getNextRowIndex: () => number;
7
7
  gridTemplateColumns: string;
@@ -2,7 +2,7 @@ import { RefObject } from "react";
2
2
  import TableBodyProps from "../../types/TableBodyProps";
3
3
  import VisibleRow from "../../types/VisibleRow";
4
4
  import { RowId } from "../../types/RowId";
5
- import { Pinned } from "../../enums/Pinned";
5
+ import { Pinned } from "../../types/Pinned";
6
6
  declare const TableSection: ({ headerContainerRef, onExpandRowClick, pinned, rowHeight, sectionRef, templateColumns, totalHeight, visibleRows, width, ...props }: {
7
7
  headerContainerRef: RefObject<HTMLDivElement | null>;
8
8
  onExpandRowClick: (rowId: RowId) => void;
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,forwardRef as d,useLayoutEffect as c,createElement as s,Fragment as u,createRef as h,memo as f,useReducer as v}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){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}function m(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,I=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},R=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)}))]}))},C=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"})}))},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 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},y=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"})}))},H=function(e){return e.position*(e.rowHeight+1)-1},M=function(e){return e.position*(e.rowHeight+1)},D=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},E=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},S=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"}))]}))},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(S,{onBlur:l,onChange:a,value:i}):"number"==typeof i?n(N,{defaultValue:i,onBlur:l,onChange:a}):null})},L=0,O=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))}},B=Date.now(),W={screenX:0,screenY:0},A=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,B=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-W.screenX,2)+Math.pow(u-W.screenY,2));l.current=o;var f=m([],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})),w=f.splice(v,1)[0];if(f.splice(g,0,w),!(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-B<800&&h<50||(B=p,W={screenX:d,screenY:u},c(f))}}},handleDragEnd:function(){t.current=null,l.current=null,null==d||d(i.current)}}},P=d((function(r,o){var i,l,d=r.borderClass,c=r.colIndex,s=r.draggedHeaderRef,u=r.header,h=r.headersRef,f=r.hoveredHeaderRef,v=r.isSelected,w=r.isInitialFocusedCell,m=r.onCellEdit,p=r.onExpandRowClick,I=r.onMouseDown,R=r.onMouseOver,C=r.onTableHeaderDragEnd,b=r.rowIndex,H=r.visibleRow,M=H.depth,E=H.row,S=t(E.rowData[u.accessor]),k=S[0],N=S[1],L=t(!1),B=L[0],W=L[1],P=A({draggedHeaderRef:s,headersRef:h,hoveredHeaderRef:f,onTableHeaderDragEnd:C}).handleDragOver,F=O(),z="cell-".concat(b,"-").concat(c),U=Boolean(null===(l=null===(i=E.rowMeta)||void 0===i?void 0:i.children)||void 0===l?void 0:l.length),j=Boolean(null==u?void 0:u.isEditable),G=b%2==0,K="st-cell ".concat(M>0&&u.expandable?"st-cell-depth-".concat(M):""," ").concat(v?w?"st-cell-selected-first ".concat(d):"st-cell-selected ".concat(d):""," ").concat(G?"st-cell-odd-row":"st-cell-even-row"," ").concat(j?"clickable":"");a((function(){N(E.rowData[u.accessor])}),[u.accessor,E]);return B?n("div",g({className:"st-cell-editing ".concat(G?"st-cell-odd-row":"st-cell-even-row"),id:D({accessor:u.accessor,rowIndex:b+1})},{children:n(T,{onChange:function(e){N(e),null==m||m({accessor:u.accessor,newValue:e,row:E})},setIsEditing:W,value:k})})):e("div",g({className:K,id:z,onDoubleClick:function(){return u.isEditable&&W(!0)},onMouseDown:function(){return I({rowIndex:b,colIndex:c,rowId:E.rowMeta.rowId})},onMouseOver:function(){return R({rowIndex:b,colIndex:c,rowId:E.rowMeta.rowId})},onDragOver:function(e){return F({callback:P,callbackProps:{event:e,hoveredHeader:u},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!u.isEditable||B||(e.preventDefault(),W(!0))},ref:o,"data-row-index":b,"data-col-index":c,"aria-selected":v},{children:[u.expandable&&U?E.rowMeta.isExpanded?n("div",g({className:"st-sort-icon-container",onClick:function(){return p(E.rowMeta.rowId)}},{children:n(y,{className:"st-sort-icon"})})):n("div",g({className:"st-sort-icon-container",onClick:function(){return p(E.rowMeta.rowId)}},{children:n(x,{className:"st-sort-icon"})})):null,n("span",g({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:E}):k}))]}))})),F=function(e){var t=e.allowAnimations,o=e.children,i=w(e,["allowAnimations","children"]);return t?n(z,g({},i,{children:o})):n(r,{children:o})},z=function(e){var i=e.allowHorizontalAnimate,l=void 0===i||i,d=e.children,s=e.draggedHeaderRef,u=e.headersRef,h=e.isBody,f=e.mainBodyRef,v=e.pauseAnimation,g=e.rowIndex,w=o(!1),m=t({}),p=m[0],I=m[1],R=o({}),C=u.current;return c((function(){if(C){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(D({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:C,draggedHeaderRef:s,rowIndex:g});JSON.stringify(e)!==JSON.stringify(p)&&(R.current=p,I(e))}}),[p,C,s,h,g]),c((function(){var e=f.current,n=function(){w.current=!0},r=function(){w.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)}}),[s,f]),a((function(){v||w.current||Object.keys(R.current).length&&C&&C.forEach((function(e){var n=document.getElementById(D({accessor:e.accessor,rowIndex:g}));if(n){var r=R.current[e.accessor],t=p[e.accessor];if(r&&t){var o=r.left-t.left,i=l?0:r.top-t.top,a=Math.abs(o),d=Math.abs(i);(a>10||d>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")}))}))}}}))}),[l,p,C,h,v,R,g]),n(r,{children:d})},U=function(e){var r=e.getBorderClass,t=e.handleMouseDown,o=e.handleMouseOver,i=e.headers,a=e.hiddenColumns,l=e.isSelected,d=e.isInitialFocusedCell,c=e.onExpandRowClick,s=e.pinned,u=e.rowIndex,h=e.visibleRow,f=w(e,["getBorderClass","handleMouseDown","handleMouseOver","headers","hiddenColumns","isSelected","isInitialFocusedCell","onExpandRowClick","pinned","rowIndex","visibleRow"]);return n(F,g({allowAnimations:f.allowAnimations,allowHorizontalAnimate:f.shouldPaginate,draggedHeaderRef:f.draggedHeaderRef,headersRef:f.headersRef,isBody:!0,mainBodyRef:f.mainBodyRef,pauseAnimation:f.isWidthDragging,rowIndex:u+1},{children:i.map((function(e,v){return E({hiddenColumns:a,header:e,pinned:s})?n(j,g({colIndex:v,getBorderClass:r,handleMouseDown:t,handleMouseOver:o,header:e,headers:i,hiddenColumns:a,isInitialFocusedCell:d,isSelected:l,onExpandRowClick:c,pinned:s,rowIndex:u,visibleRow:h},f),D({accessor:e.accessor,rowIndex:u+1})):null}))}))},j=function(e){var t=e.colIndex,o=e.getBorderClass,i=e.handleMouseDown,a=e.handleMouseOver,l=e.header,d=e.isInitialFocusedCell,c=e.isSelected,u=e.onExpandRowClick,h=e.rowIndex,f=e.visibleRow,v=w(e,["colIndex","getBorderClass","handleMouseDown","handleMouseOver","header","isInitialFocusedCell","isSelected","onExpandRowClick","rowIndex","visibleRow"]);return l.children?n(r,{children:l.children.map((function(e,r){return n(j,g({colIndex:t+r,getBorderClass:o,handleMouseDown:i,handleMouseOver:a,header:e,isSelected:c,isInitialFocusedCell:d,onExpandRowClick:u,rowIndex:h,visibleRow:f},v),D({accessor:e.accessor,rowIndex:h+1}))}))}):s(P,g({},v,{borderClass:o({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId}),colIndex:t,header:l,isSelected:c({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId}),isInitialFocusedCell:d({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId}),key:D({accessor:l.accessor,rowIndex:h+1}),onExpandRowClick:u,onMouseDown:function(){return i({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId})},onMouseOver:function(){return a({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId})},rowIndex:h,visibleRow:f}))},G=function(e){var r=e.getNextRowIndex,t=e.gridTemplateColumns,o=e.index,i=e.pinned,a=e.props,l=e.rowHeight,d=e.visibleRow,c=d.position,s=r();return n("div",g({className:"st-table-row",style:{gridTemplateColumns:t,top:M({position:c,rowHeight:l}),height:"".concat(l,"px")}},{children:n(U,g({pinned:i,rowIndex:s,visibleRow:d},a),o)}))},K=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:H({position:t,rowHeight:o}),minWidth:"100%"}},{children:n("div",{style:{gridColumn:"1 / -1"}})}))},V=function(r){r.headerContainerRef;var t=r.onExpandRowClick,i=r.pinned,l=r.rowHeight,d=r.sectionRef,c=r.templateColumns,s=r.totalHeight,h=r.visibleRows,f=r.width,v=w(r,["headerContainerRef","onExpandRowClick","pinned","rowHeight","sectionRef","templateColumns","totalHeight","visibleRows","width"]),m=i?"st-table-body-pinned-".concat(i):"st-table-body-main",p=o(0);a((function(){p.current=0}));var I=function(){return p.current++};return n("div",g({className:m,ref:d,style:{position:"relative",height:"".concat(s,"px"),width:f}},{children:h.map((function(r,o){var a,d,s=Boolean(null===(d=null===(a=r.row.rowMeta)||void 0===a?void 0:a.children)||void 0===d?void 0:d.length);return e(u,{children:[n(G,{getNextRowIndex:I,gridTemplateColumns:c,index:o,pinned:i,props:g(g({},v),{onExpandRowClick:t,rowHeight:l,visibleRows:h}),rowHeight:l,visibleRow:r}),0!==o&&n(K,{lastGroupRow:s,position:r.position,rowHeight:l,templateColumns:c})]},o)}))}))};!function(e){e.LEFT="left",e.RIGHT="right"}(p||(p={}));var J,X=function(r){var i,l,d,c,s,u=r.centerHeaderRef,h=r.flattenedRows,f=r.headerContainerRef,v=r.mainBodyRef,w=r.mainTemplateColumns,m=r.pinnedLeftColumns,I=r.pinnedLeftHeaderRef,R=r.pinnedLeftRef,C=r.pinnedLeftTemplateColumns,x=r.pinnedRightColumns,b=r.pinnedRightHeaderRef,y=r.pinnedRightRef,H=r.pinnedRightTemplateColumns,M=r.rowHeight,D=r.scrollbarWidth,E=r.setFlattenedRows,S=r.setScrollTop,k=r.tableBodyContainerRef,N=r.visibleRows;!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:f,mainSectionRef:k,scrollbarWidth:D});var T,L,O=o(null),B=(T=0,(L=function(e){e.forEach((function(e){T+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&L(e.rowMeta.children)}))})(h),T)*(M+1)-1,W=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};E((function(e){return e.map(n)}))},A=(null===(i=I.current)||void 0===i?void 0:i.clientWidth)?(null===(l=I.current)||void 0===l?void 0:l.clientWidth)+1:0,P=null===(d=u.current)||void 0===d?void 0:d.clientWidth,F=(null===(c=b.current)||void 0===c?void 0:c.clientWidth)?(null===(s=b.current)||void 0===s?void 0:s.clientWidth)+1:0;return e("div",g({className:"st-table-body-container",ref:k,onScroll:function(e){var n=e.currentTarget.scrollTop;O.current&&cancelAnimationFrame(O.current),O.current=requestAnimationFrame((function(){S(n)}))}},{children:[m.length>0&&n(V,g({},r,{onExpandRowClick:W,pinned:p.LEFT,rowHeight:M,sectionRef:R,templateColumns:C,totalHeight:B,visibleRows:N,width:A})),n(V,g({},r,{onExpandRowClick:W,rowHeight:M,sectionRef:v,templateColumns:w,totalHeight:B,visibleRows:N,width:P})),x.length>0&&n(V,g({},r,{onExpandRowClick:W,pinned:p.RIGHT,rowHeight:M,sectionRef:y,templateColumns:H,totalHeight:B,visibleRows:N,width:F}))]}))},q=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])},Y={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 Y.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?Y.string(e,n,r):"number"==typeof e&&"number"==typeof n?Y.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?Y.boolean(e,n,r):Y.string(String(e),String(n),r)}},$=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 Y.number(i,a,t)}return"date"===r?Y.date(String(e),String(n),t):"boolean"===r?Y.boolean(Boolean(e),Boolean(n),t):"enum"===r?Y.enum(String(e),String(n),t):Y.string(String(e),String(n),t)},_=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=Q(a.rowMeta.children,n,r)),c.push(a)}var d=m([],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 $(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=Q(t.rowMeta.children,n,r);t.rowMeta=g(g({},t.rowMeta),{children:o})}return t})))})),c},Q=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 m([],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 $(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:Q(e.rowMeta.children,n,r)})}):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 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)}},ee=d((function(r,o){var i=r.colIndex,l=r.columnReordering,d=r.columnResizing,c=r.currentRows,s=r.draggedHeaderRef,u=r.forceUpdate,h=r.gridColumnEnd,f=r.gridColumnStart,v=r.gridRowEnd,w=r.gridRowStart,m=r.header,p=r.headersRef,R=r.hoveredHeaderRef,C=r.onColumnOrderChange,x=r.onSort,b=r.onTableHeaderDragEnd,y=r.reverse,H=r.rowHeight,M=r.selectableColumns,E=r.setIsWidthDragging,S=r.setSelectedCells,k=r.sort,N=r.sortDownIcon,T=r.sortUpIcon,L=t(!1),B=L[0],W=L[1],P=Boolean(null==m?void 0:m.isSortable),F="st-header-cell ".concat(m===R.current?"st-hovered":""," ").concat(B?"st-dragging":""," ").concat(P?"clickable":""," ").concat(l&&!P?"columnReordering":""," ").concat("right"===(null==m?void 0:m.align)?"right-aligned":"center"===(null==m?void 0:m.align)?"center-aligned":""),z=A({draggedHeaderRef:s,headersRef:p,hoveredHeaderRef:R,onColumnOrderChange:C,onTableHeaderDragEnd:b}),U=z.handleDragStart,j=z.handleDragEnd,G=z.handleDragOver,K=O(),V=function(e){var n=e.event,r=e.header;if(M){var t=c.length,o=Array.from({length:t},(function(e,n){return I({rowIndex:n,colIndex:i,rowId:c[n].rowMeta.rowId})})),a=function(e,n){var r=new Set,o=Math.min(e,n),i=Math.max(e,n);return Array.from({length:t}).forEach((function(e,n){Array.from({length:i-o+1}).forEach((function(e,t){r.add(I({rowIndex:n,colIndex:o+t,rowId:c[n].rowMeta.rowId}))}))})),r};n.shiftKey?S((function(e){var n,r=Number(null===(n=Array.from(e)[0])||void 0===n?void 0:n.split("-")[1]),t=Number(o[0].split("-")[1]);return r===t?new Set(o):r>t?a(t,r):a(r,t)})):S(new Set(o))}else r.isSortable&&x(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)}}),[]),!m)return null;var J=d&&n("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;K({callback:Z,callbackProps:{colIndex:i,event:e,forceUpdate:u,header:m,headersRef:p,setIsWidthDragging:E,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),X=k&&k.key.accessor===m.accessor&&e("div",g({className:"st-sort-icon-container",onClick:function(e){return V({event:e,header:m})}},{children:["ascending"===k.direction&&T&&T,"descending"===k.direction&&N&&N]}));return e("div",g({className:F,id:D({accessor:m.accessor,rowIndex:0}),onDragOver:function(e){K({callback:G,callbackProps:{event:e,hoveredHeader:m},limit:50})},ref:o,style:g(g({gridRowStart:w,gridRowEnd:v,gridColumnStart:f,gridColumnEnd:h},h-f>1?{}:{width:m.width}),v-w>1?{}:{height:H})},{children:[y&&J,e("div",g({className:"st-header-label ".concat("right"===m.align?"right-aligned":"center"===m.align?"center-aligned":""),draggable:l,onClick:function(e){return V({event:e,header:m})},onDragEnd:function(e){e.preventDefault(),W(!1),j()},onDragStart:function(e){l&&m&&function(e){W(!0),U(e)}(m)}},{children:["right"===m.align&&X,null==m?void 0:m.label,"right"!==m.align&&X]})),!y&&J]}))})),ne=function(r){var t,o,i=r.depth,a=r.getNextColIndex,l=r.header,d=r.hiddenColumns,c=r.index,f=r.maxDepth,v=r.pinned,m=w(r,["depth","getNextColIndex","header","hiddenColumns","index","maxDepth","pinned"]),p=null!==(o=null===(t=l.children)||void 0===t?void 0:t.length)&&void 0!==o?o:0,I=a(0===c?0:1),R={gridColumnStart:I,gridColumnEnd:p>0?I+p:I+1,gridRowStart:i,gridRowEnd:p>0?i+1:f+1};if(l.children){var C=l.children.filter((function(e){return E({hiddenColumns:d,header:e,pinned:v})}));return e(u,{children:[n(ee,g({},m,R,{colIndex:I,header:l,ref:h()})),C.map((function(e,n){return s(ne,g({},m,{depth:i+1,getNextColIndex:a,header:e,hiddenColumns:d,index:n,key:e.accessor,maxDepth:f}))}))]})}return n(ee,g({},m,R,{colIndex:I,header:l,ref:h()}))},re=function(e){var r=e.allowAnimations,t=e.columnReordering,i=e.columnResizing,l=e.currentRows,d=e.draggedHeaderRef,c=e.forceUpdate,s=e.gridTemplateColumns,u=e.handleScroll,h=e.headersRef,f=e.hiddenColumns,v=e.hoveredHeaderRef,w=e.isWidthDragging,m=e.mainBodyRef,I=e.maxDepth,R=e.onColumnOrderChange,C=e.onSort,x=e.onTableHeaderDragEnd,b=e.pinned,y=e.rowHeight,H=e.sectionRef,M=e.selectableColumns,D=e.setIsWidthDragging,S=e.setSelectedCells,k=e.sort,N=e.sortDownIcon,T=e.sortUpIcon,L=o(1);a((function(){L.current=1}));var O=function(e){return void 0===e&&(e=1),L.current+=e,L.current},B=h.current.filter((function(e){return E({hiddenColumns:f,header:e,pinned:b})}));return n("div",g({className:"st-header-".concat(b?"pinned-".concat(b):"main")},u&&{onScroll:u},{ref:H,style:{gridTemplateColumns:s}},{children:n(F,g({allowAnimations:r,draggedHeaderRef:d,headersRef:h,mainBodyRef:m,pauseAnimation:w,rowIndex:0},{children:B.map((function(e,r){return n(ne,{getNextColIndex:O,columnReordering:t,columnResizing:i,currentRows:l,depth:1,draggedHeaderRef:d,forceUpdate:c,header:e,headersRef:h,hiddenColumns:f,hoveredHeaderRef:v,index:r,maxDepth:I,onColumnOrderChange:R,onSort:C,onTableHeaderDragEnd:x,pinned:b,reverse:b===p.RIGHT,rowHeight:y,selectableColumns:M,setIsWidthDragging:D,setSelectedCells:S,sort:k,sortDownIcon:N,sortUpIcon:T},e.accessor)}))}))}))},te=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(te)):1},oe=function(r){var t=r.allowAnimations,o=r.centerHeaderRef,i=r.columnResizing,a=r.currentRows,d=r.columnReordering,c=r.draggedHeaderRef,s=r.forceUpdate,u=r.headerContainerRef,h=r.headersRef,f=r.hiddenColumns,v=r.hoveredHeaderRef,w=r.isWidthDragging,m=r.mainBodyRef,I=r.mainTemplateColumns,R=r.onColumnOrderChange,C=r.onSort,x=r.onTableHeaderDragEnd,b=r.pinnedLeftColumns,y=r.pinnedLeftHeaderRef,H=r.pinnedLeftTemplateColumns,M=r.pinnedRightColumns,D=r.pinnedRightHeaderRef,S=r.pinnedRightTemplateColumns,k=r.rowHeight,N=r.selectableColumns,T=r.setIsWidthDragging,L=r.setSelectedCells,O=r.sort,B=r.sortDownIcon,W=r.sortUpIcon;q(m,o);var A=function(e){var n,r,t=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=m.current)||void 0===r||r.scrollTo(t,0))},P=l((function(){var e=h.current,n=0;return e.forEach((function(e){if(E({hiddenColumns:f,header:e})){var r=te(e);n=Math.max(n,r)}})),{maxDepth:n}}),[h,f]).maxDepth,F={allowAnimations:t,columnReordering:d,columnResizing:i,currentRows:a,draggedHeaderRef:c,forceUpdate:s,handleScroll:A,headersRef:h,hiddenColumns:f,hoveredHeaderRef:v,isWidthDragging:w,mainBodyRef:m,maxDepth:P,onColumnOrderChange:R,onSort:C,onTableHeaderDragEnd:x,rowHeight:k,selectableColumns:N,setIsWidthDragging:T,setSelectedCells:L,sort:O,sortDownIcon:B,sortUpIcon:W};return e("div",g({className:"st-header-container",ref:u},{children:[b.length>0&&n(re,g({},F,{gridTemplateColumns:H,pinned:p.LEFT,sectionRef:y})),n(re,g({},F,{gridTemplateColumns:I,handleScroll:A,sectionRef:o})),M.length>0&&n(re,g({},F,{gridTemplateColumns:S,pinned:p.RIGHT,sectionRef:D}))]}))},ie=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(" "))},ae=function(r){var t=r.allowAnimations,i=r.columnReordering,a=r.columnResizing,d=r.currentRows,c=r.draggedHeaderRef,s=r.editColumns,u=r.flattenedRows,h=r.forceUpdate,f=r.getBorderClass,v=r.handleMouseDown,w=r.handleMouseOver,m=r.headersRef,p=r.hiddenColumns,I=r.hoveredHeaderRef,R=r.isSelected,C=r.isInitialFocusedCell,x=r.isWidthDragging,b=r.mainBodyRef,y=r.onCellEdit,H=r.onColumnOrderChange,M=r.onSort,D=r.onTableHeaderDragEnd,E=r.pinnedLeftRef,S=r.pinnedRightRef,k=r.rowHeight,N=r.scrollbarWidth,T=r.selectableColumns,L=r.setIsWidthDragging,O=r.setFlattenedRows,B=r.setScrollTop,W=r.setSelectedCells,A=r.shouldPaginate,P=r.sort,F=r.sortDownIcon,z=r.sortUpIcon,U=r.tableBodyContainerRef,j=r.visibleRows,G=o(null),K=o(null),V=o(null),J=o(null),q=m.current.filter((function(e){return!e.pinned})),Y=m.current.filter((function(e){return"left"===e.pinned})),$=m.current.filter((function(e){return"right"===e.pinned})),_=l((function(){return ie({headers:Y,hiddenColumns:p})}),[Y,p]),Q=l((function(){return ie({headers:q,hiddenColumns:p})}),[q,p]),Z=l((function(){return ie({headers:$,hiddenColumns:p})}),[$,p]),ee={allowAnimations:t,centerHeaderRef:V,columnResizing:a,currentRows:d,columnReordering:i,draggedHeaderRef:c,forceUpdate:h,headerContainerRef:G,headersRef:m,hiddenColumns:p,hoveredHeaderRef:I,isWidthDragging:x,mainBodyRef:b,mainTemplateColumns:Q,onColumnOrderChange:H,onSort:M,onTableHeaderDragEnd:D,pinnedLeftColumns:Y,pinnedLeftHeaderRef:K,pinnedLeftTemplateColumns:_,pinnedRightColumns:$,pinnedRightHeaderRef:J,pinnedRightTemplateColumns:Z,rowHeight:k,selectableColumns:T,setIsWidthDragging:L,setSelectedCells:W,sort:P,sortDownIcon:F,sortUpIcon:z,tableBodyContainerRef:U},ne={allowAnimations:t,centerHeaderRef:V,draggedHeaderRef:c,flattenedRows:u,getBorderClass:f,handleMouseDown:v,handleMouseOver:w,headerContainerRef:G,headers:m.current,headersRef:m,hiddenColumns:p,hoveredHeaderRef:I,isSelected:R,isInitialFocusedCell:C,isWidthDragging:x,mainBodyRef:b,mainTemplateColumns:Q,onCellEdit:y,onTableHeaderDragEnd:D,pinnedLeftColumns:Y,pinnedLeftHeaderRef:K,pinnedLeftRef:E,pinnedLeftTemplateColumns:_,pinnedRightColumns:$,pinnedRightHeaderRef:J,pinnedRightRef:S,pinnedRightTemplateColumns:Z,rowHeight:k,scrollbarWidth:N,setFlattenedRows:O,shouldPaginate:A,setScrollTop:B,tableBodyContainerRef:U,visibleRows:j};return e("div",g({className:"st-table-content",style:{width:s?"calc(100% - 27.5px)":"100%"}},{children:[n(oe,g({},ee)),n(X,g({},ne))]}))},le=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])},de=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],w=t(0),m=w[0],p=w[1],I=o(null);return le({widthAttribute:"offsetWidth",callback:u,ref:a}),le({widthAttribute:"scrollWidth",callback:p,ref:i}),le({widthAttribute:"offsetWidth",callback:v,ref:l}),q(i,I),!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}}),m>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:I},{children:n("div",{style:{width:m}})})),f>0&&n("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:f}})]}))},ce=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:_(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}},se=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]}))},ue=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(se,g({checked:a[e.accessor],onChange:function(n){var r;return i(g(g({},a),((r={})[e.accessor]=n,r)))}},{children:e.label}),r)}))}))}))},he=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(ue,{headers:l,open:f,position:c,setOpen:v,setHiddenColumns:s,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(J||(J={}));var fe=f((function(r){var d=r.allowAnimations,s=void 0!==d&&d,u=r.columnEditorPosition,h=void 0===u?J.Right:u,f=r.columnEditorText,w=void 0===f?"Columns":f,m=r.columnResizing,p=void 0!==m&&m,H=r.defaultHeaders,M=r.editColumns,D=void 0!==M&&M,E=r.editColumnsInitOpen,S=void 0!==E&&E,k=r.columnReordering,N=void 0!==k&&k,T=r.height,L=r.hideFooter,O=void 0!==L&&L,B=r.nextIcon,W=void 0===B?n(x,{className:"st-next-prev-icon"}):B,A=r.onCellEdit,P=r.onColumnOrderChange,F=r.onNextPage,z=r.onPreviousPage,U=r.prevIcon,j=void 0===U?n(C,{className:"st-next-prev-icon"}):U,G=r.rowHeight,K=void 0===G?40:G,V=r.rows,X=r.rowsPerPage,q=void 0===X?10:X,Y=r.selectableCells,$=void 0!==Y&&Y,_=r.selectableColumns,Q=void 0!==_&&_,Z=r.shouldPaginate,ee=void 0!==Z&&Z,ne=r.sortDownIcon,re=void 0===ne?n(y,{className:"st-sort-icon"}):ne,te=r.sortUpIcon,oe=void 0===te?n(b,{className:"st-sort-icon"}):te,ie=r.theme,le=void 0===ie?"light":ie,se=r.totalPages,ue=o(null),fe=o(H),ve=o(null),ge=o(null),we=o(null),me=o(null),pe=o(null),Ie=t(!1),Re=Ie[0],Ce=Ie[1],xe=t(1),be=xe[0],ye=xe[1],He=t(0),Me=He[0],De=He[1],Ee=t(0),Se=Ee[0],ke=Ee[1],Ne=t(0),Te=Ne[0],Le=Ne[1],Oe=ce({headers:fe.current,tableRows:V}),Be=Oe.sort,We=Oe.sortedRows,Ae=Oe.hiddenColumns,Pe=Oe.setHiddenColumns,Fe=Oe.updateSort,ze=l((function(){if(!ee)return We;var e=(be-1)*q,n=e+q;return We.slice(e,n)}),[be,q,ee,We]),Ue=t(ze),je=Ue[0],Ge=Ue[1];a((function(){Ge(ze)}),[ze]);var Ke=l((function(){var e;if(!T)return window.innerHeight-K;var n=document.querySelector(".simple-table-root"),r=0;if(T.endsWith("px"))r=parseInt(T,10);else if(T.endsWith("vh")){var t=parseInt(T,10);r=window.innerHeight*t/100}else if(T.endsWith("%")){var o=parseInt(T,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-K)}),[T,K]),Ve=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:Ke,flattenedRows:je,rowHeight:K,scrollTop:Te})}),[Ke,K,je,Te]),Je=v((function(e){return e+1}),0)[1],Xe=function(e){var n=e.selectableCells,r=e.headers,d=e.visibleRows,c=t(new Set),s=c[0],u=c[1],h=t(null),f=h[0],v=h[1],g=o(!1),w=o(null),m=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]),p=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(I({colIndex:c,rowIndex:l,rowId:s}))}u(r)}),[d]),R=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<r.length){var n=I(e);u(new Set([n])),v(e)}}),[r.length,d.length]);a((function(){var e=function(e){if(n&&f){var t=f.rowIndex,o=f.colIndex,i=f.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};R(l)}}else"ArrowDown"===e.key?(e.preventDefault(),t<d.length-1&&(l={rowIndex:t+1,colIndex:o,rowId:d[t+1].row.rowMeta.rowId},R(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},R(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},R(l))):"Escape"===e.key&&(u(new Set),w.current=null,v(null))}else m()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[m,r.length,f,p,R,n,d]);var C=i((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=I({colIndex:n,rowIndex:r,rowId:t});return s.has(o)}),[s]),x=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,f={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},v={colIndex:l-1,rowIndex:c,rowId:s},g={colIndex:l+1,rowIndex:c,rowId:s};return C({colIndex:l,rowIndex:c-1,rowId:h})||u.push("st-selected-top-border"),C(f)||u.push("st-selected-bottom-border"),C(v)||u.push("st-selected-left-border"),C(g)||u.push("st-selected-right-border"),u.join(" ")}),[C,d]),b=l((function(){return f?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===f.rowIndex&&r===f.colIndex&&t===f.rowId}:function(){return!1}}),[f]);return{getBorderClass:x,handleMouseDown:function(e){var r=e.colIndex,t=e.rowIndex,o=e.rowId;if(n){g.current=!0,w.current={rowIndex:t,colIndex:r,rowId:o};var i=I({colIndex:r,rowIndex:t,rowId:o});u(new Set([i])),v({rowIndex:t,colIndex:r,rowId:o})}},handleMouseOver:function(e){var r=e.colIndex,t=e.rowIndex;if(e.rowId,n&&g.current&&w.current){for(var o=new Set,i=Math.min(w.current.rowIndex,t),a=Math.max(w.current.rowIndex,t),l=Math.min(w.current.colIndex,r),c=Math.max(w.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(I({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){g.current=!1},isInitialFocusedCell:b,isSelected:C,selectedCells:s,setSelectedCells:u}}({selectableCells:$,headers:fe.current,visibleRows:Ve}),qe=Xe.handleMouseDown,Ye=Xe.handleMouseOver,$e=Xe.handleMouseUp,_e=Xe.isSelected,Qe=Xe.getBorderClass,Ze=Xe.isInitialFocusedCell,en=Xe.setSelectedCells,nn=i((function(e,n){Fe(e,n)}),[Fe]),rn=i((function(e){fe.current=e,Je()}),[]);return a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||Q&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||en(new Set)};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[Q,en]),c((function(){if(pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth,n=pe.current.clientWidth;De(e),ke(n)}}),[]),c((function(){var e=function(){if(Je(),pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth,n=pe.current.clientWidth;De(e),ke(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),e("div",g({className:"simple-table-root st-wrapper theme-".concat(le),style:T?{height:T}:{}},{children:[e("div",g({className:"st-table-wrapper-container"},{children:[e("div",g({className:"st-table-wrapper",onMouseUp:$e,onMouseLeave:$e},{children:[n(ae,{allowAnimations:s,columnReordering:N,columnResizing:p,currentRows:ze,draggedHeaderRef:ue,editColumns:D,flattenedRows:je,forceUpdate:Je,getBorderClass:Qe,handleMouseDown:qe,handleMouseOver:Ye,headersRef:fe,hiddenColumns:Ae,hoveredHeaderRef:ve,isInitialFocusedCell:Ze,isSelected:_e,isWidthDragging:Re,mainBodyRef:ge,onCellEdit:A,onColumnOrderChange:P,onSort:nn,onTableHeaderDragEnd:rn,pinnedLeftRef:we,pinnedRightRef:me,rowHeight:K,scrollbarWidth:Me,selectableColumns:Q,setIsWidthDragging:Ce,setFlattenedRows:Ge,setScrollTop:Le,setSelectedCells:en,shouldPaginate:ee,sort:Be,sortDownIcon:re,sortUpIcon:oe,tableBodyContainerRef:pe,visibleRows:Ve}),n(he,{columnEditorText:w,editColumns:D,editColumnsInitOpen:S,headers:fe.current,hiddenColumns:Ae,position:h,setHiddenColumns:Pe})]})),n(de,{mainBodyRef:ge,pinnedLeftRef:we,pinnedRightRef:me,tableContentWidth:Se})]})),n(R,{currentPage:be,hideFooter:O,nextIcon:W,onPageChange:ye,onNextPage:F,onPreviousPage:z,prevIcon:j,shouldPaginate:ee,totalPages:se||Math.ceil(We.length/q)})]}))}));export{fe 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,forwardRef as d,useLayoutEffect as c,createElement as s,Fragment as u,createRef as h,memo as f,useReducer as v}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){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}function m(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,I=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},R=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)}))]}))},C=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"})}))},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 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},y=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"})}))},M=function(e){return e.position*(e.rowHeight+1)-1},H=function(e){return e.position*(e.rowHeight+1)},D=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},E=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"}))]}))},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(E,{onBlur:l,onChange:a,value:i}):"number"==typeof i?n(N,{defaultValue:i,onBlur:l,onChange:a}):null})},O=0,B=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===O||o-O>=t)&&(O=o,n(r))}},L=Date.now(),W={screenX:0,screenY:0},A=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,L=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-W.screenX,2)+Math.pow(u-W.screenY,2));l.current=o;var f=m([],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})),w=f.splice(v,1)[0];if(f.splice(g,0,w),!(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-L<800&&h<50||(L=p,W={screenX:d,screenY:u},c(f))}}},handleDragEnd:function(){t.current=null,l.current=null,null==d||d(i.current)}}},P=d((function(r,o){var i,l,d=r.borderClass,c=r.colIndex,s=r.draggedHeaderRef,u=r.header,h=r.headersRef,f=r.hoveredHeaderRef,v=r.isSelected,w=r.isInitialFocusedCell,m=r.onCellEdit,p=r.onExpandRowClick,I=r.onMouseDown,R=r.onMouseOver,C=r.onTableHeaderDragEnd,b=r.rowIndex,M=r.visibleRow,H=M.depth,S=M.row,E=t(S.rowData[u.accessor]),k=E[0],N=E[1],O=t(!1),L=O[0],W=O[1],P=A({draggedHeaderRef:s,headersRef:h,hoveredHeaderRef:f,onTableHeaderDragEnd:C}).handleDragOver,F=B(),z="cell-".concat(b,"-").concat(c),U=Boolean(null===(l=null===(i=S.rowMeta)||void 0===i?void 0:i.children)||void 0===l?void 0:l.length),j=Boolean(null==u?void 0:u.isEditable),K=b%2==0,V="st-cell ".concat(H>0&&u.expandable?"st-cell-depth-".concat(H):""," ").concat(v?w?"st-cell-selected-first ".concat(d):"st-cell-selected ".concat(d):""," ").concat(K?"st-cell-odd-row":"st-cell-even-row"," ").concat(j?"clickable":"");a((function(){N(S.rowData[u.accessor])}),[u.accessor,S]);return L?n("div",g({className:"st-cell-editing ".concat(K?"st-cell-odd-row":"st-cell-even-row"),id:D({accessor:u.accessor,rowIndex:b+1})},{children:n(T,{onChange:function(e){N(e),null==m||m({accessor:u.accessor,newValue:e,row:S})},setIsEditing:W,value:k})})):e("div",g({className:V,id:z,onDoubleClick:function(){return u.isEditable&&W(!0)},onMouseDown:function(){return I({rowIndex:b,colIndex:c,rowId:S.rowMeta.rowId})},onMouseOver:function(){return R({rowIndex:b,colIndex:c,rowId:S.rowMeta.rowId})},onDragOver:function(e){return F({callback:P,callbackProps:{event:e,hoveredHeader:u},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!u.isEditable||L||(e.preventDefault(),W(!0))},ref:o,"data-row-index":b,"data-col-index":c,"aria-selected":v},{children:[u.expandable&&U?S.rowMeta.isExpanded?n("div",g({className:"st-sort-icon-container",onClick:function(){return p(S.rowMeta.rowId)}},{children:n(y,{className:"st-sort-icon"})})):n("div",g({className:"st-sort-icon-container",onClick:function(){return p(S.rowMeta.rowId)}},{children:n(x,{className:"st-sort-icon"})})):null,n("span",g({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:S}):k}))]}))})),F=function(e){var t=e.allowAnimations,o=e.children,i=w(e,["allowAnimations","children"]);return t?n(z,g({},i,{children:o})):n(r,{children:o})},z=function(e){var i=e.allowHorizontalAnimate,l=void 0===i||i,d=e.children,s=e.draggedHeaderRef,u=e.headersRef,h=e.isBody,f=e.mainBodyRef,v=e.pauseAnimation,g=e.rowIndex,w=o(!1),m=t({}),p=m[0],I=m[1],R=o({}),C=u.current;return c((function(){if(C){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(D({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:C,draggedHeaderRef:s,rowIndex:g});JSON.stringify(e)!==JSON.stringify(p)&&(R.current=p,I(e))}}),[p,C,s,h,g]),c((function(){var e=f.current,n=function(){w.current=!0},r=function(){w.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)}}),[s,f]),a((function(){v||w.current||Object.keys(R.current).length&&C&&C.forEach((function(e){var n=document.getElementById(D({accessor:e.accessor,rowIndex:g}));if(n){var r=R.current[e.accessor],t=p[e.accessor];if(r&&t){var o=r.left-t.left,i=l?0:r.top-t.top,a=Math.abs(o),d=Math.abs(i);(a>10||d>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")}))}))}}}))}),[l,p,C,h,v,R,g]),n(r,{children:d})},U=function(e){var r=e.getBorderClass,t=e.handleMouseDown,o=e.handleMouseOver,i=e.headers,a=e.hiddenColumns,l=e.isSelected,d=e.isInitialFocusedCell,c=e.onExpandRowClick,s=e.pinned,u=e.rowIndex,h=e.visibleRow,f=w(e,["getBorderClass","handleMouseDown","handleMouseOver","headers","hiddenColumns","isSelected","isInitialFocusedCell","onExpandRowClick","pinned","rowIndex","visibleRow"]);return n(F,g({allowAnimations:f.allowAnimations,allowHorizontalAnimate:f.shouldPaginate,draggedHeaderRef:f.draggedHeaderRef,headersRef:f.headersRef,isBody:!0,mainBodyRef:f.mainBodyRef,pauseAnimation:f.isWidthDragging,rowIndex:u+1},{children:i.map((function(e,v){return S({hiddenColumns:a,header:e,pinned:s})?n(j,g({colIndex:v,getBorderClass:r,handleMouseDown:t,handleMouseOver:o,header:e,headers:i,hiddenColumns:a,isInitialFocusedCell:d,isSelected:l,onExpandRowClick:c,pinned:s,rowIndex:u,visibleRow:h},f),D({accessor:e.accessor,rowIndex:u+1})):null}))}))},j=function(e){var t=e.colIndex,o=e.getBorderClass,i=e.handleMouseDown,a=e.handleMouseOver,l=e.header,d=e.isInitialFocusedCell,c=e.isSelected,u=e.onExpandRowClick,h=e.rowIndex,f=e.visibleRow,v=w(e,["colIndex","getBorderClass","handleMouseDown","handleMouseOver","header","isInitialFocusedCell","isSelected","onExpandRowClick","rowIndex","visibleRow"]);return l.children?n(r,{children:l.children.map((function(e,r){return n(j,g({colIndex:t+r,getBorderClass:o,handleMouseDown:i,handleMouseOver:a,header:e,isSelected:c,isInitialFocusedCell:d,onExpandRowClick:u,rowIndex:h,visibleRow:f},v),D({accessor:e.accessor,rowIndex:h+1}))}))}):s(P,g({},v,{borderClass:o({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId}),colIndex:t,header:l,isSelected:c({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId}),isInitialFocusedCell:d({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId}),key:D({accessor:l.accessor,rowIndex:h+1}),onExpandRowClick:u,onMouseDown:function(){return i({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId})},onMouseOver:function(){return a({rowIndex:h,colIndex:t,rowId:f.row.rowMeta.rowId})},rowIndex:h,visibleRow:f}))},K=function(e){var r=e.getNextRowIndex,t=e.gridTemplateColumns,o=e.index,i=e.pinned,a=e.props,l=e.rowHeight,d=e.visibleRow,c=d.position,s=r();return n("div",g({className:"st-table-row",style:{gridTemplateColumns:t,top:H({position:c,rowHeight:l}),height:"".concat(l,"px")}},{children:n(U,g({pinned:i,rowIndex:s,visibleRow:d},a),o)}))},V=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:M({position:t,rowHeight:o}),minWidth:"100%"}},{children:n("div",{style:{gridColumn:"1 / -1"}})}))},J=function(r){r.headerContainerRef;var t=r.onExpandRowClick,i=r.pinned,l=r.rowHeight,d=r.sectionRef,c=r.templateColumns,s=r.totalHeight,h=r.visibleRows,f=r.width,v=w(r,["headerContainerRef","onExpandRowClick","pinned","rowHeight","sectionRef","templateColumns","totalHeight","visibleRows","width"]),m=i?"st-table-body-pinned-".concat(i):"st-table-body-main",p=o(0);a((function(){p.current=0}));var I=function(){return p.current++};return n("div",g({className:m,ref:d,style:{position:"relative",height:"".concat(s,"px"),width:f}},{children:h.map((function(r,o){var a,d,s=Boolean(null===(d=null===(a=r.row.rowMeta)||void 0===a?void 0:a.children)||void 0===d?void 0:d.length);return e(u,{children:[n(K,{getNextRowIndex:I,gridTemplateColumns:c,index:o,pinned:i,props:g(g({},v),{onExpandRowClick:t,rowHeight:l,visibleRows:h}),rowHeight:l,visibleRow:r}),0!==o&&n(V,{lastGroupRow:s,position:r.position,rowHeight:l,templateColumns:c})]},o)}))}))},X=function(r){var i,l,d,c,s,u=r.centerHeaderRef,h=r.flattenedRows,f=r.headerContainerRef,v=r.mainBodyRef,w=r.mainTemplateColumns,m=r.pinnedLeftColumns,p=r.pinnedLeftHeaderRef,I=r.pinnedLeftRef,R=r.pinnedLeftTemplateColumns,C=r.pinnedRightColumns,x=r.pinnedRightHeaderRef,b=r.pinnedRightRef,y=r.pinnedRightTemplateColumns,M=r.rowHeight,H=r.scrollbarWidth,D=r.setFlattenedRows,S=r.setScrollTop,E=r.tableBodyContainerRef,k=r.visibleRows;!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:f,mainSectionRef:E,scrollbarWidth:H});var N,T,O=o(null),B=(N=0,(T=function(e){e.forEach((function(e){N+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&T(e.rowMeta.children)}))})(h),N)*(M+1)-1,L=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};D((function(e){return e.map(n)}))},W=(null===(i=p.current)||void 0===i?void 0:i.clientWidth)?(null===(l=p.current)||void 0===l?void 0:l.clientWidth)+1:0,A=null===(d=u.current)||void 0===d?void 0:d.clientWidth,P=(null===(c=x.current)||void 0===c?void 0:c.clientWidth)?(null===(s=x.current)||void 0===s?void 0:s.clientWidth)+1:0;return e("div",g({className:"st-table-body-container",ref:E,onScroll:function(e){var n=e.currentTarget.scrollTop;O.current&&cancelAnimationFrame(O.current),O.current=requestAnimationFrame((function(){S(n)}))}},{children:[m.length>0&&n(J,g({},r,{onExpandRowClick:L,pinned:"left",rowHeight:M,sectionRef:I,templateColumns:R,totalHeight:B,visibleRows:k,width:W})),n(J,g({},r,{onExpandRowClick:L,rowHeight:M,sectionRef:v,templateColumns:w,totalHeight:B,visibleRows:k,width:A})),C.length>0&&n(J,g({},r,{onExpandRowClick:L,pinned:"right",rowHeight:M,sectionRef:b,templateColumns:y,totalHeight:B,visibleRows:k,width:P}))]}))},q=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])},Y={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 Y.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?Y.string(e,n,r):"number"==typeof e&&"number"==typeof n?Y.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?Y.boolean(e,n,r):Y.string(String(e),String(n),r)}},G=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 Y.number(i,a,t)}return"date"===r?Y.date(String(e),String(n),t):"boolean"===r?Y.boolean(Boolean(e),Boolean(n),t):"enum"===r?Y.enum(String(e),String(n),t):Y.string(String(e),String(n),t)},$=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=_(a.rowMeta.children,n,r)),c.push(a)}var d=m([],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 G(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=_(t.rowMeta.children,n,r);t.rowMeta=g(g({},t.rowMeta),{children:o})}return t})))})),c},_=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 m([],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 G(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:_(e.rowMeta.children,n,r)})}):e}))},Q=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)}},Z=d((function(r,o){var i=r.colIndex,l=r.columnReordering,d=r.columnResizing,c=r.currentRows,s=r.draggedHeaderRef,u=r.forceUpdate,h=r.gridColumnEnd,f=r.gridColumnStart,v=r.gridRowEnd,w=r.gridRowStart,m=r.header,p=r.headersRef,R=r.hoveredHeaderRef,C=r.onColumnOrderChange,x=r.onSort,b=r.onTableHeaderDragEnd,y=r.reverse,M=r.rowHeight,H=r.selectableColumns,S=r.setIsWidthDragging,E=r.setSelectedCells,k=r.sort,N=r.sortDownIcon,T=r.sortUpIcon,O=t(!1),L=O[0],W=O[1],P=Boolean(null==m?void 0:m.isSortable),F="st-header-cell ".concat(m===R.current?"st-hovered":""," ").concat(L?"st-dragging":""," ").concat(P?"clickable":""," ").concat(l&&!P?"columnReordering":""," ").concat("right"===(null==m?void 0:m.align)?"right-aligned":"center"===(null==m?void 0:m.align)?"center-aligned":""),z=A({draggedHeaderRef:s,headersRef:p,hoveredHeaderRef:R,onColumnOrderChange:C,onTableHeaderDragEnd:b}),U=z.handleDragStart,j=z.handleDragEnd,K=z.handleDragOver,V=B(),J=function(e){var n=e.event,r=e.header;if(H){var t=c.length,o=Array.from({length:t},(function(e,n){return I({rowIndex:n,colIndex:i,rowId:c[n].rowMeta.rowId})})),a=function(e,n){var r=new Set,o=Math.min(e,n),i=Math.max(e,n);return Array.from({length:t}).forEach((function(e,n){Array.from({length:i-o+1}).forEach((function(e,t){r.add(I({rowIndex:n,colIndex:o+t,rowId:c[n].rowMeta.rowId}))}))})),r};n.shiftKey?E((function(e){var n,r=Number(null===(n=Array.from(e)[0])||void 0===n?void 0:n.split("-")[1]),t=Number(o[0].split("-")[1]);return r===t?new Set(o):r>t?a(t,r):a(r,t)})):E(new Set(o))}else r.isSortable&&x(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)}}),[]),!m)return null;var X=d&&n("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;V({callback:Q,callbackProps:{colIndex:i,event:e,forceUpdate:u,header:m,headersRef:p,setIsWidthDragging:S,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),q=k&&k.key.accessor===m.accessor&&e("div",g({className:"st-sort-icon-container",onClick:function(e){return J({event:e,header:m})}},{children:["ascending"===k.direction&&T&&T,"descending"===k.direction&&N&&N]}));return e("div",g({className:F,id:D({accessor:m.accessor,rowIndex:0}),onDragOver:function(e){V({callback:K,callbackProps:{event:e,hoveredHeader:m},limit:50})},ref:o,style:g(g({gridRowStart:w,gridRowEnd:v,gridColumnStart:f,gridColumnEnd:h},h-f>1?{}:{width:m.width}),v-w>1?{}:{height:M})},{children:[y&&X,e("div",g({className:"st-header-label ".concat("right"===m.align?"right-aligned":"center"===m.align?"center-aligned":""),draggable:l,onClick:function(e){return J({event:e,header:m})},onDragEnd:function(e){e.preventDefault(),W(!1),j()},onDragStart:function(e){l&&m&&function(e){W(!0),U(e)}(m)}},{children:["right"===m.align&&q,null==m?void 0:m.label,"right"!==m.align&&q]})),!y&&X]}))})),ee=function(r){var t,o,i=r.depth,a=r.getNextColIndex,l=r.header,d=r.hiddenColumns,c=r.index,f=r.maxDepth,v=r.pinned,m=w(r,["depth","getNextColIndex","header","hiddenColumns","index","maxDepth","pinned"]),p=null!==(o=null===(t=l.children)||void 0===t?void 0:t.length)&&void 0!==o?o:0,I=a(0===c?0:1),R={gridColumnStart:I,gridColumnEnd:p>0?I+p:I+1,gridRowStart:i,gridRowEnd:p>0?i+1:f+1};if(l.children){var C=l.children.filter((function(e){return S({hiddenColumns:d,header:e,pinned:v})}));return e(u,{children:[n(Z,g({},m,R,{colIndex:I,header:l,ref:h()})),C.map((function(e,n){return s(ee,g({},m,{depth:i+1,getNextColIndex:a,header:e,hiddenColumns:d,index:n,key:e.accessor,maxDepth:f}))}))]})}return n(Z,g({},m,R,{colIndex:I,header:l,ref:h()}))},ne=function(e){var r=e.allowAnimations,t=e.columnReordering,i=e.columnResizing,l=e.currentRows,d=e.draggedHeaderRef,c=e.forceUpdate,s=e.gridTemplateColumns,u=e.handleScroll,h=e.headersRef,f=e.hiddenColumns,v=e.hoveredHeaderRef,w=e.isWidthDragging,m=e.mainBodyRef,p=e.maxDepth,I=e.onColumnOrderChange,R=e.onSort,C=e.onTableHeaderDragEnd,x=e.pinned,b=e.rowHeight,y=e.sectionRef,M=e.selectableColumns,H=e.setIsWidthDragging,D=e.setSelectedCells,E=e.sort,k=e.sortDownIcon,N=e.sortUpIcon,T=o(1);a((function(){T.current=1}));var O=function(e){return void 0===e&&(e=1),T.current+=e,T.current},B=h.current.filter((function(e){return S({hiddenColumns:f,header:e,pinned:x})}));return n("div",g({className:"st-header-".concat(x?"pinned-".concat(x):"main")},u&&{onScroll:u},{ref:y,style:{gridTemplateColumns:s}},{children:n(F,g({allowAnimations:r,draggedHeaderRef:d,headersRef:h,mainBodyRef:m,pauseAnimation:w,rowIndex:0},{children:B.map((function(e,r){return n(ee,{getNextColIndex:O,columnReordering:t,columnResizing:i,currentRows:l,depth:1,draggedHeaderRef:d,forceUpdate:c,header:e,headersRef:h,hiddenColumns:f,hoveredHeaderRef:v,index:r,maxDepth:p,onColumnOrderChange:I,onSort:R,onTableHeaderDragEnd:C,pinned:x,reverse:"right"===x,rowHeight:b,selectableColumns:M,setIsWidthDragging:H,setSelectedCells:D,sort:E,sortDownIcon:k,sortUpIcon:N},e.accessor)}))}))}))},re=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(re)):1},te=function(r){var t=r.allowAnimations,o=r.centerHeaderRef,i=r.columnResizing,a=r.currentRows,d=r.columnReordering,c=r.draggedHeaderRef,s=r.forceUpdate,u=r.headerContainerRef,h=r.headersRef,f=r.hiddenColumns,v=r.hoveredHeaderRef,w=r.isWidthDragging,m=r.mainBodyRef,p=r.mainTemplateColumns,I=r.onColumnOrderChange,R=r.onSort,C=r.onTableHeaderDragEnd,x=r.pinnedLeftColumns,b=r.pinnedLeftHeaderRef,y=r.pinnedLeftTemplateColumns,M=r.pinnedRightColumns,H=r.pinnedRightHeaderRef,D=r.pinnedRightTemplateColumns,E=r.rowHeight,k=r.selectableColumns,N=r.setIsWidthDragging,T=r.setSelectedCells,O=r.sort,B=r.sortDownIcon,L=r.sortUpIcon;q(m,o);var W=function(e){var n,r,t=null===(n=o.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=m.current)||void 0===r||r.scrollTo(t,0))},A=l((function(){var e=h.current,n=0;return e.forEach((function(e){if(S({hiddenColumns:f,header:e})){var r=re(e);n=Math.max(n,r)}})),{maxDepth:n}}),[h,f]).maxDepth,P={allowAnimations:t,columnReordering:d,columnResizing:i,currentRows:a,draggedHeaderRef:c,forceUpdate:s,handleScroll:W,headersRef:h,hiddenColumns:f,hoveredHeaderRef:v,isWidthDragging:w,mainBodyRef:m,maxDepth:A,onColumnOrderChange:I,onSort:R,onTableHeaderDragEnd:C,rowHeight:E,selectableColumns:k,setIsWidthDragging:N,setSelectedCells:T,sort:O,sortDownIcon:B,sortUpIcon:L};return e("div",g({className:"st-header-container",ref:u},{children:[x.length>0&&n(ne,g({},P,{gridTemplateColumns:y,pinned:"left",sectionRef:b})),n(ne,g({},P,{gridTemplateColumns:p,handleScroll:W,sectionRef:o})),M.length>0&&n(ne,g({},P,{gridTemplateColumns:D,pinned:"right",sectionRef:H}))]}))},oe=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(" "))},ie=function(r){var t=r.allowAnimations,i=r.columnReordering,a=r.columnResizing,d=r.currentRows,c=r.draggedHeaderRef,s=r.editColumns,u=r.flattenedRows,h=r.forceUpdate,f=r.getBorderClass,v=r.handleMouseDown,w=r.handleMouseOver,m=r.headersRef,p=r.hiddenColumns,I=r.hoveredHeaderRef,R=r.isSelected,C=r.isInitialFocusedCell,x=r.isWidthDragging,b=r.mainBodyRef,y=r.onCellEdit,M=r.onColumnOrderChange,H=r.onSort,D=r.onTableHeaderDragEnd,S=r.pinnedLeftRef,E=r.pinnedRightRef,k=r.rowHeight,N=r.scrollbarWidth,T=r.selectableColumns,O=r.setIsWidthDragging,B=r.setFlattenedRows,L=r.setScrollTop,W=r.setSelectedCells,A=r.shouldPaginate,P=r.sort,F=r.sortDownIcon,z=r.sortUpIcon,U=r.tableBodyContainerRef,j=r.visibleRows,K=o(null),V=o(null),J=o(null),q=o(null),Y=m.current.filter((function(e){return!e.pinned})),G=m.current.filter((function(e){return"left"===e.pinned})),$=m.current.filter((function(e){return"right"===e.pinned})),_=l((function(){return oe({headers:G,hiddenColumns:p})}),[G,p]),Q=l((function(){return oe({headers:Y,hiddenColumns:p})}),[Y,p]),Z=l((function(){return oe({headers:$,hiddenColumns:p})}),[$,p]),ee={allowAnimations:t,centerHeaderRef:J,columnResizing:a,currentRows:d,columnReordering:i,draggedHeaderRef:c,forceUpdate:h,headerContainerRef:K,headersRef:m,hiddenColumns:p,hoveredHeaderRef:I,isWidthDragging:x,mainBodyRef:b,mainTemplateColumns:Q,onColumnOrderChange:M,onSort:H,onTableHeaderDragEnd:D,pinnedLeftColumns:G,pinnedLeftHeaderRef:V,pinnedLeftTemplateColumns:_,pinnedRightColumns:$,pinnedRightHeaderRef:q,pinnedRightTemplateColumns:Z,rowHeight:k,selectableColumns:T,setIsWidthDragging:O,setSelectedCells:W,sort:P,sortDownIcon:F,sortUpIcon:z,tableBodyContainerRef:U},ne={allowAnimations:t,centerHeaderRef:J,draggedHeaderRef:c,flattenedRows:u,getBorderClass:f,handleMouseDown:v,handleMouseOver:w,headerContainerRef:K,headers:m.current,headersRef:m,hiddenColumns:p,hoveredHeaderRef:I,isSelected:R,isInitialFocusedCell:C,isWidthDragging:x,mainBodyRef:b,mainTemplateColumns:Q,onCellEdit:y,onTableHeaderDragEnd:D,pinnedLeftColumns:G,pinnedLeftHeaderRef:V,pinnedLeftRef:S,pinnedLeftTemplateColumns:_,pinnedRightColumns:$,pinnedRightHeaderRef:q,pinnedRightRef:E,pinnedRightTemplateColumns:Z,rowHeight:k,scrollbarWidth:N,setFlattenedRows:B,shouldPaginate:A,setScrollTop:L,tableBodyContainerRef:U,visibleRows:j};return e("div",g({className:"st-table-content",style:{width:s?"calc(100% - 27.5px)":"100%"}},{children:[n(te,g({},ee)),n(X,g({},ne))]}))},ae=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])},le=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],w=t(0),m=w[0],p=w[1],I=o(null);return ae({widthAttribute:"offsetWidth",callback:u,ref:a}),ae({widthAttribute:"scrollWidth",callback:p,ref:i}),ae({widthAttribute:"offsetWidth",callback:v,ref:l}),q(i,I),!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}}),m>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:I},{children:n("div",{style:{width:m}})})),f>0&&n("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:f}})]}))},de=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:$(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}},ce=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]}))},se=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(ce,g({checked:a[e.accessor],onChange:function(n){var r;return i(g(g({},a),((r={})[e.accessor]=n,r)))}},{children:e.label}),r)}))}))}))},ue=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(se,{headers:l,open:f,position:c,setOpen:v,setHiddenColumns:s,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(p||(p={}));var he=f((function(r){var d=r.allowAnimations,s=void 0!==d&&d,u=r.columnEditorPosition,h=void 0===u?p.Right:u,f=r.columnEditorText,w=void 0===f?"Columns":f,m=r.columnResizing,M=void 0!==m&&m,H=r.defaultHeaders,D=r.editColumns,S=void 0!==D&&D,E=r.editColumnsInitOpen,k=void 0!==E&&E,N=r.columnReordering,T=void 0!==N&&N,O=r.height,B=r.hideFooter,L=void 0!==B&&B,W=r.nextIcon,A=void 0===W?n(x,{className:"st-next-prev-icon"}):W,P=r.onCellEdit,F=r.onColumnOrderChange,z=r.onNextPage,U=r.onPreviousPage,j=r.prevIcon,K=void 0===j?n(C,{className:"st-next-prev-icon"}):j,V=r.rowHeight,J=void 0===V?40:V,X=r.rows,q=r.rowsPerPage,Y=void 0===q?10:q,G=r.selectableCells,$=void 0!==G&&G,_=r.selectableColumns,Q=void 0!==_&&_,Z=r.shouldPaginate,ee=void 0!==Z&&Z,ne=r.sortDownIcon,re=void 0===ne?n(y,{className:"st-sort-icon"}):ne,te=r.sortUpIcon,oe=void 0===te?n(b,{className:"st-sort-icon"}):te,ae=r.theme,ce=void 0===ae?"light":ae,se=r.totalPages,he=o(null),fe=o(H),ve=o(null),ge=o(null),we=o(null),me=o(null),pe=o(null),Ie=t(!1),Re=Ie[0],Ce=Ie[1],xe=t(1),be=xe[0],ye=xe[1],Me=t(0),He=Me[0],De=Me[1],Se=t(0),Ee=Se[0],ke=Se[1],Ne=t(0),Te=Ne[0],Oe=Ne[1],Be=de({headers:fe.current,tableRows:X}),Le=Be.sort,We=Be.sortedRows,Ae=Be.hiddenColumns,Pe=Be.setHiddenColumns,Fe=Be.updateSort,ze=l((function(){if(!ee)return We;var e=(be-1)*Y,n=e+Y;return We.slice(e,n)}),[be,Y,ee,We]),Ue=t(ze),je=Ue[0],Ke=Ue[1];a((function(){Ke(ze)}),[ze]);var Ve=l((function(){var e;if(!O)return window.innerHeight-J;var n=document.querySelector(".simple-table-root"),r=0;if(O.endsWith("px"))r=parseInt(O,10);else if(O.endsWith("vh")){var t=parseInt(O,10);r=window.innerHeight*t/100}else if(O.endsWith("%")){var o=parseInt(O,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)}),[O,J]),Je=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:Ve,flattenedRows:je,rowHeight:J,scrollTop:Te})}),[Ve,J,je,Te]),Xe=v((function(e){return e+1}),0)[1],qe=function(e){var n=e.selectableCells,r=e.headers,d=e.visibleRows,c=t(new Set),s=c[0],u=c[1],h=t(null),f=h[0],v=h[1],g=o(!1),w=o(null),m=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]),p=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(I({colIndex:c,rowIndex:l,rowId:s}))}u(r)}),[d]),R=i((function(e){if(e.rowIndex>=0&&e.rowIndex<d.length&&e.colIndex>=0&&e.colIndex<r.length){var n=I(e);u(new Set([n])),v(e)}}),[r.length,d.length]);a((function(){var e=function(e){if(n&&f){var t=f.rowIndex,o=f.colIndex,i=f.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};R(l)}}else"ArrowDown"===e.key?(e.preventDefault(),t<d.length-1&&(l={rowIndex:t+1,colIndex:o,rowId:d[t+1].row.rowMeta.rowId},R(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},R(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},R(l))):"Escape"===e.key&&(u(new Set),w.current=null,v(null))}else m()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[m,r.length,f,p,R,n,d]);var C=i((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=I({colIndex:n,rowIndex:r,rowId:t});return s.has(o)}),[s]),x=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,f={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},v={colIndex:l-1,rowIndex:c,rowId:s},g={colIndex:l+1,rowIndex:c,rowId:s};return C({colIndex:l,rowIndex:c-1,rowId:h})||u.push("st-selected-top-border"),C(f)||u.push("st-selected-bottom-border"),C(v)||u.push("st-selected-left-border"),C(g)||u.push("st-selected-right-border"),u.join(" ")}),[C,d]),b=l((function(){return f?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===f.rowIndex&&r===f.colIndex&&t===f.rowId}:function(){return!1}}),[f]);return{getBorderClass:x,handleMouseDown:function(e){var r=e.colIndex,t=e.rowIndex,o=e.rowId;if(n){g.current=!0,w.current={rowIndex:t,colIndex:r,rowId:o};var i=I({colIndex:r,rowIndex:t,rowId:o});u(new Set([i])),v({rowIndex:t,colIndex:r,rowId:o})}},handleMouseOver:function(e){var r=e.colIndex,t=e.rowIndex;if(e.rowId,n&&g.current&&w.current){for(var o=new Set,i=Math.min(w.current.rowIndex,t),a=Math.max(w.current.rowIndex,t),l=Math.min(w.current.colIndex,r),c=Math.max(w.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(I({colIndex:h,rowIndex:s,rowId:f}))}u(o)}},handleMouseUp:function(){g.current=!1},isInitialFocusedCell:b,isSelected:C,selectedCells:s,setSelectedCells:u}}({selectableCells:$,headers:fe.current,visibleRows:Je}),Ye=qe.handleMouseDown,Ge=qe.handleMouseOver,$e=qe.handleMouseUp,_e=qe.isSelected,Qe=qe.getBorderClass,Ze=qe.isInitialFocusedCell,en=qe.setSelectedCells,nn=i((function(e,n){Fe(e,n)}),[Fe]),rn=i((function(e){fe.current=e,Xe()}),[]);return a((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||Q&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||en(new Set)};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[Q,en]),c((function(){if(pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth,n=pe.current.clientWidth;De(e),ke(n)}}),[]),c((function(){var e=function(){if(Xe(),pe.current){var e=pe.current.offsetWidth-pe.current.clientWidth,n=pe.current.clientWidth;De(e),ke(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),e("div",g({className:"simple-table-root st-wrapper theme-".concat(ce),style:O?{height:O}:{}},{children:[e("div",g({className:"st-table-wrapper-container"},{children:[e("div",g({className:"st-table-wrapper",onMouseUp:$e,onMouseLeave:$e},{children:[n(ie,{allowAnimations:s,columnReordering:T,columnResizing:M,currentRows:ze,draggedHeaderRef:he,editColumns:S,flattenedRows:je,forceUpdate:Xe,getBorderClass:Qe,handleMouseDown:Ye,handleMouseOver:Ge,headersRef:fe,hiddenColumns:Ae,hoveredHeaderRef:ve,isInitialFocusedCell:Ze,isSelected:_e,isWidthDragging:Re,mainBodyRef:ge,onCellEdit:P,onColumnOrderChange:F,onSort:nn,onTableHeaderDragEnd:rn,pinnedLeftRef:we,pinnedRightRef:me,rowHeight:J,scrollbarWidth:He,selectableColumns:Q,setIsWidthDragging:Ce,setFlattenedRows:Ke,setScrollTop:Oe,setSelectedCells:en,shouldPaginate:ee,sort:Le,sortDownIcon:re,sortUpIcon:oe,tableBodyContainerRef:pe,visibleRows:Je}),n(ue,{columnEditorText:w,editColumns:S,editColumnsInitOpen:k,headers:fe.current,hiddenColumns:Ae,position:h,setHiddenColumns:Pe})]})),n(le,{mainBodyRef:ge,pinnedLeftRef:we,pinnedRightRef:me,tableContentWidth:Ee})]})),n(R,{currentPage:be,hideFooter:L,nextIcon:A,onPageChange:ye,onNextPage:z,onPreviousPage:U,prevIcon:K,shouldPaginate:ee,totalPages:se||Math.ceil(We.length/Y)})]}))}));export{he 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){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}function o(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 i,a=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},l=function(n){var t=n.currentPage,o=n.hideFooter,i=n.nextIcon,a=n.onPageChange,l=n.onNextPage,d=n.onPreviousPage,s=n.prevIcon,c=n.shouldPaginate,u=n.totalPages;if(o||!c)return null;var f=!(t>1)&&!d,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),d&&d(e-1)},disabled:f},{children:s})),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&&d&&d(e-1))},className:"st-page-btn ".concat(t===o+1?"active":"")},{children:o+1}),o)}))]}))},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:"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"})}))},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 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},u=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"})}))},f=function(e){return e.position*(e.rowHeight+1)-1},h=function(e){return e.position*(e.rowHeight+1)},v=function(e){var n=e.accessor,r=e.rowIndex;return"cell-".concat(n,"-").concat(r)},g=function(e){var n=e.hiddenColumns,r=e.header,t=e.pinned;return n[r.accessor]?null:!t&&!r.pinned||r.pinned===t||null},w=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)}})},p=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)}})},x=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(w,{onBlur:a,onChange:i,value:o}):"number"==typeof o?e.jsx(p,{defaultValue:o,onBlur:a,onChange:i}):null})},R=0,I=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===R||o-R>=t)&&(R=o,n(r))}},C=Date.now(),b={screenX:0,screenY:0},y=function(e){var r,t,i=e.draggedHeaderRef,a=e.headersRef,l=e.hoveredHeaderRef,d=e.onColumnOrderChange,s=e.onTableHeaderDragEnd,c=(r=a.current,t=n.useRef(r),n.useEffect((function(){t.current=r}),[r]),t.current);return{handleDragStart:function(e){i.current=e,C=Date.now()},handleDragOver:function(e){var n,r=e.event,t=e.hoveredHeader;if(r.preventDefault(),a.current){var d=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=r.screenX,f=r.screenY,h=Math.sqrt(Math.pow(u-b.screenX,2)+Math.pow(f-b.screenY,2));l.current=t;var v=o([],a.current,!0),g=v.findIndex((function(e){var n;return e.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)})),w=v.findIndex((function(e){return e.accessor===t.accessor})),m=v.splice(g,1)[0];if(v.splice(w,0,m),!(d||t.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)||null===i.current||h<10||void 0===g||void 0===w||JSON.stringify(v)===JSON.stringify(a.current))){var p=Date.now();JSON.stringify(v)===JSON.stringify(c)&&p-C<800&&h<50||(C=p,b={screenX:u,screenY:f},s(v))}}},handleDragEnd:function(){i.current=null,l.current=null,null==d||d(a.current)}}},M=n.forwardRef((function(t,o){var i,a,l=t.borderClass,d=t.colIndex,c=t.draggedHeaderRef,f=t.header,h=t.headersRef,g=t.hoveredHeaderRef,w=t.isSelected,m=t.isInitialFocusedCell,p=t.onCellEdit,R=t.onExpandRowClick,C=t.onMouseDown,b=t.onMouseOver,M=t.onTableHeaderDragEnd,H=t.rowIndex,S=t.visibleRow,E=S.depth,D=S.row,j=n.useState(D.rowData[f.accessor]),k=j[0],N=j[1],T=n.useState(!1),L=T[0],O=T[1],B=y({draggedHeaderRef:c,headersRef:h,hoveredHeaderRef:g,onTableHeaderDragEnd:M}).handleDragOver,W=I(),A="cell-".concat(H,"-").concat(d),F=Boolean(null===(a=null===(i=D.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),P=Boolean(null==f?void 0:f.isEditable),z=H%2==0,U="st-cell ".concat(E>0&&f.expandable?"st-cell-depth-".concat(E):""," ").concat(w?m?"st-cell-selected-first ".concat(l):"st-cell-selected ".concat(l):""," ").concat(z?"st-cell-odd-row":"st-cell-even-row"," ").concat(P?"clickable":"");n.useEffect((function(){N(D.rowData[f.accessor])}),[f.accessor,D]);return L?e.jsx("div",r({className:"st-cell-editing ".concat(z?"st-cell-odd-row":"st-cell-even-row"),id:v({accessor:f.accessor,rowIndex:H+1})},{children:e.jsx(x,{onChange:function(e){N(e),null==p||p({accessor:f.accessor,newValue:e,row:D})},setIsEditing:O,value:k})})):e.jsxs("div",r({className:U,id:A,onDoubleClick:function(){return f.isEditable&&O(!0)},onMouseDown:function(){return C({rowIndex:H,colIndex:d,rowId:D.rowMeta.rowId})},onMouseOver:function(){return b({rowIndex:H,colIndex:d,rowId:D.rowMeta.rowId})},onDragOver:function(e){return W({callback:B,callbackProps:{event:e,hoveredHeader:f},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!f.isEditable||L||(e.preventDefault(),O(!0))},ref:o,"data-row-index":H,"data-col-index":d,"aria-selected":w},{children:[f.expandable&&F?D.rowMeta.isExpanded?e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return R(D.rowMeta.rowId)}},{children:e.jsx(u,{className:"st-sort-icon"})})):e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return R(D.rowMeta.rowId)}},{children:e.jsx(s,{className:"st-sort-icon"})})):null,e.jsx("span",r({className:"st-cell-content ".concat("right"===f.align?"right-aligned":"center"===f.align?"center-aligned":"")},{children:f.cellRenderer?f.cellRenderer({accessor:f.accessor,colIndex:d,row:D}):k}))]}))})),H=function(n){var o=n.allowAnimations,i=n.children,a=t(n,["allowAnimations","children"]);return o?e.jsx(S,r({},a,{children:i})):e.jsx(e.Fragment,{children:i})},S=function(r){var t=r.allowHorizontalAnimate,o=void 0===t||t,i=r.children,a=r.draggedHeaderRef,l=r.headersRef,d=r.isBody,s=r.mainBodyRef,c=r.pauseAnimation,u=r.rowIndex,f=n.useRef(!1),h=n.useState({}),g=h[0],w=h[1],m=n.useRef({}),p=l.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(v({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:a,rowIndex:u});JSON.stringify(e)!==JSON.stringify(g)&&(m.current=g,w(e))}}),[g,p,a,d,u]),n.useLayoutEffect((function(){var e=s.current,n=function(){f.current=!0},r=function(){f.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)}}),[a,s]),n.useEffect((function(){c||f.current||Object.keys(m.current).length&&p&&p.forEach((function(e){var n=document.getElementById(v({accessor:e.accessor,rowIndex:u}));if(n){var r=m.current[e.accessor],t=g[e.accessor];if(r&&t){var i=r.left-t.left,a=o?0:r.top-t.top,l=Math.abs(i),d=Math.abs(a);(l>10||d>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(i,"px, ").concat(a,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[o,g,p,d,c,m,u]),e.jsx(e.Fragment,{children:i})},E=function(n){var o=n.getBorderClass,i=n.handleMouseDown,a=n.handleMouseOver,l=n.headers,d=n.hiddenColumns,s=n.isSelected,c=n.isInitialFocusedCell,u=n.onExpandRowClick,f=n.pinned,h=n.rowIndex,w=n.visibleRow,m=t(n,["getBorderClass","handleMouseDown","handleMouseOver","headers","hiddenColumns","isSelected","isInitialFocusedCell","onExpandRowClick","pinned","rowIndex","visibleRow"]);return e.jsx(H,r({allowAnimations:m.allowAnimations,allowHorizontalAnimate:m.shouldPaginate,draggedHeaderRef:m.draggedHeaderRef,headersRef:m.headersRef,isBody:!0,mainBodyRef:m.mainBodyRef,pauseAnimation:m.isWidthDragging,rowIndex:h+1},{children:l.map((function(n,t){return g({hiddenColumns:d,header:n,pinned:f})?e.jsx(D,r({colIndex:t,getBorderClass:o,handleMouseDown:i,handleMouseOver:a,header:n,headers:l,hiddenColumns:d,isInitialFocusedCell:c,isSelected:s,onExpandRowClick:u,pinned:f,rowIndex:h,visibleRow:w},m),v({accessor:n.accessor,rowIndex:h+1})):null}))}))},D=function(o){var i=o.colIndex,a=o.getBorderClass,l=o.handleMouseDown,d=o.handleMouseOver,s=o.header,c=o.isInitialFocusedCell,u=o.isSelected,f=o.onExpandRowClick,h=o.rowIndex,g=o.visibleRow,w=t(o,["colIndex","getBorderClass","handleMouseDown","handleMouseOver","header","isInitialFocusedCell","isSelected","onExpandRowClick","rowIndex","visibleRow"]);return s.children?e.jsx(e.Fragment,{children:s.children.map((function(n,t){return e.jsx(D,r({colIndex:i+t,getBorderClass:a,handleMouseDown:l,handleMouseOver:d,header:n,isSelected:u,isInitialFocusedCell:c,onExpandRowClick:f,rowIndex:h,visibleRow:g},w),v({accessor:n.accessor,rowIndex:h+1}))}))}):n.createElement(M,r({},w,{borderClass:a({rowIndex:h,colIndex:i,rowId:g.row.rowMeta.rowId}),colIndex:i,header:s,isSelected:u({rowIndex:h,colIndex:i,rowId:g.row.rowMeta.rowId}),isInitialFocusedCell:c({rowIndex:h,colIndex:i,rowId:g.row.rowMeta.rowId}),key:v({accessor:s.accessor,rowIndex:h+1}),onExpandRowClick:f,onMouseDown:function(){return l({rowIndex:h,colIndex:i,rowId:g.row.rowMeta.rowId})},onMouseOver:function(){return d({rowIndex:h,colIndex:i,rowId:g.row.rowMeta.rowId})},rowIndex:h,visibleRow:g}))},j=function(n){var t=n.getNextRowIndex,o=n.gridTemplateColumns,i=n.index,a=n.pinned,l=n.props,d=n.rowHeight,s=n.visibleRow,c=s.position,u=t();return e.jsx("div",r({className:"st-table-row",style:{gridTemplateColumns:o,top:h({position:c,rowHeight:d}),height:"".concat(d,"px")}},{children:e.jsx(E,r({pinned:a,rowIndex:u,visibleRow:s},l),i)}))},k=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:f({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},N=function(o){o.headerContainerRef;var i=o.onExpandRowClick,a=o.pinned,l=o.rowHeight,d=o.sectionRef,s=o.templateColumns,c=o.totalHeight,u=o.visibleRows,f=o.width,h=t(o,["headerContainerRef","onExpandRowClick","pinned","rowHeight","sectionRef","templateColumns","totalHeight","visibleRows","width"]),v=a?"st-table-body-pinned-".concat(a):"st-table-body-main",g=n.useRef(0);n.useEffect((function(){g.current=0}));var w=function(){return g.current++};return e.jsx("div",r({className:v,ref:d,style:{position:"relative",height:"".concat(c,"px"),width:f}},{children:u.map((function(t,o){var d,c,f=Boolean(null===(c=null===(d=t.row.rowMeta)||void 0===d?void 0:d.children)||void 0===c?void 0:c.length);return e.jsxs(n.Fragment,{children:[e.jsx(j,{getNextRowIndex:w,gridTemplateColumns:s,index:o,pinned:a,props:r(r({},h),{onExpandRowClick:i,rowHeight:l,visibleRows:u}),rowHeight:l,visibleRow:t}),0!==o&&e.jsx(k,{lastGroupRow:f,position:t.position,rowHeight:l,templateColumns:s})]},o)}))}))};!function(e){e.LEFT="left",e.RIGHT="right"}(i||(i={}));var T,L=function(t){var o,a,l,d,s,c=t.centerHeaderRef,u=t.flattenedRows,f=t.headerContainerRef,h=t.mainBodyRef,v=t.mainTemplateColumns,g=t.pinnedLeftColumns,w=t.pinnedLeftHeaderRef,m=t.pinnedLeftRef,p=t.pinnedLeftTemplateColumns,x=t.pinnedRightColumns,R=t.pinnedRightHeaderRef,I=t.pinnedRightRef,C=t.pinnedRightTemplateColumns,b=t.rowHeight,y=t.scrollbarWidth,M=t.setFlattenedRows,H=t.setScrollTop,S=t.tableBodyContainerRef,E=t.visibleRows;!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:f,mainSectionRef:S,scrollbarWidth:y});var D,j,k=n.useRef(null),T=(D=0,(j=function(e){e.forEach((function(e){D+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&j(e.rowMeta.children)}))})(u),D)*(b+1)-1,L=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};M((function(e){return e.map(n)}))},O=(null===(o=w.current)||void 0===o?void 0:o.clientWidth)?(null===(a=w.current)||void 0===a?void 0:a.clientWidth)+1:0,B=null===(l=c.current)||void 0===l?void 0:l.clientWidth,W=(null===(d=R.current)||void 0===d?void 0:d.clientWidth)?(null===(s=R.current)||void 0===s?void 0:s.clientWidth)+1:0;return e.jsxs("div",r({className:"st-table-body-container",ref:S,onScroll:function(e){var n=e.currentTarget.scrollTop;k.current&&cancelAnimationFrame(k.current),k.current=requestAnimationFrame((function(){H(n)}))}},{children:[g.length>0&&e.jsx(N,r({},t,{onExpandRowClick:L,pinned:i.LEFT,rowHeight:b,sectionRef:m,templateColumns:p,totalHeight:T,visibleRows:E,width:O})),e.jsx(N,r({},t,{onExpandRowClick:L,rowHeight:b,sectionRef:h,templateColumns:v,totalHeight:T,visibleRows:E,width:B})),x.length>0&&e.jsx(N,r({},t,{onExpandRowClick:L,pinned:i.RIGHT,rowHeight:b,sectionRef:I,templateColumns:C,totalHeight:T,visibleRows:E,width:W}))]}))},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])},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)}},W=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,t){var i=t.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction,d=new Map,s=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(d.size)).toString();c=t,s.set(c,e),d.has(c)||d.set(c,[])}else if(c){var o=d.get(c)||[];o.push(e),d.set(c,o)}else{var i="default";d.has(i)||d.set(i,[]),null===(r=d.get(i))||void 0===r||r.push(e)}}));var u=[];return d.forEach((function(e,i){if(s.has(i)){var d=s.get(i);d.rowMeta.children&&d.rowMeta.children.length>0&&(d.rowMeta.children=F(d.rowMeta.children,n,t)),u.push(d)}var c=o([],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 W(o,i,a,l)}));u.push.apply(u,c.map((function(e){var o=r({},e);if(o.rowMeta.children&&o.rowMeta.children.length>0){var i=F(o.rowMeta.children,n,t);o.rowMeta=r(r({},o.rowMeta),{children:i})}return o})))})),u},F=function(e,n,t){var i=t.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction;return o([],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 W(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:F(e.rowMeta.children,n,t)})}):e}))},P=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 s=function(e){var r=Math.max(l+(e.clientX-d),40);o&&i.current&&(i.current[n].width=r,t())},c=function(){document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),a(!1)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c)}},z=n.forwardRef((function(t,o){var i=t.colIndex,l=t.columnReordering,d=t.columnResizing,s=t.currentRows,c=t.draggedHeaderRef,u=t.forceUpdate,f=t.gridColumnEnd,h=t.gridColumnStart,g=t.gridRowEnd,w=t.gridRowStart,m=t.header,p=t.headersRef,x=t.hoveredHeaderRef,R=t.onColumnOrderChange,C=t.onSort,b=t.onTableHeaderDragEnd,M=t.reverse,H=t.rowHeight,S=t.selectableColumns,E=t.setIsWidthDragging,D=t.setSelectedCells,j=t.sort,k=t.sortDownIcon,N=t.sortUpIcon,T=n.useState(!1),L=T[0],O=T[1],B=Boolean(null==m?void 0:m.isSortable),W="st-header-cell ".concat(m===x.current?"st-hovered":""," ").concat(L?"st-dragging":""," ").concat(B?"clickable":""," ").concat(l&&!B?"columnReordering":""," ").concat("right"===(null==m?void 0:m.align)?"right-aligned":"center"===(null==m?void 0:m.align)?"center-aligned":""),A=y({draggedHeaderRef:c,headersRef:p,hoveredHeaderRef:x,onColumnOrderChange:R,onTableHeaderDragEnd:b}),F=A.handleDragStart,z=A.handleDragEnd,U=A.handleDragOver,q=I(),G=function(e){var n=e.event,r=e.header;if(S){var t=s.length,o=Array.from({length:t},(function(e,n){return a({rowIndex:n,colIndex:i,rowId:s[n].rowMeta.rowId})})),l=function(e,n){var r=new Set,o=Math.min(e,n),i=Math.max(e,n);return Array.from({length:t}).forEach((function(e,n){Array.from({length:i-o+1}).forEach((function(e,t){r.add(a({rowIndex:n,colIndex:o+t,rowId:s[n].rowMeta.rowId}))}))})),r};n.shiftKey?D((function(e){var n,r=Number(null===(n=Array.from(e)[0])||void 0===n?void 0:n.split("-")[1]),t=Number(o[0].split("-")[1]);return r===t?new Set(o):r>t?l(t,r):l(r,t)})):D(new Set(o))}else r.isSortable&&C(i,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)}}),[]),!m)return null;var K=d&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;q({callback:P,callbackProps:{colIndex:i,event:e,forceUpdate:u,header:m,headersRef:p,setIsWidthDragging:E,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),V=j&&j.key.accessor===m.accessor&&e.jsxs("div",r({className:"st-sort-icon-container",onClick:function(e){return G({event:e,header:m})}},{children:["ascending"===j.direction&&N&&N,"descending"===j.direction&&k&&k]}));return e.jsxs("div",r({className:W,id:v({accessor:m.accessor,rowIndex:0}),onDragOver:function(e){q({callback:U,callbackProps:{event:e,hoveredHeader:m},limit:50})},ref:o,style:r(r({gridRowStart:w,gridRowEnd:g,gridColumnStart:h,gridColumnEnd:f},f-h>1?{}:{width:m.width}),g-w>1?{}:{height:H})},{children:[M&&K,e.jsxs("div",r({className:"st-header-label ".concat("right"===m.align?"right-aligned":"center"===m.align?"center-aligned":""),draggable:l,onClick:function(e){return G({event:e,header:m})},onDragEnd:function(e){e.preventDefault(),O(!1),z()},onDragStart:function(e){l&&m&&function(e){O(!0),F(e)}(m)}},{children:["right"===m.align&&V,null==m?void 0:m.label,"right"!==m.align&&V]})),!M&&K]}))})),U=function(o){var i,a,l=o.depth,d=o.getNextColIndex,s=o.header,c=o.hiddenColumns,u=o.index,f=o.maxDepth,h=o.pinned,v=t(o,["depth","getNextColIndex","header","hiddenColumns","index","maxDepth","pinned"]),w=null!==(a=null===(i=s.children)||void 0===i?void 0:i.length)&&void 0!==a?a:0,m=d(0===u?0:1),p={gridColumnStart:m,gridColumnEnd:w>0?m+w:m+1,gridRowStart:l,gridRowEnd:w>0?l+1:f+1};if(s.children){var x=s.children.filter((function(e){return g({hiddenColumns:c,header:e,pinned:h})}));return e.jsxs(n.Fragment,{children:[e.jsx(z,r({},v,p,{colIndex:m,header:s,ref:n.createRef()})),x.map((function(e,t){return n.createElement(U,r({},v,{depth:l+1,getNextColIndex:d,header:e,hiddenColumns:c,index:t,key:e.accessor,maxDepth:f}))}))]})}return e.jsx(z,r({},v,p,{colIndex:m,header:s,ref:n.createRef()}))},q=function(t){var o=t.allowAnimations,a=t.columnReordering,l=t.columnResizing,d=t.currentRows,s=t.draggedHeaderRef,c=t.forceUpdate,u=t.gridTemplateColumns,f=t.handleScroll,h=t.headersRef,v=t.hiddenColumns,w=t.hoveredHeaderRef,m=t.isWidthDragging,p=t.mainBodyRef,x=t.maxDepth,R=t.onColumnOrderChange,I=t.onSort,C=t.onTableHeaderDragEnd,b=t.pinned,y=t.rowHeight,M=t.sectionRef,S=t.selectableColumns,E=t.setIsWidthDragging,D=t.setSelectedCells,j=t.sort,k=t.sortDownIcon,N=t.sortUpIcon,T=n.useRef(1);n.useEffect((function(){T.current=1}));var L=function(e){return void 0===e&&(e=1),T.current+=e,T.current},O=h.current.filter((function(e){return g({hiddenColumns:v,header:e,pinned:b})}));return e.jsx("div",r({className:"st-header-".concat(b?"pinned-".concat(b):"main")},f&&{onScroll:f},{ref:M,style:{gridTemplateColumns:u}},{children:e.jsx(H,r({allowAnimations:o,draggedHeaderRef:s,headersRef:h,mainBodyRef:p,pauseAnimation:m,rowIndex:0},{children:O.map((function(n,r){return e.jsx(U,{getNextColIndex:L,columnReordering:a,columnResizing:l,currentRows:d,depth:1,draggedHeaderRef:s,forceUpdate:c,header:n,headersRef:h,hiddenColumns:v,hoveredHeaderRef:w,index:r,maxDepth:x,onColumnOrderChange:R,onSort:I,onTableHeaderDragEnd:C,pinned:b,reverse:b===i.RIGHT,rowHeight:y,selectableColumns:S,setIsWidthDragging:E,setSelectedCells:D,sort:j,sortDownIcon:k,sortUpIcon:N},n.accessor)}))}))}))},G=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(G)):1},K=function(t){var o=t.allowAnimations,a=t.centerHeaderRef,l=t.columnResizing,d=t.currentRows,s=t.columnReordering,c=t.draggedHeaderRef,u=t.forceUpdate,f=t.headerContainerRef,h=t.headersRef,v=t.hiddenColumns,w=t.hoveredHeaderRef,m=t.isWidthDragging,p=t.mainBodyRef,x=t.mainTemplateColumns,R=t.onColumnOrderChange,I=t.onSort,C=t.onTableHeaderDragEnd,b=t.pinnedLeftColumns,y=t.pinnedLeftHeaderRef,M=t.pinnedLeftTemplateColumns,H=t.pinnedRightColumns,S=t.pinnedRightHeaderRef,E=t.pinnedRightTemplateColumns,D=t.rowHeight,j=t.selectableColumns,k=t.setIsWidthDragging,N=t.setSelectedCells,T=t.sort,L=t.sortDownIcon,B=t.sortUpIcon;O(p,a);var W=function(e){var n,r,t=null===(n=a.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=p.current)||void 0===r||r.scrollTo(t,0))},A=n.useMemo((function(){var e=h.current,n=0;return e.forEach((function(e){if(g({hiddenColumns:v,header:e})){var r=G(e);n=Math.max(n,r)}})),{maxDepth:n}}),[h,v]).maxDepth,F={allowAnimations:o,columnReordering:s,columnResizing:l,currentRows:d,draggedHeaderRef:c,forceUpdate:u,handleScroll:W,headersRef:h,hiddenColumns:v,hoveredHeaderRef:w,isWidthDragging:m,mainBodyRef:p,maxDepth:A,onColumnOrderChange:R,onSort:I,onTableHeaderDragEnd:C,rowHeight:D,selectableColumns:j,setIsWidthDragging:k,setSelectedCells:N,sort:T,sortDownIcon:L,sortUpIcon:B};return e.jsxs("div",r({className:"st-header-container",ref:f},{children:[b.length>0&&e.jsx(q,r({},F,{gridTemplateColumns:M,pinned:i.LEFT,sectionRef:y})),e.jsx(q,r({},F,{gridTemplateColumns:x,handleScroll:W,sectionRef:a})),H.length>0&&e.jsx(q,r({},F,{gridTemplateColumns:E,pinned:i.RIGHT,sectionRef:S}))]}))},V=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(" "))},J=function(t){var o=t.allowAnimations,i=t.columnReordering,a=t.columnResizing,l=t.currentRows,d=t.draggedHeaderRef,s=t.editColumns,c=t.flattenedRows,u=t.forceUpdate,f=t.getBorderClass,h=t.handleMouseDown,v=t.handleMouseOver,g=t.headersRef,w=t.hiddenColumns,m=t.hoveredHeaderRef,p=t.isSelected,x=t.isInitialFocusedCell,R=t.isWidthDragging,I=t.mainBodyRef,C=t.onCellEdit,b=t.onColumnOrderChange,y=t.onSort,M=t.onTableHeaderDragEnd,H=t.pinnedLeftRef,S=t.pinnedRightRef,E=t.rowHeight,D=t.scrollbarWidth,j=t.selectableColumns,k=t.setIsWidthDragging,N=t.setFlattenedRows,T=t.setScrollTop,O=t.setSelectedCells,B=t.shouldPaginate,W=t.sort,A=t.sortDownIcon,F=t.sortUpIcon,P=t.tableBodyContainerRef,z=t.visibleRows,U=n.useRef(null),q=n.useRef(null),G=n.useRef(null),J=n.useRef(null),X=g.current.filter((function(e){return!e.pinned})),Y=g.current.filter((function(e){return"left"===e.pinned})),_=g.current.filter((function(e){return"right"===e.pinned})),$=n.useMemo((function(){return V({headers:Y,hiddenColumns:w})}),[Y,w]),Q=n.useMemo((function(){return V({headers:X,hiddenColumns:w})}),[X,w]),Z=n.useMemo((function(){return V({headers:_,hiddenColumns:w})}),[_,w]),ee={allowAnimations:o,centerHeaderRef:G,columnResizing:a,currentRows:l,columnReordering:i,draggedHeaderRef:d,forceUpdate:u,headerContainerRef:U,headersRef:g,hiddenColumns:w,hoveredHeaderRef:m,isWidthDragging:R,mainBodyRef:I,mainTemplateColumns:Q,onColumnOrderChange:b,onSort:y,onTableHeaderDragEnd:M,pinnedLeftColumns:Y,pinnedLeftHeaderRef:q,pinnedLeftTemplateColumns:$,pinnedRightColumns:_,pinnedRightHeaderRef:J,pinnedRightTemplateColumns:Z,rowHeight:E,selectableColumns:j,setIsWidthDragging:k,setSelectedCells:O,sort:W,sortDownIcon:A,sortUpIcon:F,tableBodyContainerRef:P},ne={allowAnimations:o,centerHeaderRef:G,draggedHeaderRef:d,flattenedRows:c,getBorderClass:f,handleMouseDown:h,handleMouseOver:v,headerContainerRef:U,headers:g.current,headersRef:g,hiddenColumns:w,hoveredHeaderRef:m,isSelected:p,isInitialFocusedCell:x,isWidthDragging:R,mainBodyRef:I,mainTemplateColumns:Q,onCellEdit:C,onTableHeaderDragEnd:M,pinnedLeftColumns:Y,pinnedLeftHeaderRef:q,pinnedLeftRef:H,pinnedLeftTemplateColumns:$,pinnedRightColumns:_,pinnedRightHeaderRef:J,pinnedRightRef:S,pinnedRightTemplateColumns:Z,rowHeight:E,scrollbarWidth:D,setFlattenedRows:N,shouldPaginate:B,setScrollTop:T,tableBodyContainerRef:P,visibleRows:z};return e.jsxs("div",r({className:"st-table-content",style:{width:s?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(K,r({},ee)),e.jsx(L,r({},ne))]}))},X=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])},Y=function(t){var o=t.mainBodyRef,i=t.pinnedLeftRef,a=t.pinnedRightRef,l=t.tableContentWidth,d=n.useState(0),s=d[0],c=d[1],u=n.useState(0),f=u[0],h=u[1],v=n.useState(0),g=v[0],w=v[1],m=n.useRef(null);return X({widthAttribute:"offsetWidth",callback:c,ref:i}),X({widthAttribute:"scrollWidth",callback:w,ref:o}),X({widthAttribute:"offsetWidth",callback:h,ref:a}),O(o,m),!o.current||o.current.scrollWidth<=o.current.clientWidth?null:e.jsxs("div",r({className:"st-horizontal-scrollbar-container",style:{width:l}},{children:[s>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:s}}),g>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:m},{children:e.jsx("div",{style:{width:g}})})),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]),d=n.useState(l),s=d[0],c=d[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:s,setHiddenColumns:c}},$=function(t){var o=t.checked,i=void 0!==o&&o,a=t.children,l=t.onChange,d=n.useState(i),s=d[0],c=d[1];return e.jsxs("label",r({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:s,className:"st-checkbox-input",onChange:function(){var e=!s;c(e),l&&l(e)},type:"checkbox"}),e.jsx("span",r({className:"st-checkbox-custom ".concat(s?"st-checked":"")},{children:s&&e.jsx("span",{className:"st-checkbox-checkmark"})})),a]}))},Q=function(n){var t=n.headers,o=n.open,i=n.position;n.setOpen;var a=n.setHiddenColumns,l=n.hiddenColumns,d="left"===i?"left":"";return e.jsx("div",r({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(d),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($,r({checked:l[n.accessor],onChange:function(e){var t;return a(r(r({},l),((t={})[n.accessor]=e,t)))}},{children:n.label}),t)}))}))}))},Z=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,l=t.headers,d=t.position,s=void 0===d?"right":d,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(s),onClick:function(){return function(e){v(e)}(!h)}},{children:[e.jsx("div",r({className:"st-column-editor-text"},{children:o})),e.jsx(Q,{headers:l,open:h,position:s,setOpen:v,setHiddenColumns:c,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(T||(T={}));var ee=n.memo((function(t){var o=t.allowAnimations,i=void 0!==o&&o,f=t.columnEditorPosition,h=void 0===f?T.Right:f,v=t.columnEditorText,g=void 0===v?"Columns":v,w=t.columnResizing,m=void 0!==w&&w,p=t.defaultHeaders,x=t.editColumns,R=void 0!==x&&x,I=t.editColumnsInitOpen,C=void 0!==I&&I,b=t.columnReordering,y=void 0!==b&&b,M=t.height,H=t.hideFooter,S=void 0!==H&&H,E=t.nextIcon,D=void 0===E?e.jsx(s,{className:"st-next-prev-icon"}):E,j=t.onCellEdit,k=t.onColumnOrderChange,N=t.onNextPage,L=t.onPreviousPage,O=t.prevIcon,B=void 0===O?e.jsx(d,{className:"st-next-prev-icon"}):O,W=t.rowHeight,A=void 0===W?40:W,F=t.rows,P=t.rowsPerPage,z=void 0===P?10:P,U=t.selectableCells,q=void 0!==U&&U,G=t.selectableColumns,K=void 0!==G&&G,V=t.shouldPaginate,X=void 0!==V&&V,$=t.sortDownIcon,Q=void 0===$?e.jsx(u,{className:"st-sort-icon"}):$,ee=t.sortUpIcon,ne=void 0===ee?e.jsx(c,{className:"st-sort-icon"}):ee,re=t.theme,te=void 0===re?"light":re,oe=t.totalPages,ie=n.useRef(null),ae=n.useRef(p),le=n.useRef(null),de=n.useRef(null),se=n.useRef(null),ce=n.useRef(null),ue=n.useRef(null),fe=n.useState(!1),he=fe[0],ve=fe[1],ge=n.useState(1),we=ge[0],me=ge[1],pe=n.useState(0),xe=pe[0],Re=pe[1],Ie=n.useState(0),Ce=Ie[0],be=Ie[1],ye=n.useState(0),Me=ye[0],He=ye[1],Se=_({headers:ae.current,tableRows:F}),Ee=Se.sort,De=Se.sortedRows,je=Se.hiddenColumns,ke=Se.setHiddenColumns,Ne=Se.updateSort,Te=n.useMemo((function(){if(!X)return De;var e=(we-1)*z,n=e+z;return De.slice(e,n)}),[we,z,X,De]),Le=n.useState(Te),Oe=Le[0],Be=Le[1];n.useEffect((function(){Be(Te)}),[Te]);var We=n.useMemo((function(){var e;if(!M)return window.innerHeight-A;var n=document.querySelector(".simple-table-root"),r=0;if(M.endsWith("px"))r=parseInt(M,10);else if(M.endsWith("vh")){var t=parseInt(M,10);r=window.innerHeight*t/100}else if(M.endsWith("%")){var o=parseInt(M,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-A)}),[M,A]),Ae=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,d=Math.max(0,i-o*n),s=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>=s)break;f+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&&c(u.rowMeta.children,n+1)}};return c(t,0),a}({bufferRowCount:5,contentHeight:We,flattenedRows:Oe,rowHeight:A,scrollTop:Me})}),[We,A,Oe,Me]),Fe=n.useReducer((function(e){return e+1}),0)[1],Pe=function(e){var r=e.selectableCells,t=e.headers,o=e.visibleRows,i=n.useState(new Set),l=i[0],d=i[1],s=n.useState(null),c=s[0],u=s[1],f=n.useRef(!1),h=n.useRef(null),v=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]),g=n.useCallback((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),i=Math.max(e.rowIndex,n.rowIndex),l=Math.min(e.colIndex,n.colIndex),s=Math.max(e.colIndex,n.colIndex),c=t;c<=i;c++)for(var u=l;u<=s;u++)if(c>=0&&c<o.length){var f=o[c].row.rowMeta.rowId;r.add(a({colIndex:u,rowIndex:c,rowId:f}))}d(r)}),[o]),w=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<t.length){var n=a(e);d(new Set([n])),u(e)}}),[t.length,o.length]);n.useEffect((function(){var e=function(e){if(r&&c){var n=c.rowIndex,i=c.colIndex,a=c.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 s={rowIndex:n-1,colIndex:i,rowId:o[n-1].row.rowMeta.rowId};w(s)}}else"ArrowDown"===e.key?(e.preventDefault(),n<o.length-1&&(s={rowIndex:n+1,colIndex:i,rowId:o[n+1].row.rowMeta.rowId},w(s))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(s={rowIndex:n,colIndex:i-1,rowId:o[n].row.rowMeta.rowId},w(s))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<t.length-1&&(s={rowIndex:n,colIndex:i+1,rowId:o[n].row.rowMeta.rowId},w(s))):"Escape"===e.key&&(d(new Set),h.current=null,u(null))}else v()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[v,t.length,c,g,w,r,o]);var m=n.useCallback((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=a({colIndex:n,rowIndex:r,rowId:t});return l.has(o)}),[l]),p=n.useCallback((function(e){var n,r,t,i,a,l,d=e.colIndex,s=e.rowIndex,c=e.rowId,u=[],f=null===(t=null===(r=null===(n=o[s-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,h={colIndex:d,rowIndex:s+1,rowId:null===(l=null===(a=null===(i=o[s+1])||void 0===i?void 0:i.row)||void 0===a?void 0:a.rowMeta)||void 0===l?void 0:l.rowId},v={colIndex:d-1,rowIndex:s,rowId:c},g={colIndex:d+1,rowIndex:s,rowId:c};return m({colIndex:d,rowIndex:s-1,rowId:f})||u.push("st-selected-top-border"),m(h)||u.push("st-selected-bottom-border"),m(v)||u.push("st-selected-left-border"),m(g)||u.push("st-selected-right-border"),u.join(" ")}),[m,o]),x=n.useMemo((function(){return c?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===c.rowIndex&&r===c.colIndex&&t===c.rowId}:function(){return!1}}),[c]);return{getBorderClass:p,handleMouseDown:function(e){var n=e.colIndex,t=e.rowIndex,o=e.rowId;if(r){f.current=!0,h.current={rowIndex:t,colIndex:n,rowId:o};var i=a({colIndex:n,rowIndex:t,rowId:o});d(new Set([i])),u({rowIndex:t,colIndex:n,rowId:o})}},handleMouseOver:function(e){var n=e.colIndex,t=e.rowIndex;if(e.rowId,r&&f.current&&h.current){for(var i=new Set,l=Math.min(h.current.rowIndex,t),s=Math.max(h.current.rowIndex,t),c=Math.min(h.current.colIndex,n),u=Math.max(h.current.colIndex,n),v=l;v<=s;v++)for(var g=c;g<=u;g++)if(v>=0&&v<o.length){var w=o[v].row.rowMeta.rowId;i.add(a({colIndex:g,rowIndex:v,rowId:w}))}d(i)}},handleMouseUp:function(){f.current=!1},isInitialFocusedCell:x,isSelected:m,selectedCells:l,setSelectedCells:d}}({selectableCells:q,headers:ae.current,visibleRows:Ae}),ze=Pe.handleMouseDown,Ue=Pe.handleMouseOver,qe=Pe.handleMouseUp,Ge=Pe.isSelected,Ke=Pe.getBorderClass,Ve=Pe.isInitialFocusedCell,Je=Pe.setSelectedCells,Xe=n.useCallback((function(e,n){Ne(e,n)}),[Ne]),Ye=n.useCallback((function(e){ae.current=e,Fe()}),[]);return n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||K&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||Je(new Set)};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[K,Je]),n.useLayoutEffect((function(){if(ue.current){var e=ue.current.offsetWidth-ue.current.clientWidth,n=ue.current.clientWidth;Re(e),be(n)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Fe(),ue.current){var e=ue.current.offsetWidth-ue.current.clientWidth,n=ue.current.clientWidth;Re(e),be(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),e.jsxs("div",r({className:"simple-table-root st-wrapper theme-".concat(te),style:M?{height:M}:{}},{children:[e.jsxs("div",r({className:"st-table-wrapper-container"},{children:[e.jsxs("div",r({className:"st-table-wrapper",onMouseUp:qe,onMouseLeave:qe},{children:[e.jsx(J,{allowAnimations:i,columnReordering:y,columnResizing:m,currentRows:Te,draggedHeaderRef:ie,editColumns:R,flattenedRows:Oe,forceUpdate:Fe,getBorderClass:Ke,handleMouseDown:ze,handleMouseOver:Ue,headersRef:ae,hiddenColumns:je,hoveredHeaderRef:le,isInitialFocusedCell:Ve,isSelected:Ge,isWidthDragging:he,mainBodyRef:de,onCellEdit:j,onColumnOrderChange:k,onSort:Xe,onTableHeaderDragEnd:Ye,pinnedLeftRef:se,pinnedRightRef:ce,rowHeight:A,scrollbarWidth:xe,selectableColumns:K,setIsWidthDragging:ve,setFlattenedRows:Be,setScrollTop:He,setSelectedCells:Je,shouldPaginate:X,sort:Ee,sortDownIcon:Q,sortUpIcon:ne,tableBodyContainerRef:ue,visibleRows:Ae}),e.jsx(Z,{columnEditorText:g,editColumns:R,editColumnsInitOpen:C,headers:ae.current,hiddenColumns:je,position:h,setHiddenColumns:ke})]})),e.jsx(Y,{mainBodyRef:de,pinnedLeftRef:se,pinnedRightRef:ce,tableContentWidth:Ce})]})),e.jsx(l,{currentPage:we,hideFooter:S,nextIcon:D,onPageChange:me,onNextPage:N,onPreviousPage:L,prevIcon:B,shouldPaginate:X,totalPages:oe||Math.ceil(De.length/z)})]}))}));exports.SimpleTable=ee;
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){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}function o(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 i,a=function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return"".concat(n,"-").concat(r,"-").concat(t)},l=function(n){var t=n.currentPage,o=n.hideFooter,i=n.nextIcon,a=n.onPageChange,l=n.onNextPage,d=n.onPreviousPage,s=n.prevIcon,c=n.shouldPaginate,u=n.totalPages;if(o||!c)return null;var f=!(t>1)&&!d,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),d&&d(e-1)},disabled:f},{children:s})),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&&d&&d(e-1))},className:"st-page-btn ".concat(t===o+1?"active":"")},{children:o+1}),o)}))]}))},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:"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"})}))},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 11.41L10 6.83l4.59 4.58L16 10l-6-6-6 6z"})}))},u=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"})}))},f=function(e){return e.position*(e.rowHeight+1)-1},h=function(e){return e.position*(e.rowHeight+1)},g=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},w=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)}})},p=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)}})},x=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(w,{onBlur:a,onChange:i,value:o}):"number"==typeof o?e.jsx(p,{defaultValue:o,onBlur:a,onChange:i}):null})},R=0,C=function(){return function(e){var n=e.callback,r=e.callbackProps,t=e.limit,o=Date.now();(0===R||o-R>=t)&&(R=o,n(r))}},I=Date.now(),b={screenX:0,screenY:0},y=function(e){var r,t,i=e.draggedHeaderRef,a=e.headersRef,l=e.hoveredHeaderRef,d=e.onColumnOrderChange,s=e.onTableHeaderDragEnd,c=(r=a.current,t=n.useRef(r),n.useEffect((function(){t.current=r}),[r]),t.current);return{handleDragStart:function(e){i.current=e,I=Date.now()},handleDragOver:function(e){var n,r=e.event,t=e.hoveredHeader;if(r.preventDefault(),a.current){var d=r.currentTarget.getAnimations().some((function(e){return"running"===e.playState})),u=r.screenX,f=r.screenY,h=Math.sqrt(Math.pow(u-b.screenX,2)+Math.pow(f-b.screenY,2));l.current=t;var g=o([],a.current,!0),v=g.findIndex((function(e){var n;return e.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)})),w=g.findIndex((function(e){return e.accessor===t.accessor})),m=g.splice(v,1)[0];if(g.splice(w,0,m),!(d||t.accessor===(null===(n=i.current)||void 0===n?void 0:n.accessor)||null===i.current||h<10||void 0===v||void 0===w||JSON.stringify(g)===JSON.stringify(a.current))){var p=Date.now();JSON.stringify(g)===JSON.stringify(c)&&p-I<800&&h<50||(I=p,b={screenX:u,screenY:f},s(g))}}},handleDragEnd:function(){i.current=null,l.current=null,null==d||d(a.current)}}},M=n.forwardRef((function(t,o){var i,a,l=t.borderClass,d=t.colIndex,c=t.draggedHeaderRef,f=t.header,h=t.headersRef,v=t.hoveredHeaderRef,w=t.isSelected,m=t.isInitialFocusedCell,p=t.onCellEdit,R=t.onExpandRowClick,I=t.onMouseDown,b=t.onMouseOver,M=t.onTableHeaderDragEnd,S=t.rowIndex,H=t.visibleRow,E=H.depth,D=H.row,j=n.useState(D.rowData[f.accessor]),k=j[0],N=j[1],T=n.useState(!1),L=T[0],O=T[1],B=y({draggedHeaderRef:c,headersRef:h,hoveredHeaderRef:v,onTableHeaderDragEnd:M}).handleDragOver,W=C(),A="cell-".concat(S,"-").concat(d),P=Boolean(null===(a=null===(i=D.rowMeta)||void 0===i?void 0:i.children)||void 0===a?void 0:a.length),F=Boolean(null==f?void 0:f.isEditable),z=S%2==0,U="st-cell ".concat(E>0&&f.expandable?"st-cell-depth-".concat(E):""," ").concat(w?m?"st-cell-selected-first ".concat(l):"st-cell-selected ".concat(l):""," ").concat(z?"st-cell-odd-row":"st-cell-even-row"," ").concat(F?"clickable":"");n.useEffect((function(){N(D.rowData[f.accessor])}),[f.accessor,D]);return L?e.jsx("div",r({className:"st-cell-editing ".concat(z?"st-cell-odd-row":"st-cell-even-row"),id:g({accessor:f.accessor,rowIndex:S+1})},{children:e.jsx(x,{onChange:function(e){N(e),null==p||p({accessor:f.accessor,newValue:e,row:D})},setIsEditing:O,value:k})})):e.jsxs("div",r({className:U,id:A,onDoubleClick:function(){return f.isEditable&&O(!0)},onMouseDown:function(){return I({rowIndex:S,colIndex:d,rowId:D.rowMeta.rowId})},onMouseOver:function(){return b({rowIndex:S,colIndex:d,rowId:D.rowMeta.rowId})},onDragOver:function(e){return W({callback:B,callbackProps:{event:e,hoveredHeader:f},limit:50})},onKeyDown:function(e){"F2"!==e.key&&"Enter"!==e.key||!f.isEditable||L||(e.preventDefault(),O(!0))},ref:o,"data-row-index":S,"data-col-index":d,"aria-selected":w},{children:[f.expandable&&P?D.rowMeta.isExpanded?e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return R(D.rowMeta.rowId)}},{children:e.jsx(u,{className:"st-sort-icon"})})):e.jsx("div",r({className:"st-sort-icon-container",onClick:function(){return R(D.rowMeta.rowId)}},{children:e.jsx(s,{className:"st-sort-icon"})})):null,e.jsx("span",r({className:"st-cell-content ".concat("right"===f.align?"right-aligned":"center"===f.align?"center-aligned":"")},{children:f.cellRenderer?f.cellRenderer({accessor:f.accessor,colIndex:d,row:D}):k}))]}))})),S=function(n){var o=n.allowAnimations,i=n.children,a=t(n,["allowAnimations","children"]);return o?e.jsx(H,r({},a,{children:i})):e.jsx(e.Fragment,{children:i})},H=function(r){var t=r.allowHorizontalAnimate,o=void 0===t||t,i=r.children,a=r.draggedHeaderRef,l=r.headersRef,d=r.isBody,s=r.mainBodyRef,c=r.pauseAnimation,u=r.rowIndex,f=n.useRef(!1),h=n.useState({}),v=h[0],w=h[1],m=n.useRef({}),p=l.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(g({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:a,rowIndex:u});JSON.stringify(e)!==JSON.stringify(v)&&(m.current=v,w(e))}}),[v,p,a,d,u]),n.useLayoutEffect((function(){var e=s.current,n=function(){f.current=!0},r=function(){f.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)}}),[a,s]),n.useEffect((function(){c||f.current||Object.keys(m.current).length&&p&&p.forEach((function(e){var n=document.getElementById(g({accessor:e.accessor,rowIndex:u}));if(n){var r=m.current[e.accessor],t=v[e.accessor];if(r&&t){var i=r.left-t.left,a=o?0:r.top-t.top,l=Math.abs(i),d=Math.abs(a);(l>10||d>10)&&requestAnimationFrame((function(){n.style.transform="translate(".concat(i,"px, ").concat(a,"px)"),n.style.transition="transform 0s",requestAnimationFrame((function(){n.style.transform="",n.style.transition="transform ".concat(400,"ms ease-out")}))}))}}}))}),[o,v,p,d,c,m,u]),e.jsx(e.Fragment,{children:i})},E=function(n){var o=n.getBorderClass,i=n.handleMouseDown,a=n.handleMouseOver,l=n.headers,d=n.hiddenColumns,s=n.isSelected,c=n.isInitialFocusedCell,u=n.onExpandRowClick,f=n.pinned,h=n.rowIndex,w=n.visibleRow,m=t(n,["getBorderClass","handleMouseDown","handleMouseOver","headers","hiddenColumns","isSelected","isInitialFocusedCell","onExpandRowClick","pinned","rowIndex","visibleRow"]);return e.jsx(S,r({allowAnimations:m.allowAnimations,allowHorizontalAnimate:m.shouldPaginate,draggedHeaderRef:m.draggedHeaderRef,headersRef:m.headersRef,isBody:!0,mainBodyRef:m.mainBodyRef,pauseAnimation:m.isWidthDragging,rowIndex:h+1},{children:l.map((function(n,t){return v({hiddenColumns:d,header:n,pinned:f})?e.jsx(D,r({colIndex:t,getBorderClass:o,handleMouseDown:i,handleMouseOver:a,header:n,headers:l,hiddenColumns:d,isInitialFocusedCell:c,isSelected:s,onExpandRowClick:u,pinned:f,rowIndex:h,visibleRow:w},m),g({accessor:n.accessor,rowIndex:h+1})):null}))}))},D=function(o){var i=o.colIndex,a=o.getBorderClass,l=o.handleMouseDown,d=o.handleMouseOver,s=o.header,c=o.isInitialFocusedCell,u=o.isSelected,f=o.onExpandRowClick,h=o.rowIndex,v=o.visibleRow,w=t(o,["colIndex","getBorderClass","handleMouseDown","handleMouseOver","header","isInitialFocusedCell","isSelected","onExpandRowClick","rowIndex","visibleRow"]);return s.children?e.jsx(e.Fragment,{children:s.children.map((function(n,t){return e.jsx(D,r({colIndex:i+t,getBorderClass:a,handleMouseDown:l,handleMouseOver:d,header:n,isSelected:u,isInitialFocusedCell:c,onExpandRowClick:f,rowIndex:h,visibleRow:v},w),g({accessor:n.accessor,rowIndex:h+1}))}))}):n.createElement(M,r({},w,{borderClass:a({rowIndex:h,colIndex:i,rowId:v.row.rowMeta.rowId}),colIndex:i,header:s,isSelected:u({rowIndex:h,colIndex:i,rowId:v.row.rowMeta.rowId}),isInitialFocusedCell:c({rowIndex:h,colIndex:i,rowId:v.row.rowMeta.rowId}),key:g({accessor:s.accessor,rowIndex:h+1}),onExpandRowClick:f,onMouseDown:function(){return l({rowIndex:h,colIndex:i,rowId:v.row.rowMeta.rowId})},onMouseOver:function(){return d({rowIndex:h,colIndex:i,rowId:v.row.rowMeta.rowId})},rowIndex:h,visibleRow:v}))},j=function(n){var t=n.getNextRowIndex,o=n.gridTemplateColumns,i=n.index,a=n.pinned,l=n.props,d=n.rowHeight,s=n.visibleRow,c=s.position,u=t();return e.jsx("div",r({className:"st-table-row",style:{gridTemplateColumns:o,top:h({position:c,rowHeight:d}),height:"".concat(d,"px")}},{children:e.jsx(E,r({pinned:a,rowIndex:u,visibleRow:s},l),i)}))},k=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:f({position:o,rowHeight:i}),minWidth:"100%"}},{children:e.jsx("div",{style:{gridColumn:"1 / -1"}})}))},N=function(o){o.headerContainerRef;var i=o.onExpandRowClick,a=o.pinned,l=o.rowHeight,d=o.sectionRef,s=o.templateColumns,c=o.totalHeight,u=o.visibleRows,f=o.width,h=t(o,["headerContainerRef","onExpandRowClick","pinned","rowHeight","sectionRef","templateColumns","totalHeight","visibleRows","width"]),g=a?"st-table-body-pinned-".concat(a):"st-table-body-main",v=n.useRef(0);n.useEffect((function(){v.current=0}));var w=function(){return v.current++};return e.jsx("div",r({className:g,ref:d,style:{position:"relative",height:"".concat(c,"px"),width:f}},{children:u.map((function(t,o){var d,c,f=Boolean(null===(c=null===(d=t.row.rowMeta)||void 0===d?void 0:d.children)||void 0===c?void 0:c.length);return e.jsxs(n.Fragment,{children:[e.jsx(j,{getNextRowIndex:w,gridTemplateColumns:s,index:o,pinned:a,props:r(r({},h),{onExpandRowClick:i,rowHeight:l,visibleRows:u}),rowHeight:l,visibleRow:t}),0!==o&&e.jsx(k,{lastGroupRow:f,position:t.position,rowHeight:l,templateColumns:s})]},o)}))}))},T=function(t){var o,i,a,l,d,s=t.centerHeaderRef,c=t.flattenedRows,u=t.headerContainerRef,f=t.mainBodyRef,h=t.mainTemplateColumns,g=t.pinnedLeftColumns,v=t.pinnedLeftHeaderRef,w=t.pinnedLeftRef,m=t.pinnedLeftTemplateColumns,p=t.pinnedRightColumns,x=t.pinnedRightHeaderRef,R=t.pinnedRightRef,C=t.pinnedRightTemplateColumns,I=t.rowHeight,b=t.scrollbarWidth,y=t.setFlattenedRows,M=t.setScrollTop,S=t.tableBodyContainerRef,H=t.visibleRows;!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:S,scrollbarWidth:b});var E,D,j=n.useRef(null),k=(E=0,(D=function(e){e.forEach((function(e){E+=1,e.rowMeta.isExpanded&&e.rowMeta.children&&D(e.rowMeta.children)}))})(c),E)*(I+1)-1,T=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};y((function(e){return e.map(n)}))},L=(null===(o=v.current)||void 0===o?void 0:o.clientWidth)?(null===(i=v.current)||void 0===i?void 0:i.clientWidth)+1:0,O=null===(a=s.current)||void 0===a?void 0:a.clientWidth,B=(null===(l=x.current)||void 0===l?void 0:l.clientWidth)?(null===(d=x.current)||void 0===d?void 0:d.clientWidth)+1:0;return e.jsxs("div",r({className:"st-table-body-container",ref:S,onScroll:function(e){var n=e.currentTarget.scrollTop;j.current&&cancelAnimationFrame(j.current),j.current=requestAnimationFrame((function(){M(n)}))}},{children:[g.length>0&&e.jsx(N,r({},t,{onExpandRowClick:T,pinned:"left",rowHeight:I,sectionRef:w,templateColumns:m,totalHeight:k,visibleRows:H,width:L})),e.jsx(N,r({},t,{onExpandRowClick:T,rowHeight:I,sectionRef:f,templateColumns:h,totalHeight:k,visibleRows:H,width:O})),p.length>0&&e.jsx(N,r({},t,{onExpandRowClick:T,pinned:"right",rowHeight:I,sectionRef:R,templateColumns:C,totalHeight:k,visibleRows:H,width:B}))]}))},L=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])},O={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 O.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?O.string(e,n,r):"number"==typeof e&&"number"==typeof n?O.number(e,n,r):"boolean"==typeof e&&"boolean"==typeof n?O.boolean(e,n,r):O.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 O.number(i,a,t)}return"date"===r?O.date(String(e),String(n),t):"boolean"===r?O.boolean(Boolean(e),Boolean(n),t):"enum"===r?O.enum(String(e),String(n),t):O.string(String(e),String(n),t)},W=function(e,n,t){var i=t.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction,d=new Map,s=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(d.size)).toString();c=t,s.set(c,e),d.has(c)||d.set(c,[])}else if(c){var o=d.get(c)||[];o.push(e),d.set(c,o)}else{var i="default";d.has(i)||d.set(i,[]),null===(r=d.get(i))||void 0===r||r.push(e)}}));var u=[];return d.forEach((function(e,i){if(s.has(i)){var d=s.get(i);d.rowMeta.children&&d.rowMeta.children.length>0&&(d.rowMeta.children=A(d.rowMeta.children,n,t)),u.push(d)}var c=o([],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 o=r({},e);if(o.rowMeta.children&&o.rowMeta.children.length>0){var i=A(o.rowMeta.children,n,t);o.rowMeta=r(r({},o.rowMeta),{children:i})}return o})))})),u},A=function(e,n,t){var i=t.find((function(e){return e.accessor===n.key.accessor})),a=(null==i?void 0:i.type)||"string",l=n.direction;return o([],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,t)})}):e}))},P=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 s=function(e){var r=Math.max(l+(e.clientX-d),40);o&&i.current&&(i.current[n].width=r,t())},c=function(){document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),a(!1)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c)}},F=n.forwardRef((function(t,o){var i=t.colIndex,l=t.columnReordering,d=t.columnResizing,s=t.currentRows,c=t.draggedHeaderRef,u=t.forceUpdate,f=t.gridColumnEnd,h=t.gridColumnStart,v=t.gridRowEnd,w=t.gridRowStart,m=t.header,p=t.headersRef,x=t.hoveredHeaderRef,R=t.onColumnOrderChange,I=t.onSort,b=t.onTableHeaderDragEnd,M=t.reverse,S=t.rowHeight,H=t.selectableColumns,E=t.setIsWidthDragging,D=t.setSelectedCells,j=t.sort,k=t.sortDownIcon,N=t.sortUpIcon,T=n.useState(!1),L=T[0],O=T[1],B=Boolean(null==m?void 0:m.isSortable),W="st-header-cell ".concat(m===x.current?"st-hovered":""," ").concat(L?"st-dragging":""," ").concat(B?"clickable":""," ").concat(l&&!B?"columnReordering":""," ").concat("right"===(null==m?void 0:m.align)?"right-aligned":"center"===(null==m?void 0:m.align)?"center-aligned":""),A=y({draggedHeaderRef:c,headersRef:p,hoveredHeaderRef:x,onColumnOrderChange:R,onTableHeaderDragEnd:b}),F=A.handleDragStart,z=A.handleDragEnd,U=A.handleDragOver,q=C(),K=function(e){var n=e.event,r=e.header;if(H){var t=s.length,o=Array.from({length:t},(function(e,n){return a({rowIndex:n,colIndex:i,rowId:s[n].rowMeta.rowId})})),l=function(e,n){var r=new Set,o=Math.min(e,n),i=Math.max(e,n);return Array.from({length:t}).forEach((function(e,n){Array.from({length:i-o+1}).forEach((function(e,t){r.add(a({rowIndex:n,colIndex:o+t,rowId:s[n].rowMeta.rowId}))}))})),r};n.shiftKey?D((function(e){var n,r=Number(null===(n=Array.from(e)[0])||void 0===n?void 0:n.split("-")[1]),t=Number(o[0].split("-")[1]);return r===t?new Set(o):r>t?l(t,r):l(r,t)})):D(new Set(o))}else r.isSortable&&I(i,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)}}),[]),!m)return null;var V=d&&e.jsx("div",{className:"st-header-resize-handle",onMouseDown:function(e){var n;q({callback:P,callbackProps:{colIndex:i,event:e,forceUpdate:u,header:m,headersRef:p,setIsWidthDragging:E,startWidth:"object"==typeof o&&null!==o&&"current"in o?null===(n=o.current)||void 0===n?void 0:n.offsetWidth:void 0},limit:10})}}),J=j&&j.key.accessor===m.accessor&&e.jsxs("div",r({className:"st-sort-icon-container",onClick:function(e){return K({event:e,header:m})}},{children:["ascending"===j.direction&&N&&N,"descending"===j.direction&&k&&k]}));return e.jsxs("div",r({className:W,id:g({accessor:m.accessor,rowIndex:0}),onDragOver:function(e){q({callback:U,callbackProps:{event:e,hoveredHeader:m},limit:50})},ref:o,style:r(r({gridRowStart:w,gridRowEnd:v,gridColumnStart:h,gridColumnEnd:f},f-h>1?{}:{width:m.width}),v-w>1?{}:{height:S})},{children:[M&&V,e.jsxs("div",r({className:"st-header-label ".concat("right"===m.align?"right-aligned":"center"===m.align?"center-aligned":""),draggable:l,onClick:function(e){return K({event:e,header:m})},onDragEnd:function(e){e.preventDefault(),O(!1),z()},onDragStart:function(e){l&&m&&function(e){O(!0),F(e)}(m)}},{children:["right"===m.align&&J,null==m?void 0:m.label,"right"!==m.align&&J]})),!M&&V]}))})),z=function(o){var i,a,l=o.depth,d=o.getNextColIndex,s=o.header,c=o.hiddenColumns,u=o.index,f=o.maxDepth,h=o.pinned,g=t(o,["depth","getNextColIndex","header","hiddenColumns","index","maxDepth","pinned"]),w=null!==(a=null===(i=s.children)||void 0===i?void 0:i.length)&&void 0!==a?a:0,m=d(0===u?0:1),p={gridColumnStart:m,gridColumnEnd:w>0?m+w:m+1,gridRowStart:l,gridRowEnd:w>0?l+1:f+1};if(s.children){var x=s.children.filter((function(e){return v({hiddenColumns:c,header:e,pinned:h})}));return e.jsxs(n.Fragment,{children:[e.jsx(F,r({},g,p,{colIndex:m,header:s,ref:n.createRef()})),x.map((function(e,t){return n.createElement(z,r({},g,{depth:l+1,getNextColIndex:d,header:e,hiddenColumns:c,index:t,key:e.accessor,maxDepth:f}))}))]})}return e.jsx(F,r({},g,p,{colIndex:m,header:s,ref:n.createRef()}))},U=function(t){var o=t.allowAnimations,i=t.columnReordering,a=t.columnResizing,l=t.currentRows,d=t.draggedHeaderRef,s=t.forceUpdate,c=t.gridTemplateColumns,u=t.handleScroll,f=t.headersRef,h=t.hiddenColumns,g=t.hoveredHeaderRef,w=t.isWidthDragging,m=t.mainBodyRef,p=t.maxDepth,x=t.onColumnOrderChange,R=t.onSort,C=t.onTableHeaderDragEnd,I=t.pinned,b=t.rowHeight,y=t.sectionRef,M=t.selectableColumns,H=t.setIsWidthDragging,E=t.setSelectedCells,D=t.sort,j=t.sortDownIcon,k=t.sortUpIcon,N=n.useRef(1);n.useEffect((function(){N.current=1}));var T=function(e){return void 0===e&&(e=1),N.current+=e,N.current},L=f.current.filter((function(e){return v({hiddenColumns:h,header:e,pinned:I})}));return e.jsx("div",r({className:"st-header-".concat(I?"pinned-".concat(I):"main")},u&&{onScroll:u},{ref:y,style:{gridTemplateColumns:c}},{children:e.jsx(S,r({allowAnimations:o,draggedHeaderRef:d,headersRef:f,mainBodyRef:m,pauseAnimation:w,rowIndex:0},{children:L.map((function(n,r){return e.jsx(z,{getNextColIndex:T,columnReordering:i,columnResizing:a,currentRows:l,depth:1,draggedHeaderRef:d,forceUpdate:s,header:n,headersRef:f,hiddenColumns:h,hoveredHeaderRef:g,index:r,maxDepth:p,onColumnOrderChange:x,onSort:R,onTableHeaderDragEnd:C,pinned:I,reverse:"right"===I,rowHeight:b,selectableColumns:M,setIsWidthDragging:H,setSelectedCells:E,sort:D,sortDownIcon:j,sortUpIcon:k},n.accessor)}))}))}))},q=function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)?1+Math.max.apply(Math,e.children.map(q)):1},K=function(t){var o=t.allowAnimations,i=t.centerHeaderRef,a=t.columnResizing,l=t.currentRows,d=t.columnReordering,s=t.draggedHeaderRef,c=t.forceUpdate,u=t.headerContainerRef,f=t.headersRef,h=t.hiddenColumns,g=t.hoveredHeaderRef,w=t.isWidthDragging,m=t.mainBodyRef,p=t.mainTemplateColumns,x=t.onColumnOrderChange,R=t.onSort,C=t.onTableHeaderDragEnd,I=t.pinnedLeftColumns,b=t.pinnedLeftHeaderRef,y=t.pinnedLeftTemplateColumns,M=t.pinnedRightColumns,S=t.pinnedRightHeaderRef,H=t.pinnedRightTemplateColumns,E=t.rowHeight,D=t.selectableColumns,j=t.setIsWidthDragging,k=t.setSelectedCells,N=t.sort,T=t.sortDownIcon,O=t.sortUpIcon;L(m,i);var B=function(e){var n,r,t=null===(n=i.current)||void 0===n?void 0:n.scrollLeft;void 0!==t&&(null===(r=m.current)||void 0===r||r.scrollTo(t,0))},W=n.useMemo((function(){var e=f.current,n=0;return e.forEach((function(e){if(v({hiddenColumns:h,header:e})){var r=q(e);n=Math.max(n,r)}})),{maxDepth:n}}),[f,h]).maxDepth,A={allowAnimations:o,columnReordering:d,columnResizing:a,currentRows:l,draggedHeaderRef:s,forceUpdate:c,handleScroll:B,headersRef:f,hiddenColumns:h,hoveredHeaderRef:g,isWidthDragging:w,mainBodyRef:m,maxDepth:W,onColumnOrderChange:x,onSort:R,onTableHeaderDragEnd:C,rowHeight:E,selectableColumns:D,setIsWidthDragging:j,setSelectedCells:k,sort:N,sortDownIcon:T,sortUpIcon:O};return e.jsxs("div",r({className:"st-header-container",ref:u},{children:[I.length>0&&e.jsx(U,r({},A,{gridTemplateColumns:y,pinned:"left",sectionRef:b})),e.jsx(U,r({},A,{gridTemplateColumns:p,handleScroll:B,sectionRef:i})),M.length>0&&e.jsx(U,r({},A,{gridTemplateColumns:H,pinned:"right",sectionRef:S}))]}))},V=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(" "))},J=function(t){var o=t.allowAnimations,i=t.columnReordering,a=t.columnResizing,l=t.currentRows,d=t.draggedHeaderRef,s=t.editColumns,c=t.flattenedRows,u=t.forceUpdate,f=t.getBorderClass,h=t.handleMouseDown,g=t.handleMouseOver,v=t.headersRef,w=t.hiddenColumns,m=t.hoveredHeaderRef,p=t.isSelected,x=t.isInitialFocusedCell,R=t.isWidthDragging,C=t.mainBodyRef,I=t.onCellEdit,b=t.onColumnOrderChange,y=t.onSort,M=t.onTableHeaderDragEnd,S=t.pinnedLeftRef,H=t.pinnedRightRef,E=t.rowHeight,D=t.scrollbarWidth,j=t.selectableColumns,k=t.setIsWidthDragging,N=t.setFlattenedRows,L=t.setScrollTop,O=t.setSelectedCells,B=t.shouldPaginate,W=t.sort,A=t.sortDownIcon,P=t.sortUpIcon,F=t.tableBodyContainerRef,z=t.visibleRows,U=n.useRef(null),q=n.useRef(null),J=n.useRef(null),X=n.useRef(null),Y=v.current.filter((function(e){return!e.pinned})),G=v.current.filter((function(e){return"left"===e.pinned})),_=v.current.filter((function(e){return"right"===e.pinned})),$=n.useMemo((function(){return V({headers:G,hiddenColumns:w})}),[G,w]),Q=n.useMemo((function(){return V({headers:Y,hiddenColumns:w})}),[Y,w]),Z=n.useMemo((function(){return V({headers:_,hiddenColumns:w})}),[_,w]),ee={allowAnimations:o,centerHeaderRef:J,columnResizing:a,currentRows:l,columnReordering:i,draggedHeaderRef:d,forceUpdate:u,headerContainerRef:U,headersRef:v,hiddenColumns:w,hoveredHeaderRef:m,isWidthDragging:R,mainBodyRef:C,mainTemplateColumns:Q,onColumnOrderChange:b,onSort:y,onTableHeaderDragEnd:M,pinnedLeftColumns:G,pinnedLeftHeaderRef:q,pinnedLeftTemplateColumns:$,pinnedRightColumns:_,pinnedRightHeaderRef:X,pinnedRightTemplateColumns:Z,rowHeight:E,selectableColumns:j,setIsWidthDragging:k,setSelectedCells:O,sort:W,sortDownIcon:A,sortUpIcon:P,tableBodyContainerRef:F},ne={allowAnimations:o,centerHeaderRef:J,draggedHeaderRef:d,flattenedRows:c,getBorderClass:f,handleMouseDown:h,handleMouseOver:g,headerContainerRef:U,headers:v.current,headersRef:v,hiddenColumns:w,hoveredHeaderRef:m,isSelected:p,isInitialFocusedCell:x,isWidthDragging:R,mainBodyRef:C,mainTemplateColumns:Q,onCellEdit:I,onTableHeaderDragEnd:M,pinnedLeftColumns:G,pinnedLeftHeaderRef:q,pinnedLeftRef:S,pinnedLeftTemplateColumns:$,pinnedRightColumns:_,pinnedRightHeaderRef:X,pinnedRightRef:H,pinnedRightTemplateColumns:Z,rowHeight:E,scrollbarWidth:D,setFlattenedRows:N,shouldPaginate:B,setScrollTop:L,tableBodyContainerRef:F,visibleRows:z};return e.jsxs("div",r({className:"st-table-content",style:{width:s?"calc(100% - 27.5px)":"100%"}},{children:[e.jsx(K,r({},ee)),e.jsx(T,r({},ne))]}))},X=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])},Y=function(t){var o=t.mainBodyRef,i=t.pinnedLeftRef,a=t.pinnedRightRef,l=t.tableContentWidth,d=n.useState(0),s=d[0],c=d[1],u=n.useState(0),f=u[0],h=u[1],g=n.useState(0),v=g[0],w=g[1],m=n.useRef(null);return X({widthAttribute:"offsetWidth",callback:c,ref:i}),X({widthAttribute:"scrollWidth",callback:w,ref:o}),X({widthAttribute:"offsetWidth",callback:h,ref:a}),L(o,m),!o.current||o.current.scrollWidth<=o.current.clientWidth?null:e.jsxs("div",r({className:"st-horizontal-scrollbar-container",style:{width:l}},{children:[s>0&&e.jsx("div",{className:"st-horizontal-scrollbar-left",style:{flexShrink:0,width:s}}),v>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:m},{children:e.jsx("div",{style:{width:v}})})),f>0&&e.jsx("div",{className:"st-horizontal-scrollbar-right",style:{flexShrink:0,minWidth:f}})]}))},G=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]),d=n.useState(l),s=d[0],c=d[1],u=n.useMemo((function(){if(!i)return t;var e=function(e,n,r){return{sortedData:W(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:s,setHiddenColumns:c}},_=function(t){var o=t.checked,i=void 0!==o&&o,a=t.children,l=t.onChange,d=n.useState(i),s=d[0],c=d[1];return e.jsxs("label",r({className:"st-checkbox-label"},{children:[e.jsx("input",{checked:s,className:"st-checkbox-input",onChange:function(){var e=!s;c(e),l&&l(e)},type:"checkbox"}),e.jsx("span",r({className:"st-checkbox-custom ".concat(s?"st-checked":"")},{children:s&&e.jsx("span",{className:"st-checkbox-checkmark"})})),a]}))},$=function(n){var t=n.headers,o=n.open,i=n.position;n.setOpen;var a=n.setHiddenColumns,l=n.hiddenColumns,d="left"===i?"left":"";return e.jsx("div",r({className:"st-column-editor-popout ".concat(o?"open":""," ").concat(d),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(_,r({checked:l[n.accessor],onChange:function(e){var t;return a(r(r({},l),((t={})[n.accessor]=e,t)))}},{children:n.label}),t)}))}))}))},Q=function(t){var o=t.columnEditorText,i=t.editColumns,a=t.editColumnsInitOpen,l=t.headers,d=t.position,s=void 0===d?"right":d,c=t.setHiddenColumns,u=t.hiddenColumns,f=n.useState(a),h=f[0],g=f[1];return i?e.jsxs("div",r({className:"st-column-editor ".concat(h?"open":""," ").concat(s),onClick:function(){return function(e){g(e)}(!h)}},{children:[e.jsx("div",r({className:"st-column-editor-text"},{children:o})),e.jsx($,{headers:l,open:h,position:s,setOpen:g,setHiddenColumns:c,hiddenColumns:u})]})):null};!function(e){e.Left="left",e.Right="right"}(i||(i={}));var Z=n.memo((function(t){var o=t.allowAnimations,f=void 0!==o&&o,h=t.columnEditorPosition,g=void 0===h?i.Right:h,v=t.columnEditorText,w=void 0===v?"Columns":v,m=t.columnResizing,p=void 0!==m&&m,x=t.defaultHeaders,R=t.editColumns,C=void 0!==R&&R,I=t.editColumnsInitOpen,b=void 0!==I&&I,y=t.columnReordering,M=void 0!==y&&y,S=t.height,H=t.hideFooter,E=void 0!==H&&H,D=t.nextIcon,j=void 0===D?e.jsx(s,{className:"st-next-prev-icon"}):D,k=t.onCellEdit,N=t.onColumnOrderChange,T=t.onNextPage,L=t.onPreviousPage,O=t.prevIcon,B=void 0===O?e.jsx(d,{className:"st-next-prev-icon"}):O,W=t.rowHeight,A=void 0===W?40:W,P=t.rows,F=t.rowsPerPage,z=void 0===F?10:F,U=t.selectableCells,q=void 0!==U&&U,K=t.selectableColumns,V=void 0!==K&&K,X=t.shouldPaginate,_=void 0!==X&&X,$=t.sortDownIcon,Z=void 0===$?e.jsx(u,{className:"st-sort-icon"}):$,ee=t.sortUpIcon,ne=void 0===ee?e.jsx(c,{className:"st-sort-icon"}):ee,re=t.theme,te=void 0===re?"light":re,oe=t.totalPages,ie=n.useRef(null),ae=n.useRef(x),le=n.useRef(null),de=n.useRef(null),se=n.useRef(null),ce=n.useRef(null),ue=n.useRef(null),fe=n.useState(!1),he=fe[0],ge=fe[1],ve=n.useState(1),we=ve[0],me=ve[1],pe=n.useState(0),xe=pe[0],Re=pe[1],Ce=n.useState(0),Ie=Ce[0],be=Ce[1],ye=n.useState(0),Me=ye[0],Se=ye[1],He=G({headers:ae.current,tableRows:P}),Ee=He.sort,De=He.sortedRows,je=He.hiddenColumns,ke=He.setHiddenColumns,Ne=He.updateSort,Te=n.useMemo((function(){if(!_)return De;var e=(we-1)*z,n=e+z;return De.slice(e,n)}),[we,z,_,De]),Le=n.useState(Te),Oe=Le[0],Be=Le[1];n.useEffect((function(){Be(Te)}),[Te]);var We=n.useMemo((function(){var e;if(!S)return window.innerHeight-A;var n=document.querySelector(".simple-table-root"),r=0;if(S.endsWith("px"))r=parseInt(S,10);else if(S.endsWith("vh")){var t=parseInt(S,10);r=window.innerHeight*t/100}else if(S.endsWith("%")){var o=parseInt(S,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-A)}),[S,A]),Ae=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,d=Math.max(0,i-o*n),s=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>=s)break;f+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&&c(u.rowMeta.children,n+1)}};return c(t,0),a}({bufferRowCount:5,contentHeight:We,flattenedRows:Oe,rowHeight:A,scrollTop:Me})}),[We,A,Oe,Me]),Pe=n.useReducer((function(e){return e+1}),0)[1],Fe=function(e){var r=e.selectableCells,t=e.headers,o=e.visibleRows,i=n.useState(new Set),l=i[0],d=i[1],s=n.useState(null),c=s[0],u=s[1],f=n.useRef(!1),h=n.useRef(null),g=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]),v=n.useCallback((function(e,n){for(var r=new Set,t=Math.min(e.rowIndex,n.rowIndex),i=Math.max(e.rowIndex,n.rowIndex),l=Math.min(e.colIndex,n.colIndex),s=Math.max(e.colIndex,n.colIndex),c=t;c<=i;c++)for(var u=l;u<=s;u++)if(c>=0&&c<o.length){var f=o[c].row.rowMeta.rowId;r.add(a({colIndex:u,rowIndex:c,rowId:f}))}d(r)}),[o]),w=n.useCallback((function(e){if(e.rowIndex>=0&&e.rowIndex<o.length&&e.colIndex>=0&&e.colIndex<t.length){var n=a(e);d(new Set([n])),u(e)}}),[t.length,o.length]);n.useEffect((function(){var e=function(e){if(r&&c){var n=c.rowIndex,i=c.colIndex,a=c.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 s={rowIndex:n-1,colIndex:i,rowId:o[n-1].row.rowMeta.rowId};w(s)}}else"ArrowDown"===e.key?(e.preventDefault(),n<o.length-1&&(s={rowIndex:n+1,colIndex:i,rowId:o[n+1].row.rowMeta.rowId},w(s))):"ArrowLeft"===e.key||"Tab"===e.key&&e.shiftKey?(e.preventDefault(),i>0&&(s={rowIndex:n,colIndex:i-1,rowId:o[n].row.rowMeta.rowId},w(s))):"ArrowRight"===e.key||"Tab"===e.key?(e.preventDefault(),i<t.length-1&&(s={rowIndex:n,colIndex:i+1,rowId:o[n].row.rowMeta.rowId},w(s))):"Escape"===e.key&&(d(new Set),h.current=null,u(null))}else g()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[g,t.length,c,v,w,r,o]);var m=n.useCallback((function(e){var n=e.colIndex,r=e.rowIndex,t=e.rowId,o=a({colIndex:n,rowIndex:r,rowId:t});return l.has(o)}),[l]),p=n.useCallback((function(e){var n,r,t,i,a,l,d=e.colIndex,s=e.rowIndex,c=e.rowId,u=[],f=null===(t=null===(r=null===(n=o[s-1])||void 0===n?void 0:n.row)||void 0===r?void 0:r.rowMeta)||void 0===t?void 0:t.rowId,h={colIndex:d,rowIndex:s+1,rowId:null===(l=null===(a=null===(i=o[s+1])||void 0===i?void 0:i.row)||void 0===a?void 0:a.rowMeta)||void 0===l?void 0:l.rowId},g={colIndex:d-1,rowIndex:s,rowId:c},v={colIndex:d+1,rowIndex:s,rowId:c};return m({colIndex:d,rowIndex:s-1,rowId:f})||u.push("st-selected-top-border"),m(h)||u.push("st-selected-bottom-border"),m(g)||u.push("st-selected-left-border"),m(v)||u.push("st-selected-right-border"),u.join(" ")}),[m,o]),x=n.useMemo((function(){return c?function(e){var n=e.rowIndex,r=e.colIndex,t=e.rowId;return n===c.rowIndex&&r===c.colIndex&&t===c.rowId}:function(){return!1}}),[c]);return{getBorderClass:p,handleMouseDown:function(e){var n=e.colIndex,t=e.rowIndex,o=e.rowId;if(r){f.current=!0,h.current={rowIndex:t,colIndex:n,rowId:o};var i=a({colIndex:n,rowIndex:t,rowId:o});d(new Set([i])),u({rowIndex:t,colIndex:n,rowId:o})}},handleMouseOver:function(e){var n=e.colIndex,t=e.rowIndex;if(e.rowId,r&&f.current&&h.current){for(var i=new Set,l=Math.min(h.current.rowIndex,t),s=Math.max(h.current.rowIndex,t),c=Math.min(h.current.colIndex,n),u=Math.max(h.current.colIndex,n),g=l;g<=s;g++)for(var v=c;v<=u;v++)if(g>=0&&g<o.length){var w=o[g].row.rowMeta.rowId;i.add(a({colIndex:v,rowIndex:g,rowId:w}))}d(i)}},handleMouseUp:function(){f.current=!1},isInitialFocusedCell:x,isSelected:m,selectedCells:l,setSelectedCells:d}}({selectableCells:q,headers:ae.current,visibleRows:Ae}),ze=Fe.handleMouseDown,Ue=Fe.handleMouseOver,qe=Fe.handleMouseUp,Ke=Fe.isSelected,Ve=Fe.getBorderClass,Je=Fe.isInitialFocusedCell,Xe=Fe.setSelectedCells,Ye=n.useCallback((function(e,n){Ne(e,n)}),[Ne]),Ge=n.useCallback((function(e){ae.current=e,Pe()}),[]);return n.useEffect((function(){var e=function(e){var n=e.target;n.closest(".st-cell")||V&&(n.classList.contains("st-header-cell")||n.classList.contains("st-header-label"))||Xe(new Set)};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[V,Xe]),n.useLayoutEffect((function(){if(ue.current){var e=ue.current.offsetWidth-ue.current.clientWidth,n=ue.current.clientWidth;Re(e),be(n)}}),[]),n.useLayoutEffect((function(){var e=function(){if(Pe(),ue.current){var e=ue.current.offsetWidth-ue.current.clientWidth,n=ue.current.clientWidth;Re(e),be(n)}};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),e.jsxs("div",r({className:"simple-table-root st-wrapper theme-".concat(te),style:S?{height:S}:{}},{children:[e.jsxs("div",r({className:"st-table-wrapper-container"},{children:[e.jsxs("div",r({className:"st-table-wrapper",onMouseUp:qe,onMouseLeave:qe},{children:[e.jsx(J,{allowAnimations:f,columnReordering:M,columnResizing:p,currentRows:Te,draggedHeaderRef:ie,editColumns:C,flattenedRows:Oe,forceUpdate:Pe,getBorderClass:Ve,handleMouseDown:ze,handleMouseOver:Ue,headersRef:ae,hiddenColumns:je,hoveredHeaderRef:le,isInitialFocusedCell:Je,isSelected:Ke,isWidthDragging:he,mainBodyRef:de,onCellEdit:k,onColumnOrderChange:N,onSort:Ye,onTableHeaderDragEnd:Ge,pinnedLeftRef:se,pinnedRightRef:ce,rowHeight:A,scrollbarWidth:xe,selectableColumns:V,setIsWidthDragging:ge,setFlattenedRows:Be,setScrollTop:Se,setSelectedCells:Xe,shouldPaginate:_,sort:Ee,sortDownIcon:Z,sortUpIcon:ne,tableBodyContainerRef:ue,visibleRows:Ae}),e.jsx(Q,{columnEditorText:w,editColumns:C,editColumnsInitOpen:b,headers:ae.current,hiddenColumns:je,position:g,setHiddenColumns:ke})]})),e.jsx(Y,{mainBodyRef:de,pinnedLeftRef:se,pinnedRightRef:ce,tableContentWidth:Ie})]})),e.jsx(l,{currentPage:we,hideFooter:E,nextIcon:j,onPageChange:me,onNextPage:T,onPreviousPage:L,prevIcon:B,shouldPaginate:_,totalPages:oe||Math.ceil(De.length/z)})]}))}));exports.SimpleTable=Z;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import Row from "./Row";
3
- import { Pinned } from "../enums/Pinned";
3
+ import { Pinned } from "./Pinned";
4
4
  type HeaderObject = {
5
5
  accessor: string;
6
6
  align?: "left" | "center" | "right";
@@ -0,0 +1 @@
1
+ export type Pinned = "left" | "right";
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, ReactNode, SetStateAction, UIEvent } from "react";
2
2
  import Row from "./Row";
3
- import { Pinned } from "../enums/Pinned";
3
+ import { Pinned } from "./Pinned";
4
4
  import { OnSortProps, SortConfig } from "..";
5
5
  import { HeaderObject } from "..";
6
6
  import { RefObject } from "react";
@@ -1,5 +1,5 @@
1
1
  import HeaderObject from "../types/HeaderObject";
2
- import { Pinned } from "../enums/Pinned";
2
+ import { Pinned } from "../types/Pinned";
3
3
  export declare const getCellId: ({ accessor, rowIndex }: {
4
4
  accessor: string;
5
5
  rowIndex: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-table-core",
3
- "version": "0.7.26",
3
+ "version": "0.7.28",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +0,0 @@
1
- export declare enum Pinned {
2
- LEFT = "left",
3
- RIGHT = "right"
4
- }