laif-ds 0.2.22 → 0.2.24

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.
Files changed (57) hide show
  1. package/dist/_virtual/index.js +3 -5
  2. package/dist/_virtual/index3.js +5 -2
  3. package/dist/_virtual/index4.js +5 -3
  4. package/dist/_virtual/index5.js +5 -5
  5. package/dist/_virtual/index6.js +2 -5
  6. package/dist/_virtual/index7.js +2 -2
  7. package/dist/components/ui/alert-dialog.js +6 -6
  8. package/dist/components/ui/app-multiple-select-dropdown.js +34 -34
  9. package/dist/components/ui/app-select.js +127 -124
  10. package/dist/components/ui/badge.js +13 -12
  11. package/dist/components/ui/button.js +20 -18
  12. package/dist/components/ui/calendar.js +6 -6
  13. package/dist/components/ui/checkbox.js +9 -9
  14. package/dist/components/ui/confirmer.js +45 -19
  15. package/dist/components/ui/context-menu.js +4 -4
  16. package/dist/components/ui/input-otp.js +16 -16
  17. package/dist/components/ui/input-selector.js +19 -19
  18. package/dist/components/ui/input.js +19 -19
  19. package/dist/components/ui/menubar.js +1 -1
  20. package/dist/components/ui/pagination.js +90 -77
  21. package/dist/components/ui/radio-group.js +14 -14
  22. package/dist/components/ui/select.js +27 -27
  23. package/dist/components/ui/switch.js +8 -6
  24. package/dist/components/ui/table.js +16 -16
  25. package/dist/components/ui/tables/data-cross-table/data-cross-table.js +6 -6
  26. package/dist/components/ui/tables/data-table/components/data-table-actions.js +51 -0
  27. package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +470 -0
  28. package/dist/components/ui/tables/data-table/components/data-table-body.js +340 -0
  29. package/dist/components/ui/tables/data-table/components/data-table-column-visibility.js +274 -0
  30. package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +177 -0
  31. package/dist/components/ui/tables/data-table/components/data-table-filters.js +286 -0
  32. package/dist/components/ui/tables/data-table/components/data-table-pagination.js +131 -0
  33. package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +112 -0
  34. package/dist/components/ui/tables/data-table/components/data-table-simple-filters.js +263 -0
  35. package/dist/components/ui/tables/data-table/components/data-table-sorting.js +128 -0
  36. package/dist/components/ui/tables/data-table/data-table-constants.js +58 -0
  37. package/dist/components/ui/tables/data-table/data-table-i18n.js +138 -0
  38. package/dist/components/ui/tables/data-table/data-table.js +549 -0
  39. package/dist/components/ui/tables/data-table/data-table.service.js +254 -0
  40. package/dist/components/ui/tabs.js +33 -33
  41. package/dist/components/ui/textarea.js +18 -15
  42. package/dist/components/ui/tooltip.js +10 -10
  43. package/dist/css-for-template.css +57 -0
  44. package/dist/index.d.ts +247 -76
  45. package/dist/index.js +64 -64
  46. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
  47. package/dist/node_modules/eventemitter3/index.js +1 -1
  48. package/dist/node_modules/eventemitter3/index2.js +1 -1
  49. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
  50. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  51. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  52. package/dist/node_modules/unified/lib/index.js +1 -1
  53. package/dist/styles.css +1 -1
  54. package/dist/styles.v3.css +1 -1
  55. package/package.json +5 -3
  56. package/dist/components/ui/data-table.js +0 -461
  57. package/dist/components/ui/data-table.service.js +0 -62
@@ -0,0 +1,177 @@
1
+ "use client";
2
+ import { jsx as r, jsxs as j } from "react/jsx-runtime";
3
+ import { AppSelect as S } from "../../../app-select.js";
4
+ import { DatePicker as w } from "../../../date-picker.js";
5
+ import { Input as y } from "../../../input.js";
6
+ import { cn as m } from "../../../../../lib/utils.js";
7
+ function K({
8
+ columnType: x,
9
+ value: e,
10
+ onChange: l,
11
+ operator: g,
12
+ listOptions: $ = [],
13
+ placeholder: C,
14
+ size: n = "sm",
15
+ className: d,
16
+ hasError: b = !1,
17
+ disabled: a = !1,
18
+ i18n: o
19
+ }) {
20
+ const p = C || o?.filters.value || "Value", D = b ? "border-red-500" : "", f = b ? "border-red-500" : "";
21
+ if (g === "eq_null" || g === "n_eq_null" || g === "checked" || g === "unchecked")
22
+ return null;
23
+ switch (x) {
24
+ case "string":
25
+ return /* @__PURE__ */ r(
26
+ y,
27
+ {
28
+ size: n,
29
+ placeholder: p,
30
+ className: m(d, D),
31
+ value: e != null ? String(e) : "",
32
+ disabled: a,
33
+ onChange: (t) => l(t.target.value)
34
+ }
35
+ );
36
+ case "number":
37
+ return /* @__PURE__ */ r(
38
+ y,
39
+ {
40
+ size: n,
41
+ type: "number",
42
+ placeholder: p,
43
+ className: m(d, D),
44
+ value: e != null ? String(e) : "",
45
+ disabled: a,
46
+ onChange: (t) => l(Number(t.target.value))
47
+ }
48
+ );
49
+ case "boolean":
50
+ return /* @__PURE__ */ r(
51
+ S,
52
+ {
53
+ isSingleSelectClearable: !0,
54
+ size: n,
55
+ placeholder: p,
56
+ className: m(d, f),
57
+ options: [
58
+ { value: "true", label: o?.booleanOperators.true || "True" },
59
+ { value: "false", label: o?.booleanOperators.false || "False" }
60
+ ],
61
+ value: e === !0 ? "true" : e === !1 ? "false" : void 0,
62
+ disabled: a,
63
+ onValueChange: (t) => {
64
+ l(t === "true" ? !0 : t === "false" ? !1 : void 0);
65
+ }
66
+ },
67
+ `boolean-${e}`
68
+ );
69
+ case "list_single_select":
70
+ return /* @__PURE__ */ r(
71
+ S,
72
+ {
73
+ searchable: !0,
74
+ isSingleSelectClearable: !0,
75
+ size: n,
76
+ placeholder: o?.filters.searchPlaceholder || p,
77
+ className: m(d, f),
78
+ options: $,
79
+ value: Array.isArray(e) || typeof e == "boolean" ? void 0 : e,
80
+ disabled: a,
81
+ onValueChange: l
82
+ }
83
+ );
84
+ case "list_multi_select":
85
+ return /* @__PURE__ */ r(
86
+ S,
87
+ {
88
+ multiple: !0,
89
+ searchable: !0,
90
+ size: n,
91
+ placeholder: o?.filters.searchPlaceholder || p,
92
+ className: m(d, f),
93
+ options: $,
94
+ value: Array.isArray(e) ? e : [],
95
+ disabled: a,
96
+ onValueChange: l
97
+ }
98
+ );
99
+ case "date":
100
+ const M = (t) => {
101
+ const s = t ? `${t.getFullYear()}-${(t.getMonth() + 1).toString().padStart(2, "0")}-${t.getDate().toString().padStart(2, "0")}` : void 0;
102
+ l(s);
103
+ }, F = e && typeof e == "string" ? new Date(e) : void 0;
104
+ return /* @__PURE__ */ r(
105
+ w,
106
+ {
107
+ value: F,
108
+ onChange: M,
109
+ placeholder: o?.filters.selectDate || "Select date",
110
+ buttonVariant: "outline",
111
+ size: n,
112
+ dateFormat: "dd/MM/yyyy",
113
+ disabled: a
114
+ }
115
+ );
116
+ case "datetime":
117
+ const V = (t, s) => {
118
+ let c;
119
+ if (t) {
120
+ const h = s || "00:00", [I, N] = h.split(":"), i = new Date(t);
121
+ i.setHours(parseInt(I, 10), parseInt(N, 10), 0, 0);
122
+ const _ = i.getFullYear(), P = (i.getMonth() + 1).toString().padStart(2, "0"), A = i.getDate().toString().padStart(2, "0"), H = i.getHours().toString().padStart(2, "0"), k = i.getMinutes().toString().padStart(2, "0"), O = i.getSeconds().toString().padStart(2, "0");
123
+ c = `${_}-${P}-${A}T${H}:${k}:${O}.000000`;
124
+ }
125
+ l(c);
126
+ }, u = e && typeof e == "string" ? (() => {
127
+ if (e.includes("T")) {
128
+ const t = e.split("T")[0];
129
+ if (t.match(/^\d{4}-\d{2}-\d{2}$/)) {
130
+ const [s, c, h] = t.split("-").map(Number);
131
+ return new Date(s, c - 1, h);
132
+ }
133
+ }
134
+ return new Date(e);
135
+ })() : void 0, T = u ? (() => {
136
+ if (typeof e == "string" && e.includes("T")) {
137
+ const t = e.split("T")[1];
138
+ if (t) {
139
+ const c = t.split(".")[0].replace("Z", "");
140
+ if (c.match(/^\d{2}:\d{2}(:\d{2})?$/))
141
+ return c.substring(0, 5);
142
+ }
143
+ }
144
+ return `${u.getHours().toString().padStart(2, "0")}:${u.getMinutes().toString().padStart(2, "0")}`;
145
+ })() : "00:00";
146
+ return /* @__PURE__ */ j("div", { className: "flex flex-row gap-2", children: [
147
+ /* @__PURE__ */ r(
148
+ w,
149
+ {
150
+ value: u,
151
+ onChange: (t) => V(t, T),
152
+ placeholder: o?.filters.selectDate || "Select date",
153
+ buttonVariant: "outline",
154
+ size: n,
155
+ dateFormat: "dd/MM/yyyy",
156
+ disabled: a
157
+ }
158
+ ),
159
+ /* @__PURE__ */ r(
160
+ y,
161
+ {
162
+ type: "time",
163
+ size: n,
164
+ value: T,
165
+ onChange: (t) => V(u, t.target.value),
166
+ className: "text-sm",
167
+ disabled: !u || a
168
+ }
169
+ )
170
+ ] });
171
+ default:
172
+ return /* @__PURE__ */ r("div", { className: "text-muted-foreground text-sm", children: o?.filters.filterNotSupported || "Filter not supported" });
173
+ }
174
+ }
175
+ export {
176
+ K as FilterValueInput
177
+ };
@@ -0,0 +1,286 @@
1
+ "use client";
2
+ import { jsxs as p, Fragment as A, jsx as o } from "react/jsx-runtime";
3
+ import { useState as q, useEffect as $ } from "react";
4
+ import { Badge as y } from "../../../badge.js";
5
+ import { Button as N } from "../../../button.js";
6
+ import { Icon as f } from "../../../icon.js";
7
+ import { Input as E } from "../../../input.js";
8
+ import { Popover as S, PopoverTrigger as _, PopoverContent as D } from "../../../popover.js";
9
+ import { getIconFromColumnType as M } from "../data-table.service.js";
10
+ import { DataTableAdvancedFilterComponent as R } from "./data-table-advanced-filter.js";
11
+ import { DataTableStringFilter as z, DataTableNumberFilter as H, DataTableBooleanFilter as J, DataTableDateFilter as K, DataTableDateTimeFilter as Q, DataTableListSingleSelectFilter as U, DataTableListMultiSelectFilter as V } from "./data-table-simple-filters.js";
12
+ function se({
13
+ advancedFilterBadge: m,
14
+ setAdvancedFilterBadge: b,
15
+ filterableColumns: h,
16
+ sortedFilterBadges: x,
17
+ setFilterBadges: d,
18
+ filterSearch: L,
19
+ setFilterSearch: I,
20
+ filteredColumns: P,
21
+ handleAddFilter: G,
22
+ handleAddAdvancedFilter: F,
23
+ i18n: s
24
+ }) {
25
+ const [w, C] = q(/* @__PURE__ */ new Set()), j = w.has("add");
26
+ return $(() => {
27
+ if (d((e) => {
28
+ let c = !1;
29
+ const a = e.map((r) => {
30
+ if (r.columnType !== "list_single_select" && r.columnType !== "list_multi_select")
31
+ return r;
32
+ const n = h.find((t) => t.id === r.columnId)?.column.columnDef.meta?.listOptions || [], g = new Set(n.map((t) => String(t.value)));
33
+ if (r.columnType === "list_single_select") {
34
+ const t = r.value;
35
+ return t !== void 0 && !g.has(String(t)) ? (c = !0, { ...r, value: void 0, listOptions: n }) : r.listOptions !== n ? { ...r, listOptions: n } : r;
36
+ } else {
37
+ const t = Array.isArray(r.value) ? r.value : [], v = t.filter((i) => g.has(String(i)));
38
+ return v.length !== t.length ? (c = !0, {
39
+ ...r,
40
+ value: v.length > 0 ? v : void 0,
41
+ listOptions: n
42
+ }) : r.listOptions !== n ? { ...r, listOptions: n } : r;
43
+ }
44
+ });
45
+ return c ? a : e;
46
+ }), m) {
47
+ const e = (l) => {
48
+ let n = !1;
49
+ return { conditions: l.map((t) => {
50
+ if (t.columnType !== "list_single_select" && t.columnType !== "list_multi_select")
51
+ return t;
52
+ const i = h.find(
53
+ (u) => u.id === t.columnId
54
+ )?.column.columnDef.meta?.listOptions || [], O = new Set(i.map((u) => String(u.value)));
55
+ if (t.columnType === "list_single_select") {
56
+ const u = t.value;
57
+ return u !== void 0 && !O.has(String(u)) ? (n = !0, {
58
+ ...t,
59
+ value: void 0,
60
+ listOptions: i
61
+ }) : t.listOptions !== i ? { ...t, listOptions: i } : t;
62
+ } else {
63
+ const u = Array.isArray(t.value) ? t.value : [], T = u.filter((k) => O.has(String(k)));
64
+ return T.length !== u.length ? (n = !0, {
65
+ ...t,
66
+ value: T.length > 0 ? T : void 0,
67
+ listOptions: i
68
+ }) : t.listOptions !== i ? { ...t, listOptions: i } : t;
69
+ }
70
+ }), changed: n };
71
+ }, c = (l) => {
72
+ let n = !1;
73
+ const { conditions: g, changed: t } = e(l.conditions);
74
+ t && (n = !0);
75
+ const v = l.groups?.map((i) => {
76
+ const { group: O, changed: u } = c(i);
77
+ return u && (n = !0), O;
78
+ });
79
+ return {
80
+ group: {
81
+ ...l,
82
+ conditions: g,
83
+ groups: v
84
+ },
85
+ changed: n
86
+ };
87
+ }, { group: a, changed: r } = c(
88
+ m.rootGroup
89
+ );
90
+ r && b({
91
+ ...m,
92
+ rootGroup: a
93
+ });
94
+ }
95
+ }, [
96
+ h,
97
+ d,
98
+ m,
99
+ b
100
+ ]), /* @__PURE__ */ p(A, { children: [
101
+ m && /* @__PURE__ */ p(S, { children: [
102
+ /* @__PURE__ */ o(_, { asChild: !0, children: /* @__PURE__ */ p(
103
+ y,
104
+ {
105
+ className: "hover:border-d-border cursor-pointer hover:border",
106
+ variant: "default",
107
+ children: [
108
+ /* @__PURE__ */ o(f, { name: "ListFilter" }),
109
+ s.filters.advancedFilter
110
+ ]
111
+ }
112
+ ) }),
113
+ /* @__PURE__ */ o(D, { className: "w-[800px]", children: /* @__PURE__ */ o(
114
+ R,
115
+ {
116
+ columns: h,
117
+ onFilterChange: (e) => {
118
+ b(e || void 0);
119
+ },
120
+ initialFilter: m,
121
+ i18n: s
122
+ }
123
+ ) })
124
+ ] }),
125
+ x.map((e) => {
126
+ const c = w.has(e.id);
127
+ return /* @__PURE__ */ p(
128
+ S,
129
+ {
130
+ onOpenChange: (a) => {
131
+ C((r) => {
132
+ const l = new Set(r);
133
+ return a ? l.add(e.id) : l.delete(e.id), l;
134
+ });
135
+ },
136
+ children: [
137
+ /* @__PURE__ */ o(_, { asChild: !0, children: /* @__PURE__ */ p(
138
+ y,
139
+ {
140
+ variant: (e.value === void 0 || e.value === "") && !(e.operator === "eq_null" || e.operator === "n_eq_null" || e.operator === "checked" || e.operator === "unchecked") ? "ghost" : "default",
141
+ className: `hover:border-d-border flex cursor-pointer items-center gap-1 hover:border ${c && "border-d-foreground border"}`,
142
+ children: [
143
+ /* @__PURE__ */ o(f, { name: "Filter" }),
144
+ e.columnLabel || s.filters.value
145
+ ]
146
+ }
147
+ ) }),
148
+ /* @__PURE__ */ p(D, { children: [
149
+ e.columnType === "string" && /* @__PURE__ */ o(
150
+ z,
151
+ {
152
+ filter: e,
153
+ setFilterBadges: d,
154
+ i18n: s
155
+ }
156
+ ),
157
+ e.columnType === "number" && /* @__PURE__ */ o(
158
+ H,
159
+ {
160
+ filter: e,
161
+ setFilterBadges: d,
162
+ i18n: s
163
+ }
164
+ ),
165
+ e.columnType === "boolean" && /* @__PURE__ */ o(
166
+ J,
167
+ {
168
+ filter: e,
169
+ setFilterBadges: d,
170
+ i18n: s
171
+ }
172
+ ),
173
+ e.columnType === "date" && /* @__PURE__ */ o(
174
+ K,
175
+ {
176
+ filter: e,
177
+ setFilterBadges: d,
178
+ i18n: s
179
+ }
180
+ ),
181
+ e.columnType === "datetime" && /* @__PURE__ */ o(
182
+ Q,
183
+ {
184
+ filter: e,
185
+ setFilterBadges: d,
186
+ i18n: s
187
+ }
188
+ ),
189
+ e.columnType === "list_single_select" && (() => {
190
+ const r = h.find(
191
+ (l) => l.id === e.columnId
192
+ )?.column.columnDef.meta?.listOptions || e.listOptions || [];
193
+ return /* @__PURE__ */ o(
194
+ U,
195
+ {
196
+ filter: { ...e, listOptions: r },
197
+ setFilterBadges: d,
198
+ i18n: s
199
+ }
200
+ );
201
+ })(),
202
+ e.columnType === "list_multi_select" && (() => {
203
+ const r = h.find(
204
+ (l) => l.id === e.columnId
205
+ )?.column.columnDef.meta?.listOptions || e.listOptions || [];
206
+ return /* @__PURE__ */ o(
207
+ V,
208
+ {
209
+ filter: { ...e, listOptions: r },
210
+ setFilterBadges: d,
211
+ i18n: s
212
+ }
213
+ );
214
+ })(),
215
+ e.columnType === "other" && /* @__PURE__ */ o("div", { children: s.filters.filterNotSupported })
216
+ ] })
217
+ ]
218
+ },
219
+ e.id
220
+ );
221
+ }),
222
+ h?.length > 0 && /* @__PURE__ */ p(
223
+ S,
224
+ {
225
+ onOpenChange: (e) => {
226
+ C((c) => {
227
+ const a = new Set(c);
228
+ return e ? a.add("add") : a.delete("add"), a;
229
+ });
230
+ },
231
+ children: [
232
+ /* @__PURE__ */ o(_, { asChild: !0, children: /* @__PURE__ */ p(
233
+ y,
234
+ {
235
+ variant: "ghost",
236
+ className: `hover:border-d-border flex cursor-pointer items-center gap-1 hover:border ${j && "border-d-foreground border"}`,
237
+ children: [
238
+ /* @__PURE__ */ o(f, { name: "FunnelPlus" }),
239
+ s.filters.addFilter
240
+ ]
241
+ }
242
+ ) }),
243
+ /* @__PURE__ */ p(D, { className: "p-2", children: [
244
+ /* @__PURE__ */ o(
245
+ E,
246
+ {
247
+ className: "mb-1",
248
+ placeholder: s.filters.searchFilters,
249
+ iconLeft: "Search",
250
+ onChange: (e) => I(e.target.value),
251
+ value: L
252
+ }
253
+ ),
254
+ /* @__PURE__ */ o("div", { className: "max-h-[400px] overflow-y-auto", children: P.map((e) => /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
255
+ N,
256
+ {
257
+ variant: "ghost",
258
+ className: "w-full justify-start",
259
+ iconLeft: M(
260
+ e.column.columnDef.meta?.type
261
+ ),
262
+ onClick: () => G(e),
263
+ children: e.column.columnDef.header?.toString()
264
+ }
265
+ ) }, e.id)) }),
266
+ /* @__PURE__ */ o("div", { className: "border-d-border mb-1 w-full border-b" }),
267
+ /* @__PURE__ */ o(
268
+ N,
269
+ {
270
+ variant: "ghost",
271
+ className: "w-full justify-start",
272
+ iconLeft: "ListFilterPlus",
273
+ disabled: !!m,
274
+ onClick: () => F(),
275
+ children: s.filters.advancedFilter
276
+ }
277
+ )
278
+ ] })
279
+ ]
280
+ }
281
+ )
282
+ ] });
283
+ }
284
+ export {
285
+ se as DataTableFilters
286
+ };
@@ -0,0 +1,131 @@
1
+ "use client";
2
+ import { jsxs as h, jsx as a } from "react/jsx-runtime";
3
+ import { Pagination as k, PaginationContent as M, PaginationItem as t, PaginationFirst as D, PaginationPrevious as w, PaginationLink as $, PaginationNext as j, PaginationLast as F } from "../../../pagination.js";
4
+ function R({
5
+ table: n,
6
+ isServerSide: l,
7
+ clientPagination: f,
8
+ serverState: i,
9
+ onServerStateChange: g,
10
+ totalItems: I,
11
+ i18n: s
12
+ }) {
13
+ const P = l ? i?.pagination?.pageIndex ?? 0 : n.getState().pagination.pageIndex, u = l ? i?.pagination?.pageSize ?? f.pageSize : n.getState().pagination.pageSize, x = l ? I ?? 0 : n.getFilteredRowModel().rows.length, N = x === 0 ? 0 : P * u + 1, z = x === 0 ? 0 : Math.min((P + 1) * u, x);
14
+ return /* @__PURE__ */ h(k, { className: "h-6", children: [
15
+ /* @__PURE__ */ a("div", { className: "flex h-full flex-1 items-center align-middle text-xs", children: /* @__PURE__ */ a("div", { className: "text-d-foreground hidden md:flex", children: `${N}-${z} / ${x} ${s.pagination.rows}` }) }),
16
+ /* @__PURE__ */ h(M, { children: [
17
+ /* @__PURE__ */ a(t, { className: "h-full", children: /* @__PURE__ */ a(
18
+ D,
19
+ {
20
+ className: "h-full text-xs",
21
+ size: "sm",
22
+ isDisabled: !n.getCanPreviousPage(),
23
+ label: s.pagination.first,
24
+ onClick: () => {
25
+ l && i && g ? g({
26
+ ...i,
27
+ pagination: {
28
+ ...i.pagination,
29
+ pageIndex: 0
30
+ }
31
+ }) : n.setPageIndex(0);
32
+ },
33
+ "aria-label": "Go to first page"
34
+ }
35
+ ) }),
36
+ /* @__PURE__ */ a(t, { className: "h-full", children: /* @__PURE__ */ a(
37
+ w,
38
+ {
39
+ className: "h-full text-xs",
40
+ size: "sm",
41
+ isDisabled: !n.getCanPreviousPage(),
42
+ label: s.pagination.previous,
43
+ onClick: () => {
44
+ if (n.getCanPreviousPage())
45
+ if (l && i && g) {
46
+ const o = i.pagination.pageIndex ?? f.pageIndex, d = Math.max(o - 1, 0);
47
+ g({
48
+ ...i,
49
+ pagination: {
50
+ ...i.pagination,
51
+ pageIndex: d
52
+ }
53
+ });
54
+ } else
55
+ n.previousPage();
56
+ }
57
+ }
58
+ ) }),
59
+ (() => {
60
+ const o = n.getState().pagination.pageIndex, d = n.getPageCount(), c = 5;
61
+ let m = Math.max(
62
+ 0,
63
+ o - Math.floor(c / 2)
64
+ ), p = m + c;
65
+ return p > d && (p = d, m = Math.max(0, p - c)), n.getPageOptions().slice(m, p).map((e, C) => /* @__PURE__ */ a(t, { className: "h-full", children: /* @__PURE__ */ a(
66
+ $,
67
+ {
68
+ className: "h-full text-sm",
69
+ size: "icon",
70
+ isActive: o === e,
71
+ onClick: () => {
72
+ if (l && i && g) {
73
+ if (o === e) return;
74
+ g({
75
+ ...i,
76
+ pagination: {
77
+ ...i.pagination,
78
+ pageIndex: e
79
+ }
80
+ });
81
+ } else
82
+ n.setPageIndex(e);
83
+ },
84
+ children: e + 1
85
+ }
86
+ ) }, C));
87
+ })(),
88
+ /* @__PURE__ */ a(t, { className: "h-full", children: /* @__PURE__ */ a(
89
+ j,
90
+ {
91
+ className: "h-full text-xs",
92
+ size: "sm",
93
+ isDisabled: !n.getCanNextPage(),
94
+ label: s.pagination.next,
95
+ onClick: () => {
96
+ n.getCanNextPage() && (l && i && g ? g({
97
+ ...i,
98
+ pagination: {
99
+ ...i.pagination,
100
+ pageIndex: i.pagination.pageIndex + 1
101
+ }
102
+ }) : n.nextPage());
103
+ }
104
+ }
105
+ ) }),
106
+ /* @__PURE__ */ a(t, { className: "h-full", children: /* @__PURE__ */ a(
107
+ F,
108
+ {
109
+ className: "h-full text-xs",
110
+ size: "sm",
111
+ isDisabled: !n.getCanNextPage(),
112
+ label: s.pagination.last,
113
+ onClick: () => {
114
+ l && i && g ? g({
115
+ ...i,
116
+ pagination: {
117
+ ...i.pagination,
118
+ pageIndex: n.getPageCount() - 1
119
+ }
120
+ }) : n.setPageIndex(n.getPageCount() - 1);
121
+ },
122
+ "aria-label": "Go to last page"
123
+ }
124
+ ) })
125
+ ] }),
126
+ /* @__PURE__ */ a("div", { className: "flex h-full flex-1 items-center justify-end align-middle text-xs", children: /* @__PURE__ */ a("div", { className: "text-d-foreground hidden md:flex", children: (n.getPageCount() ? n.getState().pagination.pageIndex + 1 : 0) + " / " + n.getPageCount() + " " + s.pagination.pages }) })
127
+ ] });
128
+ }
129
+ export {
130
+ R as DataTablePaginationComponent
131
+ };