@bwp-web/components 0.11.7 → 0.13.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/dist/index.js CHANGED
@@ -465,8 +465,9 @@ function BiampLayout({
465
465
 
466
466
  // src/BiampTable/BiampTable.tsx
467
467
  import {
468
- Box as Box3,
468
+ Box as Box4,
469
469
  Checkbox,
470
+ IconButton,
470
471
  Table as MuiTable,
471
472
  TableBody,
472
473
  TableCell,
@@ -476,11 +477,12 @@ import {
476
477
  TableSortLabel
477
478
  } from "@mui/material";
478
479
  import {
480
+ ChevronRightIcon,
479
481
  DropdownChevronDownIcon,
480
482
  DropdownChevronUpIcon
481
483
  } from "@bwp-web/assets";
482
484
  import { flexRender } from "@tanstack/react-table";
483
- import { useRef as useRef2 } from "react";
485
+ import { useRef as useRef3 } from "react";
484
486
 
485
487
  // src/BiampTable/BiampTableEmptyState.tsx
486
488
  import { NoResultsIcon } from "@bwp-web/assets";
@@ -496,7 +498,7 @@ function BiampTableStatusMessage({
496
498
  children,
497
499
  ...stackProps
498
500
  }) {
499
- return /* @__PURE__ */ jsxs4(Stack5, { alignItems: "center", gap: 2, ...stackProps, children: [
501
+ return /* @__PURE__ */ jsxs4(Stack5, { alignItems: "center", gap: 1.5, ...stackProps, children: [
500
502
  cloneElement(icon, {
501
503
  "aria-hidden": true,
502
504
  sx: { width: 56, height: 56, ...icon.props.sx }
@@ -536,11 +538,56 @@ function BiampTableErrorState({
536
538
  return /* @__PURE__ */ jsx6(BiampTableStatusMessage, { role: "alert", icon, title, ...rest });
537
539
  }
538
540
 
541
+ // src/BiampTable/BiampTableTruncatedCell.tsx
542
+ import { Box as Box3, Tooltip } from "@mui/material";
543
+ import { useCallback, useRef, useState } from "react";
544
+ import { jsx as jsx7 } from "react/jsx-runtime";
545
+ function BiampTableTruncatedCell({
546
+ children
547
+ }) {
548
+ const textRef = useRef(null);
549
+ const [open, setOpen] = useState(false);
550
+ const handleMouseEnter = useCallback(() => {
551
+ const el = textRef.current;
552
+ if (el && el.scrollWidth > el.clientWidth) {
553
+ setOpen(true);
554
+ }
555
+ }, []);
556
+ const handleMouseLeave = useCallback(() => {
557
+ setOpen(false);
558
+ }, []);
559
+ return /* @__PURE__ */ jsx7(
560
+ Tooltip,
561
+ {
562
+ title: children,
563
+ open,
564
+ arrow: true,
565
+ placement: "top",
566
+ disableInteractive: true,
567
+ children: /* @__PURE__ */ jsx7(
568
+ Box3,
569
+ {
570
+ ref: textRef,
571
+ onMouseEnter: handleMouseEnter,
572
+ onMouseLeave: handleMouseLeave,
573
+ sx: {
574
+ overflow: "hidden",
575
+ textOverflow: "ellipsis",
576
+ whiteSpace: "nowrap",
577
+ minWidth: 0
578
+ },
579
+ children
580
+ }
581
+ )
582
+ }
583
+ );
584
+ }
585
+
539
586
  // src/BiampTable/useLoadingDelay.ts
540
- import { useEffect, useRef, useState } from "react";
587
+ import { useEffect, useRef as useRef2, useState as useState2 } from "react";
541
588
  function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
542
- const [status, setStatus] = useState("idle");
543
- const timeoutRef = useRef(null);
589
+ const [status, setStatus] = useState2("idle");
590
+ const timeoutRef = useRef2(null);
544
591
  function clearPending() {
545
592
  if (timeoutRef.current !== null) {
546
593
  clearTimeout(timeoutRef.current);
@@ -568,7 +615,39 @@ function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
568
615
  }
569
616
 
570
617
  // src/BiampTable/BiampTable.tsx
571
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
618
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
619
+ var overlaySx = {
620
+ position: "absolute",
621
+ top: 0,
622
+ left: 0,
623
+ right: 0,
624
+ bottom: 0,
625
+ display: "flex",
626
+ alignItems: "center",
627
+ justifyContent: "center",
628
+ pointerEvents: "none"
629
+ };
630
+ var stickyHoverBg = {
631
+ ".MuiTableRow-hover:hover > &, .Mui-selected > &": {
632
+ bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
633
+ }
634
+ };
635
+ function cellSx(sticky, minWidth, zIndex) {
636
+ if (sticky) {
637
+ return {
638
+ position: "sticky",
639
+ [sticky]: 0,
640
+ zIndex,
641
+ width: 0,
642
+ whiteSpace: "nowrap",
643
+ textAlign: "center",
644
+ bgcolor: "background.paper",
645
+ ...zIndex < 3 && stickyHoverBg
646
+ };
647
+ }
648
+ const mw = minWidth ?? 40;
649
+ return { minWidth: mw, maxWidth: mw };
650
+ }
572
651
  function BiampTable({
573
652
  table,
574
653
  onRowClick,
@@ -577,7 +656,9 @@ function BiampTable({
577
656
  error,
578
657
  empty,
579
658
  enableRowSelection = false,
659
+ enableExpanding = false,
580
660
  hideSelectAll,
661
+ selectChildrenWithParent = false,
581
662
  getRowLabel,
582
663
  sx,
583
664
  ...boxProps
@@ -589,15 +670,16 @@ function BiampTable({
589
670
  },
590
671
  enableRowSelection ? 48 : 0
591
672
  );
592
- const containerRef = useRef2(null);
673
+ const containerRef = useRef3(null);
593
674
  const showLoading = useLoadingDelay(!!loading);
594
675
  const rows = table.getRowModel().rows;
676
+ const hasExpandableRows = enableExpanding && rows.some((r) => r.getCanExpand());
595
677
  const showError = !!error && !loading;
596
678
  const showEmpty = !showError && !loading && rows.length === 0;
597
679
  return /* @__PURE__ */ jsxs5(
598
680
  TableContainer,
599
681
  {
600
- component: Box3,
682
+ component: Box4,
601
683
  ...boxProps,
602
684
  ref: containerRef,
603
685
  sx: {
@@ -616,8 +698,8 @@ function BiampTable({
616
698
  "aria-busy": showLoading || void 0,
617
699
  sx: { minWidth: tableMinWidth, tableLayout: "auto" },
618
700
  children: [
619
- /* @__PURE__ */ jsx7(TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs5(TableRow, { children: [
620
- enableRowSelection && /* @__PURE__ */ jsx7(
701
+ /* @__PURE__ */ jsx8(TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs5(TableRow, { children: [
702
+ enableRowSelection && /* @__PURE__ */ jsx8(
621
703
  TableCell,
622
704
  {
623
705
  padding: "checkbox",
@@ -627,7 +709,7 @@ function BiampTable({
627
709
  zIndex: 3,
628
710
  bgcolor: "background.paper"
629
711
  },
630
- children: !hideSelectAll && /* @__PURE__ */ jsx7(
712
+ children: !hideSelectAll && /* @__PURE__ */ jsx8(
631
713
  Checkbox,
632
714
  {
633
715
  checked: table.getIsAllPageRowsSelected(),
@@ -641,7 +723,7 @@ function BiampTable({
641
723
  ),
642
724
  headerGroup.headers.map((header) => {
643
725
  const sticky = header.column.columnDef.meta?.sticky;
644
- return /* @__PURE__ */ jsx7(
726
+ return /* @__PURE__ */ jsx8(
645
727
  TableCell,
646
728
  {
647
729
  "data-sticky": sticky || void 0,
@@ -649,19 +731,12 @@ function BiampTable({
649
731
  ...header.column.getCanSort() && {
650
732
  "aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
651
733
  },
652
- sx: {
653
- minWidth: sticky ? void 0 : header.column.columnDef.meta?.minWidth ?? 40,
654
- ...sticky && {
655
- position: "sticky",
656
- [sticky]: 0,
657
- zIndex: 3,
658
- width: 0,
659
- whiteSpace: "nowrap",
660
- textAlign: "center",
661
- bgcolor: "background.paper"
662
- }
663
- },
664
- children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsx7(
734
+ sx: cellSx(
735
+ sticky,
736
+ header.column.columnDef.meta?.minWidth,
737
+ 3
738
+ ),
739
+ children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsx8(
665
740
  TableSortLabel,
666
741
  {
667
742
  active: !!header.column.getIsSorted(),
@@ -684,7 +759,7 @@ function BiampTable({
684
759
  );
685
760
  })
686
761
  ] }, headerGroup.id)) }),
687
- /* @__PURE__ */ jsx7(TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => {
762
+ /* @__PURE__ */ jsx8(TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => {
688
763
  const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
689
764
  return /* @__PURE__ */ jsxs5(
690
765
  TableRow,
@@ -702,7 +777,7 @@ function BiampTable({
702
777
  }
703
778
  } : void 0,
704
779
  children: [
705
- enableRowSelection && /* @__PURE__ */ jsx7(
780
+ enableRowSelection && /* @__PURE__ */ jsx8(
706
781
  TableCell,
707
782
  {
708
783
  padding: "checkbox",
@@ -715,12 +790,14 @@ function BiampTable({
715
790
  bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
716
791
  }
717
792
  },
718
- children: /* @__PURE__ */ jsx7(
793
+ children: /* @__PURE__ */ jsx8(
719
794
  Checkbox,
720
795
  {
721
796
  checked: row.getIsSelected(),
722
797
  disabled: !row.getCanSelect(),
723
- onChange: row.getToggleSelectedHandler(),
798
+ onChange: (e) => row.toggleSelected(e.target.checked, {
799
+ selectChildren: selectChildrenWithParent
800
+ }),
724
801
  onClick: (e) => e.stopPropagation(),
725
802
  sx: !row.getCanSelect() ? { visibility: "hidden" } : void 0,
726
803
  slotProps: {
@@ -732,31 +809,66 @@ function BiampTable({
732
809
  )
733
810
  }
734
811
  ),
735
- row.getVisibleCells().map((cell) => {
812
+ row.getVisibleCells().map((cell, cellIndex, cells) => {
736
813
  const sticky = cell.column.columnDef.meta?.sticky;
737
- return /* @__PURE__ */ jsx7(
814
+ const isExpandCell = enableExpanding && !sticky && cellIndex === cells.findIndex(
815
+ (c) => !c.column.columnDef.meta?.sticky
816
+ );
817
+ return /* @__PURE__ */ jsx8(
738
818
  TableCell,
739
819
  {
740
820
  "data-sticky": sticky || void 0,
741
- sx: {
742
- minWidth: sticky ? void 0 : cell.column.columnDef.meta?.minWidth ?? 40,
743
- ...sticky && {
744
- position: "sticky",
745
- [sticky]: 0,
746
- zIndex: 2,
747
- width: 0,
748
- whiteSpace: "nowrap",
749
- textAlign: "center",
750
- bgcolor: "background.paper",
751
- ".MuiTableRow-hover:hover > &, .Mui-selected > &": {
752
- bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
821
+ sx: cellSx(
822
+ sticky,
823
+ cell.column.columnDef.meta?.minWidth,
824
+ 2
825
+ ),
826
+ children: (() => {
827
+ const content = flexRender(
828
+ cell.column.columnDef.cell,
829
+ cell.getContext()
830
+ );
831
+ if (sticky) return content;
832
+ const truncated = /* @__PURE__ */ jsx8(BiampTableTruncatedCell, { children: content });
833
+ if (!isExpandCell) return truncated;
834
+ const rowLabel = getRowLabel ? getRowLabel(row.original) : `row ${row.index + 1}`;
835
+ return /* @__PURE__ */ jsxs5(
836
+ Box4,
837
+ {
838
+ sx: {
839
+ display: "flex",
840
+ alignItems: "center",
841
+ pl: `${row.depth * 12}px`
842
+ },
843
+ children: [
844
+ row.getCanExpand() ? /* @__PURE__ */ jsx8(
845
+ IconButton,
846
+ {
847
+ variant: "none",
848
+ onClick: (e) => {
849
+ e.stopPropagation();
850
+ row.toggleExpanded();
851
+ },
852
+ "aria-label": row.getIsExpanded() ? `Collapse ${rowLabel}` : `Expand ${rowLabel}`,
853
+ "aria-expanded": row.getIsExpanded(),
854
+ children: /* @__PURE__ */ jsx8(
855
+ ChevronRightIcon,
856
+ {
857
+ variant: "xs",
858
+ sx: {
859
+ color: ({ palette }) => palette.text.secondary,
860
+ transition: "transform 150ms ease",
861
+ transform: row.getIsExpanded() ? "rotate(90deg)" : "rotate(0deg)"
862
+ }
863
+ }
864
+ )
865
+ }
866
+ ) : hasExpandableRows ? /* @__PURE__ */ jsx8(Box4, { sx: { width: 28 } }) : null,
867
+ truncated
868
+ ]
753
869
  }
754
- }
755
- },
756
- children: flexRender(
757
- cell.column.columnDef.cell,
758
- cell.getContext()
759
- )
870
+ );
871
+ })()
760
872
  },
761
873
  cell.id
762
874
  );
@@ -769,46 +881,14 @@ function BiampTable({
769
881
  ]
770
882
  }
771
883
  ),
772
- showError && /* @__PURE__ */ jsx7(
773
- Box3,
774
- {
775
- sx: {
776
- position: "absolute",
777
- top: 0,
778
- left: 0,
779
- right: 0,
780
- bottom: 0,
781
- display: "flex",
782
- alignItems: "center",
783
- justifyContent: "center",
784
- pointerEvents: "none"
785
- },
786
- children: error === true ? /* @__PURE__ */ jsx7(BiampTableErrorState, { sx: { pointerEvents: "auto" } }) : error instanceof Error ? /* @__PURE__ */ jsx7(
787
- BiampTableErrorState,
788
- {
789
- description: error.message,
790
- sx: { pointerEvents: "auto" }
791
- }
792
- ) : error
793
- }
794
- ),
795
- showEmpty && /* @__PURE__ */ jsx7(
796
- Box3,
884
+ showError && /* @__PURE__ */ jsx8(Box4, { sx: overlaySx, children: error === true ? /* @__PURE__ */ jsx8(BiampTableErrorState, { sx: { pointerEvents: "auto" } }) : error instanceof Error ? /* @__PURE__ */ jsx8(
885
+ BiampTableErrorState,
797
886
  {
798
- sx: {
799
- position: "absolute",
800
- top: 0,
801
- left: 0,
802
- right: 0,
803
- bottom: 0,
804
- display: "flex",
805
- alignItems: "center",
806
- justifyContent: "center",
807
- pointerEvents: "none"
808
- },
809
- children: empty && empty !== true ? empty : /* @__PURE__ */ jsx7(BiampTableEmptyState, { sx: { pointerEvents: "auto" } })
887
+ description: error.message,
888
+ sx: { pointerEvents: "auto" }
810
889
  }
811
- )
890
+ ) : error }),
891
+ showEmpty && /* @__PURE__ */ jsx8(Box4, { sx: overlaySx, children: empty && empty !== true ? empty : /* @__PURE__ */ jsx8(BiampTableEmptyState, { sx: { pointerEvents: "auto" } }) })
812
892
  ]
813
893
  }
814
894
  );
@@ -816,7 +896,7 @@ function BiampTable({
816
896
 
817
897
  // src/BiampTable/BiampTableContainer.tsx
818
898
  import { Stack as Stack6 } from "@mui/material";
819
- import { jsx as jsx8 } from "react/jsx-runtime";
899
+ import { jsx as jsx9 } from "react/jsx-runtime";
820
900
  function BiampTableContainer({
821
901
  withBorderTop = true,
822
902
  withBorderBottom = false,
@@ -824,7 +904,7 @@ function BiampTableContainer({
824
904
  sx,
825
905
  ...props
826
906
  }) {
827
- return /* @__PURE__ */ jsx8(
907
+ return /* @__PURE__ */ jsx9(
828
908
  Stack6,
829
909
  {
830
910
  direction: "column",
@@ -843,18 +923,18 @@ function BiampTableContainer({
843
923
  }
844
924
 
845
925
  // src/BiampTable/BiampTableCellActionButton.tsx
846
- import { IconButton, Tooltip } from "@mui/material";
847
- import { jsx as jsx9 } from "react/jsx-runtime";
926
+ import { IconButton as IconButton2, Tooltip as Tooltip2 } from "@mui/material";
927
+ import { jsx as jsx10 } from "react/jsx-runtime";
848
928
  function BiampTableCellActionButton({ label, icon, ...props }) {
849
- return /* @__PURE__ */ jsx9(
850
- Tooltip,
929
+ return /* @__PURE__ */ jsx10(
930
+ Tooltip2,
851
931
  {
852
932
  title: label,
853
933
  placement: "top",
854
934
  enterDelay: 500,
855
935
  enterNextDelay: 500,
856
936
  disableInteractive: true,
857
- children: /* @__PURE__ */ jsx9("span", { children: /* @__PURE__ */ jsx9(IconButton, { "aria-label": label, ...props, children: icon }) })
937
+ children: /* @__PURE__ */ jsx10("span", { children: /* @__PURE__ */ jsx10(IconButton2, { "aria-label": label, ...props, children: icon }) })
858
938
  }
859
939
  );
860
940
  }
@@ -862,7 +942,7 @@ function BiampTableCellActionButton({ label, icon, ...props }) {
862
942
  // src/BiampTable/BiampTableColumnVisibility.tsx
863
943
  import {
864
944
  alpha as alpha2,
865
- Box as Box4,
945
+ Box as Box5,
866
946
  Checkbox as Checkbox2,
867
947
  Divider,
868
948
  List,
@@ -870,7 +950,7 @@ import {
870
950
  Popover as Popover2,
871
951
  Typography as Typography3
872
952
  } from "@mui/material";
873
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
953
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
874
954
  function toVisibilityState(visibility) {
875
955
  return visibility;
876
956
  }
@@ -913,8 +993,7 @@ function BiampTableColumnVisibility({
913
993
  ...popoverProps
914
994
  }) {
915
995
  const allVisible = table.getAllLeafColumns().every((col) => col.getIsVisible());
916
- const someVisible = table.getAllLeafColumns().some((col) => col.getIsVisible());
917
- return /* @__PURE__ */ jsx10(
996
+ return /* @__PURE__ */ jsx11(
918
997
  Popover2,
919
998
  {
920
999
  anchorEl,
@@ -939,47 +1018,53 @@ function BiampTableColumnVisibility({
939
1018
  /* @__PURE__ */ jsxs6(
940
1019
  ListItem,
941
1020
  {
1021
+ dense: true,
942
1022
  sx: columnListItemSx,
943
1023
  onClick: () => table.toggleAllColumnsVisible(!allVisible),
944
1024
  children: [
945
- /* @__PURE__ */ jsx10(
1025
+ /* @__PURE__ */ jsx11(
946
1026
  Checkbox2,
947
1027
  {
948
1028
  checked: allVisible,
949
- indeterminate: !allVisible && someVisible,
950
- size: "small",
951
1029
  slotProps: { input: { "aria-label": `${showAllLabel} columns` } }
952
1030
  }
953
1031
  ),
954
- /* @__PURE__ */ jsx10(Typography3, { variant: "caption", children: showAllLabel })
1032
+ /* @__PURE__ */ jsx11(Typography3, { variant: "caption", fontWeight: 600, children: showAllLabel })
955
1033
  ]
956
1034
  }
957
1035
  ),
958
- /* @__PURE__ */ jsx10(Divider, {}),
959
- /* @__PURE__ */ jsx10(Box4, { sx: { maxHeight: 340, overflow: "auto" }, children: table.getAllLeafColumns().map((column) => {
960
- const columnName = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
961
- return /* @__PURE__ */ jsxs6(
962
- ListItem,
963
- {
964
- sx: columnListItemSx,
965
- onClick: column.getToggleVisibilityHandler(),
966
- children: [
967
- /* @__PURE__ */ jsx10(
968
- Checkbox2,
969
- {
970
- checked: column.getIsVisible(),
971
- size: "small",
972
- slotProps: {
973
- input: { "aria-label": `Show ${columnName}` }
974
- }
975
- }
976
- ),
977
- /* @__PURE__ */ jsx10(Typography3, { variant: "caption", children: columnName })
978
- ]
979
- },
980
- column.id
981
- );
982
- }) })
1036
+ /* @__PURE__ */ jsx11(Divider, {}),
1037
+ /* @__PURE__ */ jsx11(
1038
+ Box5,
1039
+ {
1040
+ sx: { maxHeight: 340, overflow: "auto", overscrollBehavior: "none" },
1041
+ children: table.getAllLeafColumns().map((column) => {
1042
+ const columnName = column.columnDef.meta?.columnLabel ?? (typeof column.columnDef.header === "string" ? column.columnDef.header : column.id);
1043
+ return /* @__PURE__ */ jsxs6(
1044
+ ListItem,
1045
+ {
1046
+ dense: true,
1047
+ sx: columnListItemSx,
1048
+ onClick: column.getToggleVisibilityHandler(),
1049
+ children: [
1050
+ /* @__PURE__ */ jsx11(
1051
+ Checkbox2,
1052
+ {
1053
+ checked: column.getIsVisible(),
1054
+ sx: { py: 1 },
1055
+ slotProps: {
1056
+ input: { "aria-label": `Show ${columnName}` }
1057
+ }
1058
+ }
1059
+ ),
1060
+ /* @__PURE__ */ jsx11(Typography3, { variant: "caption", children: columnName })
1061
+ ]
1062
+ },
1063
+ column.id
1064
+ );
1065
+ })
1066
+ }
1067
+ )
983
1068
  ] })
984
1069
  }
985
1070
  );
@@ -987,14 +1072,14 @@ function BiampTableColumnVisibility({
987
1072
 
988
1073
  // src/BiampTable/BiampTableToolbarColumnVisibility.tsx
989
1074
  import { ColumnsIcon } from "@bwp-web/assets";
990
- import { useState as useState2 } from "react";
1075
+ import { useState as useState3 } from "react";
991
1076
 
992
1077
  // src/BiampTable/BiampTableToolbarActionButton.tsx
993
1078
  import {
994
1079
  Badge,
995
- IconButton as IconButton2
1080
+ IconButton as IconButton3
996
1081
  } from "@mui/material";
997
- import { jsx as jsx11 } from "react/jsx-runtime";
1082
+ import { jsx as jsx12 } from "react/jsx-runtime";
998
1083
  function BiampTableToolbarActionButton({
999
1084
  label,
1000
1085
  icon,
@@ -1002,12 +1087,12 @@ function BiampTableToolbarActionButton({
1002
1087
  ...props
1003
1088
  }) {
1004
1089
  const showBadge = badgeContent != null && badgeContent !== 0;
1005
- return /* @__PURE__ */ jsx11(
1006
- IconButton2,
1090
+ return /* @__PURE__ */ jsx12(
1091
+ IconButton3,
1007
1092
  {
1008
1093
  "aria-label": showBadge ? `${label} (${badgeContent})` : label,
1009
1094
  ...props,
1010
- children: showBadge ? /* @__PURE__ */ jsx11(
1095
+ children: showBadge ? /* @__PURE__ */ jsx12(
1011
1096
  Badge,
1012
1097
  {
1013
1098
  badgeContent,
@@ -1031,20 +1116,20 @@ function BiampTableToolbarActionButton({
1031
1116
  }
1032
1117
 
1033
1118
  // src/BiampTable/BiampTableToolbarColumnVisibility.tsx
1034
- import { Fragment, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1119
+ import { Fragment, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1035
1120
  function BiampTableToolbarColumnVisibility({
1036
1121
  table,
1037
- icon = /* @__PURE__ */ jsx12(ColumnsIcon, { variant: "xs" }),
1122
+ icon = /* @__PURE__ */ jsx13(ColumnsIcon, { variant: "xs" }),
1038
1123
  label = "Columns",
1039
1124
  defaultColumnVisibility,
1040
1125
  showAllLabel,
1041
1126
  ...actionButtonProps
1042
1127
  }) {
1043
- const [anchorEl, setAnchorEl] = useState2(null);
1128
+ const [anchorEl, setAnchorEl] = useState3(null);
1044
1129
  const defaults = defaultColumnVisibility ?? getDefaultColumnVisibility(table);
1045
1130
  const dirtyCount = getColumnVisibilityDirtyCount(table, defaults);
1046
1131
  return /* @__PURE__ */ jsxs7(Fragment, { children: [
1047
- /* @__PURE__ */ jsx12(
1132
+ /* @__PURE__ */ jsx13(
1048
1133
  BiampTableToolbarActionButton,
1049
1134
  {
1050
1135
  label,
@@ -1054,7 +1139,7 @@ function BiampTableToolbarColumnVisibility({
1054
1139
  ...actionButtonProps
1055
1140
  }
1056
1141
  ),
1057
- /* @__PURE__ */ jsx12(
1142
+ /* @__PURE__ */ jsx13(
1058
1143
  BiampTableColumnVisibility,
1059
1144
  {
1060
1145
  table,
@@ -1067,9 +1152,9 @@ function BiampTableToolbarColumnVisibility({
1067
1152
  }
1068
1153
 
1069
1154
  // src/BiampTable/BiampTablePagination.tsx
1070
- import { useRef as useRef3 } from "react";
1155
+ import { useEffect as useEffect2, useRef as useRef4 } from "react";
1071
1156
  import { TablePagination } from "@mui/material";
1072
- import { jsx as jsx13 } from "react/jsx-runtime";
1157
+ import { jsx as jsx14 } from "react/jsx-runtime";
1073
1158
  var positionMap = {
1074
1159
  left: "flex-start",
1075
1160
  center: "center",
@@ -1085,18 +1170,20 @@ function BiampTablePagination({
1085
1170
  ...paginationProps
1086
1171
  }) {
1087
1172
  const rowCount = table.getRowCount();
1088
- const lastRowCountRef = useRef3(rowCount);
1173
+ const lastRowCountRef = useRef4(rowCount);
1089
1174
  if (!loading && rowCount >= 0) {
1090
1175
  lastRowCountRef.current = rowCount;
1091
1176
  }
1092
1177
  const stableCount = loading ? lastRowCountRef.current : rowCount;
1093
1178
  const { pageSize, pageIndex } = table.getState().pagination;
1094
1179
  const maxPage = Math.max(0, Math.ceil(stableCount / pageSize) - 1);
1095
- if (!loading && pageIndex > maxPage) {
1096
- table.setPageIndex(maxPage);
1097
- }
1180
+ useEffect2(() => {
1181
+ if (!loading && pageIndex > maxPage) {
1182
+ table.setPageIndex(maxPage);
1183
+ }
1184
+ }, [loading, pageIndex, maxPage, table]);
1098
1185
  if (autoHide && (!stableCount || stableCount <= pageSize)) return null;
1099
- return /* @__PURE__ */ jsx13(
1186
+ return /* @__PURE__ */ jsx14(
1100
1187
  TablePagination,
1101
1188
  {
1102
1189
  component: "div",
@@ -1128,15 +1215,15 @@ function BiampTablePagination({
1128
1215
  }
1129
1216
 
1130
1217
  // src/BiampTable/BiampTableToolbar.tsx
1131
- import { Box as Box5 } from "@mui/material";
1132
- import { jsx as jsx14 } from "react/jsx-runtime";
1218
+ import { Box as Box6 } from "@mui/material";
1219
+ import { jsx as jsx15 } from "react/jsx-runtime";
1133
1220
  function BiampTableToolbar({
1134
1221
  children,
1135
1222
  sx,
1136
1223
  ...props
1137
1224
  }) {
1138
- return /* @__PURE__ */ jsx14(
1139
- Box5,
1225
+ return /* @__PURE__ */ jsx15(
1226
+ Box6,
1140
1227
  {
1141
1228
  role: "toolbar",
1142
1229
  display: "flex",
@@ -1154,14 +1241,14 @@ function BiampTableToolbar({
1154
1241
  }
1155
1242
 
1156
1243
  // src/BiampTable/BiampTableToolbarActions.tsx
1157
- import { Box as Box6 } from "@mui/material";
1158
- import { jsx as jsx15 } from "react/jsx-runtime";
1244
+ import { Box as Box7 } from "@mui/material";
1245
+ import { jsx as jsx16 } from "react/jsx-runtime";
1159
1246
  function BiampTableToolbarActions({
1160
1247
  children,
1161
1248
  ...props
1162
1249
  }) {
1163
- return /* @__PURE__ */ jsx15(
1164
- Box6,
1250
+ return /* @__PURE__ */ jsx16(
1251
+ Box7,
1165
1252
  {
1166
1253
  display: "flex",
1167
1254
  alignItems: "center",
@@ -1177,19 +1264,19 @@ function BiampTableToolbarActions({
1177
1264
  // src/BiampTable/BiampTableToolbarExport.tsx
1178
1265
  import { CircularProgress } from "@mui/material";
1179
1266
  import { DownloadIcon } from "@bwp-web/assets";
1180
- import { jsx as jsx16 } from "react/jsx-runtime";
1267
+ import { jsx as jsx17 } from "react/jsx-runtime";
1181
1268
  function BiampTableToolbarExport({
1182
1269
  onExport,
1183
1270
  loading,
1184
- icon = /* @__PURE__ */ jsx16(DownloadIcon, { variant: "xs" }),
1271
+ icon = /* @__PURE__ */ jsx17(DownloadIcon, { variant: "xs" }),
1185
1272
  label = "Export",
1186
1273
  ...props
1187
1274
  }) {
1188
- return /* @__PURE__ */ jsx16(
1275
+ return /* @__PURE__ */ jsx17(
1189
1276
  BiampTableToolbarActionButton,
1190
1277
  {
1191
1278
  label: loading ? `${label}, loading` : label,
1192
- icon: loading ? /* @__PURE__ */ jsx16(CircularProgress, { size: 20, color: "inherit" }) : icon,
1279
+ icon: loading ? /* @__PURE__ */ jsx17(CircularProgress, { size: 20, color: "inherit" }) : icon,
1193
1280
  disabled: loading,
1194
1281
  onClick: onExport,
1195
1282
  ...props
@@ -1200,22 +1287,22 @@ function BiampTableToolbarExport({
1200
1287
  // src/BiampTable/BiampTableToolbarFilters.tsx
1201
1288
  import {
1202
1289
  Badge as Badge2,
1203
- Box as Box7,
1290
+ Box as Box8,
1204
1291
  Button,
1205
1292
  Divider as Divider2,
1206
1293
  Drawer,
1207
- IconButton as IconButton3,
1294
+ IconButton as IconButton4,
1208
1295
  Typography as Typography4
1209
1296
  } from "@mui/material";
1210
1297
  import { CloseIcon, FilterIcon } from "@bwp-web/assets";
1211
- import { useId, useState as useState3 } from "react";
1212
- import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
1298
+ import { useId, useState as useState4 } from "react";
1299
+ import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
1213
1300
  function BiampTableToolbarFilters({
1214
1301
  activeFilterCount,
1215
1302
  children,
1216
1303
  onReset,
1217
1304
  onApply,
1218
- icon = /* @__PURE__ */ jsx17(FilterIcon, { variant: "xs" }),
1305
+ icon = /* @__PURE__ */ jsx18(FilterIcon, { variant: "xs" }),
1219
1306
  title = "Filters",
1220
1307
  resetLabel = "Clear filters",
1221
1308
  applyLabel = "Apply",
@@ -1223,14 +1310,14 @@ function BiampTableToolbarFilters({
1223
1310
  buttonLabel = "Filters",
1224
1311
  DrawerProps: drawerProps
1225
1312
  }) {
1226
- const [open, setOpen] = useState3(false);
1313
+ const [open, setOpen] = useState4(false);
1227
1314
  const titleId = useId();
1228
1315
  function handleClose() {
1229
1316
  onApply?.();
1230
1317
  setOpen(false);
1231
1318
  }
1232
1319
  return /* @__PURE__ */ jsxs8(Fragment2, { children: [
1233
- /* @__PURE__ */ jsx17(
1320
+ /* @__PURE__ */ jsx18(
1234
1321
  BiampTableToolbarActionButton,
1235
1322
  {
1236
1323
  label: buttonLabel,
@@ -1239,7 +1326,7 @@ function BiampTableToolbarFilters({
1239
1326
  onClick: () => setOpen(true)
1240
1327
  }
1241
1328
  ),
1242
- /* @__PURE__ */ jsx17(
1329
+ /* @__PURE__ */ jsx18(
1243
1330
  Drawer,
1244
1331
  {
1245
1332
  anchor: "right",
@@ -1252,16 +1339,16 @@ function BiampTableToolbarFilters({
1252
1339
  ...drawerProps?.PaperProps
1253
1340
  },
1254
1341
  children: /* @__PURE__ */ jsxs8(
1255
- Box7,
1342
+ Box8,
1256
1343
  {
1257
1344
  height: "100%",
1258
1345
  display: "flex",
1259
1346
  flexDirection: "column",
1260
1347
  justifyContent: "space-between",
1261
1348
  children: [
1262
- /* @__PURE__ */ jsxs8(Box7, { children: [
1349
+ /* @__PURE__ */ jsxs8(Box8, { children: [
1263
1350
  /* @__PURE__ */ jsxs8(
1264
- Box7,
1351
+ Box8,
1265
1352
  {
1266
1353
  display: "flex",
1267
1354
  justifyContent: "space-between",
@@ -1271,7 +1358,7 @@ function BiampTableToolbarFilters({
1271
1358
  children: [
1272
1359
  /* @__PURE__ */ jsxs8(Typography4, { id: titleId, variant: "h2", children: [
1273
1360
  title,
1274
- /* @__PURE__ */ jsx17(
1361
+ /* @__PURE__ */ jsx18(
1275
1362
  Badge2,
1276
1363
  {
1277
1364
  badgeContent: activeFilterCount,
@@ -1280,21 +1367,21 @@ function BiampTableToolbarFilters({
1280
1367
  }
1281
1368
  )
1282
1369
  ] }),
1283
- /* @__PURE__ */ jsx17(
1284
- IconButton3,
1370
+ /* @__PURE__ */ jsx18(
1371
+ IconButton4,
1285
1372
  {
1286
1373
  size: "medium",
1287
1374
  onClick: handleClose,
1288
1375
  "aria-label": closeLabel,
1289
- children: /* @__PURE__ */ jsx17(CloseIcon, {})
1376
+ children: /* @__PURE__ */ jsx18(CloseIcon, {})
1290
1377
  }
1291
1378
  )
1292
1379
  ]
1293
1380
  }
1294
1381
  ),
1295
- /* @__PURE__ */ jsx17(Divider2, {}),
1296
- /* @__PURE__ */ jsx17(
1297
- Box7,
1382
+ /* @__PURE__ */ jsx18(Divider2, {}),
1383
+ /* @__PURE__ */ jsx18(
1384
+ Box8,
1298
1385
  {
1299
1386
  role: "group",
1300
1387
  "aria-label": "Filter options",
@@ -1307,8 +1394,8 @@ function BiampTableToolbarFilters({
1307
1394
  }
1308
1395
  )
1309
1396
  ] }),
1310
- /* @__PURE__ */ jsxs8(Box7, { display: "flex", children: [
1311
- /* @__PURE__ */ jsx17(
1397
+ /* @__PURE__ */ jsxs8(Box8, { display: "flex", children: [
1398
+ /* @__PURE__ */ jsx18(
1312
1399
  Button,
1313
1400
  {
1314
1401
  variant: "overlay",
@@ -1319,7 +1406,7 @@ function BiampTableToolbarFilters({
1319
1406
  children: resetLabel
1320
1407
  }
1321
1408
  ),
1322
- /* @__PURE__ */ jsx17(
1409
+ /* @__PURE__ */ jsx18(
1323
1410
  Button,
1324
1411
  {
1325
1412
  variant: "overlay",
@@ -1340,30 +1427,30 @@ function BiampTableToolbarFilters({
1340
1427
 
1341
1428
  // src/BiampTable/BiampTableToolbarSearch.tsx
1342
1429
  import {
1343
- Box as Box8,
1430
+ Box as Box9,
1344
1431
  Collapse,
1345
- IconButton as IconButton4,
1432
+ IconButton as IconButton5,
1346
1433
  InputAdornment as InputAdornment2,
1347
1434
  InputBase,
1348
1435
  TextField as TextField2,
1349
1436
  useMediaQuery
1350
1437
  } from "@mui/material";
1351
1438
  import { CloseIcon as CloseIcon2, SearchIcon as SearchIcon2 } from "@bwp-web/assets";
1352
- import { useEffect as useEffect3, useState as useState4 } from "react";
1439
+ import { useEffect as useEffect4, useState as useState5 } from "react";
1353
1440
 
1354
1441
  // src/BiampTable/useDebouncedCallback.ts
1355
- import { useCallback, useEffect as useEffect2, useRef as useRef4 } from "react";
1442
+ import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef5 } from "react";
1356
1443
  var BIAMP_TABLE_DEBOUNCE_DELAY = 300;
1357
1444
  function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
1358
- const timeoutRef = useRef4(null);
1359
- const callbackRef = useRef4(callback);
1445
+ const timeoutRef = useRef5(null);
1446
+ const callbackRef = useRef5(callback);
1360
1447
  callbackRef.current = callback;
1361
- useEffect2(() => {
1448
+ useEffect3(() => {
1362
1449
  return () => {
1363
1450
  if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
1364
1451
  };
1365
1452
  }, []);
1366
- return useCallback(
1453
+ return useCallback2(
1367
1454
  (...args) => {
1368
1455
  if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
1369
1456
  timeoutRef.current = setTimeout(
@@ -1376,7 +1463,7 @@ function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
1376
1463
  }
1377
1464
 
1378
1465
  // src/BiampTable/BiampTableToolbarSearch.tsx
1379
- import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
1466
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
1380
1467
  var searchFieldSx = {
1381
1468
  "& .MuiInputBase-root": {
1382
1469
  height: "36px !important",
@@ -1401,10 +1488,10 @@ function BiampTableToolbarSearch({
1401
1488
  ...textFieldProps
1402
1489
  }) {
1403
1490
  const isMobile = useMediaQuery((t) => t.breakpoints.down("md"));
1404
- const [inputValue, setInputValue] = useState4(defaultValue);
1405
- const [isExpanded, setIsExpanded] = useState4(false);
1491
+ const [inputValue, setInputValue] = useState5(defaultValue);
1492
+ const [isExpanded, setIsExpanded] = useState5(false);
1406
1493
  const debouncedOnChange = useDebouncedCallback(onChange, debounceDelay);
1407
- useEffect3(() => {
1494
+ useEffect4(() => {
1408
1495
  setInputValue(defaultValue);
1409
1496
  }, [defaultValue]);
1410
1497
  const handleChange = (e) => {
@@ -1420,17 +1507,17 @@ function BiampTableToolbarSearch({
1420
1507
  setIsExpanded(false);
1421
1508
  }
1422
1509
  };
1423
- const clearButton = inputValue ? /* @__PURE__ */ jsx18(InputAdornment2, { position: "end", children: /* @__PURE__ */ jsx18(
1424
- IconButton4,
1510
+ const clearButton = inputValue ? /* @__PURE__ */ jsx19(InputAdornment2, { position: "end", children: /* @__PURE__ */ jsx19(
1511
+ IconButton5,
1425
1512
  {
1426
1513
  size: "small",
1427
1514
  onClick: handleClear,
1428
1515
  "aria-label": clearLabel,
1429
1516
  sx: { mr: 0.5 },
1430
- children: /* @__PURE__ */ jsx18(CloseIcon2, { variant: "xs", sx: { width: 20, height: 20 } })
1517
+ children: /* @__PURE__ */ jsx19(CloseIcon2, { variant: "xs", sx: { width: 20, height: 20 } })
1431
1518
  }
1432
1519
  ) }) : null;
1433
- const textField = /* @__PURE__ */ jsx18(
1520
+ const textField = /* @__PURE__ */ jsx19(
1434
1521
  TextField2,
1435
1522
  {
1436
1523
  name: "search",
@@ -1439,7 +1526,7 @@ function BiampTableToolbarSearch({
1439
1526
  slotProps: {
1440
1527
  htmlInput: { maxLength, "aria-label": placeholder },
1441
1528
  input: {
1442
- startAdornment: /* @__PURE__ */ jsx18(InputAdornment2, { position: "start", sx: { ml: 1 }, children: /* @__PURE__ */ jsx18(
1529
+ startAdornment: /* @__PURE__ */ jsx19(InputAdornment2, { position: "start", sx: { ml: 1 }, children: /* @__PURE__ */ jsx19(
1443
1530
  SearchIcon2,
1444
1531
  {
1445
1532
  variant: "xs",
@@ -1465,9 +1552,9 @@ function BiampTableToolbarSearch({
1465
1552
  }
1466
1553
  );
1467
1554
  if (isMobile && enableMobileView) {
1468
- return /* @__PURE__ */ jsxs9(Box8, { display: "flex", alignItems: "center", width: "100%", pr: 1, gap: 1, children: [
1469
- /* @__PURE__ */ jsx18(SearchIcon2, { sx: { width: 16, height: 16 } }),
1470
- /* @__PURE__ */ jsx18(
1555
+ return /* @__PURE__ */ jsxs9(Box9, { display: "flex", alignItems: "center", width: "100%", pr: 1, gap: 1, children: [
1556
+ /* @__PURE__ */ jsx19(SearchIcon2, { sx: { width: 16, height: 16 } }),
1557
+ /* @__PURE__ */ jsx19(
1471
1558
  InputBase,
1472
1559
  {
1473
1560
  name: "search",
@@ -1489,14 +1576,14 @@ function BiampTableToolbarSearch({
1489
1576
  ] });
1490
1577
  }
1491
1578
  if (expandable) {
1492
- return /* @__PURE__ */ jsxs9(Box8, { display: "flex", alignItems: "center", minWidth: 28, children: [
1493
- /* @__PURE__ */ jsx18(
1494
- IconButton4,
1579
+ return /* @__PURE__ */ jsxs9(Box9, { display: "flex", alignItems: "center", minWidth: 28, children: [
1580
+ /* @__PURE__ */ jsx19(
1581
+ IconButton5,
1495
1582
  {
1496
1583
  "aria-label": expandLabel ?? placeholder,
1497
1584
  onClick: () => setIsExpanded(true),
1498
1585
  sx: { display: isExpanded || inputValue ? "none" : "flex" },
1499
- children: /* @__PURE__ */ jsx18(
1586
+ children: /* @__PURE__ */ jsx19(
1500
1587
  SearchIcon2,
1501
1588
  {
1502
1589
  variant: "xs",
@@ -1506,7 +1593,7 @@ function BiampTableToolbarSearch({
1506
1593
  )
1507
1594
  }
1508
1595
  ),
1509
- /* @__PURE__ */ jsx18(
1596
+ /* @__PURE__ */ jsx19(
1510
1597
  Collapse,
1511
1598
  {
1512
1599
  in: isExpanded || !!inputValue,
@@ -1520,6 +1607,158 @@ function BiampTableToolbarSearch({
1520
1607
  return textField;
1521
1608
  }
1522
1609
 
1610
+ // src/BiampTable/useBiampServerSideTable.ts
1611
+ import {
1612
+ getCoreRowModel,
1613
+ useReactTable
1614
+ } from "@tanstack/react-table";
1615
+ import { useMemo } from "react";
1616
+
1617
+ // src/BiampTable/serverSideTableUtils.ts
1618
+ function orderToSorting(order, fieldToColumnId) {
1619
+ if (!order) return [];
1620
+ const id = fieldToColumnId?.[order.field] ?? order.field;
1621
+ return [{ id, desc: order.desc ?? false }];
1622
+ }
1623
+ function sortingToOrder(sorting, columnIdToField) {
1624
+ if (sorting.length === 0) return void 0;
1625
+ const { id, desc } = sorting[0];
1626
+ const field = columnIdToField?.[id] ?? id;
1627
+ return { field, desc };
1628
+ }
1629
+ function selectedIdsToRowSelection(ids) {
1630
+ const state = {};
1631
+ for (const id of ids) {
1632
+ state[id] = true;
1633
+ }
1634
+ return state;
1635
+ }
1636
+ function rowSelectionToSelectedIds(selection) {
1637
+ return Object.keys(selection).filter((key) => selection[key]);
1638
+ }
1639
+ function getOrderFieldMappings(columns) {
1640
+ const columnIdToField = {};
1641
+ const fieldToColumnId = {};
1642
+ for (const col of columns) {
1643
+ const orderField = col.meta?.orderField;
1644
+ if (col.id && orderField) {
1645
+ columnIdToField[col.id] = orderField;
1646
+ fieldToColumnId[orderField] = col.id;
1647
+ }
1648
+ }
1649
+ return { columnIdToField, fieldToColumnId };
1650
+ }
1651
+ function getDefaultColumnVisibilityFromDefs(columns) {
1652
+ const defaults = {};
1653
+ for (const col of columns) {
1654
+ if (col.id != null && col.meta?.defaultVisible !== void 0) {
1655
+ defaults[col.id] = col.meta.defaultVisible;
1656
+ }
1657
+ }
1658
+ return defaults;
1659
+ }
1660
+ function getDirtyColumnVisibility(visibility, defaults) {
1661
+ const dirty = {};
1662
+ for (const [id, visible] of Object.entries(visibility)) {
1663
+ if (visible !== (defaults[id] ?? true)) {
1664
+ dirty[id] = visible;
1665
+ }
1666
+ }
1667
+ return dirty;
1668
+ }
1669
+
1670
+ // src/BiampTable/useBiampServerSideTable.ts
1671
+ var coreRowModel = getCoreRowModel();
1672
+ function useBiampServerSideTable({
1673
+ data,
1674
+ columns,
1675
+ getRowId = (row) => row.id,
1676
+ order,
1677
+ onOrderChange,
1678
+ page,
1679
+ rowsPerPage,
1680
+ onPageChange,
1681
+ rowCount,
1682
+ columnVisibility,
1683
+ onColumnVisibilityChange,
1684
+ selectedRowIds,
1685
+ onSelectedRowIdsChange,
1686
+ enableRowSelection
1687
+ }) {
1688
+ const defaultColumnVisibility = useMemo(
1689
+ () => getDefaultColumnVisibilityFromDefs(columns),
1690
+ [columns]
1691
+ );
1692
+ const { columnIdToField, fieldToColumnId } = useMemo(
1693
+ () => getOrderFieldMappings(columns),
1694
+ [columns]
1695
+ );
1696
+ const sorting = useMemo(
1697
+ () => orderToSorting(order, fieldToColumnId),
1698
+ [order, fieldToColumnId]
1699
+ );
1700
+ const hasPagination = page != null && rowsPerPage != null;
1701
+ const pagination = useMemo(
1702
+ () => hasPagination ? { pageIndex: page, pageSize: rowsPerPage } : void 0,
1703
+ [hasPagination, page, rowsPerPage]
1704
+ );
1705
+ const hasSelection = selectedRowIds != null;
1706
+ const rowSelection = useMemo(
1707
+ () => hasSelection ? selectedIdsToRowSelection(selectedRowIds) : void 0,
1708
+ [hasSelection, selectedRowIds]
1709
+ );
1710
+ const mergedVisibility = useMemo(
1711
+ () => toVisibilityState({
1712
+ ...defaultColumnVisibility,
1713
+ ...columnVisibility
1714
+ }),
1715
+ [defaultColumnVisibility, columnVisibility]
1716
+ );
1717
+ return useReactTable({
1718
+ data,
1719
+ columns,
1720
+ getCoreRowModel: coreRowModel,
1721
+ getRowId,
1722
+ // Sorting — always manual for server-side tables
1723
+ manualSorting: true,
1724
+ sortDescFirst: false,
1725
+ state: {
1726
+ sorting,
1727
+ ...pagination && { pagination },
1728
+ columnVisibility: mergedVisibility,
1729
+ ...rowSelection && { rowSelection }
1730
+ },
1731
+ onSortingChange: onOrderChange ? (updater) => {
1732
+ const next = typeof updater === "function" ? updater(sorting) : updater;
1733
+ onOrderChange(sortingToOrder(next, columnIdToField));
1734
+ } : void 0,
1735
+ // Pagination — only when page/rowsPerPage are provided
1736
+ ...hasPagination && {
1737
+ manualPagination: true,
1738
+ rowCount: rowCount ?? 0,
1739
+ onPaginationChange: onPageChange ? (updater) => {
1740
+ const next = typeof updater === "function" ? updater(pagination) : updater;
1741
+ onPageChange(next.pageIndex);
1742
+ } : void 0
1743
+ },
1744
+ // Column visibility
1745
+ onColumnVisibilityChange: onColumnVisibilityChange ? (updater) => {
1746
+ const next = typeof updater === "function" ? updater(mergedVisibility) : updater;
1747
+ onColumnVisibilityChange(
1748
+ getDirtyColumnVisibility(next, defaultColumnVisibility)
1749
+ );
1750
+ } : void 0,
1751
+ // Row selection — only when selectedRowIds is provided
1752
+ ...hasSelection && {
1753
+ enableRowSelection: enableRowSelection ?? true,
1754
+ onRowSelectionChange: onSelectedRowIdsChange ? (updater) => {
1755
+ const next = typeof updater === "function" ? updater(rowSelection) : updater;
1756
+ onSelectedRowIdsChange(rowSelectionToSelectedIds(next));
1757
+ } : void 0
1758
+ }
1759
+ });
1760
+ }
1761
+
1523
1762
  // src/BiampTable/exportCsv.ts
1524
1763
  function exportToCsv(rows, columns, filename = "export") {
1525
1764
  const csvContent = buildCsvString(rows, columns);
@@ -1587,12 +1826,21 @@ export {
1587
1826
  BiampTableToolbarExport,
1588
1827
  BiampTableToolbarFilters,
1589
1828
  BiampTableToolbarSearch,
1829
+ BiampTableTruncatedCell,
1590
1830
  BiampWrapper,
1591
1831
  buildCsvString,
1592
1832
  exportToCsv,
1593
1833
  getColumnVisibilityDirtyCount,
1594
1834
  getDefaultColumnVisibility,
1835
+ getDefaultColumnVisibilityFromDefs,
1836
+ getDirtyColumnVisibility,
1837
+ getOrderFieldMappings,
1838
+ orderToSorting,
1839
+ rowSelectionToSelectedIds,
1840
+ selectedIdsToRowSelection,
1841
+ sortingToOrder,
1595
1842
  toVisibilityState,
1843
+ useBiampServerSideTable,
1596
1844
  useDebouncedCallback
1597
1845
  };
1598
1846
  //# sourceMappingURL=index.js.map