@bwp-web/components 2.0.0-alpha.0 → 2.0.0-alpha.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.js CHANGED
@@ -1939,6 +1939,7 @@ import {
1939
1939
  TableBody,
1940
1940
  TableCell as TableCell2,
1941
1941
  TableContainer,
1942
+ TableFooter,
1942
1943
  TableHead,
1943
1944
  TableRow as TableRow2,
1944
1945
  TableSortLabel
@@ -2457,6 +2458,33 @@ var headerSelectionCellSx = {
2457
2458
  bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[900] : palette.background.paper
2458
2459
  };
2459
2460
  var checkboxHiddenHeaderSx = { visibility: "hidden" };
2461
+ var footerBg = ({ palette }) => palette.mode === "dark" ? palette.grey[900] : palette.grey[100];
2462
+ var footerRowSx = { bgcolor: footerBg };
2463
+ var footerCellSx = {
2464
+ height: 44,
2465
+ color: "text.primary",
2466
+ fontSize: 14,
2467
+ fontWeight: 600,
2468
+ lineHeight: 1.5,
2469
+ borderTop: ({ palette }) => `0.6px solid ${palette.divider}`,
2470
+ borderBottom: "none"
2471
+ };
2472
+ var footerPinnedCellSx = { bgcolor: footerBg };
2473
+ var stickyFooterSx = {
2474
+ position: "sticky",
2475
+ bottom: 0,
2476
+ zIndex: 2,
2477
+ filter: "drop-shadow(0px -1px 3.5px rgba(0, 0, 0, 0.05))"
2478
+ };
2479
+ var fillerRowSx = { height: "100%" };
2480
+ var fitHeightBodySx = {
2481
+ "& > tr:nth-last-of-type(2) > td": { borderBottom: "none" }
2482
+ };
2483
+ var fillerCellSx = {
2484
+ height: "auto",
2485
+ p: 0,
2486
+ border: "none"
2487
+ };
2460
2488
  function BiampTable({
2461
2489
  table,
2462
2490
  onRowClick,
@@ -2473,6 +2501,8 @@ function BiampTable({
2473
2501
  getRowLabel,
2474
2502
  setRowColor,
2475
2503
  slotProps,
2504
+ stickyFooter = false,
2505
+ fitHeight = false,
2476
2506
  sx,
2477
2507
  ...boxProps
2478
2508
  }) {
@@ -2499,6 +2529,10 @@ function BiampTable({
2499
2529
  const hasExpandableRows = enableExpanding && rows.some((r) => r.getCanExpand());
2500
2530
  const showError = !!error && !loading;
2501
2531
  const showEmpty = !showError && !loading && rows.length === 0;
2532
+ const footerGroup = table.getFooterGroups()[0];
2533
+ const hasFooter = table.getVisibleLeafColumns().some((col) => col.columnDef.footer !== void 0);
2534
+ const { sx: userFooterSx, ...restFooterSlotProps } = slotProps?.footer ?? {};
2535
+ const { sx: userFooterRowSx, ...restFooterRowSlotProps } = slotProps?.footerRow ?? {};
2502
2536
  return /* @__PURE__ */ jsxs9(
2503
2537
  TableContainer,
2504
2538
  {
@@ -2521,7 +2555,11 @@ function BiampTable({
2521
2555
  "aria-busy": showLoading || void 0,
2522
2556
  ...restTableSlotProps,
2523
2557
  sx: mergeSx(
2524
- { minWidth: tableMinWidth, tableLayout: "auto" },
2558
+ {
2559
+ minWidth: tableMinWidth,
2560
+ tableLayout: "auto",
2561
+ ...fitHeight && { height: "100%" }
2562
+ },
2525
2563
  userTableSx
2526
2564
  ),
2527
2565
  children: [
@@ -2586,33 +2624,102 @@ function BiampTable({
2586
2624
  },
2587
2625
  headerGroup.id
2588
2626
  )) }),
2589
- /* @__PURE__ */ jsx15(
2627
+ /* @__PURE__ */ jsxs9(
2590
2628
  TableBody,
2591
2629
  {
2592
2630
  ...restBodySlotProps,
2593
- sx: mergeSx({ opacity: showLoading ? 0.3 : 1 }, userBodySx),
2594
- children: !showError && rows.map((row) => /* @__PURE__ */ jsx15(
2595
- BiampTableRow,
2631
+ sx: mergeSx(
2632
+ { opacity: showLoading ? 0.3 : 1 },
2633
+ fitHeight && !showError ? fitHeightBodySx : void 0,
2634
+ userBodySx
2635
+ ),
2636
+ children: [
2637
+ !showError && rows.map((row) => /* @__PURE__ */ jsx15(
2638
+ BiampTableRow,
2639
+ {
2640
+ row,
2641
+ visibleColumnsKey,
2642
+ isExpanded: row.getIsExpanded(),
2643
+ isSelected: row.getIsSelected(),
2644
+ onRowClick,
2645
+ isRowClickable,
2646
+ enableRowSelection,
2647
+ enableExpanding,
2648
+ alwaysExpanded,
2649
+ selectChildrenWithParent,
2650
+ showExpandGuidelines,
2651
+ getRowLabel,
2652
+ hasExpandableRows,
2653
+ customColor: setRowColor?.(row.original),
2654
+ rowSlotProps: slotProps?.row,
2655
+ cellSlotProps: slotProps?.cell
2656
+ },
2657
+ row.id
2658
+ )),
2659
+ fitHeight && !showError && /* @__PURE__ */ jsx15(TableRow2, { "aria-hidden": true, sx: fillerRowSx, children: /* @__PURE__ */ jsx15(
2660
+ TableCell2,
2661
+ {
2662
+ colSpan: table.getVisibleLeafColumns().length + (enableRowSelection ? 1 : 0),
2663
+ sx: fillerCellSx
2664
+ }
2665
+ ) })
2666
+ ]
2667
+ }
2668
+ ),
2669
+ hasFooter && footerGroup && !showError && /* @__PURE__ */ jsx15(
2670
+ TableFooter,
2671
+ {
2672
+ ...restFooterSlotProps,
2673
+ sx: mergeSx(
2674
+ stickyFooter ? stickyFooterSx : void 0,
2675
+ userFooterSx
2676
+ ),
2677
+ children: /* @__PURE__ */ jsxs9(
2678
+ TableRow2,
2596
2679
  {
2597
- row,
2598
- visibleColumnsKey,
2599
- isExpanded: row.getIsExpanded(),
2600
- isSelected: row.getIsSelected(),
2601
- onRowClick,
2602
- isRowClickable,
2603
- enableRowSelection,
2604
- enableExpanding,
2605
- alwaysExpanded,
2606
- selectChildrenWithParent,
2607
- showExpandGuidelines,
2608
- getRowLabel,
2609
- hasExpandableRows,
2610
- customColor: setRowColor?.(row.original),
2611
- rowSlotProps: slotProps?.row,
2612
- cellSlotProps: slotProps?.cell
2613
- },
2614
- row.id
2615
- ))
2680
+ ...restFooterRowSlotProps,
2681
+ sx: mergeSx(footerRowSx, userFooterRowSx),
2682
+ children: [
2683
+ enableRowSelection && /* @__PURE__ */ jsx15(
2684
+ TableCell2,
2685
+ {
2686
+ padding: "checkbox",
2687
+ sx: mergeSx(footerCellSx, footerPinnedCellSx, {
2688
+ position: "sticky",
2689
+ left: 0,
2690
+ zIndex: 1
2691
+ })
2692
+ }
2693
+ ),
2694
+ footerGroup.headers.map((header) => {
2695
+ const sticky = header.column.columnDef.meta?.sticky;
2696
+ const resolvedFooterCell = resolveSlot(slotProps?.footerCell, {
2697
+ header
2698
+ });
2699
+ const { sx: userFooterCellSx, ...restFooterCellProps } = resolvedFooterCell ?? {};
2700
+ return /* @__PURE__ */ jsx15(
2701
+ TableCell2,
2702
+ {
2703
+ ...restFooterCellProps,
2704
+ "data-sticky": sticky || void 0,
2705
+ sx: mergeSx(
2706
+ cellSx(sticky, header.column.columnDef.meta?.minWidth, 3),
2707
+ footerCellSx,
2708
+ sticky ? footerPinnedCellSx : void 0,
2709
+ sticky ? { zIndex: 1 } : void 0,
2710
+ userFooterCellSx
2711
+ ),
2712
+ children: header.isPlaceholder ? null : flexRender2(
2713
+ header.column.columnDef.footer,
2714
+ header.getContext()
2715
+ )
2716
+ },
2717
+ header.id
2718
+ );
2719
+ })
2720
+ ]
2721
+ }
2722
+ )
2616
2723
  }
2617
2724
  )
2618
2725
  ]