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