react-tablize
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -5,2 +5,13 @@ # React Tablize - Change Log | ||
## [0.4.0 - 2019-05-12](https://github.com/alonrbar/react-tablize/tree/v0.4.0) | ||
### Added | ||
- Variable sized grid. | ||
- Grid RTL support. | ||
### Changed | ||
- BREAKING: Grid render callbacks uses argument objects. | ||
## [0.3.0 - 2019-05-08](https://github.com/alonrbar/react-tablize/tree/v0.3.0) | ||
@@ -7,0 +18,0 @@ |
@@ -91,5 +91,5 @@ import * as React from 'react'; | ||
declare type RowsSyntaxChildren<T> = [SubComp<TableHead<T>>, SubComp<TableBody<T>>]; | ||
declare type TableChildren_RowsSyntax<T> = [SubComp<TableHead<T>>, SubComp<TableBody<T>>]; | ||
declare type ColumnsSyntaxChildren<T> = OneOrMore<SubComp<TableColumn<T>>>; | ||
declare type TableChildren_ColumnsSyntax<T> = OneOrMore<SubComp<TableColumn<T>>>; | ||
@@ -101,3 +101,3 @@ export declare type ItemIdCallback<T> = (item: T, index: number) => Id; | ||
itemId?: ItemIdCallback<T>; | ||
children?: RowsSyntaxChildren<T> | ColumnsSyntaxChildren<T>; | ||
children?: TableChildren_RowsSyntax<T> | TableChildren_ColumnsSyntax<T>; | ||
dir?: DocDir; | ||
@@ -130,4 +130,8 @@ className?: string; | ||
export type HeadCellRender = (columnIndex: number) => React.ReactNode; | ||
export interface HeadCellRenderArgs { | ||
columnIndex: number; | ||
} | ||
export type HeadCellRender = (args: HeadCellRenderArgs) => React.ReactNode; | ||
export interface GridHeadProps extends React.DivProps { | ||
@@ -143,5 +147,12 @@ children?: HeadCellRender; | ||
export type BodyCellRender = (rowIndex: number, columnIndex: number) => React.ReactNode; | ||
export interface BodyCellRenderArgs { | ||
rowIndex: number; | ||
columnIndex: number; | ||
} | ||
export type BodyCellRender = (args: BodyCellRenderArgs) => React.ReactNode; | ||
export interface GridBodyProps extends React.DivProps { | ||
rowCount: number; | ||
rowHeight: number | SizeCallback; | ||
children?: BodyCellRender; | ||
@@ -178,4 +189,4 @@ } | ||
type FullSyntaxChildren = [React.SubComp<GridHead>, React.SubComp<GridBody>]; | ||
type GridChildren = FullSyntaxChildren | BodyCellRender; | ||
type GridChildren_FullSyntax = [React.SubComp<GridHead>, React.SubComp<GridBody>]; | ||
type GridChildren = GridChildren_FullSyntax | BodyCellRender; | ||
@@ -185,6 +196,4 @@ export interface GridViewProps extends React.DivProps { | ||
columnCount: number; | ||
columnWidth: number; | ||
freezeColumns?: number; | ||
rowCount: number; | ||
rowHeight: number; | ||
columnWidth: number | SizeCallback; | ||
freezeColumns?: number; | ||
@@ -196,3 +205,3 @@ dir?: DocDir; | ||
export class GridView extends React.PureComponent<GridViewProps, GridViewState> { | ||
export class GridView extends React.PureComponent<GridViewProps> { | ||
@@ -235,8 +244,4 @@ public static readonly defaultHeight = '35vh'; | ||
type Id = any; | ||
type DocDir = 'ltr' | 'rtl'; | ||
interface IIdentifiable { | ||
id: Id; | ||
} | ||
type DocDir = 'ltr' | 'rtl'; | ||
type SizeCallback = (index: number) => number; |
@@ -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 function(n){var r={};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}return o.m=n,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(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 o=n(3),y=n(0),r=n(2),c=n.n(r),l=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 f(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 a(e){return(a=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)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var h=function(e){function n(e){var t;return p(this,n),(t=f(this,a(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&&s(e,t)}(n,y["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?y.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||t.isPrototypeOf(e.type)))}},{key:"isReactFragment",value:function(e){return y.isValidElement(e)&&e.type===y.Fragment}},{key:"addPropsToChildren",value:function(e,r){return y.Children.map(e,function(e,t){var n=r(e,t);return y.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:y.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 v(e){return null==e}function g(e){return Number.isFinite(e)?e+"px":e}function O(e,t){var n=(e=e||{}).height,r=e.minHeight,o=e.maxHeight;return void 0===n&&void 0===r&&(n=t),{height:n=g(n),minHeight:r=g(r),maxHeight:o=g(o)}}function w(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 P(e){return(P=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 E=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),_(this,P(t).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)}(t,y["PureComponent"]),t}();function C(e){return(C="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"!==C(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(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Number.MIN_SAFE_INTEGER,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Number.MAX_SAFE_INTEGER;return Math.floor(Math.random()*(t-e+1)+e)}(0),A=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),H(this,k(t).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)}(t,y["PureComponent"]),function(e,t,n){t&&T(e.prototype,t),n&&T(e,n)}(t,[{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}}}]),t}();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 L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}I(A,"defaultProps",I({},z,!0));var N=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),F(this,L(t).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&&M(e,t)}(t,y["PureComponent"]),t}();function W(e){return(W="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 q(e,t){return!t||"object"!==W(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 G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var D=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),q(this,G(t).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&&V(e,t)}(t,y["PureComponent"]),t}(),K=n(4),X=n.n(K).a;function J(){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 J=function(){return e},e}function Q(){var e=$(["\n label: grid-body;\n"]);return Q=function(){return e},e}function U(){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 U=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(U()),re=X.div(Q()),oe=X.div(J());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 ce(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 le(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(e){function u(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return pe(ae(t=function(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?ae(e):t}(this,(e=fe(u)).call.apply(e,[this].concat(r)))),"headList",y.createRef()),pe(ae(t),"freezedColumnsList",y.createRef()),pe(ae(t),"handleScroll",function(e){t.freezedColumnsList.current&&t.freezedColumnsList.current.scrollTo(e.scrollTop),t.headList.current&&t.headList.current.scrollTo(e.scrollLeft)}),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&&se(e,t)}(u,y["PureComponent"]),function(e,t,n){t&&le(e.prototype,t),n&&le(e,n)}(u,[{key:"render",value:function(){var e=this.props,t=(e.columnCount,e.columnWidth,e.children,ce(e,["columnCount","columnWidth","children"]));return y.createElement(h,null,y.createElement(o.ThemeProvider,{theme:this.getTheme()},y.createElement(ee,ue({},t,{style:Object.assign({},this.props.style,O(t.style,u.defaultHeight))}),this.renderHead(),this.renderBody(),this.renderFooter())))}},{key:"renderHead",value:function(){var r=this,e=b.singleChildOfType(this,D);if(!e)return null;var t=e.props,o=t.children,n=ce(t,["children"]),i=this.props.freezeColumns||0;return y.createElement(te,ue({},n,{style:Object.assign({},e.props.style,O(n.style,u.defaultHeadHeight))}),y.createElement(h,null,y.createElement(c.a,null,function(e){var t=e.width,n=e.height;return y.createElement("div",{style:{width:t,height:n,display:"flex"}},w(i).map(function(e){return r.renderHeadCell(o,e)}),y.createElement(l.FixedSizeList,{ref:r.headList,style:{overflow:"hidden"},layout:"horizontal",height:n,width:t-i*r.props.columnWidth,itemCount:r.props.columnCount-i,itemSize:r.props.columnWidth},function(e){var t=e.index,n=e.style;return r.renderHeadCell(o,t+i,n)}))})))}},{key:"renderHeadCell",value:function(e,t,n){var r=e(t),o=A.extract(r),i=o.props,u=o.content;return y.createElement(ne,ue({key:t},i,{style:Object.assign({width:this.props.columnWidth},i.style,n)}),y.createElement(h,null,u))}},{key:"renderBody",value:function(){var o=this,e=b.singleChildOfType(this,E);if(!e)return null;var t=e.props,i=t.children,n=ce(t,["children"]),r=this.getBodyHeights(),u=this.props.freezeColumns||0;return y.createElement(re,ue({},n,{style:Object.assign({},n.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){pe(t,e,n[e])})}return t}({direction:this.props.dir},r))}),y.createElement(h,null,y.createElement(c.a,null,function(e){var t=e.height,n=e.width;return y.createElement("div",{style:{width:n,height:t,display:"flex"}},y.createElement(l.FixedSizeList,{ref:o.freezedColumnsList,style:{overflow:"hidden"},height:t-17,width:u*o.props.columnWidth,itemCount:o.props.rowCount,itemSize:o.props.rowHeight},function(e){var t=e.index,n=e.style;return y.createElement("div",{style:n},w(u).map(function(e){return o.renderBodyCell(i,t,e)}))}),y.createElement(l.FixedSizeGrid,{height:t,width:n-u*o.props.columnWidth,columnCount:o.props.columnCount-u,columnWidth:o.props.columnWidth,rowCount:o.props.rowCount,rowHeight:o.props.rowHeight,onScroll:o.handleScroll},function(e){var t=e.rowIndex,n=e.columnIndex,r=e.style;return o.renderBodyCell(i,t,n+u,r)}))})))}},{key:"renderBodyCell",value:function(e,t,n,r){var o=e(t,n),i=A.extract(o),u=i.props,c=i.content;return y.createElement(oe,ue({key:"[ ".concat(t,", ").concat(n," ]")},u,{style:Object.assign({},u.style,r)}),y.createElement(h,null,c))}},{key:"renderFooter",value:function(){return b.singleChildOfType(this,N)?y.createElement("span",null,"Footer"):null}},{key:"getTheme",value:function(){return{dir:this.props.dir}}},{key:"getBodyHeights",value:function(){var e,t,n=O(this.props.style,u.defaultHeight),r=this.getHeadHeight(),o=O(this.props.style,void 0),i=o.height||"calc(".concat(n.height," - ").concat(r,")");return(o.minHeight||n.minHeight)&&(e=o.minHeight||"calc(".concat(n.minHeight," - ").concat(r,")")),(o.maxHeight||n.maxHeight)&&(t=o.maxHeight||"calc(".concat(n.maxHeight," - ").concat(r,")")),{height:i,minHeight:e,maxHeight:t}}},{key:"getHeadHeight",value:function(){var e=b.singleChildOfType(this,D),t=0;return e&&(t=O(e.props.style,u.defaultHeadHeight).height),t}}]),u}();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 ve(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",D),pe(ye,"Body",E),pe(ye,"Cell",A);var ge=function e(){ve(this,e),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)},Oe=function(e){function t(){return ve(this,t),de(this,be(t).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)}(t,y["PureComponent"]),t}();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 je(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 _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Pe(e,t){return(Pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ce=function e(){Se(this,e),Ee(this,"height","40px"),Ee(this,"children",void 0)},xe=function(e){function t(){return Se(this,t),je(this,_e(t).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&&Pe(e,t)}(t,y["PureComponent"]),t}();function Te(e){return(Te="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 He(e,t){return!t||"object"!==Te(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 ke(e){return(ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Re(e,t){return(Re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ze=function e(){Ie(this,e),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)},Ae=function(e){function t(){return Ie(this,t),He(this,ke(t).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&&Re(e,t)}(t,y["PureComponent"]),t}();function Be(e){return(Be="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 Fe(e,t){return!t||"object"!==Be(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 Le(e){return(Le=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)}var Ne=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Fe(this,Le(t).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)}(t,y["PureComponent"]),t}();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 qe(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 De(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ke=function e(){De(this,e),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)},Xe=function(e){function t(){return De(this,t),qe(this,Ge(t).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)}(t,y["PureComponent"]),t}();function Je(e){return(Je="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 Qe(e,t){return!t||"object"!==Je(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 Ue(e){return(Ue=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ye(e,t){return(Ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var et=function e(){Ze(this,e),$e(this,"height","40px"),$e(this,"children",void 0)},tt=function(e){function t(){return Ze(this,t),Qe(this,Ue(t).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&&Ye(e,t)}(t,y["PureComponent"]),t}();function nt(e){return(nt="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 rt(e,t){return!t||"object"!==nt(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 ot(e){return(ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function it(e,t){return(it=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ut=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),rt(this,ot(t).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&&it(e,t)}(t,y["PureComponent"]),t}();function ct(){var e=ht(["\n flex: 1;\n padding: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n"]);return ct=function(){return e},e}function lt(){var e=ht(["\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 lt=function(){return e},e}function ft(){var e=ht(["\n display: flex;\n flex-flow: column;\n\n vertical-align: middle;\n"]);return ft=function(){return e},e}function at(){var e=ht(["\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 at=function(){return e},e}function st(){var e=ht(["\n flex: 1;\n display: flex;\n justify-content: stretch;\n\n ",": ",";\n\n border-bottom: ",";\n"]);return st=function(){return e},e}function pt(){var e=ht(["\n display: flex;\n flex-flow: column;\n\n overflow-y: hidden;\n\n font-weight: bold;\n vertical-align: middle;\n"]);return pt=function(){return e},e}function yt(){var e=ht(["\n background-color: #fff;\n width: 100%;\n overflow-y: hidden;\n"]);return yt=function(){return e},e}function ht(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var dt="1px solid #ddd",bt=X.div(yt()),mt=X.div(pt()),vt=X.div(st(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-dir"},"17px",dt),gt=X.div(at()),Ot=X.div(ft()),wt=X.div(lt(),dt),jt=X.div(ct());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 Pt(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 St(){return(St=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 Ct(e,t){return!t||"object"!==_t(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 xt(e){return(xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tt(e,t){return(Tt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Rt=n(6),It=function e(){Ht(this,e),kt(this,"items",void 0),kt(this,"itemId",void 0),kt(this,"children",void 0),kt(this,"dir","ltr"),kt(this,"className",void 0),kt(this,"style",void 0),kt(this,"rowHeight",50),kt(this,"emptyMessage","No Items to Display"),kt(this,"overscanCount",20)},zt=function e(){Ht(this,e),kt(this,"selectedItems",{})},At=function(e){function r(e){var t;return Ht(this,r),(t=Ct(this,xt(r).call(this,e))).state=new zt,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&&Tt(e,t)}(r,y["PureComponent"]),function(e,t,n){t&&Et(e.prototype,t),n&&Et(e,n)}(r,[{key:"render",value:function(){var e=b.singleChildOfType(this,tt),t=b.singleChildOfType(this,Ae),n=b.childrenOfType(this,Xe);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 y.createElement(h,null,y.createElement(o.ThemeProvider,{theme:this.getTheme()},y.createElement(bt,{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?y.createElement(mt,{style:{height:e.props.height}},y.createElement(vt,null,y.createElement(h,null,y.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 y.createElement(gt,St({key:t},r),y.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 y.createElement(Ot,{style:{direction:this.props.dir,height:o,minHeight:i,maxHeight:u}},y.createElement(h,null,this.renderTableRows(t)))}},{key:"renderTableRows",value:function(s){var p=this;return 0!==this.props.items.length&&this.hasBody(s)?y.createElement(c.a,null,function(e){var t=e.width,n=e.height;return y.createElement(l.FixedSizeList,{style:{outline:"none"},direction:p.props.dir,layout:"vertical",height:n,width:t,itemCount:p.props.items.length,itemSize:p.props.rowHeight},function(e){var t=e.index,n=e.style,r=s.props.children;if(!r)return null;var o=p.props.items[t],i=r(o,t),u=p.getRowProps(i),c=u.style,l=Pt(u,["style"]),f=p.getRowKey(l,o,t),a=p.getRowContent(i);return y.createElement(wt,St({style:Object.assign({},n,c||{}),key:f},l),y.createElement(h,null,function(e){return Array.isArray(e)?e:[e]}(a).map(function(e,t){var n=p.getCellProps(e);return!1===n.visible?null:y.createElement(jt,St({key:t},n),y.createElement(h,null,p.getCellContent(e)))})))})}):this.renderItemsPlaceHolder()}},{key:"renderItemsPlaceHolder",value:function(){return y.createElement("div",null,y.createElement("div",{style:{textAlign:"center"}},this.props.emptyMessage))}},{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=r.defaultHeight),{height:e=g(e),minHeight:t=g(t),maxHeight:n=g(n)}}},{key:"getItemId",value:function(e,t){return"function"==typeof this.props.itemId?this.props.itemId(e,t):e.id}},{key:"createHeadFromColumns",value:function(e){return y.createElement(tt,null,e.map(function(e){return b.singleChildOfType(e,xe).props.children}))}},{key:"createBodyFromColumns",value:function(e){return y.createElement(Ae,null,function(r,o){return e.map(function(e,t){var n=b.singleChildOfType(e,Oe).props.children;return n?n(r,o,t):null})})}},{key:"getHeadProps",value:function(e){return b.elementInstanceOf(e,ut)?e.props:new et}},{key:"getHeadCellProps",value:function(e){return b.elementInstanceOf(e,Ne)&&e.props||{}}},{key:"getHeadCellContent",value:function(e){return b.elementInstanceOf(e,Ne)?e.props.children:e}},{key:"hasBody",value:function(e){return!!e&&(!v(e.props.children)&&("function"==typeof e.props.children||(Array.isArray(e.props.children)?0<e.props.children.length:0<y.Children.count(e.props.children))))}},{key:"getRowProps",value:function(e){return b.elementInstanceOf(e,ut)&&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,ut)&&(t=t.props.children),Array.isArray(t)&&(t=Rt(t)),t}},{key:"getRowKey",value:function(e,t,n){if(!v(e.key))return e.key;var r=this.getItemId(t,n);return v(r)?n:r}},{key:"getCellProps",value:function(e){return b.elementInstanceOf(e,Ne)&&e.props||{}}},{key:"getCellContent",value:function(e){var t=e;return b.elementInstanceOf(t,Ne)&&(t=t.props.children),t||null}}]),r}();kt(At,"defaultHeight","35vh"),kt(At,"Head",tt),kt(At,"Body",Ae),kt(At,"Row",ut),kt(At,"Cell",Ne),kt(At,"Column",Xe),kt(At,"defaultProps",new It),n.d(t,"GridView",function(){return ye}),n.d(t,"ColumnBodyProps",function(){return ge}),n.d(t,"ColumnBody",function(){return Oe}),n.d(t,"ColumnHeadProps",function(){return Ce}),n.d(t,"ColumnHead",function(){return xe}),n.d(t,"TableBodyProps",function(){return ze}),n.d(t,"TableBody",function(){return Ae}),n.d(t,"TableCell",function(){return Ne}),n.d(t,"TableColumnProps",function(){return Ke}),n.d(t,"TableColumn",function(){return Xe}),n.d(t,"TableHeadProps",function(){return et}),n.d(t,"TableHead",function(){return tt}),n.d(t,"TableRow",function(){return ut}),n.d(t,"TableViewProps",function(){return It}),n.d(t,"TableView",function(){return At})}])}); | ||
!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 function(n){var r={};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}return o.m=n,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(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("react-scroll-sync")},function(e,t){e.exports=require("emotion-theming")},function(e,t){e.exports=require("@emotion/styled")},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 o=n(4),y=n(0),a=n(3),r=n(2),h=n.n(r),d=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 c(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 l(e){return(l=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 s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var b=function(e){function n(e){var t;return s(this,n),(t=c(this,l(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,y["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?y.createElement("span",null,"X"):void 0!==this.props.children?this.props.children:null}}]),n}();function p(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 m=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&&p(e.prototype,t),n&&p(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 y.isValidElement(e)&&e.type===y.Fragment}},{key:"addPropsToChildren",value:function(e,r){return y.Children.map(e,function(e,t){var n=r(e,t);return y.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:y.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 g(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 v(e){return null==e}function O(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=O(n),minHeight:r=O(r),maxHeight:o=O(o)}}function j(e){return g(Array(e||0).keys())}function _(e){return(_="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 P(e,t){return!t||"object"!==_(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 E=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),P(this,S(t).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)}(t,y["PureComponent"]),t}();function x(e){return(x="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 H(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 k(e,t){return!t||"object"!==x(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 R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var A="__ReactTablize__GridCell__"+function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Number.MIN_SAFE_INTEGER,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Number.MAX_SAFE_INTEGER;return Math.floor(Math.random()*(t-e+1)+e)}(0),B=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),k(this,R(t).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&&I(e,t)}(t,y["PureComponent"]),function(e,t,n){t&&T(e.prototype,t),n&&T(e,n)}(t,[{key:"render",value:function(){return this.props.children}}],[{key:"extract",value:function(e){if(e&&e.props&&e.props[A]){var t=e.props,n=t.children;return{props:H(t,["children"]),content:n}}return{props:{},content:e}}}]),t}();function F(e){return(F="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 W(e,t){return!t||"object"!==F(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 M(e){return(M=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)}z(B,"defaultProps",z({},A,!0));var q=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),W(this,M(t).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)}(t,y["PureComponent"]),t}();function L(e){return(L="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"!==L(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 G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var K=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),V(this,G(t).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&&D(e,t)}(t,y["PureComponent"]),t}(),X=n(5),J=n.n(X).a;function Q(){var e=ee(["\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 Q=function(){return e},e}function U(){var e=ee(["\n label: grid-body;\n"]);return U=function(){return e},e}function Y(){var e=ee(["\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 Y=function(){return e},e}function Z(){var e=ee(["\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 Z=function(){return e},e}function $(){var e=ee(["\n label: grid-view;\n\n width: 100%;\n"]);return $=function(){return e},e}function ee(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var te=J.div($()),ne=J.div(Z(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-right"},17,"1px solid #ddd"),re=J.div(Y()),oe=J.div(U()),ie=J.div(Q());function ue(e){return(ue="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 ce(){return(ce=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 fe(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 ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(e,t){return(pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ye(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var he=function(e){function u(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return ye(se(t=function(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?se(e):t}(this,(e=ae(u)).call.apply(e,[this].concat(r)))),"headList",y.createRef()),ye(se(t),"freezedColumnsList",y.createRef()),ye(se(t),"getColumnWidth",function(e){return"function"==typeof t.props.columnWidth?t.props.columnWidth(e):t.props.columnWidth}),ye(se(t),"getRowHeight",function(t){return function(e){return"function"==typeof t?t(e):t}}),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&&pe(e,t)}(u,y["PureComponent"]),function(e,t,n){t&&fe(e.prototype,t),n&&fe(e,n)}(u,[{key:"render",value:function(){var e=this.props,t=(e.columnCount,e.columnWidth,e.children,le(e,["columnCount","columnWidth","children"]));return y.createElement(b,null,y.createElement(o.ThemeProvider,{theme:this.getTheme()},y.createElement(a.ScrollSync,null,y.createElement(te,ce({},t,{style:Object.assign({direction:this.props.dir},this.props.style,w(t.style,u.defaultHeight))}),this.renderHead(),this.renderBody(),this.renderFooter()))))}},{key:"renderHead",value:function(){var r=this,e=m.singleChildOfType(this,K);if(!e)return null;var t=e.props,o=t.children,n=le(t,["children"]),i=this.props.freezeColumns||0;return y.createElement(ne,ce({},n,{style:Object.assign({},e.props.style,w(n.style,u.defaultHeadHeight))}),y.createElement(b,null,y.createElement(h.a,null,function(e){var t=e.width,n=e.height;return y.createElement("div",{style:{width:t,height:n,display:"flex"}},j(i).map(function(e){return r.renderHeadCell(o,e)}),y.createElement(a.ScrollSyncPane,null,y.createElement(d.VariableSizeList,{ref:r.headList,direction:r.props.dir,style:{overflow:"hidden"},layout:"horizontal",height:n,width:t-r.getFrozenColumnsWidth(),itemCount:r.props.columnCount-i,itemSize:function(e){return r.getColumnWidth(e+i)}},function(e){var t=e.index,n=e.style;return r.renderHeadCell(o,t+i,n)})))})))}},{key:"renderHeadCell",value:function(e,t,n){var r=e({columnIndex:t}),o=B.extract(r),i=o.props,u=o.content,c=this.getColumnWidth(t);return y.createElement(re,ce({key:t},i,{style:Object.assign({width:c},i.style,n)}),y.createElement(b,null,u))}},{key:"renderBody",value:function(){var o=this,e=m.singleChildOfType(this,E);if(!e)return null;var t=e.props,i=t.children,r=t.rowCount,u=t.rowHeight,n=le(t,["children","rowCount","rowHeight"]),c=this.getBodyHeights(),l=this.props.freezeColumns||0,f=this.getFrozenColumnsWidth();return y.createElement(oe,ce({},n,{style:Object.assign({},n.style,c)}),y.createElement(b,null,y.createElement(h.a,null,function(e){var t=e.height,n=e.width;return y.createElement("div",{style:{width:n,height:t,display:"flex"}},y.createElement(a.ScrollSyncPane,null,y.createElement(d.VariableSizeList,{ref:o.freezedColumnsList,style:{overflow:"hidden"},height:t-17,width:f,itemCount:r,itemSize:o.getRowHeight(u)},function(e){var t=e.index,n=e.style;return y.createElement("div",{style:n},j(l).map(function(e){return o.renderBodyCell(i,t,e)}))})),y.createElement(a.ScrollSyncPane,null,y.createElement(d.VariableSizeGrid,{direction:o.props.dir,height:t,width:n-f,columnCount:o.props.columnCount-l,columnWidth:function(e){return o.getColumnWidth(e+l)},rowCount:r,rowHeight:o.getRowHeight(u)},function(e){var t=e.rowIndex,n=e.columnIndex,r=e.style;return o.renderBodyCell(i,t,n+l,r)})))})))}},{key:"renderBodyCell",value:function(e,t,n,r){var o=e({rowIndex:t,columnIndex:n}),i=B.extract(o),u=i.props,c=i.content;return y.createElement(ie,ce({key:"[ ".concat(t,", ").concat(n," ]")},u,{style:Object.assign({},u.style,r)}),y.createElement(b,null,c))}},{key:"renderFooter",value:function(){return m.singleChildOfType(this,q)?y.createElement("span",null,"Footer"):null}},{key:"getTheme",value:function(){return{dir:this.props.dir}}},{key:"getBodyHeights",value:function(){var e,t,n=w(this.props.style,u.defaultHeight),r=this.getHeadHeight(),o=w(this.props.style,void 0),i=o.height||"calc(".concat(n.height," - ").concat(r,")");return(o.minHeight||n.minHeight)&&(e=o.minHeight||"calc(".concat(n.minHeight," - ").concat(r,")")),(o.maxHeight||n.maxHeight)&&(t=o.maxHeight||"calc(".concat(n.maxHeight," - ").concat(r,")")),{height:i,minHeight:e,maxHeight:t}}},{key:"getHeadHeight",value:function(){var e=m.singleChildOfType(this,K),t=0;return e&&(t=w(e.props.style,u.defaultHeadHeight).height),t}},{key:"getFrozenColumnsWidth",value:function(){return this.props.freezeColumns?j(this.props.freezeColumns).map(this.getColumnWidth).reduce(function(e,t){return e+t},0):0}}]),u}();function de(e){return(de="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 be(e,t){return!t||"object"!==de(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 me(e){return(me=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ge(e,t){return(ge=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")}ye(he,"defaultHeight","35vh"),ye(he,"defaultHeadHeight","40px"),ye(he,"Head",K),ye(he,"Body",E),ye(he,"Cell",B);var Oe=function e(){ve(this,e),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)},we=function(e){function t(){return ve(this,t),be(this,me(t).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&&ge(e,t)}(t,y["PureComponent"]),t}();function je(e){return(je="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(e,t){return!t||"object"!==je(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 Pe(e){return(Pe=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)}function Ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xe=function e(){Ce(this,e),Ee(this,"height","40px"),Ee(this,"children",void 0)},He=function(e){function t(){return Ce(this,t),_e(this,Pe(t).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)}(t,y["PureComponent"]),t}();function Te(e){return(Te="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 ke(e,t){return!t||"object"!==Te(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 Re(e){return(Re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ie(e,t){return(Ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ae=function e(){ze(this,e),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)},Be=function(e){function t(){return ze(this,t),ke(this,Re(t).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&&Ie(e,t)}(t,y["PureComponent"]),t}();function Fe(e){return(Fe="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 We(e,t){return!t||"object"!==Fe(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 Me(e){return(Me=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ne(e,t){return(Ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var qe=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),We(this,Me(t).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&&Ne(e,t)}(t,y["PureComponent"]),t}();function Le(e){return(Le="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 Ve(e,t){return!t||"object"!==Le(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 De(e,t){return(De=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Xe=function e(){Ke(this,e),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)},Je=function(e){function t(){return Ke(this,t),Ve(this,Ge(t).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&&De(e,t)}(t,y["PureComponent"]),t}();function Qe(e){return(Qe="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(e,t){return!t||"object"!==Qe(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 Ye(e){return(Ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ze(e,t){return(Ze=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var tt=function e(){$e(this,e),et(this,"height","40px"),et(this,"children",void 0)},nt=function(e){function t(){return $e(this,t),Ue(this,Ye(t).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&&Ze(e,t)}(t,y["PureComponent"]),t}();function rt(e){return(rt="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 ot(e,t){return!t||"object"!==rt(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 it(e){return(it=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ut(e,t){return(ut=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ct=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ot(this,it(t).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&&ut(e,t)}(t,y["PureComponent"]),t}();function lt(){var e=dt(["\n flex: 1;\n padding: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n"]);return lt=function(){return e},e}function ft(){var e=dt(["\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 ft=function(){return e},e}function at(){var e=dt(["\n display: flex;\n flex-flow: column;\n\n vertical-align: middle;\n"]);return at=function(){return e},e}function st(){var e=dt(["\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 st=function(){return e},e}function pt(){var e=dt(["\n flex: 1;\n display: flex;\n justify-content: stretch;\n\n ",": ",";\n\n border-bottom: ",";\n"]);return pt=function(){return e},e}function yt(){var e=dt(["\n display: flex;\n flex-flow: column;\n\n overflow-y: hidden;\n\n font-weight: bold;\n vertical-align: middle;\n"]);return yt=function(){return e},e}function ht(){var e=dt(["\n background-color: #fff;\n width: 100%;\n overflow-y: hidden;\n"]);return ht=function(){return e},e}function dt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var bt="1px solid #ddd",mt=J.div(ht()),gt=J.div(yt()),vt=J.div(pt(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-dir"},"17px",bt),Ot=J.div(st()),wt=J.div(at()),jt=J.div(ft(),bt),_t=J.div(lt());function Pt(e){return(Pt="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 Ct(){return(Ct=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,t){return!t||"object"!==Pt(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 Ht(e){return(Ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tt(e,t){return(Tt=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}var It=n(7),zt=function e(){kt(this,e),Rt(this,"items",void 0),Rt(this,"itemId",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,"overscanCount",20)},At=function e(){kt(this,e),Rt(this,"selectedItems",{})},Bt=function(e){function r(e){var t;return kt(this,r),(t=xt(this,Ht(r).call(this,e))).state=new At,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&&Tt(e,t)}(r,y["PureComponent"]),function(e,t,n){t&&Et(e.prototype,t),n&&Et(e,n)}(r,[{key:"render",value:function(){var e=m.singleChildOfType(this,nt),t=m.singleChildOfType(this,Be),n=m.childrenOfType(this,Je);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 y.createElement(b,null,y.createElement(o.ThemeProvider,{theme:this.getTheme()},y.createElement(mt,{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?y.createElement(gt,{style:{height:e.props.height}},y.createElement(vt,null,y.createElement(b,null,y.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 y.createElement(Ot,Ct({key:t},r),y.createElement(b,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 y.createElement(wt,{style:{direction:this.props.dir,height:o,minHeight:i,maxHeight:u}},y.createElement(b,null,this.renderTableRows(t)))}},{key:"renderTableRows",value:function(s){var p=this;return 0!==this.props.items.length&&this.hasBody(s)?y.createElement(h.a,null,function(e){var t=e.width,n=e.height;return y.createElement(d.FixedSizeList,{style:{outline:"none"},direction:p.props.dir,layout:"vertical",height:n,width:t,itemCount:p.props.items.length,itemSize:p.props.rowHeight},function(e){var t=e.index,n=e.style,r=s.props.children;if(!r)return null;var o=p.props.items[t],i=r(o,t),u=p.getRowProps(i),c=u.style,l=St(u,["style"]),f=p.getRowKey(l,o,t),a=p.getRowContent(i);return y.createElement(jt,Ct({style:Object.assign({},n,c||{}),key:f},l),y.createElement(b,null,function(e){return Array.isArray(e)?e:[e]}(a).map(function(e,t){var n=p.getCellProps(e);return!1===n.visible?null:y.createElement(_t,Ct({key:t},n),y.createElement(b,null,p.getCellContent(e)))})))})}):this.renderItemsPlaceHolder()}},{key:"renderItemsPlaceHolder",value:function(){return y.createElement("div",null,y.createElement("div",{style:{textAlign:"center"}},this.props.emptyMessage))}},{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=r.defaultHeight),{height:e=O(e),minHeight:t=O(t),maxHeight:n=O(n)}}},{key:"getItemId",value:function(e,t){return"function"==typeof this.props.itemId?this.props.itemId(e,t):e.id}},{key:"createHeadFromColumns",value:function(e){return y.createElement(nt,null,e.map(function(e){return m.singleChildOfType(e,He).props.children}))}},{key:"createBodyFromColumns",value:function(e){return y.createElement(Be,null,function(r,o){return e.map(function(e,t){var n=m.singleChildOfType(e,we).props.children;return n?n(r,o,t):null})})}},{key:"getHeadProps",value:function(e){return m.elementInstanceOf(e,ct)?e.props:new tt}},{key:"getHeadCellProps",value:function(e){return m.elementInstanceOf(e,qe)&&e.props||{}}},{key:"getHeadCellContent",value:function(e){return m.elementInstanceOf(e,qe)?e.props.children:e}},{key:"hasBody",value:function(e){return!!e&&(!v(e.props.children)&&("function"==typeof e.props.children||(Array.isArray(e.props.children)?0<e.props.children.length:0<y.Children.count(e.props.children))))}},{key:"getRowProps",value:function(e){return m.elementInstanceOf(e,ct)&&e.props||{}}},{key:"getRowContent",value:function(e){var t=e;if(m.isReactFragment(t))throw new Error("Can not use React.Fragment as row content. Consider wrapping your content with a row element.");return m.elementInstanceOf(t,ct)&&(t=t.props.children),Array.isArray(t)&&(t=It(t)),t}},{key:"getRowKey",value:function(e,t,n){if(!v(e.key))return e.key;var r=this.getItemId(t,n);return v(r)?n:r}},{key:"getCellProps",value:function(e){return m.elementInstanceOf(e,qe)&&e.props||{}}},{key:"getCellContent",value:function(e){var t=e;return m.elementInstanceOf(t,qe)&&(t=t.props.children),t||null}}]),r}();Rt(Bt,"defaultHeight","35vh"),Rt(Bt,"Head",nt),Rt(Bt,"Body",Be),Rt(Bt,"Row",ct),Rt(Bt,"Cell",qe),Rt(Bt,"Column",Je),Rt(Bt,"defaultProps",new zt),n.d(t,"GridView",function(){return he}),n.d(t,"ColumnBodyProps",function(){return Oe}),n.d(t,"ColumnBody",function(){return we}),n.d(t,"ColumnHeadProps",function(){return xe}),n.d(t,"ColumnHead",function(){return He}),n.d(t,"TableBodyProps",function(){return Ae}),n.d(t,"TableBody",function(){return Be}),n.d(t,"TableCell",function(){return qe}),n.d(t,"TableColumnProps",function(){return Xe}),n.d(t,"TableColumn",function(){return Je}),n.d(t,"TableHeadProps",function(){return tt}),n.d(t,"TableHead",function(){return nt}),n.d(t,"TableRow",function(){return ct}),n.d(t,"TableViewProps",function(){return zt}),n.d(t,"TableView",function(){return Bt})}])}); |
{ | ||
"name": "react-tablize", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "React virtual table component", | ||
@@ -33,2 +33,3 @@ "author": "Alon Bar", | ||
"react-dom": "^16.8.6", | ||
"react-scroll-sync": "0.7.0", | ||
"react-virtualized-auto-sizer": "^1.0.2", | ||
@@ -35,0 +36,0 @@ "react-window": "^1.8.1" |
@@ -14,8 +14,2 @@ | ||
type Id = any; | ||
interface IIdentifiable { | ||
id: Id; | ||
} | ||
type DocDir = 'ltr' | 'rtl'; | ||
@@ -27,2 +21,4 @@ | ||
maxHeight: string | number; | ||
} | ||
} | ||
type SizeCallback = (index: number) => number; |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
248254
2557
7
+ Addedreact-scroll-sync@0.7.0
+ Addedreact-scroll-sync@0.7.0(transitive)