<commit_before>define(["dojo/_base/kernel", "dojo/_base/declare", "dojo/on", "dojo/query", "dojo/_base/html", 'xstyle/css!../resources/resize.css'], function(dojo, declare, listen){
	
return declare([], {
	resizeNode: null,
	minWidth: 40,	//minimum column width in px
	detectWidth: 5, //distance from cell edge that the resize mouse cursor changes
	gridWidth: null, //place holder for the grid width property
	setColumnWidth: function(colId, width){
	// Summary:
	//      calls grid's styleColumn function to add a style for the column
	// colId: String
	//      column id
	// width: Integer
	//      new width of the column
		
		this.styleColumn(colId, "width: " + width + 'px;');
		this.resize();
	},
	postCreate: function(){
		this.inherited(arguments);
		//console.log("this: ", this);
		var grid = this,
			body = document.body;
		grid.gridWidth = grid.headerNode.clientWidth;

		listen(grid.headerNode, "mousemove", function(e){
			//listens for the mouse to move over the header node
			if(grid._resizing || !grid._getCell(e)){return;}
			grid._mouseMove(e);
		});
		listen(grid, '.' + this.getCSSClass("header") + ":mouseout", function(e){ // should this be the mouse.leave event?
			//listens for the mouse to leave the headerNode (even though it doesn't do anything special if it does...)
			if(grid._resizing){return;}
			grid._readyToResize = false;
			dojo.removeClass(dojo.body(), 'dojoxGridxColumnResizing');
		});
		listen(grid, '.' + this.getCSSClass("header") + ":mousedown", function(e){
			// if ready to resize, allow resize
			if(!grid._readyToResize){return;}
				grid._mouseDown(e);
		});
		listen(body, "mousemove", function(e){
			// while resizing, update the position of the resizer bar
			if(!grid._resizing){return;}
			grid._updateResizerPosition(e);
		});
		listen(body, "mouseup", function(e){
			// if resizing and mouse button is release, fire mouseUp()
			if(!this._resizing){return;}
				grid._mouseUp(e);
		});
	},//end postCreate

	_mouseMove: function(e){
	// Summary:
	//      called when mouse moves over the header node
	// e: Object
	//      mouse move object

		if(this._isInResizeRange(e)){
			this._readyToResize = true;
			dojo.addClass(dojo.body(), 'dojoxGridxColumnResizing');
		}else{
			this._readyToResize = false;
			dojo.removeClass(dojo.body(), 'dojoxGridxColumnResizing');
		}
	},

	_mouseDown: function(e){
	// Summary:
	//      called when mouse button is pressed on the header
	// e: Object
	//      mousedown event object
		
		dojo.setSelectable(this.domNode, false);
		var grid = this;
		grid._resizing = true;
		grid._startX = e.clientX; //position of the target  
		grid._gridX = dojo.position(grid.bodyNode).x;//position of the grid in the body

		// show resizer inlined
		if(!grid._resizer){
			grid._resizer = dojo.create('div', {
				className: 'dojoxGridxColumnResizer'},
				grid.domNode, 'last');
			listen(grid._resizer, 'mouseup', function(e){
				grid._mouseUp(e);
			});
		}
		grid._resizer.style.display = 'block';
		grid._updateResizerPosition(e);
	},
	_mouseUp: function(e) {
	// Summary:
	//      called when mouse button is released
	// e: Object
	//      mouseup event object

		this._resizing = false;
		this._readyToResize = false;
		dojo.removeClass(dojo.body(), 'dojoxGridxColumnResizing');
		dojo.setSelectable(this.domNode, true);

		var cell = this._targetCell,
			delta = e.clientX - this._startX, //final change in position of resizer
			w = cell.offsetWidth + delta; //w is the new width after resize

		if(w < this.minWidth){
			w = this.minWidth;
		}
		this.setColumnWidth(cell.columnId, w);
		this._hideResizer();
	},
	_updateResizerPosition: function(e){
	// Summary:
	//      updates position of resizer bar as mouse moves
	// e: Object
	//      mousemove event object

		var delta = e.clientX - this._startX, //change from where user clicked to where they drag
			cell = this._targetCell,
			left = e.clientX - this._gridX;
		console.log("cell: ", cell);
		if(cell.offsetWidth + delta < this.minWidth){ 
			left = this._startX - this._gridX - (cell.offsetWidth - this.minWidth); 
		}
		this._resizer.style.left = left  + 'px';
	},
	_hideResizer: function(){
	// Summary:
	//      sets resizer bar display to none

		this._resizer.style.display = 'none';
	},
	
	_isInResizeRange: function(e){
	// Summary:
	//      checks if mouse is within 5px of the edge of the header cell
	// e: Object
	//      mousemove event object

		var cell = this._getCell(e);<commit_msg>removed log<commit_after>define(["dojo/_base/kernel", "dojo/_base/declare", "dojo/on", "dojo/query", "dojo/_base/html", 'xstyle/css!../resources/resize.css'], function(dojo, declare, listen){
	
return declare([], {
	resizeNode: null,
	minWidth: 40,	//minimum column width in px
	detectWidth: 5, //distance from cell edge that the resize mouse cursor changes
	gridWidth: null, //place holder for the grid width property
	setColumnWidth: function(colId, width){
	// Summary:
	//      calls grid's styleColumn function to add a style for the column
	// colId: String
	//      column id
	// width: Integer
	//      new width of the column
		
		this.styleColumn(colId, "width: " + width + 'px;');
		this.resize();
	},
	postCreate: function(){
		this.inherited(arguments);
		//console.log("this: ", this);
		var grid = this,
			body = document.body;
		grid.gridWidth = grid.headerNode.clientWidth;

		listen(grid.headerNode, "mousemove", function(e){
			//listens for the mouse to move over the header node
			if(grid._resizing || !grid._getCell(e)){return;}
			grid._mouseMove(e);
		});
		listen(grid, '.' + this.getCSSClass("header") + ":mouseout", function(e){ // should this be the mouse.leave event?
			//listens for the mouse to leave the headerNode (even though it doesn't do anything special if it does...)
			if(grid._resizing){return;}
			grid._readyToResize = false;
			dojo.removeClass(dojo.body(), 'dojoxGridxColumnResizing');
		});
		listen(grid, '.' + this.getCSSClass("header") + ":mousedown", function(e){
			// if ready to resize, allow resize
			if(!grid._readyToResize){return;}
				grid._mouseDown(e);
		});
		listen(body, "mousemove", function(e){
			// while resizing, update the position of the resizer bar
			if(!grid._resizing){return;}
			grid._updateResizerPosition(e);
		});
		listen(body, "mouseup", function(e){
			// if resizing and mouse button is release, fire mouseUp()
			if(!this._resizing){return;}
				grid._mouseUp(e);
		});
	},//end postCreate

	_mouseMove: function(e){
	// Summary:
	//      called when mouse moves over the header node
	// e: Object
	//      mouse move object

		if(this._isInResizeRange(e)){
			this._readyToResize = true;
			dojo.addClass(dojo.body(), 'dojoxGridxColumnResizing');
		}else{
			this._readyToResize = false;
			dojo.removeClass(dojo.body(), 'dojoxGridxColumnResizing');
		}
	},

	_mouseDown: function(e){
	// Summary:
	//      called when mouse button is pressed on the header
	// e: Object
	//      mousedown event object
		
		dojo.setSelectable(this.domNode, false);
		var grid = this;
		grid._resizing = true;
		grid._startX = e.clientX; //position of the target  
		grid._gridX = dojo.position(grid.bodyNode).x;//position of the grid in the body

		// show resizer inlined
		if(!grid._resizer){
			grid._resizer = dojo.create('div', {
				className: 'dojoxGridxColumnResizer'},
				grid.domNode, 'last');
			listen(grid._resizer, 'mouseup', function(e){
				grid._mouseUp(e);
			});
		}
		grid._resizer.style.display = 'block';
		grid._updateResizerPosition(e);
	},
	_mouseUp: function(e) {
	// Summary:
	//      called when mouse button is released
	// e: Object
	//      mouseup event object

		this._resizing = false;
		this._readyToResize = false;
		dojo.removeClass(dojo.body(), 'dojoxGridxColumnResizing');
		dojo.setSelectable(this.domNode, true);

		var cell = this._targetCell,
			delta = e.clientX - this._startX, //final change in position of resizer
			w = cell.offsetWidth + delta; //w is the new width after resize

		if(w < this.minWidth){
			w = this.minWidth;
		}
		this.setColumnWidth(cell.columnId, w);
		this._hideResizer();
	},
	_updateResizerPosition: function(e){
	// Summary:
	//      updates position of resizer bar as mouse moves
	// e: Object
	//      mousemove event object

		var delta = e.clientX - this._startX, //change from where user clicked to where they drag
			cell = this._targetCell,
			left = e.clientX - this._gridX;
		
		if(cell.offsetWidth + delta < this.minWidth){ 
			left = this._startX - this._gridX - (cell.offsetWidth - this.minWidth); 
		}
		this._resizer.style.left = left  + 'px';
	},
	_hideResizer: function(){
	// Summary:
	//      sets resizer bar display to none

		this._resizer.style.display = 'none';
	},
	
	_isInResizeRange: function(e){
	// Summary:
	//      checks if mouse is within 5px of the edge of the header cell
	// e: Object
	//      mousemove event object

		var cell = this._getCell(e);
{'fraction_non_alphanumeric': 0.14076905779176974, 'fraction_numerical': 0.0008994827973914999, 'mean_word_length': 3.341142020497804, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 3, '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': '3197000', 'n_tokens_mistral': 3209, 'n_tokens_neox': 2931, 'n_words': 776}