qaema-ui 0.0.76 → 0.0.77
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.
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useState as b, useId as X, useEffect as
|
|
2
|
+
import { useState as b, useId as X, useEffect as z, useMemo as Y } from "react";
|
|
3
3
|
import { useTranslation as H } from "react-i18next";
|
|
4
4
|
import { Tooltip as D } from "../../../node_modules/react-tooltip/dist/react-tooltip.min.js";
|
|
5
5
|
import k from "../../Spinner.js";
|
|
6
6
|
import F from "../../Pagination.js";
|
|
7
7
|
import R from "../../Typography.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { TableContainer as ee, LoadingOverlay as te, TablesWrapper as ne, DataScrollBox as se, StyledTable as re, TableBody as
|
|
11
|
-
function
|
|
8
|
+
import L, { CheckboxCell as w } from "./components/CellComponents.js";
|
|
9
|
+
import O from "./components/TableHead.js";
|
|
10
|
+
import { TableContainer as ee, LoadingOverlay as te, TablesWrapper as ne, DataScrollBox as se, StyledTable as re, TableBody as W, EmptyState as le, TableRow as N, TableCellContainer as C, ActionsTable as ie, TableFooter as ce } from "./Table.styles.js";
|
|
11
|
+
function $e({
|
|
12
12
|
columns: S,
|
|
13
13
|
data: n,
|
|
14
14
|
keyField: i,
|
|
15
15
|
selectable: p = !1,
|
|
16
16
|
onRowSelect: x,
|
|
17
|
-
rowActions:
|
|
17
|
+
rowActions: f,
|
|
18
18
|
stickyHeader: T = !1,
|
|
19
|
-
loading:
|
|
19
|
+
loading: u = !1,
|
|
20
20
|
emptyStateMessage: K,
|
|
21
21
|
pagination: l,
|
|
22
22
|
onRowClick: j,
|
|
@@ -26,40 +26,40 @@ function ge({
|
|
|
26
26
|
alignHeader: B = "start",
|
|
27
27
|
// Dropdown related props
|
|
28
28
|
isTableHeadVisible: M = !1,
|
|
29
|
-
isRowSelected:
|
|
29
|
+
isRowSelected: I,
|
|
30
30
|
getRowTooltip: m
|
|
31
31
|
}) {
|
|
32
|
-
const [h,
|
|
33
|
-
|
|
32
|
+
const [h, g] = b([]), [A, $] = b(_), [V, E] = b(null), { t: Z } = H(), y = X();
|
|
33
|
+
z(() => {
|
|
34
34
|
const e = () => {
|
|
35
|
-
|
|
35
|
+
E(null);
|
|
36
36
|
};
|
|
37
37
|
return document.addEventListener("click", e), () => {
|
|
38
38
|
document.removeEventListener("click", e);
|
|
39
39
|
};
|
|
40
|
-
}, []),
|
|
40
|
+
}, []), z(() => {
|
|
41
41
|
const e = () => {
|
|
42
42
|
const s = window.innerWidth;
|
|
43
|
-
s < 576 ?
|
|
43
|
+
s < 576 ? $("sm") : s < 992 ? $("md") : $("lg");
|
|
44
44
|
};
|
|
45
45
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
46
46
|
}, []);
|
|
47
|
-
const v = Y(() => S.filter((e) => typeof e.hidden == "function" ? !e.hidden(
|
|
48
|
-
h.length === n.length ?
|
|
47
|
+
const v = Y(() => S.filter((e) => typeof e.hidden == "function" ? !e.hidden(A) : !e.hidden), [S, A]), q = () => {
|
|
48
|
+
h.length === n.length ? g([]) : g([...n]), x && x(h.length === n.length ? [] : [...n]);
|
|
49
49
|
}, G = (e) => {
|
|
50
50
|
const s = h.filter((r) => e[i] === r[i]);
|
|
51
51
|
return s && s.length > 0;
|
|
52
52
|
}, J = (e) => {
|
|
53
53
|
const s = h.some((d) => d[i] === e[i]);
|
|
54
54
|
let r;
|
|
55
|
-
s ? r = h.filter((d) => d[i] !== e[i]) : r = [...h, e],
|
|
55
|
+
s ? r = h.filter((d) => d[i] !== e[i]) : r = [...h, e], g(r), x && x(r);
|
|
56
56
|
};
|
|
57
57
|
return /* @__PURE__ */ t.jsxs(ee, { children: [
|
|
58
|
-
|
|
58
|
+
u && /* @__PURE__ */ t.jsx(te, { children: /* @__PURE__ */ t.jsx(k, { size: "3rem" }) }),
|
|
59
59
|
/* @__PURE__ */ t.jsxs(ne, { children: [
|
|
60
60
|
/* @__PURE__ */ t.jsx(se, { children: /* @__PURE__ */ t.jsxs(re, { children: [
|
|
61
61
|
M && /* @__PURE__ */ t.jsx(
|
|
62
|
-
|
|
62
|
+
O,
|
|
63
63
|
{
|
|
64
64
|
data: n,
|
|
65
65
|
handleSelectAll: q,
|
|
@@ -69,11 +69,11 @@ function ge({
|
|
|
69
69
|
rowActions: void 0,
|
|
70
70
|
stickyHeader: T,
|
|
71
71
|
selectable: p,
|
|
72
|
-
loading:
|
|
72
|
+
loading: u
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
/* @__PURE__ */ t.jsx(
|
|
76
|
-
const r = (o == null ? void 0 : o(e)) ?? !1, d =
|
|
75
|
+
/* @__PURE__ */ t.jsx(W, { children: n.length === 0 ? /* @__PURE__ */ t.jsx("tr", { children: /* @__PURE__ */ t.jsx("td", { colSpan: (p ? 1 : 0) + v.length, children: /* @__PURE__ */ t.jsx(le, { children: /* @__PURE__ */ t.jsx(R, { variant: "mdText", children: K ?? Z("NO_DATA_AVAILABLE") }) }) }) }) : n == null ? void 0 : n.map((e, s) => {
|
|
76
|
+
const r = (o == null ? void 0 : o(e)) ?? !1, d = I ? I(e) : h.some((c) => c[i] === e[i]), P = e[i], Q = (a == null ? void 0 : a(e, s)) ?? "", U = (m == null ? void 0 : m(e)) ? `${y}-${String(P)}` : void 0;
|
|
77
77
|
return /* @__PURE__ */ t.jsxs(
|
|
78
78
|
N,
|
|
79
79
|
{
|
|
@@ -97,7 +97,7 @@ function ge({
|
|
|
97
97
|
}
|
|
98
98
|
) }),
|
|
99
99
|
v.map((c) => /* @__PURE__ */ t.jsx(C, { $align: c.align, children: /* @__PURE__ */ t.jsx(
|
|
100
|
-
|
|
100
|
+
L,
|
|
101
101
|
{
|
|
102
102
|
column: c,
|
|
103
103
|
row: e,
|
|
@@ -115,9 +115,9 @@ function ge({
|
|
|
115
115
|
);
|
|
116
116
|
}) })
|
|
117
117
|
] }) }),
|
|
118
|
-
|
|
118
|
+
f && f.length > 0 && /* @__PURE__ */ t.jsxs(ie, { children: [
|
|
119
119
|
/* @__PURE__ */ t.jsx(
|
|
120
|
-
|
|
120
|
+
O,
|
|
121
121
|
{
|
|
122
122
|
data: n,
|
|
123
123
|
handleSelectAll: () => {
|
|
@@ -125,24 +125,24 @@ function ge({
|
|
|
125
125
|
selectedRows: h,
|
|
126
126
|
visibleColumns: [],
|
|
127
127
|
alignHeader: B,
|
|
128
|
-
rowActions:
|
|
128
|
+
rowActions: f,
|
|
129
129
|
stickyHeader: T,
|
|
130
130
|
selectable: !1,
|
|
131
|
-
loading:
|
|
131
|
+
loading: u
|
|
132
132
|
}
|
|
133
133
|
),
|
|
134
|
-
/* @__PURE__ */ t.jsx(
|
|
134
|
+
/* @__PURE__ */ t.jsx(W, { children: n.length === 0 ? /* @__PURE__ */ t.jsx("tr", { children: /* @__PURE__ */ t.jsx("td", { children: /* @__PURE__ */ t.jsx("div", { style: { height: "3.5rem" } }) }) }) : n == null ? void 0 : n.map((e) => {
|
|
135
135
|
const s = (o == null ? void 0 : o(e)) ?? !1;
|
|
136
136
|
return /* @__PURE__ */ t.jsx(N, { $disabled: s, children: /* @__PURE__ */ t.jsx(C, { $align: "center", $isActionCell: !0, children: /* @__PURE__ */ t.jsx(
|
|
137
|
-
|
|
137
|
+
L,
|
|
138
138
|
{
|
|
139
139
|
row: e,
|
|
140
140
|
type: "icon",
|
|
141
141
|
iconOptions: {
|
|
142
142
|
keyField: i,
|
|
143
|
-
rowActions:
|
|
143
|
+
rowActions: f,
|
|
144
144
|
activeDropdown: V,
|
|
145
|
-
setActiveDropdown:
|
|
145
|
+
setActiveDropdown: E
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
) }) }, `action-${e[i]}`);
|
|
@@ -152,8 +152,8 @@ function ge({
|
|
|
152
152
|
m && n.map((e) => {
|
|
153
153
|
const s = m(e);
|
|
154
154
|
if (!s) return null;
|
|
155
|
-
const r = e[i], d = `${
|
|
156
|
-
return /* @__PURE__ */ t.jsx(D, { id: d, content: s }, d);
|
|
155
|
+
const r = e[i], d = `${y}-${String(r)}`;
|
|
156
|
+
return /* @__PURE__ */ t.jsx(D, { id: d, content: s, positionStrategy: "fixed", style: { zIndex: 9999 } }, d);
|
|
157
157
|
}),
|
|
158
158
|
l && l.enabled && /* @__PURE__ */ t.jsx(ce, { children: /* @__PURE__ */ t.jsx(
|
|
159
159
|
F,
|
|
@@ -161,7 +161,7 @@ function ge({
|
|
|
161
161
|
currentPage: l.currentPage,
|
|
162
162
|
totalPages: l.totalPages,
|
|
163
163
|
onChange: l.onPageChange,
|
|
164
|
-
disabled:
|
|
164
|
+
disabled: u,
|
|
165
165
|
hidePrevButton: l.hidePrevButton,
|
|
166
166
|
hideNextButton: l.hideNextButton,
|
|
167
167
|
siblingCount: l.siblingCount,
|
|
@@ -175,5 +175,5 @@ function ge({
|
|
|
175
175
|
] });
|
|
176
176
|
}
|
|
177
177
|
export {
|
|
178
|
-
|
|
178
|
+
$e as default
|
|
179
179
|
};
|