simple-table-core 1.8.9 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Animate-2b4177d4.js → Animate-e6d095b8.js} +2 -2
- package/dist/Animate-e6d095b8.js.map +1 -0
- package/dist/{DatePicker-b28d8e22.js → DatePicker-fa8eea64.js} +2 -2
- package/dist/DatePicker-fa8eea64.js.map +1 -0
- package/dist/cjs/{Animate-5b511261.js → Animate-736d3b8f.js} +2 -2
- package/dist/cjs/Animate-736d3b8f.js.map +1 -0
- package/dist/cjs/{DatePicker-59c069e5.js → DatePicker-c67d5bfb.js} +2 -2
- package/dist/cjs/DatePicker-c67d5bfb.js.map +1 -0
- package/dist/cjs/components/empty-state/DefaultEmptyState.d.ts +5 -0
- package/dist/cjs/components/simple-table/RowStateIndicator.d.ts +18 -0
- package/dist/cjs/components/simple-table/SimpleTable.d.ts +7 -0
- package/dist/cjs/context/TableContext.d.ts +12 -0
- package/dist/cjs/hooks/useSelection.d.ts +2 -1
- package/dist/cjs/hooks/useTableAPI.d.ts +4 -1
- package/dist/cjs/hooks/useTableRowProcessing.d.ts +9 -3
- package/dist/cjs/index-7d78913a.js +2 -0
- package/dist/cjs/index-7d78913a.js.map +1 -0
- package/dist/cjs/index.d.ts +5 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/cjs/types/OnRowGroupExpandProps.d.ts +6 -1
- package/dist/cjs/types/RowState.d.ts +12 -0
- package/dist/cjs/types/RowStateRendererProps.d.ts +48 -0
- package/dist/cjs/types/TableRow.d.ts +6 -0
- package/dist/cjs/utils/cellClipboardUtils.d.ts +1 -1
- package/dist/cjs/utils/csvExportUtils.d.ts +2 -2
- package/dist/cjs/utils/rowUtils.d.ts +7 -1
- package/dist/components/empty-state/DefaultEmptyState.d.ts +5 -0
- package/dist/components/simple-table/RowStateIndicator.d.ts +18 -0
- package/dist/components/simple-table/SimpleTable.d.ts +7 -0
- package/dist/context/TableContext.d.ts +12 -0
- package/dist/hooks/useSelection.d.ts +2 -1
- package/dist/hooks/useTableAPI.d.ts +4 -1
- package/dist/hooks/useTableRowProcessing.d.ts +9 -3
- package/dist/index-89816bff.js +2 -0
- package/dist/index-89816bff.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.es.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/OnRowGroupExpandProps.d.ts +6 -1
- package/dist/types/RowState.d.ts +12 -0
- package/dist/types/RowStateRendererProps.d.ts +48 -0
- package/dist/types/TableRow.d.ts +6 -0
- package/dist/utils/cellClipboardUtils.d.ts +1 -1
- package/dist/utils/csvExportUtils.d.ts +2 -2
- package/dist/utils/rowUtils.d.ts +7 -1
- package/package.json +1 -1
- package/src/styles/base.css +47 -0
- package/dist/Animate-2b4177d4.js.map +0 -1
- package/dist/DatePicker-b28d8e22.js.map +0 -1
- package/dist/cjs/Animate-5b511261.js.map +0 -1
- package/dist/cjs/DatePicker-59c069e5.js.map +0 -1
- package/dist/cjs/index-185a7b0e.js +0 -2
- package/dist/cjs/index-185a7b0e.js.map +0 -1
- package/dist/index-76da1a62.js +0 -2
- package/dist/index-76da1a62.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as n,u as i,a as t,c as o,b as e,A as a,d as r,f as l,R as d}from"./index-
|
|
2
|
-
//# sourceMappingURL=Animate-
|
|
1
|
+
import{_ as n,u as i,a as t,c as o,b as e,A as a,d as r,f as l,R as d}from"./index-89816bff.js";import{jsx as u}from"react/jsx-runtime";import{useRef as f,useMemo as s,useLayoutEffect as v}from"react";var m=function(m){var p=m.children,h=m.id,M=m.parentRef,c=m.tableRow,Y=n(m,["children","id","parentRef","tableRow"]),C=i(),g=C.allowAnimations,b=C.isResizing,x=C.isScrolling,R=C.rowHeight,j=f(null),A=f(null),B=t(x),w=t(b),_=s(function(){return o(R)},[R]);return v(function(){var n,i,t,o;if(g&&j.current&&!b){var u=j.current.getBoundingClientRect(),f=A.current;if(!x)if(!B||x)if(!w||b){if(A.current=u,f){var s=u.x-f.x,v=u.y-f.y;if((Math.abs(s)>=50||Math.abs(v)>5)&&(Math.abs(s)>5||Math.abs(v)>5)){var m=e(e({},a.ROW_REORDER),{onComplete:function(){j.current&&(j.current.style.zIndex="",j.current.style.position="",j.current.style.top="")}}),p=null===(n=null==M?void 0:M.current)||void 0===n?void 0:n.scrollTop,h=null===(i=null==M?void 0:M.current)||void 0===i?void 0:i.clientHeight,Y=null===(t=null==M?void 0:M.current)||void 0===t?void 0:t.scrollHeight;if(void 0!==p&&void 0!==h&&void 0!==Y){var C=_*(R+d),k=p-C,q=p+h+C,y=f.y>k&&q>f.y,z=u.y>k&&q>u.y,D=p>u.y,E=null!==(o=null==c?void 0:c.position)&&void 0!==o?o:0,F=.6*R,G=function(n,i,t){return Math.min(900,Math.max(100,100+80*Math.log10(Math.max(1,Math.min(Math.abs(n-i),Math.abs(n-t))))))};if(y&&!z&&u.y>p+h){var H=G(u.y,p,p+h);return void r({element:j.current,options:{startY:f.y,endY:p+h+H+E%15*F*2.5+E%7*.4*R,finalY:u.y,duration:m.duration,easing:m.easing,onComplete:m.onComplete}})}if(y&&!z&&D)return H=G(u.y,p,p+h),void r({element:j.current,options:{startY:f.y,endY:p-H-E%15*F*2.5-E%7*.4*R,finalY:u.y,duration:m.duration,easing:m.easing,onComplete:m.onComplete}});if(!y&&z&&f.y>p+h)return H=G(f.y,p,p+h),void r({element:j.current,options:{startY:p+h+H+E%10*F*1,endY:u.y,duration:m.duration,easing:m.easing,onComplete:m.onComplete}});if(!y&&z&&p>f.y)return H=G(f.y,p,p+h),void r({element:j.current,options:{startY:p-H-E%10*F*1,endY:u.y,duration:m.duration,easing:m.easing,onComplete:m.onComplete}})}l({element:j.current,fromBounds:f,toBounds:u,finalConfig:m})}}}else A.current=u;else A.current=u}},[g,_,b,x,M,B,w,R,null==c?void 0:c.position,c]),u("div",e({ref:j,"data-animate-id":h,id:h+""},Y,{children:p}))};m.displayName="Animate";export{m as Animate,m as default};
|
|
2
|
+
//# sourceMappingURL=Animate-e6d095b8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Animate-e6d095b8.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as e,b as n}from"./index-
|
|
2
|
-
//# sourceMappingURL=DatePicker-
|
|
1
|
+
import{u as e,b as n}from"./index-89816bff.js";import{jsxs as t,Fragment as a,jsx as r}from"react/jsx-runtime";import{useState as c}from"react";var i=function(i){var d,o,s=i.onChange,l=i.onClose,u=i.value,f=e(),h=f.nextIcon,m=f.prevIcon,v=c(u||new Date),k=v[0],p=v[1],w=c("days"),y=w[0],D=w[1],N=function(e,n){return new Date(e,n+1,0).getDate()};return t("div",n({className:"st-datepicker"},{children:[t("div",n({className:"st-datepicker-header"},{children:["days"===y&&t(a,{children:[r("button",n({onClick:function(){p(new Date(k.getFullYear(),k.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:m})),t("div",n({className:"st-datepicker-header-label",onClick:function(){return D("months")}},{children:[(o=k,o.toLocaleString("default",{month:"long"}))," ",k.getFullYear()]})),r("button",n({onClick:function(){p(new Date(k.getFullYear(),k.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:h}))]}),"months"===y&&r("div",n({className:"st-datepicker-header-label",onClick:function(){return D("years")}},{children:k.getFullYear()})),"years"===y&&r("div",n({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),t("div",n({className:"st-datepicker-grid st-datepicker-".concat(y,"-grid")},{children:["days"===y&&function(){var e=[],t=k.getFullYear(),a=k.getMonth(),c=N(t,a),i=function(e,n){return new Date(e,n,1).getDay()}(t,a),d=N(t,a-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(function(t,a){e.push(r("div",n({className:"st-datepicker-weekday"},{children:t}),"header-".concat(a)))});for(var o=function(t){var a=d-i+t+1;e.push(r("div",n({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(k.getFullYear(),k.getMonth()-1,e,12,0,0);p(n),s(n),null==l||l()}(a)}},{children:a}),"prev-".concat(a)))},f=0;i>f;f++)o(f);for(var h=function(c){var i=c===(new Date).getDate()&&a===(new Date).getMonth()&&t===(new Date).getFullYear(),d=new Date(u),o=c===d.getDate()&&a===d.getMonth()&&t===d.getFullYear();e.push(r("div",n({className:"st-datepicker-day ".concat(i?"today":""," ").concat(o?"selected":""),onClick:function(){return function(e){var n=k.getFullYear(),t=k.getMonth(),a=new Date(n,t,e,12,0,0);p(a),s(a),null==l||l()}(c)}},{children:c}),"day-".concat(c)))},m=1;c>=m;m++)h(m);var v=35-(i+c),w=function(t){e.push(r("div",n({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(k.getFullYear(),k.getMonth()+1,e,12,0,0);p(n),s(n),null==l||l()}(t)}},{children:t}),"next-".concat(t)))};for(m=1;v>=m;m++)w(m);return e}(),"months"===y&&(d=[],Array.from({length:12},function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})}).forEach(function(e,t){var a=t===k.getMonth();d.push(r("div",n({className:"st-datepicker-month ".concat(a?"selected":""),onClick:function(){return function(e){p(new Date(k.getFullYear(),e,1)),D("days")}(t)}},{children:e}),"month-".concat(t)))}),d),"years"===y&&function(){for(var e=[],t=k.getFullYear(),a=t-6,c=function(a){e.push(r("div",n({className:"st-datepicker-year ".concat(a===t?"selected":""),onClick:function(){return function(e){p(new Date(e,k.getMonth(),1)),D("months")}(a)}},{children:a}),"year-".concat(a)))},i=a;a+12>i;i++)c(i);return e}()]})),r("div",n({className:"st-datepicker-footer"},{children:r("button",n({className:"st-datepicker-today-btn",onClick:function(){var e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0);p(n),s(n),null==l||l()}},{children:"Today"}))}))]}))};export{i as default};
|
|
2
|
+
//# sourceMappingURL=DatePicker-fa8eea64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker-fa8eea64.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=require("./index-
|
|
2
|
-
//# sourceMappingURL=Animate-
|
|
1
|
+
"use strict";var n=require("./index-7d78913a.js"),e=require("react/jsx-runtime"),i=require("react"),t=function(t){var o=t.children,r=t.id,a=t.parentRef,l=t.tableRow,d=n.__rest(t,["children","id","parentRef","tableRow"]),u=n.useTableContext(),v=u.allowAnimations,f=u.isResizing,s=u.isScrolling,m=u.rowHeight,h=i.useRef(null),p=i.useRef(null),M=n.usePrevious(s),c=n.usePrevious(f),Y=i.useMemo(function(){return n.calculateBufferRowCount(m)},[m]);return i.useLayoutEffect(function(){var e,i,t,o;if(v&&h.current&&!f){var r=h.current.getBoundingClientRect(),d=p.current;if(!s)if(!M||s)if(!c||f){if(p.current=r,d){var u=r.x-d.x,C=r.y-d.y;if((Math.abs(u)>=50||Math.abs(C)>5)&&(Math.abs(u)>5||Math.abs(C)>5)){var g=n.__assign(n.__assign({},n.ANIMATION_CONFIGS.ROW_REORDER),{onComplete:function(){h.current&&(h.current.style.zIndex="",h.current.style.position="",h.current.style.top="")}}),x=null===(e=null==a?void 0:a.current)||void 0===e?void 0:e.scrollTop,q=null===(i=null==a?void 0:a.current)||void 0===i?void 0:i.clientHeight,j=null===(t=null==a?void 0:a.current)||void 0===t?void 0:t.scrollHeight;if(void 0!==x&&void 0!==q&&void 0!==j){var B=Y*(m+n.ROW_SEPARATOR_WIDTH),R=x-B,b=x+q+B,w=d.y>R&&b>d.y,A=r.y>R&&b>r.y,k=x>r.y,y=null!==(o=null==l?void 0:l.position)&&void 0!==o?o:0,z=.6*m,D=function(n,e,i){return Math.min(900,Math.max(100,100+80*Math.log10(Math.max(1,Math.min(Math.abs(n-e),Math.abs(n-i))))))};if(w&&!A&&r.y>x+q){var E=D(r.y,x,x+q);return void n.animateWithCustomCoordinates({element:h.current,options:{startY:d.y,endY:x+q+E+y%15*z*2.5+y%7*.4*m,finalY:r.y,duration:g.duration,easing:g.easing,onComplete:g.onComplete}})}if(w&&!A&&k)return E=D(r.y,x,x+q),void n.animateWithCustomCoordinates({element:h.current,options:{startY:d.y,endY:x-E-y%15*z*2.5-y%7*.4*m,finalY:r.y,duration:g.duration,easing:g.easing,onComplete:g.onComplete}});if(!w&&A&&d.y>x+q)return E=D(d.y,x,x+q),void n.animateWithCustomCoordinates({element:h.current,options:{startY:x+q+E+y%10*z*1,endY:r.y,duration:g.duration,easing:g.easing,onComplete:g.onComplete}});if(!w&&A&&x>d.y)return E=D(d.y,x,x+q),void n.animateWithCustomCoordinates({element:h.current,options:{startY:x-E-y%10*z*1,endY:r.y,duration:g.duration,easing:g.easing,onComplete:g.onComplete}})}n.flipElement({element:h.current,fromBounds:d,toBounds:r,finalConfig:g})}}}else p.current=r;else p.current=r}},[v,Y,f,s,a,M,c,m,null==l?void 0:l.position,l]),e.jsx("div",n.__assign({ref:h,"data-animate-id":r,id:r+""},d,{children:o}))};t.displayName="Animate",exports.Animate=t,exports.default=t;
|
|
2
|
+
//# sourceMappingURL=Animate-736d3b8f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Animate-736d3b8f.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
2
|
-
//# sourceMappingURL=DatePicker-
|
|
1
|
+
"use strict";var e=require("./index-7d78913a.js"),n=require("react/jsx-runtime"),t=require("react");exports.default=function(a){var r,c,i=a.onChange,d=a.onClose,s=a.value,l=e.useTableContext(),o=l.nextIcon,u=l.prevIcon,h=t.useState(s||new Date),f=h[0],v=h[1],k=t.useState("days"),m=k[0],p=k[1],w=function(e,n){return new Date(e,n+1,0).getDate()};return n.jsxs("div",e.__assign({className:"st-datepicker"},{children:[n.jsxs("div",e.__assign({className:"st-datepicker-header"},{children:["days"===m&&n.jsxs(n.Fragment,{children:[n.jsx("button",e.__assign({onClick:function(){v(new Date(f.getFullYear(),f.getMonth()-1,1))},className:"st-datepicker-nav-btn"},{children:u})),n.jsxs("div",e.__assign({className:"st-datepicker-header-label",onClick:function(){return p("months")}},{children:[(c=f,c.toLocaleString("default",{month:"long"}))," ",f.getFullYear()]})),n.jsx("button",e.__assign({onClick:function(){v(new Date(f.getFullYear(),f.getMonth()+1,1))},className:"st-datepicker-nav-btn"},{children:o}))]}),"months"===m&&n.jsx("div",e.__assign({className:"st-datepicker-header-label",onClick:function(){return p("years")}},{children:f.getFullYear()})),"years"===m&&n.jsx("div",e.__assign({className:"st-datepicker-header-label"},{children:"Select Year"}))]})),n.jsxs("div",e.__assign({className:"st-datepicker-grid st-datepicker-".concat(m,"-grid")},{children:["days"===m&&function(){var t=[],a=f.getFullYear(),r=f.getMonth(),c=w(a,r),l=function(e,n){return new Date(e,n,1).getDay()}(a,r),o=w(a,r-1);["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(function(a,r){t.push(n.jsx("div",e.__assign({className:"st-datepicker-weekday"},{children:a}),"header-".concat(r)))});for(var u=function(a){var r=o-l+a+1;t.push(n.jsx("div",e.__assign({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(f.getFullYear(),f.getMonth()-1,e,12,0,0);v(n),i(n),null==d||d()}(r)}},{children:r}),"prev-".concat(r)))},h=0;l>h;h++)u(h);for(var k=function(c){var l=c===(new Date).getDate()&&r===(new Date).getMonth()&&a===(new Date).getFullYear(),o=new Date(s),u=c===o.getDate()&&r===o.getMonth()&&a===o.getFullYear();t.push(n.jsx("div",e.__assign({className:"st-datepicker-day ".concat(l?"today":""," ").concat(u?"selected":""),onClick:function(){return function(e){var n=f.getFullYear(),t=f.getMonth(),a=new Date(n,t,e,12,0,0);v(a),i(a),null==d||d()}(c)}},{children:c}),"day-".concat(c)))},m=1;c>=m;m++)k(m);var p=35-(l+c),y=function(a){t.push(n.jsx("div",e.__assign({className:"st-datepicker-day other-month",onClick:function(){return function(e){var n=new Date(f.getFullYear(),f.getMonth()+1,e,12,0,0);v(n),i(n),null==d||d()}(a)}},{children:a}),"next-".concat(a)))};for(m=1;p>=m;m++)y(m);return t}(),"months"===m&&(r=[],Array.from({length:12},function(e,n){return new Date(2e3,n,1).toLocaleString("default",{month:"short"})}).forEach(function(t,a){var c=a===f.getMonth();r.push(n.jsx("div",e.__assign({className:"st-datepicker-month ".concat(c?"selected":""),onClick:function(){return function(e){v(new Date(f.getFullYear(),e,1)),p("days")}(a)}},{children:t}),"month-".concat(a)))}),r),"years"===m&&function(){for(var t=[],a=f.getFullYear(),r=a-6,c=function(r){t.push(n.jsx("div",e.__assign({className:"st-datepicker-year ".concat(r===a?"selected":""),onClick:function(){return function(e){v(new Date(e,f.getMonth(),1)),p("months")}(r)}},{children:r}),"year-".concat(r)))},i=r;r+12>i;i++)c(i);return t}()]})),n.jsx("div",e.__assign({className:"st-datepicker-footer"},{children:n.jsx("button",e.__assign({className:"st-datepicker-today-btn",onClick:function(){var e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0);v(n),i(n),null==d||d()}},{children:"Today"}))}))]}))};
|
|
2
|
+
//# sourceMappingURL=DatePicker-c67d5bfb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker-c67d5bfb.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Row from "../../types/Row";
|
|
3
|
+
import RowState from "../../types/RowState";
|
|
4
|
+
import { LoadingStateRenderer, ErrorStateRenderer, EmptyStateRenderer } from "../../types/RowStateRendererProps";
|
|
5
|
+
interface RowStateIndicatorProps {
|
|
6
|
+
parentRow: Row;
|
|
7
|
+
rowState: RowState;
|
|
8
|
+
gridTemplateColumns: string;
|
|
9
|
+
loadingStateRenderer?: LoadingStateRenderer;
|
|
10
|
+
errorStateRenderer?: ErrorStateRenderer;
|
|
11
|
+
emptyStateRenderer?: EmptyStateRenderer;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Component that renders loading/error/empty states for a row
|
|
15
|
+
* Spans the full width of the table (grid column 1 / -1)
|
|
16
|
+
*/
|
|
17
|
+
declare const RowStateIndicator: React.FC<RowStateIndicatorProps>;
|
|
18
|
+
export default RowStateIndicator;
|
|
@@ -15,6 +15,7 @@ import { RowButton } from "../../types/RowButton";
|
|
|
15
15
|
import { HeaderDropdown } from "../../types/HeaderDropdownProps";
|
|
16
16
|
import FooterRendererProps from "../../types/FooterRendererProps";
|
|
17
17
|
import OnRowGroupExpandProps from "../../types/OnRowGroupExpandProps";
|
|
18
|
+
import { LoadingStateRenderer, ErrorStateRenderer, EmptyStateRenderer } from "../../types/RowStateRendererProps";
|
|
18
19
|
interface SimpleTableProps {
|
|
19
20
|
allowAnimations?: boolean;
|
|
20
21
|
cellUpdateFlash?: boolean;
|
|
@@ -24,6 +25,7 @@ interface SimpleTableProps {
|
|
|
24
25
|
columnEditorText?: string;
|
|
25
26
|
columnReordering?: boolean;
|
|
26
27
|
columnResizing?: boolean;
|
|
28
|
+
copyHeadersToClipboard?: boolean;
|
|
27
29
|
defaultHeaders: HeaderObject[];
|
|
28
30
|
editColumns?: boolean;
|
|
29
31
|
editColumnsInitOpen?: boolean;
|
|
@@ -41,9 +43,13 @@ interface SimpleTableProps {
|
|
|
41
43
|
headerHeight?: number;
|
|
42
44
|
height?: string | number;
|
|
43
45
|
hideFooter?: boolean;
|
|
46
|
+
includeHeadersInCSVExport?: boolean;
|
|
44
47
|
initialSortColumn?: string;
|
|
45
48
|
initialSortDirection?: "ascending" | "descending";
|
|
46
49
|
isLoading?: boolean;
|
|
50
|
+
loadingStateRenderer?: LoadingStateRenderer;
|
|
51
|
+
errorStateRenderer?: ErrorStateRenderer;
|
|
52
|
+
emptyStateRenderer?: EmptyStateRenderer;
|
|
47
53
|
nextIcon?: ReactNode;
|
|
48
54
|
onCellEdit?: (props: CellChangeProps) => void;
|
|
49
55
|
onCellClick?: (props: CellClickProps) => void;
|
|
@@ -72,6 +78,7 @@ interface SimpleTableProps {
|
|
|
72
78
|
shouldPaginate?: boolean;
|
|
73
79
|
sortDownIcon?: ReactNode;
|
|
74
80
|
sortUpIcon?: ReactNode;
|
|
81
|
+
tableEmptyStateRenderer?: ReactNode;
|
|
75
82
|
tableRef?: MutableRefObject<TableRefType | null>;
|
|
76
83
|
theme?: Theme;
|
|
77
84
|
totalRowCount?: number;
|
|
@@ -10,6 +10,9 @@ import CellClickProps from "../types/CellClickProps";
|
|
|
10
10
|
import { RowButton } from "../types/RowButton";
|
|
11
11
|
import { HeaderDropdown } from "../types/HeaderDropdownProps";
|
|
12
12
|
import OnRowGroupExpandProps from "../types/OnRowGroupExpandProps";
|
|
13
|
+
import RowState from "../types/RowState";
|
|
14
|
+
import Row from "../types/Row";
|
|
15
|
+
import { LoadingStateRenderer, ErrorStateRenderer, EmptyStateRenderer } from "../types/RowStateRendererProps";
|
|
13
16
|
export interface CellRegistryEntry {
|
|
14
17
|
updateContent: (newValue: CellValue) => void;
|
|
15
18
|
}
|
|
@@ -27,6 +30,7 @@ interface TableContextType {
|
|
|
27
30
|
columnBorders: boolean;
|
|
28
31
|
columnReordering: boolean;
|
|
29
32
|
columnResizing: boolean;
|
|
33
|
+
copyHeadersToClipboard: boolean;
|
|
30
34
|
draggedHeaderRef: MutableRefObject<HeaderObject | null>;
|
|
31
35
|
editColumns?: boolean;
|
|
32
36
|
enableHeaderEditing?: boolean;
|
|
@@ -35,7 +39,14 @@ interface TableContextType {
|
|
|
35
39
|
expandIcon?: ReactNode;
|
|
36
40
|
filterIcon?: ReactNode;
|
|
37
41
|
filters: TableFilterState;
|
|
42
|
+
includeHeadersInCSVExport: boolean;
|
|
43
|
+
loadingStateRenderer?: LoadingStateRenderer;
|
|
44
|
+
errorStateRenderer?: ErrorStateRenderer;
|
|
45
|
+
emptyStateRenderer?: EmptyStateRenderer;
|
|
38
46
|
forceUpdate: () => void;
|
|
47
|
+
rowStateMap: Map<string | number, RowState>;
|
|
48
|
+
setRowStateMap: Dispatch<SetStateAction<Map<string | number, RowState>>>;
|
|
49
|
+
rows: Row[];
|
|
39
50
|
getBorderClass: (cell: Cell) => string;
|
|
40
51
|
handleApplyFilter: (filter: FilterCondition) => void;
|
|
41
52
|
handleClearAllFilters: () => void;
|
|
@@ -103,6 +114,7 @@ interface TableContextType {
|
|
|
103
114
|
sortDownIcon: ReactNode;
|
|
104
115
|
sortUpIcon: ReactNode;
|
|
105
116
|
tableBodyContainerRef: RefObject<HTMLDivElement>;
|
|
117
|
+
tableEmptyStateRenderer?: ReactNode;
|
|
106
118
|
tableRows: TableRow[];
|
|
107
119
|
theme: Theme;
|
|
108
120
|
unexpandedRows: Set<string>;
|
|
@@ -13,8 +13,9 @@ interface UseSelectionProps {
|
|
|
13
13
|
collapsedHeaders?: Set<Accessor>;
|
|
14
14
|
rowHeight: number;
|
|
15
15
|
enableRowSelection?: boolean;
|
|
16
|
+
copyHeadersToClipboard?: boolean;
|
|
16
17
|
}
|
|
17
|
-
declare const useSelection: ({ selectableCells, headers, tableRows, rowIdAccessor, onCellEdit, cellRegistry, collapsedHeaders, rowHeight, enableRowSelection, }: UseSelectionProps) => {
|
|
18
|
+
declare const useSelection: ({ selectableCells, headers, tableRows, rowIdAccessor, onCellEdit, cellRegistry, collapsedHeaders, rowHeight, enableRowSelection, copyHeadersToClipboard, }: UseSelectionProps) => {
|
|
18
19
|
getBorderClass: ({ colIndex, rowIndex, rowId }: Cell) => string;
|
|
19
20
|
handleMouseDown: ({ colIndex, rowIndex, rowId }: Cell) => void;
|
|
20
21
|
handleMouseOver: ({ colIndex, rowIndex, rowId }: Cell) => void;
|
|
@@ -4,13 +4,16 @@ import { CellRegistryEntry, HeaderRegistryEntry } from "../context/TableContext"
|
|
|
4
4
|
import { Accessor } from "../types/HeaderObject";
|
|
5
5
|
import TableRow from "../types/TableRow";
|
|
6
6
|
import HeaderObject from "../types/HeaderObject";
|
|
7
|
-
declare const useTableAPI: ({ cellRegistryRef, currentTableRows, headerRegistryRef, headers, rowIdAccessor, rows, tableRef, visibleRows, }: {
|
|
7
|
+
declare const useTableAPI: ({ cellRegistryRef, currentTableRows, headerRegistryRef, headers, includeHeadersInCSVExport, rowIdAccessor, rowIndexMap, rows, setRows, tableRef, visibleRows, }: {
|
|
8
8
|
cellRegistryRef: MutableRefObject<Map<string, CellRegistryEntry>>;
|
|
9
9
|
currentTableRows: TableRow[];
|
|
10
10
|
headerRegistryRef: MutableRefObject<Map<string, HeaderRegistryEntry>>;
|
|
11
11
|
headers: HeaderObject[];
|
|
12
|
+
includeHeadersInCSVExport: boolean;
|
|
12
13
|
rowIdAccessor: Accessor;
|
|
14
|
+
rowIndexMap: MutableRefObject<Map<string | number, number>>;
|
|
13
15
|
rows: Row[];
|
|
16
|
+
setRows: (rows: Row[]) => void;
|
|
14
17
|
tableRef?: MutableRefObject<TableRefType | null> | undefined;
|
|
15
18
|
visibleRows: TableRow[];
|
|
16
19
|
}) => void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Row from "../types/Row";
|
|
2
2
|
import { Accessor } from "../types/HeaderObject";
|
|
3
3
|
import { FilterCondition } from "../types/FilterTypes";
|
|
4
|
+
import RowState from "../types/RowState";
|
|
5
|
+
import TableRow from "../types/TableRow";
|
|
4
6
|
interface UseTableRowProcessingProps {
|
|
5
7
|
allowAnimations: boolean;
|
|
6
8
|
sortedRows: Row[];
|
|
@@ -19,10 +21,14 @@ interface UseTableRowProcessingProps {
|
|
|
19
21
|
scrollDirection?: "up" | "down" | "none";
|
|
20
22
|
computeFilteredRowsPreview: (filter: FilterCondition) => Row[];
|
|
21
23
|
computeSortedRowsPreview: (accessor: Accessor) => Row[];
|
|
24
|
+
rowStateMap: Map<string | number, RowState>;
|
|
25
|
+
hasLoadingRenderer: boolean;
|
|
26
|
+
hasErrorRenderer: boolean;
|
|
27
|
+
hasEmptyRenderer: boolean;
|
|
22
28
|
}
|
|
23
|
-
declare const useTableRowProcessing: ({ allowAnimations, sortedRows, originalRows, currentPage, rowsPerPage, shouldPaginate, serverSidePagination, rowGrouping, rowIdAccessor, unexpandedRows, expandAll, contentHeight, rowHeight, scrollTop, scrollDirection, computeFilteredRowsPreview, computeSortedRowsPreview, }: UseTableRowProcessingProps) => {
|
|
24
|
-
currentTableRows:
|
|
25
|
-
currentVisibleRows:
|
|
29
|
+
declare const useTableRowProcessing: ({ allowAnimations, sortedRows, originalRows, currentPage, rowsPerPage, shouldPaginate, serverSidePagination, rowGrouping, rowIdAccessor, unexpandedRows, expandAll, contentHeight, rowHeight, scrollTop, scrollDirection, computeFilteredRowsPreview, computeSortedRowsPreview, rowStateMap, hasLoadingRenderer, hasErrorRenderer, hasEmptyRenderer, }: UseTableRowProcessingProps) => {
|
|
30
|
+
currentTableRows: TableRow[];
|
|
31
|
+
currentVisibleRows: TableRow[];
|
|
26
32
|
isAnimating: boolean;
|
|
27
33
|
prepareForFilterChange: (filter: any) => void;
|
|
28
34
|
prepareForSortChange: (accessor: Accessor) => void;
|