sag_components 2.0.0-beta307 → 2.0.0-beta309
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/index.d.ts +10 -1
- package/dist/index.esm.js +169 -155
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +169 -155
- package/dist/index.js.map +1 -1
- package/dist/types/components/ItemManagerPanel/ItemManagerPanel.d.ts +10 -1
- package/dist/types/components/ItemManagerPanel/ItemManagerPanel.style.d.ts +2 -0
- package/dist/types/components/ItemManagerPanel/NewItemList/NewItemList.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1556,7 +1556,7 @@ declare function RangePop(props: any): react_jsx_runtime.JSX.Element;
|
|
|
1556
1556
|
|
|
1557
1557
|
declare function SearchInput(props: any): react_jsx_runtime.JSX.Element;
|
|
1558
1558
|
|
|
1559
|
-
declare function ItemManagerPanel({ width, height, disableSection, onSendForms, editMode, disabledSendForms, AllFormsSent, itemAndPackage, setItemAndPackage, linkColor, backgroundColor, buttonTooltipText, trashTooltipText, maxVisibleVendors, componentText, SubTitleColor }: {
|
|
1559
|
+
declare function ItemManagerPanel({ width, height, disableSection, onSendForms, editMode, disabledSendForms, AllFormsSent, itemAndPackage, setItemAndPackage, linkColor, backgroundColor, buttonTooltipText, trashTooltipText, maxVisibleVendors, componentText, SubTitleColor, searchValue, onSearchChange, filteredVendors, isSearchLoading, isLoading, isLoadingText, onLastRowsReached, lastRowsThreshold, onBackFromList, }: {
|
|
1560
1560
|
width?: string;
|
|
1561
1561
|
height?: string;
|
|
1562
1562
|
disableSection?: boolean;
|
|
@@ -1573,6 +1573,15 @@ declare function ItemManagerPanel({ width, height, disableSection, onSendForms,
|
|
|
1573
1573
|
maxVisibleVendors?: number;
|
|
1574
1574
|
componentText?: string;
|
|
1575
1575
|
SubTitleColor?: string;
|
|
1576
|
+
searchValue?: string;
|
|
1577
|
+
onSearchChange?: any;
|
|
1578
|
+
filteredVendors?: any;
|
|
1579
|
+
isSearchLoading?: boolean;
|
|
1580
|
+
isLoading?: boolean;
|
|
1581
|
+
isLoadingText?: string;
|
|
1582
|
+
onLastRowsReached?: () => void;
|
|
1583
|
+
lastRowsThreshold?: number;
|
|
1584
|
+
onBackFromList?: any;
|
|
1576
1585
|
}): react_jsx_runtime.JSX.Element;
|
|
1577
1586
|
|
|
1578
1587
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -37097,7 +37097,7 @@ const NoEventsMessage = styled.span`
|
|
|
37097
37097
|
font-weight: 500;
|
|
37098
37098
|
}
|
|
37099
37099
|
`;
|
|
37100
|
-
const LoadingWrapper = styled.div`
|
|
37100
|
+
const LoadingWrapper$1 = styled.div`
|
|
37101
37101
|
display: flex;
|
|
37102
37102
|
align-items: center;
|
|
37103
37103
|
justify-content: center;
|
|
@@ -37108,7 +37108,7 @@ const LoadingWrapper = styled.div`
|
|
|
37108
37108
|
font-size: 14px;
|
|
37109
37109
|
font-weight: 400;
|
|
37110
37110
|
`;
|
|
37111
|
-
const LoadingText = styled.span`
|
|
37111
|
+
const LoadingText$1 = styled.span`
|
|
37112
37112
|
color: #066768;
|
|
37113
37113
|
font-family: 'Poppins', sans-serif;
|
|
37114
37114
|
font-size: 14px;
|
|
@@ -47498,14 +47498,14 @@ const Table = props => {
|
|
|
47498
47498
|
backgroundColor: buttonColor,
|
|
47499
47499
|
hoverBackgroundColor: buttonHoverColor,
|
|
47500
47500
|
onClick: onButtonClick
|
|
47501
|
-
}))), isLoading && /*#__PURE__*/React$1.createElement(LoadingWrapper, null, /*#__PURE__*/React$1.createElement(Lottie, {
|
|
47501
|
+
}))), isLoading && /*#__PURE__*/React$1.createElement(LoadingWrapper$1, null, /*#__PURE__*/React$1.createElement(Lottie, {
|
|
47502
47502
|
style: {
|
|
47503
47503
|
width: "24px",
|
|
47504
47504
|
height: "24px"
|
|
47505
47505
|
},
|
|
47506
47506
|
animationData: LoadingAnimation,
|
|
47507
47507
|
loop: true
|
|
47508
|
-
}), /*#__PURE__*/React$1.createElement(LoadingText, null, isLoadingText)), isLoadingSpinner && /*#__PURE__*/React$1.createElement(LoaderWrapper, {
|
|
47508
|
+
}), /*#__PURE__*/React$1.createElement(LoadingText$1, null, isLoadingText)), isLoadingSpinner && /*#__PURE__*/React$1.createElement(LoaderWrapper, {
|
|
47509
47509
|
id: "LoaderWrapper"
|
|
47510
47510
|
}, /*#__PURE__*/React$1.createElement(Loader, null)))));
|
|
47511
47511
|
};
|
|
@@ -47520,7 +47520,7 @@ const Card = styled$1.div`
|
|
|
47520
47520
|
width: ${props => props.width || "auto"};
|
|
47521
47521
|
height: ${props => props.height || "auto"};
|
|
47522
47522
|
margin: 0 auto;
|
|
47523
|
-
font-family:
|
|
47523
|
+
font-family: "Poppins", sans-serif;
|
|
47524
47524
|
&:disabled {
|
|
47525
47525
|
background: #f2f2f2;
|
|
47526
47526
|
cursor: not-allowed;
|
|
@@ -47540,7 +47540,7 @@ const SubtitleContainer = styled$1.div`
|
|
|
47540
47540
|
display: flex;
|
|
47541
47541
|
align-items: center;
|
|
47542
47542
|
gap: 6px;
|
|
47543
|
-
color: #
|
|
47543
|
+
color: #8b8989;
|
|
47544
47544
|
`;
|
|
47545
47545
|
const Subtitle$1 = styled$1.span`
|
|
47546
47546
|
color: ${props => props.color};
|
|
@@ -47583,32 +47583,48 @@ styled$1.input`
|
|
|
47583
47583
|
`;
|
|
47584
47584
|
const VendorListWrapper$2 = styled$1.div`
|
|
47585
47585
|
height: calc(100% - ${props => props.headerHeight}px);
|
|
47586
|
-
background: ${props => props.disabled ?
|
|
47586
|
+
background: ${props => props.disabled ? "#f2f2f2" : "#fff"};
|
|
47587
47587
|
width: 100%;
|
|
47588
47588
|
overflow: auto;
|
|
47589
47589
|
border-radius: 0 0 8px 8px;
|
|
47590
47590
|
`;
|
|
47591
|
-
const VendorList$2 = styled$1.div
|
|
47592
|
-
`;
|
|
47591
|
+
const VendorList$2 = styled$1.div``;
|
|
47593
47592
|
const VendorItem$1 = styled$1.div`
|
|
47594
47593
|
display: grid;
|
|
47595
|
-
grid-template-columns: 10% 75% 15%;
|
|
47594
|
+
grid-template-columns: 10% 75% 15%;
|
|
47596
47595
|
align-items: center;
|
|
47597
47596
|
padding: 16px 8px;
|
|
47598
47597
|
border-bottom: 1px solid #f2f2f2;
|
|
47599
|
-
width: ${props => `${Number(props.width.replace(
|
|
47598
|
+
width: ${props => `${Number(props.width.replace("px", "")) - 16}px` || "100%"};
|
|
47600
47599
|
cursor: pointer;
|
|
47601
|
-
|
|
47600
|
+
|
|
47602
47601
|
&:hover {
|
|
47603
|
-
background: #
|
|
47604
|
-
|
|
47605
|
-
|
|
47606
|
-
|
|
47607
|
-
|
|
47608
|
-
|
|
47609
|
-
|
|
47602
|
+
background: #e6f0f0;
|
|
47603
|
+
.trash-icon svg path {
|
|
47604
|
+
fill: #b1b1b1;
|
|
47605
|
+
}
|
|
47606
|
+
.trash-icon-disabled svg path {
|
|
47607
|
+
fill: #b1b1b1;
|
|
47608
|
+
}
|
|
47610
47609
|
}
|
|
47611
47610
|
`;
|
|
47611
|
+
const LoadingWrapper = styled$1.div`
|
|
47612
|
+
display: flex;
|
|
47613
|
+
align-items: center;
|
|
47614
|
+
justify-content: center;
|
|
47615
|
+
gap: 8px;
|
|
47616
|
+
padding: 16px;
|
|
47617
|
+
color: #066768;
|
|
47618
|
+
font-family: "Poppins", sans-serif;
|
|
47619
|
+
font-size: 14px;
|
|
47620
|
+
font-weight: 400;
|
|
47621
|
+
`;
|
|
47622
|
+
const LoadingText = styled$1.span`
|
|
47623
|
+
color: #066768;
|
|
47624
|
+
font-family: "Poppins", sans-serif;
|
|
47625
|
+
font-size: 14px;
|
|
47626
|
+
font-weight: 400;
|
|
47627
|
+
`;
|
|
47612
47628
|
const VendorName$2 = styled$1.div`
|
|
47613
47629
|
color: #212121;
|
|
47614
47630
|
font-size: 14px;
|
|
@@ -47627,7 +47643,6 @@ const VendorChevron$1 = styled$1.div`
|
|
|
47627
47643
|
align-items: center;
|
|
47628
47644
|
display: flex;
|
|
47629
47645
|
width: 15%;
|
|
47630
|
-
|
|
47631
47646
|
`;
|
|
47632
47647
|
const VendorNameAndPackagesContainer$1 = styled$1.div`
|
|
47633
47648
|
display: flex;
|
|
@@ -47754,7 +47769,7 @@ const baseIconWrapperStyles = css`
|
|
|
47754
47769
|
svg {
|
|
47755
47770
|
pointer-events: none;
|
|
47756
47771
|
}
|
|
47757
|
-
|
|
47772
|
+
|
|
47758
47773
|
svg path {
|
|
47759
47774
|
fill: white;
|
|
47760
47775
|
}
|
|
@@ -47768,15 +47783,14 @@ const DisabledTrashIconWrapper = styled$1.div`
|
|
|
47768
47783
|
text-align: left;
|
|
47769
47784
|
left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
|
|
47770
47785
|
}
|
|
47771
|
-
|
|
47786
|
+
|
|
47772
47787
|
&[data-tooltip]:hover::after {
|
|
47773
47788
|
left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
|
|
47774
47789
|
}
|
|
47775
|
-
|
|
47776
47790
|
`;
|
|
47777
47791
|
const TrashIconWrapper = styled$1.div`
|
|
47778
47792
|
${baseIconWrapperStyles}
|
|
47779
|
-
|
|
47793
|
+
|
|
47780
47794
|
&:hover {
|
|
47781
47795
|
svg path {
|
|
47782
47796
|
fill: #066768 !important;
|
|
@@ -47915,21 +47929,31 @@ styled.span`
|
|
|
47915
47929
|
|
|
47916
47930
|
let FixedSizeList = null;
|
|
47917
47931
|
try {
|
|
47918
|
-
FixedSizeList = require(
|
|
47932
|
+
FixedSizeList = require("react-window").FixedSizeList;
|
|
47919
47933
|
} catch (e) {
|
|
47920
|
-
console.error(
|
|
47934
|
+
console.error("react-window not found:", e);
|
|
47921
47935
|
}
|
|
47922
47936
|
const VENDOR_ITEM_HEIGHT = 72;
|
|
47923
47937
|
const NewItemList = ({
|
|
47924
47938
|
onBack,
|
|
47925
47939
|
onVendorClick,
|
|
47926
|
-
itemAndPackage
|
|
47940
|
+
itemAndPackage,
|
|
47941
|
+
searchValue = "",
|
|
47942
|
+
onSearchChange = null,
|
|
47943
|
+
filteredVendors = null,
|
|
47944
|
+
isSearchLoading = false,
|
|
47945
|
+
onLastRowsReached = () => {},
|
|
47946
|
+
lastRowsThreshold = 3
|
|
47927
47947
|
}) => {
|
|
47928
|
-
const [
|
|
47948
|
+
const [internalSearch, setInternalSearch] = useState("");
|
|
47929
47949
|
const [headerHeight, setHeaderHeight] = useState(0);
|
|
47950
|
+
const [hasTriggered, setHasTriggered] = useState(false);
|
|
47930
47951
|
const headerRef = useRef(null);
|
|
47931
47952
|
const searchInputRef = useRef(null);
|
|
47932
47953
|
const timerRef = useRef(null);
|
|
47954
|
+
const scrollWrapperRef = useRef(null);
|
|
47955
|
+
const isExternalSearch = onSearchChange !== null;
|
|
47956
|
+
const currentSearchValue = isExternalSearch ? searchValue : internalSearch;
|
|
47933
47957
|
useEffect(() => {
|
|
47934
47958
|
if (headerRef.current) {
|
|
47935
47959
|
setHeaderHeight(headerRef.current.offsetHeight);
|
|
@@ -47937,16 +47961,31 @@ const NewItemList = ({
|
|
|
47937
47961
|
}, []);
|
|
47938
47962
|
const handleSearchChange = e => {
|
|
47939
47963
|
const value = e.target.value;
|
|
47940
|
-
if (
|
|
47941
|
-
|
|
47964
|
+
if (isExternalSearch) {
|
|
47965
|
+
onSearchChange(value);
|
|
47966
|
+
} else {
|
|
47967
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
47968
|
+
timerRef.current = setTimeout(() => {
|
|
47969
|
+
setInternalSearch(value);
|
|
47970
|
+
}, 100);
|
|
47942
47971
|
}
|
|
47943
|
-
timerRef.current = setTimeout(() => {
|
|
47944
|
-
setDebouncedSearch(value);
|
|
47945
|
-
}, 100);
|
|
47946
47972
|
};
|
|
47973
|
+
|
|
47974
|
+
// DEFINE filteredItems BEFORE using it
|
|
47947
47975
|
const filteredItems = useMemo(() => {
|
|
47948
|
-
|
|
47949
|
-
|
|
47976
|
+
// Use external results if provided
|
|
47977
|
+
if (filteredVendors !== null) {
|
|
47978
|
+
return filteredVendors;
|
|
47979
|
+
}
|
|
47980
|
+
|
|
47981
|
+
// Safety check
|
|
47982
|
+
if (!itemAndPackage || !Array.isArray(itemAndPackage)) {
|
|
47983
|
+
return [];
|
|
47984
|
+
}
|
|
47985
|
+
|
|
47986
|
+
// Internal filtering
|
|
47987
|
+
if (!currentSearchValue) return itemAndPackage;
|
|
47988
|
+
const searchLower = currentSearchValue.toLowerCase();
|
|
47950
47989
|
const results = [];
|
|
47951
47990
|
const startsWithResults = [];
|
|
47952
47991
|
for (let i = 0; i < itemAndPackage.length; i++) {
|
|
@@ -47958,7 +47997,33 @@ const NewItemList = ({
|
|
|
47958
47997
|
}
|
|
47959
47998
|
}
|
|
47960
47999
|
return [...startsWithResults, ...results];
|
|
47961
|
-
}, [
|
|
48000
|
+
}, [currentSearchValue, itemAndPackage, filteredVendors]);
|
|
48001
|
+
|
|
48002
|
+
// ONLY ONE scroll detection useEffect
|
|
48003
|
+
useEffect(() => {
|
|
48004
|
+
const scrollWrapper = scrollWrapperRef.current;
|
|
48005
|
+
if (!scrollWrapper || !onLastRowsReached) return;
|
|
48006
|
+
const handleScroll = () => {
|
|
48007
|
+
const {
|
|
48008
|
+
scrollTop,
|
|
48009
|
+
scrollHeight,
|
|
48010
|
+
clientHeight
|
|
48011
|
+
} = scrollWrapper;
|
|
48012
|
+
const isNearBottom = scrollTop + clientHeight >= scrollHeight - VENDOR_ITEM_HEIGHT * lastRowsThreshold;
|
|
48013
|
+
if (isNearBottom && filteredItems.length > 0) {
|
|
48014
|
+
if (!hasTriggered) {
|
|
48015
|
+
onLastRowsReached();
|
|
48016
|
+
setHasTriggered(true);
|
|
48017
|
+
}
|
|
48018
|
+
} else {
|
|
48019
|
+
if (hasTriggered) {
|
|
48020
|
+
setHasTriggered(false);
|
|
48021
|
+
}
|
|
48022
|
+
}
|
|
48023
|
+
};
|
|
48024
|
+
scrollWrapper.addEventListener("scroll", handleScroll);
|
|
48025
|
+
return () => scrollWrapper.removeEventListener("scroll", handleScroll);
|
|
48026
|
+
}, [onLastRowsReached, filteredItems.length, lastRowsThreshold, hasTriggered]);
|
|
47962
48027
|
const highlightMatch = (text, query) => {
|
|
47963
48028
|
if (!query) return text;
|
|
47964
48029
|
const regex = new RegExp(`(${query})`, "ig");
|
|
@@ -47987,7 +48052,7 @@ const NewItemList = ({
|
|
|
47987
48052
|
onVendorClick(item);
|
|
47988
48053
|
}
|
|
47989
48054
|
}
|
|
47990
|
-
}, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React$1.createElement(VendorName$1, null, highlightMatch(item.name,
|
|
48055
|
+
}, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React$1.createElement(VendorName$1, null, highlightMatch(item.name, currentSearchValue.toLowerCase())), packagesLength > 0 && /*#__PURE__*/React$1.createElement(VendorPackages, null, (() => {
|
|
47991
48056
|
const noPackagesSent = sentPackagesLength === 0;
|
|
47992
48057
|
if (noPackagesSent) {
|
|
47993
48058
|
return `0/${packagesLength} Packages Sent`;
|
|
@@ -48005,7 +48070,8 @@ const NewItemList = ({
|
|
|
48005
48070
|
type: "search",
|
|
48006
48071
|
placeholder: "Search",
|
|
48007
48072
|
onChange: handleSearchChange
|
|
48008
|
-
}), /*#__PURE__*/React$1.createElement(VendorSearchResult, null,
|
|
48073
|
+
}), /*#__PURE__*/React$1.createElement(VendorSearchResult, null, isSearchLoading ? "Searching..." : currentSearchValue !== "" ? `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found` : " ")), /*#__PURE__*/React$1.createElement(VendorListWrapper$1, {
|
|
48074
|
+
ref: scrollWrapperRef,
|
|
48009
48075
|
headerHeight: headerHeight
|
|
48010
48076
|
}, FixedSizeList ? /*#__PURE__*/React$1.createElement(FixedSizeList, {
|
|
48011
48077
|
height: window.innerHeight - headerHeight - 48,
|
|
@@ -48026,7 +48092,7 @@ const NewItemList = ({
|
|
|
48026
48092
|
onVendorClick(item);
|
|
48027
48093
|
}
|
|
48028
48094
|
}
|
|
48029
|
-
}, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React$1.createElement(VendorName$1, null, highlightMatch(item.name,
|
|
48095
|
+
}, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React$1.createElement(VendorName$1, null, highlightMatch(item.name, currentSearchValue.toLowerCase())), packagesLength > 0 && /*#__PURE__*/React$1.createElement(VendorPackages, null, (() => {
|
|
48030
48096
|
const noPackagesSent = sentPackagesLength === 0;
|
|
48031
48097
|
if (noPackagesSent) {
|
|
48032
48098
|
return `0/${packagesLength} Packages Sent`;
|
|
@@ -48242,112 +48308,6 @@ const CustomTooltip = styled(Tooltip$2)`
|
|
|
48242
48308
|
}
|
|
48243
48309
|
`;
|
|
48244
48310
|
|
|
48245
|
-
/* Custom properties */
|
|
48246
|
-
styled.div`
|
|
48247
|
-
--tooltip-text-color: white;
|
|
48248
|
-
--tooltip-background-color: rgba(0, 0, 0, 0.9);
|
|
48249
|
-
--tooltip-margin: 30px;
|
|
48250
|
-
--tooltip-arrow-size: 6px;
|
|
48251
|
-
`;
|
|
48252
|
-
|
|
48253
|
-
/* Text wrapper with ellipsis */
|
|
48254
|
-
styled.div`
|
|
48255
|
-
display: inline-block;
|
|
48256
|
-
position: relative;
|
|
48257
|
-
cursor: ${props => props.isOverflowing ? 'help' : 'default'};
|
|
48258
|
-
`;
|
|
48259
|
-
styled.div`
|
|
48260
|
-
overflow: hidden;
|
|
48261
|
-
text-overflow: ellipsis;
|
|
48262
|
-
white-space: nowrap;
|
|
48263
|
-
max-width: ${props => props.maxWidth}px;
|
|
48264
|
-
`;
|
|
48265
|
-
|
|
48266
|
-
/* Absolute positioning */
|
|
48267
|
-
styled.div`
|
|
48268
|
-
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
|
|
48269
|
-
position: absolute;
|
|
48270
|
-
border-radius: 6px;
|
|
48271
|
-
left: 50%;
|
|
48272
|
-
transform: translateX(-50%);
|
|
48273
|
-
padding: 8px 12px;
|
|
48274
|
-
color: var(--tooltip-text-color);
|
|
48275
|
-
background: var(--tooltip-background-color);
|
|
48276
|
-
font-size: 14px;
|
|
48277
|
-
font-family: inherit;
|
|
48278
|
-
line-height: 1.4;
|
|
48279
|
-
z-index: 99999;
|
|
48280
|
-
max-width: 300px;
|
|
48281
|
-
white-space: normal;
|
|
48282
|
-
word-wrap: break-word;
|
|
48283
|
-
opacity: ${props => props.show ? 1 : 0};
|
|
48284
|
-
visibility: ${props => props.show ? 'visible' : 'hidden'};
|
|
48285
|
-
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
|
|
48286
|
-
|
|
48287
|
-
/* CSS border triangles */
|
|
48288
|
-
&.controls::before {
|
|
48289
|
-
content: " ";
|
|
48290
|
-
left: 50%;
|
|
48291
|
-
border: solid transparent;
|
|
48292
|
-
height: 0;
|
|
48293
|
-
width: 0;
|
|
48294
|
-
position: absolute;
|
|
48295
|
-
pointer-events: none;
|
|
48296
|
-
border-width: var(--tooltip-arrow-size);
|
|
48297
|
-
margin-left: calc(var(--tooltip-arrow-size) * -1);
|
|
48298
|
-
}
|
|
48299
|
-
|
|
48300
|
-
&.controls.top {
|
|
48301
|
-
bottom: calc(100% + var(--tooltip-margin));
|
|
48302
|
-
transform: translateX(-50%) ${props => props.show ? 'translateY(0)' : 'translateY(-4px)'};
|
|
48303
|
-
}
|
|
48304
|
-
|
|
48305
|
-
/* CSS border triangles */
|
|
48306
|
-
&.controls.top::before {
|
|
48307
|
-
top: 100%;
|
|
48308
|
-
border-top-color: var(--tooltip-background-color);
|
|
48309
|
-
}
|
|
48310
|
-
|
|
48311
|
-
&.controls.right {
|
|
48312
|
-
left: calc(100% + var(--tooltip-margin));
|
|
48313
|
-
top: 50%;
|
|
48314
|
-
transform: translateY(-50%) ${props => props.show ? 'translateX(0)' : 'translateX(-4px)'};
|
|
48315
|
-
}
|
|
48316
|
-
|
|
48317
|
-
/* CSS border triangles */
|
|
48318
|
-
&.controls.right::before {
|
|
48319
|
-
left: calc(var(--tooltip-arrow-size) * -1);
|
|
48320
|
-
top: 50%;
|
|
48321
|
-
transform: translateY(-50%);
|
|
48322
|
-
border-right-color: var(--tooltip-background-color);
|
|
48323
|
-
}
|
|
48324
|
-
|
|
48325
|
-
&.controls.bottom {
|
|
48326
|
-
top: calc(100% + var(--tooltip-margin));
|
|
48327
|
-
transform: translateX(-50%) ${props => props.show ? 'translateY(0)' : 'translateY(4px)'};
|
|
48328
|
-
}
|
|
48329
|
-
|
|
48330
|
-
/* CSS border triangles */
|
|
48331
|
-
&.controls.bottom::before {
|
|
48332
|
-
bottom: 100%;
|
|
48333
|
-
border-bottom-color: var(--tooltip-background-color);
|
|
48334
|
-
}
|
|
48335
|
-
|
|
48336
|
-
&.controls.left {
|
|
48337
|
-
right: calc(100% + var(--tooltip-margin));
|
|
48338
|
-
top: 50%;
|
|
48339
|
-
transform: translateY(-50%) ${props => props.show ? 'translateX(0)' : 'translateX(4px)'};
|
|
48340
|
-
}
|
|
48341
|
-
|
|
48342
|
-
/* CSS border triangles */
|
|
48343
|
-
&.controls.left::before {
|
|
48344
|
-
right: calc(var(--tooltip-arrow-size) * -1);
|
|
48345
|
-
top: 50%;
|
|
48346
|
-
transform: translateY(-50%);
|
|
48347
|
-
border-left-color: var(--tooltip-background-color);
|
|
48348
|
-
}
|
|
48349
|
-
`;
|
|
48350
|
-
|
|
48351
48311
|
const NewSubitemList = props => {
|
|
48352
48312
|
const {
|
|
48353
48313
|
vendor,
|
|
@@ -57358,12 +57318,21 @@ const ItemManagerPanel = _ref => {
|
|
|
57358
57318
|
itemAndPackage = [],
|
|
57359
57319
|
setItemAndPackage,
|
|
57360
57320
|
linkColor = "#212121",
|
|
57361
|
-
backgroundColor =
|
|
57321
|
+
backgroundColor = "white",
|
|
57362
57322
|
buttonTooltipText = "Please fill out all forms before sending.",
|
|
57363
|
-
trashTooltipText =
|
|
57323
|
+
trashTooltipText = "Vendor cannot be deleted since its packages <br/> have already been sent as a form.",
|
|
57364
57324
|
maxVisibleVendors = 12,
|
|
57365
57325
|
componentText = "Scale",
|
|
57366
|
-
SubTitleColor = "#8B8989"
|
|
57326
|
+
SubTitleColor = "#8B8989",
|
|
57327
|
+
searchValue = "",
|
|
57328
|
+
onSearchChange = null,
|
|
57329
|
+
filteredVendors = null,
|
|
57330
|
+
isSearchLoading = false,
|
|
57331
|
+
isLoading = false,
|
|
57332
|
+
isLoadingText = "Loading Vendors...",
|
|
57333
|
+
onLastRowsReached = () => {},
|
|
57334
|
+
lastRowsThreshold = 3,
|
|
57335
|
+
onBackFromList = null
|
|
57367
57336
|
} = _ref;
|
|
57368
57337
|
const [screen, setScreen] = useState("initial");
|
|
57369
57338
|
const [selectedVendor, setSelectedVendor] = useState(null);
|
|
@@ -57371,12 +57340,39 @@ const ItemManagerPanel = _ref => {
|
|
|
57371
57340
|
const [isEditingExisting, setIsEditingExisting] = useState(false);
|
|
57372
57341
|
const [trashIsHovered, setTrashIsHovered] = useState(false);
|
|
57373
57342
|
const [headerHeight, setHeaderHeight] = useState(0);
|
|
57343
|
+
const [hasTriggered, setHasTriggered] = useState(false);
|
|
57344
|
+
const scrollWrapperRef = useRef(null);
|
|
57374
57345
|
const headerRef = useRef(null);
|
|
57375
57346
|
useEffect(() => {
|
|
57376
57347
|
if (headerRef.current) {
|
|
57377
57348
|
setHeaderHeight(headerRef.current.offsetHeight);
|
|
57378
57349
|
}
|
|
57379
57350
|
}, []);
|
|
57351
|
+
useEffect(() => {
|
|
57352
|
+
const scrollWrapper = scrollWrapperRef.current;
|
|
57353
|
+
if (!scrollWrapper || !onLastRowsReached) return;
|
|
57354
|
+
const handleScroll = () => {
|
|
57355
|
+
const {
|
|
57356
|
+
scrollTop,
|
|
57357
|
+
scrollHeight,
|
|
57358
|
+
clientHeight
|
|
57359
|
+
} = scrollWrapper;
|
|
57360
|
+
const visibleVendors = itemAndPackage.filter(item => item.packages !== null).length;
|
|
57361
|
+
const isNearBottom = scrollTop + clientHeight >= scrollHeight - 56 * lastRowsThreshold;
|
|
57362
|
+
if (isNearBottom && visibleVendors > 0) {
|
|
57363
|
+
if (!hasTriggered) {
|
|
57364
|
+
onLastRowsReached();
|
|
57365
|
+
setHasTriggered(true);
|
|
57366
|
+
}
|
|
57367
|
+
} else {
|
|
57368
|
+
if (hasTriggered) {
|
|
57369
|
+
setHasTriggered(false);
|
|
57370
|
+
}
|
|
57371
|
+
}
|
|
57372
|
+
};
|
|
57373
|
+
scrollWrapper.addEventListener("scroll", handleScroll);
|
|
57374
|
+
return () => scrollWrapper.removeEventListener("scroll", handleScroll);
|
|
57375
|
+
}, [onLastRowsReached, itemAndPackage, lastRowsThreshold, hasTriggered]);
|
|
57380
57376
|
const hasVendorsWithPackages = () => {
|
|
57381
57377
|
return itemAndPackage.some(item => item.packages !== null && Array.isArray(item.packages) && item.packages.length > 0);
|
|
57382
57378
|
};
|
|
@@ -57411,7 +57407,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57411
57407
|
});
|
|
57412
57408
|
setScreen("subitem");
|
|
57413
57409
|
};
|
|
57414
|
-
const hasValidStatus = pkg => pkg.hasOwnProperty(
|
|
57410
|
+
const hasValidStatus = pkg => pkg.hasOwnProperty("status") && pkg.status != null && pkg.status !== undefined && pkg.status !== "";
|
|
57415
57411
|
const hasInvalidStatus = pkg => !hasValidStatus(pkg);
|
|
57416
57412
|
const draftPackages = pkg => pkg.status === 1;
|
|
57417
57413
|
const unsentPackages = () => {
|
|
@@ -57464,8 +57460,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57464
57460
|
if (screen === "success" && onSendForms) {
|
|
57465
57461
|
onSendForms();
|
|
57466
57462
|
}
|
|
57467
|
-
}, [screen]);
|
|
57468
|
-
|
|
57463
|
+
}, [screen]);
|
|
57469
57464
|
if (screen === "subitem") {
|
|
57470
57465
|
return /*#__PURE__*/React$1.createElement(Card, {
|
|
57471
57466
|
width: width,
|
|
@@ -57551,9 +57546,20 @@ const ItemManagerPanel = _ref => {
|
|
|
57551
57546
|
height: height,
|
|
57552
57547
|
backgroundColor: backgroundColor
|
|
57553
57548
|
}, /*#__PURE__*/React$1.createElement(NewItemList, {
|
|
57554
|
-
onBack: () =>
|
|
57549
|
+
onBack: () => {
|
|
57550
|
+
if (onBackFromList) {
|
|
57551
|
+
onBackFromList();
|
|
57552
|
+
}
|
|
57553
|
+
setScreen("initial");
|
|
57554
|
+
},
|
|
57555
57555
|
itemAndPackage: itemAndPackage,
|
|
57556
|
-
onVendorClick: handleVendorClick
|
|
57556
|
+
onVendorClick: handleVendorClick,
|
|
57557
|
+
searchValue: searchValue,
|
|
57558
|
+
onSearchChange: onSearchChange,
|
|
57559
|
+
filteredVendors: filteredVendors,
|
|
57560
|
+
isSearchLoading: isSearchLoading,
|
|
57561
|
+
onLastRowsReached: onLastRowsReached,
|
|
57562
|
+
lastRowsThreshold: lastRowsThreshold
|
|
57557
57563
|
}));
|
|
57558
57564
|
}
|
|
57559
57565
|
const handleMouseEnter = () => setTrashIsHovered(true);
|
|
@@ -57590,7 +57596,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57590
57596
|
hoverBorderColor: linkColor
|
|
57591
57597
|
})), /*#__PURE__*/React$1.createElement(Subtitle$1, {
|
|
57592
57598
|
color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
|
|
57593
|
-
}, actuallyAllFormsSent ?
|
|
57599
|
+
}, actuallyAllFormsSent ? "All Forms Sent" : itemAndPackage.filter(item => item.packages !== null).length > 0 ? `${unsentPackages().reduce((acc, item) => acc + item.packages?.length, 0)} New Forms` : ""))), /*#__PURE__*/React$1.createElement(AddButtonContainer$1, null, /*#__PURE__*/React$1.createElement(LinkButton, {
|
|
57594
57600
|
leftIcon: "Plus",
|
|
57595
57601
|
onClick: () => setScreen("list"),
|
|
57596
57602
|
rightIcon: "none",
|
|
@@ -57600,6 +57606,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57600
57606
|
textColor: linkColor,
|
|
57601
57607
|
disabled: disableSection
|
|
57602
57608
|
}))), /*#__PURE__*/React$1.createElement(VendorListWrapper$2, {
|
|
57609
|
+
ref: scrollWrapperRef,
|
|
57603
57610
|
disabled: disableSection,
|
|
57604
57611
|
headerHeight: headerHeight
|
|
57605
57612
|
}, /*#__PURE__*/React$1.createElement(VendorList$2, null, itemAndPackage.filter(item => item.packages !== null).map((item, idx) => {
|
|
@@ -57649,7 +57656,14 @@ const ItemManagerPanel = _ref => {
|
|
|
57649
57656
|
width: "14",
|
|
57650
57657
|
height: "18"
|
|
57651
57658
|
})));
|
|
57652
|
-
}))
|
|
57659
|
+
})), isLoading && /*#__PURE__*/React$1.createElement(LoadingWrapper, null, /*#__PURE__*/React$1.createElement(Lottie, {
|
|
57660
|
+
style: {
|
|
57661
|
+
width: "24px",
|
|
57662
|
+
height: "24px"
|
|
57663
|
+
},
|
|
57664
|
+
animationData: LoadingAnimation,
|
|
57665
|
+
loop: true
|
|
57666
|
+
}), /*#__PURE__*/React$1.createElement(LoadingText, null, isLoadingText))));
|
|
57653
57667
|
}
|
|
57654
57668
|
};
|
|
57655
57669
|
|