<commit_before>/*
 * This file is part of the Tabulator package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

(function(){

	'use strict';

	$.widget("ui.tabulator", {

	data:[],//array to hold data for table
	activeData:[],//array to hold data that is active in the DOM

	firstRender:true, //layout table widths correctly on first render
	mouseDrag:false, //mouse drag tracker;
	mouseDragWidth:false, //starting width of colum on mouse drag
	mouseDragElement:false, //column being dragged
	mouseDragOut:false, //catch to prevent mouseup on col drag triggering click on sort

	sortCurCol:null,//column name of currently sorted column
	sortCurDir:null,//column name of currently sorted column

	filterField:null, //field to be filtered on data render
	filterValue:null, //value to match on filter
	filterType:null, //filter type

	paginationCurrentPage:1, // pagination page
	paginationMaxPage:1, // pagination maxpage

	progressiveRenderTimer:null, //timer for progressiver rendering

	loaderDiv: $("<div class='tablulator-loader'><div class='tabulator-loader-msg'></div></div>"), //loader blockout div

	//setup options
	options: {

		colMinWidth:"40px", //minimum global width for a column
		colResizable:true, //resizable columns

		height:false, //height of tabulator
		fitColumns:false, //fit colums to width of screen;

		movableCols:false, //enable movable columns
		movableRows:false, //enable movable rows
		movableRowHandle:"<div style='margin:0 10%; width:80%; height:3px; background:#666;'></div><div style='margin:0 10%; width:80%; height:3px; background:#666; margin-top:2px;'></div><div style='margin:0 10%; width:80%; height:3px; background:#666; margin-top:2px;'></div>", //handle for movable rows

		columnLayoutCookie:false, //store cookie with column _styles
		columnLayoutCookieID:"", //id for stored cookie

		pagination:false, //enable pagination
		paginationSize:false, //size of pages
		paginationAjax:false, //paginate internal or via ajax
		paginationElement:false, //element to hold pagination numbers

		progressiveRender:true, //enable progressive rendering
		progressiveRenderSize:200, //block size for progressive rendering
		progressiveRenderPeriod:100, //time between renders

		tooltips: false, //Tool tip value

		columns:[],//store for colum header info

		index:"id",

		sortable:true, //global default for sorting
		dateFormat: "dd/mm/yyyy", //date format to be used for sorting

		sortBy:"id", //defualt column to sort by
		sortDir:"desc", //default sort direction

		groupBy:false, //enable table grouping and set field to group by
		groupHeader:function(value, count, data){ //header layout function
			return value + "<span style='color:#d00; margin-left:10px;'>(" + count + " item)</span>";
		},

		editBoxColor:"#1D68CD", //color for edit boxes

		rowFormatter:false, //row formatter callback

		addRowPos:"bottom", //position to insert blank rows, top|bottom

		selectable:true, //highlight rows on hover

		ajaxURL:false, //url for ajax loading
		ajaxParams:{}, //url for ajax loading

		showLoader:true, //show loader while data loading
		loader:"<div class='tabulator-loading'>Loading Data</div>", //loader element
		loaderError:"<div class='tabulator-error'>Loading Error</div>", //loader element

		rowClick:function(){}, //do action on row click
		rowAdded:function(){}, //do action on row add
		rowEdit:function(){}, //do action on row edit
		rowDelete:function(){}, //do action on row delete
		rowContext:function(){}, //context menu action
		dataLoaded:function(){},  //callback for when data has been Loaded
		rowMoved:function(){},  //callback for when row has moved
		colMoved:function(){},  //callback for when column has moved
	},

	//constructor
	_create: function() {
		var self = this;
		var options = self.options;
		var element = self.element;

		options.colMinWidth = isNaN(options.colMinWidth) ? options.colMinWidth : options.colMinWidth + "px";

		if(options.height){
			options.height = isNaN(options.height) ? options.height : options.height + "px";
			element.css({"height": options.height});
		}

		element.addClass("tabulator");

		self.header = $("<div class='tabulator-header'></div>")

		self.tableHolder = $("<div class='tabulator-tableHolder'></div>");

		self.tableHolder.scroll(function(){
			self.header.css({"margin-left": "-1" * $(this).scrollLeft()});
		});

		//create scrollable table holder
		self.table = $("<div class='tabulator-table'></div>");


		//build pagination footer if needed
		if(options.pagination){

			if(!options.paginationElement){
				options.paginationElement = $("<div class='tabulator-footer'></div>");
				self.footer = options.paginationElement;
			}

			self.paginator = $("<span class='tabulator-paginator'><span class='tabulator-page' data-page='first'>First</span><span class='tabulator-page' data-page='prev'>Prev</span><span class='tabulator-pages'></span><span class='tabulator-page' data-page='next'>Next</span><span class='tabulator-page' data-page='last'>Last</span></span>");

			self.paginator.on("click", ".tabulator-page", function(){
				if(!$(this).hasClass("disabled")){
					self.setPage($(this).data("page"));
				}
			});

			options.paginationElement.append(self.paginator);
		}

		//layout columns
		if(options.columnLayoutCookie){
			self._getColCookie();
		}else{
			self._colLayout();
		}

	},

	//set options
	_setOption: function(option, value) {
		$.Widget.prototype._setOption.apply( this, arguments );
	},

	//show loader blockout div
	_showLoader:function(self, msg){
		if(self.options.showLoader){
			$(".tabulator-loader-msg", self.loaderDiv).empty().append(msg);
			$(".tabulator-loader-msg", self.loaderDiv).css({"margin-top":(self.element.innerHeight() / 2) - ($(".tabulator-loader-msg", self.loaderDiv).outerHeight()/2)})
			self.element.append(self.loaderDiv);
		}
	},

	_hideLoader:function(self){
		$(".tablulator-loader", self.element).remove();
	},

	//handle cell data change
	_cellDataChange: function(cell, value){

		var self = this;
		var row = cell.closest(".tabulator-row");

		cell.removeClass("tabulator-editing");

		//update cell data value
		cell.data("value", value);
<commit_msg>removed obsolete editBoxColor option<commit_after>/*
 * This file is part of the Tabulator package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

(function(){

	'use strict';

	$.widget("ui.tabulator", {

	data:[],//array to hold data for table
	activeData:[],//array to hold data that is active in the DOM

	firstRender:true, //layout table widths correctly on first render
	mouseDrag:false, //mouse drag tracker;
	mouseDragWidth:false, //starting width of colum on mouse drag
	mouseDragElement:false, //column being dragged
	mouseDragOut:false, //catch to prevent mouseup on col drag triggering click on sort

	sortCurCol:null,//column name of currently sorted column
	sortCurDir:null,//column name of currently sorted column

	filterField:null, //field to be filtered on data render
	filterValue:null, //value to match on filter
	filterType:null, //filter type

	paginationCurrentPage:1, // pagination page
	paginationMaxPage:1, // pagination maxpage

	progressiveRenderTimer:null, //timer for progressiver rendering

	loaderDiv: $("<div class='tablulator-loader'><div class='tabulator-loader-msg'></div></div>"), //loader blockout div

	//setup options
	options: {

		colMinWidth:"40px", //minimum global width for a column
		colResizable:true, //resizable columns

		height:false, //height of tabulator
		fitColumns:false, //fit colums to width of screen;

		movableCols:false, //enable movable columns
		movableRows:false, //enable movable rows
		movableRowHandle:"<div style='margin:0 10%; width:80%; height:3px; background:#666;'></div><div style='margin:0 10%; width:80%; height:3px; background:#666; margin-top:2px;'></div><div style='margin:0 10%; width:80%; height:3px; background:#666; margin-top:2px;'></div>", //handle for movable rows

		columnLayoutCookie:false, //store cookie with column _styles
		columnLayoutCookieID:"", //id for stored cookie

		pagination:false, //enable pagination
		paginationSize:false, //size of pages
		paginationAjax:false, //paginate internal or via ajax
		paginationElement:false, //element to hold pagination numbers

		progressiveRender:true, //enable progressive rendering
		progressiveRenderSize:200, //block size for progressive rendering
		progressiveRenderPeriod:100, //time between renders

		tooltips: false, //Tool tip value

		columns:[],//store for colum header info

		index:"id",

		sortable:true, //global default for sorting
		dateFormat: "dd/mm/yyyy", //date format to be used for sorting

		sortBy:"id", //defualt column to sort by
		sortDir:"desc", //default sort direction

		groupBy:false, //enable table grouping and set field to group by
		groupHeader:function(value, count, data){ //header layout function
			return value + "<span style='color:#d00; margin-left:10px;'>(" + count + " item)</span>";
		},

		rowFormatter:false, //row formatter callback

		addRowPos:"bottom", //position to insert blank rows, top|bottom

		selectable:true, //highlight rows on hover

		ajaxURL:false, //url for ajax loading
		ajaxParams:{}, //url for ajax loading

		showLoader:true, //show loader while data loading
		loader:"<div class='tabulator-loading'>Loading Data</div>", //loader element
		loaderError:"<div class='tabulator-error'>Loading Error</div>", //loader element

		rowClick:function(){}, //do action on row click
		rowAdded:function(){}, //do action on row add
		rowEdit:function(){}, //do action on row edit
		rowDelete:function(){}, //do action on row delete
		rowContext:function(){}, //context menu action
		dataLoaded:function(){},  //callback for when data has been Loaded
		rowMoved:function(){},  //callback for when row has moved
		colMoved:function(){},  //callback for when column has moved
	},

	//constructor
	_create: function() {
		var self = this;
		var options = self.options;
		var element = self.element;

		options.colMinWidth = isNaN(options.colMinWidth) ? options.colMinWidth : options.colMinWidth + "px";

		if(options.height){
			options.height = isNaN(options.height) ? options.height : options.height + "px";
			element.css({"height": options.height});
		}

		element.addClass("tabulator");

		self.header = $("<div class='tabulator-header'></div>")

		self.tableHolder = $("<div class='tabulator-tableHolder'></div>");

		self.tableHolder.scroll(function(){
			self.header.css({"margin-left": "-1" * $(this).scrollLeft()});
		});

		//create scrollable table holder
		self.table = $("<div class='tabulator-table'></div>");


		//build pagination footer if needed
		if(options.pagination){

			if(!options.paginationElement){
				options.paginationElement = $("<div class='tabulator-footer'></div>");
				self.footer = options.paginationElement;
			}

			self.paginator = $("<span class='tabulator-paginator'><span class='tabulator-page' data-page='first'>First</span><span class='tabulator-page' data-page='prev'>Prev</span><span class='tabulator-pages'></span><span class='tabulator-page' data-page='next'>Next</span><span class='tabulator-page' data-page='last'>Last</span></span>");

			self.paginator.on("click", ".tabulator-page", function(){
				if(!$(this).hasClass("disabled")){
					self.setPage($(this).data("page"));
				}
			});

			options.paginationElement.append(self.paginator);
		}

		//layout columns
		if(options.columnLayoutCookie){
			self._getColCookie();
		}else{
			self._colLayout();
		}

	},

	//set options
	_setOption: function(option, value) {
		$.Widget.prototype._setOption.apply( this, arguments );


	},

	//show loader blockout div
	_showLoader:function(self, msg){
		if(self.options.showLoader){
			$(".tabulator-loader-msg", self.loaderDiv).empty().append(msg);
			$(".tabulator-loader-msg", self.loaderDiv).css({"margin-top":(self.element.innerHeight() / 2) - ($(".tabulator-loader-msg", self.loaderDiv).outerHeight()/2)})
			self.element.append(self.loaderDiv);
		}
	},

	_hideLoader:function(self){
		$(".tablulator-loader", self.element).remove();
	},

	//handle cell data change
	_cellDataChange: function(cell, value){

		var self = this;
		var row = cell.closest(".tabulator-row");

		cell.removeClass("tabulator-editing");

		//update cell data value
		cell.data("value", value);

{'fraction_non_alphanumeric': 0.15190784737221022, 'fraction_numerical': 0.007599392048636109, 'mean_word_length': 4.507488986784141, 'pattern_counts': {'":': 6, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '1719562', 'n_tokens_mistral': 4127, 'n_tokens_neox': 3697, 'n_words': 1022}