bootstrap-table.js 247 KB

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