@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.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
exportToCsv: () => exportToCsv,
|
|
57
57
|
getColumnVisibilityDirtyCount: () => getColumnVisibilityDirtyCount,
|
|
58
58
|
getDefaultColumnVisibility: () => getDefaultColumnVisibility,
|
|
59
|
+
toVisibilityState: () => toVisibilityState,
|
|
59
60
|
useDebouncedCallback: () => useDebouncedCallback
|
|
60
61
|
});
|
|
61
62
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -516,6 +517,7 @@ function BiampLayout({
|
|
|
516
517
|
var import_material6 = require("@mui/material");
|
|
517
518
|
var import_assets5 = require("@bwp-web/assets");
|
|
518
519
|
var import_react_table = require("@tanstack/react-table");
|
|
520
|
+
var import_react3 = require("react");
|
|
519
521
|
|
|
520
522
|
// src/BiampTable/BiampTableEmptyState.tsx
|
|
521
523
|
var import_assets3 = require("@bwp-web/assets");
|
|
@@ -624,198 +626,242 @@ function BiampTable({
|
|
|
624
626
|
},
|
|
625
627
|
enableRowSelection ? 48 : 0
|
|
626
628
|
);
|
|
627
|
-
const
|
|
629
|
+
const containerRef = (0, import_react3.useRef)(null);
|
|
630
|
+
const lastScrollLeftRef = (0, import_react3.useRef)(null);
|
|
631
|
+
const onContainerScroll = (0, import_react3.useCallback)((target) => {
|
|
632
|
+
const { scrollLeft, scrollWidth, clientWidth } = target;
|
|
633
|
+
if (!containerRef.current || lastScrollLeftRef.current === scrollLeft)
|
|
634
|
+
return;
|
|
635
|
+
containerRef.current.dataset["rightShadow"] = scrollWidth - clientWidth > scrollLeft ? "true" : "false";
|
|
636
|
+
lastScrollLeftRef.current = scrollLeft;
|
|
637
|
+
}, []);
|
|
638
|
+
(0, import_react3.useEffect)(() => {
|
|
639
|
+
if (!containerRef.current) return;
|
|
640
|
+
const observer = new ResizeObserver(
|
|
641
|
+
([{ target }]) => onContainerScroll(target)
|
|
642
|
+
);
|
|
643
|
+
observer.observe(containerRef.current);
|
|
644
|
+
return () => observer.disconnect();
|
|
645
|
+
}, [onContainerScroll]);
|
|
628
646
|
const showLoading = useLoadingDelay(!!loading);
|
|
629
647
|
const rows = table.getRowModel().rows;
|
|
630
|
-
const showError = !!error;
|
|
631
|
-
const showEmpty = !showError && rows.length === 0;
|
|
632
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.
|
|
648
|
+
const showError = !!error && !loading;
|
|
649
|
+
const showEmpty = !showError && !loading && rows.length === 0;
|
|
650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
633
651
|
import_material6.TableContainer,
|
|
634
652
|
{
|
|
635
653
|
component: import_material6.Box,
|
|
636
654
|
...boxProps,
|
|
655
|
+
ref: containerRef,
|
|
656
|
+
onScroll: (e) => onContainerScroll(e.currentTarget),
|
|
637
657
|
sx: {
|
|
638
658
|
display: "flex",
|
|
639
659
|
flexDirection: "column",
|
|
640
660
|
height: "100%",
|
|
641
661
|
overflow: "auto",
|
|
642
662
|
overscrollBehavior: "none",
|
|
663
|
+
position: "relative",
|
|
664
|
+
'& [data-sticky="right"]': {
|
|
665
|
+
transition: "box-shadow .2s"
|
|
666
|
+
},
|
|
667
|
+
'&[data-right-shadow="true"] [data-sticky="right"]': {
|
|
668
|
+
boxShadow: ({ palette }) => `-16px 0px 12px -2px ${palette.background.default}`
|
|
669
|
+
},
|
|
643
670
|
...sx
|
|
644
671
|
},
|
|
645
|
-
children:
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
minWidth: tableMinWidth,
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableRow, { children: [
|
|
655
|
-
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
656
|
-
import_material6.TableCell,
|
|
657
|
-
{
|
|
658
|
-
padding: "checkbox",
|
|
659
|
-
sx: {
|
|
660
|
-
position: "sticky",
|
|
661
|
-
left: 0,
|
|
662
|
-
zIndex: 3,
|
|
663
|
-
bgcolor: "background.paper"
|
|
664
|
-
},
|
|
665
|
-
children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
666
|
-
import_material6.Checkbox,
|
|
667
|
-
{
|
|
668
|
-
checked: table.getIsAllPageRowsSelected(),
|
|
669
|
-
indeterminate: table.getIsSomePageRowsSelected(),
|
|
670
|
-
onChange: table.getToggleAllPageRowsSelectedHandler(),
|
|
671
|
-
slotProps: { input: { "aria-label": "Select all rows" } }
|
|
672
|
-
}
|
|
673
|
-
)
|
|
674
|
-
}
|
|
675
|
-
),
|
|
676
|
-
headerGroup.headers.map((header) => {
|
|
677
|
-
const sticky = header.column.columnDef.meta?.sticky;
|
|
678
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
672
|
+
children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
674
|
+
import_material6.Table,
|
|
675
|
+
{
|
|
676
|
+
"aria-busy": showLoading || void 0,
|
|
677
|
+
sx: { minWidth: tableMinWidth },
|
|
678
|
+
children: [
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableRow, { children: [
|
|
680
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
679
681
|
import_material6.TableCell,
|
|
680
682
|
{
|
|
681
|
-
|
|
682
|
-
...header.column.getCanSort() && {
|
|
683
|
-
"aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
|
|
684
|
-
},
|
|
683
|
+
padding: "checkbox",
|
|
685
684
|
sx: {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
zIndex: 3,
|
|
691
|
-
bgcolor: "background.paper"
|
|
692
|
-
}
|
|
685
|
+
position: "sticky",
|
|
686
|
+
left: 0,
|
|
687
|
+
zIndex: 3,
|
|
688
|
+
bgcolor: "background.paper"
|
|
693
689
|
},
|
|
694
|
-
children:
|
|
695
|
-
import_material6.
|
|
690
|
+
children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
691
|
+
import_material6.Checkbox,
|
|
696
692
|
{
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
IconComponent: header.column.getIsSorted() === "asc" ? import_assets5.DropdownChevronUpIcon : import_assets5.DropdownChevronDownIcon
|
|
702
|
-
},
|
|
703
|
-
children: (0, import_react_table.flexRender)(
|
|
704
|
-
header.column.columnDef.header,
|
|
705
|
-
header.getContext()
|
|
706
|
-
)
|
|
693
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
694
|
+
indeterminate: table.getIsSomePageRowsSelected(),
|
|
695
|
+
onChange: table.getToggleAllPageRowsSelectedHandler(),
|
|
696
|
+
slotProps: { input: { "aria-label": "Select all rows" } }
|
|
707
697
|
}
|
|
708
|
-
) : (0, import_react_table.flexRender)(
|
|
709
|
-
header.column.columnDef.header,
|
|
710
|
-
header.getContext()
|
|
711
698
|
)
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
)
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
) }) : showEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
729
|
-
import_material6.TableCell,
|
|
730
|
-
{
|
|
731
|
-
colSpan: totalColumns,
|
|
732
|
-
sx: {
|
|
733
|
-
textAlign: "center",
|
|
734
|
-
verticalAlign: "middle",
|
|
735
|
-
height: "100%"
|
|
736
|
-
},
|
|
737
|
-
children: empty && empty !== true ? empty : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableEmptyState, {})
|
|
738
|
-
}
|
|
739
|
-
) }) : rows.map((row) => {
|
|
740
|
-
const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
|
|
741
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
742
|
-
import_material6.TableRow,
|
|
743
|
-
{
|
|
744
|
-
hover: clickable,
|
|
745
|
-
selected: enableRowSelection ? row.getIsSelected() : void 0,
|
|
746
|
-
role: clickable ? "button" : void 0,
|
|
747
|
-
tabIndex: clickable ? 0 : void 0,
|
|
748
|
-
sx: { cursor: clickable ? "pointer" : void 0 },
|
|
749
|
-
onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
|
|
750
|
-
onKeyDown: clickable && onRowClick ? (e) => {
|
|
751
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
752
|
-
e.preventDefault();
|
|
753
|
-
onRowClick(row.original);
|
|
754
|
-
}
|
|
755
|
-
} : void 0,
|
|
756
|
-
children: [
|
|
757
|
-
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
758
|
-
import_material6.TableCell,
|
|
759
|
-
{
|
|
760
|
-
padding: "checkbox",
|
|
761
|
-
sx: {
|
|
699
|
+
}
|
|
700
|
+
),
|
|
701
|
+
headerGroup.headers.map((header) => {
|
|
702
|
+
const sticky = header.column.columnDef.meta?.sticky;
|
|
703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
704
|
+
import_material6.TableCell,
|
|
705
|
+
{
|
|
706
|
+
"data-sticky": sticky || void 0,
|
|
707
|
+
sortDirection: header.column.getIsSorted() || false,
|
|
708
|
+
...header.column.getCanSort() && {
|
|
709
|
+
"aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
|
|
710
|
+
},
|
|
711
|
+
sx: {
|
|
712
|
+
minWidth: header.column.columnDef.meta?.minWidth ?? 40,
|
|
713
|
+
...sticky && {
|
|
762
714
|
position: "sticky",
|
|
763
|
-
|
|
764
|
-
zIndex:
|
|
765
|
-
bgcolor: "background.paper"
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
715
|
+
[sticky]: 0,
|
|
716
|
+
zIndex: 3,
|
|
717
|
+
bgcolor: "background.paper"
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
721
|
+
import_material6.TableSortLabel,
|
|
722
|
+
{
|
|
723
|
+
active: !!header.column.getIsSorted(),
|
|
724
|
+
direction: header.column.getIsSorted() || "asc",
|
|
725
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
726
|
+
...header.column.getIsSorted() && {
|
|
727
|
+
IconComponent: header.column.getIsSorted() === "asc" ? import_assets5.DropdownChevronUpIcon : import_assets5.DropdownChevronDownIcon
|
|
728
|
+
},
|
|
729
|
+
children: (0, import_react_table.flexRender)(
|
|
730
|
+
header.column.columnDef.header,
|
|
731
|
+
header.getContext()
|
|
732
|
+
)
|
|
733
|
+
}
|
|
734
|
+
) : (0, import_react_table.flexRender)(
|
|
735
|
+
header.column.columnDef.header,
|
|
736
|
+
header.getContext()
|
|
737
|
+
)
|
|
738
|
+
},
|
|
739
|
+
header.id
|
|
740
|
+
);
|
|
741
|
+
})
|
|
742
|
+
] }, headerGroup.id)) }),
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => {
|
|
744
|
+
const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
|
|
745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
746
|
+
import_material6.TableRow,
|
|
747
|
+
{
|
|
748
|
+
hover: clickable,
|
|
749
|
+
selected: enableRowSelection ? row.getIsSelected() : void 0,
|
|
750
|
+
role: clickable ? "button" : void 0,
|
|
751
|
+
tabIndex: clickable ? 0 : void 0,
|
|
752
|
+
sx: { cursor: clickable ? "pointer" : void 0 },
|
|
753
|
+
onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
|
|
754
|
+
onKeyDown: clickable && onRowClick ? (e) => {
|
|
755
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
756
|
+
e.preventDefault();
|
|
757
|
+
onRowClick(row.original);
|
|
784
758
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
759
|
+
} : void 0,
|
|
760
|
+
children: [
|
|
761
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
789
762
|
import_material6.TableCell,
|
|
790
763
|
{
|
|
764
|
+
padding: "checkbox",
|
|
791
765
|
sx: {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
bgcolor: "
|
|
798
|
-
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
799
|
-
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
800
|
-
}
|
|
766
|
+
position: "sticky",
|
|
767
|
+
left: 0,
|
|
768
|
+
zIndex: 2,
|
|
769
|
+
bgcolor: "background.paper",
|
|
770
|
+
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
771
|
+
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
801
772
|
}
|
|
802
773
|
},
|
|
803
|
-
children: (0,
|
|
804
|
-
|
|
805
|
-
|
|
774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
775
|
+
import_material6.Checkbox,
|
|
776
|
+
{
|
|
777
|
+
checked: row.getIsSelected(),
|
|
778
|
+
disabled: !row.getCanSelect(),
|
|
779
|
+
onChange: row.getToggleSelectedHandler(),
|
|
780
|
+
onClick: (e) => e.stopPropagation(),
|
|
781
|
+
slotProps: {
|
|
782
|
+
input: {
|
|
783
|
+
"aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
806
787
|
)
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
)
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
788
|
+
}
|
|
789
|
+
),
|
|
790
|
+
row.getVisibleCells().map((cell) => {
|
|
791
|
+
const sticky = cell.column.columnDef.meta?.sticky;
|
|
792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
793
|
+
import_material6.TableCell,
|
|
794
|
+
{
|
|
795
|
+
"data-sticky": sticky || void 0,
|
|
796
|
+
sx: {
|
|
797
|
+
minWidth: cell.column.columnDef.meta?.minWidth ?? 40,
|
|
798
|
+
...sticky && {
|
|
799
|
+
position: "sticky",
|
|
800
|
+
[sticky]: 0,
|
|
801
|
+
zIndex: 2,
|
|
802
|
+
bgcolor: "background.paper",
|
|
803
|
+
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
804
|
+
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
children: (0, import_react_table.flexRender)(
|
|
809
|
+
cell.column.columnDef.cell,
|
|
810
|
+
cell.getContext()
|
|
811
|
+
)
|
|
812
|
+
},
|
|
813
|
+
cell.id
|
|
814
|
+
);
|
|
815
|
+
})
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
row.id
|
|
819
|
+
);
|
|
820
|
+
}) })
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
825
|
+
import_material6.Box,
|
|
826
|
+
{
|
|
827
|
+
sx: {
|
|
828
|
+
position: "absolute",
|
|
829
|
+
top: 0,
|
|
830
|
+
left: 0,
|
|
831
|
+
right: 0,
|
|
832
|
+
bottom: 0,
|
|
833
|
+
display: "flex",
|
|
834
|
+
alignItems: "center",
|
|
835
|
+
justifyContent: "center",
|
|
836
|
+
pointerEvents: "none"
|
|
837
|
+
},
|
|
838
|
+
children: error === true ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableErrorState, { sx: { pointerEvents: "auto" } }) : error instanceof Error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
839
|
+
BiampTableErrorState,
|
|
840
|
+
{
|
|
841
|
+
description: error.message,
|
|
842
|
+
sx: { pointerEvents: "auto" }
|
|
843
|
+
}
|
|
844
|
+
) : error
|
|
845
|
+
}
|
|
846
|
+
),
|
|
847
|
+
showEmpty && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
848
|
+
import_material6.Box,
|
|
849
|
+
{
|
|
850
|
+
sx: {
|
|
851
|
+
position: "absolute",
|
|
852
|
+
top: 0,
|
|
853
|
+
left: 0,
|
|
854
|
+
right: 0,
|
|
855
|
+
bottom: 0,
|
|
856
|
+
display: "flex",
|
|
857
|
+
alignItems: "center",
|
|
858
|
+
justifyContent: "center",
|
|
859
|
+
pointerEvents: "none"
|
|
860
|
+
},
|
|
861
|
+
children: empty && empty !== true ? empty : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableEmptyState, { sx: { pointerEvents: "auto" } })
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
]
|
|
819
865
|
}
|
|
820
866
|
);
|
|
821
867
|
}
|
|
@@ -867,8 +913,10 @@ function BiampTableCellActionButton({ label, icon, ...props }) {
|
|
|
867
913
|
|
|
868
914
|
// src/BiampTable/BiampTableColumnVisibility.tsx
|
|
869
915
|
var import_material9 = require("@mui/material");
|
|
870
|
-
var import_react3 = require("react");
|
|
871
916
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
917
|
+
function toVisibilityState(visibility) {
|
|
918
|
+
return visibility;
|
|
919
|
+
}
|
|
872
920
|
function getDefaultColumnVisibility(table) {
|
|
873
921
|
const result = {};
|
|
874
922
|
for (const col of table.getAllLeafColumns()) {
|
|
@@ -900,7 +948,6 @@ var columnListItemSx = {
|
|
|
900
948
|
};
|
|
901
949
|
function BiampTableColumnVisibility({
|
|
902
950
|
table,
|
|
903
|
-
onChange,
|
|
904
951
|
showAllLabel = "Show all",
|
|
905
952
|
anchorEl,
|
|
906
953
|
anchorOrigin = { vertical: "bottom", horizontal: "right" },
|
|
@@ -908,13 +955,6 @@ function BiampTableColumnVisibility({
|
|
|
908
955
|
slotProps,
|
|
909
956
|
...popoverProps
|
|
910
957
|
}) {
|
|
911
|
-
const visibility = table.getState().columnVisibility;
|
|
912
|
-
const prevVisibilityRef = (0, import_react3.useRef)(visibility);
|
|
913
|
-
(0, import_react3.useEffect)(() => {
|
|
914
|
-
if (prevVisibilityRef.current === visibility) return;
|
|
915
|
-
prevVisibilityRef.current = visibility;
|
|
916
|
-
onChange?.(visibility);
|
|
917
|
-
}, [visibility, onChange]);
|
|
918
958
|
const allVisible = table.getAllLeafColumns().every((col) => col.getIsVisible());
|
|
919
959
|
const someVisible = table.getAllLeafColumns().some((col) => col.getIsVisible());
|
|
920
960
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -1037,7 +1077,6 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1037
1077
|
icon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_assets6.ColumnsIcon, { variant: "xs" }),
|
|
1038
1078
|
label = "Columns",
|
|
1039
1079
|
defaultColumnVisibility,
|
|
1040
|
-
onChange,
|
|
1041
1080
|
showAllLabel,
|
|
1042
1081
|
...actionButtonProps
|
|
1043
1082
|
}) {
|
|
@@ -1061,7 +1100,6 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1061
1100
|
table,
|
|
1062
1101
|
anchorEl,
|
|
1063
1102
|
onClose: () => setAnchorEl(null),
|
|
1064
|
-
onChange,
|
|
1065
1103
|
showAllLabel
|
|
1066
1104
|
}
|
|
1067
1105
|
)
|
|
@@ -1072,12 +1110,19 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1072
1110
|
var import_react5 = require("react");
|
|
1073
1111
|
var import_material11 = require("@mui/material");
|
|
1074
1112
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1113
|
+
var positionMap = {
|
|
1114
|
+
left: "flex-start",
|
|
1115
|
+
center: "center",
|
|
1116
|
+
right: "flex-end"
|
|
1117
|
+
};
|
|
1075
1118
|
function BiampTablePagination({
|
|
1076
1119
|
table,
|
|
1077
1120
|
rowsPerPageOptions,
|
|
1078
1121
|
loading,
|
|
1079
1122
|
autoHide = true,
|
|
1080
|
-
|
|
1123
|
+
position = "center",
|
|
1124
|
+
sx,
|
|
1125
|
+
...paginationProps
|
|
1081
1126
|
}) {
|
|
1082
1127
|
const rowCount = table.getRowCount();
|
|
1083
1128
|
const lastRowCountRef = (0, import_react5.useRef)(rowCount);
|
|
@@ -1087,7 +1132,7 @@ function BiampTablePagination({
|
|
|
1087
1132
|
const stableCount = loading ? lastRowCountRef.current : rowCount;
|
|
1088
1133
|
const pageSize = table.getState().pagination.pageSize;
|
|
1089
1134
|
if (autoHide && !loading && stableCount <= pageSize) return null;
|
|
1090
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1091
1136
|
import_material11.TablePagination,
|
|
1092
1137
|
{
|
|
1093
1138
|
component: "div",
|
|
@@ -1101,9 +1146,21 @@ function BiampTablePagination({
|
|
|
1101
1146
|
},
|
|
1102
1147
|
rowsPerPageOptions: rowsPerPageOptions ?? [],
|
|
1103
1148
|
showFirstButton: true,
|
|
1104
|
-
showLastButton: true
|
|
1149
|
+
showLastButton: true,
|
|
1150
|
+
sx: {
|
|
1151
|
+
display: "flex",
|
|
1152
|
+
justifyContent: positionMap[position],
|
|
1153
|
+
height: 40,
|
|
1154
|
+
minHeight: 40,
|
|
1155
|
+
"& .MuiToolbar-root": {
|
|
1156
|
+
minHeight: 40,
|
|
1157
|
+
px: 0
|
|
1158
|
+
},
|
|
1159
|
+
...sx
|
|
1160
|
+
},
|
|
1161
|
+
...paginationProps
|
|
1105
1162
|
}
|
|
1106
|
-
)
|
|
1163
|
+
);
|
|
1107
1164
|
}
|
|
1108
1165
|
|
|
1109
1166
|
// src/BiampTable/BiampTableToolbar.tsx
|
|
@@ -1331,8 +1388,11 @@ function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
|
1331
1388
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1332
1389
|
var searchFieldSx = {
|
|
1333
1390
|
"& .MuiInputBase-root": {
|
|
1334
|
-
height:
|
|
1335
|
-
minHeight:
|
|
1391
|
+
height: "36px !important",
|
|
1392
|
+
minHeight: "36px !important"
|
|
1393
|
+
},
|
|
1394
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
1395
|
+
height: "36px !important"
|
|
1336
1396
|
}
|
|
1337
1397
|
};
|
|
1338
1398
|
function BiampTableToolbarSearch({
|
|
@@ -1516,6 +1576,7 @@ function downloadCsv(csvContent, filename) {
|
|
|
1516
1576
|
exportToCsv,
|
|
1517
1577
|
getColumnVisibilityDirtyCount,
|
|
1518
1578
|
getDefaultColumnVisibility,
|
|
1579
|
+
toVisibilityState,
|
|
1519
1580
|
useDebouncedCallback
|
|
1520
1581
|
});
|
|
1521
1582
|
//# sourceMappingURL=index.cjs.map
|