@stephenchenorg/astro 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/error.d.ts +2 -0
- package/dist/pagination/stub/Pagination.astro +8 -2
- package/dist/query-params/components/ProvideUrlConfig.astro +1 -3
- package/dist/query-params/index.d.ts +1 -0
- package/dist/query-params/index.js +1 -0
- package/dist/query-params/url.d.ts +5 -0
- package/package.json +1 -1
package/dist/api/error.d.ts
CHANGED
|
@@ -12,10 +12,14 @@ const {
|
|
|
12
12
|
items,
|
|
13
13
|
showPagination,
|
|
14
14
|
currentPage,
|
|
15
|
+
canFirst,
|
|
15
16
|
canPrev,
|
|
16
17
|
canNext,
|
|
18
|
+
canLast,
|
|
19
|
+
firstUrl,
|
|
17
20
|
prevUrl,
|
|
18
21
|
nextUrl,
|
|
22
|
+
lastUrl,
|
|
19
23
|
getUrl,
|
|
20
24
|
} = usePagination({
|
|
21
25
|
total: Astro.props.total,
|
|
@@ -28,12 +32,14 @@ const {
|
|
|
28
32
|
|
|
29
33
|
{showPagination && (
|
|
30
34
|
<div>
|
|
31
|
-
{
|
|
35
|
+
{canFirst && <a href={firstUrl}>First</a>}
|
|
36
|
+
{canPrev && <a href={prevUrl}>Previous</a>}
|
|
32
37
|
{items.map(page =>
|
|
33
38
|
page === currentPage
|
|
34
39
|
? <span>{page}</span>
|
|
35
40
|
: <a href={getUrl(page)}>{page}</a>
|
|
36
41
|
)}
|
|
37
|
-
{canNext && <a href={nextUrl}
|
|
42
|
+
{canNext && <a href={nextUrl}>Next</a>}
|
|
43
|
+
{canLast && <a href={lastUrl}>Last</a>}
|
|
38
44
|
</div>
|
|
39
45
|
)}
|
|
@@ -13,14 +13,12 @@ const config: UrlConfig = {
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
<script is:inline define:vars={{ config }}>
|
|
16
|
-
// eslint-disable-next-line style/semi
|
|
17
16
|
window.__astro_provide_url_config__ = config;
|
|
18
17
|
</script>
|
|
19
18
|
|
|
20
19
|
<script>
|
|
21
|
-
import { urlConfigStore } from '
|
|
20
|
+
import { urlConfigStore } from '@stephenchenorg/astro/query-params'
|
|
22
21
|
|
|
23
|
-
// @ts-ignore
|
|
24
22
|
const props = window.__astro_provide_url_config__
|
|
25
23
|
|
|
26
24
|
const baseUrl: string = props?.baseUrl || location.pathname
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import qs from 'query-string';
|
|
2
2
|
import type { UrlConfig } from './types';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__astro_provide_url_config__?: UrlConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
3
8
|
export interface QueryParamsUrlOptions {
|
|
4
9
|
transformParams?: (params: Record<string, any>) => Record<string, any>;
|
|
5
10
|
}
|