@capillarytech/blaze-ui 1.0.3-alpha.8 → 1.0.3-alpha.9

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/index.js CHANGED
@@ -20397,7 +20397,7 @@ var _CapTooltipWithInfo = _interopRequireDefault(__webpack_require__(2608));
20397
20397
  var _constants = __webpack_require__(9788);
20398
20398
  var _styles = _interopRequireDefault(__webpack_require__(8263));
20399
20399
  var _jsxRuntime = __webpack_require__(4848);
20400
- const _excluded = ["type", "options", "value", "onChange", "placeholder", "className", "style", "isError", "errorMessage", "containerClassName", "popoverClassName", "allowClear", "headerLabel", "onUpload", "uploadLabel", "tooltip", "bylineText", "disabled", "showUpload", "customPopupRender", "showSearch", "searchBasedOn", "onSearch", "searchDebounce", "onConfirm", "clearText", "noResultCustomText", "noResultCustomIcon", "readOnly", "staticValue", "onFooterDownloadChange", "onPopupScroll", "enableVirtualization", "virtualRowHeight", "resetSearch", "resetData", "fetchMissingOptions"];
20400
+ const _excluded = ["type", "options", "value", "onChange", "placeholder", "className", "style", "isError", "errorMessage", "containerClassName", "popoverClassName", "allowClear", "headerLabel", "onUpload", "uploadLabel", "tooltip", "bylineText", "disabled", "showUpload", "customPopupRender", "showSearch", "searchBasedOn", "onSearch", "searchDebounce", "onConfirm", "clearText", "noResultCustomText", "noResultCustomIcon", "readOnly", "staticValue", "onFooterDownloadChange", "onPopupScroll", "hasMore", "enableVirtualization", "virtualRowHeight", "resetSearch", "resetData", "fetchMissingOptions"];
20401
20401
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20402
20402
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20403
20403
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
@@ -20567,6 +20567,7 @@ const CapUnifiedSelect = _ref4 => {
20567
20567
  staticValue = true,
20568
20568
  onFooterDownloadChange,
20569
20569
  onPopupScroll,
20570
+ hasMore = true,
20570
20571
  enableVirtualization = false,
20571
20572
  virtualRowHeight = _constants.DEFAULTS.VIRTUAL_ROW_HEIGHT,
20572
20573
  resetSearch = true,
@@ -20901,6 +20902,18 @@ const CapUnifiedSelect = _ref4 => {
20901
20902
  return () => clearTimeout(fallbackTimeout);
20902
20903
  }, [isResettingData, options]);
20903
20904
 
20905
+ // Clear loading state when hasMore becomes false (all items exhausted)
20906
+ (0, _react.useEffect)(() => {
20907
+ if (!hasMore && isLoadingOnScroll) {
20908
+ setIsLoadingOnScroll(false);
20909
+ isScrollProcessingRef.current = false;
20910
+ if (scrollLoadingTimeoutRef.current) {
20911
+ clearTimeout(scrollLoadingTimeoutRef.current);
20912
+ scrollLoadingTimeoutRef.current = null;
20913
+ }
20914
+ }
20915
+ }, [hasMore, isLoadingOnScroll]);
20916
+
20904
20917
  // Detect when options change after scroll to clear loading overlay
20905
20918
  (0, _react.useEffect)(() => {
20906
20919
  // Always update refs when options change (when not loading)
@@ -21452,7 +21465,7 @@ const CapUnifiedSelect = _ref4 => {
21452
21465
  hasInteractedRef.current = false;
21453
21466
  }
21454
21467
  setDropdownOpen(open);
21455
- }, [customPopupRender, value, onChange, tempValue, readOnly, resetSearch, resetData, options]);
21468
+ }, [customPopupRender, value, onChange, tempValue, readOnly, resetSearch, resetData, options, isResettingData]);
21456
21469
  const handleFooterDownload = (0, _react.useCallback)(() => {
21457
21470
  const currentValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
21458
21471
  onFooterDownloadChange == null || onFooterDownloadChange(currentValues);
@@ -21507,6 +21520,13 @@ const CapUnifiedSelect = _ref4 => {
21507
21520
  // This ensures loading state is managed properly and data loading completes
21508
21521
  if (isLoadingOnScroll) return;
21509
21522
 
21523
+ // Don't trigger if there are no more items to load
21524
+ // This prevents showing loading state when all items are exhausted
21525
+ if (!hasMore) {
21526
+ isScrollProcessingRef.current = false;
21527
+ return;
21528
+ }
21529
+
21510
21530
  // Throttle scroll events to prevent rapid-fire API calls
21511
21531
  // Clear any existing throttle timeout
21512
21532
  if (scrollThrottleTimeoutRef.current) {
@@ -21520,7 +21540,8 @@ const CapUnifiedSelect = _ref4 => {
21520
21540
  scrollThrottleTimeoutRef.current = setTimeout(() => {
21521
21541
  // Double-check we're still near bottom and not loading
21522
21542
  const stillNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
21523
- if (!stillNearBottom || isLoadingOnScroll) {
21543
+ // Also check if hasMore is still true (might have changed during throttle delay)
21544
+ if (!stillNearBottom || isLoadingOnScroll || !hasMore) {
21524
21545
  isScrollProcessingRef.current = false;
21525
21546
  return;
21526
21547
  }
@@ -21569,7 +21590,7 @@ const CapUnifiedSelect = _ref4 => {
21569
21590
  });
21570
21591
  }, _constants.TIMEOUTS.SCROLL_LOADING_TIMEOUT);
21571
21592
  }, 150); // 150ms throttle to prevent rapid-fire events
21572
- }, [onPopupScroll, isLoadingOnScroll]);
21593
+ }, [onPopupScroll, isLoadingOnScroll, hasMore]);
21573
21594
 
21574
21595
  // Setup scroll listener for onPopupScroll
21575
21596
  (0, _react.useEffect)(() => {
@@ -21733,7 +21754,7 @@ const CapUnifiedSelect = _ref4 => {
21733
21754
  children: "Loading..."
21734
21755
  })
21735
21756
  })]
21736
- }), isLoadingOnScroll && onPopupScroll && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21757
+ }), isLoadingOnScroll && onPopupScroll && hasMore && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21737
21758
  className: _styles.default['cap-unified-select-loading-overlay'],
21738
21759
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21739
21760
  align: "middle",
@@ -21790,7 +21811,7 @@ const CapUnifiedSelect = _ref4 => {
21790
21811
  })
21791
21812
  })]
21792
21813
  });
21793
- }, [customPopupRender, filteredTree, searchText, isMulti, showUpload, uploadLabel, handleUpload, noResultCustomText, noResultCustomIcon, options, type, tempValue, handleConfirm, handleClearAll, popoverClassName, className, selectedLeafCount, clearText, allowClear, staticValue, showSearch, onFooterDownloadChange, handleFooterDownload, isSearching, handleSearchChange, handleSearchKeyDown, isLoadingOnScroll, onPopupScroll, isResettingData]);
21814
+ }, [customPopupRender, filteredTree, searchText, isMulti, showUpload, uploadLabel, handleUpload, noResultCustomText, noResultCustomIcon, options, type, tempValue, handleConfirm, handleClearAll, popoverClassName, className, selectedLeafCount, clearText, allowClear, staticValue, showSearch, onFooterDownloadChange, handleFooterDownload, isSearching, handleSearchChange, handleSearchKeyDown, isLoadingOnScroll, onPopupScroll, hasMore, isResettingData]);
21794
21815
  const combinedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(containerClassName, _styles.default['cap-unified-tree-select'], {
21795
21816
  [_styles.default['cap-unified-tree-select-readonly']]: readOnly
21796
21817
  }, className), [containerClassName, className, readOnly]);