triafly-ui-kit 1.0.45 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Ui/Table/Table.js +22 -20
- package/dist/main.d.ts +1 -0
- package/package.json +1 -1
@@ -1,16 +1,16 @@
|
|
1
1
|
import { jsx as n, jsxs as g } from "react/jsx-runtime";
|
2
|
-
import
|
2
|
+
import K, { forwardRef as ee, useState as j, useMemo as te, useCallback as k, useEffect as ne } from "react";
|
3
3
|
import i from "../../../_virtual/index.js";
|
4
4
|
import '../../../assets/src/components/Ui/Table/Table.css';/* empty css */
|
5
|
-
import { IconCaretDown as z, IconCaretUp as
|
5
|
+
import { IconCaretDown as z, IconCaretUp as ae } from "../Icons/Icons.js";
|
6
6
|
import { MemoizedRow as C } from "./MemoizedRow/MemoizedRow.js";
|
7
|
-
import { Loader as
|
8
|
-
import { TableSkeletonRow as
|
7
|
+
import { Loader as re } from "../Loader/Loader.js";
|
8
|
+
import { TableSkeletonRow as se } from "./TableSkeletonRow/TableSkeletonRow.js";
|
9
9
|
const L = {
|
10
10
|
asc: /* @__PURE__ */ n(z, { viewBox: "0 -6 24 24", "aria-hidden": "true" }),
|
11
|
-
desc: /* @__PURE__ */ n(
|
11
|
+
desc: /* @__PURE__ */ n(ae, { viewBox: "0 -4 24 24", "aria-hidden": "true" }),
|
12
12
|
default: /* @__PURE__ */ n(z, { viewBox: "0 -6 24 24", "aria-hidden": "true" })
|
13
|
-
},
|
13
|
+
}, le = ({
|
14
14
|
columns: m,
|
15
15
|
dataSource: l,
|
16
16
|
rowKey: f,
|
@@ -34,11 +34,12 @@ const L = {
|
|
34
34
|
loaderRef: B,
|
35
35
|
externalSorting: D = !1,
|
36
36
|
entities: c,
|
37
|
-
sortedIds: u
|
38
|
-
|
39
|
-
|
37
|
+
sortedIds: u,
|
38
|
+
containerRef: V
|
39
|
+
}, W) => {
|
40
|
+
const T = K.useRef(null), o = !!c && !!u, [A, X] = j(l || []), [s, E] = j(
|
40
41
|
J || null
|
41
|
-
), N =
|
42
|
+
), N = te(() => {
|
42
43
|
if (!o)
|
43
44
|
return D ? l : A;
|
44
45
|
}, [o, l, A, D]), I = k(
|
@@ -47,7 +48,7 @@ const L = {
|
|
47
48
|
E({ key: e, order: t });
|
48
49
|
return;
|
49
50
|
}
|
50
|
-
|
51
|
+
X((_) => [..._].sort((h, M) => {
|
51
52
|
const r = h[e], a = M[e];
|
52
53
|
return typeof r == "string" && typeof a == "string" ? t === "asc" ? r.localeCompare(a) : a.localeCompare(r) : typeof r == "number" && typeof a == "number" ? t === "asc" ? r - a : a - r : r instanceof Date && a instanceof Date ? t === "asc" ? r.getTime() - a.getTime() : a.getTime() - r.getTime() : 0;
|
53
54
|
})), E({ key: e, order: t });
|
@@ -56,14 +57,14 @@ const L = {
|
|
56
57
|
), v = k(
|
57
58
|
(e) => typeof f == "function" ? f(e) : String(e[f]),
|
58
59
|
[f]
|
59
|
-
),
|
60
|
+
), Y = k(
|
60
61
|
(e) => {
|
61
62
|
const _ = (s == null ? void 0 : s.key) === e && s.order === "asc" ? "desc" : "asc";
|
62
63
|
I(e, _);
|
63
64
|
},
|
64
65
|
[s, I]
|
65
66
|
);
|
66
|
-
return
|
67
|
+
return ne(() => {
|
67
68
|
const e = T.current;
|
68
69
|
if (!e) return;
|
69
70
|
const t = (_) => {
|
@@ -75,7 +76,7 @@ const L = {
|
|
75
76
|
const a = c[r];
|
76
77
|
a && d(a);
|
77
78
|
} else {
|
78
|
-
const a = l == null ? void 0 : l.find((
|
79
|
+
const a = l == null ? void 0 : l.find((Z) => v(Z) === r);
|
79
80
|
a && d(a);
|
80
81
|
}
|
81
82
|
};
|
@@ -91,6 +92,7 @@ const L = {
|
|
91
92
|
},
|
92
93
|
$
|
93
94
|
),
|
95
|
+
ref: V,
|
94
96
|
children: /* @__PURE__ */ g(
|
95
97
|
"table",
|
96
98
|
{
|
@@ -98,7 +100,7 @@ const L = {
|
|
98
100
|
bordered: p,
|
99
101
|
borderBottom: y
|
100
102
|
}),
|
101
|
-
ref:
|
103
|
+
ref: W,
|
102
104
|
children: [
|
103
105
|
/* @__PURE__ */ n(
|
104
106
|
"thead",
|
@@ -133,7 +135,7 @@ const L = {
|
|
133
135
|
...e.width ? { width: e.width } : {},
|
134
136
|
...e.align ? { textAlign: e.align } : {}
|
135
137
|
},
|
136
|
-
onClick: () => e.sorted &&
|
138
|
+
onClick: () => e.sorted && Y(e.key),
|
137
139
|
children: /* @__PURE__ */ g("div", { className: "th-content", children: [
|
138
140
|
e.title,
|
139
141
|
e.sorted && /* @__PURE__ */ n("span", { className: "sort-icon", children: (s == null ? void 0 : s.key) === e.key ? L[s.order] : L.default })
|
@@ -180,8 +182,8 @@ const L = {
|
|
180
182
|
},
|
181
183
|
v(e)
|
182
184
|
)),
|
183
|
-
R ? /* @__PURE__ */ n("div", { className: "loading_table_init", children: /* @__PURE__ */ n(
|
184
|
-
!R && Q && B && /* @__PURE__ */ n("tr", { ref: B, children: /* @__PURE__ */ n("td", { colSpan: m.length, children: S || /* @__PURE__ */ n(
|
185
|
+
R ? /* @__PURE__ */ n("div", { className: "loading_table_init", children: /* @__PURE__ */ n(re, { className: "centered" }) }) : null,
|
186
|
+
!R && Q && B && /* @__PURE__ */ n("tr", { ref: B, children: /* @__PURE__ */ n("td", { colSpan: m.length, children: S || /* @__PURE__ */ n(se, { colSpan: m.length }) }) })
|
185
187
|
]
|
186
188
|
}
|
187
189
|
)
|
@@ -190,7 +192,7 @@ const L = {
|
|
190
192
|
)
|
191
193
|
}
|
192
194
|
) });
|
193
|
-
},
|
195
|
+
}, ue = ee(le);
|
194
196
|
export {
|
195
|
-
|
197
|
+
ue as Table
|
196
198
|
};
|
package/dist/main.d.ts
CHANGED
@@ -1181,6 +1181,7 @@ declare type TablesProps<T extends object = Record<string, unknown>> = {
|
|
1181
1181
|
entities?: Record<string, T>;
|
1182
1182
|
sortedIds?: string[];
|
1183
1183
|
externalSorting?: boolean;
|
1184
|
+
containerRef?: default_2.RefObject<HTMLDivElement>;
|
1184
1185
|
};
|
1185
1186
|
|
1186
1187
|
export declare const Tabs: React.FC<TabsProps>;
|