@reviewpush/rp-treeselect 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3693 +0,0 @@
1
- module.exports =
2
- /******/ (function(modules) { // webpackBootstrap
3
- /******/ // The module cache
4
- /******/ var installedModules = {};
5
- /******/
6
- /******/ // The require function
7
- /******/ function __webpack_require__(moduleId) {
8
- /******/
9
- /******/ // Check if module is in cache
10
- /******/ if(installedModules[moduleId]) {
11
- /******/ return installedModules[moduleId].exports;
12
- /******/ }
13
- /******/ // Create a new module (and put it into the cache)
14
- /******/ var module = installedModules[moduleId] = {
15
- /******/ i: moduleId,
16
- /******/ l: false,
17
- /******/ exports: {}
18
- /******/ };
19
- /******/
20
- /******/ // Execute the module function
21
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
- /******/
23
- /******/ // Flag the module as loaded
24
- /******/ module.l = true;
25
- /******/
26
- /******/ // Return the exports of the module
27
- /******/ return module.exports;
28
- /******/ }
29
- /******/
30
- /******/
31
- /******/ // expose the modules object (__webpack_modules__)
32
- /******/ __webpack_require__.m = modules;
33
- /******/
34
- /******/ // expose the module cache
35
- /******/ __webpack_require__.c = installedModules;
36
- /******/
37
- /******/ // define getter function for harmony exports
38
- /******/ __webpack_require__.d = function(exports, name, getter) {
39
- /******/ if(!__webpack_require__.o(exports, name)) {
40
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
- /******/ }
42
- /******/ };
43
- /******/
44
- /******/ // define __esModule on exports
45
- /******/ __webpack_require__.r = function(exports) {
46
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
- /******/ }
49
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
- /******/ };
51
- /******/
52
- /******/ // create a fake namespace object
53
- /******/ // mode & 1: value is a module id, require it
54
- /******/ // mode & 2: merge all properties of value into the ns
55
- /******/ // mode & 4: return value when already ns object
56
- /******/ // mode & 8|1: behave like require
57
- /******/ __webpack_require__.t = function(value, mode) {
58
- /******/ if(mode & 1) value = __webpack_require__(value);
59
- /******/ if(mode & 8) return value;
60
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
- /******/ var ns = Object.create(null);
62
- /******/ __webpack_require__.r(ns);
63
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
- /******/ return ns;
66
- /******/ };
67
- /******/
68
- /******/ // getDefaultExport function for compatibility with non-harmony modules
69
- /******/ __webpack_require__.n = function(module) {
70
- /******/ var getter = module && module.__esModule ?
71
- /******/ function getDefault() { return module['default']; } :
72
- /******/ function getModuleExports() { return module; };
73
- /******/ __webpack_require__.d(getter, 'a', getter);
74
- /******/ return getter;
75
- /******/ };
76
- /******/
77
- /******/ // Object.prototype.hasOwnProperty.call
78
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
- /******/
80
- /******/ // __webpack_public_path__
81
- /******/ __webpack_require__.p = "/";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 16);
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ([
89
- /* 0 */
90
- /***/ (function(module, exports) {
91
-
92
- module.exports = require("@babel/runtime/helpers/slicedToArray");
93
-
94
- /***/ }),
95
- /* 1 */
96
- /***/ (function(module, exports) {
97
-
98
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
99
-
100
- /***/ }),
101
- /* 2 */
102
- /***/ (function(module, exports) {
103
-
104
- module.exports = require("@babel/runtime/helpers/defineProperty");
105
-
106
- /***/ }),
107
- /* 3 */
108
- /***/ (function(module, exports) {
109
-
110
- module.exports = require("fuzzysearch");
111
-
112
- /***/ }),
113
- /* 4 */
114
- /***/ (function(module, exports) {
115
-
116
- module.exports = require("vue");
117
-
118
- /***/ }),
119
- /* 5 */
120
- /***/ (function(module, exports) {
121
-
122
- module.exports = require("lodash/noop");
123
-
124
- /***/ }),
125
- /* 6 */
126
- /***/ (function(module, exports) {
127
-
128
- module.exports = require("lodash/debounce");
129
-
130
- /***/ }),
131
- /* 7 */
132
- /***/ (function(module, exports) {
133
-
134
- module.exports = require("watch-size");
135
-
136
- /***/ }),
137
- /* 8 */
138
- /***/ (function(module, exports) {
139
-
140
- module.exports = require("is-promise");
141
-
142
- /***/ }),
143
- /* 9 */
144
- /***/ (function(module, exports) {
145
-
146
- module.exports = require("lodash/once");
147
-
148
- /***/ }),
149
- /* 10 */
150
- /***/ (function(module, exports) {
151
-
152
- module.exports = require("lodash/identity");
153
-
154
- /***/ }),
155
- /* 11 */
156
- /***/ (function(module, exports) {
157
-
158
- module.exports = require("lodash/constant");
159
-
160
- /***/ }),
161
- /* 12 */
162
- /***/ (function(module, exports) {
163
-
164
- module.exports = require("@babel/runtime/helpers/typeof");
165
-
166
- /***/ }),
167
- /* 13 */
168
- /***/ (function(module, exports) {
169
-
170
- module.exports = require("lodash/last");
171
-
172
- /***/ }),
173
- /* 14 */
174
- /***/ (function(module, exports) {
175
-
176
- module.exports = require("babel-helper-vue-jsx-merge-props");
177
-
178
- /***/ }),
179
- /* 15 */
180
- /***/ (function(module, exports, __webpack_require__) {
181
-
182
- // extracted by mini-css-extract-plugin
183
-
184
- /***/ }),
185
- /* 16 */
186
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
187
-
188
- "use strict";
189
- // ESM COMPAT FLAG
190
- __webpack_require__.r(__webpack_exports__);
191
-
192
- // EXPORTS
193
- __webpack_require__.d(__webpack_exports__, "Treeselect", function() { return /* reexport */ Treeselect; });
194
- __webpack_require__.d(__webpack_exports__, "LOAD_ROOT_OPTIONS", function() { return /* reexport */ LOAD_ROOT_OPTIONS; });
195
- __webpack_require__.d(__webpack_exports__, "LOAD_CHILDREN_OPTIONS", function() { return /* reexport */ LOAD_CHILDREN_OPTIONS; });
196
- __webpack_require__.d(__webpack_exports__, "ASYNC_SEARCH", function() { return /* reexport */ ASYNC_SEARCH; });
197
- __webpack_require__.d(__webpack_exports__, "VERSION", function() { return /* binding */ VERSION; });
198
-
199
- // EXTERNAL MODULE: external "@babel/runtime/helpers/slicedToArray"
200
- var slicedToArray_ = __webpack_require__(0);
201
- var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray_);
202
-
203
- // EXTERNAL MODULE: external "@babel/runtime/helpers/toConsumableArray"
204
- var toConsumableArray_ = __webpack_require__(1);
205
- var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_);
206
-
207
- // EXTERNAL MODULE: external "@babel/runtime/helpers/defineProperty"
208
- var defineProperty_ = __webpack_require__(2);
209
- var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
210
-
211
- // EXTERNAL MODULE: external "fuzzysearch"
212
- var external_fuzzysearch_ = __webpack_require__(3);
213
- var external_fuzzysearch_default = /*#__PURE__*/__webpack_require__.n(external_fuzzysearch_);
214
-
215
- // EXTERNAL MODULE: external "vue"
216
- var external_vue_ = __webpack_require__(4);
217
-
218
- // EXTERNAL MODULE: external "lodash/noop"
219
- var noop_ = __webpack_require__(5);
220
- var noop_default = /*#__PURE__*/__webpack_require__.n(noop_);
221
-
222
- // CONCATENATED MODULE: ./src/utils/noop.js
223
-
224
- // CONCATENATED MODULE: ./src/utils/warning.js
225
-
226
-
227
- var warning_warning = process.env.NODE_ENV === 'production' ? noop_default.a : function warning(checker, complainer) {
228
- if (!checker()) {
229
- var _console;
230
- var message = ['[Rp-Treeselect Warning]'].concat(complainer());
231
- (_console = console).error.apply(_console, toConsumableArray_default()(message));
232
- }
233
- };
234
- // CONCATENATED MODULE: ./src/utils/onLeftClick.js
235
- function onLeftClick(mouseDownHandler) {
236
- return function onMouseDown(evt) {
237
- if (evt.type === 'mousedown' && evt.button === 0) {
238
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
239
- args[_key - 1] = arguments[_key];
240
- }
241
- mouseDownHandler.call.apply(mouseDownHandler, [this, evt].concat(args));
242
- }
243
- };
244
- }
245
- // CONCATENATED MODULE: ./src/utils/scrollIntoView.js
246
- function scrollIntoView($scrollingEl, $focusedEl) {
247
- var scrollingReact = $scrollingEl.getBoundingClientRect();
248
- var focusedRect = $focusedEl.getBoundingClientRect();
249
- var overScroll = $focusedEl.offsetHeight / 3;
250
- if (focusedRect.bottom + overScroll > scrollingReact.bottom) {
251
- $scrollingEl.scrollTop = Math.min($focusedEl.offsetTop + $focusedEl.clientHeight - $scrollingEl.offsetHeight + overScroll, $scrollingEl.scrollHeight);
252
- } else if (focusedRect.top - overScroll < scrollingReact.top) {
253
- $scrollingEl.scrollTop = Math.max($focusedEl.offsetTop - overScroll, 0);
254
- }
255
- }
256
- // EXTERNAL MODULE: external "lodash/debounce"
257
- var debounce_ = __webpack_require__(6);
258
- var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
259
-
260
- // CONCATENATED MODULE: ./src/utils/debounce.js
261
-
262
- // EXTERNAL MODULE: external "watch-size"
263
- var external_watch_size_ = __webpack_require__(7);
264
- var external_watch_size_default = /*#__PURE__*/__webpack_require__.n(external_watch_size_);
265
-
266
- // CONCATENATED MODULE: ./src/utils/removeFromArray.js
267
- function removeFromArray(arr, elem) {
268
- var idx = arr.indexOf(elem);
269
- if (idx !== -1) arr.splice(idx, 1);
270
- }
271
- // CONCATENATED MODULE: ./src/utils/watchSize.js
272
-
273
-
274
- var intervalId;
275
- var registered = [];
276
- var INTERVAL_DURATION = 100;
277
- function run() {
278
- intervalId = setInterval(function () {
279
- registered.forEach(test);
280
- }, INTERVAL_DURATION);
281
- }
282
- function stop() {
283
- clearInterval(intervalId);
284
- intervalId = null;
285
- }
286
- function test(item) {
287
- var $el = item.$el,
288
- listener = item.listener,
289
- lastWidth = item.lastWidth,
290
- lastHeight = item.lastHeight;
291
- var width = $el.offsetWidth;
292
- var height = $el.offsetHeight;
293
- if (lastWidth !== width || lastHeight !== height) {
294
- item.lastWidth = width;
295
- item.lastHeight = height;
296
- listener({
297
- width: width,
298
- height: height
299
- });
300
- }
301
- }
302
- function watchSizeForIE9($el, listener) {
303
- var item = {
304
- $el: $el,
305
- listener: listener,
306
- lastWidth: null,
307
- lastHeight: null
308
- };
309
- var unwatch = function unwatch() {
310
- removeFromArray(registered, item);
311
- if (!registered.length) stop();
312
- };
313
- registered.push(item);
314
- test(item);
315
- run();
316
- return unwatch;
317
- }
318
- function watchSize($el, listener) {
319
- var isIE9 = document.documentMode === 9;
320
- var locked = true;
321
- var wrappedListener = function wrappedListener() {
322
- return locked || listener.apply(void 0, arguments);
323
- };
324
- var implementation = isIE9 ? watchSizeForIE9 : external_watch_size_default.a;
325
- var removeSizeWatcher = implementation($el, wrappedListener);
326
- locked = false;
327
- return removeSizeWatcher;
328
- }
329
- // CONCATENATED MODULE: ./src/utils/setupResizeAndScrollEventListeners.js
330
- function findScrollParents($el) {
331
- var $scrollParents = [];
332
- var $parent = $el.parentNode;
333
- while ($parent && $parent.nodeName !== 'BODY' && $parent.nodeType === document.ELEMENT_NODE) {
334
- if (isScrollElment($parent)) $scrollParents.push($parent);
335
- $parent = $parent.parentNode;
336
- }
337
- $scrollParents.push(window);
338
- return $scrollParents;
339
- }
340
- function isScrollElment($el) {
341
- var _getComputedStyle = getComputedStyle($el),
342
- overflow = _getComputedStyle.overflow,
343
- overflowX = _getComputedStyle.overflowX,
344
- overflowY = _getComputedStyle.overflowY;
345
- return /(auto|scroll|overlay)/.test(overflow + overflowY + overflowX);
346
- }
347
- function setupResizeAndScrollEventListeners($el, listener) {
348
- var $scrollParents = findScrollParents($el);
349
- window.addEventListener('resize', listener, {
350
- passive: true
351
- });
352
- $scrollParents.forEach(function (scrollParent) {
353
- scrollParent.addEventListener('scroll', listener, {
354
- passive: true
355
- });
356
- });
357
- return function removeEventListeners() {
358
- window.removeEventListener('resize', listener, {
359
- passive: true
360
- });
361
- $scrollParents.forEach(function ($scrollParent) {
362
- $scrollParent.removeEventListener('scroll', listener, {
363
- passive: true
364
- });
365
- });
366
- };
367
- }
368
- // CONCATENATED MODULE: ./src/utils/isNaN.js
369
- function isNaN_isNaN(x) {
370
- return x !== x;
371
- }
372
- // EXTERNAL MODULE: external "is-promise"
373
- var external_is_promise_ = __webpack_require__(8);
374
- var external_is_promise_default = /*#__PURE__*/__webpack_require__.n(external_is_promise_);
375
-
376
- // CONCATENATED MODULE: ./src/utils/isPromise.js
377
-
378
- // EXTERNAL MODULE: external "lodash/once"
379
- var once_ = __webpack_require__(9);
380
- var once_default = /*#__PURE__*/__webpack_require__.n(once_);
381
-
382
- // CONCATENATED MODULE: ./src/utils/once.js
383
-
384
- // EXTERNAL MODULE: external "lodash/identity"
385
- var identity_ = __webpack_require__(10);
386
- var identity_default = /*#__PURE__*/__webpack_require__.n(identity_);
387
-
388
- // CONCATENATED MODULE: ./src/utils/identity.js
389
-
390
- // EXTERNAL MODULE: external "lodash/constant"
391
- var constant_ = __webpack_require__(11);
392
- var constant_default = /*#__PURE__*/__webpack_require__.n(constant_);
393
-
394
- // CONCATENATED MODULE: ./src/utils/constant.js
395
-
396
- // CONCATENATED MODULE: ./src/utils/createMap.js
397
- var createMap = function createMap() {
398
- return Object.create(null);
399
- };
400
- // EXTERNAL MODULE: external "@babel/runtime/helpers/typeof"
401
- var typeof_ = __webpack_require__(12);
402
- var typeof_default = /*#__PURE__*/__webpack_require__.n(typeof_);
403
-
404
- // CONCATENATED MODULE: ./src/utils/deepExtend.js
405
-
406
- function isPlainObject(value) {
407
- if (value == null || typeof_default()(value) !== 'object') return false;
408
- return Object.getPrototypeOf(value) === Object.prototype;
409
- }
410
- function copy(obj, key, value) {
411
- if (isPlainObject(value)) {
412
- obj[key] || (obj[key] = {});
413
- deepExtend(obj[key], value);
414
- } else {
415
- obj[key] = value;
416
- }
417
- }
418
- function deepExtend(target, source) {
419
- if (isPlainObject(source)) {
420
- var keys = Object.keys(source);
421
- for (var i = 0, len = keys.length; i < len; i++) {
422
- copy(target, keys[i], source[keys[i]]);
423
- }
424
- }
425
- return target;
426
- }
427
- // EXTERNAL MODULE: external "lodash/last"
428
- var last_ = __webpack_require__(13);
429
- var last_default = /*#__PURE__*/__webpack_require__.n(last_);
430
-
431
- // CONCATENATED MODULE: ./src/utils/last.js
432
-
433
- // CONCATENATED MODULE: ./src/utils/includes.js
434
- function includes(arrOrStr, elem) {
435
- return arrOrStr.indexOf(elem) !== -1;
436
- }
437
- // CONCATENATED MODULE: ./src/utils/find.js
438
- function find(arr, predicate, ctx) {
439
- for (var i = 0, len = arr.length; i < len; i++) {
440
- if (predicate.call(ctx, arr[i], i, arr)) return arr[i];
441
- }
442
- return undefined;
443
- }
444
- // CONCATENATED MODULE: ./src/utils/quickDiff.js
445
- function quickDiff(arrA, arrB) {
446
- if (arrA.length !== arrB.length) return true;
447
- for (var i = 0; i < arrA.length; i++) {
448
- if (arrA[i] !== arrB[i]) return true;
449
- }
450
- return false;
451
- }
452
- // CONCATENATED MODULE: ./src/utils/index.js
453
-
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
-
472
- // CONCATENATED MODULE: ./src/constants.js
473
- var NO_PARENT_NODE = null;
474
- var UNCHECKED = 0;
475
- var INDETERMINATE = 1;
476
- var CHECKED = 2;
477
- var ALL_CHILDREN = 'ALL_CHILDREN';
478
- var ALL_DESCENDANTS = 'ALL_DESCENDANTS';
479
- var LEAF_CHILDREN = 'LEAF_CHILDREN';
480
- var LEAF_DESCENDANTS = 'LEAF_DESCENDANTS';
481
- var LOAD_ROOT_OPTIONS = 'LOAD_ROOT_OPTIONS';
482
- var LOAD_CHILDREN_OPTIONS = 'LOAD_CHILDREN_OPTIONS';
483
- var ASYNC_SEARCH = 'ASYNC_SEARCH';
484
- var ALL = 'ALL';
485
- var BRANCH_PRIORITY = 'BRANCH_PRIORITY';
486
- var LEAF_PRIORITY = 'LEAF_PRIORITY';
487
- var ALL_WITH_INDETERMINATE = 'ALL_WITH_INDETERMINATE';
488
- var ORDER_SELECTED = 'ORDER_SELECTED';
489
- var LEVEL = 'LEVEL';
490
- var INDEX = 'INDEX';
491
- var KEY_CODES = {
492
- BACKSPACE: 8,
493
- ENTER: 13,
494
- ESCAPE: 27,
495
- END: 35,
496
- HOME: 36,
497
- ARROW_LEFT: 37,
498
- ARROW_UP: 38,
499
- ARROW_RIGHT: 39,
500
- ARROW_DOWN: 40,
501
- DELETE: 46
502
- };
503
- var INPUT_DEBOUNCE_DELAY = process.env.NODE_ENV === 'testing' ? 10 : 200;
504
- var MIN_INPUT_WIDTH = 5;
505
- var MENU_BUFFER = 40;
506
- // 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
507
-
508
-
509
- function stringifyValue(value) {
510
- if (typeof value === 'string') return value;
511
- if (value != null && !isNaN_isNaN(value)) return JSON.stringify(value);
512
- return '';
513
- }
514
- /* harmony default export */ var HiddenFieldsvue_type_script_lang_js = ({
515
- name: 'rp-treeselect--hidden-fields',
516
- setup: function setup() {
517
- var instance = Object(external_vue_["inject"])('instance');
518
- return {
519
- instance: instance
520
- };
521
- },
522
- render: function render() {
523
- var _this = this;
524
- var h = arguments[0];
525
- if (!this.instance.name || this.instance.disabled || !this.instance.hasValue) return null;
526
- var stringifiedValues = this.instance.internalValue.map(stringifyValue);
527
- if (this.instance.multiple && this.instance.joinValues) stringifiedValues = [stringifiedValues.join(this.instance.delimiter)];
528
- return stringifiedValues.map(function (stringifiedValue, i) {
529
- return h("input", {
530
- attrs: {
531
- type: "hidden",
532
- name: _this.instance.name
533
- },
534
- domProps: {
535
- "value": stringifiedValue
536
- },
537
- key: 'hidden-field-' + i
538
- });
539
- });
540
- }
541
- });
542
- // CONCATENATED MODULE: ./src/components/HiddenFields.vue?vue&type=script&lang=js
543
- /* harmony default export */ var components_HiddenFieldsvue_type_script_lang_js = (HiddenFieldsvue_type_script_lang_js);
544
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
545
- /* globals __VUE_SSR_CONTEXT__ */
546
-
547
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
548
- // This module is a runtime utility for cleaner component module output and will
549
- // be included in the final webpack user bundle.
550
-
551
- function normalizeComponent(
552
- scriptExports,
553
- render,
554
- staticRenderFns,
555
- functionalTemplate,
556
- injectStyles,
557
- scopeId,
558
- moduleIdentifier /* server only */,
559
- shadowMode /* vue-cli only */
560
- ) {
561
- // Vue.extend constructor export interop
562
- var options =
563
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
564
-
565
- // render functions
566
- if (render) {
567
- options.render = render
568
- options.staticRenderFns = staticRenderFns
569
- options._compiled = true
570
- }
571
-
572
- // functional template
573
- if (functionalTemplate) {
574
- options.functional = true
575
- }
576
-
577
- // scopedId
578
- if (scopeId) {
579
- options._scopeId = 'data-v-' + scopeId
580
- }
581
-
582
- var hook
583
- if (moduleIdentifier) {
584
- // server build
585
- hook = function (context) {
586
- // 2.3 injection
587
- context =
588
- context || // cached call
589
- (this.$vnode && this.$vnode.ssrContext) || // stateful
590
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
591
- // 2.2 with runInNewContext: true
592
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
593
- context = __VUE_SSR_CONTEXT__
594
- }
595
- // inject component styles
596
- if (injectStyles) {
597
- injectStyles.call(this, context)
598
- }
599
- // register component module identifier for async chunk inferrence
600
- if (context && context._registeredComponents) {
601
- context._registeredComponents.add(moduleIdentifier)
602
- }
603
- }
604
- // used by ssr in case component is cached and beforeCreate
605
- // never gets called
606
- options._ssrRegister = hook
607
- } else if (injectStyles) {
608
- hook = shadowMode
609
- ? function () {
610
- injectStyles.call(
611
- this,
612
- (options.functional ? this.parent : this).$root.$options.shadowRoot
613
- )
614
- }
615
- : injectStyles
616
- }
617
-
618
- if (hook) {
619
- if (options.functional) {
620
- // for template-only hot-reload because in that case the render fn doesn't
621
- // go through the normalizer
622
- options._injectStyles = hook
623
- // register for functional component in vue file
624
- var originalRender = options.render
625
- options.render = function renderWithStyleInjection(h, context) {
626
- hook.call(context)
627
- return originalRender(h, context)
628
- }
629
- } else {
630
- // inject component registration as beforeCreate hook
631
- var existing = options.beforeCreate
632
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
633
- }
634
- }
635
-
636
- return {
637
- exports: scriptExports,
638
- options: options
639
- }
640
- }
641
-
642
- // CONCATENATED MODULE: ./src/components/HiddenFields.vue
643
- var HiddenFields_render, staticRenderFns
644
-
645
-
646
-
647
-
648
- /* normalize component */
649
-
650
- var component = normalizeComponent(
651
- components_HiddenFieldsvue_type_script_lang_js,
652
- HiddenFields_render,
653
- staticRenderFns,
654
- false,
655
- null,
656
- null,
657
- null
658
-
659
- )
660
-
661
- /* harmony default export */ var HiddenFields = (component.exports);
662
- // EXTERNAL MODULE: external "babel-helper-vue-jsx-merge-props"
663
- var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(14);
664
- var external_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
665
-
666
- // 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
667
-
668
-
669
-
670
-
671
- 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];
672
- /* harmony default export */ var Inputvue_type_script_lang_js = ({
673
- name: 'rp-treeselect--input',
674
- setup: function setup() {
675
- var instance = Object(external_vue_["inject"])('instance');
676
- return {
677
- instance: instance
678
- };
679
- },
680
- data: function data() {
681
- return {
682
- inputWidth: MIN_INPUT_WIDTH,
683
- value: ''
684
- };
685
- },
686
- computed: {
687
- needAutoSize: function needAutoSize() {
688
- var instance = this.instance;
689
- return instance.searchable && !instance.disabled && instance.multiple;
690
- },
691
- inputStyle: function inputStyle() {
692
- return {
693
- width: this.needAutoSize ? "".concat(this.inputWidth, "px") : null
694
- };
695
- }
696
- },
697
- watch: {
698
- 'instance.trigger.searchQuery': function instanceTriggerSearchQuery(newValue) {
699
- this.value = newValue;
700
- },
701
- value: function value() {
702
- if (this.needAutoSize) this.$nextTick(this.updateInputWidth);
703
- }
704
- },
705
- created: function created() {
706
- this.debouncedCallback = debounce_default()(this.updateSearchQuery, INPUT_DEBOUNCE_DELAY, {
707
- leading: true,
708
- trailing: true
709
- });
710
- },
711
- methods: {
712
- clear: function clear() {
713
- this.onInput({
714
- target: {
715
- value: ''
716
- }
717
- });
718
- },
719
- focus: function focus() {
720
- var instance = this.instance;
721
- if (!instance.disabled) {
722
- this.$refs.input && this.$refs.input.focus();
723
- }
724
- },
725
- blur: function blur() {
726
- this.$refs.input && this.$refs.input.blur();
727
- },
728
- onFocus: function onFocus() {
729
- var instance = this.instance;
730
- instance.trigger.isFocused = true;
731
- if (instance.openOnFocus) instance.openMenu();
732
- },
733
- onBlur: function onBlur() {
734
- var instance = this.instance;
735
- var menu = instance.getMenu();
736
- if (menu && document.activeElement === menu) {
737
- return this.focus();
738
- }
739
- instance.trigger.isFocused = false;
740
- instance.closeMenu();
741
- },
742
- onInput: function onInput(evt) {
743
- var value = evt.target.value;
744
- this.value = value;
745
- if (value) {
746
- this.debouncedCallback();
747
- } else {
748
- this.debouncedCallback.cancel();
749
- this.updateSearchQuery();
750
- }
751
- },
752
- onKeyDown: function onKeyDown(evt) {
753
- var instance = this.instance;
754
- var key = 'which' in evt ? evt.which : evt.keyCode;
755
- if (evt.ctrlKey || evt.shiftKey || evt.altKey || evt.metaKey) return;
756
- if (!instance.menu.isOpen && includes(keysThatRequireMenuBeingOpen, key)) {
757
- evt.preventDefault();
758
- return instance.openMenu();
759
- }
760
- switch (key) {
761
- case KEY_CODES.BACKSPACE:
762
- {
763
- if (instance.backspaceRemoves && !this.value.length) {
764
- instance.removeLastValue();
765
- }
766
- break;
767
- }
768
- case KEY_CODES.ENTER:
769
- {
770
- evt.preventDefault();
771
- if (instance.menu.current === null) return;
772
- var current = instance.getNode(instance.menu.current);
773
- if (current.isBranch && instance.disableBranchNodes) return;
774
- instance.select(current);
775
- break;
776
- }
777
- case KEY_CODES.ESCAPE:
778
- {
779
- if (this.value.length) {
780
- this.clear();
781
- } else if (instance.menu.isOpen) {
782
- instance.closeMenu();
783
- }
784
- break;
785
- }
786
- case KEY_CODES.END:
787
- {
788
- evt.preventDefault();
789
- instance.highlightLastOption();
790
- break;
791
- }
792
- case KEY_CODES.HOME:
793
- {
794
- evt.preventDefault();
795
- instance.highlightFirstOption();
796
- break;
797
- }
798
- case KEY_CODES.ARROW_LEFT:
799
- {
800
- var _current = instance.getNode(instance.menu.current);
801
- if (_current.isBranch && instance.shouldExpand(_current)) {
802
- evt.preventDefault();
803
- instance.toggleExpanded(_current);
804
- } else if (!_current.isRootNode && (_current.isLeaf || _current.isBranch && !instance.shouldExpand(_current))) {
805
- evt.preventDefault();
806
- instance.setCurrentHighlightedOption(_current.parentNode);
807
- }
808
- break;
809
- }
810
- case KEY_CODES.ARROW_UP:
811
- {
812
- evt.preventDefault();
813
- instance.highlightPrevOption();
814
- break;
815
- }
816
- case KEY_CODES.ARROW_RIGHT:
817
- {
818
- var _current2 = instance.getNode(instance.menu.current);
819
- if (_current2.isBranch && !instance.shouldExpand(_current2)) {
820
- evt.preventDefault();
821
- instance.toggleExpanded(_current2);
822
- }
823
- break;
824
- }
825
- case KEY_CODES.ARROW_DOWN:
826
- {
827
- evt.preventDefault();
828
- instance.highlightNextOption();
829
- break;
830
- }
831
- case KEY_CODES.DELETE:
832
- {
833
- if (instance.deleteRemoves && !this.value.length) {
834
- instance.removeLastValue();
835
- }
836
- break;
837
- }
838
- default:
839
- {
840
- instance.openMenu();
841
- }
842
- }
843
- },
844
- onMouseDown: function onMouseDown(evt) {
845
- if (this.value.length) {
846
- evt.stopPropagation();
847
- }
848
- },
849
- renderInputContainer: function renderInputContainer() {
850
- var h = this.$createElement;
851
- var instance = this.instance;
852
- var props = {};
853
- var children = [];
854
- if (instance.searchable && !instance.disabled) {
855
- children.push(this.renderInput());
856
- if (this.needAutoSize) children.push(this.renderSizer());
857
- }
858
- if (!instance.searchable) {
859
- deepExtend(props, {
860
- on: {
861
- focus: this.onFocus,
862
- blur: this.onBlur,
863
- keydown: this.onKeyDown
864
- },
865
- ref: 'input'
866
- });
867
- }
868
- if (!instance.searchable && !instance.disabled) {
869
- deepExtend(props, {
870
- attrs: {
871
- tabIndex: instance.tabIndex
872
- }
873
- });
874
- }
875
- return h("div", external_babel_helper_vue_jsx_merge_props_default()([{
876
- "class": "rp-treeselect__input-container"
877
- }, props]), [children]);
878
- },
879
- renderInput: function renderInput() {
880
- var h = this.$createElement;
881
- var instance = this.instance;
882
- return h("input", {
883
- ref: "input",
884
- "class": "rp-treeselect__input",
885
- attrs: {
886
- type: "text",
887
- autocomplete: "off",
888
- tabIndex: instance.tabIndex,
889
- required: instance.required && !instance.hasValue
890
- },
891
- domProps: {
892
- "value": this.value
893
- },
894
- style: this.inputStyle,
895
- on: {
896
- "focus": this.onFocus,
897
- "input": this.onInput,
898
- "blur": this.onBlur,
899
- "keydown": this.onKeyDown,
900
- "mousedown": this.onMouseDown
901
- }
902
- });
903
- },
904
- renderSizer: function renderSizer() {
905
- var h = this.$createElement;
906
- return h("div", {
907
- ref: "sizer",
908
- "class": "rp-treeselect__sizer"
909
- }, [this.value]);
910
- },
911
- updateInputWidth: function updateInputWidth() {
912
- this.inputWidth = Math.max(MIN_INPUT_WIDTH, this.$refs.sizer.scrollWidth + 15);
913
- },
914
- updateSearchQuery: function updateSearchQuery() {
915
- var instance = this.instance;
916
- instance.trigger.searchQuery = this.value;
917
- }
918
- },
919
- render: function render() {
920
- return this.renderInputContainer();
921
- }
922
- });
923
- // CONCATENATED MODULE: ./src/components/Input.vue?vue&type=script&lang=js
924
- /* harmony default export */ var components_Inputvue_type_script_lang_js = (Inputvue_type_script_lang_js);
925
- // CONCATENATED MODULE: ./src/components/Input.vue
926
- var Input_render, Input_staticRenderFns
927
-
928
-
929
-
930
-
931
- /* normalize component */
932
-
933
- var Input_component = normalizeComponent(
934
- components_Inputvue_type_script_lang_js,
935
- Input_render,
936
- Input_staticRenderFns,
937
- false,
938
- null,
939
- null,
940
- null
941
-
942
- )
943
-
944
- /* hot reload */
945
- if (false) { var api; }
946
- Input_component.options.__file = "src/components/Input.vue"
947
- /* harmony default export */ var Input = (Input_component.exports);
948
- // 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
949
-
950
- /* harmony default export */ var Placeholdervue_type_script_lang_js = ({
951
- name: 'rp-treeselect--placeholder',
952
- setup: function setup() {
953
- var instance = Object(external_vue_["inject"])('instance');
954
- return {
955
- instance: instance
956
- };
957
- },
958
- render: function render() {
959
- var h = arguments[0];
960
- var instance = this.instance;
961
- var placeholderClass = {
962
- 'rp-treeselect__placeholder': true,
963
- 'rp-treeselect-helper-zoom-effect-off': true,
964
- 'rp-treeselect-helper-hide': instance.hasValue || instance.trigger.searchQuery
965
- };
966
- return h("div", {
967
- "class": placeholderClass
968
- }, [instance.placeholder]);
969
- }
970
- });
971
- // CONCATENATED MODULE: ./src/components/Placeholder.vue?vue&type=script&lang=js
972
- /* harmony default export */ var components_Placeholdervue_type_script_lang_js = (Placeholdervue_type_script_lang_js);
973
- // CONCATENATED MODULE: ./src/components/Placeholder.vue
974
- var Placeholder_render, Placeholder_staticRenderFns
975
-
976
-
977
-
978
-
979
- /* normalize component */
980
-
981
- var Placeholder_component = normalizeComponent(
982
- components_Placeholdervue_type_script_lang_js,
983
- Placeholder_render,
984
- Placeholder_staticRenderFns,
985
- false,
986
- null,
987
- null,
988
- null
989
-
990
- )
991
-
992
- /* harmony default export */ var Placeholder = (Placeholder_component.exports);
993
- // 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
994
-
995
-
996
-
997
- /* harmony default export */ var SingleValuevue_type_script_lang_js = ({
998
- name: 'rp-treeselect--single-value',
999
- setup: function setup() {
1000
- var instance = Object(external_vue_["inject"])('instance');
1001
- return {
1002
- instance: instance
1003
- };
1004
- },
1005
- methods: {
1006
- renderSingleValueLabel: function renderSingleValueLabel() {
1007
- var instance = this.instance;
1008
- var node = instance.selectedNodes[0];
1009
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
1010
- return customValueLabelRenderer ? customValueLabelRenderer({
1011
- node: node
1012
- }) : node.label;
1013
- }
1014
- },
1015
- render: function render() {
1016
- var h = arguments[0];
1017
- var instance = this.instance,
1018
- renderValueContainer = this.$parent.renderValueContainer;
1019
- var shouldShowValue = instance.hasValue && !instance.trigger.searchQuery;
1020
- return renderValueContainer([shouldShowValue && h("div", {
1021
- "class": "rp-treeselect__single-value"
1022
- }, [this.renderSingleValueLabel()]), h(Placeholder), h(Input, {
1023
- ref: "input"
1024
- })]);
1025
- }
1026
- });
1027
- // CONCATENATED MODULE: ./src/components/SingleValue.vue?vue&type=script&lang=js
1028
- /* harmony default export */ var components_SingleValuevue_type_script_lang_js = (SingleValuevue_type_script_lang_js);
1029
- // CONCATENATED MODULE: ./src/components/SingleValue.vue
1030
- var SingleValue_render, SingleValue_staticRenderFns
1031
-
1032
-
1033
-
1034
-
1035
- /* normalize component */
1036
-
1037
- var SingleValue_component = normalizeComponent(
1038
- components_SingleValuevue_type_script_lang_js,
1039
- SingleValue_render,
1040
- SingleValue_staticRenderFns,
1041
- false,
1042
- null,
1043
- null,
1044
- null
1045
-
1046
- )
1047
-
1048
- /* hot reload */
1049
- if (false) { var SingleValue_api; }
1050
- SingleValue_component.options.__file = "src/components/SingleValue.vue"
1051
- /* harmony default export */ var SingleValue = (SingleValue_component.exports);
1052
- // 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
1053
- var Deletevue_type_template_id_364b6320_render = function render() {
1054
- var _vm = this,
1055
- _c = _vm._self._c
1056
- return _c(
1057
- "svg",
1058
- {
1059
- attrs: {
1060
- xmlns: "http://www.w3.org/2000/svg",
1061
- viewBox: "0 0 348.333 348.333",
1062
- },
1063
- },
1064
- [
1065
- _c("path", {
1066
- attrs: {
1067
- 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",
1068
- },
1069
- }),
1070
- ]
1071
- )
1072
- }
1073
- var Deletevue_type_template_id_364b6320_staticRenderFns = []
1074
- Deletevue_type_template_id_364b6320_render._withStripped = true
1075
-
1076
-
1077
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=template&id=364b6320
1078
-
1079
- // 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
1080
- /* harmony default export */ var Deletevue_type_script_lang_js = ({
1081
- name: 'rp-treeselect--x'
1082
- });
1083
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=script&lang=js
1084
- /* harmony default export */ var icons_Deletevue_type_script_lang_js = (Deletevue_type_script_lang_js);
1085
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue
1086
-
1087
-
1088
-
1089
-
1090
-
1091
- /* normalize component */
1092
-
1093
- var Delete_component = normalizeComponent(
1094
- icons_Deletevue_type_script_lang_js,
1095
- Deletevue_type_template_id_364b6320_render,
1096
- Deletevue_type_template_id_364b6320_staticRenderFns,
1097
- false,
1098
- null,
1099
- null,
1100
- null
1101
-
1102
- )
1103
-
1104
- /* hot reload */
1105
- if (false) { var Delete_api; }
1106
- Delete_component.options.__file = "src/components/icons/Delete.vue"
1107
- /* harmony default export */ var Delete = (Delete_component.exports);
1108
- // 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
1109
-
1110
-
1111
-
1112
- /* harmony default export */ var MultiValueItemvue_type_script_lang_js = ({
1113
- name: 'rp-treeselect--multi-value-item',
1114
- setup: function setup() {
1115
- var instance = Object(external_vue_["inject"])('instance');
1116
- return {
1117
- instance: instance
1118
- };
1119
- },
1120
- props: {
1121
- node: {
1122
- type: Object,
1123
- required: true
1124
- }
1125
- },
1126
- methods: {
1127
- handleMouseDown: onLeftClick(function handleMouseDown() {
1128
- var instance = this.instance,
1129
- node = this.node;
1130
- instance.select(node);
1131
- })
1132
- },
1133
- render: function render() {
1134
- var h = arguments[0];
1135
- var instance = this.instance,
1136
- node = this.node;
1137
- var itemClass = {
1138
- 'rp-treeselect__multi-value-item': true,
1139
- 'rp-treeselect__multi-value-item-disabled': node.isDisabled,
1140
- 'rp-treeselect__multi-value-item-new': node.isNew
1141
- };
1142
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
1143
- var labelRenderer = customValueLabelRenderer ? customValueLabelRenderer({
1144
- node: node
1145
- }) : node.label;
1146
- return h("div", {
1147
- "class": "rp-treeselect__multi-value-item-container"
1148
- }, [h("div", {
1149
- "class": itemClass,
1150
- on: {
1151
- "mousedown": this.handleMouseDown
1152
- }
1153
- }, [h("span", {
1154
- "class": "rp-treeselect__multi-value-label"
1155
- }, [labelRenderer]), h("span", {
1156
- "class": "rp-treeselect__icon rp-treeselect__value-remove"
1157
- }, [h(Delete)])])]);
1158
- }
1159
- });
1160
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue?vue&type=script&lang=js
1161
- /* harmony default export */ var components_MultiValueItemvue_type_script_lang_js = (MultiValueItemvue_type_script_lang_js);
1162
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue
1163
- var MultiValueItem_render, MultiValueItem_staticRenderFns
1164
-
1165
-
1166
-
1167
-
1168
- /* normalize component */
1169
-
1170
- var MultiValueItem_component = normalizeComponent(
1171
- components_MultiValueItemvue_type_script_lang_js,
1172
- MultiValueItem_render,
1173
- MultiValueItem_staticRenderFns,
1174
- false,
1175
- null,
1176
- null,
1177
- null
1178
-
1179
- )
1180
-
1181
- /* hot reload */
1182
- if (false) { var MultiValueItem_api; }
1183
- MultiValueItem_component.options.__file = "src/components/MultiValueItem.vue"
1184
- /* harmony default export */ var MultiValueItem = (MultiValueItem_component.exports);
1185
- // 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
1186
-
1187
-
1188
-
1189
-
1190
-
1191
- /* harmony default export */ var MultiValuevue_type_script_lang_js = ({
1192
- name: 'rp-treeselect--multi-value',
1193
- setup: function setup() {
1194
- var instance = Object(external_vue_["inject"])('instance');
1195
- return {
1196
- instance: instance
1197
- };
1198
- },
1199
- methods: {
1200
- renderMultiValueItems: function renderMultiValueItems() {
1201
- var h = this.$createElement;
1202
- var instance = this.instance;
1203
- return instance.internalValue.slice(0, instance.limit).map(instance.getNode).map(function (node) {
1204
- return h(MultiValueItem, {
1205
- key: "multi-value-item-".concat(node.id),
1206
- attrs: {
1207
- node: node
1208
- }
1209
- });
1210
- });
1211
- },
1212
- renderExceedLimitTip: function renderExceedLimitTip() {
1213
- var h = this.$createElement;
1214
- var instance = this.instance;
1215
- var count = instance.internalValue.length - instance.limit;
1216
- if (count <= 0) return null;
1217
- return h("div", {
1218
- "class": "rp-treeselect__limit-tip rp-treeselect-helper-zoom-effect-off",
1219
- key: "exceed-limit-tip"
1220
- }, [h("span", {
1221
- "class": "rp-treeselect__limit-tip-text"
1222
- }, [instance.limitText(count)])]);
1223
- }
1224
- },
1225
- render: function render() {
1226
- var h = arguments[0];
1227
- var renderValueContainer = this.$parent.renderValueContainer;
1228
- var transitionGroupProps = {
1229
- props: {
1230
- tag: 'div',
1231
- name: 'rp-treeselect__multi-value-item--transition',
1232
- appear: true
1233
- }
1234
- };
1235
- return renderValueContainer(h("transition-group", external_babel_helper_vue_jsx_merge_props_default()([{
1236
- "class": "rp-treeselect__multi-value"
1237
- }, transitionGroupProps]), [this.renderMultiValueItems(), this.renderExceedLimitTip(), h(Placeholder, {
1238
- key: "placeholder"
1239
- }), h(Input, {
1240
- ref: "input",
1241
- key: "input"
1242
- })]));
1243
- }
1244
- });
1245
- // CONCATENATED MODULE: ./src/components/MultiValue.vue?vue&type=script&lang=js
1246
- /* harmony default export */ var components_MultiValuevue_type_script_lang_js = (MultiValuevue_type_script_lang_js);
1247
- // CONCATENATED MODULE: ./src/components/MultiValue.vue
1248
- var MultiValue_render, MultiValue_staticRenderFns
1249
-
1250
-
1251
-
1252
-
1253
- /* normalize component */
1254
-
1255
- var MultiValue_component = normalizeComponent(
1256
- components_MultiValuevue_type_script_lang_js,
1257
- MultiValue_render,
1258
- MultiValue_staticRenderFns,
1259
- false,
1260
- null,
1261
- null,
1262
- null
1263
-
1264
- )
1265
-
1266
- /* hot reload */
1267
- if (false) { var MultiValue_api; }
1268
- MultiValue_component.options.__file = "src/components/MultiValue.vue"
1269
- /* harmony default export */ var MultiValue = (MultiValue_component.exports);
1270
- // 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
1271
- var Arrowvue_type_template_id_11186cd4_render = function render() {
1272
- var _vm = this,
1273
- _c = _vm._self._c
1274
- return _c(
1275
- "svg",
1276
- {
1277
- attrs: {
1278
- xmlns: "http://www.w3.org/2000/svg",
1279
- viewBox: "0 0 292.362 292.362",
1280
- },
1281
- },
1282
- [
1283
- _c("path", {
1284
- attrs: {
1285
- 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",
1286
- },
1287
- }),
1288
- ]
1289
- )
1290
- }
1291
- var Arrowvue_type_template_id_11186cd4_staticRenderFns = []
1292
- Arrowvue_type_template_id_11186cd4_render._withStripped = true
1293
-
1294
-
1295
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=template&id=11186cd4
1296
-
1297
- // 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
1298
- /* harmony default export */ var Arrowvue_type_script_lang_js = ({
1299
- name: 'rp-treeselect--arrow'
1300
- });
1301
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=script&lang=js
1302
- /* harmony default export */ var icons_Arrowvue_type_script_lang_js = (Arrowvue_type_script_lang_js);
1303
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue
1304
-
1305
-
1306
-
1307
-
1308
-
1309
- /* normalize component */
1310
-
1311
- var Arrow_component = normalizeComponent(
1312
- icons_Arrowvue_type_script_lang_js,
1313
- Arrowvue_type_template_id_11186cd4_render,
1314
- Arrowvue_type_template_id_11186cd4_staticRenderFns,
1315
- false,
1316
- null,
1317
- null,
1318
- null
1319
-
1320
- )
1321
-
1322
- /* hot reload */
1323
- if (false) { var Arrow_api; }
1324
- Arrow_component.options.__file = "src/components/icons/Arrow.vue"
1325
- /* harmony default export */ var Arrow = (Arrow_component.exports);
1326
- // 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
1327
-
1328
-
1329
-
1330
-
1331
-
1332
-
1333
- /* harmony default export */ var Controlvue_type_script_lang_js = ({
1334
- name: 'rp-treeselect--control',
1335
- setup: function setup() {
1336
- var instance = Object(external_vue_["inject"])('instance');
1337
- return {
1338
- instance: instance
1339
- };
1340
- },
1341
- computed: {
1342
- shouldShowX: function shouldShowX() {
1343
- var instance = this.instance;
1344
- return instance.clearable && !instance.disabled && instance.hasValue && (this.hasUndisabledValue || instance.allowClearingDisabled);
1345
- },
1346
- shouldShowArrow: function shouldShowArrow() {
1347
- var instance = this.instance;
1348
- if (!instance.alwaysOpen) return true;
1349
- return !instance.menu.isOpen;
1350
- },
1351
- hasUndisabledValue: function hasUndisabledValue() {
1352
- var instance = this.instance;
1353
- return instance.hasValue && instance.internalValue.some(function (id) {
1354
- return !instance.getNode(id).isDisabled;
1355
- });
1356
- }
1357
- },
1358
- methods: {
1359
- renderX: function renderX() {
1360
- var h = this.$createElement;
1361
- var instance = this.instance;
1362
- var title = instance.multiple ? instance.clearAllText : instance.clearValueText;
1363
- if (!this.shouldShowX) return null;
1364
- return h("div", {
1365
- "class": "rp-treeselect__x-container",
1366
- attrs: {
1367
- title: title
1368
- },
1369
- on: {
1370
- "mousedown": this.handleMouseDownOnX
1371
- }
1372
- }, [h(Delete, {
1373
- "class": "rp-treeselect__x"
1374
- })]);
1375
- },
1376
- renderArrow: function renderArrow() {
1377
- var h = this.$createElement;
1378
- var instance = this.instance;
1379
- var arrowClass = {
1380
- 'rp-treeselect__control-arrow': true,
1381
- 'rp-treeselect__control-arrow--rotated': instance.menu.isOpen
1382
- };
1383
- if (!this.shouldShowArrow) return null;
1384
- return h("div", {
1385
- "class": "rp-treeselect__control-arrow-container",
1386
- on: {
1387
- "mousedown": this.handleMouseDownOnArrow
1388
- }
1389
- }, [h(Arrow, {
1390
- "class": arrowClass
1391
- })]);
1392
- },
1393
- handleMouseDownOnX: onLeftClick(function handleMouseDownOnX(evt) {
1394
- evt.stopPropagation();
1395
- evt.preventDefault();
1396
- var instance = this.instance;
1397
- var result = instance.beforeClearAll();
1398
- var handler = function handler(shouldClear) {
1399
- if (shouldClear) instance.clear();
1400
- };
1401
- if (external_is_promise_default()(result)) {
1402
- result.then(handler);
1403
- } else {
1404
- setTimeout(function () {
1405
- return handler(result);
1406
- }, 0);
1407
- }
1408
- }),
1409
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnArrow(evt) {
1410
- evt.preventDefault();
1411
- evt.stopPropagation();
1412
- var instance = this.instance;
1413
- instance.focusInput();
1414
- instance.toggleMenu();
1415
- }),
1416
- renderValueContainer: function renderValueContainer(children) {
1417
- var h = this.$createElement;
1418
- return h("div", {
1419
- "class": "rp-treeselect__value-container"
1420
- }, [children]);
1421
- }
1422
- },
1423
- render: function render() {
1424
- var h = arguments[0];
1425
- var instance = this.instance;
1426
- var ValueContainer = instance.single ? SingleValue : MultiValue;
1427
- return h("div", {
1428
- "class": "rp-treeselect__control",
1429
- on: {
1430
- "mousedown": instance.handleMouseDown
1431
- }
1432
- }, [h(ValueContainer, {
1433
- ref: "value-container"
1434
- }), this.renderX(), this.renderArrow()]);
1435
- }
1436
- });
1437
- // CONCATENATED MODULE: ./src/components/Control.vue?vue&type=script&lang=js
1438
- /* harmony default export */ var components_Controlvue_type_script_lang_js = (Controlvue_type_script_lang_js);
1439
- // CONCATENATED MODULE: ./src/components/Control.vue
1440
- var Control_render, Control_staticRenderFns
1441
-
1442
-
1443
-
1444
-
1445
- /* normalize component */
1446
-
1447
- var Control_component = normalizeComponent(
1448
- components_Controlvue_type_script_lang_js,
1449
- Control_render,
1450
- Control_staticRenderFns,
1451
- false,
1452
- null,
1453
- null,
1454
- null
1455
-
1456
- )
1457
-
1458
- /* hot reload */
1459
- if (false) { var Control_api; }
1460
- Control_component.options.__file = "src/components/Control.vue"
1461
- /* harmony default export */ var Control = (Control_component.exports);
1462
- // 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
1463
- /* harmony default export */ var Tipvue_type_script_lang_js = ({
1464
- name: 'rp-treeselect--tip',
1465
- props: {
1466
- type: {
1467
- type: String,
1468
- required: true
1469
- },
1470
- icon: {
1471
- type: String,
1472
- required: true
1473
- }
1474
- },
1475
- render: function render() {
1476
- var h = arguments[0];
1477
- var _this$$props = this.$props,
1478
- icon = _this$$props.icon,
1479
- type = _this$$props.type;
1480
- return h("div", {
1481
- "class": "rp-treeselect__tip rp-treeselect__".concat(type, "-tip")
1482
- }, [h("div", {
1483
- "class": "rp-treeselect__icon-container"
1484
- }, [h("span", {
1485
- "class": "rp-treeselect__icon-".concat(icon)
1486
- })]), h("span", {
1487
- "class": "rp-treeselect__tip-text rp-treeselect__".concat(type, "-tip-text")
1488
- }, [h("slot")])]);
1489
- }
1490
- });
1491
- // CONCATENATED MODULE: ./src/components/Tip.vue?vue&type=script&lang=js
1492
- /* harmony default export */ var components_Tipvue_type_script_lang_js = (Tipvue_type_script_lang_js);
1493
- // CONCATENATED MODULE: ./src/components/Tip.vue
1494
- var Tip_render, Tip_staticRenderFns
1495
-
1496
-
1497
-
1498
-
1499
- /* normalize component */
1500
-
1501
- var Tip_component = normalizeComponent(
1502
- components_Tipvue_type_script_lang_js,
1503
- Tip_render,
1504
- Tip_staticRenderFns,
1505
- false,
1506
- null,
1507
- null,
1508
- null
1509
-
1510
- )
1511
-
1512
- /* hot reload */
1513
- if (false) { var Tip_api; }
1514
- Tip_component.options.__file = "src/components/Tip.vue"
1515
- /* harmony default export */ var Tip = (Tip_component.exports);
1516
- // 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
1517
-
1518
-
1519
-
1520
-
1521
-
1522
-
1523
- var arrowPlaceholder, checkMark, minusMark;
1524
- var Option = {
1525
- name: 'rp-treeselect--option',
1526
- setup: function setup() {
1527
- var instance = Object(external_vue_["inject"])('instance');
1528
- return {
1529
- instance: instance
1530
- };
1531
- },
1532
- props: {
1533
- node: {
1534
- type: Object,
1535
- required: true
1536
- }
1537
- },
1538
- computed: {
1539
- shouldExpand: function shouldExpand() {
1540
- var instance = this.instance,
1541
- node = this.node;
1542
- return node.isBranch && instance.shouldExpand(node);
1543
- },
1544
- shouldShow: function shouldShow() {
1545
- var instance = this.instance,
1546
- node = this.node;
1547
- return instance.shouldShowOptionInMenu(node);
1548
- }
1549
- },
1550
- methods: {
1551
- renderOption: function renderOption() {
1552
- var h = this.$createElement;
1553
- var instance = this.instance,
1554
- node = this.node;
1555
- var optionClass = {
1556
- 'rp-treeselect__option': true,
1557
- 'rp-treeselect__option--disabled': node.isDisabled,
1558
- 'rp-treeselect__option--selected': instance.isSelected(node),
1559
- 'rp-treeselect__option--highlight': node.isHighlighted,
1560
- 'rp-treeselect__option--matched': instance.localSearch.active && node.isMatched,
1561
- 'rp-treeselect__option--hide': !this.shouldShow
1562
- };
1563
- return h("div", {
1564
- "class": optionClass,
1565
- on: {
1566
- "mouseenter": this.handleMouseEnterOption
1567
- },
1568
- attrs: {
1569
- "data-id": node.id
1570
- }
1571
- }, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
1572
- },
1573
- renderSubOptionsList: function renderSubOptionsList() {
1574
- var h = this.$createElement;
1575
- if (!this.shouldExpand) return null;
1576
- return h("div", {
1577
- "class": "rp-treeselect__list"
1578
- }, [this.renderSubOptions(), this.renderNoChildrenTip(), this.renderLoadingChildrenTip(), this.renderLoadingChildrenErrorTip()]);
1579
- },
1580
- renderArrow: function renderArrow() {
1581
- var h = this.$createElement;
1582
- var instance = this.instance,
1583
- node = this.node;
1584
- if (instance.shouldFlattenOptions && this.shouldShow) return null;
1585
- if (node.isBranch) {
1586
- var transitionProps = {
1587
- props: {
1588
- name: 'rp-treeselect__option-arrow--prepare',
1589
- appear: true
1590
- }
1591
- };
1592
- var arrowClass = {
1593
- 'rp-treeselect__option-arrow': true,
1594
- 'rp-treeselect__option-arrow--rotated': this.shouldExpand
1595
- };
1596
- return h("div", {
1597
- "class": "rp-treeselect__option-arrow-container",
1598
- on: {
1599
- "mousedown": this.handleMouseDownOnArrow
1600
- }
1601
- }, [h("transition", transitionProps, [h(Arrow, {
1602
- "class": arrowClass
1603
- })])]);
1604
- }
1605
- if (instance.hasBranchNodes) {
1606
- if (!arrowPlaceholder) arrowPlaceholder = h("div", {
1607
- "class": "rp-treeselect__option-arrow-placeholder"
1608
- }, ["\xA0"]);
1609
- return arrowPlaceholder;
1610
- }
1611
- return null;
1612
- },
1613
- renderLabelContainer: function renderLabelContainer(children) {
1614
- var h = this.$createElement;
1615
- return h("div", {
1616
- "class": "rp-treeselect__label-container",
1617
- on: {
1618
- "mousedown": this.handleMouseDownOnLabelContainer
1619
- }
1620
- }, [children]);
1621
- },
1622
- renderCheckboxContainer: function renderCheckboxContainer(children) {
1623
- var h = this.$createElement;
1624
- var instance = this.instance,
1625
- node = this.node;
1626
- if (instance.single) return null;
1627
- if (instance.disableBranchNodes && node.isBranch) return null;
1628
- return h("div", {
1629
- "class": "rp-treeselect__checkbox-container"
1630
- }, [children]);
1631
- },
1632
- renderCheckbox: function renderCheckbox() {
1633
- var h = this.$createElement;
1634
- var instance = this.instance,
1635
- node = this.node;
1636
- var checkedState = instance.forest.checkedStateMap[node.id];
1637
- var checkboxClass = {
1638
- 'rp-treeselect__checkbox': true,
1639
- 'rp-treeselect__checkbox--checked': checkedState === CHECKED,
1640
- 'rp-treeselect__checkbox--indeterminate': checkedState === INDETERMINATE,
1641
- 'rp-treeselect__checkbox--unchecked': checkedState === UNCHECKED,
1642
- 'rp-treeselect__checkbox--disabled': node.isDisabled
1643
- };
1644
- if (!checkMark) checkMark = h("span", {
1645
- "class": "rp-treeselect__check-mark"
1646
- });
1647
- if (!minusMark) minusMark = h("span", {
1648
- "class": "rp-treeselect__minus-mark"
1649
- });
1650
- return h("span", {
1651
- "class": checkboxClass
1652
- }, [checkMark, minusMark]);
1653
- },
1654
- renderLabel: function renderLabel() {
1655
- var h = this.$createElement;
1656
- var instance = this.instance,
1657
- node = this.node;
1658
- var shouldShowCount = node.isBranch && (instance.localSearch.active ? instance.showCountOnSearchComputed : instance.showCount);
1659
- var count = shouldShowCount ? instance.localSearch.active ? instance.localSearch.countMap[node.id][instance.showCountOf] : node.count[instance.showCountOf] : NaN;
1660
- var labelClassName = 'rp-treeselect__label';
1661
- var countClassName = 'rp-treeselect__count';
1662
- var customLabelRenderer = instance.$scopedSlots['option-label'];
1663
- if (customLabelRenderer) return customLabelRenderer({
1664
- node: node,
1665
- shouldShowCount: shouldShowCount,
1666
- count: count,
1667
- labelClassName: labelClassName,
1668
- countClassName: countClassName
1669
- });
1670
- return h("label", {
1671
- "class": labelClassName
1672
- }, [node.label, shouldShowCount && h("span", {
1673
- "class": countClassName
1674
- }, ["(", count, ")"])]);
1675
- },
1676
- renderSubOptions: function renderSubOptions() {
1677
- var h = this.$createElement;
1678
- var node = this.node;
1679
- if (!node.childrenStates.isLoaded) return null;
1680
- return node.children.map(function (childNode) {
1681
- return h(Option, {
1682
- attrs: {
1683
- node: childNode
1684
- },
1685
- key: childNode.id
1686
- });
1687
- });
1688
- },
1689
- renderNoChildrenTip: function renderNoChildrenTip() {
1690
- var h = this.$createElement;
1691
- var instance = this.instance,
1692
- node = this.node;
1693
- if (!node.childrenStates.isLoaded || node.children.length) return null;
1694
- return h(Tip, {
1695
- attrs: {
1696
- type: "no-children",
1697
- icon: "warning"
1698
- }
1699
- }, [instance.noChildrenText]);
1700
- },
1701
- renderLoadingChildrenTip: function renderLoadingChildrenTip() {
1702
- var h = this.$createElement;
1703
- var instance = this.instance,
1704
- node = this.node;
1705
- if (!node.childrenStates.isLoading) return null;
1706
- return h(Tip, {
1707
- attrs: {
1708
- type: "loading",
1709
- icon: "loader"
1710
- }
1711
- }, [instance.loadingText]);
1712
- },
1713
- renderLoadingChildrenErrorTip: function renderLoadingChildrenErrorTip() {
1714
- var h = this.$createElement;
1715
- var instance = this.instance,
1716
- node = this.node;
1717
- if (!node.childrenStates.loadingError) return null;
1718
- return h(Tip, {
1719
- attrs: {
1720
- type: "error",
1721
- icon: "error"
1722
- }
1723
- }, [node.childrenStates.loadingError, h("a", {
1724
- "class": "rp-treeselect__retry",
1725
- attrs: {
1726
- title: instance.retryTitle
1727
- },
1728
- on: {
1729
- "mousedown": this.handleMouseDownOnRetry
1730
- }
1731
- }, [instance.retryText])]);
1732
- },
1733
- handleMouseEnterOption: function handleMouseEnterOption(evt) {
1734
- var instance = this.instance,
1735
- node = this.node;
1736
- if (evt.target !== evt.currentTarget) return;
1737
- instance.setCurrentHighlightedOption(node, false);
1738
- },
1739
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnOptionArrow() {
1740
- var instance = this.instance,
1741
- node = this.node;
1742
- instance.toggleExpanded(node);
1743
- }),
1744
- handleMouseDownOnLabelContainer: onLeftClick(function handleMouseDownOnLabelContainer() {
1745
- var instance = this.instance,
1746
- node = this.node;
1747
- if (node.isBranch && instance.disableBranchNodes) {
1748
- instance.toggleExpanded(node);
1749
- } else {
1750
- instance.select(node);
1751
- }
1752
- }),
1753
- handleMouseDownOnRetry: onLeftClick(function handleMouseDownOnRetry() {
1754
- var instance = this.instance,
1755
- node = this.node;
1756
- instance.loadChildrenOptions(node);
1757
- })
1758
- },
1759
- render: function render() {
1760
- var h = arguments[0];
1761
- var node = this.node;
1762
- var indentLevel = this.instance.shouldFlattenOptions ? 0 : node.level;
1763
- var listItemClass = defineProperty_default()({
1764
- 'rp-treeselect__list-item': true
1765
- }, "rp-treeselect__indent-level-".concat(indentLevel), true);
1766
- var transitionProps = {
1767
- props: {
1768
- name: 'rp-treeselect__list--transition'
1769
- }
1770
- };
1771
- return h("div", {
1772
- "class": listItemClass
1773
- }, [this.renderOption(), node.isBranch && h("transition", transitionProps, [this.renderSubOptionsList()])]);
1774
- }
1775
- };
1776
- /* harmony default export */ var Optionvue_type_script_lang_js = (Option);
1777
- // CONCATENATED MODULE: ./src/components/Option.vue?vue&type=script&lang=js
1778
- /* harmony default export */ var components_Optionvue_type_script_lang_js = (Optionvue_type_script_lang_js);
1779
- // CONCATENATED MODULE: ./src/components/Option.vue
1780
- var Option_render, Option_staticRenderFns
1781
-
1782
-
1783
-
1784
-
1785
- /* normalize component */
1786
-
1787
- var Option_component = normalizeComponent(
1788
- components_Optionvue_type_script_lang_js,
1789
- Option_render,
1790
- Option_staticRenderFns,
1791
- false,
1792
- null,
1793
- null,
1794
- null
1795
-
1796
- )
1797
-
1798
- /* harmony default export */ var components_Option = (Option_component.exports);
1799
- // 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
1800
-
1801
-
1802
-
1803
-
1804
-
1805
- var directionMap = {
1806
- top: 'top',
1807
- bottom: 'bottom',
1808
- above: 'top',
1809
- below: 'bottom'
1810
- };
1811
- /* harmony default export */ var Menuvue_type_script_lang_js = ({
1812
- name: 'rp-treeselect--menu',
1813
- setup: function setup() {
1814
- var instance = Object(external_vue_["inject"])('instance');
1815
- return {
1816
- instance: instance
1817
- };
1818
- },
1819
- computed: {
1820
- menuStyle: function menuStyle() {
1821
- var instance = this.instance;
1822
- return {
1823
- maxHeight: instance.maxHeight + 'px'
1824
- };
1825
- },
1826
- menuContainerStyle: function menuContainerStyle() {
1827
- var instance = this.instance;
1828
- return {
1829
- zIndex: instance.appendToBody ? null : instance.zIndex
1830
- };
1831
- }
1832
- },
1833
- watch: {
1834
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
1835
- if (newValue) {
1836
- this.$nextTick(this.onMenuOpen);
1837
- } else {
1838
- this.onMenuClose();
1839
- }
1840
- }
1841
- },
1842
- created: function created() {
1843
- this.menuSizeWatcher = null;
1844
- this.menuResizeAndScrollEventListeners = null;
1845
- },
1846
- mounted: function mounted() {
1847
- var instance = this.instance;
1848
- if (instance.menu.isOpen) this.$nextTick(this.onMenuOpen);
1849
- },
1850
- destroyed: function destroyed() {
1851
- this.onMenuClose();
1852
- },
1853
- methods: {
1854
- renderMenu: function renderMenu() {
1855
- var h = this.$createElement;
1856
- var instance = this.instance;
1857
- if (!instance.menu.isOpen) return null;
1858
- return h("div", {
1859
- ref: "menu",
1860
- "class": "rp-treeselect__menu",
1861
- on: {
1862
- "mousedown": instance.handleMouseDown
1863
- },
1864
- style: this.menuStyle
1865
- }, [this.renderBeforeList(), instance.async ? this.renderAsyncSearchMenuInner() : instance.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(), this.renderAfterList()]);
1866
- },
1867
- renderBeforeList: function renderBeforeList() {
1868
- var instance = this.instance;
1869
- var beforeListRenderer = instance.$scopedSlots['before-list'];
1870
- return beforeListRenderer ? beforeListRenderer() : null;
1871
- },
1872
- renderAfterList: function renderAfterList() {
1873
- var instance = this.instance;
1874
- var afterListRenderer = instance.$scopedSlots['after-list'];
1875
- return afterListRenderer ? afterListRenderer() : null;
1876
- },
1877
- renderNormalMenuInner: function renderNormalMenuInner() {
1878
- var instance = this.instance;
1879
- if (instance.rootOptionsStates.isLoading) {
1880
- return this.renderLoadingOptionsTip();
1881
- } else if (instance.rootOptionsStates.loadingError) {
1882
- return this.renderLoadingRootOptionsErrorTip();
1883
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
1884
- return this.renderNoAvailableOptionsTip();
1885
- } else {
1886
- return this.renderOptionList();
1887
- }
1888
- },
1889
- renderLocalSearchMenuInner: function renderLocalSearchMenuInner() {
1890
- var instance = this.instance;
1891
- if (instance.rootOptionsStates.isLoading) {
1892
- return this.renderLoadingOptionsTip();
1893
- } else if (instance.rootOptionsStates.loadingError) {
1894
- return this.renderLoadingRootOptionsErrorTip();
1895
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
1896
- return this.renderNoAvailableOptionsTip();
1897
- } else if (instance.localSearch.noResults) {
1898
- return this.renderNoResultsTip();
1899
- } else {
1900
- return this.renderOptionList();
1901
- }
1902
- },
1903
- renderAsyncSearchMenuInner: function renderAsyncSearchMenuInner() {
1904
- var instance = this.instance;
1905
- var entry = instance.getRemoteSearchEntry();
1906
- var shouldShowSearchPromptTip = instance.trigger.searchQuery === '' && !instance.defaultOptions;
1907
- var shouldShowNoResultsTip = shouldShowSearchPromptTip ? false : entry.isLoaded && entry.options.length === 0;
1908
- if (shouldShowSearchPromptTip) {
1909
- return this.renderSearchPromptTip();
1910
- } else if (entry.isLoading) {
1911
- return this.renderLoadingOptionsTip();
1912
- } else if (entry.loadingError) {
1913
- return this.renderAsyncSearchLoadingErrorTip();
1914
- } else if (shouldShowNoResultsTip) {
1915
- return this.renderNoResultsTip();
1916
- } else {
1917
- return this.renderOptionList();
1918
- }
1919
- },
1920
- renderOptionList: function renderOptionList() {
1921
- var h = this.$createElement;
1922
- var instance = this.instance;
1923
- return h("div", {
1924
- "class": "rp-treeselect__list"
1925
- }, [instance.forest.normalizedOptions.map(function (rootNode) {
1926
- return h(components_Option, {
1927
- attrs: {
1928
- node: rootNode
1929
- },
1930
- key: rootNode.id
1931
- });
1932
- })]);
1933
- },
1934
- renderSearchPromptTip: function renderSearchPromptTip() {
1935
- var h = this.$createElement;
1936
- var instance = this.instance;
1937
- return h(Tip, {
1938
- attrs: {
1939
- type: "search-prompt",
1940
- icon: "warning"
1941
- }
1942
- }, [instance.searchPromptText]);
1943
- },
1944
- renderLoadingOptionsTip: function renderLoadingOptionsTip() {
1945
- var h = this.$createElement;
1946
- var instance = this.instance;
1947
- return h(Tip, {
1948
- attrs: {
1949
- type: "loading",
1950
- icon: "loader"
1951
- }
1952
- }, [instance.loadingText]);
1953
- },
1954
- renderLoadingRootOptionsErrorTip: function renderLoadingRootOptionsErrorTip() {
1955
- var h = this.$createElement;
1956
- var instance = this.instance;
1957
- return h(Tip, {
1958
- attrs: {
1959
- type: "error",
1960
- icon: "error"
1961
- }
1962
- }, [instance.rootOptionsStates.loadingError, h("a", {
1963
- "class": "rp-treeselect__retry",
1964
- on: {
1965
- "click": instance.loadRootOptions
1966
- },
1967
- attrs: {
1968
- title: instance.retryTitle
1969
- }
1970
- }, [instance.retryText])]);
1971
- },
1972
- renderAsyncSearchLoadingErrorTip: function renderAsyncSearchLoadingErrorTip() {
1973
- var h = this.$createElement;
1974
- var instance = this.instance;
1975
- var entry = instance.getRemoteSearchEntry();
1976
- return h(Tip, {
1977
- attrs: {
1978
- type: "error",
1979
- icon: "error"
1980
- }
1981
- }, [entry.loadingError, h("a", {
1982
- "class": "rp-treeselect__retry",
1983
- on: {
1984
- "click": instance.handleRemoteSearch
1985
- },
1986
- attrs: {
1987
- title: instance.retryTitle
1988
- }
1989
- }, [instance.retryText])]);
1990
- },
1991
- renderNoAvailableOptionsTip: function renderNoAvailableOptionsTip() {
1992
- var h = this.$createElement;
1993
- var instance = this.instance;
1994
- return h(Tip, {
1995
- attrs: {
1996
- type: "no-options",
1997
- icon: "warning"
1998
- }
1999
- }, [instance.noOptionsText]);
2000
- },
2001
- renderNoResultsTip: function renderNoResultsTip() {
2002
- var h = this.$createElement;
2003
- var instance = this.instance;
2004
- return h(Tip, {
2005
- attrs: {
2006
- type: "no-results",
2007
- icon: "warning"
2008
- }
2009
- }, [instance.noResultsText]);
2010
- },
2011
- onMenuOpen: function onMenuOpen() {
2012
- this.adjustMenuOpenDirection();
2013
- this.setupMenuSizeWatcher();
2014
- this.setupMenuResizeAndScrollEventListeners();
2015
- },
2016
- onMenuClose: function onMenuClose() {
2017
- this.removeMenuSizeWatcher();
2018
- this.removeMenuResizeAndScrollEventListeners();
2019
- },
2020
- adjustMenuOpenDirection: function adjustMenuOpenDirection() {
2021
- var instance = this.instance;
2022
- if (!instance.menu.isOpen) return;
2023
- var $menu = instance.getMenu();
2024
- var $control = instance.getControl();
2025
- var menuRect = $menu.getBoundingClientRect();
2026
- var controlRect = $control.getBoundingClientRect();
2027
- var menuHeight = menuRect.height;
2028
- var viewportHeight = window.innerHeight;
2029
- var spaceAbove = controlRect.top;
2030
- var spaceBelow = window.innerHeight - controlRect.bottom;
2031
- var isControlInViewport = controlRect.top >= 0 && controlRect.top <= viewportHeight || controlRect.top < 0 && controlRect.bottom > 0;
2032
- var hasEnoughSpaceBelow = spaceBelow > menuHeight + MENU_BUFFER;
2033
- var hasEnoughSpaceAbove = spaceAbove > menuHeight + MENU_BUFFER;
2034
- if (!isControlInViewport) {
2035
- instance.closeMenu();
2036
- } else if (instance.openDirection !== 'auto') {
2037
- instance.menu.placement = directionMap[instance.openDirection];
2038
- } else if (hasEnoughSpaceBelow || !hasEnoughSpaceAbove) {
2039
- instance.menu.placement = 'bottom';
2040
- } else {
2041
- instance.menu.placement = 'top';
2042
- }
2043
- },
2044
- setupMenuSizeWatcher: function setupMenuSizeWatcher() {
2045
- var instance = this.instance;
2046
- var $menu = instance.getMenu();
2047
- if (this.menuSizeWatcher) return;
2048
- this.menuSizeWatcher = {
2049
- remove: watchSize($menu, this.adjustMenuOpenDirection)
2050
- };
2051
- },
2052
- setupMenuResizeAndScrollEventListeners: function setupMenuResizeAndScrollEventListeners() {
2053
- var instance = this.instance;
2054
- var $control = instance.getControl();
2055
- if (this.menuResizeAndScrollEventListeners) return;
2056
- this.menuResizeAndScrollEventListeners = {
2057
- remove: setupResizeAndScrollEventListeners($control, this.adjustMenuOpenDirection)
2058
- };
2059
- },
2060
- removeMenuSizeWatcher: function removeMenuSizeWatcher() {
2061
- if (!this.menuSizeWatcher) return;
2062
- this.menuSizeWatcher.remove();
2063
- this.menuSizeWatcher = null;
2064
- },
2065
- removeMenuResizeAndScrollEventListeners: function removeMenuResizeAndScrollEventListeners() {
2066
- if (!this.menuResizeAndScrollEventListeners) return;
2067
- this.menuResizeAndScrollEventListeners.remove();
2068
- this.menuResizeAndScrollEventListeners = null;
2069
- }
2070
- },
2071
- render: function render() {
2072
- var h = arguments[0];
2073
- return h("div", {
2074
- ref: "menu-container",
2075
- "class": "rp-treeselect__menu-container",
2076
- style: this.menuContainerStyle
2077
- }, [h("transition", {
2078
- attrs: {
2079
- name: "rp-treeselect__menu--transition"
2080
- }
2081
- }, [this.renderMenu()])]);
2082
- }
2083
- });
2084
- // CONCATENATED MODULE: ./src/components/Menu.vue?vue&type=script&lang=js
2085
- /* harmony default export */ var components_Menuvue_type_script_lang_js = (Menuvue_type_script_lang_js);
2086
- // CONCATENATED MODULE: ./src/components/Menu.vue
2087
- var Menu_render, Menu_staticRenderFns
2088
-
2089
-
2090
-
2091
-
2092
- /* normalize component */
2093
-
2094
- var Menu_component = normalizeComponent(
2095
- components_Menuvue_type_script_lang_js,
2096
- Menu_render,
2097
- Menu_staticRenderFns,
2098
- false,
2099
- null,
2100
- null,
2101
- null
2102
-
2103
- )
2104
-
2105
- /* hot reload */
2106
- if (false) { var Menu_api; }
2107
- Menu_component.options.__file = "src/components/Menu.vue"
2108
- /* harmony default export */ var Menu = (Menu_component.exports);
2109
- // 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
2110
-
2111
- 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; }
2112
- 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; }
2113
-
2114
-
2115
-
2116
- var PortalTarget = {
2117
- name: 'rp-treeselect--portal-target',
2118
- setup: function setup() {
2119
- console.log('TEST');
2120
- var instance = Object(external_vue_["inject"])('instance');
2121
- return {
2122
- instance: instance
2123
- };
2124
- },
2125
- watch: {
2126
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
2127
- if (newValue) {
2128
- this.setupHandlers();
2129
- } else {
2130
- this.removeHandlers();
2131
- }
2132
- },
2133
- 'instance.menu.placement': function instanceMenuPlacement() {
2134
- this.updateMenuContainerOffset();
2135
- }
2136
- },
2137
- created: function created() {
2138
- this.controlResizeAndScrollEventListeners = null;
2139
- this.controlSizeWatcher = null;
2140
- },
2141
- mounted: function mounted() {
2142
- console.log('TEST');
2143
- var instance = this.instance;
2144
- if (instance.menu.isOpen) this.setupHandlers();
2145
- },
2146
- methods: {
2147
- setupHandlers: function setupHandlers() {
2148
- this.updateWidth();
2149
- this.updateMenuContainerOffset();
2150
- this.setupControlResizeAndScrollEventListeners();
2151
- this.setupControlSizeWatcher();
2152
- },
2153
- removeHandlers: function removeHandlers() {
2154
- this.removeControlResizeAndScrollEventListeners();
2155
- this.removeControlSizeWatcher();
2156
- },
2157
- setupControlResizeAndScrollEventListeners: function setupControlResizeAndScrollEventListeners() {
2158
- var instance = this.instance;
2159
- var $control = instance.getControl();
2160
- if (this.controlResizeAndScrollEventListeners) return;
2161
- this.controlResizeAndScrollEventListeners = {
2162
- remove: setupResizeAndScrollEventListeners($control, this.updateMenuContainerOffset)
2163
- };
2164
- },
2165
- setupControlSizeWatcher: function setupControlSizeWatcher() {
2166
- var _this = this;
2167
- var instance = this.instance;
2168
- var $control = instance.getControl();
2169
- if (this.controlSizeWatcher) return;
2170
- this.controlSizeWatcher = {
2171
- remove: watchSize($control, function () {
2172
- _this.updateWidth();
2173
- _this.updateMenuContainerOffset();
2174
- })
2175
- };
2176
- },
2177
- removeControlResizeAndScrollEventListeners: function removeControlResizeAndScrollEventListeners() {
2178
- if (!this.controlResizeAndScrollEventListeners) return;
2179
- this.controlResizeAndScrollEventListeners.remove();
2180
- this.controlResizeAndScrollEventListeners = null;
2181
- },
2182
- removeControlSizeWatcher: function removeControlSizeWatcher() {
2183
- if (!this.controlSizeWatcher) return;
2184
- this.controlSizeWatcher.remove();
2185
- this.controlSizeWatcher = null;
2186
- },
2187
- updateWidth: function updateWidth() {
2188
- var instance = this.instance;
2189
- var $portalTarget = this.$el;
2190
- var $control = instance.getControl();
2191
- var controlRect = $control.getBoundingClientRect();
2192
- $portalTarget.style.width = controlRect.width + 'px';
2193
- },
2194
- updateMenuContainerOffset: function updateMenuContainerOffset() {
2195
- var instance = this.instance;
2196
- var $control = instance.getControl();
2197
- var $portalTarget = this.$el;
2198
- var controlRect = $control.getBoundingClientRect();
2199
- var portalTargetRect = $portalTarget.getBoundingClientRect();
2200
- var offsetY = instance.menu.placement === 'bottom' ? controlRect.height : 0;
2201
- var left = Math.round(controlRect.left - portalTargetRect.left) + 'px';
2202
- var top = Math.round(controlRect.top - portalTargetRect.top + offsetY) + 'px';
2203
- var menuContainerStyle = this.$refs.menu.$refs['menu-container'].style;
2204
- var transformVariations = ['transform', 'webkitTransform', 'MozTransform', 'msTransform'];
2205
- var transform = find(transformVariations, function (t) {
2206
- return t in document.body.style;
2207
- });
2208
- menuContainerStyle[transform] = "translate(".concat(left, ", ").concat(top, ")");
2209
- }
2210
- },
2211
- render: function render() {
2212
- var h = arguments[0];
2213
- var portalTargetClass = ['rp-treeselect__portal-target', this.instance.wrapperClass];
2214
- var portalTargetStyle = {
2215
- zIndex: this.instance.zIndex
2216
- };
2217
- return h("div", {
2218
- "class": portalTargetClass,
2219
- style: portalTargetStyle,
2220
- attrs: {
2221
- "data-instance-id": this.instance.getInstanceId()
2222
- }
2223
- }, [h(Menu, {
2224
- ref: "menu"
2225
- })]);
2226
- },
2227
- destroyed: function destroyed() {
2228
- this.removeHandlers();
2229
- }
2230
- };
2231
- var placeholder;
2232
- /* harmony default export */ var MenuPortalvue_type_script_lang_js = ({
2233
- name: 'rp-treeselect--menu-portal',
2234
- created: function created() {
2235
- this.portalTarget = null;
2236
- },
2237
- mounted: function mounted() {
2238
- this.setup();
2239
- },
2240
- destroyed: function destroyed() {
2241
- this.teardown();
2242
- },
2243
- methods: {
2244
- setup: function setup() {
2245
- var el = document.createElement('div');
2246
- el.setAttribute('id', "menu-target-".concat(this._uid));
2247
- document.body.appendChild(el);
2248
- var targetApp = _objectSpread({
2249
- parent: this
2250
- }, PortalTarget);
2251
- this.portalTarget = Object(external_vue_["createApp"])(targetApp);
2252
- this.portalTarget.mount("#menu-target-".concat(this._uid));
2253
- },
2254
- teardown: function teardown() {
2255
- document.body.removeChild(this.portalTarget.$el);
2256
- this.portalTarget.$el.innerHTML = '';
2257
- this.portalTarget.$destroy();
2258
- this.portalTarget = null;
2259
- }
2260
- },
2261
- render: function render() {
2262
- var h = arguments[0];
2263
- if (!placeholder) placeholder = h("div", {
2264
- "class": "rp-treeselect__menu-placeholder"
2265
- });
2266
- return placeholder;
2267
- }
2268
- });
2269
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue?vue&type=script&lang=js
2270
- /* harmony default export */ var components_MenuPortalvue_type_script_lang_js = (MenuPortalvue_type_script_lang_js);
2271
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue
2272
- var MenuPortal_render, MenuPortal_staticRenderFns
2273
-
2274
-
2275
-
2276
-
2277
- /* normalize component */
2278
-
2279
- var MenuPortal_component = normalizeComponent(
2280
- components_MenuPortalvue_type_script_lang_js,
2281
- MenuPortal_render,
2282
- MenuPortal_staticRenderFns,
2283
- false,
2284
- null,
2285
- null,
2286
- null
2287
-
2288
- )
2289
-
2290
- /* harmony default export */ var MenuPortal = (MenuPortal_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/Treeselect.vue?vue&type=script&lang=js
2292
-
2293
-
2294
-
2295
- 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; }
2296
- 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; }
2297
-
2298
-
2299
-
2300
-
2301
-
2302
-
2303
-
2304
-
2305
- function sortValueByIndex(a, b) {
2306
- var i = 0;
2307
- do {
2308
- if (a.level < i) return -1;
2309
- if (b.level < i) return 1;
2310
- if (a.index[i] !== b.index[i]) return a.index[i] - b.index[i];
2311
- i++;
2312
- } while (true);
2313
- }
2314
- function sortValueByLevel(a, b) {
2315
- return a.level === b.level ? sortValueByIndex(a, b) : a.level - b.level;
2316
- }
2317
- function createAsyncOptionsStates() {
2318
- return {
2319
- isLoaded: false,
2320
- isLoading: false,
2321
- loadingError: ''
2322
- };
2323
- }
2324
- function stringifyOptionPropValue(value) {
2325
- if (typeof value === 'string') return value;
2326
- if (typeof value === 'number' && !isNaN_isNaN(value)) return value + '';
2327
- return '';
2328
- }
2329
- function match(enableFuzzyMatch, needle, haystack) {
2330
- return enableFuzzyMatch ? external_fuzzysearch_default()(needle, haystack) : includes(haystack, needle);
2331
- }
2332
- function getErrorMessage(err) {
2333
- return err.message || String(err);
2334
- }
2335
- var instanceId = 0;
2336
- /* harmony default export */ var Treeselectvue_type_script_lang_js = ({
2337
- name: 'rp-treeselect',
2338
- props: {
2339
- allowClearingDisabled: {
2340
- type: Boolean,
2341
- default: false
2342
- },
2343
- allowSelectingDisabledDescendants: {
2344
- type: Boolean,
2345
- default: false
2346
- },
2347
- alwaysOpen: {
2348
- type: Boolean,
2349
- default: false
2350
- },
2351
- appendToBody: {
2352
- type: Boolean,
2353
- default: false
2354
- },
2355
- async: {
2356
- type: Boolean,
2357
- default: false
2358
- },
2359
- autoFocus: {
2360
- type: Boolean,
2361
- default: false
2362
- },
2363
- autoLoadRootOptions: {
2364
- type: Boolean,
2365
- default: true
2366
- },
2367
- autoDeselectAncestors: {
2368
- type: Boolean,
2369
- default: false
2370
- },
2371
- autoDeselectDescendants: {
2372
- type: Boolean,
2373
- default: false
2374
- },
2375
- autoSelectAncestors: {
2376
- type: Boolean,
2377
- default: false
2378
- },
2379
- autoSelectDescendants: {
2380
- type: Boolean,
2381
- default: false
2382
- },
2383
- backspaceRemoves: {
2384
- type: Boolean,
2385
- default: true
2386
- },
2387
- beforeClearAll: {
2388
- type: Function,
2389
- default: constant_default()(true)
2390
- },
2391
- branchNodesFirst: {
2392
- type: Boolean,
2393
- default: false
2394
- },
2395
- cacheOptions: {
2396
- type: Boolean,
2397
- default: true
2398
- },
2399
- clearable: {
2400
- type: Boolean,
2401
- default: true
2402
- },
2403
- clearAllText: {
2404
- type: String,
2405
- default: 'Clear all'
2406
- },
2407
- clearOnSelect: {
2408
- type: Boolean,
2409
- default: false
2410
- },
2411
- clearValueText: {
2412
- type: String,
2413
- default: 'Clear value'
2414
- },
2415
- closeOnSelect: {
2416
- type: Boolean,
2417
- default: true
2418
- },
2419
- defaultExpandLevel: {
2420
- type: Number,
2421
- default: 0
2422
- },
2423
- defaultOptions: {
2424
- default: false
2425
- },
2426
- deleteRemoves: {
2427
- type: Boolean,
2428
- default: true
2429
- },
2430
- delimiter: {
2431
- type: String,
2432
- default: ','
2433
- },
2434
- flattenSearchResults: {
2435
- type: Boolean,
2436
- default: false
2437
- },
2438
- disableBranchNodes: {
2439
- type: Boolean,
2440
- default: false
2441
- },
2442
- disabled: {
2443
- type: Boolean,
2444
- default: false
2445
- },
2446
- disableFuzzyMatching: {
2447
- type: Boolean,
2448
- default: false
2449
- },
2450
- flat: {
2451
- type: Boolean,
2452
- default: false
2453
- },
2454
- instanceId: {
2455
- default: function _default() {
2456
- return "".concat(instanceId++, "$$");
2457
- },
2458
- type: [String, Number]
2459
- },
2460
- joinValues: {
2461
- type: Boolean,
2462
- default: false
2463
- },
2464
- limit: {
2465
- type: Number,
2466
- default: Infinity
2467
- },
2468
- limitText: {
2469
- type: Function,
2470
- default: function limitTextDefault(count) {
2471
- return "and ".concat(count, " more");
2472
- }
2473
- },
2474
- loadingText: {
2475
- type: String,
2476
- default: 'Loading...'
2477
- },
2478
- loadOptions: {
2479
- type: Function
2480
- },
2481
- matchKeys: {
2482
- type: Array,
2483
- default: constant_default()(['label'])
2484
- },
2485
- maxHeight: {
2486
- type: Number,
2487
- default: 300
2488
- },
2489
- multiple: {
2490
- type: Boolean,
2491
- default: false
2492
- },
2493
- name: {
2494
- type: String
2495
- },
2496
- noChildrenText: {
2497
- type: String,
2498
- default: 'No sub-options.'
2499
- },
2500
- noOptionsText: {
2501
- type: String,
2502
- default: 'No options available.'
2503
- },
2504
- noResultsText: {
2505
- type: String,
2506
- default: 'No results found...'
2507
- },
2508
- normalizer: {
2509
- type: Function,
2510
- default: identity_default.a
2511
- },
2512
- openDirection: {
2513
- type: String,
2514
- default: 'auto',
2515
- validator: function validator(value) {
2516
- var acceptableValues = ['auto', 'top', 'bottom', 'above', 'below'];
2517
- return includes(acceptableValues, value);
2518
- }
2519
- },
2520
- openOnClick: {
2521
- type: Boolean,
2522
- default: true
2523
- },
2524
- openOnFocus: {
2525
- type: Boolean,
2526
- default: false
2527
- },
2528
- options: {
2529
- type: Array
2530
- },
2531
- placeholder: {
2532
- type: String,
2533
- default: 'Select...'
2534
- },
2535
- required: {
2536
- type: Boolean,
2537
- default: false
2538
- },
2539
- retryText: {
2540
- type: String,
2541
- default: 'Retry?'
2542
- },
2543
- retryTitle: {
2544
- type: String,
2545
- default: 'Click to retry'
2546
- },
2547
- searchable: {
2548
- type: Boolean,
2549
- default: true
2550
- },
2551
- searchNested: {
2552
- type: Boolean,
2553
- default: false
2554
- },
2555
- searchPromptText: {
2556
- type: String,
2557
- default: 'Type to search...'
2558
- },
2559
- showCount: {
2560
- type: Boolean,
2561
- default: false
2562
- },
2563
- showCountOf: {
2564
- type: String,
2565
- default: ALL_CHILDREN,
2566
- validator: function validator(value) {
2567
- var acceptableValues = [ALL_CHILDREN, ALL_DESCENDANTS, LEAF_CHILDREN, LEAF_DESCENDANTS];
2568
- return includes(acceptableValues, value);
2569
- }
2570
- },
2571
- showCountOnSearch: null,
2572
- sortValueBy: {
2573
- type: String,
2574
- default: ORDER_SELECTED,
2575
- validator: function validator(value) {
2576
- var acceptableValues = [ORDER_SELECTED, LEVEL, INDEX];
2577
- return includes(acceptableValues, value);
2578
- }
2579
- },
2580
- tabIndex: {
2581
- type: Number,
2582
- default: 0
2583
- },
2584
- value: null,
2585
- valueConsistsOf: {
2586
- type: String,
2587
- default: BRANCH_PRIORITY,
2588
- validator: function validator(value) {
2589
- var acceptableValues = [ALL, BRANCH_PRIORITY, LEAF_PRIORITY, ALL_WITH_INDETERMINATE];
2590
- return includes(acceptableValues, value);
2591
- }
2592
- },
2593
- valueFormat: {
2594
- type: String,
2595
- default: 'id'
2596
- },
2597
- zIndex: {
2598
- type: [Number, String],
2599
- default: 999
2600
- }
2601
- },
2602
- data: function data() {
2603
- return {
2604
- trigger: {
2605
- isFocused: false,
2606
- searchQuery: ''
2607
- },
2608
- menu: {
2609
- isOpen: false,
2610
- current: null,
2611
- lastScrollPosition: 0,
2612
- placement: 'bottom'
2613
- },
2614
- forest: {
2615
- normalizedOptions: [],
2616
- nodeMap: createMap(),
2617
- checkedStateMap: createMap(),
2618
- selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
2619
- selectedNodeMap: createMap()
2620
- },
2621
- rootOptionsStates: createAsyncOptionsStates(),
2622
- localSearch: {
2623
- active: false,
2624
- noResults: true,
2625
- countMap: createMap()
2626
- },
2627
- remoteSearch: createMap()
2628
- };
2629
- },
2630
- computed: {
2631
- selectedNodes: function selectedNodes() {
2632
- return this.forest.selectedNodeIds.map(this.getNode);
2633
- },
2634
- internalValue: function internalValue() {
2635
- var _this = this;
2636
- var internalValue;
2637
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
2638
- internalValue = this.forest.selectedNodeIds.slice();
2639
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
2640
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
2641
- var node = _this.getNode(id);
2642
- if (node.isRootNode) return true;
2643
- return !_this.isSelected(node.parentNode);
2644
- });
2645
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
2646
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
2647
- var node = _this.getNode(id);
2648
- if (node.isLeaf) return true;
2649
- return node.children.length === 0;
2650
- });
2651
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
2652
- var _internalValue;
2653
- var indeterminateNodeIds = [];
2654
- internalValue = this.forest.selectedNodeIds.slice();
2655
- this.selectedNodes.forEach(function (selectedNode) {
2656
- selectedNode.ancestors.forEach(function (ancestor) {
2657
- if (includes(indeterminateNodeIds, ancestor.id)) return;
2658
- if (includes(internalValue, ancestor.id)) return;
2659
- indeterminateNodeIds.push(ancestor.id);
2660
- });
2661
- });
2662
- (_internalValue = internalValue).push.apply(_internalValue, indeterminateNodeIds);
2663
- }
2664
- if (this.sortValueBy === LEVEL) {
2665
- internalValue.sort(function (a, b) {
2666
- return sortValueByLevel(_this.getNode(a), _this.getNode(b));
2667
- });
2668
- } else if (this.sortValueBy === INDEX) {
2669
- internalValue.sort(function (a, b) {
2670
- return sortValueByIndex(_this.getNode(a), _this.getNode(b));
2671
- });
2672
- }
2673
- return internalValue;
2674
- },
2675
- hasValue: function hasValue() {
2676
- return this.internalValue.length > 0;
2677
- },
2678
- single: function single() {
2679
- return !this.multiple;
2680
- },
2681
- visibleOptionIds: function visibleOptionIds() {
2682
- var _this2 = this;
2683
- var visibleOptionIds = [];
2684
- this.traverseAllNodesByIndex(function (node) {
2685
- if (!_this2.localSearch.active || _this2.shouldOptionBeIncludedInSearchResult(node)) {
2686
- visibleOptionIds.push(node.id);
2687
- }
2688
- if (node.isBranch && !_this2.shouldExpand(node)) {
2689
- return false;
2690
- }
2691
- });
2692
- return visibleOptionIds;
2693
- },
2694
- hasVisibleOptions: function hasVisibleOptions() {
2695
- return this.visibleOptionIds.length !== 0;
2696
- },
2697
- showCountOnSearchComputed: function showCountOnSearchComputed() {
2698
- return typeof this.showCountOnSearch === 'boolean' ? this.showCountOnSearch : this.showCount;
2699
- },
2700
- hasBranchNodes: function hasBranchNodes() {
2701
- return this.forest.normalizedOptions.some(function (rootNode) {
2702
- return rootNode.isBranch;
2703
- });
2704
- },
2705
- shouldFlattenOptions: function shouldFlattenOptions() {
2706
- return this.localSearch.active && this.flattenSearchResults;
2707
- },
2708
- wrapperClass: function wrapperClass() {
2709
- return {
2710
- 'rp-treeselect': true,
2711
- 'rp-treeselect--single': this.single,
2712
- 'rp-treeselect--multi': this.multiple,
2713
- 'rp-treeselect--searchable': this.searchable,
2714
- 'rp-treeselect--disabled': this.disabled,
2715
- 'rp-treeselect--focused': this.trigger.isFocused,
2716
- 'rp-treeselect--has-value': this.hasValue,
2717
- 'rp-treeselect--open': this.menu.isOpen,
2718
- 'rp-treeselect--open-above': this.menu.placement === 'top',
2719
- 'rp-treeselect--open-below': this.menu.placement === 'bottom',
2720
- 'rp-treeselect--branch-nodes-disabled': this.disableBranchNodes,
2721
- 'rp-treeselect--append-to-body': this.appendToBody,
2722
- 'rp-treeselect--test': true
2723
- };
2724
- }
2725
- },
2726
- watch: {
2727
- alwaysOpen: function alwaysOpen(newValue) {
2728
- if (newValue) this.openMenu();else this.closeMenu();
2729
- },
2730
- branchNodesFirst: function branchNodesFirst() {
2731
- this.initialize();
2732
- },
2733
- disabled: function disabled(newValue) {
2734
- if (newValue && this.menu.isOpen) this.closeMenu();else if (!newValue && !this.menu.isOpen && this.alwaysOpen) this.openMenu();
2735
- },
2736
- flat: function flat() {
2737
- this.initialize();
2738
- },
2739
- internalValue: function internalValue(newValue, oldValue) {
2740
- var hasChanged = quickDiff(newValue, oldValue);
2741
- if (hasChanged) this.$emit('input', this.getValue(), this.getInstanceId());
2742
- },
2743
- matchKeys: function matchKeys() {
2744
- this.initialize();
2745
- },
2746
- multiple: function multiple(newValue) {
2747
- if (newValue) this.buildForestState();
2748
- },
2749
- options: {
2750
- handler: function handler() {
2751
- if (this.async) return;
2752
- this.initialize();
2753
- this.rootOptionsStates.isLoaded = Array.isArray(this.options);
2754
- },
2755
- deep: true,
2756
- immediate: true
2757
- },
2758
- 'trigger.searchQuery': function triggerSearchQuery() {
2759
- if (this.async) {
2760
- this.handleRemoteSearch();
2761
- } else {
2762
- this.handleLocalSearch();
2763
- }
2764
- this.$emit('search-change', this.trigger.searchQuery, this.getInstanceId());
2765
- },
2766
- value: function value() {
2767
- var nodeIdsFromValue = this.extractCheckedNodeIdsFromValue();
2768
- var hasChanged = quickDiff(nodeIdsFromValue, this.internalValue);
2769
- if (hasChanged) this.fixSelectedNodeIds(nodeIdsFromValue);
2770
- }
2771
- },
2772
- created: function created() {
2773
- this.verifyProps();
2774
- this.resetFlags();
2775
- Object(external_vue_["provide"])('instance', this);
2776
- },
2777
- mounted: function mounted() {
2778
- console.log('TREESELECT');
2779
- if (this.autoFocus) this.focusInput();
2780
- if (!this.options && !this.async && this.autoLoadRootOptions) this.loadRootOptions();
2781
- if (this.alwaysOpen) this.openMenu();
2782
- if (this.async && this.defaultOptions) this.handleRemoteSearch();
2783
- },
2784
- destroyed: function destroyed() {
2785
- this.toggleClickOutsideEvent(false);
2786
- },
2787
- methods: {
2788
- verifyProps: function verifyProps() {
2789
- var _this3 = this;
2790
- warning_warning(function () {
2791
- return _this3.async ? _this3.searchable : true;
2792
- }, function () {
2793
- return 'For async search mode, the value of "searchable" prop must be true.';
2794
- });
2795
- if (this.options == null && !this.loadOptions) {
2796
- warning_warning(function () {
2797
- return false;
2798
- }, function () {
2799
- return 'Are you meant to dynamically load options? You need to use "loadOptions" prop.';
2800
- });
2801
- }
2802
- if (this.flat) {
2803
- warning_warning(function () {
2804
- return _this3.multiple;
2805
- }, function () {
2806
- return 'You are using flat mode. But you forgot to add "multiple=true"?';
2807
- });
2808
- }
2809
- if (!this.flat) {
2810
- var propNames = ['autoSelectAncestors', 'autoSelectDescendants', 'autoDeselectAncestors', 'autoDeselectDescendants'];
2811
- propNames.forEach(function (propName) {
2812
- warning_warning(function () {
2813
- return !_this3[propName];
2814
- }, function () {
2815
- return "\"".concat(propName, "\" only applies to flat mode.");
2816
- });
2817
- });
2818
- }
2819
- },
2820
- resetFlags: function resetFlags() {
2821
- this._blurOnSelect = false;
2822
- },
2823
- initialize: function initialize() {
2824
- var options = this.async ? this.getRemoteSearchEntry().options : this.options;
2825
- if (Array.isArray(options)) {
2826
- var prevNodeMap = this.forest.nodeMap;
2827
- this.forest.nodeMap = createMap();
2828
- this.keepDataOfSelectedNodes(prevNodeMap);
2829
- this.forest.normalizedOptions = this.normalize(NO_PARENT_NODE, options, prevNodeMap);
2830
- this.fixSelectedNodeIds(this.internalValue);
2831
- } else {
2832
- this.forest.normalizedOptions = [];
2833
- }
2834
- },
2835
- getInstanceId: function getInstanceId() {
2836
- return this.instanceId == null ? this.id : this.instanceId;
2837
- },
2838
- getValue: function getValue() {
2839
- var _this4 = this;
2840
- if (this.valueFormat === 'id') {
2841
- return this.multiple ? this.internalValue.slice() : this.internalValue[0];
2842
- }
2843
- var rawNodes = this.internalValue.map(function (id) {
2844
- return _this4.getNode(id).raw;
2845
- });
2846
- return this.multiple ? rawNodes : rawNodes[0];
2847
- },
2848
- getNode: function getNode(nodeId) {
2849
- warning_warning(function () {
2850
- return nodeId != null;
2851
- }, function () {
2852
- return "Invalid node id: ".concat(nodeId);
2853
- });
2854
- if (nodeId == null) return null;
2855
- return nodeId in this.forest.nodeMap ? this.forest.nodeMap[nodeId] : this.createFallbackNode(nodeId);
2856
- },
2857
- createFallbackNode: function createFallbackNode(id) {
2858
- var raw = this.extractNodeFromValue(id);
2859
- var label = this.enhancedNormalizer(raw).label || "".concat(id, " (unknown)");
2860
- var fallbackNode = {
2861
- id: id,
2862
- label: label,
2863
- ancestors: [],
2864
- parentNode: NO_PARENT_NODE,
2865
- isFallbackNode: true,
2866
- isRootNode: true,
2867
- isLeaf: true,
2868
- isBranch: false,
2869
- isDisabled: false,
2870
- isNew: false,
2871
- index: [-1],
2872
- level: 0,
2873
- raw: raw
2874
- };
2875
- return this.$set(this.forest.nodeMap, id, fallbackNode);
2876
- },
2877
- extractCheckedNodeIdsFromValue: function extractCheckedNodeIdsFromValue() {
2878
- var _this5 = this;
2879
- if (this.value == null) return [];
2880
- if (this.valueFormat === 'id') {
2881
- return this.multiple ? this.value.slice() : [this.value];
2882
- }
2883
- return (this.multiple ? this.value : [this.value]).map(function (node) {
2884
- return _this5.enhancedNormalizer(node);
2885
- }).map(function (node) {
2886
- return node.id;
2887
- });
2888
- },
2889
- extractNodeFromValue: function extractNodeFromValue(id) {
2890
- var _this6 = this;
2891
- var defaultNode = {
2892
- id: id
2893
- };
2894
- if (this.valueFormat === 'id') {
2895
- return defaultNode;
2896
- }
2897
- var valueArray = this.multiple ? Array.isArray(this.value) ? this.value : [] : this.value ? [this.value] : [];
2898
- var matched = find(valueArray, function (node) {
2899
- return node && _this6.enhancedNormalizer(node).id === id;
2900
- });
2901
- return matched || defaultNode;
2902
- },
2903
- fixSelectedNodeIds: function fixSelectedNodeIds(nodeIdListOfPrevValue) {
2904
- var _this7 = this;
2905
- var nextSelectedNodeIds = [];
2906
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
2907
- nextSelectedNodeIds = nodeIdListOfPrevValue;
2908
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
2909
- nodeIdListOfPrevValue.forEach(function (nodeId) {
2910
- nextSelectedNodeIds.push(nodeId);
2911
- var node = _this7.getNode(nodeId);
2912
- if (node.isBranch) _this7.traverseDescendantsBFS(node, function (descendant) {
2913
- nextSelectedNodeIds.push(descendant.id);
2914
- });
2915
- });
2916
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
2917
- var map = createMap();
2918
- var queue = nodeIdListOfPrevValue.slice();
2919
- while (queue.length) {
2920
- var nodeId = queue.shift();
2921
- var node = this.getNode(nodeId);
2922
- nextSelectedNodeIds.push(nodeId);
2923
- if (node.isRootNode) continue;
2924
- if (!(node.parentNode.id in map)) map[node.parentNode.id] = node.parentNode.children.length;
2925
- if (--map[node.parentNode.id] === 0) queue.push(node.parentNode.id);
2926
- }
2927
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
2928
- var _map = createMap();
2929
- var _queue = nodeIdListOfPrevValue.filter(function (nodeId) {
2930
- var node = _this7.getNode(nodeId);
2931
- return node.isLeaf || node.children.length === 0;
2932
- });
2933
- while (_queue.length) {
2934
- var _nodeId = _queue.shift();
2935
- var _node = this.getNode(_nodeId);
2936
- nextSelectedNodeIds.push(_nodeId);
2937
- if (_node.isRootNode) continue;
2938
- if (!(_node.parentNode.id in _map)) _map[_node.parentNode.id] = _node.parentNode.children.length;
2939
- if (--_map[_node.parentNode.id] === 0) _queue.push(_node.parentNode.id);
2940
- }
2941
- }
2942
- var hasChanged = quickDiff(this.forest.selectedNodeIds, nextSelectedNodeIds);
2943
- if (hasChanged) this.forest.selectedNodeIds = nextSelectedNodeIds;
2944
- this.buildForestState();
2945
- },
2946
- keepDataOfSelectedNodes: function keepDataOfSelectedNodes(prevNodeMap) {
2947
- var _this8 = this;
2948
- this.forest.selectedNodeIds.forEach(function (id) {
2949
- if (!prevNodeMap[id]) return;
2950
- var node = Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, prevNodeMap[id]), {}, {
2951
- isFallbackNode: true
2952
- });
2953
- _this8.$set(_this8.forest.nodeMap, id, node);
2954
- });
2955
- },
2956
- isSelected: function isSelected(node) {
2957
- return this.forest.selectedNodeMap[node.id] === true;
2958
- },
2959
- traverseDescendantsBFS: function traverseDescendantsBFS(parentNode, callback) {
2960
- if (!parentNode.isBranch) return;
2961
- var queue = parentNode.children.slice();
2962
- while (queue.length) {
2963
- var currNode = queue[0];
2964
- if (currNode.isBranch) queue.push.apply(queue, toConsumableArray_default()(currNode.children));
2965
- callback(currNode);
2966
- queue.shift();
2967
- }
2968
- },
2969
- traverseDescendantsDFS: function traverseDescendantsDFS(parentNode, callback) {
2970
- var _this9 = this;
2971
- if (!parentNode.isBranch) return;
2972
- parentNode.children.forEach(function (child) {
2973
- _this9.traverseDescendantsDFS(child, callback);
2974
- callback(child);
2975
- });
2976
- },
2977
- traverseAllNodesDFS: function traverseAllNodesDFS(callback) {
2978
- var _this10 = this;
2979
- this.forest.normalizedOptions.forEach(function (rootNode) {
2980
- _this10.traverseDescendantsDFS(rootNode, callback);
2981
- callback(rootNode);
2982
- });
2983
- },
2984
- traverseAllNodesByIndex: function traverseAllNodesByIndex(callback) {
2985
- var walk = function walk(parentNode) {
2986
- parentNode.children.forEach(function (child) {
2987
- if (callback(child) !== false && child.isBranch) {
2988
- walk(child);
2989
- }
2990
- });
2991
- };
2992
- walk({
2993
- children: this.forest.normalizedOptions
2994
- });
2995
- },
2996
- toggleClickOutsideEvent: function toggleClickOutsideEvent(enabled) {
2997
- if (enabled) {
2998
- document.addEventListener('mousedown', this.handleClickOutside, false);
2999
- } else {
3000
- document.removeEventListener('mousedown', this.handleClickOutside, false);
3001
- }
3002
- },
3003
- getValueContainer: function getValueContainer() {
3004
- return this.$refs.control.$refs['value-container'];
3005
- },
3006
- getInput: function getInput() {
3007
- return this.getValueContainer().$refs.input;
3008
- },
3009
- focusInput: function focusInput() {
3010
- this.getInput().focus();
3011
- },
3012
- blurInput: function blurInput() {
3013
- this.getInput().blur();
3014
- },
3015
- handleMouseDown: onLeftClick(function handleMouseDown(evt) {
3016
- evt.preventDefault();
3017
- evt.stopPropagation();
3018
- if (this.disabled) return;
3019
- var isClickedOnValueContainer = this.getValueContainer().$el.contains(evt.target);
3020
- if (isClickedOnValueContainer && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused)) {
3021
- this.openMenu();
3022
- }
3023
- if (this._blurOnSelect) {
3024
- this.blurInput();
3025
- } else {
3026
- this.focusInput();
3027
- }
3028
- this.resetFlags();
3029
- }),
3030
- handleClickOutside: function handleClickOutside(evt) {
3031
- if (this.$refs.wrapper && !this.$refs.wrapper.contains(evt.target)) {
3032
- this.blurInput();
3033
- this.closeMenu();
3034
- }
3035
- },
3036
- handleLocalSearch: function handleLocalSearch() {
3037
- var _this11 = this;
3038
- var searchQuery = this.trigger.searchQuery;
3039
- var done = function done() {
3040
- return _this11.resetHighlightedOptionWhenNecessary(true);
3041
- };
3042
- if (!searchQuery) {
3043
- this.localSearch.active = false;
3044
- return done();
3045
- }
3046
- this.localSearch.active = true;
3047
- this.localSearch.noResults = true;
3048
- this.traverseAllNodesDFS(function (node) {
3049
- if (node.isBranch) {
3050
- node.isExpandedOnSearch = false;
3051
- node.showAllChildrenOnSearch = false;
3052
- node.isMatched = false;
3053
- node.hasMatchedDescendants = false;
3054
- _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));
3055
- }
3056
- });
3057
- var lowerCasedSearchQuery = searchQuery.trim().toLocaleLowerCase();
3058
- var splitSearchQuery = lowerCasedSearchQuery.replace(/\s+/g, ' ').split(' ');
3059
- this.traverseAllNodesDFS(function (node) {
3060
- if (_this11.searchNested && splitSearchQuery.length > 1) {
3061
- node.isMatched = splitSearchQuery.every(function (filterValue) {
3062
- return match(false, filterValue, node.nestedSearchLabel);
3063
- });
3064
- } else {
3065
- node.isMatched = _this11.matchKeys.some(function (matchKey) {
3066
- return match(!_this11.disableFuzzyMatching, lowerCasedSearchQuery, node.lowerCased[matchKey]);
3067
- });
3068
- }
3069
- if (node.isMatched) {
3070
- _this11.localSearch.noResults = false;
3071
- node.ancestors.forEach(function (ancestor) {
3072
- return _this11.localSearch.countMap[ancestor.id][ALL_DESCENDANTS]++;
3073
- });
3074
- if (node.isLeaf) node.ancestors.forEach(function (ancestor) {
3075
- return _this11.localSearch.countMap[ancestor.id][LEAF_DESCENDANTS]++;
3076
- });
3077
- if (node.parentNode !== NO_PARENT_NODE) {
3078
- _this11.localSearch.countMap[node.parentNode.id][ALL_CHILDREN] += 1;
3079
- if (node.isLeaf) _this11.localSearch.countMap[node.parentNode.id][LEAF_CHILDREN] += 1;
3080
- }
3081
- }
3082
- if ((node.isMatched || node.isBranch && node.isExpandedOnSearch) && node.parentNode !== NO_PARENT_NODE) {
3083
- node.parentNode.isExpandedOnSearch = true;
3084
- node.parentNode.hasMatchedDescendants = true;
3085
- }
3086
- });
3087
- done();
3088
- },
3089
- handleRemoteSearch: function handleRemoteSearch() {
3090
- var _this12 = this;
3091
- var searchQuery = this.trigger.searchQuery;
3092
- var entry = this.getRemoteSearchEntry();
3093
- var done = function done() {
3094
- _this12.initialize();
3095
- _this12.resetHighlightedOptionWhenNecessary(true);
3096
- };
3097
- if ((searchQuery === '' || this.cacheOptions) && entry.isLoaded) {
3098
- return done();
3099
- }
3100
- this.callLoadOptionsProp({
3101
- action: ASYNC_SEARCH,
3102
- args: {
3103
- searchQuery: searchQuery
3104
- },
3105
- isPending: function isPending() {
3106
- return entry.isLoading;
3107
- },
3108
- start: function start() {
3109
- entry.isLoading = true;
3110
- entry.isLoaded = false;
3111
- entry.loadingError = '';
3112
- },
3113
- succeed: function succeed(options) {
3114
- entry.isLoaded = true;
3115
- entry.options = options;
3116
- if (_this12.trigger.searchQuery === searchQuery) done();
3117
- },
3118
- fail: function fail(err) {
3119
- entry.loadingError = getErrorMessage(err);
3120
- },
3121
- end: function end() {
3122
- entry.isLoading = false;
3123
- }
3124
- });
3125
- },
3126
- getRemoteSearchEntry: function getRemoteSearchEntry() {
3127
- var _this13 = this;
3128
- var searchQuery = this.trigger.searchQuery;
3129
- var entry = this.remoteSearch[searchQuery] || Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, createAsyncOptionsStates()), {}, {
3130
- options: []
3131
- });
3132
- this.$watch(function () {
3133
- return entry.options;
3134
- }, function () {
3135
- if (_this13.trigger.searchQuery === searchQuery) _this13.initialize();
3136
- }, {
3137
- deep: true
3138
- });
3139
- if (searchQuery === '') {
3140
- if (Array.isArray(this.defaultOptions)) {
3141
- entry.options = this.defaultOptions;
3142
- entry.isLoaded = true;
3143
- return entry;
3144
- } else if (this.defaultOptions !== true) {
3145
- entry.isLoaded = true;
3146
- return entry;
3147
- }
3148
- }
3149
- if (!this.remoteSearch[searchQuery]) {
3150
- this.$set(this.remoteSearch, searchQuery, entry);
3151
- }
3152
- return entry;
3153
- },
3154
- shouldExpand: function shouldExpand(node) {
3155
- return this.localSearch.active ? node.isExpandedOnSearch : node.isExpanded;
3156
- },
3157
- shouldOptionBeIncludedInSearchResult: function shouldOptionBeIncludedInSearchResult(node) {
3158
- if (node.isMatched) return true;
3159
- if (node.isBranch && node.hasMatchedDescendants && !this.flattenSearchResults) return true;
3160
- if (!node.isRootNode && node.parentNode.showAllChildrenOnSearch) return true;
3161
- return false;
3162
- },
3163
- shouldShowOptionInMenu: function shouldShowOptionInMenu(node) {
3164
- if (this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(node)) {
3165
- return false;
3166
- }
3167
- return true;
3168
- },
3169
- getControl: function getControl() {
3170
- return this.$refs.control.$el;
3171
- },
3172
- getMenu: function getMenu() {
3173
- var ref = this.appendToBody ? this.$refs.portal.portalTarget : this;
3174
- var $menu = ref.$refs.menu.$refs.menu;
3175
- return $menu && $menu.nodeName !== '#comment' ? $menu : null;
3176
- },
3177
- setCurrentHighlightedOption: function setCurrentHighlightedOption(node) {
3178
- var _this14 = this;
3179
- var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
3180
- var prev = this.menu.current;
3181
- if (prev != null && prev in this.forest.nodeMap) {
3182
- this.forest.nodeMap[prev].isHighlighted = false;
3183
- }
3184
- this.menu.current = node.id;
3185
- node.isHighlighted = true;
3186
- if (this.menu.isOpen && scroll) {
3187
- var scrollToOption = function scrollToOption() {
3188
- var $menu = _this14.getMenu();
3189
- var $option = $menu.querySelector(".rp-treeselect__option[data-id=\"".concat(node.id, "\"]"));
3190
- if ($option) scrollIntoView($menu, $option);
3191
- };
3192
- if (this.getMenu()) {
3193
- scrollToOption();
3194
- } else {
3195
- this.$nextTick(scrollToOption);
3196
- }
3197
- }
3198
- },
3199
- resetHighlightedOptionWhenNecessary: function resetHighlightedOptionWhenNecessary() {
3200
- var forceReset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3201
- var current = this.menu.current;
3202
- if (forceReset || current == null || !(current in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(current))) {
3203
- this.highlightFirstOption();
3204
- }
3205
- },
3206
- highlightFirstOption: function highlightFirstOption() {
3207
- if (!this.hasVisibleOptions) return;
3208
- var first = this.visibleOptionIds[0];
3209
- this.setCurrentHighlightedOption(this.getNode(first));
3210
- },
3211
- highlightPrevOption: function highlightPrevOption() {
3212
- if (!this.hasVisibleOptions) return;
3213
- var prev = this.visibleOptionIds.indexOf(this.menu.current) - 1;
3214
- if (prev === -1) return this.highlightLastOption();
3215
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[prev]));
3216
- },
3217
- highlightNextOption: function highlightNextOption() {
3218
- if (!this.hasVisibleOptions) return;
3219
- var next = this.visibleOptionIds.indexOf(this.menu.current) + 1;
3220
- if (next === this.visibleOptionIds.length) return this.highlightFirstOption();
3221
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[next]));
3222
- },
3223
- highlightLastOption: function highlightLastOption() {
3224
- if (!this.hasVisibleOptions) return;
3225
- var last = last_default()(this.visibleOptionIds);
3226
- this.setCurrentHighlightedOption(this.getNode(last));
3227
- },
3228
- resetSearchQuery: function resetSearchQuery() {
3229
- this.trigger.searchQuery = '';
3230
- },
3231
- closeMenu: function closeMenu() {
3232
- if (!this.menu.isOpen || !this.disabled && this.alwaysOpen) return;
3233
- this.saveMenuScrollPosition();
3234
- this.menu.isOpen = false;
3235
- this.toggleClickOutsideEvent(false);
3236
- this.resetSearchQuery();
3237
- this.$emit('close', this.getValue(), this.getInstanceId());
3238
- },
3239
- openMenu: function openMenu() {
3240
- if (this.disabled || this.menu.isOpen) return;
3241
- this.menu.isOpen = true;
3242
- this.$nextTick(this.resetHighlightedOptionWhenNecessary);
3243
- this.$nextTick(this.restoreMenuScrollPosition);
3244
- if (!this.options && !this.async) this.loadRootOptions();
3245
- this.toggleClickOutsideEvent(true);
3246
- this.$emit('open', this.getInstanceId());
3247
- },
3248
- toggleMenu: function toggleMenu() {
3249
- if (this.menu.isOpen) {
3250
- this.closeMenu();
3251
- } else {
3252
- this.openMenu();
3253
- }
3254
- },
3255
- toggleExpanded: function toggleExpanded(node) {
3256
- var nextState;
3257
- if (this.localSearch.active) {
3258
- nextState = node.isExpandedOnSearch = !node.isExpandedOnSearch;
3259
- if (nextState) node.showAllChildrenOnSearch = true;
3260
- } else {
3261
- nextState = node.isExpanded = !node.isExpanded;
3262
- }
3263
- if (nextState && !node.childrenStates.isLoaded) {
3264
- this.loadChildrenOptions(node);
3265
- }
3266
- },
3267
- buildForestState: function buildForestState() {
3268
- var _this15 = this;
3269
- var selectedNodeMap = createMap();
3270
- this.forest.selectedNodeIds.forEach(function (selectedNodeId) {
3271
- selectedNodeMap[selectedNodeId] = true;
3272
- });
3273
- this.forest.selectedNodeMap = selectedNodeMap;
3274
- var checkedStateMap = createMap();
3275
- if (this.multiple) {
3276
- this.traverseAllNodesByIndex(function (node) {
3277
- checkedStateMap[node.id] = UNCHECKED;
3278
- });
3279
- this.selectedNodes.forEach(function (selectedNode) {
3280
- checkedStateMap[selectedNode.id] = CHECKED;
3281
- if (!_this15.flat && !_this15.disableBranchNodes) {
3282
- selectedNode.ancestors.forEach(function (ancestorNode) {
3283
- if (!_this15.isSelected(ancestorNode)) {
3284
- checkedStateMap[ancestorNode.id] = INDETERMINATE;
3285
- }
3286
- });
3287
- }
3288
- });
3289
- }
3290
- this.forest.checkedStateMap = checkedStateMap;
3291
- },
3292
- enhancedNormalizer: function enhancedNormalizer(raw) {
3293
- return Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, raw), this.normalizer(raw, this.getInstanceId()));
3294
- },
3295
- normalize: function normalize(parentNode, nodes, prevNodeMap) {
3296
- var _this16 = this;
3297
- var normalizedOptions = nodes.map(function (node) {
3298
- return [_this16.enhancedNormalizer(node), node];
3299
- }).map(function (_ref, index) {
3300
- var _ref2 = slicedToArray_default()(_ref, 2),
3301
- node = _ref2[0],
3302
- raw = _ref2[1];
3303
- _this16.checkDuplication(node);
3304
- _this16.verifyNodeShape(node);
3305
- var id = node.id,
3306
- label = node.label,
3307
- children = node.children,
3308
- isDefaultExpanded = node.isDefaultExpanded;
3309
- var isRootNode = parentNode === NO_PARENT_NODE;
3310
- var level = isRootNode ? 0 : parentNode.level + 1;
3311
- var isBranch = Array.isArray(children) || children === null;
3312
- var isLeaf = !isBranch;
3313
- var isDisabled = !!node.isDisabled || !_this16.flat && !isRootNode && parentNode.isDisabled;
3314
- var isNew = !!node.isNew;
3315
- var lowerCased = _this16.matchKeys.reduce(function (prev, key) {
3316
- return Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, prev), {}, defineProperty_default()({}, key, stringifyOptionPropValue(node[key]).toLocaleLowerCase()));
3317
- }, {});
3318
- var nestedSearchLabel = isRootNode ? lowerCased.label : parentNode.nestedSearchLabel + ' ' + lowerCased.label;
3319
- var normalized = _this16.$set(_this16.forest.nodeMap, id, createMap());
3320
- _this16.$set(normalized, 'id', id);
3321
- _this16.$set(normalized, 'label', label);
3322
- _this16.$set(normalized, 'level', level);
3323
- _this16.$set(normalized, 'ancestors', isRootNode ? [] : [parentNode].concat(parentNode.ancestors));
3324
- _this16.$set(normalized, 'index', (isRootNode ? [] : parentNode.index).concat(index));
3325
- _this16.$set(normalized, 'parentNode', parentNode);
3326
- _this16.$set(normalized, 'lowerCased', lowerCased);
3327
- _this16.$set(normalized, 'nestedSearchLabel', nestedSearchLabel);
3328
- _this16.$set(normalized, 'isDisabled', isDisabled);
3329
- _this16.$set(normalized, 'isNew', isNew);
3330
- _this16.$set(normalized, 'isMatched', false);
3331
- _this16.$set(normalized, 'isHighlighted', false);
3332
- _this16.$set(normalized, 'isBranch', isBranch);
3333
- _this16.$set(normalized, 'isLeaf', isLeaf);
3334
- _this16.$set(normalized, 'isRootNode', isRootNode);
3335
- _this16.$set(normalized, 'raw', raw);
3336
- if (isBranch) {
3337
- var isLoaded = Array.isArray(children);
3338
- _this16.$set(normalized, 'childrenStates', Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({}, createAsyncOptionsStates()), {}, {
3339
- isLoaded: isLoaded
3340
- }));
3341
- _this16.$set(normalized, 'isExpanded', typeof isDefaultExpanded === 'boolean' ? isDefaultExpanded : level < _this16.defaultExpandLevel);
3342
- _this16.$set(normalized, 'hasMatchedDescendants', false);
3343
- _this16.$set(normalized, 'hasDisabledDescendants', false);
3344
- _this16.$set(normalized, 'isExpandedOnSearch', false);
3345
- _this16.$set(normalized, 'showAllChildrenOnSearch', false);
3346
- _this16.$set(normalized, 'count', defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, ALL_CHILDREN, 0), ALL_DESCENDANTS, 0), LEAF_CHILDREN, 0), LEAF_DESCENDANTS, 0));
3347
- _this16.$set(normalized, 'children', isLoaded ? _this16.normalize(normalized, children, prevNodeMap) : []);
3348
- if (isDefaultExpanded === true) normalized.ancestors.forEach(function (ancestor) {
3349
- ancestor.isExpanded = true;
3350
- });
3351
- if (!isLoaded && typeof _this16.loadOptions !== 'function') {
3352
- warning_warning(function () {
3353
- return false;
3354
- }, function () {
3355
- return 'Unloaded branch node detected. "loadOptions" prop is required to load its children.';
3356
- });
3357
- } else if (!isLoaded && normalized.isExpanded) {
3358
- _this16.loadChildrenOptions(normalized);
3359
- }
3360
- }
3361
- normalized.ancestors.forEach(function (ancestor) {
3362
- return ancestor.count[ALL_DESCENDANTS]++;
3363
- });
3364
- if (isLeaf) normalized.ancestors.forEach(function (ancestor) {
3365
- return ancestor.count[LEAF_DESCENDANTS]++;
3366
- });
3367
- if (!isRootNode) {
3368
- parentNode.count[ALL_CHILDREN] += 1;
3369
- if (isLeaf) parentNode.count[LEAF_CHILDREN] += 1;
3370
- if (isDisabled) parentNode.hasDisabledDescendants = true;
3371
- }
3372
- if (prevNodeMap && prevNodeMap[id]) {
3373
- var prev = prevNodeMap[id];
3374
- normalized.isMatched = prev.isMatched;
3375
- normalized.showAllChildrenOnSearch = prev.showAllChildrenOnSearch;
3376
- normalized.isHighlighted = prev.isHighlighted;
3377
- if (prev.isBranch && normalized.isBranch) {
3378
- normalized.isExpanded = prev.isExpanded;
3379
- normalized.isExpandedOnSearch = prev.isExpandedOnSearch;
3380
- if (prev.childrenStates.isLoaded && !normalized.childrenStates.isLoaded) {
3381
- normalized.isExpanded = false;
3382
- } else {
3383
- normalized.childrenStates = Treeselectvue_type_script_lang_js_objectSpread({}, prev.childrenStates);
3384
- }
3385
- }
3386
- }
3387
- return normalized;
3388
- });
3389
- if (this.branchNodesFirst) {
3390
- var branchNodes = normalizedOptions.filter(function (option) {
3391
- return option.isBranch;
3392
- });
3393
- var leafNodes = normalizedOptions.filter(function (option) {
3394
- return option.isLeaf;
3395
- });
3396
- normalizedOptions = branchNodes.concat(leafNodes);
3397
- }
3398
- return normalizedOptions;
3399
- },
3400
- loadRootOptions: function loadRootOptions() {
3401
- var _this17 = this;
3402
- this.callLoadOptionsProp({
3403
- action: LOAD_ROOT_OPTIONS,
3404
- isPending: function isPending() {
3405
- return _this17.rootOptionsStates.isLoading;
3406
- },
3407
- start: function start() {
3408
- _this17.rootOptionsStates.isLoading = true;
3409
- _this17.rootOptionsStates.loadingError = '';
3410
- },
3411
- succeed: function succeed() {
3412
- _this17.rootOptionsStates.isLoaded = true;
3413
- _this17.$nextTick(function () {
3414
- _this17.resetHighlightedOptionWhenNecessary(true);
3415
- });
3416
- },
3417
- fail: function fail(err) {
3418
- _this17.rootOptionsStates.loadingError = getErrorMessage(err);
3419
- },
3420
- end: function end() {
3421
- _this17.rootOptionsStates.isLoading = false;
3422
- }
3423
- });
3424
- },
3425
- loadChildrenOptions: function loadChildrenOptions(parentNode) {
3426
- var _this18 = this;
3427
- var id = parentNode.id,
3428
- raw = parentNode.raw;
3429
- this.callLoadOptionsProp({
3430
- action: LOAD_CHILDREN_OPTIONS,
3431
- args: {
3432
- parentNode: raw
3433
- },
3434
- isPending: function isPending() {
3435
- return _this18.getNode(id).childrenStates.isLoading;
3436
- },
3437
- start: function start() {
3438
- _this18.getNode(id).childrenStates.isLoading = true;
3439
- _this18.getNode(id).childrenStates.loadingError = '';
3440
- },
3441
- succeed: function succeed() {
3442
- _this18.getNode(id).childrenStates.isLoaded = true;
3443
- },
3444
- fail: function fail(err) {
3445
- _this18.getNode(id).childrenStates.loadingError = getErrorMessage(err);
3446
- },
3447
- end: function end() {
3448
- _this18.getNode(id).childrenStates.isLoading = false;
3449
- }
3450
- });
3451
- },
3452
- callLoadOptionsProp: function callLoadOptionsProp(_ref3) {
3453
- var action = _ref3.action,
3454
- args = _ref3.args,
3455
- isPending = _ref3.isPending,
3456
- start = _ref3.start,
3457
- succeed = _ref3.succeed,
3458
- fail = _ref3.fail,
3459
- end = _ref3.end;
3460
- if (!this.loadOptions || isPending()) {
3461
- return;
3462
- }
3463
- start();
3464
- var callback = once_default()(function (err, result) {
3465
- if (err) {
3466
- fail(err);
3467
- } else {
3468
- succeed(result);
3469
- }
3470
- end();
3471
- });
3472
- var result = this.loadOptions(Treeselectvue_type_script_lang_js_objectSpread(Treeselectvue_type_script_lang_js_objectSpread({
3473
- id: this.getInstanceId(),
3474
- instanceId: this.getInstanceId(),
3475
- action: action
3476
- }, args), {}, {
3477
- callback: callback
3478
- }));
3479
- if (external_is_promise_default()(result)) {
3480
- result.then(function () {
3481
- callback();
3482
- }, function (err) {
3483
- callback(err);
3484
- }).catch(function (err) {
3485
- console.error(err);
3486
- });
3487
- }
3488
- },
3489
- checkDuplication: function checkDuplication(node) {
3490
- var _this19 = this;
3491
- warning_warning(function () {
3492
- return !(node.id in _this19.forest.nodeMap && !_this19.forest.nodeMap[node.id].isFallbackNode);
3493
- }, function () {
3494
- 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.");
3495
- });
3496
- },
3497
- verifyNodeShape: function verifyNodeShape(node) {
3498
- warning_warning(function () {
3499
- return !(node.children === undefined && node.isBranch === true);
3500
- }, function () {
3501
- return 'Are you meant to declare an unloaded branch node? ' + '`isBranch: true` is no longer supported, please use `children: null` instead.';
3502
- });
3503
- },
3504
- select: function select(node) {
3505
- if (this.disabled || node.isDisabled) {
3506
- return;
3507
- }
3508
- if (this.single) {
3509
- this.clear();
3510
- }
3511
- var nextState = this.multiple && !this.flat ? this.forest.checkedStateMap[node.id] === UNCHECKED : !this.isSelected(node);
3512
- if (nextState) {
3513
- this._selectNode(node);
3514
- } else {
3515
- this._deselectNode(node);
3516
- }
3517
- this.buildForestState();
3518
- if (nextState) {
3519
- this.$emit('select', node.raw, this.getInstanceId());
3520
- } else {
3521
- this.$emit('deselect', node.raw, this.getInstanceId());
3522
- }
3523
- if (this.localSearch.active && nextState && (this.single || this.clearOnSelect)) {
3524
- this.resetSearchQuery();
3525
- }
3526
- if (this.single && this.closeOnSelect) {
3527
- this.closeMenu();
3528
- if (this.searchable) {
3529
- this._blurOnSelect = true;
3530
- }
3531
- }
3532
- },
3533
- clear: function clear() {
3534
- var _this20 = this;
3535
- if (this.hasValue) {
3536
- if (this.single || this.allowClearingDisabled) {
3537
- this.forest.selectedNodeIds = [];
3538
- } else {
3539
- this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter(function (nodeId) {
3540
- return _this20.getNode(nodeId).isDisabled;
3541
- });
3542
- }
3543
- this.buildForestState();
3544
- }
3545
- },
3546
- _selectNode: function _selectNode(node) {
3547
- var _this21 = this;
3548
- if (this.single || this.disableBranchNodes) {
3549
- return this.addValue(node);
3550
- }
3551
- if (this.flat) {
3552
- this.addValue(node);
3553
- if (this.autoSelectAncestors) {
3554
- node.ancestors.forEach(function (ancestor) {
3555
- if (!_this21.isSelected(ancestor) && !ancestor.isDisabled) _this21.addValue(ancestor);
3556
- });
3557
- } else if (this.autoSelectDescendants) {
3558
- this.traverseDescendantsBFS(node, function (descendant) {
3559
- if (!_this21.isSelected(descendant) && !descendant.isDisabled) _this21.addValue(descendant);
3560
- });
3561
- }
3562
- return;
3563
- }
3564
- var isFullyChecked = node.isLeaf || (!node.hasDisabledDescendants) || (this.allowSelectingDisabledDescendants);
3565
- if (isFullyChecked) {
3566
- this.addValue(node);
3567
- }
3568
- if (node.isBranch) {
3569
- this.traverseDescendantsBFS(node, function (descendant) {
3570
- if (!descendant.isDisabled || _this21.allowSelectingDisabledDescendants) {
3571
- _this21.addValue(descendant);
3572
- }
3573
- });
3574
- }
3575
- if (isFullyChecked) {
3576
- var curr = node;
3577
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
3578
- if (curr.children.every(this.isSelected)) this.addValue(curr);else break;
3579
- }
3580
- }
3581
- },
3582
- _deselectNode: function _deselectNode(node) {
3583
- var _this22 = this;
3584
- if (this.disableBranchNodes) {
3585
- return this.removeValue(node);
3586
- }
3587
- if (this.flat) {
3588
- this.removeValue(node);
3589
- if (this.autoDeselectAncestors) {
3590
- node.ancestors.forEach(function (ancestor) {
3591
- if (_this22.isSelected(ancestor) && !ancestor.isDisabled) _this22.removeValue(ancestor);
3592
- });
3593
- } else if (this.autoDeselectDescendants) {
3594
- this.traverseDescendantsBFS(node, function (descendant) {
3595
- if (_this22.isSelected(descendant) && !descendant.isDisabled) _this22.removeValue(descendant);
3596
- });
3597
- }
3598
- return;
3599
- }
3600
- var hasUncheckedSomeDescendants = false;
3601
- if (node.isBranch) {
3602
- this.traverseDescendantsDFS(node, function (descendant) {
3603
- if (!descendant.isDisabled || _this22.allowSelectingDisabledDescendants) {
3604
- _this22.removeValue(descendant);
3605
- hasUncheckedSomeDescendants = true;
3606
- }
3607
- });
3608
- }
3609
- if (node.isLeaf || hasUncheckedSomeDescendants || node.children.length === 0) {
3610
- this.removeValue(node);
3611
- var curr = node;
3612
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
3613
- if (this.isSelected(curr)) this.removeValue(curr);else break;
3614
- }
3615
- }
3616
- },
3617
- addValue: function addValue(node) {
3618
- this.forest.selectedNodeIds.push(node.id);
3619
- this.forest.selectedNodeMap[node.id] = true;
3620
- },
3621
- removeValue: function removeValue(node) {
3622
- removeFromArray(this.forest.selectedNodeIds, node.id);
3623
- delete this.forest.selectedNodeMap[node.id];
3624
- },
3625
- removeLastValue: function removeLastValue() {
3626
- if (!this.hasValue) return;
3627
- if (this.single) return this.clear();
3628
- var lastValue = last_default()(this.internalValue);
3629
- var lastSelectedNode = this.getNode(lastValue);
3630
- this.select(lastSelectedNode);
3631
- },
3632
- saveMenuScrollPosition: function saveMenuScrollPosition() {
3633
- var $menu = this.getMenu();
3634
- if ($menu) this.menu.lastScrollPosition = $menu.scrollTop;
3635
- },
3636
- restoreMenuScrollPosition: function restoreMenuScrollPosition() {
3637
- var $menu = this.getMenu();
3638
- if ($menu) $menu.scrollTop = this.menu.lastScrollPosition;
3639
- }
3640
- },
3641
- render: function render() {
3642
- var h = arguments[0];
3643
- return h("div", {
3644
- ref: "wrapper",
3645
- "class": this.wrapperClass
3646
- }, [h(HiddenFields), h(Control, {
3647
- ref: "control"
3648
- }), this.appendToBody ? h(MenuPortal, {
3649
- ref: "portal"
3650
- }) : h(Menu, {
3651
- ref: "menu"
3652
- })]);
3653
- }
3654
- });
3655
- // CONCATENATED MODULE: ./src/components/Treeselect.vue?vue&type=script&lang=js
3656
- /* harmony default export */ var components_Treeselectvue_type_script_lang_js = (Treeselectvue_type_script_lang_js);
3657
- // CONCATENATED MODULE: ./src/components/Treeselect.vue
3658
- var Treeselect_render, Treeselect_staticRenderFns
3659
-
3660
-
3661
-
3662
-
3663
- /* normalize component */
3664
-
3665
- var Treeselect_component = normalizeComponent(
3666
- components_Treeselectvue_type_script_lang_js,
3667
- Treeselect_render,
3668
- Treeselect_staticRenderFns,
3669
- false,
3670
- null,
3671
- null,
3672
- null
3673
-
3674
- )
3675
-
3676
- /* hot reload */
3677
- if (false) { var Treeselect_api; }
3678
- Treeselect_component.options.__file = "src/components/Treeselect.vue"
3679
- /* harmony default export */ var Treeselect = (Treeselect_component.exports);
3680
- // EXTERNAL MODULE: ./src/style.less
3681
- var style = __webpack_require__(15);
3682
-
3683
- // CONCATENATED MODULE: ./src/index.js
3684
-
3685
-
3686
- /* harmony default export */ var src = __webpack_exports__["default"] = (Treeselect);
3687
-
3688
-
3689
- var VERSION = "0.0.13";
3690
-
3691
- /***/ })
3692
- /******/ ]);
3693
- //# sourceMappingURL=rp-treeselect.cjs.js.map