New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(comp:select): add loading
prop for select component
#1439
Conversation
This preview will be available after the AzureCI is passed. |
loading
prop for select componentloading
prop for select component
Codecov Report
@@ Coverage Diff @@
## main #1439 +/- ##
==========================================
+ Coverage 92.80% 92.98% +0.17%
==========================================
Files 327 327
Lines 30292 30361 +69
Branches 2541 2561 +20
==========================================
+ Hits 28114 28232 +118
+ Misses 2178 2129 -49
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
1afd8b1
to
ebf8fb5
Compare
不建议在面板上加loading,可以加在外部 content 组件上面,面板仅仅是数据展示,耦合太多功能会影响后续扩展问题。 比如以下场景,这样的写法可能没有办法兼容:
另外,loading是需要考虑自定义 spin 配置的,可以参考一下其他组件的 spin 写法 |
11239b6
to
998a681
Compare
@@ -107,7 +108,13 @@ export default defineComponent({ | |||
} | |||
} | |||
|
|||
const handleBlur = () => accessor.markAsBlurred() | |||
const handleBlur = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方还是没有正确 rebase 哈,你需要先在 main 分支 pull 一下最新代码,再切换到 select-loading 分支做一次rebase
@@ -37,6 +37,7 @@ | |||
| `status` | 手动指定校验状态 | `valid \| invalid \| validating` | - | - | - | | |||
| `suffix` | 设置后缀图标 | `string \| #suffix` | `down` | ✅ | - | | |||
| `virtual` | 是否开启虚拟滚动 | `boolean` | `false` | - | - | | |||
| `loading` | 是否显示加载中状态 | `boolean \| SpinPublicProps` | `false` | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个直接改成 spin 吧, 跟 table 直接保持一致,默认值为 undefined
然后注意下 API 顺序,按照字母顺序排下序
const { loading } = props | ||
if (!loading) { | ||
return children | ||
} | ||
if (typeof loading === 'boolean') { | ||
return <IxSpin>{children}</IxSpin> | ||
} else { | ||
return <IxSpin {...loading}>{children}</IxSpin> | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { loading } = props | |
if (!loading) { | |
return children | |
} | |
if (typeof loading === 'boolean') { | |
return <IxSpin>{children}</IxSpin> | |
} else { | |
return <IxSpin {...loading}>{children}</IxSpin> | |
} | |
const { spin } = props | |
const spinProps = isBoolean(spin) ? { spinning: spin } : spin | |
return spinProps ? <IxSpin {...spinProps }>{children}</IxSpin> : children |
@@ -12,6 +12,7 @@ import type { VirtualScrollToFn } from '@idux/cdk/scroll' | |||
import type { ExtractInnerPropTypes, ExtractPublicPropTypes, MaybeArray, VKey } from '@idux/cdk/utils' | |||
import type { EmptyProps } from '@idux/components/empty' | |||
import type { FormSize } from '@idux/components/form' | |||
import type { SpinPublicProps } from '@idux/components/spin/src/types' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type { SpinPublicProps } from '@idux/components/spin/src/types' | |
import type { SpinProps } from '@idux/components/spin' |
@@ -80,6 +81,7 @@ export const selectProps = { | |||
status: String as PropType<ValidateStatus>, | |||
suffix: { type: String, default: undefined }, | |||
virtual: { type: Boolean, default: false }, | |||
loading: { type: [Boolean, Object] as PropType<boolean | SpinPublicProps>, default: false }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loading: { type: [Boolean, Object] as PropType<boolean | SpinPublicProps>, default: false }, | |
spin: { type: [Boolean, Object] as PropType<boolean | SpinProps >, default: undefined }, |
fcdd0f8
to
77cce6c
Compare
* feat(comp:select): add loading prop * fix(comp:select): spin type in api doc
* feat(comp:select): add loading prop * fix(comp:select): spin type in api doc
PR Checklist
Please check if your PR fulfills the following requirements:
What is the current behavior?
fix #1435
What is the new behavior?
Other information