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.4.3 to 2.4.4

plugins/slick.autocolumnsize.js

2

package.json
{
"name": "slickgrid",
"version": "2.4.3",
"version": "2.4.4",
"description": "A lightning fast JavaScript grid/spreadsheet",

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

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

if (typeof options === "undefined" || typeof options.cellRangeSelector === "undefined") {
if (typeof options === "undefined" || typeof options.cellRangeSelector === "undefined") {
_selector = new Slick.CellRangeSelector({

@@ -88,3 +88,3 @@ "selectionCss": {

var rangeHasChanged = !rangesAreEqual(_ranges, ranges);
_ranges = removeInvalidRanges(ranges);

@@ -135,7 +135,7 @@ if (rangeHasChanged) { _self.onSelectedRangesChanged.notify(_ranges); }

ranges = getSelectedRanges();
ranges = getSelectedRanges().slice();
if (!ranges.length)
ranges.push(new Slick.Range(active.row, active.cell));
// keyboard can work with last range only
// keyboard can work with last range only
last = ranges.pop();

@@ -163,3 +163,3 @@

// define new selection range
// define new selection range
var new_last = new Slick.Range(active.row, active.cell, active.row + dirRow * dRow, active.cell + dirCell * dCell);

@@ -166,0 +166,0 @@ if (removeInvalidRanges([new_last]).length) {

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

var _grid;
var _canRowBeSelected = null;
var _selectAll_UID = createUID();

@@ -35,3 +36,3 @@ var _handler = new Slick.EventHandler();

.subscribe(_grid.onKeyDown, handleKeyDown);
if (!_options.hideInFilterHeaderRow) {

@@ -55,3 +56,3 @@ addCheckboxToFilterHeaderRow(grid);

_options = $.extend(true, {}, _options, options);
if (_options.hideSelectAllCheckbox) {

@@ -62,7 +63,3 @@ hideSelectAllFromColumnHeaderTitleRow();

if (!_options.hideInColumnTitleRow) {
if (_isSelectAllChecked) {
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + _selectAll_UID + "' type='checkbox' checked='checked'><label for='header-selector" + _selectAll_UID + "'></label>", _options.toolTip);
} else {
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + _selectAll_UID + "' type='checkbox'><label for='header-selector" + _selectAll_UID + "'></label>", _options.toolTip);
}
renderSelectAllCheckbox(_isSelectAllChecked);
_handler.subscribe(_grid.onHeaderClick, handleHeaderClick);

@@ -80,3 +77,3 @@ } else {

}
}
}
}

@@ -95,9 +92,29 @@

var lookup = {}, row, i;
var disabledCount = 0;
if (typeof _canRowBeSelected === 'function') {
for (k = 0; k < _grid.getDataLength(); k++) {
// If we are allowed to select the row
var dataItem = _grid.getDataItem(k);
if (!checkcanRowBeSelected(i, dataItem, _grid)) {
disabledCount++;
}
}
}
var removeList = [];
for (i = 0; i < selectedRows.length; i++) {
row = selectedRows[i];
lookup[row] = true;
if (lookup[row] !== _selectedRowsLookup[row]) {
_grid.invalidateRow(row);
delete _selectedRowsLookup[row];
// If we are allowed to select the row
var rowItem = _grid.getDataItem(row);
if (checkcanRowBeSelected(i, rowItem, _grid)) {
lookup[row] = true;
if (lookup[row] !== _selectedRowsLookup[row]) {
_grid.invalidateRow(row);
delete _selectedRowsLookup[row];
}
}
else {
removeList.push(row);
}
}

@@ -109,11 +126,7 @@ for (i in _selectedRowsLookup) {

_grid.render();
_isSelectAllChecked = selectedRows.length && selectedRows.length == _grid.getDataLength();
_isSelectAllChecked = selectedRows.length && selectedRows.length + disabledCount >= _grid.getDataLength();
if (!_options.hideInColumnTitleRow && !_options.hideSelectAllCheckbox) {
if (_isSelectAllChecked) {
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + _selectAll_UID + "' type='checkbox' checked='checked'><label for='header-selector" + _selectAll_UID + "'></label>", _options.toolTip);
} else {
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + _selectAll_UID + "' type='checkbox'><label for='header-selector" + _selectAll_UID + "'></label>", _options.toolTip);
}
}
renderSelectAllCheckbox(_isSelectAllChecked);
}
if (!_options.hideInFilterHeaderRow) {

@@ -123,2 +136,10 @@ var selectAllElm = $("#header-filter-selector" + _selectAll_UID);

}
// Remove items that shouln't of been selected in the first place (Got here Ctrl + click)
if (removeList.length > 0) {
for (i = 0; i < removeList.length; i++) {
var remIdx = selectedRows.indexOf(removeList[i]);
selectedRows.splice(remIdx, 1);
}
_grid.setSelectedRows(selectedRows);
}
}

@@ -156,2 +177,7 @@

function toggleRowSelection(row) {
var dataContext = _grid.getDataItem(row);
if (!checkcanRowBeSelected(row, dataContext, _grid)) {
return;
}
if (_selectedRowsLookup[row]) {

@@ -165,3 +191,2 @@ _grid.setSelectedRows($.grep(_grid.getSelectedRows(), function (n) {

_grid.setActiveCell(row, getCheckboxColumnCellIndex());
_grid.focus();
}

@@ -203,3 +228,7 @@

for (var i = 0; i < _grid.getDataLength(); i++) {
rows.push(i);
// Get the row and check it's a selectable row before pushing it onto the stack
var rowItem = _grid.getDataItem(i);
if (rowItem.selectableRow !== false) {
rows.push(i);
}
}

@@ -251,4 +280,4 @@ _grid.setSelectedRows(rows);

.appendTo(args.node)
.on('click', function(evnt) {
handleHeaderClick(evnt, args)
.on('click', function(evnt) {
handleHeaderClick(evnt, args)
});

@@ -263,9 +292,13 @@ }

function checkboxSelectionFormatter(row, cell, value, columnDef, dataContext) {
function checkboxSelectionFormatter(row, cell, value, columnDef, dataContext, grid) {
var UID = createUID() + row;
if (dataContext) {
return _selectedRowsLookup[row]
? "<input id='selector" + UID + "' type='checkbox' checked='checked'><label for='selector" + UID + "'></label>"
: "<input id='selector" + UID + "' type='checkbox'><label for='selector" + UID + "'></label>";
if (!checkcanRowBeSelected(row, dataContext, grid)) {
return null;
} else {
return _selectedRowsLookup[row]
? "<input id='selector" + UID + "' type='checkbox' checked='checked'><label for='selector" + UID + "'></label>"
: "<input id='selector" + UID + "' type='checkbox'><label for='selector" + UID + "'></label>";
}
}

@@ -275,2 +308,27 @@ return null;

function checkcanRowBeSelected(row, dataContext, grid) {
if (typeof _canRowBeSelected === 'function') {
return _canRowBeSelected(row, dataContext, grid);
}
return true;
}
function renderSelectAllCheckbox(isSelectAllChecked) {
if (isSelectAllChecked) {
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + _selectAll_UID + "' type='checkbox' checked='checked'><label for='header-selector" + _selectAll_UID + "'></label>", _options.toolTip);
} else {
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + _selectAll_UID + "' type='checkbox'><label for='header-selector" + _selectAll_UID + "'></label>", _options.toolTip);
}
}
/**
* Method that user can pass to override the default behavior or making every row a selectable row.
* In order word, user can choose which rows to be selectable or not by providing his own logic.
* @param overrideFn: override function callback
*/
function canRowBeSelected(overrideFn) {
_canRowBeSelected = overrideFn;
}
$.extend(this, {

@@ -283,2 +341,3 @@ "init": init,

"getOptions": getOptions,
"canRowBeSelected": canRowBeSelected,
"setOptions": setOptions,

@@ -285,0 +344,0 @@ });

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

var onRowsChanged = new Slick.Event();
var onRowsOrCountChanged = new Slick.Event();
var onPagingInfoChanged = new Slick.Event();

@@ -938,7 +939,10 @@

if (countBefore !== rows.length) {
onRowCountChanged.notify({previous: countBefore, current: rows.length, dataView: self}, null, self);
onRowCountChanged.notify({previous: countBefore, current: rows.length, dataView: self, callingOnRowsChanged: (diff.length > 0)}, null, self);
}
if (diff.length > 0) {
onRowsChanged.notify({rows: diff, dataView: self}, null, self);
onRowsChanged.notify({rows: diff, dataView: self, calledOnRowCountChanged: (countBefore !== rows.length)}, null, self);
}
if (countBefore !== rows.length || diff.length > 0) {
onRowsOrCountChanged.notify({rowsDiff: diff, previousRowCount: countBefore, currentRowCount: rows.length, dataView: self}, null, self);
}
}

@@ -1010,6 +1014,4 @@

this.onRowsChanged.subscribe(update);
this.onRowsOrCountChanged.subscribe(update);
this.onRowCountChanged.subscribe(update);
return onSelectedRowIdsChanged;

@@ -1057,10 +1059,7 @@ }

grid.onCellCssStylesChanged.unsubscribe(styleChanged);
self.onRowsChanged.unsubscribe(update);
self.onRowCountChanged.unsubscribe(update);
self.onRowsOrCountChanged.unsubscribe(update);
}
});
this.onRowsChanged.subscribe(update);
this.onRowCountChanged.subscribe(update);
this.onRowsOrCountChanged.subscribe(update);
}

@@ -1119,2 +1118,3 @@

"onRowsChanged": onRowsChanged,
"onRowsOrCountChanged": onRowsOrCountChanged,
"onPagingInfoChanged": onPagingInfoChanged

@@ -1121,0 +1121,0 @@ });

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