@cfx-dev/ui-components 2.0.3 → 2.0.4
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/assets/Table.css +1 -1
- package/dist/components/Select/Select.js +757 -703
- package/dist/components/Table/Table.js +67 -48
- package/dist/components/Table/TableShowcase.d.ts +5 -0
- package/dist/components/Table/TableShowcase.js +55 -0
- package/package.json +1 -1
- package/dist/iconBase-C6DV9qqL.js +0 -60
|
@@ -1,60 +1,79 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"table-responsive": "_table-responsive_1jg2j_1",
|
|
12
|
-
selectedRow: z
|
|
1
|
+
import { jsx as o, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import f, { useState as m } from "react";
|
|
3
|
+
import O from "../Checkbox/Checkbox.js";
|
|
4
|
+
import j from "../IconButton/IconButton.js";
|
|
5
|
+
import '../../assets/Table.css';const x = "_pointer_19b0f_18", A = "_selectedRow_19b0f_22", E = "_headerContent_19b0f_40", z = "_sortButton_19b0f_47", l = {
|
|
6
|
+
"table-responsive": "_table-responsive_19b0f_1",
|
|
7
|
+
pointer: x,
|
|
8
|
+
selectedRow: A,
|
|
9
|
+
headerContent: E,
|
|
10
|
+
sortButton: z
|
|
13
11
|
};
|
|
14
|
-
function
|
|
15
|
-
headers:
|
|
16
|
-
data:
|
|
17
|
-
includeRadio:
|
|
18
|
-
onSelectChange:
|
|
19
|
-
dataContainer:
|
|
20
|
-
useSort:
|
|
21
|
-
sortBy:
|
|
22
|
-
sortOrder:
|
|
23
|
-
onSortChange:
|
|
12
|
+
function F({
|
|
13
|
+
headers: u = [],
|
|
14
|
+
data: B = [],
|
|
15
|
+
includeRadio: r = !1,
|
|
16
|
+
onSelectChange: c,
|
|
17
|
+
dataContainer: b,
|
|
18
|
+
useSort: n = !1,
|
|
19
|
+
sortBy: k,
|
|
20
|
+
sortOrder: v = "asc",
|
|
21
|
+
onSortChange: d
|
|
24
22
|
}) {
|
|
25
|
-
const [
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
const [p, y] = m(null), [R, w] = m(k), [$, N] = m(v), _ = (e) => {
|
|
24
|
+
const t = R === e && $ === "asc" ? "desc" : "asc";
|
|
25
|
+
w(e), N(t), d == null || d(e, t);
|
|
26
|
+
}, h = f.useCallback(
|
|
27
|
+
(e, s) => {
|
|
28
|
+
if (typeof e == "boolean") {
|
|
29
|
+
const t = e ? s : null;
|
|
30
|
+
y(t), t !== null && (c == null || c(t));
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
[c]
|
|
34
|
+
);
|
|
35
|
+
return /* @__PURE__ */ o("div", { className: l.tableResponsive, children: /* @__PURE__ */ i("table", { children: [
|
|
36
|
+
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
37
|
+
r && /* @__PURE__ */ o("th", { "aria-label": "Select Row" }),
|
|
38
|
+
u.map((e, s) => /* @__PURE__ */ o(
|
|
39
|
+
"th",
|
|
40
|
+
{
|
|
41
|
+
className: n ? l.pointer : "",
|
|
42
|
+
onClick: () => n && _(e),
|
|
43
|
+
children: /* @__PURE__ */ i("div", { className: l.headerContent, children: [
|
|
44
|
+
e,
|
|
45
|
+
n && /* @__PURE__ */ o(
|
|
46
|
+
j,
|
|
47
|
+
{
|
|
48
|
+
className: l.sortButton,
|
|
49
|
+
color: "secondary",
|
|
50
|
+
name: "Sort",
|
|
51
|
+
onClick: n ? () => _(e) : void 0
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] })
|
|
55
|
+
},
|
|
56
|
+
`header-${s}`
|
|
57
|
+
))
|
|
38
58
|
] }) }),
|
|
39
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ o("tbody", { children: B.map((e, s) => /* @__PURE__ */ i(
|
|
40
60
|
"tr",
|
|
41
61
|
{
|
|
42
|
-
className:
|
|
62
|
+
className: `${p === s ? l.selectedRow : ""} ${r ? l.pointer : ""}`,
|
|
63
|
+
onClick: r ? () => h(!0, s) : void 0,
|
|
43
64
|
children: [
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
r && /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(
|
|
66
|
+
O,
|
|
46
67
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
checked:
|
|
51
|
-
onChange: O,
|
|
52
|
-
"aria-label": `${s}`
|
|
68
|
+
size: "small",
|
|
69
|
+
onCheckedChange: (t) => h(t, s),
|
|
70
|
+
"aria-label": `${s}`,
|
|
71
|
+
checked: p === s
|
|
53
72
|
}
|
|
54
73
|
) }),
|
|
55
|
-
|
|
74
|
+
e.map((t, C) => {
|
|
56
75
|
let a;
|
|
57
|
-
return
|
|
76
|
+
return f.isValidElement(t) ? a = t : b ? a = f.createElement(b, { item: t }) : a = String(t), /* @__PURE__ */ o("td", { children: a }, `item-${C}`);
|
|
58
77
|
})
|
|
59
78
|
]
|
|
60
79
|
},
|
|
@@ -63,5 +82,5 @@ function G({
|
|
|
63
82
|
] }) });
|
|
64
83
|
}
|
|
65
84
|
export {
|
|
66
|
-
|
|
85
|
+
F as Table
|
|
67
86
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import d from "react";
|
|
3
|
+
import { Badge as l } from "../Badge/Badge.js";
|
|
4
|
+
import { Flex as a } from "../Layout/Flex/Flex.js";
|
|
5
|
+
import "../Interactive/Interactive.js";
|
|
6
|
+
import { Scrollable as c } from "../Layout/Scrollable/Scrollable.js";
|
|
7
|
+
import "../Layout/Scrollable/VirtualScrollable.js";
|
|
8
|
+
import { Text as r } from "../Text/Text.js";
|
|
9
|
+
import { Table as o } from "./Table.js";
|
|
10
|
+
const i = [
|
|
11
|
+
[
|
|
12
|
+
"Cell 1",
|
|
13
|
+
"Cell 2",
|
|
14
|
+
"Cell 3",
|
|
15
|
+
new Date(2023, 0, 1).toLocaleDateString(),
|
|
16
|
+
/* @__PURE__ */ e(l, { color: "error", children: "Error" }, "1")
|
|
17
|
+
],
|
|
18
|
+
["Cell 4", "Cell 5", "Cell 6", new Date(2023, 1, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "2")],
|
|
19
|
+
["Cell 7", "Cell 8", "Cell 9", new Date(2023, 2, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "3")],
|
|
20
|
+
["Cell 4", "Cell 5", "Cell 6", new Date(2023, 1, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "2")],
|
|
21
|
+
["Cell 7", "Cell 8", "Cell 9", new Date(2023, 2, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "3")],
|
|
22
|
+
["Cell 4", "Cell 5", "Cell 6", new Date(2023, 1, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "2")],
|
|
23
|
+
["Cell 7", "Cell 8", "Cell 9", new Date(2023, 2, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "3")],
|
|
24
|
+
["Cell 4", "Cell 5", "Cell 6", new Date(2023, 1, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "2")],
|
|
25
|
+
["Cell 7", "Cell 8", "Cell 9", new Date(2023, 2, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "3")],
|
|
26
|
+
["Cell 4", "Cell 5", "Cell 6", new Date(2023, 1, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "2")],
|
|
27
|
+
["Cell 7", "Cell 8", "Cell 9", new Date(2023, 2, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "3")],
|
|
28
|
+
["Cell 4", "Cell 5", "Cell 6", new Date(2023, 1, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "2")],
|
|
29
|
+
["Cell 7", "Cell 8", "Cell 9", new Date(2023, 2, 1).toLocaleDateString(), /* @__PURE__ */ e(l, { children: "Badge" }, "3")]
|
|
30
|
+
], n = ["Header 1", "Header 2", "Header 3", "Date", "Item"];
|
|
31
|
+
function C() {
|
|
32
|
+
return /* @__PURE__ */ t(a, { gap: "large", vertical: !0, children: [
|
|
33
|
+
/* @__PURE__ */ t(a, { gap: "normal", vertical: !0, children: [
|
|
34
|
+
/* @__PURE__ */ e(r, { children: "Table" }),
|
|
35
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(o, { includeRadio: !0, headers: n, data: i }) })
|
|
36
|
+
] }),
|
|
37
|
+
/* @__PURE__ */ t(a, { fullWidth: !0, vertical: !0, children: [
|
|
38
|
+
/* @__PURE__ */ e(r, { children: "Table with scroll" }),
|
|
39
|
+
/* @__PURE__ */ e(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
style: {
|
|
43
|
+
height: "400px",
|
|
44
|
+
overflow: "hidden"
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(o, { includeRadio: !0, headers: n, data: i }) })
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
const B = d.memo(C);
|
|
53
|
+
export {
|
|
54
|
+
B as default
|
|
55
|
+
};
|
package/package.json
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import i from "react";
|
|
2
|
-
var s = {
|
|
3
|
-
color: void 0,
|
|
4
|
-
size: void 0,
|
|
5
|
-
className: void 0,
|
|
6
|
-
style: void 0,
|
|
7
|
-
attr: void 0
|
|
8
|
-
}, f = i.createContext && i.createContext(s), l = function() {
|
|
9
|
-
return l = Object.assign || function(e) {
|
|
10
|
-
for (var n, t = 1, r = arguments.length; t < r; t++) {
|
|
11
|
-
n = arguments[t];
|
|
12
|
-
for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
|
|
13
|
-
}
|
|
14
|
-
return e;
|
|
15
|
-
}, l.apply(this, arguments);
|
|
16
|
-
}, y = function(e, n) {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && n.indexOf(r) < 0 && (t[r] = e[r]);
|
|
19
|
-
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, r = Object.getOwnPropertySymbols(e); a < r.length; a++)
|
|
20
|
-
n.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (t[r[a]] = e[r[a]]);
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
function m(e) {
|
|
24
|
-
return e && e.map(function(n, t) {
|
|
25
|
-
return i.createElement(n.tag, l({
|
|
26
|
-
key: t
|
|
27
|
-
}, n.attr), m(n.child));
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function h(e) {
|
|
31
|
-
return function(n) {
|
|
32
|
-
return i.createElement(g, l({
|
|
33
|
-
attr: l({}, e.attr)
|
|
34
|
-
}, n), m(e.child));
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function g(e) {
|
|
38
|
-
var n = function(t) {
|
|
39
|
-
var r = e.attr, a = e.size, c = e.title, d = y(e, ["attr", "size", "title"]), o = a || t.size || "1em", u;
|
|
40
|
-
return t.className && (u = t.className), e.className && (u = (u ? u + " " : "") + e.className), i.createElement("svg", l({
|
|
41
|
-
stroke: "currentColor",
|
|
42
|
-
fill: "currentColor",
|
|
43
|
-
strokeWidth: "0"
|
|
44
|
-
}, t.attr, r, d, {
|
|
45
|
-
className: u,
|
|
46
|
-
style: l(l({
|
|
47
|
-
color: e.color || t.color
|
|
48
|
-
}, t.style), e.style),
|
|
49
|
-
height: o,
|
|
50
|
-
width: o,
|
|
51
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
52
|
-
}), c && i.createElement("title", null, c), e.children);
|
|
53
|
-
};
|
|
54
|
-
return f !== void 0 ? i.createElement(f.Consumer, null, function(t) {
|
|
55
|
-
return n(t);
|
|
56
|
-
}) : n(s);
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
h as G
|
|
60
|
-
};
|