sag_components 2.0.0-beta313 → 2.0.0-beta315

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 CHANGED
@@ -1439,7 +1439,7 @@ declare function RangePop(props: any): any;
1439
1439
 
1440
1440
  declare function SearchInput(props: any): any;
1441
1441
 
1442
- 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, }: {
1442
+ declare function ItemManagerPanel({ width, height, disableSection, onSendForms, editMode, disabledSendForms, AllFormsSent, itemAndPackage, setItemAndPackage, linkColor, backgroundColor, buttonTooltipText, trashTooltipText, maxVisibleVendors, componentText, SubTitleColor, searchValue, onSearchChange, searchResults, filteredVendors, isSearchLoading, isLoading, isLoadingText, onLastRowsReached, lastRowsThreshold, onBackFromList, }: {
1443
1443
  width?: string;
1444
1444
  height?: string;
1445
1445
  disableSection?: boolean;
@@ -1458,6 +1458,7 @@ declare function ItemManagerPanel({ width, height, disableSection, onSendForms,
1458
1458
  SubTitleColor?: string;
1459
1459
  searchValue?: string;
1460
1460
  onSearchChange?: any;
1461
+ searchResults?: any;
1461
1462
  filteredVendors?: any;
1462
1463
  isSearchLoading?: boolean;
1463
1464
  isLoading?: boolean;
package/dist/index.esm.js CHANGED
@@ -47940,7 +47940,10 @@ const NewItemList = ({
47940
47940
  itemAndPackage,
47941
47941
  searchValue = "",
47942
47942
  onSearchChange = null,
47943
+ searchResults = null,
47944
+ // Server-side search results (separate from itemAndPackage)
47943
47945
  filteredVendors = null,
47946
+ // Deprecated: use searchResults instead
47944
47947
  isSearchLoading = false,
47945
47948
  onLastRowsReached = () => {},
47946
47949
  lastRowsThreshold = 3
@@ -47971,20 +47974,28 @@ const NewItemList = ({
47971
47974
  }
47972
47975
  };
47973
47976
 
47977
+ // Resolve searchResults (prefer new prop, fallback to deprecated filteredVendors)
47978
+ const serverSearchResults = searchResults !== null ? searchResults : filteredVendors;
47979
+
47974
47980
  // DEFINE filteredItems BEFORE using it
47981
+ // Logic:
47982
+ // - When NOT searching: show static itemAndPackage (never changes length)
47983
+ // - When searching with external/server-side search: show searchResults (can change length)
47984
+ // - When searching with internal search: filter itemAndPackage locally
47975
47985
  const filteredItems = useMemo(() => {
47976
- // Use external results if provided
47977
- if (filteredVendors !== null) {
47978
- return filteredVendors;
47979
- }
47980
-
47981
- // Safety check
47982
47986
  if (!itemAndPackage || !Array.isArray(itemAndPackage)) {
47983
47987
  return [];
47984
47988
  }
47985
-
47986
- // Internal filtering
47987
- if (!currentSearchValue) return itemAndPackage;
47989
+ if (!currentSearchValue) {
47990
+ return itemAndPackage;
47991
+ }
47992
+ if (isExternalSearch) {
47993
+ if (serverSearchResults !== null) {
47994
+ return serverSearchResults;
47995
+ } else {
47996
+ return [];
47997
+ }
47998
+ }
47988
47999
  const searchLower = currentSearchValue.toLowerCase();
47989
48000
  const results = [];
47990
48001
  const startsWithResults = [];
@@ -47996,8 +48007,9 @@ const NewItemList = ({
47996
48007
  results.push(itemAndPackage[i]);
47997
48008
  }
47998
48009
  }
47999
- return [...startsWithResults, ...results];
48000
- }, [currentSearchValue, itemAndPackage, filteredVendors]);
48010
+ const finalResults = [...startsWithResults, ...results];
48011
+ return finalResults;
48012
+ }, [currentSearchValue, itemAndPackage, serverSearchResults, isExternalSearch]);
48001
48013
 
48002
48014
  // ONLY ONE scroll detection useEffect
48003
48015
  useEffect(() => {
@@ -48070,7 +48082,7 @@ const NewItemList = ({
48070
48082
  type: "search",
48071
48083
  placeholder: "Search",
48072
48084
  onChange: handleSearchChange
48073
- }), /*#__PURE__*/React$1.createElement(VendorSearchResult, null, isSearchLoading ? "Searching..." : currentSearchValue !== "" ? `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found` : " ")), /*#__PURE__*/React$1.createElement(VendorListWrapper$1, {
48085
+ }), /*#__PURE__*/React$1.createElement(VendorSearchResult, null, currentSearchValue === "" ? " " : isSearchLoading ? "Searching..." : serverSearchResults === null ? "..." : `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found`)), /*#__PURE__*/React$1.createElement(VendorListWrapper$1, {
48074
48086
  ref: scrollWrapperRef,
48075
48087
  headerHeight: headerHeight
48076
48088
  }, FixedSizeList ? /*#__PURE__*/React$1.createElement(FixedSizeList, {
@@ -57326,7 +57338,10 @@ const ItemManagerPanel = _ref => {
57326
57338
  SubTitleColor = "#8B8989",
57327
57339
  searchValue = "",
57328
57340
  onSearchChange = null,
57341
+ searchResults = null,
57342
+ // Server-side search results (separate from itemAndPackage)
57329
57343
  filteredVendors = null,
57344
+ // Deprecated: use searchResults instead
57330
57345
  isSearchLoading = false,
57331
57346
  isLoading = false,
57332
57347
  isLoadingText = "Loading Vendors...",
@@ -57554,6 +57569,7 @@ const ItemManagerPanel = _ref => {
57554
57569
  onVendorClick: handleVendorClick,
57555
57570
  searchValue: searchValue,
57556
57571
  onSearchChange: onSearchChange,
57572
+ searchResults: searchResults,
57557
57573
  filteredVendors: filteredVendors,
57558
57574
  isSearchLoading: isSearchLoading,
57559
57575
  onLastRowsReached: onLastRowsReached,