cynx-lib 1.3.84 → 1.3.85
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/gen.js +77 -77
- package/package.json +5 -1
- package/ui/components/Drawer.jsx +208 -208
- package/ui/components/Pagination.jsx +145 -145
- package/ui/components/PrivacyBlur.jsx +603 -603
- package/utils/index.cjs +5 -0
- package/utils/index.js +22 -20
- package/utils/utils/duration.js +139 -139
- package/utils/utils/oidc.js +214 -214
- package/utils/utils/realtime.js +1634 -1634
- package/utils/utils/session.cjs +15 -2
- package/utils/utils/session.js +67 -58
- package/utils/utils/session_manager.cjs +490 -0
- package/utils/utils/session_manager.js +549 -0
- package/utils/utils/storage.js +393 -393
- package/utils/utils/ui.js +111 -111
- package/vue/components/Badge.vue +79 -79
- package/vue/components/Button.vue +209 -209
- package/vue/components/Checkbox.vue +103 -103
- package/vue/components/CircularProgress.vue +383 -383
- package/vue/components/Divider.vue +94 -94
- package/vue/components/Drawer.vue +243 -243
- package/vue/components/InfoBadge.vue +223 -223
- package/vue/components/Input.vue +341 -341
- package/vue/components/LinearProgress.vue +268 -268
- package/vue/components/Modal.vue +226 -226
- package/vue/components/Pagination.vue +199 -199
- package/vue/components/Select.vue +713 -713
- package/vue/components/Sidebar.vue +955 -955
- package/vue/components/Skeleton.vue +91 -91
- package/vue/components/Spinner.vue +263 -263
- package/vue/components/StatusTag.vue +89 -89
- package/vue/components/TabBar.vue +176 -176
- package/vue/components/Table.vue +388 -388
- package/vue/components/TimePicker.vue +399 -399
- package/vue/components/Toggle.vue +115 -115
- package/vue/components/XTable.vue +119 -119
- package/vue/composables/useAutoSkeletonRows.ts +71 -71
- package/vue/index.d.ts +67 -67
- package/vue/index.js +86 -86
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
3
|
-
|
|
4
|
-
export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onChange, size = 'md', style = {} }) {
|
|
5
|
-
const effectivePerPage = pageSize || perPage || 20;
|
|
6
|
-
const totalPages = pages || (total && effectivePerPage ? Math.ceil(total / effectivePerPage) : 0);
|
|
7
|
-
if (!totalPages || totalPages <= 1) return null;
|
|
8
|
-
|
|
9
|
-
const items = [];
|
|
10
|
-
for (let i = 1; i <= totalPages; i++) {
|
|
11
|
-
if (i === 1 || i === totalPages || (i >= page - 1 && i <= page + 1)) items.push(i);
|
|
12
|
-
else if (items[items.length - 1] !== '...') items.push('...');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const start = effectivePerPage ? (page - 1) * effectivePerPage + 1 : null;
|
|
16
|
-
const end = effectivePerPage ? Math.min(page * effectivePerPage, total) : null;
|
|
17
|
-
|
|
18
|
-
const SIZES = {
|
|
19
|
-
xs: { box: 26, icon: 13, font: '11px', gap: 6 },
|
|
20
|
-
sm: { box: 30, icon: 15, font: '12px', gap: 8 },
|
|
21
|
-
md: { box: 34, icon: 17, font: '13.5px', gap: 10 },
|
|
22
|
-
lg: { box: 38, icon: 19, font: '15px', gap: 12 },
|
|
23
|
-
};
|
|
24
|
-
const currentSize = SIZES[size] || SIZES.md;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div
|
|
28
|
-
style={{
|
|
29
|
-
display: 'flex',
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
justifyContent: 'space-between',
|
|
32
|
-
width: '100%',
|
|
33
|
-
padding: '8px 0',
|
|
34
|
-
userSelect: 'none',
|
|
35
|
-
...style,
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
{start !== null && (
|
|
39
|
-
<div style={{ fontSize: '.75rem', color: 'var(--muted, #797b8d)', fontFamily: 'var(--mono, ui-monospace, monospace)' }}>
|
|
40
|
-
{start}–{end} of {total}
|
|
41
|
-
</div>
|
|
42
|
-
)}
|
|
43
|
-
|
|
44
|
-
<div style={{ display: 'flex', gap: currentSize.gap, alignItems: 'center', marginLeft: start !== null ? 'auto' : 0 }}>
|
|
45
|
-
{/* Prev Button */}
|
|
46
|
-
<button
|
|
47
|
-
type="button"
|
|
48
|
-
disabled={page <= 1}
|
|
49
|
-
onClick={() => onChange?.(page - 1)}
|
|
50
|
-
style={{
|
|
51
|
-
display: 'inline-flex',
|
|
52
|
-
alignItems: 'center',
|
|
53
|
-
justifyContent: 'center',
|
|
54
|
-
width: currentSize.box,
|
|
55
|
-
height: currentSize.box,
|
|
56
|
-
borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
|
|
57
|
-
background: 'var(--surface, #ffffff)',
|
|
58
|
-
border: '1px solid var(--border, var(--bd, #e2e8f0))',
|
|
59
|
-
boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
|
|
60
|
-
color: 'var(--muted, #64748b)',
|
|
61
|
-
cursor: page <= 1 ? 'not-allowed' : 'pointer',
|
|
62
|
-
opacity: page <= 1 ? 0.35 : 1,
|
|
63
|
-
transition: 'all .14s',
|
|
64
|
-
}}
|
|
65
|
-
title="Previous page"
|
|
66
|
-
>
|
|
67
|
-
<ChevronLeft size={currentSize.icon} strokeWidth={2.2} />
|
|
68
|
-
</button>
|
|
69
|
-
|
|
70
|
-
{/* Page numbers */}
|
|
71
|
-
{items.map((item, i) =>
|
|
72
|
-
item === '...' ? (
|
|
73
|
-
<span
|
|
74
|
-
key={`e${i}`}
|
|
75
|
-
style={{
|
|
76
|
-
display: 'inline-flex',
|
|
77
|
-
alignItems: 'center',
|
|
78
|
-
justifyContent: 'center',
|
|
79
|
-
minWidth: currentSize.box,
|
|
80
|
-
height: currentSize.box,
|
|
81
|
-
color: 'var(--muted, #94a3b8)',
|
|
82
|
-
fontSize: currentSize.font,
|
|
83
|
-
fontWeight: 500,
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
…
|
|
87
|
-
</span>
|
|
88
|
-
) : (
|
|
89
|
-
<button
|
|
90
|
-
key={item}
|
|
91
|
-
type="button"
|
|
92
|
-
onClick={() => onChange?.(item)}
|
|
93
|
-
style={{
|
|
94
|
-
display: 'inline-flex',
|
|
95
|
-
alignItems: 'center',
|
|
96
|
-
justifyContent: 'center',
|
|
97
|
-
minWidth: currentSize.box,
|
|
98
|
-
height: currentSize.box,
|
|
99
|
-
padding: '0 6px',
|
|
100
|
-
borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
|
|
101
|
-
fontSize: currentSize.font,
|
|
102
|
-
fontWeight: item === page ? 600 : 500,
|
|
103
|
-
background: item === page ? 'var(--accent, #12675D)' : 'transparent',
|
|
104
|
-
color: item === page ? '#ffffff' : 'var(--muted, #64748b)',
|
|
105
|
-
boxShadow: item === page ? '0 3px 8px rgba(0, 0, 0, 0.12)' : 'none',
|
|
106
|
-
border: 'none',
|
|
107
|
-
cursor: 'pointer',
|
|
108
|
-
transition: 'all .14s',
|
|
109
|
-
}}
|
|
110
|
-
>
|
|
111
|
-
{item}
|
|
112
|
-
</button>
|
|
113
|
-
)
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
{/* Next Button */}
|
|
117
|
-
<button
|
|
118
|
-
type="button"
|
|
119
|
-
disabled={page >= totalPages}
|
|
120
|
-
onClick={() => onChange?.(page + 1)}
|
|
121
|
-
style={{
|
|
122
|
-
display: 'inline-flex',
|
|
123
|
-
alignItems: 'center',
|
|
124
|
-
justifyContent: 'center',
|
|
125
|
-
width: currentSize.box,
|
|
126
|
-
height: currentSize.box,
|
|
127
|
-
borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
|
|
128
|
-
background: 'var(--surface, #ffffff)',
|
|
129
|
-
border: '1px solid var(--border, var(--bd, #e2e8f0))',
|
|
130
|
-
boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
|
|
131
|
-
color: 'var(--muted, #64748b)',
|
|
132
|
-
cursor: page >= totalPages ? 'not-allowed' : 'pointer',
|
|
133
|
-
opacity: page >= totalPages ? 0.35 : 1,
|
|
134
|
-
transition: 'all .14s',
|
|
135
|
-
}}
|
|
136
|
-
title="Next page"
|
|
137
|
-
>
|
|
138
|
-
<ChevronRight size={currentSize.icon} strokeWidth={2.2} />
|
|
139
|
-
</button>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export default Pagination;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onChange, size = 'md', style = {} }) {
|
|
5
|
+
const effectivePerPage = pageSize || perPage || 20;
|
|
6
|
+
const totalPages = pages || (total && effectivePerPage ? Math.ceil(total / effectivePerPage) : 0);
|
|
7
|
+
if (!totalPages || totalPages <= 1) return null;
|
|
8
|
+
|
|
9
|
+
const items = [];
|
|
10
|
+
for (let i = 1; i <= totalPages; i++) {
|
|
11
|
+
if (i === 1 || i === totalPages || (i >= page - 1 && i <= page + 1)) items.push(i);
|
|
12
|
+
else if (items[items.length - 1] !== '...') items.push('...');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const start = effectivePerPage ? (page - 1) * effectivePerPage + 1 : null;
|
|
16
|
+
const end = effectivePerPage ? Math.min(page * effectivePerPage, total) : null;
|
|
17
|
+
|
|
18
|
+
const SIZES = {
|
|
19
|
+
xs: { box: 26, icon: 13, font: '11px', gap: 6 },
|
|
20
|
+
sm: { box: 30, icon: 15, font: '12px', gap: 8 },
|
|
21
|
+
md: { box: 34, icon: 17, font: '13.5px', gap: 10 },
|
|
22
|
+
lg: { box: 38, icon: 19, font: '15px', gap: 12 },
|
|
23
|
+
};
|
|
24
|
+
const currentSize = SIZES[size] || SIZES.md;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
style={{
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
width: '100%',
|
|
33
|
+
padding: '8px 0',
|
|
34
|
+
userSelect: 'none',
|
|
35
|
+
...style,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{start !== null && (
|
|
39
|
+
<div style={{ fontSize: '.75rem', color: 'var(--muted, #797b8d)', fontFamily: 'var(--mono, ui-monospace, monospace)' }}>
|
|
40
|
+
{start}–{end} of {total}
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
|
|
44
|
+
<div style={{ display: 'flex', gap: currentSize.gap, alignItems: 'center', marginLeft: start !== null ? 'auto' : 0 }}>
|
|
45
|
+
{/* Prev Button */}
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
disabled={page <= 1}
|
|
49
|
+
onClick={() => onChange?.(page - 1)}
|
|
50
|
+
style={{
|
|
51
|
+
display: 'inline-flex',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
width: currentSize.box,
|
|
55
|
+
height: currentSize.box,
|
|
56
|
+
borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
|
|
57
|
+
background: 'var(--surface, #ffffff)',
|
|
58
|
+
border: '1px solid var(--border, var(--bd, #e2e8f0))',
|
|
59
|
+
boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
|
|
60
|
+
color: 'var(--muted, #64748b)',
|
|
61
|
+
cursor: page <= 1 ? 'not-allowed' : 'pointer',
|
|
62
|
+
opacity: page <= 1 ? 0.35 : 1,
|
|
63
|
+
transition: 'all .14s',
|
|
64
|
+
}}
|
|
65
|
+
title="Previous page"
|
|
66
|
+
>
|
|
67
|
+
<ChevronLeft size={currentSize.icon} strokeWidth={2.2} />
|
|
68
|
+
</button>
|
|
69
|
+
|
|
70
|
+
{/* Page numbers */}
|
|
71
|
+
{items.map((item, i) =>
|
|
72
|
+
item === '...' ? (
|
|
73
|
+
<span
|
|
74
|
+
key={`e${i}`}
|
|
75
|
+
style={{
|
|
76
|
+
display: 'inline-flex',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
minWidth: currentSize.box,
|
|
80
|
+
height: currentSize.box,
|
|
81
|
+
color: 'var(--muted, #94a3b8)',
|
|
82
|
+
fontSize: currentSize.font,
|
|
83
|
+
fontWeight: 500,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
…
|
|
87
|
+
</span>
|
|
88
|
+
) : (
|
|
89
|
+
<button
|
|
90
|
+
key={item}
|
|
91
|
+
type="button"
|
|
92
|
+
onClick={() => onChange?.(item)}
|
|
93
|
+
style={{
|
|
94
|
+
display: 'inline-flex',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
justifyContent: 'center',
|
|
97
|
+
minWidth: currentSize.box,
|
|
98
|
+
height: currentSize.box,
|
|
99
|
+
padding: '0 6px',
|
|
100
|
+
borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
|
|
101
|
+
fontSize: currentSize.font,
|
|
102
|
+
fontWeight: item === page ? 600 : 500,
|
|
103
|
+
background: item === page ? 'var(--accent, #12675D)' : 'transparent',
|
|
104
|
+
color: item === page ? '#ffffff' : 'var(--muted, #64748b)',
|
|
105
|
+
boxShadow: item === page ? '0 3px 8px rgba(0, 0, 0, 0.12)' : 'none',
|
|
106
|
+
border: 'none',
|
|
107
|
+
cursor: 'pointer',
|
|
108
|
+
transition: 'all .14s',
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
{item}
|
|
112
|
+
</button>
|
|
113
|
+
)
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
{/* Next Button */}
|
|
117
|
+
<button
|
|
118
|
+
type="button"
|
|
119
|
+
disabled={page >= totalPages}
|
|
120
|
+
onClick={() => onChange?.(page + 1)}
|
|
121
|
+
style={{
|
|
122
|
+
display: 'inline-flex',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
justifyContent: 'center',
|
|
125
|
+
width: currentSize.box,
|
|
126
|
+
height: currentSize.box,
|
|
127
|
+
borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
|
|
128
|
+
background: 'var(--surface, #ffffff)',
|
|
129
|
+
border: '1px solid var(--border, var(--bd, #e2e8f0))',
|
|
130
|
+
boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
|
|
131
|
+
color: 'var(--muted, #64748b)',
|
|
132
|
+
cursor: page >= totalPages ? 'not-allowed' : 'pointer',
|
|
133
|
+
opacity: page >= totalPages ? 0.35 : 1,
|
|
134
|
+
transition: 'all .14s',
|
|
135
|
+
}}
|
|
136
|
+
title="Next page"
|
|
137
|
+
>
|
|
138
|
+
<ChevronRight size={currentSize.icon} strokeWidth={2.2} />
|
|
139
|
+
</button>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export default Pagination;
|