diff --git a/@types/alltypes.d.ts b/@types/alltypes.d.ts index 53c4fd01e..0ea778cf5 100644 --- a/@types/alltypes.d.ts +++ b/@types/alltypes.d.ts @@ -1,48 +1,4 @@ declare module 'react-page-layout'; -declare module 'react-perf-tool'; declare module 'react-prism'; declare module 'react-router-dom'; -declare module 'velocity-animate'; - -declare module 'hoist-non-react-statics' { - import {ComponentClass} from 'react'; - - function hoistNonReactStatics
(to: ComponentClass
, from: ComponentClass ;
- export = hoistNonReactStatics;
-}
-
-// declare module "react-css-themr" {
-// import React = require("react");
-// type TReactCSSThemrTheme = {
-// [key: string]: string | TReactCSSThemrTheme
-// }
-
-// export function themeable(...themes: Array extends React.Component {
-// }
-
-// interface ThemedComponentClass extends React.ComponentClass {
-// new(props?: P, context?: any): ThemedComponent ;
-// }
-
-// export function themr(
-// identifier: string | number | symbol,
-// defaultTheme?: {},
-// options?: IThemrOptions
-// ): (component: (new(props?: P, context?: any) => React.Component ) | React.SFC ) => ThemedComponentClass ;
-// }
diff --git a/@types/react-addons-perf.d.ts b/@types/react-addons-perf.d.ts
deleted file mode 100644
index fa6336f40..000000000
--- a/@types/react-addons-perf.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-declare module 'react-addons-perf';
diff --git a/@types/velocity-animate.d.ts b/@types/velocity-animate.d.ts
deleted file mode 100644
index 4c827e029..000000000
--- a/@types/velocity-animate.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-declare module 'velocity-animate';
diff --git a/config/jest/config.json b/config/jest/config.json
index a5581fce7..7ae484866 100644
--- a/config/jest/config.json
+++ b/config/jest/config.json
@@ -1,5 +1,6 @@
{
"setupFiles": [
+ "
- {cellContent}
- {dragHandle}
- {tooltip}
-
- );
- }
-});
-
-module.exports = Cell;
\ No newline at end of file
diff --git a/src/components/ReactDataGrid/CellExpand.js b/src/components/ReactDataGrid/CellExpand.js
deleted file mode 100644
index 03d24be93..000000000
--- a/src/components/ReactDataGrid/CellExpand.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import React, { PropTypes } from 'react';
-import AppConstants from './AppConstants';
-
-const CellExpand = React.createClass({
- getInitialState() {
- let expanded = this.props.expandableOptions && this.props.expandableOptions.expanded;
- return { expanded: expanded };
- },
- componentWillReceiveProps(nextProps) {
- let expanded = nextProps.expandableOptions && nextProps.expandableOptions.expanded;
- if (this.state.expanded !== expanded) {
- this.setState({expanded});
- }
- },
- propTypes: {
- expandableOptions: PropTypes.object.isRequired,
- onCellExpand: PropTypes.func.isRequired
- },
- onCellExpand(e) {
- this.setState({ expanded: !this.state.expanded });
- this.props.onCellExpand(e);
- },
- render() {
- return (
-
- {this.state.expanded ? AppConstants.CellExpand.DOWN_TRIANGLE : AppConstants.CellExpand.RIGHT_TRIANGLE}
-
- );
- }
-});
-
-export default CellExpand;
diff --git a/src/components/ReactDataGrid/ChildRowDeleteButton.js b/src/components/ReactDataGrid/ChildRowDeleteButton.js
deleted file mode 100644
index cc8130269..000000000
--- a/src/components/ReactDataGrid/ChildRowDeleteButton.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-import classNames from 'classnames';
-
-const ChildRowDeleteButton = ({treeDepth, cellHeight, siblingIndex, numberSiblings, onDeleteSubRow, isDeleteSubRowEnabled, allowAddChildRow = true }) => {
- const lastSibling = siblingIndex === numberSiblings - 1;
- let className = classNames(
- { 'rdg-child-row-action-cross': allowAddChildRow === true || !lastSibling },
- { 'rdg-child-row-action-cross-last': allowAddChildRow === false && (lastSibling || numberSiblings === 1) }
- );
- const height = 12;
- const width = 12;
- let left = treeDepth * 15;
- let top = (cellHeight - 12) / 2;
- return (
-
- );
- }
-});
-
-module.exports = Grid;
\ No newline at end of file
diff --git a/src/components/ReactDataGrid/GridScrollMixin.js b/src/components/ReactDataGrid/GridScrollMixin.js
deleted file mode 100644
index 96f26f85e..000000000
--- a/src/components/ReactDataGrid/GridScrollMixin.js
+++ /dev/null
@@ -1,48 +0,0 @@
-const ReactDOM = require('react-dom');
-
-module.exports = {
-
- componentDidMount() {
- this._scrollLeft = this.viewport ? this.viewport.getScroll().scrollLeft : 0;
- this._onScroll();
- },
-
- componentDidUpdate() {
- this._onScroll();
- },
-
- componentWillMount() {
- this._scrollLeft = undefined;
- },
-
- componentWillUnmount() {
- this._scrollLeft = undefined;
- },
-
- onScroll(props) {
- if (this._scrollLeft !== props.scrollLeft) {
- this._scrollLeft = props.scrollLeft;
- this._onScroll();
- }
- },
-
- onHeaderScroll(e) {
- let scrollLeft = e.target.scrollLeft;
- if (this._scrollLeft !== scrollLeft) {
- this._scrollLeft = scrollLeft;
- this.header.setScrollLeft(scrollLeft);
- let canvas = ReactDOM.findDOMNode(this.viewport.canvas);
- canvas.scrollLeft = scrollLeft;
- this.viewport.canvas.setScrollLeft(scrollLeft);
- }
- },
-
- _onScroll() {
- if (this._scrollLeft !== undefined) {
- this.header.setScrollLeft(this._scrollLeft);
- if (this.viewport) {
- this.viewport.setScrollLeft(this._scrollLeft);
- }
- }
- }
-};
diff --git a/src/components/ReactDataGrid/Header.js b/src/components/ReactDataGrid/Header.js
deleted file mode 100644
index 4e13c5f53..000000000
--- a/src/components/ReactDataGrid/Header.js
+++ /dev/null
@@ -1,210 +0,0 @@
-const React = require('react');
-const ReactDOM = require('react-dom');
-const joinClasses = require('classnames');
-const shallowCloneObject = require('./shallowCloneObject');
-const ColumnMetrics = require('./ColumnMetrics');
-const ColumnUtils = require('./ColumnUtils');
-const HeaderRow = require('./HeaderRow');
-const getScrollbarSize = require('./getScrollbarSize');
-const PropTypes = React.PropTypes;
-const createObjectWithProperties = require('./createObjectWithProperties');
-const cellMetaDataShape = require('./PropTypeShapes/CellMetaDataShape');
-require('./themes/react-data-grid-header.scss');
-
-type Column = {
- width: number
-}
-
-// The list of the propTypes that we want to include in the Header div
-const knownDivPropertyKeys = ['height', 'onScroll'];
-
-const Header = React.createClass({
- propTypes: {
- columnMetrics: PropTypes.shape({ width: PropTypes.number.isRequired, columns: PropTypes.any }).isRequired,
- totalWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
- height: PropTypes.number.isRequired,
- headerRows: PropTypes.array.isRequired,
- sortColumn: PropTypes.string,
- sortDirection: PropTypes.oneOf(['ASC', 'DESC', 'NONE']),
- onSort: PropTypes.func,
- onColumnResize: PropTypes.func,
- onScroll: PropTypes.func,
- onHeaderDrop: PropTypes.func,
- draggableHeaderCell: PropTypes.func,
- getValidFilterValues: PropTypes.func,
- cellMetaData: PropTypes.shape(cellMetaDataShape)
- },
-
- getInitialState(): {resizing: any} {
- return {resizing: null};
- },
-
- componentWillReceiveProps() {
- this.setState({resizing: null});
- },
-
- shouldComponentUpdate: function(nextProps: any, nextState: any): boolean {
- let update = !(ColumnMetrics.sameColumns(this.props.columnMetrics.columns, nextProps.columnMetrics.columns, ColumnMetrics.sameColumn))
- || this.props.totalWidth !== nextProps.totalWidth
- || (this.props.headerRows.length !== nextProps.headerRows.length)
- || (this.state.resizing !== nextState.resizing)
- || this.props.sortColumn !== nextProps.sortColumn
- || this.props.sortDirection !== nextProps.sortDirection;
- return update;
- },
-
- onColumnResize(column: Column, width: number) {
- let state = this.state.resizing || this.props;
-
- let pos = this.getColumnPosition(column);
-
- if (pos != null) {
- let resizing = {
- columnMetrics: shallowCloneObject(state.columnMetrics)
- };
- resizing.columnMetrics = ColumnMetrics.resizeColumn(
- resizing.columnMetrics, pos, width);
-
- // we don't want to influence scrollLeft while resizing
- if (resizing.columnMetrics.totalWidth < state.columnMetrics.totalWidth) {
- resizing.columnMetrics.totalWidth = state.columnMetrics.totalWidth;
- }
-
- resizing.column = ColumnUtils.getColumn(resizing.columnMetrics.columns, pos);
- this.setState({resizing});
- }
- },
-
- onColumnResizeEnd(column: Column, width: number) {
- let pos = this.getColumnPosition(column);
- if (pos !== null && this.props.onColumnResize) {
- this.props.onColumnResize(pos, width || column.width);
- }
- },
-
- getHeaderRows(): Array
- {cell}
- {resizeHandle}
-
- );
- }
-});
-
-module.exports = HeaderCell;
diff --git a/src/components/ReactDataGrid/HeaderCellType.js b/src/components/ReactDataGrid/HeaderCellType.js
deleted file mode 100644
index 489740d51..000000000
--- a/src/components/ReactDataGrid/HeaderCellType.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const HeaderCellType = {
- SORTABLE: 0,
- FILTERABLE: 1,
- NONE: 2,
- CHECKBOX: 3
-};
-
-module.exports = HeaderCellType;
diff --git a/src/components/ReactDataGrid/HeaderRow.js b/src/components/ReactDataGrid/HeaderRow.js
deleted file mode 100644
index 17dc710a3..000000000
--- a/src/components/ReactDataGrid/HeaderRow.js
+++ /dev/null
@@ -1,184 +0,0 @@
-const React = require('react');
-const shallowEqual = require('fbjs/lib/shallowEqual');
-const BaseHeaderCell = require('./HeaderCell');
-const getScrollbarSize = require('./getScrollbarSize');
-const ExcelColumn = require('./PropTypeShapes/ExcelColumn');
-const ColumnUtilsMixin = require('./ColumnUtils');
-const SortableHeaderCell = require('./cells/headerCells/SortableHeaderCell');
-const FilterableHeaderCell = require('./cells/headerCells/FilterableHeaderCell');
-const HeaderCellType = require('./HeaderCellType');
-const createObjectWithProperties = require('./createObjectWithProperties');
-require('./themes/react-data-grid-header.scss');
-
-const PropTypes = React.PropTypes;
-
-const HeaderRowStyle = {
- overflow: React.PropTypes.string,
- width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
- height: React.PropTypes.number,
- position: React.PropTypes.string
-};
-
-// The list of the propTypes that we want to include in the HeaderRow div
-const knownDivPropertyKeys = ['width', 'height', 'style', 'onScroll'];
-
-const HeaderRow = React.createClass({
- propTypes: {
- width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
- height: PropTypes.number.isRequired,
- columns: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
- onColumnResize: PropTypes.func,
- onSort: PropTypes.func.isRequired,
- onColumnResizeEnd: PropTypes.func,
- style: PropTypes.shape(HeaderRowStyle),
- sortColumn: PropTypes.string,
- sortDirection: React.PropTypes.oneOf(Object.keys(SortableHeaderCell.DEFINE_SORT)),
- cellRenderer: PropTypes.func,
- headerCellRenderer: PropTypes.func,
- filterable: PropTypes.bool,
- onFilterChange: PropTypes.func,
- resizing: PropTypes.object,
- onScroll: PropTypes.func,
- rowType: PropTypes.string,
- draggableHeaderCell: PropTypes.func,
- onHeaderDrop: PropTypes.func
- },
-
- mixins: [ColumnUtilsMixin],
-
- componentWillMount() {
- this.cells = [];
- },
-
- shouldComponentUpdate(nextProps: {width: ?(number | string); height: number; columns: Array
- {cells}
-
- );
- }
-});
-
-module.exports = HeaderRow;
\ No newline at end of file
diff --git a/src/components/ReactDataGrid/KeyCodes.js b/src/components/ReactDataGrid/KeyCodes.js
deleted file mode 100644
index 96fffca54..000000000
--- a/src/components/ReactDataGrid/KeyCodes.js
+++ /dev/null
@@ -1,100 +0,0 @@
-module.exports = {
- Backspace: 8,
- Tab: 9,
- Enter: 13,
- Shift: 16,
- Ctrl: 17,
- Alt: 18,
- PauseBreak: 19,
- CapsLock: 20,
- Escape: 27,
- PageUp: 33,
- PageDown: 34,
- End: 35,
- Home: 36,
- LeftArrow: 37,
- UpArrow: 38,
- RightArrow: 39,
- DownArrow: 40,
- Insert: 45,
- Delete: 46,
- 0: 48,
- 1: 49,
- 2: 50,
- 3: 51,
- 4: 52,
- 5: 53,
- 6: 54,
- 7: 55,
- 8: 56,
- 9: 57,
- a: 65,
- b: 66,
- c: 67,
- d: 68,
- e: 69,
- f: 70,
- g: 71,
- h: 72,
- i: 73,
- j: 74,
- k: 75,
- l: 76,
- m: 77,
- n: 78,
- o: 79,
- p: 80,
- q: 81,
- r: 82,
- s: 83,
- t: 84,
- u: 85,
- v: 86,
- w: 87,
- x: 88,
- y: 89,
- z: 90,
- LeftWindowKey: 91,
- RightWindowKey: 92,
- SelectKey: 93,
- NumPad0: 96,
- NumPad1: 97,
- NumPad2: 98,
- NumPad3: 99,
- NumPad4: 100,
- NumPad5: 101,
- NumPad6: 102,
- NumPad7: 103,
- NumPad8: 104,
- NumPad9: 105,
- Multiply: 106,
- Add: 107,
- Subtract: 109,
- DecimalPoint: 110,
- Divide: 111,
- F1: 112,
- F2: 113,
- F3: 114,
- F4: 115,
- F5: 116,
- F6: 117,
- F7: 118,
- F8: 119,
- F9: 120,
- F10: 121,
- F12: 123,
- NumLock: 144,
- ScrollLock: 145,
- SemiColon: 186,
- EqualSign: 187,
- Comma: 188,
- Dash: 189,
- Period: 190,
- ForwardSlash: 191,
- GraveAccent: 192,
- OpenBracket: 219,
- BackSlash: 220,
- CloseBracket: 221,
- SingleQuote: 222
-};
-
diff --git a/src/components/ReactDataGrid/KeyboardHandlerMixin.js b/src/components/ReactDataGrid/KeyboardHandlerMixin.js
deleted file mode 100644
index 683340f09..000000000
--- a/src/components/ReactDataGrid/KeyboardHandlerMixin.js
+++ /dev/null
@@ -1,69 +0,0 @@
-let KeyboardHandlerMixin = {
- onKeyDown(e: SyntheticKeyboardEvent) {
- if (this.isCtrlKeyHeldDown(e)) {
- this.checkAndCall('onPressKeyWithCtrl', e);
- } else if (this.isKeyExplicitlyHandled(e.key)) {
- // break up individual keyPress events to have their own specific callbacks
- // this allows multiple mixins to listen to onKeyDown events and somewhat reduces methodName clashing
- let callBack = 'onPress' + e.key;
- this.checkAndCall(callBack, e);
- } else if (this.isKeyPrintable(e.keyCode)) {
- this.checkAndCall('onPressChar', e);
- }
-
- // Track which keys are currently down for shift clicking etc
- this._keysDown = this._keysDown || {};
- this._keysDown[e.keyCode] = true;
- if (this.props.onGridKeyDown && typeof this.props.onGridKeyDown === 'function') {
- this.props.onGridKeyDown(e);
- }
- },
-
- onKeyUp(e) {
- // Track which keys are currently down for shift clicking etc
- this._keysDown = this._keysDown || {};
- delete this._keysDown[e.keyCode];
-
- if (this.props.onGridKeyUp && typeof this.props.onGridKeyUp === 'function') {
- this.props.onGridKeyUp(e);
- }
- },
- isKeyDown(keyCode) {
- if (!this._keysDown) return false;
- return keyCode in this._keysDown;
- },
-
- isSingleKeyDown(keyCode) {
- if (!this._keysDown) return false;
- return keyCode in this._keysDown && Object.keys(this._keysDown).length === 1;
- },
-
- // taken from http://stackoverflow.com/questions/12467240/determine-if-javascript-e-keycode-is-a-printable-non-control-character
- isKeyPrintable(keycode: number): boolean {
- let valid =
- (keycode > 47 && keycode < 58) || // number keys
- keycode === 32 || keycode === 13 || // spacebar & return key(s) (if you want to allow carriage returns)
- (keycode > 64 && keycode < 91) || // letter keys
- (keycode > 95 && keycode < 112) || // numpad keys
- (keycode > 185 && keycode < 193) || // ;=,-./` (in order)
- (keycode > 218 && keycode < 223); // [\]' (in order)
-
- return valid;
- },
-
- isKeyExplicitlyHandled(key: string): boolean {
- return typeof this['onPress' + key] === 'function';
- },
-
- isCtrlKeyHeldDown(e: SyntheticKeyboardEvent): boolean {
- return e.ctrlKey === true && e.key !== 'Control';
- },
-
- checkAndCall(methodName: string, args: any) {
- if (typeof this[methodName] === 'function') {
- this[methodName](args);
- }
- }
-};
-
-module.exports = KeyboardHandlerMixin;
diff --git a/src/components/ReactDataGrid/OverflowCell.js b/src/components/ReactDataGrid/OverflowCell.js
deleted file mode 100644
index 58f0d1c4b..000000000
--- a/src/components/ReactDataGrid/OverflowCell.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import React from 'react';
-import focusableComponentWrapper from './focusableComponentWrapper';
-import './themes/react-data-grid-cell.scss';
-
-class OverflowCell extends React.Component {
- getStyle() {
- let style = {
- width: this.props.column.width,
- height: this.props.height,
- left: this.props.column.left,
- border: '1px solid #eee'
- };
- return style;
- }
-
- render() {
- return ();
- }
-}
-
-OverflowCell.isSelected = (props) => {
- const { cellMetaData, rowIdx, idx } = props;
- if (cellMetaData == null) { return false; }
-
- const { selected } = cellMetaData;
-
- return selected && selected.rowIdx === rowIdx && selected.idx === idx;
-};
-
-OverflowCell.isScrolling = props => props.cellMetaData.isScrollingHorizontallyWithKeyboard;
-
-OverflowCell.propTypes = {
- rowIdx: React.PropTypes.number,
- idx: React.PropTypes.number,
- height: React.PropTypes.number,
- column: React.PropTypes.object,
- cellMetaData: React.PropTypes.object
-};
-
-OverflowCell.displayName = 'Cell';
-
-const OverflowCellComponent = OverflowCell;
-export default focusableComponentWrapper(OverflowCell);
-export { OverflowCellComponent };
\ No newline at end of file
diff --git a/src/components/ReactDataGrid/OverflowRow.js b/src/components/ReactDataGrid/OverflowRow.js
deleted file mode 100644
index 7f31cc4fd..000000000
--- a/src/components/ReactDataGrid/OverflowRow.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-import focusableComponentWrapper from './focusableComponentWrapper';
-import './themes/react-data-grid-row.scss';
-
-class OverflowRow extends React.Component {
- render() {
- return ( );
- }
-}
-
-OverflowRow.isSelected = props => {
- const { cellMetaData, idx } = props;
- if (cellMetaData == null) { return false; }
-
- const { selected } = cellMetaData;
-
- return selected && selected.rowIdx === idx;
-};
-
-OverflowRow.isScrolling = props => props.cellMetaData.isScrollingVerticallyWithKeyboard;
-
-OverflowRow.propTypes = {
- idx: React.PropTypes.number,
- height: React.PropTypes.number,
- cellMetaData: React.PropTypes.object
-};
-
-const OverflowRowComponent = OverflowRow;
-export default focusableComponentWrapper(OverflowRow);
-export { OverflowRowComponent };
\ No newline at end of file
diff --git a/src/components/ReactDataGrid/PropTypeShapes/CellMetaDataShape.js b/src/components/ReactDataGrid/PropTypeShapes/CellMetaDataShape.js
deleted file mode 100644
index 7dd6fc180..000000000
--- a/src/components/ReactDataGrid/PropTypeShapes/CellMetaDataShape.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const PropTypes = require('react').PropTypes;
-
-module.exports = {
- selected: PropTypes.object.isRequired,
- copied: PropTypes.object,
- dragged: PropTypes.object,
- onCellClick: PropTypes.func.isRequired,
- onCellDoubleClick: PropTypes.func.isRequired,
- onCommit: PropTypes.func.isRequired,
- onCommitCancel: PropTypes.func.isRequired,
- handleDragEnterRow: PropTypes.func.isRequired,
- handleTerminateDrag: PropTypes.func.isRequired
-};
diff --git a/src/components/ReactDataGrid/PropTypeShapes/ExcelColumn.js b/src/components/ReactDataGrid/PropTypeShapes/ExcelColumn.js
deleted file mode 100644
index d53e329c6..000000000
--- a/src/components/ReactDataGrid/PropTypeShapes/ExcelColumn.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/* @flow */
-const React = require('react');
-
-const ExcelColumnShape = {
- name: React.PropTypes.node.isRequired,
- key: React.PropTypes.string.isRequired,
- width: React.PropTypes.number.isRequired,
- filterable: React.PropTypes.bool
-};
-
-module.exports = ExcelColumnShape;
diff --git a/src/components/ReactDataGrid/PropTypeShapes/index.js b/src/components/ReactDataGrid/PropTypeShapes/index.js
deleted file mode 100644
index 3cf44fcc1..000000000
--- a/src/components/ReactDataGrid/PropTypeShapes/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import ExcelColumn from './ExcelColumn';
-
-export default { ExcelColumn };
diff --git a/src/components/ReactDataGrid/ReactDataGrid.js b/src/components/ReactDataGrid/ReactDataGrid.js
deleted file mode 100644
index 367b94260..000000000
--- a/src/components/ReactDataGrid/ReactDataGrid.js
+++ /dev/null
@@ -1,974 +0,0 @@
-/* tslint:disable */
-const React = require('react');
-const ReactDOM = require('react-dom');
-const BaseGrid = require('./Grid');
-const Row = require('./Row');
-const ExcelColumn = require('./PropTypeShapes/ExcelColumn');
-const KeyboardHandlerMixin = require('./KeyboardHandlerMixin');
-const CheckboxEditor = require('./editors/CheckboxEditor');
-const DOMMetrics = require('./DOMMetrics');
-const ColumnMetricsMixin = require('./ColumnMetricsMixin');
-const RowUtils = require('./RowUtils');
-const ColumnUtils = require('./ColumnUtils');
-const KeyCodes = require('./KeyCodes');
-const isFunction = require('./utils/isFunction');
-import AppConstants from './AppConstants';
-require('./themes/react-data-grid-core.scss');
-require('./themes/react-data-grid-checkbox.scss');
-
-if (!Object.assign) {
- Object.assign = require('object-assign');
-}
-
-type SelectedType = {
- rowIdx: number;
- idx: number;
-};
-
-type ColumnEvent = {
- name: string,
- rowIdx: number;
- idx: number;
-}
-
-type DraggedType = {
- idx: number;
- rowIdx: number;
- value: string;
-};
-
-type RowUpdateEvent = {
- keyCode: string;
- changed: {expandedHeight: number};
- rowIdx: number;
-};
-
-const ReactDataGrid = React.createClass({
-
- mixins: [
- ColumnMetricsMixin,
- DOMMetrics.MetricsComputatorMixin,
- KeyboardHandlerMixin
- ],
-
- propTypes: {
- rowHeight: React.PropTypes.number.isRequired,
- headerRowHeight: React.PropTypes.number,
- headerFiltersHeight: React.PropTypes.number,
- minHeight: React.PropTypes.number.isRequired,
- minWidth: React.PropTypes.number,
- enableRowSelect: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.string]),
- onRowUpdated: React.PropTypes.func,
- rowGetter: React.PropTypes.func.isRequired,
- rowsCount: React.PropTypes.number.isRequired,
- toolbar: React.PropTypes.element,
- enableCellSelect: React.PropTypes.bool,
- columns: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.array]).isRequired,
- onFilter: React.PropTypes.func,
- onCellCopyPaste: React.PropTypes.func,
- onCellsDragged: React.PropTypes.func,
- onAddFilter: React.PropTypes.func,
- onGridSort: React.PropTypes.func,
- onDragHandleDoubleClick: React.PropTypes.func,
- onGridRowsUpdated: React.PropTypes.func,
- onRowSelect: React.PropTypes.func,
- rowKey: React.PropTypes.string,
- rowScrollTimeout: React.PropTypes.number,
- onClearFilters: React.PropTypes.func,
- contextMenu: React.PropTypes.element,
- cellNavigationMode: React.PropTypes.oneOf(['none', 'loopOverRow', 'changeRow']),
- onCellSelected: React.PropTypes.func,
- onCellDeSelected: React.PropTypes.func,
- onCellExpand: React.PropTypes.func,
- enableDragAndDrop: React.PropTypes.bool,
- onRowExpandToggle: React.PropTypes.func,
- draggableHeaderCell: React.PropTypes.func,
- getValidFilterValues: React.PropTypes.func,
- rowSelection: React.PropTypes.shape({
- enableShiftSelect: React.PropTypes.bool,
- onRowsSelected: React.PropTypes.func,
- onRowsDeselected: React.PropTypes.func,
- showCheckbox: React.PropTypes.bool,
- selectBy: React.PropTypes.oneOfType([
- React.PropTypes.shape({
- indexes: React.PropTypes.arrayOf(React.PropTypes.number).isRequired
- }),
- React.PropTypes.shape({
- isSelectedKey: React.PropTypes.string.isRequired
- }),
- React.PropTypes.shape({
- keys: React.PropTypes.shape({
- values: React.PropTypes.array.isRequired,
- rowKey: React.PropTypes.string.isRequired
- }).isRequired
- })
- ]).isRequired
- }),
- onRowClick: React.PropTypes.func,
- OnCellClick: React.PropTypes.func,
- onGridKeyUp: React.PropTypes.func,
- onGridKeyDown: React.PropTypes.func,
- rowGroupRenderer: React.PropTypes.func,
- rowActionsCell: React.PropTypes.func,
- onCheckCellIsEditable: React.PropTypes.func,
- /* called before cell is set active, returns a boolean to determine whether cell is editable */
- overScan: React.PropTypes.object,
- onDeleteSubRow: React.PropTypes.func,
- onAddSubRow: React.PropTypes.func
- },
-
- getDefaultProps(): {enableCellSelect: boolean} {
- return {
- enableCellSelect: false,
- tabIndex: -1,
- rowHeight: 35,
- headerFiltersHeight: 45,
- enableRowSelect: false,
- minHeight: 350,
- rowKey: 'id',
- rowScrollTimeout: 0,
- cellNavigationMode: 'none',
- overScan: {
- colsStart: 5,
- colsEnd: 5,
- rowsStart: 5,
- rowsEnd: 5
- }
- };
- },
-
- getInitialState: function(): {selected: SelectedType; copied: ?{idx: number; rowIdx: number}; selectedRows: Array
-
- );
- }
-});
-
-module.exports = Row;
\ No newline at end of file
diff --git a/src/components/ReactDataGrid/RowComparer.js b/src/components/ReactDataGrid/RowComparer.js
deleted file mode 100644
index 451b882f4..000000000
--- a/src/components/ReactDataGrid/RowComparer.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import ColumnMetrics from './ColumnMetrics';
-
-function doesRowContainSelectedCell(props) {
- let selected = props.cellMetaData.selected;
- if (selected && selected.rowIdx === props.idx) {
- return true;
- }
- return false;
-}
-
-function willRowBeDraggedOver(props) {
- let dragged = props.cellMetaData.dragged;
- return dragged != null && (dragged.rowIdx >= 0 || dragged.complete === true);
-}
-
-function hasRowBeenCopied(props) {
- let copied = props.cellMetaData.copied;
- return copied != null && copied.rowIdx === props.idx;
-}
-
-export const shouldRowUpdate = (nextProps, currentProps) => {
- return !(ColumnMetrics.sameColumns(currentProps.columns, nextProps.columns, ColumnMetrics.sameColumn)) ||
- doesRowContainSelectedCell(currentProps) ||
- doesRowContainSelectedCell(nextProps) ||
- willRowBeDraggedOver(nextProps) ||
- nextProps.row !== currentProps.row ||
- currentProps.colDisplayStart !== nextProps.colDisplayStart ||
- currentProps.colDisplayEnd !== nextProps.colDisplayEnd ||
- currentProps.colVisibleStart !== nextProps.colVisibleStart ||
- currentProps.colVisibleEnd !== nextProps.colVisibleEnd ||
- hasRowBeenCopied(currentProps) ||
- currentProps.isSelected !== nextProps.isSelected ||
- nextProps.height !== currentProps.height ||
- currentProps.isOver !== nextProps.isOver ||
- currentProps.expandedRows !== nextProps.expandedRows ||
- currentProps.canDrop !== nextProps.canDrop ||
- currentProps.forceUpdate === true;
-};
-
-export default shouldRowUpdate;
diff --git a/src/components/ReactDataGrid/RowGroup.js b/src/components/ReactDataGrid/RowGroup.js
deleted file mode 100644
index 381b74ff1..000000000
--- a/src/components/ReactDataGrid/RowGroup.js
+++ /dev/null
@@ -1,116 +0,0 @@
-import React, {PropTypes, Component} from 'react';
-import utils from './utils';
-const cellMetaDataShape = require('./PropTypeShapes/CellMetaDataShape');
-
-import './themes/react-data-grid-row.scss';
-
-class RowGroup extends Component {
- constructor(props) {
- super(props);
-
- this.onRowExpandToggle = this.onRowExpandToggle.bind(this);
- this.onRowExpandClick = this.onRowExpandClick.bind(this);
- this.setScrollLeft = this.setScrollLeft.bind(this);
- }
-
- onRowExpandToggle(expand) {
- let shouldExpand = expand == null ? !this.props.isExpanded : expand;
- let meta = this.props.cellMetaData;
- if (meta != null && meta.onRowExpandToggle && typeof(meta.onRowExpandToggle) === 'function') {
- meta.onRowExpandToggle({rowIdx: this.props.idx, shouldExpand: shouldExpand, columnGroupName: this.props.columnGroupName, name: this.props.name});
- }
- }
-
- onRowExpandClick() {
- this.onRowExpandToggle(!this.props.isExpanded);
- }
-
- setScrollLeft(scrollLeft) {
- if (this.rowGroupRenderer) {
- this.rowGroupRenderer.setScrollLeft ? this.rowGroupRenderer.setScrollLeft(scrollLeft) : null;
- }
- }
-
- render() {
- let lastColumn = utils.last(this.props.columns);
-
- let style = {width: lastColumn.left + lastColumn.width};
-
- return (
-
- {
- React.isValidElement(this.props.row) ?
- this.props.row : cells
- }
-