Skip to content

Commit

Permalink
chore(release): 1.0.0-beta.6 distribution files
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrowhurstram committed Oct 3, 2015
1 parent 8056f3d commit f2486b9
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 60 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<a name="1.0.0-beta.6"></a>
# 1.0.0-beta.6 (2015-10-03)


## Bug Fixes

- **ngTableController:** should not show filter row when all filterable columns are hidden
([9ba4f473](https://github.com/esvit/ng-table/commit/9ba4f473676a94605f6e14755c7d453fa4705bce))
- **pager:** removed margin around buttons
([7e6919ea](https://github.com/esvit/ng-table/commit/7e6919ea6b88bfee39ea14bd975b2a21b416e286))


## Features

- **NgTableParams:** support grouping on nested properties
([2ec9d189](https://github.com/esvit/ng-table/commit/2ec9d18937693b8df42588aa84fa5cb74fb5037b))
- **ngTableColumn:** allow $column fields to be model bound as getter/setter's
([e705fd9a](https://github.com/esvit/ng-table/commit/e705fd9a930504054e00a6ed2040c9e203b97bca))


<a name="1.0.0-beta.5"></a>
# 1.0.0-beta.5 (2015-09-18)

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-table",
"version": "1.0.0-beta.5",
"version": "1.0.0-beta.6",
"main": [
"./dist/ng-table.min.js",
"./dist/ng-table.min.css"
Expand Down
6 changes: 3 additions & 3 deletions dist/ng-table.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@
.ng-table .ng-table-group-toggle {
margin-right: 5px;
}
.ng-table + .pagination {
margin-top: 0;
}
@media only screen and (max-width: 800px) {
.ng-table-responsive {
border-bottom: 1px solid #999999;
Expand Down Expand Up @@ -147,6 +144,9 @@
display: block;
}
}
.ng-table-pagination {
margin-top: 0;
}
.ng-table-group-selector:before,
.ng-table-group-selector:after,
.filter:before,
Expand Down
130 changes: 84 additions & 46 deletions dist/ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,31 +426,11 @@
*/
angular.module('ngTable').factory('ngTableColumn', [function () {

function createDefaults(){
return {
'class': createGetterSetter(''),
filter: createGetterSetter(false),
groupable: createGetterSetter(false),
filterData: angular.noop,
headerTemplateURL: createGetterSetter(false),
headerTitle: createGetterSetter(''),
sortable: createGetterSetter(false),
show: createGetterSetter(true),
title: createGetterSetter(''),
titleAlt: createGetterSetter('')
};
}
return {
buildColumn: buildColumn
};

function createGetterSetter(initialValue){
var value = initialValue;
var getter = function (/*$scope, locals*/){
return value;
};
getter.assign = function($scope, newValue){
value = newValue;
};
return getter;
}
//////////////

/**
* @ngdoc method
Expand All @@ -477,26 +457,34 @@
// - note that the original column object is being "proxied"; this is important
// as it ensure that any changes to the original object will be returned by the "getter"
(function(prop1){
var getterFn = function () {
return column[prop1];
var getterSetter = function getterSetter(/*[value] || [$scope, locals]*/) {
if (arguments.length === 1 && !isScopeLike(arguments[0])) {
getterSetter.assign(null, arguments[0]);
} else {
return column[prop1];
}
};
getterFn.assign = function($scope, value){
getterSetter.assign = function($scope, value){
column[prop1] = value;
};
extendedCol[prop1] = getterFn;
extendedCol[prop1] = getterSetter;
})(prop);
}
(function(prop1){
// satisfy the arguments expected by the function returned by parsedAttribute in the ngTable directive
var getterFn = extendedCol[prop1];
extendedCol[prop1] = function () {
var scope = arguments[0] || defaultScope;
var context = Object.create(scope);
angular.extend(context, {
$column: extendedCol,
$columns: columns
});
return getterFn.call(column, context);
if (arguments.length === 1 && !isScopeLike(arguments[0])){
getterFn.assign(null, arguments[0]);
} else {
var scope = arguments[0] || defaultScope;
var context = Object.create(scope);
angular.extend(context, {
$column: extendedCol,
$columns: columns
});
return getterFn.call(column, context);
}
};
if (getterFn.assign){
extendedCol[prop1].assign = getterFn.assign;
Expand All @@ -506,9 +494,39 @@
return extendedCol;
}

return {
buildColumn: buildColumn
};
function createDefaults(){
return {
'class': createGetterSetter(''),
filter: createGetterSetter(false),
groupable: createGetterSetter(false),
filterData: angular.noop,
headerTemplateURL: createGetterSetter(false),
headerTitle: createGetterSetter(''),
sortable: createGetterSetter(false),
show: createGetterSetter(true),
title: createGetterSetter(''),
titleAlt: createGetterSetter('')
};
}

function createGetterSetter(initialValue){
var value = initialValue;
var getterSetter = function getterSetter(/*[value] || [$scope, locals]*/){
if (arguments.length === 1 && !isScopeLike(arguments[0])) {
getterSetter.assign(null, arguments[0]);
} else {
return value;
}
};
getterSetter.assign = function($scope, newValue){
value = newValue;
};
return getterSetter;
}

function isScopeLike(object){
return object != null && angular.isFunction(object.$new);
}
}]);
})();

Expand Down Expand Up @@ -1205,7 +1223,7 @@
var groupField = Object.keys(group)[0];
sortDirection = group[groupField];
groupFn = function(item){
return item[groupField];
return getPath(item, groupField);
};
}

Expand Down Expand Up @@ -1243,6 +1261,26 @@
settings.dataOptions = originalDataOptions;
});
}

function getPath (obj, ks) {
// origianl source https://github.com/documentcloud/underscore-contrib

if (typeof ks == "string") ks = ks.split(".");

// If we have reached an undefined property
// then stop executing and return undefined
if (obj === undefined) return void 0;

// If the path array has no more elements, we've reached
// the intended property and return its value
if (ks.length === 0) return obj;

// If we still have elements in the path array and the current
// value is null, stop executing and return undefined
if (obj === null) return void 0;

return getPath(obj[ks[0]], ks.slice(1));
}
}

var params = {
Expand Down Expand Up @@ -1492,7 +1530,7 @@
$scope.show_filter = value;
});
} else {
$scope.$watch(hasFilterColumn, function(value){
$scope.$watch(hasVisibleFilterColumn, function(value){
$scope.show_filter = value;
})
}
Expand Down Expand Up @@ -1530,11 +1568,11 @@
});
}

function hasFilterColumn(){
function hasVisibleFilterColumn(){
if (!$scope.$columns) return false;

return some($scope.$columns, function($column){
return $column.filter($scope);
return $column.show($scope) && $column.filter($scope);
});
}

Expand Down Expand Up @@ -1687,11 +1725,11 @@
show: el.attr("ng-if") ? parsedAttribute('ng-if') : undefined
});

if (groupRow){
if (groupRow || el.attr("ng-if")){
// change ng-if to bind to our column definition which we know will be writable
// because this will potentially increase the $watch count, only do so when we definitely
// need to change visibility of the columns.
// currently only ngTableGroupRow directive needs this
// because this will potentially increase the $watch count, only do so if we already have an
// ng-if or when we definitely need to change visibility of the columns.
// currently only ngTableGroupRow directive needs to change visibility
setAttrValue('ng-if', '$columns[' + (columns.length - 1) + '].show(this)');
}
});
Expand Down
8 changes: 4 additions & 4 deletions dist/ng-table.less
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
.ng-table-group-toggle {
margin-right: 5px;
}
& + .pagination {
margin-top: 0;
}
}

@media only screen and (max-width: 800px) {
Expand Down Expand Up @@ -160,10 +157,13 @@
}

.ng-table-pager {}
.ng-table-pagination {}
.ng-table-counts {}
}

.ng-table-pagination {
margin-top: 0;
}

.ng-table-group-selector:before,
.ng-table-group-selector:after,
.filter:before,
Expand Down
4 changes: 2 additions & 2 deletions dist/ng-table.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/ng-table.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ng-table.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-table",
"version": "1.0.0-beta.5",
"version": "1.0.0-beta.6",
"author": "Vitalii Savchuk <esvit666@gmail.com>",
"license": "BSD",
"repository": {
Expand Down

0 comments on commit f2486b9

Please sign in to comment.