var _excluded = ["selectProps"];
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); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { Select } from 'antd';
import { Context } from "../../info/model";
import React, { useCallback, useMemo, useContext } from 'react';
import useSelectPet from "../../info/service2/hooks/useSelectPet";
var Holder = function Holder(props) {
  var _state$pet;
  var selectProps = props.selectProps,
    resetProps = _objectWithoutProperties(props, _excluded);
  var _useContext = useContext(Context),
    state = _useContext.state;
  var _useSelectPet = useSelectPet(state),
    holderLists = _useSelectPet.holderLists;

  /**
   * @title: holders数据
   * @description:
   * @param {*} useMemo
   * @return {*}
   * @Author: WangHan
   * @Date: 2024-12-02 22:30
   */
  var holders = useMemo(function () {
    var lists = holderLists === null || holderLists === void 0 ? void 0 : holderLists.filter(function (d) {
      return ((d === null || d === void 0 ? void 0 : d.id) || (d === null || d === void 0 ? void 0 : d.form_record_id)) > 0;
    });
    if (!(lists !== null && lists !== void 0 && lists.length)) return [];
    return lists.map(function (d) {
      return {
        value: (d === null || d === void 0 ? void 0 : d.id) || (d === null || d === void 0 ? void 0 : d.form_record_id),
        label: d === null || d === void 0 ? void 0 : d.main_field
      };
    });
  }, [state === null || state === void 0 || (_state$pet = state.pet) === null || _state$pet === void 0 ? void 0 : _state$pet.value]);
  var renderOptions = useCallback(function (array) {
    var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
    var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
    return array.map(function (d) {
      return /*#__PURE__*/React.createElement(Select.Option, {
        value: d[value],
        key: d[value],
        disabled: d.disabled
      }, d[label]);
    });
  }, []);
  return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), renderOptions(holders));
};
export default Holder;