function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
import React, { memo } from 'react';
import InfiniteScroll from 'react-infinite-scroll-component';
import { Skeleton } from 'antd';
import PisellCheckboxGroup from "../pisellCheckboxGroup";
import PisellWalletPassCard from "../pisellWalletPassCard";
import PisellEmpty from "../pisellEmpty";
/**
 * 卡列表组件
 * @param props
 * @constructor
 */
var PisellCardList = function PisellCardList(props) {
  var data = props.data,
    _props$loadMoreData = props.loadMoreData,
    loadMoreData = _props$loadMoreData === void 0 ? function () {} : _props$loadMoreData,
    endMessage = props.endMessage,
    loader = props.loader,
    hasMore = props.hasMore,
    onChange = props.onChange,
    value = props.value,
    mode = props.mode,
    showName = props.showName,
    showCode = props.showCode,
    showCover = props.showCover,
    showDetail = props.showDetail,
    showBalance = props.showBalance,
    showRedeem = props.showRedeem,
    showQrCode = props.showQrCode,
    showStoreName = props.showStoreName,
    showValidDate = props.showValidDate,
    empty = props.empty,
    showEmpty = props.showEmpty,
    showBalanceSymbol = props.showBalanceSymbol;
  return /*#__PURE__*/React.createElement(InfiniteScroll, {
    dataLength: data.length,
    next: loadMoreData,
    hasMore: hasMore,
    loader: loader || /*#__PURE__*/React.createElement(Skeleton, {
      paragraph: {
        rows: 3
      },
      active: true
    }),
    endMessage: endMessage,
    scrollableTarget: "scrollableDiv"
  }, data.length ? /*#__PURE__*/React.createElement(PisellCheckboxGroup, {
    options: data,
    value: value,
    mode: mode,
    rowKey: "id",
    gap: 12,
    onChange: onChange,
    iconPosition: "hide",
    renderOption: function renderOption(item, active) {
      return /*#__PURE__*/React.createElement(PisellWalletPassCard, _extends({}, item, {
        active: active,
        showName: showName || (item === null || item === void 0 ? void 0 : item.showName),
        showBalance: showBalance || (item === null || item === void 0 ? void 0 : item.showBalance),
        showCode: showCode || (item === null || item === void 0 ? void 0 : item.showCode),
        showCover: showCover || (item === null || item === void 0 ? void 0 : item.showCover),
        showDetail: showDetail || (item === null || item === void 0 ? void 0 : item.showDetail),
        showQrCode: showQrCode || (item === null || item === void 0 ? void 0 : item.showQrCode),
        showRedeem: showRedeem || (item === null || item === void 0 ? void 0 : item.showRedeem),
        showStoreName: showStoreName || (item === null || item === void 0 ? void 0 : item.showStoreName),
        showValidDate: showValidDate || (item === null || item === void 0 ? void 0 : item.showValidDate),
        showBalanceSymbol: showBalanceSymbol || (item === null || item === void 0 ? void 0 : item.showBalanceSymbol)
      }));
    }
  }) : showEmpty && (empty || /*#__PURE__*/React.createElement(PisellEmpty, null)));
};
export default /*#__PURE__*/memo(PisellCardList);