slickgrid
Advanced tools
Comparing version 2.4.33 to 2.4.34
@@ -506,8 +506,2 @@ /*** | ||
// does the user want to leave open the Grid Menu after executing a command? | ||
var leaveOpen = (_options.gridMenu && _options.gridMenu.leaveOpen) ? true : false; | ||
if (!leaveOpen) { | ||
hideMenu(e); | ||
} | ||
if (command != null && command != '') { | ||
@@ -529,2 +523,8 @@ var callbackArgs = { | ||
// does the user want to leave open the Grid Menu after executing a command? | ||
var leaveOpen = (_options.gridMenu && _options.gridMenu.leaveOpen) ? true : false; | ||
if (!leaveOpen && !e.isDefaultPrevented()) { | ||
hideMenu(e); | ||
} | ||
// Stop propagation so that it doesn't register as a header click event. | ||
@@ -531,0 +531,0 @@ e.preventDefault(); |
@@ -7,3 +7,5 @@ (function ($) { | ||
showAllText: "Showing all {rowCount} rows", | ||
showPageText: "Showing page {pageNum} of {pageCount}" | ||
showPageText: "Showing page {pageNum} of {pageCount}", | ||
showCountText: "From {countBegin} to {countEnd} of {rowCount} rows", | ||
showCount: false | ||
}; | ||
@@ -148,2 +150,21 @@ | ||
} | ||
if (_options.showCount && pagingInfo.pageSize!==0) | ||
{ | ||
var pageBegin = pagingInfo.pageNum * pagingInfo.pageSize; | ||
var currentText = $status.text(); | ||
if (currentText) | ||
{ | ||
currentText += " - "; | ||
} | ||
$status.text( | ||
currentText + | ||
_options.showCountText | ||
.replace('{rowCount}', pagingInfo.totalRows + "") | ||
.replace("{countBegin}", pageBegin + 1) | ||
.replace("{countEnd}", Math.min(pageBegin + pagingInfo.pageSize, pagingInfo.totalRows)) | ||
); | ||
} | ||
} | ||
@@ -150,0 +171,0 @@ |
{ | ||
"name": "slickgrid", | ||
"version": "2.4.33", | ||
"version": "2.4.34", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -5,0 +5,0 @@ "main": "slick.core.js", |
@@ -229,3 +229,3 @@ (function ($) { | ||
if (!_cellMenuProperties.hideCloseButton) { | ||
$(closeButtonHtml).on("click", destroyMenu).appendTo(menu); | ||
$(closeButtonHtml).on("click", handleCloseButtonClicked).appendTo(menu); | ||
} | ||
@@ -245,3 +245,3 @@ $optionMenu.appendTo(menu); | ||
if (!_cellMenuProperties.hideCloseButton && (optionItems.length === 0 || _cellMenuProperties.hideOptionSection)) { | ||
$(closeButtonHtml).on("click", destroyMenu).appendTo(menu); | ||
$(closeButtonHtml).on("click", handleCloseButtonClicked).appendTo(menu); | ||
} | ||
@@ -290,2 +290,8 @@ $commandMenu.appendTo(menu); | ||
function handleCloseButtonClicked(e) { | ||
if(!e.isDefaultPrevented()) { | ||
destroyMenu(e); | ||
} | ||
} | ||
function destroyMenu(e, args) { | ||
@@ -405,3 +411,5 @@ $menu = $menu || $(".slick-cell-menu." + _gridUid); | ||
if ($menu && $menu[0] != e.target && !$.contains($menu[0], e.target)) { | ||
closeMenu(e, { cell: _currentCell, row: _currentRow }); | ||
if(!e.isDefaultPrevented()) { | ||
closeMenu(e, { cell: _currentCell, row: _currentRow }); | ||
} | ||
} | ||
@@ -602,4 +610,2 @@ } | ||
if (command !== null && command !== "") { | ||
closeMenu(e, { cell: cell, row: row }); | ||
// user could execute a callback through 2 ways | ||
@@ -622,2 +628,6 @@ // via the onCommand event and/or an action callback | ||
} | ||
if(!e.isDefaultPrevented()) { | ||
closeMenu(e, { cell: cell, row: row }); | ||
} | ||
} | ||
@@ -644,4 +654,2 @@ } | ||
if (option !== undefined) { | ||
closeMenu(e, { cell: cell, row: row }); | ||
// user could execute a callback through 2 ways | ||
@@ -664,2 +672,6 @@ // via the onOptionSelected event and/or an action callback | ||
} | ||
if(!e.isDefaultPrevented()) { | ||
closeMenu(e, { cell: cell, row: row }); | ||
} | ||
} | ||
@@ -666,0 +678,0 @@ } |
@@ -79,3 +79,3 @@ (function ($) { | ||
if (_gridOptions.frozenRow > -1 && _isBottomCanvas) { | ||
_rowOffset = (_gridOptions.frozenBottom) ? $('.grid-canvas-bottom').height() : $('.grid-canvas-top').height(); | ||
_rowOffset = (_gridOptions.frozenBottom) ? $('.'+_grid.getUID()+' .grid-canvas-bottom').height() : $('.'+_grid.getUID()+' .grid-canvas-top').height(); | ||
} | ||
@@ -86,3 +86,3 @@ | ||
if (_gridOptions.frozenColumn > -1 && _isRightCanvas) { | ||
_columnOffset = $('.grid-canvas-left').width(); | ||
_columnOffset = $('.'+_grid.getUID()+' .grid-canvas-left').width(); | ||
} | ||
@@ -191,2 +191,2 @@ | ||
} | ||
})(jQuery); | ||
})(jQuery); |
@@ -248,3 +248,3 @@ (function ($) { | ||
if (!_contextMenuProperties.hideCloseButton) { | ||
$(closeButtonHtml).on("click", destroyMenu).appendTo(menu); | ||
$(closeButtonHtml).on("click", handleCloseButtonClicked).appendTo(menu); | ||
} | ||
@@ -264,3 +264,3 @@ $optionMenu.appendTo(menu); | ||
if (!_contextMenuProperties.hideCloseButton && (!isColumnOptionAllowed || optionItems.length === 0 || _contextMenuProperties.hideOptionSection)) { | ||
$(closeButtonHtml).on("click", destroyMenu).appendTo(menu); | ||
$(closeButtonHtml).on("click", handleCloseButtonClicked).appendTo(menu); | ||
} | ||
@@ -290,2 +290,8 @@ $commandMenu.appendTo(menu); | ||
function handleCloseButtonClicked(e) { | ||
if(!e.isDefaultPrevented()) { | ||
destroyMenu(e); | ||
} | ||
} | ||
function destroyMenu(e, args) { | ||
@@ -378,3 +384,5 @@ $menu = $menu || $(".slick-context-menu." + _gridUid); | ||
$("body").one("click", function (e) { | ||
destroyMenu(e, { cell: _currentCell, row: _currentRow }); | ||
if(!e.isDefaultPrevented()) { | ||
destroyMenu(e, { cell: _currentCell, row: _currentRow }); | ||
} | ||
}); | ||
@@ -381,0 +389,0 @@ } |
@@ -128,2 +128,16 @@ /** | ||
var reorderedIds = $headers.sortable("toArray"); | ||
// If frozen columns are used, headers has more than one entry and we need the ids from all of them. | ||
// though there is only really a left and right header, this will work even if that should change. | ||
if($headers.length > 1) { | ||
for(var headerI=1,l=$headers.length; headerI < l; headerI+=1) { | ||
var $header = $($headers[headerI]); | ||
var ids = $header.sortable("toArray"); | ||
// Note: the loop below could be simplified with: | ||
// reorderedIds.push.apply(reorderedIds,ids); | ||
// However, the loop is more in keeping with way-backward compatibility | ||
for(var idI=0,idL=ids.length; idI< idL; idI+=1) { | ||
reorderedIds.push(ids[idI]); | ||
} | ||
} | ||
} | ||
var reorderedColumns = []; | ||
@@ -233,3 +247,4 @@ for (var i = 0; i < reorderedIds.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 columnName = column.children('.slick-column-name').first(); | ||
var groupText = $("<div style='display: inline-flex'>" + (columnName.length ? columnName.text() : column.text()) + "</div>"); | ||
groupText.appendTo(entry); | ||
@@ -236,0 +251,0 @@ var groupRemoveIcon = $("<div class='slick-groupby-remove'> </div>"); |
@@ -339,4 +339,2 @@ (function ($) { | ||
hideMenu(); | ||
if (command != null && command !== '') { | ||
@@ -357,2 +355,6 @@ var callbackArgs = { | ||
if(!e.isDefaultPrevented()) { | ||
hideMenu(); | ||
} | ||
// Stop propagation so that it doesn't register as a header click event. | ||
@@ -359,0 +361,0 @@ e.preventDefault(); |
@@ -82,6 +82,6 @@ (function ($) { | ||
/*** | ||
* Begins a bached update of the items in the data view. | ||
* @param bulkUpdate {Boolean} if set to true, most data view modifications | ||
* Begins a bached update of the items in the data view. | ||
* @param bulkUpdate {Boolean} if set to true, most data view modifications | ||
* including deletes and the related events are postponed to the endUpdate call. | ||
* As certain operations are postponed during this update, some methods might not | ||
* As certain operations are postponed during this update, some methods might not | ||
* deliver fully consistent information. | ||
@@ -137,9 +137,9 @@ */ | ||
function processBulkDelete() { | ||
// the bulk update is processed by | ||
// the bulk update is processed by | ||
// recomputing the whole items array and the index lookup in one go. | ||
// this is done by placing the not-deleted items | ||
// from left to right into the array and shrink the array the the new | ||
// this is done by placing the not-deleted items | ||
// from left to right into the array and shrink the array the the new | ||
// size afterwards. | ||
// see https://github.com/6pac/SlickGrid/issues/571 for further details. | ||
// see https://github.com/6pac/SlickGrid/issues/571 for further details. | ||
var id, item, newIdx = 0; | ||
@@ -150,7 +150,7 @@ for (var i = 0, l = items.length; i < l; i++) { | ||
if (id === undefined) { | ||
throw new Error("Each data element must implement a unique 'id' property"); | ||
throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property"); | ||
} | ||
// if items have been marked as deleted we skip them for the new final items array | ||
// and we remove them from the lookup table. | ||
// and we remove them from the lookup table. | ||
if(bulkDeleteIds.has(id)) { | ||
@@ -166,5 +166,5 @@ idxById.delete(id); | ||
} | ||
// here we shrink down the full item array to the ones actually | ||
// inserted in the cleanup loop above. | ||
// here we shrink down the full item array to the ones actually | ||
// inserted in the cleanup loop above. | ||
items.length = newIdx; | ||
@@ -184,3 +184,3 @@ // and finally cleanup the deleted ids to start cleanly on the next update. | ||
if (id === undefined) { | ||
throw new Error("Each data element must implement a unique 'id' property"); | ||
throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property"); | ||
} | ||
@@ -196,3 +196,3 @@ idxById.set(id, i); | ||
if (id === undefined || idxById.get(id) !== i) { | ||
throw new Error("Each data element must implement a unique 'id' property"); | ||
throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property"); | ||
} | ||
@@ -366,3 +366,3 @@ } | ||
if (!groupingInfos.length) { | ||
throw new Error("At least one grouping must be specified before calling setAggregators()."); | ||
throw new Error("[SlickGrid DataView] At least one grouping must be specified before calling setAggregators()."); | ||
} | ||
@@ -442,6 +442,6 @@ | ||
/*** | ||
* Performs the update operations of a single item by id without | ||
* Performs the update operations of a single item by id without | ||
* triggering any events or refresh operations. | ||
* @param id The new id of the item. | ||
* @param item The item which should be the new value for the given id. | ||
* @param id The new id of the item. | ||
* @param item The item which should be the new value for the given id. | ||
*/ | ||
@@ -451,3 +451,3 @@ function updateSingleItem(id, item) { | ||
if (!idxById.has(id)) { | ||
throw new Error("Invalid id"); | ||
throw new Error("[SlickGrid DataView] Invalid id"); | ||
} | ||
@@ -461,6 +461,6 @@ | ||
if (newId == null) { | ||
throw new Error("Cannot update item to associate with a null id"); | ||
throw new Error("[SlickGrid DataView] Cannot update item to associate with a null id"); | ||
} | ||
if (idxById.has(newId)) { | ||
throw new Error("Cannot update item to associate with a non-unique id"); | ||
throw new Error("[SlickGrid DataView] Cannot update item to associate with a non-unique id"); | ||
} | ||
@@ -488,8 +488,8 @@ idxById.set(newId, idxById.get(id)); | ||
} | ||
/*** | ||
* Updates a single item in the data view given the id and new value. | ||
* @param id The new id of the item. | ||
* @param item The item which should be the new value for the given id. | ||
*/ | ||
* Updates a single item in the data view given the id and new value. | ||
* @param id The new id of the item. | ||
* @param item The item which should be the new value for the given id. | ||
*/ | ||
function updateItem(id, item) { | ||
@@ -499,12 +499,12 @@ updateSingleItem(id, item); | ||
} | ||
/*** | ||
* Updates multiple items in the data view given the new ids and new values. | ||
* Updates multiple items in the data view given the new ids and new values. | ||
* @param id {Array} The array of new ids which is in the same order as the items. | ||
* @param newItems {Array} The new items that should be set in the data view for the given ids. | ||
*/ | ||
* @param newItems {Array} The new items that should be set in the data view for the given ids. | ||
*/ | ||
function updateItems(ids, newItems) { | ||
if(ids.length !== newItems.length) { | ||
throw new Error("Mismatch on the length of ids and items provided to update"); | ||
} | ||
throw new Error("[SlickGrid DataView] Mismatch on the length of ids and items provided to update"); | ||
} | ||
for (var i = 0, l = newItems.length; i < l; i++) { | ||
@@ -515,8 +515,8 @@ updateSingleItem(ids[i], newItems[i]); | ||
} | ||
/*** | ||
* Inserts a single item into the data view at the given position. | ||
* @param insertBefore {Number} The 0-based index before which the item should be inserted. | ||
* Inserts a single item into the data view at the given position. | ||
* @param insertBefore {Number} The 0-based index before which the item should be inserted. | ||
* @param item The item to insert. | ||
*/ | ||
*/ | ||
function insertItem(insertBefore, item) { | ||
@@ -529,4 +529,4 @@ items.splice(insertBefore, 0, item); | ||
/*** | ||
* Inserts multiple items into the data view at the given position. | ||
* @param insertBefore {Number} The 0-based index before which the items should be inserted. | ||
* Inserts multiple items into the data view at the given position. | ||
* @param insertBefore {Number} The 0-based index before which the items should be inserted. | ||
* @param newItems {Array} The items to insert. | ||
@@ -541,3 +541,3 @@ */ | ||
/*** | ||
* Adds a single item at the end of the data view. | ||
* Adds a single item at the end of the data view. | ||
* @param item The item to add at the end. | ||
@@ -552,3 +552,3 @@ */ | ||
/*** | ||
* Adds multiple items at the end of the data view. | ||
* Adds multiple items at the end of the data view. | ||
* @param newItems {Array} The items to add at the end. | ||
@@ -563,4 +563,4 @@ */ | ||
/*** | ||
* Deletes a single item identified by the given id from the data view. | ||
* @param id The id identifying the object to delete. | ||
* Deletes a single item identified by the given id from the data view. | ||
* @param id The id identifying the object to delete. | ||
*/ | ||
@@ -573,3 +573,3 @@ function deleteItem(id) { | ||
if (idx === undefined) { | ||
throw new Error("Invalid id"); | ||
throw new Error("[SlickGrid DataView] Invalid id"); | ||
} | ||
@@ -584,3 +584,3 @@ idxById.delete(id); | ||
/*** | ||
* Deletes multiple item identified by the given ids from the data view. | ||
* Deletes multiple item identified by the given ids from the data view. | ||
* @param ids {Array} The ids of the items to delete. | ||
@@ -592,3 +592,3 @@ */ | ||
} | ||
if (isBulkSuspend) { | ||
@@ -599,7 +599,7 @@ for (var i = 0, l = ids.length; i < l; i++) { | ||
if (idx === undefined) { | ||
throw new Error("Invalid id"); | ||
throw new Error("[SlickGrid DataView] Invalid id"); | ||
} | ||
bulkDeleteIds.set(id, true); | ||
} | ||
} else { | ||
} else { | ||
// collect all indexes | ||
@@ -611,3 +611,3 @@ var indexesToDelete = []; | ||
if (idx === undefined) { | ||
throw new Error("Invalid id"); | ||
throw new Error("[SlickGrid DataView] Invalid id"); | ||
} | ||
@@ -617,3 +617,3 @@ idxById.delete(id); | ||
} | ||
// Remove from back to front | ||
@@ -624,3 +624,3 @@ indexesToDelete.sort(); | ||
} | ||
// update lookup from front to back | ||
@@ -634,3 +634,3 @@ updateIdxById(indexesToDelete[0]); | ||
if (!sortComparer) { | ||
throw new Error("sortedAddItem() requires a sort comparer, use sort()"); | ||
throw new Error("[SlickGrid DataView] sortedAddItem() requires a sort comparer, use sort()"); | ||
} | ||
@@ -642,6 +642,6 @@ insertItem(sortedIndex(item), item); | ||
if (!idxById.has(id) || id !== item[idProperty]) { | ||
throw new Error("Invalid or non-matching id " + idxById.get(id)); | ||
throw new Error("[SlickGrid DataView] Invalid or non-matching id " + idxById.get(id)); | ||
} | ||
if (!sortComparer) { | ||
throw new Error("sortedUpdateItem() requires a sort comparer, use sort()"); | ||
throw new Error("[SlickGrid DataView] sortedUpdateItem() requires a sort comparer, use sort()"); | ||
} | ||
@@ -648,0 +648,0 @@ var oldItem = getItemById(id); |
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
4567851
101226