@ctlyst.id/internal-ui 3.4.1 → 3.4.3
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/index.js +39 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -935,6 +935,7 @@ var isCellDisabled = (row, cellId) => {
|
|
935
935
|
};
|
936
936
|
var getCommonPinningStyles = (column) => {
|
937
937
|
const isPinned = column.getIsPinned();
|
938
|
+
const isFirstLeftPinnedColumn = isPinned === "left" && column.getIsFirstColumn("left");
|
938
939
|
const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
939
940
|
const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
|
940
941
|
return {
|
@@ -943,8 +944,12 @@ var getCommonPinningStyles = (column) => {
|
|
943
944
|
position: isPinned ? "sticky" : "relative",
|
944
945
|
zIndex: isPinned ? 1 : 0,
|
945
946
|
backgroundColor: "white",
|
947
|
+
...isFirstLeftPinnedColumn ? {
|
948
|
+
pl: "16px"
|
949
|
+
} : { pl: "8px" },
|
946
950
|
...isLastLeftPinnedColumn ? {
|
947
|
-
|
951
|
+
py: "16px",
|
952
|
+
pr: "8px",
|
948
953
|
"&:after": {
|
949
954
|
transition: "all 0.3s",
|
950
955
|
content: "''",
|
@@ -955,12 +960,13 @@ var getCommonPinningStyles = (column) => {
|
|
955
960
|
top: 0,
|
956
961
|
transform: "translateX(100%)"
|
957
962
|
},
|
958
|
-
"[pin-left=true] &:after": {
|
963
|
+
"[data-pin-left=true] &:after": {
|
959
964
|
boxShadow: "inset 14px 0px 20px -10px #00000010"
|
960
965
|
}
|
961
966
|
} : {},
|
962
967
|
...isFirstRightPinnedColumn ? {
|
963
|
-
|
968
|
+
py: "16px",
|
969
|
+
px: "8px",
|
964
970
|
"&:after": {
|
965
971
|
transition: "all 0.3s",
|
966
972
|
content: "''",
|
@@ -971,7 +977,7 @@ var getCommonPinningStyles = (column) => {
|
|
971
977
|
bottom: "-1px",
|
972
978
|
transform: "translateX(-100%)"
|
973
979
|
},
|
974
|
-
"[pin-right=true] &:after": {
|
980
|
+
"[data-pin-right=true] &:after": {
|
975
981
|
boxShadow: "inset -14px 0px 20px -10px #00000010"
|
976
982
|
}
|
977
983
|
} : {}
|
@@ -1071,7 +1077,7 @@ var useDataTable = ({
|
|
1071
1077
|
};
|
1072
1078
|
};
|
1073
1079
|
var DataTable = React5.forwardRef((props, ref) => {
|
1074
|
-
var _a, _b
|
1080
|
+
var _a, _b;
|
1075
1081
|
const { isLoading, styles, headerSticky, onRowClick, container, columnPinning } = props;
|
1076
1082
|
const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
|
1077
1083
|
const refTable = React5.useRef(null);
|
@@ -1079,28 +1085,40 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1079
1085
|
toggleAllRowsSelected
|
1080
1086
|
}));
|
1081
1087
|
let lastPinnedColumn = 0;
|
1082
|
-
|
1083
|
-
var _a2
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1088
|
+
React5.useEffect(() => {
|
1089
|
+
var _a2;
|
1090
|
+
(_a2 = refTable.current) == null ? void 0 : _a2.addEventListener("scroll", (s) => {
|
1091
|
+
var _a3, _b2, _c, _d;
|
1092
|
+
const element = s.currentTarget;
|
1093
|
+
if (element.scrollLeft > 0) {
|
1094
|
+
(_a3 = refTable.current) == null ? void 0 : _a3.setAttribute("data-pin-left", "true");
|
1095
|
+
} else {
|
1096
|
+
(_b2 = refTable.current) == null ? void 0 : _b2.removeAttribute("data-pin-left");
|
1097
|
+
}
|
1098
|
+
if (element.scrollLeft < element.scrollWidth - (lastPinnedColumn + element.offsetWidth)) {
|
1099
|
+
(_c = refTable.current) == null ? void 0 : _c.setAttribute("data-pin-right", "true");
|
1100
|
+
} else {
|
1101
|
+
(_d = refTable.current) == null ? void 0 : _d.removeAttribute("data-pin-right");
|
1102
|
+
}
|
1103
|
+
});
|
1104
|
+
window.addEventListener("resize", (ev) => {
|
1105
|
+
var _a3, _b2, _c, _d, _e;
|
1106
|
+
if (((_a3 = refTable.current) == null ? void 0 : _a3.offsetWidth) === ((_b2 = refTable.current) == null ? void 0 : _b2.scrollWidth)) {
|
1107
|
+
(_c = refTable.current) == null ? void 0 : _c.removeAttribute("data-pin-right");
|
1108
|
+
(_d = refTable.current) == null ? void 0 : _d.removeAttribute("data-pin-left");
|
1109
|
+
} else {
|
1110
|
+
(_e = refTable.current) == null ? void 0 : _e.setAttribute("data-pin-right", "true");
|
1111
|
+
}
|
1112
|
+
});
|
1113
|
+
}, []);
|
1096
1114
|
return /* @__PURE__ */ jsx24(
|
1097
1115
|
Box11,
|
1098
1116
|
{
|
1099
1117
|
overflowX: "auto",
|
1100
1118
|
overflowY: "hidden",
|
1101
1119
|
position: "relative",
|
1102
|
-
pl: ((
|
1103
|
-
pr: ((
|
1120
|
+
pl: ((_a = columnPinning == null ? void 0 : columnPinning.left) == null ? void 0 : _a.length) ? 0 : 4,
|
1121
|
+
pr: ((_b = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _b.length) ? 0 : 4,
|
1104
1122
|
maxW: "100%",
|
1105
1123
|
w: "full",
|
1106
1124
|
ref: refTable,
|