@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260704091052 → 0.8.1-dev.20260706110649
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/CopyButton-UPJPMJUB.mjs +57 -0
- package/dist/DateTimeViewClient-R3M6ISVK.mjs +16 -0
- package/dist/DateViewClient-VLTRN47D.mjs +9 -0
- package/dist/{chunk-SDNYBQSI.mjs → HlsPlayer-57543DTW.mjs} +3 -2
- package/dist/HlsPlayer-5AWFZ2P6.mjs +601 -0
- package/dist/IframeClient-RGJFZ5P2.mjs +98 -0
- package/dist/InputControlClient-NJV6B65M.mjs +604 -0
- package/dist/InputControlClient-OQDLYA4S.mjs +604 -0
- package/dist/InputControlClient-TW664WIJ.mjs +602 -0
- package/dist/{LinkNodeButton-WDDPNYWI.mjs → LinkNodeButton-FUL3J5HR.mjs} +6 -5
- package/dist/LinkNodeButton-IGJOGOKI.mjs +362 -0
- package/dist/LinkNodeButton-ZONM74OO.mjs +174 -0
- package/dist/Pagination-6OFACRMQ.mjs +229 -0
- package/dist/Pagination-FSYLYKUA.mjs +181 -0
- package/dist/Pagination-YCD5CU2L.mjs +183 -0
- package/dist/Slider-554BKC7N.mjs +322 -0
- package/dist/Slider-PEIVH6A5.mjs +320 -0
- package/dist/chunk-2GSYECIS.mjs +109 -0
- package/dist/chunk-3GWLDT7C.mjs +204 -0
- package/dist/chunk-3R4VVVNK.mjs +903 -0
- package/dist/chunk-47HD7QP7.mjs +199 -0
- package/dist/chunk-56HSDML5.mjs +22 -0
- package/dist/chunk-67IG5NBU.mjs +200 -0
- package/dist/chunk-7ZFZLN56.mjs +903 -0
- package/dist/chunk-CM7LUGCH.mjs +107 -0
- package/dist/chunk-IKIXEQPV.mjs +198 -0
- package/dist/chunk-IMNQO57B.mjs +25 -0
- package/dist/chunk-R2HV35IB.mjs +201 -0
- package/dist/chunk-SPRVN5IM.mjs +118 -0
- package/dist/chunk-TVL6KVD5.mjs +229 -0
- package/dist/chunk-WEV5U33G.mjs +207 -0
- package/dist/chunk-YG6FKKQJ.mjs +900 -0
- package/dist/index.d.mts +57 -170
- package/dist/index.d.ts +57 -170
- package/dist/index.js +3938 -3807
- package/dist/index.mjs +588 -2922
- package/dist/server.d.mts +72 -0
- package/dist/server.d.ts +72 -0
- package/dist/server.js +5126 -0
- package/dist/server.mjs +2698 -0
- package/package.json +18 -4
- package/dist/HlsPlayer-DZNDKG2P.mjs +0 -7
- package/dist/chunk-DOKQUUH3.mjs +0 -414
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Constants,
|
|
4
|
+
Hyperlink,
|
|
5
|
+
OdataBuilder
|
|
6
|
+
} from "./chunk-TVL6KVD5.mjs";
|
|
7
|
+
import "./chunk-56HSDML5.mjs";
|
|
8
|
+
|
|
9
|
+
// src/components/Pagination.tsx
|
|
10
|
+
import { useMemo } from "react";
|
|
11
|
+
|
|
12
|
+
// src/svg/chevron-updown.tsx
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var ChevronUpDown = (props) => {
|
|
15
|
+
return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) });
|
|
16
|
+
};
|
|
17
|
+
var chevron_updown_default = ChevronUpDown;
|
|
18
|
+
|
|
19
|
+
// src/svg/chevron-down.tsx
|
|
20
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
21
|
+
var ChevronDown = (props) => {
|
|
22
|
+
return /* @__PURE__ */ jsx2("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx2("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) });
|
|
23
|
+
};
|
|
24
|
+
var chevron_down_default = ChevronDown;
|
|
25
|
+
|
|
26
|
+
// src/svg/chevron-up.tsx
|
|
27
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
28
|
+
var ChevronUp = (props) => {
|
|
29
|
+
return /* @__PURE__ */ jsx3("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx3("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) });
|
|
30
|
+
};
|
|
31
|
+
var chevron_up_default = ChevronUp;
|
|
32
|
+
|
|
33
|
+
// src/svg/plus.tsx
|
|
34
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
35
|
+
var Plus = (props) => {
|
|
36
|
+
return /* @__PURE__ */ jsx4("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx4("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) });
|
|
37
|
+
};
|
|
38
|
+
var plus_default = Plus;
|
|
39
|
+
|
|
40
|
+
// src/svg/Icons.tsx
|
|
41
|
+
var Icons = {
|
|
42
|
+
chevronUpDown: chevron_updown_default,
|
|
43
|
+
chevronDown: chevron_down_default,
|
|
44
|
+
chevronUp: chevron_up_default,
|
|
45
|
+
plus: plus_default
|
|
46
|
+
};
|
|
47
|
+
var Icons_default = Icons;
|
|
48
|
+
|
|
49
|
+
// src/svg/Icon.tsx
|
|
50
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
51
|
+
var Icon = ({ name, className, ...props }) => {
|
|
52
|
+
const IconComponent = Icons_default[name];
|
|
53
|
+
if (!IconComponent) {
|
|
54
|
+
console.error(`Icon "${name}" not found.`);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ jsx5(IconComponent, { ...props, className });
|
|
58
|
+
};
|
|
59
|
+
var Icon_default = Icon;
|
|
60
|
+
|
|
61
|
+
// src/components/Pagination.tsx
|
|
62
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
63
|
+
var Pagination = (props) => {
|
|
64
|
+
const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
|
|
65
|
+
const builder = useMemo(() => {
|
|
66
|
+
const b = new OdataBuilder(path);
|
|
67
|
+
if (query) b.setQuery(query);
|
|
68
|
+
return b;
|
|
69
|
+
}, [path, query]);
|
|
70
|
+
const activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
71
|
+
const totalItems = dataset?.count || 0;
|
|
72
|
+
const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
|
|
73
|
+
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
74
|
+
const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
|
|
75
|
+
const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
|
|
76
|
+
const getPaginationRange = () => {
|
|
77
|
+
const delta = 1;
|
|
78
|
+
const range = [];
|
|
79
|
+
if (totalPages <= 7) {
|
|
80
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
81
|
+
}
|
|
82
|
+
range.push(1);
|
|
83
|
+
let start = Math.max(2, activePageNumber - delta);
|
|
84
|
+
let end = Math.min(totalPages - 1, activePageNumber + delta);
|
|
85
|
+
if (activePageNumber - delta <= 2) {
|
|
86
|
+
end = Math.min(totalPages - 1, 4);
|
|
87
|
+
}
|
|
88
|
+
if (activePageNumber + delta >= totalPages - 1) {
|
|
89
|
+
start = Math.max(2, totalPages - 4);
|
|
90
|
+
}
|
|
91
|
+
if (start > 2) {
|
|
92
|
+
range.push("...");
|
|
93
|
+
}
|
|
94
|
+
for (let i = start; i <= end; i++) {
|
|
95
|
+
range.push(i);
|
|
96
|
+
}
|
|
97
|
+
if (end < totalPages - 1) {
|
|
98
|
+
range.push("...");
|
|
99
|
+
}
|
|
100
|
+
if (totalPages > 1) {
|
|
101
|
+
range.push(totalPages);
|
|
102
|
+
}
|
|
103
|
+
return range;
|
|
104
|
+
};
|
|
105
|
+
const paginationRange = getPaginationRange();
|
|
106
|
+
const PageButton = ({ page, children }) => /* @__PURE__ */ jsx6(
|
|
107
|
+
Hyperlink,
|
|
108
|
+
{
|
|
109
|
+
linkType: "Link" /* Link */,
|
|
110
|
+
className: `
|
|
111
|
+
min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
|
|
112
|
+
border text-sm font-medium transition-colors duration-150
|
|
113
|
+
${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
|
|
114
|
+
`,
|
|
115
|
+
href: builder.getNewPageUrl(page),
|
|
116
|
+
children
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
const NavigationButton = ({ page, disabled, children }) => {
|
|
120
|
+
if (disabled) {
|
|
121
|
+
return /* @__PURE__ */ jsx6("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
|
|
122
|
+
}
|
|
123
|
+
return /* @__PURE__ */ jsx6(
|
|
124
|
+
Hyperlink,
|
|
125
|
+
{
|
|
126
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
|
|
127
|
+
href: builder.getNewPageUrl(page),
|
|
128
|
+
children
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
if (totalPages <= 1 && totalItems === 0) return null;
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-6 border-t bg-default", children: [
|
|
134
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
|
|
135
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
136
|
+
"Showing ",
|
|
137
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
138
|
+
startItem,
|
|
139
|
+
"-",
|
|
140
|
+
endItem
|
|
141
|
+
] }),
|
|
142
|
+
" ",
|
|
143
|
+
"out of ",
|
|
144
|
+
/* @__PURE__ */ jsx6("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
|
|
145
|
+
" results"
|
|
146
|
+
] }),
|
|
147
|
+
totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
148
|
+
/* @__PURE__ */ jsxs(
|
|
149
|
+
NavigationButton,
|
|
150
|
+
{
|
|
151
|
+
page: activePageNumber - 1,
|
|
152
|
+
disabled: activePageNumber === 1,
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsx6("span", { children: /* @__PURE__ */ jsx6(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
|
|
155
|
+
/* @__PURE__ */ jsx6("span", { className: "text-sm", children: "Prev" })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
paginationRange.map((item, index) => {
|
|
160
|
+
if (item === "...") {
|
|
161
|
+
return /* @__PURE__ */ jsx6(
|
|
162
|
+
"span",
|
|
163
|
+
{
|
|
164
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
|
|
165
|
+
children: "..."
|
|
166
|
+
},
|
|
167
|
+
`ellipsis-${index}`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
const page = item;
|
|
171
|
+
return /* @__PURE__ */ jsx6(PageButton, { page, children: page }, page);
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ jsxs(
|
|
174
|
+
NavigationButton,
|
|
175
|
+
{
|
|
176
|
+
page: activePageNumber + 1,
|
|
177
|
+
disabled: activePageNumber === totalPages,
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ jsx6("span", { className: "text-sm", children: "Next" }),
|
|
180
|
+
/* @__PURE__ */ jsx6("span", { children: /* @__PURE__ */ jsx6(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
] }),
|
|
185
|
+
showJumpToPage && totalPages > 5 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
186
|
+
/* @__PURE__ */ jsx6("span", { className: "text-sm", children: "Go to:" }),
|
|
187
|
+
/* @__PURE__ */ jsx6("div", { className: "relative", children: /* @__PURE__ */ jsx6(
|
|
188
|
+
"input",
|
|
189
|
+
{
|
|
190
|
+
type: "number",
|
|
191
|
+
min: "1",
|
|
192
|
+
max: totalPages,
|
|
193
|
+
defaultValue: activePageNumber,
|
|
194
|
+
className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
|
|
195
|
+
onKeyDown: (e) => {
|
|
196
|
+
if (e.key === "Enter") {
|
|
197
|
+
const input = e.target;
|
|
198
|
+
const page = parseInt(input.value);
|
|
199
|
+
if (page >= 1 && page <= totalPages && page !== activePageNumber) {
|
|
200
|
+
window.location.href = builder.getNewPageUrl(page);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
) })
|
|
206
|
+
] })
|
|
207
|
+
] }),
|
|
208
|
+
showPageSizeSelector && /* @__PURE__ */ jsx6("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center space-x-2", children: [
|
|
209
|
+
/* @__PURE__ */ jsx6("span", { className: "text-sm", children: "Show:" }),
|
|
210
|
+
/* @__PURE__ */ jsx6("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ jsx6(
|
|
211
|
+
Hyperlink,
|
|
212
|
+
{
|
|
213
|
+
className: `
|
|
214
|
+
px-3 py-1 text-sm rounded border transition-colors duration-150
|
|
215
|
+
${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
|
|
216
|
+
`,
|
|
217
|
+
href: builder.getNewPageSizeUrl(size),
|
|
218
|
+
children: size
|
|
219
|
+
},
|
|
220
|
+
size
|
|
221
|
+
)) }),
|
|
222
|
+
/* @__PURE__ */ jsx6("span", { className: "text-sm", children: "per page" })
|
|
223
|
+
] }) })
|
|
224
|
+
] });
|
|
225
|
+
};
|
|
226
|
+
var Pagination_default = Pagination;
|
|
227
|
+
export {
|
|
228
|
+
Pagination_default as default
|
|
229
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
OdataBuilder
|
|
4
|
+
} from "./chunk-47HD7QP7.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Constants,
|
|
7
|
+
Hyperlink,
|
|
8
|
+
Icon_default
|
|
9
|
+
} from "./chunk-CM7LUGCH.mjs";
|
|
10
|
+
import "./chunk-56HSDML5.mjs";
|
|
11
|
+
|
|
12
|
+
// src/components/Pagination.tsx
|
|
13
|
+
import { useMemo } from "react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var Pagination = (props) => {
|
|
16
|
+
const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
|
|
17
|
+
const builder = useMemo(() => {
|
|
18
|
+
const b = new OdataBuilder(path);
|
|
19
|
+
if (query) b.setQuery(query);
|
|
20
|
+
return b;
|
|
21
|
+
}, [path, query]);
|
|
22
|
+
const activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
23
|
+
const totalItems = dataset?.count || 0;
|
|
24
|
+
const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
|
|
25
|
+
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
26
|
+
const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
|
|
27
|
+
const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
|
|
28
|
+
const getPaginationRange = () => {
|
|
29
|
+
const delta = 1;
|
|
30
|
+
const range = [];
|
|
31
|
+
if (totalPages <= 7) {
|
|
32
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
33
|
+
}
|
|
34
|
+
range.push(1);
|
|
35
|
+
let start = Math.max(2, activePageNumber - delta);
|
|
36
|
+
let end = Math.min(totalPages - 1, activePageNumber + delta);
|
|
37
|
+
if (activePageNumber - delta <= 2) {
|
|
38
|
+
end = Math.min(totalPages - 1, 4);
|
|
39
|
+
}
|
|
40
|
+
if (activePageNumber + delta >= totalPages - 1) {
|
|
41
|
+
start = Math.max(2, totalPages - 4);
|
|
42
|
+
}
|
|
43
|
+
if (start > 2) {
|
|
44
|
+
range.push("...");
|
|
45
|
+
}
|
|
46
|
+
for (let i = start; i <= end; i++) {
|
|
47
|
+
range.push(i);
|
|
48
|
+
}
|
|
49
|
+
if (end < totalPages - 1) {
|
|
50
|
+
range.push("...");
|
|
51
|
+
}
|
|
52
|
+
if (totalPages > 1) {
|
|
53
|
+
range.push(totalPages);
|
|
54
|
+
}
|
|
55
|
+
return range;
|
|
56
|
+
};
|
|
57
|
+
const paginationRange = getPaginationRange();
|
|
58
|
+
const PageButton = ({ page, children }) => /* @__PURE__ */ jsx(
|
|
59
|
+
Hyperlink,
|
|
60
|
+
{
|
|
61
|
+
linkType: "Link" /* Link */,
|
|
62
|
+
className: `
|
|
63
|
+
min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
|
|
64
|
+
border text-sm font-medium transition-colors duration-150
|
|
65
|
+
${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
|
|
66
|
+
`,
|
|
67
|
+
href: builder.getNewPageUrl(page),
|
|
68
|
+
children
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
const NavigationButton = ({ page, disabled, children }) => {
|
|
72
|
+
if (disabled) {
|
|
73
|
+
return /* @__PURE__ */ jsx("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
|
|
74
|
+
}
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
Hyperlink,
|
|
77
|
+
{
|
|
78
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
|
|
79
|
+
href: builder.getNewPageUrl(page),
|
|
80
|
+
children
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
if (totalPages <= 1 && totalItems === 0) return null;
|
|
85
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-6 border-t bg-default", children: [
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
88
|
+
"Showing ",
|
|
89
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
90
|
+
startItem,
|
|
91
|
+
"-",
|
|
92
|
+
endItem
|
|
93
|
+
] }),
|
|
94
|
+
" ",
|
|
95
|
+
"out of ",
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
|
|
97
|
+
" results"
|
|
98
|
+
] }),
|
|
99
|
+
totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
100
|
+
/* @__PURE__ */ jsxs(
|
|
101
|
+
NavigationButton,
|
|
102
|
+
{
|
|
103
|
+
page: activePageNumber - 1,
|
|
104
|
+
disabled: activePageNumber === 1,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
|
|
107
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Prev" })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
paginationRange.map((item, index) => {
|
|
112
|
+
if (item === "...") {
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
"span",
|
|
115
|
+
{
|
|
116
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
|
|
117
|
+
children: "..."
|
|
118
|
+
},
|
|
119
|
+
`ellipsis-${index}`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
const page = item;
|
|
123
|
+
return /* @__PURE__ */ jsx(PageButton, { page, children: page }, page);
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ jsxs(
|
|
126
|
+
NavigationButton,
|
|
127
|
+
{
|
|
128
|
+
page: activePageNumber + 1,
|
|
129
|
+
disabled: activePageNumber === totalPages,
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Next" }),
|
|
132
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }),
|
|
137
|
+
showJumpToPage && totalPages > 5 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
138
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Go to:" }),
|
|
139
|
+
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
|
|
140
|
+
"input",
|
|
141
|
+
{
|
|
142
|
+
type: "number",
|
|
143
|
+
min: "1",
|
|
144
|
+
max: totalPages,
|
|
145
|
+
defaultValue: activePageNumber,
|
|
146
|
+
className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
|
|
147
|
+
onKeyDown: (e) => {
|
|
148
|
+
if (e.key === "Enter") {
|
|
149
|
+
const input = e.target;
|
|
150
|
+
const page = parseInt(input.value);
|
|
151
|
+
if (page >= 1 && page <= totalPages && page !== activePageNumber) {
|
|
152
|
+
window.location.href = builder.getNewPageUrl(page);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
) })
|
|
158
|
+
] })
|
|
159
|
+
] }),
|
|
160
|
+
showPageSizeSelector && /* @__PURE__ */ jsx("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center space-x-2", children: [
|
|
161
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Show:" }),
|
|
162
|
+
/* @__PURE__ */ jsx("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ jsx(
|
|
163
|
+
Hyperlink,
|
|
164
|
+
{
|
|
165
|
+
className: `
|
|
166
|
+
px-3 py-1 text-sm rounded border transition-colors duration-150
|
|
167
|
+
${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
|
|
168
|
+
`,
|
|
169
|
+
href: builder.getNewPageSizeUrl(size),
|
|
170
|
+
children: size
|
|
171
|
+
},
|
|
172
|
+
size
|
|
173
|
+
)) }),
|
|
174
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "per page" })
|
|
175
|
+
] }) })
|
|
176
|
+
] });
|
|
177
|
+
};
|
|
178
|
+
var Pagination_default = Pagination;
|
|
179
|
+
export {
|
|
180
|
+
Pagination_default as default
|
|
181
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
import {
|
|
5
|
+
OdataBuilder
|
|
6
|
+
} from "./chunk-R2HV35IB.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Constants,
|
|
9
|
+
Hyperlink,
|
|
10
|
+
Icon_default
|
|
11
|
+
} from "./chunk-2GSYECIS.mjs";
|
|
12
|
+
import "./chunk-IMNQO57B.mjs";
|
|
13
|
+
|
|
14
|
+
// src/components/Pagination.tsx
|
|
15
|
+
import { useMemo } from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var Pagination = (props) => {
|
|
18
|
+
const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
|
|
19
|
+
const builder = useMemo(() => {
|
|
20
|
+
const b = new OdataBuilder(path);
|
|
21
|
+
if (query) b.setQuery(query);
|
|
22
|
+
return b;
|
|
23
|
+
}, [path, query]);
|
|
24
|
+
const activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
25
|
+
const totalItems = dataset?.count || 0;
|
|
26
|
+
const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
|
|
27
|
+
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
28
|
+
const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
|
|
29
|
+
const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
|
|
30
|
+
const getPaginationRange = () => {
|
|
31
|
+
const delta = 1;
|
|
32
|
+
const range = [];
|
|
33
|
+
if (totalPages <= 7) {
|
|
34
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
35
|
+
}
|
|
36
|
+
range.push(1);
|
|
37
|
+
let start = Math.max(2, activePageNumber - delta);
|
|
38
|
+
let end = Math.min(totalPages - 1, activePageNumber + delta);
|
|
39
|
+
if (activePageNumber - delta <= 2) {
|
|
40
|
+
end = Math.min(totalPages - 1, 4);
|
|
41
|
+
}
|
|
42
|
+
if (activePageNumber + delta >= totalPages - 1) {
|
|
43
|
+
start = Math.max(2, totalPages - 4);
|
|
44
|
+
}
|
|
45
|
+
if (start > 2) {
|
|
46
|
+
range.push("...");
|
|
47
|
+
}
|
|
48
|
+
for (let i = start; i <= end; i++) {
|
|
49
|
+
range.push(i);
|
|
50
|
+
}
|
|
51
|
+
if (end < totalPages - 1) {
|
|
52
|
+
range.push("...");
|
|
53
|
+
}
|
|
54
|
+
if (totalPages > 1) {
|
|
55
|
+
range.push(totalPages);
|
|
56
|
+
}
|
|
57
|
+
return range;
|
|
58
|
+
};
|
|
59
|
+
const paginationRange = getPaginationRange();
|
|
60
|
+
const PageButton = ({ page, children }) => /* @__PURE__ */ jsx(
|
|
61
|
+
Hyperlink,
|
|
62
|
+
{
|
|
63
|
+
linkType: "Link" /* Link */,
|
|
64
|
+
className: `
|
|
65
|
+
min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
|
|
66
|
+
border text-sm font-medium transition-colors duration-150
|
|
67
|
+
${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
|
|
68
|
+
`,
|
|
69
|
+
href: builder.getNewPageUrl(page),
|
|
70
|
+
children
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
const NavigationButton = ({ page, disabled, children }) => {
|
|
74
|
+
if (disabled) {
|
|
75
|
+
return /* @__PURE__ */ jsx("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
Hyperlink,
|
|
79
|
+
{
|
|
80
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
|
|
81
|
+
href: builder.getNewPageUrl(page),
|
|
82
|
+
children
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
if (totalPages <= 1 && totalItems === 0) return null;
|
|
87
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-6 border-t bg-default", children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
|
|
89
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
90
|
+
"Showing ",
|
|
91
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
92
|
+
startItem,
|
|
93
|
+
"-",
|
|
94
|
+
endItem
|
|
95
|
+
] }),
|
|
96
|
+
" ",
|
|
97
|
+
"out of ",
|
|
98
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
|
|
99
|
+
" results"
|
|
100
|
+
] }),
|
|
101
|
+
totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
102
|
+
/* @__PURE__ */ jsxs(
|
|
103
|
+
NavigationButton,
|
|
104
|
+
{
|
|
105
|
+
page: activePageNumber - 1,
|
|
106
|
+
disabled: activePageNumber === 1,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
|
|
109
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Prev" })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
paginationRange.map((item, index) => {
|
|
114
|
+
if (item === "...") {
|
|
115
|
+
return /* @__PURE__ */ jsx(
|
|
116
|
+
"span",
|
|
117
|
+
{
|
|
118
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
|
|
119
|
+
children: "..."
|
|
120
|
+
},
|
|
121
|
+
`ellipsis-${index}`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const page = item;
|
|
125
|
+
return /* @__PURE__ */ jsx(PageButton, { page, children: page }, page);
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ jsxs(
|
|
128
|
+
NavigationButton,
|
|
129
|
+
{
|
|
130
|
+
page: activePageNumber + 1,
|
|
131
|
+
disabled: activePageNumber === totalPages,
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Next" }),
|
|
134
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] }),
|
|
139
|
+
showJumpToPage && totalPages > 5 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
140
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Go to:" }),
|
|
141
|
+
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
|
|
142
|
+
"input",
|
|
143
|
+
{
|
|
144
|
+
type: "number",
|
|
145
|
+
min: "1",
|
|
146
|
+
max: totalPages,
|
|
147
|
+
defaultValue: activePageNumber,
|
|
148
|
+
className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
|
|
149
|
+
onKeyDown: (e) => {
|
|
150
|
+
if (e.key === "Enter") {
|
|
151
|
+
const input = e.target;
|
|
152
|
+
const page = parseInt(input.value);
|
|
153
|
+
if (page >= 1 && page <= totalPages && page !== activePageNumber) {
|
|
154
|
+
window.location.href = builder.getNewPageUrl(page);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
) })
|
|
160
|
+
] })
|
|
161
|
+
] }),
|
|
162
|
+
showPageSizeSelector && /* @__PURE__ */ jsx("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center space-x-2", children: [
|
|
163
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Show:" }),
|
|
164
|
+
/* @__PURE__ */ jsx("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ jsx(
|
|
165
|
+
Hyperlink,
|
|
166
|
+
{
|
|
167
|
+
className: `
|
|
168
|
+
px-3 py-1 text-sm rounded border transition-colors duration-150
|
|
169
|
+
${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
|
|
170
|
+
`,
|
|
171
|
+
href: builder.getNewPageSizeUrl(size),
|
|
172
|
+
children: size
|
|
173
|
+
},
|
|
174
|
+
size
|
|
175
|
+
)) }),
|
|
176
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "per page" })
|
|
177
|
+
] }) })
|
|
178
|
+
] });
|
|
179
|
+
};
|
|
180
|
+
var Pagination_default = Pagination;
|
|
181
|
+
export {
|
|
182
|
+
Pagination_default as default
|
|
183
|
+
};
|