<commit_before>'use strict';

// Vendor
var $ = require('jquery');
require('select2');
// CSS
require('select2/dist/css/select2.css');

/**
 * Autocomplete Input-component
 * @prop {Array} val
 * @prop {Array} options
 */
var AutocompleteInput = {
	props: ['val', 'options', 'optgroups'],
	template: require('./AutocompleteInput.html'),
	data: function() {
		return { 
			selected: '' 
		};
	},
	/**
	 * Ready-hook appends change listener to input element and updates val prop on change
	 */
	ready: function() {
		this.create();
	},
	watch: {
		/**
		 * On update of options-prop, recreate element
		 */
		'options': function() {
			this.create();
		},
	},
	events: {
		/**
		 * Explicitly select an option
		 * @param {String} key
		 */
		'select-option': function(key) {
			var el = this.$el;
			$(el).val(key).trigger('change');
		}
	},
	methods: {
		/**
		 * Clears the value
		 */
		clear: function() {
			var el = this.$el;
			$(el).select2('val', '');
		},
		/**
		 * Create select2 autocomplete element. This function may also be called to re-create upon
		 * updated props
		 */
		create: function() {
			var el = this.$el;
			$(el).select2().on('change', function(e) {
	 			this.$set('val', $(el).select2('data').map(function(d) { return { value: d.id, text: d.text } }));
			}.bind(this));
		}
	}
};

module.exports = AutocompleteInput;<commit_msg>org URL query parameter can now contain many orgs<commit_after>'use strict';

// Vendor
var $ = require('jquery');
require('select2');
// CSS
require('select2/dist/css/select2.css');

/**
 * Autocomplete Input-component
 * @prop {Array} val
 * @prop {Array} options
 */
var AutocompleteInput = {
	props: ['val', 'options', 'optgroups'],
	template: require('./AutocompleteInput.html'),
	data: function() {
		return { 
			selected: '' 
		};
	},
	/**
	 * Ready-hook appends change listener to input element and updates val prop on change
	 */
	ready: function() {
		this.create();
	},
	watch: {
		/**
		 * On update of options-prop, recreate element
		 */
		'options': function() {
			this.create();
		},
	},
	events: {
		/**
		 * Explicitly select an option
		 * @param {String} key
		 */
		'select-option': function(key) {
			var el = this.$el;
			$(el).val(key.split(',')).trigger('change');
		}
	},
	methods: {
		/**
		 * Clears the value
		 */
		clear: function() {
			var el = this.$el;
			$(el).select2('val', '');
		},
		/**
		 * Create select2 autocomplete element. This function may also be called to re-create upon
		 * updated props
		 */
		create: function() {
			var el = this.$el;
			$(el).select2().on('change', function(e) {
	 			this.$set('val', $(el).select2('data').map(function(d) { return { value: d.id, text: d.text } }));
			}.bind(this));
		}
	}
};

module.exports = AutocompleteInput;
{'fraction_non_alphanumeric': 0.1929887965305385, 'fraction_numerical': 0.005059631369714492, 'mean_word_length': 3.094674556213018, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2563955', 'n_tokens_mistral': 1048, 'n_tokens_neox': 917, 'n_words': 227}