Skip to content

Commit

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


## Features

- **filters:** add ngTableSelectFilterDs directive
([c79fdd86](https://github.com/esvit/ng-table/commit/c79fdd86a718b61da0c7eab9eb2a82810881a941))


## Breaking Changes

- **filters:** due to [6e1bd3d9](https://github.com/esvit/ng-table/commit/6e1bd3d9b47ed1bf47c8daaf512ab2e9c3d9b4af),


`ngTableController` no longer adds an empty item to the array returned by `$column.filterData`.

This will only affect those apps that were using `$column.filterData` to supply data to a *custom*
filter template.

Those apps that are using the `select.html` will be unaffected as the `select.html` filter will add
this empty item.


<a name="1.0.0-alpha.3"></a>
# 1.0.0-alpha.3 (2015-08-14)

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-alpha.3",
"version": "1.0.0-alpha.4",
"main": [
"./dist/ng-table.min.js",
"./dist/ng-table.min.css"
Expand Down
91 changes: 77 additions & 14 deletions dist/ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,28 +1161,15 @@
if (!angular.isArray(data) && !angular.isFunction(data) && !angular.isObject(data)) {
// if none of the above was found - we just want an empty array
data = [];
} else if (angular.isArray(data)) {
ensureEmptyListOption(data);
}
$column.data = data;
});
}
// otherwise, we just return what the user gave us. It could be a function, array, object, whatever
else {
ensureEmptyListOption(result);
return $column.data = result;
}
});

function ensureEmptyListOption(data){
if (!angular.isArray(data)){
return;
}
data.unshift({
title: '',
id: ''
});
}
};

this.buildColumns = function (columns) {
Expand Down Expand Up @@ -1616,11 +1603,87 @@
}
})();

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

(function(){
'use strict';

/**
* @ngdoc directive
* @name ngTableSelectFilterDs
* @module ngTable
* @restrict A
*
* @description
* Takes the array returned by $column.filterData and makes it available as `$selectData` on the `$scope`.
*
* The resulting `$selectData` array will contain an extra item that is suitable to represent the user
* "deselecting" an item from a `<select>` tag
*
* This directive is is focused on providing a datasource to an `ngOptions` directive
*/
angular.module('ngTable')
.directive('ngTableSelectFilterDs', ngTableSelectFilterDs);

ngTableSelectFilterDs.$inject = [];

function ngTableSelectFilterDs(){
// note: not using isolated or child scope "by design"
// this is to allow this directive to be combined with other directives that do

var directive = {
restrict: 'A',
controller: ngTableSelectFilterDsController
};
return directive;
}

ngTableSelectFilterDsController.$inject = ['$scope', '$parse', '$attrs', '$q'];
function ngTableSelectFilterDsController($scope, $parse, $attrs, $q){

init();

function init(){
var $column = $parse($attrs.ngTableSelectFilterDs)($scope);
getSelectListData($column).then(function(data){
if (data && !hasEmptyOption(data)){
data.unshift({ id: '', title: ''});
}
data = data || [];
$scope.$selectData = data;
});
}

function hasEmptyOption(data) {
var isMatch;
for (var i = 0; i < data.length; i++) {
var item = data[i];
if (item && item.id === '') {
isMatch = true;
break;
}
}
return isMatch;
}

function getSelectListData($column) {
var data = angular.isFunction($column.data) ? $column.data() : $column.data;
return $q.when(data);
}
}
})();

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().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().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 $column.data" ng-disabled="$filterRow.disabled" ng-model="params.filter()[name]" class="filter filter-select form-control" name="{{name}}"> <option style="display:none" value=""></option> </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> ');
$templateCache.put('ng-table/filters/text.html', '<input type="text" name="{{name}}" ng-disabled="$filterRow.disabled" ng-model="params.filter()[name]" class="input-filter form-control" placeholder="{{getFilterPlaceholderValue(filter, name)}}"/> ');
$templateCache.put('ng-table/header.html', '<ng-table-sorter-row></ng-table-sorter-row> <ng-table-filter-row></ng-table-filter-row> ');
$templateCache.put('ng-table/pager.html', '<div class="ng-cloak ng-table-pager" ng-if="params.data.length"> <div ng-if="params.settings().counts.length" class="ng-table-counts btn-group pull-right"> <button ng-repeat="count in params.settings().counts" type="button" ng-class="{\'active\':params.count()==count}" ng-click="params.count(count)" class="btn btn-default"> <span ng-bind="count"></span> </button> </div> <ul ng-if="pages.length" class="pagination ng-table-pagination"> <li ng-class="{\'disabled\': !page.active && !page.current, \'active\': page.current}" ng-repeat="page in pages" ng-switch="page.type"> <a ng-switch-when="prev" ng-click="params.page(page.number)" href="">&laquo;</a> <a ng-switch-when="first" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="page" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="more" ng-click="params.page(page.number)" href="">&#8230;</a> <a ng-switch-when="last" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="next" ng-click="params.page(page.number)" href="">&raquo;</a> </li> </ul> </div> ');
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-alpha.3",
"version": "1.0.0-alpha.4",
"author": "Vitalii Savchuk <[email protected]>",
"license": "BSD",
"repository": {
Expand Down

0 comments on commit e8608dc

Please sign in to comment.