@reviewpush/rp-treeselect 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4874 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("Vue"));
4
- else if(typeof define === 'function' && define.amd)
5
- define(["Vue"], factory);
6
- else if(typeof exports === 'object')
7
- exports["RpTreeselect"] = factory(require("Vue"));
8
- else
9
- root["RpTreeselect"] = factory(root["Vue"]);
10
- })(window, function(__WEBPACK_EXTERNAL_MODULE__15__) {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
- /******/ }
51
- /******/ };
52
- /******/
53
- /******/ // define __esModule on exports
54
- /******/ __webpack_require__.r = function(exports) {
55
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
- /******/ }
58
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
- /******/ };
60
- /******/
61
- /******/ // create a fake namespace object
62
- /******/ // mode & 1: value is a module id, require it
63
- /******/ // mode & 2: merge all properties of value into the ns
64
- /******/ // mode & 4: return value when already ns object
65
- /******/ // mode & 8|1: behave like require
66
- /******/ __webpack_require__.t = function(value, mode) {
67
- /******/ if(mode & 1) value = __webpack_require__(value);
68
- /******/ if(mode & 8) return value;
69
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
- /******/ var ns = Object.create(null);
71
- /******/ __webpack_require__.r(ns);
72
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
- /******/ return ns;
75
- /******/ };
76
- /******/
77
- /******/ // getDefaultExport function for compatibility with non-harmony modules
78
- /******/ __webpack_require__.n = function(module) {
79
- /******/ var getter = module && module.__esModule ?
80
- /******/ function getDefault() { return module['default']; } :
81
- /******/ function getModuleExports() { return module; };
82
- /******/ __webpack_require__.d(getter, 'a', getter);
83
- /******/ return getter;
84
- /******/ };
85
- /******/
86
- /******/ // Object.prototype.hasOwnProperty.call
87
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
- /******/
89
- /******/ // __webpack_public_path__
90
- /******/ __webpack_require__.p = "/";
91
- /******/
92
- /******/
93
- /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = 42);
95
- /******/ })
96
- /************************************************************************/
97
- /******/ ([
98
- /* 0 */
99
- /***/ (function(module, exports, __webpack_require__) {
100
-
101
- var arrayWithHoles = __webpack_require__(1);
102
- var iterableToArrayLimit = __webpack_require__(2);
103
- var unsupportedIterableToArray = __webpack_require__(3);
104
- var nonIterableRest = __webpack_require__(5);
105
- function _slicedToArray(arr, i) {
106
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
107
- }
108
- module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
109
-
110
- /***/ }),
111
- /* 1 */
112
- /***/ (function(module, exports) {
113
-
114
- function _arrayWithHoles(arr) {
115
- if (Array.isArray(arr)) return arr;
116
- }
117
- module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
118
-
119
- /***/ }),
120
- /* 2 */
121
- /***/ (function(module, exports) {
122
-
123
- function _iterableToArrayLimit(r, l) {
124
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
125
- if (null != t) {
126
- var e,
127
- n,
128
- i,
129
- u,
130
- a = [],
131
- f = !0,
132
- o = !1;
133
- try {
134
- if (i = (t = t.call(r)).next, 0 === l) {
135
- if (Object(t) !== t) return;
136
- f = !1;
137
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
138
- } catch (r) {
139
- o = !0, n = r;
140
- } finally {
141
- try {
142
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
143
- } finally {
144
- if (o) throw n;
145
- }
146
- }
147
- return a;
148
- }
149
- }
150
- module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
151
-
152
- /***/ }),
153
- /* 3 */
154
- /***/ (function(module, exports, __webpack_require__) {
155
-
156
- var arrayLikeToArray = __webpack_require__(4);
157
- function _unsupportedIterableToArray(o, minLen) {
158
- if (!o) return;
159
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
160
- var n = Object.prototype.toString.call(o).slice(8, -1);
161
- if (n === "Object" && o.constructor) n = o.constructor.name;
162
- if (n === "Map" || n === "Set") return Array.from(o);
163
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
164
- }
165
- module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
166
-
167
- /***/ }),
168
- /* 4 */
169
- /***/ (function(module, exports) {
170
-
171
- function _arrayLikeToArray(arr, len) {
172
- if (len == null || len > arr.length) len = arr.length;
173
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
174
- return arr2;
175
- }
176
- module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
177
-
178
- /***/ }),
179
- /* 5 */
180
- /***/ (function(module, exports) {
181
-
182
- function _nonIterableRest() {
183
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
184
- }
185
- module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
186
-
187
- /***/ }),
188
- /* 6 */
189
- /***/ (function(module, exports, __webpack_require__) {
190
-
191
- var arrayWithoutHoles = __webpack_require__(7);
192
- var iterableToArray = __webpack_require__(8);
193
- var unsupportedIterableToArray = __webpack_require__(3);
194
- var nonIterableSpread = __webpack_require__(9);
195
- function _toConsumableArray(arr) {
196
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
197
- }
198
- module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
199
-
200
- /***/ }),
201
- /* 7 */
202
- /***/ (function(module, exports, __webpack_require__) {
203
-
204
- var arrayLikeToArray = __webpack_require__(4);
205
- function _arrayWithoutHoles(arr) {
206
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
207
- }
208
- module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
209
-
210
- /***/ }),
211
- /* 8 */
212
- /***/ (function(module, exports) {
213
-
214
- function _iterableToArray(iter) {
215
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
216
- }
217
- module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
218
-
219
- /***/ }),
220
- /* 9 */
221
- /***/ (function(module, exports) {
222
-
223
- function _nonIterableSpread() {
224
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
225
- }
226
- module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
227
-
228
- /***/ }),
229
- /* 10 */
230
- /***/ (function(module, exports, __webpack_require__) {
231
-
232
- var toPropertyKey = __webpack_require__(11);
233
- function _defineProperty(obj, key, value) {
234
- key = toPropertyKey(key);
235
- if (key in obj) {
236
- Object.defineProperty(obj, key, {
237
- value: value,
238
- enumerable: true,
239
- configurable: true,
240
- writable: true
241
- });
242
- } else {
243
- obj[key] = value;
244
- }
245
- return obj;
246
- }
247
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
248
-
249
- /***/ }),
250
- /* 11 */
251
- /***/ (function(module, exports, __webpack_require__) {
252
-
253
- var _typeof = __webpack_require__(12)["default"];
254
- var toPrimitive = __webpack_require__(13);
255
- function toPropertyKey(t) {
256
- var i = toPrimitive(t, "string");
257
- return "symbol" == _typeof(i) ? i : String(i);
258
- }
259
- module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
260
-
261
- /***/ }),
262
- /* 12 */
263
- /***/ (function(module, exports) {
264
-
265
- function _typeof(o) {
266
- "@babel/helpers - typeof";
267
-
268
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
269
- return typeof o;
270
- } : function (o) {
271
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
272
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
273
- }
274
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
275
-
276
- /***/ }),
277
- /* 13 */
278
- /***/ (function(module, exports, __webpack_require__) {
279
-
280
- var _typeof = __webpack_require__(12)["default"];
281
- function toPrimitive(t, r) {
282
- if ("object" != _typeof(t) || !t) return t;
283
- var e = t[Symbol.toPrimitive];
284
- if (void 0 !== e) {
285
- var i = e.call(t, r || "default");
286
- if ("object" != _typeof(i)) return i;
287
- throw new TypeError("@@toPrimitive must return a primitive value.");
288
- }
289
- return ("string" === r ? String : Number)(t);
290
- }
291
- module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
292
-
293
- /***/ }),
294
- /* 14 */
295
- /***/ (function(module, exports, __webpack_require__) {
296
-
297
- "use strict";
298
-
299
-
300
- function fuzzysearch (needle, haystack) {
301
- var tlen = haystack.length;
302
- var qlen = needle.length;
303
- if (qlen > tlen) {
304
- return false;
305
- }
306
- if (qlen === tlen) {
307
- return needle === haystack;
308
- }
309
- outer: for (var i = 0, j = 0; i < qlen; i++) {
310
- var nch = needle.charCodeAt(i);
311
- while (j < tlen) {
312
- if (haystack.charCodeAt(j++) === nch) {
313
- continue outer;
314
- }
315
- }
316
- return false;
317
- }
318
- return true;
319
- }
320
-
321
- module.exports = fuzzysearch;
322
-
323
-
324
- /***/ }),
325
- /* 15 */
326
- /***/ (function(module, exports) {
327
-
328
- module.exports = __WEBPACK_EXTERNAL_MODULE__15__;
329
-
330
- /***/ }),
331
- /* 16 */
332
- /***/ (function(module, exports) {
333
-
334
- /**
335
- * This method returns `undefined`.
336
- *
337
- * @static
338
- * @memberOf _
339
- * @since 2.3.0
340
- * @category Util
341
- * @example
342
- *
343
- * _.times(2, _.noop);
344
- * // => [undefined, undefined]
345
- */
346
- function noop() {
347
- // No operation performed.
348
- }
349
-
350
- module.exports = noop;
351
-
352
-
353
- /***/ }),
354
- /* 17 */
355
- /***/ (function(module, exports, __webpack_require__) {
356
-
357
- var isObject = __webpack_require__(18),
358
- now = __webpack_require__(19),
359
- toNumber = __webpack_require__(23);
360
-
361
- /** Error message constants. */
362
- var FUNC_ERROR_TEXT = 'Expected a function';
363
-
364
- /* Built-in method references for those with the same name as other `lodash` methods. */
365
- var nativeMax = Math.max,
366
- nativeMin = Math.min;
367
-
368
- /**
369
- * Creates a debounced function that delays invoking `func` until after `wait`
370
- * milliseconds have elapsed since the last time the debounced function was
371
- * invoked. The debounced function comes with a `cancel` method to cancel
372
- * delayed `func` invocations and a `flush` method to immediately invoke them.
373
- * Provide `options` to indicate whether `func` should be invoked on the
374
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
375
- * with the last arguments provided to the debounced function. Subsequent
376
- * calls to the debounced function return the result of the last `func`
377
- * invocation.
378
- *
379
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
380
- * invoked on the trailing edge of the timeout only if the debounced function
381
- * is invoked more than once during the `wait` timeout.
382
- *
383
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
384
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
385
- *
386
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
387
- * for details over the differences between `_.debounce` and `_.throttle`.
388
- *
389
- * @static
390
- * @memberOf _
391
- * @since 0.1.0
392
- * @category Function
393
- * @param {Function} func The function to debounce.
394
- * @param {number} [wait=0] The number of milliseconds to delay.
395
- * @param {Object} [options={}] The options object.
396
- * @param {boolean} [options.leading=false]
397
- * Specify invoking on the leading edge of the timeout.
398
- * @param {number} [options.maxWait]
399
- * The maximum time `func` is allowed to be delayed before it's invoked.
400
- * @param {boolean} [options.trailing=true]
401
- * Specify invoking on the trailing edge of the timeout.
402
- * @returns {Function} Returns the new debounced function.
403
- * @example
404
- *
405
- * // Avoid costly calculations while the window size is in flux.
406
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
407
- *
408
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
409
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
410
- * 'leading': true,
411
- * 'trailing': false
412
- * }));
413
- *
414
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
415
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
416
- * var source = new EventSource('/stream');
417
- * jQuery(source).on('message', debounced);
418
- *
419
- * // Cancel the trailing debounced invocation.
420
- * jQuery(window).on('popstate', debounced.cancel);
421
- */
422
- function debounce(func, wait, options) {
423
- var lastArgs,
424
- lastThis,
425
- maxWait,
426
- result,
427
- timerId,
428
- lastCallTime,
429
- lastInvokeTime = 0,
430
- leading = false,
431
- maxing = false,
432
- trailing = true;
433
-
434
- if (typeof func != 'function') {
435
- throw new TypeError(FUNC_ERROR_TEXT);
436
- }
437
- wait = toNumber(wait) || 0;
438
- if (isObject(options)) {
439
- leading = !!options.leading;
440
- maxing = 'maxWait' in options;
441
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
442
- trailing = 'trailing' in options ? !!options.trailing : trailing;
443
- }
444
-
445
- function invokeFunc(time) {
446
- var args = lastArgs,
447
- thisArg = lastThis;
448
-
449
- lastArgs = lastThis = undefined;
450
- lastInvokeTime = time;
451
- result = func.apply(thisArg, args);
452
- return result;
453
- }
454
-
455
- function leadingEdge(time) {
456
- // Reset any `maxWait` timer.
457
- lastInvokeTime = time;
458
- // Start the timer for the trailing edge.
459
- timerId = setTimeout(timerExpired, wait);
460
- // Invoke the leading edge.
461
- return leading ? invokeFunc(time) : result;
462
- }
463
-
464
- function remainingWait(time) {
465
- var timeSinceLastCall = time - lastCallTime,
466
- timeSinceLastInvoke = time - lastInvokeTime,
467
- timeWaiting = wait - timeSinceLastCall;
468
-
469
- return maxing
470
- ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
471
- : timeWaiting;
472
- }
473
-
474
- function shouldInvoke(time) {
475
- var timeSinceLastCall = time - lastCallTime,
476
- timeSinceLastInvoke = time - lastInvokeTime;
477
-
478
- // Either this is the first call, activity has stopped and we're at the
479
- // trailing edge, the system time has gone backwards and we're treating
480
- // it as the trailing edge, or we've hit the `maxWait` limit.
481
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
482
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
483
- }
484
-
485
- function timerExpired() {
486
- var time = now();
487
- if (shouldInvoke(time)) {
488
- return trailingEdge(time);
489
- }
490
- // Restart the timer.
491
- timerId = setTimeout(timerExpired, remainingWait(time));
492
- }
493
-
494
- function trailingEdge(time) {
495
- timerId = undefined;
496
-
497
- // Only invoke if we have `lastArgs` which means `func` has been
498
- // debounced at least once.
499
- if (trailing && lastArgs) {
500
- return invokeFunc(time);
501
- }
502
- lastArgs = lastThis = undefined;
503
- return result;
504
- }
505
-
506
- function cancel() {
507
- if (timerId !== undefined) {
508
- clearTimeout(timerId);
509
- }
510
- lastInvokeTime = 0;
511
- lastArgs = lastCallTime = lastThis = timerId = undefined;
512
- }
513
-
514
- function flush() {
515
- return timerId === undefined ? result : trailingEdge(now());
516
- }
517
-
518
- function debounced() {
519
- var time = now(),
520
- isInvoking = shouldInvoke(time);
521
-
522
- lastArgs = arguments;
523
- lastThis = this;
524
- lastCallTime = time;
525
-
526
- if (isInvoking) {
527
- if (timerId === undefined) {
528
- return leadingEdge(lastCallTime);
529
- }
530
- if (maxing) {
531
- // Handle invocations in a tight loop.
532
- clearTimeout(timerId);
533
- timerId = setTimeout(timerExpired, wait);
534
- return invokeFunc(lastCallTime);
535
- }
536
- }
537
- if (timerId === undefined) {
538
- timerId = setTimeout(timerExpired, wait);
539
- }
540
- return result;
541
- }
542
- debounced.cancel = cancel;
543
- debounced.flush = flush;
544
- return debounced;
545
- }
546
-
547
- module.exports = debounce;
548
-
549
-
550
- /***/ }),
551
- /* 18 */
552
- /***/ (function(module, exports) {
553
-
554
- /**
555
- * Checks if `value` is the
556
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
557
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
558
- *
559
- * @static
560
- * @memberOf _
561
- * @since 0.1.0
562
- * @category Lang
563
- * @param {*} value The value to check.
564
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
565
- * @example
566
- *
567
- * _.isObject({});
568
- * // => true
569
- *
570
- * _.isObject([1, 2, 3]);
571
- * // => true
572
- *
573
- * _.isObject(_.noop);
574
- * // => true
575
- *
576
- * _.isObject(null);
577
- * // => false
578
- */
579
- function isObject(value) {
580
- var type = typeof value;
581
- return value != null && (type == 'object' || type == 'function');
582
- }
583
-
584
- module.exports = isObject;
585
-
586
-
587
- /***/ }),
588
- /* 19 */
589
- /***/ (function(module, exports, __webpack_require__) {
590
-
591
- var root = __webpack_require__(20);
592
-
593
- /**
594
- * Gets the timestamp of the number of milliseconds that have elapsed since
595
- * the Unix epoch (1 January 1970 00:00:00 UTC).
596
- *
597
- * @static
598
- * @memberOf _
599
- * @since 2.4.0
600
- * @category Date
601
- * @returns {number} Returns the timestamp.
602
- * @example
603
- *
604
- * _.defer(function(stamp) {
605
- * console.log(_.now() - stamp);
606
- * }, _.now());
607
- * // => Logs the number of milliseconds it took for the deferred invocation.
608
- */
609
- var now = function() {
610
- return root.Date.now();
611
- };
612
-
613
- module.exports = now;
614
-
615
-
616
- /***/ }),
617
- /* 20 */
618
- /***/ (function(module, exports, __webpack_require__) {
619
-
620
- var freeGlobal = __webpack_require__(21);
621
-
622
- /** Detect free variable `self`. */
623
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
624
-
625
- /** Used as a reference to the global object. */
626
- var root = freeGlobal || freeSelf || Function('return this')();
627
-
628
- module.exports = root;
629
-
630
-
631
- /***/ }),
632
- /* 21 */
633
- /***/ (function(module, exports, __webpack_require__) {
634
-
635
- /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
636
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
637
-
638
- module.exports = freeGlobal;
639
-
640
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(22)))
641
-
642
- /***/ }),
643
- /* 22 */
644
- /***/ (function(module, exports) {
645
-
646
- var g;
647
-
648
- // This works in non-strict mode
649
- g = (function() {
650
- return this;
651
- })();
652
-
653
- try {
654
- // This works if eval is allowed (see CSP)
655
- g = g || new Function("return this")();
656
- } catch (e) {
657
- // This works if the window reference is available
658
- if (typeof window === "object") g = window;
659
- }
660
-
661
- // g can still be undefined, but nothing to do about it...
662
- // We return undefined, instead of nothing here, so it's
663
- // easier to handle this case. if(!global) { ...}
664
-
665
- module.exports = g;
666
-
667
-
668
- /***/ }),
669
- /* 23 */
670
- /***/ (function(module, exports, __webpack_require__) {
671
-
672
- var baseTrim = __webpack_require__(24),
673
- isObject = __webpack_require__(18),
674
- isSymbol = __webpack_require__(26);
675
-
676
- /** Used as references for various `Number` constants. */
677
- var NAN = 0 / 0;
678
-
679
- /** Used to detect bad signed hexadecimal string values. */
680
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
681
-
682
- /** Used to detect binary string values. */
683
- var reIsBinary = /^0b[01]+$/i;
684
-
685
- /** Used to detect octal string values. */
686
- var reIsOctal = /^0o[0-7]+$/i;
687
-
688
- /** Built-in method references without a dependency on `root`. */
689
- var freeParseInt = parseInt;
690
-
691
- /**
692
- * Converts `value` to a number.
693
- *
694
- * @static
695
- * @memberOf _
696
- * @since 4.0.0
697
- * @category Lang
698
- * @param {*} value The value to process.
699
- * @returns {number} Returns the number.
700
- * @example
701
- *
702
- * _.toNumber(3.2);
703
- * // => 3.2
704
- *
705
- * _.toNumber(Number.MIN_VALUE);
706
- * // => 5e-324
707
- *
708
- * _.toNumber(Infinity);
709
- * // => Infinity
710
- *
711
- * _.toNumber('3.2');
712
- * // => 3.2
713
- */
714
- function toNumber(value) {
715
- if (typeof value == 'number') {
716
- return value;
717
- }
718
- if (isSymbol(value)) {
719
- return NAN;
720
- }
721
- if (isObject(value)) {
722
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
723
- value = isObject(other) ? (other + '') : other;
724
- }
725
- if (typeof value != 'string') {
726
- return value === 0 ? value : +value;
727
- }
728
- value = baseTrim(value);
729
- var isBinary = reIsBinary.test(value);
730
- return (isBinary || reIsOctal.test(value))
731
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
732
- : (reIsBadHex.test(value) ? NAN : +value);
733
- }
734
-
735
- module.exports = toNumber;
736
-
737
-
738
- /***/ }),
739
- /* 24 */
740
- /***/ (function(module, exports, __webpack_require__) {
741
-
742
- var trimmedEndIndex = __webpack_require__(25);
743
-
744
- /** Used to match leading whitespace. */
745
- var reTrimStart = /^\s+/;
746
-
747
- /**
748
- * The base implementation of `_.trim`.
749
- *
750
- * @private
751
- * @param {string} string The string to trim.
752
- * @returns {string} Returns the trimmed string.
753
- */
754
- function baseTrim(string) {
755
- return string
756
- ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
757
- : string;
758
- }
759
-
760
- module.exports = baseTrim;
761
-
762
-
763
- /***/ }),
764
- /* 25 */
765
- /***/ (function(module, exports) {
766
-
767
- /** Used to match a single whitespace character. */
768
- var reWhitespace = /\s/;
769
-
770
- /**
771
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
772
- * character of `string`.
773
- *
774
- * @private
775
- * @param {string} string The string to inspect.
776
- * @returns {number} Returns the index of the last non-whitespace character.
777
- */
778
- function trimmedEndIndex(string) {
779
- var index = string.length;
780
-
781
- while (index-- && reWhitespace.test(string.charAt(index))) {}
782
- return index;
783
- }
784
-
785
- module.exports = trimmedEndIndex;
786
-
787
-
788
- /***/ }),
789
- /* 26 */
790
- /***/ (function(module, exports, __webpack_require__) {
791
-
792
- var baseGetTag = __webpack_require__(27),
793
- isObjectLike = __webpack_require__(31);
794
-
795
- /** `Object#toString` result references. */
796
- var symbolTag = '[object Symbol]';
797
-
798
- /**
799
- * Checks if `value` is classified as a `Symbol` primitive or object.
800
- *
801
- * @static
802
- * @memberOf _
803
- * @since 4.0.0
804
- * @category Lang
805
- * @param {*} value The value to check.
806
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
807
- * @example
808
- *
809
- * _.isSymbol(Symbol.iterator);
810
- * // => true
811
- *
812
- * _.isSymbol('abc');
813
- * // => false
814
- */
815
- function isSymbol(value) {
816
- return typeof value == 'symbol' ||
817
- (isObjectLike(value) && baseGetTag(value) == symbolTag);
818
- }
819
-
820
- module.exports = isSymbol;
821
-
822
-
823
- /***/ }),
824
- /* 27 */
825
- /***/ (function(module, exports, __webpack_require__) {
826
-
827
- var Symbol = __webpack_require__(28),
828
- getRawTag = __webpack_require__(29),
829
- objectToString = __webpack_require__(30);
830
-
831
- /** `Object#toString` result references. */
832
- var nullTag = '[object Null]',
833
- undefinedTag = '[object Undefined]';
834
-
835
- /** Built-in value references. */
836
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
837
-
838
- /**
839
- * The base implementation of `getTag` without fallbacks for buggy environments.
840
- *
841
- * @private
842
- * @param {*} value The value to query.
843
- * @returns {string} Returns the `toStringTag`.
844
- */
845
- function baseGetTag(value) {
846
- if (value == null) {
847
- return value === undefined ? undefinedTag : nullTag;
848
- }
849
- return (symToStringTag && symToStringTag in Object(value))
850
- ? getRawTag(value)
851
- : objectToString(value);
852
- }
853
-
854
- module.exports = baseGetTag;
855
-
856
-
857
- /***/ }),
858
- /* 28 */
859
- /***/ (function(module, exports, __webpack_require__) {
860
-
861
- var root = __webpack_require__(20);
862
-
863
- /** Built-in value references. */
864
- var Symbol = root.Symbol;
865
-
866
- module.exports = Symbol;
867
-
868
-
869
- /***/ }),
870
- /* 29 */
871
- /***/ (function(module, exports, __webpack_require__) {
872
-
873
- var Symbol = __webpack_require__(28);
874
-
875
- /** Used for built-in method references. */
876
- var objectProto = Object.prototype;
877
-
878
- /** Used to check objects for own properties. */
879
- var hasOwnProperty = objectProto.hasOwnProperty;
880
-
881
- /**
882
- * Used to resolve the
883
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
884
- * of values.
885
- */
886
- var nativeObjectToString = objectProto.toString;
887
-
888
- /** Built-in value references. */
889
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
890
-
891
- /**
892
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
893
- *
894
- * @private
895
- * @param {*} value The value to query.
896
- * @returns {string} Returns the raw `toStringTag`.
897
- */
898
- function getRawTag(value) {
899
- var isOwn = hasOwnProperty.call(value, symToStringTag),
900
- tag = value[symToStringTag];
901
-
902
- try {
903
- value[symToStringTag] = undefined;
904
- var unmasked = true;
905
- } catch (e) {}
906
-
907
- var result = nativeObjectToString.call(value);
908
- if (unmasked) {
909
- if (isOwn) {
910
- value[symToStringTag] = tag;
911
- } else {
912
- delete value[symToStringTag];
913
- }
914
- }
915
- return result;
916
- }
917
-
918
- module.exports = getRawTag;
919
-
920
-
921
- /***/ }),
922
- /* 30 */
923
- /***/ (function(module, exports) {
924
-
925
- /** Used for built-in method references. */
926
- var objectProto = Object.prototype;
927
-
928
- /**
929
- * Used to resolve the
930
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
931
- * of values.
932
- */
933
- var nativeObjectToString = objectProto.toString;
934
-
935
- /**
936
- * Converts `value` to a string using `Object.prototype.toString`.
937
- *
938
- * @private
939
- * @param {*} value The value to convert.
940
- * @returns {string} Returns the converted string.
941
- */
942
- function objectToString(value) {
943
- return nativeObjectToString.call(value);
944
- }
945
-
946
- module.exports = objectToString;
947
-
948
-
949
- /***/ }),
950
- /* 31 */
951
- /***/ (function(module, exports) {
952
-
953
- /**
954
- * Checks if `value` is object-like. A value is object-like if it's not `null`
955
- * and has a `typeof` result of "object".
956
- *
957
- * @static
958
- * @memberOf _
959
- * @since 4.0.0
960
- * @category Lang
961
- * @param {*} value The value to check.
962
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
963
- * @example
964
- *
965
- * _.isObjectLike({});
966
- * // => true
967
- *
968
- * _.isObjectLike([1, 2, 3]);
969
- * // => true
970
- *
971
- * _.isObjectLike(_.noop);
972
- * // => false
973
- *
974
- * _.isObjectLike(null);
975
- * // => false
976
- */
977
- function isObjectLike(value) {
978
- return value != null && typeof value == 'object';
979
- }
980
-
981
- module.exports = isObjectLike;
982
-
983
-
984
- /***/ }),
985
- /* 32 */
986
- /***/ (function(module, exports) {
987
-
988
- module.exports = isPromise;
989
- module.exports.default = isPromise;
990
-
991
- function isPromise(obj) {
992
- return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
993
- }
994
-
995
-
996
- /***/ }),
997
- /* 33 */
998
- /***/ (function(module, exports, __webpack_require__) {
999
-
1000
- var before = __webpack_require__(34);
1001
-
1002
- /**
1003
- * Creates a function that is restricted to invoking `func` once. Repeat calls
1004
- * to the function return the value of the first invocation. The `func` is
1005
- * invoked with the `this` binding and arguments of the created function.
1006
- *
1007
- * @static
1008
- * @memberOf _
1009
- * @since 0.1.0
1010
- * @category Function
1011
- * @param {Function} func The function to restrict.
1012
- * @returns {Function} Returns the new restricted function.
1013
- * @example
1014
- *
1015
- * var initialize = _.once(createApplication);
1016
- * initialize();
1017
- * initialize();
1018
- * // => `createApplication` is invoked once
1019
- */
1020
- function once(func) {
1021
- return before(2, func);
1022
- }
1023
-
1024
- module.exports = once;
1025
-
1026
-
1027
- /***/ }),
1028
- /* 34 */
1029
- /***/ (function(module, exports, __webpack_require__) {
1030
-
1031
- var toInteger = __webpack_require__(35);
1032
-
1033
- /** Error message constants. */
1034
- var FUNC_ERROR_TEXT = 'Expected a function';
1035
-
1036
- /**
1037
- * Creates a function that invokes `func`, with the `this` binding and arguments
1038
- * of the created function, while it's called less than `n` times. Subsequent
1039
- * calls to the created function return the result of the last `func` invocation.
1040
- *
1041
- * @static
1042
- * @memberOf _
1043
- * @since 3.0.0
1044
- * @category Function
1045
- * @param {number} n The number of calls at which `func` is no longer invoked.
1046
- * @param {Function} func The function to restrict.
1047
- * @returns {Function} Returns the new restricted function.
1048
- * @example
1049
- *
1050
- * jQuery(element).on('click', _.before(5, addContactToList));
1051
- * // => Allows adding up to 4 contacts to the list.
1052
- */
1053
- function before(n, func) {
1054
- var result;
1055
- if (typeof func != 'function') {
1056
- throw new TypeError(FUNC_ERROR_TEXT);
1057
- }
1058
- n = toInteger(n);
1059
- return function() {
1060
- if (--n > 0) {
1061
- result = func.apply(this, arguments);
1062
- }
1063
- if (n <= 1) {
1064
- func = undefined;
1065
- }
1066
- return result;
1067
- };
1068
- }
1069
-
1070
- module.exports = before;
1071
-
1072
-
1073
- /***/ }),
1074
- /* 35 */
1075
- /***/ (function(module, exports, __webpack_require__) {
1076
-
1077
- var toFinite = __webpack_require__(36);
1078
-
1079
- /**
1080
- * Converts `value` to an integer.
1081
- *
1082
- * **Note:** This method is loosely based on
1083
- * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
1084
- *
1085
- * @static
1086
- * @memberOf _
1087
- * @since 4.0.0
1088
- * @category Lang
1089
- * @param {*} value The value to convert.
1090
- * @returns {number} Returns the converted integer.
1091
- * @example
1092
- *
1093
- * _.toInteger(3.2);
1094
- * // => 3
1095
- *
1096
- * _.toInteger(Number.MIN_VALUE);
1097
- * // => 0
1098
- *
1099
- * _.toInteger(Infinity);
1100
- * // => 1.7976931348623157e+308
1101
- *
1102
- * _.toInteger('3.2');
1103
- * // => 3
1104
- */
1105
- function toInteger(value) {
1106
- var result = toFinite(value),
1107
- remainder = result % 1;
1108
-
1109
- return result === result ? (remainder ? result - remainder : result) : 0;
1110
- }
1111
-
1112
- module.exports = toInteger;
1113
-
1114
-
1115
- /***/ }),
1116
- /* 36 */
1117
- /***/ (function(module, exports, __webpack_require__) {
1118
-
1119
- var toNumber = __webpack_require__(23);
1120
-
1121
- /** Used as references for various `Number` constants. */
1122
- var INFINITY = 1 / 0,
1123
- MAX_INTEGER = 1.7976931348623157e+308;
1124
-
1125
- /**
1126
- * Converts `value` to a finite number.
1127
- *
1128
- * @static
1129
- * @memberOf _
1130
- * @since 4.12.0
1131
- * @category Lang
1132
- * @param {*} value The value to convert.
1133
- * @returns {number} Returns the converted number.
1134
- * @example
1135
- *
1136
- * _.toFinite(3.2);
1137
- * // => 3.2
1138
- *
1139
- * _.toFinite(Number.MIN_VALUE);
1140
- * // => 5e-324
1141
- *
1142
- * _.toFinite(Infinity);
1143
- * // => 1.7976931348623157e+308
1144
- *
1145
- * _.toFinite('3.2');
1146
- * // => 3.2
1147
- */
1148
- function toFinite(value) {
1149
- if (!value) {
1150
- return value === 0 ? value : 0;
1151
- }
1152
- value = toNumber(value);
1153
- if (value === INFINITY || value === -INFINITY) {
1154
- var sign = (value < 0 ? -1 : 1);
1155
- return sign * MAX_INTEGER;
1156
- }
1157
- return value === value ? value : 0;
1158
- }
1159
-
1160
- module.exports = toFinite;
1161
-
1162
-
1163
- /***/ }),
1164
- /* 37 */
1165
- /***/ (function(module, exports) {
1166
-
1167
- /**
1168
- * This method returns the first argument it receives.
1169
- *
1170
- * @static
1171
- * @since 0.1.0
1172
- * @memberOf _
1173
- * @category Util
1174
- * @param {*} value Any value.
1175
- * @returns {*} Returns `value`.
1176
- * @example
1177
- *
1178
- * var object = { 'a': 1 };
1179
- *
1180
- * console.log(_.identity(object) === object);
1181
- * // => true
1182
- */
1183
- function identity(value) {
1184
- return value;
1185
- }
1186
-
1187
- module.exports = identity;
1188
-
1189
-
1190
- /***/ }),
1191
- /* 38 */
1192
- /***/ (function(module, exports) {
1193
-
1194
- /**
1195
- * Creates a function that returns `value`.
1196
- *
1197
- * @static
1198
- * @memberOf _
1199
- * @since 2.4.0
1200
- * @category Util
1201
- * @param {*} value The value to return from the new function.
1202
- * @returns {Function} Returns the new constant function.
1203
- * @example
1204
- *
1205
- * var objects = _.times(2, _.constant({ 'a': 1 }));
1206
- *
1207
- * console.log(objects);
1208
- * // => [{ 'a': 1 }, { 'a': 1 }]
1209
- *
1210
- * console.log(objects[0] === objects[1]);
1211
- * // => true
1212
- */
1213
- function constant(value) {
1214
- return function() {
1215
- return value;
1216
- };
1217
- }
1218
-
1219
- module.exports = constant;
1220
-
1221
-
1222
- /***/ }),
1223
- /* 39 */
1224
- /***/ (function(module, exports) {
1225
-
1226
- /**
1227
- * Gets the last element of `array`.
1228
- *
1229
- * @static
1230
- * @memberOf _
1231
- * @since 0.1.0
1232
- * @category Array
1233
- * @param {Array} array The array to query.
1234
- * @returns {*} Returns the last element of `array`.
1235
- * @example
1236
- *
1237
- * _.last([1, 2, 3]);
1238
- * // => 3
1239
- */
1240
- function last(array) {
1241
- var length = array == null ? 0 : array.length;
1242
- return length ? array[length - 1] : undefined;
1243
- }
1244
-
1245
- module.exports = last;
1246
-
1247
-
1248
- /***/ }),
1249
- /* 40 */
1250
- /***/ (function(module, exports) {
1251
-
1252
- var nestRE = /^(attrs|props|on|nativeOn|class|style|hook)$/
1253
-
1254
- module.exports = function mergeJSXProps (objs) {
1255
- return objs.reduce(function (a, b) {
1256
- var aa, bb, key, nestedKey, temp
1257
- for (key in b) {
1258
- aa = a[key]
1259
- bb = b[key]
1260
- if (aa && nestRE.test(key)) {
1261
- // normalize class
1262
- if (key === 'class') {
1263
- if (typeof aa === 'string') {
1264
- temp = aa
1265
- a[key] = aa = {}
1266
- aa[temp] = true
1267
- }
1268
- if (typeof bb === 'string') {
1269
- temp = bb
1270
- b[key] = bb = {}
1271
- bb[temp] = true
1272
- }
1273
- }
1274
- if (key === 'on' || key === 'nativeOn' || key === 'hook') {
1275
- // merge functions
1276
- for (nestedKey in bb) {
1277
- aa[nestedKey] = mergeFn(aa[nestedKey], bb[nestedKey])
1278
- }
1279
- } else if (Array.isArray(aa)) {
1280
- a[key] = aa.concat(bb)
1281
- } else if (Array.isArray(bb)) {
1282
- a[key] = [aa].concat(bb)
1283
- } else {
1284
- for (nestedKey in bb) {
1285
- aa[nestedKey] = bb[nestedKey]
1286
- }
1287
- }
1288
- } else {
1289
- a[key] = b[key]
1290
- }
1291
- }
1292
- return a
1293
- }, {})
1294
- }
1295
-
1296
- function mergeFn (a, b) {
1297
- return function () {
1298
- a && a.apply(this, arguments)
1299
- b && b.apply(this, arguments)
1300
- }
1301
- }
1302
-
1303
-
1304
- /***/ }),
1305
- /* 41 */
1306
- /***/ (function(module, exports, __webpack_require__) {
1307
-
1308
- // extracted by mini-css-extract-plugin
1309
-
1310
- /***/ }),
1311
- /* 42 */
1312
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1313
-
1314
- "use strict";
1315
- // ESM COMPAT FLAG
1316
- __webpack_require__.r(__webpack_exports__);
1317
-
1318
- // EXPORTS
1319
- __webpack_require__.d(__webpack_exports__, "Treeselect", function() { return /* reexport */ Treeselect; });
1320
- __webpack_require__.d(__webpack_exports__, "LOAD_ROOT_OPTIONS", function() { return /* reexport */ LOAD_ROOT_OPTIONS; });
1321
- __webpack_require__.d(__webpack_exports__, "LOAD_CHILDREN_OPTIONS", function() { return /* reexport */ LOAD_CHILDREN_OPTIONS; });
1322
- __webpack_require__.d(__webpack_exports__, "ASYNC_SEARCH", function() { return /* reexport */ ASYNC_SEARCH; });
1323
- __webpack_require__.d(__webpack_exports__, "VERSION", function() { return /* binding */ VERSION; });
1324
-
1325
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
1326
- var slicedToArray = __webpack_require__(0);
1327
- var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
1328
-
1329
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
1330
- var toConsumableArray = __webpack_require__(6);
1331
- var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
1332
-
1333
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
1334
- var defineProperty = __webpack_require__(10);
1335
- var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
1336
-
1337
- // EXTERNAL MODULE: ./node_modules/fuzzysearch/index.js
1338
- var fuzzysearch = __webpack_require__(14);
1339
- var fuzzysearch_default = /*#__PURE__*/__webpack_require__.n(fuzzysearch);
1340
-
1341
- // EXTERNAL MODULE: external "Vue"
1342
- var external_Vue_ = __webpack_require__(15);
1343
-
1344
- // EXTERNAL MODULE: ./node_modules/lodash/noop.js
1345
- var noop = __webpack_require__(16);
1346
-
1347
- // CONCATENATED MODULE: ./src/utils/noop.js
1348
-
1349
- // CONCATENATED MODULE: ./src/utils/warning.js
1350
-
1351
-
1352
- var warning_warning = false ? undefined : function warning(checker, complainer) {
1353
- if (!checker()) {
1354
- var _console;
1355
- var message = ['[Rp-Treeselect Warning]'].concat(complainer());
1356
- (_console = console).error.apply(_console, toConsumableArray_default()(message));
1357
- }
1358
- };
1359
- // CONCATENATED MODULE: ./src/utils/onLeftClick.js
1360
- function onLeftClick(mouseDownHandler) {
1361
- return function onMouseDown(evt) {
1362
- if (evt.type === 'mousedown' && evt.button === 0) {
1363
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1364
- args[_key - 1] = arguments[_key];
1365
- }
1366
- mouseDownHandler.call.apply(mouseDownHandler, [this, evt].concat(args));
1367
- }
1368
- };
1369
- }
1370
- // CONCATENATED MODULE: ./src/utils/scrollIntoView.js
1371
- function scrollIntoView($scrollingEl, $focusedEl) {
1372
- var scrollingReact = $scrollingEl.getBoundingClientRect();
1373
- var focusedRect = $focusedEl.getBoundingClientRect();
1374
- var overScroll = $focusedEl.offsetHeight / 3;
1375
- if (focusedRect.bottom + overScroll > scrollingReact.bottom) {
1376
- $scrollingEl.scrollTop = Math.min($focusedEl.offsetTop + $focusedEl.clientHeight - $scrollingEl.offsetHeight + overScroll, $scrollingEl.scrollHeight);
1377
- } else if (focusedRect.top - overScroll < scrollingReact.top) {
1378
- $scrollingEl.scrollTop = Math.max($focusedEl.offsetTop - overScroll, 0);
1379
- }
1380
- }
1381
- // EXTERNAL MODULE: ./node_modules/lodash/debounce.js
1382
- var debounce = __webpack_require__(17);
1383
- var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
1384
-
1385
- // CONCATENATED MODULE: ./src/utils/debounce.js
1386
-
1387
- // CONCATENATED MODULE: ./node_modules/watch-size/index.es.mjs
1388
- var index_es_index = (function (element, listener) {
1389
- var expand = document.createElement('_');
1390
- var shrink = expand.appendChild(document.createElement('_'));
1391
- var expandChild = expand.appendChild(document.createElement('_'));
1392
- var shrinkChild = shrink.appendChild(document.createElement('_'));
1393
-
1394
- var lastWidth = void 0,
1395
- lastHeight = void 0;
1396
-
1397
- 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';
1398
- shrinkChild.style.cssText = expandChild.style.cssText = 'display:block;height:100%;transition:0s;width:100%';
1399
- shrinkChild.style.width = shrinkChild.style.height = '200%';
1400
-
1401
- element.appendChild(expand);
1402
-
1403
- test();
1404
-
1405
- return stop;
1406
-
1407
- function test() {
1408
- unbind();
1409
-
1410
- var width = element.offsetWidth;
1411
- var height = element.offsetHeight;
1412
-
1413
- if (width !== lastWidth || height !== lastHeight) {
1414
- lastWidth = width;
1415
- lastHeight = height;
1416
-
1417
- expandChild.style.width = width * 2 + 'px';
1418
- expandChild.style.height = height * 2 + 'px';
1419
-
1420
- expand.scrollLeft = expand.scrollWidth;
1421
- expand.scrollTop = expand.scrollHeight;
1422
- shrink.scrollLeft = shrink.scrollWidth;
1423
- shrink.scrollTop = shrink.scrollHeight;
1424
-
1425
- listener({ width: width, height: height });
1426
- }
1427
-
1428
- shrink.addEventListener('scroll', test);
1429
- expand.addEventListener('scroll', test);
1430
- }
1431
-
1432
- function unbind() {
1433
- shrink.removeEventListener('scroll', test);
1434
- expand.removeEventListener('scroll', test);
1435
- }
1436
-
1437
- function stop() {
1438
- unbind();
1439
-
1440
- element.removeChild(expand);
1441
- }
1442
- });
1443
-
1444
- /* harmony default export */ var index_es = (index_es_index);
1445
-
1446
- // CONCATENATED MODULE: ./src/utils/removeFromArray.js
1447
- function removeFromArray(arr, elem) {
1448
- var idx = arr.indexOf(elem);
1449
- if (idx !== -1) arr.splice(idx, 1);
1450
- }
1451
- // CONCATENATED MODULE: ./src/utils/watchSize.js
1452
-
1453
-
1454
- var intervalId;
1455
- var registered = [];
1456
- var INTERVAL_DURATION = 100;
1457
- function run() {
1458
- intervalId = setInterval(function () {
1459
- registered.forEach(test);
1460
- }, INTERVAL_DURATION);
1461
- }
1462
- function stop() {
1463
- clearInterval(intervalId);
1464
- intervalId = null;
1465
- }
1466
- function test(item) {
1467
- var $el = item.$el,
1468
- listener = item.listener,
1469
- lastWidth = item.lastWidth,
1470
- lastHeight = item.lastHeight;
1471
- var width = $el.offsetWidth;
1472
- var height = $el.offsetHeight;
1473
- if (lastWidth !== width || lastHeight !== height) {
1474
- item.lastWidth = width;
1475
- item.lastHeight = height;
1476
- listener({
1477
- width: width,
1478
- height: height
1479
- });
1480
- }
1481
- }
1482
- function watchSizeForIE9($el, listener) {
1483
- var item = {
1484
- $el: $el,
1485
- listener: listener,
1486
- lastWidth: null,
1487
- lastHeight: null
1488
- };
1489
- var unwatch = function unwatch() {
1490
- removeFromArray(registered, item);
1491
- if (!registered.length) stop();
1492
- };
1493
- registered.push(item);
1494
- test(item);
1495
- run();
1496
- return unwatch;
1497
- }
1498
- function watchSize($el, listener) {
1499
- var isIE9 = document.documentMode === 9;
1500
- var locked = true;
1501
- var wrappedListener = function wrappedListener() {
1502
- return locked || listener.apply(void 0, arguments);
1503
- };
1504
- var implementation = isIE9 ? watchSizeForIE9 : index_es;
1505
- var removeSizeWatcher = implementation($el, wrappedListener);
1506
- locked = false;
1507
- return removeSizeWatcher;
1508
- }
1509
- // CONCATENATED MODULE: ./src/utils/setupResizeAndScrollEventListeners.js
1510
- function findScrollParents($el) {
1511
- var $scrollParents = [];
1512
- var $parent = $el.parentNode;
1513
- while ($parent && $parent.nodeName !== 'BODY' && $parent.nodeType === document.ELEMENT_NODE) {
1514
- if (isScrollElment($parent)) $scrollParents.push($parent);
1515
- $parent = $parent.parentNode;
1516
- }
1517
- $scrollParents.push(window);
1518
- return $scrollParents;
1519
- }
1520
- function isScrollElment($el) {
1521
- var _getComputedStyle = getComputedStyle($el),
1522
- overflow = _getComputedStyle.overflow,
1523
- overflowX = _getComputedStyle.overflowX,
1524
- overflowY = _getComputedStyle.overflowY;
1525
- return /(auto|scroll|overlay)/.test(overflow + overflowY + overflowX);
1526
- }
1527
- function setupResizeAndScrollEventListeners($el, listener) {
1528
- var $scrollParents = findScrollParents($el);
1529
- window.addEventListener('resize', listener, {
1530
- passive: true
1531
- });
1532
- $scrollParents.forEach(function (scrollParent) {
1533
- scrollParent.addEventListener('scroll', listener, {
1534
- passive: true
1535
- });
1536
- });
1537
- return function removeEventListeners() {
1538
- window.removeEventListener('resize', listener, {
1539
- passive: true
1540
- });
1541
- $scrollParents.forEach(function ($scrollParent) {
1542
- $scrollParent.removeEventListener('scroll', listener, {
1543
- passive: true
1544
- });
1545
- });
1546
- };
1547
- }
1548
- // CONCATENATED MODULE: ./src/utils/isNaN.js
1549
- function isNaN_isNaN(x) {
1550
- return x !== x;
1551
- }
1552
- // EXTERNAL MODULE: ./node_modules/is-promise/index.js
1553
- var is_promise = __webpack_require__(32);
1554
- var is_promise_default = /*#__PURE__*/__webpack_require__.n(is_promise);
1555
-
1556
- // CONCATENATED MODULE: ./src/utils/isPromise.js
1557
-
1558
- // EXTERNAL MODULE: ./node_modules/lodash/once.js
1559
- var once = __webpack_require__(33);
1560
- var once_default = /*#__PURE__*/__webpack_require__.n(once);
1561
-
1562
- // CONCATENATED MODULE: ./src/utils/once.js
1563
-
1564
- // EXTERNAL MODULE: ./node_modules/lodash/identity.js
1565
- var identity = __webpack_require__(37);
1566
- var identity_default = /*#__PURE__*/__webpack_require__.n(identity);
1567
-
1568
- // CONCATENATED MODULE: ./src/utils/identity.js
1569
-
1570
- // EXTERNAL MODULE: ./node_modules/lodash/constant.js
1571
- var constant = __webpack_require__(38);
1572
- var constant_default = /*#__PURE__*/__webpack_require__.n(constant);
1573
-
1574
- // CONCATENATED MODULE: ./src/utils/constant.js
1575
-
1576
- // CONCATENATED MODULE: ./src/utils/createMap.js
1577
- var createMap = function createMap() {
1578
- return Object.create(null);
1579
- };
1580
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/typeof.js
1581
- var helpers_typeof = __webpack_require__(12);
1582
- var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof);
1583
-
1584
- // CONCATENATED MODULE: ./src/utils/deepExtend.js
1585
-
1586
- function isPlainObject(value) {
1587
- if (value == null || typeof_default()(value) !== 'object') return false;
1588
- return Object.getPrototypeOf(value) === Object.prototype;
1589
- }
1590
- function copy(obj, key, value) {
1591
- if (isPlainObject(value)) {
1592
- obj[key] || (obj[key] = {});
1593
- deepExtend(obj[key], value);
1594
- } else {
1595
- obj[key] = value;
1596
- }
1597
- }
1598
- function deepExtend(target, source) {
1599
- if (isPlainObject(source)) {
1600
- var keys = Object.keys(source);
1601
- for (var i = 0, len = keys.length; i < len; i++) {
1602
- copy(target, keys[i], source[keys[i]]);
1603
- }
1604
- }
1605
- return target;
1606
- }
1607
- // EXTERNAL MODULE: ./node_modules/lodash/last.js
1608
- var lodash_last = __webpack_require__(39);
1609
- var last_default = /*#__PURE__*/__webpack_require__.n(lodash_last);
1610
-
1611
- // CONCATENATED MODULE: ./src/utils/last.js
1612
-
1613
- // CONCATENATED MODULE: ./src/utils/includes.js
1614
- function includes(arrOrStr, elem) {
1615
- return arrOrStr.indexOf(elem) !== -1;
1616
- }
1617
- // CONCATENATED MODULE: ./src/utils/find.js
1618
- function find(arr, predicate, ctx) {
1619
- for (var i = 0, len = arr.length; i < len; i++) {
1620
- if (predicate.call(ctx, arr[i], i, arr)) return arr[i];
1621
- }
1622
- return undefined;
1623
- }
1624
- // CONCATENATED MODULE: ./src/utils/quickDiff.js
1625
- function quickDiff(arrA, arrB) {
1626
- if (arrA.length !== arrB.length) return true;
1627
- for (var i = 0; i < arrA.length; i++) {
1628
- if (arrA[i] !== arrB[i]) return true;
1629
- }
1630
- return false;
1631
- }
1632
- // CONCATENATED MODULE: ./src/utils/index.js
1633
-
1634
-
1635
-
1636
-
1637
-
1638
-
1639
-
1640
-
1641
-
1642
-
1643
-
1644
-
1645
-
1646
-
1647
-
1648
-
1649
-
1650
-
1651
-
1652
- // CONCATENATED MODULE: ./src/constants.js
1653
- var NO_PARENT_NODE = null;
1654
- var UNCHECKED = 0;
1655
- var INDETERMINATE = 1;
1656
- var CHECKED = 2;
1657
- var ALL_CHILDREN = 'ALL_CHILDREN';
1658
- var ALL_DESCENDANTS = 'ALL_DESCENDANTS';
1659
- var LEAF_CHILDREN = 'LEAF_CHILDREN';
1660
- var LEAF_DESCENDANTS = 'LEAF_DESCENDANTS';
1661
- var LOAD_ROOT_OPTIONS = 'LOAD_ROOT_OPTIONS';
1662
- var LOAD_CHILDREN_OPTIONS = 'LOAD_CHILDREN_OPTIONS';
1663
- var ASYNC_SEARCH = 'ASYNC_SEARCH';
1664
- var ALL = 'ALL';
1665
- var BRANCH_PRIORITY = 'BRANCH_PRIORITY';
1666
- var LEAF_PRIORITY = 'LEAF_PRIORITY';
1667
- var ALL_WITH_INDETERMINATE = 'ALL_WITH_INDETERMINATE';
1668
- var ORDER_SELECTED = 'ORDER_SELECTED';
1669
- var LEVEL = 'LEVEL';
1670
- var INDEX = 'INDEX';
1671
- var KEY_CODES = {
1672
- BACKSPACE: 8,
1673
- ENTER: 13,
1674
- ESCAPE: 27,
1675
- END: 35,
1676
- HOME: 36,
1677
- ARROW_LEFT: 37,
1678
- ARROW_UP: 38,
1679
- ARROW_RIGHT: 39,
1680
- ARROW_DOWN: 40,
1681
- DELETE: 46
1682
- };
1683
- var INPUT_DEBOUNCE_DELAY = false ? undefined : 200;
1684
- var MIN_INPUT_WIDTH = 5;
1685
- var MENU_BUFFER = 40;
1686
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/HiddenFields.vue?vue&type=script&lang=js
1687
-
1688
-
1689
- function stringifyValue(value) {
1690
- if (typeof value === 'string') return value;
1691
- if (value != null && !isNaN_isNaN(value)) return JSON.stringify(value);
1692
- return '';
1693
- }
1694
- /* harmony default export */ var HiddenFieldsvue_type_script_lang_js = ({
1695
- name: 'rp-treeselect--hidden-fields',
1696
- setup: function setup() {
1697
- var instance = Object(external_Vue_["inject"])('instance');
1698
- return {
1699
- instance: instance
1700
- };
1701
- },
1702
- render: function render() {
1703
- var _this = this;
1704
- var h = arguments[0];
1705
- if (!this.instance.name || this.instance.disabled || !this.instance.hasValue) return null;
1706
- var stringifiedValues = this.instance.internalValue.map(stringifyValue);
1707
- if (this.instance.multiple && this.instance.joinValues) stringifiedValues = [stringifiedValues.join(this.instance.delimiter)];
1708
- return stringifiedValues.map(function (stringifiedValue, i) {
1709
- return h("input", {
1710
- attrs: {
1711
- type: "hidden",
1712
- name: _this.instance.name
1713
- },
1714
- domProps: {
1715
- "value": stringifiedValue
1716
- },
1717
- key: 'hidden-field-' + i
1718
- });
1719
- });
1720
- }
1721
- });
1722
- // CONCATENATED MODULE: ./src/components/HiddenFields.vue?vue&type=script&lang=js
1723
- /* harmony default export */ var components_HiddenFieldsvue_type_script_lang_js = (HiddenFieldsvue_type_script_lang_js);
1724
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
1725
- /* globals __VUE_SSR_CONTEXT__ */
1726
-
1727
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
1728
- // This module is a runtime utility for cleaner component module output and will
1729
- // be included in the final webpack user bundle.
1730
-
1731
- function normalizeComponent(
1732
- scriptExports,
1733
- render,
1734
- staticRenderFns,
1735
- functionalTemplate,
1736
- injectStyles,
1737
- scopeId,
1738
- moduleIdentifier /* server only */,
1739
- shadowMode /* vue-cli only */
1740
- ) {
1741
- // Vue.extend constructor export interop
1742
- var options =
1743
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
1744
-
1745
- // render functions
1746
- if (render) {
1747
- options.render = render
1748
- options.staticRenderFns = staticRenderFns
1749
- options._compiled = true
1750
- }
1751
-
1752
- // functional template
1753
- if (functionalTemplate) {
1754
- options.functional = true
1755
- }
1756
-
1757
- // scopedId
1758
- if (scopeId) {
1759
- options._scopeId = 'data-v-' + scopeId
1760
- }
1761
-
1762
- var hook
1763
- if (moduleIdentifier) {
1764
- // server build
1765
- hook = function (context) {
1766
- // 2.3 injection
1767
- context =
1768
- context || // cached call
1769
- (this.$vnode && this.$vnode.ssrContext) || // stateful
1770
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
1771
- // 2.2 with runInNewContext: true
1772
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
1773
- context = __VUE_SSR_CONTEXT__
1774
- }
1775
- // inject component styles
1776
- if (injectStyles) {
1777
- injectStyles.call(this, context)
1778
- }
1779
- // register component module identifier for async chunk inferrence
1780
- if (context && context._registeredComponents) {
1781
- context._registeredComponents.add(moduleIdentifier)
1782
- }
1783
- }
1784
- // used by ssr in case component is cached and beforeCreate
1785
- // never gets called
1786
- options._ssrRegister = hook
1787
- } else if (injectStyles) {
1788
- hook = shadowMode
1789
- ? function () {
1790
- injectStyles.call(
1791
- this,
1792
- (options.functional ? this.parent : this).$root.$options.shadowRoot
1793
- )
1794
- }
1795
- : injectStyles
1796
- }
1797
-
1798
- if (hook) {
1799
- if (options.functional) {
1800
- // for template-only hot-reload because in that case the render fn doesn't
1801
- // go through the normalizer
1802
- options._injectStyles = hook
1803
- // register for functional component in vue file
1804
- var originalRender = options.render
1805
- options.render = function renderWithStyleInjection(h, context) {
1806
- hook.call(context)
1807
- return originalRender(h, context)
1808
- }
1809
- } else {
1810
- // inject component registration as beforeCreate hook
1811
- var existing = options.beforeCreate
1812
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
1813
- }
1814
- }
1815
-
1816
- return {
1817
- exports: scriptExports,
1818
- options: options
1819
- }
1820
- }
1821
-
1822
- // CONCATENATED MODULE: ./src/components/HiddenFields.vue
1823
- var HiddenFields_render, staticRenderFns
1824
-
1825
-
1826
-
1827
-
1828
- /* normalize component */
1829
-
1830
- var component = normalizeComponent(
1831
- components_HiddenFieldsvue_type_script_lang_js,
1832
- HiddenFields_render,
1833
- staticRenderFns,
1834
- false,
1835
- null,
1836
- null,
1837
- null
1838
-
1839
- )
1840
-
1841
- /* harmony default export */ var HiddenFields = (component.exports);
1842
- // EXTERNAL MODULE: ./node_modules/babel-helper-vue-jsx-merge-props/index.js
1843
- var babel_helper_vue_jsx_merge_props = __webpack_require__(40);
1844
- var babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(babel_helper_vue_jsx_merge_props);
1845
-
1846
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Input.vue?vue&type=script&lang=js
1847
-
1848
-
1849
-
1850
-
1851
- var keysThatRequireMenuBeingOpen = [KEY_CODES.ENTER, KEY_CODES.END, KEY_CODES.HOME, KEY_CODES.ARROW_LEFT, KEY_CODES.ARROW_UP, KEY_CODES.ARROW_RIGHT, KEY_CODES.ARROW_DOWN];
1852
- /* harmony default export */ var Inputvue_type_script_lang_js = ({
1853
- name: 'rp-treeselect--input',
1854
- setup: function setup() {
1855
- var instance = Object(external_Vue_["inject"])('instance');
1856
- return {
1857
- instance: instance
1858
- };
1859
- },
1860
- data: function data() {
1861
- return {
1862
- inputWidth: MIN_INPUT_WIDTH,
1863
- value: ''
1864
- };
1865
- },
1866
- computed: {
1867
- needAutoSize: function needAutoSize() {
1868
- var instance = this.instance;
1869
- return instance.searchable && !instance.disabled && instance.multiple;
1870
- },
1871
- inputStyle: function inputStyle() {
1872
- return {
1873
- width: this.needAutoSize ? "".concat(this.inputWidth, "px") : null
1874
- };
1875
- }
1876
- },
1877
- watch: {
1878
- 'instance.trigger.searchQuery': function instanceTriggerSearchQuery(newValue) {
1879
- this.value = newValue;
1880
- },
1881
- value: function value() {
1882
- if (this.needAutoSize) this.$nextTick(this.updateInputWidth);
1883
- }
1884
- },
1885
- created: function created() {
1886
- this.debouncedCallback = debounce_default()(this.updateSearchQuery, INPUT_DEBOUNCE_DELAY, {
1887
- leading: true,
1888
- trailing: true
1889
- });
1890
- },
1891
- methods: {
1892
- clear: function clear() {
1893
- this.onInput({
1894
- target: {
1895
- value: ''
1896
- }
1897
- });
1898
- },
1899
- focus: function focus() {
1900
- var instance = this.instance;
1901
- if (!instance.disabled) {
1902
- this.$refs.input && this.$refs.input.focus();
1903
- }
1904
- },
1905
- blur: function blur() {
1906
- this.$refs.input && this.$refs.input.blur();
1907
- },
1908
- onFocus: function onFocus() {
1909
- var instance = this.instance;
1910
- instance.trigger.isFocused = true;
1911
- if (instance.openOnFocus) instance.openMenu();
1912
- },
1913
- onBlur: function onBlur() {
1914
- var instance = this.instance;
1915
- var menu = instance.getMenu();
1916
- if (menu && document.activeElement === menu) {
1917
- return this.focus();
1918
- }
1919
- instance.trigger.isFocused = false;
1920
- instance.closeMenu();
1921
- },
1922
- onInput: function onInput(evt) {
1923
- var value = evt.target.value;
1924
- this.value = value;
1925
- if (value) {
1926
- this.debouncedCallback();
1927
- } else {
1928
- this.debouncedCallback.cancel();
1929
- this.updateSearchQuery();
1930
- }
1931
- },
1932
- onKeyDown: function onKeyDown(evt) {
1933
- var instance = this.instance;
1934
- var key = 'which' in evt ? evt.which : evt.keyCode;
1935
- if (evt.ctrlKey || evt.shiftKey || evt.altKey || evt.metaKey) return;
1936
- if (!instance.menu.isOpen && includes(keysThatRequireMenuBeingOpen, key)) {
1937
- evt.preventDefault();
1938
- return instance.openMenu();
1939
- }
1940
- switch (key) {
1941
- case KEY_CODES.BACKSPACE:
1942
- {
1943
- if (instance.backspaceRemoves && !this.value.length) {
1944
- instance.removeLastValue();
1945
- }
1946
- break;
1947
- }
1948
- case KEY_CODES.ENTER:
1949
- {
1950
- evt.preventDefault();
1951
- if (instance.menu.current === null) return;
1952
- var current = instance.getNode(instance.menu.current);
1953
- if (current.isBranch && instance.disableBranchNodes) return;
1954
- instance.select(current);
1955
- break;
1956
- }
1957
- case KEY_CODES.ESCAPE:
1958
- {
1959
- if (this.value.length) {
1960
- this.clear();
1961
- } else if (instance.menu.isOpen) {
1962
- instance.closeMenu();
1963
- }
1964
- break;
1965
- }
1966
- case KEY_CODES.END:
1967
- {
1968
- evt.preventDefault();
1969
- instance.highlightLastOption();
1970
- break;
1971
- }
1972
- case KEY_CODES.HOME:
1973
- {
1974
- evt.preventDefault();
1975
- instance.highlightFirstOption();
1976
- break;
1977
- }
1978
- case KEY_CODES.ARROW_LEFT:
1979
- {
1980
- var _current = instance.getNode(instance.menu.current);
1981
- if (_current.isBranch && instance.shouldExpand(_current)) {
1982
- evt.preventDefault();
1983
- instance.toggleExpanded(_current);
1984
- } else if (!_current.isRootNode && (_current.isLeaf || _current.isBranch && !instance.shouldExpand(_current))) {
1985
- evt.preventDefault();
1986
- instance.setCurrentHighlightedOption(_current.parentNode);
1987
- }
1988
- break;
1989
- }
1990
- case KEY_CODES.ARROW_UP:
1991
- {
1992
- evt.preventDefault();
1993
- instance.highlightPrevOption();
1994
- break;
1995
- }
1996
- case KEY_CODES.ARROW_RIGHT:
1997
- {
1998
- var _current2 = instance.getNode(instance.menu.current);
1999
- if (_current2.isBranch && !instance.shouldExpand(_current2)) {
2000
- evt.preventDefault();
2001
- instance.toggleExpanded(_current2);
2002
- }
2003
- break;
2004
- }
2005
- case KEY_CODES.ARROW_DOWN:
2006
- {
2007
- evt.preventDefault();
2008
- instance.highlightNextOption();
2009
- break;
2010
- }
2011
- case KEY_CODES.DELETE:
2012
- {
2013
- if (instance.deleteRemoves && !this.value.length) {
2014
- instance.removeLastValue();
2015
- }
2016
- break;
2017
- }
2018
- default:
2019
- {
2020
- instance.openMenu();
2021
- }
2022
- }
2023
- },
2024
- onMouseDown: function onMouseDown(evt) {
2025
- if (this.value.length) {
2026
- evt.stopPropagation();
2027
- }
2028
- },
2029
- renderInputContainer: function renderInputContainer() {
2030
- var h = this.$createElement;
2031
- var instance = this.instance;
2032
- var props = {};
2033
- var children = [];
2034
- if (instance.searchable && !instance.disabled) {
2035
- children.push(this.renderInput());
2036
- if (this.needAutoSize) children.push(this.renderSizer());
2037
- }
2038
- if (!instance.searchable) {
2039
- deepExtend(props, {
2040
- on: {
2041
- focus: this.onFocus,
2042
- blur: this.onBlur,
2043
- keydown: this.onKeyDown
2044
- },
2045
- ref: 'input'
2046
- });
2047
- }
2048
- if (!instance.searchable && !instance.disabled) {
2049
- deepExtend(props, {
2050
- attrs: {
2051
- tabIndex: instance.tabIndex
2052
- }
2053
- });
2054
- }
2055
- return h("div", babel_helper_vue_jsx_merge_props_default()([{
2056
- "class": "rp-treeselect__input-container"
2057
- }, props]), [children]);
2058
- },
2059
- renderInput: function renderInput() {
2060
- var h = this.$createElement;
2061
- var instance = this.instance;
2062
- return h("input", {
2063
- ref: "input",
2064
- "class": "rp-treeselect__input",
2065
- attrs: {
2066
- type: "text",
2067
- autocomplete: "off",
2068
- tabIndex: instance.tabIndex,
2069
- required: instance.required && !instance.hasValue
2070
- },
2071
- domProps: {
2072
- "value": this.value
2073
- },
2074
- style: this.inputStyle,
2075
- on: {
2076
- "focus": this.onFocus,
2077
- "input": this.onInput,
2078
- "blur": this.onBlur,
2079
- "keydown": this.onKeyDown,
2080
- "mousedown": this.onMouseDown
2081
- }
2082
- });
2083
- },
2084
- renderSizer: function renderSizer() {
2085
- var h = this.$createElement;
2086
- return h("div", {
2087
- ref: "sizer",
2088
- "class": "rp-treeselect__sizer"
2089
- }, [this.value]);
2090
- },
2091
- updateInputWidth: function updateInputWidth() {
2092
- this.inputWidth = Math.max(MIN_INPUT_WIDTH, this.$refs.sizer.scrollWidth + 15);
2093
- },
2094
- updateSearchQuery: function updateSearchQuery() {
2095
- var instance = this.instance;
2096
- instance.trigger.searchQuery = this.value;
2097
- }
2098
- },
2099
- render: function render() {
2100
- return this.renderInputContainer();
2101
- }
2102
- });
2103
- // CONCATENATED MODULE: ./src/components/Input.vue?vue&type=script&lang=js
2104
- /* harmony default export */ var components_Inputvue_type_script_lang_js = (Inputvue_type_script_lang_js);
2105
- // CONCATENATED MODULE: ./src/components/Input.vue
2106
- var Input_render, Input_staticRenderFns
2107
-
2108
-
2109
-
2110
-
2111
- /* normalize component */
2112
-
2113
- var Input_component = normalizeComponent(
2114
- components_Inputvue_type_script_lang_js,
2115
- Input_render,
2116
- Input_staticRenderFns,
2117
- false,
2118
- null,
2119
- null,
2120
- null
2121
-
2122
- )
2123
-
2124
- /* hot reload */
2125
- if (false) { var api; }
2126
- Input_component.options.__file = "src/components/Input.vue"
2127
- /* harmony default export */ var Input = (Input_component.exports);
2128
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Placeholder.vue?vue&type=script&lang=js
2129
-
2130
- /* harmony default export */ var Placeholdervue_type_script_lang_js = ({
2131
- name: 'rp-treeselect--placeholder',
2132
- setup: function setup() {
2133
- var instance = Object(external_Vue_["inject"])('instance');
2134
- return {
2135
- instance: instance
2136
- };
2137
- },
2138
- render: function render() {
2139
- var h = arguments[0];
2140
- var instance = this.instance;
2141
- var placeholderClass = {
2142
- 'rp-treeselect__placeholder': true,
2143
- 'rp-treeselect-helper-zoom-effect-off': true,
2144
- 'rp-treeselect-helper-hide': instance.hasValue || instance.trigger.searchQuery
2145
- };
2146
- return h("div", {
2147
- "class": placeholderClass
2148
- }, [instance.placeholder]);
2149
- }
2150
- });
2151
- // CONCATENATED MODULE: ./src/components/Placeholder.vue?vue&type=script&lang=js
2152
- /* harmony default export */ var components_Placeholdervue_type_script_lang_js = (Placeholdervue_type_script_lang_js);
2153
- // CONCATENATED MODULE: ./src/components/Placeholder.vue
2154
- var Placeholder_render, Placeholder_staticRenderFns
2155
-
2156
-
2157
-
2158
-
2159
- /* normalize component */
2160
-
2161
- var Placeholder_component = normalizeComponent(
2162
- components_Placeholdervue_type_script_lang_js,
2163
- Placeholder_render,
2164
- Placeholder_staticRenderFns,
2165
- false,
2166
- null,
2167
- null,
2168
- null
2169
-
2170
- )
2171
-
2172
- /* harmony default export */ var Placeholder = (Placeholder_component.exports);
2173
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/SingleValue.vue?vue&type=script&lang=js
2174
-
2175
-
2176
-
2177
- /* harmony default export */ var SingleValuevue_type_script_lang_js = ({
2178
- name: 'rp-treeselect--single-value',
2179
- setup: function setup() {
2180
- var instance = Object(external_Vue_["inject"])('instance');
2181
- return {
2182
- instance: instance
2183
- };
2184
- },
2185
- methods: {
2186
- renderSingleValueLabel: function renderSingleValueLabel() {
2187
- var instance = this.instance;
2188
- var node = instance.selectedNodes[0];
2189
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
2190
- return customValueLabelRenderer ? customValueLabelRenderer({
2191
- node: node
2192
- }) : node.label;
2193
- }
2194
- },
2195
- render: function render() {
2196
- var h = arguments[0];
2197
- var instance = this.instance,
2198
- renderValueContainer = this.$parent.renderValueContainer;
2199
- var shouldShowValue = instance.hasValue && !instance.trigger.searchQuery;
2200
- return renderValueContainer([shouldShowValue && h("div", {
2201
- "class": "rp-treeselect__single-value"
2202
- }, [this.renderSingleValueLabel()]), h(Placeholder), h(Input, {
2203
- ref: "input"
2204
- })]);
2205
- }
2206
- });
2207
- // CONCATENATED MODULE: ./src/components/SingleValue.vue?vue&type=script&lang=js
2208
- /* harmony default export */ var components_SingleValuevue_type_script_lang_js = (SingleValuevue_type_script_lang_js);
2209
- // CONCATENATED MODULE: ./src/components/SingleValue.vue
2210
- var SingleValue_render, SingleValue_staticRenderFns
2211
-
2212
-
2213
-
2214
-
2215
- /* normalize component */
2216
-
2217
- var SingleValue_component = normalizeComponent(
2218
- components_SingleValuevue_type_script_lang_js,
2219
- SingleValue_render,
2220
- SingleValue_staticRenderFns,
2221
- false,
2222
- null,
2223
- null,
2224
- null
2225
-
2226
- )
2227
-
2228
- /* hot reload */
2229
- if (false) { var SingleValue_api; }
2230
- SingleValue_component.options.__file = "src/components/SingleValue.vue"
2231
- /* harmony default export */ var SingleValue = (SingleValue_component.exports);
2232
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/icons/Delete.vue?vue&type=template&id=364b6320
2233
- var Deletevue_type_template_id_364b6320_render = function render() {
2234
- var _vm = this,
2235
- _c = _vm._self._c
2236
- return _c(
2237
- "svg",
2238
- {
2239
- attrs: {
2240
- xmlns: "http://www.w3.org/2000/svg",
2241
- viewBox: "0 0 348.333 348.333",
2242
- },
2243
- },
2244
- [
2245
- _c("path", {
2246
- attrs: {
2247
- d: "M336.559 68.611L231.016 174.165l105.543 105.549c15.699 15.705 15.699 41.145 0 56.85-7.844 7.844-18.128 11.769-28.407 11.769-10.296 0-20.581-3.919-28.419-11.769L174.167 231.003 68.609 336.563c-7.843 7.844-18.128 11.769-28.416 11.769-10.285 0-20.563-3.919-28.413-11.769-15.699-15.698-15.699-41.139 0-56.85l105.54-105.549L11.774 68.611c-15.699-15.699-15.699-41.145 0-56.844 15.696-15.687 41.127-15.687 56.829 0l105.563 105.554L279.721 11.767c15.705-15.687 41.139-15.687 56.832 0 15.705 15.699 15.705 41.145.006 56.844z",
2248
- },
2249
- }),
2250
- ]
2251
- )
2252
- }
2253
- var Deletevue_type_template_id_364b6320_staticRenderFns = []
2254
- Deletevue_type_template_id_364b6320_render._withStripped = true
2255
-
2256
-
2257
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=template&id=364b6320
2258
-
2259
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/icons/Delete.vue?vue&type=script&lang=js
2260
- /* harmony default export */ var Deletevue_type_script_lang_js = ({
2261
- name: 'rp-treeselect--x'
2262
- });
2263
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=script&lang=js
2264
- /* harmony default export */ var icons_Deletevue_type_script_lang_js = (Deletevue_type_script_lang_js);
2265
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue
2266
-
2267
-
2268
-
2269
-
2270
-
2271
- /* normalize component */
2272
-
2273
- var Delete_component = normalizeComponent(
2274
- icons_Deletevue_type_script_lang_js,
2275
- Deletevue_type_template_id_364b6320_render,
2276
- Deletevue_type_template_id_364b6320_staticRenderFns,
2277
- false,
2278
- null,
2279
- null,
2280
- null
2281
-
2282
- )
2283
-
2284
- /* hot reload */
2285
- if (false) { var Delete_api; }
2286
- Delete_component.options.__file = "src/components/icons/Delete.vue"
2287
- /* harmony default export */ var Delete = (Delete_component.exports);
2288
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/MultiValueItem.vue?vue&type=script&lang=js
2289
-
2290
-
2291
-
2292
- /* harmony default export */ var MultiValueItemvue_type_script_lang_js = ({
2293
- name: 'rp-treeselect--multi-value-item',
2294
- setup: function setup() {
2295
- var instance = Object(external_Vue_["inject"])('instance');
2296
- return {
2297
- instance: instance
2298
- };
2299
- },
2300
- props: {
2301
- node: {
2302
- type: Object,
2303
- required: true
2304
- }
2305
- },
2306
- methods: {
2307
- handleMouseDown: onLeftClick(function handleMouseDown() {
2308
- var instance = this.instance,
2309
- node = this.node;
2310
- instance.select(node);
2311
- })
2312
- },
2313
- render: function render() {
2314
- var h = arguments[0];
2315
- var instance = this.instance,
2316
- node = this.node;
2317
- var itemClass = {
2318
- 'rp-treeselect__multi-value-item': true,
2319
- 'rp-treeselect__multi-value-item-disabled': node.isDisabled,
2320
- 'rp-treeselect__multi-value-item-new': node.isNew
2321
- };
2322
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
2323
- var labelRenderer = customValueLabelRenderer ? customValueLabelRenderer({
2324
- node: node
2325
- }) : node.label;
2326
- return h("div", {
2327
- "class": "rp-treeselect__multi-value-item-container"
2328
- }, [h("div", {
2329
- "class": itemClass,
2330
- on: {
2331
- "mousedown": this.handleMouseDown
2332
- }
2333
- }, [h("span", {
2334
- "class": "rp-treeselect__multi-value-label"
2335
- }, [labelRenderer]), h("span", {
2336
- "class": "rp-treeselect__icon rp-treeselect__value-remove"
2337
- }, [h(Delete)])])]);
2338
- }
2339
- });
2340
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue?vue&type=script&lang=js
2341
- /* harmony default export */ var components_MultiValueItemvue_type_script_lang_js = (MultiValueItemvue_type_script_lang_js);
2342
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue
2343
- var MultiValueItem_render, MultiValueItem_staticRenderFns
2344
-
2345
-
2346
-
2347
-
2348
- /* normalize component */
2349
-
2350
- var MultiValueItem_component = normalizeComponent(
2351
- components_MultiValueItemvue_type_script_lang_js,
2352
- MultiValueItem_render,
2353
- MultiValueItem_staticRenderFns,
2354
- false,
2355
- null,
2356
- null,
2357
- null
2358
-
2359
- )
2360
-
2361
- /* hot reload */
2362
- if (false) { var MultiValueItem_api; }
2363
- MultiValueItem_component.options.__file = "src/components/MultiValueItem.vue"
2364
- /* harmony default export */ var MultiValueItem = (MultiValueItem_component.exports);
2365
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/MultiValue.vue?vue&type=script&lang=js
2366
-
2367
-
2368
-
2369
-
2370
-
2371
- /* harmony default export */ var MultiValuevue_type_script_lang_js = ({
2372
- name: 'rp-treeselect--multi-value',
2373
- setup: function setup() {
2374
- var instance = Object(external_Vue_["inject"])('instance');
2375
- return {
2376
- instance: instance
2377
- };
2378
- },
2379
- methods: {
2380
- renderMultiValueItems: function renderMultiValueItems() {
2381
- var h = this.$createElement;
2382
- var instance = this.instance;
2383
- return instance.internalValue.slice(0, instance.limit).map(instance.getNode).map(function (node) {
2384
- return h(MultiValueItem, {
2385
- key: "multi-value-item-".concat(node.id),
2386
- attrs: {
2387
- node: node
2388
- }
2389
- });
2390
- });
2391
- },
2392
- renderExceedLimitTip: function renderExceedLimitTip() {
2393
- var h = this.$createElement;
2394
- var instance = this.instance;
2395
- var count = instance.internalValue.length - instance.limit;
2396
- if (count <= 0) return null;
2397
- return h("div", {
2398
- "class": "rp-treeselect__limit-tip rp-treeselect-helper-zoom-effect-off",
2399
- key: "exceed-limit-tip"
2400
- }, [h("span", {
2401
- "class": "rp-treeselect__limit-tip-text"
2402
- }, [instance.limitText(count)])]);
2403
- }
2404
- },
2405
- render: function render() {
2406
- var h = arguments[0];
2407
- var renderValueContainer = this.$parent.renderValueContainer;
2408
- var transitionGroupProps = {
2409
- props: {
2410
- tag: 'div',
2411
- name: 'rp-treeselect__multi-value-item--transition',
2412
- appear: true
2413
- }
2414
- };
2415
- return renderValueContainer(h("transition-group", babel_helper_vue_jsx_merge_props_default()([{
2416
- "class": "rp-treeselect__multi-value"
2417
- }, transitionGroupProps]), [this.renderMultiValueItems(), this.renderExceedLimitTip(), h(Placeholder, {
2418
- key: "placeholder"
2419
- }), h(Input, {
2420
- ref: "input",
2421
- key: "input"
2422
- })]));
2423
- }
2424
- });
2425
- // CONCATENATED MODULE: ./src/components/MultiValue.vue?vue&type=script&lang=js
2426
- /* harmony default export */ var components_MultiValuevue_type_script_lang_js = (MultiValuevue_type_script_lang_js);
2427
- // CONCATENATED MODULE: ./src/components/MultiValue.vue
2428
- var MultiValue_render, MultiValue_staticRenderFns
2429
-
2430
-
2431
-
2432
-
2433
- /* normalize component */
2434
-
2435
- var MultiValue_component = normalizeComponent(
2436
- components_MultiValuevue_type_script_lang_js,
2437
- MultiValue_render,
2438
- MultiValue_staticRenderFns,
2439
- false,
2440
- null,
2441
- null,
2442
- null
2443
-
2444
- )
2445
-
2446
- /* hot reload */
2447
- if (false) { var MultiValue_api; }
2448
- MultiValue_component.options.__file = "src/components/MultiValue.vue"
2449
- /* harmony default export */ var MultiValue = (MultiValue_component.exports);
2450
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/icons/Arrow.vue?vue&type=template&id=11186cd4
2451
- var Arrowvue_type_template_id_11186cd4_render = function render() {
2452
- var _vm = this,
2453
- _c = _vm._self._c
2454
- return _c(
2455
- "svg",
2456
- {
2457
- attrs: {
2458
- xmlns: "http://www.w3.org/2000/svg",
2459
- viewBox: "0 0 292.362 292.362",
2460
- },
2461
- },
2462
- [
2463
- _c("path", {
2464
- attrs: {
2465
- d: "M286.935 69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952 0-9.233 1.807-12.85 5.424C1.807 72.998 0 77.279 0 82.228c0 4.948 1.807 9.229 5.424 12.847l127.907 127.907c3.621 3.617 7.902 5.428 12.85 5.428s9.233-1.811 12.847-5.428L286.935 95.074c3.613-3.617 5.427-7.898 5.427-12.847 0-4.948-1.814-9.229-5.427-12.85z",
2466
- },
2467
- }),
2468
- ]
2469
- )
2470
- }
2471
- var Arrowvue_type_template_id_11186cd4_staticRenderFns = []
2472
- Arrowvue_type_template_id_11186cd4_render._withStripped = true
2473
-
2474
-
2475
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=template&id=11186cd4
2476
-
2477
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/icons/Arrow.vue?vue&type=script&lang=js
2478
- /* harmony default export */ var Arrowvue_type_script_lang_js = ({
2479
- name: 'rp-treeselect--arrow'
2480
- });
2481
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=script&lang=js
2482
- /* harmony default export */ var icons_Arrowvue_type_script_lang_js = (Arrowvue_type_script_lang_js);
2483
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue
2484
-
2485
-
2486
-
2487
-
2488
-
2489
- /* normalize component */
2490
-
2491
- var Arrow_component = normalizeComponent(
2492
- icons_Arrowvue_type_script_lang_js,
2493
- Arrowvue_type_template_id_11186cd4_render,
2494
- Arrowvue_type_template_id_11186cd4_staticRenderFns,
2495
- false,
2496
- null,
2497
- null,
2498
- null
2499
-
2500
- )
2501
-
2502
- /* hot reload */
2503
- if (false) { var Arrow_api; }
2504
- Arrow_component.options.__file = "src/components/icons/Arrow.vue"
2505
- /* harmony default export */ var Arrow = (Arrow_component.exports);
2506
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Control.vue?vue&type=script&lang=js
2507
-
2508
-
2509
-
2510
-
2511
-
2512
-
2513
- /* harmony default export */ var Controlvue_type_script_lang_js = ({
2514
- name: 'rp-treeselect--control',
2515
- setup: function setup() {
2516
- var instance = Object(external_Vue_["inject"])('instance');
2517
- return {
2518
- instance: instance
2519
- };
2520
- },
2521
- computed: {
2522
- shouldShowX: function shouldShowX() {
2523
- var instance = this.instance;
2524
- return instance.clearable && !instance.disabled && instance.hasValue && (this.hasUndisabledValue || instance.allowClearingDisabled);
2525
- },
2526
- shouldShowArrow: function shouldShowArrow() {
2527
- var instance = this.instance;
2528
- if (!instance.alwaysOpen) return true;
2529
- return !instance.menu.isOpen;
2530
- },
2531
- hasUndisabledValue: function hasUndisabledValue() {
2532
- var instance = this.instance;
2533
- return instance.hasValue && instance.internalValue.some(function (id) {
2534
- return !instance.getNode(id).isDisabled;
2535
- });
2536
- }
2537
- },
2538
- methods: {
2539
- renderX: function renderX() {
2540
- var h = this.$createElement;
2541
- var instance = this.instance;
2542
- var title = instance.multiple ? instance.clearAllText : instance.clearValueText;
2543
- if (!this.shouldShowX) return null;
2544
- return h("div", {
2545
- "class": "rp-treeselect__x-container",
2546
- attrs: {
2547
- title: title
2548
- },
2549
- on: {
2550
- "mousedown": this.handleMouseDownOnX
2551
- }
2552
- }, [h(Delete, {
2553
- "class": "rp-treeselect__x"
2554
- })]);
2555
- },
2556
- renderArrow: function renderArrow() {
2557
- var h = this.$createElement;
2558
- var instance = this.instance;
2559
- var arrowClass = {
2560
- 'rp-treeselect__control-arrow': true,
2561
- 'rp-treeselect__control-arrow--rotated': instance.menu.isOpen
2562
- };
2563
- if (!this.shouldShowArrow) return null;
2564
- return h("div", {
2565
- "class": "rp-treeselect__control-arrow-container",
2566
- on: {
2567
- "mousedown": this.handleMouseDownOnArrow
2568
- }
2569
- }, [h(Arrow, {
2570
- "class": arrowClass
2571
- })]);
2572
- },
2573
- handleMouseDownOnX: onLeftClick(function handleMouseDownOnX(evt) {
2574
- evt.stopPropagation();
2575
- evt.preventDefault();
2576
- var instance = this.instance;
2577
- var result = instance.beforeClearAll();
2578
- var handler = function handler(shouldClear) {
2579
- if (shouldClear) instance.clear();
2580
- };
2581
- if (is_promise_default()(result)) {
2582
- result.then(handler);
2583
- } else {
2584
- setTimeout(function () {
2585
- return handler(result);
2586
- }, 0);
2587
- }
2588
- }),
2589
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnArrow(evt) {
2590
- evt.preventDefault();
2591
- evt.stopPropagation();
2592
- var instance = this.instance;
2593
- instance.focusInput();
2594
- instance.toggleMenu();
2595
- }),
2596
- renderValueContainer: function renderValueContainer(children) {
2597
- var h = this.$createElement;
2598
- return h("div", {
2599
- "class": "rp-treeselect__value-container"
2600
- }, [children]);
2601
- }
2602
- },
2603
- render: function render() {
2604
- var h = arguments[0];
2605
- var instance = this.instance;
2606
- var ValueContainer = instance.single ? SingleValue : MultiValue;
2607
- return h("div", {
2608
- "class": "rp-treeselect__control",
2609
- on: {
2610
- "mousedown": instance.handleMouseDown
2611
- }
2612
- }, [h(ValueContainer, {
2613
- ref: "value-container"
2614
- }), this.renderX(), this.renderArrow()]);
2615
- }
2616
- });
2617
- // CONCATENATED MODULE: ./src/components/Control.vue?vue&type=script&lang=js
2618
- /* harmony default export */ var components_Controlvue_type_script_lang_js = (Controlvue_type_script_lang_js);
2619
- // CONCATENATED MODULE: ./src/components/Control.vue
2620
- var Control_render, Control_staticRenderFns
2621
-
2622
-
2623
-
2624
-
2625
- /* normalize component */
2626
-
2627
- var Control_component = normalizeComponent(
2628
- components_Controlvue_type_script_lang_js,
2629
- Control_render,
2630
- Control_staticRenderFns,
2631
- false,
2632
- null,
2633
- null,
2634
- null
2635
-
2636
- )
2637
-
2638
- /* hot reload */
2639
- if (false) { var Control_api; }
2640
- Control_component.options.__file = "src/components/Control.vue"
2641
- /* harmony default export */ var Control = (Control_component.exports);
2642
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Tip.vue?vue&type=script&lang=js
2643
- /* harmony default export */ var Tipvue_type_script_lang_js = ({
2644
- name: 'rp-treeselect--tip',
2645
- props: {
2646
- type: {
2647
- type: String,
2648
- required: true
2649
- },
2650
- icon: {
2651
- type: String,
2652
- required: true
2653
- }
2654
- },
2655
- render: function render() {
2656
- var h = arguments[0];
2657
- var _this$$props = this.$props,
2658
- icon = _this$$props.icon,
2659
- type = _this$$props.type;
2660
- return h("div", {
2661
- "class": "rp-treeselect__tip rp-treeselect__".concat(type, "-tip")
2662
- }, [h("div", {
2663
- "class": "rp-treeselect__icon-container"
2664
- }, [h("span", {
2665
- "class": "rp-treeselect__icon-".concat(icon)
2666
- })]), h("span", {
2667
- "class": "rp-treeselect__tip-text rp-treeselect__".concat(type, "-tip-text")
2668
- }, [h("slot")])]);
2669
- }
2670
- });
2671
- // CONCATENATED MODULE: ./src/components/Tip.vue?vue&type=script&lang=js
2672
- /* harmony default export */ var components_Tipvue_type_script_lang_js = (Tipvue_type_script_lang_js);
2673
- // CONCATENATED MODULE: ./src/components/Tip.vue
2674
- var Tip_render, Tip_staticRenderFns
2675
-
2676
-
2677
-
2678
-
2679
- /* normalize component */
2680
-
2681
- var Tip_component = normalizeComponent(
2682
- components_Tipvue_type_script_lang_js,
2683
- Tip_render,
2684
- Tip_staticRenderFns,
2685
- false,
2686
- null,
2687
- null,
2688
- null
2689
-
2690
- )
2691
-
2692
- /* hot reload */
2693
- if (false) { var Tip_api; }
2694
- Tip_component.options.__file = "src/components/Tip.vue"
2695
- /* harmony default export */ var Tip = (Tip_component.exports);
2696
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Option.vue?vue&type=script&lang=js
2697
-
2698
-
2699
-
2700
-
2701
-
2702
-
2703
- var arrowPlaceholder, checkMark, minusMark;
2704
- var Option = {
2705
- name: 'rp-treeselect--option',
2706
- setup: function setup() {
2707
- var instance = Object(external_Vue_["inject"])('instance');
2708
- return {
2709
- instance: instance
2710
- };
2711
- },
2712
- props: {
2713
- node: {
2714
- type: Object,
2715
- required: true
2716
- }
2717
- },
2718
- computed: {
2719
- shouldExpand: function shouldExpand() {
2720
- var instance = this.instance,
2721
- node = this.node;
2722
- return node.isBranch && instance.shouldExpand(node);
2723
- },
2724
- shouldShow: function shouldShow() {
2725
- var instance = this.instance,
2726
- node = this.node;
2727
- return instance.shouldShowOptionInMenu(node);
2728
- }
2729
- },
2730
- methods: {
2731
- renderOption: function renderOption() {
2732
- var h = this.$createElement;
2733
- var instance = this.instance,
2734
- node = this.node;
2735
- var optionClass = {
2736
- 'rp-treeselect__option': true,
2737
- 'rp-treeselect__option--disabled': node.isDisabled,
2738
- 'rp-treeselect__option--selected': instance.isSelected(node),
2739
- 'rp-treeselect__option--highlight': node.isHighlighted,
2740
- 'rp-treeselect__option--matched': instance.localSearch.active && node.isMatched,
2741
- 'rp-treeselect__option--hide': !this.shouldShow
2742
- };
2743
- return h("div", {
2744
- "class": optionClass,
2745
- on: {
2746
- "mouseenter": this.handleMouseEnterOption
2747
- },
2748
- attrs: {
2749
- "data-id": node.id
2750
- }
2751
- }, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
2752
- },
2753
- renderSubOptionsList: function renderSubOptionsList() {
2754
- var h = this.$createElement;
2755
- if (!this.shouldExpand) return null;
2756
- return h("div", {
2757
- "class": "rp-treeselect__list"
2758
- }, [this.renderSubOptions(), this.renderNoChildrenTip(), this.renderLoadingChildrenTip(), this.renderLoadingChildrenErrorTip()]);
2759
- },
2760
- renderArrow: function renderArrow() {
2761
- var h = this.$createElement;
2762
- var instance = this.instance,
2763
- node = this.node;
2764
- if (instance.shouldFlattenOptions && this.shouldShow) return null;
2765
- if (node.isBranch) {
2766
- var transitionProps = {
2767
- props: {
2768
- name: 'rp-treeselect__option-arrow--prepare',
2769
- appear: true
2770
- }
2771
- };
2772
- var arrowClass = {
2773
- 'rp-treeselect__option-arrow': true,
2774
- 'rp-treeselect__option-arrow--rotated': this.shouldExpand
2775
- };
2776
- return h("div", {
2777
- "class": "rp-treeselect__option-arrow-container",
2778
- on: {
2779
- "mousedown": this.handleMouseDownOnArrow
2780
- }
2781
- }, [h("transition", transitionProps, [h(Arrow, {
2782
- "class": arrowClass
2783
- })])]);
2784
- }
2785
- if (instance.hasBranchNodes) {
2786
- if (!arrowPlaceholder) arrowPlaceholder = h("div", {
2787
- "class": "rp-treeselect__option-arrow-placeholder"
2788
- }, ["\xA0"]);
2789
- return arrowPlaceholder;
2790
- }
2791
- return null;
2792
- },
2793
- renderLabelContainer: function renderLabelContainer(children) {
2794
- var h = this.$createElement;
2795
- return h("div", {
2796
- "class": "rp-treeselect__label-container",
2797
- on: {
2798
- "mousedown": this.handleMouseDownOnLabelContainer
2799
- }
2800
- }, [children]);
2801
- },
2802
- renderCheckboxContainer: function renderCheckboxContainer(children) {
2803
- var h = this.$createElement;
2804
- var instance = this.instance,
2805
- node = this.node;
2806
- if (instance.single) return null;
2807
- if (instance.disableBranchNodes && node.isBranch) return null;
2808
- return h("div", {
2809
- "class": "rp-treeselect__checkbox-container"
2810
- }, [children]);
2811
- },
2812
- renderCheckbox: function renderCheckbox() {
2813
- var h = this.$createElement;
2814
- var instance = this.instance,
2815
- node = this.node;
2816
- var checkedState = instance.forest.checkedStateMap[node.id];
2817
- var checkboxClass = {
2818
- 'rp-treeselect__checkbox': true,
2819
- 'rp-treeselect__checkbox--checked': checkedState === CHECKED,
2820
- 'rp-treeselect__checkbox--indeterminate': checkedState === INDETERMINATE,
2821
- 'rp-treeselect__checkbox--unchecked': checkedState === UNCHECKED,
2822
- 'rp-treeselect__checkbox--disabled': node.isDisabled
2823
- };
2824
- if (!checkMark) checkMark = h("span", {
2825
- "class": "rp-treeselect__check-mark"
2826
- });
2827
- if (!minusMark) minusMark = h("span", {
2828
- "class": "rp-treeselect__minus-mark"
2829
- });
2830
- return h("span", {
2831
- "class": checkboxClass
2832
- }, [checkMark, minusMark]);
2833
- },
2834
- renderLabel: function renderLabel() {
2835
- var h = this.$createElement;
2836
- var instance = this.instance,
2837
- node = this.node;
2838
- var shouldShowCount = node.isBranch && (instance.localSearch.active ? instance.showCountOnSearchComputed : instance.showCount);
2839
- var count = shouldShowCount ? instance.localSearch.active ? instance.localSearch.countMap[node.id][instance.showCountOf] : node.count[instance.showCountOf] : NaN;
2840
- var labelClassName = 'rp-treeselect__label';
2841
- var countClassName = 'rp-treeselect__count';
2842
- var customLabelRenderer = instance.$scopedSlots['option-label'];
2843
- if (customLabelRenderer) return customLabelRenderer({
2844
- node: node,
2845
- shouldShowCount: shouldShowCount,
2846
- count: count,
2847
- labelClassName: labelClassName,
2848
- countClassName: countClassName
2849
- });
2850
- return h("label", {
2851
- "class": labelClassName
2852
- }, [node.label, shouldShowCount && h("span", {
2853
- "class": countClassName
2854
- }, ["(", count, ")"])]);
2855
- },
2856
- renderSubOptions: function renderSubOptions() {
2857
- var h = this.$createElement;
2858
- var node = this.node;
2859
- if (!node.childrenStates.isLoaded) return null;
2860
- return node.children.map(function (childNode) {
2861
- return h(Option, {
2862
- attrs: {
2863
- node: childNode
2864
- },
2865
- key: childNode.id
2866
- });
2867
- });
2868
- },
2869
- renderNoChildrenTip: function renderNoChildrenTip() {
2870
- var h = this.$createElement;
2871
- var instance = this.instance,
2872
- node = this.node;
2873
- if (!node.childrenStates.isLoaded || node.children.length) return null;
2874
- return h(Tip, {
2875
- attrs: {
2876
- type: "no-children",
2877
- icon: "warning"
2878
- }
2879
- }, [instance.noChildrenText]);
2880
- },
2881
- renderLoadingChildrenTip: function renderLoadingChildrenTip() {
2882
- var h = this.$createElement;
2883
- var instance = this.instance,
2884
- node = this.node;
2885
- if (!node.childrenStates.isLoading) return null;
2886
- return h(Tip, {
2887
- attrs: {
2888
- type: "loading",
2889
- icon: "loader"
2890
- }
2891
- }, [instance.loadingText]);
2892
- },
2893
- renderLoadingChildrenErrorTip: function renderLoadingChildrenErrorTip() {
2894
- var h = this.$createElement;
2895
- var instance = this.instance,
2896
- node = this.node;
2897
- if (!node.childrenStates.loadingError) return null;
2898
- return h(Tip, {
2899
- attrs: {
2900
- type: "error",
2901
- icon: "error"
2902
- }
2903
- }, [node.childrenStates.loadingError, h("a", {
2904
- "class": "rp-treeselect__retry",
2905
- attrs: {
2906
- title: instance.retryTitle
2907
- },
2908
- on: {
2909
- "mousedown": this.handleMouseDownOnRetry
2910
- }
2911
- }, [instance.retryText])]);
2912
- },
2913
- handleMouseEnterOption: function handleMouseEnterOption(evt) {
2914
- var instance = this.instance,
2915
- node = this.node;
2916
- if (evt.target !== evt.currentTarget) return;
2917
- instance.setCurrentHighlightedOption(node, false);
2918
- },
2919
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnOptionArrow() {
2920
- var instance = this.instance,
2921
- node = this.node;
2922
- instance.toggleExpanded(node);
2923
- }),
2924
- handleMouseDownOnLabelContainer: onLeftClick(function handleMouseDownOnLabelContainer() {
2925
- var instance = this.instance,
2926
- node = this.node;
2927
- if (node.isBranch && instance.disableBranchNodes) {
2928
- instance.toggleExpanded(node);
2929
- } else {
2930
- instance.select(node);
2931
- }
2932
- }),
2933
- handleMouseDownOnRetry: onLeftClick(function handleMouseDownOnRetry() {
2934
- var instance = this.instance,
2935
- node = this.node;
2936
- instance.loadChildrenOptions(node);
2937
- })
2938
- },
2939
- render: function render() {
2940
- var h = arguments[0];
2941
- var node = this.node;
2942
- var indentLevel = this.instance.shouldFlattenOptions ? 0 : node.level;
2943
- var listItemClass = defineProperty_default()({
2944
- 'rp-treeselect__list-item': true
2945
- }, "rp-treeselect__indent-level-".concat(indentLevel), true);
2946
- var transitionProps = {
2947
- props: {
2948
- name: 'rp-treeselect__list--transition'
2949
- }
2950
- };
2951
- return h("div", {
2952
- "class": listItemClass
2953
- }, [this.renderOption(), node.isBranch && h("transition", transitionProps, [this.renderSubOptionsList()])]);
2954
- }
2955
- };
2956
- /* harmony default export */ var Optionvue_type_script_lang_js = (Option);
2957
- // CONCATENATED MODULE: ./src/components/Option.vue?vue&type=script&lang=js
2958
- /* harmony default export */ var components_Optionvue_type_script_lang_js = (Optionvue_type_script_lang_js);
2959
- // CONCATENATED MODULE: ./src/components/Option.vue
2960
- var Option_render, Option_staticRenderFns
2961
-
2962
-
2963
-
2964
-
2965
- /* normalize component */
2966
-
2967
- var Option_component = normalizeComponent(
2968
- components_Optionvue_type_script_lang_js,
2969
- Option_render,
2970
- Option_staticRenderFns,
2971
- false,
2972
- null,
2973
- null,
2974
- null
2975
-
2976
- )
2977
-
2978
- /* harmony default export */ var components_Option = (Option_component.exports);
2979
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Menu.vue?vue&type=script&lang=js
2980
-
2981
-
2982
-
2983
-
2984
-
2985
- var directionMap = {
2986
- top: 'top',
2987
- bottom: 'bottom',
2988
- above: 'top',
2989
- below: 'bottom'
2990
- };
2991
- /* harmony default export */ var Menuvue_type_script_lang_js = ({
2992
- name: 'rp-treeselect--menu',
2993
- setup: function setup() {
2994
- var instance = Object(external_Vue_["inject"])('instance');
2995
- return {
2996
- instance: instance
2997
- };
2998
- },
2999
- computed: {
3000
- menuStyle: function menuStyle() {
3001
- var instance = this.instance;
3002
- return {
3003
- maxHeight: instance.maxHeight + 'px'
3004
- };
3005
- },
3006
- menuContainerStyle: function menuContainerStyle() {
3007
- var instance = this.instance;
3008
- return {
3009
- zIndex: instance.appendToBody ? null : instance.zIndex
3010
- };
3011
- }
3012
- },
3013
- watch: {
3014
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
3015
- if (newValue) {
3016
- this.$nextTick(this.onMenuOpen);
3017
- } else {
3018
- this.onMenuClose();
3019
- }
3020
- }
3021
- },
3022
- created: function created() {
3023
- this.menuSizeWatcher = null;
3024
- this.menuResizeAndScrollEventListeners = null;
3025
- },
3026
- mounted: function mounted() {
3027
- var instance = this.instance;
3028
- if (instance.menu.isOpen) this.$nextTick(this.onMenuOpen);
3029
- },
3030
- destroyed: function destroyed() {
3031
- this.onMenuClose();
3032
- },
3033
- methods: {
3034
- renderMenu: function renderMenu() {
3035
- var h = this.$createElement;
3036
- var instance = this.instance;
3037
- if (!instance.menu.isOpen) return null;
3038
- return h("div", {
3039
- ref: "menu",
3040
- "class": "rp-treeselect__menu",
3041
- on: {
3042
- "mousedown": instance.handleMouseDown
3043
- },
3044
- style: this.menuStyle
3045
- }, [this.renderBeforeList(), instance.async ? this.renderAsyncSearchMenuInner() : instance.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(), this.renderAfterList()]);
3046
- },
3047
- renderBeforeList: function renderBeforeList() {
3048
- var instance = this.instance;
3049
- var beforeListRenderer = instance.$scopedSlots['before-list'];
3050
- return beforeListRenderer ? beforeListRenderer() : null;
3051
- },
3052
- renderAfterList: function renderAfterList() {
3053
- var instance = this.instance;
3054
- var afterListRenderer = instance.$scopedSlots['after-list'];
3055
- return afterListRenderer ? afterListRenderer() : null;
3056
- },
3057
- renderNormalMenuInner: function renderNormalMenuInner() {
3058
- var instance = this.instance;
3059
- if (instance.rootOptionsStates.isLoading) {
3060
- return this.renderLoadingOptionsTip();
3061
- } else if (instance.rootOptionsStates.loadingError) {
3062
- return this.renderLoadingRootOptionsErrorTip();
3063
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
3064
- return this.renderNoAvailableOptionsTip();
3065
- } else {
3066
- return this.renderOptionList();
3067
- }
3068
- },
3069
- renderLocalSearchMenuInner: function renderLocalSearchMenuInner() {
3070
- var instance = this.instance;
3071
- if (instance.rootOptionsStates.isLoading) {
3072
- return this.renderLoadingOptionsTip();
3073
- } else if (instance.rootOptionsStates.loadingError) {
3074
- return this.renderLoadingRootOptionsErrorTip();
3075
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
3076
- return this.renderNoAvailableOptionsTip();
3077
- } else if (instance.localSearch.noResults) {
3078
- return this.renderNoResultsTip();
3079
- } else {
3080
- return this.renderOptionList();
3081
- }
3082
- },
3083
- renderAsyncSearchMenuInner: function renderAsyncSearchMenuInner() {
3084
- var instance = this.instance;
3085
- var entry = instance.getRemoteSearchEntry();
3086
- var shouldShowSearchPromptTip = instance.trigger.searchQuery === '' && !instance.defaultOptions;
3087
- var shouldShowNoResultsTip = shouldShowSearchPromptTip ? false : entry.isLoaded && entry.options.length === 0;
3088
- if (shouldShowSearchPromptTip) {
3089
- return this.renderSearchPromptTip();
3090
- } else if (entry.isLoading) {
3091
- return this.renderLoadingOptionsTip();
3092
- } else if (entry.loadingError) {
3093
- return this.renderAsyncSearchLoadingErrorTip();
3094
- } else if (shouldShowNoResultsTip) {
3095
- return this.renderNoResultsTip();
3096
- } else {
3097
- return this.renderOptionList();
3098
- }
3099
- },
3100
- renderOptionList: function renderOptionList() {
3101
- var h = this.$createElement;
3102
- var instance = this.instance;
3103
- return h("div", {
3104
- "class": "rp-treeselect__list"
3105
- }, [instance.forest.normalizedOptions.map(function (rootNode) {
3106
- return h(components_Option, {
3107
- attrs: {
3108
- node: rootNode
3109
- },
3110
- key: rootNode.id
3111
- });
3112
- })]);
3113
- },
3114
- renderSearchPromptTip: function renderSearchPromptTip() {
3115
- var h = this.$createElement;
3116
- var instance = this.instance;
3117
- return h(Tip, {
3118
- attrs: {
3119
- type: "search-prompt",
3120
- icon: "warning"
3121
- }
3122
- }, [instance.searchPromptText]);
3123
- },
3124
- renderLoadingOptionsTip: function renderLoadingOptionsTip() {
3125
- var h = this.$createElement;
3126
- var instance = this.instance;
3127
- return h(Tip, {
3128
- attrs: {
3129
- type: "loading",
3130
- icon: "loader"
3131
- }
3132
- }, [instance.loadingText]);
3133
- },
3134
- renderLoadingRootOptionsErrorTip: function renderLoadingRootOptionsErrorTip() {
3135
- var h = this.$createElement;
3136
- var instance = this.instance;
3137
- return h(Tip, {
3138
- attrs: {
3139
- type: "error",
3140
- icon: "error"
3141
- }
3142
- }, [instance.rootOptionsStates.loadingError, h("a", {
3143
- "class": "rp-treeselect__retry",
3144
- on: {
3145
- "click": instance.loadRootOptions
3146
- },
3147
- attrs: {
3148
- title: instance.retryTitle
3149
- }
3150
- }, [instance.retryText])]);
3151
- },
3152
- renderAsyncSearchLoadingErrorTip: function renderAsyncSearchLoadingErrorTip() {
3153
- var h = this.$createElement;
3154
- var instance = this.instance;
3155
- var entry = instance.getRemoteSearchEntry();
3156
- return h(Tip, {
3157
- attrs: {
3158
- type: "error",
3159
- icon: "error"
3160
- }
3161
- }, [entry.loadingError, h("a", {
3162
- "class": "rp-treeselect__retry",
3163
- on: {
3164
- "click": instance.handleRemoteSearch
3165
- },
3166
- attrs: {
3167
- title: instance.retryTitle
3168
- }
3169
- }, [instance.retryText])]);
3170
- },
3171
- renderNoAvailableOptionsTip: function renderNoAvailableOptionsTip() {
3172
- var h = this.$createElement;
3173
- var instance = this.instance;
3174
- return h(Tip, {
3175
- attrs: {
3176
- type: "no-options",
3177
- icon: "warning"
3178
- }
3179
- }, [instance.noOptionsText]);
3180
- },
3181
- renderNoResultsTip: function renderNoResultsTip() {
3182
- var h = this.$createElement;
3183
- var instance = this.instance;
3184
- return h(Tip, {
3185
- attrs: {
3186
- type: "no-results",
3187
- icon: "warning"
3188
- }
3189
- }, [instance.noResultsText]);
3190
- },
3191
- onMenuOpen: function onMenuOpen() {
3192
- this.adjustMenuOpenDirection();
3193
- this.setupMenuSizeWatcher();
3194
- this.setupMenuResizeAndScrollEventListeners();
3195
- },
3196
- onMenuClose: function onMenuClose() {
3197
- this.removeMenuSizeWatcher();
3198
- this.removeMenuResizeAndScrollEventListeners();
3199
- },
3200
- adjustMenuOpenDirection: function adjustMenuOpenDirection() {
3201
- var instance = this.instance;
3202
- if (!instance.menu.isOpen) return;
3203
- var $menu = instance.getMenu();
3204
- var $control = instance.getControl();
3205
- var menuRect = $menu.getBoundingClientRect();
3206
- var controlRect = $control.getBoundingClientRect();
3207
- var menuHeight = menuRect.height;
3208
- var viewportHeight = window.innerHeight;
3209
- var spaceAbove = controlRect.top;
3210
- var spaceBelow = window.innerHeight - controlRect.bottom;
3211
- var isControlInViewport = controlRect.top >= 0 && controlRect.top <= viewportHeight || controlRect.top < 0 && controlRect.bottom > 0;
3212
- var hasEnoughSpaceBelow = spaceBelow > menuHeight + MENU_BUFFER;
3213
- var hasEnoughSpaceAbove = spaceAbove > menuHeight + MENU_BUFFER;
3214
- if (!isControlInViewport) {
3215
- instance.closeMenu();
3216
- } else if (instance.openDirection !== 'auto') {
3217
- instance.menu.placement = directionMap[instance.openDirection];
3218
- } else if (hasEnoughSpaceBelow || !hasEnoughSpaceAbove) {
3219
- instance.menu.placement = 'bottom';
3220
- } else {
3221
- instance.menu.placement = 'top';
3222
- }
3223
- },
3224
- setupMenuSizeWatcher: function setupMenuSizeWatcher() {
3225
- var instance = this.instance;
3226
- var $menu = instance.getMenu();
3227
- if (this.menuSizeWatcher) return;
3228
- this.menuSizeWatcher = {
3229
- remove: watchSize($menu, this.adjustMenuOpenDirection)
3230
- };
3231
- },
3232
- setupMenuResizeAndScrollEventListeners: function setupMenuResizeAndScrollEventListeners() {
3233
- var instance = this.instance;
3234
- var $control = instance.getControl();
3235
- if (this.menuResizeAndScrollEventListeners) return;
3236
- this.menuResizeAndScrollEventListeners = {
3237
- remove: setupResizeAndScrollEventListeners($control, this.adjustMenuOpenDirection)
3238
- };
3239
- },
3240
- removeMenuSizeWatcher: function removeMenuSizeWatcher() {
3241
- if (!this.menuSizeWatcher) return;
3242
- this.menuSizeWatcher.remove();
3243
- this.menuSizeWatcher = null;
3244
- },
3245
- removeMenuResizeAndScrollEventListeners: function removeMenuResizeAndScrollEventListeners() {
3246
- if (!this.menuResizeAndScrollEventListeners) return;
3247
- this.menuResizeAndScrollEventListeners.remove();
3248
- this.menuResizeAndScrollEventListeners = null;
3249
- }
3250
- },
3251
- render: function render() {
3252
- var h = arguments[0];
3253
- return h("div", {
3254
- ref: "menu-container",
3255
- "class": "rp-treeselect__menu-container",
3256
- style: this.menuContainerStyle
3257
- }, [h("transition", {
3258
- attrs: {
3259
- name: "rp-treeselect__menu--transition"
3260
- }
3261
- }, [this.renderMenu()])]);
3262
- }
3263
- });
3264
- // CONCATENATED MODULE: ./src/components/Menu.vue?vue&type=script&lang=js
3265
- /* harmony default export */ var components_Menuvue_type_script_lang_js = (Menuvue_type_script_lang_js);
3266
- // CONCATENATED MODULE: ./src/components/Menu.vue
3267
- var Menu_render, Menu_staticRenderFns
3268
-
3269
-
3270
-
3271
-
3272
- /* normalize component */
3273
-
3274
- var Menu_component = normalizeComponent(
3275
- components_Menuvue_type_script_lang_js,
3276
- Menu_render,
3277
- Menu_staticRenderFns,
3278
- false,
3279
- null,
3280
- null,
3281
- null
3282
-
3283
- )
3284
-
3285
- /* hot reload */
3286
- if (false) { var Menu_api; }
3287
- Menu_component.options.__file = "src/components/Menu.vue"
3288
- /* harmony default export */ var Menu = (Menu_component.exports);
3289
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/MenuPortal.vue?vue&type=script&lang=js
3290
-
3291
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3292
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { defineProperty_default()(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3293
-
3294
-
3295
-
3296
- var PortalTarget = {
3297
- name: 'rp-treeselect--portal-target',
3298
- setup: function setup() {
3299
- console.log('TEST');
3300
- var instance = Object(external_Vue_["inject"])('instance');
3301
- return {
3302
- instance: instance
3303
- };
3304
- },
3305
- watch: {
3306
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
3307
- if (newValue) {
3308
- this.setupHandlers();
3309
- } else {
3310
- this.removeHandlers();
3311
- }
3312
- },
3313
- 'instance.menu.placement': function instanceMenuPlacement() {
3314
- this.updateMenuContainerOffset();
3315
- }
3316
- },
3317
- created: function created() {
3318
- this.controlResizeAndScrollEventListeners = null;
3319
- this.controlSizeWatcher = null;
3320
- },
3321
- mounted: function mounted() {
3322
- console.log('TEST');
3323
- var instance = this.instance;
3324
- if (instance.menu.isOpen) this.setupHandlers();
3325
- },
3326
- methods: {
3327
- setupHandlers: function setupHandlers() {
3328
- this.updateWidth();
3329
- this.updateMenuContainerOffset();
3330
- this.setupControlResizeAndScrollEventListeners();
3331
- this.setupControlSizeWatcher();
3332
- },
3333
- removeHandlers: function removeHandlers() {
3334
- this.removeControlResizeAndScrollEventListeners();
3335
- this.removeControlSizeWatcher();
3336
- },
3337
- setupControlResizeAndScrollEventListeners: function setupControlResizeAndScrollEventListeners() {
3338
- var instance = this.instance;
3339
- var $control = instance.getControl();
3340
- if (this.controlResizeAndScrollEventListeners) return;
3341
- this.controlResizeAndScrollEventListeners = {
3342
- remove: setupResizeAndScrollEventListeners($control, this.updateMenuContainerOffset)
3343
- };
3344
- },
3345
- setupControlSizeWatcher: function setupControlSizeWatcher() {
3346
- var _this = this;
3347
- var instance = this.instance;
3348
- var $control = instance.getControl();
3349
- if (this.controlSizeWatcher) return;
3350
- this.controlSizeWatcher = {
3351
- remove: watchSize($control, function () {
3352
- _this.updateWidth();
3353
- _this.updateMenuContainerOffset();
3354
- })
3355
- };
3356
- },
3357
- removeControlResizeAndScrollEventListeners: function removeControlResizeAndScrollEventListeners() {
3358
- if (!this.controlResizeAndScrollEventListeners) return;
3359
- this.controlResizeAndScrollEventListeners.remove();
3360
- this.controlResizeAndScrollEventListeners = null;
3361
- },
3362
- removeControlSizeWatcher: function removeControlSizeWatcher() {
3363
- if (!this.controlSizeWatcher) return;
3364
- this.controlSizeWatcher.remove();
3365
- this.controlSizeWatcher = null;
3366
- },
3367
- updateWidth: function updateWidth() {
3368
- var instance = this.instance;
3369
- var $portalTarget = this.$el;
3370
- var $control = instance.getControl();
3371
- var controlRect = $control.getBoundingClientRect();
3372
- $portalTarget.style.width = controlRect.width + 'px';
3373
- },
3374
- updateMenuContainerOffset: function updateMenuContainerOffset() {
3375
- var instance = this.instance;
3376
- var $control = instance.getControl();
3377
- var $portalTarget = this.$el;
3378
- var controlRect = $control.getBoundingClientRect();
3379
- var portalTargetRect = $portalTarget.getBoundingClientRect();
3380
- var offsetY = instance.menu.placement === 'bottom' ? controlRect.height : 0;
3381
- var left = Math.round(controlRect.left - portalTargetRect.left) + 'px';
3382
- var top = Math.round(controlRect.top - portalTargetRect.top + offsetY) + 'px';
3383
- var menuContainerStyle = this.$refs.menu.$refs['menu-container'].style;
3384
- var transformVariations = ['transform', 'webkitTransform', 'MozTransform', 'msTransform'];
3385
- var transform = find(transformVariations, function (t) {
3386
- return t in document.body.style;
3387
- });
3388
- menuContainerStyle[transform] = "translate(".concat(left, ", ").concat(top, ")");
3389
- }
3390
- },
3391
- render: function render() {
3392
- var h = arguments[0];
3393
- var portalTargetClass = ['rp-treeselect__portal-target', this.instance.wrapperClass];
3394
- var portalTargetStyle = {
3395
- zIndex: this.instance.zIndex
3396
- };
3397
- return h("div", {
3398
- "class": portalTargetClass,
3399
- style: portalTargetStyle,
3400
- attrs: {
3401
- "data-instance-id": this.instance.getInstanceId()
3402
- }
3403
- }, [h(Menu, {
3404
- ref: "menu"
3405
- })]);
3406
- },
3407
- destroyed: function destroyed() {
3408
- this.removeHandlers();
3409
- }
3410
- };
3411
- var placeholder;
3412
- /* harmony default export */ var MenuPortalvue_type_script_lang_js = ({
3413
- name: 'rp-treeselect--menu-portal',
3414
- created: function created() {
3415
- this.portalTarget = null;
3416
- },
3417
- mounted: function mounted() {
3418
- this.setup();
3419
- },
3420
- destroyed: function destroyed() {
3421
- this.teardown();
3422
- },
3423
- methods: {
3424
- setup: function setup() {
3425
- var el = document.createElement('div');
3426
- el.setAttribute('id', "menu-target-".concat(this._uid));
3427
- document.body.appendChild(el);
3428
- var targetApp = _objectSpread({
3429
- parent: this
3430
- }, PortalTarget);
3431
- this.portalTarget = Object(external_Vue_["createApp"])(targetApp);
3432
- this.portalTarget.mount("#menu-target-".concat(this._uid));
3433
- },
3434
- teardown: function teardown() {
3435
- document.body.removeChild(this.portalTarget.$el);
3436
- this.portalTarget.$el.innerHTML = '';
3437
- this.portalTarget.$destroy();
3438
- this.portalTarget = null;
3439
- }
3440
- },
3441
- render: function render() {
3442
- var h = arguments[0];
3443
- if (!placeholder) placeholder = h("div", {
3444
- "class": "rp-treeselect__menu-placeholder"
3445
- });
3446
- return placeholder;
3447
- }
3448
- });
3449
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue?vue&type=script&lang=js
3450
- /* harmony default export */ var components_MenuPortalvue_type_script_lang_js = (MenuPortalvue_type_script_lang_js);
3451
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue
3452
- var MenuPortal_render, MenuPortal_staticRenderFns
3453
-
3454
-
3455
-
3456
-
3457
- /* normalize component */
3458
-
3459
- var MenuPortal_component = normalizeComponent(
3460
- components_MenuPortalvue_type_script_lang_js,
3461
- MenuPortal_render,
3462
- MenuPortal_staticRenderFns,
3463
- false,
3464
- null,
3465
- null,
3466
- null
3467
-
3468
- )
3469
-
3470
- /* harmony default export */ var MenuPortal = (MenuPortal_component.exports);
3471
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Treeselect.vue?vue&type=script&lang=js
3472
-
3473
-
3474
-
3475
- function Treeselectvue_type_script_lang_js_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3476
- function Treeselectvue_type_script_lang_js_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Treeselectvue_type_script_lang_js_ownKeys(Object(t), !0).forEach(function (r) { defineProperty_default()(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Treeselectvue_type_script_lang_js_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3477
-
3478
-
3479
-
3480
-
3481
-
3482
-
3483
-
3484
-
3485
- function sortValueByIndex(a, b) {
3486
- var i = 0;
3487
- do {
3488
- if (a.level < i) return -1;
3489
- if (b.level < i) return 1;
3490
- if (a.index[i] !== b.index[i]) return a.index[i] - b.index[i];
3491
- i++;
3492
- } while (true);
3493
- }
3494
- function sortValueByLevel(a, b) {
3495
- return a.level === b.level ? sortValueByIndex(a, b) : a.level - b.level;
3496
- }
3497
- function createAsyncOptionsStates() {
3498
- return {
3499
- isLoaded: false,
3500
- isLoading: false,
3501
- loadingError: ''
3502
- };
3503
- }
3504
- function stringifyOptionPropValue(value) {
3505
- if (typeof value === 'string') return value;
3506
- if (typeof value === 'number' && !isNaN_isNaN(value)) return value + '';
3507
- return '';
3508
- }
3509
- function match(enableFuzzyMatch, needle, haystack) {
3510
- return enableFuzzyMatch ? fuzzysearch_default()(needle, haystack) : includes(haystack, needle);
3511
- }
3512
- function getErrorMessage(err) {
3513
- return err.message || String(err);
3514
- }
3515
- var instanceId = 0;
3516
- /* harmony default export */ var Treeselectvue_type_script_lang_js = ({
3517
- name: 'rp-treeselect',
3518
- props: {
3519
- allowClearingDisabled: {
3520
- type: Boolean,
3521
- default: false
3522
- },
3523
- allowSelectingDisabledDescendants: {
3524
- type: Boolean,
3525
- default: false
3526
- },
3527
- alwaysOpen: {
3528
- type: Boolean,
3529
- default: false
3530
- },
3531
- appendToBody: {
3532
- type: Boolean,
3533
- default: false
3534
- },
3535
- async: {
3536
- type: Boolean,
3537
- default: false
3538
- },
3539
- autoFocus: {
3540
- type: Boolean,
3541
- default: false
3542
- },
3543
- autoLoadRootOptions: {
3544
- type: Boolean,
3545
- default: true
3546
- },
3547
- autoDeselectAncestors: {
3548
- type: Boolean,
3549
- default: false
3550
- },
3551
- autoDeselectDescendants: {
3552
- type: Boolean,
3553
- default: false
3554
- },
3555
- autoSelectAncestors: {
3556
- type: Boolean,
3557
- default: false
3558
- },
3559
- autoSelectDescendants: {
3560
- type: Boolean,
3561
- default: false
3562
- },
3563
- backspaceRemoves: {
3564
- type: Boolean,
3565
- default: true
3566
- },
3567
- beforeClearAll: {
3568
- type: Function,
3569
- default: constant_default()(true)
3570
- },
3571
- branchNodesFirst: {
3572
- type: Boolean,
3573
- default: false
3574
- },
3575
- cacheOptions: {
3576
- type: Boolean,
3577
- default: true
3578
- },
3579
- clearable: {
3580
- type: Boolean,
3581
- default: true
3582
- },
3583
- clearAllText: {
3584
- type: String,
3585
- default: 'Clear all'
3586
- },
3587
- clearOnSelect: {
3588
- type: Boolean,
3589
- default: false
3590
- },
3591
- clearValueText: {
3592
- type: String,
3593
- default: 'Clear value'
3594
- },
3595
- closeOnSelect: {
3596
- type: Boolean,
3597
- default: true
3598
- },
3599
- defaultExpandLevel: {
3600
- type: Number,
3601
- default: 0
3602
- },
3603
- defaultOptions: {
3604
- default: false
3605
- },
3606
- deleteRemoves: {
3607
- type: Boolean,
3608
- default: true
3609
- },
3610
- delimiter: {
3611
- type: String,
3612
- default: ','
3613
- },
3614
- flattenSearchResults: {
3615
- type: Boolean,
3616
- default: false
3617
- },
3618
- disableBranchNodes: {
3619
- type: Boolean,
3620
- default: false
3621
- },
3622
- disabled: {
3623
- type: Boolean,
3624
- default: false
3625
- },
3626
- disableFuzzyMatching: {
3627
- type: Boolean,
3628
- default: false
3629
- },
3630
- flat: {
3631
- type: Boolean,
3632
- default: false
3633
- },
3634
- instanceId: {
3635
- default: function _default() {
3636
- return "".concat(instanceId++, "$$");
3637
- },
3638
- type: [String, Number]
3639
- },
3640
- joinValues: {
3641
- type: Boolean,
3642
- default: false
3643
- },
3644
- limit: {
3645
- type: Number,
3646
- default: Infinity
3647
- },
3648
- limitText: {
3649
- type: Function,
3650
- default: function limitTextDefault(count) {
3651
- return "and ".concat(count, " more");
3652
- }
3653
- },
3654
- loadingText: {
3655
- type: String,
3656
- default: 'Loading...'
3657
- },
3658
- loadOptions: {
3659
- type: Function
3660
- },
3661
- matchKeys: {
3662
- type: Array,
3663
- default: constant_default()(['label'])
3664
- },
3665
- maxHeight: {
3666
- type: Number,
3667
- default: 300
3668
- },
3669
- multiple: {
3670
- type: Boolean,
3671
- default: false
3672
- },
3673
- name: {
3674
- type: String
3675
- },
3676
- noChildrenText: {
3677
- type: String,
3678
- default: 'No sub-options.'
3679
- },
3680
- noOptionsText: {
3681
- type: String,
3682
- default: 'No options available.'
3683
- },
3684
- noResultsText: {
3685
- type: String,
3686
- default: 'No results found...'
3687
- },
3688
- normalizer: {
3689
- type: Function,
3690
- default: identity_default.a
3691
- },
3692
- openDirection: {
3693
- type: String,
3694
- default: 'auto',
3695
- validator: function validator(value) {
3696
- var acceptableValues = ['auto', 'top', 'bottom', 'above', 'below'];
3697
- return includes(acceptableValues, value);
3698
- }
3699
- },
3700
- openOnClick: {
3701
- type: Boolean,
3702
- default: true
3703
- },
3704
- openOnFocus: {
3705
- type: Boolean,
3706
- default: false
3707
- },
3708
- options: {
3709
- type: Array
3710
- },
3711
- placeholder: {
3712
- type: String,
3713
- default: 'Select...'
3714
- },
3715
- required: {
3716
- type: Boolean,
3717
- default: false
3718
- },
3719
- retryText: {
3720
- type: String,
3721
- default: 'Retry?'
3722
- },
3723
- retryTitle: {
3724
- type: String,
3725
- default: 'Click to retry'
3726
- },
3727
- searchable: {
3728
- type: Boolean,
3729
- default: true
3730
- },
3731
- searchNested: {
3732
- type: Boolean,
3733
- default: false
3734
- },
3735
- searchPromptText: {
3736
- type: String,
3737
- default: 'Type to search...'
3738
- },
3739
- showCount: {
3740
- type: Boolean,
3741
- default: false
3742
- },
3743
- showCountOf: {
3744
- type: String,
3745
- default: ALL_CHILDREN,
3746
- validator: function validator(value) {
3747
- var acceptableValues = [ALL_CHILDREN, ALL_DESCENDANTS, LEAF_CHILDREN, LEAF_DESCENDANTS];
3748
- return includes(acceptableValues, value);
3749
- }
3750
- },
3751
- showCountOnSearch: null,
3752
- sortValueBy: {
3753
- type: String,
3754
- default: ORDER_SELECTED,
3755
- validator: function validator(value) {
3756
- var acceptableValues = [ORDER_SELECTED, LEVEL, INDEX];
3757
- return includes(acceptableValues, value);
3758
- }
3759
- },
3760
- tabIndex: {
3761
- type: Number,
3762
- default: 0
3763
- },
3764
- value: null,
3765
- valueConsistsOf: {
3766
- type: String,
3767
- default: BRANCH_PRIORITY,
3768
- validator: function validator(value) {
3769
- var acceptableValues = [ALL, BRANCH_PRIORITY, LEAF_PRIORITY, ALL_WITH_INDETERMINATE];
3770
- return includes(acceptableValues, value);
3771
- }
3772
- },
3773
- valueFormat: {
3774
- type: String,
3775
- default: 'id'
3776
- },
3777
- zIndex: {
3778
- type: [Number, String],
3779
- default: 999
3780
- }
3781
- },
3782
- data: function data() {
3783
- return {
3784
- trigger: {
3785
- isFocused: false,
3786
- searchQuery: ''
3787
- },
3788
- menu: {
3789
- isOpen: false,
3790
- current: null,
3791
- lastScrollPosition: 0,
3792
- placement: 'bottom'
3793
- },
3794
- forest: {
3795
- normalizedOptions: [],
3796
- nodeMap: createMap(),
3797
- checkedStateMap: createMap(),
3798
- selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
3799
- selectedNodeMap: createMap()
3800
- },
3801
- rootOptionsStates: createAsyncOptionsStates(),
3802
- localSearch: {
3803
- active: false,
3804
- noResults: true,
3805
- countMap: createMap()
3806
- },
3807
- remoteSearch: createMap()
3808
- };
3809
- },
3810
- computed: {
3811
- selectedNodes: function selectedNodes() {
3812
- return this.forest.selectedNodeIds.map(this.getNode);
3813
- },
3814
- internalValue: function internalValue() {
3815
- var _this = this;
3816
- var internalValue;
3817
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
3818
- internalValue = this.forest.selectedNodeIds.slice();
3819
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
3820
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
3821
- var node = _this.getNode(id);
3822
- if (node.isRootNode) return true;
3823
- return !_this.isSelected(node.parentNode);
3824
- });
3825
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
3826
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
3827
- var node = _this.getNode(id);
3828
- if (node.isLeaf) return true;
3829
- return node.children.length === 0;
3830
- });
3831
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
3832
- var _internalValue;
3833
- var indeterminateNodeIds = [];
3834
- internalValue = this.forest.selectedNodeIds.slice();
3835
- this.selectedNodes.forEach(function (selectedNode) {
3836
- selectedNode.ancestors.forEach(function (ancestor) {
3837
- if (includes(indeterminateNodeIds, ancestor.id)) return;
3838
- if (includes(internalValue, ancestor.id)) return;
3839
- indeterminateNodeIds.push(ancestor.id);
3840
- });
3841
- });
3842
- (_internalValue = internalValue).push.apply(_internalValue, indeterminateNodeIds);
3843
- }
3844
- if (this.sortValueBy === LEVEL) {
3845
- internalValue.sort(function (a, b) {
3846
- return sortValueByLevel(_this.getNode(a), _this.getNode(b));
3847
- });
3848
- } else if (this.sortValueBy === INDEX) {
3849
- internalValue.sort(function (a, b) {
3850
- return sortValueByIndex(_this.getNode(a), _this.getNode(b));
3851
- });
3852
- }
3853
- return internalValue;
3854
- },
3855
- hasValue: function hasValue() {
3856
- return this.internalValue.length > 0;
3857
- },
3858
- single: function single() {
3859
- return !this.multiple;
3860
- },
3861
- visibleOptionIds: function visibleOptionIds() {
3862
- var _this2 = this;
3863
- var visibleOptionIds = [];
3864
- this.traverseAllNodesByIndex(function (node) {
3865
- if (!_this2.localSearch.active || _this2.shouldOptionBeIncludedInSearchResult(node)) {
3866
- visibleOptionIds.push(node.id);
3867
- }
3868
- if (node.isBranch && !_this2.shouldExpand(node)) {
3869
- return false;
3870
- }
3871
- });
3872
- return visibleOptionIds;
3873
- },
3874
- hasVisibleOptions: function hasVisibleOptions() {
3875
- return this.visibleOptionIds.length !== 0;
3876
- },
3877
- showCountOnSearchComputed: function showCountOnSearchComputed() {
3878
- return typeof this.showCountOnSearch === 'boolean' ? this.showCountOnSearch : this.showCount;
3879
- },
3880
- hasBranchNodes: function hasBranchNodes() {
3881
- return this.forest.normalizedOptions.some(function (rootNode) {
3882
- return rootNode.isBranch;
3883
- });
3884
- },
3885
- shouldFlattenOptions: function shouldFlattenOptions() {
3886
- return this.localSearch.active && this.flattenSearchResults;
3887
- },
3888
- wrapperClass: function wrapperClass() {
3889
- return {
3890
- 'rp-treeselect': true,
3891
- 'rp-treeselect--single': this.single,
3892
- 'rp-treeselect--multi': this.multiple,
3893
- 'rp-treeselect--searchable': this.searchable,
3894
- 'rp-treeselect--disabled': this.disabled,
3895
- 'rp-treeselect--focused': this.trigger.isFocused,
3896
- 'rp-treeselect--has-value': this.hasValue,
3897
- 'rp-treeselect--open': this.menu.isOpen,
3898
- 'rp-treeselect--open-above': this.menu.placement === 'top',
3899
- 'rp-treeselect--open-below': this.menu.placement === 'bottom',
3900
- 'rp-treeselect--branch-nodes-disabled': this.disableBranchNodes,
3901
- 'rp-treeselect--append-to-body': this.appendToBody,
3902
- 'rp-treeselect--test': true
3903
- };
3904
- }
3905
- },
3906
- watch: {
3907
- alwaysOpen: function alwaysOpen(newValue) {
3908
- if (newValue) this.openMenu();else this.closeMenu();
3909
- },
3910
- branchNodesFirst: function branchNodesFirst() {
3911
- this.initialize();
3912
- },
3913
- disabled: function disabled(newValue) {
3914
- if (newValue && this.menu.isOpen) this.closeMenu();else if (!newValue && !this.menu.isOpen && this.alwaysOpen) this.openMenu();
3915
- },
3916
- flat: function flat() {
3917
- this.initialize();
3918
- },
3919
- internalValue: function internalValue(newValue, oldValue) {
3920
- var hasChanged = quickDiff(newValue, oldValue);
3921
- if (hasChanged) this.$emit('input', this.getValue(), this.getInstanceId());
3922
- },
3923
- matchKeys: function matchKeys() {
3924
- this.initialize();
3925
- },
3926
- multiple: function multiple(newValue) {
3927
- if (newValue) this.buildForestState();
3928
- },
3929
- options: {
3930
- handler: function handler() {
3931
- if (this.async) return;
3932
- this.initialize();
3933
- this.rootOptionsStates.isLoaded = Array.isArray(this.options);
3934
- },
3935
- deep: true,
3936
- immediate: true
3937
- },
3938
- 'trigger.searchQuery': function triggerSearchQuery() {
3939
- if (this.async) {
3940
- this.handleRemoteSearch();
3941
- } else {
3942
- this.handleLocalSearch();
3943
- }
3944
- this.$emit('search-change', this.trigger.searchQuery, this.getInstanceId());
3945
- },
3946
- value: function value() {
3947
- var nodeIdsFromValue = this.extractCheckedNodeIdsFromValue();
3948
- var hasChanged = quickDiff(nodeIdsFromValue, this.internalValue);
3949
- if (hasChanged) this.fixSelectedNodeIds(nodeIdsFromValue);
3950
- }
3951
- },
3952
- created: function created() {
3953
- this.verifyProps();
3954
- this.resetFlags();
3955
- Object(external_Vue_["provide"])('instance', this);
3956
- },
3957
- mounted: function mounted() {
3958
- console.log('TREESELECT');
3959
- if (this.autoFocus) this.focusInput();
3960
- if (!this.options && !this.async && this.autoLoadRootOptions) this.loadRootOptions();
3961
- if (this.alwaysOpen) this.openMenu();
3962
- if (this.async && this.defaultOptions) this.handleRemoteSearch();
3963
- },
3964
- destroyed: function destroyed() {
3965
- this.toggleClickOutsideEvent(false);
3966
- },
3967
- methods: {
3968
- verifyProps: function verifyProps() {
3969
- var _this3 = this;
3970
- warning_warning(function () {
3971
- return _this3.async ? _this3.searchable : true;
3972
- }, function () {
3973
- return 'For async search mode, the value of "searchable" prop must be true.';
3974
- });
3975
- if (this.options == null && !this.loadOptions) {
3976
- warning_warning(function () {
3977
- return false;
3978
- }, function () {
3979
- return 'Are you meant to dynamically load options? You need to use "loadOptions" prop.';
3980
- });
3981
- }
3982
- if (this.flat) {
3983
- warning_warning(function () {
3984
- return _this3.multiple;
3985
- }, function () {
3986
- return 'You are using flat mode. But you forgot to add "multiple=true"?';
3987
- });
3988
- }
3989
- if (!this.flat) {
3990
- var propNames = ['autoSelectAncestors', 'autoSelectDescendants', 'autoDeselectAncestors', 'autoDeselectDescendants'];
3991
- propNames.forEach(function (propName) {
3992
- warning_warning(function () {
3993
- return !_this3[propName];
3994
- }, function () {
3995
- return "\"".concat(propName, "\" only applies to flat mode.");
3996
- });
3997
- });
3998
- }
3999
- },
4000
- resetFlags: function resetFlags() {
4001
- this._blurOnSelect = false;
4002
- },
4003
- initialize: function initialize() {
4004
- var options = this.async ? this.getRemoteSearchEntry().options : this.options;
4005
- if (Array.isArray(options)) {
4006
- var prevNodeMap = this.forest.nodeMap;
4007
- this.forest.nodeMap = createMap();
4008
- this.keepDataOfSelectedNodes(prevNodeMap);
4009
- this.forest.normalizedOptions = this.normalize(NO_PARENT_NODE, options, prevNodeMap);
4010
- this.fixSelectedNodeIds(this.internalValue);
4011
- } else {
4012
- this.forest.normalizedOptions = [];
4013
- }
4014
- },
4015
- getInstanceId: function getInstanceId() {
4016
- return this.instanceId == null ? this.id : this.instanceId;
4017
- },
4018
- getValue: function getValue() {
4019
- var _this4 = this;
4020
- if (this.valueFormat === 'id') {
4021
- return this.multiple ? this.internalValue.slice() : this.internalValue[0];
4022
- }
4023
- var rawNodes = this.internalValue.map(function (id) {
4024
- return _this4.getNode(id).raw;
4025
- });
4026
- return this.multiple ? rawNodes : rawNodes[0];
4027
- },
4028
- getNode: function getNode(nodeId) {
4029
- warning_warning(function () {
4030
- return nodeId != null;
4031
- }, function () {
4032
- return "Invalid node id: ".concat(nodeId);
4033
- });
4034
- if (nodeId == null) return null;
4035
- return nodeId in this.forest.nodeMap ? this.forest.nodeMap[nodeId] : this.createFallbackNode(nodeId);
4036
- },
4037
- createFallbackNode: function createFallbackNode(id) {
4038
- var raw = this.extractNodeFromValue(id);
4039
- var label = this.enhancedNormalizer(raw).label || "".concat(id, " (unknown)");
4040
- var fallbackNode = {
4041
- id: id,
4042
- label: label,
4043
- ancestors: [],
4044
- parentNode: NO_PARENT_NODE,
4045
- isFallbackNode: true,
4046
- isRootNode: true,
4047
- isLeaf: true,
4048
- isBranch: false,
4049
- isDisabled: false,
4050
- isNew: false,
4051
- index: [-1],
4052
- level: 0,
4053
- raw: raw
4054
- };
4055
- return this.$set(this.forest.nodeMap, id, fallbackNode);
4056
- },
4057
- extractCheckedNodeIdsFromValue: function extractCheckedNodeIdsFromValue() {
4058
- var _this5 = this;
4059
- if (this.value == null) return [];
4060
- if (this.valueFormat === 'id') {
4061
- return this.multiple ? this.value.slice() : [this.value];
4062
- }
4063
- return (this.multiple ? this.value : [this.value]).map(function (node) {
4064
- return _this5.enhancedNormalizer(node);
4065
- }).map(function (node) {
4066
- return node.id;
4067
- });
4068
- },
4069
- extractNodeFromValue: function extractNodeFromValue(id) {
4070
- var _this6 = this;
4071
- var defaultNode = {
4072
- id: id
4073
- };
4074
- if (this.valueFormat === 'id') {
4075
- return defaultNode;
4076
- }
4077
- var valueArray = this.multiple ? Array.isArray(this.value) ? this.value : [] : this.value ? [this.value] : [];
4078
- var matched = find(valueArray, function (node) {
4079
- return node && _this6.enhancedNormalizer(node).id === id;
4080
- });
4081
- return matched || defaultNode;
4082
- },
4083
- fixSelectedNodeIds: function fixSelectedNodeIds(nodeIdListOfPrevValue) {
4084
- var _this7 = this;
4085
- var nextSelectedNodeIds = [];
4086
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
4087
- nextSelectedNodeIds = nodeIdListOfPrevValue;
4088
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
4089
- nodeIdListOfPrevValue.forEach(function (nodeId) {
4090
- nextSelectedNodeIds.push(nodeId);
4091
- var node = _this7.getNode(nodeId);
4092
- if (node.isBranch) _this7.traverseDescendantsBFS(node, function (descendant) {
4093
- nextSelectedNodeIds.push(descendant.id);
4094
- });
4095
- });
4096
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
4097
- var map = createMap();
4098
- var queue = nodeIdListOfPrevValue.slice();
4099
- while (queue.length) {
4100
- var nodeId = queue.shift();
4101
- var node = this.getNode(nodeId);
4102
- nextSelectedNodeIds.push(nodeId);
4103
- if (node.isRootNode) continue;
4104
- if (!(node.parentNode.id in map)) map[node.parentNode.id] = node.parentNode.children.length;
4105
- if (--map[node.parentNode.id] === 0) queue.push(node.parentNode.id);
4106
- }
4107
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
4108
- var _map = createMap();
4109
- var _queue = nodeIdListOfPrevValue.filter(function (nodeId) {
4110
- var node = _this7.getNode(nodeId);
4111
- return node.isLeaf || node.children.length === 0;
4112
- });
4113
- while (_queue.length) {
4114
- var _nodeId = _queue.shift();
4115
- var _node = this.getNode(_nodeId);
4116
- nextSelectedNodeIds.push(_nodeId);
4117
- if (_node.isRootNode) continue;
4118
- if (!(_node.parentNode.id in _map)) _map[_node.parentNode.id] = _node.parentNode.children.length;
4119
- if (--_map[_node.parentNode.id] === 0) _queue.push(_node.parentNode.id);
4120
- }
4121
- }
4122
- var hasChanged = quickDiff(this.forest.selectedNodeIds, nextSelectedNodeIds);
4123
- if (hasChanged) this.forest.selectedNodeIds = nextSelectedNodeIds;
4124
- this.buildForestState();
4125
- },
4126
- keepDataOfSelectedNodes: function keepDataOfSelectedNodes(prevNodeMap) {
4127
- var _this8 = this;
4128
- this.forest.selectedNodeIds.forEach(function (id) {
4129
- if (!prevNodeMap[id]) return;
4130
- var node = Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, prevNodeMap[id]), {}, {
4131
- isFallbackNode: true
4132
- });
4133
- _this8.$set(_this8.forest.nodeMap, id, node);
4134
- });
4135
- },
4136
- isSelected: function isSelected(node) {
4137
- return this.forest.selectedNodeMap[node.id] === true;
4138
- },
4139
- traverseDescendantsBFS: function traverseDescendantsBFS(parentNode, callback) {
4140
- if (!parentNode.isBranch) return;
4141
- var queue = parentNode.children.slice();
4142
- while (queue.length) {
4143
- var currNode = queue[0];
4144
- if (currNode.isBranch) queue.push.apply(queue, toConsumableArray_default()(currNode.children));
4145
- callback(currNode);
4146
- queue.shift();
4147
- }
4148
- },
4149
- traverseDescendantsDFS: function traverseDescendantsDFS(parentNode, callback) {
4150
- var _this9 = this;
4151
- if (!parentNode.isBranch) return;
4152
- parentNode.children.forEach(function (child) {
4153
- _this9.traverseDescendantsDFS(child, callback);
4154
- callback(child);
4155
- });
4156
- },
4157
- traverseAllNodesDFS: function traverseAllNodesDFS(callback) {
4158
- var _this10 = this;
4159
- this.forest.normalizedOptions.forEach(function (rootNode) {
4160
- _this10.traverseDescendantsDFS(rootNode, callback);
4161
- callback(rootNode);
4162
- });
4163
- },
4164
- traverseAllNodesByIndex: function traverseAllNodesByIndex(callback) {
4165
- var walk = function walk(parentNode) {
4166
- parentNode.children.forEach(function (child) {
4167
- if (callback(child) !== false && child.isBranch) {
4168
- walk(child);
4169
- }
4170
- });
4171
- };
4172
- walk({
4173
- children: this.forest.normalizedOptions
4174
- });
4175
- },
4176
- toggleClickOutsideEvent: function toggleClickOutsideEvent(enabled) {
4177
- if (enabled) {
4178
- document.addEventListener('mousedown', this.handleClickOutside, false);
4179
- } else {
4180
- document.removeEventListener('mousedown', this.handleClickOutside, false);
4181
- }
4182
- },
4183
- getValueContainer: function getValueContainer() {
4184
- return this.$refs.control.$refs['value-container'];
4185
- },
4186
- getInput: function getInput() {
4187
- return this.getValueContainer().$refs.input;
4188
- },
4189
- focusInput: function focusInput() {
4190
- this.getInput().focus();
4191
- },
4192
- blurInput: function blurInput() {
4193
- this.getInput().blur();
4194
- },
4195
- handleMouseDown: onLeftClick(function handleMouseDown(evt) {
4196
- evt.preventDefault();
4197
- evt.stopPropagation();
4198
- if (this.disabled) return;
4199
- var isClickedOnValueContainer = this.getValueContainer().$el.contains(evt.target);
4200
- if (isClickedOnValueContainer && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused)) {
4201
- this.openMenu();
4202
- }
4203
- if (this._blurOnSelect) {
4204
- this.blurInput();
4205
- } else {
4206
- this.focusInput();
4207
- }
4208
- this.resetFlags();
4209
- }),
4210
- handleClickOutside: function handleClickOutside(evt) {
4211
- if (this.$refs.wrapper && !this.$refs.wrapper.contains(evt.target)) {
4212
- this.blurInput();
4213
- this.closeMenu();
4214
- }
4215
- },
4216
- handleLocalSearch: function handleLocalSearch() {
4217
- var _this11 = this;
4218
- var searchQuery = this.trigger.searchQuery;
4219
- var done = function done() {
4220
- return _this11.resetHighlightedOptionWhenNecessary(true);
4221
- };
4222
- if (!searchQuery) {
4223
- this.localSearch.active = false;
4224
- return done();
4225
- }
4226
- this.localSearch.active = true;
4227
- this.localSearch.noResults = true;
4228
- this.traverseAllNodesDFS(function (node) {
4229
- if (node.isBranch) {
4230
- node.isExpandedOnSearch = false;
4231
- node.showAllChildrenOnSearch = false;
4232
- node.isMatched = false;
4233
- node.hasMatchedDescendants = false;
4234
- _this11.$set(_this11.localSearch.countMap, node.id, defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, ALL_CHILDREN, 0), ALL_DESCENDANTS, 0), LEAF_CHILDREN, 0), LEAF_DESCENDANTS, 0));
4235
- }
4236
- });
4237
- var lowerCasedSearchQuery = searchQuery.trim().toLocaleLowerCase();
4238
- var splitSearchQuery = lowerCasedSearchQuery.replace(/\s+/g, ' ').split(' ');
4239
- this.traverseAllNodesDFS(function (node) {
4240
- if (_this11.searchNested && splitSearchQuery.length > 1) {
4241
- node.isMatched = splitSearchQuery.every(function (filterValue) {
4242
- return match(false, filterValue, node.nestedSearchLabel);
4243
- });
4244
- } else {
4245
- node.isMatched = _this11.matchKeys.some(function (matchKey) {
4246
- return match(!_this11.disableFuzzyMatching, lowerCasedSearchQuery, node.lowerCased[matchKey]);
4247
- });
4248
- }
4249
- if (node.isMatched) {
4250
- _this11.localSearch.noResults = false;
4251
- node.ancestors.forEach(function (ancestor) {
4252
- return _this11.localSearch.countMap[ancestor.id][ALL_DESCENDANTS]++;
4253
- });
4254
- if (node.isLeaf) node.ancestors.forEach(function (ancestor) {
4255
- return _this11.localSearch.countMap[ancestor.id][LEAF_DESCENDANTS]++;
4256
- });
4257
- if (node.parentNode !== NO_PARENT_NODE) {
4258
- _this11.localSearch.countMap[node.parentNode.id][ALL_CHILDREN] += 1;
4259
- if (node.isLeaf) _this11.localSearch.countMap[node.parentNode.id][LEAF_CHILDREN] += 1;
4260
- }
4261
- }
4262
- if ((node.isMatched || node.isBranch && node.isExpandedOnSearch) && node.parentNode !== NO_PARENT_NODE) {
4263
- node.parentNode.isExpandedOnSearch = true;
4264
- node.parentNode.hasMatchedDescendants = true;
4265
- }
4266
- });
4267
- done();
4268
- },
4269
- handleRemoteSearch: function handleRemoteSearch() {
4270
- var _this12 = this;
4271
- var searchQuery = this.trigger.searchQuery;
4272
- var entry = this.getRemoteSearchEntry();
4273
- var done = function done() {
4274
- _this12.initialize();
4275
- _this12.resetHighlightedOptionWhenNecessary(true);
4276
- };
4277
- if ((searchQuery === '' || this.cacheOptions) && entry.isLoaded) {
4278
- return done();
4279
- }
4280
- this.callLoadOptionsProp({
4281
- action: ASYNC_SEARCH,
4282
- args: {
4283
- searchQuery: searchQuery
4284
- },
4285
- isPending: function isPending() {
4286
- return entry.isLoading;
4287
- },
4288
- start: function start() {
4289
- entry.isLoading = true;
4290
- entry.isLoaded = false;
4291
- entry.loadingError = '';
4292
- },
4293
- succeed: function succeed(options) {
4294
- entry.isLoaded = true;
4295
- entry.options = options;
4296
- if (_this12.trigger.searchQuery === searchQuery) done();
4297
- },
4298
- fail: function fail(err) {
4299
- entry.loadingError = getErrorMessage(err);
4300
- },
4301
- end: function end() {
4302
- entry.isLoading = false;
4303
- }
4304
- });
4305
- },
4306
- getRemoteSearchEntry: function getRemoteSearchEntry() {
4307
- var _this13 = this;
4308
- var searchQuery = this.trigger.searchQuery;
4309
- var entry = this.remoteSearch[searchQuery] || Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, createAsyncOptionsStates()), {}, {
4310
- options: []
4311
- });
4312
- this.$watch(function () {
4313
- return entry.options;
4314
- }, function () {
4315
- if (_this13.trigger.searchQuery === searchQuery) _this13.initialize();
4316
- }, {
4317
- deep: true
4318
- });
4319
- if (searchQuery === '') {
4320
- if (Array.isArray(this.defaultOptions)) {
4321
- entry.options = this.defaultOptions;
4322
- entry.isLoaded = true;
4323
- return entry;
4324
- } else if (this.defaultOptions !== true) {
4325
- entry.isLoaded = true;
4326
- return entry;
4327
- }
4328
- }
4329
- if (!this.remoteSearch[searchQuery]) {
4330
- this.$set(this.remoteSearch, searchQuery, entry);
4331
- }
4332
- return entry;
4333
- },
4334
- shouldExpand: function shouldExpand(node) {
4335
- return this.localSearch.active ? node.isExpandedOnSearch : node.isExpanded;
4336
- },
4337
- shouldOptionBeIncludedInSearchResult: function shouldOptionBeIncludedInSearchResult(node) {
4338
- if (node.isMatched) return true;
4339
- if (node.isBranch && node.hasMatchedDescendants && !this.flattenSearchResults) return true;
4340
- if (!node.isRootNode && node.parentNode.showAllChildrenOnSearch) return true;
4341
- return false;
4342
- },
4343
- shouldShowOptionInMenu: function shouldShowOptionInMenu(node) {
4344
- if (this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(node)) {
4345
- return false;
4346
- }
4347
- return true;
4348
- },
4349
- getControl: function getControl() {
4350
- return this.$refs.control.$el;
4351
- },
4352
- getMenu: function getMenu() {
4353
- var ref = this.appendToBody ? this.$refs.portal.portalTarget : this;
4354
- var $menu = ref.$refs.menu.$refs.menu;
4355
- return $menu && $menu.nodeName !== '#comment' ? $menu : null;
4356
- },
4357
- setCurrentHighlightedOption: function setCurrentHighlightedOption(node) {
4358
- var _this14 = this;
4359
- var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4360
- var prev = this.menu.current;
4361
- if (prev != null && prev in this.forest.nodeMap) {
4362
- this.forest.nodeMap[prev].isHighlighted = false;
4363
- }
4364
- this.menu.current = node.id;
4365
- node.isHighlighted = true;
4366
- if (this.menu.isOpen && scroll) {
4367
- var scrollToOption = function scrollToOption() {
4368
- var $menu = _this14.getMenu();
4369
- var $option = $menu.querySelector(".rp-treeselect__option[data-id=\"".concat(node.id, "\"]"));
4370
- if ($option) scrollIntoView($menu, $option);
4371
- };
4372
- if (this.getMenu()) {
4373
- scrollToOption();
4374
- } else {
4375
- this.$nextTick(scrollToOption);
4376
- }
4377
- }
4378
- },
4379
- resetHighlightedOptionWhenNecessary: function resetHighlightedOptionWhenNecessary() {
4380
- var forceReset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4381
- var current = this.menu.current;
4382
- if (forceReset || current == null || !(current in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(current))) {
4383
- this.highlightFirstOption();
4384
- }
4385
- },
4386
- highlightFirstOption: function highlightFirstOption() {
4387
- if (!this.hasVisibleOptions) return;
4388
- var first = this.visibleOptionIds[0];
4389
- this.setCurrentHighlightedOption(this.getNode(first));
4390
- },
4391
- highlightPrevOption: function highlightPrevOption() {
4392
- if (!this.hasVisibleOptions) return;
4393
- var prev = this.visibleOptionIds.indexOf(this.menu.current) - 1;
4394
- if (prev === -1) return this.highlightLastOption();
4395
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[prev]));
4396
- },
4397
- highlightNextOption: function highlightNextOption() {
4398
- if (!this.hasVisibleOptions) return;
4399
- var next = this.visibleOptionIds.indexOf(this.menu.current) + 1;
4400
- if (next === this.visibleOptionIds.length) return this.highlightFirstOption();
4401
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[next]));
4402
- },
4403
- highlightLastOption: function highlightLastOption() {
4404
- if (!this.hasVisibleOptions) return;
4405
- var last = last_default()(this.visibleOptionIds);
4406
- this.setCurrentHighlightedOption(this.getNode(last));
4407
- },
4408
- resetSearchQuery: function resetSearchQuery() {
4409
- this.trigger.searchQuery = '';
4410
- },
4411
- closeMenu: function closeMenu() {
4412
- if (!this.menu.isOpen || !this.disabled && this.alwaysOpen) return;
4413
- this.saveMenuScrollPosition();
4414
- this.menu.isOpen = false;
4415
- this.toggleClickOutsideEvent(false);
4416
- this.resetSearchQuery();
4417
- this.$emit('close', this.getValue(), this.getInstanceId());
4418
- },
4419
- openMenu: function openMenu() {
4420
- if (this.disabled || this.menu.isOpen) return;
4421
- this.menu.isOpen = true;
4422
- this.$nextTick(this.resetHighlightedOptionWhenNecessary);
4423
- this.$nextTick(this.restoreMenuScrollPosition);
4424
- if (!this.options && !this.async) this.loadRootOptions();
4425
- this.toggleClickOutsideEvent(true);
4426
- this.$emit('open', this.getInstanceId());
4427
- },
4428
- toggleMenu: function toggleMenu() {
4429
- if (this.menu.isOpen) {
4430
- this.closeMenu();
4431
- } else {
4432
- this.openMenu();
4433
- }
4434
- },
4435
- toggleExpanded: function toggleExpanded(node) {
4436
- var nextState;
4437
- if (this.localSearch.active) {
4438
- nextState = node.isExpandedOnSearch = !node.isExpandedOnSearch;
4439
- if (nextState) node.showAllChildrenOnSearch = true;
4440
- } else {
4441
- nextState = node.isExpanded = !node.isExpanded;
4442
- }
4443
- if (nextState && !node.childrenStates.isLoaded) {
4444
- this.loadChildrenOptions(node);
4445
- }
4446
- },
4447
- buildForestState: function buildForestState() {
4448
- var _this15 = this;
4449
- var selectedNodeMap = createMap();
4450
- this.forest.selectedNodeIds.forEach(function (selectedNodeId) {
4451
- selectedNodeMap[selectedNodeId] = true;
4452
- });
4453
- this.forest.selectedNodeMap = selectedNodeMap;
4454
- var checkedStateMap = createMap();
4455
- if (this.multiple) {
4456
- this.traverseAllNodesByIndex(function (node) {
4457
- checkedStateMap[node.id] = UNCHECKED;
4458
- });
4459
- this.selectedNodes.forEach(function (selectedNode) {
4460
- checkedStateMap[selectedNode.id] = CHECKED;
4461
- if (!_this15.flat && !_this15.disableBranchNodes) {
4462
- selectedNode.ancestors.forEach(function (ancestorNode) {
4463
- if (!_this15.isSelected(ancestorNode)) {
4464
- checkedStateMap[ancestorNode.id] = INDETERMINATE;
4465
- }
4466
- });
4467
- }
4468
- });
4469
- }
4470
- this.forest.checkedStateMap = checkedStateMap;
4471
- },
4472
- enhancedNormalizer: function enhancedNormalizer(raw) {
4473
- return Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, raw), this.normalizer(raw, this.getInstanceId()));
4474
- },
4475
- normalize: function normalize(parentNode, nodes, prevNodeMap) {
4476
- var _this16 = this;
4477
- var normalizedOptions = nodes.map(function (node) {
4478
- return [_this16.enhancedNormalizer(node), node];
4479
- }).map(function (_ref, index) {
4480
- var _ref2 = slicedToArray_default()(_ref, 2),
4481
- node = _ref2[0],
4482
- raw = _ref2[1];
4483
- _this16.checkDuplication(node);
4484
- _this16.verifyNodeShape(node);
4485
- var id = node.id,
4486
- label = node.label,
4487
- children = node.children,
4488
- isDefaultExpanded = node.isDefaultExpanded;
4489
- var isRootNode = parentNode === NO_PARENT_NODE;
4490
- var level = isRootNode ? 0 : parentNode.level + 1;
4491
- var isBranch = Array.isArray(children) || children === null;
4492
- var isLeaf = !isBranch;
4493
- var isDisabled = !!node.isDisabled || !_this16.flat && !isRootNode && parentNode.isDisabled;
4494
- var isNew = !!node.isNew;
4495
- var lowerCased = _this16.matchKeys.reduce(function (prev, key) {
4496
- return Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, prev), {}, defineProperty_default()({}, key, stringifyOptionPropValue(node[key]).toLocaleLowerCase()));
4497
- }, {});
4498
- var nestedSearchLabel = isRootNode ? lowerCased.label : parentNode.nestedSearchLabel + ' ' + lowerCased.label;
4499
- var normalized = _this16.$set(_this16.forest.nodeMap, id, createMap());
4500
- _this16.$set(normalized, 'id', id);
4501
- _this16.$set(normalized, 'label', label);
4502
- _this16.$set(normalized, 'level', level);
4503
- _this16.$set(normalized, 'ancestors', isRootNode ? [] : [parentNode].concat(parentNode.ancestors));
4504
- _this16.$set(normalized, 'index', (isRootNode ? [] : parentNode.index).concat(index));
4505
- _this16.$set(normalized, 'parentNode', parentNode);
4506
- _this16.$set(normalized, 'lowerCased', lowerCased);
4507
- _this16.$set(normalized, 'nestedSearchLabel', nestedSearchLabel);
4508
- _this16.$set(normalized, 'isDisabled', isDisabled);
4509
- _this16.$set(normalized, 'isNew', isNew);
4510
- _this16.$set(normalized, 'isMatched', false);
4511
- _this16.$set(normalized, 'isHighlighted', false);
4512
- _this16.$set(normalized, 'isBranch', isBranch);
4513
- _this16.$set(normalized, 'isLeaf', isLeaf);
4514
- _this16.$set(normalized, 'isRootNode', isRootNode);
4515
- _this16.$set(normalized, 'raw', raw);
4516
- if (isBranch) {
4517
- var isLoaded = Array.isArray(children);
4518
- _this16.$set(normalized, 'childrenStates', Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, createAsyncOptionsStates()), {}, {
4519
- isLoaded: isLoaded
4520
- }));
4521
- _this16.$set(normalized, 'isExpanded', typeof isDefaultExpanded === 'boolean' ? isDefaultExpanded : level < _this16.defaultExpandLevel);
4522
- _this16.$set(normalized, 'hasMatchedDescendants', false);
4523
- _this16.$set(normalized, 'hasDisabledDescendants', false);
4524
- _this16.$set(normalized, 'isExpandedOnSearch', false);
4525
- _this16.$set(normalized, 'showAllChildrenOnSearch', false);
4526
- _this16.$set(normalized, 'count', defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, ALL_CHILDREN, 0), ALL_DESCENDANTS, 0), LEAF_CHILDREN, 0), LEAF_DESCENDANTS, 0));
4527
- _this16.$set(normalized, 'children', isLoaded ? _this16.normalize(normalized, children, prevNodeMap) : []);
4528
- if (isDefaultExpanded === true) normalized.ancestors.forEach(function (ancestor) {
4529
- ancestor.isExpanded = true;
4530
- });
4531
- if (!isLoaded && typeof _this16.loadOptions !== 'function') {
4532
- warning_warning(function () {
4533
- return false;
4534
- }, function () {
4535
- return 'Unloaded branch node detected. "loadOptions" prop is required to load its children.';
4536
- });
4537
- } else if (!isLoaded && normalized.isExpanded) {
4538
- _this16.loadChildrenOptions(normalized);
4539
- }
4540
- }
4541
- normalized.ancestors.forEach(function (ancestor) {
4542
- return ancestor.count[ALL_DESCENDANTS]++;
4543
- });
4544
- if (isLeaf) normalized.ancestors.forEach(function (ancestor) {
4545
- return ancestor.count[LEAF_DESCENDANTS]++;
4546
- });
4547
- if (!isRootNode) {
4548
- parentNode.count[ALL_CHILDREN] += 1;
4549
- if (isLeaf) parentNode.count[LEAF_CHILDREN] += 1;
4550
- if (isDisabled) parentNode.hasDisabledDescendants = true;
4551
- }
4552
- if (prevNodeMap && prevNodeMap[id]) {
4553
- var prev = prevNodeMap[id];
4554
- normalized.isMatched = prev.isMatched;
4555
- normalized.showAllChildrenOnSearch = prev.showAllChildrenOnSearch;
4556
- normalized.isHighlighted = prev.isHighlighted;
4557
- if (prev.isBranch && normalized.isBranch) {
4558
- normalized.isExpanded = prev.isExpanded;
4559
- normalized.isExpandedOnSearch = prev.isExpandedOnSearch;
4560
- if (prev.childrenStates.isLoaded && !normalized.childrenStates.isLoaded) {
4561
- normalized.isExpanded = false;
4562
- } else {
4563
- normalized.childrenStates = Treeselectvue_type_script_lang_js_objectSpread({}, prev.childrenStates);
4564
- }
4565
- }
4566
- }
4567
- return normalized;
4568
- });
4569
- if (this.branchNodesFirst) {
4570
- var branchNodes = normalizedOptions.filter(function (option) {
4571
- return option.isBranch;
4572
- });
4573
- var leafNodes = normalizedOptions.filter(function (option) {
4574
- return option.isLeaf;
4575
- });
4576
- normalizedOptions = branchNodes.concat(leafNodes);
4577
- }
4578
- return normalizedOptions;
4579
- },
4580
- loadRootOptions: function loadRootOptions() {
4581
- var _this17 = this;
4582
- this.callLoadOptionsProp({
4583
- action: LOAD_ROOT_OPTIONS,
4584
- isPending: function isPending() {
4585
- return _this17.rootOptionsStates.isLoading;
4586
- },
4587
- start: function start() {
4588
- _this17.rootOptionsStates.isLoading = true;
4589
- _this17.rootOptionsStates.loadingError = '';
4590
- },
4591
- succeed: function succeed() {
4592
- _this17.rootOptionsStates.isLoaded = true;
4593
- _this17.$nextTick(function () {
4594
- _this17.resetHighlightedOptionWhenNecessary(true);
4595
- });
4596
- },
4597
- fail: function fail(err) {
4598
- _this17.rootOptionsStates.loadingError = getErrorMessage(err);
4599
- },
4600
- end: function end() {
4601
- _this17.rootOptionsStates.isLoading = false;
4602
- }
4603
- });
4604
- },
4605
- loadChildrenOptions: function loadChildrenOptions(parentNode) {
4606
- var _this18 = this;
4607
- var id = parentNode.id,
4608
- raw = parentNode.raw;
4609
- this.callLoadOptionsProp({
4610
- action: LOAD_CHILDREN_OPTIONS,
4611
- args: {
4612
- parentNode: raw
4613
- },
4614
- isPending: function isPending() {
4615
- return _this18.getNode(id).childrenStates.isLoading;
4616
- },
4617
- start: function start() {
4618
- _this18.getNode(id).childrenStates.isLoading = true;
4619
- _this18.getNode(id).childrenStates.loadingError = '';
4620
- },
4621
- succeed: function succeed() {
4622
- _this18.getNode(id).childrenStates.isLoaded = true;
4623
- },
4624
- fail: function fail(err) {
4625
- _this18.getNode(id).childrenStates.loadingError = getErrorMessage(err);
4626
- },
4627
- end: function end() {
4628
- _this18.getNode(id).childrenStates.isLoading = false;
4629
- }
4630
- });
4631
- },
4632
- callLoadOptionsProp: function callLoadOptionsProp(_ref3) {
4633
- var action = _ref3.action,
4634
- args = _ref3.args,
4635
- isPending = _ref3.isPending,
4636
- start = _ref3.start,
4637
- succeed = _ref3.succeed,
4638
- fail = _ref3.fail,
4639
- end = _ref3.end;
4640
- if (!this.loadOptions || isPending()) {
4641
- return;
4642
- }
4643
- start();
4644
- var callback = once_default()(function (err, result) {
4645
- if (err) {
4646
- fail(err);
4647
- } else {
4648
- succeed(result);
4649
- }
4650
- end();
4651
- });
4652
- var result = this.loadOptions(Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({
4653
- id: this.getInstanceId(),
4654
- instanceId: this.getInstanceId(),
4655
- action: action
4656
- }, args), {}, {
4657
- callback: callback
4658
- }));
4659
- if (is_promise_default()(result)) {
4660
- result.then(function () {
4661
- callback();
4662
- }, function (err) {
4663
- callback(err);
4664
- }).catch(function (err) {
4665
- console.error(err);
4666
- });
4667
- }
4668
- },
4669
- checkDuplication: function checkDuplication(node) {
4670
- var _this19 = this;
4671
- warning_warning(function () {
4672
- return !(node.id in _this19.forest.nodeMap && !_this19.forest.nodeMap[node.id].isFallbackNode);
4673
- }, function () {
4674
- return "Detected duplicate presence of node id ".concat(JSON.stringify(node.id), ". ") + "Their labels are \"".concat(_this19.forest.nodeMap[node.id].label, "\" and \"").concat(node.label, "\" respectively.");
4675
- });
4676
- },
4677
- verifyNodeShape: function verifyNodeShape(node) {
4678
- warning_warning(function () {
4679
- return !(node.children === undefined && node.isBranch === true);
4680
- }, function () {
4681
- return 'Are you meant to declare an unloaded branch node? ' + '`isBranch: true` is no longer supported, please use `children: null` instead.';
4682
- });
4683
- },
4684
- select: function select(node) {
4685
- if (this.disabled || node.isDisabled) {
4686
- return;
4687
- }
4688
- if (this.single) {
4689
- this.clear();
4690
- }
4691
- var nextState = this.multiple && !this.flat ? this.forest.checkedStateMap[node.id] === UNCHECKED : !this.isSelected(node);
4692
- if (nextState) {
4693
- this._selectNode(node);
4694
- } else {
4695
- this._deselectNode(node);
4696
- }
4697
- this.buildForestState();
4698
- if (nextState) {
4699
- this.$emit('select', node.raw, this.getInstanceId());
4700
- } else {
4701
- this.$emit('deselect', node.raw, this.getInstanceId());
4702
- }
4703
- if (this.localSearch.active && nextState && (this.single || this.clearOnSelect)) {
4704
- this.resetSearchQuery();
4705
- }
4706
- if (this.single && this.closeOnSelect) {
4707
- this.closeMenu();
4708
- if (this.searchable) {
4709
- this._blurOnSelect = true;
4710
- }
4711
- }
4712
- },
4713
- clear: function clear() {
4714
- var _this20 = this;
4715
- if (this.hasValue) {
4716
- if (this.single || this.allowClearingDisabled) {
4717
- this.forest.selectedNodeIds = [];
4718
- } else {
4719
- this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter(function (nodeId) {
4720
- return _this20.getNode(nodeId).isDisabled;
4721
- });
4722
- }
4723
- this.buildForestState();
4724
- }
4725
- },
4726
- _selectNode: function _selectNode(node) {
4727
- var _this21 = this;
4728
- if (this.single || this.disableBranchNodes) {
4729
- return this.addValue(node);
4730
- }
4731
- if (this.flat) {
4732
- this.addValue(node);
4733
- if (this.autoSelectAncestors) {
4734
- node.ancestors.forEach(function (ancestor) {
4735
- if (!_this21.isSelected(ancestor) && !ancestor.isDisabled) _this21.addValue(ancestor);
4736
- });
4737
- } else if (this.autoSelectDescendants) {
4738
- this.traverseDescendantsBFS(node, function (descendant) {
4739
- if (!_this21.isSelected(descendant) && !descendant.isDisabled) _this21.addValue(descendant);
4740
- });
4741
- }
4742
- return;
4743
- }
4744
- var isFullyChecked = node.isLeaf || (!node.hasDisabledDescendants) || (this.allowSelectingDisabledDescendants);
4745
- if (isFullyChecked) {
4746
- this.addValue(node);
4747
- }
4748
- if (node.isBranch) {
4749
- this.traverseDescendantsBFS(node, function (descendant) {
4750
- if (!descendant.isDisabled || _this21.allowSelectingDisabledDescendants) {
4751
- _this21.addValue(descendant);
4752
- }
4753
- });
4754
- }
4755
- if (isFullyChecked) {
4756
- var curr = node;
4757
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
4758
- if (curr.children.every(this.isSelected)) this.addValue(curr);else break;
4759
- }
4760
- }
4761
- },
4762
- _deselectNode: function _deselectNode(node) {
4763
- var _this22 = this;
4764
- if (this.disableBranchNodes) {
4765
- return this.removeValue(node);
4766
- }
4767
- if (this.flat) {
4768
- this.removeValue(node);
4769
- if (this.autoDeselectAncestors) {
4770
- node.ancestors.forEach(function (ancestor) {
4771
- if (_this22.isSelected(ancestor) && !ancestor.isDisabled) _this22.removeValue(ancestor);
4772
- });
4773
- } else if (this.autoDeselectDescendants) {
4774
- this.traverseDescendantsBFS(node, function (descendant) {
4775
- if (_this22.isSelected(descendant) && !descendant.isDisabled) _this22.removeValue(descendant);
4776
- });
4777
- }
4778
- return;
4779
- }
4780
- var hasUncheckedSomeDescendants = false;
4781
- if (node.isBranch) {
4782
- this.traverseDescendantsDFS(node, function (descendant) {
4783
- if (!descendant.isDisabled || _this22.allowSelectingDisabledDescendants) {
4784
- _this22.removeValue(descendant);
4785
- hasUncheckedSomeDescendants = true;
4786
- }
4787
- });
4788
- }
4789
- if (node.isLeaf || hasUncheckedSomeDescendants || node.children.length === 0) {
4790
- this.removeValue(node);
4791
- var curr = node;
4792
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
4793
- if (this.isSelected(curr)) this.removeValue(curr);else break;
4794
- }
4795
- }
4796
- },
4797
- addValue: function addValue(node) {
4798
- this.forest.selectedNodeIds.push(node.id);
4799
- this.forest.selectedNodeMap[node.id] = true;
4800
- },
4801
- removeValue: function removeValue(node) {
4802
- removeFromArray(this.forest.selectedNodeIds, node.id);
4803
- delete this.forest.selectedNodeMap[node.id];
4804
- },
4805
- removeLastValue: function removeLastValue() {
4806
- if (!this.hasValue) return;
4807
- if (this.single) return this.clear();
4808
- var lastValue = last_default()(this.internalValue);
4809
- var lastSelectedNode = this.getNode(lastValue);
4810
- this.select(lastSelectedNode);
4811
- },
4812
- saveMenuScrollPosition: function saveMenuScrollPosition() {
4813
- var $menu = this.getMenu();
4814
- if ($menu) this.menu.lastScrollPosition = $menu.scrollTop;
4815
- },
4816
- restoreMenuScrollPosition: function restoreMenuScrollPosition() {
4817
- var $menu = this.getMenu();
4818
- if ($menu) $menu.scrollTop = this.menu.lastScrollPosition;
4819
- }
4820
- },
4821
- render: function render() {
4822
- var h = arguments[0];
4823
- return h("div", {
4824
- ref: "wrapper",
4825
- "class": this.wrapperClass
4826
- }, [h(HiddenFields), h(Control, {
4827
- ref: "control"
4828
- }), this.appendToBody ? h(MenuPortal, {
4829
- ref: "portal"
4830
- }) : h(Menu, {
4831
- ref: "menu"
4832
- })]);
4833
- }
4834
- });
4835
- // CONCATENATED MODULE: ./src/components/Treeselect.vue?vue&type=script&lang=js
4836
- /* harmony default export */ var components_Treeselectvue_type_script_lang_js = (Treeselectvue_type_script_lang_js);
4837
- // CONCATENATED MODULE: ./src/components/Treeselect.vue
4838
- var Treeselect_render, Treeselect_staticRenderFns
4839
-
4840
-
4841
-
4842
-
4843
- /* normalize component */
4844
-
4845
- var Treeselect_component = normalizeComponent(
4846
- components_Treeselectvue_type_script_lang_js,
4847
- Treeselect_render,
4848
- Treeselect_staticRenderFns,
4849
- false,
4850
- null,
4851
- null,
4852
- null
4853
-
4854
- )
4855
-
4856
- /* hot reload */
4857
- if (false) { var Treeselect_api; }
4858
- Treeselect_component.options.__file = "src/components/Treeselect.vue"
4859
- /* harmony default export */ var Treeselect = (Treeselect_component.exports);
4860
- // EXTERNAL MODULE: ./src/style.less
4861
- var style = __webpack_require__(41);
4862
-
4863
- // CONCATENATED MODULE: ./src/index.js
4864
-
4865
-
4866
- /* harmony default export */ var src = __webpack_exports__["default"] = (Treeselect);
4867
-
4868
-
4869
- var VERSION = "0.0.13";
4870
-
4871
- /***/ })
4872
- /******/ ]);
4873
- });
4874
- //# sourceMappingURL=rp-treeselect.umd.js.map