Liferay.Loader.define("portal-workflow-metrics-web@2.0.59/js/components/filter/RoleFilter.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', '../../shared/components/filter/Filter.es', '../../shared/components/filter/hooks/useFilterFetch.es', '../../shared/components/filter/hooks/useFilterName.es', '../../shared/components/filter/util/filterConstants.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

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

    var _Filter = _interopRequireDefault(require("../../shared/components/filter/Filter.es"));

    var _useFilterFetch2 = require("../../shared/components/filter/hooks/useFilterFetch.es");

    var _useFilterName = require("../../shared/components/filter/hooks/useFilterName.es");

    var _filterConstants = _interopRequireDefault(require("../../shared/components/filter/util/filterConstants.es"));

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

    function _extends() {
      _extends = Object.assign || function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }return target;
      };return _extends.apply(this, arguments);
    }

    function ownKeys(object, enumerableOnly) {
      var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
        });keys.push.apply(keys, symbols);
      }return keys;
    }

    function _objectSpread(target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {
          ownKeys(Object(source), true).forEach(function (key) {
            _defineProperty(target, key, source[key]);
          });
        } else if (Object.getOwnPropertyDescriptors) {
          Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
        } else {
          ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
          });
        }
      }return target;
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    var RoleFilter = function RoleFilter(_ref) {
      var _ref$completed = _ref.completed,
          completed = _ref$completed === void 0 ? false : _ref$completed,
          className = _ref.className,
          _ref$filterKey = _ref.filterKey,
          filterKey = _ref$filterKey === void 0 ? _filterConstants.default.roles.key : _ref$filterKey,
          _ref$options = _ref.options,
          options = _ref$options === void 0 ? {} : _ref$options,
          _ref$prefixKey = _ref.prefixKey,
          prefixKey = _ref$prefixKey === void 0 ? '' : _ref$prefixKey,
          processId = _ref.processId;
      options = _objectSpread({
        hideControl: false,
        multiple: true,
        position: 'left',
        withSelectionTitle: false,
        withoutRouteParams: false
      }, options);

      var _useFilterFetch = (0, _useFilterFetch2.useFilterFetch)(_objectSpread({
        filterKey: filterKey,
        labelPropertyName: 'name',
        prefixKey: prefixKey,
        propertyKey: 'id',
        requestUrl: "/processes/".concat(processId, "/roles?completed=").concat(completed)
      }, options)),
          items = _useFilterFetch.items,
          selectedItems = _useFilterFetch.selectedItems;

      var filterName = (0, _useFilterName.useFilterName)(options.multiple, selectedItems, Liferay.Language.get('role'), options.withSelectionTitle);
      return (/*#__PURE__*/_react.default.createElement(_Filter.default, _extends({
          elementClasses: className,
          filterKey: filterKey,
          items: items,
          name: filterName,
          prefixKey: prefixKey
        }, options))
      );
    };

    var _default = RoleFilter;
    exports.default = _default;
    //# sourceMappingURL=RoleFilter.es.js.map
  }
});
//# sourceMappingURL=RoleFilter.es.js.map