Skip to content

Commit 70e2959

Browse files
Portugal, MarceloPortugal, Marcelo
Portugal, Marcelo
authored and
Portugal, Marcelo
committed
v4.0.2
1 parent daa90ae commit 70e2959

8 files changed

+1096
-43
lines changed

CHANGELOG.md

+1,008
Large diffs are not rendered by default.

bower.json

+2-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,8 @@
22
"name": "angular-ui-grid",
33
"description": "A data grid for Angular",
44
"main": [
5-
"4.0.1",
6-
"less",
7-
"ui-grid.css",
8-
"ui-grid.eot",
9-
"ui-grid.js",
10-
"ui-grid.min.css",
11-
"ui-grid.min.js",
12-
"ui-grid.svg",
13-
"ui-grid.ttf",
14-
"ui-grid.woff"
5+
"./ui-grid.css",
6+
"./ui-grid.js"
157
],
168
"ignore": [],
179
"dependencies": {

index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require('./ui-grid');
2+
module.exports = 'ui.grid';

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-ui-grid",
33
"description": "A data grid for Angular",
4-
"main": "ui-grid.js",
4+
"main": "index.js",
55
"ignore": [],
66
"dependencies": {
77
"angular": ">=1.4.0 1.5.x"
@@ -27,9 +27,8 @@
2727
"data grid"
2828
],
2929
"license": "MIT",
30-
"version": "4.0.1",
30+
"version": "4.0.2",
3131
"files": [
32-
"4.0.1",
3332
"less",
3433
"ui-grid.css",
3534
"ui-grid.eot",

ui-grid.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* ui-grid - v4.0.1 - 2016-12-15
2+
* ui-grid - v4.0.2 - 2016-12-30
33
* Copyright (c) 2016 ; License: MIT
44
*/
55
#ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:before,

ui-grid.js

+70-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* ui-grid - v4.0.1 - 2016-12-15
2+
* ui-grid - v4.0.2 - 2016-12-30
33
* Copyright (c) 2016 ; License: MIT
44
*/
55

@@ -2120,8 +2120,15 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
21202120
templateUrl: 'ui-grid/uiGridMenu',
21212121
replace: false,
21222122
link: function ($scope, $elm, $attrs, uiGridCtrl) {
2123-
21242123
$scope.dynamicStyles = '';
2124+
if (uiGridCtrl && uiGridCtrl.grid && uiGridCtrl.grid.options && uiGridCtrl.grid.options.gridMenuTemplate) {
2125+
var gridMenuTemplate = uiGridCtrl.grid.options.gridMenuTemplate;
2126+
gridUtil.getTemplate(gridMenuTemplate).then(function (contents) {
2127+
var template = angular.element(contents);
2128+
var newElm = $compile(template)($scope);
2129+
$elm.replaceWith(newElm);
2130+
});
2131+
}
21252132

21262133
var setupHeightStyle = function(gridHeight) {
21272134
//menu appears under header row, so substract that height from it's total
@@ -2138,7 +2145,7 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
21382145
setupHeightStyle(uiGridCtrl.grid.gridHeight);
21392146
uiGridCtrl.grid.api.core.on.gridDimensionChanged($scope, function(oldGridHeight, oldGridWidth, newGridHeight, newGridWidth) {
21402147
setupHeightStyle(newGridHeight);
2141-
});
2148+
});
21422149
}
21432150

21442151
$scope.i18n = {
@@ -2273,13 +2280,11 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
22732280
angular.element($window).on('resize', applyHideMenu);
22742281
}
22752282

2276-
$scope.$on('$destroy', function () {
2277-
angular.element(document).off('click touchstart', applyHideMenu);
2278-
});
2279-
2280-
2281-
$scope.$on('$destroy', function() {
2283+
$scope.$on('$destroy', function unbindEvents() {
22822284
angular.element($window).off('resize', applyHideMenu);
2285+
angular.element(document).off('click touchstart', applyHideMenu);
2286+
$elm.off('keyup', checkKeyUp);
2287+
$elm.off('keydown', checkKeyDown);
22832288
});
22842289

22852290
if (uiGridCtrl) {
@@ -3214,7 +3219,9 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
32143219
}
32153220
}
32163221

3217-
3222+
$scope.$on('$destroy', function unbindEvents() {
3223+
$elm.off();
3224+
});
32183225
},
32193226
controller: ['$scope', function ($scope) {
32203227
this.rowStyle = function (index) {
@@ -4784,7 +4791,7 @@ angular.module('ui.grid')
47844791
* @methodOf ui.grid.class:Grid
47854792
* @description returns the GridRow that contains the rowEntity
47864793
* @param {object} rowEntity the gridOptions.data array element instance
4787-
* @param {array} rows [optional] the rows to look in - if not provided then
4794+
* @param {array} lookInRows [optional] the rows to look in - if not provided then
47884795
* looks in grid.rows
47894796
*/
47904797
Grid.prototype.getRow = function getRow(rowEntity, lookInRows) {
@@ -4849,13 +4856,20 @@ angular.module('ui.grid')
48494856
self.rows.length = 0;
48504857

48514858
newRawData.forEach( function( newEntity, i ) {
4852-
var newRow;
4859+
var newRow, oldRow;
4860+
48534861
if ( self.options.enableRowHashing ){
48544862
// if hashing is enabled, then this row will be in the hash if we already know about it
4855-
newRow = oldRowHash.get( newEntity );
4863+
oldRow = oldRowHash.get( newEntity );
48564864
} else {
48574865
// otherwise, manually search the oldRows to see if we can find this row
4858-
newRow = self.getRow(newEntity, oldRows);
4866+
oldRow = self.getRow(newEntity, oldRows);
4867+
}
4868+
4869+
// update newRow to have an entity
4870+
if ( oldRow ) {
4871+
newRow = oldRow;
4872+
newRow.entity = newEntity;
48594873
}
48604874

48614875
// if we didn't find the row, it must be new, so create it
@@ -8143,6 +8157,15 @@ angular.module('ui.grid')
81438157
*/
81448158
baseOptions.rowTemplate = baseOptions.rowTemplate || 'ui-grid/ui-grid-row';
81458159

8160+
/**
8161+
* @ngdoc string
8162+
* @name gridMenuTemplate
8163+
* @propertyOf ui.grid.class:GridOptions
8164+
* @description 'ui-grid/uiGridMenu' by default. When provided, this setting uses a
8165+
* custom grid menu template.
8166+
*/
8167+
baseOptions.gridMenuTemplate = baseOptions.gridMenuTemplate || 'ui-grid/uiGridMenu';
8168+
81468169
/**
81478170
* @ngdoc object
81488171
* @name appScopeProvider
@@ -11786,6 +11809,11 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
1178611809
for ( var i = mouseWheeltoBind.length; i; ) {
1178711810
$elm.on(mouseWheeltoBind[--i], cbs[fn]);
1178811811
}
11812+
$elm.on('$destroy', function unbindEvents() {
11813+
for ( var i = mouseWheeltoBind.length; i; ) {
11814+
$elm.off(mouseWheeltoBind[--i], cbs[fn]);
11815+
}
11816+
});
1178911817
};
1179011818
s.off.mousewheel = function (elm, fn) {
1179111819
var $elm = angular.element(elm);
@@ -16436,7 +16464,11 @@ module.filter('px', function() {
1643616464
});
1643716465

1643816466

16439-
$scope.$on( '$destroy', rowWatchDereg );
16467+
$scope.$on('$destroy', function destroyEvents() {
16468+
rowWatchDereg();
16469+
// unbind all jquery events in order to avoid memory leaks
16470+
$elm.off();
16471+
});
1644016472

1644116473
function registerBeginEditEvents() {
1644216474
$elm.on('dblclick', beginEdit);
@@ -16971,6 +17003,11 @@ module.filter('px', function() {
1697117003

1697217004
return true;
1697317005
});
17006+
17007+
$scope.$on('$destroy', function unbindEvents() {
17008+
// unbind all jquery events in order to avoid memory leaks
17009+
$elm.off();
17010+
});
1697417011
}
1697517012
};
1697617013
}
@@ -17114,6 +17151,11 @@ module.filter('px', function() {
1711417151
}
1711517152
return true;
1711617153
});
17154+
17155+
$scope.$on('$destroy', function unbindEvents() {
17156+
// unbind jquery events to prevent memory leaks
17157+
$elm.off();
17158+
});
1711717159
}
1711817160
};
1711917161
}
@@ -17206,7 +17248,7 @@ module.filter('px', function() {
1720617248
}
1720717249
};
1720817250

17209-
$elm[0].addEventListener('change', handleFileSelect, false); // TODO: why the false on the end? Google
17251+
$elm[0].addEventListener('change', handleFileSelect, false);
1721017252

1721117253
$scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function () {
1721217254
$elm[0].focus();
@@ -17216,13 +17258,17 @@ module.filter('px', function() {
1721617258
$scope.$emit(uiGridEditConstants.events.END_CELL_EDIT);
1721717259
});
1721817260
});
17261+
17262+
$scope.$on('$destroy', function unbindEvents() {
17263+
// unbind jquery events to prevent memory leaks
17264+
$elm.off();
17265+
$elm[0].removeEventListener('change', handleFileSelect, false);
17266+
});
1721917267
}
1722017268
};
1722117269
}
1722217270
};
1722317271
}]);
17224-
17225-
1722617272
})();
1722717273

1722817274
(function () {
@@ -22385,6 +22431,8 @@ module.filter('px', function() {
2238522431
movingElm.css({'width': reducedWidth + 'px'});
2238622432
}
2238722433
};
22434+
22435+
$scope.$on('$destroy', offAllEvents);
2238822436
}
2238922437
}
2239022438
};
@@ -25966,6 +26014,10 @@ module.filter('px', function() {
2596626014
window.setTimeout(function () { evt.target.onselectstart = null; }, 0);
2596726015
}
2596826016
}
26017+
26018+
$scope.$on('$destroy', function unbindEvents() {
26019+
$elm.off();
26020+
});
2596926021
}
2597026022
};
2597126023
}]);

ui-grid.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui-grid.min.js

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)