horsey-ybg
Advanced tools
Comparing version
@@ -65,3 +65,2 @@ 'use strict'; | ||
var debounce = options.debounce; | ||
var autoFocusFirst = options.autoFocusFirst; | ||
@@ -104,3 +103,2 @@ var caching = options.cache !== false; | ||
debounce: debounce, | ||
autoFocusFirst: autoFocusFirst, | ||
set: function set(s) { | ||
@@ -215,3 +213,2 @@ if (setAppends !== true) { | ||
var debouncedLoading = (0, _debounce2.default)(loading, debounceTime); | ||
var autoFocusFirst = o.autoFocusFirst; | ||
@@ -252,4 +249,3 @@ if (o.autoHideOnBlur === void 0) { | ||
attachment: attachment, | ||
source: [], | ||
search: search | ||
source: [] | ||
}); | ||
@@ -710,3 +706,3 @@ | ||
function move(up, moves, autoFocus) { | ||
function move(up, moves) { | ||
var total = api.source.length; | ||
@@ -726,7 +722,4 @@ if (total === 0) { | ||
var li = findNext(); | ||
select(li); | ||
if(autoFocus || autoFocus === undefined){ | ||
select(li); | ||
} | ||
if (hidden(li)) { | ||
@@ -849,68 +842,2 @@ move(up, moves ? moves + 1 : 1); | ||
if (!selection) { | ||
if(!autoFocusFirst) { | ||
move(undefined, undefined, false); | ||
}else{ | ||
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 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(); | ||
@@ -917,0 +844,0 @@ } |
@@ -55,3 +55,2 @@ 'use strict'; | ||
let previousSelection = null; | ||
const autoFocusFirst = options.autoFocusFirst | ||
const limit = Number(options.limit) || Infinity; | ||
@@ -73,3 +72,2 @@ const completer = autocomplete(el, { | ||
debounce, | ||
autoFocusFirst, | ||
set (s) { | ||
@@ -176,3 +174,2 @@ if (setAppends !== true) { | ||
const debouncedLoading = debounce(loading, debounceTime); | ||
const autoFocusFirst = o.autoFocusFirst; | ||
@@ -207,4 +204,3 @@ if (o.autoHideOnBlur === void 0) { o.autoHideOnBlur = true; } | ||
attachment, | ||
source: [], | ||
search: search | ||
source: [] | ||
}); | ||
@@ -541,3 +537,3 @@ | ||
function move (up, moves, autoFocus) { | ||
function move (up, moves) { | ||
const total = api.source.length; | ||
@@ -557,7 +553,4 @@ if (total === 0) { | ||
const li = findNext(); | ||
select(li); | ||
if(autoFocus || autoFocus === undefined){ | ||
select(li); | ||
} | ||
if (hidden(li)) { | ||
@@ -673,65 +666,2 @@ move(up, moves ? moves + 1 : 1); | ||
if (!selection) { | ||
if(!autoFocusFirst) { | ||
move(undefined, undefined, false); | ||
}else{ | ||
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 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(); | ||
@@ -738,0 +668,0 @@ } |
{ | ||
"name": "horsey-ybg", | ||
"version": "4.2.11", | ||
"version": "4.2.12", | ||
"description": "Progressive and customizable autocomplete component", | ||
@@ -5,0 +5,0 @@ "main": "horsey.es5.js", |
393107
-0.94%5051
-2.68%