import React__default from 'react';
import { Radio, Row, Col, Tooltip } from 'antd';
import FormCollapsedLayout from '../FormCollapsedLayout/index.js';
import '../Title/index.js';
import '../IconFont/index.js';
import '../_rollupPluginBabelHelpers-736b301a.js';
import '@zenview/micro-utils';
import '../BetweenBox/index.js';

const RadioGroup = Radio.Group;

// showMore 显示更多 收起时只展示3行
const RadioGroupFilter = ({
  className = '',
  icon,
  title,
  sourceData = [],
  renderExtraTip,
  maxLength = 9,
  titleExt,
  value,
  onChange
}) => {
  return /*#__PURE__*/React__default.createElement(FormCollapsedLayout, {
    className: `lm-filter-radio-group-wrapper ${className}`,
    visibleCollapsed: sourceData.length > maxLength,
    title: title,
    icon: icon,
    titleExt: titleExt
  }, /*#__PURE__*/React__default.createElement(FromRadioGroupFilter, {
    renderExtraTip: renderExtraTip,
    value: value,
    onChange: onChange,
    sourceData: sourceData,
    maxLength: maxLength
  }));
};
function FromRadioGroupFilter({
  renderExtraTip,
  value,
  onChange,
  isCollapsed,
  sourceData,
  maxLength
}) {
  return /*#__PURE__*/React__default.createElement(RadioGroup, {
    value: value,
    onChange: e => onChange(e.target.value)
  }, /*#__PURE__*/React__default.createElement(Row, {
    gutter: 8,
    className: `radio-row ${isCollapsed ? 'collapsed' : ''}`
  }, sourceData.map((v, i) => {
    return /*#__PURE__*/React__default.createElement(Col, {
      key: v.value,
      style: i > maxLength - 1 && isCollapsed ? {
        display: 'none'
      } : {}
    }, /*#__PURE__*/React__default.createElement(Tooltip, {
      title: v.label
    }, /*#__PURE__*/React__default.createElement(Radio, {
      value: v.value,
      disabled: !!v.disabled
    }, renderExtraTip && renderExtraTip(v), /*#__PURE__*/React__default.createElement("span", null, v.label))));
  })));
}

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