@hybridcore/ui 1.6.26 → 1.6.27
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/CATALOG.md +1 -0
- package/dist/IconCheck-BcUcbvno.js +19 -0
- package/dist/components/data-list/index.js +139 -0
- package/dist/components/data-list/logic.js +224 -0
- package/dist/components/data-list/styled.js +260 -0
- package/dist/components/status-indicator/logic.js +28 -41
- package/dist/main.d.ts +245 -50
- package/dist/main.js +117 -115
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -61,6 +61,7 @@ import { ComponentName } from '@hybridcore/ui';
|
|
|
61
61
|
| InstanceHierarchyTable | HCInstanceHierarchyTable | Accordion table showing template hierarchy with counts | data-table, hierarchy, accordion |
|
|
62
62
|
| SimplePivotTable | HCSimplePivotTable | Pivot table with row/column dimensions + aggregations (sum/avg/min/max) | data-table, pivot, aggregation |
|
|
63
63
|
| PaginatedList | HCPaginatedList | Paginated list with selection mode and snapshot export | data-list, pagination, selection |
|
|
64
|
+
| DataList | HCDataList | Dashboard list: leading icon states, composed meta line, trailing badge/progress slot | data-list, dashboard, badge, status |
|
|
64
65
|
| SortableList | HCSortableList | Drag-and-drop sortable list | data-list, sortable, drag |
|
|
65
66
|
| InstanceVariableList | HCInstanceVariableList | Renders typed instance variables with per-type widgets | data-list, ontology, variable, domain |
|
|
66
67
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { c as e } from "./createReactComponent-C7L-DMHj.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
const t = [["path", { d: "M12 9v4", key: "svg-0" }], ["path", { d: "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0", key: "svg-1" }], ["path", { d: "M12 16h.01", key: "svg-2" }]], c = e("outline", "alert-triangle", "AlertTriangle", t);
|
|
9
|
+
/**
|
|
10
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
const a = [["path", { d: "M5 12l5 5l10 -10", key: "svg-0" }]], n = e("outline", "check", "Check", a);
|
|
16
|
+
export {
|
|
17
|
+
n as I,
|
|
18
|
+
c as a
|
|
19
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsxs as o, jsx as a, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { Typography as k, Stack as u, Skeleton as L, CircularProgress as w, TablePagination as x } from "@mui/material";
|
|
3
|
+
import { LinearIndicator as m } from "../linear-indicator/index.js";
|
|
4
|
+
import { useDataListLogic as y } from "./logic.js";
|
|
5
|
+
import { DataListRoot as v, DataListHeader as A, DataListHeaderActionLink as B, DataListHeaderActionButton as R, DataListContent as E, DataListEmpty as H, DataListList as M, DataListLoadMore as T, DataListPagination as j, DataListItemRow as z, DataListItemButton as O, DataListItemEnd as V, DataListItemStart as f, DataListBadge as F, DataListEndLabel as b, DataListItemMain as N, DataListItemTitle as W, DataListItemMeta as _ } from "./styled.js";
|
|
6
|
+
const Q = (t) => {
|
|
7
|
+
const { refs: c, state: r, actions: d } = y(t), { ownerState: l, displayData: C } = r, D = !!(t.title || t.headerAction || t.actionLabel && (t.onActionClick || t.actionHref)), s = (e) => {
|
|
8
|
+
if (t.renderItemStart) return t.renderItemStart(e);
|
|
9
|
+
if (e.icon)
|
|
10
|
+
return /* @__PURE__ */ a(f, { ownerState: l, children: e.icon });
|
|
11
|
+
const i = r.getIcon(e);
|
|
12
|
+
if (!i) return null;
|
|
13
|
+
const n = r.getIconState(e);
|
|
14
|
+
return /* @__PURE__ */ a(
|
|
15
|
+
f,
|
|
16
|
+
{
|
|
17
|
+
ownerState: l,
|
|
18
|
+
iconColor: n == null ? void 0 : n.color,
|
|
19
|
+
iconBackground: n == null ? void 0 : n.backgroundColor,
|
|
20
|
+
role: n != null && n.label ? "img" : void 0,
|
|
21
|
+
"aria-label": n == null ? void 0 : n.label,
|
|
22
|
+
"aria-hidden": n != null && n.label ? void 0 : !0,
|
|
23
|
+
title: n == null ? void 0 : n.label,
|
|
24
|
+
children: /* @__PURE__ */ a(i, { size: l.dense ? 16 : 20 })
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}, P = (e) => {
|
|
28
|
+
if (t.renderItemEnd) return t.renderItemEnd(e);
|
|
29
|
+
if (e.endContent) return e.endContent;
|
|
30
|
+
if (r.endSlot === "badge") {
|
|
31
|
+
const i = r.getBadgeLabel(e);
|
|
32
|
+
if (!i) return null;
|
|
33
|
+
const n = r.getBadgeState(e);
|
|
34
|
+
return /* @__PURE__ */ a(
|
|
35
|
+
F,
|
|
36
|
+
{
|
|
37
|
+
badgeColor: n == null ? void 0 : n.color,
|
|
38
|
+
badgeBackground: n == null ? void 0 : n.backgroundColor,
|
|
39
|
+
badgeBorder: n == null ? void 0 : n.borderColor,
|
|
40
|
+
children: i
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (r.endSlot === "progress")
|
|
45
|
+
return /* @__PURE__ */ o(g, { children: [
|
|
46
|
+
/* @__PURE__ */ a(
|
|
47
|
+
m,
|
|
48
|
+
{
|
|
49
|
+
value: r.getProgressValue(e),
|
|
50
|
+
sx: { flex: 1, minWidth: 0 }
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
e.endLabel && /* @__PURE__ */ a(b, { children: e.endLabel })
|
|
54
|
+
] });
|
|
55
|
+
if (r.endSlot === "text") {
|
|
56
|
+
const i = e.endLabel ?? e.endValue;
|
|
57
|
+
return i == null || `${i}`.trim() === "" ? null : /* @__PURE__ */ a(b, { children: i });
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}, h = (e) => {
|
|
61
|
+
const i = r.getSecondaryText(e);
|
|
62
|
+
return /* @__PURE__ */ o(N, { ownerState: l, children: [
|
|
63
|
+
/* @__PURE__ */ a(W, { title: e.title, children: e.title }),
|
|
64
|
+
i && /* @__PURE__ */ a(_, { ownerState: l, title: i, children: i })
|
|
65
|
+
] });
|
|
66
|
+
}, I = (e) => {
|
|
67
|
+
const i = P(e);
|
|
68
|
+
return /* @__PURE__ */ o(z, { ownerState: l, children: [
|
|
69
|
+
r.isItemClickable(e) ? /* @__PURE__ */ o(
|
|
70
|
+
O,
|
|
71
|
+
{
|
|
72
|
+
onClick: d.handleItemClick(e),
|
|
73
|
+
disabled: e.disabled,
|
|
74
|
+
children: [
|
|
75
|
+
s(e),
|
|
76
|
+
h(e)
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
) : /* @__PURE__ */ o(g, { children: [
|
|
80
|
+
s(e),
|
|
81
|
+
h(e)
|
|
82
|
+
] }),
|
|
83
|
+
i && /* @__PURE__ */ a(V, { ownerState: l, children: i })
|
|
84
|
+
] }, e.id);
|
|
85
|
+
};
|
|
86
|
+
return /* @__PURE__ */ o(
|
|
87
|
+
v,
|
|
88
|
+
{
|
|
89
|
+
ownerState: l,
|
|
90
|
+
sx: t.sx,
|
|
91
|
+
elevation: 0,
|
|
92
|
+
"data-snapshot": r.snapshot,
|
|
93
|
+
children: [
|
|
94
|
+
D && /* @__PURE__ */ o(A, { ownerState: l, children: [
|
|
95
|
+
t.title && /* @__PURE__ */ a(k, { variant: "h3", children: t.title }),
|
|
96
|
+
t.headerAction ?? (t.actionLabel && (t.actionHref ? /* @__PURE__ */ a(
|
|
97
|
+
B,
|
|
98
|
+
{
|
|
99
|
+
href: t.actionHref,
|
|
100
|
+
onClick: t.onActionClick,
|
|
101
|
+
children: t.actionLabel
|
|
102
|
+
}
|
|
103
|
+
) : t.onActionClick && /* @__PURE__ */ a(
|
|
104
|
+
R,
|
|
105
|
+
{
|
|
106
|
+
type: "button",
|
|
107
|
+
onClick: t.onActionClick,
|
|
108
|
+
children: t.actionLabel
|
|
109
|
+
}
|
|
110
|
+
)))
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ o(E, { ownerState: l, children: [
|
|
113
|
+
t.loading ? /* @__PURE__ */ a(u, { spacing: 2, padding: 2, children: Array.from({ length: t.loadingRows ?? 4 }).map((e, i) => /* @__PURE__ */ o(u, { spacing: 0.5, children: [
|
|
114
|
+
/* @__PURE__ */ a(L, { variant: "text", width: "60%" }),
|
|
115
|
+
/* @__PURE__ */ a(L, { variant: "text", width: "40%" })
|
|
116
|
+
] }, i)) }) : l.isEmpty ? /* @__PURE__ */ a(H, { ownerState: l, children: t.emptyMessage ?? "No records to display" }) : /* @__PURE__ */ o(M, { ownerState: l, ref: c.listRef, children: [
|
|
117
|
+
C.map(I),
|
|
118
|
+
r.hasMore && /* @__PURE__ */ a(T, { ownerState: l, ref: c.sentinelRef, children: r.isLoadingMore && /* @__PURE__ */ a(w, { size: 18 }) })
|
|
119
|
+
] }),
|
|
120
|
+
r.showPagination && /* @__PURE__ */ a(j, { ownerState: l, children: /* @__PURE__ */ a(
|
|
121
|
+
x,
|
|
122
|
+
{
|
|
123
|
+
component: "div",
|
|
124
|
+
count: r.count,
|
|
125
|
+
page: r.page,
|
|
126
|
+
rowsPerPage: r.rowsPerPage,
|
|
127
|
+
rowsPerPageOptions: r.rowsPerPageOptions,
|
|
128
|
+
onPageChange: d.handleChangePage,
|
|
129
|
+
onRowsPerPageChange: d.handleChangeRowsPerPage
|
|
130
|
+
}
|
|
131
|
+
) })
|
|
132
|
+
] })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
Q as DataList
|
|
139
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { useThemeProps as de } from "@mui/material";
|
|
2
|
+
import { useRef as f, useState as N, useMemo as S, useCallback as ge, useEffect as B } from "react";
|
|
3
|
+
import { c as s } from "../../createReactComponent-C7L-DMHj.js";
|
|
4
|
+
import { a as he, I as pe } from "../../IconCheck-BcUcbvno.js";
|
|
5
|
+
import { I as ve } from "../../IconCircle-HcgE1lHy.js";
|
|
6
|
+
/**
|
|
7
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
const fe = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 8v4", key: "svg-1" }], ["path", { d: "M12 16h.01", key: "svg-2" }]], Me = s("outline", "alert-circle", "AlertCircle", fe);
|
|
13
|
+
/**
|
|
14
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license.
|
|
17
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
const me = [["path", { d: "M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6", key: "svg-0" }], ["path", { d: "M9 17v1a3 3 0 0 0 6 0v-1", key: "svg-1" }]], ke = s("outline", "bell", "Bell", me);
|
|
20
|
+
/**
|
|
21
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license.
|
|
24
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
const ye = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 7v5l3 3", key: "svg-1" }]], _e = s("outline", "clock", "Clock", ye);
|
|
27
|
+
/**
|
|
28
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the MIT license.
|
|
31
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/
|
|
33
|
+
const Ie = [["path", { d: "M14 3v4a1 1 0 0 0 1 1h4", key: "svg-0" }], ["path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2", key: "svg-1" }], ["path", { d: "M9 9l1 0", key: "svg-2" }], ["path", { d: "M9 13l6 0", key: "svg-3" }], ["path", { d: "M9 17l6 0", key: "svg-4" }]], Pe = s("outline", "file-text", "FileText", Ie);
|
|
34
|
+
/**
|
|
35
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license.
|
|
38
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
const be = [["path", { d: "M5 5a5 5 0 0 1 7 0a5 5 0 0 0 7 0v9a5 5 0 0 1 -7 0a5 5 0 0 0 -7 0v-9", key: "svg-0" }], ["path", { d: "M5 21v-7", key: "svg-1" }]], Ne = s("outline", "flag", "Flag", be);
|
|
41
|
+
/**
|
|
42
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the MIT license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/
|
|
47
|
+
const Se = [["path", { d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", key: "svg-0" }], ["path", { d: "M12 9h.01", key: "svg-1" }], ["path", { d: "M11 12h1v4h1", key: "svg-2" }]], we = s("outline", "info-circle", "InfoCircle", Se);
|
|
48
|
+
/**
|
|
49
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the MIT license.
|
|
52
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
53
|
+
*/
|
|
54
|
+
const Re = [["path", { d: "M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0", key: "svg-0" }], ["path", { d: "M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0", key: "svg-1" }]], $e = s("outline", "map-pin", "MapPin", Re);
|
|
55
|
+
/**
|
|
56
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the MIT license.
|
|
59
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/
|
|
61
|
+
const Ce = [["path", { d: "M8 9h8", key: "svg-0" }], ["path", { d: "M8 13h6", key: "svg-1" }], ["path", { d: "M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12", key: "svg-2" }]], Oe = s("outline", "message", "Message", Ce);
|
|
62
|
+
/**
|
|
63
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the MIT license.
|
|
66
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/
|
|
68
|
+
const Le = [["path", { d: "M15.04 19.745c-.942 .551 -1.964 .976 -3.04 1.255a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3a12 12 0 0 1 .195 6.015", key: "svg-0" }], ["path", { d: "M19 16v3", key: "svg-1" }], ["path", { d: "M19 22v.01", key: "svg-2" }]], xe = s("outline", "shield-exclamation", "ShieldExclamation", Le);
|
|
69
|
+
/**
|
|
70
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
71
|
+
*
|
|
72
|
+
* This source code is licensed under the MIT license.
|
|
73
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
74
|
+
*/
|
|
75
|
+
const Te = [["path", { d: "M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3", key: "svg-0" }]], Ae = s("outline", "shield", "Shield", Te);
|
|
76
|
+
/**
|
|
77
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the MIT license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/
|
|
82
|
+
const Ee = [["path", { d: "M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3", key: "svg-0" }]], Be = s("outline", "thumb-up", "ThumbUp", Ee);
|
|
83
|
+
/**
|
|
84
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the MIT license.
|
|
87
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/
|
|
89
|
+
const Fe = [["path", { d: "M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0", key: "svg-0" }], ["path", { d: "M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2", key: "svg-1" }], ["path", { d: "M16 3.13a4 4 0 0 1 0 7.75", key: "svg-2" }], ["path", { d: "M21 21v-2a4 4 0 0 0 -3 -3.85", key: "svg-3" }]], Ve = s("outline", "users", "Users", Fe), De = {
|
|
90
|
+
shield: Ae,
|
|
91
|
+
"shield-alert": xe,
|
|
92
|
+
"alert-triangle": he,
|
|
93
|
+
"alert-circle": Me,
|
|
94
|
+
info: we,
|
|
95
|
+
bell: ke,
|
|
96
|
+
check: pe,
|
|
97
|
+
clock: _e,
|
|
98
|
+
flag: Ne,
|
|
99
|
+
file: Pe,
|
|
100
|
+
"map-pin": $e,
|
|
101
|
+
message: Oe,
|
|
102
|
+
"thumb-up": Be,
|
|
103
|
+
users: Ve,
|
|
104
|
+
circle: ve
|
|
105
|
+
}, Ue = [5, 10, 25, 50], Ge = "120px", F = (g, d) => {
|
|
106
|
+
if (!(g != null && g.length) || d === void 0 || d === null) return;
|
|
107
|
+
const o = `${d}`.trim().toLowerCase();
|
|
108
|
+
if (o)
|
|
109
|
+
return g.find((k) => `${k.value}`.trim().toLowerCase() === o);
|
|
110
|
+
}, qe = (g) => {
|
|
111
|
+
const d = de({ props: g, name: "HCDataList" }), {
|
|
112
|
+
data: o = [],
|
|
113
|
+
totalCount: k,
|
|
114
|
+
payload: i,
|
|
115
|
+
onChange: r,
|
|
116
|
+
onItemClick: M,
|
|
117
|
+
iconStates: V,
|
|
118
|
+
iconShape: D = "circle",
|
|
119
|
+
badgeStates: U,
|
|
120
|
+
endSlot: w = "badge",
|
|
121
|
+
metaSeparator: G = "•",
|
|
122
|
+
descriptionLines: j = 1,
|
|
123
|
+
dense: H = !1,
|
|
124
|
+
divider: J = !0,
|
|
125
|
+
headerGutter: K = !1,
|
|
126
|
+
paginationMode: y = "infinite",
|
|
127
|
+
rowsPerPage: W = 10,
|
|
128
|
+
resetKey: q,
|
|
129
|
+
loading: _ = !1,
|
|
130
|
+
loadingMore: z = !1
|
|
131
|
+
} = d, R = f(null), $ = f(null), [Q, C] = N(0), [X, Y] = N(W), l = (i == null ? void 0 : i.pageNumber) ?? Q, a = (i == null ? void 0 : i.rows) ?? X, c = !!r, u = y === "infinite", [O, L] = N(a), p = f(/* @__PURE__ */ new Map()), m = `${q ?? ""}`, x = f(m), h = f(null);
|
|
132
|
+
x.current !== m && (x.current = m, p.current.clear(), h.current = null), c && u && (l === 0 && p.current.clear(), p.current.set(l, o), h.current === l && (h.current = null));
|
|
133
|
+
const T = S(() => !c || !u ? o : Array.from(p.current.keys()).sort((e, t) => e - t).flatMap((e) => p.current.get(e) ?? []), [c, u, o, l]), I = c ? k ?? 0 : o.length, v = S(() => u ? c ? T : o.slice(0, O) : c ? o : o.slice(l * a, (l + 1) * a), [u, c, T, o, O, l, a]), P = u && v.length < I, Z = y === "buttons" && I > a, b = ge(() => {
|
|
134
|
+
if (!c) {
|
|
135
|
+
L((t) => t + a);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const e = l + 1;
|
|
139
|
+
h.current === null && (h.current = e, r == null || r({ ...i, pageNumber: e, rows: a }));
|
|
140
|
+
}, [c, a, l, r, i]);
|
|
141
|
+
B(() => {
|
|
142
|
+
if (!u || !P || _) return;
|
|
143
|
+
const e = $.current;
|
|
144
|
+
if (!e || typeof IntersectionObserver > "u") return;
|
|
145
|
+
const t = new IntersectionObserver(
|
|
146
|
+
(n) => {
|
|
147
|
+
n.some((ue) => ue.isIntersecting) && b();
|
|
148
|
+
},
|
|
149
|
+
{ root: R.current, rootMargin: Ge }
|
|
150
|
+
);
|
|
151
|
+
return t.observe(e), () => t.disconnect();
|
|
152
|
+
}, [u, P, _, b]), B(() => {
|
|
153
|
+
u && !c && L(a);
|
|
154
|
+
}, [u, c, a, m, o.length]);
|
|
155
|
+
const ee = (e, t) => {
|
|
156
|
+
C(t), r == null || r({ ...i, pageNumber: t, rows: a });
|
|
157
|
+
}, te = (e) => {
|
|
158
|
+
const t = parseInt(e.target.value, 10);
|
|
159
|
+
Y(t), C(0), r == null || r({ ...i, pageNumber: 0, rows: t });
|
|
160
|
+
}, ne = (e) => () => {
|
|
161
|
+
e.disabled || M == null || M(e);
|
|
162
|
+
}, oe = (e) => !!M && !e.disabled, ae = (e) => {
|
|
163
|
+
if (!e.meta) return e.description;
|
|
164
|
+
const t = e.meta.filter((n) => n != null && `${n}`.trim() !== "").map((n) => `${n}`.trim());
|
|
165
|
+
return t.length ? t.join(` ${G} `) : void 0;
|
|
166
|
+
}, A = (e) => F(V, e.iconValue), se = (e) => {
|
|
167
|
+
var n;
|
|
168
|
+
const t = (n = A(e)) == null ? void 0 : n.icon;
|
|
169
|
+
return t ? De[t] : void 0;
|
|
170
|
+
}, E = (e) => F(U, e.status), re = (e) => {
|
|
171
|
+
var n;
|
|
172
|
+
const t = E(e);
|
|
173
|
+
return t ? t.label ?? t.value : ((n = e.status) == null ? void 0 : n.trim()) || void 0;
|
|
174
|
+
}, ce = (e) => {
|
|
175
|
+
const t = typeof e.endValue == "string" ? Number(e.endValue) : e.endValue;
|
|
176
|
+
return Number.isFinite(t) ? Math.min(100, Math.max(0, t)) : 0;
|
|
177
|
+
}, ie = S(
|
|
178
|
+
() => JSON.stringify({ title: d.title, data: v }),
|
|
179
|
+
[d.title, v]
|
|
180
|
+
), le = {
|
|
181
|
+
...d,
|
|
182
|
+
iconShape: D,
|
|
183
|
+
endSlot: w,
|
|
184
|
+
dense: H,
|
|
185
|
+
divider: J,
|
|
186
|
+
descriptionLines: j,
|
|
187
|
+
headerGutter: K,
|
|
188
|
+
paginationMode: y,
|
|
189
|
+
isEmpty: !_ && v.length === 0
|
|
190
|
+
};
|
|
191
|
+
return {
|
|
192
|
+
refs: { listRef: R, sentinelRef: $ },
|
|
193
|
+
state: {
|
|
194
|
+
ownerState: le,
|
|
195
|
+
displayData: v,
|
|
196
|
+
count: I,
|
|
197
|
+
page: l,
|
|
198
|
+
rowsPerPage: a,
|
|
199
|
+
rowsPerPageOptions: d.rowsPerPageOptions ?? Ue,
|
|
200
|
+
showPagination: Z,
|
|
201
|
+
hasMore: P,
|
|
202
|
+
// Either the caller says a request is running, or we know one is in flight.
|
|
203
|
+
isLoadingMore: z || h.current !== null,
|
|
204
|
+
snapshot: ie,
|
|
205
|
+
endSlot: w,
|
|
206
|
+
isItemClickable: oe,
|
|
207
|
+
getSecondaryText: ae,
|
|
208
|
+
getIconState: A,
|
|
209
|
+
getIcon: se,
|
|
210
|
+
getBadgeState: E,
|
|
211
|
+
getBadgeLabel: re,
|
|
212
|
+
getProgressValue: ce
|
|
213
|
+
},
|
|
214
|
+
actions: {
|
|
215
|
+
handleChangePage: ee,
|
|
216
|
+
handleChangeRowsPerPage: te,
|
|
217
|
+
handleItemClick: ne,
|
|
218
|
+
loadMore: b
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
export {
|
|
223
|
+
qe as useDataListLogic
|
|
224
|
+
};
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { styled as a, List as u, ButtonBase as L, alpha as g, Typography as l, Box as f } from "@mui/material";
|
|
2
|
+
import { resolvePaletteColor as s } from "../metric-card/helpers.js";
|
|
3
|
+
import { Widget as p } from "../widget/styled.js";
|
|
4
|
+
const e = {
|
|
5
|
+
shouldForwardProp: (t) => t !== "ownerState"
|
|
6
|
+
}, m = a(p.Root, {
|
|
7
|
+
name: "HCDataList",
|
|
8
|
+
slot: "Root",
|
|
9
|
+
...e
|
|
10
|
+
})(() => ({
|
|
11
|
+
overflow: "hidden"
|
|
12
|
+
})), C = a(p.Header, {
|
|
13
|
+
name: "HCDataList",
|
|
14
|
+
slot: "Header",
|
|
15
|
+
...e
|
|
16
|
+
})(({ theme: t, ownerState: o }) => ({
|
|
17
|
+
display: "flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
justifyContent: "space-between",
|
|
20
|
+
gap: t.spacing(2),
|
|
21
|
+
padding: t.spacing(1.75, 2),
|
|
22
|
+
// Separates the header from the first row, as the dashboard cards are drawn. Same
|
|
23
|
+
// rule the rows use between themselves, so the whole card reads as one ruled list.
|
|
24
|
+
borderBottom: `1px solid ${t.palette.divider}`,
|
|
25
|
+
// Clears the widget store's floating menu trigger (absolute, top/right 8px) and
|
|
26
|
+
// the error badge that parks beside it, so neither lands on the header content.
|
|
27
|
+
...o.headerGutter && {
|
|
28
|
+
paddingRight: typeof o.headerGutter == "number" ? o.headerGutter : 44
|
|
29
|
+
}
|
|
30
|
+
})), y = ({ theme: t }) => ({
|
|
31
|
+
...t.typography.body2,
|
|
32
|
+
color: t.palette.primary.main,
|
|
33
|
+
fontWeight: 500,
|
|
34
|
+
background: "none",
|
|
35
|
+
border: "none",
|
|
36
|
+
cursor: "pointer",
|
|
37
|
+
textDecoration: "none",
|
|
38
|
+
borderRadius: t.shape.borderRadius,
|
|
39
|
+
padding: t.spacing(0.25, 0.5),
|
|
40
|
+
flex: "0 0 auto",
|
|
41
|
+
"&:hover": {
|
|
42
|
+
textDecoration: "underline"
|
|
43
|
+
}
|
|
44
|
+
}), H = a("button", {
|
|
45
|
+
name: "HCDataList",
|
|
46
|
+
slot: "HeaderAction"
|
|
47
|
+
})(y), I = a("a", {
|
|
48
|
+
name: "HCDataList",
|
|
49
|
+
slot: "HeaderAction"
|
|
50
|
+
})(y), w = a(p.Content, {
|
|
51
|
+
name: "HCDataList",
|
|
52
|
+
slot: "Content",
|
|
53
|
+
...e
|
|
54
|
+
})(() => ({
|
|
55
|
+
overflow: "hidden"
|
|
56
|
+
})), v = a(u, {
|
|
57
|
+
name: "HCDataList",
|
|
58
|
+
slot: "List",
|
|
59
|
+
...e
|
|
60
|
+
})(() => ({
|
|
61
|
+
flex: 1,
|
|
62
|
+
overflowY: "auto",
|
|
63
|
+
padding: 0
|
|
64
|
+
})), h = a("li", {
|
|
65
|
+
name: "HCDataList",
|
|
66
|
+
slot: "Item",
|
|
67
|
+
...e
|
|
68
|
+
})(({ theme: t, ownerState: o }) => ({
|
|
69
|
+
display: "flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
gap: t.spacing(1.5),
|
|
72
|
+
padding: t.spacing(o.dense ? 1 : 1.5, 2),
|
|
73
|
+
listStyle: "none",
|
|
74
|
+
...o.divider && {
|
|
75
|
+
"& + &": {
|
|
76
|
+
borderTop: `1px solid ${t.palette.divider}`
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})), B = a(L, {
|
|
80
|
+
name: "HCDataList",
|
|
81
|
+
slot: "ItemButton"
|
|
82
|
+
})(({ theme: t }) => ({
|
|
83
|
+
flex: "1 1 auto",
|
|
84
|
+
minWidth: 0,
|
|
85
|
+
display: "flex",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
gap: t.spacing(1.5),
|
|
88
|
+
justifyContent: "flex-start",
|
|
89
|
+
textAlign: "left",
|
|
90
|
+
borderRadius: t.shape.borderRadius,
|
|
91
|
+
padding: t.spacing(0.5),
|
|
92
|
+
margin: t.spacing(-0.5),
|
|
93
|
+
"&:hover": {
|
|
94
|
+
backgroundColor: t.palette.action.hover
|
|
95
|
+
},
|
|
96
|
+
"&.Mui-disabled": {
|
|
97
|
+
opacity: t.palette.action.disabledOpacity
|
|
98
|
+
}
|
|
99
|
+
})), R = a("span", {
|
|
100
|
+
name: "HCDataList",
|
|
101
|
+
slot: "ItemStart",
|
|
102
|
+
shouldForwardProp: (t) => t !== "ownerState" && t !== "iconColor" && t !== "iconBackground"
|
|
103
|
+
})(({ theme: t, ownerState: o, iconColor: r, iconBackground: d }) => {
|
|
104
|
+
const i = s(t, r) ?? t.palette.text.secondary, n = {
|
|
105
|
+
flex: "0 0 auto",
|
|
106
|
+
display: "inline-flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
justifyContent: "center",
|
|
109
|
+
color: i
|
|
110
|
+
};
|
|
111
|
+
if (o.iconShape === "plain") return n;
|
|
112
|
+
const c = o.dense ? 32 : 40;
|
|
113
|
+
return {
|
|
114
|
+
...n,
|
|
115
|
+
width: c,
|
|
116
|
+
height: c,
|
|
117
|
+
// The dashboard's alert rows use a solid disc with a light glyph; a state that
|
|
118
|
+
// sets only `color` gets a tint of that color instead of a hard-coded grey.
|
|
119
|
+
backgroundColor: s(t, d) ?? g(i, 0.12),
|
|
120
|
+
borderRadius: o.iconShape === "circle" ? "50%" : t.shape.borderRadius
|
|
121
|
+
};
|
|
122
|
+
}), M = a("span", {
|
|
123
|
+
name: "HCDataList",
|
|
124
|
+
slot: "ItemMain",
|
|
125
|
+
...e
|
|
126
|
+
})(() => ({
|
|
127
|
+
flex: "1 1 auto",
|
|
128
|
+
minWidth: 0,
|
|
129
|
+
display: "flex",
|
|
130
|
+
flexDirection: "column"
|
|
131
|
+
})), k = a(l, {
|
|
132
|
+
name: "HCDataList",
|
|
133
|
+
slot: "ItemTitle"
|
|
134
|
+
})(({ theme: t }) => ({
|
|
135
|
+
...t.typography.subtitle2,
|
|
136
|
+
color: t.palette.text.primary,
|
|
137
|
+
// Rows live in a resizable widget grid with no character limit — clip to one line
|
|
138
|
+
// so a long title never reflows the row. Full text on hover.
|
|
139
|
+
whiteSpace: "nowrap",
|
|
140
|
+
overflow: "hidden",
|
|
141
|
+
textOverflow: "ellipsis"
|
|
142
|
+
})), P = a(l, {
|
|
143
|
+
name: "HCDataList",
|
|
144
|
+
slot: "ItemMeta",
|
|
145
|
+
...e
|
|
146
|
+
})(({ theme: t, ownerState: o }) => ({
|
|
147
|
+
...t.typography.body2,
|
|
148
|
+
color: t.palette.text.secondary,
|
|
149
|
+
marginTop: t.spacing(0.25),
|
|
150
|
+
...o.descriptionLines > 0 && {
|
|
151
|
+
display: "-webkit-box",
|
|
152
|
+
WebkitBoxOrient: "vertical",
|
|
153
|
+
WebkitLineClamp: o.descriptionLines,
|
|
154
|
+
overflow: "hidden"
|
|
155
|
+
}
|
|
156
|
+
})), T = a("span", {
|
|
157
|
+
name: "HCDataList",
|
|
158
|
+
slot: "ItemEnd",
|
|
159
|
+
...e
|
|
160
|
+
})(({ theme: t, ownerState: o }) => ({
|
|
161
|
+
flex: "0 0 auto",
|
|
162
|
+
display: "flex",
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
justifyContent: "flex-end",
|
|
165
|
+
gap: t.spacing(1),
|
|
166
|
+
// A bar needs room to read as a bar; a badge should only take the width it needs.
|
|
167
|
+
...o.endSlot === "progress" && {
|
|
168
|
+
flex: "0 1 45%",
|
|
169
|
+
minWidth: 120
|
|
170
|
+
}
|
|
171
|
+
})), W = a("span", {
|
|
172
|
+
name: "HCDataList",
|
|
173
|
+
slot: "Badge",
|
|
174
|
+
shouldForwardProp: (t) => t !== "badgeColor" && t !== "badgeBackground" && t !== "badgeBorder"
|
|
175
|
+
})(({ theme: t, badgeColor: o, badgeBackground: r, badgeBorder: d }) => {
|
|
176
|
+
const i = s(t, o) ?? t.palette.text.secondary, n = s(t, d);
|
|
177
|
+
return {
|
|
178
|
+
...t.typography.caption,
|
|
179
|
+
display: "inline-flex",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
whiteSpace: "nowrap",
|
|
182
|
+
color: i,
|
|
183
|
+
// Filled tint by default; an outlined chip is opt-in per state via `borderColor`,
|
|
184
|
+
// which is how the design's two chip styles differ.
|
|
185
|
+
backgroundColor: s(t, r) ?? (n ? "transparent" : g(i, 0.12)),
|
|
186
|
+
border: `1px solid ${n ?? "transparent"}`,
|
|
187
|
+
borderRadius: 999,
|
|
188
|
+
padding: t.spacing(0.5, 1.25),
|
|
189
|
+
fontWeight: 500,
|
|
190
|
+
lineHeight: 1.2
|
|
191
|
+
};
|
|
192
|
+
}), S = a(l, {
|
|
193
|
+
name: "HCDataList",
|
|
194
|
+
slot: "ItemEnd"
|
|
195
|
+
})(({ theme: t }) => ({
|
|
196
|
+
...t.typography.body2,
|
|
197
|
+
color: t.palette.text.primary,
|
|
198
|
+
fontWeight: 500,
|
|
199
|
+
whiteSpace: "nowrap"
|
|
200
|
+
})), j = a(f, {
|
|
201
|
+
name: "HCDataList",
|
|
202
|
+
slot: "Empty",
|
|
203
|
+
...e
|
|
204
|
+
})(({ theme: t }) => ({
|
|
205
|
+
flex: 1,
|
|
206
|
+
display: "flex",
|
|
207
|
+
alignItems: "center",
|
|
208
|
+
justifyContent: "center",
|
|
209
|
+
padding: t.spacing(4, 2),
|
|
210
|
+
color: t.palette.text.secondary,
|
|
211
|
+
...t.typography.body2
|
|
212
|
+
})), A = a("li", {
|
|
213
|
+
name: "HCDataList",
|
|
214
|
+
slot: "LoadMore",
|
|
215
|
+
...e
|
|
216
|
+
})(({ theme: t }) => ({
|
|
217
|
+
listStyle: "none",
|
|
218
|
+
display: "flex",
|
|
219
|
+
alignItems: "center",
|
|
220
|
+
justifyContent: "center",
|
|
221
|
+
minHeight: t.spacing(5),
|
|
222
|
+
color: t.palette.text.secondary
|
|
223
|
+
})), E = a("div", {
|
|
224
|
+
name: "HCDataList",
|
|
225
|
+
slot: "Pagination",
|
|
226
|
+
...e
|
|
227
|
+
})(({ theme: t }) => ({
|
|
228
|
+
flex: "0 0 auto",
|
|
229
|
+
borderTop: `1px solid ${t.palette.divider}`,
|
|
230
|
+
".MuiToolbar-root": {
|
|
231
|
+
minHeight: 24,
|
|
232
|
+
paddingLeft: t.spacing(1)
|
|
233
|
+
},
|
|
234
|
+
".MuiTablePagination-actions .MuiButtonBase-root": {
|
|
235
|
+
padding: t.spacing(0.5)
|
|
236
|
+
},
|
|
237
|
+
".MuiTablePagination-displayedRows": {
|
|
238
|
+
lineHeight: 1
|
|
239
|
+
}
|
|
240
|
+
}));
|
|
241
|
+
export {
|
|
242
|
+
W as DataListBadge,
|
|
243
|
+
w as DataListContent,
|
|
244
|
+
j as DataListEmpty,
|
|
245
|
+
S as DataListEndLabel,
|
|
246
|
+
C as DataListHeader,
|
|
247
|
+
H as DataListHeaderActionButton,
|
|
248
|
+
I as DataListHeaderActionLink,
|
|
249
|
+
B as DataListItemButton,
|
|
250
|
+
T as DataListItemEnd,
|
|
251
|
+
M as DataListItemMain,
|
|
252
|
+
P as DataListItemMeta,
|
|
253
|
+
h as DataListItemRow,
|
|
254
|
+
R as DataListItemStart,
|
|
255
|
+
k as DataListItemTitle,
|
|
256
|
+
v as DataListList,
|
|
257
|
+
A as DataListLoadMore,
|
|
258
|
+
E as DataListPagination,
|
|
259
|
+
m as DataListRoot
|
|
260
|
+
};
|