@ctlyst.id/internal-ui 4.2.0 → 4.2.1
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
@@ -254,7 +254,8 @@ interface DataTableProps<T> {
|
|
254
254
|
columnPinning?: ColumnPinningState;
|
255
255
|
cellLineClamp?: number;
|
256
256
|
onRowClick?: (data: T) => void;
|
257
|
-
|
257
|
+
disabledRow?: (row: T) => boolean;
|
258
|
+
highlightedRow?: (row: T) => boolean;
|
258
259
|
}
|
259
260
|
declare const isCellDisabled: (row: DisabledRowData, cellId: string) => boolean;
|
260
261
|
type DataTableRefs<T> = Pick<RowSelectionInstance<T>, 'toggleAllRowsSelected'>;
|
package/dist/index.d.ts
CHANGED
@@ -254,7 +254,8 @@ interface DataTableProps<T> {
|
|
254
254
|
columnPinning?: ColumnPinningState;
|
255
255
|
cellLineClamp?: number;
|
256
256
|
onRowClick?: (data: T) => void;
|
257
|
-
|
257
|
+
disabledRow?: (row: T) => boolean;
|
258
|
+
highlightedRow?: (row: T) => boolean;
|
258
259
|
}
|
259
260
|
declare const isCellDisabled: (row: DisabledRowData, cellId: string) => boolean;
|
260
261
|
type DataTableRefs<T> = Pick<RowSelectionInstance<T>, 'toggleAllRowsSelected'>;
|
package/dist/index.js
CHANGED
@@ -1439,7 +1439,8 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1439
1439
|
onRowClick,
|
1440
1440
|
container,
|
1441
1441
|
columnPinning,
|
1442
|
-
|
1442
|
+
disabledRow,
|
1443
|
+
highlightedRow,
|
1443
1444
|
cellLineClamp = 2
|
1444
1445
|
} = props;
|
1445
1446
|
const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
|
@@ -1566,14 +1567,14 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1566
1567
|
}
|
1567
1568
|
),
|
1568
1569
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react28.Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row) => {
|
1569
|
-
const
|
1570
|
+
const isDisabledRow = disabledRow && disabledRow(row.original);
|
1571
|
+
const isHighlightedRow = highlightedRow && highlightedRow(row.original);
|
1570
1572
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
1571
1573
|
import_react28.Tr,
|
1572
1574
|
{
|
1573
1575
|
"data-test-id": "-RU0hNYGRzeVM3HQ4cXHl",
|
1574
|
-
tabindex: "0",
|
1575
1576
|
...styles == null ? void 0 : styles.tableRow,
|
1576
|
-
"aria-
|
1577
|
+
"aria-selected": isHighlightedRow,
|
1577
1578
|
css: import_react29.css`
|
1578
1579
|
&:last-child {
|
1579
1580
|
td {
|
@@ -1581,10 +1582,10 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1581
1582
|
}
|
1582
1583
|
}
|
1583
1584
|
`,
|
1584
|
-
cursor:
|
1585
|
+
cursor: isDisabledRow ? "default" : "pointer",
|
1585
1586
|
onMouseDown: (e) => {
|
1586
1587
|
var _a2;
|
1587
|
-
if (!
|
1588
|
+
if (!isDisabledRow && !isHighlightedRow) {
|
1588
1589
|
(_a2 = e.currentTarget) == null ? void 0 : _a2.setAttribute("data-active", "true");
|
1589
1590
|
}
|
1590
1591
|
},
|
@@ -1594,7 +1595,7 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1594
1595
|
},
|
1595
1596
|
onClick: () => {
|
1596
1597
|
if (onRowClick) {
|
1597
|
-
if (
|
1598
|
+
if (isDisabledRow) return;
|
1598
1599
|
onRowClick(row.original);
|
1599
1600
|
}
|
1600
1601
|
},
|
@@ -7444,6 +7445,11 @@ var baseStyle11 = definePartsStyle10({
|
|
7444
7445
|
td: {
|
7445
7446
|
backgroundColor: "neutral.200"
|
7446
7447
|
}
|
7448
|
+
},
|
7449
|
+
'&[aria-selected="true"]': {
|
7450
|
+
td: {
|
7451
|
+
backgroundColor: "danger.50"
|
7452
|
+
}
|
7447
7453
|
}
|
7448
7454
|
}
|
7449
7455
|
}
|