@izumisy-tailor/tailor-data-viewer 0.1.53 → 0.1.54
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/package.json
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
ArrowUpDown,
|
|
6
6
|
ChevronRight,
|
|
7
7
|
ChevronDown,
|
|
8
|
-
ChevronLeft,
|
|
9
8
|
X,
|
|
10
9
|
MoreHorizontal,
|
|
11
10
|
} from "lucide-react";
|
|
11
|
+
import { Pagination } from "./pagination";
|
|
12
12
|
import {
|
|
13
13
|
Table,
|
|
14
14
|
TableBody,
|
|
@@ -80,16 +80,8 @@ export function DataTable(props: DataTableProps = {}) {
|
|
|
80
80
|
return new Map(columnDefinitions.map((col) => [col.field, col]));
|
|
81
81
|
}, [columnDefinitions]);
|
|
82
82
|
|
|
83
|
-
const {
|
|
84
|
-
|
|
85
|
-
loading,
|
|
86
|
-
sortState,
|
|
87
|
-
setSort,
|
|
88
|
-
pagination,
|
|
89
|
-
hasPreviousPage,
|
|
90
|
-
nextPage,
|
|
91
|
-
previousPage,
|
|
92
|
-
} = useTableDataContext();
|
|
83
|
+
const { data, loading, sortState, setSort, pagination, hasPreviousPage } =
|
|
84
|
+
useTableDataContext();
|
|
93
85
|
|
|
94
86
|
const fields = tableMetadata?.fields ?? [];
|
|
95
87
|
|
|
@@ -563,38 +555,8 @@ export function DataTable(props: DataTableProps = {}) {
|
|
|
563
555
|
</Table>
|
|
564
556
|
</div>
|
|
565
557
|
|
|
566
|
-
{/* Integrated Pagination */}
|
|
567
|
-
|
|
568
|
-
<div className="text-muted-foreground text-sm">
|
|
569
|
-
{data.length > 0 ? (
|
|
570
|
-
<>
|
|
571
|
-
<span className="font-medium">{data.length}</span> 件を表示
|
|
572
|
-
</>
|
|
573
|
-
) : (
|
|
574
|
-
"データなし"
|
|
575
|
-
)}
|
|
576
|
-
</div>
|
|
577
|
-
<div className="flex items-center gap-2">
|
|
578
|
-
<Button
|
|
579
|
-
variant="outline"
|
|
580
|
-
size="sm"
|
|
581
|
-
onClick={previousPage}
|
|
582
|
-
disabled={!hasPreviousPage}
|
|
583
|
-
>
|
|
584
|
-
<ChevronLeft className="size-4" />
|
|
585
|
-
前へ
|
|
586
|
-
</Button>
|
|
587
|
-
<Button
|
|
588
|
-
variant="outline"
|
|
589
|
-
size="sm"
|
|
590
|
-
onClick={nextPage}
|
|
591
|
-
disabled={!pagination.hasNextPage}
|
|
592
|
-
>
|
|
593
|
-
次へ
|
|
594
|
-
<ChevronRight className="size-4" />
|
|
595
|
-
</Button>
|
|
596
|
-
</div>
|
|
597
|
-
</div>
|
|
558
|
+
{/* Integrated Pagination - Hidden when data fits in a single page */}
|
|
559
|
+
{(hasPreviousPage || pagination.hasNextPage) && <Pagination />}
|
|
598
560
|
</>
|
|
599
561
|
);
|
|
600
562
|
}
|
|
@@ -229,13 +229,7 @@ function DataViewTabContentInner({
|
|
|
229
229
|
/>
|
|
230
230
|
|
|
231
231
|
{/* Pagination */}
|
|
232
|
-
<Pagination
|
|
233
|
-
pagination={tableData.pagination}
|
|
234
|
-
currentCount={tableData.data.length}
|
|
235
|
-
onNext={tableData.nextPage}
|
|
236
|
-
onPrevious={tableData.previousPage}
|
|
237
|
-
hasPreviousPage={tableData.hasPreviousPage}
|
|
238
|
-
/>
|
|
232
|
+
<Pagination />
|
|
239
233
|
</div>
|
|
240
234
|
);
|
|
241
235
|
}
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
2
2
|
import { Button } from "./ui/button";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
interface PaginationProps {
|
|
6
|
-
pagination: PaginationState;
|
|
7
|
-
currentCount: number;
|
|
8
|
-
onNext: () => void;
|
|
9
|
-
onPrevious: () => void;
|
|
10
|
-
hasPreviousPage: boolean;
|
|
11
|
-
}
|
|
3
|
+
import { useTableDataContext } from "./contexts";
|
|
12
4
|
|
|
13
5
|
/**
|
|
14
6
|
* Pagination controls for the data table
|
|
7
|
+
* Uses TableDataContext internally - no props required
|
|
15
8
|
*/
|
|
16
|
-
export function Pagination({
|
|
17
|
-
pagination,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onPrevious,
|
|
21
|
-
hasPreviousPage,
|
|
22
|
-
}: PaginationProps) {
|
|
9
|
+
export function Pagination() {
|
|
10
|
+
const { data, pagination, hasPreviousPage, nextPage, previousPage } =
|
|
11
|
+
useTableDataContext();
|
|
12
|
+
|
|
23
13
|
return (
|
|
24
14
|
<div className="flex items-center justify-between py-2">
|
|
25
15
|
<div className="text-muted-foreground text-sm">
|
|
26
|
-
{
|
|
16
|
+
{data.length > 0 ? (
|
|
27
17
|
<>
|
|
28
|
-
<span className="font-medium">{
|
|
18
|
+
<span className="font-medium">{data.length}</span> 件を表示
|
|
29
19
|
</>
|
|
30
20
|
) : (
|
|
31
21
|
"データなし"
|
|
@@ -35,7 +25,7 @@ export function Pagination({
|
|
|
35
25
|
<Button
|
|
36
26
|
variant="outline"
|
|
37
27
|
size="sm"
|
|
38
|
-
onClick={
|
|
28
|
+
onClick={previousPage}
|
|
39
29
|
disabled={!hasPreviousPage}
|
|
40
30
|
>
|
|
41
31
|
<ChevronLeft className="size-4" />
|
|
@@ -44,7 +34,7 @@ export function Pagination({
|
|
|
44
34
|
<Button
|
|
45
35
|
variant="outline"
|
|
46
36
|
size="sm"
|
|
47
|
-
onClick={
|
|
37
|
+
onClick={nextPage}
|
|
48
38
|
disabled={!pagination.hasNextPage}
|
|
49
39
|
>
|
|
50
40
|
次へ
|