refactor: refactor create instance

refact create instance code

Change-Id: Ib8ca4af068bd7377c82bee9d0b01df9f1c0ace42
This commit is contained in:
Jingwei.Zhang 2023-08-07 15:26:35 +08:00
parent cfe389dd39
commit 29c4030d0c

View File

@ -518,9 +518,9 @@ export class StepCreate extends StepAction {
return null; return null;
} }
renderFooterLeft() { getCountInputConfig() {
const { data } = this.state; const { data } = this.state;
const { count = 1, source: { value: sourceValue } = {} } = data; const { source: { value: sourceValue } = {} } = data;
const configs = { const configs = {
min: 1, min: 1,
max: max:
@ -533,17 +533,30 @@ export class StepCreate extends StepAction {
onChange: this.onCountChange, onChange: this.onCountChange,
formatter: (value) => `$ ${value}`.replace(/\D/g, ''), formatter: (value) => `$ ${value}`.replace(/\D/g, ''),
}; };
return configs;
}
renderCountInput() {
const { data } = this.state;
const { count = 1 } = data || {};
const configs = this.getCountInputConfig();
return (
<div className={styles['number-input']}>
<span>{t('Count')}</span>
<InputNumber
{...configs}
value={count}
className={classnames(styles.input, 'instance-count')}
/>
</div>
);
}
renderFooterLeft() {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<div style={{ display: 'flex', alignItems: 'center' }}> <div style={{ display: 'flex', alignItems: 'center' }}>
<div className={styles['number-input']}> {this.renderCountInput()}
<span>{t('Count')}</span>
<InputNumber
{...configs}
value={count}
className={classnames(styles.input, 'instance-count')}
/>
</div>
{this.renderExtra()} {this.renderExtra()}
</div> </div>
{this.renderBadge()} {this.renderBadge()}