2
0
mirror of https://github.com/frappe/books.git synced 2025-01-23 15:18:24 +00:00

fix: search modal scroll issue

- add button outlines
- remove random lifecycle methods
- fix create option name display
This commit is contained in:
18alantom 2023-03-24 14:42:06 +05:30 committed by Alan
parent 4fa3169ce4
commit 524111418c
4 changed files with 7 additions and 25 deletions

View File

@ -1,13 +1,6 @@
<template> <template>
<button <button
class=" class="rounded-md flex justify-center items-center text-sm"
focus:outline-none
rounded-md
flex
justify-center
items-center
text-sm
"
:class="_class" :class="_class"
v-bind="$attrs" v-bind="$attrs"
> >

View File

@ -121,8 +121,8 @@ export default {
value: () => this.value, value: () => this.value,
linkValue: () => this.linkValue, linkValue: () => this.linkValue,
isNewValue: () => { isNewValue: () => {
let values = this.suggestions.map((d) => d.value); const values = this.suggestions.map((d) => d.label);
return this.value && !values.includes(this.value); return this.linkValue && !values.includes(this.linkValue);
}, },
}, },
components: { Badge }, components: { Badge },

View File

@ -79,12 +79,6 @@ export default defineComponent({
this.focusButton(); this.focusButton();
}, },
unmounted() {
console.log('unmounted');
},
deactivated() {
console.log('deactivated');
},
methods: { methods: {
focusButton() { focusButton() {
let button = this.primary?.[0]; let button = this.primary?.[0];

View File

@ -49,7 +49,7 @@
<div <div
v-for="(si, i) in suggestions" v-for="(si, i) in suggestions"
:key="`${i}-${si.label}`" :key="`${i}-${si.label}`"
ref="suggestions" :data-index="`search-suggestion-${i}`"
class="hover:bg-gray-50 cursor-pointer" class="hover:bg-gray-50 cursor-pointer"
:class="idx === i ? 'border-blue-500 bg-gray-50 border-s-4' : ''" :class="idx === i ? 'border-blue-500 bg-gray-50 border-s-4' : ''"
@click="select(i)" @click="select(i)"
@ -332,14 +332,9 @@ export default defineComponent({
this.close(); this.close();
}, },
scrollToHighlighted(): void { scrollToHighlighted(): void {
const suggestionRefs = this.$refs.suggestions; const query = `[data-index="search-suggestion-${this.idx}"]`;
if (!Array.isArray(suggestionRefs)) { const element = document.querySelectorAll(query)?.[0];
return; element?.scrollIntoView({ block: 'nearest' });
}
const el = suggestionRefs[this.idx];
if (el instanceof HTMLElement) {
el.scrollIntoView({ block: 'nearest' });
}
}, },
getGroupFilterButtonClass(g: SearchGroup): string { getGroupFilterButtonClass(g: SearchGroup): string {
if (!this.searcher) { if (!this.searcher) {