import { _ as _extends } from '../_rollupPluginBabelHelpers-736b301a.js';
import React__default from 'react';
import { formatTimeStamp } from '@zenview/micro-utils';
import { S as SingleColumnCard } from '../index-dd375369.js';
import Drawer from '../Drawer/index.js';
import CBox from '../CBox/index.js';
import '../ImageView/index.js';
import '../IconFont/index.js';
import 'antd';

/**
 * @desc 关系图谱各种详情
 * @param {} singleCard 是否是单列卡片
 * @param {Array} dataList 列表 [{desc:'2019.08.13 (共经过 3次)',list:[]}]
 */

const TimeLine = props => {
  let {
    dataList,
    singleCard = true,
    jumpDetail,
    jumpTogetherDetail,
    onClose
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "time-line"
  }, !!dataList.length && dataList.map((item, j) => /*#__PURE__*/React__default.createElement("div", {
    className: "time-case",
    key: `case${j}`
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "case-header"
  }, item.desc), /*#__PURE__*/React__default.createElement("div", {
    className: "case-content"
  }, singleCard && item.list.map((v, k) => /*#__PURE__*/React__default.createElement("div", {
    className: "detail-box-item",
    key: v.aid + k
  }, getCard({
    item: v,
    list: item.list,
    jumpDetail,
    onClose
  }))), !singleCard && item.list.reverse().map((v, index) => {
    return /*#__PURE__*/React__default.createElement("div", {
      key: `card${index}`,
      className: "case-content-double"
    }, v.map((x, k) => {
      return /*#__PURE__*/React__default.createElement("div", {
        className: "detail-box-item",
        key: x.aid || x.captureId
      }, getCard({
        item: x,
        list: item.list,
        jumpDetail: jumpTogetherDetail,
        onClose
      }));
    }));
  })))));
};
const getCard = ({
  item,
  list,
  jumpDetail,
  onClose
}) => {
  let {
    deviceName,
    captureTime,
    imgUrl
  } = item;
  return /*#__PURE__*/React__default.createElement(SingleColumnCard, {
    sourceData: item,
    click: () => {
      onClose();
      jumpDetail({
        item,
        list
      });
    },
    imgUrl: imgUrl,
    data: [{
      info: deviceName || '暂无',
      icon: 'icon-S_Bar_Add'
    }, {
      info: formatTimeStamp(captureTime) || '暂无',
      icon: 'icon-S_Edit_ClockEnd'
    }]
  });
};

// import { Drawer,CBox } from "micro-components";

/**
 * @desc 关系图谱各种详情
 * @param {} title 同行详情
 * @param {} visible 抽屉状态
 * @param {} onClose 关闭抽屉
 * @param {} width 抽屉宽度
 * @param {} card 头部卡片 <Card />
 * @param {} dataDesc 数据汇总描述 <p><icon />同行次数：5次</p>
 * @param {} hasTimeLine 是否需要时间线 true
 * @param {} singleCard 是否是单列卡片 true
 * @param {} children 拓展
 * @param {Array} dataList 列表 格式如下
 * 单列卡片[{desc:'2019.08.13 (共经过 3次)',list:[{aid,captureTime,deviceName}]}]
 * 并列卡片[{desc:'2019.08.13 (共经过 3次)',list:[[{aid,captureTime,deviceName},{aid,captureTime,deviceName}]]
 */

const RelationsDrawer = props => {
  const {
    width = '800px',
    card,
    dataDesc,
    hasTimeLine = true,
    dataList,
    singleCard,
    children,
    onClose,
    jumpDetail,
    jumpTogetherDetail,
    ...rest
  } = props;
  return /*#__PURE__*/React__default.createElement(Drawer, _extends({
    hasFooter: false,
    width: width,
    onClose: onClose
  }, rest), /*#__PURE__*/React__default.createElement(CBox, {
    style: {
      display: 'flex',
      flexDirection: 'column'
    }
  }, card, dataDesc, hasTimeLine && /*#__PURE__*/React__default.createElement(TimeLine, {
    onClose: onClose,
    title: props.title,
    jumpDetail: jumpDetail,
    jumpTogetherDetail: jumpTogetherDetail,
    dataList: dataList,
    singleCard: singleCard
  }), children));
};

export { RelationsDrawer as default };
//# sourceMappingURL=index.js.map
