Commit 7090d432 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request redmic-project/client/widgets!7
parents 185c09e7 280a2d8a
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
{
  "name": "Widgets",
  "version": "0.10.1",
  "author": "Observatorio Ambiental Granadilla",
  "homepage": "https://redmic.es",
  "name": "redmic-widgets",
  "version": "0.21.0",
  "author": "REDMIC",
  "homepage": "https://gitlab.com/redmic-project/client/widgets/blob/master/README.md",
  "description": "Colección de widgets para REDMIC",
  "contributors": [
    {
      "name": "Ignacio Lorenzo García",
      "email": "nacho@oag-fundacion.org"
      "name": "Ignacio Lorenzo García"
    },
    {
      "name": "Pedro E. Trujillo Brito",
@@ -18,13 +17,12 @@
      "email": "noel@redmic.es"
    },
    {
      "name": "Carlos Alberto González Carballo",
      "email": "carlos@redmic.es"
      "name": "Carlos Alberto González Carballo"
    }
  ],
  "repository": {
    "type": "git",
    "url": "http://git.redmic.net/redmic-client/widgets.git"
    "url": "https://gitlab.com/redmic-project/client/widgets.git"
  },
  "private": true,
  "scripts": {

src/app/ContainerFacets.js

deleted100644 → 0
+0 −167
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dijit/_WidgetBase"
	, "dojo/_base/lang"
	, "dojo/Evented"
	, "./Facet"
], function(
	declare
	, _WidgetBase
	, lang
	, Evented
	, Facet
) {

	return declare([_WidgetBase, Evented], {

		"class": "containerFacets",

		constructor: function(args){

			this.config = {
				aggs: null,
				openFacets: false,
				order: null,
				instance: {},
				i18n: null,
				events: {
					CONFIG_CHANGED: "configChanged",
					UPDATE_QUERY: "updateQuery",
					UPDATE_CONSULT: "updateConsult"
				}
			};

			lang.mixin(this, this.config, args);

			this.on(this.events.CONFIG_CHANGED, this._render);

			this.query = {};
		},

		postCreate: function() {

			this.domNode.removeAttribute('widgetId');

			this.inherited(arguments);
		},

		setConfig: function(config) {

			this.config = config;
			this.emit(this.events.CONFIG_CHANGED, config);
		},

		setI18n: function(i18n) {

			this.i18n = i18n;
		},

		_render: function() {

			var item ;

			if (Object.keys(this.instance).length !== 0) {
				for (item in this.instance) {

					this.instance[item].termSelection = this.instance[item].widget.termSelection;
				}
			}

			this._cleanChildrenNode();

			for (var i = 0; i < this.order.length; i++) {
				item = this.order[i];

				var content = this.config.aggregations[item],
					open;

				if (!content) {
					continue;
				}

				if (!content.buckets) {
					content = content[item];
				}

				if (this.instance && this.instance[item] && (this.instance[item].termSelection.length != 0)) {
					open = true;
				} else if (this.aggs && this.aggs[item] && this.aggs[item].open) {
					open = this.aggs[item].open;
				} else {
					open = this.openFacets;
				}

				var widget = new Facet({
						termSelection: (this.instance && this.instance[item]) ? this.instance[item].termSelection : [],
						label: item,
						termsFieldFacet: (this.aggs && this.aggs[item]) ? this.aggs[item].terms.field : item,
						title: (this.i18n && this.i18n[item]) ? this.i18n[item] : item,
						i18n: this.i18n,
						open: open,
						config: content
					}).placeAt(this.domNode);

				this.instance[item] = {
					'widget': widget,
					'termSelection': []
				};

				if (widget.termSelection.length != 0) {
					widget.emit(widget.events.TERMS_CHANGED);
				}

				widget.on(this.events.UPDATE_QUERY, lang.hitch(this, this.updateQuery));
			}
		},

		_cleanChildrenNode: function() {

			while (this.domNode.firstChild) {
				this.domNode.removeChild(this.domNode.firstChild);
			}
		},

		updateQuery: function(queryTerm, title) {

			queryTerm ? this.add(title, queryTerm) : this.remove(title);

			this.emit(this.events.UPDATE_CONSULT, this.query);
		},

		add: function(title, queryTerm) {

			this.query[title] = queryTerm;
		},

		remove: function(title) {

			delete this.query[title];
		},

		setPrefixFieldFacet: function(/*String*/ prefixFieldFacet) {

			this.prefixFieldFacet = prefixFieldFacet;
		},

		setSuffixFieldFacet: function(/*String*/ suffixFieldFacet) {

			this.suffixFieldFacet = suffixFieldFacet;
		},

		setFieldFacets: function(/*json*/ fieldFacet) {

			this.fieldFacet = fieldFacet;
		},

		setOrder: function(/*json*/ order) {

			this.order = order;
		},

		setAggs: function(/*json*/ aggs) {

			this.aggs = aggs;
			this.setOrder(Object.keys(aggs));
		}
	});
});
+82 −7
Original line number Diff line number Diff line
@@ -3,12 +3,14 @@ define([
	, "dijit/TitlePane"
	, "dojo/_base/lang"
	, "dojo/Evented"
	, 'dojo/query'
	, "put-selector/put"
], function(
	declare
	, TitlePane
	, lang
	, Evented
	, query
	, put
) {

@@ -17,12 +19,21 @@ define([
		constructor: function(args) {

			this.config = {
				maxInitialEntries: 5,
				termsFieldFacet: null,
				termSelection: [],
				bucketsKeys: [],
				facetsEntriesContainerClass: 'dijitTitlePaneContentOuter',
				collapseEntriesClass: 'collapseEntries',
				collapseToggleClass: 'collapseToggle',
				hiddenClass: 'hidden',
				events: {
					TERMS_CHANGED: "termsChanged",
					UPDATE_QUERY: "updateQuery"
					UPDATE_QUERY: "updateQuery",
					SHOW_MORE: 'showMore',
					SHOW_LESS: 'showLess',
					OPEN: 'open',
					CLOSE: 'close'
				}
			};

@@ -38,6 +49,68 @@ define([
			this.domNode.removeAttribute('widgetId');

			this.inherited(arguments);

			if (this.maxInitialEntries > 0) {
				this._evaluateNumberOfBuckets();
			}
		},

		_onTitleClick: function() {

			this.inherited(arguments);

			this._evaluateOpenStatus();

			var evt = this.open ? 'OPEN' : 'CLOSE';
			this.emit(this.events[evt], this.label);
		},

		_evaluateNumberOfBuckets: function() {

			var buckets = this.config.buckets;
			if (buckets.length > this.maxInitialEntries) {
				this._outerNode = query('.' + this.facetsEntriesContainerClass, this.domNode)[0];

				var toggleText;
				if (this.expanded) {
					toggleText = this.i18n.showLess;
				} else {
					toggleText = this.i18n.showMore;
					put(this._outerNode, '.' + this.collapseEntriesClass);
				}

				this._toggleNode = put(this.domNode, 'span.' + this.collapseToggleClass);
				this._setToggleShowText(toggleText);
				this._toggleNode.onclick = lang.hitch(this, this._onToggleShowMore);

				this._evaluateOpenStatus();
			}
		},

		_evaluateOpenStatus: function() {

			put(this._toggleNode, (this.open ? '!' : '.') + this.hiddenClass);
		},

		_onToggleShowMore: function() {

			if (query('.' + this.collapseEntriesClass, this.domNode).length) {
				put(this._outerNode, '!' + this.collapseEntriesClass);
				this._setToggleShowText(this.i18n.showLess);
				this.emit(this.events.SHOW_MORE, this.label);
			} else {
				put(this._outerNode, '.' + this.collapseEntriesClass);
				this._setToggleShowText(this.i18n.showMore);
				this.emit(this.events.SHOW_LESS);
			}
		},

		_setToggleShowText: function(text) {

			var total = this.config.buckets.length,
				fullText = text + ' (' + total + ')';

			this._toggleNode.innerHTML = fullText;
		},

		_render: function() {
@@ -64,7 +137,7 @@ define([

		_insertBucket: function(bucket) {

			var label,
			var labelText,
				key = bucket.key;

			if (this.i18n && this.i18n[key]) {
@@ -74,10 +147,12 @@ define([
			}

			var id_random = this._generateIDRandom(),
			    bucketNode = put(this.containerBucketsNode, "div.containerBucket");
			    labelNode = put(bucketNode, "label[for=$][title=$].inlineRow.labelBucket", id_random, labelText, labelText),
			    put(bucketNode, "label[for=$].labelBucket", id_random, "(" + bucket.doc_count + ")"),
			    checkBoxNode = put(labelNode, "-input[type='checkbox'][id=$][data-redmic-id=$]", id_random, key);
				bucketNode = put(this.containerBucketsNode, "div.containerBucket"),
				labelNode = put(bucketNode, "label[for=$][title=$].inlineRow.labelBucket", id_random, labelText, labelText);

			put(bucketNode, "label[for=$].labelBucket", id_random, "(" + bucket.doc_count + ")");

			var checkBoxNode = put(labelNode, "-input[type='checkbox'][id=$][data-redmic-id=$]", id_random, key);

			checkBoxNode.onchange = lang.hitch(this, this._eventClickCheckBox, checkBoxNode.getAttribute('data-redmic-id'));

+25 −25
Original line number Diff line number Diff line
@@ -48,6 +48,10 @@ define([
			this.config = {
				idProperty: 'id',
				labelAttr: 'name',
				hiddenClass: 'hidden',
				innerButtonsContainerClass: 'innerButtons',
				removeTextButtonClass: 'clearTextButton',
				suggestionsContainerClass: 'suggestions',
				value: null,
				required: false,
				label: '',
@@ -143,12 +147,16 @@ define([
		_createFilteringSelect: function() {

			this.filteringSelectNode = put(this.domNode, "div.textSearch");

			this.inputAutocompleteNode = put(this.filteringSelectNode, "input[type=search].autocomplete");
			this.inputNode = put(this.filteringSelectNode, "input[type=search].inputSearch");
			this.removeTextNode = put(this.filteringSelectNode, "i.fa.fa-times.hidden");
			this.inputNode = put(this.filteringSelectNode, "input[type=search]");

			var innerButtonsContainer = put(this.filteringSelectNode, 'div.' + this.innerButtonsContainerClass);

			this.removeTextNode = put(innerButtonsContainer, 'i.' + this.removeTextButtonClass + '.' +
				this.hiddenClass + '[title=' + this.i18n.remove + ']');

			this.inputNode.onfocus = lang.hitch(this, this._activeInput);
			this.inputNode.onblur = lang.hitch(this, this._desactiveInput);
			this.inputNode.onblur = lang.hitch(this, this._onInputBlur);

			this.inputNode.onkeyup = lang.hitch(this, this._eventChangeText);
			this.inputNode.onkeydown = lang.hitch(this, this._eventCloseOnKeyDown);
@@ -261,12 +269,12 @@ define([

		_activeRemoveText: function() {

			put(this.removeTextNode, "!hidden");
			put(this.removeTextNode, '!' + this.hiddenClass);
		},

		_desactiveRemoveText: function() {

			put(this.removeTextNode, ".hidden");
			put(this.removeTextNode, '.' + this.hiddenClass);
		},

		_getValueInput: function() {
@@ -292,9 +300,12 @@ define([
		_selectResult: function() {

			if (this.focusIn !== -1) {
				if (this.focusIn.getAttribute('data-redmic-id')) {
				var itemId = this.focusIn.getAttribute('data-redmic-id'),
					itemValue = isNaN(itemId) ? itemId : parseInt(itemId, 10);

				if (itemId) {
					this._activeRemoveText();
					this.set("value", parseInt(this.focusIn.getAttribute('data-redmic-id'), 10));
					this.set("value", itemValue);
					this.label = cleanSpace(this._labelFocus);
					this._setValueInput(this._labelFocus);
					this.validate();
@@ -409,7 +420,7 @@ define([

		_createButtonFiltering: function() {

			this.buttonFilteringNode = put(this.domNode, "div.buttonSearch.border");
			this.buttonFilteringNode = put(this.domNode, "div.buttonSearch");
			put(this.buttonFilteringNode, "i.fa.fa-caret-down");
			this.buttonFilteringNode.onclick = lang.hitch(this, this._clickFiltering);
		},
@@ -478,11 +489,11 @@ define([
			}

			this._cleanChildrenNode(this.boxResultsNode);
			this.boxResultsNode = put(document.body, "div.filteringResult.border.hidden");
			this.boxResultsNode = put(document.body, 'div.' + this.suggestionsContainerClass + '.' + this.hiddenClass);

			var positionNode = domGeom.position(this.domNode);

			var obj = {top: positionNode.y + 'px', left: positionNode.x + 'px', width: positionNode.w + 'px'};
			var obj = {top: (positionNode.y + positionNode.h) + 'px', left: positionNode.x + 'px', width: positionNode.w + 'px'};
			domAttr.set(this.boxResultsNode, "style", obj);

			this._openResults();
@@ -519,8 +530,6 @@ define([
				this._addEventsPagination(paginationNode, +this.count);
			}

			this._activeInput();

			if (this.boxResultsNode.children.length !== 0) {
				this._selectAutocompleteNode();
			} else if (this._getValueInput().length !== 0) {
@@ -532,18 +541,9 @@ define([
			this.validate();
		},

		_activeInput: function() {

			put(this.inputNode, ".activeSuggest");
			put(this.buttonFilteringNode, ".activeSuggest");
		},

		_desactiveInput: function() {
		_onInputBlur: function() {

			this.validate();

			put(this.inputNode, "!activeSuggest");
			put(this.buttonFilteringNode, "!activeSuggest");
		},

		_insertPagination: function(text) {
@@ -673,7 +673,7 @@ define([

		_openResults: function() {

			put(this.boxResultsNode, "!hidden");
			put(this.boxResultsNode, '!' + this.hiddenClass);
			this.boxResultsNode.onmouseleave = lang.hitch(this, this._startTimeOut, this._closeResults);
			this.boxResultsNode.onmouseenter = lang.hitch(this, this._stopTimeOut);
		},
+82 −117
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ define([
	, "dojo/Evented"
	, "put-selector/put"
	, "dojo/dom-attr"
	, "dojo/dom-construct"
	, "dojo/dom-geometry"
	, "dojo/query"
], function(
@@ -14,6 +15,7 @@ define([
	, Evented
	, put
	, domAttr
	, domConstruct
	, domGeom
	, query
) {
@@ -34,6 +36,15 @@ define([
				originalValue: '',
				suggestFields: null,
				sizeSuggets: null,
				suggestionsContainerClass: 'suggestions',
				hiddenClass: 'hidden',
				innerButtonsContainerClass: 'innerButtons',
				outerButtonsContainerClass: 'outerButtons',
				removeTextButtonClass: 'clearTextButton',
				expandSearchButtonClass: 'expandSearchButton',
				searchButtonClass: 'searchButton',
				suggestionsShownClass: 'suggestionsShown',
				showExpandIcon: false,
				events: {
					SEARCH_CHANGED: "searchChanged",
					NEW_SEARCH: "newSearch",
@@ -44,27 +55,26 @@ define([
					CLOSE: "close",
					CLOSED: "closed",
					RESET: "reset",
					OPEN: "open",
					FOCUS_INPUT: "focusInput",
					SET_DEFAULT: "setDefault",
					EXECUTE: "execute",
					REFRESH: "refresh"
					REFRESH: "refresh",
					EXPAND_SEARCH: 'expandSearch'
				},
				createQuery: function(text, fields) {

					var query = {
					var queryObj = {
						'text': text
					};

					if (fields) {
						query.fields = fields;
						queryObj.fields = fields;
					}

					if (this.sizeSuggets) {
						query.size = this.sizeSuggets;
						queryObj.size = this.sizeSuggets;
					}

					return query;
					return queryObj;
				}
			};

@@ -73,9 +83,7 @@ define([
			this.on(this.events.SEARCH_CHANGED, this._requestSuggestions);
			this.on(this.events.RECEIVED_SUGGESTS, this._addSuggestions);
			this.on(this.events.CLOSE, this._closeSuggestion);
			this.on(this.events.OPEN, this._openSuggestion);
			this.on(this.events.RESET, this._reset);
			this.on(this.events.FOCUS_INPUT, this._focusInput);
			this.on(this.events.SET_DEFAULT, this.setValue);
			this.on(this.events.EXECUTE, this._execute);
			this.on(this.events.REFRESH, this._refresh);
@@ -92,51 +100,58 @@ define([
			}

			this._createTextSearch();
			this._createButtonSearch();
			this._createInnerButtons();
			this._createOuterButtons();
		},

		_createTextSearch: function() {

			this.textSearchNode = put(this.domNode, "div.textSearch");
			this.inputAutocompleteNode = put(this.textSearchNode, "input[type=search].autocomplete");
			this.inputNode = put(this.textSearchNode, "input[type=search][autofocus].inputSearch");
			this.removeTextNode = put(this.textSearchNode, "i.fa.fa-times.hidden");
			this.inputNode = put(this.textSearchNode, "input[type=search]");

			var suggestionsNodeExists = query("div.suggestions.border.hidden", document.body);
			this.inputNode.onkeyup = lang.hitch(this, this._eventChangeText);
		},

			if (suggestionsNodeExists.length !== 0) {
				this.boxSuggestionsNode = suggestionsNodeExists[0];
			} else {
				this.boxSuggestionsNode = put(document.body, "div.suggestions.border.hidden");
			}
		_createInnerButtons: function() {

			this.inputNode.onkeyup = lang.hitch(this, this._eventChangeText);
			this.removeTextNode.onclick = lang.hitch(this, this._removeText);
			var innerButtonsContainer = put(this.textSearchNode, 'div.' + this.innerButtonsContainerClass);

			this.removeTextNode = put(innerButtonsContainer, 'i.' + this.removeTextButtonClass + '.' +
				this.hiddenClass + '[title=' + this.i18n.remove + ']');

			this.domNode.onmouseleave = lang.hitch(this, this._startTimeout, 'suggestTimeout',
				this._closeSuggestion, 800);
			this.domNode.onmouseenter = lang.hitch(this, this._stopTimeout, 'suggestTimeout');
			this.inputNode.onblur = lang.hitch(this, this._inputNodeNoFocus);
			this.removeTextNode.onclick = lang.hitch(this, this._removeText);
		},

		_inputNodeNoFocus: function() {
		_createOuterButtons: function() {

			setTimeout(lang.hitch(this, this._restartLastValueInput), 300);
		},
			var outerButtonsContainer = put(this.domNode, 'div.' + this.outerButtonsContainerClass),
				searchButton = put(outerButtonsContainer, 'i.' + this.searchButtonClass +
					'[title=' + this.i18n.search + ']');

		_restartLastValueInput: function() {
			searchButton.onclick = lang.hitch(this, this._onClickSearch);

			this.setValue(this.lastSearch);
			if (this.showExpandIcon) {
				this.expandSearchNode = put(outerButtonsContainer, 'i.' + this.expandSearchButtonClass + '[title=' +
					this.i18n.advancedSearch + ']');

				this.expandSearchNode.onclick = lang.hitch(this, this._expandSearch);
			}
		},

		_startTimeout: function(nameTimeout, callback, time) {
		_createSuggestions: function() {

			this[nameTimeout] = setTimeout(lang.hitch(this, callback), time);
			var suggestionsNodeExists = query('div.' + this.suggestionsContainerClass, this.ownerDocumentBody);

			if (suggestionsNodeExists.length !== 0) {
				this.boxSuggestionsNode = suggestionsNodeExists[0];
			} else {
				this.boxSuggestionsNode = put(this.ownerDocumentBody, 'div.' + this.suggestionsContainerClass);
			}
		},

		_stopTimeout: function(nameTimeout) {
		_inputNodeNoFocus: function() {

			clearTimeout(this[nameTimeout]);
			setTimeout(lang.hitch(this, this._restartLastValueInput), 300);
		},

		_eventChangeText: function(e) {
@@ -164,10 +179,6 @@ define([
				this._selectNodeFocus(1);
			} else if (keyCode === 38) {
				this._selectNodeFocus(-1);
			} else if ((keyCode === 39) && (this.getValueInputAutocomplete())) {
				this.inputAutocompleteNode.value = cleanSpace(this.getValueInputAutocomplete());
				this.setValueInput(this.getValueInputAutocomplete());
				this.originalValue = this.getValueInputAutocomplete();
			} else {
				return false;
			}
@@ -177,8 +188,8 @@ define([

		_selectCharCorrect: function(keyCode) {

			patron = /[a-zA-Z0-9\s]/;
			charSeleccionado = String.fromCharCode(keyCode);
			var patron = /[a-zA-Z0-9\s]/;
			var charSeleccionado = String.fromCharCode(keyCode);

			if ((patron.test(charSeleccionado)) || (keyCode === 46) || (keyCode === 8)) {
				this.focusIn = -1;
@@ -195,21 +206,25 @@ define([
			this.emit(this.events.NEW_SEARCH, this.getValueInput());
		},

		_activeRemoveText: function() {
		_expandSearch: function() {

			if (!this.showExpandIcon) {
				return;
			}

			put(this.removeTextNode, "!hidden");
			this.emit(this.events.EXPAND_SEARCH, {
				node: this.expandSearchNode
			});
		},

		_desactiveRemoveText: function() {
		_activeRemoveText: function() {

			put(this.removeTextNode, ".hidden");
			put(this.removeTextNode, '!' + this.hiddenClass);
		},

		_createButtonSearch: function() {
		_desactiveRemoveText: function() {

			this.buttonSearchNode = put(this.domNode, "div.buttonSearch.border");
			put(this.buttonSearchNode, "i.fa.fa-search");
			this.buttonSearchNode.onclick = lang.hitch(this, this._onClickSearch);
			put(this.removeTextNode, '.' + this.hiddenClass);
		},

		_onClickSearch: function() {
@@ -246,20 +261,18 @@ define([
		_selectNodeFocus: function(num) {

			if (this.boxSuggestionsNode.children.length !== 0) {
				if ((this.focusIn === -1)) {
					num === 1 ? this.focusIn = this.boxSuggestionsNode.firstChild :
						this.focusIn = this.boxSuggestionsNode.lastChild;
				if (this.focusIn === -1) {
					this.focusIn = num === 1 ? this.boxSuggestionsNode.firstChild : this.boxSuggestionsNode.lastChild;
				} else {
					this.focusIn.onblur();

					if ((num === 1) && (this.boxSuggestionsNode.lastChild !== this.focusIn)) {
					if (num === 1 && this.boxSuggestionsNode.lastChild !== this.focusIn) {
						this.focusIn = this.focusIn.nextSibling;
					} else if ((num === -1) && (this.boxSuggestionsNode.firstChild != this.focusIn)) {
					} else if (num === -1 && this.boxSuggestionsNode.firstChild != this.focusIn) {
						this.focusIn = this.focusIn.previousSibling;
					} else {
						this.focusIn = -1;
						this.setValueInput(this.originalValue);
						this._updateInputAutocomplete(this.boxSuggestionsNode.firstChild.textContent);
					}
				}

@@ -281,17 +294,9 @@ define([

		_addSuggestions: function(/*JSON*/ suggestions) {

			this._cleanChildrenNode(this.boxSuggestionsNode);

			var positionNode = domGeom.position(this.domNode);

			var obj = {top: positionNode.y + 'px', left: positionNode.x + 'px', width: (positionNode.w - 31) + 'px'};
			domAttr.set(this.boxSuggestionsNode, "style", obj);

			this._openSuggestion();

			tamSuggets = suggestions.length;

			var tamSuggets = suggestions.length;
			for (var i = 0; i < tamSuggets; i++){
				var node = this._createSuggest(suggestions[i]);
				this._addEventsSugget(node);
@@ -300,35 +305,6 @@ define([
			if (tamSuggets === 0) {
				this._closeSuggestion();
			}

			if (this.boxSuggestionsNode.children.length !== 0) {
				this._updateInputAutocomplete(this.boxSuggestionsNode.firstChild.textContent);
			} else {
				this.inputAutocompleteNode.value = '';
			}
		},

		_updateInputAutocomplete: function(text) {

			text = cleanSpace(text);
			if (this.boxSuggestionsNode.children.length !== 0) {
				var spaceValue = '',
					i = 0;

				while (this.getValueInput().charAt(i) == ' ') {
					spaceValue += this.getValueInput().charAt(i);
					i++;
				}

				var tamValue = this.getValueInput().length - spaceValue.length;

				this.inputAutocompleteNode.value = this.getValueInput() + text.substring(tamValue, text.length);
			}
		},

		_deleteValueInputAutocomplete: function() {

			this.inputAutocompleteNode.value = '';
		},

		_createSuggest: function(item) {
@@ -371,11 +347,9 @@ define([
			}

			this.focusIn = spanNode;
			put(spanNode, ".hover");

			if (change) {
				this.setValueInput(spanNode.textContent);
				this._updateInputAutocomplete(spanNode.textContent);
			}
		},

@@ -383,12 +357,7 @@ define([

			if (change) {
				this.setValueInput(this.originalValue);
				if (this.boxSuggestionsNode.children.length !== 0) {
					this._updateInputAutocomplete(this.boxSuggestionsNode.firstChild.textContent);
			}
			}

			put(spanNode, "!hover");
		},

		_selectSuggestion: function(spanNode) {
@@ -403,27 +372,32 @@ define([

		_cleanChildrenNode: function(node) {

			while (node.firstChild) {
				node.removeChild(node.firstChild);
			}
			domConstruct.destroy(node);
		},

		_closeSuggestion: function() {

			this.focusIn = -1;
			this._deleteValueInputAutocomplete();
			this._cleanChildrenNode(this.boxSuggestionsNode);
			put(this.boxSuggestionsNode, ".hidden");
			put(this.domNode, '!' + this.suggestionsShownClass);

			this.emit(this.events.CLOSED);
		},

		_openSuggestion: function() {

			put(this.boxSuggestionsNode, "!hidden");
			this.boxSuggestionsNode.onmouseleave = lang.hitch(this, this._startTimeout, 'suggestTimeout',
				this._closeSuggestion, 800);
			this.boxSuggestionsNode.onmouseenter = lang.hitch(this, this._stopTimeout, 'suggestTimeout');
			this._cleanChildrenNode(this.boxSuggestionsNode);
			this._createSuggestions();

			var positionNode = domGeom.position(this.domNode);
			var obj = {
				top: (positionNode.y + positionNode.h) + 'px',
				left: positionNode.x + 'px',
				width: positionNode.w + 'px'
			};
			domAttr.set(this.boxSuggestionsNode, 'style', obj);

			put(this.domNode, '.' + this.suggestionsShownClass);
		},

		getValueInput: function() {
@@ -452,20 +426,11 @@ define([
			}
		},

		getValueInputAutocomplete: function() {

			return this.inputAutocompleteNode.value;
		},

		setI18n: function(i18n){

			this.i18n = i18n;
		},

		_focusInput: function() {

		},

		_reset: function() {

			this.setValueInput('');
Loading