import React__default from 'react';
import ImageView from './ImageView/index.js';
import IconFont from './IconFont/index.js';

/**
 * @desc 单一图片卡片
 * @param {boolean} active 是否选中
 * @param {boolean} hoverScale 图片hover是否需要放大
 * @param {string} imgUrl 图片地址
 * @param {string} relativeIcon 关联图标
 * @param {node} checkboxItem checkbox
 */
const ImageCard = props => {
  let {
    active = false,
    hoverScale = false,
    imgUrl = '',
    relativeIcon = '',
    checkboxItem = undefined,
    imageNum,
    hasImageNum
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: `lm-card-image-box ${active ? 'active' : ''} ${hoverScale && imgUrl ? 'img-hover-scale' : ''}`
  }, hasImageNum && /*#__PURE__*/React__default.createElement("span", {
    className: "image-box-number"
  }, imageNum), /*#__PURE__*/React__default.createElement(ImageView, {
    src: imgUrl || "/micro-apps/micro-dep-librarys/images/error/image-unupload.png",
    defaultSrc: "/micro-apps/micro-dep-librarys/images/error/image-over.png"
  }), relativeIcon && /*#__PURE__*/React__default.createElement(IconFont, {
    className: "relative-icon",
    type: relativeIcon
  }), checkboxItem);
};

/**
 * @desc 单列卡片
 * @param {boolean} active 是否选中
 * @param {function} click 回调
 * @param {node} children 卡片信息
 * @param {array} sourceData 卡片数据
 */
const BaseCard = props => {
  const {
    active,
    click,
    children,
    sourceData,
    className
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: `lm-base-card ${active ? "active" : ""} ${className}`,
    onClick: e => click && click(sourceData, e)
  }, /*#__PURE__*/React__default.createElement(ImageCard, props), children);
};

/**
 * @desc 单列卡片
 * @param {array} data 卡片数据 [{info,icon}]
 * @param {string} icon 图标
 * @param {string} info 信息
 * @param {node} children 子组件
 * @param {node} outChildren 加在卡片子级的子组件
 */
const SingleColumnCard = props => {
  const {
    data = [],
    children,
    outChildren
  } = props;
  return /*#__PURE__*/React__default.createElement(BaseCard, props, /*#__PURE__*/React__default.createElement("div", {
    className: "lm-base-card-info"
  }, data.map((item, i) => /*#__PURE__*/React__default.createElement("div", {
    className: "info",
    key: `info${i}`
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: item.icon
  }), /*#__PURE__*/React__default.createElement("span", {
    className: "ellipsis",
    title: item.info
  }, item.info))), children), outChildren);
};

export { BaseCard as B, ImageCard as I, SingleColumnCard as S };
//# sourceMappingURL=index-dd375369.js.map
