cynx-lib 1.3.103 → 1.3.104
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
3
3
|
|
|
4
|
-
export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onChange, size = 'md', style = {} }) {
|
|
4
|
+
export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onChange, size = 'md', showTotal = false, style = {} }) {
|
|
5
5
|
const effectivePerPage = pageSize || perPage || 20;
|
|
6
6
|
const totalPages = pages || (total && effectivePerPage ? Math.ceil(total / effectivePerPage) : 0);
|
|
7
7
|
if (!totalPages || totalPages <= 1) return null;
|
|
@@ -12,8 +12,9 @@ export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onCh
|
|
|
12
12
|
else if (items[items.length - 1] !== '...') items.push('...');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const hasTotal = typeof total === 'number' && !isNaN(total);
|
|
16
|
+
const start = hasTotal && effectivePerPage ? (page - 1) * effectivePerPage + 1 : null;
|
|
17
|
+
const end = hasTotal && effectivePerPage ? Math.min(page * effectivePerPage, total) : null;
|
|
17
18
|
|
|
18
19
|
const SIZES = {
|
|
19
20
|
xs: { box: 26, icon: 13, font: '11px', gap: 6 },
|
|
@@ -35,13 +36,13 @@ export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onCh
|
|
|
35
36
|
...style,
|
|
36
37
|
}}
|
|
37
38
|
>
|
|
38
|
-
{start !== null && (
|
|
39
|
+
{showTotal && hasTotal && start !== null && (
|
|
39
40
|
<div style={{ fontSize: '.75rem', color: 'var(--muted, #797b8d)', fontFamily: 'var(--mono, ui-monospace, monospace)' }}>
|
|
40
41
|
{start}–{end} of {total}
|
|
41
42
|
</div>
|
|
42
43
|
)}
|
|
43
44
|
|
|
44
|
-
<div style={{ display: 'flex', gap: currentSize.gap, alignItems: 'center', marginLeft:
|
|
45
|
+
<div style={{ display: 'flex', gap: currentSize.gap, alignItems: 'center', marginLeft: 'auto' }}>
|
|
45
46
|
{/* Prev Button */}
|
|
46
47
|
<button
|
|
47
48
|
type="button"
|
package/ui/components/XTable.jsx
CHANGED
|
@@ -66,6 +66,10 @@ export function XTh({ children, style, className = '', ...props }) {
|
|
|
66
66
|
<th
|
|
67
67
|
className={className}
|
|
68
68
|
style={{
|
|
69
|
+
position: 'sticky',
|
|
70
|
+
top: 0,
|
|
71
|
+
zIndex: 2,
|
|
72
|
+
background: 'var(--surface, #ffffff)',
|
|
69
73
|
textAlign: 'left',
|
|
70
74
|
padding: '8px 10px',
|
|
71
75
|
fontSize: '.68rem',
|