x-ui-design 0.6.27 → 0.6.29

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.esm.js CHANGED
@@ -774,11 +774,20 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
774
774
  const results = await Promise.all(fieldsToValidate.map(name => validateField(name)));
775
775
  if (_scrollToFirstError.current) {
776
776
  const firstErrorContent = document.querySelectorAll('.xUi-form-item-has-error')?.[0];
777
- console.log('firstErrorContent', firstErrorContent);
778
777
  if (firstErrorContent) {
778
+ let toggleDisplay = false;
779
+ const _firstErrorContent = firstErrorContent.closest('.xUi-form-item');
780
+ if (_firstErrorContent.style.display === 'none') {
781
+ toggleDisplay = true;
782
+ _firstErrorContent.style.display = 'block';
783
+ }
779
784
  firstErrorContent.closest('.xUi-form-item')?.scrollIntoView({
780
785
  behavior: 'smooth'
781
786
  });
787
+ if (toggleDisplay) {
788
+ toggleDisplay = false;
789
+ _firstErrorContent.style.display = 'none';
790
+ }
782
791
  }
783
792
  }
784
793
  return results.every(valid => valid);
@@ -3580,11 +3589,13 @@ const SelectComponent = /*#__PURE__*/memo(({
3580
3589
  } else {
3581
3590
  onSelect?.(optionValue, option);
3582
3591
  }
3592
+ onDropdownVisibleChange?.(defaultOpen, newSelection);
3583
3593
  } else {
3584
3594
  setIsOpen(defaultOpen);
3585
3595
  setSelected(optionValue);
3586
3596
  onChange?.(optionValue, option);
3587
3597
  onSelect?.(optionValue, option);
3598
+ onDropdownVisibleChange?.(defaultOpen, optionValue);
3588
3599
  }
3589
3600
  handleClearInputValue();
3590
3601
  };