"use strict";

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); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _comp = require("../../ui/src/comp");
var _ui = require("../../ui");
var _dom = require("../../ui/src/dom");
var _utils = require("../../ui/src/utils");
var _util = require("./util");
var _xeUtils = _interopRequireDefault(require("xe-utils"));
var _list = _interopRequireDefault(require("../../list"));
var _input = _interopRequireDefault(require("../../input"));
var _button = _interopRequireDefault(require("../../button"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : 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); }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
/**
 * 生成节点的唯一主键
 */
function getNodeUniqueId() {
  return _xeUtils.default.uniqueId('node_');
}
function handleVisibleOrCheckMode(mode, isExistChild, nLevel) {
  if (mode) {
    if (mode === 'first') {
      return !nLevel;
    }
    if (mode === 'last') {
      return !isExistChild;
    }
  }
  return true;
}
function createReactData() {
  return {
    initialized: false,
    searchValue: '',
    searchLoading: false,
    currentCunkList: [],
    currentItems: [],
    currentNode: null,
    panelIndex: 0,
    panelStyle: {},
    panelPlacement: null,
    triggerFocusPanel: false,
    visiblePanel: false,
    isAniVisible: false,
    isActivated: false,
    selectRadioKey: null,
    treeList: [],
    updateExpandedFlag: 1,
    updateCheckboxFlag: 1,
    fullOptFlag: 1,
    lazyOptFlag: 1
  };
}
function createInternalData() {
  return {
    // hpTimeout: undefined,
    listVirtualYOpts: {
      enabled: true,
      gt: 20
    },
    afterTreeList: [],
    treeFullData: [],
    afterVisibleList: [],
    nodeMaps: {},
    fullNodeMaps: {},
    lazyNodeMaps: {},
    indeterminateRowMaps: {},
    selectCheckboxMaps: {},
    treeExpandedMaps: {},
    treeExpandLazyLoadedMaps: {}
    // isUpdateMode: false
  };
}
var _default2 = exports.default = /* define-vxe-component start */(0, _comp.defineVxeComponent)({
  name: 'VxeCascader',
  mixins: [_ui.globalMixins.sizeMixin],
  model: {
    prop: 'value',
    event: 'modelValue'
  },
  props: {
    value: [String, Number, Array],
    clearable: Boolean,
    placeholder: {
      type: String,
      default: function _default() {
        return _xeUtils.default.eqNull((0, _ui.getConfig)().cascader.placeholder) ? (0, _ui.getI18n)('vxe.base.pleaseSelect') : (0, _ui.getConfig)().cascader.placeholder;
      }
    },
    readonly: {
      type: Boolean,
      default: null
    },
    loading: Boolean,
    disabled: {
      type: Boolean,
      default: null
    },
    filterable: Boolean,
    filterConfig: Object,
    showFullLabel: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.showFullLabel;
      }
    },
    separator: {
      type: String,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.separator;
      }
    },
    multiple: Boolean,
    className: [String, Function],
    prefixIcon: String,
    lazyOptions: Array,
    options: Array,
    optionProps: Object,
    size: {
      type: String,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.size || (0, _ui.getConfig)().size;
      }
    },
    treeConfig: Object,
    showRadio: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.showRadio;
      }
    },
    radioConfig: Object,
    showCheckbox: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.showCheckbox;
      }
    },
    checkboxConfig: Object,
    remote: Boolean,
    remoteConfig: Function,
    popupConfig: Object,
    checkedClosable: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.checkedClosable;
      }
    },
    clearClosable: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.clearClosable;
      }
    },
    showCloseButton: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.showCloseButton;
      }
    },
    showTotalButton: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.showTotalButton;
      }
    },
    showCheckedButton: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.showCheckedButton;
      }
    },
    showClearButton: {
      type: Boolean,
      default: function _default() {
        return (0, _ui.getConfig)().cascader.showClearButton;
      }
    }
  },
  inject: {
    $xeModal: {
      default: null
    },
    $xeDrawer: {
      default: null
    },
    $xeTable: {
      default: null
    },
    $xeForm: {
      default: null
    },
    formItemInfo: {
      from: 'xeFormItemInfo',
      default: null
    }
  },
  provide: function provide() {
    var $xeCascader = this;
    return {
      $xeCascader: $xeCascader
    };
  },
  data: function data() {
    var xID = _xeUtils.default.uniqueId();
    var reactData = createReactData();
    return Object.assign(Object.assign({}, {}), {
      xID: xID,
      reactData: reactData
    });
  },
  computed: Object.assign(Object.assign({}, {}), {
    computeFormReadonly: function computeFormReadonly() {
      var $xeCascader = this;
      var props = $xeCascader;
      var $xeForm = $xeCascader.$xeForm;
      var readonly = props.readonly;
      if (readonly === null) {
        if ($xeForm) {
          return $xeForm.readonly;
        }
        return false;
      }
      return readonly;
    },
    computeIsDisabled: function computeIsDisabled() {
      var $xeCascader = this;
      var props = $xeCascader;
      var $xeForm = $xeCascader.$xeForm;
      var disabled = props.disabled;
      if (disabled === null) {
        if ($xeForm) {
          return $xeForm.disabled;
        }
        return false;
      }
      return disabled;
    },
    computeBtnTransfer: function computeBtnTransfer() {
      var $xeCascader = this;
      var $xeTable = $xeCascader.$xeTable;
      var $xeModal = $xeCascader.$xeModal;
      var $xeDrawer = $xeCascader.$xeDrawer;
      var $xeForm = $xeCascader.$xeForm;
      var popupOpts = $xeCascader.computePopupOpts;
      var transfer = popupOpts.transfer;
      if (_xeUtils.default.isBoolean(transfer)) {
        return transfer;
      }
      if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
        return true;
      }
      return false;
    },
    computeTreeOpts: function computeTreeOpts() {
      var $xeCascader = this;
      var props = $xeCascader;
      return Object.assign({}, (0, _ui.getConfig)().cascader.treeConfig, props.treeConfig);
    },
    computeRadioOpts: function computeRadioOpts() {
      var $xeCascader = this;
      var props = $xeCascader;
      return Object.assign({}, (0, _ui.getConfig)().cascader.radioConfig, props.radioConfig);
    },
    computeCheckboxOpts: function computeCheckboxOpts() {
      var $xeCascader = this;
      var props = $xeCascader;
      return Object.assign({}, (0, _ui.getConfig)().cascader.checkboxConfig, props.checkboxConfig);
    },
    computePopupOpts: function computePopupOpts() {
      var $xeCascader = this;
      var props = $xeCascader;
      return Object.assign({}, (0, _ui.getConfig)().cascader.popupConfig, props.popupConfig);
    },
    computePropsOpts: function computePropsOpts() {
      var $xeCascader = this;
      var props = $xeCascader;
      return props.optionProps || {};
    },
    computeLabelField: function computeLabelField() {
      var $xeCascader = this;
      var propsOpts = $xeCascader.computePropsOpts;
      return propsOpts.label || 'label';
    },
    computeValueField: function computeValueField() {
      var $xeCascader = this;
      var propsOpts = $xeCascader.computePropsOpts;
      return propsOpts.value || 'value';
    },
    computeKeyField: function computeKeyField() {
      var $xeCascader = this;
      var treeOpts = $xeCascader.computeTreeOpts;
      return treeOpts.keyField || 'id';
    },
    computeParentField: function computeParentField() {
      var $xeCascader = this;
      var treeOpts = $xeCascader.computeTreeOpts;
      return treeOpts.parentField || 'parentId';
    },
    computeChildrenField: function computeChildrenField() {
      var $xeCascader = this;
      var treeOpts = $xeCascader.computeTreeOpts;
      return treeOpts.childrenField || 'children';
    },
    computeMapChildrenField: function computeMapChildrenField() {
      var $xeCascader = this;
      var treeOpts = $xeCascader.computeTreeOpts;
      return treeOpts.mapChildrenField || 'mapChildren';
    },
    computeHasChildField: function computeHasChildField() {
      var $xeCascader = this;
      var treeOpts = $xeCascader.computeTreeOpts;
      return treeOpts.hasChildField || 'hasChild';
    },
    computeRemoteOpts: function computeRemoteOpts() {
      var $xeCascader = this;
      var props = $xeCascader;
      return Object.assign({}, (0, _ui.getConfig)().cascader.remoteConfig, props.remoteConfig);
    },
    computeSelectVals: function computeSelectVals() {
      var $xeCascader = this;
      var props = $xeCascader;
      var modelValue = props.value;
      return _xeUtils.default.eqNull(modelValue) ? [] : _xeUtils.default.isArray(modelValue) ? modelValue : [modelValue];
    },
    computeSelectLabel: function computeSelectLabel() {
      var $xeCascader = this;
      var props = $xeCascader;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var showFullLabel = props.showFullLabel;
      var fullOptFlag = reactData.fullOptFlag,
        lazyOptFlag = reactData.lazyOptFlag;
      var fullNodeMaps = internalData.fullNodeMaps,
        lazyNodeMaps = internalData.lazyNodeMaps;
      var labelField = $xeCascader.computeLabelField;
      var selectVals = $xeCascader.computeSelectVals;
      return selectVals.map(function (val) {
        var cacheItem = fullNodeMaps[val];
        if (fullOptFlag && cacheItem) {
          return showFullLabel ? cacheItem.fullLabel : cacheItem.item[labelField];
        }
        if (lazyOptFlag) {
          var lazyCacheItem = lazyNodeMaps[val];
          if (lazyCacheItem) {
            return showFullLabel ? lazyCacheItem.fullLabel : lazyCacheItem.item[labelField];
          }
        }
        return val;
      }).join(', ');
    },
    computePopupWrapperStyle: function computePopupWrapperStyle() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var currentCunkList = reactData.currentCunkList,
        panelStyle = reactData.panelStyle;
      var popupOpts = $xeCascader.computePopupOpts;
      var height = popupOpts.height,
        nodeWidth = popupOpts.nodeWidth,
        nodeHeight = popupOpts.nodeHeight;
      var stys = Object.assign(Object.assign({}, panelStyle), {
        '--vxe-ui-cascader-chunk-size': currentCunkList.length
      });
      if (height) {
        stys['--vxe-ui-cascader-chunk-height'] = (0, _dom.toCssUnit)(height);
      }
      if (nodeWidth) {
        stys['--vxe-ui-cascader-node-width'] = (0, _dom.toCssUnit)(nodeWidth);
      }
      if (nodeHeight) {
        stys['--vxe-ui-cascader-node-height'] = (0, _dom.toCssUnit)(nodeHeight);
      }
      return stys;
    },
    computeFilterOpts: function computeFilterOpts() {
      var $xeCascader = this;
      var props = $xeCascader;
      return Object.assign({}, (0, _ui.getConfig)().cascader.filterConfig, props.filterConfig);
    }
  }),
  methods: {
    //
    // Method
    //
    dispatchEvent: function dispatchEvent(type, params, evnt) {
      var $xeCascader = this;
      $xeCascader.$emit(type, (0, _ui.createEvent)(evnt, {
        $cascader: $xeCascader
      }, params));
    },
    emitModel: function emitModel(value) {
      var $xeCascader = this;
      var _events = $xeCascader._events;
      if (_events && _events.modelValue) {
        $xeCascader.$emit('modelValue', value);
      } else {
        $xeCascader.$emit('model-value', value);
      }
    },
    getNodeId: function getNodeId(node) {
      var $xeCascader = this;
      if (!node) {
        return '';
      }
      var valueField = $xeCascader.computeValueField;
      var nodeKey = node[valueField];
      return (0, _util.enNodeValue)(nodeKey);
    },
    isPathInTree: function isPathInTree(treeData, pathIds) {
      var $xeCascader = this;
      if (!pathIds || !pathIds.length) {
        return false;
      }
      var currentNodes = treeData;
      var _iterator = _createForOfIteratorHelper(pathIds),
        _step;
      try {
        var _loop = function _loop() {
            var nodeid = _step.value;
            var found = currentNodes.find(function (node) {
              return $xeCascader.getNodeId(node) === nodeid;
            });
            if (!found) {
              return {
                v: false
              };
            }
            currentNodes = found.children || [];
          },
          _ret;
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          _ret = _loop();
          if (_ret) return _ret.v;
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
      return true;
    },
    isCheckedByCheckboxNodeId: function isCheckedByCheckboxNodeId(nodeid) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var updateCheckboxFlag = reactData.updateCheckboxFlag;
      var selectCheckboxMaps = internalData.selectCheckboxMaps;
      return !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
    },
    handleCheckedCheckboxNode: function handleCheckedCheckboxNode(nodeList, checked) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var selectCheckboxMaps = internalData.selectCheckboxMaps;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var childrenField = $xeCascader.computeChildrenField;
      var checkboxOpts = $xeCascader.computeCheckboxOpts;
      var checkStrictly = checkboxOpts.checkStrictly;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var handleSelect = function handleSelect(node) {
        var nodeid = $xeCascader.getNodeId(node);
        if (checked) {
          if (!selectCheckboxMaps[nodeid]) {
            selectCheckboxMaps[nodeid] = node;
          }
        } else {
          if (selectCheckboxMaps[nodeid]) {
            delete selectCheckboxMaps[nodeid];
          }
        }
      };
      if (checkStrictly) {
        nodeList.forEach(handleSelect);
      } else {
        _xeUtils.default.eachTree(nodeList, handleSelect, {
          children: transform ? mapChildrenField : childrenField
        });
      }
      reactData.updateCheckboxFlag++;
      $xeCascader.updateCheckboxStatus();
    },
    createNode: function createNode(records) {
      var $xeCascader = this;
      var valueField = $xeCascader.computeValueField;
      return Promise.resolve(records.map(function (obj) {
        var item = Object.assign({}, obj);
        var nodeid = $xeCascader.getNodeId(item);
        if (!nodeid) {
          nodeid = getNodeUniqueId();
          _xeUtils.default.set(item, valueField, nodeid);
        }
        return item;
      }));
    },
    handleSetCheckboxByNodeId: function handleSetCheckboxByNodeId(nodeKeys, checked) {
      var $xeCascader = this;
      var internalData = $xeCascader.internalData;
      var nodeMaps = internalData.nodeMaps;
      if (nodeKeys) {
        if (!_xeUtils.default.isArray(nodeKeys)) {
          nodeKeys = [nodeKeys];
        }
        var nodeList = [];
        nodeKeys.forEach(function (nodeKey) {
          var nodeid = (0, _util.enNodeValue)(nodeKey);
          var nodeItem = nodeMaps[nodeid];
          if (nodeItem) {
            nodeList.push(nodeItem.item);
          }
        });
        $xeCascader.handleCheckedCheckboxNode(nodeList, checked);
      }
      return $xeCascader.$nextTick();
    },
    updateCheckboxChecked: function updateCheckboxChecked(nodeKeys) {
      var $xeCascader = this;
      var internalData = $xeCascader.internalData;
      internalData.selectCheckboxMaps = {};
      $xeCascader.handleSetCheckboxByNodeId(nodeKeys, true);
    },
    updateModelChecked: function updateModelChecked() {
      var $xeCascader = this;
      var props = $xeCascader;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var modelValue = props.value;
      var nodeMaps = internalData.nodeMaps;
      var expandedMaps = {};
      if (props.multiple) {
        if (modelValue && modelValue.length) {
          $xeCascader.updateCheckboxChecked(modelValue);
        }
      } else {
        if (modelValue) {
          var nodeid = (0, _util.enNodeValue)(_xeUtils.default.isArray(modelValue) ? modelValue[0] : modelValue);
          var itemRest = nodeMaps[nodeid];
          if (itemRest) {
            itemRest.nodes.forEach(function (item) {
              expandedMaps[$xeCascader.getNodeId(item)] = true;
            });
            reactData.selectRadioKey = nodeid;
          }
        }
      }
      internalData.treeExpandedMaps = expandedMaps;
    },
    cacheNodeMap: function cacheNodeMap() {
      var $xeCascader = this;
      var props = $xeCascader;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var separator = props.separator;
      var treeFullData = internalData.treeFullData;
      var valueField = $xeCascader.computeValueField;
      var labelField = $xeCascader.computeLabelField;
      var childrenField = $xeCascader.computeChildrenField;
      var keyMaps = {};
      var fullMaps = {};
      _xeUtils.default.eachTree(treeFullData, function (item, index, items, path, parenItem, nodes) {
        var nodeid = $xeCascader.getNodeId(item);
        if (!nodeid) {
          nodeid = getNodeUniqueId();
          item[valueField] = nodeid;
        }
        var nodeVal = item[valueField];
        var itemRest = {
          item: item,
          index: index,
          $index: -1,
          _index: -1,
          items: items,
          parent: parenItem,
          nodes: nodes,
          level: nodes.length - 1,
          treeIndex: index,
          lineCount: 0,
          treeLoaded: false,
          fullLabel: nodes.map(function (item) {
            return item[labelField];
          }).join(separator || ' / ')
        };
        keyMaps[nodeid] = itemRest;
        fullMaps[nodeVal] = itemRest;
      }, {
        children: childrenField
      });
      internalData.nodeMaps = keyMaps;
      internalData.fullNodeMaps = fullMaps;
      reactData.fullOptFlag++;
    },
    updateAfterDataIndex: function updateAfterDataIndex() {
      var $xeCascader = this;
      var props = $xeCascader;
      var internalData = $xeCascader.internalData;
      var separator = props.separator;
      var afterTreeList = internalData.afterTreeList,
        nodeMaps = internalData.nodeMaps;
      var labelField = $xeCascader.computeLabelField;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var vtIndex = 0;
      _xeUtils.default.eachTree(afterTreeList, function (item, index, items, path, parenItem, nodes) {
        var nodeid = $xeCascader.getNodeId(item);
        var nodeItem = nodeMaps[nodeid];
        if (nodeItem) {
          nodeItem.items = items;
          nodeItem.treeIndex = index;
          nodeItem._index = vtIndex;
        } else {
          var rest = {
            item: item,
            index: index,
            $index: -1,
            _index: vtIndex,
            items: items,
            parent: parenItem,
            nodes: nodes,
            level: nodes.length - 1,
            treeIndex: index,
            lineCount: 0,
            treeLoaded: false,
            fullLabel: nodes.map(function (item) {
              return item[labelField];
            }).join(separator || ' / ')
          };
          nodeMaps[nodeid] = rest;
        }
        vtIndex++;
      }, {
        children: transform ? mapChildrenField : childrenField
      });
    },
    updateAfterFullData: function updateAfterFullData() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var searchValue = reactData.searchValue;
      var treeFullData = internalData.treeFullData,
        lastFilterValue = internalData.lastFilterValue;
      var labelField = $xeCascader.computeLabelField;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var filterOpts = $xeCascader.computeFilterOpts;
      var beforeFilterMethod = filterOpts.beforeFilterMethod,
        filterMethod = filterOpts.filterMethod,
        afterFilterMethod = filterOpts.afterFilterMethod;
      var fullList = treeFullData;
      var treeList = fullList;
      var filterStr = '';
      if (searchValue) {
        filterStr = "".concat(searchValue);
        var handleSearch = filterMethod ? function (item) {
          return filterMethod({
            $cascader: $xeCascader,
            node: item,
            filterValue: filterStr
          });
        } : function (item) {
          return String(item[labelField]).toLowerCase().indexOf(filterStr.toLowerCase()) > -1;
        };
        var bafParams = {
          $cascader: $xeCascader,
          filterValue: filterStr
        };
        if (beforeFilterMethod) {
          beforeFilterMethod(bafParams);
        }
        if (transform) {
          treeList = _xeUtils.default.searchTree(treeFullData, handleSearch, {
            original: true,
            isEvery: false,
            children: childrenField,
            mapChildren: mapChildrenField
          });
          fullList = treeList;
        } else {
          fullList = treeFullData.filter(handleSearch);
        }
        internalData.lastFilterValue = filterStr;
        $xeCascader.$nextTick(function () {
          if (afterFilterMethod) {
            afterFilterMethod(bafParams);
          }
        });
      } else {
        if (transform) {
          treeList = _xeUtils.default.searchTree(treeFullData, function () {
            return true;
          }, {
            original: true,
            isEvery: false,
            children: childrenField,
            mapChildren: mapChildrenField
          });
          fullList = treeList;
          if (lastFilterValue) {
            var _bafParams = {
              $cascader: $xeCascader,
              filterValue: filterStr
            };
            if (beforeFilterMethod) {
              beforeFilterMethod(_bafParams);
            }
            // 取消筛选时自动收起
            $xeCascader.$nextTick(function () {
              if (afterFilterMethod) {
                afterFilterMethod(_bafParams);
              }
            });
          }
        }
        internalData.lastFilterValue = '';
      }
      internalData.afterVisibleList = fullList;
      internalData.afterTreeList = treeList;
      $xeCascader.updateAfterDataIndex();
    },
    /**
     * 如果为虚拟树、则将树结构拍平
     */
    handleTreeToList: function handleTreeToList() {
      var $xeCascader = this;
      var internalData = $xeCascader.internalData;
      var afterTreeList = internalData.afterTreeList,
        treeExpandedMaps = internalData.treeExpandedMaps;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var expandMaps = {};
      if (transform) {
        var fullData = [];
        _xeUtils.default.eachTree(afterTreeList, function (item, index, items, path, parentRow) {
          var nodeid = $xeCascader.getNodeId(item);
          var parentNodeid = $xeCascader.getNodeId(parentRow);
          if (!parentRow || expandMaps[parentNodeid] && treeExpandedMaps[parentNodeid]) {
            expandMaps[nodeid] = 1;
            fullData.push(item);
          }
        }, {
          children: mapChildrenField
        });
        internalData.afterVisibleList = fullData;
        return fullData;
      }
      return internalData.afterVisibleList;
    },
    handleData: function handleData(force) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var fullList = internalData.afterVisibleList;
      if (force) {
        // 更新数据，处理筛选和排序
        $xeCascader.updateAfterFullData();
        // 如果为虚拟树，将树结构拍平
        fullList = $xeCascader.handleTreeToList();
      }
      var treeList = fullList.slice(0);
      reactData.treeList = treeList;
    },
    /**
     * 获取第一个拥有子节点的节点
     */
    handleHasChildNodeIds: function handleHasChildNodeIds(treeList, type) {
      var $xeCascader = this;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var childField = transform ? mapChildrenField : childrenField;
      var nodeIds = [];
      var currList = treeList;
      while (currList.length) {
        var targetNode = null;
        var _iterator2 = _createForOfIteratorHelper(currList),
          _step2;
        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var item = _step2.value;
            var kids = item[childField];
            if (_xeUtils.default.isArray(kids) && kids.length > 0) {
              targetNode = item;
              break;
            }
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
        if (targetNode) {
          nodeIds.push($xeCascader.getNodeId(targetNode));
          currList = targetNode[childField];
        } else {
          var endNode = _xeUtils.default[type](currList);
          nodeIds.push($xeCascader.getNodeId(endNode));
          break;
        }
      }
      return nodeIds;
    },
    triggerSearchEvent: _xeUtils.default.debounce(function () {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      $xeCascader.handleData(true);
      $xeCascader.updateCheckboxStatus();
      var currentItems = reactData.currentItems;
      var afterTreeList = internalData.afterTreeList;
      var filterOpts = $xeCascader.computeFilterOpts;
      var autoExpandMode = filterOpts.autoExpandMode;
      // 如果当前不在列表情况下，触发默认行为
      if (!$xeCascader.isPathInTree(afterTreeList, currentItems)) {
        // 默认展开
        if (autoExpandMode === 'first' || autoExpandMode === 'last') {
          var stItems = $xeCascader.handleHasChildNodeIds(afterTreeList, autoExpandMode);
          var expandedMaps = {};
          stItems.forEach(function (nodeid) {
            expandedMaps[nodeid] = true;
          });
          internalData.treeExpandedMaps = expandedMaps;
          reactData.currentItems = stItems;
        } else {
          $xeCascader.handleCurrentItems();
        }
      }
      $xeCascader.updateCurrentChunk();
    }, 350, {
      trailing: true
    }),
    loadData: function loadData(list) {
      var $xeCascader = this;
      var internalData = $xeCascader.internalData;
      var treeOpts = $xeCascader.computeTreeOpts;
      var keyField = $xeCascader.computeKeyField;
      var parentField = $xeCascader.computeParentField;
      var childrenField = $xeCascader.computeChildrenField;
      var rootParentValue = treeOpts.rootParentValue,
        rootValues = treeOpts.rootValues;
      var transform = treeOpts.transform;
      var fullData = transform ? _xeUtils.default.toArrayTree(list, {
        key: keyField,
        parentKey: parentField,
        mapChildren: childrenField,
        rootParentValue: rootParentValue,
        rootValues: rootValues
      }) : list ? list.slice(0) : [];
      internalData.treeFullData = fullData;
      $xeCascader.cacheNodeMap();
      $xeCascader.handleData(true);
      $xeCascader.updateModelChecked();
      $xeCascader.handleCurrentItems();
      $xeCascader.updateCurrentChunk();
      return $xeCascader.$nextTick();
    },
    updateCurrentChunk: function updateCurrentChunk() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var currentItems = reactData.currentItems;
      var afterTreeList = internalData.afterTreeList;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var currentCunkList = [afterTreeList];
      if (currentItems.length) {
        var chunkIndex = 0;
        var stNodeid = currentItems[chunkIndex];
        var optList = afterTreeList;
        while (stNodeid && optList && optList.length) {
          stNodeid = currentItems[chunkIndex++];
          var currOption = optList.find(function (item) {
            return stNodeid === $xeCascader.getNodeId(item);
          });
          optList = currOption ? currOption[transform ? mapChildrenField : childrenField] : [];
          if (!optList || !optList.length) {
            break;
          }
          currentCunkList.push(optList);
        }
      }
      reactData.currentCunkList = currentCunkList;
    },
    handleCurrentItems: function handleCurrentItems() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var currentNode = reactData.currentNode;
      var afterTreeList = internalData.afterTreeList;
      var selectVals = $xeCascader.computeSelectVals;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var stItems = [];
      var expandedMaps = {};
      var lastVal = currentNode ? $xeCascader.getNodeId(currentNode) : (0, _util.enNodeValue)(_xeUtils.default.last(selectVals));
      if (lastVal) {
        var stRest = _xeUtils.default.findTree(afterTreeList, function (item) {
          return lastVal === $xeCascader.getNodeId(item);
        }, {
          children: transform ? mapChildrenField : childrenField
        });
        if (stRest) {
          var nodes = stRest.nodes;
          nodes.forEach(function (item) {
            var nodeid = $xeCascader.getNodeId(item);
            expandedMaps[nodeid] = true;
            stItems.push(nodeid);
          });
        }
      }
      reactData.currentItems = stItems;
      internalData.treeExpandedMaps = expandedMaps;
    },
    updateZindex: function updateZindex() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var popupOpts = $xeCascader.computePopupOpts;
      var zIndex = popupOpts.zIndex;
      if (zIndex) {
        reactData.panelIndex = zIndex;
      } else if (reactData.panelIndex < (0, _utils.getLastZIndex)()) {
        reactData.panelIndex = (0, _utils.nextZIndex)();
      }
    },
    updatePlacement: function updatePlacement() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var panelIndex = reactData.panelIndex;
      var targetElem = $xeCascader.$refs.refElem;
      var panelElem = $xeCascader.$refs.refOptionPanel;
      var btnTransfer = $xeCascader.computeBtnTransfer;
      var popupOpts = $xeCascader.computePopupOpts;
      var handleStyle = function handleStyle() {
        var ppObj = (0, _dom.updatePanelPlacement)(targetElem, panelElem, {
          placement: popupOpts.placement,
          defaultPlacement: popupOpts.defaultPlacement,
          teleportTo: btnTransfer,
          isMinWidth: false
        });
        var panelStyle = Object.assign(ppObj.style, {
          zIndex: panelIndex
        });
        reactData.panelStyle = panelStyle;
        reactData.panelPlacement = ppObj.placement;
      };
      handleStyle();
      return $xeCascader.$nextTick().then(handleStyle);
    },
    showOptionPanel: function showOptionPanel(evnt) {
      var $xeCascader = this;
      var props = $xeCascader;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var loading = props.loading,
        remote = props.remote,
        filterable = props.filterable;
      var treeFullData = internalData.treeFullData;
      var isDisabled = $xeCascader.computeIsDisabled;
      var remoteOpts = $xeCascader.computeRemoteOpts;
      if (!loading && !isDisabled) {
        clearTimeout(internalData.hpTimeout);
        if (!reactData.initialized) {
          reactData.initialized = true;
          var btnTransfer = $xeCascader.computeBtnTransfer;
          var panelElem = $xeCascader.$refs.refOptionPanel;
          if (btnTransfer) {
            if (panelElem) {
              document.body.appendChild(panelElem);
            }
          }
        }
        reactData.isActivated = true;
        reactData.isAniVisible = true;
        if (filterable) {
          if (remote && remoteOpts.enabled && remoteOpts.autoLoad && !treeFullData.length) {
            $xeCascader.handleSearchEvent();
          }
        }
        setTimeout(function () {
          reactData.visiblePanel = true;
          $xeCascader.handleFocusSearch();
        }, 10);
        $xeCascader.updateZindex();
        $xeCascader.updatePlacement();
        $xeCascader.dispatchEvent('visible-change', {
          visible: true
        }, evnt || null);
      }
    },
    hideOptionPanel: function hideOptionPanel(evnt) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      reactData.visiblePanel = false;
      internalData.hpTimeout = setTimeout(function () {
        reactData.isAniVisible = false;
      }, 350);
      $xeCascader.dispatchEvent('visible-change', {
        visible: false
      }, evnt || null);
    },
    setCurrentNode: function setCurrentNode(node) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      reactData.currentNode = node;
      return $xeCascader.$nextTick();
    },
    setAllCheckboxNode: function setAllCheckboxNode(checked) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var selectMaps = {};
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var checkKeys = [];
      var checkNodes = [];
      if (checked) {
        _xeUtils.default.eachTree(internalData.afterTreeList, function (node) {
          var nodeid = $xeCascader.getNodeId(node);
          checkKeys.push(nodeid);
          checkNodes.push(node);
          selectMaps[nodeid] = true;
        }, {
          children: transform ? mapChildrenField : childrenField
        });
      }
      internalData.indeterminateRowMaps = {};
      internalData.selectCheckboxMaps = selectMaps;
      reactData.updateCheckboxFlag++;
      $xeCascader.updateCheckboxStatus();
      return $xeCascader.$nextTick().then(function () {
        return {
          checkNodeKeys: checkKeys,
          checkNodes: checkNodes
        };
      });
    },
    clearSelectedNode: function clearSelectedNode() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      internalData.indeterminateRowMaps = {};
      internalData.selectCheckboxMaps = {};
      reactData.updateCheckboxFlag++;
      reactData.selectRadioKey = null;
      $xeCascader.updateCheckboxStatus();
      return $xeCascader.$nextTick().then(function () {
        return {
          checkNodeKeys: [],
          checkNodes: []
        };
      });
    },
    changeEvent: function changeEvent(evnt, selectValue, node) {
      var $xeCascader = this;
      var props = $xeCascader;
      var internalData = $xeCascader.internalData;
      var $xeForm = $xeCascader.$xeForm;
      var formItemInfo = $xeCascader.formItemInfo;
      var value = _xeUtils.default.isArray(selectValue) ? selectValue.map(_util.deNodeValue) : (0, _util.deNodeValue)(selectValue);
      internalData.isUpdateMode = true;
      $xeCascader.emitModel(value);
      if (value !== props.value) {
        $xeCascader.dispatchEvent('change', {
          value: value,
          node: node,
          option: node
        }, evnt);
        // 自动更新校验状态
        if ($xeForm && formItemInfo) {
          $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
        }
      }
    },
    clearValueEvent: function clearValueEvent(evnt, selectValue) {
      var $xeCascader = this;
      $xeCascader.changeEvent(evnt, selectValue, null);
      $xeCascader.dispatchEvent('clear', {
        value: selectValue
      }, evnt);
    },
    clearEvent: function clearEvent(params, evnt) {
      var $xeCascader = this;
      $xeCascader.clearValueEvent(evnt, null);
      $xeCascader.hideOptionPanel(evnt);
    },
    allCheckedPanelEvent: function allCheckedPanelEvent(params) {
      var $xeCascader = this;
      var props = $xeCascader;
      var $event = params.$event;
      var multiple = props.multiple,
        checkedClosable = props.checkedClosable;
      if (multiple) {
        $xeCascader.setAllCheckboxNode(true).then(function (_ref) {
          var checkNodeKeys = _ref.checkNodeKeys,
            checkNodes = _ref.checkNodes;
          $xeCascader.changeEvent($event, checkNodeKeys, checkNodes[0]);
          $xeCascader.dispatchEvent('all-change', {
            value: checkNodeKeys
          }, $event);
          if (checkedClosable) {
            $xeCascader.hideOptionPanel($event);
          }
        });
      }
    },
    clearCheckedPanelEvent: function clearCheckedPanelEvent(params) {
      var $xeCascader = this;
      var props = $xeCascader;
      var $event = params.$event;
      var multiple = props.multiple,
        checkedClosable = props.checkedClosable;
      var value = multiple ? [] : null;
      $xeCascader.clearSelectedNode().then(function () {
        if (checkedClosable) {
          $xeCascader.hideOptionPanel($event);
        }
      });
      $xeCascader.changeEvent($event, value, null);
      $xeCascader.dispatchEvent('clear', {
        value: value
      }, $event);
    },
    closePanelEvent: function closePanelEvent(params) {
      var $xeCascader = this;
      var $event = params.$event;
      $xeCascader.hideOptionPanel($event);
    },
    handleGlobalMousewheelEvent: function handleGlobalMousewheelEvent(evnt) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var visiblePanel = reactData.visiblePanel;
      var isDisabled = $xeCascader.computeIsDisabled;
      if (!isDisabled) {
        if (visiblePanel) {
          var panelElem = $xeCascader.$refs.refOptionPanel;
          if ((0, _dom.getEventTargetNode)(evnt, panelElem).flag) {
            $xeCascader.updatePlacement();
          } else {
            $xeCascader.hideOptionPanel(evnt);
          }
        }
      }
    },
    handleGlobalMousedownEvent: function handleGlobalMousedownEvent(evnt) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var visiblePanel = reactData.visiblePanel;
      var isDisabled = $xeCascader.computeIsDisabled;
      if (!isDisabled) {
        var el = $xeCascader.$refs.refElem;
        var panelElem = $xeCascader.$refs.refOptionPanel;
        reactData.isActivated = (0, _dom.getEventTargetNode)(evnt, el).flag || (0, _dom.getEventTargetNode)(evnt, panelElem).flag;
        if (visiblePanel && !reactData.isActivated) {
          $xeCascader.hideOptionPanel(evnt);
        }
      }
    },
    handleGlobalBlurEvent: function handleGlobalBlurEvent(evnt) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var visiblePanel = reactData.visiblePanel,
        isActivated = reactData.isActivated;
      if (visiblePanel) {
        $xeCascader.hideOptionPanel(evnt);
      }
      if (isActivated) {
        reactData.isActivated = false;
      }
      if (visiblePanel || isActivated) {
        var $input = $xeCascader.$refs.refInput;
        if ($input) {
          $input.blur();
        }
      }
    },
    handleGlobalResizeEvent: function handleGlobalResizeEvent() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var visiblePanel = reactData.visiblePanel;
      if (visiblePanel) {
        $xeCascader.updatePlacement();
      }
    },
    handleFocusSearch: function handleFocusSearch() {
      var $xeCascader = this;
      var props = $xeCascader;
      if (props.filterable) {
        $xeCascader.$nextTick(function () {
          var inpSearch = $xeCascader.$refs.refInpSearch;
          if (inpSearch) {
            inpSearch.focus();
          }
        });
      }
    },
    changeCurrentEvent: function changeCurrentEvent(evnt, node) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      evnt.preventDefault();
      var isChecked = true;
      reactData.currentNode = node;
      $xeCascader.dispatchEvent('current-change', {
        node: node,
        checked: isChecked
      }, evnt);
    },
    changeRadioEvent: function changeRadioEvent(evnt, node, chunks, chunkIndex) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      evnt.preventDefault();
      evnt.stopPropagation();
      var currentItems = reactData.currentItems;
      var nodeMaps = internalData.nodeMaps;
      var radioOpts = $xeCascader.computeRadioOpts;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var checkMode = radioOpts.checkMode,
        checkMethod = radioOpts.checkMethod;
      var nodeid = $xeCascader.getNodeId(node);
      var childList = node[transform ? mapChildrenField : childrenField];
      var isExistChild = childList && childList.length > 0;
      var nodeItem = nodeMaps[nodeid] || {};
      var nLevel = nodeItem.level;
      var isDisabled = checkMethod ? !checkMethod({
        $cascader: $xeCascader,
        node: node
      }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
      if (isDisabled) {
        return;
      }
      var value = nodeid;
      reactData.selectRadioKey = value;
      $xeCascader.changeEvent(evnt, value, node);
      if (!currentItems.includes(nodeid)) {
        $xeCascader.changeCurrentEvent(evnt, node);
        $xeCascader.toggleExpandEvent(evnt, node, chunks, chunkIndex);
      }
      $xeCascader.hideOptionPanel(evnt);
    },
    handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(node) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var checkboxOpts = $xeCascader.computeCheckboxOpts;
      var treeOpts = $xeCascader.computeTreeOpts;
      var loadMethod = treeOpts.loadMethod;
      var checkStrictly = checkboxOpts.checkStrictly;
      return new Promise(function (resolve) {
        if (loadMethod) {
          var nodeMaps = internalData.nodeMaps;
          var nodeid = $xeCascader.getNodeId(node);
          var nodeItem = nodeMaps[nodeid];
          internalData.treeExpandLazyLoadedMaps[nodeid] = true;
          Promise.resolve(loadMethod({
            $cascader: $xeCascader,
            node: node
          })).then(function (childRecords) {
            var treeExpandLazyLoadedMaps = internalData.treeExpandLazyLoadedMaps;
            nodeItem.treeLoaded = true;
            if (treeExpandLazyLoadedMaps[nodeid]) {
              treeExpandLazyLoadedMaps[nodeid] = false;
            }
            if (!_xeUtils.default.isArray(childRecords)) {
              childRecords = [];
            }
            if (childRecords) {
              return $xeCascader.loadChildrenNode(node, childRecords).then(function (childRows) {
                var treeExpandedMaps = internalData.treeExpandedMaps;
                if (childRows.length && !treeExpandedMaps[nodeid]) {
                  treeExpandedMaps[nodeid] = true;
                }
                reactData.updateExpandedFlag++;
                // 如果当前节点已选中，则展开后子节点也被选中
                if (!checkStrictly && $xeCascader.isCheckedByCheckboxNodeId(nodeid)) {
                  $xeCascader.handleCheckedCheckboxNode(childRows, true);
                }
                $xeCascader.dispatchEvent('load-success', {
                  node: node,
                  data: childRecords
                }, new Event('load-success'));
                return $xeCascader.$nextTick();
              });
            } else {
              $xeCascader.dispatchEvent('load-success', {
                node: node,
                data: childRecords
              }, new Event('load-success'));
            }
          }).catch(function (e) {
            var treeExpandLazyLoadedMaps = internalData.treeExpandLazyLoadedMaps;
            nodeItem.treeLoaded = false;
            if (treeExpandLazyLoadedMaps[nodeid]) {
              treeExpandLazyLoadedMaps[nodeid] = false;
            }
            $xeCascader.dispatchEvent('load-error', {
              node: node,
              data: e
            }, new Event('load-error'));
          }).finally(function () {
            $xeCascader.handleTreeToList();
            $xeCascader.handleData();
          });
        } else {
          resolve();
        }
      });
    },
    /**
     * 展开与收起树节点
     * @param nodeList
     * @param expanded
     * @returns
     */
    handleBaseTreeExpand: function handleBaseTreeExpand(nodeList, expanded) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var treeExpandLazyLoadedMaps = internalData.treeExpandLazyLoadedMaps,
        treeExpandedMaps = internalData.treeExpandedMaps;
      var nodeMaps = internalData.nodeMaps;
      var childrenField = $xeCascader.computeChildrenField;
      var hasChildField = $xeCascader.computeHasChildField;
      var treeOpts = $xeCascader.computeTreeOpts;
      var lazy = treeOpts.lazy,
        toggleMethod = treeOpts.toggleMethod;
      var result = [];
      var validNodes = toggleMethod ? nodeList.filter(function (node) {
        return toggleMethod({
          $cascader: $xeCascader,
          expanded: expanded,
          node: node
        });
      }) : nodeList;
      validNodes = validNodes.length ? [validNodes[validNodes.length - 1]] : [];
      // 同一级只能展开一个
      var nodeid = $xeCascader.getNodeId(validNodes[0]);
      var nodeItem = nodeMaps[nodeid];
      if (nodeItem) {
        nodeItem.items.forEach(function (item) {
          var itemNodeId = $xeCascader.getNodeId(item);
          if (treeExpandedMaps[itemNodeId]) {
            delete treeExpandedMaps[itemNodeId];
          }
        });
      }
      var expandNodes = [];
      if (expanded) {
        validNodes.forEach(function (item) {
          var itemNodeId = $xeCascader.getNodeId(item);
          if (!treeExpandedMaps[itemNodeId]) {
            var _nodeItem = nodeMaps[itemNodeId];
            var isLoad = lazy && item[hasChildField] && !_nodeItem.treeLoaded && !treeExpandLazyLoadedMaps[itemNodeId];
            // 是否使用懒加载
            if (isLoad) {
              result.push($xeCascader.handleAsyncTreeExpandChilds(item));
            } else {
              if (item[childrenField] && item[childrenField].length) {
                treeExpandedMaps[itemNodeId] = true;
                expandNodes.push(item);
              }
            }
          }
        });
      } else {
        validNodes.forEach(function (item) {
          var itemNodeId = $xeCascader.getNodeId(item);
          if (treeExpandedMaps[itemNodeId]) {
            delete treeExpandedMaps[itemNodeId];
            expandNodes.push(item);
          }
        });
      }
      reactData.updateExpandedFlag++;
      $xeCascader.handleTreeToList();
      $xeCascader.handleData();
      return Promise.all(result);
    },
    toggleExpandEvent: function toggleExpandEvent(evnt, node, chunks, chunkIndex) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var currentItems = reactData.currentItems;
      var treeExpandLazyLoadedMaps = internalData.treeExpandLazyLoadedMaps;
      var treeOpts = $xeCascader.computeTreeOpts;
      var lazy = treeOpts.lazy;
      var stItems = currentItems.slice(0, chunkIndex);
      var nodeid = $xeCascader.getNodeId(node);
      var expanded = true;
      evnt.stopPropagation();
      stItems.push(nodeid);
      reactData.currentItems = stItems;
      if (!lazy || !treeExpandLazyLoadedMaps[nodeid]) {
        $xeCascader.handleBaseTreeExpand([node], expanded);
      }
      $xeCascader.setCurrentNode(node);
      $xeCascader.updateCurrentChunk();
      $xeCascader.dispatchEvent('node-expand', {
        node: node,
        expanded: expanded
      }, evnt);
    },
    updateCheckboxStatus: function updateCheckboxStatus() {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var selectCheckboxMaps = internalData.selectCheckboxMaps,
        indeterminateRowMaps = internalData.indeterminateRowMaps,
        afterTreeList = internalData.afterTreeList;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var checkboxOpts = $xeCascader.computeCheckboxOpts;
      var checkStrictly = checkboxOpts.checkStrictly,
        checkMethod = checkboxOpts.checkMethod;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      if (!checkStrictly) {
        var childRowMaps = {};
        var childRowList = [];
        _xeUtils.default.eachTree(afterTreeList, function (node) {
          var nodeid = $xeCascader.getNodeId(node);
          var childList = node[transform ? mapChildrenField : childrenField];
          if (childList && childList.length && !childRowMaps[nodeid]) {
            childRowMaps[nodeid] = 1;
            childRowList.unshift([node, nodeid, childList]);
          }
        }, {
          children: transform ? mapChildrenField : childrenField
        });
        childRowList.forEach(function (vals) {
          var node = vals[0];
          var nodeid = vals[1];
          var childList = vals[2];
          var sLen = 0; // 已选
          var hLen = 0; // 半选
          var vLen = 0; // 有效子行
          var cLen = childList.length; // 子行
          childList.forEach(checkMethod ? function (item) {
            var childNodeid = $xeCascader.getNodeId(item);
            var isSelect = selectCheckboxMaps[childNodeid];
            if (checkMethod({
              $cascader: $xeCascader,
              node: item
            })) {
              if (isSelect) {
                sLen++;
              } else if (indeterminateRowMaps[childNodeid]) {
                hLen++;
              }
              vLen++;
            } else {
              if (isSelect) {
                sLen++;
              } else if (indeterminateRowMaps[childNodeid]) {
                hLen++;
              }
            }
          } : function (item) {
            var childNodeid = $xeCascader.getNodeId(item);
            var isSelect = selectCheckboxMaps[childNodeid];
            if (isSelect) {
              sLen++;
            } else if (indeterminateRowMaps[childNodeid]) {
              hLen++;
            }
            vLen++;
          });
          var isSelected = false;
          if (cLen > 0) {
            if (vLen > 0) {
              isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
            } else {
              // 如果存在子项禁用
              if (sLen > 0 && sLen >= vLen) {
                isSelected = true;
              } else if (selectCheckboxMaps[nodeid]) {
                isSelected = true;
              } else {
                isSelected = false;
              }
            }
          } else {
            // 如果无子项
            isSelected = selectCheckboxMaps[nodeid];
          }
          var halfSelect = !isSelected && (sLen > 0 || hLen > 0);
          if (isSelected) {
            selectCheckboxMaps[nodeid] = node;
            if (indeterminateRowMaps[nodeid]) {
              delete indeterminateRowMaps[nodeid];
            }
          } else {
            if (selectCheckboxMaps[nodeid]) {
              delete selectCheckboxMaps[nodeid];
            }
            if (halfSelect) {
              indeterminateRowMaps[nodeid] = node;
            } else {
              if (indeterminateRowMaps[nodeid]) {
                delete indeterminateRowMaps[nodeid];
              }
            }
          }
        });
        reactData.updateCheckboxFlag++;
      }
    },
    changeCheckboxEvent: function changeCheckboxEvent(evnt, node, chunks, chunkIndex) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      evnt.preventDefault();
      evnt.stopPropagation();
      // const { filterable } = props
      var currentItems = reactData.currentItems;
      var selectCheckboxMaps = internalData.selectCheckboxMaps,
        nodeMaps = internalData.nodeMaps;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var checkboxOpts = $xeCascader.computeCheckboxOpts;
      var checkStrictly = checkboxOpts.checkStrictly,
        checkMode = checkboxOpts.checkMode,
        checkMethod = checkboxOpts.checkMethod;
      var treeOpts = $xeCascader.computeTreeOpts;
      var transform = treeOpts.transform;
      var nodeid = $xeCascader.getNodeId(node);
      var childList = node[transform ? mapChildrenField : childrenField];
      var isExistChild = childList && childList.length > 0;
      var nodeItem = nodeMaps[nodeid] || {};
      var nLevel = nodeItem.level;
      var isDisabled = checkMethod ? !checkMethod({
        $cascader: $xeCascader,
        node: node
      }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
      if (isDisabled) {
        return;
      }
      var isChecked = false;
      if (selectCheckboxMaps[nodeid]) {
        delete selectCheckboxMaps[nodeid];
      } else {
        isChecked = true;
        selectCheckboxMaps[nodeid] = node;
      }
      if (!checkStrictly) {
        _xeUtils.default.eachTree(childList, function (childNode) {
          var childNodeid = $xeCascader.getNodeId(childNode);
          if (isChecked) {
            if (!selectCheckboxMaps[childNodeid]) {
              selectCheckboxMaps[childNodeid] = true;
            }
          } else {
            if (selectCheckboxMaps[childNodeid]) {
              delete selectCheckboxMaps[childNodeid];
            }
          }
        }, {
          children: transform ? mapChildrenField : childrenField
        });
      }
      reactData.updateCheckboxFlag++;
      $xeCascader.updateCheckboxStatus();
      var nodeids = _xeUtils.default.keys(selectCheckboxMaps);
      var value = nodeids;
      $xeCascader.changeEvent(evnt, value, node);
      if (!currentItems.includes(nodeid)) {
        $xeCascader.changeCurrentEvent(evnt, node);
        $xeCascader.toggleExpandEvent(evnt, node, chunks, chunkIndex);
      }
    },
    handleNodeClickEvent: function handleNodeClickEvent(evnt, node, chunks, chunkIndex) {
      var $xeCascader = this;
      var props = $xeCascader;
      var multiple = props.multiple,
        showCheckbox = props.showCheckbox,
        showRadio = props.showRadio;
      var treeOpts = $xeCascader.computeTreeOpts;
      var radioOpts = $xeCascader.computeRadioOpts;
      var checkboxOpts = $xeCascader.computeCheckboxOpts;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var transform = treeOpts.transform,
        trigger = treeOpts.trigger;
      var childList = node[transform ? mapChildrenField : childrenField];
      var triggerCurrent = false;
      var triggerRadio = false;
      var triggerCheckbox = false;
      var triggerExpand = false;
      triggerCurrent = true;
      $xeCascader.changeCurrentEvent(evnt, node);
      if (trigger !== 'icon') {
        triggerExpand = true;
        $xeCascader.toggleExpandEvent(evnt, node, chunks, chunkIndex);
      }
      if (multiple) {
        if (checkboxOpts.trigger === 'node' || !showCheckbox && (!childList || !childList.length)) {
          triggerCheckbox = true;
          $xeCascader.changeCheckboxEvent(evnt, node, chunks, chunkIndex);
        }
      } else {
        if (radioOpts.trigger === 'node' || !showRadio && (!childList || !childList.length)) {
          triggerRadio = true;
          $xeCascader.changeRadioEvent(evnt, node, chunks, chunkIndex);
        }
      }
      $xeCascader.dispatchEvent('node-click', {
        node: node,
        triggerCurrent: triggerCurrent,
        triggerRadio: triggerRadio,
        triggerCheckbox: triggerCheckbox,
        triggerExpand: triggerExpand
      }, evnt);
    },
    focusEvent: function focusEvent(evnt) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var isDisabled = $xeCascader.computeIsDisabled;
      if (!isDisabled) {
        if (!reactData.visiblePanel) {
          reactData.triggerFocusPanel = true;
          $xeCascader.showOptionPanel(evnt);
          setTimeout(function () {
            reactData.triggerFocusPanel = false;
          }, 150);
        }
      }
      $xeCascader.dispatchEvent('focus', {}, evnt);
    },
    clickEvent: function clickEvent(evnt) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      evnt.preventDefault();
      if (reactData.triggerFocusPanel) {
        reactData.triggerFocusPanel = false;
      } else {
        if (!reactData.visiblePanel) {
          $xeCascader.showOptionPanel(evnt);
        }
      }
      $xeCascader.dispatchEvent('click', {}, evnt);
    },
    blurEvent: function blurEvent(evnt) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      reactData.isActivated = false;
      $xeCascader.dispatchEvent('blur', {}, evnt);
    },
    modelSearchEvent: function modelSearchEvent(value) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      reactData.searchValue = value;
      $xeCascader.triggerSearchEvent(new Event('filter'));
    },
    handleSearchEvent: function handleSearchEvent() {
      var $xeCascader = this;
      var props = $xeCascader;
      var reactData = $xeCascader.reactData;
      var modelValue = props.value,
        remote = props.remote;
      var searchValue = reactData.searchValue;
      var remoteOpts = $xeCascader.computeRemoteOpts;
      var queryMethod = remoteOpts.queryMethod;
      if (remote && queryMethod && remoteOpts.enabled) {
        reactData.searchLoading = true;
        Promise.resolve(queryMethod({
          $cascader: $xeCascader,
          searchValue: searchValue,
          value: modelValue
        })).then(function () {
          return $xeCascader.$nextTick();
        }).catch(function () {
          return $xeCascader.$nextTick();
        }).finally(function () {
          reactData.searchLoading = false;
        });
      }
    },
    togglePanelEvent: function togglePanelEvent(params) {
      var $xeCascader = this;
      var reactData = $xeCascader.reactData;
      var $event = params.$event;
      $event.preventDefault();
      if (reactData.triggerFocusPanel) {
        reactData.triggerFocusPanel = false;
      } else {
        if (reactData.visiblePanel) {
          $xeCascader.hideOptionPanel($event);
        } else {
          $xeCascader.showOptionPanel($event);
        }
      }
    },
    /**
       * 用于树结构，给行数据加载子节点
       */
    loadChildrenNode: function loadChildrenNode(node, childRecords) {
      var $xeCascader = this;
      var props = $xeCascader;
      var internalData = $xeCascader.internalData;
      var separator = props.separator;
      var nodeMaps = internalData.nodeMaps;
      var treeOpts = $xeCascader.computeTreeOpts;
      var labelField = $xeCascader.computeLabelField;
      var lazy = treeOpts.lazy,
        transform = treeOpts.transform;
      if (!lazy) {
        return Promise.resolve([]);
      }
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var parentNodeItem = nodeMaps[$xeCascader.getNodeId(node)];
      var parentLevel = parentNodeItem ? parentNodeItem.level : 0;
      var parentNodes = parentNodeItem ? parentNodeItem.nodes : [];
      return $xeCascader.createNode(childRecords).then(function (nodeList) {
        _xeUtils.default.eachTree(nodeList, function (childRow, index, items, path, parent, nodes) {
          var itemNodeId = $xeCascader.getNodeId(childRow);
          nodeMaps[itemNodeId] = {
            item: childRow,
            index: -1,
            $index: -1,
            _index: -1,
            items: items,
            parent: parent || parentNodeItem.item,
            nodes: parentNodes.concat(nodes),
            level: parentLevel + nodes.length,
            treeIndex: -1,
            lineCount: 0,
            treeLoaded: false,
            fullLabel: nodes.map(function (item) {
              return item[labelField];
            }).join(separator || ' / ')
          };
        }, {
          children: childrenField
        });
        node[childrenField] = nodeList;
        if (transform) {
          node[mapChildrenField] = nodeList;
        }
        $xeCascader.updateAfterDataIndex();
        return nodeList;
      });
    },
    //
    // Render
    //
    renderRadio: function renderRadio(h, node, isExistChild, nLevel, isChecked, chunks, chunkIndex) {
      var $xeCascader = this;
      var props = $xeCascader;
      var showRadio = props.showRadio;
      var radioOpts = $xeCascader.computeRadioOpts;
      var checkMode = radioOpts.checkMode,
        checkMethod = radioOpts.checkMethod,
        visibleMode = radioOpts.visibleMode,
        visibleMethod = radioOpts.visibleMethod;
      var isVisible = visibleMethod ? visibleMethod({
        $cascader: $xeCascader,
        node: node
      }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
      if (showRadio && isVisible) {
        var isDisabled = checkMethod ? !checkMethod({
          $cascader: $xeCascader,
          node: node
        }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
        return h('div', {
          class: ['vxe-tree--radio-option', {
            'is--checked': isChecked,
            'is--disabled': isDisabled
          }],
          on: {
            click: function click(evnt) {
              if (!isDisabled) {
                $xeCascader.changeRadioEvent(evnt, node, chunks, chunkIndex);
              }
            }
          }
        }, [h('span', {
          class: ['vxe-radio--icon', isChecked ? (0, _ui.getIcon)().RADIO_CHECKED : (0, _ui.getIcon)().RADIO_UNCHECKED]
        })]);
      }
      return (0, _ui.renderEmptyElement)($xeCascader);
    },
    renderCheckbox: function renderCheckbox(h, node, isExistChild, nLevel, isChecked, isIndeterminate, chunks, chunkIndex) {
      var $xeCascader = this;
      var props = $xeCascader;
      var showCheckbox = props.showCheckbox;
      var checkboxOpts = $xeCascader.computeCheckboxOpts;
      var checkMode = checkboxOpts.checkMode,
        checkMethod = checkboxOpts.checkMethod,
        visibleMode = checkboxOpts.visibleMode,
        visibleMethod = checkboxOpts.visibleMethod;
      var isVisible = visibleMethod ? visibleMethod({
        $cascader: $xeCascader,
        node: node
      }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
      if (showCheckbox && isVisible) {
        var isDisabled = checkMethod ? !checkMethod({
          $cascader: $xeCascader,
          node: node
        }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
        return h('div', {
          class: ['vxe-cascader--checkbox-option', {
            'is--checked': isChecked,
            'is--indeterminate': isIndeterminate,
            'is--disabled': isDisabled
          }],
          on: {
            click: function click(evnt) {
              if (!isDisabled) {
                $xeCascader.changeCheckboxEvent(evnt, node, chunks, chunkIndex);
              }
            }
          }
        }, [h('span', {
          class: ['vxe-checkbox--icon', isIndeterminate ? (0, _ui.getIcon)().CHECKBOX_INDETERMINATE : isChecked ? (0, _ui.getIcon)().CHECKBOX_CHECKED : (0, _ui.getIcon)().CHECKBOX_UNCHECKED]
        })]);
      }
      return (0, _ui.renderEmptyElement)($xeCascader);
    },
    renderNode: function renderNode(h, node, nodeid, nodeIndex, chunks, chunkIndex) {
      var $xeCascader = this;
      var props = $xeCascader;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var slots = $xeCascader.$scopedSlots;
      var multiple = props.multiple;
      var currentNode = reactData.currentNode,
        selectRadioKey = reactData.selectRadioKey,
        updateCheckboxFlag = reactData.updateCheckboxFlag,
        updateExpandedFlag = reactData.updateExpandedFlag;
      var nodeMaps = internalData.nodeMaps,
        selectCheckboxMaps = internalData.selectCheckboxMaps,
        indeterminateRowMaps = internalData.indeterminateRowMaps,
        treeExpandedMaps = internalData.treeExpandedMaps,
        treeExpandLazyLoadedMaps = internalData.treeExpandLazyLoadedMaps;
      var treeOpts = $xeCascader.computeTreeOpts;
      var lazy = treeOpts.lazy,
        transform = treeOpts.transform,
        iconLoaded = treeOpts.iconLoaded,
        iconOpen = treeOpts.iconOpen,
        iconClose = treeOpts.iconClose;
      var childrenField = $xeCascader.computeChildrenField;
      var mapChildrenField = $xeCascader.computeMapChildrenField;
      var labelField = $xeCascader.computeLabelField;
      var hasChildField = $xeCascader.computeHasChildField;
      var childList = node[transform ? mapChildrenField : childrenField];
      var isExistChild = childList && childList.length > 0;
      var iconSlot = slots.icon;
      var titleSlot = slots.title;
      var isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
      var nodeItem = nodeMaps[nodeid] || {};
      var nodeTitle = node[labelField];
      var nLevel = nodeItem.level;
      var isRadioChecked = false;
      if (!multiple) {
        isRadioChecked = nodeid === selectRadioKey;
      }
      var isCheckboxChecked = false;
      var isIndeterminate = false;
      if (multiple) {
        isCheckboxChecked = !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
        isIndeterminate = !!(updateCheckboxFlag && indeterminateRowMaps[nodeid]);
      }
      var hasLazyChilds = false;
      var isLazyLoading = false;
      var isLazyLoaded = false;
      if (lazy) {
        isLazyLoading = !!treeExpandLazyLoadedMaps[nodeid];
        hasLazyChilds = node[hasChildField];
        isLazyLoaded = !!nodeItem.treeLoaded;
      }
      var nParams = {
        node: node
      };
      return h('div', {
        key: "".concat(chunkIndex, "_").concat(nodeIndex),
        class: ['vxe-cascader-chunk--node-item', {
          'is--current': currentNode && (currentNode === node || $xeCascader.getNodeId(currentNode) === nodeid),
          'is-radio--checked': isRadioChecked,
          'is-checkbox--checked': isCheckboxChecked,
          'is-checkbox--indeterminate': isIndeterminate,
          'is--expand': isExpand
        }],
        attrs: {
          title: nodeTitle
        },
        on: {
          mousedown: function mousedown(evnt) {
            var isLeftBtn = evnt.button === 0;
            if (isLeftBtn) {
              evnt.stopPropagation();
            }
          },
          click: function click(evnt) {
            $xeCascader.handleNodeClickEvent(evnt, node, chunks, chunkIndex);
          }
        }
      }, [multiple ? $xeCascader.renderCheckbox(h, node, isExistChild, nLevel, isCheckboxChecked, isIndeterminate, chunks, chunkIndex) : $xeCascader.renderRadio(h, node, isExistChild, nLevel, isRadioChecked, chunks, chunkIndex), h('div', {
        class: 'vxe-cascader-chunk--node-item-inner'
      }, [h('div', {
        class: 'vxe-cascader-chunk--node-item-title'
      }, titleSlot ? (0, _ui.getSlotVNs)(titleSlot(nParams)) : nodeTitle)]), treeOpts.showIcon && (lazy ? isLazyLoaded ? isExistChild : hasLazyChilds : isExistChild) ? h('div', {
        class: 'vxe-cascader-chunk--node-item-switcher'
      }, [[h('div', {
        class: 'vxe-cascader--node-item-icon',
        on: {
          click: function click(evnt) {
            if (treeOpts.trigger === 'icon') {
              $xeCascader.toggleExpandEvent(evnt, node, chunks, chunkIndex);
            }
          }
        }
      }, iconSlot ? (0, _ui.getSlotVNs)(iconSlot(nParams)) : [h('i', {
        class: isLazyLoading ? iconLoaded || (0, _ui.getIcon)().CASCADER_NODE_LOADED : isExpand ? iconOpen || (0, _ui.getIcon)().CASCADER_NODE_OPEN : iconClose || (0, _ui.getIcon)().CASCADER_NODE_CLOSE
      })])]]) : (0, _ui.renderEmptyElement)($xeCascader)]);
    },
    renderVN: function renderVN(h) {
      var $xeCascader = this;
      var props = $xeCascader;
      var reactData = $xeCascader.reactData;
      var internalData = $xeCascader.internalData;
      var slots = $xeCascader.$scopedSlots;
      var className = props.className,
        modelValue = props.value,
        multiple = props.multiple,
        loading = props.loading,
        filterable = props.filterable,
        showTotalButton = props.showTotalButton,
        showCheckedButton = props.showCheckedButton,
        showClearButton = props.showClearButton,
        showCloseButton = props.showCloseButton;
      var initialized = reactData.initialized,
        isActivated = reactData.isActivated,
        isAniVisible = reactData.isAniVisible,
        visiblePanel = reactData.visiblePanel,
        searchValue = reactData.searchValue,
        currentCunkList = reactData.currentCunkList;
      var listVirtualYOpts = internalData.listVirtualYOpts;
      var vSize = $xeCascader.computeSize;
      var isDisabled = $xeCascader.computeIsDisabled;
      var selectLabel = $xeCascader.computeSelectLabel;
      var btnTransfer = $xeCascader.computeBtnTransfer;
      var formReadonly = $xeCascader.computeFormReadonly;
      var popupWrapperStyle = $xeCascader.computePopupWrapperStyle;
      var headerSlot = slots.header;
      var footerSlot = slots.footer;
      var prefixSlot = slots.prefix;
      var popupOpts = $xeCascader.computePopupOpts;
      var popupClassName = popupOpts.className;
      if (formReadonly) {
        return h('div', {
          ref: 'refElem',
          class: ['vxe-cascader--readonly', className]
        }, [h('span', {
          class: 'vxe-cascader-label'
        }, selectLabel)]);
      }
      var selectVals = _xeUtils.default.eqNull(modelValue) ? [] : _xeUtils.default.isArray(modelValue) ? modelValue : [modelValue];
      return h('div', {
        ref: 'refElem',
        class: ['vxe-cascader', className ? _xeUtils.default.isFunction(className) ? className({
          $cascader: $xeCascader
        }) : className : '', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "size--".concat(vSize), vSize), 'is--filterable', filterable), 'is--visible', visiblePanel), 'is--disabled', isDisabled), 'is--loading', loading), 'is--active', isActivated)]
      }, [h(_input.default, {
        ref: 'refInput',
        props: {
          clearable: props.clearable,
          placeholder: loading ? (0, _ui.getI18n)('vxe.select.loadingText') : props.placeholder,
          editable: false,
          disabled: isDisabled,
          type: 'text',
          prefixIcon: props.prefixIcon,
          suffixIcon: loading ? (0, _ui.getIcon)().TREE_SELECT_LOADED : visiblePanel ? (0, _ui.getIcon)().TREE_SELECT_OPEN : (0, _ui.getIcon)().TREE_SELECT_CLOSE,
          value: loading ? '' : selectLabel,
          title: selectLabel
        },
        on: {
          clear: $xeCascader.clearEvent,
          click: $xeCascader.clickEvent,
          focus: $xeCascader.focusEvent,
          blur: $xeCascader.blurEvent,
          'suffix-click': $xeCascader.togglePanelEvent
        },
        scopedSlots: prefixSlot ? {
          prefix: function prefix() {
            return prefixSlot({});
          }
        } : undefined
      }), h('div', {
        ref: 'refOptionPanel',
        class: ['vxe-table--ignore-clear vxe-cascader--panel', popupClassName ? _xeUtils.default.isFunction(popupClassName) ? popupClassName({
          $cascader: $xeCascader
        }) : popupClassName : '', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "size--".concat(vSize), vSize), 'is--transfer', btnTransfer), 'ani--leave', !loading && isAniVisible), 'ani--enter', !loading && visiblePanel)],
        attrs: {
          placement: reactData.panelPlacement
        },
        style: popupWrapperStyle
      }, initialized ? [h('div', {
        class: 'vxe-cascader--panel-wrapper'
      }, [filterable ? h('div', {
        class: 'vxe-cascader--panel-search'
      }, [h(_input.default, {
        ref: 'refInpSearch',
        class: 'vxe-cascader-search--input',
        props: {
          value: searchValue,
          clearable: true,
          disabled: false,
          readonly: false,
          placeholder: (0, _ui.getI18n)('vxe.cascader.search'),
          prefixIcon: (0, _ui.getIcon)().INPUT_SEARCH
        },
        on: {
          'model-value': $xeCascader.modelSearchEvent
        }
      })]) : (0, _ui.renderEmptyElement)($xeCascader), showCheckedButton && multiple || showClearButton || headerSlot ? h('div', {
        class: 'vxe-cascader--panel-header'
      }, headerSlot ? headerSlot({}) : [h('div', {
        class: 'vxe-cascader--header-button'
      }, [showCheckedButton && multiple || showClearButton ? h('div', {
        class: 'vxe-cascader--selected-btns'
      }, [showCheckedButton && multiple ? h(_button.default, {
        props: {
          content: (0, _ui.getI18n)('vxe.treeSelect.allChecked'),
          mode: 'text'
        },
        on: {
          click: $xeCascader.allCheckedPanelEvent
        }
      }) : (0, _ui.renderEmptyElement)($xeCascader), showClearButton ? h(_button.default, {
        props: {
          content: (0, _ui.getI18n)('vxe.treeSelect.clearChecked'),
          mode: 'text'
        },
        on: {
          click: $xeCascader.clearCheckedPanelEvent
        }
      }) : (0, _ui.renderEmptyElement)($xeCascader)]) : (0, _ui.renderEmptyElement)($xeCascader)])]) : (0, _ui.renderEmptyElement)($xeCascader), h('div', {
        class: 'vxe-cascader--panel-body'
      }, [h('div', {
        ref: 'refChunkWrapper',
        class: 'vxe-cascader-chunk--wrapper'
      }, [currentCunkList.map(function (chunks, chunkIndex) {
        return h('div', {
          key: chunkIndex,
          class: 'vxe-cascader-chunk--item-wrapper'
        }, [h(_list.default, {
          props: {
            data: chunks,
            virtualYConfig: listVirtualYOpts
          },
          scopedSlots: {
            default: function _default(slotParams) {
              var items = slotParams.items;
              return items.map(function (node, nodeIndex) {
                var nodeid = $xeCascader.getNodeId(node);
                return $xeCascader.renderNode(h, node, nodeid, nodeIndex, chunks, chunkIndex);
              });
            }
          }
        })]);
      })])]), footerSlot || showTotalButton || showCloseButton ? h('div', {
        class: 'vxe-cascader--panel-footer'
      }, footerSlot ? footerSlot({}) : [h('div', {
        class: 'vxe-cascader--footer-button'
      }, [showTotalButton ? h('div', {
        class: 'vxe-cascader--total-btns'
      }, (0, _ui.getI18n)('vxe.treeSelect.total', [selectVals.length])) : (0, _ui.renderEmptyElement)($xeCascader), showCloseButton ? h('div', {
        class: 'vxe-cascader--oper-btns'
      }, [h(_button.default, {
        props: {
          content: (0, _ui.getI18n)('vxe.select.close'),
          mode: 'text'
        },
        on: {
          click: $xeCascader.closePanelEvent
        }
      })]) : (0, _ui.renderEmptyElement)($xeCascader)])]) : (0, _ui.renderEmptyElement)($xeCascader)])] : [])]);
    }
  },
  watch: {
    value: function value() {
      var $xeCascader = this;
      var internalData = $xeCascader.internalData;
      if (!internalData.isUpdateMode) {
        $xeCascader.updateModelChecked();
        $xeCascader.handleCurrentItems();
        $xeCascader.updateCurrentChunk();
      }
      internalData.isUpdateMode = false;
    },
    options: function options() {
      var $xeCascader = this;
      var props = $xeCascader;
      $xeCascader.loadData(props.options || []);
    }
  },
  created: function created() {
    var $xeCascader = this;
    var props = $xeCascader;
    var reactData = $xeCascader.reactData;
    $xeCascader.internalData = createInternalData();
    if (!props.multiple) {
      reactData.selectRadioKey = (0, _util.enNodeValue)(props.value);
    }
    $xeCascader.loadData(props.options || []);
  },
  mounted: function mounted() {
    var $xeCascader = this;
    _ui.globalEvents.on($xeCascader, 'mousewheel', $xeCascader.handleGlobalMousewheelEvent);
    _ui.globalEvents.on($xeCascader, 'mousedown', $xeCascader.handleGlobalMousedownEvent);
    _ui.globalEvents.on($xeCascader, 'blur', $xeCascader.handleGlobalBlurEvent);
    _ui.globalEvents.on($xeCascader, 'resize', $xeCascader.handleGlobalResizeEvent);
  },
  beforeDestroy: function beforeDestroy() {
    var $xeCascader = this;
    var reactData = $xeCascader.reactData;
    var internalData = $xeCascader.internalData;
    var panelElem = $xeCascader.$refs.refOptionPanel;
    if (panelElem && panelElem.parentNode) {
      panelElem.parentNode.removeChild(panelElem);
    }
    _ui.globalEvents.off($xeCascader, 'mousewheel');
    _ui.globalEvents.off($xeCascader, 'mousedown');
    _ui.globalEvents.off($xeCascader, 'blur');
    _ui.globalEvents.off($xeCascader, 'resize');
    _xeUtils.default.assign(reactData, createReactData());
    _xeUtils.default.assign(internalData, createInternalData());
  },
  render: function render(h) {
    return this.renderVN(h);
  }
});
/* define-vxe-component end */