Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/components/performance-by-step-page/PerformanceByStepPageTable.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/table', 'frontend-js-react-web$react', '../../shared/components/list/ListHeadItem.es', '../../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 _table = _interopRequireDefault(require("@frontend-taglib-clay$clayui/table"));

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

    var _ListHeadItem = _interopRequireDefault(require("../../shared/components/list/ListHeadItem.es"));

    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 (/*#__PURE__*/_react.default.createElement(_table.default.Row, null, /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          className: "table-title"
        }, label), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          className: "text-right"
        }, (0, _util.isValidNumber)(breachedInstanceCount) ? breachedInstanceCount : 0, ' ', "(", formattedPercentage, ")"), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          className: "text-right"
        }, formattedDuration))
      );
    };

    var Table = function Table(_ref2) {
      var items = _ref2.items;
      return (/*#__PURE__*/_react.default.createElement(_table.default, null, /*#__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: '60%'
          }
        }, Liferay.Language.get('step-name')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          className: "text-right",
          headingCell: true,
          style: {
            width: '20%'
          }
        }, /*#__PURE__*/_react.default.createElement(_ListHeadItem.default, {
          name: "breachedInstancePercentage",
          title: Liferay.Language.get('sla-breached-percent')
        })), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          className: "text-right",
          headingCell: true,
          style: {
            width: '20%'
          }
        }, /*#__PURE__*/_react.default.createElement(_ListHeadItem.default, {
          name: "durationAvg",
          title: Liferay.Language.get('average-completion-time')
        })))), /*#__PURE__*/_react.default.createElement(_table.default.Body, null, items.map(function (item, index) {
          return (/*#__PURE__*/_react.default.createElement(Table.Item, _extends({}, item, {
              key: index
            }))
          );
        })))
      );
    };

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