@bwp-web/components 1.2.0 → 1.3.0

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/README.md CHANGED
@@ -282,7 +282,7 @@ import BrokenImageIcon from '@mui/icons-material/BrokenImage';
282
282
 
283
283
  ### BiampTable
284
284
 
285
- A composable data table built on TanStack React Table v8 with support for sorting, row selection, pagination, column visibility, global search, column filters, and CSV export.
285
+ A composable data table built on TanStack React Table v8 with support for sorting, row selection, pagination, column visibility, global search, column filters, CSV export, and per-slot prop overrides for restyling internal MUI elements.
286
286
 
287
287
  Requires `@tanstack/react-table` >= 8.0.0 as a peer dependency.
288
288
 
@@ -1,6 +1,29 @@
1
- import { type BoxProps } from '@mui/material';
2
- import { type Table } from '@tanstack/react-table';
1
+ import { type BoxProps, type TableBodyProps as MuiTableBodyProps, type TableCellProps as MuiTableCellProps, type TableHeadProps as MuiTableHeadProps, type TableProps as MuiTableProps, type TableRowProps as MuiTableRowProps } from '@mui/material';
2
+ import { type Cell, type Header, type Row, type Table } from '@tanstack/react-table';
3
3
  import { type ReactNode } from 'react';
4
+ import { type SlotPropsOrFn } from './slotProps';
5
+ export type BiampTableSlotProps<TData> = {
6
+ /** Props merged onto the MUI `<Table>`. `sx` composes with defaults. */
7
+ table?: MuiTableProps;
8
+ /** Props merged onto the `<TableHead>`. `sx` composes with defaults. */
9
+ head?: MuiTableHeadProps;
10
+ /** Props merged onto the `<TableBody>`. `sx` composes with defaults. */
11
+ body?: MuiTableBodyProps;
12
+ /** Props merged onto the header `<TableRow>`. `sx` composes with defaults. */
13
+ headerRow?: MuiTableRowProps;
14
+ /** Props merged onto each header `<TableCell>`. Pass a function for per-column overrides. `sx` composes with defaults. */
15
+ headerCell?: SlotPropsOrFn<MuiTableCellProps, {
16
+ header: Header<TData, unknown>;
17
+ }>;
18
+ /** Props merged onto each body `<TableRow>`. Pass a function for per-row overrides. `sx` composes with defaults. */
19
+ row?: SlotPropsOrFn<MuiTableRowProps, {
20
+ row: Row<TData>;
21
+ }>;
22
+ /** Props merged onto each body `<TableCell>`. Pass a function for per-cell overrides. `sx` composes with defaults. */
23
+ cell?: SlotPropsOrFn<MuiTableCellProps, {
24
+ cell: Cell<TData, unknown>;
25
+ }>;
26
+ };
4
27
  type RowClickProps<TData> = {
5
28
  /** Called when a clickable body row is clicked. Receives the row's original data. */
6
29
  onRowClick: (row: TData) => void;
@@ -34,7 +57,15 @@ export type BiampTableProps<TData> = BoxProps & RowClickProps<TData> & Selection
34
57
  empty?: boolean | ReactNode;
35
58
  /** Returns a human-readable name for a row, used in ARIA labels (e.g. "Select: Conference Room A"). Falls back to row index. */
36
59
  getRowLabel?: (row: TData) => string;
60
+ /**
61
+ * Per-slot props merged onto the internal MUI elements (`table`, `head`, `body`,
62
+ * `headerRow`, `headerCell`, `row`, `cell`). `sx` composes with the defaults
63
+ * instead of replacing them. `row`, `cell`, and `headerCell` accept a function
64
+ * of the row/cell/header for data-aware overrides — memoize these callbacks to
65
+ * avoid breaking row memoization.
66
+ */
67
+ slotProps?: BiampTableSlotProps<TData>;
37
68
  };
38
- export declare function BiampTable<TData>({ table, onRowClick, isRowClickable, loading, error, empty, enableRowSelection, enableExpanding, hideSelectAll, selectChildrenWithParent, getRowLabel, sx, ...boxProps }: BiampTableProps<TData>): import("react/jsx-runtime").JSX.Element;
69
+ export declare function BiampTable<TData>({ table, onRowClick, isRowClickable, loading, error, empty, enableRowSelection, enableExpanding, hideSelectAll, selectChildrenWithParent, getRowLabel, slotProps, sx, ...boxProps }: BiampTableProps<TData>): import("react/jsx-runtime").JSX.Element;
39
70
  export {};
40
71
  //# sourceMappingURL=BiampTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BiampTable.d.ts","sourceRoot":"","sources":["../../src/BiampTable/BiampTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAWd,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAwB,KAAK,KAAK,EAAE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B,EAC1B,eAAuB,EACvB,aAAa,EACb,wBAAgC,EAChC,WAAW,EACX,SAAS,EACT,EAAE,EACF,GAAG,QAAQ,EACZ,EAAE,eAAe,CAAC,KAAK,CAAC,2CAgLxB"}
@@ -1,4 +1,4 @@
1
- export { BiampTable, type BiampTableProps } from './BiampTable';
1
+ export { BiampTable, type BiampTableProps, type BiampTableSlotProps, } from './BiampTable';
2
2
  export { BiampTableContainer, type BiampTableContainerProps, } from './BiampTableContainer';
3
3
  export { BiampTableCellActionButton, type BiampTableCellActionButtonProps, } from './BiampTableCellActionButton';
4
4
  export { BiampTableColumnVisibility, type BiampTableColumnVisibilityProps, getColumnVisibilityDirtyCount, getDefaultColumnVisibility, toVisibilityState, type ColumnVisibility, } from './BiampTableColumnVisibility';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/BiampTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,KAAK,+BAA+B,GACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,0BAA0B,EAC1B,KAAK,+BAA+B,EACpC,6BAA6B,EAC7B,0BAA0B,EAC1B,iBAAiB,EACjB,KAAK,gBAAgB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iCAAiC,EACjC,KAAK,sCAAsC,GAC5C,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAC7B,KAAK,kCAAkC,GACxC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,KAAK,8BAA8B,GACpC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,kCAAkC,EAClC,wBAAwB,EACxB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/BiampTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,KAAK,+BAA+B,GACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,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ACpB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { SxProps, Theme } from '@mui/material';
2
+ export type SlotPropsOrFn<TProps, TCtx> = TProps | ((ctx: TCtx) => TProps);
3
+ export declare function resolveSlot<TProps, TCtx>(slot: SlotPropsOrFn<TProps, TCtx> | undefined, ctx: TCtx): TProps | undefined;
4
+ export declare function mergeSx(...inputs: Array<SxProps<Theme> | false | null | undefined>): SxProps<Theme>;
5
+ //# sourceMappingURL=slotProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slotProps.d.ts","sourceRoot":"","sources":["../../src/BiampTable/slotProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC;AAE3E,wBAAgB,WAAW,CAAC,MAAM,EAAE,IAAI,EACtC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,SAAS,EAC7C,GAAG,EAAE,IAAI,GACR,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,OAAO,CACrB,GAAG,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,GAC1D,OAAO,CAAC,KAAK,CAAC,CAIhB"}
package/dist/index.cjs CHANGED
@@ -1086,6 +1086,15 @@ function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
1086
1086
  return status === "loading" || status === "ending";
1087
1087
  }
1088
1088
 
1089
+ // src/BiampTable/slotProps.ts
1090
+ function resolveSlot(slot, ctx) {
1091
+ if (!slot) return void 0;
1092
+ return typeof slot === "function" ? slot(ctx) : slot;
1093
+ }
1094
+ function mergeSx(...inputs) {
1095
+ return inputs.filter((v) => Boolean(v)).flatMap((v) => Array.isArray(v) ? v : [v]);
1096
+ }
1097
+
1089
1098
  // src/BiampTable/BiampTable.tsx
1090
1099
  var import_jsx_runtime9 = require("react/jsx-runtime");
1091
1100
  var overlaySx = {
@@ -1156,24 +1165,38 @@ function BiampTableRowInner({
1156
1165
  enableExpanding,
1157
1166
  selectChildrenWithParent,
1158
1167
  getRowLabel,
1159
- hasExpandableRows
1168
+ hasExpandableRows,
1169
+ rowSlotProps,
1170
+ cellSlotProps
1160
1171
  }) {
1161
1172
  const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
1173
+ const resolvedRow = resolveSlot(rowSlotProps, { row });
1174
+ const {
1175
+ sx: userRowSx,
1176
+ onClick: userRowOnClick,
1177
+ onKeyDown: userRowOnKeyDown,
1178
+ ...restRowProps
1179
+ } = resolvedRow ?? {};
1162
1180
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1163
1181
  import_material7.TableRow,
1164
1182
  {
1183
+ ...restRowProps,
1165
1184
  hover: clickable,
1166
1185
  selected: enableRowSelection ? isSelected : void 0,
1167
1186
  role: clickable ? "button" : void 0,
1168
1187
  tabIndex: clickable ? 0 : void 0,
1169
- sx: clickable ? rowCursorPointerSx : void 0,
1170
- onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
1188
+ sx: mergeSx(clickable && rowCursorPointerSx, userRowSx),
1189
+ onClick: clickable && onRowClick ? (e) => {
1190
+ onRowClick(row.original);
1191
+ userRowOnClick?.(e);
1192
+ } : userRowOnClick,
1171
1193
  onKeyDown: clickable && onRowClick ? (e) => {
1172
1194
  if (e.key === "Enter" || e.key === " ") {
1173
1195
  e.preventDefault();
1174
1196
  onRowClick(row.original);
1175
1197
  }
1176
- } : void 0,
1198
+ userRowOnKeyDown?.(e);
1199
+ } : userRowOnKeyDown,
1177
1200
  children: [
1178
1201
  enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableCell, { padding: "checkbox", sx: selectionCellSx, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1179
1202
  import_material7.Checkbox,
@@ -1199,14 +1222,18 @@ function BiampTableRowInner({
1199
1222
  cell.column.columnDef.cell,
1200
1223
  cell.getContext()
1201
1224
  );
1225
+ const resolvedCell = resolveSlot(cellSlotProps, { cell });
1226
+ const { sx: userCellSx, ...restCellProps } = resolvedCell ?? {};
1202
1227
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1203
1228
  import_material7.TableCell,
1204
1229
  {
1230
+ ...restCellProps,
1205
1231
  "data-sticky": sticky || void 0,
1206
- sx: {
1207
- ...cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
1208
- pl: isExpandCell ? "6px" : "12px"
1209
- },
1232
+ sx: mergeSx(
1233
+ cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
1234
+ { pl: isExpandCell ? "6px" : "12px" },
1235
+ userCellSx
1236
+ ),
1210
1237
  children: (() => {
1211
1238
  if (sticky) return content;
1212
1239
  const truncate = cell.column.columnDef.meta?.truncate ?? true;
@@ -1262,7 +1289,7 @@ function BiampTableRowInner({
1262
1289
  );
1263
1290
  }
1264
1291
  function biampTableRowPropsAreEqual(prev, next) {
1265
- return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel;
1292
+ return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel && prev.rowSlotProps === next.rowSlotProps && prev.cellSlotProps === next.cellSlotProps;
1266
1293
  }
1267
1294
  var BiampTableRow = import_react4.default.memo(
1268
1295
  BiampTableRowInner,
@@ -1280,9 +1307,14 @@ function BiampTable({
1280
1307
  hideSelectAll,
1281
1308
  selectChildrenWithParent = false,
1282
1309
  getRowLabel,
1310
+ slotProps,
1283
1311
  sx,
1284
1312
  ...boxProps
1285
1313
  }) {
1314
+ const { sx: userTableSx, ...restTableSlotProps } = slotProps?.table ?? {};
1315
+ const { sx: userHeadSx, ...restHeadSlotProps } = slotProps?.head ?? {};
1316
+ const { sx: userBodySx, ...restBodySlotProps } = slotProps?.body ?? {};
1317
+ const { sx: userHeaderRowSx, ...restHeaderRowSlotProps } = slotProps?.headerRow ?? {};
1286
1318
  const tableMinWidth = table.getVisibleLeafColumns().reduce(
1287
1319
  (sum, col) => {
1288
1320
  const mw = col.columnDef.meta?.minWidth;
@@ -1314,73 +1346,98 @@ function BiampTable({
1314
1346
  import_material7.Table,
1315
1347
  {
1316
1348
  "aria-busy": showLoading || void 0,
1317
- sx: { minWidth: tableMinWidth, tableLayout: "auto" },
1349
+ ...restTableSlotProps,
1350
+ sx: mergeSx(
1351
+ { minWidth: tableMinWidth, tableLayout: "auto" },
1352
+ userTableSx
1353
+ ),
1318
1354
  children: [
1319
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material7.TableRow, { children: [
1320
- enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableCell, { padding: "checkbox", sx: headerSelectionCellSx, children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1321
- import_material7.Checkbox,
1322
- {
1323
- checked: table.getIsAllPageRowsSelected(),
1324
- indeterminate: table.getIsSomePageRowsSelected(),
1325
- onChange: table.getToggleAllPageRowsSelectedHandler(),
1326
- sx: rows.length === 0 ? checkboxHiddenHeaderSx : void 0,
1327
- slotProps: { input: { "aria-label": "Select all rows" } }
1328
- }
1329
- ) }),
1330
- headerGroup.headers.map((header) => {
1331
- const sticky = header.column.columnDef.meta?.sticky;
1332
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1333
- import_material7.TableCell,
1334
- {
1335
- "data-sticky": sticky || void 0,
1336
- sortDirection: header.column.getIsSorted() || false,
1337
- ...header.column.getCanSort() && {
1338
- "aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
1339
- },
1340
- sx: cellSx(
1341
- sticky,
1342
- header.column.columnDef.meta?.minWidth,
1343
- 3
1344
- ),
1345
- children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1346
- import_material7.TableSortLabel,
1355
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableHead, { ...restHeadSlotProps, sx: mergeSx(userHeadSx), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1356
+ import_material7.TableRow,
1357
+ {
1358
+ ...restHeaderRowSlotProps,
1359
+ sx: mergeSx(userHeaderRowSx),
1360
+ children: [
1361
+ enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableCell, { padding: "checkbox", sx: headerSelectionCellSx, children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1362
+ import_material7.Checkbox,
1363
+ {
1364
+ checked: table.getIsAllPageRowsSelected(),
1365
+ indeterminate: table.getIsSomePageRowsSelected(),
1366
+ onChange: table.getToggleAllPageRowsSelectedHandler(),
1367
+ sx: rows.length === 0 ? checkboxHiddenHeaderSx : void 0,
1368
+ slotProps: { input: { "aria-label": "Select all rows" } }
1369
+ }
1370
+ ) }),
1371
+ headerGroup.headers.map((header) => {
1372
+ const sticky = header.column.columnDef.meta?.sticky;
1373
+ const resolvedHeaderCell = resolveSlot(slotProps?.headerCell, {
1374
+ header
1375
+ });
1376
+ const { sx: userHeaderCellSx, ...restHeaderCellProps } = resolvedHeaderCell ?? {};
1377
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1378
+ import_material7.TableCell,
1347
1379
  {
1348
- active: !!header.column.getIsSorted(),
1349
- direction: header.column.getIsSorted() || "asc",
1350
- onClick: header.column.getToggleSortingHandler(),
1351
- ...header.column.getIsSorted() && {
1352
- IconComponent: header.column.getIsSorted() === "asc" ? import_assets5.DropdownChevronUpIcon : import_assets5.DropdownChevronDownIcon
1380
+ ...restHeaderCellProps,
1381
+ "data-sticky": sticky || void 0,
1382
+ sortDirection: header.column.getIsSorted() || false,
1383
+ ...header.column.getCanSort() && {
1384
+ "aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
1353
1385
  },
1354
- children: (0, import_react_table.flexRender)(
1386
+ sx: mergeSx(
1387
+ cellSx(sticky, header.column.columnDef.meta?.minWidth, 3),
1388
+ userHeaderCellSx
1389
+ ),
1390
+ children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1391
+ import_material7.TableSortLabel,
1392
+ {
1393
+ active: !!header.column.getIsSorted(),
1394
+ direction: header.column.getIsSorted() || "asc",
1395
+ onClick: header.column.getToggleSortingHandler(),
1396
+ ...header.column.getIsSorted() && {
1397
+ IconComponent: header.column.getIsSorted() === "asc" ? import_assets5.DropdownChevronUpIcon : import_assets5.DropdownChevronDownIcon
1398
+ },
1399
+ children: (0, import_react_table.flexRender)(
1400
+ header.column.columnDef.header,
1401
+ header.getContext()
1402
+ )
1403
+ }
1404
+ ) : (0, import_react_table.flexRender)(
1355
1405
  header.column.columnDef.header,
1356
1406
  header.getContext()
1357
1407
  )
1358
- }
1359
- ) : (0, import_react_table.flexRender)(
1360
- header.column.columnDef.header,
1361
- header.getContext()
1362
- )
1363
- },
1364
- header.id
1365
- );
1366
- })
1367
- ] }, headerGroup.id)) }),
1368
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1369
- BiampTableRow,
1370
- {
1371
- row,
1372
- isExpanded: row.getIsExpanded(),
1373
- isSelected: row.getIsSelected(),
1374
- onRowClick,
1375
- isRowClickable,
1376
- enableRowSelection,
1377
- enableExpanding,
1378
- selectChildrenWithParent,
1379
- getRowLabel,
1380
- hasExpandableRows
1408
+ },
1409
+ header.id
1410
+ );
1411
+ })
1412
+ ]
1381
1413
  },
1382
- row.id
1383
- )) })
1414
+ headerGroup.id
1415
+ )) }),
1416
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1417
+ import_material7.TableBody,
1418
+ {
1419
+ ...restBodySlotProps,
1420
+ sx: mergeSx({ opacity: showLoading ? 0.3 : 1 }, userBodySx),
1421
+ children: !showError && rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1422
+ BiampTableRow,
1423
+ {
1424
+ row,
1425
+ isExpanded: row.getIsExpanded(),
1426
+ isSelected: row.getIsSelected(),
1427
+ onRowClick,
1428
+ isRowClickable,
1429
+ enableRowSelection,
1430
+ enableExpanding,
1431
+ selectChildrenWithParent,
1432
+ getRowLabel,
1433
+ hasExpandableRows,
1434
+ rowSlotProps: slotProps?.row,
1435
+ cellSlotProps: slotProps?.cell
1436
+ },
1437
+ row.id
1438
+ ))
1439
+ }
1440
+ )
1384
1441
  ]
1385
1442
  }
1386
1443
  ),