Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-tablize

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tablize - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

src/table/CustomScrollbars.tsx

9

CHANGELOG.md

@@ -5,2 +5,11 @@ # React Tablize - Change Log

## [0.9.0 - 2019-07-01](https://github.com/alonrbar/react-tablize/tree/v0.9.0)
### Added
- Props description in the README file.
- New `TableView.isVirtual` property.
- New appearance props (not documented): `TableView.customScrollbars` and `TableView.hairlines`.
Note: Use appearance props with caution as they may be removed in the future...
## [0.8.0 - 2019-06-23](https://github.com/alonrbar/react-tablize/tree/v0.8.0)

@@ -7,0 +16,0 @@

18

dist/index.d.ts

@@ -103,2 +103,3 @@ import * as React from 'react';

export class TableViewProps {
isVirtual?: boolean;
rowCount: number;

@@ -110,5 +111,15 @@ rowKey?: RowKeyCallback;

style?: React.CSSProperties;
/**
* Row height in pixels.
*
* Default: 50
*/
rowHeight?: number | SizeCallback;
emptyMessage?: string;
lineNumbers?: boolean;
customScrollbars?: boolean;
hairlines?: boolean;
/**
* Default: 20
*/
overscanCount?: number;

@@ -204,2 +215,5 @@ }

columnWidth: number | SizeCallback;
/**
* Number of columns to freeze (always the first columns).
*/
freezeColumns?: number;

@@ -214,3 +228,3 @@

*
* Default: 20
* Default: 1
*/

@@ -223,3 +237,3 @@ overscanRowsCount?: number;

*
* Default: 20
* Default: 1
*/

@@ -226,0 +240,0 @@ overscanColumnsCount?: number;

2

dist/react-tablize.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("react-tablize",[],t):"object"==typeof exports?exports["react-tablize"]=t():e["react-tablize"]=t()}(this,function(){return r={},o.m=n=[function(e,t){e.exports=require("react")},function(e,t){e.exports=require("react-window")},function(e,t){e.exports=require("react-virtualized-auto-sizer")},function(e,t){e.exports=require("emotion-theming")},function(e,t){e.exports=require("@emotion/styled")},function(e,t,n){e.exports=n(7)},function(e,t){e.exports=require("lodash.flattendeep")},function(e,t,n){"use strict";n.r(t);var r=n(3),p=n(0),o=n(2),y=n.n(o),h=n(1);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=function(){function n(e){var t;return a(this,n),(t=l(this,c(n).call(this,e))).state={hasError:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(n,p["Component"]),function(e,t,n){t&&u(e.prototype,t),n&&u(e,n)}(n,[{key:"componentDidCatch",value:function(e,t){this.setState({hasError:!0}),console.error(e)}},{key:"render",value:function(){return this.state.hasError?p.createElement("span",null,"X"):void 0!==this.props.children?this.props.children:null}}]),n}();function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var b=function(){function r(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r)}return function(e,t,n){t&&s(e.prototype,t),n&&s(e,n)}(r,null,[{key:"getProps",value:function(e){return e&&e.props||{}}},{key:"elementInstanceOf",value:function(e,t){return!!e&&(!!e.type&&(e.type===t||e.type.prototype instanceof t||t.isPrototypeOf(e.type)))}},{key:"isReactFragment",value:function(e){return p.isValidElement(e)&&e.type===p.Fragment}},{key:"addPropsToChildren",value:function(e,r){return p.Children.map(e,function(e,t){var n=r(e,t);return p.cloneElement(e,n)})}},{key:"childrenArray",value:function(e){if(!e)return null;if(!e.props)return null;var t=e.props.children;return Array.isArray(t)?t:p.Children.map(t,function(e){return e})}},{key:"childrenOfType",value:function(e,t){var n=r.childrenArray(e);return n?n.filter(function(e){return r.elementInstanceOf(e,t)}):null}},{key:"singleChildOfType",value:function(e,t){var n=r.childrenOfType(e,t);if(!n||!n.length)return null;if(1<n.length)throw new Error("Only one ".concat(t.name," child element is allowed."));return n[0]}},{key:"singleFunctionChild",value:function(e){if(!e)return null;if(!e.props)return null;var t=e.props.children;return"function"!=typeof e.props.children?null:t}}]),r}();function m(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function g(e){return null==e}function v(e){return Number.isFinite(e)?e+"px":e}function w(e,t){var n=(e=e||{}).height,r=e.minHeight,o=e.maxHeight;return void 0===n&&void 0===r&&(n=t),{height:n=v(n),minHeight:r=v(r),maxHeight:o=v(o)}}function O(e){return m(Array(e||0).keys())}function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var P=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),C(this,_(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(e,p["PureComponent"]),e}();function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function H(e,t){return!t||"object"!==E(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z="__ReactTablize__GridCell__"+function(e,t){var n=0<arguments.length&&void 0!==e?e:Number.MIN_SAFE_INTEGER,r=1<arguments.length&&void 0!==t?t:Number.MAX_SAFE_INTEGER;return Math.floor(Math.random()*(r-n+1)+n)}(0),A=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),H(this,k(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(e,p["PureComponent"]),function(e,t,n){t&&T(e.prototype,t),n&&T(e,n)}(e,[{key:"render",value:function(){return this.props.children}}],[{key:"extract",value:function(e){if(e&&e.props&&e.props[z]){var t=e.props,n=t.children;return{props:x(t,["children"]),content:n}}return{props:{},content:e}}}]),e}();function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function F(e,t){return!t||"object"!==B(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}I(A,"defaultProps",I({},z,!0));var G=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),F(this,W(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&N(e,t)}(e,p["PureComponent"]),e}();function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(e,t){return!t||"object"!==M(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var K=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),V(this,L(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&q(e,t)}(e,p["PureComponent"]),e}(),D=n(4),X=n.n(D).a;function U(){var e=$(["\n label: grid-body-cell;\n\n display: flex;\n\n height: 100%;\n\n overflow: hidden;\n text-overflow: ellipsis;\n\n align-items: center;\n vertical-align: middle;\n"]);return U=function(){return e},e}function J(){var e=$(["\n label: grid-body;\n"]);return J=function(){return e},e}function Q(){var e=$(["\n label: grid-head-cell;\n\n display: flex;\n\n overflow: hidden;\n text-overflow: ellipsis;\n\n align-items: flex-end;\n vertical-align: bottom;\n"]);return Q=function(){return e},e}function Y(){var e=$(["\n label: grid-head;\n\n display: flex;\n\n font-weight: bold;\n vertical-align: middle;\n\n ",": ","px;\n border-bottom: ",";\n"]);return Y=function(){return e},e}function Z(){var e=$(["\n label: grid-view;\n\n width: 100%;\n"]);return Z=function(){return e},e}function $(e,t){return t=t||e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ee=X.div(Z()),te=X.div(Y(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-right"},17,"1px solid #ddd"),ne=X.div(Q()),re=X.div(J()),oe=X.div(U());function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ue(){return(ue=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function le(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fe(e){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e,t){return(se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ye=function(){function l(){var e,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return pe(ae(r=function(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?ae(e):t}(this,(e=fe(l)).call.apply(e,[this].concat(n)))),"headList",p.createRef()),pe(ae(r),"mainBodyGrid",p.createRef()),pe(ae(r),"freezedColumnsGrid",p.createRef()),pe(ae(r),"syncScroll",function(e){var t=e.scrollTop,n=e.scrollLeft;r.headList.current&&r.headList.current.scrollTo(n),r.freezedColumnsGrid.current&&r.freezedColumnsGrid.current.scrollTo({scrollTop:t})}),pe(ae(r),"getColumnWidth",function(e){return"function"==typeof r.props.columnWidth?r.props.columnWidth(e):r.props.columnWidth}),pe(ae(r),"getRowHeight",function(t){return function(e){return"function"==typeof t?t(e):t}}),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}(l,p["PureComponent"]),function(e,t,n){t&&ce(e.prototype,t),n&&ce(e,n)}(l,[{key:"render",value:function(){var e=this.props,t=(e.columnCount,e.columnWidth,e.children,le(e,["columnCount","columnWidth","children"]));return p.createElement(d,null,p.createElement(r.ThemeProvider,{theme:this.getTheme()},p.createElement(ee,ue({},t,{style:Object.assign({direction:this.props.dir},this.props.style,w(t.style,l.defaultHeight))}),this.renderHead(),this.renderBody(),this.renderFooter())))}},{key:"renderHead",value:function(){var o=this,e=b.singleChildOfType(this,K);if(!e)return null;var t=e.props,i=t.children,n=le(t,["children"]),u=this.props.freezeColumns||0;return p.createElement(te,ue({},n,{style:Object.assign({},e.props.style,w(n.style,l.defaultHeadHeight))}),p.createElement(d,null,p.createElement(y.a,null,function(e){var t=e.width,n=e.height;return p.createElement("div",{style:{width:t,height:n,display:"flex"}},O(u).map(function(e){return o.renderHeadCell({cellRender:i,columnIndex:e,isScrolling:!1})}),p.createElement(h.VariableSizeList,{ref:o.headList,direction:o.props.dir,style:{overflow:"hidden"},layout:"horizontal",height:n,width:t-o.getFrozenColumnsWidth(),itemCount:o.props.columnCount-u,itemSize:function(e){return o.getColumnWidth(e+u)},overscanCount:o.props.overscanColumnsCount,useIsScrolling:o.props.useIsScrolling},function(e){var t=e.index,n=e.style,r=e.isScrolling;return o.renderHeadCell({cellRender:i,columnIndex:t+u,isScrolling:r,style:n})}))})))}},{key:"renderHeadCell",value:function(e){var t=e.columnIndex,n=e.cellRender,r=e.isScrolling,o=e.style,i=n({columnIndex:t,isScrolling:r}),u=A.extract(i),l=u.props,c=u.content,f=this.getColumnWidth(t);return p.createElement(ne,ue({key:t},l,{style:Object.assign({width:f},l.style,o)}),p.createElement(d,null,c))}},{key:"renderBody",value:function(){var i=this,e=b.singleChildOfType(this,P);if(!e)return null;var t=e.props,u=t.children,r=t.rowCount,o=t.rowHeight,n=le(t,["children","rowCount","rowHeight"]),l=this.getBodyHeights(),c=this.props.freezeColumns||0,f=this.getFrozenColumnsWidth();return p.createElement(re,ue({},n,{style:Object.assign({},n.style,l)}),p.createElement(d,null,p.createElement(y.a,null,function(e){var t=e.height,n=e.width;return p.createElement("div",{style:{width:n,height:t,display:"flex"}},p.createElement(h.VariableSizeGrid,{ref:i.freezedColumnsGrid,direction:i.props.dir,style:{overflow:"hidden"},height:t-17,width:f,columnCount:c,columnWidth:i.getColumnWidth,rowCount:r,rowHeight:i.getRowHeight(o),overscanRowsCount:i.props.overscanRowsCount,useIsScrolling:i.props.useIsScrolling},function(e){var t=e.rowIndex,n=e.columnIndex,r=e.style,o=e.isScrolling;return i.renderBodyCell({cellRender:u,rowIndex:t,columnIndex:n,isScrolling:o,style:r})}),p.createElement(h.VariableSizeGrid,{ref:i.mainBodyGrid,direction:i.props.dir,height:t,width:n-f,columnCount:i.props.columnCount-c,columnWidth:function(e){return i.getColumnWidth(e+c)},rowCount:r,rowHeight:i.getRowHeight(o),onScroll:i.syncScroll,overscanRowsCount:i.props.overscanRowsCount,overscanColumnsCount:i.props.overscanColumnsCount,useIsScrolling:i.props.useIsScrolling},function(e){var t=e.rowIndex,n=e.columnIndex,r=e.style,o=e.isScrolling;return i.renderBodyCell({cellRender:u,rowIndex:t,columnIndex:n+c,isScrolling:o,style:r})}))})))}},{key:"renderBodyCell",value:function(e){var t=e.rowIndex,n=e.columnIndex,r=e.cellRender,o=e.isScrolling,i=e.style,u=r({rowIndex:t,columnIndex:n,isScrolling:o}),l=A.extract(u),c=l.props,f=l.content;return p.createElement(oe,ue({key:"[ ".concat(t,", ").concat(n," ]")},c,{style:Object.assign({},c.style,i)}),p.createElement(d,null,f))}},{key:"renderFooter",value:function(){return b.singleChildOfType(this,G)?p.createElement("span",null,"Footer"):null}},{key:"getTheme",value:function(){return{dir:this.props.dir}}},{key:"getBodyHeights",value:function(){var e=w(this.props.style,l.defaultHeight),t=this.getHeadHeight(),n=w(this.props.style,void 0),r=n.height||e.height,o=n.minHeight||e.minHeight,i=n.maxHeight||e.maxHeight;return t&&(r="calc(".concat(r," - ").concat(t,")"),o=o&&"calc(".concat(o," - ").concat(t,")"),i=i&&"calc(".concat(i," - ").concat(t,")")),{height:r,minHeight:o,maxHeight:i}}},{key:"getHeadHeight",value:function(){var e=b.singleChildOfType(this,K),t=0;return e&&(t=w(e.props.style,l.defaultHeadHeight).height),t}},{key:"getFrozenColumnsWidth",value:function(){return this.props.freezeColumns?O(this.props.freezeColumns).map(this.getColumnWidth).reduce(function(e,t){return e+t},0):0}}]),l}();function he(e){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){return!t||"object"!==he(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}pe(ye,"defaultHeight","35vh"),pe(ye,"defaultHeadHeight","40px"),pe(ye,"Head",K),pe(ye,"Body",P),pe(ye,"Cell",A),pe(ye,"defaultProps",{overscanRowsCount:1,overscanColumnsCount:1});function ve(){ge(this,ve),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"children",void 0)}var we=function(){function e(){return ge(this,e),de(this,be(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(e,p["PureComponent"]),e}();function Oe(e){return(Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function je(e,t){return!t||"object"!==Oe(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Ce(e){return(Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _e(e,t){return(_e=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Se=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),je(this,Ce(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_e(e,t)}(e,p["PureComponent"]),e}();function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ee(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function xe(e){return(xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Te(e,t){return(Te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ke(){He(this,ke),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"children",void 0)}var Re=function(){function e(){return He(this,e),Ee(this,xe(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Te(e,t)}(e,p["PureComponent"]),e}();function Ie(e){return(Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ze(e,t){return!t||"object"!==Ie(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Ae(e){return(Ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Be(e,t){return(Be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fe=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ze(this,Ae(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Be(e,t)}(e,p["PureComponent"]),e}();function We(e){return(We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ne(e,t){return!t||"object"!==We(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Ge(e){return(Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Me(e,t){return(Me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Le(){Ve(this,Le),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"children",void 0)}var qe=function(){function e(){return Ve(this,e),Ne(this,Ge(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Me(e,t)}(e,p["PureComponent"]),e}();function Ke(e){return(Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function De(e,t){return!t||"object"!==Ke(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Xe(e){return(Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ye(){Je(this,Ye),Qe(this,"height","40px"),Qe(this,"children",void 0)}var Ze=function(){function e(){return Je(this,e),De(this,Xe(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ue(e,t)}(e,p["PureComponent"]),e}();function $e(e){return($e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function et(e,t){return!t||"object"!==$e(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function tt(e){return(tt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nt(e,t){return(nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var rt=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),et(this,tt(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nt(e,t)}(e,p["PureComponent"]),e}();function ot(){var e=yt(["\n min-width: 40px;\n max-width: 50px;\n"]);return ot=function(){return e},e}function it(){var e=yt(["\n flex: 1;\n padding: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n"]);return it=function(){return e},e}function ut(){var e=yt(["\n flex: 1;\n display: flex;\n justify-content: stretch;\n\n border-top: ",";\n\n &:first-of-type {\n border-top: none;\n }\n"]);return ut=function(){return e},e}function lt(){var e=yt(["\n display: flex;\n flex-flow: column;\n\n vertical-align: middle;\n"]);return lt=function(){return e},e}function ct(){var e=yt(["\n min-width: 40px;\n max-width: 50px;\n"]);return ct=function(){return e},e}function ft(){var e=yt(["\n flex: 1;\n display: flex;\n padding: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n align-items: flex-end;\n vertical-align: bottom;\n"]);return ft=function(){return e},e}function at(){var e=yt(["\n flex: 1;\n display: flex;\n justify-content: stretch;\n\n ",": ",";\n\n border-bottom: ",";\n"]);return at=function(){return e},e}function st(){var e=yt(["\n display: flex;\n flex-flow: column;\n\n overflow-y: hidden;\n\n font-weight: bold;\n vertical-align: middle;\n"]);return st=function(){return e},e}function pt(){var e=yt(["\n background-color: #fff;\n width: 100%;\n overflow-y: hidden;\n"]);return pt=function(){return e},e}function yt(e,t){return t=t||e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ht="1px solid #ddd",dt=X.div(pt()),bt=X.div(st()),mt=X.div(at(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-dir"},"17px",ht),gt=X.div(ft()),vt=X(gt)(ct()),wt=X.div(lt()),Ot=X.div(ut(),ht),jt=X.div(it()),Ct=X(jt)(ot());function _t(e){return(_t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function St(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Pt(){return(Pt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Et(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function xt(e){return(xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ht(e,t){return(Ht=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function kt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function It(){kt(this,It),Rt(this,"rowCount",void 0),Rt(this,"rowKey",void 0),Rt(this,"children",void 0),Rt(this,"dir","ltr"),Rt(this,"className",void 0),Rt(this,"style",void 0),Rt(this,"rowHeight",50),Rt(this,"emptyMessage","No Items to Display"),Rt(this,"lineNumbers",void 0),Rt(this,"overscanCount",20)}var zt=n(6),At=function(){function i(){var e,t;kt(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Rt(Tt(t=function(e,t){return!t||"object"!==_t(t)&&"function"!=typeof t?Tt(e):t}(this,(e=xt(i)).call.apply(e,[this].concat(r)))),"tableElement",p.createRef()),Rt(Tt(t),"getRowHeight",function(e){return"function"==typeof t.props.rowHeight?t.props.rowHeight(e):t.props.rowHeight}),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ht(e,t)}(i,p["PureComponent"]),function(e,t,n){t&&Et(e.prototype,t),n&&Et(e,n)}(i,[{key:"refresh",value:function(){this.tableElement.current&&this.tableElement.current.resetAfterIndex(0,!1),this.forceUpdate()}},{key:"render",value:function(){var e=b.singleChildOfType(this,Ze),t=b.singleChildOfType(this,Re),n=b.childrenOfType(this,qe);if(n&&n.length){if(e||t)throw new Error("Can not specify head and/or body when specifying table columns.");e=this.createHeadFromColumns(n),t=this.createBodyFromColumns(n)}return p.createElement(d,null,p.createElement(r.ThemeProvider,{theme:this.getTheme()},p.createElement(dt,{className:this.props.className,style:Object.assign({},this.props.style,this.getHeights())},this.renderTableHead(e),this.renderTableBody(e,t))))}},{key:"renderTableHead",value:function(e){var i=this;return e?p.createElement(bt,{style:{height:e.props.height}},p.createElement(mt,null,p.createElement(d,null,this.props.lineNumbers&&p.createElement(vt,null),p.Children.map(e.props.children,function(e,t){var n=e,r=i.getHeadCellProps(n);if(!1===r.visible)return null;var o=i.getHeadCellContent(n);return p.createElement(gt,Pt({key:t},r),p.createElement(d,null,o))})))):null}},{key:"renderTableBody",value:function(e,t){var n=this.getHeadProps(e),r=this.getHeights(),o="calc(".concat(r.height," - ").concat(n.height,")"),i="calc(".concat(r.minHeight," - ").concat(n.height,")"),u="calc(".concat(r.maxHeight," - ").concat(n.height,")");return p.createElement(wt,{style:{direction:this.props.dir,height:o,minHeight:i,maxHeight:u}},p.createElement(d,null,this.renderTableRows(t)))}},{key:"renderTableRows",value:function(a){var s=this;return 0!==this.props.rowCount&&this.hasBody(a)?p.createElement(y.a,null,function(e){var t=e.width,n=e.height;return p.createElement(h.VariableSizeList,{ref:s.tableElement,style:{outline:"none"},direction:s.props.dir,layout:"vertical",height:n,width:t,itemCount:s.props.rowCount,itemSize:s.getRowHeight},function(e){var t=e.index,n=e.style,r=a.props.children;if(!r)return null;var o=r(t),i=s.getRowProps(o),u=i.style,l=St(i,["style"]),c=s.getRowKey(l,t),f=s.getRowContent(o);return p.createElement(Ot,Pt({style:Object.assign({},n,u||{}),key:c},l),p.createElement(d,null,s.props.lineNumbers&&p.createElement(Ct,null,t+1),function(e){return Array.isArray(e)?e:[e]}(f).map(function(e,t){var n=s.getCellProps(e);return!1===n.visible?null:p.createElement(jt,Pt({key:t},n),p.createElement(d,null,s.getCellContent(e)))})))})}):this.renderItemsPlaceHolder()}},{key:"renderItemsPlaceHolder",value:function(){return p.createElement("div",null,p.createElement("div",{style:{textAlign:"center"}},this.props.emptyMessage))}},{key:"createHeadFromColumns",value:function(e){return e.every(function(e){return!b.singleChildOfType(e,Se)})?null:p.createElement(Ze,null,e.map(function(e){var t=b.singleChildOfType(e,Se);return t?p.createElement(Fe,t.props):null}))}},{key:"createBodyFromColumns",value:function(e){return p.createElement(Re,null,function(r){return e.map(function(e,t){var n=b.singleChildOfType(e,we).props.children;return n?n({rowIndex:r,columnIndex:t}):null})})}},{key:"getHeadProps",value:function(e){return b.elementInstanceOf(e,rt)?e.props:new Ye}},{key:"getHeadCellProps",value:function(e){return b.elementInstanceOf(e,Fe)&&e.props||{}}},{key:"getHeadCellContent",value:function(e){return b.elementInstanceOf(e,Fe)?e.props.children:e}},{key:"hasBody",value:function(e){return!!e&&(!g(e.props.children)&&("function"==typeof e.props.children||(Array.isArray(e.props.children)?0<e.props.children.length:0<p.Children.count(e.props.children))))}},{key:"getRowProps",value:function(e){return b.elementInstanceOf(e,rt)&&e.props||{}}},{key:"getRowContent",value:function(e){var t=e;if(b.isReactFragment(t))throw new Error("Can not use React.Fragment as row content. Consider wrapping your content with a row element.");return b.elementInstanceOf(t,rt)&&(t=t.props.children),Array.isArray(t)&&(t=zt(t)),t}},{key:"getRowKey",value:function(e,t){return g(e.key)?"function"==typeof this.props.rowKey?this.props.rowKey(t):t:e.key}},{key:"getCellProps",value:function(e){return b.elementInstanceOf(e,Fe)&&e.props||{}}},{key:"getCellContent",value:function(e){var t=e;return b.elementInstanceOf(t,Fe)&&(t=t.props.children),t||null}},{key:"getTheme",value:function(){return{dir:this.props.dir}}},{key:"getHeights",value:function(){var e=(this.props.style||{}).height,t=(this.props.style||{}).minHeight,n=(this.props.style||{}).maxHeight;return void 0===e&&void 0===t&&(e=i.defaultHeight),{height:e=v(e),minHeight:t=v(t),maxHeight:n=v(n)}}}]),i}();Rt(At,"defaultHeight","35vh"),Rt(At,"Head",Ze),Rt(At,"Body",Re),Rt(At,"Row",rt),Rt(At,"Cell",Fe),Rt(At,"Column",qe),Rt(At,"defaultProps",new It),n.d(t,"GridView",function(){return ye}),n.d(t,"ColumnBodyProps",function(){return ve}),n.d(t,"ColumnBody",function(){return we}),n.d(t,"ColumnHead",function(){return Se}),n.d(t,"TableBodyProps",function(){return ke}),n.d(t,"TableBody",function(){return Re}),n.d(t,"TableCell",function(){return Fe}),n.d(t,"TableColumnProps",function(){return Le}),n.d(t,"TableColumn",function(){return qe}),n.d(t,"TableHeadProps",function(){return Ye}),n.d(t,"TableHead",function(){return Ze}),n.d(t,"TableRow",function(){return rt}),n.d(t,"TableViewProps",function(){return It}),n.d(t,"TableView",function(){return At})}],o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=5);function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var n,r});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("react-tablize",[],t):"object"==typeof exports?exports["react-tablize"]=t():e["react-tablize"]=t()}(this,function(){return r={},o.m=n=[function(e,t){e.exports=require("react")},function(e,t){e.exports=require("react-window")},function(e,t){e.exports=require("react-virtualized-auto-sizer")},function(e,t){e.exports=require("emotion-theming")},function(e,t){e.exports=require("@emotion/styled")},function(e,t){e.exports=require("react-custom-scrollbars")},function(e,t,n){e.exports=n(8)},function(e,t){e.exports=require("lodash.flattendeep")},function(e,t,n){"use strict";n.r(t);var r=n(3),a=n(0),o=n(2),s=n.n(o),p=n(1);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var h=function(){function n(e){var t;return y(this,n),(t=l(this,c(n).call(this,e))).state={hasError:!1},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(n,a["Component"]),function(e,t,n){t&&u(e.prototype,t),n&&u(e,n)}(n,[{key:"componentDidCatch",value:function(e,t){this.setState({hasError:!0}),console.error(e)}},{key:"render",value:function(){return this.state.hasError?a.createElement("span",null,"X"):void 0!==this.props.children?this.props.children:null}}]),n}();function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var b=function(){function r(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r)}return function(e,t,n){t&&d(e.prototype,t),n&&d(e,n)}(r,null,[{key:"getProps",value:function(e){return e&&e.props||{}}},{key:"elementInstanceOf",value:function(e,t){return!!e&&(!!e.type&&(e.type===t||e.type.prototype instanceof t||Object.prototype.isPrototypeOf.call(t,e.type)))}},{key:"isReactFragment",value:function(e){return a.isValidElement(e)&&e.type===a.Fragment}},{key:"addPropsToChildren",value:function(e,r){return a.Children.map(e,function(e,t){var n=r(e,t);return a.cloneElement(e,n)})}},{key:"childrenArray",value:function(e){if(!e)return null;if(!e.props)return null;var t=e.props.children;return Array.isArray(t)?t:a.Children.map(t,function(e){return e})}},{key:"childrenOfType",value:function(e,t){var n=r.childrenArray(e);return n?n.filter(function(e){return r.elementInstanceOf(e,t)}):null}},{key:"singleChildOfType",value:function(e,t){var n=r.childrenOfType(e,t);if(!n||!n.length)return null;if(1<n.length)throw new Error("Only one ".concat(t.name," child element is allowed."));return n[0]}},{key:"singleFunctionChild",value:function(e){if(!e)return null;if(!e.props)return null;var t=e.props.children;return"function"!=typeof e.props.children?null:t}}]),r}();function m(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function g(e){return null==e}function v(e){return Number.isFinite(e)?e+"px":e}function w(e,t){var n=(e=e||{}).height,r=e.minHeight,o=e.maxHeight;return void 0===n&&void 0===r&&(n=t),{height:n=v(n),minHeight:r=v(r),maxHeight:o=v(o)}}function O(e){return m(Array(e||0).keys())}function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var P=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),_(this,S(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(e,a["PureComponent"]),e}();function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function H(e,t){return!t||"object"!==E(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z="__ReactTablize__GridCell__"+function(e,t){var n=0<arguments.length&&void 0!==e?e:Number.MIN_SAFE_INTEGER,r=1<arguments.length&&void 0!==t?t:Number.MAX_SAFE_INTEGER;return Math.floor(Math.random()*(r-n+1)+n)}(0),A=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),H(this,k(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(e,a["PureComponent"]),function(e,t,n){t&&T(e.prototype,t),n&&T(e,n)}(e,[{key:"render",value:function(){return this.props.children}}],[{key:"extract",value:function(e){if(e&&e.props&&e.props[z]){var t=e.props,n=t.children;return{props:x(t,["children"]),content:n}}return{props:{},content:e}}}]),e}();function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function F(e,t){return!t||"object"!==B(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}I(A,"defaultProps",I({},z,!0));var G=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),F(this,W(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&N(e,t)}(e,a["PureComponent"]),e}();function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function M(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var K=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),M(this,q(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(e,a["PureComponent"]),e}(),D=n(4),X=n.n(D).a;function U(){var e=$(["\n label: grid-body-cell;\n\n display: flex;\n\n height: 100%;\n\n overflow: hidden;\n text-overflow: ellipsis;\n\n align-items: center;\n vertical-align: middle;\n"]);return U=function(){return e},e}function J(){var e=$(["\n label: grid-body;\n"]);return J=function(){return e},e}function Q(){var e=$(["\n label: grid-head-cell;\n\n display: flex;\n\n overflow: hidden;\n text-overflow: ellipsis;\n\n align-items: flex-end;\n vertical-align: bottom;\n"]);return Q=function(){return e},e}function Y(){var e=$(["\n label: grid-head;\n\n display: flex;\n\n font-weight: bold;\n vertical-align: middle;\n\n ",": ","px;\n border-bottom: ",";\n"]);return Y=function(){return e},e}function Z(){var e=$(["\n label: grid-view;\n\n width: 100%;\n"]);return Z=function(){return e},e}function $(e,t){return t=t||e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ee=X.div(Z()),te=X.div(Y(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-right"},17,"1px solid #ddd"),ne=X.div(Q()),re=X.div(J()),oe=X.div(U());function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ue(){return(ue=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function le(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fe(e){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e,t){return(se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ye=function(){function l(){var e,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return pe(ae(r=function(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?ae(e):t}(this,(e=fe(l)).call.apply(e,[this].concat(n)))),"headList",a.createRef()),pe(ae(r),"mainBodyGrid",a.createRef()),pe(ae(r),"freezedColumnsGrid",a.createRef()),pe(ae(r),"syncScroll",function(e){var t=e.scrollTop,n=e.scrollLeft;r.headList.current&&r.headList.current.scrollTo(n),r.freezedColumnsGrid.current&&r.freezedColumnsGrid.current.scrollTo({scrollTop:t})}),pe(ae(r),"getColumnWidth",function(e){return"function"==typeof r.props.columnWidth?r.props.columnWidth(e):r.props.columnWidth}),pe(ae(r),"getRowHeight",function(t){return function(e){return"function"==typeof t?t(e):t}}),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}(l,a["PureComponent"]),function(e,t,n){t&&ce(e.prototype,t),n&&ce(e,n)}(l,[{key:"render",value:function(){var e=this.props,t=(e.columnCount,e.columnWidth,e.children,le(e,["columnCount","columnWidth","children"]));return a.createElement(h,null,a.createElement(r.ThemeProvider,{theme:this.getTheme()},a.createElement(ee,ue({},t,{style:Object.assign({direction:this.props.dir},this.props.style,w(t.style,l.defaultHeight))}),this.renderHead(),this.renderBody(),this.renderFooter())))}},{key:"renderHead",value:function(){var o=this,e=b.singleChildOfType(this,K);if(!e)return null;var t=e.props,i=t.children,n=le(t,["children"]),u=this.props.freezeColumns||0;return a.createElement(te,ue({},n,{style:Object.assign({},e.props.style,w(n.style,l.defaultHeadHeight))}),a.createElement(h,null,a.createElement(s.a,null,function(e){var t=e.width,n=e.height;return a.createElement("div",{style:{width:t,height:n,display:"flex"}},O(u).map(function(e){return o.renderHeadCell({cellRender:i,columnIndex:e,isScrolling:!1})}),a.createElement(p.VariableSizeList,{ref:o.headList,direction:o.props.dir,style:{overflow:"hidden"},layout:"horizontal",height:n,width:t-o.getFrozenColumnsWidth(),itemCount:o.props.columnCount-u,itemSize:function(e){return o.getColumnWidth(e+u)},overscanCount:o.props.overscanColumnsCount,useIsScrolling:o.props.useIsScrolling},function(e){var t=e.index,n=e.style,r=e.isScrolling;return o.renderHeadCell({cellRender:i,columnIndex:t+u,isScrolling:r,style:n})}))})))}},{key:"renderHeadCell",value:function(e){var t=e.columnIndex,n=e.cellRender,r=e.isScrolling,o=e.style,i=n({columnIndex:t,isScrolling:r}),u=A.extract(i),l=u.props,c=u.content,f=this.getColumnWidth(t);return a.createElement(ne,ue({key:t},l,{style:Object.assign({width:f},l.style,o)}),a.createElement(h,null,c))}},{key:"renderBody",value:function(){var i=this,e=b.singleChildOfType(this,P);if(!e)return null;var t=e.props,u=t.children,r=t.rowCount,o=t.rowHeight,n=le(t,["children","rowCount","rowHeight"]),l=this.getBodyHeights(),c=this.props.freezeColumns||0,f=this.getFrozenColumnsWidth();return a.createElement(re,ue({},n,{style:Object.assign({},n.style,l)}),a.createElement(h,null,a.createElement(s.a,null,function(e){var t=e.height,n=e.width;return a.createElement("div",{style:{width:n,height:t,display:"flex"}},a.createElement(p.VariableSizeGrid,{ref:i.freezedColumnsGrid,direction:i.props.dir,style:{overflow:"hidden"},height:t-17,width:f,columnCount:c,columnWidth:i.getColumnWidth,rowCount:r,rowHeight:i.getRowHeight(o),overscanRowsCount:i.props.overscanRowsCount,useIsScrolling:i.props.useIsScrolling},function(e){var t=e.rowIndex,n=e.columnIndex,r=e.style,o=e.isScrolling;return i.renderBodyCell({cellRender:u,rowIndex:t,columnIndex:n,isScrolling:o,style:r})}),a.createElement(p.VariableSizeGrid,{ref:i.mainBodyGrid,direction:i.props.dir,height:t,width:n-f,columnCount:i.props.columnCount-c,columnWidth:function(e){return i.getColumnWidth(e+c)},rowCount:r,rowHeight:i.getRowHeight(o),onScroll:i.syncScroll,overscanRowsCount:i.props.overscanRowsCount,overscanColumnsCount:i.props.overscanColumnsCount,useIsScrolling:i.props.useIsScrolling},function(e){var t=e.rowIndex,n=e.columnIndex,r=e.style,o=e.isScrolling;return i.renderBodyCell({cellRender:u,rowIndex:t,columnIndex:n+c,isScrolling:o,style:r})}))})))}},{key:"renderBodyCell",value:function(e){var t=e.rowIndex,n=e.columnIndex,r=e.cellRender,o=e.isScrolling,i=e.style,u=r({rowIndex:t,columnIndex:n,isScrolling:o}),l=A.extract(u),c=l.props,f=l.content;return a.createElement(oe,ue({key:"[ ".concat(t,", ").concat(n," ]")},c,{style:Object.assign({},c.style,i)}),a.createElement(h,null,f))}},{key:"renderFooter",value:function(){return b.singleChildOfType(this,G)?a.createElement("span",null,"Footer"):null}},{key:"getTheme",value:function(){return{dir:this.props.dir}}},{key:"getBodyHeights",value:function(){var e=w(this.props.style,l.defaultHeight),t=this.getHeadHeight(),n=w(this.props.style,void 0),r=n.height||e.height,o=n.minHeight||e.minHeight,i=n.maxHeight||e.maxHeight;return t&&(r="calc(".concat(r," - ").concat(t,")"),o=o&&"calc(".concat(o," - ").concat(t,")"),i=i&&"calc(".concat(i," - ").concat(t,")")),{height:r,minHeight:o,maxHeight:i}}},{key:"getHeadHeight",value:function(){var e=b.singleChildOfType(this,K),t=0;return e&&(t=w(e.props.style,l.defaultHeadHeight).height),t}},{key:"getFrozenColumnsWidth",value:function(){return this.props.freezeColumns?O(this.props.freezeColumns).map(this.getColumnWidth).reduce(function(e,t){return e+t},0):0}}]),l}();function he(e){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){return!t||"object"!==he(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}pe(ye,"defaultHeight","35vh"),pe(ye,"defaultHeadHeight","40px"),pe(ye,"Head",K),pe(ye,"Body",P),pe(ye,"Cell",A),pe(ye,"defaultProps",{overscanRowsCount:1,overscanColumnsCount:1});function ve(){ge(this,ve),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"children",void 0)}var we=function(){function e(){return ge(this,e),de(this,be(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(e,a["PureComponent"]),e}();function Oe(e){return(Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function je(e,t){return!t||"object"!==Oe(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Se(e,t){return(Se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ce=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),je(this,_e(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Se(e,t)}(e,a["PureComponent"]),e}();function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ee(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function xe(e){return(xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Te(e,t){return(Te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ke(){He(this,ke),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"children",void 0)}var Re=function(){function e(){return He(this,e),Ee(this,xe(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Te(e,t)}(e,a["PureComponent"]),e}();function Ie(e){return(Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ze(e,t){return!t||"object"!==Ie(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Ae(e){return(Ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Be(e,t){return(Be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fe=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ze(this,Ae(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Be(e,t)}(e,a["PureComponent"]),e}();function We(e){return(We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ne(e,t){return!t||"object"!==We(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Ge(e){return(Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ve(e,t){return(Ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qe(){Me(this,qe),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"children",void 0)}var Le=function(){function e(){return Me(this,e),Ne(this,Ge(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ve(e,t)}(e,a["PureComponent"]),e}();function Ke(e){return(Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function De(e,t){return!t||"object"!==Ke(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function Xe(e){return(Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ye(){Je(this,Ye),Qe(this,"height","40px"),Qe(this,"children",void 0)}var Ze=function(){function e(){return Je(this,e),De(this,Xe(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ue(e,t)}(e,a["PureComponent"]),e}();function $e(e){return($e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function et(e,t){return!t||"object"!==$e(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function tt(e){return(tt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nt(e,t){return(nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var rt=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),et(this,tt(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nt(e,t)}(e,a["PureComponent"]),e}(),ot=n(5),it=n.n(ot);function ut(e){return(ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ft(e,t){return!t||"object"!==ut(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function at(e){return(at=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function st(e,t){return(st=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pt=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ft(this,at(e).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&st(e,t)}(e,a["PureComponent"]),function(e,t,n){t&&ct(e.prototype,t),n&&ct(e,n)}(e,[{key:"render",value:function(){return a.createElement(it.a,{style:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(e){lt(t,e,n[e])})}return t}({},this.props.style,{overflow:"hidden",direction:"ltr"}),onScroll:this.props.onScroll},this.props.children)}}]),e}();function yt(){var e=jt(["\n min-width: 40px;\n max-width: 50px;\n"]);return yt=function(){return e},e}function ht(){var e=jt(["\n flex: 1;\n padding: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n"]);return ht=function(){return e},e}function dt(){var e=jt(["\n flex: 1;\n display: flex;\n justify-content: stretch;\n\n ",";\n\n &:first-of-type {\n border-top: none;\n }\n"]);return dt=function(){return e},e}function bt(){var e=jt(["\n display: flex;\n flex-flow: column;\n\n vertical-align: middle;\n"]);return bt=function(){return e},e}function mt(){var e=jt(["\n min-width: 40px;\n max-width: 50px;\n"]);return mt=function(){return e},e}function gt(){var e=jt(["\n flex: 1;\n display: flex;\n padding: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n align-items: flex-end;\n vertical-align: bottom;\n"]);return gt=function(){return e},e}function vt(){var e=jt(["\n flex: 1;\n display: flex;\n justify-content: stretch;\n\n ",": ",";\n ",";\n"]);return vt=function(){return e},e}function wt(){var e=jt(["\n display: flex;\n flex-flow: column;\n\n overflow-y: hidden;\n\n font-weight: bold;\n vertical-align: middle;\n"]);return wt=function(){return e},e}function Ot(){var e=jt(["\n width: 100%;\n overflow-y: hidden;\n"]);return Ot=function(){return e},e}function jt(e,t){return t=t||e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var _t="1px solid #ddd",St=X.div(Ot()),Ct=X.div(wt()),Pt=X.div(vt(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-right"},"17px",function(e){return e.theme.hairlines?"border-bottom: ".concat(_t):""}),Et=X.div(gt()),xt=X(Et)(mt()),Tt=X.div(bt()),Ht=X.div(dt(),function(e){return e.theme.hairlines?"border-top: ".concat(_t):""}),kt=X.div(ht()),Rt=X(kt)(yt());function It(e){return(It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zt(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function At(){return(At=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Bt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ft(e){return(Ft=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nt(e,t){return(Nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Gt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(){Gt(this,Mt),Vt(this,"isVirtual",void 0),Vt(this,"rowCount",void 0),Vt(this,"rowKey",void 0),Vt(this,"children",void 0),Vt(this,"dir","ltr"),Vt(this,"className",void 0),Vt(this,"style",void 0),Vt(this,"rowHeight",50),Vt(this,"emptyMessage","No Items to Display"),Vt(this,"lineNumbers",void 0),Vt(this,"customScrollbars",void 0),Vt(this,"hairlines",void 0),Vt(this,"overscanCount",20)}var qt=n(7),Lt=function(){function i(){var e,t;Gt(this,i);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Vt(Wt(t=function(e,t){return!t||"object"!==It(t)&&"function"!=typeof t?Wt(e):t}(this,(e=Ft(i)).call.apply(e,[this].concat(r)))),"tableElement",a.createRef()),Vt(Wt(t),"getRowHeight",function(e){return"function"==typeof t.props.rowHeight?t.props.rowHeight(e):t.props.rowHeight}),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Nt(e,t)}(i,a["PureComponent"]),function(e,t,n){t&&Bt(e.prototype,t),n&&Bt(e,n)}(i,[{key:"refresh",value:function(){this.tableElement.current&&this.tableElement.current.resetAfterIndex(0,!1),this.forceUpdate()}},{key:"render",value:function(){var e=b.singleChildOfType(this,Ze),t=b.singleChildOfType(this,Re),n=b.childrenOfType(this,Le);if(n&&n.length){if(e||t)throw new Error("Can not specify head and/or body when specifying table columns.");e=this.createHeadFromColumns(n),t=this.createBodyFromColumns(n)}return a.createElement(h,null,a.createElement(r.ThemeProvider,{theme:this.getTheme()},a.createElement(St,{className:this.props.className,style:Object.assign({},this.props.style,this.getHeights())},this.renderTableHead(e),this.renderTableBody(e,t))))}},{key:"renderTableHead",value:function(e){var i=this;return e?a.createElement(Ct,{style:{height:e.props.height}},a.createElement(Pt,null,a.createElement(h,null,this.props.lineNumbers&&a.createElement(xt,null),a.Children.map(e.props.children,function(e,t){var n=e,r=i.getHeadCellProps(n);if(!1===r.visible)return null;var o=i.getHeadCellContent(n);return a.createElement(Et,At({key:t},r),a.createElement(h,null,o))})))):null}},{key:"renderTableBody",value:function(e,t){var n=this.getHeadProps(e),r=this.getHeights(),o="calc(".concat(r.height," - ").concat(n.height,")"),i="calc(".concat(r.minHeight," - ").concat(n.height,")"),u="calc(".concat(r.maxHeight," - ").concat(n.height,")");return a.createElement(Tt,{style:{direction:this.props.dir,height:o,minHeight:i,maxHeight:u}},a.createElement(h,null,this.renderTableRows(t)))}},{key:"renderTableRows",value:function(e){var r=this;if(0===this.props.rowCount||!this.hasBody(e))return this.renderItemsPlaceHolder();var o=e.props.children;return a.createElement(s.a,null,function(e){var t=e.width,n=e.height;return!1!==r.props.isVirtual?r.renderTableRows_virtual(t,n,o):r.renderTableRows_nonVirtual(t,n,o)})}},{key:"renderTableRows_virtual",value:function(e,t,r){var o=this;return a.createElement(p.VariableSizeList,{ref:this.tableElement,style:{outline:"none"},outerElementType:this.getOuterElementType(),direction:this.props.dir,layout:"vertical",height:t,width:e,itemCount:this.props.rowCount,itemSize:this.getRowHeight},function(e){var t=e.index,n=e.style;return o.renderBodyRow(t,r,n)})}},{key:"renderTableRows_nonVirtual",value:function(e,t,n){var r=this;return a.createElement(this.getOuterElementType()||"div",{style:{height:t,width:e,direction:this.props.dir,outline:"none",overflow:"auto"}},n&&Array(this.props.rowCount).fill(0).map(function(e,t){return r.renderBodyRow(t,n,{height:r.getRowHeight(t)})}))}},{key:"renderBodyRow",value:function(e,t,n){var r=this;if(!t)return null;var o=t(e),i=this.getRowProps(o),u=i.style,l=zt(i,["style"]),c=this.getRowKey(l,e),f=this.getRowContent(o);return a.createElement(Ht,At({style:Object.assign({},n,u),key:c},l),a.createElement(h,null,this.props.lineNumbers&&a.createElement(Rt,null,e+1),function(e){return Array.isArray(e)?e:[e]}(f).map(function(e,t){var n=r.getCellProps(e);return!1===n.visible?null:a.createElement(kt,At({key:t},n),a.createElement(h,null,r.getCellContent(e)))})))}},{key:"renderItemsPlaceHolder",value:function(){return a.createElement("div",null,a.createElement("div",{style:{textAlign:"center"}},this.props.emptyMessage))}},{key:"createHeadFromColumns",value:function(e){return e.every(function(e){return!b.singleChildOfType(e,Ce)})?null:a.createElement(Ze,null,e.map(function(e){var t=b.singleChildOfType(e,Ce);return t?a.createElement(Fe,t.props):null}))}},{key:"createBodyFromColumns",value:function(e){return a.createElement(Re,null,function(r){return e.map(function(e,t){var n=b.singleChildOfType(e,we).props.children;return n?n({rowIndex:r,columnIndex:t}):null})})}},{key:"getHeadProps",value:function(e){return b.elementInstanceOf(e,rt)?e.props:new Ye}},{key:"getHeadCellProps",value:function(e){return b.elementInstanceOf(e,Fe)&&e.props||{}}},{key:"getHeadCellContent",value:function(e){return b.elementInstanceOf(e,Fe)?e.props.children:e}},{key:"hasBody",value:function(e){return!!e&&(!g(e.props.children)&&("function"==typeof e.props.children||(Array.isArray(e.props.children)?0<e.props.children.length:0<a.Children.count(e.props.children))))}},{key:"getRowProps",value:function(e){return b.elementInstanceOf(e,rt)&&e.props||{}}},{key:"getRowContent",value:function(e){var t=e;if(b.isReactFragment(t))throw new Error("Can not use React.Fragment as row content. Consider wrapping your content with a row element.");return b.elementInstanceOf(t,rt)&&(t=t.props.children),Array.isArray(t)&&(t=qt(t)),t}},{key:"getRowKey",value:function(e,t){return g(e.key)?"function"==typeof this.props.rowKey?this.props.rowKey(t):t:e.key}},{key:"getCellProps",value:function(e){return b.elementInstanceOf(e,Fe)&&e.props||{}}},{key:"getCellContent",value:function(e){var t=e;return b.elementInstanceOf(t,Fe)&&(t=t.props.children),t||null}},{key:"getTheme",value:function(){return{dir:this.props.dir,hairlines:!1!==this.props.hairlines}}},{key:"getHeights",value:function(){var e=(this.props.style||{}).height,t=(this.props.style||{}).minHeight,n=(this.props.style||{}).maxHeight;return void 0===e&&void 0===t&&(e=i.defaultHeight),{height:e=v(e),minHeight:t=v(t),maxHeight:n=v(n)}}},{key:"getOuterElementType",value:function(){return this.props.customScrollbars?pt:void 0}}]),i}();Vt(Lt,"defaultHeight","35vh"),Vt(Lt,"Head",Ze),Vt(Lt,"Body",Re),Vt(Lt,"Row",rt),Vt(Lt,"Cell",Fe),Vt(Lt,"Column",Le),Vt(Lt,"defaultProps",new Mt),n.d(t,"GridView",function(){return ye}),n.d(t,"ColumnBodyProps",function(){return ve}),n.d(t,"ColumnBody",function(){return we}),n.d(t,"ColumnHead",function(){return Ce}),n.d(t,"TableBodyProps",function(){return ke}),n.d(t,"TableBody",function(){return Re}),n.d(t,"TableCell",function(){return Fe}),n.d(t,"TableColumnProps",function(){return qe}),n.d(t,"TableColumn",function(){return Le}),n.d(t,"TableHeadProps",function(){return Ye}),n.d(t,"TableHead",function(){return Ze}),n.d(t,"TableRow",function(){return rt}),n.d(t,"TableViewProps",function(){return Mt}),n.d(t,"TableView",function(){return Lt})}],o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=6);function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var n,r});
{
"name": "react-tablize",
"version": "0.8.0",
"version": "0.9.0",
"description": "Virtual table and grid components for React",

@@ -30,6 +30,7 @@ "author": "Alon Bar",

"dependencies": {
"@emotion/styled": "^10.0.10",
"lodash.flattendeep": "^4.4.0",
"@emotion/styled": "^10.0.14",
"lodash.flattendeep": "^4.4.0",
"react-custom-scrollbars": "4.2.1",
"react-virtualized-auto-sizer": "^1.0.2",
"react-window": "^1.8.2"
"react-window": "^1.8.4"
},

@@ -47,19 +48,20 @@ "peerDependencies": {

"@babel/preset-typescript": "7.3.3",
"@storybook/react": "5.1.3",
"@types/react": "16.8.17",
"@storybook/react": "5.1.9",
"@types/react": "16.8.22",
"@types/react-custom-scrollbars": "4.0.5",
"@types/react-dom": "16.8.4",
"@types/react-virtualized-auto-sizer": "1.0.0",
"@types/react-window": "1.8.0",
"@types/storybook__react": "4.0.1",
"@types/storybook__react": "4.0.2",
"@types/webpack-env": "1.13.9",
"@typescript-eslint/eslint-plugin": "1.9.0",
"@typescript-eslint/parser": "1.9.0",
"@typescript-eslint/eslint-plugin": "1.11.0",
"@typescript-eslint/parser": "1.11.0",
"babel-loader": "8.0.6",
"babel-plugin-emotion": "10.0.9",
"eslint": "5.16.0",
"eslint-plugin-react": "7.13.0",
"typescript": "3.5.1",
"babel-plugin-emotion": "10.0.14",
"eslint": "6.0.1",
"eslint-plugin-react": "7.14.2",
"typescript": "3.5.2",
"uglifyjs-webpack-plugin": "2.1.3",
"webpack": "4.33.0",
"webpack-cli": "3.3.3",
"webpack": "4.35.2",
"webpack-cli": "3.3.5",
"webpack-merge": "4.2.1",

@@ -66,0 +68,0 @@ "webpack-node-externals": "1.7.2"

@@ -11,8 +11,14 @@ # react-tablize

- [TableView](#tableview)
- [Examples](#table-examples)
- [Props](#table-props)
- [GridView](#gridview)
- [Examples](#grid-examples)
- [Props](#grid-props)
## TableView
### Terse syntax
### Table Examples
#### Terse syntax
```jsx

@@ -35,3 +41,3 @@

### Rows and cells syntax
#### Rows and cells syntax

@@ -66,3 +72,3 @@ ```jsx

### Mixed syntax
#### Mixed syntax

@@ -97,3 +103,3 @@ ```jsx

### Columns syntax
#### Columns syntax

@@ -123,6 +129,22 @@ ```jsx

### Table Props
| Name | Type | Default | Required | Description |
|-|-|-|-|-|
| isVirtual | boolean | true | no | Whether to use a virtual table (using [react-window](https://github.com/bvaughn/react-window)) or to use simple divs. Useful for performance comparison and optimization. |
| rowCount | number || yes | The number of rows in the table. |
| rowKey | `(rowIndex: number) => React.Key` | | no | React key for each row. |
| dir | `'rtl'` \| `'ltr'` | `'ltr'` | no ||
| className | string || no ||
| style | React.CSSProperties || no ||
| rowHeight | `number` \| `(rowIndex: number) => number` | 50 | no | Row height in pixels. |
| emptyMessage | string | "No Items to Display" | no | What to display when there are no items. |
| overscanCount | number | 20 | no ||
## GridView
### Simple Grid
### Grid Examples
#### Simple Grid
```jsx

@@ -146,3 +168,3 @@ <GridView

### Frozen Head and Columns
#### Frozen Head and Columns

@@ -177,3 +199,3 @@ ```jsx

### Variable Width and Height
#### Variable Width and Height

@@ -205,2 +227,14 @@ ```jsx

</GridView>
```
```
### Grid Props
| Name | Type | Default | Required | Description |
|-|-|-|-|-|
| columnCount | number || yes ||
| columnWidth | `number` \| `(columnIndex: number) => number` || yes | Column width in pixels. |
| freezeColumns | number | 0 | no | Number of columns to freeze (always the first columns). |
| dir | `'rtl'` \| `'ltr'` | `'ltr'` | no ||
| overscanRowsCount | number | 1 | no ||
| overscanColumnsCount | number | 1 | no ||
| useIsScrolling | boolean | false | no | Adds an additional isScrolling parameter to the children render function. This parameter can be used to show a placeholder row or column while the list is being scrolled. Note that using this parameter may impact performance. |

@@ -5,2 +5,3 @@ import styled, { CreateStyled } from '@emotion/styled';

dir: DocDir;
hairlines?: boolean;
}

@@ -7,0 +8,0 @@

@@ -29,3 +29,3 @@ import * as React from 'react';

elem.type.prototype instanceof type ||
type.isPrototypeOf(elem.type);
Object.prototype.isPrototypeOf.call(type, elem.type);
}

@@ -32,0 +32,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc