Skip to content

Commit

Permalink
Version 2.0.8 release
Browse files Browse the repository at this point in the history
  • Loading branch information
c0bra committed Apr 22, 2014
1 parent c1c9054 commit c2802d2
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 109 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<a name="2.0.6"></a>
<a name="2.0.8"></a>
## 2.0.8 *(2014-04-22)*

* Release 2.0.8 is the last release before 3.0.

### Changes

* Many community-provided fixes and features.

<a name="2.0.7"></a>
## 2.0.7 *(2013-07-01)*

### Features
Expand Down
93 changes: 58 additions & 35 deletions build/ng-grid.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 04/07/2014 16:55
* Compiled At: 04/22/2014 16:27
***********************************************/
(function(window, $) {
'use strict';
Expand Down Expand Up @@ -375,6 +375,7 @@ angular.module('ngGrid.services').factory('$domUtilityService',['$utilityService
angular.module('ngGrid.services').factory('$sortService', ['$parse', function($parse) {
var sortService = {};
sortService.colSortFnCache = {}; // cache of sorting functions. Once we create them, we don't want to keep re-doing it
sortService.isCustomSort = false; // track if we're using an internal sort or a user provided sort
// this takes an piece of data from the cell and tries to determine its type and what sorting
// function to use for it
// @item - the cell data
Expand Down Expand Up @@ -472,6 +473,7 @@ angular.module('ngGrid.services').factory('$sortService', ['$parse', function($p
data.sort(function (itemA, itemB) {
var tem = 0,
indx = 0,
res,
sortFn;
while (tem === 0 && indx < l) {
// grab the metadata for the rest of the logic
Expand All @@ -481,30 +483,33 @@ angular.module('ngGrid.services').factory('$sortService', ['$parse', function($p

var propA = $parse(order[indx])(itemA);
var propB = $parse(order[indx])(itemB);
// we want to allow zero values to be evaluated in the sort function
if ((!propA && propA !== 0) || (!propB && propB !== 0)) {
// we want to force nulls and such to the bottom when we sort... which effectively is "greater than"
if (!propB && !propA) {
tem = 0;
}
else if (!propA) {
tem = 1;
// if user provides custom sort, we want them to have full control of the sort
if (sortService.isCustomSort) {
res = sortFn(propA, propB);
tem = direction === ASC ? res : 0 - res;
} else {
// we want to allow zero values to be evaluated in the sort function
if ((!propA && propA !== 0) || (!propB && propB !== 0)) {
// we want to force nulls and such to the bottom when we sort... which effectively is "greater than"
if (!propB && !propA) {
tem = 0;
}
else if (!propA) {
tem = 1;
}
else if (!propB) {
tem = -1;
}
}
else if (!propB) {
tem = -1;
else {
// this will keep nulls at the bottom regardless of ordering
res = sortFn(propA, propB);
tem = direction === ASC ? res : 0 - res;
}
}
else {
tem = sortFn(propA, propB);
}
indx++;
}
//made it this far, we don't have to worry about null & undefined
if (direction === ASC) {
return tem;
} else {
return 0 - tem;
}
return tem;
});
};
sortService.Sort = function(sortInfo, data) {
Expand All @@ -524,6 +529,7 @@ angular.module('ngGrid.services').factory('$sortService', ['$parse', function($p
else if (col.sortingAlgorithm !== undefined) {
sortFn = col.sortingAlgorithm;
sortService.colSortFnCache[col.field] = col.sortingAlgorithm;
sortService.isCustomSort = true;
}
else { // try and guess what sort function to use
item = data[0];
Expand Down Expand Up @@ -574,7 +580,7 @@ angular.module('ngGrid.services').factory('$utilityService', ['$parse', function
}
},
evalProperty: function (entity, path) {
return $parse(path)(entity);
return $parse("entity." + path)({ entity: entity });
},
endsWith: function(str, suffix) {
if (!str || !suffix || typeof str !== "string") {
Expand Down Expand Up @@ -863,7 +869,7 @@ var ngColumn = function (config, $scope, grid, domUtilityService, $templateCache
return false;
};
self.copy = function() {
var ret = new ngColumn(config, $scope, grid, domUtilityService, $templateCache);
var ret = new ngColumn(config, $scope, grid, domUtilityService, $templateCache, $utils);
ret.isClone = true;
ret.orig = self;
return ret;
Expand Down Expand Up @@ -986,7 +992,7 @@ var ngEventProvider = function (grid, $scope, domUtilityService, $timeout) {
});
} else {
grid.$groupPanel.on('mousedown', self.onGroupMouseDown).on('dragover', self.dragOver).on('drop', self.onGroupDrop);
grid.$headerScroller.on('mousedown', self.onHeaderMouseDown).on('dragover', self.dragOver);
grid.$topPanel.on('mousedown', '.ngHeaderScroller', self.onHeaderMouseDown).on('dragover', '.ngHeaderScroller', self.dragOver);

grid.$groupPanel.on('$destroy', function() {
grid.$groupPanel.off('mousedown');
Expand All @@ -995,17 +1001,17 @@ var ngEventProvider = function (grid, $scope, domUtilityService, $timeout) {
});

if (grid.config.enableColumnReordering) {
grid.$headerScroller.on('drop', self.onHeaderDrop);
grid.$topPanel.on('drop', '.ngHeaderScroller', self.onHeaderDrop);
}

grid.$headerScroller.on('$destroy', function() {
grid.$headerScroller.off('mousedown');
grid.$topPanel.on('$destroy', function() {
grid.$topPanel.off('mousedown');

if (grid.config.enableColumnReordering) {
grid.$headerScroller.off('drop');
grid.$topPanel.off('drop');
}

grid.$headerScroller = null;
grid.$topPanel = null;
});
}

Expand Down Expand Up @@ -1915,7 +1921,7 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
} else {
self.config.sortInfo.directions[indx] = col.sortDirection;
}
} else if (!self.config.useExternalSorting || (self.config.useExternalSorting && evt && self.config.sortInfo )) {
} else if (!self.config.useExternalSorting || (self.config.useExternalSorting && self.config.sortInfo )) {
var isArr = $.isArray(col);
self.config.sortInfo.columns.length = 0;
self.config.sortInfo.fields.length = 0;
Expand Down Expand Up @@ -2562,6 +2568,16 @@ var ngSearchProvider = function ($scope, grid, $filter) {

self.fieldMap = {};

var convertToFieldMap = function(obj) {
var fieldMap = {};
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
fieldMap[prop.toLowerCase()] = obj[prop];
}
}
return fieldMap;
};

var searchEntireRow = function(condition, item, fieldMap){
var result;
for (var prop in item) {
Expand All @@ -2572,7 +2588,8 @@ var ngSearchProvider = function ($scope, grid, $filter) {
}
var pVal = item[prop];
if(typeof pVal === 'object' && !(pVal instanceof Date)) {
result = searchEntireRow(condition, pVal, c);
var objectFieldMap = convertToFieldMap(c);
result = searchEntireRow(condition, pVal, objectFieldMap);
if (result) {
return true;
}
Expand Down Expand Up @@ -2963,6 +2980,7 @@ ngGridDirectives.directive('ngCellHasFocus', ['$domUtilityService',
domUtilityService.digest($scope);

$scope.$broadcast('ngGridEventStartCellEdit');
$scope.$emit('ngGridEventStartCellEdit');

$scope.$on('$destroy', $scope.$on('ngGridEventEndCellEdit', function() {
$scope.isFocused = false;
Expand Down Expand Up @@ -3046,6 +3064,7 @@ ngGridDirectives.directive('ngCellHasFocus', ['$domUtilityService',
});
};
}]);

ngGridDirectives.directive('ngCellText',
function () {
return function(scope, elm) {
Expand Down Expand Up @@ -3719,7 +3738,7 @@ angular.module('ngGrid').run(['$templateCache', function($templateCache) {


$templateCache.put('cellEditTemplate.html',
"<div ng-cell-has-focus ng-dblclick=\"editCell()\">\r" +
"<div ng-cell-has-focus ng-dblclick=\"CELL_EDITABLE_CONDITION && editCell()\">\r" +
"\n" +
"\t<div ng-edit-cell-if=\"!(isFocused && CELL_EDITABLE_CONDITION)\">\t\r" +
"\n" +
Expand All @@ -3733,7 +3752,8 @@ angular.module('ngGrid').run(['$templateCache', function($templateCache) {
"\n" +
"\t</div>\r" +
"\n" +
"</div>"
"</div>\r" +
"\n"
);


Expand Down Expand Up @@ -3798,6 +3818,8 @@ angular.module('ngGrid').run(['$templateCache', function($templateCache) {
"\n" +
" <input class=\"ngPagerCurrent\" min=\"1\" max=\"{{currentMaxPages}}\" type=\"number\" style=\"width:50px; height: 24px; margin-top: 1px; padding: 0 4px;\" ng-model=\"pagingOptions.currentPage\"/>\r" +
"\n" +
" <span class=\"ngGridMaxPagesNumber\" ng-show=\"maxPages() > 0\">/ {{maxPages()}}</span>\r" +
"\n" +
" <button type=\"button\" class=\"ngPagerButton\" ng-click=\"pageForward()\" ng-disabled=\"cantPageForward()\" title=\"{{i18n.ngPagerNextTitle}}\"><div class=\"ngPagerLastTriangle ngPagerNextTriangle\"></div></button>\r" +
"\n" +
" <button type=\"button\" class=\"ngPagerButton\" ng-click=\"pageToLast()\" ng-disabled=\"cantPageToLast()\" title=\"{{i18n.ngPagerLastTitle}}\"><div class=\"ngPagerLastTriangle\"><div class=\"ngPagerLastBar\"></div></div></button>\r" +
Expand Down Expand Up @@ -3870,17 +3892,18 @@ angular.module('ngGrid').run(['$templateCache', function($templateCache) {
"\n" +
" <div ng-click=\"col.sort($event)\" ng-class=\"'colt' + col.index\" class=\"ngHeaderText\">{{col.displayName}}</div>\r" +
"\n" +
" <div class=\"ngSortButtonDown\" ng-show=\"col.showSortButtonDown()\"></div>\r" +
" <div class=\"ngSortButtonDown\" ng-click=\"col.sort($event)\" ng-show=\"col.showSortButtonDown()\"></div>\r" +
"\n" +
" <div class=\"ngSortButtonUp\" ng-show=\"col.showSortButtonUp()\"></div>\r" +
" <div class=\"ngSortButtonUp\" ng-click=\"col.sort($event)\" ng-show=\"col.showSortButtonUp()\"></div>\r" +
"\n" +
" <div class=\"ngSortPriority\">{{col.sortPriority}}</div>\r" +
"\n" +
" <div ng-class=\"{ ngPinnedIcon: col.pinned, ngUnPinnedIcon: !col.pinned }\" ng-click=\"togglePin(col)\" ng-show=\"col.pinnable\"></div>\r" +
"\n" +
"</div>\r" +
"\n" +
"<div ng-show=\"col.resizable\" class=\"ngHeaderGrip\" ng-click=\"col.gripClick($event)\" ng-mousedown=\"col.gripOnMouseDown($event)\"></div>"
"<div ng-show=\"col.resizable\" class=\"ngHeaderGrip\" ng-click=\"col.gripClick($event)\" ng-mousedown=\"col.gripOnMouseDown($event)\"></div>\r" +
"\n"
);


Expand Down
Loading

0 comments on commit c2802d2

Please sign in to comment.