"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
exports.uuid = uuid;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _steps = _interopRequireDefault(require("antd/lib/steps"));
var React = _interopRequireWildcard(require("react"));
require("./index.less");
var _excluded = ["style", "steps", "flag"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
var Step = _steps["default"].Step;
var description = 'This is a description.';
var item = [{
  title: 'Finished',
  description: description,
  icon: 'add'
}, {
  title: 'In Progress',
  description: description,
  subTitle: 'Left 00:00:08'
}, {
  title: 'Waiting',
  description: description
}];
var antSteps = function antSteps(_ref) {
  var style = _ref.style,
    steps = _ref.steps,
    flag = _ref.flag,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  var _useState = (0, React.useState)(item),
    items = _useState[0],
    setItems = _useState[1];
  (0, React.useEffect)(function () {
    setItems(steps);
  }, [steps]);
  var _useState2 = (0, React.useState)(''),
    ID = _useState2[0],
    setID = _useState2[1];
  (0, React.useEffect)(function () {
    setID("steps_" + uuid());
  }, []);
  return /*#__PURE__*/React.createElement(_steps["default"], (0, _extends2["default"])({
    id: ID
  }, otherProps, {
    style: (0, _extends2["default"])({}, style, {
      display: flag ? 'none' : ''
    })
  }), items === null || items === void 0 ? void 0 : items.map(function (item, index) {
    return /*#__PURE__*/React.createElement(Step, {
      title: item.title,
      description: item.description,
      subTitle: item.subTitle,
      key: index
    });
  }));
};
antSteps.displayName = 'antSteps';
var _default = antSteps;
exports["default"] = _default;
function uuid() {
  return (Math.random() * 1e6 >> 0).toString(36);
}