"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _get = _interopRequireDefault(require("rc-util/es/utils/get"));
var _form = _interopRequireDefault(require("../../../form"));
var _jsxRuntime = require("react/jsx-runtime");
const ProFormDependency = ({
  name,
  children,
  ...rest
}) => {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.default.Item, {
    ...rest,
    noStyle: true,
    shouldUpdate: (prevValues, nextValues) => {
      return name.some(nameItem => {
        const arrayName = Array.isArray(nameItem) ? nameItem : [nameItem];
        return (0, _get.default)(prevValues, arrayName) !== (0, _get.default)(nextValues, arrayName);
      });
    },
    children: form => {
      const values = form.getFieldsValue(name);
      return children === null || children === void 0 ? void 0 : children(values, form);
    }
  });
};
var _default = ProFormDependency;
exports.default = _default;