sag_components 2.0.0-beta252 → 2.0.0-beta253

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.esm.js CHANGED
@@ -42862,14 +42862,27 @@ const TableBody = /*#__PURE__*/forwardRef(({
42862
42862
  return `${value || 0}%`;
42863
42863
  case "date":
42864
42864
  try {
42865
+ let formattedDate = value;
42865
42866
  if (column.format === "MM/DD/YYYY" && value) {
42866
42867
  const date = new Date(value);
42867
42868
  if (isNaN(date.getTime())) {
42868
42869
  return String(value);
42869
42870
  }
42870
- return `${(date.getMonth() + 1).toString().padStart(2, "0")}/${date.getDate().toString().padStart(2, "0")}/${date.getFullYear()}`;
42871
+ formattedDate = `${(date.getMonth() + 1).toString().padStart(2, "0")}/${date.getDate().toString().padStart(2, "0")}/${date.getFullYear()}`;
42872
+ } else {
42873
+ formattedDate = String(value || "");
42871
42874
  }
42872
- return String(value || "");
42875
+
42876
+ // Check if this column should check for expiration
42877
+ if (column.checkExpiration !== false && value && isDateExpired(value)) {
42878
+ return /*#__PURE__*/React$1.createElement("span", {
42879
+ style: {
42880
+ color: "#D23630",
42881
+ textDecoration: "line-through"
42882
+ }
42883
+ }, formattedDate);
42884
+ }
42885
+ return formattedDate;
42873
42886
  } catch (e) {
42874
42887
  console.warn('Error formatting date:', e);
42875
42888
  return String(value || "");
@@ -43373,7 +43386,21 @@ const TableBody = /*#__PURE__*/forwardRef(({
43373
43386
  rowIndex: rowIndex
43374
43387
  });
43375
43388
  }
43376
- console.log('handler--------', row, columnKey, currentValue, rowIndex);
43389
+ };
43390
+
43391
+ // Helper function to check if date is expired (past current date)
43392
+ const isDateExpired = dateString => {
43393
+ if (!dateString) return false;
43394
+ try {
43395
+ const date = new Date(dateString);
43396
+ if (isNaN(date.getTime())) return false;
43397
+ const today = new Date();
43398
+ today.setHours(0, 0, 0, 0); // Reset time to start of day for fair comparison
43399
+ date.setHours(0, 0, 0, 0);
43400
+ return date < today;
43401
+ } catch (error) {
43402
+ return false;
43403
+ }
43377
43404
  };
43378
43405
  return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(StyledTableBody, {
43379
43406
  ref: ref