Comparing version 1.1.0 to 1.2.1
{ | ||
"name": "taggify", | ||
"version": "1.1.0", | ||
"version": "1.2.1", | ||
"description": "Create tags by typing", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -198,3 +198,3 @@ var Taggify = function (params) { | ||
if (isHotKeyUsed) { | ||
if (isHotKeyUsed || event.type === 'blur') { | ||
tags = _createTagsArrayFromString(event.target.value); | ||
@@ -221,11 +221,18 @@ | ||
timeoutInputKeyup = window.setTimeout(function () { | ||
if (finalParams.autocomplete) { | ||
finalParams.autocompleteCallback(event.target.value, _createTags); | ||
} else { | ||
_createTagsNoAutocomplete(event); | ||
} | ||
}, finalParams.inputDelay); | ||
timeoutInputKeyup = window.setTimeout(_createTagsFromInput.bind(null, event), finalParams.inputDelay); | ||
}, | ||
/** | ||
* Creates tags from an event fired on input | ||
* | ||
* @method _createTagsFromInput | ||
* @param {Event} event | ||
*/ | ||
_createTagsFromInput = function (event) { | ||
if (finalParams.autocomplete) { | ||
finalParams.autocompleteCallback(event.target.value, _createTags); | ||
} else { | ||
_createTagsNoAutocomplete(event); | ||
} | ||
}, | ||
/** | ||
* Creates tags | ||
@@ -369,3 +376,3 @@ * | ||
_fire(EVENT_TAG_REMOVED, {tags: createdTags}); | ||
_fire(EVENT_TAG_REMOVED, { tags: createdTags }); | ||
} else { | ||
@@ -411,2 +418,3 @@ _fire(EVENT_TAG_NOT_REMOVED); | ||
taggifyInput.addEventListener('keyup', _inputKeyupEventHandler, false); | ||
taggifyInput.addEventListener('blur', _createTagsFromInput, false); | ||
taggifyTags.addEventListener('click', _removeTag, false); | ||
@@ -413,0 +421,0 @@ |
/*@preserve | ||
* Taggify - input tags creating library v1.0.0 | ||
* Taggify - input tags creating library v1.2.1 | ||
* https://github.com/sunpietro/taggify | ||
@@ -11,3 +11,3 @@ * | ||
* | ||
* Date: 2017-11-27T08:00Z | ||
* Date: 2017-11-29T15:15Z | ||
*/ | ||
@@ -212,3 +212,3 @@ | ||
if (isHotKeyUsed) { | ||
if (isHotKeyUsed || event.type === 'blur') { | ||
tags = _createTagsArrayFromString(event.target.value); | ||
@@ -235,11 +235,18 @@ | ||
timeoutInputKeyup = window.setTimeout(function () { | ||
if (finalParams.autocomplete) { | ||
finalParams.autocompleteCallback(event.target.value, _createTags); | ||
} else { | ||
_createTagsNoAutocomplete(event); | ||
} | ||
}, finalParams.inputDelay); | ||
timeoutInputKeyup = window.setTimeout(_createTagsFromInput.bind(null, event), finalParams.inputDelay); | ||
}, | ||
/** | ||
* Creates tags from an event fired on input | ||
* | ||
* @method _createTagsFromInput | ||
* @param {Event} event | ||
*/ | ||
_createTagsFromInput = function (event) { | ||
if (finalParams.autocomplete) { | ||
finalParams.autocompleteCallback(event.target.value, _createTags); | ||
} else { | ||
_createTagsNoAutocomplete(event); | ||
} | ||
}, | ||
/** | ||
* Creates tags | ||
@@ -383,3 +390,3 @@ * | ||
_fire(EVENT_TAG_REMOVED, {tags: createdTags}); | ||
_fire(EVENT_TAG_REMOVED, { tags: createdTags }); | ||
} else { | ||
@@ -425,2 +432,3 @@ _fire(EVENT_TAG_NOT_REMOVED); | ||
taggifyInput.addEventListener('keyup', _inputKeyupEventHandler, false); | ||
taggifyInput.addEventListener('blur', _createTagsFromInput, false); | ||
taggifyTags.addEventListener('click', _removeTag, false); | ||
@@ -427,0 +435,0 @@ |
/*@preserve | ||
* Taggify - input tags creating library v1.0.0 | ||
* Taggify - input tags creating library v1.2.1 | ||
* https://github.com/sunpietro/taggify | ||
@@ -11,3 +11,3 @@ * | ||
* | ||
* Date: 2017-11-27T08:00Z | ||
* Date: 2017-11-29T15:15Z | ||
*/ | ||
@@ -28,3 +28,3 @@ | ||
var Taggify = function (params) { | ||
var Taggify = function (params) { | ||
var SUFFIX_LABEL = '__label', | ||
@@ -226,3 +226,3 @@ CLASS_TAGGIFY = 'taggify', | ||
if (isHotKeyUsed) { | ||
if (isHotKeyUsed || event.type === 'blur') { | ||
tags = _createTagsArrayFromString(event.target.value); | ||
@@ -249,11 +249,18 @@ | ||
timeoutInputKeyup = window.setTimeout(function () { | ||
if (finalParams.autocomplete) { | ||
finalParams.autocompleteCallback(event.target.value, _createTags); | ||
} else { | ||
_createTagsNoAutocomplete(event); | ||
} | ||
}, finalParams.inputDelay); | ||
timeoutInputKeyup = window.setTimeout(_createTagsFromInput.bind(null, event), finalParams.inputDelay); | ||
}, | ||
/** | ||
* Creates tags from an event fired on input | ||
* | ||
* @method _createTagsFromInput | ||
* @param {Event} event | ||
*/ | ||
_createTagsFromInput = function (event) { | ||
if (finalParams.autocomplete) { | ||
finalParams.autocompleteCallback(event.target.value, _createTags); | ||
} else { | ||
_createTagsNoAutocomplete(event); | ||
} | ||
}, | ||
/** | ||
* Creates tags | ||
@@ -397,3 +404,3 @@ * | ||
_fire(EVENT_TAG_REMOVED, {tags: createdTags}); | ||
_fire(EVENT_TAG_REMOVED, { tags: createdTags }); | ||
} else { | ||
@@ -439,2 +446,3 @@ _fire(EVENT_TAG_NOT_REMOVED); | ||
taggifyInput.addEventListener('keyup', _inputKeyupEventHandler, false); | ||
taggifyInput.addEventListener('blur', _createTagsFromInput, false); | ||
taggifyTags.addEventListener('click', _removeTag, false); | ||
@@ -441,0 +449,0 @@ |
/*@preserve | ||
* Taggify - input tags creating library v1.0.0 | ||
* Taggify - input tags creating library v1.2.1 | ||
* https://github.com/sunpietro/taggify | ||
@@ -11,4 +11,4 @@ * | ||
* | ||
* Date: 2017-11-27T08:00Z | ||
* Date: 2017-11-29T15:15Z | ||
*/ | ||
!function(t,e,a){"use strict";"function"==typeof define&&define.amd?define("Taggify",a):"object"==typeof exports?exports=module.exports=a():t.Taggify=a()}(this,0,function(){"use strict";return function(t){var e,a,n,i=function(t,e){e(g(t))},l={containerNode:null,containerSelector:".taggify",autocomplete:!1,autocompleteCallback:i,inputDelay:100,inputLabel:"Start typing ...",allowDuplicates:!1,hotKeys:[188,13],displayLabel:!0,displayInputValues:!0},o="taggify-"+Date.now(),r=document.createElement("input"),u=document.createElement("label"),c=document.createElement("div"),s=document.createElement("div"),d=[],p=window.hasOwnProperty("CustomEvent"),f=function(t,e){var n,i;p?(i={bubbles:!0,cancelable:!1},e&&Object.keys(e).length&&(i.detail=e),n=new CustomEvent(t,i)):(n=document.createEvent("CustomEvent"),n.initEvent(t,!1,!0)),a.dispatchEvent(n)},g=function(t){var e={};return t.split(",").map(function(t){return{id:Math.floor(65536*(1+Math.random())).toString(16),label:t.trim()}}).filter(function(t){return l.allowDuplicates?!!t.label.length:!(!t.label.length||e[t.label])&&(e[t.label]=!0,t)})},m=function(t){var e,a=l.hotKeys.some(function(e){return(t.keyCode||t.which)===e});a&&(e=g(t.target.value),l.displayInputValues||(e=d.concat(e)),b(e))},y=function(t){window.clearTimeout(n),n=window.setTimeout(function(){l.autocomplete?l.autocompleteCallback(t.target.value,b):m(t)},l.inputDelay)},b=function(t){var e=document.createDocumentFragment(),a={};Array.isArray(t)&&(d.length&&(t=d.concat(t)),l.allowDuplicates||(t=t.filter(function(t){return!a[t.label]&&(a[t.label]=!0,!0)})),t.forEach(function(t){var a=document.createElement("div"),n=document.createElement("span"),i=document.createElement("button");n.classList.add("taggify__tag-label"),n.innerHTML=t.label,i.classList.add("taggify__btn--remove"),i.innerHTML="x",a.classList.add("taggify__tag"),a.dataset.tagText=t.label,a.dataset.tagId=t.id,a.appendChild(n),a.appendChild(i),e.appendChild(a)}),d=t,l.autocomplete?r.value="":(c.innerHTML="",l.displayInputValues?r.value=t.map(function(t){return t.label}).join(", ")+", ":r.value=""),c.appendChild(e),f("tagsCreated",{tags:d}))},v=function(t,e){var a=t.parentNode;if(a)return e(t)?t:e(a)?a:v(a,e)},h=function(t){return t.classList&&t.classList.contains("taggify__tag")},L=function(t){return t.classList&&t.classList.contains("taggify__btn--remove")},_=function(t){var e,a=v(t.target,L),n="";a?(e=v(t.target,h),d=d.filter(function(t){return""+t.id!=""+e.dataset.tagId}),l.autocomplete||(n=d.map(function(t){return t.label}).join(", "),n=n.trim().length?n+", ":""),l.displayInputValues&&(r.value=n),this.removeChild(e),f("tagRemoved",{tags:d})):f("tagNotRemoved")};for(e in t)t.hasOwnProperty(e)&&(l[e]=t[e]);return a=l.containerNode?l.containerNode:document.querySelector(l.containerSelector),a.innerHTML="",s.classList.add("taggify__wrapper"),r.id=o,r.type="text",r.classList.add("taggify__input"),c.classList.add("taggify__tags"),a.appendChild(s),a.appendChild(c),l.displayLabel&&(u.for=o,u.innerHTML=l.inputLabel,u.setAttribute("for",o),u.classList.add("taggify__label"),s.appendChild(u)),s.appendChild(r),r.addEventListener("keyup",y,!1),c.addEventListener("click",_,!1),{updateTags:function(t){return l.displayInputValues&&(r.value=t.map(function(t){return t.label}).join(", ")),b(t),this}}}}); | ||
!function(t,e,a){"use strict";"function"==typeof define&&define.amd?define("Taggify",a):"object"==typeof exports?exports=module.exports=a():t.Taggify=a()}(this,0,function(){"use strict";return function(t){var e,a,n,i=function(t,e){e(g(t))},l={containerNode:null,containerSelector:".taggify",autocomplete:!1,autocompleteCallback:i,inputDelay:100,inputLabel:"Start typing ...",allowDuplicates:!1,hotKeys:[188,13],displayLabel:!0,displayInputValues:!0},o="taggify-"+Date.now(),r=document.createElement("input"),u=document.createElement("label"),c=document.createElement("div"),d=document.createElement("div"),s=[],p=window.hasOwnProperty("CustomEvent"),f=function(t,e){var n,i;p?(i={bubbles:!0,cancelable:!1},e&&Object.keys(e).length&&(i.detail=e),n=new CustomEvent(t,i)):(n=document.createEvent("CustomEvent"),n.initEvent(t,!1,!0)),a.dispatchEvent(n)},g=function(t){var e={};return t.split(",").map(function(t){return{id:Math.floor(65536*(1+Math.random())).toString(16),label:t.trim()}}).filter(function(t){return l.allowDuplicates?!!t.label.length:!(!t.label.length||e[t.label])&&(e[t.label]=!0,t)})},m=function(t){var e,a=l.hotKeys.some(function(e){return(t.keyCode||t.which)===e});(a||"blur"===t.type)&&(e=g(t.target.value),l.displayInputValues||(e=s.concat(e)),v(e))},y=function(t){window.clearTimeout(n),n=window.setTimeout(b.bind(null,t),l.inputDelay)},b=function(t){l.autocomplete?l.autocompleteCallback(t.target.value,v):m(t)},v=function(t){var e=document.createDocumentFragment(),a={};Array.isArray(t)&&(s.length&&(t=s.concat(t)),l.allowDuplicates||(t=t.filter(function(t){return!a[t.label]&&(a[t.label]=!0,!0)})),t.forEach(function(t){var a=document.createElement("div"),n=document.createElement("span"),i=document.createElement("button");n.classList.add("taggify__tag-label"),n.innerHTML=t.label,i.classList.add("taggify__btn--remove"),i.innerHTML="x",a.classList.add("taggify__tag"),a.dataset.tagText=t.label,a.dataset.tagId=t.id,a.appendChild(n),a.appendChild(i),e.appendChild(a)}),s=t,l.autocomplete?r.value="":(c.innerHTML="",l.displayInputValues?r.value=t.map(function(t){return t.label}).join(", ")+", ":r.value=""),c.appendChild(e),f("tagsCreated",{tags:s}))},h=function(t,e){var a=t.parentNode;if(a)return e(t)?t:e(a)?a:h(a,e)},L=function(t){return t.classList&&t.classList.contains("taggify__tag")},_=function(t){return t.classList&&t.classList.contains("taggify__btn--remove")},E=function(t){var e,a=h(t.target,_),n="";a?(e=h(t.target,L),s=s.filter(function(t){return""+t.id!=""+e.dataset.tagId}),l.autocomplete||(n=s.map(function(t){return t.label}).join(", "),n=n.trim().length?n+", ":""),l.displayInputValues&&(r.value=n),this.removeChild(e),f("tagRemoved",{tags:s})):f("tagNotRemoved")};for(e in t)t.hasOwnProperty(e)&&(l[e]=t[e]);return a=l.containerNode?l.containerNode:document.querySelector(l.containerSelector),a.innerHTML="",d.classList.add("taggify__wrapper"),r.id=o,r.type="text",r.classList.add("taggify__input"),c.classList.add("taggify__tags"),a.appendChild(d),a.appendChild(c),l.displayLabel&&(u.for=o,u.innerHTML=l.inputLabel,u.setAttribute("for",o),u.classList.add("taggify__label"),d.appendChild(u)),d.appendChild(r),r.addEventListener("keyup",y,!1),r.addEventListener("blur",b,!1),c.addEventListener("click",E,!1),{updateTags:function(t){return l.displayInputValues&&(r.value=t.map(function(t){return t.label}).join(", ")),v(t),this}}}}); |
/*@preserve | ||
* Taggify - input tags creating library v1.0.0 | ||
* Taggify - input tags creating library v1.2.1 | ||
* https://github.com/sunpietro/taggify | ||
@@ -11,3 +11,3 @@ * | ||
* | ||
* Date: 2017-11-27T08:00Z | ||
* Date: 2017-11-29T15:15Z | ||
*/ |
@@ -15,5 +15,5 @@ [COMMENT] | ||
[TAGGIFY] | ||
[TAGGIFY] | ||
return Taggify; | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77199
1722
21