@reviewpush/rp-treeselect 0.0.12 → 0.0.14

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