Commit 5fca5b48 authored by 田翔's avatar 田翔

fix: 代码更新

parent bfbfffee
{
"name": "panda-xform",
"version": "4.9.9",
"description": "4.9.9 隐藏条件修复",
"version": "5.0.0",
"description": "5.0.0 初始调用隐藏规则",
"keywords": [
"panda-xform"
],
......
......@@ -12,6 +12,8 @@ import { isObject } from '../../utils'
import { getWatch } from './watch'
import styles from '../../main.less'
let watchFns = {}
const XRender = (props, ref) => {
useImperativeHandle(ref, () => (
......@@ -27,7 +29,7 @@ const XRender = (props, ref) => {
const { formJson, values } = schemaValues
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
const pandaXform = getPrefixCls()
const [startTime, setStartTime] = useState(new Date().getTime())
const startTime = useState(new Date().getTime())
const [initField, setInitField] = useState([])
const form = useForm()
......@@ -89,7 +91,8 @@ const XRender = (props, ref) => {
}, [formJson, values, disabledFields, disabled])
const watch = useMemo(() => {
return getWatch({ schema: schemaForm, form, startTime, initField })
watchFns = getWatch({ schema: schemaForm, form, startTime, initField })
return watchFns
}, [schemaForm, form, startTime, initField])
const getValues = async () => {
......@@ -111,10 +114,13 @@ const XRender = (props, ref) => {
//初始化时存储外部传的额外数据
const onMount = () => {
// setTimeout(() => {
// setLoading(false)
// }, 500)
// form.setValueByPath('extraData', extraData || { codes: { '事件编号': '12312' } })
setTimeout(() => {
if (isObject(watchFns)) {
for (let key in watchFns) {
watchFns?.[key]()
}
}
}, 1500)
}
return (
......
......@@ -207,7 +207,6 @@ const getAutoWatch = ({ schema, form, startTime, initField }) => {
let watch = {}
let paths = []
let formValue = form?.getValues()
console.log('form?.getValues()', form?.getValues(), form)
let { relationForm } = formValue
const configs = relationForm?.configs || []
const AutoCalculate = getWidgetInfo(schema, 'NumberInput')
......@@ -260,7 +259,6 @@ const getAutoWatch = ({ schema, form, startTime, initField }) => {
}
})
}
console.log('paths', paths)
if (Array.isArray(paths)) {
paths.forEach(v => {
watch[v.path] = () => {
......@@ -284,7 +282,6 @@ const getAutoWatch = ({ schema, form, startTime, initField }) => {
}
})
}
console.log('watch', watch)
return watch
}
......
......@@ -21,11 +21,10 @@ const RichTextDefault = (props, ref) => {
const [editor, setEditor] = useState(null)
const editorChange = (editor) => {
setText(editor.getHtml())
setText(editor?.getHtml())
}
const iconClick = () => {
setText(value)
setVisible(true)
}
......@@ -36,9 +35,10 @@ const RichTextDefault = (props, ref) => {
useEffect(() => {
return () => {
if (editor == null) return
editor.destroy()
setEditor(null)
if (editor !== null) {
editor.destroy()
setEditor(null)
}
}
}, [editor])
......@@ -51,6 +51,7 @@ const RichTextDefault = (props, ref) => {
onCancel={() => setVisible(false)}
visible={visible}
onOk={onOk}
destroyOnClose
>
<div className={styles.richText}>
<Toolbar
......@@ -80,7 +81,7 @@ const RichTextDefault = (props, ref) => {
}
}
}}
value={text}
value={value}
onCreated={setEditor}
onChange={editorChange}
mode="default"
......
......@@ -23,7 +23,6 @@ const debounce = (fn) => {
const TextInput = (props) => {
console.log('props', props)
const preview = sessionStorage.getItem('FormRender')
const userInfo = preview === 'preview' ? { fullName: '【本人姓名】', depart: { name: '【本人部门】' } } : window?.globalConfig?.userInfo || { fullName: '【本人姓名】', depart: { name: '【本人部门】' } }
const { value, onChange, schema, addons } = props
......
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