slickgrid
Advanced tools
Comparing version 2.4.11 to 2.4.12
@@ -28,5 +28,4 @@ /*** | ||
'use strict'; | ||
(function ($) { | ||
'use strict'; | ||
function SlickColumnPicker(columns, grid, options) { | ||
@@ -36,3 +35,2 @@ var _grid = grid; | ||
var $columnTitleElm; | ||
var columns; | ||
var $list; | ||
@@ -39,0 +37,0 @@ var $menu; |
@@ -108,3 +108,2 @@ /*** | ||
var $menu; | ||
var columns; | ||
var columnCheckboxes; | ||
@@ -111,0 +110,0 @@ var _defaults = { |
@@ -27,8 +27,8 @@ (function ($) { | ||
return { | ||
canGotoFirst: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum > 0, | ||
canGotoLast: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum != lastPage, | ||
canGotoPrev: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum > 0, | ||
canGotoNext: !cannotLeaveEditMode && pagingInfo.pageSize != 0 && pagingInfo.pageNum < lastPage, | ||
canGotoFirst: !cannotLeaveEditMode && pagingInfo.pageSize !== 0 && pagingInfo.pageNum > 0, | ||
canGotoLast: !cannotLeaveEditMode && pagingInfo.pageSize !== 0 && pagingInfo.pageNum !== lastPage, | ||
canGotoPrev: !cannotLeaveEditMode && pagingInfo.pageSize !== 0 && pagingInfo.pageNum > 0, | ||
canGotoNext: !cannotLeaveEditMode && pagingInfo.pageSize !== 0 && pagingInfo.pageNum < lastPage, | ||
pagingInfo: pagingInfo | ||
} | ||
}; | ||
} | ||
@@ -82,3 +82,3 @@ | ||
var pagesize = $(e.target).attr("data"); | ||
if (pagesize != undefined) { | ||
if (pagesize !== undefined) { | ||
if (pagesize == -1) { | ||
@@ -98,3 +98,3 @@ var vp = grid.getViewport(); | ||
.click(function () { | ||
$(".slick-pager-settings-expanded").toggle() | ||
$(".slick-pager-settings-expanded").toggle(); | ||
}) | ||
@@ -145,3 +145,3 @@ .appendTo($settings); | ||
if (pagingInfo.pageSize == 0) { | ||
if (pagingInfo.pageSize === 0) { | ||
$status.text(_options.showAllText.replace('{rowCount}', pagingInfo.totalRows + "").replace('{pageCount}', pagingInfo.totalPages + "")); | ||
@@ -148,0 +148,0 @@ } else { |
{ | ||
"name": "slickgrid", | ||
"version": "2.4.11", | ||
"version": "2.4.12", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -5,0 +5,0 @@ "main": "slick.core.js", |
@@ -38,3 +38,3 @@ (function ($) { | ||
ranges = _grid.getSelectionModel().getSelectedRanges(); | ||
if (ranges.length != 0) { | ||
if (ranges.length !== 0) { | ||
e.preventDefault(); | ||
@@ -41,0 +41,0 @@ _copiedRanges = ranges; |
@@ -139,3 +139,3 @@ (function ($) { | ||
// trim trailing CR if present | ||
if (clipRows[clipRows.length - 1]=="") { clipRows.pop(); } | ||
if (clipRows[clipRows.length - 1]==="") { clipRows.pop(); } | ||
@@ -147,3 +147,3 @@ var clippedRange = []; | ||
for (var i=0; i<clipRows.length; i++) { | ||
if (clipRows[i]!="") | ||
if (clipRows[i]!=="") | ||
clippedRange[j++] = clipRows[i].split("\t"); | ||
@@ -256,3 +256,3 @@ else | ||
'toRow': activeRow+this.h-1 | ||
} | ||
}; | ||
@@ -293,3 +293,3 @@ this.markCopySelection([bRange]); | ||
'toRow': activeRow+this.h-1 | ||
} | ||
}; | ||
@@ -336,3 +336,3 @@ this.markCopySelection([bRange]); | ||
ranges = _grid.getSelectionModel().getSelectedRanges(); | ||
if (ranges.length != 0) { | ||
if (ranges.length !== 0) { | ||
_copiedRanges = ranges; | ||
@@ -352,3 +352,3 @@ markCopySelection(ranges); | ||
if (clipTextRows == "" && _options.includeHeaderWhenCopying) { | ||
if (clipTextRows === "" && _options.includeHeaderWhenCopying) { | ||
var clipTextHeaders = []; | ||
@@ -355,0 +355,0 @@ for (var j = range.fromCell; j < range.toCell + 1 ; j++) { |
@@ -152,3 +152,3 @@ (function ($) { | ||
// trim trailing CR if present | ||
if (clipRows[clipRows.length - 1]=="") { clipRows.pop(); } | ||
if (clipRows[clipRows.length - 1]==="") { clipRows.pop(); } | ||
@@ -160,3 +160,3 @@ var clippedRange = []; | ||
for (var i=0; i<clipRows.length; i++) { | ||
if (clipRows[i]!="") | ||
if (clipRows[i]!=="") | ||
clippedRange[j++] = clipRows[i].split("\t"); | ||
@@ -269,3 +269,3 @@ else | ||
'toRow': activeRow+this.h-1 | ||
} | ||
}; | ||
@@ -306,3 +306,3 @@ this.markCopySelection([bRange]); | ||
'toRow': activeRow+this.h-1 | ||
} | ||
}; | ||
@@ -349,3 +349,3 @@ this.markCopySelection([bRange]); | ||
ranges = _grid.getSelectionModel().getSelectedRanges(); | ||
if (ranges.length != 0) { | ||
if (ranges.length !== 0) { | ||
_copiedRanges = ranges; | ||
@@ -365,3 +365,3 @@ markCopySelection(ranges); | ||
if (clipTextRows == "" && _options.includeHeaderWhenCopying) { | ||
if (clipTextRows === "" && _options.includeHeaderWhenCopying) { | ||
var clipTextHeaders = []; | ||
@@ -368,0 +368,0 @@ for (var j = range.fromCell; j < range.toCell + 1 ; j++) { |
@@ -45,3 +45,3 @@ (function ($) { | ||
if (!_options.hideInColumnTitleRow) { | ||
_handler.subscribe(_grid.onHeaderClick, handleHeaderClick) | ||
_handler.subscribe(_grid.onHeaderClick, handleHeaderClick); | ||
} | ||
@@ -182,3 +182,3 @@ } | ||
_grid.setSelectedRows($.grep(_grid.getSelectedRows(), function (n) { | ||
return n != row | ||
return n != row; | ||
})); | ||
@@ -209,3 +209,3 @@ } else { | ||
_grid.setSelectedRows($.grep(_grid.getSelectedRows(), function (n) { | ||
return removeRows.indexOf(n) < 0 | ||
return removeRows.indexOf(n) < 0; | ||
})); | ||
@@ -278,3 +278,3 @@ } | ||
.on('click', function (evnt) { | ||
handleHeaderClick(evnt, args) | ||
handleHeaderClick(evnt, args); | ||
}); | ||
@@ -281,0 +281,0 @@ } |
@@ -84,7 +84,7 @@ /** | ||
var groupableIcon = $("<span class='slick-column-groupable' />"); | ||
if(options.groupIconCssClass) groupableIcon.addClass(options.groupIconCssClass) | ||
if(options.groupIconImage) groupableIcon.css("background", "url(" + options.groupIconImage + ") no-repeat center center"); | ||
if(options.groupIconCssClass) { groupableIcon.addClass(options.groupIconCssClass); } | ||
if(options.groupIconImage) { groupableIcon.css("background", "url(" + options.groupIconImage + ") no-repeat center center"); } | ||
$(node).css('cursor', 'pointer').append(groupableIcon); | ||
} | ||
}) | ||
}); | ||
@@ -231,5 +231,5 @@ for (var i = 0; i < _gridColumns.length; i++) { | ||
var entry = $("<div id='" + _gridUid + e.id + "_entry' data-id='" + e.id + "' class='slick-dropped-grouping'>"); | ||
var groupText = $("<div style='display: inline-flex'>" + column.text() + "</div>") | ||
var groupText = $("<div style='display: inline-flex'>" + column.text() + "</div>"); | ||
groupText.appendTo(entry); | ||
var groupRemoveIcon = $("<div class='slick-groupby-remove'> </div>") | ||
var groupRemoveIcon = $("<div class='slick-groupby-remove'> </div>"); | ||
if(options.deleteIconCssClass) groupRemoveIcon.addClass(options.deleteIconCssClass); | ||
@@ -266,3 +266,3 @@ if(options.deleteIconImage) groupRemoveIcon.css("background", "url(" + options.deleteIconImage + ") no-repeat center right"); | ||
var groupingInfos = (groupingInfo instanceof Array) ? groupingInfo : [groupingInfo]; | ||
dropboxPlaceholder.hide() | ||
dropboxPlaceholder.hide(); | ||
for (var i = 0; i < groupingInfos.length; i++) { | ||
@@ -278,3 +278,3 @@ var column = $(_grid.getHeaderColumn(groupingInfos[i])); | ||
groupToggler.css("display", "none"); | ||
dropboxPlaceholder.show() | ||
dropboxPlaceholder.show(); | ||
} | ||
@@ -302,3 +302,3 @@ | ||
removeFromArray(columnsGroupBy, groupby[id]); | ||
if(columnsGroupBy.length == 0){ | ||
if(columnsGroupBy.length === 0){ | ||
dropboxPlaceholder.show(); | ||
@@ -310,3 +310,3 @@ } | ||
function updateGroupBy(originator) { | ||
if (columnsGroupBy.length == 0) { | ||
if (columnsGroupBy.length === 0) { | ||
_dataView.setGrouping([]); | ||
@@ -324,3 +324,3 @@ onGroupChanged.notify({ caller: originator, groupColumns: [] }); | ||
*/ | ||
onGroupChanged.notify({ caller: originator, groupColumns: groupingArray}) | ||
onGroupChanged.notify({ caller: originator, groupColumns: groupingArray}); | ||
} | ||
@@ -327,0 +327,0 @@ |
@@ -278,3 +278,3 @@ (function ($) { | ||
if (command != null && command != '') { | ||
if (command != null && command !== '') { | ||
_self.onCommand.notify({ | ||
@@ -281,0 +281,0 @@ "grid": _grid, |
@@ -518,3 +518,3 @@ /*** | ||
if (!args || (!args.item && !args.itemDetail)) { | ||
throw 'Slick.RowDetailView plugin requires the onAsyncResponse() to supply "args.item" property.' | ||
throw 'Slick.RowDetailView plugin requires the onAsyncResponse() to supply "args.item" property.'; | ||
} | ||
@@ -574,3 +574,3 @@ | ||
return item; | ||
} | ||
}; | ||
@@ -622,11 +622,11 @@ ////////////////////////////////////////////////////////////// | ||
if (dataContext[_keyPrefix + 'collapsed'] == undefined) { | ||
dataContext[_keyPrefix + 'collapsed'] = true, | ||
dataContext[_keyPrefix + 'sizePadding'] = 0, //the required number of pading rows | ||
dataContext[_keyPrefix + 'height'] = 0, //the actual height in pixels of the detail field | ||
dataContext[_keyPrefix + 'isPadding'] = false, | ||
dataContext[_keyPrefix + 'parent'] = undefined, | ||
dataContext[_keyPrefix + 'offset'] = 0 | ||
dataContext[_keyPrefix + 'collapsed'] = true; | ||
dataContext[_keyPrefix + 'sizePadding'] = 0; //the required number of pading rows | ||
dataContext[_keyPrefix + 'height'] = 0; //the actual height in pixels of the detail field | ||
dataContext[_keyPrefix + 'isPadding'] = false; | ||
dataContext[_keyPrefix + 'parent'] = undefined; | ||
dataContext[_keyPrefix + 'offset'] = 0; | ||
} | ||
if (dataContext[_keyPrefix + 'isPadding'] == true) { | ||
if (dataContext[_keyPrefix + 'isPadding']) { | ||
// render nothing | ||
@@ -633,0 +633,0 @@ } |
@@ -55,3 +55,3 @@ (function ($) { | ||
if (selectedRows.length == 0 || $.inArray(cell.row, selectedRows) == -1) { | ||
if (selectedRows.length === 0 || $.inArray(cell.row, selectedRows) == -1) { | ||
selectedRows = [cell.row]; | ||
@@ -58,0 +58,0 @@ _grid.setSelectedRows(selectedRows); |
@@ -107,3 +107,3 @@ (function ($) { | ||
selectedRows.sort(function (x, y) { | ||
return x - y | ||
return x - y; | ||
}); | ||
@@ -110,0 +110,0 @@ |
@@ -135,3 +135,3 @@ /*** | ||
return isImmediatePropagationStopped; | ||
} | ||
}; | ||
} | ||
@@ -232,3 +232,3 @@ | ||
return this; // allow chaining | ||
} | ||
}; | ||
} | ||
@@ -317,3 +317,3 @@ | ||
} | ||
} | ||
}; | ||
} | ||
@@ -708,3 +708,3 @@ | ||
}); | ||
} | ||
}; | ||
} | ||
@@ -711,0 +711,0 @@ })(jQuery); |
@@ -10,3 +10,4 @@ (function ($) { | ||
Max: MaxAggregator, | ||
Sum: SumAggregator | ||
Sum: SumAggregator, | ||
Count: CountAggregator | ||
} | ||
@@ -190,3 +191,3 @@ } | ||
Object.prototype.toString = (typeof field == "function") ? field : function () { | ||
return this[field] | ||
return this[field]; | ||
}; | ||
@@ -713,3 +714,5 @@ // an extra reversal for descending sort keeps the sort stable | ||
function getFunctionInfo(fn) { | ||
var fnRegex = /^function[^(]*\(([^)]*)\)\s*{([\s\S]*)}$/; | ||
var fnStr = fn.toString(); | ||
var usingEs5 = fnStr.indexOf('function') >= 0; // with ES6, the word function is not present | ||
var fnRegex = usingEs5 ? /^function[^(]*\(([^)]*)\)\s*{([\s\S]*)}$/ : /^[^(]*\(([^)]*)\)\s*{([\s\S]*)}$/; | ||
var matches = fn.toString().match(fnRegex); | ||
@@ -723,12 +726,19 @@ return { | ||
function compileAccumulatorLoop(aggregator) { | ||
var accumulatorInfo = getFunctionInfo(aggregator.accumulate); | ||
var fn = new Function( | ||
"_items", | ||
"for (var " + accumulatorInfo.params[0] + ", _i=0, _il=_items.length; _i<_il; _i++) {" + | ||
accumulatorInfo.params[0] + " = _items[_i]; " + | ||
accumulatorInfo.body + | ||
"}" | ||
); | ||
fn.displayName = fn.name = "compiledAccumulatorLoop"; | ||
return fn; | ||
if(aggregator.accumulate) { | ||
var accumulatorInfo = getFunctionInfo(aggregator.accumulate); | ||
var fn = new Function( | ||
"_items", | ||
"for (var " + accumulatorInfo.params[0] + ", _i=0, _il=_items.length; _i<_il; _i++) {" + | ||
accumulatorInfo.params[0] + " = _items[_i]; " + | ||
accumulatorInfo.body + | ||
"}" | ||
); | ||
var fnName = "compiledAccumulatorLoop"; | ||
fn.displayName = fnName; | ||
fn.name = setFunctionName(fn, fnName); | ||
return fn; | ||
} else { | ||
return function noAccumulator() { | ||
} | ||
} | ||
} | ||
@@ -769,3 +779,5 @@ | ||
var fn = new Function("_items,_args", tpl); | ||
fn.displayName = fn.name = "compiledFilter"; | ||
var fnName = "compiledFilter"; | ||
fn.displayName = fnName; | ||
fn.name = setFunctionName(fn, fnName); | ||
return fn; | ||
@@ -811,6 +823,26 @@ } | ||
var fn = new Function("_items,_args,_cache", tpl); | ||
fn.displayName = fn.name = "compiledFilterWithCaching"; | ||
var fnName = "compiledFilterWithCaching"; | ||
fn.displayName = fnName; | ||
fn.name = setFunctionName(fn, fnName); | ||
return fn; | ||
} | ||
/** | ||
* In ES5 we could set the function name on the fly but in ES6 this is forbidden and we need to set it through differently | ||
* We can use Object.defineProperty and set it the property to writable, see MDN for reference | ||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty | ||
* @param {string} fn | ||
* @param {string} fnName | ||
*/ | ||
function setFunctionName(fn, fnName) { | ||
if (Object && Object.defineProperty) { | ||
Object.defineProperty(fn, 'name', { | ||
writable: true, | ||
value: fnName | ||
}); | ||
} else { | ||
fn.name = fnName; | ||
} | ||
} | ||
function uncompiledFilter(items, args) { | ||
@@ -978,4 +1010,6 @@ var retval = [], idx = 0; | ||
if (countBefore !== rows.length || diff.length > 0) { | ||
onRowsOrCountChanged.notify({rowsDiff: diff, previousRowCount: countBefore, currentRowCount: rows.length, | ||
rowCountChanged: countBefore !== rows.length, rowsChanged: diff.length > 0, dataView: self}, null, self); | ||
onRowsOrCountChanged.notify({ | ||
rowsDiff: diff, previousRowCount: countBefore, currentRowCount: rows.length, | ||
rowCountChanged: countBefore !== rows.length, rowsChanged: diff.length > 0, dataView: self | ||
}, null, self); | ||
} | ||
@@ -1177,3 +1211,3 @@ } | ||
} | ||
if (this.nonNullCount_ != 0) { | ||
if (this.nonNullCount_ !== 0) { | ||
groupTotals.avg[this.field_] = this.sum_ / this.nonNullCount_; | ||
@@ -1205,3 +1239,3 @@ } | ||
groupTotals.min[this.field_] = this.min_; | ||
} | ||
}; | ||
} | ||
@@ -1230,3 +1264,3 @@ | ||
groupTotals.max[this.field_] = this.max_; | ||
} | ||
}; | ||
} | ||
@@ -1253,5 +1287,19 @@ | ||
groupTotals.sum[this.field_] = this.sum_; | ||
} | ||
}; | ||
} | ||
function CountAggregator(field) { | ||
this.field_ = field; | ||
this.init = function () { | ||
}; | ||
this.storeResult = function (groupTotals) { | ||
if (!groupTotals.count) { | ||
groupTotals.count = {}; | ||
} | ||
groupTotals.count[this.field_] = groupTotals.group.rows.length; | ||
}; | ||
} | ||
// TODO: add more built-in aggregators | ||
@@ -1258,0 +1306,0 @@ // TODO: merge common aggregators in one to prevent needles iterating |
@@ -70,3 +70,3 @@ /*** | ||
this.isValueChanged = function () { | ||
return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
return (!($input.val() === "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
}; | ||
@@ -129,3 +129,3 @@ | ||
this.isValueChanged = function () { | ||
return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
return (!($input.val() === "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
}; | ||
@@ -226,3 +226,3 @@ | ||
this.isValueChanged = function () { | ||
return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
return (!($input.val() === "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
}; | ||
@@ -271,6 +271,6 @@ | ||
beforeShow: function () { | ||
calendarOpen = true | ||
calendarOpen = true; | ||
}, | ||
onClose: function () { | ||
calendarOpen = false | ||
calendarOpen = false; | ||
} | ||
@@ -329,3 +329,3 @@ }); | ||
this.isValueChanged = function () { | ||
return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
return (!($input.val() === "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
}; | ||
@@ -472,3 +472,3 @@ | ||
slide: function (event, ui) { | ||
$input.val(ui.value) | ||
$input.val(ui.value); | ||
} | ||
@@ -480,3 +480,3 @@ }); | ||
$picker.find(".editor-percentcomplete-slider").slider("value", $(this).attr("val")); | ||
}) | ||
}); | ||
}; | ||
@@ -507,3 +507,3 @@ | ||
this.isValueChanged = function () { | ||
return (!($input.val() == "" && defaultValue == null)) && ((parseInt($input.val(), 10) || 0) != defaultValue); | ||
return (!($input.val() === "" && defaultValue == null)) && ((parseInt($input.val(), 10) || 0) != defaultValue); | ||
}; | ||
@@ -605,3 +605,3 @@ | ||
.css("top", position.top - 5) | ||
.css("left", position.left - 5) | ||
.css("left", position.left - 5); | ||
}; | ||
@@ -631,3 +631,3 @@ | ||
this.isValueChanged = function () { | ||
return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
return (!($input.val() === "" && defaultValue == null)) && ($input.val() != defaultValue); | ||
}; | ||
@@ -634,0 +634,0 @@ |
@@ -140,6 +140,7 @@ (function ($) { | ||
function getGroupRowMetadata(item) { | ||
var groupLevel = item && item.level; | ||
return { | ||
selectable: false, | ||
focusable: options.groupFocusable, | ||
cssClasses: options.groupCssClass, | ||
cssClasses: options.groupCssClass + ' slick-group-level-' + groupLevel, | ||
columns: { | ||
@@ -156,6 +157,7 @@ 0: { | ||
function getTotalsRowMetadata(item) { | ||
var groupLevel = item && item.group && item.group.level; | ||
return { | ||
selectable: false, | ||
focusable: options.totalsFocusable, | ||
cssClasses: options.totalsCssClass, | ||
cssClasses: options.totalsCssClass + ' slick-group-level-' + groupLevel, | ||
formatter: options.totalsFormatter, | ||
@@ -162,0 +164,0 @@ editor: null |
@@ -95,6 +95,6 @@ (function ($) { | ||
success: function (json, textStatus, xOptions) { | ||
onSuccess(json, recStart) | ||
onSuccess(json, recStart); | ||
}, | ||
error: function () { | ||
onError(fromPage, toPage) | ||
onError(fromPage, toPage); | ||
} | ||
@@ -101,0 +101,0 @@ }); |
@@ -97,3 +97,3 @@ (function ($) { | ||
error: function () { | ||
onError(fromPage, toPage) | ||
onError(fromPage, toPage); | ||
} | ||
@@ -100,0 +100,0 @@ }); |
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
3941911
135
92891