@alexochihua/exos-library-components 2.25.33 → 2.25.34

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.
@@ -55402,6 +55402,9 @@ const _hoisted_20 = {
55402
55402
  };
55403
55403
 
55404
55404
 
55405
+ const ESTIMATED_OPTION_ROW_PX = 44;
55406
+
55407
+ // Lazy load state (solo cuando lazyOptions está definido)
55405
55408
  const DROPDOWN_GAP_PX = 8;
55406
55409
  /** Gap entre el dropdown y el trigger cuando abre hacia arriba, para que el label quede siempre visible. */
55407
55410
  const DROPDOWN_LABEL_GAP_PX = 8;
@@ -55895,8 +55898,7 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
55895
55898
  */
55896
55899
  const clickOutsideIgnore = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.ref)([]);
55897
55900
  let scrollResizeCleanup = null;
55898
-
55899
- // Lazy load state (solo cuando lazyOptions está definido)
55901
+ let dropdownResizeObserverCleanup = null;
55900
55902
  const lazyOptionsList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.ref)([]);
55901
55903
  const isLoadingLazy = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.ref)(false);
55902
55904
  const page = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.ref)(1);
@@ -56216,6 +56218,7 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56216
56218
  });
56217
56219
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.onBeforeUnmount)(() => {
56218
56220
  window.removeEventListener('resize', handleResize);
56221
+ disconnectDropdownResizeObserver();
56219
56222
  if (scrollResizeCleanup) {
56220
56223
  scrollResizeCleanup();
56221
56224
  scrollResizeCleanup = null;
@@ -56298,10 +56301,55 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56298
56301
  if (topSpace >= needHeight) return true;
56299
56302
  return topSpace >= bottomSpace;
56300
56303
  };
56304
+ const getMeasuredDropdownHeight = () => {
56305
+ const dropdownElement = contentSelect.value;
56306
+ if (!dropdownElement) {
56307
+ return 0;
56308
+ }
56309
+ const measuredHeight = Math.max(dropdownElement.offsetHeight, dropdownElement.scrollHeight, dropdownElement.getBoundingClientRect().height);
56310
+ return measuredHeight > 0 ? measuredHeight : 0;
56311
+ };
56312
+ const getDropdownHeightForPositioning = () => {
56313
+ const measuredHeight = getMeasuredDropdownHeight();
56314
+ if (measuredHeight > 0) {
56315
+ return measuredHeight;
56316
+ }
56317
+ const optionCount = displayOptionsForDropdown.value.length;
56318
+ if (optionCount > 0) {
56319
+ return Math.min(optionCount * ESTIMATED_OPTION_ROW_PX + 8, window.innerHeight * DROPDOWN_MAX_HEIGHT_VH);
56320
+ }
56321
+ return window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56322
+ };
56323
+ const scheduleTeleportDropdownPositionUpdate = () => {
56324
+ if (!isSelectOpened.value || !useTeleport.value) {
56325
+ return;
56326
+ }
56327
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.nextTick)(() => {
56328
+ updateDropdownPositionFixed();
56329
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.nextTick)(updateDropdownPositionFixed);
56330
+ });
56331
+ };
56332
+ const disconnectDropdownResizeObserver = () => {
56333
+ if (dropdownResizeObserverCleanup) {
56334
+ dropdownResizeObserverCleanup();
56335
+ dropdownResizeObserverCleanup = null;
56336
+ }
56337
+ };
56338
+ const connectDropdownResizeObserver = () => {
56339
+ disconnectDropdownResizeObserver();
56340
+ if (!isSelectOpened.value || !useTeleport.value || typeof ResizeObserver === 'undefined' || !contentSelect.value) {
56341
+ return;
56342
+ }
56343
+ const resizeObserver = new ResizeObserver(() => {
56344
+ updateDropdownPositionFixed();
56345
+ });
56346
+ resizeObserver.observe(contentSelect.value);
56347
+ dropdownResizeObserverCleanup = () => resizeObserver.disconnect();
56348
+ };
56301
56349
  const calculateDropPositionY = () => {
56302
56350
  if (isSelectOpened.value) {
56303
56351
  const refComp = instance.refs[`mainSelectComp-${instance.uid}`];
56304
- const dropdownHeight = contentSelect.value?.offsetHeight ?? window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56352
+ const dropdownHeight = getDropdownHeightForPositioning();
56305
56353
  const openAbove = refComp ? shouldOpenAbove({
56306
56354
  referenceEl: refComp,
56307
56355
  dropdownHeight,
@@ -56328,12 +56376,14 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56328
56376
  const triggerEl = getTriggerEl();
56329
56377
  if (!triggerEl) return;
56330
56378
  const rect = triggerEl.getBoundingClientRect();
56331
- const dropdownHeight = contentSelect.value?.offsetHeight ?? window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56379
+ const measuredHeight = getMeasuredDropdownHeight();
56380
+ const heightForDirection = measuredHeight > 0 ? measuredHeight : getDropdownHeightForPositioning();
56332
56381
  const openAbove = shouldOpenAbove({
56333
56382
  referenceEl: triggerEl,
56334
- dropdownHeight,
56383
+ dropdownHeight: heightForDirection,
56335
56384
  useViewport: true
56336
56385
  });
56386
+ const maxDropdownHeightVh = window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56337
56387
  const style = {
56338
56388
  position: 'fixed',
56339
56389
  left: rect.left + 'px',
@@ -56342,10 +56392,17 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56342
56392
  maxWidth: rect.width + 'px',
56343
56393
  zIndex: 9999
56344
56394
  };
56395
+ showPosition.value = !openAbove;
56345
56396
  if (openAbove) {
56346
- style.top = Math.max(0, rect.top - dropdownHeight - DROPDOWN_LABEL_GAP_PX) + 'px';
56397
+ const spaceAbove = rect.top - DROPDOWN_LABEL_GAP_PX - DROPDOWN_GAP_PX;
56398
+ style.maxHeight = Math.min(maxDropdownHeightVh, Math.max(spaceAbove, 0)) + 'px';
56399
+ style.top = 'auto';
56400
+ style.bottom = window.innerHeight - rect.top + DROPDOWN_LABEL_GAP_PX + 'px';
56347
56401
  } else {
56402
+ const spaceBelow = window.innerHeight - rect.bottom - DROPDOWN_GAP_PX;
56403
+ style.maxHeight = Math.min(maxDropdownHeightVh, Math.max(spaceBelow, 0)) + 'px';
56348
56404
  style.top = rect.bottom + 'px';
56405
+ style.bottom = 'auto';
56349
56406
  }
56350
56407
  dropdownPositionFixed.value = style;
56351
56408
  };
@@ -56798,17 +56855,24 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56798
56855
  });
56799
56856
  });
56800
56857
 
56858
+ // Recalcular posición al filtrar o cambiar opciones (Teleport + suggestion / lazy)
56859
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.watch)(() => [displayOptionsForDropdown.value.length, tempValueInput.value, isLoadingLazy.value], () => {
56860
+ scheduleTeleportDropdownPositionUpdate();
56861
+ });
56862
+
56801
56863
  // Watch para Teleport: actualizar posición fixed y listeners scroll/resize
56802
56864
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.watch)(() => isSelectOpened.value, isOpen => {
56803
56865
  if (scrollResizeCleanup) {
56804
56866
  scrollResizeCleanup();
56805
56867
  scrollResizeCleanup = null;
56806
56868
  }
56869
+ disconnectDropdownResizeObserver();
56807
56870
  if (isOpen && useTeleport.value) {
56808
56871
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.nextTick)(() => {
56809
56872
  updateDropdownPositionFixed();
56810
56873
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.nextTick)(() => {
56811
56874
  updateDropdownPositionFixed();
56875
+ connectDropdownResizeObserver();
56812
56876
  });
56813
56877
  const onScrollResize = () => {
56814
56878
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.nextTick)(updateDropdownPositionFixed);
@@ -55420,6 +55420,9 @@ const _hoisted_20 = {
55420
55420
  };
55421
55421
 
55422
55422
 
55423
+ const ESTIMATED_OPTION_ROW_PX = 44;
55424
+
55425
+ // Lazy load state (solo cuando lazyOptions está definido)
55423
55426
  const DROPDOWN_GAP_PX = 8;
55424
55427
  /** Gap entre el dropdown y el trigger cuando abre hacia arriba, para que el label quede siempre visible. */
55425
55428
  const DROPDOWN_LABEL_GAP_PX = 8;
@@ -55913,8 +55916,7 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
55913
55916
  */
55914
55917
  const clickOutsideIgnore = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)([]);
55915
55918
  let scrollResizeCleanup = null;
55916
-
55917
- // Lazy load state (solo cuando lazyOptions está definido)
55919
+ let dropdownResizeObserverCleanup = null;
55918
55920
  const lazyOptionsList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)([]);
55919
55921
  const isLoadingLazy = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(false);
55920
55922
  const page = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(1);
@@ -56234,6 +56236,7 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56234
56236
  });
56235
56237
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onBeforeUnmount)(() => {
56236
56238
  window.removeEventListener('resize', handleResize);
56239
+ disconnectDropdownResizeObserver();
56237
56240
  if (scrollResizeCleanup) {
56238
56241
  scrollResizeCleanup();
56239
56242
  scrollResizeCleanup = null;
@@ -56316,10 +56319,55 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56316
56319
  if (topSpace >= needHeight) return true;
56317
56320
  return topSpace >= bottomSpace;
56318
56321
  };
56322
+ const getMeasuredDropdownHeight = () => {
56323
+ const dropdownElement = contentSelect.value;
56324
+ if (!dropdownElement) {
56325
+ return 0;
56326
+ }
56327
+ const measuredHeight = Math.max(dropdownElement.offsetHeight, dropdownElement.scrollHeight, dropdownElement.getBoundingClientRect().height);
56328
+ return measuredHeight > 0 ? measuredHeight : 0;
56329
+ };
56330
+ const getDropdownHeightForPositioning = () => {
56331
+ const measuredHeight = getMeasuredDropdownHeight();
56332
+ if (measuredHeight > 0) {
56333
+ return measuredHeight;
56334
+ }
56335
+ const optionCount = displayOptionsForDropdown.value.length;
56336
+ if (optionCount > 0) {
56337
+ return Math.min(optionCount * ESTIMATED_OPTION_ROW_PX + 8, window.innerHeight * DROPDOWN_MAX_HEIGHT_VH);
56338
+ }
56339
+ return window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56340
+ };
56341
+ const scheduleTeleportDropdownPositionUpdate = () => {
56342
+ if (!isSelectOpened.value || !useTeleport.value) {
56343
+ return;
56344
+ }
56345
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
56346
+ updateDropdownPositionFixed();
56347
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(updateDropdownPositionFixed);
56348
+ });
56349
+ };
56350
+ const disconnectDropdownResizeObserver = () => {
56351
+ if (dropdownResizeObserverCleanup) {
56352
+ dropdownResizeObserverCleanup();
56353
+ dropdownResizeObserverCleanup = null;
56354
+ }
56355
+ };
56356
+ const connectDropdownResizeObserver = () => {
56357
+ disconnectDropdownResizeObserver();
56358
+ if (!isSelectOpened.value || !useTeleport.value || typeof ResizeObserver === 'undefined' || !contentSelect.value) {
56359
+ return;
56360
+ }
56361
+ const resizeObserver = new ResizeObserver(() => {
56362
+ updateDropdownPositionFixed();
56363
+ });
56364
+ resizeObserver.observe(contentSelect.value);
56365
+ dropdownResizeObserverCleanup = () => resizeObserver.disconnect();
56366
+ };
56319
56367
  const calculateDropPositionY = () => {
56320
56368
  if (isSelectOpened.value) {
56321
56369
  const refComp = instance.refs[`mainSelectComp-${instance.uid}`];
56322
- const dropdownHeight = contentSelect.value?.offsetHeight ?? window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56370
+ const dropdownHeight = getDropdownHeightForPositioning();
56323
56371
  const openAbove = refComp ? shouldOpenAbove({
56324
56372
  referenceEl: refComp,
56325
56373
  dropdownHeight,
@@ -56346,12 +56394,14 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56346
56394
  const triggerEl = getTriggerEl();
56347
56395
  if (!triggerEl) return;
56348
56396
  const rect = triggerEl.getBoundingClientRect();
56349
- const dropdownHeight = contentSelect.value?.offsetHeight ?? window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56397
+ const measuredHeight = getMeasuredDropdownHeight();
56398
+ const heightForDirection = measuredHeight > 0 ? measuredHeight : getDropdownHeightForPositioning();
56350
56399
  const openAbove = shouldOpenAbove({
56351
56400
  referenceEl: triggerEl,
56352
- dropdownHeight,
56401
+ dropdownHeight: heightForDirection,
56353
56402
  useViewport: true
56354
56403
  });
56404
+ const maxDropdownHeightVh = window.innerHeight * DROPDOWN_MAX_HEIGHT_VH;
56355
56405
  const style = {
56356
56406
  position: 'fixed',
56357
56407
  left: rect.left + 'px',
@@ -56360,10 +56410,17 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56360
56410
  maxWidth: rect.width + 'px',
56361
56411
  zIndex: 9999
56362
56412
  };
56413
+ showPosition.value = !openAbove;
56363
56414
  if (openAbove) {
56364
- style.top = Math.max(0, rect.top - dropdownHeight - DROPDOWN_LABEL_GAP_PX) + 'px';
56415
+ const spaceAbove = rect.top - DROPDOWN_LABEL_GAP_PX - DROPDOWN_GAP_PX;
56416
+ style.maxHeight = Math.min(maxDropdownHeightVh, Math.max(spaceAbove, 0)) + 'px';
56417
+ style.top = 'auto';
56418
+ style.bottom = window.innerHeight - rect.top + DROPDOWN_LABEL_GAP_PX + 'px';
56365
56419
  } else {
56420
+ const spaceBelow = window.innerHeight - rect.bottom - DROPDOWN_GAP_PX;
56421
+ style.maxHeight = Math.min(maxDropdownHeightVh, Math.max(spaceBelow, 0)) + 'px';
56366
56422
  style.top = rect.bottom + 'px';
56423
+ style.bottom = 'auto';
56367
56424
  }
56368
56425
  dropdownPositionFixed.value = style;
56369
56426
  };
@@ -56816,17 +56873,24 @@ const DROPDOWN_MAX_HEIGHT_VH = 0.4;
56816
56873
  });
56817
56874
  });
56818
56875
 
56876
+ // Recalcular posición al filtrar o cambiar opciones (Teleport + suggestion / lazy)
56877
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => [displayOptionsForDropdown.value.length, tempValueInput.value, isLoadingLazy.value], () => {
56878
+ scheduleTeleportDropdownPositionUpdate();
56879
+ });
56880
+
56819
56881
  // Watch para Teleport: actualizar posición fixed y listeners scroll/resize
56820
56882
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => isSelectOpened.value, isOpen => {
56821
56883
  if (scrollResizeCleanup) {
56822
56884
  scrollResizeCleanup();
56823
56885
  scrollResizeCleanup = null;
56824
56886
  }
56887
+ disconnectDropdownResizeObserver();
56825
56888
  if (isOpen && useTeleport.value) {
56826
56889
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
56827
56890
  updateDropdownPositionFixed();
56828
56891
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
56829
56892
  updateDropdownPositionFixed();
56893
+ connectDropdownResizeObserver();
56830
56894
  });
56831
56895
  const onScrollResize = () => {
56832
56896
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(updateDropdownPositionFixed);