2727 :key =" month"
2828 class =" file-picker__navigation__month"
2929 :class =" {selected: targetMonth === month}"
30- @click =" scrollTo( month) " >
30+ @click =" targetMonth = month" >
3131 {{ month | dateMonthAndYear }}
3232 </div >
3333 </div >
3434 <FilesListViewer class =" file-picker__file-list"
35- :file-ids-by-section =" filesListByMonth "
35+ :file-ids-by-section =" fileIdsByMonth "
3636 :sections =" monthsList"
37- :loading =" loadingFiles && fetchedFileIds.length !== 0 "
37+ :loading =" loadingFiles"
3838 :base-height =" 100"
3939 :section-header-height =" 50"
4040 :scroll-to-section =" targetMonth"
41- @need-content =" fetchedFileIds " >
41+ @need-content =" fetchFiles " >
4242 <template slot-scope="{file, height, visibility}">
4343 <h3 v-if =" file.sectionHeader"
4444 :id =" `file-picker-section-header-${file.id}`"
@@ -84,6 +84,7 @@ import FetchFilesMixin from '../mixins/FetchFilesMixin.js'
8484import FilesSelectionMixin from ' ../mixins/FilesSelectionMixin.js'
8585import FilesListViewer from ' ./FilesListViewer.vue'
8686import File from ' ./File.vue'
87+ import FilesByMonthMixin from ' ../mixins/FilesByMonthMixin.js'
8788
8889export default {
8990 name: ' FilesPicker' ,
@@ -107,6 +108,7 @@ export default {
107108
108109 mixins: [
109110 FetchFilesMixin,
111+ FilesByMonthMixin,
110112 FilesSelectionMixin,
111113 ],
112114
@@ -121,34 +123,6 @@ export default {
121123 }
122124 },
123125
124- computed: {
125- /**
126- * @return {string[]}
127- */
128- filesListByMonth () {
129- const filesByMonth = {}
130- for (const fileId of Object .keys (this .files )) {
131- const file = this .files [fileId]
132- filesByMonth[file .month ] = filesByMonth[file .month ] ?? []
133- filesByMonth[file .month ].push (file .fileid )
134- }
135-
136- // Sort files in sections.
137- Object .keys (filesByMonth).forEach (month => filesByMonth[month].sort (this .sortFilesByTimestamp ))
138-
139- return filesByMonth
140- },
141-
142- /**
143- * @return {string[]}
144- */
145- monthsList () {
146- return Object
147- .keys (this .filesListByMonth )
148- .sort ((month1 , month2 ) => month1 > month2 ? - 1 : 1 )
149- },
150- },
151-
152126 watch: {
153127 monthsList (value ) {
154128 if (this .targetMonth === null ) {
@@ -182,6 +156,7 @@ export default {
182156
183157 & __content {
184158 display : flex ;
159+ align-items : flex-start ;
185160 flex-grow : 1 ;
186161 height : 500px ;
187162 }
@@ -191,6 +166,7 @@ export default {
191166 overflow : scroll ;
192167 margin-right : 8px ;
193168 padding-right : 8px ;
169+ height : 100% ;
194170
195171 & __month {
196172 font-weight : bold ;
@@ -213,6 +189,7 @@ export default {
213189 & __file-list {
214190 flex-grow : 1 ;
215191 min-width : 0 ;
192+ height : 100% ;
216193
217194 .section-header {
218195 font-weight : bold ;
0 commit comments