@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.js
CHANGED
@@ -1277,6 +1277,7 @@ var isCellDisabled = (row, cellId) => {
|
|
1277
1277
|
};
|
1278
1278
|
var getCommonPinningStyles = (column) => {
|
1279
1279
|
const isPinned = column.getIsPinned();
|
1280
|
+
const isFirstLeftPinnedColumn = isPinned === "left" && column.getIsFirstColumn("left");
|
1280
1281
|
const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
1281
1282
|
const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
|
1282
1283
|
return {
|
@@ -1285,8 +1286,12 @@ var getCommonPinningStyles = (column) => {
|
|
1285
1286
|
position: isPinned ? "sticky" : "relative",
|
1286
1287
|
zIndex: isPinned ? 1 : 0,
|
1287
1288
|
backgroundColor: "white",
|
1289
|
+
...isFirstLeftPinnedColumn ? {
|
1290
|
+
pl: "16px"
|
1291
|
+
} : { pl: "8px" },
|
1288
1292
|
...isLastLeftPinnedColumn ? {
|
1289
|
-
|
1293
|
+
py: "16px",
|
1294
|
+
pr: "8px",
|
1290
1295
|
"&:after": {
|
1291
1296
|
transition: "all 0.3s",
|
1292
1297
|
content: "''",
|
@@ -1297,12 +1302,13 @@ var getCommonPinningStyles = (column) => {
|
|
1297
1302
|
top: 0,
|
1298
1303
|
transform: "translateX(100%)"
|
1299
1304
|
},
|
1300
|
-
"[pin-left=true] &:after": {
|
1305
|
+
"[data-pin-left=true] &:after": {
|
1301
1306
|
boxShadow: "inset 14px 0px 20px -10px #00000010"
|
1302
1307
|
}
|
1303
1308
|
} : {},
|
1304
1309
|
...isFirstRightPinnedColumn ? {
|
1305
|
-
|
1310
|
+
py: "16px",
|
1311
|
+
px: "8px",
|
1306
1312
|
"&:after": {
|
1307
1313
|
transition: "all 0.3s",
|
1308
1314
|
content: "''",
|
@@ -1313,7 +1319,7 @@ var getCommonPinningStyles = (column) => {
|
|
1313
1319
|
bottom: "-1px",
|
1314
1320
|
transform: "translateX(-100%)"
|
1315
1321
|
},
|
1316
|
-
"[pin-right=true] &:after": {
|
1322
|
+
"[data-pin-right=true] &:after": {
|
1317
1323
|
boxShadow: "inset -14px 0px 20px -10px #00000010"
|
1318
1324
|
}
|
1319
1325
|
} : {}
|
@@ -1413,7 +1419,7 @@ var useDataTable = ({
|
|
1413
1419
|
};
|
1414
1420
|
};
|
1415
1421
|
var DataTable = React5.forwardRef((props, ref) => {
|
1416
|
-
var _a, _b
|
1422
|
+
var _a, _b;
|
1417
1423
|
const { isLoading, styles, headerSticky, onRowClick, container, columnPinning } = props;
|
1418
1424
|
const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
|
1419
1425
|
const refTable = React5.useRef(null);
|
@@ -1421,28 +1427,40 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1421
1427
|
toggleAllRowsSelected
|
1422
1428
|
}));
|
1423
1429
|
let lastPinnedColumn = 0;
|
1424
|
-
|
1425
|
-
var _a2
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1430
|
+
React5.useEffect(() => {
|
1431
|
+
var _a2;
|
1432
|
+
(_a2 = refTable.current) == null ? void 0 : _a2.addEventListener("scroll", (s) => {
|
1433
|
+
var _a3, _b2, _c, _d;
|
1434
|
+
const element = s.currentTarget;
|
1435
|
+
if (element.scrollLeft > 0) {
|
1436
|
+
(_a3 = refTable.current) == null ? void 0 : _a3.setAttribute("data-pin-left", "true");
|
1437
|
+
} else {
|
1438
|
+
(_b2 = refTable.current) == null ? void 0 : _b2.removeAttribute("data-pin-left");
|
1439
|
+
}
|
1440
|
+
if (element.scrollLeft < element.scrollWidth - (lastPinnedColumn + element.offsetWidth)) {
|
1441
|
+
(_c = refTable.current) == null ? void 0 : _c.setAttribute("data-pin-right", "true");
|
1442
|
+
} else {
|
1443
|
+
(_d = refTable.current) == null ? void 0 : _d.removeAttribute("data-pin-right");
|
1444
|
+
}
|
1445
|
+
});
|
1446
|
+
window.addEventListener("resize", (ev) => {
|
1447
|
+
var _a3, _b2, _c, _d, _e;
|
1448
|
+
if (((_a3 = refTable.current) == null ? void 0 : _a3.offsetWidth) === ((_b2 = refTable.current) == null ? void 0 : _b2.scrollWidth)) {
|
1449
|
+
(_c = refTable.current) == null ? void 0 : _c.removeAttribute("data-pin-right");
|
1450
|
+
(_d = refTable.current) == null ? void 0 : _d.removeAttribute("data-pin-left");
|
1451
|
+
} else {
|
1452
|
+
(_e = refTable.current) == null ? void 0 : _e.setAttribute("data-pin-right", "true");
|
1453
|
+
}
|
1454
|
+
});
|
1455
|
+
}, []);
|
1438
1456
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
1439
1457
|
import_react28.Box,
|
1440
1458
|
{
|
1441
1459
|
overflowX: "auto",
|
1442
1460
|
overflowY: "hidden",
|
1443
1461
|
position: "relative",
|
1444
|
-
pl: ((
|
1445
|
-
pr: ((
|
1462
|
+
pl: ((_a = columnPinning == null ? void 0 : columnPinning.left) == null ? void 0 : _a.length) ? 0 : 4,
|
1463
|
+
pr: ((_b = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _b.length) ? 0 : 4,
|
1446
1464
|
maxW: "100%",
|
1447
1465
|
w: "full",
|
1448
1466
|
ref: refTable,
|