slickgrid
Advanced tools
Comparing version 2.4.2 to 2.4.3
{ | ||
"name": "slickgrid", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -5,0 +5,0 @@ "main": "slick.core.js", |
@@ -111,2 +111,4 @@ (function ($) { | ||
function setDataItemValueForColumn(item, columnDef, value) { | ||
if (columnDef.denyPaste) { return null; } | ||
if (_options.dataItemColumnValueSetter) { | ||
@@ -113,0 +115,0 @@ return _options.dataItemColumnValueSetter(item, columnDef, value); |
@@ -31,2 +31,6 @@ (function ($) { | ||
// Scrollings | ||
var _scrollTop = 0; | ||
var _scrollLeft = 0; | ||
function init(grid) { | ||
@@ -39,2 +43,3 @@ options = $.extend(true, {}, _defaults, options); | ||
_handler | ||
.subscribe(_grid.onScroll, handleScroll) | ||
.subscribe(_grid.onDragInit, handleDragInit) | ||
@@ -54,6 +59,11 @@ .subscribe(_grid.onDragStart, handleDragStart) | ||
function handleScroll(e, args) { | ||
_scrollTop = args.scrollTop; | ||
_scrollLeft = args.scrollLeft; | ||
} | ||
function handleDragInit(e, dd) { | ||
// Set the active canvas node because the decorator needs to append its | ||
// box to the correct canvas | ||
_$activeCanvas = $( _grid.getActiveCanvasNode( e ) ); | ||
_$activeCanvas = $(_grid.getActiveCanvasNode(e)); | ||
@@ -64,14 +74,14 @@ var c = _$activeCanvas.offset(); | ||
_columnOffset = 0; | ||
_isBottomCanvas = _$activeCanvas.hasClass( 'grid-canvas-bottom' ); | ||
_isBottomCanvas = _$activeCanvas.hasClass('grid-canvas-bottom'); | ||
if ( _gridOptions.frozenRow > -1 && _isBottomCanvas ) { | ||
_rowOffset = ( _gridOptions.frozenBottom ) ? $('.grid-canvas-bottom').height() : $('.grid-canvas-top').height(); | ||
if (_gridOptions.frozenRow > -1 && _isBottomCanvas) { | ||
_rowOffset = (_gridOptions.frozenBottom) ? $('.grid-canvas-bottom').height() : $('.grid-canvas-top').height(); | ||
} | ||
_isRightCanvas = _$activeCanvas.hasClass( 'grid-canvas-right' ); | ||
if ( _gridOptions.frozenColumn > -1 && _isRightCanvas ) { | ||
_columnOffset = $('.grid-canvas-left').width(); | ||
_isRightCanvas = _$activeCanvas.hasClass('grid-canvas-right'); | ||
if (_gridOptions.frozenColumn > -1 && _isRightCanvas) { | ||
_columnOffset = $('.grid-canvas-left').width(); | ||
} | ||
// prevent the grid from cancelling drag'n'drop by default | ||
@@ -95,7 +105,15 @@ e.stopImmediatePropagation(); | ||
var start = _grid.getCellFromPoint( | ||
dd.startX - $(_canvas).offset().left, | ||
dd.startY - $(_canvas).offset().top); | ||
var startX = dd.startX - $(_canvas).offset().left; | ||
if (_gridOptions.frozenColumn >= 0 && _isRightCanvas) { | ||
startX += _scrollLeft; | ||
} | ||
dd.range = {start: start, end: {}}; | ||
var startY = dd.startY - $(_canvas).offset().top; | ||
if (_gridOptions.frozenRow >= 0 && _isBottomCanvas) { | ||
startY += _scrollTop; | ||
} | ||
var start = _grid.getCellFromPoint(startX, startY); | ||
dd.range = { start: start, end: {} }; | ||
_currentlySelectedRange = dd.range; | ||
@@ -116,20 +134,19 @@ return _decorator.show(new Slick.Range(start.row, start.cell)); | ||
if (_gridOptions.frozenColumn < 0) { | ||
if (!_grid.canCellBeSelected(end.row, end.cell)) { | ||
return; | ||
} | ||
} else { | ||
// when having frozen column(s), we need to do extra checks | ||
if ( (!_grid.canCellBeSelected( end.row, end.cell ) ) | ||
|| ( !_isRightCanvas && ( end.cell > _gridOptions.frozenColumn ) ) | ||
|| ( _isRightCanvas && ( end.cell <= _gridOptions.frozenColumn ) ) | ||
|| ( !_isBottomCanvas && ( end.row >= _gridOptions.frozenRow ) ) | ||
|| ( _isBottomCanvas && ( end.row < _gridOptions.frozenRow ) ) | ||
) { | ||
return; | ||
} | ||
// ... frozen column(s), | ||
if ( _gridOptions.frozenColumn >= 0 && (!_isRightCanvas && (end.cell > _gridOptions.frozenColumn)) || (_isRightCanvas && (end.cell <= _gridOptions.frozenColumn)) ) { | ||
return; | ||
} | ||
// ... or frozen row(s) | ||
if ( _gridOptions.frozenRow >= 0 && (!_isBottomCanvas && (end.row >= _gridOptions.frozenRow)) || (_isBottomCanvas && (end.row < _gridOptions.frozenRow)) ) { | ||
return; | ||
} | ||
// ... or regular grid (without any frozen options) | ||
if (!_grid.canCellBeSelected(end.row, end.cell)) { | ||
return; | ||
} | ||
dd.range.end = end; | ||
_decorator.show(new Slick.Range(dd.range.start.row, dd.range.start.cell, end.row, end.cell)); | ||
@@ -156,3 +173,3 @@ } | ||
} | ||
function getCurrentRange() { | ||
@@ -159,0 +176,0 @@ return _currentlySelectedRange; |
Sorry, the diff of this file is too big to display
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
3516395
92041