git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit ecda2432805a17ed2c63337f3316d731822ad189

profile filter: match ID, auto focus search box

Matt McKegg committed on 2/12/2018, 9:59:21 PM
Parent: e90da2f27b61cf784fcae42a35492b32c3e19af3

Files changed

modules/sheet/profiles.jschanged
modules/sheet/profiles.jsView
@@ -26,9 +26,9 @@
2626 var filteredIds = computed([ids, nameLookup, currentFilter], (ids, nameLookup, filter) => {
2727 if (filter) {
2828 var result = []
2929 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) {
3131 result.push(k)
3232 }
3333 }
3434 return result
@@ -48,8 +48,9 @@
4848 placeholder: 'filter names',
4949 'ev-input': function (ev) {
5050 currentFilter.set(ev.target.value)
5151 },
52+ hooks: [FocusHook()],
5253 style: {
5354 'float': 'right',
5455 'font-size': '100%'
5556 }
@@ -101,4 +102,13 @@
101102 ])
102103 ]
103104 }
104105 }
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