|
27 | 27 | + (singleSectionView ? 'single-section-view ' : '')
|
28 | 28 | + (this.colCount ? `col-count-${this.colCount} ` : '')"
|
29 | 29 | >
|
30 |
| - <template v-for="(section, index) in filteredTiles"> |
| 30 | + <template v-for="(section, index) in filteredSections"> |
31 | 31 | <Section
|
32 | 32 | :key="index"
|
33 | 33 | :index="index"
|
34 | 34 | :title="section.name"
|
35 | 35 | :icon="section.icon || undefined"
|
36 | 36 | :displayData="getDisplayData(section)"
|
37 | 37 | :groupId="`${pageId}-section-${index}`"
|
38 |
| - :items="filterTiles(section.items, searchValue)" |
| 38 | + :items="section.filteredItems" |
39 | 39 | :widgets="section.widgets"
|
40 | 40 | :searchTerm="searchValue"
|
41 | 41 | :itemSize="itemSizeBound"
|
42 | 42 | @itemClicked="finishedSearching()"
|
43 | 43 | @change-modal-visibility="updateModalVisibility"
|
44 | 44 | :isWide="!!singleSectionView || layoutOrientation === 'horizontal'"
|
45 |
| - :class=" |
46 |
| - (searchValue && filterTiles(section.items, searchValue).length === 0) ? 'no-results' : ''" |
| 45 | + :class="(searchValue && section.filteredItems.length === 0) ? 'no-results' : ''" |
47 | 46 | />
|
48 | 47 | </template>
|
49 | 48 | <!-- Show add new section button, in edit mode -->
|
50 | 49 | <AddNewSection v-if="isEditMode && !singleSectionView" />
|
51 | 50 | </div>
|
52 | 51 | <!-- Show message when there's no data to show -->
|
53 |
| - <div v-if="checkIfResults() && !isEditMode" class="no-data"> |
| 52 | + <div v-if="checkIfResults(filteredSections) && !isEditMode" class="no-data"> |
54 | 53 | {{searchValue ? $t('home.no-results') : $t('home.no-data')}}
|
55 | 54 | </div>
|
56 | 55 | <!-- Show banner at bottom of screen, for Saving config changes -->
|
@@ -100,10 +99,14 @@ export default {
|
100 | 99 | if (colCount > 8) colCount = 8;
|
101 | 100 | return colCount;
|
102 | 101 | },
|
103 |
| - /* Return all sections, that match users search term */ |
104 |
| - filteredTiles() { |
| 102 | + /* Return sections with filtered items, that match users search term */ |
| 103 | + filteredSections() { |
105 | 104 | const sections = this.singleSectionView || this.sections;
|
106 |
| - return sections.filter((section) => this.filterTiles(section.items, this.searchValue)); |
| 105 | + return sections.map((_section) => { |
| 106 | + const section = _section; |
| 107 | + section.filteredItems = this.filterTiles(section.items, this.searchValue); |
| 108 | + return section; |
| 109 | + }); |
107 | 110 | },
|
108 | 111 | /* Updates layout (when button clicked), and saves in local storage */
|
109 | 112 | layoutOrientation() {
|
|
0 commit comments