mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
Update the nuxt3 version. Co-authored-by: Jonathan Adeline <jonathan@baserow.io> Co-authored-by: Bram Wiepjes <bramw@protonmail.com> Co-authored-by: Cezary <cezary@baserow.io> Co-authored-by: Tsering Paljor <tsering@baserow.io> Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io> Co-authored-by: Bram <bram2w@users.noreply.github.com>
60 lines
1.6 KiB
Vue
60 lines
1.6 KiB
Vue
<template>
|
|
<ul class="elements-list">
|
|
<ElementsListItem
|
|
v-for="element in filteredElements"
|
|
:key="element.id"
|
|
:element="element"
|
|
:filtered-search-elements="filteredSearchElements"
|
|
@select="$emit('select', $event)"
|
|
>
|
|
<template #children="{ children }">
|
|
<ElementsList
|
|
v-if="children.length"
|
|
name="nested-elements-list"
|
|
:elements="children"
|
|
:filtered-search-elements="filteredSearchElements"
|
|
@select="$emit('select', $event)"
|
|
/>
|
|
</template>
|
|
</ElementsListItem>
|
|
</ul>
|
|
</template>
|
|
|
|
<script>
|
|
import ElementsListItem from '@baserow/modules/builder/components/elements/ElementsListItem'
|
|
|
|
export default {
|
|
name: 'ElementsList',
|
|
components: { ElementsListItem },
|
|
props: {
|
|
elements: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
filteredSearchElements: {
|
|
type: Array,
|
|
required: false,
|
|
default: () => [],
|
|
},
|
|
},
|
|
emits: ['select'],
|
|
computed: {
|
|
/**
|
|
* Responsible for returning elements to display in `ElementsListItem`.
|
|
* If we've been given an array of `filteredSearchElements`, we'll filter
|
|
* the elements to only include those that match the `id` of the element.
|
|
* If `filteredSearchElements` is empty, then we show all `elements`.
|
|
*/
|
|
filteredElements() {
|
|
if (this.filteredSearchElements.length === 0) {
|
|
return this.elements
|
|
} else {
|
|
return this.elements.filter((element) => {
|
|
return this.filteredSearchElements.includes(element.id)
|
|
})
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|