bootstrap-table.js 264 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BootstrapTable = factory(global.jQuery));
  5. }(this, (function ($) { 'use strict';
  6. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  7. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  8. function _typeof(obj) {
  9. "@babel/helpers - typeof";
  10. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  11. _typeof = function (obj) {
  12. return typeof obj;
  13. };
  14. } else {
  15. _typeof = function (obj) {
  16. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  17. };
  18. }
  19. return _typeof(obj);
  20. }
  21. function _classCallCheck(instance, Constructor) {
  22. if (!(instance instanceof Constructor)) {
  23. throw new TypeError("Cannot call a class as a function");
  24. }
  25. }
  26. function _defineProperties(target, props) {
  27. for (var i = 0; i < props.length; i++) {
  28. var descriptor = props[i];
  29. descriptor.enumerable = descriptor.enumerable || false;
  30. descriptor.configurable = true;
  31. if ("value" in descriptor) descriptor.writable = true;
  32. Object.defineProperty(target, descriptor.key, descriptor);
  33. }
  34. }
  35. function _createClass(Constructor, protoProps, staticProps) {
  36. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  37. if (staticProps) _defineProperties(Constructor, staticProps);
  38. return Constructor;
  39. }
  40. function _slicedToArray(arr, i) {
  41. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  42. }
  43. function _toConsumableArray(arr) {
  44. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  45. }
  46. function _arrayWithoutHoles(arr) {
  47. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  48. }
  49. function _arrayWithHoles(arr) {
  50. if (Array.isArray(arr)) return arr;
  51. }
  52. function _iterableToArray(iter) {
  53. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  54. }
  55. function _iterableToArrayLimit(arr, i) {
  56. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  57. var _arr = [];
  58. var _n = true;
  59. var _d = false;
  60. var _e = undefined;
  61. try {
  62. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  63. _arr.push(_s.value);
  64. if (i && _arr.length === i) break;
  65. }
  66. } catch (err) {
  67. _d = true;
  68. _e = err;
  69. } finally {
  70. try {
  71. if (!_n && _i["return"] != null) _i["return"]();
  72. } finally {
  73. if (_d) throw _e;
  74. }
  75. }
  76. return _arr;
  77. }
  78. function _unsupportedIterableToArray(o, minLen) {
  79. if (!o) return;
  80. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  81. var n = Object.prototype.toString.call(o).slice(8, -1);
  82. if (n === "Object" && o.constructor) n = o.constructor.name;
  83. if (n === "Map" || n === "Set") return Array.from(o);
  84. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  85. }
  86. function _arrayLikeToArray(arr, len) {
  87. if (len == null || len > arr.length) len = arr.length;
  88. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  89. return arr2;
  90. }
  91. function _nonIterableSpread() {
  92. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  93. }
  94. function _nonIterableRest() {
  95. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  96. }
  97. function _createForOfIteratorHelper(o, allowArrayLike) {
  98. var it;
  99. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  100. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  101. if (it) o = it;
  102. var i = 0;
  103. var F = function () {};
  104. return {
  105. s: F,
  106. n: function () {
  107. if (i >= o.length) return {
  108. done: true
  109. };
  110. return {
  111. done: false,
  112. value: o[i++]
  113. };
  114. },
  115. e: function (e) {
  116. throw e;
  117. },
  118. f: F
  119. };
  120. }
  121. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  122. }
  123. var normalCompletion = true,
  124. didErr = false,
  125. err;
  126. return {
  127. s: function () {
  128. it = o[Symbol.iterator]();
  129. },
  130. n: function () {
  131. var step = it.next();
  132. normalCompletion = step.done;
  133. return step;
  134. },
  135. e: function (e) {
  136. didErr = true;
  137. err = e;
  138. },
  139. f: function () {
  140. try {
  141. if (!normalCompletion && it.return != null) it.return();
  142. } finally {
  143. if (didErr) throw err;
  144. }
  145. }
  146. };
  147. }
  148. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  149. function createCommonjsModule(fn, module) {
  150. return module = { exports: {} }, fn(module, module.exports), module.exports;
  151. }
  152. var check = function (it) {
  153. return it && it.Math == Math && it;
  154. };
  155. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  156. var global_1 =
  157. // eslint-disable-next-line es/no-global-this -- safe
  158. check(typeof globalThis == 'object' && globalThis) ||
  159. check(typeof window == 'object' && window) ||
  160. // eslint-disable-next-line no-restricted-globals -- safe
  161. check(typeof self == 'object' && self) ||
  162. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  163. // eslint-disable-next-line no-new-func -- fallback
  164. (function () { return this; })() || Function('return this')();
  165. var fails = function (exec) {
  166. try {
  167. return !!exec();
  168. } catch (error) {
  169. return true;
  170. }
  171. };
  172. // Detect IE8's incomplete defineProperty implementation
  173. var descriptors = !fails(function () {
  174. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  175. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  176. });
  177. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  178. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  179. var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
  180. // Nashorn ~ JDK8 bug
  181. var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  182. // `Object.prototype.propertyIsEnumerable` method implementation
  183. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  184. var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  185. var descriptor = getOwnPropertyDescriptor$4(this, V);
  186. return !!descriptor && descriptor.enumerable;
  187. } : $propertyIsEnumerable;
  188. var objectPropertyIsEnumerable = {
  189. f: f$4
  190. };
  191. var createPropertyDescriptor = function (bitmap, value) {
  192. return {
  193. enumerable: !(bitmap & 1),
  194. configurable: !(bitmap & 2),
  195. writable: !(bitmap & 4),
  196. value: value
  197. };
  198. };
  199. var toString = {}.toString;
  200. var classofRaw = function (it) {
  201. return toString.call(it).slice(8, -1);
  202. };
  203. var split = ''.split;
  204. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  205. var indexedObject = fails(function () {
  206. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  207. // eslint-disable-next-line no-prototype-builtins -- safe
  208. return !Object('z').propertyIsEnumerable(0);
  209. }) ? function (it) {
  210. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  211. } : Object;
  212. // `RequireObjectCoercible` abstract operation
  213. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  214. var requireObjectCoercible = function (it) {
  215. if (it == undefined) throw TypeError("Can't call method on " + it);
  216. return it;
  217. };
  218. // toObject with fallback for non-array-like ES3 strings
  219. var toIndexedObject = function (it) {
  220. return indexedObject(requireObjectCoercible(it));
  221. };
  222. var isObject = function (it) {
  223. return typeof it === 'object' ? it !== null : typeof it === 'function';
  224. };
  225. // `ToPrimitive` abstract operation
  226. // https://tc39.es/ecma262/#sec-toprimitive
  227. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  228. // and the second argument - flag - preferred type is a string
  229. var toPrimitive = function (input, PREFERRED_STRING) {
  230. if (!isObject(input)) return input;
  231. var fn, val;
  232. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  233. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  234. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  235. throw TypeError("Can't convert object to primitive value");
  236. };
  237. var hasOwnProperty = {}.hasOwnProperty;
  238. var has$1 = function (it, key) {
  239. return hasOwnProperty.call(it, key);
  240. };
  241. var document$1 = global_1.document;
  242. // typeof document.createElement is 'object' in old IE
  243. var EXISTS = isObject(document$1) && isObject(document$1.createElement);
  244. var documentCreateElement = function (it) {
  245. return EXISTS ? document$1.createElement(it) : {};
  246. };
  247. // Thank's IE8 for his funny defineProperty
  248. var ie8DomDefine = !descriptors && !fails(function () {
  249. // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  250. return Object.defineProperty(documentCreateElement('div'), 'a', {
  251. get: function () { return 7; }
  252. }).a != 7;
  253. });
  254. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  255. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  256. // `Object.getOwnPropertyDescriptor` method
  257. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  258. var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  259. O = toIndexedObject(O);
  260. P = toPrimitive(P, true);
  261. if (ie8DomDefine) try {
  262. return $getOwnPropertyDescriptor(O, P);
  263. } catch (error) { /* empty */ }
  264. if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  265. };
  266. var objectGetOwnPropertyDescriptor = {
  267. f: f$3
  268. };
  269. var anObject = function (it) {
  270. if (!isObject(it)) {
  271. throw TypeError(String(it) + ' is not an object');
  272. } return it;
  273. };
  274. // eslint-disable-next-line es/no-object-defineproperty -- safe
  275. var $defineProperty = Object.defineProperty;
  276. // `Object.defineProperty` method
  277. // https://tc39.es/ecma262/#sec-object.defineproperty
  278. var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
  279. anObject(O);
  280. P = toPrimitive(P, true);
  281. anObject(Attributes);
  282. if (ie8DomDefine) try {
  283. return $defineProperty(O, P, Attributes);
  284. } catch (error) { /* empty */ }
  285. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  286. if ('value' in Attributes) O[P] = Attributes.value;
  287. return O;
  288. };
  289. var objectDefineProperty = {
  290. f: f$2
  291. };
  292. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  293. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  294. } : function (object, key, value) {
  295. object[key] = value;
  296. return object;
  297. };
  298. var setGlobal = function (key, value) {
  299. try {
  300. createNonEnumerableProperty(global_1, key, value);
  301. } catch (error) {
  302. global_1[key] = value;
  303. } return value;
  304. };
  305. var SHARED = '__core-js_shared__';
  306. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  307. var sharedStore = store$1;
  308. var functionToString = Function.toString;
  309. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  310. if (typeof sharedStore.inspectSource != 'function') {
  311. sharedStore.inspectSource = function (it) {
  312. return functionToString.call(it);
  313. };
  314. }
  315. var inspectSource = sharedStore.inspectSource;
  316. var WeakMap$1 = global_1.WeakMap;
  317. var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
  318. var shared = createCommonjsModule(function (module) {
  319. (module.exports = function (key, value) {
  320. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  321. })('versions', []).push({
  322. version: '3.10.1',
  323. mode: 'global',
  324. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  325. });
  326. });
  327. var id = 0;
  328. var postfix = Math.random();
  329. var uid = function (key) {
  330. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  331. };
  332. var keys$2 = shared('keys');
  333. var sharedKey = function (key) {
  334. return keys$2[key] || (keys$2[key] = uid(key));
  335. };
  336. var hiddenKeys$1 = {};
  337. var WeakMap = global_1.WeakMap;
  338. var set, get, has;
  339. var enforce = function (it) {
  340. return has(it) ? get(it) : set(it, {});
  341. };
  342. var getterFor = function (TYPE) {
  343. return function (it) {
  344. var state;
  345. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  346. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  347. } return state;
  348. };
  349. };
  350. if (nativeWeakMap) {
  351. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  352. var wmget = store.get;
  353. var wmhas = store.has;
  354. var wmset = store.set;
  355. set = function (it, metadata) {
  356. metadata.facade = it;
  357. wmset.call(store, it, metadata);
  358. return metadata;
  359. };
  360. get = function (it) {
  361. return wmget.call(store, it) || {};
  362. };
  363. has = function (it) {
  364. return wmhas.call(store, it);
  365. };
  366. } else {
  367. var STATE = sharedKey('state');
  368. hiddenKeys$1[STATE] = true;
  369. set = function (it, metadata) {
  370. metadata.facade = it;
  371. createNonEnumerableProperty(it, STATE, metadata);
  372. return metadata;
  373. };
  374. get = function (it) {
  375. return has$1(it, STATE) ? it[STATE] : {};
  376. };
  377. has = function (it) {
  378. return has$1(it, STATE);
  379. };
  380. }
  381. var internalState = {
  382. set: set,
  383. get: get,
  384. has: has,
  385. enforce: enforce,
  386. getterFor: getterFor
  387. };
  388. var redefine = createCommonjsModule(function (module) {
  389. var getInternalState = internalState.get;
  390. var enforceInternalState = internalState.enforce;
  391. var TEMPLATE = String(String).split('String');
  392. (module.exports = function (O, key, value, options) {
  393. var unsafe = options ? !!options.unsafe : false;
  394. var simple = options ? !!options.enumerable : false;
  395. var noTargetGet = options ? !!options.noTargetGet : false;
  396. var state;
  397. if (typeof value == 'function') {
  398. if (typeof key == 'string' && !has$1(value, 'name')) {
  399. createNonEnumerableProperty(value, 'name', key);
  400. }
  401. state = enforceInternalState(value);
  402. if (!state.source) {
  403. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  404. }
  405. }
  406. if (O === global_1) {
  407. if (simple) O[key] = value;
  408. else setGlobal(key, value);
  409. return;
  410. } else if (!unsafe) {
  411. delete O[key];
  412. } else if (!noTargetGet && O[key]) {
  413. simple = true;
  414. }
  415. if (simple) O[key] = value;
  416. else createNonEnumerableProperty(O, key, value);
  417. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  418. })(Function.prototype, 'toString', function toString() {
  419. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  420. });
  421. });
  422. var path = global_1;
  423. var aFunction$1 = function (variable) {
  424. return typeof variable == 'function' ? variable : undefined;
  425. };
  426. var getBuiltIn = function (namespace, method) {
  427. return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
  428. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  429. };
  430. var ceil = Math.ceil;
  431. var floor$1 = Math.floor;
  432. // `ToInteger` abstract operation
  433. // https://tc39.es/ecma262/#sec-tointeger
  434. var toInteger = function (argument) {
  435. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
  436. };
  437. var min$6 = Math.min;
  438. // `ToLength` abstract operation
  439. // https://tc39.es/ecma262/#sec-tolength
  440. var toLength = function (argument) {
  441. return argument > 0 ? min$6(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  442. };
  443. var max$3 = Math.max;
  444. var min$5 = Math.min;
  445. // Helper for a popular repeating case of the spec:
  446. // Let integer be ? ToInteger(index).
  447. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  448. var toAbsoluteIndex = function (index, length) {
  449. var integer = toInteger(index);
  450. return integer < 0 ? max$3(integer + length, 0) : min$5(integer, length);
  451. };
  452. // `Array.prototype.{ indexOf, includes }` methods implementation
  453. var createMethod$4 = function (IS_INCLUDES) {
  454. return function ($this, el, fromIndex) {
  455. var O = toIndexedObject($this);
  456. var length = toLength(O.length);
  457. var index = toAbsoluteIndex(fromIndex, length);
  458. var value;
  459. // Array#includes uses SameValueZero equality algorithm
  460. // eslint-disable-next-line no-self-compare -- NaN check
  461. if (IS_INCLUDES && el != el) while (length > index) {
  462. value = O[index++];
  463. // eslint-disable-next-line no-self-compare -- NaN check
  464. if (value != value) return true;
  465. // Array#indexOf ignores holes, Array#includes - not
  466. } else for (;length > index; index++) {
  467. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  468. } return !IS_INCLUDES && -1;
  469. };
  470. };
  471. var arrayIncludes = {
  472. // `Array.prototype.includes` method
  473. // https://tc39.es/ecma262/#sec-array.prototype.includes
  474. includes: createMethod$4(true),
  475. // `Array.prototype.indexOf` method
  476. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  477. indexOf: createMethod$4(false)
  478. };
  479. var indexOf = arrayIncludes.indexOf;
  480. var objectKeysInternal = function (object, names) {
  481. var O = toIndexedObject(object);
  482. var i = 0;
  483. var result = [];
  484. var key;
  485. for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
  486. // Don't enum bug & hidden keys
  487. while (names.length > i) if (has$1(O, key = names[i++])) {
  488. ~indexOf(result, key) || result.push(key);
  489. }
  490. return result;
  491. };
  492. // IE8- don't enum bug keys
  493. var enumBugKeys = [
  494. 'constructor',
  495. 'hasOwnProperty',
  496. 'isPrototypeOf',
  497. 'propertyIsEnumerable',
  498. 'toLocaleString',
  499. 'toString',
  500. 'valueOf'
  501. ];
  502. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  503. // `Object.getOwnPropertyNames` method
  504. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  505. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  506. var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  507. return objectKeysInternal(O, hiddenKeys);
  508. };
  509. var objectGetOwnPropertyNames = {
  510. f: f$1
  511. };
  512. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  513. var f = Object.getOwnPropertySymbols;
  514. var objectGetOwnPropertySymbols = {
  515. f: f
  516. };
  517. // all object keys, includes non-enumerable and symbols
  518. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  519. var keys = objectGetOwnPropertyNames.f(anObject(it));
  520. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  521. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  522. };
  523. var copyConstructorProperties = function (target, source) {
  524. var keys = ownKeys(source);
  525. var defineProperty = objectDefineProperty.f;
  526. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  527. for (var i = 0; i < keys.length; i++) {
  528. var key = keys[i];
  529. if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  530. }
  531. };
  532. var replacement = /#|\.prototype\./;
  533. var isForced = function (feature, detection) {
  534. var value = data[normalize(feature)];
  535. return value == POLYFILL ? true
  536. : value == NATIVE ? false
  537. : typeof detection == 'function' ? fails(detection)
  538. : !!detection;
  539. };
  540. var normalize = isForced.normalize = function (string) {
  541. return String(string).replace(replacement, '.').toLowerCase();
  542. };
  543. var data = isForced.data = {};
  544. var NATIVE = isForced.NATIVE = 'N';
  545. var POLYFILL = isForced.POLYFILL = 'P';
  546. var isForced_1 = isForced;
  547. var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
  548. /*
  549. options.target - name of the target object
  550. options.global - target is the global object
  551. options.stat - export as static methods of target
  552. options.proto - export as prototype methods of target
  553. options.real - real prototype method for the `pure` version
  554. options.forced - export even if the native feature is available
  555. options.bind - bind methods to the target, required for the `pure` version
  556. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  557. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  558. options.sham - add a flag to not completely full polyfills
  559. options.enumerable - export as enumerable property
  560. options.noTargetGet - prevent calling a getter on target
  561. */
  562. var _export = function (options, source) {
  563. var TARGET = options.target;
  564. var GLOBAL = options.global;
  565. var STATIC = options.stat;
  566. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  567. if (GLOBAL) {
  568. target = global_1;
  569. } else if (STATIC) {
  570. target = global_1[TARGET] || setGlobal(TARGET, {});
  571. } else {
  572. target = (global_1[TARGET] || {}).prototype;
  573. }
  574. if (target) for (key in source) {
  575. sourceProperty = source[key];
  576. if (options.noTargetGet) {
  577. descriptor = getOwnPropertyDescriptor$3(target, key);
  578. targetProperty = descriptor && descriptor.value;
  579. } else targetProperty = target[key];
  580. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  581. // contained in target
  582. if (!FORCED && targetProperty !== undefined) {
  583. if (typeof sourceProperty === typeof targetProperty) continue;
  584. copyConstructorProperties(sourceProperty, targetProperty);
  585. }
  586. // add a flag to not completely full polyfills
  587. if (options.sham || (targetProperty && targetProperty.sham)) {
  588. createNonEnumerableProperty(sourceProperty, 'sham', true);
  589. }
  590. // extend global
  591. redefine(target, key, sourceProperty, options);
  592. }
  593. };
  594. // a string of all valid unicode whitespaces
  595. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  596. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  597. var whitespace = '[' + whitespaces + ']';
  598. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  599. var rtrim = RegExp(whitespace + whitespace + '*$');
  600. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  601. var createMethod$3 = function (TYPE) {
  602. return function ($this) {
  603. var string = String(requireObjectCoercible($this));
  604. if (TYPE & 1) string = string.replace(ltrim, '');
  605. if (TYPE & 2) string = string.replace(rtrim, '');
  606. return string;
  607. };
  608. };
  609. var stringTrim = {
  610. // `String.prototype.{ trimLeft, trimStart }` methods
  611. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  612. start: createMethod$3(1),
  613. // `String.prototype.{ trimRight, trimEnd }` methods
  614. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  615. end: createMethod$3(2),
  616. // `String.prototype.trim` method
  617. // https://tc39.es/ecma262/#sec-string.prototype.trim
  618. trim: createMethod$3(3)
  619. };
  620. var non = '\u200B\u0085\u180E';
  621. // check that a method works with the correct list
  622. // of whitespaces and has a correct name
  623. var stringTrimForced = function (METHOD_NAME) {
  624. return fails(function () {
  625. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  626. });
  627. };
  628. var $trim = stringTrim.trim;
  629. // `String.prototype.trim` method
  630. // https://tc39.es/ecma262/#sec-string.prototype.trim
  631. _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
  632. trim: function trim() {
  633. return $trim(this);
  634. }
  635. });
  636. var arrayMethodIsStrict = function (METHOD_NAME, argument) {
  637. var method = [][METHOD_NAME];
  638. return !!method && fails(function () {
  639. // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
  640. method.call(null, argument || function () { throw 1; }, 1);
  641. });
  642. };
  643. var nativeJoin = [].join;
  644. var ES3_STRINGS = indexedObject != Object;
  645. var STRICT_METHOD$3 = arrayMethodIsStrict('join', ',');
  646. // `Array.prototype.join` method
  647. // https://tc39.es/ecma262/#sec-array.prototype.join
  648. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, {
  649. join: function join(separator) {
  650. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  651. }
  652. });
  653. // `RegExp.prototype.flags` getter implementation
  654. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  655. var regexpFlags = function () {
  656. var that = anObject(this);
  657. var result = '';
  658. if (that.global) result += 'g';
  659. if (that.ignoreCase) result += 'i';
  660. if (that.multiline) result += 'm';
  661. if (that.dotAll) result += 's';
  662. if (that.unicode) result += 'u';
  663. if (that.sticky) result += 'y';
  664. return result;
  665. };
  666. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
  667. // so we use an intermediate function.
  668. function RE(s, f) {
  669. return RegExp(s, f);
  670. }
  671. var UNSUPPORTED_Y$3 = fails(function () {
  672. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  673. var re = RE('a', 'y');
  674. re.lastIndex = 2;
  675. return re.exec('abcd') != null;
  676. });
  677. var BROKEN_CARET = fails(function () {
  678. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  679. var re = RE('^r', 'gy');
  680. re.lastIndex = 2;
  681. return re.exec('str') != null;
  682. });
  683. var regexpStickyHelpers = {
  684. UNSUPPORTED_Y: UNSUPPORTED_Y$3,
  685. BROKEN_CARET: BROKEN_CARET
  686. };
  687. var nativeExec = RegExp.prototype.exec;
  688. var nativeReplace = shared('native-string-replace', String.prototype.replace);
  689. var patchedExec = nativeExec;
  690. var UPDATES_LAST_INDEX_WRONG = (function () {
  691. var re1 = /a/;
  692. var re2 = /b*/g;
  693. nativeExec.call(re1, 'a');
  694. nativeExec.call(re2, 'a');
  695. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  696. })();
  697. var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
  698. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  699. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
  700. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  701. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2;
  702. if (PATCH) {
  703. patchedExec = function exec(str) {
  704. var re = this;
  705. var lastIndex, reCopy, match, i;
  706. var sticky = UNSUPPORTED_Y$2 && re.sticky;
  707. var flags = regexpFlags.call(re);
  708. var source = re.source;
  709. var charsAdded = 0;
  710. var strCopy = str;
  711. if (sticky) {
  712. flags = flags.replace('y', '');
  713. if (flags.indexOf('g') === -1) {
  714. flags += 'g';
  715. }
  716. strCopy = String(str).slice(re.lastIndex);
  717. // Support anchored sticky behavior.
  718. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
  719. source = '(?: ' + source + ')';
  720. strCopy = ' ' + strCopy;
  721. charsAdded++;
  722. }
  723. // ^(? + rx + ) is needed, in combination with some str slicing, to
  724. // simulate the 'y' flag.
  725. reCopy = new RegExp('^(?:' + source + ')', flags);
  726. }
  727. if (NPCG_INCLUDED) {
  728. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  729. }
  730. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  731. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  732. if (sticky) {
  733. if (match) {
  734. match.input = match.input.slice(charsAdded);
  735. match[0] = match[0].slice(charsAdded);
  736. match.index = re.lastIndex;
  737. re.lastIndex += match[0].length;
  738. } else re.lastIndex = 0;
  739. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  740. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  741. }
  742. if (NPCG_INCLUDED && match && match.length > 1) {
  743. // Fix browsers whose `exec` methods don't consistently return `undefined`
  744. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  745. nativeReplace.call(match[0], reCopy, function () {
  746. for (i = 1; i < arguments.length - 2; i++) {
  747. if (arguments[i] === undefined) match[i] = undefined;
  748. }
  749. });
  750. }
  751. return match;
  752. };
  753. }
  754. var regexpExec = patchedExec;
  755. // `RegExp.prototype.exec` method
  756. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  757. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  758. exec: regexpExec
  759. });
  760. var engineIsNode = classofRaw(global_1.process) == 'process';
  761. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  762. var process = global_1.process;
  763. var versions = process && process.versions;
  764. var v8 = versions && versions.v8;
  765. var match, version;
  766. if (v8) {
  767. match = v8.split('.');
  768. version = match[0] + match[1];
  769. } else if (engineUserAgent) {
  770. match = engineUserAgent.match(/Edge\/(\d+)/);
  771. if (!match || match[1] >= 74) {
  772. match = engineUserAgent.match(/Chrome\/(\d+)/);
  773. if (match) version = match[1];
  774. }
  775. }
  776. var engineV8Version = version && +version;
  777. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  778. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  779. // eslint-disable-next-line es/no-symbol -- required for testing
  780. return !Symbol.sham &&
  781. // Chrome 38 Symbol has incorrect toString conversion
  782. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  783. (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
  784. });
  785. /* eslint-disable es/no-symbol -- required for testing */
  786. var useSymbolAsUid = nativeSymbol
  787. && !Symbol.sham
  788. && typeof Symbol.iterator == 'symbol';
  789. var WellKnownSymbolsStore = shared('wks');
  790. var Symbol$1 = global_1.Symbol;
  791. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
  792. var wellKnownSymbol = function (name) {
  793. if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
  794. if (nativeSymbol && has$1(Symbol$1, name)) {
  795. WellKnownSymbolsStore[name] = Symbol$1[name];
  796. } else {
  797. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  798. }
  799. } return WellKnownSymbolsStore[name];
  800. };
  801. // TODO: Remove from `core-js@4` since it's moved to entry points
  802. var SPECIES$5 = wellKnownSymbol('species');
  803. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  804. // #replace needs built-in support for named groups.
  805. // #match works fine because it just return the exec results, even if it has
  806. // a "grops" property.
  807. var re = /./;
  808. re.exec = function () {
  809. var result = [];
  810. result.groups = { a: '7' };
  811. return result;
  812. };
  813. return ''.replace(re, '$<a>') !== '7';
  814. });
  815. // IE <= 11 replaces $0 with the whole match, as if it was $&
  816. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  817. var REPLACE_KEEPS_$0 = (function () {
  818. // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
  819. return 'a'.replace(/./, '$0') === '$0';
  820. })();
  821. var REPLACE = wellKnownSymbol('replace');
  822. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  823. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  824. if (/./[REPLACE]) {
  825. return /./[REPLACE]('a', '$0') === '';
  826. }
  827. return false;
  828. })();
  829. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  830. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  831. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  832. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  833. var re = /(?:)/;
  834. var originalExec = re.exec;
  835. re.exec = function () { return originalExec.apply(this, arguments); };
  836. var result = 'ab'.split(re);
  837. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  838. });
  839. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  840. var SYMBOL = wellKnownSymbol(KEY);
  841. var DELEGATES_TO_SYMBOL = !fails(function () {
  842. // String methods call symbol-named RegEp methods
  843. var O = {};
  844. O[SYMBOL] = function () { return 7; };
  845. return ''[KEY](O) != 7;
  846. });
  847. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  848. // Symbol-named RegExp methods call .exec
  849. var execCalled = false;
  850. var re = /a/;
  851. if (KEY === 'split') {
  852. // We can't use real regex here since it causes deoptimization
  853. // and serious performance degradation in V8
  854. // https://github.com/zloirock/core-js/issues/306
  855. re = {};
  856. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  857. // a new one. We need to return the patched regex when creating the new one.
  858. re.constructor = {};
  859. re.constructor[SPECIES$5] = function () { return re; };
  860. re.flags = '';
  861. re[SYMBOL] = /./[SYMBOL];
  862. }
  863. re.exec = function () { execCalled = true; return null; };
  864. re[SYMBOL]('');
  865. return !execCalled;
  866. });
  867. if (
  868. !DELEGATES_TO_SYMBOL ||
  869. !DELEGATES_TO_EXEC ||
  870. (KEY === 'replace' && !(
  871. REPLACE_SUPPORTS_NAMED_GROUPS &&
  872. REPLACE_KEEPS_$0 &&
  873. !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  874. )) ||
  875. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  876. ) {
  877. var nativeRegExpMethod = /./[SYMBOL];
  878. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  879. if (regexp.exec === RegExp.prototype.exec) {
  880. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  881. // The native String method already delegates to @@method (this
  882. // polyfilled function), leasing to infinite recursion.
  883. // We avoid it by directly calling the native @@method method.
  884. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  885. }
  886. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  887. }
  888. return { done: false };
  889. }, {
  890. REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
  891. REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  892. });
  893. var stringMethod = methods[0];
  894. var regexMethod = methods[1];
  895. redefine(String.prototype, KEY, stringMethod);
  896. redefine(RegExp.prototype, SYMBOL, length == 2
  897. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  898. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  899. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  900. // 21.2.5.6 RegExp.prototype[@@match](string)
  901. // 21.2.5.9 RegExp.prototype[@@search](string)
  902. : function (string) { return regexMethod.call(string, this); }
  903. );
  904. }
  905. if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
  906. };
  907. var MATCH$2 = wellKnownSymbol('match');
  908. // `IsRegExp` abstract operation
  909. // https://tc39.es/ecma262/#sec-isregexp
  910. var isRegexp = function (it) {
  911. var isRegExp;
  912. return isObject(it) && ((isRegExp = it[MATCH$2]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  913. };
  914. var aFunction = function (it) {
  915. if (typeof it != 'function') {
  916. throw TypeError(String(it) + ' is not a function');
  917. } return it;
  918. };
  919. var SPECIES$4 = wellKnownSymbol('species');
  920. // `SpeciesConstructor` abstract operation
  921. // https://tc39.es/ecma262/#sec-speciesconstructor
  922. var speciesConstructor = function (O, defaultConstructor) {
  923. var C = anObject(O).constructor;
  924. var S;
  925. return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction(S);
  926. };
  927. // `String.prototype.{ codePointAt, at }` methods implementation
  928. var createMethod$2 = function (CONVERT_TO_STRING) {
  929. return function ($this, pos) {
  930. var S = String(requireObjectCoercible($this));
  931. var position = toInteger(pos);
  932. var size = S.length;
  933. var first, second;
  934. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  935. first = S.charCodeAt(position);
  936. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  937. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  938. ? CONVERT_TO_STRING ? S.charAt(position) : first
  939. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  940. };
  941. };
  942. var stringMultibyte = {
  943. // `String.prototype.codePointAt` method
  944. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  945. codeAt: createMethod$2(false),
  946. // `String.prototype.at` method
  947. // https://github.com/mathiasbynens/String.prototype.at
  948. charAt: createMethod$2(true)
  949. };
  950. var charAt = stringMultibyte.charAt;
  951. // `AdvanceStringIndex` abstract operation
  952. // https://tc39.es/ecma262/#sec-advancestringindex
  953. var advanceStringIndex = function (S, index, unicode) {
  954. return index + (unicode ? charAt(S, index).length : 1);
  955. };
  956. // `RegExpExec` abstract operation
  957. // https://tc39.es/ecma262/#sec-regexpexec
  958. var regexpExecAbstract = function (R, S) {
  959. var exec = R.exec;
  960. if (typeof exec === 'function') {
  961. var result = exec.call(R, S);
  962. if (typeof result !== 'object') {
  963. throw TypeError('RegExp exec method returned something other than an Object or null');
  964. }
  965. return result;
  966. }
  967. if (classofRaw(R) !== 'RegExp') {
  968. throw TypeError('RegExp#exec called on incompatible receiver');
  969. }
  970. return regexpExec.call(R, S);
  971. };
  972. var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y;
  973. var arrayPush = [].push;
  974. var min$4 = Math.min;
  975. var MAX_UINT32 = 0xFFFFFFFF;
  976. // @@split logic
  977. fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
  978. var internalSplit;
  979. if (
  980. 'abbc'.split(/(b)*/)[1] == 'c' ||
  981. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  982. 'test'.split(/(?:)/, -1).length != 4 ||
  983. 'ab'.split(/(?:ab)*/).length != 2 ||
  984. '.'.split(/(.?)(.?)/).length != 4 ||
  985. // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
  986. '.'.split(/()()/).length > 1 ||
  987. ''.split(/.?/).length
  988. ) {
  989. // based on es5-shim implementation, need to rework it
  990. internalSplit = function (separator, limit) {
  991. var string = String(requireObjectCoercible(this));
  992. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  993. if (lim === 0) return [];
  994. if (separator === undefined) return [string];
  995. // If `separator` is not a regex, use native split
  996. if (!isRegexp(separator)) {
  997. return nativeSplit.call(string, separator, lim);
  998. }
  999. var output = [];
  1000. var flags = (separator.ignoreCase ? 'i' : '') +
  1001. (separator.multiline ? 'm' : '') +
  1002. (separator.unicode ? 'u' : '') +
  1003. (separator.sticky ? 'y' : '');
  1004. var lastLastIndex = 0;
  1005. // Make `global` and avoid `lastIndex` issues by working with a copy
  1006. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1007. var match, lastIndex, lastLength;
  1008. while (match = regexpExec.call(separatorCopy, string)) {
  1009. lastIndex = separatorCopy.lastIndex;
  1010. if (lastIndex > lastLastIndex) {
  1011. output.push(string.slice(lastLastIndex, match.index));
  1012. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1013. lastLength = match[0].length;
  1014. lastLastIndex = lastIndex;
  1015. if (output.length >= lim) break;
  1016. }
  1017. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1018. }
  1019. if (lastLastIndex === string.length) {
  1020. if (lastLength || !separatorCopy.test('')) output.push('');
  1021. } else output.push(string.slice(lastLastIndex));
  1022. return output.length > lim ? output.slice(0, lim) : output;
  1023. };
  1024. // Chakra, V8
  1025. } else if ('0'.split(undefined, 0).length) {
  1026. internalSplit = function (separator, limit) {
  1027. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1028. };
  1029. } else internalSplit = nativeSplit;
  1030. return [
  1031. // `String.prototype.split` method
  1032. // https://tc39.es/ecma262/#sec-string.prototype.split
  1033. function split(separator, limit) {
  1034. var O = requireObjectCoercible(this);
  1035. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1036. return splitter !== undefined
  1037. ? splitter.call(separator, O, limit)
  1038. : internalSplit.call(String(O), separator, limit);
  1039. },
  1040. // `RegExp.prototype[@@split]` method
  1041. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  1042. //
  1043. // NOTE: This cannot be properly polyfilled in engines that don't support
  1044. // the 'y' flag.
  1045. function (regexp, limit) {
  1046. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1047. if (res.done) return res.value;
  1048. var rx = anObject(regexp);
  1049. var S = String(this);
  1050. var C = speciesConstructor(rx, RegExp);
  1051. var unicodeMatching = rx.unicode;
  1052. var flags = (rx.ignoreCase ? 'i' : '') +
  1053. (rx.multiline ? 'm' : '') +
  1054. (rx.unicode ? 'u' : '') +
  1055. (UNSUPPORTED_Y$1 ? 'g' : 'y');
  1056. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1057. // simulate the 'y' flag.
  1058. var splitter = new C(UNSUPPORTED_Y$1 ? '^(?:' + rx.source + ')' : rx, flags);
  1059. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1060. if (lim === 0) return [];
  1061. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1062. var p = 0;
  1063. var q = 0;
  1064. var A = [];
  1065. while (q < S.length) {
  1066. splitter.lastIndex = UNSUPPORTED_Y$1 ? 0 : q;
  1067. var z = regexpExecAbstract(splitter, UNSUPPORTED_Y$1 ? S.slice(q) : S);
  1068. var e;
  1069. if (
  1070. z === null ||
  1071. (e = min$4(toLength(splitter.lastIndex + (UNSUPPORTED_Y$1 ? q : 0)), S.length)) === p
  1072. ) {
  1073. q = advanceStringIndex(S, q, unicodeMatching);
  1074. } else {
  1075. A.push(S.slice(p, q));
  1076. if (A.length === lim) return A;
  1077. for (var i = 1; i <= z.length - 1; i++) {
  1078. A.push(z[i]);
  1079. if (A.length === lim) return A;
  1080. }
  1081. q = p = e;
  1082. }
  1083. }
  1084. A.push(S.slice(p));
  1085. return A;
  1086. }
  1087. ];
  1088. }, UNSUPPORTED_Y$1);
  1089. // `Object.keys` method
  1090. // https://tc39.es/ecma262/#sec-object.keys
  1091. // eslint-disable-next-line es/no-object-keys -- safe
  1092. var objectKeys = Object.keys || function keys(O) {
  1093. return objectKeysInternal(O, enumBugKeys);
  1094. };
  1095. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  1096. // `Object.{ entries, values }` methods implementation
  1097. var createMethod$1 = function (TO_ENTRIES) {
  1098. return function (it) {
  1099. var O = toIndexedObject(it);
  1100. var keys = objectKeys(O);
  1101. var length = keys.length;
  1102. var i = 0;
  1103. var result = [];
  1104. var key;
  1105. while (length > i) {
  1106. key = keys[i++];
  1107. if (!descriptors || propertyIsEnumerable.call(O, key)) {
  1108. result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
  1109. }
  1110. }
  1111. return result;
  1112. };
  1113. };
  1114. var objectToArray = {
  1115. // `Object.entries` method
  1116. // https://tc39.es/ecma262/#sec-object.entries
  1117. entries: createMethod$1(true),
  1118. // `Object.values` method
  1119. // https://tc39.es/ecma262/#sec-object.values
  1120. values: createMethod$1(false)
  1121. };
  1122. var $entries = objectToArray.entries;
  1123. // `Object.entries` method
  1124. // https://tc39.es/ecma262/#sec-object.entries
  1125. _export({ target: 'Object', stat: true }, {
  1126. entries: function entries(O) {
  1127. return $entries(O);
  1128. }
  1129. });
  1130. // `Object.defineProperties` method
  1131. // https://tc39.es/ecma262/#sec-object.defineproperties
  1132. // eslint-disable-next-line es/no-object-defineproperties -- safe
  1133. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  1134. anObject(O);
  1135. var keys = objectKeys(Properties);
  1136. var length = keys.length;
  1137. var index = 0;
  1138. var key;
  1139. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  1140. return O;
  1141. };
  1142. var html = getBuiltIn('document', 'documentElement');
  1143. var GT = '>';
  1144. var LT = '<';
  1145. var PROTOTYPE = 'prototype';
  1146. var SCRIPT = 'script';
  1147. var IE_PROTO$1 = sharedKey('IE_PROTO');
  1148. var EmptyConstructor = function () { /* empty */ };
  1149. var scriptTag = function (content) {
  1150. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  1151. };
  1152. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  1153. var NullProtoObjectViaActiveX = function (activeXDocument) {
  1154. activeXDocument.write(scriptTag(''));
  1155. activeXDocument.close();
  1156. var temp = activeXDocument.parentWindow.Object;
  1157. activeXDocument = null; // avoid memory leak
  1158. return temp;
  1159. };
  1160. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  1161. var NullProtoObjectViaIFrame = function () {
  1162. // Thrash, waste and sodomy: IE GC bug
  1163. var iframe = documentCreateElement('iframe');
  1164. var JS = 'java' + SCRIPT + ':';
  1165. var iframeDocument;
  1166. iframe.style.display = 'none';
  1167. html.appendChild(iframe);
  1168. // https://github.com/zloirock/core-js/issues/475
  1169. iframe.src = String(JS);
  1170. iframeDocument = iframe.contentWindow.document;
  1171. iframeDocument.open();
  1172. iframeDocument.write(scriptTag('document.F=Object'));
  1173. iframeDocument.close();
  1174. return iframeDocument.F;
  1175. };
  1176. // Check for document.domain and active x support
  1177. // No need to use active x approach when document.domain is not set
  1178. // see https://github.com/es-shims/es5-shim/issues/150
  1179. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  1180. // avoid IE GC bug
  1181. var activeXDocument;
  1182. var NullProtoObject = function () {
  1183. try {
  1184. /* global ActiveXObject -- old IE */
  1185. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  1186. } catch (error) { /* ignore */ }
  1187. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  1188. var length = enumBugKeys.length;
  1189. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  1190. return NullProtoObject();
  1191. };
  1192. hiddenKeys$1[IE_PROTO$1] = true;
  1193. // `Object.create` method
  1194. // https://tc39.es/ecma262/#sec-object.create
  1195. var objectCreate = Object.create || function create(O, Properties) {
  1196. var result;
  1197. if (O !== null) {
  1198. EmptyConstructor[PROTOTYPE] = anObject(O);
  1199. result = new EmptyConstructor();
  1200. EmptyConstructor[PROTOTYPE] = null;
  1201. // add "__proto__" for Object.getPrototypeOf polyfill
  1202. result[IE_PROTO$1] = O;
  1203. } else result = NullProtoObject();
  1204. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  1205. };
  1206. var UNSCOPABLES = wellKnownSymbol('unscopables');
  1207. var ArrayPrototype = Array.prototype;
  1208. // Array.prototype[@@unscopables]
  1209. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1210. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  1211. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  1212. configurable: true,
  1213. value: objectCreate(null)
  1214. });
  1215. }
  1216. // add a key to Array.prototype[@@unscopables]
  1217. var addToUnscopables = function (key) {
  1218. ArrayPrototype[UNSCOPABLES][key] = true;
  1219. };
  1220. var $includes = arrayIncludes.includes;
  1221. // `Array.prototype.includes` method
  1222. // https://tc39.es/ecma262/#sec-array.prototype.includes
  1223. _export({ target: 'Array', proto: true }, {
  1224. includes: function includes(el /* , fromIndex = 0 */) {
  1225. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  1226. }
  1227. });
  1228. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1229. addToUnscopables('includes');
  1230. // `IsArray` abstract operation
  1231. // https://tc39.es/ecma262/#sec-isarray
  1232. // eslint-disable-next-line es/no-array-isarray -- safe
  1233. var isArray = Array.isArray || function isArray(arg) {
  1234. return classofRaw(arg) == 'Array';
  1235. };
  1236. // `ToObject` abstract operation
  1237. // https://tc39.es/ecma262/#sec-toobject
  1238. var toObject = function (argument) {
  1239. return Object(requireObjectCoercible(argument));
  1240. };
  1241. var createProperty = function (object, key, value) {
  1242. var propertyKey = toPrimitive(key);
  1243. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  1244. else object[propertyKey] = value;
  1245. };
  1246. var SPECIES$3 = wellKnownSymbol('species');
  1247. // `ArraySpeciesCreate` abstract operation
  1248. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  1249. var arraySpeciesCreate = function (originalArray, length) {
  1250. var C;
  1251. if (isArray(originalArray)) {
  1252. C = originalArray.constructor;
  1253. // cross-realm fallback
  1254. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  1255. else if (isObject(C)) {
  1256. C = C[SPECIES$3];
  1257. if (C === null) C = undefined;
  1258. }
  1259. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  1260. };
  1261. var SPECIES$2 = wellKnownSymbol('species');
  1262. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  1263. // We can't use this feature detection in V8 since it causes
  1264. // deoptimization and serious performance degradation
  1265. // https://github.com/zloirock/core-js/issues/677
  1266. return engineV8Version >= 51 || !fails(function () {
  1267. var array = [];
  1268. var constructor = array.constructor = {};
  1269. constructor[SPECIES$2] = function () {
  1270. return { foo: 1 };
  1271. };
  1272. return array[METHOD_NAME](Boolean).foo !== 1;
  1273. });
  1274. };
  1275. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  1276. var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
  1277. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  1278. // We can't use this feature detection in V8 since it causes
  1279. // deoptimization and serious performance degradation
  1280. // https://github.com/zloirock/core-js/issues/679
  1281. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  1282. var array = [];
  1283. array[IS_CONCAT_SPREADABLE] = false;
  1284. return array.concat()[0] !== array;
  1285. });
  1286. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  1287. var isConcatSpreadable = function (O) {
  1288. if (!isObject(O)) return false;
  1289. var spreadable = O[IS_CONCAT_SPREADABLE];
  1290. return spreadable !== undefined ? !!spreadable : isArray(O);
  1291. };
  1292. var FORCED$4 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  1293. // `Array.prototype.concat` method
  1294. // https://tc39.es/ecma262/#sec-array.prototype.concat
  1295. // with adding support of @@isConcatSpreadable and @@species
  1296. _export({ target: 'Array', proto: true, forced: FORCED$4 }, {
  1297. // eslint-disable-next-line no-unused-vars -- required for `.length`
  1298. concat: function concat(arg) {
  1299. var O = toObject(this);
  1300. var A = arraySpeciesCreate(O, 0);
  1301. var n = 0;
  1302. var i, k, length, len, E;
  1303. for (i = -1, length = arguments.length; i < length; i++) {
  1304. E = i === -1 ? O : arguments[i];
  1305. if (isConcatSpreadable(E)) {
  1306. len = toLength(E.length);
  1307. if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  1308. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  1309. } else {
  1310. if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  1311. createProperty(A, n++, E);
  1312. }
  1313. }
  1314. A.length = n;
  1315. return A;
  1316. }
  1317. });
  1318. // optional / simple context binding
  1319. var functionBindContext = function (fn, that, length) {
  1320. aFunction(fn);
  1321. if (that === undefined) return fn;
  1322. switch (length) {
  1323. case 0: return function () {
  1324. return fn.call(that);
  1325. };
  1326. case 1: return function (a) {
  1327. return fn.call(that, a);
  1328. };
  1329. case 2: return function (a, b) {
  1330. return fn.call(that, a, b);
  1331. };
  1332. case 3: return function (a, b, c) {
  1333. return fn.call(that, a, b, c);
  1334. };
  1335. }
  1336. return function (/* ...args */) {
  1337. return fn.apply(that, arguments);
  1338. };
  1339. };
  1340. var push = [].push;
  1341. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
  1342. var createMethod = function (TYPE) {
  1343. var IS_MAP = TYPE == 1;
  1344. var IS_FILTER = TYPE == 2;
  1345. var IS_SOME = TYPE == 3;
  1346. var IS_EVERY = TYPE == 4;
  1347. var IS_FIND_INDEX = TYPE == 6;
  1348. var IS_FILTER_OUT = TYPE == 7;
  1349. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  1350. return function ($this, callbackfn, that, specificCreate) {
  1351. var O = toObject($this);
  1352. var self = indexedObject(O);
  1353. var boundFunction = functionBindContext(callbackfn, that, 3);
  1354. var length = toLength(self.length);
  1355. var index = 0;
  1356. var create = specificCreate || arraySpeciesCreate;
  1357. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
  1358. var value, result;
  1359. for (;length > index; index++) if (NO_HOLES || index in self) {
  1360. value = self[index];
  1361. result = boundFunction(value, index, O);
  1362. if (TYPE) {
  1363. if (IS_MAP) target[index] = result; // map
  1364. else if (result) switch (TYPE) {
  1365. case 3: return true; // some
  1366. case 5: return value; // find
  1367. case 6: return index; // findIndex
  1368. case 2: push.call(target, value); // filter
  1369. } else switch (TYPE) {
  1370. case 4: return false; // every
  1371. case 7: push.call(target, value); // filterOut
  1372. }
  1373. }
  1374. }
  1375. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  1376. };
  1377. };
  1378. var arrayIteration = {
  1379. // `Array.prototype.forEach` method
  1380. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1381. forEach: createMethod(0),
  1382. // `Array.prototype.map` method
  1383. // https://tc39.es/ecma262/#sec-array.prototype.map
  1384. map: createMethod(1),
  1385. // `Array.prototype.filter` method
  1386. // https://tc39.es/ecma262/#sec-array.prototype.filter
  1387. filter: createMethod(2),
  1388. // `Array.prototype.some` method
  1389. // https://tc39.es/ecma262/#sec-array.prototype.some
  1390. some: createMethod(3),
  1391. // `Array.prototype.every` method
  1392. // https://tc39.es/ecma262/#sec-array.prototype.every
  1393. every: createMethod(4),
  1394. // `Array.prototype.find` method
  1395. // https://tc39.es/ecma262/#sec-array.prototype.find
  1396. find: createMethod(5),
  1397. // `Array.prototype.findIndex` method
  1398. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  1399. findIndex: createMethod(6),
  1400. // `Array.prototype.filterOut` method
  1401. // https://github.com/tc39/proposal-array-filtering
  1402. filterOut: createMethod(7)
  1403. };
  1404. var $find = arrayIteration.find;
  1405. var FIND = 'find';
  1406. var SKIPS_HOLES$1 = true;
  1407. // Shouldn't skip holes
  1408. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; });
  1409. // `Array.prototype.find` method
  1410. // https://tc39.es/ecma262/#sec-array.prototype.find
  1411. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, {
  1412. find: function find(callbackfn /* , that = undefined */) {
  1413. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1414. }
  1415. });
  1416. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1417. addToUnscopables(FIND);
  1418. var notARegexp = function (it) {
  1419. if (isRegexp(it)) {
  1420. throw TypeError("The method doesn't accept regular expressions");
  1421. } return it;
  1422. };
  1423. var MATCH$1 = wellKnownSymbol('match');
  1424. var correctIsRegexpLogic = function (METHOD_NAME) {
  1425. var regexp = /./;
  1426. try {
  1427. '/./'[METHOD_NAME](regexp);
  1428. } catch (error1) {
  1429. try {
  1430. regexp[MATCH$1] = false;
  1431. return '/./'[METHOD_NAME](regexp);
  1432. } catch (error2) { /* empty */ }
  1433. } return false;
  1434. };
  1435. // `String.prototype.includes` method
  1436. // https://tc39.es/ecma262/#sec-string.prototype.includes
  1437. _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
  1438. includes: function includes(searchString /* , position = 0 */) {
  1439. return !!~String(requireObjectCoercible(this))
  1440. .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
  1441. }
  1442. });
  1443. // iterable DOM collections
  1444. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1445. var domIterables = {
  1446. CSSRuleList: 0,
  1447. CSSStyleDeclaration: 0,
  1448. CSSValueList: 0,
  1449. ClientRectList: 0,
  1450. DOMRectList: 0,
  1451. DOMStringList: 0,
  1452. DOMTokenList: 1,
  1453. DataTransferItemList: 0,
  1454. FileList: 0,
  1455. HTMLAllCollection: 0,
  1456. HTMLCollection: 0,
  1457. HTMLFormElement: 0,
  1458. HTMLSelectElement: 0,
  1459. MediaList: 0,
  1460. MimeTypeArray: 0,
  1461. NamedNodeMap: 0,
  1462. NodeList: 1,
  1463. PaintRequestList: 0,
  1464. Plugin: 0,
  1465. PluginArray: 0,
  1466. SVGLengthList: 0,
  1467. SVGNumberList: 0,
  1468. SVGPathSegList: 0,
  1469. SVGPointList: 0,
  1470. SVGStringList: 0,
  1471. SVGTransformList: 0,
  1472. SourceBufferList: 0,
  1473. StyleSheetList: 0,
  1474. TextTrackCueList: 0,
  1475. TextTrackList: 0,
  1476. TouchList: 0
  1477. };
  1478. var $forEach = arrayIteration.forEach;
  1479. var STRICT_METHOD$2 = arrayMethodIsStrict('forEach');
  1480. // `Array.prototype.forEach` method implementation
  1481. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1482. var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) {
  1483. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1484. // eslint-disable-next-line es/no-array-prototype-foreach -- safe
  1485. } : [].forEach;
  1486. for (var COLLECTION_NAME$1 in domIterables) {
  1487. var Collection$1 = global_1[COLLECTION_NAME$1];
  1488. var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
  1489. // some Chrome versions have non-configurable methods on DOMTokenList
  1490. if (CollectionPrototype$1 && CollectionPrototype$1.forEach !== arrayForEach) try {
  1491. createNonEnumerableProperty(CollectionPrototype$1, 'forEach', arrayForEach);
  1492. } catch (error) {
  1493. CollectionPrototype$1.forEach = arrayForEach;
  1494. }
  1495. }
  1496. var trim$2 = stringTrim.trim;
  1497. var $parseFloat = global_1.parseFloat;
  1498. var FORCED$3 = 1 / $parseFloat(whitespaces + '-0') !== -Infinity;
  1499. // `parseFloat` method
  1500. // https://tc39.es/ecma262/#sec-parsefloat-string
  1501. var numberParseFloat = FORCED$3 ? function parseFloat(string) {
  1502. var trimmedString = trim$2(String(string));
  1503. var result = $parseFloat(trimmedString);
  1504. return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
  1505. } : $parseFloat;
  1506. // `parseFloat` method
  1507. // https://tc39.es/ecma262/#sec-parsefloat-string
  1508. _export({ global: true, forced: parseFloat != numberParseFloat }, {
  1509. parseFloat: numberParseFloat
  1510. });
  1511. /* eslint-disable es/no-array-prototype-indexof -- required for testing */
  1512. var $indexOf = arrayIncludes.indexOf;
  1513. var nativeIndexOf = [].indexOf;
  1514. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  1515. var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
  1516. // `Array.prototype.indexOf` method
  1517. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  1518. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 }, {
  1519. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  1520. return NEGATIVE_ZERO
  1521. // convert -0 to +0
  1522. ? nativeIndexOf.apply(this, arguments) || 0
  1523. : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  1524. }
  1525. });
  1526. var test$2 = [];
  1527. var nativeSort = test$2.sort;
  1528. // IE8-
  1529. var FAILS_ON_UNDEFINED = fails(function () {
  1530. test$2.sort(undefined);
  1531. });
  1532. // V8 bug
  1533. var FAILS_ON_NULL = fails(function () {
  1534. test$2.sort(null);
  1535. });
  1536. // Old WebKit
  1537. var STRICT_METHOD = arrayMethodIsStrict('sort');
  1538. var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD;
  1539. // `Array.prototype.sort` method
  1540. // https://tc39.es/ecma262/#sec-array.prototype.sort
  1541. _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
  1542. sort: function sort(comparefn) {
  1543. return comparefn === undefined
  1544. ? nativeSort.call(toObject(this))
  1545. : nativeSort.call(toObject(this), aFunction(comparefn));
  1546. }
  1547. });
  1548. var floor = Math.floor;
  1549. var replace = ''.replace;
  1550. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  1551. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  1552. // https://tc39.es/ecma262/#sec-getsubstitution
  1553. var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
  1554. var tailPos = position + matched.length;
  1555. var m = captures.length;
  1556. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1557. if (namedCaptures !== undefined) {
  1558. namedCaptures = toObject(namedCaptures);
  1559. symbols = SUBSTITUTION_SYMBOLS;
  1560. }
  1561. return replace.call(replacement, symbols, function (match, ch) {
  1562. var capture;
  1563. switch (ch.charAt(0)) {
  1564. case '$': return '$';
  1565. case '&': return matched;
  1566. case '`': return str.slice(0, position);
  1567. case "'": return str.slice(tailPos);
  1568. case '<':
  1569. capture = namedCaptures[ch.slice(1, -1)];
  1570. break;
  1571. default: // \d\d?
  1572. var n = +ch;
  1573. if (n === 0) return match;
  1574. if (n > m) {
  1575. var f = floor(n / 10);
  1576. if (f === 0) return match;
  1577. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1578. return match;
  1579. }
  1580. capture = captures[n - 1];
  1581. }
  1582. return capture === undefined ? '' : capture;
  1583. });
  1584. };
  1585. var max$2 = Math.max;
  1586. var min$3 = Math.min;
  1587. var maybeToString = function (it) {
  1588. return it === undefined ? it : String(it);
  1589. };
  1590. // @@replace logic
  1591. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
  1592. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
  1593. var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
  1594. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  1595. return [
  1596. // `String.prototype.replace` method
  1597. // https://tc39.es/ecma262/#sec-string.prototype.replace
  1598. function replace(searchValue, replaceValue) {
  1599. var O = requireObjectCoercible(this);
  1600. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  1601. return replacer !== undefined
  1602. ? replacer.call(searchValue, O, replaceValue)
  1603. : nativeReplace.call(String(O), searchValue, replaceValue);
  1604. },
  1605. // `RegExp.prototype[@@replace]` method
  1606. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  1607. function (regexp, replaceValue) {
  1608. if (
  1609. (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
  1610. (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
  1611. ) {
  1612. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  1613. if (res.done) return res.value;
  1614. }
  1615. var rx = anObject(regexp);
  1616. var S = String(this);
  1617. var functionalReplace = typeof replaceValue === 'function';
  1618. if (!functionalReplace) replaceValue = String(replaceValue);
  1619. var global = rx.global;
  1620. if (global) {
  1621. var fullUnicode = rx.unicode;
  1622. rx.lastIndex = 0;
  1623. }
  1624. var results = [];
  1625. while (true) {
  1626. var result = regexpExecAbstract(rx, S);
  1627. if (result === null) break;
  1628. results.push(result);
  1629. if (!global) break;
  1630. var matchStr = String(result[0]);
  1631. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1632. }
  1633. var accumulatedResult = '';
  1634. var nextSourcePosition = 0;
  1635. for (var i = 0; i < results.length; i++) {
  1636. result = results[i];
  1637. var matched = String(result[0]);
  1638. var position = max$2(min$3(toInteger(result.index), S.length), 0);
  1639. var captures = [];
  1640. // NOTE: This is equivalent to
  1641. // captures = result.slice(1).map(maybeToString)
  1642. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1643. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1644. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1645. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1646. var namedCaptures = result.groups;
  1647. if (functionalReplace) {
  1648. var replacerArgs = [matched].concat(captures, position, S);
  1649. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1650. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  1651. } else {
  1652. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1653. }
  1654. if (position >= nextSourcePosition) {
  1655. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1656. nextSourcePosition = position + matched.length;
  1657. }
  1658. }
  1659. return accumulatedResult + S.slice(nextSourcePosition);
  1660. }
  1661. ];
  1662. });
  1663. // eslint-disable-next-line es/no-object-assign -- safe
  1664. var $assign = Object.assign;
  1665. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  1666. var defineProperty$3 = Object.defineProperty;
  1667. // `Object.assign` method
  1668. // https://tc39.es/ecma262/#sec-object.assign
  1669. var objectAssign = !$assign || fails(function () {
  1670. // should have correct order of operations (Edge bug)
  1671. if (descriptors && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', {
  1672. enumerable: true,
  1673. get: function () {
  1674. defineProperty$3(this, 'b', {
  1675. value: 3,
  1676. enumerable: false
  1677. });
  1678. }
  1679. }), { b: 2 })).b !== 1) return true;
  1680. // should work with symbols and should have deterministic property order (V8 bug)
  1681. var A = {};
  1682. var B = {};
  1683. // eslint-disable-next-line es/no-symbol -- safe
  1684. var symbol = Symbol();
  1685. var alphabet = 'abcdefghijklmnopqrst';
  1686. A[symbol] = 7;
  1687. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  1688. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  1689. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  1690. var T = toObject(target);
  1691. var argumentsLength = arguments.length;
  1692. var index = 1;
  1693. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  1694. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  1695. while (argumentsLength > index) {
  1696. var S = indexedObject(arguments[index++]);
  1697. var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
  1698. var length = keys.length;
  1699. var j = 0;
  1700. var key;
  1701. while (length > j) {
  1702. key = keys[j++];
  1703. if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
  1704. }
  1705. } return T;
  1706. } : $assign;
  1707. // `Object.assign` method
  1708. // https://tc39.es/ecma262/#sec-object.assign
  1709. // eslint-disable-next-line es/no-object-assign -- required for testing
  1710. _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
  1711. assign: objectAssign
  1712. });
  1713. var $filter = arrayIteration.filter;
  1714. var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('filter');
  1715. // `Array.prototype.filter` method
  1716. // https://tc39.es/ecma262/#sec-array.prototype.filter
  1717. // with adding support of @@species
  1718. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, {
  1719. filter: function filter(callbackfn /* , thisArg */) {
  1720. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1721. }
  1722. });
  1723. // `SameValue` abstract operation
  1724. // https://tc39.es/ecma262/#sec-samevalue
  1725. // eslint-disable-next-line es/no-object-is -- safe
  1726. var sameValue = Object.is || function is(x, y) {
  1727. // eslint-disable-next-line no-self-compare -- NaN check
  1728. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  1729. };
  1730. // @@search logic
  1731. fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
  1732. return [
  1733. // `String.prototype.search` method
  1734. // https://tc39.es/ecma262/#sec-string.prototype.search
  1735. function search(regexp) {
  1736. var O = requireObjectCoercible(this);
  1737. var searcher = regexp == undefined ? undefined : regexp[SEARCH];
  1738. return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
  1739. },
  1740. // `RegExp.prototype[@@search]` method
  1741. // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
  1742. function (regexp) {
  1743. var res = maybeCallNative(nativeSearch, regexp, this);
  1744. if (res.done) return res.value;
  1745. var rx = anObject(regexp);
  1746. var S = String(this);
  1747. var previousLastIndex = rx.lastIndex;
  1748. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  1749. var result = regexpExecAbstract(rx, S);
  1750. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  1751. return result === null ? -1 : result.index;
  1752. }
  1753. ];
  1754. });
  1755. var trim$1 = stringTrim.trim;
  1756. var $parseInt = global_1.parseInt;
  1757. var hex = /^[+-]?0[Xx]/;
  1758. var FORCED$1 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22;
  1759. // `parseInt` method
  1760. // https://tc39.es/ecma262/#sec-parseint-string-radix
  1761. var numberParseInt = FORCED$1 ? function parseInt(string, radix) {
  1762. var S = trim$1(String(string));
  1763. return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
  1764. } : $parseInt;
  1765. // `parseInt` method
  1766. // https://tc39.es/ecma262/#sec-parseint-string-radix
  1767. _export({ global: true, forced: parseInt != numberParseInt }, {
  1768. parseInt: numberParseInt
  1769. });
  1770. var $map = arrayIteration.map;
  1771. var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
  1772. // `Array.prototype.map` method
  1773. // https://tc39.es/ecma262/#sec-array.prototype.map
  1774. // with adding support of @@species
  1775. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
  1776. map: function map(callbackfn /* , thisArg */) {
  1777. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1778. }
  1779. });
  1780. var $findIndex = arrayIteration.findIndex;
  1781. var FIND_INDEX = 'findIndex';
  1782. var SKIPS_HOLES = true;
  1783. // Shouldn't skip holes
  1784. if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
  1785. // `Array.prototype.findIndex` method
  1786. // https://tc39.es/ecma262/#sec-array.prototype.findindex
  1787. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  1788. findIndex: function findIndex(callbackfn /* , that = undefined */) {
  1789. return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1790. }
  1791. });
  1792. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1793. addToUnscopables(FIND_INDEX);
  1794. var aPossiblePrototype = function (it) {
  1795. if (!isObject(it) && it !== null) {
  1796. throw TypeError("Can't set " + String(it) + ' as a prototype');
  1797. } return it;
  1798. };
  1799. /* eslint-disable no-proto -- safe */
  1800. // `Object.setPrototypeOf` method
  1801. // https://tc39.es/ecma262/#sec-object.setprototypeof
  1802. // Works with __proto__ only. Old v8 can't work with null proto objects.
  1803. // eslint-disable-next-line es/no-object-setprototypeof -- safe
  1804. var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  1805. var CORRECT_SETTER = false;
  1806. var test = {};
  1807. var setter;
  1808. try {
  1809. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  1810. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  1811. setter.call(test, []);
  1812. CORRECT_SETTER = test instanceof Array;
  1813. } catch (error) { /* empty */ }
  1814. return function setPrototypeOf(O, proto) {
  1815. anObject(O);
  1816. aPossiblePrototype(proto);
  1817. if (CORRECT_SETTER) setter.call(O, proto);
  1818. else O.__proto__ = proto;
  1819. return O;
  1820. };
  1821. }() : undefined);
  1822. // makes subclassing work correct for wrapped built-ins
  1823. var inheritIfRequired = function ($this, dummy, Wrapper) {
  1824. var NewTarget, NewTargetPrototype;
  1825. if (
  1826. // it can work only with native `setPrototypeOf`
  1827. objectSetPrototypeOf &&
  1828. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  1829. typeof (NewTarget = dummy.constructor) == 'function' &&
  1830. NewTarget !== Wrapper &&
  1831. isObject(NewTargetPrototype = NewTarget.prototype) &&
  1832. NewTargetPrototype !== Wrapper.prototype
  1833. ) objectSetPrototypeOf($this, NewTargetPrototype);
  1834. return $this;
  1835. };
  1836. var SPECIES$1 = wellKnownSymbol('species');
  1837. var setSpecies = function (CONSTRUCTOR_NAME) {
  1838. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  1839. var defineProperty = objectDefineProperty.f;
  1840. if (descriptors && Constructor && !Constructor[SPECIES$1]) {
  1841. defineProperty(Constructor, SPECIES$1, {
  1842. configurable: true,
  1843. get: function () { return this; }
  1844. });
  1845. }
  1846. };
  1847. var defineProperty$2 = objectDefineProperty.f;
  1848. var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
  1849. var setInternalState$1 = internalState.set;
  1850. var MATCH = wellKnownSymbol('match');
  1851. var NativeRegExp = global_1.RegExp;
  1852. var RegExpPrototype$1 = NativeRegExp.prototype;
  1853. var re1 = /a/g;
  1854. var re2 = /a/g;
  1855. // "new" should create a new object, old webkit bug
  1856. var CORRECT_NEW = new NativeRegExp(re1) !== re1;
  1857. var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y;
  1858. var FORCED = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () {
  1859. re2[MATCH] = false;
  1860. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  1861. return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
  1862. })));
  1863. // `RegExp` constructor
  1864. // https://tc39.es/ecma262/#sec-regexp-constructor
  1865. if (FORCED) {
  1866. var RegExpWrapper = function RegExp(pattern, flags) {
  1867. var thisIsRegExp = this instanceof RegExpWrapper;
  1868. var patternIsRegExp = isRegexp(pattern);
  1869. var flagsAreUndefined = flags === undefined;
  1870. var sticky;
  1871. if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {
  1872. return pattern;
  1873. }
  1874. if (CORRECT_NEW) {
  1875. if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;
  1876. } else if (pattern instanceof RegExpWrapper) {
  1877. if (flagsAreUndefined) flags = regexpFlags.call(pattern);
  1878. pattern = pattern.source;
  1879. }
  1880. if (UNSUPPORTED_Y) {
  1881. sticky = !!flags && flags.indexOf('y') > -1;
  1882. if (sticky) flags = flags.replace(/y/g, '');
  1883. }
  1884. var result = inheritIfRequired(
  1885. CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),
  1886. thisIsRegExp ? this : RegExpPrototype$1,
  1887. RegExpWrapper
  1888. );
  1889. if (UNSUPPORTED_Y && sticky) setInternalState$1(result, { sticky: sticky });
  1890. return result;
  1891. };
  1892. var proxy = function (key) {
  1893. key in RegExpWrapper || defineProperty$2(RegExpWrapper, key, {
  1894. configurable: true,
  1895. get: function () { return NativeRegExp[key]; },
  1896. set: function (it) { NativeRegExp[key] = it; }
  1897. });
  1898. };
  1899. var keys$1 = getOwnPropertyNames$1(NativeRegExp);
  1900. var index = 0;
  1901. while (keys$1.length > index) proxy(keys$1[index++]);
  1902. RegExpPrototype$1.constructor = RegExpWrapper;
  1903. RegExpWrapper.prototype = RegExpPrototype$1;
  1904. redefine(global_1, 'RegExp', RegExpWrapper);
  1905. }
  1906. // https://tc39.es/ecma262/#sec-get-regexp-@@species
  1907. setSpecies('RegExp');
  1908. var TO_STRING = 'toString';
  1909. var RegExpPrototype = RegExp.prototype;
  1910. var nativeToString = RegExpPrototype[TO_STRING];
  1911. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  1912. // FF44- RegExp#toString has a wrong name
  1913. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  1914. // `RegExp.prototype.toString` method
  1915. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  1916. if (NOT_GENERIC || INCORRECT_NAME) {
  1917. redefine(RegExp.prototype, TO_STRING, function toString() {
  1918. var R = anObject(this);
  1919. var p = String(R.source);
  1920. var rf = R.flags;
  1921. var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
  1922. return '/' + p + '/' + f;
  1923. }, { unsafe: true });
  1924. }
  1925. var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
  1926. var test$1 = {};
  1927. test$1[TO_STRING_TAG$3] = 'z';
  1928. var toStringTagSupport = String(test$1) === '[object z]';
  1929. var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
  1930. // ES3 wrong here
  1931. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1932. // fallback for IE11 Script Access Denied error
  1933. var tryGet = function (it, key) {
  1934. try {
  1935. return it[key];
  1936. } catch (error) { /* empty */ }
  1937. };
  1938. // getting tag from ES6+ `Object.prototype.toString`
  1939. var classof = toStringTagSupport ? classofRaw : function (it) {
  1940. var O, tag, result;
  1941. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1942. // @@toStringTag case
  1943. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
  1944. // builtinTag case
  1945. : CORRECT_ARGUMENTS ? classofRaw(O)
  1946. // ES3 arguments fallback
  1947. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  1948. };
  1949. // `Object.prototype.toString` method implementation
  1950. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1951. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  1952. return '[object ' + classof(this) + ']';
  1953. };
  1954. // `Object.prototype.toString` method
  1955. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1956. if (!toStringTagSupport) {
  1957. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  1958. }
  1959. var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
  1960. var SPECIES = wellKnownSymbol('species');
  1961. var nativeSlice = [].slice;
  1962. var max$1 = Math.max;
  1963. // `Array.prototype.slice` method
  1964. // https://tc39.es/ecma262/#sec-array.prototype.slice
  1965. // fallback for not array-like ES3 strings and DOM objects
  1966. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
  1967. slice: function slice(start, end) {
  1968. var O = toIndexedObject(this);
  1969. var length = toLength(O.length);
  1970. var k = toAbsoluteIndex(start, length);
  1971. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  1972. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  1973. var Constructor, result, n;
  1974. if (isArray(O)) {
  1975. Constructor = O.constructor;
  1976. // cross-realm fallback
  1977. if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
  1978. Constructor = undefined;
  1979. } else if (isObject(Constructor)) {
  1980. Constructor = Constructor[SPECIES];
  1981. if (Constructor === null) Constructor = undefined;
  1982. }
  1983. if (Constructor === Array || Constructor === undefined) {
  1984. return nativeSlice.call(O, k, fin);
  1985. }
  1986. }
  1987. result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
  1988. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  1989. result.length = n;
  1990. return result;
  1991. }
  1992. });
  1993. var correctPrototypeGetter = !fails(function () {
  1994. function F() { /* empty */ }
  1995. F.prototype.constructor = null;
  1996. // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
  1997. return Object.getPrototypeOf(new F()) !== F.prototype;
  1998. });
  1999. var IE_PROTO = sharedKey('IE_PROTO');
  2000. var ObjectPrototype = Object.prototype;
  2001. // `Object.getPrototypeOf` method
  2002. // https://tc39.es/ecma262/#sec-object.getprototypeof
  2003. // eslint-disable-next-line es/no-object-getprototypeof -- safe
  2004. var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
  2005. O = toObject(O);
  2006. if (has$1(O, IE_PROTO)) return O[IE_PROTO];
  2007. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  2008. return O.constructor.prototype;
  2009. } return O instanceof Object ? ObjectPrototype : null;
  2010. };
  2011. var ITERATOR$2 = wellKnownSymbol('iterator');
  2012. var BUGGY_SAFARI_ITERATORS$1 = false;
  2013. var returnThis$1 = function () { return this; };
  2014. // `%IteratorPrototype%` object
  2015. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  2016. var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
  2017. /* eslint-disable es/no-array-prototype-keys -- safe */
  2018. if ([].keys) {
  2019. arrayIterator = [].keys();
  2020. // Safari 8 has buggy iterators w/o `next`
  2021. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
  2022. else {
  2023. PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
  2024. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
  2025. }
  2026. }
  2027. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
  2028. var test = {};
  2029. // FF44- legacy iterators case
  2030. return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
  2031. });
  2032. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
  2033. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  2034. if (!has$1(IteratorPrototype$2, ITERATOR$2)) {
  2035. createNonEnumerableProperty(IteratorPrototype$2, ITERATOR$2, returnThis$1);
  2036. }
  2037. var iteratorsCore = {
  2038. IteratorPrototype: IteratorPrototype$2,
  2039. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
  2040. };
  2041. var defineProperty$1 = objectDefineProperty.f;
  2042. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  2043. var setToStringTag = function (it, TAG, STATIC) {
  2044. if (it && !has$1(it = STATIC ? it : it.prototype, TO_STRING_TAG$1)) {
  2045. defineProperty$1(it, TO_STRING_TAG$1, { configurable: true, value: TAG });
  2046. }
  2047. };
  2048. var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
  2049. var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
  2050. var TO_STRING_TAG = NAME + ' Iterator';
  2051. IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
  2052. setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
  2053. return IteratorConstructor;
  2054. };
  2055. var IteratorPrototype = iteratorsCore.IteratorPrototype;
  2056. var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
  2057. var ITERATOR$1 = wellKnownSymbol('iterator');
  2058. var KEYS = 'keys';
  2059. var VALUES = 'values';
  2060. var ENTRIES = 'entries';
  2061. var returnThis = function () { return this; };
  2062. var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  2063. createIteratorConstructor(IteratorConstructor, NAME, next);
  2064. var getIterationMethod = function (KIND) {
  2065. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  2066. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  2067. switch (KIND) {
  2068. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  2069. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  2070. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  2071. } return function () { return new IteratorConstructor(this); };
  2072. };
  2073. var TO_STRING_TAG = NAME + ' Iterator';
  2074. var INCORRECT_VALUES_NAME = false;
  2075. var IterablePrototype = Iterable.prototype;
  2076. var nativeIterator = IterablePrototype[ITERATOR$1]
  2077. || IterablePrototype['@@iterator']
  2078. || DEFAULT && IterablePrototype[DEFAULT];
  2079. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  2080. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  2081. var CurrentIteratorPrototype, methods, KEY;
  2082. // fix native
  2083. if (anyNativeIterator) {
  2084. CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
  2085. if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  2086. if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  2087. if (objectSetPrototypeOf) {
  2088. objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  2089. } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
  2090. createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis);
  2091. }
  2092. }
  2093. // Set @@toStringTag to native iterators
  2094. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
  2095. }
  2096. }
  2097. // fix Array#{values, @@iterator}.name in V8 / FF
  2098. if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  2099. INCORRECT_VALUES_NAME = true;
  2100. defaultIterator = function values() { return nativeIterator.call(this); };
  2101. }
  2102. // define iterator
  2103. if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
  2104. createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
  2105. }
  2106. // export additional methods
  2107. if (DEFAULT) {
  2108. methods = {
  2109. values: getIterationMethod(VALUES),
  2110. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  2111. entries: getIterationMethod(ENTRIES)
  2112. };
  2113. if (FORCED) for (KEY in methods) {
  2114. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  2115. redefine(IterablePrototype, KEY, methods[KEY]);
  2116. }
  2117. } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  2118. }
  2119. return methods;
  2120. };
  2121. var ARRAY_ITERATOR = 'Array Iterator';
  2122. var setInternalState = internalState.set;
  2123. var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
  2124. // `Array.prototype.entries` method
  2125. // https://tc39.es/ecma262/#sec-array.prototype.entries
  2126. // `Array.prototype.keys` method
  2127. // https://tc39.es/ecma262/#sec-array.prototype.keys
  2128. // `Array.prototype.values` method
  2129. // https://tc39.es/ecma262/#sec-array.prototype.values
  2130. // `Array.prototype[@@iterator]` method
  2131. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  2132. // `CreateArrayIterator` internal method
  2133. // https://tc39.es/ecma262/#sec-createarrayiterator
  2134. var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
  2135. setInternalState(this, {
  2136. type: ARRAY_ITERATOR,
  2137. target: toIndexedObject(iterated), // target
  2138. index: 0, // next index
  2139. kind: kind // kind
  2140. });
  2141. // `%ArrayIteratorPrototype%.next` method
  2142. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  2143. }, function () {
  2144. var state = getInternalState(this);
  2145. var target = state.target;
  2146. var kind = state.kind;
  2147. var index = state.index++;
  2148. if (!target || index >= target.length) {
  2149. state.target = undefined;
  2150. return { value: undefined, done: true };
  2151. }
  2152. if (kind == 'keys') return { value: index, done: false };
  2153. if (kind == 'values') return { value: target[index], done: false };
  2154. return { value: [index, target[index]], done: false };
  2155. }, 'values');
  2156. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  2157. addToUnscopables('keys');
  2158. addToUnscopables('values');
  2159. addToUnscopables('entries');
  2160. var ITERATOR = wellKnownSymbol('iterator');
  2161. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2162. var ArrayValues = es_array_iterator.values;
  2163. for (var COLLECTION_NAME in domIterables) {
  2164. var Collection = global_1[COLLECTION_NAME];
  2165. var CollectionPrototype = Collection && Collection.prototype;
  2166. if (CollectionPrototype) {
  2167. // some Chrome versions have non-configurable methods on DOMTokenList
  2168. if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
  2169. createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
  2170. } catch (error) {
  2171. CollectionPrototype[ITERATOR] = ArrayValues;
  2172. }
  2173. if (!CollectionPrototype[TO_STRING_TAG]) {
  2174. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  2175. }
  2176. if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
  2177. // some Chrome versions have non-configurable methods on DOMTokenList
  2178. if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
  2179. createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
  2180. } catch (error) {
  2181. CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
  2182. }
  2183. }
  2184. }
  2185. }
  2186. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  2187. var max = Math.max;
  2188. var min$2 = Math.min;
  2189. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  2190. var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
  2191. // `Array.prototype.splice` method
  2192. // https://tc39.es/ecma262/#sec-array.prototype.splice
  2193. // with adding support of @@species
  2194. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  2195. splice: function splice(start, deleteCount /* , ...items */) {
  2196. var O = toObject(this);
  2197. var len = toLength(O.length);
  2198. var actualStart = toAbsoluteIndex(start, len);
  2199. var argumentsLength = arguments.length;
  2200. var insertCount, actualDeleteCount, A, k, from, to;
  2201. if (argumentsLength === 0) {
  2202. insertCount = actualDeleteCount = 0;
  2203. } else if (argumentsLength === 1) {
  2204. insertCount = 0;
  2205. actualDeleteCount = len - actualStart;
  2206. } else {
  2207. insertCount = argumentsLength - 2;
  2208. actualDeleteCount = min$2(max(toInteger(deleteCount), 0), len - actualStart);
  2209. }
  2210. if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
  2211. throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
  2212. }
  2213. A = arraySpeciesCreate(O, actualDeleteCount);
  2214. for (k = 0; k < actualDeleteCount; k++) {
  2215. from = actualStart + k;
  2216. if (from in O) createProperty(A, k, O[from]);
  2217. }
  2218. A.length = actualDeleteCount;
  2219. if (insertCount < actualDeleteCount) {
  2220. for (k = actualStart; k < len - actualDeleteCount; k++) {
  2221. from = k + actualDeleteCount;
  2222. to = k + insertCount;
  2223. if (from in O) O[to] = O[from];
  2224. else delete O[to];
  2225. }
  2226. for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
  2227. } else if (insertCount > actualDeleteCount) {
  2228. for (k = len - actualDeleteCount; k > actualStart; k--) {
  2229. from = k + actualDeleteCount - 1;
  2230. to = k + insertCount - 1;
  2231. if (from in O) O[to] = O[from];
  2232. else delete O[to];
  2233. }
  2234. }
  2235. for (k = 0; k < insertCount; k++) {
  2236. O[k + actualStart] = arguments[k + 2];
  2237. }
  2238. O.length = len - actualDeleteCount + insertCount;
  2239. return A;
  2240. }
  2241. });
  2242. var getOwnPropertyNames = objectGetOwnPropertyNames.f;
  2243. var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
  2244. var defineProperty = objectDefineProperty.f;
  2245. var trim = stringTrim.trim;
  2246. var NUMBER = 'Number';
  2247. var NativeNumber = global_1[NUMBER];
  2248. var NumberPrototype = NativeNumber.prototype;
  2249. // Opera ~12 has broken Object#toString
  2250. var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
  2251. // `ToNumber` abstract operation
  2252. // https://tc39.es/ecma262/#sec-tonumber
  2253. var toNumber = function (argument) {
  2254. var it = toPrimitive(argument, false);
  2255. var first, third, radix, maxCode, digits, length, index, code;
  2256. if (typeof it == 'string' && it.length > 2) {
  2257. it = trim(it);
  2258. first = it.charCodeAt(0);
  2259. if (first === 43 || first === 45) {
  2260. third = it.charCodeAt(2);
  2261. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  2262. } else if (first === 48) {
  2263. switch (it.charCodeAt(1)) {
  2264. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  2265. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  2266. default: return +it;
  2267. }
  2268. digits = it.slice(2);
  2269. length = digits.length;
  2270. for (index = 0; index < length; index++) {
  2271. code = digits.charCodeAt(index);
  2272. // parseInt parses a string to a first unavailable symbol
  2273. // but ToNumber should return NaN if a string contains unavailable symbols
  2274. if (code < 48 || code > maxCode) return NaN;
  2275. } return parseInt(digits, radix);
  2276. }
  2277. } return +it;
  2278. };
  2279. // `Number` constructor
  2280. // https://tc39.es/ecma262/#sec-number-constructor
  2281. if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  2282. var NumberWrapper = function Number(value) {
  2283. var it = arguments.length < 1 ? 0 : value;
  2284. var dummy = this;
  2285. return dummy instanceof NumberWrapper
  2286. // check on 1..constructor(foo) case
  2287. && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
  2288. ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
  2289. };
  2290. for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : (
  2291. // ES3:
  2292. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  2293. // ES2015 (in case, if modules with ES2015 Number statics required before):
  2294. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
  2295. 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' +
  2296. // ESNext
  2297. 'fromString,range'
  2298. ).split(','), j = 0, key; keys.length > j; j++) {
  2299. if (has$1(NativeNumber, key = keys[j]) && !has$1(NumberWrapper, key)) {
  2300. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
  2301. }
  2302. }
  2303. NumberWrapper.prototype = NumberPrototype;
  2304. NumberPrototype.constructor = NumberWrapper;
  2305. redefine(global_1, NUMBER, NumberWrapper);
  2306. }
  2307. var nativeReverse = [].reverse;
  2308. var test = [1, 2];
  2309. // `Array.prototype.reverse` method
  2310. // https://tc39.es/ecma262/#sec-array.prototype.reverse
  2311. // fix for Safari 12.0 bug
  2312. // https://bugs.webkit.org/show_bug.cgi?id=188794
  2313. _export({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
  2314. reverse: function reverse() {
  2315. // eslint-disable-next-line no-self-assign -- dirty hack
  2316. if (isArray(this)) this.length = this.length;
  2317. return nativeReverse.call(this);
  2318. }
  2319. });
  2320. /* eslint-disable no-unused-vars */
  2321. var VERSION = '1.19.0';
  2322. var bootstrapVersion = 4;
  2323. try {
  2324. var rawVersion = $__default['default'].fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
  2325. // It is undefined in older versions of Bootstrap (tested with 3.1.1).
  2326. if (rawVersion !== undefined) {
  2327. bootstrapVersion = parseInt(rawVersion, 10);
  2328. }
  2329. } catch (e) {// ignore
  2330. }
  2331. try {
  2332. // eslint-disable-next-line no-undef
  2333. var _rawVersion = bootstrap.Tooltip.VERSION;
  2334. if (_rawVersion !== undefined) {
  2335. bootstrapVersion = parseInt(_rawVersion, 10);
  2336. }
  2337. } catch (e) {// ignore
  2338. }
  2339. var CONSTANTS = {
  2340. 3: {
  2341. iconsPrefix: 'glyphicon',
  2342. icons: {
  2343. paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
  2344. paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
  2345. refresh: 'glyphicon-refresh icon-refresh',
  2346. toggleOff: 'glyphicon-list-alt icon-list-alt',
  2347. toggleOn: 'glyphicon-list-alt icon-list-alt',
  2348. columns: 'glyphicon-th icon-th',
  2349. detailOpen: 'glyphicon-plus icon-plus',
  2350. detailClose: 'glyphicon-minus icon-minus',
  2351. fullscreen: 'glyphicon-fullscreen',
  2352. search: 'glyphicon-search',
  2353. clearSearch: 'glyphicon-trash'
  2354. },
  2355. classes: {
  2356. buttonsPrefix: 'btn',
  2357. buttons: 'default',
  2358. buttonsGroup: 'btn-group',
  2359. buttonsDropdown: 'btn-group',
  2360. pull: 'pull',
  2361. inputGroup: 'input-group',
  2362. inputPrefix: 'input-',
  2363. input: 'form-control',
  2364. paginationDropdown: 'btn-group dropdown',
  2365. dropup: 'dropup',
  2366. dropdownActive: 'active',
  2367. paginationActive: 'active',
  2368. buttonActive: 'active'
  2369. },
  2370. html: {
  2371. toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  2372. toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',
  2373. toolbarDropdownSeparator: '<li class="divider"></li>',
  2374. pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  2375. pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
  2376. dropdownCaret: '<span class="caret"></span>',
  2377. pagination: ['<ul class="pagination%s">', '</ul>'],
  2378. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  2379. icon: '<i class="%s %s"></i>',
  2380. inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
  2381. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  2382. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  2383. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  2384. }
  2385. },
  2386. 4: {
  2387. iconsPrefix: 'fa',
  2388. icons: {
  2389. paginationSwitchDown: 'fa-caret-square-down',
  2390. paginationSwitchUp: 'fa-caret-square-up',
  2391. refresh: 'fa-sync',
  2392. toggleOff: 'fa-toggle-off',
  2393. toggleOn: 'fa-toggle-on',
  2394. columns: 'fa-th-list',
  2395. detailOpen: 'fa-plus',
  2396. detailClose: 'fa-minus',
  2397. fullscreen: 'fa-arrows-alt',
  2398. search: 'fa-search',
  2399. clearSearch: 'fa-trash'
  2400. },
  2401. classes: {
  2402. buttonsPrefix: 'btn',
  2403. buttons: 'secondary',
  2404. buttonsGroup: 'btn-group',
  2405. buttonsDropdown: 'btn-group',
  2406. pull: 'float',
  2407. inputGroup: 'btn-group',
  2408. inputPrefix: 'form-control-',
  2409. input: 'form-control',
  2410. paginationDropdown: 'btn-group dropdown',
  2411. dropup: 'dropup',
  2412. dropdownActive: 'active',
  2413. paginationActive: 'active',
  2414. buttonActive: 'active'
  2415. },
  2416. html: {
  2417. toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  2418. toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
  2419. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  2420. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  2421. toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
  2422. dropdownCaret: '<span class="caret"></span>',
  2423. pagination: ['<ul class="pagination%s">', '</ul>'],
  2424. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  2425. icon: '<i class="%s %s"></i>',
  2426. inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
  2427. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  2428. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  2429. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  2430. }
  2431. },
  2432. 5: {
  2433. iconsPrefix: 'bi',
  2434. icons: {
  2435. paginationSwitchDown: 'bi-caret-down-square',
  2436. paginationSwitchUp: 'bi-caret-up-square',
  2437. refresh: 'bi-arrow-clockwise',
  2438. toggleOff: 'bi-toggle-off',
  2439. toggleOn: 'bi-toggle-on',
  2440. columns: 'bi-list-ul',
  2441. detailOpen: 'bi-plus',
  2442. detailClose: 'bi-dash',
  2443. fullscreen: 'bi-arrows-move',
  2444. search: 'bi-search',
  2445. clearSearch: 'bi-trash'
  2446. },
  2447. classes: {
  2448. buttonsPrefix: 'btn',
  2449. buttons: 'secondary',
  2450. buttonsGroup: 'btn-group',
  2451. buttonsDropdown: 'btn-group',
  2452. pull: 'float',
  2453. inputGroup: 'btn-group',
  2454. inputPrefix: 'form-control-',
  2455. input: 'form-control',
  2456. paginationDropdown: 'btn-group dropdown',
  2457. dropup: 'dropup',
  2458. dropdownActive: 'active',
  2459. paginationActive: 'active',
  2460. buttonActive: 'active'
  2461. },
  2462. html: {
  2463. dataToggle: 'data-bs-toggle',
  2464. toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  2465. toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
  2466. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  2467. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  2468. toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
  2469. dropdownCaret: '<span class="caret"></span>',
  2470. pagination: ['<ul class="pagination%s">', '</ul>'],
  2471. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  2472. icon: '<i class="%s %s"></i>',
  2473. inputGroup: '<div class="input-group">%s%s</div>',
  2474. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  2475. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  2476. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  2477. }
  2478. }
  2479. }[bootstrapVersion];
  2480. var DEFAULTS = {
  2481. height: undefined,
  2482. classes: 'table table-bordered table-hover',
  2483. buttons: {},
  2484. theadClasses: '',
  2485. headerStyle: function headerStyle(column) {
  2486. return {};
  2487. },
  2488. rowStyle: function rowStyle(row, index) {
  2489. return {};
  2490. },
  2491. rowAttributes: function rowAttributes(row, index) {
  2492. return {};
  2493. },
  2494. undefinedText: '-',
  2495. locale: undefined,
  2496. virtualScroll: false,
  2497. virtualScrollItemHeight: undefined,
  2498. sortable: true,
  2499. sortClass: undefined,
  2500. silentSort: true,
  2501. sortName: undefined,
  2502. sortOrder: undefined,
  2503. sortReset: false,
  2504. sortStable: false,
  2505. rememberOrder: false,
  2506. serverSort: true,
  2507. customSort: undefined,
  2508. columns: [[]],
  2509. data: [],
  2510. url: undefined,
  2511. method: 'get',
  2512. cache: true,
  2513. contentType: 'application/json',
  2514. dataType: 'json',
  2515. ajax: undefined,
  2516. ajaxOptions: {},
  2517. queryParams: function queryParams(params) {
  2518. return params;
  2519. },
  2520. queryParamsType: 'limit',
  2521. // 'limit', undefined
  2522. responseHandler: function responseHandler(res) {
  2523. return res;
  2524. },
  2525. totalField: 'total',
  2526. totalNotFilteredField: 'totalNotFiltered',
  2527. dataField: 'rows',
  2528. footerField: 'footer',
  2529. pagination: false,
  2530. paginationParts: ['pageInfo', 'pageSize', 'pageList'],
  2531. showExtendedPagination: false,
  2532. paginationLoop: true,
  2533. sidePagination: 'client',
  2534. // client or server
  2535. totalRows: 0,
  2536. totalNotFiltered: 0,
  2537. pageNumber: 1,
  2538. pageSize: 10,
  2539. pageList: [10, 25, 50, 100],
  2540. paginationHAlign: 'right',
  2541. // right, left
  2542. paginationVAlign: 'bottom',
  2543. // bottom, top, both
  2544. paginationDetailHAlign: 'left',
  2545. // right, left
  2546. paginationPreText: '&lsaquo;',
  2547. paginationNextText: '&rsaquo;',
  2548. paginationSuccessivelySize: 5,
  2549. // Maximum successively number of pages in a row
  2550. paginationPagesBySide: 1,
  2551. // Number of pages on each side (right, left) of the current page.
  2552. paginationUseIntermediate: false,
  2553. // Calculate intermediate pages for quick access
  2554. search: false,
  2555. searchHighlight: false,
  2556. searchOnEnterKey: false,
  2557. strictSearch: false,
  2558. regexSearch: false,
  2559. searchSelector: false,
  2560. visibleSearch: false,
  2561. showButtonIcons: true,
  2562. showButtonText: false,
  2563. showSearchButton: false,
  2564. showSearchClearButton: false,
  2565. trimOnSearch: true,
  2566. searchAlign: 'right',
  2567. searchTimeOut: 500,
  2568. searchText: '',
  2569. customSearch: undefined,
  2570. showHeader: true,
  2571. showFooter: false,
  2572. footerStyle: function footerStyle(column) {
  2573. return {};
  2574. },
  2575. searchAccentNeutralise: false,
  2576. showColumns: false,
  2577. showColumnsToggleAll: false,
  2578. showColumnsSearch: false,
  2579. minimumCountColumns: 1,
  2580. showPaginationSwitch: false,
  2581. showRefresh: false,
  2582. showToggle: false,
  2583. showFullscreen: false,
  2584. smartDisplay: true,
  2585. escape: false,
  2586. filterOptions: {
  2587. filterAlgorithm: 'and'
  2588. },
  2589. idField: undefined,
  2590. selectItemName: 'btSelectItem',
  2591. clickToSelect: false,
  2592. ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
  2593. var tagName = _ref.tagName;
  2594. return ['A', 'BUTTON'].includes(tagName);
  2595. },
  2596. singleSelect: false,
  2597. checkboxHeader: true,
  2598. maintainMetaData: false,
  2599. multipleSelectRow: false,
  2600. uniqueId: undefined,
  2601. cardView: false,
  2602. detailView: false,
  2603. detailViewIcon: true,
  2604. detailViewByClick: false,
  2605. detailViewAlign: 'left',
  2606. detailFormatter: function detailFormatter(index, row) {
  2607. return '';
  2608. },
  2609. detailFilter: function detailFilter(index, row) {
  2610. return true;
  2611. },
  2612. toolbar: undefined,
  2613. toolbarAlign: 'left',
  2614. buttonsToolbar: undefined,
  2615. buttonsAlign: 'right',
  2616. buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'],
  2617. buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
  2618. buttonsClass: CONSTANTS.classes.buttons,
  2619. icons: CONSTANTS.icons,
  2620. iconSize: undefined,
  2621. iconsPrefix: CONSTANTS.iconsPrefix,
  2622. // glyphicon or fa(font-awesome)
  2623. loadingFontSize: 'auto',
  2624. loadingTemplate: function loadingTemplate(loadingMessage) {
  2625. return "<span class=\"loading-wrap\">\n <span class=\"loading-text\">".concat(loadingMessage, "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n ");
  2626. },
  2627. onAll: function onAll(name, args) {
  2628. return false;
  2629. },
  2630. onClickCell: function onClickCell(field, value, row, $element) {
  2631. return false;
  2632. },
  2633. onDblClickCell: function onDblClickCell(field, value, row, $element) {
  2634. return false;
  2635. },
  2636. onClickRow: function onClickRow(item, $element) {
  2637. return false;
  2638. },
  2639. onDblClickRow: function onDblClickRow(item, $element) {
  2640. return false;
  2641. },
  2642. onSort: function onSort(name, order) {
  2643. return false;
  2644. },
  2645. onCheck: function onCheck(row) {
  2646. return false;
  2647. },
  2648. onUncheck: function onUncheck(row) {
  2649. return false;
  2650. },
  2651. onCheckAll: function onCheckAll(rows) {
  2652. return false;
  2653. },
  2654. onUncheckAll: function onUncheckAll(rows) {
  2655. return false;
  2656. },
  2657. onCheckSome: function onCheckSome(rows) {
  2658. return false;
  2659. },
  2660. onUncheckSome: function onUncheckSome(rows) {
  2661. return false;
  2662. },
  2663. onLoadSuccess: function onLoadSuccess(data) {
  2664. return false;
  2665. },
  2666. onLoadError: function onLoadError(status) {
  2667. return false;
  2668. },
  2669. onColumnSwitch: function onColumnSwitch(field, checked) {
  2670. return false;
  2671. },
  2672. onPageChange: function onPageChange(number, size) {
  2673. return false;
  2674. },
  2675. onSearch: function onSearch(text) {
  2676. return false;
  2677. },
  2678. onToggle: function onToggle(cardView) {
  2679. return false;
  2680. },
  2681. onPreBody: function onPreBody(data) {
  2682. return false;
  2683. },
  2684. onPostBody: function onPostBody() {
  2685. return false;
  2686. },
  2687. onPostHeader: function onPostHeader() {
  2688. return false;
  2689. },
  2690. onPostFooter: function onPostFooter() {
  2691. return false;
  2692. },
  2693. onExpandRow: function onExpandRow(index, row, $detail) {
  2694. return false;
  2695. },
  2696. onCollapseRow: function onCollapseRow(index, row) {
  2697. return false;
  2698. },
  2699. onRefreshOptions: function onRefreshOptions(options) {
  2700. return false;
  2701. },
  2702. onRefresh: function onRefresh(params) {
  2703. return false;
  2704. },
  2705. onResetView: function onResetView() {
  2706. return false;
  2707. },
  2708. onScrollBody: function onScrollBody() {
  2709. return false;
  2710. },
  2711. onTogglePagination: function onTogglePagination(newState) {
  2712. return false;
  2713. }
  2714. };
  2715. var EN = {
  2716. formatLoadingMessage: function formatLoadingMessage() {
  2717. return 'Loading, please wait';
  2718. },
  2719. formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
  2720. return "".concat(pageNumber, " rows per page");
  2721. },
  2722. formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
  2723. if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
  2724. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
  2725. }
  2726. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
  2727. },
  2728. formatSRPaginationPreText: function formatSRPaginationPreText() {
  2729. return 'previous page';
  2730. },
  2731. formatSRPaginationPageText: function formatSRPaginationPageText(page) {
  2732. return "to page ".concat(page);
  2733. },
  2734. formatSRPaginationNextText: function formatSRPaginationNextText() {
  2735. return 'next page';
  2736. },
  2737. formatDetailPagination: function formatDetailPagination(totalRows) {
  2738. return "Showing ".concat(totalRows, " rows");
  2739. },
  2740. formatSearch: function formatSearch() {
  2741. return 'Search';
  2742. },
  2743. formatClearSearch: function formatClearSearch() {
  2744. return 'Clear Search';
  2745. },
  2746. formatNoMatches: function formatNoMatches() {
  2747. return 'No matching records found';
  2748. },
  2749. formatPaginationSwitch: function formatPaginationSwitch() {
  2750. return 'Hide/Show pagination';
  2751. },
  2752. formatPaginationSwitchDown: function formatPaginationSwitchDown() {
  2753. return 'Show pagination';
  2754. },
  2755. formatPaginationSwitchUp: function formatPaginationSwitchUp() {
  2756. return 'Hide pagination';
  2757. },
  2758. formatRefresh: function formatRefresh() {
  2759. return 'Refresh';
  2760. },
  2761. formatToggle: function formatToggle() {
  2762. return 'Toggle';
  2763. },
  2764. formatToggleOn: function formatToggleOn() {
  2765. return 'Show card view';
  2766. },
  2767. formatToggleOff: function formatToggleOff() {
  2768. return 'Hide card view';
  2769. },
  2770. formatColumns: function formatColumns() {
  2771. return 'Columns';
  2772. },
  2773. formatColumnsToggleAll: function formatColumnsToggleAll() {
  2774. return 'Toggle all';
  2775. },
  2776. formatFullscreen: function formatFullscreen() {
  2777. return 'Fullscreen';
  2778. },
  2779. formatAllRows: function formatAllRows() {
  2780. return 'All';
  2781. }
  2782. };
  2783. var COLUMN_DEFAULTS = {
  2784. field: undefined,
  2785. title: undefined,
  2786. titleTooltip: undefined,
  2787. class: undefined,
  2788. width: undefined,
  2789. widthUnit: 'px',
  2790. rowspan: undefined,
  2791. colspan: undefined,
  2792. align: undefined,
  2793. // left, right, center
  2794. halign: undefined,
  2795. // left, right, center
  2796. falign: undefined,
  2797. // left, right, center
  2798. valign: undefined,
  2799. // top, middle, bottom
  2800. cellStyle: undefined,
  2801. radio: false,
  2802. checkbox: false,
  2803. checkboxEnabled: true,
  2804. clickToSelect: true,
  2805. showSelectTitle: false,
  2806. sortable: false,
  2807. sortName: undefined,
  2808. order: 'asc',
  2809. // asc, desc
  2810. sorter: undefined,
  2811. visible: true,
  2812. switchable: true,
  2813. cardVisible: true,
  2814. searchable: true,
  2815. formatter: undefined,
  2816. footerFormatter: undefined,
  2817. detailFormatter: undefined,
  2818. searchFormatter: true,
  2819. searchHighlightFormatter: false,
  2820. escape: false,
  2821. events: undefined
  2822. };
  2823. var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandRowByUniqueId', 'collapseRowByUniqueId', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText'];
  2824. var EVENTS = {
  2825. 'all.bs.table': 'onAll',
  2826. 'click-row.bs.table': 'onClickRow',
  2827. 'dbl-click-row.bs.table': 'onDblClickRow',
  2828. 'click-cell.bs.table': 'onClickCell',
  2829. 'dbl-click-cell.bs.table': 'onDblClickCell',
  2830. 'sort.bs.table': 'onSort',
  2831. 'check.bs.table': 'onCheck',
  2832. 'uncheck.bs.table': 'onUncheck',
  2833. 'check-all.bs.table': 'onCheckAll',
  2834. 'uncheck-all.bs.table': 'onUncheckAll',
  2835. 'check-some.bs.table': 'onCheckSome',
  2836. 'uncheck-some.bs.table': 'onUncheckSome',
  2837. 'load-success.bs.table': 'onLoadSuccess',
  2838. 'load-error.bs.table': 'onLoadError',
  2839. 'column-switch.bs.table': 'onColumnSwitch',
  2840. 'page-change.bs.table': 'onPageChange',
  2841. 'search.bs.table': 'onSearch',
  2842. 'toggle.bs.table': 'onToggle',
  2843. 'pre-body.bs.table': 'onPreBody',
  2844. 'post-body.bs.table': 'onPostBody',
  2845. 'post-header.bs.table': 'onPostHeader',
  2846. 'post-footer.bs.table': 'onPostFooter',
  2847. 'expand-row.bs.table': 'onExpandRow',
  2848. 'collapse-row.bs.table': 'onCollapseRow',
  2849. 'refresh-options.bs.table': 'onRefreshOptions',
  2850. 'reset-view.bs.table': 'onResetView',
  2851. 'refresh.bs.table': 'onRefresh',
  2852. 'scroll-body.bs.table': 'onScrollBody',
  2853. 'toggle-pagination.bs.table': 'onTogglePagination',
  2854. 'virtual-scroll.bs.table': 'onVirtualScroll'
  2855. };
  2856. Object.assign(DEFAULTS, EN);
  2857. var Constants = {
  2858. VERSION: VERSION,
  2859. THEME: "bootstrap".concat(bootstrapVersion),
  2860. CONSTANTS: CONSTANTS,
  2861. DEFAULTS: DEFAULTS,
  2862. COLUMN_DEFAULTS: COLUMN_DEFAULTS,
  2863. METHODS: METHODS,
  2864. EVENTS: EVENTS,
  2865. LOCALES: {
  2866. en: EN,
  2867. 'en-US': EN
  2868. }
  2869. };
  2870. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  2871. // `Object.keys` method
  2872. // https://tc39.es/ecma262/#sec-object.keys
  2873. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  2874. keys: function keys(it) {
  2875. return objectKeys(toObject(it));
  2876. }
  2877. });
  2878. // @@match logic
  2879. fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
  2880. return [
  2881. // `String.prototype.match` method
  2882. // https://tc39.es/ecma262/#sec-string.prototype.match
  2883. function match(regexp) {
  2884. var O = requireObjectCoercible(this);
  2885. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  2886. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  2887. },
  2888. // `RegExp.prototype[@@match]` method
  2889. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  2890. function (regexp) {
  2891. var res = maybeCallNative(nativeMatch, regexp, this);
  2892. if (res.done) return res.value;
  2893. var rx = anObject(regexp);
  2894. var S = String(this);
  2895. if (!rx.global) return regexpExecAbstract(rx, S);
  2896. var fullUnicode = rx.unicode;
  2897. rx.lastIndex = 0;
  2898. var A = [];
  2899. var n = 0;
  2900. var result;
  2901. while ((result = regexpExecAbstract(rx, S)) !== null) {
  2902. var matchStr = String(result[0]);
  2903. A[n] = matchStr;
  2904. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  2905. n++;
  2906. }
  2907. return n === 0 ? null : A;
  2908. }
  2909. ];
  2910. });
  2911. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  2912. // eslint-disable-next-line es/no-string-prototype-startswith -- safe
  2913. var $startsWith = ''.startsWith;
  2914. var min$1 = Math.min;
  2915. var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith');
  2916. // https://github.com/zloirock/core-js/pull/702
  2917. var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
  2918. var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'startsWith');
  2919. return descriptor && !descriptor.writable;
  2920. }();
  2921. // `String.prototype.startsWith` method
  2922. // https://tc39.es/ecma262/#sec-string.prototype.startswith
  2923. _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
  2924. startsWith: function startsWith(searchString /* , position = 0 */) {
  2925. var that = String(requireObjectCoercible(this));
  2926. notARegexp(searchString);
  2927. var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
  2928. var search = String(searchString);
  2929. return $startsWith
  2930. ? $startsWith.call(that, search, index)
  2931. : that.slice(index, index + search.length) === search;
  2932. }
  2933. });
  2934. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  2935. // eslint-disable-next-line es/no-string-prototype-endswith -- safe
  2936. var $endsWith = ''.endsWith;
  2937. var min = Math.min;
  2938. var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith');
  2939. // https://github.com/zloirock/core-js/pull/702
  2940. var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
  2941. var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith');
  2942. return descriptor && !descriptor.writable;
  2943. }();
  2944. // `String.prototype.endsWith` method
  2945. // https://tc39.es/ecma262/#sec-string.prototype.endswith
  2946. _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
  2947. endsWith: function endsWith(searchString /* , endPosition = @length */) {
  2948. var that = String(requireObjectCoercible(this));
  2949. notARegexp(searchString);
  2950. var endPosition = arguments.length > 1 ? arguments[1] : undefined;
  2951. var len = toLength(that.length);
  2952. var end = endPosition === undefined ? len : min(toLength(endPosition), len);
  2953. var search = String(searchString);
  2954. return $endsWith
  2955. ? $endsWith.call(that, search, end)
  2956. : that.slice(end - search.length, end) === search;
  2957. }
  2958. });
  2959. var Utils = {
  2960. getSearchInput: function getSearchInput(that) {
  2961. if (typeof that.options.searchSelector === 'string') {
  2962. return $__default['default'](that.options.searchSelector);
  2963. }
  2964. return that.$toolbar.find('.search input');
  2965. },
  2966. // it only does '%s', and return '' when arguments are undefined
  2967. sprintf: function sprintf(_str) {
  2968. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  2969. args[_key - 1] = arguments[_key];
  2970. }
  2971. var flag = true;
  2972. var i = 0;
  2973. var str = _str.replace(/%s/g, function () {
  2974. var arg = args[i++];
  2975. if (typeof arg === 'undefined') {
  2976. flag = false;
  2977. return '';
  2978. }
  2979. return arg;
  2980. });
  2981. return flag ? str : '';
  2982. },
  2983. isObject: function isObject(val) {
  2984. return val instanceof Object && !Array.isArray(val);
  2985. },
  2986. isEmptyObject: function isEmptyObject() {
  2987. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2988. return Object.entries(obj).length === 0 && obj.constructor === Object;
  2989. },
  2990. isNumeric: function isNumeric(n) {
  2991. return !isNaN(parseFloat(n)) && isFinite(n);
  2992. },
  2993. getFieldTitle: function getFieldTitle(list, value) {
  2994. var _iterator = _createForOfIteratorHelper(list),
  2995. _step;
  2996. try {
  2997. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2998. var item = _step.value;
  2999. if (item.field === value) {
  3000. return item.title;
  3001. }
  3002. }
  3003. } catch (err) {
  3004. _iterator.e(err);
  3005. } finally {
  3006. _iterator.f();
  3007. }
  3008. return '';
  3009. },
  3010. setFieldIndex: function setFieldIndex(columns) {
  3011. var totalCol = 0;
  3012. var flag = [];
  3013. var _iterator2 = _createForOfIteratorHelper(columns[0]),
  3014. _step2;
  3015. try {
  3016. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  3017. var column = _step2.value;
  3018. totalCol += column.colspan || 1;
  3019. }
  3020. } catch (err) {
  3021. _iterator2.e(err);
  3022. } finally {
  3023. _iterator2.f();
  3024. }
  3025. for (var i = 0; i < columns.length; i++) {
  3026. flag[i] = [];
  3027. for (var j = 0; j < totalCol; j++) {
  3028. flag[i][j] = false;
  3029. }
  3030. }
  3031. for (var _i = 0; _i < columns.length; _i++) {
  3032. var _iterator3 = _createForOfIteratorHelper(columns[_i]),
  3033. _step3;
  3034. try {
  3035. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  3036. var r = _step3.value;
  3037. var rowspan = r.rowspan || 1;
  3038. var colspan = r.colspan || 1;
  3039. var index = flag[_i].indexOf(false);
  3040. r.colspanIndex = index;
  3041. if (colspan === 1) {
  3042. r.fieldIndex = index; // when field is undefined, use index instead
  3043. if (typeof r.field === 'undefined') {
  3044. r.field = index;
  3045. }
  3046. } else {
  3047. r.colspanGroup = r.colspan;
  3048. }
  3049. for (var _j = 0; _j < rowspan; _j++) {
  3050. for (var k = 0; k < colspan; k++) {
  3051. flag[_i + _j][index + k] = true;
  3052. }
  3053. }
  3054. }
  3055. } catch (err) {
  3056. _iterator3.e(err);
  3057. } finally {
  3058. _iterator3.f();
  3059. }
  3060. }
  3061. },
  3062. normalizeAccent: function normalizeAccent(value) {
  3063. if (typeof value !== 'string') {
  3064. return value;
  3065. }
  3066. return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
  3067. },
  3068. updateFieldGroup: function updateFieldGroup(columns) {
  3069. var _ref;
  3070. var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns));
  3071. var _iterator4 = _createForOfIteratorHelper(columns),
  3072. _step4;
  3073. try {
  3074. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  3075. var c = _step4.value;
  3076. var _iterator5 = _createForOfIteratorHelper(c),
  3077. _step5;
  3078. try {
  3079. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  3080. var r = _step5.value;
  3081. if (r.colspanGroup > 1) {
  3082. var colspan = 0;
  3083. var _loop = function _loop(i) {
  3084. var column = allColumns.find(function (col) {
  3085. return col.fieldIndex === i;
  3086. });
  3087. if (column.visible) {
  3088. colspan++;
  3089. }
  3090. };
  3091. for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
  3092. _loop(i);
  3093. }
  3094. r.colspan = colspan;
  3095. r.visible = colspan > 0;
  3096. }
  3097. }
  3098. } catch (err) {
  3099. _iterator5.e(err);
  3100. } finally {
  3101. _iterator5.f();
  3102. }
  3103. }
  3104. } catch (err) {
  3105. _iterator4.e(err);
  3106. } finally {
  3107. _iterator4.f();
  3108. }
  3109. },
  3110. getScrollBarWidth: function getScrollBarWidth() {
  3111. if (this.cachedWidth === undefined) {
  3112. var $inner = $__default['default']('<div/>').addClass('fixed-table-scroll-inner');
  3113. var $outer = $__default['default']('<div/>').addClass('fixed-table-scroll-outer');
  3114. $outer.append($inner);
  3115. $__default['default']('body').append($outer);
  3116. var w1 = $inner[0].offsetWidth;
  3117. $outer.css('overflow', 'scroll');
  3118. var w2 = $inner[0].offsetWidth;
  3119. if (w1 === w2) {
  3120. w2 = $outer[0].clientWidth;
  3121. }
  3122. $outer.remove();
  3123. this.cachedWidth = w1 - w2;
  3124. }
  3125. return this.cachedWidth;
  3126. },
  3127. calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
  3128. var func = name;
  3129. if (typeof name === 'string') {
  3130. // support obj.func1.func2
  3131. var names = name.split('.');
  3132. if (names.length > 1) {
  3133. func = window;
  3134. var _iterator6 = _createForOfIteratorHelper(names),
  3135. _step6;
  3136. try {
  3137. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  3138. var f = _step6.value;
  3139. func = func[f];
  3140. }
  3141. } catch (err) {
  3142. _iterator6.e(err);
  3143. } finally {
  3144. _iterator6.f();
  3145. }
  3146. } else {
  3147. func = window[name];
  3148. }
  3149. }
  3150. if (func !== null && _typeof(func) === 'object') {
  3151. return func;
  3152. }
  3153. if (typeof func === 'function') {
  3154. return func.apply(self, args || []);
  3155. }
  3156. if (!func && typeof name === 'string' && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
  3157. return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
  3158. }
  3159. return defaultValue;
  3160. },
  3161. compareObjects: function compareObjects(objectA, objectB, compareLength) {
  3162. var aKeys = Object.keys(objectA);
  3163. var bKeys = Object.keys(objectB);
  3164. if (compareLength && aKeys.length !== bKeys.length) {
  3165. return false;
  3166. }
  3167. for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
  3168. var key = _aKeys[_i2];
  3169. if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
  3170. return false;
  3171. }
  3172. }
  3173. return true;
  3174. },
  3175. regexCompare: function regexCompare(value, search) {
  3176. try {
  3177. var regexpParts = search.match(/^\/(.*?)\/([gim]*)$/);
  3178. if (value.toString().search(regexpParts ? new RegExp(regexpParts[1], regexpParts[2]) : new RegExp(search, 'gim')) !== -1) {
  3179. return true;
  3180. }
  3181. } catch (e) {
  3182. return false;
  3183. }
  3184. },
  3185. escapeHTML: function escapeHTML(text) {
  3186. if (typeof text === 'string') {
  3187. return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/`/g, '&#x60;');
  3188. }
  3189. return text;
  3190. },
  3191. unescapeHTML: function unescapeHTML(text) {
  3192. if (typeof text === 'string') {
  3193. return text.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#039;/g, '\'').replace(/&#x60;/g, '`');
  3194. }
  3195. return text;
  3196. },
  3197. getRealDataAttr: function getRealDataAttr(dataAttr) {
  3198. for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
  3199. var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
  3200. attr = _Object$entries$_i[0],
  3201. value = _Object$entries$_i[1];
  3202. var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
  3203. if (auxAttr !== attr) {
  3204. dataAttr[auxAttr] = value;
  3205. delete dataAttr[attr];
  3206. }
  3207. }
  3208. return dataAttr;
  3209. },
  3210. getItemField: function getItemField(item, field, escape) {
  3211. var value = item;
  3212. if (typeof field !== 'string' || item.hasOwnProperty(field)) {
  3213. return escape ? this.escapeHTML(item[field]) : item[field];
  3214. }
  3215. var props = field.split('.');
  3216. var _iterator7 = _createForOfIteratorHelper(props),
  3217. _step7;
  3218. try {
  3219. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  3220. var p = _step7.value;
  3221. value = value && value[p];
  3222. }
  3223. } catch (err) {
  3224. _iterator7.e(err);
  3225. } finally {
  3226. _iterator7.f();
  3227. }
  3228. return escape ? this.escapeHTML(value) : value;
  3229. },
  3230. isIEBrowser: function isIEBrowser() {
  3231. return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
  3232. },
  3233. findIndex: function findIndex(items, item) {
  3234. var _iterator8 = _createForOfIteratorHelper(items),
  3235. _step8;
  3236. try {
  3237. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  3238. var it = _step8.value;
  3239. if (JSON.stringify(it) === JSON.stringify(item)) {
  3240. return items.indexOf(it);
  3241. }
  3242. }
  3243. } catch (err) {
  3244. _iterator8.e(err);
  3245. } finally {
  3246. _iterator8.f();
  3247. }
  3248. return -1;
  3249. },
  3250. trToData: function trToData(columns, $els) {
  3251. var _this = this;
  3252. var data = [];
  3253. var m = [];
  3254. $els.each(function (y, el) {
  3255. var $el = $__default['default'](el);
  3256. var row = {}; // save tr's id, class and data-* attributes
  3257. row._id = $el.attr('id');
  3258. row._class = $el.attr('class');
  3259. row._data = _this.getRealDataAttr($el.data());
  3260. row._style = $el.attr('style');
  3261. $el.find('>td,>th').each(function (_x, el) {
  3262. var $el = $__default['default'](el);
  3263. var cspan = +$el.attr('colspan') || 1;
  3264. var rspan = +$el.attr('rowspan') || 1;
  3265. var x = _x; // skip already occupied cells in current row
  3266. for (; m[y] && m[y][x]; x++) {// ignore
  3267. } // mark matrix elements occupied by current cell with true
  3268. for (var tx = x; tx < x + cspan; tx++) {
  3269. for (var ty = y; ty < y + rspan; ty++) {
  3270. if (!m[ty]) {
  3271. // fill missing rows
  3272. m[ty] = [];
  3273. }
  3274. m[ty][tx] = true;
  3275. }
  3276. }
  3277. var field = columns[x].field;
  3278. row[field] = $el.html().trim(); // save td's id, class and data-* attributes
  3279. row["_".concat(field, "_id")] = $el.attr('id');
  3280. row["_".concat(field, "_class")] = $el.attr('class');
  3281. row["_".concat(field, "_rowspan")] = $el.attr('rowspan');
  3282. row["_".concat(field, "_colspan")] = $el.attr('colspan');
  3283. row["_".concat(field, "_title")] = $el.attr('title');
  3284. row["_".concat(field, "_data")] = _this.getRealDataAttr($el.data());
  3285. row["_".concat(field, "_style")] = $el.attr('style');
  3286. });
  3287. data.push(row);
  3288. });
  3289. return data;
  3290. },
  3291. sort: function sort(a, b, order, sortStable, aPosition, bPosition) {
  3292. if (a === undefined || a === null) {
  3293. a = '';
  3294. }
  3295. if (b === undefined || b === null) {
  3296. b = '';
  3297. }
  3298. if (sortStable && a === b) {
  3299. a = aPosition;
  3300. b = bPosition;
  3301. } // If both values are numeric, do a numeric comparison
  3302. if (this.isNumeric(a) && this.isNumeric(b)) {
  3303. // Convert numerical values form string to float.
  3304. a = parseFloat(a);
  3305. b = parseFloat(b);
  3306. if (a < b) {
  3307. return order * -1;
  3308. }
  3309. if (a > b) {
  3310. return order;
  3311. }
  3312. return 0;
  3313. }
  3314. if (a === b) {
  3315. return 0;
  3316. } // If value is not a string, convert to string
  3317. if (typeof a !== 'string') {
  3318. a = a.toString();
  3319. }
  3320. if (a.localeCompare(b) === -1) {
  3321. return order * -1;
  3322. }
  3323. return order;
  3324. },
  3325. getEventName: function getEventName(eventPrefix) {
  3326. var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  3327. id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000));
  3328. return "".concat(eventPrefix, "-").concat(id);
  3329. },
  3330. hasDetailViewIcon: function hasDetailViewIcon(options) {
  3331. return options.detailView && options.detailViewIcon && !options.cardView;
  3332. },
  3333. getDetailViewIndexOffset: function getDetailViewIndexOffset(options) {
  3334. return this.hasDetailViewIcon(options) && options.detailViewAlign !== 'right' ? 1 : 0;
  3335. },
  3336. checkAutoMergeCells: function checkAutoMergeCells(data) {
  3337. var _iterator9 = _createForOfIteratorHelper(data),
  3338. _step9;
  3339. try {
  3340. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  3341. var row = _step9.value;
  3342. for (var _i4 = 0, _Object$keys = Object.keys(row); _i4 < _Object$keys.length; _i4++) {
  3343. var key = _Object$keys[_i4];
  3344. if (key.startsWith('_') && (key.endsWith('_rowspan') || key.endsWith('_colspan'))) {
  3345. return true;
  3346. }
  3347. }
  3348. }
  3349. } catch (err) {
  3350. _iterator9.e(err);
  3351. } finally {
  3352. _iterator9.f();
  3353. }
  3354. return false;
  3355. },
  3356. deepCopy: function deepCopy(arg) {
  3357. if (arg === undefined) {
  3358. return arg;
  3359. }
  3360. return $__default['default'].extend(true, Array.isArray(arg) ? [] : {}, arg);
  3361. }
  3362. };
  3363. var BLOCK_ROWS = 50;
  3364. var CLUSTER_BLOCKS = 4;
  3365. var VirtualScroll = /*#__PURE__*/function () {
  3366. function VirtualScroll(options) {
  3367. var _this = this;
  3368. _classCallCheck(this, VirtualScroll);
  3369. this.rows = options.rows;
  3370. this.scrollEl = options.scrollEl;
  3371. this.contentEl = options.contentEl;
  3372. this.callback = options.callback;
  3373. this.itemHeight = options.itemHeight;
  3374. this.cache = {};
  3375. this.scrollTop = this.scrollEl.scrollTop;
  3376. this.initDOM(this.rows, options.fixedScroll);
  3377. this.scrollEl.scrollTop = this.scrollTop;
  3378. this.lastCluster = 0;
  3379. var onScroll = function onScroll() {
  3380. if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
  3381. _this.initDOM(_this.rows);
  3382. _this.callback(_this.startIndex, _this.endIndex);
  3383. }
  3384. };
  3385. this.scrollEl.addEventListener('scroll', onScroll, false);
  3386. this.destroy = function () {
  3387. _this.contentEl.innerHtml = '';
  3388. _this.scrollEl.removeEventListener('scroll', onScroll, false);
  3389. };
  3390. }
  3391. _createClass(VirtualScroll, [{
  3392. key: "initDOM",
  3393. value: function initDOM(rows, fixedScroll) {
  3394. if (typeof this.clusterHeight === 'undefined') {
  3395. this.cache.scrollTop = this.scrollEl.scrollTop;
  3396. this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
  3397. this.getRowsHeight(rows);
  3398. }
  3399. var data = this.initData(rows, this.getNum(fixedScroll));
  3400. var thisRows = data.rows.join('');
  3401. var dataChanged = this.checkChanges('data', thisRows);
  3402. var topOffsetChanged = this.checkChanges('top', data.topOffset);
  3403. var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
  3404. var html = [];
  3405. if (dataChanged && topOffsetChanged) {
  3406. if (data.topOffset) {
  3407. html.push(this.getExtra('top', data.topOffset));
  3408. }
  3409. html.push(thisRows);
  3410. if (data.bottomOffset) {
  3411. html.push(this.getExtra('bottom', data.bottomOffset));
  3412. }
  3413. this.startIndex = data.start;
  3414. this.endIndex = data.end;
  3415. this.contentEl.innerHTML = html.join('');
  3416. if (fixedScroll) {
  3417. this.contentEl.scrollTop = this.cache.scrollTop;
  3418. }
  3419. } else if (bottomOffsetChanged) {
  3420. this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
  3421. }
  3422. }
  3423. }, {
  3424. key: "getRowsHeight",
  3425. value: function getRowsHeight() {
  3426. if (typeof this.itemHeight === 'undefined') {
  3427. var nodes = this.contentEl.children;
  3428. var node = nodes[Math.floor(nodes.length / 2)];
  3429. this.itemHeight = node.offsetHeight;
  3430. }
  3431. this.blockHeight = this.itemHeight * BLOCK_ROWS;
  3432. this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
  3433. this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
  3434. }
  3435. }, {
  3436. key: "getNum",
  3437. value: function getNum(fixedScroll) {
  3438. this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
  3439. return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
  3440. }
  3441. }, {
  3442. key: "initData",
  3443. value: function initData(rows, num) {
  3444. if (rows.length < BLOCK_ROWS) {
  3445. return {
  3446. topOffset: 0,
  3447. bottomOffset: 0,
  3448. rowsAbove: 0,
  3449. rows: rows
  3450. };
  3451. }
  3452. var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
  3453. var end = start + this.clusterRows;
  3454. var topOffset = Math.max(start * this.itemHeight, 0);
  3455. var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
  3456. var thisRows = [];
  3457. var rowsAbove = start;
  3458. if (topOffset < 1) {
  3459. rowsAbove++;
  3460. }
  3461. for (var i = start; i < end; i++) {
  3462. rows[i] && thisRows.push(rows[i]);
  3463. }
  3464. return {
  3465. start: start,
  3466. end: end,
  3467. topOffset: topOffset,
  3468. bottomOffset: bottomOffset,
  3469. rowsAbove: rowsAbove,
  3470. rows: thisRows
  3471. };
  3472. }
  3473. }, {
  3474. key: "checkChanges",
  3475. value: function checkChanges(type, value) {
  3476. var changed = value !== this.cache[type];
  3477. this.cache[type] = value;
  3478. return changed;
  3479. }
  3480. }, {
  3481. key: "getExtra",
  3482. value: function getExtra(className, height) {
  3483. var tag = document.createElement('tr');
  3484. tag.className = "virtual-scroll-".concat(className);
  3485. if (height) {
  3486. tag.style.height = "".concat(height, "px");
  3487. }
  3488. return tag.outerHTML;
  3489. }
  3490. }]);
  3491. return VirtualScroll;
  3492. }();
  3493. var BootstrapTable = /*#__PURE__*/function () {
  3494. function BootstrapTable(el, options) {
  3495. _classCallCheck(this, BootstrapTable);
  3496. this.options = options;
  3497. this.$el = $__default['default'](el);
  3498. this.$el_ = this.$el.clone();
  3499. this.timeoutId_ = 0;
  3500. this.timeoutFooter_ = 0;
  3501. }
  3502. _createClass(BootstrapTable, [{
  3503. key: "init",
  3504. value: function init() {
  3505. this.initConstants();
  3506. this.initLocale();
  3507. this.initContainer();
  3508. this.initTable();
  3509. this.initHeader();
  3510. this.initData();
  3511. this.initHiddenRows();
  3512. this.initToolbar();
  3513. this.initPagination();
  3514. this.initBody();
  3515. this.initSearchText();
  3516. this.initServer();
  3517. }
  3518. }, {
  3519. key: "initConstants",
  3520. value: function initConstants() {
  3521. var opts = this.options;
  3522. this.constants = Constants.CONSTANTS;
  3523. this.constants.theme = $__default['default'].fn.bootstrapTable.theme;
  3524. this.constants.dataToggle = this.constants.html.dataToggle || 'data-toggle';
  3525. var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : '';
  3526. this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim();
  3527. this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {});
  3528. if (_typeof(this.buttons) !== 'object') {
  3529. this.buttons = {};
  3530. }
  3531. if (typeof opts.icons === 'string') {
  3532. opts.icons = Utils.calculateObjectValue(null, opts.icons);
  3533. }
  3534. }
  3535. }, {
  3536. key: "initLocale",
  3537. value: function initLocale() {
  3538. if (this.options.locale) {
  3539. var locales = $__default['default'].fn.bootstrapTable.locales;
  3540. var parts = this.options.locale.split(/-|_/);
  3541. parts[0] = parts[0].toLowerCase();
  3542. if (parts[1]) {
  3543. parts[1] = parts[1].toUpperCase();
  3544. }
  3545. var localesToExtend = {};
  3546. if (locales[this.options.locale]) {
  3547. localesToExtend = locales[this.options.locale];
  3548. } else if (locales[parts.join('-')]) {
  3549. localesToExtend = locales[parts.join('-')];
  3550. } else if (locales[parts[0]]) {
  3551. localesToExtend = locales[parts[0]];
  3552. }
  3553. for (var _i = 0, _Object$entries = Object.entries(localesToExtend); _i < _Object$entries.length; _i++) {
  3554. var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
  3555. formatName = _Object$entries$_i[0],
  3556. func = _Object$entries$_i[1];
  3557. if (this.options[formatName] !== BootstrapTable.DEFAULTS[formatName]) {
  3558. continue;
  3559. }
  3560. this.options[formatName] = func;
  3561. }
  3562. }
  3563. }
  3564. }, {
  3565. key: "initContainer",
  3566. value: function initContainer() {
  3567. var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
  3568. var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
  3569. var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]);
  3570. this.$container = $__default['default']("\n <div class=\"bootstrap-table ".concat(this.constants.theme, "\">\n <div class=\"fixed-table-toolbar\"></div>\n ").concat(topPagination, "\n <div class=\"fixed-table-container\">\n <div class=\"fixed-table-header\"><table></table></div>\n <div class=\"fixed-table-body\">\n <div class=\"fixed-table-loading\">\n ").concat(loadingTemplate, "\n </div>\n </div>\n <div class=\"fixed-table-footer\"></div>\n </div>\n ").concat(bottomPagination, "\n </div>\n "));
  3571. this.$container.insertAfter(this.$el);
  3572. this.$tableContainer = this.$container.find('.fixed-table-container');
  3573. this.$tableHeader = this.$container.find('.fixed-table-header');
  3574. this.$tableBody = this.$container.find('.fixed-table-body');
  3575. this.$tableLoading = this.$container.find('.fixed-table-loading');
  3576. this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
  3577. if (this.options.buttonsToolbar) {
  3578. this.$toolbar = $__default['default']('body').find(this.options.buttonsToolbar);
  3579. } else {
  3580. this.$toolbar = this.$container.find('.fixed-table-toolbar');
  3581. }
  3582. this.$pagination = this.$container.find('.fixed-table-pagination');
  3583. this.$tableBody.append(this.$el);
  3584. this.$container.after('<div class="clearfix"></div>');
  3585. this.$el.addClass(this.options.classes);
  3586. this.$tableLoading.addClass(this.options.classes);
  3587. if (this.options.height) {
  3588. this.$tableContainer.addClass('fixed-height');
  3589. if (this.options.showFooter) {
  3590. this.$tableContainer.addClass('has-footer');
  3591. }
  3592. if (this.options.classes.split(' ').includes('table-bordered')) {
  3593. this.$tableBody.append('<div class="fixed-table-border"></div>');
  3594. this.$tableBorder = this.$tableBody.find('.fixed-table-border');
  3595. this.$tableLoading.addClass('fixed-table-border');
  3596. }
  3597. this.$tableFooter = this.$container.find('.fixed-table-footer');
  3598. }
  3599. }
  3600. }, {
  3601. key: "initTable",
  3602. value: function initTable() {
  3603. var _this = this;
  3604. var columns = [];
  3605. this.$header = this.$el.find('>thead');
  3606. if (!this.$header.length) {
  3607. this.$header = $__default['default']("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
  3608. } else if (this.options.theadClasses) {
  3609. this.$header.addClass(this.options.theadClasses);
  3610. }
  3611. this._headerTrClasses = [];
  3612. this._headerTrStyles = [];
  3613. this.$header.find('tr').each(function (i, el) {
  3614. var $tr = $__default['default'](el);
  3615. var column = [];
  3616. $tr.find('th').each(function (i, el) {
  3617. var $th = $__default['default'](el); // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
  3618. if (typeof $th.data('field') !== 'undefined') {
  3619. $th.data('field', "".concat($th.data('field')));
  3620. }
  3621. column.push($__default['default'].extend({}, {
  3622. title: $th.html(),
  3623. class: $th.attr('class'),
  3624. titleTooltip: $th.attr('title'),
  3625. rowspan: $th.attr('rowspan') ? +$th.attr('rowspan') : undefined,
  3626. colspan: $th.attr('colspan') ? +$th.attr('colspan') : undefined
  3627. }, $th.data()));
  3628. });
  3629. columns.push(column);
  3630. if ($tr.attr('class')) {
  3631. _this._headerTrClasses.push($tr.attr('class'));
  3632. }
  3633. if ($tr.attr('style')) {
  3634. _this._headerTrStyles.push($tr.attr('style'));
  3635. }
  3636. });
  3637. if (!Array.isArray(this.options.columns[0])) {
  3638. this.options.columns = [this.options.columns];
  3639. }
  3640. this.options.columns = $__default['default'].extend(true, [], columns, this.options.columns);
  3641. this.columns = [];
  3642. this.fieldsColumnsIndex = [];
  3643. Utils.setFieldIndex(this.options.columns);
  3644. this.options.columns.forEach(function (columns, i) {
  3645. columns.forEach(function (_column, j) {
  3646. var column = $__default['default'].extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
  3647. if (typeof column.fieldIndex !== 'undefined') {
  3648. _this.columns[column.fieldIndex] = column;
  3649. _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
  3650. }
  3651. _this.options.columns[i][j] = column;
  3652. });
  3653. }); // if options.data is setting, do not process tbody and tfoot data
  3654. if (!this.options.data.length) {
  3655. var htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
  3656. if (htmlData.length) {
  3657. this.options.data = htmlData;
  3658. this.fromHtml = true;
  3659. }
  3660. }
  3661. if (!(this.options.pagination && this.options.sidePagination !== 'server')) {
  3662. this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
  3663. }
  3664. if (this.footerData) {
  3665. this.$el.find('tfoot').html('<tr></tr>');
  3666. }
  3667. if (!this.options.showFooter || this.options.cardView) {
  3668. this.$tableFooter.hide();
  3669. } else {
  3670. this.$tableFooter.show();
  3671. }
  3672. }
  3673. }, {
  3674. key: "initHeader",
  3675. value: function initHeader() {
  3676. var _this2 = this;
  3677. var visibleColumns = {};
  3678. var headerHtml = [];
  3679. this.header = {
  3680. fields: [],
  3681. styles: [],
  3682. classes: [],
  3683. formatters: [],
  3684. detailFormatters: [],
  3685. events: [],
  3686. sorters: [],
  3687. sortNames: [],
  3688. cellStyles: [],
  3689. searchables: []
  3690. };
  3691. Utils.updateFieldGroup(this.options.columns);
  3692. this.options.columns.forEach(function (columns, i) {
  3693. var html = [];
  3694. html.push("<tr".concat(Utils.sprintf(' class="%s"', _this2._headerTrClasses[i]), " ").concat(Utils.sprintf(' style="%s"', _this2._headerTrStyles[i]), ">"));
  3695. var detailViewTemplate = '';
  3696. if (i === 0 && Utils.hasDetailViewIcon(_this2.options)) {
  3697. var rowspan = _this2.options.columns.length > 1 ? " rowspan=\"".concat(_this2.options.columns.length, "\"") : '';
  3698. detailViewTemplate = "<th class=\"detail\"".concat(rowspan, ">\n <div class=\"fht-cell\"></div>\n </th>");
  3699. }
  3700. if (detailViewTemplate && _this2.options.detailViewAlign !== 'right') {
  3701. html.push(detailViewTemplate);
  3702. }
  3703. columns.forEach(function (column, j) {
  3704. var class_ = Utils.sprintf(' class="%s"', column['class']);
  3705. var unitWidth = column.widthUnit;
  3706. var width = parseFloat(column.width);
  3707. var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
  3708. var align = Utils.sprintf('text-align: %s; ', column.align);
  3709. var style = Utils.sprintf('vertical-align: %s; ', column.valign);
  3710. style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
  3711. if (typeof column.fieldIndex === 'undefined' && !column.visible) {
  3712. return;
  3713. }
  3714. var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]);
  3715. var csses = [];
  3716. var classes = '';
  3717. if (headerStyle && headerStyle.css) {
  3718. for (var _i2 = 0, _Object$entries2 = Object.entries(headerStyle.css); _i2 < _Object$entries2.length; _i2++) {
  3719. var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
  3720. key = _Object$entries2$_i[0],
  3721. value = _Object$entries2$_i[1];
  3722. csses.push("".concat(key, ": ").concat(value));
  3723. }
  3724. }
  3725. if (headerStyle && headerStyle.classes) {
  3726. classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes);
  3727. }
  3728. if (typeof column.fieldIndex !== 'undefined') {
  3729. _this2.header.fields[column.fieldIndex] = column.field;
  3730. _this2.header.styles[column.fieldIndex] = align + style;
  3731. _this2.header.classes[column.fieldIndex] = class_;
  3732. _this2.header.formatters[column.fieldIndex] = column.formatter;
  3733. _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
  3734. _this2.header.events[column.fieldIndex] = column.events;
  3735. _this2.header.sorters[column.fieldIndex] = column.sorter;
  3736. _this2.header.sortNames[column.fieldIndex] = column.sortName;
  3737. _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
  3738. _this2.header.searchables[column.fieldIndex] = column.searchable;
  3739. if (!column.visible) {
  3740. return;
  3741. }
  3742. if (_this2.options.cardView && !column.cardVisible) {
  3743. return;
  3744. }
  3745. visibleColumns[column.field] = column;
  3746. }
  3747. html.push("<th".concat(Utils.sprintf(' title="%s"', column.titleTooltip)), column.checkbox || column.radio ? Utils.sprintf(' class="bs-checkbox %s"', column['class'] || '') : classes || class_, Utils.sprintf(' style="%s"', halign + style + csses.join('; ')), Utils.sprintf(' rowspan="%s"', column.rowspan), Utils.sprintf(' colspan="%s"', column.colspan), Utils.sprintf(' data-field="%s"', column.field), // If `column` is not the first element of `this.options.columns[0]`, then className 'data-not-first-th' should be added.
  3748. j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
  3749. html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
  3750. var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
  3751. var title = text;
  3752. if (column.checkbox) {
  3753. text = '';
  3754. if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
  3755. text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
  3756. }
  3757. _this2.header.stateField = column.field;
  3758. }
  3759. if (column.radio) {
  3760. text = '';
  3761. _this2.header.stateField = column.field;
  3762. }
  3763. if (!text && column.showSelectTitle) {
  3764. text += title;
  3765. }
  3766. html.push(text);
  3767. html.push('</div>');
  3768. html.push('<div class="fht-cell"></div>');
  3769. html.push('</div>');
  3770. html.push('</th>');
  3771. });
  3772. if (detailViewTemplate && _this2.options.detailViewAlign === 'right') {
  3773. html.push(detailViewTemplate);
  3774. }
  3775. html.push('</tr>');
  3776. if (html.length > 3) {
  3777. headerHtml.push(html.join(''));
  3778. }
  3779. });
  3780. this.$header.html(headerHtml.join(''));
  3781. this.$header.find('th[data-field]').each(function (i, el) {
  3782. $__default['default'](el).data(visibleColumns[$__default['default'](el).data('field')]);
  3783. });
  3784. this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
  3785. var $this = $__default['default'](e.currentTarget);
  3786. if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
  3787. if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
  3788. return false;
  3789. }
  3790. }
  3791. if (_this2.options.sortable && $this.parent().data().sortable) {
  3792. _this2.onSort(e);
  3793. }
  3794. });
  3795. var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id'));
  3796. $__default['default'](window).off(resizeEvent);
  3797. if (!this.options.showHeader || this.options.cardView) {
  3798. this.$header.hide();
  3799. this.$tableHeader.hide();
  3800. this.$tableLoading.css('top', 0);
  3801. } else {
  3802. this.$header.show();
  3803. this.$tableHeader.show();
  3804. this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
  3805. this.getCaret();
  3806. $__default['default'](window).on(resizeEvent, function () {
  3807. return _this2.resetView();
  3808. });
  3809. }
  3810. this.$selectAll = this.$header.find('[name="btSelectAll"]');
  3811. this.$selectAll.off('click').on('click', function (e) {
  3812. e.stopPropagation();
  3813. var checked = $__default['default'](e.currentTarget).prop('checked');
  3814. _this2[checked ? 'checkAll' : 'uncheckAll']();
  3815. _this2.updateSelected();
  3816. });
  3817. }
  3818. }, {
  3819. key: "initData",
  3820. value: function initData(data, type) {
  3821. if (type === 'append') {
  3822. this.options.data = this.options.data.concat(data);
  3823. } else if (type === 'prepend') {
  3824. this.options.data = [].concat(data).concat(this.options.data);
  3825. } else {
  3826. data = data || Utils.deepCopy(this.options.data);
  3827. this.options.data = Array.isArray(data) ? data : data[this.options.dataField];
  3828. }
  3829. this.data = _toConsumableArray(this.options.data);
  3830. if (this.options.sortReset) {
  3831. this.unsortedData = _toConsumableArray(this.data);
  3832. }
  3833. if (this.options.sidePagination === 'server') {
  3834. return;
  3835. }
  3836. this.initSort();
  3837. }
  3838. }, {
  3839. key: "initSort",
  3840. value: function initSort() {
  3841. var _this3 = this;
  3842. var name = this.options.sortName;
  3843. var order = this.options.sortOrder === 'desc' ? -1 : 1;
  3844. var index = this.header.fields.indexOf(this.options.sortName);
  3845. var timeoutId = 0;
  3846. if (index !== -1) {
  3847. if (this.options.sortStable) {
  3848. this.data.forEach(function (row, i) {
  3849. if (!row.hasOwnProperty('_position')) {
  3850. row._position = i;
  3851. }
  3852. });
  3853. }
  3854. if (this.options.customSort) {
  3855. Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
  3856. } else {
  3857. this.data.sort(function (a, b) {
  3858. if (_this3.header.sortNames[index]) {
  3859. name = _this3.header.sortNames[index];
  3860. }
  3861. var aa = Utils.getItemField(a, name, _this3.options.escape);
  3862. var bb = Utils.getItemField(b, name, _this3.options.escape);
  3863. var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
  3864. if (value !== undefined) {
  3865. if (_this3.options.sortStable && value === 0) {
  3866. return order * (a._position - b._position);
  3867. }
  3868. return order * value;
  3869. }
  3870. return Utils.sort(aa, bb, order, _this3.options.sortStable, a._position, b._position);
  3871. });
  3872. }
  3873. if (this.options.sortClass !== undefined) {
  3874. clearTimeout(timeoutId);
  3875. timeoutId = setTimeout(function () {
  3876. _this3.$el.removeClass(_this3.options.sortClass);
  3877. var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
  3878. _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
  3879. }, 250);
  3880. }
  3881. } else if (this.options.sortReset) {
  3882. this.data = _toConsumableArray(this.unsortedData);
  3883. }
  3884. }
  3885. }, {
  3886. key: "onSort",
  3887. value: function onSort(_ref) {
  3888. var type = _ref.type,
  3889. currentTarget = _ref.currentTarget;
  3890. var $this = type === 'keypress' ? $__default['default'](currentTarget) : $__default['default'](currentTarget).parent();
  3891. var $this_ = this.$header.find('th').eq($this.index());
  3892. this.$header.add(this.$header_).find('span.order').remove();
  3893. if (this.options.sortName === $this.data('field')) {
  3894. var currentSortOrder = this.options.sortOrder;
  3895. if (currentSortOrder === undefined) {
  3896. this.options.sortOrder = 'asc';
  3897. } else if (currentSortOrder === 'asc') {
  3898. this.options.sortOrder = 'desc';
  3899. } else if (this.options.sortOrder === 'desc') {
  3900. this.options.sortOrder = this.options.sortReset ? undefined : 'asc';
  3901. }
  3902. if (this.options.sortOrder === undefined) {
  3903. this.options.sortName = undefined;
  3904. }
  3905. } else {
  3906. this.options.sortName = $this.data('field');
  3907. if (this.options.rememberOrder) {
  3908. this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
  3909. } else {
  3910. this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
  3911. }
  3912. }
  3913. this.trigger('sort', this.options.sortName, this.options.sortOrder);
  3914. $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
  3915. this.getCaret();
  3916. if (this.options.sidePagination === 'server' && this.options.serverSort) {
  3917. this.options.pageNumber = 1;
  3918. this.initServer(this.options.silentSort);
  3919. return;
  3920. }
  3921. this.initSort();
  3922. this.initBody();
  3923. }
  3924. }, {
  3925. key: "initToolbar",
  3926. value: function initToolbar() {
  3927. var _this4 = this;
  3928. var opts = this.options;
  3929. var html = [];
  3930. var timeoutId = 0;
  3931. var $keepOpen;
  3932. var switchableCount = 0;
  3933. if (this.$toolbar.find('.bs-bars').children().length) {
  3934. $__default['default']('body').append($__default['default'](opts.toolbar));
  3935. }
  3936. this.$toolbar.html('');
  3937. if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') {
  3938. $__default['default'](Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($__default['default'](opts.toolbar));
  3939. } // showColumns, showToggle, showRefresh
  3940. html = ["<div class=\"".concat(['columns', "columns-".concat(opts.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(opts.buttonsAlign)].join(' '), "\">")];
  3941. if (typeof opts.buttonsOrder === 'string') {
  3942. opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').split(',');
  3943. }
  3944. this.buttons = Object.assign(this.buttons, {
  3945. paginationSwitch: {
  3946. text: opts.pagination ? opts.formatPaginationSwitchUp() : opts.formatPaginationSwitchDown(),
  3947. icon: opts.pagination ? opts.icons.paginationSwitchDown : opts.icons.paginationSwitchUp,
  3948. render: false,
  3949. event: this.togglePagination,
  3950. attributes: {
  3951. 'aria-label': opts.formatPaginationSwitch(),
  3952. title: opts.formatPaginationSwitch()
  3953. }
  3954. },
  3955. refresh: {
  3956. text: opts.formatRefresh(),
  3957. icon: opts.icons.refresh,
  3958. render: false,
  3959. event: this.refresh,
  3960. attributes: {
  3961. 'aria-label': opts.formatRefresh(),
  3962. title: opts.formatRefresh()
  3963. }
  3964. },
  3965. toggle: {
  3966. text: opts.formatToggle(),
  3967. icon: opts.icons.toggleOff,
  3968. render: false,
  3969. event: this.toggleView,
  3970. attributes: {
  3971. 'aria-label': opts.formatToggleOn(),
  3972. title: opts.formatToggleOn()
  3973. }
  3974. },
  3975. fullscreen: {
  3976. text: opts.formatFullscreen(),
  3977. icon: opts.icons.fullscreen,
  3978. render: false,
  3979. event: this.toggleFullscreen,
  3980. attributes: {
  3981. 'aria-label': opts.formatFullscreen(),
  3982. title: opts.formatFullscreen()
  3983. }
  3984. },
  3985. columns: {
  3986. render: false,
  3987. html: function html() {
  3988. var html = [];
  3989. html.push("<div class=\"keep-open ".concat(_this4.constants.classes.buttonsDropdown, "\" title=\"").concat(opts.formatColumns(), "\">\n <button class=\"").concat(_this4.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(_this4.constants.dataToggle, "=\"dropdown\"\n aria-label=\"Columns\" title=\"").concat(opts.formatColumns(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(_this4.constants.html.icon, opts.iconsPrefix, opts.icons.columns) : '', "\n ").concat(opts.showButtonText ? opts.formatColumns() : '', "\n ").concat(_this4.constants.html.dropdownCaret, "\n </button>\n ").concat(_this4.constants.html.toolbarDropdown[0]));
  3990. if (opts.showColumnsSearch) {
  3991. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', _this4.constants.classes.input, opts.formatSearch())));
  3992. html.push(_this4.constants.html.toolbarDropdownSeparator);
  3993. }
  3994. if (opts.showColumnsToggleAll) {
  3995. var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) {
  3996. return !_this4.isSelectionColumn(column);
  3997. }).length;
  3998. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', opts.formatColumnsToggleAll())));
  3999. html.push(_this4.constants.html.toolbarDropdownSeparator);
  4000. }
  4001. var visibleColumns = 0;
  4002. _this4.columns.forEach(function (column) {
  4003. if (column.visible) {
  4004. visibleColumns++;
  4005. }
  4006. });
  4007. _this4.columns.forEach(function (column, i) {
  4008. if (_this4.isSelectionColumn(column)) {
  4009. return;
  4010. }
  4011. if (opts.cardView && !column.cardVisible) {
  4012. return;
  4013. }
  4014. var checked = column.visible ? ' checked="checked"' : '';
  4015. var disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : '';
  4016. if (column.switchable) {
  4017. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>', column.field, i, checked, disabled, column.title)));
  4018. switchableCount++;
  4019. }
  4020. });
  4021. html.push(_this4.constants.html.toolbarDropdown[1], '</div>');
  4022. return html.join('');
  4023. }
  4024. }
  4025. });
  4026. var buttonsHtml = {};
  4027. for (var _i3 = 0, _Object$entries3 = Object.entries(this.buttons); _i3 < _Object$entries3.length; _i3++) {
  4028. var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
  4029. buttonName = _Object$entries3$_i[0],
  4030. buttonConfig = _Object$entries3$_i[1];
  4031. var buttonHtml = void 0;
  4032. if (buttonConfig.hasOwnProperty('html')) {
  4033. if (typeof buttonConfig.html === 'function') {
  4034. buttonHtml = buttonConfig.html();
  4035. } else if (typeof buttonConfig.html === 'string') {
  4036. buttonHtml = buttonConfig.html;
  4037. }
  4038. } else {
  4039. buttonHtml = "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"").concat(buttonName, "\"");
  4040. if (buttonConfig.hasOwnProperty('attributes')) {
  4041. for (var _i4 = 0, _Object$entries4 = Object.entries(buttonConfig.attributes); _i4 < _Object$entries4.length; _i4++) {
  4042. var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
  4043. attributeName = _Object$entries4$_i[0],
  4044. value = _Object$entries4$_i[1];
  4045. buttonHtml += " ".concat(attributeName, "=\"").concat(value, "\"");
  4046. }
  4047. }
  4048. buttonHtml += '>';
  4049. if (opts.showButtonIcons && buttonConfig.hasOwnProperty('icon')) {
  4050. buttonHtml += "".concat(Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, buttonConfig.icon), " ");
  4051. }
  4052. if (opts.showButtonText && buttonConfig.hasOwnProperty('text')) {
  4053. buttonHtml += buttonConfig.text;
  4054. }
  4055. buttonHtml += '</button>';
  4056. }
  4057. buttonsHtml[buttonName] = buttonHtml;
  4058. var optionName = "show".concat(buttonName.charAt(0).toUpperCase()).concat(buttonName.substring(1));
  4059. var showOption = opts[optionName];
  4060. if ((!buttonConfig.hasOwnProperty('render') || buttonConfig.hasOwnProperty('render') && buttonConfig.render) && (showOption === undefined || showOption === true)) {
  4061. opts[optionName] = true;
  4062. }
  4063. if (!opts.buttonsOrder.includes(buttonName)) {
  4064. opts.buttonsOrder.push(buttonName);
  4065. }
  4066. } // Adding the button html to the final toolbar html when the showOption is true
  4067. var _iterator = _createForOfIteratorHelper(opts.buttonsOrder),
  4068. _step;
  4069. try {
  4070. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4071. var button = _step.value;
  4072. var _showOption = opts["show".concat(button.charAt(0).toUpperCase()).concat(button.substring(1))];
  4073. if (_showOption) {
  4074. html.push(buttonsHtml[button]);
  4075. }
  4076. }
  4077. } catch (err) {
  4078. _iterator.e(err);
  4079. } finally {
  4080. _iterator.f();
  4081. }
  4082. html.push('</div>'); // Fix #188: this.showToolbar is for extensions
  4083. if (this.showToolbar || html.length > 2) {
  4084. this.$toolbar.append(html.join(''));
  4085. }
  4086. for (var _i5 = 0, _Object$entries5 = Object.entries(this.buttons); _i5 < _Object$entries5.length; _i5++) {
  4087. var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
  4088. _buttonName = _Object$entries5$_i[0],
  4089. _buttonConfig = _Object$entries5$_i[1];
  4090. if (_buttonConfig.hasOwnProperty('event')) {
  4091. if (typeof _buttonConfig.event === 'function' || typeof _buttonConfig.event === 'string') {
  4092. var _ret = function () {
  4093. var event = typeof _buttonConfig.event === 'string' ? window[_buttonConfig.event] : _buttonConfig.event;
  4094. _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off('click').on('click', function () {
  4095. return event.call(_this4);
  4096. });
  4097. return "continue";
  4098. }();
  4099. if (_ret === "continue") continue;
  4100. }
  4101. var _loop = function _loop() {
  4102. var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
  4103. eventType = _Object$entries6$_i[0],
  4104. eventFunction = _Object$entries6$_i[1];
  4105. var event = typeof eventFunction === 'string' ? window[eventFunction] : eventFunction;
  4106. _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off(eventType).on(eventType, function () {
  4107. return event.call(_this4);
  4108. });
  4109. };
  4110. for (var _i6 = 0, _Object$entries6 = Object.entries(_buttonConfig.event); _i6 < _Object$entries6.length; _i6++) {
  4111. _loop();
  4112. }
  4113. }
  4114. }
  4115. if (opts.showColumns) {
  4116. $keepOpen = this.$toolbar.find('.keep-open');
  4117. var $checkboxes = $keepOpen.find('input[type="checkbox"]:not(".toggle-all")');
  4118. var $toggleAll = $keepOpen.find('input[type="checkbox"].toggle-all');
  4119. if (switchableCount <= opts.minimumCountColumns) {
  4120. $keepOpen.find('input').prop('disabled', true);
  4121. }
  4122. $keepOpen.find('li, label').off('click').on('click', function (e) {
  4123. e.stopImmediatePropagation();
  4124. });
  4125. $checkboxes.off('click').on('click', function (_ref2) {
  4126. var currentTarget = _ref2.currentTarget;
  4127. var $this = $__default['default'](currentTarget);
  4128. _this4._toggleColumn($this.val(), $this.prop('checked'), false);
  4129. _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
  4130. $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) {
  4131. return !_this4.isSelectionColumn(column);
  4132. }).length);
  4133. });
  4134. $toggleAll.off('click').on('click', function (_ref3) {
  4135. var currentTarget = _ref3.currentTarget;
  4136. _this4._toggleAllColumns($__default['default'](currentTarget).prop('checked'));
  4137. });
  4138. if (opts.showColumnsSearch) {
  4139. var $columnsSearch = $keepOpen.find('[name="columnsSearch"]');
  4140. var $listItems = $keepOpen.find('.dropdown-item-marker');
  4141. $columnsSearch.on('keyup paste change', function (_ref4) {
  4142. var currentTarget = _ref4.currentTarget;
  4143. var $this = $__default['default'](currentTarget);
  4144. var searchValue = $this.val().toLowerCase();
  4145. $listItems.show();
  4146. $checkboxes.each(function (i, el) {
  4147. var $checkbox = $__default['default'](el);
  4148. var $listItem = $checkbox.parents('.dropdown-item-marker');
  4149. var text = $listItem.text().toLowerCase();
  4150. if (!text.includes(searchValue)) {
  4151. $listItem.hide();
  4152. }
  4153. });
  4154. });
  4155. }
  4156. }
  4157. var handleInputEvent = function handleInputEvent($searchInput) {
  4158. var eventTriggers = 'keyup drop blur mouseup';
  4159. $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
  4160. if (opts.searchOnEnterKey && event.keyCode !== 13) {
  4161. return;
  4162. }
  4163. if ([37, 38, 39, 40].includes(event.keyCode)) {
  4164. return;
  4165. }
  4166. clearTimeout(timeoutId); // doesn't matter if it's 0
  4167. timeoutId = setTimeout(function () {
  4168. _this4.onSearch({
  4169. currentTarget: event.currentTarget
  4170. });
  4171. }, opts.searchTimeOut);
  4172. });
  4173. }; // Fix #4516: this.showSearchClearButton is for extensions
  4174. if ((opts.search || this.showSearchClearButton) && typeof opts.searchSelector !== 'string') {
  4175. html = [];
  4176. var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, opts.formatSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.search) : '', opts.showButtonText ? opts.formatSearch() : '');
  4177. var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, opts.formatClearSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.clearSearch) : '', opts.showButtonText ? opts.formatClearSearch() : '');
  4178. var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, opts.iconSize), "\n search-input\" type=\"search\" placeholder=\"").concat(opts.formatSearch(), "\" autocomplete=\"off\">");
  4179. var searchInputFinalHtml = searchInputHtml;
  4180. if (opts.showSearchButton || opts.showSearchClearButton) {
  4181. var _buttonsHtml = (opts.showSearchButton ? showSearchButton : '') + (opts.showSearchClearButton ? showSearchClearButton : '');
  4182. searchInputFinalHtml = opts.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, _buttonsHtml) : _buttonsHtml;
  4183. }
  4184. html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(opts.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml));
  4185. this.$toolbar.append(html.join(''));
  4186. var $searchInput = Utils.getSearchInput(this);
  4187. if (opts.showSearchButton) {
  4188. this.$toolbar.find('.search button[name=search]').off('click').on('click', function () {
  4189. clearTimeout(timeoutId); // doesn't matter if it's 0
  4190. timeoutId = setTimeout(function () {
  4191. _this4.onSearch({
  4192. currentTarget: $searchInput
  4193. });
  4194. }, opts.searchTimeOut);
  4195. });
  4196. if (opts.searchOnEnterKey) {
  4197. handleInputEvent($searchInput);
  4198. }
  4199. } else {
  4200. handleInputEvent($searchInput);
  4201. }
  4202. if (opts.showSearchClearButton) {
  4203. this.$toolbar.find('.search button[name=clearSearch]').click(function () {
  4204. _this4.resetSearch();
  4205. });
  4206. }
  4207. } else if (typeof opts.searchSelector === 'string') {
  4208. var _$searchInput = Utils.getSearchInput(this);
  4209. handleInputEvent(_$searchInput);
  4210. }
  4211. }
  4212. }, {
  4213. key: "onSearch",
  4214. value: function onSearch() {
  4215. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4216. currentTarget = _ref5.currentTarget,
  4217. firedByInitSearchText = _ref5.firedByInitSearchText;
  4218. var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  4219. if (currentTarget !== undefined && $__default['default'](currentTarget).length && overwriteSearchText) {
  4220. var text = $__default['default'](currentTarget).val().trim();
  4221. if (this.options.trimOnSearch && $__default['default'](currentTarget).val() !== text) {
  4222. $__default['default'](currentTarget).val(text);
  4223. }
  4224. if (this.searchText === text) {
  4225. return;
  4226. }
  4227. var $searchInput = Utils.getSearchInput(this);
  4228. var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $__default['default'](currentTarget);
  4229. if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) {
  4230. this.searchText = text;
  4231. this.options.searchText = text;
  4232. }
  4233. }
  4234. if (!firedByInitSearchText) {
  4235. this.options.pageNumber = 1;
  4236. }
  4237. this.initSearch();
  4238. if (firedByInitSearchText) {
  4239. if (this.options.sidePagination === 'client') {
  4240. this.updatePagination();
  4241. }
  4242. } else {
  4243. this.updatePagination();
  4244. }
  4245. this.trigger('search', this.searchText);
  4246. }
  4247. }, {
  4248. key: "initSearch",
  4249. value: function initSearch() {
  4250. var _this5 = this;
  4251. this.filterOptions = this.filterOptions || this.options.filterOptions;
  4252. if (this.options.sidePagination !== 'server') {
  4253. if (this.options.customSearch) {
  4254. this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
  4255. if (this.options.sortReset) {
  4256. this.unsortedData = _toConsumableArray(this.data);
  4257. }
  4258. return;
  4259. }
  4260. var rawSearchText = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText);
  4261. var searchText = rawSearchText ? rawSearchText.toLowerCase() : '';
  4262. var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
  4263. if (this.options.searchAccentNeutralise) {
  4264. searchText = Utils.normalizeAccent(searchText);
  4265. } // Check filter
  4266. if (typeof this.filterOptions.filterAlgorithm === 'function') {
  4267. this.data = this.options.data.filter(function (item) {
  4268. return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
  4269. });
  4270. } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
  4271. this.data = f ? this.options.data.filter(function (item) {
  4272. var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
  4273. if (filterAlgorithm === 'and') {
  4274. for (var key in f) {
  4275. if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
  4276. return false;
  4277. }
  4278. }
  4279. } else if (filterAlgorithm === 'or') {
  4280. var match = false;
  4281. for (var _key in f) {
  4282. if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
  4283. match = true;
  4284. }
  4285. }
  4286. return match;
  4287. }
  4288. return true;
  4289. }) : _toConsumableArray(this.options.data);
  4290. }
  4291. var visibleFields = this.getVisibleFields();
  4292. this.data = searchText ? this.data.filter(function (item, i) {
  4293. for (var j = 0; j < _this5.header.fields.length; j++) {
  4294. if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
  4295. continue;
  4296. }
  4297. var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
  4298. var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
  4299. var value = void 0;
  4300. if (typeof key === 'string') {
  4301. value = item;
  4302. var props = key.split('.');
  4303. for (var _i7 = 0; _i7 < props.length; _i7++) {
  4304. if (value[props[_i7]] !== null) {
  4305. value = value[props[_i7]];
  4306. }
  4307. }
  4308. } else {
  4309. value = item[key];
  4310. }
  4311. if (_this5.options.searchAccentNeutralise) {
  4312. value = Utils.normalizeAccent(value);
  4313. } // Fix #142: respect searchFormatter boolean
  4314. if (column && column.searchFormatter) {
  4315. value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
  4316. }
  4317. if (typeof value === 'string' || typeof value === 'number') {
  4318. if (_this5.options.strictSearch && "".concat(value).toLowerCase() === searchText || _this5.options.regexSearch && Utils.regexCompare(value, rawSearchText)) {
  4319. return true;
  4320. }
  4321. var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
  4322. var matches = largerSmallerEqualsRegex.exec(_this5.searchText);
  4323. var comparisonCheck = false;
  4324. if (matches) {
  4325. var operator = matches[1] || "".concat(matches[5], "l");
  4326. var comparisonValue = matches[2] || matches[3];
  4327. var int = parseInt(value, 10);
  4328. var comparisonInt = parseInt(comparisonValue, 10);
  4329. switch (operator) {
  4330. case '>':
  4331. case '<l':
  4332. comparisonCheck = int > comparisonInt;
  4333. break;
  4334. case '<':
  4335. case '>l':
  4336. comparisonCheck = int < comparisonInt;
  4337. break;
  4338. case '<=':
  4339. case '=<':
  4340. case '>=l':
  4341. case '=>l':
  4342. comparisonCheck = int <= comparisonInt;
  4343. break;
  4344. case '>=':
  4345. case '=>':
  4346. case '<=l':
  4347. case '=<l':
  4348. comparisonCheck = int >= comparisonInt;
  4349. break;
  4350. }
  4351. }
  4352. if (comparisonCheck || "".concat(value).toLowerCase().includes(searchText)) {
  4353. return true;
  4354. }
  4355. }
  4356. }
  4357. return false;
  4358. }) : this.data;
  4359. if (this.options.sortReset) {
  4360. this.unsortedData = _toConsumableArray(this.data);
  4361. }
  4362. this.initSort();
  4363. }
  4364. }
  4365. }, {
  4366. key: "initPagination",
  4367. value: function initPagination() {
  4368. var _this6 = this;
  4369. var opts = this.options;
  4370. if (!opts.pagination) {
  4371. this.$pagination.hide();
  4372. return;
  4373. }
  4374. this.$pagination.show();
  4375. var html = [];
  4376. var allSelected = false;
  4377. var i;
  4378. var from;
  4379. var to;
  4380. var $pageList;
  4381. var $pre;
  4382. var $next;
  4383. var $number;
  4384. var data = this.getData({
  4385. includeHiddenRows: false
  4386. });
  4387. var pageList = opts.pageList;
  4388. if (typeof pageList === 'string') {
  4389. pageList = pageList.replace(/\[|\]| /g, '').toLowerCase().split(',');
  4390. }
  4391. pageList = pageList.map(function (value) {
  4392. if (typeof value === 'string') {
  4393. return value.toLowerCase() === opts.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value;
  4394. }
  4395. return value;
  4396. });
  4397. this.paginationParts = opts.paginationParts;
  4398. if (typeof this.paginationParts === 'string') {
  4399. this.paginationParts = this.paginationParts.replace(/\[|\]| |'/g, '').split(',');
  4400. }
  4401. if (opts.sidePagination !== 'server') {
  4402. opts.totalRows = data.length;
  4403. }
  4404. this.totalPages = 0;
  4405. if (opts.totalRows) {
  4406. if (opts.pageSize === opts.formatAllRows()) {
  4407. opts.pageSize = opts.totalRows;
  4408. allSelected = true;
  4409. }
  4410. this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1;
  4411. opts.totalPages = this.totalPages;
  4412. }
  4413. if (this.totalPages > 0 && opts.pageNumber > this.totalPages) {
  4414. opts.pageNumber = this.totalPages;
  4415. }
  4416. this.pageFrom = (opts.pageNumber - 1) * opts.pageSize + 1;
  4417. this.pageTo = opts.pageNumber * opts.pageSize;
  4418. if (this.pageTo > opts.totalRows) {
  4419. this.pageTo = opts.totalRows;
  4420. }
  4421. if (this.options.pagination && this.options.sidePagination !== 'server') {
  4422. this.options.totalNotFiltered = this.options.data.length;
  4423. }
  4424. if (!this.options.showExtendedPagination) {
  4425. this.options.totalNotFiltered = undefined;
  4426. }
  4427. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
  4428. html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationDetailHAlign, " pagination-detail\">"));
  4429. }
  4430. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort')) {
  4431. var paginationInfo = this.paginationParts.includes('pageInfoShort') ? opts.formatDetailPagination(opts.totalRows) : opts.formatShowingRows(this.pageFrom, this.pageTo, opts.totalRows, opts.totalNotFiltered);
  4432. html.push("<span class=\"pagination-info\">\n ".concat(paginationInfo, "\n </span>"));
  4433. }
  4434. if (this.paginationParts.includes('pageSize')) {
  4435. html.push('<div class="page-list">');
  4436. var pageNumber = ["<div class=\"".concat(this.constants.classes.paginationDropdown, "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(this.constants.dataToggle, "=\"dropdown\">\n <span class=\"page-size\">\n ").concat(allSelected ? opts.formatAllRows() : opts.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])];
  4437. pageList.forEach(function (page, i) {
  4438. if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows || page === opts.formatAllRows()) {
  4439. var active;
  4440. if (allSelected) {
  4441. active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
  4442. } else {
  4443. active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : '';
  4444. }
  4445. pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
  4446. }
  4447. });
  4448. pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</div>"));
  4449. html.push(opts.formatRecordsPerPage(pageNumber.join('')));
  4450. }
  4451. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
  4452. html.push('</div></div>');
  4453. }
  4454. if (this.paginationParts.includes('pageList')) {
  4455. html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationHAlign, " pagination\">"), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', opts.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', opts.formatSRPaginationPreText(), opts.paginationPreText));
  4456. if (this.totalPages < opts.paginationSuccessivelySize) {
  4457. from = 1;
  4458. to = this.totalPages;
  4459. } else {
  4460. from = opts.pageNumber - opts.paginationPagesBySide;
  4461. to = from + opts.paginationPagesBySide * 2;
  4462. }
  4463. if (opts.pageNumber < opts.paginationSuccessivelySize - 1) {
  4464. to = opts.paginationSuccessivelySize;
  4465. }
  4466. if (opts.paginationSuccessivelySize > this.totalPages - from) {
  4467. from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1;
  4468. }
  4469. if (from < 1) {
  4470. from = 1;
  4471. }
  4472. if (to > this.totalPages) {
  4473. to = this.totalPages;
  4474. }
  4475. var middleSize = Math.round(opts.paginationPagesBySide / 2);
  4476. var pageItem = function pageItem(i) {
  4477. var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  4478. return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i);
  4479. };
  4480. if (from > 1) {
  4481. var max = opts.paginationPagesBySide;
  4482. if (max >= from) max = from - 1;
  4483. for (i = 1; i <= max; i++) {
  4484. html.push(pageItem(i));
  4485. }
  4486. if (from - 1 === max + 1) {
  4487. i = from - 1;
  4488. html.push(pageItem(i));
  4489. } else if (from - 1 > max) {
  4490. if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) {
  4491. i = Math.round((from - middleSize) / 2 + middleSize);
  4492. html.push(pageItem(i, ' page-intermediate'));
  4493. } else {
  4494. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
  4495. }
  4496. }
  4497. }
  4498. for (i = from; i <= to; i++) {
  4499. html.push(pageItem(i));
  4500. }
  4501. if (this.totalPages > to) {
  4502. var min = this.totalPages - (opts.paginationPagesBySide - 1);
  4503. if (to >= min) min = to + 1;
  4504. if (to + 1 === min - 1) {
  4505. i = to + 1;
  4506. html.push(pageItem(i));
  4507. } else if (min > to + 1) {
  4508. if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) {
  4509. i = Math.round((this.totalPages - middleSize - to) / 2 + to);
  4510. html.push(pageItem(i, ' page-intermediate'));
  4511. } else {
  4512. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
  4513. }
  4514. }
  4515. for (i = min; i <= this.totalPages; i++) {
  4516. html.push(pageItem(i));
  4517. }
  4518. }
  4519. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText));
  4520. html.push(this.constants.html.pagination[1], '</div>');
  4521. }
  4522. this.$pagination.html(html.join(''));
  4523. var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
  4524. this.$pagination.last().find('.page-list > div').addClass(dropupClass);
  4525. if (!opts.onlyInfoPagination) {
  4526. $pageList = this.$pagination.find('.page-list a');
  4527. $pre = this.$pagination.find('.page-pre');
  4528. $next = this.$pagination.find('.page-next');
  4529. $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
  4530. if (this.totalPages <= 1) {
  4531. this.$pagination.find('div.pagination').hide();
  4532. }
  4533. if (opts.smartDisplay) {
  4534. if (pageList.length < 2 || opts.totalRows <= pageList[0]) {
  4535. this.$pagination.find('div.page-list').hide();
  4536. }
  4537. } // when data is empty, hide the pagination
  4538. this.$pagination[this.getData().length ? 'show' : 'hide']();
  4539. if (!opts.paginationLoop) {
  4540. if (opts.pageNumber === 1) {
  4541. $pre.addClass('disabled');
  4542. }
  4543. if (opts.pageNumber === this.totalPages) {
  4544. $next.addClass('disabled');
  4545. }
  4546. }
  4547. if (allSelected) {
  4548. opts.pageSize = opts.formatAllRows();
  4549. } // removed the events for last and first, onPageNumber executeds the same logic
  4550. $pageList.off('click').on('click', function (e) {
  4551. return _this6.onPageListChange(e);
  4552. });
  4553. $pre.off('click').on('click', function (e) {
  4554. return _this6.onPagePre(e);
  4555. });
  4556. $next.off('click').on('click', function (e) {
  4557. return _this6.onPageNext(e);
  4558. });
  4559. $number.off('click').on('click', function (e) {
  4560. return _this6.onPageNumber(e);
  4561. });
  4562. }
  4563. }
  4564. }, {
  4565. key: "updatePagination",
  4566. value: function updatePagination(event) {
  4567. // Fix #171: IE disabled button can be clicked bug.
  4568. if (event && $__default['default'](event.currentTarget).hasClass('disabled')) {
  4569. return;
  4570. }
  4571. if (!this.options.maintainMetaData) {
  4572. this.resetRows();
  4573. }
  4574. this.initPagination();
  4575. this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
  4576. if (this.options.sidePagination === 'server') {
  4577. this.initServer();
  4578. } else {
  4579. this.initBody();
  4580. }
  4581. }
  4582. }, {
  4583. key: "onPageListChange",
  4584. value: function onPageListChange(event) {
  4585. event.preventDefault();
  4586. var $this = $__default['default'](event.currentTarget);
  4587. $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
  4588. this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
  4589. this.$toolbar.find('.page-size').text(this.options.pageSize);
  4590. this.updatePagination(event);
  4591. return false;
  4592. }
  4593. }, {
  4594. key: "onPagePre",
  4595. value: function onPagePre(event) {
  4596. if ($__default['default'](event.target).hasClass('disabled')) {
  4597. return;
  4598. }
  4599. event.preventDefault();
  4600. if (this.options.pageNumber - 1 === 0) {
  4601. this.options.pageNumber = this.options.totalPages;
  4602. } else {
  4603. this.options.pageNumber--;
  4604. }
  4605. this.updatePagination(event);
  4606. return false;
  4607. }
  4608. }, {
  4609. key: "onPageNext",
  4610. value: function onPageNext(event) {
  4611. if ($__default['default'](event.target).hasClass('disabled')) {
  4612. return;
  4613. }
  4614. event.preventDefault();
  4615. if (this.options.pageNumber + 1 > this.options.totalPages) {
  4616. this.options.pageNumber = 1;
  4617. } else {
  4618. this.options.pageNumber++;
  4619. }
  4620. this.updatePagination(event);
  4621. return false;
  4622. }
  4623. }, {
  4624. key: "onPageNumber",
  4625. value: function onPageNumber(event) {
  4626. event.preventDefault();
  4627. if (this.options.pageNumber === +$__default['default'](event.currentTarget).text()) {
  4628. return;
  4629. }
  4630. this.options.pageNumber = +$__default['default'](event.currentTarget).text();
  4631. this.updatePagination(event);
  4632. return false;
  4633. } // eslint-disable-next-line no-unused-vars
  4634. }, {
  4635. key: "initRow",
  4636. value: function initRow(item, i, data, trFragments) {
  4637. var _this7 = this;
  4638. var html = [];
  4639. var style = {};
  4640. var csses = [];
  4641. var data_ = '';
  4642. var attributes = {};
  4643. var htmlAttributes = [];
  4644. if (Utils.findIndex(this.hiddenRows, item) > -1) {
  4645. return;
  4646. }
  4647. style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
  4648. if (style && style.css) {
  4649. for (var _i8 = 0, _Object$entries7 = Object.entries(style.css); _i8 < _Object$entries7.length; _i8++) {
  4650. var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
  4651. key = _Object$entries7$_i[0],
  4652. value = _Object$entries7$_i[1];
  4653. csses.push("".concat(key, ": ").concat(value));
  4654. }
  4655. }
  4656. attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
  4657. if (attributes) {
  4658. for (var _i9 = 0, _Object$entries8 = Object.entries(attributes); _i9 < _Object$entries8.length; _i9++) {
  4659. var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
  4660. _key2 = _Object$entries8$_i[0],
  4661. _value = _Object$entries8$_i[1];
  4662. htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\""));
  4663. }
  4664. }
  4665. if (item._data && !Utils.isEmptyObject(item._data)) {
  4666. for (var _i10 = 0, _Object$entries9 = Object.entries(item._data); _i10 < _Object$entries9.length; _i10++) {
  4667. var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
  4668. k = _Object$entries9$_i[0],
  4669. v = _Object$entries9$_i[1];
  4670. // ignore data-index
  4671. if (k === 'index') {
  4672. return;
  4673. }
  4674. data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
  4675. }
  4676. }
  4677. html.push('<tr', Utils.sprintf(' %s', htmlAttributes.length ? htmlAttributes.join(' ') : undefined), Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id), Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)), Utils.sprintf(' style="%s"', Array.isArray(item) ? undefined : item._style), " data-index=\"".concat(i, "\""), Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)), Utils.sprintf(' data-has-detail-view="%s"', this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>');
  4678. if (this.options.cardView) {
  4679. html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
  4680. }
  4681. var detailViewTemplate = '';
  4682. if (Utils.hasDetailViewIcon(this.options)) {
  4683. detailViewTemplate = '<td>';
  4684. if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
  4685. detailViewTemplate += "\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n ");
  4686. }
  4687. detailViewTemplate += '</td>';
  4688. }
  4689. if (detailViewTemplate && this.options.detailViewAlign !== 'right') {
  4690. html.push(detailViewTemplate);
  4691. }
  4692. this.header.fields.forEach(function (field, j) {
  4693. var text = '';
  4694. var value_ = Utils.getItemField(item, field, _this7.options.escape);
  4695. var value = '';
  4696. var type = '';
  4697. var cellStyle = {};
  4698. var id_ = '';
  4699. var class_ = _this7.header.classes[j];
  4700. var style_ = '';
  4701. var styleToAdd_ = '';
  4702. var data_ = '';
  4703. var rowspan_ = '';
  4704. var colspan_ = '';
  4705. var title_ = '';
  4706. var column = _this7.columns[j];
  4707. if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') {
  4708. if (!column.checkbox && !column.radio) {
  4709. return;
  4710. }
  4711. }
  4712. if (!column.visible) {
  4713. return;
  4714. }
  4715. if (_this7.options.cardView && !column.cardVisible) {
  4716. return;
  4717. }
  4718. if (column.escape) {
  4719. value_ = Utils.escapeHTML(value_);
  4720. } // Style concat
  4721. if (csses.concat([_this7.header.styles[j]]).length) {
  4722. styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; '));
  4723. }
  4724. if (item["_".concat(field, "_style")]) {
  4725. styleToAdd_ += "".concat(item["_".concat(field, "_style")]);
  4726. }
  4727. if (styleToAdd_) {
  4728. style_ = " style=\"".concat(styleToAdd_, "\"");
  4729. } // Style concat
  4730. // handle id and class of td
  4731. if (item["_".concat(field, "_id")]) {
  4732. id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
  4733. }
  4734. if (item["_".concat(field, "_class")]) {
  4735. class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
  4736. }
  4737. if (item["_".concat(field, "_rowspan")]) {
  4738. rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
  4739. }
  4740. if (item["_".concat(field, "_colspan")]) {
  4741. colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
  4742. }
  4743. if (item["_".concat(field, "_title")]) {
  4744. title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
  4745. }
  4746. cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
  4747. if (cellStyle.classes) {
  4748. class_ = " class=\"".concat(cellStyle.classes, "\"");
  4749. }
  4750. if (cellStyle.css) {
  4751. var csses_ = [];
  4752. for (var _i11 = 0, _Object$entries10 = Object.entries(cellStyle.css); _i11 < _Object$entries10.length; _i11++) {
  4753. var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
  4754. _key3 = _Object$entries10$_i[0],
  4755. _value2 = _Object$entries10$_i[1];
  4756. csses_.push("".concat(_key3, ": ").concat(_value2));
  4757. }
  4758. style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
  4759. }
  4760. value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
  4761. if (!(column.checkbox || column.radio)) {
  4762. value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
  4763. }
  4764. if (column.searchable && _this7.searchText && _this7.options.searchHighlight && !(column.checkbox || column.radio)) {
  4765. var defValue = '';
  4766. var regExp = new RegExp("(".concat(_this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ")"), 'gim');
  4767. var marker = '<mark>$1</mark>';
  4768. var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value);
  4769. if (isHTML) {
  4770. // value can contains a HTML tags
  4771. var textContent = new DOMParser().parseFromString(value.toString(), 'text/html').documentElement.textContent;
  4772. var textReplaced = textContent.replace(regExp, marker);
  4773. defValue = value.replace(new RegExp("(>\\s*)(".concat(textContent, ")(\\s*)"), 'gm'), "$1".concat(textReplaced, "$3"));
  4774. } else {
  4775. // but usually not
  4776. defValue = value.toString().replace(regExp, marker);
  4777. }
  4778. value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue);
  4779. }
  4780. if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
  4781. for (var _i12 = 0, _Object$entries11 = Object.entries(item["_".concat(field, "_data")]); _i12 < _Object$entries11.length; _i12++) {
  4782. var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2),
  4783. _k = _Object$entries11$_i[0],
  4784. _v = _Object$entries11$_i[1];
  4785. // ignore data-index
  4786. if (_k === 'index') {
  4787. return;
  4788. }
  4789. data_ += " data-".concat(_k, "=\"").concat(_v, "\"");
  4790. }
  4791. }
  4792. if (column.checkbox || column.radio) {
  4793. type = column.checkbox ? 'checkbox' : type;
  4794. type = column.radio ? 'radio' : type;
  4795. var c = column['class'] || '';
  4796. var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false;
  4797. var isDisabled = !column.checkboxEnabled || value && value.disabled;
  4798. text = [_this7.options.cardView ? "<div class=\"card-view ".concat(c, "\">") : "<td class=\"bs-checkbox ".concat(c, "\"").concat(class_).concat(style_, ">"), "<label>\n <input\n data-index=\"".concat(i, "\"\n name=\"").concat(_this7.options.selectItemName, "\"\n type=\"").concat(type, "\"\n ").concat(Utils.sprintf('value="%s"', item[_this7.options.idField]), "\n ").concat(Utils.sprintf('checked="%s"', isChecked ? 'checked' : undefined), "\n ").concat(Utils.sprintf('disabled="%s"', isDisabled ? 'disabled' : undefined), " />\n <span></span>\n </label>"), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '</div>' : '</td>'].join('');
  4799. item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
  4800. } else if (_this7.options.cardView) {
  4801. var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title ".concat(cellStyle.classes, "\"").concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
  4802. text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value ").concat(cellStyle.classes, "\"").concat(style_, ">").concat(value, "</span></div>");
  4803. if (_this7.options.smartDisplay && value === '') {
  4804. text = '<div class="card-view"></div>';
  4805. }
  4806. } else {
  4807. text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
  4808. }
  4809. html.push(text);
  4810. });
  4811. if (detailViewTemplate && this.options.detailViewAlign === 'right') {
  4812. html.push(detailViewTemplate);
  4813. }
  4814. if (this.options.cardView) {
  4815. html.push('</div></td>');
  4816. }
  4817. html.push('</tr>');
  4818. return html.join('');
  4819. }
  4820. }, {
  4821. key: "initBody",
  4822. value: function initBody(fixedScroll, updatedUid) {
  4823. var _this8 = this;
  4824. var data = this.getData();
  4825. this.trigger('pre-body', data);
  4826. this.$body = this.$el.find('>tbody');
  4827. if (!this.$body.length) {
  4828. this.$body = $__default['default']('<tbody></tbody>').appendTo(this.$el);
  4829. } // Fix #389 Bootstrap-table-flatJSON is not working
  4830. if (!this.options.pagination || this.options.sidePagination === 'server') {
  4831. this.pageFrom = 1;
  4832. this.pageTo = data.length;
  4833. }
  4834. var rows = [];
  4835. var trFragments = $__default['default'](document.createDocumentFragment());
  4836. var hasTr = false;
  4837. var toExpand = [];
  4838. this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo));
  4839. for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
  4840. var item = data[i];
  4841. var tr = this.initRow(item, i, data, trFragments);
  4842. hasTr = hasTr || !!tr;
  4843. if (tr && typeof tr === 'string') {
  4844. var uniqueId = this.options.uniqueId;
  4845. if (uniqueId && item.hasOwnProperty(uniqueId)) {
  4846. var itemUniqueId = item[uniqueId];
  4847. var oldTr = this.$body.find(Utils.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', itemUniqueId));
  4848. var oldTrNext = oldTr.next();
  4849. if (oldTrNext.is('tr.detail-view')) {
  4850. toExpand.push(i);
  4851. if (!updatedUid || itemUniqueId !== updatedUid) {
  4852. tr += oldTrNext[0].outerHTML;
  4853. }
  4854. }
  4855. }
  4856. if (!this.options.virtualScroll) {
  4857. trFragments.append(tr);
  4858. } else {
  4859. rows.push(tr);
  4860. }
  4861. }
  4862. } // show no records
  4863. if (!hasTr) {
  4864. this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "</tr>"));
  4865. } else if (!this.options.virtualScroll) {
  4866. this.$body.html(trFragments);
  4867. } else {
  4868. if (this.virtualScroll) {
  4869. this.virtualScroll.destroy();
  4870. }
  4871. this.virtualScroll = new VirtualScroll({
  4872. rows: rows,
  4873. fixedScroll: fixedScroll,
  4874. scrollEl: this.$tableBody[0],
  4875. contentEl: this.$body[0],
  4876. itemHeight: this.options.virtualScrollItemHeight,
  4877. callback: function callback(startIndex, endIndex) {
  4878. _this8.fitHeader();
  4879. _this8.initBodyEvent();
  4880. _this8.trigger('virtual-scroll', startIndex, endIndex);
  4881. }
  4882. });
  4883. }
  4884. toExpand.forEach(function (index) {
  4885. _this8.expandRow(index);
  4886. });
  4887. if (!fixedScroll) {
  4888. this.scrollTo(0);
  4889. }
  4890. this.initBodyEvent();
  4891. this.initFooter();
  4892. this.resetView();
  4893. this.updateSelected();
  4894. if (this.options.sidePagination !== 'server') {
  4895. this.options.totalRows = data.length;
  4896. }
  4897. this.trigger('post-body', data);
  4898. }
  4899. }, {
  4900. key: "initBodyEvent",
  4901. value: function initBodyEvent() {
  4902. var _this9 = this;
  4903. // click to select by column
  4904. this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  4905. var $td = $__default['default'](e.currentTarget);
  4906. var $tr = $td.parent();
  4907. var $cardViewArr = $__default['default'](e.target).parents('.card-views').children();
  4908. var $cardViewTarget = $__default['default'](e.target).parents('.card-view');
  4909. var rowIndex = $tr.data('index');
  4910. var item = _this9.data[rowIndex];
  4911. var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
  4912. var fields = _this9.getVisibleFields();
  4913. var field = fields[index - Utils.getDetailViewIndexOffset(_this9.options)];
  4914. var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
  4915. var value = Utils.getItemField(item, field, _this9.options.escape);
  4916. if ($td.find('.detail-icon').length) {
  4917. return;
  4918. }
  4919. _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
  4920. _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
  4921. if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
  4922. var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
  4923. if ($selectItem.length) {
  4924. $selectItem[0].click();
  4925. }
  4926. }
  4927. if (e.type === 'click' && _this9.options.detailViewByClick) {
  4928. _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
  4929. }
  4930. }).off('mousedown').on('mousedown', function (e) {
  4931. // https://github.com/jquery/jquery/issues/1741
  4932. _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
  4933. _this9.multipleSelectRowShiftKey = e.shiftKey;
  4934. });
  4935. this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
  4936. e.preventDefault();
  4937. _this9.toggleDetailView($__default['default'](e.currentTarget).parent().parent().data('index'));
  4938. return false;
  4939. });
  4940. this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
  4941. this.$selectItem.off('click').on('click', function (e) {
  4942. e.stopImmediatePropagation();
  4943. var $this = $__default['default'](e.currentTarget);
  4944. _this9._toggleCheck($this.prop('checked'), $this.data('index'));
  4945. });
  4946. this.header.events.forEach(function (_events, i) {
  4947. var events = _events;
  4948. if (!events) {
  4949. return;
  4950. } // fix bug, if events is defined with namespace
  4951. if (typeof events === 'string') {
  4952. events = Utils.calculateObjectValue(null, events);
  4953. }
  4954. var field = _this9.header.fields[i];
  4955. var fieldIndex = _this9.getVisibleFields().indexOf(field);
  4956. if (fieldIndex === -1) {
  4957. return;
  4958. }
  4959. fieldIndex += Utils.getDetailViewIndexOffset(_this9.options);
  4960. var _loop2 = function _loop2(key) {
  4961. if (!events.hasOwnProperty(key)) {
  4962. return "continue";
  4963. }
  4964. var event = events[key];
  4965. _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
  4966. var $tr = $__default['default'](tr);
  4967. var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
  4968. var index = key.indexOf(' ');
  4969. var name = key.substring(0, index);
  4970. var el = key.substring(index + 1);
  4971. $td.find(el).off(name).on(name, function (e) {
  4972. var index = $tr.data('index');
  4973. var row = _this9.data[index];
  4974. var value = row[field];
  4975. event.apply(_this9, [e, value, row, index]);
  4976. });
  4977. });
  4978. };
  4979. for (var key in events) {
  4980. var _ret2 = _loop2(key);
  4981. if (_ret2 === "continue") continue;
  4982. }
  4983. });
  4984. }
  4985. }, {
  4986. key: "initServer",
  4987. value: function initServer(silent, query, url) {
  4988. var _this10 = this;
  4989. var data = {};
  4990. var index = this.header.fields.indexOf(this.options.sortName);
  4991. var params = {
  4992. searchText: this.searchText,
  4993. sortName: this.options.sortName,
  4994. sortOrder: this.options.sortOrder
  4995. };
  4996. if (this.header.sortNames[index]) {
  4997. params.sortName = this.header.sortNames[index];
  4998. }
  4999. if (this.options.pagination && this.options.sidePagination === 'server') {
  5000. params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
  5001. params.pageNumber = this.options.pageNumber;
  5002. }
  5003. if (!(url || this.options.url) && !this.options.ajax) {
  5004. return;
  5005. }
  5006. if (this.options.queryParamsType === 'limit') {
  5007. params = {
  5008. search: params.searchText,
  5009. sort: params.sortName,
  5010. order: params.sortOrder
  5011. };
  5012. if (this.options.pagination && this.options.sidePagination === 'server') {
  5013. params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
  5014. params.limit = this.options.pageSize;
  5015. if (params.limit === 0 || this.options.pageSize === this.options.formatAllRows()) {
  5016. delete params.limit;
  5017. }
  5018. }
  5019. }
  5020. if (this.options.search && this.options.sidePagination === 'server' && this.columns.filter(function (column) {
  5021. return !column.searchable;
  5022. }).length) {
  5023. params.searchable = [];
  5024. var _iterator2 = _createForOfIteratorHelper(this.columns),
  5025. _step2;
  5026. try {
  5027. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  5028. var column = _step2.value;
  5029. if (!column.checkbox && column.searchable && (this.options.visibleSearch && column.visible || !this.options.visibleSearch)) {
  5030. params.searchable.push(column.field);
  5031. }
  5032. }
  5033. } catch (err) {
  5034. _iterator2.e(err);
  5035. } finally {
  5036. _iterator2.f();
  5037. }
  5038. }
  5039. if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
  5040. params.filter = JSON.stringify(this.filterColumnsPartial, null);
  5041. }
  5042. $__default['default'].extend(params, query || {});
  5043. data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
  5044. if (data === false) {
  5045. return;
  5046. }
  5047. if (!silent) {
  5048. this.showLoading();
  5049. }
  5050. var request = $__default['default'].extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
  5051. type: this.options.method,
  5052. url: url || this.options.url,
  5053. data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
  5054. cache: this.options.cache,
  5055. contentType: this.options.contentType,
  5056. dataType: this.options.dataType,
  5057. success: function success(_res, textStatus, jqXHR) {
  5058. var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
  5059. _this10.load(res);
  5060. _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR);
  5061. if (!silent) {
  5062. _this10.hideLoading();
  5063. }
  5064. if (_this10.options.sidePagination === 'server' && _this10.options.pageNumber > 1 && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
  5065. _this10.updatePagination();
  5066. }
  5067. },
  5068. error: function error(jqXHR) {
  5069. // abort ajax by multiple request
  5070. if (jqXHR && jqXHR.status === 0 && _this10._xhrAbort) {
  5071. _this10._xhrAbort = false;
  5072. return;
  5073. }
  5074. var data = [];
  5075. if (_this10.options.sidePagination === 'server') {
  5076. data = {};
  5077. data[_this10.options.totalField] = 0;
  5078. data[_this10.options.dataField] = [];
  5079. }
  5080. _this10.load(data);
  5081. _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR);
  5082. if (!silent) _this10.$tableLoading.hide();
  5083. }
  5084. });
  5085. if (this.options.ajax) {
  5086. Utils.calculateObjectValue(this, this.options.ajax, [request], null);
  5087. } else {
  5088. if (this._xhr && this._xhr.readyState !== 4) {
  5089. this._xhrAbort = true;
  5090. this._xhr.abort();
  5091. }
  5092. this._xhr = $__default['default'].ajax(request);
  5093. }
  5094. return data;
  5095. }
  5096. }, {
  5097. key: "initSearchText",
  5098. value: function initSearchText() {
  5099. if (this.options.search) {
  5100. this.searchText = '';
  5101. if (this.options.searchText !== '') {
  5102. var $search = Utils.getSearchInput(this);
  5103. $search.val(this.options.searchText);
  5104. this.onSearch({
  5105. currentTarget: $search,
  5106. firedByInitSearchText: true
  5107. });
  5108. }
  5109. }
  5110. }
  5111. }, {
  5112. key: "getCaret",
  5113. value: function getCaret() {
  5114. var _this11 = this;
  5115. this.$header.find('th').each(function (i, th) {
  5116. $__default['default'](th).find('.sortable').removeClass('desc asc').addClass($__default['default'](th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
  5117. });
  5118. }
  5119. }, {
  5120. key: "updateSelected",
  5121. value: function updateSelected() {
  5122. var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
  5123. this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
  5124. this.$selectItem.each(function (i, el) {
  5125. $__default['default'](el).closest('tr')[$__default['default'](el).prop('checked') ? 'addClass' : 'removeClass']('selected');
  5126. });
  5127. }
  5128. }, {
  5129. key: "updateRows",
  5130. value: function updateRows() {
  5131. var _this12 = this;
  5132. this.$selectItem.each(function (i, el) {
  5133. _this12.data[$__default['default'](el).data('index')][_this12.header.stateField] = $__default['default'](el).prop('checked');
  5134. });
  5135. }
  5136. }, {
  5137. key: "resetRows",
  5138. value: function resetRows() {
  5139. var _iterator3 = _createForOfIteratorHelper(this.data),
  5140. _step3;
  5141. try {
  5142. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  5143. var row = _step3.value;
  5144. this.$selectAll.prop('checked', false);
  5145. this.$selectItem.prop('checked', false);
  5146. if (this.header.stateField) {
  5147. row[this.header.stateField] = false;
  5148. }
  5149. }
  5150. } catch (err) {
  5151. _iterator3.e(err);
  5152. } finally {
  5153. _iterator3.f();
  5154. }
  5155. this.initHiddenRows();
  5156. }
  5157. }, {
  5158. key: "trigger",
  5159. value: function trigger(_name) {
  5160. var _this$options, _this$options2;
  5161. var name = "".concat(_name, ".bs.table");
  5162. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) {
  5163. args[_key4 - 1] = arguments[_key4];
  5164. }
  5165. (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this]));
  5166. this.$el.trigger($__default['default'].Event(name, {
  5167. sender: this
  5168. }), args);
  5169. (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this])));
  5170. this.$el.trigger($__default['default'].Event('all.bs.table', {
  5171. sender: this
  5172. }), [name, args]);
  5173. }
  5174. }, {
  5175. key: "resetHeader",
  5176. value: function resetHeader() {
  5177. var _this13 = this;
  5178. // fix #61: the hidden table reset header bug.
  5179. // fix bug: get $el.css('width') error sometime (height = 500)
  5180. clearTimeout(this.timeoutId_);
  5181. this.timeoutId_ = setTimeout(function () {
  5182. return _this13.fitHeader();
  5183. }, this.$el.is(':hidden') ? 100 : 0);
  5184. }
  5185. }, {
  5186. key: "fitHeader",
  5187. value: function fitHeader() {
  5188. var _this14 = this;
  5189. if (this.$el.is(':hidden')) {
  5190. this.timeoutId_ = setTimeout(function () {
  5191. return _this14.fitHeader();
  5192. }, 100);
  5193. return;
  5194. }
  5195. var fixedBody = this.$tableBody.get(0);
  5196. var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  5197. this.$el.css('margin-top', -this.$header.outerHeight());
  5198. var focused = $__default['default'](':focus');
  5199. if (focused.length > 0) {
  5200. var $th = focused.parents('th');
  5201. if ($th.length > 0) {
  5202. var dataField = $th.attr('data-field');
  5203. if (dataField !== undefined) {
  5204. var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
  5205. if ($headerTh.length > 0) {
  5206. $headerTh.find(':input').addClass('focus-temp');
  5207. }
  5208. }
  5209. }
  5210. }
  5211. this.$header_ = this.$header.clone(true, true);
  5212. this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
  5213. this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
  5214. this.$tableLoading.css('width', this.$el.outerWidth());
  5215. var focusedTemp = $__default['default']('.focus-temp:visible:eq(0)');
  5216. if (focusedTemp.length > 0) {
  5217. focusedTemp.focus();
  5218. this.$header.find('.focus-temp').removeClass('focus-temp');
  5219. } // fix bug: $.data() is not working as expected after $.append()
  5220. this.$header.find('th[data-field]').each(function (i, el) {
  5221. _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $__default['default'](el).data('field'))).data($__default['default'](el).data());
  5222. });
  5223. var visibleFields = this.getVisibleFields();
  5224. var $ths = this.$header_.find('th');
  5225. var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
  5226. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  5227. $tr = $tr.next();
  5228. }
  5229. var trLength = $tr.find('> *').length;
  5230. $tr.find('> *').each(function (i, el) {
  5231. var $this = $__default['default'](el);
  5232. if (Utils.hasDetailViewIcon(_this14.options)) {
  5233. if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') {
  5234. var $thDetail = $ths.filter('.detail');
  5235. var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  5236. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
  5237. return;
  5238. }
  5239. }
  5240. var index = i - Utils.getDetailViewIndexOffset(_this14.options);
  5241. var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
  5242. if ($th.length > 1) {
  5243. $th = $__default['default']($ths[$this[0].cellIndex]);
  5244. }
  5245. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  5246. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  5247. });
  5248. this.horizontalScroll();
  5249. this.trigger('post-header');
  5250. }
  5251. }, {
  5252. key: "initFooter",
  5253. value: function initFooter() {
  5254. if (!this.options.showFooter || this.options.cardView) {
  5255. // do nothing
  5256. return;
  5257. }
  5258. var data = this.getData();
  5259. var html = [];
  5260. var detailTemplate = '';
  5261. if (Utils.hasDetailViewIcon(this.options)) {
  5262. detailTemplate = '<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>';
  5263. }
  5264. if (detailTemplate && this.options.detailViewAlign !== 'right') {
  5265. html.push(detailTemplate);
  5266. }
  5267. var _iterator4 = _createForOfIteratorHelper(this.columns),
  5268. _step4;
  5269. try {
  5270. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  5271. var column = _step4.value;
  5272. var falign = '';
  5273. var valign = '';
  5274. var csses = [];
  5275. var style = {};
  5276. var class_ = Utils.sprintf(' class="%s"', column['class']);
  5277. if (!column.visible || this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])) {
  5278. continue;
  5279. }
  5280. if (this.options.cardView && !column.cardVisible) {
  5281. return;
  5282. }
  5283. falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
  5284. valign = Utils.sprintf('vertical-align: %s; ', column.valign);
  5285. style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
  5286. if (style && style.css) {
  5287. for (var _i13 = 0, _Object$entries12 = Object.entries(style.css); _i13 < _Object$entries12.length; _i13++) {
  5288. var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2),
  5289. key = _Object$entries12$_i[0],
  5290. _value3 = _Object$entries12$_i[1];
  5291. csses.push("".concat(key, ": ").concat(_value3));
  5292. }
  5293. }
  5294. if (style && style.classes) {
  5295. class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
  5296. }
  5297. html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')));
  5298. var colspan = 0;
  5299. if (this.footerData && this.footerData.length > 0) {
  5300. colspan = this.footerData[0]["_".concat(column.field, "_colspan")] || 0;
  5301. }
  5302. if (colspan) {
  5303. html.push(" colspan=\"".concat(colspan, "\" "));
  5304. }
  5305. html.push('>');
  5306. html.push('<div class="th-inner">');
  5307. var value = '';
  5308. if (this.footerData && this.footerData.length > 0) {
  5309. value = this.footerData[0][column.field] || '';
  5310. }
  5311. html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data, value], value));
  5312. html.push('</div>');
  5313. html.push('<div class="fht-cell"></div>');
  5314. html.push('</div>');
  5315. html.push('</th>');
  5316. }
  5317. } catch (err) {
  5318. _iterator4.e(err);
  5319. } finally {
  5320. _iterator4.f();
  5321. }
  5322. if (detailTemplate && this.options.detailViewAlign === 'right') {
  5323. html.push(detailTemplate);
  5324. }
  5325. if (!this.options.height && !this.$tableFooter.length) {
  5326. this.$el.append('<tfoot><tr></tr></tfoot>');
  5327. this.$tableFooter = this.$el.find('tfoot');
  5328. }
  5329. if (!this.$tableFooter.find('tr').length) {
  5330. this.$tableFooter.html('<table><thead><tr></tr></thead></table>');
  5331. }
  5332. this.$tableFooter.find('tr').html(html.join(''));
  5333. this.trigger('post-footer', this.$tableFooter);
  5334. }
  5335. }, {
  5336. key: "fitFooter",
  5337. value: function fitFooter() {
  5338. var _this15 = this;
  5339. if (this.$el.is(':hidden')) {
  5340. setTimeout(function () {
  5341. return _this15.fitFooter();
  5342. }, 100);
  5343. return;
  5344. }
  5345. var fixedBody = this.$tableBody.get(0);
  5346. var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  5347. this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
  5348. var $ths = this.$tableFooter.find('th');
  5349. var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
  5350. $ths.find('.fht-cell').width('auto');
  5351. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  5352. $tr = $tr.next();
  5353. }
  5354. var trLength = $tr.find('> *').length;
  5355. $tr.find('> *').each(function (i, el) {
  5356. var $this = $__default['default'](el);
  5357. if (Utils.hasDetailViewIcon(_this15.options)) {
  5358. if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') {
  5359. var $thDetail = $ths.filter('.detail');
  5360. var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  5361. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
  5362. return;
  5363. }
  5364. }
  5365. var $th = $ths.eq(i);
  5366. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  5367. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  5368. });
  5369. this.horizontalScroll();
  5370. }
  5371. }, {
  5372. key: "horizontalScroll",
  5373. value: function horizontalScroll() {
  5374. var _this16 = this;
  5375. // horizontal scroll event
  5376. // TODO: it's probably better improving the layout than binding to scroll event
  5377. this.$tableBody.off('scroll').on('scroll', function () {
  5378. var scrollLeft = _this16.$tableBody.scrollLeft();
  5379. if (_this16.options.showHeader && _this16.options.height) {
  5380. _this16.$tableHeader.scrollLeft(scrollLeft);
  5381. }
  5382. if (_this16.options.showFooter && !_this16.options.cardView) {
  5383. _this16.$tableFooter.scrollLeft(scrollLeft);
  5384. }
  5385. _this16.trigger('scroll-body', _this16.$tableBody);
  5386. });
  5387. }
  5388. }, {
  5389. key: "getVisibleFields",
  5390. value: function getVisibleFields() {
  5391. var visibleFields = [];
  5392. var _iterator5 = _createForOfIteratorHelper(this.header.fields),
  5393. _step5;
  5394. try {
  5395. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  5396. var field = _step5.value;
  5397. var column = this.columns[this.fieldsColumnsIndex[field]];
  5398. if (!column || !column.visible) {
  5399. continue;
  5400. }
  5401. visibleFields.push(field);
  5402. }
  5403. } catch (err) {
  5404. _iterator5.e(err);
  5405. } finally {
  5406. _iterator5.f();
  5407. }
  5408. return visibleFields;
  5409. }
  5410. }, {
  5411. key: "initHiddenRows",
  5412. value: function initHiddenRows() {
  5413. this.hiddenRows = [];
  5414. } // PUBLIC FUNCTION DEFINITION
  5415. // =======================
  5416. }, {
  5417. key: "getOptions",
  5418. value: function getOptions() {
  5419. // deep copy and remove data
  5420. var options = $__default['default'].extend({}, this.options);
  5421. delete options.data;
  5422. return $__default['default'].extend(true, {}, options);
  5423. }
  5424. }, {
  5425. key: "refreshOptions",
  5426. value: function refreshOptions(options) {
  5427. // If the objects are equivalent then avoid the call of destroy / init methods
  5428. if (Utils.compareObjects(this.options, options, true)) {
  5429. return;
  5430. }
  5431. this.options = $__default['default'].extend(this.options, options);
  5432. this.trigger('refresh-options', this.options);
  5433. this.destroy();
  5434. this.init();
  5435. }
  5436. }, {
  5437. key: "getData",
  5438. value: function getData(params) {
  5439. var _this17 = this;
  5440. var data = this.options.data;
  5441. if ((this.searchText || this.options.customSearch || this.options.sortName !== undefined || this.enableCustomSort || // Fix #4616: this.enableCustomSort is for extensions
  5442. !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) {
  5443. data = this.data;
  5444. }
  5445. if (params && params.useCurrentPage) {
  5446. data = data.slice(this.pageFrom - 1, this.pageTo);
  5447. }
  5448. if (params && !params.includeHiddenRows) {
  5449. var hiddenRows = this.getHiddenRows();
  5450. data = data.filter(function (row) {
  5451. return Utils.findIndex(hiddenRows, row) === -1;
  5452. });
  5453. }
  5454. if (params && params.formatted) {
  5455. data.forEach(function (row) {
  5456. for (var _i14 = 0, _Object$entries13 = Object.entries(row); _i14 < _Object$entries13.length; _i14++) {
  5457. var _Object$entries13$_i = _slicedToArray(_Object$entries13[_i14], 2),
  5458. key = _Object$entries13$_i[0],
  5459. value = _Object$entries13$_i[1];
  5460. var column = _this17.columns[_this17.fieldsColumnsIndex[key]];
  5461. if (!column) {
  5462. return;
  5463. }
  5464. row[key] = Utils.calculateObjectValue(column, _this17.header.formatters[column.fieldIndex], [value, row, row.index, column.field], value);
  5465. }
  5466. });
  5467. }
  5468. return data;
  5469. }
  5470. }, {
  5471. key: "getSelections",
  5472. value: function getSelections() {
  5473. var _this18 = this;
  5474. return (this.options.maintainMetaData ? this.options.data : this.data).filter(function (row) {
  5475. return row[_this18.header.stateField] === true;
  5476. });
  5477. }
  5478. }, {
  5479. key: "load",
  5480. value: function load(_data) {
  5481. var fixedScroll = false;
  5482. var data = _data; // #431: support pagination
  5483. if (this.options.pagination && this.options.sidePagination === 'server') {
  5484. this.options.totalRows = data[this.options.totalField];
  5485. this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
  5486. this.footerData = data[this.options.footerField] ? [data[this.options.footerField]] : undefined;
  5487. }
  5488. fixedScroll = data.fixedScroll;
  5489. data = Array.isArray(data) ? data : data[this.options.dataField];
  5490. this.initData(data);
  5491. this.initSearch();
  5492. this.initPagination();
  5493. this.initBody(fixedScroll);
  5494. }
  5495. }, {
  5496. key: "append",
  5497. value: function append(data) {
  5498. this.initData(data, 'append');
  5499. this.initSearch();
  5500. this.initPagination();
  5501. this.initSort();
  5502. this.initBody(true);
  5503. }
  5504. }, {
  5505. key: "prepend",
  5506. value: function prepend(data) {
  5507. this.initData(data, 'prepend');
  5508. this.initSearch();
  5509. this.initPagination();
  5510. this.initSort();
  5511. this.initBody(true);
  5512. }
  5513. }, {
  5514. key: "remove",
  5515. value: function remove(params) {
  5516. var removed = 0;
  5517. for (var i = this.options.data.length - 1; i >= 0; i--) {
  5518. var row = this.options.data[i];
  5519. if (!row.hasOwnProperty(params.field) && params.field !== '$index') {
  5520. continue;
  5521. }
  5522. if (!row.hasOwnProperty(params.field) && params.field === '$index' && params.values.includes(i) || params.values.includes(row[params.field])) {
  5523. removed++;
  5524. this.options.data.splice(i, 1);
  5525. }
  5526. }
  5527. if (!removed) {
  5528. return;
  5529. }
  5530. if (this.options.sidePagination === 'server') {
  5531. this.options.totalRows -= removed;
  5532. this.data = _toConsumableArray(this.options.data);
  5533. }
  5534. this.initSearch();
  5535. this.initPagination();
  5536. this.initSort();
  5537. this.initBody(true);
  5538. }
  5539. }, {
  5540. key: "removeAll",
  5541. value: function removeAll() {
  5542. if (this.options.data.length > 0) {
  5543. this.options.data.splice(0, this.options.data.length);
  5544. this.initSearch();
  5545. this.initPagination();
  5546. this.initBody(true);
  5547. }
  5548. }
  5549. }, {
  5550. key: "insertRow",
  5551. value: function insertRow(params) {
  5552. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
  5553. return;
  5554. }
  5555. this.options.data.splice(params.index, 0, params.row);
  5556. this.initSearch();
  5557. this.initPagination();
  5558. this.initSort();
  5559. this.initBody(true);
  5560. }
  5561. }, {
  5562. key: "updateRow",
  5563. value: function updateRow(params) {
  5564. var allParams = Array.isArray(params) ? params : [params];
  5565. var _iterator6 = _createForOfIteratorHelper(allParams),
  5566. _step6;
  5567. try {
  5568. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  5569. var _params = _step6.value;
  5570. if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
  5571. continue;
  5572. }
  5573. if (_params.hasOwnProperty('replace') && _params.replace) {
  5574. this.options.data[_params.index] = _params.row;
  5575. } else {
  5576. $__default['default'].extend(this.options.data[_params.index], _params.row);
  5577. }
  5578. }
  5579. } catch (err) {
  5580. _iterator6.e(err);
  5581. } finally {
  5582. _iterator6.f();
  5583. }
  5584. this.initSearch();
  5585. this.initPagination();
  5586. this.initSort();
  5587. this.initBody(true);
  5588. }
  5589. }, {
  5590. key: "getRowByUniqueId",
  5591. value: function getRowByUniqueId(_id) {
  5592. var uniqueId = this.options.uniqueId;
  5593. var len = this.options.data.length;
  5594. var id = _id;
  5595. var dataRow = null;
  5596. var i;
  5597. var row;
  5598. var rowUniqueId;
  5599. for (i = len - 1; i >= 0; i--) {
  5600. row = this.options.data[i];
  5601. if (row.hasOwnProperty(uniqueId)) {
  5602. // uniqueId is a column
  5603. rowUniqueId = row[uniqueId];
  5604. } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
  5605. // uniqueId is a row data property
  5606. rowUniqueId = row._data[uniqueId];
  5607. } else {
  5608. continue;
  5609. }
  5610. if (typeof rowUniqueId === 'string') {
  5611. id = id.toString();
  5612. } else if (typeof rowUniqueId === 'number') {
  5613. if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
  5614. id = parseInt(id, 10);
  5615. } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
  5616. id = parseFloat(id);
  5617. }
  5618. }
  5619. if (rowUniqueId === id) {
  5620. dataRow = row;
  5621. break;
  5622. }
  5623. }
  5624. return dataRow;
  5625. }
  5626. }, {
  5627. key: "updateByUniqueId",
  5628. value: function updateByUniqueId(params) {
  5629. var allParams = Array.isArray(params) ? params : [params];
  5630. var updatedUid = null;
  5631. var _iterator7 = _createForOfIteratorHelper(allParams),
  5632. _step7;
  5633. try {
  5634. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  5635. var _params2 = _step7.value;
  5636. if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
  5637. continue;
  5638. }
  5639. var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
  5640. if (rowId === -1) {
  5641. continue;
  5642. }
  5643. if (_params2.hasOwnProperty('replace') && _params2.replace) {
  5644. this.options.data[rowId] = _params2.row;
  5645. } else {
  5646. $__default['default'].extend(this.options.data[rowId], _params2.row);
  5647. }
  5648. updatedUid = _params2.id;
  5649. }
  5650. } catch (err) {
  5651. _iterator7.e(err);
  5652. } finally {
  5653. _iterator7.f();
  5654. }
  5655. this.initSearch();
  5656. this.initPagination();
  5657. this.initSort();
  5658. this.initBody(true, updatedUid);
  5659. }
  5660. }, {
  5661. key: "removeByUniqueId",
  5662. value: function removeByUniqueId(id) {
  5663. var len = this.options.data.length;
  5664. var row = this.getRowByUniqueId(id);
  5665. if (row) {
  5666. this.options.data.splice(this.options.data.indexOf(row), 1);
  5667. }
  5668. if (len === this.options.data.length) {
  5669. return;
  5670. }
  5671. if (this.options.sidePagination === 'server') {
  5672. this.options.totalRows -= 1;
  5673. this.data = _toConsumableArray(this.options.data);
  5674. }
  5675. this.initSearch();
  5676. this.initPagination();
  5677. this.initBody(true);
  5678. }
  5679. }, {
  5680. key: "updateCell",
  5681. value: function updateCell(params) {
  5682. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
  5683. return;
  5684. }
  5685. this.data[params.index][params.field] = params.value;
  5686. if (params.reinit === false) {
  5687. return;
  5688. }
  5689. this.initSort();
  5690. this.initBody(true);
  5691. }
  5692. }, {
  5693. key: "updateCellByUniqueId",
  5694. value: function updateCellByUniqueId(params) {
  5695. var _this19 = this;
  5696. var allParams = Array.isArray(params) ? params : [params];
  5697. allParams.forEach(function (_ref6) {
  5698. var id = _ref6.id,
  5699. field = _ref6.field,
  5700. value = _ref6.value;
  5701. var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
  5702. if (rowId === -1) {
  5703. return;
  5704. }
  5705. _this19.options.data[rowId][field] = value;
  5706. });
  5707. if (params.reinit === false) {
  5708. return;
  5709. }
  5710. this.initSort();
  5711. this.initBody(true);
  5712. }
  5713. }, {
  5714. key: "showRow",
  5715. value: function showRow(params) {
  5716. this._toggleRow(params, true);
  5717. }
  5718. }, {
  5719. key: "hideRow",
  5720. value: function hideRow(params) {
  5721. this._toggleRow(params, false);
  5722. }
  5723. }, {
  5724. key: "_toggleRow",
  5725. value: function _toggleRow(params, visible) {
  5726. var row;
  5727. if (params.hasOwnProperty('index')) {
  5728. row = this.getData()[params.index];
  5729. } else if (params.hasOwnProperty('uniqueId')) {
  5730. row = this.getRowByUniqueId(params.uniqueId);
  5731. }
  5732. if (!row) {
  5733. return;
  5734. }
  5735. var index = Utils.findIndex(this.hiddenRows, row);
  5736. if (!visible && index === -1) {
  5737. this.hiddenRows.push(row);
  5738. } else if (visible && index > -1) {
  5739. this.hiddenRows.splice(index, 1);
  5740. }
  5741. this.initBody(true);
  5742. this.initPagination();
  5743. }
  5744. }, {
  5745. key: "getHiddenRows",
  5746. value: function getHiddenRows(show) {
  5747. if (show) {
  5748. this.initHiddenRows();
  5749. this.initBody(true);
  5750. this.initPagination();
  5751. return;
  5752. }
  5753. var data = this.getData();
  5754. var rows = [];
  5755. var _iterator8 = _createForOfIteratorHelper(data),
  5756. _step8;
  5757. try {
  5758. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  5759. var row = _step8.value;
  5760. if (this.hiddenRows.includes(row)) {
  5761. rows.push(row);
  5762. }
  5763. }
  5764. } catch (err) {
  5765. _iterator8.e(err);
  5766. } finally {
  5767. _iterator8.f();
  5768. }
  5769. this.hiddenRows = rows;
  5770. return rows;
  5771. }
  5772. }, {
  5773. key: "showColumn",
  5774. value: function showColumn(field) {
  5775. var _this20 = this;
  5776. var fields = Array.isArray(field) ? field : [field];
  5777. fields.forEach(function (field) {
  5778. _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
  5779. });
  5780. }
  5781. }, {
  5782. key: "hideColumn",
  5783. value: function hideColumn(field) {
  5784. var _this21 = this;
  5785. var fields = Array.isArray(field) ? field : [field];
  5786. fields.forEach(function (field) {
  5787. _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
  5788. });
  5789. }
  5790. }, {
  5791. key: "_toggleColumn",
  5792. value: function _toggleColumn(index, checked, needUpdate) {
  5793. if (index === -1 || this.columns[index].visible === checked) {
  5794. return;
  5795. }
  5796. this.columns[index].visible = checked;
  5797. this.initHeader();
  5798. this.initSearch();
  5799. this.initPagination();
  5800. this.initBody();
  5801. if (this.options.showColumns) {
  5802. var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
  5803. if (needUpdate) {
  5804. $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
  5805. }
  5806. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  5807. $items.filter(':checked').prop('disabled', true);
  5808. }
  5809. }
  5810. }
  5811. }, {
  5812. key: "getVisibleColumns",
  5813. value: function getVisibleColumns() {
  5814. var _this22 = this;
  5815. return this.columns.filter(function (column) {
  5816. return column.visible && !_this22.isSelectionColumn(column);
  5817. });
  5818. }
  5819. }, {
  5820. key: "getHiddenColumns",
  5821. value: function getHiddenColumns() {
  5822. return this.columns.filter(function (_ref7) {
  5823. var visible = _ref7.visible;
  5824. return !visible;
  5825. });
  5826. }
  5827. }, {
  5828. key: "isSelectionColumn",
  5829. value: function isSelectionColumn(column) {
  5830. return column.radio || column.checkbox;
  5831. }
  5832. }, {
  5833. key: "showAllColumns",
  5834. value: function showAllColumns() {
  5835. this._toggleAllColumns(true);
  5836. }
  5837. }, {
  5838. key: "hideAllColumns",
  5839. value: function hideAllColumns() {
  5840. this._toggleAllColumns(false);
  5841. }
  5842. }, {
  5843. key: "_toggleAllColumns",
  5844. value: function _toggleAllColumns(visible) {
  5845. var _this23 = this;
  5846. var _iterator9 = _createForOfIteratorHelper(this.columns.slice().reverse()),
  5847. _step9;
  5848. try {
  5849. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  5850. var column = _step9.value;
  5851. if (column.switchable) {
  5852. if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) {
  5853. continue;
  5854. }
  5855. column.visible = visible;
  5856. }
  5857. }
  5858. } catch (err) {
  5859. _iterator9.e(err);
  5860. } finally {
  5861. _iterator9.f();
  5862. }
  5863. this.initHeader();
  5864. this.initSearch();
  5865. this.initPagination();
  5866. this.initBody();
  5867. if (this.options.showColumns) {
  5868. var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false);
  5869. if (visible) {
  5870. $items.prop('checked', visible);
  5871. } else {
  5872. $items.get().reverse().forEach(function (item) {
  5873. if ($items.filter(':checked').length > _this23.options.minimumCountColumns) {
  5874. $__default['default'](item).prop('checked', visible);
  5875. }
  5876. });
  5877. }
  5878. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  5879. $items.filter(':checked').prop('disabled', true);
  5880. }
  5881. }
  5882. }
  5883. }, {
  5884. key: "mergeCells",
  5885. value: function mergeCells(options) {
  5886. var row = options.index;
  5887. var col = this.getVisibleFields().indexOf(options.field);
  5888. var rowspan = options.rowspan || 1;
  5889. var colspan = options.colspan || 1;
  5890. var i;
  5891. var j;
  5892. var $tr = this.$body.find('>tr[data-index]');
  5893. col += Utils.getDetailViewIndexOffset(this.options);
  5894. var $td = $tr.eq(row).find('>td').eq(col);
  5895. if (row < 0 || col < 0 || row >= this.data.length) {
  5896. return;
  5897. }
  5898. for (i = row; i < row + rowspan; i++) {
  5899. for (j = col; j < col + colspan; j++) {
  5900. $tr.eq(i).find('>td').eq(j).hide();
  5901. }
  5902. }
  5903. $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
  5904. }
  5905. }, {
  5906. key: "checkAll",
  5907. value: function checkAll() {
  5908. this._toggleCheckAll(true);
  5909. }
  5910. }, {
  5911. key: "uncheckAll",
  5912. value: function uncheckAll() {
  5913. this._toggleCheckAll(false);
  5914. }
  5915. }, {
  5916. key: "_toggleCheckAll",
  5917. value: function _toggleCheckAll(checked) {
  5918. var rowsBefore = this.getSelections();
  5919. this.$selectAll.add(this.$selectAll_).prop('checked', checked);
  5920. this.$selectItem.filter(':enabled').prop('checked', checked);
  5921. this.updateRows();
  5922. this.updateSelected();
  5923. var rowsAfter = this.getSelections();
  5924. if (checked) {
  5925. this.trigger('check-all', rowsAfter, rowsBefore);
  5926. return;
  5927. }
  5928. this.trigger('uncheck-all', rowsAfter, rowsBefore);
  5929. }
  5930. }, {
  5931. key: "checkInvert",
  5932. value: function checkInvert() {
  5933. var $items = this.$selectItem.filter(':enabled');
  5934. var checked = $items.filter(':checked');
  5935. $items.each(function (i, el) {
  5936. $__default['default'](el).prop('checked', !$__default['default'](el).prop('checked'));
  5937. });
  5938. this.updateRows();
  5939. this.updateSelected();
  5940. this.trigger('uncheck-some', checked);
  5941. checked = this.getSelections();
  5942. this.trigger('check-some', checked);
  5943. }
  5944. }, {
  5945. key: "check",
  5946. value: function check(index) {
  5947. this._toggleCheck(true, index);
  5948. }
  5949. }, {
  5950. key: "uncheck",
  5951. value: function uncheck(index) {
  5952. this._toggleCheck(false, index);
  5953. }
  5954. }, {
  5955. key: "_toggleCheck",
  5956. value: function _toggleCheck(checked, index) {
  5957. var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
  5958. var row = this.data[index];
  5959. if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
  5960. var _iterator10 = _createForOfIteratorHelper(this.options.data),
  5961. _step10;
  5962. try {
  5963. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  5964. var r = _step10.value;
  5965. r[this.header.stateField] = false;
  5966. }
  5967. } catch (err) {
  5968. _iterator10.e(err);
  5969. } finally {
  5970. _iterator10.f();
  5971. }
  5972. this.$selectItem.filter(':checked').not($el).prop('checked', false);
  5973. }
  5974. row[this.header.stateField] = checked;
  5975. if (this.options.multipleSelectRow) {
  5976. if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
  5977. var _ref8 = this.multipleSelectRowLastSelectedIndex < index ? [this.multipleSelectRowLastSelectedIndex, index] : [index, this.multipleSelectRowLastSelectedIndex],
  5978. _ref9 = _slicedToArray(_ref8, 2),
  5979. fromIndex = _ref9[0],
  5980. toIndex = _ref9[1];
  5981. for (var i = fromIndex + 1; i < toIndex; i++) {
  5982. this.data[i][this.header.stateField] = true;
  5983. this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
  5984. }
  5985. }
  5986. this.multipleSelectRowCtrlKey = false;
  5987. this.multipleSelectRowShiftKey = false;
  5988. this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
  5989. }
  5990. $el.prop('checked', checked);
  5991. this.updateSelected();
  5992. this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
  5993. }
  5994. }, {
  5995. key: "checkBy",
  5996. value: function checkBy(obj) {
  5997. this._toggleCheckBy(true, obj);
  5998. }
  5999. }, {
  6000. key: "uncheckBy",
  6001. value: function uncheckBy(obj) {
  6002. this._toggleCheckBy(false, obj);
  6003. }
  6004. }, {
  6005. key: "_toggleCheckBy",
  6006. value: function _toggleCheckBy(checked, obj) {
  6007. var _this24 = this;
  6008. if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
  6009. return;
  6010. }
  6011. var rows = [];
  6012. this.data.forEach(function (row, i) {
  6013. if (!row.hasOwnProperty(obj.field)) {
  6014. return false;
  6015. }
  6016. if (obj.values.includes(row[obj.field])) {
  6017. var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
  6018. var onlyCurrentPage = obj.hasOwnProperty('onlyCurrentPage') ? obj.onlyCurrentPage : false;
  6019. $el = checked ? $el.not(':checked') : $el.filter(':checked');
  6020. if (!$el.length && onlyCurrentPage) {
  6021. return;
  6022. }
  6023. $el.prop('checked', checked);
  6024. row[_this24.header.stateField] = checked;
  6025. rows.push(row);
  6026. _this24.trigger(checked ? 'check' : 'uncheck', row, $el);
  6027. }
  6028. });
  6029. this.updateSelected();
  6030. this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
  6031. }
  6032. }, {
  6033. key: "refresh",
  6034. value: function refresh(params) {
  6035. if (params && params.url) {
  6036. this.options.url = params.url;
  6037. }
  6038. if (params && params.pageNumber) {
  6039. this.options.pageNumber = params.pageNumber;
  6040. }
  6041. if (params && params.pageSize) {
  6042. this.options.pageSize = params.pageSize;
  6043. }
  6044. this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
  6045. }
  6046. }, {
  6047. key: "destroy",
  6048. value: function destroy() {
  6049. this.$el.insertBefore(this.$container);
  6050. $__default['default'](this.options.toolbar).insertBefore(this.$el);
  6051. this.$container.next().remove();
  6052. this.$container.remove();
  6053. this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
  6054. }
  6055. }, {
  6056. key: "resetView",
  6057. value: function resetView(params) {
  6058. var padding = 0;
  6059. if (params && params.height) {
  6060. this.options.height = params.height;
  6061. }
  6062. this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
  6063. if (!this.options.cardView && this.options.showHeader && this.options.height) {
  6064. this.$tableHeader.show();
  6065. this.resetHeader();
  6066. padding += this.$header.outerHeight(true) + 1;
  6067. } else {
  6068. this.$tableHeader.hide();
  6069. this.trigger('post-header');
  6070. }
  6071. if (!this.options.cardView && this.options.showFooter) {
  6072. this.$tableFooter.show();
  6073. this.fitFooter();
  6074. if (this.options.height) {
  6075. padding += this.$tableFooter.outerHeight(true);
  6076. }
  6077. }
  6078. if (this.$container.hasClass('fullscreen')) {
  6079. this.$tableContainer.css('height', '');
  6080. this.$tableContainer.css('width', '');
  6081. } else if (this.options.height) {
  6082. if (this.$tableBorder) {
  6083. this.$tableBorder.css('width', '');
  6084. this.$tableBorder.css('height', '');
  6085. }
  6086. var toolbarHeight = this.$toolbar.outerHeight(true);
  6087. var paginationHeight = this.$pagination.outerHeight(true);
  6088. var height = this.options.height - toolbarHeight - paginationHeight;
  6089. var $bodyTable = this.$tableBody.find('>table');
  6090. var tableHeight = $bodyTable.outerHeight();
  6091. this.$tableContainer.css('height', "".concat(height, "px"));
  6092. if (this.$tableBorder && $bodyTable.is(':visible')) {
  6093. var tableBorderHeight = height - tableHeight - 2;
  6094. if (this.$tableBody[0].scrollWidth - this.$tableBody.innerWidth()) {
  6095. tableBorderHeight -= Utils.getScrollBarWidth();
  6096. }
  6097. this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px"));
  6098. this.$tableBorder.css('height', "".concat(tableBorderHeight, "px"));
  6099. }
  6100. }
  6101. if (this.options.cardView) {
  6102. // remove the element css
  6103. this.$el.css('margin-top', '0');
  6104. this.$tableContainer.css('padding-bottom', '0');
  6105. this.$tableFooter.hide();
  6106. } else {
  6107. // Assign the correct sortable arrow
  6108. this.getCaret();
  6109. this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
  6110. }
  6111. this.trigger('reset-view');
  6112. }
  6113. }, {
  6114. key: "showLoading",
  6115. value: function showLoading() {
  6116. this.$tableLoading.toggleClass('open', true);
  6117. var fontSize = this.options.loadingFontSize;
  6118. if (this.options.loadingFontSize === 'auto') {
  6119. fontSize = this.$tableLoading.width() * 0.04;
  6120. fontSize = Math.max(12, fontSize);
  6121. fontSize = Math.min(32, fontSize);
  6122. fontSize = "".concat(fontSize, "px");
  6123. }
  6124. this.$tableLoading.find('.loading-text').css('font-size', fontSize);
  6125. }
  6126. }, {
  6127. key: "hideLoading",
  6128. value: function hideLoading() {
  6129. this.$tableLoading.toggleClass('open', false);
  6130. }
  6131. }, {
  6132. key: "togglePagination",
  6133. value: function togglePagination() {
  6134. this.options.pagination = !this.options.pagination;
  6135. var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
  6136. var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
  6137. this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
  6138. this.updatePagination();
  6139. this.trigger('toggle-pagination', this.options.pagination);
  6140. }
  6141. }, {
  6142. key: "toggleFullscreen",
  6143. value: function toggleFullscreen() {
  6144. this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
  6145. this.resetView();
  6146. }
  6147. }, {
  6148. key: "toggleView",
  6149. value: function toggleView() {
  6150. this.options.cardView = !this.options.cardView;
  6151. this.initHeader();
  6152. var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
  6153. var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
  6154. this.$toolbar.find('button[name="toggle"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
  6155. this.initBody();
  6156. this.trigger('toggle', this.options.cardView);
  6157. }
  6158. }, {
  6159. key: "resetSearch",
  6160. value: function resetSearch(text) {
  6161. var $search = Utils.getSearchInput(this);
  6162. $search.val(text || '');
  6163. this.onSearch({
  6164. currentTarget: $search
  6165. });
  6166. }
  6167. }, {
  6168. key: "filterBy",
  6169. value: function filterBy(columns, options) {
  6170. this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $__default['default'].extend(this.options.filterOptions, options);
  6171. this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
  6172. this.options.pageNumber = 1;
  6173. this.initSearch();
  6174. this.updatePagination();
  6175. }
  6176. }, {
  6177. key: "scrollTo",
  6178. value: function scrollTo(params) {
  6179. var options = {
  6180. unit: 'px',
  6181. value: 0
  6182. };
  6183. if (_typeof(params) === 'object') {
  6184. options = Object.assign(options, params);
  6185. } else if (typeof params === 'string' && params === 'bottom') {
  6186. options.value = this.$tableBody[0].scrollHeight;
  6187. } else if (typeof params === 'string' || typeof params === 'number') {
  6188. options.value = params;
  6189. }
  6190. var scrollTo = options.value;
  6191. if (options.unit === 'rows') {
  6192. scrollTo = 0;
  6193. this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
  6194. scrollTo += $__default['default'](el).outerHeight(true);
  6195. });
  6196. }
  6197. this.$tableBody.scrollTop(scrollTo);
  6198. }
  6199. }, {
  6200. key: "getScrollPosition",
  6201. value: function getScrollPosition() {
  6202. return this.$tableBody.scrollTop();
  6203. }
  6204. }, {
  6205. key: "selectPage",
  6206. value: function selectPage(page) {
  6207. if (page > 0 && page <= this.options.totalPages) {
  6208. this.options.pageNumber = page;
  6209. this.updatePagination();
  6210. }
  6211. }
  6212. }, {
  6213. key: "prevPage",
  6214. value: function prevPage() {
  6215. if (this.options.pageNumber > 1) {
  6216. this.options.pageNumber--;
  6217. this.updatePagination();
  6218. }
  6219. }
  6220. }, {
  6221. key: "nextPage",
  6222. value: function nextPage() {
  6223. if (this.options.pageNumber < this.options.totalPages) {
  6224. this.options.pageNumber++;
  6225. this.updatePagination();
  6226. }
  6227. }
  6228. }, {
  6229. key: "toggleDetailView",
  6230. value: function toggleDetailView(index, _columnDetailFormatter) {
  6231. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
  6232. if ($tr.next().is('tr.detail-view')) {
  6233. this.collapseRow(index);
  6234. } else {
  6235. this.expandRow(index, _columnDetailFormatter);
  6236. }
  6237. this.resetView();
  6238. }
  6239. }, {
  6240. key: "expandRow",
  6241. value: function expandRow(index, _columnDetailFormatter) {
  6242. var row = this.data[index];
  6243. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  6244. if (this.options.detailViewIcon) {
  6245. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
  6246. }
  6247. if ($tr.next().is('tr.detail-view')) {
  6248. return;
  6249. }
  6250. $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
  6251. var $element = $tr.next().find('td');
  6252. var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
  6253. var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
  6254. if ($element.length === 1) {
  6255. $element.append(content);
  6256. }
  6257. this.trigger('expand-row', index, row, $element);
  6258. }
  6259. }, {
  6260. key: "expandRowByUniqueId",
  6261. value: function expandRowByUniqueId(uniqueId) {
  6262. var row = this.getRowByUniqueId(uniqueId);
  6263. if (!row) {
  6264. return;
  6265. }
  6266. this.expandRow(this.data.indexOf(row));
  6267. }
  6268. }, {
  6269. key: "collapseRow",
  6270. value: function collapseRow(index) {
  6271. var row = this.data[index];
  6272. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  6273. if (!$tr.next().is('tr.detail-view')) {
  6274. return;
  6275. }
  6276. if (this.options.detailViewIcon) {
  6277. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
  6278. }
  6279. this.trigger('collapse-row', index, row, $tr.next());
  6280. $tr.next().remove();
  6281. }
  6282. }, {
  6283. key: "collapseRowByUniqueId",
  6284. value: function collapseRowByUniqueId(uniqueId) {
  6285. var row = this.getRowByUniqueId(uniqueId);
  6286. if (!row) {
  6287. return;
  6288. }
  6289. this.collapseRow(this.data.indexOf(row));
  6290. }
  6291. }, {
  6292. key: "expandAllRows",
  6293. value: function expandAllRows() {
  6294. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  6295. for (var i = 0; i < trs.length; i++) {
  6296. this.expandRow($__default['default'](trs[i]).data('index'));
  6297. }
  6298. }
  6299. }, {
  6300. key: "collapseAllRows",
  6301. value: function collapseAllRows() {
  6302. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  6303. for (var i = 0; i < trs.length; i++) {
  6304. this.collapseRow($__default['default'](trs[i]).data('index'));
  6305. }
  6306. }
  6307. }, {
  6308. key: "updateColumnTitle",
  6309. value: function updateColumnTitle(params) {
  6310. if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
  6311. return;
  6312. }
  6313. this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
  6314. if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
  6315. this.$header.find('th[data-field]').each(function (i, el) {
  6316. if ($__default['default'](el).data('field') === params.field) {
  6317. $__default['default']($__default['default'](el).find('.th-inner')[0]).text(params.title);
  6318. return false;
  6319. }
  6320. });
  6321. this.resetView();
  6322. }
  6323. }
  6324. }, {
  6325. key: "updateFormatText",
  6326. value: function updateFormatText(formatName, text) {
  6327. if (!/^format/.test(formatName) || !this.options[formatName]) {
  6328. return;
  6329. }
  6330. if (typeof text === 'string') {
  6331. this.options[formatName] = function () {
  6332. return text;
  6333. };
  6334. } else if (typeof text === 'function') {
  6335. this.options[formatName] = text;
  6336. }
  6337. this.initToolbar();
  6338. this.initPagination();
  6339. this.initBody();
  6340. }
  6341. }]);
  6342. return BootstrapTable;
  6343. }();
  6344. BootstrapTable.VERSION = Constants.VERSION;
  6345. BootstrapTable.DEFAULTS = Constants.DEFAULTS;
  6346. BootstrapTable.LOCALES = Constants.LOCALES;
  6347. BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
  6348. BootstrapTable.METHODS = Constants.METHODS;
  6349. BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
  6350. // =======================
  6351. $__default['default'].BootstrapTable = BootstrapTable;
  6352. $__default['default'].fn.bootstrapTable = function (option) {
  6353. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) {
  6354. args[_key5 - 1] = arguments[_key5];
  6355. }
  6356. var value;
  6357. this.each(function (i, el) {
  6358. var data = $__default['default'](el).data('bootstrap.table');
  6359. var options = $__default['default'].extend({}, BootstrapTable.DEFAULTS, $__default['default'](el).data(), _typeof(option) === 'object' && option);
  6360. if (typeof option === 'string') {
  6361. var _data2;
  6362. if (!Constants.METHODS.includes(option)) {
  6363. throw new Error("Unknown method: ".concat(option));
  6364. }
  6365. if (!data) {
  6366. return;
  6367. }
  6368. value = (_data2 = data)[option].apply(_data2, args);
  6369. if (option === 'destroy') {
  6370. $__default['default'](el).removeData('bootstrap.table');
  6371. }
  6372. }
  6373. if (!data) {
  6374. data = new $__default['default'].BootstrapTable(el, options);
  6375. $__default['default'](el).data('bootstrap.table', data);
  6376. data.init();
  6377. }
  6378. });
  6379. return typeof value === 'undefined' ? this : value;
  6380. };
  6381. $__default['default'].fn.bootstrapTable.Constructor = BootstrapTable;
  6382. $__default['default'].fn.bootstrapTable.theme = Constants.THEME;
  6383. $__default['default'].fn.bootstrapTable.VERSION = Constants.VERSION;
  6384. $__default['default'].fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
  6385. $__default['default'].fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
  6386. $__default['default'].fn.bootstrapTable.events = BootstrapTable.EVENTS;
  6387. $__default['default'].fn.bootstrapTable.locales = BootstrapTable.LOCALES;
  6388. $__default['default'].fn.bootstrapTable.methods = BootstrapTable.METHODS;
  6389. $__default['default'].fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
  6390. // =======================
  6391. $__default['default'](function () {
  6392. $__default['default']('[data-toggle="table"]').bootstrapTable();
  6393. });
  6394. return BootstrapTable;
  6395. })));