@machinemetrics/mm-react-components 0.2.3-26 → 0.2.3-27
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/components/ui/data-table/TableView.d.ts.map +1 -1
- package/dist/components/ui/data-table/parts/TableBody.d.ts +7 -1
- package/dist/components/ui/data-table/parts/TableBody.d.ts.map +1 -1
- package/dist/mm-react-components.es.js +24 -6
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js +1 -1
- package/dist/mm-react-components.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableView.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/data-table/TableView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"TableView.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/data-table/TableView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA0L9C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EACvC,OAAO,EACP,IAAI,EACJ,OAAe,EACf,cAAc,EACd,YAAY,EACZ,OAAO,EACP,OAAO,EACP,UAAU,EACV,eAAe,EACf,gBAAwB,EACxB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,oBAAoB,GACrB,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,mBAoK/B"}
|
|
@@ -11,6 +11,12 @@ export interface TableBodyProps<TData, TValue> {
|
|
|
11
11
|
* Defaults to 5 if not provided.
|
|
12
12
|
*/
|
|
13
13
|
skeletonRowCount?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Callback fired when a row is clicked.
|
|
16
|
+
* @param row - The row data
|
|
17
|
+
* @param rowIndex - The index of the row
|
|
18
|
+
*/
|
|
19
|
+
onRowClick?: (row: TData, rowIndex: number) => void;
|
|
14
20
|
}
|
|
15
|
-
export declare function TableBody<TData, TValue>({ loading, resolvedColumns, rows, renderOrder, isDragging, activeColumnId, skeletonRowCount, }: Readonly<TableBodyProps<TData, TValue>>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function TableBody<TData, TValue>({ loading, resolvedColumns, rows, renderOrder, isDragging, activeColumnId, skeletonRowCount, onRowClick, }: Readonly<TableBodyProps<TData, TValue>>): import("react/jsx-runtime").JSX.Element;
|
|
16
22
|
//# sourceMappingURL=TableBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/data-table/parts/TableBody.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,GAAG,EAET,MAAM,uBAAuB,CAAC;AAuH/B,MAAM,WAAW,cAAc,CAAC,KAAK,EAAE,MAAM;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/data-table/parts/TableBody.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,GAAG,EAET,MAAM,uBAAuB,CAAC;AAuH/B,MAAM,WAAW,cAAc,CAAC,KAAK,EAAE,MAAM;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EACvC,OAAO,EACP,eAAe,EACf,IAAI,EACJ,WAAW,EACX,UAAU,EACV,cAAc,EACd,gBAAoB,EACpB,UAAU,GACX,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,2CAkDzC"}
|
|
@@ -30336,7 +30336,8 @@ function TableBody({
|
|
|
30336
30336
|
renderOrder,
|
|
30337
30337
|
isDragging,
|
|
30338
30338
|
activeColumnId,
|
|
30339
|
-
skeletonRowCount = 5
|
|
30339
|
+
skeletonRowCount = 5,
|
|
30340
|
+
onRowClick
|
|
30340
30341
|
}) {
|
|
30341
30342
|
let tableContent;
|
|
30342
30343
|
if (loading) {
|
|
@@ -30344,11 +30345,24 @@ function TableBody({
|
|
|
30344
30345
|
} else if (rows?.length) {
|
|
30345
30346
|
tableContent = rows.map((row) => {
|
|
30346
30347
|
const visibleCells = getVisibleCellsInOrder(row, isDragging, renderOrder);
|
|
30348
|
+
const handleRowClick = onRowClick ? (event) => {
|
|
30349
|
+
const target = event.target;
|
|
30350
|
+
if (!target) return;
|
|
30351
|
+
const interactive = target.closest(
|
|
30352
|
+
'a,button,input,select,textarea,label,[role=checkbox],[data-slot="table-action-trigger"]'
|
|
30353
|
+
);
|
|
30354
|
+
if (interactive) return;
|
|
30355
|
+
onRowClick(row.original, row.index);
|
|
30356
|
+
} : void 0;
|
|
30347
30357
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30348
30358
|
"tr",
|
|
30349
30359
|
{
|
|
30350
30360
|
"data-state": row.getIsSelected() && "selected",
|
|
30351
|
-
className:
|
|
30361
|
+
className: cn$1(
|
|
30362
|
+
"border-b transition-colors hover:bg-[var(--accent)] data-[state=selected]:bg-muted",
|
|
30363
|
+
onRowClick && "cursor-pointer"
|
|
30364
|
+
),
|
|
30365
|
+
onClick: handleRowClick,
|
|
30352
30366
|
children: visibleCells.map(
|
|
30353
30367
|
(cell) => renderTableCell(cell, isDragging, activeColumnId)
|
|
30354
30368
|
)
|
|
@@ -30490,7 +30504,8 @@ function renderTableContent({
|
|
|
30490
30504
|
handleDragOver,
|
|
30491
30505
|
handleDragEnd,
|
|
30492
30506
|
tableRef,
|
|
30493
|
-
debug: debug2
|
|
30507
|
+
debug: debug2,
|
|
30508
|
+
onRowClick
|
|
30494
30509
|
}) {
|
|
30495
30510
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30496
30511
|
DndContext,
|
|
@@ -30534,7 +30549,8 @@ function renderTableContent({
|
|
|
30534
30549
|
renderOrder,
|
|
30535
30550
|
isDragging,
|
|
30536
30551
|
activeColumnId,
|
|
30537
|
-
skeletonRowCount
|
|
30552
|
+
skeletonRowCount,
|
|
30553
|
+
onRowClick
|
|
30538
30554
|
}
|
|
30539
30555
|
)
|
|
30540
30556
|
]
|
|
@@ -30576,7 +30592,8 @@ function DataTable({
|
|
|
30576
30592
|
setGlobalFilter,
|
|
30577
30593
|
handleResetColumns,
|
|
30578
30594
|
onBatchAction: controllerOnBatchAction,
|
|
30579
|
-
onExportComplete: controllerOnExportComplete
|
|
30595
|
+
onExportComplete: controllerOnExportComplete,
|
|
30596
|
+
onRowClick: controllerOnRowClick
|
|
30580
30597
|
} = useTableController({
|
|
30581
30598
|
columns,
|
|
30582
30599
|
data,
|
|
@@ -30652,7 +30669,8 @@ function DataTable({
|
|
|
30652
30669
|
handleDragOver,
|
|
30653
30670
|
handleDragEnd,
|
|
30654
30671
|
tableRef,
|
|
30655
|
-
debug: debug2
|
|
30672
|
+
debug: debug2,
|
|
30673
|
+
onRowClick: controllerOnRowClick
|
|
30656
30674
|
});
|
|
30657
30675
|
const toolbarElement = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30658
30676
|
DataTableToolbar,
|