slickgrid
Advanced tools
Comparing version 2.3.14 to 2.3.15
{ | ||
"name": "slickgrid", | ||
"version": "2.3.14", | ||
"version": "2.3.15", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -5,0 +5,0 @@ "main": "slick.core.js", |
@@ -48,8 +48,11 @@ (function ($) { | ||
* Available menu item options: | ||
* title: Menu item text. | ||
* disabled: Whether the item is disabled. | ||
* tooltip: Item tooltip. | ||
* command: A command identifier to be passed to the onCommand event handlers. | ||
* iconCssClass: A CSS class to be added to the menu item icon. | ||
* iconImage: A url to the icon image. | ||
* title: Menu item text. | ||
* disabled: Whether the item is disabled. | ||
* tooltip: Item tooltip. | ||
* command: A command identifier to be passed to the onCommand event handlers. | ||
* iconCssClass: A CSS class to be added to the menu item icon. | ||
* iconImage: A url to the icon image. | ||
* minWidth: Minimum width that the drop menu will have | ||
* autoAlign: Auto-align drop menu to the left when not enough viewport space to show on the right | ||
* autoAlignOffset: When drop menu is aligned to the left, it might not be perfectly aligned with the header menu icon, if that is the case you can add an offset (positive/negative number to move right/left) | ||
* | ||
@@ -87,3 +90,6 @@ * | ||
buttonCssClass: null, | ||
buttonImage: null | ||
buttonImage: null, | ||
minWidth: 100, | ||
autoAlign: true, | ||
autoAlignOffset: 0 | ||
}; | ||
@@ -108,3 +114,7 @@ var $menu; | ||
function setOptions(newOptions) { | ||
options = $.extend(true, {}, options, newOptions); | ||
} | ||
function destroy() { | ||
@@ -187,3 +197,3 @@ _handler.unsubscribeAll(); | ||
if (!$menu) { | ||
$menu = $("<div class='slick-header-menu'></div>") | ||
$menu = $("<div class='slick-header-menu' style='min-width: " + options.minWidth + "px'></div>") | ||
.appendTo(_grid.getContainerNode()); | ||
@@ -229,6 +239,16 @@ } | ||
var leftPos = $(this).offset().left; | ||
// Position the menu. | ||
// when auto-align is set, it will calculate whether it has enough space in the viewport to show the drop menu on the right (default) | ||
// if there isn't enough space on the right, it will automatically align the drop menu to the left | ||
// to simulate an align left, we actually need to know the width of the drop menu | ||
if (options.autoAlign) { | ||
var gridPos = _grid.getGridPosition(); | ||
if ((leftPos + options.minWidth) >= gridPos.width) { | ||
leftPos = leftPos - options.minWidth + options.autoAlignOffset; | ||
} | ||
} | ||
$menu | ||
.offset({ top: $(this).offset().top + $(this).height(), left: $(this).offset().left }); | ||
.offset({ top: $(this).offset().top + $(this).height(), left: leftPos }); | ||
@@ -275,2 +295,3 @@ | ||
"destroy": destroy, | ||
"setOptions": setOptions, | ||
@@ -277,0 +298,0 @@ "onBeforeMenuShow": new Slick.Event(), |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
87609
1
3749115
195