@aliretail/react-materials-components
Version:
22 lines (19 loc) • 659 B
JavaScript
import { connect } from '@formily/next';
import CustomInput from "../../Input";
import { mapStyledProps, mapTextComponent } from "../shared";
export var InputConnectProps = function InputConnectProps(props, fieldProps) {
mapStyledProps(props, fieldProps); // 当是disabled状态是不显示清除按钮
if (props.disabled) {
props.hasClear = false;
} // 当有限制长度的时候自动显示
if ('maxLength' in props && !('showLimitHint' in props)) {
props.showLimitHint = true;
}
};
export var Input = connect({
getProps: InputConnectProps,
getComponent: mapTextComponent,
defaultProps: {
hasClear: true
}
})(CustomInput);