Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/components/sla/list-page/SLAListPageTable.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/table', 'frontend-js-react-web$react', './SLAListPageTableItem.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.Table = void 0;

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

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

    var _SLAListPageTableItem = require("./SLAListPageTableItem.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 _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);
    }

    var Table = function Table(_ref) {
      var items = _ref.items;
      var blockedItems = (0, _react.useMemo)(function () {
        return items.filter(function (_ref2) {
          var status = _ref2.status;
          return status === 2;
        });
      }, [items]);
      var showBlockedDivider = blockedItems.length > 0;
      var unblockedItems = (0, _react.useMemo)(function () {
        return items.filter(function (_ref3) {
          var status = _ref3.status;
          return status !== 2;
        });
      }, [items]);
      var showRunningDivider = showBlockedDivider && unblockedItems.length > 0;
      return (/*#__PURE__*/_react.default.createElement(_table.default, {
          className: "table-responsive"
        }, /*#__PURE__*/_react.default.createElement(_table.default.Head, null, /*#__PURE__*/_react.default.createElement(_table.default.Row, null, /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            width: '27%'
          }
        }, Liferay.Language.get('sla-name')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            width: '24%'
          }
        }, Liferay.Language.get('description')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            width: '17%'
          }
        }, Liferay.Language.get('status')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            width: '17%'
          }
        }, Liferay.Language.get('duration')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            width: '25%'
          }
        }, Liferay.Language.get('last-modified')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, null))), /*#__PURE__*/_react.default.createElement(_table.default.Body, null, showBlockedDivider && /*#__PURE__*/_react.default.createElement(_table.default.Row, {
          className: "table-divider"
        }, /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          colSpan: "9"
        }, Liferay.Language.get('blocked').toUpperCase())), blockedItems.map(function (sla, index) {
          return (/*#__PURE__*/_react.default.createElement(Table.Item, _extends({}, sla, {
              key: "blocked_".concat(index),
              status: 2
            }))
          );
        }), showRunningDivider && /*#__PURE__*/_react.default.createElement(_table.default.Row, {
          className: "table-divider"
        }, /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          colSpan: "9"
        }, Liferay.Language.get('running').toUpperCase())), unblockedItems.map(function (sla, index) {
          return (/*#__PURE__*/_react.default.createElement(Table.Item, _extends({}, sla, {
              key: "unblocked_".concat(index)
            }))
          );
        })))
      );
    };

    exports.Table = Table;
    Table.Item = _SLAListPageTableItem.Item;
    //# sourceMappingURL=SLAListPageTable.es.js.map
  }
});
//# sourceMappingURL=SLAListPageTable.es.js.map