react-tablize
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -5,6 +5,16 @@ # React Tablize - Change Log | ||
## [0.2.0 - 2019-17-04](https://github.com/alonrbar/react-tablize/tree/v0.2.0) | ||
## [0.3.0 - 2019-05-08](https://github.com/alonrbar/react-tablize/tree/v0.3.0) | ||
### Added | ||
- GridView. | ||
### Fixed | ||
- Div props typing | ||
## [0.2.0 - 2019-04-17](https://github.com/alonrbar/react-tablize/tree/v0.2.0) | ||
### Added | ||
- Standard div props support | ||
@@ -16,3 +26,3 @@ | ||
## [0.1.0 - 2019-16-04](https://github.com/alonrbar/react-tablize/tree/v0.1.0) | ||
## [0.1.0 - 2019-04-16](https://github.com/alonrbar/react-tablize/tree/v0.1.0) | ||
@@ -19,0 +29,0 @@ First version |
import * as React from 'react'; | ||
// --------------------- // | ||
// TableView // | ||
// --------------------- // | ||
// | ||
@@ -30,3 +34,3 @@ // table head | ||
export interface TableRowProps<T> extends React.DivProps { | ||
export interface TableRowProps<T> extends DivProps { | ||
children?: RowContent<T>; | ||
@@ -45,3 +49,3 @@ } | ||
export interface TableCellProps<T> extends React.DivProps { | ||
export interface TableCellProps<T> extends DivProps { | ||
children?: CellContent; | ||
@@ -118,6 +122,94 @@ visible?: boolean; | ||
// -------------------- // | ||
// GridView // | ||
// -------------------- // | ||
// | ||
// misc | ||
// grid head | ||
// | ||
export type HeadCellRender = (columnIndex: number) => React.ReactNode; | ||
export interface GridHeadProps extends React.DivProps { | ||
children?: HeadCellRender; | ||
} | ||
export class GridHead extends React.PureComponent<GridHeadProps> { } | ||
// | ||
// grid body | ||
// | ||
export type BodyCellRender = (rowIndex: number, columnIndex: number) => React.ReactNode; | ||
export interface GridBodyProps extends React.DivProps { | ||
children?: BodyCellRender; | ||
} | ||
export class GridBody extends React.PureComponent<GridBodyProps> { } | ||
// | ||
// grid footer | ||
// | ||
// TODO... | ||
// | ||
// grid cell | ||
// | ||
export interface GridCellExtractResult { | ||
props: GridCellProps; | ||
content: React.ReactNode; | ||
} | ||
export interface GridCellProps extends React.DivProps { | ||
} | ||
export class GridCell extends React.PureComponent<GridCellProps> { | ||
public static extract(cell: any): GridCellExtractResult; | ||
} | ||
// | ||
// grid view | ||
// | ||
type FullSyntaxChildren = [React.SubComp<GridHead>, React.SubComp<GridBody>]; | ||
type GridChildren = FullSyntaxChildren | BodyCellRender; | ||
export interface GridViewProps extends React.DivProps { | ||
columnCount: number; | ||
columnWidth: number; | ||
freezeColumns?: number; | ||
rowCount: number; | ||
rowHeight: number; | ||
dir?: DocDir; | ||
children?: GridChildren; | ||
} | ||
export class GridView extends React.PureComponent<GridViewProps, GridViewState> { | ||
public static readonly defaultHeight = '35vh'; | ||
public static readonly defaultHeadHeight = '40px'; | ||
// | ||
// nested types | ||
// | ||
public static Head = GridHead; | ||
public static Body = GridBody; | ||
// TODO: public static Footer = GridFooter; | ||
public static Cell = GridCell; | ||
} | ||
// ----------------- // | ||
// misc // | ||
// ----------------- // | ||
type SubComp<T> = T extends React.Component<infer P> ? React.ReactElement<P, any> : never; | ||
@@ -124,0 +216,0 @@ |
@@ -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("emotion-theming")},function(e,t){e.exports=require("react-virtualized-auto-sizer")},function(e,t){e.exports=require("react-window")},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 y=n(0);function r(e){return(r="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 o(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 i(e,t){return!t||"object"!==r(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 u(e){return(u=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)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var f=function e(){l(this,e)},a=function(e){function t(){return l(this,t),i(this,u(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"]),function(e,t,n){t&&o(e.prototype,t),n&&o(e,n)}(t,[{key:"render",value:function(){return y.createElement("h1",null,"Hi!")}}]),t}();function p(e){return(p="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 s(e,t){return!t||"object"!==p(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 h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var m=function e(){d(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)},v=function(e){function t(){return d(this,t),s(this,h(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&&b(e,t)}(t,y["PureComponent"]),t}();function g(e){return(g="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 O(e,t){return!t||"object"!==g(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 j(e,t){return(j=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")}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=function e(){P(this,e),_(this,"height","40px"),_(this,"children",void 0)},C=function(e){function t(){return P(this,t),O(this,w(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&&j(e,t)}(t,y["PureComponent"]),t}();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){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 T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var R=function e(){H(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)},I=function(e){function t(){return H(this,t),x(this,T(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&&k(e,t)}(t,y["PureComponent"]),t}();function A(e){return(A="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 B(e,t){return!t||"object"!==A(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 F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}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),B(this,F(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&&z(e,t)}(t,y["PureComponent"]),t}();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 N(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 V(e){return(V=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)}function G(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var K=function e(){G(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)},L=function(e){function t(){return G(this,t),N(this,V(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}();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 J(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 Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Y(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=function e(){W(this,e),Y(this,"height","40px"),Y(this,"children",void 0)},$=function(e){function t(){return W(this,t),J(this,Q(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&&U(e,t)}(t,y["PureComponent"]),t}();function ee(e){return(ee="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 te(e,t){return!t||"object"!==ee(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 ne(e){return(ne=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)}var oe=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),te(this,ne(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}(),ie=n(1),ue=n(2),ce=n.n(ue),le=n(3);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 ae(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 pe(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 se(e){return(se=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 he(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var be=function(e){function n(e){var t;return he(this,n),(t=pe(this,se(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&&ye(e,t)}(n,y["Component"]),function(e,t,n){t&&ae(e.prototype,t),n&&ae(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 de(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 me=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&&de(e.prototype,t),n&&de(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 ve(e){return null==e}function ge(e){return Number.isFinite(e)?e+"px":e}var Oe=n(4),we=n.n(Oe).a;function je(){var e=Te(["\n flex: 1;\n padding: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n"]);return je=function(){return e},e}function Pe(){var e=Te(["\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 Pe=function(){return e},e}function _e(){var e=Te(["\n display: flex;\n flex-flow: column;\n\n vertical-align: middle;\n"]);return _e=function(){return e},e}function Se(){var e=Te(["\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 Se=function(){return e},e}function Ce(){var e=Te(["\n flex: 1;\n display: flex;\n justify-content: stretch;\n\n ",": ",";\n\n border-bottom: ",";\n"]);return Ce=function(){return e},e}function Ee(){var e=Te(["\n display: flex;\n flex-flow: column;\n\n overflow-y: hidden;\n\n font-weight: bold;\n vertical-align: middle;\n"]);return Ee=function(){return e},e}function xe(){var e=Te(["\n background-color: #fff;\n width: 100%;\n overflow-y: hidden;\n"]);return xe=function(){return e},e}function Te(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ke="1px solid #ddd",He=we.div(xe()),Re=we.div(Ee()),Ie=we.div(Ce(),function(e){return"rtl"===e.theme.dir?"padding-left":"padding-dir"},"17px",ke),Ae=we.div(Se()),Be=we.div(_e()),Fe=we.div(Pe(),ke),ze=we.div(je());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 Me(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 Ne(){return(Ne=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 Ve(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 De(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 Ge(e){return(Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ke(e,t){return(Ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Je=n(6),Qe=function e(){Le(this,e),Xe(this,"items",void 0),Xe(this,"itemId",void 0),Xe(this,"children",void 0),Xe(this,"dir","ltr"),Xe(this,"className",void 0),Xe(this,"style",void 0),Xe(this,"rowHeight",50),Xe(this,"emptyMessage","No Items to Display"),Xe(this,"overscanCount",20)},Ue=function e(){Le(this,e),Xe(this,"selectedItems",{})},We=function(e){function r(e){var t;return Le(this,r),(t=De(this,Ge(r).call(this,e))).state=new Ue,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&&Ke(e,t)}(r,y["PureComponent"]),function(e,t,n){t&&Ve(e.prototype,t),n&&Ve(e,n)}(r,[{key:"render",value:function(){var e=me.singleChildOfType(this,$),t=me.singleChildOfType(this,I),n=me.childrenOfType(this,L);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(be,null,y.createElement(ie.ThemeProvider,{theme:this.getTheme()},y.createElement(He,{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(Re,{style:{height:e.props.height}},y.createElement(Ie,null,y.createElement(be,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(Ae,Ne({key:t},r),y.createElement(be,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(Be,{style:{direction:this.props.dir,height:o,minHeight:i,maxHeight:u}},y.createElement(be,null,this.renderTableRows(t)))}},{key:"renderTableRows",value:function(p){var s=this;return 0!==this.props.items.length&&this.hasBody(p)?y.createElement(ce.a,null,function(e){var t=e.width,n=e.height;return y.createElement(le.FixedSizeList,{style:{outline:"none"},direction:s.props.dir,layout:"vertical",height:n,width:t,itemCount:s.props.items.length,itemSize:s.props.rowHeight},function(e){var t=e.index,n=e.style,r=p.props.children;if(!r)return null;var o=s.props.items[t],i=r(o,t),u=s.getRowProps(i),c=u.style,l=Me(u,["style"]),f=s.getRowKey(l,o,t),a=s.getRowContent(i);return y.createElement(Fe,Ne({style:Object.assign({},n,c||{}),key:f},l),y.createElement(be,null,function(e){return Array.isArray(e)?e:[e]}(a).map(function(e,t){var n=s.getCellProps(e);return!1===n.visible?null:y.createElement(ze,Ne({key:t},n),y.createElement(be,null,s.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=ge(e),minHeight:t=ge(t),maxHeight:n=ge(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($,null,e.map(function(e){return me.singleChildOfType(e,C).props.children}))}},{key:"createBodyFromColumns",value:function(e){return y.createElement(I,null,function(r,o){return e.map(function(e,t){var n=me.singleChildOfType(e,v).props.children;return n?n(r,o,t):null})})}},{key:"getHeadProps",value:function(e){return me.elementInstanceOf(e,oe)?e.props:new Z}},{key:"getHeadCellProps",value:function(e){return me.elementInstanceOf(e,q)&&e.props||{}}},{key:"getHeadCellContent",value:function(e){return me.elementInstanceOf(e,q)?e.props.children:e}},{key:"hasBody",value:function(e){return!!e&&(!ve(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 me.elementInstanceOf(e,oe)&&e.props||{}}},{key:"getRowContent",value:function(e){var t=e;if(me.isReactFragment(t))throw new Error("Can not use React.Fragment as row content. Consider wrapping your content with a row element.");return me.elementInstanceOf(t,oe)&&(t=t.props.children),Array.isArray(t)&&(t=Je(t)),t}},{key:"getRowKey",value:function(e,t,n){if(!ve(e.key))return e.key;var r=this.getItemId(t,n);return ve(r)?n:r}},{key:"getCellProps",value:function(e){return me.elementInstanceOf(e,q)&&e.props||{}}},{key:"getCellContent",value:function(e){var t=e;return me.elementInstanceOf(t,q)&&(t=t.props.children),t||null}}]),r}();Xe(We,"defaultHeight","35vh"),Xe(We,"Head",$),Xe(We,"Body",I),Xe(We,"Row",oe),Xe(We,"Cell",q),Xe(We,"Column",L),Xe(We,"defaultProps",new Qe),n.d(t,"GridViewProps",function(){return f}),n.d(t,"GridView",function(){return a}),n.d(t,"ColumnBodyProps",function(){return m}),n.d(t,"ColumnBody",function(){return v}),n.d(t,"ColumnHeadProps",function(){return S}),n.d(t,"ColumnHead",function(){return C}),n.d(t,"TableBodyProps",function(){return R}),n.d(t,"TableBody",function(){return I}),n.d(t,"TableCell",function(){return q}),n.d(t,"TableColumnProps",function(){return K}),n.d(t,"TableColumn",function(){return L}),n.d(t,"TableHeadProps",function(){return Z}),n.d(t,"TableHead",function(){return $}),n.d(t,"TableRow",function(){return oe}),n.d(t,"TableViewProps",function(){return Qe}),n.d(t,"TableView",function(){return We})}])}); | ||
!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})}])}); |
{ | ||
"name": "react-tablize", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "React virtual table component", | ||
@@ -24,7 +24,4 @@ "author": "Alon Bar", | ||
"dev": "webpack --config webpack.dev.js --watch", | ||
"typecheck": "tsc --watch", | ||
"typecheck": "cd src && tsc --watch && cd..", | ||
"lint": "eslint \"./{src,test}/**/!(*.d).ts\"", | ||
"lint-fix": "yarn lint --fix", | ||
"test": "mocha-webpack --require source-map-support/register --webpack-config webpack.test.js \"test/**/*.tests.ts\"", | ||
"test-watch": "yarn test --watch", | ||
"release": "yarn lint && webpack --config webpack.dev.js && webpack --config webpack.release.js" | ||
@@ -38,32 +35,31 @@ }, | ||
"react-virtualized-auto-sizer": "^1.0.2", | ||
"react-window": "^1.7.2" | ||
"react-window": "^1.8.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.4.3", | ||
"@babel/plugin-proposal-class-properties": "7.4.0", | ||
"@babel/plugin-proposal-object-rest-spread": "7.4.3", | ||
"@babel/preset-env": "7.4.3", | ||
"@babel/core": "7.4.4", | ||
"@babel/plugin-proposal-class-properties": "7.4.4", | ||
"@babel/plugin-proposal-object-rest-spread": "7.4.4", | ||
"@babel/preset-env": "7.4.4", | ||
"@babel/preset-react": "7.0.0", | ||
"@babel/preset-typescript": "7.3.3", | ||
"@storybook/react": "5.0.6", | ||
"@types/classnames": "^2.2.7", | ||
"@types/react": "16.8.13", | ||
"@types/react-dom": "16.8.3", | ||
"@storybook/react": "5.0.11", | ||
"@types/react": "16.8.17", | ||
"@types/react-dom": "16.8.4", | ||
"@types/react-virtualized-auto-sizer": "1.0.0", | ||
"@types/react-window": "1.7.1", | ||
"@types/react-window": "1.8.0", | ||
"@types/storybook__react": "4.0.1", | ||
"@types/webpack-env": "1.13.9", | ||
"@typescript-eslint/eslint-plugin": "1.6.0", | ||
"@typescript-eslint/parser": "1.6.0", | ||
"@typescript-eslint/eslint-plugin": "1.7.0", | ||
"@typescript-eslint/parser": "1.7.0", | ||
"babel-loader": "8.0.5", | ||
"babel-plugin-emotion": "10.0.9", | ||
"eslint": "5.16.0", | ||
"eslint-plugin-react": "7.12.4", | ||
"typescript": "3.4.3", | ||
"eslint-plugin-react": "7.13.0", | ||
"typescript": "3.4.5", | ||
"uglifyjs-webpack-plugin": "2.1.2", | ||
"webpack": "4.29.6", | ||
"webpack-cli": "3.3.0", | ||
"webpack": "4.30.0", | ||
"webpack-cli": "3.3.2", | ||
"webpack-merge": "4.2.1", | ||
"webpack-node-externals": "1.7.2" | ||
} | ||
} | ||
} |
@@ -20,2 +20,8 @@ | ||
type DocDir = 'ltr' | 'rtl'; | ||
type DocDir = 'ltr' | 'rtl'; | ||
interface Heights { | ||
height: string | number; | ||
minHeight: string | number; | ||
maxHeight: string | number; | ||
} |
@@ -17,2 +17,33 @@ | ||
return size; | ||
} | ||
export function getHeights(style: React.CSSProperties, defaultHeight: number | string): Heights { | ||
style = style || {}; | ||
let height = style.height; | ||
let minHeight = style.minHeight; | ||
let maxHeight = style.maxHeight; | ||
if (height === undefined && minHeight === undefined) { | ||
height = defaultHeight; | ||
} | ||
height = cssSizeString(height); | ||
minHeight = cssSizeString(minHeight); | ||
maxHeight = cssSizeString(maxHeight); | ||
return { | ||
height, | ||
minHeight, | ||
maxHeight | ||
}; | ||
} | ||
export function randomInt(min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER): number { | ||
return Math.floor(Math.random() * (max - min + 1) + min); | ||
} | ||
export function range(count: number): number[] { | ||
// https://stackoverflow.com/questions/3895478/does-javascript-have-a-method-like-range-to-generate-a-range-within-the-supp | ||
return [...Array(count || 0).keys()]; | ||
} |
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
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
241781
25
34
2488
Updatedreact-window@^1.8.1