@bwp-web/components 0.11.2 → 0.11.4
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/BiampTable/BiampTable.d.ts.map +1 -1
- package/dist/BiampTable/BiampTableColumnVisibility.d.ts +8 -5
- package/dist/BiampTable/BiampTableColumnVisibility.d.ts.map +1 -1
- package/dist/BiampTable/BiampTablePagination.d.ts +6 -4
- package/dist/BiampTable/BiampTablePagination.d.ts.map +1 -1
- package/dist/BiampTable/BiampTableToolbarColumnVisibility.d.ts +1 -3
- package/dist/BiampTable/BiampTableToolbarColumnVisibility.d.ts.map +1 -1
- package/dist/BiampTable/BiampTableToolbarSearch.d.ts.map +1 -1
- package/dist/BiampTable/index.d.ts +1 -1
- package/dist/BiampTable/index.d.ts.map +1 -1
- package/dist/index.cjs +241 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +255 -195
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -480,6 +480,7 @@ import {
|
|
|
480
480
|
DropdownChevronUpIcon
|
|
481
481
|
} from "@bwp-web/assets";
|
|
482
482
|
import { flexRender } from "@tanstack/react-table";
|
|
483
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
483
484
|
|
|
484
485
|
// src/BiampTable/BiampTableEmptyState.tsx
|
|
485
486
|
import { NoResultsIcon } from "@bwp-web/assets";
|
|
@@ -588,198 +589,242 @@ function BiampTable({
|
|
|
588
589
|
},
|
|
589
590
|
enableRowSelection ? 48 : 0
|
|
590
591
|
);
|
|
591
|
-
const
|
|
592
|
+
const containerRef = useRef2(null);
|
|
593
|
+
const lastScrollLeftRef = useRef2(null);
|
|
594
|
+
const onContainerScroll = useCallback((target) => {
|
|
595
|
+
const { scrollLeft, scrollWidth, clientWidth } = target;
|
|
596
|
+
if (!containerRef.current || lastScrollLeftRef.current === scrollLeft)
|
|
597
|
+
return;
|
|
598
|
+
containerRef.current.dataset["rightShadow"] = scrollWidth - clientWidth > scrollLeft ? "true" : "false";
|
|
599
|
+
lastScrollLeftRef.current = scrollLeft;
|
|
600
|
+
}, []);
|
|
601
|
+
useEffect2(() => {
|
|
602
|
+
if (!containerRef.current) return;
|
|
603
|
+
const observer = new ResizeObserver(
|
|
604
|
+
([{ target }]) => onContainerScroll(target)
|
|
605
|
+
);
|
|
606
|
+
observer.observe(containerRef.current);
|
|
607
|
+
return () => observer.disconnect();
|
|
608
|
+
}, [onContainerScroll]);
|
|
592
609
|
const showLoading = useLoadingDelay(!!loading);
|
|
593
610
|
const rows = table.getRowModel().rows;
|
|
594
|
-
const showError = !!error;
|
|
595
|
-
const showEmpty = !showError && rows.length === 0;
|
|
596
|
-
return /* @__PURE__ */
|
|
611
|
+
const showError = !!error && !loading;
|
|
612
|
+
const showEmpty = !showError && !loading && rows.length === 0;
|
|
613
|
+
return /* @__PURE__ */ jsxs5(
|
|
597
614
|
TableContainer,
|
|
598
615
|
{
|
|
599
616
|
component: Box3,
|
|
600
617
|
...boxProps,
|
|
618
|
+
ref: containerRef,
|
|
619
|
+
onScroll: (e) => onContainerScroll(e.currentTarget),
|
|
601
620
|
sx: {
|
|
602
621
|
display: "flex",
|
|
603
622
|
flexDirection: "column",
|
|
604
623
|
height: "100%",
|
|
605
624
|
overflow: "auto",
|
|
606
625
|
overscrollBehavior: "none",
|
|
626
|
+
position: "relative",
|
|
627
|
+
'& [data-sticky="right"]': {
|
|
628
|
+
transition: "box-shadow .2s"
|
|
629
|
+
},
|
|
630
|
+
'&[data-right-shadow="true"] [data-sticky="right"]': {
|
|
631
|
+
boxShadow: ({ palette }) => `-16px 0px 12px -2px ${palette.background.default}`
|
|
632
|
+
},
|
|
607
633
|
...sx
|
|
608
634
|
},
|
|
609
|
-
children:
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
minWidth: tableMinWidth,
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
/* @__PURE__ */ jsx7(TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs5(TableRow, { children: [
|
|
619
|
-
enableRowSelection && /* @__PURE__ */ jsx7(
|
|
620
|
-
TableCell,
|
|
621
|
-
{
|
|
622
|
-
padding: "checkbox",
|
|
623
|
-
sx: {
|
|
624
|
-
position: "sticky",
|
|
625
|
-
left: 0,
|
|
626
|
-
zIndex: 3,
|
|
627
|
-
bgcolor: "background.paper"
|
|
628
|
-
},
|
|
629
|
-
children: !hideSelectAll && /* @__PURE__ */ jsx7(
|
|
630
|
-
Checkbox,
|
|
631
|
-
{
|
|
632
|
-
checked: table.getIsAllPageRowsSelected(),
|
|
633
|
-
indeterminate: table.getIsSomePageRowsSelected(),
|
|
634
|
-
onChange: table.getToggleAllPageRowsSelectedHandler(),
|
|
635
|
-
slotProps: { input: { "aria-label": "Select all rows" } }
|
|
636
|
-
}
|
|
637
|
-
)
|
|
638
|
-
}
|
|
639
|
-
),
|
|
640
|
-
headerGroup.headers.map((header) => {
|
|
641
|
-
const sticky = header.column.columnDef.meta?.sticky;
|
|
642
|
-
return /* @__PURE__ */ jsx7(
|
|
635
|
+
children: [
|
|
636
|
+
/* @__PURE__ */ jsxs5(
|
|
637
|
+
MuiTable,
|
|
638
|
+
{
|
|
639
|
+
"aria-busy": showLoading || void 0,
|
|
640
|
+
sx: { minWidth: tableMinWidth },
|
|
641
|
+
children: [
|
|
642
|
+
/* @__PURE__ */ jsx7(TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs5(TableRow, { children: [
|
|
643
|
+
enableRowSelection && /* @__PURE__ */ jsx7(
|
|
643
644
|
TableCell,
|
|
644
645
|
{
|
|
645
|
-
|
|
646
|
-
...header.column.getCanSort() && {
|
|
647
|
-
"aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
|
|
648
|
-
},
|
|
646
|
+
padding: "checkbox",
|
|
649
647
|
sx: {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
zIndex: 3,
|
|
655
|
-
bgcolor: "background.paper"
|
|
656
|
-
}
|
|
648
|
+
position: "sticky",
|
|
649
|
+
left: 0,
|
|
650
|
+
zIndex: 3,
|
|
651
|
+
bgcolor: "background.paper"
|
|
657
652
|
},
|
|
658
|
-
children:
|
|
659
|
-
|
|
653
|
+
children: !hideSelectAll && /* @__PURE__ */ jsx7(
|
|
654
|
+
Checkbox,
|
|
660
655
|
{
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
IconComponent: header.column.getIsSorted() === "asc" ? DropdownChevronUpIcon : DropdownChevronDownIcon
|
|
666
|
-
},
|
|
667
|
-
children: flexRender(
|
|
668
|
-
header.column.columnDef.header,
|
|
669
|
-
header.getContext()
|
|
670
|
-
)
|
|
656
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
657
|
+
indeterminate: table.getIsSomePageRowsSelected(),
|
|
658
|
+
onChange: table.getToggleAllPageRowsSelectedHandler(),
|
|
659
|
+
slotProps: { input: { "aria-label": "Select all rows" } }
|
|
671
660
|
}
|
|
672
|
-
) : flexRender(
|
|
673
|
-
header.column.columnDef.header,
|
|
674
|
-
header.getContext()
|
|
675
661
|
)
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
)
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
) }) : showEmpty ? /* @__PURE__ */ jsx7(TableRow, { children: /* @__PURE__ */ jsx7(
|
|
693
|
-
TableCell,
|
|
694
|
-
{
|
|
695
|
-
colSpan: totalColumns,
|
|
696
|
-
sx: {
|
|
697
|
-
textAlign: "center",
|
|
698
|
-
verticalAlign: "middle",
|
|
699
|
-
height: "100%"
|
|
700
|
-
},
|
|
701
|
-
children: empty && empty !== true ? empty : /* @__PURE__ */ jsx7(BiampTableEmptyState, {})
|
|
702
|
-
}
|
|
703
|
-
) }) : rows.map((row) => {
|
|
704
|
-
const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
|
|
705
|
-
return /* @__PURE__ */ jsxs5(
|
|
706
|
-
TableRow,
|
|
707
|
-
{
|
|
708
|
-
hover: clickable,
|
|
709
|
-
selected: enableRowSelection ? row.getIsSelected() : void 0,
|
|
710
|
-
role: clickable ? "button" : void 0,
|
|
711
|
-
tabIndex: clickable ? 0 : void 0,
|
|
712
|
-
sx: { cursor: clickable ? "pointer" : void 0 },
|
|
713
|
-
onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
|
|
714
|
-
onKeyDown: clickable && onRowClick ? (e) => {
|
|
715
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
716
|
-
e.preventDefault();
|
|
717
|
-
onRowClick(row.original);
|
|
718
|
-
}
|
|
719
|
-
} : void 0,
|
|
720
|
-
children: [
|
|
721
|
-
enableRowSelection && /* @__PURE__ */ jsx7(
|
|
722
|
-
TableCell,
|
|
723
|
-
{
|
|
724
|
-
padding: "checkbox",
|
|
725
|
-
sx: {
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
headerGroup.headers.map((header) => {
|
|
665
|
+
const sticky = header.column.columnDef.meta?.sticky;
|
|
666
|
+
return /* @__PURE__ */ jsx7(
|
|
667
|
+
TableCell,
|
|
668
|
+
{
|
|
669
|
+
"data-sticky": sticky || void 0,
|
|
670
|
+
sortDirection: header.column.getIsSorted() || false,
|
|
671
|
+
...header.column.getCanSort() && {
|
|
672
|
+
"aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
|
|
673
|
+
},
|
|
674
|
+
sx: {
|
|
675
|
+
minWidth: header.column.columnDef.meta?.minWidth ?? 40,
|
|
676
|
+
...sticky && {
|
|
726
677
|
position: "sticky",
|
|
727
|
-
|
|
728
|
-
zIndex:
|
|
729
|
-
bgcolor: "background.paper"
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
678
|
+
[sticky]: 0,
|
|
679
|
+
zIndex: 3,
|
|
680
|
+
bgcolor: "background.paper"
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsx7(
|
|
684
|
+
TableSortLabel,
|
|
685
|
+
{
|
|
686
|
+
active: !!header.column.getIsSorted(),
|
|
687
|
+
direction: header.column.getIsSorted() || "asc",
|
|
688
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
689
|
+
...header.column.getIsSorted() && {
|
|
690
|
+
IconComponent: header.column.getIsSorted() === "asc" ? DropdownChevronUpIcon : DropdownChevronDownIcon
|
|
691
|
+
},
|
|
692
|
+
children: flexRender(
|
|
693
|
+
header.column.columnDef.header,
|
|
694
|
+
header.getContext()
|
|
695
|
+
)
|
|
696
|
+
}
|
|
697
|
+
) : flexRender(
|
|
698
|
+
header.column.columnDef.header,
|
|
699
|
+
header.getContext()
|
|
700
|
+
)
|
|
701
|
+
},
|
|
702
|
+
header.id
|
|
703
|
+
);
|
|
704
|
+
})
|
|
705
|
+
] }, headerGroup.id)) }),
|
|
706
|
+
/* @__PURE__ */ jsx7(TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => {
|
|
707
|
+
const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
|
|
708
|
+
return /* @__PURE__ */ jsxs5(
|
|
709
|
+
TableRow,
|
|
710
|
+
{
|
|
711
|
+
hover: clickable,
|
|
712
|
+
selected: enableRowSelection ? row.getIsSelected() : void 0,
|
|
713
|
+
role: clickable ? "button" : void 0,
|
|
714
|
+
tabIndex: clickable ? 0 : void 0,
|
|
715
|
+
sx: { cursor: clickable ? "pointer" : void 0 },
|
|
716
|
+
onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
|
|
717
|
+
onKeyDown: clickable && onRowClick ? (e) => {
|
|
718
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
719
|
+
e.preventDefault();
|
|
720
|
+
onRowClick(row.original);
|
|
748
721
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
return /* @__PURE__ */ jsx7(
|
|
722
|
+
} : void 0,
|
|
723
|
+
children: [
|
|
724
|
+
enableRowSelection && /* @__PURE__ */ jsx7(
|
|
753
725
|
TableCell,
|
|
754
726
|
{
|
|
727
|
+
padding: "checkbox",
|
|
755
728
|
sx: {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
bgcolor: "
|
|
762
|
-
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
763
|
-
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
764
|
-
}
|
|
729
|
+
position: "sticky",
|
|
730
|
+
left: 0,
|
|
731
|
+
zIndex: 2,
|
|
732
|
+
bgcolor: "background.paper",
|
|
733
|
+
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
734
|
+
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
765
735
|
}
|
|
766
736
|
},
|
|
767
|
-
children:
|
|
768
|
-
|
|
769
|
-
|
|
737
|
+
children: /* @__PURE__ */ jsx7(
|
|
738
|
+
Checkbox,
|
|
739
|
+
{
|
|
740
|
+
checked: row.getIsSelected(),
|
|
741
|
+
disabled: !row.getCanSelect(),
|
|
742
|
+
onChange: row.getToggleSelectedHandler(),
|
|
743
|
+
onClick: (e) => e.stopPropagation(),
|
|
744
|
+
slotProps: {
|
|
745
|
+
input: {
|
|
746
|
+
"aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
770
750
|
)
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
)
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
row.getVisibleCells().map((cell) => {
|
|
754
|
+
const sticky = cell.column.columnDef.meta?.sticky;
|
|
755
|
+
return /* @__PURE__ */ jsx7(
|
|
756
|
+
TableCell,
|
|
757
|
+
{
|
|
758
|
+
"data-sticky": sticky || void 0,
|
|
759
|
+
sx: {
|
|
760
|
+
minWidth: cell.column.columnDef.meta?.minWidth ?? 40,
|
|
761
|
+
...sticky && {
|
|
762
|
+
position: "sticky",
|
|
763
|
+
[sticky]: 0,
|
|
764
|
+
zIndex: 2,
|
|
765
|
+
bgcolor: "background.paper",
|
|
766
|
+
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
767
|
+
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
children: flexRender(
|
|
772
|
+
cell.column.columnDef.cell,
|
|
773
|
+
cell.getContext()
|
|
774
|
+
)
|
|
775
|
+
},
|
|
776
|
+
cell.id
|
|
777
|
+
);
|
|
778
|
+
})
|
|
779
|
+
]
|
|
780
|
+
},
|
|
781
|
+
row.id
|
|
782
|
+
);
|
|
783
|
+
}) })
|
|
784
|
+
]
|
|
785
|
+
}
|
|
786
|
+
),
|
|
787
|
+
showError && /* @__PURE__ */ jsx7(
|
|
788
|
+
Box3,
|
|
789
|
+
{
|
|
790
|
+
sx: {
|
|
791
|
+
position: "absolute",
|
|
792
|
+
top: 0,
|
|
793
|
+
left: 0,
|
|
794
|
+
right: 0,
|
|
795
|
+
bottom: 0,
|
|
796
|
+
display: "flex",
|
|
797
|
+
alignItems: "center",
|
|
798
|
+
justifyContent: "center",
|
|
799
|
+
pointerEvents: "none"
|
|
800
|
+
},
|
|
801
|
+
children: error === true ? /* @__PURE__ */ jsx7(BiampTableErrorState, { sx: { pointerEvents: "auto" } }) : error instanceof Error ? /* @__PURE__ */ jsx7(
|
|
802
|
+
BiampTableErrorState,
|
|
803
|
+
{
|
|
804
|
+
description: error.message,
|
|
805
|
+
sx: { pointerEvents: "auto" }
|
|
806
|
+
}
|
|
807
|
+
) : error
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
showEmpty && /* @__PURE__ */ jsx7(
|
|
811
|
+
Box3,
|
|
812
|
+
{
|
|
813
|
+
sx: {
|
|
814
|
+
position: "absolute",
|
|
815
|
+
top: 0,
|
|
816
|
+
left: 0,
|
|
817
|
+
right: 0,
|
|
818
|
+
bottom: 0,
|
|
819
|
+
display: "flex",
|
|
820
|
+
alignItems: "center",
|
|
821
|
+
justifyContent: "center",
|
|
822
|
+
pointerEvents: "none"
|
|
823
|
+
},
|
|
824
|
+
children: empty && empty !== true ? empty : /* @__PURE__ */ jsx7(BiampTableEmptyState, { sx: { pointerEvents: "auto" } })
|
|
825
|
+
}
|
|
826
|
+
)
|
|
827
|
+
]
|
|
783
828
|
}
|
|
784
829
|
);
|
|
785
830
|
}
|
|
@@ -840,8 +885,10 @@ import {
|
|
|
840
885
|
Popover as Popover2,
|
|
841
886
|
Typography as Typography3
|
|
842
887
|
} from "@mui/material";
|
|
843
|
-
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
844
888
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
889
|
+
function toVisibilityState(visibility) {
|
|
890
|
+
return visibility;
|
|
891
|
+
}
|
|
845
892
|
function getDefaultColumnVisibility(table) {
|
|
846
893
|
const result = {};
|
|
847
894
|
for (const col of table.getAllLeafColumns()) {
|
|
@@ -873,7 +920,6 @@ var columnListItemSx = {
|
|
|
873
920
|
};
|
|
874
921
|
function BiampTableColumnVisibility({
|
|
875
922
|
table,
|
|
876
|
-
onChange,
|
|
877
923
|
showAllLabel = "Show all",
|
|
878
924
|
anchorEl,
|
|
879
925
|
anchorOrigin = { vertical: "bottom", horizontal: "right" },
|
|
@@ -881,13 +927,6 @@ function BiampTableColumnVisibility({
|
|
|
881
927
|
slotProps,
|
|
882
928
|
...popoverProps
|
|
883
929
|
}) {
|
|
884
|
-
const visibility = table.getState().columnVisibility;
|
|
885
|
-
const prevVisibilityRef = useRef2(visibility);
|
|
886
|
-
useEffect2(() => {
|
|
887
|
-
if (prevVisibilityRef.current === visibility) return;
|
|
888
|
-
prevVisibilityRef.current = visibility;
|
|
889
|
-
onChange?.(visibility);
|
|
890
|
-
}, [visibility, onChange]);
|
|
891
930
|
const allVisible = table.getAllLeafColumns().every((col) => col.getIsVisible());
|
|
892
931
|
const someVisible = table.getAllLeafColumns().some((col) => col.getIsVisible());
|
|
893
932
|
return /* @__PURE__ */ jsx10(
|
|
@@ -1013,7 +1052,6 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1013
1052
|
icon = /* @__PURE__ */ jsx12(ColumnsIcon, { variant: "xs" }),
|
|
1014
1053
|
label = "Columns",
|
|
1015
1054
|
defaultColumnVisibility,
|
|
1016
|
-
onChange,
|
|
1017
1055
|
showAllLabel,
|
|
1018
1056
|
...actionButtonProps
|
|
1019
1057
|
}) {
|
|
@@ -1037,7 +1075,6 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1037
1075
|
table,
|
|
1038
1076
|
anchorEl,
|
|
1039
1077
|
onClose: () => setAnchorEl(null),
|
|
1040
|
-
onChange,
|
|
1041
1078
|
showAllLabel
|
|
1042
1079
|
}
|
|
1043
1080
|
)
|
|
@@ -1046,14 +1083,21 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1046
1083
|
|
|
1047
1084
|
// src/BiampTable/BiampTablePagination.tsx
|
|
1048
1085
|
import { useRef as useRef3 } from "react";
|
|
1049
|
-
import {
|
|
1086
|
+
import { TablePagination } from "@mui/material";
|
|
1050
1087
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1088
|
+
var positionMap = {
|
|
1089
|
+
left: "flex-start",
|
|
1090
|
+
center: "center",
|
|
1091
|
+
right: "flex-end"
|
|
1092
|
+
};
|
|
1051
1093
|
function BiampTablePagination({
|
|
1052
1094
|
table,
|
|
1053
1095
|
rowsPerPageOptions,
|
|
1054
1096
|
loading,
|
|
1055
1097
|
autoHide = true,
|
|
1056
|
-
|
|
1098
|
+
position = "center",
|
|
1099
|
+
sx,
|
|
1100
|
+
...paginationProps
|
|
1057
1101
|
}) {
|
|
1058
1102
|
const rowCount = table.getRowCount();
|
|
1059
1103
|
const lastRowCountRef = useRef3(rowCount);
|
|
@@ -1063,7 +1107,7 @@ function BiampTablePagination({
|
|
|
1063
1107
|
const stableCount = loading ? lastRowCountRef.current : rowCount;
|
|
1064
1108
|
const pageSize = table.getState().pagination.pageSize;
|
|
1065
1109
|
if (autoHide && !loading && stableCount <= pageSize) return null;
|
|
1066
|
-
return /* @__PURE__ */ jsx13(
|
|
1110
|
+
return /* @__PURE__ */ jsx13(
|
|
1067
1111
|
TablePagination,
|
|
1068
1112
|
{
|
|
1069
1113
|
component: "div",
|
|
@@ -1077,13 +1121,25 @@ function BiampTablePagination({
|
|
|
1077
1121
|
},
|
|
1078
1122
|
rowsPerPageOptions: rowsPerPageOptions ?? [],
|
|
1079
1123
|
showFirstButton: true,
|
|
1080
|
-
showLastButton: true
|
|
1124
|
+
showLastButton: true,
|
|
1125
|
+
sx: {
|
|
1126
|
+
display: "flex",
|
|
1127
|
+
justifyContent: positionMap[position],
|
|
1128
|
+
height: 40,
|
|
1129
|
+
minHeight: 40,
|
|
1130
|
+
"& .MuiToolbar-root": {
|
|
1131
|
+
minHeight: 40,
|
|
1132
|
+
px: 0
|
|
1133
|
+
},
|
|
1134
|
+
...sx
|
|
1135
|
+
},
|
|
1136
|
+
...paginationProps
|
|
1081
1137
|
}
|
|
1082
|
-
)
|
|
1138
|
+
);
|
|
1083
1139
|
}
|
|
1084
1140
|
|
|
1085
1141
|
// src/BiampTable/BiampTableToolbar.tsx
|
|
1086
|
-
import { Box as
|
|
1142
|
+
import { Box as Box5 } from "@mui/material";
|
|
1087
1143
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1088
1144
|
function BiampTableToolbar({
|
|
1089
1145
|
children,
|
|
@@ -1091,7 +1147,7 @@ function BiampTableToolbar({
|
|
|
1091
1147
|
...props
|
|
1092
1148
|
}) {
|
|
1093
1149
|
return /* @__PURE__ */ jsx14(
|
|
1094
|
-
|
|
1150
|
+
Box5,
|
|
1095
1151
|
{
|
|
1096
1152
|
role: "toolbar",
|
|
1097
1153
|
display: "flex",
|
|
@@ -1109,13 +1165,13 @@ function BiampTableToolbar({
|
|
|
1109
1165
|
}
|
|
1110
1166
|
|
|
1111
1167
|
// src/BiampTable/BiampTableToolbarActions.tsx
|
|
1112
|
-
import { Box as
|
|
1168
|
+
import { Box as Box6 } from "@mui/material";
|
|
1113
1169
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1114
1170
|
function BiampTableToolbarActions({
|
|
1115
1171
|
children,
|
|
1116
1172
|
...props
|
|
1117
1173
|
}) {
|
|
1118
|
-
return /* @__PURE__ */ jsx15(
|
|
1174
|
+
return /* @__PURE__ */ jsx15(Box6, { display: "flex", alignItems: "center", gap: 1, ml: "auto", ...props, children });
|
|
1119
1175
|
}
|
|
1120
1176
|
|
|
1121
1177
|
// src/BiampTable/BiampTableToolbarExport.tsx
|
|
@@ -1144,7 +1200,7 @@ function BiampTableToolbarExport({
|
|
|
1144
1200
|
// src/BiampTable/BiampTableToolbarFilters.tsx
|
|
1145
1201
|
import {
|
|
1146
1202
|
Badge as Badge2,
|
|
1147
|
-
Box as
|
|
1203
|
+
Box as Box7,
|
|
1148
1204
|
Button,
|
|
1149
1205
|
Divider as Divider2,
|
|
1150
1206
|
Drawer,
|
|
@@ -1196,16 +1252,16 @@ function BiampTableToolbarFilters({
|
|
|
1196
1252
|
...drawerProps?.PaperProps
|
|
1197
1253
|
},
|
|
1198
1254
|
children: /* @__PURE__ */ jsxs8(
|
|
1199
|
-
|
|
1255
|
+
Box7,
|
|
1200
1256
|
{
|
|
1201
1257
|
height: "100%",
|
|
1202
1258
|
display: "flex",
|
|
1203
1259
|
flexDirection: "column",
|
|
1204
1260
|
justifyContent: "space-between",
|
|
1205
1261
|
children: [
|
|
1206
|
-
/* @__PURE__ */ jsxs8(
|
|
1262
|
+
/* @__PURE__ */ jsxs8(Box7, { children: [
|
|
1207
1263
|
/* @__PURE__ */ jsxs8(
|
|
1208
|
-
|
|
1264
|
+
Box7,
|
|
1209
1265
|
{
|
|
1210
1266
|
display: "flex",
|
|
1211
1267
|
justifyContent: "space-between",
|
|
@@ -1238,7 +1294,7 @@ function BiampTableToolbarFilters({
|
|
|
1238
1294
|
),
|
|
1239
1295
|
/* @__PURE__ */ jsx17(Divider2, {}),
|
|
1240
1296
|
/* @__PURE__ */ jsx17(
|
|
1241
|
-
|
|
1297
|
+
Box7,
|
|
1242
1298
|
{
|
|
1243
1299
|
role: "group",
|
|
1244
1300
|
"aria-label": "Filter options",
|
|
@@ -1251,7 +1307,7 @@ function BiampTableToolbarFilters({
|
|
|
1251
1307
|
}
|
|
1252
1308
|
)
|
|
1253
1309
|
] }),
|
|
1254
|
-
/* @__PURE__ */ jsxs8(
|
|
1310
|
+
/* @__PURE__ */ jsxs8(Box7, { display: "flex", children: [
|
|
1255
1311
|
/* @__PURE__ */ jsx17(
|
|
1256
1312
|
Button,
|
|
1257
1313
|
{
|
|
@@ -1284,7 +1340,7 @@ function BiampTableToolbarFilters({
|
|
|
1284
1340
|
|
|
1285
1341
|
// src/BiampTable/BiampTableToolbarSearch.tsx
|
|
1286
1342
|
import {
|
|
1287
|
-
Box as
|
|
1343
|
+
Box as Box8,
|
|
1288
1344
|
Collapse,
|
|
1289
1345
|
IconButton as IconButton4,
|
|
1290
1346
|
InputAdornment as InputAdornment2,
|
|
@@ -1294,7 +1350,7 @@ import { CloseIcon as CloseIcon2, SearchIcon as SearchIcon2 } from "@bwp-web/ass
|
|
|
1294
1350
|
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
1295
1351
|
|
|
1296
1352
|
// src/BiampTable/useDebouncedCallback.ts
|
|
1297
|
-
import { useCallback, useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
1353
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
1298
1354
|
var BIAMP_TABLE_DEBOUNCE_DELAY = 300;
|
|
1299
1355
|
function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
1300
1356
|
const timeoutRef = useRef4(null);
|
|
@@ -1305,7 +1361,7 @@ function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
|
1305
1361
|
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
1306
1362
|
};
|
|
1307
1363
|
}, []);
|
|
1308
|
-
return
|
|
1364
|
+
return useCallback2(
|
|
1309
1365
|
(...args) => {
|
|
1310
1366
|
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
1311
1367
|
timeoutRef.current = setTimeout(
|
|
@@ -1321,8 +1377,11 @@ function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
|
1321
1377
|
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1322
1378
|
var searchFieldSx = {
|
|
1323
1379
|
"& .MuiInputBase-root": {
|
|
1324
|
-
height:
|
|
1325
|
-
minHeight:
|
|
1380
|
+
height: "36px !important",
|
|
1381
|
+
minHeight: "36px !important"
|
|
1382
|
+
},
|
|
1383
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
1384
|
+
height: "36px !important"
|
|
1326
1385
|
}
|
|
1327
1386
|
};
|
|
1328
1387
|
function BiampTableToolbarSearch({
|
|
@@ -1402,7 +1461,7 @@ function BiampTableToolbarSearch({
|
|
|
1402
1461
|
}
|
|
1403
1462
|
);
|
|
1404
1463
|
if (expandable) {
|
|
1405
|
-
return /* @__PURE__ */ jsxs9(
|
|
1464
|
+
return /* @__PURE__ */ jsxs9(Box8, { display: "flex", alignItems: "center", minWidth: 28, children: [
|
|
1406
1465
|
/* @__PURE__ */ jsx18(
|
|
1407
1466
|
IconButton4,
|
|
1408
1467
|
{
|
|
@@ -1505,6 +1564,7 @@ export {
|
|
|
1505
1564
|
exportToCsv,
|
|
1506
1565
|
getColumnVisibilityDirtyCount,
|
|
1507
1566
|
getDefaultColumnVisibility,
|
|
1567
|
+
toVisibilityState,
|
|
1508
1568
|
useDebouncedCallback
|
|
1509
1569
|
};
|
|
1510
1570
|
//# sourceMappingURL=index.js.map
|