Skip to content

Commit

Permalink
chore(release): 1.0.0 distribution files
Browse files Browse the repository at this point in the history
  • Loading branch information
christianacca committed Jun 17, 2016
1 parent a6b2a9f commit d635559
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 94 deletions.
80 changes: 80 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
<a name="1.0.0"></a>
# 1.0.0 (2016-06-17)


## Breaking Changes

- **ngTableParams:** due to [9b81066a](https://github.com/esvit/ng-table/commit/9b81066af8322c30a9d850063b977afce4f83f9e),


1) `ngTableAfterReloadData $scope` event removed

Eventing no longer makes *direct* calls to `$scope.$emit`. Instead a strongly typed pub/sub service
(`ngTableEventsChannel`) is used.

**To migrate**

*Previously:*

```js
$scope.$on('ngTableAfterReloadData', yourHandler)
```

*Now:*

```js
ngTableEventsChannel.onAfterReloadData(yourHandler, $scope)
```

2) `$scope` removed from `NgTableParams`

Because of 1. above, `NgTableParams` no longer requires a reference to `$scope`.

A reference to `$scope` was largely an internal requirement so there should be no code change
required on your part.

3) `getData` signature change

The `$defer` paramater supplied to your `getData` method has been removed. Instead your
`getData` method should return an array or a promise that resolves to an array.

**To migrate**

*Previously:*

```js
var tp = new NgTableParams({}, { getData: getData });

function getData($defer, params){
// snip
$defer.resolve(yourDataArray);
}
```

*Now:*

```js
var tp = new NgTableParams({}, { getData: getData });

function getData(params){
// snip
return yourDataArrayOrPromise;
}
```

4) `ngTableParams` renamed to `NgTableParams`

**To migrate**

*Previously:*

```js
var tp = new ngTableParams();
```

*Now:*

```js
var tp = new NgTableParams();
```

<a name="1.0.0-beta.9"></a>
# 1.0.0-beta.9 (2015-11-10)

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.9",
"version": "1.0.0",
"main": [
"./dist/ng-table.js",
"./dist/ng-table.css"
Expand Down
100 changes: 12 additions & 88 deletions dist/ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@

/////////

function getTemplateUrl(filterValue, filterKey){
if (angular.isObject(filterValue)){
filterValue = filterValue.id;
function getTemplateUrl(filterDef, filterKey){
if (angular.isObject(filterDef)){
filterDef = filterDef.id;
}
if (filterValue.indexOf('/') !== -1){
return filterValue;
if (filterDef.indexOf('/') !== -1){
return filterDef;
}

return service.getUrlForAlias(filterValue, filterKey);
return service.getUrlForAlias(filterDef, filterKey);
}

function getUrlForAlias(aliasName/*, filterKey*/){
Expand Down Expand Up @@ -371,43 +371,6 @@
}
})();

/**
* ngTable: Table + Angular JS
*
* @author Vitalii Savchuk <esvit666@gmail.com>
* @url https://github.com/esvit/ng-table/
* @license New BSD License <http://creativecommons.org/licenses/BSD/>
*/

(function(){
'use strict';

// todo: remove shim after an acceptable depreciation period

angular.module('ngTable')
.factory('ngTableGetDataBcShim', ngTableGetDataBcShim);

ngTableGetDataBcShim.$inject = ['$q'];

function ngTableGetDataBcShim($q){

return createWrapper;

function createWrapper(getDataFn){
return function getDataShim(/*args*/){
var $defer = $q.defer();
var pData = getDataFn.apply(this, [$defer].concat(Array.prototype.slice.call(arguments)));
if (!pData) {
// If getData resolved the $defer, and didn't promise us data,
// create a promise from the $defer. We need to return a promise.
pData = $defer.promise;
}
return pData;
}
}
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -546,7 +509,7 @@
* @description Parameters manager for ngTable
*/

angular.module('ngTable').factory('NgTableParams', ['$q', '$log', '$filter', 'ngTableDefaults', 'ngTableGetDataBcShim', 'ngTableDefaultGetData', 'ngTableEventsChannel', function($q, $log, $filter, ngTableDefaults, ngTableGetDataBcShim, ngTableDefaultGetData, ngTableEventsChannel) {
angular.module('ngTable').factory('NgTableParams', ['$q', '$log', '$filter', 'ngTableDefaults', 'ngTableDefaultGetData', 'ngTableEventsChannel', function($q, $log, $filter, ngTableDefaults, ngTableDefaultGetData, ngTableEventsChannel) {
var isNumber = function(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
};
Expand Down Expand Up @@ -676,16 +639,6 @@
newSettings.total = newSettings.dataset.length;
}

// todo: remove the backwards compatibility shim and the following two if blocks
if (newSettings.getData && newSettings.getData.length > 1){
// support the old getData($defer, params) api
newSettings.getDataFnAdaptor = ngTableGetDataBcShim;
}
if (newSettings.getGroups && newSettings.getGroups.length > 2){
// support the old getGroups($defer, params) api
newSettings.getGroupsFnAdaptor = ngTableGetDataBcShim;
}

var originalDataset = settings.dataset;
settings = angular.extend(settings, newSettings);

Expand Down Expand Up @@ -1090,9 +1043,9 @@
isCommittedDataset = true;

if (self.hasGroup()) {
pData = runInterceptorPipeline(runGetGroups);
pData = runInterceptorPipeline($q.when(settings.getGroups(self)));
} else {
pData = runInterceptorPipeline(runGetData);
pData = runInterceptorPipeline($q.when(settings.getData(self)));
}

log('ngTable: reload data');
Expand All @@ -1108,11 +1061,6 @@
ngTableEventsChannel.publishAfterReloadData(self, data, oldData);
self.reloadPages();

// todo: remove after acceptable depreciation period
if (settings.$scope) {
settings.$scope.$emit('ngTableAfterReloadData');
}

return data;
}).catch(function(reason){
errParamsMemento = prevParamsMemento;
Expand Down Expand Up @@ -1155,17 +1103,7 @@
}
})();

function runGetData(){
var getDataFn = settings.getDataFnAdaptor(settings.getData);
return $q.when(getDataFn.call(settings, self));
}

function runGetGroups(){
var getGroupsFn = settings.getGroupsFnAdaptor(settings.getGroups);
return $q.when(getGroupsFn.call(settings, self));
}

function runInterceptorPipeline(fetchFn){
function runInterceptorPipeline(fetchedData){
var interceptors = settings.interceptors || [];

return interceptors.reduce(function(result, interceptor){
Expand All @@ -1176,14 +1114,12 @@
}, function(reason){
return rejectFn(reason, self);
});
}, fetchFn());
}, fetchedData);
}

function getDefaultSettingFns(){

return {
getDataFnAdaptor: angular.identity,
getGroupsFnAdaptor: angular.identity,
getData: getData,
getGroups: getGroups
};
Expand Down Expand Up @@ -1231,8 +1167,7 @@
var settings = params.settings();
var originalDataOptions = settings.dataOptions;
settings.dataOptions = { applyPaging: false };
var adaptedFn = settings.getDataFnAdaptor(settings.getData);
var gotData = $q.when(adaptedFn.call(settings, params));
var gotData = $q.when(settings.getData(params));
return gotData.then(function(data) {
var groups = {};
angular.forEach(data, function(item) {
Expand Down Expand Up @@ -1300,8 +1235,6 @@
* @description configuration settings for `NgTableParams`
*/
var settings = {
// todo: remove $scope after acceptable depreciation period as no longer required
$scope: null, // set by ngTable controller
$loading: false,
dataset: null, //allows data to be set when table is initialized
total: 0,
Expand Down Expand Up @@ -1332,15 +1265,6 @@
};
return NgTableParams;
}]);

/**
* @ngdoc service
* @name ngTableParams
* @description Backwards compatible shim for lowercase 'n' in NgTableParams
*/
angular.module('ngTable').factory('ngTableParams', ['NgTableParams', function(NgTableParams) {
return NgTableParams;
}]);
})();


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.9",
"version": "1.0.0",
"author": "Vitalii Savchuk <esvit666@gmail.com>",
"license": "BSD",
"repository": {
Expand Down

0 comments on commit d635559

Please sign in to comment.