triafly-ui-kit 1.0.39 → 1.0.40
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 +55 -56
- package/dist/main.d.ts +2 -3
- package/package.json +1 -1
@@ -1,22 +1,22 @@
|
|
1
|
-
import { jsx as t, jsxs as
|
2
|
-
import { forwardRef as
|
3
|
-
import
|
1
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as H, useState as y, useEffect as J, useCallback as _ } from "react";
|
3
|
+
import l from "../../../_virtual/index.js";
|
4
4
|
import '../../../assets/src/components/Ui/Table/Table.css';/* empty css */
|
5
|
-
import { IconCaretDown as k, IconCaretUp as
|
6
|
-
import { MemoizedRow as
|
7
|
-
import { Loader as
|
8
|
-
import { TableSkeletonRow as
|
9
|
-
const
|
5
|
+
import { IconCaretDown as k, IconCaretUp as O } from "../Icons/Icons.js";
|
6
|
+
import { MemoizedRow as P } from "./MemoizedRow/MemoizedRow.js";
|
7
|
+
import { Loader as Q } from "../Loader/Loader.js";
|
8
|
+
import { TableSkeletonRow as V } from "./TableSkeletonRow/TableSkeletonRow.js";
|
9
|
+
const v = {
|
10
10
|
asc: /* @__PURE__ */ t(k, { viewBox: "0 -6 24 24", "aria-hidden": "true" }),
|
11
|
-
desc: /* @__PURE__ */ t(
|
11
|
+
desc: /* @__PURE__ */ t(O, { viewBox: "0 -4 24 24", "aria-hidden": "true" }),
|
12
12
|
default: /* @__PURE__ */ t(k, { viewBox: "0 -6 24 24", "aria-hidden": "true" })
|
13
|
-
},
|
13
|
+
}, W = ({
|
14
14
|
columns: o,
|
15
15
|
dataSource: p,
|
16
|
-
rowKey:
|
17
|
-
tableClassName:
|
18
|
-
theadClassName:
|
19
|
-
trTheadClassNames:
|
16
|
+
rowKey: i,
|
17
|
+
tableClassName: x,
|
18
|
+
theadClassName: D,
|
19
|
+
trTheadClassNames: I,
|
20
20
|
thTheadClassNames: S,
|
21
21
|
tbodyClassName: A,
|
22
22
|
wrapperClassName: C,
|
@@ -27,76 +27,75 @@ const x = {
|
|
27
27
|
rowClassName: j,
|
28
28
|
defaultSort: B,
|
29
29
|
onClickTr: m,
|
30
|
-
onClickTrHeader:
|
30
|
+
onClickTrHeader: R,
|
31
31
|
loading: b = !1,
|
32
|
-
hasMore:
|
33
|
-
loadingIndicator:
|
34
|
-
|
35
|
-
|
32
|
+
hasMore: z = !1,
|
33
|
+
loadingIndicator: $,
|
34
|
+
loaderRef: g
|
35
|
+
}, E) => {
|
36
|
+
const [L, w] = y(p), [n, M] = y(
|
36
37
|
B || null
|
37
38
|
);
|
38
|
-
|
39
|
+
J(() => {
|
39
40
|
w(p);
|
40
|
-
}, [p])
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
(e) => typeof l == "function" ? l(e) : typeof l == "string" && l in e ? String(e[l]) : "unknown",
|
45
|
-
[l]
|
41
|
+
}, [p]);
|
42
|
+
const U = _(
|
43
|
+
(e) => typeof i == "function" ? i(e) : typeof i == "string" && i in e ? String(e[i]) : "unknown",
|
44
|
+
[i]
|
46
45
|
), N = _((e, a) => {
|
47
|
-
w((
|
48
|
-
const s =
|
46
|
+
w((d) => [...d].sort((F, G) => {
|
47
|
+
const s = F[e], r = G[e];
|
49
48
|
return typeof s == "string" && typeof r == "string" ? a === "asc" ? s.localeCompare(r) : r.localeCompare(s) : typeof s == "number" && typeof r == "number" ? a === "asc" ? s - r : r - s : s instanceof Date && r instanceof Date ? a === "asc" ? s.getTime() - r.getTime() : r.getTime() - s.getTime() : 0;
|
50
|
-
})),
|
51
|
-
}, []),
|
49
|
+
})), M({ key: e, order: a });
|
50
|
+
}, []), q = _(
|
52
51
|
(e) => {
|
53
|
-
const
|
54
|
-
N(e,
|
52
|
+
const d = (n == null ? void 0 : n.key) === e && n.order === "asc" ? "desc" : "asc";
|
53
|
+
N(e, d);
|
55
54
|
},
|
56
55
|
[n, N]
|
57
56
|
);
|
58
|
-
return /* @__PURE__ */ t("div", { className:
|
57
|
+
return /* @__PURE__ */ t("div", { className: l("table-component", C), children: /* @__PURE__ */ t(
|
59
58
|
"div",
|
60
59
|
{
|
61
|
-
className:
|
60
|
+
className: l(
|
62
61
|
"table-component__wrapper",
|
63
62
|
{
|
64
63
|
bordered: c,
|
65
64
|
borderBottom: h
|
66
65
|
},
|
67
|
-
|
66
|
+
x
|
68
67
|
),
|
69
|
-
children: /* @__PURE__ */
|
68
|
+
children: /* @__PURE__ */ f(
|
70
69
|
"table",
|
71
70
|
{
|
72
|
-
className:
|
71
|
+
className: l("table-component__wrapper__table", {
|
73
72
|
bordered: c,
|
74
73
|
borderBottom: h
|
75
74
|
}),
|
76
|
-
ref:
|
75
|
+
ref: E,
|
77
76
|
children: [
|
78
77
|
/* @__PURE__ */ t(
|
79
78
|
"thead",
|
80
79
|
{
|
81
|
-
className:
|
80
|
+
className: l(
|
82
81
|
"table-component__wrapper__table__thead",
|
83
82
|
{
|
84
83
|
stickyHeader: T
|
85
84
|
},
|
86
|
-
|
85
|
+
D
|
87
86
|
),
|
88
87
|
children: /* @__PURE__ */ t(
|
89
88
|
"tr",
|
90
89
|
{
|
91
|
-
className:
|
90
|
+
className: l(
|
92
91
|
"table-component__wrapper__table__thead__tr",
|
93
|
-
|
92
|
+
I
|
94
93
|
),
|
95
|
-
onClick:
|
94
|
+
onClick: R,
|
96
95
|
children: o.map((e, a) => /* @__PURE__ */ t(
|
97
96
|
"th",
|
98
97
|
{
|
99
|
-
className:
|
98
|
+
className: l(
|
100
99
|
"table-component__wrapper__table__thead__th",
|
101
100
|
{
|
102
101
|
bordered: c,
|
@@ -108,10 +107,10 @@ const x = {
|
|
108
107
|
...e.width ? { width: e.width } : {},
|
109
108
|
...e.align ? { textAlign: e.align } : {}
|
110
109
|
},
|
111
|
-
onClick: () => e.sorted &&
|
112
|
-
children: /* @__PURE__ */
|
110
|
+
onClick: () => e.sorted && q(e.key),
|
111
|
+
children: /* @__PURE__ */ f("div", { className: "th-content", children: [
|
113
112
|
e.title,
|
114
|
-
e.sorted && /* @__PURE__ */ t("span", { className: "sort-icon", children: (n == null ? void 0 : n.key) === e.key ?
|
113
|
+
e.sorted && /* @__PURE__ */ t("span", { className: "sort-icon", children: (n == null ? void 0 : n.key) === e.key ? v[n.order] : v.default })
|
115
114
|
] })
|
116
115
|
},
|
117
116
|
`${e.key}-${a}`
|
@@ -120,20 +119,20 @@ const x = {
|
|
120
119
|
)
|
121
120
|
}
|
122
121
|
),
|
123
|
-
/* @__PURE__ */
|
124
|
-
|
125
|
-
|
122
|
+
/* @__PURE__ */ f("tbody", { className: l("table-component__wrapper__table__tbody", A), children: [
|
123
|
+
L.map((e, a) => /* @__PURE__ */ t(
|
124
|
+
P,
|
126
125
|
{
|
127
126
|
record: e,
|
128
127
|
onClickTr: () => m == null ? void 0 : m(e),
|
129
128
|
columns: o,
|
130
|
-
rowKey:
|
129
|
+
rowKey: i,
|
131
130
|
rowClassName: j,
|
132
131
|
index: a,
|
133
132
|
stickyLeft: u,
|
134
133
|
bordered: c
|
135
134
|
},
|
136
|
-
|
135
|
+
U(e)
|
137
136
|
)),
|
138
137
|
b ? /* @__PURE__ */ t(
|
139
138
|
"div",
|
@@ -150,17 +149,17 @@ const x = {
|
|
150
149
|
backgroundColor: "rgba(255, 255, 255, 0.7)",
|
151
150
|
zIndex: 10
|
152
151
|
},
|
153
|
-
children: /* @__PURE__ */ t(
|
152
|
+
children: /* @__PURE__ */ t(Q, { className: "centered" })
|
154
153
|
}
|
155
154
|
) : null,
|
156
|
-
!b &&
|
155
|
+
!b && z && g && /* @__PURE__ */ t("tr", { ref: g, children: /* @__PURE__ */ t("td", { colSpan: o.length, children: $ || /* @__PURE__ */ t(V, { colSpan: o.length }) }) })
|
157
156
|
] })
|
158
157
|
]
|
159
158
|
}
|
160
159
|
)
|
161
160
|
}
|
162
161
|
) });
|
163
|
-
},
|
162
|
+
}, re = H(W);
|
164
163
|
export {
|
165
|
-
|
164
|
+
re as Table
|
166
165
|
};
|
package/dist/main.d.ts
CHANGED
@@ -1150,9 +1150,7 @@ export declare interface TabItem {
|
|
1150
1150
|
}
|
1151
1151
|
|
1152
1152
|
export declare const Table: <T extends object>(props: TablesProps<T> & {
|
1153
|
-
ref?: default_2.ForwardedRef<
|
1154
|
-
loaderRef: HTMLTableRowElement | null;
|
1155
|
-
}>;
|
1153
|
+
ref?: default_2.ForwardedRef<HTMLTableElement>;
|
1156
1154
|
}) => JSX.Element;
|
1157
1155
|
|
1158
1156
|
declare type TablesProps<T extends object = Record<string, unknown>> = {
|
@@ -1179,6 +1177,7 @@ declare type TablesProps<T extends object = Record<string, unknown>> = {
|
|
1179
1177
|
loading?: boolean;
|
1180
1178
|
hasMore?: boolean;
|
1181
1179
|
loadingIndicator?: default_2.ReactNode;
|
1180
|
+
loaderRef?: default_2.Ref<HTMLTableRowElement>;
|
1182
1181
|
};
|
1183
1182
|
|
1184
1183
|
export declare const Tabs: React.FC<TabsProps>;
|