function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
// @ts-nocheck
import React, { useContext, useEffect, useRef, useState, useMemo, useCallback, useImperativeHandle } from 'react';
import { Form, Button } from 'antd';
import RenderItemGroup from "../FormComp/RenderItemGroup";
import { UtilValueFormat } from "../utils";
import ButtonGroup from "../ButtonGroup/";
import { general } from "../data/";
import "./style/index.less";
import { FanContext } from "../ConfigContext";
import dayjs from "dayjs";
import useStyle from "./style/FilterStyle";
import SpecIcon from "../SpecIcon";
var FormItem = Form.Item;
var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var _filterFormRef$curren4;
  var InitFanContext = useContext(FanContext);
  var providerConfig = InitFanContext['StandardFilter'] || {}; // 使用上下文（全局配置）设置扩展的配置项
  var _providerConfig$props = _objectSpread(_objectSpread({}, providerConfig), props),
    _providerConfig$props2 = _providerConfig$props.formItemGroup,
    formItemGroup = _providerConfig$props2 === void 0 ? [] : _providerConfig$props2,
    itemGroupConfig = _providerConfig$props.itemGroupConfig,
    initialValues = _providerConfig$props.initialValues,
    getFormFields = _providerConfig$props.getFormFields,
    onFilterSearch = _providerConfig$props.onFilterSearch,
    onFilterReset = _providerConfig$props.onFilterReset,
    className = _providerConfig$props.className,
    style = _providerConfig$props.style,
    _providerConfig$props3 = _providerConfig$props.buttonGroup,
    buttonGroup = _providerConfig$props3 === void 0 ? [] : _providerConfig$props3,
    _providerConfig$props4 = _providerConfig$props.buttonGroupConfig,
    buttonGroupConfig = _providerConfig$props4 === void 0 ? {} : _providerConfig$props4,
    min = _providerConfig$props.min,
    codes = _providerConfig$props.codes,
    permissionCodes = _providerConfig$props.permissionCodes,
    confirmText = _providerConfig$props.confirmText,
    cancelText = _providerConfig$props.cancelText,
    _providerConfig$props5 = _providerConfig$props.confirmButtonProps,
    confirmButtonProps = _providerConfig$props5 === void 0 ? {} : _providerConfig$props5,
    _providerConfig$props6 = _providerConfig$props.cancelButtonProps,
    cancelButtonProps = _providerConfig$props6 === void 0 ? {} : _providerConfig$props6,
    filterButtonColSpan = _providerConfig$props.filterButtonColSpan,
    filterButtonConfig = _providerConfig$props.filterButtonConfig,
    _providerConfig$props7 = _providerConfig$props.formLayout,
    formLayout = _providerConfig$props7 === void 0 ? 'inline' : _providerConfig$props7,
    _providerConfig$props8 = _providerConfig$props.gridLayout,
    gridLayout = _providerConfig$props8 === void 0 ? 'inline' : _providerConfig$props8,
    _providerConfig$props9 = _providerConfig$props.buttonGroupPlacement,
    buttonGroupPlacement = _providerConfig$props9 === void 0 ? 'left' : _providerConfig$props9,
    filterFormStyle = _providerConfig$props.filterFormStyle,
    filterBtnsStyle = _providerConfig$props.filterBtnsStyle,
    _providerConfig$props10 = _providerConfig$props.colon,
    colon = _providerConfig$props10 === void 0 ? true : _providerConfig$props10,
    dateFormatter = _providerConfig$props.dateFormatter,
    _providerConfig$props11 = _providerConfig$props.collapseable,
    collapseable = _providerConfig$props11 === void 0 ? false : _providerConfig$props11,
    parseTransform = _providerConfig$props.parseTransform,
    _providerConfig$props12 = _providerConfig$props.forceListener,
    forceListener = _providerConfig$props12 === void 0 ? true : _providerConfig$props12;
  var filterFormRef = useRef();
  // ref 的转发
  useImperativeHandle(ref, function () {
    return _objectSpread(_objectSpread({}, filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current), {}, {
      onSubmit: function onSubmit(values) {
        return handleSearch(values);
      }
    });
  });
  var _useState = useState([]),
    _useState2 = _slicedToArray(_useState, 2),
    reFormItemGroup = _useState2[0],
    setReFormItemGroup = _useState2[1];
  var _useState3 = useState(0),
    _useState4 = _slicedToArray(_useState3, 2),
    isHideCount = _useState4[0],
    setIsHideCount = _useState4[1]; // 表单隐藏项数量值
  var _useState5 = useState(0),
    _useState6 = _slicedToArray(_useState5, 2),
    additionalCount = _useState6[0],
    setAdditionalCount = _useState6[1]; // 根据表单项配置dipslay或者colSpan，额外需要计算在内的栅格占用
  var _useState7 = useState(false),
    _useState8 = _slicedToArray(_useState7, 2),
    collapsed = _useState8[0],
    setCollapsed = _useState8[1];
  var componentName = 'spec-standard-filter';
  var _useStyle = useStyle(componentName),
    _useStyle2 = _slicedToArray(_useStyle, 2),
    wrapSSR = _useStyle2[0],
    hashId = _useStyle2[1];
  var filterFormLayout = useMemo(function () {
    return formLayout || 'inline';
  }, [formLayout]);

  // 计算当前栅格数量，及对应的size
  var columnNumberAndSize = useMemo(function () {
    // 当前栅栅数量
    var itemGroupSize = (itemGroupConfig === null || itemGroupConfig === void 0 ? void 0 : itemGroupConfig.size) || (filterFormLayout === 'horizontal' ? 'xxlg' : 'md');
    if (itemGroupConfig !== null && itemGroupConfig !== void 0 && itemGroupConfig.columnCount) {
      // 有配置栅格数 1,2,3,4
      switch (itemGroupConfig === null || itemGroupConfig === void 0 ? void 0 : itemGroupConfig.columnCount) {
        case 1:
          itemGroupSize = 'sm';
          break;
        case 2:
          itemGroupSize = 'md';
          break;
        case 3:
          itemGroupSize = 'lg';
          break;
        case 4:
          itemGroupSize = 'xxlg';
          break;
      }
    }
    return {
      columnNumber: general.modalSize[itemGroupSize].columnNumber,
      itemGroupSize: itemGroupSize
    };
  }, [itemGroupConfig, filterFormLayout]);

  // 计算表单隐藏项(开启展开与收缩）
  var calculateHideCount = function calculateHideCount(filterFormRef, groups) {
    var _filterFormRef$curren;
    var itemGroupSize = columnNumberAndSize.itemGroupSize,
      columnNumber = columnNumberAndSize.columnNumber;
    var formValues = filterFormRef === null || filterFormRef === void 0 || (_filterFormRef$curren = filterFormRef.current) === null || _filterFormRef$curren === void 0 ? void 0 : _filterFormRef$curren.getFieldValue();
    // Rule1: 不包括isHidden跟isHide的数据
    // Rule2：剩余的表单项中，查找是否有自定义配置 display='block' 或者colSpan的表单项
    var notShowGroupItem = (groups || []).filter(function (item) {
      return (item === null || item === void 0 ? void 0 : item.isHidden) || (item.hasOwnProperty('isHide') ? item.isHide(_objectSpread({}, formValues), filterFormRef) : false);
    });
    // 可显示的表单值
    var showGroupItem = (groups || []).filter(function (item) {
      return !(item !== null && item !== void 0 && item.isHidden || (item.hasOwnProperty('isHide') ? item.isHide(_objectSpread({}, formValues), filterFormRef) : false));
    });
    var showGroupWithSetting = showGroupItem.filter(function (item) {
      return item.hasOwnProperty('colSpan');
    });
    var resultCount = notShowGroupItem.length;
    var aCount = 0; // 需要再次额外新增的数量
    if (showGroupWithSetting.length > 0) {
      showGroupWithSetting.forEach(function (gItem) {
        // colSpan 优先级更高
        if (gItem.hasOwnProperty('colSpan')) {
          // console.log('有配置了colSpan, 占用栅格数量', gItem.colSpan / (24 / columnNumber), '需要再额外减1', gItem.colSpan / (24 / columnNumber) - 1, Math.ceil(gItem.colSpan / (24 / columnNumber) - 1))
          aCount += Math.ceil(gItem.colSpan / (24 / columnNumber) - 1); // 额外占用了
          return;
        }
        // if (gItem.hasOwnProperty('display') && gItem.display === 'block' ) {
        //   // TODO.计算会有问题
        //   console.log('有配置了display=block', Math.ceil(24 / (24 / columnNumber) - 1))
        //   aCount += columnNumber -1 // Math.ceil(24 / (24 / columnNumber) - 1)  // 额外占用了
        // }
      });
    }
    setAdditionalCount(aCount);
    setIsHideCount(resultCount - aCount);
  };

  //  配置筛选按钮（确认与取消）
  var filterActionButtons = useMemo(function () {
    var itemGroupSize = columnNumberAndSize.itemGroupSize,
      columnNumber = columnNumberAndSize.columnNumber;
    // 计算扣除栅格列数是否还有多余的项，用来判断筛选按钮的版式（初始化的时候，可能会受默认值内配置的isHide影响导致计算错误;或自定义表单控件组栅格影响）
    // if (collapseable) {
    //   columnNumber = collapsed ? columnNumber : (columnNumber === 1 ? columnNumber = 2 : columnNumber)
    // }
    var calculateTimes = (reFormItemGroup.length - isHideCount) % columnNumber;
    // console.log('当前多余的数量', calculateTimes, '当前隐藏的控件数量isHideCount==>', isHideCount, itemGroupSize, 'columnNumber', columnNumber)
    // xs:1列  sm:1列   【span:24】
    // md:2列           【span:12】
    // lg:3列  xlg:3列  【span:8】
    // xxlg:4列         【span:6】
    if (!onFilterSearch && !onFilterReset) return [];
    return [_objectSpread(_objectSpread({
      label: '',
      type: 'custom',
      // display: 'block',
      filedName: 'filterAction',
      display: {
        wrapperCol: {
          // 占用的格子数按对应size配置的formItem,如果是md则单独使用筛选的栅格配置
          span: itemGroupSize === 'md' || itemGroupSize === 'lg' || itemGroupSize === 'xlg' ? general.modalSize[itemGroupSize].filterFormLayout.labelCol.span + general.modalSize[itemGroupSize].filterFormLayout.wrapperCol.span : general.modalSize[itemGroupSize].formLayout.labelCol.span + general.modalSize[itemGroupSize].formLayout.wrapperCol.span
        }
      },
      style: {
        // textAlign: 'right'
      },
      protoFormItem: {
        style: {
          textAlign: filterFormLayout === 'horizontal' ? 'right' : 'left'
        },
        className: filterFormLayout === 'horizontal' ? 'filter-action-right' : 'filter-action-left'
      },
      colSpan: filterButtonColSpan || 24 - calculateTimes * (24 / general.modalSize[itemGroupSize].columnNumber)
    }, filterButtonConfig), {}, {
      customRender: function customRender() {
        return /*#__PURE__*/React.createElement(FormItem, {
          noStyle: true
        }, onFilterReset && /*#__PURE__*/React.createElement(Button, _extends({
          type: "primary",
          onClick: handleReset,
          ghost: true
        }, cancelButtonProps), cancelText || '重置'), onFilterSearch && /*#__PURE__*/React.createElement(Button, _extends({
          type: "primary",
          style: {
            marginLeft: 8
          },
          htmlType: "submit"
        }, confirmButtonProps), confirmText || '查询'), filterFormLayout === 'horizontal' && collapseable && reFormItemGroup.length > columnNumberAndSize.columnNumber - 1 ? /*#__PURE__*/React.createElement(Button, {
          type: 'link',
          onClick: function onClick() {
            return setCollapsed(!collapsed);
          },
          style: {
            marginLeft: 8,
            paddingInlineStart: 0,
            paddingInlineEnd: 0
          }
        }, collapsed ? '收起' : '展开', /*#__PURE__*/React.createElement(SpecIcon, {
          noPrefix: true,
          name: collapsed ? 'speci-up' : 'speci-down'
        })) : null);
      }
    })];
  }, [confirmText, cancelText, filterFormLayout, reFormItemGroup, onFilterSearch, onFilterReset, columnNumberAndSize, filterFormRef, isHideCount, collapseable, collapsed]);

  // 更新表单控件值，用于外部获取当前表单实例(force是否强制清空表单)
  var updateFormFields = function updateFormFields(newVal, force) {
    var resetValues = {};
    if (force) {
      // this.filterFormRef.current.resetFields()
      // 先清空 再赋值
      resetValues = filterFormRef.current.getFieldsValue();
      Object.keys(resetValues).forEach(function (item) {
        resetValues[item] = undefined;
      });
    }
    var dateFieldTypes = ['datePicker', 'dateTimePicker', 'rangePicker', 'rangeTimePicker', 'timePicker', 'timePickerRange'];
    var filterDateFields = formItemGroup.filter(function (fItem) {
      return dateFieldTypes.includes(fItem.type);
    });
    if (parseTransform) {
      newVal = parseTransform(_objectSpread({}, newVal));
    }
    // 如果配置了dateFormatter='string'，则将默认对其他进行格式转换
    if (dateFormatter === 'string') {
      // 需要将字符串转换成日期格式
      filterDateFields.forEach(function (dItem) {
        if (newVal[dItem.filedName || dItem.fieldName]) {
          if (typeof newVal[dItem.filedName || dItem.fieldName] === 'string') {
            // console.log('将字符串转换成dayjs')
            newVal[dItem.filedName || dItem.fieldName] = dayjs(newVal[dItem.filedName || dItem.fieldName]);
          } else if (Array.isArray(newVal[dItem.filedName || dItem.fieldName])) {
            // console.log('将数组转换成dayjs数组')
            newVal[dItem.filedName || dItem.fieldName] = newVal[dItem.filedName || dItem.fieldName].map(function (valItem) {
              return typeof valItem === 'string' ? dayjs(valItem) : valItem;
            });
          } else {
            // console.log('其他情况', newVal[dItem.filedName] instanceof Date)
            // console.log('其他情况,当它是日期格式，则不进行转换')
          }
        }
      });
    }
    filterFormRef.current.setFieldsValue(_objectSpread(_objectSpread({}, resetValues), newVal || {})); // 直接清空表单的赋值
    forceUpdateForm();
  };
  // 强制更新表单值，用于赋初始化实例值
  var forceUpdateForm = useCallback(function () {
    var formValues = filterFormRef.current.getFieldsValue();
    if (Object.prototype.hasOwnProperty.call(formValues, false)) {
      delete formValues.false; // 自定义结构会莫名的出来一个false字段
    }
    calculateHideCount(filterFormRef, reFormItemGroup); // 更新当前表单数量，排除被隐藏的值
    if (getFormFields) getFormFields(formValues, filterFormRef);
  }, [reFormItemGroup, filterFormRef]);
  var handleSearch = function handleSearch(values) {
    if (Object.prototype.hasOwnProperty.call(values, false)) {
      delete values.false; // 自定义结构会莫名的出来一个false字段
    }
    var resultValues = UtilValueFormat(values, reFormItemGroup, dateFormatter);
    // reFormItemGroup里面有 transform，则筛选转换
    // console.log('格式化前数据', values)
    // console.log('格式化后数据', resultValues)
    if (onFilterSearch) {
      onFilterSearch(_objectSpread({}, resultValues));
    }
  };
  var handleReset = function handleReset() {
    // 使用此方法，表单校验无法清空掉
    // const resetValues = this.filterFormRef.current.getFieldsValue()
    // Object.keys(resetValues).forEach((item) => {
    //   resetValues[item] = undefined
    // })
    // this.filterFormRef.current.setFieldsValue({ ...resetValues }) // 直接清空表单的赋值
    filterFormRef.current.resetFields();
    setReFormItemGroup(formItemGroup); // 重新渲染列表
    calculateHideCount(filterFormRef, reFormItemGroup);
    if (onFilterReset) {
      var _filterFormRef$curren2;
      onFilterReset(filterFormRef === null || filterFormRef === void 0 || (_filterFormRef$curren2 = filterFormRef.current) === null || _filterFormRef$curren2 === void 0 ? void 0 : _filterFormRef$curren2.getFieldsValue());
    }
  };

  // 判断是否隐藏结构, display:'none'
  var setItemHiddenNode = function setItemHiddenNode(item, index, collapsed, showItemNumber) {
    // console.log('判断是否隐藏结构==>当前执行序号', index, showItemNumber)
    if (item.filedName === 'filterAction' || item.fieldName === 'filterAction') {
      return {
        isHidden: false
      };
    }
    return {
      // 栅格列为1时，显示1个表单项
      isHidden: collapsed ? false : showItemNumber === 0 ? index !== 0 : !(index < showItemNumber)
    };
  };
  // 渲染隐藏指定控件
  var itemIsHide = function itemIsHide(isHide, getFieldsValue, FormInstance) {
    if (typeof isHide === 'function') {
      return isHide(getFieldsValue, FormInstance, 'default');
    }
    return isHide || false;
  };
  var updateGroupByCollapsed = function updateGroupByCollapsed(groups, formValues) {
    // console.log('判断当前是否需要按展开与收缩显示对应的表单项')
    var showItemNumber = columnNumberAndSize.columnNumber - 1;
    return new Promise(function (resolve, reject) {
      if (Array.isArray(groups)) {
        resolve(groups.map(function (item, index) {
          if (collapseable && filterFormLayout === "horizontal") {
            var _setItemHiddenNode = setItemHiddenNode(item, index, collapsed, showItemNumber),
              isHidden = _setItemHiddenNode.isHidden;
            item.isHidden = isHidden;
            item.style = _objectSpread(_objectSpread({}, item.style || {}), {}, {
              display: item.isHidden ? 'none' : 'block'
            });
            if (item.hasOwnProperty('isHide') && itemIsHide(item.isHide, formValues, filterFormRef)) {
              showItemNumber++;
              item.isHidden = true;
              // console.log('当前是结构是隐藏未渲染,跳到下个序号', showItemNumber)
            }
          }
          return _objectSpread({}, item);
        }));
      } else {
        resolve(groups);
      }
    });
  };
  useEffect(function () {
    // 初始化表单数据数据
    if (collapseable && filterFormLayout === "horizontal") {
      var _filterFormRef$curren3;
      var formValues = filterFormRef === null || filterFormRef === void 0 || (_filterFormRef$curren3 = filterFormRef.current) === null || _filterFormRef$curren3 === void 0 ? void 0 : _filterFormRef$curren3.getFieldValue();
      updateGroupByCollapsed(formItemGroup, formValues).then(function (groups) {
        setReFormItemGroup(groups);
        calculateHideCount(filterFormRef, groups);
      });
    } else {
      setReFormItemGroup(formItemGroup);
    }
  }, [formItemGroup, collapseable, filterFormLayout, collapsed, columnNumberAndSize === null || columnNumberAndSize === void 0 ? void 0 : columnNumberAndSize.columnNumber, itemGroupConfig, filterFormRef, filterFormRef === null || filterFormRef === void 0 || (_filterFormRef$curren4 = filterFormRef.current) === null || _filterFormRef$curren4 === void 0 ? void 0 : _filterFormRef$curren4.getFieldValue()]);
  useEffect(function () {
    if (!forceListener) {
      if (initialValues && JSON.stringify(initialValues) !== '{}') {
        updateFormFields(initialValues, true);
      }
    }
  }, []);
  useEffect(function () {
    if (forceListener) {
      if (initialValues && JSON.stringify(initialValues) !== '{}') {
        updateFormFields(initialValues, true);
      }
    }
  }, [forceListener, initialValues]);
  // / 表单列表组 formItemGroup 类型为数组或者React.Node
  var renderFormItemGroup = function renderFormItemGroup() {
    if (Array.isArray(reFormItemGroup)) {
      // 数组则默认加上"确认与取消"按钮
      return /*#__PURE__*/React.createElement(RenderItemGroup, _extends({
        itemGroup: reFormItemGroup.concat(filterActionButtons),
        size: filterFormLayout === 'horizontal' ? 'xxlg' : 'md' // size决定栅格排列数量(4列排版）
        ,
        layout: filterFormLayout,
        form: filterFormRef,
        collapseable: collapseable,
        collapsed: collapsed,
        parentNode: 'standardFilter'
        // displayLayout={{labelCol: { span: 8 }, wrapperCol: { span: 16 },}}
        ,
        doUpdateFormFields: function doUpdateFormFields() {
          return forceUpdateForm();
        }
      }, itemGroupConfig));
    }
    return reFormItemGroup;
  };
  /**
   * 生成guid
   */
  var guid = function guid() {
    function S4() {
      return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
    }
    return "".concat(S4(), "-").concat(S4());
  };
  var renderButtonGroup = function renderButtonGroup() {
    return buttonGroup && buttonGroup.length > 0 ? /*#__PURE__*/React.createElement("div", {
      className: "filter-btns filter-btns-".concat(gridLayout, " filter-btns-").concat(gridLayout, "-").concat(buttonGroupPlacement),
      style: filterBtnsStyle
    }, /*#__PURE__*/React.createElement(ButtonGroup, _extends({
      options: buttonGroup,
      min: min,
      codes: codes,
      permissionCodes: permissionCodes
    }, buttonGroupConfig))) : null;
  };
  return wrapSSR( /*#__PURE__*/React.createElement(Form, {
    name: 'standard-filter-form-' + guid(),
    ref: filterFormRef,
    layout: filterFormLayout,
    onFinish: handleSearch
    // className={classNames(componentName, hashId, props?.className)}
    ,
    className: "standard-filter ".concat(componentName, " ").concat(className || '', " ").concat(hashId),
    style: style,
    colon: colon
    // {...providerConfig}  // 直接传这里面的话，会影响layout渲染
    // initialValues={{ ...initialValues }}
  }, /*#__PURE__*/React.createElement("div", {
    className: "filter-grid filter-grid-".concat(gridLayout),
    style: filterFormStyle
  }, reFormItemGroup.length === 0 ? null : /*#__PURE__*/React.createElement("div", {
    className: "filter-form filter-form-".concat(formLayout)
  }, reFormItemGroup ? /*#__PURE__*/React.createElement(React.Fragment, null, renderFormItemGroup()) : null), renderButtonGroup())));
});
export default StandardFilter;