/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	// The require scope
/******/ 	var __webpack_require__ = {};
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "default": function() { return /* binding */ cascader_plugin; }
});

;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/cascader-plugin/src/main.vue?vue&type=template&id=0ac64c23&
var render = function render() {
  var _vm = this,
    _c = _vm._self._c;
  return _c("div", {
    staticClass: "jdf-cascader-plugin"
  }, [_c("el-cascader", _vm._g(_vm._b({
    key: _vm.key,
    ref: "cascader",
    class: _vm.$vnode.data.staticClass,
    style: _vm.$vnode.data.staticStyle,
    attrs: {
      options: _vm.innerOptions,
      size: _vm.size,
      props: _vm.innerProps,
      separator: _vm.separator,
      placeholder: _vm.placeholder
    },
    on: {
      "remove-tag": _vm.removeTag,
      "expand-change": _vm.expandChange,
      change: _vm.handleChange,
      "visible-change": _vm.visibleChange
    },
    scopedSlots: _vm._u([{
      key: "default",
      fn: function fn(allprops) {
        return [_c("div", {
          staticClass: "label",
          on: {
            click: function click($event) {
              return _vm.clickLabel(allprops);
            }
          }
        }, [_vm.$scopedSlots.default ? _c("div", [_vm._t("default", null, null, allprops)], 2) : _c("div", [_vm._v("\n          " + _vm._s(allprops.data[_vm.innerProps.label]) + "\n        ")])])];
      }
    }, {
      key: "empty",
      fn: function fn() {
        return [[_vm.$slots.empty ? _c("div", [_vm._t("empty")], 2) : _c("div", [_c("li", {
          staticClass: "el-cascader__empty-text"
        }, [_vm._v("无匹配数据")])])]];
      },
      proxy: true
    }], null, true),
    model: {
      value: _vm.innerValue,
      callback: function callback($$v) {
        _vm.innerValue = $$v;
      },
      expression: "innerValue"
    }
  }, "el-cascader", _vm.$attrs, false), _vm.$listeners))], 1);
};
var staticRenderFns = [];
render._withStripped = true;

;// CONCATENATED MODULE: ./packages/cascader-plugin/src/main.vue?vue&type=template&id=0ac64c23&

;// CONCATENATED MODULE: external "@babel/runtime/helpers/toConsumableArray"
var toConsumableArray_namespaceObject = require("@babel/runtime/helpers/toConsumableArray");
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/helpers/defineProperty"
var defineProperty_namespaceObject = require("@babel/runtime/helpers/defineProperty");
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/helpers/asyncToGenerator"
var asyncToGenerator_namespaceObject = require("@babel/runtime/helpers/asyncToGenerator");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/regenerator"
var regenerator_namespaceObject = require("@babel/runtime/regenerator");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/helpers/typeof"
var typeof_namespaceObject = require("@babel/runtime/helpers/typeof");
var typeof_default = /*#__PURE__*/__webpack_require__.n(typeof_namespaceObject);
;// CONCATENATED MODULE: ./packages/cascader-plugin/src/utils.js





function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
// 递归为选项列表
var changeToSelectOpt = function changeToSelectOpt(data, childrenProp) {
  // 选项分离为有children和无children
  var hasChild = false;
  var filterHasChildTreeList = [];
  var filterNoChildTreeList = [];
  filterNoChildTreeList = data.filter(function (select) {
    if (select && !select[childrenProp || 'children'] || select && select[childrenProp || 'children'] && !select[childrenProp || 'children'].length) {
      return true;
    }
    hasChild = true;
    return false;
  });
  filterHasChildTreeList = data.filter(function (select) {
    if (select && !select[childrenProp || 'children'] || select && select[childrenProp || 'children'] && !select[childrenProp || 'children'].length) {
      return false;
    }
    hasChild = true;
    return true;
  });
  if (hasChild) {
    var _ref;
    var tempTreeList = filterHasChildTreeList.map(function (select) {
      var obj = _objectSpread({}, select);
      delete obj[childrenProp || 'children'];
      // 父子处理为同一级
      return [obj].concat(changeToSelectOpt(select[childrenProp || 'children']));
    });
    // 格式化处理
    var resultTreeList = (_ref = []).concat.apply(_ref, toConsumableArray_default()(tempTreeList));
    // 过滤好的无children时的select与处理完的父子集select拼接返回
    return resultTreeList.concat(filterNoChildTreeList);
  }
  // 无children时返回过滤好的的无children选项
  return filterNoChildTreeList;
};

// 获取选项列表
var getTreeListAndFormat = /*#__PURE__*/function () {
  var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee(treeList, childrenProp) {
    var selectList, data;
    return regenerator_default().wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          selectList = [];
          data = [];
          if (treeList && Object.keys(treeList).length) {
            data = treeList || [];
          }
          if (data && data.length) {
            selectList = changeToSelectOpt(data, childrenProp);
          }
          return _context.abrupt("return", selectList);
        case 5:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return function getTreeListAndFormat(_x, _x2) {
    return _ref2.apply(this, arguments);
  };
}();

// 数组转树
var arrListToTree = function arrListToTree(data, _ref3) {
  var parentprop = _ref3.parentprop,
    valueProp = _ref3.valueProp,
    childrenProp = _ref3.childrenProp;
  var result = [];
  var map = {};
  data.forEach(function (item) {
    map[item[valueProp || 'value']] = item;
  });
  data.forEach(function (item) {
    var parent = map[item[parentprop] || 'parentId'];
    if (parent) {
      (parent[childrenProp] || (parent[childrenProp || 'children'] = [])).push(item);
    } else {
      result.push(item);
    }
  });
  return result;
};

// 深度合并
var deepMerge = function deepMerge(a, b) {
  var k;
  for (k in b) {
    a[k] = a[k] && a[k].toString() === '[object Object]' ? deepMerge(a[k], b[k]) : a[k] = b[k];
  }
  return a;
};

// eslint-disable-next-line no-use-before-define
var isPromise = function isPromise(val) {
  return isObject(val) && isFunction(val.then) && isFunction(val.catch);
};
var isObject = function isObject(val) {
  return typeof_default()(val) === 'object';
};
var isFunction = function isFunction(val) {
  return typeof val === 'function';
};
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/cascader-plugin/src/main.vue?vue&type=script&lang=js&



function mainvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function mainvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? mainvue_type_script_lang_js_ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : mainvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }

/* harmony default export */ var mainvue_type_script_lang_js_ = ({
  name: 'JdfCascaderPlugin',
  computed: {
    isMultiple: function isMultiple() {
      return this.innerProps.multiple === true;
    }
  },
  props: {
    maxLevel: {
      type: Number,
      default: function _default() {
        return 1000;
      }
    },
    value: {
      type: [Array, String],
      default: function _default() {
        return [];
      }
    },
    // 分隔符号
    separator: {
      type: String,
      default: function _default() {
        return ' / ';
      }
    },
    placeholder: {
      type: String,
      default: function _default() {
        return '请选择';
      }
    },
    options: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    size: {
      type: String,
      default: 'small'
    },
    props: {
      type: Object,
      default: function _default() {
        return {};
      }
    }
  },
  watch: {
    value: {
      handler: function handler(val, oldVal) {
        var _this = this;
        return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee() {
          var selectList, same, _iterator, _step, item, valCompare, _valCompare;
          return regenerator_default().wrap(function _callee$(_context) {
            while (1) switch (_context.prev = _context.next) {
              case 0:
                if (!(!_this.isPopOpen && _this.props.lazy === true)) {
                  _context.next = 69;
                  break;
                }
                if (!(Array.isArray(val) === true && val.length)) {
                  _context.next = 65;
                  break;
                }
                if (!(_this.innerValue.length !== val.length)) {
                  _context.next = 7;
                  break;
                }
                _this.levelChildNodes = [];
                _this.isEmitRequestZero = false;
                _context.next = 20;
                break;
              case 7:
                if (!_this.innerOptions.length) {
                  _context.next = 19;
                  break;
                }
                _context.next = 10;
                return getTreeListAndFormat(JSON.parse(JSON.stringify(_this.innerOptions)), _this.innerProps.children);
              case 10:
                selectList = _context.sent;
                selectList = selectList.map(function (opt) {
                  return opt[_this.innerProps.value];
                });
                _this.selectList = selectList;
                same = []; // eslint-disable-next-line no-restricted-syntax
                _iterator = _createForOfIteratorHelper(val);
                try {
                  for (_iterator.s(); !(_step = _iterator.n()).done;) {
                    item = _step.value;
                    if (selectList.includes(item)) {
                      same.push(true);
                    } else {
                      same.push(false);
                    }
                  }
                  // 如果innerOptions中没有对应选项,回显不正确，则手动触发getnode，
                } catch (err) {
                  _iterator.e(err);
                } finally {
                  _iterator.f();
                }
                if (!same.every(function (v) {
                  return v === true;
                })) {
                  _this.levelChildNodes = [];
                  _this.isEmitRequestZero = false;
                }
                _context.next = 20;
                break;
              case 19:
                // 其他情况对比val判断
                if (_this.innerValue.length) {
                  if (val.join('') !== _this.innerValue.join('')) {
                    _this.levelChildNodes = [];
                    _this.isEmitRequestZero = false;
                  }
                } else {
                  _this.levelChildNodes = [];
                  _this.isEmitRequestZero = false;
                }
              case 20:
                if (_this.isEmitRequestZero) {
                  _context.next = 47;
                  break;
                }
                if (_this.levelChildNodes.length) {
                  _context.next = 45;
                  break;
                }
                if (!_this.isMultiple) {
                  _context.next = 26;
                  break;
                }
                // 多选回显处理
                _this.handleMultOpts();
                _context.next = 45;
                break;
              case 26:
                if (!_this.innerValue.length) {
                  _context.next = 40;
                  break;
                }
                if (!(val && val.length)) {
                  _context.next = 37;
                  break;
                }
                valCompare = val.slice(0, -1); // 数据没被选过才重新获取options
                if (_this.allSingleCheckedArr.join().includes(valCompare.join())) {
                  _context.next = 34;
                  break;
                }
                _context.next = 32;
                return _this.handleOpts();
              case 32:
                _context.next = 35;
                break;
              case 34:
                _this.innerValue = JSON.parse(JSON.stringify(val));
              case 35:
                _context.next = 38;
                break;
              case 37:
                // 删除数据为空的时候处理
                _this.innerValue = [];
              case 38:
                _context.next = 45;
                break;
              case 40:
                _this.innerValue = JSON.parse(JSON.stringify(val));
                _this.autoFeedback();
                // 改变isEmitRequestZero触发第一次0级请求
                _this.isEmitRequestZero = true;
                _context.next = 45;
                return _this.handleOpts();
              case 45:
                _context.next = 63;
                break;
              case 47:
                if (!_this.isMultiple) {
                  _context.next = 52;
                  break;
                }
                _context.next = 50;
                return _this.handleMultOpts();
              case 50:
                _context.next = 63;
                break;
              case 52:
                if (!(val && val.length)) {
                  _context.next = 62;
                  break;
                }
                _valCompare = val.slice(0, -1); // 数据没被选过才重新获取options
                if (_this.allSingleCheckedArr.join().includes(_valCompare.join())) {
                  _context.next = 59;
                  break;
                }
                _context.next = 57;
                return _this.handleOpts();
              case 57:
                _context.next = 60;
                break;
              case 59:
                _this.innerValue = JSON.parse(JSON.stringify(val));
              case 60:
                _context.next = 63;
                break;
              case 62:
                // 删除数据为空的时候处理
                _this.innerValue = [];
              case 63:
                _context.next = 67;
                break;
              case 65:
                // 触发重新渲染
                _this.innerValue = JSON.parse(JSON.stringify(val));
                if (!_this.isMultiple) {
                  _this.autoFeedback();
                }
              case 67:
                _context.next = 70;
                break;
              case 69:
                // 非懒加载直接赋值
                if (_this.innerValue.join() !== val.join()) {
                  _this.innerValue = JSON.parse(JSON.stringify(val));
                }
              case 70:
              case "end":
                return _context.stop();
            }
          }, _callee);
        }))();
      },
      deep: true
    }
  },
  data: function data() {
    return {
      key: 0,
      // 所有被选中过的单选值
      allSingleCheckedArr: [],
      // 所有被选中的多选值
      allCheckedArr: [],
      isPopOpen: false,
      isFromOut: true,
      isRemoveTag: false,
      // 自动回显功能开关
      autoFeedBackSwitch: !this.props.multiple,
      // 回显数组
      inputArr: [],
      // 是否请求0级数据（请求动作）
      isEmitRequestZero: false,
      innerValue: [],
      // 每级对应的当前选项(children)集合
      levelChildNodes: [],
      // 级联懒加载
      innerProps: mainvue_type_script_lang_js_objectSpread(mainvue_type_script_lang_js_objectSpread({
        value: 'value',
        label: 'label',
        children: 'children',
        leaf: 'leaf'
      }, this.props), {}, {
        lazyLoad: this.getNode
      }),
      innerOptions: this.options
    };
  },
  created: function created() {
    this.init();
  },
  mounted: function mounted() {},
  destroyed: function destroyed() {
    this.init();
  },
  methods: {
    // 找到某个树节点进行插入数据操作
    findTreeNode: function findTreeNode(value, nodes) {
      for (var i = 0; i < this.innerOptions.length; i++) {
        this.findAndInsert(this.innerOptions[i], value, false, nodes);
      }
    },
    // 找到某个树节点，如果节点没有children则添加children数据，有children则返回
    findAndInsert: function findAndInsert(item, cid) {
      var flag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      var nodes = arguments.length > 3 ? arguments[3] : undefined;
      if (item[this.innerProps.value] === cid) {
        flag = true;
      } else {
        flag = false;
      }
      // 找到的节点如果已经有子集则返回
      if (flag && item[this.innerProps.children] && item[this.innerProps.children].length) {}
      // 找到的节点如果没有子集则插入子集数据
      else if (flag && (!item[this.innerProps.children] || !item[this.innerProps.children].length)) {
        this.$set(item, this.innerProps.children, nodes);
      }
      // 如果没找到节点则继续查找其他有children的节点
      else if (!flag && item[this.innerProps.children] && item[this.innerProps.children].length) {
        for (var i = 0; i < item[this.innerProps.children].length; i++) {
          this.findAndInsert(item[this.innerProps.children][i], cid, false, nodes);
        }
      }
      // 如果没找到节点且节点无children则返回
      else {}
    },
    // 删除标签
    removeTag: function removeTag(e) {
      this.isRemoveTag = true;
      if (this.props.lazy === true) {
        this.innerProps.lazy = true;
      }
      this.isRemoveTag = false;
      this.$emit('remove-tag', e);
    },
    // 点击标签
    clickLabel: function clickLabel(node) {
      if (this.props.lazy === true) {
        // 有子集则不改变lazy状态
        if (!node.data[this.innerProps.children] || !node.data[this.innerProps.children].length) {
          this.innerProps.lazy = true;
        } else {
          this.innerProps.lazy = false;
        }
      }
    },
    // 单选回显功能
    handleOpts: function handleOpts() {
      var _this2 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee2() {
        var value, valArr;
        return regenerator_default().wrap(function _callee2$(_context2) {
          while (1) switch (_context2.prev = _context2.next) {
            case 0:
              value = JSON.parse(JSON.stringify(_this2.value));
              value.pop();
              // 因为获取数据不需要最后一个值，所以去除最后一位
              valArr = []; // 处理值
              valArr = value.map(function (v, index) {
                return defineProperty_default()({
                  level: index + 1
                }, _this2.innerProps.value, v);
              });
              // 去重
              valArr = valArr.filter(function (v, index) {
                return index === valArr.findIndex(function (e) {
                  return e[_this2.innerProps.value] === v[_this2.innerProps.value];
                });
              });
              _this2.dealOpts(valArr);
            case 6:
            case "end":
              return _context2.stop();
          }
        }, _callee2);
      }))();
    },
    // 多选回显功能
    handleMultOpts: function handleMultOpts() {
      var _this3 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3() {
        var value, valArr;
        return regenerator_default().wrap(function _callee3$(_context3) {
          while (1) switch (_context3.prev = _context3.next) {
            case 0:
              value = JSON.parse(JSON.stringify(_this3.value));
              valArr = []; // 处理值
              value.forEach(function (v) {
                // 因为获取数据不需要最后一个值，所以去除最后一位
                v.pop();
                valArr = valArr.concat(v.map(function (item, index) {
                  return defineProperty_default()({
                    level: index + 1
                  }, _this3.innerProps.value, item);
                }));
              });
              // 去重
              valArr = valArr.filter(function (v, index) {
                return index === valArr.findIndex(function (e) {
                  return e[_this3.innerProps.value] === v[_this3.innerProps.value];
                });
              });
              _this3.dealOpts(valArr);
            case 5:
            case "end":
              return _context3.stop();
          }
        }, _callee3);
      }))();
    },
    // 获取各层级opt
    dealOpts: function dealOpts(valArr) {
      var _this4 = this;
      // 先写获取第0级数据的promise
      var optsListPromise = [new Promise( /*#__PURE__*/function () {
        var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee5(resolve, reject) {
          return regenerator_default().wrap(function _callee5$(_context5) {
            while (1) switch (_context5.prev = _context5.next) {
              case 0:
                _this4.props.lazyLoad({
                  value: 0,
                  level: 0
                }, /*#__PURE__*/function () {
                  var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee4(result) {
                    var nodes;
                    return regenerator_default().wrap(function _callee4$(_context4) {
                      while (1) switch (_context4.prev = _context4.next) {
                        case 0:
                          _context4.next = 2;
                          return _this4.getResult(result);
                        case 2:
                          result = _context4.sent;
                          nodes = result.map(function (v) {
                            var _objectSpread2;
                            return mainvue_type_script_lang_js_objectSpread(mainvue_type_script_lang_js_objectSpread({}, v), {}, (_objectSpread2 = {}, defineProperty_default()(_objectSpread2, _this4.innerProps.value, v[_this4.innerProps.value]), defineProperty_default()(_objectSpread2, _this4.innerProps.label, v[_this4.innerProps.label]), defineProperty_default()(_objectSpread2, _this4.innerProps.leaf, Object.prototype.hasOwnProperty.call(v, _this4.innerProps.leaf) ? v[_this4.innerProps.leaf] || _this4.maxLevel <= 0 : _this4.maxLevel <= 0), _objectSpread2));
                          });
                          if (!_this4.innerOptions.length && !_this4.isMultiple) {
                            _this4.innerOptions = nodes;
                            // 每赋值一级options便回显一级
                            _this4.getLabel(_this4.innerOptions, 0);
                            _this4.autoFeedback();
                          }
                          resolve(nodes);
                        case 6:
                        case "end":
                          return _context4.stop();
                      }
                    }, _callee4);
                  }));
                  return function (_x3) {
                    return _ref4.apply(this, arguments);
                  };
                }());
              case 1:
              case "end":
                return _context5.stop();
            }
          }, _callee5);
        }));
        return function (_x, _x2) {
          return _ref3.apply(this, arguments);
        };
      }())];
      // 其他层级获取
      valArr.forEach(function (e) {
        var promise = new Promise( /*#__PURE__*/function () {
          var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee7(resolve, reject) {
            return regenerator_default().wrap(function _callee7$(_context7) {
              while (1) switch (_context7.prev = _context7.next) {
                case 0:
                  _this4.props.lazyLoad({
                    value: e[_this4.innerProps.value],
                    level: e.level
                  }, /*#__PURE__*/function () {
                    var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee6(result) {
                      var nodes;
                      return regenerator_default().wrap(function _callee6$(_context6) {
                        while (1) switch (_context6.prev = _context6.next) {
                          case 0:
                            _context6.next = 2;
                            return _this4.getResult(result);
                          case 2:
                            result = _context6.sent;
                            nodes = result.map(function (v) {
                              var _objectSpread3;
                              return mainvue_type_script_lang_js_objectSpread(mainvue_type_script_lang_js_objectSpread({}, v), {}, (_objectSpread3 = {}, defineProperty_default()(_objectSpread3, _this4.innerProps.value, v[_this4.innerProps.value]), defineProperty_default()(_objectSpread3, _this4.innerProps.label, v[_this4.innerProps.label]), defineProperty_default()(_objectSpread3, _this4.innerProps.leaf, Object.prototype.hasOwnProperty.call(v, _this4.innerProps.leaf) ? v[_this4.innerProps.leaf] || e.level >= _this4.maxLevel : e.level >= _this4.maxLevel), defineProperty_default()(_objectSpread3, "parentValue", e[_this4.innerProps.value]), _objectSpread3));
                            });
                            if (!_this4.isMultiple) {
                              // 每获取一级nodes回显一级
                              _this4.getLabel(nodes, e.level);
                              _this4.autoFeedback();
                            }
                            resolve(nodes);
                          case 6:
                          case "end":
                            return _context6.stop();
                        }
                      }, _callee6);
                    }));
                    return function (_x6) {
                      return _ref6.apply(this, arguments);
                    };
                  }());
                case 1:
                case "end":
                  return _context7.stop();
              }
            }, _callee7);
          }));
          return function (_x4, _x5) {
            return _ref5.apply(this, arguments);
          };
        }());
        optsListPromise.push(promise);
      });
      Promise.all(optsListPromise).then( /*#__PURE__*/function () {
        var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee8(res) {
          var optsList, treeOptsOrign, optTree;
          return regenerator_default().wrap(function _callee8$(_context8) {
            while (1) switch (_context8.prev = _context8.next) {
              case 0:
                optsList = [];
                res.forEach(function (v, index) {
                  optsList.push.apply(optsList, toConsumableArray_default()(v));
                  if (!_this4.isMultiple) {
                    // 单选把子集nodes直接插入到options中
                    if (index !== 0) {
                      _this4.findTreeNode(_this4.value[index - 1], v);
                    }
                  }
                });
                treeOptsOrign = JSON.parse(JSON.stringify(_this4.innerOptions)); // 数组转树
                optTree = arrListToTree(JSON.parse(JSON.stringify(optsList)), {
                  parentprop: 'parentValue',
                  valueProp: _this4.innerProps.value,
                  childrenProp: _this4.innerProps.children
                }); // 深度合并
                optTree = Object.keys(optTree).length ? JSON.parse(JSON.stringify(deepMerge(treeOptsOrign, optTree))) : treeOptsOrign;
                if (Object.keys(optTree).length) {
                  // 有值的时候再对opt赋值 不赋空值
                  // 多选的时候改变options，单选采用直接插入到options中
                  if (_this4.isMultiple) {
                    _this4.innerOptions = optTree;
                    _this4.key++;
                  }
                  _this4.$nextTick(function () {
                    // 最后在赋值选中项
                    _this4.innerValue = [];
                    _this4.innerValue = JSON.parse(JSON.stringify(_this4.value));
                  });
                }
              case 6:
              case "end":
                return _context8.stop();
            }
          }, _callee8);
        }));
        return function (_x7) {
          return _ref7.apply(this, arguments);
        };
      }());
    },
    // 弹窗显示隐藏，显示的时候关闭自动回显功能，避免选项看起来混乱
    visibleChange: function visibleChange(val) {
      var _this5 = this;
      this.isFromOut = !val;
      if (this.props.lazy === true) {
        this.innerProps.lazy = true;
      }
      this.isPopOpen = val;
      this.isRemoveTag = false;
      if (val) {
        if (this.isMultiple) {
          var checkedValueArr = JSON.parse(JSON.stringify(this.$refs.cascader.checkedValue));
          var valArr = [];
          // 处理值
          checkedValueArr.forEach(function (v) {
            valArr = valArr.concat(v);
          });
          // 去重
          this.allCheckedArr = toConsumableArray_default()(new Set([].concat(toConsumableArray_default()(this.allCheckedArr), toConsumableArray_default()(valArr))));
          this.$nextTick(function () {
            if (checkedValueArr.length) {
              _this5.innerProps.lazy = false;
            } else {
              // 修复一开始点击不获取数据
              if (_this5.props.lazy === true) {
                _this5.innerProps.lazy = true;
              }
            }
          });
        }
      } else if (this.props.lazy === true) {
        this.innerProps.lazy = true;
      }
      if (this.isMultiple) {
        // 因为自动回显功能是针对单选写的，所以多选的时候关闭
        this.autoFeedBackSwitch = false;
        // 多选点击的时候去掉外部响应变化
        this.isFromOut = !val;
      } else {
        this.autoFeedBackSwitch = !val;
      }
      this.$emit('visible-change', val);
    },
    // 初始化
    init: function init() {
      var _this6 = this;
      this.levelChildNodes = [];
      this.innerOptions = this.options;
      this.isEmitRequestZero = false;
      // 一开始就已经存在value值的处理，此时watch无响应，更改value值手动触发watch
      if (this.value.length && this.props.lazy === true) {
        // 外部删除value，重新触发watch
        var value = this.value;
        this.$emit('input', []);
        setTimeout(function () {
          _this6.$emit('input', value);
        }, 50);
      } else {
        // 非懒加载直接赋值
        this.innerValue = this.value;
      }
    },
    // 点击加载下级菜单的时候
    expandChange: function expandChange(val) {
      var _this7 = this;
      this.$nextTick(function () {
        if (_this7.props.lazy === true) {
          _this7.innerProps.lazy = true;
        }
      });
      this.$emit('expand-change', val);
    },
    handleChange: function handleChange(value) {
      var _this8 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee9() {
        var arr;
        return regenerator_default().wrap(function _callee9$(_context9) {
          while (1) switch (_context9.prev = _context9.next) {
            case 0:
              // 只在数值类型正确的时候执行
              if (Array.isArray(_this8.innerValue) === true) {
                _this8.$nextTick(function () {
                  if (!_this8.isFromOut) {
                    _this8.$emit('input', value);
                    _this8.$emit('change', value);
                  }
                });
                if (_this8.props.lazy === true) {
                  _this8.innerProps.lazy = true;
                  // 补充单选label,选中值收集
                  if (!_this8.isMultiple) {
                    _this8.allSingleCheckedArr = toConsumableArray_default()(new Set([].concat(toConsumableArray_default()(_this8.allSingleCheckedArr), toConsumableArray_default()(value))));
                    // this.innerProps.lazy = false;
                    value.forEach(function (v, index) {
                      _this8.levelChildNodes.forEach(function (e) {
                        e.forEach(function (item) {
                          if (item.value === v) {
                            _this8.$set(_this8.inputArr, index, item.label);
                          }
                        });
                      });
                    });
                    _this8.autoFeedback();
                  }
                  //  多选
                  if (_this8.isMultiple) {
                    arr = [];
                    value.forEach(function (v) {
                      var _arr;
                      (_arr = arr).push.apply(_arr, toConsumableArray_default()(v));
                    });
                    arr = toConsumableArray_default()(new Set(arr));
                    if (arr.every(function (v) {
                      return _this8.allCheckedArr.includes(v);
                    })) {
                      // 如果已有选项则关闭lazy，修复取消点击依然全选
                      _this8.$nextTick(function () {
                        // 1、删除标签会出现清空已选项的情况修复，2、重复点击选择选中失效修复
                        if (_this8.isRemoveTag === true || _this8.innerProps.checkStrictly === true) {
                          _this8.innerProps.lazy = true;
                          _this8.isRemoveTag === false;
                        } else {
                          _this8.innerProps.lazy = false;
                        }
                      });
                    } else if (_this8.props.lazy === true) {
                      _this8.innerProps.lazy = true;
                    }
                  }
                }
              }
            case 1:
            case "end":
              return _context9.stop();
          }
        }, _callee9);
      }))();
    },
    getNode: function getNode(node, resolve) {
      var _this9 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee13() {
        var level, label, nodes, innerOptions, _innerOptions;
        return regenerator_default().wrap(function _callee13$(_context13) {
          while (1) switch (_context13.prev = _context13.next) {
            case 0:
              level = node.level, label = node.label; // 叶子节点不请求直接resolve
              if (node.data && node.data[_this9.innerProps.leaf]) {
                resolve();
              }
              // 多选和单选分开处理
              if (_this9.isMultiple) {
                if (level === 0 || node.data && !node.data[_this9.innerProps.children] || node.data && !node.data[_this9.innerProps.children].length) {
                  _this9.props.lazyLoad(node, /*#__PURE__*/function () {
                    var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee10(result) {
                      var nodes;
                      return regenerator_default().wrap(function _callee10$(_context10) {
                        while (1) switch (_context10.prev = _context10.next) {
                          case 0:
                            _context10.next = 2;
                            return _this9.getResult(result);
                          case 2:
                            result = _context10.sent;
                            nodes = result.map(function (v) {
                              var _objectSpread4;
                              return mainvue_type_script_lang_js_objectSpread(mainvue_type_script_lang_js_objectSpread({}, v), {}, (_objectSpread4 = {}, defineProperty_default()(_objectSpread4, _this9.innerProps.value, v[_this9.innerProps.value]), defineProperty_default()(_objectSpread4, _this9.innerProps.label, v[_this9.innerProps.label]), defineProperty_default()(_objectSpread4, _this9.innerProps.leaf, Object.prototype.hasOwnProperty.call(v, _this9.innerProps.leaf) ? v[_this9.innerProps.leaf] || level >= _this9.maxLevel : level >= _this9.maxLevel), defineProperty_default()(_objectSpread4, "parentValue", node.value), _objectSpread4));
                            });
                            _this9.$nextTick(function () {
                              resolve(nodes);
                            });
                          case 5:
                          case "end":
                            return _context10.stop();
                        }
                      }, _callee10);
                    }));
                    return function (_x8) {
                      return _ref8.apply(this, arguments);
                    };
                  }());
                } else {
                  resolve();
                }
              } else if (!_this9.isMultiple) {
                // 保存label回显用
                if (!_this9.isMultiple && label) {
                  _this9.$set(_this9.inputArr, [level - 1], label);
                }
                // 只在数值类型正确的时候加载下拉数据
                if (Array.isArray(_this9.innerValue) === true) {
                  nodes = []; // 判断是否获取api数据，避免数据重复
                  // 0级的时候有innerOptions则用opt数值，没有则通过事件调用数据
                  if (level === 0 && _this9.innerOptions.length) {
                    // 赋值完下拉再赋值选中数据
                    innerOptions = [];
                    innerOptions = _this9.levelChildNodes.length && Object.keys(_this9.levelChildNodes[0]).length ? JSON.parse(JSON.stringify(_this9.levelChildNodes[0])) : JSON.parse(JSON.stringify(_this9.innerOptions));
                    // 关键在于这个this.$nextTick,在页面加载完成后再回填子选项则可以自动响应下一级，
                    // 没加则无法响应回显下一级
                    _this9.autoFeedBackSwitch && _this9.autoFeedback() && _this9.getLabel(innerOptions, level);
                    _this9.$nextTick(function () {
                      resolve(innerOptions);
                    });
                  } else if (level === 0 && !_this9.innerOptions.length && _this9.levelChildNodes.length && Object.keys(_this9.levelChildNodes[0]).length
                  // 如果有第0级数据则直接赋值减少一次请求
                  ) {
                    // 赋值完下拉再赋值选中数据可以引起请求下一级数据
                    _innerOptions = [];
                    _innerOptions = _this9.levelChildNodes.length && Object.keys(_this9.levelChildNodes[0]).length ? JSON.parse(JSON.stringify(_this9.levelChildNodes[0])) : [];
                    _this9.autoFeedBackSwitch && _this9.autoFeedback() && _this9.getLabel(_innerOptions, level);
                    _this9.$nextTick(function () {
                      resolve(_innerOptions);
                    });
                  } else if (level === 0 && !_this9.innerOptions.length) {
                    // 调用当前选中项的下级数据并填充
                    // isEmitRequestZero限制第一次默认请求，第一次请求交给watch中的vulue值变化来处理
                    // 如果是value初始值为[]也请求
                    if (_this9.isEmitRequestZero || !_this9.value.length) {
                      _this9.props.lazyLoad(node, /*#__PURE__*/function () {
                        var _ref9 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee11(result) {
                          return regenerator_default().wrap(function _callee11$(_context11) {
                            while (1) switch (_context11.prev = _context11.next) {
                              case 0:
                                _context11.next = 2;
                                return _this9.getResult(result);
                              case 2:
                                result = _context11.sent;
                                nodes = _this9.dealResult(result, level);
                                // 因为第一次启动总会调用一次getNode,所以0级数据存起来可以重复利用
                                _this9.levelChildNodes[0] = JSON.parse(JSON.stringify(nodes));
                                _this9.autoFeedBackSwitch && _this9.autoFeedback() && _this9.getLabel(nodes, level);
                                _this9.$nextTick(function () {
                                  resolve(nodes);
                                });
                              case 7:
                              case "end":
                                return _context11.stop();
                            }
                          }, _callee11);
                        }));
                        return function (_x9) {
                          return _ref9.apply(this, arguments);
                        };
                      }());
                    }
                  } else {
                    // 非0级处理
                    // 当前被点击的选项已有children则不再获取下一级nodes,直接resolve
                    if (node.data && node.data[_this9.innerProps.children] && node.data[_this9.innerProps.children].length) {
                      if (_this9.levelChildNodes.length && _this9.levelChildNodes[level - 1] && Object.keys(_this9.levelChildNodes[level - 1]).length) {
                        _this9.autoFeedBackSwitch && _this9.autoFeedback() && _this9.getLabel(_this9.levelChildNodes[level], level);
                      }
                      resolve();
                    } else {
                      // 非0级点击下级无数据时
                      _this9.props.lazyLoad(node, /*#__PURE__*/function () {
                        var _ref10 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee12(result) {
                          return regenerator_default().wrap(function _callee12$(_context12) {
                            while (1) switch (_context12.prev = _context12.next) {
                              case 0:
                                _context12.next = 2;
                                return _this9.getResult(result);
                              case 2:
                                result = _context12.sent;
                                nodes = _this9.dealResult(result, level);
                                _this9.levelChildNodes[level] = nodes;
                                _this9.autoFeedBackSwitch && _this9.autoFeedback() && _this9.getLabel(nodes, level);
                                // 通过调用resolve将子节点数据返回，通知组件数据加载完成
                                _this9.$nextTick(function () {
                                  resolve(nodes);
                                });
                              case 7:
                              case "end":
                                return _context12.stop();
                            }
                          }, _callee12);
                        }));
                        return function (_x10) {
                          return _ref10.apply(this, arguments);
                        };
                      }());
                    }
                  }
                }
              } else {
                resolve();
              }
            case 3:
            case "end":
              return _context13.stop();
          }
        }, _callee13);
      }))();
    },
    getResult: function getResult(result) {
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee14() {
        return regenerator_default().wrap(function _callee14$(_context14) {
          while (1) switch (_context14.prev = _context14.next) {
            case 0:
              if (!(typeof result === 'function')) {
                _context14.next = 13;
                break;
              }
              _context14.prev = 1;
              _context14.next = 4;
              return result();
            case 4:
              result = _context14.sent;
              return _context14.abrupt("return", result);
            case 8:
              _context14.prev = 8;
              _context14.t0 = _context14["catch"](1);
              console.log(_context14.t0);
            case 11:
              _context14.next = 27;
              break;
            case 13:
              if (!isPromise(result)) {
                _context14.next = 26;
                break;
              }
              _context14.prev = 14;
              _context14.next = 17;
              return result;
            case 17:
              result = _context14.sent;
              return _context14.abrupt("return", result);
            case 21:
              _context14.prev = 21;
              _context14.t1 = _context14["catch"](14);
              console.log(_context14.t1);
            case 24:
              _context14.next = 27;
              break;
            case 26:
              return _context14.abrupt("return", result);
            case 27:
            case "end":
              return _context14.stop();
          }
        }, _callee14, null, [[1, 8], [14, 21]]);
      }))();
    },
    dealResult: function dealResult(result, level) {
      var _this10 = this;
      result = result.map(function (v) {
        var _objectSpread5;
        return mainvue_type_script_lang_js_objectSpread(mainvue_type_script_lang_js_objectSpread({}, v), {}, (_objectSpread5 = {}, defineProperty_default()(_objectSpread5, _this10.innerProps.value, v[_this10.innerProps.value]), defineProperty_default()(_objectSpread5, _this10.innerProps.label, v[_this10.innerProps.label]), defineProperty_default()(_objectSpread5, _this10.innerProps.leaf, Object.prototype.hasOwnProperty.call(v, _this10.innerProps.leaf) ? v[_this10.innerProps.leaf] || level >= _this10.maxLevel : level >= _this10.maxLevel), _objectSpread5));
      });
      return result;
    },
    // 从获取的nodes节点中得到当前level的选项值对应的label
    getLabel: function getLabel(nodes, level) {
      var _this11 = this;
      var input = nodes.find(function (node) {
        return _this11.innerValue[level] === node[_this11.innerProps.value];
      });
      input = input ? input[this.innerProps.label] : '';
      if (input) {
        this.$set(this.inputArr, level, input);
      }
    },
    // 单选提前回显,可提高回显速度
    autoFeedback: function autoFeedback() {
      var _this12 = this;
      // 不关联的时候因为本身就有实时响应功能无需手动回显
      var inputArr = JSON.parse(JSON.stringify(this.inputArr));
      if (this.$refs && this.$refs.cascader && !this.props.checkStrictly) {
        this.$nextTick(function () {
          _this12.$refs.cascader.inputValue = inputArr.join(_this12.separator);
        });
      }
    }
  }
});
;// CONCATENATED MODULE: ./packages/cascader-plugin/src/main.vue?vue&type=script&lang=js&
 /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_); 
;// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent(
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier /* server only */,
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options =
    typeof scriptExports === 'function' ? scriptExports.options : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
          injectStyles.call(
            this,
            (options.functional ? this.parent : this).$root.$options.shadowRoot
          )
        }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}

;// CONCATENATED MODULE: ./packages/cascader-plugin/src/main.vue





/* normalize component */
;
var component = normalizeComponent(
  src_mainvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* harmony default export */ var main = (component.exports);
;// CONCATENATED MODULE: ./packages/cascader-plugin/index.js

main.install = function (Vue) {
  Vue.component(main.name, main);
};
/* harmony default export */ var cascader_plugin = (main);
module.exports = __webpack_exports__;
/******/ })()
;