Skip to content

Commit

Permalink
chore(release): 1.0.0-alpha distribution files
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrowhurstram committed Aug 10, 2015
1 parent 6aec41c commit fe4fed7
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 54 deletions.
64 changes: 64 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
<a name="1.0.0-alpha"></a>
# 1.0.0-alpha (2015-08-10)


## Bug Fixes

- **NgTableParams:** default page size is unreasonably small
([6aec41ca](https://github.com/esvit/ng-table/commit/6aec41cae47050861ade27cde71e4a6ca6252922))


## Breaking Changes

- **NgTableParams:**
- due to [6aec41ca](https://github.com/esvit/ng-table/commit/6aec41cae47050861ade27cde71e4a6ca6252922),


Default page size has been increased from 1 to 10.

To override this behaviour set the default page size in the a run block:

```js
angular.module("yourApp").run(setRunPhaseDefaults);

setRunPhaseDefaults.$inject = ["ngTableDefaults"];

function setRunPhaseDefaults(ngTableDefaults) {
ngTableDefaults.params.count = 1;
}
```

- due to [6b747850](https://github.com/esvit/ng-table/commit/6b747850fdc3ca9c22ee5f5e0d9cfc26d8e462f4),


`NgTableParams` no longer exposes a `getGroups` method.

`getGroups` is now a method on the settings object only.

- due to [1ed1a044](https://github.com/esvit/ng-table/commit/1ed1a044bf1eb411d6e051b3440d5e75007e06ee),


`NgTableParams` no longer exposes a `getData` method

- **settings:** due to [e29babf2](https://github.com/esvit/ng-table/commit/e29babf2958fb0f1ee39c48c8531cc70c110cdeb),


The `column` parameter of the `getGroups` method has been removed.

Instead the `groupBy` value on the `NgTableParams.settings()` object supplied as a parameter will
be used to determine the grouping.

Previously:

```js
var groupsFetched = tableParams.settings().getGroups('age');
```

Now:

```js
tableParams.settings({ groupBy: 'age'});
var groupsFetched = tableParams.settings().getGroups(tableParams);
```


<a name="0.8.3"></a>
# 0.8.3 (2015-08-09)

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": "0.8.3",
"version": "1.0.0-alpha",
"main": [
"./dist/ng-table.min.js",
"./dist/ng-table.min.css"
Expand Down
116 changes: 68 additions & 48 deletions dist/ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@
/**
* @ngdoc provider
* @name ngTableDefaultGetDataProvider
* @description Allows for the configuration of the {@link ngTable.ngTableDefaultGetData ngTableDefaultGetData}
* service.
* @description Allows for the configuration of the ngTableDefaultGetData service.
*
* Set filterFilterName to the name of a angular filter that knows how to take `NgTableParams.filter()`
* to restrict an array of data.
Expand Down Expand Up @@ -449,7 +448,6 @@

var self = this,
committedParams,
getGroups,
isCommittedDataset = false,
log = function() {
if (settings.debugMode && $log.debug) {
Expand Down Expand Up @@ -519,7 +517,7 @@
newSettings.getDataFnAdaptor = ngTableGetDataBcShim;
}
if (newSettings.getGroups && newSettings.getGroups.length > 2){
// support the old getGroups($defer, grouping, params) api
// support the old getGroups($defer, params) api
newSettings.getGroupsFnAdaptor = ngTableGetDataBcShim;
}

Expand Down Expand Up @@ -672,33 +670,6 @@
return sorting;
};

/**
* @ngdoc method
* @name settings#getGroups
* @description Return groups for table grouping
*/
getGroups = function(column) {
// this === settings
return runGetData().then(function(data) {
var groups = {};
angular.forEach(data, function(item) {
var groupName = angular.isFunction(column) ? column(item) : item[column];

groups[groupName] = groups[groupName] || {
data: []
};
groups[groupName]['value'] = groupName;
groups[groupName].data.push(item);
});
var result = [];
for (var i in groups) {
result.push(groups[i]);
}
log('ngTable: refresh groups', result);
return result;
});
};

/**
* @ngdoc method
* @name NgTableParams#generatePagesArray
Expand Down Expand Up @@ -906,7 +877,7 @@

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

function runInterceptorPipeline(fetchFn){
Expand All @@ -923,9 +894,70 @@
}, fetchFn());
}

function getDefaultSettingFns(){

return {
getDataFnAdaptor: angular.identity,
getGroupsFnAdaptor: angular.identity,
getData: getData,
getGroups: getGroups
};

/**
* @ngdoc method
* @name settings#getData
* @description Returns the data to display in the table
*
* Called by `NgTableParams` whenever it considers new data is to be loaded
*
* @param {Object} params the `NgTableParams` requesting data
*/
function getData(params) {
return ngTableDefaultGetData(params.settings().data, params);
}

/**
* @ngdoc method
* @name settings#getGroups
* @description Return groups of data to display in the table
*
* Called by `NgTableParams` whenever it considers new data is to be loaded
* and when the `settings` object has a `groupBy` value
*
* @param {Object} params the `NgTableParams` requesting data
*/
function getGroups(params) {
var settings = params.settings();
var adaptedFn = settings.getDataFnAdaptor(settings.getData);
var gotData = $q.when(adaptedFn.call(settings, params));
return gotData.then(function(data) {
var groups = {};
angular.forEach(data, function(item) {
var groupName;
if (angular.isFunction(settings.groupBy)) {
groupName = settings.groupBy(item);
} else {
groupName = item[settings.groupBy];
}

groups[groupName] = groups[groupName] || {
data: []
};
groups[groupName]['value'] = groupName;
groups[groupName].data.push(item);
});
var result = [];
for (var i in groups) {
result.push(groups[i]);
}
return result;
});
}
}

var params = {
page: 1,
count: 1,
count: 10,
filter: {},
sorting: {},
group: {},
Expand All @@ -934,7 +966,7 @@
angular.extend(params, ngTableDefaults.params);

/**
* @ngdoc type
* @ngdoc object
* @name settings
* @module ngTable
* @description configuration settings for `NgTableParams`
Expand All @@ -951,22 +983,10 @@
interceptors: [],
paginationMaxBlocks: 11,
paginationMinBlocks: 5,
sortingIndicator: 'span',
getDataFnAdaptor: angular.identity,
getGroupsFnAdaptor: angular.identity,
getGroups: getGroups,
/**
* @ngdoc method
* @name settings#getData
* @description Called by NgTableParams whenever it considers new data is to be loaded
*
* @param {Object} params the NgTableParams requesting data
*/
getData: function(params) {
return ngTableDefaultGetData(this.data, params);
}
sortingIndicator: 'span'
};

this.settings(getDefaultSettingFns());
this.settings(ngTableDefaults.settings);
this.settings(baseSettings);
this.parameters(baseParameters, true);
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": "0.8.3",
"version": "1.0.0-alpha",
"author": "Vitalii Savchuk <[email protected]>",
"license": "BSD",
"repository": {
Expand Down

0 comments on commit fe4fed7

Please sign in to comment.