diff --git a/.gitignore b/.gitignore index dc28ea22..de517881 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ internal docs/api dist *.swp +.idea/ \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..f19c9629 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +@buildingconnected:registry=https://registry.npmjs.org/ +//registry.npmjs.org/:_authToken=${NPM_TOKEN} diff --git a/README.md b/README.md index 5e717f71..5a8a88dd 100644 --- a/README.md +++ b/README.md @@ -1,98 +1,20 @@ -Fixed Data Tables for React -==================================== +# Why is there a fork of Facebook's [fixed-data-table](https://github.com/facebook/fixed-data-table/pull/331)? -FixedDataTable is a React component for building and presenting data in a flexible, powerful way. It supports standard table features, like headers, columns, rows, header groupings, and both fixed-position and scrolling columns. +There's a [scroll bug](https://github.com/facebook/fixed-data-table/issues/330) in Fixed Data Table that's causing a [user facing scroll bug](https://github.com/BuildingConnected/client/pull/180#issuecomment-163759904) in the project table. -The table was designed to handle thousands of rows of data without sacrificing performance. Scrolling smoothly is a first-class goal of FixedDataTable and it's architected in a way to allow for flexibility and extensibility. +Until Al's [PR](https://github.com/facebook/fixed-data-table/pull/331) is accepted or this underlying bug is fixed, use this fork. -Features of FixedDataTable: -* Fixed headers and footer -* Both fixed and scrollable columns -* Handling huge amounts of data -* Variable row heights (with adaptive scroll positions) -* Column resizing -* Performant scrolling -* Customizable styling -* Jumping to a row or column -* Controlled scroll API allows touch support +## Local Testing -Things the FixedDataTable **doesn't** do: -* FixedDataTable does not provide a layout reflow mechanism or calculate content layout information such as width and height of the cell contents. The developer has to provide the layout information to the table instead. -* FixedDataTable does not handle sorting of data. Instead it allows the developer to supply data getters that can be sort-, filter-, or tail-loading-aware. -* FixedDataTable does not fetch the data (see above) +To test changes locally without publishing to npm you can run the following +command -Getting started ---------------- - -Install `fixed-data-table` using npm. - -```shell -npm install fixed-data-table ``` -Add the default stylesheet `dist/fixed-data-table.css`, then import it into any module. - -### Basic Example - -```javascript -import React from 'react'; -import ReactDOM from 'react-dom'; -import {Table, Column, Cell} from 'fixed-data-table'; - -// Table data as a list of array. -const rows = [ - ['a1', 'b1', 'c1'], - ['a2', 'b2', 'c2'], - ['a3', 'b3', 'c3'], - // .... and more -]; - -// Render your table -ReactDOM.render( - - Col 1} - cell={Column 1 static content} - width={2000} - /> - Col 2} - cell={} - width={1000} - /> - Col 3} - cell={({rowIndex, ...props}) => ( - - Data for column 3: {rows[rowIndex][2]} - - )} - width={2000} - /> -
, - document.getElementById('example') -); +npm run build-move ``` -Contributions ------------- - -Use [GitHub issues](https://github.com/facebook/fixed-data-table/issues) for requests. - -We actively welcome pull requests; learn how to [contribute](https://github.com/facebook/fixed-data-table/blob/master/CONTRIBUTING.md). +## Publishing to NPM - -Changelog ---------- - -Changes are tracked as [GitHub releases](https://github.com/facebook/fixed-data-table/releases). - - -License -------- - -`FixedDataTable` is [BSD-licensed](https://github.com/facebook/fixed-data-table/blob/master/LICENSE). We also provide an additional [patent grant](https://github.com/facebook/fixed-data-table/blob/master/PATENTS). +``` +npm run publish-package +``` diff --git a/build_helpers/buildMove.sh b/build_helpers/buildMove.sh new file mode 100755 index 00000000..5413ccd5 --- /dev/null +++ b/build_helpers/buildMove.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +client='../client/node_modules/@buildingconnected/fixed-data-table' + +rm -rf $client/internal +cp -r internal $client diff --git a/build_helpers/buildNPMInternals.sh b/build_helpers/buildNPMInternals.sh index 8ad0e19f..4c198d96 100755 --- a/build_helpers/buildNPMInternals.sh +++ b/build_helpers/buildNPMInternals.sh @@ -2,47 +2,48 @@ // -*- mode: js -*- "use strict"; -var glob = require('glob'); -var path = require('path'); -var fs = require('fs'); -var babel = require('babel-core'); +var glob = require("glob"); +var path = require("path"); +var fs = require("fs"); +var babel = require("babel-core"); -var internalPath = path.join(__dirname, '../internal'); +var internalPath = path.join(__dirname, "../internal"); if (!fs.existsSync(internalPath)) { fs.mkdirSync(internalPath); } var providesModuleRegex = /@providesModule ([^\s*]+)/; var moduleRequireRegex = /=\s+require\((?:'|")([\w\.\/]+)(?:'|")\);/gm; -var excludePathRegex = /^react($|\/)/; +var excludePathRegex = /^react($|\/)|lodash/; var findDEVRegex = /__DEV__/g; function replaceRequirePath(match, modulePath) { var path = modulePath; if (!excludePathRegex.test(path)) { - path = './' + path; + path = "./" + path; } - return '= require(\'' + path + '\');'; + return "= require('" + path + "');"; } -var babelConf = JSON.parse( - fs.readFileSync('.babelrc', {encoding: 'utf8'}) -); +var babelConf = JSON.parse(fs.readFileSync(".babelrc", { encoding: "utf8" })); function processFile(fileName) { - var contents = fs.readFileSync(fileName, {encoding: 'utf8'}); + var contents = fs.readFileSync(fileName, { encoding: "utf8" }); var providesModule = providesModuleRegex.exec(contents); if (providesModule) { contents = babel.transform(contents, babelConf).code; contents = contents.replace(moduleRequireRegex, replaceRequirePath); - contents = contents.replace(findDEVRegex, 'process.env.NODE_ENV !== \'production\''); + contents = contents.replace( + findDEVRegex, + "process.env.NODE_ENV !== 'production'" + ); fs.writeFileSync( - path.join(internalPath, providesModule[1] + '.js'), + path.join(internalPath, providesModule[1] + ".js"), contents ); } } -glob.sync(path.join(__dirname, '../src/**/*.js')).forEach(processFile); +glob.sync(path.join(__dirname, "../src/**/*.js")).forEach(processFile); diff --git a/dist/fixed-data-table-base.css b/dist/fixed-data-table-base.css index 292ba6d0..7e09c365 100644 --- a/dist/fixed-data-table-base.css +++ b/dist/fixed-data-table-base.css @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -9,107 +9,6 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -/** - * Copyright (c) 2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ScrollbarLayout - */ - -.ScrollbarLayout_main { - box-sizing: border-box; - outline: none; - overflow: hidden; - position: absolute; - -webkit-transition-duration: 250ms; - transition-duration: 250ms; - -webkit-transition-timing-function: ease; - transition-timing-function: ease; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.ScrollbarLayout_mainVertical { - bottom: 0; - right: 0; - top: 0; - -webkit-transition-property: background-color width; - transition-property: background-color width; - width: 15px; -} - -.ScrollbarLayout_mainVertical.public_Scrollbar_mainActive, -.ScrollbarLayout_mainVertical:hover { - width: 17px; -} - -.ScrollbarLayout_mainHorizontal { - bottom: 0; - height: 15px; - left: 0; - -webkit-transition-property: background-color height; - transition-property: background-color height; -} - -/* Touching the scroll-track directly makes the scroll-track bolder */ -.ScrollbarLayout_mainHorizontal.public_Scrollbar_mainActive, -.ScrollbarLayout_mainHorizontal:hover { - height: 17px; -} - -.ScrollbarLayout_face { - left: 0; - overflow: hidden; - position: absolute; - z-index: 1; -} - -/** - * This selector renders the "nub" of the scrollface. The nub must - * be rendered as pseudo-element so that it won't receive any UI events then - * we can get the correct `event.offsetX` and `event.offsetY` from the - * scrollface element while dragging it. - */ -.ScrollbarLayout_face:after { - border-radius: 6px; - content: ''; - display: block; - position: absolute; - -webkit-transition: background-color 250ms ease; - transition: background-color 250ms ease; -} - -.ScrollbarLayout_faceHorizontal { - bottom: 0; - left: 0; - top: 0; -} - -.ScrollbarLayout_faceHorizontal:after { - bottom: 4px; - left: 0; - top: 4px; - width: 100%; -} - -.ScrollbarLayout_faceVertical { - left: 0; - right: 0; - top: 0; -} - -.ScrollbarLayout_faceVertical:after { - height: 100%; - left: 4px; - right: 4px; - top: 0; -} /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -122,8 +21,7 @@ */ .fixedDataTableCellGroupLayout_cellGroup { - -webkit-backface-visibility: hidden; - backface-visibility: hidden; + backface-visibility: hidden; left: 0; overflow: hidden; position: absolute; @@ -196,18 +94,13 @@ } .fixedDataTableCellLayout_columnResizerContainer:hover { - cursor: ew-resize; -} - -.fixedDataTableCellLayout_columnResizerContainer:hover .fixedDataTableCellLayout_columnResizerKnob { - visibility: visible; + cursor: col-resize; } .fixedDataTableCellLayout_columnResizerKnob { position: absolute; right: 0px; - visibility: hidden; - width: 4px; + width: 1px; } /** * Copyright (c) 2015, Facebook, Inc. @@ -221,7 +114,7 @@ */ .fixedDataTableColumnResizerLineLayout_mouseArea { - cursor: ew-resize; + cursor: col-resize; position: absolute; right: -5px; width: 12px; @@ -323,8 +216,7 @@ body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main { } .fixedDataTableRowLayout_fixedColumnsDivider { - -webkit-backface-visibility: hidden; - backface-visibility: hidden; + backface-visibility: hidden; border-left-style: solid; border-left-width: 1px; left: 0; @@ -341,3 +233,99 @@ body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main { position: absolute; top: 0; } +/** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ScrollbarLayout + */ + +.ScrollbarLayout_main { + box-sizing: border-box; + outline: none; + overflow: hidden; + position: absolute; + transition-duration: 250ms; + transition-timing-function: ease; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.ScrollbarLayout_mainVertical { + bottom: 0; + right: 0; + top: 0; + transition-property: background-color width; + width: 15px; +} + +.ScrollbarLayout_mainVertical.public_Scrollbar_mainActive, +.ScrollbarLayout_mainVertical:hover { + width: 17px; +} + +.ScrollbarLayout_mainHorizontal { + bottom: 0; + height: 15px; + left: 0; + transition-property: background-color height; +} + +/* Touching the scroll-track directly makes the scroll-track bolder */ +.ScrollbarLayout_mainHorizontal.public_Scrollbar_mainActive, +.ScrollbarLayout_mainHorizontal:hover { + height: 17px; +} + +.ScrollbarLayout_face { + left: 0; + overflow: hidden; + position: absolute; + z-index: 1; +} + +/** + * This selector renders the "nub" of the scrollface. The nub must + * be rendered as pseudo-element so that it won't receive any UI events then + * we can get the correct `event.offsetX` and `event.offsetY` from the + * scrollface element while dragging it. + */ +.ScrollbarLayout_face:after { + border-radius: 6px; + content: ''; + display: block; + position: absolute; + transition: background-color 250ms ease; +} + +.ScrollbarLayout_faceHorizontal { + bottom: 0; + left: 0; + top: 0; +} + +.ScrollbarLayout_faceHorizontal:after { + bottom: 4px; + left: 0; + top: 4px; + width: 100%; +} + +.ScrollbarLayout_faceVertical { + left: 0; + right: 0; + top: 0; +} + +.ScrollbarLayout_faceVertical:after { + height: 100%; + left: 4px; + right: 4px; + top: 0; +} diff --git a/dist/fixed-data-table-base.min.css b/dist/fixed-data-table-base.min.css index 342396eb..5350aa77 100644 --- a/dist/fixed-data-table-base.min.css +++ b/dist/fixed-data-table-base.min.css @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -9,4 +9,4 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -.ScrollbarLayout_main{box-sizing:border-box;outline:none;overflow:hidden;position:absolute;-webkit-transition-duration:250ms;transition-duration:250ms;-webkit-transition-timing-function:ease;transition-timing-function:ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ScrollbarLayout_mainVertical{bottom:0;right:0;top:0;-webkit-transition-property:background-color width;transition-property:background-color width;width:15px}.ScrollbarLayout_mainVertical.public_Scrollbar_mainActive,.ScrollbarLayout_mainVertical:hover{width:17px}.ScrollbarLayout_mainHorizontal{bottom:0;height:15px;left:0;-webkit-transition-property:background-color height;transition-property:background-color height}.ScrollbarLayout_mainHorizontal.public_Scrollbar_mainActive,.ScrollbarLayout_mainHorizontal:hover{height:17px}.ScrollbarLayout_face{left:0;overflow:hidden;position:absolute;z-index:1}.ScrollbarLayout_face:after{border-radius:6px;content:'';display:block;position:absolute;-webkit-transition:background-color 250ms ease;transition:background-color 250ms ease}.ScrollbarLayout_faceHorizontal{bottom:0;left:0;top:0}.ScrollbarLayout_faceHorizontal:after{bottom:4px;left:0;top:4px;width:100%}.ScrollbarLayout_faceVertical{left:0;right:0;top:0}.ScrollbarLayout_faceVertical:after{height:100%;left:4px;right:4px;top:0}.fixedDataTableCellGroupLayout_cellGroup{-webkit-backface-visibility:hidden;backface-visibility:hidden;left:0;overflow:hidden;position:absolute;top:0;white-space:nowrap}.fixedDataTableCellGroupLayout_cellGroup>.public_fixedDataTableCell_main{display:inline-block;vertical-align:top;white-space:normal}.fixedDataTableCellGroupLayout_cellGroupWrapper{position:absolute;top:0}.fixedDataTableCellLayout_main{border-right-style:solid;border-width:0 1px 0 0;box-sizing:border-box;display:block;overflow:hidden;position:absolute;white-space:normal}.fixedDataTableCellLayout_lastChild{border-width:0 1px 1px 0}.fixedDataTableCellLayout_alignRight{text-align:right}.fixedDataTableCellLayout_alignCenter{text-align:center}.fixedDataTableCellLayout_wrap1{display:table}.fixedDataTableCellLayout_wrap2{display:table-row}.fixedDataTableCellLayout_wrap3{display:table-cell;vertical-align:middle}.fixedDataTableCellLayout_columnResizerContainer{position:absolute;right:0;width:6px;z-index:1}.fixedDataTableCellLayout_columnResizerContainer:hover{cursor:ew-resize}.fixedDataTableCellLayout_columnResizerContainer:hover .fixedDataTableCellLayout_columnResizerKnob{visibility:visible}.fixedDataTableCellLayout_columnResizerKnob{position:absolute;right:0;visibility:hidden;width:4px}.fixedDataTableColumnResizerLineLayout_mouseArea{cursor:ew-resize;position:absolute;right:-5px;width:12px}.fixedDataTableColumnResizerLineLayout_main{border-right-style:solid;border-right-width:1px;box-sizing:border-box;position:absolute;z-index:10}body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main,.fixedDataTableColumnResizerLineLayout_hiddenElem{display:none!important}.fixedDataTableLayout_main{border-style:solid;border-width:1px;box-sizing:border-box;overflow:hidden;position:relative}.fixedDataTableLayout_header,.fixedDataTableLayout_hasBottomBorder{border-bottom-style:solid;border-bottom-width:1px}.fixedDataTableLayout_footer .public_fixedDataTableCell_main{border-top-style:solid;border-top-width:1px}.fixedDataTableLayout_topShadow,.fixedDataTableLayout_bottomShadow{height:4px;left:0;position:absolute;right:0;z-index:1}.fixedDataTableLayout_bottomShadow{margin-top:-4px}.fixedDataTableLayout_rowsContainer{overflow:hidden;position:relative}.fixedDataTableLayout_horizontalScrollbar{bottom:0;position:absolute}.fixedDataTableRowLayout_main{box-sizing:border-box;overflow:hidden;position:absolute;top:0}.fixedDataTableRowLayout_body{left:0;position:absolute;top:0}.fixedDataTableRowLayout_fixedColumnsDivider{-webkit-backface-visibility:hidden;backface-visibility:hidden;border-left-style:solid;border-left-width:1px;left:0;position:absolute;top:0;width:0}.fixedDataTableRowLayout_columnsShadow{width:4px}.fixedDataTableRowLayout_rowWrapper{position:absolute;top:0} \ No newline at end of file +.fixedDataTableCellGroupLayout_cellGroup{backface-visibility:hidden;left:0;overflow:hidden;position:absolute;top:0;white-space:nowrap}.fixedDataTableCellGroupLayout_cellGroup>.public_fixedDataTableCell_main{display:inline-block;vertical-align:top;white-space:normal}.fixedDataTableCellGroupLayout_cellGroupWrapper{position:absolute;top:0}.fixedDataTableCellLayout_main{border-right-style:solid;border-width:0 1px 0 0;box-sizing:border-box;display:block;overflow:hidden;position:absolute;white-space:normal}.fixedDataTableCellLayout_lastChild{border-width:0 1px 1px 0}.fixedDataTableCellLayout_alignRight{text-align:right}.fixedDataTableCellLayout_alignCenter{text-align:center}.fixedDataTableCellLayout_wrap1{display:table}.fixedDataTableCellLayout_wrap2{display:table-row}.fixedDataTableCellLayout_wrap3{display:table-cell;vertical-align:middle}.fixedDataTableCellLayout_columnResizerContainer{position:absolute;right:0;width:6px;z-index:1}.fixedDataTableCellLayout_columnResizerContainer:hover{cursor:col-resize}.fixedDataTableCellLayout_columnResizerKnob{position:absolute;right:0;width:1px}.fixedDataTableColumnResizerLineLayout_mouseArea{cursor:col-resize;position:absolute;right:-5px;width:12px}.fixedDataTableColumnResizerLineLayout_main{border-right-style:solid;border-right-width:1px;box-sizing:border-box;position:absolute;z-index:10}body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main,.fixedDataTableColumnResizerLineLayout_hiddenElem{display:none!important}.fixedDataTableLayout_main{border-style:solid;border-width:1px;box-sizing:border-box;overflow:hidden;position:relative}.fixedDataTableLayout_header,.fixedDataTableLayout_hasBottomBorder{border-bottom-style:solid;border-bottom-width:1px}.fixedDataTableLayout_footer .public_fixedDataTableCell_main{border-top-style:solid;border-top-width:1px}.fixedDataTableLayout_topShadow,.fixedDataTableLayout_bottomShadow{height:4px;left:0;position:absolute;right:0;z-index:1}.fixedDataTableLayout_bottomShadow{margin-top:-4px}.fixedDataTableLayout_rowsContainer{overflow:hidden;position:relative}.fixedDataTableLayout_horizontalScrollbar{bottom:0;position:absolute}.fixedDataTableRowLayout_main{box-sizing:border-box;overflow:hidden;position:absolute;top:0}.fixedDataTableRowLayout_body{left:0;position:absolute;top:0}.fixedDataTableRowLayout_fixedColumnsDivider{backface-visibility:hidden;border-left-style:solid;border-left-width:1px;left:0;position:absolute;top:0;width:0}.fixedDataTableRowLayout_columnsShadow{width:4px}.fixedDataTableRowLayout_rowWrapper{position:absolute;top:0}.ScrollbarLayout_main{box-sizing:border-box;outline:none;overflow:hidden;position:absolute;transition-duration:250ms;transition-timing-function:ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ScrollbarLayout_mainVertical{bottom:0;right:0;top:0;transition-property:background-color width;width:15px}.ScrollbarLayout_mainVertical.public_Scrollbar_mainActive,.ScrollbarLayout_mainVertical:hover{width:17px}.ScrollbarLayout_mainHorizontal{bottom:0;height:15px;left:0;transition-property:background-color height}.ScrollbarLayout_mainHorizontal.public_Scrollbar_mainActive,.ScrollbarLayout_mainHorizontal:hover{height:17px}.ScrollbarLayout_face{left:0;overflow:hidden;position:absolute;z-index:1}.ScrollbarLayout_face:after{border-radius:6px;content:'';display:block;position:absolute;transition:background-color 250ms ease}.ScrollbarLayout_faceHorizontal{bottom:0;left:0;top:0}.ScrollbarLayout_faceHorizontal:after{bottom:4px;left:0;top:4px;width:100%}.ScrollbarLayout_faceVertical{left:0;right:0;top:0}.ScrollbarLayout_faceVertical:after{height:100%;left:4px;right:4px;top:0} \ No newline at end of file diff --git a/dist/fixed-data-table-style.css b/dist/fixed-data-table-style.css index e41dfbaa..057f6478 100644 --- a/dist/fixed-data-table-style.css +++ b/dist/fixed-data-table-style.css @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -9,43 +9,6 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -/** - * Copyright (c) 2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule Scrollbar - * - */ - -/** - * Scrollbars. - */ - -/* Touching the scroll-track directly makes the scroll-track bolder */ -.public_Scrollbar_main.public_Scrollbar_mainActive, -.public_Scrollbar_main:hover { - background-color: rgba(255, 255, 255, 0.8); -} - -.public_Scrollbar_mainOpaque, -.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive, -.public_Scrollbar_mainOpaque:hover { - background-color: #fff; -} - -.public_Scrollbar_face:after { - background-color: #c2c2c2; -} - -.public_Scrollbar_main:hover .public_Scrollbar_face:after, -.public_Scrollbar_mainActive .public_Scrollbar_face:after, -.public_Scrollbar_faceActive:after { - background-color: #7d7d7d; -} /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -77,7 +40,6 @@ .public_fixedDataTable_header, .public_fixedDataTable_header .public_fixedDataTableCell_main { background-color: #f6f7f8; - background-image: -webkit-linear-gradient(#fff, #efefef); background-image: linear-gradient(#fff, #efefef); } @@ -125,7 +87,7 @@ } .public_fixedDataTableCell_columnResizerKnob { - background-color: #0284ff; + background-color: #f57c00; } /** * Copyright (c) 2015, Facebook, Inc. @@ -143,7 +105,7 @@ * Column resizer line. */ .public_fixedDataTableColumnResizerLine_main { - border-color: #0284ff; + border-color: #f57c00; } /** * Copyright (c) 2015, Facebook, Inc. @@ -175,3 +137,40 @@ .public_fixedDataTableRow_columnsShadow { background: 0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==) repeat-y; } +/** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule Scrollbar + * + */ + +/** + * Scrollbars. + */ + +/* Touching the scroll-track directly makes the scroll-track bolder */ +.public_Scrollbar_main.public_Scrollbar_mainActive, +.public_Scrollbar_main:hover { + background-color: rgba(255, 255, 255, 0.8); +} + +.public_Scrollbar_mainOpaque, +.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive, +.public_Scrollbar_mainOpaque:hover { + background-color: #fff; +} + +.public_Scrollbar_face:after { + background-color: #c2c2c2; +} + +.public_Scrollbar_main:hover .public_Scrollbar_face:after, +.public_Scrollbar_mainActive .public_Scrollbar_face:after, +.public_Scrollbar_faceActive:after { + background-color: #7d7d7d; +} diff --git a/dist/fixed-data-table-style.min.css b/dist/fixed-data-table-style.min.css index b58ae79c..dcf6901f 100644 --- a/dist/fixed-data-table-style.min.css +++ b/dist/fixed-data-table-style.min.css @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -9,4 +9,4 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -.public_Scrollbar_main.public_Scrollbar_mainActive,.public_Scrollbar_main:hover{background-color:rgba(255,255,255,.8)}.public_Scrollbar_mainOpaque,.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive,.public_Scrollbar_mainOpaque:hover{background-color:#fff}.public_Scrollbar_face:after{background-color:#c2c2c2}.public_Scrollbar_main:hover .public_Scrollbar_face:after,.public_Scrollbar_mainActive .public_Scrollbar_face:after,.public_Scrollbar_faceActive:after{background-color:#7d7d7d}.public_fixedDataTable_main,.public_fixedDataTable_header,.public_fixedDataTable_hasBottomBorder{border-color:#d3d3d3}.public_fixedDataTable_header .public_fixedDataTableCell_main{font-weight:700}.public_fixedDataTable_header,.public_fixedDataTable_header .public_fixedDataTableCell_main{background-color:#f6f7f8;background-image:-webkit-linear-gradient(#fff,#efefef);background-image:linear-gradient(#fff,#efefef)}.public_fixedDataTable_footer .public_fixedDataTableCell_main{background-color:#f6f7f8;border-color:#d3d3d3}.public_fixedDataTable_topShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAF0lEQVR4AWPUkNeSBhHCjJoK2twgFisAFagCCp3pJlAAAAAASUVORK5CYII=) repeat-x}.public_fixedDataTable_bottomShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAHElEQVQI12MwNjZmZdAT1+Nm0JDWEGZQk1GTBgAWkwIeAEp52AAAAABJRU5ErkJggg==) repeat-x}.public_fixedDataTable_horizontalScrollbar .public_Scrollbar_mainHorizontal{background-color:#fff}.public_fixedDataTableCell_main{background-color:#fff;border-color:#d3d3d3}.public_fixedDataTableCell_highlighted{background-color:#f4f4f4}.public_fixedDataTableCell_cellContent{padding:8px}.public_fixedDataTableCell_columnResizerKnob{background-color:#0284ff}.public_fixedDataTableColumnResizerLine_main{border-color:#0284ff}.public_fixedDataTableRow_main{background-color:#fff}.public_fixedDataTableRow_highlighted,.public_fixedDataTableRow_highlighted .public_fixedDataTableCell_main{background-color:#f6f7f8}.public_fixedDataTableRow_fixedColumnsDivider{border-color:#d3d3d3}.public_fixedDataTableRow_columnsShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==) repeat-y} \ No newline at end of file +.public_fixedDataTable_main,.public_fixedDataTable_header,.public_fixedDataTable_hasBottomBorder{border-color:#d3d3d3}.public_fixedDataTable_header .public_fixedDataTableCell_main{font-weight:700}.public_fixedDataTable_header,.public_fixedDataTable_header .public_fixedDataTableCell_main{background-color:#f6f7f8;background-image:linear-gradient(#fff,#efefef)}.public_fixedDataTable_footer .public_fixedDataTableCell_main{background-color:#f6f7f8;border-color:#d3d3d3}.public_fixedDataTable_topShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAF0lEQVR4AWPUkNeSBhHCjJoK2twgFisAFagCCp3pJlAAAAAASUVORK5CYII=) repeat-x}.public_fixedDataTable_bottomShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAHElEQVQI12MwNjZmZdAT1+Nm0JDWEGZQk1GTBgAWkwIeAEp52AAAAABJRU5ErkJggg==) repeat-x}.public_fixedDataTable_horizontalScrollbar .public_Scrollbar_mainHorizontal{background-color:#fff}.public_fixedDataTableCell_main{background-color:#fff;border-color:#d3d3d3}.public_fixedDataTableCell_highlighted{background-color:#f4f4f4}.public_fixedDataTableCell_cellContent{padding:8px}.public_fixedDataTableCell_columnResizerKnob{background-color:#f57c00}.public_fixedDataTableColumnResizerLine_main{border-color:#f57c00}.public_fixedDataTableRow_main{background-color:#fff}.public_fixedDataTableRow_highlighted,.public_fixedDataTableRow_highlighted .public_fixedDataTableCell_main{background-color:#f6f7f8}.public_fixedDataTableRow_fixedColumnsDivider{border-color:#d3d3d3}.public_fixedDataTableRow_columnsShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==) repeat-y}.public_Scrollbar_main.public_Scrollbar_mainActive,.public_Scrollbar_main:hover{background-color:rgba(255,255,255,.8)}.public_Scrollbar_mainOpaque,.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive,.public_Scrollbar_mainOpaque:hover{background-color:#fff}.public_Scrollbar_face:after{background-color:#c2c2c2}.public_Scrollbar_main:hover .public_Scrollbar_face:after,.public_Scrollbar_mainActive .public_Scrollbar_face:after,.public_Scrollbar_faceActive:after{background-color:#7d7d7d} \ No newline at end of file diff --git a/dist/fixed-data-table.css b/dist/fixed-data-table.css index d1a79eae..ff3b49ee 100644 --- a/dist/fixed-data-table.css +++ b/dist/fixed-data-table.css @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -17,34 +17,27 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule Scrollbar - * - */ - -/** - * Scrollbars. + * @providesModule fixedDataTableCellGroupLayout */ -/* Touching the scroll-track directly makes the scroll-track bolder */ -.public_Scrollbar_main.public_Scrollbar_mainActive, -.public_Scrollbar_main:hover { - background-color: rgba(255, 255, 255, 0.8); -} - -.public_Scrollbar_mainOpaque, -.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive, -.public_Scrollbar_mainOpaque:hover { - background-color: #fff; +.fixedDataTableCellGroupLayout_cellGroup { + backface-visibility: hidden; + left: 0; + overflow: hidden; + position: absolute; + top: 0; + white-space: nowrap; } -.public_Scrollbar_face:after { - background-color: #c2c2c2; +.fixedDataTableCellGroupLayout_cellGroup > .public_fixedDataTableCell_main { + display: inline-block; + vertical-align: top; + white-space: normal; } -.public_Scrollbar_main:hover .public_Scrollbar_face:after, -.public_Scrollbar_mainActive .public_Scrollbar_face:after, -.public_Scrollbar_faceActive:after { - background-color: #7d7d7d; +.fixedDataTableCellGroupLayout_cellGroupWrapper { + position: absolute; + top: 0; } /** * Copyright (c) 2015, Facebook, Inc. @@ -54,48 +47,60 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTable - * + * @providesModule fixedDataTableCellLayout */ -/** - * Table. - */ -.public_fixedDataTable_main { - border-color: #d3d3d3; +.fixedDataTableCellLayout_main { + border-right-style: solid; + border-right-width: 1px; + border-width: 0 1px 0 0; + box-sizing: border-box; + display: block; + overflow: hidden; + position: absolute; + white-space: normal; } -.public_fixedDataTable_header, -.public_fixedDataTable_hasBottomBorder { - border-color: #d3d3d3; +.fixedDataTableCellLayout_lastChild { + border-width: 0 1px 1px 0; } -.public_fixedDataTable_header .public_fixedDataTableCell_main { - font-weight: bold; +.fixedDataTableCellLayout_alignRight { + text-align: right; } -.public_fixedDataTable_header, -.public_fixedDataTable_header .public_fixedDataTableCell_main { - background-color: #f6f7f8; - background-image: -webkit-linear-gradient(#fff, #efefef); - background-image: linear-gradient(#fff, #efefef); +.fixedDataTableCellLayout_alignCenter { + text-align: center; } -.public_fixedDataTable_footer .public_fixedDataTableCell_main { - background-color: #f6f7f8; - border-color: #d3d3d3; +.fixedDataTableCellLayout_wrap1 { + display: table; } -.public_fixedDataTable_topShadow { - background: 0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAF0lEQVR4AWPUkNeSBhHCjJoK2twgFisAFagCCp3pJlAAAAAASUVORK5CYII=) repeat-x; +.fixedDataTableCellLayout_wrap2 { + display: table-row; } -.public_fixedDataTable_bottomShadow { - background: 0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAHElEQVQI12MwNjZmZdAT1+Nm0JDWEGZQk1GTBgAWkwIeAEp52AAAAABJRU5ErkJggg==) repeat-x; +.fixedDataTableCellLayout_wrap3 { + display: table-cell; + vertical-align: middle; } -.public_fixedDataTable_horizontalScrollbar .public_Scrollbar_mainHorizontal { - background-color: #fff; +.fixedDataTableCellLayout_columnResizerContainer { + position: absolute; + right: 0px; + width: 6px; + z-index: 1; +} + +.fixedDataTableCellLayout_columnResizerContainer:hover { + cursor: col-resize; +} + +.fixedDataTableCellLayout_columnResizerKnob { + position: absolute; + right: 0px; + width: 1px; } /** * Copyright (c) 2015, Facebook, Inc. @@ -105,27 +110,34 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTableCell + * @providesModule fixedDataTableColumnResizerLineLayout */ -/** - * Table cell. - */ -.public_fixedDataTableCell_main { - background-color: #fff; - border-color: #d3d3d3; +.fixedDataTableColumnResizerLineLayout_mouseArea { + cursor: col-resize; + position: absolute; + right: -5px; + width: 12px; } -.public_fixedDataTableCell_highlighted { - background-color: #f4f4f4; +.fixedDataTableColumnResizerLineLayout_main { + border-right-style: solid; + border-right-width: 1px; + box-sizing: border-box; + position: absolute; + z-index: 10; } -.public_fixedDataTableCell_cellContent { - padding: 8px; +body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main { + /* the resizer line is in the wrong position in RTL with no easy fix. + * Disabling is more useful than displaying it. + * #167 (github) should look into this and come up with a permanent fix. + */ + display: none !important; } -.public_fixedDataTableCell_columnResizerKnob { - background-color: #0284ff; +.fixedDataTableColumnResizerLineLayout_hiddenElem { + display: none !important; } /** * Copyright (c) 2015, Facebook, Inc. @@ -135,15 +147,49 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTableColumnResizerLine - * + * @providesModule fixedDataTableLayout */ -/** - * Column resizer line. - */ -.public_fixedDataTableColumnResizerLine_main { - border-color: #0284ff; +.fixedDataTableLayout_main { + border-style: solid; + border-width: 1px; + box-sizing: border-box; + overflow: hidden; + position: relative; +} + +.fixedDataTableLayout_header, +.fixedDataTableLayout_hasBottomBorder { + border-bottom-style: solid; + border-bottom-width: 1px; +} + +.fixedDataTableLayout_footer .public_fixedDataTableCell_main { + border-top-style: solid; + border-top-width: 1px; +} + +.fixedDataTableLayout_topShadow, +.fixedDataTableLayout_bottomShadow { + height: 4px; + left: 0; + position: absolute; + right: 0; + z-index: 1; +} + +.fixedDataTableLayout_bottomShadow { + margin-top: -4px; +} + +.fixedDataTableLayout_rowsContainer { + overflow: hidden; + position: relative; +} + +.fixedDataTableLayout_horizontalScrollbar { + bottom: 0; + position: absolute; } /** * Copyright (c) 2015, Facebook, Inc. @@ -153,27 +199,39 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTableRow + * @providesModule fixedDataTableRowLayout */ -/** - * Table row. - */ -.public_fixedDataTableRow_main { - background-color: #fff; +.fixedDataTableRowLayout_main { + box-sizing: border-box; + overflow: hidden; + position: absolute; + top: 0; } -.public_fixedDataTableRow_highlighted, -.public_fixedDataTableRow_highlighted .public_fixedDataTableCell_main { - background-color: #f6f7f8; +.fixedDataTableRowLayout_body { + left: 0; + position: absolute; + top: 0; } -.public_fixedDataTableRow_fixedColumnsDivider { - border-color: #d3d3d3; +.fixedDataTableRowLayout_fixedColumnsDivider { + backface-visibility: hidden; + border-left-style: solid; + border-left-width: 1px; + left: 0; + position: absolute; + top: 0; + width: 0; } -.public_fixedDataTableRow_columnsShadow { - background: 0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==) repeat-y; +.fixedDataTableRowLayout_columnsShadow { + width: 4px; +} + +.fixedDataTableRowLayout_rowWrapper { + position: absolute; + top: 0; } /** * Copyright (c) 2015, Facebook, Inc. @@ -191,10 +249,8 @@ outline: none; overflow: hidden; position: absolute; - -webkit-transition-duration: 250ms; - transition-duration: 250ms; - -webkit-transition-timing-function: ease; - transition-timing-function: ease; + transition-duration: 250ms; + transition-timing-function: ease; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; @@ -205,8 +261,7 @@ bottom: 0; right: 0; top: 0; - -webkit-transition-property: background-color width; - transition-property: background-color width; + transition-property: background-color width; width: 15px; } @@ -219,8 +274,7 @@ bottom: 0; height: 15px; left: 0; - -webkit-transition-property: background-color height; - transition-property: background-color height; + transition-property: background-color height; } /* Touching the scroll-track directly makes the scroll-track bolder */ @@ -247,8 +301,7 @@ content: ''; display: block; position: absolute; - -webkit-transition: background-color 250ms ease; - transition: background-color 250ms ease; + transition: background-color 250ms ease; } .ScrollbarLayout_faceHorizontal { @@ -284,96 +337,47 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTableCellGroupLayout + * @providesModule fixedDataTable + * */ -.fixedDataTableCellGroupLayout_cellGroup { - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - left: 0; - overflow: hidden; - position: absolute; - top: 0; - white-space: nowrap; -} - -.fixedDataTableCellGroupLayout_cellGroup > .public_fixedDataTableCell_main { - display: inline-block; - vertical-align: top; - white-space: normal; -} - -.fixedDataTableCellGroupLayout_cellGroupWrapper { - position: absolute; - top: 0; -} /** - * Copyright (c) 2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule fixedDataTableCellLayout + * Table. */ - -.fixedDataTableCellLayout_main { - border-right-style: solid; - border-right-width: 1px; - border-width: 0 1px 0 0; - box-sizing: border-box; - display: block; - overflow: hidden; - position: absolute; - white-space: normal; -} - -.fixedDataTableCellLayout_lastChild { - border-width: 0 1px 1px 0; -} - -.fixedDataTableCellLayout_alignRight { - text-align: right; -} - -.fixedDataTableCellLayout_alignCenter { - text-align: center; +.public_fixedDataTable_main { + border-color: #d3d3d3; } -.fixedDataTableCellLayout_wrap1 { - display: table; +.public_fixedDataTable_header, +.public_fixedDataTable_hasBottomBorder { + border-color: #d3d3d3; } -.fixedDataTableCellLayout_wrap2 { - display: table-row; +.public_fixedDataTable_header .public_fixedDataTableCell_main { + font-weight: bold; } -.fixedDataTableCellLayout_wrap3 { - display: table-cell; - vertical-align: middle; +.public_fixedDataTable_header, +.public_fixedDataTable_header .public_fixedDataTableCell_main { + background-color: #f6f7f8; + background-image: linear-gradient(#fff, #efefef); } -.fixedDataTableCellLayout_columnResizerContainer { - position: absolute; - right: 0px; - width: 6px; - z-index: 1; +.public_fixedDataTable_footer .public_fixedDataTableCell_main { + background-color: #f6f7f8; + border-color: #d3d3d3; } -.fixedDataTableCellLayout_columnResizerContainer:hover { - cursor: ew-resize; +.public_fixedDataTable_topShadow { + background: 0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAF0lEQVR4AWPUkNeSBhHCjJoK2twgFisAFagCCp3pJlAAAAAASUVORK5CYII=) repeat-x; } -.fixedDataTableCellLayout_columnResizerContainer:hover .fixedDataTableCellLayout_columnResizerKnob { - visibility: visible; +.public_fixedDataTable_bottomShadow { + background: 0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAHElEQVQI12MwNjZmZdAT1+Nm0JDWEGZQk1GTBgAWkwIeAEp52AAAAABJRU5ErkJggg==) repeat-x; } -.fixedDataTableCellLayout_columnResizerKnob { - position: absolute; - right: 0px; - visibility: hidden; - width: 4px; +.public_fixedDataTable_horizontalScrollbar .public_Scrollbar_mainHorizontal { + background-color: #fff; } /** * Copyright (c) 2015, Facebook, Inc. @@ -383,34 +387,27 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTableColumnResizerLineLayout + * @providesModule fixedDataTableCell */ -.fixedDataTableColumnResizerLineLayout_mouseArea { - cursor: ew-resize; - position: absolute; - right: -5px; - width: 12px; +/** + * Table cell. + */ +.public_fixedDataTableCell_main { + background-color: #fff; + border-color: #d3d3d3; } -.fixedDataTableColumnResizerLineLayout_main { - border-right-style: solid; - border-right-width: 1px; - box-sizing: border-box; - position: absolute; - z-index: 10; +.public_fixedDataTableCell_highlighted { + background-color: #f4f4f4; } -body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main { - /* the resizer line is in the wrong position in RTL with no easy fix. - * Disabling is more useful than displaying it. - * #167 (github) should look into this and come up with a permanent fix. - */ - display: none !important; +.public_fixedDataTableCell_cellContent { + padding: 8px; } -.fixedDataTableColumnResizerLineLayout_hiddenElem { - display: none !important; +.public_fixedDataTableCell_columnResizerKnob { + background-color: #f57c00; } /** * Copyright (c) 2015, Facebook, Inc. @@ -420,49 +417,45 @@ body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main { * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTableLayout + * @providesModule fixedDataTableColumnResizerLine + * */ -.fixedDataTableLayout_main { - border-style: solid; - border-width: 1px; - box-sizing: border-box; - overflow: hidden; - position: relative; -} - -.fixedDataTableLayout_header, -.fixedDataTableLayout_hasBottomBorder { - border-bottom-style: solid; - border-bottom-width: 1px; -} - -.fixedDataTableLayout_footer .public_fixedDataTableCell_main { - border-top-style: solid; - border-top-width: 1px; +/** + * Column resizer line. + */ +.public_fixedDataTableColumnResizerLine_main { + border-color: #f57c00; } +/** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule fixedDataTableRow + */ -.fixedDataTableLayout_topShadow, -.fixedDataTableLayout_bottomShadow { - height: 4px; - left: 0; - position: absolute; - right: 0; - z-index: 1; +/** + * Table row. + */ +.public_fixedDataTableRow_main { + background-color: #fff; } -.fixedDataTableLayout_bottomShadow { - margin-top: -4px; +.public_fixedDataTableRow_highlighted, +.public_fixedDataTableRow_highlighted .public_fixedDataTableCell_main { + background-color: #f6f7f8; } -.fixedDataTableLayout_rowsContainer { - overflow: hidden; - position: relative; +.public_fixedDataTableRow_fixedColumnsDivider { + border-color: #d3d3d3; } -.fixedDataTableLayout_horizontalScrollbar { - bottom: 0; - position: absolute; +.public_fixedDataTableRow_columnsShadow { + background: 0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==) repeat-y; } /** * Copyright (c) 2015, Facebook, Inc. @@ -472,38 +465,32 @@ body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main { * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule fixedDataTableRowLayout + * @providesModule Scrollbar + * */ -.fixedDataTableRowLayout_main { - box-sizing: border-box; - overflow: hidden; - position: absolute; - top: 0; -} +/** + * Scrollbars. + */ -.fixedDataTableRowLayout_body { - left: 0; - position: absolute; - top: 0; +/* Touching the scroll-track directly makes the scroll-track bolder */ +.public_Scrollbar_main.public_Scrollbar_mainActive, +.public_Scrollbar_main:hover { + background-color: rgba(255, 255, 255, 0.8); } -.fixedDataTableRowLayout_fixedColumnsDivider { - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - border-left-style: solid; - border-left-width: 1px; - left: 0; - position: absolute; - top: 0; - width: 0; +.public_Scrollbar_mainOpaque, +.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive, +.public_Scrollbar_mainOpaque:hover { + background-color: #fff; } -.fixedDataTableRowLayout_columnsShadow { - width: 4px; +.public_Scrollbar_face:after { + background-color: #c2c2c2; } -.fixedDataTableRowLayout_rowWrapper { - position: absolute; - top: 0; +.public_Scrollbar_main:hover .public_Scrollbar_face:after, +.public_Scrollbar_mainActive .public_Scrollbar_face:after, +.public_Scrollbar_faceActive:after { + background-color: #7d7d7d; } diff --git a/dist/fixed-data-table.js b/dist/fixed-data-table.js index 29a1eafe..fd061ac1 100644 --- a/dist/fixed-data-table.js +++ b/dist/fixed-data-table.js @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -18,7 +18,7 @@ exports["FixedDataTable"] = factory(require("react"), require("react-dom")); else root["FixedDataTable"] = factory(root["React"], root["ReactDOM"]); -})(this, function(__WEBPACK_EXTERNAL_MODULE_28__, __WEBPACK_EXTERNAL_MODULE_46__) { +})(this, function(__WEBPACK_EXTERNAL_MODULE_35__, __WEBPACK_EXTERNAL_MODULE_58__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -63,104 +63,104 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { + __webpack_require__(1); + __webpack_require__(5); + __webpack_require__(7); + __webpack_require__(9); + __webpack_require__(11); __webpack_require__(13); __webpack_require__(15); __webpack_require__(17); __webpack_require__(19); __webpack_require__(21); __webpack_require__(23); - __webpack_require__(1); - __webpack_require__(5); - __webpack_require__(7); - __webpack_require__(9); - __webpack_require__(11); module.exports = __webpack_require__(25); -/***/ }, +/***/ }), /* 1 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 2 */, /* 3 */, /* 4 */, /* 5 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 6 */, /* 7 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 8 */, /* 9 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 10 */, /* 11 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 12 */, /* 13 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 14 */, /* 15 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 16 */, /* 17 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 18 */, /* 19 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 20 */, /* 21 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 22 */, /* 23 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { // removed by extract-text-webpack-plugin -/***/ }, +/***/ }), /* 24 */, /* 25 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -176,22 +176,23 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; var FixedDataTable = __webpack_require__(26); - var FixedDataTableCellDefault = __webpack_require__(66); - var FixedDataTableColumn = __webpack_require__(64); - var FixedDataTableColumnGroup = __webpack_require__(63); + var FixedDataTableCellDefault = __webpack_require__(78); + var FixedDataTableColumn = __webpack_require__(76); + var FixedDataTableColumnGroup = __webpack_require__(75); var FixedDataTableRoot = { Cell: FixedDataTableCellDefault, Column: FixedDataTableColumn, ColumnGroup: FixedDataTableColumnGroup, - Table: FixedDataTable }; + Table: FixedDataTable + }; - FixedDataTableRoot.version = '0.6.0'; + FixedDataTableRoot.version = '0.7.0'; module.exports = FixedDataTableRoot; -/***/ }, +/***/ }), /* 26 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -216,19 +217,27 @@ return /******/ (function(modules) { // webpackBootstrap var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - var React = __webpack_require__(27); + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - var ReactChildren = React.Children; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - var PropTypes = React.PropTypes; + var PropTypes = __webpack_require__(27); + + var React = __webpack_require__(34); + + var ReactChildren = React.Children; // New Table API - var Table = __webpack_require__(29); - var Column = __webpack_require__(73); - var ColumnGroup = __webpack_require__(74); + var Table = __webpack_require__(36); + var Column = __webpack_require__(87); + var ColumnGroup = __webpack_require__(88); // Transition Cell - var TransitionCell = __webpack_require__(75); + var TransitionCell = __webpack_require__(89); var NEXT_VERSION = '0.7.0'; var DOCUMENTATION_URL = 'https://fburl.com/FixedDataTable-v0.6'; @@ -240,7 +249,7 @@ return /******/ (function(modules) { // webpackBootstrap */ var notified = {}; function notifyDeprecated(prop, reason) { - if (true) { + if (false) { if (!notified[prop]) { console.warn('`' + prop + '` will be DEPRECATED in version ' + NEXT_VERSION + ' of FixedDataTable and beyond. \n' + reason + '\n' + 'Read the docs at: ' + DOCUMENTATION_URL); notified[prop] = true; @@ -297,1137 +306,2282 @@ return /******/ (function(modules) { // webpackBootstrap * - Scrollable Body Columns: The body columns that move while scrolling * vertically or horizontally. */ - var TransitionTable = React.createClass({ - displayName: 'TransitionTable', - - propTypes: { - /** - * Pixel width of table. If all columns do not fit, - * a horizontal scrollbar will appear. - */ - width: PropTypes.number.isRequired, - /** - * Pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - height: PropTypes.number, + var TransitionTable = (function (_React$Component) { + _inherits(TransitionTable, _React$Component); + + _createClass(TransitionTable, null, [{ + key: 'propTypes', + value: { + /** + * Pixel width of table. If all columns do not fit, + * a horizontal scrollbar will appear. + */ + width: PropTypes.number.isRequired, + + /** + * Pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + height: PropTypes.number, + + /** + * Maximum pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + maxHeight: PropTypes.number, + + /** + * Pixel height of table's owner, this is used in a managed scrolling + * situation when you want to slide the table up from below the fold + * without having to constantly update the height on every scroll tick. + * Instead, vary this property on scroll. By using `ownerHeight`, we + * over-render the table while making sure the footer and horizontal + * scrollbar of the table are visible when the current space for the table + * in view is smaller than the final, over-flowing height of table. It + * allows us to avoid resizing and reflowing table when it is moving in the + * view. + * + * This is used if `ownerHeight < height` (or `maxHeight`). + */ + ownerHeight: PropTypes.number, + + overflowX: PropTypes.oneOf(['hidden', 'auto']), + overflowY: PropTypes.oneOf(['hidden', 'auto']), + + /** + * Number of rows in the table. + */ + rowsCount: PropTypes.number.isRequired, + + /** + * Pixel height of rows unless `rowHeightGetter` is specified and returns + * different value. + */ + rowHeight: PropTypes.number.isRequired, + + /** + * If specified, `rowHeightGetter(index)` is called for each row and the + * returned value overrides `rowHeight` for particular row. + */ + rowHeightGetter: PropTypes.func, + + /** + * DEPRECATED + * + * To get rows to display in table, `rowGetter(index)` + * is called. `rowGetter` should be smart enough to handle async + * fetching of data and return temporary objects + * while data is being fetched. + */ + rowGetter: PropTypes.func, + + /** + * To get any additional CSS classes that should be added to a row, + * `rowClassNameGetter(index)` is called. + */ + rowClassNameGetter: PropTypes.func, + + /** + * Pixel height of the column group header. + */ + groupHeaderHeight: PropTypes.number, + + /** + * Pixel height of header. + */ + headerHeight: PropTypes.number.isRequired, + + /** + * DEPRECATED + * + * Function that is called to get the data for the header row. + * If the function returns null, the header will be set to the + * Column's label property. + */ + headerDataGetter: PropTypes.func, + + /** + * Pixel height of footer. + */ + footerHeight: PropTypes.number, + + /** + * DEPRECATED - use footerDataGetter instead. + * Data that will be passed to footer cell renderers. + */ + footerData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), + + /** + * DEPRECATED + * + * Function that is called to get the data for the footer row. + */ + footerDataGetter: PropTypes.func, + + /** + * Value of horizontal scroll. + */ + scrollLeft: PropTypes.number, + + /** + * Index of column to scroll to. + */ + scrollToColumn: PropTypes.number, + + /** + * Value of vertical scroll. + */ + scrollTop: PropTypes.number, + + /** + * Index of row to scroll to. + */ + scrollToRow: PropTypes.number, + + /** + * Callback that is called when scrolling starts with current horizontal + * and vertical scroll values. + */ + onScrollStart: PropTypes.func, + + /** + * Callback that is called when scrolling ends or stops with new horizontal + * and vertical scroll values. + */ + onScrollEnd: PropTypes.func, + + /** + * Callback that is called when `rowHeightGetter` returns a different height + * for a row than the `rowHeight` prop. This is necessary because initially + * table estimates heights of some parts of the content. + */ + onContentHeightChange: PropTypes.func, + + /** + * Callback that is called when a row is clicked. + */ + onRowClick: PropTypes.func, + + /** + * Callback that is called when a row is double clicked. + */ + onRowDoubleClick: PropTypes.func, + + /** + * Callback that is called when a mouse-down event happens on a row. + */ + onRowMouseDown: PropTypes.func, + + /** + * Callback that is called when a mouse-enter event happens on a row. + */ + onRowMouseEnter: PropTypes.func, + + /** + * Callback that is called when a mouse-leave event happens on a row. + */ + onRowMouseLeave: PropTypes.func, + + /** + * Callback that is called when resizer has been released + * and column needs to be updated. + * + * Required if the isResizable property is true on any column. + * + * ``` + * function( + * newColumnWidth: number, + * dataKey: string, + * ) + * ``` + */ + onColumnResizeEndCallback: PropTypes.func, + + /** + * Whether a column is currently being resized. + */ + isColumnResizing: PropTypes.bool + }, + enumerable: true + }]); - /** - * Maximum pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - maxHeight: PropTypes.number, + function TransitionTable(props, context) { + var _this = this; - /** - * Pixel height of table's owner, this is used in a managed scrolling - * situation when you want to slide the table up from below the fold - * without having to constantly update the height on every scroll tick. - * Instead, vary this property on scroll. By using `ownerHeight`, we - * over-render the table while making sure the footer and horizontal - * scrollbar of the table are visible when the current space for the table - * in view is smaller than the final, over-flowing height of table. It - * allows us to avoid resizing and reflowing table when it is moving in the - * view. - * - * This is used if `ownerHeight < height` (or `maxHeight`). - */ - ownerHeight: PropTypes.number, + _classCallCheck(this, TransitionTable); - overflowX: PropTypes.oneOf(['hidden', 'auto']), - overflowY: PropTypes.oneOf(['hidden', 'auto']), + _get(Object.getPrototypeOf(TransitionTable.prototype), 'constructor', this).call(this, props, context); + // Throw warnings on deprecated props. - /** - * Number of rows in the table. - */ - rowsCount: PropTypes.number.isRequired, + this._checkDeprecations = function () { + var needsMigration = false; - /** - * Pixel height of rows unless `rowHeightGetter` is specified and returns - * different value. - */ - rowHeight: PropTypes.number.isRequired, + if (_this.props.rowGetter) { + notifyDeprecated('rowGetter', 'Please use the cell API in Column to fetch data for your cells.'); - /** - * If specified, `rowHeightGetter(index)` is called for each row and the - * returned value overrides `rowHeight` for particular row. - */ - rowHeightGetter: PropTypes.func, + // ROWGETTER??? You need to migrate. + needsMigration = true; + } - /** - * DEPRECATED - * - * To get rows to display in table, `rowGetter(index)` - * is called. `rowGetter` should be smart enough to handle async - * fetching of data and return temporary objects - * while data is being fetched. - */ - rowGetter: PropTypes.func, + if (_this.props.headerDataGetter) { + notifyDeprecated('headerDataGetter', 'Please use the header API in Column to ' + 'fetch data for your header cells.'); + } - /** - * To get any additional CSS classes that should be added to a row, - * `rowClassNameGetter(index)` is called. - */ - rowClassNameGetter: PropTypes.func, + if (_this.props.footerData) { + notifyDeprecated('footerData', 'Please use the footer API in Column to ' + 'fetch data for your footer cells.'); + } - /** - * Pixel height of the column group header. - */ - groupHeaderHeight: PropTypes.number, + if (_this.props.footerDataGetter) { + notifyDeprecated('footerDataGetter', 'Please use the footer API in Column to ' + 'fetch data for your footer cells.'); + } - /** - * Pixel height of header. - */ - headerHeight: PropTypes.number.isRequired, + ReactChildren.forEach(_this.props.children, function (child) { + if (!child || !child.props) { + return; + } - /** - * DEPRECATED - * - * Function that is called to get the data for the header row. - * If the function returns null, the header will be set to the - * Column's label property. - */ - headerDataGetter: PropTypes.func, + var props = child.props; - /** - * Pixel height of footer. - */ - footerHeight: PropTypes.number, + if (props.label) { + notifyDeprecated('label', 'Please use `header` instead.'); + } - /** - * DEPRECATED - use footerDataGetter instead. - * Data that will be passed to footer cell renderers. - */ - footerData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), + if (props.dataKey) { + notifyDeprecated('dataKey', 'Please use the `cell` API to pass in a dataKey'); + } - /** - * DEPRECATED - * - * Function that is called to get the data for the footer row. - */ - footerDataGetter: PropTypes.func, + if (props.cellRenderer) { + notifyDeprecated('cellRenderer', 'Please use the `cell` API to pass in a React Element instead.'); + } - /** - * Value of horizontal scroll. - */ - scrollLeft: PropTypes.number, + if (props.headerRenderer) { + notifyDeprecated('headerRenderer', 'Please use the `header` API to pass in a React Element instead.'); + } - /** - * Index of column to scroll to. - */ - scrollToColumn: PropTypes.number, + if (props.columnData) { + notifyDeprecated('columnData', 'Please pass data in through props to your header, cell or footer.'); + } - /** - * Value of vertical scroll. - */ - scrollTop: PropTypes.number, + if (props.groupHeaderRenderer) { + notifyDeprecated('groupHeaderRenderer', 'Please use the `header` API in ColumnGroup to ' + 'pass in a React Element instead of a function that creates one.'); + } - /** - * Index of row to scroll to. - */ - scrollToRow: PropTypes.number, + if (props.groupHeaderData) { + notifyDeprecated('groupHeaderData', 'Please pass in any data through props to your header.'); + } + }); - /** - * Callback that is called when scrolling starts with current horizontal - * and vertical scroll values. - */ - onScrollStart: PropTypes.func, + return needsMigration; + }; - /** - * Callback that is called when scrolling ends or stops with new horizontal - * and vertical scroll values. - */ - onScrollEnd: PropTypes.func, + this._onRowAction = function (props, callback) { + if (!callback) { + return undefined; + } - /** - * Callback that is called when `rowHeightGetter` returns a different height - * for a row than the `rowHeight` prop. This is necessary because initially - * table estimates heights of some parts of the content. - */ - onContentHeightChange: PropTypes.func, + return function (e, rowIndex) { + callback(e, rowIndex, props.rowGetter && props.rowGetter(rowIndex) || EMPTY_OBJECT); + }; + }; - /** - * Callback that is called when a row is clicked. - */ - onRowClick: PropTypes.func, + this._transformColumn = function (column, tableProps, key) { + + var props = column.props; + + if (column.type.__TableColumn__) { + // Constuct the cell to be used using the rowGetter + return React.createElement(Column, _extends({ + key: 'column_' + key + }, props, { + header: React.createElement(TransitionCell, { + isHeaderCell: true, + label: props.label, + width: props.width, + dataKey: props.dataKey, + className: props.headerClassName, + columnData: props.columnData || EMPTY_OBJECT, + cellRenderer: props.headerRenderer, + headerDataGetter: tableProps.headerDataGetter + }), + columnKey: props.dataKey, + cell: React.createElement(TransitionCell, { + dataKey: props.dataKey, + className: props.cellClassName, + rowGetter: tableProps.rowGetter, + width: props.width, + columnData: props.columnData || EMPTY_OBJECT, + cellDataGetter: props.cellDataGetter, + cellRenderer: props.cellRenderer + }), + footer: React.createElement(TransitionCell, { + isFooterCell: true, + className: props.footerClassName, + dataKey: props.dataKey, + cellRenderer: props.footerRenderer, + footerDataGetter: tableProps.footerDataGetter, + footerData: tableProps.footerData || EMPTY_OBJECT + }) + })); + } + }; - /** - * Callback that is called when a row is double clicked. - */ - onRowDoubleClick: PropTypes.func, + this._transformColumnGroup = function (group, tableProps, key, labels) { + var props = group.props; - /** - * Callback that is called when a mouse-down event happens on a row. - */ - onRowMouseDown: PropTypes.func, + var j = 0; + var columns = ReactChildren.map(props.children, function (child) { + j++; + return _this._transformColumn(child, tableProps, key + '_' + j); + }); - /** - * Callback that is called when a mouse-enter event happens on a row. - */ - onRowMouseEnter: PropTypes.func, + return React.createElement( + ColumnGroup, + _extends({}, props, { + key: 'group_' + key, + header: React.createElement(TransitionCell, { + isHeaderCell: true, + label: group.props.label, + dataKey: key, + groupHeaderRenderer: props.groupHeaderRenderer, + groupHeaderLabels: labels, + groupHeaderData: props.columnGroupData || EMPTY_OBJECT + }) }), + columns + ); + }; - /** - * Callback that is called when a mouse-leave event happens on a row. - */ - onRowMouseLeave: PropTypes.func, + this._convertedColumns = function (needsMigration) { + // If we don't need to migrate, map directly to the new API. + if (!needsMigration) { + return ReactChildren.map(_this.props.children, function (child) { - /** - * Callback that is called when resizer has been released - * and column needs to be updated. - * - * Required if the isResizable property is true on any column. - * - * ``` - * function( - * newColumnWidth: number, - * dataKey: string, - * ) - * ``` - */ - onColumnResizeEndCallback: PropTypes.func, + if (!child) { + return null; + } - /** - * Whether a column is currently being resized. - */ - isColumnResizing: PropTypes.bool }, + if (child.type.__TableColumn__) { + return React.createElement(Column, child.props); + } - getInitialState: function getInitialState() { - // Throw warnings on deprecated props. - var state = {}; - state.needsMigration = this._checkDeprecations(); + if (child.type.__TableColumnGroup__) { + return React.createElement(ColumnGroup, child.props); + } + }); + } - return state; - }, + var tableProps = _this.props; - _checkDeprecations: function _checkDeprecations() { - var needsMigration = false; + // Otherwise, if a migration is needed, we need to transform each Column + // or ColumnGroup. + var i = 0; + return ReactChildren.map(_this.props.children, function (child) { - if (this.props.rowGetter) { - notifyDeprecated('rowGetter', 'Please use the cell API in Column to fetch data for your cells.'); + if (!child) { + return null; + } - // ROWGETTER??? You need to migrate. - needsMigration = true; - } + if (child.type.__TableColumn__) { + child = _this._transformColumn(child, tableProps, i); + } - if (this.props.headerDataGetter) { - notifyDeprecated('headerDataGetter', 'Please use the header API in Column to ' + 'fetch data for your header cells.'); - } + if (child.type.__TableColumnGroup__) { + // Since we apparently give an array of labels to groupHeaderRenderer + var labels = []; + ReactChildren.forEach(_this.props.children, function (child) { + labels.push(child.props.label); + }); - if (this.props.footerData) { - notifyDeprecated('footerData', 'Please use the footer API in Column to ' + 'fetch data for your footer cells.'); - } + child = _this._transformColumnGroup(child, tableProps, i, labels); + } - if (this.props.footerDataGetter) { - notifyDeprecated('footerDataGetter', 'Please use the footer API in Column to ' + 'fetch data for your footer cells.'); - } + i++; + return child; + }); + }; - ReactChildren.forEach(this.props.children, function (child) { - if (!child || !child.props) { - return; - } + var state = {}; + state.needsMigration = this._checkDeprecations(); - var props = child.props; + this.state = state; + } - if (props.label) { - notifyDeprecated('label', 'Please use `header` instead.'); - } + _createClass(TransitionTable, [{ + key: 'render', + value: function render() { + var props = this.props; + return React.createElement( + Table, + _extends({}, props, { + onRowMouseDown: this._onRowAction(props, props.onRowMouseDown), + onRowClick: this._onRowAction(props, props.onRowClick), + onRowDoubleClick: this._onRowAction(props, props.onRowDoubleClick), + onRowMouseEnter: this._onRowAction(props, props.onRowMouseEnter), + onRowMouseLeave: this._onRowAction(props, props.onRowMouseLeave) + }), + this._convertedColumns(this.state.needsMigration) + ); + } + }]); - if (props.dataKey) { - notifyDeprecated('dataKey', 'Please use the `cell` API to pass in a dataKey'); - } + return TransitionTable; + })(React.Component); - if (props.cellRenderer) { - notifyDeprecated('cellRenderer', 'Please use the `cell` API to pass in a React Element instead.'); - } + module.exports = TransitionTable; - if (props.headerRenderer) { - notifyDeprecated('headerRenderer', 'Please use the `header` API to pass in a React Element instead.'); - } + // Wrapper for onRow callbacks, since we don't have rowData at that level. - if (props.columnData) { - notifyDeprecated('columnData', 'Please pass data in through props to your header, cell or footer.'); - } +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { - if (props.groupHeaderRenderer) { - notifyDeprecated('groupHeaderRenderer', 'Please use the `header` API in ColumnGroup to ' + 'pass in a React Element instead of a function that creates one.'); - } + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ - if (props.groupHeaderData) { - notifyDeprecated('groupHeaderData', 'Please pass in any data through props to your header.'); - } - }); + if (process.env.NODE_ENV !== 'production') { + var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && + Symbol.for && + Symbol.for('react.element')) || + 0xeac7; - return needsMigration; - }, + var isValidElement = function(object) { + return typeof object === 'object' && + object !== null && + object.$$typeof === REACT_ELEMENT_TYPE; + }; - // Wrapper for onRow callbacks, since we don't have rowData at that level. - _onRowAction: function _onRowAction(props, callback) { - if (!callback) { - return undefined; - } + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = __webpack_require__(29)(isValidElement, throwOnDirectAccess); + } else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = __webpack_require__(33)(); + } - return function (e, rowIndex) { - callback(e, rowIndex, props.rowGetter && props.rowGetter(rowIndex) || EMPTY_OBJECT); - }; - }, + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28))) - _transformColumn: function _transformColumn(column, tableProps, key) { - - var props = column.props; - - if (column.type.__TableColumn__) { - // Constuct the cell to be used using the rowGetter - return React.createElement(Column, _extends({ - key: 'column_' + key - }, props, { - header: React.createElement(TransitionCell, { - isHeaderCell: true, - label: props.label, - width: props.width, - dataKey: props.dataKey, - className: props.headerClassName, - columnData: props.columnData || EMPTY_OBJECT, - cellRenderer: props.headerRenderer, - headerDataGetter: tableProps.headerDataGetter - }), - columnKey: props.dataKey, - cell: React.createElement(TransitionCell, { - dataKey: props.dataKey, - className: props.cellClassName, - rowGetter: tableProps.rowGetter, - width: props.width, - columnData: props.columnData || EMPTY_OBJECT, - cellDataGetter: props.cellDataGetter, - cellRenderer: props.cellRenderer - }), - footer: React.createElement(TransitionCell, { - isFooterCell: true, - className: props.footerClassName, - dataKey: props.dataKey, - cellRenderer: props.footerRenderer, - footerDataGetter: tableProps.footerDataGetter, - footerData: tableProps.footerData || EMPTY_OBJECT - }) - })); - } - }, +/***/ }), +/* 28 */ +/***/ (function(module, exports) { - _transformColumnGroup: function _transformColumnGroup(group, tableProps, key, labels) { - var _this = this; + // shim for using process in browser + var process = module.exports = {}; - var props = group.props; + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. - var j = 0; - var columns = ReactChildren.map(props.children, function (child) { - j++; - return _this._transformColumn(child, tableProps, key + '_' + j); - }); + var cachedSetTimeout; + var cachedClearTimeout; - return React.createElement( - ColumnGroup, - _extends({}, props, { - key: 'group_' + key, - header: React.createElement(TransitionCell, { - isHeaderCell: true, - label: group.props.label, - dataKey: key, - groupHeaderRenderer: props.groupHeaderRenderer, - groupHeaderLabels: labels, - groupHeaderData: props.columnGroupData || EMPTY_OBJECT - }) }), - columns - ); - }, - - _convertedColumns: function _convertedColumns(needsMigration) { - var _this2 = this; - - // If we don't need to migrate, map directly to the new API. - if (!needsMigration) { - return ReactChildren.map(this.props.children, function (child) { - - if (!child) { - return null; + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; } - - if (child.type.__TableColumn__) { - return React.createElement(Column, child.props); + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); } + } - if (child.type.__TableColumnGroup__) { - return React.createElement(ColumnGroup, child.props); + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); } - }); } - var tableProps = this.props; - // Otherwise, if a migration is needed, we need to transform each Column - // or ColumnGroup. - var i = 0; - return ReactChildren.map(this.props.children, function (child) { - if (!child) { - return null; - } + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; - if (child.type.__TableColumn__) { - child = _this2._transformColumn(child, tableProps, i); - } + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } - if (child.type.__TableColumnGroup__) { - // Since we apparently give an array of labels to groupHeaderRenderer - var labels = []; - ReactChildren.forEach(_this2.props.children, function (child) { - labels.push(child.props.label); - }); + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - child = _this2._transformColumnGroup(child, tableProps, i, labels); - } + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } - i++; - return child; - }); - }, + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; - render: function render() { - var props = this.props; - return React.createElement( - Table, - _extends({}, props, { - onRowMouseDown: this._onRowAction(props, props.onRowMouseDown), - onRowClick: this._onRowAction(props, props.onRowClick), - onRowDoubleClick: this._onRowAction(props, props.onRowDoubleClick), - onRowMouseEnter: this._onRowAction(props, props.onRowMouseEnter), - onRowMouseLeave: this._onRowAction(props, props.onRowMouseLeave) - }), - this._convertedColumns(this.state.needsMigration) - ); - } }); + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { return [] } + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; - module.exports = TransitionTable; + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; -/***/ }, -/* 27 */ -/***/ function(module, exports, __webpack_require__) { - /** - * Copyright (c) 2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. * - * @providesModule React + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ 'use strict'; - module.exports = __webpack_require__(28); + var assign = __webpack_require__(30); -/***/ }, -/* 28 */ -/***/ function(module, exports, __webpack_require__) { + var ReactPropTypesSecret = __webpack_require__(31); + var checkPropTypes = __webpack_require__(32); - module.exports = __WEBPACK_EXTERNAL_MODULE_28__; + var printWarning = function() {}; -/***/ }, -/* 29 */ -/***/ function(module, exports, __webpack_require__) { + if (process.env.NODE_ENV !== 'production') { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + } - /** - * Copyright (c) 2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule FixedDataTableNew.react - * @typechecks - * @noflow - */ + function emptyFunctionThatReturnsNull() { + return null; + } - /*eslint no-bitwise:1*/ + module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. - 'use strict'; + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ - var React = __webpack_require__(27); - var ReactComponentWithPureRenderMixin = __webpack_require__(31); - var ReactWheelHandler = __webpack_require__(32); - var Scrollbar = __webpack_require__(40); - var FixedDataTableBufferedRows = __webpack_require__(54); - var FixedDataTableColumnResizeHandle = __webpack_require__(68); - var FixedDataTableRow = __webpack_require__(59); - var FixedDataTableScrollHelper = __webpack_require__(69); - var FixedDataTableWidthHelper = __webpack_require__(30); - - var cx = __webpack_require__(48); - var debounceCore = __webpack_require__(71); - var emptyFunction = __webpack_require__(33); - var invariant = __webpack_require__(53); - var joinClasses = __webpack_require__(67); - var shallowEqual = __webpack_require__(72); - var translateDOMPositionXY = __webpack_require__(49); - - var PropTypes = React.PropTypes; + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; - var ReactChildren = React.Children; + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ - var EMPTY_OBJECT = {}; - var BORDER_HEIGHT = 1; - var HEADER = 'header'; - var FOOTER = 'footer'; - var CELL = 'cell'; + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } - /** - * Data grid component with fixed or scrollable header and columns. - * - * The layout of the data table is as follows: - * - * ``` - * +---------------------------------------------------+ - * | Fixed Column Group | Scrollable Column Group | - * | Header | Header | - * | | | - * +---------------------------------------------------+ - * | | | - * | Fixed Header Columns | Scrollable Header Columns | - * | | | - * +-----------------------+---------------------------+ - * | | | - * | Fixed Body Columns | Scrollable Body Columns | - * | | | - * +-----------------------+---------------------------+ - * | | | - * | Fixed Footer Columns | Scrollable Footer Columns | - * | | | - * +-----------------------+---------------------------+ - * ``` - * - * - Fixed Column Group Header: These are the headers for a group - * of columns if included in the table that do not scroll - * vertically or horizontally. - * - * - Scrollable Column Group Header: The header for a group of columns - * that do not move while scrolling vertically, but move horizontally - * with the horizontal scrolling. - * - * - Fixed Header Columns: The header columns that do not move while scrolling - * vertically or horizontally. - * - * - Scrollable Header Columns: The header columns that do not move - * while scrolling vertically, but move horizontally with the horizontal - * scrolling. - * - * - Fixed Body Columns: The body columns that do not move while scrolling - * horizontally, but move vertically with the vertical scrolling. - * - * - Scrollable Body Columns: The body columns that move while scrolling - * vertically or horizontally. - */ - var FixedDataTable = React.createClass({ - displayName: 'FixedDataTable', + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); - propTypes: { + return chainedCheckType; + } - /** - * Pixel width of table. If all columns do not fit, - * a horizontal scrollbar will appear. - */ - width: PropTypes.number.isRequired, + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - /** - * Pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - height: PropTypes.number, + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } - /** - * Maximum pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - maxHeight: PropTypes.number, + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } - /** - * Pixel height of table's owner, this is used in a managed scrolling - * situation when you want to slide the table up from below the fold - * without having to constantly update the height on every scroll tick. - * Instead, vary this property on scroll. By using `ownerHeight`, we - * over-render the table while making sure the footer and horizontal - * scrollbar of the table are visible when the current space for the table - * in view is smaller than the final, over-flowing height of table. It - * allows us to avoid resizing and reflowing table when it is moving in the - * view. - * - * This is used if `ownerHeight < height` (or `maxHeight`). - */ - ownerHeight: PropTypes.number, + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - overflowX: PropTypes.oneOf(['hidden', 'auto']), - overflowY: PropTypes.oneOf(['hidden', 'auto']), + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - /** - * Number of rows in the table. - */ - rowsCount: PropTypes.number.isRequired, + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } - /** - * Pixel height of rows unless `rowHeightGetter` is specified and returns - * different value. - */ - rowHeight: PropTypes.number.isRequired, + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } - /** - * If specified, `rowHeightGetter(index)` is called for each row and the - * returned value overrides `rowHeight` for particular row. - */ - rowHeightGetter: PropTypes.func, + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } - /** - * To get any additional CSS classes that should be added to a row, - * `rowClassNameGetter(index)` is called. - */ - rowClassNameGetter: PropTypes.func, + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } - /** - * Pixel height of the column group header. - */ - groupHeaderHeight: PropTypes.number, - - /** - * Pixel height of header. - */ - headerHeight: PropTypes.number.isRequired, - - /** - * Pixel height of footer. - */ - footerHeight: PropTypes.number, - - /** - * Value of horizontal scroll. - */ - scrollLeft: PropTypes.number, - - /** - * Index of column to scroll to. - */ - scrollToColumn: PropTypes.number, - - /** - * Value of vertical scroll. - */ - scrollTop: PropTypes.number, - - /** - * Index of row to scroll to. - */ - scrollToRow: PropTypes.number, - - /** - * Callback that is called when scrolling starts with current horizontal - * and vertical scroll values. - */ - onScrollStart: PropTypes.func, - - /** - * Callback that is called when scrolling ends or stops with new horizontal - * and vertical scroll values. - */ - onScrollEnd: PropTypes.func, + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } - /** - * Callback that is called when `rowHeightGetter` returns a different height - * for a row than the `rowHeight` prop. This is necessary because initially - * table estimates heights of some parts of the content. - */ - onContentHeightChange: PropTypes.func, + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } - /** - * Callback that is called when a row is clicked. - */ - onRowClick: PropTypes.func, + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } + } - /** - * Callback that is called when a row is double clicked. - */ - onRowDoubleClick: PropTypes.func, + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } - /** - * Callback that is called when a mouse-down event happens on a row. - */ - onRowMouseDown: PropTypes.func, + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } - /** - * Callback that is called when a mouse-enter event happens on a row. - */ - onRowMouseEnter: PropTypes.func, + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } - /** - * Callback that is called when a mouse-leave event happens on a row. - */ - onRowMouseLeave: PropTypes.func, + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } - /** - * Callback that is called when resizer has been released - * and column needs to be updated. - * - * Required if the isResizable property is true on any column. - * - * ``` - * function( - * newColumnWidth: number, - * columnKey: string, - * ) - * ``` - */ - onColumnResizeEndCallback: PropTypes.func, + return createChainableTypeChecker(validate); + } - /** - * Whether a column is currently being resized. - */ - isColumnResizing: PropTypes.bool }, + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } - getDefaultProps: function getDefaultProps() /*object*/{ - return { - footerHeight: 0, - groupHeaderHeight: 0, - headerHeight: 0, - scrollLeft: 0, - scrollTop: 0 }; - }, + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } - getInitialState: function getInitialState() /*object*/{ - var props = this.props; - var viewportHeight = (props.height === undefined ? props.maxHeight : props.height) - (props.headerHeight || 0) - (props.footerHeight || 0) - (props.groupHeaderHeight || 0); - this._scrollHelper = new FixedDataTableScrollHelper(props.rowsCount, props.rowHeight, viewportHeight, props.rowHeightGetter); - if (props.scrollTop) { - this._scrollHelper.scrollTo(props.scrollTop); + return true; + default: + return false; } - this._didScrollStop = debounceCore(this._didScrollStop, 200, this); - - return this._calculateState(this.props); - }, + } - componentWillMount: function componentWillMount() { - var scrollToRow = this.props.scrollToRow; - if (scrollToRow !== undefined && scrollToRow !== null) { - this._rowToScrollTo = scrollToRow; - } - var scrollToColumn = this.props.scrollToColumn; - if (scrollToColumn !== undefined && scrollToColumn !== null) { - this._columnToScrollTo = scrollToColumn; + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; } - this._wheelHandler = new ReactWheelHandler(this._onWheel, this._shouldHandleWheelX, this._shouldHandleWheelY); - }, - _shouldHandleWheelX: function _shouldHandleWheelX( /*number*/delta) /*boolean*/{ - if (this.props.overflowX === 'hidden') { - return false; + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; } - delta = Math.round(delta); - if (delta === 0) { - return false; + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; } - return delta < 0 && this.state.scrollX > 0 || delta >= 0 && this.state.scrollX < this.state.maxScrollX; - }, - - _shouldHandleWheelY: function _shouldHandleWheelY( /*number*/delta) /*boolean*/{ - if (this.props.overflowY === 'hidden' || delta === 0) { - return false; - } + return false; + } - delta = Math.round(delta); - if (delta === 0) { - return false; + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; } - - return delta < 0 && this.state.scrollY > 0 || delta >= 0 && this.state.scrollY < this.state.maxScrollY; - }, - - _reportContentHeight: function _reportContentHeight() { - var scrollContentHeight = this.state.scrollContentHeight; - var reservedHeight = this.state.reservedHeight; - var requiredHeight = scrollContentHeight + reservedHeight; - var contentHeight; - var useMaxHeight = this.props.height === undefined; - if (useMaxHeight && this.props.maxHeight > requiredHeight) { - contentHeight = requiredHeight; - } else if (this.state.height > requiredHeight && this.props.ownerHeight) { - contentHeight = Math.max(requiredHeight, this.props.ownerHeight); - } else { - contentHeight = this.state.height + this.state.maxScrollY; + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; } - if (contentHeight !== this._contentHeight && this.props.onContentHeightChange) { - this.props.onContentHeightChange(contentHeight); + if (isSymbol(propType, propValue)) { + return 'symbol'; } - this._contentHeight = contentHeight; - }, - - componentDidMount: function componentDidMount() { - this._reportContentHeight(); - }, + return propType; + } - componentWillReceiveProps: function componentWillReceiveProps( /*object*/nextProps) { - var scrollToRow = nextProps.scrollToRow; - if (scrollToRow !== undefined && scrollToRow !== null) { - this._rowToScrollTo = scrollToRow; - } - var scrollToColumn = nextProps.scrollToColumn; - if (scrollToColumn !== undefined && scrollToColumn !== null) { - this._columnToScrollTo = scrollToColumn; + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } } + return propType; + } - var newOverflowX = nextProps.overflowX; - var newOverflowY = nextProps.overflowY; - if (newOverflowX !== this.props.overflowX || newOverflowY !== this.props.overflowY) { - this._wheelHandler = new ReactWheelHandler(this._onWheel, newOverflowX !== 'hidden', // Should handle horizontal scroll - newOverflowY !== 'hidden' // Should handle vertical scroll - ); + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; } + } - // In the case of controlled scrolling, notify. - if (this.props.ownerHeight !== nextProps.ownerHeight || this.props.scrollTop !== nextProps.scrollTop) { - this._didScrollStart(); + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; } - this._didScrollStop(); + return propValue.constructor.name; + } - this.setState(this._calculateState(nextProps, this.state)); - }, + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.PropTypes = ReactPropTypes; - componentDidUpdate: function componentDidUpdate() { - this._reportContentHeight(); - }, + return ReactPropTypes; + }; - render: function render() /*object*/{ - var state = this.state; - var props = this.props; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28))) - var groupHeader; - if (state.useGroupHeader) { - groupHeader = React.createElement(FixedDataTableRow, { - key: 'group_header', - isScrolling: this._isScrolling, - className: joinClasses(cx('fixedDataTableLayout/header'), cx('public/fixedDataTable/header')), - width: state.width, - height: state.groupHeaderHeight, - index: 0, - zIndex: 1, - offsetTop: 0, - scrollLeft: state.scrollX, - fixedColumns: state.groupHeaderFixedColumns, - scrollableColumns: state.groupHeaderScrollableColumns, - onColumnResize: this._onColumnResize - }); - } +/***/ }), +/* 30 */ +/***/ (function(module, exports) { - var maxScrollY = this.state.maxScrollY; - var showScrollbarX = state.maxScrollX > 0 && state.overflowX !== 'hidden'; - var showScrollbarY = maxScrollY > 0 && state.overflowY !== 'hidden'; - var scrollbarXHeight = showScrollbarX ? Scrollbar.SIZE : 0; - var scrollbarYHeight = state.height - scrollbarXHeight - 2 * BORDER_HEIGHT - state.footerHeight; + /* + object-assign + (c) Sindre Sorhus + @license MIT + */ - var headerOffsetTop = state.useGroupHeader ? state.groupHeaderHeight : 0; - var bodyOffsetTop = headerOffsetTop + state.headerHeight; - scrollbarYHeight -= bodyOffsetTop; - var bottomSectionOffset = 0; - var footOffsetTop = props.maxHeight != null ? bodyOffsetTop + state.bodyHeight : bodyOffsetTop + scrollbarYHeight; - var rowsContainerHeight = footOffsetTop + state.footerHeight; + 'use strict'; + /* eslint-disable no-unused-vars */ + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var propIsEnumerable = Object.prototype.propertyIsEnumerable; - if (props.ownerHeight !== undefined && props.ownerHeight < state.height) { - bottomSectionOffset = props.ownerHeight - state.height; + function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } - footOffsetTop = Math.min(footOffsetTop, props.ownerHeight - state.footerHeight - scrollbarXHeight); + return Object(val); + } - scrollbarYHeight = Math.max(0, footOffsetTop - bodyOffsetTop); - } + function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } + } - var verticalScrollbar; - if (showScrollbarY) { - verticalScrollbar = React.createElement(Scrollbar, { - size: scrollbarYHeight, - contentSize: scrollbarYHeight + maxScrollY, - onScroll: this._onVerticalScroll, - verticalTop: bodyOffsetTop, - position: state.scrollY - }); - } - - var horizontalScrollbar; - if (showScrollbarX) { - var scrollbarXWidth = state.width; - horizontalScrollbar = React.createElement(HorizontalScrollbar, { - contentSize: scrollbarXWidth + state.maxScrollX, - offset: bottomSectionOffset, - onScroll: this._onHorizontalScroll, - position: state.scrollX, - size: scrollbarXWidth - }); - } + module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; + }; - var dragKnob = React.createElement(FixedDataTableColumnResizeHandle, { - height: state.height, - initialWidth: state.columnResizingData.width || 0, - minWidth: state.columnResizingData.minWidth || 0, - maxWidth: state.columnResizingData.maxWidth || Number.MAX_VALUE, - visible: !!state.isColumnResizing, - leftOffset: state.columnResizingData.left || 0, - knobHeight: state.headerHeight, - initialEvent: state.columnResizingData.initialEvent, - onColumnResizeEnd: props.onColumnResizeEndCallback, - columnKey: state.columnResizingData.key - }); - var footer = null; - if (state.footerHeight) { - footer = React.createElement(FixedDataTableRow, { - key: 'footer', - isScrolling: this._isScrolling, - className: joinClasses(cx('fixedDataTableLayout/footer'), cx('public/fixedDataTable/footer')), - width: state.width, - height: state.footerHeight, - index: -1, - zIndex: 1, - offsetTop: footOffsetTop, - fixedColumns: state.footFixedColumns, - scrollableColumns: state.footScrollableColumns, - scrollLeft: state.scrollX - }); - } +/***/ }), +/* 31 */ +/***/ (function(module, exports) { - var rows = this._renderRows(bodyOffsetTop); + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ - var header = React.createElement(FixedDataTableRow, { - key: 'header', - isScrolling: this._isScrolling, - className: joinClasses(cx('fixedDataTableLayout/header'), cx('public/fixedDataTable/header')), - width: state.width, - height: state.headerHeight, - index: -1, - zIndex: 1, - offsetTop: headerOffsetTop, - scrollLeft: state.scrollX, - fixedColumns: state.headFixedColumns, - scrollableColumns: state.headScrollableColumns, - onColumnResize: this._onColumnResize - }); + 'use strict'; - var topShadow; - var bottomShadow; - if (state.scrollY) { - topShadow = React.createElement('div', { - className: joinClasses(cx('fixedDataTableLayout/topShadow'), cx('public/fixedDataTable/topShadow')), - style: { top: bodyOffsetTop } - }); - } + var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - if (state.ownerHeight != null && state.ownerHeight < state.height && state.scrollContentHeight + state.reservedHeight > state.ownerHeight || state.scrollY < maxScrollY) { - bottomShadow = React.createElement('div', { - className: joinClasses(cx('fixedDataTableLayout/bottomShadow'), cx('public/fixedDataTable/bottomShadow')), - style: { top: footOffsetTop } - }); - } + module.exports = ReactPropTypesSecret; - return React.createElement( - 'div', - { - className: joinClasses(cx('fixedDataTableLayout/main'), cx('public/fixedDataTable/main')), - onWheel: this._wheelHandler.onWheel, - style: { height: state.height, width: state.width } }, - React.createElement( - 'div', - { - className: cx('fixedDataTableLayout/rowsContainer'), - style: { height: rowsContainerHeight, width: state.width } }, - dragKnob, - groupHeader, - header, - rows, - footer, - topShadow, - bottomShadow - ), - verticalScrollbar, - horizontalScrollbar - ); - }, - _renderRows: function _renderRows( /*number*/offsetTop) /*object*/{ - var state = this.state; +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { - return React.createElement(FixedDataTableBufferedRows, { - isScrolling: this._isScrolling, - defaultRowHeight: state.rowHeight, - firstRowIndex: state.firstRowIndex, - firstRowOffset: state.firstRowOffset, - fixedColumns: state.bodyFixedColumns, - height: state.bodyHeight, - offsetTop: offsetTop, - onRowClick: state.onRowClick, - onRowDoubleClick: state.onRowDoubleClick, - onRowMouseDown: state.onRowMouseDown, - onRowMouseEnter: state.onRowMouseEnter, - onRowMouseLeave: state.onRowMouseLeave, - rowClassNameGetter: state.rowClassNameGetter, - rowsCount: state.rowsCount, - rowGetter: state.rowGetter, - rowHeightGetter: state.rowHeightGetter, - scrollLeft: state.scrollX, - scrollableColumns: state.bodyScrollableColumns, - showLastRowBorder: true, - width: state.width, - rowPositionGetter: this._scrollHelper.getRowPosition - }); - }, + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ - /** - * This is called when a cell that is in the header of a column has its - * resizer knob clicked on. It displays the resizer and puts in the correct - * location on the table. - */ - _onColumnResize: function _onColumnResize( - /*number*/combinedWidth, - /*number*/leftOffset, - /*number*/cellWidth, - /*?number*/cellMinWidth, - /*?number*/cellMaxWidth, - /*number|string*/columnKey, - /*object*/event) { - this.setState({ - isColumnResizing: true, - columnResizingData: { - left: leftOffset + combinedWidth - cellWidth, - width: cellWidth, - minWidth: cellMinWidth, - maxWidth: cellMaxWidth, - initialEvent: { - clientX: event.clientX, - clientY: event.clientY, - preventDefault: emptyFunction - }, - key: columnKey - } - }); - }, + 'use strict'; - _areColumnSettingsIdentical: function _areColumnSettingsIdentical(oldColumns, newColumns) { - if (oldColumns.length !== newColumns.length) { - return false; - } - for (var index = 0; index < oldColumns.length; ++index) { - if (!shallowEqual(oldColumns[index].props, newColumns[index].props)) { - return false; - } - } - return true; - }, + var printWarning = function() {}; - _populateColumnsAndColumnData: function _populateColumnsAndColumnData(columns, columnGroups, oldState) { - var canReuseColumnSettings = false; - var canReuseColumnGroupSettings = false; + if (process.env.NODE_ENV !== 'production') { + var ReactPropTypesSecret = __webpack_require__(31); + var loggedTypeFailures = {}; - if (oldState && oldState.columns) { - canReuseColumnSettings = this._areColumnSettingsIdentical(columns, oldState.columns); - } - if (oldState && oldState.columnGroups && columnGroups) { - canReuseColumnGroupSettings = this._areColumnSettingsIdentical(columnGroups, oldState.columnGroups); + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + } - var columnInfo = {}; - if (canReuseColumnSettings) { - columnInfo.bodyFixedColumns = oldState.bodyFixedColumns; - columnInfo.bodyScrollableColumns = oldState.bodyScrollableColumns; - columnInfo.headFixedColumns = oldState.headFixedColumns; - columnInfo.headScrollableColumns = oldState.headScrollableColumns; - columnInfo.footFixedColumns = oldState.footFixedColumns; - columnInfo.footScrollableColumns = oldState.footScrollableColumns; - } else { - var bodyColumnTypes = this._splitColumnTypes(columns); - columnInfo.bodyFixedColumns = bodyColumnTypes.fixed; - columnInfo.bodyScrollableColumns = bodyColumnTypes.scrollable; + /** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ + function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + ); + err.name = 'Invariant Violation'; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ) - var headColumnTypes = this._splitColumnTypes(this._selectColumnElement(HEADER, columns)); - columnInfo.headFixedColumns = headColumnTypes.fixed; - columnInfo.headScrollableColumns = headColumnTypes.scrollable; + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; - var footColumnTypes = this._splitColumnTypes(this._selectColumnElement(FOOTER, columns)); - columnInfo.footFixedColumns = footColumnTypes.fixed; - columnInfo.footScrollableColumns = footColumnTypes.scrollable; - } + var stack = getStack ? getStack() : ''; - if (canReuseColumnGroupSettings) { - columnInfo.groupHeaderFixedColumns = oldState.groupHeaderFixedColumns; - columnInfo.groupHeaderScrollableColumns = oldState.groupHeaderScrollableColumns; - } else { - if (columnGroups) { - var groupHeaderColumnTypes = this._splitColumnTypes(this._selectColumnElement(HEADER, columnGroups)); - columnInfo.groupHeaderFixedColumns = groupHeaderColumnTypes.fixed; - columnInfo.groupHeaderScrollableColumns = groupHeaderColumnTypes.scrollable; + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } } } + } + } - return columnInfo; - }, + module.exports = checkPropTypes; - _calculateState: function _calculateState( /*object*/props, /*?object*/oldState) /*object*/{ - invariant(props.height !== undefined || props.maxHeight !== undefined, 'You must set either a height or a maxHeight'); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28))) - var children = []; - ReactChildren.forEach(props.children, function (child, index) { - if (child == null) { - return; - } - invariant(child.type.__TableColumnGroup__ || child.type.__TableColumn__, 'child type should be or ' + ''); - children.push(child); - }); +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { - var useGroupHeader = false; - if (children.length && children[0].type.__TableColumnGroup__) { - useGroupHeader = true; - } + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ - var firstRowIndex = oldState && oldState.firstRowIndex || 0; - var firstRowOffset = oldState && oldState.firstRowOffset || 0; - var scrollX, scrollY; - if (oldState && props.overflowX !== 'hidden') { - scrollX = oldState.scrollX; - } else { - scrollX = props.scrollLeft; - } - if (oldState && props.overflowY !== 'hidden') { - scrollY = oldState.scrollY; - } else { - scrollState = this._scrollHelper.scrollTo(props.scrollTop); - firstRowIndex = scrollState.index; - firstRowOffset = scrollState.offset; - scrollY = scrollState.position; - } + 'use strict'; - if (this._rowToScrollTo !== undefined) { - scrollState = this._scrollHelper.scrollRowIntoView(this._rowToScrollTo); - firstRowIndex = scrollState.index; - firstRowOffset = scrollState.offset; - scrollY = scrollState.position; - delete this._rowToScrollTo; + var ReactPropTypesSecret = __webpack_require__(31); + + function emptyFunction() {} + + module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim + }; - var groupHeaderHeight = useGroupHeader ? props.groupHeaderHeight : 0; + ReactPropTypes.checkPropTypes = emptyFunction; + ReactPropTypes.PropTypes = ReactPropTypes; - if (oldState && props.rowsCount !== oldState.rowsCount) { + return ReactPropTypes; + }; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule React + */ + + 'use strict'; + + module.exports = __webpack_require__(35); + +/***/ }), +/* 35 */ +/***/ (function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_35__; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } + + var PropTypes = __webpack_require__(27); + /** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule FixedDataTableNew.react + * @typechecks + * @noflow + */ + + /*eslint no-bitwise:1*/ + + var React = __webpack_require__(34); + var createReactClass = __webpack_require__(37); + var ReactComponentWithPureRenderMixin = __webpack_require__(43); + var ReactWheelHandler = __webpack_require__(44); + var Scrollbar = __webpack_require__(52); + var FixedDataTableBufferedRows = __webpack_require__(66); + var FixedDataTableColumnResizeHandle = __webpack_require__(80); + var FixedDataTableRow = __webpack_require__(71); + var FixedDataTableScrollHelper = __webpack_require__(81); + var FixedDataTableWidthHelper = __webpack_require__(83); + + var cx = __webpack_require__(60); + var debounceCore = __webpack_require__(84); + var emptyFunction = __webpack_require__(45); + var invariant = __webpack_require__(65); + var joinClasses = __webpack_require__(79); + var shallowEqual = __webpack_require__(85); + var translateDOMPositionXY = __webpack_require__(61); + var throttle = __webpack_require__(86); + + var ReactChildren = React.Children; + + var EMPTY_OBJECT = {}; + var BORDER_HEIGHT = 1; + var HEADER = "header"; + var FOOTER = "footer"; + var CELL = "cell"; + + /** + * Data grid component with fixed or scrollable header and columns. + * + * The layout of the data table is as follows: + * + * ``` + * +---------------------------------------------------+ + * | Fixed Column Group | Scrollable Column Group | + * | Header | Header | + * | | | + * +---------------------------------------------------+ + * | | | + * | Fixed Header Columns | Scrollable Header Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Body Columns | Scrollable Body Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Footer Columns | Scrollable Footer Columns | + * | | | + * +-----------------------+---------------------------+ + * ``` + * + * - Fixed Column Group Header: These are the headers for a group + * of columns if included in the table that do not scroll + * vertically or horizontally. + * + * - Scrollable Column Group Header: The header for a group of columns + * that do not move while scrolling vertically, but move horizontally + * with the horizontal scrolling. + * + * - Fixed Header Columns: The header columns that do not move while scrolling + * vertically or horizontally. + * + * - Scrollable Header Columns: The header columns that do not move + * while scrolling vertically, but move horizontally with the horizontal + * scrolling. + * + * - Fixed Body Columns: The body columns that do not move while scrolling + * horizontally, but move vertically with the vertical scrolling. + * + * - Scrollable Body Columns: The body columns that move while scrolling + * vertically or horizontally. + */ + var FixedDataTable = createReactClass({ + displayName: "FixedDataTable", + + propTypes: { + /** + * Pixel width of table. If all columns do not fit, + * a horizontal scrollbar will appear. + */ + width: PropTypes.number.isRequired, + + /** + * Pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + height: PropTypes.number, + + /** + * Maximum pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + maxHeight: PropTypes.number, + + /** + * Pixel height of table's owner, this is used in a managed scrolling + * situation when you want to slide the table up from below the fold + * without having to constantly update the height on every scroll tick. + * Instead, vary this property on scroll. By using `ownerHeight`, we + * over-render the table while making sure the footer and horizontal + * scrollbar of the table are visible when the current space for the table + * in view is smaller than the final, over-flowing height of table. It + * allows us to avoid resizing and reflowing table when it is moving in the + * view. + * + * This is used if `ownerHeight < height` (or `maxHeight`). + */ + ownerHeight: PropTypes.number, + + overflowX: PropTypes.oneOf(["hidden", "auto"]), + overflowY: PropTypes.oneOf(["hidden", "auto"]), + + /** + * Number of rows in the table. + */ + rowsCount: PropTypes.number.isRequired, + + /** + * Pixel height of rows unless `rowHeightGetter` is specified and returns + * different value. + */ + rowHeight: PropTypes.number.isRequired, + + /** + * If specified, `rowHeightGetter(index)` is called for each row and the + * returned value overrides `rowHeight` for particular row. + */ + rowHeightGetter: PropTypes.func, + + /** + * To get any additional CSS classes that should be added to a row, + * `rowClassNameGetter(index)` is called. + */ + rowClassNameGetter: PropTypes.func, + + /** + * Pixel height of the column group header. + */ + groupHeaderHeight: PropTypes.number, + + /** + * Pixel height of header. + */ + headerHeight: PropTypes.number.isRequired, + + /** + * Pixel height of footer. + */ + footerHeight: PropTypes.number, + + /** + * Value of horizontal scroll. + */ + scrollLeft: PropTypes.number, + + /** + * Index of column to scroll to. + */ + scrollToColumn: PropTypes.number, + + /** + * Value of vertical scroll. + */ + scrollTop: PropTypes.number, + + /** + * Index of row to scroll to. + */ + scrollToRow: PropTypes.number, + + /** + * Callback that is called when scrolling starts with current horizontal + * and vertical scroll values. + */ + onScrollStart: PropTypes.func, + + /** + * Callback that is called during scrolling with current horizontal + * and vertical scroll values. + */ + onScroll: PropTypes.func, + + /** + * Number of milliseconds to throttle the onScroll event + */ + onScrollThrottle: PropTypes.number, + + /** + * Callback that is called when scrolling ends or stops with new horizontal + * and vertical scroll values. + */ + onScrollEnd: PropTypes.func, + + /** + * Callback that is called when `rowHeightGetter` returns a different height + * for a row than the `rowHeight` prop. This is necessary because initially + * table estimates heights of some parts of the content. + */ + onContentHeightChange: PropTypes.func, + + /** + * Callback that is called when a row is clicked. + */ + onRowClick: PropTypes.func, + + /** + * Callback that is called when a row is double clicked. + */ + onRowDoubleClick: PropTypes.func, + + /** + * Callback that is called when a mouse-down event happens on a row. + */ + onRowMouseDown: PropTypes.func, + + /** + * Callback that is called when a mouse-enter event happens on a row. + */ + onRowMouseEnter: PropTypes.func, + + /** + * Callback that is called when a mouse-leave event happens on a row. + */ + onRowMouseLeave: PropTypes.func, + + /** + * Callback that is called when resizer has been released + * and column needs to be updated. + * + * Required if the isResizable property is true on any column. + * + * ``` + * function( + * newColumnWidth: number, + * columnKey: string, + * ) + * ``` + */ + onColumnResizeEndCallback: PropTypes.func, + + /** + * Whether a column is currently being resized. + */ + isColumnResizing: PropTypes.bool, + + /** + * CSS style props to pass to the box shadow that shows up on the fixed + * header while scrolling + */ + topShadowStyle: PropTypes.object, + + /** + * CSS style props to pass to the horizontal scrollbar + */ + horizontalScrollbarStyle: PropTypes.object + }, + + getDefaultProps: function getDefaultProps() /*object*/{ + return { + footerHeight: 0, + groupHeaderHeight: 0, + headerHeight: 0, + scrollLeft: 0, + scrollTop: 0, + topShadowStyle: {}, + horizontalScrollbarStyle: {} + }; + }, + + getInitialState: function getInitialState() /*object*/{ + var props = this.props; + var viewportHeight = (props.height === undefined ? props.maxHeight : props.height) - (props.headerHeight || 0) - (props.footerHeight || 0) - (props.groupHeaderHeight || 0); + this._scrollHelper = new FixedDataTableScrollHelper(props.rowsCount, props.rowHeight, viewportHeight, props.rowHeightGetter); + if (props.scrollTop) { + this._scrollHelper.scrollTo(props.scrollTop); + } + this._didScrollStop = debounceCore(this._didScrollStop, 200, this); + + return _extends({}, this._calculateState(this.props), { + isHoveringResizerKnob: false + }); + }, + + componentWillMount: function componentWillMount() { + var scrollToRow = this.props.scrollToRow; + if (scrollToRow !== undefined && scrollToRow !== null) { + this._rowToScrollTo = scrollToRow; + } + var scrollToColumn = this.props.scrollToColumn; + if (scrollToColumn !== undefined && scrollToColumn !== null) { + this._columnToScrollTo = scrollToColumn; + } + this._wheelHandler = new ReactWheelHandler(this._onWheel, this._shouldHandleWheelX, this._shouldHandleWheelY); + this._didScroll = throttle(this._didScroll, this.props.onScrollThrottle || 0); + }, + + _shouldHandleWheelX: function _shouldHandleWheelX( /*number*/delta) /*boolean*/{ + if (this.props.overflowX === "hidden") { + return false; + } + + delta = Math.round(delta); + if (delta === 0) { + return false; + } + + return delta < 0 && this.state.scrollX > 0 || delta >= 0 && this.state.scrollX < this.state.maxScrollX; + }, + + _shouldHandleWheelY: function _shouldHandleWheelY( /*number*/delta) /*boolean*/{ + if (this.props.overflowY === "hidden" || delta === 0) { + return false; + } + + delta = Math.round(delta); + if (delta === 0) { + return false; + } + + return delta < 0 && this.state.scrollY > 0 || delta >= 0 && this.state.scrollY < this.state.maxScrollY; + }, + + _reportContentHeight: function _reportContentHeight() { + var scrollContentHeight = this.state.scrollContentHeight; + var reservedHeight = this.state.reservedHeight; + var requiredHeight = scrollContentHeight + reservedHeight; + var contentHeight; + var useMaxHeight = this.props.height === undefined; + if (useMaxHeight && this.props.maxHeight > requiredHeight) { + contentHeight = requiredHeight; + } else if (this.state.height > requiredHeight && this.props.ownerHeight) { + contentHeight = Math.max(requiredHeight, this.props.ownerHeight); + } else { + contentHeight = this.state.height + this.state.maxScrollY; + } + if (contentHeight !== this._contentHeight && this.props.onContentHeightChange) { + this.props.onContentHeightChange(contentHeight); + } + this._contentHeight = contentHeight; + }, + + componentDidMount: function componentDidMount() { + this._reportContentHeight(); + this._isMounted = true; + }, + + componentWillReceiveProps: function componentWillReceiveProps( /*object*/nextProps) { + var scrollToRow = nextProps.scrollToRow; + if (scrollToRow !== undefined && scrollToRow !== null) { + this._rowToScrollTo = scrollToRow; + } + var scrollToColumn = nextProps.scrollToColumn; + if (scrollToColumn !== undefined && scrollToColumn !== null) { + this._columnToScrollTo = scrollToColumn; + } + + var newOverflowX = nextProps.overflowX; + var newOverflowY = nextProps.overflowY; + if (newOverflowX !== this.props.overflowX || newOverflowY !== this.props.overflowY) { + this._wheelHandler = new ReactWheelHandler(this._onWheel, newOverflowX !== "hidden", // Should handle horizontal scroll + newOverflowY !== "hidden" // Should handle vertical scroll + ); + } + + // In the case of controlled scrolling, notify. + if (this.props.ownerHeight !== nextProps.ownerHeight || this.props.scrollTop !== nextProps.scrollTop) { + this._didScrollStart(); + } + this._didScroll(); + this._didScrollStop(); + + this.setState(this._calculateState(nextProps, this.state)); + }, + + componentDidUpdate: function componentDidUpdate() { + this._reportContentHeight(); + }, + + render: function render() /*object*/{ + var state = this.state; + var props = this.props; + + var groupHeader; + if (state.useGroupHeader) { + groupHeader = React.createElement(FixedDataTableRow, { + key: "group_header", + isScrolling: this._isScrolling, + className: joinClasses(cx("fixedDataTableLayout/header"), cx("public/fixedDataTable/header")), + width: state.width, + height: state.groupHeaderHeight, + index: 0, + zIndex: 1, + offsetTop: 0, + scrollLeft: state.scrollX, + fixedColumns: state.groupHeaderFixedColumns, + scrollableColumns: state.groupHeaderScrollableColumns, + onColumnResize: this._onColumnResize, + setHoverState: this.setHoverState, + isColumnResizing: state.isColumnResizing + }); + } + + var maxScrollY = this.state.maxScrollY; + var showScrollbarX = state.maxScrollX > 0 && state.overflowX !== "hidden"; + var showScrollbarY = maxScrollY > 0 && state.overflowY !== "hidden"; + var scrollbarXHeight = showScrollbarX ? Scrollbar.SIZE : 0; + var scrollbarYHeight = state.height - scrollbarXHeight - 2 * BORDER_HEIGHT - state.footerHeight; + + var headerOffsetTop = state.useGroupHeader ? state.groupHeaderHeight : 0; + var bodyOffsetTop = headerOffsetTop + state.headerHeight; + scrollbarYHeight -= bodyOffsetTop; + var bottomSectionOffset = 0; + var footOffsetTop = props.maxHeight != null ? bodyOffsetTop + state.bodyHeight : bodyOffsetTop + scrollbarYHeight; + var rowsContainerHeight = footOffsetTop + state.footerHeight; + + if (props.ownerHeight !== undefined && props.ownerHeight < state.height) { + bottomSectionOffset = props.ownerHeight - state.height; + + footOffsetTop = Math.min(footOffsetTop, props.ownerHeight - state.footerHeight - scrollbarXHeight); + + scrollbarYHeight = Math.max(0, footOffsetTop - bodyOffsetTop); + } + + var verticalScrollbar; + if (showScrollbarY) { + verticalScrollbar = React.createElement(Scrollbar, { + size: scrollbarYHeight, + contentSize: scrollbarYHeight + maxScrollY, + onScroll: this._onVerticalScroll, + verticalTop: bodyOffsetTop, + position: state.scrollY + }); + } + + var horizontalScrollbar; + if (showScrollbarX) { + var scrollbarXWidth = state.width; + horizontalScrollbar = React.createElement(HorizontalScrollbar, { + contentSize: scrollbarXWidth + state.maxScrollX, + offset: bottomSectionOffset, + onScroll: this._onHorizontalScroll, + position: state.scrollX, + size: scrollbarXWidth, + horizontalScrollbarStyle: props.horizontalScrollbarStyle + }); + } + + var dragKnob = React.createElement(FixedDataTableColumnResizeHandle, { + height: state.height, + initialWidth: state.columnResizingData.width || 0, + minWidth: state.columnResizingData.minWidth || 0, + maxWidth: state.columnResizingData.maxWidth || Number.MAX_VALUE, + visible: !!state.isColumnResizing, + leftOffset: state.columnResizingData.left || 0, + knobHeight: state.headerHeight, + initialEvent: state.columnResizingData.initialEvent, + onColumnResizeEnd: props.onColumnResizeEndCallback, + columnKey: state.columnResizingData.key + }); + + var footer = null; + if (state.footerHeight) { + footer = React.createElement(FixedDataTableRow, { + key: "footer", + isScrolling: this._isScrolling, + className: joinClasses(cx("fixedDataTableLayout/footer"), cx("public/fixedDataTable/footer")), + width: state.width, + height: state.footerHeight, + index: -1, + zIndex: 1, + offsetTop: footOffsetTop, + fixedColumns: state.footFixedColumns, + scrollableColumns: state.footScrollableColumns, + scrollLeft: state.scrollX + }); + } + + var rows = this._renderRows(bodyOffsetTop); + + var header = React.createElement(FixedDataTableRow, { + key: "header", + isScrolling: this._isScrolling, + className: joinClasses(cx("fixedDataTableLayout/header"), cx("public/fixedDataTable/header")), + width: state.width, + height: state.headerHeight, + index: -1, + zIndex: 1, + offsetTop: headerOffsetTop, + scrollLeft: state.scrollX, + fixedColumns: state.headFixedColumns, + scrollableColumns: state.headScrollableColumns, + onColumnResize: this._onColumnResize, + isHoveringResizerKnob: state.isHoveringResizerKnob, + setHoverState: this.setHoverState, + isColumnResizing: state.isColumnResizing + }); + + var topShadow; + var bottomShadow; + if (state.scrollY) { + var topShadowStyle = {}; + // Kinda hacky, but we'll use the header columns to apply this styling + // fix for a renegade border style. + if (props.useTopShadow) { + var sumOfColumnWidths = [].concat(_toConsumableArray(state.headFixedColumns), _toConsumableArray(state.headScrollableColumns)).reduce(function (acc, column) { + return acc + column.props.width; + }, 0); + topShadowStyle = { + marginLeft: '3px', + width: sumOfColumnWidths + 'px', + maxWidth: 'calc(100% - 6px)' + }; + } + topShadow = React.createElement("div", { + className: joinClasses(cx("fixedDataTableLayout/topShadow"), cx("public/fixedDataTable/topShadow")), + style: _extends({}, topShadowStyle, { top: bodyOffsetTop }) + }); + } + + if (state.ownerHeight != null && state.ownerHeight < state.height && state.scrollContentHeight + state.reservedHeight > state.ownerHeight || state.scrollY < maxScrollY) { + bottomShadow = React.createElement("div", { + className: joinClasses(cx("fixedDataTableLayout/bottomShadow"), cx("public/fixedDataTable/bottomShadow")), + style: { top: footOffsetTop } + }); + } + + return React.createElement( + "div", + { + className: joinClasses(cx("fixedDataTableLayout/main"), cx("public/fixedDataTable/main")), + onWheel: this._wheelHandler.onWheel, + style: { height: state.height, width: state.width, opacity: this.state.isColumnResizing ? .4 : 1 } + }, + React.createElement( + "div", + { + className: cx("fixedDataTableLayout/rowsContainer"), + style: { height: rowsContainerHeight, width: state.width } + }, + dragKnob, + groupHeader, + header, + rows, + footer, + topShadow, + bottomShadow + ), + verticalScrollbar, + horizontalScrollbar + ); + }, + + componentWillUnmount: function componentWillUnmount() { + this._isMounted = false; + }, + + _renderRows: function _renderRows( /*number*/offsetTop) /*object*/{ + var state = this.state; + + return React.createElement(FixedDataTableBufferedRows, { + isScrolling: this._isScrolling, + defaultRowHeight: state.rowHeight, + firstRowIndex: state.firstRowIndex, + firstRowOffset: state.firstRowOffset, + fixedColumns: state.bodyFixedColumns, + height: state.bodyHeight, + offsetTop: offsetTop, + onRowClick: state.onRowClick, + onRowDoubleClick: state.onRowDoubleClick, + onRowMouseDown: state.onRowMouseDown, + onRowMouseEnter: state.onRowMouseEnter, + onRowMouseLeave: state.onRowMouseLeave, + rowClassNameGetter: state.rowClassNameGetter, + rowsCount: state.rowsCount, + rowGetter: state.rowGetter, + rowHeightGetter: state.rowHeightGetter, + scrollLeft: state.scrollX, + scrollableColumns: state.bodyScrollableColumns, + showLastRowBorder: true, + width: state.width, + rowPositionGetter: this._scrollHelper.getRowPosition, + onColumnResize: this._onColumnResize, + isHoveringResizerKnob: state.isHoveringResizerKnob, + setHoverState: this.setHoverState, + isColumnResizing: state.isColumnResizing + }); + }, + + /** + * This is called when a cell that is in the header of a column has its + * resizer knob clicked on. It displays the resizer and puts in the correct + * location on the table. + */ + _onColumnResize: function _onColumnResize( + /*number*/combinedWidth, + /*number*/leftOffset, + /*number*/cellWidth, + /*?number*/cellMinWidth, + /*?number*/cellMaxWidth, + /*number|string*/columnKey, + /*object*/event) { + this.setState({ + isColumnResizing: true, + columnResizingData: { + left: leftOffset + combinedWidth - cellWidth, + width: cellWidth, + minWidth: cellMinWidth, + maxWidth: cellMaxWidth, + initialEvent: { + clientX: event.clientX, + clientY: event.clientY, + preventDefault: emptyFunction + }, + key: columnKey + } + }); + }, + + _areColumnSettingsIdentical: function _areColumnSettingsIdentical(oldColumns, newColumns) { + if (oldColumns.length !== newColumns.length) { + return false; + } + for (var index = 0; index < oldColumns.length; ++index) { + if (!shallowEqual(oldColumns[index].props, newColumns[index].props)) { + return false; + } + } + return true; + }, + + _populateColumnsAndColumnData: function _populateColumnsAndColumnData(columns, columnGroups, oldState) { + var canReuseColumnSettings = false; + var canReuseColumnGroupSettings = false; + + if (oldState && oldState.columns) { + canReuseColumnSettings = this._areColumnSettingsIdentical(columns, oldState.columns); + } + if (oldState && oldState.columnGroups && columnGroups) { + canReuseColumnGroupSettings = this._areColumnSettingsIdentical(columnGroups, oldState.columnGroups); + } + + var columnInfo = {}; + if (canReuseColumnSettings) { + columnInfo.bodyFixedColumns = oldState.bodyFixedColumns; + columnInfo.bodyScrollableColumns = oldState.bodyScrollableColumns; + columnInfo.headFixedColumns = oldState.headFixedColumns; + columnInfo.headScrollableColumns = oldState.headScrollableColumns; + columnInfo.footFixedColumns = oldState.footFixedColumns; + columnInfo.footScrollableColumns = oldState.footScrollableColumns; + } else { + var bodyColumnTypes = this._splitColumnTypes(columns); + columnInfo.bodyFixedColumns = bodyColumnTypes.fixed; + columnInfo.bodyScrollableColumns = bodyColumnTypes.scrollable; + + var headColumnTypes = this._splitColumnTypes(this._selectColumnElement(HEADER, columns)); + columnInfo.headFixedColumns = headColumnTypes.fixed; + columnInfo.headScrollableColumns = headColumnTypes.scrollable; + + var footColumnTypes = this._splitColumnTypes(this._selectColumnElement(FOOTER, columns)); + columnInfo.footFixedColumns = footColumnTypes.fixed; + columnInfo.footScrollableColumns = footColumnTypes.scrollable; + } + + if (canReuseColumnGroupSettings) { + columnInfo.groupHeaderFixedColumns = oldState.groupHeaderFixedColumns; + columnInfo.groupHeaderScrollableColumns = oldState.groupHeaderScrollableColumns; + } else { + if (columnGroups) { + var groupHeaderColumnTypes = this._splitColumnTypes(this._selectColumnElement(HEADER, columnGroups)); + columnInfo.groupHeaderFixedColumns = groupHeaderColumnTypes.fixed; + columnInfo.groupHeaderScrollableColumns = groupHeaderColumnTypes.scrollable; + } + } + + return columnInfo; + }, + + _calculateState: function _calculateState( /*object*/props, /*?object*/oldState) /*object*/{ + invariant(props.height !== undefined || props.maxHeight !== undefined, "You must set either a height or a maxHeight"); + + var children = []; + ReactChildren.forEach(props.children, function (child, index) { + if (child == null) { + return; + } + invariant(child.type.__TableColumnGroup__ || child.type.__TableColumn__, "child type should be or " + ""); + children.push(child); + }); + + var useGroupHeader = false; + if (children.length && children[0].type.__TableColumnGroup__) { + useGroupHeader = true; + } + + if (oldState && (props.width !== undefined && props.width !== oldState.width || props.height !== undefined && props.height !== oldState.height || props.maxWidth !== undefined && props.maxWidth !== oldState.maxWidth || props.maxHeight !== undefined && props.maxHeight !== oldState.maxHeight)) { + oldState = null; + } + + var firstRowIndex = oldState && oldState.firstRowIndex || 0; + var firstRowOffset = oldState && oldState.firstRowOffset || 0; + var scrollX, scrollY; + if (oldState && props.overflowX !== "hidden") { + scrollX = oldState.scrollX; + } else { + scrollX = props.scrollLeft; + } + if (oldState && props.overflowY !== "hidden") { + scrollY = oldState.scrollY; + } else { + scrollState = this._scrollHelper.scrollTo(props.scrollTop); + firstRowIndex = scrollState.index; + firstRowOffset = scrollState.offset; + scrollY = scrollState.position; + } + + if (this._rowToScrollTo !== undefined) { + scrollState = this._scrollHelper.scrollRowIntoView(this._rowToScrollTo); + firstRowIndex = scrollState.index; + firstRowOffset = scrollState.offset; + scrollY = scrollState.position; + delete this._rowToScrollTo; + } + + var groupHeaderHeight = useGroupHeader ? props.groupHeaderHeight : 0; + + if (oldState && props.rowsCount !== oldState.rowsCount) { // Number of rows changed, try to scroll to the row from before the // change var viewportHeight = (props.height === undefined ? props.maxHeight : props.height) - (props.headerHeight || 0) - (props.footerHeight || 0) - (props.groupHeaderHeight || 0); @@ -1440,399 +2594,1449 @@ return /******/ (function(modules) { // webpackBootstrap this._scrollHelper.setRowHeightGetter(props.rowHeightGetter); } - var columnResizingData; - if (props.isColumnResizing) { - columnResizingData = oldState && oldState.columnResizingData; - } else { - columnResizingData = EMPTY_OBJECT; + var columnResizingData; + if (props.isColumnResizing) { + columnResizingData = oldState && oldState.columnResizingData; + } else { + columnResizingData = EMPTY_OBJECT; + } + + var columns; + var columnGroups; + + if (useGroupHeader) { + var columnGroupSettings = FixedDataTableWidthHelper.adjustColumnGroupWidths(children, props.width); + columns = columnGroupSettings.columns; + columnGroups = columnGroupSettings.columnGroups; + } else { + columns = FixedDataTableWidthHelper.adjustColumnWidths(children, props.width); + } + + var columnInfo = this._populateColumnsAndColumnData(columns, columnGroups, oldState); + + if (this._columnToScrollTo !== undefined) { + // If selected column is a fixed column, don't scroll + var fixedColumnsCount = columnInfo.bodyFixedColumns.length; + if (this._columnToScrollTo >= fixedColumnsCount) { + var totalFixedColumnsWidth = 0; + var i, column; + for (i = 0; i < columnInfo.bodyFixedColumns.length; ++i) { + column = columnInfo.bodyFixedColumns[i]; + totalFixedColumnsWidth += column.props.width; + } + + var scrollableColumnIndex = Math.min(this._columnToScrollTo - fixedColumnsCount, columnInfo.bodyScrollableColumns.length - 1); + + var previousColumnsWidth = 0; + for (i = 0; i < scrollableColumnIndex; ++i) { + column = columnInfo.bodyScrollableColumns[i]; + previousColumnsWidth += column.props.width; + } + + var availableScrollWidth = props.width - totalFixedColumnsWidth; + var selectedColumnWidth = columnInfo.bodyScrollableColumns[scrollableColumnIndex].props.width; + var minAcceptableScrollPosition = previousColumnsWidth + selectedColumnWidth - availableScrollWidth; + + if (scrollX < minAcceptableScrollPosition) { + scrollX = minAcceptableScrollPosition; + } + + if (scrollX > previousColumnsWidth) { + scrollX = previousColumnsWidth; + } + } + delete this._columnToScrollTo; + } + + var useMaxHeight = props.height === undefined; + var height = Math.round(useMaxHeight ? props.maxHeight : props.height); + var totalHeightReserved = props.footerHeight + props.headerHeight + groupHeaderHeight + 2 * BORDER_HEIGHT; + var bodyHeight = height - totalHeightReserved; + var scrollContentHeight = this._scrollHelper.getContentHeight(); + var totalHeightNeeded = scrollContentHeight + totalHeightReserved; + var scrollContentWidth = FixedDataTableWidthHelper.getTotalWidth(columns); + + var horizontalScrollbarVisible = scrollContentWidth > props.width && props.overflowX !== "hidden"; + + if (horizontalScrollbarVisible) { + bodyHeight -= Scrollbar.SIZE; + totalHeightNeeded += Scrollbar.SIZE; + totalHeightReserved += Scrollbar.SIZE; + } + + var maxScrollX = Math.max(0, scrollContentWidth - props.width); + var maxScrollY = Math.max(0, scrollContentHeight - bodyHeight); + scrollX = Math.min(scrollX, maxScrollX); + scrollY = Math.min(scrollY, maxScrollY); + + if (!maxScrollY) { + // no vertical scrollbar necessary, use the totals we tracked so we + // can shrink-to-fit vertically + if (useMaxHeight) { + height = totalHeightNeeded; + } + bodyHeight = totalHeightNeeded - totalHeightReserved; + } + + this._scrollHelper.setViewportHeight(bodyHeight); + + // The order of elements in this object metters and bringing bodyHeight, + // height or useGroupHeader to the top can break various features + var newState = _extends({ + isColumnResizing: oldState && oldState.isColumnResizing + }, columnInfo, props, { + + columns: columns, + columnGroups: columnGroups, + columnResizingData: columnResizingData, + firstRowIndex: firstRowIndex, + firstRowOffset: firstRowOffset, + horizontalScrollbarVisible: horizontalScrollbarVisible, + maxScrollX: maxScrollX, + maxScrollY: maxScrollY, + reservedHeight: totalHeightReserved, + scrollContentHeight: scrollContentHeight, + scrollX: scrollX, + scrollY: scrollY, + + // These properties may overwrite properties defined in + // columnInfo and props + bodyHeight: bodyHeight, + height: height, + groupHeaderHeight: groupHeaderHeight, + useGroupHeader: useGroupHeader + }); + + return newState; + }, + + _selectColumnElement: function _selectColumnElement( /*string*/type, /*array*/columns) /*array*/{ + var newColumns = []; + for (var i = 0; i < columns.length; ++i) { + var column = columns[i]; + newColumns.push(React.cloneElement(column, { + cell: type ? column.props[type] : column.props[CELL] + })); + } + return newColumns; + }, + + _splitColumnTypes: function _splitColumnTypes( /*array*/columns) /*object*/{ + var fixedColumns = []; + var scrollableColumns = []; + for (var i = 0; i < columns.length; ++i) { + if (columns[i].props.fixed) { + fixedColumns.push(columns[i]); + } else { + scrollableColumns.push(columns[i]); + } + } + return { + fixed: fixedColumns, + scrollable: scrollableColumns + }; + }, + + _onWheel: function _onWheel( /*number*/deltaX, /*number*/deltaY) { + if (this._isMounted) { + if (!this._isScrolling) { + this._didScrollStart(); + } + var x = this.state.scrollX; + if (Math.abs(deltaY) > Math.abs(deltaX) && this.props.overflowY !== "hidden") { + var scrollState = this._scrollHelper.scrollBy(Math.round(deltaY)); + var maxScrollY = Math.max(0, scrollState.contentHeight - this.state.bodyHeight); + this.setState({ + firstRowIndex: scrollState.index, + firstRowOffset: scrollState.offset, + scrollY: scrollState.position, + scrollContentHeight: scrollState.contentHeight, + maxScrollY: maxScrollY + }); + } else if (deltaX && this.props.overflowX !== "hidden") { + x += deltaX; + x = x < 0 ? 0 : x; + x = x > this.state.maxScrollX ? this.state.maxScrollX : x; + this.setState({ + scrollX: x + }); + } + this._didScroll(); + this._didScrollStop(); + } + }, + + _onHorizontalScroll: function _onHorizontalScroll( /*number*/scrollPos) { + if (this._isMounted && scrollPos !== this.state.scrollX) { + if (!this._isScrolling) { + this._didScrollStart(); + } + this.setState({ + scrollX: scrollPos + }); + this._didScroll(); + this._didScrollStop(); + } + }, + + _onVerticalScroll: function _onVerticalScroll( /*number*/scrollPos) { + if (this._isMounted && scrollPos !== this.state.scrollY) { + if (!this._isScrolling) { + this._didScrollStart(); + } + var scrollState = this._scrollHelper.scrollTo(Math.round(scrollPos)); + this.setState({ + firstRowIndex: scrollState.index, + firstRowOffset: scrollState.offset, + scrollY: scrollState.position, + scrollContentHeight: scrollState.contentHeight + }); + this._didScroll(); + this._didScrollStop(); + } + }, + + _didScrollStart: function _didScrollStart() { + if (this._isMounted && !this._isScrolling) { + this._isScrolling = true; + if (this.props.onScrollStart) { + this.props.onScrollStart(this.state.scrollX, this.state.scrollY); + } } + }, - var columns; - var columnGroups; + _didScroll: function _didScroll() { + if (this._isMounted && this._isScrolling) { + if (this.props.onScroll) { + this.props.onScroll(this.state.scrollX, this.state.scrollY); + } + } + }, - if (useGroupHeader) { - var columnGroupSettings = FixedDataTableWidthHelper.adjustColumnGroupWidths(children, props.width); - columns = columnGroupSettings.columns; - columnGroups = columnGroupSettings.columnGroups; - } else { - columns = FixedDataTableWidthHelper.adjustColumnWidths(children, props.width); + _didScrollStop: function _didScrollStop() { + if (this._isMounted && this._isScrolling) { + this._isScrolling = false; + this.setState({ redraw: true }); + if (this.props.onScrollEnd) { + this.props.onScrollEnd(this.state.scrollX, this.state.scrollY); + } + } + }, + + setHoverState: function setHoverState(hoverState) { + this.setState({ isHoveringResizerKnob: hoverState }); + } + }); + + var HorizontalScrollbar = createReactClass({ + displayName: "HorizontalScrollbar", + mixins: [ReactComponentWithPureRenderMixin], + + propTypes: { + contentSize: PropTypes.number.isRequired, + offset: PropTypes.number.isRequired, + onScroll: PropTypes.func.isRequired, + position: PropTypes.number.isRequired, + size: PropTypes.number.isRequired + }, + + render: function render() /*object*/{ + var outerContainerStyle = _extends({ + height: Scrollbar.SIZE, + width: this.props.size + }, this.props.horizontalScrollbarStyle); + var innerContainerStyle = { + height: Scrollbar.SIZE, + position: "absolute", + overflow: "hidden", + width: this.props.size + }; + translateDOMPositionXY(innerContainerStyle, 0, this.props.offset); + + return React.createElement( + "div", + { + className: joinClasses(cx("fixedDataTableLayout/horizontalScrollbar"), cx("public/fixedDataTable/horizontalScrollbar")), + style: outerContainerStyle + }, + React.createElement( + "div", + { style: innerContainerStyle }, + React.createElement(Scrollbar, _extends({}, this.props, { + isOpaque: true, + orientation: "horizontal", + offset: undefined + })) + ) + ); + } + }); + + module.exports = FixedDataTable; + // isColumnResizing should be overwritten by value from props if + // avaialble + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + 'use strict'; + + var React = __webpack_require__(35); + var factory = __webpack_require__(38); + + if (typeof React === 'undefined') { + throw Error( + 'create-react-class could not find the React object. If you are using script tags, ' + + 'make sure that React is being loaded before create-react-class.' + ); + } + + // Hack to grab NoopUpdateQueue from isomorphic React + var ReactNoopUpdateQueue = new React.Component().updater; + + module.exports = factory( + React.Component, + React.isValidElement, + ReactNoopUpdateQueue + ); + + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + 'use strict'; + + var _assign = __webpack_require__(30); + + var emptyObject = __webpack_require__(39); + var _invariant = __webpack_require__(40); + + if (process.env.NODE_ENV !== 'production') { + var warning = __webpack_require__(41); + } + + var MIXINS_KEY = 'mixins'; + + // Helper function to allow the creation of anonymous functions which do not + // have .name set to the name of the variable being assigned to. + function identity(fn) { + return fn; + } + + var ReactPropTypeLocationNames; + if (process.env.NODE_ENV !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; + } else { + ReactPropTypeLocationNames = {}; + } + + function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { + /** + * Policies that describe methods in `ReactClassInterface`. + */ + + var injectedMixins = []; + + /** + * Composite components are higher-level components that compose other composite + * or host components. + * + * To create a new type of `ReactClass`, pass a specification of + * your new class to `React.createClass`. The only requirement of your class + * specification is that you implement a `render` method. + * + * var MyComponent = React.createClass({ + * render: function() { + * return
Hello World
; + * } + * }); + * + * The class specification supports a specific protocol of methods that have + * special meaning (e.g. `render`). See `ReactClassInterface` for + * more the comprehensive protocol. Any other properties and methods in the + * class specification will be available on the prototype. + * + * @interface ReactClassInterface + * @internal + */ + var ReactClassInterface = { + /** + * An array of Mixin objects to include when defining your component. + * + * @type {array} + * @optional + */ + mixins: 'DEFINE_MANY', + + /** + * An object containing properties and methods that should be defined on + * the component's constructor instead of its prototype (static methods). + * + * @type {object} + * @optional + */ + statics: 'DEFINE_MANY', + + /** + * Definition of prop types for this component. + * + * @type {object} + * @optional + */ + propTypes: 'DEFINE_MANY', + + /** + * Definition of context types for this component. + * + * @type {object} + * @optional + */ + contextTypes: 'DEFINE_MANY', + + /** + * Definition of context types this component sets for its children. + * + * @type {object} + * @optional + */ + childContextTypes: 'DEFINE_MANY', + + // ==== Definition methods ==== + + /** + * Invoked when the component is mounted. Values in the mapping will be set on + * `this.props` if that prop is not specified (i.e. using an `in` check). + * + * This method is invoked before `getInitialState` and therefore cannot rely + * on `this.state` or use `this.setState`. + * + * @return {object} + * @optional + */ + getDefaultProps: 'DEFINE_MANY_MERGED', + + /** + * Invoked once before the component is mounted. The return value will be used + * as the initial value of `this.state`. + * + * getInitialState: function() { + * return { + * isOn: false, + * fooBaz: new BazFoo() + * } + * } + * + * @return {object} + * @optional + */ + getInitialState: 'DEFINE_MANY_MERGED', + + /** + * @return {object} + * @optional + */ + getChildContext: 'DEFINE_MANY_MERGED', + + /** + * Uses props from `this.props` and state from `this.state` to render the + * structure of the component. + * + * No guarantees are made about when or how often this method is invoked, so + * it must not have side effects. + * + * render: function() { + * var name = this.props.name; + * return
Hello, {name}!
; + * } + * + * @return {ReactComponent} + * @required + */ + render: 'DEFINE_ONCE', + + // ==== Delegate methods ==== + + /** + * Invoked when the component is initially created and about to be mounted. + * This may have side effects, but any external subscriptions or data created + * by this method must be cleaned up in `componentWillUnmount`. + * + * @optional + */ + componentWillMount: 'DEFINE_MANY', + + /** + * Invoked when the component has been mounted and has a DOM representation. + * However, there is no guarantee that the DOM node is in the document. + * + * Use this as an opportunity to operate on the DOM when the component has + * been mounted (initialized and rendered) for the first time. + * + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidMount: 'DEFINE_MANY', + + /** + * Invoked before the component receives new props. + * + * Use this as an opportunity to react to a prop transition by updating the + * state using `this.setState`. Current props are accessed via `this.props`. + * + * componentWillReceiveProps: function(nextProps, nextContext) { + * this.setState({ + * likesIncreasing: nextProps.likeCount > this.props.likeCount + * }); + * } + * + * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop + * transition may cause a state change, but the opposite is not true. If you + * need it, you are probably looking for `componentWillUpdate`. + * + * @param {object} nextProps + * @optional + */ + componentWillReceiveProps: 'DEFINE_MANY', + + /** + * Invoked while deciding if the component should be updated as a result of + * receiving new props, state and/or context. + * + * Use this as an opportunity to `return false` when you're certain that the + * transition to the new props/state/context will not require a component + * update. + * + * shouldComponentUpdate: function(nextProps, nextState, nextContext) { + * return !equal(nextProps, this.props) || + * !equal(nextState, this.state) || + * !equal(nextContext, this.context); + * } + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @return {boolean} True if the component should update. + * @optional + */ + shouldComponentUpdate: 'DEFINE_ONCE', + + /** + * Invoked when the component is about to update due to a transition from + * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` + * and `nextContext`. + * + * Use this as an opportunity to perform preparation before an update occurs. + * + * NOTE: You **cannot** use `this.setState()` in this method. + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @param {ReactReconcileTransaction} transaction + * @optional + */ + componentWillUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component's DOM representation has been updated. + * + * Use this as an opportunity to operate on the DOM when the component has + * been updated. + * + * @param {object} prevProps + * @param {?object} prevState + * @param {?object} prevContext + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component is about to be removed from its parent and have + * its DOM representation destroyed. + * + * Use this as an opportunity to deallocate any external resources. + * + * NOTE: There is no `componentDidUnmount` since your component will have been + * destroyed by that point. + * + * @optional + */ + componentWillUnmount: 'DEFINE_MANY', + + /** + * Replacement for (deprecated) `componentWillMount`. + * + * @optional + */ + UNSAFE_componentWillMount: 'DEFINE_MANY', + + /** + * Replacement for (deprecated) `componentWillReceiveProps`. + * + * @optional + */ + UNSAFE_componentWillReceiveProps: 'DEFINE_MANY', + + /** + * Replacement for (deprecated) `componentWillUpdate`. + * + * @optional + */ + UNSAFE_componentWillUpdate: 'DEFINE_MANY', + + // ==== Advanced methods ==== + + /** + * Updates the component's currently mounted DOM representation. + * + * By default, this implements React's rendering and reconciliation algorithm. + * Sophisticated clients may wish to override this. + * + * @param {ReactReconcileTransaction} transaction + * @internal + * @overridable + */ + updateComponent: 'OVERRIDE_BASE' + }; + + /** + * Similar to ReactClassInterface but for static methods. + */ + var ReactClassStaticInterface = { + /** + * This method is invoked after a component is instantiated and when it + * receives new props. Return an object to update state in response to + * prop changes. Return null to indicate no change to state. + * + * If an object is returned, its keys will be merged into the existing state. + * + * @return {object || null} + * @optional + */ + getDerivedStateFromProps: 'DEFINE_MANY_MERGED' + }; + + /** + * Mapping from class specification keys to special processing functions. + * + * Although these are declared like instance properties in the specification + * when defining classes using `React.createClass`, they are actually static + * and are accessible on the constructor instead of the prototype. Despite + * being static, they must be defined outside of the "statics" key under + * which all other static methods are defined. + */ + var RESERVED_SPEC_KEYS = { + displayName: function(Constructor, displayName) { + Constructor.displayName = displayName; + }, + mixins: function(Constructor, mixins) { + if (mixins) { + for (var i = 0; i < mixins.length; i++) { + mixSpecIntoComponent(Constructor, mixins[i]); + } + } + }, + childContextTypes: function(Constructor, childContextTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, childContextTypes, 'childContext'); + } + Constructor.childContextTypes = _assign( + {}, + Constructor.childContextTypes, + childContextTypes + ); + }, + contextTypes: function(Constructor, contextTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, contextTypes, 'context'); + } + Constructor.contextTypes = _assign( + {}, + Constructor.contextTypes, + contextTypes + ); + }, + /** + * Special case getDefaultProps which should move into statics but requires + * automatic merging. + */ + getDefaultProps: function(Constructor, getDefaultProps) { + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps = createMergedResultFunction( + Constructor.getDefaultProps, + getDefaultProps + ); + } else { + Constructor.getDefaultProps = getDefaultProps; + } + }, + propTypes: function(Constructor, propTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, propTypes, 'prop'); + } + Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); + }, + statics: function(Constructor, statics) { + mixStaticSpecIntoComponent(Constructor, statics); + }, + autobind: function() {} + }; + + function validateTypeDef(Constructor, typeDef, location) { + for (var propName in typeDef) { + if (typeDef.hasOwnProperty(propName)) { + // use a warning instead of an _invariant so components + // don't show up in prod but only in __DEV__ + if (process.env.NODE_ENV !== 'production') { + warning( + typeof typeDef[propName] === 'function', + '%s: %s type `%s` is invalid; it must be a function, usually from ' + + 'React.PropTypes.', + Constructor.displayName || 'ReactClass', + ReactPropTypeLocationNames[location], + propName + ); + } + } + } + } + + function validateMethodOverride(isAlreadyDefined, name) { + var specPolicy = ReactClassInterface.hasOwnProperty(name) + ? ReactClassInterface[name] + : null; + + // Disallow overriding of base class methods unless explicitly allowed. + if (ReactClassMixin.hasOwnProperty(name)) { + _invariant( + specPolicy === 'OVERRIDE_BASE', + 'ReactClassInterface: You are attempting to override ' + + '`%s` from your class specification. Ensure that your method names ' + + 'do not overlap with React methods.', + name + ); + } + + // Disallow defining methods more than once unless explicitly allowed. + if (isAlreadyDefined) { + _invariant( + specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', + 'ReactClassInterface: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be due ' + + 'to a mixin.', + name + ); + } + } + + /** + * Mixin helper which handles policy validation and reserved + * specification keys when building React classes. + */ + function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + if (process.env.NODE_ENV !== 'production') { + var typeofSpec = typeof spec; + var isMixinValid = typeofSpec === 'object' && spec !== null; + + if (process.env.NODE_ENV !== 'production') { + warning( + isMixinValid, + "%s: You're attempting to include a mixin that is either null " + + 'or not an object. Check the mixins included by the component, ' + + 'as well as any mixins they include themselves. ' + + 'Expected object but got %s.', + Constructor.displayName || 'ReactClass', + spec === null ? null : typeofSpec + ); + } + } + + return; } - var columnInfo = this._populateColumnsAndColumnData(columns, columnGroups, oldState); + _invariant( + typeof spec !== 'function', + "ReactClass: You're attempting to " + + 'use a component class or function as a mixin. Instead, just use a ' + + 'regular object.' + ); + _invariant( + !isValidElement(spec), + "ReactClass: You're attempting to " + + 'use a component as a mixin. Instead, just use a regular object.' + ); - if (this._columnToScrollTo !== undefined) { - // If selected column is a fixed column, don't scroll - var fixedColumnsCount = columnInfo.bodyFixedColumns.length; - if (this._columnToScrollTo >= fixedColumnsCount) { - var totalFixedColumnsWidth = 0; - var i, column; - for (i = 0; i < columnInfo.bodyFixedColumns.length; ++i) { - column = columnInfo.bodyFixedColumns[i]; - totalFixedColumnsWidth += column.props.width; - } + var proto = Constructor.prototype; + var autoBindPairs = proto.__reactAutoBindPairs; - var scrollableColumnIndex = Math.min(this._columnToScrollTo - fixedColumnsCount, columnInfo.bodyScrollableColumns.length - 1); + // By handling mixins before any other properties, we ensure the same + // chaining order is applied to methods with DEFINE_MANY policy, whether + // mixins are listed before or after these methods in the spec. + if (spec.hasOwnProperty(MIXINS_KEY)) { + RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); + } - var previousColumnsWidth = 0; - for (i = 0; i < scrollableColumnIndex; ++i) { - column = columnInfo.bodyScrollableColumns[i]; - previousColumnsWidth += column.props.width; - } + for (var name in spec) { + if (!spec.hasOwnProperty(name)) { + continue; + } - var availableScrollWidth = props.width - totalFixedColumnsWidth; - var selectedColumnWidth = columnInfo.bodyScrollableColumns[scrollableColumnIndex].props.width; - var minAcceptableScrollPosition = previousColumnsWidth + selectedColumnWidth - availableScrollWidth; + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above. + continue; + } - if (scrollX < minAcceptableScrollPosition) { - scrollX = minAcceptableScrollPosition; - } + var property = spec[name]; + var isAlreadyDefined = proto.hasOwnProperty(name); + validateMethodOverride(isAlreadyDefined, name); - if (scrollX > previousColumnsWidth) { - scrollX = previousColumnsWidth; + if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { + RESERVED_SPEC_KEYS[name](Constructor, property); + } else { + // Setup methods on prototype: + // The following member methods should not be automatically bound: + // 1. Expected ReactClass methods (in the "interface"). + // 2. Overridden methods (that were mixed in). + var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); + var isFunction = typeof property === 'function'; + var shouldAutoBind = + isFunction && + !isReactClassMethod && + !isAlreadyDefined && + spec.autobind !== false; + + if (shouldAutoBind) { + autoBindPairs.push(name, property); + proto[name] = property; + } else { + if (isAlreadyDefined) { + var specPolicy = ReactClassInterface[name]; + + // These cases should already be caught by validateMethodOverride. + _invariant( + isReactClassMethod && + (specPolicy === 'DEFINE_MANY_MERGED' || + specPolicy === 'DEFINE_MANY'), + 'ReactClass: Unexpected spec policy %s for key %s ' + + 'when mixing in component specs.', + specPolicy, + name + ); + + // For methods which are defined more than once, call the existing + // methods before calling the new property, merging if appropriate. + if (specPolicy === 'DEFINE_MANY_MERGED') { + proto[name] = createMergedResultFunction(proto[name], property); + } else if (specPolicy === 'DEFINE_MANY') { + proto[name] = createChainedFunction(proto[name], property); + } + } else { + proto[name] = property; + if (process.env.NODE_ENV !== 'production') { + // Add verbose displayName to the function, which helps when looking + // at profiling tools. + if (typeof property === 'function' && spec.displayName) { + proto[name].displayName = spec.displayName + '_' + name; + } + } + } } } - delete this._columnToScrollTo; } + } - var useMaxHeight = props.height === undefined; - var height = Math.round(useMaxHeight ? props.maxHeight : props.height); - var totalHeightReserved = props.footerHeight + props.headerHeight + groupHeaderHeight + 2 * BORDER_HEIGHT; - var bodyHeight = height - totalHeightReserved; - var scrollContentHeight = this._scrollHelper.getContentHeight(); - var totalHeightNeeded = scrollContentHeight + totalHeightReserved; - var scrollContentWidth = FixedDataTableWidthHelper.getTotalWidth(columns); + function mixStaticSpecIntoComponent(Constructor, statics) { + if (!statics) { + return; + } - var horizontalScrollbarVisible = scrollContentWidth > props.width && props.overflowX !== 'hidden'; + for (var name in statics) { + var property = statics[name]; + if (!statics.hasOwnProperty(name)) { + continue; + } - if (horizontalScrollbarVisible) { - bodyHeight -= Scrollbar.SIZE; - totalHeightNeeded += Scrollbar.SIZE; - totalHeightReserved += Scrollbar.SIZE; + var isReserved = name in RESERVED_SPEC_KEYS; + _invariant( + !isReserved, + 'ReactClass: You are attempting to define a reserved ' + + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + + 'as an instance property instead; it will still be accessible on the ' + + 'constructor.', + name + ); + + var isAlreadyDefined = name in Constructor; + if (isAlreadyDefined) { + var specPolicy = ReactClassStaticInterface.hasOwnProperty(name) + ? ReactClassStaticInterface[name] + : null; + + _invariant( + specPolicy === 'DEFINE_MANY_MERGED', + 'ReactClass: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be ' + + 'due to a mixin.', + name + ); + + Constructor[name] = createMergedResultFunction(Constructor[name], property); + + return; + } + + Constructor[name] = property; } + } - var maxScrollX = Math.max(0, scrollContentWidth - props.width); - var maxScrollY = Math.max(0, scrollContentHeight - bodyHeight); - scrollX = Math.min(scrollX, maxScrollX); - scrollY = Math.min(scrollY, maxScrollY); + /** + * Merge two objects, but throw if both contain the same key. + * + * @param {object} one The first object, which is mutated. + * @param {object} two The second object + * @return {object} one after it has been mutated to contain everything in two. + */ + function mergeIntoWithNoDuplicateKeys(one, two) { + _invariant( + one && two && typeof one === 'object' && typeof two === 'object', + 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.' + ); - if (!maxScrollY) { - // no vertical scrollbar necessary, use the totals we tracked so we - // can shrink-to-fit vertically - if (useMaxHeight) { - height = totalHeightNeeded; + for (var key in two) { + if (two.hasOwnProperty(key)) { + _invariant( + one[key] === undefined, + 'mergeIntoWithNoDuplicateKeys(): ' + + 'Tried to merge two objects with the same key: `%s`. This conflict ' + + 'may be due to a mixin; in particular, this may be caused by two ' + + 'getInitialState() or getDefaultProps() methods returning objects ' + + 'with clashing keys.', + key + ); + one[key] = two[key]; } - bodyHeight = totalHeightNeeded - totalHeightReserved; } + return one; + } - this._scrollHelper.setViewportHeight(bodyHeight); + /** + * Creates a function that invokes two functions and merges their return values. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ + function createMergedResultFunction(one, two) { + return function mergedResult() { + var a = one.apply(this, arguments); + var b = two.apply(this, arguments); + if (a == null) { + return b; + } else if (b == null) { + return a; + } + var c = {}; + mergeIntoWithNoDuplicateKeys(c, a); + mergeIntoWithNoDuplicateKeys(c, b); + return c; + }; + } - // The order of elements in this object metters and bringing bodyHeight, - // height or useGroupHeader to the top can break various features - var newState = _extends({ - isColumnResizing: oldState && oldState.isColumnResizing }, columnInfo, props, { + /** + * Creates a function that invokes two functions and ignores their return vales. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ + function createChainedFunction(one, two) { + return function chainedFunction() { + one.apply(this, arguments); + two.apply(this, arguments); + }; + } - columns: columns, - columnGroups: columnGroups, - columnResizingData: columnResizingData, - firstRowIndex: firstRowIndex, - firstRowOffset: firstRowOffset, - horizontalScrollbarVisible: horizontalScrollbarVisible, - maxScrollX: maxScrollX, - maxScrollY: maxScrollY, - reservedHeight: totalHeightReserved, - scrollContentHeight: scrollContentHeight, - scrollX: scrollX, - scrollY: scrollY, + /** + * Binds a method to the component. + * + * @param {object} component Component whose method is going to be bound. + * @param {function} method Method to be bound. + * @return {function} The bound method. + */ + function bindAutoBindMethod(component, method) { + var boundMethod = method.bind(component); + if (process.env.NODE_ENV !== 'production') { + boundMethod.__reactBoundContext = component; + boundMethod.__reactBoundMethod = method; + boundMethod.__reactBoundArguments = null; + var componentName = component.constructor.displayName; + var _bind = boundMethod.bind; + boundMethod.bind = function(newThis) { + for ( + var _len = arguments.length, + args = Array(_len > 1 ? _len - 1 : 0), + _key = 1; + _key < _len; + _key++ + ) { + args[_key - 1] = arguments[_key]; + } - // These properties may overwrite properties defined in - // columnInfo and props - bodyHeight: bodyHeight, - height: height, - groupHeaderHeight: groupHeaderHeight, - useGroupHeader: useGroupHeader }); + // User is trying to bind() an autobound method; we effectively will + // ignore the value of "this" that the user is trying to use, so + // let's warn. + if (newThis !== component && newThis !== null) { + if (process.env.NODE_ENV !== 'production') { + warning( + false, + 'bind(): React component methods may only be bound to the ' + + 'component instance. See %s', + componentName + ); + } + } else if (!args.length) { + if (process.env.NODE_ENV !== 'production') { + warning( + false, + 'bind(): You are binding a component method to the component. ' + + 'React does this for you automatically in a high-performance ' + + 'way, so you can safely remove this call. See %s', + componentName + ); + } + return boundMethod; + } + var reboundMethod = _bind.apply(boundMethod, arguments); + reboundMethod.__reactBoundContext = component; + reboundMethod.__reactBoundMethod = method; + reboundMethod.__reactBoundArguments = args; + return reboundMethod; + }; + } + return boundMethod; + } - return newState; - }, + /** + * Binds all auto-bound methods in a component. + * + * @param {object} component Component whose method is going to be bound. + */ + function bindAutoBindMethods(component) { + var pairs = component.__reactAutoBindPairs; + for (var i = 0; i < pairs.length; i += 2) { + var autoBindKey = pairs[i]; + var method = pairs[i + 1]; + component[autoBindKey] = bindAutoBindMethod(component, method); + } + } - _selectColumnElement: function _selectColumnElement( /*string*/type, /*array*/columns) /*array*/{ - var newColumns = []; - for (var i = 0; i < columns.length; ++i) { - var column = columns[i]; - newColumns.push(React.cloneElement(column, { - cell: type ? column.props[type] : column.props[CELL] - })); + var IsMountedPreMixin = { + componentDidMount: function() { + this.__isMounted = true; } - return newColumns; - }, + }; - _splitColumnTypes: function _splitColumnTypes( /*array*/columns) /*object*/{ - var fixedColumns = []; - var scrollableColumns = []; - for (var i = 0; i < columns.length; ++i) { - if (columns[i].props.fixed) { - fixedColumns.push(columns[i]); - } else { - scrollableColumns.push(columns[i]); - } + var IsMountedPostMixin = { + componentWillUnmount: function() { + this.__isMounted = false; } - return { - fixed: fixedColumns, - scrollable: scrollableColumns }; - }, + }; - _onWheel: function _onWheel( /*number*/deltaX, /*number*/deltaY) { - if (this.isMounted()) { - if (!this._isScrolling) { - this._didScrollStart(); + /** + * Add more to the ReactClass base class. These are all legacy features and + * therefore not already part of the modern ReactComponent. + */ + var ReactClassMixin = { + /** + * TODO: This will be deprecated because state should always keep a consistent + * type signature and the only use case for this, is to avoid that. + */ + replaceState: function(newState, callback) { + this.updater.enqueueReplaceState(this, newState, callback); + }, + + /** + * Checks whether or not this composite component is mounted. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function() { + if (process.env.NODE_ENV !== 'production') { + warning( + this.__didWarnIsMounted, + '%s: isMounted is deprecated. Instead, make sure to clean up ' + + 'subscriptions and pending requests in componentWillUnmount to ' + + 'prevent memory leaks.', + (this.constructor && this.constructor.displayName) || + this.name || + 'Component' + ); + this.__didWarnIsMounted = true; } - var x = this.state.scrollX; - if (Math.abs(deltaY) > Math.abs(deltaX) && this.props.overflowY !== 'hidden') { - var scrollState = this._scrollHelper.scrollBy(Math.round(deltaY)); - var maxScrollY = Math.max(0, scrollState.contentHeight - this.state.bodyHeight); - this.setState({ - firstRowIndex: scrollState.index, - firstRowOffset: scrollState.offset, - scrollY: scrollState.position, - scrollContentHeight: scrollState.contentHeight, - maxScrollY: maxScrollY }); - } else if (deltaX && this.props.overflowX !== 'hidden') { - x += deltaX; - x = x < 0 ? 0 : x; - x = x > this.state.maxScrollX ? this.state.maxScrollX : x; - this.setState({ - scrollX: x }); + return !!this.__isMounted; + } + }; + + var ReactClassComponent = function() {}; + _assign( + ReactClassComponent.prototype, + ReactComponent.prototype, + ReactClassMixin + ); + + /** + * Creates a composite component class given a class specification. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass + * + * @param {object} spec Class specification (which must define `render`). + * @return {function} Component constructor function. + * @public + */ + function createClass(spec) { + // To keep our warnings more understandable, we'll use a little hack here to + // ensure that Constructor.name !== 'Constructor'. This makes sure we don't + // unnecessarily identify a class without displayName as 'Constructor'. + var Constructor = identity(function(props, context, updater) { + // This constructor gets overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. + + if (process.env.NODE_ENV !== 'production') { + warning( + this instanceof Constructor, + 'Something is calling a React component directly. Use a factory or ' + + 'JSX instead. See: https://fb.me/react-legacyfactory' + ); } - this._didScrollStop(); - } - }, + // Wire up auto-binding + if (this.__reactAutoBindPairs.length) { + bindAutoBindMethods(this); + } - _onHorizontalScroll: function _onHorizontalScroll( /*number*/scrollPos) { - if (this.isMounted() && scrollPos !== this.state.scrollX) { - if (!this._isScrolling) { - this._didScrollStart(); + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + + this.state = null; + + // ReactClasses doesn't have constructors. Instead, they use the + // getInitialState and componentWillMount methods for initialization. + + var initialState = this.getInitialState ? this.getInitialState() : null; + if (process.env.NODE_ENV !== 'production') { + // We allow auto-mocks to proceed as if they're returning null. + if ( + initialState === undefined && + this.getInitialState._isMockFunction + ) { + // This is probably bad practice. Consider warning here and + // deprecating this convenience. + initialState = null; + } } - this.setState({ - scrollX: scrollPos }); - this._didScrollStop(); + _invariant( + typeof initialState === 'object' && !Array.isArray(initialState), + '%s.getInitialState(): must return an object or null', + Constructor.displayName || 'ReactCompositeComponent' + ); + + this.state = initialState; + }); + Constructor.prototype = new ReactClassComponent(); + Constructor.prototype.constructor = Constructor; + Constructor.prototype.__reactAutoBindPairs = []; + + injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); + + mixSpecIntoComponent(Constructor, IsMountedPreMixin); + mixSpecIntoComponent(Constructor, spec); + mixSpecIntoComponent(Constructor, IsMountedPostMixin); + + // Initialize the defaultProps property after all mixins have been merged. + if (Constructor.getDefaultProps) { + Constructor.defaultProps = Constructor.getDefaultProps(); } - }, - _onVerticalScroll: function _onVerticalScroll( /*number*/scrollPos) { - if (this.isMounted() && scrollPos !== this.state.scrollY) { - if (!this._isScrolling) { - this._didScrollStart(); + if (process.env.NODE_ENV !== 'production') { + // This is a tag to indicate that the use of these method names is ok, + // since it's used with createClass. If it's not, then it's likely a + // mistake so we'll warn you to use the static property, property + // initializer or constructor respectively. + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps.isReactClassApproved = {}; + } + if (Constructor.prototype.getInitialState) { + Constructor.prototype.getInitialState.isReactClassApproved = {}; } - var scrollState = this._scrollHelper.scrollTo(Math.round(scrollPos)); - this.setState({ - firstRowIndex: scrollState.index, - firstRowOffset: scrollState.offset, - scrollY: scrollState.position, - scrollContentHeight: scrollState.contentHeight }); - this._didScrollStop(); } - }, - _didScrollStart: function _didScrollStart() { - if (this.isMounted() && !this._isScrolling) { - this._isScrolling = true; - if (this.props.onScrollStart) { - this.props.onScrollStart(this.state.scrollX, this.state.scrollY); - } + _invariant( + Constructor.prototype.render, + 'createClass(...): Class specification must implement a `render` method.' + ); + + if (process.env.NODE_ENV !== 'production') { + warning( + !Constructor.prototype.componentShouldUpdate, + '%s has a method called ' + + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + + 'The name is phrased as a question because the function is ' + + 'expected to return a value.', + spec.displayName || 'A component' + ); + warning( + !Constructor.prototype.componentWillRecieveProps, + '%s has a method called ' + + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', + spec.displayName || 'A component' + ); + warning( + !Constructor.prototype.UNSAFE_componentWillRecieveProps, + '%s has a method called UNSAFE_componentWillRecieveProps(). ' + + 'Did you mean UNSAFE_componentWillReceiveProps()?', + spec.displayName || 'A component' + ); } - }, - _didScrollStop: function _didScrollStop() { - if (this.isMounted() && this._isScrolling) { - this._isScrolling = false; - this.setState({ redraw: true }); - if (this.props.onScrollEnd) { - this.props.onScrollEnd(this.state.scrollX, this.state.scrollY); + // Reduce time spent doing lookups by setting these on the prototype. + for (var methodName in ReactClassInterface) { + if (!Constructor.prototype[methodName]) { + Constructor.prototype[methodName] = null; } } - } }); - var HorizontalScrollbar = React.createClass({ - displayName: 'HorizontalScrollbar', + return Constructor; + } - mixins: [ReactComponentWithPureRenderMixin], - propTypes: { - contentSize: PropTypes.number.isRequired, - offset: PropTypes.number.isRequired, - onScroll: PropTypes.func.isRequired, - position: PropTypes.number.isRequired, - size: PropTypes.number.isRequired }, + return createClass; + } - render: function render() /*object*/{ - var outerContainerStyle = { - height: Scrollbar.SIZE, - width: this.props.size }; - var innerContainerStyle = { - height: Scrollbar.SIZE, - position: 'absolute', - overflow: 'hidden', - width: this.props.size }; - translateDOMPositionXY(innerContainerStyle, 0, this.props.offset); + module.exports = factory; - return React.createElement( - 'div', - { - className: joinClasses(cx('fixedDataTableLayout/horizontalScrollbar'), cx('public/fixedDataTable/horizontalScrollbar')), - style: outerContainerStyle }, - React.createElement( - 'div', - { style: innerContainerStyle }, - React.createElement(Scrollbar, _extends({}, this.props, { - isOpaque: true, - orientation: 'horizontal', - offset: undefined - })) - ) - ); - } }); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28))) + +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ - module.exports = FixedDataTable; + 'use strict'; - // isColumnResizing should be overwritten by value from props if - // avaialble + var emptyObject = {}; -/***/ }, -/* 30 */ -/***/ function(module, exports, __webpack_require__) { + if (process.env.NODE_ENV !== 'production') { + Object.freeze(emptyObject); + } - /** - * Copyright (c) 2015, Facebook, Inc. - * All rights reserved. + module.exports = emptyObject; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28))) + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2013-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * - * @providesModule FixedDataTableWidthHelper - * @typechecks */ 'use strict'; - var React = __webpack_require__(27); + /** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ - function getTotalWidth( /*array*/columns) /*number*/{ - var totalWidth = 0; - for (var i = 0; i < columns.length; ++i) { - totalWidth += columns[i].props.width; - } - return totalWidth; + var validateFormat = function validateFormat(format) {}; + + if (process.env.NODE_ENV !== 'production') { + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; } - function getTotalFlexGrow( /*array*/columns) /*number*/{ - var totalFlexGrow = 0; - for (var i = 0; i < columns.length; ++i) { - totalFlexGrow += columns[i].props.flexGrow || 0; + function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; } - return totalFlexGrow; } - function distributeFlexWidth( - /*array*/columns, - /*number*/flexWidth) /*object*/{ - if (flexWidth <= 0) { - return { - columns: columns, - width: getTotalWidth(columns) }; - } - var remainingFlexGrow = getTotalFlexGrow(columns); - var remainingFlexWidth = flexWidth; - var newColumns = []; - var totalWidth = 0; - for (var i = 0; i < columns.length; ++i) { - var column = columns[i]; - if (!column.props.flexGrow) { - totalWidth += column.props.width; - newColumns.push(column); - continue; - } - var columnFlexWidth = Math.floor(column.props.flexGrow / remainingFlexGrow * remainingFlexWidth); - var newColumnWidth = Math.floor(column.props.width + columnFlexWidth); - totalWidth += newColumnWidth; + module.exports = invariant; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28))) - remainingFlexGrow -= column.props.flexGrow; - remainingFlexWidth -= columnFlexWidth; +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { - newColumns.push(React.cloneElement(column, { width: newColumnWidth })); - } + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ - return { - columns: newColumns, - width: totalWidth }; - } + 'use strict'; - function adjustColumnGroupWidths( - /*array*/columnGroups, - /*number*/expectedWidth) /*object*/{ - var allColumns = []; - var i; - for (i = 0; i < columnGroups.length; ++i) { - React.Children.forEach(columnGroups[i].props.children, function (column) { - allColumns.push(column); - }); - } - var columnsWidth = getTotalWidth(allColumns); - var remainingFlexGrow = getTotalFlexGrow(allColumns); - var remainingFlexWidth = Math.max(expectedWidth - columnsWidth, 0); + var emptyFunction = __webpack_require__(42); - var newAllColumns = []; - var newColumnGroups = []; + /** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ - for (i = 0; i < columnGroups.length; ++i) { - var columnGroup = columnGroups[i]; - var currentColumns = []; + var warning = emptyFunction; - React.Children.forEach(columnGroup.props.children, function (column) { - currentColumns.push(column); + if (process.env.NODE_ENV !== 'production') { + var printWarning = function printWarning(format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; - var columnGroupFlexGrow = getTotalFlexGrow(currentColumns); - var columnGroupFlexWidth = Math.floor(columnGroupFlexGrow / remainingFlexGrow * remainingFlexWidth); + warning = function warning(condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } - var newColumnSettings = distributeFlexWidth(currentColumns, columnGroupFlexWidth); + if (format.indexOf('Failed Composite propType: ') === 0) { + return; // Ignore CompositeComponent proptype check. + } - remainingFlexGrow -= columnGroupFlexGrow; - remainingFlexWidth -= columnGroupFlexWidth; + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } - for (var j = 0; j < newColumnSettings.columns.length; ++j) { - newAllColumns.push(newColumnSettings.columns[j]); + printWarning.apply(undefined, [format].concat(args)); } + }; + } - newColumnGroups.push(React.cloneElement(columnGroup, { width: newColumnSettings.width })); - } + module.exports = warning; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28))) - return { - columns: newAllColumns, - columnGroups: newColumnGroups }; - } +/***/ }), +/* 42 */ +/***/ (function(module, exports) { - function adjustColumnWidths( - /*array*/columns, - /*number*/expectedWidth) /*array*/{ - var columnsWidth = getTotalWidth(columns); - if (columnsWidth < expectedWidth) { - return distributeFlexWidth(columns, expectedWidth - columnsWidth).columns; - } - return columns; + "use strict"; + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + function makeEmptyFunction(arg) { + return function () { + return arg; + }; } - var FixedDataTableWidthHelper = { - getTotalWidth: getTotalWidth, - getTotalFlexGrow: getTotalFlexGrow, - distributeFlexWidth: distributeFlexWidth, - adjustColumnWidths: adjustColumnWidths, - adjustColumnGroupWidths: adjustColumnGroupWidths }; + /** + * This function accepts and discards inputs; it has no side effects. This is + * primarily useful idiomatically for overridable function endpoints which + * always need to be callable, since JS lacks a null-call idiom ala Cocoa. + */ + var emptyFunction = function emptyFunction() {}; - module.exports = FixedDataTableWidthHelper; + emptyFunction.thatReturns = makeEmptyFunction; + emptyFunction.thatReturnsFalse = makeEmptyFunction(false); + emptyFunction.thatReturnsTrue = makeEmptyFunction(true); + emptyFunction.thatReturnsNull = makeEmptyFunction(null); + emptyFunction.thatReturnsThis = function () { + return this; + }; + emptyFunction.thatReturnsArgument = function (arg) { + return arg; + }; -/***/ }, -/* 31 */ -/***/ function(module, exports, __webpack_require__) { + module.exports = emptyFunction; + +/***/ }), +/* 43 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -1906,9 +4110,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = ReactComponentWithPureRenderMixin; -/***/ }, -/* 32 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -1931,9 +4135,9 @@ return /******/ (function(modules) { // webpackBootstrap function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var emptyFunction = __webpack_require__(33); - var normalizeWheel = __webpack_require__(34); - var requestAnimationFramePolyfill = __webpack_require__(38); + var emptyFunction = __webpack_require__(45); + var normalizeWheel = __webpack_require__(46); + var requestAnimationFramePolyfill = __webpack_require__(50); var ReactWheelHandler = (function () { /** @@ -2016,9 +4220,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = ReactWheelHandler; -/***/ }, -/* 33 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 45 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -2059,9 +4263,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = emptyFunction; -/***/ }, -/* 34 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -2077,9 +4281,9 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var UserAgent_DEPRECATED = __webpack_require__(35); + var UserAgent_DEPRECATED = __webpack_require__(47); - var isEventSupported = __webpack_require__(36); + var isEventSupported = __webpack_require__(48); // Reasonable defaults var PIXEL_STEP = 10; @@ -2260,9 +4464,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = normalizeWheel; -/***/ }, -/* 35 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 47 */ +/***/ (function(module, exports) { /** * Copyright 2004-present Facebook. All Rights Reserved. @@ -2524,7 +4728,7 @@ return /******/ (function(modules) { // webpackBootstrap }, mobile: function mobile() { - return _populate() || (_iphone || _ipad || _android || _mobile); + return _populate() || _iphone || _ipad || _android || _mobile; }, nativeApp: function nativeApp() { @@ -2543,9 +4747,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = UserAgent_DEPRECATED; -/***/ }, -/* 36 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-2015, Facebook, Inc. @@ -2560,7 +4764,7 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var ExecutionEnvironment = __webpack_require__(37); + var ExecutionEnvironment = __webpack_require__(49); var useHasFeature; if (ExecutionEnvironment.canUseDOM) { @@ -2608,9 +4812,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = isEventSupported; -/***/ }, -/* 37 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 49 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -2651,9 +4855,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = ExecutionEnvironment; -/***/ }, -/* 38 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2015, Facebook, Inc. @@ -2668,8 +4872,8 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var emptyFunction = __webpack_require__(33); - var nativeRequestAnimationFrame = __webpack_require__(39); + var emptyFunction = __webpack_require__(45); + var nativeRequestAnimationFrame = __webpack_require__(51); var lastTime = 0; @@ -2692,9 +4896,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = requestAnimationFrame; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) -/***/ }, -/* 39 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 51 */ +/***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2015, Facebook, Inc. @@ -2714,9 +4918,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = nativeRequestAnimationFrame; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) -/***/ }, -/* 40 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -2732,23 +4936,24 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var DOMMouseMoveTracker = __webpack_require__(41); - var Keys = __webpack_require__(44); - var React = __webpack_require__(27); - var ReactDOM = __webpack_require__(45); - var ReactComponentWithPureRenderMixin = __webpack_require__(31); - var ReactWheelHandler = __webpack_require__(32); - - var cssVar = __webpack_require__(47); - var cx = __webpack_require__(48); - var emptyFunction = __webpack_require__(33); - var translateDOMPositionXY = __webpack_require__(49); + var DOMMouseMoveTracker = __webpack_require__(53); + var Keys = __webpack_require__(56); + var PropTypes = __webpack_require__(27); + var React = __webpack_require__(34); + var createReactClass = __webpack_require__(37); + var ReactDOM = __webpack_require__(57); + var ReactComponentWithPureRenderMixin = __webpack_require__(43); + var ReactWheelHandler = __webpack_require__(44); - var PropTypes = React.PropTypes; + var cssVar = __webpack_require__(59); + var cx = __webpack_require__(60); + var emptyFunction = __webpack_require__(45); + var translateDOMPositionXY = __webpack_require__(61); var UNSCROLLABLE_STATE = { position: 0, - scrollable: false }; + scrollable: false + }; var FACE_MARGIN = parseInt(cssVar('scrollbar-face-margin'), 10); var FACE_MARGIN_2 = FACE_MARGIN * 2; @@ -2757,9 +4962,8 @@ return /******/ (function(modules) { // webpackBootstrap var _lastScrolledScrollbar = null; - var Scrollbar = React.createClass({ - displayName: 'Scrollbar', - + var Scrollbar = createReactClass({ + displayName: "Scrollbar", mixins: [ReactComponentWithPureRenderMixin], propTypes: { @@ -2795,7 +4999,8 @@ return /******/ (function(modules) { // webpackBootstrap isOpaque: false, onScroll: emptyFunction, orientation: 'vertical', - zIndex: 99 }; + zIndex: 99 + }; }, render: function render() /*?object*/{ @@ -2819,20 +5024,23 @@ return /******/ (function(modules) { // webpackBootstrap 'ScrollbarLayout/mainHorizontal': isHorizontal, 'public/Scrollbar/main': true, 'public/Scrollbar/mainOpaque': isOpaque, - 'public/Scrollbar/mainActive': isActive }); + 'public/Scrollbar/mainActive': isActive + }); var faceClassName = cx({ 'ScrollbarLayout/face': true, 'ScrollbarLayout/faceHorizontal': isHorizontal, 'ScrollbarLayout/faceVertical': isVertical, 'public/Scrollbar/faceActive': isActive, - 'public/Scrollbar/face': true }); + 'public/Scrollbar/face': true + }); var position = this.state.position * this.state.scale + FACE_MARGIN; if (isHorizontal) { mainStyle = { - width: size }; + width: size + }; faceStyle = { width: faceSize - FACE_MARGIN_2 }; @@ -2840,9 +5048,11 @@ return /******/ (function(modules) { // webpackBootstrap } else { mainStyle = { top: verticalTop, - height: size }; + height: size + }; faceStyle = { - height: faceSize - FACE_MARGIN_2 }; + height: faceSize - FACE_MARGIN_2 + }; translateDOMPositionXY(faceStyle, 0, position); } @@ -2886,6 +5096,8 @@ return /******/ (function(modules) { // webpackBootstrap if (this.props.position !== undefined && this.state.position !== this.props.position) { this._didScroll(); } + + this._isMounted = true; }, componentWillUnmount: function componentWillUnmount() { @@ -2895,6 +5107,8 @@ return /******/ (function(modules) { // webpackBootstrap _lastScrolledScrollbar = null; } delete this._mouseMoveTracker; + + this._isMounted = false; }, scrollBy: function scrollBy( /*number*/delta) { @@ -2923,7 +5137,7 @@ return /******/ (function(modules) { // webpackBootstrap return UNSCROLLABLE_STATE; } - var stateKey = '' + position + '_' + size + '_' + contentSize + '_' + orientation; + var stateKey = position + '_' + size + '_' + contentSize + '_' + orientation; if (this._stateKey === stateKey) { return this._stateForKey; } @@ -2962,7 +5176,8 @@ return /******/ (function(modules) { // webpackBootstrap isHorizontal: isHorizontal, position: position, scale: scale, - scrollable: scrollable }; + scrollable: scrollable + }; // cache the state for later use. this._stateKey = stateKey; @@ -3103,20 +5318,24 @@ return /******/ (function(modules) { // webpackBootstrap _onFocus: function _onFocus() { this.setState({ - focused: true }); + focused: true + }); }, _onBlur: function _onBlur() { this.setState({ - focused: false }); + focused: false + }); }, _blur: function _blur() { - if (this.isMounted()) { + if (this._isMounted) { try { this._onBlur(); ReactDOM.findDOMNode(this).blur(); - } catch (oops) {} + } catch (oops) { + // pass + } } }, @@ -3146,18 +5365,17 @@ return /******/ (function(modules) { // webpackBootstrap _didScroll: function _didScroll() { this.props.onScroll(this.state.position); - } }); + } + }); Scrollbar.KEYBOARD_SCROLL_AMOUNT = KEYBOARD_SCROLL_AMOUNT; Scrollbar.SIZE = parseInt(cssVar('scrollbar-size'), 10); module.exports = Scrollbar; - // pass - -/***/ }, -/* 41 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3184,10 +5402,10 @@ return /******/ (function(modules) { // webpackBootstrap function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var EventListener = __webpack_require__(42); + var EventListener = __webpack_require__(54); - var cancelAnimationFramePolyfill = __webpack_require__(43); - var requestAnimationFramePolyfill = __webpack_require__(38); + var cancelAnimationFramePolyfill = __webpack_require__(55); + var requestAnimationFramePolyfill = __webpack_require__(50); var DOMMouseMoveTracker = (function () { /** @@ -3211,15 +5429,15 @@ return /******/ (function(modules) { // webpackBootstrap this._didMouseMove = this._didMouseMove.bind(this); } + /** + * This is to set up the listeners for listening to mouse move + * and mouse up signaling the movement has ended. Please note that these + * listeners are added at the document.body level. It takes in an event + * in order to grab inital state. + */ + _createClass(DOMMouseMoveTracker, [{ key: 'captureMouseMoves', - - /** - * This is to set up the listeners for listening to mouse move - * and mouse up signaling the movement has ended. Please note that these - * listeners are added at the document.body level. It takes in an event - * in order to grab inital state. - */ value: function captureMouseMoves( /*object*/event) { if (!this._eventMoveToken && !this._eventUpToken) { this._eventMoveToken = EventListener.listen(this._domNode, 'mousemove', this._onMouseMove); @@ -3235,12 +5453,12 @@ return /******/ (function(modules) { // webpackBootstrap } event.preventDefault(); } - }, { - key: 'releaseMouseMoves', /** * These releases all of the listeners on document.body. */ + }, { + key: 'releaseMouseMoves', value: function releaseMouseMoves() { if (this._eventMoveToken && this._eventUpToken) { this._eventMoveToken.remove(); @@ -3260,21 +5478,21 @@ return /******/ (function(modules) { // webpackBootstrap this._y = null; } } - }, { - key: 'isDragging', /** * Returns whether or not if the mouse movement is being tracked. */ + }, { + key: 'isDragging', value: function isDragging() /*boolean*/{ return this._isDragging; } - }, { - key: '_onMouseMove', /** * Calls onMove passed into constructor and updates internal state. */ + }, { + key: '_onMouseMove', value: function _onMouseMove( /*object*/event) { var x = event.clientX; var y = event.clientY; @@ -3300,12 +5518,12 @@ return /******/ (function(modules) { // webpackBootstrap this._deltaX = 0; this._deltaY = 0; } - }, { - key: '_onMouseUp', /** * Calls onMoveEnd passed into constructor and updates internal state. */ + }, { + key: '_onMouseUp', value: function _onMouseUp() { if (this._animationFrameID) { this._didMouseMove(); @@ -3319,9 +5537,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = DOMMouseMoveTracker; -/***/ }, -/* 42 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3337,7 +5555,7 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var emptyFunction = __webpack_require__(33); + var emptyFunction = __webpack_require__(45); /** * Upstream version of event listener. Does not take into account specific @@ -3387,7 +5605,7 @@ return /******/ (function(modules) { // webpackBootstrap } }; } else { - if (true) { + if (false) { console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); } return { @@ -3401,9 +5619,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = EventListener; -/***/ }, -/* 43 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 55 */ +/***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2015, Facebook, Inc. @@ -3427,9 +5645,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = cancelAnimationFrame; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) -/***/ }, -/* 44 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 56 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3469,9 +5687,9 @@ return /******/ (function(modules) { // webpackBootstrap NUMPAD_9: 105 }; -/***/ }, -/* 45 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3486,17 +5704,17 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - module.exports = __webpack_require__(46); + module.exports = __webpack_require__(58); -/***/ }, -/* 46 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 58 */ +/***/ (function(module, exports) { - module.exports = __WEBPACK_EXTERNAL_MODULE_46__; + module.exports = __WEBPACK_EXTERNAL_MODULE_58__; -/***/ }, -/* 47 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 59 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3510,7 +5728,7 @@ return /******/ (function(modules) { // webpackBootstrap * @typechecks */ - 'use strict'; + "use strict"; var CSS_VARS = { 'scrollbar-face-active-color': '#7d7d7d', @@ -3521,7 +5739,8 @@ return /******/ (function(modules) { // webpackBootstrap 'scrollbar-size-large': '17px', 'scrollbar-track-color': 'rgba(255, 255, 255, 0.8)', 'fbui-white': '#fff', - 'fbui-desktop-background-light': '#f6f7f8' }; + 'fbui-desktop-background-light': '#f6f7f8' + }; /** * @param {string} name @@ -3538,9 +5757,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = cssVar; -/***/ }, -/* 48 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 60 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3597,9 +5816,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = cx; -/***/ }, -/* 49 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2015, Facebook, Inc. @@ -3615,9 +5834,9 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var BrowserSupportCore = __webpack_require__(50); + var BrowserSupportCore = __webpack_require__(62); - var getVendorPrefixedName = __webpack_require__(51); + var getVendorPrefixedName = __webpack_require__(63); var TRANSFORM = getVendorPrefixedName('transform'); var BACKFACE_VISIBILITY = getVendorPrefixedName('backfaceVisibility'); @@ -3651,9 +5870,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = translateDOMPositionXY; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) -/***/ }, -/* 50 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3668,7 +5887,7 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var getVendorPrefixedName = __webpack_require__(51); + var getVendorPrefixedName = __webpack_require__(63); var BrowserSupportCore = { /** @@ -3697,13 +5916,14 @@ return /******/ (function(modules) { // webpackBootstrap */ hasCSSTransitions: function hasCSSTransitions() { return !!getVendorPrefixedName('transition'); - } }; + } + }; module.exports = BrowserSupportCore; -/***/ }, -/* 51 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3719,10 +5939,10 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var ExecutionEnvironment = __webpack_require__(37); + var ExecutionEnvironment = __webpack_require__(49); - var camelize = __webpack_require__(52); - var invariant = __webpack_require__(53); + var camelize = __webpack_require__(64); + var invariant = __webpack_require__(65); var memoized = {}; var prefixes = ['Webkit', 'ms', 'Moz', 'O']; @@ -3758,9 +5978,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = getVendorPrefixedName; -/***/ }, -/* 52 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 64 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3795,9 +6015,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = camelize; -/***/ }, -/* 53 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 65 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -3810,7 +6030,7 @@ return /******/ (function(modules) { // webpackBootstrap * @providesModule invariant */ - 'use strict'; + "use strict"; /** * Use invariant() to assert state which your program assumes to be true. @@ -3824,7 +6044,7 @@ return /******/ (function(modules) { // webpackBootstrap */ var invariant = function invariant(condition, format, a, b, c, d, e, f) { - if (true) { + if (false) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } @@ -3849,10 +6069,13 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = invariant; -/***/ }, -/* 54 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { + 'use strict'; + + var PropTypes = __webpack_require__(27); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -3865,21 +6088,18 @@ return /******/ (function(modules) { // webpackBootstrap * @typechecks */ - 'use strict'; - - var React = __webpack_require__(27); - var FixedDataTableRowBuffer = __webpack_require__(55); - var FixedDataTableRow = __webpack_require__(59); + var React = __webpack_require__(34); + var createReactClass = __webpack_require__(37); + var FixedDataTableRowBuffer = __webpack_require__(67); + var FixedDataTableRow = __webpack_require__(71); - var cx = __webpack_require__(48); - var emptyFunction = __webpack_require__(33); - var joinClasses = __webpack_require__(67); - var translateDOMPositionXY = __webpack_require__(49); + var cx = __webpack_require__(60); + var emptyFunction = __webpack_require__(45); + var joinClasses = __webpack_require__(79); + var translateDOMPositionXY = __webpack_require__(61); - var PropTypes = React.PropTypes; - - var FixedDataTableBufferedRows = React.createClass({ - displayName: 'FixedDataTableBufferedRows', + var FixedDataTableBufferedRows = createReactClass({ + displayName: "FixedDataTableBufferedRows", propTypes: { isScrolling: PropTypes.bool, @@ -3901,12 +6121,14 @@ return /******/ (function(modules) { // webpackBootstrap scrollLeft: PropTypes.number.isRequired, scrollableColumns: PropTypes.array.isRequired, showLastRowBorder: PropTypes.bool, - width: PropTypes.number.isRequired }, + width: PropTypes.number.isRequired + }, getInitialState: function getInitialState() /*object*/{ this._rowBuffer = new FixedDataTableRowBuffer(this.props.rowsCount, this.props.defaultRowHeight, this.props.height, this._getRowHeight); return { - rowsToRender: this._rowBuffer.getRows(this.props.firstRowIndex, this.props.firstRowOffset) }; + rowsToRender: this._rowBuffer.getRows(this.props.firstRowIndex, this.props.firstRowOffset) + }; }, componentWillMount: function componentWillMount() { @@ -3915,6 +6137,7 @@ return /******/ (function(modules) { // webpackBootstrap componentDidMount: function componentDidMount() { setTimeout(this._updateBuffer, 1000); + this._isMounted = true; }, componentWillReceiveProps: function componentWillReceiveProps( /*object*/nextProps) { @@ -3925,14 +6148,16 @@ return /******/ (function(modules) { // webpackBootstrap this._updateBuffer(); } else { this.setState({ - rowsToRender: this._rowBuffer.getRows(nextProps.firstRowIndex, nextProps.firstRowOffset) }); + rowsToRender: this._rowBuffer.getRows(nextProps.firstRowIndex, nextProps.firstRowOffset) + }); } }, _updateBuffer: function _updateBuffer() { - if (this.isMounted()) { + if (this._isMounted) { this.setState({ - rowsToRender: this._rowBuffer.getRowsWithUpdatedBuffer() }); + rowsToRender: this._rowBuffer.getRowsWithUpdatedBuffer() + }); } }, @@ -3943,6 +6168,7 @@ return /******/ (function(modules) { // webpackBootstrap componentWillUnmount: function componentWillUnmount() { this._staticRowArray.length = 0; + this._isMounted = false; }, render: function render() /*object*/{ @@ -3977,7 +6203,12 @@ return /******/ (function(modules) { // webpackBootstrap onMouseLeave: props.onRowMouseLeave, className: joinClasses(rowClassNameGetter(rowIndex), cx('public/fixedDataTable/bodyRow'), cx({ 'fixedDataTableLayout/hasBottomBorder': hasBottomBorder, - 'public/fixedDataTable/hasBottomBorder': hasBottomBorder })) + 'public/fixedDataTable/hasBottomBorder': hasBottomBorder + })), + onColumnResize: props.onColumnResize, + isHoveringResizerKnob: props.isHoveringResizerKnob, + setHoverState: props.setHoverState, + isColumnResizing: props.isColumnResizing }); } @@ -3985,7 +6216,8 @@ return /******/ (function(modules) { // webpackBootstrap var style = { position: 'absolute', - pointerEvents: props.isScrolling ? 'none' : 'auto' }; + pointerEvents: props.isScrolling ? 'none' : 'auto' + }; translateDOMPositionXY(style, 0, props.firstRowOffset - firstRowPosition + props.offsetTop); @@ -3998,13 +6230,14 @@ return /******/ (function(modules) { // webpackBootstrap _getRowHeight: function _getRowHeight( /*number*/index) /*number*/{ return this.props.rowHeightGetter ? this.props.rowHeightGetter(index) : this.props.defaultRowHeight; - } }); + } + }); module.exports = FixedDataTableBufferedRows; -/***/ }, -/* 55 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -4024,10 +6257,10 @@ return /******/ (function(modules) { // webpackBootstrap function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var IntegerBufferSet = __webpack_require__(56); + var IntegerBufferSet = __webpack_require__(68); - var clamp = __webpack_require__(58); - var invariant = __webpack_require__(53); + var clamp = __webpack_require__(70); + var invariant = __webpack_require__(65); var MIN_BUFFER_ROWS = 3; var MAX_BUFFER_ROWS = 6; @@ -4043,7 +6276,7 @@ return /******/ (function(modules) { // webpackBootstrap /*?function*/rowHeightGetter) { _classCallCheck(this, FixedDataTableRowBuffer); - invariant(defaultRowHeight !== 0, 'defaultRowHeight musn\'t be equal 0 in FixedDataTableRowBuffer'); + invariant(defaultRowHeight !== 0, "defaultRowHeight musn't be equal 0 in FixedDataTableRowBuffer"); this._bufferSet = new IntegerBufferSet(); this._defaultRowHeight = defaultRowHeight; @@ -4130,9 +6363,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = FixedDataTableRowBuffer; -/***/ }, -/* 56 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -4152,9 +6385,9 @@ return /******/ (function(modules) { // webpackBootstrap function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var Heap = __webpack_require__(57); + var Heap = __webpack_require__(69); - var invariant = __webpack_require__(53); + var invariant = __webpack_require__(65); // Data structure that allows to store values and assign positions to them // in a way to minimize changing positions of stored values when new ones are @@ -4201,7 +6434,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'getNewPositionForValue', value: function getNewPositionForValue( /*number*/value) /*number*/{ - invariant(this._valueToPositionMap[value] === undefined, 'Shouldn\'t try to find new position for value already stored in BufferSet'); + invariant(this._valueToPositionMap[value] === undefined, "Shouldn't try to find new position for value already stored in BufferSet"); var newPosition = this._size; this._size++; this._pushToHeaps(newPosition, value); @@ -4214,7 +6447,7 @@ return /******/ (function(modules) { // webpackBootstrap /*number*/lowValue, /*number*/highValue, /*number*/newValue) /*?number*/{ - invariant(this._valueToPositionMap[newValue] === undefined, 'Shouldn\'t try to replace values with value already stored value in ' + 'BufferSet'); + invariant(this._valueToPositionMap[newValue] === undefined, "Shouldn't try to replace values with value already stored value in " + "BufferSet"); this._cleanHeaps(); if (this._smallValues.empty() || this._largeValues.empty()) { @@ -4251,7 +6484,8 @@ return /******/ (function(modules) { // webpackBootstrap value: function _pushToHeaps( /*number*/position, /*number*/value) { var element = { position: position, - value: value }; + value: value + }; // We can reuse the same object in both heaps, because we don't mutate them this._smallValues.push(element); this._largeValues.push(element); @@ -4314,9 +6548,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = IntegerBufferSet; -/***/ }, -/* 57 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 69 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -4333,15 +6567,16 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - /* * @param {*} a * @param {*} b * @return {boolean} */ + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + function defaultComparator(a, b) { return a < b; } @@ -4356,21 +6591,21 @@ return /******/ (function(modules) { // webpackBootstrap this._heapify(); } + /* + * @return {boolean} + */ + _createClass(Heap, [{ key: 'empty', - - /* - * @return {boolean} - */ value: function empty() { return this._size === 0; } - }, { - key: 'pop', /* * @return {*} */ + }, { + key: 'pop', value: function pop() { if (this._size === 0) { return; @@ -4388,31 +6623,31 @@ return /******/ (function(modules) { // webpackBootstrap return elt; } - }, { - key: 'push', /* * @param {*} item */ + }, { + key: 'push', value: function push(item) { this._items[this._size++] = item; this._bubbleUp(this._size - 1); } - }, { - key: 'size', /* * @return {number} */ + }, { + key: 'size', value: function size() { return this._size; } - }, { - key: 'peek', /* * @return {*} */ + }, { + key: 'peek', value: function peek() { if (this._size === 0) { return; @@ -4427,12 +6662,12 @@ return /******/ (function(modules) { // webpackBootstrap this._sinkDown(index); } } - }, { - key: '_bubbleUp', /* * @parent {number} index */ + }, { + key: '_bubbleUp', value: function _bubbleUp(index) { var elt = this._items[index]; while (index > 0) { @@ -4450,12 +6685,12 @@ return /******/ (function(modules) { // webpackBootstrap index = parentIndex; } } - }, { - key: '_sinkDown', /* * @parent {number} index */ + }, { + key: '_sinkDown', value: function _sinkDown(index) { var elt = this._items[index]; @@ -4497,9 +6732,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = Heap; -/***/ }, -/* 58 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 70 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -4534,9 +6769,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = clamp; -/***/ }, -/* 59 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -4554,235 +6789,282 @@ return /******/ (function(modules) { // webpackBootstrap var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - var React = __webpack_require__(27); - var FixedDataTableCellGroup = __webpack_require__(60); + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - var cx = __webpack_require__(48); - var joinClasses = __webpack_require__(67); - var translateDOMPositionXY = __webpack_require__(49); + var PropTypes = __webpack_require__(27); - var PropTypes = React.PropTypes; + var React = __webpack_require__(34); + var FixedDataTableCellGroup = __webpack_require__(72); + + var cx = __webpack_require__(60); + var joinClasses = __webpack_require__(79); + var translateDOMPositionXY = __webpack_require__(61); /** * Component that renders the row for . * This component should not be used directly by developer. Instead, * only should use the component internally. */ - var FixedDataTableRowImpl = React.createClass({ - displayName: 'FixedDataTableRowImpl', - - propTypes: { - - isScrolling: PropTypes.bool, - - /** - * Array of for the fixed columns. - */ - fixedColumns: PropTypes.array.isRequired, - /** - * Height of the row. - */ - height: PropTypes.number.isRequired, + var FixedDataTableRowImpl = (function (_React$Component) { + _inherits(FixedDataTableRowImpl, _React$Component); - /** - * The row index. - */ - index: PropTypes.number.isRequired, + function FixedDataTableRowImpl() { + var _this = this; - /** - * Array of for the scrollable columns. - */ - scrollableColumns: PropTypes.array.isRequired, + _classCallCheck(this, FixedDataTableRowImpl); - /** - * The distance between the left edge of the table and the leftmost portion - * of the row currently visible in the table. - */ - scrollLeft: PropTypes.number.isRequired, + _get(Object.getPrototypeOf(FixedDataTableRowImpl.prototype), 'constructor', this).apply(this, arguments); - /** - * Width of the row. - */ - width: PropTypes.number.isRequired, + this._getColumnsWidth = /*array*/function (columns) /*number*/{ + var width = 0; + for (var i = 0; i < columns.length; ++i) { + width += columns[i].props.width; + } + return width; + }; - /** - * Fire when a row is clicked. - */ - onClick: PropTypes.func, + this._renderColumnsShadow = /*number*/function (left) /*?object*/{ + if (left > 0) { + var className = cx({ + 'fixedDataTableRowLayout/fixedColumnsDivider': true, + 'fixedDataTableRowLayout/columnsShadow': _this.props.scrollLeft > 0, + 'public/fixedDataTableRow/fixedColumnsDivider': true, + 'public/fixedDataTableRow/columnsShadow': _this.props.scrollLeft > 0 + }); + var style = { + left: left, + height: _this.props.height + }; + return React.createElement('div', { className: className, style: style }); + } + }; - /** - * Fire when a row is double clicked. - */ - onDoubleClick: PropTypes.func, + this._onClick = /*object*/function (event) { + _this.props.onClick(event, _this.props.index); + }; - /** - * Callback for when resizer knob (in FixedDataTableCell) is clicked - * to initialize resizing. Please note this is only on the cells - * in the header. - * @param number combinedWidth - * @param number leftOffset - * @param number cellWidth - * @param number|string columnKey - * @param object event - */ - onColumnResize: PropTypes.func }, + this._onDoubleClick = /*object*/function (event) { + _this.props.onDoubleClick(event, _this.props.index); + }; - render: function render() /*object*/{ - var style = { - width: this.props.width, - height: this.props.height }; - - var className = cx({ - 'fixedDataTableRowLayout/main': true, - 'public/fixedDataTableRow/main': true, - 'public/fixedDataTableRow/highlighted': this.props.index % 2 === 1, - 'public/fixedDataTableRow/odd': this.props.index % 2 === 1, - 'public/fixedDataTableRow/even': this.props.index % 2 === 0 }); - - var fixedColumnsWidth = this._getColumnsWidth(this.props.fixedColumns); - var fixedColumns = React.createElement(FixedDataTableCellGroup, { - key: 'fixed_cells', - isScrolling: this.props.isScrolling, - height: this.props.height, - left: 0, - width: fixedColumnsWidth, - zIndex: 2, - columns: this.props.fixedColumns, - onColumnResize: this.props.onColumnResize, - rowHeight: this.props.height, - rowIndex: this.props.index - }); - var columnsShadow = this._renderColumnsShadow(fixedColumnsWidth); - var scrollableColumns = React.createElement(FixedDataTableCellGroup, { - key: 'scrollable_cells', - isScrolling: this.props.isScrolling, - height: this.props.height, - left: this.props.scrollLeft, - offsetLeft: fixedColumnsWidth, - width: this.props.width - fixedColumnsWidth, - zIndex: 0, - columns: this.props.scrollableColumns, - onColumnResize: this.props.onColumnResize, - rowHeight: this.props.height, - rowIndex: this.props.index - }); + this._onMouseDown = /*object*/function (event) { + _this.props.onMouseDown(event, _this.props.index); + }; - return React.createElement( - 'div', - { - className: joinClasses(className, this.props.className), - onClick: this.props.onClick ? this._onClick : null, - onDoubleClick: this.props.onDoubleClick ? this._onDoubleClick : null, - onMouseDown: this.props.onMouseDown ? this._onMouseDown : null, - onMouseEnter: this.props.onMouseEnter ? this._onMouseEnter : null, - onMouseLeave: this.props.onMouseLeave ? this._onMouseLeave : null, - style: style }, - React.createElement( - 'div', - { className: cx('fixedDataTableRowLayout/body') }, - fixedColumns, - scrollableColumns, - columnsShadow - ) - ); - }, + this._onMouseEnter = /*object*/function (event) { + _this.props.onMouseEnter(event, _this.props.index); + }; - _getColumnsWidth: function _getColumnsWidth( /*array*/columns) /*number*/{ - var width = 0; - for (var i = 0; i < columns.length; ++i) { - width += columns[i].props.width; - } - return width; - }, + this._onMouseLeave = /*object*/function (event) { + _this.props.onMouseLeave(event, _this.props.index); + }; + } - _renderColumnsShadow: function _renderColumnsShadow( /*number*/left) /*?object*/{ - if (left > 0) { - var className = cx({ - 'fixedDataTableRowLayout/fixedColumnsDivider': true, - 'fixedDataTableRowLayout/columnsShadow': this.props.scrollLeft > 0, - 'public/fixedDataTableRow/fixedColumnsDivider': true, - 'public/fixedDataTableRow/columnsShadow': this.props.scrollLeft > 0 }); + _createClass(FixedDataTableRowImpl, [{ + key: 'render', + value: function render() /*object*/{ var style = { - left: left, + width: this.props.width, height: this.props.height }; - return React.createElement('div', { className: className, style: style }); - } - }, - - _onClick: function _onClick( /*object*/event) { - this.props.onClick(event, this.props.index); - }, - - _onDoubleClick: function _onDoubleClick( /*object*/event) { - this.props.onDoubleClick(event, this.props.index); - }, - - _onMouseDown: function _onMouseDown( /*object*/event) { - this.props.onMouseDown(event, this.props.index); - }, - - _onMouseEnter: function _onMouseEnter( /*object*/event) { - this.props.onMouseEnter(event, this.props.index); - }, - _onMouseLeave: function _onMouseLeave( /*object*/event) { - this.props.onMouseLeave(event, this.props.index); - } }); + var className = cx({ + 'fixedDataTableRowLayout/main': true, + 'public/fixedDataTableRow/main': true, + 'public/fixedDataTableRow/highlighted': this.props.index % 2 === 1, + 'public/fixedDataTableRow/odd': this.props.index % 2 === 1, + 'public/fixedDataTableRow/even': this.props.index % 2 === 0 + }); - var FixedDataTableRow = React.createClass({ - displayName: 'FixedDataTableRow', + var fixedColumnsWidth = this._getColumnsWidth(this.props.fixedColumns); + var fixedColumns = React.createElement(FixedDataTableCellGroup, { + key: 'fixed_cells', + isScrolling: this.props.isScrolling, + height: this.props.height, + left: 0, + width: fixedColumnsWidth, + zIndex: 2, + columns: this.props.fixedColumns, + onColumnResize: this.props.onColumnResize, + isHoveringResizerKnob: this.props.isHoveringResizerKnob, + setHoverState: this.props.setHoverState, + rowHeight: this.props.height, + rowIndex: this.props.index + }); + var columnsShadow = this._renderColumnsShadow(fixedColumnsWidth); + var scrollableColumns = React.createElement(FixedDataTableCellGroup, { + key: 'scrollable_cells', + isScrolling: this.props.isScrolling, + height: this.props.height, + left: this.props.scrollLeft, + offsetLeft: fixedColumnsWidth, + width: this.props.width - fixedColumnsWidth, + zIndex: 0, + columns: this.props.scrollableColumns, + onColumnResize: this.props.onColumnResize, + rowHeight: this.props.height, + rowIndex: this.props.index + }); - propTypes: { + return React.createElement( + 'div', + { + className: joinClasses(className, this.props.className), + onClick: this.props.onClick ? this._onClick : null, + onDoubleClick: this.props.onDoubleClick ? this._onDoubleClick : null, + onMouseDown: this.props.onMouseDown ? this._onMouseDown : null, + onMouseEnter: this.props.onMouseEnter ? this._onMouseEnter : null, + onMouseLeave: this.props.onMouseLeave ? this._onMouseLeave : null, + style: style }, + React.createElement( + 'div', + { className: cx('fixedDataTableRowLayout/body') }, + fixedColumns, + scrollableColumns, + columnsShadow + ) + ); + } + }], [{ + key: 'propTypes', + value: { + + isScrolling: PropTypes.bool, + + /** + * Array of for the fixed columns. + */ + fixedColumns: PropTypes.array.isRequired, + + /** + * Height of the row. + */ + height: PropTypes.number.isRequired, + + /** + * The row index. + */ + index: PropTypes.number.isRequired, + + /** + * Array of for the scrollable columns. + */ + scrollableColumns: PropTypes.array.isRequired, + + /** + * The distance between the left edge of the table and the leftmost portion + * of the row currently visible in the table. + */ + scrollLeft: PropTypes.number.isRequired, + + /** + * Width of the row. + */ + width: PropTypes.number.isRequired, + + /** + * Fire when a row is clicked. + */ + onClick: PropTypes.func, + + /** + * Fire when a row is double clicked. + */ + onDoubleClick: PropTypes.func, + + /** + * Callback for when resizer knob (in FixedDataTableCell) is clicked + * to initialize resizing. Please note this is only on the cells + * in the header. + * @param number combinedWidth + * @param number leftOffset + * @param number cellWidth + * @param number|string columnKey + * @param object event + */ + onColumnResize: PropTypes.func + }, + enumerable: true + }]); - isScrolling: PropTypes.bool, + return FixedDataTableRowImpl; + })(React.Component); - /** - * Height of the row. - */ - height: PropTypes.number.isRequired, + var FixedDataTableRow = (function (_React$Component2) { + _inherits(FixedDataTableRow, _React$Component2); - /** - * Z-index on which the row will be displayed. Used e.g. for keeping - * header and footer in front of other rows. - */ - zIndex: PropTypes.number, + function FixedDataTableRow() { + _classCallCheck(this, FixedDataTableRow); - /** - * The vertical position where the row should render itself - */ - offsetTop: PropTypes.number.isRequired, + _get(Object.getPrototypeOf(FixedDataTableRow.prototype), 'constructor', this).apply(this, arguments); + } - /** - * Width of the row. - */ - width: PropTypes.number.isRequired }, + _createClass(FixedDataTableRow, [{ + key: 'render', + value: function render() /*object*/{ + var style = { + width: this.props.width, + height: this.props.height, + zIndex: this.props.zIndex ? this.props.zIndex : 0 + }; + translateDOMPositionXY(style, 0, this.props.offsetTop); - render: function render() /*object*/{ - var style = { - width: this.props.width, - height: this.props.height, - zIndex: this.props.zIndex ? this.props.zIndex : 0 }; - translateDOMPositionXY(style, 0, this.props.offsetTop); + return React.createElement( + 'div', + { + style: style, + className: cx('fixedDataTableRowLayout/rowWrapper') }, + React.createElement(FixedDataTableRowImpl, _extends({}, this.props, { + offsetTop: undefined, + zIndex: undefined + })) + ); + } + }], [{ + key: 'propTypes', + value: { + + isScrolling: PropTypes.bool, + + /** + * Height of the row. + */ + height: PropTypes.number.isRequired, + + /** + * Z-index on which the row will be displayed. Used e.g. for keeping + * header and footer in front of other rows. + */ + zIndex: PropTypes.number, + + /** + * The vertical position where the row should render itself + */ + offsetTop: PropTypes.number.isRequired, + + /** + * Width of the row. + */ + width: PropTypes.number.isRequired + }, + enumerable: true + }]); - return React.createElement( - 'div', - { - style: style, - className: cx('fixedDataTableRowLayout/rowWrapper') }, - React.createElement(FixedDataTableRowImpl, _extends({}, this.props, { - offsetTop: undefined, - zIndex: undefined - })) - ); - } }); + return FixedDataTableRow; + })(React.Component); module.exports = FixedDataTableRow; -/***/ }, -/* 60 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 72 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -4802,19 +7084,19 @@ return /******/ (function(modules) { // webpackBootstrap function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - var FixedDataTableHelper = __webpack_require__(61); - var React = __webpack_require__(27); - var FixedDataTableCell = __webpack_require__(65); - - var cx = __webpack_require__(48); - var translateDOMPositionXY = __webpack_require__(49); + var FixedDataTableHelper = __webpack_require__(73); + var PropTypes = __webpack_require__(27); + var React = __webpack_require__(34); + var createReactClass = __webpack_require__(37); + var FixedDataTableCell = __webpack_require__(77); - var PropTypes = React.PropTypes; + var cx = __webpack_require__(60); + var translateDOMPositionXY = __webpack_require__(61); var DIR_SIGN = FixedDataTableHelper.DIR_SIGN; - var FixedDataTableCellGroupImpl = React.createClass({ - displayName: 'FixedDataTableCellGroupImpl', + var FixedDataTableCellGroupImpl = createReactClass({ + displayName: "FixedDataTableCellGroupImpl", /** * PropTypes are disabled in this component, because having them on slows @@ -4840,7 +7122,8 @@ return /******/ (function(modules) { // webpackBootstrap width: PropTypes.number.isRequired, - zIndex: PropTypes.number.isRequired }, + zIndex: PropTypes.number.isRequired + }, render: function render() /*object*/{ var props = this.props; @@ -4863,7 +7146,8 @@ return /******/ (function(modules) { // webpackBootstrap height: props.height, position: 'absolute', width: contentWidth, - zIndex: props.zIndex }; + zIndex: props.zIndex + }; translateDOMPositionXY(style, -1 * DIR_SIGN * props.left, 0); return React.createElement( @@ -4896,6 +7180,8 @@ return /******/ (function(modules) { // webpackBootstrap maxWidth: columnProps.maxWidth, minWidth: columnProps.minWidth, onColumnResize: onColumnResize, + isHoveringResizerKnob: this.props.isHoveringResizerKnob, + setHoverState: this.props.setHoverState, rowIndex: rowIndex, columnKey: columnProps.columnKey, width: columnProps.width, @@ -4910,10 +7196,11 @@ return /******/ (function(modules) { // webpackBootstrap width += columns[i].props.width; } return width; - } }); + } + }); - var FixedDataTableCellGroup = React.createClass({ - displayName: 'FixedDataTableCellGroup', + var FixedDataTableCellGroup = createReactClass({ + displayName: "FixedDataTableCellGroup", /** * PropTypes are disabled in this component, because having them on slows @@ -4934,7 +7221,8 @@ return /******/ (function(modules) { // webpackBootstrap * Z-index on which the row will be displayed. Used e.g. for keeping * header and footer in front of other rows. */ - zIndex: PropTypes.number.isRequired }, + zIndex: PropTypes.number.isRequired + }, shouldComponentUpdate: function shouldComponentUpdate( /*object*/nextProps) /*boolean*/{ return !nextProps.isScrolling || this.props.rowIndex !== nextProps.rowIndex || this.props.left !== nextProps.left; @@ -4942,7 +7230,8 @@ return /******/ (function(modules) { // webpackBootstrap getDefaultProps: function getDefaultProps() /*object*/{ return { - offsetLeft: 0 }; + offsetLeft: 0 + }; }, render: function render() /*object*/{ @@ -4952,7 +7241,8 @@ return /******/ (function(modules) { // webpackBootstrap var props = _objectWithoutProperties(_props, ['offsetLeft']); var style = { - height: props.height }; + height: props.height + }; if (DIR_SIGN === 1) { style.left = offsetLeft; @@ -4981,13 +7271,14 @@ return /******/ (function(modules) { // webpackBootstrap /*string|number*/columnKey, /*object*/event) { this.props.onColumnResize && this.props.onColumnResize(this.props.offsetLeft, left - this.props.left + width, width, minWidth, maxWidth, columnKey, event); - } }); + } + }); module.exports = FixedDataTableCellGroup; -/***/ }, -/* 61 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -5003,10 +7294,10 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var Locale = __webpack_require__(62); - var React = __webpack_require__(27); - var FixedDataTableColumnGroup = __webpack_require__(63); - var FixedDataTableColumn = __webpack_require__(64); + var Locale = __webpack_require__(74); + var React = __webpack_require__(34); + var FixedDataTableColumnGroup = __webpack_require__(75); + var FixedDataTableColumn = __webpack_require__(76); var DIR_SIGN = Locale.isRTL() ? -1 : +1; // A cell up to 5px outside of the visible area will still be considered visible @@ -5071,7 +7362,8 @@ return /******/ (function(modules) { // webpackBootstrap // new children if (haveColumnsChanged) { newChild = React.cloneElement(originalChild, { - children: newColumns }); + children: newColumns + }); } } else if (originalChild.type === FixedDataTableColumn) { newChild = callback(originalChild); @@ -5088,13 +7380,14 @@ return /******/ (function(modules) { // webpackBootstrap CELL_VISIBILITY_TOLERANCE: CELL_VISIBILITY_TOLERANCE, renderToString: renderToString, forEachColumn: forEachColumn, - mapColumns: mapColumns }; + mapColumns: mapColumns + }; module.exports = FixedDataTableHelper; -/***/ }, -/* 62 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 74 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -5115,15 +7408,15 @@ return /******/ (function(modules) { // webpackBootstrap return false; }, getDirection: function getDirection() { - return "LTR"; + return 'LTR'; } }; module.exports = Locale; -/***/ }, -/* 63 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -5146,27 +7439,47 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(27); + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - var TransitionColumnGroup = React.createClass({ - displayName: 'TransitionColumnGroup', + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - statics: { - __TableColumnGroup__: true }, + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - render: function render() { - if (true) { - throw new Error('Component should never render'); - } - return null; + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var React = __webpack_require__(34); + + var TransitionColumnGroup = (function (_React$Component) { + _inherits(TransitionColumnGroup, _React$Component); + + function TransitionColumnGroup() { + _classCallCheck(this, TransitionColumnGroup); + + _get(Object.getPrototypeOf(TransitionColumnGroup.prototype), 'constructor', this).apply(this, arguments); } - }); + + _createClass(TransitionColumnGroup, [{ + key: 'render', + value: function render() { + if (false) { + throw new Error('Component should never render'); + } + return null; + } + }], [{ + key: '__TableColumnGroup__', + value: true, + enumerable: true + }]); + + return TransitionColumnGroup; + })(React.Component); module.exports = TransitionColumnGroup; -/***/ }, -/* 64 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -5189,28 +7502,47 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(27); + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var React = __webpack_require__(34); + + var TransitionColumn = (function (_React$Component) { + _inherits(TransitionColumn, _React$Component); - var TransitionColumn = React.createClass({ - displayName: 'TransitionColumn', + function TransitionColumn() { + _classCallCheck(this, TransitionColumn); - statics: { - __TableColumn__: true - }, + _get(Object.getPrototypeOf(TransitionColumn.prototype), 'constructor', this).apply(this, arguments); + } - render: function render() { - if (true) { - throw new Error('Component should never render'); + _createClass(TransitionColumn, [{ + key: 'render', + value: function render() { + if (false) { + throw new Error('Component should never render'); + } + return null; } - return null; - } - }); + }], [{ + key: '__TableColumn__', + value: true, + enumerable: true + }]); + + return TransitionColumn; + })(React.Component); module.exports = TransitionColumn; -/***/ }, -/* 65 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -5228,22 +7560,23 @@ return /******/ (function(modules) { // webpackBootstrap function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - var FixedDataTableCellDefault = __webpack_require__(66); - var FixedDataTableHelper = __webpack_require__(61); - var React = __webpack_require__(27); - var cx = __webpack_require__(48); - var joinClasses = __webpack_require__(67); + var FixedDataTableCellDefault = __webpack_require__(78); + var FixedDataTableHelper = __webpack_require__(73); + var PropTypes = __webpack_require__(27); + var React = __webpack_require__(34); + var createReactClass = __webpack_require__(37); + var cx = __webpack_require__(60); + var joinClasses = __webpack_require__(79); var DIR_SIGN = FixedDataTableHelper.DIR_SIGN; - var PropTypes = React.PropTypes; - var DEFAULT_PROPS = { align: 'left', - highlighted: false }; + highlighted: false + }; - var FixedDataTableCell = React.createClass({ - displayName: 'FixedDataTableCell', + var FixedDataTableCell = createReactClass({ + displayName: "FixedDataTableCell", /** * PropTypes are disabled in this component, because having them on slows @@ -5286,7 +7619,8 @@ return /******/ (function(modules) { // webpackBootstrap /** * The left offset in pixels of the cell. */ - left: PropTypes.number }, + left: PropTypes.number + }, shouldComponentUpdate: function shouldComponentUpdate(nextProps) { return !nextProps.isScrolling || this.props.rowIndex !== nextProps.rowIndex; @@ -5306,7 +7640,8 @@ return /******/ (function(modules) { // webpackBootstrap var style = { height: height, - width: width }; + width: width + }; if (DIR_SIGN === 1) { style.left = props.left; @@ -5321,19 +7656,28 @@ return /******/ (function(modules) { // webpackBootstrap 'fixedDataTableCellLayout/alignCenter': props.align === 'center', 'public/fixedDataTableCell/alignRight': props.align === 'right', 'public/fixedDataTableCell/highlighted': props.highlighted, - 'public/fixedDataTableCell/main': true }), props.className); + 'public/fixedDataTableCell/main': true + }), props.className); var columnResizerComponent; if (props.onColumnResize) { var columnResizerStyle = { - height: height + height: height, + opacity: props.isHoveringResizerKnob ? 1 : 0 }; + columnResizerComponent = React.createElement( 'div', { className: cx('fixedDataTableCellLayout/columnResizerContainer'), style: columnResizerStyle, - onMouseDown: this._onColumnResizerMouseDown }, + onMouseDown: this._onColumnResizerMouseDown, + onMouseEnter: function () { + return props.setHoverState(true); + }, + onMouseLeave: function () { + return props.setHoverState(false); + } }, React.createElement('div', { className: joinClasses(cx('fixedDataTableCellLayout/columnResizerKnob'), cx('public/fixedDataTableCell/columnResizerKnob')), style: columnResizerStyle @@ -5353,6 +7697,10 @@ return /******/ (function(modules) { // webpackBootstrap var content; if (React.isValidElement(props.cell)) { + if (props.cell.type === 'div') { + delete cellProps.columnKey; + } + content = React.cloneElement(props.cell, cellProps); } else if (typeof props.cell === 'function') { content = props.cell(cellProps); @@ -5374,14 +7722,30 @@ return /******/ (function(modules) { // webpackBootstrap _onColumnResizerMouseDown: function _onColumnResizerMouseDown( /*object*/event) { this.props.onColumnResize(this.props.left, this.props.width, this.props.minWidth, this.props.maxWidth, this.props.columnKey, event); - } }); + } + }); module.exports = FixedDataTableCell; -/***/ }, -/* 66 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 78 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; + + function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PropTypes = __webpack_require__(27); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -5394,18 +7758,10 @@ return /******/ (function(modules) { // webpackBootstrap * @typechecks */ - 'use strict'; - - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - - function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - - var React = __webpack_require__(27); - - var cx = __webpack_require__(48); - var joinClasses = __webpack_require__(67); + var React = __webpack_require__(34); - var PropTypes = React.PropTypes; + var cx = __webpack_require__(60); + var joinClasses = __webpack_require__(79); /** * Component that handles default cell layout and styling. @@ -5430,69 +7786,86 @@ return /******/ (function(modules) { // webpackBootstrap * ); * ``` */ - var FixedDataTableCellDefault = React.createClass({ - displayName: 'FixedDataTableCellDefault', - propTypes: { - - /** - * Outer height of the cell. - */ - height: PropTypes.number, + var FixedDataTableCellDefault = (function (_React$Component) { + _inherits(FixedDataTableCellDefault, _React$Component); - /** - * Outer width of the cell. - */ - width: PropTypes.number, + function FixedDataTableCellDefault() { + _classCallCheck(this, FixedDataTableCellDefault); - /** - * Optional prop that if specified on the `Column` will be passed to the - * cell. It can be used to uniquely identify which column is the cell is in. - */ - columnKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) }, + _get(Object.getPrototypeOf(FixedDataTableCellDefault.prototype), 'constructor', this).apply(this, arguments); + } - render: function render() { - var _props = this.props; - var height = _props.height; - var width = _props.width; - var style = _props.style; - var className = _props.className; - var children = _props.children; + _createClass(FixedDataTableCellDefault, [{ + key: 'render', + value: function render() { + var _props = this.props; + var height = _props.height; + var width = _props.width; + var style = _props.style; + var className = _props.className; + var children = _props.children; - var props = _objectWithoutProperties(_props, ['height', 'width', 'style', 'className', 'children']); + var props = _objectWithoutProperties(_props, ['height', 'width', 'style', 'className', 'children']); - var innerStyle = _extends({ - height: height, - width: width }, style); + var innerStyle = _extends({ + height: height, + width: width + }, style); - return React.createElement( - 'div', - _extends({}, props, { - className: joinClasses(cx('fixedDataTableCellLayout/wrap1'), cx('public/fixedDataTableCell/wrap1'), className), - style: innerStyle }), - React.createElement( + return React.createElement( 'div', - { - className: joinClasses(cx('fixedDataTableCellLayout/wrap2'), cx('public/fixedDataTableCell/wrap2')) }, + _extends({}, props, { + className: joinClasses(cx('fixedDataTableCellLayout/wrap1'), cx('public/fixedDataTableCell/wrap1'), className), + style: innerStyle }), React.createElement( 'div', { - className: joinClasses(cx('fixedDataTableCellLayout/wrap3'), cx('public/fixedDataTableCell/wrap3')) }, + className: joinClasses(cx('fixedDataTableCellLayout/wrap2'), cx('public/fixedDataTableCell/wrap2')) }, React.createElement( 'div', - { className: cx('public/fixedDataTableCell/cellContent') }, - children + { + className: joinClasses(cx('fixedDataTableCellLayout/wrap3'), cx('public/fixedDataTableCell/wrap3')) }, + React.createElement( + 'div', + { className: cx('public/fixedDataTableCell/cellContent') }, + children + ) ) ) - ) - ); - } }); + ); + } + }], [{ + key: 'propTypes', + value: { + + /** + * Outer height of the cell. + */ + height: PropTypes.number, + + /** + * Outer width of the cell. + */ + width: PropTypes.number, + + /** + * Optional prop that if specified on the `Column` will be passed to the + * cell. It can be used to uniquely identify which column is the cell is in. + */ + columnKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) + }, + enumerable: true + }]); + + return FixedDataTableCellDefault; + })(React.Component); module.exports = FixedDataTableCellDefault; -/***/ }, -/* 67 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 79 */ +/***/ (function(module, exports) { /** * Copyright 2013-2015, Facebook, Inc. @@ -5534,9 +7907,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = joinClasses; -/***/ }, -/* 68 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -5556,19 +7929,18 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var DOMMouseMoveTracker = __webpack_require__(41); - var Locale = __webpack_require__(62); - var React = __webpack_require__(27); - var ReactComponentWithPureRenderMixin = __webpack_require__(31); + var DOMMouseMoveTracker = __webpack_require__(53); + var Locale = __webpack_require__(74); + var PropTypes = __webpack_require__(27); + var React = __webpack_require__(34); + var createReactClass = __webpack_require__(37); + var ReactComponentWithPureRenderMixin = __webpack_require__(43); - var clamp = __webpack_require__(58); - var cx = __webpack_require__(48); - - var PropTypes = React.PropTypes; - - var FixedDataTableColumnResizeHandle = React.createClass({ - displayName: 'FixedDataTableColumnResizeHandle', + var clamp = __webpack_require__(70); + var cx = __webpack_require__(60); + var FixedDataTableColumnResizeHandle = createReactClass({ + displayName: "FixedDataTableColumnResizeHandle", mixins: [ReactComponentWithPureRenderMixin], propTypes: { @@ -5621,7 +7993,8 @@ return /******/ (function(modules) { // webpackBootstrap /** * Column key for the column being resized. */ - columnKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) }, + columnKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]) + }, getInitialState: function getInitialState() /*object*/{ return { @@ -5652,7 +8025,8 @@ return /******/ (function(modules) { // webpackBootstrap render: function render() /*object*/{ var style = { width: this.state.width, - height: this.props.height }; + height: this.props.height + }; if (Locale.isRTL()) { style.right = this.props.leftOffset; } else { @@ -5664,7 +8038,8 @@ return /******/ (function(modules) { // webpackBootstrap className: cx({ 'fixedDataTableColumnResizerLineLayout/main': true, 'fixedDataTableColumnResizerLineLayout/hiddenElem': !this.props.visible, - 'public/fixedDataTableColumnResizerLine/main': true }), + 'public/fixedDataTableColumnResizerLine/main': true + }), style: style }, React.createElement('div', { className: cx('fixedDataTableColumnResizerLineLayout/mouseArea'), @@ -5691,13 +8066,14 @@ return /******/ (function(modules) { // webpackBootstrap _onColumnResizeEnd: function _onColumnResizeEnd() { this._mouseMoveTracker.releaseMouseMoves(); this.props.onColumnResizeEnd(this.state.width, this.props.columnKey); - } }); + } + }); module.exports = FixedDataTableColumnResizeHandle; -/***/ }, -/* 69 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2015, Facebook, Inc. @@ -5717,15 +8093,16 @@ return /******/ (function(modules) { // webpackBootstrap function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var PrefixIntervalTree = __webpack_require__(70); - var clamp = __webpack_require__(58); + var PrefixIntervalTree = __webpack_require__(82); + var clamp = __webpack_require__(70); var BUFFER_ROWS = 5; var NO_ROWS_SCROLL_RESULT = { index: 0, offset: 0, position: 0, - contentHeight: 0 }; + contentHeight: 0 + }; var FixedDataTableScrollHelper = (function () { function FixedDataTableScrollHelper( @@ -5890,7 +8267,8 @@ return /******/ (function(modules) { // webpackBootstrap index: firstRowIndex, offset: firstRowOffset, position: this._position, - contentHeight: this._contentHeight }; + contentHeight: this._contentHeight + }; } }, { key: '_getRowAtEndPosition', @@ -5930,7 +8308,8 @@ return /******/ (function(modules) { // webpackBootstrap index: 0, offset: 0, position: this._position, - contentHeight: this._contentHeight }; + contentHeight: this._contentHeight + }; } else if (position >= this._contentHeight - this._viewportHeight) { // If position is equal to or greater than max scroll value, we need // to make sure to have bottom border of last row visible. @@ -5951,23 +8330,22 @@ return /******/ (function(modules) { // webpackBootstrap index: firstRowIndex, offset: firstRowOffset, position: this._position, - contentHeight: this._contentHeight }; + contentHeight: this._contentHeight + }; } - }, { - key: 'scrollToRow', /** * Allows to scroll to selected row with specified offset. It always * brings that row to top of viewport with that offset */ + }, { + key: 'scrollToRow', value: function scrollToRow( /*number*/rowIndex, /*number*/offset) /*object*/{ rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0)); offset = clamp(offset, -this._storedHeights[rowIndex], 0); var firstRow = this._rowOffsets.sumUntil(rowIndex); return this.scrollTo(firstRow - offset); } - }, { - key: 'scrollRowIntoView', /** * Allows to scroll to selected row by bringing it to viewport with minimal @@ -5977,6 +8355,8 @@ return /******/ (function(modules) { // webpackBootstrap * below end of viewport, it will be scrolled up to be fully visible on the * bottom of viewport. */ + }, { + key: 'scrollRowIntoView', value: function scrollRowIntoView( /*number*/rowIndex) /*object*/{ rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0)); var rowBegin = this._rowOffsets.sumUntil(rowIndex); @@ -5996,9 +8376,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = FixedDataTableScrollHelper; -/***/ }, -/* 70 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2015, Facebook, Inc. @@ -6009,7 +8389,7 @@ return /******/ (function(modules) { // webpackBootstrap * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule PrefixIntervalTree - * @flow + * * @typechecks */ @@ -6019,7 +8399,7 @@ return /******/ (function(modules) { // webpackBootstrap function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var invariant = __webpack_require__(53); + var invariant = __webpack_require__(65); var parent = function parent(node) { return Math.floor(node / 2); @@ -6103,12 +8483,12 @@ return /******/ (function(modules) { // webpackBootstrap value: function getSize() { return this._size; } - }, { - key: 'sumUntil', /** * Returns the sum get(0) + get(1) + ... + get(end - 1). */ + }, { + key: 'sumUntil', value: function sumUntil(end) { invariant(0 <= end && end < this._size + 1, 'Index out of range %s', end); @@ -6126,33 +8506,33 @@ return /******/ (function(modules) { // webpackBootstrap return sum; } - }, { - key: 'sumTo', /** * Returns the sum get(0) + get(1) + ... + get(inclusiveEnd). */ + }, { + key: 'sumTo', value: function sumTo(inclusiveEnd) { invariant(0 <= inclusiveEnd && inclusiveEnd < this._size, 'Index out of range %s', inclusiveEnd); return this.sumUntil(inclusiveEnd + 1); } - }, { - key: 'sum', /** * Returns the sum get(begin) + get(begin + 1) + ... + get(end - 1). */ + }, { + key: 'sum', value: function sum(begin, end) { invariant(begin <= end, 'Begin must precede end'); return this.sumUntil(end) - this.sumUntil(begin); } - }, { - key: 'greatestLowerBound', /** * Returns the smallest i such that 0 <= i <= size and sumUntil(i) <= t, or * -1 if no such i exists. */ + }, { + key: 'greatestLowerBound', value: function greatestLowerBound(t) { if (t < 0) { return -1; @@ -6173,96 +8553,234 @@ return /******/ (function(modules) { // webpackBootstrap } } - return node - this._half; - } - }, { - key: 'greatestStrictLowerBound', + return node - this._half; + } + + /** + * Returns the smallest i such that 0 <= i <= size and sumUntil(i) < t, or + * -1 if no such i exists. + */ + }, { + key: 'greatestStrictLowerBound', + value: function greatestStrictLowerBound(t) { + if (t <= 0) { + return -1; + } + + var node = 1; + if (this._heap[node] < t) { + return this._size; + } + + while (node < this._half) { + var leftSum = this._heap[2 * node]; + if (t <= leftSum) { + node = 2 * node; + } else { + node = 2 * node + 1; + t -= leftSum; + } + } + + return node - this._half; + } + + /** + * Returns the smallest i such that 0 <= i <= size and t <= sumUntil(i), or + * size + 1 if no such i exists. + */ + }, { + key: 'leastUpperBound', + value: function leastUpperBound(t) { + return this.greatestStrictLowerBound(t) + 1; + } + + /** + * Returns the smallest i such that 0 <= i <= size and t < sumUntil(i), or + * size + 1 if no such i exists. + */ + }, { + key: 'leastStrictUpperBound', + value: function leastStrictUpperBound(t) { + return this.greatestLowerBound(t) + 1; + } + }], [{ + key: 'uniform', + value: function uniform(size, initialValue) { + var xs = []; + for (var i = size - 1; i >= 0; --i) { + xs[i] = initialValue; + } + + return new PrefixIntervalTree(xs); + } + }, { + key: 'empty', + value: function empty(size) { + return PrefixIntervalTree.uniform(size, 0); + } + }]); + + return PrefixIntervalTree; + })(); + + module.exports = PrefixIntervalTree; + + /** + * Number of elements in the array + */ + + /** + * Half the size of the heap. It is also the number of non-leaf nodes, and the + * index of the first element in the heap. Always a power of 2. + */ + + /** + * Binary heap + */ + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule FixedDataTableWidthHelper + * @typechecks + */ + + 'use strict'; + + var React = __webpack_require__(34); + + function getTotalWidth( /*array*/columns) /*number*/{ + var totalWidth = 0; + for (var i = 0; i < columns.length; ++i) { + totalWidth += columns[i].props.width; + } + return totalWidth; + } + + function getTotalFlexGrow( /*array*/columns) /*number*/{ + var totalFlexGrow = 0; + for (var i = 0; i < columns.length; ++i) { + totalFlexGrow += columns[i].props.flexGrow || 0; + } + return totalFlexGrow; + } + + function distributeFlexWidth( + /*array*/columns, + /*number*/flexWidth) /*object*/{ + if (flexWidth <= 0) { + return { + columns: columns, + width: getTotalWidth(columns) + }; + } + var remainingFlexGrow = getTotalFlexGrow(columns); + var remainingFlexWidth = flexWidth; + var newColumns = []; + var totalWidth = 0; + for (var i = 0; i < columns.length; ++i) { + var column = columns[i]; + if (!column.props.flexGrow) { + totalWidth += column.props.width; + newColumns.push(column); + continue; + } + var columnFlexWidth = Math.floor(column.props.flexGrow / remainingFlexGrow * remainingFlexWidth); + var newColumnWidth = Math.floor(column.props.width + columnFlexWidth); + totalWidth += newColumnWidth; + + remainingFlexGrow -= column.props.flexGrow; + remainingFlexWidth -= columnFlexWidth; + + newColumns.push(React.cloneElement(column, { width: newColumnWidth })); + } + + return { + columns: newColumns, + width: totalWidth + }; + } + + function adjustColumnGroupWidths( + /*array*/columnGroups, + /*number*/expectedWidth) /*object*/{ + var allColumns = []; + var i; + for (i = 0; i < columnGroups.length; ++i) { + React.Children.forEach(columnGroups[i].props.children, function (column) { + allColumns.push(column); + }); + } + var columnsWidth = getTotalWidth(allColumns); + var remainingFlexGrow = getTotalFlexGrow(allColumns); + var remainingFlexWidth = Math.max(expectedWidth - columnsWidth, 0); - /** - * Returns the smallest i such that 0 <= i <= size and sumUntil(i) < t, or - * -1 if no such i exists. - */ - value: function greatestStrictLowerBound(t) { - if (t <= 0) { - return -1; - } + var newAllColumns = []; + var newColumnGroups = []; - var node = 1; - if (this._heap[node] < t) { - return this._size; - } + for (i = 0; i < columnGroups.length; ++i) { + var columnGroup = columnGroups[i]; + var currentColumns = []; - while (node < this._half) { - var leftSum = this._heap[2 * node]; - if (t <= leftSum) { - node = 2 * node; - } else { - node = 2 * node + 1; - t -= leftSum; - } - } + React.Children.forEach(columnGroup.props.children, function (column) { + currentColumns.push(column); + }); - return node - this._half; - } - }, { - key: 'leastUpperBound', + var columnGroupFlexGrow = getTotalFlexGrow(currentColumns); + var columnGroupFlexWidth = Math.floor(columnGroupFlexGrow / remainingFlexGrow * remainingFlexWidth); - /** - * Returns the smallest i such that 0 <= i <= size and t <= sumUntil(i), or - * size + 1 if no such i exists. - */ - value: function leastUpperBound(t) { - return this.greatestStrictLowerBound(t) + 1; - } - }, { - key: 'leastStrictUpperBound', + var newColumnSettings = distributeFlexWidth(currentColumns, columnGroupFlexWidth); - /** - * Returns the smallest i such that 0 <= i <= size and t < sumUntil(i), or - * size + 1 if no such i exists. - */ - value: function leastStrictUpperBound(t) { - return this.greatestLowerBound(t) + 1; - } - }], [{ - key: 'uniform', - value: function uniform(size, initialValue) { - var xs = []; - for (var i = size - 1; i >= 0; --i) { - xs[i] = initialValue; - } + remainingFlexGrow -= columnGroupFlexGrow; + remainingFlexWidth -= columnGroupFlexWidth; - return new PrefixIntervalTree(xs); - } - }, { - key: 'empty', - value: function empty(size) { - return PrefixIntervalTree.uniform(size, 0); + for (var j = 0; j < newColumnSettings.columns.length; ++j) { + newAllColumns.push(newColumnSettings.columns[j]); } - }]); - return PrefixIntervalTree; - })(); + newColumnGroups.push(React.cloneElement(columnGroup, { width: newColumnSettings.width })); + } - module.exports = PrefixIntervalTree; + return { + columns: newAllColumns, + columnGroups: newColumnGroups + }; + } - /** - * Number of elements in the array - */ + function adjustColumnWidths( + /*array*/columns, + /*number*/expectedWidth) /*array*/{ + var columnsWidth = getTotalWidth(columns); + if (columnsWidth < expectedWidth) { + return distributeFlexWidth(columns, expectedWidth - columnsWidth).columns; + } + return columns; + } - /** - * Half the size of the heap. It is also the number of non-leaf nodes, and the - * index of the first element in the heap. Always a power of 2. - */ + var FixedDataTableWidthHelper = { + getTotalWidth: getTotalWidth, + getTotalFlexGrow: getTotalFlexGrow, + distributeFlexWidth: distributeFlexWidth, + adjustColumnWidths: adjustColumnWidths, + adjustColumnGroupWidths: adjustColumnGroupWidths + }; - /** - * Binary heap - */ - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + module.exports = FixedDataTableWidthHelper; -/***/ }, -/* 71 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 84 */ +/***/ (function(module, exports) { /** * Copyright (c) 2015, Facebook, Inc. @@ -6330,67 +8848,524 @@ return /******/ (function(modules) { // webpackBootstrap return debouncer; } - module.exports = debounce; - -/***/ }, -/* 72 */ -/***/ function(module, exports, __webpack_require__) { - + module.exports = debounce; + +/***/ }), +/* 85 */ +/***/ (function(module, exports) { + + /** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule shallowEqual + * @typechecks + * + */ + + 'use strict'; + + var hasOwnProperty = Object.prototype.hasOwnProperty; + + /** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ + function shallowEqual(objA, objB) { + if (objA === objB) { + return true; + } + + if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + + if (keysA.length !== keysB.length) { + return false; + } + + // Test for A's keys different from B. + var bHasOwnProperty = hasOwnProperty.bind(objB); + for (var i = 0; i < keysA.length; i++) { + if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { + return false; + } + } + + return true; + } + + module.exports = shallowEqual; + +/***/ }), +/* 86 */ +/***/ (function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + + /** Used as the `TypeError` message for "Functions" methods. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** Used as references for various `Number` constants. */ + var NAN = 0 / 0; + + /** `Object#toString` result references. */ + var symbolTag = '[object Symbol]'; + + /** Used to match leading and trailing whitespace. */ + var reTrim = /^\s+|\s+$/g; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Built-in method references without a dependency on `root`. */ + var freeParseInt = parseInt; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var objectToString = objectProto.toString; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max, + nativeMin = Math.min; + + /** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ + var now = function() { + return root.Date.now(); + }; + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ + function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + result = wait - timeSinceLastCall; + + return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + + /** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed `func` invocations and a `flush` method to + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` + * timeout. The `func` is invoked with the last arguments provided to the + * throttled function. Subsequent calls to the throttled function return the + * result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // Avoid excessively updating the position while scrolling. + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. + * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); + * jQuery(element).on('click', throttled); + * + * // Cancel the trailing throttled invocation. + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); + } + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + /** - * Copyright (c) 2015, Facebook, Inc. - * All rights reserved. + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example * - * @providesModule shallowEqual - * @typechecks - * @flow + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } - 'use strict'; - - var hasOwnProperty = Object.prototype.hasOwnProperty; + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); + } /** - * Performs equality by iterating through keys on an object and returning false - * when any key has values which are not strictly equal between the arguments. - * Returns true when the values of all keys are strictly equal. + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 */ - function shallowEqual(objA, objB) { - if (objA === objB) { - return true; + function toNumber(value) { + if (typeof value == 'number') { + return value; } - - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false; + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); + module.exports = throttle; - if (keysA.length !== keysB.length) { - return false; - } + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - // Test for A's keys different from B. - var bHasOwnProperty = hasOwnProperty.bind(objB); - for (var i = 0; i < keysA.length; i++) { - if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { - return false; - } - } +/***/ }), +/* 87 */ +/***/ (function(module, exports, __webpack_require__) { - return true; - } + 'use strict'; - module.exports = shallowEqual; + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -/***/ }, -/* 73 */ -/***/ function(module, exports, __webpack_require__) { + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PropTypes = __webpack_require__(27); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -6403,175 +9378,199 @@ return /******/ (function(modules) { // webpackBootstrap * @typechecks */ - 'use strict'; - - var React = __webpack_require__(27); - - var PropTypes = React.PropTypes; + var React = __webpack_require__(34); /** * Component that defines the attributes of table column. */ - var FixedDataTableColumn = React.createClass({ - displayName: 'FixedDataTableColumn', - - statics: { - __TableColumn__: true - }, - - propTypes: { - /** - * The horizontal alignment of the table cell content. - */ - align: PropTypes.oneOf(['left', 'center', 'right']), - - /** - * Controls if the column is fixed when scrolling in the X axis. - */ - fixed: PropTypes.bool, - - /** - * The header cell for this column. - * This can either be a string a React element, or a function that generates - * a React Element. Passing in a string will render a default header cell - * with that string. By default, the React element passed in can expect to - * receive the following props: - * - * ``` - * props: { - * columnKey: string // (of the column, if given) - * height: number // (supplied from the Table or rowHeightGetter) - * width: number // (supplied from the Column) - * } - * ``` - * - * Because you are passing in your own React element, you can feel free to - * pass in whatever props you may want or need. - * - * If you pass in a function, you will receive the same props object as the - * first argument. - */ - header: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), - - /** - * This is the body cell that will be cloned for this column. - * This can either be a string a React element, or a function that generates - * a React Element. Passing in a string will render a default header cell - * with that string. By default, the React element passed in can expect to - * receive the following props: - * - * ``` - * props: { - * rowIndex; number // (the row index of the cell) - * columnKey: string // (of the column, if given) - * height: number // (supplied from the Table or rowHeightGetter) - * width: number // (supplied from the Column) - * } - * ``` - * - * Because you are passing in your own React element, you can feel free to - * pass in whatever props you may want or need. - * - * If you pass in a function, you will receive the same props object as the - * first argument. - */ - cell: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), - - /** - * This is the footer cell for this column. - * This can either be a string a React element, or a function that generates - * a React Element. Passing in a string will render a default header cell - * with that string. By default, the React element passed in can expect to - * receive the following props: - * - * ``` - * props: { - * columnKey: string // (of the column, if given) - * height: number // (supplied from the Table or rowHeightGetter) - * width: number // (supplied from the Column) - * } - * ``` - * - * Because you are passing in your own React element, you can feel free to - * pass in whatever props you may want or need. - * - * If you pass in a function, you will receive the same props object as the - * first argument. - */ - footer: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), - - /** - * This is used to uniquely identify the column, and is not required unless - * you a resizing columns. This will be the key given in the - * `onColumnResizeEndCallback` on the Table. - */ - columnKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - - /** - * The pixel width of the column. - */ - width: PropTypes.number.isRequired, - - /** - * If this is a resizable column this is its minimum pixel width. - */ - minWidth: PropTypes.number, - /** - * If this is a resizable column this is its maximum pixel width. - */ - maxWidth: PropTypes.number, + var FixedDataTableColumn = (function (_React$Component) { + _inherits(FixedDataTableColumn, _React$Component); + + function FixedDataTableColumn() { + _classCallCheck(this, FixedDataTableColumn); + + _get(Object.getPrototypeOf(FixedDataTableColumn.prototype), 'constructor', this).apply(this, arguments); + } + + _createClass(FixedDataTableColumn, [{ + key: 'render', + value: function render() { + if (false) { + throw new Error('Component should never render'); + } + return null; + } + }], [{ + key: '__TableColumn__', + value: true, + enumerable: true + }, { + key: 'propTypes', + value: { + /** + * The horizontal alignment of the table cell content. + */ + align: PropTypes.oneOf(['left', 'center', 'right']), + + /** + * Controls if the column is fixed when scrolling in the X axis. + */ + fixed: PropTypes.bool, + + /** + * The header cell for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + header: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), + + /** + * This is the body cell that will be cloned for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * rowIndex; number // (the row index of the cell) + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + cell: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), + + /** + * This is the footer cell for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + footer: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), + + /** + * This is used to uniquely identify the column, and is not required unless + * you a resizing columns. This will be the key given in the + * `onColumnResizeEndCallback` on the Table. + */ + columnKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + + /** + * The pixel width of the column. + */ + width: PropTypes.number.isRequired, + + /** + * If this is a resizable column this is its minimum pixel width. + */ + minWidth: PropTypes.number, + + /** + * If this is a resizable column this is its maximum pixel width. + */ + maxWidth: PropTypes.number, + + /** + * The grow factor relative to other columns. Same as the flex-grow API + * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available + * extra width and distribute it proportionally according to all columns' + * flexGrow values. Defaults to zero (no-flexing). + */ + flexGrow: PropTypes.number, + + /** + * Whether the column can be resized with the + * FixedDataTableColumnResizeHandle. Please note that if a column + * has a flex grow, once you resize the column this will be set to 0. + * + * This property only provides the UI for the column resizing. If this + * is set to true, you will need to set the onColumnResizeEndCallback table + * property and render your columns appropriately. + */ + isResizable: PropTypes.bool, + + /** + * Whether cells in this column can be removed from document when outside + * of viewport as a result of horizontal scrolling. + * Setting this property to true allows the table to not render cells in + * particular column that are outside of viewport for visible rows. This + * allows to create table with many columns and not have vertical scrolling + * performance drop. + * Setting the property to false will keep previous behaviour and keep + * cell rendered if the row it belongs to is visible. + */ + allowCellsRecycling: PropTypes.bool + }, + enumerable: true + }, { + key: 'defaultProps', + value: { + allowCellsRecycling: false, + fixed: false + }, + enumerable: true + }]); + + return FixedDataTableColumn; + })(React.Component); - /** - * The grow factor relative to other columns. Same as the flex-grow API - * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available - * extra width and distribute it proportionally according to all columns' - * flexGrow values. Defaults to zero (no-flexing). - */ - flexGrow: PropTypes.number, + module.exports = FixedDataTableColumn; - /** - * Whether the column can be resized with the - * FixedDataTableColumnResizeHandle. Please note that if a column - * has a flex grow, once you resize the column this will be set to 0. - * - * This property only provides the UI for the column resizing. If this - * is set to true, you will need to set the onColumnResizeEndCallback table - * property and render your columns appropriately. - */ - isResizable: PropTypes.bool, +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Whether cells in this column can be removed from document when outside - * of viewport as a result of horizontal scrolling. - * Setting this property to true allows the table to not render cells in - * particular column that are outside of viewport for visible rows. This - * allows to create table with many columns and not have vertical scrolling - * performance drop. - * Setting the property to false will keep previous behaviour and keep - * cell rendered if the row it belongs to is visible. - */ - allowCellsRecycling: PropTypes.bool }, + 'use strict'; - getDefaultProps: function getDefaultProps() /*object*/{ - return { - allowCellsRecycling: false, - fixed: false }; - }, + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - render: function render() { - if (true) { - throw new Error('Component should never render'); - } - return null; - } }); + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - module.exports = FixedDataTableColumn; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } -/***/ }, -/* 74 */ -/***/ function(module, exports, __webpack_require__) { + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + var PropTypes = __webpack_require__(27); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -6584,71 +9583,99 @@ return /******/ (function(modules) { // webpackBootstrap * @typechecks */ - 'use strict'; - - var React = __webpack_require__(27); - - var PropTypes = React.PropTypes; + var React = __webpack_require__(34); /** * Component that defines the attributes of a table column group. */ - var FixedDataTableColumnGroup = React.createClass({ - displayName: 'FixedDataTableColumnGroup', - - statics: { - __TableColumnGroup__: true }, - propTypes: { - /** - * The horizontal alignment of the table cell content. - */ - align: PropTypes.oneOf(['left', 'center', 'right']), + var FixedDataTableColumnGroup = (function (_React$Component) { + _inherits(FixedDataTableColumnGroup, _React$Component); - /** - * Controls if the column group is fixed when scrolling in the X axis. - */ - fixed: PropTypes.bool, - - /** - * This is the header cell for this column group. - * This can either be a string or a React element. Passing in a string - * will render a default footer cell with that string. By default, the React - * element passed in can expect to receive the following props: - * - * ``` - * props: { - * height: number // (supplied from the groupHeaderHeight) - * width: number // (supplied from the Column) - * } - * ``` - * - * Because you are passing in your own React element, you can feel free to - * pass in whatever props you may want or need. - * - * You can also pass in a function that returns a react elemnt, with the - * props object above passed in as the first parameter. - */ - header: PropTypes.oneOfType([PropTypes.node, PropTypes.func]) }, + function FixedDataTableColumnGroup() { + _classCallCheck(this, FixedDataTableColumnGroup); - getDefaultProps: function getDefaultProps() /*object*/{ - return { - fixed: false }; - }, + _get(Object.getPrototypeOf(FixedDataTableColumnGroup.prototype), 'constructor', this).apply(this, arguments); + } - render: function render() { - if (true) { - throw new Error('Component should never render'); + _createClass(FixedDataTableColumnGroup, [{ + key: 'render', + value: function render() { + if (false) { + throw new Error('Component should never render'); + } + return null; } - return null; - } }); + }], [{ + key: '__TableColumnGroup__', + value: true, + enumerable: true + }, { + key: 'propTypes', + value: { + /** + * The horizontal alignment of the table cell content. + */ + align: PropTypes.oneOf(['left', 'center', 'right']), + + /** + * Controls if the column group is fixed when scrolling in the X axis. + */ + fixed: PropTypes.bool, + + /** + * This is the header cell for this column group. + * This can either be a string or a React element. Passing in a string + * will render a default footer cell with that string. By default, the React + * element passed in can expect to receive the following props: + * + * ``` + * props: { + * height: number // (supplied from the groupHeaderHeight) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * You can also pass in a function that returns a react elemnt, with the + * props object above passed in as the first parameter. + */ + header: PropTypes.oneOfType([PropTypes.node, PropTypes.func]) + + }, + enumerable: true + }, { + key: 'defaultProps', + value: { + fixed: false + }, + enumerable: true + }]); + + return FixedDataTableColumnGroup; + })(React.Component); module.exports = FixedDataTableColumnGroup; -/***/ }, -/* 75 */ -/***/ function(module, exports, __webpack_require__) { +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PropTypes = __webpack_require__(27); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -6668,182 +9695,192 @@ return /******/ (function(modules) { // webpackBootstrap * FixedDataTableCellNew.react and dependency in FixedDataTableCellGroup.react */ - 'use strict'; + var React = __webpack_require__(34); - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + var cx = __webpack_require__(60); + var joinClasses = __webpack_require__(79); + var shallowEqual = __webpack_require__(85); - var React = __webpack_require__(27); - var PropTypes = React.PropTypes; + var CellDefault = __webpack_require__(78); - var cx = __webpack_require__(48); - var joinClasses = __webpack_require__(67); - var shallowEqual = __webpack_require__(72); + var TransitionCell = (function (_React$Component) { + _inherits(TransitionCell, _React$Component); - var CellDefault = __webpack_require__(66); + function TransitionCell() { + _classCallCheck(this, TransitionCell); - var TransitionCell = React.createClass({ - displayName: 'TransitionCell', + _get(Object.getPrototypeOf(TransitionCell.prototype), 'constructor', this).apply(this, arguments); - propTypes: { - label: PropTypes.string, // header, footer - className: PropTypes.string, - rowIndex: PropTypes.number, - rowGetter: PropTypes.func, // cell - dataKey: PropTypes.oneOfType([// cell, footer - PropTypes.string, PropTypes.number]), - cellRenderer: PropTypes.func, - cellDataGetter: PropTypes.func, - footerDataGetter: PropTypes.func, // footer - footerData: PropTypes.any, // footer - columnData: PropTypes.any, // cell, header - width: PropTypes.number, - height: PropTypes.number, - isHeaderCell: PropTypes.bool, // header - isFooterCell: PropTypes.bool }, - - shouldComponentUpdate: function shouldComponentUpdate( /*object*/nextProps) { - var update = false; - var rowData; - if (nextProps.rowGetter) { - rowData = nextProps.rowGetter(nextProps.rowIndex); - if (this._rowData !== rowData) { - update = true; + this._getCellData = function (props) { + var dataKey = props.dataKey; + if (dataKey == null) { + return null; } - } - var cellData; - if (nextProps.dataKey != null) { - if (nextProps.cellDataGetter) { - cellData = nextProps.cellDataGetter(nextProps.dataKey, rowData); + var rowData; + if (props.rowGetter) { + rowData = props.rowGetter(props.rowIndex); } - if (!cellData && rowData) { - cellData = rowData[nextProps.dataKey]; + + if (props.cellDataGetter) { + return props.cellDataGetter(dataKey, rowData); } - } - if (this._cellData !== cellData) { - update = true; - } - this._rowData = rowData; - this._cellData = cellData; - return update || !shallowEqual(nextProps, this.props); - }, + if (rowData) { + return rowData[dataKey]; + } - _getCellData: function _getCellData(props) { - var dataKey = props.dataKey; - if (dataKey == null) { - return null; - } + if (props.footerDataGetter) { + return props.footerDataGetter()[dataKey]; + } - var rowData; - if (props.rowGetter) { - rowData = props.rowGetter(props.rowIndex); - } + if (props.footerData) { + return props.footerData[dataKey]; + } - if (props.cellDataGetter) { - return props.cellDataGetter(dataKey, rowData); - } + if (props.headerDataGetter) { + return props.headerDataGetter[dataKey]; + } + }; - if (rowData) { - return rowData[dataKey]; - } + this._getRowData = function (props) { + if (props.rowGetter) { + return props.rowGetter(props.rowIndex) || {}; + } - if (props.footerDataGetter) { - return props.footerDataGetter()[dataKey]; - } + if (props.footerDataGetter) { + return props.footerDataGetter() || {}; + } - if (props.footerData) { - return props.footerData[dataKey]; - } + if (props.footerData) { + return props.footerData || {}; + } - if (props.headerDataGetter) { - return props.headerDataGetter[dataKey]; - } - }, + return {}; + }; + } - _getRowData: function _getRowData(props) { - if (props.rowGetter) { - return props.rowGetter(props.rowIndex) || {}; - } + _createClass(TransitionCell, [{ + key: 'shouldComponentUpdate', + // footer + value: function shouldComponentUpdate( /*object*/nextProps) { + var update = false; + var rowData; + if (nextProps.rowGetter) { + rowData = nextProps.rowGetter(nextProps.rowIndex); + if (this._rowData !== rowData) { + update = true; + } + } - if (props.footerDataGetter) { - return props.footerDataGetter() || {}; - } + var cellData; + if (nextProps.dataKey != null) { + if (nextProps.cellDataGetter) { + cellData = nextProps.cellDataGetter(nextProps.dataKey, rowData); + } + if (!cellData && rowData) { + cellData = rowData[nextProps.dataKey]; + } + } + if (this._cellData !== cellData) { + update = true; + } + this._rowData = rowData; + this._cellData = cellData; - if (props.footerData) { - return props.footerData || {}; + return update || !shallowEqual(nextProps, this.props); } + }, { + key: 'render', + value: function render() { + var props = this.props; - return {}; - }, + var cellData = this._getCellData(props); + var content = cellData; + var rowData = this._getRowData(props); + var usingRenderer = !!(props.cellRenderer || props.groupHeaderRenderer); - render: function render() { - var props = this.props; + if (props.isHeaderCell || props.isFooterCell) { + content = content || props.label; + } - var cellData = this._getCellData(props); - var content = cellData; - var rowData = this._getRowData(props); - var usingRenderer = !!(props.cellRenderer || props.groupHeaderRenderer); + if (props.cellRenderer) { + if (props.isHeaderCell || props.isFooterCell) { + content = props.cellRenderer(props.label, props.dataKey, props.columnData, rowData, props.width) || props.label; + } else { + content = props.cellRenderer(cellData, props.dataKey, rowData, props.rowIndex, props.columnData, props.width); + } + } - if (props.isHeaderCell || props.isFooterCell) { - content = content || props.label; - } + if (props.groupHeaderRenderer) { + content = props.groupHeaderRenderer(props.label, props.dataKey, // index in children + props.groupHeaderData, props.groupHeaderLabels, props.width) || content; + } - if (props.cellRenderer) { - if (props.isHeaderCell || props.isFooterCell) { - content = props.cellRenderer(props.label, props.dataKey, props.columnData, rowData, props.width) || props.label; + var contentClass = cx('public/fixedDataTableCell/cellContent'); + + if (React.isValidElement(content) && usingRenderer) { + content = React.cloneElement(content, { + className: joinClasses(content.props.className, contentClass) + }); } else { - content = props.cellRenderer(cellData, props.dataKey, rowData, props.rowIndex, props.columnData, props.width); + return React.createElement( + CellDefault, + props, + content + ); } - } - - if (props.groupHeaderRenderer) { - content = props.groupHeaderRenderer(props.label, props.dataKey, // index in children - props.groupHeaderData, props.groupHeaderLabels, props.width) || content; - } - var contentClass = cx('public/fixedDataTableCell/cellContent'); + var innerStyle = _extends({ + height: props.height, + width: props.width + }, props.style); - if (React.isValidElement(content) && usingRenderer) { - content = React.cloneElement(content, { - className: joinClasses(content.props.className, contentClass) - }); - } else { return React.createElement( - CellDefault, - props, - content - ); - } - - var innerStyle = _extends({ - height: props.height, - width: props.width }, props.style); - - return React.createElement( - 'div', - _extends({}, this.props, { - className: joinClasses(cx('fixedDataTableCellLayout/wrap1'), cx('public/fixedDataTableCell/wrap1'), this.props.className), - style: innerStyle }), - React.createElement( 'div', - { - className: joinClasses(cx('fixedDataTableCellLayout/wrap2'), cx('public/fixedDataTableCell/wrap2')) }, + _extends({}, this.props, { + className: joinClasses(cx('fixedDataTableCellLayout/wrap1'), cx('public/fixedDataTableCell/wrap1'), this.props.className), + style: innerStyle }), React.createElement( 'div', { - className: joinClasses(cx('fixedDataTableCellLayout/wrap3'), cx('public/fixedDataTableCell/wrap3')) }, - content + className: joinClasses(cx('fixedDataTableCellLayout/wrap2'), cx('public/fixedDataTableCell/wrap2')) }, + React.createElement( + 'div', + { + className: joinClasses(cx('fixedDataTableCellLayout/wrap3'), cx('public/fixedDataTableCell/wrap3')) }, + content + ) ) - ) - ); - } - }); + ); + } + }], [{ + key: 'propTypes', + value: { + label: PropTypes.string, // header, footer + className: PropTypes.string, + rowIndex: PropTypes.number, + rowGetter: PropTypes.func, // cell + dataKey: PropTypes.oneOfType([// cell, footer + PropTypes.string, PropTypes.number]), + cellRenderer: PropTypes.func, + cellDataGetter: PropTypes.func, + footerDataGetter: PropTypes.func, // footer + footerData: PropTypes.any, // footer + columnData: PropTypes.any, // cell, header + width: PropTypes.number, + height: PropTypes.number, + isHeaderCell: PropTypes.bool, // header + isFooterCell: PropTypes.bool }, + enumerable: true + }]); + + return TransitionCell; + })(React.Component); module.exports = TransitionCell; - // footer -/***/ } +/***/ }) /******/ ]) }); ; \ No newline at end of file diff --git a/dist/fixed-data-table.min.css b/dist/fixed-data-table.min.css index e2f1a7b9..ed65b4ea 100644 --- a/dist/fixed-data-table.min.css +++ b/dist/fixed-data-table.min.css @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -9,4 +9,4 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -.public_Scrollbar_main.public_Scrollbar_mainActive,.public_Scrollbar_main:hover{background-color:rgba(255,255,255,.8)}.public_Scrollbar_mainOpaque,.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive,.public_Scrollbar_mainOpaque:hover{background-color:#fff}.public_Scrollbar_face:after{background-color:#c2c2c2}.public_Scrollbar_main:hover .public_Scrollbar_face:after,.public_Scrollbar_mainActive .public_Scrollbar_face:after,.public_Scrollbar_faceActive:after{background-color:#7d7d7d}.public_fixedDataTable_main,.public_fixedDataTable_header,.public_fixedDataTable_hasBottomBorder{border-color:#d3d3d3}.public_fixedDataTable_header .public_fixedDataTableCell_main{font-weight:700}.public_fixedDataTable_header,.public_fixedDataTable_header .public_fixedDataTableCell_main{background-color:#f6f7f8;background-image:-webkit-linear-gradient(#fff,#efefef);background-image:linear-gradient(#fff,#efefef)}.public_fixedDataTable_footer .public_fixedDataTableCell_main{background-color:#f6f7f8;border-color:#d3d3d3}.public_fixedDataTable_topShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAF0lEQVR4AWPUkNeSBhHCjJoK2twgFisAFagCCp3pJlAAAAAASUVORK5CYII=) repeat-x}.public_fixedDataTable_bottomShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAHElEQVQI12MwNjZmZdAT1+Nm0JDWEGZQk1GTBgAWkwIeAEp52AAAAABJRU5ErkJggg==) repeat-x}.public_fixedDataTable_horizontalScrollbar .public_Scrollbar_mainHorizontal{background-color:#fff}.public_fixedDataTableCell_main{background-color:#fff;border-color:#d3d3d3}.public_fixedDataTableCell_highlighted{background-color:#f4f4f4}.public_fixedDataTableCell_cellContent{padding:8px}.public_fixedDataTableCell_columnResizerKnob{background-color:#0284ff}.public_fixedDataTableColumnResizerLine_main{border-color:#0284ff}.public_fixedDataTableRow_main{background-color:#fff}.public_fixedDataTableRow_highlighted,.public_fixedDataTableRow_highlighted .public_fixedDataTableCell_main{background-color:#f6f7f8}.public_fixedDataTableRow_fixedColumnsDivider{border-color:#d3d3d3}.public_fixedDataTableRow_columnsShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==) repeat-y}.ScrollbarLayout_main{box-sizing:border-box;outline:none;overflow:hidden;position:absolute;-webkit-transition-duration:250ms;transition-duration:250ms;-webkit-transition-timing-function:ease;transition-timing-function:ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ScrollbarLayout_mainVertical{bottom:0;right:0;top:0;-webkit-transition-property:background-color width;transition-property:background-color width;width:15px}.ScrollbarLayout_mainVertical.public_Scrollbar_mainActive,.ScrollbarLayout_mainVertical:hover{width:17px}.ScrollbarLayout_mainHorizontal{bottom:0;height:15px;left:0;-webkit-transition-property:background-color height;transition-property:background-color height}.ScrollbarLayout_mainHorizontal.public_Scrollbar_mainActive,.ScrollbarLayout_mainHorizontal:hover{height:17px}.ScrollbarLayout_face{left:0;overflow:hidden;position:absolute;z-index:1}.ScrollbarLayout_face:after{border-radius:6px;content:'';display:block;position:absolute;-webkit-transition:background-color 250ms ease;transition:background-color 250ms ease}.ScrollbarLayout_faceHorizontal{bottom:0;left:0;top:0}.ScrollbarLayout_faceHorizontal:after{bottom:4px;left:0;top:4px;width:100%}.ScrollbarLayout_faceVertical{left:0;right:0;top:0}.ScrollbarLayout_faceVertical:after{height:100%;left:4px;right:4px;top:0}.fixedDataTableCellGroupLayout_cellGroup{-webkit-backface-visibility:hidden;backface-visibility:hidden;left:0;overflow:hidden;position:absolute;top:0;white-space:nowrap}.fixedDataTableCellGroupLayout_cellGroup>.public_fixedDataTableCell_main{display:inline-block;vertical-align:top;white-space:normal}.fixedDataTableCellGroupLayout_cellGroupWrapper{position:absolute;top:0}.fixedDataTableCellLayout_main{border-right-style:solid;border-width:0 1px 0 0;box-sizing:border-box;display:block;overflow:hidden;position:absolute;white-space:normal}.fixedDataTableCellLayout_lastChild{border-width:0 1px 1px 0}.fixedDataTableCellLayout_alignRight{text-align:right}.fixedDataTableCellLayout_alignCenter{text-align:center}.fixedDataTableCellLayout_wrap1{display:table}.fixedDataTableCellLayout_wrap2{display:table-row}.fixedDataTableCellLayout_wrap3{display:table-cell;vertical-align:middle}.fixedDataTableCellLayout_columnResizerContainer{position:absolute;right:0;width:6px;z-index:1}.fixedDataTableCellLayout_columnResizerContainer:hover{cursor:ew-resize}.fixedDataTableCellLayout_columnResizerContainer:hover .fixedDataTableCellLayout_columnResizerKnob{visibility:visible}.fixedDataTableCellLayout_columnResizerKnob{position:absolute;right:0;visibility:hidden;width:4px}.fixedDataTableColumnResizerLineLayout_mouseArea{cursor:ew-resize;position:absolute;right:-5px;width:12px}.fixedDataTableColumnResizerLineLayout_main{border-right-style:solid;border-right-width:1px;box-sizing:border-box;position:absolute;z-index:10}body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main,.fixedDataTableColumnResizerLineLayout_hiddenElem{display:none!important}.fixedDataTableLayout_main{border-style:solid;border-width:1px;box-sizing:border-box;overflow:hidden;position:relative}.fixedDataTableLayout_header,.fixedDataTableLayout_hasBottomBorder{border-bottom-style:solid;border-bottom-width:1px}.fixedDataTableLayout_footer .public_fixedDataTableCell_main{border-top-style:solid;border-top-width:1px}.fixedDataTableLayout_topShadow,.fixedDataTableLayout_bottomShadow{height:4px;left:0;position:absolute;right:0;z-index:1}.fixedDataTableLayout_bottomShadow{margin-top:-4px}.fixedDataTableLayout_rowsContainer{overflow:hidden;position:relative}.fixedDataTableLayout_horizontalScrollbar{bottom:0;position:absolute}.fixedDataTableRowLayout_main{box-sizing:border-box;overflow:hidden;position:absolute;top:0}.fixedDataTableRowLayout_body{left:0;position:absolute;top:0}.fixedDataTableRowLayout_fixedColumnsDivider{-webkit-backface-visibility:hidden;backface-visibility:hidden;border-left-style:solid;border-left-width:1px;left:0;position:absolute;top:0;width:0}.fixedDataTableRowLayout_columnsShadow{width:4px}.fixedDataTableRowLayout_rowWrapper{position:absolute;top:0} \ No newline at end of file +.fixedDataTableCellGroupLayout_cellGroup{backface-visibility:hidden;left:0;overflow:hidden;position:absolute;top:0;white-space:nowrap}.fixedDataTableCellGroupLayout_cellGroup>.public_fixedDataTableCell_main{display:inline-block;vertical-align:top;white-space:normal}.fixedDataTableCellGroupLayout_cellGroupWrapper{position:absolute;top:0}.fixedDataTableCellLayout_main{border-right-style:solid;border-width:0 1px 0 0;box-sizing:border-box;display:block;overflow:hidden;position:absolute;white-space:normal}.fixedDataTableCellLayout_lastChild{border-width:0 1px 1px 0}.fixedDataTableCellLayout_alignRight{text-align:right}.fixedDataTableCellLayout_alignCenter{text-align:center}.fixedDataTableCellLayout_wrap1{display:table}.fixedDataTableCellLayout_wrap2{display:table-row}.fixedDataTableCellLayout_wrap3{display:table-cell;vertical-align:middle}.fixedDataTableCellLayout_columnResizerContainer{position:absolute;right:0;width:6px;z-index:1}.fixedDataTableCellLayout_columnResizerContainer:hover{cursor:col-resize}.fixedDataTableCellLayout_columnResizerKnob{position:absolute;right:0;width:1px}.fixedDataTableColumnResizerLineLayout_mouseArea{cursor:col-resize;position:absolute;right:-5px;width:12px}.fixedDataTableColumnResizerLineLayout_main{border-right-style:solid;border-right-width:1px;box-sizing:border-box;position:absolute;z-index:10}body[dir="rtl"] .fixedDataTableColumnResizerLineLayout_main,.fixedDataTableColumnResizerLineLayout_hiddenElem{display:none!important}.fixedDataTableLayout_main{border-style:solid;border-width:1px;box-sizing:border-box;overflow:hidden;position:relative}.fixedDataTableLayout_header,.fixedDataTableLayout_hasBottomBorder{border-bottom-style:solid;border-bottom-width:1px}.fixedDataTableLayout_footer .public_fixedDataTableCell_main{border-top-style:solid;border-top-width:1px}.fixedDataTableLayout_topShadow,.fixedDataTableLayout_bottomShadow{height:4px;left:0;position:absolute;right:0;z-index:1}.fixedDataTableLayout_bottomShadow{margin-top:-4px}.fixedDataTableLayout_rowsContainer{overflow:hidden;position:relative}.fixedDataTableLayout_horizontalScrollbar{bottom:0;position:absolute}.fixedDataTableRowLayout_main{box-sizing:border-box;overflow:hidden;position:absolute;top:0}.fixedDataTableRowLayout_body{left:0;position:absolute;top:0}.fixedDataTableRowLayout_fixedColumnsDivider{backface-visibility:hidden;border-left-style:solid;border-left-width:1px;left:0;position:absolute;top:0;width:0}.fixedDataTableRowLayout_columnsShadow{width:4px}.fixedDataTableRowLayout_rowWrapper{position:absolute;top:0}.ScrollbarLayout_main{box-sizing:border-box;outline:none;overflow:hidden;position:absolute;transition-duration:250ms;transition-timing-function:ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ScrollbarLayout_mainVertical{bottom:0;right:0;top:0;transition-property:background-color width;width:15px}.ScrollbarLayout_mainVertical.public_Scrollbar_mainActive,.ScrollbarLayout_mainVertical:hover{width:17px}.ScrollbarLayout_mainHorizontal{bottom:0;height:15px;left:0;transition-property:background-color height}.ScrollbarLayout_mainHorizontal.public_Scrollbar_mainActive,.ScrollbarLayout_mainHorizontal:hover{height:17px}.ScrollbarLayout_face{left:0;overflow:hidden;position:absolute;z-index:1}.ScrollbarLayout_face:after{border-radius:6px;content:'';display:block;position:absolute;transition:background-color 250ms ease}.ScrollbarLayout_faceHorizontal{bottom:0;left:0;top:0}.ScrollbarLayout_faceHorizontal:after{bottom:4px;left:0;top:4px;width:100%}.ScrollbarLayout_faceVertical{left:0;right:0;top:0}.ScrollbarLayout_faceVertical:after{height:100%;left:4px;right:4px;top:0}.public_fixedDataTable_main,.public_fixedDataTable_header,.public_fixedDataTable_hasBottomBorder{border-color:#d3d3d3}.public_fixedDataTable_header .public_fixedDataTableCell_main{font-weight:700}.public_fixedDataTable_header,.public_fixedDataTable_header .public_fixedDataTableCell_main{background-color:#f6f7f8;background-image:linear-gradient(#fff,#efefef)}.public_fixedDataTable_footer .public_fixedDataTableCell_main{background-color:#f6f7f8;border-color:#d3d3d3}.public_fixedDataTable_topShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAF0lEQVR4AWPUkNeSBhHCjJoK2twgFisAFagCCp3pJlAAAAAASUVORK5CYII=) repeat-x}.public_fixedDataTable_bottomShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAYAAABP2FU6AAAAHElEQVQI12MwNjZmZdAT1+Nm0JDWEGZQk1GTBgAWkwIeAEp52AAAAABJRU5ErkJggg==) repeat-x}.public_fixedDataTable_horizontalScrollbar .public_Scrollbar_mainHorizontal{background-color:#fff}.public_fixedDataTableCell_main{background-color:#fff;border-color:#d3d3d3}.public_fixedDataTableCell_highlighted{background-color:#f4f4f4}.public_fixedDataTableCell_cellContent{padding:8px}.public_fixedDataTableCell_columnResizerKnob{background-color:#f57c00}.public_fixedDataTableColumnResizerLine_main{border-color:#f57c00}.public_fixedDataTableRow_main{background-color:#fff}.public_fixedDataTableRow_highlighted,.public_fixedDataTableRow_highlighted .public_fixedDataTableCell_main{background-color:#f6f7f8}.public_fixedDataTableRow_fixedColumnsDivider{border-color:#d3d3d3}.public_fixedDataTableRow_columnsShadow{background:0 0 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAYAAAD5PA/NAAAAFklEQVQIHWPSkNeSBmJhTQVtbiDNCgASagIIuJX8OgAAAABJRU5ErkJggg==) repeat-y}.public_Scrollbar_main.public_Scrollbar_mainActive,.public_Scrollbar_main:hover{background-color:rgba(255,255,255,.8)}.public_Scrollbar_mainOpaque,.public_Scrollbar_mainOpaque.public_Scrollbar_mainActive,.public_Scrollbar_mainOpaque:hover{background-color:#fff}.public_Scrollbar_face:after{background-color:#c2c2c2}.public_Scrollbar_main:hover .public_Scrollbar_face:after,.public_Scrollbar_mainActive .public_Scrollbar_face:after,.public_Scrollbar_faceActive:after{background-color:#7d7d7d} \ No newline at end of file diff --git a/dist/fixed-data-table.min.js b/dist/fixed-data-table.min.js index f237873d..5c9195b4 100644 --- a/dist/fixed-data-table.min.js +++ b/dist/fixed-data-table.min.js @@ -1,5 +1,5 @@ /** - * FixedDataTable v0.6.0 + * FixedDataTable v0.8.2 * * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -9,6 +9,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.FixedDataTable=t(require("react"),require("react-dom")):e.FixedDataTable=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(i){if(o[i])return o[i].exports;var n=o[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){o(13),o(15),o(17),o(19),o(21),o(23),o(1),o(5),o(7),o(9),o(11),e.exports=o(25)},function(e,t,o){},,,,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){},,function(e,t,o){"use strict";var i=o(26),n=o(66),r=o(64),s=o(63),a={Cell:n,Column:r,ColumnGroup:s,Table:i};a.version="0.6.0",e.exports=a},function(e,t,o){"use strict";function i(e,t){m[e]||(console.warn("`"+e+"` will be DEPRECATED in version "+f+" of FixedDataTable and beyond. \n"+t+"\nRead the docs at: "+p),m[e]=!0)}var n=Object.assign||function(e){for(var t=1;te&&this.state.scrollX>0||e>=0&&this.state.scrollXe&&this.state.scrollY>0||e>=0&&this.state.scrollYi?i:this.state.height>i&&this.props.ownerHeight?Math.max(i,this.props.ownerHeight):this.state.height+this.state.maxScrollY,e!==this._contentHeight&&this.props.onContentHeightChange&&this.props.onContentHeightChange(e),this._contentHeight=e},componentDidMount:function(){this._reportContentHeight()},componentWillReceiveProps:function(e){var t=e.scrollToRow;void 0!==t&&null!==t&&(this._rowToScrollTo=t);var o=e.scrollToColumn;void 0!==o&&null!==o&&(this._columnToScrollTo=o);var i=e.overflowX,n=e.overflowY;(i!==this.props.overflowX||n!==this.props.overflowY)&&(this._wheelHandler=new s(this._onWheel,"hidden"!==i,"hidden"!==n)),(this.props.ownerHeight!==e.ownerHeight||this.props.scrollTop!==e.scrollTop)&&this._didScrollStart(),this._didScrollStop(),this.setState(this._calculateState(e,this.state))},componentDidUpdate:function(){this._reportContentHeight()},render:function(){var e,t=this.state,o=this.props;t.useGroupHeader&&(e=n.createElement(h,{key:"group_header",isScrolling:this._isScrolling,className:w(p("fixedDataTableLayout/header"),p("public/fixedDataTable/header")),width:t.width,height:t.groupHeaderHeight,index:0,zIndex:1,offsetTop:0,scrollLeft:t.scrollX,fixedColumns:t.groupHeaderFixedColumns,scrollableColumns:t.groupHeaderScrollableColumns,onColumnResize:this._onColumnResize}));var i=this.state.maxScrollY,r=t.maxScrollX>0&&"hidden"!==t.overflowX,s=i>0&&"hidden"!==t.overflowY,l=r?a.SIZE:0,c=t.height-l-2*x-t.footerHeight,f=t.useGroupHeader?t.groupHeaderHeight:0,d=f+t.headerHeight;c-=d;var m=0,_=null!=o.maxHeight?d+t.bodyHeight:d+c,g=_+t.footerHeight;void 0!==o.ownerHeight&&o.ownerHeightt.ownerHeight||t.scrollY or "),o.push(e))});var n=!1;o.length&&o[0].type.__TableColumnGroup__&&(n=!0);var r,s,l=t&&t.firstRowIndex||0,u=t&&t.firstRowOffset||0;r=t&&"hidden"!==e.overflowX?t.scrollX:e.scrollLeft,t&&"hidden"!==e.overflowY?s=t.scrollY:(d=this._scrollHelper.scrollTo(e.scrollTop),l=d.index,u=d.offset,s=d.position),void 0!==this._rowToScrollTo&&(d=this._scrollHelper.scrollRowIntoView(this._rowToScrollTo),l=d.index,u=d.offset,s=d.position,delete this._rowToScrollTo);var h=n?e.groupHeaderHeight:0;if(t&&e.rowsCount!==t.rowsCount){var p=(void 0===e.height?e.maxHeight:e.height)-(e.headerHeight||0)-(e.footerHeight||0)-(e.groupHeaderHeight||0);this._scrollHelper=new c(e.rowsCount,e.rowHeight,p,e.rowHeightGetter);var d=this._scrollHelper.scrollToRow(l,u);l=d.index,u=d.offset,s=d.position}else t&&e.rowHeightGetter!==t.rowHeightGetter&&this._scrollHelper.setRowHeightGetter(e.rowHeightGetter);var m;m=e.isColumnResizing?t&&t.columnResizingData:y;var w,g;if(n){var v=f.adjustColumnGroupWidths(o,e.width);w=v.columns,g=v.columnGroups}else w=f.adjustColumnWidths(o,e.width);var b=this._populateColumnsAndColumnData(w,g,t);if(void 0!==this._columnToScrollTo){var R=b.bodyFixedColumns.length;if(this._columnToScrollTo>=R){var T,D,S=0;for(T=0;TT;++T)D=b.bodyScrollableColumns[T],M+=D.props.width;var E=e.width-S,z=b.bodyScrollableColumns[H].props.width,k=M+z-E;k>r&&(r=k),r>M&&(r=M)}delete this._columnToScrollTo}var O=void 0===e.height,P=Math.round(O?e.maxHeight:e.height),N=e.footerHeight+e.headerHeight+h+2*x,I=P-N,G=this._scrollHelper.getContentHeight(),L=G+N,F=f.getTotalWidth(w),W=F>e.width&&"hidden"!==e.overflowX;W&&(I-=a.SIZE,L+=a.SIZE,N+=a.SIZE);var A=Math.max(0,F-e.width),V=Math.max(0,G-I);r=Math.min(r,A),s=Math.min(s,V),V||(O&&(P=L),I=L-N),this._scrollHelper.setViewportHeight(I);var q=i({isColumnResizing:t&&t.isColumnResizing},b,e,{columns:w,columnGroups:g,columnResizingData:m,firstRowIndex:l,firstRowOffset:u,horizontalScrollbarVisible:W,maxScrollX:A,maxScrollY:V,reservedHeight:N,scrollContentHeight:G,scrollX:r,scrollY:s,bodyHeight:I,height:P,groupHeaderHeight:h,useGroupHeader:n});return q},_selectColumnElement:function(e,t){for(var o=[],i=0;iMath.abs(e)&&"hidden"!==this.props.overflowY){var i=this._scrollHelper.scrollBy(Math.round(t)),n=Math.max(0,i.contentHeight-this.state.bodyHeight);this.setState({firstRowIndex:i.index,firstRowOffset:i.offset,scrollY:i.position,scrollContentHeight:i.contentHeight,maxScrollY:n})}else e&&"hidden"!==this.props.overflowX&&(o+=e,o=0>o?0:o,o=o>this.state.maxScrollX?this.state.maxScrollX:o,this.setState({scrollX:o}));this._didScrollStop()}},_onHorizontalScroll:function(e){this.isMounted()&&e!==this.state.scrollX&&(this._isScrolling||this._didScrollStart(),this.setState({scrollX:e}),this._didScrollStop())},_onVerticalScroll:function(e){if(this.isMounted()&&e!==this.state.scrollY){this._isScrolling||this._didScrollStart();var t=this._scrollHelper.scrollTo(Math.round(e));this.setState({firstRowIndex:t.index,firstRowOffset:t.offset,scrollY:t.position,scrollContentHeight:t.contentHeight}),this._didScrollStop()}},_didScrollStart:function(){this.isMounted()&&!this._isScrolling&&(this._isScrolling=!0,this.props.onScrollStart&&this.props.onScrollStart(this.state.scrollX,this.state.scrollY))},_didScrollStop:function(){this.isMounted()&&this._isScrolling&&(this._isScrolling=!1,this.setState({redraw:!0}),this.props.onScrollEnd&&this.props.onScrollEnd(this.state.scrollX,this.state.scrollY))}}),H=n.createClass({displayName:"HorizontalScrollbar",mixins:[r],propTypes:{contentSize:b.number.isRequired,offset:b.number.isRequired,onScroll:b.func.isRequired,position:b.number.isRequired,size:b.number.isRequired},render:function(){var e={height:a.SIZE,width:this.props.size},t={height:a.SIZE,position:"absolute",overflow:"hidden",width:this.props.size};return v(t,0,this.props.offset),n.createElement("div",{className:w(p("fixedDataTableLayout/horizontalScrollbar"),p("public/fixedDataTable/horizontalScrollbar")),style:e},n.createElement("div",{style:t},n.createElement(a,i({},this.props,{isOpaque:!0,orientation:"horizontal",offset:void 0}))))}});e.exports=S},function(e,t,o){"use strict";function i(e){for(var t=0,o=0;o=t)return{columns:e,width:i(e)};for(var o=n(e),r=t,s=[],a=0,u=0;uo?r(e,t-o).columns:e}var l=o(27),u={getTotalWidth:i,getTotalFlexGrow:n,distributeFlexWidth:r,adjustColumnWidths:a,adjustColumnGroupWidths:s};e.exports=u},function(e,t,o){"use strict";function i(e,t){if(e===t)return!0;var o;for(o in e)if(e.hasOwnProperty(o)&&(!t.hasOwnProperty(o)||e[o]!==t[o]))return!1;for(o in t)if(t.hasOwnProperty(o)&&!e.hasOwnProperty(o))return!1;return!0}var n={shouldComponentUpdate:function(e,t){return!i(this.props,e)||!i(this.state,t)}};e.exports=n},function(e,t,o){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=function(){function e(e,t){for(var o=0;oi?-1:1),n&&!o&&(o=1>n?-1:1),{spinX:t,spinY:o,pixelX:i,pixelY:n}}var n=o(35),r=o(36),s=10,a=40,l=800;i.getEventType=function(){return n.firefox()?"DOMMouseScroll":r("wheel")?"wheel":"mousewheel"},e.exports=i},function(e,t,o){"use strict";function i(){if(!v){v=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),o=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(m=/\b(iPhone|iP[ao]d)/.exec(e),_=/\b(iP[ao]d)/.exec(e),p=/Android/i.exec(e),w=/FBAN\/\w+;/i.exec(e),g=/Mobile/i.exec(e),d=!!/Win64/.exec(e),t){n=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN,n&&document&&document.documentMode&&(n=document.documentMode);var i=/(?:Trident\/(\d+.\d+))/.exec(e);u=i?parseFloat(i[1])+4:n,r=t[2]?parseFloat(t[2]):NaN,s=t[3]?parseFloat(t[3]):NaN,a=t[4]?parseFloat(t[4]):NaN,a?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),l=t&&t[1]?parseFloat(t[1]):NaN):l=NaN}else n=r=s=l=a=NaN;if(o){if(o[1]){var b=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);h=b?parseFloat(b[1].replace("_",".")):!0}else h=!1;c=!!o[2],f=!!o[3]}else h=c=f=!1}}var n,r,s,a,l,u,h,c,f,p,d,m,_,w,g,v=!1,b={ie:function(){return i()||n},ieCompatibilityMode:function(){return i()||u>n},ie64:function(){return b.ie()&&d},firefox:function(){return i()||r},opera:function(){return i()||s},webkit:function(){return i()||a},safari:function(){return b.webkit()},chrome:function(){return i()||l},windows:function(){return i()||c},osx:function(){return i()||h},linux:function(){return i()||f},iphone:function(){return i()||m},mobile:function(){return i()||m||_||p||g},nativeApp:function(){return i()||w},android:function(){return i()||p},ipad:function(){return i()||_}};e.exports=b},function(e,t,o){"use strict";function i(e,t){if(!r.canUseDOM||t&&!("addEventListener"in document))return!1;var o="on"+e,i=o in document;if(!i){var s=document.createElement("div");s.setAttribute(o,"return;"),i="function"==typeof s[o]}return!i&&n&&"wheel"===e&&(i=document.implementation.hasFeature("Events.wheel","3.0")),i}var n,r=o(37);r.canUseDOM&&(n=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=i},function(e,t,o){"use strict";var i=!("undefined"==typeof window||!window.document||!window.document.createElement),n={canUseDOM:i,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen,isInWorker:!i};e.exports=n},function(e,t,o){(function(t){"use strict";var i=o(33),n=o(39),r=0,s=n||function(e){var o=Date.now(),i=Math.max(0,16-(o-r));return r=o+i,t.setTimeout(function(){e(Date.now())},i)};s(i),e.exports=s}).call(t,function(){return this}())},function(e,t,o){(function(t){"use strict";var o=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame;e.exports=o}).call(t,function(){return this}())},function(e,t,o){"use strict";var i=o(41),n=o(44),r=o(27),s=o(45),a=o(31),l=o(32),u=o(47),h=o(48),c=o(33),f=o(49),p=r.PropTypes,d={position:0,scrollable:!1},m=parseInt(u("scrollbar-face-margin"),10),_=2*m,w=30,g=40,v=null,b=r.createClass({displayName:"Scrollbar",mixins:[a],propTypes:{contentSize:p.number.isRequired,defaultPosition:p.number,isOpaque:p.bool,orientation:p.oneOf(["vertical","horizontal"]),onScroll:p.func,position:p.number,size:p.number.isRequired,trackColor:p.oneOf(["gray"]),zIndex:p.number,verticalTop:p.number},getInitialState:function(){var e=this.props;return this._calculateState(e.position||e.defaultPosition||0,e.size,e.contentSize,e.orientation)},componentWillReceiveProps:function(e){var t=e.position;void 0===t?this._setNextState(this._calculateState(this.state.position,e.size,e.contentSize,e.orientation)):this._setNextState(this._calculateState(t,e.size,e.contentSize,e.orientation),e)},getDefaultProps:function(){return{defaultPosition:0,isOpaque:!1,onScroll:c,orientation:"vertical",zIndex:99}},render:function(){if(!this.state.scrollable)return null;var e,t,o=this.props.size,i=this.state.isHorizontal,n=!i,s=this.state.focused||this.state.isDragging,a=this.state.faceSize,l=this.props.isOpaque,c=this.props.verticalTop||0,p=h({"ScrollbarLayout/main":!0,"ScrollbarLayout/mainVertical":n,"ScrollbarLayout/mainHorizontal":i,"public/Scrollbar/main":!0,"public/Scrollbar/mainOpaque":l,"public/Scrollbar/mainActive":s}),d=h({"ScrollbarLayout/face":!0,"ScrollbarLayout/faceHorizontal":i,"ScrollbarLayout/faceVertical":n,"public/Scrollbar/faceActive":s,"public/Scrollbar/face":!0}),w=this.state.position*this.state.scale+m;return i?(e={width:o},t={width:a-_},f(t,w,0)):(e={top:c,height:o},t={height:a-_},f(t,0,w)),e.zIndex=this.props.zIndex,"gray"===this.props.trackColor&&(e.backgroundColor=u("fbui-desktop-background-light")),r.createElement("div",{onFocus:this._onFocus,onBlur:this._onBlur,onKeyDown:this._onKeyDown,onMouseDown:this._onMouseDown,onWheel:this._wheelHandler.onWheel,className:p,style:e,tabIndex:0},r.createElement("div",{ref:"face",className:d,style:t}))},componentWillMount:function(){var e="horizontal"===this.props.orientation,t=e?this._onWheelX:this._onWheelY;this._wheelHandler=new l(t,this._shouldHandleX,this._shouldHandleY)},componentDidMount:function(){this._mouseMoveTracker=new i(this._onMouseMove,this._onMouseMoveEnd,document.documentElement),void 0!==this.props.position&&this.state.position!==this.props.position&&this._didScroll()},componentWillUnmount:function(){this._nextState=null,this._mouseMoveTracker.releaseMouseMoves(),v===this&&(v=null),delete this._mouseMoveTracker},scrollBy:function(e){this._onWheel(e)},_shouldHandleX:function(e){return"horizontal"===this.props.orientation?this._shouldHandleChange(e):!1},_shouldHandleY:function(e){return"horizontal"!==this.props.orientation?this._shouldHandleChange(e):!1},_shouldHandleChange:function(e){var t=this._calculateState(this.state.position+e,this.props.size,this.props.contentSize,this.props.orientation);return t.position!==this.state.position},_calculateState:function(e,t,o,i){if(1>t||t>=o)return d;var n=""+e+"_"+t+"_"+o+"_"+i;if(this._stateKey===n)return this._stateForKey;var r="horizontal"===i,s=t/o,a=t*s;w>a&&(s=(t-w)/(o-t),a=w);var l=!0,u=o-t;0>e?e=0:e>u&&(e=u);var h=this._mouseMoveTracker?this._mouseMoveTracker.isDragging():!1,c={faceSize:a,isDragging:h,isHorizontal:r,position:e,scale:s,scrollable:l};return this._stateKey=n,this._stateForKey=c,c},_onWheelY:function(e,t){this._onWheel(t)},_onWheelX:function(e,t){this._onWheel(e)},_onWheel:function(e){var t=this.props;this._setNextState(this._calculateState(this.state.position+e,t.size,t.contentSize,t.orientation))},_onMouseDown:function(e){var t;if(e.target!==s.findDOMNode(this.refs.face)){var o=e.nativeEvent,i=this.state.isHorizontal?o.offsetX||o.layerX:o.offsetY||o.layerY,n=this.props;i/=this.state.scale,t=this._calculateState(i-.5*this.state.faceSize/this.state.scale,n.size,n.contentSize,n.orientation)}else t={};t.focused=!0,this._setNextState(t),this._mouseMoveTracker.captureMouseMoves(e),s.findDOMNode(this).focus()},_onMouseMove:function(e,t){var o=this.props,i=this.state.isHorizontal?e:t;i/=this.state.scale,this._setNextState(this._calculateState(this.state.position+i,o.size,o.contentSize,o.orientation))},_onMouseMoveEnd:function(){this._nextState=null,this._mouseMoveTracker.releaseMouseMoves(),this.setState({isDragging:!1})},_onKeyDown:function(e){var t=e.keyCode;if(t!==n.TAB){var o=g,i=0;if(this.state.isHorizontal)switch(t){case n.HOME:i=-1,o=this.props.contentSize;break;case n.LEFT:i=-1;break;case n.RIGHT:i=1;break;default:return}if(!this.state.isHorizontal)switch(t){case n.SPACE:i=e.shiftKey?-1:1;break;case n.HOME:i=-1,o=this.props.contentSize;break;case n.UP:i=-1;break;case n.DOWN:i=1;break;case n.PAGE_UP:i=-1,o=this.props.size;break;case n.PAGE_DOWN:i=1,o=this.props.size;break;default:return}e.preventDefault();var r=this.props;this._setNextState(this._calculateState(this.state.position+o*i,r.size,r.contentSize,r.orientation))}},_onFocus:function(){this.setState({focused:!0})},_onBlur:function(){this.setState({focused:!1})},_blur:function(){if(this.isMounted())try{this._onBlur(),s.findDOMNode(this).blur()}catch(e){}},_setNextState:function(e,t){t=t||this.props;var o=t.position,i=this.state.position!==e.position;if(void 0===o){var n=i?this._didScroll:void 0;this.setState(e,n)}else{if(o!==e.position)return void(void 0!==e.position&&e.position!==this.state.position&&this.props.onScroll(e.position));this.setState(e)}i&&v!==this&&(v&&v._blur(),v=this)},_didScroll:function(){this.props.onScroll(this.state.position)}});b.KEYBOARD_SCROLL_AMOUNT=g,b.SIZE=parseInt(u("scrollbar-size"),10),e.exports=b},function(e,t,o){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=function(){function e(e,t){for(var o=0;o0;)this._addRowToBuffer(t,this._viewportRowsBegin,this._viewportRowsEnd-1),t++,e--;return this._rows}},{key:"getRows",value:function(e,t){var o=t,i=o,n=e,r=Math.min(e+this._maxVisibleRowCount,this._rowsCount);for(this._viewportRowsBegin=e;r>n||i=r&&(i=this._bufferSet.replaceFurthestValuePosition(t,o,e)),null===i?(i=this._bufferSet.getNewPositionForValue(e),this._rows[i]=e):this._rows[i]=e}}]),e}();e.exports=h},function(e,t,o){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=function(){function e(e,t){for(var o=0;o=e&&t>=n)return null;var r;e-i>n-t?(r=i,this._smallValues.pop()):(r=n,this._largeValues.pop());var a=this._valueToPositionMap[r];return delete this._valueToPositionMap[r],this._valueToPositionMap[o]=a,this._pushToHeaps(a,o),a}},{key:"_pushToHeaps",value:function(e,t){var o={position:e,value:t};this._smallValues.push(o),this._largeValues.push(o)}},{key:"_cleanHeaps",value:function(){this._cleanHeap(this._smallValues),this._cleanHeap(this._largeValues);var e=Math.min(this._smallValues.size(),this._largeValues.size()),t=Math.max(this._smallValues.size(),this._largeValues.size());t>10*e&&this._recreateHeaps()}},{key:"_recreateHeaps",value:function(){for(var e=this._smallValues.size()t.value}}]),e}();e.exports=a},function(e,t,o){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){return t>e}var r=function(){function e(e,t){for(var o=0;o0&&(this._items[0]=t,this._sinkDown(0)),e}}},{key:"push",value:function(e){this._items[this._size++]=e,this._bubbleUp(this._size-1)}},{key:"size",value:function(){return this._size}},{key:"peek",value:function(){return 0!==this._size?this._items[0]:void 0}},{key:"_heapify",value:function(){for(var e=Math.floor((this._size+1)/2);e>=0;e--)this._sinkDown(e)}},{key:"_bubbleUp",value:function(e){for(var t=this._items[e];e>0;){var o=Math.floor((e+1)/2)-1,i=this._items[o];if(this._comparator(i,t))return;this._items[o]=t,this._items[e]=i,e=o}}},{key:"_sinkDown",value:function(e){for(var t=this._items[e];;){var o=2*(e+1)-1,i=2*(e+1),n=-1;if(oe?t:e>o?o:e}e.exports=i},function(e,t,o){"use strict";var i=Object.assign||function(e){for(var t=1;t0){var t=s({"fixedDataTableRowLayout/fixedColumnsDivider":!0,"fixedDataTableRowLayout/columnsShadow":this.props.scrollLeft>0,"public/fixedDataTableRow/fixedColumnsDivider":!0,"public/fixedDataTableRow/columnsShadow":this.props.scrollLeft>0}),o={left:e,height:this.props.height};return n.createElement("div",{className:t,style:o})}},_onClick:function(e){this.props.onClick(e,this.props.index)},_onDoubleClick:function(e){this.props.onDoubleClick(e,this.props.index)},_onMouseDown:function(e){this.props.onMouseDown(e,this.props.index)},_onMouseEnter:function(e){this.props.onMouseEnter(e,this.props.index)},_onMouseLeave:function(e){this.props.onMouseLeave(e,this.props.index)}}),c=n.createClass({displayName:"FixedDataTableRow",propTypes:{isScrolling:u.bool,height:u.number.isRequired,zIndex:u.number,offsetTop:u.number.isRequired,width:u.number.isRequired},render:function(){var e={width:this.props.width,height:this.props.height,zIndex:this.props.zIndex?this.props.zIndex:0};return l(e,0,this.props.offsetTop),n.createElement("div",{style:e,className:s("fixedDataTableRowLayout/rowWrapper")},n.createElement(h,i({},this.props,{offsetTop:void 0,zIndex:void 0})))}});e.exports=c},function(e,t,o){"use strict";function i(e,t){var o={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(o[i]=e[i]);return o}var n=Object.assign||function(e){for(var t=1;tn;n++){var a=t[n].props;if(!a.allowCellsRecycling||i-e.left<=e.width&&i-e.left+a.width>=0){var h="cell_"+n;o[n]=this._renderCell(e.rowIndex,e.rowHeight,a,i,h)}i+=a.width}var f=this._getColumnsWidth(t),p={height:e.height,position:"absolute",width:f,zIndex:e.zIndex};return u(p,-1*c*e.left,0),s.createElement("div",{className:l("fixedDataTableCellGroupLayout/cellGroup"),style:p},o)},_renderCell:function(e,t,o,i,n){var r=o.isResizable&&this.props.onColumnResize,l=r?this.props.onColumnResize:null,u=o.cellClassName;return s.createElement(a,{isScrolling:this.props.isScrolling,align:o.align,className:u,height:t,key:n,maxWidth:o.maxWidth,minWidth:o.minWidth,onColumnResize:l,rowIndex:e,columnKey:o.columnKey,width:o.width,left:i,cell:o.cell})},_getColumnsWidth:function(e){for(var t=0,o=0;o should never render")}});e.exports=n},function(e,t,o){"use strict";var i=o(27),n=i.createClass({displayName:"TransitionColumn",statics:{__TableColumn__:!0},render:function(){throw new Error("Component should never render")}});e.exports=n},function(e,t,o){"use strict";function i(e,t){var o={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(o[i]=e[i]);return o}var n=o(66),r=o(61),s=o(27),a=o(48),l=o(67),u=r.DIR_SIGN,h=s.PropTypes,c={align:"left",highlighted:!1},f=s.createClass({displayName:"FixedDataTableCell",propTypes_DISABLED_FOR_PERFORMANCE:{isScrolling:h.bool,align:h.oneOf(["left","center","right"]),className:h.string,highlighted:h.bool,width:h.number.isRequired,minWidth:h.number,maxWidth:h.number,height:h.number.isRequired,cell:h.oneOfType([h.string,h.element,h.func]),columnKey:h.oneOfType([h.string,h.number]),rowIndex:h.number.isRequired,onColumnResize:h.func,left:h.number},shouldComponentUpdate:function(e){return!e.isScrolling||this.props.rowIndex!==e.rowIndex},getDefaultProps:function(){return c},render:function(){var e=this.props,t=e.height,o=e.width,r=e.columnKey,h=i(e,["height","width","columnKey"]),c={height:t,width:o};1===u?c.left=h.left:c.right=h.left;var f,p=l(a({"fixedDataTableCellLayout/main":!0,"fixedDataTableCellLayout/lastChild":h.lastChild,"fixedDataTableCellLayout/alignRight":"right"===h.align,"fixedDataTableCellLayout/alignCenter":"center"===h.align,"public/fixedDataTableCell/alignRight":"right"===h.align,"public/fixedDataTableCell/highlighted":h.highlighted,"public/fixedDataTableCell/main":!0}),h.className);if(h.onColumnResize){var d={height:t};f=s.createElement("div",{className:a("fixedDataTableCellLayout/columnResizerContainer"),style:d,onMouseDown:this._onColumnResizerMouseDown},s.createElement("div",{className:l(a("fixedDataTableCellLayout/columnResizerKnob"),a("public/fixedDataTableCell/columnResizerKnob")),style:d}))}var m={columnKey:r,height:t,width:o};h.rowIndex>=0&&(m.rowIndex=h.rowIndex);var _;return _=s.isValidElement(h.cell)?s.cloneElement(h.cell,m):"function"==typeof h.cell?h.cell(m):s.createElement(n,m,h.cell),s.createElement("div",{className:p,style:c},f,_)},_onColumnResizerMouseDown:function(e){this.props.onColumnResize(this.props.left,this.props.width,this.props.minWidth,this.props.maxWidth,this.props.columnKey,e)}});e.exports=f},function(e,t,o){"use strict";function i(e,t){var o={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(o[i]=e[i]);return o}var n=Object.assign||function(e){for(var t=1;t1)for(var i=1;o>i;i++)t=arguments[i],t&&(e=(e?e+" ":"")+t);return e}e.exports=i},function(e,t,o){"use strict";var i=o(41),n=o(62),r=o(27),s=o(31),a=o(58),l=o(48),u=r.PropTypes,h=r.createClass({displayName:"FixedDataTableColumnResizeHandle",mixins:[s],propTypes:{visible:u.bool.isRequired,height:u.number.isRequired,leftOffset:u.number.isRequired,knobHeight:u.number.isRequired,initialWidth:u.number,minWidth:u.number,maxWidth:u.number,initialEvent:u.object,onColumnResizeEnd:u.func,columnKey:u.oneOfType([u.string,u.number])},getInitialState:function(){return{width:0,cursorDelta:0}},componentWillReceiveProps:function(e){e.initialEvent&&!this._mouseMoveTracker.isDragging()&&(this._mouseMoveTracker.captureMouseMoves(e.initialEvent),this.setState({width:e.initialWidth,cursorDelta:e.initialWidth}))},componentDidMount:function(){this._mouseMoveTracker=new i(this._onMove,this._onColumnResizeEnd,document.body)},componentWillUnmount:function(){this._mouseMoveTracker.releaseMouseMoves(),this._mouseMoveTracker=null},render:function(){var e={width:this.state.width,height:this.props.height};return n.isRTL()?e.right=this.props.leftOffset:e.left=this.props.leftOffset,r.createElement("div",{className:l({"fixedDataTableColumnResizerLineLayout/main":!0,"fixedDataTableColumnResizerLineLayout/hiddenElem":!this.props.visible,"public/fixedDataTableColumnResizerLine/main":!0}),style:e},r.createElement("div",{className:l("fixedDataTableColumnResizerLineLayout/mouseArea"),style:{height:this.props.height}}))},_onMove:function(e){n.isRTL()&&(e=-e);var t=this.state.cursorDelta+e,o=a(t,this.props.minWidth,this.props.maxWidth);this.setState({width:o,cursorDelta:t})},_onColumnResizeEnd:function(){this._mouseMoveTracker.releaseMouseMoves(),this.props.onColumnResizeEnd(this.state.width,this.props.columnKey)}});e.exports=h},function(e,t,o){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=function(){function e(e,t){for(var o=0;oa;++a)this._storedHeights[a]=o;this._rowCount=t,this._position=0,this._contentHeight=t*o,this._defaultRowHeight=o,this._rowHeightGetter=s?s:function(){return o},this._viewportHeight=n,this.scrollRowIntoView=this.scrollRowIntoView.bind(this),this.setViewportHeight=this.setViewportHeight.bind(this),this.scrollBy=this.scrollBy.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollToRow=this.scrollToRow.bind(this),this.setRowHeightGetter=this.setRowHeightGetter.bind(this),this.getContentHeight=this.getContentHeight.bind(this),this.getRowPosition=this.getRowPosition.bind(this),this._updateHeightsInViewport(0,0)}return n(e,[{key:"setRowHeightGetter",value:function(e){this._rowHeightGetter=e}},{key:"setViewportHeight",value:function(e){this._viewportHeight=e}},{key:"getContentHeight",value:function(){return this._contentHeight}},{key:"_updateHeightsInViewport",value:function(e,t){for(var o=t,i=e;o<=this._viewportHeight&&i=0&&t>=e-a;){var o=this._updateRowHeight(t);this._position+=o,t--}}},{key:"_updateRowHeight",value:function(e){if(0>e||e>=this._rowCount)return 0;var t=this._rowHeightGetter(e);if(t!==this._storedHeights[e]){var o=t-this._storedHeights[e];return this._rowOffsets.set(e,t),this._storedHeights[e]=t,this._contentHeight+=o,o}return 0}},{key:"getRowPosition",value:function(e){return this._updateRowHeight(e),this._rowOffsets.sumUntil(e)}},{key:"scrollBy",value:function(e){if(0===this._rowCount)return l;var t=this._rowOffsets.greatestLowerBound(this._position);t=s(t,0,Math.max(this._rowCount-1,0));var o=this._rowOffsets.sumUntil(t),i=t,n=this._position,r=this._updateRowHeight(i);0!==o&&(n+=r);var a=this._storedHeights[i]-(n-o);if(e>=0)for(;e>0&&ie?(n+=e,e=0):(e-=a,n+=a,i++),ie){e=-e;for(var u=this._storedHeights[i]-a;e>0&&i>=0;)if(u>e?(n-=e,e=0):(n-=u,e-=u,i--),i>=0){var h=this._updateRowHeight(i);u=this._storedHeights[i],n+=h}}var c=this._contentHeight-this._viewportHeight;n=s(n,0,c),this._position=n;var f=this._rowOffsets.greatestLowerBound(n);f=s(f,0,Math.max(this._rowCount-1,0)),o=this._rowOffsets.sumUntil(f);var p=o-n;return this._updateHeightsInViewport(f,p),this._updateHeightsAboveViewport(f),{index:f,offset:p,position:this._position,contentHeight:this._contentHeight}}},{key:"_getRowAtEndPosition",value:function(e){this._updateRowHeight(e);for(var t=e,o=this._storedHeights[t];o=0;)t--,t>=0&&(this._updateRowHeight(t),o+=this._storedHeights[t]);var i=this._rowOffsets.sumTo(e)-this._viewportHeight;return 0>i&&(i=0),i}},{key:"scrollTo",value:function(e){if(0===this._rowCount)return l;if(0>=e)return this._position=0,this._updateHeightsInViewport(0,0),{index:0,offset:0,position:this._position,contentHeight:this._contentHeight};if(e>=this._contentHeight-this._viewportHeight){var t=this._rowCount-1;e=this._getRowAtEndPosition(t)}this._position=e;var o=this._rowOffsets.greatestLowerBound(e);o=s(o,0,Math.max(this._rowCount-1,0));var i=this._rowOffsets.sumUntil(o),n=i-e;return this._updateHeightsInViewport(o,n),this._updateHeightsAboveViewport(o),{index:o,offset:n,position:this._position,contentHeight:this._contentHeight}}},{key:"scrollToRow",value:function(e,t){e=s(e,0,Math.max(this._rowCount-1,0)),t=s(t,-this._storedHeights[e],0);var o=this._rowOffsets.sumUntil(e);return this.scrollTo(o-t)}},{key:"scrollRowIntoView",value:function(e){e=s(e,0,Math.max(this._rowCount-1,0));var t=this._rowOffsets.sumUntil(e),o=t+this._storedHeights[e];if(tt;)t*=2;return t}var r=function(){function e(e,t){for(var o=0;o=0;--o)t[o]=0;return t},u=function(){function e(t){i(this,e),this._size=t.length,this._half=n(this._size),this._heap=new l(2*this._half);var o;for(o=0;o0;--o)this._heap[o]=this._heap[2*o]+this._heap[2*o+1]}return r(e,[{key:"set",value:function(e,t){s(e>=0&&e=0&&e=0&&e=0&&e=e,"Begin must precede end"),this.sumUntil(t)-this.sumUntil(e)}},{key:"greatestLowerBound",value:function(e){if(0>e)return-1;var t=1;if(this._heap[t]<=e)return this._size;for(;te?t=2*t:(t=2*t+1,e-=o)}return t-this._half}},{key:"greatestStrictLowerBound",value:function(e){if(0>=e)return-1;var t=1;if(this._heap[t]=e?t=2*t:(t=2*t+1,e-=o)}return t-this._half}},{key:"leastUpperBound",value:function(e){return this.greatestStrictLowerBound(e)+1}},{key:"leastStrictUpperBound",value:function(e){return this.greatestLowerBound(e)+1}}],[{key:"uniform",value:function(t,o){for(var i=[],n=t-1;n>=0;--n)i[n]=o;return new e(i)}},{key:"empty",value:function(t){return e.uniform(t,0)}}]),e}();e.exports=u}).call(t,function(){return this}())},function(e,t,o){"use strict";function i(e,t,o,i,n){function r(){for(var n=arguments.length,a=Array(n),l=0;n>l;l++)a[l]=arguments[l];r.reset();var u=function(){e.apply(o,a)};u.__SMmeta=e.__SMmeta,s=i(u,t)}i=i||setTimeout,n=n||clearTimeout;var s;return r.reset=function(){n(s)},r}e.exports=i},function(e,t,o){"use strict";function i(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(var r=n.bind(t),s=0;s should never render")}});e.exports=r},function(e,t,o){"use strict";var i=o(27),n=i.PropTypes,r=i.createClass({displayName:"FixedDataTableColumnGroup",statics:{__TableColumnGroup__:!0},propTypes:{align:n.oneOf(["left","center","right"]),fixed:n.bool,header:n.oneOfType([n.node,n.func])},getDefaultProps:function(){return{fixed:!1}},render:function(){throw new Error("Component should never render")}});e.exports=r},function(e,t,o){"use strict";var i=Object.assign||function(e){for(var t=1;t1)for(var o=1;o0||e>=0&&this.state.scrollX0||e>=0&&this.state.scrollYn?n:this.state.height>n&&this.props.ownerHeight?Math.max(n,this.props.ownerHeight):this.state.height+this.state.maxScrollY,e!==this._contentHeight&&this.props.onContentHeightChange&&this.props.onContentHeightChange(e),this._contentHeight=e},componentDidMount:function(){this._reportContentHeight(),this._isMounted=!0},componentWillReceiveProps:function(e){var t=e.scrollToRow;void 0!==t&&null!==t&&(this._rowToScrollTo=t);var o=e.scrollToColumn;void 0!==o&&null!==o&&(this._columnToScrollTo=o);var n=e.overflowX,r=e.overflowY;n===this.props.overflowX&&r===this.props.overflowY||(this._wheelHandler=new u(this._onWheel,"hidden"!==n,"hidden"!==r)),this.props.ownerHeight===e.ownerHeight&&this.props.scrollTop===e.scrollTop||this._didScrollStart(),this._didScroll(),this._didScrollStop(),this.setState(this._calculateState(e,this.state))},componentDidUpdate:function(){this._reportContentHeight()},render:function(){var e,t=this.state,o=this.props;t.useGroupHeader&&(e=s.createElement(p,{key:"group_header",isScrolling:this._isScrolling,className:w(v("fixedDataTableLayout/header"),v("public/fixedDataTable/header")),width:t.width,height:t.groupHeaderHeight,index:0,zIndex:1,offsetTop:0,scrollLeft:t.scrollX,fixedColumns:t.groupHeaderFixedColumns,scrollableColumns:t.groupHeaderScrollableColumns,onColumnResize:this._onColumnResize,setHoverState:this.setHoverState,isColumnResizing:t.isColumnResizing}));var i=this.state.maxScrollY,a=t.maxScrollX>0&&"hidden"!==t.overflowX,l=i>0&&"hidden"!==t.overflowY,u=a?c.SIZE:0,h=t.height-u-2*S-t.footerHeight,d=t.useGroupHeader?t.groupHeaderHeight:0,m=d+t.headerHeight;h-=m;var g=0,_=null!=o.maxHeight?m+t.bodyHeight:m+h,y=_+t.footerHeight;void 0!==o.ownerHeight&&o.ownerHeightt.ownerHeight||t.scrollY or "),o.push(e))});var n=!1;o.length&&o[0].type.__TableColumnGroup__&&(n=!0),t&&(void 0!==e.width&&e.width!==t.width||void 0!==e.height&&e.height!==t.height||void 0!==e.maxWidth&&e.maxWidth!==t.maxWidth||void 0!==e.maxHeight&&e.maxHeight!==t.maxHeight)&&(t=null);var i,s,a=t&&t.firstRowIndex||0,l=t&&t.firstRowOffset||0;i=t&&"hidden"!==e.overflowX?t.scrollX:e.scrollLeft,t&&"hidden"!==e.overflowY?s=t.scrollY:(f=this._scrollHelper.scrollTo(e.scrollTop),a=f.index,l=f.offset,s=f.position),void 0!==this._rowToScrollTo&&(f=this._scrollHelper.scrollRowIntoView(this._rowToScrollTo),a=f.index,l=f.offset,s=f.position,delete this._rowToScrollTo);var u=n?e.groupHeaderHeight:0;if(t&&e.rowsCount!==t.rowsCount){var h=(void 0===e.height?e.maxHeight:e.height)-(e.headerHeight||0)-(e.footerHeight||0)-(e.groupHeaderHeight||0);this._scrollHelper=new d(e.rowsCount,e.rowHeight,h,e.rowHeightGetter);var f=this._scrollHelper.scrollToRow(a,l);a=f.index,l=f.offset,s=f.position}else t&&e.rowHeightGetter!==t.rowHeightGetter&&this._scrollHelper.setRowHeightGetter(e.rowHeightGetter);var p;p=e.isColumnResizing?t&&t.columnResizingData:E;var v,g;if(n){var _=m.adjustColumnGroupWidths(o,e.width);v=_.columns,g=_.columnGroups}else v=m.adjustColumnWidths(o,e.width);var w=this._populateColumnsAndColumnData(v,g,t);if(void 0!==this._columnToScrollTo){var b=w.bodyFixedColumns.length;if(this._columnToScrollTo>=b){var x,C,T=0;for(x=0;xO&&(i=O)}delete this._columnToScrollTo}var k=void 0===e.height,P=Math.round(k?e.maxHeight:e.height),z=e.footerHeight+e.headerHeight+u+2*S,I=P-z,j=this._scrollHelper.getContentHeight(),A=j+z,F=m.getTotalWidth(v),L=F>e.width&&"hidden"!==e.overflowX;L&&(I-=c.SIZE,A+=c.SIZE,z+=c.SIZE);var G=Math.max(0,F-e.width),W=Math.max(0,j-I);i=Math.min(i,G),s=Math.min(s,W),W||(k&&(P=A),I=A-z),this._scrollHelper.setViewportHeight(I);var V=r({isColumnResizing:t&&t.isColumnResizing},w,e,{columns:v,columnGroups:g,columnResizingData:p,firstRowIndex:a,firstRowOffset:l,horizontalScrollbarVisible:L,maxScrollX:G,maxScrollY:W,reservedHeight:z,scrollContentHeight:j,scrollX:i,scrollY:s,bodyHeight:I,height:P,groupHeaderHeight:u,useGroupHeader:n});return V},_selectColumnElement:function(e,t){for(var o=[],n=0;nMath.abs(e)&&"hidden"!==this.props.overflowY){var n=this._scrollHelper.scrollBy(Math.round(t)),r=Math.max(0,n.contentHeight-this.state.bodyHeight);this.setState({firstRowIndex:n.index,firstRowOffset:n.offset,scrollY:n.position,scrollContentHeight:n.contentHeight,maxScrollY:r})}else e&&"hidden"!==this.props.overflowX&&(o+=e,o=o<0?0:o,o=o>this.state.maxScrollX?this.state.maxScrollX:o,this.setState({scrollX:o}));this._didScroll(),this._didScrollStop()}},_onHorizontalScroll:function(e){this._isMounted&&e!==this.state.scrollX&&(this._isScrolling||this._didScrollStart(),this.setState({scrollX:e}),this._didScroll(),this._didScrollStop())},_onVerticalScroll:function(e){if(this._isMounted&&e!==this.state.scrollY){this._isScrolling||this._didScrollStart();var t=this._scrollHelper.scrollTo(Math.round(e));this.setState({firstRowIndex:t.index,firstRowOffset:t.offset,scrollY:t.position,scrollContentHeight:t.contentHeight}),this._didScroll(),this._didScrollStop()}},_didScrollStart:function(){this._isMounted&&!this._isScrolling&&(this._isScrolling=!0,this.props.onScrollStart&&this.props.onScrollStart(this.state.scrollX,this.state.scrollY))},_didScroll:function(){this._isMounted&&this._isScrolling&&this.props.onScroll&&this.props.onScroll(this.state.scrollX,this.state.scrollY)},_didScrollStop:function(){this._isMounted&&this._isScrolling&&(this._isScrolling=!1,this.setState({redraw:!0}),this.props.onScrollEnd&&this.props.onScrollEnd(this.state.scrollX,this.state.scrollY))},setHoverState:function(e){this.setState({isHoveringResizerKnob:e})}}),M=a({displayName:"HorizontalScrollbar",mixins:[l],propTypes:{contentSize:i.number.isRequired,offset:i.number.isRequired,onScroll:i.func.isRequired,position:i.number.isRequired,size:i.number.isRequired},render:function(){var e=r({height:c.SIZE,width:this.props.size},this.props.horizontalScrollbarStyle),t={height:c.SIZE, +position:"absolute",overflow:"hidden",width:this.props.size};return x(t,0,this.props.offset),s.createElement("div",{className:w(v("fixedDataTableLayout/horizontalScrollbar"),v("public/fixedDataTable/horizontalScrollbar")),style:e},s.createElement("div",{style:t},s.createElement(c,r({},this.props,{isOpaque:!0,orientation:"horizontal",offset:void 0}))))}});e.exports=H},function(e,t,o){"use strict";var n=o(35),r=o(38);if("undefined"==typeof n)throw Error("create-react-class could not find the React object. If you are using script tags, make sure that React is being loaded before create-react-class.");var i=(new n.Component).updater;e.exports=r(n.Component,n.isValidElement,i)},function(e,t,o){(function(t){"use strict";function n(e){return e}function r(e,o,r){function h(e,o,n){for(var r in o)o.hasOwnProperty(r)&&"production"!==t.env.NODE_ENV&&l("function"==typeof o[r],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",u[n],r)}function f(e,t){var o=x.hasOwnProperty(t)?x[t]:null;T.hasOwnProperty(t)&&a("OVERRIDE_BASE"===o,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",t),e&&a("DEFINE_MANY"===o||"DEFINE_MANY_MERGED"===o,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t)}function p(e,n){if(n){a("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),a(!o(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var r=e.prototype,i=r.__reactAutoBindPairs;n.hasOwnProperty(c)&&R.mixins(e,n.mixins);for(var s in n)if(n.hasOwnProperty(s)&&s!==c){var u=n[s],h=r.hasOwnProperty(s);if(f(h,s),R.hasOwnProperty(s))R[s](e,u);else{var p=x.hasOwnProperty(s),d="function"==typeof u,m=d&&!p&&!h&&n.autobind!==!1;if(m)i.push(s,u),r[s]=u;else if(h){var _=x[s];a(p&&("DEFINE_MANY_MERGED"===_||"DEFINE_MANY"===_),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",_,s),"DEFINE_MANY_MERGED"===_?r[s]=v(r[s],u):"DEFINE_MANY"===_&&(r[s]=g(r[s],u))}else r[s]=u,"production"!==t.env.NODE_ENV&&"function"==typeof u&&n.displayName&&(r[s].displayName=n.displayName+"_"+s)}}}else if("production"!==t.env.NODE_ENV){var y=typeof n,w="object"===y&&null!==n;"production"!==t.env.NODE_ENV&&l(w,"%s: You're attempting to include a mixin that is either null or not an object. Check the mixins included by the component, as well as any mixins they include themselves. Expected object but got %s.",e.displayName||"ReactClass",null===n?null:y)}}function d(e,t){if(t)for(var o in t){var n=t[o];if(t.hasOwnProperty(o)){var r=o in R;a(!r,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',o);var i=o in e;if(i){var s=C.hasOwnProperty(o)?C[o]:null;return a("DEFINE_MANY_MERGED"===s,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",o),void(e[o]=v(e[o],n))}e[o]=n}}}function m(e,t){a(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var o in t)t.hasOwnProperty(o)&&(a(void 0===e[o],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",o),e[o]=t[o]);return e}function v(e,t){return function(){var o=e.apply(this,arguments),n=t.apply(this,arguments);if(null==o)return n;if(null==n)return o;var r={};return m(r,o),m(r,n),r}}function g(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function _(e,o){var n=o.bind(e);if("production"!==t.env.NODE_ENV){n.__reactBoundContext=e,n.__reactBoundMethod=o,n.__reactBoundArguments=null;var r=e.constructor.displayName,i=n.bind;n.bind=function(s){for(var a=arguments.length,u=Array(a>1?a-1:0),c=1;c1?t-1:0),n=1;n2?o-2:0),r=2;rn},ie64:function(){return y.ie()&&p},firefox:function(){return o()||r},opera:function(){return o()||i},webkit:function(){return o()||s},safari:function(){return y.webkit()},chrome:function(){return o()||a},windows:function(){return o()||c},osx:function(){return o()||u},linux:function(){return o()||h},iphone:function(){return o()||d},mobile:function(){return o()||d||m||f||g},nativeApp:function(){return o()||v},android:function(){return o()||f},ipad:function(){return o()||m}};e.exports=y},function(e,t,o){"use strict";function n(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var o="on"+e,n=o in document;if(!n){var s=document.createElement("div");s.setAttribute(o,"return;"),n="function"==typeof s[o]}return!n&&r&&"wheel"===e&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n}var r,i=o(49);i.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=n},function(e,t){"use strict";var o=!("undefined"==typeof window||!window.document||!window.document.createElement),n={canUseDOM:o,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:o&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:o&&!!window.screen,isInWorker:!o};e.exports=n},function(e,t,o){(function(t){"use strict";var n=o(45),r=o(51),i=0,s=r||function(e){var o=Date.now(),n=Math.max(0,16-(o-i));return i=o+n,t.setTimeout(function(){e(Date.now())},n)};s(n),e.exports=s}).call(t,function(){return this}())},function(e,t){(function(t){"use strict";var o=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame;e.exports=o}).call(t,function(){return this}())},function(e,t,o){"use strict";var n=o(53),r=o(56),i=o(27),s=o(34),a=o(37),l=o(57),u=o(43),c=o(44),h=o(59),f=o(60),p=o(45),d=o(61),m={position:0,scrollable:!1},v=parseInt(h("scrollbar-face-margin"),10),g=2*v,_=30,y=40,w=null,b=a({displayName:"Scrollbar",mixins:[u],propTypes:{contentSize:i.number.isRequired,defaultPosition:i.number,isOpaque:i.bool,orientation:i.oneOf(["vertical","horizontal"]),onScroll:i.func,position:i.number,size:i.number.isRequired,trackColor:i.oneOf(["gray"]),zIndex:i.number,verticalTop:i.number},getInitialState:function(){var e=this.props;return this._calculateState(e.position||e.defaultPosition||0,e.size,e.contentSize,e.orientation)},componentWillReceiveProps:function(e){var t=e.position;void 0===t?this._setNextState(this._calculateState(this.state.position,e.size,e.contentSize,e.orientation)):this._setNextState(this._calculateState(t,e.size,e.contentSize,e.orientation),e)},getDefaultProps:function(){return{defaultPosition:0,isOpaque:!1,onScroll:p,orientation:"vertical",zIndex:99}},render:function(){if(!this.state.scrollable)return null;var e,t,o=this.props.size,n=this.state.isHorizontal,r=!n,i=this.state.focused||this.state.isDragging,a=this.state.faceSize,l=this.props.isOpaque,u=this.props.verticalTop||0,c=f({"ScrollbarLayout/main":!0,"ScrollbarLayout/mainVertical":r,"ScrollbarLayout/mainHorizontal":n,"public/Scrollbar/main":!0,"public/Scrollbar/mainOpaque":l,"public/Scrollbar/mainActive":i}),p=f({"ScrollbarLayout/face":!0,"ScrollbarLayout/faceHorizontal":n,"ScrollbarLayout/faceVertical":r,"public/Scrollbar/faceActive":i,"public/Scrollbar/face":!0}),m=this.state.position*this.state.scale+v;return n?(e={width:o},t={width:a-g},d(t,m,0)):(e={top:u,height:o},t={height:a-g},d(t,0,m)),e.zIndex=this.props.zIndex,"gray"===this.props.trackColor&&(e.backgroundColor=h("fbui-desktop-background-light")),s.createElement("div",{onFocus:this._onFocus,onBlur:this._onBlur,onKeyDown:this._onKeyDown,onMouseDown:this._onMouseDown,onWheel:this._wheelHandler.onWheel,className:c,style:e,tabIndex:0},s.createElement("div",{ref:"face",className:p,style:t}))},componentWillMount:function(){var e="horizontal"===this.props.orientation,t=e?this._onWheelX:this._onWheelY;this._wheelHandler=new c(t,this._shouldHandleX,this._shouldHandleY)},componentDidMount:function(){this._mouseMoveTracker=new n(this._onMouseMove,this._onMouseMoveEnd,document.documentElement),void 0!==this.props.position&&this.state.position!==this.props.position&&this._didScroll(),this._isMounted=!0},componentWillUnmount:function(){this._nextState=null,this._mouseMoveTracker.releaseMouseMoves(),w===this&&(w=null),delete this._mouseMoveTracker,this._isMounted=!1},scrollBy:function(e){this._onWheel(e)},_shouldHandleX:function(e){return"horizontal"===this.props.orientation&&this._shouldHandleChange(e)},_shouldHandleY:function(e){return"horizontal"!==this.props.orientation&&this._shouldHandleChange(e)},_shouldHandleChange:function(e){var t=this._calculateState(this.state.position+e,this.props.size,this.props.contentSize,this.props.orientation);return t.position!==this.state.position},_calculateState:function(e,t,o,n){if(t<1||o<=t)return m;var r=e+"_"+t+"_"+o+"_"+n;if(this._stateKey===r)return this._stateForKey;var i="horizontal"===n,s=t/o,a=t*s;a<_&&(s=(t-_)/(o-t),a=_);var l=!0,u=o-t;e<0?e=0:e>u&&(e=u);var c=!!this._mouseMoveTracker&&this._mouseMoveTracker.isDragging(),h={faceSize:a,isDragging:c,isHorizontal:i,position:e,scale:s,scrollable:l};return this._stateKey=r,this._stateForKey=h,h},_onWheelY:function(e,t){this._onWheel(t)},_onWheelX:function(e,t){this._onWheel(e)},_onWheel:function(e){var t=this.props;this._setNextState(this._calculateState(this.state.position+e,t.size,t.contentSize,t.orientation))},_onMouseDown:function(e){var t;if(e.target!==l.findDOMNode(this.refs.face)){var o=e.nativeEvent,n=this.state.isHorizontal?o.offsetX||o.layerX:o.offsetY||o.layerY,r=this.props;n/=this.state.scale,t=this._calculateState(n-.5*this.state.faceSize/this.state.scale,r.size,r.contentSize,r.orientation)}else t={};t.focused=!0,this._setNextState(t),this._mouseMoveTracker.captureMouseMoves(e),l.findDOMNode(this).focus()},_onMouseMove:function(e,t){var o=this.props,n=this.state.isHorizontal?e:t;n/=this.state.scale,this._setNextState(this._calculateState(this.state.position+n,o.size,o.contentSize,o.orientation))},_onMouseMoveEnd:function(){this._nextState=null,this._mouseMoveTracker.releaseMouseMoves(),this.setState({isDragging:!1})},_onKeyDown:function(e){var t=e.keyCode;if(t!==r.TAB){var o=y,n=0;if(this.state.isHorizontal)switch(t){case r.HOME:n=-1,o=this.props.contentSize;break;case r.LEFT:n=-1;break;case r.RIGHT:n=1;break;default:return}if(!this.state.isHorizontal)switch(t){case r.SPACE:n=e.shiftKey?-1:1;break;case r.HOME:n=-1,o=this.props.contentSize;break;case r.UP:n=-1;break;case r.DOWN:n=1;break;case r.PAGE_UP:n=-1,o=this.props.size;break;case r.PAGE_DOWN:n=1,o=this.props.size;break;default:return}e.preventDefault();var i=this.props;this._setNextState(this._calculateState(this.state.position+o*n,i.size,i.contentSize,i.orientation))}},_onFocus:function(){this.setState({focused:!0})},_onBlur:function(){this.setState({focused:!1})},_blur:function(){if(this._isMounted)try{this._onBlur(),l.findDOMNode(this).blur()}catch(e){}},_setNextState:function(e,t){t=t||this.props;var o=t.position,n=this.state.position!==e.position;if(void 0===o){var r=n?this._didScroll:void 0;this.setState(e,r)}else{if(o!==e.position)return void(void 0!==e.position&&e.position!==this.state.position&&this.props.onScroll(e.position));this.setState(e)}n&&w!==this&&(w&&w._blur(),w=this)},_didScroll:function(){this.props.onScroll(this.state.position)}});b.KEYBOARD_SCROLL_AMOUNT=y,b.SIZE=parseInt(h("scrollbar-size"),10),e.exports=b},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var o=0;o0;)this._addRowToBuffer(t,this._viewportRowsBegin,this._viewportRowsEnd-1),t++,e--;return this._rows}},{key:"getRows",value:function(e,t){var o=t,n=o,r=e,i=Math.min(e+this._maxVisibleRowCount,this._rowsCount);for(this._viewportRowsBegin=e;r=i&&(n=this._bufferSet.replaceFurthestValuePosition(t,o,e)),null===n?(n=this._bufferSet.getNewPositionForValue(e),this._rows[n]=e):this._rows[n]=e}}]),e}();e.exports=c},function(e,t,o){ +"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var o=0;o=e&&r<=t)return null;var i;e-n>r-t?(i=n,this._smallValues.pop()):(i=r,this._largeValues.pop());var a=this._valueToPositionMap[i];return delete this._valueToPositionMap[i],this._valueToPositionMap[o]=a,this._pushToHeaps(a,o),a}},{key:"_pushToHeaps",value:function(e,t){var o={position:e,value:t};this._smallValues.push(o),this._largeValues.push(o)}},{key:"_cleanHeaps",value:function(){this._cleanHeap(this._smallValues),this._cleanHeap(this._largeValues);var e=Math.min(this._smallValues.size(),this._largeValues.size()),t=Math.max(this._smallValues.size(),this._largeValues.size());t>10*e&&this._recreateHeaps()}},{key:"_recreateHeaps",value:function(){for(var e=this._smallValues.size()t.value}}]),e}();e.exports=a},function(e,t){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){return e0&&(this._items[0]=t,this._sinkDown(0)),e}}},{key:"push",value:function(e){this._items[this._size++]=e,this._bubbleUp(this._size-1)}},{key:"size",value:function(){return this._size}},{key:"peek",value:function(){if(0!==this._size)return this._items[0]}},{key:"_heapify",value:function(){for(var e=Math.floor((this._size+1)/2);e>=0;e--)this._sinkDown(e)}},{key:"_bubbleUp",value:function(e){for(var t=this._items[e];e>0;){var o=Math.floor((e+1)/2)-1,n=this._items[o];if(this._comparator(n,t))return;this._items[o]=t,this._items[e]=n,e=o}}},{key:"_sinkDown",value:function(e){for(var t=this._items[e];;){var o=2*(e+1)-1,n=2*(e+1),r=-1;if(oo?o:e}e.exports=o},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=Object.assign||function(e){for(var t=1;t0){var o=h({"fixedDataTableRowLayout/fixedColumnsDivider":!0,"fixedDataTableRowLayout/columnsShadow":e.props.scrollLeft>0,"public/fixedDataTableRow/fixedColumnsDivider":!0,"public/fixedDataTableRow/columnsShadow":e.props.scrollLeft>0}),n={left:t,height:e.props.height};return u.createElement("div",{className:o,style:n})}},this._onClick=function(t){e.props.onClick(t,e.props.index)},this._onDoubleClick=function(t){e.props.onDoubleClick(t,e.props.index)},this._onMouseDown=function(t){e.props.onMouseDown(t,e.props.index)},this._onMouseEnter=function(t){e.props.onMouseEnter(t,e.props.index)},this._onMouseLeave=function(t){e.props.onMouseLeave(t,e.props.index)}}return r(t,e),s(t,[{key:"render",value:function(){var e={width:this.props.width,height:this.props.height},t=h({"fixedDataTableRowLayout/main":!0,"public/fixedDataTableRow/main":!0,"public/fixedDataTableRow/highlighted":this.props.index%2===1,"public/fixedDataTableRow/odd":this.props.index%2===1,"public/fixedDataTableRow/even":this.props.index%2===0}),o=this._getColumnsWidth(this.props.fixedColumns),n=u.createElement(c,{key:"fixed_cells",isScrolling:this.props.isScrolling,height:this.props.height,left:0,width:o,zIndex:2,columns:this.props.fixedColumns,onColumnResize:this.props.onColumnResize,isHoveringResizerKnob:this.props.isHoveringResizerKnob,setHoverState:this.props.setHoverState,rowHeight:this.props.height,rowIndex:this.props.index}),r=this._renderColumnsShadow(o),i=u.createElement(c,{key:"scrollable_cells",isScrolling:this.props.isScrolling,height:this.props.height,left:this.props.scrollLeft,offsetLeft:o,width:this.props.width-o,zIndex:0,columns:this.props.scrollableColumns,onColumnResize:this.props.onColumnResize,rowHeight:this.props.height,rowIndex:this.props.index});return u.createElement("div",{className:f(t,this.props.className),onClick:this.props.onClick?this._onClick:null,onDoubleClick:this.props.onDoubleClick?this._onDoubleClick:null,onMouseDown:this.props.onMouseDown?this._onMouseDown:null,onMouseEnter:this.props.onMouseEnter?this._onMouseEnter:null,onMouseLeave:this.props.onMouseLeave?this._onMouseLeave:null,style:e},u.createElement("div",{className:h("fixedDataTableRowLayout/body")},n,i,r))}}],[{key:"propTypes",value:{isScrolling:l.bool,fixedColumns:l.array.isRequired,height:l.number.isRequired,index:l.number.isRequired,scrollableColumns:l.array.isRequired,scrollLeft:l.number.isRequired,width:l.number.isRequired,onClick:l.func,onDoubleClick:l.func,onColumnResize:l.func},enumerable:!0}]),t}(u.Component),m=function(e){function t(){n(this,t),a(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return r(t,e),s(t,[{key:"render",value:function(){var e={width:this.props.width,height:this.props.height,zIndex:this.props.zIndex?this.props.zIndex:0};return p(e,0,this.props.offsetTop),u.createElement("div",{style:e,className:h("fixedDataTableRowLayout/rowWrapper")},u.createElement(d,i({},this.props,{offsetTop:void 0,zIndex:void 0})))}}],[{key:"propTypes",value:{isScrolling:l.bool,height:l.number.isRequired,zIndex:l.number,offsetTop:l.number.isRequired,width:l.number.isRequired},enumerable:!0}]),t}(u.Component);e.exports=m},function(e,t,o){"use strict";function n(e,t){var o={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}var r=Object.assign||function(e){for(var t=1;t=0){var l="cell_"+r;o[r]=this._renderCell(e.rowIndex,e.rowHeight,s,n,l)}n+=s.width}var u=this._getColumnsWidth(t),p={height:e.height,position:"absolute",width:u,zIndex:e.zIndex};return h(p,-1*f*e.left,0),a.createElement("div",{className:c("fixedDataTableCellGroupLayout/cellGroup"),style:p},o)},_renderCell:function(e,t,o,n,r){var i=o.isResizable&&this.props.onColumnResize,s=i?this.props.onColumnResize:null,l=o.cellClassName;return a.createElement(u,{isScrolling:this.props.isScrolling,align:o.align,className:l,height:t,key:r,maxWidth:o.maxWidth,minWidth:o.minWidth,onColumnResize:s,isHoveringResizerKnob:this.props.isHoveringResizerKnob,setHoverState:this.props.setHoverState,rowIndex:e,columnKey:o.columnKey,width:o.width,left:n,cell:o.cell})},_getColumnsWidth:function(e){for(var t=0,o=0;o=0||Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}var r=o(78),i=o(73),s=o(27),a=o(34),l=o(37),u=o(60),c=o(79),h=i.DIR_SIGN,f={align:"left",highlighted:!1},p=l({displayName:"FixedDataTableCell",propTypes_DISABLED_FOR_PERFORMANCE:{isScrolling:s.bool,align:s.oneOf(["left","center","right"]),className:s.string,highlighted:s.bool,width:s.number.isRequired,minWidth:s.number,maxWidth:s.number,height:s.number.isRequired,cell:s.oneOfType([s.string,s.element,s.func]),columnKey:s.oneOfType([s.string,s.number]),rowIndex:s.number.isRequired,onColumnResize:s.func,left:s.number},shouldComponentUpdate:function(e){return!e.isScrolling||this.props.rowIndex!==e.rowIndex},getDefaultProps:function(){return f},render:function(){var e=this.props,t=e.height,o=e.width,i=e.columnKey,s=n(e,["height","width","columnKey"]),l={height:t,width:o};1===h?l.left=s.left:l.right=s.left;var f,p=c(u({"fixedDataTableCellLayout/main":!0,"fixedDataTableCellLayout/lastChild":s.lastChild,"fixedDataTableCellLayout/alignRight":"right"===s.align,"fixedDataTableCellLayout/alignCenter":"center"===s.align,"public/fixedDataTableCell/alignRight":"right"===s.align,"public/fixedDataTableCell/highlighted":s.highlighted,"public/fixedDataTableCell/main":!0}),s.className);if(s.onColumnResize){var d={height:t,opacity:s.isHoveringResizerKnob?1:0};f=a.createElement("div",{className:u("fixedDataTableCellLayout/columnResizerContainer"),style:d,onMouseDown:this._onColumnResizerMouseDown,onMouseEnter:function(){return s.setHoverState(!0)},onMouseLeave:function(){return s.setHoverState(!1)}},a.createElement("div",{className:c(u("fixedDataTableCellLayout/columnResizerKnob"),u("public/fixedDataTableCell/columnResizerKnob")),style:d}))}var m={columnKey:i,height:t,width:o};s.rowIndex>=0&&(m.rowIndex=s.rowIndex);var v;return a.isValidElement(s.cell)?("div"===s.cell.type&&delete m.columnKey,v=a.cloneElement(s.cell,m)):v="function"==typeof s.cell?s.cell(m):a.createElement(r,m,s.cell),a.createElement("div",{className:p,style:l},f,v)},_onColumnResizerMouseDown:function(e){this.props.onColumnResize(this.props.left,this.props.width,this.props.minWidth,this.props.maxWidth,this.props.columnKey,e)}});e.exports=p},function(e,t,o){"use strict";function n(e,t){var o={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=Object.assign||function(e){for(var t=1;t1)for(var n=1;n=0&&t>=e-a;){var o=this._updateRowHeight(t);this._position+=o,t--}}},{key:"_updateRowHeight",value:function(e){if(e<0||e>=this._rowCount)return 0;var t=this._rowHeightGetter(e);if(t!==this._storedHeights[e]){var o=t-this._storedHeights[e];return this._rowOffsets.set(e,t),this._storedHeights[e]=t,this._contentHeight+=o,o}return 0}},{key:"getRowPosition",value:function(e){return this._updateRowHeight(e),this._rowOffsets.sumUntil(e)}},{key:"scrollBy",value:function(e){if(0===this._rowCount)return l;var t=this._rowOffsets.greatestLowerBound(this._position);t=s(t,0,Math.max(this._rowCount-1,0));var o=this._rowOffsets.sumUntil(t),n=t,r=this._position,i=this._updateRowHeight(n);0!==o&&(r+=i);var a=this._storedHeights[n]-(r-o);if(e>=0)for(;e>0&&n0&&n>=0;)if(e=0){var c=this._updateRowHeight(n);u=this._storedHeights[n],r+=c}}var h=this._contentHeight-this._viewportHeight;r=s(r,0,h),this._position=r;var f=this._rowOffsets.greatestLowerBound(r);f=s(f,0,Math.max(this._rowCount-1,0)),o=this._rowOffsets.sumUntil(f);var p=o-r;return this._updateHeightsInViewport(f,p),this._updateHeightsAboveViewport(f),{index:f,offset:p,position:this._position,contentHeight:this._contentHeight}}},{key:"_getRowAtEndPosition",value:function(e){this._updateRowHeight(e);for(var t=e,o=this._storedHeights[t];o=0;)t--,t>=0&&(this._updateRowHeight(t),o+=this._storedHeights[t]);var n=this._rowOffsets.sumTo(e)-this._viewportHeight;return n<0&&(n=0),n}},{key:"scrollTo",value:function(e){if(0===this._rowCount)return l;if(e<=0)return this._position=0,this._updateHeightsInViewport(0,0),{index:0,offset:0,position:this._position,contentHeight:this._contentHeight};if(e>=this._contentHeight-this._viewportHeight){var t=this._rowCount-1;e=this._getRowAtEndPosition(t)}this._position=e;var o=this._rowOffsets.greatestLowerBound(e);o=s(o,0,Math.max(this._rowCount-1,0));var n=this._rowOffsets.sumUntil(o),r=n-e;return this._updateHeightsInViewport(o,r),this._updateHeightsAboveViewport(o),{index:o,offset:r,position:this._position,contentHeight:this._contentHeight}}},{key:"scrollToRow",value:function(e,t){e=s(e,0,Math.max(this._rowCount-1,0)),t=s(t,-this._storedHeights[e],0);var o=this._rowOffsets.sumUntil(e);return this.scrollTo(o-t)}},{key:"scrollRowIntoView",value:function(e){e=s(e,0,Math.max(this._rowCount-1,0));var t=this._rowOffsets.sumUntil(e),o=t+this._storedHeights[e];if(t=0;--o)t[o]=0;return t},u=function(){function e(t){n(this,e),this._size=t.length,this._half=r(this._size),this._heap=new l(2*this._half);var o;for(o=0;o0;--o)this._heap[o]=this._heap[2*o]+this._heap[2*o+1]}return i(e,[{key:"set",value:function(e,t){s(0<=e&&e=0;--r)n[r]=o;return new e(n)}},{key:"empty",value:function(t){return e.uniform(t,0)}}]),e}();e.exports=u}).call(t,function(){return this}())},function(e,t,o){"use strict";function n(e){for(var t=0,o=0;o=t||o<0||S&&n>=g}function c(){var e=C();return u(e)?h(e):void(y=setTimeout(c,s(e)))}function h(e){return y=void 0,T&&m?n(e):(m=v=void 0,_)}function f(){void 0!==y&&clearTimeout(y),R=0,m=w=v=y=void 0}function p(){return void 0===y?_:h(C())}function d(){var e=C(),o=u(e);if(m=arguments,v=this,w=e,o){if(void 0===y)return i(w);if(S)return y=setTimeout(c,t),n(w)}return void 0===y&&(y=setTimeout(c,t)),_}var m,v,g,_,y,w,R=0,E=!1,S=!1,T=!0;if("function"!=typeof e)throw new TypeError(l);return t=a(t)||0,r(o)&&(E=!!o.leading,S="maxWait"in o,g=S?b(a(o.maxWait)||0,t):g,T="trailing"in o?!!o.trailing:T),d.cancel=f,d.flush=p,d}function n(e,t,n){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(l);return r(n)&&(i="leading"in n?!!n.leading:i,s="trailing"in n?!!n.trailing:s),o(e,t,{leading:i,maxWait:t,trailing:s})}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function s(e){return"symbol"==typeof e||i(e)&&w.call(e)==c}function a(e){if("number"==typeof e)return e;if(s(e))return u;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(h,"");var o=p.test(e);return o||d.test(e)?m(e.slice(2),o?2:8):f.test(e)?u:+e}var l="Expected a function",u=NaN,c="[object Symbol]",h=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,d=/^0o[0-7]+$/i,m=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,_=v||g||Function("return this")(),y=Object.prototype,w=y.toString,b=Math.max,x=Math.min,C=function(){return _.Date.now()};e.exports=n}).call(t,function(){return this}())},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{ +constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(){function e(e,t){for(var o=0;o=0.13.0 <0.15.0 || ^0.14.0-beta3", - "react-dom": ">=0.14.0 <0.15.0 || ^0.14.0-beta3" + "react": "^15.0.0", + "react-dom": "^15.0.0" }, "devDependencies": { "autoprefixer": "^5.0.0", @@ -24,9 +24,9 @@ "null-loader": "^0.1.0", "postcss": "^4.0.2", "postcss-custom-properties": "3.0.1", - "react": "^0.14.0", - "react-docgen": "^1.2.0", - "react-tools": "^0.12.2", + "react": "^15.0.0", + "react-docgen": "2.8.x", + "react-tools": "0.13.x", "style-loader": "^0.8.3", "url-loader": "^0.5.5", "webpack": "^1.8.3", @@ -38,6 +38,7 @@ "build-dist": "./build_helpers/buildDist.sh", "build-npm": "./build_helpers/buildNPMInternals.sh", "build-docs": "./build_helpers/buildAPIDocs.sh", + "build-move": "npm run build-npm && ./build_helpers/buildMove.sh", "publish-site": "./build_helpers/publishStaticSite.sh", "publish-package": "./build_helpers/publishPackage.sh", "test": "echo \"Error: no test specified\" && exit 1" @@ -61,5 +62,8 @@ "table", "data-table", "fixed-table" - ] + ], + "dependencies": { + "lodash.throttle": "^4.1.1" + } } diff --git a/src/FixedDataTableBufferedRows.react.js b/src/FixedDataTableBufferedRows.react.js index 032bcbe6..c40a31e6 100644 --- a/src/FixedDataTableBufferedRows.react.js +++ b/src/FixedDataTableBufferedRows.react.js @@ -1,3 +1,4 @@ +var PropTypes = require('prop-types'); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -11,6 +12,7 @@ */ var React = require('React'); +var createReactClass = require('create-react-class'); var FixedDataTableRowBuffer = require('FixedDataTableRowBuffer'); var FixedDataTableRow = require('FixedDataTableRow.react'); @@ -19,9 +21,8 @@ var emptyFunction = require('emptyFunction'); var joinClasses = require('joinClasses'); var translateDOMPositionXY = require('translateDOMPositionXY'); -var {PropTypes} = React; - -var FixedDataTableBufferedRows = React.createClass({ +var FixedDataTableBufferedRows = createReactClass({ + displayName: "FixedDataTableBufferedRows", propTypes: { isScrolling: PropTypes.bool, @@ -68,6 +69,7 @@ var FixedDataTableBufferedRows = React.createClass({ componentDidMount() { setTimeout(this._updateBuffer, 1000); + this._isMounted = true; }, componentWillReceiveProps(/*object*/ nextProps) { @@ -95,7 +97,7 @@ var FixedDataTableBufferedRows = React.createClass({ }, _updateBuffer() { - if (this.isMounted()) { + if (this._isMounted) { this.setState({ rowsToRender: this._rowBuffer.getRowsWithUpdatedBuffer(), }); @@ -109,6 +111,7 @@ var FixedDataTableBufferedRows = React.createClass({ componentWillUnmount() { this._staticRowArray.length = 0; + this._isMounted = false; }, render() /*object*/ { @@ -151,6 +154,10 @@ var FixedDataTableBufferedRows = React.createClass({ 'public/fixedDataTable/hasBottomBorder': hasBottomBorder, }) )} + onColumnResize={props.onColumnResize} + isHoveringResizerKnob={props.isHoveringResizerKnob} + setHoverState={props.setHoverState} + isColumnResizing={props.isColumnResizing} />; } @@ -174,7 +181,7 @@ var FixedDataTableBufferedRows = React.createClass({ return this.props.rowHeightGetter ? this.props.rowHeightGetter(index) : this.props.defaultRowHeight; - }, + } }); module.exports = FixedDataTableBufferedRows; diff --git a/src/FixedDataTableCell.react.js b/src/FixedDataTableCell.react.js index 8c2e83ba..09e77e6f 100644 --- a/src/FixedDataTableCell.react.js +++ b/src/FixedDataTableCell.react.js @@ -12,20 +12,21 @@ var FixedDataTableCellDefault = require('FixedDataTableCellDefault.react'); var FixedDataTableHelper = require('FixedDataTableHelper'); +var PropTypes = require('prop-types'); var React = require('React'); +var createReactClass = require('create-react-class'); var cx = require('cx'); var joinClasses = require('joinClasses'); var DIR_SIGN = FixedDataTableHelper.DIR_SIGN; -var {PropTypes} = React; - var DEFAULT_PROPS = { align: 'left', highlighted: false, }; -var FixedDataTableCell = React.createClass({ +var FixedDataTableCell = createReactClass({ + displayName: "FixedDataTableCell", /** * PropTypes are disabled in this component, because having them on slows @@ -120,13 +121,17 @@ var FixedDataTableCell = React.createClass({ var columnResizerComponent; if (props.onColumnResize) { var columnResizerStyle = { - height + height, + opacity: props.isHoveringResizerKnob ? 1 : 0, }; + columnResizerComponent = (
+ onMouseDown={this._onColumnResizerMouseDown} + onMouseEnter={() => props.setHoverState(true)} + onMouseLeave={() => props.setHoverState(false)}>
); - }, -}); + } +} module.exports = FixedDataTableCellDefault; diff --git a/src/FixedDataTableCellGroup.react.js b/src/FixedDataTableCellGroup.react.js index 81d80d7b..3d901cbb 100644 --- a/src/FixedDataTableCellGroup.react.js +++ b/src/FixedDataTableCellGroup.react.js @@ -13,17 +13,18 @@ 'use strict'; var FixedDataTableHelper = require('FixedDataTableHelper'); +var PropTypes = require('prop-types'); var React = require('React'); +var createReactClass = require('create-react-class'); var FixedDataTableCell = require('FixedDataTableCell.react'); var cx = require('cx'); var translateDOMPositionXY = require('translateDOMPositionXY'); -var {PropTypes} = React; - var DIR_SIGN = FixedDataTableHelper.DIR_SIGN; -var FixedDataTableCellGroupImpl = React.createClass({ +var FixedDataTableCellGroupImpl = createReactClass({ + displayName: "FixedDataTableCellGroupImpl", /** * PropTypes are disabled in this component, because having them on slows @@ -118,6 +119,8 @@ var FixedDataTableCellGroupImpl = React.createClass({ maxWidth={columnProps.maxWidth} minWidth={columnProps.minWidth} onColumnResize={onColumnResize} + isHoveringResizerKnob={this.props.isHoveringResizerKnob} + setHoverState={this.props.setHoverState} rowIndex={rowIndex} columnKey={columnProps.columnKey} width={columnProps.width} @@ -133,10 +136,11 @@ var FixedDataTableCellGroupImpl = React.createClass({ width += columns[i].props.width; } return width; - }, + } }); -var FixedDataTableCellGroup = React.createClass({ +var FixedDataTableCellGroup = createReactClass({ + displayName: "FixedDataTableCellGroup", /** * PropTypes are disabled in this component, because having them on slows @@ -218,7 +222,7 @@ var FixedDataTableCellGroup = React.createClass({ columnKey, event ); - }, + } }); diff --git a/src/FixedDataTableColumnGroupNew.react.js b/src/FixedDataTableColumnGroupNew.react.js index 99dcb626..11a9af2d 100644 --- a/src/FixedDataTableColumnGroupNew.react.js +++ b/src/FixedDataTableColumnGroupNew.react.js @@ -1,3 +1,4 @@ +var PropTypes = require('prop-types'); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -12,17 +13,13 @@ var React = require('React'); -var {PropTypes} = React; - /** * Component that defines the attributes of a table column group. */ -var FixedDataTableColumnGroup = React.createClass({ - statics: { - __TableColumnGroup__: true, - }, +class FixedDataTableColumnGroup extends React.Component { + static __TableColumnGroup__ = true; - propTypes: { + static propTypes = { /** * The horizontal alignment of the table cell content. */ @@ -57,13 +54,11 @@ var FixedDataTableColumnGroup = React.createClass({ PropTypes.func, ]), - }, + }; - getDefaultProps() /*object*/ { - return { - fixed: false, - }; - }, + static defaultProps = { + fixed: false, + }; render() { if (__DEV__) { @@ -72,7 +67,7 @@ var FixedDataTableColumnGroup = React.createClass({ ); } return null; - }, -}); + } +} module.exports = FixedDataTableColumnGroup; diff --git a/src/FixedDataTableColumnNew.react.js b/src/FixedDataTableColumnNew.react.js index 91b0571f..b387e89f 100644 --- a/src/FixedDataTableColumnNew.react.js +++ b/src/FixedDataTableColumnNew.react.js @@ -1,3 +1,4 @@ +var PropTypes = require('prop-types'); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -12,178 +13,172 @@ var React = require('React'); -var {PropTypes} = React; - /** * Component that defines the attributes of table column. */ -var FixedDataTableColumn = React.createClass({ - statics: { - __TableColumn__: true - }, - - propTypes: { - /** - * The horizontal alignment of the table cell content. - */ - align: PropTypes.oneOf(['left', 'center', 'right']), - - /** - * Controls if the column is fixed when scrolling in the X axis. - */ - fixed: PropTypes.bool, - - /** - * The header cell for this column. - * This can either be a string a React element, or a function that generates - * a React Element. Passing in a string will render a default header cell - * with that string. By default, the React element passed in can expect to - * receive the following props: - * - * ``` - * props: { - * columnKey: string // (of the column, if given) - * height: number // (supplied from the Table or rowHeightGetter) - * width: number // (supplied from the Column) - * } - * ``` - * - * Because you are passing in your own React element, you can feel free to - * pass in whatever props you may want or need. - * - * If you pass in a function, you will receive the same props object as the - * first argument. - */ - header: PropTypes.oneOfType([ - PropTypes.node, - PropTypes.func, - ]), - - /** - * This is the body cell that will be cloned for this column. - * This can either be a string a React element, or a function that generates - * a React Element. Passing in a string will render a default header cell - * with that string. By default, the React element passed in can expect to - * receive the following props: - * - * ``` - * props: { - * rowIndex; number // (the row index of the cell) - * columnKey: string // (of the column, if given) - * height: number // (supplied from the Table or rowHeightGetter) - * width: number // (supplied from the Column) - * } - * ``` - * - * Because you are passing in your own React element, you can feel free to - * pass in whatever props you may want or need. - * - * If you pass in a function, you will receive the same props object as the - * first argument. - */ - cell: PropTypes.oneOfType([ - PropTypes.node, - PropTypes.func, - ]), - - /** - * This is the footer cell for this column. - * This can either be a string a React element, or a function that generates - * a React Element. Passing in a string will render a default header cell - * with that string. By default, the React element passed in can expect to - * receive the following props: - * - * ``` - * props: { - * columnKey: string // (of the column, if given) - * height: number // (supplied from the Table or rowHeightGetter) - * width: number // (supplied from the Column) - * } - * ``` - * - * Because you are passing in your own React element, you can feel free to - * pass in whatever props you may want or need. - * - * If you pass in a function, you will receive the same props object as the - * first argument. - */ - footer: PropTypes.oneOfType([ - PropTypes.node, - PropTypes.func, - ]), - - /** - * This is used to uniquely identify the column, and is not required unless - * you a resizing columns. This will be the key given in the - * `onColumnResizeEndCallback` on the Table. - */ - columnKey: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - ]), - - /** - * The pixel width of the column. - */ - width: PropTypes.number.isRequired, - - /** - * If this is a resizable column this is its minimum pixel width. - */ - minWidth: PropTypes.number, - - /** - * If this is a resizable column this is its maximum pixel width. - */ - maxWidth: PropTypes.number, - - /** - * The grow factor relative to other columns. Same as the flex-grow API - * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available - * extra width and distribute it proportionally according to all columns' - * flexGrow values. Defaults to zero (no-flexing). - */ - flexGrow: PropTypes.number, - - /** - * Whether the column can be resized with the - * FixedDataTableColumnResizeHandle. Please note that if a column - * has a flex grow, once you resize the column this will be set to 0. - * - * This property only provides the UI for the column resizing. If this - * is set to true, you will need to set the onColumnResizeEndCallback table - * property and render your columns appropriately. - */ - isResizable: PropTypes.bool, - - /** - * Whether cells in this column can be removed from document when outside - * of viewport as a result of horizontal scrolling. - * Setting this property to true allows the table to not render cells in - * particular column that are outside of viewport for visible rows. This - * allows to create table with many columns and not have vertical scrolling - * performance drop. - * Setting the property to false will keep previous behaviour and keep - * cell rendered if the row it belongs to is visible. - */ - allowCellsRecycling: PropTypes.bool, - }, - - getDefaultProps() /*object*/ { - return { - allowCellsRecycling: false, - fixed: false, - }; - }, - - render() { - if (__DEV__) { - throw new Error( - 'Component should never render' - ); - } - return null; - }, -}); +class FixedDataTableColumn extends React.Component { + static __TableColumn__ = true; + + static propTypes = { + /** + * The horizontal alignment of the table cell content. + */ + align: PropTypes.oneOf(['left', 'center', 'right']), + + /** + * Controls if the column is fixed when scrolling in the X axis. + */ + fixed: PropTypes.bool, + + /** + * The header cell for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + header: PropTypes.oneOfType([ + PropTypes.node, + PropTypes.func, + ]), + + /** + * This is the body cell that will be cloned for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * rowIndex; number // (the row index of the cell) + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + cell: PropTypes.oneOfType([ + PropTypes.node, + PropTypes.func, + ]), + + /** + * This is the footer cell for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + footer: PropTypes.oneOfType([ + PropTypes.node, + PropTypes.func, + ]), + + /** + * This is used to uniquely identify the column, and is not required unless + * you a resizing columns. This will be the key given in the + * `onColumnResizeEndCallback` on the Table. + */ + columnKey: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + ]), + + /** + * The pixel width of the column. + */ + width: PropTypes.number.isRequired, + + /** + * If this is a resizable column this is its minimum pixel width. + */ + minWidth: PropTypes.number, + + /** + * If this is a resizable column this is its maximum pixel width. + */ + maxWidth: PropTypes.number, + + /** + * The grow factor relative to other columns. Same as the flex-grow API + * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available + * extra width and distribute it proportionally according to all columns' + * flexGrow values. Defaults to zero (no-flexing). + */ + flexGrow: PropTypes.number, + + /** + * Whether the column can be resized with the + * FixedDataTableColumnResizeHandle. Please note that if a column + * has a flex grow, once you resize the column this will be set to 0. + * + * This property only provides the UI for the column resizing. If this + * is set to true, you will need to set the onColumnResizeEndCallback table + * property and render your columns appropriately. + */ + isResizable: PropTypes.bool, + + /** + * Whether cells in this column can be removed from document when outside + * of viewport as a result of horizontal scrolling. + * Setting this property to true allows the table to not render cells in + * particular column that are outside of viewport for visible rows. This + * allows to create table with many columns and not have vertical scrolling + * performance drop. + * Setting the property to false will keep previous behaviour and keep + * cell rendered if the row it belongs to is visible. + */ + allowCellsRecycling: PropTypes.bool, + }; + + static defaultProps = { + allowCellsRecycling: false, + fixed: false, + }; + + render() { + if (__DEV__) { + throw new Error( + 'Component should never render' + ); + } + return null; + } +} module.exports = FixedDataTableColumn; diff --git a/src/FixedDataTableColumnResizeHandle.react.js b/src/FixedDataTableColumnResizeHandle.react.js index e1751bd6..f5eac5be 100644 --- a/src/FixedDataTableColumnResizeHandle.react.js +++ b/src/FixedDataTableColumnResizeHandle.react.js @@ -16,15 +16,16 @@ var DOMMouseMoveTracker = require('DOMMouseMoveTracker'); var Locale = require('Locale'); +var PropTypes = require('prop-types'); var React = require('React'); +var createReactClass = require('create-react-class'); var ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin'); var clamp = require('clamp'); var cx = require('cx'); -var {PropTypes} = React; - -var FixedDataTableColumnResizeHandle = React.createClass({ +var FixedDataTableColumnResizeHandle = createReactClass({ + displayName: "FixedDataTableColumnResizeHandle", mixins: [ReactComponentWithPureRenderMixin], propTypes: { @@ -161,7 +162,7 @@ var FixedDataTableColumnResizeHandle = React.createClass({ this.state.width, this.props.columnKey ); - }, + } }); module.exports = FixedDataTableColumnResizeHandle; diff --git a/src/FixedDataTableNew.react.js b/src/FixedDataTableNew.react.js index f9e2bd9a..f5f1b11b 100644 --- a/src/FixedDataTableNew.react.js +++ b/src/FixedDataTableNew.react.js @@ -1,3 +1,4 @@ +var PropTypes = require("prop-types"); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -13,32 +14,33 @@ /*eslint no-bitwise:1*/ -var React = require('React'); -var ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin'); -var ReactWheelHandler = require('ReactWheelHandler'); -var Scrollbar = require('Scrollbar.react'); -var FixedDataTableBufferedRows = require('FixedDataTableBufferedRows.react'); -var FixedDataTableColumnResizeHandle = require('FixedDataTableColumnResizeHandle.react'); -var FixedDataTableRow = require('FixedDataTableRow.react'); -var FixedDataTableScrollHelper = require('FixedDataTableScrollHelper'); -var FixedDataTableWidthHelper = require('FixedDataTableWidthHelper'); - -var cx = require('cx'); -var debounceCore = require('debounceCore'); -var emptyFunction = require('emptyFunction'); -var invariant = require('invariant'); -var joinClasses = require('joinClasses'); -var shallowEqual = require('shallowEqual'); -var translateDOMPositionXY = require('translateDOMPositionXY'); - -var {PropTypes} = React; +var React = require("React"); +var createReactClass = require("create-react-class"); +var ReactComponentWithPureRenderMixin = require("ReactComponentWithPureRenderMixin"); +var ReactWheelHandler = require("ReactWheelHandler"); +var Scrollbar = require("Scrollbar.react"); +var FixedDataTableBufferedRows = require("FixedDataTableBufferedRows.react"); +var FixedDataTableColumnResizeHandle = require("FixedDataTableColumnResizeHandle.react"); +var FixedDataTableRow = require("FixedDataTableRow.react"); +var FixedDataTableScrollHelper = require("FixedDataTableScrollHelper"); +var FixedDataTableWidthHelper = require("FixedDataTableWidthHelper"); + +var cx = require("cx"); +var debounceCore = require("debounceCore"); +var emptyFunction = require("emptyFunction"); +var invariant = require("invariant"); +var joinClasses = require("joinClasses"); +var shallowEqual = require("shallowEqual"); +var translateDOMPositionXY = require("translateDOMPositionXY"); +var throttle = require("lodash.throttle"); + var ReactChildren = React.Children; var EMPTY_OBJECT = {}; var BORDER_HEIGHT = 1; -var HEADER = 'header'; -var FOOTER = 'footer'; -var CELL = 'cell'; +var HEADER = "header"; +var FOOTER = "footer"; +var CELL = "cell"; /** * Data grid component with fixed or scrollable header and columns. @@ -86,10 +88,10 @@ var CELL = 'cell'; * - Scrollable Body Columns: The body columns that move while scrolling * vertically or horizontally. */ -var FixedDataTable = React.createClass({ +var FixedDataTable = createReactClass({ + displayName: "FixedDataTable", propTypes: { - /** * Pixel width of table. If all columns do not fit, * a horizontal scrollbar will appear. @@ -127,8 +129,8 @@ var FixedDataTable = React.createClass({ */ ownerHeight: PropTypes.number, - overflowX: PropTypes.oneOf(['hidden', 'auto']), - overflowY: PropTypes.oneOf(['hidden', 'auto']), + overflowX: PropTypes.oneOf(["hidden", "auto"]), + overflowY: PropTypes.oneOf(["hidden", "auto"]), /** * Number of rows in the table. @@ -194,6 +196,17 @@ var FixedDataTable = React.createClass({ */ onScrollStart: PropTypes.func, + /** + * Callback that is called during scrolling with current horizontal + * and vertical scroll values. + */ + onScroll: PropTypes.func, + + /** + * Number of milliseconds to throttle the onScroll event + */ + onScrollThrottle: PropTypes.number, + /** * Callback that is called when scrolling ends or stops with new horizontal * and vertical scroll values. @@ -251,6 +264,17 @@ var FixedDataTable = React.createClass({ * Whether a column is currently being resized. */ isColumnResizing: PropTypes.bool, + + /** + * CSS style props to pass to the box shadow that shows up on the fixed + * header while scrolling + */ + topShadowStyle: PropTypes.object, + + /** + * CSS style props to pass to the horizontal scrollbar + */ + horizontalScrollbarStyle: PropTypes.object }, getDefaultProps() /*object*/ { @@ -260,6 +284,8 @@ var FixedDataTable = React.createClass({ headerHeight: 0, scrollLeft: 0, scrollTop: 0, + topShadowStyle: {}, + horizontalScrollbarStyle: {} }; }, @@ -281,7 +307,10 @@ var FixedDataTable = React.createClass({ } this._didScrollStop = debounceCore(this._didScrollStop, 200, this); - return this._calculateState(this.props); + return { + ...this._calculateState(this.props), + isHoveringResizerKnob: false, + }; }, componentWillMount() { @@ -298,10 +327,14 @@ var FixedDataTable = React.createClass({ this._shouldHandleWheelX, this._shouldHandleWheelY ); + this._didScroll = throttle( + this._didScroll, + this.props.onScrollThrottle || 0 + ); }, _shouldHandleWheelX(/*number*/ delta) /*boolean*/ { - if (this.props.overflowX === 'hidden') { + if (this.props.overflowX === "hidden") { return false; } @@ -317,7 +350,7 @@ var FixedDataTable = React.createClass({ }, _shouldHandleWheelY(/*number*/ delta) /*boolean*/ { - if (this.props.overflowY === 'hidden'|| delta === 0) { + if (this.props.overflowY === "hidden" || delta === 0) { return false; } @@ -345,8 +378,10 @@ var FixedDataTable = React.createClass({ } else { contentHeight = this.state.height + this.state.maxScrollY; } - if (contentHeight !== this._contentHeight && - this.props.onContentHeightChange) { + if ( + contentHeight !== this._contentHeight && + this.props.onContentHeightChange + ) { this.props.onContentHeightChange(contentHeight); } this._contentHeight = contentHeight; @@ -354,6 +389,7 @@ var FixedDataTable = React.createClass({ componentDidMount() { this._reportContentHeight(); + this._isMounted = true; }, componentWillReceiveProps(/*object*/ nextProps) { @@ -368,20 +404,25 @@ var FixedDataTable = React.createClass({ var newOverflowX = nextProps.overflowX; var newOverflowY = nextProps.overflowY; - if (newOverflowX !== this.props.overflowX || - newOverflowY !== this.props.overflowY) { + if ( + newOverflowX !== this.props.overflowX || + newOverflowY !== this.props.overflowY + ) { this._wheelHandler = new ReactWheelHandler( this._onWheel, - newOverflowX !== 'hidden', // Should handle horizontal scroll - newOverflowY !== 'hidden' // Should handle vertical scroll + newOverflowX !== "hidden", // Should handle horizontal scroll + newOverflowY !== "hidden" // Should handle vertical scroll ); } // In the case of controlled scrolling, notify. - if (this.props.ownerHeight !== nextProps.ownerHeight || - this.props.scrollTop !== nextProps.scrollTop) { + if ( + this.props.ownerHeight !== nextProps.ownerHeight || + this.props.scrollTop !== nextProps.scrollTop + ) { this._didScrollStart(); } + this._didScroll(); this._didScrollStop(); this.setState(this._calculateState(nextProps, this.state)); @@ -402,8 +443,8 @@ var FixedDataTable = React.createClass({ key="group_header" isScrolling={this._isScrolling} className={joinClasses( - cx('fixedDataTableLayout/header'), - cx('public/fixedDataTable/header'), + cx("fixedDataTableLayout/header"), + cx("public/fixedDataTable/header") )} width={state.width} height={state.groupHeaderHeight} @@ -414,24 +455,27 @@ var FixedDataTable = React.createClass({ fixedColumns={state.groupHeaderFixedColumns} scrollableColumns={state.groupHeaderScrollableColumns} onColumnResize={this._onColumnResize} + setHoverState={this.setHoverState} + isColumnResizing={state.isColumnResizing} /> ); } var maxScrollY = this.state.maxScrollY; - var showScrollbarX = state.maxScrollX > 0 && state.overflowX !== 'hidden'; - var showScrollbarY = maxScrollY > 0 && state.overflowY !== 'hidden'; + var showScrollbarX = state.maxScrollX > 0 && state.overflowX !== "hidden"; + var showScrollbarY = maxScrollY > 0 && state.overflowY !== "hidden"; var scrollbarXHeight = showScrollbarX ? Scrollbar.SIZE : 0; - var scrollbarYHeight = state.height - scrollbarXHeight - - (2 * BORDER_HEIGHT) - state.footerHeight; + var scrollbarYHeight = + state.height - scrollbarXHeight - 2 * BORDER_HEIGHT - state.footerHeight; var headerOffsetTop = state.useGroupHeader ? state.groupHeaderHeight : 0; var bodyOffsetTop = headerOffsetTop + state.headerHeight; scrollbarYHeight -= bodyOffsetTop; var bottomSectionOffset = 0; - var footOffsetTop = props.maxHeight != null - ? bodyOffsetTop + state.bodyHeight - : bodyOffsetTop + scrollbarYHeight; + var footOffsetTop = + props.maxHeight != null + ? bodyOffsetTop + state.bodyHeight + : bodyOffsetTop + scrollbarYHeight; var rowsContainerHeight = footOffsetTop + state.footerHeight; if (props.ownerHeight !== undefined && props.ownerHeight < state.height) { @@ -447,30 +491,33 @@ var FixedDataTable = React.createClass({ var verticalScrollbar; if (showScrollbarY) { - verticalScrollbar = + verticalScrollbar = ( ; + /> + ); } var horizontalScrollbar; if (showScrollbarX) { var scrollbarXWidth = state.width; - horizontalScrollbar = + horizontalScrollbar = ( ; + horizontalScrollbarStyle={props.horizontalScrollbarStyle} + /> + ); } - var dragKnob = + var dragKnob = ( ; + /> + ); var footer = null; if (state.footerHeight) { - footer = + footer = ( ; + /> + ); } var rows = this._renderRows(bodyOffsetTop); - var header = + var header = ( ; + isHoveringResizerKnob={state.isHoveringResizerKnob} + setHoverState={this.setHoverState} + isColumnResizing={state.isColumnResizing} + /> + ); var topShadow; var bottomShadow; if (state.scrollY) { - topShadow = + let topShadowStyle = {} + // Kinda hacky, but we'll use the header columns to apply this styling + // fix for a renegade border style. + if (props.useTopShadow) { + const sumOfColumnWidths = [...state.headFixedColumns, ...state.headScrollableColumns].reduce( + (acc, column) => acc + column.props.width, + 0 + ) + topShadowStyle = { + marginLeft: '3px', + width: sumOfColumnWidths + 'px', + maxWidth: 'calc(100% - 6px)', + } + } + topShadow = (
; + style={{ ...topShadowStyle, top: bodyOffsetTop }} + /> + ); } if ( @@ -545,27 +613,30 @@ var FixedDataTable = React.createClass({ state.scrollContentHeight + state.reservedHeight > state.ownerHeight) || state.scrollY < maxScrollY ) { - bottomShadow = + bottomShadow = (
; + style={{ top: footOffsetTop }} + /> + ); } return (
+ style={{ height: state.height, width: state.width, opacity: this.state.isColumnResizing ? .4 : 1 }} + >
+ className={cx("fixedDataTableLayout/rowsContainer")} + style={{ height: rowsContainerHeight, width: state.width }} + > {dragKnob} {groupHeader} {header} @@ -580,6 +651,10 @@ var FixedDataTable = React.createClass({ ); }, + componentWillUnmount() { + this._isMounted = false; + }, + _renderRows(/*number*/ offsetTop) /*object*/ { var state = this.state; @@ -606,6 +681,10 @@ var FixedDataTable = React.createClass({ showLastRowBorder={true} width={state.width} rowPositionGetter={this._scrollHelper.getRowPosition} + onColumnResize={this._onColumnResize} + isHoveringResizerKnob={state.isHoveringResizerKnob} + setHoverState={this.setHoverState} + isColumnResizing={state.isColumnResizing} /> ); }, @@ -641,18 +720,12 @@ var FixedDataTable = React.createClass({ }); }, - _areColumnSettingsIdentical( - oldColumns: Array, - newColumns: Array - ): boolean { + _areColumnSettingsIdentical(oldColumns: Array, newColumns: Array): boolean { if (oldColumns.length !== newColumns.length) { return false; } for (var index = 0; index < oldColumns.length; ++index) { - if (!shallowEqual( - oldColumns[index].props, - newColumns[index].props - )) { + if (!shallowEqual(oldColumns[index].props, newColumns[index].props)) { return false; } } @@ -668,12 +741,16 @@ var FixedDataTable = React.createClass({ var canReuseColumnGroupSettings = false; if (oldState && oldState.columns) { - canReuseColumnSettings = - this._areColumnSettingsIdentical(columns, oldState.columns); + canReuseColumnSettings = this._areColumnSettingsIdentical( + columns, + oldState.columns + ); } if (oldState && oldState.columnGroups && columnGroups) { - canReuseColumnGroupSettings = - this._areColumnSettingsIdentical(columnGroups, oldState.columnGroups); + canReuseColumnGroupSettings = this._areColumnSettingsIdentical( + columnGroups, + oldState.columnGroups + ); } var columnInfo = {}; @@ -723,7 +800,7 @@ var FixedDataTable = React.createClass({ _calculateState(/*object*/ props, /*?object*/ oldState) /*object*/ { invariant( props.height !== undefined || props.maxHeight !== undefined, - 'You must set either a height or a maxHeight' + "You must set either a height or a maxHeight" ); var children = []; @@ -732,10 +809,9 @@ var FixedDataTable = React.createClass({ return; } invariant( - child.type.__TableColumnGroup__ || - child.type.__TableColumn__, - 'child type should be or ' + - '' + child.type.__TableColumnGroup__ || child.type.__TableColumn__, + "child type should be or " + + "" ); children.push(child); }); @@ -745,15 +821,27 @@ var FixedDataTable = React.createClass({ useGroupHeader = true; } + if ( + oldState && + ((props.width !== undefined && props.width !== oldState.width) || + (props.height !== undefined && props.height !== oldState.height) || + (props.maxWidth !== undefined && + props.maxWidth !== oldState.maxWidth) || + (props.maxHeight !== undefined && + props.maxHeight !== oldState.maxHeight)) + ) { + oldState = null; + } + var firstRowIndex = (oldState && oldState.firstRowIndex) || 0; var firstRowOffset = (oldState && oldState.firstRowOffset) || 0; var scrollX, scrollY; - if (oldState && props.overflowX !== 'hidden') { + if (oldState && props.overflowX !== "hidden") { scrollX = oldState.scrollX; } else { scrollX = props.scrollLeft; } - if (oldState && props.overflowY !== 'hidden') { + if (oldState && props.overflowY !== "hidden") { scrollY = oldState.scrollY; } else { scrollState = this._scrollHelper.scrollTo(props.scrollTop); @@ -763,8 +851,7 @@ var FixedDataTable = React.createClass({ } if (this._rowToScrollTo !== undefined) { - scrollState = - this._scrollHelper.scrollRowIntoView(this._rowToScrollTo); + scrollState = this._scrollHelper.scrollRowIntoView(this._rowToScrollTo); firstRowIndex = scrollState.index; firstRowOffset = scrollState.offset; scrollY = scrollState.position; @@ -787,8 +874,10 @@ var FixedDataTable = React.createClass({ viewportHeight, props.rowHeightGetter ); - var scrollState = - this._scrollHelper.scrollToRow(firstRowIndex, firstRowOffset); + var scrollState = this._scrollHelper.scrollToRow( + firstRowIndex, + firstRowOffset + ); firstRowIndex = scrollState.index; firstRowOffset = scrollState.offset; scrollY = scrollState.position; @@ -807,10 +896,9 @@ var FixedDataTable = React.createClass({ var columnGroups; if (useGroupHeader) { - var columnGroupSettings = - FixedDataTableWidthHelper.adjustColumnGroupWidths( - children, - props.width + var columnGroupSettings = FixedDataTableWidthHelper.adjustColumnGroupWidths( + children, + props.width ); columns = columnGroupSettings.columns; columnGroups = columnGroupSettings.columnGroups; @@ -840,7 +928,7 @@ var FixedDataTable = React.createClass({ var scrollableColumnIndex = Math.min( this._columnToScrollTo - fixedColumnsCount, - columnInfo.bodyScrollableColumns.length - 1, + columnInfo.bodyScrollableColumns.length - 1 ); var previousColumnsWidth = 0; @@ -850,9 +938,8 @@ var FixedDataTable = React.createClass({ } var availableScrollWidth = props.width - totalFixedColumnsWidth; - var selectedColumnWidth = columnInfo.bodyScrollableColumns[ - scrollableColumnIndex - ].props.width; + var selectedColumnWidth = + columnInfo.bodyScrollableColumns[scrollableColumnIndex].props.width; var minAcceptableScrollPosition = previousColumnsWidth + selectedColumnWidth - availableScrollWidth; @@ -869,16 +956,18 @@ var FixedDataTable = React.createClass({ var useMaxHeight = props.height === undefined; var height = Math.round(useMaxHeight ? props.maxHeight : props.height); - var totalHeightReserved = props.footerHeight + props.headerHeight + - groupHeaderHeight + 2 * BORDER_HEIGHT; + var totalHeightReserved = + props.footerHeight + + props.headerHeight + + groupHeaderHeight + + 2 * BORDER_HEIGHT; var bodyHeight = height - totalHeightReserved; var scrollContentHeight = this._scrollHelper.getContentHeight(); var totalHeightNeeded = scrollContentHeight + totalHeightReserved; - var scrollContentWidth = - FixedDataTableWidthHelper.getTotalWidth(columns); + var scrollContentWidth = FixedDataTableWidthHelper.getTotalWidth(columns); - var horizontalScrollbarVisible = scrollContentWidth > props.width && - props.overflowX !== 'hidden'; + var horizontalScrollbarVisible = + scrollContentWidth > props.width && props.overflowX !== "hidden"; if (horizontalScrollbarVisible) { bodyHeight -= Scrollbar.SIZE; @@ -930,7 +1019,7 @@ var FixedDataTable = React.createClass({ bodyHeight, height, groupHeaderHeight, - useGroupHeader, + useGroupHeader }; return newState; @@ -940,12 +1029,11 @@ var FixedDataTable = React.createClass({ var newColumns = []; for (var i = 0; i < columns.length; ++i) { var column = columns[i]; - newColumns.push(React.cloneElement( - column, - { - cell: type ? column.props[type] : column.props[CELL] - } - )); + newColumns.push( + React.cloneElement(column, { + cell: type ? column.props[type] : column.props[CELL] + }) + ); } return newColumns; }, @@ -962,18 +1050,20 @@ var FixedDataTable = React.createClass({ } return { fixed: fixedColumns, - scrollable: scrollableColumns, + scrollable: scrollableColumns }; }, _onWheel(/*number*/ deltaX, /*number*/ deltaY) { - if (this.isMounted()) { + if (this._isMounted) { if (!this._isScrolling) { this._didScrollStart(); } var x = this.state.scrollX; - if (Math.abs(deltaY) > Math.abs(deltaX) && - this.props.overflowY !== 'hidden') { + if ( + Math.abs(deltaY) > Math.abs(deltaX) && + this.props.overflowY !== "hidden" + ) { var scrollState = this._scrollHelper.scrollBy(Math.round(deltaY)); var maxScrollY = Math.max( 0, @@ -984,36 +1074,36 @@ var FixedDataTable = React.createClass({ firstRowOffset: scrollState.offset, scrollY: scrollState.position, scrollContentHeight: scrollState.contentHeight, - maxScrollY: maxScrollY, + maxScrollY: maxScrollY }); - } else if (deltaX && this.props.overflowX !== 'hidden') { + } else if (deltaX && this.props.overflowX !== "hidden") { x += deltaX; x = x < 0 ? 0 : x; x = x > this.state.maxScrollX ? this.state.maxScrollX : x; this.setState({ - scrollX: x, + scrollX: x }); } - + this._didScroll(); this._didScrollStop(); } }, - _onHorizontalScroll(/*number*/ scrollPos) { - if (this.isMounted() && scrollPos !== this.state.scrollX) { + if (this._isMounted && scrollPos !== this.state.scrollX) { if (!this._isScrolling) { this._didScrollStart(); } this.setState({ - scrollX: scrollPos, + scrollX: scrollPos }); + this._didScroll(); this._didScrollStop(); } }, _onVerticalScroll(/*number*/ scrollPos) { - if (this.isMounted() && scrollPos !== this.state.scrollY) { + if (this._isMounted && scrollPos !== this.state.scrollY) { if (!this._isScrolling) { this._didScrollStart(); } @@ -1022,14 +1112,15 @@ var FixedDataTable = React.createClass({ firstRowIndex: scrollState.index, firstRowOffset: scrollState.offset, scrollY: scrollState.position, - scrollContentHeight: scrollState.contentHeight, + scrollContentHeight: scrollState.contentHeight }); + this._didScroll(); this._didScrollStop(); } }, _didScrollStart() { - if (this.isMounted() && !this._isScrolling) { + if (this._isMounted && !this._isScrolling) { this._isScrolling = true; if (this.props.onScrollStart) { this.props.onScrollStart(this.state.scrollX, this.state.scrollY); @@ -1037,51 +1128,63 @@ var FixedDataTable = React.createClass({ } }, + _didScroll() { + if (this._isMounted && this._isScrolling) { + if (this.props.onScroll) { + this.props.onScroll(this.state.scrollX, this.state.scrollY); + } + } + }, + _didScrollStop() { - if (this.isMounted() && this._isScrolling) { + if (this._isMounted && this._isScrolling) { this._isScrolling = false; - this.setState({redraw: true}); + this.setState({ redraw: true }); if (this.props.onScrollEnd) { this.props.onScrollEnd(this.state.scrollX, this.state.scrollY); } } }, + + setHoverState(hoverState) { + this.setState({ isHoveringResizerKnob: hoverState }) + } }); -var HorizontalScrollbar = React.createClass({ +var HorizontalScrollbar = createReactClass({ + displayName: "HorizontalScrollbar", mixins: [ReactComponentWithPureRenderMixin], + propTypes: { contentSize: PropTypes.number.isRequired, offset: PropTypes.number.isRequired, onScroll: PropTypes.func.isRequired, position: PropTypes.number.isRequired, - size: PropTypes.number.isRequired, + size: PropTypes.number.isRequired }, render() /*object*/ { var outerContainerStyle = { height: Scrollbar.SIZE, width: this.props.size, + ...this.props.horizontalScrollbarStyle }; var innerContainerStyle = { height: Scrollbar.SIZE, - position: 'absolute', - overflow: 'hidden', - width: this.props.size, + position: "absolute", + overflow: "hidden", + width: this.props.size }; - translateDOMPositionXY( - innerContainerStyle, - 0, - this.props.offset - ); + translateDOMPositionXY(innerContainerStyle, 0, this.props.offset); return (
+ style={outerContainerStyle} + >
); - }, + } }); module.exports = FixedDataTable; diff --git a/src/FixedDataTableRoot.js b/src/FixedDataTableRoot.js index 69cee919..9e7ec7b3 100644 --- a/src/FixedDataTableRoot.js +++ b/src/FixedDataTableRoot.js @@ -23,5 +23,5 @@ var FixedDataTableRoot = { Table: FixedDataTable, }; -FixedDataTableRoot.version = '0.6.0'; +FixedDataTableRoot.version = '0.7.0'; module.exports = FixedDataTableRoot; diff --git a/src/FixedDataTableRow.react.js b/src/FixedDataTableRow.react.js index ffaa60d0..18914729 100644 --- a/src/FixedDataTableRow.react.js +++ b/src/FixedDataTableRow.react.js @@ -12,6 +12,8 @@ 'use strict'; +var PropTypes = require('prop-types'); + var React = require('React'); var FixedDataTableCellGroup = require('FixedDataTableCellGroup.react'); @@ -19,16 +21,13 @@ var cx = require('cx'); var joinClasses = require('joinClasses'); var translateDOMPositionXY = require('translateDOMPositionXY'); -var {PropTypes} = React; - /** * Component that renders the row for . * This component should not be used directly by developer. Instead, * only should use the component internally. */ -var FixedDataTableRowImpl = React.createClass({ - - propTypes: { +class FixedDataTableRowImpl extends React.Component { + static propTypes = { isScrolling: PropTypes.bool, @@ -84,7 +83,7 @@ var FixedDataTableRowImpl = React.createClass({ * @param object event */ onColumnResize: PropTypes.func, - }, + }; render() /*object*/ { var style = { @@ -111,6 +110,8 @@ var FixedDataTableRowImpl = React.createClass({ zIndex={2} columns={this.props.fixedColumns} onColumnResize={this.props.onColumnResize} + isHoveringResizerKnob={this.props.isHoveringResizerKnob} + setHoverState={this.props.setHoverState} rowHeight={this.props.height} rowIndex={this.props.index} />; @@ -146,17 +147,17 @@ var FixedDataTableRowImpl = React.createClass({
); - }, + } - _getColumnsWidth(/*array*/ columns) /*number*/ { + _getColumnsWidth = /*array*/ columns => /*number*/ { var width = 0; for (var i = 0; i < columns.length; ++i) { width += columns[i].props.width; } return width; - }, + }; - _renderColumnsShadow(/*number*/ left) /*?object*/ { + _renderColumnsShadow = /*number*/ left => /*?object*/ { if (left > 0) { var className = cx({ 'fixedDataTableRowLayout/fixedColumnsDivider': true, @@ -170,32 +171,31 @@ var FixedDataTableRowImpl = React.createClass({ }; return
; } - }, + }; - _onClick(/*object*/ event) { + _onClick = /*object*/ event => { this.props.onClick(event, this.props.index); - }, + }; - _onDoubleClick(/*object*/ event) { + _onDoubleClick = /*object*/ event => { this.props.onDoubleClick(event, this.props.index); - }, + }; - _onMouseDown(/*object*/ event) { + _onMouseDown = /*object*/ event => { this.props.onMouseDown(event, this.props.index); - }, + }; - _onMouseEnter(/*object*/ event) { + _onMouseEnter = /*object*/ event => { this.props.onMouseEnter(event, this.props.index); - }, + }; - _onMouseLeave(/*object*/ event) { + _onMouseLeave = /*object*/ event => { this.props.onMouseLeave(event, this.props.index); - }, -}); - -var FixedDataTableRow = React.createClass({ + }; +} - propTypes: { +class FixedDataTableRow extends React.Component { + static propTypes = { isScrolling: PropTypes.bool, @@ -219,7 +219,7 @@ var FixedDataTableRow = React.createClass({ * Width of the row. */ width: PropTypes.number.isRequired, - }, + }; render() /*object*/ { var style = { @@ -240,8 +240,8 @@ var FixedDataTableRow = React.createClass({ />
); - }, -}); + } +} module.exports = FixedDataTableRow; diff --git a/src/Scrollbar.react.js b/src/Scrollbar.react.js index 185532f0..582160de 100644 --- a/src/Scrollbar.react.js +++ b/src/Scrollbar.react.js @@ -12,7 +12,9 @@ var DOMMouseMoveTracker = require('DOMMouseMoveTracker'); var Keys = require('Keys'); +var PropTypes = require('prop-types'); var React = require('React'); +var createReactClass = require('create-react-class'); var ReactDOM = require('ReactDOM'); var ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin'); var ReactWheelHandler = require('ReactWheelHandler'); @@ -22,8 +24,6 @@ var cx = require('cx'); var emptyFunction = require('emptyFunction'); var translateDOMPositionXY = require('translateDOMPositionXY'); -var {PropTypes} = React; - var UNSCROLLABLE_STATE = { position: 0, scrollable: false, @@ -36,7 +36,8 @@ var KEYBOARD_SCROLL_AMOUNT = 40; var _lastScrolledScrollbar = null; -var Scrollbar = React.createClass({ +var Scrollbar = createReactClass({ + displayName: "Scrollbar", mixins: [ReactComponentWithPureRenderMixin], propTypes: { @@ -196,6 +197,8 @@ var Scrollbar = React.createClass({ this.state.position !== this.props.position) { this._didScroll(); } + + this._isMounted = true; }, componentWillUnmount() { @@ -205,6 +208,8 @@ var Scrollbar = React.createClass({ _lastScrolledScrollbar = null; } delete this._mouseMoveTracker; + + this._isMounted = false; }, scrollBy(/*number*/ delta) { @@ -465,7 +470,7 @@ var Scrollbar = React.createClass({ }, _blur() { - if (this.isMounted()) { + if (this._isMounted) { try { this._onBlur(); ReactDOM.findDOMNode(this).blur(); @@ -502,7 +507,7 @@ var Scrollbar = React.createClass({ _didScroll() { this.props.onScroll(this.state.position); - }, + } }); Scrollbar.KEYBOARD_SCROLL_AMOUNT = KEYBOARD_SCROLL_AMOUNT; diff --git a/src/css/layout/fixedDataTableCellLayout.css b/src/css/layout/fixedDataTableCellLayout.css index 90fc2f1d..3844e7b9 100644 --- a/src/css/layout/fixedDataTableCellLayout.css +++ b/src/css/layout/fixedDataTableCellLayout.css @@ -53,16 +53,11 @@ } .fixedDataTableCellLayout/columnResizerContainer:hover { - cursor: ew-resize; -} - -.fixedDataTableCellLayout/columnResizerContainer:hover .fixedDataTableCellLayout/columnResizerKnob { - visibility: visible; + cursor: col-resize; } .fixedDataTableCellLayout/columnResizerKnob { position: absolute; right: 0px; - visibility: hidden; - width: 4px; + width: 1px; } diff --git a/src/css/layout/fixedDataTableColumnResizerLineLayout.css b/src/css/layout/fixedDataTableColumnResizerLineLayout.css index e724497c..2d1f0a25 100644 --- a/src/css/layout/fixedDataTableColumnResizerLineLayout.css +++ b/src/css/layout/fixedDataTableColumnResizerLineLayout.css @@ -10,7 +10,7 @@ */ .fixedDataTableColumnResizerLineLayout/mouseArea { - cursor: ew-resize; + cursor: col-resize; position: absolute; right: -5px; width: 12px; diff --git a/src/css/style/fixedDataTableCell.css b/src/css/style/fixedDataTableCell.css index 7c878046..ed5e6cbc 100644 --- a/src/css/style/fixedDataTableCell.css +++ b/src/css/style/fixedDataTableCell.css @@ -26,5 +26,5 @@ } .public/fixedDataTableCell/columnResizerKnob { - background-color: #0284ff; + background-color: #f57c00; } diff --git a/src/css/style/fixedDataTableColumnResizerLine.css b/src/css/style/fixedDataTableColumnResizerLine.css index 42a975fd..3f9653f6 100644 --- a/src/css/style/fixedDataTableColumnResizerLine.css +++ b/src/css/style/fixedDataTableColumnResizerLine.css @@ -14,5 +14,5 @@ * Column resizer line. */ .public/fixedDataTableColumnResizerLine/main { - border-color: #0284ff; + border-color: #f57c00; } diff --git a/src/transition/FixedDataTable.react.js b/src/transition/FixedDataTable.react.js index de768dda..82dc2735 100644 --- a/src/transition/FixedDataTable.react.js +++ b/src/transition/FixedDataTable.react.js @@ -9,22 +9,22 @@ * @providesModule FixedDataTable.react */ - /** - * TRANSITION SHIM - * This acts to provide an intermediate mapping from the old API to the new API - * - * Remove this entire file and replace the two lines in FixedDataTableRoot - * when ready to continue to the new API. - */ +/** + * TRANSITION SHIM + * This acts to provide an intermediate mapping from the old API to the new API + * + * Remove this entire file and replace the two lines in FixedDataTableRoot + * when ready to continue to the new API. + */ 'use strict'; +var PropTypes = require('prop-types'); + var React = require('React'); var ReactChildren = React.Children; -var {PropTypes} = React; - // New Table API var Table = require('FixedDataTableNew.react'); var Column = require('FixedDataTableColumnNew.react'); @@ -105,8 +105,8 @@ function notifyDeprecated(prop, reason) { * - Scrollable Body Columns: The body columns that move while scrolling * vertically or horizontally. */ -var TransitionTable = React.createClass({ - propTypes: { +class TransitionTable extends React.Component { + static propTypes = { /** * Pixel width of table. If all columns do not fit, * a horizontal scrollbar will appear. @@ -303,17 +303,18 @@ var TransitionTable = React.createClass({ * Whether a column is currently being resized. */ isColumnResizing: PropTypes.bool, - }, + }; - getInitialState() { - // Throw warnings on deprecated props. - var state = {}; - state.needsMigration = this._checkDeprecations(); + constructor(props, context) { + super(props, context); + // Throw warnings on deprecated props. + var state = {}; + state.needsMigration = this._checkDeprecations(); - return state; - }, + this.state = state; + } - _checkDeprecations() { + _checkDeprecations = () => { var needsMigration = false; if (this.props.rowGetter) { @@ -398,10 +399,10 @@ var TransitionTable = React.createClass({ }); return needsMigration; - }, + }; // Wrapper for onRow callbacks, since we don't have rowData at that level. - _onRowAction(props, callback) { + _onRowAction = (props, callback) => { if (!callback) { return undefined; } @@ -413,9 +414,9 @@ var TransitionTable = React.createClass({ (props.rowGetter && props.rowGetter(rowIndex)) || EMPTY_OBJECT ); }; - }, + }; - _transformColumn(column, tableProps, key) { + _transformColumn = (column, tableProps, key) => { var props = column.props; @@ -462,9 +463,9 @@ var TransitionTable = React.createClass({ /> ); } - }, + }; - _transformColumnGroup(group, tableProps, key, labels) { + _transformColumnGroup = (group, tableProps, key, labels) => { var props = group.props; var j = 0; @@ -490,9 +491,9 @@ var TransitionTable = React.createClass({ {columns} ); - }, + }; - _convertedColumns(needsMigration) { + _convertedColumns = needsMigration => { // If we don't need to migrate, map directly to the new API. if (!needsMigration) { return ReactChildren.map(this.props.children, (child) => { @@ -539,7 +540,7 @@ var TransitionTable = React.createClass({ i++; return child; }); - }, + }; render() { var props = this.props; @@ -555,7 +556,7 @@ var TransitionTable = React.createClass({ {this._convertedColumns(this.state.needsMigration)} ); - }, -}); + } +} module.exports = TransitionTable; diff --git a/src/transition/FixedDataTableCellTransition.react.js b/src/transition/FixedDataTableCellTransition.react.js index 300c376a..02a4ab73 100644 --- a/src/transition/FixedDataTableCellTransition.react.js +++ b/src/transition/FixedDataTableCellTransition.react.js @@ -1,3 +1,4 @@ +var PropTypes = require('prop-types'); /** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. @@ -18,7 +19,6 @@ */ var React = require('React'); -var {PropTypes} = React; var cx = require('cx'); var joinClasses = require('joinClasses'); @@ -26,9 +26,8 @@ var shallowEqual = require('shallowEqual'); var CellDefault = require('FixedDataTableCellDefault.react'); -var TransitionCell = React.createClass({ - - propTypes: { +class TransitionCell extends React.Component { + static propTypes = { label: PropTypes.string, // header, footer className: PropTypes.string, rowIndex: PropTypes.number, @@ -46,7 +45,7 @@ var TransitionCell = React.createClass({ height: PropTypes.number, isHeaderCell: PropTypes.bool, // header isFooterCell: PropTypes.bool, // footer - }, + }; shouldComponentUpdate(/*object*/ nextProps): boolean { var update = false; @@ -74,9 +73,9 @@ var TransitionCell = React.createClass({ this._cellData = cellData; return update || !shallowEqual(nextProps, this.props); - }, + } - _getCellData(props) { + _getCellData = props => { var dataKey = props.dataKey; if (dataKey == null) { return null; @@ -106,9 +105,9 @@ var TransitionCell = React.createClass({ if (props.headerDataGetter) { return props.headerDataGetter[dataKey]; } - }, + }; - _getRowData(props): Object { + _getRowData = (props): Object => { if (props.rowGetter) { return props.rowGetter(props.rowIndex) || {}; } @@ -122,7 +121,7 @@ var TransitionCell = React.createClass({ } return {}; - }, + }; render() { var props = this.props; @@ -214,6 +213,6 @@ var TransitionCell = React.createClass({ ); } -}); +} module.exports = TransitionCell; diff --git a/src/transition/FixedDataTableColumn.react.js b/src/transition/FixedDataTableColumn.react.js index 25f31da1..c2d7ba19 100644 --- a/src/transition/FixedDataTableColumn.react.js +++ b/src/transition/FixedDataTableColumn.react.js @@ -19,10 +19,8 @@ var React = require('React'); -var TransitionColumn = React.createClass({ - statics: { - __TableColumn__: true - }, +class TransitionColumn extends React.Component { + static __TableColumn__ = true; render() { if (__DEV__) { @@ -32,6 +30,6 @@ var TransitionColumn = React.createClass({ } return null; } -}); +} module.exports = TransitionColumn; diff --git a/src/transition/FixedDataTableColumnGroup.react.js b/src/transition/FixedDataTableColumnGroup.react.js index 911126d9..d0c2d38c 100644 --- a/src/transition/FixedDataTableColumnGroup.react.js +++ b/src/transition/FixedDataTableColumnGroup.react.js @@ -9,20 +9,18 @@ * @providesModule FixedDataTableColumnGroup.react */ - /** - * TRANSITION SHIM - * This provides an intermediate mapping from the old API to the new API. - * - * When ready, remove this file and rename the providesModule in - * FixedDataTableColumnNew.react - */ +/** + * TRANSITION SHIM + * This provides an intermediate mapping from the old API to the new API. + * + * When ready, remove this file and rename the providesModule in + * FixedDataTableColumnNew.react + */ var React = require('React'); -var TransitionColumnGroup = React.createClass({ - statics: { - __TableColumnGroup__: true, - }, +class TransitionColumnGroup extends React.Component { + static __TableColumnGroup__ = true; render() { if (__DEV__) { @@ -32,6 +30,6 @@ var TransitionColumnGroup = React.createClass({ } return null; } -}); +} module.exports = TransitionColumnGroup;