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