pro-components
pro-components copied to clipboard
fix debounceTime no work error and support select component load data util focus
⚡️ Deploying PR Preview...

利用一个focusRef变量来控制组件是否被focus了,默认值是!fieldProps.searchOnFocus,这个变量被传递到fetch方法中。
当searchOnFocus=true时focusRef为false,那么渲染完成就不会发请求了。 当searchOnFocus=false|undefined|null时focusRef为true,那么渲染完成后就会发请求。
如果组件被focus了,onFocus里会设置focusRef=true,当searchOnFocus = true时之后再调用fetchData就会发请求了。
@chenshuai2144 这里吧
我理解一下你的意思,你是希望增加个属性,让组件在选中的时候发一次请求吗
@chenshuai2144 是的哈,表单有很多的select都需要远程加载数据,但是如果页面一渲染就都去加载数据哪完全没必要(labelInValue模式下),我希望的是只有点击的时候才去加载下拉框的数据。所以希望增加一个类似loadUtilClick的属性。
ok, 看看测试用例怎么了
Codecov Report
Base: 98.81% // Head: 98.80% // Decreases project coverage by -0.01% :warning:
Coverage data is based on head (
b99ac2c) compared to base (bf3fd22). Patch coverage: 92.85% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## master #5947 +/- ##
==========================================
- Coverage 98.81% 98.80% -0.02%
==========================================
Files 268 268
Lines 7881 7892 +11
Branches 2792 2721 -71
==========================================
+ Hits 7788 7798 +10
- Misses 93 94 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| packages/form/src/components/SchemaForm/index.tsx | 100.00% <ø> (ø) |
|
| packages/field/src/components/Select/index.tsx | 99.52% <92.30%> (-0.48%) |
:arrow_down: |
| ...field/src/components/Select/SearchSelect/index.tsx | 97.43% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.