diff --git a/examples/demos/example08-sortable-cols.js b/examples/demos/example08-sortable-cols.js index 715b8284fb..c367295569 100644 --- a/examples/demos/example08-sortable-cols.js +++ b/examples/demos/example08-sortable-cols.js @@ -14,37 +14,31 @@ export default class extends React.Component { { key: 'task', name: 'Title', - width: 200, sortable: true }, { key: 'priority', name: 'Priority', - width: 200, sortable: true }, { key: 'issueType', name: 'Issue Type', - width: 200, sortable: true }, { key: 'complete', name: '% Complete', - width: 200, sortable: true }, { key: 'startDate', name: 'Start Date', - width: 200, sortable: true }, { key: 'completeDate', name: 'Expected Complete', - width: 200, sortable: true } ]; diff --git a/examples/demos/example27-cell-actions.js b/examples/demos/example27-cell-actions.js index 87164fc0b8..71e82ee9f6 100644 --- a/examples/demos/example27-cell-actions.js +++ b/examples/demos/example27-cell-actions.js @@ -1,6 +1,7 @@ import React from 'react'; import ReactDataGrid from 'react-data-grid'; import { Data, Formatters } from 'react-data-grid-addons'; +import { Clear, Link, FileCopy } from '@material-ui/icons'; import faker from 'faker'; import Wrapper from './Wrapper'; @@ -133,18 +134,18 @@ export default class extends React.Component { if (column.key === 'county' && row.id === 'id_0') { return [ { - icon: , + icon: , callback() { alert('Deleting'); } }, { - icon: , + icon: , actions: [ { text: 'Edit Cell', callback() { alert('Edit Cell'); } }, { - text: <> Copy Cell, + text: <> Copy Cell, callback() { alert('Copied'); } } ] diff --git a/jest.config.js b/jest.config.js index 91fec3a368..7721538ef7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -23,6 +23,7 @@ module.exports = { moduleNameMapper: { '^react-data-grid$': '/packages/react-data-grid/src/', '^react-data-grid-addons$': '/packages/react-data-grid-addons/src/', + '^@material-ui/icons$': '/test/iconsMock.ts', '\\.css$': '/test/fileMock.js' }, setupFiles: [ diff --git a/packages/react-data-grid-addons/package.json b/packages/react-data-grid-addons/package.json index 3bc52559b2..5f2ec7b75c 100644 --- a/packages/react-data-grid-addons/package.json +++ b/packages/react-data-grid-addons/package.json @@ -25,7 +25,7 @@ "build": "tsc" }, "dependencies": { - "lodash": "^4.17.11", + "lodash": "^4.17.15", "prop-types": "^15.7.2", "react-contextmenu": "^2.11.0", "react-data-grid": "^7.0.0-alpha.20", diff --git a/packages/react-data-grid-addons/src/cells/headerCells/filters/NumericFilter.tsx b/packages/react-data-grid-addons/src/cells/headerCells/filters/NumericFilter.tsx index abc2cf8008..97c87ae3c9 100644 --- a/packages/react-data-grid-addons/src/cells/headerCells/filters/NumericFilter.tsx +++ b/packages/react-data-grid-addons/src/cells/headerCells/filters/NumericFilter.tsx @@ -45,31 +45,19 @@ export default function NumericFilter({ column, onChange }: Props) { } const inputKey = `header-filter-${column.key as keyof R}`; - const columnStyle: React.CSSProperties = { - float: 'left', - marginRight: 5, - maxWidth: '80%' - }; - const badgeStyle: React.CSSProperties = { - cursor: 'help' - }; const tooltipText = 'Input Methods: Range (x-y), Greater Then (>x), Less Then ( -
- -
-
- ? -
+
+ + ?
); } diff --git a/packages/react-data-grid-addons/src/draggable-header/DraggableHeaderCell.js b/packages/react-data-grid-addons/src/draggable-header/DraggableHeaderCell.js index d81e1ef17b..aa40e90ea2 100644 --- a/packages/react-data-grid-addons/src/draggable-header/DraggableHeaderCell.js +++ b/packages/react-data-grid-addons/src/draggable-header/DraggableHeaderCell.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import classNames from 'classnames'; import { DragSource, DropTarget } from 'react-dnd'; class DraggableHeaderCell extends React.Component { @@ -21,18 +22,13 @@ class DraggableHeaderCell extends React.Component { canDrop } = this.props; - let opacity = 1; - if (isDragging) { - opacity = 0.2; - } - // set drag source and drop target on header cell // width: 0 - otherwise drag clone was wrongly positioned return connectDragSource( connectDropTarget(
{this.props.children}
diff --git a/packages/react-data-grid-addons/src/draggable/DraggableHeaderCell.js b/packages/react-data-grid-addons/src/draggable/DraggableHeaderCell.js index b7c4f9ba33..ddc8454d89 100644 --- a/packages/react-data-grid-addons/src/draggable/DraggableHeaderCell.js +++ b/packages/react-data-grid-addons/src/draggable/DraggableHeaderCell.js @@ -23,7 +23,7 @@ class DraggableHeaderCell extends Component { if (isDragging) { return null; } - return connectDragSource(
{this.props.children}
); + return connectDragSource(
{this.props.children}
); } } diff --git a/packages/react-data-grid-addons/src/draggable/RowDragLayer.js b/packages/react-data-grid-addons/src/draggable/RowDragLayer.js index 16e4b4706c..576478180e 100644 --- a/packages/react-data-grid-addons/src/draggable/RowDragLayer.js +++ b/packages/react-data-grid-addons/src/draggable/RowDragLayer.js @@ -69,9 +69,9 @@ class CustomDragLayer extends Component { if (c.formatter) { const Formatter = c.formatter; const dependentValues = typeof c.getRowMetaData === 'function' ? c.getRowMetaData(item, c) : {}; - cells.push(); + cells.push(); } else { - cells.push({item[c.key]}); + cells.push({item[c.key]}); } } }); diff --git a/packages/react-data-grid-addons/src/editors/DropDownEditor.js b/packages/react-data-grid-addons/src/editors/DropDownEditor.js index d8be16c4e6..0f1f731600 100644 --- a/packages/react-data-grid-addons/src/editors/DropDownEditor.js +++ b/packages/react-data-grid-addons/src/editors/DropDownEditor.js @@ -63,7 +63,7 @@ export default class DropDownEditor extends React.Component { return ( (props: Props) { }); return ( -
- {SORT_TEXT[sortDirection]} - {content} -
+ + {content} + {SORT_TEXT[sortDirection]} + ); } diff --git a/packages/react-data-grid/src/common/editors/ClickOutside.tsx b/packages/react-data-grid/src/common/editors/ClickOutside.tsx index 09d0f27b53..128ea104a3 100644 --- a/packages/react-data-grid/src/common/editors/ClickOutside.tsx +++ b/packages/react-data-grid/src/common/editors/ClickOutside.tsx @@ -12,20 +12,20 @@ import React, { useRef, useEffect } from 'react'; * * * SimpleEditor for example Texbox (No Portals) - *
..
+ *
..
*
*
*
..
*
- *
+ *
* * ComplexEditor for example Modals (using Portals) - *
..
+ *
..
*
*
* // Nothing here *
- *
+ *
*
*
..
*
diff --git a/packages/react-data-grid/src/common/editors/EditorContainer.tsx b/packages/react-data-grid/src/common/editors/EditorContainer.tsx index faa697364f..59ec2cae08 100644 --- a/packages/react-data-grid/src/common/editors/EditorContainer.tsx +++ b/packages/react-data-grid/src/common/editors/EditorContainer.tsx @@ -1,6 +1,7 @@ import React, { KeyboardEvent } from 'react'; import classNames from 'classnames'; import { isElement, isValidElementType } from 'react-is'; +import { Clear } from '@material-ui/icons'; import { CalculatedColumn, Editor, EditorProps, CommitEvent, Dimension, Omit } from '../types'; import SimpleTextEditor from './SimpleTextEditor'; @@ -39,10 +40,6 @@ export default class EditorContainer extends React.Component, State> const inputNode = this.getInputNode(); if (inputNode instanceof HTMLElement) { inputNode.focus(); - if (!this.getEditor().disableContainerStyles) { - inputNode.className += ' editor-main'; - inputNode.style.height = `${this.props.height - 1}px`; - } } if (inputNode instanceof HTMLInputElement) { inputNode.select(); @@ -251,13 +248,13 @@ export default class EditorContainer extends React.Component, State> renderStatusIcon() { return this.state.isInvalid - && ; + && ; } render() { const { width, height, left, top } = this.props; const className = classNames('rdg-editor-container', { - 'has-error': this.state.isInvalid === true + 'has-error': this.state.isInvalid }); return ( diff --git a/packages/react-data-grid/src/common/editors/SimpleTextEditor.tsx b/packages/react-data-grid/src/common/editors/SimpleTextEditor.tsx index c87de85f57..51477f7960 100644 --- a/packages/react-data-grid/src/common/editors/SimpleTextEditor.tsx +++ b/packages/react-data-grid/src/common/editors/SimpleTextEditor.tsx @@ -19,7 +19,7 @@ export default class SimpleTextEditor extends React.Component implements render() { return ( { cellMetaData: CellMetaData; scrollLeft: number; expandableOptions?: ExpandableOptions; - lastFrozenColumnIndex: number; isRowSelected: boolean; onRowSelectionChange(rowIdx: number, row: TRow, checked: boolean, isShiftClick: boolean): void; } diff --git a/packages/react-data-grid/src/formatters/SelectCellFormatter.tsx b/packages/react-data-grid/src/formatters/SelectCellFormatter.tsx index 01c96f37a4..43891a2707 100644 --- a/packages/react-data-grid/src/formatters/SelectCellFormatter.tsx +++ b/packages/react-data-grid/src/formatters/SelectCellFormatter.tsx @@ -11,14 +11,14 @@ export default function SelectCellFormatter({ value, onChange }: SelectCellForma } return ( -