Commit 3b9805c6 authored by 田翔's avatar 田翔

fix: 增加是否初始调用参数

parent f45ed876
{
"name": "panda-xform",
"version": "6.10.5",
"description": "6.10.5 解决打印无数据问题",
"version": "6.10.6",
"description": "6.10.6 增加是否初始调用参数",
"keywords": [
"panda-xform"
],
......
......@@ -21,7 +21,7 @@ const XRender = (props, ref) => {
}
))
const { schemaValues, disabledFields, disabled, codes, env } = props
const { schemaValues, disabledFields, disabled, codes, env, firstCall } = props
window.pandaXform = {
codes,
env,
......@@ -30,7 +30,7 @@ const XRender = (props, ref) => {
const { formJson, values } = schemaValues
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
const pandaXform = getPrefixCls()
const startTime = new Date().getTime()
const startTime = firstCall ? 0 : new Date().getTime()
const [initField, setInitField] = useState([])
const form = useForm()
......
......@@ -245,7 +245,7 @@ const getFieldValue = (formValue, fieldName) => {
}
//自动计算监听/隐藏条件监听
export const getWatch = ({ schema, form, startTime, initField }) => {
export const getWatch = ({ schema, form, startTime, initField, firstCall }) => {
let watch = {}
let paths = []
let formValue = form?.getValues()
......@@ -338,6 +338,7 @@ export const getWatch = ({ schema, form, startTime, initField }) => {
relationForm,
schema: schema,
startTime,
firstCall,
initField,
currentValue,
}
......
......@@ -44,12 +44,6 @@ const NumberInput = (props) => {
}
}
const inputChange = (e) => {
let inputValue = e.target.value
inputValue.replace(/[^\d.]/g, '')
onChange(inputValue)
}
const formatterFn = (value) => {
if (value) {
if (formatter === '${百分比}') {
......@@ -59,7 +53,8 @@ const NumberInput = (props) => {
} else if (formatter === '${整数}') {
return `${parseInt(value)}`
} else if (formatter === '${小数}') {
return Number(value).toFixed(Number(decimalDigits))
return value
// return Number(value).toFixed(Number(decimalDigits))
} else if (formatter === '${科学计数法}') {
return Number(value).toExponential()
} else if (formatter) {
......@@ -69,9 +64,12 @@ const NumberInput = (props) => {
return value
}
const obj = formatter === '${小数}' ? { precision: decimalDigits } : { formatter: formatterFn }
return (
<div className={styles.inputNumber} isdisabled={JSON.stringify(disabled)}>
<InputNumber
{...obj}
min={min || Number.MIN_SAFE_INTEGER}
max={max || Number.MAX_SAFE_INTEGER}
step={(formatter === '${百分比}' && isStoreFormatter) ? 0.01 : 1}
......@@ -81,7 +79,7 @@ const NumberInput = (props) => {
placeholder={disabled ? (placeholder || '') : (placeholder || '请输入内容')}
disabled={disabled}
value={value === '' ? null : Number(value)}
formatter={formatterFn}
stringMode={true}
onChange={numberChange}
style={{ width: '100%' }}
/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment