Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Enhancement] Replace react-data-grid with react-virtualized (#629)

Giuseppe Macrì96b889e42d65
diff --git a/package.json b/package.json
index e66fd2732..f16feea4b 100644
--- a/package.json
+++ b/package.json
@@ -83,7 +83,6 @@
"d3-hexbin": "^0.2.2",
"d3-request": "^1.0.6",
"d3-scale": "^1.0.6",
- "luma.gl": "^7.1.1",
"deck.gl": "^7.1.5",
"fuzzy": "^0.1.3",
"global": "^4.3.0",
@@ -97,11 +96,11 @@
"lodash.pick": "^4.4.0",
"lodash.throttle": "^4.1.1",
"lodash.uniq": "^4.0.1",
+ "luma.gl": "^7.1.1",
"mini-svg-data-uri": "^1.0.3",
"moment": "^2.10.6",
"pbf": "^3.1.0",
"prop-types": "^15.6.0",
- "react-data-grid": "2.0.80-am-fix-defaultprops-warnings3337",
"react-file-drop": "^0.1.9",
"react-json-pretty": "^1.7.9",
"react-map-gl": "^5.0.3",
@@ -112,6 +111,7 @@
"react-redux": "^5.1.1",
"react-sortable-hoc": "^1.8.3",
"react-tooltip": "^3.10.0",
+ "react-virtualized": "^9.21.1",
"react-vis": "^1.8.0",
"redux": "^3.0.4",
"redux-actions": "^2.2.1",
@@ -152,8 +152,8 @@
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@babel/traverse": "^7.2.3",
- "@probe.gl/test-utils": "^3.0.1",
"@deck.gl/test-utils": "^7.1.5",
+ "@probe.gl/test-utils": "^3.0.1",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.0",
"babel-plugin-istanbul": "^5.1.1",
diff --git a/src/components/common/datagrid.js b/src/components/common/datagrid.js
new file mode 100644
index 000000000..91a2aea3d
--- /dev/null
+++ b/src/components/common/datagrid.js
@@ -0,0 +1,172 @@
+// Copyright (c) 2019 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import React, {PureComponent} from 'react';
+import PropTypes from 'prop-types';
+import {MultiGrid} from 'react-virtualized';
+import styled, {withTheme}from 'styled-components';
+import FieldToken from 'components/common/field-token';
+import {Clock} from 'components/common/icons/index';
+import {ALL_FIELD_TYPES} from 'constants/default-settings';
+
+const DataGridWrapper = styled.div`
+ .ReactVirtualized__Grid:focus,
+ .ReactVirtualized__Grid:active {
+ outline: 0;
+ }
+ .ReactVirtualized__Grid__innerScrollContainer {
+ ${props => props.theme.modalScrollBar};
+ }
+`;
+
+const StyledFieldHeader = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ border-right: 0;
+ border-bottom: 0;
+ background: ${props => props.theme.panelBackgroundLT};
+ color: ${props => props.theme.titleColorLT};
+ height: 100%;
+
+ .label-wrapper {
+ display: flex;
+ align-items: center;
+ }
+
+ .icon-wrapper {
+ marginRight: ${props => props.type === 'timestamp' ? '2px' : '0'};
+ height: 16px;
+ }
+`;
+
+const FieldHeaderTemplate = ({name, type}) => (
+ <StyledFieldHeader type={type}>
+ <div className="label-wrapper">
+ <div className="icon-wrapper">
+ {type === 'timestamp' ? <Clock height="16px" /> : null}
+ </div>
+ <span>{name}</span>
+ </div>
+ <div className="field-wrapper">
+ <FieldToken type={type} />
+ </div>
+ </StyledFieldHeader>
+);
+
+export const FieldHeaderFactory = () => FieldHeaderTemplate;
+
+const StyledCell = styled.div`
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ border-right: 0;
+ border-bottom: ${props => props.theme.panelBorderLT};
+ color: ${props => props.theme.labelColorLT};
+ text-overflow: ellipsis;
+ white-space: pre-wrap;
+ word-wrap: break-spaces;
+ height: 100%;
+`;
+
+const CellTemplate = ({name, type}) => {
+ const value = type === ALL_FIELD_TYPES.boolean ? String(name) : name;
+ return (<StyledCell title={value}><span>{value}</span></StyledCell>);
+};
+
+export const CellFactory = () => CellTemplate;
+
+DataGridFactory.deps = [
+ FieldHeaderFactory,
+ CellFactory
+];
+
+function DataGridFactory(
+ FieldHeader,
+ Cell
+) {
+ class DataGrid extends PureComponent {
+ static propTypes = {
+ theme: PropTypes.object,
+ columns: PropTypes.arrayOf(PropTypes.object).isRequired,
+ height: PropTypes.number.isRequired,
+ rows: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.any)).isRequired,
+ width: PropTypes.number.isRequired
+ };
+
+ _cellRenderer = ({columnIndex, key, rowIndex, style}) => {
+ const {columns, rows} = this.props;
+
+ // rowIndex -1 because data rows start rendering at index 1 and we normalize back using the -1 param
+ const className = `${rowIndex === 0
+ ? `header-${columnIndex}`
+ : `row-${rowIndex-1}`} column-${columnIndex}`;
+
+ const type = columns[columnIndex].type;
+
+ return (
+ <div key={key} style={style} className={className}>
+ {rowIndex === 0
+ ? (<FieldHeader className={`header-cell ${type}`} name={columns[columnIndex].name} type={type} />)
+ : (<Cell className={`cell ${type}`} name={rows[rowIndex - 1][columnIndex]} type={type} />)
+ }
+ </div>
+ );
+ };
+
+ _rowHeight = ({index}) => index === 0
+ ? this.props.theme.cellHeaderHeight
+ : this.props.theme.cellHeight;
+
+ render() {
+ const {columns, height, rows, theme, width} = this.props;
+
+ return (
+ <DataGridWrapper className="datagrid-wrapper">
+ <MultiGrid
+ cellRenderer={this._cellRenderer}
+ columnWidth={theme.columnWidth}
+ columnCount={columns.length}
+ fixedRowCount={1}
+ enableFixedRowScroll={true}
+ width={width || theme.gridDefaultWidth}
+ height={height || theme.gridDefaultHeight}
+ rowHeight={this._rowHeight}
+ rowCount={rows.length + 1}
+ hideTopRightGridScrollbar={true}
+ hideBottomLeftGridScrollbar={true}
+ />
+ </DataGridWrapper>
+ );
+ }
+ }
+
+ DataGrid.displayName = 'DataGrid';
+
+ // Wrapping the component using withTheme because we need to
+ // access variables outside sytled-components context
+ return withTheme(DataGrid);
+}
+
+export default DataGridFactory;
diff --git a/src/components/common/modal.js b/src/components/common/modal.js
index 43edf9b9e..129ed8870 100644
--- a/src/components/common/modal.js
+++ b/src/components/common/modal.js
@@ -29,7 +29,7 @@ import {media} from 'styles/media-breakpoints';
const ModalContentWrapper = styled.div`
overflow-y: scroll;
- max-width: 960px;
+ max-width: 70vw;
max-height: 70vh;
padding: 24px 72px 40px;
position: relative;
@@ -43,10 +43,17 @@ const ModalContentWrapper = styled.div`
box-sizing: border-box;
font-size: 12px;
color: ${props => props.theme.labelColorLT};
- ${props => props.cssStyle || ''};
+
${media.portable`
padding: 12px 36px 24px;
+ max-width: 80vw;
+ `}
+
+ ${media.palm`
+ max-width: 100vw;
`}
+
+ ${props => props.cssStyle || ''};
`;
const ModalContent = styled.div`
diff --git a/src/components/map/layer-hover-info.js b/src/components/map/layer-hover-info.js
index f2c723e8c..930a95592 100644
--- a/src/components/map/layer-hover-info.js
+++ b/src/components/map/layer-hover-info.js
@@ -17,6 +17,7 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+
import React from 'react';
import styled from 'styled-components';
import {CenterFlexbox} from 'components/common/styled-components';
diff --git a/src/components/modal-container.js b/src/components/modal-container.js
index b168a8bc4..fcda36d43 100644
--- a/src/components/modal-container.js
+++ b/src/components/modal-container.js
@@ -56,15 +56,16 @@ import {
import {EXPORT_MAP_FORMAT} from '../constants/default-settings';
const DataTableModalStyle = css`
- height: 85%;
- width: 90%;
top: 80px;
padding: 32px 0 0 0;
- max-width: unset;
+
+ ${media.portable`
+ padding: 0;
+ `}
+
${media.palm`
- width: 100vw;
padding: 0;
- margin: 0;
+ margin: 0 auto;
`}
`;
@@ -252,6 +253,7 @@ export default function ModalContainerFactory(
} else {
switch (currentModal) {
case DATA_TABLE_ID:
+ const width = containerW * 0.9;
template = (
<DataTableModal
width={containerW * 0.9}
@@ -261,7 +263,14 @@ export default function ModalContainerFactory(
showDatasetTable={visStateActions.showDatasetTable}
/>
);
- modalProps.cssStyle = DataTableModalStyle;
+
+ // TODO: we need to make this width consistent with the css rule defined modal.js:32 max-width: 70vw
+ modalProps.cssStyle = css`
+ ${DataTableModalStyle};
+ ${media.palm`
+ width: ${width}px;
+ `}
+ `;
break;
case DELETE_DATA_ID:
// validate options
diff --git a/src/components/modals/data-table-modal.js b/src/components/modals/data-table-modal.js
index bb0a9c6d2..98c218d08 100644
--- a/src/components/modals/data-table-modal.js
+++ b/src/components/modals/data-table-modal.js
@@ -18,195 +18,25 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React, {Component} from 'react';
+import React from 'react';
import styled from 'styled-components';
-import window from 'global/window';
-
-import {ALL_FIELD_TYPES} from 'constants/default-settings';
-import FieldToken from 'components/common/field-token';
+import DataGridFactory from 'components/common/datagrid';
import DatasetLabel from 'components/common/dataset-label';
-import {Clock} from 'components/common/icons/index';
-
-// Breakpoints
-import {media} from 'styles/media-breakpoints';
-
-const ReactDataGrid = window.navigator ? require('react-data-grid/dist/react-data-grid.min') : null;
-
-let shouldPreventScrollBack = false;
-
-if (window.navigator && window.navigator.userAgent) {
- const {navigator} = window;
- // Detect browsers
- // http://stackoverflow.com/questions/5899783/detect-safari-using-jquery
- const isMac = navigator.userAgent.match(/Macintosh/);
- const is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
- const is_safari = navigator.userAgent.indexOf('Safari') > -1;
- const is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
-
- // prevent chrome scroll back
- shouldPreventScrollBack = isMac && (is_chrome || is_safari || is_firefox);
-}
const dgSettings = {
- sidePadding: '38px'
+ sidePadding: '38px',
+ verticalPadding: '16px',
+ height: '36px'
};
-const DataGridWrapper = styled.div`
- .react-grid-Main {
- outline: 0;
- }
-
- .react-grid-Grid {
- border: 0;
- }
-
- .react-grid-Cell {
- border-right: 0;
- border-bottom: ${props => props.theme.panelBorderLT};
- padding-left: 16px;
- }
-
- .react-grid-HeaderCell {
- border-right: 0;
- border-bottom: 0;
- background: ${props => props.theme.panelBackgroundLT};
- color: ${props => props.theme.titleColorLT};
- padding: 14px 8px 14px 0;
- }
- .react-grid-Cell:first-child,
- .react-grid-HeaderCell:first-child {
- padding-left: ${dgSettings.sidePadding};
- }
- .react-grid-Cell:last-child,
- .react-grid-HeaderCell:last-child {
- padding-right: ${dgSettings.sidePadding};
- }
- .react-grid-Cell__value {
- color: ${props => props.theme.labelColorLT};
- }
- .react-grid-Canvas {
- ${props => props.theme.modalScrollBar};
- }
-
- ${media.palm`
- .react-grid-Container {
- /* TODO: replace data-grid component with react-window */
- /* We need to use important in this case to override data-grid styling */
- width: 100vw !important;
- }
- `};
-
-`;
const StyledModal = styled.div`
- ${media.palm`
- margin: 0 -36px;
- `}
+ min-height: 70vh;
+ overflow: hidden;
`;
-const BooleanFormatter = ({value}) => <span>{String(value)}</span>;
-
-export class DataTableModal extends Component {
-
- constructor(props) {
- super(props);
- this._root = React.createRef();
- }
-
- _onMouseWheel = e => {
- // Prevent futile scroll, which would trigger the Back/Next page event
- // https://github.com/micho/jQuery.preventMacBackScroll
- // This prevents scroll when reaching the topmost or leftmost
- // positions of a container.
-
- // react-data-grid canvas element can be scrolled
- const canvas = this._root.querySelector('.react-grid-Canvas');
-
- // If canvas can not be scrolled left anymore when we try to scroll left
- const prevent_left = e.deltaX < 0 && canvas.scrollLeft <= 0;
- // If canvas can not be scrolled up when we try to scroll up
- const prevent_up = e.deltaY < 0 && canvas.scrollTop <= 0;
-
- if (prevent_left || prevent_up) {
- e.preventDefault();
- }
- };
-
- render() {
- const {datasets, dataId, showDatasetTable} = this.props;
-
- if (!datasets || !dataId) {
- return null;
- }
-
- const activeDataset = datasets[dataId];
- // TODO: this should be all data
- const rows = activeDataset.data;
- const columns = activeDataset.fields
- .map((field, i) => ({
- ...field,
- key: i,
- headerRenderer: <FieldHeader {...field} />,
- resizable: true,
- formatter:
- field.type === ALL_FIELD_TYPES.boolean ? BooleanFormatter : undefined
- }))
- .filter(({name}) => name !== '_geojson');
-
- return (
- <StyledModal ref={this._root} className="dataset-modal" style={{overflow: 'scroll'}}>
- <DatasetTabs
- activeDataset={activeDataset}
- datasets={datasets}
- showDatasetTable={showDatasetTable}
- />
- <DataGridWrapper
- onWheel={shouldPreventScrollBack ? this._onMouseWheel : null}
- >
- {ReactDataGrid && (
- <ReactDataGrid
- headerRowHeight={72}
- columns={columns}
- minColumnWidth={172}
- minWidth={this.props.width}
- minHeight={this.props.height - 65}
- rowGetter={i => rows[i]}
- rowHeight={48}
- rowsCount={rows.length}
- />
- )}
- </DataGridWrapper>
- </StyledModal>
- );
- }
-}
-
-const tagContainerStyle = {
- display: 'flex',
- flexDirection: 'column',
- justifyContent: 'space-between'
-};
-
-const FieldHeader = ({name, type}) => (
- <div style={tagContainerStyle}>
- <div style={{display: 'flex', alignItems: 'center'}}>
- <div
- style={{
- marginRight: type === 'timestamp' ? '2px' : '18px',
- height: '16px'
- }}
- >
- {type === 'timestamp' ? <Clock height="16px" /> : null}
- </div>
- {name}
- </div>
- <div style={{marginLeft: '18px'}}>
- <FieldToken type={type} />
- </div>
- </div>
-);
const DatasetCatalog = styled.div`
display: flex;
- padding: 0 ${dgSettings.sidePadding};
+ padding: ${dgSettings.verticalPadding} ${dgSettings.sidePadding} 0;
`;
export const DatasetModalTab = styled.div`
@@ -224,7 +54,7 @@ export const DatasetModalTab = styled.div`
}
`;
-export const DatasetTabs = ({activeDataset, datasets, showDatasetTable}) => (
+export const DatasetTabs = React.memo(({activeDataset, datasets, showDatasetTable}) => (
<DatasetCatalog className="dataset-modal-catalog">
{Object.values(datasets).map(dataset => (
<DatasetModalTab
@@ -237,7 +67,51 @@ export const DatasetTabs = ({activeDataset, datasets, showDatasetTable}) => (
</DatasetModalTab>
))}
</DatasetCatalog>
-);
+));
+
+DatasetTabs.displayName = 'DatasetTabs';
+
+DataTableModalFactory.deps = [
+ DataGridFactory
+];
+
+function DataTableModalFactory(DataGrid) {
+ const DataTableModal = ({
+ datasets,
+ dataId,
+ height,
+ showDatasetTable,
+ width
+ }) => {
+ if (!datasets || !dataId) {
+ return null;
+ }
+
+ const activeDataset = datasets[dataId];
+ const rows = activeDataset.data;
+
+ const columns = activeDataset.fields
+ .filter(({name}) => name !== '_geojson');
+
+ return (
+ <StyledModal className="dataset-modal" >
+ <DatasetTabs
+ activeDataset={activeDataset}
+ datasets={datasets}
+ showDatasetTable={showDatasetTable}
+ />
+ <DataGrid
+ width={width}
+ height={height}
+ rows={rows}
+ columns={columns}
+ />
+ </StyledModal>
+ );
+ };
+
+ return DataTableModal;
+}
-const DataTableModalFactory = () => DataTableModal;
export default DataTableModalFactory;
+
diff --git a/src/styles/base.js b/src/styles/base.js
index 1fd31cdf2..07079bfd3 100644
--- a/src/styles/base.js
+++ b/src/styles/base.js
@@ -225,6 +225,13 @@ export const notificationPanelWidth = 240;
export const notificationPanelItemWidth = notificationPanelWidth - 60;
export const notificationPanelItemHeight = 60;
+// Datagrid
+const columnWidth = 200;
+const cellHeaderHeight = 72;
+const cellHeight = 48;
+const gridDefaultWidth = 800;
+const gridDefaultHeight = 600;
+
export const textTruncate = {
maxWidth: '100%',
overflow: 'hidden',
@@ -949,6 +956,13 @@ export const theme = {
notificationPanelItemWidth,
notificationPanelItemHeight,
+ // datagrid
+ columnWidth,
+ cellHeaderHeight,
+ cellHeight,
+ gridDefaultWidth,
+ gridDefaultHeight,
+
// Breakpoints
breakPoints
};
diff --git a/test/browser/components/data-table-model-test.js b/test/browser/components/data-table-modal-test.js
similarity index 52%
rename from test/browser/components/data-table-model-test.js
rename to test/browser/components/data-table-modal-test.js
index a2ad2540c..04daa2209 100644
--- a/test/browser/components/data-table-model-test.js
+++ b/test/browser/components/data-table-modal-test.js
@@ -21,37 +21,45 @@
import React from 'react';
import test from 'tape';
import {mount} from 'enzyme';
+import {mountWithTheme} from 'test/helpers/component-utils';
import DataTableModalFactory, {DatasetTabs, DatasetModalTab} from
'components/modals/data-table-modal';
-import ReactDataGrid from 'react-data-grid/dist/react-data-grid.min';
+import DataGridFactory, {FieldHeaderFactory, CellFactory} from 'components/common/datagrid';
-const DataTableModal = DataTableModalFactory();
+const FieldHeader = FieldHeaderFactory();
+const Cell = CellFactory();
+const DataGrid = DataGridFactory(FieldHeader, Cell);
+const DataTableModal = DataTableModalFactory(DataGrid);
import {testFields, testAllData} from 'test/fixtures/test-csv-data';
+// This makes sure react-virtualized renders the full grid
+const WIDTH = 1400;
+const HEIGHT = 800;
+const rows = 10;
+
/* eslint-disable max-statements */
test('Components -> DataTableModal.render', t => {
-
t.doesNotThrow(() => {
- mount(
+ mountWithTheme(
<DataTableModal
- width={400}
- height={400}
+ width={WIDTH}
+ height={HEIGHT}
/>
);
}, 'Show not fail without data');
- const wrapper = mount(
+ const wrapper = mountWithTheme(
<DataTableModal
- width={800}
- height={400}
+ width={WIDTH}
+ height={HEIGHT}
datasets={{
smoothie: {
id: 'smoothie',
allData: testAllData,
fields: testFields,
color: [113, 113, 113],
- data: testAllData.slice(0, 10)
+ data: testAllData.slice(0, rows)
}
}}
dataId="smoothie"
@@ -59,60 +67,52 @@ test('Components -> DataTableModal.render', t => {
);
t.equal(wrapper.find(DataTableModal).length, 1, 'should render DataTableModal data');
- t.equal(wrapper.find(ReactDataGrid).length, 1, 'should render ReactDataGrid data');
t.equal(wrapper.find(DatasetTabs).length, 1, 'should render DatasetTabs');
t.equal(wrapper.find(DatasetModalTab).length, 1, 'should render 1 dataset-modal-catalog');
- t.equal(wrapper.find('.react-grid-Row').length, 10, 'should render 10 rows');
-
- const expectedRow0 = [
- '2016-09-17 00:09:55',
- '29.9900937',
- '31.2590542',
- 'driver_analytics',
- '1472688000000',
- 'false',
- '1',
- '2016-09-23T00:00:00.000Z',
- '2016-10-01 09:41:39+00:00',
- '2016-10-01 09:41:39+00:00',
- '2016-09-23'
- ];
-
- const expectedRow2 = [
- '2016-09-17 00:11:56',
- '29.9907261',
- '31.2312742',
- 'driver_analytics',
- '1472688000000',
- 'false',
- '3',
- '2016-09-23T00:00:00.000Z',
- '',
- '',
- '2016-09-23'
- ];
- const row0 = wrapper.find('.react-grid-Row').at(0);
- const row2 = wrapper.find('.react-grid-Row').at(2);
-
- const cells = row0.find('.react-grid-Cell');
- t.equal(cells.length, 11, 'should render 11 cells');
-
- for (let c = 0; c < cells.length; c++) {
- const cell = row0.find('.react-grid-Cell').at(c).find('span');
- const cellText = cell.length > 1 ? cell.at(1).text() : cell.text();
-
- t.equal(cellText, expectedRow0[c], `should render cell ${expectedRow0[c]} correctly`);
- }
-
- const cells2 = row2.find('.react-grid-Cell');
- t.equal(cells2.length, 11, 'should render 11 cells');
-
- for (let c = 0; c < cells2.length; c++) {
- const cell = row2.find('.react-grid-Cell').at(c).find('span');
- const cellText = cell.length > 1 ? cell.at(1).text() : cell.text();
-
- t.equal(cellText, expectedRow2[c], `should render cell ${expectedRow2[c]} correctly`);
- }
+ t.equal(wrapper.find('.header-cell').length, testFields.length, `should render ${testFields.length} headers`);
+ t.equal(wrapper.find('.cell').length, testFields.length * rows, `should render ${testFields.length * rows} cells`);
+ t.equal(wrapper.find('.cell.boolean').length, 10, 'should render 10 cells');
+
+ const expectedRows = {
+ 0: [
+ '2016-09-17 00:09:55',
+ '29.9900937',
+ '31.2590542',
+ 'driver_analytics',
+ '1472688000000',
+ 'false',
+ '1',
+ '2016-09-23T00:00:00.000Z',
+ '2016-10-01 09:41:39+00:00',
+ '2016-10-01 09:41:39+00:00',
+ '2016-09-23'
+ ],
+ 2: [
+ '2016-09-17 00:11:56',
+ '29.9907261',
+ '31.2312742',
+ 'driver_analytics',
+ '1472688000000',
+ 'false',
+ '3',
+ '2016-09-23T00:00:00.000Z',
+ '',
+ '',
+ '2016-09-23'
+ ]
+ };
+
+ Object.entries(expectedRows).forEach(keyAndRow => {
+ const [index, expectedRow] = keyAndRow;
+
+ const cells = wrapper.find(`.row-${index}`);
+ t.equal(cells.length, 11, 'should render 11 cells');
+
+ for (let c = 0; c < cells.length; c++) {
+ const cellText = cells.at(c).find('span').text();
+ t.equal(cellText, expectedRow[c], `should render cell ${expectedRow[c]} correctly`);
+ }
+ });
t.end();
});
diff --git a/test/browser/components/index.js b/test/browser/components/index.js
index e69f43cbd..2178fe0ac 100644
--- a/test/browser/components/index.js
+++ b/test/browser/components/index.js
@@ -25,7 +25,7 @@ configure({adapter: new Adapter()});
import './injector-test';
import './container-test';
-import './data-table-model-test';
+import './data-table-modal-test';
import './notifications';
import './kepler-gl-test';
import './map';
diff --git a/yarn.lock b/yarn.lock
index a6a6cb434..c3be05c24 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2424,6 +2424,11 @@ cloneable-readable@^1.0.0:
process-nextick-args "^2.0.0"
readable-stream "^2.3.5"
+clsx@^1.0.1:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.0.4.tgz#0c0171f6d5cb2fe83848463c15fcc26b4df8c2ec"
+ integrity sha512-1mQ557MIZTrL/140j+JVdRM6e31/OA4vTYxXgqIIZlndyfjHpyawKZia1Im05Vp9BWmImkcNrNtFYQMyFcgJDg==
+
code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
@@ -3259,6 +3264,13 @@ documentation@^9.1.1:
vue-template-compiler "^2.5.16"
yargs "^12.0.2"
+"dom-helpers@^2.4.0 || ^3.0.0":
+ version "3.4.0"
+ resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8"
+ integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA==
+ dependencies:
+ "@babel/runtime" "^7.1.2"
+
dom-serializer@0, dom-serializer@~0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0"
@@ -3405,16 +3417,18 @@ entities@^1.1.1, entities@~1.1.1:
resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56"
enzyme-adapter-react-16@^1.10.0:
- version "1.13.0"
- resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.13.0.tgz#530e4aed3c127d7a7c5c7f4f634ad9ba65f719f6"
+ version "1.14.0"
+ resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.14.0.tgz#204722b769172bcf096cb250d33e6795c1f1858f"
+ integrity sha512-7PcOF7pb4hJUvjY7oAuPGpq3BmlCig3kxXGi2kFx0YzJHppqX1K8IIV9skT1IirxXlu8W7bneKi+oQ10QRnhcA==
dependencies:
enzyme-adapter-utils "^1.12.0"
+ has "^1.0.3"
object.assign "^4.1.0"
object.values "^1.1.0"
prop-types "^15.7.2"
react-is "^16.8.6"
react-test-renderer "^16.0.0-0"
- semver "^5.6.0"
+ semver "^5.7.0"
enzyme-adapter-utils@^1.12.0:
version "1.12.0"
@@ -5527,6 +5541,11 @@ levn@^0.3.0, levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"
+ version "0.0.1"
+ resolved "https://registry.yarnpkg.com/linear-layout-vector/-/linear-layout-vector-0.0.1.tgz#398114d7303b6ecc7fd6b273af7b8401d8ba9c70"
+ integrity sha1-OYEU1zA7bsx/1rJzr3uEAdi6nHA=
+
livereload-js@^2.3.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/livereload-js/-/livereload-js-2.4.0.tgz#447c31cf1ea9ab52fc20db615c5ddf678f78009c"
@@ -5661,7 +5680,7 @@ longest-streak@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.3.tgz#3de7a3f47ee18e9074ded8575b5c091f5d0a4105"
-loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
+loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
dependencies:
@@ -7324,10 +7343,6 @@ re-emitter@^1.0.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/re-emitter/-/re-emitter-1.1.3.tgz#fa9e319ffdeeeb35b27296ef0f3d374dac2f52a7"
- version "2.0.80-am-fix-defaultprops-warnings3337"
- resolved "https://registry.yarnpkg.com/react-data-grid/-/react-data-grid-2.0.80-am-fix-defaultprops-warnings3337.tgz#a822e6266f828e66946827e69ee7ea5ba8db4bf2"
-
react-deep-force-update@^2.1.1:
version "2.1.3"
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-2.1.3.tgz#740612322e617bcced38f61794a4af75dc3d98e7"
@@ -7368,7 +7383,7 @@ react-json-pretty@^1.7.9:
dependencies:
create-react-class "^15.5.2"
-react-lifecycles-compat@^3.0.0:
+react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
@@ -7481,6 +7496,20 @@ react-tooltip@^3.10.0:
react-virtualized-auto-sizer@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/react-virtualized-auto-sizer/-/react-virtualized-auto-sizer-1.0.2.tgz#a61dd4f756458bbf63bd895a92379f9b70f803bd"
+ integrity sha512-MYXhTY1BZpdJFjUovvYHVBmkq79szK/k7V3MO+36gJkWGkrXKtyr4vCPtpphaTLRAdDNoYEYFZWE8LjN+PIHNg==
+
+react-virtualized@^9.21.1:
+ version "9.21.1"
+ resolved "https://registry.yarnpkg.com/react-virtualized/-/react-virtualized-9.21.1.tgz#4dbbf8f0a1420e2de3abf28fbb77120815277b3a"
+ integrity sha512-E53vFjRRMCyUTEKuDLuGH1ld/9TFzjf/fFW816PE4HFXWZorESbSTYtiZz1oAjra0MminaUU1EnvUxoGuEFFPA==
+ dependencies:
+ babel-runtime "^6.26.0"
+ clsx "^1.0.1"
+ dom-helpers "^2.4.0 || ^3.0.0"
+ linear-layout-vector "0.0.1"
+ loose-envify "^1.3.0"
+ prop-types "^15.6.0"
+ react-lifecycles-compat "^3.0.4"
react-vis@^1.8.0:
version "1.11.7"
@@ -8117,7 +8146,7 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"
-"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
+"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0:
version "5.7.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"