Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup DraggableContainer and fix styles #1379

Merged
merged 2 commits into from Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 25 additions & 17 deletions packages/react-data-grid-addons/src/draggable/DragDropContainer.js
@@ -1,36 +1,44 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import html5DragDropContext from '../shared/html5DragDropContext';
import DraggableHeaderCell from './DraggableHeaderCell';
import RowDragLayer from './RowDragLayer';
import {isColumnsImmutable} from 'common/utils';
import PropTypes from 'prop-types';
import { isColumnsImmutable } from 'common/utils';

class DraggableContainer extends Component {

getRows(rowsCount, rowGetter) {
let rows = [];
const rows = [];
for (let j = 0; j < rowsCount; j++) {
rows.push(rowGetter(j));
}
return rows;
}

renderGrid() {
return React.Children.map(this.props.children, (child) => {
return React.cloneElement(child, { draggableHeaderCell: DraggableHeaderCell });
})[0];
return React.cloneElement(
React.Children.only(this.props.children), {
draggableHeaderCell: DraggableHeaderCell
}
);
}

render() {
let grid = this.renderGrid();
let rowGetter = this.props.getDragPreviewRow || grid.props.rowGetter;
let rowsCount = grid.props.rowsCount;
let columns = grid.props.columns;
let rows = this.getRows(rowsCount, rowGetter);
return (<div>
{grid}
<RowDragLayer rowSelection={grid.props.rowSelection} rows={rows} columns={isColumnsImmutable(columns) ? columns.toArray() : columns} />
</div>);
const grid = this.renderGrid();
const rowGetter = this.props.getDragPreviewRow || grid.props.rowGetter;
const rowsCount = grid.props.rowsCount;
const columns = grid.props.columns;
const rows = this.getRows(rowsCount, rowGetter);
return (
<div>
{grid}
<RowDragLayer
rowSelection={grid.props.rowSelection}
rows={rows}
columns={isColumnsImmutable(columns) ? columns.toArray() : columns}
/>
</div>
);
}
}

Expand Down
12 changes: 5 additions & 7 deletions themes/react-data-grid-drop-target.css
@@ -1,12 +1,10 @@
.slideUp{
animation-name: slideUp;
.slideUp {
-webkit-animation-name: slideUp;

animation-duration: 1s;
animation-name: slideUp;
-webkit-animation-duration: 1s;

animation-timing-function: ease;
animation-duration: 1s;
-webkit-animation-timing-function: ease;
animation-timing-function: ease;

visibility: visible !important;
}
Expand Down Expand Up @@ -60,4 +58,4 @@
width: 100%;
z-index: 1;
border-bottom: 1px solid black;
}
}