horsey-ybg
Advanced tools
Comparing version
@@ -246,3 +246,4 @@ 'use strict'; | ||
attachment: attachment, | ||
source: [] | ||
source: [], | ||
search: search | ||
}); | ||
@@ -879,2 +880,64 @@ | ||
function search(value) { | ||
if (!visible()) { | ||
return; | ||
} | ||
if(!inputOk){ | ||
return; | ||
} | ||
debouncedLoading(true); | ||
_crossvent2.default.fabricate(attachment, 'horsey-filter'); | ||
if (!o.blankSearch && !value) { | ||
hide();return; | ||
} | ||
var nomatch = noMatches({ query: value }); | ||
var count = walkCategories(); | ||
if (count === 0 && nomatch && hasItems) { | ||
showNoResults(); | ||
} else { | ||
hideNoResults(); | ||
} | ||
if (!selection) { | ||
move(); | ||
} | ||
if (!selection && !nomatch) { | ||
hide(); | ||
} | ||
function walkCategories() { | ||
var category = categories.firstChild; | ||
var count = 0; | ||
while (category) { | ||
var list = findList(category); | ||
var partial = walkCategory(list); | ||
if (partial === 0) { | ||
category.classList.add('sey-hide'); | ||
} else { | ||
category.classList.remove('sey-hide'); | ||
} | ||
count += partial; | ||
category = category.nextSibling; | ||
} | ||
return count; | ||
} | ||
function walkCategory(ul) { | ||
var li = ul.firstChild; | ||
var count = 0; | ||
while (li) { | ||
if (count >= limit) { | ||
_crossvent2.default.fabricate(li, 'horsey-hide'); | ||
} else { | ||
_crossvent2.default.fabricate(li, 'horsey-filter'); | ||
if (li.className.indexOf('sey-hide') === -1) { | ||
count++; | ||
if (highlighter) { | ||
highlight(li, value); | ||
} | ||
} | ||
} | ||
li = li.nextSibling; | ||
} | ||
return count; | ||
} | ||
} | ||
function deferredFilteringNoEnter(e) { | ||
@@ -881,0 +944,0 @@ var which = e.which || e.keyCode; |
@@ -201,3 +201,4 @@ 'use strict'; | ||
attachment, | ||
source: [] | ||
source: [], | ||
search: search | ||
}); | ||
@@ -703,2 +704,61 @@ | ||
function search (value) { | ||
if (!visible()) { | ||
return; | ||
} | ||
debouncedLoading(true); | ||
crossvent.fabricate(attachment, 'horsey-filter'); | ||
if (!o.blankSearch && !value) { | ||
hide(); return; | ||
} | ||
const nomatch = noMatches({ query: value }); | ||
let count = walkCategories(); | ||
if (count === 0 && nomatch && hasItems) { | ||
showNoResults(); | ||
} else { | ||
hideNoResults(); | ||
} | ||
if (!selection) { | ||
move(); | ||
} | ||
if (!selection && !nomatch) { | ||
hide(); | ||
} | ||
function walkCategories () { | ||
let category = categories.firstChild; | ||
let count = 0; | ||
while (category) { | ||
const list = findList(category); | ||
const partial = walkCategory(list); | ||
if (partial === 0) { | ||
category.classList.add('sey-hide'); | ||
} else { | ||
category.classList.remove('sey-hide'); | ||
} | ||
count += partial; | ||
category = category.nextSibling; | ||
} | ||
return count; | ||
} | ||
function walkCategory (ul) { | ||
let li = ul.firstChild; | ||
let count = 0; | ||
while (li) { | ||
if (count >= limit) { | ||
crossvent.fabricate(li, 'horsey-hide'); | ||
} else { | ||
crossvent.fabricate(li, 'horsey-filter'); | ||
if (li.className.indexOf('sey-hide') === -1) { | ||
count++; | ||
if (highlighter) { | ||
highlight(li, value); | ||
} | ||
} | ||
} | ||
li = li.nextSibling; | ||
} | ||
return count; | ||
} | ||
} | ||
function deferredFilteringNoEnter (e) { | ||
@@ -705,0 +765,0 @@ const which = e.which || e.keyCode; |
{ | ||
"name": "horsey-ybg", | ||
"version": "4.2.5", | ||
"version": "4.2.6", | ||
"description": "Progressive and customizable autocomplete component", | ||
@@ -5,0 +5,0 @@ "main": "horsey.es5.js", |
396261
0.8%5172
2.4%