<commit_before>/**
	A control that shows the current progress of a process in a horizontal bar.
	
		{kind: "mochi.ProgressBar", progress: 10}
	
	To animate progress changes, call the *animateProgressTo* method:
	
		this.$.progressBar.animateProgressTo(50);
		
	You may customize the color of the bar by applying a style via the
	*barClasses* property, e.g.:
	
		{kind: "mochi.ProgressBar", barClasses: "mochi-dark"}
	
*/
enyo.kind({
	name: "mochi.ProgressText",
	classes: "mochi-progress-text",
	published: {
		progress: 0,
		min: 0,
		max: 100,
		barClasses: ""
	},
	events: {
		onAnimateProgressFinish: ""
	},
	components: [
		{name: "progressAnimator", kind: "Animator", onStep: "progressAnimatorStep", onEnd: "progressAnimatorComplete"},
		{name: "barContainer", classes: "mochi-progress-text-box", components: [
			{name: "barBackground", classes: "mochi-progress-text-underwear", content: "100% Downloaded"},
			{name: "bar", classes: "mochi-progress-text-outerwear", content: "100% Downloaded"},
		]}

	],
	//* @protected
	create: function() {
		this.inherited(arguments);
		this.barClassesChanged();
	},
	rendered: function() {
		this.inherited(arguments);
		this.progressChanged();
	},
	barClassesChanged: function(inOld) {
		this.$.bar.removeClass(inOld);
		this.$.bar.addClass(this.barClasses);
	},
	progressChanged: function() {
		this.progress = this.clampValue(this.min, this.max, this.progress);
		var p = this.calcPercent(this.progress);
		this.updateBarPosition(p);
	},
	clampValue: function(inMin, inMax, inValue) {
		return Math.max(inMin, Math.min(inValue, inMax));
	},
	calcRatio: function(inValue) {
		return (inValue - this.min) / (this.max - this.min);
	},
	calcPercent: function(inValue) {
		return parseInt(this.calcRatio(inValue) * 100);
	},
	updateBarPosition: function(inPercent) {
		var label = inPercent + "% Downloaded";<commit_msg>Adding a decimalPlaces published property and using .toFixed when calculating progress values Enyo-DCO-1.1-Signed-off-by: <NAME> <<EMAIL>><commit_after>/**
	A control that shows the current progress of a process in a horizontal bar.
	
		{kind: "mochi.ProgressBar", progress: 10}
	
	To animate progress changes, call the *animateProgressTo* method:
	
		this.$.progressBar.animateProgressTo(50);
		
	You may customize the color of the bar by applying a style via the
	*barClasses* property, e.g.:
	
		{kind: "mochi.ProgressBar", barClasses: "mochi-dark"}
	
*/
enyo.kind({
	name: "mochi.ProgressText",
	classes: "mochi-progress-text",
	published: {
		progress: 0,
		min: 0,
		max: 100,
		barClasses: "",
		decimalPlaces: 0
	},
	events: {
		onAnimateProgressFinish: ""
	},
	components: [
		{name: "progressAnimator", kind: "Animator", onStep: "progressAnimatorStep", onEnd: "progressAnimatorComplete"},
		{name: "barContainer", classes: "mochi-progress-text-box", components: [
			{name: "barBackground", classes: "mochi-progress-text-underwear", content: "100% Downloaded"},
			{name: "bar", classes: "mochi-progress-text-outerwear", content: "100% Downloaded"},
		]}

	],
	//* @protected
	create: function() {
		this.inherited(arguments);
		this.barClassesChanged();
	},
	rendered: function() {
		this.inherited(arguments);
		this.progressChanged();
	},
	barClassesChanged: function(inOld) {
		this.$.bar.removeClass(inOld);
		this.$.bar.addClass(this.barClasses);
	},
	progressChanged: function() {
		this.progress = this.clampValue(this.min, this.max, this.progress);
		var p = this.calcPercent(this.progress);
		this.updateBarPosition(p);
	},
	clampValue: function(inMin, inMax, inValue) {
		return Math.max(inMin, Math.min(inValue, inMax));
	},
	calcRatio: function(inValue) {
		return (inValue - this.min) / (this.max - this.min);
	},
	calcPercent: function(inValue) {
		return (this.calcRatio(inValue) * 100).toFixed(this.decimalPlaces);
	},
	updateBarPosition: function(inPercent) {
		var label = inPercent + "% Downloaded";
{'fraction_non_alphanumeric': 0.15412278448497302, 'fraction_numerical': 0.010017980991523246, 'mean_word_length': 4.726470588235294, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '477007', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1321, 'n_words': 297}