Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary #684

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ module.exports = function(grunt) {
'src/scripts/ngTableFilterRow.directive.js',
'src/scripts/ngTableSorterRowController.js',
'src/scripts/ngTableSorterRow.directive.js',
'src/scripts/ngTableSummaryRow.directive.js',
'src/scripts/ngTableSummaryRowController.js',
'src/scripts/ngTableSelectFilterDs.directive.js',
'./.temp/scripts/views.js',
'src/scripts/outro.js'
Expand Down
150 changes: 119 additions & 31 deletions dist/ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
}(window.angular || null, function(angular) {
'use strict';

/**
* ngTable: Table + Angular JS
*
Expand All @@ -27,7 +27,7 @@
*/
angular.module('ngTable', []);
})();

/**
* ngTable: Table + Angular JS
*
Expand All @@ -49,7 +49,7 @@
settings: {}
});
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -147,7 +147,7 @@
}
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -235,7 +235,7 @@
}
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -345,7 +345,7 @@
}
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -382,7 +382,7 @@
}
}
})();

/**
* ngTable: Table + Angular JS
*
Expand All @@ -408,6 +408,9 @@
headerTemplateURL: function(){ return false; },
headerTitle: function(){ return ''; },
sortable: function(){ return false; },
summary: function() { return false; },
summaryClass: function(){ return ''; },
summaryFilter: function(){ return false; },
show: function(){ return true; },
title: function(){ return ''; },
titleAlt: function(){ return ''; }
Expand Down Expand Up @@ -460,7 +463,7 @@
};
}]);
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -611,6 +614,20 @@
}) : settings.total;
};

/**
* @ngdoc method
* @name NgTableParams#summaryVaules
* @description If parameter summaryVaules not set return current summary else set current summaryVaules
*
* @param {string} summaryVaules
* @returns {Object|Number} Current summaryVaules or `this`
*/
this.summaryValues = function(summaryValues) {
return angular.isDefined(summaryValues) ? this.settings({
'summaryValues': summaryValues
}) : settings.summaryValues;
}

/**
* @ngdoc method
* @name NgTableParams#count
Expand Down Expand Up @@ -1078,9 +1095,7 @@
return NgTableParams;
}]);
})();




/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1162,6 +1177,7 @@
if (!$element.hasClass('ng-table')) {
$scope.templates = {
header: ($attrs.templateHeader ? $attrs.templateHeader : 'ng-table/header.html'),
footer: ($attrs.templateFooter ? $attrs.templateFooter : 'ng-table/footer.html'),
pagination: ($attrs.templatePagination ? $attrs.templatePagination : 'ng-table/pager.html')
};
$element.addClass('ng-table');
Expand All @@ -1178,6 +1194,17 @@
headerTemplate = angular.element(document.createElement('thead')).attr('ng-include', 'templates.header');
$element.prepend(headerTemplate);
}
var footerTemplate = null;
var tfootFound = false;
angular.forEach($element.children(), function(e){
if (e.tagName === 'TFOOT') {
theadFound = true;
}
});
if (!tfootFound) {
footerTemplate = angular.element(document.createElement('tfoot')).attr('ng-include', 'templates.footer');
$element.append(footerTemplate);
}
var paginationTemplate = angular.element(document.createElement('div')).attr({
'ng-table-pagination': 'params',
'template-url': 'templates.pagination'
Expand All @@ -1186,6 +1213,9 @@
if (headerTemplate) {
$compile(headerTemplate)($scope);
}
if (footerTemplate) {
$compile(footerTemplate)($scope);
}
$compile(paginationTemplate)($scope);
}
};
Expand Down Expand Up @@ -1268,8 +1298,6 @@
}
};



function commonInit(){
ngTableEventsChannel.onAfterReloadData(bindDataToScope, $scope, isMyPublisher);
ngTableEventsChannel.onPagesChanged(bindPagesToScope, $scope, isMyPublisher);
Expand All @@ -1294,7 +1322,7 @@
commonInit();
}]);
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1373,6 +1401,9 @@
sortable: parsedAttribute('sortable'),
'class': parsedAttribute('header-class'),
filter: parsedAttribute('filter'),
summary: parsedAttribute('summary'),
summaryClass: parsedAttribute('summary-class'),
summaryFilter: parsedAttribute('summary-filter'),
headerTemplateURL: parsedAttribute('header'),
filterData: parsedAttribute('filter-data'),
show: (el.attr("ng-if") ? function (scope) {
Expand All @@ -1392,7 +1423,7 @@
}
]);
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1465,7 +1496,7 @@
};
}]);
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1517,7 +1548,7 @@
]);

})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1557,7 +1588,7 @@
};
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1585,7 +1616,7 @@
return directive;
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1624,7 +1655,7 @@
}
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1652,7 +1683,62 @@
return directive;
}
})();

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

(function(){
'use strict';

angular.module('ngTable')
.directive('ngTableSummaryRow', ngTableSummaryRow);

ngTableSummaryRow.$inject = [];

function ngTableSummaryRow(){
var directive = {
restrict: 'E',
replace: true,
templateUrl: 'ng-table/summaryRow.html',
scope: true,
controller: 'ngTableSummaryRowController'
};
return directive;
}
})();

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

(function(){
'use strict';

angular.module('ngTable')
.controller('ngTableSummaryRowController', ngTableSummaryRowController);

ngTableSummaryRowController.$inject = ['$scope'];

function ngTableSummaryRowController($scope){
$scope.params.settings().summaries = $scope.$columns.map(function($column){
return $column.summary;
});

$scope.params.settings().summaryFilters = $scope.$columns.map(function($column){
return $column.summaryFilter;
});
}
})();

/**
* ngTable: Table + Angular JS
*
Expand Down Expand Up @@ -1728,16 +1814,18 @@
}
}
})();

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 $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> ');
$templateCache.put('ng-table/sorterRow.html', '<tr> <th title="{{$column.headerTitle(this)}}" ng-repeat="$column in $columns" ng-class="{ \'sortable\': $column.sortable(this), \'sort-asc\': params.sorting()[$column.sortable(this)]==\'asc\', \'sort-desc\': params.sorting()[$column.sortable(this)]==\'desc\' }" ng-click="sortBy($column, $event)" ng-if="$column.show(this)" ng-init="template=$column.headerTemplateURL(this)" class="header {{$column.class(this)}}"> <div ng-if="!template" class="ng-table-header" ng-class="{\'sort-indicator\': params.settings().sortingIndicator==\'div\'}"> <span ng-bind="$column.title(this)" ng-class="{\'sort-indicator\': params.settings().sortingIndicator==\'span\'}"></span> </div> <div ng-if="template" ng-include="template"></div> </th> </tr> ');
}]);

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 $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/footer.html', '<ng-table-summary-row></ng-table-summary-row> ');
$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> ');
$templateCache.put('ng-table/sorterRow.html', '<tr> <th title="{{$column.headerTitle(this)}}" ng-repeat="$column in $columns" ng-class="{ \'sortable\': $column.sortable(this), \'sort-asc\': params.sorting()[$column.sortable(this)]==\'asc\', \'sort-desc\': params.sorting()[$column.sortable(this)]==\'desc\' }" ng-click="sortBy($column, $event)" ng-if="$column.show(this)" ng-init="template=$column.headerTemplateURL(this)" class="header {{$column.class(this)}}"> <div ng-if="!template" class="ng-table-header" ng-class="{\'sort-indicator\': params.settings().sortingIndicator==\'div\'}"> <span ng-bind="$column.title(this)" ng-class="{\'sort-indicator\': params.settings().sortingIndicator==\'span\'}"></span> </div> <div ng-if="template" ng-include="template"></div> </th> </tr> ');
$templateCache.put('ng-table/summaryRow.html', '<tr> <td ng-repeat="$column in $columns" ng-if="$column.show(this)" ng-class="$column.summaryClass()"> {{params.summaryValues()[$column.summary(this)]}} </td> </tr> ');
}]);
return angular.module('ngTable');
}));
Loading