@ctlyst.id/internal-ui 4.1.9 → 4.1.11

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -253,6 +253,7 @@ interface DataTableProps<T> {
253
253
  headerSticky?: boolean;
254
254
  columnPinning?: ColumnPinningState;
255
255
  onRowClick?: (data: T) => void;
256
+ isRowDisabled?: (row: T) => boolean;
256
257
  }
257
258
  declare const isCellDisabled: (row: DisabledRowData, cellId: string) => boolean;
258
259
  type DataTableRefs<T> = Pick<RowSelectionInstance<T>, 'toggleAllRowsSelected'>;
package/dist/index.d.ts CHANGED
@@ -253,6 +253,7 @@ interface DataTableProps<T> {
253
253
  headerSticky?: boolean;
254
254
  columnPinning?: ColumnPinningState;
255
255
  onRowClick?: (data: T) => void;
256
+ isRowDisabled?: (row: T) => boolean;
256
257
  }
257
258
  declare const isCellDisabled: (row: DisabledRowData, cellId: string) => boolean;
258
259
  type DataTableRefs<T> = Pick<RowSelectionInstance<T>, 'toggleAllRowsSelected'>;
package/dist/index.js CHANGED
@@ -1432,7 +1432,7 @@ var useDataTable = ({
1432
1432
  };
1433
1433
  var DataTable = React5.forwardRef((props, ref) => {
1434
1434
  var _a, _b, _c, _d, _e, _f, _g;
1435
- const { isLoading, styles, headerSticky, onRowClick, container, columnPinning } = props;
1435
+ const { isLoading, styles, headerSticky, onRowClick, container, columnPinning, isRowDisabled } = props;
1436
1436
  const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
1437
1437
  const refTable = React5.useRef(null);
1438
1438
  React5.useImperativeHandle(ref, () => ({
@@ -1570,6 +1570,7 @@ var DataTable = React5.forwardRef((props, ref) => {
1570
1570
  }
1571
1571
  }
1572
1572
  `,
1573
+ cursor: isRowDisabled && isRowDisabled(row.original) ? "default" : "pointer",
1573
1574
  onMouseDown: (e) => {
1574
1575
  var _a2;
1575
1576
  (_a2 = e.currentTarget) == null ? void 0 : _a2.setAttribute("data-active", "true");
@@ -1579,7 +1580,7 @@ var DataTable = React5.forwardRef((props, ref) => {
1579
1580
  (_a2 = e.currentTarget) == null ? void 0 : _a2.removeAttribute("data-active");
1580
1581
  },
1581
1582
  onClick: () => {
1582
- if (onRowClick) {
1583
+ if (onRowClick && isRowDisabled && !isRowDisabled(row.original)) {
1583
1584
  onRowClick(row.original);
1584
1585
  }
1585
1586
  },