@itrocks/autocomplete 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/autocomplete.d.ts CHANGED
@@ -34,7 +34,7 @@ export declare class AutoComplete {
34
34
  onInputValueChange(): void;
35
35
  onKeyDown(event: KeyboardEvent): void;
36
36
  onTouchStart(event: Event): void;
37
- openSuggestions(event: Event): boolean;
37
+ openSuggestions(event: Event, force?: boolean): boolean;
38
38
  select(): void;
39
39
  suggest(value?: string): void;
40
40
  updateSuggestions(items: Item[], startsWith?: string): void;
package/autocomplete.js CHANGED
@@ -166,7 +166,7 @@ export class AutoComplete {
166
166
  keyDown(event) {
167
167
  if (DEBUG)
168
168
  console.log('keyDown()');
169
- if (this.openSuggestions(event))
169
+ if (this.openSuggestions(event, true))
170
170
  return;
171
171
  if (this.suggestions.isLastSelected())
172
172
  return;
@@ -277,7 +277,7 @@ export class AutoComplete {
277
277
  onTouchStart(event) {
278
278
  this.openSuggestions(event);
279
279
  }
280
- openSuggestions(event) {
280
+ openSuggestions(event, force = false) {
281
281
  if (DEBUG)
282
282
  console.log('openSuggestions()');
283
283
  const suggestions = this.suggestions;
@@ -291,7 +291,7 @@ export class AutoComplete {
291
291
  console.log('OS: isVisible is true => return');
292
292
  return false;
293
293
  }
294
- if ((suggestions.length > 1) || (!this.input.value.length && suggestions.length)) {
294
+ if (force || (suggestions.length > 1) || (!this.input.value.length && suggestions.length)) {
295
295
  if (DEBUG)
296
296
  console.log('OS: has items => show');
297
297
  event.preventDefault();
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  },
41
41
  "type": "module",
42
42
  "types": "./autocomplete.d.ts",
43
- "version": "0.1.9"
43
+ "version": "0.1.10"
44
44
  }