king
7 天以前 a1e9b18a4dbfd21e1bf4d5cb60974ac2f0115efd
src/tabviews/zshare/mutilform/mkNumberInput/index.jsx
@@ -44,15 +44,6 @@
    } else if (type === 'input') {
      this.setState({value})
      this.props.onChange(value, true)
    } else if (type === 'reset') {
      let _val = this.props.config.initval
      this.setState({value: _val}, () => {
        let node = document.getElementById(this.props.config.uuid)
        node && node.select()
      })
      this.props.onChange(_val)
    }
  }
@@ -80,15 +71,21 @@
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
    } else {
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      this.props.onSubmit()
      this.props.onSubmit(config.tabUuid, config.errTabUuid)
    }
  }
  render() {
    const { config } = this.props
    const { value, precision } = this.state
    if (precision === null) {
    if (config.format === 'thdSeparator') {
      if (precision === null) {
        return (<InputNumber id={config.uuid} formatter={value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')} parser={value => value.replace(/,*/g, '')} value={value} disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleSubmit}/>)
      } else {
        return (<InputNumber id={config.uuid} formatter={value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')} parser={value => value.replace(/,*/g, '')} value={value} precision={precision} disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleSubmit} />)
      }
    } else if (precision === null) {
      return (<InputNumber id={config.uuid} value={value} disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleSubmit}/>)
    } else {
      return (<InputNumber id={config.uuid} value={value} precision={precision} disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleSubmit} />)