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.js
CHANGED
|
@@ -37107,7 +37107,7 @@ const NoEventsMessage = styled__default["default"].span`
|
|
|
37107
37107
|
font-weight: 500;
|
|
37108
37108
|
}
|
|
37109
37109
|
`;
|
|
37110
|
-
const LoadingWrapper = styled__default["default"].div`
|
|
37110
|
+
const LoadingWrapper$1 = styled__default["default"].div`
|
|
37111
37111
|
display: flex;
|
|
37112
37112
|
align-items: center;
|
|
37113
37113
|
justify-content: center;
|
|
@@ -37118,7 +37118,7 @@ const LoadingWrapper = styled__default["default"].div`
|
|
|
37118
37118
|
font-size: 14px;
|
|
37119
37119
|
font-weight: 400;
|
|
37120
37120
|
`;
|
|
37121
|
-
const LoadingText = styled__default["default"].span`
|
|
37121
|
+
const LoadingText$1 = styled__default["default"].span`
|
|
37122
37122
|
color: #066768;
|
|
37123
37123
|
font-family: 'Poppins', sans-serif;
|
|
37124
37124
|
font-size: 14px;
|
|
@@ -47508,14 +47508,14 @@ const Table = props => {
|
|
|
47508
47508
|
backgroundColor: buttonColor,
|
|
47509
47509
|
hoverBackgroundColor: buttonHoverColor,
|
|
47510
47510
|
onClick: onButtonClick
|
|
47511
|
-
}))), isLoading && /*#__PURE__*/React__default["default"].createElement(LoadingWrapper, null, /*#__PURE__*/React__default["default"].createElement(Lottie, {
|
|
47511
|
+
}))), isLoading && /*#__PURE__*/React__default["default"].createElement(LoadingWrapper$1, null, /*#__PURE__*/React__default["default"].createElement(Lottie, {
|
|
47512
47512
|
style: {
|
|
47513
47513
|
width: "24px",
|
|
47514
47514
|
height: "24px"
|
|
47515
47515
|
},
|
|
47516
47516
|
animationData: LoadingAnimation,
|
|
47517
47517
|
loop: true
|
|
47518
|
-
}), /*#__PURE__*/React__default["default"].createElement(LoadingText, null, isLoadingText)), isLoadingSpinner && /*#__PURE__*/React__default["default"].createElement(LoaderWrapper, {
|
|
47518
|
+
}), /*#__PURE__*/React__default["default"].createElement(LoadingText$1, null, isLoadingText)), isLoadingSpinner && /*#__PURE__*/React__default["default"].createElement(LoaderWrapper, {
|
|
47519
47519
|
id: "LoaderWrapper"
|
|
47520
47520
|
}, /*#__PURE__*/React__default["default"].createElement(Loader, null)))));
|
|
47521
47521
|
};
|
|
@@ -47530,7 +47530,7 @@ const Card = styled.styled.div`
|
|
|
47530
47530
|
width: ${props => props.width || "auto"};
|
|
47531
47531
|
height: ${props => props.height || "auto"};
|
|
47532
47532
|
margin: 0 auto;
|
|
47533
|
-
font-family:
|
|
47533
|
+
font-family: "Poppins", sans-serif;
|
|
47534
47534
|
&:disabled {
|
|
47535
47535
|
background: #f2f2f2;
|
|
47536
47536
|
cursor: not-allowed;
|
|
@@ -47550,7 +47550,7 @@ const SubtitleContainer = styled.styled.div`
|
|
|
47550
47550
|
display: flex;
|
|
47551
47551
|
align-items: center;
|
|
47552
47552
|
gap: 6px;
|
|
47553
|
-
color: #
|
|
47553
|
+
color: #8b8989;
|
|
47554
47554
|
`;
|
|
47555
47555
|
const Subtitle$1 = styled.styled.span`
|
|
47556
47556
|
color: ${props => props.color};
|
|
@@ -47593,32 +47593,48 @@ styled.styled.input`
|
|
|
47593
47593
|
`;
|
|
47594
47594
|
const VendorListWrapper$2 = styled.styled.div`
|
|
47595
47595
|
height: calc(100% - ${props => props.headerHeight}px);
|
|
47596
|
-
background: ${props => props.disabled ?
|
|
47596
|
+
background: ${props => props.disabled ? "#f2f2f2" : "#fff"};
|
|
47597
47597
|
width: 100%;
|
|
47598
47598
|
overflow: auto;
|
|
47599
47599
|
border-radius: 0 0 8px 8px;
|
|
47600
47600
|
`;
|
|
47601
|
-
const VendorList$2 = styled.styled.div
|
|
47602
|
-
`;
|
|
47601
|
+
const VendorList$2 = styled.styled.div``;
|
|
47603
47602
|
const VendorItem$1 = styled.styled.div`
|
|
47604
47603
|
display: grid;
|
|
47605
|
-
grid-template-columns: 10% 75% 15%;
|
|
47604
|
+
grid-template-columns: 10% 75% 15%;
|
|
47606
47605
|
align-items: center;
|
|
47607
47606
|
padding: 16px 8px;
|
|
47608
47607
|
border-bottom: 1px solid #f2f2f2;
|
|
47609
|
-
width: ${props => `${Number(props.width.replace(
|
|
47608
|
+
width: ${props => `${Number(props.width.replace("px", "")) - 16}px` || "100%"};
|
|
47610
47609
|
cursor: pointer;
|
|
47611
|
-
|
|
47610
|
+
|
|
47612
47611
|
&:hover {
|
|
47613
|
-
background: #
|
|
47614
|
-
|
|
47615
|
-
|
|
47616
|
-
|
|
47617
|
-
|
|
47618
|
-
|
|
47619
|
-
|
|
47612
|
+
background: #e6f0f0;
|
|
47613
|
+
.trash-icon svg path {
|
|
47614
|
+
fill: #b1b1b1;
|
|
47615
|
+
}
|
|
47616
|
+
.trash-icon-disabled svg path {
|
|
47617
|
+
fill: #b1b1b1;
|
|
47618
|
+
}
|
|
47620
47619
|
}
|
|
47621
47620
|
`;
|
|
47621
|
+
const LoadingWrapper = styled.styled.div`
|
|
47622
|
+
display: flex;
|
|
47623
|
+
align-items: center;
|
|
47624
|
+
justify-content: center;
|
|
47625
|
+
gap: 8px;
|
|
47626
|
+
padding: 16px;
|
|
47627
|
+
color: #066768;
|
|
47628
|
+
font-family: "Poppins", sans-serif;
|
|
47629
|
+
font-size: 14px;
|
|
47630
|
+
font-weight: 400;
|
|
47631
|
+
`;
|
|
47632
|
+
const LoadingText = styled.styled.span`
|
|
47633
|
+
color: #066768;
|
|
47634
|
+
font-family: "Poppins", sans-serif;
|
|
47635
|
+
font-size: 14px;
|
|
47636
|
+
font-weight: 400;
|
|
47637
|
+
`;
|
|
47622
47638
|
const VendorName$2 = styled.styled.div`
|
|
47623
47639
|
color: #212121;
|
|
47624
47640
|
font-size: 14px;
|
|
@@ -47637,7 +47653,6 @@ const VendorChevron$1 = styled.styled.div`
|
|
|
47637
47653
|
align-items: center;
|
|
47638
47654
|
display: flex;
|
|
47639
47655
|
width: 15%;
|
|
47640
|
-
|
|
47641
47656
|
`;
|
|
47642
47657
|
const VendorNameAndPackagesContainer$1 = styled.styled.div`
|
|
47643
47658
|
display: flex;
|
|
@@ -47764,7 +47779,7 @@ const baseIconWrapperStyles = styled.css`
|
|
|
47764
47779
|
svg {
|
|
47765
47780
|
pointer-events: none;
|
|
47766
47781
|
}
|
|
47767
|
-
|
|
47782
|
+
|
|
47768
47783
|
svg path {
|
|
47769
47784
|
fill: white;
|
|
47770
47785
|
}
|
|
@@ -47778,15 +47793,14 @@ const DisabledTrashIconWrapper = styled.styled.div`
|
|
|
47778
47793
|
text-align: left;
|
|
47779
47794
|
left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
|
|
47780
47795
|
}
|
|
47781
|
-
|
|
47796
|
+
|
|
47782
47797
|
&[data-tooltip]:hover::after {
|
|
47783
47798
|
left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
|
|
47784
47799
|
}
|
|
47785
|
-
|
|
47786
47800
|
`;
|
|
47787
47801
|
const TrashIconWrapper = styled.styled.div`
|
|
47788
47802
|
${baseIconWrapperStyles}
|
|
47789
|
-
|
|
47803
|
+
|
|
47790
47804
|
&:hover {
|
|
47791
47805
|
svg path {
|
|
47792
47806
|
fill: #066768 !important;
|
|
@@ -47925,21 +47939,31 @@ styled__default["default"].span`
|
|
|
47925
47939
|
|
|
47926
47940
|
let FixedSizeList = null;
|
|
47927
47941
|
try {
|
|
47928
|
-
FixedSizeList = require(
|
|
47942
|
+
FixedSizeList = require("react-window").FixedSizeList;
|
|
47929
47943
|
} catch (e) {
|
|
47930
|
-
console.error(
|
|
47944
|
+
console.error("react-window not found:", e);
|
|
47931
47945
|
}
|
|
47932
47946
|
const VENDOR_ITEM_HEIGHT = 72;
|
|
47933
47947
|
const NewItemList = ({
|
|
47934
47948
|
onBack,
|
|
47935
47949
|
onVendorClick,
|
|
47936
|
-
itemAndPackage
|
|
47950
|
+
itemAndPackage,
|
|
47951
|
+
searchValue = "",
|
|
47952
|
+
onSearchChange = null,
|
|
47953
|
+
filteredVendors = null,
|
|
47954
|
+
isSearchLoading = false,
|
|
47955
|
+
onLastRowsReached = () => {},
|
|
47956
|
+
lastRowsThreshold = 3
|
|
47937
47957
|
}) => {
|
|
47938
|
-
const [
|
|
47958
|
+
const [internalSearch, setInternalSearch] = React$1.useState("");
|
|
47939
47959
|
const [headerHeight, setHeaderHeight] = React$1.useState(0);
|
|
47960
|
+
const [hasTriggered, setHasTriggered] = React$1.useState(false);
|
|
47940
47961
|
const headerRef = React$1.useRef(null);
|
|
47941
47962
|
const searchInputRef = React$1.useRef(null);
|
|
47942
47963
|
const timerRef = React$1.useRef(null);
|
|
47964
|
+
const scrollWrapperRef = React$1.useRef(null);
|
|
47965
|
+
const isExternalSearch = onSearchChange !== null;
|
|
47966
|
+
const currentSearchValue = isExternalSearch ? searchValue : internalSearch;
|
|
47943
47967
|
React$1.useEffect(() => {
|
|
47944
47968
|
if (headerRef.current) {
|
|
47945
47969
|
setHeaderHeight(headerRef.current.offsetHeight);
|
|
@@ -47947,16 +47971,31 @@ const NewItemList = ({
|
|
|
47947
47971
|
}, []);
|
|
47948
47972
|
const handleSearchChange = e => {
|
|
47949
47973
|
const value = e.target.value;
|
|
47950
|
-
if (
|
|
47951
|
-
|
|
47974
|
+
if (isExternalSearch) {
|
|
47975
|
+
onSearchChange(value);
|
|
47976
|
+
} else {
|
|
47977
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
47978
|
+
timerRef.current = setTimeout(() => {
|
|
47979
|
+
setInternalSearch(value);
|
|
47980
|
+
}, 100);
|
|
47952
47981
|
}
|
|
47953
|
-
timerRef.current = setTimeout(() => {
|
|
47954
|
-
setDebouncedSearch(value);
|
|
47955
|
-
}, 100);
|
|
47956
47982
|
};
|
|
47983
|
+
|
|
47984
|
+
// DEFINE filteredItems BEFORE using it
|
|
47957
47985
|
const filteredItems = React$1.useMemo(() => {
|
|
47958
|
-
|
|
47959
|
-
|
|
47986
|
+
// Use external results if provided
|
|
47987
|
+
if (filteredVendors !== null) {
|
|
47988
|
+
return filteredVendors;
|
|
47989
|
+
}
|
|
47990
|
+
|
|
47991
|
+
// Safety check
|
|
47992
|
+
if (!itemAndPackage || !Array.isArray(itemAndPackage)) {
|
|
47993
|
+
return [];
|
|
47994
|
+
}
|
|
47995
|
+
|
|
47996
|
+
// Internal filtering
|
|
47997
|
+
if (!currentSearchValue) return itemAndPackage;
|
|
47998
|
+
const searchLower = currentSearchValue.toLowerCase();
|
|
47960
47999
|
const results = [];
|
|
47961
48000
|
const startsWithResults = [];
|
|
47962
48001
|
for (let i = 0; i < itemAndPackage.length; i++) {
|
|
@@ -47968,7 +48007,33 @@ const NewItemList = ({
|
|
|
47968
48007
|
}
|
|
47969
48008
|
}
|
|
47970
48009
|
return [...startsWithResults, ...results];
|
|
47971
|
-
}, [
|
|
48010
|
+
}, [currentSearchValue, itemAndPackage, filteredVendors]);
|
|
48011
|
+
|
|
48012
|
+
// ONLY ONE scroll detection useEffect
|
|
48013
|
+
React$1.useEffect(() => {
|
|
48014
|
+
const scrollWrapper = scrollWrapperRef.current;
|
|
48015
|
+
if (!scrollWrapper || !onLastRowsReached) return;
|
|
48016
|
+
const handleScroll = () => {
|
|
48017
|
+
const {
|
|
48018
|
+
scrollTop,
|
|
48019
|
+
scrollHeight,
|
|
48020
|
+
clientHeight
|
|
48021
|
+
} = scrollWrapper;
|
|
48022
|
+
const isNearBottom = scrollTop + clientHeight >= scrollHeight - VENDOR_ITEM_HEIGHT * lastRowsThreshold;
|
|
48023
|
+
if (isNearBottom && filteredItems.length > 0) {
|
|
48024
|
+
if (!hasTriggered) {
|
|
48025
|
+
onLastRowsReached();
|
|
48026
|
+
setHasTriggered(true);
|
|
48027
|
+
}
|
|
48028
|
+
} else {
|
|
48029
|
+
if (hasTriggered) {
|
|
48030
|
+
setHasTriggered(false);
|
|
48031
|
+
}
|
|
48032
|
+
}
|
|
48033
|
+
};
|
|
48034
|
+
scrollWrapper.addEventListener("scroll", handleScroll);
|
|
48035
|
+
return () => scrollWrapper.removeEventListener("scroll", handleScroll);
|
|
48036
|
+
}, [onLastRowsReached, filteredItems.length, lastRowsThreshold, hasTriggered]);
|
|
47972
48037
|
const highlightMatch = (text, query) => {
|
|
47973
48038
|
if (!query) return text;
|
|
47974
48039
|
const regex = new RegExp(`(${query})`, "ig");
|
|
@@ -47997,7 +48062,7 @@ const NewItemList = ({
|
|
|
47997
48062
|
onVendorClick(item);
|
|
47998
48063
|
}
|
|
47999
48064
|
}
|
|
48000
|
-
}, /*#__PURE__*/React__default["default"].createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React__default["default"].createElement(VendorName$1, null, highlightMatch(item.name,
|
|
48065
|
+
}, /*#__PURE__*/React__default["default"].createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React__default["default"].createElement(VendorName$1, null, highlightMatch(item.name, currentSearchValue.toLowerCase())), packagesLength > 0 && /*#__PURE__*/React__default["default"].createElement(VendorPackages, null, (() => {
|
|
48001
48066
|
const noPackagesSent = sentPackagesLength === 0;
|
|
48002
48067
|
if (noPackagesSent) {
|
|
48003
48068
|
return `0/${packagesLength} Packages Sent`;
|
|
@@ -48015,7 +48080,8 @@ const NewItemList = ({
|
|
|
48015
48080
|
type: "search",
|
|
48016
48081
|
placeholder: "Search",
|
|
48017
48082
|
onChange: handleSearchChange
|
|
48018
|
-
}), /*#__PURE__*/React__default["default"].createElement(VendorSearchResult, null,
|
|
48083
|
+
}), /*#__PURE__*/React__default["default"].createElement(VendorSearchResult, null, isSearchLoading ? "Searching..." : currentSearchValue !== "" ? `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found` : " ")), /*#__PURE__*/React__default["default"].createElement(VendorListWrapper$1, {
|
|
48084
|
+
ref: scrollWrapperRef,
|
|
48019
48085
|
headerHeight: headerHeight
|
|
48020
48086
|
}, FixedSizeList ? /*#__PURE__*/React__default["default"].createElement(FixedSizeList, {
|
|
48021
48087
|
height: window.innerHeight - headerHeight - 48,
|
|
@@ -48036,7 +48102,7 @@ const NewItemList = ({
|
|
|
48036
48102
|
onVendorClick(item);
|
|
48037
48103
|
}
|
|
48038
48104
|
}
|
|
48039
|
-
}, /*#__PURE__*/React__default["default"].createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React__default["default"].createElement(VendorName$1, null, highlightMatch(item.name,
|
|
48105
|
+
}, /*#__PURE__*/React__default["default"].createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React__default["default"].createElement(VendorName$1, null, highlightMatch(item.name, currentSearchValue.toLowerCase())), packagesLength > 0 && /*#__PURE__*/React__default["default"].createElement(VendorPackages, null, (() => {
|
|
48040
48106
|
const noPackagesSent = sentPackagesLength === 0;
|
|
48041
48107
|
if (noPackagesSent) {
|
|
48042
48108
|
return `0/${packagesLength} Packages Sent`;
|
|
@@ -48252,112 +48318,6 @@ const CustomTooltip = styled__default["default"](Tooltip$2)`
|
|
|
48252
48318
|
}
|
|
48253
48319
|
`;
|
|
48254
48320
|
|
|
48255
|
-
/* Custom properties */
|
|
48256
|
-
styled__default["default"].div`
|
|
48257
|
-
--tooltip-text-color: white;
|
|
48258
|
-
--tooltip-background-color: rgba(0, 0, 0, 0.9);
|
|
48259
|
-
--tooltip-margin: 30px;
|
|
48260
|
-
--tooltip-arrow-size: 6px;
|
|
48261
|
-
`;
|
|
48262
|
-
|
|
48263
|
-
/* Text wrapper with ellipsis */
|
|
48264
|
-
styled__default["default"].div`
|
|
48265
|
-
display: inline-block;
|
|
48266
|
-
position: relative;
|
|
48267
|
-
cursor: ${props => props.isOverflowing ? 'help' : 'default'};
|
|
48268
|
-
`;
|
|
48269
|
-
styled__default["default"].div`
|
|
48270
|
-
overflow: hidden;
|
|
48271
|
-
text-overflow: ellipsis;
|
|
48272
|
-
white-space: nowrap;
|
|
48273
|
-
max-width: ${props => props.maxWidth}px;
|
|
48274
|
-
`;
|
|
48275
|
-
|
|
48276
|
-
/* Absolute positioning */
|
|
48277
|
-
styled__default["default"].div`
|
|
48278
|
-
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
|
|
48279
|
-
position: absolute;
|
|
48280
|
-
border-radius: 6px;
|
|
48281
|
-
left: 50%;
|
|
48282
|
-
transform: translateX(-50%);
|
|
48283
|
-
padding: 8px 12px;
|
|
48284
|
-
color: var(--tooltip-text-color);
|
|
48285
|
-
background: var(--tooltip-background-color);
|
|
48286
|
-
font-size: 14px;
|
|
48287
|
-
font-family: inherit;
|
|
48288
|
-
line-height: 1.4;
|
|
48289
|
-
z-index: 99999;
|
|
48290
|
-
max-width: 300px;
|
|
48291
|
-
white-space: normal;
|
|
48292
|
-
word-wrap: break-word;
|
|
48293
|
-
opacity: ${props => props.show ? 1 : 0};
|
|
48294
|
-
visibility: ${props => props.show ? 'visible' : 'hidden'};
|
|
48295
|
-
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
|
|
48296
|
-
|
|
48297
|
-
/* CSS border triangles */
|
|
48298
|
-
&.controls::before {
|
|
48299
|
-
content: " ";
|
|
48300
|
-
left: 50%;
|
|
48301
|
-
border: solid transparent;
|
|
48302
|
-
height: 0;
|
|
48303
|
-
width: 0;
|
|
48304
|
-
position: absolute;
|
|
48305
|
-
pointer-events: none;
|
|
48306
|
-
border-width: var(--tooltip-arrow-size);
|
|
48307
|
-
margin-left: calc(var(--tooltip-arrow-size) * -1);
|
|
48308
|
-
}
|
|
48309
|
-
|
|
48310
|
-
&.controls.top {
|
|
48311
|
-
bottom: calc(100% + var(--tooltip-margin));
|
|
48312
|
-
transform: translateX(-50%) ${props => props.show ? 'translateY(0)' : 'translateY(-4px)'};
|
|
48313
|
-
}
|
|
48314
|
-
|
|
48315
|
-
/* CSS border triangles */
|
|
48316
|
-
&.controls.top::before {
|
|
48317
|
-
top: 100%;
|
|
48318
|
-
border-top-color: var(--tooltip-background-color);
|
|
48319
|
-
}
|
|
48320
|
-
|
|
48321
|
-
&.controls.right {
|
|
48322
|
-
left: calc(100% + var(--tooltip-margin));
|
|
48323
|
-
top: 50%;
|
|
48324
|
-
transform: translateY(-50%) ${props => props.show ? 'translateX(0)' : 'translateX(-4px)'};
|
|
48325
|
-
}
|
|
48326
|
-
|
|
48327
|
-
/* CSS border triangles */
|
|
48328
|
-
&.controls.right::before {
|
|
48329
|
-
left: calc(var(--tooltip-arrow-size) * -1);
|
|
48330
|
-
top: 50%;
|
|
48331
|
-
transform: translateY(-50%);
|
|
48332
|
-
border-right-color: var(--tooltip-background-color);
|
|
48333
|
-
}
|
|
48334
|
-
|
|
48335
|
-
&.controls.bottom {
|
|
48336
|
-
top: calc(100% + var(--tooltip-margin));
|
|
48337
|
-
transform: translateX(-50%) ${props => props.show ? 'translateY(0)' : 'translateY(4px)'};
|
|
48338
|
-
}
|
|
48339
|
-
|
|
48340
|
-
/* CSS border triangles */
|
|
48341
|
-
&.controls.bottom::before {
|
|
48342
|
-
bottom: 100%;
|
|
48343
|
-
border-bottom-color: var(--tooltip-background-color);
|
|
48344
|
-
}
|
|
48345
|
-
|
|
48346
|
-
&.controls.left {
|
|
48347
|
-
right: calc(100% + var(--tooltip-margin));
|
|
48348
|
-
top: 50%;
|
|
48349
|
-
transform: translateY(-50%) ${props => props.show ? 'translateX(0)' : 'translateX(4px)'};
|
|
48350
|
-
}
|
|
48351
|
-
|
|
48352
|
-
/* CSS border triangles */
|
|
48353
|
-
&.controls.left::before {
|
|
48354
|
-
right: calc(var(--tooltip-arrow-size) * -1);
|
|
48355
|
-
top: 50%;
|
|
48356
|
-
transform: translateY(-50%);
|
|
48357
|
-
border-left-color: var(--tooltip-background-color);
|
|
48358
|
-
}
|
|
48359
|
-
`;
|
|
48360
|
-
|
|
48361
48321
|
const NewSubitemList = props => {
|
|
48362
48322
|
const {
|
|
48363
48323
|
vendor,
|
|
@@ -57368,12 +57328,21 @@ const ItemManagerPanel = _ref => {
|
|
|
57368
57328
|
itemAndPackage = [],
|
|
57369
57329
|
setItemAndPackage,
|
|
57370
57330
|
linkColor = "#212121",
|
|
57371
|
-
backgroundColor =
|
|
57331
|
+
backgroundColor = "white",
|
|
57372
57332
|
buttonTooltipText = "Please fill out all forms before sending.",
|
|
57373
|
-
trashTooltipText =
|
|
57333
|
+
trashTooltipText = "Vendor cannot be deleted since its packages <br/> have already been sent as a form.",
|
|
57374
57334
|
maxVisibleVendors = 12,
|
|
57375
57335
|
componentText = "Scale",
|
|
57376
|
-
SubTitleColor = "#8B8989"
|
|
57336
|
+
SubTitleColor = "#8B8989",
|
|
57337
|
+
searchValue = "",
|
|
57338
|
+
onSearchChange = null,
|
|
57339
|
+
filteredVendors = null,
|
|
57340
|
+
isSearchLoading = false,
|
|
57341
|
+
isLoading = false,
|
|
57342
|
+
isLoadingText = "Loading Vendors...",
|
|
57343
|
+
onLastRowsReached = () => {},
|
|
57344
|
+
lastRowsThreshold = 3,
|
|
57345
|
+
onBackFromList = null
|
|
57377
57346
|
} = _ref;
|
|
57378
57347
|
const [screen, setScreen] = React$1.useState("initial");
|
|
57379
57348
|
const [selectedVendor, setSelectedVendor] = React$1.useState(null);
|
|
@@ -57381,12 +57350,39 @@ const ItemManagerPanel = _ref => {
|
|
|
57381
57350
|
const [isEditingExisting, setIsEditingExisting] = React$1.useState(false);
|
|
57382
57351
|
const [trashIsHovered, setTrashIsHovered] = React$1.useState(false);
|
|
57383
57352
|
const [headerHeight, setHeaderHeight] = React$1.useState(0);
|
|
57353
|
+
const [hasTriggered, setHasTriggered] = React$1.useState(false);
|
|
57354
|
+
const scrollWrapperRef = React$1.useRef(null);
|
|
57384
57355
|
const headerRef = React$1.useRef(null);
|
|
57385
57356
|
React$1.useEffect(() => {
|
|
57386
57357
|
if (headerRef.current) {
|
|
57387
57358
|
setHeaderHeight(headerRef.current.offsetHeight);
|
|
57388
57359
|
}
|
|
57389
57360
|
}, []);
|
|
57361
|
+
React$1.useEffect(() => {
|
|
57362
|
+
const scrollWrapper = scrollWrapperRef.current;
|
|
57363
|
+
if (!scrollWrapper || !onLastRowsReached) return;
|
|
57364
|
+
const handleScroll = () => {
|
|
57365
|
+
const {
|
|
57366
|
+
scrollTop,
|
|
57367
|
+
scrollHeight,
|
|
57368
|
+
clientHeight
|
|
57369
|
+
} = scrollWrapper;
|
|
57370
|
+
const visibleVendors = itemAndPackage.filter(item => item.packages !== null).length;
|
|
57371
|
+
const isNearBottom = scrollTop + clientHeight >= scrollHeight - 56 * lastRowsThreshold;
|
|
57372
|
+
if (isNearBottom && visibleVendors > 0) {
|
|
57373
|
+
if (!hasTriggered) {
|
|
57374
|
+
onLastRowsReached();
|
|
57375
|
+
setHasTriggered(true);
|
|
57376
|
+
}
|
|
57377
|
+
} else {
|
|
57378
|
+
if (hasTriggered) {
|
|
57379
|
+
setHasTriggered(false);
|
|
57380
|
+
}
|
|
57381
|
+
}
|
|
57382
|
+
};
|
|
57383
|
+
scrollWrapper.addEventListener("scroll", handleScroll);
|
|
57384
|
+
return () => scrollWrapper.removeEventListener("scroll", handleScroll);
|
|
57385
|
+
}, [onLastRowsReached, itemAndPackage, lastRowsThreshold, hasTriggered]);
|
|
57390
57386
|
const hasVendorsWithPackages = () => {
|
|
57391
57387
|
return itemAndPackage.some(item => item.packages !== null && Array.isArray(item.packages) && item.packages.length > 0);
|
|
57392
57388
|
};
|
|
@@ -57421,7 +57417,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57421
57417
|
});
|
|
57422
57418
|
setScreen("subitem");
|
|
57423
57419
|
};
|
|
57424
|
-
const hasValidStatus = pkg => pkg.hasOwnProperty(
|
|
57420
|
+
const hasValidStatus = pkg => pkg.hasOwnProperty("status") && pkg.status != null && pkg.status !== undefined && pkg.status !== "";
|
|
57425
57421
|
const hasInvalidStatus = pkg => !hasValidStatus(pkg);
|
|
57426
57422
|
const draftPackages = pkg => pkg.status === 1;
|
|
57427
57423
|
const unsentPackages = () => {
|
|
@@ -57474,8 +57470,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57474
57470
|
if (screen === "success" && onSendForms) {
|
|
57475
57471
|
onSendForms();
|
|
57476
57472
|
}
|
|
57477
|
-
}, [screen]);
|
|
57478
|
-
|
|
57473
|
+
}, [screen]);
|
|
57479
57474
|
if (screen === "subitem") {
|
|
57480
57475
|
return /*#__PURE__*/React__default["default"].createElement(Card, {
|
|
57481
57476
|
width: width,
|
|
@@ -57561,9 +57556,20 @@ const ItemManagerPanel = _ref => {
|
|
|
57561
57556
|
height: height,
|
|
57562
57557
|
backgroundColor: backgroundColor
|
|
57563
57558
|
}, /*#__PURE__*/React__default["default"].createElement(NewItemList, {
|
|
57564
|
-
onBack: () =>
|
|
57559
|
+
onBack: () => {
|
|
57560
|
+
if (onBackFromList) {
|
|
57561
|
+
onBackFromList();
|
|
57562
|
+
}
|
|
57563
|
+
setScreen("initial");
|
|
57564
|
+
},
|
|
57565
57565
|
itemAndPackage: itemAndPackage,
|
|
57566
|
-
onVendorClick: handleVendorClick
|
|
57566
|
+
onVendorClick: handleVendorClick,
|
|
57567
|
+
searchValue: searchValue,
|
|
57568
|
+
onSearchChange: onSearchChange,
|
|
57569
|
+
filteredVendors: filteredVendors,
|
|
57570
|
+
isSearchLoading: isSearchLoading,
|
|
57571
|
+
onLastRowsReached: onLastRowsReached,
|
|
57572
|
+
lastRowsThreshold: lastRowsThreshold
|
|
57567
57573
|
}));
|
|
57568
57574
|
}
|
|
57569
57575
|
const handleMouseEnter = () => setTrashIsHovered(true);
|
|
@@ -57600,7 +57606,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57600
57606
|
hoverBorderColor: linkColor
|
|
57601
57607
|
})), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, {
|
|
57602
57608
|
color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
|
|
57603
|
-
}, actuallyAllFormsSent ?
|
|
57609
|
+
}, 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__default["default"].createElement(AddButtonContainer$1, null, /*#__PURE__*/React__default["default"].createElement(LinkButton, {
|
|
57604
57610
|
leftIcon: "Plus",
|
|
57605
57611
|
onClick: () => setScreen("list"),
|
|
57606
57612
|
rightIcon: "none",
|
|
@@ -57610,6 +57616,7 @@ const ItemManagerPanel = _ref => {
|
|
|
57610
57616
|
textColor: linkColor,
|
|
57611
57617
|
disabled: disableSection
|
|
57612
57618
|
}))), /*#__PURE__*/React__default["default"].createElement(VendorListWrapper$2, {
|
|
57619
|
+
ref: scrollWrapperRef,
|
|
57613
57620
|
disabled: disableSection,
|
|
57614
57621
|
headerHeight: headerHeight
|
|
57615
57622
|
}, /*#__PURE__*/React__default["default"].createElement(VendorList$2, null, itemAndPackage.filter(item => item.packages !== null).map((item, idx) => {
|
|
@@ -57659,7 +57666,14 @@ const ItemManagerPanel = _ref => {
|
|
|
57659
57666
|
width: "14",
|
|
57660
57667
|
height: "18"
|
|
57661
57668
|
})));
|
|
57662
|
-
}))
|
|
57669
|
+
})), isLoading && /*#__PURE__*/React__default["default"].createElement(LoadingWrapper, null, /*#__PURE__*/React__default["default"].createElement(Lottie, {
|
|
57670
|
+
style: {
|
|
57671
|
+
width: "24px",
|
|
57672
|
+
height: "24px"
|
|
57673
|
+
},
|
|
57674
|
+
animationData: LoadingAnimation,
|
|
57675
|
+
loop: true
|
|
57676
|
+
}), /*#__PURE__*/React__default["default"].createElement(LoadingText, null, isLoadingText))));
|
|
57663
57677
|
}
|
|
57664
57678
|
};
|
|
57665
57679
|
|