Skip to content

Commit

Permalink
chore(release): 1.0.0-beta.5 distribution files
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrowhurstram committed Sep 17, 2015
1 parent 542bb55 commit 2ebfabc
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 31 deletions.
70 changes: 70 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
<a name="1.0.0-beta.5"></a>
# 1.0.0-beta.5 (2015-09-18)


## Bug Fixes

- **NgTableParams:** afterCreated should be the very first event to fire
([84d4220c](https://github.com/esvit/ng-table/commit/84d4220c1a1b61731773f5b5dc6861070dc9f99b))
- **filterRow.html:** header-class should also apply to filter row
([eed65436](https://github.com/esvit/ng-table/commit/eed65436acf4aa8d655492034e755dbbc5e73a1a))
- **ngTableController:** reference to $column not always available in $column getter functions
([adddb27d](https://github.com/esvit/ng-table/commit/adddb27de0abd4fb100ff4998ff6af83cbb6e13b))


## Features

- **ngTableController:** display the filter row by default when applicable
([103b2be4](https://github.com/esvit/ng-table/commit/103b2be40fc703bf30acb782118d1bf4d5a1bd8e))


## Breaking Changes

- **NgTableParams:** due to [84d4220c](https://github.com/esvit/ng-table/commit/84d4220c1a1b61731773f5b5dc6861070dc9f99b),


The order of events firing has changed.

Previously the `datasetChanged` event would fire after the `afterCreated` event. Now `afterCreated`
event will fires first.

- **filterRow.html:** due to [eed65436](https://github.com/esvit/ng-table/commit/eed65436acf4aa8d655492034e755dbbc5e73a1a),


A css class specified using the header-class will now be added to the filter row header cell and not
just the sorting row.

If you want to continue to apply the css rules *only* to the cell in the sorting header row you
will now need to qualify your css rule with the '.header' css class.

So the following:

```css
.my-customer-header {
/* rules */
}
```

... will need to change to:

```css
.header.my-customer-header {
/* rules */
}
```

- **ngTableController:** due to [adddb27d](https://github.com/esvit/ng-table/commit/adddb27de0abd4fb100ff4998ff6af83cbb6e13b),


A context object combines and replaces the `$scope` and `locals` argument originally supplied to
`$column` getter functions.

This context object prototypically inherits from the original `$scope` and has the fields from the
original `locals` argument as own properties.

**It change is very unlikely to affect you**

`ngTableColumn.buildColumn` now expects a third parameter - a reference to the `$columns`
array that will contain the column being built


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

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.4",
"version": "1.0.0-beta.5",
"main": [
"./dist/ng-table.min.js",
"./dist/ng-table.min.css"
Expand Down
100 changes: 75 additions & 25 deletions dist/ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,11 @@
*
* @param {Object} column an existing $column or simple column data object
* @param {Scope} defaultScope the $scope to supply to the $column getter methods when not supplied by caller
* @param {Array} columns a reference to the columns array to make available on the context supplied to the
* $column getter methods
* @returns {Object} a $column object
*/
function buildColumn(column, defaultScope){
function buildColumn(column, defaultScope, columns){
// note: we're not modifying the original column object. This helps to avoid unintended side affects
var extendedCol = Object.create(column);
var defaults = createDefaults();
Expand All @@ -488,11 +490,13 @@
// satisfy the arguments expected by the function returned by parsedAttribute in the ngTable directive
var getterFn = extendedCol[prop1];
extendedCol[prop1] = function () {
if (arguments.length === 0) {
return getterFn.call(column, defaultScope);
} else {
return getterFn.apply(column, arguments);
}
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 Down Expand Up @@ -540,6 +544,7 @@
prevParamsMemento,
errParamsMemento,
isCommittedDataset = false,
initialEvents = [],
log = function() {
if (settings.debugMode && $log.debug) {
$log.debug.apply($log, arguments);
Expand Down Expand Up @@ -677,7 +682,16 @@
this.page(1); // reset page as a new dataset has been supplied
}
isCommittedDataset = false;
ngTableEventsChannel.publishDatasetChanged(this, newSettings.dataset, originalDataset);

var fireEvent = function () {
ngTableEventsChannel.publishDatasetChanged(self, newSettings.dataset, originalDataset);
};

if (initialEvents){
initialEvents.push(fireEvent);
} else {
fireEvent();
}
}
log('ngTable: set settings', settings);
return this;
Expand Down Expand Up @@ -1268,6 +1282,12 @@
this.parameters(baseParameters, true);

ngTableEventsChannel.publishAfterCreated(this);
// run events during construction after the initial create event. That way a consumer
// can subscribe to all events for a table without "dropping" an event
angular.forEach(initialEvents, function(event){
event();
});
initialEvents = null;

return this;
};
Expand Down Expand Up @@ -1399,9 +1419,7 @@
this.loadFilterData = function ($columns) {
angular.forEach($columns, function ($column) {
var result;
result = $column.filterData($scope, {
$column: $column
});
result = $column.filterData($scope);
if (!result) {
delete $column.filterData;
return;
Expand Down Expand Up @@ -1429,9 +1447,11 @@
};

this.buildColumns = function (columns) {
return columns.map(function(col){
return ngTableColumn.buildColumn(col, $scope)
})
var result = [];
columns.forEach(function(col){
result.push(ngTableColumn.buildColumn(col, $scope, result));
});
return result
};

this.parseNgTableDynamicExpr = function (attr) {
Expand Down Expand Up @@ -1462,19 +1482,37 @@
$scope.params = params;
}), false);

setupFilterRowBindingsToInternalScope();
setupGroupRowBindingsToInternalScope();
};

function setupFilterRowBindingsToInternalScope(){
if ($attrs.showFilter) {
$scope.$parent.$watch($attrs.showFilter, function(value) {
$scope.show_filter = value;
});
} else {
$scope.$watch(hasFilterColumn, function(value){
$scope.show_filter = value;
})
}

if ($attrs.disableFilter) {
$scope.$parent.$watch($attrs.disableFilter, function(value) {
$scope.$filterRow.disabled = value;
});
}
}

function setupGroupRowBindingsToInternalScope(){
$scope.$groupRow = {};
if ($attrs.showGroup) {
var showGroupGetter = $parse($attrs.showGroup);
$scope.$parent.$watch(showGroupGetter, function(value) {
$scope.$groupRow.show = value;
});
if (showGroupGetter.assign){
// setup two-way databinding thus allowing ngTableGrowRow to assign to the showGroup expression
$scope.$watch('$groupRow.show', function(value) {
showGroupGetter.assign($scope.$parent, value);
});
Expand All @@ -1484,20 +1522,34 @@
$scope.$groupRow.show = newValue;
});
}

if ($attrs.disableFilter) {
$scope.$parent.$watch($attrs.disableFilter, function(value) {
$scope.$filterRow.disabled = value;
});
}
};
}

function getVisibleColumns(){
return ($scope.$columns || []).filter(function(c){
return c.show($scope);
});
}

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

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

function some(array, predicate){
var found = false;
for (var i = 0; i < array.length; i++) {
var obj = array[i];
if (predicate(obj)){
found = true;
break;
}
}
return found;
}

function commonInit(){
ngTableEventsChannel.onAfterReloadData(bindDataToScope, $scope, isMyPublisher);
ngTableEventsChannel.onPagesChanged(bindPagesToScope, $scope, isMyPublisher);
Expand Down Expand Up @@ -1597,13 +1649,11 @@
}

var localValue;
var getter = function (scope, locals) {
var getter = function (context) {
if (localValue !== undefined){
return localValue;
}
return $parse(expr)(scope, angular.extend(locals || {}, {
$columns: columns
}));
return $parse(expr)(context);
};
getter.assign = function($scope, value){
var parsedExpr = $parse(expr);
Expand Down Expand Up @@ -2193,7 +2243,7 @@
})();

angular.module('ngTable').run(['$templateCache', function ($templateCache) {
$templateCache.put('ng-table/filterRow.html', '<tr ng-show="show_filter" class="ng-table-filters"> <th data-title-text="{{$column.titleAlt(this) || $column.title(this)}}" ng-repeat="$column in $columns" ng-if="$column.show(this)" class="filter" ng-class="params.settings().filterOptions.filterLayout===\'horizontal\' ? \'filter-horizontal\' : \'\'"> <div ng-repeat="(name, filter) in $column.filter(this)" ng-include="config.getTemplateUrl(filter)" class="filter-cell" ng-class="[getFilterCellCss($column.filter(this), params.settings().filterOptions.filterLayout), $last ? \'last\' : \'\']"> </div> </th> </tr> ');
$templateCache.put('ng-table/filterRow.html', '<tr ng-show="show_filter" class="ng-table-filters"> <th data-title-text="{{$column.titleAlt(this) || $column.title(this)}}" ng-repeat="$column in $columns" ng-if="$column.show(this)" class="filter {{$column.class(this)}}" ng-class="params.settings().filterOptions.filterLayout===\'horizontal\' ? \'filter-horizontal\' : \'\'"> <div ng-repeat="(name, filter) in $column.filter(this)" ng-include="config.getTemplateUrl(filter)" class="filter-cell" ng-class="[getFilterCellCss($column.filter(this), params.settings().filterOptions.filterLayout), $last ? \'last\' : \'\']"> </div> </th> </tr> ');
$templateCache.put('ng-table/filters/number.html', '<input type="number" name="{{name}}" ng-disabled="$filterRow.disabled" ng-model="params.filter()[name]" class="input-filter form-control" placeholder="{{getFilterPlaceholderValue(filter, name)}}"/> ');
$templateCache.put('ng-table/filters/select-multiple.html', '<select ng-options="data.id as data.title for data in $column.data" ng-disabled="$filterRow.disabled" multiple ng-multiple="true" ng-model="params.filter()[name]" class="filter filter-select-multiple form-control" name="{{name}}"> </select> ');
$templateCache.put('ng-table/filters/select.html', '<select ng-options="data.id as data.title for data in $selectData" ng-table-select-filter-ds="$column" ng-disabled="$filterRow.disabled" ng-model="params.filter()[name]" class="filter filter-select form-control" name="{{name}}"> <option style="display:none" value=""></option> </select> ');
Expand Down
2 changes: 1 addition & 1 deletion 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.4",
"version": "1.0.0-beta.5",
"author": "Vitalii Savchuk <[email protected]>",
"license": "BSD",
"repository": {
Expand Down

0 comments on commit 2ebfabc

Please sign in to comment.