react-base-table
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -5,2 +5,7 @@ # CHANGELOG | ||
## v1.7.3 (2019-08-27) | ||
- fix: fix possible memory leak in `ColumnResizer` | ||
- fix: bring back column resize on touch events support | ||
## v1.7.2 (2019-08-26) | ||
@@ -37,3 +42,3 @@ | ||
- feat: support infinite loading with `maxHeight` | ||
- feat: support infinite loading with `maxHeight` | ||
- chore: remove unused `$table-border-radius` variable | ||
@@ -40,0 +45,0 @@ - feat: add `sortState` to support multi sort |
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized"; | ||
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import React from 'react'; | ||
@@ -7,0 +12,0 @@ import PropTypes from 'prop-types'; |
@@ -1,2 +0,7 @@ | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import { FrozenDirection } from './Column'; | ||
@@ -3,0 +8,0 @@ |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized"; | ||
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import React from 'react'; | ||
@@ -38,2 +43,15 @@ import PropTypes from 'prop-types'; | ||
} | ||
var eventsFor = { | ||
touch: { | ||
start: 'touchstart', | ||
move: 'touchmove', | ||
stop: 'touchend' | ||
}, | ||
mouse: { | ||
start: 'mousedown', | ||
move: 'mousemove', | ||
stop: 'mouseup' | ||
} | ||
}; | ||
var dragEventFor = eventsFor.mouse; | ||
/** | ||
@@ -59,3 +77,7 @@ * ColumnResizer for BaseTable | ||
_this._handleMouseUp = _this._handleMouseUp.bind(_assertThisInitialized(_this)); | ||
_this._handleMouseMove = _this._handleMouseMove.bind(_assertThisInitialized(_this)); | ||
_this._handleTouchStart = _this._handleTouchStart.bind(_assertThisInitialized(_this)); | ||
_this._handleTouchEnd = _this._handleTouchEnd.bind(_assertThisInitialized(_this)); | ||
_this._handleDragStart = _this._handleDragStart.bind(_assertThisInitialized(_this)); | ||
_this._handleDragStop = _this._handleDragStop.bind(_assertThisInitialized(_this)); | ||
_this._handleDrag = _this._handleDrag.bind(_assertThisInitialized(_this)); | ||
return _this; | ||
@@ -66,7 +88,9 @@ } | ||
_proto.componentWillMount = function componentWillMount() { | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
if (this.handleRef) { | ||
var ownerDocument = this.handleRef.ownerDocument; | ||
ownerDocument.removeEventListener('mousemove', this._handleMouseMove); | ||
ownerDocument.addEventListener('mouseup', this._handleMouseUp); | ||
ownerDocument.removeEventListener(eventsFor.mouse.move, this._handleDrag); | ||
ownerDocument.removeEventListener(eventsFor.mouse.stop, this._handleDragStop); | ||
ownerDocument.removeEventListener(eventsFor.touch.move, this._handleDrag); | ||
ownerDocument.removeEventListener(eventsFor.touch.stop, this._handleDragStop); | ||
removeUserSelectStyles(ownerDocument); | ||
@@ -91,2 +115,4 @@ } | ||
onMouseUp: this._handleMouseUp, | ||
onTouchStart: this._handleTouchStart, | ||
onTouchEnd: this._handleTouchEnd, | ||
style: _objectSpread({ | ||
@@ -113,2 +139,26 @@ userSelect: 'none', | ||
_proto._handleMouseDown = function _handleMouseDown(e) { | ||
dragEventFor = eventsFor.mouse; | ||
this._handleDragStart(e); | ||
}; | ||
_proto._handleMouseUp = function _handleMouseUp(e) { | ||
dragEventFor = eventsFor.mouse; | ||
this._handleDragStop(e); | ||
}; | ||
_proto._handleTouchStart = function _handleTouchStart(e) { | ||
dragEventFor = eventsFor.touch; | ||
this._handleDragStart(e); | ||
}; | ||
_proto._handleTouchEnd = function _handleTouchEnd(e) { | ||
dragEventFor = eventsFor.touch; | ||
this._handleDragStop(e); | ||
}; | ||
_proto._handleDragStart = function _handleDragStart(e) { | ||
if (typeof e.button === 'number' && e.button !== 0) return; | ||
@@ -121,7 +171,7 @@ this.isDragging = true; | ||
addUserSelectStyles(ownerDocument); | ||
ownerDocument.addEventListener('mousemove', this._handleMouseMove); | ||
ownerDocument.addEventListener('mouseup', this._handleMouseUp); | ||
ownerDocument.addEventListener(dragEventFor.move, this._handleDrag); | ||
ownerDocument.addEventListener(dragEventFor.stop, this._handleDragStop); | ||
}; | ||
_proto._handleMouseUp = function _handleMouseUp(e) { | ||
_proto._handleDragStop = function _handleDragStop(e) { | ||
if (!this.isDragging) return; | ||
@@ -132,10 +182,17 @@ this.isDragging = false; | ||
removeUserSelectStyles(ownerDocument); | ||
ownerDocument.removeEventListener('mousemove', this._handleMouseMove); | ||
ownerDocument.addEventListener('mouseup', this._handleMouseUp); | ||
ownerDocument.removeEventListener(dragEventFor.move, this._handleDrag); | ||
ownerDocument.removeEventListener(dragEventFor.stop, this._handleDragStop); | ||
}; | ||
_proto._handleMouseMove = function _handleMouseMove(e) { | ||
_proto._handleDrag = function _handleDrag(e) { | ||
var clientX = e.clientX; | ||
if (e.type === eventsFor.touch.move) { | ||
e.preventDefault(); | ||
if (e.targetTouches && e.targetTouches[0]) clientX = e.targetTouches[0].clientX; | ||
} | ||
var offsetParent = this.handleRef.offsetParent; | ||
var offsetParentRect = offsetParent.getBoundingClientRect(); | ||
var x = e.clientX + offsetParent.scrollLeft - offsetParentRect.left; | ||
var x = clientX + offsetParent.scrollLeft - offsetParentRect.left; | ||
@@ -142,0 +199,0 @@ if (this.lastX === INVALID_VALUE) { |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized"; | ||
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import React from 'react'; | ||
@@ -7,0 +12,0 @@ import PropTypes from 'prop-types'; |
@@ -1,2 +0,7 @@ | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import React from 'react'; | ||
@@ -3,0 +8,0 @@ import PropTypes from 'prop-types'; |
@@ -1,2 +0,7 @@ | ||
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import React from 'react'; | ||
@@ -3,0 +8,0 @@ export function renderElement(renderer, props) { |
@@ -14,4 +14,2 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -65,2 +63,6 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var getContainerStyle = function getContainerStyle(width, maxWidth, height) { | ||
@@ -351,3 +353,4 @@ return { | ||
var className = (0, _classnames["default"])(this._prefixClass('row'), rowClass, (_cn = {}, (0, _defineProperty2["default"])(_cn, this._prefixClass("row--depth-".concat(depth)), !!expandColumnKey && rowIndex >= 0), (0, _defineProperty2["default"])(_cn, this._prefixClass('row--expanded'), !!expandColumnKey && this.state.expandedRowKeys.indexOf(rowKey) >= 0), (0, _defineProperty2["default"])(_cn, this._prefixClass('row--hovered'), !isScrolling && rowKey === this.state.hoveredRowKey), (0, _defineProperty2["default"])(_cn, this._prefixClass('row--frozen'), depth === 0 && rowIndex < 0), (0, _defineProperty2["default"])(_cn, this._prefixClass('row--customized'), rowRenderer), _cn)); | ||
var rowProps = (0, _objectSpread2["default"])({}, extraProps, { | ||
var rowProps = _objectSpread({}, extraProps, { | ||
role: 'row', | ||
@@ -372,2 +375,3 @@ key: "row-".concat(rowKey), | ||
}); | ||
return _react["default"].createElement(_TableRow["default"], rowProps); | ||
@@ -473,3 +477,4 @@ } | ||
var className = (0, _classnames["default"])(this._prefixClass('header-row'), headerClass, (_cn3 = {}, (0, _defineProperty2["default"])(_cn3, this._prefixClass('header-row--resizing'), !!this.state.resizingKey), (0, _defineProperty2["default"])(_cn3, this._prefixClass('header-row--customized'), headerRenderer), _cn3)); | ||
var headerProps = (0, _objectSpread2["default"])({}, extraProps, { | ||
var headerProps = _objectSpread({}, extraProps, { | ||
role: 'row', | ||
@@ -486,2 +491,3 @@ key: "header-".concat(headerIndex), | ||
}); | ||
return _react["default"].createElement(_TableHeaderRow["default"], headerProps); | ||
@@ -785,3 +791,3 @@ } | ||
var containerStyle = (0, _objectSpread2["default"])({}, style, { | ||
var containerStyle = _objectSpread({}, style, { | ||
width: width, | ||
@@ -791,2 +797,3 @@ height: this._getTableHeight() + footerHeight, | ||
}); | ||
var cls = (0, _classnames["default"])(classPrefix, className, (_cn6 = {}, (0, _defineProperty2["default"])(_cn6, "".concat(classPrefix, "--fixed"), fixed), (0, _defineProperty2["default"])(_cn6, "".concat(classPrefix, "--expandable"), !!expandColumnKey), (0, _defineProperty2["default"])(_cn6, "".concat(classPrefix, "--empty"), data.length === 0), (0, _defineProperty2["default"])(_cn6, "".concat(classPrefix, "--has-frozen-rows"), frozenData.length > 0), (0, _defineProperty2["default"])(_cn6, "".concat(classPrefix, "--has-frozen-columns"), this.columnManager.hasFrozenColumns()), (0, _defineProperty2["default"])(_cn6, "".concat(classPrefix, "--disabled"), disabled), _cn6)); | ||
@@ -793,0 +800,0 @@ return _react["default"].createElement("div", { |
@@ -12,4 +12,2 @@ "use strict"; | ||
var _objectSpread4 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
@@ -21,2 +19,6 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var ColumnManager = | ||
@@ -57,3 +59,3 @@ /*#__PURE__*/ | ||
return (0, _objectSpread4["default"])({}, column, { | ||
return _objectSpread({}, column, { | ||
width: width | ||
@@ -139,3 +141,3 @@ }); | ||
//columns placeholder for the fixed table above them | ||
mainColumns.push((0, _objectSpread4["default"])({}, column, (0, _defineProperty2["default"])({}, ColumnManager.PlaceholderKey, true))); | ||
mainColumns.push(_objectSpread({}, column, (0, _defineProperty2["default"])({}, ColumnManager.PlaceholderKey, true))); | ||
}); | ||
@@ -148,3 +150,3 @@ | ||
_this6.getRightFrozenColumns().forEach(function (column) { | ||
mainColumns.push((0, _objectSpread4["default"])({}, column, (0, _defineProperty2["default"])({}, ColumnManager.PlaceholderKey, true))); | ||
mainColumns.push(_objectSpread({}, column, (0, _defineProperty2["default"])({}, ColumnManager.PlaceholderKey, true))); | ||
}); | ||
@@ -253,3 +255,4 @@ | ||
var flexValue = "".concat(flexGrow, " ").concat(flexShrink, " auto"); | ||
var style = (0, _objectSpread4["default"])({}, column.style, { | ||
var style = _objectSpread({}, column.style, { | ||
flex: flexValue, | ||
@@ -256,0 +259,0 @@ msFlex: flexValue, |
@@ -14,3 +14,3 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -37,2 +37,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var INVALID_VALUE = null; // copied from https://github.com/mzabriskie/react-draggable/blob/master/lib/utils/domFns.js | ||
@@ -68,2 +72,16 @@ | ||
} | ||
var eventsFor = { | ||
touch: { | ||
start: 'touchstart', | ||
move: 'touchmove', | ||
stop: 'touchend' | ||
}, | ||
mouse: { | ||
start: 'mousedown', | ||
move: 'mousemove', | ||
stop: 'mouseup' | ||
} | ||
}; | ||
var dragEventFor = eventsFor.mouse; | ||
/** | ||
@@ -73,3 +91,2 @@ * ColumnResizer for BaseTable | ||
var ColumnResizer = | ||
@@ -92,3 +109,7 @@ /*#__PURE__*/ | ||
_this._handleMouseUp = _this._handleMouseUp.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this._handleMouseMove = _this._handleMouseMove.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this._handleTouchStart = _this._handleTouchStart.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this._handleTouchEnd = _this._handleTouchEnd.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this._handleDragStart = _this._handleDragStart.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this._handleDragStop = _this._handleDragStop.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this._handleDrag = _this._handleDrag.bind((0, _assertThisInitialized2["default"])(_this)); | ||
return _this; | ||
@@ -98,8 +119,10 @@ } | ||
(0, _createClass2["default"])(ColumnResizer, [{ | ||
key: "componentWillMount", | ||
value: function componentWillMount() { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
if (this.handleRef) { | ||
var ownerDocument = this.handleRef.ownerDocument; | ||
ownerDocument.removeEventListener('mousemove', this._handleMouseMove); | ||
ownerDocument.addEventListener('mouseup', this._handleMouseUp); | ||
ownerDocument.removeEventListener(eventsFor.mouse.move, this._handleDrag); | ||
ownerDocument.removeEventListener(eventsFor.mouse.stop, this._handleDragStop); | ||
ownerDocument.removeEventListener(eventsFor.touch.move, this._handleDrag); | ||
ownerDocument.removeEventListener(eventsFor.touch.stop, this._handleDragStop); | ||
removeUserSelectStyles(ownerDocument); | ||
@@ -124,3 +147,5 @@ } | ||
onMouseUp: this._handleMouseUp, | ||
style: (0, _objectSpread2["default"])({ | ||
onTouchStart: this._handleTouchStart, | ||
onTouchEnd: this._handleTouchEnd, | ||
style: _objectSpread({ | ||
userSelect: 'none', | ||
@@ -149,2 +174,30 @@ touchAction: 'none', | ||
value: function _handleMouseDown(e) { | ||
dragEventFor = eventsFor.mouse; | ||
this._handleDragStart(e); | ||
} | ||
}, { | ||
key: "_handleMouseUp", | ||
value: function _handleMouseUp(e) { | ||
dragEventFor = eventsFor.mouse; | ||
this._handleDragStop(e); | ||
} | ||
}, { | ||
key: "_handleTouchStart", | ||
value: function _handleTouchStart(e) { | ||
dragEventFor = eventsFor.touch; | ||
this._handleDragStart(e); | ||
} | ||
}, { | ||
key: "_handleTouchEnd", | ||
value: function _handleTouchEnd(e) { | ||
dragEventFor = eventsFor.touch; | ||
this._handleDragStop(e); | ||
} | ||
}, { | ||
key: "_handleDragStart", | ||
value: function _handleDragStart(e) { | ||
if (typeof e.button === 'number' && e.button !== 0) return; | ||
@@ -157,8 +210,8 @@ this.isDragging = true; | ||
addUserSelectStyles(ownerDocument); | ||
ownerDocument.addEventListener('mousemove', this._handleMouseMove); | ||
ownerDocument.addEventListener('mouseup', this._handleMouseUp); | ||
ownerDocument.addEventListener(dragEventFor.move, this._handleDrag); | ||
ownerDocument.addEventListener(dragEventFor.stop, this._handleDragStop); | ||
} | ||
}, { | ||
key: "_handleMouseUp", | ||
value: function _handleMouseUp(e) { | ||
key: "_handleDragStop", | ||
value: function _handleDragStop(e) { | ||
if (!this.isDragging) return; | ||
@@ -169,11 +222,18 @@ this.isDragging = false; | ||
removeUserSelectStyles(ownerDocument); | ||
ownerDocument.removeEventListener('mousemove', this._handleMouseMove); | ||
ownerDocument.addEventListener('mouseup', this._handleMouseUp); | ||
ownerDocument.removeEventListener(dragEventFor.move, this._handleDrag); | ||
ownerDocument.removeEventListener(dragEventFor.stop, this._handleDragStop); | ||
} | ||
}, { | ||
key: "_handleMouseMove", | ||
value: function _handleMouseMove(e) { | ||
key: "_handleDrag", | ||
value: function _handleDrag(e) { | ||
var clientX = e.clientX; | ||
if (e.type === eventsFor.touch.move) { | ||
e.preventDefault(); | ||
if (e.targetTouches && e.targetTouches[0]) clientX = e.targetTouches[0].clientX; | ||
} | ||
var offsetParent = this.handleRef.offsetParent; | ||
var offsetParentRect = offsetParent.getBoundingClientRect(); | ||
var x = e.clientX + offsetParent.scrollLeft - offsetParentRect.left; | ||
var x = clientX + offsetParent.scrollLeft - offsetParentRect.left; | ||
@@ -180,0 +240,0 @@ if (this.lastX === INVALID_VALUE) { |
@@ -14,3 +14,3 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -39,2 +39,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
/** | ||
@@ -106,3 +110,3 @@ * A wrapper of the Grid for internal only | ||
var rowData = data[args.rowIndex]; | ||
return rowRenderer((0, _objectSpread2["default"])({}, args, { | ||
return rowRenderer(_objectSpread({}, args, { | ||
columns: columns, | ||
@@ -109,0 +113,0 @@ rowData: rowData |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -21,2 +21,6 @@ var _react = _interopRequireDefault(require("react")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
/** | ||
@@ -34,3 +38,3 @@ * default SortIndicator for BaseTable | ||
className: cls, | ||
style: (0, _objectSpread2["default"])({ | ||
style: _objectSpread({ | ||
userSelect: 'none', | ||
@@ -37,0 +41,0 @@ width: '16px', |
@@ -26,6 +26,10 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _react = _interopRequireDefault(require("react")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function renderElement(renderer, props) { | ||
@@ -46,5 +50,6 @@ if (!renderer) return null; | ||
if (_react["default"].isValidElement(element) && element.key) { | ||
var column = (0, _objectSpread2["default"])({}, element.props, { | ||
var column = _objectSpread({}, element.props, { | ||
key: element.key | ||
}); | ||
columns.push(column); | ||
@@ -104,3 +109,4 @@ } | ||
for (var i = 0; i < length; i++) { | ||
var item = (0, _objectSpread2["default"])({}, array[i]); | ||
var item = _objectSpread({}, array[i]); | ||
var id = item[dataKey]; | ||
@@ -107,0 +113,0 @@ var parentId = item[parentKey]; |
{ | ||
"name": "react-base-table", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "a react table component to display large data set with high performance and flexibility", | ||
@@ -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 not supported yet
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 not supported yet
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 not supported yet
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 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
836638
6282