@bwp-web/components 1.3.2 → 1.4.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/README.md +52 -39
- package/dist/BiampHeader/BiampHeader.d.ts.map +1 -1
- package/dist/BiampSidebar/BiampSidebar.d.ts +8 -2
- package/dist/BiampSidebar/BiampSidebar.d.ts.map +1 -1
- package/dist/index.cjs +200 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +198 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -492,34 +492,134 @@ function BiampWrapper({ children, sx, ...props }) {
|
|
|
492
492
|
// src/BiampSidebar/BiampSidebar.tsx
|
|
493
493
|
var import_material2 = require("@mui/material");
|
|
494
494
|
var import_assets = require("@bwp-web/assets");
|
|
495
|
+
var import_react = require("react");
|
|
495
496
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
497
|
+
var BiampSidebarContext = (0, import_react.createContext)({
|
|
498
|
+
expanded: false
|
|
499
|
+
});
|
|
496
500
|
function BiampSidebar({
|
|
497
501
|
children,
|
|
498
502
|
bottomLogoIcon,
|
|
503
|
+
bottomLogoText,
|
|
504
|
+
expandable = true,
|
|
505
|
+
expanded: expandedProp,
|
|
506
|
+
defaultExpanded = false,
|
|
507
|
+
onExpandedChange,
|
|
499
508
|
sx,
|
|
500
509
|
...props
|
|
501
510
|
}) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
511
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react.useState)(defaultExpanded);
|
|
512
|
+
const isControlled = expandedProp !== void 0;
|
|
513
|
+
const expanded = isControlled ? expandedProp : internalExpanded;
|
|
514
|
+
const toggleExpanded = () => {
|
|
515
|
+
const next = !expanded;
|
|
516
|
+
if (!isControlled) setInternalExpanded(next);
|
|
517
|
+
onExpandedChange?.(next);
|
|
518
|
+
};
|
|
519
|
+
const width = expanded ? "240px" : "48px";
|
|
520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BiampSidebarContext.Provider, { value: { expanded }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
521
|
+
import_material2.Stack,
|
|
522
|
+
{
|
|
523
|
+
sx: {
|
|
524
|
+
width,
|
|
525
|
+
minWidth: width,
|
|
526
|
+
height: "100%",
|
|
527
|
+
overflowX: "hidden",
|
|
528
|
+
transition: ({ transitions }) => transitions.create(["width", "min-width"], {
|
|
529
|
+
easing: transitions.easing.sharp,
|
|
530
|
+
duration: expanded ? transitions.duration.enteringScreen : transitions.duration.leavingScreen
|
|
531
|
+
}),
|
|
532
|
+
...sx
|
|
533
|
+
},
|
|
534
|
+
...props,
|
|
535
|
+
children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Stack, { sx: { flex: 1, minHeight: 0 }, children }),
|
|
537
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
538
|
+
BiampSidebarIcon,
|
|
539
|
+
{
|
|
540
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
541
|
+
import_assets.SquareRoundedArrowRightIcon,
|
|
542
|
+
{
|
|
543
|
+
sx: {
|
|
544
|
+
transform: expanded ? "rotate(180deg)" : "none",
|
|
545
|
+
transition: ({ transitions }) => transitions.create("transform", {
|
|
546
|
+
duration: transitions.duration.shorter
|
|
547
|
+
})
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
),
|
|
551
|
+
name: "Collapse menu",
|
|
552
|
+
onClick: toggleExpanded
|
|
553
|
+
}
|
|
554
|
+
),
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
556
|
+
import_material2.Stack,
|
|
557
|
+
{
|
|
558
|
+
direction: "row",
|
|
559
|
+
alignItems: "center",
|
|
560
|
+
justifyContent: "space-between",
|
|
561
|
+
sx: { mt: 2, overflow: "hidden" },
|
|
562
|
+
children: [
|
|
563
|
+
bottomLogoIcon ?? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
564
|
+
import_assets.BiampLogoIcon,
|
|
565
|
+
{
|
|
566
|
+
sx: { width: "48px", height: "15px", flexShrink: 0 }
|
|
567
|
+
}
|
|
568
|
+
),
|
|
569
|
+
bottomLogoText && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
570
|
+
import_material2.Typography,
|
|
571
|
+
{
|
|
572
|
+
variant: "caption",
|
|
573
|
+
fontWeight: 500,
|
|
574
|
+
color: "sidebar.main",
|
|
575
|
+
noWrap: true,
|
|
576
|
+
sx: {
|
|
577
|
+
opacity: expanded ? 1 : 0,
|
|
578
|
+
transition: ({ transitions }) => transitions.create("opacity", {
|
|
579
|
+
duration: expanded ? transitions.duration.enteringScreen : transitions.duration.leavingScreen
|
|
580
|
+
})
|
|
581
|
+
},
|
|
582
|
+
children: `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} ${bottomLogoText}`
|
|
583
|
+
}
|
|
584
|
+
)
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
)
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
) });
|
|
506
591
|
}
|
|
507
592
|
function BiampSidebarIconList({
|
|
508
593
|
children,
|
|
509
594
|
sx,
|
|
510
595
|
...props
|
|
511
596
|
}) {
|
|
512
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
598
|
+
import_material2.Stack,
|
|
599
|
+
{
|
|
600
|
+
sx: {
|
|
601
|
+
flex: 1,
|
|
602
|
+
minHeight: 0,
|
|
603
|
+
gap: "4px",
|
|
604
|
+
overflowY: "auto",
|
|
605
|
+
...sx
|
|
606
|
+
},
|
|
607
|
+
...props,
|
|
608
|
+
children
|
|
609
|
+
}
|
|
610
|
+
);
|
|
513
611
|
}
|
|
514
612
|
function BiampSidebarIcon({
|
|
515
613
|
selected,
|
|
516
614
|
icon,
|
|
517
615
|
selectedIcon,
|
|
616
|
+
name,
|
|
518
617
|
sx,
|
|
519
618
|
...props
|
|
520
619
|
}) {
|
|
620
|
+
const { expanded } = (0, import_react.useContext)(BiampSidebarContext);
|
|
521
621
|
const displayedSelectedIcon = selectedIcon ?? icon;
|
|
522
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
523
623
|
import_material2.ListItemButton,
|
|
524
624
|
{
|
|
525
625
|
selected,
|
|
@@ -527,16 +627,50 @@ function BiampSidebarIcon({
|
|
|
527
627
|
disableRipple: true,
|
|
528
628
|
sx: {
|
|
529
629
|
minWidth: "48px",
|
|
530
|
-
maxWidth: "48px",
|
|
531
630
|
minHeight: "48px",
|
|
532
631
|
maxHeight: "48px",
|
|
533
632
|
borderRadius: "8px",
|
|
534
|
-
justifyContent: "
|
|
633
|
+
justifyContent: "flex-start",
|
|
535
634
|
alignItems: "center",
|
|
635
|
+
padding: 0,
|
|
636
|
+
overflow: "hidden",
|
|
637
|
+
color: "text.secondary",
|
|
536
638
|
...sx
|
|
537
639
|
},
|
|
538
640
|
...props,
|
|
539
|
-
children:
|
|
641
|
+
children: [
|
|
642
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
643
|
+
import_material2.Box,
|
|
644
|
+
{
|
|
645
|
+
sx: {
|
|
646
|
+
width: "48px",
|
|
647
|
+
height: "48px",
|
|
648
|
+
display: "flex",
|
|
649
|
+
alignItems: "center",
|
|
650
|
+
justifyContent: "center",
|
|
651
|
+
flexShrink: 0
|
|
652
|
+
},
|
|
653
|
+
children: selected ? displayedSelectedIcon : icon
|
|
654
|
+
}
|
|
655
|
+
),
|
|
656
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
657
|
+
import_material2.Typography,
|
|
658
|
+
{
|
|
659
|
+
variant: "body1",
|
|
660
|
+
fontWeight: 600,
|
|
661
|
+
color: "inherit",
|
|
662
|
+
noWrap: true,
|
|
663
|
+
sx: {
|
|
664
|
+
pr: 2,
|
|
665
|
+
opacity: expanded ? 1 : 0,
|
|
666
|
+
transition: ({ transitions }) => transitions.create("opacity", {
|
|
667
|
+
duration: expanded ? transitions.duration.enteringScreen : transitions.duration.leavingScreen
|
|
668
|
+
})
|
|
669
|
+
},
|
|
670
|
+
children: name
|
|
671
|
+
}
|
|
672
|
+
)
|
|
673
|
+
]
|
|
540
674
|
}
|
|
541
675
|
);
|
|
542
676
|
}
|
|
@@ -568,6 +702,7 @@ function BiampSidebarComponent({
|
|
|
568
702
|
|
|
569
703
|
// src/BiampHeader/BiampHeader.tsx
|
|
570
704
|
var import_material3 = require("@mui/material");
|
|
705
|
+
var import_react2 = require("react");
|
|
571
706
|
var import_assets2 = require("@bwp-web/assets");
|
|
572
707
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
573
708
|
function BiampHeader({ children, sx, ...props }) {
|
|
@@ -810,12 +945,17 @@ function BiampEndUserAppContent({
|
|
|
810
945
|
sx,
|
|
811
946
|
...props
|
|
812
947
|
}) {
|
|
948
|
+
const isGrid = import_react2.Children.count(children) > 1;
|
|
813
949
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
814
950
|
import_material3.Stack,
|
|
815
951
|
{
|
|
816
952
|
direction: "column",
|
|
817
953
|
sx: {
|
|
818
954
|
gap: 1.5,
|
|
955
|
+
...isGrid && {
|
|
956
|
+
display: "grid",
|
|
957
|
+
gridTemplateColumns: "1fr 1fr"
|
|
958
|
+
},
|
|
819
959
|
...sx
|
|
820
960
|
},
|
|
821
961
|
...props,
|
|
@@ -953,14 +1093,14 @@ function BiampLayout({
|
|
|
953
1093
|
var import_material9 = require("@mui/material");
|
|
954
1094
|
var import_assets6 = require("@bwp-web/assets");
|
|
955
1095
|
var import_react_table2 = require("@tanstack/react-table");
|
|
956
|
-
var
|
|
1096
|
+
var import_react7 = require("react");
|
|
957
1097
|
|
|
958
1098
|
// src/BiampTable/BiampTableEmptyState.tsx
|
|
959
1099
|
var import_assets3 = require("@bwp-web/assets");
|
|
960
1100
|
|
|
961
1101
|
// src/BiampTable/BiampTableStatusMessage.tsx
|
|
962
1102
|
var import_material5 = require("@mui/material");
|
|
963
|
-
var
|
|
1103
|
+
var import_react3 = require("react");
|
|
964
1104
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
965
1105
|
function BiampTableStatusMessage({
|
|
966
1106
|
icon,
|
|
@@ -970,7 +1110,7 @@ function BiampTableStatusMessage({
|
|
|
970
1110
|
...stackProps
|
|
971
1111
|
}) {
|
|
972
1112
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material5.Stack, { alignItems: "center", gap: 1.5, ...stackProps, children: [
|
|
973
|
-
(0,
|
|
1113
|
+
(0, import_react3.cloneElement)(icon, {
|
|
974
1114
|
"aria-hidden": true,
|
|
975
1115
|
sx: { width: 56, height: 56, ...icon.props.sx }
|
|
976
1116
|
}),
|
|
@@ -1013,24 +1153,24 @@ function BiampTableErrorState({
|
|
|
1013
1153
|
var import_material8 = require("@mui/material");
|
|
1014
1154
|
var import_assets5 = require("@bwp-web/assets");
|
|
1015
1155
|
var import_react_table = require("@tanstack/react-table");
|
|
1016
|
-
var
|
|
1156
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
1017
1157
|
|
|
1018
1158
|
// src/BiampTable/BiampTableTruncatedCell.tsx
|
|
1019
1159
|
var import_material6 = require("@mui/material");
|
|
1020
|
-
var
|
|
1160
|
+
var import_react4 = require("react");
|
|
1021
1161
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1022
1162
|
function BiampTableTruncatedCell({
|
|
1023
1163
|
children
|
|
1024
1164
|
}) {
|
|
1025
|
-
const textRef = (0,
|
|
1026
|
-
const [open, setOpen] = (0,
|
|
1027
|
-
const handleMouseEnter = (0,
|
|
1165
|
+
const textRef = (0, import_react4.useRef)(null);
|
|
1166
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
1167
|
+
const handleMouseEnter = (0, import_react4.useCallback)(() => {
|
|
1028
1168
|
const el = textRef.current;
|
|
1029
1169
|
if (el && el.scrollWidth > el.clientWidth) {
|
|
1030
1170
|
setOpen(true);
|
|
1031
1171
|
}
|
|
1032
1172
|
}, []);
|
|
1033
|
-
const handleMouseLeave = (0,
|
|
1173
|
+
const handleMouseLeave = (0, import_react4.useCallback)(() => {
|
|
1034
1174
|
setOpen(false);
|
|
1035
1175
|
}, []);
|
|
1036
1176
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -1424,23 +1564,23 @@ function BiampTableRowInner({
|
|
|
1424
1564
|
function biampTableRowPropsAreEqual(prev, next) {
|
|
1425
1565
|
return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.alwaysExpanded === next.alwaysExpanded && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.showExpandGuidelines === next.showExpandGuidelines && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel && prev.customColor === next.customColor && prev.rowSlotProps === next.rowSlotProps && prev.cellSlotProps === next.cellSlotProps;
|
|
1426
1566
|
}
|
|
1427
|
-
var BiampTableRow =
|
|
1567
|
+
var BiampTableRow = import_react5.default.memo(
|
|
1428
1568
|
BiampTableRowInner,
|
|
1429
1569
|
biampTableRowPropsAreEqual
|
|
1430
1570
|
);
|
|
1431
1571
|
|
|
1432
1572
|
// src/BiampTable/useLoadingDelay.ts
|
|
1433
|
-
var
|
|
1573
|
+
var import_react6 = require("react");
|
|
1434
1574
|
function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
|
|
1435
|
-
const [status, setStatus] = (0,
|
|
1436
|
-
const timeoutRef = (0,
|
|
1575
|
+
const [status, setStatus] = (0, import_react6.useState)("idle");
|
|
1576
|
+
const timeoutRef = (0, import_react6.useRef)(null);
|
|
1437
1577
|
function clearPending() {
|
|
1438
1578
|
if (timeoutRef.current !== null) {
|
|
1439
1579
|
clearTimeout(timeoutRef.current);
|
|
1440
1580
|
timeoutRef.current = null;
|
|
1441
1581
|
}
|
|
1442
1582
|
}
|
|
1443
|
-
(0,
|
|
1583
|
+
(0, import_react6.useEffect)(() => {
|
|
1444
1584
|
if (loading && status === "idle") {
|
|
1445
1585
|
clearPending();
|
|
1446
1586
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -1456,7 +1596,7 @@ function useLoadingDelay(loading, { delay = 150, minDuration = 500 } = {}) {
|
|
|
1456
1596
|
setStatus("idle");
|
|
1457
1597
|
}
|
|
1458
1598
|
}, [loading, delay, minDuration, status]);
|
|
1459
|
-
(0,
|
|
1599
|
+
(0, import_react6.useEffect)(() => clearPending, []);
|
|
1460
1600
|
return status === "loading" || status === "ending";
|
|
1461
1601
|
}
|
|
1462
1602
|
|
|
@@ -1510,8 +1650,8 @@ function BiampTable({
|
|
|
1510
1650
|
},
|
|
1511
1651
|
enableRowSelection ? 48 : 0
|
|
1512
1652
|
);
|
|
1513
|
-
const containerRef = (0,
|
|
1514
|
-
(0,
|
|
1653
|
+
const containerRef = (0, import_react7.useRef)(null);
|
|
1654
|
+
(0, import_react7.useEffect)(() => {
|
|
1515
1655
|
if (enableExpanding && alwaysExpanded) {
|
|
1516
1656
|
table.toggleAllRowsExpanded(true);
|
|
1517
1657
|
}
|
|
@@ -1819,7 +1959,7 @@ function BiampTableColumnVisibility({
|
|
|
1819
1959
|
|
|
1820
1960
|
// src/BiampTable/BiampTableToolbarColumnVisibility.tsx
|
|
1821
1961
|
var import_assets7 = require("@bwp-web/assets");
|
|
1822
|
-
var
|
|
1962
|
+
var import_react8 = require("react");
|
|
1823
1963
|
|
|
1824
1964
|
// src/BiampTable/BiampTableToolbarActionButton.tsx
|
|
1825
1965
|
var import_material13 = require("@mui/material");
|
|
@@ -1869,7 +2009,7 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1869
2009
|
showAllLabel,
|
|
1870
2010
|
...actionButtonProps
|
|
1871
2011
|
}) {
|
|
1872
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
2012
|
+
const [anchorEl, setAnchorEl] = (0, import_react8.useState)(null);
|
|
1873
2013
|
const defaults = defaultColumnVisibility ?? getDefaultColumnVisibility(table);
|
|
1874
2014
|
const dirtyCount = getColumnVisibilityDirtyCount(table, defaults);
|
|
1875
2015
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
@@ -1896,7 +2036,7 @@ function BiampTableToolbarColumnVisibility({
|
|
|
1896
2036
|
}
|
|
1897
2037
|
|
|
1898
2038
|
// src/BiampTable/BiampTablePagination.tsx
|
|
1899
|
-
var
|
|
2039
|
+
var import_react9 = require("react");
|
|
1900
2040
|
var import_material14 = require("@mui/material");
|
|
1901
2041
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1902
2042
|
var positionMap = {
|
|
@@ -1914,14 +2054,14 @@ function BiampTablePagination({
|
|
|
1914
2054
|
...paginationProps
|
|
1915
2055
|
}) {
|
|
1916
2056
|
const rowCount = table.getRowCount();
|
|
1917
|
-
const lastRowCountRef = (0,
|
|
2057
|
+
const lastRowCountRef = (0, import_react9.useRef)(rowCount);
|
|
1918
2058
|
if (!loading && rowCount >= 0) {
|
|
1919
2059
|
lastRowCountRef.current = rowCount;
|
|
1920
2060
|
}
|
|
1921
2061
|
const stableCount = loading ? lastRowCountRef.current : rowCount;
|
|
1922
2062
|
const { pageSize, pageIndex } = table.getState().pagination;
|
|
1923
2063
|
const maxPage = Math.max(0, Math.ceil(stableCount / pageSize) - 1);
|
|
1924
|
-
(0,
|
|
2064
|
+
(0, import_react9.useEffect)(() => {
|
|
1925
2065
|
if (!loading && pageIndex > maxPage) {
|
|
1926
2066
|
table.setPageIndex(maxPage);
|
|
1927
2067
|
}
|
|
@@ -2031,7 +2171,7 @@ function BiampTableToolbarExport({
|
|
|
2031
2171
|
// src/BiampTable/BiampTableToolbarFilters.tsx
|
|
2032
2172
|
var import_material18 = require("@mui/material");
|
|
2033
2173
|
var import_assets9 = require("@bwp-web/assets");
|
|
2034
|
-
var
|
|
2174
|
+
var import_react10 = require("react");
|
|
2035
2175
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2036
2176
|
function BiampTableToolbarFilters({
|
|
2037
2177
|
activeFilterCount,
|
|
@@ -2046,8 +2186,8 @@ function BiampTableToolbarFilters({
|
|
|
2046
2186
|
buttonLabel = "Filters",
|
|
2047
2187
|
DrawerProps: drawerProps
|
|
2048
2188
|
}) {
|
|
2049
|
-
const [open, setOpen] = (0,
|
|
2050
|
-
const titleId = (0,
|
|
2189
|
+
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
2190
|
+
const titleId = (0, import_react10.useId)();
|
|
2051
2191
|
function handleClose() {
|
|
2052
2192
|
onApply?.();
|
|
2053
2193
|
setOpen(false);
|
|
@@ -2164,21 +2304,21 @@ function BiampTableToolbarFilters({
|
|
|
2164
2304
|
// src/BiampTable/BiampTableToolbarSearch.tsx
|
|
2165
2305
|
var import_material19 = require("@mui/material");
|
|
2166
2306
|
var import_assets10 = require("@bwp-web/assets");
|
|
2167
|
-
var
|
|
2307
|
+
var import_react12 = require("react");
|
|
2168
2308
|
|
|
2169
2309
|
// src/BiampTable/useDebouncedCallback.ts
|
|
2170
|
-
var
|
|
2310
|
+
var import_react11 = require("react");
|
|
2171
2311
|
var BIAMP_TABLE_DEBOUNCE_DELAY = 300;
|
|
2172
2312
|
function useDebouncedCallback(callback, delay = BIAMP_TABLE_DEBOUNCE_DELAY) {
|
|
2173
|
-
const timeoutRef = (0,
|
|
2174
|
-
const callbackRef = (0,
|
|
2313
|
+
const timeoutRef = (0, import_react11.useRef)(null);
|
|
2314
|
+
const callbackRef = (0, import_react11.useRef)(callback);
|
|
2175
2315
|
callbackRef.current = callback;
|
|
2176
|
-
(0,
|
|
2316
|
+
(0, import_react11.useEffect)(() => {
|
|
2177
2317
|
return () => {
|
|
2178
2318
|
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
2179
2319
|
};
|
|
2180
2320
|
}, []);
|
|
2181
|
-
return (0,
|
|
2321
|
+
return (0, import_react11.useCallback)(
|
|
2182
2322
|
(...args) => {
|
|
2183
2323
|
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
|
|
2184
2324
|
timeoutRef.current = setTimeout(
|
|
@@ -2216,10 +2356,10 @@ function BiampTableToolbarSearch({
|
|
|
2216
2356
|
...textFieldProps
|
|
2217
2357
|
}) {
|
|
2218
2358
|
const isMobile = (0, import_material19.useMediaQuery)((t) => t.breakpoints.down("md"));
|
|
2219
|
-
const [inputValue, setInputValue] = (0,
|
|
2220
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
2359
|
+
const [inputValue, setInputValue] = (0, import_react12.useState)(defaultValue);
|
|
2360
|
+
const [isExpanded, setIsExpanded] = (0, import_react12.useState)(false);
|
|
2221
2361
|
const debouncedOnChange = useDebouncedCallback(onChange, debounceDelay);
|
|
2222
|
-
(0,
|
|
2362
|
+
(0, import_react12.useEffect)(() => {
|
|
2223
2363
|
setInputValue(defaultValue);
|
|
2224
2364
|
}, [defaultValue]);
|
|
2225
2365
|
const handleChange = (e) => {
|
|
@@ -2337,7 +2477,7 @@ function BiampTableToolbarSearch({
|
|
|
2337
2477
|
|
|
2338
2478
|
// src/BiampTable/useBiampServerSideTable.ts
|
|
2339
2479
|
var import_react_table3 = require("@tanstack/react-table");
|
|
2340
|
-
var
|
|
2480
|
+
var import_react13 = require("react");
|
|
2341
2481
|
|
|
2342
2482
|
// src/BiampTable/serverSideTableUtils.ts
|
|
2343
2483
|
function orderToSorting(order, fieldToColumnId) {
|
|
@@ -2415,28 +2555,28 @@ function useBiampServerSideTable({
|
|
|
2415
2555
|
onExpandedChange,
|
|
2416
2556
|
getSubRows
|
|
2417
2557
|
}) {
|
|
2418
|
-
const { defaultColumnVisibility, columnIdToField, fieldToColumnId } = (0,
|
|
2558
|
+
const { defaultColumnVisibility, columnIdToField, fieldToColumnId } = (0, import_react13.useMemo)(
|
|
2419
2559
|
() => ({
|
|
2420
2560
|
defaultColumnVisibility: getDefaultColumnVisibilityFromDefs(columns),
|
|
2421
2561
|
...getOrderFieldMappings(columns)
|
|
2422
2562
|
}),
|
|
2423
2563
|
[columns]
|
|
2424
2564
|
);
|
|
2425
|
-
const sorting = (0,
|
|
2565
|
+
const sorting = (0, import_react13.useMemo)(
|
|
2426
2566
|
() => orderToSorting(order, fieldToColumnId),
|
|
2427
2567
|
[order, fieldToColumnId]
|
|
2428
2568
|
);
|
|
2429
2569
|
const hasPagination = page != null && rowsPerPage != null;
|
|
2430
|
-
const pagination = (0,
|
|
2570
|
+
const pagination = (0, import_react13.useMemo)(
|
|
2431
2571
|
() => hasPagination ? { pageIndex: page, pageSize: rowsPerPage } : void 0,
|
|
2432
2572
|
[hasPagination, page, rowsPerPage]
|
|
2433
2573
|
);
|
|
2434
2574
|
const hasSelection = selectedRowIds != null;
|
|
2435
|
-
const rowSelection = (0,
|
|
2575
|
+
const rowSelection = (0, import_react13.useMemo)(
|
|
2436
2576
|
() => hasSelection ? selectedIdsToRowSelection(selectedRowIds) : void 0,
|
|
2437
2577
|
[hasSelection, selectedRowIds]
|
|
2438
2578
|
);
|
|
2439
|
-
const mergedVisibility = (0,
|
|
2579
|
+
const mergedVisibility = (0, import_react13.useMemo)(
|
|
2440
2580
|
() => toVisibilityState({
|
|
2441
2581
|
...defaultColumnVisibility,
|
|
2442
2582
|
...columnVisibility
|
|
@@ -2643,11 +2783,11 @@ function SegmentedButtonGroup({ children, sx, ...props }) {
|
|
|
2643
2783
|
}
|
|
2644
2784
|
|
|
2645
2785
|
// src/BiampGlobalSearch/BiampGlobalSearch.tsx
|
|
2646
|
-
var
|
|
2786
|
+
var import_react14 = require("react");
|
|
2647
2787
|
var import_material23 = require("@mui/material");
|
|
2648
2788
|
var import_assets12 = require("@bwp-web/assets");
|
|
2649
2789
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2650
|
-
var SearchContext = (0,
|
|
2790
|
+
var SearchContext = (0, import_react14.createContext)({
|
|
2651
2791
|
hasOptions: true,
|
|
2652
2792
|
loading: false,
|
|
2653
2793
|
noResultsText: "No results found",
|
|
@@ -2682,9 +2822,9 @@ function KeyCap({
|
|
|
2682
2822
|
}
|
|
2683
2823
|
);
|
|
2684
2824
|
}
|
|
2685
|
-
var BiampGlobalSearchPaper = (0,
|
|
2825
|
+
var BiampGlobalSearchPaper = (0, import_react14.forwardRef)(
|
|
2686
2826
|
function BiampGlobalSearchPaper2({ children, ...props }, ref) {
|
|
2687
|
-
const { hasOptions, loading, noResultsText } = (0,
|
|
2827
|
+
const { hasOptions, loading, noResultsText } = (0, import_react14.useContext)(SearchContext);
|
|
2688
2828
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material23.Paper, { ref, ...props, children: [
|
|
2689
2829
|
hasOptions || loading ? children : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2690
2830
|
import_material23.Typography,
|
|
@@ -2769,7 +2909,7 @@ function BiampGlobalSearchListItem({
|
|
|
2769
2909
|
option,
|
|
2770
2910
|
props: liProps
|
|
2771
2911
|
}) {
|
|
2772
|
-
const { query } = (0,
|
|
2912
|
+
const { query } = (0, import_react14.useContext)(SearchContext);
|
|
2773
2913
|
const { key, ...rest } = liProps;
|
|
2774
2914
|
const maxChips = 3;
|
|
2775
2915
|
const chips = option.associatedItems?.slice(0, maxChips) ?? [];
|
|
@@ -3051,7 +3191,7 @@ var getInitials = (name) => {
|
|
|
3051
3191
|
|
|
3052
3192
|
// src/DynamicSvgIcon/DynamicSvgIcon.tsx
|
|
3053
3193
|
var import_material25 = require("@mui/material");
|
|
3054
|
-
var
|
|
3194
|
+
var import_react15 = require("react");
|
|
3055
3195
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3056
3196
|
var svgCache = /* @__PURE__ */ new Map();
|
|
3057
3197
|
function clearDynamicSvgIconCache() {
|
|
@@ -3063,17 +3203,17 @@ function applyCurrentColor(svg) {
|
|
|
3063
3203
|
function useDynamicSvgIcon(url, options = {}) {
|
|
3064
3204
|
const { replaceColors = false, onLoad, onError } = options;
|
|
3065
3205
|
const transform = replaceColors ? applyCurrentColor : (s) => s;
|
|
3066
|
-
const [svgContent, setSvgContent] = (0,
|
|
3206
|
+
const [svgContent, setSvgContent] = (0, import_react15.useState)(() => {
|
|
3067
3207
|
const cached = svgCache.get(url);
|
|
3068
3208
|
return cached ? transform(cached.innerContent) : null;
|
|
3069
3209
|
});
|
|
3070
|
-
const [svgViewBox, setSvgViewBox] = (0,
|
|
3210
|
+
const [svgViewBox, setSvgViewBox] = (0, import_react15.useState)(() => {
|
|
3071
3211
|
const cached = svgCache.get(url);
|
|
3072
3212
|
return cached?.viewBox ?? null;
|
|
3073
3213
|
});
|
|
3074
|
-
const [loading, setLoading] = (0,
|
|
3075
|
-
const [error, setError] = (0,
|
|
3076
|
-
(0,
|
|
3214
|
+
const [loading, setLoading] = (0, import_react15.useState)(() => !svgCache.has(url));
|
|
3215
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
3216
|
+
(0, import_react15.useEffect)(() => {
|
|
3077
3217
|
if (!url) {
|
|
3078
3218
|
setLoading(false);
|
|
3079
3219
|
setError("No URL provided");
|