"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _antd = require("antd");
var _IconNode = _interopRequireDefault(require("../components/IconNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var RenderNode = function RenderNode(props) {
  var element = props.element;
  return element;
};
var ActionList = function ActionList(props) {
  var list = props.list,
    form = props.form,
    _props$align = props.align,
    align = _props$align === void 0 ? 'default' : _props$align,
    other = props.other,
    onStep = props.onStep;
  // @ts-ignore
  return /*#__PURE__*/_react.default.createElement("div", {
    className: "standardForm-actions",
    style: {
      textAlign: !align || align === 'default' ? 'inherit' : align
    }
  }, list.map(function (item, index) {
    if (_typeof(item) === 'object' && !(item !== null && item !== void 0 && item.$$typeof)) {
      return /*#__PURE__*/_react.default.createElement(_antd.Button, {
        key: index,
        type: item.type ? item.type : 'primary',
        icon: item.icon ? /*#__PURE__*/_react.default.createElement(_IconNode.default, {
          icon: item.icon
        }) : null,
        ghost: item.ghost,
        disabled: item.disabled,
        loading: item.loading,
        onClick: function onClick(e) {
          if (item.action) {
            // 如果有配置默认执行方法，则优先以组件内部的步骤事件做处理
            onStep && onStep(item.action, function () {
              item.fn && item.fn(item, form, other, e);
            });
          } else if (item.fn) {
            item.fn(item, form, other, e);
          } else if (item.onClick) {
            item.onClick(item, form, other, e);
          }
        }
      }, item.name);
    }
    return /*#__PURE__*/_react.default.createElement(RenderNode, {
      key: index,
      element: item
    });
  }));
};
var _default = exports.default = ActionList;