Skip to content

Commit 4a6e500

Browse files
committed
Add some props for hiding search and pagination
1 parent 602a4a6 commit 4a6e500

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

js/Components/Pagination.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
v-if="hasPagination"
44
class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"
55
>
6+
{{ hasPagination}}
67
<p v-if="!hasData || pagination.total < 1">
78
{{ translations.no_results_found }}
89
</p>
@@ -229,7 +230,7 @@ const hasLinks = computed(() => {
229230
});
230231
231232
const hasPagination = computed(() => {
232-
return Object.keys(pagination.value).length > 0;
233+
return Object.keys(pagination.value).length > 0 && pagination.value.total > 1;
233234
});
234235
235236
const pagination = computed(() => {

js/Components/Table.vue

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
:on-filter-change="changeFilterValue"
2121
>
2222
<TableFilter
23-
23+
v-if="hasData"
2424
:has-enabled-filters="queryBuilderProps.hasEnabledFilters"
2525
:filters="queryBuilderProps.filters"
2626
:on-filter-change="changeFilterValue"
2727
/>
2828
</slot>
2929
</div>
30-
3130
<div
32-
v-if="queryBuilderProps.globalSearch"
3331
class="flex flex-row order-1 w-full mb-2 sm:w-auto sm:flex-grow sm:order-2 sm:mb-0 "
3432
>
3533
<slot
@@ -40,7 +38,7 @@
4038
:on-change="changeGlobalSearchValue"
4139
>
4240
<TableGlobalSearch
43-
v-if="queryBuilderProps.globalSearch"
41+
v-if="showGlobalSearch && queryBuilderProps.globalSearch && hasData"
4442
class="flex-grow"
4543
:label="queryBuilderProps.globalSearch.label"
4644
:value="queryBuilderProps.globalSearch.value"
@@ -71,7 +69,7 @@
7169
:on-add="showSearchInput"
7270
>
7371
<TableAddSearchRow
74-
v-if="queryBuilderProps.hasSearchInputs"
72+
v-if="showGlobalSearch && queryBuilderProps.hasSearchInputs && hasData"
7573
class="order-3 sm:order-4"
7674
:search-inputs="queryBuilderProps.searchInputsWithoutGlobal"
7775
:has-search-inputs-without-value="queryBuilderProps.hasSearchInputsWithoutValue"
@@ -173,6 +171,15 @@
173171
</td>
174172
</tr>
175173
</slot>
174+
175+
<tr v-if="!hasData">
176+
<td
177+
class="px-6 py-4 text-sm text-gray-500 whitespace-nowrap text-center"
178+
:colspan="100"
179+
>
180+
Geen resultaten gevonden.
181+
</td>
182+
</tr>
176183
</tbody>
177184
</table>
178185
</slot>
@@ -295,6 +302,12 @@ const props = defineProps({
295302
focusBorder: "focus:border-indigo-500"
296303
};
297304
}
305+
},
306+
307+
showGlobalSearch: {
308+
type: [Boolean, String],
309+
default: true,
310+
required: false,
298311
}
299312
});
300313

js/Components/TableFilter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
role="menu"
2828
aria-orientation="horizontal"
2929
aria-labelledby="filter-menu"
30-
class="min-w-max"
30+
class="min-w-[320px]"
3131
>
3232
<div
3333
v-for="(filter, key) in filters"

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jdanino/inertiajs-tables-laravel-query-builder",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "Inertia.js Front-end Components for Spatie's Laravel Query Builder",
55
"private": false,
66
"author": "Pascal Baljet <pascal@protone.media>",

0 commit comments

Comments
 (0)