123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007 |
- /*!
- * vue-treeselect v0.4.0 | (c) 2017-2019 Riophae Lee
- * Released under the MIT License.
- * https://vue-treeselect.js.org/
- */
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("Vue"));
- else if(typeof define === 'function' && define.amd)
- define(["Vue"], factory);
- else if(typeof exports === 'object')
- exports["VueTreeselect"] = factory(require("Vue"));
- else
- root["VueTreeselect"] = factory(root["Vue"]);
- })(window, function(__WEBPACK_EXTERNAL_MODULE__34__) {
- return /******/ (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 = 36);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayWithHoles = __webpack_require__(1);
- var iterableToArrayLimit = __webpack_require__(2);
- var nonIterableRest = __webpack_require__(3);
- function _slicedToArray(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
- }
- module.exports = _slicedToArray;
- /***/ }),
- /* 1 */
- /***/ (function(module, exports) {
- function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
- }
- module.exports = _arrayWithHoles;
- /***/ }),
- /* 2 */
- /***/ (function(module, exports) {
- function _iterableToArrayLimit(arr, i) {
- if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
- return;
- }
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
- try {
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
- module.exports = _iterableToArrayLimit;
- /***/ }),
- /* 3 */
- /***/ (function(module, exports) {
- function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
- }
- module.exports = _nonIterableRest;
- /***/ }),
- /* 4 */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayWithoutHoles = __webpack_require__(5);
- var iterableToArray = __webpack_require__(6);
- var nonIterableSpread = __webpack_require__(7);
- function _toConsumableArray(arr) {
- return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
- }
- module.exports = _toConsumableArray;
- /***/ }),
- /* 5 */
- /***/ (function(module, exports) {
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- }
- module.exports = _arrayWithoutHoles;
- /***/ }),
- /* 6 */
- /***/ (function(module, exports) {
- function _iterableToArray(iter) {
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
- }
- module.exports = _iterableToArray;
- /***/ }),
- /* 7 */
- /***/ (function(module, exports) {
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
- }
- module.exports = _nonIterableSpread;
- /***/ }),
- /* 8 */
- /***/ (function(module, exports) {
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- module.exports = _defineProperty;
- /***/ }),
- /* 9 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function fuzzysearch (needle, haystack) {
- var tlen = haystack.length;
- var qlen = needle.length;
- if (qlen > tlen) {
- return false;
- }
- if (qlen === tlen) {
- return needle === haystack;
- }
- outer: for (var i = 0, j = 0; i < qlen; i++) {
- var nch = needle.charCodeAt(i);
- while (j < tlen) {
- if (haystack.charCodeAt(j++) === nch) {
- continue outer;
- }
- }
- return false;
- }
- return true;
- }
- module.exports = fuzzysearch;
- /***/ }),
- /* 10 */
- /***/ (function(module, exports) {
- /**
- * This method returns `undefined`.
- *
- * @static
- * @memberOf _
- * @since 2.3.0
- * @category Util
- * @example
- *
- * _.times(2, _.noop);
- * // => [undefined, undefined]
- */
- function noop() {
- // No operation performed.
- }
- module.exports = noop;
- /***/ }),
- /* 11 */
- /***/ (function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(12),
- now = __webpack_require__(13),
- toNumber = __webpack_require__(17);
- /** Error message constants. */
- var FUNC_ERROR_TEXT = 'Expected a function';
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max,
- nativeMin = Math.min;
- /**
- * Creates a debounced function that delays invoking `func` until after `wait`
- * milliseconds have elapsed since the last time the debounced function was
- * invoked. The debounced function comes with a `cancel` method to cancel
- * delayed `func` invocations and a `flush` method to immediately invoke them.
- * Provide `options` to indicate whether `func` should be invoked on the
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
- * with the last arguments provided to the debounced function. Subsequent
- * calls to the debounced function return the result of the last `func`
- * invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the debounced function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.debounce` and `_.throttle`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to debounce.
- * @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=false]
- * Specify invoking on the leading edge of the timeout.
- * @param {number} [options.maxWait]
- * The maximum time `func` is allowed to be delayed before it's invoked.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new debounced function.
- * @example
- *
- * // Avoid costly calculations while the window size is in flux.
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
- *
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
- * 'leading': true,
- * 'trailing': false
- * }));
- *
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
- * var source = new EventSource('/stream');
- * jQuery(source).on('message', debounced);
- *
- * // Cancel the trailing debounced invocation.
- * jQuery(window).on('popstate', debounced.cancel);
- */
- function debounce(func, wait, options) {
- var lastArgs,
- lastThis,
- maxWait,
- result,
- timerId,
- lastCallTime,
- lastInvokeTime = 0,
- leading = false,
- maxing = false,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- wait = toNumber(wait) || 0;
- if (isObject(options)) {
- leading = !!options.leading;
- maxing = 'maxWait' in options;
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- function invokeFunc(time) {
- var args = lastArgs,
- thisArg = lastThis;
- lastArgs = lastThis = undefined;
- lastInvokeTime = time;
- result = func.apply(thisArg, args);
- return result;
- }
- function leadingEdge(time) {
- // Reset any `maxWait` timer.
- lastInvokeTime = time;
- // Start the timer for the trailing edge.
- timerId = setTimeout(timerExpired, wait);
- // Invoke the leading edge.
- return leading ? invokeFunc(time) : result;
- }
- function remainingWait(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime,
- timeWaiting = wait - timeSinceLastCall;
- return maxing
- ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
- : timeWaiting;
- }
- function shouldInvoke(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime;
- // Either this is the first call, activity has stopped and we're at the
- // trailing edge, the system time has gone backwards and we're treating
- // it as the trailing edge, or we've hit the `maxWait` limit.
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
- }
- function timerExpired() {
- var time = now();
- if (shouldInvoke(time)) {
- return trailingEdge(time);
- }
- // Restart the timer.
- timerId = setTimeout(timerExpired, remainingWait(time));
- }
- function trailingEdge(time) {
- timerId = undefined;
- // Only invoke if we have `lastArgs` which means `func` has been
- // debounced at least once.
- if (trailing && lastArgs) {
- return invokeFunc(time);
- }
- lastArgs = lastThis = undefined;
- return result;
- }
- function cancel() {
- if (timerId !== undefined) {
- clearTimeout(timerId);
- }
- lastInvokeTime = 0;
- lastArgs = lastCallTime = lastThis = timerId = undefined;
- }
- function flush() {
- return timerId === undefined ? result : trailingEdge(now());
- }
- function debounced() {
- var time = now(),
- isInvoking = shouldInvoke(time);
- lastArgs = arguments;
- lastThis = this;
- lastCallTime = time;
- if (isInvoking) {
- if (timerId === undefined) {
- return leadingEdge(lastCallTime);
- }
- if (maxing) {
- // Handle invocations in a tight loop.
- clearTimeout(timerId);
- timerId = setTimeout(timerExpired, wait);
- return invokeFunc(lastCallTime);
- }
- }
- if (timerId === undefined) {
- timerId = setTimeout(timerExpired, wait);
- }
- return result;
- }
- debounced.cancel = cancel;
- debounced.flush = flush;
- return debounced;
- }
- module.exports = debounce;
- /***/ }),
- /* 12 */
- /***/ (function(module, exports) {
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return value != null && (type == 'object' || type == 'function');
- }
- module.exports = isObject;
- /***/ }),
- /* 13 */
- /***/ (function(module, exports, __webpack_require__) {
- var root = __webpack_require__(14);
- /**
- * Gets the timestamp of the number of milliseconds that have elapsed since
- * the Unix epoch (1 January 1970 00:00:00 UTC).
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Date
- * @returns {number} Returns the timestamp.
- * @example
- *
- * _.defer(function(stamp) {
- * console.log(_.now() - stamp);
- * }, _.now());
- * // => Logs the number of milliseconds it took for the deferred invocation.
- */
- var now = function() {
- return root.Date.now();
- };
- module.exports = now;
- /***/ }),
- /* 14 */
- /***/ (function(module, exports, __webpack_require__) {
- var freeGlobal = __webpack_require__(15);
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- module.exports = root;
- /***/ }),
- /* 15 */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
- module.exports = freeGlobal;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(16)))
- /***/ }),
- /* 16 */
- /***/ (function(module, exports) {
- var g;
- // This works in non-strict mode
- g = (function() {
- return this;
- })();
- try {
- // This works if eval is allowed (see CSP)
- g = g || new Function("return this")();
- } catch (e) {
- // This works if the window reference is available
- if (typeof window === "object") g = window;
- }
- // g can still be undefined, but nothing to do about it...
- // We return undefined, instead of nothing here, so it's
- // easier to handle this case. if(!global) { ...}
- module.exports = g;
- /***/ }),
- /* 17 */
- /***/ (function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(12),
- isSymbol = __webpack_require__(18);
- /** Used as references for various `Number` constants. */
- var NAN = 0 / 0;
- /** Used to match leading and trailing whitespace. */
- var reTrim = /^\s+|\s+$/g;
- /** Used to detect bad signed hexadecimal string values. */
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- /** Used to detect binary string values. */
- var reIsBinary = /^0b[01]+$/i;
- /** Used to detect octal string values. */
- var reIsOctal = /^0o[0-7]+$/i;
- /** Built-in method references without a dependency on `root`. */
- var freeParseInt = parseInt;
- /**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */
- function toNumber(value) {
- if (typeof value == 'number') {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
- value = isObject(other) ? (other + '') : other;
- }
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim, '');
- var isBinary = reIsBinary.test(value);
- return (isBinary || reIsOctal.test(value))
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex.test(value) ? NAN : +value);
- }
- module.exports = toNumber;
- /***/ }),
- /* 18 */
- /***/ (function(module, exports, __webpack_require__) {
- var baseGetTag = __webpack_require__(19),
- isObjectLike = __webpack_require__(23);
- /** `Object#toString` result references. */
- var symbolTag = '[object Symbol]';
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol(value) {
- return typeof value == 'symbol' ||
- (isObjectLike(value) && baseGetTag(value) == symbolTag);
- }
- module.exports = isSymbol;
- /***/ }),
- /* 19 */
- /***/ (function(module, exports, __webpack_require__) {
- var Symbol = __webpack_require__(20),
- getRawTag = __webpack_require__(21),
- objectToString = __webpack_require__(22);
- /** `Object#toString` result references. */
- var nullTag = '[object Null]',
- undefinedTag = '[object Undefined]';
- /** Built-in value references. */
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
- /**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
- return (symToStringTag && symToStringTag in Object(value))
- ? getRawTag(value)
- : objectToString(value);
- }
- module.exports = baseGetTag;
- /***/ }),
- /* 20 */
- /***/ (function(module, exports, __webpack_require__) {
- var root = __webpack_require__(14);
- /** Built-in value references. */
- var Symbol = root.Symbol;
- module.exports = Symbol;
- /***/ }),
- /* 21 */
- /***/ (function(module, exports, __webpack_require__) {
- var Symbol = __webpack_require__(20);
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString = objectProto.toString;
- /** Built-in value references. */
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
- /**
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the raw `toStringTag`.
- */
- function getRawTag(value) {
- var isOwn = hasOwnProperty.call(value, symToStringTag),
- tag = value[symToStringTag];
- try {
- value[symToStringTag] = undefined;
- var unmasked = true;
- } catch (e) {}
- var result = nativeObjectToString.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag] = tag;
- } else {
- delete value[symToStringTag];
- }
- }
- return result;
- }
- module.exports = getRawTag;
- /***/ }),
- /* 22 */
- /***/ (function(module, exports) {
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString = objectProto.toString;
- /**
- * Converts `value` to a string using `Object.prototype.toString`.
- *
- * @private
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- */
- function objectToString(value) {
- return nativeObjectToString.call(value);
- }
- module.exports = objectToString;
- /***/ }),
- /* 23 */
- /***/ (function(module, exports) {
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return value != null && typeof value == 'object';
- }
- module.exports = isObjectLike;
- /***/ }),
- /* 24 */
- /***/ (function(module, exports) {
- module.exports = isPromise;
- function isPromise(obj) {
- return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
- }
- /***/ }),
- /* 25 */
- /***/ (function(module, exports, __webpack_require__) {
- var before = __webpack_require__(26);
- /**
- * Creates a function that is restricted to invoking `func` once. Repeat calls
- * to the function return the value of the first invocation. The `func` is
- * invoked with the `this` binding and arguments of the created function.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * var initialize = _.once(createApplication);
- * initialize();
- * initialize();
- * // => `createApplication` is invoked once
- */
- function once(func) {
- return before(2, func);
- }
- module.exports = once;
- /***/ }),
- /* 26 */
- /***/ (function(module, exports, __webpack_require__) {
- var toInteger = __webpack_require__(27);
- /** Error message constants. */
- var FUNC_ERROR_TEXT = 'Expected a function';
- /**
- * Creates a function that invokes `func`, with the `this` binding and arguments
- * of the created function, while it's called less than `n` times. Subsequent
- * calls to the created function return the result of the last `func` invocation.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Function
- * @param {number} n The number of calls at which `func` is no longer invoked.
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * jQuery(element).on('click', _.before(5, addContactToList));
- * // => Allows adding up to 4 contacts to the list.
- */
- function before(n, func) {
- var result;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- n = toInteger(n);
- return function() {
- if (--n > 0) {
- result = func.apply(this, arguments);
- }
- if (n <= 1) {
- func = undefined;
- }
- return result;
- };
- }
- module.exports = before;
- /***/ }),
- /* 27 */
- /***/ (function(module, exports, __webpack_require__) {
- var toFinite = __webpack_require__(28);
- /**
- * Converts `value` to an integer.
- *
- * **Note:** This method is loosely based on
- * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toInteger(3.2);
- * // => 3
- *
- * _.toInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toInteger(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toInteger('3.2');
- * // => 3
- */
- function toInteger(value) {
- var result = toFinite(value),
- remainder = result % 1;
- return result === result ? (remainder ? result - remainder : result) : 0;
- }
- module.exports = toInteger;
- /***/ }),
- /* 28 */
- /***/ (function(module, exports, __webpack_require__) {
- var toNumber = __webpack_require__(17);
- /** Used as references for various `Number` constants. */
- var INFINITY = 1 / 0,
- MAX_INTEGER = 1.7976931348623157e+308;
- /**
- * Converts `value` to a finite number.
- *
- * @static
- * @memberOf _
- * @since 4.12.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted number.
- * @example
- *
- * _.toFinite(3.2);
- * // => 3.2
- *
- * _.toFinite(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toFinite(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toFinite('3.2');
- * // => 3.2
- */
- function toFinite(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = (value < 0 ? -1 : 1);
- return sign * MAX_INTEGER;
- }
- return value === value ? value : 0;
- }
- module.exports = toFinite;
- /***/ }),
- /* 29 */
- /***/ (function(module, exports) {
- /**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */
- function identity(value) {
- return value;
- }
- module.exports = identity;
- /***/ }),
- /* 30 */
- /***/ (function(module, exports) {
- /**
- * Creates a function that returns `value`.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {*} value The value to return from the new function.
- * @returns {Function} Returns the new constant function.
- * @example
- *
- * var objects = _.times(2, _.constant({ 'a': 1 }));
- *
- * console.log(objects);
- * // => [{ 'a': 1 }, { 'a': 1 }]
- *
- * console.log(objects[0] === objects[1]);
- * // => true
- */
- function constant(value) {
- return function() {
- return value;
- };
- }
- module.exports = constant;
- /***/ }),
- /* 31 */
- /***/ (function(module, exports) {
- function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
- function _typeof(obj) {
- if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
- module.exports = _typeof = function _typeof(obj) {
- return _typeof2(obj);
- };
- } else {
- module.exports = _typeof = function _typeof(obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
- };
- }
- return _typeof(obj);
- }
- module.exports = _typeof;
- /***/ }),
- /* 32 */
- /***/ (function(module, exports) {
- /**
- * Gets the last element of `array`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to query.
- * @returns {*} Returns the last element of `array`.
- * @example
- *
- * _.last([1, 2, 3]);
- * // => 3
- */
- function last(array) {
- var length = array == null ? 0 : array.length;
- return length ? array[length - 1] : undefined;
- }
- module.exports = last;
- /***/ }),
- /* 33 */
- /***/ (function(module, exports) {
- var nestRE = /^(attrs|props|on|nativeOn|class|style|hook)$/
- module.exports = function mergeJSXProps (objs) {
- return objs.reduce(function (a, b) {
- var aa, bb, key, nestedKey, temp
- for (key in b) {
- aa = a[key]
- bb = b[key]
- if (aa && nestRE.test(key)) {
- // normalize class
- if (key === 'class') {
- if (typeof aa === 'string') {
- temp = aa
- a[key] = aa = {}
- aa[temp] = true
- }
- if (typeof bb === 'string') {
- temp = bb
- b[key] = bb = {}
- bb[temp] = true
- }
- }
- if (key === 'on' || key === 'nativeOn' || key === 'hook') {
- // merge functions
- for (nestedKey in bb) {
- aa[nestedKey] = mergeFn(aa[nestedKey], bb[nestedKey])
- }
- } else if (Array.isArray(aa)) {
- a[key] = aa.concat(bb)
- } else if (Array.isArray(bb)) {
- a[key] = [aa].concat(bb)
- } else {
- for (nestedKey in bb) {
- aa[nestedKey] = bb[nestedKey]
- }
- }
- } else {
- a[key] = b[key]
- }
- }
- return a
- }, {})
- }
- function mergeFn (a, b) {
- return function () {
- a && a.apply(this, arguments)
- b && b.apply(this, arguments)
- }
- }
- /***/ }),
- /* 34 */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__34__;
- /***/ }),
- /* 35 */
- /***/ (function(module, exports, __webpack_require__) {
- // extracted by mini-css-extract-plugin
- /***/ }),
- /* 36 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
- var slicedToArray = __webpack_require__(0);
- var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
- var toConsumableArray = __webpack_require__(4);
- var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
- var defineProperty = __webpack_require__(8);
- var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
- // EXTERNAL MODULE: ./node_modules/fuzzysearch/index.js
- var fuzzysearch = __webpack_require__(9);
- var fuzzysearch_default = /*#__PURE__*/__webpack_require__.n(fuzzysearch);
- // EXTERNAL MODULE: ./node_modules/lodash/noop.js
- var noop = __webpack_require__(10);
- // CONCATENATED MODULE: ./src/utils/noop.js
- // CONCATENATED MODULE: ./src/utils/warning.js
- var warning_warning = false ? undefined : 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: ./node_modules/lodash/debounce.js
- var debounce = __webpack_require__(11);
- var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
- // CONCATENATED MODULE: ./src/utils/debounce.js
- // CONCATENATED MODULE: ./node_modules/watch-size/index.es.mjs
- var index_es_index = (function (element, listener) {
- var expand = document.createElement('_');
- var shrink = expand.appendChild(document.createElement('_'));
- var expandChild = expand.appendChild(document.createElement('_'));
- var shrinkChild = shrink.appendChild(document.createElement('_'));
- var lastWidth = void 0,
- lastHeight = void 0;
- shrink.style.cssText = expand.style.cssText = 'height:100%;left:0;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:0;transition:0s;width:100%;z-index:-1';
- shrinkChild.style.cssText = expandChild.style.cssText = 'display:block;height:100%;transition:0s;width:100%';
- shrinkChild.style.width = shrinkChild.style.height = '200%';
- element.appendChild(expand);
- test();
- return stop;
- function test() {
- unbind();
- var width = element.offsetWidth;
- var height = element.offsetHeight;
- if (width !== lastWidth || height !== lastHeight) {
- lastWidth = width;
- lastHeight = height;
- expandChild.style.width = width * 2 + 'px';
- expandChild.style.height = height * 2 + 'px';
- expand.scrollLeft = expand.scrollWidth;
- expand.scrollTop = expand.scrollHeight;
- shrink.scrollLeft = shrink.scrollWidth;
- shrink.scrollTop = shrink.scrollHeight;
- listener({ width: width, height: height });
- }
- shrink.addEventListener('scroll', test);
- expand.addEventListener('scroll', test);
- }
- function unbind() {
- shrink.removeEventListener('scroll', test);
- expand.removeEventListener('scroll', test);
- }
- function stop() {
- unbind();
- element.removeChild(expand);
- }
- });
- /* harmony default export */ var index_es = (index_es_index);
- // 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 : index_es;
- 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: ./node_modules/is-promise/index.js
- var is_promise = __webpack_require__(24);
- var is_promise_default = /*#__PURE__*/__webpack_require__.n(is_promise);
- // CONCATENATED MODULE: ./src/utils/isPromise.js
- // EXTERNAL MODULE: ./node_modules/lodash/once.js
- var once = __webpack_require__(25);
- var once_default = /*#__PURE__*/__webpack_require__.n(once);
- // CONCATENATED MODULE: ./src/utils/once.js
- // EXTERNAL MODULE: ./node_modules/lodash/identity.js
- var identity = __webpack_require__(29);
- var identity_default = /*#__PURE__*/__webpack_require__.n(identity);
- // CONCATENATED MODULE: ./src/utils/identity.js
- // EXTERNAL MODULE: ./node_modules/lodash/constant.js
- var constant = __webpack_require__(30);
- 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: ./node_modules/@babel/runtime/helpers/typeof.js
- var helpers_typeof = __webpack_require__(31);
- var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_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: ./node_modules/lodash/last.js
- var lodash_last = __webpack_require__(32);
- var last_default = /*#__PURE__*/__webpack_require__.n(lodash_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 = false ? undefined : 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 ? 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 (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: ./node_modules/babel-helper-vue-jsx-merge-props/index.js
- var babel_helper_vue_jsx_merge_props = __webpack_require__(33);
- var babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(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", 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", 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 (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__(34);
- 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__(35);
- // 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.umd.js.map
|