bootstrap-table.js 235 KB

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