- update to AdonisJS 6
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m15s

This commit is contained in:
Kaimbacher 2024-03-14 20:25:27 +01:00
parent f828ca4491
commit cb51a4136f
167 changed files with 21485 additions and 21212 deletions

View file

@ -9,50 +9,70 @@ const props = defineProps({
default: () => ({}),
},
});
// meta:
// {total: 19, perPage: 5, currentPage: 1, lastPage: 4, firstPage: 1, }
// currentPage:
// 1
// firstPage:
// 1
// firstPageUrl:
// '/?page=1'
// lastPage:
// 4
// lastPageUrl:
// '/?page=4'
// nextPageUrl:
// '/?page=2'
// perPage:
// 5
// previousPageUrl:
// null
// total:
// 19
const nextPageLink = computed(() => {
let url = new URL(document.location);
url.searchParams.set('page', props.data.current_page + 1);
url.searchParams.set('page', props.data.currentPage + 1);
return url.href;
// return url + '&page=' + (Number(props.data.current_page) + 1);
// return url + '&page=' + (Number(props.data.currentPage) + 1);
});
const prevPageLink = computed(() => {
let url = new URL(document.location);
url.searchParams.set('page', props.data.current_page - 1);
url.searchParams.set('page', props.data.currentPage - 1);
return url.href;
// return url + '&page=' + (props.data.current_page - 1);
// return url + '&page=' + (props.data.currentPage - 1);
});
const toPage = computed(() => {
let currentPage = props.data.current_page;
let perPage = props.data.per_page;
let currentPage = props.data.currentPage;
let perPage = props.data.perPage;
if (props.data.current_page == props.data.last_page) {
if (props.data.currentPage == props.data.lastPage) {
return props.data.total;
} else {
return currentPage * perPage;
}
});
const fromPage = computed(() => {
let currentPage = props.data.current_page;
let perPage = props.data.per_page;
let currentPage = props.data.currentPage;
let perPage = props.data.perPage;
return currentPage * perPage - (perPage - 1);
});
</script>
<!-- current_page:
<!-- currentPage:
1
first_page:
firstPage:
1
first_page_url:
firstPageUrl:
'/?page=1'
last_page:
lastPage:
3
last_page_url:
lastPageUrl:
'/?page=3'
next_page_url:
nextPageUrl:
'/?page=2'
per_page:
perPage:
5
previous_page_url:
previousPageUrl:
null
total:
15 -->
@ -62,22 +82,22 @@ total:
<nav v-if="data.total > 3" role="navigation" aria-label="Pagination Navigation" class="flex items-center justify-between">
<div class="flex justify-between flex-1 sm:hidden">
<span
v-if="data.current_page <= 1"
v-if="data.currentPage <= 1"
class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md"
>
Previous
</span>
<Link
v-else
:href="data.previous_page_url"
:href="data.previousPageUrl"
class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150"
>
Previous
</Link>
<Link
v-if="data.current_page < data.last_page"
:href="data.next_page_url"
v-if="data.currentPage < data.lastPage"
:href="data.nextPageUrl"
class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150"
>
Next
@ -105,7 +125,7 @@ total:
<div>
<span class="relative z-0 inline-flex shadow-sm rounded-md">
<span v-if="props.data.current_page <= 1" aria-disabled="true" aria-label="Previous">
<span v-if="props.data.currentPage <= 1" aria-disabled="true" aria-label="Previous">
<span
class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md leading-5"
aria-hidden="true"
@ -120,7 +140,7 @@ total:
</span>
</span>
<!-- <Link v-else :href="data.previous_page_url" rel="prev" -->
<!-- <Link v-else :href="data.previousPageUrl" rel="prev" -->
<Link
v-else
:href="prevPageLink"
@ -138,7 +158,7 @@ total:
</Link>
<!-- <template v-for="(link, key) in data.links">
<template v-if="key > 0 && key < data.last_page + 1">
<template v-if="key > 0 && key < data.lastPage + 1">
<span v-if="!link.active && link.url === null" :key="key" aria-disabled="true">
<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 cursor-default leading-5">{{ link.label }}</span>
</span>
@ -152,7 +172,7 @@ total:
</template> -->
<Link
v-if="props.data.current_page < props.data.last_page"
v-if="props.data.currentPage < props.data.lastPage"
:href="nextPageLink"
rel="next"
class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150"