UNPKG

@xrenders/xflow

Version:

一款功能强大、易用灵活的流程编辑器框架,帮助你轻松构建复杂的工作流和流程产品

61 lines 1.39 kB
import FormRender, { useForm } from 'form-render'; import React, { memo, useEffect } from 'react'; import "../index.css"; import { safeJsonStringify } from '../../../utils'; var schema = { type: 'object', displayType: 'row', properties: { list: { type: 'array', widget: 'simpleList', props: { hideCopy: true, hideMove: true }, items: { type: 'object', properties: { title: { title: '标题', type: 'string', props: { allowClear: true }, span: 6 }, value: { title: '事件', type: 'string', props: { allowClear: true }, span: 6 } } } } } }; export default /*#__PURE__*/memo(function (props) { var form = useForm(); var onChange = props.onChange, value = props.value; var watch = { '#': function _(allValues) { onChange(Object.assign({}, allValues)); } }; useEffect(function () { form.resetFields(); form.setValues(value || {}); }, [safeJsonStringify(value)]); return /*#__PURE__*/React.createElement(FormRender, { schema: schema, form: form, watch: watch, size: 'small', className: "custom-node-switch-setting", readOnly: props.readOnly }); });