@ctlyst.id/internal-ui 3.4.1 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
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
- padding: "16px 8px 16px 8px",
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
- padding: "16px 8px 16px 8px",
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, _c;
1422
+ var _a, _b, _c, _d;
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);
@@ -1422,17 +1428,17 @@ var DataTable = React5.forwardRef((props, ref) => {
1422
1428
  }));
1423
1429
  let lastPinnedColumn = 0;
1424
1430
  (_a = refTable.current) == null ? void 0 : _a.addEventListener("scroll", (s) => {
1425
- var _a2, _b2, _c2, _d;
1431
+ var _a2, _b2, _c2, _d2;
1426
1432
  const element = s.currentTarget;
1427
1433
  if (element.scrollLeft > 0) {
1428
- (_a2 = refTable.current) == null ? void 0 : _a2.setAttribute("pin-left", "true");
1434
+ (_a2 = refTable.current) == null ? void 0 : _a2.setAttribute("data-pin-left", "true");
1429
1435
  } else {
1430
- (_b2 = refTable.current) == null ? void 0 : _b2.removeAttribute("pin-left");
1436
+ (_b2 = refTable.current) == null ? void 0 : _b2.removeAttribute("data-pin-left");
1431
1437
  }
1432
1438
  if (element.scrollLeft < element.scrollWidth - (lastPinnedColumn + element.offsetWidth)) {
1433
- (_c2 = refTable.current) == null ? void 0 : _c2.setAttribute("pin-right", "true");
1439
+ (_c2 = refTable.current) == null ? void 0 : _c2.setAttribute("data-pin-right", "true");
1434
1440
  } else {
1435
- (_d = refTable.current) == null ? void 0 : _d.removeAttribute("pin-right");
1441
+ (_d2 = refTable.current) == null ? void 0 : _d2.removeAttribute("data-pin-right");
1436
1442
  }
1437
1443
  });
1438
1444
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
@@ -1446,6 +1452,7 @@ var DataTable = React5.forwardRef((props, ref) => {
1446
1452
  maxW: "100%",
1447
1453
  w: "full",
1448
1454
  ref: refTable,
1455
+ ...((_d = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _d.length) ? { "data-pin-right": true } : {},
1449
1456
  ...container,
1450
1457
  children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react28.Table, { ...styles == null ? void 0 : styles.table, "data-loading": "true", children: [
1451
1458
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react28.Thead, { ...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react28.Tr, { mx: "2", ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(