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>
<button
class="
focus:outline-none
rounded-md
flex
justify-center
items-center
text-sm
"
class="rounded-md flex justify-center items-center text-sm"
:class="_class"
v-bind="$attrs"
>

View File

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

View File

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

View File

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