Liferay.Loader.define("app-builder-workflow-web@1.0.40/js/pages/apps/edit/sidebar/ActionsTab.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/button', '@frontend-taglib-clay$clayui/form', '@frontend-taglib-clay$clayui/icon', 'frontend-js-react-web$react', '../configReducer.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = ActionsTab;

    var _button = _interopRequireDefault(require("@frontend-taglib-clay$clayui/button"));

    var _form = _interopRequireWildcard(require("@frontend-taglib-clay$clayui/form"));

    var _icon = _interopRequireDefault(require("@frontend-taglib-clay$clayui/icon"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _configReducer = require("../configReducer.es");

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _slicedToArray(arr, i) {
      return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
    }

    function _nonIterableRest() {
      throw new TypeError("Invalid attempt to destructure non-iterable instance");
    }

    function _iterableToArrayLimit(arr, i) {
      if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
        return;
      }var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
        for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
          _arr.push(_s.value);if (i && _arr.length === i) break;
        }
      } catch (err) {
        _d = true;_e = err;
      } finally {
        try {
          if (!_n && _i["return"] != null) _i["return"]();
        } finally {
          if (_d) throw _e;
        }
      }return _arr;
    }

    function _arrayWithHoles(arr) {
      if (Array.isArray(arr)) return arr;
    }

    function ActionsTab(_ref) {
      var _ref$config = _ref.config,
          currentStep = _ref$config.currentStep,
          stepIndex = _ref$config.stepIndex,
          dispatchConfig = _ref.dispatchConfig;
      var _currentStep$appWorkf = currentStep.appWorkflowTransitions;
      _currentStep$appWorkf = _currentStep$appWorkf === void 0 ? [{}] : _currentStep$appWorkf;

      var _currentStep$appWorkf2 = _slicedToArray(_currentStep$appWorkf, 2),
          _currentStep$appWorkf3 = _currentStep$appWorkf2[0],
          primaryAction = _currentStep$appWorkf3 === void 0 ? {} : _currentStep$appWorkf3,
          secondaryAction = _currentStep$appWorkf2[1];

      var onChangeActionName = function onChangeActionName(_ref2, primary) {
        var target = _ref2.target;
        dispatchConfig({
          name: target.value,
          primary: primary,
          type: _configReducer.UPDATE_STEP_ACTION
        });
      };

      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("label", {
          className: "ml-3 outline-text text-secondary",
          style: {
            marginTop: '16px'
          }
        }, Liferay.Language.get('primary-action')), /*#__PURE__*/_react.default.createElement(_form.default.Group, {
          className: "form-group-outlined mt-4"
        }, /*#__PURE__*/_react.default.createElement("label", {
          className: "mt-3"
        }, Liferay.Language.get('action-name')), /*#__PURE__*/_react.default.createElement(_form.ClayInput, {
          maxLength: "50",
          onChange: function onChange(event) {
            return onChangeActionName(event, true);
          },
          type: "text",
          value: primaryAction.name
        }), /*#__PURE__*/_react.default.createElement("label", {
          className: "mt-3"
        }, Liferay.Language.get('transition-to')), /*#__PURE__*/_react.default.createElement(_button.default, {
          className: "clearfix disabled w-100",
          displayType: "secondary"
        }, /*#__PURE__*/_react.default.createElement("span", {
          className: "float-left text-left text-truncate w90"
        }, Liferay.Language.get('next-step')), /*#__PURE__*/_react.default.createElement(_icon.default, {
          className: "dropdown-button-asset float-right",
          symbol: "caret-bottom"
        }))), stepIndex > 1 && !secondaryAction && /*#__PURE__*/_react.default.createElement(_button.default, {
          className: "w-100",
          displayType: "secondary",
          onClick: function onClick() {
            return dispatchConfig({
              type: _configReducer.ADD_STEP_ACTION
            });
          }
        }, Liferay.Language.get('add-new-action')), secondaryAction && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("label", {
          className: "ml-3 outline-text text-secondary"
        }, Liferay.Language.get('secondary-action')), /*#__PURE__*/_react.default.createElement(_form.default.Group, {
          className: "form-group-outlined mt-4 pb-2"
        }, /*#__PURE__*/_react.default.createElement("label", {
          className: "mt-3"
        }, Liferay.Language.get('action-name')), /*#__PURE__*/_react.default.createElement(_form.ClayInput, {
          maxLength: "50",
          onChange: function onChange(event) {
            return onChangeActionName(event, false);
          },
          type: "text",
          value: secondaryAction.name
        }), /*#__PURE__*/_react.default.createElement("label", {
          className: "mt-3"
        }, Liferay.Language.get('transition-to')), /*#__PURE__*/_react.default.createElement(_button.default, {
          className: "clearfix disabled w-100",
          displayType: "secondary"
        }, /*#__PURE__*/_react.default.createElement("span", {
          className: "float-left text-left text-truncate w90"
        }, Liferay.Language.get('previous-step')), /*#__PURE__*/_react.default.createElement(_icon.default, {
          className: "dropdown-button-asset float-right",
          symbol: "caret-bottom"
        })), /*#__PURE__*/_react.default.createElement("div", {
          className: "text-right"
        }, /*#__PURE__*/_react.default.createElement(_button.default, {
          className: "border-0 mt-2",
          displayType: "secondary",
          onClick: function onClick() {
            return dispatchConfig({
              type: _configReducer.REMOVE_STEP_ACTION
            });
          },
          small: true
        }, Liferay.Language.get('remove'))))))
      );
    }
    //# sourceMappingURL=ActionsTab.es.js.map
  }
});
//# sourceMappingURL=ActionsTab.es.js.map