react-sheet
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -13,3 +13,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function renderRow(data, columns, selection, focusedCell, setSelection, focus) { | ||
function renderRow(data, columns, selection, focusedCell, setSelection, focus, onEnter) { | ||
return function (_ref) { | ||
@@ -27,2 +27,3 @@ var key = _ref.key, | ||
rowIndex: index, | ||
onEnter: onEnter, | ||
row: data[index], | ||
@@ -55,3 +56,4 @@ columns: columns, | ||
focusedCell = _props.focusedCell, | ||
focus = _props.focus; | ||
focus = _props.focus, | ||
onEnter = _props.onEnter; | ||
@@ -70,3 +72,3 @@ return React.createElement( | ||
rowHeight: 20, | ||
rowRenderer: renderRow(data, columns, selection, focusedCell, setSelection, focus) | ||
rowRenderer: renderRow(data, columns, selection, focusedCell, setSelection, focus, onEnter) | ||
}) | ||
@@ -73,0 +75,0 @@ ); |
@@ -44,2 +44,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
focus = _props.focus, | ||
onEnter = _props.onEnter, | ||
focusedCell = _props.focusedCell; | ||
@@ -68,2 +69,3 @@ var width = this.state.width; | ||
focus: focus, | ||
onEnter: onEnter, | ||
columns: columns, | ||
@@ -70,0 +72,0 @@ selection: selection, |
@@ -61,9 +61,13 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
_this.blur(); | ||
_this.moveDown(); | ||
_this.addListeners(); | ||
_this.removeEscapeListener(); | ||
_this.onEnter(); | ||
} | ||
}; | ||
_this.onEnter = function () { | ||
_this.blur(); | ||
_this.moveDown(); | ||
_this.addListeners(); | ||
_this.removeEscapeListener(); | ||
}; | ||
_this.scrollToCell = function (row, column) { | ||
@@ -256,2 +260,3 @@ var table = document.querySelector('#react-sheet-body'); | ||
selection: selection, | ||
onEnter: this.onEnter, | ||
focusedCell: focusedCell, | ||
@@ -258,0 +263,0 @@ setSelection: this.setSelection |
@@ -17,5 +17,24 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function Row() { | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Row); | ||
return _possibleConstructorReturn(this, _Component.apply(this, arguments)); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onMouseDown = function (rowIndex, colIndex) { | ||
var setSelection = _this.props.setSelection; | ||
if (setSelection) { | ||
setSelection(rowIndex, colIndex); | ||
} | ||
}, _this.onDoubleClick = function (selectedRow, selectedColumn) { | ||
var focus = _this.props.focus; | ||
if (focus) { | ||
focus(selectedRow, selectedColumn); | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
@@ -34,9 +53,17 @@ | ||
focus = _props.focus, | ||
setSelection = _props.setSelection; | ||
var focusedRow = focusedCell.row, | ||
focusedColumn = focusedCell.column; | ||
var selectedRow = selection.row, | ||
selectedColumn = selection.column; | ||
setSelection = _props.setSelection, | ||
onEnter = _props.onEnter; | ||
var _ref = focusedCell || {}, | ||
_ref$row = _ref.row, | ||
focusedRow = _ref$row === undefined ? null : _ref$row, | ||
_ref$column = _ref.column, | ||
focusedColumn = _ref$column === undefined ? null : _ref$column; | ||
var _ref2 = selection || {}, | ||
_ref2$row = _ref2.row, | ||
selectedRow = _ref2$row === undefined ? null : _ref2$row, | ||
_ref2$column = _ref2.column, | ||
selectedColumn = _ref2$column === undefined ? null : _ref2$column; | ||
return React.createElement( | ||
@@ -60,3 +87,4 @@ 'div', | ||
var customCell = Cell && Cell(rowData, { | ||
isFocused: isFocused | ||
isFocused: isFocused, | ||
onEnter: onEnter | ||
}); | ||
@@ -78,8 +106,4 @@ | ||
}), | ||
onMouseDown: function onMouseDown() { | ||
return setSelection(rowIndex, colIndex); | ||
}, | ||
onDoubleClick: function onDoubleClick() { | ||
focus(selectedRow, selectedColumn); | ||
} | ||
onMouseDown: _this2.onMouseDown, | ||
onDoubleClick: _this2.onDoubleClick | ||
}); | ||
@@ -86,0 +110,0 @@ }) |
@@ -13,2 +13,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import PropTypes from 'prop-types'; | ||
import _debounce from 'lodash/debounce'; | ||
import React, { Component } from 'react'; | ||
@@ -122,2 +123,12 @@ | ||
_this3.onInputChange = _debounce(function () { | ||
var onEnter = _this3.props.onEnter; | ||
if (onEnter) { | ||
onEnter(); | ||
} | ||
}); | ||
_this3.select; | ||
@@ -168,3 +179,4 @@ return _this3; | ||
onChange: this.onChange, | ||
autoBlur: true | ||
autoBlur: true, | ||
onInputChange: this.onInputChange | ||
}); | ||
@@ -171,0 +183,0 @@ }; |
@@ -25,3 +25,3 @@ 'use strict'; | ||
function renderRow(data, columns, selection, focusedCell, setSelection, focus) { | ||
function renderRow(data, columns, selection, focusedCell, setSelection, focus, onEnter) { | ||
return function (_ref) { | ||
@@ -39,2 +39,3 @@ var key = _ref.key, | ||
rowIndex: index, | ||
onEnter: onEnter, | ||
row: data[index], | ||
@@ -67,3 +68,4 @@ columns: columns, | ||
focusedCell = _props.focusedCell, | ||
focus = _props.focus; | ||
focus = _props.focus, | ||
onEnter = _props.onEnter; | ||
@@ -82,3 +84,3 @@ return _react2.default.createElement( | ||
rowHeight: 20, | ||
rowRenderer: renderRow(data, columns, selection, focusedCell, setSelection, focus) | ||
rowRenderer: renderRow(data, columns, selection, focusedCell, setSelection, focus, onEnter) | ||
}) | ||
@@ -85,0 +87,0 @@ ); |
@@ -65,2 +65,3 @@ 'use strict'; | ||
focus = _props.focus, | ||
onEnter = _props.onEnter, | ||
focusedCell = _props.focusedCell; | ||
@@ -89,2 +90,3 @@ var width = this.state.width; | ||
focus: focus, | ||
onEnter: onEnter, | ||
columns: columns, | ||
@@ -91,0 +93,0 @@ selection: selection, |
@@ -76,9 +76,13 @@ 'use strict'; | ||
_this.blur(); | ||
_this.moveDown(); | ||
_this.addListeners(); | ||
_this.removeEscapeListener(); | ||
_this.onEnter(); | ||
} | ||
}; | ||
_this.onEnter = function () { | ||
_this.blur(); | ||
_this.moveDown(); | ||
_this.addListeners(); | ||
_this.removeEscapeListener(); | ||
}; | ||
_this.scrollToCell = function (row, column) { | ||
@@ -271,2 +275,3 @@ var table = document.querySelector('#react-sheet-body'); | ||
selection: selection, | ||
onEnter: this.onEnter, | ||
focusedCell: focusedCell, | ||
@@ -273,0 +278,0 @@ setSelection: this.setSelection |
@@ -33,5 +33,24 @@ 'use strict'; | ||
function Row() { | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Row); | ||
return _possibleConstructorReturn(this, _Component.apply(this, arguments)); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onMouseDown = function (rowIndex, colIndex) { | ||
var setSelection = _this.props.setSelection; | ||
if (setSelection) { | ||
setSelection(rowIndex, colIndex); | ||
} | ||
}, _this.onDoubleClick = function (selectedRow, selectedColumn) { | ||
var focus = _this.props.focus; | ||
if (focus) { | ||
focus(selectedRow, selectedColumn); | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
@@ -50,9 +69,17 @@ | ||
focus = _props.focus, | ||
setSelection = _props.setSelection; | ||
var focusedRow = focusedCell.row, | ||
focusedColumn = focusedCell.column; | ||
var selectedRow = selection.row, | ||
selectedColumn = selection.column; | ||
setSelection = _props.setSelection, | ||
onEnter = _props.onEnter; | ||
var _ref = focusedCell || {}, | ||
_ref$row = _ref.row, | ||
focusedRow = _ref$row === undefined ? null : _ref$row, | ||
_ref$column = _ref.column, | ||
focusedColumn = _ref$column === undefined ? null : _ref$column; | ||
var _ref2 = selection || {}, | ||
_ref2$row = _ref2.row, | ||
selectedRow = _ref2$row === undefined ? null : _ref2$row, | ||
_ref2$column = _ref2.column, | ||
selectedColumn = _ref2$column === undefined ? null : _ref2$column; | ||
return _react2.default.createElement( | ||
@@ -76,3 +103,4 @@ 'div', | ||
var customCell = Cell && Cell(rowData, { | ||
isFocused: isFocused | ||
isFocused: isFocused, | ||
onEnter: onEnter | ||
}); | ||
@@ -94,8 +122,4 @@ | ||
}), | ||
onMouseDown: function onMouseDown() { | ||
return setSelection(rowIndex, colIndex); | ||
}, | ||
onDoubleClick: function onDoubleClick() { | ||
focus(selectedRow, selectedColumn); | ||
} | ||
onMouseDown: _this2.onMouseDown, | ||
onDoubleClick: _this2.onDoubleClick | ||
}); | ||
@@ -102,0 +126,0 @@ }) |
@@ -17,2 +17,6 @@ 'use strict'; | ||
var _debounce2 = require('lodash/debounce'); | ||
var _debounce3 = _interopRequireDefault(_debounce2); | ||
var _react = require('react'); | ||
@@ -138,2 +142,12 @@ | ||
_this3.onInputChange = (0, _debounce3.default)(function () { | ||
var onEnter = _this3.props.onEnter; | ||
if (onEnter) { | ||
onEnter(); | ||
} | ||
}); | ||
_this3.select; | ||
@@ -184,3 +198,4 @@ return _this3; | ||
onChange: this.onChange, | ||
autoBlur: true | ||
autoBlur: true, | ||
onInputChange: this.onInputChange | ||
}); | ||
@@ -187,0 +202,0 @@ }; |
{ | ||
"name": "react-sheet", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Spreadsheet component for react", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3159539
37973