mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
29 lines
889 B
JavaScript
29 lines
889 B
JavaScript
import paginatedDropdown from '@baserow/modules/core/mixins/paginatedDropdown'
|
|
import dropdown from '@baserow/modules/core/mixins/dropdown'
|
|
|
|
export default {
|
|
name: 'inMemoryPaginatedDropdown',
|
|
mixins: [paginatedDropdown],
|
|
methods: {
|
|
fetchPage(page = 1, query = '') {
|
|
const start = (page - 1) * this.pageSize
|
|
const results = this.filterItems(query || '')
|
|
return {
|
|
data: {
|
|
count: results.length,
|
|
results: results.slice(start, start + this.pageSize),
|
|
},
|
|
}
|
|
},
|
|
search() {
|
|
this.fetch(1, this.query)
|
|
},
|
|
hide() {
|
|
// Call the dropdown `hide` method because it resets the search. We're
|
|
// deliberately not inheriting the `paginatedDropdown` method because that one
|
|
// doesn't reset the search because then another reset is made.
|
|
return dropdown.methods.hide.call(this)
|
|
},
|
|
},
|
|
}
|