lecom-ui 5.4.16 → 5.4.18
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.
|
@@ -96,7 +96,7 @@ function DataTable({
|
|
|
96
96
|
const lastColumnFixed = rowsElem.length - 1 === rowElemIndex;
|
|
97
97
|
const lastRow = listRows.length - 1 === listRowIndex;
|
|
98
98
|
const currentElemIsTh = currentElem.tagName === "TH";
|
|
99
|
-
const hasTruncate = currentElem.
|
|
99
|
+
const hasTruncate = currentElem.querySelector(".truncate") !== null;
|
|
100
100
|
const boxShadowWidth = currentElemIsTh ? "-1.5px" : "-0.5px";
|
|
101
101
|
const boxShadow = `#c9c9c9 0px ${lastRow ? "0px" : boxShadowWidth} 0px inset`;
|
|
102
102
|
currentElem.style.position = "sticky";
|
|
@@ -114,35 +114,11 @@ function DataTable({
|
|
|
114
114
|
const allCells = document.querySelectorAll("table#data-table td");
|
|
115
115
|
allCells.forEach((cell) => {
|
|
116
116
|
const cellElem = cell;
|
|
117
|
-
const hasTruncate = cellElem.
|
|
117
|
+
const hasTruncate = cellElem.querySelector(".truncate") !== null;
|
|
118
118
|
if (hasTruncate && !cellElem.hasAttribute("data-fixed")) {
|
|
119
119
|
cellElem.style.backgroundColor = "#ffffff";
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
|
-
const allRows = document.querySelectorAll("table#data-table tbody tr");
|
|
123
|
-
allRows.forEach((row) => {
|
|
124
|
-
const rowElem = row;
|
|
125
|
-
rowElem.addEventListener("mouseenter", () => {
|
|
126
|
-
const cells = rowElem.querySelectorAll("td");
|
|
127
|
-
cells.forEach((cell) => {
|
|
128
|
-
const cellElem = cell;
|
|
129
|
-
const hasTruncate = cellElem.style.overflow === "hidden" && cellElem.style.textOverflow === "ellipsis";
|
|
130
|
-
if (hasTruncate || cellElem.hasAttribute("data-fixed")) {
|
|
131
|
-
cellElem.style.backgroundColor = "#f3f4f6";
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
rowElem.addEventListener("mouseleave", () => {
|
|
136
|
-
const cells = rowElem.querySelectorAll("td");
|
|
137
|
-
cells.forEach((cell) => {
|
|
138
|
-
const cellElem = cell;
|
|
139
|
-
const hasTruncate = cellElem.style.overflow === "hidden" && cellElem.style.textOverflow === "ellipsis";
|
|
140
|
-
if (hasTruncate || cellElem.hasAttribute("data-fixed")) {
|
|
141
|
-
cellElem.style.backgroundColor = "#ffffff";
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
122
|
}
|
|
147
123
|
}, [isLoading, sorting]);
|
|
148
124
|
const throttle = React.useCallback(
|
|
@@ -13,18 +13,7 @@ function Table({
|
|
|
13
13
|
onIsSelected,
|
|
14
14
|
expandedContent
|
|
15
15
|
}) {
|
|
16
|
-
const styleColumn = React.useCallback((meta
|
|
17
|
-
if (elem === "td" && meta.truncate) {
|
|
18
|
-
return {
|
|
19
|
-
width: meta.width,
|
|
20
|
-
maxWidth: meta.maxWidth ?? "0",
|
|
21
|
-
minWidth: meta.minWidth ?? "0",
|
|
22
|
-
overflow: "hidden",
|
|
23
|
-
textOverflow: "ellipsis",
|
|
24
|
-
whiteSpace: "nowrap",
|
|
25
|
-
textAlign: meta.align || "left"
|
|
26
|
-
};
|
|
27
|
-
}
|
|
16
|
+
const styleColumn = React.useCallback((meta) => {
|
|
28
17
|
return {
|
|
29
18
|
width: meta.width,
|
|
30
19
|
maxWidth: meta.maxWidth ?? void 0,
|
|
@@ -59,7 +48,7 @@ function Table({
|
|
|
59
48
|
"data-header": header.id,
|
|
60
49
|
"data-fixed": getFixed(header.column.columnDef.meta),
|
|
61
50
|
style: {
|
|
62
|
-
...styleColumn(header.column.columnDef.meta
|
|
51
|
+
...styleColumn(header.column.columnDef.meta),
|
|
63
52
|
...header.column.columnDef.meta?.headerStyle
|
|
64
53
|
}
|
|
65
54
|
},
|
|
@@ -83,12 +72,9 @@ function Table({
|
|
|
83
72
|
),
|
|
84
73
|
"data-column": cell.column.id,
|
|
85
74
|
"data-fixed": getFixed(cell.column.columnDef.meta),
|
|
86
|
-
style: styleColumn(
|
|
87
|
-
cell.column.columnDef.meta,
|
|
88
|
-
"td"
|
|
89
|
-
)
|
|
75
|
+
style: styleColumn(cell.column.columnDef.meta)
|
|
90
76
|
},
|
|
91
|
-
flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
77
|
+
cell.column.columnDef.meta?.truncate ? /* @__PURE__ */ React.createElement("div", { className: "truncate" }, flexRender(cell.column.columnDef.cell, cell.getContext())) : flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
92
78
|
))
|
|
93
79
|
), row.getIsExpanded() && expandedContent && /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { colSpan: columns.length, className: "p-0" }, expandedContent(row))))) : /* @__PURE__ */ React.createElement("tr", { className: "border-b-[0.5px] [&_td]:hover:bg-grey-100 [&_td]:data-[state=selected]:bg-grey-100" }, /* @__PURE__ */ React.createElement(
|
|
94
80
|
"td",
|