Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slickgrid

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slickgrid - npm Package Compare versions

Comparing version 2.3.3 to 2.3.9

controls/slick.gridmenu.css

41

controls/slick.columnpicker.js
(function ($) {
function SlickColumnPicker(columns, grid, options) {
var $list;
var $menu;

@@ -7,3 +8,3 @@ var columnCheckboxes;

var defaults = {
fadeSpeed:250
fadeSpeed: 250
};

@@ -16,9 +17,19 @@

$menu = $("<span class='slick-columnpicker' style='display:none;position:absolute;z-index:20;overflow-y:scroll;' />").appendTo(document.body);
$menu = $("<div class='slick-columnpicker' style='display:none' />").appendTo(document.body);
$close = $("<button type='button' class='close' data-dismiss='slick-columnpicker' aria-label='Close'><span class='close' aria-hidden='true'>&times;</span></button>").appendTo($menu);
$menu.on("mouseleave", function (e) {
$(this).fadeOut(options.fadeSpeed)
});
// user could pass a title on top of the columns list
if(options.columnPickerTitle) {
$title = $("<div class='title'/>").append(options.columnPickerTitle);
$title.appendTo($menu);
}
$menu.on("click", updateColumn);
$list = $("<span class='slick-columnpicker-list' />");
// Hide the menu on outside click.
$(document.body).on("mousedown", handleBodyMouseDown);
// destroy the picker if user leaves the page
$(window).on("beforeunload", destroy);
}

@@ -29,8 +40,16 @@

grid.onColumnsReordered.unsubscribe(updateColumnOrder);
$(document.body).off("mousedown", handleBodyMouseDown);
$("div.slick-columnpicker").hide(options.fadeSpeed);
$menu.remove();
}
function handleBodyMouseDown(e) {
if (($menu && $menu[0] != e.target && !$.contains($menu[0], e.target)) || e.target.className == "close") {
$menu.hide(options.fadeSpeed);
}
}
function handleHeaderContextMenu(e, args) {
e.preventDefault();
$menu.empty();
$list.empty();
updateColumnOrder();

@@ -41,3 +60,3 @@ columnCheckboxes = [];

for (var i = 0; i < columns.length; i++) {
$li = $("<li />").appendTo($menu);
$li = $("<li />").appendTo($list);
$input = $("<input type='checkbox' />").data("column-id", columns[i].id);

@@ -56,4 +75,4 @@ columnCheckboxes.push($input);

$("<hr/>").appendTo($menu);
$li = $("<li />").appendTo($menu);
$("<hr/>").appendTo($list);
$li = $("<li />").appendTo($list);
$input = $("<input type='checkbox' />").data("option", "autoresize");

@@ -68,3 +87,3 @@ $("<label />")

$li = $("<li />").appendTo($menu);
$li = $("<li />").appendTo($list);
$input = $("<input type='checkbox' />").data("option", "syncresize");

@@ -84,2 +103,4 @@ $("<label />")

.fadeIn(options.fadeSpeed);
$list.appendTo($menu);
}

@@ -86,0 +107,0 @@

@@ -163,3 +163,5 @@ /*!

interaction: function( elem, dd ){
var offset = $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 };
var offset = (elem && elem.ownerDocument)
? $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 }
: { top: 0, left: 0 };
return {

@@ -166,0 +168,0 @@ drag: elem,

{
"name": "slickgrid",
"version": "2.3.3",
"version": "2.3.9",
"description": "A lightning fast JavaScript grid/spreadsheet",

@@ -5,0 +5,0 @@ "main": "slick.core.js",

@@ -51,6 +51,6 @@ (function ($) {

_self.onPasteCells.notify({from: _copiedRanges, to: ranges});
if (!_grid.getOptions().preserveCopiedSelectionOnPaste) {
clearCopySelection();
_copiedRanges = null;
}
if (!_grid.getOptions().preserveCopiedSelectionOnPaste) {
clearCopySelection();
_copiedRanges = null;
}
}

@@ -57,0 +57,0 @@ }

@@ -30,2 +30,3 @@ (function ($) {

newRowCreator: function to add rows to table if paste overflows bottom of table
readOnlyMode: suppresses paste
*/

@@ -92,4 +93,3 @@ var _grid;

editor.destroy();
}
else {
} else {
retVal = item[columnDef.field];

@@ -118,2 +118,4 @@ }

editor.destroy();
} else {
item[columnDef.field] = value;
}

@@ -139,8 +141,8 @@ }

var clipRows = clipText.split(/[\n\f\r]/);
// trim trailing CR if present
if (clipRows[clipRows.length - 1]=="") { clipRows.pop(); }
// trim trailing CR if present
if (clipRows[clipRows.length - 1]=="") { clipRows.pop(); }
var clippedRange = [];
var j = 0;
_bodyElement.removeChild(ta);

@@ -213,4 +215,2 @@ for (var i=0; i<clipRows.length; i++) {

destW: destW,
desty: activeRow,
destx: activeCell,
maxDestY: _grid.getDataLength(),

@@ -223,7 +223,7 @@ maxDestX: _grid.getColumns().length,

this.h=0;
for (var y = 0; y < destH; y++){
for (var y = 0; y < this.destH; y++){
this.oldValues[y] = [];
this.w=0;
this.h++;
for (var x = 0; x < destW; x++){
for (var x = 0; x < this.destW; x++){
this.w++;

@@ -266,4 +266,4 @@ var desty = activeRow + y;

undo: function() {
for (var y = 0; y < destH; y++){
for (var x = 0; x < destW; x++){
for (var y = 0; y < this.destH; y++){
for (var x = 0; x < this.destW; x++){
var desty = activeRow + y;

@@ -407,3 +407,6 @@ var destx = activeCell + x;

if ((e.which === keyCodes.V && (e.ctrlKey || e.metaKey) && !e.shiftKey || (e.which === keyCodes.INSERT && e.shiftKey && !e.ctrlKey))) { // CTRL+V or Shift+INS
if (!_options.readOnlyMode && (
(e.which === keyCodes.V && (e.ctrlKey || e.metaKey) && !e.shiftKey)
|| (e.which === keyCodes.INSERT && e.shiftKey && !e.ctrlKey)
)) { // CTRL+V or Shift+INS
var ta = _createTextBox('');

@@ -410,0 +413,0 @@

@@ -27,2 +27,8 @@ (function ($) {

"border": "2px dashed red"
},
offset: {
top: -1,
left: -1,
height: -2,
width: -2
}

@@ -37,5 +43,5 @@ };

_elem = $("<div></div>", {css: options.selectionCss})
.addClass(options.selectionCssClass)
.css("position", "absolute")
.appendTo(grid.getCanvasNode());
.addClass(options.selectionCssClass)
.css("position", "absolute")
.appendTo(grid.getCanvasNode());
}

@@ -47,6 +53,6 @@

_elem.css({
top: from.top - 1,
left: from.left - 1,
height: to.bottom - from.top - 2,
width: to.right - from.left - 2
top: from.top + options.offset.top,
left: from.left + options.offset.left,
height: to.bottom - from.top + options.offset.height,
width: to.right - from.left + options.offset.width
});

@@ -53,0 +59,0 @@

@@ -9,5 +9,5 @@ (function ($) {

function CellRangeSelector(options) {
var _grid;
var _currentlySelectedRange;
var _canvas;

@@ -24,6 +24,5 @@ var _dragging;

function init(grid) {
options = $.extend(true, {}, _defaults, options);
_decorator = new Slick.CellRangeDecorator(grid, options);
_decorator = options.cellDecorator || new Slick.CellRangeDecorator(grid, options);
_grid = grid;

@@ -42,2 +41,6 @@ _canvas = _grid.getCanvasNode();

function getCellDecorator() {
return _decorator;
}
function handleDragInit(e, dd) {

@@ -63,7 +66,7 @@ // prevent the grid from cancelling drag'n'drop by default

var start = _grid.getCellFromPoint(
dd.startX - $(_canvas).offset().left,
dd.startY - $(_canvas).offset().top);
dd.startX - $(_canvas).offset().left,
dd.startY - $(_canvas).offset().top);
dd.range = {start: start, end: {}};
_currentlySelectedRange = dd.range;
return _decorator.show(new Slick.Range(start.row, start.cell));

@@ -79,4 +82,4 @@ }

var end = _grid.getCellFromPoint(
e.pageX - $(_canvas).offset().left,
e.pageY - $(_canvas).offset().top);
e.pageX - $(_canvas).offset().left,
e.pageY - $(_canvas).offset().top);

@@ -88,2 +91,3 @@ if (!_grid.canCellBeSelected(end.row, end.cell)) {

dd.range.end = end;
_currentlySelectedRange = dd.range;
_decorator.show(new Slick.Range(dd.range.start.row, dd.range.start.cell, end.row, end.cell));

@@ -103,6 +107,6 @@ }

range: new Slick.Range(
dd.range.start.row,
dd.range.start.cell,
dd.range.end.row,
dd.range.end.cell
dd.range.start.row,
dd.range.start.cell,
dd.range.end.row,
dd.range.end.cell
)

@@ -112,5 +116,11 @@ });

function getCurrentRange() {
return _currentlySelectedRange;
}
$.extend(this, {
"init": init,
"destroy": destroy,
"getCellDecorator": getCellDecorator,
"getCurrentRange": getCurrentRange,

@@ -121,2 +131,2 @@ "onBeforeCellRangeSelected": new Slick.Event(),

}
})(jQuery);
})(jQuery);

@@ -9,3 +9,2 @@ (function ($) {

function CellSelectionModel(options) {

@@ -16,7 +15,14 @@ var _grid;

var _self = this;
var _selector = new Slick.CellRangeSelector({
"selectionCss": {
"border": "2px solid black"
}
});
var _selector;
if (typeof options === "undefined" || typeof options.cellRangeSelector === "undefined") {
_selector = new Slick.CellRangeSelector({
"selectionCss": {
"border": "2px solid black"
}
});
} else {
_selector = options.cellRangeSelector;
}
var _options;

@@ -27,3 +33,2 @@ var _defaults = {

function init(grid) {

@@ -62,3 +67,3 @@ _options = $.extend(true, {}, _defaults, options);

function setSelectedRanges(ranges) {
// simle check for: empty selection didn't change, prevent firing onSelectedRangesChanged
// simple check for: empty selection didn't change, prevent firing onSelectedRangesChanged
if ((!_ranges || _ranges.length === 0) && (!ranges || ranges.length === 0)) { return; }

@@ -82,2 +87,3 @@

function handleCellRangeSelected(e, args) {
_grid.setActiveCell(args.range.fromRow, args.range.fromCell, false, false, true);
setSelectedRanges([args.range]);

@@ -91,3 +97,3 @@ }

}
function handleKeyDown(e) {

@@ -99,39 +105,40 @@ /***

* 39 right
* 40 down
*/
* 40 down
*/
var ranges, last;
var active = _grid.getActiveCell();
var active = _grid.getActiveCell();
var metaKey = e.ctrlKey || e.metaKey;
if ( active && e.shiftKey && !e.ctrlKey && !e.altKey &&
(e.which == 37 || e.which == 39 || e.which == 38 || e.which == 40) ) {
if (active && e.shiftKey && !metaKey && !e.altKey &&
(e.which == 37 || e.which == 39 || e.which == 38 || e.which == 40)) {
ranges = getSelectedRanges();
if (!ranges.length)
ranges.push(new Slick.Range(active.row, active.cell));
ranges.push(new Slick.Range(active.row, active.cell));
// keyboard can work with last range only
last = ranges.pop();
// can't handle selection out of active cell
if (!last.contains(active.row, active.cell))
last = new Slick.Range(active.row, active.cell);
var dRow = last.toRow - last.fromRow,
dCell = last.toCell - last.fromCell,
// walking direction
dirRow = active.row == last.fromRow ? 1 : -1,
dirCell = active.cell == last.fromCell ? 1 : -1;
dCell = last.toCell - last.fromCell,
// walking direction
dirRow = active.row == last.fromRow ? 1 : -1,
dirCell = active.cell == last.fromCell ? 1 : -1;
if (e.which == 37) {
dCell -= dirCell;
dCell -= dirCell;
} else if (e.which == 39) {
dCell += dirCell ;
dCell += dirCell;
} else if (e.which == 38) {
dRow -= dirRow;
dRow -= dirRow;
} else if (e.which == 40) {
dRow += dirRow;
dRow += dirRow;
}
// define new selection range
var new_last = new Slick.Range(active.row, active.cell, active.row + dirRow*dRow, active.cell + dirCell*dCell);
var new_last = new Slick.Range(active.row, active.cell, active.row + dirRow * dRow, active.cell + dirCell * dCell);
if (removeInvalidRanges([new_last]).length) {

@@ -141,13 +148,13 @@ ranges.push(new_last);

var viewCell = dirCell > 0 ? new_last.toCell : new_last.fromCell;
_grid.scrollRowIntoView(viewRow);
_grid.scrollCellIntoView(viewRow, viewCell);
_grid.scrollRowIntoView(viewRow);
_grid.scrollCellIntoView(viewRow, viewCell);
}
else
else
ranges.push(last);
setSelectedRanges(ranges);
setSelectedRanges(ranges);
e.preventDefault();
e.stopPropagation();
}
e.stopPropagation();
}
}

@@ -154,0 +161,0 @@

@@ -98,4 +98,28 @@ (function ($) {

}
_grid.setActiveCell(row, getCheckboxColumnCellIndex());
_grid.focus();
}
function selectRows(rowArray) {
var i, l=rowArray.length, addRows = [];
for(i=0; i<l; i++) {
if (!_selectedRowsLookup[rowArray[i]]) {
addRows[addRows.length] = rowArray[i];
}
}
_grid.setSelectedRows(_grid.getSelectedRows().concat(addRows));
}
function deSelectRows(rowArray) {
var i, l=rowArray.length, removeRows = [];
for(i=0; i<l; i++) {
if (_selectedRowsLookup[rowArray[i]]) {
removeRows[removeRows.length] = rowArray[i];
}
}
_grid.setSelectedRows($.grep(_grid.getSelectedRows(), function (n) {
return removeRows.indexOf(n)<0
}));
}
function handleHeaderClick(e, args) {

@@ -124,2 +148,17 @@ if (args.column.id == _options.columnId && $(e.target).is(":checkbox")) {

var _checkboxColumnCellIndex = null;
function getCheckboxColumnCellIndex() {
if (_checkboxColumnCellIndex === null) {
_checkboxColumnCellIndex = 0;
var colArr = _grid.getColumns();
for (var i=0; i < colArr.length; i++) {
if (colArr[i].id == _options.columnId) {
_checkboxColumnCellIndex = i;
}
}
}
return _checkboxColumnCellIndex;
}
function getColumnDefinition() {

@@ -151,3 +190,4 @@ return {

"destroy": destroy,
"deSelectRows": deSelectRows,
"selectRows": selectRows,
"getColumnDefinition": getColumnDefinition

@@ -154,0 +194,0 @@ });

@@ -9,48 +9,2 @@ ## This is the 6pac SlickGrid repo

Also check out my [wiki](https://github.com/6pac/SlickGrid/wiki).
The following are the changes (most recent first) made since forking from the main MLeibman branch, a significant number in response to issues or pull requests.
**Maintenance:**
* breaking change: updated jquery.event.drag-2.2.js and jquery.event.drop-2.2.js to be compatible with jQuery 3, bumped these to jquery.event.drag-2.3.0.js and jquery.event.drop-2.3.0.js
* tested with jQuery 1.8.3, 1.11.2, 2.2.4, and 3.1.0 -- thanks to lfilho
* updated repo to work with jQuery 3.x (without needing jQuery-Migrate) -- thanks to lfilho
* fix bug with refresh last row of grid
* fix bug in compound editor example 'isValueChanged' method
* add internal keycode enums
* fix error in autotooltips test
* remove deprecated jquery .browser property
* fix bugs identified by JsHint
* Patch absBox for null element bug (MLeibman #1066)
* Fix column resizing issues with Bootstrap 3/box-sizing:border-box
* Fix jQueryUI css interfering with SlickGrid css issues
* Prevent useless onSelectedRangesChanged events in selectionmodels' setSelectedRanges
* Fix tooltip error with draggable columns
* additional version of ajax loading page, using Yahoo news and YQL as a source. the format of the grid rows is more in keeping with the newsfeed style of the original
* Fix Issue #963 ajax example not working
* update DataView compiled-expression regex to deal with some forms of minification
* fix grouping bug (issue #841 & #896 mleibman#898)
* Make default group comparer function more robust
* Fix unnecessary horizontal scroll for autosized columns when viewport has fractional pixel width
* Remove redundant slick pager code
* Fix bug in dataview causing model benchmark test to throw an error
* update to jquery-1.11.2 and jquery-ui-1.11.3, with minor patches to accommodate the change
**New features:**
* Add example of jQueryUI autocomplete editor
* Add KeyCaptureList property to editor, to allow editor to capture specified keys
* add optional fixed footer row
* Add example of dynamic tab and grid creation for grid with all the features of example-4-model
* Add example of dynamic tab and grid creation for basic grid
* add custom validator option to integer, float and date editors
* Add grid as member of args parameter for all events, and to column formatter. Add dataView as member of args parameter for all dataView events
* Add Floating Point editor
* Allow custom editors to suppress automatic cell clear on edit
* Add async post render async cleanup
* Add multi grid on page example (example-multi-grid-basic)
* Add jQueryUI accordion and Bootstrap 3 examples
* Add css manipulation so that grid initialises successfully if the parent element is hidden
Original mleibman [wiki](https://github.com/mleibman/SlickGrid/wiki).
Also check out the [wiki](https://github.com/6pac/SlickGrid/wiki) for news and documentation.

@@ -43,3 +43,4 @@ /***

UP: 38
}
},
"preClickClassName" : "slick-edit-preclick"
}

@@ -329,2 +330,9 @@ });

/***
* Whether a group selection checkbox is checked.
* @property selectChecked
* @type {Boolean}
*/
this.selectChecked = false;
/***
* GroupTotals, if any.

@@ -428,3 +436,3 @@ * @property totals

* Sets the specified edit controller as the active edit controller (acquire edit lock).
* If another edit controller is already active, and exception will be thrown.
* If another edit controller is already active, and exception will be throw new Error(.
* @method activate

@@ -438,9 +446,9 @@ * @param editController {EditController} edit controller acquiring the lock

if (activeEditController !== null) {
throw "SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController";
throw new Error("SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController");
}
if (!editController.commitCurrentEdit) {
throw "SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()";
throw new Error("SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()");
}
if (!editController.cancelCurrentEdit) {
throw "SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()";
throw new Error("SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()");
}

@@ -452,3 +460,3 @@ activeEditController = editController;

* Unsets the specified edit controller as the active edit controller (release edit lock).
* If the specified edit controller is not the active one, an exception will be thrown.
* If the specified edit controller is not the active one, an exception will be throw new Error(.
* @method deactivate

@@ -459,3 +467,3 @@ * @param editController {EditController} edit controller releasing the lock

if (activeEditController !== editController) {
throw "SlickGrid.EditorLock.deactivate: specified editController is not the currently active one";
throw new Error("SlickGrid.EditorLock.deactivate: specified editController is not the currently active one");
}

@@ -462,0 +470,0 @@ activeEditController = null;

@@ -110,3 +110,3 @@ (function ($) {

if (id === undefined) {
throw "Each data element must implement a unique 'id' property";
throw new Error("Each data element must implement a unique 'id' property");
}

@@ -122,3 +122,3 @@ idxById[id] = i;

if (id === undefined || idxById[id] !== i) {
throw "Each data element must implement a unique 'id' property";
throw new Error("Each data element must implement a unique 'id' property");
}

@@ -215,2 +215,11 @@ }

function getFilteredItems(){
return filteredItems;
}
function getFilter(){
return filter;
}
function setFilter(filterFn) {

@@ -303,2 +312,7 @@ filter = filterFn;

function getRowByItem(item) {
ensureRowsByIdCache();
return rowsById[item[idProperty]];
}
function getRowById(id) {

@@ -313,2 +327,14 @@ ensureRowsByIdCache();

function mapItemsToRows(itemArray) {
var rows = [];
ensureRowsByIdCache();
for (var i = 0, l = itemArray.length; i < l; i++) {
var row = rowsById[itemArray[i][idProperty]];
if (row != null) {
rows[rows.length] = row;
}
}
return rows;
}
function mapIdsToRows(idArray) {

@@ -338,3 +364,3 @@ var rows = [];

if (idxById[id] === undefined || id !== item[idProperty]) {
throw "Invalid or non-matching id";
throw new Error("Invalid or non-matching id");
}

@@ -355,2 +381,41 @@ items[idxById[id]] = item;

function sortedAddItem(item) {
// NOTE: assumes 'items' are sorted!
if(!sortComparer) {
throw new Error("sortedAddItem() requires a sort comparer, use sort()");
}
insertItem(sortedIndex(item), item);
}
function sortedUpdateItem(item) {
// NOTE: assumes 'items' are sorted!
if(!sortComparer) {
throw new Error("sortedUpdateItem() requires a sort comparer, use sort()");
}
var old_item = getItemById(item.id);
if(sortComparer(old_item, item) !== 0) {
// item affects sorting -> must use sorted add
deleteItem(item.id);
sortedAddItem(item);
}
else { // update does not affect sorting -> regular update works fine
updateItem(item.id, item);
}
}
function sortedIndex(searchItem) {
var low = 0, high = items.length;
while (low < high) {
var mid = low + high >>> 1;
if (sortComparer(items[mid], searchItem) === -1) {
low = mid + 1;
}
else {
high = mid;
}
}
return low;
}
function addItem(item) {

@@ -365,3 +430,3 @@ items.push(item);

if (idx === undefined) {
throw "Invalid id";
throw new Error("Invalid id");
}

@@ -774,7 +839,7 @@ delete idxById[id];

if (filteredItems.length <= pagenum * pagesize) {
if (filteredItems.length === 0) {
pagenum = 0;
} else {
pagenum = Math.floor((filteredItems.length - 1) / pagesize);
}
if (filteredItems.length === 0) {
pagenum = 0;
} else {
pagenum = Math.floor((filteredItems.length - 1) / pagesize);
}
}

@@ -995,2 +1060,6 @@ paged = filteredItems.slice(pagesize * pagenum, pagesize * pagenum + pagesize);

storeCellCssStyles(args.hash);
} else {
grid.onCellCssStylesChanged.unsubscribe(styleChanged);
self.onRowsChanged.unsubscribe(update);
self.onRowCountChanged.unsubscribe(update);
}

@@ -1013,2 +1082,4 @@ });

"setFilter": setFilter,
"getFilter": getFilter,
"getFilteredItems": getFilteredItems,
"sort": sort,

@@ -1027,5 +1098,7 @@ "fastSort": fastSort,

"getIdxById": getIdxById,
"getRowByItem": getRowByItem,
"getRowById": getRowById,
"getItemById": getItemById,
"getItemByIdx": getItemByIdx,
"mapItemsToRows": mapItemsToRows,
"mapRowsToIds": mapRowsToIds,

@@ -1039,2 +1112,4 @@ "mapIdsToRows": mapIdsToRows,

"addItem": addItem,
"sortedAddItem": sortedAddItem,
"sortedUpdateItem": sortedUpdateItem,
"deleteItem": deleteItem,

@@ -1041,0 +1116,0 @@ "syncGridSelection": syncGridSelection,

@@ -14,3 +14,3 @@ /***

"Integer": IntegerEditor,
"Float": FloatEditor,
"Float": FloatEditor,
"Date": DateEditor,

@@ -189,10 +189,10 @@ "YesNoSelect": YesNoSelectEditor,

function getDecimalPlaces() {
// returns the number of fixed decimal places or null
var rtn = args.column.editorFixedDecimalPlaces;
if (typeof rtn == 'undefined') {
rtn = FloatEditor.DefaultDecimalPlaces;
}
return (!rtn && rtn!==0 ? null : rtn);
}
function getDecimalPlaces() {
// returns the number of fixed decimal places or null
var rtn = args.column.editorFixedDecimalPlaces;
if (typeof rtn == 'undefined') {
rtn = FloatEditor.DefaultDecimalPlaces;
}
return (!rtn && rtn!==0 ? null : rtn);
}

@@ -202,8 +202,8 @@ this.loadValue = function (item) {

var decPlaces = getDecimalPlaces();
if (decPlaces !== null
&& (defaultValue || defaultValue===0)
&& defaultValue.toFixed) {
defaultValue = defaultValue.toFixed(decPlaces);
}
var decPlaces = getDecimalPlaces();
if (decPlaces !== null
&& (defaultValue || defaultValue===0)
&& defaultValue.toFixed) {
defaultValue = defaultValue.toFixed(decPlaces);
}

@@ -216,11 +216,16 @@ $input.val(defaultValue);

this.serializeValue = function () {
var rtn = parseFloat($input.val()) || 0;
var rtn = parseFloat($input.val());
if (FloatEditor.AllowEmptyValue) {
if (!rtn && rtn !==0) { rtn = ''; }
} else {
rtn |= 0;
}
var decPlaces = getDecimalPlaces();
if (decPlaces !== null
&& (rtn || rtn===0)
&& rtn.toFixed) {
rtn = parseFloat(rtn.toFixed(decPlaces));
}
var decPlaces = getDecimalPlaces();
if (decPlaces !== null
&& (rtn || rtn===0)
&& rtn.toFixed) {
rtn = parseFloat(rtn.toFixed(decPlaces));
}
return rtn;

@@ -262,2 +267,3 @@ };

FloatEditor.DefaultDecimalPlaces = null;
FloatEditor.AllowEmptyValue = false;

@@ -429,2 +435,6 @@ function DateEditor(args) {

this.preClick = function () {
$select.prop('checked', !$select.prop('checked'));
};
this.serializeValue = function () {

@@ -543,3 +553,3 @@ return $select.prop('checked');

$input = $("<TEXTAREA hidefocus rows=5 style='backround:white;width:250px;height:80px;border:0;outline:0'>")
$input = $("<TEXTAREA hidefocus rows=5 style='background:white;width:250px;height:80px;border:0;outline:0'>")
.appendTo($wrapper);

@@ -546,0 +556,0 @@

@@ -19,3 +19,5 @@ /***

"YesNo": YesNoFormatter,
"Checkmark": CheckmarkFormatter
"Checkmark": CheckmarkFormatter,
"Checkbox": CheckboxFormatter
}

@@ -57,2 +59,6 @@ }

function CheckboxFormatter(row, cell, value, columnDef, dataContext) {
return '<img class="slick-edit-preclick" src="../images/' + (value ? "CheckboxY" : "CheckboxN") + '.png">';
}
function CheckmarkFormatter(row, cell, value, columnDef, dataContext) {

@@ -59,0 +65,0 @@ return value ? "<img src='../images/tick.png'>" : "";

@@ -28,2 +28,5 @@ (function ($) {

var _defaults = {
checkboxSelect: false,
checkboxSelectCssClass: "slick-group-select-checkbox",
checkboxSelectPlugin: null,
groupCssClass: "slick-group",

@@ -52,3 +55,5 @@ groupTitleCssClass: "slick-group-title",

return "<span class='" + options.toggleCssClass + " " +
return (options.checkboxSelect ? '<span class="' + options.checkboxSelectCssClass +
' ' + (item.selectChecked ? 'checked' : 'unchecked') + '"></span>' : '') +
"<span class='" + options.toggleCssClass + " " +
(item.collapsed ? options.toggleCollapsedCssClass : options.toggleExpandedCssClass) +

@@ -82,4 +87,5 @@ "' style='margin-left:" + indentation +"'>" +

function handleGridClick(e, args) {
var $target = $(e.target);
var item = this.getDataItem(args.row);
if (item && item instanceof Slick.Group && $(e.target).hasClass(options.toggleCssClass)) {
if (item && item instanceof Slick.Group && $target.hasClass(options.toggleCssClass)) {
var range = _grid.getRenderedRange();

@@ -100,2 +106,10 @@ this.getData().setRefreshHints({

}
if (item && item instanceof Slick.Group && $target.hasClass(options.checkboxSelectCssClass)) {
item.selectChecked = !item.selectChecked;
$target.removeClass((item.selectChecked ? "unchecked" : "checked"));
$target.addClass((item.selectChecked ? "checked" : "unchecked"));
// get rowIndexes array
var rowIndexes = _grid.getData().mapItemsToRows(item.rows);
(item.selectChecked ? options.checkboxSelectPlugin.selectRows : options.checkboxSelectPlugin.deSelectRows)(rowIndexes);
}
}

@@ -102,0 +116,0 @@

(function ($) {
var grid;
const ROWS = 500, COLS = 10;
var grid, data, cols, $testgrid;
var el, offsetBefore, offsetAfter, dragged;

@@ -14,37 +15,50 @@

offsetAfter = el.offset();
}
var moved = function (dx, dy, msg) {
msg = msg ? msg + "." : "";
var actual = { left: offsetAfter.left, top: offsetAfter.top };
var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy };
same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
}
var ROWS = 500, COLS = 10;
var data = [], row;
for (var i = 0; i < ROWS; i++) {
row = { id: "id_" + i };
for (var j = 0; j < COLS; j++) {
row["col_" + j] = i + "." + j;
};
var setupData = function () {
data = [];
var row;
for (var i = 0; i < ROWS; i++) {
row = { id: "id_" + i };
for (var j = 0; j < COLS; j++) {
row["col_" + j] = i + "." + j;
}
data.push(row);
}
data.push(row);
}
var cols = [], col;
for (var i = 0; i < COLS; i++) {
cols.push({
id: "col" + i,
field: "col_" + i,
name: "col_" + i
});
}
cols[0].minWidth = 70;
grid = new Slick.Grid("#container", data, cols);
grid.render();
cols = [];
var col;
for (var i = 0; i < COLS; i++) {
cols.push({
id: "col" + i,
field: "col_" + i,
name: "col_" + i
});
}
module("grid - column resizing");
cols[0].minWidth = 70;
};
var setupGrid = function() {
setupData();
$testgrid = $("<div id='testgrid'></div>");
$testgrid.height(200);
$testgrid.width(200);
$("#container").append($testgrid);
grid = new Slick.Grid("#testgrid", data, cols);
grid.render();
};
var teardownGrid = function() {
$("body").find($testgrid).remove();
};
module("grid - column resizing", {
setup: setupGrid,
teardown: teardownGrid
});
test("minWidth is respected", function () {

@@ -68,3 +82,38 @@ var firstCol = $("#container .slick-header-column:first");

});
})(jQuery);
module("scrollColumnIntoView,", {
setup: setupGrid,
teardown: teardownGrid
});
test("when scrolling left with a column beyond the left edge of the viewport," +
" the viewport scrolls one column to the left", function () {
var viewport = grid.getViewport;
// move viewport over to the right by three
var initialRightmostCell = grid.getCellFromPoint(viewport().rightPx, 0);
grid.scrollCellIntoView(0, initialRightmostCell.cell + 3);
// now scroll left one column
var leftmostCellInViewport = grid.getCellFromPoint(viewport().leftPx, 0);
grid.scrollColumnIntoView(leftmostCellInViewport.cell-1);
var leftmostCellAfterScroll = grid.getCellFromPoint(viewport().leftPx, 0);
strictEqual(leftmostCellAfterScroll.cell, 1, "left column is one further left");
});
test("given we started scrolled down," +
"when we scroll right the viewport does not scroll rows", function () {
var viewport = grid.getViewport;
grid.scrollRowIntoView(100);
var rowPositionBeforeColumnScroll = viewport().top;
// scroll right
var initialRightmostCell = grid.getCellFromPoint(viewport().rightPx, 0);
grid.scrollColumnIntoView(initialRightmostCell.cell + 3);
strictEqual(viewport().top, rowPositionBeforeColumnScroll, "we have not scrolled");
});
})(jQuery);

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

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

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

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 too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc