@neovici/cosmoz-autocomplete
Advanced tools
Comparing version 7.5.1 to 7.6.0
@@ -10,3 +10,3 @@ import { useCallback, useMemo, useEffect } from 'haunted'; | ||
export const useAutocomplete = ({ value: _value, text, onChange: _onChange, onText: _onText, onSelect, limit, source, textProperty, textual: _textual, valueProperty, external, hideEmpty, keepOpened, keepQuery, ...thru }) => { | ||
const textual = useMemo(() => (_textual ?? strProp)(textProperty), [_textual, textProperty]), { active, focused, onFocus, setClosed } = useFocus(thru), empty = !text, query = useMemo(() => text?.trim().toLowerCase(), [text]), host = useHost(), onText = useNotify(host, _onText, 'text'), onChange = useCallback((val) => { | ||
const textual = useMemo(() => (_textual ?? strProp)(textProperty), [_textual, textProperty]), { active, focused, onFocus, setClosed } = useFocus(thru), empty = !text, query = useMemo(() => text?.trim(), [text]), host = useHost(), onText = useNotify(host, _onText, 'text'), onChange = useCallback((val) => { | ||
_onChange?.(val, () => setClosed(true)); | ||
@@ -13,0 +13,0 @@ notify(host, 'value', val); |
import { useCallback } from 'haunted'; | ||
export const search = (source, query, textual) => { | ||
const qry = query.toLowerCase(); | ||
const matches = []; | ||
for (const item of source) { | ||
const index = textual(item).toLowerCase().indexOf(query); | ||
const index = textual(item).toLowerCase().indexOf(qry); | ||
if (index < 0) { | ||
@@ -7,0 +8,0 @@ continue; |
{ | ||
"name": "@neovici/cosmoz-autocomplete", | ||
"version": "7.5.1", | ||
"version": "7.6.0", | ||
"description": "A autocomplete input web component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
36638
1002