mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 11:40:54 +01:00
Merge pull request #2714 from mikiher/keyboard-navigation
Fix input width in MultiSelect UI components - replacement solution
This commit is contained in:
commit
0d9d2fa4be
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</div>
|
</div>
|
||||||
<input v-show="!readonly" ref="input" v-model="textInput" :disabled="disabled" style="min-width: 40px; width: fit-content" class="h-full bg-primary focus:outline-none px-1" @keydown="keydownInput" @focus="inputFocus" @blur="inputBlur" @paste="inputPaste" />
|
<input v-show="!readonly" ref="input" v-model="textInput" :disabled="disabled" class="h-full bg-primary focus:outline-none px-1 w-6" @keydown="keydownInput" @focus="inputFocus" @blur="inputBlur" @paste="inputPaste" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -110,6 +110,15 @@ export default {
|
|||||||
this.typingTimeout = setTimeout(() => {
|
this.typingTimeout = setTimeout(() => {
|
||||||
this.currentSearch = this.textInput
|
this.currentSearch = this.textInput
|
||||||
}, 100)
|
}, 100)
|
||||||
|
this.setInputWidth()
|
||||||
|
},
|
||||||
|
setInputWidth() {
|
||||||
|
setTimeout(() => {
|
||||||
|
var value = this.$refs.input.value
|
||||||
|
var len = value.length * 7 + 24
|
||||||
|
this.$refs.input.style.width = len + 'px'
|
||||||
|
this.recalcMenuPos()
|
||||||
|
}, 50)
|
||||||
},
|
},
|
||||||
recalcMenuPos() {
|
recalcMenuPos() {
|
||||||
if (!this.menu || !this.$refs.inputWrapper) return
|
if (!this.menu || !this.$refs.inputWrapper) return
|
||||||
@ -199,7 +208,10 @@ export default {
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
if (this.$refs.input) this.$refs.input.focus()
|
if (this.$refs.input) {
|
||||||
|
this.$refs.input.style.width = '24px'
|
||||||
|
this.$refs.input.focus()
|
||||||
|
}
|
||||||
|
|
||||||
var newSelected = null
|
var newSelected = null
|
||||||
if (this.selected.includes(itemValue)) {
|
if (this.selected.includes(itemValue)) {
|
||||||
@ -252,6 +264,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.insertNewItem(this.textInput)
|
this.insertNewItem(this.textInput)
|
||||||
}
|
}
|
||||||
|
if (this.$refs.input) this.$refs.input.style.width = '24px'
|
||||||
},
|
},
|
||||||
scroll() {
|
scroll() {
|
||||||
this.recalcMenuPos()
|
this.recalcMenuPos()
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<div v-if="showEdit && !disabled" class="rounded-full cursor-pointer w-6 h-6 mx-0.5 bg-bg flex items-center justify-center">
|
<div v-if="showEdit && !disabled" class="rounded-full cursor-pointer w-6 h-6 mx-0.5 bg-bg flex items-center justify-center">
|
||||||
<span class="material-icons text-white hover:text-success pt-px pr-px" style="font-size: 1.1rem" @click.stop="addItem">add</span>
|
<span class="material-icons text-white hover:text-success pt-px pr-px" style="font-size: 1.1rem" @click.stop="addItem">add</span>
|
||||||
</div>
|
</div>
|
||||||
<input v-show="!readonly" ref="input" v-model="textInput" :disabled="disabled" style="min-width: 40px; width: fit-content" class="h-full bg-primary focus:outline-none px-1" @keydown="keydownInput" @focus="inputFocus" @blur="inputBlur" @paste="inputPaste" />
|
<input v-show="!readonly" ref="input" v-model="textInput" :disabled="disabled" class="h-full bg-primary focus:outline-none px-1 w-6" @keydown="keydownInput" @focus="inputFocus" @blur="inputBlur" @paste="inputPaste" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -126,7 +126,16 @@ export default {
|
|||||||
clearTimeout(this.typingTimeout)
|
clearTimeout(this.typingTimeout)
|
||||||
this.typingTimeout = setTimeout(() => {
|
this.typingTimeout = setTimeout(() => {
|
||||||
this.search()
|
this.search()
|
||||||
}, 250)
|
}, 250)
|
||||||
|
this.setInputWidth()
|
||||||
|
},
|
||||||
|
setInputWidth() {
|
||||||
|
setTimeout(() => {
|
||||||
|
var value = this.$refs.input.value
|
||||||
|
var len = value.length * 7 + 24
|
||||||
|
this.$refs.input.style.width = len + 'px'
|
||||||
|
this.recalcMenuPos()
|
||||||
|
}, 50)
|
||||||
},
|
},
|
||||||
recalcMenuPos() {
|
recalcMenuPos() {
|
||||||
if (!this.menu || !this.$refs.inputWrapper) return
|
if (!this.menu || !this.$refs.inputWrapper) return
|
||||||
@ -219,7 +228,10 @@ export default {
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
if (this.$refs.input) this.$refs.input.focus()
|
if (this.$refs.input) {
|
||||||
|
this.$refs.input.style.width = '24px'
|
||||||
|
this.$refs.input.focus()
|
||||||
|
}
|
||||||
|
|
||||||
let newSelected = null
|
let newSelected = null
|
||||||
if (this.getIsSelected(item.id)) {
|
if (this.getIsSelected(item.id)) {
|
||||||
@ -282,6 +294,7 @@ export default {
|
|||||||
name: this.textInput
|
name: this.textInput
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (this.$refs.input) this.$refs.input.style.width = '24px'
|
||||||
},
|
},
|
||||||
scroll() {
|
scroll() {
|
||||||
this.recalcMenuPos()
|
this.recalcMenuPos()
|
||||||
|
Loading…
Reference in New Issue
Block a user