Comparing version 0.2.6 to 0.2.7
{ | ||
"name": "ng-tasty", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"homepage": "https://github.com/Zizzamia/ng-tasty", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -5,3 +5,3 @@ /* | ||
* Version: 0.2.6 - 2014-08-26 | ||
* Version: 0.2.7 - 2014-09-08 | ||
* License: MIT | ||
@@ -224,3 +224,3 @@ */ | ||
'pages': 1, | ||
'size': 1 | ||
'size': 0 | ||
}; | ||
@@ -272,4 +272,8 @@ $scope.theadDirective = false; | ||
var sortBy; | ||
if (!resource) { | ||
return false; | ||
if (!angular.isObject(resource)) { | ||
throw 'AngularJS tastyTable directive: the resource '+ | ||
'it\'s not an object'; | ||
} else if (!resource.header && !resource.rows) { | ||
throw 'AngularJS tastyTable directive: the resource '+ | ||
'has the property header or rows undefined'; | ||
} | ||
@@ -345,3 +349,3 @@ sortBy = resource.sortBy || $scope.params.sortBy; | ||
$scope.url = $scope.buildUrl($scope.params, $scope[$attrs.filters]); | ||
$scope.resourceCallback($scope.url).then(function (resource) { | ||
$scope.resourceCallback($scope.url, $scope.params).then(function (resource) { | ||
$scope.setDirectivesValues(resource); | ||
@@ -371,3 +375,3 @@ }); | ||
} | ||
$scope.$watch('params', function (newValue, oldValue){ | ||
$scope.$watchCollection('params', function (newValue, oldValue){ | ||
if (newValue !== oldValue) { | ||
@@ -380,3 +384,3 @@ if ($scope.clientSide) { | ||
} | ||
}, true); | ||
}); | ||
if ($scope.resource) { | ||
@@ -426,8 +430,9 @@ $scope.$parent.$watch($attrs.resource, function (newValue, oldValue){ | ||
scope.fields = {}; | ||
scope.columns = []; | ||
scope.setFields = function () { | ||
var lenHeader, width, i, active, sortable; | ||
scope.setColumns = function () { | ||
var lenHeader, width, i, active, sortable, sort; | ||
scope.columns = []; | ||
lenHeader = scope.header.columns.length; | ||
scope.header.columns.forEach(function (column) { | ||
scope.header.columns.forEach(function (column, index) { | ||
width = parseFloat((100 / lenHeader).toFixed(2)); | ||
@@ -443,8 +448,12 @@ sortable = true; | ||
} | ||
scope.fields[column.key] = { | ||
sort = $filter('cleanFieldName')(column.key); | ||
scope.columns.push({ | ||
'key': column.key, | ||
'name': column.name, | ||
'active': active, | ||
'sortable': sortable, | ||
'width': { 'width': width + '%' }, | ||
'sort': $filter('cleanFieldName')(column.key) | ||
}; | ||
'isSortUp': scope.header.sortBy === '-' + sort, | ||
'isSortDown': scope.header.sortBy === sort | ||
}); | ||
}); | ||
@@ -457,38 +466,35 @@ if (scope.header.sortOrder === 'dsc' && | ||
scope.sortBy = function (field) { | ||
if (scope.notSortBy && scope.notSortBy.indexOf(field.key) >= 0) { | ||
scope.sortBy = function (column) { | ||
if (scope.notSortBy && scope.notSortBy.indexOf(column.key) >= 0) { | ||
return false; | ||
} | ||
var fieldName; | ||
fieldName = $filter('cleanFieldName')(field.key); | ||
if (scope.header.sortBy == fieldName) { | ||
scope.header.sortBy = '-' + fieldName; | ||
var columnName; | ||
columnName = $filter('cleanFieldName')(column.key); | ||
if (scope.header.sortBy == columnName) { | ||
scope.header.sortBy = '-' + columnName; | ||
tastyTable.setParams('sortOrder', 'dsc'); | ||
} else { | ||
scope.header.sortBy = fieldName; | ||
scope.header.sortBy = columnName; | ||
tastyTable.setParams('sortOrder', 'asc'); | ||
} | ||
tastyTable.setParams('sortBy', field.key); | ||
tastyTable.setParams('sortBy', column.key); | ||
}; | ||
scope.isSortUp = function(field) { | ||
if (scope.fields[field.key] === undefined) { | ||
return false; | ||
scope.classToShow = function (column) { | ||
var listClassToShow = []; | ||
if (column.sortable) { | ||
listClassToShow.push('sortable'); | ||
} | ||
return scope.header.sortBy == '-' + scope.fields[field.key].sort; | ||
}; | ||
scope.isSortDown = function(field) { | ||
if (scope.fields[field.key] === undefined) { | ||
return false; | ||
if (column.active) { | ||
listClassToShow.push('active'); | ||
} | ||
return scope.header.sortBy == scope.fields[field.key].sort; | ||
return listClassToShow; | ||
}; | ||
tastyTable.$scope.$watch('header', function (newValue, oldValue){ | ||
tastyTable.$scope.$watchCollection('header', function (newValue, oldValue){ | ||
if (newValue && (newValue !== oldValue)) { | ||
scope.header = newValue; | ||
scope.setFields(); | ||
scope.setColumns(); | ||
} | ||
}, true); | ||
}); | ||
} | ||
@@ -561,3 +567,2 @@ }; | ||
currentPage = scope.pagination.page; | ||
//scope.pagination.count = scope.itemsPerPage; | ||
if (currentPage > scope.pagination.pages) { | ||
@@ -602,2 +607,4 @@ currentPage = scope.pagination.pages; | ||
scope.pagHideMaxRange = scope.pagMaxRange >= scope.pagination.pages; | ||
scope.classPageMinRange = scope.pagHideMinRange ? 'disabled' : ''; | ||
scope.classPageMaxRange = scope.pagHideMaxRange ? 'disabled' : ''; | ||
for (var i = 2; i < scope.listItemsPerPage.length; i++) { | ||
@@ -612,2 +619,16 @@ if (scope.pagination.size < scope.listItemsPerPage[i]) { | ||
scope.classPaginationCount = function (count) { | ||
if (count == scope.pagination.count) { | ||
return 'active'; | ||
} | ||
return ''; | ||
}; | ||
scope.classNumPage = function (numPage) { | ||
if (numPage == scope.pagination.page) { | ||
return 'active'; | ||
} | ||
return false; | ||
}; | ||
scope.page = { | ||
@@ -620,3 +641,3 @@ 'get': getPage, | ||
tastyTable.$scope.$watch('pagination', function (newValue, oldValue){ | ||
tastyTable.$scope.$watchCollection('pagination', function (newValue, oldValue){ | ||
if (newValue && (newValue !== oldValue)) { | ||
@@ -626,3 +647,3 @@ scope.pagination = newValue; | ||
} | ||
}, true); | ||
}); | ||
@@ -638,10 +659,8 @@ // Init Pagination | ||
'<tr>\n' + | ||
' <th ng-repeat="column in header.columns" \n' + | ||
' ng-class="{\'sortable\': fields[column.key].sortable, \n' + | ||
' \'active\': fields[column.key].active}"\n' + | ||
' ng-style="fields[column.key].width" \n' + | ||
' ng-click="sortBy(column)">\n' + | ||
' <th ng-repeat="column in columns track by $index" \n' + | ||
' ng-class="classToShow(column)"\n' + | ||
' ng-style="column.width" ng-click="sortBy(column)">\n' + | ||
' <span ng-bind="column.name"></span>\n' + | ||
' <span ng-if="isSortUp(column)" class="fa fa-sort-up"></span>\n' + | ||
' <span ng-if="isSortDown(column)" class="fa fa-sort-down"></span>\n' + | ||
' <span ng-if="column.isSortUp" class="fa fa-sort-up"></span>\n' + | ||
' <span ng-if="column.isSortDown" class="fa fa-sort-down"></span>\n' + | ||
' </th> \n' + | ||
@@ -658,3 +677,3 @@ '</tr>'); | ||
' ng-repeat="count in listItemsPerPageShow" \n' + | ||
' ng-class="{active: count == pagination.count}" \n' + | ||
' ng-class="classPaginationCount(count)" \n' + | ||
' ng-click="page.setCount(count)" ng-bind="count"></button>\n' + | ||
@@ -665,13 +684,12 @@ ' </div>\n' + | ||
' <ul class="pagination">\n' + | ||
' <li ng-class="{disabled: pagHideMinRange}">\n' + | ||
' <li ng-class="classPageMinRange">\n' + | ||
' <span ng-click="page.previous()">«</span>\n' + | ||
' </li>\n' + | ||
' <li ng-repeat="numPage in rangePage" \n' + | ||
' ng-class="{active: numPage == pagination.page}">\n' + | ||
' <li ng-repeat="numPage in rangePage" ng-class="classNumPage(numPage)">\n' + | ||
' <span ng-click="page.get(numPage)">\n' + | ||
' <span ng-bind="numPage"></span>\n' + | ||
' <span class="sr-only" ng-if="numPage == pagination.page">(current)</span>\n' + | ||
' <span class="sr-only" ng-if="classNumPage(numPage)">(current)</span>\n' + | ||
' </span>\n' + | ||
' </li>\n' + | ||
' <li ng-class="{disabled: pagHideMaxRange}">\n' + | ||
' <li ng-class="classPageMaxRange">\n' + | ||
' <span ng-click="page.remaining()">»</span>\n' + | ||
@@ -678,0 +696,0 @@ ' </li>\n' + |
@@ -5,5 +5,5 @@ /* | ||
* Version: 0.2.6 - 2014-08-26 | ||
* Version: 0.2.7 - 2014-09-08 | ||
* License: MIT | ||
*/ | ||
angular.module("ngTasty",["ngTasty.tpls","ngTasty.filter","ngTasty.service","ngTasty.table"]),angular.module("ngTasty.tpls",["template/table/head.html","template/table/pagination.html"]),angular.module("ngTasty.filter",["ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range"]),angular.module("ngTasty.filter.cleanFieldName",[]).filter("cleanFieldName",function(){return function(input){return input.replace(/[^a-zA-Z0-9-]+/g,"-").toLowerCase()}}),angular.module("ngTasty.filter.filterInt",[]).filter("filterInt",function(){return function(input){return/^(\-|\+)?([0-9]+|Infinity)$/.test(input)?Number(input):0/0}}),angular.module("ngTasty.filter.range",[]).filter("range",["$filter",function($filter){return function(input,start,stop,step){if(start=$filter("filterInt")(start),stop=$filter("filterInt")(stop),step=$filter("filterInt")(step),isNaN(start)&&(start=0),isNaN(stop)&&(stop=start,start=0),isNaN(step)&&(step=1),step>0&&start>=stop||0>step&&stop>=start)return[];for(var i=start;step>0?stop>i:i>stop;i+=step)input.push(i);return input}}]),angular.module("ngTasty.service",["ngTasty.service.tastyUtil","ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]),angular.module("ngTasty.service.tastyUtil",["ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]).factory("tastyUtil",["debounce","setProperty","joinObjects",function(debounce,setProperty,joinObjects){return{debounce:debounce,setProperty:setProperty,joinObjects:joinObjects}}]),angular.module("ngTasty.service.debounce",[]).factory("debounce",["$timeout",function($timeout){return function(func,wait){var timeout;return function(){var context=this,args=arguments;$timeout.cancel(timeout),timeout=$timeout(function(){timeout=null,func.apply(context,args)},wait)}}}]),angular.module("ngTasty.service.setProperty",[]).factory("setProperty",function(){return function(objOne,objTwo,attrname){return"undefined"!=typeof objTwo[attrname]&&null!==objTwo[attrname]&&(objOne[attrname]=objTwo[attrname]),objOne}}),angular.module("ngTasty.service.joinObjects",[]).factory("joinObjects",["setProperty",function(setProperty){return function(objOne,objTwo){for(var attrname in objTwo)setProperty(objOne,objTwo,attrname);return objOne}}]),angular.module("ngTasty.table",["ngTasty.filter.cleanFieldName","ngTasty.filter.range","ngTasty.service.tastyUtil"]).constant("tableConfig",{query:{page:"page",count:"count",sortBy:"sort-by",sortOrder:"sort-order"},resource:void 0,resourceCallback:void 0,listItemsPerPage:[5,25,50,100],itemsPerPage:5}).controller("TableController",["$scope","$attrs","$timeout","$filter","tableConfig","tastyUtil",function($scope,$attrs,$timeout,$filter,tableConfig,tastyUtil){"use strict";if(this.$scope=$scope,$scope.query=tableConfig.query,$scope.resource=tableConfig.resource,$scope.resourceCallback=tableConfig.resourceCallback,$scope.clientSide=!0,$scope.url="",$scope.header={columns:[]},$scope.rows=[],$scope.params={},$scope.pagination={count:5,page:1,pages:1,size:1},$scope.theadDirective=!1,$scope.paginationDirective=!1,angular.isDefined($attrs.query)&&($scope.query=$scope.$parent[$attrs.query]),!angular.isDefined($attrs.resource)&&!angular.isDefined($attrs.resourceCallback))throw"AngularJS tastyTable directive: need the resource or resource-callback attribute";if(angular.isDefined($attrs.resource)){if($scope.resource=$scope.$parent[$attrs.resource],!angular.isObject($scope.resource))throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") it's not an object";if(!$scope.resource.header&&!$scope.resource.rows)throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") has the property header or rows undefined"}if(angular.isDefined($attrs.resourceCallback)){if($scope.resourceCallback=$scope.$parent[$attrs.resourceCallback],!angular.isFunction($scope.resourceCallback))throw"AngularJS tastyTable directive: the resource-callback ("+$attrs.resourceCallback+") it's not a function";$scope.clientSide=!1}this.activate=function(directiveName){$scope[directiveName+"Directive"]=!0,$scope.params[directiveName]=!0},this.setParams=function(key,value){$scope.params[key]=value},$scope.setDirectivesValues=function(resource){var sortBy;return resource?(sortBy=resource.sortBy||$scope.params.sortBy,sortBy=sortBy||resource.header[0].key,$scope.header={columns:resource.header,sortBy:sortBy,sortOrder:resource.sortOrder||$scope.params.sortOrder},$scope.rows=resource.rows,void($scope.pagination=resource.pagination||$scope.pagination)):!1},$scope.buildClientResource=function(){var fromRow,toRow,rowToShow,reverse,listSortBy;$scope.theadDirective&&(reverse="asc"===$scope.header.sortOrder?!1:!0,listSortBy=[function(item){return item[$scope.header.sortBy]}],$scope.header.columns[0].key!==$scope.header.sortBy&&listSortBy.push(function(item){return item[$scope.header.columns[0].key]}),$scope.rows=$filter("orderBy")($scope.rows,listSortBy,reverse)),$scope.paginationDirective&&($scope.pagination.page=$scope.params.page,$scope.pagination.count=$scope.params.count,$scope.pagination.size=$scope.rows.length,$scope.pagination.pages=Math.ceil($scope.rows.length/$scope.pagination.count),toRow=$scope.pagination.count*$scope.pagination.page,fromRow=toRow-$scope.pagination.count,fromRow>=0&&toRow>=0&&(rowToShow=$scope.rows.slice(fromRow,toRow),$scope.rows=rowToShow))},$scope.buildUrl=function(params,filters){var urlQuery,value;return urlQuery={},$scope.theadDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"sortBy"),urlQuery=tastyUtil.setProperty(urlQuery,params,"sortOrder")),$scope.paginationDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"page"),urlQuery=tastyUtil.setProperty(urlQuery,params,"count")),$attrs.filters&&(urlQuery=tastyUtil.joinObjects(urlQuery,filters)),Object.keys(urlQuery).map(function(key){return value=urlQuery[key],$scope.query[key]&&(key=$scope.query[key]),encodeURIComponent(key)+"="+encodeURIComponent(value)}).join("&")},$scope.updateClientSideResource=tastyUtil.debounce(function(){$scope.setDirectivesValues($scope.resource),$scope.buildClientResource()},100),$scope.updateServerSideResource=tastyUtil.debounce(function(){$scope.url=$scope.buildUrl($scope.params,$scope[$attrs.filters]),$scope.resourceCallback($scope.url).then(function(resource){$scope.setDirectivesValues(resource)})},100),$scope.initTable=function(){$scope.params.sortBy=void 0,$scope.params.sortOrder="asc",$scope.params.page=1,$scope.params.count=void 0,$scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource()},$attrs.filters&&$scope.$watch($attrs.filters,function(newValue,oldValue){newValue!==oldValue&&$scope.updateServerSideResource()},!0),$scope.$watch("params",function(newValue,oldValue){newValue!==oldValue&&($scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource())},!0),$scope.resource&&$scope.$parent.$watch($attrs.resource,function(newValue,oldValue){newValue!==oldValue&&($scope.resource=newValue,$scope.updateClientSideResource())},!0),$scope.initTable()}]).directive("tastyTable",function(){return{restrict:"A",scope:!0,controller:"TableController"}}).directive("tastyThead",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{notSortBy:"="},templateUrl:"template/table/head.html",link:function(scope,element,attrs,tastyTable){"use strict";tastyTable.activate("thead"),scope.fields={},scope.setFields=function(){var lenHeader,width,active,sortable;lenHeader=scope.header.columns.length,scope.header.columns.forEach(function(column){width=parseFloat((100/lenHeader).toFixed(2)),sortable=!0,active=!1,scope.notSortBy&&(sortable=scope.notSortBy.indexOf(column.key)<0),(column.key===scope.header.sortBy||"-"+column.key===scope.header.sortBy)&&(active=!0),scope.fields[column.key]={active:active,sortable:sortable,width:{width:width+"%"},sort:$filter("cleanFieldName")(column.key)}}),"dsc"===scope.header.sortOrder&&"-"!==scope.header.sortBy[0]&&(scope.header.sortBy="-"+scope.header.sortBy)},scope.sortBy=function(field){if(scope.notSortBy&&scope.notSortBy.indexOf(field.key)>=0)return!1;var fieldName;fieldName=$filter("cleanFieldName")(field.key),scope.header.sortBy==fieldName?(scope.header.sortBy="-"+fieldName,tastyTable.setParams("sortOrder","dsc")):(scope.header.sortBy=fieldName,tastyTable.setParams("sortOrder","asc")),tastyTable.setParams("sortBy",field.key)},scope.isSortUp=function(field){return void 0===scope.fields[field.key]?!1:scope.header.sortBy=="-"+scope.fields[field.key].sort},scope.isSortDown=function(field){return void 0===scope.fields[field.key]?!1:scope.header.sortBy==scope.fields[field.key].sort},tastyTable.$scope.$watch("header",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.header=newValue,scope.setFields())},!0)}}}]).controller("TablePaginationController",["$scope","$attrs","tableConfig",function($scope,$attrs,tableConfig){angular.isDefined($attrs.itemsPerPage)&&($scope.itemsPerPage=$scope.$parent[$attrs.itemsPerPage]),angular.isDefined($attrs.listItemsPerPage)&&($scope.listItemsPerPage=$scope.$parent[$attrs.listItemsPerPage]),$scope.itemsPerPage=$scope.itemsPerPage||tableConfig.itemsPerPage,$scope.listItemsPerPage=$scope.listItemsPerPage||tableConfig.listItemsPerPage}]).directive("tastyPagination",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{},templateUrl:"template/table/pagination.html",controller:"TablePaginationController",link:function(scope,element,attrs,tastyTable){"use strict";var getPage,setCount,setPaginationRange,setPreviousRange,setRemainingRange,setPaginationRanges;tastyTable.activate("pagination"),scope.pagination={},scope.pagMinRange=1,scope.pagMaxRange=1,getPage=function(numPage){tastyTable.setParams("page",numPage)},setCount=function(count){var maxItems,page;maxItems=count*scope.pagination.page,maxItems>scope.pagination.size&&(page=Math.ceil(scope.pagination.size/count),tastyTable.setParams("page",page)),tastyTable.setParams("count",count)},setPaginationRange=function(){var currentPage;currentPage=scope.pagination.page,currentPage>scope.pagination.pages&&(currentPage=scope.pagination.pages),scope.pagMinRange=currentPage-2>0?currentPage-2:1,scope.pagMaxRange=currentPage+2,scope.pagination.page=currentPage,setPaginationRanges()},setPreviousRange=function(){return scope.pagHideMinRange===!0||scope.pagMinRange<1?!1:(scope.pagMaxRange=scope.pagMinRange,scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setRemainingRange=function(){return scope.pagHideMaxRange===!0||scope.pagMaxRange>scope.pagination.pages?!1:(scope.pagMinRange=scope.pagMaxRange,scope.pagMaxRange=scope.pagMinRange+scope.itemsPerPage,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages),scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setPaginationRanges=function(){scope.pagMinRange=scope.pagMinRange>0?scope.pagMinRange:1,scope.pagMaxRange=scope.pagMinRange+5,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages+1),scope.pagHideMinRange=scope.pagMinRange<=1,scope.pagHideMaxRange=scope.pagMaxRange>=scope.pagination.pages;for(var i=2;i<scope.listItemsPerPage.length;i++)if(scope.pagination.size<scope.listItemsPerPage[i]){scope.listItemsPerPageShow=scope.listItemsPerPage.slice(0,i);break}scope.rangePage=$filter("range")([],scope.pagMinRange,scope.pagMaxRange)},scope.page={get:getPage,setCount:setCount,previous:setPreviousRange,remaining:setRemainingRange},tastyTable.$scope.$watch("pagination",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.pagination=newValue,setPaginationRange())},!0),scope.page.setCount(scope.itemsPerPage)}}}]),angular.module("template/table/head.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/table/head.html",'<tr>\n <th ng-repeat="column in header.columns" \n ng-class="{\'sortable\': fields[column.key].sortable, \n \'active\': fields[column.key].active}"\n ng-style="fields[column.key].width" \n ng-click="sortBy(column)">\n <span ng-bind="column.name"></span>\n <span ng-if="isSortUp(column)" class="fa fa-sort-up"></span>\n <span ng-if="isSortDown(column)" class="fa fa-sort-down"></span>\n </th> \n</tr>')}]),angular.module("template/table/pagination.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/table/pagination.html",'<div class="row">\n <div class="col-xs-3 text-left">\n <div class="btn-group">\n <button type="button" class="btn btn-default" \n ng-repeat="count in listItemsPerPageShow" \n ng-class="{active: count == pagination.count}" \n ng-click="page.setCount(count)" ng-bind="count"></button>\n </div>\n </div>\n <div class="col-xs-6 text-center">\n <ul class="pagination">\n <li ng-class="{disabled: pagHideMinRange}">\n <span ng-click="page.previous()">«</span>\n </li>\n <li ng-repeat="numPage in rangePage" \n ng-class="{active: numPage == pagination.page}">\n <span ng-click="page.get(numPage)">\n <span ng-bind="numPage"></span>\n <span class="sr-only" ng-if="numPage == pagination.page">(current)</span>\n </span>\n </li>\n <li ng-class="{disabled: pagHideMaxRange}">\n <span ng-click="page.remaining()">»</span>\n </li>\n </ul>\n </div>\n <div class="col-xs-3 text-right">\n <p>Page <span ng-bind="pagination.page"></span> \n of <span ng-bind="pagination.pages"></span>,\n of <span ng-bind="pagination.size"></span> entries</p>\n </div>\n</div>')}]); | ||
angular.module("ngTasty",["ngTasty.tpls","ngTasty.filter","ngTasty.service","ngTasty.table"]),angular.module("ngTasty.tpls",["template/table/head.html","template/table/pagination.html"]),angular.module("ngTasty.filter",["ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range"]),angular.module("ngTasty.filter.cleanFieldName",[]).filter("cleanFieldName",function(){return function(input){return input.replace(/[^a-zA-Z0-9-]+/g,"-").toLowerCase()}}),angular.module("ngTasty.filter.filterInt",[]).filter("filterInt",function(){return function(input){return/^(\-|\+)?([0-9]+|Infinity)$/.test(input)?Number(input):0/0}}),angular.module("ngTasty.filter.range",[]).filter("range",["$filter",function($filter){return function(input,start,stop,step){if(start=$filter("filterInt")(start),stop=$filter("filterInt")(stop),step=$filter("filterInt")(step),isNaN(start)&&(start=0),isNaN(stop)&&(stop=start,start=0),isNaN(step)&&(step=1),step>0&&start>=stop||0>step&&stop>=start)return[];for(var i=start;step>0?stop>i:i>stop;i+=step)input.push(i);return input}}]),angular.module("ngTasty.service",["ngTasty.service.tastyUtil","ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]),angular.module("ngTasty.service.tastyUtil",["ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]).factory("tastyUtil",["debounce","setProperty","joinObjects",function(debounce,setProperty,joinObjects){return{debounce:debounce,setProperty:setProperty,joinObjects:joinObjects}}]),angular.module("ngTasty.service.debounce",[]).factory("debounce",["$timeout",function($timeout){return function(func,wait){var timeout;return function(){var context=this,args=arguments;$timeout.cancel(timeout),timeout=$timeout(function(){timeout=null,func.apply(context,args)},wait)}}}]),angular.module("ngTasty.service.setProperty",[]).factory("setProperty",function(){return function(objOne,objTwo,attrname){return"undefined"!=typeof objTwo[attrname]&&null!==objTwo[attrname]&&(objOne[attrname]=objTwo[attrname]),objOne}}),angular.module("ngTasty.service.joinObjects",[]).factory("joinObjects",["setProperty",function(setProperty){return function(objOne,objTwo){for(var attrname in objTwo)setProperty(objOne,objTwo,attrname);return objOne}}]),angular.module("ngTasty.table",["ngTasty.filter.cleanFieldName","ngTasty.filter.range","ngTasty.service.tastyUtil"]).constant("tableConfig",{query:{page:"page",count:"count",sortBy:"sort-by",sortOrder:"sort-order"},resource:void 0,resourceCallback:void 0,listItemsPerPage:[5,25,50,100],itemsPerPage:5}).controller("TableController",["$scope","$attrs","$timeout","$filter","tableConfig","tastyUtil",function($scope,$attrs,$timeout,$filter,tableConfig,tastyUtil){"use strict";if(this.$scope=$scope,$scope.query=tableConfig.query,$scope.resource=tableConfig.resource,$scope.resourceCallback=tableConfig.resourceCallback,$scope.clientSide=!0,$scope.url="",$scope.header={columns:[]},$scope.rows=[],$scope.params={},$scope.pagination={count:5,page:1,pages:1,size:0},$scope.theadDirective=!1,$scope.paginationDirective=!1,angular.isDefined($attrs.query)&&($scope.query=$scope.$parent[$attrs.query]),!angular.isDefined($attrs.resource)&&!angular.isDefined($attrs.resourceCallback))throw"AngularJS tastyTable directive: need the resource or resource-callback attribute";if(angular.isDefined($attrs.resource)){if($scope.resource=$scope.$parent[$attrs.resource],!angular.isObject($scope.resource))throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") it's not an object";if(!$scope.resource.header&&!$scope.resource.rows)throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") has the property header or rows undefined"}if(angular.isDefined($attrs.resourceCallback)){if($scope.resourceCallback=$scope.$parent[$attrs.resourceCallback],!angular.isFunction($scope.resourceCallback))throw"AngularJS tastyTable directive: the resource-callback ("+$attrs.resourceCallback+") it's not a function";$scope.clientSide=!1}this.activate=function(directiveName){$scope[directiveName+"Directive"]=!0,$scope.params[directiveName]=!0},this.setParams=function(key,value){$scope.params[key]=value},$scope.setDirectivesValues=function(resource){var sortBy;if(!angular.isObject(resource))throw"AngularJS tastyTable directive: the resource it's not an object";if(!resource.header&&!resource.rows)throw"AngularJS tastyTable directive: the resource has the property header or rows undefined";sortBy=resource.sortBy||$scope.params.sortBy,sortBy=sortBy||resource.header[0].key,$scope.header={columns:resource.header,sortBy:sortBy,sortOrder:resource.sortOrder||$scope.params.sortOrder},$scope.rows=resource.rows,$scope.pagination=resource.pagination||$scope.pagination},$scope.buildClientResource=function(){var fromRow,toRow,rowToShow,reverse,listSortBy;$scope.theadDirective&&(reverse="asc"===$scope.header.sortOrder?!1:!0,listSortBy=[function(item){return item[$scope.header.sortBy]}],$scope.header.columns[0].key!==$scope.header.sortBy&&listSortBy.push(function(item){return item[$scope.header.columns[0].key]}),$scope.rows=$filter("orderBy")($scope.rows,listSortBy,reverse)),$scope.paginationDirective&&($scope.pagination.page=$scope.params.page,$scope.pagination.count=$scope.params.count,$scope.pagination.size=$scope.rows.length,$scope.pagination.pages=Math.ceil($scope.rows.length/$scope.pagination.count),toRow=$scope.pagination.count*$scope.pagination.page,fromRow=toRow-$scope.pagination.count,fromRow>=0&&toRow>=0&&(rowToShow=$scope.rows.slice(fromRow,toRow),$scope.rows=rowToShow))},$scope.buildUrl=function(params,filters){var urlQuery,value;return urlQuery={},$scope.theadDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"sortBy"),urlQuery=tastyUtil.setProperty(urlQuery,params,"sortOrder")),$scope.paginationDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"page"),urlQuery=tastyUtil.setProperty(urlQuery,params,"count")),$attrs.filters&&(urlQuery=tastyUtil.joinObjects(urlQuery,filters)),Object.keys(urlQuery).map(function(key){return value=urlQuery[key],$scope.query[key]&&(key=$scope.query[key]),encodeURIComponent(key)+"="+encodeURIComponent(value)}).join("&")},$scope.updateClientSideResource=tastyUtil.debounce(function(){$scope.setDirectivesValues($scope.resource),$scope.buildClientResource()},100),$scope.updateServerSideResource=tastyUtil.debounce(function(){$scope.url=$scope.buildUrl($scope.params,$scope[$attrs.filters]),$scope.resourceCallback($scope.url,$scope.params).then(function(resource){$scope.setDirectivesValues(resource)})},100),$scope.initTable=function(){$scope.params.sortBy=void 0,$scope.params.sortOrder="asc",$scope.params.page=1,$scope.params.count=void 0,$scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource()},$attrs.filters&&$scope.$watch($attrs.filters,function(newValue,oldValue){newValue!==oldValue&&$scope.updateServerSideResource()},!0),$scope.$watchCollection("params",function(newValue,oldValue){newValue!==oldValue&&($scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource())}),$scope.resource&&$scope.$parent.$watch($attrs.resource,function(newValue,oldValue){newValue!==oldValue&&($scope.resource=newValue,$scope.updateClientSideResource())},!0),$scope.initTable()}]).directive("tastyTable",function(){return{restrict:"A",scope:!0,controller:"TableController"}}).directive("tastyThead",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{notSortBy:"="},templateUrl:"template/table/head.html",link:function(scope,element,attrs,tastyTable){"use strict";tastyTable.activate("thead"),scope.columns=[],scope.setColumns=function(){var lenHeader,width,active,sortable,sort;scope.columns=[],lenHeader=scope.header.columns.length,scope.header.columns.forEach(function(column){width=parseFloat((100/lenHeader).toFixed(2)),sortable=!0,active=!1,scope.notSortBy&&(sortable=scope.notSortBy.indexOf(column.key)<0),(column.key===scope.header.sortBy||"-"+column.key===scope.header.sortBy)&&(active=!0),sort=$filter("cleanFieldName")(column.key),scope.columns.push({key:column.key,name:column.name,active:active,sortable:sortable,width:{width:width+"%"},isSortUp:scope.header.sortBy==="-"+sort,isSortDown:scope.header.sortBy===sort})}),"dsc"===scope.header.sortOrder&&"-"!==scope.header.sortBy[0]&&(scope.header.sortBy="-"+scope.header.sortBy)},scope.sortBy=function(column){if(scope.notSortBy&&scope.notSortBy.indexOf(column.key)>=0)return!1;var columnName;columnName=$filter("cleanFieldName")(column.key),scope.header.sortBy==columnName?(scope.header.sortBy="-"+columnName,tastyTable.setParams("sortOrder","dsc")):(scope.header.sortBy=columnName,tastyTable.setParams("sortOrder","asc")),tastyTable.setParams("sortBy",column.key)},scope.classToShow=function(column){var listClassToShow=[];return column.sortable&&listClassToShow.push("sortable"),column.active&&listClassToShow.push("active"),listClassToShow},tastyTable.$scope.$watchCollection("header",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.header=newValue,scope.setColumns())})}}}]).controller("TablePaginationController",["$scope","$attrs","tableConfig",function($scope,$attrs,tableConfig){angular.isDefined($attrs.itemsPerPage)&&($scope.itemsPerPage=$scope.$parent[$attrs.itemsPerPage]),angular.isDefined($attrs.listItemsPerPage)&&($scope.listItemsPerPage=$scope.$parent[$attrs.listItemsPerPage]),$scope.itemsPerPage=$scope.itemsPerPage||tableConfig.itemsPerPage,$scope.listItemsPerPage=$scope.listItemsPerPage||tableConfig.listItemsPerPage}]).directive("tastyPagination",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{},templateUrl:"template/table/pagination.html",controller:"TablePaginationController",link:function(scope,element,attrs,tastyTable){"use strict";var getPage,setCount,setPaginationRange,setPreviousRange,setRemainingRange,setPaginationRanges;tastyTable.activate("pagination"),scope.pagination={},scope.pagMinRange=1,scope.pagMaxRange=1,getPage=function(numPage){tastyTable.setParams("page",numPage)},setCount=function(count){var maxItems,page;maxItems=count*scope.pagination.page,maxItems>scope.pagination.size&&(page=Math.ceil(scope.pagination.size/count),tastyTable.setParams("page",page)),tastyTable.setParams("count",count)},setPaginationRange=function(){var currentPage;currentPage=scope.pagination.page,currentPage>scope.pagination.pages&&(currentPage=scope.pagination.pages),scope.pagMinRange=currentPage-2>0?currentPage-2:1,scope.pagMaxRange=currentPage+2,scope.pagination.page=currentPage,setPaginationRanges()},setPreviousRange=function(){return scope.pagHideMinRange===!0||scope.pagMinRange<1?!1:(scope.pagMaxRange=scope.pagMinRange,scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setRemainingRange=function(){return scope.pagHideMaxRange===!0||scope.pagMaxRange>scope.pagination.pages?!1:(scope.pagMinRange=scope.pagMaxRange,scope.pagMaxRange=scope.pagMinRange+scope.itemsPerPage,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages),scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setPaginationRanges=function(){scope.pagMinRange=scope.pagMinRange>0?scope.pagMinRange:1,scope.pagMaxRange=scope.pagMinRange+5,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages+1),scope.pagHideMinRange=scope.pagMinRange<=1,scope.pagHideMaxRange=scope.pagMaxRange>=scope.pagination.pages,scope.classPageMinRange=scope.pagHideMinRange?"disabled":"",scope.classPageMaxRange=scope.pagHideMaxRange?"disabled":"";for(var i=2;i<scope.listItemsPerPage.length;i++)if(scope.pagination.size<scope.listItemsPerPage[i]){scope.listItemsPerPageShow=scope.listItemsPerPage.slice(0,i);break}scope.rangePage=$filter("range")([],scope.pagMinRange,scope.pagMaxRange)},scope.classPaginationCount=function(count){return count==scope.pagination.count?"active":""},scope.classNumPage=function(numPage){return numPage==scope.pagination.page?"active":!1},scope.page={get:getPage,setCount:setCount,previous:setPreviousRange,remaining:setRemainingRange},tastyTable.$scope.$watchCollection("pagination",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.pagination=newValue,setPaginationRange())}),scope.page.setCount(scope.itemsPerPage)}}}]),angular.module("template/table/head.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/table/head.html",'<tr>\n <th ng-repeat="column in columns track by $index" \n ng-class="classToShow(column)"\n ng-style="column.width" ng-click="sortBy(column)">\n <span ng-bind="column.name"></span>\n <span ng-if="column.isSortUp" class="fa fa-sort-up"></span>\n <span ng-if="column.isSortDown" class="fa fa-sort-down"></span>\n </th> \n</tr>')}]),angular.module("template/table/pagination.html",[]).run(["$templateCache",function($templateCache){$templateCache.put("template/table/pagination.html",'<div class="row">\n <div class="col-xs-3 text-left">\n <div class="btn-group">\n <button type="button" class="btn btn-default" \n ng-repeat="count in listItemsPerPageShow" \n ng-class="classPaginationCount(count)" \n ng-click="page.setCount(count)" ng-bind="count"></button>\n </div>\n </div>\n <div class="col-xs-6 text-center">\n <ul class="pagination">\n <li ng-class="classPageMinRange">\n <span ng-click="page.previous()">«</span>\n </li>\n <li ng-repeat="numPage in rangePage" ng-class="classNumPage(numPage)">\n <span ng-click="page.get(numPage)">\n <span ng-bind="numPage"></span>\n <span class="sr-only" ng-if="classNumPage(numPage)">(current)</span>\n </span>\n </li>\n <li ng-class="classPageMaxRange">\n <span ng-click="page.remaining()">»</span>\n </li>\n </ul>\n </div>\n <div class="col-xs-3 text-right">\n <p>Page <span ng-bind="pagination.page"></span> \n of <span ng-bind="pagination.pages"></span>,\n of <span ng-bind="pagination.size"></span> entries</p>\n </div>\n</div>')}]); |
@@ -5,3 +5,3 @@ /* | ||
* Version: 0.2.6 - 2014-08-26 | ||
* Version: 0.2.7 - 2014-09-08 | ||
* License: MIT | ||
@@ -223,3 +223,3 @@ */ | ||
'pages': 1, | ||
'size': 1 | ||
'size': 0 | ||
}; | ||
@@ -271,4 +271,8 @@ $scope.theadDirective = false; | ||
var sortBy; | ||
if (!resource) { | ||
return false; | ||
if (!angular.isObject(resource)) { | ||
throw 'AngularJS tastyTable directive: the resource '+ | ||
'it\'s not an object'; | ||
} else if (!resource.header && !resource.rows) { | ||
throw 'AngularJS tastyTable directive: the resource '+ | ||
'has the property header or rows undefined'; | ||
} | ||
@@ -344,3 +348,3 @@ sortBy = resource.sortBy || $scope.params.sortBy; | ||
$scope.url = $scope.buildUrl($scope.params, $scope[$attrs.filters]); | ||
$scope.resourceCallback($scope.url).then(function (resource) { | ||
$scope.resourceCallback($scope.url, $scope.params).then(function (resource) { | ||
$scope.setDirectivesValues(resource); | ||
@@ -370,3 +374,3 @@ }); | ||
} | ||
$scope.$watch('params', function (newValue, oldValue){ | ||
$scope.$watchCollection('params', function (newValue, oldValue){ | ||
if (newValue !== oldValue) { | ||
@@ -379,3 +383,3 @@ if ($scope.clientSide) { | ||
} | ||
}, true); | ||
}); | ||
if ($scope.resource) { | ||
@@ -425,8 +429,9 @@ $scope.$parent.$watch($attrs.resource, function (newValue, oldValue){ | ||
scope.fields = {}; | ||
scope.columns = []; | ||
scope.setFields = function () { | ||
var lenHeader, width, i, active, sortable; | ||
scope.setColumns = function () { | ||
var lenHeader, width, i, active, sortable, sort; | ||
scope.columns = []; | ||
lenHeader = scope.header.columns.length; | ||
scope.header.columns.forEach(function (column) { | ||
scope.header.columns.forEach(function (column, index) { | ||
width = parseFloat((100 / lenHeader).toFixed(2)); | ||
@@ -442,8 +447,12 @@ sortable = true; | ||
} | ||
scope.fields[column.key] = { | ||
sort = $filter('cleanFieldName')(column.key); | ||
scope.columns.push({ | ||
'key': column.key, | ||
'name': column.name, | ||
'active': active, | ||
'sortable': sortable, | ||
'width': { 'width': width + '%' }, | ||
'sort': $filter('cleanFieldName')(column.key) | ||
}; | ||
'isSortUp': scope.header.sortBy === '-' + sort, | ||
'isSortDown': scope.header.sortBy === sort | ||
}); | ||
}); | ||
@@ -456,38 +465,35 @@ if (scope.header.sortOrder === 'dsc' && | ||
scope.sortBy = function (field) { | ||
if (scope.notSortBy && scope.notSortBy.indexOf(field.key) >= 0) { | ||
scope.sortBy = function (column) { | ||
if (scope.notSortBy && scope.notSortBy.indexOf(column.key) >= 0) { | ||
return false; | ||
} | ||
var fieldName; | ||
fieldName = $filter('cleanFieldName')(field.key); | ||
if (scope.header.sortBy == fieldName) { | ||
scope.header.sortBy = '-' + fieldName; | ||
var columnName; | ||
columnName = $filter('cleanFieldName')(column.key); | ||
if (scope.header.sortBy == columnName) { | ||
scope.header.sortBy = '-' + columnName; | ||
tastyTable.setParams('sortOrder', 'dsc'); | ||
} else { | ||
scope.header.sortBy = fieldName; | ||
scope.header.sortBy = columnName; | ||
tastyTable.setParams('sortOrder', 'asc'); | ||
} | ||
tastyTable.setParams('sortBy', field.key); | ||
tastyTable.setParams('sortBy', column.key); | ||
}; | ||
scope.isSortUp = function(field) { | ||
if (scope.fields[field.key] === undefined) { | ||
return false; | ||
scope.classToShow = function (column) { | ||
var listClassToShow = []; | ||
if (column.sortable) { | ||
listClassToShow.push('sortable'); | ||
} | ||
return scope.header.sortBy == '-' + scope.fields[field.key].sort; | ||
}; | ||
scope.isSortDown = function(field) { | ||
if (scope.fields[field.key] === undefined) { | ||
return false; | ||
if (column.active) { | ||
listClassToShow.push('active'); | ||
} | ||
return scope.header.sortBy == scope.fields[field.key].sort; | ||
return listClassToShow; | ||
}; | ||
tastyTable.$scope.$watch('header', function (newValue, oldValue){ | ||
tastyTable.$scope.$watchCollection('header', function (newValue, oldValue){ | ||
if (newValue && (newValue !== oldValue)) { | ||
scope.header = newValue; | ||
scope.setFields(); | ||
scope.setColumns(); | ||
} | ||
}, true); | ||
}); | ||
} | ||
@@ -560,3 +566,2 @@ }; | ||
currentPage = scope.pagination.page; | ||
//scope.pagination.count = scope.itemsPerPage; | ||
if (currentPage > scope.pagination.pages) { | ||
@@ -601,2 +606,4 @@ currentPage = scope.pagination.pages; | ||
scope.pagHideMaxRange = scope.pagMaxRange >= scope.pagination.pages; | ||
scope.classPageMinRange = scope.pagHideMinRange ? 'disabled' : ''; | ||
scope.classPageMaxRange = scope.pagHideMaxRange ? 'disabled' : ''; | ||
for (var i = 2; i < scope.listItemsPerPage.length; i++) { | ||
@@ -611,2 +618,16 @@ if (scope.pagination.size < scope.listItemsPerPage[i]) { | ||
scope.classPaginationCount = function (count) { | ||
if (count == scope.pagination.count) { | ||
return 'active'; | ||
} | ||
return ''; | ||
}; | ||
scope.classNumPage = function (numPage) { | ||
if (numPage == scope.pagination.page) { | ||
return 'active'; | ||
} | ||
return false; | ||
}; | ||
scope.page = { | ||
@@ -619,3 +640,3 @@ 'get': getPage, | ||
tastyTable.$scope.$watch('pagination', function (newValue, oldValue){ | ||
tastyTable.$scope.$watchCollection('pagination', function (newValue, oldValue){ | ||
if (newValue && (newValue !== oldValue)) { | ||
@@ -625,3 +646,3 @@ scope.pagination = newValue; | ||
} | ||
}, true); | ||
}); | ||
@@ -628,0 +649,0 @@ // Init Pagination |
@@ -5,5 +5,5 @@ /* | ||
* Version: 0.2.6 - 2014-08-26 | ||
* Version: 0.2.7 - 2014-09-08 | ||
* License: MIT | ||
*/ | ||
angular.module("ngTasty",["ngTasty.filter","ngTasty.service","ngTasty.table"]),angular.module("ngTasty.filter",["ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range"]),angular.module("ngTasty.filter.cleanFieldName",[]).filter("cleanFieldName",function(){return function(input){return input.replace(/[^a-zA-Z0-9-]+/g,"-").toLowerCase()}}),angular.module("ngTasty.filter.filterInt",[]).filter("filterInt",function(){return function(input){return/^(\-|\+)?([0-9]+|Infinity)$/.test(input)?Number(input):0/0}}),angular.module("ngTasty.filter.range",[]).filter("range",["$filter",function($filter){return function(input,start,stop,step){if(start=$filter("filterInt")(start),stop=$filter("filterInt")(stop),step=$filter("filterInt")(step),isNaN(start)&&(start=0),isNaN(stop)&&(stop=start,start=0),isNaN(step)&&(step=1),step>0&&start>=stop||0>step&&stop>=start)return[];for(var i=start;step>0?stop>i:i>stop;i+=step)input.push(i);return input}}]),angular.module("ngTasty.service",["ngTasty.service.tastyUtil","ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]),angular.module("ngTasty.service.tastyUtil",["ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]).factory("tastyUtil",["debounce","setProperty","joinObjects",function(debounce,setProperty,joinObjects){return{debounce:debounce,setProperty:setProperty,joinObjects:joinObjects}}]),angular.module("ngTasty.service.debounce",[]).factory("debounce",["$timeout",function($timeout){return function(func,wait){var timeout;return function(){var context=this,args=arguments;$timeout.cancel(timeout),timeout=$timeout(function(){timeout=null,func.apply(context,args)},wait)}}}]),angular.module("ngTasty.service.setProperty",[]).factory("setProperty",function(){return function(objOne,objTwo,attrname){return"undefined"!=typeof objTwo[attrname]&&null!==objTwo[attrname]&&(objOne[attrname]=objTwo[attrname]),objOne}}),angular.module("ngTasty.service.joinObjects",[]).factory("joinObjects",["setProperty",function(setProperty){return function(objOne,objTwo){for(var attrname in objTwo)setProperty(objOne,objTwo,attrname);return objOne}}]),angular.module("ngTasty.table",["ngTasty.filter.cleanFieldName","ngTasty.filter.range","ngTasty.service.tastyUtil"]).constant("tableConfig",{query:{page:"page",count:"count",sortBy:"sort-by",sortOrder:"sort-order"},resource:void 0,resourceCallback:void 0,listItemsPerPage:[5,25,50,100],itemsPerPage:5}).controller("TableController",["$scope","$attrs","$timeout","$filter","tableConfig","tastyUtil",function($scope,$attrs,$timeout,$filter,tableConfig,tastyUtil){"use strict";if(this.$scope=$scope,$scope.query=tableConfig.query,$scope.resource=tableConfig.resource,$scope.resourceCallback=tableConfig.resourceCallback,$scope.clientSide=!0,$scope.url="",$scope.header={columns:[]},$scope.rows=[],$scope.params={},$scope.pagination={count:5,page:1,pages:1,size:1},$scope.theadDirective=!1,$scope.paginationDirective=!1,angular.isDefined($attrs.query)&&($scope.query=$scope.$parent[$attrs.query]),!angular.isDefined($attrs.resource)&&!angular.isDefined($attrs.resourceCallback))throw"AngularJS tastyTable directive: need the resource or resource-callback attribute";if(angular.isDefined($attrs.resource)){if($scope.resource=$scope.$parent[$attrs.resource],!angular.isObject($scope.resource))throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") it's not an object";if(!$scope.resource.header&&!$scope.resource.rows)throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") has the property header or rows undefined"}if(angular.isDefined($attrs.resourceCallback)){if($scope.resourceCallback=$scope.$parent[$attrs.resourceCallback],!angular.isFunction($scope.resourceCallback))throw"AngularJS tastyTable directive: the resource-callback ("+$attrs.resourceCallback+") it's not a function";$scope.clientSide=!1}this.activate=function(directiveName){$scope[directiveName+"Directive"]=!0,$scope.params[directiveName]=!0},this.setParams=function(key,value){$scope.params[key]=value},$scope.setDirectivesValues=function(resource){var sortBy;return resource?(sortBy=resource.sortBy||$scope.params.sortBy,sortBy=sortBy||resource.header[0].key,$scope.header={columns:resource.header,sortBy:sortBy,sortOrder:resource.sortOrder||$scope.params.sortOrder},$scope.rows=resource.rows,void($scope.pagination=resource.pagination||$scope.pagination)):!1},$scope.buildClientResource=function(){var fromRow,toRow,rowToShow,reverse,listSortBy;$scope.theadDirective&&(reverse="asc"===$scope.header.sortOrder?!1:!0,listSortBy=[function(item){return item[$scope.header.sortBy]}],$scope.header.columns[0].key!==$scope.header.sortBy&&listSortBy.push(function(item){return item[$scope.header.columns[0].key]}),$scope.rows=$filter("orderBy")($scope.rows,listSortBy,reverse)),$scope.paginationDirective&&($scope.pagination.page=$scope.params.page,$scope.pagination.count=$scope.params.count,$scope.pagination.size=$scope.rows.length,$scope.pagination.pages=Math.ceil($scope.rows.length/$scope.pagination.count),toRow=$scope.pagination.count*$scope.pagination.page,fromRow=toRow-$scope.pagination.count,fromRow>=0&&toRow>=0&&(rowToShow=$scope.rows.slice(fromRow,toRow),$scope.rows=rowToShow))},$scope.buildUrl=function(params,filters){var urlQuery,value;return urlQuery={},$scope.theadDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"sortBy"),urlQuery=tastyUtil.setProperty(urlQuery,params,"sortOrder")),$scope.paginationDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"page"),urlQuery=tastyUtil.setProperty(urlQuery,params,"count")),$attrs.filters&&(urlQuery=tastyUtil.joinObjects(urlQuery,filters)),Object.keys(urlQuery).map(function(key){return value=urlQuery[key],$scope.query[key]&&(key=$scope.query[key]),encodeURIComponent(key)+"="+encodeURIComponent(value)}).join("&")},$scope.updateClientSideResource=tastyUtil.debounce(function(){$scope.setDirectivesValues($scope.resource),$scope.buildClientResource()},100),$scope.updateServerSideResource=tastyUtil.debounce(function(){$scope.url=$scope.buildUrl($scope.params,$scope[$attrs.filters]),$scope.resourceCallback($scope.url).then(function(resource){$scope.setDirectivesValues(resource)})},100),$scope.initTable=function(){$scope.params.sortBy=void 0,$scope.params.sortOrder="asc",$scope.params.page=1,$scope.params.count=void 0,$scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource()},$attrs.filters&&$scope.$watch($attrs.filters,function(newValue,oldValue){newValue!==oldValue&&$scope.updateServerSideResource()},!0),$scope.$watch("params",function(newValue,oldValue){newValue!==oldValue&&($scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource())},!0),$scope.resource&&$scope.$parent.$watch($attrs.resource,function(newValue,oldValue){newValue!==oldValue&&($scope.resource=newValue,$scope.updateClientSideResource())},!0),$scope.initTable()}]).directive("tastyTable",function(){return{restrict:"A",scope:!0,controller:"TableController"}}).directive("tastyThead",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{notSortBy:"="},templateUrl:"template/table/head.html",link:function(scope,element,attrs,tastyTable){"use strict";tastyTable.activate("thead"),scope.fields={},scope.setFields=function(){var lenHeader,width,active,sortable;lenHeader=scope.header.columns.length,scope.header.columns.forEach(function(column){width=parseFloat((100/lenHeader).toFixed(2)),sortable=!0,active=!1,scope.notSortBy&&(sortable=scope.notSortBy.indexOf(column.key)<0),(column.key===scope.header.sortBy||"-"+column.key===scope.header.sortBy)&&(active=!0),scope.fields[column.key]={active:active,sortable:sortable,width:{width:width+"%"},sort:$filter("cleanFieldName")(column.key)}}),"dsc"===scope.header.sortOrder&&"-"!==scope.header.sortBy[0]&&(scope.header.sortBy="-"+scope.header.sortBy)},scope.sortBy=function(field){if(scope.notSortBy&&scope.notSortBy.indexOf(field.key)>=0)return!1;var fieldName;fieldName=$filter("cleanFieldName")(field.key),scope.header.sortBy==fieldName?(scope.header.sortBy="-"+fieldName,tastyTable.setParams("sortOrder","dsc")):(scope.header.sortBy=fieldName,tastyTable.setParams("sortOrder","asc")),tastyTable.setParams("sortBy",field.key)},scope.isSortUp=function(field){return void 0===scope.fields[field.key]?!1:scope.header.sortBy=="-"+scope.fields[field.key].sort},scope.isSortDown=function(field){return void 0===scope.fields[field.key]?!1:scope.header.sortBy==scope.fields[field.key].sort},tastyTable.$scope.$watch("header",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.header=newValue,scope.setFields())},!0)}}}]).controller("TablePaginationController",["$scope","$attrs","tableConfig",function($scope,$attrs,tableConfig){angular.isDefined($attrs.itemsPerPage)&&($scope.itemsPerPage=$scope.$parent[$attrs.itemsPerPage]),angular.isDefined($attrs.listItemsPerPage)&&($scope.listItemsPerPage=$scope.$parent[$attrs.listItemsPerPage]),$scope.itemsPerPage=$scope.itemsPerPage||tableConfig.itemsPerPage,$scope.listItemsPerPage=$scope.listItemsPerPage||tableConfig.listItemsPerPage}]).directive("tastyPagination",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{},templateUrl:"template/table/pagination.html",controller:"TablePaginationController",link:function(scope,element,attrs,tastyTable){"use strict";var getPage,setCount,setPaginationRange,setPreviousRange,setRemainingRange,setPaginationRanges;tastyTable.activate("pagination"),scope.pagination={},scope.pagMinRange=1,scope.pagMaxRange=1,getPage=function(numPage){tastyTable.setParams("page",numPage)},setCount=function(count){var maxItems,page;maxItems=count*scope.pagination.page,maxItems>scope.pagination.size&&(page=Math.ceil(scope.pagination.size/count),tastyTable.setParams("page",page)),tastyTable.setParams("count",count)},setPaginationRange=function(){var currentPage;currentPage=scope.pagination.page,currentPage>scope.pagination.pages&&(currentPage=scope.pagination.pages),scope.pagMinRange=currentPage-2>0?currentPage-2:1,scope.pagMaxRange=currentPage+2,scope.pagination.page=currentPage,setPaginationRanges()},setPreviousRange=function(){return scope.pagHideMinRange===!0||scope.pagMinRange<1?!1:(scope.pagMaxRange=scope.pagMinRange,scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setRemainingRange=function(){return scope.pagHideMaxRange===!0||scope.pagMaxRange>scope.pagination.pages?!1:(scope.pagMinRange=scope.pagMaxRange,scope.pagMaxRange=scope.pagMinRange+scope.itemsPerPage,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages),scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setPaginationRanges=function(){scope.pagMinRange=scope.pagMinRange>0?scope.pagMinRange:1,scope.pagMaxRange=scope.pagMinRange+5,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages+1),scope.pagHideMinRange=scope.pagMinRange<=1,scope.pagHideMaxRange=scope.pagMaxRange>=scope.pagination.pages;for(var i=2;i<scope.listItemsPerPage.length;i++)if(scope.pagination.size<scope.listItemsPerPage[i]){scope.listItemsPerPageShow=scope.listItemsPerPage.slice(0,i);break}scope.rangePage=$filter("range")([],scope.pagMinRange,scope.pagMaxRange)},scope.page={get:getPage,setCount:setCount,previous:setPreviousRange,remaining:setRemainingRange},tastyTable.$scope.$watch("pagination",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.pagination=newValue,setPaginationRange())},!0),scope.page.setCount(scope.itemsPerPage)}}}]); | ||
angular.module("ngTasty",["ngTasty.filter","ngTasty.service","ngTasty.table"]),angular.module("ngTasty.filter",["ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range"]),angular.module("ngTasty.filter.cleanFieldName",[]).filter("cleanFieldName",function(){return function(input){return input.replace(/[^a-zA-Z0-9-]+/g,"-").toLowerCase()}}),angular.module("ngTasty.filter.filterInt",[]).filter("filterInt",function(){return function(input){return/^(\-|\+)?([0-9]+|Infinity)$/.test(input)?Number(input):0/0}}),angular.module("ngTasty.filter.range",[]).filter("range",["$filter",function($filter){return function(input,start,stop,step){if(start=$filter("filterInt")(start),stop=$filter("filterInt")(stop),step=$filter("filterInt")(step),isNaN(start)&&(start=0),isNaN(stop)&&(stop=start,start=0),isNaN(step)&&(step=1),step>0&&start>=stop||0>step&&stop>=start)return[];for(var i=start;step>0?stop>i:i>stop;i+=step)input.push(i);return input}}]),angular.module("ngTasty.service",["ngTasty.service.tastyUtil","ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]),angular.module("ngTasty.service.tastyUtil",["ngTasty.service.debounce","ngTasty.service.setProperty","ngTasty.service.joinObjects"]).factory("tastyUtil",["debounce","setProperty","joinObjects",function(debounce,setProperty,joinObjects){return{debounce:debounce,setProperty:setProperty,joinObjects:joinObjects}}]),angular.module("ngTasty.service.debounce",[]).factory("debounce",["$timeout",function($timeout){return function(func,wait){var timeout;return function(){var context=this,args=arguments;$timeout.cancel(timeout),timeout=$timeout(function(){timeout=null,func.apply(context,args)},wait)}}}]),angular.module("ngTasty.service.setProperty",[]).factory("setProperty",function(){return function(objOne,objTwo,attrname){return"undefined"!=typeof objTwo[attrname]&&null!==objTwo[attrname]&&(objOne[attrname]=objTwo[attrname]),objOne}}),angular.module("ngTasty.service.joinObjects",[]).factory("joinObjects",["setProperty",function(setProperty){return function(objOne,objTwo){for(var attrname in objTwo)setProperty(objOne,objTwo,attrname);return objOne}}]),angular.module("ngTasty.table",["ngTasty.filter.cleanFieldName","ngTasty.filter.range","ngTasty.service.tastyUtil"]).constant("tableConfig",{query:{page:"page",count:"count",sortBy:"sort-by",sortOrder:"sort-order"},resource:void 0,resourceCallback:void 0,listItemsPerPage:[5,25,50,100],itemsPerPage:5}).controller("TableController",["$scope","$attrs","$timeout","$filter","tableConfig","tastyUtil",function($scope,$attrs,$timeout,$filter,tableConfig,tastyUtil){"use strict";if(this.$scope=$scope,$scope.query=tableConfig.query,$scope.resource=tableConfig.resource,$scope.resourceCallback=tableConfig.resourceCallback,$scope.clientSide=!0,$scope.url="",$scope.header={columns:[]},$scope.rows=[],$scope.params={},$scope.pagination={count:5,page:1,pages:1,size:0},$scope.theadDirective=!1,$scope.paginationDirective=!1,angular.isDefined($attrs.query)&&($scope.query=$scope.$parent[$attrs.query]),!angular.isDefined($attrs.resource)&&!angular.isDefined($attrs.resourceCallback))throw"AngularJS tastyTable directive: need the resource or resource-callback attribute";if(angular.isDefined($attrs.resource)){if($scope.resource=$scope.$parent[$attrs.resource],!angular.isObject($scope.resource))throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") it's not an object";if(!$scope.resource.header&&!$scope.resource.rows)throw"AngularJS tastyTable directive: the resource ("+$attrs.resource+") has the property header or rows undefined"}if(angular.isDefined($attrs.resourceCallback)){if($scope.resourceCallback=$scope.$parent[$attrs.resourceCallback],!angular.isFunction($scope.resourceCallback))throw"AngularJS tastyTable directive: the resource-callback ("+$attrs.resourceCallback+") it's not a function";$scope.clientSide=!1}this.activate=function(directiveName){$scope[directiveName+"Directive"]=!0,$scope.params[directiveName]=!0},this.setParams=function(key,value){$scope.params[key]=value},$scope.setDirectivesValues=function(resource){var sortBy;if(!angular.isObject(resource))throw"AngularJS tastyTable directive: the resource it's not an object";if(!resource.header&&!resource.rows)throw"AngularJS tastyTable directive: the resource has the property header or rows undefined";sortBy=resource.sortBy||$scope.params.sortBy,sortBy=sortBy||resource.header[0].key,$scope.header={columns:resource.header,sortBy:sortBy,sortOrder:resource.sortOrder||$scope.params.sortOrder},$scope.rows=resource.rows,$scope.pagination=resource.pagination||$scope.pagination},$scope.buildClientResource=function(){var fromRow,toRow,rowToShow,reverse,listSortBy;$scope.theadDirective&&(reverse="asc"===$scope.header.sortOrder?!1:!0,listSortBy=[function(item){return item[$scope.header.sortBy]}],$scope.header.columns[0].key!==$scope.header.sortBy&&listSortBy.push(function(item){return item[$scope.header.columns[0].key]}),$scope.rows=$filter("orderBy")($scope.rows,listSortBy,reverse)),$scope.paginationDirective&&($scope.pagination.page=$scope.params.page,$scope.pagination.count=$scope.params.count,$scope.pagination.size=$scope.rows.length,$scope.pagination.pages=Math.ceil($scope.rows.length/$scope.pagination.count),toRow=$scope.pagination.count*$scope.pagination.page,fromRow=toRow-$scope.pagination.count,fromRow>=0&&toRow>=0&&(rowToShow=$scope.rows.slice(fromRow,toRow),$scope.rows=rowToShow))},$scope.buildUrl=function(params,filters){var urlQuery,value;return urlQuery={},$scope.theadDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"sortBy"),urlQuery=tastyUtil.setProperty(urlQuery,params,"sortOrder")),$scope.paginationDirective&&(urlQuery=tastyUtil.setProperty(urlQuery,params,"page"),urlQuery=tastyUtil.setProperty(urlQuery,params,"count")),$attrs.filters&&(urlQuery=tastyUtil.joinObjects(urlQuery,filters)),Object.keys(urlQuery).map(function(key){return value=urlQuery[key],$scope.query[key]&&(key=$scope.query[key]),encodeURIComponent(key)+"="+encodeURIComponent(value)}).join("&")},$scope.updateClientSideResource=tastyUtil.debounce(function(){$scope.setDirectivesValues($scope.resource),$scope.buildClientResource()},100),$scope.updateServerSideResource=tastyUtil.debounce(function(){$scope.url=$scope.buildUrl($scope.params,$scope[$attrs.filters]),$scope.resourceCallback($scope.url,$scope.params).then(function(resource){$scope.setDirectivesValues(resource)})},100),$scope.initTable=function(){$scope.params.sortBy=void 0,$scope.params.sortOrder="asc",$scope.params.page=1,$scope.params.count=void 0,$scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource()},$attrs.filters&&$scope.$watch($attrs.filters,function(newValue,oldValue){newValue!==oldValue&&$scope.updateServerSideResource()},!0),$scope.$watchCollection("params",function(newValue,oldValue){newValue!==oldValue&&($scope.clientSide?$scope.updateClientSideResource():$scope.updateServerSideResource())}),$scope.resource&&$scope.$parent.$watch($attrs.resource,function(newValue,oldValue){newValue!==oldValue&&($scope.resource=newValue,$scope.updateClientSideResource())},!0),$scope.initTable()}]).directive("tastyTable",function(){return{restrict:"A",scope:!0,controller:"TableController"}}).directive("tastyThead",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{notSortBy:"="},templateUrl:"template/table/head.html",link:function(scope,element,attrs,tastyTable){"use strict";tastyTable.activate("thead"),scope.columns=[],scope.setColumns=function(){var lenHeader,width,active,sortable,sort;scope.columns=[],lenHeader=scope.header.columns.length,scope.header.columns.forEach(function(column){width=parseFloat((100/lenHeader).toFixed(2)),sortable=!0,active=!1,scope.notSortBy&&(sortable=scope.notSortBy.indexOf(column.key)<0),(column.key===scope.header.sortBy||"-"+column.key===scope.header.sortBy)&&(active=!0),sort=$filter("cleanFieldName")(column.key),scope.columns.push({key:column.key,name:column.name,active:active,sortable:sortable,width:{width:width+"%"},isSortUp:scope.header.sortBy==="-"+sort,isSortDown:scope.header.sortBy===sort})}),"dsc"===scope.header.sortOrder&&"-"!==scope.header.sortBy[0]&&(scope.header.sortBy="-"+scope.header.sortBy)},scope.sortBy=function(column){if(scope.notSortBy&&scope.notSortBy.indexOf(column.key)>=0)return!1;var columnName;columnName=$filter("cleanFieldName")(column.key),scope.header.sortBy==columnName?(scope.header.sortBy="-"+columnName,tastyTable.setParams("sortOrder","dsc")):(scope.header.sortBy=columnName,tastyTable.setParams("sortOrder","asc")),tastyTable.setParams("sortBy",column.key)},scope.classToShow=function(column){var listClassToShow=[];return column.sortable&&listClassToShow.push("sortable"),column.active&&listClassToShow.push("active"),listClassToShow},tastyTable.$scope.$watchCollection("header",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.header=newValue,scope.setColumns())})}}}]).controller("TablePaginationController",["$scope","$attrs","tableConfig",function($scope,$attrs,tableConfig){angular.isDefined($attrs.itemsPerPage)&&($scope.itemsPerPage=$scope.$parent[$attrs.itemsPerPage]),angular.isDefined($attrs.listItemsPerPage)&&($scope.listItemsPerPage=$scope.$parent[$attrs.listItemsPerPage]),$scope.itemsPerPage=$scope.itemsPerPage||tableConfig.itemsPerPage,$scope.listItemsPerPage=$scope.listItemsPerPage||tableConfig.listItemsPerPage}]).directive("tastyPagination",["$filter",function($filter){return{restrict:"AE",require:"^tastyTable",scope:{},templateUrl:"template/table/pagination.html",controller:"TablePaginationController",link:function(scope,element,attrs,tastyTable){"use strict";var getPage,setCount,setPaginationRange,setPreviousRange,setRemainingRange,setPaginationRanges;tastyTable.activate("pagination"),scope.pagination={},scope.pagMinRange=1,scope.pagMaxRange=1,getPage=function(numPage){tastyTable.setParams("page",numPage)},setCount=function(count){var maxItems,page;maxItems=count*scope.pagination.page,maxItems>scope.pagination.size&&(page=Math.ceil(scope.pagination.size/count),tastyTable.setParams("page",page)),tastyTable.setParams("count",count)},setPaginationRange=function(){var currentPage;currentPage=scope.pagination.page,currentPage>scope.pagination.pages&&(currentPage=scope.pagination.pages),scope.pagMinRange=currentPage-2>0?currentPage-2:1,scope.pagMaxRange=currentPage+2,scope.pagination.page=currentPage,setPaginationRanges()},setPreviousRange=function(){return scope.pagHideMinRange===!0||scope.pagMinRange<1?!1:(scope.pagMaxRange=scope.pagMinRange,scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setRemainingRange=function(){return scope.pagHideMaxRange===!0||scope.pagMaxRange>scope.pagination.pages?!1:(scope.pagMinRange=scope.pagMaxRange,scope.pagMaxRange=scope.pagMinRange+scope.itemsPerPage,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages),scope.pagMinRange=scope.pagMaxRange-scope.itemsPerPage,void setPaginationRanges())},setPaginationRanges=function(){scope.pagMinRange=scope.pagMinRange>0?scope.pagMinRange:1,scope.pagMaxRange=scope.pagMinRange+5,scope.pagMaxRange>scope.pagination.pages&&(scope.pagMaxRange=scope.pagination.pages+1),scope.pagHideMinRange=scope.pagMinRange<=1,scope.pagHideMaxRange=scope.pagMaxRange>=scope.pagination.pages,scope.classPageMinRange=scope.pagHideMinRange?"disabled":"",scope.classPageMaxRange=scope.pagHideMaxRange?"disabled":"";for(var i=2;i<scope.listItemsPerPage.length;i++)if(scope.pagination.size<scope.listItemsPerPage[i]){scope.listItemsPerPageShow=scope.listItemsPerPage.slice(0,i);break}scope.rangePage=$filter("range")([],scope.pagMinRange,scope.pagMaxRange)},scope.classPaginationCount=function(count){return count==scope.pagination.count?"active":""},scope.classNumPage=function(numPage){return numPage==scope.pagination.page?"active":!1},scope.page={get:getPage,setCount:setCount,previous:setPreviousRange,remaining:setRemainingRange},tastyTable.$scope.$watchCollection("pagination",function(newValue,oldValue){newValue&&newValue!==oldValue&&(scope.pagination=newValue,setPaginationRange())}),scope.page.setCount(scope.itemsPerPage)}}}]); |
{ | ||
"name": "ng-tasty", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "A lightweight, flexible, and tasty collection of reusable UI components for AngularJS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69025
1261