@ctlyst.id/internal-ui 4.1.16 → 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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
@@ -252,8 +252,10 @@ interface DataTableProps<T> {
|
|
252
252
|
sortDescFirst?: boolean;
|
253
253
|
headerSticky?: boolean;
|
254
254
|
columnPinning?: ColumnPinningState;
|
255
|
+
cellLineClamp?: number;
|
255
256
|
onRowClick?: (data: T) => void;
|
256
|
-
|
257
|
+
disabledRow?: (row: T) => boolean;
|
258
|
+
highlightedRow?: (row: T) => boolean;
|
257
259
|
}
|
258
260
|
declare const isCellDisabled: (row: DisabledRowData, cellId: string) => boolean;
|
259
261
|
type DataTableRefs<T> = Pick<RowSelectionInstance<T>, 'toggleAllRowsSelected'>;
|
package/dist/index.d.ts
CHANGED
@@ -252,8 +252,10 @@ interface DataTableProps<T> {
|
|
252
252
|
sortDescFirst?: boolean;
|
253
253
|
headerSticky?: boolean;
|
254
254
|
columnPinning?: ColumnPinningState;
|
255
|
+
cellLineClamp?: number;
|
255
256
|
onRowClick?: (data: T) => void;
|
256
|
-
|
257
|
+
disabledRow?: (row: T) => boolean;
|
258
|
+
highlightedRow?: (row: T) => boolean;
|
257
259
|
}
|
258
260
|
declare const isCellDisabled: (row: DisabledRowData, cellId: string) => boolean;
|
259
261
|
type DataTableRefs<T> = Pick<RowSelectionInstance<T>, 'toggleAllRowsSelected'>;
|
package/dist/index.js
CHANGED
@@ -1432,7 +1432,17 @@ var useDataTable = ({
|
|
1432
1432
|
};
|
1433
1433
|
var DataTable = React5.forwardRef((props, ref) => {
|
1434
1434
|
var _a, _b, _c, _d, _e, _f, _g;
|
1435
|
-
const {
|
1435
|
+
const {
|
1436
|
+
isLoading,
|
1437
|
+
styles,
|
1438
|
+
headerSticky,
|
1439
|
+
onRowClick,
|
1440
|
+
container,
|
1441
|
+
columnPinning,
|
1442
|
+
disabledRow,
|
1443
|
+
highlightedRow,
|
1444
|
+
cellLineClamp = 2
|
1445
|
+
} = props;
|
1436
1446
|
const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
|
1437
1447
|
const refTable = React5.useRef(null);
|
1438
1448
|
React5.useImperativeHandle(ref, () => ({
|
@@ -1557,14 +1567,14 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1557
1567
|
}
|
1558
1568
|
),
|
1559
1569
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react28.Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row) => {
|
1560
|
-
const
|
1570
|
+
const isDisabledRow = disabledRow && disabledRow(row.original);
|
1571
|
+
const isHighlightedRow = highlightedRow && highlightedRow(row.original);
|
1561
1572
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
1562
1573
|
import_react28.Tr,
|
1563
1574
|
{
|
1564
1575
|
"data-test-id": "-RU0hNYGRzeVM3HQ4cXHl",
|
1565
|
-
tabindex: "0",
|
1566
1576
|
...styles == null ? void 0 : styles.tableRow,
|
1567
|
-
"aria-
|
1577
|
+
"aria-selected": isHighlightedRow,
|
1568
1578
|
css: import_react29.css`
|
1569
1579
|
&:last-child {
|
1570
1580
|
td {
|
@@ -1572,10 +1582,10 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1572
1582
|
}
|
1573
1583
|
}
|
1574
1584
|
`,
|
1575
|
-
cursor:
|
1585
|
+
cursor: isDisabledRow ? "default" : "pointer",
|
1576
1586
|
onMouseDown: (e) => {
|
1577
1587
|
var _a2;
|
1578
|
-
if (!
|
1588
|
+
if (!isDisabledRow && !isHighlightedRow) {
|
1579
1589
|
(_a2 = e.currentTarget) == null ? void 0 : _a2.setAttribute("data-active", "true");
|
1580
1590
|
}
|
1581
1591
|
},
|
@@ -1585,7 +1595,7 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1585
1595
|
},
|
1586
1596
|
onClick: () => {
|
1587
1597
|
if (onRowClick) {
|
1588
|
-
if (
|
1598
|
+
if (isDisabledRow) return;
|
1589
1599
|
onRowClick(row.original);
|
1590
1600
|
}
|
1591
1601
|
},
|
@@ -1618,10 +1628,12 @@ var DataTable = React5.forwardRef((props, ref) => {
|
|
1618
1628
|
onClick: (e) => {
|
1619
1629
|
e.stopPropagation();
|
1620
1630
|
},
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1631
|
+
...cellLineClamp > 0 ? {
|
1632
|
+
noOfLines: cellLineClamp,
|
1633
|
+
sx: {
|
1634
|
+
display: "-webkit-inline-box"
|
1635
|
+
}
|
1636
|
+
} : {},
|
1625
1637
|
children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
|
1626
1638
|
}
|
1627
1639
|
)
|
@@ -7433,6 +7445,11 @@ var baseStyle11 = definePartsStyle10({
|
|
7433
7445
|
td: {
|
7434
7446
|
backgroundColor: "neutral.200"
|
7435
7447
|
}
|
7448
|
+
},
|
7449
|
+
'&[aria-selected="true"]': {
|
7450
|
+
td: {
|
7451
|
+
backgroundColor: "danger.50"
|
7452
|
+
}
|
7436
7453
|
}
|
7437
7454
|
}
|
7438
7455
|
}
|