diff --git a/komga-webui/src/components/FilterPanels.vue b/komga-webui/src/components/FilterPanels.vue index 7878dd891..95c7bbf86 100644 --- a/komga-webui/src/components/FilterPanels.vue +++ b/komga-webui/src/components/FilterPanels.vue @@ -16,20 +16,30 @@ {{ f.name }} - + + + + + > + + + mdi-checkbox-marked + + {{ v }} + + import Vue, {PropType} from 'vue' +import SearchBoxBase from "@/components/SearchBoxBase.vue"; export default Vue.extend({ name: 'FilterPanels', - data: () => { - return { - search: {} as any, - model: {} as any, - items: {} as any, - loading: {} as any, - } - }, + components: {SearchBoxBase}, props: { filtersOptions: { type: Object as PropType, @@ -78,46 +82,6 @@ export default Vue.extend({ required: true, }, }, - watch: { - search: { - deep: true, - async handler(val: any) { - for (const prop in val) { - if (val[prop] !== null) { - this.loading[prop] = true - this.$set(this.items, prop, await (this.filtersOptions[prop] as any).search(val[prop])) - this.loading[prop] = false - } - } - }, - }, - model: { - deep: true, - async handler(val: any) { - for (const prop in val) { - if (val[prop] !== null && val[prop] !== this.filtersActive[prop]) { - let r = this.$_.cloneDeep(this.filtersActive) - r[prop] = this.$_.clone(val[prop]) - - this.$emit('update:filtersActive', r) - } - } - }, - }, - filtersActive: { - deep: true, - immediate: true, - handler(val: any) { - for (const prop in val) { - if (val[prop].length > 0) { - // we need to add existing values to items also, else v-autocomplete won't show it - this.$set(this.items, prop, this.$_.union(this.items[prop], val[prop])) - this.$set(this.model, prop, val[prop]) - } - } - }, - }, - }, methods: { clear(key: string) { let r = this.$_.cloneDeep(this.filtersActive) diff --git a/komga-webui/src/components/SearchBoxBase.vue b/komga-webui/src/components/SearchBoxBase.vue new file mode 100644 index 000000000..5922c06fb --- /dev/null +++ b/komga-webui/src/components/SearchBoxBase.vue @@ -0,0 +1,98 @@ + + +