@bwp-web/components 0.10.0 → 0.11.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 +27 -0
- package/dist/BiampTable/BiampTable.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableCellActionButton.d.ts +13 -0
- package/dist/BiampTable/BiampTableCellActionButton.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableColumnVisibility.d.ts +18 -0
- package/dist/BiampTable/BiampTableColumnVisibility.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableContainer.d.ts +9 -0
- package/dist/BiampTable/BiampTableContainer.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableEmptyState.d.ts +4 -0
- package/dist/BiampTable/BiampTableEmptyState.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableErrorState.d.ts +4 -0
- package/dist/BiampTable/BiampTableErrorState.d.ts.map +1 -0
- package/dist/BiampTable/BiampTablePagination.d.ts +14 -0
- package/dist/BiampTable/BiampTablePagination.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableStatusMessage.d.ts +14 -0
- package/dist/BiampTable/BiampTableStatusMessage.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableToolbar.d.ts +4 -0
- package/dist/BiampTable/BiampTableToolbar.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableToolbarActionButton.d.ts +12 -0
- package/dist/BiampTable/BiampTableToolbarActionButton.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableToolbarActions.d.ts +4 -0
- package/dist/BiampTable/BiampTableToolbarActions.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableToolbarExport.d.ts +13 -0
- package/dist/BiampTable/BiampTableToolbarExport.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableToolbarFilters.d.ts +28 -0
- package/dist/BiampTable/BiampTableToolbarFilters.d.ts.map +1 -0
- package/dist/BiampTable/BiampTableToolbarSearch.d.ts +19 -0
- package/dist/BiampTable/BiampTableToolbarSearch.d.ts.map +1 -0
- package/dist/BiampTable/index.d.ts +16 -0
- package/dist/BiampTable/index.d.ts.map +1 -0
- package/dist/BiampTable/tanstack-meta.d.ts +10 -0
- package/dist/BiampTable/tanstack-meta.d.ts.map +1 -0
- package/dist/BiampTable/useDebouncedCallback.d.ts +9 -0
- package/dist/BiampTable/useDebouncedCallback.d.ts.map +1 -0
- package/dist/BiampTable/useLoadingDelay.d.ts +17 -0
- package/dist/BiampTable/useLoadingDelay.d.ts.map +1 -0
- package/dist/index.cjs +867 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +886 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
BIAMP_TABLE_DEBOUNCE_DELAY: () => BIAMP_TABLE_DEBOUNCE_DELAY,
|
|
23
24
|
BiampAppDialog: () => BiampAppDialog,
|
|
24
25
|
BiampAppDialogItem: () => BiampAppDialogItem,
|
|
25
26
|
BiampAppPopover: () => BiampAppPopover,
|
|
@@ -35,7 +36,23 @@ __export(index_exports, {
|
|
|
35
36
|
BiampSidebarComponent: () => BiampSidebarComponent,
|
|
36
37
|
BiampSidebarIcon: () => BiampSidebarIcon,
|
|
37
38
|
BiampSidebarIconList: () => BiampSidebarIconList,
|
|
38
|
-
|
|
39
|
+
BiampTable: () => BiampTable,
|
|
40
|
+
BiampTableCellActionButton: () => BiampTableCellActionButton,
|
|
41
|
+
BiampTableColumnVisibility: () => BiampTableColumnVisibility,
|
|
42
|
+
BiampTableContainer: () => BiampTableContainer,
|
|
43
|
+
BiampTableEmptyState: () => BiampTableEmptyState,
|
|
44
|
+
BiampTableErrorState: () => BiampTableErrorState,
|
|
45
|
+
BiampTablePagination: () => BiampTablePagination,
|
|
46
|
+
BiampTableStatusMessage: () => BiampTableStatusMessage,
|
|
47
|
+
BiampTableToolbar: () => BiampTableToolbar,
|
|
48
|
+
BiampTableToolbarActionButton: () => BiampTableToolbarActionButton,
|
|
49
|
+
BiampTableToolbarActions: () => BiampTableToolbarActions,
|
|
50
|
+
BiampTableToolbarExport: () => BiampTableToolbarExport,
|
|
51
|
+
BiampTableToolbarFilters: () => BiampTableToolbarFilters,
|
|
52
|
+
BiampTableToolbarSearch: () => BiampTableToolbarSearch,
|
|
53
|
+
BiampWrapper: () => BiampWrapper,
|
|
54
|
+
getColumnVisibilityDirtyCount: () => getColumnVisibilityDirtyCount,
|
|
55
|
+
useDebouncedCallback: () => useDebouncedCallback
|
|
39
56
|
});
|
|
40
57
|
module.exports = __toCommonJS(index_exports);
|
|
41
58
|
|
|
@@ -490,8 +507,840 @@ function BiampLayout({
|
|
|
490
507
|
}
|
|
491
508
|
);
|
|
492
509
|
}
|
|
510
|
+
|
|
511
|
+
// src/BiampTable/BiampTable.tsx
|
|
512
|
+
var import_material6 = require("@mui/material");
|
|
513
|
+
var import_assets5 = require("@bwp-web/assets");
|
|
514
|
+
var import_react_table = require("@tanstack/react-table");
|
|
515
|
+
|
|
516
|
+
// src/BiampTable/BiampTableEmptyState.tsx
|
|
517
|
+
var import_assets3 = require("@bwp-web/assets");
|
|
518
|
+
|
|
519
|
+
// src/BiampTable/BiampTableStatusMessage.tsx
|
|
520
|
+
var import_material5 = require("@mui/material");
|
|
521
|
+
var import_react = require("react");
|
|
522
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
523
|
+
function BiampTableStatusMessage({
|
|
524
|
+
icon,
|
|
525
|
+
title,
|
|
526
|
+
description,
|
|
527
|
+
children,
|
|
528
|
+
...stackProps
|
|
529
|
+
}) {
|
|
530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Stack, { alignItems: "center", gap: 2, ...stackProps, children: [
|
|
531
|
+
(0, import_react.cloneElement)(icon, {
|
|
532
|
+
"aria-hidden": true,
|
|
533
|
+
sx: { width: 56, height: 56, ...icon.props.sx }
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.Typography, { variant: "h2", children: title }),
|
|
536
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material5.Typography, { variant: "body1", children: description }),
|
|
537
|
+
children
|
|
538
|
+
] });
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// src/BiampTable/BiampTableEmptyState.tsx
|
|
542
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
543
|
+
function BiampTableEmptyState({
|
|
544
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_assets3.NoResultsIcon, {}),
|
|
545
|
+
title = "Nothing to show",
|
|
546
|
+
...rest
|
|
547
|
+
}) {
|
|
548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
549
|
+
BiampTableStatusMessage,
|
|
550
|
+
{
|
|
551
|
+
role: "status",
|
|
552
|
+
icon,
|
|
553
|
+
title,
|
|
554
|
+
...rest
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// src/BiampTable/BiampTableErrorState.tsx
|
|
560
|
+
var import_assets4 = require("@bwp-web/assets");
|
|
561
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
562
|
+
function BiampTableErrorState({
|
|
563
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_assets4.ServiceNotReachableIcon, {}),
|
|
564
|
+
title = "Failed to load",
|
|
565
|
+
...rest
|
|
566
|
+
}) {
|
|
567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BiampTableStatusMessage, { role: "alert", icon, title, ...rest });
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// src/BiampTable/useLoadingDelay.ts
|
|
571
|
+
var import_react2 = require("react");
|
|
572
|
+
function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
|
|
573
|
+
const [status, setStatus] = (0, import_react2.useState)("idle");
|
|
574
|
+
const timeoutRef = (0, import_react2.useRef)(null);
|
|
575
|
+
function clearPending() {
|
|
576
|
+
if (timeoutRef.current !== null) {
|
|
577
|
+
clearTimeout(timeoutRef.current);
|
|
578
|
+
timeoutRef.current = null;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
(0, import_react2.useEffect)(() => {
|
|
582
|
+
if (loading && status === "idle") {
|
|
583
|
+
clearPending();
|
|
584
|
+
timeoutRef.current = setTimeout(() => {
|
|
585
|
+
timeoutRef.current = setTimeout(() => {
|
|
586
|
+
setStatus("ending");
|
|
587
|
+
}, minDuration);
|
|
588
|
+
setStatus("loading");
|
|
589
|
+
}, delay);
|
|
590
|
+
setStatus("delaying");
|
|
591
|
+
}
|
|
592
|
+
if (!loading && status !== "loading") {
|
|
593
|
+
clearPending();
|
|
594
|
+
setStatus("idle");
|
|
595
|
+
}
|
|
596
|
+
}, [loading, delay, minDuration, status]);
|
|
597
|
+
(0, import_react2.useEffect)(() => clearPending, []);
|
|
598
|
+
return status === "loading" || status === "ending";
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// src/BiampTable/BiampTable.tsx
|
|
602
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
603
|
+
function BiampTable({
|
|
604
|
+
table,
|
|
605
|
+
onRowClick,
|
|
606
|
+
isRowClickable,
|
|
607
|
+
loading,
|
|
608
|
+
error,
|
|
609
|
+
empty,
|
|
610
|
+
hideSelectAll,
|
|
611
|
+
getRowLabel,
|
|
612
|
+
sx,
|
|
613
|
+
...boxProps
|
|
614
|
+
}) {
|
|
615
|
+
const enableRowSelection = table.options.enableRowSelection === true || typeof table.options.enableRowSelection === "function";
|
|
616
|
+
const tableMinWidth = table.getVisibleLeafColumns().reduce(
|
|
617
|
+
(sum, col) => {
|
|
618
|
+
const mw = col.columnDef.meta?.minWidth;
|
|
619
|
+
return sum + (typeof mw === "number" ? mw : 40);
|
|
620
|
+
},
|
|
621
|
+
enableRowSelection ? 48 : 0
|
|
622
|
+
);
|
|
623
|
+
const totalColumns = table.getVisibleLeafColumns().length + (enableRowSelection ? 1 : 0);
|
|
624
|
+
const showLoading = useLoadingDelay(!!loading);
|
|
625
|
+
const rows = table.getRowModel().rows;
|
|
626
|
+
const showError = !!error;
|
|
627
|
+
const showEmpty = !showError && rows.length === 0;
|
|
628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
629
|
+
import_material6.TableContainer,
|
|
630
|
+
{
|
|
631
|
+
component: import_material6.Box,
|
|
632
|
+
...boxProps,
|
|
633
|
+
sx: {
|
|
634
|
+
display: "flex",
|
|
635
|
+
flexDirection: "column",
|
|
636
|
+
height: "100%",
|
|
637
|
+
overflow: "auto",
|
|
638
|
+
overscrollBehavior: "none",
|
|
639
|
+
...sx
|
|
640
|
+
},
|
|
641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
642
|
+
import_material6.Table,
|
|
643
|
+
{
|
|
644
|
+
"aria-busy": showLoading || void 0,
|
|
645
|
+
sx: {
|
|
646
|
+
minWidth: tableMinWidth,
|
|
647
|
+
height: showError || showEmpty ? "100%" : void 0
|
|
648
|
+
},
|
|
649
|
+
children: [
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.TableRow, { children: [
|
|
651
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
652
|
+
import_material6.TableCell,
|
|
653
|
+
{
|
|
654
|
+
padding: "checkbox",
|
|
655
|
+
sx: {
|
|
656
|
+
position: "sticky",
|
|
657
|
+
left: 0,
|
|
658
|
+
zIndex: 3,
|
|
659
|
+
bgcolor: "background.paper"
|
|
660
|
+
},
|
|
661
|
+
children: !hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
662
|
+
import_material6.Checkbox,
|
|
663
|
+
{
|
|
664
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
665
|
+
indeterminate: table.getIsSomePageRowsSelected(),
|
|
666
|
+
onChange: table.getToggleAllPageRowsSelectedHandler(),
|
|
667
|
+
slotProps: { input: { "aria-label": "Select all rows" } }
|
|
668
|
+
}
|
|
669
|
+
)
|
|
670
|
+
}
|
|
671
|
+
),
|
|
672
|
+
headerGroup.headers.map((header) => {
|
|
673
|
+
const sticky = header.column.columnDef.meta?.sticky;
|
|
674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
675
|
+
import_material6.TableCell,
|
|
676
|
+
{
|
|
677
|
+
sortDirection: header.column.getIsSorted() || false,
|
|
678
|
+
...header.column.getCanSort() && {
|
|
679
|
+
"aria-sort": header.column.getIsSorted() ? header.column.getIsSorted() === "asc" ? "ascending" : "descending" : "none"
|
|
680
|
+
},
|
|
681
|
+
sx: {
|
|
682
|
+
minWidth: header.column.columnDef.meta?.minWidth ?? 40,
|
|
683
|
+
...sticky && {
|
|
684
|
+
position: "sticky",
|
|
685
|
+
[sticky]: 0,
|
|
686
|
+
zIndex: 3,
|
|
687
|
+
bgcolor: "background.paper"
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
691
|
+
import_material6.TableSortLabel,
|
|
692
|
+
{
|
|
693
|
+
active: !!header.column.getIsSorted(),
|
|
694
|
+
direction: header.column.getIsSorted() || "asc",
|
|
695
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
696
|
+
...header.column.getIsSorted() && {
|
|
697
|
+
IconComponent: header.column.getIsSorted() === "asc" ? import_assets5.DropdownChevronUpIcon : import_assets5.DropdownChevronDownIcon
|
|
698
|
+
},
|
|
699
|
+
children: (0, import_react_table.flexRender)(
|
|
700
|
+
header.column.columnDef.header,
|
|
701
|
+
header.getContext()
|
|
702
|
+
)
|
|
703
|
+
}
|
|
704
|
+
) : (0, import_react_table.flexRender)(
|
|
705
|
+
header.column.columnDef.header,
|
|
706
|
+
header.getContext()
|
|
707
|
+
)
|
|
708
|
+
},
|
|
709
|
+
header.id
|
|
710
|
+
);
|
|
711
|
+
})
|
|
712
|
+
] }, headerGroup.id)) }),
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableBody, { sx: { opacity: showLoading ? 0.3 : 1 }, children: showError ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
714
|
+
import_material6.TableCell,
|
|
715
|
+
{
|
|
716
|
+
colSpan: totalColumns,
|
|
717
|
+
sx: {
|
|
718
|
+
textAlign: "center",
|
|
719
|
+
verticalAlign: "middle",
|
|
720
|
+
height: "100%"
|
|
721
|
+
},
|
|
722
|
+
children: error === true ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableErrorState, {}) : error
|
|
723
|
+
}
|
|
724
|
+
) }) : showEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
725
|
+
import_material6.TableCell,
|
|
726
|
+
{
|
|
727
|
+
colSpan: totalColumns,
|
|
728
|
+
sx: {
|
|
729
|
+
textAlign: "center",
|
|
730
|
+
verticalAlign: "middle",
|
|
731
|
+
height: "100%"
|
|
732
|
+
},
|
|
733
|
+
children: empty && empty !== true ? empty : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BiampTableEmptyState, {})
|
|
734
|
+
}
|
|
735
|
+
) }) : rows.map((row) => {
|
|
736
|
+
const clickable = onRowClick ? isRowClickable ? isRowClickable(row.original) : true : false;
|
|
737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
738
|
+
import_material6.TableRow,
|
|
739
|
+
{
|
|
740
|
+
hover: clickable,
|
|
741
|
+
selected: enableRowSelection ? row.getIsSelected() : void 0,
|
|
742
|
+
role: clickable ? "button" : void 0,
|
|
743
|
+
tabIndex: clickable ? 0 : void 0,
|
|
744
|
+
sx: { cursor: clickable ? "pointer" : void 0 },
|
|
745
|
+
onClick: clickable && onRowClick ? () => onRowClick(row.original) : void 0,
|
|
746
|
+
onKeyDown: clickable && onRowClick ? (e) => {
|
|
747
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
748
|
+
e.preventDefault();
|
|
749
|
+
onRowClick(row.original);
|
|
750
|
+
}
|
|
751
|
+
} : void 0,
|
|
752
|
+
children: [
|
|
753
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
754
|
+
import_material6.TableCell,
|
|
755
|
+
{
|
|
756
|
+
padding: "checkbox",
|
|
757
|
+
sx: {
|
|
758
|
+
position: "sticky",
|
|
759
|
+
left: 0,
|
|
760
|
+
zIndex: 2,
|
|
761
|
+
bgcolor: "background.paper",
|
|
762
|
+
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
763
|
+
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
767
|
+
import_material6.Checkbox,
|
|
768
|
+
{
|
|
769
|
+
checked: row.getIsSelected(),
|
|
770
|
+
disabled: !row.getCanSelect(),
|
|
771
|
+
onChange: row.getToggleSelectedHandler(),
|
|
772
|
+
onClick: (e) => e.stopPropagation(),
|
|
773
|
+
slotProps: {
|
|
774
|
+
input: {
|
|
775
|
+
"aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
)
|
|
780
|
+
}
|
|
781
|
+
),
|
|
782
|
+
row.getVisibleCells().map((cell) => {
|
|
783
|
+
const sticky = cell.column.columnDef.meta?.sticky;
|
|
784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
785
|
+
import_material6.TableCell,
|
|
786
|
+
{
|
|
787
|
+
sx: {
|
|
788
|
+
minWidth: cell.column.columnDef.meta?.minWidth ?? 40,
|
|
789
|
+
...sticky && {
|
|
790
|
+
position: "sticky",
|
|
791
|
+
[sticky]: 0,
|
|
792
|
+
zIndex: 2,
|
|
793
|
+
bgcolor: "background.paper",
|
|
794
|
+
".MuiTableRow-hover:hover > &, .Mui-selected > &": {
|
|
795
|
+
bgcolor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
children: (0, import_react_table.flexRender)(
|
|
800
|
+
cell.column.columnDef.cell,
|
|
801
|
+
cell.getContext()
|
|
802
|
+
)
|
|
803
|
+
},
|
|
804
|
+
cell.id
|
|
805
|
+
);
|
|
806
|
+
})
|
|
807
|
+
]
|
|
808
|
+
},
|
|
809
|
+
row.id
|
|
810
|
+
);
|
|
811
|
+
}) })
|
|
812
|
+
]
|
|
813
|
+
}
|
|
814
|
+
)
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// src/BiampTable/BiampTableContainer.tsx
|
|
820
|
+
var import_material7 = require("@mui/material");
|
|
821
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
822
|
+
function BiampTableContainer({
|
|
823
|
+
withBorderTop = true,
|
|
824
|
+
withBorderBottom = false,
|
|
825
|
+
children,
|
|
826
|
+
...props
|
|
827
|
+
}) {
|
|
828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
829
|
+
import_material7.Stack,
|
|
830
|
+
{
|
|
831
|
+
direction: "column",
|
|
832
|
+
height: "100%",
|
|
833
|
+
overflow: "hidden",
|
|
834
|
+
py: { xs: 0, md: 1.5 },
|
|
835
|
+
gap: { xs: 0, md: 1 },
|
|
836
|
+
borderTop: withBorderTop ? ({ palette }) => `0.6px solid ${palette.divider}` : void 0,
|
|
837
|
+
borderBottom: withBorderBottom ? ({ palette }) => `0.6px solid ${palette.divider}` : void 0,
|
|
838
|
+
...props,
|
|
839
|
+
children
|
|
840
|
+
}
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// src/BiampTable/BiampTableCellActionButton.tsx
|
|
845
|
+
var import_material8 = require("@mui/material");
|
|
846
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
847
|
+
function BiampTableCellActionButton({ label, icon, ...props }) {
|
|
848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
849
|
+
import_material8.Tooltip,
|
|
850
|
+
{
|
|
851
|
+
title: label,
|
|
852
|
+
placement: "top",
|
|
853
|
+
enterDelay: 500,
|
|
854
|
+
enterNextDelay: 500,
|
|
855
|
+
disableInteractive: true,
|
|
856
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material8.IconButton, { "aria-label": label, ...props, children: icon }) })
|
|
857
|
+
}
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// src/BiampTable/BiampTableColumnVisibility.tsx
|
|
862
|
+
var import_material9 = require("@mui/material");
|
|
863
|
+
var import_react3 = require("react");
|
|
864
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
865
|
+
function getColumnVisibilityDirtyCount(table, defaultVisibility = {}) {
|
|
866
|
+
const current = table.getState().columnVisibility;
|
|
867
|
+
let count = 0;
|
|
868
|
+
for (const col of table.getAllLeafColumns()) {
|
|
869
|
+
const isVisible = current[col.id] ?? true;
|
|
870
|
+
const wasVisible = defaultVisibility[col.id] ?? true;
|
|
871
|
+
if (isVisible !== wasVisible) count++;
|
|
872
|
+
}
|
|
873
|
+
return count;
|
|
874
|
+
}
|
|
875
|
+
var columnListItemSx = {
|
|
876
|
+
py: 0,
|
|
877
|
+
pr: 1.5,
|
|
878
|
+
pl: 0,
|
|
879
|
+
alignItems: "center",
|
|
880
|
+
cursor: "pointer",
|
|
881
|
+
"&:hover": {
|
|
882
|
+
backgroundColor: ({ palette }) => palette.mode === "dark" ? palette.grey[800] : palette.grey[100]
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
function BiampTableColumnVisibility({
|
|
886
|
+
table,
|
|
887
|
+
onChange,
|
|
888
|
+
showAllLabel = "Show all",
|
|
889
|
+
anchorEl,
|
|
890
|
+
anchorOrigin = { vertical: "bottom", horizontal: "right" },
|
|
891
|
+
transformOrigin = { vertical: "top", horizontal: "right" },
|
|
892
|
+
slotProps,
|
|
893
|
+
...popoverProps
|
|
894
|
+
}) {
|
|
895
|
+
const visibility = table.getState().columnVisibility;
|
|
896
|
+
const prevVisibilityRef = (0, import_react3.useRef)(visibility);
|
|
897
|
+
(0, import_react3.useEffect)(() => {
|
|
898
|
+
if (prevVisibilityRef.current === visibility) return;
|
|
899
|
+
prevVisibilityRef.current = visibility;
|
|
900
|
+
onChange?.(visibility);
|
|
901
|
+
}, [visibility, onChange]);
|
|
902
|
+
const allVisible = table.getAllLeafColumns().every((col) => col.getIsVisible());
|
|
903
|
+
const someVisible = table.getAllLeafColumns().some((col) => col.getIsVisible());
|
|
904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
905
|
+
import_material9.Popover,
|
|
906
|
+
{
|
|
907
|
+
anchorEl,
|
|
908
|
+
open: Boolean(anchorEl),
|
|
909
|
+
anchorOrigin,
|
|
910
|
+
transformOrigin,
|
|
911
|
+
slotProps: {
|
|
912
|
+
...slotProps,
|
|
913
|
+
paper: {
|
|
914
|
+
sx: ({ palette }) => ({
|
|
915
|
+
borderRadius: "6px",
|
|
916
|
+
backgroundImage: "none",
|
|
917
|
+
border: `0.6px solid ${palette.dividers.secondary}`,
|
|
918
|
+
boxShadow: `0px 1px 1px 0px ${(0, import_material9.alpha)(palette.common.black, 0.05)}`,
|
|
919
|
+
minWidth: "150px"
|
|
920
|
+
}),
|
|
921
|
+
...slotProps?.paper ?? {}
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
...popoverProps,
|
|
925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material9.List, { dense: true, disablePadding: true, children: [
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
927
|
+
import_material9.ListItem,
|
|
928
|
+
{
|
|
929
|
+
sx: columnListItemSx,
|
|
930
|
+
onClick: () => table.toggleAllColumnsVisible(!allVisible),
|
|
931
|
+
children: [
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
933
|
+
import_material9.Checkbox,
|
|
934
|
+
{
|
|
935
|
+
checked: allVisible,
|
|
936
|
+
indeterminate: !allVisible && someVisible,
|
|
937
|
+
size: "small",
|
|
938
|
+
slotProps: { input: { "aria-label": `${showAllLabel} columns` } }
|
|
939
|
+
}
|
|
940
|
+
),
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material9.Typography, { variant: "caption", children: showAllLabel })
|
|
942
|
+
]
|
|
943
|
+
}
|
|
944
|
+
),
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material9.Divider, {}),
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material9.Box, { sx: { maxHeight: 340, overflow: "auto" }, children: table.getAllLeafColumns().map((column) => {
|
|
947
|
+
const columnName = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
949
|
+
import_material9.ListItem,
|
|
950
|
+
{
|
|
951
|
+
sx: columnListItemSx,
|
|
952
|
+
onClick: column.getToggleVisibilityHandler(),
|
|
953
|
+
children: [
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
955
|
+
import_material9.Checkbox,
|
|
956
|
+
{
|
|
957
|
+
checked: column.getIsVisible(),
|
|
958
|
+
size: "small",
|
|
959
|
+
slotProps: {
|
|
960
|
+
input: { "aria-label": `Show ${columnName}` }
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
),
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material9.Typography, { variant: "caption", children: columnName })
|
|
965
|
+
]
|
|
966
|
+
},
|
|
967
|
+
column.id
|
|
968
|
+
);
|
|
969
|
+
}) })
|
|
970
|
+
] })
|
|
971
|
+
}
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// src/BiampTable/BiampTablePagination.tsx
|
|
976
|
+
var import_react4 = require("react");
|
|
977
|
+
var import_material10 = require("@mui/material");
|
|
978
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
979
|
+
function BiampTablePagination({
|
|
980
|
+
table,
|
|
981
|
+
rowsPerPageOptions,
|
|
982
|
+
loading,
|
|
983
|
+
autoHide = true,
|
|
984
|
+
...boxProps
|
|
985
|
+
}) {
|
|
986
|
+
const rowCount = table.getRowCount();
|
|
987
|
+
const lastRowCountRef = (0, import_react4.useRef)(rowCount);
|
|
988
|
+
if (!loading && rowCount >= 0) {
|
|
989
|
+
lastRowCountRef.current = rowCount;
|
|
990
|
+
}
|
|
991
|
+
const stableCount = loading ? lastRowCountRef.current : rowCount;
|
|
992
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
993
|
+
if (autoHide && !loading && stableCount <= pageSize) return null;
|
|
994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material10.Box, { ...boxProps, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
995
|
+
import_material10.TablePagination,
|
|
996
|
+
{
|
|
997
|
+
component: "div",
|
|
998
|
+
count: stableCount,
|
|
999
|
+
page: table.getState().pagination.pageIndex,
|
|
1000
|
+
rowsPerPage: table.getState().pagination.pageSize,
|
|
1001
|
+
onPageChange: (_, page) => table.setPageIndex(page),
|
|
1002
|
+
onRowsPerPageChange: (e) => {
|
|
1003
|
+
table.setPageSize(Number(e.target.value));
|
|
1004
|
+
table.setPageIndex(0);
|
|
1005
|
+
},
|
|
1006
|
+
rowsPerPageOptions: rowsPerPageOptions ?? [],
|
|
1007
|
+
showFirstButton: true,
|
|
1008
|
+
showLastButton: true
|
|
1009
|
+
}
|
|
1010
|
+
) });
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
// src/BiampTable/BiampTableToolbar.tsx
|
|
1014
|
+
var import_material11 = require("@mui/material");
|
|
1015
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1016
|
+
function BiampTableToolbar({
|
|
1017
|
+
children,
|
|
1018
|
+
...props
|
|
1019
|
+
}) {
|
|
1020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1021
|
+
import_material11.Box,
|
|
1022
|
+
{
|
|
1023
|
+
role: "toolbar",
|
|
1024
|
+
display: "flex",
|
|
1025
|
+
justifyContent: "space-between",
|
|
1026
|
+
alignItems: "center",
|
|
1027
|
+
gap: 1,
|
|
1028
|
+
...props,
|
|
1029
|
+
children
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// src/BiampTable/BiampTableToolbarActionButton.tsx
|
|
1035
|
+
var import_material12 = require("@mui/material");
|
|
1036
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1037
|
+
function BiampTableToolbarActionButton({
|
|
1038
|
+
label,
|
|
1039
|
+
icon,
|
|
1040
|
+
badgeContent,
|
|
1041
|
+
...props
|
|
1042
|
+
}) {
|
|
1043
|
+
const showBadge = badgeContent != null && badgeContent !== 0;
|
|
1044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1045
|
+
import_material12.IconButton,
|
|
1046
|
+
{
|
|
1047
|
+
"aria-label": showBadge ? `${label} (${badgeContent})` : label,
|
|
1048
|
+
...props,
|
|
1049
|
+
children: showBadge ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1050
|
+
import_material12.Badge,
|
|
1051
|
+
{
|
|
1052
|
+
badgeContent,
|
|
1053
|
+
color: "info",
|
|
1054
|
+
variant: "dot",
|
|
1055
|
+
sx: {
|
|
1056
|
+
"& .MuiBadge-badge": {
|
|
1057
|
+
width: 6,
|
|
1058
|
+
height: 6,
|
|
1059
|
+
minWidth: 6,
|
|
1060
|
+
borderRadius: "50%",
|
|
1061
|
+
top: 0,
|
|
1062
|
+
right: -3
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
children: icon
|
|
1066
|
+
}
|
|
1067
|
+
) : icon
|
|
1068
|
+
}
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// src/BiampTable/BiampTableToolbarActions.tsx
|
|
1073
|
+
var import_material13 = require("@mui/material");
|
|
1074
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1075
|
+
function BiampTableToolbarActions({
|
|
1076
|
+
children,
|
|
1077
|
+
...props
|
|
1078
|
+
}) {
|
|
1079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Box, { display: "flex", alignItems: "center", gap: 1, ml: "auto", ...props, children });
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// src/BiampTable/BiampTableToolbarExport.tsx
|
|
1083
|
+
var import_material14 = require("@mui/material");
|
|
1084
|
+
var import_assets6 = require("@bwp-web/assets");
|
|
1085
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1086
|
+
function BiampTableToolbarExport({
|
|
1087
|
+
onExport,
|
|
1088
|
+
loading,
|
|
1089
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_assets6.DownloadIcon, { variant: "xs" }),
|
|
1090
|
+
label = "Export",
|
|
1091
|
+
...props
|
|
1092
|
+
}) {
|
|
1093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1094
|
+
BiampTableToolbarActionButton,
|
|
1095
|
+
{
|
|
1096
|
+
label: loading ? `${label}, loading` : label,
|
|
1097
|
+
icon: loading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.CircularProgress, { size: 20, color: "inherit" }) : icon,
|
|
1098
|
+
disabled: loading,
|
|
1099
|
+
onClick: onExport,
|
|
1100
|
+
...props
|
|
1101
|
+
}
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
// src/BiampTable/BiampTableToolbarFilters.tsx
|
|
1106
|
+
var import_material15 = require("@mui/material");
|
|
1107
|
+
var import_assets7 = require("@bwp-web/assets");
|
|
1108
|
+
var import_react5 = require("react");
|
|
1109
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1110
|
+
function BiampTableToolbarFilters({
|
|
1111
|
+
activeFilterCount,
|
|
1112
|
+
children,
|
|
1113
|
+
onReset,
|
|
1114
|
+
onApply,
|
|
1115
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_assets7.FilterIcon, { variant: "xs" }),
|
|
1116
|
+
title = "Filters",
|
|
1117
|
+
resetLabel = "Clear filters",
|
|
1118
|
+
applyLabel = "Apply",
|
|
1119
|
+
closeLabel = "Close",
|
|
1120
|
+
buttonLabel = "Filters",
|
|
1121
|
+
DrawerProps: drawerProps
|
|
1122
|
+
}) {
|
|
1123
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
1124
|
+
const titleId = (0, import_react5.useId)();
|
|
1125
|
+
function handleClose() {
|
|
1126
|
+
onApply?.();
|
|
1127
|
+
setOpen(false);
|
|
1128
|
+
}
|
|
1129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1131
|
+
BiampTableToolbarActionButton,
|
|
1132
|
+
{
|
|
1133
|
+
label: buttonLabel,
|
|
1134
|
+
icon,
|
|
1135
|
+
badgeContent: activeFilterCount,
|
|
1136
|
+
onClick: () => setOpen(true)
|
|
1137
|
+
}
|
|
1138
|
+
),
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1140
|
+
import_material15.Drawer,
|
|
1141
|
+
{
|
|
1142
|
+
anchor: "right",
|
|
1143
|
+
open,
|
|
1144
|
+
onClose: handleClose,
|
|
1145
|
+
"aria-labelledby": titleId,
|
|
1146
|
+
...drawerProps,
|
|
1147
|
+
PaperProps: {
|
|
1148
|
+
sx: { width: { xs: "100%", sm: 480 } },
|
|
1149
|
+
...drawerProps?.PaperProps
|
|
1150
|
+
},
|
|
1151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1152
|
+
import_material15.Box,
|
|
1153
|
+
{
|
|
1154
|
+
height: "100%",
|
|
1155
|
+
display: "flex",
|
|
1156
|
+
flexDirection: "column",
|
|
1157
|
+
justifyContent: "space-between",
|
|
1158
|
+
children: [
|
|
1159
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { children: [
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1161
|
+
import_material15.Box,
|
|
1162
|
+
{
|
|
1163
|
+
display: "flex",
|
|
1164
|
+
justifyContent: "space-between",
|
|
1165
|
+
alignItems: "center",
|
|
1166
|
+
px: 3.5,
|
|
1167
|
+
py: 2.5,
|
|
1168
|
+
children: [
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Typography, { id: titleId, variant: "h2", children: [
|
|
1170
|
+
title,
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1172
|
+
import_material15.Badge,
|
|
1173
|
+
{
|
|
1174
|
+
badgeContent: activeFilterCount,
|
|
1175
|
+
color: "secondary",
|
|
1176
|
+
sx: { ml: 1.5, mb: 0.5 }
|
|
1177
|
+
}
|
|
1178
|
+
)
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1181
|
+
import_material15.IconButton,
|
|
1182
|
+
{
|
|
1183
|
+
size: "medium",
|
|
1184
|
+
onClick: handleClose,
|
|
1185
|
+
"aria-label": closeLabel,
|
|
1186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_assets7.CloseIcon, {})
|
|
1187
|
+
}
|
|
1188
|
+
)
|
|
1189
|
+
]
|
|
1190
|
+
}
|
|
1191
|
+
),
|
|
1192
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material15.Divider, {}),
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1194
|
+
import_material15.Box,
|
|
1195
|
+
{
|
|
1196
|
+
role: "group",
|
|
1197
|
+
"aria-label": "Filter options",
|
|
1198
|
+
display: "flex",
|
|
1199
|
+
flexDirection: "column",
|
|
1200
|
+
gap: 2,
|
|
1201
|
+
p: 3.5,
|
|
1202
|
+
overflow: "auto",
|
|
1203
|
+
children
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
] }),
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material15.Box, { display: "flex", children: [
|
|
1208
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1209
|
+
import_material15.Button,
|
|
1210
|
+
{
|
|
1211
|
+
variant: "overlay",
|
|
1212
|
+
color: "secondary",
|
|
1213
|
+
fullWidth: true,
|
|
1214
|
+
onClick: onReset,
|
|
1215
|
+
disabled: activeFilterCount === 0,
|
|
1216
|
+
children: resetLabel
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1220
|
+
import_material15.Button,
|
|
1221
|
+
{
|
|
1222
|
+
variant: "overlay",
|
|
1223
|
+
color: "primary",
|
|
1224
|
+
fullWidth: true,
|
|
1225
|
+
onClick: handleClose,
|
|
1226
|
+
children: applyLabel
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1229
|
+
] })
|
|
1230
|
+
]
|
|
1231
|
+
}
|
|
1232
|
+
)
|
|
1233
|
+
}
|
|
1234
|
+
)
|
|
1235
|
+
] });
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// src/BiampTable/BiampTableToolbarSearch.tsx
|
|
1239
|
+
var import_material16 = require("@mui/material");
|
|
1240
|
+
var import_assets8 = require("@bwp-web/assets");
|
|
1241
|
+
var import_react7 = require("react");
|
|
1242
|
+
|
|
1243
|
+
// src/BiampTable/useDebouncedCallback.ts
|
|
1244
|
+
var import_react6 = require("react");
|
|
1245
|
+
var BIAMP_TABLE_DEBOUNCE_DELAY = 300;
|
|
1246
|
+
function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
1247
|
+
const timeoutRef = (0, import_react6.useRef)(null);
|
|
1248
|
+
const callbackRef = (0, import_react6.useRef)(callback);
|
|
1249
|
+
callbackRef.current = callback;
|
|
1250
|
+
(0, import_react6.useEffect)(() => {
|
|
1251
|
+
return () => {
|
|
1252
|
+
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
1253
|
+
};
|
|
1254
|
+
}, []);
|
|
1255
|
+
return (0, import_react6.useCallback)(
|
|
1256
|
+
(...args) => {
|
|
1257
|
+
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
1258
|
+
timeoutRef.current = setTimeout(
|
|
1259
|
+
() => callbackRef.current(...args),
|
|
1260
|
+
delay
|
|
1261
|
+
);
|
|
1262
|
+
},
|
|
1263
|
+
[delay]
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
// src/BiampTable/BiampTableToolbarSearch.tsx
|
|
1268
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1269
|
+
var searchFieldSx = {
|
|
1270
|
+
"& .MuiInputBase-root": {
|
|
1271
|
+
height: 36,
|
|
1272
|
+
minHeight: 36
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
function BiampTableToolbarSearch({
|
|
1276
|
+
onChange,
|
|
1277
|
+
defaultValue = "",
|
|
1278
|
+
debounceDelay = BIAMP_TABLE_DEBOUNCE_DELAY,
|
|
1279
|
+
maxLength = 120,
|
|
1280
|
+
maxWidth = 280,
|
|
1281
|
+
placeholder = "Search",
|
|
1282
|
+
clearLabel = "Clear search",
|
|
1283
|
+
sx,
|
|
1284
|
+
...textFieldProps
|
|
1285
|
+
}) {
|
|
1286
|
+
const [inputValue, setInputValue] = (0, import_react7.useState)(defaultValue);
|
|
1287
|
+
const debouncedOnChange = useDebouncedCallback(onChange, debounceDelay);
|
|
1288
|
+
(0, import_react7.useEffect)(() => {
|
|
1289
|
+
setInputValue(defaultValue);
|
|
1290
|
+
}, [defaultValue]);
|
|
1291
|
+
const handleChange = (e) => {
|
|
1292
|
+
setInputValue(e.target.value);
|
|
1293
|
+
debouncedOnChange(e.target.value);
|
|
1294
|
+
};
|
|
1295
|
+
const handleClear = () => {
|
|
1296
|
+
setInputValue("");
|
|
1297
|
+
debouncedOnChange("");
|
|
1298
|
+
};
|
|
1299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1300
|
+
import_material16.TextField,
|
|
1301
|
+
{
|
|
1302
|
+
name: "search",
|
|
1303
|
+
type: "text",
|
|
1304
|
+
placeholder,
|
|
1305
|
+
slotProps: {
|
|
1306
|
+
htmlInput: { maxLength, "aria-label": placeholder },
|
|
1307
|
+
input: {
|
|
1308
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material16.InputAdornment, { position: "start", sx: { ml: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1309
|
+
import_assets8.SearchIcon,
|
|
1310
|
+
{
|
|
1311
|
+
variant: "xs",
|
|
1312
|
+
color: "inherit",
|
|
1313
|
+
sx: { width: 16, height: 16 }
|
|
1314
|
+
}
|
|
1315
|
+
) }),
|
|
1316
|
+
endAdornment: inputValue ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material16.InputAdornment, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1317
|
+
import_material16.IconButton,
|
|
1318
|
+
{
|
|
1319
|
+
size: "small",
|
|
1320
|
+
onClick: handleClear,
|
|
1321
|
+
"aria-label": clearLabel,
|
|
1322
|
+
sx: { mr: 0.5 },
|
|
1323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_assets8.CloseIcon, { variant: "xs", sx: { width: 20, height: 20 } })
|
|
1324
|
+
}
|
|
1325
|
+
) }) : null
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
fullWidth: true,
|
|
1329
|
+
sx: [
|
|
1330
|
+
searchFieldSx,
|
|
1331
|
+
{ maxWidth },
|
|
1332
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
1333
|
+
],
|
|
1334
|
+
variant: "outlined",
|
|
1335
|
+
value: inputValue,
|
|
1336
|
+
onChange: handleChange,
|
|
1337
|
+
...textFieldProps
|
|
1338
|
+
}
|
|
1339
|
+
);
|
|
1340
|
+
}
|
|
493
1341
|
// Annotate the CommonJS export names for ESM import in node:
|
|
494
1342
|
0 && (module.exports = {
|
|
1343
|
+
BIAMP_TABLE_DEBOUNCE_DELAY,
|
|
495
1344
|
BiampAppDialog,
|
|
496
1345
|
BiampAppDialogItem,
|
|
497
1346
|
BiampAppPopover,
|
|
@@ -507,6 +1356,22 @@ function BiampLayout({
|
|
|
507
1356
|
BiampSidebarComponent,
|
|
508
1357
|
BiampSidebarIcon,
|
|
509
1358
|
BiampSidebarIconList,
|
|
510
|
-
|
|
1359
|
+
BiampTable,
|
|
1360
|
+
BiampTableCellActionButton,
|
|
1361
|
+
BiampTableColumnVisibility,
|
|
1362
|
+
BiampTableContainer,
|
|
1363
|
+
BiampTableEmptyState,
|
|
1364
|
+
BiampTableErrorState,
|
|
1365
|
+
BiampTablePagination,
|
|
1366
|
+
BiampTableStatusMessage,
|
|
1367
|
+
BiampTableToolbar,
|
|
1368
|
+
BiampTableToolbarActionButton,
|
|
1369
|
+
BiampTableToolbarActions,
|
|
1370
|
+
BiampTableToolbarExport,
|
|
1371
|
+
BiampTableToolbarFilters,
|
|
1372
|
+
BiampTableToolbarSearch,
|
|
1373
|
+
BiampWrapper,
|
|
1374
|
+
getColumnVisibilityDirtyCount,
|
|
1375
|
+
useDebouncedCallback
|
|
511
1376
|
});
|
|
512
1377
|
//# sourceMappingURL=index.cjs.map
|