triafly-ui-kit 1.0.40 → 1.0.42
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/_virtual/index2.js +2 -5
- package/dist/assets/src/components/Ui/Table/Table.css +1 -1
- package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +30 -31
- package/dist/components/Ui/Table/Table.js +145 -114
- package/dist/main.d.ts +3 -0
- package/dist/node_modules/classnames/index.js +1 -1
- package/package.json +1 -1
- package/dist/_virtual/index3.js +0 -4
- package/dist/node_modules/fast-deep-equal/index.js +0 -31
package/dist/_virtual/index2.js
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
import { __require as r } from "../node_modules/fast-deep-equal/index.js";
|
3
|
-
var t = r();
|
4
|
-
const p = /* @__PURE__ */ e(t);
|
1
|
+
var s = { exports: {} };
|
5
2
|
export {
|
6
|
-
|
3
|
+
s as __module
|
7
4
|
};
|
@@ -1 +1 @@
|
|
1
|
-
.table-component{width:100%;overflow:auto;position:relative}.table-component__wrapper{width:100%}.table-component__wrapper.bordered{border:1px solid var(--color-border-primary-default);border-radius:8px}.table-component__wrapper__table{width:100%;border-collapse:separate;border-spacing:0}.table-component__wrapper__table.bordered{border:none}.table-component__wrapper__table__thead{background-color:var(--color-bg-innerisland-default);height:41px}.table-component__wrapper__table__thead.stickyHeader{position:sticky;top:0;z-index:10}.table-component__wrapper__table__thead__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__thead__th{padding:12px;text-align:left;position:relative}.table-component__wrapper__table__thead__th.bordered{border-left:1px solid var(--color-border-primary-default);border-bottom:none}.table-component__wrapper__table__thead__th.bordered:first-child{border-left:none}.table-component__wrapper__table__thead__th.stickyLeft{position:sticky;left:0;background-color:inherit;z-index:9}.table-component__wrapper__table__thead__th .th-content{display:flex;align-items:center;gap:4px}.table-component__wrapper__table__thead__th .sort-icon{display:inline-flex}.table-component__wrapper__table__tbody__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__tbody--hoverable{cursor:pointer}.table-component__wrapper__table__tbody__td{padding:12px}.table-component__wrapper__table__tbody__td--bordered{border-top:1px solid var(--color-border-primary-default);border-left:1px solid var(--color-border-primary-default)}.table-component__wrapper__table__tbody__td--bordered:first-child{border-left:none}.table-component__wrapper__table__tbody__td--sticky-left{position:sticky;left:0;background-color:inherit;z-index:8}.table-component__wrapper.borderBottom .table-component__wrapper__table__tbody td{border-bottom:1px solid var(--color-border-primary-default)}
|
1
|
+
.table-component{width:100%;overflow:auto;position:relative}.table-component__wrapper{width:100%}.table-component__wrapper.bordered{border:1px solid var(--color-border-primary-default);border-radius:8px}.table-component__wrapper__table{width:100%;border-collapse:separate;border-spacing:0}.table-component__wrapper__table.bordered{border:none}.table-component__wrapper__table__thead{background-color:var(--color-bg-innerisland-default);height:41px}.table-component__wrapper__table__thead.stickyHeader{position:sticky;top:0;z-index:10}.table-component__wrapper__table__thead__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__thead__th{padding:12px;text-align:left;position:relative}.table-component__wrapper__table__thead__th.bordered{border-left:1px solid var(--color-border-primary-default);border-bottom:none}.table-component__wrapper__table__thead__th.bordered:first-child{border-left:none}.table-component__wrapper__table__thead__th.stickyLeft{position:sticky;left:0;background-color:inherit;z-index:9}.table-component__wrapper__table__thead__th .th-content{display:flex;align-items:center;gap:4px}.table-component__wrapper__table__thead__th .sort-icon{display:inline-flex}.table-component__wrapper__table__tbody__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__tbody--hoverable{cursor:pointer}.table-component__wrapper__table__tbody__td{padding:12px}.table-component__wrapper__table__tbody__td--bordered{border-top:1px solid var(--color-border-primary-default);border-left:1px solid var(--color-border-primary-default)}.table-component__wrapper__table__tbody__td--bordered:first-child{border-left:none}.table-component__wrapper__table__tbody__td--sticky-left{position:sticky;left:0;background-color:inherit;z-index:8}.table-component__wrapper.borderBottom .table-component__wrapper__table__tbody td{border-bottom:1px solid var(--color-border-primary-default)}.loading_table_init{position:absolute;top:0;left:0;right:0;bottom:0;display:"flex";justify-content:"center";align-items:"center";background-color:"rgba(255, 255, 255, 0.7)";z-index:10}
|
@@ -1,50 +1,49 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import
|
3
|
-
import
|
4
|
-
|
5
|
-
const h = c.memo(
|
1
|
+
import { jsx as b } from "react/jsx-runtime";
|
2
|
+
import f from "react";
|
3
|
+
import o from "../../../../_virtual/index.js";
|
4
|
+
const K = f.memo(
|
6
5
|
({
|
7
6
|
record: t,
|
8
|
-
columns:
|
7
|
+
columns: n,
|
9
8
|
rowKey: a,
|
10
|
-
rowClassName:
|
11
|
-
index:
|
12
|
-
stickyLeft:
|
13
|
-
|
14
|
-
|
9
|
+
rowClassName: d,
|
10
|
+
index: i,
|
11
|
+
stickyLeft: e,
|
12
|
+
bordered: y,
|
13
|
+
id: c
|
15
14
|
}) => {
|
16
|
-
const
|
17
|
-
|
18
|
-
};
|
19
|
-
return /* @__PURE__ */ p(
|
15
|
+
const m = c || (typeof a == "function" ? a(t) : String(t[a]));
|
16
|
+
return /* @__PURE__ */ b(
|
20
17
|
"tr",
|
21
18
|
{
|
22
|
-
|
19
|
+
"data-id": m,
|
20
|
+
className: o(
|
23
21
|
"table-component__wrapper__table__tbody__tr",
|
24
|
-
|
25
|
-
{
|
26
|
-
"table-component__wrapper__table__tbody__tr--hoverable": !!b
|
27
|
-
}
|
22
|
+
d == null ? void 0 : d(t, i)
|
28
23
|
),
|
29
|
-
|
30
|
-
children: _.map((e, o) => /* @__PURE__ */ p(
|
24
|
+
children: n.map((_, r) => /* @__PURE__ */ b(
|
31
25
|
"td",
|
32
26
|
{
|
33
|
-
className:
|
34
|
-
"table-component__wrapper__table__tbody__td--bordered":
|
35
|
-
"table-component__wrapper__table__tbody__td--sticky-left":
|
27
|
+
className: o("table-component__wrapper__table__tbody__td", _.className, {
|
28
|
+
"table-component__wrapper__table__tbody__td--bordered": y,
|
29
|
+
"table-component__wrapper__table__tbody__td--sticky-left": e && r === 0
|
36
30
|
}),
|
37
|
-
align:
|
38
|
-
children:
|
31
|
+
align: _.align,
|
32
|
+
children: _.render ? _.render(t[_.dataIndex], t) : String(t[_.dataIndex] ?? "")
|
39
33
|
},
|
40
|
-
`${
|
34
|
+
`${_.key}-${r}`
|
41
35
|
))
|
42
36
|
},
|
43
|
-
|
37
|
+
m
|
44
38
|
);
|
45
39
|
},
|
46
|
-
(t,
|
40
|
+
(t, n) => {
|
41
|
+
if (t.id && n.id)
|
42
|
+
return t.id === n.id;
|
43
|
+
const a = (e) => typeof e.rowKey == "function" ? e.rowKey(e.record) : String(e.record[e.rowKey]), d = a(t), i = a(n);
|
44
|
+
return d !== i ? !1 : t.columns === n.columns;
|
45
|
+
}
|
47
46
|
);
|
48
47
|
export {
|
49
|
-
|
48
|
+
K as MemoizedRow
|
50
49
|
};
|
@@ -1,165 +1,196 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { forwardRef as
|
3
|
-
import
|
1
|
+
import { jsx as n, jsxs as g } from "react/jsx-runtime";
|
2
|
+
import Z, { forwardRef as K, useState as M, useMemo as ee, useCallback as k, useEffect as te } from "react";
|
3
|
+
import o from "../../../_virtual/index.js";
|
4
4
|
import '../../../assets/src/components/Ui/Table/Table.css';/* empty css */
|
5
|
-
import { IconCaretDown as
|
6
|
-
import { MemoizedRow as
|
7
|
-
import { Loader as
|
8
|
-
import { TableSkeletonRow as
|
9
|
-
const
|
10
|
-
asc: /* @__PURE__ */
|
11
|
-
desc: /* @__PURE__ */
|
12
|
-
default: /* @__PURE__ */
|
13
|
-
},
|
14
|
-
columns:
|
15
|
-
dataSource:
|
5
|
+
import { IconCaretDown as j, IconCaretUp as ne } from "../Icons/Icons.js";
|
6
|
+
import { MemoizedRow as z } from "./MemoizedRow/MemoizedRow.js";
|
7
|
+
import { Loader as ae } from "../Loader/Loader.js";
|
8
|
+
import { TableSkeletonRow as re } from "./TableSkeletonRow/TableSkeletonRow.js";
|
9
|
+
const C = {
|
10
|
+
asc: /* @__PURE__ */ n(j, { viewBox: "0 -6 24 24", "aria-hidden": "true" }),
|
11
|
+
desc: /* @__PURE__ */ n(ne, { viewBox: "0 -4 24 24", "aria-hidden": "true" }),
|
12
|
+
default: /* @__PURE__ */ n(j, { viewBox: "0 -6 24 24", "aria-hidden": "true" })
|
13
|
+
}, se = ({
|
14
|
+
columns: f,
|
15
|
+
dataSource: m,
|
16
16
|
rowKey: i,
|
17
|
-
tableClassName:
|
18
|
-
theadClassName:
|
19
|
-
trTheadClassNames:
|
20
|
-
thTheadClassNames:
|
21
|
-
tbodyClassName:
|
22
|
-
wrapperClassName:
|
23
|
-
borderBottom:
|
24
|
-
stickyHeader:
|
25
|
-
stickyLeft:
|
26
|
-
bordered:
|
27
|
-
rowClassName:
|
28
|
-
defaultSort:
|
29
|
-
onClickTr:
|
30
|
-
onClickTrHeader:
|
31
|
-
loading:
|
32
|
-
hasMore:
|
33
|
-
loadingIndicator:
|
34
|
-
loaderRef:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
17
|
+
tableClassName: L,
|
18
|
+
theadClassName: $,
|
19
|
+
trTheadClassNames: O,
|
20
|
+
thTheadClassNames: U,
|
21
|
+
tbodyClassName: q,
|
22
|
+
wrapperClassName: F,
|
23
|
+
borderBottom: y = !1,
|
24
|
+
stickyHeader: G = !1,
|
25
|
+
stickyLeft: b = !1,
|
26
|
+
bordered: p = !1,
|
27
|
+
rowClassName: x,
|
28
|
+
defaultSort: H,
|
29
|
+
onClickTr: _,
|
30
|
+
onClickTrHeader: J,
|
31
|
+
loading: R = !1,
|
32
|
+
hasMore: P = !1,
|
33
|
+
loadingIndicator: Q,
|
34
|
+
loaderRef: B,
|
35
|
+
externalSorting: D = !1,
|
36
|
+
entities: c,
|
37
|
+
sortedIds: u
|
38
|
+
}, V) => {
|
39
|
+
const T = Z.useRef(null), l = !!c && !!u, [A, W] = M(m || []), [s, S] = M(
|
40
|
+
H || null
|
41
|
+
), N = ee(() => {
|
42
|
+
if (!l)
|
43
|
+
return D ? m : A;
|
44
|
+
}, [l, m, A, D]), E = k(
|
45
|
+
(e, t) => {
|
46
|
+
if (l) {
|
47
|
+
S({ key: e, order: t });
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
W((d) => [...d].sort((h, I) => {
|
51
|
+
const r = h[e], a = I[e];
|
52
|
+
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
|
+
})), S({ key: e, order: t });
|
54
|
+
},
|
55
|
+
[l]
|
56
|
+
), v = k(
|
57
|
+
(e) => typeof i == "function" ? i(e) : String(e[i]),
|
44
58
|
[i]
|
45
|
-
),
|
46
|
-
w((d) => [...d].sort((F, G) => {
|
47
|
-
const s = F[e], r = G[e];
|
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;
|
49
|
-
})), M({ key: e, order: a });
|
50
|
-
}, []), q = _(
|
59
|
+
), X = k(
|
51
60
|
(e) => {
|
52
|
-
const d = (
|
53
|
-
|
61
|
+
const d = (s == null ? void 0 : s.key) === e && s.order === "asc" ? "desc" : "asc";
|
62
|
+
E(e, d);
|
54
63
|
},
|
55
|
-
[
|
64
|
+
[s, E]
|
56
65
|
);
|
57
|
-
return
|
66
|
+
return te(() => {
|
67
|
+
const e = T.current;
|
68
|
+
if (!e) return;
|
69
|
+
const t = (d) => {
|
70
|
+
const w = d.target, h = w.closest("tr");
|
71
|
+
if (!h || w.closest("[data-no-bubble]")) return;
|
72
|
+
const r = h.dataset.id;
|
73
|
+
if (!(!r || !_))
|
74
|
+
if (l && c) {
|
75
|
+
const a = c[r];
|
76
|
+
a && _(a);
|
77
|
+
} else {
|
78
|
+
const a = m.find((Y) => v(Y) === r);
|
79
|
+
a && _(a);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
return e.addEventListener("click", t), () => e.removeEventListener("click", t);
|
83
|
+
}, [m, _, v, l, c]), /* @__PURE__ */ n("div", { className: o("table-component", F), children: /* @__PURE__ */ n(
|
58
84
|
"div",
|
59
85
|
{
|
60
|
-
className:
|
86
|
+
className: o(
|
61
87
|
"table-component__wrapper",
|
62
88
|
{
|
63
|
-
bordered:
|
64
|
-
borderBottom:
|
89
|
+
bordered: p,
|
90
|
+
borderBottom: y
|
65
91
|
},
|
66
|
-
|
92
|
+
L
|
67
93
|
),
|
68
|
-
children: /* @__PURE__ */
|
94
|
+
children: /* @__PURE__ */ g(
|
69
95
|
"table",
|
70
96
|
{
|
71
|
-
className:
|
72
|
-
bordered:
|
73
|
-
borderBottom:
|
97
|
+
className: o("table-component__wrapper__table", {
|
98
|
+
bordered: p,
|
99
|
+
borderBottom: y
|
74
100
|
}),
|
75
|
-
ref:
|
101
|
+
ref: V,
|
76
102
|
children: [
|
77
|
-
/* @__PURE__ */
|
103
|
+
/* @__PURE__ */ n(
|
78
104
|
"thead",
|
79
105
|
{
|
80
|
-
className:
|
106
|
+
className: o(
|
81
107
|
"table-component__wrapper__table__thead",
|
82
108
|
{
|
83
|
-
stickyHeader:
|
109
|
+
stickyHeader: G
|
84
110
|
},
|
85
|
-
|
111
|
+
$
|
86
112
|
),
|
87
|
-
children: /* @__PURE__ */
|
113
|
+
children: /* @__PURE__ */ n(
|
88
114
|
"tr",
|
89
115
|
{
|
90
|
-
className:
|
116
|
+
className: o(
|
91
117
|
"table-component__wrapper__table__thead__tr",
|
92
|
-
|
118
|
+
O
|
93
119
|
),
|
94
|
-
onClick:
|
95
|
-
children:
|
120
|
+
onClick: J,
|
121
|
+
children: f.map((e, t) => /* @__PURE__ */ n(
|
96
122
|
"th",
|
97
123
|
{
|
98
|
-
className:
|
124
|
+
className: o(
|
99
125
|
"table-component__wrapper__table__thead__th",
|
100
126
|
{
|
101
|
-
bordered:
|
102
|
-
stickyLeft:
|
127
|
+
bordered: p,
|
128
|
+
stickyLeft: b && t === 0
|
103
129
|
},
|
104
|
-
|
130
|
+
U
|
105
131
|
),
|
106
132
|
style: {
|
107
133
|
...e.width ? { width: e.width } : {},
|
108
134
|
...e.align ? { textAlign: e.align } : {}
|
109
135
|
},
|
110
|
-
onClick: () => e.sorted &&
|
111
|
-
children: /* @__PURE__ */
|
136
|
+
onClick: () => e.sorted && X(e.key),
|
137
|
+
children: /* @__PURE__ */ g("div", { className: "th-content", children: [
|
112
138
|
e.title,
|
113
|
-
e.sorted && /* @__PURE__ */
|
139
|
+
e.sorted && /* @__PURE__ */ n("span", { className: "sort-icon", children: (s == null ? void 0 : s.key) === e.key ? C[s.order] : C.default })
|
114
140
|
] })
|
115
141
|
},
|
116
|
-
`${e.key}-${
|
142
|
+
`${e.key}-${t}`
|
117
143
|
))
|
118
144
|
}
|
119
145
|
)
|
120
146
|
}
|
121
147
|
),
|
122
|
-
/* @__PURE__ */
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
148
|
+
/* @__PURE__ */ g(
|
149
|
+
"tbody",
|
150
|
+
{
|
151
|
+
ref: T,
|
152
|
+
className: o("table-component__wrapper__table__tbody", q),
|
153
|
+
children: [
|
154
|
+
l && u ? u.map((e) => {
|
155
|
+
const t = c == null ? void 0 : c[e];
|
156
|
+
return t ? /* @__PURE__ */ n(
|
157
|
+
z,
|
158
|
+
{
|
159
|
+
record: t,
|
160
|
+
columns: f,
|
161
|
+
rowKey: i,
|
162
|
+
rowClassName: x,
|
163
|
+
index: u.indexOf(e),
|
164
|
+
stickyLeft: b,
|
165
|
+
bordered: p,
|
166
|
+
id: e
|
167
|
+
},
|
168
|
+
e
|
169
|
+
) : null;
|
170
|
+
}) : N == null ? void 0 : N.map((e, t) => /* @__PURE__ */ n(
|
171
|
+
z,
|
172
|
+
{
|
173
|
+
record: e,
|
174
|
+
columns: f,
|
175
|
+
rowKey: i,
|
176
|
+
rowClassName: x,
|
177
|
+
index: t,
|
178
|
+
stickyLeft: b,
|
179
|
+
bordered: p
|
180
|
+
},
|
181
|
+
v(e)
|
182
|
+
)),
|
183
|
+
R ? /* @__PURE__ */ n("div", { className: "loading_table_init", children: /* @__PURE__ */ n(ae, { className: "centered" }) }) : null,
|
184
|
+
!R && P && B && /* @__PURE__ */ n("tr", { ref: B, children: /* @__PURE__ */ n("td", { colSpan: f.length, children: Q || /* @__PURE__ */ n(re, { colSpan: f.length }) }) })
|
185
|
+
]
|
186
|
+
}
|
187
|
+
)
|
157
188
|
]
|
158
189
|
}
|
159
190
|
)
|
160
191
|
}
|
161
192
|
) });
|
162
|
-
},
|
193
|
+
}, _e = K(se);
|
163
194
|
export {
|
164
|
-
|
195
|
+
_e as Table
|
165
196
|
};
|
package/dist/main.d.ts
CHANGED
@@ -1178,6 +1178,9 @@ declare type TablesProps<T extends object = Record<string, unknown>> = {
|
|
1178
1178
|
hasMore?: boolean;
|
1179
1179
|
loadingIndicator?: default_2.ReactNode;
|
1180
1180
|
loaderRef?: default_2.Ref<HTMLTableRowElement>;
|
1181
|
+
entities?: Record<string, T>;
|
1182
|
+
sortedIds?: string[];
|
1183
|
+
externalSorting?: boolean;
|
1181
1184
|
};
|
1182
1185
|
|
1183
1186
|
export declare const Tabs: React.FC<TabsProps>;
|
package/package.json
CHANGED
package/dist/_virtual/index3.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
var o, c;
|
2
|
-
function l() {
|
3
|
-
return c || (c = 1, o = function n(r, e) {
|
4
|
-
if (r === e) return !0;
|
5
|
-
if (r && e && typeof r == "object" && typeof e == "object") {
|
6
|
-
if (r.constructor !== e.constructor) return !1;
|
7
|
-
var u, t, f;
|
8
|
-
if (Array.isArray(r)) {
|
9
|
-
if (u = r.length, u != e.length) return !1;
|
10
|
-
for (t = u; t-- !== 0; )
|
11
|
-
if (!n(r[t], e[t])) return !1;
|
12
|
-
return !0;
|
13
|
-
}
|
14
|
-
if (r.constructor === RegExp) return r.source === e.source && r.flags === e.flags;
|
15
|
-
if (r.valueOf !== Object.prototype.valueOf) return r.valueOf() === e.valueOf();
|
16
|
-
if (r.toString !== Object.prototype.toString) return r.toString() === e.toString();
|
17
|
-
if (f = Object.keys(r), u = f.length, u !== Object.keys(e).length) return !1;
|
18
|
-
for (t = u; t-- !== 0; )
|
19
|
-
if (!Object.prototype.hasOwnProperty.call(e, f[t])) return !1;
|
20
|
-
for (t = u; t-- !== 0; ) {
|
21
|
-
var s = f[t];
|
22
|
-
if (!n(r[s], e[s])) return !1;
|
23
|
-
}
|
24
|
-
return !0;
|
25
|
-
}
|
26
|
-
return r !== r && e !== e;
|
27
|
-
}), o;
|
28
|
-
}
|
29
|
-
export {
|
30
|
-
l as __require
|
31
|
-
};
|