1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904 |
- /*!
- * vue-treeselect v0.4.0 | (c) 2017-2019 Riophae Lee
- * Released under the MIT License.
- * https://vue-treeselect.js.org/
- */
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "/";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 16);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, exports) {
- module.exports = require("@babel/runtime/helpers/slicedToArray");
- /***/ }),
- /* 1 */
- /***/ (function(module, exports) {
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
- /***/ }),
- /* 2 */
- /***/ (function(module, exports) {
- module.exports = require("@babel/runtime/helpers/defineProperty");
- /***/ }),
- /* 3 */
- /***/ (function(module, exports) {
- module.exports = require("fuzzysearch");
- /***/ }),
- /* 4 */
- /***/ (function(module, exports) {
- module.exports = require("lodash/noop");
- /***/ }),
- /* 5 */
- /***/ (function(module, exports) {
- module.exports = require("lodash/debounce");
- /***/ }),
- /* 6 */
- /***/ (function(module, exports) {
- module.exports = require("watch-size");
- /***/ }),
- /* 7 */
- /***/ (function(module, exports) {
- module.exports = require("is-promise");
- /***/ }),
- /* 8 */
- /***/ (function(module, exports) {
- module.exports = require("lodash/once");
- /***/ }),
- /* 9 */
- /***/ (function(module, exports) {
- module.exports = require("lodash/identity");
- /***/ }),
- /* 10 */
- /***/ (function(module, exports) {
- module.exports = require("lodash/constant");
- /***/ }),
- /* 11 */
- /***/ (function(module, exports) {
- module.exports = require("@babel/runtime/helpers/typeof");
- /***/ }),
- /* 12 */
- /***/ (function(module, exports) {
- module.exports = require("lodash/last");
- /***/ }),
- /* 13 */
- /***/ (function(module, exports) {
- module.exports = require("babel-helper-vue-jsx-merge-props");
- /***/ }),
- /* 14 */
- /***/ (function(module, exports) {
- module.exports = require("vue");
- /***/ }),
- /* 15 */
- /***/ (function(module, exports, __webpack_require__) {
- // extracted by mini-css-extract-plugin
- /***/ }),
- /* 16 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- // EXTERNAL MODULE: external "@babel/runtime/helpers/slicedToArray"
- var slicedToArray_ = __webpack_require__(0);
- var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray_);
- // EXTERNAL MODULE: external "@babel/runtime/helpers/toConsumableArray"
- var toConsumableArray_ = __webpack_require__(1);
- var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_);
- // EXTERNAL MODULE: external "@babel/runtime/helpers/defineProperty"
- var defineProperty_ = __webpack_require__(2);
- var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
- // EXTERNAL MODULE: external "fuzzysearch"
- var external_fuzzysearch_ = __webpack_require__(3);
- var external_fuzzysearch_default = /*#__PURE__*/__webpack_require__.n(external_fuzzysearch_);
- // EXTERNAL MODULE: external "lodash/noop"
- var noop_ = __webpack_require__(4);
- var noop_default = /*#__PURE__*/__webpack_require__.n(noop_);
- // CONCATENATED MODULE: ./src/utils/noop.js
- // CONCATENATED MODULE: ./src/utils/warning.js
- var warning_warning = process.env.NODE_ENV === 'production' ? noop_default.a : function warning(checker, complainer) {
- if (!checker()) {
- var _console;
- var message = ['[Vue-Treeselect Warning]'].concat(complainer());
- (_console = console).error.apply(_console, toConsumableArray_default()(message));
- }
- };
- // CONCATENATED MODULE: ./src/utils/onLeftClick.js
- function onLeftClick(mouseDownHandler) {
- return function onMouseDown(evt) {
- if (evt.type === 'mousedown' && evt.button === 0) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- mouseDownHandler.call.apply(mouseDownHandler, [this, evt].concat(args));
- }
- };
- }
- // CONCATENATED MODULE: ./src/utils/scrollIntoView.js
- function scrollIntoView($scrollingEl, $focusedEl) {
- var scrollingReact = $scrollingEl.getBoundingClientRect();
- var focusedRect = $focusedEl.getBoundingClientRect();
- var overScroll = $focusedEl.offsetHeight / 3;
- if (focusedRect.bottom + overScroll > scrollingReact.bottom) {
- $scrollingEl.scrollTop = Math.min($focusedEl.offsetTop + $focusedEl.clientHeight - $scrollingEl.offsetHeight + overScroll, $scrollingEl.scrollHeight);
- } else if (focusedRect.top - overScroll < scrollingReact.top) {
- $scrollingEl.scrollTop = Math.max($focusedEl.offsetTop - overScroll, 0);
- }
- }
- // EXTERNAL MODULE: external "lodash/debounce"
- var debounce_ = __webpack_require__(5);
- var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
- // CONCATENATED MODULE: ./src/utils/debounce.js
- // EXTERNAL MODULE: external "watch-size"
- var external_watch_size_ = __webpack_require__(6);
- var external_watch_size_default = /*#__PURE__*/__webpack_require__.n(external_watch_size_);
- // CONCATENATED MODULE: ./src/utils/removeFromArray.js
- function removeFromArray(arr, elem) {
- var idx = arr.indexOf(elem);
- if (idx !== -1) arr.splice(idx, 1);
- }
- // CONCATENATED MODULE: ./src/utils/watchSize.js
- var intervalId;
- var registered = [];
- var INTERVAL_DURATION = 100;
- function run() {
- intervalId = setInterval(function () {
- registered.forEach(test);
- }, INTERVAL_DURATION);
- }
- function stop() {
- clearInterval(intervalId);
- intervalId = null;
- }
- function test(item) {
- var $el = item.$el,
- listener = item.listener,
- lastWidth = item.lastWidth,
- lastHeight = item.lastHeight;
- var width = $el.offsetWidth;
- var height = $el.offsetHeight;
- if (lastWidth !== width || lastHeight !== height) {
- item.lastWidth = width;
- item.lastHeight = height;
- listener({
- width: width,
- height: height
- });
- }
- }
- function watchSizeForIE9($el, listener) {
- var item = {
- $el: $el,
- listener: listener,
- lastWidth: null,
- lastHeight: null
- };
- var unwatch = function unwatch() {
- removeFromArray(registered, item);
- if (!registered.length) stop();
- };
- registered.push(item);
- test(item);
- run();
- return unwatch;
- }
- function watchSize($el, listener) {
- var isIE9 = document.documentMode === 9;
- var locked = true;
- var wrappedListener = function wrappedListener() {
- return locked || listener.apply(void 0, arguments);
- };
- var implementation = isIE9 ? watchSizeForIE9 : external_watch_size_default.a;
- var removeSizeWatcher = implementation($el, wrappedListener);
- locked = false;
- return removeSizeWatcher;
- }
- // CONCATENATED MODULE: ./src/utils/setupResizeAndScrollEventListeners.js
- function findScrollParents($el) {
- var $scrollParents = [];
- var $parent = $el.parentNode;
- while ($parent && $parent.nodeName !== 'BODY' && $parent.nodeType === document.ELEMENT_NODE) {
- if (isScrollElment($parent)) $scrollParents.push($parent);
- $parent = $parent.parentNode;
- }
- $scrollParents.push(window);
- return $scrollParents;
- }
- function isScrollElment($el) {
- var _getComputedStyle = getComputedStyle($el),
- overflow = _getComputedStyle.overflow,
- overflowX = _getComputedStyle.overflowX,
- overflowY = _getComputedStyle.overflowY;
- return /(auto|scroll|overlay)/.test(overflow + overflowY + overflowX);
- }
- function setupResizeAndScrollEventListeners($el, listener) {
- var $scrollParents = findScrollParents($el);
- window.addEventListener('resize', listener, {
- passive: true
- });
- $scrollParents.forEach(function (scrollParent) {
- scrollParent.addEventListener('scroll', listener, {
- passive: true
- });
- });
- return function removeEventListeners() {
- window.removeEventListener('resize', listener, {
- passive: true
- });
- $scrollParents.forEach(function ($scrollParent) {
- $scrollParent.removeEventListener('scroll', listener, {
- passive: true
- });
- });
- };
- }
- // CONCATENATED MODULE: ./src/utils/isNaN.js
- function isNaN_isNaN(x) {
- return x !== x;
- }
- // EXTERNAL MODULE: external "is-promise"
- var external_is_promise_ = __webpack_require__(7);
- var external_is_promise_default = /*#__PURE__*/__webpack_require__.n(external_is_promise_);
- // CONCATENATED MODULE: ./src/utils/isPromise.js
- // EXTERNAL MODULE: external "lodash/once"
- var once_ = __webpack_require__(8);
- var once_default = /*#__PURE__*/__webpack_require__.n(once_);
- // CONCATENATED MODULE: ./src/utils/once.js
- // EXTERNAL MODULE: external "lodash/identity"
- var identity_ = __webpack_require__(9);
- var identity_default = /*#__PURE__*/__webpack_require__.n(identity_);
- // CONCATENATED MODULE: ./src/utils/identity.js
- // EXTERNAL MODULE: external "lodash/constant"
- var constant_ = __webpack_require__(10);
- var constant_default = /*#__PURE__*/__webpack_require__.n(constant_);
- // CONCATENATED MODULE: ./src/utils/constant.js
- // CONCATENATED MODULE: ./src/utils/createMap.js
- var createMap = function createMap() {
- return Object.create(null);
- };
- // EXTERNAL MODULE: external "@babel/runtime/helpers/typeof"
- var typeof_ = __webpack_require__(11);
- var typeof_default = /*#__PURE__*/__webpack_require__.n(typeof_);
- // CONCATENATED MODULE: ./src/utils/deepExtend.js
- function isPlainObject(value) {
- if (value == null || typeof_default()(value) !== 'object') return false;
- return Object.getPrototypeOf(value) === Object.prototype;
- }
- function copy(obj, key, value) {
- if (isPlainObject(value)) {
- obj[key] || (obj[key] = {});
- deepExtend(obj[key], value);
- } else {
- obj[key] = value;
- }
- }
- function deepExtend(target, source) {
- if (isPlainObject(source)) {
- var keys = Object.keys(source);
- for (var i = 0, len = keys.length; i < len; i++) {
- copy(target, keys[i], source[keys[i]]);
- }
- }
- return target;
- }
- // EXTERNAL MODULE: external "lodash/last"
- var last_ = __webpack_require__(12);
- var last_default = /*#__PURE__*/__webpack_require__.n(last_);
- // CONCATENATED MODULE: ./src/utils/last.js
- // CONCATENATED MODULE: ./src/utils/includes.js
- function includes(arrOrStr, elem) {
- return arrOrStr.indexOf(elem) !== -1;
- }
- // CONCATENATED MODULE: ./src/utils/find.js
- function find(arr, predicate, ctx) {
- for (var i = 0, len = arr.length; i < len; i++) {
- if (predicate.call(ctx, arr[i], i, arr)) return arr[i];
- }
- return undefined;
- }
- // CONCATENATED MODULE: ./src/utils/quickDiff.js
- function quickDiff(arrA, arrB) {
- if (arrA.length !== arrB.length) return true;
- for (var i = 0; i < arrA.length; i++) {
- if (arrA[i] !== arrB[i]) return true;
- }
- return false;
- }
- // CONCATENATED MODULE: ./src/utils/index.js
- // CONCATENATED MODULE: ./src/constants.js
- var NO_PARENT_NODE = null;
- var UNCHECKED = 0;
- var INDETERMINATE = 1;
- var CHECKED = 2;
- var ALL_CHILDREN = 'ALL_CHILDREN';
- var ALL_DESCENDANTS = 'ALL_DESCENDANTS';
- var LEAF_CHILDREN = 'LEAF_CHILDREN';
- var LEAF_DESCENDANTS = 'LEAF_DESCENDANTS';
- var LOAD_ROOT_OPTIONS = 'LOAD_ROOT_OPTIONS';
- var LOAD_CHILDREN_OPTIONS = 'LOAD_CHILDREN_OPTIONS';
- var ASYNC_SEARCH = 'ASYNC_SEARCH';
- var ALL = 'ALL';
- var BRANCH_PRIORITY = 'BRANCH_PRIORITY';
- var LEAF_PRIORITY = 'LEAF_PRIORITY';
- var ALL_WITH_INDETERMINATE = 'ALL_WITH_INDETERMINATE';
- var ORDER_SELECTED = 'ORDER_SELECTED';
- var LEVEL = 'LEVEL';
- var INDEX = 'INDEX';
- var KEY_CODES = {
- BACKSPACE: 8,
- ENTER: 13,
- ESCAPE: 27,
- END: 35,
- HOME: 36,
- ARROW_LEFT: 37,
- ARROW_UP: 38,
- ARROW_RIGHT: 39,
- ARROW_DOWN: 40,
- DELETE: 46
- };
- var INPUT_DEBOUNCE_DELAY = process.env.NODE_ENV === 'testing' ? 10 : 200;
- var MIN_INPUT_WIDTH = 5;
- var MENU_BUFFER = 40;
- // CONCATENATED MODULE: ./src/mixins/treeselectMixin.js
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
- function sortValueByIndex(a, b) {
- var i = 0;
- do {
- if (a.level < i) return -1;
- if (b.level < i) return 1;
- if (a.index[i] !== b.index[i]) return a.index[i] - b.index[i];
- i++;
- } while (true);
- }
- function sortValueByLevel(a, b) {
- return a.level === b.level ? sortValueByIndex(a, b) : a.level - b.level;
- }
- function createAsyncOptionsStates() {
- return {
- isLoaded: false,
- isLoading: false,
- loadingError: ''
- };
- }
- function stringifyOptionPropValue(value) {
- if (typeof value === 'string') return value;
- if (typeof value === 'number' && !isNaN_isNaN(value)) return value + '';
- return '';
- }
- function match(enableFuzzyMatch, needle, haystack) {
- return enableFuzzyMatch ? external_fuzzysearch_default()(needle, haystack) : includes(haystack, needle);
- }
- function getErrorMessage(err) {
- return err.message || String(err);
- }
- var instanceId = 0;
- /* harmony default export */ var treeselectMixin = ({
- provide: function provide() {
- return {
- instance: this
- };
- },
- props: {
- allowClearingDisabled: {
- type: Boolean,
- default: false
- },
- allowSelectingDisabledDescendants: {
- type: Boolean,
- default: false
- },
- alwaysOpen: {
- type: Boolean,
- default: false
- },
- appendToBody: {
- type: Boolean,
- default: false
- },
- async: {
- type: Boolean,
- default: false
- },
- autoFocus: {
- type: Boolean,
- default: false
- },
- autoLoadRootOptions: {
- type: Boolean,
- default: true
- },
- autoDeselectAncestors: {
- type: Boolean,
- default: false
- },
- autoDeselectDescendants: {
- type: Boolean,
- default: false
- },
- autoSelectAncestors: {
- type: Boolean,
- default: false
- },
- autoSelectDescendants: {
- type: Boolean,
- default: false
- },
- backspaceRemoves: {
- type: Boolean,
- default: true
- },
- beforeClearAll: {
- type: Function,
- default: constant_default()(true)
- },
- branchNodesFirst: {
- type: Boolean,
- default: false
- },
- cacheOptions: {
- type: Boolean,
- default: true
- },
- clearable: {
- type: Boolean,
- default: true
- },
- clearAllText: {
- type: String,
- default: 'Clear all'
- },
- clearOnSelect: {
- type: Boolean,
- default: false
- },
- clearValueText: {
- type: String,
- default: 'Clear value'
- },
- closeOnSelect: {
- type: Boolean,
- default: true
- },
- defaultExpandLevel: {
- type: Number,
- default: 0
- },
- defaultOptions: {
- default: false
- },
- deleteRemoves: {
- type: Boolean,
- default: true
- },
- delimiter: {
- type: String,
- default: ','
- },
- flattenSearchResults: {
- type: Boolean,
- default: false
- },
- disableBranchNodes: {
- type: Boolean,
- default: false
- },
- disabled: {
- type: Boolean,
- default: false
- },
- disableFuzzyMatching: {
- type: Boolean,
- default: false
- },
- flat: {
- type: Boolean,
- default: false
- },
- instanceId: {
- default: function _default() {
- return "".concat(instanceId++, "$$");
- },
- type: [String, Number]
- },
- joinValues: {
- type: Boolean,
- default: false
- },
- limit: {
- type: Number,
- default: Infinity
- },
- limitText: {
- type: Function,
- default: function limitTextDefault(count) {
- return "and ".concat(count, " more");
- }
- },
- loadingText: {
- type: String,
- default: 'Loading...'
- },
- loadOptions: {
- type: Function
- },
- matchKeys: {
- type: Array,
- default: constant_default()(['label'])
- },
- maxHeight: {
- type: Number,
- default: 300
- },
- multiple: {
- type: Boolean,
- default: false
- },
- name: {
- type: String
- },
- noChildrenText: {
- type: String,
- default: 'No sub-options.'
- },
- noOptionsText: {
- type: String,
- default: 'No options available.'
- },
- noResultsText: {
- type: String,
- default: 'No results found...'
- },
- normalizer: {
- type: Function,
- default: identity_default.a
- },
- openDirection: {
- type: String,
- default: 'auto',
- validator: function validator(value) {
- var acceptableValues = ['auto', 'top', 'bottom', 'above', 'below'];
- return includes(acceptableValues, value);
- }
- },
- openOnClick: {
- type: Boolean,
- default: true
- },
- openOnFocus: {
- type: Boolean,
- default: false
- },
- options: {
- type: Array
- },
- placeholder: {
- type: String,
- default: 'Select...'
- },
- required: {
- type: Boolean,
- default: false
- },
- retryText: {
- type: String,
- default: 'Retry?'
- },
- retryTitle: {
- type: String,
- default: 'Click to retry'
- },
- searchable: {
- type: Boolean,
- default: true
- },
- searchNested: {
- type: Boolean,
- default: false
- },
- searchPromptText: {
- type: String,
- default: 'Type to search...'
- },
- showCount: {
- type: Boolean,
- default: false
- },
- showCountOf: {
- type: String,
- default: ALL_CHILDREN,
- validator: function validator(value) {
- var acceptableValues = [ALL_CHILDREN, ALL_DESCENDANTS, LEAF_CHILDREN, LEAF_DESCENDANTS];
- return includes(acceptableValues, value);
- }
- },
- showCountOnSearch: null,
- sortValueBy: {
- type: String,
- default: ORDER_SELECTED,
- validator: function validator(value) {
- var acceptableValues = [ORDER_SELECTED, LEVEL, INDEX];
- return includes(acceptableValues, value);
- }
- },
- tabIndex: {
- type: Number,
- default: 0
- },
- value: null,
- valueConsistsOf: {
- type: String,
- default: BRANCH_PRIORITY,
- validator: function validator(value) {
- var acceptableValues = [ALL, BRANCH_PRIORITY, LEAF_PRIORITY, ALL_WITH_INDETERMINATE];
- return includes(acceptableValues, value);
- }
- },
- valueFormat: {
- type: String,
- default: 'id'
- },
- zIndex: {
- type: [Number, String],
- default: 999
- }
- },
- data: function data() {
- return {
- trigger: {
- isFocused: false,
- searchQuery: ''
- },
- menu: {
- isOpen: false,
- current: null,
- lastScrollPosition: 0,
- placement: 'bottom'
- },
- forest: {
- normalizedOptions: [],
- nodeMap: createMap(),
- checkedStateMap: createMap(),
- selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
- selectedNodeMap: createMap()
- },
- rootOptionsStates: createAsyncOptionsStates(),
- localSearch: {
- active: false,
- noResults: true,
- countMap: createMap()
- },
- remoteSearch: createMap()
- };
- },
- computed: {
- selectedNodes: function selectedNodes() {
- return this.forest.selectedNodeIds.map(this.getNode);
- },
- internalValue: function internalValue() {
- var _this = this;
- var internalValue;
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
- internalValue = this.forest.selectedNodeIds.slice();
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
- var node = _this.getNode(id);
- if (node.isRootNode) return true;
- return !_this.isSelected(node.parentNode);
- });
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
- internalValue = this.forest.selectedNodeIds.filter(function (id) {
- var node = _this.getNode(id);
- if (node.isLeaf) return true;
- return node.children.length === 0;
- });
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
- var _internalValue;
- var indeterminateNodeIds = [];
- internalValue = this.forest.selectedNodeIds.slice();
- this.selectedNodes.forEach(function (selectedNode) {
- selectedNode.ancestors.forEach(function (ancestor) {
- if (includes(indeterminateNodeIds, ancestor.id)) return;
- if (includes(internalValue, ancestor.id)) return;
- indeterminateNodeIds.push(ancestor.id);
- });
- });
- (_internalValue = internalValue).push.apply(_internalValue, indeterminateNodeIds);
- }
- if (this.sortValueBy === LEVEL) {
- internalValue.sort(function (a, b) {
- return sortValueByLevel(_this.getNode(a), _this.getNode(b));
- });
- } else if (this.sortValueBy === INDEX) {
- internalValue.sort(function (a, b) {
- return sortValueByIndex(_this.getNode(a), _this.getNode(b));
- });
- }
- return internalValue;
- },
- hasValue: function hasValue() {
- return this.internalValue.length > 0;
- },
- single: function single() {
- return !this.multiple;
- },
- visibleOptionIds: function visibleOptionIds() {
- var _this2 = this;
- var visibleOptionIds = [];
- this.traverseAllNodesByIndex(function (node) {
- if (!_this2.localSearch.active || _this2.shouldOptionBeIncludedInSearchResult(node)) {
- visibleOptionIds.push(node.id);
- }
- if (node.isBranch && !_this2.shouldExpand(node)) {
- return false;
- }
- });
- return visibleOptionIds;
- },
- hasVisibleOptions: function hasVisibleOptions() {
- return this.visibleOptionIds.length !== 0;
- },
- showCountOnSearchComputed: function showCountOnSearchComputed() {
- return typeof this.showCountOnSearch === 'boolean' ? this.showCountOnSearch : this.showCount;
- },
- hasBranchNodes: function hasBranchNodes() {
- return this.forest.normalizedOptions.some(function (rootNode) {
- return rootNode.isBranch;
- });
- },
- shouldFlattenOptions: function shouldFlattenOptions() {
- return this.localSearch.active && this.flattenSearchResults;
- }
- },
- watch: {
- alwaysOpen: function alwaysOpen(newValue) {
- if (newValue) this.openMenu();else this.closeMenu();
- },
- branchNodesFirst: function branchNodesFirst() {
- this.initialize();
- },
- disabled: function disabled(newValue) {
- if (newValue && this.menu.isOpen) this.closeMenu();else if (!newValue && !this.menu.isOpen && this.alwaysOpen) this.openMenu();
- },
- flat: function flat() {
- this.initialize();
- },
- internalValue: function internalValue(newValue, oldValue) {
- var hasChanged = quickDiff(newValue, oldValue);
- if (hasChanged) this.$emit('input', this.getValue(), this.getInstanceId());
- },
- matchKeys: function matchKeys() {
- this.initialize();
- },
- multiple: function multiple(newValue) {
- if (newValue) this.buildForestState();
- },
- options: {
- handler: function handler() {
- if (this.async) return;
- this.initialize();
- this.rootOptionsStates.isLoaded = Array.isArray(this.options);
- },
- deep: true,
- immediate: true
- },
- 'trigger.searchQuery': function triggerSearchQuery() {
- if (this.async) {
- this.handleRemoteSearch();
- } else {
- this.handleLocalSearch();
- }
- this.$emit('search-change', this.trigger.searchQuery, this.getInstanceId());
- },
- value: function value() {
- var nodeIdsFromValue = this.extractCheckedNodeIdsFromValue();
- var hasChanged = quickDiff(nodeIdsFromValue, this.internalValue);
- if (hasChanged) this.fixSelectedNodeIds(nodeIdsFromValue);
- }
- },
- methods: {
- verifyProps: function verifyProps() {
- var _this3 = this;
- warning_warning(function () {
- return _this3.async ? _this3.searchable : true;
- }, function () {
- return 'For async search mode, the value of "searchable" prop must be true.';
- });
- if (this.options == null && !this.loadOptions) {
- warning_warning(function () {
- return false;
- }, function () {
- return 'Are you meant to dynamically load options? You need to use "loadOptions" prop.';
- });
- }
- if (this.flat) {
- warning_warning(function () {
- return _this3.multiple;
- }, function () {
- return 'You are using flat mode. But you forgot to add "multiple=true"?';
- });
- }
- if (!this.flat) {
- var propNames = ['autoSelectAncestors', 'autoSelectDescendants', 'autoDeselectAncestors', 'autoDeselectDescendants'];
- propNames.forEach(function (propName) {
- warning_warning(function () {
- return !_this3[propName];
- }, function () {
- return "\"".concat(propName, "\" only applies to flat mode.");
- });
- });
- }
- },
- resetFlags: function resetFlags() {
- this._blurOnSelect = false;
- },
- initialize: function initialize() {
- var options = this.async ? this.getRemoteSearchEntry().options : this.options;
- if (Array.isArray(options)) {
- var prevNodeMap = this.forest.nodeMap;
- this.forest.nodeMap = createMap();
- this.keepDataOfSelectedNodes(prevNodeMap);
- this.forest.normalizedOptions = this.normalize(NO_PARENT_NODE, options, prevNodeMap);
- this.fixSelectedNodeIds(this.internalValue);
- } else {
- this.forest.normalizedOptions = [];
- }
- },
- getInstanceId: function getInstanceId() {
- return this.instanceId == null ? this.id : this.instanceId;
- },
- getValue: function getValue() {
- var _this4 = this;
- if (this.valueFormat === 'id') {
- return this.multiple ? this.internalValue.slice() : this.internalValue[0];
- }
- var rawNodes = this.internalValue.map(function (id) {
- return _this4.getNode(id).raw;
- });
- return this.multiple ? rawNodes : rawNodes[0];
- },
- getNode: function getNode(nodeId) {
- warning_warning(function () {
- return nodeId != null;
- }, function () {
- return "Invalid node id: ".concat(nodeId);
- });
- if (nodeId == null) return null;
- return nodeId in this.forest.nodeMap ? this.forest.nodeMap[nodeId] : this.createFallbackNode(nodeId);
- },
- createFallbackNode: function createFallbackNode(id) {
- var raw = this.extractNodeFromValue(id);
- var label = this.enhancedNormalizer(raw).label || "".concat(id, " (unknown)");
- var fallbackNode = {
- id: id,
- label: label,
- ancestors: [],
- parentNode: NO_PARENT_NODE,
- isFallbackNode: true,
- isRootNode: true,
- isLeaf: true,
- isBranch: false,
- isDisabled: false,
- isNew: false,
- index: [-1],
- level: 0,
- raw: raw
- };
- return this.$set(this.forest.nodeMap, id, fallbackNode);
- },
- extractCheckedNodeIdsFromValue: function extractCheckedNodeIdsFromValue() {
- var _this5 = this;
- if (this.value == null) return [];
- if (this.valueFormat === 'id') {
- return this.multiple ? this.value.slice() : [this.value];
- }
- return (this.multiple ? this.value : [this.value]).map(function (node) {
- return _this5.enhancedNormalizer(node);
- }).map(function (node) {
- return node.id;
- });
- },
- extractNodeFromValue: function extractNodeFromValue(id) {
- var _this6 = this;
- var defaultNode = {
- id: id
- };
- if (this.valueFormat === 'id') {
- return defaultNode;
- }
- var valueArray = this.multiple ? Array.isArray(this.value) ? this.value : [] : this.value ? [this.value] : [];
- var matched = find(valueArray, function (node) {
- return node && _this6.enhancedNormalizer(node).id === id;
- });
- return matched || defaultNode;
- },
- fixSelectedNodeIds: function fixSelectedNodeIds(nodeIdListOfPrevValue) {
- var _this7 = this;
- var nextSelectedNodeIds = [];
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === ALL) {
- nextSelectedNodeIds = nodeIdListOfPrevValue;
- } else if (this.valueConsistsOf === BRANCH_PRIORITY) {
- nodeIdListOfPrevValue.forEach(function (nodeId) {
- nextSelectedNodeIds.push(nodeId);
- var node = _this7.getNode(nodeId);
- if (node.isBranch) _this7.traverseDescendantsBFS(node, function (descendant) {
- nextSelectedNodeIds.push(descendant.id);
- });
- });
- } else if (this.valueConsistsOf === LEAF_PRIORITY) {
- var map = createMap();
- var queue = nodeIdListOfPrevValue.slice();
- while (queue.length) {
- var nodeId = queue.shift();
- var node = this.getNode(nodeId);
- nextSelectedNodeIds.push(nodeId);
- if (node.isRootNode) continue;
- if (!(node.parentNode.id in map)) map[node.parentNode.id] = node.parentNode.children.length;
- if (--map[node.parentNode.id] === 0) queue.push(node.parentNode.id);
- }
- } else if (this.valueConsistsOf === ALL_WITH_INDETERMINATE) {
- var _map = createMap();
- var _queue = nodeIdListOfPrevValue.filter(function (nodeId) {
- var node = _this7.getNode(nodeId);
- return node.isLeaf || node.children.length === 0;
- });
- while (_queue.length) {
- var _nodeId = _queue.shift();
- var _node = this.getNode(_nodeId);
- nextSelectedNodeIds.push(_nodeId);
- if (_node.isRootNode) continue;
- if (!(_node.parentNode.id in _map)) _map[_node.parentNode.id] = _node.parentNode.children.length;
- if (--_map[_node.parentNode.id] === 0) _queue.push(_node.parentNode.id);
- }
- }
- var hasChanged = quickDiff(this.forest.selectedNodeIds, nextSelectedNodeIds);
- if (hasChanged) this.forest.selectedNodeIds = nextSelectedNodeIds;
- this.buildForestState();
- },
- keepDataOfSelectedNodes: function keepDataOfSelectedNodes(prevNodeMap) {
- var _this8 = this;
- this.forest.selectedNodeIds.forEach(function (id) {
- if (!prevNodeMap[id]) return;
- var node = _objectSpread({}, prevNodeMap[id], {
- isFallbackNode: true
- });
- _this8.$set(_this8.forest.nodeMap, id, node);
- });
- },
- isSelected: function isSelected(node) {
- return this.forest.selectedNodeMap[node.id] === true;
- },
- traverseDescendantsBFS: function traverseDescendantsBFS(parentNode, callback) {
- if (!parentNode.isBranch) return;
- var queue = parentNode.children.slice();
- while (queue.length) {
- var currNode = queue[0];
- if (currNode.isBranch) queue.push.apply(queue, toConsumableArray_default()(currNode.children));
- callback(currNode);
- queue.shift();
- }
- },
- traverseDescendantsDFS: function traverseDescendantsDFS(parentNode, callback) {
- var _this9 = this;
- if (!parentNode.isBranch) return;
- parentNode.children.forEach(function (child) {
- _this9.traverseDescendantsDFS(child, callback);
- callback(child);
- });
- },
- traverseAllNodesDFS: function traverseAllNodesDFS(callback) {
- var _this10 = this;
- this.forest.normalizedOptions.forEach(function (rootNode) {
- _this10.traverseDescendantsDFS(rootNode, callback);
- callback(rootNode);
- });
- },
- traverseAllNodesByIndex: function traverseAllNodesByIndex(callback) {
- var walk = function walk(parentNode) {
- parentNode.children.forEach(function (child) {
- if (callback(child) !== false && child.isBranch) {
- walk(child);
- }
- });
- };
- walk({
- children: this.forest.normalizedOptions
- });
- },
- toggleClickOutsideEvent: function toggleClickOutsideEvent(enabled) {
- if (enabled) {
- document.addEventListener('mousedown', this.handleClickOutside, false);
- } else {
- document.removeEventListener('mousedown', this.handleClickOutside, false);
- }
- },
- getValueContainer: function getValueContainer() {
- return this.$refs.control.$refs['value-container'];
- },
- getInput: function getInput() {
- return this.getValueContainer().$refs.input;
- },
- focusInput: function focusInput() {
- this.getInput().focus();
- },
- blurInput: function blurInput() {
- this.getInput().blur();
- },
- handleMouseDown: onLeftClick(function handleMouseDown(evt) {
- evt.preventDefault();
- evt.stopPropagation();
- if (this.disabled) return;
- var isClickedOnValueContainer = this.getValueContainer().$el.contains(evt.target);
- if (isClickedOnValueContainer && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused)) {
- this.openMenu();
- }
- if (this._blurOnSelect) {
- this.blurInput();
- } else {
- this.focusInput();
- }
- this.resetFlags();
- }),
- handleClickOutside: function handleClickOutside(evt) {
- if (this.$refs.wrapper && !this.$refs.wrapper.contains(evt.target)) {
- this.blurInput();
- this.closeMenu();
- }
- },
- handleLocalSearch: function handleLocalSearch() {
- var _this11 = this;
- var searchQuery = this.trigger.searchQuery;
- var done = function done() {
- return _this11.resetHighlightedOptionWhenNecessary(true);
- };
- if (!searchQuery) {
- this.localSearch.active = false;
- return done();
- }
- this.localSearch.active = true;
- this.localSearch.noResults = true;
- this.traverseAllNodesDFS(function (node) {
- if (node.isBranch) {
- var _this11$$set;
- node.isExpandedOnSearch = false;
- node.showAllChildrenOnSearch = false;
- node.isMatched = false;
- node.hasMatchedDescendants = false;
- _this11.$set(_this11.localSearch.countMap, node.id, (_this11$$set = {}, defineProperty_default()(_this11$$set, ALL_CHILDREN, 0), defineProperty_default()(_this11$$set, ALL_DESCENDANTS, 0), defineProperty_default()(_this11$$set, LEAF_CHILDREN, 0), defineProperty_default()(_this11$$set, LEAF_DESCENDANTS, 0), _this11$$set));
- }
- });
- var lowerCasedSearchQuery = searchQuery.trim().toLocaleLowerCase();
- var splitSearchQuery = lowerCasedSearchQuery.replace(/\s+/g, ' ').split(' ');
- this.traverseAllNodesDFS(function (node) {
- if (_this11.searchNested && splitSearchQuery.length > 1) {
- node.isMatched = splitSearchQuery.every(function (filterValue) {
- return match(false, filterValue, node.nestedSearchLabel);
- });
- } else {
- node.isMatched = _this11.matchKeys.some(function (matchKey) {
- return match(!_this11.disableFuzzyMatching, lowerCasedSearchQuery, node.lowerCased[matchKey]);
- });
- }
- if (node.isMatched) {
- _this11.localSearch.noResults = false;
- node.ancestors.forEach(function (ancestor) {
- return _this11.localSearch.countMap[ancestor.id][ALL_DESCENDANTS]++;
- });
- if (node.isLeaf) node.ancestors.forEach(function (ancestor) {
- return _this11.localSearch.countMap[ancestor.id][LEAF_DESCENDANTS]++;
- });
- if (node.parentNode !== NO_PARENT_NODE) {
- _this11.localSearch.countMap[node.parentNode.id][ALL_CHILDREN] += 1;
- if (node.isLeaf) _this11.localSearch.countMap[node.parentNode.id][LEAF_CHILDREN] += 1;
- }
- }
- if ((node.isMatched || node.isBranch && node.isExpandedOnSearch) && node.parentNode !== NO_PARENT_NODE) {
- node.parentNode.isExpandedOnSearch = true;
- node.parentNode.hasMatchedDescendants = true;
- }
- });
- done();
- },
- handleRemoteSearch: function handleRemoteSearch() {
- var _this12 = this;
- var searchQuery = this.trigger.searchQuery;
- var entry = this.getRemoteSearchEntry();
- var done = function done() {
- _this12.initialize();
- _this12.resetHighlightedOptionWhenNecessary(true);
- };
- if ((searchQuery === '' || this.cacheOptions) && entry.isLoaded) {
- return done();
- }
- this.callLoadOptionsProp({
- action: ASYNC_SEARCH,
- args: {
- searchQuery: searchQuery
- },
- isPending: function isPending() {
- return entry.isLoading;
- },
- start: function start() {
- entry.isLoading = true;
- entry.isLoaded = false;
- entry.loadingError = '';
- },
- succeed: function succeed(options) {
- entry.isLoaded = true;
- entry.options = options;
- if (_this12.trigger.searchQuery === searchQuery) done();
- },
- fail: function fail(err) {
- entry.loadingError = getErrorMessage(err);
- },
- end: function end() {
- entry.isLoading = false;
- }
- });
- },
- getRemoteSearchEntry: function getRemoteSearchEntry() {
- var _this13 = this;
- var searchQuery = this.trigger.searchQuery;
- var entry = this.remoteSearch[searchQuery] || _objectSpread({}, createAsyncOptionsStates(), {
- options: []
- });
- this.$watch(function () {
- return entry.options;
- }, function () {
- if (_this13.trigger.searchQuery === searchQuery) _this13.initialize();
- }, {
- deep: true
- });
- if (searchQuery === '') {
- if (Array.isArray(this.defaultOptions)) {
- entry.options = this.defaultOptions;
- entry.isLoaded = true;
- return entry;
- } else if (this.defaultOptions !== true) {
- entry.isLoaded = true;
- return entry;
- }
- }
- if (!this.remoteSearch[searchQuery]) {
- this.$set(this.remoteSearch, searchQuery, entry);
- }
- return entry;
- },
- shouldExpand: function shouldExpand(node) {
- return this.localSearch.active ? node.isExpandedOnSearch : node.isExpanded;
- },
- shouldOptionBeIncludedInSearchResult: function shouldOptionBeIncludedInSearchResult(node) {
- if (node.isMatched) return true;
- if (node.isBranch && node.hasMatchedDescendants && !this.flattenSearchResults) return true;
- if (!node.isRootNode && node.parentNode.showAllChildrenOnSearch) return true;
- return false;
- },
- shouldShowOptionInMenu: function shouldShowOptionInMenu(node) {
- if (this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(node)) {
- return false;
- }
- return true;
- },
- getControl: function getControl() {
- return this.$refs.control.$el;
- },
- getMenu: function getMenu() {
- var ref = this.appendToBody ? this.$refs.portal.portalTarget : this;
- var $menu = ref.$refs.menu.$refs.menu;
- return $menu && $menu.nodeName !== '#comment' ? $menu : null;
- },
- setCurrentHighlightedOption: function setCurrentHighlightedOption(node) {
- var _this14 = this;
- var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- var prev = this.menu.current;
- if (prev != null && prev in this.forest.nodeMap) {
- this.forest.nodeMap[prev].isHighlighted = false;
- }
- this.menu.current = node.id;
- node.isHighlighted = true;
- if (this.menu.isOpen && scroll) {
- var scrollToOption = function scrollToOption() {
- var $menu = _this14.getMenu();
- var $option = $menu.querySelector(".vue-treeselect__option[data-id=\"".concat(node.id, "\"]"));
- if ($option) scrollIntoView($menu, $option);
- };
- if (this.getMenu()) {
- scrollToOption();
- } else {
- this.$nextTick(scrollToOption);
- }
- }
- },
- resetHighlightedOptionWhenNecessary: function resetHighlightedOptionWhenNecessary() {
- var forceReset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var current = this.menu.current;
- if (forceReset || current == null || !(current in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(current))) {
- this.highlightFirstOption();
- }
- },
- highlightFirstOption: function highlightFirstOption() {
- if (!this.hasVisibleOptions) return;
- var first = this.visibleOptionIds[0];
- this.setCurrentHighlightedOption(this.getNode(first));
- },
- highlightPrevOption: function highlightPrevOption() {
- if (!this.hasVisibleOptions) return;
- var prev = this.visibleOptionIds.indexOf(this.menu.current) - 1;
- if (prev === -1) return this.highlightLastOption();
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[prev]));
- },
- highlightNextOption: function highlightNextOption() {
- if (!this.hasVisibleOptions) return;
- var next = this.visibleOptionIds.indexOf(this.menu.current) + 1;
- if (next === this.visibleOptionIds.length) return this.highlightFirstOption();
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[next]));
- },
- highlightLastOption: function highlightLastOption() {
- if (!this.hasVisibleOptions) return;
- var last = last_default()(this.visibleOptionIds);
- this.setCurrentHighlightedOption(this.getNode(last));
- },
- resetSearchQuery: function resetSearchQuery() {
- this.trigger.searchQuery = '';
- },
- closeMenu: function closeMenu() {
- if (!this.menu.isOpen || !this.disabled && this.alwaysOpen) return;
- this.saveMenuScrollPosition();
- this.menu.isOpen = false;
- this.toggleClickOutsideEvent(false);
- this.resetSearchQuery();
- this.$emit('close', this.getValue(), this.getInstanceId());
- },
- openMenu: function openMenu() {
- if (this.disabled || this.menu.isOpen) return;
- this.menu.isOpen = true;
- this.$nextTick(this.resetHighlightedOptionWhenNecessary);
- this.$nextTick(this.restoreMenuScrollPosition);
- if (!this.options && !this.async) this.loadRootOptions();
- this.toggleClickOutsideEvent(true);
- this.$emit('open', this.getInstanceId());
- },
- toggleMenu: function toggleMenu() {
- if (this.menu.isOpen) {
- this.closeMenu();
- } else {
- this.openMenu();
- }
- },
- toggleExpanded: function toggleExpanded(node) {
- var nextState;
- if (this.localSearch.active) {
- nextState = node.isExpandedOnSearch = !node.isExpandedOnSearch;
- if (nextState) node.showAllChildrenOnSearch = true;
- } else {
- nextState = node.isExpanded = !node.isExpanded;
- }
- if (nextState && !node.childrenStates.isLoaded) {
- this.loadChildrenOptions(node);
- }
- },
- buildForestState: function buildForestState() {
- var _this15 = this;
- var selectedNodeMap = createMap();
- this.forest.selectedNodeIds.forEach(function (selectedNodeId) {
- selectedNodeMap[selectedNodeId] = true;
- });
- this.forest.selectedNodeMap = selectedNodeMap;
- var checkedStateMap = createMap();
- if (this.multiple) {
- this.traverseAllNodesByIndex(function (node) {
- checkedStateMap[node.id] = UNCHECKED;
- });
- this.selectedNodes.forEach(function (selectedNode) {
- checkedStateMap[selectedNode.id] = CHECKED;
- if (!_this15.flat && !_this15.disableBranchNodes) {
- selectedNode.ancestors.forEach(function (ancestorNode) {
- if (!_this15.isSelected(ancestorNode)) {
- checkedStateMap[ancestorNode.id] = INDETERMINATE;
- }
- });
- }
- });
- }
- this.forest.checkedStateMap = checkedStateMap;
- },
- enhancedNormalizer: function enhancedNormalizer(raw) {
- return _objectSpread({}, raw, {}, this.normalizer(raw, this.getInstanceId()));
- },
- normalize: function normalize(parentNode, nodes, prevNodeMap) {
- var _this16 = this;
- var normalizedOptions = nodes.map(function (node) {
- return [_this16.enhancedNormalizer(node), node];
- }).map(function (_ref, index) {
- var _ref2 = slicedToArray_default()(_ref, 2),
- node = _ref2[0],
- raw = _ref2[1];
- _this16.checkDuplication(node);
- _this16.verifyNodeShape(node);
- var id = node.id,
- label = node.label,
- children = node.children,
- isDefaultExpanded = node.isDefaultExpanded;
- var isRootNode = parentNode === NO_PARENT_NODE;
- var level = isRootNode ? 0 : parentNode.level + 1;
- var isBranch = Array.isArray(children) || children === null;
- var isLeaf = !isBranch;
- var isDisabled = !!node.isDisabled || !_this16.flat && !isRootNode && parentNode.isDisabled;
- var isNew = !!node.isNew;
- var lowerCased = _this16.matchKeys.reduce(function (prev, key) {
- return _objectSpread({}, prev, defineProperty_default()({}, key, stringifyOptionPropValue(node[key]).toLocaleLowerCase()));
- }, {});
- var nestedSearchLabel = isRootNode ? lowerCased.label : parentNode.nestedSearchLabel + ' ' + lowerCased.label;
- var normalized = _this16.$set(_this16.forest.nodeMap, id, createMap());
- _this16.$set(normalized, 'id', id);
- _this16.$set(normalized, 'label', label);
- _this16.$set(normalized, 'level', level);
- _this16.$set(normalized, 'ancestors', isRootNode ? [] : [parentNode].concat(parentNode.ancestors));
- _this16.$set(normalized, 'index', (isRootNode ? [] : parentNode.index).concat(index));
- _this16.$set(normalized, 'parentNode', parentNode);
- _this16.$set(normalized, 'lowerCased', lowerCased);
- _this16.$set(normalized, 'nestedSearchLabel', nestedSearchLabel);
- _this16.$set(normalized, 'isDisabled', isDisabled);
- _this16.$set(normalized, 'isNew', isNew);
- _this16.$set(normalized, 'isMatched', false);
- _this16.$set(normalized, 'isHighlighted', false);
- _this16.$set(normalized, 'isBranch', isBranch);
- _this16.$set(normalized, 'isLeaf', isLeaf);
- _this16.$set(normalized, 'isRootNode', isRootNode);
- _this16.$set(normalized, 'raw', raw);
- if (isBranch) {
- var _this16$$set;
- var isLoaded = Array.isArray(children);
- _this16.$set(normalized, 'childrenStates', _objectSpread({}, createAsyncOptionsStates(), {
- isLoaded: isLoaded
- }));
- _this16.$set(normalized, 'isExpanded', typeof isDefaultExpanded === 'boolean' ? isDefaultExpanded : level < _this16.defaultExpandLevel);
- _this16.$set(normalized, 'hasMatchedDescendants', false);
- _this16.$set(normalized, 'hasDisabledDescendants', false);
- _this16.$set(normalized, 'isExpandedOnSearch', false);
- _this16.$set(normalized, 'showAllChildrenOnSearch', false);
- _this16.$set(normalized, 'count', (_this16$$set = {}, defineProperty_default()(_this16$$set, ALL_CHILDREN, 0), defineProperty_default()(_this16$$set, ALL_DESCENDANTS, 0), defineProperty_default()(_this16$$set, LEAF_CHILDREN, 0), defineProperty_default()(_this16$$set, LEAF_DESCENDANTS, 0), _this16$$set));
- _this16.$set(normalized, 'children', isLoaded ? _this16.normalize(normalized, children, prevNodeMap) : []);
- if (isDefaultExpanded === true) normalized.ancestors.forEach(function (ancestor) {
- ancestor.isExpanded = true;
- });
- if (!isLoaded && typeof _this16.loadOptions !== 'function') {
- warning_warning(function () {
- return false;
- }, function () {
- return 'Unloaded branch node detected. "loadOptions" prop is required to load its children.';
- });
- } else if (!isLoaded && normalized.isExpanded) {
- _this16.loadChildrenOptions(normalized);
- }
- }
- normalized.ancestors.forEach(function (ancestor) {
- return ancestor.count[ALL_DESCENDANTS]++;
- });
- if (isLeaf) normalized.ancestors.forEach(function (ancestor) {
- return ancestor.count[LEAF_DESCENDANTS]++;
- });
- if (!isRootNode) {
- parentNode.count[ALL_CHILDREN] += 1;
- if (isLeaf) parentNode.count[LEAF_CHILDREN] += 1;
- if (isDisabled) parentNode.hasDisabledDescendants = true;
- }
- if (prevNodeMap && prevNodeMap[id]) {
- var prev = prevNodeMap[id];
- normalized.isMatched = prev.isMatched;
- normalized.showAllChildrenOnSearch = prev.showAllChildrenOnSearch;
- normalized.isHighlighted = prev.isHighlighted;
- if (prev.isBranch && normalized.isBranch) {
- normalized.isExpanded = prev.isExpanded;
- normalized.isExpandedOnSearch = prev.isExpandedOnSearch;
- if (prev.childrenStates.isLoaded && !normalized.childrenStates.isLoaded) {
- normalized.isExpanded = false;
- } else {
- normalized.childrenStates = _objectSpread({}, prev.childrenStates);
- }
- }
- }
- return normalized;
- });
- if (this.branchNodesFirst) {
- var branchNodes = normalizedOptions.filter(function (option) {
- return option.isBranch;
- });
- var leafNodes = normalizedOptions.filter(function (option) {
- return option.isLeaf;
- });
- normalizedOptions = branchNodes.concat(leafNodes);
- }
- return normalizedOptions;
- },
- loadRootOptions: function loadRootOptions() {
- var _this17 = this;
- this.callLoadOptionsProp({
- action: LOAD_ROOT_OPTIONS,
- isPending: function isPending() {
- return _this17.rootOptionsStates.isLoading;
- },
- start: function start() {
- _this17.rootOptionsStates.isLoading = true;
- _this17.rootOptionsStates.loadingError = '';
- },
- succeed: function succeed() {
- _this17.rootOptionsStates.isLoaded = true;
- _this17.$nextTick(function () {
- _this17.resetHighlightedOptionWhenNecessary(true);
- });
- },
- fail: function fail(err) {
- _this17.rootOptionsStates.loadingError = getErrorMessage(err);
- },
- end: function end() {
- _this17.rootOptionsStates.isLoading = false;
- }
- });
- },
- loadChildrenOptions: function loadChildrenOptions(parentNode) {
- var _this18 = this;
- var id = parentNode.id,
- raw = parentNode.raw;
- this.callLoadOptionsProp({
- action: LOAD_CHILDREN_OPTIONS,
- args: {
- parentNode: raw
- },
- isPending: function isPending() {
- return _this18.getNode(id).childrenStates.isLoading;
- },
- start: function start() {
- _this18.getNode(id).childrenStates.isLoading = true;
- _this18.getNode(id).childrenStates.loadingError = '';
- },
- succeed: function succeed() {
- _this18.getNode(id).childrenStates.isLoaded = true;
- },
- fail: function fail(err) {
- _this18.getNode(id).childrenStates.loadingError = getErrorMessage(err);
- },
- end: function end() {
- _this18.getNode(id).childrenStates.isLoading = false;
- }
- });
- },
- callLoadOptionsProp: function callLoadOptionsProp(_ref3) {
- var action = _ref3.action,
- args = _ref3.args,
- isPending = _ref3.isPending,
- start = _ref3.start,
- succeed = _ref3.succeed,
- fail = _ref3.fail,
- end = _ref3.end;
- if (!this.loadOptions || isPending()) {
- return;
- }
- start();
- var callback = once_default()(function (err, result) {
- if (err) {
- fail(err);
- } else {
- succeed(result);
- }
- end();
- });
- var result = this.loadOptions(_objectSpread({
- id: this.getInstanceId(),
- instanceId: this.getInstanceId(),
- action: action
- }, args, {
- callback: callback
- }));
- if (external_is_promise_default()(result)) {
- result.then(function () {
- callback();
- }, function (err) {
- callback(err);
- }).catch(function (err) {
- console.error(err);
- });
- }
- },
- checkDuplication: function checkDuplication(node) {
- var _this19 = this;
- warning_warning(function () {
- return !(node.id in _this19.forest.nodeMap && !_this19.forest.nodeMap[node.id].isFallbackNode);
- }, function () {
- 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.");
- });
- },
- verifyNodeShape: function verifyNodeShape(node) {
- warning_warning(function () {
- return !(node.children === undefined && node.isBranch === true);
- }, function () {
- return 'Are you meant to declare an unloaded branch node? ' + '`isBranch: true` is no longer supported, please use `children: null` instead.';
- });
- },
- select: function select(node) {
- if (this.disabled || node.isDisabled) {
- return;
- }
- if (this.single) {
- this.clear();
- }
- var nextState = this.multiple && !this.flat ? this.forest.checkedStateMap[node.id] === UNCHECKED : !this.isSelected(node);
- if (nextState) {
- this._selectNode(node);
- } else {
- this._deselectNode(node);
- }
- this.buildForestState();
- if (nextState) {
- this.$emit('select', node.raw, this.getInstanceId());
- } else {
- this.$emit('deselect', node.raw, this.getInstanceId());
- }
- if (this.localSearch.active && nextState && (this.single || this.clearOnSelect)) {
- this.resetSearchQuery();
- }
- if (this.single && this.closeOnSelect) {
- this.closeMenu();
- if (this.searchable) {
- this._blurOnSelect = true;
- }
- }
- },
- clear: function clear() {
- var _this20 = this;
- if (this.hasValue) {
- if (this.single || this.allowClearingDisabled) {
- this.forest.selectedNodeIds = [];
- } else {
- this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter(function (nodeId) {
- return _this20.getNode(nodeId).isDisabled;
- });
- }
- this.buildForestState();
- }
- },
- _selectNode: function _selectNode(node) {
- var _this21 = this;
- if (this.single || this.disableBranchNodes) {
- return this.addValue(node);
- }
- if (this.flat) {
- this.addValue(node);
- if (this.autoSelectAncestors) {
- node.ancestors.forEach(function (ancestor) {
- if (!_this21.isSelected(ancestor) && !ancestor.isDisabled) _this21.addValue(ancestor);
- });
- } else if (this.autoSelectDescendants) {
- this.traverseDescendantsBFS(node, function (descendant) {
- if (!_this21.isSelected(descendant) && !descendant.isDisabled) _this21.addValue(descendant);
- });
- }
- return;
- }
- var isFullyChecked = node.isLeaf || !node.hasDisabledDescendants || this.allowSelectingDisabledDescendants;
- if (isFullyChecked) {
- this.addValue(node);
- }
- if (node.isBranch) {
- this.traverseDescendantsBFS(node, function (descendant) {
- if (!descendant.isDisabled || _this21.allowSelectingDisabledDescendants) {
- _this21.addValue(descendant);
- }
- });
- }
- if (isFullyChecked) {
- var curr = node;
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
- if (curr.children.every(this.isSelected)) this.addValue(curr);else break;
- }
- }
- },
- _deselectNode: function _deselectNode(node) {
- var _this22 = this;
- if (this.disableBranchNodes) {
- return this.removeValue(node);
- }
- if (this.flat) {
- this.removeValue(node);
- if (this.autoDeselectAncestors) {
- node.ancestors.forEach(function (ancestor) {
- if (_this22.isSelected(ancestor) && !ancestor.isDisabled) _this22.removeValue(ancestor);
- });
- } else if (this.autoDeselectDescendants) {
- this.traverseDescendantsBFS(node, function (descendant) {
- if (_this22.isSelected(descendant) && !descendant.isDisabled) _this22.removeValue(descendant);
- });
- }
- return;
- }
- var hasUncheckedSomeDescendants = false;
- if (node.isBranch) {
- this.traverseDescendantsDFS(node, function (descendant) {
- if (!descendant.isDisabled || _this22.allowSelectingDisabledDescendants) {
- _this22.removeValue(descendant);
- hasUncheckedSomeDescendants = true;
- }
- });
- }
- if (node.isLeaf || hasUncheckedSomeDescendants || node.children.length === 0) {
- this.removeValue(node);
- var curr = node;
- while ((curr = curr.parentNode) !== NO_PARENT_NODE) {
- if (this.isSelected(curr)) this.removeValue(curr);else break;
- }
- }
- },
- addValue: function addValue(node) {
- this.forest.selectedNodeIds.push(node.id);
- this.forest.selectedNodeMap[node.id] = true;
- },
- removeValue: function removeValue(node) {
- removeFromArray(this.forest.selectedNodeIds, node.id);
- delete this.forest.selectedNodeMap[node.id];
- },
- removeLastValue: function removeLastValue() {
- if (!this.hasValue) return;
- if (this.single) return this.clear();
- var lastValue = last_default()(this.internalValue);
- var lastSelectedNode = this.getNode(lastValue);
- this.select(lastSelectedNode);
- },
- saveMenuScrollPosition: function saveMenuScrollPosition() {
- var $menu = this.getMenu();
- if ($menu) this.menu.lastScrollPosition = $menu.scrollTop;
- },
- restoreMenuScrollPosition: function restoreMenuScrollPosition() {
- var $menu = this.getMenu();
- if ($menu) $menu.scrollTop = this.menu.lastScrollPosition;
- }
- },
- created: function created() {
- this.verifyProps();
- this.resetFlags();
- },
- mounted: function mounted() {
- if (this.autoFocus) this.focusInput();
- if (!this.options && !this.async && this.autoLoadRootOptions) this.loadRootOptions();
- if (this.alwaysOpen) this.openMenu();
- if (this.async && this.defaultOptions) this.handleRemoteSearch();
- },
- destroyed: function destroyed() {
- this.toggleClickOutsideEvent(false);
- }
- });
- // 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&
- function stringifyValue(value) {
- if (typeof value === 'string') return value;
- if (value != null && !isNaN_isNaN(value)) return JSON.stringify(value);
- return '';
- }
- /* harmony default export */ var HiddenFieldsvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--hidden-fields',
- inject: ['instance'],
- functional: true,
- render: function render(_, context) {
- var h = arguments[0];
- var instance = context.injections.instance;
- if (!instance.name || instance.disabled || !instance.hasValue) return null;
- var stringifiedValues = instance.internalValue.map(stringifyValue);
- if (instance.multiple && instance.joinValues) stringifiedValues = [stringifiedValues.join(instance.delimiter)];
- return stringifiedValues.map(function (stringifiedValue, i) {
- return h("input", {
- attrs: {
- type: "hidden",
- name: instance.name
- },
- domProps: {
- "value": stringifiedValue
- },
- key: 'hidden-field-' + i
- });
- });
- }
- });
- // CONCATENATED MODULE: ./src/components/HiddenFields.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_HiddenFieldsvue_type_script_lang_js_ = (HiddenFieldsvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
- /* globals __VUE_SSR_CONTEXT__ */
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
- // This module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle.
- function normalizeComponent (
- scriptExports,
- render,
- staticRenderFns,
- functionalTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier, /* server only */
- shadowMode /* vue-cli only */
- ) {
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // render functions
- if (render) {
- options.render = render
- options.staticRenderFns = staticRenderFns
- options._compiled = true
- }
- // functional template
- if (functionalTemplate) {
- options.functional = true
- }
- // scopedId
- if (scopeId) {
- options._scopeId = 'data-v-' + scopeId
- }
- var hook
- if (moduleIdentifier) { // server build
- hook = function (context) {
- // 2.3 injection
- context =
- context || // cached call
- (this.$vnode && this.$vnode.ssrContext) || // stateful
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
- // 2.2 with runInNewContext: true
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
- context = __VUE_SSR_CONTEXT__
- }
- // inject component styles
- if (injectStyles) {
- injectStyles.call(this, context)
- }
- // register component module identifier for async chunk inferrence
- if (context && context._registeredComponents) {
- context._registeredComponents.add(moduleIdentifier)
- }
- }
- // used by ssr in case component is cached and beforeCreate
- // never gets called
- options._ssrRegister = hook
- } else if (injectStyles) {
- hook = shadowMode
- ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
- : injectStyles
- }
- if (hook) {
- if (options.functional) {
- // for template-only hot-reload because in that case the render fn doesn't
- // go through the normalizer
- options._injectStyles = hook
- // register for functioal component in vue file
- var originalRender = options.render
- options.render = function renderWithStyleInjection (h, context) {
- hook.call(context)
- return originalRender(h, context)
- }
- } else {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
- }
- return {
- exports: scriptExports,
- options: options
- }
- }
- // CONCATENATED MODULE: ./src/components/HiddenFields.vue
- var HiddenFields_render, staticRenderFns
- /* normalize component */
- var component = normalizeComponent(
- components_HiddenFieldsvue_type_script_lang_js_,
- HiddenFields_render,
- staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var api; }
- component.options.__file = "src/components/HiddenFields.vue"
- /* harmony default export */ var HiddenFields = (component.exports);
- // EXTERNAL MODULE: external "babel-helper-vue-jsx-merge-props"
- var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(13);
- var external_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
- // 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&
- 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];
- /* harmony default export */ var Inputvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--input',
- inject: ['instance'],
- data: function data() {
- return {
- inputWidth: MIN_INPUT_WIDTH,
- value: ''
- };
- },
- computed: {
- needAutoSize: function needAutoSize() {
- var instance = this.instance;
- return instance.searchable && !instance.disabled && instance.multiple;
- },
- inputStyle: function inputStyle() {
- return {
- width: this.needAutoSize ? "".concat(this.inputWidth, "px") : null
- };
- }
- },
- watch: {
- 'instance.trigger.searchQuery': function instanceTriggerSearchQuery(newValue) {
- this.value = newValue;
- },
- value: function value() {
- if (this.needAutoSize) this.$nextTick(this.updateInputWidth);
- }
- },
- created: function created() {
- this.debouncedCallback = debounce_default()(this.updateSearchQuery, INPUT_DEBOUNCE_DELAY, {
- leading: true,
- trailing: true
- });
- },
- methods: {
- clear: function clear() {
- this.onInput({
- target: {
- value: ''
- }
- });
- },
- focus: function focus() {
- var instance = this.instance;
- if (!instance.disabled) {
- this.$refs.input && this.$refs.input.focus();
- }
- },
- blur: function blur() {
- this.$refs.input && this.$refs.input.blur();
- },
- onFocus: function onFocus() {
- var instance = this.instance;
- instance.trigger.isFocused = true;
- if (instance.openOnFocus) instance.openMenu();
- },
- onBlur: function onBlur() {
- var instance = this.instance;
- var menu = instance.getMenu();
- if (menu && document.activeElement === menu) {
- return this.focus();
- }
- instance.trigger.isFocused = false;
- instance.closeMenu();
- },
- onInput: function onInput(evt) {
- var value = evt.target.value;
- this.value = value;
- if (value) {
- this.debouncedCallback();
- } else {
- this.debouncedCallback.cancel();
- this.updateSearchQuery();
- }
- },
- onKeyDown: function onKeyDown(evt) {
- var instance = this.instance;
- var key = 'which' in evt ? evt.which : evt.keyCode;
- if (evt.ctrlKey || evt.shiftKey || evt.altKey || evt.metaKey) return;
- if (!instance.menu.isOpen && includes(keysThatRequireMenuBeingOpen, key)) {
- evt.preventDefault();
- return instance.openMenu();
- }
- switch (key) {
- case KEY_CODES.BACKSPACE:
- {
- if (instance.backspaceRemoves && !this.value.length) {
- instance.removeLastValue();
- }
- break;
- }
- case KEY_CODES.ENTER:
- {
- evt.preventDefault();
- if (instance.menu.current === null) return;
- var current = instance.getNode(instance.menu.current);
- if (current.isBranch && instance.disableBranchNodes) return;
- instance.select(current);
- break;
- }
- case KEY_CODES.ESCAPE:
- {
- if (this.value.length) {
- this.clear();
- } else if (instance.menu.isOpen) {
- instance.closeMenu();
- }
- break;
- }
- case KEY_CODES.END:
- {
- evt.preventDefault();
- instance.highlightLastOption();
- break;
- }
- case KEY_CODES.HOME:
- {
- evt.preventDefault();
- instance.highlightFirstOption();
- break;
- }
- case KEY_CODES.ARROW_LEFT:
- {
- var _current = instance.getNode(instance.menu.current);
- if (_current.isBranch && instance.shouldExpand(_current)) {
- evt.preventDefault();
- instance.toggleExpanded(_current);
- } else if (!_current.isRootNode && (_current.isLeaf || _current.isBranch && !instance.shouldExpand(_current))) {
- evt.preventDefault();
- instance.setCurrentHighlightedOption(_current.parentNode);
- }
- break;
- }
- case KEY_CODES.ARROW_UP:
- {
- evt.preventDefault();
- instance.highlightPrevOption();
- break;
- }
- case KEY_CODES.ARROW_RIGHT:
- {
- var _current2 = instance.getNode(instance.menu.current);
- if (_current2.isBranch && !instance.shouldExpand(_current2)) {
- evt.preventDefault();
- instance.toggleExpanded(_current2);
- }
- break;
- }
- case KEY_CODES.ARROW_DOWN:
- {
- evt.preventDefault();
- instance.highlightNextOption();
- break;
- }
- case KEY_CODES.DELETE:
- {
- if (instance.deleteRemoves && !this.value.length) {
- instance.removeLastValue();
- }
- break;
- }
- default:
- {
- instance.openMenu();
- }
- }
- },
- onMouseDown: function onMouseDown(evt) {
- if (this.value.length) {
- evt.stopPropagation();
- }
- },
- renderInputContainer: function renderInputContainer() {
- var h = this.$createElement;
- var instance = this.instance;
- var props = {};
- var children = [];
- if (instance.searchable && !instance.disabled) {
- children.push(this.renderInput());
- if (this.needAutoSize) children.push(this.renderSizer());
- }
- if (!instance.searchable) {
- deepExtend(props, {
- on: {
- focus: this.onFocus,
- blur: this.onBlur,
- keydown: this.onKeyDown
- },
- ref: 'input'
- });
- }
- if (!instance.searchable && !instance.disabled) {
- deepExtend(props, {
- attrs: {
- tabIndex: instance.tabIndex
- }
- });
- }
- return h("div", external_babel_helper_vue_jsx_merge_props_default()([{
- "class": "vue-treeselect__input-container"
- }, props]), [children]);
- },
- renderInput: function renderInput() {
- var h = this.$createElement;
- var instance = this.instance;
- return h("input", {
- ref: "input",
- "class": "vue-treeselect__input",
- attrs: {
- type: "text",
- autocomplete: "off",
- tabIndex: instance.tabIndex,
- required: instance.required && !instance.hasValue
- },
- domProps: {
- "value": this.value
- },
- style: this.inputStyle,
- on: {
- "focus": this.onFocus,
- "input": this.onInput,
- "blur": this.onBlur,
- "keydown": this.onKeyDown,
- "mousedown": this.onMouseDown
- }
- });
- },
- renderSizer: function renderSizer() {
- var h = this.$createElement;
- return h("div", {
- ref: "sizer",
- "class": "vue-treeselect__sizer"
- }, [this.value]);
- },
- updateInputWidth: function updateInputWidth() {
- this.inputWidth = Math.max(MIN_INPUT_WIDTH, this.$refs.sizer.scrollWidth + 15);
- },
- updateSearchQuery: function updateSearchQuery() {
- var instance = this.instance;
- instance.trigger.searchQuery = this.value;
- }
- },
- render: function render() {
- return this.renderInputContainer();
- }
- });
- // CONCATENATED MODULE: ./src/components/Input.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_Inputvue_type_script_lang_js_ = (Inputvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/Input.vue
- var Input_render, Input_staticRenderFns
- /* normalize component */
- var Input_component = normalizeComponent(
- components_Inputvue_type_script_lang_js_,
- Input_render,
- Input_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Input_api; }
- Input_component.options.__file = "src/components/Input.vue"
- /* harmony default export */ var Input = (Input_component.exports);
- // 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&
- /* harmony default export */ var Placeholdervue_type_script_lang_js_ = ({
- name: 'vue-treeselect--placeholder',
- inject: ['instance'],
- render: function render() {
- var h = arguments[0];
- var instance = this.instance;
- var placeholderClass = {
- 'vue-treeselect__placeholder': true,
- 'vue-treeselect-helper-zoom-effect-off': true,
- 'vue-treeselect-helper-hide': instance.hasValue || instance.trigger.searchQuery
- };
- return h("div", {
- "class": placeholderClass
- }, [instance.placeholder]);
- }
- });
- // CONCATENATED MODULE: ./src/components/Placeholder.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_Placeholdervue_type_script_lang_js_ = (Placeholdervue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/Placeholder.vue
- var Placeholder_render, Placeholder_staticRenderFns
- /* normalize component */
- var Placeholder_component = normalizeComponent(
- components_Placeholdervue_type_script_lang_js_,
- Placeholder_render,
- Placeholder_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Placeholder_api; }
- Placeholder_component.options.__file = "src/components/Placeholder.vue"
- /* harmony default export */ var Placeholder = (Placeholder_component.exports);
- // 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&
- /* harmony default export */ var SingleValuevue_type_script_lang_js_ = ({
- name: 'vue-treeselect--single-value',
- inject: ['instance'],
- methods: {
- renderSingleValueLabel: function renderSingleValueLabel() {
- var instance = this.instance;
- var node = instance.selectedNodes[0];
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
- return customValueLabelRenderer ? customValueLabelRenderer({
- node: node
- }) : node.label;
- }
- },
- render: function render() {
- var h = arguments[0];
- var instance = this.instance,
- renderValueContainer = this.$parent.renderValueContainer;
- var shouldShowValue = instance.hasValue && !instance.trigger.searchQuery;
- return renderValueContainer([shouldShowValue && h("div", {
- "class": "vue-treeselect__single-value"
- }, [this.renderSingleValueLabel()]), h(Placeholder), h(Input, {
- ref: "input"
- })]);
- }
- });
- // CONCATENATED MODULE: ./src/components/SingleValue.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_SingleValuevue_type_script_lang_js_ = (SingleValuevue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/SingleValue.vue
- var SingleValue_render, SingleValue_staticRenderFns
- /* normalize component */
- var SingleValue_component = normalizeComponent(
- components_SingleValuevue_type_script_lang_js_,
- SingleValue_render,
- SingleValue_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var SingleValue_api; }
- SingleValue_component.options.__file = "src/components/SingleValue.vue"
- /* harmony default export */ var SingleValue = (SingleValue_component.exports);
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./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&
- var Deletevue_type_template_id_364b6320_render = function() {
- var _vm = this
- var _h = _vm.$createElement
- var _c = _vm._self._c || _h
- return _c(
- "svg",
- {
- attrs: {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 348.333 348.333"
- }
- },
- [
- _c("path", {
- attrs: {
- 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"
- }
- })
- ]
- )
- }
- var Deletevue_type_template_id_364b6320_staticRenderFns = []
- Deletevue_type_template_id_364b6320_render._withStripped = true
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=template&id=364b6320&
- // 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&
- /* harmony default export */ var Deletevue_type_script_lang_js_ = ({
- name: 'vue-treeselect--x'
- });
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue?vue&type=script&lang=js&
- /* harmony default export */ var icons_Deletevue_type_script_lang_js_ = (Deletevue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/icons/Delete.vue
- /* normalize component */
- var Delete_component = normalizeComponent(
- icons_Deletevue_type_script_lang_js_,
- Deletevue_type_template_id_364b6320_render,
- Deletevue_type_template_id_364b6320_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Delete_api; }
- Delete_component.options.__file = "src/components/icons/Delete.vue"
- /* harmony default export */ var Delete = (Delete_component.exports);
- // 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&
- /* harmony default export */ var MultiValueItemvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--multi-value-item',
- inject: ['instance'],
- props: {
- node: {
- type: Object,
- required: true
- }
- },
- methods: {
- handleMouseDown: onLeftClick(function handleMouseDown() {
- var instance = this.instance,
- node = this.node;
- instance.select(node);
- })
- },
- render: function render() {
- var h = arguments[0];
- var instance = this.instance,
- node = this.node;
- var itemClass = {
- 'vue-treeselect__multi-value-item': true,
- 'vue-treeselect__multi-value-item-disabled': node.isDisabled,
- 'vue-treeselect__multi-value-item-new': node.isNew
- };
- var customValueLabelRenderer = instance.$scopedSlots['value-label'];
- var labelRenderer = customValueLabelRenderer ? customValueLabelRenderer({
- node: node
- }) : node.label;
- return h("div", {
- "class": "vue-treeselect__multi-value-item-container"
- }, [h("div", {
- "class": itemClass,
- on: {
- "mousedown": this.handleMouseDown
- }
- }, [h("span", {
- "class": "vue-treeselect__multi-value-label"
- }, [labelRenderer]), h("span", {
- "class": "vue-treeselect__icon vue-treeselect__value-remove"
- }, [h(Delete)])])]);
- }
- });
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_MultiValueItemvue_type_script_lang_js_ = (MultiValueItemvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/MultiValueItem.vue
- var MultiValueItem_render, MultiValueItem_staticRenderFns
- /* normalize component */
- var MultiValueItem_component = normalizeComponent(
- components_MultiValueItemvue_type_script_lang_js_,
- MultiValueItem_render,
- MultiValueItem_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var MultiValueItem_api; }
- MultiValueItem_component.options.__file = "src/components/MultiValueItem.vue"
- /* harmony default export */ var MultiValueItem = (MultiValueItem_component.exports);
- // 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&
- /* harmony default export */ var MultiValuevue_type_script_lang_js_ = ({
- name: 'vue-treeselect--multi-value',
- inject: ['instance'],
- methods: {
- renderMultiValueItems: function renderMultiValueItems() {
- var h = this.$createElement;
- var instance = this.instance;
- return instance.internalValue.slice(0, instance.limit).map(instance.getNode).map(function (node) {
- return h(MultiValueItem, {
- key: "multi-value-item-".concat(node.id),
- attrs: {
- node: node
- }
- });
- });
- },
- renderExceedLimitTip: function renderExceedLimitTip() {
- var h = this.$createElement;
- var instance = this.instance;
- var count = instance.internalValue.length - instance.limit;
- if (count <= 0) return null;
- return h("div", {
- "class": "vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off",
- key: "exceed-limit-tip"
- }, [h("span", {
- "class": "vue-treeselect__limit-tip-text"
- }, [instance.limitText(count)])]);
- }
- },
- render: function render() {
- var h = arguments[0];
- var renderValueContainer = this.$parent.renderValueContainer;
- var transitionGroupProps = {
- props: {
- tag: 'div',
- name: 'vue-treeselect__multi-value-item--transition',
- appear: true
- }
- };
- return renderValueContainer(h("transition-group", external_babel_helper_vue_jsx_merge_props_default()([{
- "class": "vue-treeselect__multi-value"
- }, transitionGroupProps]), [this.renderMultiValueItems(), this.renderExceedLimitTip(), h(Placeholder, {
- key: "placeholder"
- }), h(Input, {
- ref: "input",
- key: "input"
- })]));
- }
- });
- // CONCATENATED MODULE: ./src/components/MultiValue.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_MultiValuevue_type_script_lang_js_ = (MultiValuevue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/MultiValue.vue
- var MultiValue_render, MultiValue_staticRenderFns
- /* normalize component */
- var MultiValue_component = normalizeComponent(
- components_MultiValuevue_type_script_lang_js_,
- MultiValue_render,
- MultiValue_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var MultiValue_api; }
- MultiValue_component.options.__file = "src/components/MultiValue.vue"
- /* harmony default export */ var MultiValue = (MultiValue_component.exports);
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./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&
- var Arrowvue_type_template_id_11186cd4_render = function() {
- var _vm = this
- var _h = _vm.$createElement
- var _c = _vm._self._c || _h
- return _c(
- "svg",
- {
- attrs: {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 292.362 292.362"
- }
- },
- [
- _c("path", {
- attrs: {
- 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"
- }
- })
- ]
- )
- }
- var Arrowvue_type_template_id_11186cd4_staticRenderFns = []
- Arrowvue_type_template_id_11186cd4_render._withStripped = true
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=template&id=11186cd4&
- // 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&
- /* harmony default export */ var Arrowvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--arrow'
- });
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue?vue&type=script&lang=js&
- /* harmony default export */ var icons_Arrowvue_type_script_lang_js_ = (Arrowvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/icons/Arrow.vue
- /* normalize component */
- var Arrow_component = normalizeComponent(
- icons_Arrowvue_type_script_lang_js_,
- Arrowvue_type_template_id_11186cd4_render,
- Arrowvue_type_template_id_11186cd4_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Arrow_api; }
- Arrow_component.options.__file = "src/components/icons/Arrow.vue"
- /* harmony default export */ var Arrow = (Arrow_component.exports);
- // 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&
- /* harmony default export */ var Controlvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--control',
- inject: ['instance'],
- computed: {
- shouldShowX: function shouldShowX() {
- var instance = this.instance;
- return instance.clearable && !instance.disabled && instance.hasValue && (this.hasUndisabledValue || instance.allowClearingDisabled);
- },
- shouldShowArrow: function shouldShowArrow() {
- var instance = this.instance;
- if (!instance.alwaysOpen) return true;
- return !instance.menu.isOpen;
- },
- hasUndisabledValue: function hasUndisabledValue() {
- var instance = this.instance;
- return instance.hasValue && instance.internalValue.some(function (id) {
- return !instance.getNode(id).isDisabled;
- });
- }
- },
- methods: {
- renderX: function renderX() {
- var h = this.$createElement;
- var instance = this.instance;
- var title = instance.multiple ? instance.clearAllText : instance.clearValueText;
- if (!this.shouldShowX) return null;
- return h("div", {
- "class": "vue-treeselect__x-container",
- attrs: {
- title: title
- },
- on: {
- "mousedown": this.handleMouseDownOnX
- }
- }, [h(Delete, {
- "class": "vue-treeselect__x"
- })]);
- },
- renderArrow: function renderArrow() {
- var h = this.$createElement;
- var instance = this.instance;
- var arrowClass = {
- 'vue-treeselect__control-arrow': true,
- 'vue-treeselect__control-arrow--rotated': instance.menu.isOpen
- };
- if (!this.shouldShowArrow) return null;
- return h("div", {
- "class": "vue-treeselect__control-arrow-container",
- on: {
- "mousedown": this.handleMouseDownOnArrow
- }
- }, [h(Arrow, {
- "class": arrowClass
- })]);
- },
- handleMouseDownOnX: onLeftClick(function handleMouseDownOnX(evt) {
- evt.stopPropagation();
- evt.preventDefault();
- var instance = this.instance;
- var result = instance.beforeClearAll();
- var handler = function handler(shouldClear) {
- if (shouldClear) instance.clear();
- };
- if (external_is_promise_default()(result)) {
- result.then(handler);
- } else {
- setTimeout(function () {
- return handler(result);
- }, 0);
- }
- }),
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnArrow(evt) {
- evt.preventDefault();
- evt.stopPropagation();
- var instance = this.instance;
- instance.focusInput();
- instance.toggleMenu();
- }),
- renderValueContainer: function renderValueContainer(children) {
- var h = this.$createElement;
- return h("div", {
- "class": "vue-treeselect__value-container"
- }, [children]);
- }
- },
- render: function render() {
- var h = arguments[0];
- var instance = this.instance;
- var ValueContainer = instance.single ? SingleValue : MultiValue;
- return h("div", {
- "class": "vue-treeselect__control",
- on: {
- "mousedown": instance.handleMouseDown
- }
- }, [h(ValueContainer, {
- ref: "value-container"
- }), this.renderX(), this.renderArrow()]);
- }
- });
- // CONCATENATED MODULE: ./src/components/Control.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_Controlvue_type_script_lang_js_ = (Controlvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/Control.vue
- var Control_render, Control_staticRenderFns
- /* normalize component */
- var Control_component = normalizeComponent(
- components_Controlvue_type_script_lang_js_,
- Control_render,
- Control_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Control_api; }
- Control_component.options.__file = "src/components/Control.vue"
- /* harmony default export */ var Control = (Control_component.exports);
- // 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&
- /* harmony default export */ var Tipvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--tip',
- functional: true,
- props: {
- type: {
- type: String,
- required: true
- },
- icon: {
- type: String,
- required: true
- }
- },
- render: function render(_, context) {
- var h = arguments[0];
- var props = context.props,
- children = context.children;
- return h("div", {
- "class": "vue-treeselect__tip vue-treeselect__".concat(props.type, "-tip")
- }, [h("div", {
- "class": "vue-treeselect__icon-container"
- }, [h("span", {
- "class": "vue-treeselect__icon-".concat(props.icon)
- })]), h("span", {
- "class": "vue-treeselect__tip-text vue-treeselect__".concat(props.type, "-tip-text")
- }, [children])]);
- }
- });
- // CONCATENATED MODULE: ./src/components/Tip.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_Tipvue_type_script_lang_js_ = (Tipvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/Tip.vue
- var Tip_render, Tip_staticRenderFns
- /* normalize component */
- var Tip_component = normalizeComponent(
- components_Tipvue_type_script_lang_js_,
- Tip_render,
- Tip_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Tip_api; }
- Tip_component.options.__file = "src/components/Tip.vue"
- /* harmony default export */ var Tip = (Tip_component.exports);
- // 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&
- var arrowPlaceholder, checkMark, minusMark;
- var Option = {
- name: 'vue-treeselect--option',
- inject: ['instance'],
- props: {
- node: {
- type: Object,
- required: true
- }
- },
- computed: {
- shouldExpand: function shouldExpand() {
- var instance = this.instance,
- node = this.node;
- return node.isBranch && instance.shouldExpand(node);
- },
- shouldShow: function shouldShow() {
- var instance = this.instance,
- node = this.node;
- return instance.shouldShowOptionInMenu(node);
- }
- },
- methods: {
- renderOption: function renderOption() {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- var optionClass = {
- 'vue-treeselect__option': true,
- 'vue-treeselect__option--disabled': node.isDisabled,
- 'vue-treeselect__option--selected': instance.isSelected(node),
- 'vue-treeselect__option--highlight': node.isHighlighted,
- 'vue-treeselect__option--matched': instance.localSearch.active && node.isMatched,
- 'vue-treeselect__option--hide': !this.shouldShow
- };
- return h("div", {
- "class": optionClass,
- on: {
- "mouseenter": this.handleMouseEnterOption
- },
- attrs: {
- "data-id": node.id
- }
- }, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
- },
- renderSubOptionsList: function renderSubOptionsList() {
- var h = this.$createElement;
- if (!this.shouldExpand) return null;
- return h("div", {
- "class": "vue-treeselect__list"
- }, [this.renderSubOptions(), this.renderNoChildrenTip(), this.renderLoadingChildrenTip(), this.renderLoadingChildrenErrorTip()]);
- },
- renderArrow: function renderArrow() {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- if (instance.shouldFlattenOptions && this.shouldShow) return null;
- if (node.isBranch) {
- var transitionProps = {
- props: {
- name: 'vue-treeselect__option-arrow--prepare',
- appear: true
- }
- };
- var arrowClass = {
- 'vue-treeselect__option-arrow': true,
- 'vue-treeselect__option-arrow--rotated': this.shouldExpand
- };
- return h("div", {
- "class": "vue-treeselect__option-arrow-container",
- on: {
- "mousedown": this.handleMouseDownOnArrow
- }
- }, [h("transition", transitionProps, [h(Arrow, {
- "class": arrowClass
- })])]);
- }
- if (instance.hasBranchNodes) {
- if (!arrowPlaceholder) arrowPlaceholder = h("div", {
- "class": "vue-treeselect__option-arrow-placeholder"
- }, ["\xA0"]);
- return arrowPlaceholder;
- }
- return null;
- },
- renderLabelContainer: function renderLabelContainer(children) {
- var h = this.$createElement;
- return h("div", {
- "class": "vue-treeselect__label-container",
- on: {
- "mousedown": this.handleMouseDownOnLabelContainer
- }
- }, [children]);
- },
- renderCheckboxContainer: function renderCheckboxContainer(children) {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- if (instance.single) return null;
- if (instance.disableBranchNodes && node.isBranch) return null;
- return h("div", {
- "class": "vue-treeselect__checkbox-container"
- }, [children]);
- },
- renderCheckbox: function renderCheckbox() {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- var checkedState = instance.forest.checkedStateMap[node.id];
- var checkboxClass = {
- 'vue-treeselect__checkbox': true,
- 'vue-treeselect__checkbox--checked': checkedState === CHECKED,
- 'vue-treeselect__checkbox--indeterminate': checkedState === INDETERMINATE,
- 'vue-treeselect__checkbox--unchecked': checkedState === UNCHECKED,
- 'vue-treeselect__checkbox--disabled': node.isDisabled
- };
- if (!checkMark) checkMark = h("span", {
- "class": "vue-treeselect__check-mark"
- });
- if (!minusMark) minusMark = h("span", {
- "class": "vue-treeselect__minus-mark"
- });
- return h("span", {
- "class": checkboxClass
- }, [checkMark, minusMark]);
- },
- renderLabel: function renderLabel() {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- var shouldShowCount = node.isBranch && (instance.localSearch.active ? instance.showCountOnSearchComputed : instance.showCount);
- var count = shouldShowCount ? instance.localSearch.active ? instance.localSearch.countMap[node.id][instance.showCountOf] : node.count[instance.showCountOf] : NaN;
- var labelClassName = 'vue-treeselect__label';
- var countClassName = 'vue-treeselect__count';
- var customLabelRenderer = instance.$scopedSlots['option-label'];
- if (customLabelRenderer) return customLabelRenderer({
- node: node,
- shouldShowCount: shouldShowCount,
- count: count,
- labelClassName: labelClassName,
- countClassName: countClassName
- });
- return h("label", {
- "class": labelClassName
- }, [node.label, shouldShowCount && h("span", {
- "class": countClassName
- }, ["(", count, ")"])]);
- },
- renderSubOptions: function renderSubOptions() {
- var h = this.$createElement;
- var node = this.node;
- if (!node.childrenStates.isLoaded) return null;
- return node.children.map(function (childNode) {
- return h(Option, {
- attrs: {
- node: childNode
- },
- key: childNode.id
- });
- });
- },
- renderNoChildrenTip: function renderNoChildrenTip() {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- if (!node.childrenStates.isLoaded || node.children.length) return null;
- return h(Tip, {
- attrs: {
- type: "no-children",
- icon: "warning"
- }
- }, [instance.noChildrenText]);
- },
- renderLoadingChildrenTip: function renderLoadingChildrenTip() {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- if (!node.childrenStates.isLoading) return null;
- return h(Tip, {
- attrs: {
- type: "loading",
- icon: "loader"
- }
- }, [instance.loadingText]);
- },
- renderLoadingChildrenErrorTip: function renderLoadingChildrenErrorTip() {
- var h = this.$createElement;
- var instance = this.instance,
- node = this.node;
- if (!node.childrenStates.loadingError) return null;
- return h(Tip, {
- attrs: {
- type: "error",
- icon: "error"
- }
- }, [node.childrenStates.loadingError, h("a", {
- "class": "vue-treeselect__retry",
- attrs: {
- title: instance.retryTitle
- },
- on: {
- "mousedown": this.handleMouseDownOnRetry
- }
- }, [instance.retryText])]);
- },
- handleMouseEnterOption: function handleMouseEnterOption(evt) {
- var instance = this.instance,
- node = this.node;
- if (evt.target !== evt.currentTarget) return;
- instance.setCurrentHighlightedOption(node, false);
- },
- handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnOptionArrow() {
- var instance = this.instance,
- node = this.node;
- instance.toggleExpanded(node);
- }),
- handleMouseDownOnLabelContainer: onLeftClick(function handleMouseDownOnLabelContainer() {
- var instance = this.instance,
- node = this.node;
- if (node.isBranch && instance.disableBranchNodes) {
- instance.toggleExpanded(node);
- } else {
- instance.select(node);
- }
- }),
- handleMouseDownOnRetry: onLeftClick(function handleMouseDownOnRetry() {
- var instance = this.instance,
- node = this.node;
- instance.loadChildrenOptions(node);
- })
- },
- render: function render() {
- var h = arguments[0];
- var node = this.node;
- var indentLevel = this.instance.shouldFlattenOptions ? 0 : node.level;
- var listItemClass = defineProperty_default()({
- 'vue-treeselect__list-item': true
- }, "vue-treeselect__indent-level-".concat(indentLevel), true);
- var transitionProps = {
- props: {
- name: 'vue-treeselect__list--transition'
- }
- };
- return h("div", {
- "class": listItemClass
- }, [this.renderOption(), node.isBranch && h("transition", transitionProps, [this.renderSubOptionsList()])]);
- }
- };
- /* harmony default export */ var Optionvue_type_script_lang_js_ = (Option);
- // CONCATENATED MODULE: ./src/components/Option.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_Optionvue_type_script_lang_js_ = (Optionvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/Option.vue
- var Option_render, Option_staticRenderFns
- /* normalize component */
- var Option_component = normalizeComponent(
- components_Optionvue_type_script_lang_js_,
- Option_render,
- Option_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Option_api; }
- Option_component.options.__file = "src/components/Option.vue"
- /* harmony default export */ var components_Option = (Option_component.exports);
- // 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&
- var directionMap = {
- top: 'top',
- bottom: 'bottom',
- above: 'top',
- below: 'bottom'
- };
- /* harmony default export */ var Menuvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--menu',
- inject: ['instance'],
- computed: {
- menuStyle: function menuStyle() {
- var instance = this.instance;
- return {
- maxHeight: instance.maxHeight + 'px'
- };
- },
- menuContainerStyle: function menuContainerStyle() {
- var instance = this.instance;
- return {
- zIndex: instance.appendToBody ? null : instance.zIndex
- };
- }
- },
- watch: {
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
- if (newValue) {
- this.$nextTick(this.onMenuOpen);
- } else {
- this.onMenuClose();
- }
- }
- },
- created: function created() {
- this.menuSizeWatcher = null;
- this.menuResizeAndScrollEventListeners = null;
- },
- mounted: function mounted() {
- var instance = this.instance;
- if (instance.menu.isOpen) this.$nextTick(this.onMenuOpen);
- },
- destroyed: function destroyed() {
- this.onMenuClose();
- },
- methods: {
- renderMenu: function renderMenu() {
- var h = this.$createElement;
- var instance = this.instance;
- if (!instance.menu.isOpen) return null;
- return h("div", {
- ref: "menu",
- "class": "vue-treeselect__menu",
- on: {
- "mousedown": instance.handleMouseDown
- },
- style: this.menuStyle
- }, [this.renderBeforeList(), instance.async ? this.renderAsyncSearchMenuInner() : instance.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(), this.renderAfterList()]);
- },
- renderBeforeList: function renderBeforeList() {
- var instance = this.instance;
- var beforeListRenderer = instance.$scopedSlots['before-list'];
- return beforeListRenderer ? beforeListRenderer() : null;
- },
- renderAfterList: function renderAfterList() {
- var instance = this.instance;
- var afterListRenderer = instance.$scopedSlots['after-list'];
- return afterListRenderer ? afterListRenderer() : null;
- },
- renderNormalMenuInner: function renderNormalMenuInner() {
- var instance = this.instance;
- if (instance.rootOptionsStates.isLoading) {
- return this.renderLoadingOptionsTip();
- } else if (instance.rootOptionsStates.loadingError) {
- return this.renderLoadingRootOptionsErrorTip();
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
- return this.renderNoAvailableOptionsTip();
- } else {
- return this.renderOptionList();
- }
- },
- renderLocalSearchMenuInner: function renderLocalSearchMenuInner() {
- var instance = this.instance;
- if (instance.rootOptionsStates.isLoading) {
- return this.renderLoadingOptionsTip();
- } else if (instance.rootOptionsStates.loadingError) {
- return this.renderLoadingRootOptionsErrorTip();
- } else if (instance.rootOptionsStates.isLoaded && instance.forest.normalizedOptions.length === 0) {
- return this.renderNoAvailableOptionsTip();
- } else if (instance.localSearch.noResults) {
- return this.renderNoResultsTip();
- } else {
- return this.renderOptionList();
- }
- },
- renderAsyncSearchMenuInner: function renderAsyncSearchMenuInner() {
- var instance = this.instance;
- var entry = instance.getRemoteSearchEntry();
- var shouldShowSearchPromptTip = instance.trigger.searchQuery === '' && !instance.defaultOptions;
- var shouldShowNoResultsTip = shouldShowSearchPromptTip ? false : entry.isLoaded && entry.options.length === 0;
- if (shouldShowSearchPromptTip) {
- return this.renderSearchPromptTip();
- } else if (entry.isLoading) {
- return this.renderLoadingOptionsTip();
- } else if (entry.loadingError) {
- return this.renderAsyncSearchLoadingErrorTip();
- } else if (shouldShowNoResultsTip) {
- return this.renderNoResultsTip();
- } else {
- return this.renderOptionList();
- }
- },
- renderOptionList: function renderOptionList() {
- var h = this.$createElement;
- var instance = this.instance;
- return h("div", {
- "class": "vue-treeselect__list"
- }, [instance.forest.normalizedOptions.map(function (rootNode) {
- return h(components_Option, {
- attrs: {
- node: rootNode
- },
- key: rootNode.id
- });
- })]);
- },
- renderSearchPromptTip: function renderSearchPromptTip() {
- var h = this.$createElement;
- var instance = this.instance;
- return h(Tip, {
- attrs: {
- type: "search-prompt",
- icon: "warning"
- }
- }, [instance.searchPromptText]);
- },
- renderLoadingOptionsTip: function renderLoadingOptionsTip() {
- var h = this.$createElement;
- var instance = this.instance;
- return h(Tip, {
- attrs: {
- type: "loading",
- icon: "loader"
- }
- }, [instance.loadingText]);
- },
- renderLoadingRootOptionsErrorTip: function renderLoadingRootOptionsErrorTip() {
- var h = this.$createElement;
- var instance = this.instance;
- return h(Tip, {
- attrs: {
- type: "error",
- icon: "error"
- }
- }, [instance.rootOptionsStates.loadingError, h("a", {
- "class": "vue-treeselect__retry",
- on: {
- "click": instance.loadRootOptions
- },
- attrs: {
- title: instance.retryTitle
- }
- }, [instance.retryText])]);
- },
- renderAsyncSearchLoadingErrorTip: function renderAsyncSearchLoadingErrorTip() {
- var h = this.$createElement;
- var instance = this.instance;
- var entry = instance.getRemoteSearchEntry();
- return h(Tip, {
- attrs: {
- type: "error",
- icon: "error"
- }
- }, [entry.loadingError, h("a", {
- "class": "vue-treeselect__retry",
- on: {
- "click": instance.handleRemoteSearch
- },
- attrs: {
- title: instance.retryTitle
- }
- }, [instance.retryText])]);
- },
- renderNoAvailableOptionsTip: function renderNoAvailableOptionsTip() {
- var h = this.$createElement;
- var instance = this.instance;
- return h(Tip, {
- attrs: {
- type: "no-options",
- icon: "warning"
- }
- }, [instance.noOptionsText]);
- },
- renderNoResultsTip: function renderNoResultsTip() {
- var h = this.$createElement;
- var instance = this.instance;
- return h(Tip, {
- attrs: {
- type: "no-results",
- icon: "warning"
- }
- }, [instance.noResultsText]);
- },
- onMenuOpen: function onMenuOpen() {
- this.adjustMenuOpenDirection();
- this.setupMenuSizeWatcher();
- this.setupMenuResizeAndScrollEventListeners();
- },
- onMenuClose: function onMenuClose() {
- this.removeMenuSizeWatcher();
- this.removeMenuResizeAndScrollEventListeners();
- },
- adjustMenuOpenDirection: function adjustMenuOpenDirection() {
- var instance = this.instance;
- if (!instance.menu.isOpen) return;
- var $menu = instance.getMenu();
- var $control = instance.getControl();
- var menuRect = $menu.getBoundingClientRect();
- var controlRect = $control.getBoundingClientRect();
- var menuHeight = menuRect.height;
- var viewportHeight = window.innerHeight;
- var spaceAbove = controlRect.top;
- var spaceBelow = window.innerHeight - controlRect.bottom;
- var isControlInViewport = controlRect.top >= 0 && controlRect.top <= viewportHeight || controlRect.top < 0 && controlRect.bottom > 0;
- var hasEnoughSpaceBelow = spaceBelow > menuHeight + MENU_BUFFER;
- var hasEnoughSpaceAbove = spaceAbove > menuHeight + MENU_BUFFER;
- if (!isControlInViewport) {
- instance.closeMenu();
- } else if (instance.openDirection !== 'auto') {
- instance.menu.placement = directionMap[instance.openDirection];
- } else if (hasEnoughSpaceBelow || !hasEnoughSpaceAbove) {
- instance.menu.placement = 'bottom';
- } else {
- instance.menu.placement = 'top';
- }
- },
- setupMenuSizeWatcher: function setupMenuSizeWatcher() {
- var instance = this.instance;
- var $menu = instance.getMenu();
- if (this.menuSizeWatcher) return;
- this.menuSizeWatcher = {
- remove: watchSize($menu, this.adjustMenuOpenDirection)
- };
- },
- setupMenuResizeAndScrollEventListeners: function setupMenuResizeAndScrollEventListeners() {
- var instance = this.instance;
- var $control = instance.getControl();
- if (this.menuResizeAndScrollEventListeners) return;
- this.menuResizeAndScrollEventListeners = {
- remove: setupResizeAndScrollEventListeners($control, this.adjustMenuOpenDirection)
- };
- },
- removeMenuSizeWatcher: function removeMenuSizeWatcher() {
- if (!this.menuSizeWatcher) return;
- this.menuSizeWatcher.remove();
- this.menuSizeWatcher = null;
- },
- removeMenuResizeAndScrollEventListeners: function removeMenuResizeAndScrollEventListeners() {
- if (!this.menuResizeAndScrollEventListeners) return;
- this.menuResizeAndScrollEventListeners.remove();
- this.menuResizeAndScrollEventListeners = null;
- }
- },
- render: function render() {
- var h = arguments[0];
- return h("div", {
- ref: "menu-container",
- "class": "vue-treeselect__menu-container",
- style: this.menuContainerStyle
- }, [h("transition", {
- attrs: {
- name: "vue-treeselect__menu--transition"
- }
- }, [this.renderMenu()])]);
- }
- });
- // CONCATENATED MODULE: ./src/components/Menu.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_Menuvue_type_script_lang_js_ = (Menuvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/Menu.vue
- var Menu_render, Menu_staticRenderFns
- /* normalize component */
- var Menu_component = normalizeComponent(
- components_Menuvue_type_script_lang_js_,
- Menu_render,
- Menu_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Menu_api; }
- Menu_component.options.__file = "src/components/Menu.vue"
- /* harmony default export */ var Menu = (Menu_component.exports);
- // EXTERNAL MODULE: external "vue"
- var external_vue_ = __webpack_require__(14);
- var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
- // 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&
- function MenuPortalvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
- function MenuPortalvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { MenuPortalvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { MenuPortalvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
- var PortalTarget = {
- name: 'vue-treeselect--portal-target',
- inject: ['instance'],
- watch: {
- 'instance.menu.isOpen': function instanceMenuIsOpen(newValue) {
- if (newValue) {
- this.setupHandlers();
- } else {
- this.removeHandlers();
- }
- },
- 'instance.menu.placement': function instanceMenuPlacement() {
- this.updateMenuContainerOffset();
- }
- },
- created: function created() {
- this.controlResizeAndScrollEventListeners = null;
- this.controlSizeWatcher = null;
- },
- mounted: function mounted() {
- var instance = this.instance;
- if (instance.menu.isOpen) this.setupHandlers();
- },
- methods: {
- setupHandlers: function setupHandlers() {
- this.updateWidth();
- this.updateMenuContainerOffset();
- this.setupControlResizeAndScrollEventListeners();
- this.setupControlSizeWatcher();
- },
- removeHandlers: function removeHandlers() {
- this.removeControlResizeAndScrollEventListeners();
- this.removeControlSizeWatcher();
- },
- setupControlResizeAndScrollEventListeners: function setupControlResizeAndScrollEventListeners() {
- var instance = this.instance;
- var $control = instance.getControl();
- if (this.controlResizeAndScrollEventListeners) return;
- this.controlResizeAndScrollEventListeners = {
- remove: setupResizeAndScrollEventListeners($control, this.updateMenuContainerOffset)
- };
- },
- setupControlSizeWatcher: function setupControlSizeWatcher() {
- var _this = this;
- var instance = this.instance;
- var $control = instance.getControl();
- if (this.controlSizeWatcher) return;
- this.controlSizeWatcher = {
- remove: watchSize($control, function () {
- _this.updateWidth();
- _this.updateMenuContainerOffset();
- })
- };
- },
- removeControlResizeAndScrollEventListeners: function removeControlResizeAndScrollEventListeners() {
- if (!this.controlResizeAndScrollEventListeners) return;
- this.controlResizeAndScrollEventListeners.remove();
- this.controlResizeAndScrollEventListeners = null;
- },
- removeControlSizeWatcher: function removeControlSizeWatcher() {
- if (!this.controlSizeWatcher) return;
- this.controlSizeWatcher.remove();
- this.controlSizeWatcher = null;
- },
- updateWidth: function updateWidth() {
- var instance = this.instance;
- var $portalTarget = this.$el;
- var $control = instance.getControl();
- var controlRect = $control.getBoundingClientRect();
- $portalTarget.style.width = controlRect.width + 'px';
- },
- updateMenuContainerOffset: function updateMenuContainerOffset() {
- var instance = this.instance;
- var $control = instance.getControl();
- var $portalTarget = this.$el;
- var controlRect = $control.getBoundingClientRect();
- var portalTargetRect = $portalTarget.getBoundingClientRect();
- var offsetY = instance.menu.placement === 'bottom' ? controlRect.height : 0;
- var left = Math.round(controlRect.left - portalTargetRect.left) + 'px';
- var top = Math.round(controlRect.top - portalTargetRect.top + offsetY) + 'px';
- var menuContainerStyle = this.$refs.menu.$refs['menu-container'].style;
- var transformVariations = ['transform', 'webkitTransform', 'MozTransform', 'msTransform'];
- var transform = find(transformVariations, function (t) {
- return t in document.body.style;
- });
- menuContainerStyle[transform] = "translate(".concat(left, ", ").concat(top, ")");
- }
- },
- render: function render() {
- var h = arguments[0];
- var instance = this.instance;
- var portalTargetClass = ['vue-treeselect__portal-target', instance.wrapperClass];
- var portalTargetStyle = {
- zIndex: instance.zIndex
- };
- return h("div", {
- "class": portalTargetClass,
- style: portalTargetStyle,
- attrs: {
- "data-instance-id": instance.getInstanceId()
- }
- }, [h(Menu, {
- ref: "menu"
- })]);
- },
- destroyed: function destroyed() {
- this.removeHandlers();
- }
- };
- var placeholder;
- /* harmony default export */ var MenuPortalvue_type_script_lang_js_ = ({
- name: 'vue-treeselect--menu-portal',
- created: function created() {
- this.portalTarget = null;
- },
- mounted: function mounted() {
- this.setup();
- },
- destroyed: function destroyed() {
- this.teardown();
- },
- methods: {
- setup: function setup() {
- var el = document.createElement('div');
- document.body.appendChild(el);
- this.portalTarget = new external_vue_default.a(MenuPortalvue_type_script_lang_js_objectSpread({
- el: el,
- parent: this
- }, PortalTarget));
- },
- teardown: function teardown() {
- document.body.removeChild(this.portalTarget.$el);
- this.portalTarget.$el.innerHTML = '';
- this.portalTarget.$destroy();
- this.portalTarget = null;
- }
- },
- render: function render() {
- var h = arguments[0];
- if (!placeholder) placeholder = h("div", {
- "class": "vue-treeselect__menu-placeholder"
- });
- return placeholder;
- }
- });
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_MenuPortalvue_type_script_lang_js_ = (MenuPortalvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/MenuPortal.vue
- var MenuPortal_render, MenuPortal_staticRenderFns
- /* normalize component */
- var MenuPortal_component = normalizeComponent(
- components_MenuPortalvue_type_script_lang_js_,
- MenuPortal_render,
- MenuPortal_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var MenuPortal_api; }
- MenuPortal_component.options.__file = "src/components/MenuPortal.vue"
- /* harmony default export */ var MenuPortal = (MenuPortal_component.exports);
- // 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&
- /* harmony default export */ var Treeselectvue_type_script_lang_js_ = ({
- name: 'vue-treeselect',
- mixins: [treeselectMixin],
- computed: {
- wrapperClass: function wrapperClass() {
- return {
- 'vue-treeselect': true,
- 'vue-treeselect--single': this.single,
- 'vue-treeselect--multi': this.multiple,
- 'vue-treeselect--searchable': this.searchable,
- 'vue-treeselect--disabled': this.disabled,
- 'vue-treeselect--focused': this.trigger.isFocused,
- 'vue-treeselect--has-value': this.hasValue,
- 'vue-treeselect--open': this.menu.isOpen,
- 'vue-treeselect--open-above': this.menu.placement === 'top',
- 'vue-treeselect--open-below': this.menu.placement === 'bottom',
- 'vue-treeselect--branch-nodes-disabled': this.disableBranchNodes,
- 'vue-treeselect--append-to-body': this.appendToBody
- };
- }
- },
- render: function render() {
- var h = arguments[0];
- return h("div", {
- ref: "wrapper",
- "class": this.wrapperClass
- }, [h(HiddenFields), h(Control, {
- ref: "control"
- }), this.appendToBody ? h(MenuPortal, {
- ref: "portal"
- }) : h(Menu, {
- ref: "menu"
- })]);
- }
- });
- // CONCATENATED MODULE: ./src/components/Treeselect.vue?vue&type=script&lang=js&
- /* harmony default export */ var components_Treeselectvue_type_script_lang_js_ = (Treeselectvue_type_script_lang_js_);
- // CONCATENATED MODULE: ./src/components/Treeselect.vue
- var Treeselect_render, Treeselect_staticRenderFns
- /* normalize component */
- var Treeselect_component = normalizeComponent(
- components_Treeselectvue_type_script_lang_js_,
- Treeselect_render,
- Treeselect_staticRenderFns,
- false,
- null,
- null,
- null
-
- )
- /* hot reload */
- if (false) { var Treeselect_api; }
- Treeselect_component.options.__file = "src/components/Treeselect.vue"
- /* harmony default export */ var Treeselect = (Treeselect_component.exports);
- // EXTERNAL MODULE: ./src/style.less
- var style = __webpack_require__(15);
- // CONCATENATED MODULE: ./src/index.js
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
- /* concated harmony reexport Treeselect */__webpack_require__.d(__webpack_exports__, "Treeselect", function() { return Treeselect; });
- /* concated harmony reexport treeselectMixin */__webpack_require__.d(__webpack_exports__, "treeselectMixin", function() { return treeselectMixin; });
- /* concated harmony reexport LOAD_ROOT_OPTIONS */__webpack_require__.d(__webpack_exports__, "LOAD_ROOT_OPTIONS", function() { return LOAD_ROOT_OPTIONS; });
- /* concated harmony reexport LOAD_CHILDREN_OPTIONS */__webpack_require__.d(__webpack_exports__, "LOAD_CHILDREN_OPTIONS", function() { return LOAD_CHILDREN_OPTIONS; });
- /* concated harmony reexport ASYNC_SEARCH */__webpack_require__.d(__webpack_exports__, "ASYNC_SEARCH", function() { return ASYNC_SEARCH; });
- /* harmony default export */ var src = __webpack_exports__["default"] = (Treeselect);
- var VERSION = "0.4.0";
- /***/ })
- /******/ ]);
- //# sourceMappingURL=vue-treeselect.cjs.js.map
|