UNPKG

@riophae/vue-treeselect

Version:

A multi-select component with nested options support for Vue.js

1,993 lines (1,682 loc) 152 kB
/*! * vue-treeselect v0.4.0 | (c) 2017-2019 Riophae Lee * Released under the MIT License. * https://vue-treeselect.js.org/ */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("Vue")); else if(typeof define === 'function' && define.amd) define(["Vue"], factory); else if(typeof exports === 'object') exports["VueTreeselect"] = factory(require("Vue")); else root["VueTreeselect"] = factory(root["Vue"]); })(window, function(__WEBPACK_EXTERNAL_MODULE__34__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // 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 }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 36); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var arrayWithHoles = __webpack_require__(1); var iterableToArrayLimit = __webpack_require__(2); var nonIterableRest = __webpack_require__(3); function _slicedToArray(arr, i) { return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); } module.exports = _slicedToArray; /***/ }), /* 1 */ /***/ (function(module, exports) { function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } module.exports = _arrayWithHoles; /***/ }), /* 2 */ /***/ (function(module, exports) { function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } module.exports = _iterableToArrayLimit; /***/ }), /* 3 */ /***/ (function(module, exports) { function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } module.exports = _nonIterableRest; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { var arrayWithoutHoles = __webpack_require__(5); var iterableToArray = __webpack_require__(6); var nonIterableSpread = __webpack_require__(7); function _toConsumableArray(arr) { return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); } module.exports = _toConsumableArray; /***/ }), /* 5 */ /***/ (function(module, exports) { function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } module.exports = _arrayWithoutHoles; /***/ }), /* 6 */ /***/ (function(module, exports) { function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } module.exports = _iterableToArray; /***/ }), /* 7 */ /***/ (function(module, exports) { function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } module.exports = _nonIterableSpread; /***/ }), /* 8 */ /***/ (function(module, exports) { function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } module.exports = _defineProperty; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function fuzzysearch (needle, haystack) { var tlen = haystack.length; var qlen = needle.length; if (qlen > tlen) { return false; } if (qlen === tlen) { return needle === haystack; } outer: for (var i = 0, j = 0; i < qlen; i++) { var nch = needle.charCodeAt(i); while (j < tlen) { if (haystack.charCodeAt(j++) === nch) { continue outer; } } return false; } return true; } module.exports = fuzzysearch; /***/ }), /* 10 */ /***/ (function(module, exports) { /** * This method returns `undefined`. * * @static * @memberOf _ * @since 2.3.0 * @category Util * @example * * _.times(2, _.noop); * // => [undefined, undefined] */ function noop() { // No operation performed. } module.exports = noop; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(12), now = __webpack_require__(13), toNumber = __webpack_require__(17); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max, nativeMin = Math.min; /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } module.exports = debounce; /***/ }), /* 12 */ /***/ (function(module, exports) { /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { var root = __webpack_require__(14); /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = function() { return root.Date.now(); }; module.exports = now; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { var freeGlobal = __webpack_require__(15); /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; module.exports = freeGlobal; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(16))) /***/ }), /* 16 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(12), isSymbol = __webpack_require__(18); /** Used as references for various `Number` constants. */ var NAN = 0 / 0; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } module.exports = toNumber; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(19), isObjectLike = __webpack_require__(23); /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } module.exports = isSymbol; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(20), getRawTag = __webpack_require__(21), objectToString = __webpack_require__(22); /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } module.exports = baseGetTag; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { var root = __webpack_require__(14); /** Built-in value references. */ var Symbol = root.Symbol; module.exports = Symbol; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(20); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } module.exports = getRawTag; /***/ }), /* 22 */ /***/ (function(module, exports) { /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } module.exports = objectToString; /***/ }), /* 23 */ /***/ (function(module, exports) { /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } module.exports = isObjectLike; /***/ }), /* 24 */ /***/ (function(module, exports) { module.exports = isPromise; function isPromise(obj) { return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; } /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { var before = __webpack_require__(26); /** * Creates a function that is restricted to invoking `func` once. Repeat calls * to the function return the value of the first invocation. The `func` is * invoked with the `this` binding and arguments of the created function. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var initialize = _.once(createApplication); * initialize(); * initialize(); * // => `createApplication` is invoked once */ function once(func) { return before(2, func); } module.exports = once; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(27); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it's called less than `n` times. Subsequent * calls to the created function return the result of the last `func` invocation. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * jQuery(element).on('click', _.before(5, addContactToList)); * // => Allows adding up to 4 contacts to the list. */ function before(n, func) { var result; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n > 0) { result = func.apply(this, arguments); } if (n <= 1) { func = undefined; } return result; }; } module.exports = before; /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { var toFinite = __webpack_require__(28); /** * Converts `value` to an integer. * * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3.2); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3.2'); * // => 3 */ function toInteger(value) { var result = toFinite(value), remainder = result % 1; return result === result ? (remainder ? result - remainder : result) : 0; } module.exports = toInteger; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { var toNumber = __webpack_require__(17); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_INTEGER = 1.7976931348623157e+308; /** * Converts `value` to a finite number. * * @static * @memberOf _ * @since 4.12.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted number. * @example * * _.toFinite(3.2); * // => 3.2 * * _.toFinite(Number.MIN_VALUE); * // => 5e-324 * * _.toFinite(Infinity); * // => 1.7976931348623157e+308 * * _.toFinite('3.2'); * // => 3.2 */ function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } return value === value ? value : 0; } module.exports = toFinite; /***/ }), /* 29 */ /***/ (function(module, exports) { /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } module.exports = identity; /***/ }), /* 30 */ /***/ (function(module, exports) { /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function() { return value; }; } module.exports = constant; /***/ }), /* 31 */ /***/ (function(module, exports) { function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } function _typeof(obj) { if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { module.exports = _typeof = function _typeof(obj) { return _typeof2(obj); }; } else { module.exports = _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); }; } return _typeof(obj); } module.exports = _typeof; /***/ }), /* 32 */ /***/ (function(module, exports) { /** * Gets the last element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array == null ? 0 : array.length; return length ? array[length - 1] : undefined; } module.exports = last; /***/ }), /* 33 */ /***/ (function(module, exports) { var nestRE = /^(attrs|props|on|nativeOn|class|style|hook)$/ module.exports = function mergeJSXProps (objs) { return objs.reduce(function (a, b) { var aa, bb, key, nestedKey, temp for (key in b) { aa = a[key] bb = b[key] if (aa && nestRE.test(key)) { // normalize class if (key === 'class') { if (typeof aa === 'string') { temp = aa a[key] = aa = {} aa[temp] = true } if (typeof bb === 'string') { temp = bb b[key] = bb = {} bb[temp] = true } } if (key === 'on' || key === 'nativeOn' || key === 'hook') { // merge functions for (nestedKey in bb) { aa[nestedKey] = mergeFn(aa[nestedKey], bb[nestedKey]) } } else if (Array.isArray(aa)) { a[key] = aa.concat(bb) } else if (Array.isArray(bb)) { a[key] = [aa].concat(bb) } else { for (nestedKey in bb) { aa[nestedKey] = bb[nestedKey] } } } else { a[key] = b[key] } } return a }, {}) } function mergeFn (a, b) { return function () { a && a.apply(this, arguments) b && b.apply(this, arguments) } } /***/ }), /* 34 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__34__; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /* 36 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js var slicedToArray = __webpack_require__(0); var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js var toConsumableArray = __webpack_require__(4); var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js var defineProperty = __webpack_require__(8); var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty); // EXTERNAL MODULE: ./node_modules/fuzzysearch/index.js var fuzzysearch = __webpack_require__(9); var fuzzysearch_default = /*#__PURE__*/__webpack_require__.n(fuzzysearch); // EXTERNAL MODULE: ./node_modules/lodash/noop.js var noop = __webpack_require__(10); // CONCATENATED MODULE: ./src/utils/noop.js // CONCATENATED MODULE: ./src/utils/warning.js var warning_warning = false ? undefined : function warning(checker, complainer) { if (!checker()) { var _console; var message = ['[Vue-Treeselect Warning]'].concat(complainer()); (_console = console).error.apply(_console, toConsumableArray_default()(message)); } }; // CONCATENATED MODULE: ./src/utils/onLeftClick.js function onLeftClick(mouseDownHandler) { return function onMouseDown(evt) { if (evt.type === 'mousedown' && evt.button === 0) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } mouseDownHandler.call.apply(mouseDownHandler, [this, evt].concat(args)); } }; } // CONCATENATED MODULE: ./src/utils/scrollIntoView.js function scrollIntoView($scrollingEl, $focusedEl) { var scrollingReact = $scrollingEl.getBoundingClientRect(); var focusedRect = $focusedEl.getBoundingClientRect(); var overScroll = $focusedEl.offsetHeight / 3; if (focusedRect.bottom + overScroll > scrollingReact.bottom) { $scrollingEl.scrollTop = Math.min($focusedEl.offsetTop + $focusedEl.clientHeight - $scrollingEl.offsetHeight + overScroll, $scrollingEl.scrollHeight); } else if (focusedRect.top - overScroll < scrollingReact.top) { $scrollingEl.scrollTop = Math.max($focusedEl.offsetTop - overScroll, 0); } } // EXTERNAL MODULE: ./node_modules/lodash/debounce.js var debounce = __webpack_require__(11); var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce); // CONCATENATED MODULE: ./src/utils/debounce.js // CONCATENATED MODULE: ./node_modules/watch-size/index.es.mjs var index_es_index = (function (element, listener) { var expand = document.createElement('_'); var shrink = expand.appendChild(document.createElement('_')); var expandChild = expand.appendChild(document.createElement('_')); var shrinkChild = shrink.appendChild(document.createElement('_')); var lastWidth = void 0, lastHeight = void 0; shrink.style.cssText = expand.style.cssText = 'height:100%;left:0;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:0;transition:0s;width:100%;z-index:-1'; shrinkChild.style.cssText = expandChild.style.cssText = 'display:block;height:100%;transition:0s;width:100%'; shrinkChild.style.width = shrinkChild.style.height = '200%'; element.appendChild(expand); test(); return stop; function test() { unbind(); var width = element.offsetWidth; var height = element.offsetHeight; if (width !== lastWidth || height !== lastHeight) { lastWidth = width; lastHeight = height; expandChild.style.width = width * 2 + 'px'; expandChild.style.height = height * 2 + 'px'; expand.scrollLeft = expand.scrollWidth; expand.scrollTop = expand.scrollHeight; shrink.scrollLeft = shrink.scrollWidth; shrink.scrollTop = shrink.scrollHeight; listener({ width: width, height: height }); } shrink.addEventListener('scroll', test); expand.addEventListener('scroll', test); } function unbind() { shrink.removeEventListener('scroll', test); expand.removeEventListener('scroll', test); } function stop() { unbind(); element.removeChild(expand); } }); /* harmony default export */ var index_es = (index_es_index); // CONCATENATED MODULE: ./src/utils/removeFromArray.js function removeFromArray(arr, elem) { var idx = arr.indexOf(elem); if (idx !== -1) arr.splice(idx, 1); } // CONCATENATED MODULE: ./src/utils/watchSize.js var intervalId; var registered = []; var INTERVAL_DURATION = 100; function run() { intervalId = setInterval(function () { registered.forEach(test); }, INTERVAL_DURATION); } function stop() { clearInterval(intervalId); intervalId = null; } function test(item) { var $el = item.$el, listener = item.listener, lastWidth = item.lastWidth, lastHeight = item.lastHeight; var width = $el.offsetWidth; var height = $el.offsetHeight; if (lastWidth !== width || lastHeight !== height) { item.lastWidth = width; item.lastHeight = height; listener({ width: width, height: height }); } } function watchSizeForIE9($el, listener) { var item = { $el: $el, listener: listener, lastWidth: null, lastHeight: null }; var unwatch = function unwatch() { removeFromArray(registered, item); if (!registered.length) stop(); }; registered.push(item); test(item); run(); return unwatch; } function watchSize($el, listener) { var isIE9 = document.documentMode === 9; var locked = true; var wrappedListener = function wrappedListener() { return locked || listener.apply(void 0, arguments); }; var implementation = isIE9 ? watchSizeForIE9 : index_es; var removeSizeWatcher = implementation($el, wrappedListener); locked = false; return removeSizeWatcher; } // CONCATENATED MODULE: ./src/utils/setupResizeAndScrollEventListeners.js function findScrollParents($el) { var $scrollParents = []; var $parent = $el.parentNode; while ($parent && $parent.nodeName !== 'BODY' && $parent.nodeType === document.ELEMENT_NODE) { if (isScrollElment($parent)) $scrollParents.push($parent); $parent = $parent.parentNode; } $scrollParents.push(window); return $scrollParents; } function isScrollElment($el) { var _getComputedStyle = getComputedStyle($el), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY; return /(auto|scroll|overlay)/.test(overflow + overflowY + overflowX); } function setupResizeAndScrollEventListeners($el, listener) { var $scrollParents = findScrollParents($el); window.addEventListener('resize', listener, { passive: true }); $scrollParents.forEach(function (scrollParent) { scrollParent.addEventListener('scroll', listener, { passive: true }); }); return function removeEventListeners() { window.removeEventListener('resize', listener, { passive: true }); $scrollParents.forEach(function ($scrollParent) { $scrollParent.removeEventListener('scroll', listener, { passive: true }); }); }; } // CONCATENATED MODULE: ./src/utils/isNaN.js function isNaN_isNaN(x) { return x !== x; } // EXTERNAL MODULE: ./node_modules/is-promise/index.js var is_promise = __webpack_require__(24); var is_promise_default = /*#__PURE__*/__webpack_require__.n(is_promise); // CONCATENATED MODULE: ./src/utils/isPromise.js // EXTERNAL MODULE: ./node_modules/lodash/once.js var once = __webpack_require__(25); var once_default = /*#__PURE__*/__webpack_require__.n(once); // CONCATENATED MODULE: ./src/utils/once.js // EXTERNAL MODULE: ./node_modules/lodash/identity.js var identity = __webpack_require__(29); var identity_default = /*#__PURE__*/__webpack_require__.n(identity); // CONCATENATED MODULE: ./src/utils/identity.js // EXTERNAL MODULE: ./node_modules/lodash/constant.js var constant = __webpack_require__(30); var constant_default = /*#__PURE__*/__webpack_require__.n(constant); // CONCATENATED MODULE: ./src/utils/constant.js // CONCATENATED MODULE: ./src/utils/createMap.js var createMap = function createMap() { return Object.create(null); }; // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/typeof.js var helpers_typeof = __webpack_require__(31); var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof); // CONCATENATED MODULE: ./src/utils/deepExtend.js function isPlainObject(value) { if (value == null || typeof_default()(value) !== 'object') return false; return Object.getPrototypeOf(value) === Object.prototype; } function copy(obj, key, value) { if (isPlainObject(value)) { obj[key] || (obj[key] = {}); deepExtend(obj[key], value); } else { obj[key] = value; } } function deepExtend(target, source) { if (isPlainObject(source)) { var keys = Object.keys(source); for (var i = 0, len = keys.length; i < len; i++) { copy(target, keys[i], source[keys[i]]); } } return target; } // EXTERNAL MODULE: ./node_modules/lodash/last.js var lodash_last = __webpack_require__(32); var last_default = /*#__PURE__*/__webpack_require__.n(lodash_last); // CONCATENATED MODULE: ./src/utils/last.js // CONCATENATED MODULE: ./src/utils/includes.js function includes(arrOrStr, elem) { return arrOrStr.indexOf(elem) !== -1; } // CONCATENATED MODULE: ./src/utils/find.js function find(arr, predicate, ctx) { for (var i = 0, len = arr.length; i < len; i++) { if (predicate.call(ctx, arr[i], i, arr)) return arr[i]; } return undefined; } // CONCATENATED MODULE: ./src/utils/quickDiff.js function quickDiff(arrA, arrB) { if (arrA.length !== arrB.length) return true; for (var i = 0; i < arrA.length; i++) { if (arrA[i] !== arrB[i]) return true; } return false; } // CONCATENATED MODULE: ./src/utils/index.js // CONCATENATED MODULE: ./src/constants.js var NO_PARENT_NODE = null; var UNCHECKED = 0; var INDETERMINATE = 1; var CHECKED = 2; var ALL_CHILDREN = 'ALL_CHILDREN'; var ALL_DESCENDANTS = 'ALL_DESCENDANTS'; var LEAF_CHILDREN = 'LEAF_CHILDREN'; var LEAF_DESCENDANTS = 'LEAF_DESCENDANTS'; var LOAD_ROOT_OPTIONS = 'LOAD_ROOT_OPTIONS'; var LOAD_CHILDREN_OPTIONS = 'LOAD_CHILDREN_OPTIONS'; var ASYNC_SEARCH = 'ASYNC_SEARCH'; var ALL = 'ALL'; var BRANCH_PRIORITY = 'BRANCH_PRIORITY'; var LEAF_PRIORITY = 'LEAF_PRIORITY'; var ALL_WITH_INDETERMINATE = 'ALL_WITH_INDETERMINATE'; var ORDER_SELECTED = 'ORDER_SELECTED'; var LEVEL = 'LEVEL'; var INDEX = 'INDEX'; var KEY_CODES = { BACKSPACE: 8, ENTER: 13, ESCAPE: 27, END: 35, HOME: 36, ARROW_LEFT: 37, ARROW_UP: 38, ARROW_RIGHT: 39, ARROW_DOWN: 40, DELETE: 46 }; var INPUT_DEBOUNCE_DELAY = false ? undefined : 200; var MIN_INPUT_WIDTH = 5; var MENU_BUFFER = 40; // CONCATENATED MODULE: ./src/mixins/treeselectMixin.js function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function sortValueByIndex(a, b) { var i = 0; do { if (a.level < i) return -1; if (b.level < i) return 1; if (a.index[i] !== b.index[i]) return a.index[i] - b.index[i]; i++; } while (true); } function sortValueByLevel(a, b) { return a.level === b.level ? sortValueByIndex(a, b) : a.level - b.level; } function createAsyncOptionsStates() { return { isLoaded: false, isLoading: false, loadingError: '' }; } function stringifyOptionPropValue(value) { if (typeof value === 'string') return value; if (typeof value === 'number' && !isNaN_isNaN(value)) return value + ''; return ''; } function match(enableFuzzyMatch, needle, haystack) { return enableFuzzyMatch ? fuzzysearch_default()(needle, haystack) : includes(haystack, needle); } function getErrorMessage(err) { return err.message || String(err); } var instanceId = 0; /* harmony default export */ var treeselectMixin = ({ provide: function provide() { return { instance: this }; }, props: { allowClearingDisabled: { type: Boolean, default: false }, allowSelectingDisabledDescendants: { type: Boolean, default: false }, alwaysOpen: { type: Boolean, default: false }, appendToBody: { type: Boolean, default: false }, async: { type: Boolean, default: false }, autoFocus: { type: Boolean, default: false }, autoLoadRootOptions: { type: Boolean, default: true }, autoDeselectAncestors: { type: Boolean, default: false }, autoDeselectDescendants: { type: Boolean, default: false }, autoSelectAncestors: { type: Boolean, default: false }, autoSelectDescendants: { type: Boolean, default: false }, backspaceRemoves: { type: Boolean, default: true }, beforeClearAll: { type: Function, default: constant_default()(true) }, branchNodesFirst: { type: Boolean, default: false }, cacheOptions: { type: Boolean, default: true }, clearable: { type: Boolean, default: true }, clearAllText: { type: String, default: 'Clear all' }, clearOnSelect: { type: Boolean, default: false }, clearValueText: { type: String, default: 'Clear value' }, closeOnSelect: { type: Boolean, default: true }, defaultExpandLevel: { type: Number, default: 0 }, defaultOptions: { default: false }, deleteRemoves: { type: Boolean, default: true }, delimiter: { type: String, default: ',' }, flattenSearchResults: { type: Boolean, default: false }, disableBranchNodes: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, disableFuzzyMatching: { type: Boolean, default: false }, flat: { type: Boolean, default: false }, instanceId: { default: function _default() { return "".concat(instanceId++, "$$"); }, type: [String, Number] }, joinValues: { type: Boolean, default: false }, limit: { type: Number, default: Infinity }, limitText: { type: Function, default: function limitTextDefault(count) { return "and ".concat(count, " more"); } }, loadingText: { type: String, default: 'Loading...' }, loadOptions: { type: Function }, matchKeys: { type: Array, default: constant_default()(['label']) }, maxHeight: { type: Number, default: 300 }, multiple: { type: Boolean, default: false }, name: { type: String }, noChildrenText: { type: String, default: 'No sub-options.' }, noOptionsText: { type: String, default: 'No options available.' }, noResultsText: { type: String, default: 'No results found...' }, normalizer: { type: Function, default: identity_default.a }, openDirection: { type: String, default: 'auto', validator: function validator(value) { var acceptableValues = ['auto', 'top', 'bottom', 'above', 'below']; return includes(acceptableValues, value); } }, openOnClick: { type: Boolean, default: true }, openOnFocus: { type: Boolean, default: false }, options: { type: Array }, placeholder: { type: String, default: 'Select...' }, required: { type: Boolean, default: false }, retryText: { type: String, default: 'Retry?' }, retryTitle: { type: String, default: 'Click to retry' }, searchable: { type: Boolean, default: true }, searchNested: { type: Boolean, default: false }, searchPromptText: { type: String, default: 'Type to search...' }, showCount: { type: Boolean, default: false }, showCountOf: { type: String, default: ALL_CHILDREN, validator: function validator(value) { var acceptableValues = [ALL_CHILDREN, ALL_DESCENDANTS, LEAF_CHILDREN, LEAF_DESCENDANTS]; return includes(acceptableValues, value); } }, showCountOnSearch: null, sortValueBy: { type: String, default: ORDER_SELECTED, validator: function validator(value) { var acceptableValues = [ORDER_SELECTED, LEVEL, INDEX]; return includes(acceptableValues, value); } }, tabIndex: { type: Number, default: 0 }, value: null, valueConsistsOf: { type: String, default: BRANCH_PRIORITY, validator: function validator(value) { var acceptableValues = [ALL, BRANCH_PRIORITY, LEAF_PRIORITY, ALL_WITH_INDETERMINATE]; return includes(acceptableValues, value); } }, valueFormat: { type: String, default: 'id' }, zIndex: { type: [Number, String], default: 999 } }, data: function data() { return { trigger: { isFocused: false, searchQuery: '' }, menu: { isOpen: false, current: null, lastScrollPosition: 0, placement: 'bottom' }, forest: { normalizedOptions: [], nodeMap: createMap(), checkedStateMap: createMap(), selectedNodeIds: this.extractCheckedNodeIdsFromValue(), selectedNodeMap: createMap() }, rootOptionsStates: createAsyncOptionsStates(), localSearch: { active: false, noResults: true, countMap: createMap() }, remoteSearch: createMap() }; }, computed: { selectedNodes: function selectedNodes() { return this.forest.selectedNodeIds.map(this.getNode); }, internalValue: function internalValue() { var _this = this; var internalValue; if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) { internalValue = this.forest.selectedNodeIds.slice(); } else if (this.valueConsistsOf === BRANCH_PRIORITY) { internalValue = this.forest.selectedNodeIds.filter(function (id) { var node = _this.getNode(id);