Commit ecda2432805a17ed2c63337f3316d731822ad189
profile filter: match ID, auto focus search box
Matt McKegg committed on 2/12/2018, 9:59:21 PMParent: e90da2f27b61cf784fcae42a35492b32c3e19af3
Files changed
modules/sheet/profiles.js | changed |
modules/sheet/profiles.js | ||
---|---|---|
@@ -26,9 +26,9 @@ | ||
26 | 26 | var filteredIds = computed([ids, nameLookup, currentFilter], (ids, nameLookup, filter) => { |
27 | 27 | if (filter) { |
28 | 28 | var result = [] |
29 | 29 | for (var k in nameLookup) { |
30 | - if (nameLookup[k] && nameLookup[k].toLowerCase().includes(filter.toLowerCase())) { | |
30 | + if ((nameLookup[k] && nameLookup[k].toLowerCase().includes(filter.toLowerCase())) || k === filter) { | |
31 | 31 | result.push(k) |
32 | 32 | } |
33 | 33 | } |
34 | 34 | return result |
@@ -48,8 +48,9 @@ | ||
48 | 48 | placeholder: 'filter names', |
49 | 49 | 'ev-input': function (ev) { |
50 | 50 | currentFilter.set(ev.target.value) |
51 | 51 | }, |
52 | + hooks: [FocusHook()], | |
52 | 53 | style: { |
53 | 54 | 'float': 'right', |
54 | 55 | 'font-size': '100%' |
55 | 56 | } |
@@ -101,4 +102,13 @@ | ||
101 | 102 | ]) |
102 | 103 | ] |
103 | 104 | } |
104 | 105 | } |
106 | + | |
107 | +function FocusHook () { | |
108 | + return function (element) { | |
109 | + setTimeout(() => { | |
110 | + element.focus() | |
111 | + element.select() | |
112 | + }, 5) | |
113 | + } | |
114 | +} |
Built with git-ssb-web