77 <!-- there's only one (default) column now -->
88
99 <vue-draggable-next
10- v-if =" tabsForColumn() .length > 0"
10+ v-if =" tabs .length > 0"
1111 class =" q-ma-none"
12- :list =" tabsForColumn() as Array<IndexedTab> "
12+ :list =" tabs "
1313 :group =" { name: 'tabs', pull: 'clone' }"
1414 @change =" (event: any) => handleDragAndDrop(event, column)" >
1515 <SidePanelTabListHelper
16- v-for =" tab in tabsForColumn() as Array<IndexedTab> "
16+ v-for =" tab in tabs "
1717 :tab =" tab.tab as Tab"
1818 :index =" tab.index"
1919 :type =" props.type"
2424 :hide-menu =" props.hideMenu"
2525 :filter =" props.filter || ''" />
2626 </vue-draggable-next >
27- <div v-else class =" q-ma-md text-caption" >
27+ <div v-else-if = " props.filter " class =" q-ma-md text-caption" >
2828 Filter <em >'{{ props.filter }}'</em > did not match anything inside this collection. Click 'Enter' to search in
2929 all your collections.
3030 </div >
31+ <div v-else-if =" props.tabset?.folders.length === 0" class =" q-ma-md text-caption" >Empty Collection</div >
3132 </template >
3233
3334 <!-- no drag & drop on mobile -->
3435 <template v-else >
3536 <SidePanelTabListHelper
36- v-for =" tab in tabsForColumn() as Array<IndexedTab> "
37+ v-for =" tab in tabs "
3738 :tab =" tab.tab as Tab"
3839 :index =" 0"
3940 :type =" props.type"
5354</template >
5455
5556<script setup lang="ts">
56- import _ from ' lodash'
5757import { SPECIAL_ID_FOR_NO_GROUP_ASSIGNED } from ' src/boot/constants'
5858import SidePanelTabListHelper from ' src/tabsets/layouts/SidePanelTabListHelper.vue'
5959import { IndexedTab } from ' src/tabsets/models/IndexedTab'
@@ -62,7 +62,7 @@ import { Tabset, TabsetType } from 'src/tabsets/models/Tabset'
6262import { TabsetColumn } from ' src/tabsets/models/TabsetColumn'
6363import TabsetService from ' src/tabsets/services/TabsetService'
6464import { useTabsetService } from ' src/tabsets/services/TabsetService2'
65- import { PropType , ref , watchEffect } from ' vue'
65+ import { PropType , ref , watch } from ' vue'
6666import { VueDraggableNext } from ' vue-draggable-next'
6767
6868const props = defineProps ({
@@ -77,7 +77,14 @@ const props = defineProps({
7777 filter: { type: String , required: false },
7878})
7979
80- const tabs = ref <Tab []>([])
80+ const tabs = ref <IndexedTab []>([])
81+
82+ watch (
83+ () => props .filter ,
84+ (a : string | undefined , b : string | undefined ) => {
85+ tabs .value = tabsForColumn ()
86+ },
87+ )
8188
8289const handleDragAndDrop = async (event : any , column : TabsetColumn ) => {
8390 console .log (' SidePanelPageTabList d&d event:' , event )
@@ -87,16 +94,8 @@ const handleDragAndDrop = async (event: any, column: TabsetColumn) => {
8794 const tabsInColumn = tabsForColumn ()
8895 const movedElement: Tab = tabsInColumn [moved .oldIndex ]! .tab
8996 const realNewIndex = tabsInColumn [moved .newIndex ]! .index
90- console .log (` '${movedElement .id }' ${moved .oldIndex } -> ${realNewIndex } ` )
97+ // console.log(` '${movedElement.id}' ${moved.oldIndex} -> ${realNewIndex}`)
9198 await TabsetService .moveTo (movedElement .id , realNewIndex , column )
92- console .log (' hier: ' , props .tabset )
93- if (props .tabset ) {
94- tabs .value = useTabsetService ().tabsToShow (props .tabset )
95- console .log (
96- ' tabs.value' ,
97- _ .map (tabs .value , (t : Tab ) => t .url ),
98- )
99- }
10099 }
101100 if (added ) {
102101 console .log (
@@ -111,17 +110,6 @@ const handleDragAndDrop = async (event: any, column: TabsetColumn) => {
111110 }
112111}
113112
114- watchEffect (() => {
115- // TODO why was this done in the first place? Updates from where?
116- // const tabset = useTabsStore().useTabsetsStore(props.tabset?.id || "")
117- if (props .tabset ) {
118- tabs .value = useTabsetService ().tabsToShow (props .tabset )
119- } else {
120- console .warn (' could not determine tabset...' )
121- tabs .value = []
122- }
123- })
124-
125113const getColumns = () => {
126114 return [new TabsetColumn (SPECIAL_ID_FOR_NO_GROUP_ASSIGNED , ' ' )]
127115}
@@ -131,7 +119,7 @@ const tabsForColumn = (): IndexedTab[] => {
131119 return property && property .toLowerCase ().indexOf (props .filter ! .toLowerCase ()! ) >= 0
132120 }
133121
134- return (tabs . value as Tab [])
122+ return (props . tabset ?. tabs as Tab [])
135123 .filter ((t : Tab ) => {
136124 if (! props .filter || props .filter .trim () === ' ' ) {
137125 return true
@@ -142,8 +130,9 @@ const tabsForColumn = (): IndexedTab[] => {
142130 return props .tabset && props .tabset .type === TabsetType .RSS_FOLDER ? b .created - a .created : 0
143131 })
144132 .map ((t : Tab , index : number ) => new IndexedTab (index , t ))
145- // return _.map(tabs.value as Tab[], (t: Tab, index: number) => new IndexedTab(index, t))
146133}
134+
135+ tabs .value = tabsForColumn ()
147136 </script >
148137
149138<style >
0 commit comments