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