better-table 1.0.0 → 1.1.0
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/README.md +33 -0
- package/dist/better-table.cjs.js +1 -1
- package/dist/better-table.cjs.js.map +1 -1
- package/dist/better-table.css +1 -1
- package/dist/better-table.es.js +852 -699
- package/dist/better-table.es.js.map +1 -1
- package/dist/components/BetterTable/components/TableCard.d.ts +8 -0
- package/dist/components/BetterTable/components/TableCards.d.ts +4 -0
- package/dist/components/BetterTable/components/index.d.ts +2 -0
- package/dist/setupTests.d.ts +0 -0
- package/package.json +7 -7
package/dist/better-table.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as
|
|
1
|
+
import I, { useContext as Ee, createContext as Ke, useCallback as m, useMemo as x, useEffect as Oe, useState as z } from "react";
|
|
2
|
+
import { jsx as i, jsxs as y, Fragment as Fe } from "react/jsx-runtime";
|
|
3
3
|
import "./styles.js";
|
|
4
4
|
const Ve = {
|
|
5
5
|
search: "Buscar",
|
|
@@ -18,292 +18,290 @@ const Ve = {
|
|
|
18
18
|
clearFilters: "Limpiar filtros",
|
|
19
19
|
selectAll: "Seleccionar todo",
|
|
20
20
|
deselectAll: "Deseleccionar todo"
|
|
21
|
-
},
|
|
22
|
-
function
|
|
23
|
-
const e = Ee(
|
|
21
|
+
}, $e = Ke(null);
|
|
22
|
+
function w() {
|
|
23
|
+
const e = Ee($e);
|
|
24
24
|
if (!e)
|
|
25
25
|
throw new Error("useTableContext must be used within a TableProvider");
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function He({
|
|
29
29
|
value: e,
|
|
30
|
-
children:
|
|
30
|
+
children: t
|
|
31
31
|
}) {
|
|
32
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ i($e.Provider, { value: e, children: t });
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
var
|
|
36
|
-
if (typeof e == "string" || typeof e == "number")
|
|
34
|
+
function xe(e) {
|
|
35
|
+
var t, l, n = "";
|
|
36
|
+
if (typeof e == "string" || typeof e == "number") n += e;
|
|
37
37
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
38
|
-
var
|
|
39
|
-
for (
|
|
40
|
-
} else for (
|
|
41
|
-
return
|
|
38
|
+
var s = e.length;
|
|
39
|
+
for (t = 0; t < s; t++) e[t] && (l = xe(e[t])) && (n && (n += " "), n += l);
|
|
40
|
+
} else for (l in e) e[l] && (n && (n += " "), n += l);
|
|
41
|
+
return n;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
for (var e,
|
|
45
|
-
return
|
|
43
|
+
function P() {
|
|
44
|
+
for (var e, t, l = 0, n = "", s = arguments.length; l < s; l++) (e = arguments[l]) && (t = xe(e)) && (n && (n += " "), n += t);
|
|
45
|
+
return n;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function qe({
|
|
48
48
|
column: e
|
|
49
49
|
}) {
|
|
50
50
|
const {
|
|
51
|
-
sortState:
|
|
52
|
-
handleSort:
|
|
53
|
-
filters:
|
|
54
|
-
setFilter:
|
|
55
|
-
locale:
|
|
56
|
-
} =
|
|
57
|
-
e.sortable !== !1 &&
|
|
58
|
-
}, [e.id, e.sortable,
|
|
59
|
-
(
|
|
60
|
-
const
|
|
61
|
-
e.type === "boolean" ?
|
|
51
|
+
sortState: t,
|
|
52
|
+
handleSort: l,
|
|
53
|
+
filters: n,
|
|
54
|
+
setFilter: s,
|
|
55
|
+
locale: a
|
|
56
|
+
} = w(), r = t.columnId === e.id, b = r ? t.direction : null, o = m(() => {
|
|
57
|
+
e.sortable !== !1 && l(e.id);
|
|
58
|
+
}, [e.id, e.sortable, l]), h = m(
|
|
59
|
+
(u) => {
|
|
60
|
+
const v = u.target.value;
|
|
61
|
+
e.type === "boolean" ? v === "" ? s(e.id, null) : s(e.id, v === "true") : s(e.id, v || null);
|
|
62
62
|
},
|
|
63
|
-
[e.id, e.type,
|
|
64
|
-
),
|
|
65
|
-
(
|
|
66
|
-
|
|
63
|
+
[e.id, e.type, s]
|
|
64
|
+
), f = m(
|
|
65
|
+
(u) => {
|
|
66
|
+
u.key === "Enter" && e.sortable !== !1 && l(e.id);
|
|
67
67
|
},
|
|
68
|
-
[e.id, e.sortable,
|
|
69
|
-
),
|
|
68
|
+
[e.id, e.sortable, l]
|
|
69
|
+
), S = () => e.sortable === !1 || e.type === "custom" ? null : /* @__PURE__ */ i(
|
|
70
70
|
"button",
|
|
71
71
|
{
|
|
72
|
-
className:
|
|
73
|
-
onClick:
|
|
74
|
-
"aria-label":
|
|
72
|
+
className: P("bt-sort-btn", r && "bt-active"),
|
|
73
|
+
onClick: o,
|
|
74
|
+
"aria-label": b === "asc" ? a.sortDesc : a.sortAsc,
|
|
75
75
|
type: "button",
|
|
76
|
-
children:
|
|
76
|
+
children: r ? b === "asc" ? "↑" : "↓" : "⇅"
|
|
77
77
|
}
|
|
78
|
-
),
|
|
78
|
+
), p = () => {
|
|
79
79
|
if (e.filterable === !1 || e.type === "custom")
|
|
80
80
|
return null;
|
|
81
|
-
const
|
|
81
|
+
const u = n[e.id];
|
|
82
82
|
return e.type === "boolean" ? /* @__PURE__ */ y(
|
|
83
83
|
"select",
|
|
84
84
|
{
|
|
85
85
|
className: "bt-filter-select",
|
|
86
|
-
value:
|
|
87
|
-
onChange:
|
|
88
|
-
"aria-label": `${
|
|
86
|
+
value: u == null ? "" : String(u),
|
|
87
|
+
onChange: h,
|
|
88
|
+
"aria-label": `${a.filterBy} ${e.header}`,
|
|
89
89
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ i("option", { value: "", children: "-" }),
|
|
91
|
+
/* @__PURE__ */ i("option", { value: "true", children: "✅" }),
|
|
92
|
+
/* @__PURE__ */ i("option", { value: "false", children: "❌" })
|
|
93
93
|
]
|
|
94
94
|
}
|
|
95
|
-
) : /* @__PURE__ */
|
|
95
|
+
) : /* @__PURE__ */ i(
|
|
96
96
|
"input",
|
|
97
97
|
{
|
|
98
98
|
type: e.type === "number" ? "number" : "text",
|
|
99
99
|
className: "bt-filter-input",
|
|
100
|
-
placeholder: `${
|
|
101
|
-
value:
|
|
102
|
-
onChange:
|
|
103
|
-
"aria-label": `${
|
|
100
|
+
placeholder: `${a.filterBy}...`,
|
|
101
|
+
value: u != null ? String(u) : "",
|
|
102
|
+
onChange: h,
|
|
103
|
+
"aria-label": `${a.filterBy} ${e.header}`
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
106
|
};
|
|
107
|
-
return e.headerCell ? /* @__PURE__ */
|
|
107
|
+
return e.headerCell ? /* @__PURE__ */ i(
|
|
108
108
|
"th",
|
|
109
109
|
{
|
|
110
|
-
className:
|
|
110
|
+
className: P("bt-th", e.align && `bt-align-${e.align}`),
|
|
111
111
|
style: { width: e.width },
|
|
112
112
|
children: e.headerCell(e)
|
|
113
113
|
}
|
|
114
|
-
) : /* @__PURE__ */
|
|
114
|
+
) : /* @__PURE__ */ i(
|
|
115
115
|
"th",
|
|
116
116
|
{
|
|
117
|
-
className:
|
|
117
|
+
className: P("bt-th", e.align && `bt-align-${e.align}`),
|
|
118
118
|
style: { width: e.width },
|
|
119
119
|
role: "columnheader",
|
|
120
|
-
"aria-sort":
|
|
120
|
+
"aria-sort": r ? b === "asc" ? "ascending" : "descending" : void 0,
|
|
121
121
|
tabIndex: e.sortable !== !1 ? 0 : void 0,
|
|
122
|
-
onKeyDown: e.sortable !== !1 ?
|
|
122
|
+
onKeyDown: e.sortable !== !1 ? f : void 0,
|
|
123
123
|
children: /* @__PURE__ */ y("div", { className: "bt-th-content", children: [
|
|
124
124
|
/* @__PURE__ */ y("div", { className: "bt-th-header", children: [
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
|
|
125
|
+
/* @__PURE__ */ i("span", { className: "bt-th-title", children: e.header }),
|
|
126
|
+
S()
|
|
127
127
|
] }),
|
|
128
|
-
e.filterable !== !1 &&
|
|
128
|
+
e.filterable !== !1 && p()
|
|
129
129
|
] })
|
|
130
130
|
}
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
|
-
const _e =
|
|
134
|
-
|
|
133
|
+
const _e = I.memo(
|
|
134
|
+
qe
|
|
135
135
|
);
|
|
136
|
-
function
|
|
136
|
+
function Je() {
|
|
137
137
|
const {
|
|
138
138
|
columns: e,
|
|
139
|
-
selectable:
|
|
140
|
-
selectionMode:
|
|
141
|
-
rowActions:
|
|
142
|
-
isAllSelected:
|
|
143
|
-
isPartiallySelected:
|
|
144
|
-
selectAll:
|
|
145
|
-
deselectAll:
|
|
146
|
-
locale:
|
|
147
|
-
stickyHeader:
|
|
148
|
-
} =
|
|
149
|
-
|
|
139
|
+
selectable: t,
|
|
140
|
+
selectionMode: l,
|
|
141
|
+
rowActions: n,
|
|
142
|
+
isAllSelected: s,
|
|
143
|
+
isPartiallySelected: a,
|
|
144
|
+
selectAll: r,
|
|
145
|
+
deselectAll: b,
|
|
146
|
+
locale: o,
|
|
147
|
+
stickyHeader: h
|
|
148
|
+
} = w(), f = e.filter((u) => !u.hidden), S = n && n.length > 0, p = () => {
|
|
149
|
+
s ? b() : r();
|
|
150
150
|
};
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
|
|
151
|
+
return /* @__PURE__ */ i("thead", { className: P("bt-thead", h && "bt-sticky"), children: /* @__PURE__ */ y("tr", { className: "bt-tr", children: [
|
|
152
|
+
t && /* @__PURE__ */ i("th", { className: "bt-th bt-checkbox-cell", children: l === "multiple" && /* @__PURE__ */ i(
|
|
153
153
|
"input",
|
|
154
154
|
{
|
|
155
155
|
type: "checkbox",
|
|
156
156
|
className: "bt-checkbox",
|
|
157
|
-
checked:
|
|
158
|
-
ref: (
|
|
159
|
-
|
|
157
|
+
checked: s,
|
|
158
|
+
ref: (u) => {
|
|
159
|
+
u && (u.indeterminate = a);
|
|
160
160
|
},
|
|
161
|
-
onChange:
|
|
162
|
-
"aria-label":
|
|
161
|
+
onChange: p,
|
|
162
|
+
"aria-label": s ? o.deselectAll : o.selectAll
|
|
163
163
|
}
|
|
164
164
|
) }),
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
f.map((u) => /* @__PURE__ */ i(_e, { column: u }, u.id)),
|
|
166
|
+
S && /* @__PURE__ */ i("th", { className: "bt-th bt-actions-cell", children: o.actions })
|
|
167
167
|
] }) });
|
|
168
168
|
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
171
|
-
if (!e || !
|
|
172
|
-
const
|
|
173
|
-
let
|
|
174
|
-
for (const
|
|
175
|
-
if (
|
|
169
|
+
const Qe = Je;
|
|
170
|
+
function M(e, t) {
|
|
171
|
+
if (!e || !t) return;
|
|
172
|
+
const l = t.split(".");
|
|
173
|
+
let n = e;
|
|
174
|
+
for (const s of l) {
|
|
175
|
+
if (n == null)
|
|
176
176
|
return;
|
|
177
|
-
if (typeof
|
|
178
|
-
|
|
177
|
+
if (typeof n == "object")
|
|
178
|
+
n = n[s];
|
|
179
179
|
else
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
-
return
|
|
182
|
+
return n;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
return [...e].sort((
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
191
|
-
if (typeof
|
|
192
|
-
const
|
|
184
|
+
function Ge(e, t, l) {
|
|
185
|
+
return [...e].sort((n, s) => {
|
|
186
|
+
const a = M(n, t), r = M(s, t);
|
|
187
|
+
if (a == null)
|
|
188
|
+
return l === "asc" ? 1 : -1;
|
|
189
|
+
if (r == null)
|
|
190
|
+
return l === "asc" ? -1 : 1;
|
|
191
|
+
if (typeof a == "string" && typeof r == "string") {
|
|
192
|
+
const f = a.localeCompare(r, void 0, {
|
|
193
193
|
sensitivity: "base",
|
|
194
194
|
numeric: !0
|
|
195
195
|
});
|
|
196
|
-
return
|
|
196
|
+
return l === "asc" ? f : -f;
|
|
197
197
|
}
|
|
198
|
-
if (typeof
|
|
199
|
-
return
|
|
200
|
-
if (typeof
|
|
201
|
-
const
|
|
202
|
-
return
|
|
198
|
+
if (typeof a == "number" && typeof r == "number")
|
|
199
|
+
return l === "asc" ? a - r : r - a;
|
|
200
|
+
if (typeof a == "boolean" && typeof r == "boolean") {
|
|
201
|
+
const f = a === r ? 0 : a ? -1 : 1;
|
|
202
|
+
return l === "asc" ? f : -f;
|
|
203
203
|
}
|
|
204
|
-
if (
|
|
205
|
-
const
|
|
206
|
-
return
|
|
204
|
+
if (a instanceof Date && r instanceof Date) {
|
|
205
|
+
const f = a.getTime() - r.getTime();
|
|
206
|
+
return l === "asc" ? f : -f;
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
return
|
|
208
|
+
const b = String(a), o = String(r), h = b.localeCompare(o);
|
|
209
|
+
return l === "asc" ? h : -h;
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
const
|
|
214
|
-
([,
|
|
212
|
+
function Ue(e, t, l) {
|
|
213
|
+
const n = Object.entries(t).filter(
|
|
214
|
+
([, s]) => s != null && s !== ""
|
|
215
215
|
);
|
|
216
|
-
return
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
String(
|
|
216
|
+
return n.length === 0 ? e : e.filter((s) => n.every(([a, r]) => {
|
|
217
|
+
const b = l.find((f) => f.id === a);
|
|
218
|
+
if (!b) return !0;
|
|
219
|
+
const o = M(
|
|
220
|
+
s,
|
|
221
|
+
String(b.accessor)
|
|
222
222
|
);
|
|
223
|
-
if (
|
|
223
|
+
if (o == null)
|
|
224
224
|
return !1;
|
|
225
|
-
switch (
|
|
225
|
+
switch (b.type ?? "string") {
|
|
226
226
|
case "boolean":
|
|
227
|
-
return
|
|
227
|
+
return o === r;
|
|
228
228
|
case "number":
|
|
229
|
-
return String(
|
|
229
|
+
return String(o) === String(r);
|
|
230
230
|
case "date":
|
|
231
|
-
if (
|
|
232
|
-
const
|
|
233
|
-
return
|
|
231
|
+
if (o instanceof Date && r) {
|
|
232
|
+
const f = new Date(String(r));
|
|
233
|
+
return o.toDateString() === f.toDateString();
|
|
234
234
|
}
|
|
235
|
-
return String(
|
|
236
|
-
case "string":
|
|
235
|
+
return String(o).includes(String(r));
|
|
237
236
|
default:
|
|
238
|
-
return String(
|
|
237
|
+
return String(o).toLowerCase().includes(String(r).toLowerCase());
|
|
239
238
|
}
|
|
240
239
|
}));
|
|
241
240
|
}
|
|
242
|
-
function
|
|
243
|
-
if (!
|
|
241
|
+
function We(e, t, l, n) {
|
|
242
|
+
if (!t.trim())
|
|
244
243
|
return e;
|
|
245
|
-
const
|
|
244
|
+
const s = t.toLowerCase().trim(), a = n ? l.filter((r) => n.includes(r.id)) : l.filter((r) => r.type !== "custom");
|
|
246
245
|
return e.filter(
|
|
247
|
-
(
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
String(
|
|
246
|
+
(r) => a.some((b) => {
|
|
247
|
+
const o = M(
|
|
248
|
+
r,
|
|
249
|
+
String(b.accessor)
|
|
251
250
|
);
|
|
252
|
-
return
|
|
251
|
+
return o == null ? !1 : String(o).toLowerCase().includes(s);
|
|
253
252
|
})
|
|
254
253
|
);
|
|
255
254
|
}
|
|
256
|
-
function
|
|
255
|
+
function Xe({
|
|
257
256
|
row: e,
|
|
258
|
-
column:
|
|
259
|
-
rowIndex:
|
|
257
|
+
column: t,
|
|
258
|
+
rowIndex: l
|
|
260
259
|
}) {
|
|
261
|
-
const
|
|
260
|
+
const n = M(
|
|
262
261
|
e,
|
|
263
|
-
String(
|
|
264
|
-
),
|
|
265
|
-
if (
|
|
266
|
-
return
|
|
267
|
-
if (
|
|
268
|
-
return /* @__PURE__ */
|
|
269
|
-
switch (
|
|
262
|
+
String(t.accessor)
|
|
263
|
+
), a = (() => {
|
|
264
|
+
if (t.cell)
|
|
265
|
+
return t.cell(n, e, l);
|
|
266
|
+
if (n == null)
|
|
267
|
+
return /* @__PURE__ */ i("span", { className: "bt-cell-empty", children: "—" });
|
|
268
|
+
switch (t.type) {
|
|
270
269
|
case "boolean":
|
|
271
|
-
return
|
|
270
|
+
return n ? "✅" : "❌";
|
|
272
271
|
case "date":
|
|
273
|
-
if (
|
|
274
|
-
return
|
|
275
|
-
const
|
|
276
|
-
return isNaN(
|
|
272
|
+
if (n instanceof Date)
|
|
273
|
+
return n.toLocaleDateString();
|
|
274
|
+
const r = new Date(String(n));
|
|
275
|
+
return isNaN(r.getTime()) ? String(n) : r.toLocaleDateString();
|
|
277
276
|
case "number":
|
|
278
|
-
return typeof
|
|
279
|
-
case "string":
|
|
277
|
+
return typeof n == "number" ? n.toLocaleString() : n;
|
|
280
278
|
default:
|
|
281
|
-
return String(
|
|
279
|
+
return String(n);
|
|
282
280
|
}
|
|
283
281
|
})();
|
|
284
|
-
return /* @__PURE__ */
|
|
282
|
+
return /* @__PURE__ */ i(
|
|
285
283
|
"td",
|
|
286
284
|
{
|
|
287
|
-
className:
|
|
288
|
-
style: { width:
|
|
289
|
-
children:
|
|
285
|
+
className: P("bt-td", t.align && `bt-align-${t.align}`),
|
|
286
|
+
style: { width: t.width },
|
|
287
|
+
children: a
|
|
290
288
|
}
|
|
291
289
|
);
|
|
292
290
|
}
|
|
293
|
-
const
|
|
294
|
-
function
|
|
291
|
+
const Ye = I.memo(Xe);
|
|
292
|
+
function Ze({
|
|
295
293
|
row: e,
|
|
296
|
-
rowIndex:
|
|
294
|
+
rowIndex: t
|
|
297
295
|
}) {
|
|
298
|
-
const { rowActions:
|
|
299
|
-
(
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
else if (
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
|
|
296
|
+
const { rowActions: l, openModal: n } = w(), s = m(
|
|
297
|
+
(a) => {
|
|
298
|
+
if (a.mode === "callback" && a.onClick)
|
|
299
|
+
a.onClick(e, t);
|
|
300
|
+
else if (a.mode === "modal" && a.modalContent) {
|
|
301
|
+
const r = a.modalContent;
|
|
302
|
+
n(
|
|
303
|
+
/* @__PURE__ */ i(
|
|
304
|
+
r,
|
|
307
305
|
{
|
|
308
306
|
data: e,
|
|
309
307
|
onClose: () => {
|
|
@@ -311,226 +309,377 @@ function Fe({
|
|
|
311
309
|
}
|
|
312
310
|
)
|
|
313
311
|
);
|
|
314
|
-
} else if (
|
|
315
|
-
const
|
|
316
|
-
window.open(
|
|
312
|
+
} else if (a.mode === "link" && a.href) {
|
|
313
|
+
const r = typeof a.href == "function" ? a.href(e) : a.href;
|
|
314
|
+
window.open(r, "_blank");
|
|
317
315
|
}
|
|
318
316
|
},
|
|
319
|
-
[e,
|
|
317
|
+
[e, t, n]
|
|
320
318
|
);
|
|
321
|
-
return !
|
|
322
|
-
if (
|
|
319
|
+
return !l || l.length === 0 ? null : /* @__PURE__ */ i("td", { className: "bt-td bt-actions-cell", children: /* @__PURE__ */ i("div", { className: "bt-actions-wrapper", children: l.map((a) => {
|
|
320
|
+
if (a.visible && !a.visible(e))
|
|
323
321
|
return null;
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
return /* @__PURE__ */
|
|
322
|
+
const r = a.disabled ? a.disabled(e) : !1;
|
|
323
|
+
if (a.mode === "link" && a.href) {
|
|
324
|
+
const b = typeof a.href == "function" ? a.href(e) : a.href;
|
|
325
|
+
return /* @__PURE__ */ i(
|
|
328
326
|
"a",
|
|
329
327
|
{
|
|
330
|
-
href:
|
|
328
|
+
href: b,
|
|
331
329
|
target: "_blank",
|
|
332
330
|
rel: "noopener noreferrer",
|
|
333
|
-
className:
|
|
331
|
+
className: P(
|
|
334
332
|
"bt-action-btn",
|
|
335
|
-
|
|
333
|
+
a.variant && `bt-variant-${a.variant}`
|
|
336
334
|
),
|
|
337
|
-
"aria-label":
|
|
338
|
-
children:
|
|
335
|
+
"aria-label": a.label,
|
|
336
|
+
children: a.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: a.icon })
|
|
339
337
|
},
|
|
340
|
-
|
|
338
|
+
a.id
|
|
341
339
|
);
|
|
342
340
|
}
|
|
343
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ i(
|
|
344
342
|
"button",
|
|
345
343
|
{
|
|
346
|
-
className:
|
|
344
|
+
className: P(
|
|
347
345
|
"bt-action-btn",
|
|
348
|
-
|
|
346
|
+
a.variant && `bt-variant-${a.variant}`
|
|
349
347
|
),
|
|
350
|
-
onClick: () =>
|
|
351
|
-
disabled:
|
|
352
|
-
"aria-label":
|
|
353
|
-
title:
|
|
348
|
+
onClick: () => s(a),
|
|
349
|
+
disabled: r,
|
|
350
|
+
"aria-label": a.label,
|
|
351
|
+
title: a.label,
|
|
354
352
|
type: "button",
|
|
355
|
-
children:
|
|
353
|
+
children: a.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: a.icon })
|
|
356
354
|
},
|
|
357
|
-
|
|
355
|
+
a.id
|
|
358
356
|
);
|
|
359
357
|
}) }) });
|
|
360
358
|
}
|
|
361
|
-
const et =
|
|
362
|
-
|
|
359
|
+
const et = I.memo(
|
|
360
|
+
Ze
|
|
363
361
|
);
|
|
364
|
-
function tt({ row: e, rowIndex:
|
|
362
|
+
function tt({ row: e, rowIndex: t }) {
|
|
365
363
|
const {
|
|
366
|
-
columns:
|
|
367
|
-
selectable:
|
|
368
|
-
rowActions:
|
|
369
|
-
isSelected:
|
|
370
|
-
toggleRow:
|
|
371
|
-
striped:
|
|
372
|
-
hoverable:
|
|
373
|
-
onRowClick:
|
|
374
|
-
onRowDoubleClick:
|
|
375
|
-
} =
|
|
376
|
-
|
|
377
|
-
}, [e,
|
|
378
|
-
|
|
379
|
-
}, [e,
|
|
380
|
-
|
|
381
|
-
}, [e,
|
|
382
|
-
(
|
|
383
|
-
|
|
364
|
+
columns: l,
|
|
365
|
+
selectable: n,
|
|
366
|
+
rowActions: s,
|
|
367
|
+
isSelected: a,
|
|
368
|
+
toggleRow: r,
|
|
369
|
+
striped: b,
|
|
370
|
+
hoverable: o,
|
|
371
|
+
onRowClick: h,
|
|
372
|
+
onRowDoubleClick: f
|
|
373
|
+
} = w(), S = l.filter((k) => !k.hidden), p = s && s.length > 0, u = n && a(e, t), v = !!h, N = m(() => {
|
|
374
|
+
h?.(e, t);
|
|
375
|
+
}, [e, t, h]), D = m(() => {
|
|
376
|
+
f?.(e, t);
|
|
377
|
+
}, [e, t, f]), $ = m(() => {
|
|
378
|
+
r(e, t);
|
|
379
|
+
}, [e, t, r]), T = m(
|
|
380
|
+
(k) => {
|
|
381
|
+
k.key === "Enter" && h && N();
|
|
384
382
|
},
|
|
385
|
-
[N,
|
|
383
|
+
[N, h]
|
|
386
384
|
);
|
|
387
385
|
return /* @__PURE__ */ y(
|
|
388
386
|
"tr",
|
|
389
387
|
{
|
|
390
|
-
className:
|
|
388
|
+
className: P(
|
|
391
389
|
"bt-tr",
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
390
|
+
b && "bt-striped",
|
|
391
|
+
o && "bt-hoverable",
|
|
392
|
+
u && "bt-selected",
|
|
393
|
+
v && "bt-clickable"
|
|
396
394
|
),
|
|
397
|
-
onClick:
|
|
398
|
-
onDoubleClick:
|
|
399
|
-
onKeyDown:
|
|
400
|
-
tabIndex:
|
|
401
|
-
role:
|
|
402
|
-
"aria-selected":
|
|
395
|
+
onClick: v ? N : void 0,
|
|
396
|
+
onDoubleClick: f ? D : void 0,
|
|
397
|
+
onKeyDown: v ? T : void 0,
|
|
398
|
+
tabIndex: v ? 0 : void 0,
|
|
399
|
+
role: v ? "button" : void 0,
|
|
400
|
+
"aria-selected": n ? u : void 0,
|
|
403
401
|
children: [
|
|
404
|
-
|
|
402
|
+
n && /* @__PURE__ */ i("td", { className: "bt-td bt-checkbox-cell", children: /* @__PURE__ */ i(
|
|
405
403
|
"input",
|
|
406
404
|
{
|
|
407
405
|
type: "checkbox",
|
|
408
406
|
className: "bt-checkbox",
|
|
409
|
-
checked:
|
|
407
|
+
checked: u,
|
|
410
408
|
onChange: $,
|
|
411
|
-
onClick: (
|
|
412
|
-
"aria-label": `Select row ${
|
|
409
|
+
onClick: (k) => k.stopPropagation(),
|
|
410
|
+
"aria-label": `Select row ${t + 1}`
|
|
413
411
|
}
|
|
414
412
|
) }),
|
|
415
|
-
|
|
416
|
-
|
|
413
|
+
S.map((k) => /* @__PURE__ */ i(
|
|
414
|
+
Ye,
|
|
417
415
|
{
|
|
418
416
|
row: e,
|
|
419
|
-
column:
|
|
420
|
-
rowIndex:
|
|
417
|
+
column: k,
|
|
418
|
+
rowIndex: t
|
|
421
419
|
},
|
|
422
|
-
|
|
420
|
+
k.id
|
|
423
421
|
)),
|
|
424
|
-
|
|
422
|
+
p && /* @__PURE__ */ i(et, { row: e, rowIndex: t })
|
|
425
423
|
]
|
|
426
424
|
}
|
|
427
425
|
);
|
|
428
426
|
}
|
|
429
|
-
const at =
|
|
430
|
-
function
|
|
431
|
-
const { processedData: e, rowKey:
|
|
432
|
-
if (typeof
|
|
433
|
-
return
|
|
434
|
-
const
|
|
435
|
-
return String(
|
|
427
|
+
const at = I.memo(tt);
|
|
428
|
+
function nt() {
|
|
429
|
+
const { processedData: e, rowKey: t } = w(), l = (n, s) => {
|
|
430
|
+
if (typeof t == "function")
|
|
431
|
+
return t(n, s);
|
|
432
|
+
const a = n[t];
|
|
433
|
+
return String(a !== void 0 ? a : s);
|
|
436
434
|
};
|
|
437
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ i("tbody", { className: "bt-tbody", children: e.map((n, s) => /* @__PURE__ */ i(at, { row: n, rowIndex: s }, l(n, s))) });
|
|
438
436
|
}
|
|
439
|
-
const
|
|
440
|
-
function
|
|
437
|
+
const lt = nt;
|
|
438
|
+
function st({ row: e, rowIndex: t }) {
|
|
441
439
|
const {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
pageSizeOptions: f,
|
|
456
|
-
showSizeChanger: p,
|
|
457
|
-
locale: N,
|
|
458
|
-
classNames: P
|
|
459
|
-
} = C(), $ = m(
|
|
440
|
+
columns: l,
|
|
441
|
+
selectable: n,
|
|
442
|
+
rowActions: s,
|
|
443
|
+
isSelected: a,
|
|
444
|
+
toggleRow: r,
|
|
445
|
+
hoverable: b,
|
|
446
|
+
onRowClick: o,
|
|
447
|
+
openModal: h
|
|
448
|
+
} = w(), f = l.filter((c) => !c.hidden), S = s && s.length > 0, p = n && a(e, t), u = f[0], v = f.slice(1), N = m(() => {
|
|
449
|
+
r(e, t);
|
|
450
|
+
}, [e, t, r]), D = m(() => {
|
|
451
|
+
o?.(e, t);
|
|
452
|
+
}, [e, t, o]), $ = m(
|
|
460
453
|
(c) => {
|
|
461
|
-
o(
|
|
454
|
+
c.key === "Enter" && o && D();
|
|
462
455
|
},
|
|
463
|
-
[o]
|
|
464
|
-
),
|
|
456
|
+
[D, o]
|
|
457
|
+
), T = m(
|
|
465
458
|
(c) => {
|
|
466
|
-
if (c.
|
|
467
|
-
|
|
468
|
-
|
|
459
|
+
if (c.mode === "callback" && c.onClick)
|
|
460
|
+
c.onClick(e, t);
|
|
461
|
+
else if (c.mode === "modal" && c.modalContent) {
|
|
462
|
+
const g = c.modalContent;
|
|
463
|
+
h(/* @__PURE__ */ i(g, { data: e, onClose: () => {
|
|
464
|
+
} }));
|
|
465
|
+
} else if (c.mode === "link" && c.href) {
|
|
466
|
+
const g = typeof c.href == "function" ? c.href(e) : c.href;
|
|
467
|
+
window.open(g, "_blank");
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
[e, t, h]
|
|
471
|
+
), k = (c, g) => {
|
|
472
|
+
if (c.cell)
|
|
473
|
+
return c.cell(g, e, t);
|
|
474
|
+
if (g == null)
|
|
475
|
+
return /* @__PURE__ */ i("span", { className: "bt-card-value-empty", children: "—" });
|
|
476
|
+
switch (c.type) {
|
|
477
|
+
case "boolean":
|
|
478
|
+
return g ? "✅" : "❌";
|
|
479
|
+
case "date":
|
|
480
|
+
if (g instanceof Date)
|
|
481
|
+
return g.toLocaleDateString();
|
|
482
|
+
const C = new Date(String(g));
|
|
483
|
+
return isNaN(C.getTime()) ? String(g) : C.toLocaleDateString();
|
|
484
|
+
case "number":
|
|
485
|
+
return typeof g == "number" ? g.toLocaleString() : String(g);
|
|
486
|
+
default:
|
|
487
|
+
return String(g);
|
|
488
|
+
}
|
|
489
|
+
}, d = u ? M(e, String(u.accessor)) : "";
|
|
490
|
+
return /* @__PURE__ */ y(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
className: P(
|
|
494
|
+
"bt-card",
|
|
495
|
+
b && "bt-hoverable",
|
|
496
|
+
p && "bt-selected",
|
|
497
|
+
o && "bt-clickable"
|
|
498
|
+
),
|
|
499
|
+
onClick: o ? D : void 0,
|
|
500
|
+
onKeyDown: o ? $ : void 0,
|
|
501
|
+
tabIndex: o ? 0 : void 0,
|
|
502
|
+
role: o ? "button" : void 0,
|
|
503
|
+
"aria-selected": n ? p : void 0,
|
|
504
|
+
children: [
|
|
505
|
+
/* @__PURE__ */ y("div", { className: "bt-card-header", children: [
|
|
506
|
+
n && /* @__PURE__ */ i(
|
|
507
|
+
"input",
|
|
508
|
+
{
|
|
509
|
+
type: "checkbox",
|
|
510
|
+
className: "bt-checkbox",
|
|
511
|
+
checked: p,
|
|
512
|
+
onChange: N,
|
|
513
|
+
onClick: (c) => c.stopPropagation(),
|
|
514
|
+
"aria-label": `Select row ${t + 1}`
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
/* @__PURE__ */ i("span", { className: "bt-card-title", children: u ? k(u, d) : `Item ${t + 1}` })
|
|
518
|
+
] }),
|
|
519
|
+
v.map((c) => {
|
|
520
|
+
const g = M(
|
|
521
|
+
e,
|
|
522
|
+
String(c.accessor)
|
|
523
|
+
), C = k(c, g);
|
|
524
|
+
return /* @__PURE__ */ y("div", { className: "bt-card-row", children: [
|
|
525
|
+
/* @__PURE__ */ i("span", { className: "bt-card-label", children: c.header }),
|
|
526
|
+
/* @__PURE__ */ i("span", { className: "bt-card-value", children: C })
|
|
527
|
+
] }, c.id);
|
|
528
|
+
}),
|
|
529
|
+
S && /* @__PURE__ */ i("div", { className: "bt-card-actions", children: s.map((c) => {
|
|
530
|
+
if (c.visible && !c.visible(e))
|
|
531
|
+
return null;
|
|
532
|
+
const g = c.disabled ? c.disabled(e) : !1;
|
|
533
|
+
if (c.mode === "link" && c.href) {
|
|
534
|
+
const C = typeof c.href == "function" ? c.href(e) : c.href;
|
|
535
|
+
return /* @__PURE__ */ y(
|
|
536
|
+
"a",
|
|
537
|
+
{
|
|
538
|
+
href: C,
|
|
539
|
+
target: "_blank",
|
|
540
|
+
rel: "noopener noreferrer",
|
|
541
|
+
className: P(
|
|
542
|
+
"bt-action-btn",
|
|
543
|
+
c.variant && `bt-variant-${c.variant}`
|
|
544
|
+
),
|
|
545
|
+
onClick: (A) => A.stopPropagation(),
|
|
546
|
+
children: [
|
|
547
|
+
c.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: c.icon }),
|
|
548
|
+
/* @__PURE__ */ i("span", { children: c.label })
|
|
549
|
+
]
|
|
550
|
+
},
|
|
551
|
+
c.id
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
return /* @__PURE__ */ y(
|
|
555
|
+
"button",
|
|
556
|
+
{
|
|
557
|
+
className: P(
|
|
558
|
+
"bt-action-btn",
|
|
559
|
+
c.variant && `bt-variant-${c.variant}`
|
|
560
|
+
),
|
|
561
|
+
onClick: (C) => {
|
|
562
|
+
C.stopPropagation(), T(c);
|
|
563
|
+
},
|
|
564
|
+
disabled: g,
|
|
565
|
+
type: "button",
|
|
566
|
+
children: [
|
|
567
|
+
c.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: c.icon }),
|
|
568
|
+
/* @__PURE__ */ i("span", { children: c.label })
|
|
569
|
+
]
|
|
570
|
+
},
|
|
571
|
+
c.id
|
|
572
|
+
);
|
|
573
|
+
}) })
|
|
574
|
+
]
|
|
575
|
+
}
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
const rt = I.memo(st);
|
|
579
|
+
function it() {
|
|
580
|
+
const { processedData: e, rowKey: t } = w(), l = (n, s) => {
|
|
581
|
+
if (typeof t == "function")
|
|
582
|
+
return t(n, s);
|
|
583
|
+
const a = n[t];
|
|
584
|
+
return String(a !== void 0 ? a : s);
|
|
585
|
+
};
|
|
586
|
+
return /* @__PURE__ */ i("div", { className: "bt-cards", children: e.map((n, s) => /* @__PURE__ */ i(rt, { row: n, rowIndex: s }, l(n, s))) });
|
|
587
|
+
}
|
|
588
|
+
const ct = it;
|
|
589
|
+
function ot() {
|
|
590
|
+
const {
|
|
591
|
+
page: e,
|
|
592
|
+
pageSize: t,
|
|
593
|
+
totalPages: l,
|
|
594
|
+
totalItems: n,
|
|
595
|
+
goToPage: s,
|
|
596
|
+
nextPage: a,
|
|
597
|
+
prevPage: r,
|
|
598
|
+
changePageSize: b,
|
|
599
|
+
hasNextPage: o,
|
|
600
|
+
hasPrevPage: h,
|
|
601
|
+
startIndex: f,
|
|
602
|
+
endIndex: S,
|
|
603
|
+
paginationEnabled: p,
|
|
604
|
+
pageSizeOptions: u,
|
|
605
|
+
showSizeChanger: v,
|
|
606
|
+
locale: N,
|
|
607
|
+
classNames: D
|
|
608
|
+
} = w(), $ = m(
|
|
609
|
+
(d) => {
|
|
610
|
+
b(Number(d.target.value));
|
|
611
|
+
},
|
|
612
|
+
[b]
|
|
613
|
+
), T = m(
|
|
614
|
+
(d) => {
|
|
615
|
+
if (d.key === "Enter") {
|
|
616
|
+
const c = parseInt(d.target.value, 10);
|
|
617
|
+
!isNaN(c) && c >= 1 && c <= l && s(c);
|
|
469
618
|
}
|
|
470
619
|
},
|
|
471
|
-
[
|
|
472
|
-
),
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
475
|
-
for (let
|
|
476
|
-
|
|
620
|
+
[s, l]
|
|
621
|
+
), k = x(() => {
|
|
622
|
+
const d = [];
|
|
623
|
+
if (l <= 5)
|
|
624
|
+
for (let g = 1; g <= l; g++)
|
|
625
|
+
d.push(g);
|
|
477
626
|
else {
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
for (let A =
|
|
481
|
-
|
|
482
|
-
e <
|
|
627
|
+
d.push(1), e > 3 && d.push("ellipsis");
|
|
628
|
+
const g = Math.max(2, e - 1), C = Math.min(l - 1, e + 1);
|
|
629
|
+
for (let A = g; A <= C; A++)
|
|
630
|
+
d.push(A);
|
|
631
|
+
e < l - 2 && d.push("ellipsis"), l > 1 && d.push(l);
|
|
483
632
|
}
|
|
484
|
-
return
|
|
485
|
-
}, [e,
|
|
486
|
-
return
|
|
487
|
-
/* @__PURE__ */
|
|
633
|
+
return d;
|
|
634
|
+
}, [e, l]);
|
|
635
|
+
return p ? /* @__PURE__ */ y("div", { className: `bt-pagination ${D.pagination || ""}`, children: [
|
|
636
|
+
/* @__PURE__ */ i("div", { className: "bt-pagination-info", children: n > 0 ? `${f}-${S} ${N.of} ${n} ${N.items}` : `0 ${N.items}` }),
|
|
488
637
|
/* @__PURE__ */ y("div", { className: "bt-pagination-controls", children: [
|
|
489
|
-
|
|
638
|
+
v && /* @__PURE__ */ y("div", { className: "bt-page-size", children: [
|
|
490
639
|
/* @__PURE__ */ y("span", { className: "bt-page-size-label", children: [
|
|
491
640
|
N.rowsPerPage,
|
|
492
641
|
":"
|
|
493
642
|
] }),
|
|
494
|
-
/* @__PURE__ */
|
|
643
|
+
/* @__PURE__ */ i(
|
|
495
644
|
"select",
|
|
496
645
|
{
|
|
497
646
|
className: "bt-page-size-select",
|
|
498
|
-
value:
|
|
647
|
+
value: t,
|
|
499
648
|
onChange: $,
|
|
500
649
|
"aria-label": N.rowsPerPage,
|
|
501
|
-
children:
|
|
650
|
+
children: u.map((d) => /* @__PURE__ */ i("option", { value: d, children: d }, d))
|
|
502
651
|
}
|
|
503
652
|
)
|
|
504
653
|
] }),
|
|
505
|
-
/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ i(
|
|
506
655
|
"button",
|
|
507
656
|
{
|
|
508
657
|
className: "bt-pagination-btn",
|
|
509
|
-
onClick:
|
|
510
|
-
disabled: !
|
|
658
|
+
onClick: r,
|
|
659
|
+
disabled: !h,
|
|
511
660
|
"aria-label": "Previous page",
|
|
512
661
|
type: "button",
|
|
513
662
|
children: "←"
|
|
514
663
|
}
|
|
515
664
|
),
|
|
516
|
-
/* @__PURE__ */
|
|
665
|
+
/* @__PURE__ */ i("div", { className: "bt-pagination-pages", children: k.map((d, c) => d === "ellipsis" ? /* @__PURE__ */ i("span", { className: "bt-pagination-ellipsis", children: "..." }, `ellipsis-${c}`) : /* @__PURE__ */ i(
|
|
517
666
|
"button",
|
|
518
667
|
{
|
|
519
|
-
className: `bt-pagination-btn ${e ===
|
|
520
|
-
onClick: () =>
|
|
521
|
-
"aria-label": `${N.page} ${
|
|
522
|
-
"aria-current": e ===
|
|
668
|
+
className: `bt-pagination-btn ${e === d ? "bt-active" : ""}`,
|
|
669
|
+
onClick: () => s(d),
|
|
670
|
+
"aria-label": `${N.page} ${d}`,
|
|
671
|
+
"aria-current": e === d ? "page" : void 0,
|
|
523
672
|
type: "button",
|
|
524
|
-
children:
|
|
673
|
+
children: d
|
|
525
674
|
},
|
|
526
|
-
|
|
675
|
+
d
|
|
527
676
|
)) }),
|
|
528
|
-
/* @__PURE__ */
|
|
677
|
+
/* @__PURE__ */ i(
|
|
529
678
|
"button",
|
|
530
679
|
{
|
|
531
680
|
className: "bt-pagination-btn",
|
|
532
|
-
onClick:
|
|
533
|
-
disabled: !
|
|
681
|
+
onClick: a,
|
|
682
|
+
disabled: !o,
|
|
534
683
|
"aria-label": "Next page",
|
|
535
684
|
type: "button",
|
|
536
685
|
children: "→"
|
|
@@ -541,15 +690,15 @@ function nt() {
|
|
|
541
690
|
N.page,
|
|
542
691
|
":"
|
|
543
692
|
] }),
|
|
544
|
-
/* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ i(
|
|
545
694
|
"input",
|
|
546
695
|
{
|
|
547
696
|
type: "number",
|
|
548
697
|
className: "bt-quick-jumper-input",
|
|
549
698
|
min: 1,
|
|
550
|
-
max:
|
|
699
|
+
max: l,
|
|
551
700
|
defaultValue: e,
|
|
552
|
-
onKeyDown:
|
|
701
|
+
onKeyDown: T,
|
|
553
702
|
"aria-label": "Jump to page"
|
|
554
703
|
}
|
|
555
704
|
)
|
|
@@ -557,504 +706,504 @@ function nt() {
|
|
|
557
706
|
] })
|
|
558
707
|
] }) : null;
|
|
559
708
|
}
|
|
560
|
-
function
|
|
709
|
+
function dt() {
|
|
561
710
|
const {
|
|
562
711
|
searchable: e,
|
|
563
|
-
searchValue:
|
|
564
|
-
handleSearch:
|
|
565
|
-
clearSearch:
|
|
566
|
-
globalActions:
|
|
567
|
-
selectedRows:
|
|
568
|
-
selectedCount:
|
|
569
|
-
deselectAll:
|
|
570
|
-
data:
|
|
571
|
-
locale:
|
|
572
|
-
classNames:
|
|
573
|
-
selectable:
|
|
574
|
-
} =
|
|
575
|
-
(
|
|
576
|
-
|
|
712
|
+
searchValue: t,
|
|
713
|
+
handleSearch: l,
|
|
714
|
+
clearSearch: n,
|
|
715
|
+
globalActions: s,
|
|
716
|
+
selectedRows: a,
|
|
717
|
+
selectedCount: r,
|
|
718
|
+
deselectAll: b,
|
|
719
|
+
data: o,
|
|
720
|
+
locale: h,
|
|
721
|
+
classNames: f,
|
|
722
|
+
selectable: S
|
|
723
|
+
} = w(), p = m(
|
|
724
|
+
(v) => {
|
|
725
|
+
l(v.target.value);
|
|
577
726
|
},
|
|
578
|
-
[
|
|
727
|
+
[l]
|
|
579
728
|
);
|
|
580
|
-
return e ||
|
|
729
|
+
return e || s && s.length > 0 || S && r > 0 ? /* @__PURE__ */ y("div", { className: `bt-toolbar ${f.toolbar || ""}`, children: [
|
|
581
730
|
/* @__PURE__ */ y("div", { className: "bt-toolbar-left", children: [
|
|
582
731
|
e && /* @__PURE__ */ y("div", { className: "bt-search", children: [
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
/* @__PURE__ */
|
|
732
|
+
/* @__PURE__ */ i("span", { className: "bt-search-icon", children: "🔍" }),
|
|
733
|
+
/* @__PURE__ */ i(
|
|
585
734
|
"input",
|
|
586
735
|
{
|
|
587
736
|
type: "text",
|
|
588
737
|
className: "bt-search-input",
|
|
589
|
-
placeholder:
|
|
590
|
-
value:
|
|
591
|
-
onChange:
|
|
592
|
-
"aria-label":
|
|
738
|
+
placeholder: h.searchPlaceholder,
|
|
739
|
+
value: t,
|
|
740
|
+
onChange: p,
|
|
741
|
+
"aria-label": h.search
|
|
593
742
|
}
|
|
594
743
|
),
|
|
595
|
-
|
|
744
|
+
t && /* @__PURE__ */ i(
|
|
596
745
|
"button",
|
|
597
746
|
{
|
|
598
747
|
className: "bt-search-clear",
|
|
599
|
-
onClick:
|
|
748
|
+
onClick: n,
|
|
600
749
|
"aria-label": "Clear search",
|
|
601
750
|
type: "button",
|
|
602
751
|
children: "✕"
|
|
603
752
|
}
|
|
604
753
|
)
|
|
605
754
|
] }),
|
|
606
|
-
|
|
755
|
+
S && r > 0 && /* @__PURE__ */ y("div", { className: "bt-selection-info", children: [
|
|
607
756
|
/* @__PURE__ */ y("span", { children: [
|
|
608
|
-
|
|
757
|
+
r,
|
|
609
758
|
" ",
|
|
610
|
-
|
|
759
|
+
h.selected
|
|
611
760
|
] }),
|
|
612
|
-
/* @__PURE__ */
|
|
761
|
+
/* @__PURE__ */ i(
|
|
613
762
|
"button",
|
|
614
763
|
{
|
|
615
764
|
className: "bt-selection-clear",
|
|
616
|
-
onClick:
|
|
765
|
+
onClick: b,
|
|
617
766
|
type: "button",
|
|
618
|
-
children:
|
|
767
|
+
children: h.deselectAll
|
|
619
768
|
}
|
|
620
769
|
)
|
|
621
770
|
] })
|
|
622
771
|
] }),
|
|
623
|
-
|
|
624
|
-
const N =
|
|
772
|
+
s && s.length > 0 && /* @__PURE__ */ i("div", { className: "bt-toolbar-right", children: /* @__PURE__ */ i("div", { className: "bt-global-actions", children: s.map((v) => {
|
|
773
|
+
const N = v.requiresSelection && a.length === 0;
|
|
625
774
|
return /* @__PURE__ */ y(
|
|
626
775
|
"button",
|
|
627
776
|
{
|
|
628
|
-
className:
|
|
777
|
+
className: P(
|
|
629
778
|
"bt-global-btn",
|
|
630
|
-
|
|
779
|
+
v.variant && `bt-variant-${v.variant}`
|
|
631
780
|
),
|
|
632
|
-
onClick: () =>
|
|
781
|
+
onClick: () => v.onClick(a, o),
|
|
633
782
|
disabled: N,
|
|
634
|
-
title:
|
|
783
|
+
title: v.label,
|
|
635
784
|
type: "button",
|
|
636
785
|
children: [
|
|
637
|
-
|
|
638
|
-
/* @__PURE__ */
|
|
786
|
+
v.icon && /* @__PURE__ */ i("span", { className: "bt-global-icon", children: v.icon }),
|
|
787
|
+
/* @__PURE__ */ i("span", { children: v.label })
|
|
639
788
|
]
|
|
640
789
|
},
|
|
641
|
-
|
|
790
|
+
v.id
|
|
642
791
|
);
|
|
643
792
|
}) }) })
|
|
644
793
|
] }) : null;
|
|
645
794
|
}
|
|
646
|
-
const
|
|
647
|
-
function
|
|
648
|
-
const { locale: e, emptyComponent:
|
|
649
|
-
return
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
795
|
+
const bt = dt;
|
|
796
|
+
function ht() {
|
|
797
|
+
const { locale: e, emptyComponent: t, columns: l, selectable: n, rowActions: s } = w(), a = l.filter((o) => !o.hidden), r = s && s.length > 0, b = a.length + (n ? 1 : 0) + (r ? 1 : 0);
|
|
798
|
+
return t ? /* @__PURE__ */ i("tbody", { className: "bt-tbody", children: /* @__PURE__ */ i("tr", { className: "bt-tr", children: /* @__PURE__ */ i("td", { className: "bt-td", colSpan: b, children: t }) }) }) : /* @__PURE__ */ i("tbody", { className: "bt-tbody", children: /* @__PURE__ */ i("tr", { className: "bt-tr", children: /* @__PURE__ */ i("td", { className: "bt-td", colSpan: b, children: /* @__PURE__ */ y("div", { className: "bt-empty", children: [
|
|
799
|
+
/* @__PURE__ */ i("div", { className: "bt-empty-icon", children: "📭" }),
|
|
800
|
+
/* @__PURE__ */ i("div", { className: "bt-empty-text", children: e.noData })
|
|
652
801
|
] }) }) }) });
|
|
653
802
|
}
|
|
654
|
-
function
|
|
655
|
-
const { loadingComponent:
|
|
656
|
-
return e ? /* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
803
|
+
function ut({ show: e }) {
|
|
804
|
+
const { loadingComponent: t, locale: l } = w();
|
|
805
|
+
return e ? /* @__PURE__ */ i("div", { className: "bt-loading-overlay", role: "status", "aria-live": "polite", children: t || /* @__PURE__ */ y(Fe, { children: [
|
|
806
|
+
/* @__PURE__ */ i("div", { className: "bt-loading-spinner", "aria-hidden": "true" }),
|
|
807
|
+
/* @__PURE__ */ i("span", { className: "bt-loading-text", children: l.loading })
|
|
659
808
|
] }) }) : null;
|
|
660
809
|
}
|
|
661
|
-
function
|
|
662
|
-
const { isModalOpen: e, modalContent:
|
|
663
|
-
(
|
|
664
|
-
|
|
810
|
+
function ft() {
|
|
811
|
+
const { isModalOpen: e, modalContent: t, closeModal: l } = w(), n = m(
|
|
812
|
+
(a) => {
|
|
813
|
+
a.target === a.currentTarget && l();
|
|
665
814
|
},
|
|
666
|
-
[
|
|
667
|
-
),
|
|
668
|
-
(
|
|
669
|
-
|
|
815
|
+
[l]
|
|
816
|
+
), s = m(
|
|
817
|
+
(a) => {
|
|
818
|
+
a.key === "Escape" && l();
|
|
670
819
|
},
|
|
671
|
-
[
|
|
820
|
+
[l]
|
|
672
821
|
);
|
|
673
|
-
return
|
|
674
|
-
document.removeEventListener("keydown",
|
|
675
|
-
}), [e,
|
|
822
|
+
return Oe(() => (e && (document.addEventListener("keydown", s), document.body.style.overflow = "hidden"), () => {
|
|
823
|
+
document.removeEventListener("keydown", s), document.body.style.overflow = "";
|
|
824
|
+
}), [e, s]), !e || !t ? null : /* @__PURE__ */ i(
|
|
676
825
|
"div",
|
|
677
826
|
{
|
|
678
827
|
className: "bt-modal-backdrop",
|
|
679
|
-
onClick:
|
|
828
|
+
onClick: n,
|
|
680
829
|
role: "dialog",
|
|
681
830
|
"aria-modal": "true",
|
|
682
831
|
children: /* @__PURE__ */ y("div", { className: "bt-modal bt-modal-md", children: [
|
|
683
832
|
/* @__PURE__ */ y("div", { className: "bt-modal-header", children: [
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ i("h2", { className: "bt-modal-title", children: "Detalles" }),
|
|
834
|
+
/* @__PURE__ */ i(
|
|
686
835
|
"button",
|
|
687
836
|
{
|
|
688
837
|
className: "bt-modal-close",
|
|
689
|
-
onClick:
|
|
838
|
+
onClick: l,
|
|
690
839
|
"aria-label": "Close modal",
|
|
691
840
|
type: "button",
|
|
692
841
|
children: "✕"
|
|
693
842
|
}
|
|
694
843
|
)
|
|
695
844
|
] }),
|
|
696
|
-
/* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ i("div", { className: "bt-modal-body", children: t })
|
|
697
846
|
] })
|
|
698
847
|
}
|
|
699
848
|
);
|
|
700
849
|
}
|
|
701
|
-
function
|
|
850
|
+
function pt({
|
|
702
851
|
data: e,
|
|
703
|
-
initialSort:
|
|
704
|
-
controlledSort:
|
|
705
|
-
onSortChange:
|
|
852
|
+
initialSort: t,
|
|
853
|
+
controlledSort: l,
|
|
854
|
+
onSortChange: n
|
|
706
855
|
}) {
|
|
707
|
-
const [
|
|
708
|
-
|
|
709
|
-
),
|
|
710
|
-
(
|
|
711
|
-
const
|
|
712
|
-
columnId:
|
|
713
|
-
direction:
|
|
856
|
+
const [s, a] = z(
|
|
857
|
+
t ?? { columnId: null, direction: "asc" }
|
|
858
|
+
), r = l ?? s, b = m(
|
|
859
|
+
(f) => {
|
|
860
|
+
const S = {
|
|
861
|
+
columnId: f,
|
|
862
|
+
direction: r.columnId === f && r.direction === "asc" ? "desc" : "asc"
|
|
714
863
|
};
|
|
715
|
-
|
|
864
|
+
l || a(S), n?.(S);
|
|
716
865
|
},
|
|
717
|
-
[
|
|
718
|
-
),
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
}, [
|
|
722
|
-
return { sortedData: x(() =>
|
|
866
|
+
[r, l, n]
|
|
867
|
+
), o = m(() => {
|
|
868
|
+
const f = { columnId: null, direction: "asc" };
|
|
869
|
+
l || a(f), n?.(f);
|
|
870
|
+
}, [l, n]);
|
|
871
|
+
return { sortedData: x(() => r.columnId ? Ge(e, r.columnId, r.direction) : e, [e, r]), sortState: r, handleSort: b, clearSort: o };
|
|
723
872
|
}
|
|
724
|
-
function
|
|
873
|
+
function gt({
|
|
725
874
|
data: e,
|
|
726
|
-
columns:
|
|
727
|
-
initialFilters:
|
|
728
|
-
controlledFilters:
|
|
729
|
-
onFilterChange:
|
|
875
|
+
columns: t,
|
|
876
|
+
initialFilters: l,
|
|
877
|
+
controlledFilters: n,
|
|
878
|
+
onFilterChange: s
|
|
730
879
|
}) {
|
|
731
|
-
const [
|
|
732
|
-
|
|
733
|
-
),
|
|
734
|
-
(
|
|
735
|
-
const
|
|
736
|
-
|
|
880
|
+
const [a, r] = z(
|
|
881
|
+
l ?? {}
|
|
882
|
+
), b = n ?? a, o = m(
|
|
883
|
+
(p, u) => {
|
|
884
|
+
const v = { ...b };
|
|
885
|
+
u == null || u === "" ? delete v[p] : v[p] = u, n || r(v), s?.(v);
|
|
737
886
|
},
|
|
738
|
-
[
|
|
739
|
-
),
|
|
740
|
-
(
|
|
741
|
-
const
|
|
742
|
-
delete
|
|
887
|
+
[b, n, s]
|
|
888
|
+
), h = m(
|
|
889
|
+
(p) => {
|
|
890
|
+
const u = { ...b };
|
|
891
|
+
delete u[p], n || r(u), s?.(u);
|
|
743
892
|
},
|
|
744
|
-
[
|
|
745
|
-
),
|
|
746
|
-
|
|
747
|
-
}, [
|
|
748
|
-
return { filteredData: x(() =>
|
|
893
|
+
[b, n, s]
|
|
894
|
+
), f = m(() => {
|
|
895
|
+
n || r({}), s?.({});
|
|
896
|
+
}, [n, s]);
|
|
897
|
+
return { filteredData: x(() => Ue(e, b, t), [e, b, t]), filters: b, setFilter: o, clearFilters: f, clearFilter: h };
|
|
749
898
|
}
|
|
750
|
-
function
|
|
899
|
+
function mt({
|
|
751
900
|
data: e,
|
|
752
|
-
config:
|
|
753
|
-
onPageChange:
|
|
901
|
+
config: t,
|
|
902
|
+
onPageChange: l
|
|
754
903
|
}) {
|
|
755
|
-
const
|
|
756
|
-
(
|
|
757
|
-
const
|
|
758
|
-
|
|
904
|
+
const n = t !== !1, s = t && typeof t == "object" ? t.page ?? 1 : 1, a = t && typeof t == "object" ? t.pageSize ?? 10 : 10, r = t && typeof t == "object" ? t.totalItems : void 0, [b, o] = z(s), [h, f] = z(a), S = r ?? e.length, p = Math.max(1, Math.ceil(S / h)), u = m(
|
|
905
|
+
(d) => {
|
|
906
|
+
const c = Math.max(1, Math.min(d, p));
|
|
907
|
+
o(c), l?.(c, h);
|
|
759
908
|
},
|
|
760
|
-
[
|
|
761
|
-
),
|
|
762
|
-
|
|
763
|
-
}, [
|
|
764
|
-
|
|
765
|
-
}, [
|
|
766
|
-
(
|
|
767
|
-
|
|
909
|
+
[p, h, l]
|
|
910
|
+
), v = m(() => {
|
|
911
|
+
b < p && u(b + 1);
|
|
912
|
+
}, [b, p, u]), N = m(() => {
|
|
913
|
+
b > 1 && u(b - 1);
|
|
914
|
+
}, [b, u]), D = m(
|
|
915
|
+
(d) => {
|
|
916
|
+
f(d), o(1), l?.(1, d);
|
|
768
917
|
},
|
|
769
|
-
[
|
|
918
|
+
[l]
|
|
770
919
|
), $ = x(() => {
|
|
771
|
-
if (!
|
|
920
|
+
if (!n || r !== void 0)
|
|
772
921
|
return e;
|
|
773
|
-
const
|
|
774
|
-
return e.slice(
|
|
775
|
-
}, [e,
|
|
922
|
+
const d = (b - 1) * h;
|
|
923
|
+
return e.slice(d, d + h);
|
|
924
|
+
}, [e, b, h, n, r]), T = (b - 1) * h + 1, k = Math.min(b * h, S);
|
|
776
925
|
return {
|
|
777
926
|
paginatedData: $,
|
|
778
|
-
page:
|
|
779
|
-
pageSize:
|
|
780
|
-
totalPages:
|
|
781
|
-
totalItems:
|
|
782
|
-
goToPage:
|
|
783
|
-
nextPage:
|
|
927
|
+
page: b,
|
|
928
|
+
pageSize: h,
|
|
929
|
+
totalPages: p,
|
|
930
|
+
totalItems: S,
|
|
931
|
+
goToPage: u,
|
|
932
|
+
nextPage: v,
|
|
784
933
|
prevPage: N,
|
|
785
|
-
changePageSize:
|
|
786
|
-
hasNextPage:
|
|
787
|
-
hasPrevPage:
|
|
788
|
-
startIndex:
|
|
789
|
-
endIndex:
|
|
934
|
+
changePageSize: D,
|
|
935
|
+
hasNextPage: b < p,
|
|
936
|
+
hasPrevPage: b > 1,
|
|
937
|
+
startIndex: T,
|
|
938
|
+
endIndex: k
|
|
790
939
|
};
|
|
791
940
|
}
|
|
792
|
-
function
|
|
941
|
+
function vt({
|
|
793
942
|
data: e,
|
|
794
|
-
rowKey:
|
|
795
|
-
mode:
|
|
796
|
-
initialSelection:
|
|
797
|
-
controlledSelection:
|
|
798
|
-
onSelectionChange:
|
|
943
|
+
rowKey: t,
|
|
944
|
+
mode: l = "multiple",
|
|
945
|
+
initialSelection: n,
|
|
946
|
+
controlledSelection: s,
|
|
947
|
+
onSelectionChange: a
|
|
799
948
|
}) {
|
|
800
|
-
const [
|
|
801
|
-
|
|
802
|
-
),
|
|
803
|
-
(
|
|
804
|
-
[
|
|
805
|
-
),
|
|
806
|
-
(
|
|
807
|
-
const
|
|
808
|
-
return
|
|
949
|
+
const [r, b] = z(
|
|
950
|
+
n ?? []
|
|
951
|
+
), o = s ?? r, h = m(
|
|
952
|
+
(d, c) => typeof t == "function" ? t(d, c) : String(d[t]),
|
|
953
|
+
[t]
|
|
954
|
+
), f = x(() => new Set(o.map((d, c) => h(d, c))), [o, h]), S = m(
|
|
955
|
+
(d, c) => {
|
|
956
|
+
const g = h(d, c);
|
|
957
|
+
return f.has(g);
|
|
809
958
|
},
|
|
810
|
-
[
|
|
811
|
-
),
|
|
812
|
-
(
|
|
813
|
-
|
|
959
|
+
[h, f]
|
|
960
|
+
), p = m(
|
|
961
|
+
(d) => {
|
|
962
|
+
s || b(d), a?.(d);
|
|
814
963
|
},
|
|
815
|
-
[
|
|
816
|
-
),
|
|
817
|
-
(
|
|
818
|
-
const
|
|
819
|
-
let
|
|
820
|
-
|
|
964
|
+
[s, a]
|
|
965
|
+
), u = m(
|
|
966
|
+
(d, c) => {
|
|
967
|
+
const g = h(d, c);
|
|
968
|
+
let C;
|
|
969
|
+
l === "single" ? C = f.has(g) ? [] : [d] : f.has(g) ? C = o.filter((A, L) => h(A, L) !== g) : C = [...o, d], p(C);
|
|
821
970
|
},
|
|
822
|
-
[
|
|
823
|
-
),
|
|
824
|
-
(
|
|
825
|
-
if (!
|
|
826
|
-
const
|
|
827
|
-
|
|
971
|
+
[l, f, o, h, p]
|
|
972
|
+
), v = m(
|
|
973
|
+
(d, c) => {
|
|
974
|
+
if (!S(d, c)) {
|
|
975
|
+
const g = l === "single" ? [d] : [...o, d];
|
|
976
|
+
p(g);
|
|
828
977
|
}
|
|
829
978
|
},
|
|
830
|
-
[
|
|
979
|
+
[S, l, o, p]
|
|
831
980
|
), N = m(
|
|
832
|
-
(
|
|
833
|
-
const
|
|
834
|
-
(A,
|
|
981
|
+
(d, c) => {
|
|
982
|
+
const g = h(d, c), C = o.filter(
|
|
983
|
+
(A, L) => h(A, L) !== g
|
|
835
984
|
);
|
|
836
|
-
|
|
985
|
+
p(C);
|
|
837
986
|
},
|
|
838
|
-
[
|
|
839
|
-
),
|
|
840
|
-
|
|
841
|
-
}, [e,
|
|
842
|
-
|
|
843
|
-
}, [
|
|
987
|
+
[o, h, p]
|
|
988
|
+
), D = m(() => {
|
|
989
|
+
l === "multiple" && p([...e]);
|
|
990
|
+
}, [e, l, p]), $ = m(() => {
|
|
991
|
+
p([]);
|
|
992
|
+
}, [p]), T = e.length > 0 && o.length === e.length, k = o.length > 0 && o.length < e.length;
|
|
844
993
|
return {
|
|
845
|
-
selectedRows:
|
|
846
|
-
isSelected:
|
|
847
|
-
toggleRow:
|
|
848
|
-
selectRow:
|
|
994
|
+
selectedRows: o,
|
|
995
|
+
isSelected: S,
|
|
996
|
+
toggleRow: u,
|
|
997
|
+
selectRow: v,
|
|
849
998
|
deselectRow: N,
|
|
850
|
-
selectAll:
|
|
999
|
+
selectAll: D,
|
|
851
1000
|
deselectAll: $,
|
|
852
|
-
isAllSelected:
|
|
853
|
-
isPartiallySelected:
|
|
854
|
-
selectedCount:
|
|
1001
|
+
isAllSelected: T,
|
|
1002
|
+
isPartiallySelected: k,
|
|
1003
|
+
selectedCount: o.length
|
|
855
1004
|
};
|
|
856
1005
|
}
|
|
857
|
-
function
|
|
1006
|
+
function yt({
|
|
858
1007
|
data: e,
|
|
859
|
-
columns:
|
|
860
|
-
searchColumns:
|
|
861
|
-
initialValue:
|
|
862
|
-
controlledValue:
|
|
863
|
-
onSearchChange:
|
|
1008
|
+
columns: t,
|
|
1009
|
+
searchColumns: l,
|
|
1010
|
+
initialValue: n,
|
|
1011
|
+
controlledValue: s,
|
|
1012
|
+
onSearchChange: a
|
|
864
1013
|
}) {
|
|
865
|
-
const [
|
|
866
|
-
(
|
|
867
|
-
|
|
1014
|
+
const [r, b] = z(n ?? ""), o = s ?? r, h = m(
|
|
1015
|
+
(p) => {
|
|
1016
|
+
s === void 0 && b(p), a?.(p);
|
|
868
1017
|
},
|
|
869
|
-
[
|
|
870
|
-
),
|
|
871
|
-
|
|
872
|
-
}, [
|
|
873
|
-
return { searchedData: x(() =>
|
|
1018
|
+
[s, a]
|
|
1019
|
+
), f = m(() => {
|
|
1020
|
+
s === void 0 && b(""), a?.("");
|
|
1021
|
+
}, [s, a]);
|
|
1022
|
+
return { searchedData: x(() => We(e, o, t, l), [e, o, t, l]), searchValue: o, handleSearch: h, clearSearch: f };
|
|
874
1023
|
}
|
|
875
|
-
function
|
|
1024
|
+
function St(e) {
|
|
876
1025
|
const {
|
|
877
1026
|
// Data
|
|
878
|
-
data:
|
|
879
|
-
columns:
|
|
880
|
-
rowKey:
|
|
1027
|
+
data: t,
|
|
1028
|
+
columns: l,
|
|
1029
|
+
rowKey: n = "id",
|
|
881
1030
|
// Actions
|
|
882
|
-
rowActions:
|
|
883
|
-
globalActions:
|
|
1031
|
+
rowActions: s,
|
|
1032
|
+
globalActions: a,
|
|
884
1033
|
// Pagination
|
|
885
|
-
pagination:
|
|
886
|
-
onPageChange:
|
|
1034
|
+
pagination: r = { pageSize: 10 },
|
|
1035
|
+
onPageChange: b,
|
|
887
1036
|
// Sort
|
|
888
|
-
sort:
|
|
889
|
-
onSortChange:
|
|
1037
|
+
sort: o,
|
|
1038
|
+
onSortChange: h,
|
|
890
1039
|
// Filter
|
|
891
|
-
filters:
|
|
892
|
-
onFilterChange:
|
|
1040
|
+
filters: f,
|
|
1041
|
+
onFilterChange: S,
|
|
893
1042
|
// Search
|
|
894
|
-
searchable:
|
|
895
|
-
searchValue:
|
|
896
|
-
onSearchChange:
|
|
1043
|
+
searchable: p = !1,
|
|
1044
|
+
searchValue: u,
|
|
1045
|
+
onSearchChange: v,
|
|
897
1046
|
searchColumns: N,
|
|
898
1047
|
// Selection - now auto-inferred if not explicitly set
|
|
899
|
-
selectable:
|
|
1048
|
+
selectable: D,
|
|
900
1049
|
selectedRows: $,
|
|
901
|
-
onSelectionChange:
|
|
902
|
-
selectionMode:
|
|
1050
|
+
onSelectionChange: T,
|
|
1051
|
+
selectionMode: k = "multiple",
|
|
903
1052
|
// States
|
|
904
|
-
loading:
|
|
905
|
-
loadingComponent:
|
|
906
|
-
emptyComponent:
|
|
1053
|
+
loading: d = !1,
|
|
1054
|
+
loadingComponent: c,
|
|
1055
|
+
emptyComponent: g,
|
|
907
1056
|
// Styling
|
|
908
|
-
classNames:
|
|
1057
|
+
classNames: C = {},
|
|
909
1058
|
styles: A = {},
|
|
910
|
-
locale:
|
|
911
|
-
stickyHeader:
|
|
912
|
-
maxHeight:
|
|
913
|
-
bordered:
|
|
914
|
-
striped:
|
|
915
|
-
hoverable:
|
|
916
|
-
size:
|
|
1059
|
+
locale: L,
|
|
1060
|
+
stickyHeader: V = !1,
|
|
1061
|
+
maxHeight: Re,
|
|
1062
|
+
bordered: B = !1,
|
|
1063
|
+
striped: j = !1,
|
|
1064
|
+
hoverable: E = !0,
|
|
1065
|
+
size: K = "medium",
|
|
917
1066
|
// Callbacks
|
|
918
|
-
onRowClick:
|
|
1067
|
+
onRowClick: H,
|
|
919
1068
|
onRowDoubleClick: q,
|
|
920
1069
|
// Accessibility
|
|
921
|
-
ariaLabel:
|
|
1070
|
+
ariaLabel: ze,
|
|
922
1071
|
ariaDescribedBy: Me
|
|
923
|
-
} = e,
|
|
1072
|
+
} = e, _ = x(() => D !== void 0 ? D : a?.some(
|
|
924
1073
|
(je) => je.requiresSelection
|
|
925
|
-
)
|
|
926
|
-
() => ({ ...Ve, ...
|
|
927
|
-
[
|
|
928
|
-
), [Q, G] =
|
|
929
|
-
W(
|
|
1074
|
+
) || T !== void 0, [D, a, T]), J = x(
|
|
1075
|
+
() => ({ ...Ve, ...L }),
|
|
1076
|
+
[L]
|
|
1077
|
+
), [Q, G] = z(!1), [U, W] = z(null), X = m((we) => {
|
|
1078
|
+
W(we), G(!0);
|
|
930
1079
|
}, []), Y = m(() => {
|
|
931
1080
|
G(!1), W(null);
|
|
932
|
-
}, []),
|
|
1081
|
+
}, []), R = x(() => r === !1 ? !1 : {
|
|
933
1082
|
pageSize: 10,
|
|
934
1083
|
pageSizeOptions: [10, 20, 50, 100],
|
|
935
1084
|
showSizeChanger: !1,
|
|
936
|
-
...
|
|
937
|
-
}, [
|
|
938
|
-
searchedData:
|
|
1085
|
+
...r
|
|
1086
|
+
}, [r]), {
|
|
1087
|
+
searchedData: Le,
|
|
939
1088
|
searchValue: Z,
|
|
940
|
-
handleSearch:
|
|
941
|
-
clearSearch:
|
|
942
|
-
} =
|
|
943
|
-
data:
|
|
944
|
-
columns:
|
|
1089
|
+
handleSearch: ee,
|
|
1090
|
+
clearSearch: te
|
|
1091
|
+
} = yt({
|
|
1092
|
+
data: t,
|
|
1093
|
+
columns: l,
|
|
945
1094
|
searchColumns: N,
|
|
946
|
-
controlledValue:
|
|
947
|
-
onSearchChange:
|
|
1095
|
+
controlledValue: u,
|
|
1096
|
+
onSearchChange: v
|
|
948
1097
|
}), {
|
|
949
|
-
filteredData:
|
|
950
|
-
filters:
|
|
951
|
-
setFilter:
|
|
1098
|
+
filteredData: Ie,
|
|
1099
|
+
filters: ae,
|
|
1100
|
+
setFilter: ne,
|
|
952
1101
|
clearFilters: le
|
|
953
|
-
} =
|
|
954
|
-
data:
|
|
955
|
-
columns:
|
|
956
|
-
controlledFilters:
|
|
957
|
-
onFilterChange:
|
|
958
|
-
}), { sortedData: se, sortState:
|
|
959
|
-
data:
|
|
960
|
-
controlledSort:
|
|
961
|
-
onSortChange:
|
|
1102
|
+
} = gt({
|
|
1103
|
+
data: Le,
|
|
1104
|
+
columns: l,
|
|
1105
|
+
controlledFilters: f,
|
|
1106
|
+
onFilterChange: S
|
|
1107
|
+
}), { sortedData: se, sortState: re, handleSort: ie } = pt({
|
|
1108
|
+
data: Ie,
|
|
1109
|
+
controlledSort: o,
|
|
1110
|
+
onSortChange: h
|
|
962
1111
|
}), {
|
|
963
|
-
selectedRows:
|
|
964
|
-
isSelected:
|
|
965
|
-
toggleRow:
|
|
966
|
-
selectAll:
|
|
967
|
-
deselectAll:
|
|
1112
|
+
selectedRows: ce,
|
|
1113
|
+
isSelected: oe,
|
|
1114
|
+
toggleRow: de,
|
|
1115
|
+
selectAll: be,
|
|
1116
|
+
deselectAll: he,
|
|
968
1117
|
isAllSelected: ue,
|
|
969
1118
|
isPartiallySelected: fe,
|
|
970
|
-
selectedCount:
|
|
971
|
-
} =
|
|
1119
|
+
selectedCount: pe
|
|
1120
|
+
} = vt({
|
|
972
1121
|
data: se,
|
|
973
|
-
rowKey:
|
|
974
|
-
mode:
|
|
1122
|
+
rowKey: n,
|
|
1123
|
+
mode: k,
|
|
975
1124
|
controlledSelection: $,
|
|
976
|
-
onSelectionChange:
|
|
1125
|
+
onSelectionChange: T
|
|
977
1126
|
}), {
|
|
978
|
-
paginatedData:
|
|
979
|
-
page:
|
|
1127
|
+
paginatedData: O,
|
|
1128
|
+
page: ge,
|
|
980
1129
|
pageSize: me,
|
|
981
|
-
totalPages:
|
|
982
|
-
totalItems:
|
|
983
|
-
goToPage:
|
|
984
|
-
nextPage:
|
|
985
|
-
prevPage:
|
|
1130
|
+
totalPages: ve,
|
|
1131
|
+
totalItems: ye,
|
|
1132
|
+
goToPage: Se,
|
|
1133
|
+
nextPage: Ce,
|
|
1134
|
+
prevPage: Ne,
|
|
986
1135
|
changePageSize: ke,
|
|
987
1136
|
hasNextPage: De,
|
|
988
|
-
hasPrevPage:
|
|
989
|
-
startIndex:
|
|
990
|
-
endIndex:
|
|
991
|
-
} =
|
|
1137
|
+
hasPrevPage: Pe,
|
|
1138
|
+
startIndex: Te,
|
|
1139
|
+
endIndex: Ae
|
|
1140
|
+
} = mt({
|
|
992
1141
|
data: se,
|
|
993
|
-
config:
|
|
994
|
-
onPageChange:
|
|
995
|
-
}),
|
|
1142
|
+
config: R,
|
|
1143
|
+
onPageChange: b
|
|
1144
|
+
}), Be = x(
|
|
996
1145
|
() => ({
|
|
997
1146
|
// Data
|
|
998
|
-
data:
|
|
999
|
-
processedData:
|
|
1000
|
-
columns:
|
|
1001
|
-
rowKey:
|
|
1147
|
+
data: t,
|
|
1148
|
+
processedData: O,
|
|
1149
|
+
columns: l,
|
|
1150
|
+
rowKey: n,
|
|
1002
1151
|
// Actions
|
|
1003
|
-
rowActions:
|
|
1004
|
-
globalActions:
|
|
1152
|
+
rowActions: s,
|
|
1153
|
+
globalActions: a,
|
|
1005
1154
|
// Sort
|
|
1006
|
-
sortState:
|
|
1155
|
+
sortState: re,
|
|
1007
1156
|
handleSort: ie,
|
|
1008
1157
|
// Filter
|
|
1009
|
-
filters:
|
|
1010
|
-
setFilter:
|
|
1158
|
+
filters: ae,
|
|
1159
|
+
setFilter: ne,
|
|
1011
1160
|
clearFilters: le,
|
|
1012
1161
|
// Search
|
|
1013
1162
|
searchValue: Z,
|
|
1014
|
-
handleSearch:
|
|
1015
|
-
clearSearch:
|
|
1016
|
-
searchable:
|
|
1163
|
+
handleSearch: ee,
|
|
1164
|
+
clearSearch: te,
|
|
1165
|
+
searchable: p,
|
|
1017
1166
|
// Selection
|
|
1018
|
-
selectedRows:
|
|
1019
|
-
isSelected:
|
|
1020
|
-
toggleRow:
|
|
1021
|
-
selectAll:
|
|
1022
|
-
deselectAll:
|
|
1167
|
+
selectedRows: ce,
|
|
1168
|
+
isSelected: oe,
|
|
1169
|
+
toggleRow: de,
|
|
1170
|
+
selectAll: be,
|
|
1171
|
+
deselectAll: he,
|
|
1023
1172
|
isAllSelected: ue,
|
|
1024
1173
|
isPartiallySelected: fe,
|
|
1025
|
-
selectable:
|
|
1026
|
-
selectionMode:
|
|
1027
|
-
selectedCount:
|
|
1174
|
+
selectable: _,
|
|
1175
|
+
selectionMode: k,
|
|
1176
|
+
selectedCount: pe,
|
|
1028
1177
|
// Pagination
|
|
1029
|
-
page:
|
|
1178
|
+
page: ge,
|
|
1030
1179
|
pageSize: me,
|
|
1031
|
-
totalPages:
|
|
1032
|
-
totalItems:
|
|
1033
|
-
goToPage:
|
|
1034
|
-
nextPage:
|
|
1035
|
-
prevPage:
|
|
1180
|
+
totalPages: ve,
|
|
1181
|
+
totalItems: ye,
|
|
1182
|
+
goToPage: Se,
|
|
1183
|
+
nextPage: Ce,
|
|
1184
|
+
prevPage: Ne,
|
|
1036
1185
|
changePageSize: ke,
|
|
1037
1186
|
hasNextPage: De,
|
|
1038
|
-
hasPrevPage:
|
|
1039
|
-
startIndex:
|
|
1040
|
-
endIndex:
|
|
1041
|
-
paginationEnabled:
|
|
1042
|
-
pageSizeOptions:
|
|
1043
|
-
showSizeChanger:
|
|
1187
|
+
hasPrevPage: Pe,
|
|
1188
|
+
startIndex: Te,
|
|
1189
|
+
endIndex: Ae,
|
|
1190
|
+
paginationEnabled: r !== !1,
|
|
1191
|
+
pageSizeOptions: R && typeof R == "object" ? R.pageSizeOptions ?? [10, 20, 50, 100] : [10, 20, 50, 100],
|
|
1192
|
+
showSizeChanger: R && typeof R == "object" ? R.showSizeChanger ?? !1 : !1,
|
|
1044
1193
|
// UI State
|
|
1045
|
-
loading:
|
|
1046
|
-
loadingComponent:
|
|
1047
|
-
emptyComponent:
|
|
1194
|
+
loading: d,
|
|
1195
|
+
loadingComponent: c,
|
|
1196
|
+
emptyComponent: g,
|
|
1048
1197
|
// Styling
|
|
1049
|
-
locale:
|
|
1050
|
-
classNames:
|
|
1051
|
-
size:
|
|
1052
|
-
bordered:
|
|
1053
|
-
striped:
|
|
1054
|
-
hoverable:
|
|
1055
|
-
stickyHeader:
|
|
1198
|
+
locale: J,
|
|
1199
|
+
classNames: C,
|
|
1200
|
+
size: K,
|
|
1201
|
+
bordered: B,
|
|
1202
|
+
striped: j,
|
|
1203
|
+
hoverable: E,
|
|
1204
|
+
stickyHeader: V,
|
|
1056
1205
|
// Callbacks
|
|
1057
|
-
onRowClick:
|
|
1206
|
+
onRowClick: H,
|
|
1058
1207
|
onRowDoubleClick: q,
|
|
1059
1208
|
// Modal
|
|
1060
1209
|
openModal: X,
|
|
@@ -1063,120 +1212,124 @@ function mt(e) {
|
|
|
1063
1212
|
isModalOpen: Q
|
|
1064
1213
|
}),
|
|
1065
1214
|
[
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
a,
|
|
1215
|
+
t,
|
|
1216
|
+
O,
|
|
1069
1217
|
l,
|
|
1070
1218
|
n,
|
|
1071
|
-
|
|
1072
|
-
|
|
1219
|
+
s,
|
|
1220
|
+
a,
|
|
1221
|
+
re,
|
|
1073
1222
|
ie,
|
|
1074
|
-
te,
|
|
1075
1223
|
ae,
|
|
1224
|
+
ne,
|
|
1076
1225
|
le,
|
|
1077
1226
|
Z,
|
|
1078
|
-
F,
|
|
1079
1227
|
ee,
|
|
1080
|
-
|
|
1081
|
-
|
|
1228
|
+
te,
|
|
1229
|
+
p,
|
|
1082
1230
|
ce,
|
|
1083
1231
|
oe,
|
|
1084
1232
|
de,
|
|
1085
1233
|
be,
|
|
1234
|
+
he,
|
|
1086
1235
|
ue,
|
|
1087
1236
|
fe,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
he,
|
|
1237
|
+
_,
|
|
1238
|
+
k,
|
|
1091
1239
|
pe,
|
|
1092
|
-
me,
|
|
1093
1240
|
ge,
|
|
1241
|
+
me,
|
|
1094
1242
|
ve,
|
|
1095
1243
|
ye,
|
|
1096
|
-
Ne,
|
|
1097
1244
|
Se,
|
|
1245
|
+
Ce,
|
|
1246
|
+
Ne,
|
|
1098
1247
|
ke,
|
|
1099
1248
|
De,
|
|
1100
|
-
Te,
|
|
1101
1249
|
Pe,
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1250
|
+
Te,
|
|
1251
|
+
Ae,
|
|
1252
|
+
r,
|
|
1253
|
+
R,
|
|
1254
|
+
d,
|
|
1105
1255
|
c,
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
D,
|
|
1110
|
-
j,
|
|
1111
|
-
L,
|
|
1256
|
+
g,
|
|
1257
|
+
J,
|
|
1258
|
+
C,
|
|
1112
1259
|
K,
|
|
1113
|
-
|
|
1114
|
-
|
|
1260
|
+
B,
|
|
1261
|
+
j,
|
|
1262
|
+
E,
|
|
1115
1263
|
V,
|
|
1264
|
+
H,
|
|
1116
1265
|
q,
|
|
1117
1266
|
X,
|
|
1118
1267
|
Y,
|
|
1119
1268
|
U,
|
|
1120
1269
|
Q
|
|
1121
1270
|
]
|
|
1122
|
-
),
|
|
1123
|
-
return /* @__PURE__ */
|
|
1271
|
+
), F = O.length > 0;
|
|
1272
|
+
return /* @__PURE__ */ i(He, { value: Be, children: /* @__PURE__ */ y(
|
|
1124
1273
|
"div",
|
|
1125
1274
|
{
|
|
1126
|
-
className:
|
|
1275
|
+
className: P(
|
|
1127
1276
|
"bt-container",
|
|
1128
|
-
`bt-size-${
|
|
1129
|
-
|
|
1130
|
-
|
|
1277
|
+
`bt-size-${K}`,
|
|
1278
|
+
j && "bt-striped",
|
|
1279
|
+
B && "bt-bordered",
|
|
1280
|
+
E && "bt-hoverable",
|
|
1281
|
+
d && "bt-container-loading",
|
|
1282
|
+
C.container
|
|
1131
1283
|
),
|
|
1132
1284
|
style: A.container,
|
|
1133
1285
|
children: [
|
|
1134
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ i(bt, {}),
|
|
1135
1287
|
/* @__PURE__ */ y(
|
|
1136
1288
|
"div",
|
|
1137
1289
|
{
|
|
1138
|
-
className:
|
|
1139
|
-
style: { maxHeight:
|
|
1290
|
+
className: "bt-table-wrapper",
|
|
1291
|
+
style: { maxHeight: Re },
|
|
1140
1292
|
children: [
|
|
1141
1293
|
/* @__PURE__ */ y(
|
|
1142
1294
|
"table",
|
|
1143
1295
|
{
|
|
1144
|
-
className:
|
|
1296
|
+
className: P("bt-table", C.table),
|
|
1145
1297
|
style: A.table,
|
|
1146
1298
|
role: "grid",
|
|
1147
|
-
"aria-label":
|
|
1299
|
+
"aria-label": ze,
|
|
1148
1300
|
"aria-describedby": Me,
|
|
1149
|
-
"aria-busy":
|
|
1301
|
+
"aria-busy": d,
|
|
1150
1302
|
children: [
|
|
1151
|
-
/* @__PURE__ */
|
|
1152
|
-
|
|
1303
|
+
/* @__PURE__ */ i(Qe, {}),
|
|
1304
|
+
F ? /* @__PURE__ */ i(lt, {}) : /* @__PURE__ */ i(ht, {})
|
|
1153
1305
|
]
|
|
1154
1306
|
}
|
|
1155
1307
|
),
|
|
1156
|
-
/* @__PURE__ */
|
|
1308
|
+
F && /* @__PURE__ */ i(ct, {}),
|
|
1309
|
+
/* @__PURE__ */ i(ut, { show: d && F })
|
|
1157
1310
|
]
|
|
1158
1311
|
}
|
|
1159
1312
|
),
|
|
1160
|
-
|
|
1161
|
-
/* @__PURE__ */
|
|
1313
|
+
r !== !1 && /* @__PURE__ */ i(ot, {}),
|
|
1314
|
+
/* @__PURE__ */ i(ft, {})
|
|
1162
1315
|
]
|
|
1163
1316
|
}
|
|
1164
1317
|
) });
|
|
1165
1318
|
}
|
|
1166
|
-
const
|
|
1319
|
+
const Pt = St;
|
|
1167
1320
|
export {
|
|
1168
|
-
|
|
1169
|
-
|
|
1321
|
+
Pt as BetterTable,
|
|
1322
|
+
He as TableProvider,
|
|
1170
1323
|
Ve as defaultLocale,
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1324
|
+
Ue as filterData,
|
|
1325
|
+
M as getValueFromPath,
|
|
1326
|
+
We as searchData,
|
|
1327
|
+
Ge as sortData,
|
|
1328
|
+
w as useTableContext,
|
|
1329
|
+
gt as useTableFilter,
|
|
1330
|
+
mt as useTablePagination,
|
|
1331
|
+
yt as useTableSearch,
|
|
1332
|
+
vt as useTableSelection,
|
|
1333
|
+
pt as useTableSort
|
|
1181
1334
|
};
|
|
1182
1335
|
//# sourceMappingURL=better-table.es.js.map
|