').attr({
- 'aria-label': 'Select All',
- 'ng-click': 'toggleAll()',
- 'ng-checked': 'allSelected()',
- 'ng-disabled': '!getSelectableRows().length'
- });
- }
-
- function detachCheckbox() {
- var cell = element.prop('lastElementChild').firstElementChild;
-
- if(cell.classList.contains('md-checkbox-column')) {
- angular.element(cell).empty();
- }
- }
-
- function enableRowSelection() {
- return tableCtrl.$$rowSelect;
- }
-
- function mdSelectCtrl(row) {
- return angular.element(row).controller('mdSelect');
- }
-
- function removeCheckboxColumn() {
- Array.prototype.some.call(element.find('th'), function (cell) {
- return cell.classList.contains('md-checkbox-column') && cell.remove();
- });
- }
-
- scope.allSelected = function () {
- var rows = scope.getSelectableRows();
-
- return rows.length && rows.every(function (row) {
- return row.isSelected();
- });
- };
-
- scope.getSelectableRows = function () {
- return tableCtrl.getBodyRows().map(mdSelectCtrl).filter(function (ctrl) {
- return ctrl && !ctrl.disabled;
- });
- };
-
- scope.selectAll = function () {
- tableCtrl.getBodyRows().map(mdSelectCtrl).forEach(function (ctrl) {
- if(ctrl && !ctrl.isSelected()) {
- ctrl.select();
- }
- });
- };
-
- scope.toggleAll = function () {
- return scope.allSelected() ? scope.unSelectAll() : scope.selectAll();
- };
-
- scope.unSelectAll = function () {
- tableCtrl.getBodyRows().map(mdSelectCtrl).forEach(function (ctrl) {
- if(ctrl && ctrl.isSelected()) {
- ctrl.deselect();
- }
- });
- };
-
- scope.$watchGroup([enableRowSelection, tableCtrl.enableMultiSelect], function (newValue) {
- if(newValue[0] !== oldValue[0]) {
- if(newValue[0]) {
- addCheckboxColumn();
-
- if(newValue[1]) {
- attatchCheckbox();
- }
- } else {
- removeCheckboxColumn();
- }
- } else if(newValue[0] && newValue[1] !== oldValue[1]) {
- if(newValue[1]) {
- attatchCheckbox();
- } else {
- detachCheckbox();
- }
- }
-
- angular.copy(newValue, oldValue);
- });
- }
-
- return {
- bindToController: true,
- compile: compile,
- controller: Controller,
- controllerAs: '$mdHead',
- require: '^^mdTable',
- restrict: 'A',
- scope: {
- order: '=?mdOrder',
- onReorder: '=?mdOnReorder'
- }
- };
-}
-
-mdHead.$inject = ['$compile'];
-
-angular.module('md.data.table').directive('mdRow', mdRow);
-
-function mdRow() {
-
- function compile(tElement) {
- tElement.addClass('md-row');
- return postLink;
- }
-
- function postLink(scope, element, attrs, tableCtrl) {
- function enableRowSelection() {
- return tableCtrl.$$rowSelect;
- }
-
- function isBodyRow() {
- return tableCtrl.getBodyRows().indexOf(element[0]) !== -1;
- }
-
- function isChild(node) {
- return element[0].contains(node[0]);
- }
-
- if(isBodyRow()) {
- var cell = angular.element('');
-
- scope.$watch(enableRowSelection, function (enable) {
- // if a row is not selectable, prepend an empty cell to it
- if(enable && !attrs.mdSelect) {
- if(!isChild(cell)) {
- element.prepend(cell);
- }
- return;
- }
-
- if(isChild(cell)) {
- cell.remove();
- }
- });
- }
- }
-
- return {
- compile: compile,
- require: '^^mdTable',
- restrict: 'A'
- };
-}
-
-angular.module('md.data.table').directive('mdSelect', mdSelect);
-
-function mdSelect($compile, $parse) {
-
- // empty controller to bind scope properties to
- function Controller() {
-
- }
-
- function postLink(scope, element, attrs, ctrls) {
- var self = ctrls.shift();
- var tableCtrl = ctrls.shift();
- var getId = $parse(attrs.mdSelectId);
-
- self.id = getId(self.model);
-
- if(tableCtrl.$$rowSelect && self.id) {
- if(tableCtrl.$$hash.has(self.id)) {
- var index = tableCtrl.selected.indexOf(tableCtrl.$$hash.get(self.id));
-
- // if the item is no longer selected remove it
- if(index === -1) {
- tableCtrl.$$hash.purge(self.id);
- }
-
- // if the item is not a reference to the current model update the reference
- else if(!tableCtrl.$$hash.equals(self.id, self.model)) {
- tableCtrl.$$hash.update(self.id, self.model);
- tableCtrl.selected.splice(index, 1, self.model);
- }
-
- } else {
-
- // check if the item has been selected
- tableCtrl.selected.some(function (item, index) {
- if(getId(item) === self.id) {
- tableCtrl.$$hash.update(self.id, self.model);
- tableCtrl.selected.splice(index, 1, self.model);
-
- return true;
- }
- });
- }
- }
-
- self.isSelected = function () {
- if(!tableCtrl.$$rowSelect) {
- return false;
- }
-
- if(self.id) {
- return tableCtrl.$$hash.has(self.id);
- }
-
- return tableCtrl.selected.indexOf(self.model) !== -1;
- };
-
- self.select = function () {
- if(self.disabled) {
- return;
- }
-
- if(tableCtrl.enableMultiSelect()) {
- tableCtrl.selected.push(self.model);
- } else {
- tableCtrl.selected.splice(0, tableCtrl.selected.length, self.model);
- }
-
- if(angular.isFunction(self.onSelect)) {
- self.onSelect(self.model);
- }
- };
-
- self.deselect = function () {
- if(self.disabled) {
- return;
- }
-
- tableCtrl.selected.splice(tableCtrl.selected.indexOf(self.model), 1);
-
- if(angular.isFunction(self.onDeselect)) {
- self.onDeselect(self.model);
- }
- };
-
- self.toggle = function (event) {
- if(event && event.stopPropagation) {
- event.stopPropagation();
- }
-
- return self.isSelected() ? self.deselect() : self.select();
- };
-
- function autoSelect() {
- return attrs.mdAutoSelect === '' || self.autoSelect;
- }
-
- function createCheckbox() {
- var checkbox = angular.element('').attr({
- 'aria-label': 'Select Row',
- 'ng-click': '$mdSelect.toggle($event)',
- 'ng-checked': '$mdSelect.isSelected()',
- 'ng-disabled': '$mdSelect.disabled'
- });
-
- return angular.element('').append($compile(checkbox)(scope));
- }
-
- function disableSelection() {
- Array.prototype.some.call(element.children(), function (child) {
- return child.classList.contains('md-checkbox-cell') && element[0].removeChild(child);
- });
-
- if(autoSelect()) {
- element.off('click', toggle);
- }
- }
-
- function enableSelection() {
- element.prepend(createCheckbox());
-
- if(autoSelect()) {
- element.on('click', toggle);
- }
- }
-
- function enableRowSelection() {
- return tableCtrl.$$rowSelect;
- }
-
- function onSelectChange(selected) {
- if(!self.id) {
- return;
- }
-
- if(tableCtrl.$$hash.has(self.id)) {
- // check if the item has been deselected
- if(selected.indexOf(tableCtrl.$$hash.get(self.id)) === -1) {
- tableCtrl.$$hash.purge(self.id);
- }
-
- return;
- }
-
- // check if the item has been selected
- if(selected.indexOf(self.model) !== -1) {
- tableCtrl.$$hash.update(self.id, self.model);
- }
- }
-
- function toggle(event) {
- scope.$applyAsync(function () {
- self.toggle(event);
- });
- }
-
- scope.$watch(enableRowSelection, function (enable) {
- if(enable) {
- enableSelection();
- } else {
- disableSelection();
- }
- });
-
- scope.$watch(autoSelect, function (newValue, oldValue) {
- if(newValue === oldValue) {
- return;
- }
-
- if(tableCtrl.$$rowSelect && newValue) {
- element.on('click', toggle);
- } else {
- element.off('click', toggle);
- }
- });
-
- scope.$watch(self.isSelected, function (isSelected) {
- return isSelected ? element.addClass('md-selected') : element.removeClass('md-selected');
- });
-
- scope.$watch(tableCtrl.enableMultiSelect, function (multiple) {
- if(tableCtrl.$$rowSelect && !multiple) {
- // remove all but the first selected item
- tableCtrl.selected.splice(1);
- }
- });
-
- tableCtrl.registerModelChangeListener(onSelectChange);
-
- element.on('$destroy', function () {
- tableCtrl.removeModelChangeListener(onSelectChange);
- });
- }
-
- return {
- bindToController: true,
- controller: Controller,
- controllerAs: '$mdSelect',
- link: postLink,
- require: ['mdSelect', '^^mdTable'],
- restrict: 'A',
- scope: {
- model: '=mdSelect',
- disabled: '=ngDisabled',
- onSelect: '=?mdOnSelect',
- onDeselect: '=?mdOnDeselect',
- autoSelect: '=mdAutoSelect'
- }
- };
-}
-
-mdSelect.$inject = ['$compile', '$parse'];
-
-angular.module('md.data.table').directive('mdTable', mdTable);
-
-function Hash() {
- var keys = {};
-
- this.equals = function (key, item) {
- return keys[key] === item;
- };
-
- this.get = function (key) {
- return keys[key];
- };
-
- this.has = function (key) {
- return keys.hasOwnProperty(key);
- };
-
- this.purge = function (key) {
- delete keys[key];
- };
-
- this.update = function (key, item) {
- keys[key] = item;
- };
-}
-
-function mdTable() {
-
- function compile(tElement, tAttrs) {
- tElement.addClass('md-table');
-
- if(tAttrs.hasOwnProperty('mdProgress')) {
- var body = tElement.find('tbody')[0];
- var progress = angular.element('');
-
- if(body) {
- tElement[0].insertBefore(progress[0], body);
- }
- }
- }
-
- function Controller($attrs, $element, $q, $scope) {
- var self = this;
- var queue = [];
- var watchListener;
- var modelChangeListeners = [];
-
- self.$$hash = new Hash();
- self.$$columns = {};
-
- function enableRowSelection() {
- self.$$rowSelect = true;
-
- watchListener = $scope.$watchCollection('$mdTable.selected', function (selected) {
- modelChangeListeners.forEach(function (listener) {
- listener(selected);
- });
- });
-
- $element.addClass('md-row-select');
- }
-
- function disableRowSelection() {
- self.$$rowSelect = false;
-
- if(angular.isFunction(watchListener)) {
- watchListener();
- }
-
- $element.removeClass('md-row-select');
- }
-
- function resolvePromises() {
- if(!queue.length) {
- return $scope.$applyAsync();
- }
-
- queue[0]['finally'](function () {
- queue.shift();
- resolvePromises();
- });
- }
-
- function rowSelect() {
- return $attrs.mdRowSelect === '' || self.rowSelect;
- }
-
- function validateModel() {
- if(!self.selected) {
- return console.error('Row selection: ngModel is not defined.');
- }
-
- if(!angular.isArray(self.selected)) {
- return console.error('Row selection: Expected an array. Recived ' + typeof self.selected + '.');
- }
-
- return true;
- }
-
- self.columnCount = function () {
- return self.getRows($element[0]).reduce(function (count, row) {
- return row.cells.length > count ? row.cells.length : count;
- }, 0);
- };
-
- self.getRows = function (element) {
- return Array.prototype.filter.call(element.rows, function (row) {
- return !row.classList.contains('ng-leave');
- });
- };
-
- self.getBodyRows = function () {
- return Array.prototype.reduce.call($element.prop('tBodies'), function (result, tbody) {
- return result.concat(self.getRows(tbody));
- }, []);
- };
-
- self.getElement = function () {
- return $element;
- };
-
- self.getHeaderRows = function () {
- return self.getRows($element.prop('tHead'));
- };
-
- self.enableMultiSelect = function () {
- return $attrs.multiple === '' || $scope.$eval($attrs.multiple);
- };
-
- self.waitingOnPromise = function () {
- return !!queue.length;
- };
-
- self.queuePromise = function (promise) {
- if(!promise) {
- return;
- }
-
- if(queue.push(angular.isArray(promise) ? $q.all(promise) : $q.when(promise)) === 1) {
- resolvePromises();
- }
- };
-
- self.registerModelChangeListener = function (listener) {
- modelChangeListeners.push(listener);
- };
-
- self.removeModelChangeListener = function (listener) {
- var index = modelChangeListeners.indexOf(listener);
-
- if(index !== -1) {
- modelChangeListeners.splice(index, 1);
- }
- };
-
- if($attrs.hasOwnProperty('mdProgress')) {
- $scope.$watch('$mdTable.progress', self.queuePromise);
- }
-
- $scope.$watch(rowSelect, function (enable) {
- if(enable && !!validateModel()) {
- enableRowSelection();
- } else {
- disableRowSelection();
- }
- });
- }
-
- Controller.$inject = ['$attrs', '$element', '$q', '$scope'];
-
- return {
- bindToController: true,
- compile: compile,
- controller: Controller,
- controllerAs: '$mdTable',
- restrict: 'A',
- scope: {
- progress: '=?mdProgress',
- selected: '=ngModel',
- rowSelect: '=mdRowSelect'
- }
- };
-}
-
-angular.module('md.data.table').directive('mdTablePagination', mdTablePagination);
-
-function mdTablePagination() {
-
- function compile(tElement) {
- tElement.addClass('md-table-pagination');
- }
-
- function Controller($attrs, $mdUtil, $scope) {
- var self = this;
- var defaultLabel = {
- page: 'Page:',
- rowsPerPage: 'Rows per page:',
- of: 'of'
- };
-
- self.label = angular.copy(defaultLabel);
-
- function isPositive(number) {
- return parseInt(number, 10) > 0;
- }
-
- self.eval = function (expression) {
- return $scope.$eval(expression);
- };
-
- self.first = function () {
- self.page = 1;
- self.onPaginationChange();
- };
-
- self.hasNext = function () {
- return self.page * self.limit < self.total;
- };
-
- self.hasPrevious = function () {
- return self.page > 1;
- };
-
- self.last = function () {
- self.page = self.pages();
- self.onPaginationChange();
- };
-
- self.max = function () {
- return self.hasNext() ? self.page * self.limit : self.total;
- };
-
- self.min = function () {
- return isPositive(self.total) ? self.page * self.limit - self.limit + 1 : 0;
- };
-
- self.next = function () {
- self.page++;
- self.onPaginationChange();
- };
-
- self.onPaginationChange = function () {
- if(angular.isFunction(self.onPaginate)) {
- $mdUtil.nextTick(function () {
- self.onPaginate(self.page, self.limit);
- });
- }
- };
-
- self.pages = function () {
- return isPositive(self.total) ? Math.ceil(self.total / (isPositive(self.limit) ? self.limit : 1)) : 1;
- };
-
- self.previous = function () {
- self.page--;
- self.onPaginationChange();
- };
-
- self.showBoundaryLinks = function () {
- return $attrs.mdBoundaryLinks === '' || self.boundaryLinks;
- };
-
- self.showPageSelect = function () {
- return $attrs.mdPageSelect === '' || self.pageSelect;
- };
-
- $scope.$watch('$pagination.limit', function (newValue, oldValue) {
- if(isNaN(newValue) || isNaN(oldValue) || newValue === oldValue) {
- return;
- }
-
- // find closest page from previous min
- self.page = Math.floor(((self.page * oldValue - oldValue) + newValue) / (isPositive(newValue) ? newValue : 1));
- self.onPaginationChange();
- });
-
- $attrs.$observe('mdLabel', function (label) {
- angular.extend(self.label, defaultLabel, $scope.$eval(label));
- });
-
- $scope.$watch('$pagination.total', function (newValue, oldValue) {
- if(isNaN(newValue) || newValue === oldValue) {
- return;
- }
-
- if(self.page > self.pages()) {
- self.last();
- }
- });
- }
-
- Controller.$inject = ['$attrs', '$mdUtil', '$scope'];
-
- return {
- bindToController: {
- boundaryLinks: '=?mdBoundaryLinks',
- disabled: '=ngDisabled',
- limit: '=mdLimit',
- page: '=mdPage',
- pageSelect: '=?mdPageSelect',
- onPaginate: '=?mdOnPaginate',
- limitOptions: '=?mdLimitOptions',
- total: '@mdTotal'
- },
- compile: compile,
- controller: Controller,
- controllerAs: '$pagination',
- restrict: 'E',
- scope: {},
- templateUrl: 'md-table-pagination.html'
- };
-}
-
-angular.module('md.data.table').directive('mdTableProgress', mdTableProgress);
-
-function mdTableProgress() {
-
- function postLink(scope, element, attrs, tableCtrl) {
- scope.columnCount = tableCtrl.columnCount;
- scope.deferred = tableCtrl.waitingOnPromise;
- }
-
- return {
- link: postLink,
- require: '^^mdTable',
- restrict: 'C',
- scope: {},
- templateUrl: 'md-table-progress.html'
- };
-}
-
-angular.module('md.data.table').directive('virtualPageSelect', virtualPageSelect);
-
-function virtualPageSelect() {
-
- function Controller($element, $scope) {
- var self = this;
- var content = $element.find('md-content');
-
- self.pages = [];
-
- function getMin(pages, total) {
- return Math.min(pages, isFinite(total) && isPositive(total) ? total : 1);
- }
-
- function isPositive(number) {
- return number > 0;
- }
-
- function setPages(max) {
- if(self.pages.length > max) {
- return self.pages.splice(max);
- }
-
- for(var i = self.pages.length; i < max; i++) {
- self.pages.push(i + 1);
- }
- }
-
- content.on('scroll', function () {
- if((content.prop('clientHeight') + content.prop('scrollTop')) >= content.prop('scrollHeight')) {
- $scope.$applyAsync(function () {
- setPages(getMin(self.pages.length + 10, self.total));
- });
- }
- });
-
- $scope.$watch('$pageSelect.total', function (total) {
- setPages(getMin(Math.max(self.pages.length, 10), total));
- });
-
- $scope.$watch('$pagination.page', function (page) {
- for(var i = self.pages.length; i < page; i++) {
- self.pages.push(i + 1);
- }
- });
- }
-
- Controller.$inject = ['$element', '$scope'];
-
- return {
- bindToController: {
- total: '@'
- },
- controller: Controller,
- controllerAs: '$pageSelect'
- };
-}
-
+
+
+angular.module('md.data.table').directive('mdFoot', mdFoot);
+
+function mdFoot() {
+
+ function compile(tElement) {
+ tElement.addClass('md-foot');
+ }
+
+ return {
+ compile: compile,
+ restrict: 'A'
+ };
+}
+
+angular.module('md.data.table').directive('mdHead', mdHead);
+
+function mdHead($compile) {
+
+ function compile(tElement) {
+ tElement.addClass('md-head');
+ return postLink;
+ }
+
+ // empty controller to be bind scope properties to
+ function Controller() {
+
+ }
+
+ function postLink(scope, element, attrs, tableCtrl) {
+ // because scope.$watch is unpredictable
+ var oldValue = new Array(2);
+
+ function addCheckboxColumn() {
+ element.children().prepend('');
+ }
+
+ function attatchCheckbox() {
+ element.prop('lastElementChild').firstElementChild.appendChild($compile(createCheckBox())(scope)[0]);
+ }
+
+ function createCheckBox() {
+ return angular.element('').attr({
+ 'aria-label': 'Select All',
+ 'ng-click': 'toggleAll()',
+ 'ng-checked': 'allSelected()',
+ 'ng-disabled': '!getSelectableRows().length'
+ });
+ }
+
+ function detachCheckbox() {
+ var cell = element.prop('lastElementChild').firstElementChild;
+
+ if(cell.classList.contains('md-checkbox-column')) {
+ angular.element(cell).empty();
+ }
+ }
+
+ function enableRowSelection() {
+ return tableCtrl.$$rowSelect;
+ }
+
+ function mdSelectCtrl(row) {
+ return angular.element(row).controller('mdSelect');
+ }
+
+ function removeCheckboxColumn() {
+ Array.prototype.some.call(element.find('th'), function (cell) {
+ return cell.classList.contains('md-checkbox-column') && cell.remove();
+ });
+ }
+
+ scope.allSelected = function () {
+ var rows = scope.getSelectableRows();
+
+ return rows.length && rows.every(function (row) {
+ return row.isSelected();
+ });
+ };
+
+ scope.getSelectableRows = function () {
+ return tableCtrl.getBodyRows().map(mdSelectCtrl).filter(function (ctrl) {
+ return ctrl && !ctrl.disabled;
+ });
+ };
+
+ scope.selectAll = function () {
+ tableCtrl.getBodyRows().map(mdSelectCtrl).forEach(function (ctrl) {
+ if(ctrl && !ctrl.isSelected()) {
+ ctrl.select();
+ }
+ });
+ };
+
+ scope.toggleAll = function () {
+ return scope.allSelected() ? scope.unSelectAll() : scope.selectAll();
+ };
+
+ scope.unSelectAll = function () {
+ tableCtrl.getBodyRows().map(mdSelectCtrl).forEach(function (ctrl) {
+ if(ctrl && ctrl.isSelected()) {
+ ctrl.deselect();
+ }
+ });
+ };
+
+ scope.$watchGroup([enableRowSelection, tableCtrl.enableMultiSelect], function (newValue) {
+ if(newValue[0] !== oldValue[0]) {
+ if(newValue[0]) {
+ addCheckboxColumn();
+
+ if(newValue[1]) {
+ attatchCheckbox();
+ }
+ } else {
+ removeCheckboxColumn();
+ }
+ } else if(newValue[0] && newValue[1] !== oldValue[1]) {
+ if(newValue[1]) {
+ attatchCheckbox();
+ } else {
+ detachCheckbox();
+ }
+ }
+
+ angular.copy(newValue, oldValue);
+ });
+ }
+
+ return {
+ bindToController: true,
+ compile: compile,
+ controller: Controller,
+ controllerAs: '$mdHead',
+ require: '^^mdTable',
+ restrict: 'A',
+ scope: {
+ order: '=?mdOrder',
+ onReorder: '=?mdOnReorder'
+ }
+ };
+}
+
+mdHead.$inject = ['$compile'];
+
+angular.module('md.data.table').directive('mdRow', mdRow);
+
+function mdRow() {
+
+ function compile(tElement) {
+ tElement.addClass('md-row');
+ return postLink;
+ }
+
+ function postLink(scope, element, attrs, tableCtrl) {
+ function enableRowSelection() {
+ return tableCtrl.$$rowSelect;
+ }
+
+ function isBodyRow() {
+ return tableCtrl.getBodyRows().indexOf(element[0]) !== -1;
+ }
+
+ function isChild(node) {
+ return element[0].contains(node[0]);
+ }
+
+ if(isBodyRow()) {
+ var cell = angular.element('');
+
+ scope.$watch(enableRowSelection, function (enable) {
+ // if a row is not selectable, prepend an empty cell to it
+ if(enable && !attrs.mdSelect) {
+ if(!isChild(cell)) {
+ element.prepend(cell);
+ }
+ return;
+ }
+
+ if(isChild(cell)) {
+ cell.remove();
+ }
+ });
+ }
+ }
+
+ return {
+ compile: compile,
+ require: '^^mdTable',
+ restrict: 'A'
+ };
+}
+
+angular.module('md.data.table').directive('mdSelect', mdSelect);
+
+function mdSelect($compile, $parse) {
+
+ // empty controller to bind scope properties to
+ function Controller() {
+
+ }
+
+ function postLink(scope, element, attrs, ctrls) {
+ var self = ctrls.shift();
+ var tableCtrl = ctrls.shift();
+ var getId = $parse(attrs.mdSelectId);
+
+ self.id = getId(self.model);
+
+ if(tableCtrl.$$rowSelect && self.id) {
+ if(tableCtrl.$$hash.has(self.id)) {
+ var index = tableCtrl.selected.indexOf(tableCtrl.$$hash.get(self.id));
+
+ // if the item is no longer selected remove it
+ if(index === -1) {
+ tableCtrl.$$hash.purge(self.id);
+ }
+
+ // if the item is not a reference to the current model update the reference
+ else if(!tableCtrl.$$hash.equals(self.id, self.model)) {
+ tableCtrl.$$hash.update(self.id, self.model);
+ tableCtrl.selected.splice(index, 1, self.model);
+ }
+
+ } else {
+
+ // check if the item has been selected
+ tableCtrl.selected.some(function (item, index) {
+ if(getId(item) === self.id) {
+ tableCtrl.$$hash.update(self.id, self.model);
+ tableCtrl.selected.splice(index, 1, self.model);
+
+ return true;
+ }
+ });
+ }
+ }
+
+ self.isSelected = function () {
+ if(!tableCtrl.$$rowSelect) {
+ return false;
+ }
+
+ if(self.id) {
+ return tableCtrl.$$hash.has(self.id);
+ }
+
+ return tableCtrl.selected.indexOf(self.model) !== -1;
+ };
+
+ self.select = function () {
+ if(self.disabled) {
+ return;
+ }
+
+ if(tableCtrl.enableMultiSelect()) {
+ tableCtrl.selected.push(self.model);
+ } else {
+ tableCtrl.selected.splice(0, tableCtrl.selected.length, self.model);
+ }
+
+ if(angular.isFunction(self.onSelect)) {
+ self.onSelect(self.model);
+ }
+ };
+
+ self.deselect = function () {
+ if(self.disabled) {
+ return;
+ }
+
+ tableCtrl.selected.splice(tableCtrl.selected.indexOf(self.model), 1);
+
+ if(angular.isFunction(self.onDeselect)) {
+ self.onDeselect(self.model);
+ }
+ };
+
+ self.toggle = function (event) {
+ if(event && event.stopPropagation) {
+ event.stopPropagation();
+ }
+
+ return self.isSelected() ? self.deselect() : self.select();
+ };
+
+ function autoSelect() {
+ return attrs.mdAutoSelect === '' || self.autoSelect;
+ }
+
+ function createCheckbox() {
+ var checkbox = angular.element('').attr({
+ 'aria-label': 'Select Row',
+ 'ng-click': '$mdSelect.toggle($event)',
+ 'ng-checked': '$mdSelect.isSelected()',
+ 'ng-disabled': '$mdSelect.disabled'
+ });
+
+ return angular.element('').append($compile(checkbox)(scope));
+ }
+
+ function disableSelection() {
+ Array.prototype.some.call(element.children(), function (child) {
+ return child.classList.contains('md-checkbox-cell') && element[0].removeChild(child);
+ });
+
+ if(autoSelect()) {
+ element.off('click', toggle);
+ }
+ }
+
+ function enableSelection() {
+ element.prepend(createCheckbox());
+
+ if(autoSelect()) {
+ element.on('click', toggle);
+ }
+ }
+
+ function enableRowSelection() {
+ return tableCtrl.$$rowSelect;
+ }
+
+ function onSelectChange(selected) {
+ if(!self.id) {
+ return;
+ }
+
+ if(tableCtrl.$$hash.has(self.id)) {
+ // check if the item has been deselected
+ if(selected.indexOf(tableCtrl.$$hash.get(self.id)) === -1) {
+ tableCtrl.$$hash.purge(self.id);
+ }
+
+ return;
+ }
+
+ // check if the item has been selected
+ if(selected.indexOf(self.model) !== -1) {
+ tableCtrl.$$hash.update(self.id, self.model);
+ }
+ }
+
+ function toggle(event) {
+ scope.$applyAsync(function () {
+ self.toggle(event);
+ });
+ }
+
+ scope.$watch(enableRowSelection, function (enable) {
+ if(enable) {
+ enableSelection();
+ } else {
+ disableSelection();
+ }
+ });
+
+ scope.$watch(autoSelect, function (newValue, oldValue) {
+ if(newValue === oldValue) {
+ return;
+ }
+
+ if(tableCtrl.$$rowSelect && newValue) {
+ element.on('click', toggle);
+ } else {
+ element.off('click', toggle);
+ }
+ });
+
+ scope.$watch(self.isSelected, function (isSelected) {
+ return isSelected ? element.addClass('md-selected') : element.removeClass('md-selected');
+ });
+
+ scope.$watch(tableCtrl.enableMultiSelect, function (multiple) {
+ if(tableCtrl.$$rowSelect && !multiple) {
+ // remove all but the first selected item
+ tableCtrl.selected.splice(1);
+ }
+ });
+
+ tableCtrl.registerModelChangeListener(onSelectChange);
+
+ element.on('$destroy', function () {
+ tableCtrl.removeModelChangeListener(onSelectChange);
+ });
+ }
+
+ return {
+ bindToController: true,
+ controller: Controller,
+ controllerAs: '$mdSelect',
+ link: postLink,
+ require: ['mdSelect', '^^mdTable'],
+ restrict: 'A',
+ scope: {
+ model: '=mdSelect',
+ disabled: '=ngDisabled',
+ onSelect: '=?mdOnSelect',
+ onDeselect: '=?mdOnDeselect',
+ autoSelect: '=mdAutoSelect'
+ }
+ };
+}
+
+mdSelect.$inject = ['$compile', '$parse'];
+
+angular.module('md.data.table').directive('mdTable', mdTable);
+
+function Hash() {
+ var keys = {};
+
+ this.equals = function (key, item) {
+ return keys[key] === item;
+ };
+
+ this.get = function (key) {
+ return keys[key];
+ };
+
+ this.has = function (key) {
+ return keys.hasOwnProperty(key);
+ };
+
+ this.purge = function (key) {
+ delete keys[key];
+ };
+
+ this.update = function (key, item) {
+ keys[key] = item;
+ };
+}
+
+function mdTable() {
+
+ function compile(tElement, tAttrs) {
+ tElement.addClass('md-table');
+
+ if(tAttrs.hasOwnProperty('mdProgress')) {
+ var body = tElement.find('tbody')[0];
+ var progress = angular.element('');
+
+ if(body) {
+ tElement[0].insertBefore(progress[0], body);
+ }
+ }
+ }
+
+ function Controller($attrs, $element, $q, $scope) {
+ var self = this;
+ var queue = [];
+ var watchListener;
+ var modelChangeListeners = [];
+
+ self.$$hash = new Hash();
+ self.$$columns = {};
+
+ function enableRowSelection() {
+ self.$$rowSelect = true;
+
+ watchListener = $scope.$watchCollection('$mdTable.selected', function (selected) {
+ modelChangeListeners.forEach(function (listener) {
+ listener(selected);
+ });
+ });
+
+ $element.addClass('md-row-select');
+ }
+
+ function disableRowSelection() {
+ self.$$rowSelect = false;
+
+ if(angular.isFunction(watchListener)) {
+ watchListener();
+ }
+
+ $element.removeClass('md-row-select');
+ }
+
+ function resolvePromises() {
+ if(!queue.length) {
+ return $scope.$applyAsync();
+ }
+
+ queue[0]['finally'](function () {
+ queue.shift();
+ resolvePromises();
+ });
+ }
+
+ function rowSelect() {
+ return $attrs.mdRowSelect === '' || self.rowSelect;
+ }
+
+ function validateModel() {
+ if(!self.selected) {
+ return console.error('Row selection: ngModel is not defined.');
+ }
+
+ if(!angular.isArray(self.selected)) {
+ return console.error('Row selection: Expected an array. Recived ' + typeof self.selected + '.');
+ }
+
+ return true;
+ }
+
+ self.columnCount = function () {
+ return self.getRows($element[0]).reduce(function (count, row) {
+ return row.cells.length > count ? row.cells.length : count;
+ }, 0);
+ };
+
+ self.getRows = function (element) {
+ return Array.prototype.filter.call(element.rows, function (row) {
+ return !row.classList.contains('ng-leave');
+ });
+ };
+
+ self.getBodyRows = function () {
+ return Array.prototype.reduce.call($element.prop('tBodies'), function (result, tbody) {
+ return result.concat(self.getRows(tbody));
+ }, []);
+ };
+
+ self.getElement = function () {
+ return $element;
+ };
+
+ self.getHeaderRows = function () {
+ return self.getRows($element.prop('tHead'));
+ };
+
+ self.enableMultiSelect = function () {
+ return $attrs.multiple === '' || $scope.$eval($attrs.multiple);
+ };
+
+ self.waitingOnPromise = function () {
+ return !!queue.length;
+ };
+
+ self.queuePromise = function (promise) {
+ if(!promise) {
+ return;
+ }
+
+ if(queue.push(angular.isArray(promise) ? $q.all(promise) : $q.when(promise)) === 1) {
+ resolvePromises();
+ }
+ };
+
+ self.registerModelChangeListener = function (listener) {
+ modelChangeListeners.push(listener);
+ };
+
+ self.removeModelChangeListener = function (listener) {
+ var index = modelChangeListeners.indexOf(listener);
+
+ if(index !== -1) {
+ modelChangeListeners.splice(index, 1);
+ }
+ };
+
+ if($attrs.hasOwnProperty('mdProgress')) {
+ $scope.$watch('$mdTable.progress', self.queuePromise);
+ }
+
+ $scope.$watch(rowSelect, function (enable) {
+ if(enable && !!validateModel()) {
+ enableRowSelection();
+ } else {
+ disableRowSelection();
+ }
+ });
+ }
+
+ Controller.$inject = ['$attrs', '$element', '$q', '$scope'];
+
+ return {
+ bindToController: true,
+ compile: compile,
+ controller: Controller,
+ controllerAs: '$mdTable',
+ restrict: 'A',
+ scope: {
+ progress: '=?mdProgress',
+ selected: '=ngModel',
+ rowSelect: '=mdRowSelect'
+ }
+ };
+}
+
+angular.module('md.data.table').directive('mdTablePagination', mdTablePagination);
+
+function mdTablePagination() {
+
+ function compile(tElement) {
+ tElement.addClass('md-table-pagination');
+ }
+
+ function Controller($attrs, $mdUtil, $scope) {
+ var self = this;
+ var defaultLabel = {
+ page: 'Page:',
+ rowsPerPage: 'Rows per page:',
+ of: 'of'
+ };
+
+ self.label = angular.copy(defaultLabel);
+
+ function isPositive(number) {
+ return parseInt(number, 10) > 0;
+ }
+
+ self.eval = function (expression) {
+ return $scope.$eval(expression);
+ };
+
+ self.first = function () {
+ self.page = 1;
+ self.onPaginationChange();
+ };
+
+ self.hasNext = function () {
+ return self.page * self.limit < self.total;
+ };
+
+ self.hasPrevious = function () {
+ return self.page > 1;
+ };
+
+ self.last = function () {
+ self.page = self.pages();
+ self.onPaginationChange();
+ };
+
+ self.max = function () {
+ return self.hasNext() ? self.page * self.limit : self.total;
+ };
+
+ self.min = function () {
+ return isPositive(self.total) ? self.page * self.limit - self.limit + 1 : 0;
+ };
+
+ self.next = function () {
+ self.page++;
+ self.onPaginationChange();
+ };
+
+ self.onPaginationChange = function () {
+ if(angular.isFunction(self.onPaginate)) {
+ $mdUtil.nextTick(function () {
+ self.onPaginate(self.page, self.limit);
+ });
+ }
+ };
+
+ self.pages = function () {
+ return isPositive(self.total) ? Math.ceil(self.total / (isPositive(self.limit) ? self.limit : 1)) : 1;
+ };
+
+ self.previous = function () {
+ self.page--;
+ self.onPaginationChange();
+ };
+
+ self.showBoundaryLinks = function () {
+ return $attrs.mdBoundaryLinks === '' || self.boundaryLinks;
+ };
+
+ self.showPageSelect = function () {
+ return $attrs.mdPageSelect === '' || self.pageSelect;
+ };
+
+ $scope.$watch('$pagination.limit', function (newValue, oldValue) {
+ if(isNaN(newValue) || isNaN(oldValue) || newValue === oldValue) {
+ return;
+ }
+
+ // find closest page from previous min
+ self.page = Math.floor(((self.page * oldValue - oldValue) + newValue) / (isPositive(newValue) ? newValue : 1));
+ self.onPaginationChange();
+ });
+
+ $attrs.$observe('mdLabel', function (label) {
+ angular.extend(self.label, defaultLabel, $scope.$eval(label));
+ });
+
+ $scope.$watch('$pagination.total', function (newValue, oldValue) {
+ if(isNaN(newValue) || newValue === oldValue) {
+ return;
+ }
+
+ if(self.page > self.pages()) {
+ self.last();
+ }
+ });
+
+ $scope.$watch('$pagination.page', function (newValue, oldValue) {
+ if(isNaN(newValue) || newValue === oldValue) {
+ return;
+ }
+ if(self.page > self.pages()) {
+ self.last();
+ }else if (self.page<=0) {
+ self.first();
+ }
+ self.onPaginationChange();
+ });
+
+ }
+
+ Controller.$inject = ['$attrs', '$mdUtil', '$scope'];
+
+ return {
+ bindToController: {
+ boundaryLinks: '=?mdBoundaryLinks',
+ disabled: '=ngDisabled',
+ limit: '=mdLimit',
+ page: '=mdPage',
+ pageSelect: '=?mdPageSelect',
+ onPaginate: '=?mdOnPaginate',
+ limitOptions: '=?mdLimitOptions',
+ total: '@mdTotal'
+ },
+ compile: compile,
+ controller: Controller,
+ controllerAs: '$pagination',
+ restrict: 'E',
+ scope: {},
+ templateUrl: 'md-table-pagination.html'
+ };
+}
+
+
+angular.module('md.data.table').directive('mdTableProgress', mdTableProgress);
+
+function mdTableProgress() {
+
+ function postLink(scope, element, attrs, tableCtrl) {
+ scope.columnCount = tableCtrl.columnCount;
+ scope.deferred = tableCtrl.waitingOnPromise;
+ }
+
+ return {
+ link: postLink,
+ require: '^^mdTable',
+ restrict: 'C',
+ scope: {},
+ templateUrl: 'md-table-progress.html'
+ };
+}
+
+angular.module('md.data.table').directive('virtualPageSelect', virtualPageSelect);
+
+function virtualPageSelect() {
+
+ function Controller($element, $scope) {
+ var self = this;
+ var content = $element.find('md-content');
+
+ self.pages = [];
+
+ function getMin(pages, total) {
+ return Math.min(pages, isFinite(total) && isPositive(total) ? total : 1);
+ }
+
+ function isPositive(number) {
+ return number > 0;
+ }
+
+ function setPages(max) {
+ if(self.pages.length > max) {
+ return self.pages.splice(max);
+ }
+
+ for(var i = self.pages.length; i < max; i++) {
+ self.pages.push(i + 1);
+ }
+ }
+
+ content.on('scroll', function () {
+ if((content.prop('clientHeight') + content.prop('scrollTop')) >= content.prop('scrollHeight')) {
+ $scope.$applyAsync(function () {
+ setPages(getMin(self.pages.length + 10, self.total));
+ });
+ }
+ });
+
+ $scope.$watch('$pageSelect.total', function (total) {
+ setPages(getMin(Math.max(self.pages.length, 10), total));
+ });
+
+ $scope.$watch('$pagination.page', function (page) {
+ for(var i = self.pages.length; i < page; i++) {
+ self.pages.push(i + 1);
+ }
+ });
+ }
+
+ Controller.$inject = ['$element', '$scope'];
+
+ return {
+ bindToController: {
+ total: '@'
+ },
+ controller: Controller,
+ controllerAs: '$pageSelect'
+ };
+}
+
})(window, angular);
\ No newline at end of file
diff --git a/dist/md-data-table.min.css b/dist/md-data-table.min.css
index 0637d00..ad191ae 100644
--- a/dist/md-data-table.min.css
+++ b/dist/md-data-table.min.css
@@ -1 +1 @@
-md-backdrop.md-edit-dialog-backdrop{z-index:80}md-edit-dialog{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:fixed;z-index:81;background-color:#f9f9f9;border-radius:2px;cursor:default}md-edit-dialog>.md-content{padding:16px 24px 0}md-edit-dialog>.md-content .md-title{color:rgba(0,0,0,.87);margin-bottom:8px}md-edit-dialog>.md-content md-input-container{margin:0;font-size:13px}md-edit-dialog>.md-content md-input-container input{float:none}md-edit-dialog>.md-content md-input-container .md-errors-spacer{min-height:auto;min-width:auto;color:rgba(0,0,0,.54)}md-edit-dialog>.md-content md-input-container .md-errors-spacer .md-char-counter{padding:5px 2px 5px 0}md-edit-dialog>.md-content md-input-container [ng-message]{padding:5px 0 5px 2px}md-edit-dialog>.md-actions{margin:0 16px 8px}md-edit-dialog>.md-actions .md-button{margin:0;min-width:initial}md-edit-dialog>.md-actions .md-button+.md-button{margin-left:8px}.md-table-pagination{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;-webkit-flex-wrap:wrap-reverse;-ms-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse;box-sizing:border-box;padding:0 24px;font-size:12px;color:rgba(0,0,0,.54);border-top:1px rgba(0,0,0,.12) solid}.md-table-pagination md-select{-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;min-width:64px}.md-table-pagination md-select:not([disabled]):focus .md-select-value{color:rgba(0,0,0,.54)}.md-table-pagination md-select .md-select-value{-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto}.md-table-pagination md-select .md-select-value span.md-select-icon{-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;margin-right:-6px!important}.md-table-pagination md-select .md-select-value span.md-select-icon:after{top:initial;-webkit-transform:scaleY(0.5) scaleX(1);transform:scaleY(0.5) scaleX(1)}.md-table-pagination>*{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:56px}.md-table-pagination>.buttons:not(:first-child),.md-table-pagination>.limit-select:not(:first-child){margin-left:32px}.md-table-pagination>.buttons{margin-right:-16px}.md-table-pagination>.buttons>.md-button.md-icon-button{margin:0}.md-table-pagination>.buttons>.label+.md-button.md-icon-button{margin-left:20px}md-select.md-table-select{margin:0}md-select.md-table-select>.md-select-value{padding:0;min-width:0;min-height:24px;border-bottom:0!important}md-select.md-table-select>.md-select-value>span{display:block;height:auto;-webkit-transform:none!important;transform:none!important}md-select.md-table-select>.md-select-value>span>.md-text{display:inherit;height:inherit;-webkit-transform:inherit;transform:inherit}md-select.md-table-select>.md-select-value>span.md-select-icon{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:24px;margin:0}md-select.md-table-select>.md-select-value>span.md-select-icon:after{top:initial}.md-select-menu-container.md-pagination-select,.md-select-menu-container.md-table-select{margin-left:-2px;border-radius:2px}.md-select-menu-container.md-pagination-select md-content,.md-select-menu-container.md-pagination-select md-select-menu,.md-select-menu-container.md-table-select md-content,.md-select-menu-container.md-table-select md-select-menu{border-radius:inherit}.md-select-menu-container.md-pagination-select md-content,.md-select-menu-container.md-table-select md-content{padding:0}.md-select-menu-container.md-table-select .md-text{font-size:13px}.md-select-menu-container.md-pagination-select .md-text{font-size:12px}md-toolbar.md-table-toolbar{box-shadow:none}md-toolbar.md-table-toolbar.md-default-theme:not(.md-menu-toolbar).md-default,md-toolbar.md-table-toolbar:not(.md-menu-toolbar).md-default{background-color:#fff;color:rgba(0,0,0,.87)}md-toolbar.md-table-toolbar.md-default-theme:not(.md-menu-toolbar).md-default .md-button,md-toolbar.md-table-toolbar:not(.md-menu-toolbar).md-default .md-button{color:rgba(0,0,0,.87)}@media only screen and (max-width:959px) and (min-width:0) and (orientation:landscape){md-toolbar.md-table-toolbar .md-toolbar-tools{height:64px;max-height:initial}}md-toolbar.md-table-toolbar .md-toolbar-tools{padding:0 24px}md-toolbar.md-table-toolbar .md-toolbar-tools md-icon{color:rgba(0,0,0,.54)}md-toolbar.md-table-toolbar .md-toolbar-tools>.md-button.md-icon-button{margin:0}md-toolbar.md-table-toolbar .md-toolbar-tools>.md-button.md-icon-button:first-child{margin-left:-12px}md-toolbar.md-table-toolbar .md-toolbar-tools>.md-button.md-icon-button:last-child{margin-right:-12px}md-card>md-table-container:first-child,md-card>md-toolbar.md-table-toolbar:first-child{border-top-left-radius:2px;border-top-right-radius:2px}md-card>md-table-container:last-child,md-card>md-toolbar.md-table-toolbar:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}md-table-container{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}table.md-table{width:100%;border-spacing:0;overflow:hidden}table.md-table thead.md-head>tr.md-row{height:56px}table.md-table tbody.md-body>tr.md-row,table.md-table tfoot.md-foot>tr.md-row{height:48px}table.md-table thead.md-head+.md-table-progress md-progress-linear{top:-3px}table.md-table .md-table-progress th{padding:0}table.md-table .md-table-progress th md-progress-linear{height:0;transition:opacity 1s}table.md-table .md-table-progress th md-progress-linear.ng-hide{opacity:0}table.md-table .md-table-progress th md-progress-linear>.md-container{height:3px;top:0;transition:none}table.md-table .md-table-progress th md-progress-linear>.md-container>.md-bar{height:3px}table.md-table th.md-column{color:rgba(0,0,0,.54);font-size:12px;font-weight:700;white-space:nowrap}table.md-table th.md-column.md-sort{cursor:pointer}table.md-table th.md-column md-icon{height:16px;width:16px;font-size:16px!important;line-height:16px!important}table.md-table th.md-column md-icon.md-sort-icon{color:rgba(0,0,0,.26);opacity:0;transition:-webkit-transform .25s,opacity .25s;transition:transform .25s,opacity .25s}table.md-table th.md-column md-icon.md-sort-icon.md-asc{-webkit-transform:rotate(0deg);transform:rotate(0deg)}table.md-table th.md-column md-icon.md-sort-icon.md-desc{-webkit-transform:rotate(180deg);transform:rotate(180deg)}table.md-table th.md-column md-icon:not(:first-child){margin-left:8px}table.md-table th.md-column md-icon:not(:last-child){margin-right:8px}table.md-table th.md-column.md-active,table.md-table th.md-column.md-active md-icon{color:rgba(0,0,0,.87)}table.md-table th.md-column.md-active md-icon.md-sort-icon,table.md-table th.md-column:hover md-icon.md-sort-icon{opacity:1}table.md-table tr.md-row[data-ng-repeat].ng-leave,table.md-table tr.md-row[ng-repeat].ng-leave,table.md-table tr.md-row[ng\:repeat].ng-leave,table.md-table tr.md-row[x-ng-repeat].ng-leave{display:none}table.md-table.md-row-select tbody.md-body>tr.md-row{transition:background-color .2s}table.md-table.md-row-select tbody.md-body>tr.md-row:not([disabled]):hover{background-color:#eee!important}table.md-table.md-row-select tbody.md-body>tr.md-row.md-selected{background-color:#f5f5f5}table.md-table.md-row-select td.md-cell:first-child,table.md-table.md-row-select th.md-column:first-child{width:20px;padding:0 0 0 24px}table.md-table.md-row-select td.md-cell:nth-child(2),table.md-table.md-row-select th.md-column:nth-child(2){padding:0 24px}table.md-table.md-row-select td.md-cell:nth-child(n+3):nth-last-child(n+2),table.md-table.md-row-select th.md-column:nth-child(n+3):nth-last-child(n+2){padding:0 56px 0 0}table.md-table:not(.md-row-select) td.md-cell:first-child,table.md-table:not(.md-row-select) th.md-column:first-child{padding:0 24px}table.md-table:not(.md-row-select) td.md-cell:nth-child(n+2):nth-last-child(n+2),table.md-table:not(.md-row-select) th.md-column:nth-child(n+2):nth-last-child(n+2){padding:0 56px 0 0}table.md-table td.md-cell,table.md-table th.md-column{vertical-align:middle;text-align:left}table.md-table td.md-cell>*,table.md-table th.md-column>*{vertical-align:middle}table.md-table td.md-cell:last-child,table.md-table th.md-column:last-child{padding:0 24px 0 0}table.md-table td.md-cell.md-clickable,table.md-table th.md-column.md-clickable{cursor:pointer}table.md-table td.md-cell.md-clickable:focus,table.md-table th.md-column.md-clickable:focus{outline:0}table.md-table td.md-cell.md-numeric,table.md-table th.md-column.md-numeric{text-align:right}table.md-table td.md-cell md-checkbox,table.md-table th.md-column md-checkbox{margin:0;width:20px}table.md-table td.md-cell{color:rgba(0,0,0,.87);font-size:13px;border-top:1px rgba(0,0,0,.12) solid}table.md-table td.md-cell.md-numeric md-select{-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end}table.md-table td.md-cell.md-numeric md-select .md-select-value{-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto}table.md-table td.md-cell.md-placeholder{color:rgba(0,0,0,.26)}table.md-table td.md-cell md-select>.md-select-value>span.md-select-icon{-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;color:rgba(0,0,0,.54);width:18px;text-align:right}table.md-table td.md-cell md-select>.md-select-value>span.md-select-icon:after{-webkit-transform:scaleY(0.4) scaleX(0.8);transform:scaleY(0.4) scaleX(0.8)}
\ No newline at end of file
+md-backdrop.md-edit-dialog-backdrop{z-index:80}md-edit-dialog{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:fixed;z-index:81;background-color:#f9f9f9;border-radius:2px;cursor:default}md-edit-dialog>.md-content{padding:16px 24px 0}md-edit-dialog>.md-content .md-title{color:rgba(0,0,0,.87);margin-bottom:8px}md-edit-dialog>.md-content md-input-container{margin:0;font-size:13px}md-edit-dialog>.md-content md-input-container input{float:none}md-edit-dialog>.md-content md-input-container .md-errors-spacer{min-height:auto;min-width:auto;color:rgba(0,0,0,.54)}md-edit-dialog>.md-content md-input-container .md-errors-spacer .md-char-counter{padding:5px 2px 5px 0}md-edit-dialog>.md-content md-input-container [ng-message]{padding:5px 0 5px 2px}md-edit-dialog>.md-actions{margin:0 16px 8px}md-edit-dialog>.md-actions .md-button{margin:0;min-width:initial}md-edit-dialog>.md-actions .md-button+.md-button{margin-left:8px}.md-table-pagination{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse;box-sizing:border-box;padding:0 24px;font-size:12px;color:rgba(0,0,0,.54);border-top:1px rgba(0,0,0,.12) solid}.md-table-pagination md-select{-ms-flex-pack:end;justify-content:flex-end;min-width:64px}.md-table-pagination md-select:not([disabled]):focus .md-select-value{color:rgba(0,0,0,.54)}.md-table-pagination md-select .md-select-value{-ms-flex:0 0 auto;flex:0 0 auto}.md-table-pagination md-select .md-select-value span.md-select-icon{-ms-flex-pack:center;justify-content:center;text-align:center;margin-right:-6px!important}.md-table-pagination md-select .md-select-value span.md-select-icon:after{top:initial;transform:scaleY(0.5) scaleX(1)}.md-table-pagination>*{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:56px}.md-table-pagination>.buttons:not(:first-child),.md-table-pagination>.limit-select:not(:first-child){margin-left:32px}.md-table-pagination>.buttons{margin-right:-16px}.md-table-pagination>.buttons>.md-button.md-icon-button{margin:0}.md-table-pagination>.buttons>.label+.md-button.md-icon-button{margin-left:20px}md-select.md-table-select{margin:0}md-select.md-table-select>.md-select-value{padding:0;min-width:0;min-height:24px;border-bottom:0!important}md-select.md-table-select>.md-select-value>span{display:block;height:auto;transform:none!important}md-select.md-table-select>.md-select-value>span>.md-text{display:inherit;height:inherit;transform:inherit}md-select.md-table-select>.md-select-value>span.md-select-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:24px;margin:0}md-select.md-table-select>.md-select-value>span.md-select-icon:after{top:initial}.md-select-menu-container.md-pagination-select,.md-select-menu-container.md-table-select{margin-left:-2px;border-radius:2px}.md-select-menu-container.md-pagination-select md-content,.md-select-menu-container.md-pagination-select md-select-menu,.md-select-menu-container.md-table-select md-content,.md-select-menu-container.md-table-select md-select-menu{border-radius:inherit}.md-select-menu-container.md-pagination-select md-content,.md-select-menu-container.md-table-select md-content{padding:0}.md-select-menu-container.md-table-select .md-text{font-size:13px}.md-select-menu-container.md-pagination-select .md-text{font-size:12px}md-toolbar.md-table-toolbar{box-shadow:none}md-toolbar.md-table-toolbar.md-default-theme:not(.md-menu-toolbar).md-default,md-toolbar.md-table-toolbar:not(.md-menu-toolbar).md-default{background-color:#fff;color:rgba(0,0,0,.87)}md-toolbar.md-table-toolbar.md-default-theme:not(.md-menu-toolbar).md-default .md-button,md-toolbar.md-table-toolbar:not(.md-menu-toolbar).md-default .md-button{color:rgba(0,0,0,.87)}@media only screen and (max-width:959px) and (min-width:0) and (orientation:landscape){md-toolbar.md-table-toolbar .md-toolbar-tools{height:64px;max-height:initial}}md-toolbar.md-table-toolbar .md-toolbar-tools{padding:0 24px}md-toolbar.md-table-toolbar .md-toolbar-tools md-icon{color:rgba(0,0,0,.54)}md-toolbar.md-table-toolbar .md-toolbar-tools>.md-button.md-icon-button{margin:0}md-toolbar.md-table-toolbar .md-toolbar-tools>.md-button.md-icon-button:first-child{margin-left:-12px}md-toolbar.md-table-toolbar .md-toolbar-tools>.md-button.md-icon-button:last-child{margin-right:-12px}md-card>md-table-container:first-child,md-card>md-toolbar.md-table-toolbar:first-child{border-top-left-radius:2px;border-top-right-radius:2px}md-card>md-table-container:last-child,md-card>md-toolbar.md-table-toolbar:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}md-table-container{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}table.md-table{width:100%;border-spacing:0;overflow:hidden}table.md-table thead.md-head>tr.md-row{height:56px}table.md-table tbody.md-body>tr.md-row,table.md-table tfoot.md-foot>tr.md-row{height:48px}table.md-table thead.md-head+.md-table-progress md-progress-linear{top:-3px}table.md-table .md-table-progress th{padding:0}table.md-table .md-table-progress th md-progress-linear{height:0;transition:opacity 1s}table.md-table .md-table-progress th md-progress-linear.ng-hide{opacity:0}table.md-table .md-table-progress th md-progress-linear>.md-container{height:3px;top:0;transition:none}table.md-table .md-table-progress th md-progress-linear>.md-container>.md-bar{height:3px}table.md-table th.md-column{color:rgba(0,0,0,.54);font-size:12px;font-weight:700;white-space:nowrap}table.md-table th.md-column.md-sort{cursor:pointer}table.md-table th.md-column md-icon{height:16px;width:16px;font-size:16px!important;line-height:16px!important}table.md-table th.md-column md-icon.md-sort-icon{color:rgba(0,0,0,.26);opacity:0;transition:transform .25s,opacity .25s}table.md-table th.md-column md-icon.md-sort-icon.md-asc{transform:rotate(0deg)}table.md-table th.md-column md-icon.md-sort-icon.md-desc{transform:rotate(180deg)}table.md-table th.md-column md-icon:not(:first-child){margin-left:8px}table.md-table th.md-column md-icon:not(:last-child){margin-right:8px}table.md-table th.md-column.md-active,table.md-table th.md-column.md-active md-icon{color:rgba(0,0,0,.87)}table.md-table th.md-column.md-active md-icon.md-sort-icon,table.md-table th.md-column:hover md-icon.md-sort-icon{opacity:1}table.md-table tr.md-row[data-ng-repeat].ng-leave,table.md-table tr.md-row[ng-repeat].ng-leave,table.md-table tr.md-row[ng\:repeat].ng-leave,table.md-table tr.md-row[x-ng-repeat].ng-leave{display:none}table.md-table.md-row-select tbody.md-body>tr.md-row{transition:background-color .2s}table.md-table.md-row-select tbody.md-body>tr.md-row:not([disabled]):hover{background-color:#eee!important}table.md-table.md-row-select tbody.md-body>tr.md-row.md-selected{background-color:#f5f5f5}table.md-table.md-row-select td.md-cell:first-child,table.md-table.md-row-select th.md-column:first-child{width:20px;padding:0 0 0 24px}table.md-table.md-row-select td.md-cell:nth-child(2),table.md-table.md-row-select th.md-column:nth-child(2){padding:0 24px}table.md-table.md-row-select td.md-cell:nth-child(n+3):nth-last-child(n+2),table.md-table.md-row-select th.md-column:nth-child(n+3):nth-last-child(n+2){padding:0 56px 0 0}table.md-table:not(.md-row-select) td.md-cell:first-child,table.md-table:not(.md-row-select) th.md-column:first-child{padding:0 24px}table.md-table:not(.md-row-select) td.md-cell:nth-child(n+2):nth-last-child(n+2),table.md-table:not(.md-row-select) th.md-column:nth-child(n+2):nth-last-child(n+2){padding:0 56px 0 0}table.md-table td.md-cell,table.md-table th.md-column{vertical-align:middle;text-align:left}table.md-table td.md-cell>*,table.md-table th.md-column>*{vertical-align:middle}table.md-table td.md-cell:last-child,table.md-table th.md-column:last-child{padding:0 24px 0 0}table.md-table td.md-cell.md-clickable,table.md-table th.md-column.md-clickable{cursor:pointer}table.md-table td.md-cell.md-clickable:focus,table.md-table th.md-column.md-clickable:focus{outline:0}table.md-table td.md-cell.md-numeric,table.md-table th.md-column.md-numeric{text-align:right}table.md-table td.md-cell md-checkbox,table.md-table th.md-column md-checkbox{margin:0;width:20px}table.md-table td.md-cell{color:rgba(0,0,0,.87);font-size:13px;border-top:1px rgba(0,0,0,.12) solid}table.md-table td.md-cell.md-numeric md-select{-ms-flex-pack:end;justify-content:flex-end}table.md-table td.md-cell.md-numeric md-select .md-select-value{-ms-flex:0 0 auto;flex:0 0 auto}table.md-table td.md-cell.md-placeholder{color:rgba(0,0,0,.26)}table.md-table td.md-cell md-select>.md-select-value>span.md-select-icon{-ms-flex-pack:end;justify-content:flex-end;color:rgba(0,0,0,.54);width:18px;text-align:right}table.md-table td.md-cell md-select>.md-select-value>span.md-select-icon:after{transform:scaleY(0.4) scaleX(0.8)}
\ No newline at end of file
diff --git a/dist/md-data-table.min.js b/dist/md-data-table.min.js
index b26ca9e..276bb0e 100644
--- a/dist/md-data-table.min.js
+++ b/dist/md-data-table.min.js
@@ -1 +1 @@
-!function(a,b,c){"use strict";function d(){function a(a){a.addClass("md-body")}return{compile:a,restrict:"A"}}function e(){function a(a){var b=a.find("md-select");return b.length&&b.addClass("md-table-select").attr("md-container-class","md-table-select"),a.addClass("md-cell"),c}function b(){}function c(a,b,c,d){function e(){return i.$$columns[f()]}function f(){return Array.prototype.indexOf.call(b.parent().children(),b[0])}var g=b.find("md-select"),h=d.shift(),i=d.shift();c.ngClick&&b.addClass("md-clickable"),g.length&&(g.on("click",function(a){a.stopPropagation()}),b.addClass("md-clickable").on("click",function(a){a.stopPropagation(),g[0].click()})),h.getTable=i.getElement,a.$watch(e,function(a){a&&(a.numeric?b.addClass("md-numeric"):b.removeClass("md-numeric"))})}return{controller:b,compile:a,require:["mdCell","^^mdTable"],restrict:"A"}}function f(a,c){function d(a){return a.addClass("md-column"),e}function e(d,e,f,g){function h(){var c=b.element('');a(c.addClass("md-sort-icon").attr("ng-class","getDirection()"))(d),e.hasClass("md-numeric")?e.prepend(c):e.append(c)}function i(){Array.prototype.some.call(e.find("md-icon"),function(a){return a.classList.contains("md-sort-icon")&&e[0].removeChild(a)})}function j(){i(),e.removeClass("md-sort").off("click",o)}function k(){h(),e.addClass("md-sort").on("click",o)}function l(){return Array.prototype.indexOf.call(e.parent().children(),e[0])}function m(){return d.orderBy&&(q.order===d.orderBy||q.order==="-"+d.orderBy)}function n(){return""===f.mdNumeric||d.numeric}function o(){d.$applyAsync(function(){m()?q.order="md-asc"===d.getDirection()?"-"+d.orderBy:d.orderBy:q.order="md-asc"===d.getDirection()?d.orderBy:"-"+d.orderBy,b.isFunction(q.onReorder)&&c.nextTick(function(){q.onReorder(q.order)})})}function p(a,b){r.$$columns[a]=b,b.numeric?e.addClass("md-numeric"):e.removeClass("md-numeric")}var q=g.shift(),r=g.shift();d.getDirection=function(){return m()?"-"===q.order.charAt(0)?"md-desc":"md-asc":""===f.mdDesc||d.$eval(f.mdDesc)?"md-desc":"md-asc"},d.$watch(m,function(a){a?e.addClass("md-active"):e.removeClass("md-active")}),d.$watch(l,function(a){p(a,{numeric:n()})}),d.$watch(n,function(a){p(l(),{numeric:a})}),d.$watch("orderBy",function(a){a?e.hasClass("md-sort")||k():e.hasClass("md-sort")&&j()})}return{compile:d,require:["^^mdHead","^^mdTable"],restrict:"A",scope:{numeric:"=?mdNumeric",orderBy:"@?mdOrderBy"}}}function g(a){return function(c,d,e,f){if(e&&"object"==typeof e){var g=a(c,d,!0,f);return b.extend(g.instance,e),g()}return a(c,d,e,f)}}function h(a,c,d,e,f,g,h,i,j){function k(c,d){var f,h=g.$new(),i=a(c)(h),j=e.createBackdrop(h,"md-edit-dialog-backdrop");return d.controller?f=m(d,h,{$element:i,$scope:h}):b.extend(h,d.scope),d.disableScroll&&l(i),v.prepend(j).append(i.addClass("md-whiteframe-1dp")),r(i,d.target),d.focusOnOpen&&q(i),d.clickOutsideToClose&&j.on("click",function(){i.remove()}),d.escToClose&&p(i),i.on("$destroy",function(){u=!1,j.remove()}),f}function l(a){var b=e.disableScrollAround(a,v);a.on("$destroy",function(){b()})}function m(a,d,e){return a.controller?(a.resolve&&b.extend(e,a.resolve),a.locals&&b.extend(e,a.locals),a.controllerAs?(d[a.controllerAs]={},a.bindToController?b.extend(d[a.controllerAs],a.scope):b.extend(d,a.scope)):b.extend(d,a.scope),a.bindToController?c(a.controller,e,d[a.controllerAs]):c(a.controller,e)):void 0}function n(a){return f(function(c,d){function e(a){d("Unexpected template value. Expected a string; received a "+a+".")}var f=a.template;if(f)return b.isString(f)?c(f):e(typeof f);if(a.templateUrl){if(f=h.get(a.templateUrl))return c(f);var g=function(a){return c(a)},j=function(){return d("Error retrieving template from URL.")};return i(a.templateUrl).then(g,j)}d("Template not provided.")})}function o(a){u=!1,console.error(a)}function p(a){var b=function(b){b.keyCode===t&&a.remove()};v.on("keyup",b),a.on("$destroy",function(){v.off("keyup",b)})}function q(a){e.nextTick(function(){var b=e.findFocusTarget(a);b&&b.focus()},!1)}function r(a,c){var d=b.element(c).controller("mdCell").getTable(),e=function(){return a.prop("clientHeight")},f=function(){return{width:i(),height:e()}},h=function(){var a=d.parent();return"MD-TABLE-CONTAINER"===a.prop("tagName")?a[0].getBoundingClientRect():d[0].getBoundingClientRect()},i=function(){return a.prop("clientWidth")},k=function(){var b=f(),d=c.getBoundingClientRect(),e=h();b.width>e.right-d.left?a.css("left",e.right-b.width+"px"):a.css("left",d.left+"px"),b.height>e.bottom-d.top?a.css("top",e.bottom-b.height+"px"):a.css("top",d.top+1+"px"),a.css("minWidth",d.width+"px")},l=g.$watch(i,k),m=g.$watch(e,k);j.addEventListener("resize",k),a.on("$destroy",function(){l(),m(),j.removeEventListener("resize",k)})}function s(a,c){function d(){var a='type="'+(c.type||"text")+'"';for(var b in c.validators)a+=" "+b+'="'+c.validators[b]+'"';return a}return{controller:["$element","$q","save","$scope",function(a,c,d,e){function f(){return e.editDialog.$invalid?c.reject():b.isFunction(d)?c.when(d(e.editDialog.input)):c.resolve()}this.dismiss=function(){a.remove()},this.getInput=function(){return e.editDialog.input},e.dismiss=this.dismiss,e.submit=function(){f().then(function(){e.dismiss()})}}],locals:{save:c.save},scope:{cancel:c.cancel||"Cancel",messages:c.messages,model:c.modelValue,ok:c.ok||"Save",placeholder:c.placeholder,title:c.title,size:a},template:'{{cancel}} {{ok}}
'}}var t=27,u=!1,v=b.element(d.prop("body")),w={clickOutsideToClose:!0,disableScroll:!0,escToClose:!0,focusOnOpen:!0};return this.show=function(a){if(u)return f.reject();if(u=!0,a=b.extend({},w,a),!a.targetEvent)return o("options.targetEvent is required to align the dialog with the table cell.");if(!a.targetEvent.currentTarget.classList.contains("md-cell"))return o("The event target must be a table cell.");if(a.bindToController&&!a.controllerAs)return o("You must define options.controllerAs when options.bindToController is true.");a.target=a.targetEvent.currentTarget;var c=n(a),d=[c];for(var e in a.resolve)c=a.resolve[e],d.push(f.when(b.isFunction(c)?c():c));return c=f.all(d),c["catch"](o),c.then(function(b){var c=b.shift();for(var d in a.resolve)a.resolve[d]=b.shift();return k(c,a)})},this.small=function(a){return this.show(b.extend({},a,s("small",a)))}.bind(this),this.large=function(a){return this.show(b.extend({},a,s("large",a)))}.bind(this),this}function i(){function a(a){a.addClass("md-foot")}return{compile:a,restrict:"A"}}function j(a){function c(a){return a.addClass("md-head"),e}function d(){}function e(c,d,e,f){function g(){d.children().prepend('')}function h(){d.prop("lastElementChild").firstElementChild.appendChild(a(i())(c)[0])}function i(){return b.element("").attr({"aria-label":"Select All","ng-click":"toggleAll()","ng-checked":"allSelected()","ng-disabled":"!getSelectableRows().length"})}function j(){var a=d.prop("lastElementChild").firstElementChild;a.classList.contains("md-checkbox-column")&&b.element(a).empty()}function k(){return f.$$rowSelect}function l(a){return b.element(a).controller("mdSelect")}function m(){Array.prototype.some.call(d.find("th"),function(a){return a.classList.contains("md-checkbox-column")&&a.remove()})}var n=new Array(2);c.allSelected=function(){var a=c.getSelectableRows();return a.length&&a.every(function(a){return a.isSelected()})},c.getSelectableRows=function(){return f.getBodyRows().map(l).filter(function(a){return a&&!a.disabled})},c.selectAll=function(){f.getBodyRows().map(l).forEach(function(a){a&&!a.isSelected()&&a.select()})},c.toggleAll=function(){return c.allSelected()?c.unSelectAll():c.selectAll()},c.unSelectAll=function(){f.getBodyRows().map(l).forEach(function(a){a&&a.isSelected()&&a.deselect()})},c.$watchGroup([k,f.enableMultiSelect],function(a){a[0]!==n[0]?a[0]?(g(),a[1]&&h()):m():a[0]&&a[1]!==n[1]&&(a[1]?h():j()),b.copy(a,n)})}return{bindToController:!0,compile:c,controller:d,controllerAs:"$mdHead",require:"^^mdTable",restrict:"A",scope:{order:"=?mdOrder",onReorder:"=?mdOnReorder"}}}function k(){function a(a){return a.addClass("md-row"),c}function c(a,c,d,e){function f(){return e.$$rowSelect}function g(){return-1!==e.getBodyRows().indexOf(c[0])}function h(a){return c[0].contains(a[0])}if(g()){var i=b.element('');a.$watch(f,function(a){return a&&!d.mdSelect?void(h(i)||c.prepend(i)):void(h(i)&&i.remove())})}}return{compile:a,require:"^^mdTable",restrict:"A"}}function l(a,c){function d(){}function e(d,e,f,g){function h(){return""===f.mdAutoSelect||o.autoSelect}function i(){var c=b.element("").attr({"aria-label":"Select Row","ng-click":"$mdSelect.toggle($event)","ng-checked":"$mdSelect.isSelected()","ng-disabled":"$mdSelect.disabled"});return b.element('').append(a(c)(d))}function j(){Array.prototype.some.call(e.children(),function(a){return a.classList.contains("md-checkbox-cell")&&e[0].removeChild(a)}),h()&&e.off("click",n)}function k(){e.prepend(i()),h()&&e.on("click",n)}function l(){return p.$$rowSelect}function m(a){return o.id?p.$$hash.has(o.id)?void(-1===a.indexOf(p.$$hash.get(o.id))&&p.$$hash.purge(o.id)):void(-1!==a.indexOf(o.model)&&p.$$hash.update(o.id,o.model)):void 0}function n(a){d.$applyAsync(function(){o.toggle(a)})}var o=g.shift(),p=g.shift(),q=c(f.mdSelectId);if(o.id=q(o.model),p.$$rowSelect&&o.id)if(p.$$hash.has(o.id)){var r=p.selected.indexOf(p.$$hash.get(o.id));-1===r?p.$$hash.purge(o.id):p.$$hash.equals(o.id,o.model)||(p.$$hash.update(o.id,o.model),p.selected.splice(r,1,o.model))}else p.selected.some(function(a,b){return q(a)===o.id?(p.$$hash.update(o.id,o.model),p.selected.splice(b,1,o.model),!0):void 0});o.isSelected=function(){return p.$$rowSelect?o.id?p.$$hash.has(o.id):-1!==p.selected.indexOf(o.model):!1},o.select=function(){o.disabled||(p.enableMultiSelect()?p.selected.push(o.model):p.selected.splice(0,p.selected.length,o.model),b.isFunction(o.onSelect)&&o.onSelect(o.model))},o.deselect=function(){o.disabled||(p.selected.splice(p.selected.indexOf(o.model),1),b.isFunction(o.onDeselect)&&o.onDeselect(o.model))},o.toggle=function(a){return a&&a.stopPropagation&&a.stopPropagation(),o.isSelected()?o.deselect():o.select()},d.$watch(l,function(a){a?k():j()}),d.$watch(h,function(a,b){a!==b&&(p.$$rowSelect&&a?e.on("click",n):e.off("click",n))}),d.$watch(o.isSelected,function(a){return a?e.addClass("md-selected"):e.removeClass("md-selected")}),d.$watch(p.enableMultiSelect,function(a){p.$$rowSelect&&!a&&p.selected.splice(1)}),p.registerModelChangeListener(m),e.on("$destroy",function(){p.removeModelChangeListener(m)})}return{bindToController:!0,controller:d,controllerAs:"$mdSelect",link:e,require:["mdSelect","^^mdTable"],restrict:"A",scope:{model:"=mdSelect",disabled:"=ngDisabled",onSelect:"=?mdOnSelect",onDeselect:"=?mdOnDeselect",autoSelect:"=mdAutoSelect"}}}function m(){var a={};this.equals=function(b,c){return a[b]===c},this.get=function(b){return a[b]},this.has=function(b){return a.hasOwnProperty(b)},this.purge=function(b){delete a[b]},this.update=function(b,c){a[b]=c}}function n(){function a(a,c){if(a.addClass("md-table"),c.hasOwnProperty("mdProgress")){var d=a.find("tbody")[0],e=b.element('');d&&a[0].insertBefore(e[0],d)}}function c(a,c,d,e){function f(){l.$$rowSelect=!0,k=e.$watchCollection("$mdTable.selected",function(a){o.forEach(function(b){b(a)})}),c.addClass("md-row-select")}function g(){l.$$rowSelect=!1,b.isFunction(k)&&k(),c.removeClass("md-row-select")}function h(){return n.length?void n[0]["finally"](function(){n.shift(),h()}):e.$applyAsync()}function i(){return""===a.mdRowSelect||l.rowSelect}function j(){return l.selected?b.isArray(l.selected)?!0:console.error("Row selection: Expected an array. Recived "+typeof l.selected+"."):console.error("Row selection: ngModel is not defined.")}var k,l=this,n=[],o=[];l.$$hash=new m,l.$$columns={},l.columnCount=function(){return l.getRows(c[0]).reduce(function(a,b){return b.cells.length>a?b.cells.length:a},0)},l.getRows=function(a){return Array.prototype.filter.call(a.rows,function(a){return!a.classList.contains("ng-leave")})},l.getBodyRows=function(){return Array.prototype.reduce.call(c.prop("tBodies"),function(a,b){return a.concat(l.getRows(b))},[])},l.getElement=function(){return c},l.getHeaderRows=function(){return l.getRows(c.prop("tHead"))},l.enableMultiSelect=function(){return""===a.multiple||e.$eval(a.multiple)},l.waitingOnPromise=function(){return!!n.length},l.queuePromise=function(a){a&&1===n.push(b.isArray(a)?d.all(a):d.when(a))&&h()},l.registerModelChangeListener=function(a){o.push(a)},l.removeModelChangeListener=function(a){var b=o.indexOf(a);-1!==b&&o.splice(b,1)},a.hasOwnProperty("mdProgress")&&e.$watch("$mdTable.progress",l.queuePromise),e.$watch(i,function(a){a&&j()?f():g()})}return c.$inject=["$attrs","$element","$q","$scope"],{bindToController:!0,compile:a,controller:c,controllerAs:"$mdTable",restrict:"A",scope:{progress:"=?mdProgress",selected:"=ngModel",rowSelect:"=mdRowSelect"}}}function o(){function a(a){a.addClass("md-table-pagination")}function c(a,c,d){function e(a){return parseInt(a,10)>0}var f=this,g={page:"Page:",rowsPerPage:"Rows per page:",of:"of"};f.label=b.copy(g),f.eval=function(a){return d.$eval(a)},f.first=function(){f.page=1,f.onPaginationChange()},f.hasNext=function(){return f.page*f.limit1},f.last=function(){f.page=f.pages(),f.onPaginationChange()},f.max=function(){return f.hasNext()?f.page*f.limit:f.total},f.min=function(){return e(f.total)?f.page*f.limit-f.limit+1:0},f.next=function(){f.page++,f.onPaginationChange()},f.onPaginationChange=function(){b.isFunction(f.onPaginate)&&c.nextTick(function(){f.onPaginate(f.page,f.limit)})},f.pages=function(){return e(f.total)?Math.ceil(f.total/(e(f.limit)?f.limit:1)):1},f.previous=function(){f.page--,f.onPaginationChange()},f.showBoundaryLinks=function(){return""===a.mdBoundaryLinks||f.boundaryLinks},f.showPageSelect=function(){return""===a.mdPageSelect||f.pageSelect},d.$watch("$pagination.limit",function(a,b){isNaN(a)||isNaN(b)||a===b||(f.page=Math.floor((f.page*b-b+a)/(e(a)?a:1)),f.onPaginationChange())}),a.$observe("mdLabel",function(a){b.extend(f.label,g,d.$eval(a))}),d.$watch("$pagination.total",function(a,b){isNaN(a)||a===b||f.page>f.pages()&&f.last()})}return c.$inject=["$attrs","$mdUtil","$scope"],{bindToController:{boundaryLinks:"=?mdBoundaryLinks",disabled:"=ngDisabled",limit:"=mdLimit",page:"=mdPage",pageSelect:"=?mdPageSelect",onPaginate:"=?mdOnPaginate",limitOptions:"=?mdLimitOptions",total:"@mdTotal"},compile:a,controller:c,controllerAs:"$pagination",restrict:"E",scope:{},templateUrl:"md-table-pagination.html"}}function p(){function a(a,b,c,d){a.columnCount=d.columnCount,a.deferred=d.waitingOnPromise}return{link:a,require:"^^mdTable",restrict:"C",scope:{},templateUrl:"md-table-progress.html"}}function q(){function a(a,b){function c(a,b){return Math.min(a,isFinite(b)&&d(b)?b:1)}function d(a){return a>0}function e(a){if(f.pages.length>a)return f.pages.splice(a);for(var b=f.pages.length;a>b;b++)f.pages.push(b+1)}var f=this,g=a.find("md-content");f.pages=[],g.on("scroll",function(){g.prop("clientHeight")+g.prop("scrollTop")>=g.prop("scrollHeight")&&b.$applyAsync(function(){e(c(f.pages.length+10,f.total))})}),b.$watch("$pageSelect.total",function(a){e(c(Math.max(f.pages.length,10),a))}),b.$watch("$pagination.page",function(a){for(var b=f.pages.length;a>b;b++)f.pages.push(b+1)})}return a.$inject=["$element","$scope"],{bindToController:{total:"@"},controller:a,controllerAs:"$pageSelect"}}b.module("md.table.templates",["md-table-pagination.html","md-table-progress.html","arrow-up.svg","navigate-before.svg","navigate-first.svg","navigate-last.svg","navigate-next.svg"]),b.module("md-table-pagination.html",[]).run(["$templateCache",function(a){a.put("md-table-pagination.html",'\n
{{$pagination.label.page}}
\n\n
\n \n {{page}} \n \n \n
\n\n\n
{{$pagination.label.rowsPerPage}}
\n\n
\n {{::option.label ? option.label : option}} \n \n
\n\n')}]),b.module("md-table-progress.html",[]).run(["$templateCache",function(a){a.put("md-table-progress.html",'\n \n \n \n ')}]),b.module("arrow-up.svg",[]).run(["$templateCache",function(a){a.put("arrow-up.svg",' ')}]),b.module("navigate-before.svg",[]).run(["$templateCache",function(a){a.put("navigate-before.svg",' ')}]),b.module("navigate-first.svg",[]).run(["$templateCache",function(a){a.put("navigate-first.svg",' ')}]),b.module("navigate-last.svg",[]).run(["$templateCache",function(a){a.put("navigate-last.svg",' ')}]),b.module("navigate-next.svg",[]).run(["$templateCache",function(a){a.put("navigate-next.svg",' ')}]),b.module("md.data.table",["md.table.templates"]),b.module("md.data.table").directive("mdBody",d),b.module("md.data.table").directive("mdCell",e),b.module("md.data.table").directive("mdColumn",f),f.$inject=["$compile","$mdUtil"],b.module("md.data.table").decorator("$controller",g).factory("$mdEditDialog",h),g.$inject=["$delegate"],h.$inject=["$compile","$controller","$document","$mdUtil","$q","$rootScope","$templateCache","$templateRequest","$window"],b.module("md.data.table").directive("mdFoot",i),b.module("md.data.table").directive("mdHead",j),j.$inject=["$compile"],b.module("md.data.table").directive("mdRow",k),b.module("md.data.table").directive("mdSelect",l),l.$inject=["$compile","$parse"],b.module("md.data.table").directive("mdTable",n),b.module("md.data.table").directive("mdTablePagination",o),b.module("md.data.table").directive("mdTableProgress",p),b.module("md.data.table").directive("virtualPageSelect",q)}(window,angular);
\ No newline at end of file
+!function(a,b,c){"use strict";function d(){function a(a){a.addClass("md-body")}return{compile:a,restrict:"A"}}function e(){function a(a){var b=a.find("md-select");return b.length&&b.addClass("md-table-select").attr("md-container-class","md-table-select"),a.addClass("md-cell"),c}function b(){}function c(a,b,c,d){function e(){return i.$$columns[f()]}function f(){return Array.prototype.indexOf.call(b.parent().children(),b[0])}var g=b.find("md-select"),h=d.shift(),i=d.shift();c.ngClick&&b.addClass("md-clickable"),g.length&&(g.on("click",function(a){a.stopPropagation()}),b.addClass("md-clickable").on("click",function(a){a.stopPropagation(),g[0].click()})),h.getTable=i.getElement,a.$watch(e,function(a){a&&(a.numeric?b.addClass("md-numeric"):b.removeClass("md-numeric"))})}return{controller:b,compile:a,require:["mdCell","^^mdTable"],restrict:"A"}}function f(a,c){function d(a){return a.addClass("md-column"),e}function e(d,e,f,g){function h(){var c=b.element('');a(c.addClass("md-sort-icon").attr("ng-class","getDirection()"))(d),e.hasClass("md-numeric")?e.prepend(c):e.append(c)}function i(){Array.prototype.some.call(e.find("md-icon"),function(a){return a.classList.contains("md-sort-icon")&&e[0].removeChild(a)})}function j(){i(),e.removeClass("md-sort").off("click",o)}function k(){h(),e.addClass("md-sort").on("click",o)}function l(){return Array.prototype.indexOf.call(e.parent().children(),e[0])}function m(){return d.orderBy&&(q.order===d.orderBy||q.order==="-"+d.orderBy)}function n(){return""===f.mdNumeric||d.numeric}function o(){d.$applyAsync(function(){m()?q.order="md-asc"===d.getDirection()?"-"+d.orderBy:d.orderBy:q.order="md-asc"===d.getDirection()?d.orderBy:"-"+d.orderBy,b.isFunction(q.onReorder)&&c.nextTick(function(){q.onReorder(q.order)})})}function p(a,b){r.$$columns[a]=b,b.numeric?e.addClass("md-numeric"):e.removeClass("md-numeric")}var q=g.shift(),r=g.shift();d.getDirection=function(){return m()?"-"===q.order.charAt(0)?"md-desc":"md-asc":""===f.mdDesc||d.$eval(f.mdDesc)?"md-desc":"md-asc"},d.$watch(m,function(a){a?e.addClass("md-active"):e.removeClass("md-active")}),d.$watch(l,function(a){p(a,{numeric:n()})}),d.$watch(n,function(a){p(l(),{numeric:a})}),d.$watch("orderBy",function(a){a?e.hasClass("md-sort")||k():e.hasClass("md-sort")&&j()})}return{compile:d,require:["^^mdHead","^^mdTable"],restrict:"A",scope:{numeric:"=?mdNumeric",orderBy:"@?mdOrderBy"}}}function g(a){return function(c,d,e,f){if(e&&"object"==typeof e){var g=a(c,d,!0,f);return b.extend(g.instance,e),g()}return a(c,d,e,f)}}function h(a,c,d,e,f,g,h,i,j){function k(c,d){var f,h=g.$new(),i=a(c)(h),j=e.createBackdrop(h,"md-edit-dialog-backdrop");return d.controller?f=m(d,h,{$element:i,$scope:h}):b.extend(h,d.scope),d.disableScroll&&l(i),v.prepend(j).append(i.addClass("md-whiteframe-1dp")),r(i,d.target),d.focusOnOpen&&q(i),d.clickOutsideToClose&&j.on("click",function(){i.remove()}),d.escToClose&&p(i),i.on("$destroy",function(){u=!1,j.remove()}),f}function l(a){var b=e.disableScrollAround(a,v);a.on("$destroy",function(){b()})}function m(a,d,e){if(a.controller)return a.resolve&&b.extend(e,a.resolve),a.locals&&b.extend(e,a.locals),a.controllerAs?(d[a.controllerAs]={},a.bindToController?b.extend(d[a.controllerAs],a.scope):b.extend(d,a.scope)):b.extend(d,a.scope),a.bindToController?c(a.controller,e,d[a.controllerAs]):c(a.controller,e)}function n(a){return f(function(c,d){function e(a){d("Unexpected template value. Expected a string; received a "+a+".")}var f=a.template;if(f)return b.isString(f)?c(f):e(typeof f);if(a.templateUrl){if(f=h.get(a.templateUrl))return c(f);var g=function(a){return c(a)},j=function(){return d("Error retrieving template from URL.")};return i(a.templateUrl).then(g,j)}d("Template not provided.")})}function o(a){u=!1,console.error(a)}function p(a){var b=function(b){b.keyCode===t&&a.remove()};v.on("keyup",b),a.on("$destroy",function(){v.off("keyup",b)})}function q(a){e.nextTick(function(){var b=e.findFocusTarget(a);b&&b.focus()},!1)}function r(a,c){var d=b.element(c).controller("mdCell").getTable(),e=function(){return a.prop("clientHeight")},f=function(){return{width:i(),height:e()}},h=function(){var a=d.parent();return"MD-TABLE-CONTAINER"===a.prop("tagName")?a[0].getBoundingClientRect():d[0].getBoundingClientRect()},i=function(){return a.prop("clientWidth")},k=function(){var b=f(),d=c.getBoundingClientRect(),e=h();b.width>e.right-d.left?a.css("left",e.right-b.width+"px"):a.css("left",d.left+"px"),b.height>e.bottom-d.top?a.css("top",e.bottom-b.height+"px"):a.css("top",d.top+1+"px"),a.css("minWidth",d.width+"px")},l=g.$watch(i,k),m=g.$watch(e,k);j.addEventListener("resize",k),a.on("$destroy",function(){l(),m(),j.removeEventListener("resize",k)})}function s(a,c){function d(){var a='type="'+(c.type||"text")+'"';for(var b in c.validators)a+=" "+b+'="'+c.validators[b]+'"';return a}return{controller:["$element","$q","save","$scope",function(a,c,d,e){function f(){return e.editDialog.$invalid?c.reject():b.isFunction(d)?c.when(d(e.editDialog.input)):c.resolve()}this.dismiss=function(){a.remove()},this.getInput=function(){return e.editDialog.input},e.dismiss=this.dismiss,e.submit=function(){f().then(function(){e.dismiss()})}}],locals:{save:c.save},scope:{cancel:c.cancel||"Cancel",messages:c.messages,model:c.modelValue,ok:c.ok||"Save",placeholder:c.placeholder,title:c.title,size:a},template:'{{cancel}} {{ok}}
'}}var t=27,u=!1,v=b.element(d.prop("body")),w={clickOutsideToClose:!0,disableScroll:!0,escToClose:!0,focusOnOpen:!0};return this.show=function(a){if(u)return f.reject();if(u=!0,a=b.extend({},w,a),!a.targetEvent)return o("options.targetEvent is required to align the dialog with the table cell.");if(!a.targetEvent.currentTarget.classList.contains("md-cell"))return o("The event target must be a table cell.");if(a.bindToController&&!a.controllerAs)return o("You must define options.controllerAs when options.bindToController is true.");a.target=a.targetEvent.currentTarget;var c=n(a),d=[c];for(var e in a.resolve)c=a.resolve[e],d.push(f.when(b.isFunction(c)?c():c));return c=f.all(d),c.catch(o),c.then(function(b){var c=b.shift();for(var d in a.resolve)a.resolve[d]=b.shift();return k(c,a)})},this.small=function(a){return this.show(b.extend({},a,s("small",a)))}.bind(this),this.large=function(a){return this.show(b.extend({},a,s("large",a)))}.bind(this),this}function i(){function a(a){a.addClass("md-foot")}return{compile:a,restrict:"A"}}function j(a){function c(a){return a.addClass("md-head"),e}function d(){}function e(c,d,e,f){function g(){d.children().prepend('')}function h(){d.prop("lastElementChild").firstElementChild.appendChild(a(i())(c)[0])}function i(){return b.element("").attr({"aria-label":"Select All","ng-click":"toggleAll()","ng-checked":"allSelected()","ng-disabled":"!getSelectableRows().length"})}function j(){var a=d.prop("lastElementChild").firstElementChild;a.classList.contains("md-checkbox-column")&&b.element(a).empty()}function k(){return f.$$rowSelect}function l(a){return b.element(a).controller("mdSelect")}function m(){Array.prototype.some.call(d.find("th"),function(a){return a.classList.contains("md-checkbox-column")&&a.remove()})}var n=new Array(2);c.allSelected=function(){var a=c.getSelectableRows();return a.length&&a.every(function(a){return a.isSelected()})},c.getSelectableRows=function(){return f.getBodyRows().map(l).filter(function(a){return a&&!a.disabled})},c.selectAll=function(){f.getBodyRows().map(l).forEach(function(a){a&&!a.isSelected()&&a.select()})},c.toggleAll=function(){return c.allSelected()?c.unSelectAll():c.selectAll()},c.unSelectAll=function(){f.getBodyRows().map(l).forEach(function(a){a&&a.isSelected()&&a.deselect()})},c.$watchGroup([k,f.enableMultiSelect],function(a){a[0]!==n[0]?a[0]?(g(),a[1]&&h()):m():a[0]&&a[1]!==n[1]&&(a[1]?h():j()),b.copy(a,n)})}return{bindToController:!0,compile:c,controller:d,controllerAs:"$mdHead",require:"^^mdTable",restrict:"A",scope:{order:"=?mdOrder",onReorder:"=?mdOnReorder"}}}function k(){function a(a){return a.addClass("md-row"),c}function c(a,c,d,e){function f(){return e.$$rowSelect}function g(){return e.getBodyRows().indexOf(c[0])!==-1}function h(a){return c[0].contains(a[0])}if(g()){var i=b.element('');a.$watch(f,function(a){return a&&!d.mdSelect?void(h(i)||c.prepend(i)):void(h(i)&&i.remove())})}}return{compile:a,require:"^^mdTable",restrict:"A"}}function l(a,c){function d(){}function e(d,e,f,g){function h(){return""===f.mdAutoSelect||o.autoSelect}function i(){var c=b.element("").attr({"aria-label":"Select Row","ng-click":"$mdSelect.toggle($event)","ng-checked":"$mdSelect.isSelected()","ng-disabled":"$mdSelect.disabled"});return b.element('').append(a(c)(d))}function j(){Array.prototype.some.call(e.children(),function(a){return a.classList.contains("md-checkbox-cell")&&e[0].removeChild(a)}),h()&&e.off("click",n)}function k(){e.prepend(i()),h()&&e.on("click",n)}function l(){return p.$$rowSelect}function m(a){if(o.id)return p.$$hash.has(o.id)?void(a.indexOf(p.$$hash.get(o.id))===-1&&p.$$hash.purge(o.id)):void(a.indexOf(o.model)!==-1&&p.$$hash.update(o.id,o.model))}function n(a){d.$applyAsync(function(){o.toggle(a)})}var o=g.shift(),p=g.shift(),q=c(f.mdSelectId);if(o.id=q(o.model),p.$$rowSelect&&o.id)if(p.$$hash.has(o.id)){var r=p.selected.indexOf(p.$$hash.get(o.id));r===-1?p.$$hash.purge(o.id):p.$$hash.equals(o.id,o.model)||(p.$$hash.update(o.id,o.model),p.selected.splice(r,1,o.model))}else p.selected.some(function(a,b){if(q(a)===o.id)return p.$$hash.update(o.id,o.model),p.selected.splice(b,1,o.model),!0});o.isSelected=function(){return!!p.$$rowSelect&&(o.id?p.$$hash.has(o.id):p.selected.indexOf(o.model)!==-1)},o.select=function(){o.disabled||(p.enableMultiSelect()?p.selected.push(o.model):p.selected.splice(0,p.selected.length,o.model),b.isFunction(o.onSelect)&&o.onSelect(o.model))},o.deselect=function(){o.disabled||(p.selected.splice(p.selected.indexOf(o.model),1),b.isFunction(o.onDeselect)&&o.onDeselect(o.model))},o.toggle=function(a){return a&&a.stopPropagation&&a.stopPropagation(),o.isSelected()?o.deselect():o.select()},d.$watch(l,function(a){a?k():j()}),d.$watch(h,function(a,b){a!==b&&(p.$$rowSelect&&a?e.on("click",n):e.off("click",n))}),d.$watch(o.isSelected,function(a){return a?e.addClass("md-selected"):e.removeClass("md-selected")}),d.$watch(p.enableMultiSelect,function(a){p.$$rowSelect&&!a&&p.selected.splice(1)}),p.registerModelChangeListener(m),e.on("$destroy",function(){p.removeModelChangeListener(m)})}return{bindToController:!0,controller:d,controllerAs:"$mdSelect",link:e,require:["mdSelect","^^mdTable"],restrict:"A",scope:{model:"=mdSelect",disabled:"=ngDisabled",onSelect:"=?mdOnSelect",onDeselect:"=?mdOnDeselect",autoSelect:"=mdAutoSelect"}}}function m(){var a={};this.equals=function(b,c){return a[b]===c},this.get=function(b){return a[b]},this.has=function(b){return a.hasOwnProperty(b)},this.purge=function(b){delete a[b]},this.update=function(b,c){a[b]=c}}function n(){function a(a,c){if(a.addClass("md-table"),c.hasOwnProperty("mdProgress")){var d=a.find("tbody")[0],e=b.element('');d&&a[0].insertBefore(e[0],d)}}function c(a,c,d,e){function f(){l.$$rowSelect=!0,k=e.$watchCollection("$mdTable.selected",function(a){o.forEach(function(b){b(a)})}),c.addClass("md-row-select")}function g(){l.$$rowSelect=!1,b.isFunction(k)&&k(),c.removeClass("md-row-select")}function h(){return n.length?void n[0].finally(function(){n.shift(),h()}):e.$applyAsync()}function i(){return""===a.mdRowSelect||l.rowSelect}function j(){return l.selected?!!b.isArray(l.selected)||console.error("Row selection: Expected an array. Recived "+typeof l.selected+"."):console.error("Row selection: ngModel is not defined.")}var k,l=this,n=[],o=[];l.$$hash=new m,l.$$columns={},l.columnCount=function(){return l.getRows(c[0]).reduce(function(a,b){return b.cells.length>a?b.cells.length:a},0)},l.getRows=function(a){return Array.prototype.filter.call(a.rows,function(a){return!a.classList.contains("ng-leave")})},l.getBodyRows=function(){return Array.prototype.reduce.call(c.prop("tBodies"),function(a,b){return a.concat(l.getRows(b))},[])},l.getElement=function(){return c},l.getHeaderRows=function(){return l.getRows(c.prop("tHead"))},l.enableMultiSelect=function(){return""===a.multiple||e.$eval(a.multiple)},l.waitingOnPromise=function(){return!!n.length},l.queuePromise=function(a){a&&1===n.push(b.isArray(a)?d.all(a):d.when(a))&&h()},l.registerModelChangeListener=function(a){o.push(a)},l.removeModelChangeListener=function(a){var b=o.indexOf(a);b!==-1&&o.splice(b,1)},a.hasOwnProperty("mdProgress")&&e.$watch("$mdTable.progress",l.queuePromise),e.$watch(i,function(a){a&&j()?f():g()})}return c.$inject=["$attrs","$element","$q","$scope"],{bindToController:!0,compile:a,controller:c,controllerAs:"$mdTable",restrict:"A",scope:{progress:"=?mdProgress",selected:"=ngModel",rowSelect:"=mdRowSelect"}}}function o(){function a(a){a.addClass("md-table-pagination")}function c(a,c,d){function e(a){return parseInt(a,10)>0}var f=this,g={page:"Page:",rowsPerPage:"Rows per page:",of:"of"};f.label=b.copy(g),f.eval=function(a){return d.$eval(a)},f.first=function(){f.page=1,f.onPaginationChange()},f.hasNext=function(){return f.page*f.limit1},f.last=function(){f.page=f.pages(),f.onPaginationChange()},f.max=function(){return f.hasNext()?f.page*f.limit:f.total},f.min=function(){return e(f.total)?f.page*f.limit-f.limit+1:0},f.next=function(){f.page++,f.onPaginationChange()},f.onPaginationChange=function(){b.isFunction(f.onPaginate)&&c.nextTick(function(){f.onPaginate(f.page,f.limit)})},f.pages=function(){return e(f.total)?Math.ceil(f.total/(e(f.limit)?f.limit:1)):1},f.previous=function(){f.page--,f.onPaginationChange()},f.showBoundaryLinks=function(){return""===a.mdBoundaryLinks||f.boundaryLinks},f.showPageSelect=function(){return""===a.mdPageSelect||f.pageSelect},d.$watch("$pagination.limit",function(a,b){isNaN(a)||isNaN(b)||a===b||(f.page=Math.floor((f.page*b-b+a)/(e(a)?a:1)),f.onPaginationChange())}),a.$observe("mdLabel",function(a){b.extend(f.label,g,d.$eval(a))}),d.$watch("$pagination.total",function(a,b){isNaN(a)||a===b||f.page>f.pages()&&f.last()}),d.$watch("$pagination.page",function(a,b){isNaN(a)||a===b||(f.page>f.pages()?f.last():f.page<=0&&f.first(),f.onPaginationChange())})}return c.$inject=["$attrs","$mdUtil","$scope"],{bindToController:{boundaryLinks:"=?mdBoundaryLinks",disabled:"=ngDisabled",limit:"=mdLimit",page:"=mdPage",pageSelect:"=?mdPageSelect",onPaginate:"=?mdOnPaginate",limitOptions:"=?mdLimitOptions",total:"@mdTotal"},compile:a,controller:c,controllerAs:"$pagination",restrict:"E",scope:{},templateUrl:"md-table-pagination.html"}}function p(){function a(a,b,c,d){a.columnCount=d.columnCount,a.deferred=d.waitingOnPromise}return{link:a,require:"^^mdTable",restrict:"C",scope:{},templateUrl:"md-table-progress.html"}}function q(){function a(a,b){function c(a,b){return Math.min(a,isFinite(b)&&d(b)?b:1)}function d(a){return a>0}function e(a){if(f.pages.length>a)return f.pages.splice(a);for(var b=f.pages.length;b=g.prop("scrollHeight")&&b.$applyAsync(function(){e(c(f.pages.length+10,f.total))})}),b.$watch("$pageSelect.total",function(a){e(c(Math.max(f.pages.length,10),a))}),b.$watch("$pagination.page",function(a){for(var b=f.pages.length;b \n {{$pagination.label.page}}
\n\n \n \n {{page}} \n \n \n\n\n\n
{{$pagination.label.rowsPerPage}}
\n\n
\n {{::option.label ? option.label : option}} \n \n
\n\n')}]),b.module("md-table-progress.html",[]).run(["$templateCache",function(a){a.put("md-table-progress.html",'\n \n \n \n ')}]),b.module("arrow-up.svg",[]).run(["$templateCache",function(a){a.put("arrow-up.svg",' ')}]),b.module("navigate-before.svg",[]).run(["$templateCache",function(a){a.put("navigate-before.svg",' ')}]),b.module("navigate-first.svg",[]).run(["$templateCache",function(a){a.put("navigate-first.svg",' ')}]),b.module("navigate-last.svg",[]).run(["$templateCache",function(a){a.put("navigate-last.svg",' ')}]),b.module("navigate-next.svg",[]).run(["$templateCache",function(a){a.put("navigate-next.svg",' ')}]),b.module("md.data.table",["md.table.templates"]),b.module("md.data.table").directive("mdBody",d),b.module("md.data.table").directive("mdCell",e),b.module("md.data.table").directive("mdColumn",f),f.$inject=["$compile","$mdUtil"],b.module("md.data.table").decorator("$controller",g).factory("$mdEditDialog",h),g.$inject=["$delegate"],h.$inject=["$compile","$controller","$document","$mdUtil","$q","$rootScope","$templateCache","$templateRequest","$window"],b.module("md.data.table").directive("mdFoot",i),b.module("md.data.table").directive("mdHead",j),j.$inject=["$compile"],b.module("md.data.table").directive("mdRow",k),b.module("md.data.table").directive("mdSelect",l),l.$inject=["$compile","$parse"],b.module("md.data.table").directive("mdTable",n),b.module("md.data.table").directive("mdTablePagination",o),b.module("md.data.table").directive("mdTableProgress",p),b.module("md.data.table").directive("virtualPageSelect",q)}(window,angular);
\ No newline at end of file
diff --git a/src/scripts/mdTablePagination.js b/src/scripts/mdTablePagination.js
index e663ecf..6abb880 100644
--- a/src/scripts/mdTablePagination.js
+++ b/src/scripts/mdTablePagination.js
@@ -105,6 +105,19 @@ function mdTablePagination() {
self.last();
}
});
+
+ $scope.$watch('$pagination.page', function (newValue, oldValue) {
+ if(isNaN(newValue) || newValue === oldValue) {
+ return;
+ }
+ if(self.page > self.pages()) {
+ self.last();
+ }else if (self.page<=0) {
+ self.first();
+ }
+ self.onPaginationChange();
+ });
+
}
Controller.$inject = ['$attrs', '$mdUtil', '$scope'];
@@ -127,4 +140,4 @@ function mdTablePagination() {
scope: {},
templateUrl: 'md-table-pagination.html'
};
-}
\ No newline at end of file
+}