Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ui-grid/core

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ui-grid/core - npm Package Compare versions

Comparing version 4.10.3 to 4.11.0

index.js

17

CHANGELOG.md

@@ -6,2 +6,19 @@ # Change Log

# [4.11.0](https://github.com/angular-ui/ui-grid/compare/v4.10.3...v4.11.0) (2021-08-12)
### Bug Fixes
* 🐛 ensure viewport height cannot be negative ([a7111a1](https://github.com/angular-ui/ui-grid/commit/a7111a13b4c7d67068522881783925dedbacda88)), closes [#3034](https://github.com/angular-ui/ui-grid/issues/3034)
### Features
* 🎸 option to disable multi-column sorting ([c9abb8b](https://github.com/angular-ui/ui-grid/commit/c9abb8bab2101479b0498848b4a288c1ad7d17f9)), closes [#2913](https://github.com/angular-ui/ui-grid/issues/2913)
* 🎸 the ability to disable hide columns on a grid level ([2dd1688](https://github.com/angular-ui/ui-grid/commit/2dd168859e03583cdc7e6ab671d146e343ae4275)), closes [#1604](https://github.com/angular-ui/ui-grid/issues/1604)
## [4.10.3](https://github.com/angular-ui/ui-grid/compare/v4.10.2...v4.10.3) (2021-08-01)

@@ -8,0 +25,0 @@

4

package.json
{
"name": "@ui-grid/core",
"version": "4.10.3",
"version": "4.11.0",
"description": "A data grid for Angular",

@@ -35,3 +35,3 @@ "main": "index.js",

"license": "MIT",
"gitHead": "5cfa8bf46e8eb464b40e3d045064d4b74a77cbf2"
"gitHead": "4aa2cc59a6bc683552a1e328f639a0aa0a0c7527"
}

@@ -67,2 +67,5 @@ (function() {

getGridOption: function( $scope, option ) {
return typeof($scope.grid) !== 'undefined' && $scope.grid && $scope.grid.options && $scope.grid.options[option];
},

@@ -85,3 +88,3 @@ /**

sortable: function( $scope ) {
return Boolean( $scope.grid.options.enableSorting && typeof($scope.col) !== 'undefined' && $scope.col && $scope.col.enableSorting);
return Boolean( this.getGridOption($scope, 'enableSorting') && typeof($scope.col) !== 'undefined' && $scope.col && $scope.col.enableSorting);
},

@@ -133,3 +136,8 @@

hideable: function( $scope ) {
return !(typeof($scope.col) !== 'undefined' && $scope.col && $scope.col.colDef && $scope.col.colDef.enableHiding === false );
return Boolean(
(this.getGridOption($scope, 'enableHiding') &&
typeof($scope.col) !== 'undefined' && $scope.col &&
($scope.col.colDef && $scope.col.colDef.enableHiding !== false || !$scope.col.colDef)) ||
(!this.getGridOption($scope, 'enableHiding') && $scope.col && $scope.col.colDef && $scope.col.colDef.enableHiding)
);
},

@@ -136,0 +144,0 @@

@@ -261,13 +261,6 @@ (function() {

// add header for columns
showHideColumns.push({
title: i18nService.getSafeText('gridMenu.columns'),
order: 300,
templateUrl: 'ui-grid/ui-grid-menu-header-item'
});
$scope.grid.options.gridMenuTitleFilter = $scope.grid.options.gridMenuTitleFilter ? $scope.grid.options.gridMenuTitleFilter : function( title ) { return title; };
$scope.grid.options.columnDefs.forEach( function( colDef, index ) {
if ( colDef.enableHiding !== false ) {
if ( $scope.grid.options.enableHiding !== false && colDef.enableHiding !== false || colDef.enableHiding ) {
// add hide menu item - shows an OK icon as we only show when column is already visible

@@ -301,2 +294,12 @@ var menuItem = {

});
// add header for columns
if ( showHideColumns.length ) {
showHideColumns.unshift({
title: i18nService.getSafeText('gridMenu.columns'),
order: 300,
templateUrl: 'ui-grid/ui-grid-menu-header-item'
});
}
return showHideColumns;

@@ -303,0 +306,0 @@ },

@@ -371,2 +371,13 @@ (function() {

* @ngdoc boolean
* @name enableHiding
* @propertyOf ui.grid.class:GridOptions
* @description True by default. When enabled, this setting adds ability to hide
* the column headers, allowing hiding of the column from the grid.
* Column hiding can then be disabled / enabled on individual columns using the columnDefs,
* if it set, it will override GridOptions enableHiding setting.
*/
baseOptions.enableHiding = baseOptions.enableHiding !== false;
/**
* @ngdoc boolean
* @name enableSorting

@@ -383,2 +394,12 @@ * @propertyOf ui.grid.class:GridOptions

* @ngdoc boolean
* @name suppressMultiSort
* @propertyOf ui.grid.class:GridOptions
* @description False by default. When enabled, this setting disables the ability
* to sort multiple columns by using the shift key or interacting with the column
* menu. Instead, each column sort will remove all other sorting.
*/
baseOptions.suppressMultiSort = baseOptions.suppressMultiSort === true;
/**
* @ngdoc boolean
* @name enableFiltering

@@ -385,0 +406,0 @@ * @propertyOf ui.grid.class:GridOptions

@@ -232,3 +232,3 @@ (function() {

return viewPortHeight;
return viewPortHeight > 0 ? viewPortHeight : 0;
};

@@ -235,0 +235,0 @@

@@ -199,4 +199,12 @@ describe('ui-grid-column-menu uiGridColumnMenuService', function() {

describe('hideable: ', function() {
it('grid.options missing', function() {
$scope.col = {uid: 'ui-grid-01x', enableHiding: true};
$scope.grid = {options: {}};
expect(uiGridColumnMenuService.hideable($scope)).toEqual(false);
});
it('everything present: is not hideable', function() {
$scope.col = {uid: 'ui-grid-01x', colDef: {enableHiding: false}};
$scope.grid = {options: {enableHiding: true}};

@@ -206,4 +214,12 @@ expect(uiGridColumnMenuService.hideable($scope)).toEqual(false);

it('everything present: is hideable', function() {
$scope.col = {uid: 'ui-grid-01x', colDef: {enableHiding: true}};
$scope.grid = {options: {enableHiding: false}};
expect(uiGridColumnMenuService.hideable($scope)).toEqual(true);
});
it('colDef missing: is hideable', function() {
$scope.col = {uid: 'ui-grid-01x'};
$scope.grid = {options: {enableHiding: true}};

@@ -210,0 +226,0 @@ expect(uiGridColumnMenuService.hideable($scope)).toEqual(true);

@@ -258,3 +258,3 @@ describe('ui-grid-menu-button uiGridGridMenuService', function() {

expect(menuItems.length).toEqual(6, 'Should be 10 items, 1 columns header, 4 columns that allow hiding and Clean all filters');
expect(menuItems.length).toEqual(6, 'Should be 6 items, 1 columns header, 4 columns that allow hiding and Clean all filters');
expect(menuItems[0].title).toEqual('Clear all filters', 'Menu item 0 should be Clear all filters');

@@ -268,2 +268,19 @@ expect(menuItems[1].title).toEqual('Columns:', 'Menu item 0 should be header');

});
it('should not add any columns if enableHiding if false and not enable on any columns', function() {
grid.options.enableHiding = false;
menuItems = uiGridGridMenuService.getMenuItems($scope);
expect(menuItems.length).toEqual(1, 'Should be 1 items, the clear all filters button');
expect(menuItems[0].title).toEqual('Clear all filters', 'Menu item 0 should be Clear all filters');
});
it('should add any columns if enableHiding if false, but enabled on one columns', function() {
grid.options.enableHiding = false;
grid.options.columnDefs[1].enableHiding = true;
menuItems = uiGridGridMenuService.getMenuItems($scope);
expect(menuItems.length).toEqual(3, 'Should be 3 items, 1 columns header, 1 columns that allow hiding and Clean all filters');
expect(menuItems[1].title).toEqual('Columns:', 'Menu item 0 should be header');
expect(menuItems[1].templateUrl).toEqual('ui-grid/ui-grid-menu-header-item');
expect(menuItems[2].title).toEqual('Col2', 'Column heading');
});
});

@@ -270,0 +287,0 @@

@@ -991,2 +991,6 @@ describe('Grid factory', function() {

describe('sortColumn', function() {
beforeEach(function() {
grid.options.suppressMultiSort = false;
});
it('should throw an exception if no column parameter is provided', function() {

@@ -1064,2 +1068,13 @@ expect(function() {

it('if another column has a sort, and both add and suppressMultiSort are set to true, that sort should be removed', function() {
var priorColumn = new GridColumn({name: 'b', sort: {direction: uiGridConstants.ASC}}, 0, grid);
grid.columns.push(priorColumn);
grid.options.suppressMultiSort = true;
grid.sortColumn(column, true);
expect(column.sort.direction).toEqual(uiGridConstants.ASC);
expect(column.sort.priority).toEqual(0);
expect(priorColumn.sort).toEqual({});
});
it('if another column has a sort, and add is set to true, then that sort should not be removed', function() {

@@ -1088,2 +1103,14 @@ var priorColumn = new GridColumn({name: 'b', sort: {direction: uiGridConstants.ASC, priority: 1}}, 0, grid);

it('if another column has a sort, and both add and suppressMultiSort are set to true, but that other column has suppressRemoveSort, then it shouldn\'t be removed',
function() {
var priorColumn = new GridColumn({name: 'b', sort: {direction: uiGridConstants.ASC, priority: 1}, suppressRemoveSort: true}, 0, grid);
grid.columns.push(priorColumn);
grid.options.suppressMultiSort = true;
grid.sortColumn(column, true);
expect(column.sort.direction).toEqual(uiGridConstants.ASC);
expect(column.sort.priority).toEqual(2);
expect(priorColumn.sort).toEqual({direction: uiGridConstants.ASC, priority: 1});
});
it('if sortDirectionCycle is null-DESC-ASC, and sort is currently null, then should toggle to DESC, and reset priority', function() {

@@ -1090,0 +1117,0 @@ column.sort = {};

@@ -41,3 +41,5 @@ describe('GridOptions factory', function () {

scrollDebounce: 300,
enableHiding: true,
enableSorting: true,
suppressMultiSort: false,
enableFiltering: false,

@@ -90,3 +92,5 @@ filterContainer: 'headerCell',

wheelScrollThrottle: 75,
enableHiding: true,
enableSorting: true,
suppressMultiSort: true,
enableFiltering: true,

@@ -137,3 +141,5 @@ filterContainer: 'columnMenu',

scrollDebounce: 300,
enableHiding: true,
enableSorting: true,
suppressMultiSort: true,
enableFiltering: true,

@@ -189,3 +195,5 @@ filterContainer: 'columnMenu',

filterContainer: 'columnMenu',
enableHiding: false,
enableSorting: false,
suppressMultiSort: false,
enableColumnMenus: false,

@@ -233,3 +241,5 @@ enableVerticalScrollbar: 0,

scrollDebounce: 300,
enableHiding: false,
enableSorting: false,
suppressMultiSort: false,
enableFiltering: false,

@@ -236,0 +246,0 @@ filterContainer: 'columnMenu',

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

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