forked from facebookarchive/fixed-data-table
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e6694f8
Showing
119 changed files
with
18,777 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.DS_STORE | ||
node_modules | ||
*~ | ||
static | ||
.grunt | ||
build/ | ||
.module-cache | ||
*.log* | ||
chrome-user-data | ||
__build__ | ||
__site__ | ||
internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build_helpers | ||
site | ||
src | ||
__site__ | ||
webpack.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Contributing to FixedDataTable | ||
We want to make contributing to this project as easy and transparent as possible. | ||
|
||
## Our Development Process | ||
Some of the core team will be working directly on GitHub. These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in. | ||
|
||
## Pull Requests | ||
We actively welcome your pull requests. | ||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests (tests coming soon). | ||
3. If you've changed APIs, update the documentation via `build_helpers/buildAPIDocs.sh`. | ||
4. Ensure the test suite passes (coming soon). | ||
5. Make sure your code lints (coming soon). | ||
6. If you haven't already, complete the Contributor License Agreement ("CLA"). | ||
|
||
## Contributor License Agreement ("CLA") | ||
In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Facebook's open source projects. | ||
|
||
Complete your CLA here: <https://code.facebook.com/cla> | ||
|
||
## Issues | ||
We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue. | ||
|
||
## Coding Style | ||
* Use semicolons; | ||
* Commas last, | ||
* 2 spaces for indentation (no tabs) | ||
* Prefer `'` over `"` | ||
* `"use strict";` | ||
* 80 character line length | ||
* "Attractive" | ||
* Do not use the optional parameters of `setTimeout` and `setInterval` | ||
|
||
## License | ||
By contributing to FixedDataTable, you agree that your contributions will be licensed under its BSD license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
BSD License | ||
|
||
For FixedDataTable software | ||
|
||
Copyright (c) 2015, Facebook, Inc. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name Facebook nor the names of its contributors may be used to | ||
endorse or promote products derived from this software without specific | ||
prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Additional Grant of Patent Rights | ||
|
||
"Software" means the FixedDataTable software distributed by Facebook, Inc. | ||
|
||
Facebook hereby grants you a perpetual, worldwide, royalty-free, non-exclusive, | ||
irrevocable (subject to the termination provision below) license under any | ||
rights in any patent claims owned by Facebook, to make, have made, use, sell, | ||
offer to sell, import, and otherwise transfer the Software. For avoidance of | ||
doubt, no license is granted under Facebook’s rights in any patent claims that | ||
are infringed by (i) modifications to the Software made by you or a third party, | ||
or (ii) the Software in combination with any software or other technology | ||
provided by you or a third party. | ||
|
||
The license granted hereunder will terminate, automatically and without notice, | ||
for anyone that makes any claim (including by filing any lawsuit, assertion or | ||
other action) alleging (a) direct, indirect, or contributory infringement or | ||
inducement to infringe any patent: (i) by Facebook or any of its subsidiaries or | ||
affiliates, whether or not such claim is related to the Software, (ii) by any | ||
party if such claim arises in whole or in part from any software, product or | ||
service of Facebook or any of its subsidiaries or affiliates, whether or not | ||
such claim is related to the Software, or (iii) by any party relating to the | ||
Software; or (b) that any right in any patent claim of Facebook is invalid or | ||
unenforceable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Fixed Data Tables for React | ||
==================================== | ||
|
||
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. | ||
|
||
The table was designed to handle thousands 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 extensibilty. | ||
|
||
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 | ||
|
||
Things that are FixedDataTable doesn't do: | ||
* FixedDataTable does not provide a layout reflow mechanism or calculates 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) | ||
* FixedDataTable does not support touch devices, but eventually will. | ||
|
||
Getting started | ||
--------------- | ||
|
||
Install `fixed-data-table` using npm. | ||
|
||
```shell | ||
npm install fixed-data-table | ||
``` | ||
|
||
Then require it into any module. | ||
|
||
```javascript | ||
var React = require('react'); | ||
var FixedDataTable = require('fixed-data-table'); | ||
|
||
var Table = FixedDataTable.Table; | ||
var Column = FixedDataTable.Column; | ||
|
||
var rows = [...]; // My table data | ||
|
||
function rowGetter(rowIndex) { | ||
return rows[rowIndex]; | ||
} | ||
|
||
React.render( | ||
<Table | ||
rowHeight={50} | ||
rowGetter={rowGetter} | ||
rowsCount={rows.length} | ||
width={5000} | ||
height={5000} | ||
headerHeight={50}> | ||
<Column | ||
label="Col 1" | ||
width={3000} | ||
dataKey={0} | ||
/> | ||
<Column | ||
label="Col 2" | ||
width={2000} | ||
dataKey={1} | ||
/> | ||
</Table>, | ||
document.getElementById('example') | ||
); | ||
``` | ||
|
||
|
||
Contributions | ||
------------ | ||
|
||
Use [Github issues](https://github.com/facebook/fixed-data-table-experimental/issues) for requests. | ||
|
||
We actively welcome pull requests; learn how to [contribute](./CONTRIBUTING.md). | ||
|
||
|
||
Changelog | ||
--------- | ||
|
||
Changes are tracked as [Github releases](https://github.com/facebook/fixed-data-table-experimental/releases). | ||
|
||
|
||
License | ||
------- | ||
|
||
`FixedDataTable` is [BSD-licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env node | ||
// -*- mode: js -*- | ||
"use strict"; | ||
|
||
/** | ||
* Extractor for React documentation in JavaScript. | ||
*/ | ||
var ReactDocumentationParser = require('./react_documentation/ReactDocumentationParser'); | ||
var generateMarkdown = require('./react_documentation/generateMarkdown'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
var PROJECT_ROOT = path.join(__dirname, '../'); | ||
var FILES_TO_READ = [ | ||
{ | ||
path: path.join(PROJECT_ROOT, 'src/FixedDataTable.react.js'), | ||
name: 'Table', | ||
markdownFileName: 'TableAPI.md' | ||
}, | ||
{ | ||
path: path.join(PROJECT_ROOT, 'src/FixedDataTableColumn.react.js'), | ||
name: 'Column', | ||
markdownFileName: 'ColumnAPI.md' | ||
}, | ||
{ | ||
path: path.join(PROJECT_ROOT, 'src/FixedDataTableColumnGroup.react.js'), | ||
name: 'ColumnGroup', | ||
markdownFileName: 'ColumnGroupAPI.md' | ||
} | ||
]; | ||
|
||
ReactDocumentationParser.addHandler( | ||
require('./react_documentation/propTypeHandler'), | ||
'propTypes' | ||
); | ||
ReactDocumentationParser.addHandler( | ||
require('./react_documentation/propDocBlockHandler'), | ||
'propTypes' | ||
); | ||
ReactDocumentationParser.addHandler( | ||
require('./react_documentation/defaultValueHandler'), | ||
'getDefaultProps' | ||
); | ||
|
||
ReactDocumentationParser.addHandler( | ||
require('./react_documentation/componentDocblockHandler') | ||
); | ||
|
||
FILES_TO_READ.forEach(function(file) { | ||
var fileSource = fs.readFileSync(file.path); | ||
var fileDocsData = ReactDocumentationParser.parseSource(fileSource); | ||
var markdownFilePath = path.join(__dirname, '../docs', file.markdownFileName); | ||
|
||
var headerComment = '<!-- File generated from "' + | ||
file.path.replace(PROJECT_ROOT, '') + | ||
'" -->\n'; | ||
|
||
fs.writeFileSync( | ||
markdownFilePath, | ||
headerComment + generateMarkdown(file.name, fileDocsData) | ||
); | ||
|
||
console.log('Wrote: ' + markdownFilePath); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env node | ||
// -*- mode: js -*- | ||
"use strict"; | ||
|
||
var glob = require('glob'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var reactTools = require('react-tools'); | ||
|
||
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 findDEVRegex = /__DEV__/g; | ||
|
||
function replaceRequirePath(match, modulePath) { | ||
var path = modulePath; | ||
|
||
if (!excludePathRegex.test(path)) { | ||
path = './' + path; | ||
} | ||
|
||
return '= require(\'' + path + '\');'; | ||
} | ||
|
||
function processFile(fileName) { | ||
var contents = fs.readFileSync(fileName, {encoding: 'utf8'}); | ||
var providesModule = providesModuleRegex.exec(contents); | ||
if (providesModule) { | ||
contents = reactTools.transform(contents, {harmony: true}); | ||
contents = contents.replace(moduleRequireRegex, replaceRequirePath); | ||
contents = contents.replace(findDEVRegex, 'process.env.NODE_ENV !== \'production\''); | ||
fs.writeFileSync( | ||
path.join(internalPath, providesModule[1] + '.js'), | ||
contents | ||
); | ||
} | ||
} | ||
|
||
glob.sync(path.join(__dirname, '../src/**/*.js')).forEach(processFile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env node | ||
// -*- mode: js -*- | ||
"use strict"; | ||
|
||
require('node-jsx').install({harmony: true}); | ||
require('./nodeMarkdown').install(); | ||
require('./nodeLessStub').install(); | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var IndexPage = require('../site/IndexPage'); | ||
|
||
var isDevMode = process.argv[2] === '--devMode'; | ||
|
||
var sitePath = path.join(__dirname, '../__site__'); | ||
if (!fs.existsSync(sitePath)) { | ||
fs.mkdirSync(sitePath); | ||
} | ||
|
||
IndexPage.getPageLocations().forEach(function(fileName) { | ||
fs.writeFileSync( | ||
path.join(sitePath, fileName), | ||
IndexPage.renderToString({ | ||
location: fileName, | ||
devMode: isDevMode | ||
}) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use strict"; | ||
|
||
var postcss = require('postcss'); | ||
var autoPrefixer = require('autoprefixer'); | ||
var customProperties = require('postcss-custom-properties'); | ||
var cssVars = require('../src/stubs/cssVar'); | ||
|
||
function escapeSlash(match) { | ||
return match.replace(/\//g, '_'); | ||
} | ||
|
||
function slashTransform(content) { | ||
return content.replace(/\.[\w\/\:\.]+(\s|\,)/g, escapeSlash); | ||
} | ||
|
||
module.exports = function(content) { | ||
if (this && this.cacheable) { | ||
// Webpack specific call | ||
this.cacheable(); | ||
} | ||
|
||
content = slashTransform(content); | ||
content = postcss() | ||
.use(customProperties({variables: cssVars.CSS_VARS})) | ||
.use(autoPrefixer()) | ||
.process(content).css; | ||
|
||
return content; | ||
}; |
Oops, something went wrong.