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";
import "./index.less";
/**
 * 卡列表组件
 * @param props
 * @constructor
 */
var PisellCardList = function PisellCardList(props) {
  var _props$data = props.data,
    data = _props$data === void 0 ? [] : _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,
    _props$direction = props.direction,
    direction = _props$direction === void 0 ? 'vertical' : _props$direction,
    fullWidth = props.fullWidth,
    type = props.type,
    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,
    onChangeDebounce = props.onChangeDebounce,
    showStatus = props.showStatus,
    nameTitleStyle = props.nameTitleStyle,
    enableEditAmount = props.enableEditAmount,
    useExternalDetail = props.useExternalDetail,
    onDetail = props.onDetail,
    formatBalance = props.formatBalance,
    formatBalanceTitle = props.formatBalanceTitle,
    formatRedeem = props.formatRedeem,
    formatRedeemTitle = props.formatRedeemTitle,
    onBeforeEditAmount = props.onBeforeEditAmount,
    onItemClick = props.onItemClick,
    showActiveBackground = props.showActiveBackground,
    validDateBySchedule = props.validDateBySchedule,
    scheduleList = props.scheduleList;
  return data.length ? /*#__PURE__*/React.createElement(PisellCheckboxGroup, {
    options: data,
    value: value,
    mode: mode,
    direction: direction,
    rowKey: "id",
    gap: 12,
    onChange: onChange,
    iconPosition: "hide",
    fullWidth: fullWidth,
    onChangeDebounce: onChangeDebounce,
    onItemClick: onItemClick,
    showActiveBackground: showActiveBackground,
    renderOption: function renderOption(item, active, index) {
      return /*#__PURE__*/React.createElement(PisellWalletPassCard, _extends({}, item, {
        active: active,
        mode: mode,
        showActiveIcon: true,
        showStatus: showStatus || (item === null || item === void 0 ? void 0 : item.showStatus),
        cardStatus: item === null || item === void 0 ? void 0 : item.cardStatus,
        nameTitleStyle: nameTitleStyle || (item === null || item === void 0 ? void 0 : item.nameTitleStyle),
        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),
        showActions: props.showActions || (item === null || item === void 0 ? void 0 : item.showActions),
        actions: props.actions || (item === null || item === void 0 ? void 0 : item.actions),
        enableEditAmount: enableEditAmount || (item === null || item === void 0 ? void 0 : item.enableEditAmount),
        useExternalDetail: useExternalDetail || (item === null || item === void 0 ? void 0 : item.useExternalDetail),
        onDetail: function onDetail(record) {
          var _props$onDetail;
          return props === null || props === void 0 || (_props$onDetail = props.onDetail) === null || _props$onDetail === void 0 ? void 0 : _props$onDetail.call(props, record, index);
        },
        validDateBySchedule: validDateBySchedule || (item === null || item === void 0 ? void 0 : item.validDateBySchedule),
        scheduleList: scheduleList || (item === null || item === void 0 ? void 0 : item.scheduleList),
        beforeEdit: function beforeEdit(record) {
          var _props$beforeEdit;
          return props === null || props === void 0 || (_props$beforeEdit = props.beforeEdit) === null || _props$beforeEdit === void 0 ? void 0 : _props$beforeEdit.call(props, record, index);
        },
        onConfirmEditAmount: function onConfirmEditAmount(value) {
          var _props$onConfirmEditA;
          (_props$onConfirmEditA = props.onConfirmEditAmount) === null || _props$onConfirmEditA === void 0 || _props$onConfirmEditA.call(props, value, index, item);
        },
        onConfirmEdit: function onConfirmEdit(newVal) {
          var _props$onConfirmEdit;
          (_props$onConfirmEdit = props.onConfirmEdit) === null || _props$onConfirmEdit === void 0 || _props$onConfirmEdit.call(props, newVal, index, item);
        },
        formatBalance: formatBalance || (item === null || item === void 0 ? void 0 : item.formatBalance),
        formatBalanceTitle: formatBalanceTitle || (item === null || item === void 0 ? void 0 : item.formatBalanceTitle),
        type: type,
        style: direction === 'vertical' || direction === 'horizontal' && fullWidth ? {
          width: '100%'
        } : {},
        formatRedeem: formatRedeem || (item === null || item === void 0 ? void 0 : item.formatRedeem),
        formatRedeemTitle: formatRedeemTitle || (item === null || item === void 0 ? void 0 : item.formatRedeemTitle),
        onBeforeEditAmount: function onBeforeEditAmount(record) {
          var _props$onBeforeEditAm;
          return props === null || props === void 0 || (_props$onBeforeEditAm = props.onBeforeEditAmount) === null || _props$onBeforeEditAm === void 0 ? void 0 : _props$onBeforeEditAm.call(props, record, index, item);
        }
      }));
    }
  }) : showEmpty && (empty || /*#__PURE__*/React.createElement(PisellEmpty, null));
};
export default /*#__PURE__*/memo(PisellCardList);