fix:折叠器Collapse自定义图标&inputNumber对含后缀生效 (#5591)

* fix:折叠器Collapse自定义图标&inputNumber对含后缀生效

* 修改

* 正则修改

* 正则修改

* 正则修改

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>
This commit is contained in:
徐佳豪 2022-10-19 14:37:33 +08:00 committed by GitHub
parent 25a8fe2f48
commit 8fc6d45b4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -170,8 +170,8 @@ export default class Collapse extends React.Component<CollapseProps, {}> {
propsUpdate={propsUpdate}
expandIcon={
expandIcon
? typeof expandIcon === 'object'
? generateIcon(cx, expandIcon as IconCheckedSchema)
? typeof (expandIcon as any).icon === 'object'
? generateIcon(cx, (expandIcon as any).icon)
: render('arrow-icon', expandIcon || '', {
className: cx('Collapse-icon-tranform')
})

View File

@ -290,11 +290,9 @@ export default class NumberControl extends React.Component<
}
componentDidUpdate(prevProps: NumberProps) {
if (
!isNaN(this.props.value) &&
!isNaN(prevProps.value) &&
this.props.value !== prevProps.value
) {
// 匹配 数字 + ?字符
const reg = /^([-+]?(([1-9]\d*\.?\d*)|(0\.\d*[1-9]))[^\d\.]*)$/;
if (reg.test(this.props.value) && this.props.value !== prevProps.value) {
const unit = this.getUnit();
this.setState({unit: unit});
}