/x-render-0.9.11

form-render@0.9.11的修改版本

Primary LanguageJavaScript

此版本说明: 对官方的form-redner@0.9.11做了修改

修改如下,对onValidate 做了判断,有传入时才执行

// 用户输入都是调用这个函数
const handleChange = (key, val) => {
  isUserInput.current = true;
  // 开始编辑,节流
  setEditing(true);
  debouncedSetEditing.callback(false);
  onChange(val);
  onValidate && typeof onValidate === "function" && onValidate(getValidateList(val, schema));
};

const updateValidation = (outData, outSchema) => {
  const _data = outData || data;
  const _schema = outSchema || schema;
  onValidate && typeof onValidate === "function" && onValidate(getValidateList(_data, _schema));
};

属性onValidate不默认空函数

function FormRender({
  name = '$form',
  column = 1,
  className,
  schema = {},
  formData = {},
  widgets = {},
  FieldUI = DefaultFieldUI,
  fields = {},
  mapping = {},
  showDescIcon = false,
  showValidate = true,
  displayType = 'column',
  onChange = () => {},
  onValidate, // 不默认空函数
  onMount = () => {},
  readOnly = false,
  labelWidth = 110,
  useLogger = false,
  forwardedRef,
}) {