@reviewpush/rp-treeselect 0.0.12 → 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,4881 +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
- /* hot reload */
1842
- if (false) { var api; }
1843
- component.options.__file = "src/components/HiddenFields.vue"
1844
- /* harmony default export */ var HiddenFields = (component.exports);
1845
- // EXTERNAL MODULE: ./node_modules/babel-helper-vue-jsx-merge-props/index.js
1846
- var babel_helper_vue_jsx_merge_props = __webpack_require__(40);
1847
- var babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(babel_helper_vue_jsx_merge_props);
1848
-
1849
- // 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
1850
-
1851
-
1852
-
1853
-
1854
- 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];
1855
- /* harmony default export */ var Inputvue_type_script_lang_js = ({
1856
- name: 'rp-treeselect--input',
1857
- setup: function setup() {
1858
- var instance = Object(external_Vue_["inject"])('instance');
1859
- return {
1860
- instance: instance
1861
- };
1862
- },
1863
- data: function data() {
1864
- return {
1865
- inputWidth: MIN_INPUT_WIDTH,
1866
- value: ''
1867
- };
1868
- },
1869
- computed: {
1870
- needAutoSize: function needAutoSize() {
1871
- var instance = this.instance;
1872
- return instance.searchable && !instance.disabled && instance.multiple;
1873
- },
1874
- inputStyle: function inputStyle() {
1875
- return {
1876
- width: this.needAutoSize ? "".concat(this.inputWidth, "px") : null
1877
- };
1878
- }
1879
- },
1880
- watch: {
1881
- 'instance.trigger.searchQuery': function instanceTriggerSearchQuery(newValue) {
1882
- this.value = newValue;
1883
- },
1884
- value: function value() {
1885
- if (this.needAutoSize) this.$nextTick(this.updateInputWidth);
1886
- }
1887
- },
1888
- created: function created() {
1889
- this.debouncedCallback = debounce_default()(this.updateSearchQuery, INPUT_DEBOUNCE_DELAY, {
1890
- leading: true,
1891
- trailing: true
1892
- });
1893
- },
1894
- methods: {
1895
- clear: function clear() {
1896
- this.onInput({
1897
- target: {
1898
- value: ''
1899
- }
1900
- });
1901
- },
1902
- focus: function focus() {
1903
- var instance = this.instance;
1904
- if (!instance.disabled) {
1905
- this.$refs.input && this.$refs.input.focus();
1906
- }
1907
- },
1908
- blur: function blur() {
1909
- this.$refs.input && this.$refs.input.blur();
1910
- },
1911
- onFocus: function onFocus() {
1912
- var instance = this.instance;
1913
- instance.trigger.isFocused = true;
1914
- if (instance.openOnFocus) instance.openMenu();
1915
- },
1916
- onBlur: function onBlur() {
1917
- var instance = this.instance;
1918
- var menu = instance.getMenu();
1919
- if (menu && document.activeElement === menu) {
1920
- return this.focus();
1921
- }
1922
- instance.trigger.isFocused = false;
1923
- instance.closeMenu();
1924
- },
1925
- onInput: function onInput(evt) {
1926
- var value = evt.target.value;
1927
- this.value = value;
1928
- if (value) {
1929
- this.debouncedCallback();
1930
- } else {
1931
- this.debouncedCallback.cancel();
1932
- this.updateSearchQuery();
1933
- }
1934
- },
1935
- onKeyDown: function onKeyDown(evt) {
1936
- var instance = this.instance;
1937
- var key = 'which' in evt ? evt.which : evt.keyCode;
1938
- if (evt.ctrlKey || evt.shiftKey || evt.altKey || evt.metaKey) return;
1939
- if (!instance.menu.isOpen && includes(keysThatRequireMenuBeingOpen, key)) {
1940
- evt.preventDefault();
1941
- return instance.openMenu();
1942
- }
1943
- switch (key) {
1944
- case KEY_CODES.BACKSPACE:
1945
- {
1946
- if (instance.backspaceRemoves && !this.value.length) {
1947
- instance.removeLastValue();
1948
- }
1949
- break;
1950
- }
1951
- case KEY_CODES.ENTER:
1952
- {
1953
- evt.preventDefault();
1954
- if (instance.menu.current === null) return;
1955
- var current = instance.getNode(instance.menu.current);
1956
- if (current.isBranch && instance.disableBranchNodes) return;
1957
- instance.select(current);
1958
- break;
1959
- }
1960
- case KEY_CODES.ESCAPE:
1961
- {
1962
- if (this.value.length) {
1963
- this.clear();
1964
- } else if (instance.menu.isOpen) {
1965
- instance.closeMenu();
1966
- }
1967
- break;
1968
- }
1969
- case KEY_CODES.END:
1970
- {
1971
- evt.preventDefault();
1972
- instance.highlightLastOption();
1973
- break;
1974
- }
1975
- case KEY_CODES.HOME:
1976
- {
1977
- evt.preventDefault();
1978
- instance.highlightFirstOption();
1979
- break;
1980
- }
1981
- case KEY_CODES.ARROW_LEFT:
1982
- {
1983
- var _current = instance.getNode(instance.menu.current);
1984
- if (_current.isBranch && instance.shouldExpand(_current)) {
1985
- evt.preventDefault();
1986
- instance.toggleExpanded(_current);
1987
- } else if (!_current.isRootNode && (_current.isLeaf || _current.isBranch && !instance.shouldExpand(_current))) {
1988
- evt.preventDefault();
1989
- instance.setCurrentHighlightedOption(_current.parentNode);
1990
- }
1991
- break;
1992
- }
1993
- case KEY_CODES.ARROW_UP:
1994
- {
1995
- evt.preventDefault();
1996
- instance.highlightPrevOption();
1997
- break;
1998
- }
1999
- case KEY_CODES.ARROW_RIGHT:
2000
- {
2001
- var _current2 = instance.getNode(instance.menu.current);
2002
- if (_current2.isBranch && !instance.shouldExpand(_current2)) {
2003
- evt.preventDefault();
2004
- instance.toggleExpanded(_current2);
2005
- }
2006
- break;
2007
- }
2008
- case KEY_CODES.ARROW_DOWN:
2009
- {
2010
- evt.preventDefault();
2011
- instance.highlightNextOption();
2012
- break;
2013
- }
2014
- case KEY_CODES.DELETE:
2015
- {
2016
- if (instance.deleteRemoves && !this.value.length) {
2017
- instance.removeLastValue();
2018
- }
2019
- break;
2020
- }
2021
- default:
2022
- {
2023
- instance.openMenu();
2024
- }
2025
- }
2026
- },
2027
- onMouseDown: function onMouseDown(evt) {
2028
- if (this.value.length) {
2029
- evt.stopPropagation();
2030
- }
2031
- },
2032
- renderInputContainer: function renderInputContainer() {
2033
- var h = this.$createElement;
2034
- var instance = this.instance;
2035
- var props = {};
2036
- var children = [];
2037
- if (instance.searchable && !instance.disabled) {
2038
- children.push(this.renderInput());
2039
- if (this.needAutoSize) children.push(this.renderSizer());
2040
- }
2041
- if (!instance.searchable) {
2042
- deepExtend(props, {
2043
- on: {
2044
- focus: this.onFocus,
2045
- blur: this.onBlur,
2046
- keydown: this.onKeyDown
2047
- },
2048
- ref: 'input'
2049
- });
2050
- }
2051
- if (!instance.searchable && !instance.disabled) {
2052
- deepExtend(props, {
2053
- attrs: {
2054
- tabIndex: instance.tabIndex
2055
- }
2056
- });
2057
- }
2058
- return h("div", babel_helper_vue_jsx_merge_props_default()([{
2059
- "class": "rp-treeselect__input-container"
2060
- }, props]), [children]);
2061
- },
2062
- renderInput: function renderInput() {
2063
- var h = this.$createElement;
2064
- var instance = this.instance;
2065
- return h("input", {
2066
- ref: "input",
2067
- "class": "rp-treeselect__input",
2068
- attrs: {
2069
- type: "text",
2070
- autocomplete: "off",
2071
- tabIndex: instance.tabIndex,
2072
- required: instance.required && !instance.hasValue
2073
- },
2074
- domProps: {
2075
- "value": this.value
2076
- },
2077
- style: this.inputStyle,
2078
- on: {
2079
- "focus": this.onFocus,
2080
- "input": this.onInput,
2081
- "blur": this.onBlur,
2082
- "keydown": this.onKeyDown,
2083
- "mousedown": this.onMouseDown
2084
- }
2085
- });
2086
- },
2087
- renderSizer: function renderSizer() {
2088
- var h = this.$createElement;
2089
- return h("div", {
2090
- ref: "sizer",
2091
- "class": "rp-treeselect__sizer"
2092
- }, [this.value]);
2093
- },
2094
- updateInputWidth: function updateInputWidth() {
2095
- this.inputWidth = Math.max(MIN_INPUT_WIDTH, this.$refs.sizer.scrollWidth + 15);
2096
- },
2097
- updateSearchQuery: function updateSearchQuery() {
2098
- var instance = this.instance;
2099
- instance.trigger.searchQuery = this.value;
2100
- }
2101
- },
2102
- render: function render() {
2103
- return this.renderInputContainer();
2104
- }
2105
- });
2106
- // CONCATENATED MODULE: ./src/components/Input.vue?vue&type=script&lang=js
2107
- /* harmony default export */ var components_Inputvue_type_script_lang_js = (Inputvue_type_script_lang_js);
2108
- // CONCATENATED MODULE: ./src/components/Input.vue
2109
- var Input_render, Input_staticRenderFns
2110
-
2111
-
2112
-
2113
-
2114
- /* normalize component */
2115
-
2116
- var Input_component = normalizeComponent(
2117
- components_Inputvue_type_script_lang_js,
2118
- Input_render,
2119
- Input_staticRenderFns,
2120
- false,
2121
- null,
2122
- null,
2123
- null
2124
-
2125
- )
2126
-
2127
- /* hot reload */
2128
- if (false) { var Input_api; }
2129
- Input_component.options.__file = "src/components/Input.vue"
2130
- /* harmony default export */ var Input = (Input_component.exports);
2131
- // 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
2132
-
2133
- /* harmony default export */ var Placeholdervue_type_script_lang_js = ({
2134
- name: 'rp-treeselect--placeholder',
2135
- setup: function setup() {
2136
- var instance = Object(external_Vue_["inject"])('instance');
2137
- return {
2138
- instance: instance
2139
- };
2140
- },
2141
- render: function render() {
2142
- var h = arguments[0];
2143
- var instance = this.instance;
2144
- var placeholderClass = {
2145
- 'rp-treeselect__placeholder': true,
2146
- 'rp-treeselect-helper-zoom-effect-off': true,
2147
- 'rp-treeselect-helper-hide': instance.hasValue || instance.trigger.searchQuery
2148
- };
2149
- return h("div", {
2150
- "class": placeholderClass
2151
- }, [instance.placeholder]);
2152
- }
2153
- });
2154
- // CONCATENATED MODULE: ./src/components/Placeholder.vue?vue&type=script&lang=js
2155
- /* harmony default export */ var components_Placeholdervue_type_script_lang_js = (Placeholdervue_type_script_lang_js);
2156
- // CONCATENATED MODULE: ./src/components/Placeholder.vue
2157
- var Placeholder_render, Placeholder_staticRenderFns
2158
-
2159
-
2160
-
2161
-
2162
- /* normalize component */
2163
-
2164
- var Placeholder_component = normalizeComponent(
2165
- components_Placeholdervue_type_script_lang_js,
2166
- Placeholder_render,
2167
- Placeholder_staticRenderFns,
2168
- false,
2169
- null,
2170
- null,
2171
- null
2172
-
2173
- )
2174
-
2175
- /* harmony default export */ var Placeholder = (Placeholder_component.exports);
2176
- // 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
2177
-
2178
-
2179
-
2180
- /* harmony default export */ var SingleValuevue_type_script_lang_js = ({
2181
- name: 'rp-treeselect--single-value',
2182
- setup: function setup() {
2183
- var instance = Object(external_Vue_["inject"])('instance');
2184
- return {
2185
- instance: instance
2186
- };
2187
- },
2188
- methods: {
2189
- renderSingleValueLabel: function renderSingleValueLabel() {
2190
- var instance = this.instance;
2191
- var node = instance.selectedNodes[0];
2192
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
2193
- return customValueLabelRenderer ? customValueLabelRenderer({
2194
- node: node
2195
- }) : node.label;
2196
- }
2197
- },
2198
- render: function render() {
2199
- var h = arguments[0];
2200
- var instance = this.instance,
2201
- renderValueContainer = this.$parent.renderValueContainer;
2202
- var shouldShowValue = instance.hasValue && !instance.trigger.searchQuery;
2203
- return renderValueContainer([shouldShowValue && h("div", {
2204
- "class": "rp-treeselect__single-value"
2205
- }, [this.renderSingleValueLabel()]), h(Placeholder), h(Input, {
2206
- ref: "input"
2207
- })]);
2208
- }
2209
- });
2210
- // CONCATENATED MODULE: ./src/components/SingleValue.vue?vue&type=script&lang=js
2211
- /* harmony default export */ var components_SingleValuevue_type_script_lang_js = (SingleValuevue_type_script_lang_js);
2212
- // CONCATENATED MODULE: ./src/components/SingleValue.vue
2213
- var SingleValue_render, SingleValue_staticRenderFns
2214
-
2215
-
2216
-
2217
-
2218
- /* normalize component */
2219
-
2220
- var SingleValue_component = normalizeComponent(
2221
- components_SingleValuevue_type_script_lang_js,
2222
- SingleValue_render,
2223
- SingleValue_staticRenderFns,
2224
- false,
2225
- null,
2226
- null,
2227
- null
2228
-
2229
- )
2230
-
2231
- /* hot reload */
2232
- if (false) { var SingleValue_api; }
2233
- SingleValue_component.options.__file = "src/components/SingleValue.vue"
2234
- /* harmony default export */ var SingleValue = (SingleValue_component.exports);
2235
- // 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
2236
- var Deletevue_type_template_id_364b6320_render = function render() {
2237
- var _vm = this,
2238
- _c = _vm._self._c
2239
- return _c(
2240
- "svg",
2241
- {
2242
- attrs: {
2243
- xmlns: "http://www.w3.org/2000/svg",
2244
- viewBox: "0 0 348.333 348.333",
2245
- },
2246
- },
2247
- [
2248
- _c("path", {
2249
- attrs: {
2250
- 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",
2251
- },
2252
- }),
2253
- ]
2254
- )
2255
- }
2256
- var Deletevue_type_template_id_364b6320_staticRenderFns = []
2257
- Deletevue_type_template_id_364b6320_render._withStripped = true
2258
-
2259
-
2260
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=template&id=364b6320
2261
-
2262
- // 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
2263
- /* harmony default export */ var Deletevue_type_script_lang_js = ({
2264
- name: 'rp-treeselect--x'
2265
- });
2266
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=script&lang=js
2267
- /* harmony default export */ var icons_Deletevue_type_script_lang_js = (Deletevue_type_script_lang_js);
2268
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue
2269
-
2270
-
2271
-
2272
-
2273
-
2274
- /* normalize component */
2275
-
2276
- var Delete_component = normalizeComponent(
2277
- icons_Deletevue_type_script_lang_js,
2278
- Deletevue_type_template_id_364b6320_render,
2279
- Deletevue_type_template_id_364b6320_staticRenderFns,
2280
- false,
2281
- null,
2282
- null,
2283
- null
2284
-
2285
- )
2286
-
2287
- /* hot reload */
2288
- if (false) { var Delete_api; }
2289
- Delete_component.options.__file = "src/components/icons/Delete.vue"
2290
- /* harmony default export */ var Delete = (Delete_component.exports);
2291
- // 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
2292
-
2293
-
2294
-
2295
- /* harmony default export */ var MultiValueItemvue_type_script_lang_js = ({
2296
- name: 'rp-treeselect--multi-value-item',
2297
- setup: function setup() {
2298
- var instance = Object(external_Vue_["inject"])('instance');
2299
- return {
2300
- instance: instance
2301
- };
2302
- },
2303
- props: {
2304
- node: {
2305
- type: Object,
2306
- required: true
2307
- }
2308
- },
2309
- methods: {
2310
- handleMouseDown: onLeftClick(function handleMouseDown() {
2311
- var instance = this.instance,
2312
- node = this.node;
2313
- instance.select(node);
2314
- })
2315
- },
2316
- render: function render() {
2317
- var h = arguments[0];
2318
- var instance = this.instance,
2319
- node = this.node;
2320
- var itemClass = {
2321
- 'rp-treeselect__multi-value-item': true,
2322
- 'rp-treeselect__multi-value-item-disabled': node.isDisabled,
2323
- 'rp-treeselect__multi-value-item-new': node.isNew
2324
- };
2325
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
2326
- var labelRenderer = customValueLabelRenderer ? customValueLabelRenderer({
2327
- node: node
2328
- }) : node.label;
2329
- return h("div", {
2330
- "class": "rp-treeselect__multi-value-item-container"
2331
- }, [h("div", {
2332
- "class": itemClass,
2333
- on: {
2334
- "mousedown": this.handleMouseDown
2335
- }
2336
- }, [h("span", {
2337
- "class": "rp-treeselect__multi-value-label"
2338
- }, [labelRenderer]), h("span", {
2339
- "class": "rp-treeselect__icon rp-treeselect__value-remove"
2340
- }, [h(Delete)])])]);
2341
- }
2342
- });
2343
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue?vue&type=script&lang=js
2344
- /* harmony default export */ var components_MultiValueItemvue_type_script_lang_js = (MultiValueItemvue_type_script_lang_js);
2345
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue
2346
- var MultiValueItem_render, MultiValueItem_staticRenderFns
2347
-
2348
-
2349
-
2350
-
2351
- /* normalize component */
2352
-
2353
- var MultiValueItem_component = normalizeComponent(
2354
- components_MultiValueItemvue_type_script_lang_js,
2355
- MultiValueItem_render,
2356
- MultiValueItem_staticRenderFns,
2357
- false,
2358
- null,
2359
- null,
2360
- null
2361
-
2362
- )
2363
-
2364
- /* hot reload */
2365
- if (false) { var MultiValueItem_api; }
2366
- MultiValueItem_component.options.__file = "src/components/MultiValueItem.vue"
2367
- /* harmony default export */ var MultiValueItem = (MultiValueItem_component.exports);
2368
- // 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
2369
-
2370
-
2371
-
2372
-
2373
-
2374
- /* harmony default export */ var MultiValuevue_type_script_lang_js = ({
2375
- name: 'rp-treeselect--multi-value',
2376
- setup: function setup() {
2377
- var instance = Object(external_Vue_["inject"])('instance');
2378
- return {
2379
- instance: instance
2380
- };
2381
- },
2382
- methods: {
2383
- renderMultiValueItems: function renderMultiValueItems() {
2384
- var h = this.$createElement;
2385
- var instance = this.instance;
2386
- return instance.internalValue.slice(0, instance.limit).map(instance.getNode).map(function (node) {
2387
- return h(MultiValueItem, {
2388
- key: "multi-value-item-".concat(node.id),
2389
- attrs: {
2390
- node: node
2391
- }
2392
- });
2393
- });
2394
- },
2395
- renderExceedLimitTip: function renderExceedLimitTip() {
2396
- var h = this.$createElement;
2397
- var instance = this.instance;
2398
- var count = instance.internalValue.length - instance.limit;
2399
- if (count <= 0) return null;
2400
- return h("div", {
2401
- "class": "rp-treeselect__limit-tip rp-treeselect-helper-zoom-effect-off",
2402
- key: "exceed-limit-tip"
2403
- }, [h("span", {
2404
- "class": "rp-treeselect__limit-tip-text"
2405
- }, [instance.limitText(count)])]);
2406
- }
2407
- },
2408
- render: function render() {
2409
- var h = arguments[0];
2410
- var renderValueContainer = this.$parent.renderValueContainer;
2411
- var transitionGroupProps = {
2412
- props: {
2413
- tag: 'div',
2414
- name: 'rp-treeselect__multi-value-item--transition',
2415
- appear: true
2416
- }
2417
- };
2418
- return renderValueContainer(h("transition-group", babel_helper_vue_jsx_merge_props_default()([{
2419
- "class": "rp-treeselect__multi-value"
2420
- }, transitionGroupProps]), [this.renderMultiValueItems(), this.renderExceedLimitTip(), h(Placeholder, {
2421
- key: "placeholder"
2422
- }), h(Input, {
2423
- ref: "input",
2424
- key: "input"
2425
- })]));
2426
- }
2427
- });
2428
- // CONCATENATED MODULE: ./src/components/MultiValue.vue?vue&type=script&lang=js
2429
- /* harmony default export */ var components_MultiValuevue_type_script_lang_js = (MultiValuevue_type_script_lang_js);
2430
- // CONCATENATED MODULE: ./src/components/MultiValue.vue
2431
- var MultiValue_render, MultiValue_staticRenderFns
2432
-
2433
-
2434
-
2435
-
2436
- /* normalize component */
2437
-
2438
- var MultiValue_component = normalizeComponent(
2439
- components_MultiValuevue_type_script_lang_js,
2440
- MultiValue_render,
2441
- MultiValue_staticRenderFns,
2442
- false,
2443
- null,
2444
- null,
2445
- null
2446
-
2447
- )
2448
-
2449
- /* hot reload */
2450
- if (false) { var MultiValue_api; }
2451
- MultiValue_component.options.__file = "src/components/MultiValue.vue"
2452
- /* harmony default export */ var MultiValue = (MultiValue_component.exports);
2453
- // 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
2454
- var Arrowvue_type_template_id_11186cd4_render = function render() {
2455
- var _vm = this,
2456
- _c = _vm._self._c
2457
- return _c(
2458
- "svg",
2459
- {
2460
- attrs: {
2461
- xmlns: "http://www.w3.org/2000/svg",
2462
- viewBox: "0 0 292.362 292.362",
2463
- },
2464
- },
2465
- [
2466
- _c("path", {
2467
- attrs: {
2468
- 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",
2469
- },
2470
- }),
2471
- ]
2472
- )
2473
- }
2474
- var Arrowvue_type_template_id_11186cd4_staticRenderFns = []
2475
- Arrowvue_type_template_id_11186cd4_render._withStripped = true
2476
-
2477
-
2478
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=template&id=11186cd4
2479
-
2480
- // 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
2481
- /* harmony default export */ var Arrowvue_type_script_lang_js = ({
2482
- name: 'rp-treeselect--arrow'
2483
- });
2484
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=script&lang=js
2485
- /* harmony default export */ var icons_Arrowvue_type_script_lang_js = (Arrowvue_type_script_lang_js);
2486
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue
2487
-
2488
-
2489
-
2490
-
2491
-
2492
- /* normalize component */
2493
-
2494
- var Arrow_component = normalizeComponent(
2495
- icons_Arrowvue_type_script_lang_js,
2496
- Arrowvue_type_template_id_11186cd4_render,
2497
- Arrowvue_type_template_id_11186cd4_staticRenderFns,
2498
- false,
2499
- null,
2500
- null,
2501
- null
2502
-
2503
- )
2504
-
2505
- /* hot reload */
2506
- if (false) { var Arrow_api; }
2507
- Arrow_component.options.__file = "src/components/icons/Arrow.vue"
2508
- /* harmony default export */ var Arrow = (Arrow_component.exports);
2509
- // 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
2510
-
2511
-
2512
-
2513
-
2514
-
2515
-
2516
- /* harmony default export */ var Controlvue_type_script_lang_js = ({
2517
- name: 'rp-treeselect--control',
2518
- setup: function setup() {
2519
- var instance = Object(external_Vue_["inject"])('instance');
2520
- return {
2521
- instance: instance
2522
- };
2523
- },
2524
- computed: {
2525
- shouldShowX: function shouldShowX() {
2526
- var instance = this.instance;
2527
- return instance.clearable && !instance.disabled && instance.hasValue && (this.hasUndisabledValue || instance.allowClearingDisabled);
2528
- },
2529
- shouldShowArrow: function shouldShowArrow() {
2530
- var instance = this.instance;
2531
- if (!instance.alwaysOpen) return true;
2532
- return !instance.menu.isOpen;
2533
- },
2534
- hasUndisabledValue: function hasUndisabledValue() {
2535
- var instance = this.instance;
2536
- return instance.hasValue && instance.internalValue.some(function (id) {
2537
- return !instance.getNode(id).isDisabled;
2538
- });
2539
- }
2540
- },
2541
- methods: {
2542
- renderX: function renderX() {
2543
- var h = this.$createElement;
2544
- var instance = this.instance;
2545
- var title = instance.multiple ? instance.clearAllText : instance.clearValueText;
2546
- if (!this.shouldShowX) return null;
2547
- return h("div", {
2548
- "class": "rp-treeselect__x-container",
2549
- attrs: {
2550
- title: title
2551
- },
2552
- on: {
2553
- "mousedown": this.handleMouseDownOnX
2554
- }
2555
- }, [h(Delete, {
2556
- "class": "rp-treeselect__x"
2557
- })]);
2558
- },
2559
- renderArrow: function renderArrow() {
2560
- var h = this.$createElement;
2561
- var instance = this.instance;
2562
- var arrowClass = {
2563
- 'rp-treeselect__control-arrow': true,
2564
- 'rp-treeselect__control-arrow--rotated': instance.menu.isOpen
2565
- };
2566
- if (!this.shouldShowArrow) return null;
2567
- return h("div", {
2568
- "class": "rp-treeselect__control-arrow-container",
2569
- on: {
2570
- "mousedown": this.handleMouseDownOnArrow
2571
- }
2572
- }, [h(Arrow, {
2573
- "class": arrowClass
2574
- })]);
2575
- },
2576
- handleMouseDownOnX: onLeftClick(function handleMouseDownOnX(evt) {
2577
- evt.stopPropagation();
2578
- evt.preventDefault();
2579
- var instance = this.instance;
2580
- var result = instance.beforeClearAll();
2581
- var handler = function handler(shouldClear) {
2582
- if (shouldClear) instance.clear();
2583
- };
2584
- if (is_promise_default()(result)) {
2585
- result.then(handler);
2586
- } else {
2587
- setTimeout(function () {
2588
- return handler(result);
2589
- }, 0);
2590
- }
2591
- }),
2592
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnArrow(evt) {
2593
- evt.preventDefault();
2594
- evt.stopPropagation();
2595
- var instance = this.instance;
2596
- instance.focusInput();
2597
- instance.toggleMenu();
2598
- }),
2599
- renderValueContainer: function renderValueContainer(children) {
2600
- var h = this.$createElement;
2601
- return h("div", {
2602
- "class": "rp-treeselect__value-container"
2603
- }, [children]);
2604
- }
2605
- },
2606
- render: function render() {
2607
- var h = arguments[0];
2608
- var instance = this.instance;
2609
- var ValueContainer = instance.single ? SingleValue : MultiValue;
2610
- return h("div", {
2611
- "class": "rp-treeselect__control",
2612
- on: {
2613
- "mousedown": instance.handleMouseDown
2614
- }
2615
- }, [h(ValueContainer, {
2616
- ref: "value-container"
2617
- }), this.renderX(), this.renderArrow()]);
2618
- }
2619
- });
2620
- // CONCATENATED MODULE: ./src/components/Control.vue?vue&type=script&lang=js
2621
- /* harmony default export */ var components_Controlvue_type_script_lang_js = (Controlvue_type_script_lang_js);
2622
- // CONCATENATED MODULE: ./src/components/Control.vue
2623
- var Control_render, Control_staticRenderFns
2624
-
2625
-
2626
-
2627
-
2628
- /* normalize component */
2629
-
2630
- var Control_component = normalizeComponent(
2631
- components_Controlvue_type_script_lang_js,
2632
- Control_render,
2633
- Control_staticRenderFns,
2634
- false,
2635
- null,
2636
- null,
2637
- null
2638
-
2639
- )
2640
-
2641
- /* hot reload */
2642
- if (false) { var Control_api; }
2643
- Control_component.options.__file = "src/components/Control.vue"
2644
- /* harmony default export */ var Control = (Control_component.exports);
2645
- // 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
2646
- /* harmony default export */ var Tipvue_type_script_lang_js = ({
2647
- name: 'rp-treeselect--tip',
2648
- props: {
2649
- type: {
2650
- type: String,
2651
- required: true
2652
- },
2653
- icon: {
2654
- type: String,
2655
- required: true
2656
- }
2657
- },
2658
- render: function render() {
2659
- var h = arguments[0];
2660
- var _this$$props = this.$props,
2661
- icon = _this$$props.icon,
2662
- type = _this$$props.type;
2663
- return h("div", {
2664
- "class": "rp-treeselect__tip rp-treeselect__".concat(type, "-tip")
2665
- }, [h("div", {
2666
- "class": "rp-treeselect__icon-container"
2667
- }, [h("span", {
2668
- "class": "rp-treeselect__icon-".concat(icon)
2669
- })]), h("span", {
2670
- "class": "rp-treeselect__tip-text rp-treeselect__".concat(type, "-tip-text")
2671
- }, [h("slot")])]);
2672
- }
2673
- });
2674
- // CONCATENATED MODULE: ./src/components/Tip.vue?vue&type=script&lang=js
2675
- /* harmony default export */ var components_Tipvue_type_script_lang_js = (Tipvue_type_script_lang_js);
2676
- // CONCATENATED MODULE: ./src/components/Tip.vue
2677
- var Tip_render, Tip_staticRenderFns
2678
-
2679
-
2680
-
2681
-
2682
- /* normalize component */
2683
-
2684
- var Tip_component = normalizeComponent(
2685
- components_Tipvue_type_script_lang_js,
2686
- Tip_render,
2687
- Tip_staticRenderFns,
2688
- false,
2689
- null,
2690
- null,
2691
- null
2692
-
2693
- )
2694
-
2695
- /* hot reload */
2696
- if (false) { var Tip_api; }
2697
- Tip_component.options.__file = "src/components/Tip.vue"
2698
- /* harmony default export */ var Tip = (Tip_component.exports);
2699
- // 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
2700
-
2701
-
2702
-
2703
-
2704
-
2705
-
2706
- var arrowPlaceholder, checkMark, minusMark;
2707
- var Option = {
2708
- name: 'rp-treeselect--option',
2709
- setup: function setup() {
2710
- var instance = Object(external_Vue_["inject"])('instance');
2711
- return {
2712
- instance: instance
2713
- };
2714
- },
2715
- props: {
2716
- node: {
2717
- type: Object,
2718
- required: true
2719
- }
2720
- },
2721
- computed: {
2722
- shouldExpand: function shouldExpand() {
2723
- var instance = this.instance,
2724
- node = this.node;
2725
- return node.isBranch && instance.shouldExpand(node);
2726
- },
2727
- shouldShow: function shouldShow() {
2728
- var instance = this.instance,
2729
- node = this.node;
2730
- return instance.shouldShowOptionInMenu(node);
2731
- }
2732
- },
2733
- methods: {
2734
- renderOption: function renderOption() {
2735
- var h = this.$createElement;
2736
- var instance = this.instance,
2737
- node = this.node;
2738
- var optionClass = {
2739
- 'rp-treeselect__option': true,
2740
- 'rp-treeselect__option--disabled': node.isDisabled,
2741
- 'rp-treeselect__option--selected': instance.isSelected(node),
2742
- 'rp-treeselect__option--highlight': node.isHighlighted,
2743
- 'rp-treeselect__option--matched': instance.localSearch.active && node.isMatched,
2744
- 'rp-treeselect__option--hide': !this.shouldShow
2745
- };
2746
- return h("div", {
2747
- "class": optionClass,
2748
- on: {
2749
- "mouseenter": this.handleMouseEnterOption
2750
- },
2751
- attrs: {
2752
- "data-id": node.id
2753
- }
2754
- }, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
2755
- },
2756
- renderSubOptionsList: function renderSubOptionsList() {
2757
- var h = this.$createElement;
2758
- if (!this.shouldExpand) return null;
2759
- return h("div", {
2760
- "class": "rp-treeselect__list"
2761
- }, [this.renderSubOptions(), this.renderNoChildrenTip(), this.renderLoadingChildrenTip(), this.renderLoadingChildrenErrorTip()]);
2762
- },
2763
- renderArrow: function renderArrow() {
2764
- var h = this.$createElement;
2765
- var instance = this.instance,
2766
- node = this.node;
2767
- if (instance.shouldFlattenOptions && this.shouldShow) return null;
2768
- if (node.isBranch) {
2769
- var transitionProps = {
2770
- props: {
2771
- name: 'rp-treeselect__option-arrow--prepare',
2772
- appear: true
2773
- }
2774
- };
2775
- var arrowClass = {
2776
- 'rp-treeselect__option-arrow': true,
2777
- 'rp-treeselect__option-arrow--rotated': this.shouldExpand
2778
- };
2779
- return h("div", {
2780
- "class": "rp-treeselect__option-arrow-container",
2781
- on: {
2782
- "mousedown": this.handleMouseDownOnArrow
2783
- }
2784
- }, [h("transition", transitionProps, [h(Arrow, {
2785
- "class": arrowClass
2786
- })])]);
2787
- }
2788
- if (instance.hasBranchNodes) {
2789
- if (!arrowPlaceholder) arrowPlaceholder = h("div", {
2790
- "class": "rp-treeselect__option-arrow-placeholder"
2791
- }, ["\xA0"]);
2792
- return arrowPlaceholder;
2793
- }
2794
- return null;
2795
- },
2796
- renderLabelContainer: function renderLabelContainer(children) {
2797
- var h = this.$createElement;
2798
- return h("div", {
2799
- "class": "rp-treeselect__label-container",
2800
- on: {
2801
- "mousedown": this.handleMouseDownOnLabelContainer
2802
- }
2803
- }, [children]);
2804
- },
2805
- renderCheckboxContainer: function renderCheckboxContainer(children) {
2806
- var h = this.$createElement;
2807
- var instance = this.instance,
2808
- node = this.node;
2809
- if (instance.single) return null;
2810
- if (instance.disableBranchNodes && node.isBranch) return null;
2811
- return h("div", {
2812
- "class": "rp-treeselect__checkbox-container"
2813
- }, [children]);
2814
- },
2815
- renderCheckbox: function renderCheckbox() {
2816
- var h = this.$createElement;
2817
- var instance = this.instance,
2818
- node = this.node;
2819
- var checkedState = instance.forest.checkedStateMap[node.id];
2820
- var checkboxClass = {
2821
- 'rp-treeselect__checkbox': true,
2822
- 'rp-treeselect__checkbox--checked': checkedState === CHECKED,
2823
- 'rp-treeselect__checkbox--indeterminate': checkedState === INDETERMINATE,
2824
- 'rp-treeselect__checkbox--unchecked': checkedState === UNCHECKED,
2825
- 'rp-treeselect__checkbox--disabled': node.isDisabled
2826
- };
2827
- if (!checkMark) checkMark = h("span", {
2828
- "class": "rp-treeselect__check-mark"
2829
- });
2830
- if (!minusMark) minusMark = h("span", {
2831
- "class": "rp-treeselect__minus-mark"
2832
- });
2833
- return h("span", {
2834
- "class": checkboxClass
2835
- }, [checkMark, minusMark]);
2836
- },
2837
- renderLabel: function renderLabel() {
2838
- var h = this.$createElement;
2839
- var instance = this.instance,
2840
- node = this.node;
2841
- var shouldShowCount = node.isBranch && (instance.localSearch.active ? instance.showCountOnSearchComputed : instance.showCount);
2842
- var count = shouldShowCount ? instance.localSearch.active ? instance.localSearch.countMap[node.id][instance.showCountOf] : node.count[instance.showCountOf] : NaN;
2843
- var labelClassName = 'rp-treeselect__label';
2844
- var countClassName = 'rp-treeselect__count';
2845
- var customLabelRenderer = instance.$scopedSlots['option-label'];
2846
- if (customLabelRenderer) return customLabelRenderer({
2847
- node: node,
2848
- shouldShowCount: shouldShowCount,
2849
- count: count,
2850
- labelClassName: labelClassName,
2851
- countClassName: countClassName
2852
- });
2853
- return h("label", {
2854
- "class": labelClassName
2855
- }, [node.label, shouldShowCount && h("span", {
2856
- "class": countClassName
2857
- }, ["(", count, ")"])]);
2858
- },
2859
- renderSubOptions: function renderSubOptions() {
2860
- var h = this.$createElement;
2861
- var node = this.node;
2862
- if (!node.childrenStates.isLoaded) return null;
2863
- return node.children.map(function (childNode) {
2864
- return h(Option, {
2865
- attrs: {
2866
- node: childNode
2867
- },
2868
- key: childNode.id
2869
- });
2870
- });
2871
- },
2872
- renderNoChildrenTip: function renderNoChildrenTip() {
2873
- var h = this.$createElement;
2874
- var instance = this.instance,
2875
- node = this.node;
2876
- if (!node.childrenStates.isLoaded || node.children.length) return null;
2877
- return h(Tip, {
2878
- attrs: {
2879
- type: "no-children",
2880
- icon: "warning"
2881
- }
2882
- }, [instance.noChildrenText]);
2883
- },
2884
- renderLoadingChildrenTip: function renderLoadingChildrenTip() {
2885
- var h = this.$createElement;
2886
- var instance = this.instance,
2887
- node = this.node;
2888
- if (!node.childrenStates.isLoading) return null;
2889
- return h(Tip, {
2890
- attrs: {
2891
- type: "loading",
2892
- icon: "loader"
2893
- }
2894
- }, [instance.loadingText]);
2895
- },
2896
- renderLoadingChildrenErrorTip: function renderLoadingChildrenErrorTip() {
2897
- var h = this.$createElement;
2898
- var instance = this.instance,
2899
- node = this.node;
2900
- if (!node.childrenStates.loadingError) return null;
2901
- return h(Tip, {
2902
- attrs: {
2903
- type: "error",
2904
- icon: "error"
2905
- }
2906
- }, [node.childrenStates.loadingError, h("a", {
2907
- "class": "rp-treeselect__retry",
2908
- attrs: {
2909
- title: instance.retryTitle
2910
- },
2911
- on: {
2912
- "mousedown": this.handleMouseDownOnRetry
2913
- }
2914
- }, [instance.retryText])]);
2915
- },
2916
- handleMouseEnterOption: function handleMouseEnterOption(evt) {
2917
- var instance = this.instance,
2918
- node = this.node;
2919
- if (evt.target !== evt.currentTarget) return;
2920
- instance.setCurrentHighlightedOption(node, false);
2921
- },
2922
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnOptionArrow() {
2923
- var instance = this.instance,
2924
- node = this.node;
2925
- instance.toggleExpanded(node);
2926
- }),
2927
- handleMouseDownOnLabelContainer: onLeftClick(function handleMouseDownOnLabelContainer() {
2928
- var instance = this.instance,
2929
- node = this.node;
2930
- if (node.isBranch && instance.disableBranchNodes) {
2931
- instance.toggleExpanded(node);
2932
- } else {
2933
- instance.select(node);
2934
- }
2935
- }),
2936
- handleMouseDownOnRetry: onLeftClick(function handleMouseDownOnRetry() {
2937
- var instance = this.instance,
2938
- node = this.node;
2939
- instance.loadChildrenOptions(node);
2940
- })
2941
- },
2942
- render: function render() {
2943
- var h = arguments[0];
2944
- var node = this.node;
2945
- var indentLevel = this.instance.shouldFlattenOptions ? 0 : node.level;
2946
- var listItemClass = defineProperty_default()({
2947
- 'rp-treeselect__list-item': true
2948
- }, "rp-treeselect__indent-level-".concat(indentLevel), true);
2949
- var transitionProps = {
2950
- props: {
2951
- name: 'rp-treeselect__list--transition'
2952
- }
2953
- };
2954
- return h("div", {
2955
- "class": listItemClass
2956
- }, [this.renderOption(), node.isBranch && h("transition", transitionProps, [this.renderSubOptionsList()])]);
2957
- }
2958
- };
2959
- /* harmony default export */ var Optionvue_type_script_lang_js = (Option);
2960
- // CONCATENATED MODULE: ./src/components/Option.vue?vue&type=script&lang=js
2961
- /* harmony default export */ var components_Optionvue_type_script_lang_js = (Optionvue_type_script_lang_js);
2962
- // CONCATENATED MODULE: ./src/components/Option.vue
2963
- var Option_render, Option_staticRenderFns
2964
-
2965
-
2966
-
2967
-
2968
- /* normalize component */
2969
-
2970
- var Option_component = normalizeComponent(
2971
- components_Optionvue_type_script_lang_js,
2972
- Option_render,
2973
- Option_staticRenderFns,
2974
- false,
2975
- null,
2976
- null,
2977
- null
2978
-
2979
- )
2980
-
2981
- /* hot reload */
2982
- if (false) { var Option_api; }
2983
- Option_component.options.__file = "src/components/Option.vue"
2984
- /* harmony default export */ var components_Option = (Option_component.exports);
2985
- // 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
2986
-
2987
-
2988
-
2989
-
2990
-
2991
- var directionMap = {
2992
- top: 'top',
2993
- bottom: 'bottom',
2994
- above: 'top',
2995
- below: 'bottom'
2996
- };
2997
- /* harmony default export */ var Menuvue_type_script_lang_js = ({
2998
- name: 'rp-treeselect--menu',
2999
- setup: function setup() {
3000
- var instance = Object(external_Vue_["inject"])('instance');
3001
- return {
3002
- instance: instance
3003
- };
3004
- },
3005
- computed: {
3006
- menuStyle: function menuStyle() {
3007
- var instance = this.instance;
3008
- return {
3009
- maxHeight: instance.maxHeight + 'px'
3010
- };
3011
- },
3012
- menuContainerStyle: function menuContainerStyle() {
3013
- var instance = this.instance;
3014
- return {
3015
- zIndex: instance.appendToBody ? null : instance.zIndex
3016
- };
3017
- }
3018
- },
3019
- watch: {
3020
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
3021
- if (newValue) {
3022
- this.$nextTick(this.onMenuOpen);
3023
- } else {
3024
- this.onMenuClose();
3025
- }
3026
- }
3027
- },
3028
- created: function created() {
3029
- this.menuSizeWatcher = null;
3030
- this.menuResizeAndScrollEventListeners = null;
3031
- },
3032
- mounted: function mounted() {
3033
- var instance = this.instance;
3034
- if (instance.menu.isOpen) this.$nextTick(this.onMenuOpen);
3035
- },
3036
- destroyed: function destroyed() {
3037
- this.onMenuClose();
3038
- },
3039
- methods: {
3040
- renderMenu: function renderMenu() {
3041
- var h = this.$createElement;
3042
- var instance = this.instance;
3043
- if (!instance.menu.isOpen) return null;
3044
- return h("div", {
3045
- ref: "menu",
3046
- "class": "rp-treeselect__menu",
3047
- on: {
3048
- "mousedown": instance.handleMouseDown
3049
- },
3050
- style: this.menuStyle
3051
- }, [this.renderBeforeList(), instance.async ? this.renderAsyncSearchMenuInner() : instance.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(), this.renderAfterList()]);
3052
- },
3053
- renderBeforeList: function renderBeforeList() {
3054
- var instance = this.instance;
3055
- var beforeListRenderer = instance.$scopedSlots['before-list'];
3056
- return beforeListRenderer ? beforeListRenderer() : null;
3057
- },
3058
- renderAfterList: function renderAfterList() {
3059
- var instance = this.instance;
3060
- var afterListRenderer = instance.$scopedSlots['after-list'];
3061
- return afterListRenderer ? afterListRenderer() : null;
3062
- },
3063
- renderNormalMenuInner: function renderNormalMenuInner() {
3064
- var instance = this.instance;
3065
- if (instance.rootOptionsStates.isLoading) {
3066
- return this.renderLoadingOptionsTip();
3067
- } else if (instance.rootOptionsStates.loadingError) {
3068
- return this.renderLoadingRootOptionsErrorTip();
3069
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
3070
- return this.renderNoAvailableOptionsTip();
3071
- } else {
3072
- return this.renderOptionList();
3073
- }
3074
- },
3075
- renderLocalSearchMenuInner: function renderLocalSearchMenuInner() {
3076
- var instance = this.instance;
3077
- if (instance.rootOptionsStates.isLoading) {
3078
- return this.renderLoadingOptionsTip();
3079
- } else if (instance.rootOptionsStates.loadingError) {
3080
- return this.renderLoadingRootOptionsErrorTip();
3081
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
3082
- return this.renderNoAvailableOptionsTip();
3083
- } else if (instance.localSearch.noResults) {
3084
- return this.renderNoResultsTip();
3085
- } else {
3086
- return this.renderOptionList();
3087
- }
3088
- },
3089
- renderAsyncSearchMenuInner: function renderAsyncSearchMenuInner() {
3090
- var instance = this.instance;
3091
- var entry = instance.getRemoteSearchEntry();
3092
- var shouldShowSearchPromptTip = instance.trigger.searchQuery === '' && !instance.defaultOptions;
3093
- var shouldShowNoResultsTip = shouldShowSearchPromptTip ? false : entry.isLoaded && entry.options.length === 0;
3094
- if (shouldShowSearchPromptTip) {
3095
- return this.renderSearchPromptTip();
3096
- } else if (entry.isLoading) {
3097
- return this.renderLoadingOptionsTip();
3098
- } else if (entry.loadingError) {
3099
- return this.renderAsyncSearchLoadingErrorTip();
3100
- } else if (shouldShowNoResultsTip) {
3101
- return this.renderNoResultsTip();
3102
- } else {
3103
- return this.renderOptionList();
3104
- }
3105
- },
3106
- renderOptionList: function renderOptionList() {
3107
- var h = this.$createElement;
3108
- var instance = this.instance;
3109
- return h("div", {
3110
- "class": "rp-treeselect__list"
3111
- }, [instance.forest.normalizedOptions.map(function (rootNode) {
3112
- return h(components_Option, {
3113
- attrs: {
3114
- node: rootNode
3115
- },
3116
- key: rootNode.id
3117
- });
3118
- })]);
3119
- },
3120
- renderSearchPromptTip: function renderSearchPromptTip() {
3121
- var h = this.$createElement;
3122
- var instance = this.instance;
3123
- return h(Tip, {
3124
- attrs: {
3125
- type: "search-prompt",
3126
- icon: "warning"
3127
- }
3128
- }, [instance.searchPromptText]);
3129
- },
3130
- renderLoadingOptionsTip: function renderLoadingOptionsTip() {
3131
- var h = this.$createElement;
3132
- var instance = this.instance;
3133
- return h(Tip, {
3134
- attrs: {
3135
- type: "loading",
3136
- icon: "loader"
3137
- }
3138
- }, [instance.loadingText]);
3139
- },
3140
- renderLoadingRootOptionsErrorTip: function renderLoadingRootOptionsErrorTip() {
3141
- var h = this.$createElement;
3142
- var instance = this.instance;
3143
- return h(Tip, {
3144
- attrs: {
3145
- type: "error",
3146
- icon: "error"
3147
- }
3148
- }, [instance.rootOptionsStates.loadingError, h("a", {
3149
- "class": "rp-treeselect__retry",
3150
- on: {
3151
- "click": instance.loadRootOptions
3152
- },
3153
- attrs: {
3154
- title: instance.retryTitle
3155
- }
3156
- }, [instance.retryText])]);
3157
- },
3158
- renderAsyncSearchLoadingErrorTip: function renderAsyncSearchLoadingErrorTip() {
3159
- var h = this.$createElement;
3160
- var instance = this.instance;
3161
- var entry = instance.getRemoteSearchEntry();
3162
- return h(Tip, {
3163
- attrs: {
3164
- type: "error",
3165
- icon: "error"
3166
- }
3167
- }, [entry.loadingError, h("a", {
3168
- "class": "rp-treeselect__retry",
3169
- on: {
3170
- "click": instance.handleRemoteSearch
3171
- },
3172
- attrs: {
3173
- title: instance.retryTitle
3174
- }
3175
- }, [instance.retryText])]);
3176
- },
3177
- renderNoAvailableOptionsTip: function renderNoAvailableOptionsTip() {
3178
- var h = this.$createElement;
3179
- var instance = this.instance;
3180
- return h(Tip, {
3181
- attrs: {
3182
- type: "no-options",
3183
- icon: "warning"
3184
- }
3185
- }, [instance.noOptionsText]);
3186
- },
3187
- renderNoResultsTip: function renderNoResultsTip() {
3188
- var h = this.$createElement;
3189
- var instance = this.instance;
3190
- return h(Tip, {
3191
- attrs: {
3192
- type: "no-results",
3193
- icon: "warning"
3194
- }
3195
- }, [instance.noResultsText]);
3196
- },
3197
- onMenuOpen: function onMenuOpen() {
3198
- this.adjustMenuOpenDirection();
3199
- this.setupMenuSizeWatcher();
3200
- this.setupMenuResizeAndScrollEventListeners();
3201
- },
3202
- onMenuClose: function onMenuClose() {
3203
- this.removeMenuSizeWatcher();
3204
- this.removeMenuResizeAndScrollEventListeners();
3205
- },
3206
- adjustMenuOpenDirection: function adjustMenuOpenDirection() {
3207
- var instance = this.instance;
3208
- if (!instance.menu.isOpen) return;
3209
- var $menu = instance.getMenu();
3210
- var $control = instance.getControl();
3211
- var menuRect = $menu.getBoundingClientRect();
3212
- var controlRect = $control.getBoundingClientRect();
3213
- var menuHeight = menuRect.height;
3214
- var viewportHeight = window.innerHeight;
3215
- var spaceAbove = controlRect.top;
3216
- var spaceBelow = window.innerHeight - controlRect.bottom;
3217
- var isControlInViewport = controlRect.top >= 0 && controlRect.top <= viewportHeight || controlRect.top < 0 && controlRect.bottom > 0;
3218
- var hasEnoughSpaceBelow = spaceBelow > menuHeight + MENU_BUFFER;
3219
- var hasEnoughSpaceAbove = spaceAbove > menuHeight + MENU_BUFFER;
3220
- if (!isControlInViewport) {
3221
- instance.closeMenu();
3222
- } else if (instance.openDirection !== 'auto') {
3223
- instance.menu.placement = directionMap[instance.openDirection];
3224
- } else if (hasEnoughSpaceBelow || !hasEnoughSpaceAbove) {
3225
- instance.menu.placement = 'bottom';
3226
- } else {
3227
- instance.menu.placement = 'top';
3228
- }
3229
- },
3230
- setupMenuSizeWatcher: function setupMenuSizeWatcher() {
3231
- var instance = this.instance;
3232
- var $menu = instance.getMenu();
3233
- if (this.menuSizeWatcher) return;
3234
- this.menuSizeWatcher = {
3235
- remove: watchSize($menu, this.adjustMenuOpenDirection)
3236
- };
3237
- },
3238
- setupMenuResizeAndScrollEventListeners: function setupMenuResizeAndScrollEventListeners() {
3239
- var instance = this.instance;
3240
- var $control = instance.getControl();
3241
- if (this.menuResizeAndScrollEventListeners) return;
3242
- this.menuResizeAndScrollEventListeners = {
3243
- remove: setupResizeAndScrollEventListeners($control, this.adjustMenuOpenDirection)
3244
- };
3245
- },
3246
- removeMenuSizeWatcher: function removeMenuSizeWatcher() {
3247
- if (!this.menuSizeWatcher) return;
3248
- this.menuSizeWatcher.remove();
3249
- this.menuSizeWatcher = null;
3250
- },
3251
- removeMenuResizeAndScrollEventListeners: function removeMenuResizeAndScrollEventListeners() {
3252
- if (!this.menuResizeAndScrollEventListeners) return;
3253
- this.menuResizeAndScrollEventListeners.remove();
3254
- this.menuResizeAndScrollEventListeners = null;
3255
- }
3256
- },
3257
- render: function render() {
3258
- var h = arguments[0];
3259
- return h("div", {
3260
- ref: "menu-container",
3261
- "class": "rp-treeselect__menu-container",
3262
- style: this.menuContainerStyle
3263
- }, [h("transition", {
3264
- attrs: {
3265
- name: "rp-treeselect__menu--transition"
3266
- }
3267
- }, [this.renderMenu()])]);
3268
- }
3269
- });
3270
- // CONCATENATED MODULE: ./src/components/Menu.vue?vue&type=script&lang=js
3271
- /* harmony default export */ var components_Menuvue_type_script_lang_js = (Menuvue_type_script_lang_js);
3272
- // CONCATENATED MODULE: ./src/components/Menu.vue
3273
- var Menu_render, Menu_staticRenderFns
3274
-
3275
-
3276
-
3277
-
3278
- /* normalize component */
3279
-
3280
- var Menu_component = normalizeComponent(
3281
- components_Menuvue_type_script_lang_js,
3282
- Menu_render,
3283
- Menu_staticRenderFns,
3284
- false,
3285
- null,
3286
- null,
3287
- null
3288
-
3289
- )
3290
-
3291
- /* hot reload */
3292
- if (false) { var Menu_api; }
3293
- Menu_component.options.__file = "src/components/Menu.vue"
3294
- /* harmony default export */ var Menu = (Menu_component.exports);
3295
- // 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
3296
-
3297
- 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; }
3298
- 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; }
3299
-
3300
-
3301
-
3302
- var PortalTarget = {
3303
- name: 'rp-treeselect--portal-target',
3304
- setup: function setup() {
3305
- var instance = Object(external_Vue_["inject"])('instance');
3306
- return {
3307
- instance: instance
3308
- };
3309
- },
3310
- watch: {
3311
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
3312
- if (newValue) {
3313
- this.setupHandlers();
3314
- } else {
3315
- this.removeHandlers();
3316
- }
3317
- },
3318
- 'instance.menu.placement': function instanceMenuPlacement() {
3319
- this.updateMenuContainerOffset();
3320
- }
3321
- },
3322
- created: function created() {
3323
- this.controlResizeAndScrollEventListeners = null;
3324
- this.controlSizeWatcher = null;
3325
- },
3326
- mounted: function mounted() {
3327
- var instance = this.instance;
3328
- if (instance.menu.isOpen) this.setupHandlers();
3329
- },
3330
- methods: {
3331
- setupHandlers: function setupHandlers() {
3332
- this.updateWidth();
3333
- this.updateMenuContainerOffset();
3334
- this.setupControlResizeAndScrollEventListeners();
3335
- this.setupControlSizeWatcher();
3336
- },
3337
- removeHandlers: function removeHandlers() {
3338
- this.removeControlResizeAndScrollEventListeners();
3339
- this.removeControlSizeWatcher();
3340
- },
3341
- setupControlResizeAndScrollEventListeners: function setupControlResizeAndScrollEventListeners() {
3342
- var instance = this.instance;
3343
- var $control = instance.getControl();
3344
- if (this.controlResizeAndScrollEventListeners) return;
3345
- this.controlResizeAndScrollEventListeners = {
3346
- remove: setupResizeAndScrollEventListeners($control, this.updateMenuContainerOffset)
3347
- };
3348
- },
3349
- setupControlSizeWatcher: function setupControlSizeWatcher() {
3350
- var _this = this;
3351
- var instance = this.instance;
3352
- var $control = instance.getControl();
3353
- if (this.controlSizeWatcher) return;
3354
- this.controlSizeWatcher = {
3355
- remove: watchSize($control, function () {
3356
- _this.updateWidth();
3357
- _this.updateMenuContainerOffset();
3358
- })
3359
- };
3360
- },
3361
- removeControlResizeAndScrollEventListeners: function removeControlResizeAndScrollEventListeners() {
3362
- if (!this.controlResizeAndScrollEventListeners) return;
3363
- this.controlResizeAndScrollEventListeners.remove();
3364
- this.controlResizeAndScrollEventListeners = null;
3365
- },
3366
- removeControlSizeWatcher: function removeControlSizeWatcher() {
3367
- if (!this.controlSizeWatcher) return;
3368
- this.controlSizeWatcher.remove();
3369
- this.controlSizeWatcher = null;
3370
- },
3371
- updateWidth: function updateWidth() {
3372
- var instance = this.instance;
3373
- var $portalTarget = this.$el;
3374
- var $control = instance.getControl();
3375
- var controlRect = $control.getBoundingClientRect();
3376
- $portalTarget.style.width = controlRect.width + 'px';
3377
- },
3378
- updateMenuContainerOffset: function updateMenuContainerOffset() {
3379
- var instance = this.instance;
3380
- var $control = instance.getControl();
3381
- var $portalTarget = this.$el;
3382
- var controlRect = $control.getBoundingClientRect();
3383
- var portalTargetRect = $portalTarget.getBoundingClientRect();
3384
- var offsetY = instance.menu.placement === 'bottom' ? controlRect.height : 0;
3385
- var left = Math.round(controlRect.left - portalTargetRect.left) + 'px';
3386
- var top = Math.round(controlRect.top - portalTargetRect.top + offsetY) + 'px';
3387
- var menuContainerStyle = this.$refs.menu.$refs['menu-container'].style;
3388
- var transformVariations = ['transform', 'webkitTransform', 'MozTransform', 'msTransform'];
3389
- var transform = find(transformVariations, function (t) {
3390
- return t in document.body.style;
3391
- });
3392
- menuContainerStyle[transform] = "translate(".concat(left, ", ").concat(top, ")");
3393
- }
3394
- },
3395
- render: function render() {
3396
- var h = arguments[0];
3397
- var instance = this.instance;
3398
- var portalTargetClass = ['rp-treeselect__portal-target', instance.wrapperClass];
3399
- var portalTargetStyle = {
3400
- zIndex: instance.zIndex
3401
- };
3402
- return h("div", {
3403
- "class": portalTargetClass,
3404
- style: portalTargetStyle,
3405
- attrs: {
3406
- "data-instance-id": instance.getInstanceId()
3407
- }
3408
- }, [h(Menu, {
3409
- ref: "menu"
3410
- })]);
3411
- },
3412
- destroyed: function destroyed() {
3413
- this.removeHandlers();
3414
- }
3415
- };
3416
- var placeholder;
3417
- /* harmony default export */ var MenuPortalvue_type_script_lang_js = ({
3418
- name: 'rp-treeselect--menu-portal',
3419
- created: function created() {
3420
- this.portalTarget = null;
3421
- },
3422
- mounted: function mounted() {
3423
- this.setup();
3424
- },
3425
- destroyed: function destroyed() {
3426
- this.teardown();
3427
- },
3428
- methods: {
3429
- setup: function setup() {
3430
- var el = document.createElement('div');
3431
- el.setAttribute('id', "menu-target-".concat(this._uid));
3432
- document.body.appendChild(el);
3433
- var targetApp = _objectSpread({
3434
- parent: this
3435
- }, PortalTarget);
3436
- this.portalTarget = Object(external_Vue_["createApp"])(targetApp);
3437
- this.portalTarget.mount("#menu-target-".concat(this._uid));
3438
- },
3439
- teardown: function teardown() {
3440
- document.body.removeChild(this.portalTarget.$el);
3441
- this.portalTarget.$el.innerHTML = '';
3442
- this.portalTarget.$destroy();
3443
- this.portalTarget = null;
3444
- }
3445
- },
3446
- render: function render() {
3447
- var h = arguments[0];
3448
- if (!placeholder) placeholder = h("div", {
3449
- "class": "rp-treeselect__menu-placeholder"
3450
- });
3451
- return placeholder;
3452
- }
3453
- });
3454
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue?vue&type=script&lang=js
3455
- /* harmony default export */ var components_MenuPortalvue_type_script_lang_js = (MenuPortalvue_type_script_lang_js);
3456
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue
3457
- var MenuPortal_render, MenuPortal_staticRenderFns
3458
-
3459
-
3460
-
3461
-
3462
- /* normalize component */
3463
-
3464
- var MenuPortal_component = normalizeComponent(
3465
- components_MenuPortalvue_type_script_lang_js,
3466
- MenuPortal_render,
3467
- MenuPortal_staticRenderFns,
3468
- false,
3469
- null,
3470
- null,
3471
- null
3472
-
3473
- )
3474
-
3475
- /* hot reload */
3476
- if (false) { var MenuPortal_api; }
3477
- MenuPortal_component.options.__file = "src/components/MenuPortal.vue"
3478
- /* harmony default export */ var MenuPortal = (MenuPortal_component.exports);
3479
- // 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
3480
-
3481
-
3482
-
3483
- 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; }
3484
- 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; }
3485
-
3486
-
3487
-
3488
-
3489
-
3490
-
3491
-
3492
-
3493
- function sortValueByIndex(a, b) {
3494
- var i = 0;
3495
- do {
3496
- if (a.level < i) return -1;
3497
- if (b.level < i) return 1;
3498
- if (a.index[i] !== b.index[i]) return a.index[i] - b.index[i];
3499
- i++;
3500
- } while (true);
3501
- }
3502
- function sortValueByLevel(a, b) {
3503
- return a.level === b.level ? sortValueByIndex(a, b) : a.level - b.level;
3504
- }
3505
- function createAsyncOptionsStates() {
3506
- return {
3507
- isLoaded: false,
3508
- isLoading: false,
3509
- loadingError: ''
3510
- };
3511
- }
3512
- function stringifyOptionPropValue(value) {
3513
- if (typeof value === 'string') return value;
3514
- if (typeof value === 'number' && !isNaN_isNaN(value)) return value + '';
3515
- return '';
3516
- }
3517
- function match(enableFuzzyMatch, needle, haystack) {
3518
- return enableFuzzyMatch ? fuzzysearch_default()(needle, haystack) : includes(haystack, needle);
3519
- }
3520
- function getErrorMessage(err) {
3521
- return err.message || String(err);
3522
- }
3523
- var instanceId = 0;
3524
- /* harmony default export */ var Treeselectvue_type_script_lang_js = ({
3525
- name: 'rp-treeselect',
3526
- props: {
3527
- allowClearingDisabled: {
3528
- type: Boolean,
3529
- default: false
3530
- },
3531
- allowSelectingDisabledDescendants: {
3532
- type: Boolean,
3533
- default: false
3534
- },
3535
- alwaysOpen: {
3536
- type: Boolean,
3537
- default: false
3538
- },
3539
- appendToBody: {
3540
- type: Boolean,
3541
- default: false
3542
- },
3543
- async: {
3544
- type: Boolean,
3545
- default: false
3546
- },
3547
- autoFocus: {
3548
- type: Boolean,
3549
- default: false
3550
- },
3551
- autoLoadRootOptions: {
3552
- type: Boolean,
3553
- default: true
3554
- },
3555
- autoDeselectAncestors: {
3556
- type: Boolean,
3557
- default: false
3558
- },
3559
- autoDeselectDescendants: {
3560
- type: Boolean,
3561
- default: false
3562
- },
3563
- autoSelectAncestors: {
3564
- type: Boolean,
3565
- default: false
3566
- },
3567
- autoSelectDescendants: {
3568
- type: Boolean,
3569
- default: false
3570
- },
3571
- backspaceRemoves: {
3572
- type: Boolean,
3573
- default: true
3574
- },
3575
- beforeClearAll: {
3576
- type: Function,
3577
- default: constant_default()(true)
3578
- },
3579
- branchNodesFirst: {
3580
- type: Boolean,
3581
- default: false
3582
- },
3583
- cacheOptions: {
3584
- type: Boolean,
3585
- default: true
3586
- },
3587
- clearable: {
3588
- type: Boolean,
3589
- default: true
3590
- },
3591
- clearAllText: {
3592
- type: String,
3593
- default: 'Clear all'
3594
- },
3595
- clearOnSelect: {
3596
- type: Boolean,
3597
- default: false
3598
- },
3599
- clearValueText: {
3600
- type: String,
3601
- default: 'Clear value'
3602
- },
3603
- closeOnSelect: {
3604
- type: Boolean,
3605
- default: true
3606
- },
3607
- defaultExpandLevel: {
3608
- type: Number,
3609
- default: 0
3610
- },
3611
- defaultOptions: {
3612
- default: false
3613
- },
3614
- deleteRemoves: {
3615
- type: Boolean,
3616
- default: true
3617
- },
3618
- delimiter: {
3619
- type: String,
3620
- default: ','
3621
- },
3622
- flattenSearchResults: {
3623
- type: Boolean,
3624
- default: false
3625
- },
3626
- disableBranchNodes: {
3627
- type: Boolean,
3628
- default: false
3629
- },
3630
- disabled: {
3631
- type: Boolean,
3632
- default: false
3633
- },
3634
- disableFuzzyMatching: {
3635
- type: Boolean,
3636
- default: false
3637
- },
3638
- flat: {
3639
- type: Boolean,
3640
- default: false
3641
- },
3642
- instanceId: {
3643
- default: function _default() {
3644
- return "".concat(instanceId++, "$$");
3645
- },
3646
- type: [String, Number]
3647
- },
3648
- joinValues: {
3649
- type: Boolean,
3650
- default: false
3651
- },
3652
- limit: {
3653
- type: Number,
3654
- default: Infinity
3655
- },
3656
- limitText: {
3657
- type: Function,
3658
- default: function limitTextDefault(count) {
3659
- return "and ".concat(count, " more");
3660
- }
3661
- },
3662
- loadingText: {
3663
- type: String,
3664
- default: 'Loading...'
3665
- },
3666
- loadOptions: {
3667
- type: Function
3668
- },
3669
- matchKeys: {
3670
- type: Array,
3671
- default: constant_default()(['label'])
3672
- },
3673
- maxHeight: {
3674
- type: Number,
3675
- default: 300
3676
- },
3677
- multiple: {
3678
- type: Boolean,
3679
- default: false
3680
- },
3681
- name: {
3682
- type: String
3683
- },
3684
- noChildrenText: {
3685
- type: String,
3686
- default: 'No sub-options.'
3687
- },
3688
- noOptionsText: {
3689
- type: String,
3690
- default: 'No options available.'
3691
- },
3692
- noResultsText: {
3693
- type: String,
3694
- default: 'No results found...'
3695
- },
3696
- normalizer: {
3697
- type: Function,
3698
- default: identity_default.a
3699
- },
3700
- openDirection: {
3701
- type: String,
3702
- default: 'auto',
3703
- validator: function validator(value) {
3704
- var acceptableValues = ['auto', 'top', 'bottom', 'above', 'below'];
3705
- return includes(acceptableValues, value);
3706
- }
3707
- },
3708
- openOnClick: {
3709
- type: Boolean,
3710
- default: true
3711
- },
3712
- openOnFocus: {
3713
- type: Boolean,
3714
- default: false
3715
- },
3716
- options: {
3717
- type: Array
3718
- },
3719
- placeholder: {
3720
- type: String,
3721
- default: 'Select...'
3722
- },
3723
- required: {
3724
- type: Boolean,
3725
- default: false
3726
- },
3727
- retryText: {
3728
- type: String,
3729
- default: 'Retry?'
3730
- },
3731
- retryTitle: {
3732
- type: String,
3733
- default: 'Click to retry'
3734
- },
3735
- searchable: {
3736
- type: Boolean,
3737
- default: true
3738
- },
3739
- searchNested: {
3740
- type: Boolean,
3741
- default: false
3742
- },
3743
- searchPromptText: {
3744
- type: String,
3745
- default: 'Type to search...'
3746
- },
3747
- showCount: {
3748
- type: Boolean,
3749
- default: false
3750
- },
3751
- showCountOf: {
3752
- type: String,
3753
- default: ALL_CHILDREN,
3754
- validator: function validator(value) {
3755
- var acceptableValues = [ALL_CHILDREN, ALL_DESCENDANTS, LEAF_CHILDREN, LEAF_DESCENDANTS];
3756
- return includes(acceptableValues, value);
3757
- }
3758
- },
3759
- showCountOnSearch: null,
3760
- sortValueBy: {
3761
- type: String,
3762
- default: ORDER_SELECTED,
3763
- validator: function validator(value) {
3764
- var acceptableValues = [ORDER_SELECTED, LEVEL, INDEX];
3765
- return includes(acceptableValues, value);
3766
- }
3767
- },
3768
- tabIndex: {
3769
- type: Number,
3770
- default: 0
3771
- },
3772
- value: null,
3773
- valueConsistsOf: {
3774
- type: String,
3775
- default: BRANCH_PRIORITY,
3776
- validator: function validator(value) {
3777
- var acceptableValues = [ALL, BRANCH_PRIORITY, LEAF_PRIORITY, ALL_WITH_INDETERMINATE];
3778
- return includes(acceptableValues, value);
3779
- }
3780
- },
3781
- valueFormat: {
3782
- type: String,
3783
- default: 'id'
3784
- },
3785
- zIndex: {
3786
- type: [Number, String],
3787
- default: 999
3788
- }
3789
- },
3790
- data: function data() {
3791
- return {
3792
- trigger: {
3793
- isFocused: false,
3794
- searchQuery: ''
3795
- },
3796
- menu: {
3797
- isOpen: false,
3798
- current: null,
3799
- lastScrollPosition: 0,
3800
- placement: 'bottom'
3801
- },
3802
- forest: {
3803
- normalizedOptions: [],
3804
- nodeMap: createMap(),
3805
- checkedStateMap: createMap(),
3806
- selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
3807
- selectedNodeMap: createMap()
3808
- },
3809
- rootOptionsStates: createAsyncOptionsStates(),
3810
- localSearch: {
3811
- active: false,
3812
- noResults: true,
3813
- countMap: createMap()
3814
- },
3815
- remoteSearch: createMap()
3816
- };
3817
- },
3818
- computed: {
3819
- selectedNodes: function selectedNodes() {
3820
- return this.forest.selectedNodeIds.map(this.getNode);
3821
- },
3822
- internalValue: function internalValue() {
3823
- var _this = this;
3824
- var internalValue;
3825
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
3826
- internalValue = this.forest.selectedNodeIds.slice();
3827
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
3828
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
3829
- var node = _this.getNode(id);
3830
- if (node.isRootNode) return true;
3831
- return !_this.isSelected(node.parentNode);
3832
- });
3833
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
3834
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
3835
- var node = _this.getNode(id);
3836
- if (node.isLeaf) return true;
3837
- return node.children.length === 0;
3838
- });
3839
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
3840
- var _internalValue;
3841
- var indeterminateNodeIds = [];
3842
- internalValue = this.forest.selectedNodeIds.slice();
3843
- this.selectedNodes.forEach(function (selectedNode) {
3844
- selectedNode.ancestors.forEach(function (ancestor) {
3845
- if (includes(indeterminateNodeIds, ancestor.id)) return;
3846
- if (includes(internalValue, ancestor.id)) return;
3847
- indeterminateNodeIds.push(ancestor.id);
3848
- });
3849
- });
3850
- (_internalValue = internalValue).push.apply(_internalValue, indeterminateNodeIds);
3851
- }
3852
- if (this.sortValueBy === LEVEL) {
3853
- internalValue.sort(function (a, b) {
3854
- return sortValueByLevel(_this.getNode(a), _this.getNode(b));
3855
- });
3856
- } else if (this.sortValueBy === INDEX) {
3857
- internalValue.sort(function (a, b) {
3858
- return sortValueByIndex(_this.getNode(a), _this.getNode(b));
3859
- });
3860
- }
3861
- return internalValue;
3862
- },
3863
- hasValue: function hasValue() {
3864
- return this.internalValue.length > 0;
3865
- },
3866
- single: function single() {
3867
- return !this.multiple;
3868
- },
3869
- visibleOptionIds: function visibleOptionIds() {
3870
- var _this2 = this;
3871
- var visibleOptionIds = [];
3872
- this.traverseAllNodesByIndex(function (node) {
3873
- if (!_this2.localSearch.active || _this2.shouldOptionBeIncludedInSearchResult(node)) {
3874
- visibleOptionIds.push(node.id);
3875
- }
3876
- if (node.isBranch && !_this2.shouldExpand(node)) {
3877
- return false;
3878
- }
3879
- });
3880
- return visibleOptionIds;
3881
- },
3882
- hasVisibleOptions: function hasVisibleOptions() {
3883
- return this.visibleOptionIds.length !== 0;
3884
- },
3885
- showCountOnSearchComputed: function showCountOnSearchComputed() {
3886
- return typeof this.showCountOnSearch === 'boolean' ? this.showCountOnSearch : this.showCount;
3887
- },
3888
- hasBranchNodes: function hasBranchNodes() {
3889
- return this.forest.normalizedOptions.some(function (rootNode) {
3890
- return rootNode.isBranch;
3891
- });
3892
- },
3893
- shouldFlattenOptions: function shouldFlattenOptions() {
3894
- return this.localSearch.active && this.flattenSearchResults;
3895
- },
3896
- wrapperClass: function wrapperClass() {
3897
- return {
3898
- 'rp-treeselect': true,
3899
- 'rp-treeselect--single': this.single,
3900
- 'rp-treeselect--multi': this.multiple,
3901
- 'rp-treeselect--searchable': this.searchable,
3902
- 'rp-treeselect--disabled': this.disabled,
3903
- 'rp-treeselect--focused': this.trigger.isFocused,
3904
- 'rp-treeselect--has-value': this.hasValue,
3905
- 'rp-treeselect--open': this.menu.isOpen,
3906
- 'rp-treeselect--open-above': this.menu.placement === 'top',
3907
- 'rp-treeselect--open-below': this.menu.placement === 'bottom',
3908
- 'rp-treeselect--branch-nodes-disabled': this.disableBranchNodes,
3909
- 'rp-treeselect--append-to-body': this.appendToBody,
3910
- 'rp-treeselect--test': true
3911
- };
3912
- }
3913
- },
3914
- watch: {
3915
- alwaysOpen: function alwaysOpen(newValue) {
3916
- if (newValue) this.openMenu();else this.closeMenu();
3917
- },
3918
- branchNodesFirst: function branchNodesFirst() {
3919
- this.initialize();
3920
- },
3921
- disabled: function disabled(newValue) {
3922
- if (newValue && this.menu.isOpen) this.closeMenu();else if (!newValue && !this.menu.isOpen && this.alwaysOpen) this.openMenu();
3923
- },
3924
- flat: function flat() {
3925
- this.initialize();
3926
- },
3927
- internalValue: function internalValue(newValue, oldValue) {
3928
- var hasChanged = quickDiff(newValue, oldValue);
3929
- if (hasChanged) this.$emit('input', this.getValue(), this.getInstanceId());
3930
- },
3931
- matchKeys: function matchKeys() {
3932
- this.initialize();
3933
- },
3934
- multiple: function multiple(newValue) {
3935
- if (newValue) this.buildForestState();
3936
- },
3937
- options: {
3938
- handler: function handler() {
3939
- if (this.async) return;
3940
- this.initialize();
3941
- this.rootOptionsStates.isLoaded = Array.isArray(this.options);
3942
- },
3943
- deep: true,
3944
- immediate: true
3945
- },
3946
- 'trigger.searchQuery': function triggerSearchQuery() {
3947
- if (this.async) {
3948
- this.handleRemoteSearch();
3949
- } else {
3950
- this.handleLocalSearch();
3951
- }
3952
- this.$emit('search-change', this.trigger.searchQuery, this.getInstanceId());
3953
- },
3954
- value: function value() {
3955
- var nodeIdsFromValue = this.extractCheckedNodeIdsFromValue();
3956
- var hasChanged = quickDiff(nodeIdsFromValue, this.internalValue);
3957
- if (hasChanged) this.fixSelectedNodeIds(nodeIdsFromValue);
3958
- }
3959
- },
3960
- created: function created() {
3961
- this.verifyProps();
3962
- this.resetFlags();
3963
- Object(external_Vue_["provide"])('instance', this);
3964
- },
3965
- mounted: function mounted() {
3966
- if (this.autoFocus) this.focusInput();
3967
- if (!this.options && !this.async && this.autoLoadRootOptions) this.loadRootOptions();
3968
- if (this.alwaysOpen) this.openMenu();
3969
- if (this.async && this.defaultOptions) this.handleRemoteSearch();
3970
- },
3971
- destroyed: function destroyed() {
3972
- this.toggleClickOutsideEvent(false);
3973
- },
3974
- methods: {
3975
- verifyProps: function verifyProps() {
3976
- var _this3 = this;
3977
- warning_warning(function () {
3978
- return _this3.async ? _this3.searchable : true;
3979
- }, function () {
3980
- return 'For async search mode, the value of "searchable" prop must be true.';
3981
- });
3982
- if (this.options == null && !this.loadOptions) {
3983
- warning_warning(function () {
3984
- return false;
3985
- }, function () {
3986
- return 'Are you meant to dynamically load options? You need to use "loadOptions" prop.';
3987
- });
3988
- }
3989
- if (this.flat) {
3990
- warning_warning(function () {
3991
- return _this3.multiple;
3992
- }, function () {
3993
- return 'You are using flat mode. But you forgot to add "multiple=true"?';
3994
- });
3995
- }
3996
- if (!this.flat) {
3997
- var propNames = ['autoSelectAncestors', 'autoSelectDescendants', 'autoDeselectAncestors', 'autoDeselectDescendants'];
3998
- propNames.forEach(function (propName) {
3999
- warning_warning(function () {
4000
- return !_this3[propName];
4001
- }, function () {
4002
- return "\"".concat(propName, "\" only applies to flat mode.");
4003
- });
4004
- });
4005
- }
4006
- },
4007
- resetFlags: function resetFlags() {
4008
- this._blurOnSelect = false;
4009
- },
4010
- initialize: function initialize() {
4011
- var options = this.async ? this.getRemoteSearchEntry().options : this.options;
4012
- if (Array.isArray(options)) {
4013
- var prevNodeMap = this.forest.nodeMap;
4014
- this.forest.nodeMap = createMap();
4015
- this.keepDataOfSelectedNodes(prevNodeMap);
4016
- this.forest.normalizedOptions = this.normalize(NO_PARENT_NODE, options, prevNodeMap);
4017
- this.fixSelectedNodeIds(this.internalValue);
4018
- } else {
4019
- this.forest.normalizedOptions = [];
4020
- }
4021
- },
4022
- getInstanceId: function getInstanceId() {
4023
- return this.instanceId == null ? this.id : this.instanceId;
4024
- },
4025
- getValue: function getValue() {
4026
- var _this4 = this;
4027
- if (this.valueFormat === 'id') {
4028
- return this.multiple ? this.internalValue.slice() : this.internalValue[0];
4029
- }
4030
- var rawNodes = this.internalValue.map(function (id) {
4031
- return _this4.getNode(id).raw;
4032
- });
4033
- return this.multiple ? rawNodes : rawNodes[0];
4034
- },
4035
- getNode: function getNode(nodeId) {
4036
- warning_warning(function () {
4037
- return nodeId != null;
4038
- }, function () {
4039
- return "Invalid node id: ".concat(nodeId);
4040
- });
4041
- if (nodeId == null) return null;
4042
- return nodeId in this.forest.nodeMap ? this.forest.nodeMap[nodeId] : this.createFallbackNode(nodeId);
4043
- },
4044
- createFallbackNode: function createFallbackNode(id) {
4045
- var raw = this.extractNodeFromValue(id);
4046
- var label = this.enhancedNormalizer(raw).label || "".concat(id, " (unknown)");
4047
- var fallbackNode = {
4048
- id: id,
4049
- label: label,
4050
- ancestors: [],
4051
- parentNode: NO_PARENT_NODE,
4052
- isFallbackNode: true,
4053
- isRootNode: true,
4054
- isLeaf: true,
4055
- isBranch: false,
4056
- isDisabled: false,
4057
- isNew: false,
4058
- index: [-1],
4059
- level: 0,
4060
- raw: raw
4061
- };
4062
- return this.$set(this.forest.nodeMap, id, fallbackNode);
4063
- },
4064
- extractCheckedNodeIdsFromValue: function extractCheckedNodeIdsFromValue() {
4065
- var _this5 = this;
4066
- if (this.value == null) return [];
4067
- if (this.valueFormat === 'id') {
4068
- return this.multiple ? this.value.slice() : [this.value];
4069
- }
4070
- return (this.multiple ? this.value : [this.value]).map(function (node) {
4071
- return _this5.enhancedNormalizer(node);
4072
- }).map(function (node) {
4073
- return node.id;
4074
- });
4075
- },
4076
- extractNodeFromValue: function extractNodeFromValue(id) {
4077
- var _this6 = this;
4078
- var defaultNode = {
4079
- id: id
4080
- };
4081
- if (this.valueFormat === 'id') {
4082
- return defaultNode;
4083
- }
4084
- var valueArray = this.multiple ? Array.isArray(this.value) ? this.value : [] : this.value ? [this.value] : [];
4085
- var matched = find(valueArray, function (node) {
4086
- return node && _this6.enhancedNormalizer(node).id === id;
4087
- });
4088
- return matched || defaultNode;
4089
- },
4090
- fixSelectedNodeIds: function fixSelectedNodeIds(nodeIdListOfPrevValue) {
4091
- var _this7 = this;
4092
- var nextSelectedNodeIds = [];
4093
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
4094
- nextSelectedNodeIds = nodeIdListOfPrevValue;
4095
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
4096
- nodeIdListOfPrevValue.forEach(function (nodeId) {
4097
- nextSelectedNodeIds.push(nodeId);
4098
- var node = _this7.getNode(nodeId);
4099
- if (node.isBranch) _this7.traverseDescendantsBFS(node, function (descendant) {
4100
- nextSelectedNodeIds.push(descendant.id);
4101
- });
4102
- });
4103
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
4104
- var map = createMap();
4105
- var queue = nodeIdListOfPrevValue.slice();
4106
- while (queue.length) {
4107
- var nodeId = queue.shift();
4108
- var node = this.getNode(nodeId);
4109
- nextSelectedNodeIds.push(nodeId);
4110
- if (node.isRootNode) continue;
4111
- if (!(node.parentNode.id in map)) map[node.parentNode.id] = node.parentNode.children.length;
4112
- if (--map[node.parentNode.id] === 0) queue.push(node.parentNode.id);
4113
- }
4114
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
4115
- var _map = createMap();
4116
- var _queue = nodeIdListOfPrevValue.filter(function (nodeId) {
4117
- var node = _this7.getNode(nodeId);
4118
- return node.isLeaf || node.children.length === 0;
4119
- });
4120
- while (_queue.length) {
4121
- var _nodeId = _queue.shift();
4122
- var _node = this.getNode(_nodeId);
4123
- nextSelectedNodeIds.push(_nodeId);
4124
- if (_node.isRootNode) continue;
4125
- if (!(_node.parentNode.id in _map)) _map[_node.parentNode.id] = _node.parentNode.children.length;
4126
- if (--_map[_node.parentNode.id] === 0) _queue.push(_node.parentNode.id);
4127
- }
4128
- }
4129
- var hasChanged = quickDiff(this.forest.selectedNodeIds, nextSelectedNodeIds);
4130
- if (hasChanged) this.forest.selectedNodeIds = nextSelectedNodeIds;
4131
- this.buildForestState();
4132
- },
4133
- keepDataOfSelectedNodes: function keepDataOfSelectedNodes(prevNodeMap) {
4134
- var _this8 = this;
4135
- this.forest.selectedNodeIds.forEach(function (id) {
4136
- if (!prevNodeMap[id]) return;
4137
- var node = Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, prevNodeMap[id]), {}, {
4138
- isFallbackNode: true
4139
- });
4140
- _this8.$set(_this8.forest.nodeMap, id, node);
4141
- });
4142
- },
4143
- isSelected: function isSelected(node) {
4144
- return this.forest.selectedNodeMap[node.id] === true;
4145
- },
4146
- traverseDescendantsBFS: function traverseDescendantsBFS(parentNode, callback) {
4147
- if (!parentNode.isBranch) return;
4148
- var queue = parentNode.children.slice();
4149
- while (queue.length) {
4150
- var currNode = queue[0];
4151
- if (currNode.isBranch) queue.push.apply(queue, toConsumableArray_default()(currNode.children));
4152
- callback(currNode);
4153
- queue.shift();
4154
- }
4155
- },
4156
- traverseDescendantsDFS: function traverseDescendantsDFS(parentNode, callback) {
4157
- var _this9 = this;
4158
- if (!parentNode.isBranch) return;
4159
- parentNode.children.forEach(function (child) {
4160
- _this9.traverseDescendantsDFS(child, callback);
4161
- callback(child);
4162
- });
4163
- },
4164
- traverseAllNodesDFS: function traverseAllNodesDFS(callback) {
4165
- var _this10 = this;
4166
- this.forest.normalizedOptions.forEach(function (rootNode) {
4167
- _this10.traverseDescendantsDFS(rootNode, callback);
4168
- callback(rootNode);
4169
- });
4170
- },
4171
- traverseAllNodesByIndex: function traverseAllNodesByIndex(callback) {
4172
- var walk = function walk(parentNode) {
4173
- parentNode.children.forEach(function (child) {
4174
- if (callback(child) !== false && child.isBranch) {
4175
- walk(child);
4176
- }
4177
- });
4178
- };
4179
- walk({
4180
- children: this.forest.normalizedOptions
4181
- });
4182
- },
4183
- toggleClickOutsideEvent: function toggleClickOutsideEvent(enabled) {
4184
- if (enabled) {
4185
- document.addEventListener('mousedown', this.handleClickOutside, false);
4186
- } else {
4187
- document.removeEventListener('mousedown', this.handleClickOutside, false);
4188
- }
4189
- },
4190
- getValueContainer: function getValueContainer() {
4191
- return this.$refs.control.$refs['value-container'];
4192
- },
4193
- getInput: function getInput() {
4194
- return this.getValueContainer().$refs.input;
4195
- },
4196
- focusInput: function focusInput() {
4197
- this.getInput().focus();
4198
- },
4199
- blurInput: function blurInput() {
4200
- this.getInput().blur();
4201
- },
4202
- handleMouseDown: onLeftClick(function handleMouseDown(evt) {
4203
- evt.preventDefault();
4204
- evt.stopPropagation();
4205
- if (this.disabled) return;
4206
- var isClickedOnValueContainer = this.getValueContainer().$el.contains(evt.target);
4207
- if (isClickedOnValueContainer && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused)) {
4208
- this.openMenu();
4209
- }
4210
- if (this._blurOnSelect) {
4211
- this.blurInput();
4212
- } else {
4213
- this.focusInput();
4214
- }
4215
- this.resetFlags();
4216
- }),
4217
- handleClickOutside: function handleClickOutside(evt) {
4218
- if (this.$refs.wrapper && !this.$refs.wrapper.contains(evt.target)) {
4219
- this.blurInput();
4220
- this.closeMenu();
4221
- }
4222
- },
4223
- handleLocalSearch: function handleLocalSearch() {
4224
- var _this11 = this;
4225
- var searchQuery = this.trigger.searchQuery;
4226
- var done = function done() {
4227
- return _this11.resetHighlightedOptionWhenNecessary(true);
4228
- };
4229
- if (!searchQuery) {
4230
- this.localSearch.active = false;
4231
- return done();
4232
- }
4233
- this.localSearch.active = true;
4234
- this.localSearch.noResults = true;
4235
- this.traverseAllNodesDFS(function (node) {
4236
- if (node.isBranch) {
4237
- node.isExpandedOnSearch = false;
4238
- node.showAllChildrenOnSearch = false;
4239
- node.isMatched = false;
4240
- node.hasMatchedDescendants = false;
4241
- _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));
4242
- }
4243
- });
4244
- var lowerCasedSearchQuery = searchQuery.trim().toLocaleLowerCase();
4245
- var splitSearchQuery = lowerCasedSearchQuery.replace(/\s+/g, ' ').split(' ');
4246
- this.traverseAllNodesDFS(function (node) {
4247
- if (_this11.searchNested && splitSearchQuery.length > 1) {
4248
- node.isMatched = splitSearchQuery.every(function (filterValue) {
4249
- return match(false, filterValue, node.nestedSearchLabel);
4250
- });
4251
- } else {
4252
- node.isMatched = _this11.matchKeys.some(function (matchKey) {
4253
- return match(!_this11.disableFuzzyMatching, lowerCasedSearchQuery, node.lowerCased[matchKey]);
4254
- });
4255
- }
4256
- if (node.isMatched) {
4257
- _this11.localSearch.noResults = false;
4258
- node.ancestors.forEach(function (ancestor) {
4259
- return _this11.localSearch.countMap[ancestor.id][ALL_DESCENDANTS]++;
4260
- });
4261
- if (node.isLeaf) node.ancestors.forEach(function (ancestor) {
4262
- return _this11.localSearch.countMap[ancestor.id][LEAF_DESCENDANTS]++;
4263
- });
4264
- if (node.parentNode !== NO_PARENT_NODE) {
4265
- _this11.localSearch.countMap[node.parentNode.id][ALL_CHILDREN] += 1;
4266
- if (node.isLeaf) _this11.localSearch.countMap[node.parentNode.id][LEAF_CHILDREN] += 1;
4267
- }
4268
- }
4269
- if ((node.isMatched || node.isBranch && node.isExpandedOnSearch) && node.parentNode !== NO_PARENT_NODE) {
4270
- node.parentNode.isExpandedOnSearch = true;
4271
- node.parentNode.hasMatchedDescendants = true;
4272
- }
4273
- });
4274
- done();
4275
- },
4276
- handleRemoteSearch: function handleRemoteSearch() {
4277
- var _this12 = this;
4278
- var searchQuery = this.trigger.searchQuery;
4279
- var entry = this.getRemoteSearchEntry();
4280
- var done = function done() {
4281
- _this12.initialize();
4282
- _this12.resetHighlightedOptionWhenNecessary(true);
4283
- };
4284
- if ((searchQuery === '' || this.cacheOptions) && entry.isLoaded) {
4285
- return done();
4286
- }
4287
- this.callLoadOptionsProp({
4288
- action: ASYNC_SEARCH,
4289
- args: {
4290
- searchQuery: searchQuery
4291
- },
4292
- isPending: function isPending() {
4293
- return entry.isLoading;
4294
- },
4295
- start: function start() {
4296
- entry.isLoading = true;
4297
- entry.isLoaded = false;
4298
- entry.loadingError = '';
4299
- },
4300
- succeed: function succeed(options) {
4301
- entry.isLoaded = true;
4302
- entry.options = options;
4303
- if (_this12.trigger.searchQuery === searchQuery) done();
4304
- },
4305
- fail: function fail(err) {
4306
- entry.loadingError = getErrorMessage(err);
4307
- },
4308
- end: function end() {
4309
- entry.isLoading = false;
4310
- }
4311
- });
4312
- },
4313
- getRemoteSearchEntry: function getRemoteSearchEntry() {
4314
- var _this13 = this;
4315
- var searchQuery = this.trigger.searchQuery;
4316
- var entry = this.remoteSearch[searchQuery] || Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, createAsyncOptionsStates()), {}, {
4317
- options: []
4318
- });
4319
- this.$watch(function () {
4320
- return entry.options;
4321
- }, function () {
4322
- if (_this13.trigger.searchQuery === searchQuery) _this13.initialize();
4323
- }, {
4324
- deep: true
4325
- });
4326
- if (searchQuery === '') {
4327
- if (Array.isArray(this.defaultOptions)) {
4328
- entry.options = this.defaultOptions;
4329
- entry.isLoaded = true;
4330
- return entry;
4331
- } else if (this.defaultOptions !== true) {
4332
- entry.isLoaded = true;
4333
- return entry;
4334
- }
4335
- }
4336
- if (!this.remoteSearch[searchQuery]) {
4337
- this.$set(this.remoteSearch, searchQuery, entry);
4338
- }
4339
- return entry;
4340
- },
4341
- shouldExpand: function shouldExpand(node) {
4342
- return this.localSearch.active ? node.isExpandedOnSearch : node.isExpanded;
4343
- },
4344
- shouldOptionBeIncludedInSearchResult: function shouldOptionBeIncludedInSearchResult(node) {
4345
- if (node.isMatched) return true;
4346
- if (node.isBranch && node.hasMatchedDescendants && !this.flattenSearchResults) return true;
4347
- if (!node.isRootNode && node.parentNode.showAllChildrenOnSearch) return true;
4348
- return false;
4349
- },
4350
- shouldShowOptionInMenu: function shouldShowOptionInMenu(node) {
4351
- if (this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(node)) {
4352
- return false;
4353
- }
4354
- return true;
4355
- },
4356
- getControl: function getControl() {
4357
- return this.$refs.control.$el;
4358
- },
4359
- getMenu: function getMenu() {
4360
- var ref = this.appendToBody ? this.$refs.portal.portalTarget : this;
4361
- var $menu = ref.$refs.menu.$refs.menu;
4362
- return $menu && $menu.nodeName !== '#comment' ? $menu : null;
4363
- },
4364
- setCurrentHighlightedOption: function setCurrentHighlightedOption(node) {
4365
- var _this14 = this;
4366
- var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4367
- var prev = this.menu.current;
4368
- if (prev != null && prev in this.forest.nodeMap) {
4369
- this.forest.nodeMap[prev].isHighlighted = false;
4370
- }
4371
- this.menu.current = node.id;
4372
- node.isHighlighted = true;
4373
- if (this.menu.isOpen && scroll) {
4374
- var scrollToOption = function scrollToOption() {
4375
- var $menu = _this14.getMenu();
4376
- var $option = $menu.querySelector(".rp-treeselect__option[data-id=\"".concat(node.id, "\"]"));
4377
- if ($option) scrollIntoView($menu, $option);
4378
- };
4379
- if (this.getMenu()) {
4380
- scrollToOption();
4381
- } else {
4382
- this.$nextTick(scrollToOption);
4383
- }
4384
- }
4385
- },
4386
- resetHighlightedOptionWhenNecessary: function resetHighlightedOptionWhenNecessary() {
4387
- var forceReset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4388
- var current = this.menu.current;
4389
- if (forceReset || current == null || !(current in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(current))) {
4390
- this.highlightFirstOption();
4391
- }
4392
- },
4393
- highlightFirstOption: function highlightFirstOption() {
4394
- if (!this.hasVisibleOptions) return;
4395
- var first = this.visibleOptionIds[0];
4396
- this.setCurrentHighlightedOption(this.getNode(first));
4397
- },
4398
- highlightPrevOption: function highlightPrevOption() {
4399
- if (!this.hasVisibleOptions) return;
4400
- var prev = this.visibleOptionIds.indexOf(this.menu.current) - 1;
4401
- if (prev === -1) return this.highlightLastOption();
4402
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[prev]));
4403
- },
4404
- highlightNextOption: function highlightNextOption() {
4405
- if (!this.hasVisibleOptions) return;
4406
- var next = this.visibleOptionIds.indexOf(this.menu.current) + 1;
4407
- if (next === this.visibleOptionIds.length) return this.highlightFirstOption();
4408
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[next]));
4409
- },
4410
- highlightLastOption: function highlightLastOption() {
4411
- if (!this.hasVisibleOptions) return;
4412
- var last = last_default()(this.visibleOptionIds);
4413
- this.setCurrentHighlightedOption(this.getNode(last));
4414
- },
4415
- resetSearchQuery: function resetSearchQuery() {
4416
- this.trigger.searchQuery = '';
4417
- },
4418
- closeMenu: function closeMenu() {
4419
- if (!this.menu.isOpen || !this.disabled && this.alwaysOpen) return;
4420
- this.saveMenuScrollPosition();
4421
- this.menu.isOpen = false;
4422
- this.toggleClickOutsideEvent(false);
4423
- this.resetSearchQuery();
4424
- this.$emit('close', this.getValue(), this.getInstanceId());
4425
- },
4426
- openMenu: function openMenu() {
4427
- if (this.disabled || this.menu.isOpen) return;
4428
- this.menu.isOpen = true;
4429
- this.$nextTick(this.resetHighlightedOptionWhenNecessary);
4430
- this.$nextTick(this.restoreMenuScrollPosition);
4431
- if (!this.options && !this.async) this.loadRootOptions();
4432
- this.toggleClickOutsideEvent(true);
4433
- this.$emit('open', this.getInstanceId());
4434
- },
4435
- toggleMenu: function toggleMenu() {
4436
- if (this.menu.isOpen) {
4437
- this.closeMenu();
4438
- } else {
4439
- this.openMenu();
4440
- }
4441
- },
4442
- toggleExpanded: function toggleExpanded(node) {
4443
- var nextState;
4444
- if (this.localSearch.active) {
4445
- nextState = node.isExpandedOnSearch = !node.isExpandedOnSearch;
4446
- if (nextState) node.showAllChildrenOnSearch = true;
4447
- } else {
4448
- nextState = node.isExpanded = !node.isExpanded;
4449
- }
4450
- if (nextState && !node.childrenStates.isLoaded) {
4451
- this.loadChildrenOptions(node);
4452
- }
4453
- },
4454
- buildForestState: function buildForestState() {
4455
- var _this15 = this;
4456
- var selectedNodeMap = createMap();
4457
- this.forest.selectedNodeIds.forEach(function (selectedNodeId) {
4458
- selectedNodeMap[selectedNodeId] = true;
4459
- });
4460
- this.forest.selectedNodeMap = selectedNodeMap;
4461
- var checkedStateMap = createMap();
4462
- if (this.multiple) {
4463
- this.traverseAllNodesByIndex(function (node) {
4464
- checkedStateMap[node.id] = UNCHECKED;
4465
- });
4466
- this.selectedNodes.forEach(function (selectedNode) {
4467
- checkedStateMap[selectedNode.id] = CHECKED;
4468
- if (!_this15.flat && !_this15.disableBranchNodes) {
4469
- selectedNode.ancestors.forEach(function (ancestorNode) {
4470
- if (!_this15.isSelected(ancestorNode)) {
4471
- checkedStateMap[ancestorNode.id] = INDETERMINATE;
4472
- }
4473
- });
4474
- }
4475
- });
4476
- }
4477
- this.forest.checkedStateMap = checkedStateMap;
4478
- },
4479
- enhancedNormalizer: function enhancedNormalizer(raw) {
4480
- return Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, raw), this.normalizer(raw, this.getInstanceId()));
4481
- },
4482
- normalize: function normalize(parentNode, nodes, prevNodeMap) {
4483
- var _this16 = this;
4484
- var normalizedOptions = nodes.map(function (node) {
4485
- return [_this16.enhancedNormalizer(node), node];
4486
- }).map(function (_ref, index) {
4487
- var _ref2 = slicedToArray_default()(_ref, 2),
4488
- node = _ref2[0],
4489
- raw = _ref2[1];
4490
- _this16.checkDuplication(node);
4491
- _this16.verifyNodeShape(node);
4492
- var id = node.id,
4493
- label = node.label,
4494
- children = node.children,
4495
- isDefaultExpanded = node.isDefaultExpanded;
4496
- var isRootNode = parentNode === NO_PARENT_NODE;
4497
- var level = isRootNode ? 0 : parentNode.level + 1;
4498
- var isBranch = Array.isArray(children) || children === null;
4499
- var isLeaf = !isBranch;
4500
- var isDisabled = !!node.isDisabled || !_this16.flat && !isRootNode && parentNode.isDisabled;
4501
- var isNew = !!node.isNew;
4502
- var lowerCased = _this16.matchKeys.reduce(function (prev, key) {
4503
- return Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, prev), {}, defineProperty_default()({}, key, stringifyOptionPropValue(node[key]).toLocaleLowerCase()));
4504
- }, {});
4505
- var nestedSearchLabel = isRootNode ? lowerCased.label : parentNode.nestedSearchLabel + ' ' + lowerCased.label;
4506
- var normalized = _this16.$set(_this16.forest.nodeMap, id, createMap());
4507
- _this16.$set(normalized, 'id', id);
4508
- _this16.$set(normalized, 'label', label);
4509
- _this16.$set(normalized, 'level', level);
4510
- _this16.$set(normalized, 'ancestors', isRootNode ? [] : [parentNode].concat(parentNode.ancestors));
4511
- _this16.$set(normalized, 'index', (isRootNode ? [] : parentNode.index).concat(index));
4512
- _this16.$set(normalized, 'parentNode', parentNode);
4513
- _this16.$set(normalized, 'lowerCased', lowerCased);
4514
- _this16.$set(normalized, 'nestedSearchLabel', nestedSearchLabel);
4515
- _this16.$set(normalized, 'isDisabled', isDisabled);
4516
- _this16.$set(normalized, 'isNew', isNew);
4517
- _this16.$set(normalized, 'isMatched', false);
4518
- _this16.$set(normalized, 'isHighlighted', false);
4519
- _this16.$set(normalized, 'isBranch', isBranch);
4520
- _this16.$set(normalized, 'isLeaf', isLeaf);
4521
- _this16.$set(normalized, 'isRootNode', isRootNode);
4522
- _this16.$set(normalized, 'raw', raw);
4523
- if (isBranch) {
4524
- var isLoaded = Array.isArray(children);
4525
- _this16.$set(normalized, 'childrenStates', Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, createAsyncOptionsStates()), {}, {
4526
- isLoaded: isLoaded
4527
- }));
4528
- _this16.$set(normalized, 'isExpanded', typeof isDefaultExpanded === 'boolean' ? isDefaultExpanded : level < _this16.defaultExpandLevel);
4529
- _this16.$set(normalized, 'hasMatchedDescendants', false);
4530
- _this16.$set(normalized, 'hasDisabledDescendants', false);
4531
- _this16.$set(normalized, 'isExpandedOnSearch', false);
4532
- _this16.$set(normalized, 'showAllChildrenOnSearch', false);
4533
- _this16.$set(normalized, 'count', defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, ALL_CHILDREN, 0), ALL_DESCENDANTS, 0), LEAF_CHILDREN, 0), LEAF_DESCENDANTS, 0));
4534
- _this16.$set(normalized, 'children', isLoaded ? _this16.normalize(normalized, children, prevNodeMap) : []);
4535
- if (isDefaultExpanded === true) normalized.ancestors.forEach(function (ancestor) {
4536
- ancestor.isExpanded = true;
4537
- });
4538
- if (!isLoaded && typeof _this16.loadOptions !== 'function') {
4539
- warning_warning(function () {
4540
- return false;
4541
- }, function () {
4542
- return 'Unloaded branch node detected. "loadOptions" prop is required to load its children.';
4543
- });
4544
- } else if (!isLoaded && normalized.isExpanded) {
4545
- _this16.loadChildrenOptions(normalized);
4546
- }
4547
- }
4548
- normalized.ancestors.forEach(function (ancestor) {
4549
- return ancestor.count[ALL_DESCENDANTS]++;
4550
- });
4551
- if (isLeaf) normalized.ancestors.forEach(function (ancestor) {
4552
- return ancestor.count[LEAF_DESCENDANTS]++;
4553
- });
4554
- if (!isRootNode) {
4555
- parentNode.count[ALL_CHILDREN] += 1;
4556
- if (isLeaf) parentNode.count[LEAF_CHILDREN] += 1;
4557
- if (isDisabled) parentNode.hasDisabledDescendants = true;
4558
- }
4559
- if (prevNodeMap && prevNodeMap[id]) {
4560
- var prev = prevNodeMap[id];
4561
- normalized.isMatched = prev.isMatched;
4562
- normalized.showAllChildrenOnSearch = prev.showAllChildrenOnSearch;
4563
- normalized.isHighlighted = prev.isHighlighted;
4564
- if (prev.isBranch && normalized.isBranch) {
4565
- normalized.isExpanded = prev.isExpanded;
4566
- normalized.isExpandedOnSearch = prev.isExpandedOnSearch;
4567
- if (prev.childrenStates.isLoaded && !normalized.childrenStates.isLoaded) {
4568
- normalized.isExpanded = false;
4569
- } else {
4570
- normalized.childrenStates = Treeselectvue_type_script_lang_js_objectSpread({}, prev.childrenStates);
4571
- }
4572
- }
4573
- }
4574
- return normalized;
4575
- });
4576
- if (this.branchNodesFirst) {
4577
- var branchNodes = normalizedOptions.filter(function (option) {
4578
- return option.isBranch;
4579
- });
4580
- var leafNodes = normalizedOptions.filter(function (option) {
4581
- return option.isLeaf;
4582
- });
4583
- normalizedOptions = branchNodes.concat(leafNodes);
4584
- }
4585
- return normalizedOptions;
4586
- },
4587
- loadRootOptions: function loadRootOptions() {
4588
- var _this17 = this;
4589
- this.callLoadOptionsProp({
4590
- action: LOAD_ROOT_OPTIONS,
4591
- isPending: function isPending() {
4592
- return _this17.rootOptionsStates.isLoading;
4593
- },
4594
- start: function start() {
4595
- _this17.rootOptionsStates.isLoading = true;
4596
- _this17.rootOptionsStates.loadingError = '';
4597
- },
4598
- succeed: function succeed() {
4599
- _this17.rootOptionsStates.isLoaded = true;
4600
- _this17.$nextTick(function () {
4601
- _this17.resetHighlightedOptionWhenNecessary(true);
4602
- });
4603
- },
4604
- fail: function fail(err) {
4605
- _this17.rootOptionsStates.loadingError = getErrorMessage(err);
4606
- },
4607
- end: function end() {
4608
- _this17.rootOptionsStates.isLoading = false;
4609
- }
4610
- });
4611
- },
4612
- loadChildrenOptions: function loadChildrenOptions(parentNode) {
4613
- var _this18 = this;
4614
- var id = parentNode.id,
4615
- raw = parentNode.raw;
4616
- this.callLoadOptionsProp({
4617
- action: LOAD_CHILDREN_OPTIONS,
4618
- args: {
4619
- parentNode: raw
4620
- },
4621
- isPending: function isPending() {
4622
- return _this18.getNode(id).childrenStates.isLoading;
4623
- },
4624
- start: function start() {
4625
- _this18.getNode(id).childrenStates.isLoading = true;
4626
- _this18.getNode(id).childrenStates.loadingError = '';
4627
- },
4628
- succeed: function succeed() {
4629
- _this18.getNode(id).childrenStates.isLoaded = true;
4630
- },
4631
- fail: function fail(err) {
4632
- _this18.getNode(id).childrenStates.loadingError = getErrorMessage(err);
4633
- },
4634
- end: function end() {
4635
- _this18.getNode(id).childrenStates.isLoading = false;
4636
- }
4637
- });
4638
- },
4639
- callLoadOptionsProp: function callLoadOptionsProp(_ref3) {
4640
- var action = _ref3.action,
4641
- args = _ref3.args,
4642
- isPending = _ref3.isPending,
4643
- start = _ref3.start,
4644
- succeed = _ref3.succeed,
4645
- fail = _ref3.fail,
4646
- end = _ref3.end;
4647
- if (!this.loadOptions || isPending()) {
4648
- return;
4649
- }
4650
- start();
4651
- var callback = once_default()(function (err, result) {
4652
- if (err) {
4653
- fail(err);
4654
- } else {
4655
- succeed(result);
4656
- }
4657
- end();
4658
- });
4659
- var result = this.loadOptions(Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({
4660
- id: this.getInstanceId(),
4661
- instanceId: this.getInstanceId(),
4662
- action: action
4663
- }, args), {}, {
4664
- callback: callback
4665
- }));
4666
- if (is_promise_default()(result)) {
4667
- result.then(function () {
4668
- callback();
4669
- }, function (err) {
4670
- callback(err);
4671
- }).catch(function (err) {
4672
- console.error(err);
4673
- });
4674
- }
4675
- },
4676
- checkDuplication: function checkDuplication(node) {
4677
- var _this19 = this;
4678
- warning_warning(function () {
4679
- return !(node.id in _this19.forest.nodeMap && !_this19.forest.nodeMap[node.id].isFallbackNode);
4680
- }, function () {
4681
- 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.");
4682
- });
4683
- },
4684
- verifyNodeShape: function verifyNodeShape(node) {
4685
- warning_warning(function () {
4686
- return !(node.children === undefined && node.isBranch === true);
4687
- }, function () {
4688
- return 'Are you meant to declare an unloaded branch node? ' + '`isBranch: true` is no longer supported, please use `children: null` instead.';
4689
- });
4690
- },
4691
- select: function select(node) {
4692
- if (this.disabled || node.isDisabled) {
4693
- return;
4694
- }
4695
- if (this.single) {
4696
- this.clear();
4697
- }
4698
- var nextState = this.multiple && !this.flat ? this.forest.checkedStateMap[node.id] === UNCHECKED : !this.isSelected(node);
4699
- if (nextState) {
4700
- this._selectNode(node);
4701
- } else {
4702
- this._deselectNode(node);
4703
- }
4704
- this.buildForestState();
4705
- if (nextState) {
4706
- this.$emit('select', node.raw, this.getInstanceId());
4707
- } else {
4708
- this.$emit('deselect', node.raw, this.getInstanceId());
4709
- }
4710
- if (this.localSearch.active && nextState && (this.single || this.clearOnSelect)) {
4711
- this.resetSearchQuery();
4712
- }
4713
- if (this.single && this.closeOnSelect) {
4714
- this.closeMenu();
4715
- if (this.searchable) {
4716
- this._blurOnSelect = true;
4717
- }
4718
- }
4719
- },
4720
- clear: function clear() {
4721
- var _this20 = this;
4722
- if (this.hasValue) {
4723
- if (this.single || this.allowClearingDisabled) {
4724
- this.forest.selectedNodeIds = [];
4725
- } else {
4726
- this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter(function (nodeId) {
4727
- return _this20.getNode(nodeId).isDisabled;
4728
- });
4729
- }
4730
- this.buildForestState();
4731
- }
4732
- },
4733
- _selectNode: function _selectNode(node) {
4734
- var _this21 = this;
4735
- if (this.single || this.disableBranchNodes) {
4736
- return this.addValue(node);
4737
- }
4738
- if (this.flat) {
4739
- this.addValue(node);
4740
- if (this.autoSelectAncestors) {
4741
- node.ancestors.forEach(function (ancestor) {
4742
- if (!_this21.isSelected(ancestor) && !ancestor.isDisabled) _this21.addValue(ancestor);
4743
- });
4744
- } else if (this.autoSelectDescendants) {
4745
- this.traverseDescendantsBFS(node, function (descendant) {
4746
- if (!_this21.isSelected(descendant) && !descendant.isDisabled) _this21.addValue(descendant);
4747
- });
4748
- }
4749
- return;
4750
- }
4751
- var isFullyChecked = node.isLeaf || (!node.hasDisabledDescendants) || (this.allowSelectingDisabledDescendants);
4752
- if (isFullyChecked) {
4753
- this.addValue(node);
4754
- }
4755
- if (node.isBranch) {
4756
- this.traverseDescendantsBFS(node, function (descendant) {
4757
- if (!descendant.isDisabled || _this21.allowSelectingDisabledDescendants) {
4758
- _this21.addValue(descendant);
4759
- }
4760
- });
4761
- }
4762
- if (isFullyChecked) {
4763
- var curr = node;
4764
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
4765
- if (curr.children.every(this.isSelected)) this.addValue(curr);else break;
4766
- }
4767
- }
4768
- },
4769
- _deselectNode: function _deselectNode(node) {
4770
- var _this22 = this;
4771
- if (this.disableBranchNodes) {
4772
- return this.removeValue(node);
4773
- }
4774
- if (this.flat) {
4775
- this.removeValue(node);
4776
- if (this.autoDeselectAncestors) {
4777
- node.ancestors.forEach(function (ancestor) {
4778
- if (_this22.isSelected(ancestor) && !ancestor.isDisabled) _this22.removeValue(ancestor);
4779
- });
4780
- } else if (this.autoDeselectDescendants) {
4781
- this.traverseDescendantsBFS(node, function (descendant) {
4782
- if (_this22.isSelected(descendant) && !descendant.isDisabled) _this22.removeValue(descendant);
4783
- });
4784
- }
4785
- return;
4786
- }
4787
- var hasUncheckedSomeDescendants = false;
4788
- if (node.isBranch) {
4789
- this.traverseDescendantsDFS(node, function (descendant) {
4790
- if (!descendant.isDisabled || _this22.allowSelectingDisabledDescendants) {
4791
- _this22.removeValue(descendant);
4792
- hasUncheckedSomeDescendants = true;
4793
- }
4794
- });
4795
- }
4796
- if (node.isLeaf || hasUncheckedSomeDescendants || node.children.length === 0) {
4797
- this.removeValue(node);
4798
- var curr = node;
4799
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
4800
- if (this.isSelected(curr)) this.removeValue(curr);else break;
4801
- }
4802
- }
4803
- },
4804
- addValue: function addValue(node) {
4805
- this.forest.selectedNodeIds.push(node.id);
4806
- this.forest.selectedNodeMap[node.id] = true;
4807
- },
4808
- removeValue: function removeValue(node) {
4809
- removeFromArray(this.forest.selectedNodeIds, node.id);
4810
- delete this.forest.selectedNodeMap[node.id];
4811
- },
4812
- removeLastValue: function removeLastValue() {
4813
- if (!this.hasValue) return;
4814
- if (this.single) return this.clear();
4815
- var lastValue = last_default()(this.internalValue);
4816
- var lastSelectedNode = this.getNode(lastValue);
4817
- this.select(lastSelectedNode);
4818
- },
4819
- saveMenuScrollPosition: function saveMenuScrollPosition() {
4820
- var $menu = this.getMenu();
4821
- if ($menu) this.menu.lastScrollPosition = $menu.scrollTop;
4822
- },
4823
- restoreMenuScrollPosition: function restoreMenuScrollPosition() {
4824
- var $menu = this.getMenu();
4825
- if ($menu) $menu.scrollTop = this.menu.lastScrollPosition;
4826
- }
4827
- },
4828
- render: function render() {
4829
- var h = arguments[0];
4830
- return h("div", {
4831
- ref: "wrapper",
4832
- "class": this.wrapperClass
4833
- }, [h(HiddenFields), h(Control, {
4834
- ref: "control"
4835
- }), this.appendToBody ? h(MenuPortal, {
4836
- ref: "portal"
4837
- }) : h(Menu, {
4838
- ref: "menu"
4839
- })]);
4840
- }
4841
- });
4842
- // CONCATENATED MODULE: ./src/components/Treeselect.vue?vue&type=script&lang=js
4843
- /* harmony default export */ var components_Treeselectvue_type_script_lang_js = (Treeselectvue_type_script_lang_js);
4844
- // CONCATENATED MODULE: ./src/components/Treeselect.vue
4845
- var Treeselect_render, Treeselect_staticRenderFns
4846
-
4847
-
4848
-
4849
-
4850
- /* normalize component */
4851
-
4852
- var Treeselect_component = normalizeComponent(
4853
- components_Treeselectvue_type_script_lang_js,
4854
- Treeselect_render,
4855
- Treeselect_staticRenderFns,
4856
- false,
4857
- null,
4858
- null,
4859
- null
4860
-
4861
- )
4862
-
4863
- /* hot reload */
4864
- if (false) { var Treeselect_api; }
4865
- Treeselect_component.options.__file = "src/components/Treeselect.vue"
4866
- /* harmony default export */ var Treeselect = (Treeselect_component.exports);
4867
- // EXTERNAL MODULE: ./src/style.less
4868
- var style = __webpack_require__(41);
4869
-
4870
- // CONCATENATED MODULE: ./src/index.js
4871
-
4872
-
4873
- /* harmony default export */ var src = __webpack_exports__["default"] = (Treeselect);
4874
-
4875
-
4876
- var VERSION = "0.0.12";
4877
-
4878
- /***/ })
4879
- /******/ ]);
4880
- });
4881
- //# sourceMappingURL=rp-treeselect.umd.js.map