import React from 'react';
import get from 'rc-util/es/utils/get';
import Form from '../../../form';
import { jsx as _jsx } from "react/jsx-runtime";
const ProFormDependency = ({
  name,
  children,
  ...rest
}) => {
  return /*#__PURE__*/_jsx(Form.Item, {
    ...rest,
    noStyle: true,
    shouldUpdate: (prevValues, nextValues) => {
      return name.some(nameItem => {
        const arrayName = Array.isArray(nameItem) ? nameItem : [nameItem];
        return get(prevValues, arrayName) !== get(nextValues, arrayName);
      });
    },
    children: form => {
      const values = form.getFieldsValue(name);
      return children === null || children === void 0 ? void 0 : children(values, form);
    }
  });
};
export default ProFormDependency;