Liferay.Loader.define("portal-workflow-metrics-web@2.0.42/js/components/process-metrics/performance-by-step-card/PerformanceByStepCardTable.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', '../../../shared/util/duration.es', '../../../shared/util/util.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.Table = void 0;

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

    var _duration = require("../../../shared/util/duration.es");

    var _util = require("../../../shared/util/util.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);
    }

    var Item = function Item(_ref) {
      var breachedInstanceCount = _ref.breachedInstanceCount,
          breachedInstancePercentage = _ref.breachedInstancePercentage,
          durationAvg = _ref.durationAvg,
          label = _ref.node.label;
      var formattedDuration = (0, _duration.formatDuration)(durationAvg);
      var formattedPercentage = (0, _util.getFormattedPercentage)(breachedInstancePercentage, 100);
      return _react["default"].createElement("tr", null, _react["default"].createElement("td", {
        className: "table-cell-expand",
        "data-testid": "stepName"
      }, label), _react["default"].createElement("td", {
        className: "text-right",
        "data-testid": "slaBreached"
      }, (0, _util.isValidNumber)(breachedInstanceCount) ? breachedInstanceCount : 0, ' ', "(", formattedPercentage, ")"), _react["default"].createElement("td", {
        className: "text-right",
        "data-testid": "avgCompletionTime"
      }, formattedDuration));
    };

    var Table = function Table(_ref2) {
      var _ref2$items = _ref2.items,
          items = _ref2$items === void 0 ? [] : _ref2$items;
      return _react["default"].createElement("div", {
        className: "mb-3 table-responsive table-scrollable"
      }, _react["default"].createElement("table", {
        className: "table table-autofit table-heading-nowrap table-hover table-list"
      }, _react["default"].createElement("thead", null, _react["default"].createElement("tr", null, _react["default"].createElement("th", {
        style: {
          width: '60%'
        }
      }, Liferay.Language.get('step-name')), _react["default"].createElement("th", {
        className: "text-right",
        style: {
          width: '20%'
        }
      }, Liferay.Language.get('sla-breached-percent')), _react["default"].createElement("th", {
        className: "text-right",
        style: {
          width: '20%'
        }
      }, Liferay.Language.get('average-completion-time')))), _react["default"].createElement("tbody", null, items.map(function (item, index) {
        return _react["default"].createElement(Table.Item, _extends({}, item, {
          key: index
        }));
      }))));
    };

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