<commit_before>app.directive('uiButton', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			icon:'@',
			title:'@',
			url:'=',
			param:'='
		},
		template:function(element,atts){
			return  '<ul class="ztree" id="'+$.uuid()+'"></ul>';
		},
		replace : true,			
		transclude : false,
		link:function(scope,element,attr){

		}
	};
}); 
app.directive('uiSelect', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			url:'=',
			param:'=',
			data:'=',
			required:'='
		},
		template:function(element,atts){
			return  '<ul class="ztree" id="'+$.uuid()+'"></ul>';
		},
		replace : true,			
		transclude : false,
		link:function(scope,element,attr){

		}
	};
}); 
app.directive('uiPagination', function($http,$log,commonService) {
	
	//创建分页
	function createLimit(limit){
		//计算总页数
		var totalPageNum = Math.floor((limit.pageCount  +  limit.pageSize - 1) / limit.pageSize);  
		limit.totalPageNum = totalPageNum;
		//开始页码计算 
		var startPage = limit.pageNo - 5 < 1 ? 1 : limit.pageNo - 5;
		//结束页码
		var endPage = (limit.pageNo + 4 < 10 ? 10 : limit.pageNo + 4) > totalPageNum ? totalPageNum : (limit.pageNo + 4 < 10 ? 10 : limit.pageNo + 4);
		//页码
		var code = [];
		//第一页
		code.push({classs:'page-first' + (limit.pageNo == 1 ? ' disabled' :''),value:1,label:'«'});
		//前一页
		code.push({classs:'page-pre' + (limit.pageNo == 1 ? ' disabled' :'') ,value:limit.pageNo-1,label:'‹'});
		//设置当前页样式
		for(var idx = startPage ; idx <= endPage ; idx++){
			if(idx == limit.pageNo)
				code.push({classs:'page-number active',value:idx,label:idx});
			else
				code.push({classs:'page-number',value:idx,label:idx}); 
		}
		//下一页
		code.push({classs:'page-next' + (limit.pageNo == totalPageNum ? ' disabled' :''),value:limit.pageNo+1,label:'›'});
		//尾页
		code.push({classs:'page-last' + (limit.pageNo == totalPageNum ? ' disabled' :''),value:totalPageNum,label:'»'});
		scope.limit.code = code;
	}
	//查询数据
	function remote(scope){
		if(!_.isEmpty(scope.url)){
			commonService.post(scope.url,_.extend({pageSize:scope.limit.pageSize,pageNo:scope.limit.pageNo},scope.params),function(data){
				if(_.isUndefined(data.result)){
					$log.error("分页响应数据异常");
					return;
				}
				scope.limit.pageCount = data.result.totalElements;
				scope.data = data.result.content;
				createLimit(scope.limit);
			});
		}
	}

	return {
		restrict:'E',
		template:function(element,atts){
			return  "<div class='fixed-table-pagination' ng-if='limit.code.length'>"+
			"<div class='pull-left pagination-stats'>"+
			"	<div class='pagecount'><span>共{{limit.pageCount}}条 / {{limit.totalPageNum}}页</span></div>"+
			"	<div class='pagesize'>"+
			"		 <select ng-change='setPageSize(selected)' ng-model='selected' ng-options='x.id as x.value for x in options' class='form-control input-sm' ></select>"+
			"	</div>"+
			"</div>"+
			"<div class='pull-left pagination-detail'></div>"+
			"<div class='pull-right pagination'>"+
			"<ul class='pagination'>"+
			"<li class='{{item.classs}}' ng-repeat='item in limit.code' ng-click='go(item.value)'><a href='javascript:void(0)'>{{item.label}}</a></li>"+
			"</ul>"+
			"</div>"+
			"</div>";
		},
		scope:{
			id:"@",
			data:"=",
			url:"@",
			params:"="
		},
		transclude : false,
		link : function(scope,element,attr){
			//default
			scope.selected = 10;
			//define pagination
			scope.limit = {pageSize:scope.selected,pageNo:1};
			//initialize
			remote(scope);
			//catch parent broadcast goto
			scope.$on(scope.id, function(d,data) {  
				remote(scope);
			});  
			scope.go = function(v){
				//check data
				if(v < 1 || v > scope.limit.totalPageNum){
					return;
				}
				scope.limit.pageNo = v;
				remote(scope);
			};
			//num of page
			scope.options = [{id:10,value:10}, {id:20,value:20}, {id:30,value:30},{id:40,value:40}, {id:50,value:50} ];
			scope.setPageSize = function(option){
				scope.limit.pageSize = option;
				scope.limit.pageNo = 1;
				remote(scope);
			};
		}
	};
}); 
app.directive('uiTree', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			setting:'=',
			znodes:'=',
			callback:'&'
		},
		template:function(element,atts){
			return  '<ul class="ztree" id="'+$.uuid()+'"></ul>';
		},
		replace : true,			
		transclude : false,
		link:function(scope,element,attr){
			var ztree = $.fn.zTree.init($(element), scope.setting, scope.znodes);
			if(scope.callback){
				scope.callback({ztree:ztree});
			}
		}
	};
}); 
app.directive('uiDateime', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			value:'='
		},
		template:function(element,atts){
			return  '<div class="input-group"><input type="text" class="form-control input-sm" placeholder="yyyy-mm-dd" ng-model="value"></input>'+
			'<span class="input-group-addon bg-custom b-0 text-white"><i class="icon-calender"></i></span></div>';
		},
		replace : false,			
		transclude : false,
		link:function(scope,element,attr){
			$(element.find("input")).datepicker({
				format: 'yyyy-mm-dd',
				autoclose: true,
				language: 'zh-CN'
			});
		}
	};
}); 
//选择器
app.directive('uiSelector', function($http,$log,$uibModal) {
	return {
		restrict:'E',
		scope:{
			url:'@',
			data:"=",
			expand:'@', //扩展字段
			param:'=', //传给子页参数
			required:'='
		},
		template:function(element,atts){
			return  '<div class="app-search-sm">'
			+'<input type="text"  class="form-control input-sm" value="{{data[inputData.dataValue]}}"></input>'<commit_msg>1111111111111<commit_after>app.directive('uiButton', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			icon:'@',
			title:'@',
			url:'=',
			param:'='
		},
		template:function(element,atts){
			return  '<ul class="ztree" id="'+$.uuid()+'"></ul>';
		},
		replace : true,			
		transclude : false,
		link:function(scope,element,attr){

		}
	};
}); 
app.directive('uiSelect', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			url:'=',
			param:'=',
			data:'=',
			required:'='
		},
		template:function(element,atts){
			return  '<ul class="ztree" id="'+$.uuid()+'"></ul>';
		},
		replace : true,			
		transclude : false,
		link:function(scope,element,attr){

		}
	};
}); 
app.directive('uiPagination', function($http,$log,commonService) {
	
	//创建分页
	function createLimit(limit){
		//计算总页数
		var totalPageNum = Math.floor((limit.pageCount  +  limit.pageSize - 1) / limit.pageSize);  
		limit.totalPageNum = totalPageNum;
		//开始页码计算 
		var startPage = limit.pageNo - 5 < 1 ? 1 : limit.pageNo - 5;
		//结束页码
		var endPage = (limit.pageNo + 4 < 10 ? 10 : limit.pageNo + 4) > totalPageNum ? totalPageNum : (limit.pageNo + 4 < 10 ? 10 : limit.pageNo + 4);
		//页码
		var code = [];
		//第一页
		code.push({classs:'page-first' + (limit.pageNo == 1 ? ' disabled' :''),value:1,label:'«'});
		//前一页
		code.push({classs:'page-pre' + (limit.pageNo == 1 ? ' disabled' :'') ,value:limit.pageNo-1,label:'‹'});
		//设置当前页样式
		for(var idx = startPage ; idx <= endPage ; idx++){
			if(idx == limit.pageNo)
				code.push({classs:'page-number active',value:idx,label:idx});
			else
				code.push({classs:'page-number',value:idx,label:idx}); 
		}
		//下一页
		code.push({classs:'page-next' + (limit.pageNo == totalPageNum ? ' disabled' :''),value:limit.pageNo+1,label:'›'});
		//尾页
		code.push({classs:'page-last' + (limit.pageNo == totalPageNum ? ' disabled' :''),value:totalPageNum,label:'»'});
		scope.limit.code = code;
	}
	//查询数据
	function remote(scope){
		if(!_.isEmpty(scope.url)){
			commonService.post(scope.url,_.extend({pageSize:scope.limit.pageSize,pageNo:scope.limit.pageNo},scope.params),function(data){
				if(_.isUndefined(data.result)){
					$log.error("分页响应数据异常");
					return;
				}
				scope.limit.pageCount = data.result.totalElements;
				scope.data = data.result.content;
				createLimit(scope.limit);
			});
		}
	}

	return {
		restrict:'E',
		template:function(element,atts){
			return  "<div class='fixed-table-pagination' ng-if='limit.code.length'>"+
			"<div class='pull-left pagination-stats'>"+
			"	<div class='pagecount'><span>共{{limit.pageCount}}条 / {{limit.totalPageNum}}页</span></div>"+
			"	<div class='pagesize'>"+
			"		 <select ng-change='setPageSize(selected)' ng-model='selected' ng-options='x.id as x.value for x in options' class='form-control input-sm' ></select>"+
			"	</div>"+
			"</div>"+
			"<div class='pull-left pagination-detail'></div>"+
			"<div class='pull-right pagination'>"+
			"<ul class='pagination'>"+
			"<li class='{{item.classs}}' ng-repeat='item in limit.code' ng-click='go(item.value)'><a href='javascript:void(0)'>{{item.label}}</a></li>"+
			"</ul>"+
			"</div>"+
			"</div>";
		},
		scope:{
			id:"@",
			data:"=",
			url:"@",
			params:"="
		},
		transclude : false,
		link : function(scope,element,attr){
			//default
			scope.selected = 10;
			//define pagination
			scope.limit = {pageSize:scope.selected,pageNo:1};
			//initialize
			remote(scope);
			//catch parent broadcast goto
			scope.$on(scope.id, function(d,data) {  
				remote(scope);
			});  
			scope.go = function(v){
				//check data
				if(v < 1 || v > scope.limit.totalPageNum){
					return;
				}
				scope.limit.pageNo = v;
				remote(scope);
			};
			//num of page
			scope.options = [{id:10,value:10}, {id:20,value:20}, {id:30,value:30},{id:40,value:40}, {id:50,value:50} ];
			scope.setPageSize = function(option){
				scope.limit.pageSize = option;
				scope.limit.pageNo = 1;
				remote(scope);
			};
		}
	};
}); 
app.directive('uiTree', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			setting:'=',
			znodes:'=',
			callback:'&'
		},
		template:function(element,atts){
			return  '<ul class="ztree" id="'+$.uuid()+'"></ul>';
		},
		replace : true,			
		transclude : false,
		link:function(scope,element,attr){
			var ztree = $.fn.zTree.init($(element), scope.setting, scope.znodes);
			if(scope.callback){
				scope.callback({ztree:ztree});
			}
		}
	};
}); 
app.directive('uiDatetime', function($http,$log) {
	return {
		restrict:'E',
		scope:{
			value:'=',
			required:'='
		},
		template:function(element,atts){
			return  '<div class="input-group"><input type="text" class="form-control input-sm" placeholder="yyyy-mm-dd" ng-model="value"></input>'+
			'<span class="input-group-addon bg-custom b-0 text-white"><i class="icon-calender"></i></span></div>';
		},
		replace : false,			
		transclude : false,
		link:function(scope,element,attr){
			$(element.find("input")).datepicker({
				format: 'yyyy-mm-dd',
				autoclose: true,
				language: 'zh-CN'
			});
		}
	};
}); 
//选择器
app.directive('uiSelector', function($http,$log,$uibModal) {
	return {
		restrict:'E',
		scope:{
			url:'@',
			data:"=",
			expand:'@', //扩展字段
			param:'=', //传给子页参数
			required:'='
		},
		template:function(element,atts){
			return  '<div class="app-search-sm">'
			+'<input type="text"  class="form-control input-sm" value="{{data[inputData.dataValue]}}"></input>'
{'fraction_non_alphanumeric': 0.22111997033191175, 'fraction_numerical': 0.010291118116076395, 'mean_word_length': 3.7498899163364157, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4333743', 'n_tokens_mistral': 4709, 'n_tokens_neox': 4102, 'n_words': 630}