@sito/dashboard 0.0.65 → 0.0.66
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/Badge-CIeYthEy.js +9 -0
- package/dist/Badge-Z78MlGoQ.cjs +1 -0
- package/dist/Badge.cjs +1 -0
- package/dist/Badge.css +1 -0
- package/dist/Badge.d.ts +2 -0
- package/dist/Badge.js +4 -0
- package/dist/Button-BlYa3uPc.cjs +1 -0
- package/dist/Button-D73-swfo.js +24 -0
- package/dist/Button.cjs +1 -0
- package/dist/Button.css +1 -0
- package/dist/Button.d.ts +2 -0
- package/dist/Button.js +4 -0
- package/dist/Chip-JDQqzO9I.js +37 -0
- package/dist/Chip-a2z-338_.cjs +1 -0
- package/dist/Chip.cjs +1 -0
- package/dist/Chip.css +1 -0
- package/dist/Chip.d.ts +2 -0
- package/dist/Chip.js +4 -0
- package/dist/Close-O9P7wJGf.cjs +1 -0
- package/dist/Close-rKC9AcNX.js +17 -0
- package/dist/Dropdown-CAxauIXt.cjs +1 -0
- package/dist/Dropdown-CbaxuMbk.js +63 -0
- package/dist/Dropdown.cjs +1 -0
- package/dist/Dropdown.css +1 -0
- package/dist/Dropdown.d.ts +2 -0
- package/dist/Dropdown.js +4 -0
- package/dist/File-BuJndWMv.js +17 -0
- package/dist/File-_Hjw2d3F.cjs +1 -0
- package/dist/FileInput-5tMOO7mb.cjs +1 -0
- package/dist/FileInput-B--eBQVa.js +91 -0
- package/dist/FileInput.css +1 -0
- package/dist/Filters-BivtNVS3.js +64 -0
- package/dist/Filters-C5XEbF3V.cjs +1 -0
- package/dist/FiltersProvider-CY2fsw_F.js +57 -0
- package/dist/FiltersProvider-CYqLFEI9.cjs +1 -0
- package/dist/FiltersProvider.cjs +1 -0
- package/dist/FiltersProvider.d.ts +2 -0
- package/dist/FiltersProvider.js +8 -0
- package/dist/Form.cjs +1 -0
- package/dist/Form.d.ts +2 -0
- package/dist/Form.js +13 -0
- package/dist/IconButton-BpsTEj0z.js +29 -0
- package/dist/IconButton-CVnmT2E9.cjs +1 -0
- package/dist/IconButton.cjs +1 -0
- package/dist/IconButton.css +1 -0
- package/dist/IconButton.d.ts +2 -0
- package/dist/IconButton.js +4 -0
- package/dist/Loading-B_c_4XLr.js +26 -0
- package/dist/Loading-CNECRan-.cjs +1 -0
- package/dist/Loading.cjs +1 -0
- package/dist/Loading.css +1 -0
- package/dist/Loading.d.ts +2 -0
- package/dist/Loading.js +4 -0
- package/dist/SvgIcons.cjs +1 -0
- package/dist/SvgIcons.d.ts +2 -0
- package/dist/SvgIcons.js +12 -0
- package/dist/Table-CH9HYQ2I.js +946 -0
- package/dist/Table-CWss4TW5.cjs +1 -0
- package/dist/Table.cjs +1 -0
- package/dist/Table.css +1 -0
- package/dist/Table.d.ts +2 -0
- package/dist/Table.js +18 -0
- package/dist/TableOptions.cjs +1 -0
- package/dist/TableOptions.d.ts +2 -0
- package/dist/TableOptions.js +5 -0
- package/dist/TableOptionsProvider-BchUDA3B.cjs +1 -0
- package/dist/TableOptionsProvider-BfQS8l1N.js +50 -0
- package/dist/TextInput-BLfTozZ9.js +320 -0
- package/dist/TextInput-Bn8zsDnU.cjs +1 -0
- package/dist/TextInput.css +1 -0
- package/dist/Tooltip-B4E-FRwY.js +37 -0
- package/dist/Tooltip-BSKAgRkc.cjs +1 -0
- package/dist/Tooltip.cjs +1 -0
- package/dist/Tooltip.css +1 -0
- package/dist/Tooltip.d.ts +2 -0
- package/dist/Tooltip.js +4 -0
- package/dist/Translation.cjs +1 -0
- package/dist/Translation.d.ts +2 -0
- package/dist/Translation.js +5 -0
- package/dist/TranslationProvider-51Pc9Xrr.cjs +1 -0
- package/dist/TranslationProvider-COebIyxr.js +19 -0
- package/dist/components/Button/Button.stories.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -0
- package/dist/components/Dropdown/types.d.ts +1 -0
- package/dist/components/Form/FileInput/FileInput.test.d.ts +1 -0
- package/dist/components/Form/TextInput/TextInput.test.d.ts +1 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +1 -0
- package/dist/index.js +70 -0
- package/dist/lib.cjs +1 -0
- package/dist/lib.d.ts +2 -0
- package/dist/lib.js +6 -0
- package/dist/query-81BrXp3i.cjs +1 -0
- package/dist/query-CwuehjY1.js +4 -0
- package/package.json +80 -9
- package/dist/dashboard.cjs +0 -1
- package/dist/dashboard.js +0 -1661
- package/dist/main.css +0 -1
|
@@ -0,0 +1,946 @@
|
|
|
1
|
+
import "./Table.css";
|
|
2
|
+
import { jsx as e, jsxs as g, Fragment as K } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as V, useEffect as P, useMemo as v, useCallback as x, Fragment as re, useState as $ } from "react";
|
|
4
|
+
import { u as q, a as j, F as ae } from "./FiltersProvider-CY2fsw_F.js";
|
|
5
|
+
import { B as ie } from "./Badge-CIeYthEy.js";
|
|
6
|
+
import { c as oe, C as ce, a as de, b as ue, F as pe } from "./Filters-BivtNVS3.js";
|
|
7
|
+
import { FilterTypes as W } from "./lib.js";
|
|
8
|
+
import { u as A } from "./TranslationProvider-COebIyxr.js";
|
|
9
|
+
import { A as me, C as he, S as Z, T as Y } from "./TextInput-BLfTozZ9.js";
|
|
10
|
+
import { u as L } from "./TableOptionsProvider-BfQS8l1N.js";
|
|
11
|
+
import { C as ee } from "./Chip-JDQqzO9I.js";
|
|
12
|
+
import { I as X } from "./IconButton-BpsTEj0z.js";
|
|
13
|
+
import { T as ne } from "./Tooltip-B4E-FRwY.js";
|
|
14
|
+
import { S as fe } from "./query-CwuehjY1.js";
|
|
15
|
+
import { B as be } from "./Button-D73-swfo.js";
|
|
16
|
+
import { L as ge } from "./Loading-B_c_4XLr.js";
|
|
17
|
+
function se(n) {
|
|
18
|
+
return [...n].sort((t, a) => (a.pos ?? 0) - (t.pos ?? 0)).filter((t) => t.display !== "none");
|
|
19
|
+
}
|
|
20
|
+
function Ce(n) {
|
|
21
|
+
const { t } = A(), {
|
|
22
|
+
entity: a = "",
|
|
23
|
+
columns: s = [],
|
|
24
|
+
hasAction: l = !0,
|
|
25
|
+
onSortCallback: r,
|
|
26
|
+
selectionState: m,
|
|
27
|
+
onToggleAllRows: i
|
|
28
|
+
} = n, u = V(null);
|
|
29
|
+
P(() => {
|
|
30
|
+
u.current && (u.current.indeterminate = !!(m?.hasSomeSelected && !m?.allSelected));
|
|
31
|
+
}, [m]);
|
|
32
|
+
const { onSort: o, sortingOrder: p, sortingBy: h } = L(), f = v(() => se(s).map((c) => ({
|
|
33
|
+
id: c.key,
|
|
34
|
+
label: c.label,
|
|
35
|
+
className: c.className ?? "",
|
|
36
|
+
sortable: c.sortable ?? !0,
|
|
37
|
+
sortOptions: c.sortOptions
|
|
38
|
+
})), [s, a, t]);
|
|
39
|
+
return /* @__PURE__ */ e("thead", { className: "table-headers-row", children: /* @__PURE__ */ g("tr", { children: [
|
|
40
|
+
/* @__PURE__ */ e("th", { scope: "col", className: "table-headers-column table-headers-checkbox", children: i ? /* @__PURE__ */ e(
|
|
41
|
+
"input",
|
|
42
|
+
{
|
|
43
|
+
type: "checkbox",
|
|
44
|
+
ref: u,
|
|
45
|
+
checked: m?.allSelected ?? !1,
|
|
46
|
+
onChange: i,
|
|
47
|
+
"aria-label": t("_accessibility:components.table.selectAllRows")
|
|
48
|
+
}
|
|
49
|
+
) : null }),
|
|
50
|
+
f.map((c) => /* @__PURE__ */ e(
|
|
51
|
+
"th",
|
|
52
|
+
{
|
|
53
|
+
scope: "col",
|
|
54
|
+
className: `table-headers-column ${c.className}`,
|
|
55
|
+
children: /* @__PURE__ */ g(
|
|
56
|
+
be,
|
|
57
|
+
{
|
|
58
|
+
disabled: !c.sortable,
|
|
59
|
+
onClick: () => o(c.id, r),
|
|
60
|
+
className: "table-headers-cell",
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ e("span", { className: "table-headers-label", children: c.label }),
|
|
63
|
+
c.sortable && h === c.id && /* @__PURE__ */ e("span", { children: p === fe.ASC ? c.sortOptions?.icons?.asc ?? /* @__PURE__ */ e(
|
|
64
|
+
oe,
|
|
65
|
+
{
|
|
66
|
+
className: c.sortOptions?.icons?.className ?? "table-headers-sort-indicator"
|
|
67
|
+
}
|
|
68
|
+
) : c.sortOptions?.icons?.desc ?? /* @__PURE__ */ e(
|
|
69
|
+
ce,
|
|
70
|
+
{
|
|
71
|
+
className: c.sortOptions?.icons?.className ?? "table-headers-sort-indicator"
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
},
|
|
78
|
+
c.id
|
|
79
|
+
)),
|
|
80
|
+
l && /* @__PURE__ */ e("th", { scope: "col", className: "table-headers-action", children: /* @__PURE__ */ e("span", { className: "button text default disabled", children: t("_accessibility:labels.actions") }) })
|
|
81
|
+
] }) });
|
|
82
|
+
}
|
|
83
|
+
const Ne = (n) => {
|
|
84
|
+
const { items: t, text: a, id: s, onClearFilter: l } = n;
|
|
85
|
+
return /* @__PURE__ */ e(
|
|
86
|
+
ee,
|
|
87
|
+
{
|
|
88
|
+
text: `${a}: ${t.map((r) => r.value ?? r.name).join(", ")}`,
|
|
89
|
+
onDelete: () => l(s)
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}, ve = (n) => {
|
|
93
|
+
const { end: t, start: a, text: s, id: l, onClearFilter: r } = n;
|
|
94
|
+
return /* @__PURE__ */ e(
|
|
95
|
+
ee,
|
|
96
|
+
{
|
|
97
|
+
text: `${s}: ${a || "♾️"} - ${t || "♾️"}`,
|
|
98
|
+
onDelete: () => r(l)
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}, xe = (n) => {
|
|
102
|
+
const { filtersDefinition: t } = n, a = v(() => {
|
|
103
|
+
const i = {};
|
|
104
|
+
return t.forEach((u) => {
|
|
105
|
+
i[u.propertyName] = u.label ?? u.propertyName;
|
|
106
|
+
}), i;
|
|
107
|
+
}, [t]), { filters: s, clearFilters: l } = L(), r = v(() => Object.keys(s), [s]), m = x(
|
|
108
|
+
(i) => s[i]?.end || s[i]?.start ? /* @__PURE__ */ e(
|
|
109
|
+
ve,
|
|
110
|
+
{
|
|
111
|
+
id: i,
|
|
112
|
+
text: a[i],
|
|
113
|
+
start: s[i].start,
|
|
114
|
+
end: s[i].end,
|
|
115
|
+
onClearFilter: l
|
|
116
|
+
}
|
|
117
|
+
) : Array.isArray(s[i]) ? /* @__PURE__ */ e(
|
|
118
|
+
Ne,
|
|
119
|
+
{
|
|
120
|
+
id: i,
|
|
121
|
+
text: a[i],
|
|
122
|
+
items: s[i],
|
|
123
|
+
onClearFilter: l
|
|
124
|
+
}
|
|
125
|
+
) : /* @__PURE__ */ e(
|
|
126
|
+
ee,
|
|
127
|
+
{
|
|
128
|
+
text: `${a[i]}: ${s[i]?.value ?? s[i]?.name ?? s[i]}`,
|
|
129
|
+
onDelete: () => l(i)
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
[s, a]
|
|
133
|
+
);
|
|
134
|
+
return /* @__PURE__ */ e("ul", { className: "active-filters-main", children: r?.map((i) => /* @__PURE__ */ e("li", { children: m(i) }, i)) });
|
|
135
|
+
};
|
|
136
|
+
function we(n) {
|
|
137
|
+
const { propertyName: t, label: a, placeholder: s, options: l, multiple: r = !0 } = n, { currentFilters: m, setCurrentFilters: i } = q(), u = v(() => m[t] ?? l[0], [m]), o = x(
|
|
138
|
+
(p) => {
|
|
139
|
+
i({
|
|
140
|
+
type: j.update,
|
|
141
|
+
toUpdate: {
|
|
142
|
+
[t]: {
|
|
143
|
+
value: p
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
[r]
|
|
149
|
+
);
|
|
150
|
+
return /* @__PURE__ */ e(
|
|
151
|
+
me,
|
|
152
|
+
{
|
|
153
|
+
value: u?.value,
|
|
154
|
+
label: a,
|
|
155
|
+
options: l,
|
|
156
|
+
multiple: r,
|
|
157
|
+
helperTextClassName: "hidden",
|
|
158
|
+
containerClassName: "options-widget-container",
|
|
159
|
+
onChange: o,
|
|
160
|
+
placeholder: s
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
const ye = (n) => {
|
|
165
|
+
const { propertyName: t, label: a } = n, { currentFilters: s, setCurrentFilters: l } = q(), r = v(() => s[t]?.value ?? "", [s]), m = x((i) => {
|
|
166
|
+
l({
|
|
167
|
+
type: j.update,
|
|
168
|
+
toUpdate: { [t]: { value: i.target.checked } }
|
|
169
|
+
});
|
|
170
|
+
}, []);
|
|
171
|
+
return /* @__PURE__ */ e(he, { label: a, checked: r ?? !1, onChange: m });
|
|
172
|
+
};
|
|
173
|
+
function Se(n) {
|
|
174
|
+
const { propertyName: t, options: a, label: s, placeholder: l } = n, { currentFilters: r, setCurrentFilters: m } = q(), i = v(() => r[t]?.value ?? a[0], [r]), u = x((o) => {
|
|
175
|
+
m({
|
|
176
|
+
type: j.update,
|
|
177
|
+
toUpdate: { [t]: { value: o.target.value } }
|
|
178
|
+
});
|
|
179
|
+
}, []);
|
|
180
|
+
return /* @__PURE__ */ e(
|
|
181
|
+
Z,
|
|
182
|
+
{
|
|
183
|
+
value: i,
|
|
184
|
+
label: s,
|
|
185
|
+
options: a,
|
|
186
|
+
helperTextClassName: "hidden",
|
|
187
|
+
containerClassName: "options-widget-container",
|
|
188
|
+
onChange: u,
|
|
189
|
+
placeholder: l
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
const Re = (n) => {
|
|
194
|
+
const { propertyName: t, label: a, placeholder: s } = n, { currentFilters: l, setCurrentFilters: r } = q(), m = v(() => l[t]?.value ?? "", [l]), i = x((u) => {
|
|
195
|
+
r({
|
|
196
|
+
type: j.update,
|
|
197
|
+
toUpdate: { [t]: { value: u.target.value } }
|
|
198
|
+
});
|
|
199
|
+
}, []);
|
|
200
|
+
return /* @__PURE__ */ e(
|
|
201
|
+
Y,
|
|
202
|
+
{
|
|
203
|
+
value: m ?? "",
|
|
204
|
+
label: a,
|
|
205
|
+
onChange: i,
|
|
206
|
+
containerClassName: "input-widget-container",
|
|
207
|
+
helperTextClassName: "",
|
|
208
|
+
placeholder: s
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}, te = (n) => {
|
|
212
|
+
const { propertyName: t, label: a, inputType: s } = n, { t: l } = A(), { currentFilters: r, setCurrentFilters: m } = q(), i = V(null), u = V(null), o = x((h) => {
|
|
213
|
+
m({
|
|
214
|
+
type: j.update,
|
|
215
|
+
toUpdate: {
|
|
216
|
+
[t]: {
|
|
217
|
+
value: { end: u?.current?.value ?? null, start: h.target.value }
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}, []), p = x((h) => {
|
|
222
|
+
m({
|
|
223
|
+
type: j.update,
|
|
224
|
+
toUpdate: {
|
|
225
|
+
[t]: {
|
|
226
|
+
value: {
|
|
227
|
+
start: i?.current?.value ?? null,
|
|
228
|
+
end: h.target.value
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}, []);
|
|
234
|
+
return /* @__PURE__ */ g("div", { className: "range-widget-container", children: [
|
|
235
|
+
/* @__PURE__ */ e("p", { className: "text-input-label input-widget-label input-label-normal", children: a }),
|
|
236
|
+
/* @__PURE__ */ g("div", { className: "range-widget-row", children: [
|
|
237
|
+
/* @__PURE__ */ e(
|
|
238
|
+
Y,
|
|
239
|
+
{
|
|
240
|
+
value: r[t]?.value?.start ?? "",
|
|
241
|
+
placeholder: l("_accessibility:components.table.filters.range.start"),
|
|
242
|
+
type: s,
|
|
243
|
+
ref: i,
|
|
244
|
+
onChange: o,
|
|
245
|
+
containerClassName: "input-widget-container",
|
|
246
|
+
helperTextClassName: ""
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
/* @__PURE__ */ e(
|
|
250
|
+
Y,
|
|
251
|
+
{
|
|
252
|
+
value: r[t]?.value?.end ?? "",
|
|
253
|
+
placeholder: l("_accessibility:components.table.filters.range.end"),
|
|
254
|
+
type: s,
|
|
255
|
+
ref: u,
|
|
256
|
+
onChange: p,
|
|
257
|
+
containerClassName: "input-widget-container",
|
|
258
|
+
helperTextClassName: ""
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
] })
|
|
262
|
+
] });
|
|
263
|
+
}, Te = (n) => {
|
|
264
|
+
switch (n.type) {
|
|
265
|
+
case W.text:
|
|
266
|
+
return /* @__PURE__ */ e(Re, { ...n });
|
|
267
|
+
case W.number:
|
|
268
|
+
return /* @__PURE__ */ e(
|
|
269
|
+
te,
|
|
270
|
+
{
|
|
271
|
+
...n,
|
|
272
|
+
inputType: "number"
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
case W.date:
|
|
276
|
+
return /* @__PURE__ */ e(
|
|
277
|
+
te,
|
|
278
|
+
{
|
|
279
|
+
...n,
|
|
280
|
+
inputType: "date"
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
case W.select:
|
|
284
|
+
return /* @__PURE__ */ e(Se, { ...n });
|
|
285
|
+
case W.autocomplete:
|
|
286
|
+
return /* @__PURE__ */ e(we, { ...n });
|
|
287
|
+
case W.check:
|
|
288
|
+
return /* @__PURE__ */ e(ye, { ...n });
|
|
289
|
+
}
|
|
290
|
+
return /* @__PURE__ */ e(K, {});
|
|
291
|
+
}, Fe = (n) => {
|
|
292
|
+
const { filters: t = [], show: a, handleShow: s } = n, { onFilterApply: l } = L(), { currentFilters: r, setCurrentFilters: m } = q(), { t: i } = A(), u = V(null);
|
|
293
|
+
return P(() => {
|
|
294
|
+
const o = ({ target: h }) => {
|
|
295
|
+
u.current && (h?.closest(".filter-dropdown-trigger") || !a || u.current.contains(h) || s(!1));
|
|
296
|
+
}, p = ({ code: h }) => {
|
|
297
|
+
!a || h !== "Escape" || s(!1);
|
|
298
|
+
};
|
|
299
|
+
return document.addEventListener("click", o), document.addEventListener("keydown", p), () => {
|
|
300
|
+
document.removeEventListener("click", o), document.removeEventListener("keydown", p);
|
|
301
|
+
};
|
|
302
|
+
}, [s, a]), /* @__PURE__ */ e("div", { className: `filter-dropdown-backdrop ${a ? "opened" : "closed"}`, children: /* @__PURE__ */ g("div", { className: "filter-popup", ref: u, children: [
|
|
303
|
+
/* @__PURE__ */ e("div", { className: "filter-title", children: i("_accessibility:buttons.filters") }),
|
|
304
|
+
/* @__PURE__ */ e("ul", { className: "filter-container", children: t.map((o) => /* @__PURE__ */ e("li", { className: "filter-container-item", children: Te(o) }, o.propertyName)) }),
|
|
305
|
+
/* @__PURE__ */ e("div", { className: "filter-footer", children: /* @__PURE__ */ g("ul", { className: "filter-buttons-row", children: [
|
|
306
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
307
|
+
"button",
|
|
308
|
+
{
|
|
309
|
+
onClick: () => m({
|
|
310
|
+
type: j.reset,
|
|
311
|
+
filters: t
|
|
312
|
+
}),
|
|
313
|
+
className: "filter-dropdown-button small filter-dropdown-cancel",
|
|
314
|
+
children: i("_accessibility:buttons.clear")
|
|
315
|
+
}
|
|
316
|
+
) }),
|
|
317
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
318
|
+
"button",
|
|
319
|
+
{
|
|
320
|
+
className: "filter-dropdown-button small filter-dropdown-submit",
|
|
321
|
+
onClick: () => {
|
|
322
|
+
s(!1), l(r);
|
|
323
|
+
},
|
|
324
|
+
children: i("_accessibility:buttons.applyFilters")
|
|
325
|
+
}
|
|
326
|
+
) })
|
|
327
|
+
] }) })
|
|
328
|
+
] }) });
|
|
329
|
+
}, Ee = () => {
|
|
330
|
+
const { t: n } = A(), { total: t, pageSize: a, pageSizes: s, currentPage: l } = L(), r = (l + 1) * a > t ? t : (l + 1) * a;
|
|
331
|
+
return /* @__PURE__ */ g("div", { className: "table-navigation-sizes", children: [
|
|
332
|
+
s[0] < t && /* @__PURE__ */ e(K, { children: /* @__PURE__ */ g("p", { children: [
|
|
333
|
+
l * a + 1,
|
|
334
|
+
" - ",
|
|
335
|
+
r,
|
|
336
|
+
" ",
|
|
337
|
+
n("_accessibility:components.table.of")
|
|
338
|
+
] }) }),
|
|
339
|
+
/* @__PURE__ */ e("p", { children: t })
|
|
340
|
+
] });
|
|
341
|
+
};
|
|
342
|
+
function Ae() {
|
|
343
|
+
const { t: n } = A(), { total: t, pageSize: a, currentPage: s, setCurrentPage: l } = L(), r = v(() => {
|
|
344
|
+
const m = Math.ceil(t / a);
|
|
345
|
+
return Array.from({ length: m }, (i, u) => ({
|
|
346
|
+
id: u,
|
|
347
|
+
value: u + 1
|
|
348
|
+
}));
|
|
349
|
+
}, [t, a]);
|
|
350
|
+
return /* @__PURE__ */ g("div", { className: "jump-to-page", children: [
|
|
351
|
+
/* @__PURE__ */ e("p", { children: n("_accessibility:components.table.jumpToPage") }),
|
|
352
|
+
/* @__PURE__ */ e(
|
|
353
|
+
Z,
|
|
354
|
+
{
|
|
355
|
+
value: s,
|
|
356
|
+
options: r,
|
|
357
|
+
inputClassName: "jump-to-page-input",
|
|
358
|
+
containerClassName: "jump-to-page-input-container",
|
|
359
|
+
helperTextClassName: "hidden",
|
|
360
|
+
onChange: (m) => l(Number(m.target.value))
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
] });
|
|
364
|
+
}
|
|
365
|
+
const ke = () => {
|
|
366
|
+
const { t: n } = A(), { total: t, pageSize: a, currentPage: s, setCurrentPage: l } = L();
|
|
367
|
+
return /* @__PURE__ */ g("div", { className: "table-navigation-pages", children: [
|
|
368
|
+
/* @__PURE__ */ e(
|
|
369
|
+
X,
|
|
370
|
+
{
|
|
371
|
+
icon: /* @__PURE__ */ e(de, { className: "table-navigation-icon" }),
|
|
372
|
+
className: "table-navigation-buttons",
|
|
373
|
+
disabled: s === 0,
|
|
374
|
+
"aria-label": n("_accessibility:buttons.previous"),
|
|
375
|
+
name: n("_accessibility:buttons.previous"),
|
|
376
|
+
onClick: () => l(s - 1)
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ e(
|
|
380
|
+
X,
|
|
381
|
+
{
|
|
382
|
+
icon: /* @__PURE__ */ e(ue, { className: "table-navigation-icon" }),
|
|
383
|
+
disabled: Math.floor(t / ((s + 1) * a)) === 0,
|
|
384
|
+
className: "table-navigation-buttons",
|
|
385
|
+
name: n("_accessibility:buttons.next"),
|
|
386
|
+
"aria-label": n("_accessibility:buttons.next"),
|
|
387
|
+
onClick: () => l(s + 1)
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
] });
|
|
391
|
+
};
|
|
392
|
+
function Oe() {
|
|
393
|
+
const { t: n } = A(), { pageSizes: t, pageSize: a, setPageSize: s } = L(), l = v(
|
|
394
|
+
() => t?.map((r) => ({ id: r, value: r })),
|
|
395
|
+
[t]
|
|
396
|
+
);
|
|
397
|
+
return /* @__PURE__ */ g("div", { className: "page-size", children: [
|
|
398
|
+
/* @__PURE__ */ e("p", { children: n("_accessibility:components.table.pageSizes") }),
|
|
399
|
+
/* @__PURE__ */ e(
|
|
400
|
+
Z,
|
|
401
|
+
{
|
|
402
|
+
value: a,
|
|
403
|
+
options: l,
|
|
404
|
+
inputClassName: "page-size-input",
|
|
405
|
+
containerClassName: "page-size-input-container",
|
|
406
|
+
helperTextClassName: "hidden",
|
|
407
|
+
onChange: (r) => s(Number(r.target.value))
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
] });
|
|
411
|
+
}
|
|
412
|
+
function _e() {
|
|
413
|
+
return /* @__PURE__ */ g("div", { className: "table-footer", children: [
|
|
414
|
+
/* @__PURE__ */ e(Ae, {}),
|
|
415
|
+
/* @__PURE__ */ e(Oe, {}),
|
|
416
|
+
/* @__PURE__ */ e(Ee, {}),
|
|
417
|
+
/* @__PURE__ */ e(ke, {})
|
|
418
|
+
] });
|
|
419
|
+
}
|
|
420
|
+
const $e = (n) => n, Pe = (n) => {
|
|
421
|
+
const { t } = A(), {
|
|
422
|
+
columns: a,
|
|
423
|
+
softDeleteProperty: s = "deletedAt",
|
|
424
|
+
data: l,
|
|
425
|
+
actions: r,
|
|
426
|
+
selectedRows: m,
|
|
427
|
+
expandedRows: i = [],
|
|
428
|
+
onRowSelectionChange: u,
|
|
429
|
+
onRowExpand: o
|
|
430
|
+
} = n, p = v(
|
|
431
|
+
() => se(a),
|
|
432
|
+
[a]
|
|
433
|
+
), h = v(
|
|
434
|
+
() => new Map(
|
|
435
|
+
i.map((f) => [f.rowId, f])
|
|
436
|
+
),
|
|
437
|
+
[i]
|
|
438
|
+
);
|
|
439
|
+
return l?.map((f) => {
|
|
440
|
+
const c = m.has(f.id), y = h.get(f.id), T = !!y, U = p.length + 1 + (r ? 1 : 0);
|
|
441
|
+
return /* @__PURE__ */ g(re, { children: [
|
|
442
|
+
/* @__PURE__ */ g(
|
|
443
|
+
"tr",
|
|
444
|
+
{
|
|
445
|
+
className: `table-row ${o ? "expandable" : ""} ${f[s] ? "deleted-class" : ""} ${c ? "selected" : ""} ${T ? "expanded" : ""}`,
|
|
446
|
+
onClick: () => o?.(f),
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ e("td", { className: "table-row-cell table-row-checkbox", children: /* @__PURE__ */ e(
|
|
449
|
+
"input",
|
|
450
|
+
{
|
|
451
|
+
type: "checkbox",
|
|
452
|
+
checked: c,
|
|
453
|
+
onClick: (C) => C.stopPropagation(),
|
|
454
|
+
onChange: () => u(f),
|
|
455
|
+
"aria-label": t("_accessibility:components.table.selectRow")
|
|
456
|
+
}
|
|
457
|
+
) }),
|
|
458
|
+
p?.map((C, M) => /* @__PURE__ */ e(
|
|
459
|
+
"td",
|
|
460
|
+
{
|
|
461
|
+
className: `table-row-cell ${M === 0 ? "basic" : ""} ${C.className ?? ""}`,
|
|
462
|
+
children: C.renderBody ? C.renderBody(f[C.key], f) : $e(f[C.key])
|
|
463
|
+
},
|
|
464
|
+
C.key
|
|
465
|
+
)),
|
|
466
|
+
r ? /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("div", { className: "table-row-cell-action", children: r(f).filter((C) => !C.hidden)?.map((C) => /* @__PURE__ */ e(ne, { content: C.tooltip, children: /* @__PURE__ */ e(
|
|
467
|
+
X,
|
|
468
|
+
{
|
|
469
|
+
icon: C.icon,
|
|
470
|
+
className: "row-table-action",
|
|
471
|
+
onClick: (M) => {
|
|
472
|
+
M.stopPropagation(), C.onClick(f);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
) }, C.id)) }) }) : null
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
),
|
|
479
|
+
T && y?.content !== null && typeof y?.content < "u" && /* @__PURE__ */ e("tr", { className: "table-row-expanded", children: /* @__PURE__ */ e("td", { className: "table-row-expanded-cell", colSpan: U, children: /* @__PURE__ */ e(
|
|
480
|
+
"div",
|
|
481
|
+
{
|
|
482
|
+
className: `table-row-expanded-content ${y.isVisible ? "open" : "closed"}`,
|
|
483
|
+
children: /* @__PURE__ */ e("div", { className: "table-row-expanded-inner", children: y.content })
|
|
484
|
+
}
|
|
485
|
+
) }) })
|
|
486
|
+
] }, f.id);
|
|
487
|
+
});
|
|
488
|
+
};
|
|
489
|
+
function Me() {
|
|
490
|
+
const { t: n } = A();
|
|
491
|
+
return /* @__PURE__ */ e("div", { className: "table-empty", children: /* @__PURE__ */ e("p", { children: n("_accessibility:components.table.empty") }) });
|
|
492
|
+
}
|
|
493
|
+
const Ie = (n) => {
|
|
494
|
+
const { columns: t, title: a, isLoading: s, toolbar: l, filterOptions: r } = n, { countOfFilters: m } = L(), { t: i } = A(), u = v(() => t ? t.sort((c, y) => (y.pos ?? 0) - (c.pos ?? 0)).filter((c) => !!c.filterOptions).map((c) => ({
|
|
495
|
+
...c.filterOptions,
|
|
496
|
+
label: c.filterOptions?.label ?? c.label,
|
|
497
|
+
propertyName: c.key
|
|
498
|
+
})) : [], [t]), [o, p] = $(!1), h = x(
|
|
499
|
+
(c) => {
|
|
500
|
+
r?.dropdown?.setOpened ? r.dropdown.setOpened(c ?? !1) : p(c ?? !1);
|
|
501
|
+
},
|
|
502
|
+
[r]
|
|
503
|
+
), f = v(
|
|
504
|
+
() => r?.dropdown?.opened ?? o,
|
|
505
|
+
[r, o]
|
|
506
|
+
);
|
|
507
|
+
return /* @__PURE__ */ g("div", { className: `table-header ${f ? "showing-filters" : ""}`, children: [
|
|
508
|
+
/* @__PURE__ */ g("div", { children: [
|
|
509
|
+
a && /* @__PURE__ */ e("h1", { className: "table-header-title", children: a }),
|
|
510
|
+
s ? null : /* @__PURE__ */ g("div", { className: "table-header-content", children: [
|
|
511
|
+
l,
|
|
512
|
+
r?.button?.hide !== !0 && /* @__PURE__ */ g(
|
|
513
|
+
X,
|
|
514
|
+
{
|
|
515
|
+
icon: r?.button?.icon ?? /* @__PURE__ */ e(pe, { className: "filter-dropdown-trigger-icon" }),
|
|
516
|
+
className: "filter-dropdown-button normal filter-dropdown-trigger",
|
|
517
|
+
"aria-haspopup": "true",
|
|
518
|
+
onClick: () => h(!f),
|
|
519
|
+
"aria-expanded": f,
|
|
520
|
+
children: [
|
|
521
|
+
/* @__PURE__ */ e(
|
|
522
|
+
ie,
|
|
523
|
+
{
|
|
524
|
+
count: m,
|
|
525
|
+
className: `${m > 0 ? "show" : "hide"} `
|
|
526
|
+
}
|
|
527
|
+
),
|
|
528
|
+
/* @__PURE__ */ e("span", { className: "table-header-sr", children: i("_accessibility:buttons.filters") }),
|
|
529
|
+
/* @__PURE__ */ e("wbr", {})
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
)
|
|
533
|
+
] })
|
|
534
|
+
] }),
|
|
535
|
+
!!u && !!u.length && /* @__PURE__ */ e(
|
|
536
|
+
Fe,
|
|
537
|
+
{
|
|
538
|
+
filters: u,
|
|
539
|
+
show: f,
|
|
540
|
+
handleShow: h,
|
|
541
|
+
options: r
|
|
542
|
+
}
|
|
543
|
+
),
|
|
544
|
+
/* @__PURE__ */ e(xe, { filtersDefinition: u })
|
|
545
|
+
] });
|
|
546
|
+
};
|
|
547
|
+
function ze({
|
|
548
|
+
count: n,
|
|
549
|
+
multiActions: t,
|
|
550
|
+
onActionClick: a
|
|
551
|
+
}) {
|
|
552
|
+
const { t: s } = A();
|
|
553
|
+
return /* @__PURE__ */ g("div", { className: "table-selection-bar", children: [
|
|
554
|
+
/* @__PURE__ */ e("p", { className: "table-selection-bar-count", children: s("_accessibility:components.table.selectedCount", { count: n }) }),
|
|
555
|
+
t.length > 0 && /* @__PURE__ */ e("div", { className: "table-selection-bar-actions", children: t.map((l) => /* @__PURE__ */ e(ne, { content: l.tooltip, children: /* @__PURE__ */ e(
|
|
556
|
+
X,
|
|
557
|
+
{
|
|
558
|
+
icon: l.icon,
|
|
559
|
+
className: "multi-table-action",
|
|
560
|
+
onClick: () => a(l),
|
|
561
|
+
disabled: l.disabled
|
|
562
|
+
}
|
|
563
|
+
) }, l.id)) })
|
|
564
|
+
] });
|
|
565
|
+
}
|
|
566
|
+
const Q = 220;
|
|
567
|
+
function Le({
|
|
568
|
+
data: n,
|
|
569
|
+
allowMultipleExpandedRows: t,
|
|
570
|
+
controlledExpandedRowId: a,
|
|
571
|
+
onExpandedRowChange: s,
|
|
572
|
+
onRowExpand: l,
|
|
573
|
+
findRowById: r
|
|
574
|
+
}) {
|
|
575
|
+
const [m, i] = $(null), [u, o] = $(null), [p, h] = $(null), [f, c] = $(null), [y, T] = $(!1), [U, C] = $(/* @__PURE__ */ new Set()), [M, I] = $([]), k = V(null), O = V(null), z = V(/* @__PURE__ */ new Map()), F = typeof a < "u", E = t && !F, w = F ? a ?? null : m, B = x(() => {
|
|
576
|
+
O.current && (clearTimeout(O.current), O.current = null);
|
|
577
|
+
}, []), R = x(
|
|
578
|
+
(d) => {
|
|
579
|
+
if (typeof d < "u") {
|
|
580
|
+
const b = z.current.get(d);
|
|
581
|
+
if (!b) return;
|
|
582
|
+
clearTimeout(b), z.current.delete(d);
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
z.current.forEach(
|
|
586
|
+
(b) => clearTimeout(b)
|
|
587
|
+
), z.current.clear();
|
|
588
|
+
},
|
|
589
|
+
[]
|
|
590
|
+
), H = x(
|
|
591
|
+
(d) => {
|
|
592
|
+
R(d), I((b) => b.some(
|
|
593
|
+
(S) => S.rowId === d
|
|
594
|
+
) ? b.map(
|
|
595
|
+
(S) => S.rowId === d ? { ...S, isVisible: !1 } : S
|
|
596
|
+
) : b), z.current.set(
|
|
597
|
+
d,
|
|
598
|
+
setTimeout(() => {
|
|
599
|
+
I(
|
|
600
|
+
(b) => b.filter((N) => N.rowId !== d)
|
|
601
|
+
), z.current.delete(d);
|
|
602
|
+
}, Q)
|
|
603
|
+
);
|
|
604
|
+
},
|
|
605
|
+
[R]
|
|
606
|
+
), G = x(
|
|
607
|
+
(d, b) => {
|
|
608
|
+
R(d), I((N) => N.some(
|
|
609
|
+
(_) => _.rowId === d
|
|
610
|
+
) ? N.map(
|
|
611
|
+
(_) => _.rowId === d ? { ..._, content: b, isVisible: !1 } : _
|
|
612
|
+
) : [...N, { rowId: d, content: b, isVisible: !1 }]), requestAnimationFrame(() => {
|
|
613
|
+
I(
|
|
614
|
+
(N) => N.map(
|
|
615
|
+
(S) => S.rowId === d ? { ...S, isVisible: !0 } : S
|
|
616
|
+
)
|
|
617
|
+
);
|
|
618
|
+
});
|
|
619
|
+
},
|
|
620
|
+
[R]
|
|
621
|
+
);
|
|
622
|
+
P(() => {
|
|
623
|
+
if (!E) return;
|
|
624
|
+
const d = new Set(n.map((b) => b.id));
|
|
625
|
+
C((b) => {
|
|
626
|
+
const N = /* @__PURE__ */ new Set();
|
|
627
|
+
return b.forEach((S) => {
|
|
628
|
+
if (d.has(S)) {
|
|
629
|
+
N.add(S);
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
R(S);
|
|
633
|
+
}), N;
|
|
634
|
+
}), I((b) => (b.forEach((N) => {
|
|
635
|
+
d.has(N.rowId) || R(N.rowId);
|
|
636
|
+
}), b.filter(
|
|
637
|
+
(N) => d.has(N.rowId)
|
|
638
|
+
)));
|
|
639
|
+
}, [n, E, R]), P(() => {
|
|
640
|
+
if (E) return;
|
|
641
|
+
if (w === null) {
|
|
642
|
+
o(null), F && (k.current = null);
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
r(w) || (F || i(null), o(null), F && (k.current = null));
|
|
646
|
+
}, [
|
|
647
|
+
n,
|
|
648
|
+
w,
|
|
649
|
+
r,
|
|
650
|
+
F,
|
|
651
|
+
E
|
|
652
|
+
]), P(() => {
|
|
653
|
+
if (!E) {
|
|
654
|
+
if (B(), w === null || u === null) {
|
|
655
|
+
if (p === null) {
|
|
656
|
+
T(!1), c(null);
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
T(!1), O.current = setTimeout(() => {
|
|
660
|
+
h(null), c(null), O.current = null;
|
|
661
|
+
}, Q);
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
if (p === null) {
|
|
665
|
+
h(w), c(u), requestAnimationFrame(() => T(!0));
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
if (p === w) {
|
|
669
|
+
c(u), requestAnimationFrame(() => T(!0));
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
T(!1), O.current = setTimeout(() => {
|
|
673
|
+
h(w), c(u), requestAnimationFrame(() => T(!0)), O.current = null;
|
|
674
|
+
}, Q);
|
|
675
|
+
}
|
|
676
|
+
}, [
|
|
677
|
+
B,
|
|
678
|
+
u,
|
|
679
|
+
w,
|
|
680
|
+
E,
|
|
681
|
+
p
|
|
682
|
+
]), P(
|
|
683
|
+
() => () => {
|
|
684
|
+
B(), R();
|
|
685
|
+
},
|
|
686
|
+
[B, R]
|
|
687
|
+
), P(() => {
|
|
688
|
+
if (!F) return;
|
|
689
|
+
if (w === null) {
|
|
690
|
+
o(null), k.current = null;
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
const d = r(w);
|
|
694
|
+
if (!d) {
|
|
695
|
+
o(null), k.current = null;
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
const b = k.current;
|
|
699
|
+
o(l?.(d, b) ?? null), k.current = d;
|
|
700
|
+
}, [w, r, F, l]);
|
|
701
|
+
const le = x(
|
|
702
|
+
(d) => {
|
|
703
|
+
if (E) {
|
|
704
|
+
if (U.has(d.id)) {
|
|
705
|
+
C((J) => {
|
|
706
|
+
const D = new Set(J);
|
|
707
|
+
return D.delete(d.id), D;
|
|
708
|
+
}), H(d.id), s?.(null, d);
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
C((J) => {
|
|
712
|
+
const D = new Set(J);
|
|
713
|
+
return D.add(d.id), D;
|
|
714
|
+
});
|
|
715
|
+
const _ = l?.(d, null) ?? null;
|
|
716
|
+
_ !== null && typeof _ < "u" ? G(d.id, _) : (R(d.id), I(
|
|
717
|
+
(J) => J.filter((D) => D.rowId !== d.id)
|
|
718
|
+
)), s?.(d, null);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
const b = w === d.id, N = b ? d : r(w);
|
|
722
|
+
if (F) {
|
|
723
|
+
s?.(b ? null : d, N);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (b) {
|
|
727
|
+
i(null), o(null), s?.(null, d);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
i(d.id), o(l?.(d, N) ?? null), s?.(d, N);
|
|
731
|
+
},
|
|
732
|
+
[
|
|
733
|
+
w,
|
|
734
|
+
H,
|
|
735
|
+
R,
|
|
736
|
+
G,
|
|
737
|
+
r,
|
|
738
|
+
U,
|
|
739
|
+
F,
|
|
740
|
+
E,
|
|
741
|
+
s,
|
|
742
|
+
l
|
|
743
|
+
]
|
|
744
|
+
);
|
|
745
|
+
return { expandedRowsToRender: v(() => E ? M : p === null || f === null || typeof f > "u" ? [] : [
|
|
746
|
+
{
|
|
747
|
+
rowId: p,
|
|
748
|
+
content: f,
|
|
749
|
+
isVisible: y
|
|
750
|
+
}
|
|
751
|
+
], [
|
|
752
|
+
y,
|
|
753
|
+
E,
|
|
754
|
+
f,
|
|
755
|
+
p,
|
|
756
|
+
M
|
|
757
|
+
]), onRowExpandChange: le };
|
|
758
|
+
}
|
|
759
|
+
function De({
|
|
760
|
+
actions: n,
|
|
761
|
+
selectedRowsData: t
|
|
762
|
+
}) {
|
|
763
|
+
const a = v(() => !n || !t.length ? [] : t.reduce(
|
|
764
|
+
(l, r, m) => {
|
|
765
|
+
const i = n(r).filter(
|
|
766
|
+
(o) => o.multiple && !o.hidden
|
|
767
|
+
);
|
|
768
|
+
if (m === 0) return i;
|
|
769
|
+
const u = new Map(
|
|
770
|
+
l.map((o) => [o.id, o])
|
|
771
|
+
);
|
|
772
|
+
return i.reduce((o, p) => {
|
|
773
|
+
const h = u.get(p.id);
|
|
774
|
+
return h && o.push({
|
|
775
|
+
...h,
|
|
776
|
+
...p,
|
|
777
|
+
disabled: p.disabled || h.disabled
|
|
778
|
+
}), o;
|
|
779
|
+
}, []);
|
|
780
|
+
},
|
|
781
|
+
[]
|
|
782
|
+
), [n, t]), s = x(
|
|
783
|
+
(l) => {
|
|
784
|
+
if (t.length) {
|
|
785
|
+
if (l.onMultipleClick) {
|
|
786
|
+
l.onMultipleClick(t);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
t.forEach((r) => l.onClick(r));
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
[t]
|
|
793
|
+
);
|
|
794
|
+
return { multiActions: a, handleMultipleActionClick: s };
|
|
795
|
+
}
|
|
796
|
+
function Ve({
|
|
797
|
+
data: n,
|
|
798
|
+
onRowSelect: t,
|
|
799
|
+
onSelectedRowsChange: a
|
|
800
|
+
}) {
|
|
801
|
+
const [s, l] = $(/* @__PURE__ */ new Set()), r = v(
|
|
802
|
+
() => n?.filter((o) => s.has(o.id)) ?? [],
|
|
803
|
+
[n, s]
|
|
804
|
+
);
|
|
805
|
+
P(() => {
|
|
806
|
+
if (!n?.length) {
|
|
807
|
+
l(/* @__PURE__ */ new Set());
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
l((o) => {
|
|
811
|
+
const p = /* @__PURE__ */ new Set(), h = new Set(n.map((f) => f.id));
|
|
812
|
+
return o.forEach((f) => {
|
|
813
|
+
h.has(f) && p.add(f);
|
|
814
|
+
}), p;
|
|
815
|
+
});
|
|
816
|
+
}, [n]), P(() => {
|
|
817
|
+
a && a(r);
|
|
818
|
+
}, [r, a]);
|
|
819
|
+
const m = x(
|
|
820
|
+
(o) => {
|
|
821
|
+
l((p) => {
|
|
822
|
+
const h = new Set(p);
|
|
823
|
+
return h.has(o.id) ? (h.delete(o.id), t?.(o, !1)) : (h.add(o.id), t?.(o, !0)), h;
|
|
824
|
+
});
|
|
825
|
+
},
|
|
826
|
+
[t]
|
|
827
|
+
), i = x(() => {
|
|
828
|
+
l((o) => {
|
|
829
|
+
const p = new Set(o), h = n ?? [], f = h.every(
|
|
830
|
+
(c) => p.has(c.id)
|
|
831
|
+
);
|
|
832
|
+
return h.forEach((c) => {
|
|
833
|
+
const y = p.has(c.id);
|
|
834
|
+
f ? y && (p.delete(c.id), t?.(c, !1)) : y || (p.add(c.id), t?.(c, !0));
|
|
835
|
+
}), p;
|
|
836
|
+
});
|
|
837
|
+
}, [n, t]), u = v(() => {
|
|
838
|
+
if (!n?.length)
|
|
839
|
+
return { allSelected: !1, hasSomeSelected: !1 };
|
|
840
|
+
const o = n.every((h) => s.has(h.id)), p = n.some((h) => s.has(h.id));
|
|
841
|
+
return { allSelected: o, hasSomeSelected: p };
|
|
842
|
+
}, [n, s]);
|
|
843
|
+
return {
|
|
844
|
+
selectedRows: s,
|
|
845
|
+
selectedRowsData: r,
|
|
846
|
+
selectionState: u,
|
|
847
|
+
onRowSelectionChange: m,
|
|
848
|
+
onToggleAllRows: i
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function lt(n) {
|
|
852
|
+
const {
|
|
853
|
+
data: t,
|
|
854
|
+
onSort: a,
|
|
855
|
+
entity: s = "",
|
|
856
|
+
isLoading: l = !1,
|
|
857
|
+
actions: r,
|
|
858
|
+
columns: m = [],
|
|
859
|
+
contentClassName: i = "",
|
|
860
|
+
className: u = "",
|
|
861
|
+
softDeleteProperty: o = "deletedAt",
|
|
862
|
+
onRowSelect: p,
|
|
863
|
+
onSelectedRowsChange: h,
|
|
864
|
+
allowMultipleExpandedRows: f = !1,
|
|
865
|
+
expandedRowId: c,
|
|
866
|
+
onExpandedRowChange: y,
|
|
867
|
+
onRowExpand: T,
|
|
868
|
+
...U
|
|
869
|
+
} = n, C = v(() => !t?.length, [t]), M = x(
|
|
870
|
+
(H) => H === null ? null : t.find((G) => G.id === H) ?? null,
|
|
871
|
+
[t]
|
|
872
|
+
), {
|
|
873
|
+
selectedRows: I,
|
|
874
|
+
selectedRowsData: k,
|
|
875
|
+
selectionState: O,
|
|
876
|
+
onRowSelectionChange: z,
|
|
877
|
+
onToggleAllRows: F
|
|
878
|
+
} = Ve({ data: t, onRowSelect: p, onSelectedRowsChange: h }), { expandedRowsToRender: E, onRowExpandChange: w } = Le({
|
|
879
|
+
data: t,
|
|
880
|
+
allowMultipleExpandedRows: f,
|
|
881
|
+
controlledExpandedRowId: c,
|
|
882
|
+
onExpandedRowChange: y,
|
|
883
|
+
onRowExpand: T,
|
|
884
|
+
findRowById: M
|
|
885
|
+
}), { multiActions: B, handleMultipleActionClick: R } = De({
|
|
886
|
+
actions: r,
|
|
887
|
+
selectedRowsData: k
|
|
888
|
+
});
|
|
889
|
+
return /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ g("div", { className: `${u} table-main`, children: [
|
|
890
|
+
/* @__PURE__ */ e(Ie, { columns: m, isLoading: l, ...U }),
|
|
891
|
+
l ? /* @__PURE__ */ e(ge, { className: "table-loading" }) : /* @__PURE__ */ e(K, { children: C ? /* @__PURE__ */ e(Me, {}) : /* @__PURE__ */ g(K, { children: [
|
|
892
|
+
!!k.length && /* @__PURE__ */ e(
|
|
893
|
+
ze,
|
|
894
|
+
{
|
|
895
|
+
count: k.length,
|
|
896
|
+
multiActions: B,
|
|
897
|
+
onActionClick: R
|
|
898
|
+
}
|
|
899
|
+
),
|
|
900
|
+
/* @__PURE__ */ e("div", { className: `${i} table-body`, children: /* @__PURE__ */ g("table", { className: "table-content", children: [
|
|
901
|
+
/* @__PURE__ */ e(
|
|
902
|
+
Ce,
|
|
903
|
+
{
|
|
904
|
+
entity: s,
|
|
905
|
+
columns: m,
|
|
906
|
+
onSortCallback: a,
|
|
907
|
+
hasAction: !!r,
|
|
908
|
+
selectionState: O,
|
|
909
|
+
onToggleAllRows: F
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
/* @__PURE__ */ e("tbody", { children: /* @__PURE__ */ e(
|
|
913
|
+
Pe,
|
|
914
|
+
{
|
|
915
|
+
data: t,
|
|
916
|
+
actions: r,
|
|
917
|
+
columns: m,
|
|
918
|
+
softDeleteProperty: o,
|
|
919
|
+
selectedRows: I,
|
|
920
|
+
expandedRows: E,
|
|
921
|
+
onRowSelectionChange: z,
|
|
922
|
+
onRowExpand: T ? w : void 0
|
|
923
|
+
}
|
|
924
|
+
) })
|
|
925
|
+
] }) }),
|
|
926
|
+
/* @__PURE__ */ e(_e, {})
|
|
927
|
+
] }) })
|
|
928
|
+
] }) });
|
|
929
|
+
}
|
|
930
|
+
export {
|
|
931
|
+
xe as A,
|
|
932
|
+
Ce as C,
|
|
933
|
+
Fe as F,
|
|
934
|
+
ke as N,
|
|
935
|
+
Oe as P,
|
|
936
|
+
ve as R,
|
|
937
|
+
Me as T,
|
|
938
|
+
Ne as a,
|
|
939
|
+
Ee as b,
|
|
940
|
+
_e as c,
|
|
941
|
+
Pe as d,
|
|
942
|
+
Ie as e,
|
|
943
|
+
ze as f,
|
|
944
|
+
lt as g,
|
|
945
|
+
Te as r
|
|
946
|
+
};
|