import { _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-81040c9e.js';
import { _ as _slicedToArray } from '../_verture/slicedToArray-76060636.js';
import { r as regenerator } from '../_verture/index-beef914f.js';
import { a as __awaiter } from '../_verture/tslib.es6-55ed4bd2.js';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import React__default, { useRef, useState, useMemo, useImperativeHandle, useEffect } from 'react';
import Down from '@iam-com/icons/Down';
import SearchIcon from '@iam-com/icons/Search';
import CloseIcon from '@iam-com/icons/Close';
import CloseCircle from '@iam-com/icons/CloseCircle';
import Table from '../Table/index.js';
import { T as Tree } from '../_verture/index-6d6244a3.js';
import { Button } from '../Button/index.js';
import { D as Dropdown } from '../_verture/index-fac03ce3.js';
import { Popover } from '../Popover/index.js';
import AutoTips from '../AutoTips/index.js';
import { Tooltip } from '../Tooltip/index.js';
import clsx from 'clsx';
import { g as getReplaceField, i as isRemoteLoad, d as debounce, t as toArray, c as closest, a as getOverlaySize } from '../_verture/utils-1ffeadec.js';
import { DeepClone, ArrayToObject } from '@iam-com/lib';
import GlobalContext from '@para-ui/core/GlobalContext';
import { u as useGlobalProps } from '../_verture/useGlobalProps-1b846a65.js';
import { u as useFormatMessage } from '../_verture/useFormatMessage-703f8b20.js';
import Label from '../Label/index.js';
import HelperText from '../HelperText/index.js';
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
import '../_verture/typeof-498dd2b1.js';
import '../_verture/unsupportedIterableToArray-cb478f24.js';
import '../Checkbox/index.js';
import '../Help/index.js';
import '@iam-com/icons/Help';
import 'rc-tooltip';
import 'rc-tooltip/lib/placements';
import '@iam-com/icons/ScreenF';
import '@iam-com/icons/UpTriangleF';
import '@iam-com/icons/DownTriangleF';
import '@iam-com/icons/Panel';
import '../Empty/index.js';
import '../Radio/index.js';
import '../OperateBtn/index.js';
import '@iam-com/icons/More';
import '@iam-com/icons/Refresh';
import '../Pagination/index.js';
import '../TextField/index.js';
import '@iam-com/icons/PreviewClose';
import '@iam-com/icons/PreviewOpen';
import '../Loading/index.js';
import '@iam-com/icons/LoadingF';
import '../Select/index.js';
import '@iam-com/icons/Check';
import '@iam-com/icons/DoubleLeft';
import '@iam-com/icons/Left';
import 'rc-pagination';
import '@iam-com/icons/Right';
import '@iam-com/icons/DoubleRight';
import 'rc-tree';
import '@iam-com/icons/Document';
import 'react-dom';
import '@iam-com/icons/EditFile';
import '@iam-com/icons/PlusCircle';
import '@iam-com/icons/Delete';
import '@iam-com/icons/Forbid';
import '@iam-com/icons/MoreCircle';
import 'rc-dropdown';
import '../_verture/usePopupContainer-87febeb9.js';
import 'dayjs';

var en = {
  searchPlaceholder: 'Please enter',
  cancel: 'Cancel',
  ok: 'Ok',
  fullPath: 'Full path',
  pleaseSelect: 'Please select',
  selected: 'selected'
};

var zh = {
  searchPlaceholder: '请输入',
  cancel: '取消',
  ok: '确定',
  fullPath: '完整路径',
  pleaseSelect: '请选择',
  selected: '已选中'
};

var localeJson = {
  zh: zh,
  en: en
};

var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/18 上午10:16\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-comboselect .comboselect-wrapper {\n  position: relative;\n  display: flex;\n  width: 100%;\n  min-height: 32px;\n  padding: 0 12px;\n  font-size: 14px;\n  border: 1px solid rgba(171, 176, 185, 0.4);\n  border-radius: 4px;\n  background-color: rgb(255, 255, 255);\n  cursor: pointer;\n  transition: 0.3s;\n}\n.paraui-v3-comboselect .comboselect-wrapper:hover {\n  border-color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-placeholder {\n  position: absolute;\n  top: 50%;\n  left: 12px;\n  right: 42px;\n  transform: translateY(-50%);\n  font-size: 14px;\n  color: rgba(46, 55, 67, 0.4);\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-arrow {\n  position: absolute;\n  top: 5px;\n  right: 12px;\n  line-height: 0;\n  transition: 0.3s;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-arrow svg {\n  color: rgba(46, 55, 67, 0.7);\n  font-size: 20px;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-clear {\n  position: absolute;\n  top: 9px;\n  right: 12px;\n  opacity: 0;\n  line-height: 0;\n  cursor: pointer;\n  transition: 0.3s;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-clear svg {\n  color: rgba(46, 55, 67, 0.7);\n  font-size: 16px;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow {\n  position: relative;\n  display: flex;\n  width: 100%;\n  flex: auto;\n  flex-wrap: wrap;\n  padding: 4px 30px 0 0;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow {\n  height: 30px;\n  padding: 0 30px 0 0;\n  align-items: center;\n  overflow: hidden;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow .comboselect-single-content {\n  max-width: 100%;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  font-size: 14px;\n  color: rgb(46, 55, 67);\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item {\n  flex: none;\n  max-width: 100%;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item {\n  display: inline-flex;\n  align-items: center;\n  padding: 0 12px;\n  height: 22px;\n  margin: 0 8px 4px 0;\n  max-width: 100%;\n  color: rgb(46, 55, 67);\n  line-height: 22px;\n  background-color: rgba(171, 176, 185, 0.2);\n  border-radius: 4px;\n  user-select: none;\n  transition: 0.3s;\n  cursor: default;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-content {\n  display: inline-block;\n  margin-right: 4px;\n  overflow: hidden;\n  font-size: 12px;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-remove {\n  display: inline-flex;\n  cursor: pointer;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-remove svg {\n  font-size: 16px;\n  color: inherit;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--disabled {\n  color: rgba(46, 55, 67, 0.4);\n  background-color: rgba(171, 176, 185, 0.4);\n  cursor: not-allowed;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--disabled .comboselect-item-remove {\n  color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--unclosable .comboselect-item-content {\n  margin-right: 0;\n}\n.paraui-v3-comboselect-focused .comboselect-wrapper {\n  border-color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-focused .comboselect-wrapper .comboselect-arrow {\n  transform: rotate(180deg);\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-disabled {\n  cursor: not-allowed;\n}\n.paraui-v3-comboselect-disabled .comboselect-wrapper {\n  background-color: rgba(171, 176, 185, 0.12);\n  border-color: rgba(171, 176, 185, 0.4);\n  pointer-events: none;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper {\n  min-height: 36px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-overflow {\n  padding-top: 5px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-overflow-item .comboselect-item {\n  height: 24px;\n  margin-bottom: 5px;\n  line-height: 24px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow {\n  height: 34px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-arrow {\n  top: 8px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper {\n  min-height: 28px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-overflow {\n  padding-top: 3px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-overflow-item .comboselect-item {\n  height: 20px;\n  margin-bottom: 3px;\n  line-height: 20px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow {\n  height: 26px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-arrow {\n  top: 3px;\n}\n.paraui-v3-comboselect-error .comboselect-wrapper {\n  border-color: rgb(235, 96, 84);\n}\n.paraui-v3-comboselect-error .comboselect-wrapper:hover {\n  border-color: rgb(235, 96, 84);\n}\n.paraui-v3-comboselect-clear .comboselect-wrapper:hover .comboselect-arrow {\n  opacity: 0;\n}\n.paraui-v3-comboselect-clear .comboselect-wrapper:hover .comboselect-clear {\n  opacity: 1;\n}\n.paraui-v3-comboselect-non-popup {\n  border: 1px solid rgba(171, 176, 185, 0.4);\n  border-radius: 4px;\n  background-color: rgb(255, 255, 255);\n}\n.paraui-v3-comboselect-non-popup .comboselect-wrapper {\n  border: none;\n  border-bottom: 1px solid rgba(171, 176, 185, 0.4);\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n  cursor: default;\n}\n.paraui-v3-comboselect-non-popup .comboselect-wrapper:hover {\n  border-color: rgba(171, 176, 185, 0.4);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content {\n  position: relative;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search {\n  display: flex;\n  align-items: center;\n  height: 40px;\n  padding: 0 18px;\n  border-bottom: 1px solid rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-icon {\n  line-height: 0;\n  cursor: pointer;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-icon svg {\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-input {\n  width: 100%;\n  flex: auto;\n  margin: 0 10px 0 10px;\n  border: none;\n  color: rgb(46, 55, 67);\n  font-size: 14px;\n  height: 20px;\n  line-height: 1;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-input::placeholder {\n  color: rgba(46, 55, 67, 0.4);\n  font-size: 14px;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon {\n  display: inline-flex;\n  cursor: pointer;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon svg {\n  font-size: 16px;\n  color: rgba(46, 55, 67, 0.7);\n  transition: all 0.3s;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon svg:hover {\n  color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-table {\n  padding-bottom: 10px;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-table .paraui-v3-table {\n  box-shadow: none;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-tree {\n  padding: 6px 7px;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-tree .paraui-v3-tree-empty {\n  padding: 52px 0 73px 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-dropdown-wrapper {\n  position: relative;\n  color: initial;\n  overflow: hidden;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search {\n  display: flex;\n  align-items: center;\n  height: 40px;\n  padding: 0 18px;\n  border-bottom: 1px solid rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-icon {\n  line-height: 0;\n  cursor: pointer;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-icon svg {\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input {\n  width: 100%;\n  flex: auto;\n  margin: 0 10px 0 10px;\n  border: none;\n  color: rgb(46, 55, 67);\n  font-size: 14px;\n  height: 20px;\n  line-height: 1;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input::placeholder {\n  color: rgba(46, 55, 67, 0.4);\n  font-size: 14px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search .comboselect-clear-icon {\n  display: inline-flex;\n  cursor: pointer;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search .comboselect-clear-icon svg {\n  font-size: 16px;\n  color: rgba(46, 55, 67, 0.7);\n  transition: all 0.3s;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search .comboselect-clear-icon svg:hover {\n  color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-comboselect-dropdown .comboselect-table {\n  height: 100%;\n  padding-bottom: 10px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-table .paraui-v3-table {\n  box-shadow: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-tree {\n  height: 100%;\n  padding: 6px 7px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-tree .paraui-v3-tree-empty {\n  height: 100%;\n  padding: 52px 0 73px 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-actions {\n  display: flex;\n  align-items: center;\n  padding: 8px 20px 8px 0;\n  justify-content: flex-end;\n  border-top: 1px solid rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-dropdown .comboselect-actions button + button {\n  margin-left: 10px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-fullPath {\n  height: 34px;\n  line-height: 34px;\n  padding: 0 12px;\n  border-top: 1px solid rgba(171, 176, 185, 0.2);\n  font-size: 14px;\n  color: rgb(46, 55, 67);\n}\n.paraui-v3-comboselect-dropdown .comboselect-fullPath span {\n  display: inline-block;\n  height: 100%;\n  padding-right: 10px;\n  border-right: 1px solid rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-dropdown .comboselect-list {\n  padding: 8px 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-empty {\n  padding: 50px 0 72px 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode {\n  width: 100%;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-switcher {\n  display: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-checkbox {\n  display: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-node-content-wrapper {\n  width: 100%;\n  margin: 0;\n  padding: 6px 28px 6px 12px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-node-content-wrapper:hover {\n  background-color: rgba(171, 176, 185, 0.12);\n  border-radius: 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode-checkbox-checked .paraui-v3-tree-node-content-wrapper {\n  position: relative;\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode-checkbox-checked .paraui-v3-tree-node-content-wrapper::after {\n  position: absolute;\n  content: \" \";\n  width: 5px;\n  height: 10px;\n  right: 12px;\n  top: 50%;\n  transform: translateY(-50%) rotate(45deg);\n  border: 2px solid rgb(54, 102, 214);\n  border-top: 0;\n  border-left: 0;\n  border-bottom-right-radius: 2px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode-disabled .paraui-v3-tree-node-content-wrapper:hover {\n  background-color: transparent;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list-single .paraui-v3-tree-treenode-checkbox-checked .paraui-v3-tree-node-content-wrapper::after {\n  display: none;\n}\n.paraui-v3-comboselect-more-popover {\n  padding-left: 12px;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper {\n  width: 300px;\n  padding: 12px 0;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-title {\n  display: block;\n  padding: 0 12px;\n  margin-bottom: 5px;\n  font-size: 12px;\n  color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-content {\n  max-height: 300px;\n  padding: 0 12px;\n  overflow-y: auto;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item {\n  display: flex;\n  align-items: center;\n  height: 36px;\n  font-size: 14px;\n  color: rgb(46, 55, 67);\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-text {\n  display: inline-block;\n  max-width: calc(100% - 25px);\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove {\n  display: inline-flex;\n  margin-left: auto;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove svg {\n  font-size: 20px;\n  color: rgb(46, 55, 67);\n  cursor: pointer;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove svg:hover {\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input::-ms-clear, .paraui-v3-comboselect-non-popup .comboselect-search-input::-ms-clear {\n  display: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input::-ms-reveal, .paraui-v3-comboselect-non-popup .comboselect-search-input::-ms-reveal {\n  display: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input:-moz-placeholder, .paraui-v3-comboselect-non-popup .comboselect-search-input:-moz-placeholder {\n  color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input::-moz-placeholder, .paraui-v3-comboselect-non-popup .comboselect-search-input::-moz-placeholder {\n  color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input:-ms-input-placeholder, .paraui-v3-comboselect-non-popup .comboselect-search-input:-ms-input-placeholder {\n  /* Internet Explorer 10-11 */\n  color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input::-ms-input-placeholder, .paraui-v3-comboselect-non-popup .comboselect-search-input::-ms-input-placeholder {\n  /* Microsoft Edge */\n  color: rgba(46, 55, 67, 0.4);\n}";
styleInject(css_248z);

//组合选择器
var ComboSelect = function ComboSelect(props) {
  var _useGlobalProps = useGlobalProps(props, 'ComboSelect'),
    _useGlobalProps$mode = _useGlobalProps.mode,
    mode = _useGlobalProps$mode === void 0 ? 'table' : _useGlobalProps$mode,
    placeholder = _useGlobalProps.placeholder,
    searchPlaceholder = _useGlobalProps.searchPlaceholder,
    maxCount = _useGlobalProps.maxCount,
    _useGlobalProps$disab = _useGlobalProps.disabled,
    disabled = _useGlobalProps$disab === void 0 ? false : _useGlobalProps$disab,
    _useGlobalProps$allow = _useGlobalProps.allowClear,
    allowClear = _useGlobalProps$allow === void 0 ? false : _useGlobalProps$allow,
    className = _useGlobalProps.className,
    style = _useGlobalProps.style,
    maxHeight = _useGlobalProps.maxHeight,
    height = _useGlobalProps.height,
    _useGlobalProps$place = _useGlobalProps.placement,
    placement = _useGlobalProps$place === void 0 ? 'bottomLeft' : _useGlobalProps$place,
    popoverClassName = _useGlobalProps.popoverClassName,
    _useGlobalProps$size = _useGlobalProps.size,
    size = _useGlobalProps$size === void 0 ? 'large' : _useGlobalProps$size,
    _useGlobalProps$popov = _useGlobalProps.popoverActions,
    popoverActions = _useGlobalProps$popov === void 0 ? null : _useGlobalProps$popov,
    _useGlobalProps$showP = _useGlobalProps.showPopoverActions,
    showPopoverActions = _useGlobalProps$showP === void 0 ? false : _useGlobalProps$showP,
    _useGlobalProps$defau = _useGlobalProps.defaultOpen,
    defaultOpen = _useGlobalProps$defau === void 0 ? false : _useGlobalProps$defau,
    defaultValue = _useGlobalProps.defaultValue,
    _useGlobalProps$repla = _useGlobalProps.replaceFields,
    replaceFields = _useGlobalProps$repla === void 0 ? {
      key: 'key',
      title: 'title',
      children: 'children'
    } : _useGlobalProps$repla,
    _useGlobalProps$outpu = _useGlobalProps.outputFields,
    outputFields = _useGlobalProps$outpu === void 0 ? {
      outputKey: 'key',
      outputTitle: 'label'
    } : _useGlobalProps$outpu,
    value = _useGlobalProps.value,
    onClear = _useGlobalProps.onClear,
    onCancel = _useGlobalProps.onCancel,
    onOk = _useGlobalProps.onOk,
    onClose = _useGlobalProps.onClose,
    onChange = _useGlobalProps.onChange,
    onSearch = _useGlobalProps.onSearch,
    refresh = _useGlobalProps.refresh,
    TableProps = _useGlobalProps.TableProps,
    TreeProps = _useGlobalProps.TreeProps,
    _useGlobalProps$check = _useGlobalProps.checkable,
    checkable = _useGlobalProps$check === void 0 ? true : _useGlobalProps$check,
    url = _useGlobalProps.url,
    ctx = _useGlobalProps.ctx,
    params = _useGlobalProps.params,
    _useGlobalProps$metho = _useGlobalProps.method,
    method = _useGlobalProps$metho === void 0 ? 'Get' : _useGlobalProps$metho,
    _useGlobalProps$showS = _useGlobalProps.showSearch,
    showSearch = _useGlobalProps$showS === void 0 ? false : _useGlobalProps$showS,
    _useGlobalProps$realT = _useGlobalProps.realTimeSearch,
    realTimeSearch = _useGlobalProps$realT === void 0 ? false : _useGlobalProps$realT,
    _useGlobalProps$error = _useGlobalProps.error,
    error = _useGlobalProps$error === void 0 ? false : _useGlobalProps$error,
    hideErrorDom = _useGlobalProps.hideErrorDom,
    helperText = _useGlobalProps.helperText,
    paramsCallback = _useGlobalProps.paramsCallback,
    fullPathKey = _useGlobalProps.fullPathKey,
    fullPathRender = _useGlobalProps.fullPathRender,
    _useGlobalProps$disab2 = _useGlobalProps.disablePopup,
    disablePopup = _useGlobalProps$disab2 === void 0 ? false : _useGlobalProps$disab2,
    tagRender = _useGlobalProps.tagRender,
    onTagRemove = _useGlobalProps.onTagRemove,
    action = _useGlobalProps.action,
    _useGlobalProps$label = _useGlobalProps.label,
    label = _useGlobalProps$label === void 0 ? '' : _useGlobalProps$label,
    labelTooltip = _useGlobalProps.labelTooltip,
    _useGlobalProps$requi = _useGlobalProps.required,
    required = _useGlobalProps$requi === void 0 ? false : _useGlobalProps$requi,
    emptyProps = _useGlobalProps.emptyProps,
    _useGlobalProps$toggl = _useGlobalProps.toggleSelectedOnSingle,
    toggleSelectedOnSingle = _useGlobalProps$toggl === void 0 ? false : _useGlobalProps$toggl,
    optionRender = _useGlobalProps.optionRender,
    getOptionLabel = _useGlobalProps.getOptionLabel,
    _useGlobalProps$dropd = _useGlobalProps.dropdownMatchSelectWidth,
    dropdownMatchSelectWidth = _useGlobalProps$dropd === void 0 ? true : _useGlobalProps$dropd,
    getPopupContainer = _useGlobalProps.getPopupContainer,
    maxTagTextLength = _useGlobalProps.maxTagTextLength,
    renderInputContent = _useGlobalProps.renderInputContent,
    renderNotCheckListInputContent = _useGlobalProps.renderNotCheckListInputContent;
  var _React$useContext = React__default.useContext(GlobalContext),
    language = _React$useContext.language,
    locale = _React$useContext.locale;
  var selectRef = useRef();
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    open = _useState2[0],
    setOpen = _useState2[1]; //打开popover
  var _useState3 = useState([]),
    _useState4 = _slicedToArray(_useState3, 2),
    checkKeys = _useState4[0],
    setCheckKeys = _useState4[1]; //选中key
  var checkValuesRef = useRef(new Map()); //选中value
  var _useState5 = useState([]),
    _useState6 = _slicedToArray(_useState5, 2),
    checkList = _useState6[0],
    setCheckList = _useState6[1]; //tag显示选中项
  var _useState7 = useState(''),
    _useState8 = _slicedToArray(_useState7, 2),
    inputValue = _useState8[0],
    setInputValue = _useState8[1]; //input value
  var searchKeyRef = useRef(undefined); //搜索参数
  var _useState9 = useState(null),
    _useState10 = _slicedToArray(_useState9, 2),
    fullPath = _useState10[0],
    setFullPath = _useState10[1]; //路径
  var _useState11 = useState(false),
    _useState12 = _slicedToArray(_useState11, 2),
    hasAllClear = _useState12[0],
    setHasAllClear = _useState12[1]; //显示清除按钮
  var _useState13 = useState(0),
    _useState14 = _slicedToArray(_useState13, 2),
    inRefresh = _useState14[0],
    setInRefresh = _useState14[1]; //内部刷新组件
  var _useState15 = useState(false),
    _useState16 = _slicedToArray(_useState15, 2),
    openMore = _useState16[0],
    setOpenMore = _useState16[1]; //显示更过选中
  var _useState17 = useState([]),
    _useState18 = _slicedToArray(_useState17, 2),
    moreTagList = _useState18[0],
    setMoreTagList = _useState18[1]; //更多tag列表
  var originValueRef = useRef([]); // 保存value
  var hasPopup = useRef(false); //显示弹框标识
  var popUpNodeRef = useRef(); //popup dom
  var emptyParamsRef = useRef({}); //空参数常量
  var searchInputRef = useRef(); //search input
  var mergedReplaceF = getReplaceField(mode, replaceFields, TableProps, TreeProps); //替换字段
  var _mergedReplaceF$key = mergedReplaceF.key,
    fieldKey = _mergedReplaceF$key === void 0 ? '' : _mergedReplaceF$key,
    _mergedReplaceF$title = mergedReplaceF.title,
    fieldTitle = _mergedReplaceF$title === void 0 ? '' : _mergedReplaceF$title;
  var _ref = outputFields || {},
    _ref$outputKey = _ref.outputKey,
    outputKey = _ref$outputKey === void 0 ? 'key' : _ref$outputKey,
    _ref$outputTitle = _ref.outputTitle,
    outputTitle = _ref$outputTitle === void 0 ? 'label' : _ref$outputTitle;
  var intl = useFormatMessage('ComboSelect', localeJson);
  var isRemoteLoadRef = useRef(isRemoteLoad(mode, mode === 'table' ? TableProps : TreeProps)); //是否远程加载数据
  var _useState19 = useState(),
    _useState20 = _slicedToArray(_useState19, 2),
    loadedKeys = _useState20[0],
    setLoadKeys = _useState20[1]; //加载过的key
  //选择框点击
  var handleSelectorClick = function handleSelectorClick(event) {
    if (disablePopup) return;
    if (disabled) return;
    if (hasPopup.current) {
      handlePopoverClose();
      return;
    }
    hasPopup.current = true;
    setOpen(true);
  };
  //关闭popover
  var handlePopoverClose = function handlePopoverClose(event, reason) {
    hasPopup.current = false;
    searchKeyRef.current = undefined;
    emptyParamsRef.current = {};
    setOpen(false);
    setFullPath(null);
    setInputValue('');
    onClose === null || onClose === void 0 ? void 0 : onClose();
    if (reason === 'cancel') {
      clearSelectorData();
    }
  };
  //清空选择器数据
  var clearSelectorData = function clearSelectorData() {
    setCheckKeys([]);
    setCheckList([]);
    setMoreTagList([]);
  };
  //处理选中
  var handleChecked = function handleChecked(keys, values) {
    setCheckKeys(keys);
    formatSelectedData(values, keys);
  };
  //内部状态变化
  var internalChange = function internalChange(currItem) {
    setCheckKeys(function (prev) {
      var idx = prev.findIndex(function (k) {
        return k === currItem[outputKey];
      });
      if (idx > -1) prev.splice(idx, 1);
      return _toConsumableArray(prev);
    });
  };
  //删除当前选中项
  var handleRemoveTagClick = function handleRemoveTagClick(evt, currItem) {
    evt.stopPropagation();
    if (currItem.closable === false) return; //tag 不可关闭
    if ((onTagRemove === null || onTagRemove === void 0 ? void 0 : onTagRemove(currItem)) === false) return; //返回false不删除
    var newCheckList = _toConsumableArray(checkList);
    var idx = newCheckList.findIndex(function (_) {
      return _[outputKey] === currItem[outputKey];
    });
    if (idx > -1) newCheckList.splice(idx, 1);
    setCheckList(newCheckList);
    internalChange(currItem);
    onChange === null || onChange === void 0 ? void 0 : onChange(newCheckList);
  };
  /**
  * @desc 搜索 - 防抖
  */
  var onRealTimeSearch = useMemo(function () {
    return debounce(function (val) {
      return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
        return regenerator.wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              searchFn(val);
            case 1:
            case "end":
              return _context.stop();
          }
        }, _callee);
      }));
    }, 400);
  }, []);
  //输入框
  var handleInputChange = function handleInputChange(evt) {
    setInputValue(evt.target.value);
    realTimeSearch && onRealTimeSearch(evt.target.value);
  };
  //清空搜索值，重置搜索
  var handleClearSearchValue = function handleClearSearchValue() {
    setInputValue('');
    if (onSearch) return onSearch('');
    searchKeyRef.current = '';
    setInRefresh(Math.random());
  };
  var searchFn = function searchFn(value) {
    var input = value !== null && value !== void 0 ? value : inputValue;
    if (!onSearch) {
      searchKeyRef.current = input === null || input === void 0 ? void 0 : input.trim();
      setInRefresh(Math.random());
    } else {
      onSearch(input);
    }
    if (isRemoteLoadRef.current) setLoadKeys([]);
  };
  //输入框回车搜索
  var handleEnterSearch = function handleEnterSearch(evt, type) {
    if (type === 'click') {
      searchFn();
    } else if (evt) {
      var keyCode = evt.which || evt.keyCode;
      if (keyCode === 13) searchFn();
    }
  };
  //popover 完成
  var handlePopoverDone = function handlePopoverDone(evt, flag) {
    if (flag) {
      onOk === null || onOk === void 0 ? void 0 : onOk(checkList);
      handlePopoverClose(null, 'ok');
    } else {
      onCancel === null || onCancel === void 0 ? void 0 : onCancel();
      handlePopoverClose(null, 'cancel');
    }
  };
  //设置容器宽高
  var setPopoverWH = function setPopoverWH() {
    var w = 'auto';
    if (selectRef.current) w = selectRef.current.offsetWidth + 'px';
    var overlayStyle = getOverlaySize(mode, isRemoteLoadRef.current, maxHeight, height);
    var wObj = {
      minWidth: w,
      maxWidth: 960
    };
    if (typeof dropdownMatchSelectWidth === 'number') {
      wObj.width = dropdownMatchSelectWidth;
    } else if (dropdownMatchSelectWidth) {
      wObj.width = w;
    }
    return Object.assign(Object.assign({
      overflow: 'auto'
    }, wObj), overlayStyle);
  };
  //select className
  var makeSelectCls = function makeSelectCls() {
    var _clsx;
    var isMedium = size !== 'medium';
    return clsx("".concat($prefixCls, "-comboselect"), className, (_clsx = {}, _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-focused"), open && !disablePopup), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-disabled"), disabled), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-radioable"), !checkable), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-error"), error), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-clear"), hasAllClear), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-non-popup"), disablePopup), _clsx), isMedium && "".concat($prefixCls, "-comboselect-").concat(size));
  };
  //格式化选中数据
  var formatSelectedData = function formatSelectedData(values, keys) {
    var _a;
    var opts = [];
    if (values === null || values === void 0 ? void 0 : values.length) {
      opts = values.map(function (item) {
        var _a;
        var temp = {};
        temp[outputKey] = item[fieldKey] || '';
        if (getOptionLabel) temp[outputTitle] = getOptionLabel(item) || '';else temp[outputTitle] = item[fieldTitle] || '';
        var oValue = (_a = originValueRef.current) === null || _a === void 0 ? void 0 : _a.find(function (v) {
          return v[outputKey] === temp[outputKey];
        });
        if (oValue) {
          if (oValue.disabled !== undefined) {
            temp.disabled = oValue.disabled;
          }
          if (oValue.closable !== undefined) {
            temp.closable = oValue.closable;
          }
        }
        return temp;
      });
    }
    if ((keys === null || keys === void 0 ? void 0 : keys.length) && values) {
      var _opts;
      var fKeys = keys.filter(function (k) {
        return values.findIndex(function (v) {
          return v[fieldKey] === k;
        }) === -1;
      });
      var diffValue = (_a = originValueRef.current) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
        return fKeys === null || fKeys === void 0 ? void 0 : fKeys.includes(v[outputKey]);
      });
      if (diffValue) (_opts = opts).push.apply(_opts, _toConsumableArray(diffValue));
    }
    setCheckList(opts);
    var vals = DeepClone(values || []);
    if (!checkable)
      //单选
      onChange === null || onChange === void 0 ? void 0 : onChange(opts[0], vals[0]);else onChange === null || onChange === void 0 ? void 0 : onChange(opts, vals);
  };
  //外部数据转换为内部状态
  var transformToState = function transformToState(options) {
    var keys = options.map(function (_) {
      return _[outputKey];
    });
    setCheckList(options);
    setCheckKeys(keys);
    originValueRef.current = options;
  };
  //tree select
  var handleSelect = function handleSelect(selectedKeys, info) {
    setFullPath(info.node);
  };
  //渲染搜索
  var renderSearch = function renderSearch() {
    var styObj = {};
    if (!disablePopup) {
      var _setPopoverWH = setPopoverWH(),
        width = _setPopoverWH.width,
        minWidth = _setPopoverWH.minWidth,
        maxWidth = _setPopoverWH.maxWidth;
      styObj = {
        width: width,
        minWidth: minWidth,
        maxWidth: maxWidth
      };
    }
    return jsxs("div", Object.assign({
      className: 'comboselect-search',
      style: styObj
    }, {
      children: [jsx("span", Object.assign({
        className: 'comboselect-search-icon',
        onClick: function onClick() {
          return handleEnterSearch(null, 'click');
        }
      }, {
        children: jsx(SearchIcon, {})
      })), jsx("input", {
        placeholder: searchPlaceholder !== null && searchPlaceholder !== void 0 ? searchPlaceholder : intl({
          id: 'searchPlaceholder'
        }),
        className: 'comboselect-search-input',
        ref: searchInputRef,
        onChange: handleInputChange,
        value: inputValue,
        onKeyUp: function onKeyUp(evt) {
          return handleEnterSearch(evt, 'enter');
        }
      }), inputValue && jsx("span", Object.assign({
        className: 'comboselect-clear-icon',
        onClick: handleClearSearchValue
      }, {
        children: jsx(CloseCircle, {})
      }))]
    }));
  };
  //render popover action
  var renderActions = function renderActions() {
    if (popoverActions) return jsx("div", Object.assign({
      className: 'comboselect-actions'
    }, {
      children: popoverActions
    }));
    return jsxs("div", Object.assign({
      className: 'comboselect-actions'
    }, {
      children: [jsx(Button, Object.assign({
        onClick: function onClick(evt) {
          return handlePopoverDone(evt, false);
        },
        variant: "outlined",
        size: 'small'
      }, {
        children: intl({
          id: 'cancel'
        })
      })), jsx(Button, Object.assign({
        variant: "outlined",
        onClick: function onClick(evt) {
          return handlePopoverDone(evt, true);
        },
        size: 'small'
      }, {
        children: intl({
          id: 'ok'
        })
      }))]
    }));
  };
  //渲染完整路径
  var renderFullPath = function renderFullPath() {
    var _a;
    if (mode !== 'tree' || !fullPath) return null;
    if (fullPathRender) {
      return jsx("div", Object.assign({
        className: 'comboselect-fullPath'
      }, {
        children: fullPathRender(fullPath !== null && fullPath !== void 0 ? fullPath : {})
      }));
    }
    return jsxs("div", Object.assign({
      className: 'comboselect-fullPath'
    }, {
      children: [jsx("span", {
        children: intl({
          id: 'fullPath'
        })
      }), (_a = fullPath === null || fullPath === void 0 ? void 0 : fullPath[fullPathKey]) !== null && _a !== void 0 ? _a : '']
    }));
  };
  //全部清空
  var handleAllClear = function handleAllClear(evt) {
    evt.stopPropagation();
    clearSelectorData();
    handlePopoverClose();
    setOpenMore(false);
    onClear === null || onClear === void 0 ? void 0 : onClear();
    onChange === null || onChange === void 0 ? void 0 : onChange(checkable ? [] : {});
  };
  //显示更多
  var handleOpenMore = function handleOpenMore(e) {
    e.stopPropagation();
    setOpenMore(true);
    handlePopoverClose();
  };
  //暴露给外部的行为
  useImperativeHandle(action, function () {
    return {
      closePopup: function closePopup() {
        return handlePopoverClose();
      }
    };
  });
  useEffect(function () {
    if (!disablePopup && defaultOpen) {
      //默认打开
      hasPopup.current = true;
      setOpen(defaultOpen);
    }
  }, [defaultOpen]);
  useEffect(function () {
    if (defaultValue) {
      //默认值
      transformToState(toArray(defaultValue));
    }
  }, []);
  useEffect(function () {
    if (value) {
      //受控values
      transformToState(toArray(value));
    }
  }, [value]);
  //是否显示清除图标
  useEffect(function () {
    if (allowClear) setHasAllClear(!!(checkList === null || checkList === void 0 ? void 0 : checkList.length));
  }, [checkList]);
  useEffect(function () {
    var ownerDocument = function ownerDocument(node) {
      return node && node.ownerDocument || document;
    };
    var handleMouseDown = function handleMouseDown(evt) {
      var _a, _b;
      var doc = ownerDocument(selectRef.current);
      var target = evt.target;
      var insideDOM = !doc.documentElement.contains(target) || ((_a = popUpNodeRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)) || ((_b = selectRef.current) === null || _b === void 0 ? void 0 : _b.contains(target)) || false;
      if (mode === 'table') {
        //表格模式时，显示点击popover时阻止 关闭弹框
        //表格模式时，显示点击popover时阻止 关闭弹框
        //表格分页popover
        var tablePageSelectCls = ".".concat($prefixCls, "-select-popover");
        //表格显示列popover
        var tableColumCls = ".".concat($prefixCls, "-table-show-colums-popover");
        //表格过滤popover
        var tableFilterCls = ".".concat($prefixCls, "-filter-popover");
        // 检测元素是否在指定的DOM内
        var bol = closest(target, "".concat(tablePageSelectCls, ", ").concat(tableColumCls, ", ").concat(tableFilterCls));
        if (bol) return;
        // const tablePageSelectDom = document.querySelector(tablePageSelectCls);
        // const tableColumn = document.querySelector(tableColumCls);
        // const tableFilter = document.querySelector(tableFilterCls);
        // if (tablePageSelectDom && tablePageSelectDom.contains(target)) return;
        // if (tableColumn && tableColumn.contains(target)) return;
        // if (tableFilter && tableFilter.contains(target)) return;
      }

      if (hasPopup.current && !insideDOM) {
        handlePopoverClose();
      }
    };
    if (open) {
      setTimeout(function () {
        var _a;
        (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
      }, 200);
    }
    if (!disablePopup && open) {
      var doc = ownerDocument(selectRef.current);
      doc.addEventListener('mousedown', handleMouseDown);
      return function () {
        doc.removeEventListener('mousedown', handleMouseDown);
      };
    }
  }, [open]);
  //tag memo
  var tagMemo = useMemo(function () {
    var _a;
    if (!(checkList === null || checkList === void 0 ? void 0 : checkList.length)) return null;
    // 自定义渲染输入框内容
    if (renderInputContent) {
      if (!checkable)
        //单选
        return renderInputContent(checkList[0]);else return renderInputContent(checkList);
    }
    if (!checkable) {
      //单选
      return jsx("span", Object.assign({
        className: 'comboselect-single-content'
      }, {
        children: jsx(AutoTips, {
          children: (_a = checkList[0]) === null || _a === void 0 ? void 0 : _a[outputTitle]
        })
      }));
    }
    var realShowList = _toConsumableArray(checkList); //实际显示
    var overList = [];
    if (maxCount) {
      if (checkList.length > maxCount) {
        overList = checkList.slice(maxCount); //超出
        realShowList = checkList.slice(0, maxCount);
        setMoreTagList(overList);
      } else {
        setMoreTagList([]);
        setOpenMore(false);
      }
    }
    //超出tag渲染
    var renderOverTag = function renderOverTag() {
      return (overList === null || overList === void 0 ? void 0 : overList.length) ? jsx("div", Object.assign({
        className: 'comboselect-overflow-item'
      }, {
        children: jsx("span", Object.assign({
          className: 'comboselect-item',
          onClick: handleOpenMore
        }, {
          children: jsx("span", Object.assign({
            className: 'comboselect-item-content'
          }, {
            children: "+".concat(overList === null || overList === void 0 ? void 0 : overList.length)
          }))
        }))
      })) : null;
    };
    //渲染tag item
    var renderTagItem = function renderTagItem(item) {
      if (tagRender) return tagRender(item);
      var _ref2 = item !== null && item !== void 0 ? item : {},
        disabled = _ref2.disabled,
        _ref2$closable = _ref2.closable,
        closable = _ref2$closable === void 0 ? true : _ref2$closable;
      var displayLabel = item[outputTitle];
      var isOverflow = false;
      //限制tag文本长度
      if (typeof maxTagTextLength === 'number') {
        if (typeof displayLabel === 'string' || typeof displayLabel === 'number') {
          var strLabel = String(displayLabel);
          if (strLabel.length > maxTagTextLength) {
            displayLabel = "".concat(strLabel.slice(0, maxTagTextLength), "...");
            isOverflow = true;
          }
        }
      }
      return jsxs("span", Object.assign({
        className: clsx('comboselect-item', {
          'comboselect-item--disabled': disabled,
          'comboselect-item--unclosable': !closable
        })
      }, {
        children: [isOverflow ? jsx(Tooltip, Object.assign({
          title: jsx("div", Object.assign({
            onClick: function onClick(e) {
              return e.stopPropagation();
            }
          }, {
            children: item[outputTitle]
          })),
          arrow: false,
          placement: 'bottomLeft'
        }, {
          children: jsx("span", Object.assign({
            className: 'comboselect-item-content'
          }, {
            children: displayLabel
          }))
        })) : jsx("span", Object.assign({
          className: 'comboselect-item-content'
        }, {
          children: jsx(AutoTips, {
            children: displayLabel
          })
        })), closable === true && jsx("span", Object.assign({
          className: 'comboselect-item-remove',
          onClick: function onClick(evt) {
            return handleRemoveTagClick(evt, item);
          },
          onMouseDown: function onMouseDown(e) {
            return e.stopPropagation();
          }
        }, {
          children: jsx(CloseIcon, {})
        }))]
      }));
    };
    return jsxs(Fragment, {
      children: [realShowList.map(function (item, idx) {
        return jsx("div", Object.assign({
          className: 'comboselect-overflow-item'
        }, {
          children: renderTagItem(item)
        }), idx);
      }), renderOverTag()]
    });
  }, [checkList, onChange, checkable]);
  //处理参数
  var getParams = useMemo(function () {
    var P = params || emptyParamsRef.current;
    if (showSearch && !onSearch && searchKeyRef.current !== undefined) {
      P = Object.assign(Object.assign({}, P), {
        searchKey: searchKeyRef.current
      });
    }
    return (paramsCallback === null || paramsCallback === void 0 ? void 0 : paramsCallback(P)) || P;
  }, [params, inRefresh, refresh, open]);
  //表格组件
  var tableMemo = useMemo(function () {
    if (!disablePopup && !open || mode !== 'table') return null;
    var reqOpts = {
      url: url,
      ctx: ctx,
      search: getParams,
      method: method
    };
    //处理table radio
    var handleTableRadio = function handleTableRadio(keys, values) {
      if (!checkable) {
        //单选时关闭下拉框，点击自己不取消
        handlePopoverClose();
        if (checkKeys.includes(keys)) return;
      }
      handleChecked([keys], [values]);
    };
    return jsx("div", Object.assign({
      className: 'comboselect-table'
    }, {
      children: jsx(Table, Object.assign({}, reqOpts, TableProps, {
        emptyProps: emptyProps,
        check: checkable,
        radio: !checkable,
        rowKey: fieldKey,
        setCheck: handleChecked,
        setRadio: handleTableRadio,
        checkDefaultValue: checkKeys,
        radioDefaultValue: checkKeys[0],
        refresh: refresh !== null && refresh !== void 0 ? refresh : inRefresh,
        autoSize: false,
        refreshInside: false,
        checkCount: false
      }))
    }));
  }, [checkKeys, refresh, params, inRefresh, open]);
  //树组件
  var treeMemo = useMemo(function () {
    if (!disablePopup && !open || !['tree', 'list'].includes(mode)) return null;
    var reqOpts = {
      url: url,
      ctx: ctx,
      params: getParams,
      method: method
    };
    //处理tree nodes
    var handleTreeCheck = function handleTreeCheck(checkedKeys, info) {
      var _a;
      if (!info.checked) {
        var temp = {};
        temp[outputKey] = info.node[fieldKey] || '';
        temp[outputTitle] = info.node[fieldTitle] || '';
        if ((onTagRemove === null || onTagRemove === void 0 ? void 0 : onTagRemove(temp)) === false) {
          //返回false不删除
          return;
        }
      }
      if (!checkable) {
        //单选时
        handlePopoverClose();
        if (!toggleSelectedOnSingle) {
          if (checkKeys.includes((_a = info.node) === null || _a === void 0 ? void 0 : _a.key)) return;
        }
      }
      var nodes = info.checkedNodes;
      if (!checkable) {
        //单选
        if (checkedKeys === null || checkedKeys === void 0 ? void 0 : checkedKeys.length) nodes = [info.node];
      }
      //多选
      if (checkable) {
        var nodesObj = ArrayToObject('key', nodes);
        var ckeys = Array.from(checkValuesRef.current.keys());
        ckeys.forEach(function (k) {
          if (!checkedKeys.includes(k)) {
            checkValuesRef.current.delete(k);
          }
        });
        checkedKeys.forEach(function (k) {
          if (nodesObj[k]) {
            checkValuesRef.current.set(k, nodesObj[k]);
          }
        });
        nodes = Array.from(checkValuesRef.current.values());
      }
      handleChecked(checkedKeys, nodes);
    };
    var _titleRender = function _titleRender(dataNode) {
      if (TreeProps === null || TreeProps === void 0 ? void 0 : TreeProps.titleRender) {
        return TreeProps.titleRender(dataNode);
      }
      if (optionRender) {
        return optionRender(dataNode);
      }
      return dataNode.title;
    };
    var treeCls = clsx('comboselect-tree', {
      'comboselect-list': mode === 'list',
      'comboselect-list-single': mode === 'list' && !checkable
    });
    return jsx("div", Object.assign({
      className: treeCls
    }, {
      children: jsx(Tree, Object.assign({
        blockNode: true
      }, reqOpts, TreeProps, {
        wrapperStyle: {
          position: 'static'
        },
        emptyProps: Object.assign({
          size: 'small'
        }, emptyProps),
        replaceFields: mergedReplaceF,
        checkable: checkable,
        radioable: !checkable,
        showRadio: false,
        selectable: mode !== 'list',
        loadedKeys: loadedKeys,
        checkedKeys: checkKeys,
        onCheck: handleTreeCheck,
        onSelect: handleSelect,
        titleRender: _titleRender,
        refresh: refresh !== null && refresh !== void 0 ? refresh : inRefresh
      }))
    }));
  }, [checkKeys, refresh, params, inRefresh, open, loadedKeys]);
  //组合选择器输入框
  var comboSelectorInput = jsx("div", Object.assign({
    className: 'comboselect-wrapper',
    ref: selectRef,
    onClick: handleSelectorClick
  }, {
    children: renderNotCheckListInputContent ? renderNotCheckListInputContent() : jsxs(Fragment, {
      children: [jsx("div", Object.assign({
        className: clsx('comboselect-overflow', !checkable && 'comboselect-overflow-single')
      }, {
        children: tagMemo
      })), !disablePopup && jsx("span", Object.assign({
        className: 'comboselect-arrow'
      }, {
        children: jsx(Down, {})
      })), hasAllClear && jsx("span", Object.assign({
        className: 'comboselect-clear',
        onClick: handleAllClear
      }, {
        children: jsx(CloseCircle, {})
      })), !(checkList === null || checkList === void 0 ? void 0 : checkList.length) && jsx("span", Object.assign({
        className: 'comboselect-placeholder'
      }, {
        children: placeholder !== null && placeholder !== void 0 ? placeholder : intl({
          id: 'pleaseSelect'
        })
      }))]
    })
  }));
  //渲染label
  var renderLabel = function renderLabel() {
    if (label || required) {
      return jsx(Label, Object.assign({
        label: label,
        required: required
      }, labelTooltip));
    }
    return null;
  };
  //非popover 模式
  var nonPopoverMemo = useMemo(function () {
    return jsxs(Fragment, {
      children: [comboSelectorInput, jsxs("div", Object.assign({
        className: 'comboselect-non-popup-content'
      }, {
        children: [showSearch && renderSearch(), mode === 'table' ? tableMemo : treeMemo, renderFullPath(), showPopoverActions && renderActions()]
      }))]
    });
  }, [checkKeys, inputValue, refresh, params, fullPath, hasAllClear, helperText, language, locale, onChange, onClear]);
  //popover 浮层
  var renderOverlay = function renderOverlay() {
    return jsxs("div", Object.assign({
      ref: popUpNodeRef,
      className: 'comboselect-dropdown-wrapper'
    }, {
      children: [showSearch && renderSearch(), jsxs("div", Object.assign({
        style: setPopoverWH(),
        className: "".concat($prefixCls, "-scrollbar-small")
      }, {
        children: [mode === 'table' ? tableMemo : treeMemo, open && renderFullPath(), showPopoverActions && renderActions()]
      }))]
    }));
  };
  //popover 渲染更多节点
  var renderPopoverMore = function renderPopoverMore() {
    var generateMoreTag = function generateMoreTag() {
      if (!(moreTagList === null || moreTagList === void 0 ? void 0 : moreTagList.length)) return null;
      return moreTagList.map(function (item, idx) {
        return jsxs("div", Object.assign({
          className: "comboselect-more-item"
        }, {
          children: [jsx("span", Object.assign({
            className: "comboselect-more-item-text"
          }, {
            children: jsx(AutoTips, {
              children: item[outputTitle]
            })
          })), jsx("span", Object.assign({
            className: 'comboselect-more-item-remove',
            onClick: function onClick(e) {
              return handleRemoveTagClick(e, item);
            }
          }, {
            children: jsx(CloseIcon, {})
          }))]
        }), idx);
      });
    };
    return jsxs("div", Object.assign({
      className: "comboselect-more-wrapper"
    }, {
      children: [jsx("span", Object.assign({
        className: "comboselect-more-title"
      }, {
        children: jsxs("span", {
          children: [intl({
            id: 'selected'
          }), " ( ".concat(moreTagList.length, " )")]
        })
      })), jsx("div", Object.assign({
        className: "comboselect-more-content"
      }, {
        children: generateMoreTag()
      }))]
    }));
  };
  //popover 模式
  var popoverMemo = useMemo(function () {
    return jsx(Dropdown, Object.assign({
      overlay: renderOverlay(),
      visible: open,
      placement: placement,
      trigger: ['click'],
      overlayClassName: clsx("".concat($prefixCls, "-comboselect-dropdown"), popoverClassName),
      getPopupContainer: getPopupContainer
    }, {
      children: jsx(Popover, Object.assign({
        visible: openMore,
        destroyTooltipOnHide: true,
        placement: "rightTop",
        content: renderPopoverMore(),
        onVisibleChange: function onVisibleChange() {
          return setOpenMore(false);
        },
        overlayClassName: "".concat($prefixCls, "-comboselect-more-popover")
      }, {
        children: comboSelectorInput
      }))
    }));
  }, [open, checkKeys, inputValue, refresh, params, fullPath, inRefresh, hasAllClear, helperText, language, locale, openMore, moreTagList, loadedKeys, onChange, onClear]);
  return jsxs("div", Object.assign({
    className: makeSelectCls(),
    style: style
  }, {
    children: [renderLabel(), disablePopup ? nonPopoverMemo : popoverMemo, !disablePopup ? jsx(HelperText, {
      error: error,
      helperText: helperText,
      hideErrorDom: hideErrorDom
    }) : null]
  }));
};

export { ComboSelect, ComboSelect as default };
