@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/BiampTable/BiampTable.d.ts +34 -10
- package/dist/BiampTable/BiampTable.d.ts.map +1 -1
- package/dist/BiampTable/BiampTableColumnVisibility.d.ts.map +1 -1
- package/dist/BiampTable/BiampTablePagination.d.ts.map +1 -1
- package/dist/BiampTable/BiampTableToolbarSearch.d.ts +11 -5
- package/dist/BiampTable/BiampTableToolbarSearch.d.ts.map +1 -1
- package/dist/BiampTable/BiampTableTruncatedCell.d.ts +11 -0
- package/dist/BiampTable/BiampTableTruncatedCell.d.ts.map +1 -0
- package/dist/BiampTable/index.d.ts +3 -0
- package/dist/BiampTable/index.d.ts.map +1 -1
- package/dist/BiampTable/serverSideTableUtils.d.ts +58 -0
- package/dist/BiampTable/serverSideTableUtils.d.ts.map +1 -0
- package/dist/BiampTable/tanstack-meta.d.ts +4 -0
- package/dist/BiampTable/tanstack-meta.d.ts.map +1 -1
- package/dist/BiampTable/useBiampServerSideTable.d.ts +43 -0
- package/dist/BiampTable/useBiampServerSideTable.d.ts.map +1 -0
- package/dist/index.cjs +495 -243
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +452 -204
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -51,12 +51,21 @@ __export(index_exports, {
|
|
|
51
51
|
BiampTableToolbarExport: () => BiampTableToolbarExport,
|
|
52
52
|
BiampTableToolbarFilters: () => BiampTableToolbarFilters,
|
|
53
53
|
BiampTableToolbarSearch: () => BiampTableToolbarSearch,
|
|
54
|
+
BiampTableTruncatedCell: () => BiampTableTruncatedCell,
|
|
54
55
|
BiampWrapper: () => BiampWrapper,
|
|
55
56
|
buildCsvString: () => buildCsvString,
|
|
56
57
|
exportToCsv: () => exportToCsv,
|
|
57
58
|
getColumnVisibilityDirtyCount: () => getColumnVisibilityDirtyCount,
|
|
58
59
|
getDefaultColumnVisibility: () => getDefaultColumnVisibility,
|
|
60
|
+
getDefaultColumnVisibilityFromDefs: () => getDefaultColumnVisibilityFromDefs,
|
|
61
|
+
getDirtyColumnVisibility: () => getDirtyColumnVisibility,
|
|
62
|
+
getOrderFieldMappings: () => getOrderFieldMappings,
|
|
63
|
+
orderToSorting: () => orderToSorting,
|
|
64
|
+
rowSelectionToSelectedIds: () => rowSelectionToSelectedIds,
|
|
65
|
+
selectedIdsToRowSelection: () => selectedIdsToRowSelection,
|
|
66
|
+
sortingToOrder: () => sortingToOrder,
|
|
59
67
|
toVisibilityState: () => toVisibilityState,
|
|
68
|
+
useBiampServerSideTable: () => useBiampServerSideTable,
|
|
60
69
|
useDebouncedCallback: () => useDebouncedCallback
|
|
61
70
|
});
|
|
62
71
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -514,10 +523,10 @@ function BiampLayout({
|
|
|
514
523
|
}
|
|
515
524
|
|
|
516
525
|
// src/BiampTable/BiampTable.tsx
|
|
517
|
-
var
|
|
526
|
+
var import_material7 = require("@mui/material");
|
|
518
527
|
var import_assets5 = require("@bwp-web/assets");
|
|
519
528
|
var import_react_table = require("@tanstack/react-table");
|
|
520
|
-
var
|
|
529
|
+
var import_react4 = require("react");
|
|
521
530
|
|
|
522
531
|
// src/BiampTable/BiampTableEmptyState.tsx
|
|
523
532
|
var import_assets3 = require("@bwp-web/assets");
|
|
@@ -533,7 +542,7 @@ function BiampTableStatusMessage({
|
|
|
533
542
|
children,
|
|
534
543
|
...stackProps
|
|
535
544
|
}) {
|
|
536
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Stack, { alignItems: "center", gap:
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Stack, { alignItems: "center", gap: 1.5, ...stackProps, children: [
|
|
537
546
|
(0, import_react.cloneElement)(icon, {
|
|
538
547
|
"aria-hidden": true,
|
|
539
548
|
sx: { width: 56, height: 56, ...icon.props.sx }
|
|
@@ -573,18 +582,63 @@ function BiampTableErrorState({
|
|
|
573
582
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BiampTableStatusMessage, { role: "alert", icon, title, ...rest });
|
|
574
583
|
}
|
|
575
584
|
|
|
576
|
-
// src/BiampTable/
|
|
585
|
+
// src/BiampTable/BiampTableTruncatedCell.tsx
|
|
586
|
+
var import_material6 = require("@mui/material");
|
|
577
587
|
var import_react2 = require("react");
|
|
588
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
589
|
+
function BiampTableTruncatedCell({
|
|
590
|
+
children
|
|
591
|
+
}) {
|
|
592
|
+
const textRef = (0, import_react2.useRef)(null);
|
|
593
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
594
|
+
const handleMouseEnter = (0, import_react2.useCallback)(() => {
|
|
595
|
+
const el = textRef.current;
|
|
596
|
+
if (el && el.scrollWidth > el.clientWidth) {
|
|
597
|
+
setOpen(true);
|
|
598
|
+
}
|
|
599
|
+
}, []);
|
|
600
|
+
const handleMouseLeave = (0, import_react2.useCallback)(() => {
|
|
601
|
+
setOpen(false);
|
|
602
|
+
}, []);
|
|
603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
604
|
+
import_material6.Tooltip,
|
|
605
|
+
{
|
|
606
|
+
title: children,
|
|
607
|
+
open,
|
|
608
|
+
arrow: true,
|
|
609
|
+
placement: "top",
|
|
610
|
+
disableInteractive: true,
|
|
611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
612
|
+
import_material6.Box,
|
|
613
|
+
{
|
|
614
|
+
ref: textRef,
|
|
615
|
+
onMouseEnter: handleMouseEnter,
|
|
616
|
+
onMouseLeave: handleMouseLeave,
|
|
617
|
+
sx: {
|
|
618
|
+
overflow: "hidden",
|
|
619
|
+
textOverflow: "ellipsis",
|
|
620
|
+
whiteSpace: "nowrap",
|
|
621
|
+
minWidth: 0
|
|
622
|
+
},
|
|
623
|
+
children
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// src/BiampTable/useLoadingDelay.ts
|
|
631
|
+
var import_react3 = require("react");
|
|
578
632
|
function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
|
|
579
|
-
const [status, setStatus] = (0,
|
|
580
|
-
const timeoutRef = (0,
|
|
633
|
+
const [status, setStatus] = (0, import_react3.useState)("idle");
|
|
634
|
+
const timeoutRef = (0, import_react3.useRef)(null);
|
|
581
635
|
function clearPending() {
|
|
582
636
|
if (timeoutRef.current !== null) {
|
|
583
637
|
clearTimeout(timeoutRef.current);
|
|
584
638
|
timeoutRef.current = null;
|
|
585
639
|
}
|
|
586
640
|
}
|
|
587
|
-
(0,
|
|
641
|
+
(0, import_react3.useEffect)(() => {
|
|
588
642
|
if (loading && status === "idle") {
|
|
589
643
|
clearPending();
|
|
590
644
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -600,12 +654,44 @@ function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
|
|
|
600
654
|
setStatus("idle");
|
|
601
655
|
}
|
|
602
656
|
}, [loading, delay, minDuration, status]);
|
|
603
|
-
(0,
|
|
657
|
+
(0, import_react3.useEffect)(() => clearPending, []);
|
|
604
658
|
return status === "loading" || status === "ending";
|
|
605
659
|
}
|
|
606
660
|
|
|
607
661
|
// src/BiampTable/BiampTable.tsx
|
|
608
|
-
var
|
|
662
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
663
|
+
var overlaySx = {
|
|
664
|
+
position: "absolute",
|
|
665
|
+
top: 0,
|
|
666
|
+
left: 0,
|
|
667
|
+
right: 0,
|
|
668
|
+
bottom: 0,
|
|
669
|
+
display: "flex",
|
|
670
|
+
alignItems: "center",
|
|
671
|
+
justifyContent: "center",
|
|
672
|
+
pointerEvents: "none"
|
|
673
|
+
};
|
|
674
|
+
var stickyHoverBg = {
|
|
675
|
+
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
676
|
+
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
function cellSx(sticky, minWidth, zIndex) {
|
|
680
|
+
if (sticky) {
|
|
681
|
+
return {
|
|
682
|
+
position: "sticky",
|
|
683
|
+
[sticky]: 0,
|
|
684
|
+
zIndex,
|
|
685
|
+
width: 0,
|
|
686
|
+
whiteSpace: "nowrap",
|
|
687
|
+
textAlign: "center",
|
|
688
|
+
bgcolor: "background.paper",
|
|
689
|
+
...zIndex < 3 && stickyHoverBg
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
const mw = minWidth ?? 40;
|
|
693
|
+
return { minWidth: mw, maxWidth: mw };
|
|
694
|
+
}
|
|
609
695
|
function BiampTable({
|
|
610
696
|
table,
|
|
611
697
|
onRowClick,
|
|
@@ -614,7 +700,9 @@ function BiampTable({
|
|
|
614
700
|
error,
|
|
615
701
|
empty,
|
|
616
702
|
enableRowSelection = false,
|
|
703
|
+
enableExpanding = false,
|
|
617
704
|
hideSelectAll,
|
|
705
|
+
selectChildrenWithParent = false,
|
|
618
706
|
getRowLabel,
|
|
619
707
|
sx,
|
|
620
708
|
...boxProps
|
|
@@ -626,15 +714,16 @@ function BiampTable({
|
|
|
626
714
|
},
|
|
627
715
|
enableRowSelection ? 48 : 0
|
|
628
716
|
);
|
|
629
|
-
const containerRef = (0,
|
|
717
|
+
const containerRef = (0, import_react4.useRef)(null);
|
|
630
718
|
const showLoading = useLoadingDelay(!!loading);
|
|
631
719
|
const rows = table.getRowModel().rows;
|
|
720
|
+
const hasExpandableRows = enableExpanding && rows.some((r) => r.getCanExpand());
|
|
632
721
|
const showError = !!error && !loading;
|
|
633
722
|
const showEmpty = !showError && !loading && rows.length === 0;
|
|
634
|
-
return /* @__PURE__ */ (0,
|
|
635
|
-
|
|
723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
724
|
+
import_material7.TableContainer,
|
|
636
725
|
{
|
|
637
|
-
component:
|
|
726
|
+
component: import_material7.Box,
|
|
638
727
|
...boxProps,
|
|
639
728
|
ref: containerRef,
|
|
640
729
|
sx: {
|
|
@@ -647,15 +736,15 @@ function BiampTable({
|
|
|
647
736
|
...sx
|
|
648
737
|
},
|
|
649
738
|
children: [
|
|
650
|
-
/* @__PURE__ */ (0,
|
|
651
|
-
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
740
|
+
import_material7.Table,
|
|
652
741
|
{
|
|
653
742
|
"aria-busy": showLoading || void 0,
|
|
654
743
|
sx: { minWidth: tableMinWidth, tableLayout: "auto" },
|
|
655
744
|
children: [
|
|
656
|
-
/* @__PURE__ */ (0,
|
|
657
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
658
|
-
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material7.TableRow, { children: [
|
|
746
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
747
|
+
import_material7.TableCell,
|
|
659
748
|
{
|
|
660
749
|
padding: "checkbox",
|
|
661
750
|
sx: {
|
|
@@ -664,8 +753,8 @@ function BiampTable({
|
|
|
664
753
|
zIndex: 3,
|
|
665
754
|
bgcolor: "background.paper"
|
|
666
755
|
},
|
|
667
|
-
children: !hideSelectAll && /* @__PURE__ */ (0,
|
|
668
|
-
|
|
756
|
+
children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
757
|
+
import_material7.Checkbox,
|
|
669
758
|
{
|
|
670
759
|
checked: table.getIsAllPageRowsSelected(),
|
|
671
760
|
indeterminate: table.getIsSomePageRowsSelected(),
|
|
@@ -678,28 +767,21 @@ function BiampTable({
|
|
|
678
767
|
),
|
|
679
768
|
headerGroup.headers.map((header) => {
|
|
680
769
|
const sticky = header.column.columnDef.meta?.sticky;
|
|
681
|
-
return /* @__PURE__ */ (0,
|
|
682
|
-
|
|
770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
771
|
+
import_material7.TableCell,
|
|
683
772
|
{
|
|
684
773
|
"data-sticky": sticky || void 0,
|
|
685
774
|
sortDirection: header.column.getIsSorted() || false,
|
|
686
775
|
...header.column.getCanSort() && {
|
|
687
776
|
"aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
|
|
688
777
|
},
|
|
689
|
-
sx:
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
whiteSpace: "nowrap",
|
|
697
|
-
textAlign: "center",
|
|
698
|
-
bgcolor: "background.paper"
|
|
699
|
-
}
|
|
700
|
-
},
|
|
701
|
-
children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
702
|
-
import_material6.TableSortLabel,
|
|
778
|
+
sx: cellSx(
|
|
779
|
+
sticky,
|
|
780
|
+
header.column.columnDef.meta?.minWidth,
|
|
781
|
+
3
|
|
782
|
+
),
|
|
783
|
+
children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
784
|
+
import_material7.TableSortLabel,
|
|
703
785
|
{
|
|
704
786
|
active: !!header.column.getIsSorted(),
|
|
705
787
|
direction: header.column.getIsSorted() || "asc",
|
|
@@ -721,10 +803,10 @@ function BiampTable({
|
|
|
721
803
|
);
|
|
722
804
|
})
|
|
723
805
|
] }, headerGroup.id)) }),
|
|
724
|
-
/* @__PURE__ */ (0,
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: !showError && rows.map((row) => {
|
|
725
807
|
const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
|
|
726
|
-
return /* @__PURE__ */ (0,
|
|
727
|
-
|
|
808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
809
|
+
import_material7.TableRow,
|
|
728
810
|
{
|
|
729
811
|
hover: clickable,
|
|
730
812
|
selected: enableRowSelection ? row.getIsSelected() : void 0,
|
|
@@ -739,8 +821,8 @@ function BiampTable({
|
|
|
739
821
|
}
|
|
740
822
|
} : void 0,
|
|
741
823
|
children: [
|
|
742
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
743
|
-
|
|
824
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
825
|
+
import_material7.TableCell,
|
|
744
826
|
{
|
|
745
827
|
padding: "checkbox",
|
|
746
828
|
sx: {
|
|
@@ -752,12 +834,14 @@ function BiampTable({
|
|
|
752
834
|
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
753
835
|
}
|
|
754
836
|
},
|
|
755
|
-
children: /* @__PURE__ */ (0,
|
|
756
|
-
|
|
837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
838
|
+
import_material7.Checkbox,
|
|
757
839
|
{
|
|
758
840
|
checked: row.getIsSelected(),
|
|
759
841
|
disabled: !row.getCanSelect(),
|
|
760
|
-
onChange: row.
|
|
842
|
+
onChange: (e) => row.toggleSelected(e.target.checked, {
|
|
843
|
+
selectChildren: selectChildrenWithParent
|
|
844
|
+
}),
|
|
761
845
|
onClick: (e) => e.stopPropagation(),
|
|
762
846
|
sx: !row.getCanSelect() ? { visibility: "hidden" } : void 0,
|
|
763
847
|
slotProps: {
|
|
@@ -769,31 +853,66 @@ function BiampTable({
|
|
|
769
853
|
)
|
|
770
854
|
}
|
|
771
855
|
),
|
|
772
|
-
row.getVisibleCells().map((cell) => {
|
|
856
|
+
row.getVisibleCells().map((cell, cellIndex, cells) => {
|
|
773
857
|
const sticky = cell.column.columnDef.meta?.sticky;
|
|
774
|
-
|
|
775
|
-
|
|
858
|
+
const isExpandCell = enableExpanding && !sticky && cellIndex === cells.findIndex(
|
|
859
|
+
(c) => !c.column.columnDef.meta?.sticky
|
|
860
|
+
);
|
|
861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
862
|
+
import_material7.TableCell,
|
|
776
863
|
{
|
|
777
864
|
"data-sticky": sticky || void 0,
|
|
778
|
-
sx:
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
865
|
+
sx: cellSx(
|
|
866
|
+
sticky,
|
|
867
|
+
cell.column.columnDef.meta?.minWidth,
|
|
868
|
+
2
|
|
869
|
+
),
|
|
870
|
+
children: (() => {
|
|
871
|
+
const content = (0, import_react_table.flexRender)(
|
|
872
|
+
cell.column.columnDef.cell,
|
|
873
|
+
cell.getContext()
|
|
874
|
+
);
|
|
875
|
+
if (sticky) return content;
|
|
876
|
+
const truncated = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BiampTableTruncatedCell, { children: content });
|
|
877
|
+
if (!isExpandCell) return truncated;
|
|
878
|
+
const rowLabel = getRowLabel ? getRowLabel(row.original) : `row ${row.index + 1}`;
|
|
879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
880
|
+
import_material7.Box,
|
|
881
|
+
{
|
|
882
|
+
sx: {
|
|
883
|
+
display: "flex",
|
|
884
|
+
alignItems: "center",
|
|
885
|
+
pl: `${row.depth * 12}px`
|
|
886
|
+
},
|
|
887
|
+
children: [
|
|
888
|
+
row.getCanExpand() ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
889
|
+
import_material7.IconButton,
|
|
890
|
+
{
|
|
891
|
+
variant: "none",
|
|
892
|
+
onClick: (e) => {
|
|
893
|
+
e.stopPropagation();
|
|
894
|
+
row.toggleExpanded();
|
|
895
|
+
},
|
|
896
|
+
"aria-label": row.getIsExpanded() ? `Collapse ${rowLabel}` : `Expand ${rowLabel}`,
|
|
897
|
+
"aria-expanded": row.getIsExpanded(),
|
|
898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
899
|
+
import_assets5.ChevronRightIcon,
|
|
900
|
+
{
|
|
901
|
+
variant: "xs",
|
|
902
|
+
sx: {
|
|
903
|
+
color: ({ palette }) => palette.text.secondary,
|
|
904
|
+
transition: "transform 150ms ease",
|
|
905
|
+
transform: row.getIsExpanded() ? "rotate(90deg)" : "rotate(0deg)"
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
)
|
|
909
|
+
}
|
|
910
|
+
) : hasExpandableRows ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Box, { sx: { width: 28 } }) : null,
|
|
911
|
+
truncated
|
|
912
|
+
]
|
|
790
913
|
}
|
|
791
|
-
|
|
792
|
-
}
|
|
793
|
-
children: (0, import_react_table.flexRender)(
|
|
794
|
-
cell.column.columnDef.cell,
|
|
795
|
-
cell.getContext()
|
|
796
|
-
)
|
|
914
|
+
);
|
|
915
|
+
})()
|
|
797
916
|
},
|
|
798
917
|
cell.id
|
|
799
918
|
);
|
|
@@ -806,54 +925,22 @@ function BiampTable({
|
|
|
806
925
|
]
|
|
807
926
|
}
|
|
808
927
|
),
|
|
809
|
-
showError && /* @__PURE__ */ (0,
|
|
810
|
-
|
|
928
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Box, { sx: overlaySx, children: error === true ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BiampTableErrorState, { sx: { pointerEvents: "auto" } }) : error instanceof Error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
929
|
+
BiampTableErrorState,
|
|
811
930
|
{
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
top: 0,
|
|
815
|
-
left: 0,
|
|
816
|
-
right: 0,
|
|
817
|
-
bottom: 0,
|
|
818
|
-
display: "flex",
|
|
819
|
-
alignItems: "center",
|
|
820
|
-
justifyContent: "center",
|
|
821
|
-
pointerEvents: "none"
|
|
822
|
-
},
|
|
823
|
-
children: error === true ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableErrorState, { sx: { pointerEvents: "auto" } }) : error instanceof Error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
824
|
-
BiampTableErrorState,
|
|
825
|
-
{
|
|
826
|
-
description: error.message,
|
|
827
|
-
sx: { pointerEvents: "auto" }
|
|
828
|
-
}
|
|
829
|
-
) : error
|
|
931
|
+
description: error.message,
|
|
932
|
+
sx: { pointerEvents: "auto" }
|
|
830
933
|
}
|
|
831
|
-
),
|
|
832
|
-
showEmpty && /* @__PURE__ */ (0,
|
|
833
|
-
import_material6.Box,
|
|
834
|
-
{
|
|
835
|
-
sx: {
|
|
836
|
-
position: "absolute",
|
|
837
|
-
top: 0,
|
|
838
|
-
left: 0,
|
|
839
|
-
right: 0,
|
|
840
|
-
bottom: 0,
|
|
841
|
-
display: "flex",
|
|
842
|
-
alignItems: "center",
|
|
843
|
-
justifyContent: "center",
|
|
844
|
-
pointerEvents: "none"
|
|
845
|
-
},
|
|
846
|
-
children: empty && empty !== true ? empty : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableEmptyState, { sx: { pointerEvents: "auto" } })
|
|
847
|
-
}
|
|
848
|
-
)
|
|
934
|
+
) : error }),
|
|
935
|
+
showEmpty && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Box, { sx: overlaySx, children: empty && empty !== true ? empty : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BiampTableEmptyState, { sx: { pointerEvents: "auto" } }) })
|
|
849
936
|
]
|
|
850
937
|
}
|
|
851
938
|
);
|
|
852
939
|
}
|
|
853
940
|
|
|
854
941
|
// src/BiampTable/BiampTableContainer.tsx
|
|
855
|
-
var
|
|
856
|
-
var
|
|
942
|
+
var import_material8 = require("@mui/material");
|
|
943
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
857
944
|
function BiampTableContainer({
|
|
858
945
|
withBorderTop = true,
|
|
859
946
|
withBorderBottom = false,
|
|
@@ -861,8 +948,8 @@ function BiampTableContainer({
|
|
|
861
948
|
sx,
|
|
862
949
|
...props
|
|
863
950
|
}) {
|
|
864
|
-
return /* @__PURE__ */ (0,
|
|
865
|
-
|
|
951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
952
|
+
import_material8.Stack,
|
|
866
953
|
{
|
|
867
954
|
direction: "column",
|
|
868
955
|
height: "100%",
|
|
@@ -880,25 +967,25 @@ function BiampTableContainer({
|
|
|
880
967
|
}
|
|
881
968
|
|
|
882
969
|
// src/BiampTable/BiampTableCellActionButton.tsx
|
|
883
|
-
var
|
|
884
|
-
var
|
|
970
|
+
var import_material9 = require("@mui/material");
|
|
971
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
885
972
|
function BiampTableCellActionButton({ label, icon, ...props }) {
|
|
886
|
-
return /* @__PURE__ */ (0,
|
|
887
|
-
|
|
973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
974
|
+
import_material9.Tooltip,
|
|
888
975
|
{
|
|
889
976
|
title: label,
|
|
890
977
|
placement: "top",
|
|
891
978
|
enterDelay: 500,
|
|
892
979
|
enterNextDelay: 500,
|
|
893
980
|
disableInteractive: true,
|
|
894
|
-
children: /* @__PURE__ */ (0,
|
|
981
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material9.IconButton, { "aria-label": label, ...props, children: icon }) })
|
|
895
982
|
}
|
|
896
983
|
);
|
|
897
984
|
}
|
|
898
985
|
|
|
899
986
|
// src/BiampTable/BiampTableColumnVisibility.tsx
|
|
900
|
-
var
|
|
901
|
-
var
|
|
987
|
+
var import_material10 = require("@mui/material");
|
|
988
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
902
989
|
function toVisibilityState(visibility) {
|
|
903
990
|
return visibility;
|
|
904
991
|
}
|
|
@@ -941,9 +1028,8 @@ function BiampTableColumnVisibility({
|
|
|
941
1028
|
...popoverProps
|
|
942
1029
|
}) {
|
|
943
1030
|
const allVisible = table.getAllLeafColumns().every((col) => col.getIsVisible());
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
import_material9.Popover,
|
|
1031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1032
|
+
import_material10.Popover,
|
|
947
1033
|
{
|
|
948
1034
|
anchorEl,
|
|
949
1035
|
open: Boolean(anchorEl),
|
|
@@ -956,58 +1042,64 @@ function BiampTableColumnVisibility({
|
|
|
956
1042
|
borderRadius: "6px",
|
|
957
1043
|
backgroundImage: "none",
|
|
958
1044
|
border: `0.6px solid ${palette.dividers.secondary}`,
|
|
959
|
-
boxShadow: `0px 1px 1px 0px ${(0,
|
|
1045
|
+
boxShadow: `0px 1px 1px 0px ${(0, import_material10.alpha)(palette.common.black, 0.05)}`,
|
|
960
1046
|
minWidth: "150px"
|
|
961
1047
|
}),
|
|
962
1048
|
...slotProps?.paper ?? {}
|
|
963
1049
|
}
|
|
964
1050
|
},
|
|
965
1051
|
...popoverProps,
|
|
966
|
-
children: /* @__PURE__ */ (0,
|
|
967
|
-
/* @__PURE__ */ (0,
|
|
968
|
-
|
|
1052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_material10.List, { dense: true, disablePadding: true, children: [
|
|
1053
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1054
|
+
import_material10.ListItem,
|
|
969
1055
|
{
|
|
1056
|
+
dense: true,
|
|
970
1057
|
sx: columnListItemSx,
|
|
971
1058
|
onClick: () => table.toggleAllColumnsVisible(!allVisible),
|
|
972
1059
|
children: [
|
|
973
|
-
/* @__PURE__ */ (0,
|
|
974
|
-
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1061
|
+
import_material10.Checkbox,
|
|
975
1062
|
{
|
|
976
1063
|
checked: allVisible,
|
|
977
|
-
indeterminate: !allVisible && someVisible,
|
|
978
|
-
size: "small",
|
|
979
1064
|
slotProps: { input: { "aria-label": `${showAllLabel} columns` } }
|
|
980
1065
|
}
|
|
981
1066
|
),
|
|
982
|
-
/* @__PURE__ */ (0,
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material10.Typography, { variant: "caption", fontWeight: 600, children: showAllLabel })
|
|
983
1068
|
]
|
|
984
1069
|
}
|
|
985
1070
|
),
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
987
|
-
/* @__PURE__ */ (0,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
{
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material10.Divider, {}),
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1073
|
+
import_material10.Box,
|
|
1074
|
+
{
|
|
1075
|
+
sx: { maxHeight: 340, overflow: "auto", overscrollBehavior: "none" },
|
|
1076
|
+
children: table.getAllLeafColumns().map((column) => {
|
|
1077
|
+
const columnName = column.columnDef.meta?.columnLabel ?? (typeof column.columnDef.header === "string" ? column.columnDef.header : column.id);
|
|
1078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1079
|
+
import_material10.ListItem,
|
|
1080
|
+
{
|
|
1081
|
+
dense: true,
|
|
1082
|
+
sx: columnListItemSx,
|
|
1083
|
+
onClick: column.getToggleVisibilityHandler(),
|
|
1084
|
+
children: [
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1086
|
+
import_material10.Checkbox,
|
|
1087
|
+
{
|
|
1088
|
+
checked: column.getIsVisible(),
|
|
1089
|
+
sx: { py: 1 },
|
|
1090
|
+
slotProps: {
|
|
1091
|
+
input: { "aria-label": `Show ${columnName}` }
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material10.Typography, { variant: "caption", children: columnName })
|
|
1096
|
+
]
|
|
1097
|
+
},
|
|
1098
|
+
column.id
|
|
1099
|
+
);
|
|
1100
|
+
})
|
|
1101
|
+
}
|
|
1102
|
+
)
|
|
1011
1103
|
] })
|
|
1012
1104
|
}
|
|
1013
1105
|
);
|
|
@@ -1015,11 +1107,11 @@ function BiampTableColumnVisibility({
|
|
|
1015
1107
|
|
|
1016
1108
|
// src/BiampTable/BiampTableToolbarColumnVisibility.tsx
|
|
1017
1109
|
var import_assets6 = require("@bwp-web/assets");
|
|
1018
|
-
var
|
|
1110
|
+
var import_react5 = require("react");
|
|
1019
1111
|
|
|
1020
1112
|
// src/BiampTable/BiampTableToolbarActionButton.tsx
|
|
1021
|
-
var
|
|
1022
|
-
var
|
|
1113
|
+
var import_material11 = require("@mui/material");
|
|
1114
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1023
1115
|
function BiampTableToolbarActionButton({
|
|
1024
1116
|
label,
|
|
1025
1117
|
icon,
|
|
@@ -1027,13 +1119,13 @@ function BiampTableToolbarActionButton({
|
|
|
1027
1119
|
...props
|
|
1028
1120
|
}) {
|
|
1029
1121
|
const showBadge = badgeContent != null && badgeContent !== 0;
|
|
1030
|
-
return /* @__PURE__ */ (0,
|
|
1031
|
-
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1123
|
+
import_material11.IconButton,
|
|
1032
1124
|
{
|
|
1033
1125
|
"aria-label": showBadge ? `${label} (${badgeContent})` : label,
|
|
1034
1126
|
...props,
|
|
1035
|
-
children: showBadge ? /* @__PURE__ */ (0,
|
|
1036
|
-
|
|
1127
|
+
children: showBadge ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1128
|
+
import_material11.Badge,
|
|
1037
1129
|
{
|
|
1038
1130
|
badgeContent,
|
|
1039
1131
|
color: "info",
|
|
@@ -1056,20 +1148,20 @@ function BiampTableToolbarActionButton({
|
|
|
1056
1148
|
}
|
|
1057
1149
|
|
|
1058
1150
|
// src/BiampTable/BiampTableToolbarColumnVisibility.tsx
|
|
1059
|
-
var
|
|
1151
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1060
1152
|
function BiampTableToolbarColumnVisibility({
|
|
1061
1153
|
table,
|
|
1062
|
-
icon = /* @__PURE__ */ (0,
|
|
1154
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_assets6.ColumnsIcon, { variant: "xs" }),
|
|
1063
1155
|
label = "Columns",
|
|
1064
1156
|
defaultColumnVisibility,
|
|
1065
1157
|
showAllLabel,
|
|
1066
1158
|
...actionButtonProps
|
|
1067
1159
|
}) {
|
|
1068
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
1160
|
+
const [anchorEl, setAnchorEl] = (0, import_react5.useState)(null);
|
|
1069
1161
|
const defaults = defaultColumnVisibility ?? getDefaultColumnVisibility(table);
|
|
1070
1162
|
const dirtyCount = getColumnVisibilityDirtyCount(table, defaults);
|
|
1071
|
-
return /* @__PURE__ */ (0,
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1073
1165
|
BiampTableToolbarActionButton,
|
|
1074
1166
|
{
|
|
1075
1167
|
label,
|
|
@@ -1079,7 +1171,7 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1079
1171
|
...actionButtonProps
|
|
1080
1172
|
}
|
|
1081
1173
|
),
|
|
1082
|
-
/* @__PURE__ */ (0,
|
|
1174
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1083
1175
|
BiampTableColumnVisibility,
|
|
1084
1176
|
{
|
|
1085
1177
|
table,
|
|
@@ -1092,9 +1184,9 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1092
1184
|
}
|
|
1093
1185
|
|
|
1094
1186
|
// src/BiampTable/BiampTablePagination.tsx
|
|
1095
|
-
var
|
|
1096
|
-
var
|
|
1097
|
-
var
|
|
1187
|
+
var import_react6 = require("react");
|
|
1188
|
+
var import_material12 = require("@mui/material");
|
|
1189
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1098
1190
|
var positionMap = {
|
|
1099
1191
|
left: "flex-start",
|
|
1100
1192
|
center: "center",
|
|
@@ -1110,19 +1202,21 @@ function BiampTablePagination({
|
|
|
1110
1202
|
...paginationProps
|
|
1111
1203
|
}) {
|
|
1112
1204
|
const rowCount = table.getRowCount();
|
|
1113
|
-
const lastRowCountRef = (0,
|
|
1205
|
+
const lastRowCountRef = (0, import_react6.useRef)(rowCount);
|
|
1114
1206
|
if (!loading && rowCount >= 0) {
|
|
1115
1207
|
lastRowCountRef.current = rowCount;
|
|
1116
1208
|
}
|
|
1117
1209
|
const stableCount = loading ? lastRowCountRef.current : rowCount;
|
|
1118
1210
|
const { pageSize, pageIndex } = table.getState().pagination;
|
|
1119
1211
|
const maxPage = Math.max(0, Math.ceil(stableCount / pageSize) - 1);
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1212
|
+
(0, import_react6.useEffect)(() => {
|
|
1213
|
+
if (!loading && pageIndex > maxPage) {
|
|
1214
|
+
table.setPageIndex(maxPage);
|
|
1215
|
+
}
|
|
1216
|
+
}, [loading, pageIndex, maxPage, table]);
|
|
1123
1217
|
if (autoHide && (!stableCount || stableCount <= pageSize)) return null;
|
|
1124
|
-
return /* @__PURE__ */ (0,
|
|
1125
|
-
|
|
1218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1219
|
+
import_material12.TablePagination,
|
|
1126
1220
|
{
|
|
1127
1221
|
component: "div",
|
|
1128
1222
|
count: stableCount,
|
|
@@ -1153,15 +1247,15 @@ function BiampTablePagination({
|
|
|
1153
1247
|
}
|
|
1154
1248
|
|
|
1155
1249
|
// src/BiampTable/BiampTableToolbar.tsx
|
|
1156
|
-
var
|
|
1157
|
-
var
|
|
1250
|
+
var import_material13 = require("@mui/material");
|
|
1251
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1158
1252
|
function BiampTableToolbar({
|
|
1159
1253
|
children,
|
|
1160
1254
|
sx,
|
|
1161
1255
|
...props
|
|
1162
1256
|
}) {
|
|
1163
|
-
return /* @__PURE__ */ (0,
|
|
1164
|
-
|
|
1257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1258
|
+
import_material13.Box,
|
|
1165
1259
|
{
|
|
1166
1260
|
role: "toolbar",
|
|
1167
1261
|
display: "flex",
|
|
@@ -1179,14 +1273,14 @@ function BiampTableToolbar({
|
|
|
1179
1273
|
}
|
|
1180
1274
|
|
|
1181
1275
|
// src/BiampTable/BiampTableToolbarActions.tsx
|
|
1182
|
-
var
|
|
1183
|
-
var
|
|
1276
|
+
var import_material14 = require("@mui/material");
|
|
1277
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1184
1278
|
function BiampTableToolbarActions({
|
|
1185
1279
|
children,
|
|
1186
1280
|
...props
|
|
1187
1281
|
}) {
|
|
1188
|
-
return /* @__PURE__ */ (0,
|
|
1189
|
-
|
|
1282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1283
|
+
import_material14.Box,
|
|
1190
1284
|
{
|
|
1191
1285
|
display: "flex",
|
|
1192
1286
|
alignItems: "center",
|
|
@@ -1200,21 +1294,21 @@ function BiampTableToolbarActions({
|
|
|
1200
1294
|
}
|
|
1201
1295
|
|
|
1202
1296
|
// src/BiampTable/BiampTableToolbarExport.tsx
|
|
1203
|
-
var
|
|
1297
|
+
var import_material15 = require("@mui/material");
|
|
1204
1298
|
var import_assets7 = require("@bwp-web/assets");
|
|
1205
|
-
var
|
|
1299
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1206
1300
|
function BiampTableToolbarExport({
|
|
1207
1301
|
onExport,
|
|
1208
1302
|
loading,
|
|
1209
|
-
icon = /* @__PURE__ */ (0,
|
|
1303
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_assets7.DownloadIcon, { variant: "xs" }),
|
|
1210
1304
|
label = "Export",
|
|
1211
1305
|
...props
|
|
1212
1306
|
}) {
|
|
1213
|
-
return /* @__PURE__ */ (0,
|
|
1307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1214
1308
|
BiampTableToolbarActionButton,
|
|
1215
1309
|
{
|
|
1216
1310
|
label: loading ? `${label}, loading` : label,
|
|
1217
|
-
icon: loading ? /* @__PURE__ */ (0,
|
|
1311
|
+
icon: loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.CircularProgress, { size: 20, color: "inherit" }) : icon,
|
|
1218
1312
|
disabled: loading,
|
|
1219
1313
|
onClick: onExport,
|
|
1220
1314
|
...props
|
|
@@ -1223,16 +1317,16 @@ function BiampTableToolbarExport({
|
|
|
1223
1317
|
}
|
|
1224
1318
|
|
|
1225
1319
|
// src/BiampTable/BiampTableToolbarFilters.tsx
|
|
1226
|
-
var
|
|
1320
|
+
var import_material16 = require("@mui/material");
|
|
1227
1321
|
var import_assets8 = require("@bwp-web/assets");
|
|
1228
|
-
var
|
|
1229
|
-
var
|
|
1322
|
+
var import_react7 = require("react");
|
|
1323
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1230
1324
|
function BiampTableToolbarFilters({
|
|
1231
1325
|
activeFilterCount,
|
|
1232
1326
|
children,
|
|
1233
1327
|
onReset,
|
|
1234
1328
|
onApply,
|
|
1235
|
-
icon = /* @__PURE__ */ (0,
|
|
1329
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_assets8.FilterIcon, { variant: "xs" }),
|
|
1236
1330
|
title = "Filters",
|
|
1237
1331
|
resetLabel = "Clear filters",
|
|
1238
1332
|
applyLabel = "Apply",
|
|
@@ -1240,14 +1334,14 @@ function BiampTableToolbarFilters({
|
|
|
1240
1334
|
buttonLabel = "Filters",
|
|
1241
1335
|
DrawerProps: drawerProps
|
|
1242
1336
|
}) {
|
|
1243
|
-
const [open, setOpen] = (0,
|
|
1244
|
-
const titleId = (0,
|
|
1337
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
1338
|
+
const titleId = (0, import_react7.useId)();
|
|
1245
1339
|
function handleClose() {
|
|
1246
1340
|
onApply?.();
|
|
1247
1341
|
setOpen(false);
|
|
1248
1342
|
}
|
|
1249
|
-
return /* @__PURE__ */ (0,
|
|
1250
|
-
/* @__PURE__ */ (0,
|
|
1343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1344
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1251
1345
|
BiampTableToolbarActionButton,
|
|
1252
1346
|
{
|
|
1253
1347
|
label: buttonLabel,
|
|
@@ -1256,8 +1350,8 @@ function BiampTableToolbarFilters({
|
|
|
1256
1350
|
onClick: () => setOpen(true)
|
|
1257
1351
|
}
|
|
1258
1352
|
),
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1260
|
-
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1354
|
+
import_material16.Drawer,
|
|
1261
1355
|
{
|
|
1262
1356
|
anchor: "right",
|
|
1263
1357
|
open,
|
|
@@ -1268,17 +1362,17 @@ function BiampTableToolbarFilters({
|
|
|
1268
1362
|
sx: { width: { xs: "100%", sm: 480 } },
|
|
1269
1363
|
...drawerProps?.PaperProps
|
|
1270
1364
|
},
|
|
1271
|
-
children: /* @__PURE__ */ (0,
|
|
1272
|
-
|
|
1365
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1366
|
+
import_material16.Box,
|
|
1273
1367
|
{
|
|
1274
1368
|
height: "100%",
|
|
1275
1369
|
display: "flex",
|
|
1276
1370
|
flexDirection: "column",
|
|
1277
1371
|
justifyContent: "space-between",
|
|
1278
1372
|
children: [
|
|
1279
|
-
/* @__PURE__ */ (0,
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1375
|
+
import_material16.Box,
|
|
1282
1376
|
{
|
|
1283
1377
|
display: "flex",
|
|
1284
1378
|
justifyContent: "space-between",
|
|
@@ -1286,10 +1380,10 @@ function BiampTableToolbarFilters({
|
|
|
1286
1380
|
px: 3.5,
|
|
1287
1381
|
py: 2.5,
|
|
1288
1382
|
children: [
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Typography, { id: titleId, variant: "h2", children: [
|
|
1290
1384
|
title,
|
|
1291
|
-
/* @__PURE__ */ (0,
|
|
1292
|
-
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1386
|
+
import_material16.Badge,
|
|
1293
1387
|
{
|
|
1294
1388
|
badgeContent: activeFilterCount,
|
|
1295
1389
|
color: "secondary",
|
|
@@ -1297,21 +1391,21 @@ function BiampTableToolbarFilters({
|
|
|
1297
1391
|
}
|
|
1298
1392
|
)
|
|
1299
1393
|
] }),
|
|
1300
|
-
/* @__PURE__ */ (0,
|
|
1301
|
-
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1395
|
+
import_material16.IconButton,
|
|
1302
1396
|
{
|
|
1303
1397
|
size: "medium",
|
|
1304
1398
|
onClick: handleClose,
|
|
1305
1399
|
"aria-label": closeLabel,
|
|
1306
|
-
children: /* @__PURE__ */ (0,
|
|
1400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_assets8.CloseIcon, {})
|
|
1307
1401
|
}
|
|
1308
1402
|
)
|
|
1309
1403
|
]
|
|
1310
1404
|
}
|
|
1311
1405
|
),
|
|
1312
|
-
/* @__PURE__ */ (0,
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
1314
|
-
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Divider, {}),
|
|
1407
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1408
|
+
import_material16.Box,
|
|
1315
1409
|
{
|
|
1316
1410
|
role: "group",
|
|
1317
1411
|
"aria-label": "Filter options",
|
|
@@ -1324,9 +1418,9 @@ function BiampTableToolbarFilters({
|
|
|
1324
1418
|
}
|
|
1325
1419
|
)
|
|
1326
1420
|
] }),
|
|
1327
|
-
/* @__PURE__ */ (0,
|
|
1328
|
-
/* @__PURE__ */ (0,
|
|
1329
|
-
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { display: "flex", children: [
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1423
|
+
import_material16.Button,
|
|
1330
1424
|
{
|
|
1331
1425
|
variant: "overlay",
|
|
1332
1426
|
color: "secondary",
|
|
@@ -1336,8 +1430,8 @@ function BiampTableToolbarFilters({
|
|
|
1336
1430
|
children: resetLabel
|
|
1337
1431
|
}
|
|
1338
1432
|
),
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1340
|
-
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1434
|
+
import_material16.Button,
|
|
1341
1435
|
{
|
|
1342
1436
|
variant: "overlay",
|
|
1343
1437
|
color: "primary",
|
|
@@ -1356,23 +1450,23 @@ function BiampTableToolbarFilters({
|
|
|
1356
1450
|
}
|
|
1357
1451
|
|
|
1358
1452
|
// src/BiampTable/BiampTableToolbarSearch.tsx
|
|
1359
|
-
var
|
|
1453
|
+
var import_material17 = require("@mui/material");
|
|
1360
1454
|
var import_assets9 = require("@bwp-web/assets");
|
|
1361
|
-
var
|
|
1455
|
+
var import_react9 = require("react");
|
|
1362
1456
|
|
|
1363
1457
|
// src/BiampTable/useDebouncedCallback.ts
|
|
1364
|
-
var
|
|
1458
|
+
var import_react8 = require("react");
|
|
1365
1459
|
var BIAMP_TABLE_DEBOUNCE_DELAY = 300;
|
|
1366
1460
|
function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
1367
|
-
const timeoutRef = (0,
|
|
1368
|
-
const callbackRef = (0,
|
|
1461
|
+
const timeoutRef = (0, import_react8.useRef)(null);
|
|
1462
|
+
const callbackRef = (0, import_react8.useRef)(callback);
|
|
1369
1463
|
callbackRef.current = callback;
|
|
1370
|
-
(0,
|
|
1464
|
+
(0, import_react8.useEffect)(() => {
|
|
1371
1465
|
return () => {
|
|
1372
1466
|
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
1373
1467
|
};
|
|
1374
1468
|
}, []);
|
|
1375
|
-
return (0,
|
|
1469
|
+
return (0, import_react8.useCallback)(
|
|
1376
1470
|
(...args) => {
|
|
1377
1471
|
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
1378
1472
|
timeoutRef.current = setTimeout(
|
|
@@ -1385,7 +1479,7 @@ function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
|
1385
1479
|
}
|
|
1386
1480
|
|
|
1387
1481
|
// src/BiampTable/BiampTableToolbarSearch.tsx
|
|
1388
|
-
var
|
|
1482
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1389
1483
|
var searchFieldSx = {
|
|
1390
1484
|
"& .MuiInputBase-root": {
|
|
1391
1485
|
height: "36px !important",
|
|
@@ -1409,11 +1503,11 @@ function BiampTableToolbarSearch({
|
|
|
1409
1503
|
sx,
|
|
1410
1504
|
...textFieldProps
|
|
1411
1505
|
}) {
|
|
1412
|
-
const isMobile = (0,
|
|
1413
|
-
const [inputValue, setInputValue] = (0,
|
|
1414
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
1506
|
+
const isMobile = (0, import_material17.useMediaQuery)((t) => t.breakpoints.down("md"));
|
|
1507
|
+
const [inputValue, setInputValue] = (0, import_react9.useState)(defaultValue);
|
|
1508
|
+
const [isExpanded, setIsExpanded] = (0, import_react9.useState)(false);
|
|
1415
1509
|
const debouncedOnChange = useDebouncedCallback(onChange, debounceDelay);
|
|
1416
|
-
(0,
|
|
1510
|
+
(0, import_react9.useEffect)(() => {
|
|
1417
1511
|
setInputValue(defaultValue);
|
|
1418
1512
|
}, [defaultValue]);
|
|
1419
1513
|
const handleChange = (e) => {
|
|
@@ -1429,18 +1523,18 @@ function BiampTableToolbarSearch({
|
|
|
1429
1523
|
setIsExpanded(false);
|
|
1430
1524
|
}
|
|
1431
1525
|
};
|
|
1432
|
-
const clearButton = inputValue ? /* @__PURE__ */ (0,
|
|
1433
|
-
|
|
1526
|
+
const clearButton = inputValue ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.InputAdornment, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1527
|
+
import_material17.IconButton,
|
|
1434
1528
|
{
|
|
1435
1529
|
size: "small",
|
|
1436
1530
|
onClick: handleClear,
|
|
1437
1531
|
"aria-label": clearLabel,
|
|
1438
1532
|
sx: { mr: 0.5 },
|
|
1439
|
-
children: /* @__PURE__ */ (0,
|
|
1533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_assets9.CloseIcon, { variant: "xs", sx: { width: 20, height: 20 } })
|
|
1440
1534
|
}
|
|
1441
1535
|
) }) : null;
|
|
1442
|
-
const textField = /* @__PURE__ */ (0,
|
|
1443
|
-
|
|
1536
|
+
const textField = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1537
|
+
import_material17.TextField,
|
|
1444
1538
|
{
|
|
1445
1539
|
name: "search",
|
|
1446
1540
|
type: "text",
|
|
@@ -1448,7 +1542,7 @@ function BiampTableToolbarSearch({
|
|
|
1448
1542
|
slotProps: {
|
|
1449
1543
|
htmlInput: { maxLength, "aria-label": placeholder },
|
|
1450
1544
|
input: {
|
|
1451
|
-
startAdornment: /* @__PURE__ */ (0,
|
|
1545
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.InputAdornment, { position: "start", sx: { ml: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1452
1546
|
import_assets9.SearchIcon,
|
|
1453
1547
|
{
|
|
1454
1548
|
variant: "xs",
|
|
@@ -1474,10 +1568,10 @@ function BiampTableToolbarSearch({
|
|
|
1474
1568
|
}
|
|
1475
1569
|
);
|
|
1476
1570
|
if (isMobile && enableMobileView) {
|
|
1477
|
-
return /* @__PURE__ */ (0,
|
|
1478
|
-
/* @__PURE__ */ (0,
|
|
1479
|
-
/* @__PURE__ */ (0,
|
|
1480
|
-
|
|
1571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Box, { display: "flex", alignItems: "center", width: "100%", pr: 1, gap: 1, children: [
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_assets9.SearchIcon, { sx: { width: 16, height: 16 } }),
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1574
|
+
import_material17.InputBase,
|
|
1481
1575
|
{
|
|
1482
1576
|
name: "search",
|
|
1483
1577
|
type: "text",
|
|
@@ -1498,14 +1592,14 @@ function BiampTableToolbarSearch({
|
|
|
1498
1592
|
] });
|
|
1499
1593
|
}
|
|
1500
1594
|
if (expandable) {
|
|
1501
|
-
return /* @__PURE__ */ (0,
|
|
1502
|
-
/* @__PURE__ */ (0,
|
|
1503
|
-
|
|
1595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Box, { display: "flex", alignItems: "center", minWidth: 28, children: [
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1597
|
+
import_material17.IconButton,
|
|
1504
1598
|
{
|
|
1505
1599
|
"aria-label": expandLabel ?? placeholder,
|
|
1506
1600
|
onClick: () => setIsExpanded(true),
|
|
1507
1601
|
sx: { display: isExpanded || inputValue ? "none" : "flex" },
|
|
1508
|
-
children: /* @__PURE__ */ (0,
|
|
1602
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1509
1603
|
import_assets9.SearchIcon,
|
|
1510
1604
|
{
|
|
1511
1605
|
variant: "xs",
|
|
@@ -1515,8 +1609,8 @@ function BiampTableToolbarSearch({
|
|
|
1515
1609
|
)
|
|
1516
1610
|
}
|
|
1517
1611
|
),
|
|
1518
|
-
/* @__PURE__ */ (0,
|
|
1519
|
-
|
|
1612
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1613
|
+
import_material17.Collapse,
|
|
1520
1614
|
{
|
|
1521
1615
|
in: isExpanded || !!inputValue,
|
|
1522
1616
|
orientation: "horizontal",
|
|
@@ -1529,6 +1623,155 @@ function BiampTableToolbarSearch({
|
|
|
1529
1623
|
return textField;
|
|
1530
1624
|
}
|
|
1531
1625
|
|
|
1626
|
+
// src/BiampTable/useBiampServerSideTable.ts
|
|
1627
|
+
var import_react_table2 = require("@tanstack/react-table");
|
|
1628
|
+
var import_react10 = require("react");
|
|
1629
|
+
|
|
1630
|
+
// src/BiampTable/serverSideTableUtils.ts
|
|
1631
|
+
function orderToSorting(order, fieldToColumnId) {
|
|
1632
|
+
if (!order) return [];
|
|
1633
|
+
const id = fieldToColumnId?.[order.field] ?? order.field;
|
|
1634
|
+
return [{ id, desc: order.desc ?? false }];
|
|
1635
|
+
}
|
|
1636
|
+
function sortingToOrder(sorting, columnIdToField) {
|
|
1637
|
+
if (sorting.length === 0) return void 0;
|
|
1638
|
+
const { id, desc } = sorting[0];
|
|
1639
|
+
const field = columnIdToField?.[id] ?? id;
|
|
1640
|
+
return { field, desc };
|
|
1641
|
+
}
|
|
1642
|
+
function selectedIdsToRowSelection(ids) {
|
|
1643
|
+
const state = {};
|
|
1644
|
+
for (const id of ids) {
|
|
1645
|
+
state[id] = true;
|
|
1646
|
+
}
|
|
1647
|
+
return state;
|
|
1648
|
+
}
|
|
1649
|
+
function rowSelectionToSelectedIds(selection) {
|
|
1650
|
+
return Object.keys(selection).filter((key) => selection[key]);
|
|
1651
|
+
}
|
|
1652
|
+
function getOrderFieldMappings(columns) {
|
|
1653
|
+
const columnIdToField = {};
|
|
1654
|
+
const fieldToColumnId = {};
|
|
1655
|
+
for (const col of columns) {
|
|
1656
|
+
const orderField = col.meta?.orderField;
|
|
1657
|
+
if (col.id && orderField) {
|
|
1658
|
+
columnIdToField[col.id] = orderField;
|
|
1659
|
+
fieldToColumnId[orderField] = col.id;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
return { columnIdToField, fieldToColumnId };
|
|
1663
|
+
}
|
|
1664
|
+
function getDefaultColumnVisibilityFromDefs(columns) {
|
|
1665
|
+
const defaults = {};
|
|
1666
|
+
for (const col of columns) {
|
|
1667
|
+
if (col.id != null && col.meta?.defaultVisible !== void 0) {
|
|
1668
|
+
defaults[col.id] = col.meta.defaultVisible;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
return defaults;
|
|
1672
|
+
}
|
|
1673
|
+
function getDirtyColumnVisibility(visibility, defaults) {
|
|
1674
|
+
const dirty = {};
|
|
1675
|
+
for (const [id, visible] of Object.entries(visibility)) {
|
|
1676
|
+
if (visible !== (defaults[id] ?? true)) {
|
|
1677
|
+
dirty[id] = visible;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
return dirty;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
// src/BiampTable/useBiampServerSideTable.ts
|
|
1684
|
+
var coreRowModel = (0, import_react_table2.getCoreRowModel)();
|
|
1685
|
+
function useBiampServerSideTable({
|
|
1686
|
+
data,
|
|
1687
|
+
columns,
|
|
1688
|
+
getRowId = (row) => row.id,
|
|
1689
|
+
order,
|
|
1690
|
+
onOrderChange,
|
|
1691
|
+
page,
|
|
1692
|
+
rowsPerPage,
|
|
1693
|
+
onPageChange,
|
|
1694
|
+
rowCount,
|
|
1695
|
+
columnVisibility,
|
|
1696
|
+
onColumnVisibilityChange,
|
|
1697
|
+
selectedRowIds,
|
|
1698
|
+
onSelectedRowIdsChange,
|
|
1699
|
+
enableRowSelection
|
|
1700
|
+
}) {
|
|
1701
|
+
const defaultColumnVisibility = (0, import_react10.useMemo)(
|
|
1702
|
+
() => getDefaultColumnVisibilityFromDefs(columns),
|
|
1703
|
+
[columns]
|
|
1704
|
+
);
|
|
1705
|
+
const { columnIdToField, fieldToColumnId } = (0, import_react10.useMemo)(
|
|
1706
|
+
() => getOrderFieldMappings(columns),
|
|
1707
|
+
[columns]
|
|
1708
|
+
);
|
|
1709
|
+
const sorting = (0, import_react10.useMemo)(
|
|
1710
|
+
() => orderToSorting(order, fieldToColumnId),
|
|
1711
|
+
[order, fieldToColumnId]
|
|
1712
|
+
);
|
|
1713
|
+
const hasPagination = page != null && rowsPerPage != null;
|
|
1714
|
+
const pagination = (0, import_react10.useMemo)(
|
|
1715
|
+
() => hasPagination ? { pageIndex: page, pageSize: rowsPerPage } : void 0,
|
|
1716
|
+
[hasPagination, page, rowsPerPage]
|
|
1717
|
+
);
|
|
1718
|
+
const hasSelection = selectedRowIds != null;
|
|
1719
|
+
const rowSelection = (0, import_react10.useMemo)(
|
|
1720
|
+
() => hasSelection ? selectedIdsToRowSelection(selectedRowIds) : void 0,
|
|
1721
|
+
[hasSelection, selectedRowIds]
|
|
1722
|
+
);
|
|
1723
|
+
const mergedVisibility = (0, import_react10.useMemo)(
|
|
1724
|
+
() => toVisibilityState({
|
|
1725
|
+
...defaultColumnVisibility,
|
|
1726
|
+
...columnVisibility
|
|
1727
|
+
}),
|
|
1728
|
+
[defaultColumnVisibility, columnVisibility]
|
|
1729
|
+
);
|
|
1730
|
+
return (0, import_react_table2.useReactTable)({
|
|
1731
|
+
data,
|
|
1732
|
+
columns,
|
|
1733
|
+
getCoreRowModel: coreRowModel,
|
|
1734
|
+
getRowId,
|
|
1735
|
+
// Sorting — always manual for server-side tables
|
|
1736
|
+
manualSorting: true,
|
|
1737
|
+
sortDescFirst: false,
|
|
1738
|
+
state: {
|
|
1739
|
+
sorting,
|
|
1740
|
+
...pagination && { pagination },
|
|
1741
|
+
columnVisibility: mergedVisibility,
|
|
1742
|
+
...rowSelection && { rowSelection }
|
|
1743
|
+
},
|
|
1744
|
+
onSortingChange: onOrderChange ? (updater) => {
|
|
1745
|
+
const next = typeof updater === "function" ? updater(sorting) : updater;
|
|
1746
|
+
onOrderChange(sortingToOrder(next, columnIdToField));
|
|
1747
|
+
} : void 0,
|
|
1748
|
+
// Pagination — only when page/rowsPerPage are provided
|
|
1749
|
+
...hasPagination && {
|
|
1750
|
+
manualPagination: true,
|
|
1751
|
+
rowCount: rowCount ?? 0,
|
|
1752
|
+
onPaginationChange: onPageChange ? (updater) => {
|
|
1753
|
+
const next = typeof updater === "function" ? updater(pagination) : updater;
|
|
1754
|
+
onPageChange(next.pageIndex);
|
|
1755
|
+
} : void 0
|
|
1756
|
+
},
|
|
1757
|
+
// Column visibility
|
|
1758
|
+
onColumnVisibilityChange: onColumnVisibilityChange ? (updater) => {
|
|
1759
|
+
const next = typeof updater === "function" ? updater(mergedVisibility) : updater;
|
|
1760
|
+
onColumnVisibilityChange(
|
|
1761
|
+
getDirtyColumnVisibility(next, defaultColumnVisibility)
|
|
1762
|
+
);
|
|
1763
|
+
} : void 0,
|
|
1764
|
+
// Row selection — only when selectedRowIds is provided
|
|
1765
|
+
...hasSelection && {
|
|
1766
|
+
enableRowSelection: enableRowSelection ?? true,
|
|
1767
|
+
onRowSelectionChange: onSelectedRowIdsChange ? (updater) => {
|
|
1768
|
+
const next = typeof updater === "function" ? updater(rowSelection) : updater;
|
|
1769
|
+
onSelectedRowIdsChange(rowSelectionToSelectedIds(next));
|
|
1770
|
+
} : void 0
|
|
1771
|
+
}
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1532
1775
|
// src/BiampTable/exportCsv.ts
|
|
1533
1776
|
function exportToCsv(rows, columns, filename = "export") {
|
|
1534
1777
|
const csvContent = buildCsvString(rows, columns);
|
|
@@ -1597,12 +1840,21 @@ function downloadCsv(csvContent, filename) {
|
|
|
1597
1840
|
BiampTableToolbarExport,
|
|
1598
1841
|
BiampTableToolbarFilters,
|
|
1599
1842
|
BiampTableToolbarSearch,
|
|
1843
|
+
BiampTableTruncatedCell,
|
|
1600
1844
|
BiampWrapper,
|
|
1601
1845
|
buildCsvString,
|
|
1602
1846
|
exportToCsv,
|
|
1603
1847
|
getColumnVisibilityDirtyCount,
|
|
1604
1848
|
getDefaultColumnVisibility,
|
|
1849
|
+
getDefaultColumnVisibilityFromDefs,
|
|
1850
|
+
getDirtyColumnVisibility,
|
|
1851
|
+
getOrderFieldMappings,
|
|
1852
|
+
orderToSorting,
|
|
1853
|
+
rowSelectionToSelectedIds,
|
|
1854
|
+
selectedIdsToRowSelection,
|
|
1855
|
+
sortingToOrder,
|
|
1605
1856
|
toVisibilityState,
|
|
1857
|
+
useBiampServerSideTable,
|
|
1606
1858
|
useDebouncedCallback
|
|
1607
1859
|
});
|
|
1608
1860
|
//# sourceMappingURL=index.cjs.map
|