11/*!
2- * ui-grid - v4.10.3 - 2021-08-01
2+ * ui-grid - v4.11.0 - 2021-08-12
33 * Copyright (c) 2021 ; License: MIT
44 */
55
@@ -423,6 +423,9 @@ function ( i18nService, uiGridConstants, gridUtil ) {
423423 $scope . $on ( '$destroy' , deregFunction ) ;
424424 } ,
425425
426+ getGridOption : function ( $scope , option ) {
427+ return typeof ( $scope . grid ) !== 'undefined' && $scope . grid && $scope . grid . options && $scope . grid . options [ option ] ;
428+ } ,
426429
427430 /**
428431 * @ngdoc boolean
@@ -440,7 +443,7 @@ function ( i18nService, uiGridConstants, gridUtil ) {
440443 *
441444 */
442445 sortable : function ( $scope ) {
443- return Boolean ( $scope . grid . options . enableSorting && typeof ( $scope . col ) !== 'undefined' && $scope . col && $scope . col . enableSorting ) ;
446+ return Boolean ( this . getGridOption ( $scope , ' enableSorting' ) && typeof ( $scope . col ) !== 'undefined' && $scope . col && $scope . col . enableSorting ) ;
444447 } ,
445448
446449 /**
@@ -487,7 +490,12 @@ function ( i18nService, uiGridConstants, gridUtil ) {
487490 *
488491 */
489492 hideable : function ( $scope ) {
490- return ! ( typeof ( $scope . col ) !== 'undefined' && $scope . col && $scope . col . colDef && $scope . col . colDef . enableHiding === false ) ;
493+ return Boolean (
494+ ( this . getGridOption ( $scope , 'enableHiding' ) &&
495+ typeof ( $scope . col ) !== 'undefined' && $scope . col &&
496+ ( $scope . col . colDef && $scope . col . colDef . enableHiding !== false || ! $scope . col . colDef ) ) ||
497+ ( ! this . getGridOption ( $scope , 'enableHiding' ) && $scope . col && $scope . col . colDef && $scope . col . colDef . enableHiding )
498+ ) ;
491499 } ,
492500
493501
@@ -1938,17 +1946,10 @@ angular.module('ui.grid')
19381946 return isColumnVisible ( colDef ) ? 'ui-grid-icon-ok' : 'ui-grid-icon-cancel' ;
19391947 }
19401948
1941- // add header for columns
1942- showHideColumns . push ( {
1943- title : i18nService . getSafeText ( 'gridMenu.columns' ) ,
1944- order : 300 ,
1945- templateUrl : 'ui-grid/ui-grid-menu-header-item'
1946- } ) ;
1947-
19481949 $scope . grid . options . gridMenuTitleFilter = $scope . grid . options . gridMenuTitleFilter ? $scope . grid . options . gridMenuTitleFilter : function ( title ) { return title ; } ;
19491950
19501951 $scope . grid . options . columnDefs . forEach ( function ( colDef , index ) {
1951- if ( colDef . enableHiding !== false ) {
1952+ if ( $scope . grid . options . enableHiding !== false && colDef . enableHiding !== false || colDef . enableHiding ) {
19521953 // add hide menu item - shows an OK icon as we only show when column is already visible
19531954 var menuItem = {
19541955 icon : getColumnIcon ( colDef ) ,
@@ -1977,6 +1978,16 @@ angular.module('ui.grid')
19771978 showHideColumns . push ( menuItem ) ;
19781979 }
19791980 } ) ;
1981+
1982+ // add header for columns
1983+ if ( showHideColumns . length ) {
1984+ showHideColumns . unshift ( {
1985+ title : i18nService . getSafeText ( 'gridMenu.columns' ) ,
1986+ order : 300 ,
1987+ templateUrl : 'ui-grid/ui-grid-menu-header-item'
1988+ } ) ;
1989+ }
1990+
19801991 return showHideColumns ;
19811992 } ,
19821993
@@ -5523,7 +5534,7 @@ angular.module('ui.grid')
55235534
55245535 // gridUtil.logDebug('viewPortHeight', viewPortHeight);
55255536
5526- return viewPortHeight ;
5537+ return viewPortHeight > 0 ? viewPortHeight : 0 ;
55275538 } ;
55285539
55295540 Grid . prototype . getViewportWidth = function getViewportWidth ( ) {
@@ -5795,7 +5806,7 @@ angular.module('ui.grid')
57955806 direction = directionOrAdd ;
57965807 }
57975808
5798- if ( ! add ) {
5809+ if ( ! add || ( self . options && self . options . suppressMultiSort ) ) {
57995810 self . resetColumnSorting ( column ) ;
58005811 column . sort . priority = undefined ;
58015812 // Get the actual priority since there may be columns which have suppressRemoveSort set
@@ -8189,6 +8200,17 @@ angular.module('ui.grid')
81898200 */
81908201 baseOptions . scrollDebounce = typeof ( baseOptions . scrollDebounce ) !== "undefined" ? baseOptions . scrollDebounce : 300 ;
81918202
8203+ /**
8204+ * @ngdoc boolean
8205+ * @name enableHiding
8206+ * @propertyOf ui.grid.class:GridOptions
8207+ * @description True by default. When enabled, this setting adds ability to hide
8208+ * the column headers, allowing hiding of the column from the grid.
8209+ * Column hiding can then be disabled / enabled on individual columns using the columnDefs,
8210+ * if it set, it will override GridOptions enableHiding setting.
8211+ */
8212+ baseOptions . enableHiding = baseOptions . enableHiding !== false ;
8213+
81928214 /**
81938215 * @ngdoc boolean
81948216 * @name enableSorting
@@ -8200,6 +8222,16 @@ angular.module('ui.grid')
82008222 */
82018223 baseOptions . enableSorting = baseOptions . enableSorting !== false ;
82028224
8225+ /**
8226+ * @ngdoc boolean
8227+ * @name suppressMultiSort
8228+ * @propertyOf ui.grid.class:GridOptions
8229+ * @description False by default. When enabled, this setting disables the ability
8230+ * to sort multiple columns by using the shift key or interacting with the column
8231+ * menu. Instead, each column sort will remove all other sorting.
8232+ */
8233+ baseOptions . suppressMultiSort = baseOptions . suppressMultiSort === true ;
8234+
82038235 /**
82048236 * @ngdoc boolean
82058237 * @name enableFiltering
@@ -8623,7 +8655,7 @@ angular.module('ui.grid')
86238655
86248656 viewPortHeight = viewPortHeight + adjustment . height ;
86258657
8626- return viewPortHeight ;
8658+ return viewPortHeight > 0 ? viewPortHeight : 0 ;
86278659 } ;
86288660
86298661 GridRenderContainer . prototype . getViewportWidth = function getViewportWidth ( ) {
0 commit comments