bootstrap-table.js 236 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959
  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.5';
  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. inputPrefix: 'input-',
  2306. input: 'form-control',
  2307. paginationDropdown: 'btn-group dropdown',
  2308. dropup: 'dropup',
  2309. dropdownActive: 'active',
  2310. paginationActive: 'active',
  2311. buttonActive: 'active'
  2312. },
  2313. html: {
  2314. toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  2315. toolbarDropdownItem: '<li role="menuitem"><label>%s</label></li>',
  2316. toolbarDropdownSeparator: '<li class="divider"></li>',
  2317. pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  2318. pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
  2319. dropdownCaret: '<span class="caret"></span>',
  2320. pagination: ['<ul class="pagination%s">', '</ul>'],
  2321. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  2322. icon: '<i class="%s %s"></i>',
  2323. inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
  2324. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  2325. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  2326. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  2327. }
  2328. },
  2329. 4: {
  2330. iconsPrefix: 'fa',
  2331. icons: {
  2332. paginationSwitchDown: 'fa-caret-square-down',
  2333. paginationSwitchUp: 'fa-caret-square-up',
  2334. refresh: 'fa-sync',
  2335. toggleOff: 'fa-toggle-off',
  2336. toggleOn: 'fa-toggle-on',
  2337. columns: 'fa-th-list',
  2338. detailOpen: 'fa-plus',
  2339. detailClose: 'fa-minus',
  2340. fullscreen: 'fa-arrows-alt',
  2341. search: 'fa-search',
  2342. clearSearch: 'fa-trash'
  2343. },
  2344. classes: {
  2345. buttonsPrefix: 'btn',
  2346. buttons: 'secondary',
  2347. buttonsGroup: 'btn-group',
  2348. buttonsDropdown: 'btn-group',
  2349. pull: 'float',
  2350. inputGroup: 'btn-group',
  2351. inputPrefix: 'form-control-',
  2352. input: 'form-control',
  2353. paginationDropdown: 'btn-group dropdown',
  2354. dropup: 'dropup',
  2355. dropdownActive: 'active',
  2356. paginationActive: 'active',
  2357. buttonActive: 'active'
  2358. },
  2359. html: {
  2360. toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  2361. toolbarDropdownItem: '<label class="dropdown-item">%s</label>',
  2362. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  2363. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  2364. toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
  2365. dropdownCaret: '<span class="caret"></span>',
  2366. pagination: ['<ul class="pagination%s">', '</ul>'],
  2367. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  2368. icon: '<i class="%s %s"></i>',
  2369. inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
  2370. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  2371. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  2372. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  2373. }
  2374. }
  2375. }[bootstrapVersion];
  2376. var DEFAULTS = {
  2377. height: undefined,
  2378. classes: 'table table-bordered table-hover',
  2379. theadClasses: '',
  2380. rowStyle: function rowStyle(row, index) {
  2381. return {};
  2382. },
  2383. rowAttributes: function rowAttributes(row, index) {
  2384. return {};
  2385. },
  2386. undefinedText: '-',
  2387. locale: undefined,
  2388. virtualScroll: false,
  2389. virtualScrollItemHeight: undefined,
  2390. sortable: true,
  2391. sortClass: undefined,
  2392. silentSort: true,
  2393. sortName: undefined,
  2394. sortOrder: 'asc',
  2395. sortStable: false,
  2396. rememberOrder: false,
  2397. customSort: undefined,
  2398. columns: [[]],
  2399. data: [],
  2400. url: undefined,
  2401. method: 'get',
  2402. cache: true,
  2403. contentType: 'application/json',
  2404. dataType: 'json',
  2405. ajax: undefined,
  2406. ajaxOptions: {},
  2407. queryParams: function queryParams(params) {
  2408. return params;
  2409. },
  2410. queryParamsType: 'limit',
  2411. // 'limit', undefined
  2412. responseHandler: function responseHandler(res) {
  2413. return res;
  2414. },
  2415. totalField: 'total',
  2416. totalNotFilteredField: 'totalNotFiltered',
  2417. dataField: 'rows',
  2418. pagination: false,
  2419. onlyInfoPagination: false,
  2420. showExtendedPagination: false,
  2421. paginationLoop: true,
  2422. sidePagination: 'client',
  2423. // client or server
  2424. totalRows: 0,
  2425. totalNotFiltered: 0,
  2426. pageNumber: 1,
  2427. pageSize: 10,
  2428. pageList: [10, 25, 50, 100],
  2429. paginationHAlign: 'right',
  2430. // right, left
  2431. paginationVAlign: 'bottom',
  2432. // bottom, top, both
  2433. paginationDetailHAlign: 'left',
  2434. // right, left
  2435. paginationPreText: '&lsaquo;',
  2436. paginationNextText: '&rsaquo;',
  2437. paginationSuccessivelySize: 5,
  2438. // Maximum successively number of pages in a row
  2439. paginationPagesBySide: 1,
  2440. // Number of pages on each side (right, left) of the current page.
  2441. paginationUseIntermediate: false,
  2442. // Calculate intermediate pages for quick access
  2443. search: false,
  2444. searchOnEnterKey: false,
  2445. strictSearch: false,
  2446. visibleSearch: false,
  2447. showButtonIcons: true,
  2448. showButtonText: false,
  2449. showSearchButton: false,
  2450. showSearchClearButton: false,
  2451. trimOnSearch: true,
  2452. searchAlign: 'right',
  2453. searchTimeOut: 500,
  2454. searchText: '',
  2455. customSearch: undefined,
  2456. showHeader: true,
  2457. showFooter: false,
  2458. footerStyle: function footerStyle(row, index) {
  2459. return {};
  2460. },
  2461. showColumns: false,
  2462. showColumnsToggleAll: false,
  2463. minimumCountColumns: 1,
  2464. showPaginationSwitch: false,
  2465. showRefresh: false,
  2466. showToggle: false,
  2467. showFullscreen: false,
  2468. smartDisplay: true,
  2469. escape: false,
  2470. filterOptions: {
  2471. filterAlgorithm: 'and'
  2472. },
  2473. idField: undefined,
  2474. selectItemName: 'btSelectItem',
  2475. clickToSelect: false,
  2476. ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
  2477. var tagName = _ref.tagName;
  2478. return ['A', 'BUTTON'].includes(tagName);
  2479. },
  2480. singleSelect: false,
  2481. checkboxHeader: true,
  2482. maintainMetaData: false,
  2483. multipleSelectRow: false,
  2484. uniqueId: undefined,
  2485. cardView: false,
  2486. detailView: false,
  2487. detailViewIcon: true,
  2488. detailViewByClick: false,
  2489. detailFormatter: function detailFormatter(index, row) {
  2490. return '';
  2491. },
  2492. detailFilter: function detailFilter(index, row) {
  2493. return true;
  2494. },
  2495. toolbar: undefined,
  2496. toolbarAlign: 'left',
  2497. buttonsToolbar: undefined,
  2498. buttonsAlign: 'right',
  2499. buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
  2500. buttonsClass: CONSTANTS.classes.buttons,
  2501. icons: CONSTANTS.icons,
  2502. html: CONSTANTS.html,
  2503. iconSize: undefined,
  2504. iconsPrefix: CONSTANTS.iconsPrefix,
  2505. // glyphicon or fa(font-awesome)
  2506. onAll: function onAll(name, args) {
  2507. return false;
  2508. },
  2509. onClickCell: function onClickCell(field, value, row, $element) {
  2510. return false;
  2511. },
  2512. onDblClickCell: function onDblClickCell(field, value, row, $element) {
  2513. return false;
  2514. },
  2515. onClickRow: function onClickRow(item, $element) {
  2516. return false;
  2517. },
  2518. onDblClickRow: function onDblClickRow(item, $element) {
  2519. return false;
  2520. },
  2521. onSort: function onSort(name, order) {
  2522. return false;
  2523. },
  2524. onCheck: function onCheck(row) {
  2525. return false;
  2526. },
  2527. onUncheck: function onUncheck(row) {
  2528. return false;
  2529. },
  2530. onCheckAll: function onCheckAll(rows) {
  2531. return false;
  2532. },
  2533. onUncheckAll: function onUncheckAll(rows) {
  2534. return false;
  2535. },
  2536. onCheckSome: function onCheckSome(rows) {
  2537. return false;
  2538. },
  2539. onUncheckSome: function onUncheckSome(rows) {
  2540. return false;
  2541. },
  2542. onLoadSuccess: function onLoadSuccess(data) {
  2543. return false;
  2544. },
  2545. onLoadError: function onLoadError(status) {
  2546. return false;
  2547. },
  2548. onColumnSwitch: function onColumnSwitch(field, checked) {
  2549. return false;
  2550. },
  2551. onPageChange: function onPageChange(number, size) {
  2552. return false;
  2553. },
  2554. onSearch: function onSearch(text) {
  2555. return false;
  2556. },
  2557. onToggle: function onToggle(cardView) {
  2558. return false;
  2559. },
  2560. onPreBody: function onPreBody(data) {
  2561. return false;
  2562. },
  2563. onPostBody: function onPostBody() {
  2564. return false;
  2565. },
  2566. onPostHeader: function onPostHeader() {
  2567. return false;
  2568. },
  2569. onPostFooter: function onPostFooter() {
  2570. return false;
  2571. },
  2572. onExpandRow: function onExpandRow(index, row, $detail) {
  2573. return false;
  2574. },
  2575. onCollapseRow: function onCollapseRow(index, row) {
  2576. return false;
  2577. },
  2578. onRefreshOptions: function onRefreshOptions(options) {
  2579. return false;
  2580. },
  2581. onRefresh: function onRefresh(params) {
  2582. return false;
  2583. },
  2584. onResetView: function onResetView() {
  2585. return false;
  2586. },
  2587. onScrollBody: function onScrollBody() {
  2588. return false;
  2589. }
  2590. };
  2591. var EN = {
  2592. formatLoadingMessage: function formatLoadingMessage() {
  2593. return 'Loading, please wait';
  2594. },
  2595. formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
  2596. return "".concat(pageNumber, " rows per page");
  2597. },
  2598. formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
  2599. if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
  2600. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
  2601. }
  2602. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
  2603. },
  2604. formatSRPaginationPreText: function formatSRPaginationPreText() {
  2605. return 'previous page';
  2606. },
  2607. formatSRPaginationPageText: function formatSRPaginationPageText(page) {
  2608. return "to page ".concat(page);
  2609. },
  2610. formatSRPaginationNextText: function formatSRPaginationNextText() {
  2611. return 'next page';
  2612. },
  2613. formatDetailPagination: function formatDetailPagination(totalRows) {
  2614. return "Showing ".concat(totalRows, " rows");
  2615. },
  2616. formatSearch: function formatSearch() {
  2617. return 'Search';
  2618. },
  2619. formatClearSearch: function formatClearSearch() {
  2620. return 'Clear Search';
  2621. },
  2622. formatNoMatches: function formatNoMatches() {
  2623. return 'No matching records found';
  2624. },
  2625. formatPaginationSwitch: function formatPaginationSwitch() {
  2626. return 'Hide/Show pagination';
  2627. },
  2628. formatPaginationSwitchDown: function formatPaginationSwitchDown() {
  2629. return 'Show pagination';
  2630. },
  2631. formatPaginationSwitchUp: function formatPaginationSwitchUp() {
  2632. return 'Hide pagination';
  2633. },
  2634. formatRefresh: function formatRefresh() {
  2635. return 'Refresh';
  2636. },
  2637. formatToggle: function formatToggle() {
  2638. return 'Toggle';
  2639. },
  2640. formatToggleOn: function formatToggleOn() {
  2641. return 'Show card view';
  2642. },
  2643. formatToggleOff: function formatToggleOff() {
  2644. return 'Hide card view';
  2645. },
  2646. formatColumns: function formatColumns() {
  2647. return 'Columns';
  2648. },
  2649. formatColumnsToggleAll: function formatColumnsToggleAll() {
  2650. return 'Toggle all';
  2651. },
  2652. formatFullscreen: function formatFullscreen() {
  2653. return 'Fullscreen';
  2654. },
  2655. formatAllRows: function formatAllRows() {
  2656. return 'All';
  2657. }
  2658. };
  2659. var COLUMN_DEFAULTS = {
  2660. field: undefined,
  2661. title: undefined,
  2662. titleTooltip: undefined,
  2663. 'class': undefined,
  2664. width: undefined,
  2665. widthUnit: 'px',
  2666. rowspan: undefined,
  2667. colspan: undefined,
  2668. align: undefined,
  2669. // left, right, center
  2670. halign: undefined,
  2671. // left, right, center
  2672. falign: undefined,
  2673. // left, right, center
  2674. valign: undefined,
  2675. // top, middle, bottom
  2676. cellStyle: undefined,
  2677. radio: false,
  2678. checkbox: false,
  2679. checkboxEnabled: true,
  2680. clickToSelect: true,
  2681. showSelectTitle: false,
  2682. sortable: false,
  2683. sortName: undefined,
  2684. order: 'asc',
  2685. // asc, desc
  2686. sorter: undefined,
  2687. visible: true,
  2688. switchable: true,
  2689. cardVisible: true,
  2690. searchable: true,
  2691. formatter: undefined,
  2692. footerFormatter: undefined,
  2693. detailFormatter: undefined,
  2694. searchFormatter: true,
  2695. escape: false,
  2696. events: undefined
  2697. };
  2698. 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'];
  2699. var EVENTS = {
  2700. 'all.bs.table': 'onAll',
  2701. 'click-row.bs.table': 'onClickRow',
  2702. 'dbl-click-row.bs.table': 'onDblClickRow',
  2703. 'click-cell.bs.table': 'onClickCell',
  2704. 'dbl-click-cell.bs.table': 'onDblClickCell',
  2705. 'sort.bs.table': 'onSort',
  2706. 'check.bs.table': 'onCheck',
  2707. 'uncheck.bs.table': 'onUncheck',
  2708. 'check-all.bs.table': 'onCheckAll',
  2709. 'uncheck-all.bs.table': 'onUncheckAll',
  2710. 'check-some.bs.table': 'onCheckSome',
  2711. 'uncheck-some.bs.table': 'onUncheckSome',
  2712. 'load-success.bs.table': 'onLoadSuccess',
  2713. 'load-error.bs.table': 'onLoadError',
  2714. 'column-switch.bs.table': 'onColumnSwitch',
  2715. 'page-change.bs.table': 'onPageChange',
  2716. 'search.bs.table': 'onSearch',
  2717. 'toggle.bs.table': 'onToggle',
  2718. 'pre-body.bs.table': 'onPreBody',
  2719. 'post-body.bs.table': 'onPostBody',
  2720. 'post-header.bs.table': 'onPostHeader',
  2721. 'post-footer.bs.table': 'onPostFooter',
  2722. 'expand-row.bs.table': 'onExpandRow',
  2723. 'collapse-row.bs.table': 'onCollapseRow',
  2724. 'refresh-options.bs.table': 'onRefreshOptions',
  2725. 'reset-view.bs.table': 'onResetView',
  2726. 'refresh.bs.table': 'onRefresh',
  2727. 'scroll-body.bs.table': 'onScrollBody'
  2728. };
  2729. Object.assign(DEFAULTS, EN);
  2730. var Constants = {
  2731. VERSION: VERSION,
  2732. THEME: "bootstrap".concat(bootstrapVersion),
  2733. CONSTANTS: CONSTANTS,
  2734. DEFAULTS: DEFAULTS,
  2735. COLUMN_DEFAULTS: COLUMN_DEFAULTS,
  2736. METHODS: METHODS,
  2737. EVENTS: EVENTS,
  2738. LOCALES: {
  2739. en: EN,
  2740. 'en-US': EN
  2741. }
  2742. };
  2743. // `FlattenIntoArray` abstract operation
  2744. // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
  2745. var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
  2746. var targetIndex = start;
  2747. var sourceIndex = 0;
  2748. var mapFn = mapper ? bindContext(mapper, thisArg, 3) : false;
  2749. var element;
  2750. while (sourceIndex < sourceLen) {
  2751. if (sourceIndex in source) {
  2752. element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
  2753. if (depth > 0 && isArray(element)) {
  2754. targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
  2755. } else {
  2756. if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
  2757. target[targetIndex] = element;
  2758. }
  2759. targetIndex++;
  2760. }
  2761. sourceIndex++;
  2762. }
  2763. return targetIndex;
  2764. };
  2765. var flattenIntoArray_1 = flattenIntoArray;
  2766. // `Array.prototype.flat` method
  2767. // https://github.com/tc39/proposal-flatMap
  2768. _export({ target: 'Array', proto: true }, {
  2769. flat: function flat(/* depthArg = 1 */) {
  2770. var depthArg = arguments.length ? arguments[0] : undefined;
  2771. var O = toObject(this);
  2772. var sourceLen = toLength(O.length);
  2773. var A = arraySpeciesCreate(O, 0);
  2774. A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
  2775. return A;
  2776. }
  2777. });
  2778. // this method was added to unscopables after implementation
  2779. // in popular engines, so it's moved to a separate module
  2780. addToUnscopables('flat');
  2781. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  2782. // `Object.keys` method
  2783. // https://tc39.github.io/ecma262/#sec-object.keys
  2784. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  2785. keys: function keys(it) {
  2786. return objectKeys(toObject(it));
  2787. }
  2788. });
  2789. var Utils = {
  2790. // it only does '%s', and return '' when arguments are undefined
  2791. sprintf: function sprintf(_str) {
  2792. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  2793. args[_key - 1] = arguments[_key];
  2794. }
  2795. var flag = true;
  2796. var i = 0;
  2797. var str = _str.replace(/%s/g, function () {
  2798. var arg = args[i++];
  2799. if (typeof arg === 'undefined') {
  2800. flag = false;
  2801. return '';
  2802. }
  2803. return arg;
  2804. });
  2805. return flag ? str : '';
  2806. },
  2807. isEmptyObject: function isEmptyObject() {
  2808. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2809. return Object.entries(obj).length === 0 && obj.constructor === Object;
  2810. },
  2811. isNumeric: function isNumeric(n) {
  2812. return !isNaN(parseFloat(n)) && isFinite(n);
  2813. },
  2814. getFieldTitle: function getFieldTitle(list, value) {
  2815. var _iteratorNormalCompletion = true;
  2816. var _didIteratorError = false;
  2817. var _iteratorError = undefined;
  2818. try {
  2819. for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2820. var item = _step.value;
  2821. if (item.field === value) {
  2822. return item.title;
  2823. }
  2824. }
  2825. } catch (err) {
  2826. _didIteratorError = true;
  2827. _iteratorError = err;
  2828. } finally {
  2829. try {
  2830. if (!_iteratorNormalCompletion && _iterator.return != null) {
  2831. _iterator.return();
  2832. }
  2833. } finally {
  2834. if (_didIteratorError) {
  2835. throw _iteratorError;
  2836. }
  2837. }
  2838. }
  2839. return '';
  2840. },
  2841. setFieldIndex: function setFieldIndex(columns) {
  2842. var totalCol = 0;
  2843. var flag = [];
  2844. var _iteratorNormalCompletion2 = true;
  2845. var _didIteratorError2 = false;
  2846. var _iteratorError2 = undefined;
  2847. try {
  2848. for (var _iterator2 = columns[0][Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  2849. var column = _step2.value;
  2850. totalCol += column.colspan || 1;
  2851. }
  2852. } catch (err) {
  2853. _didIteratorError2 = true;
  2854. _iteratorError2 = err;
  2855. } finally {
  2856. try {
  2857. if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
  2858. _iterator2.return();
  2859. }
  2860. } finally {
  2861. if (_didIteratorError2) {
  2862. throw _iteratorError2;
  2863. }
  2864. }
  2865. }
  2866. for (var i = 0; i < columns.length; i++) {
  2867. flag[i] = [];
  2868. for (var j = 0; j < totalCol; j++) {
  2869. flag[i][j] = false;
  2870. }
  2871. }
  2872. for (var _i = 0; _i < columns.length; _i++) {
  2873. var _iteratorNormalCompletion3 = true;
  2874. var _didIteratorError3 = false;
  2875. var _iteratorError3 = undefined;
  2876. try {
  2877. for (var _iterator3 = columns[_i][Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
  2878. var r = _step3.value;
  2879. var rowspan = r.rowspan || 1;
  2880. var colspan = r.colspan || 1;
  2881. var index = flag[_i].indexOf(false);
  2882. r.colspanIndex = index;
  2883. if (colspan === 1) {
  2884. r.fieldIndex = index; // when field is undefined, use index instead
  2885. if (typeof r.field === 'undefined') {
  2886. r.field = index;
  2887. }
  2888. } else {
  2889. r.colspanGroup = r.colspan;
  2890. }
  2891. for (var k = 0; k < rowspan; k++) {
  2892. flag[_i + k][index] = true;
  2893. }
  2894. for (var _k = 0; _k < colspan; _k++) {
  2895. flag[_i][index + _k] = true;
  2896. }
  2897. }
  2898. } catch (err) {
  2899. _didIteratorError3 = true;
  2900. _iteratorError3 = err;
  2901. } finally {
  2902. try {
  2903. if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
  2904. _iterator3.return();
  2905. }
  2906. } finally {
  2907. if (_didIteratorError3) {
  2908. throw _iteratorError3;
  2909. }
  2910. }
  2911. }
  2912. }
  2913. },
  2914. updateFieldGroup: function updateFieldGroup(columns) {
  2915. var allColumns = columns.flat();
  2916. var _iteratorNormalCompletion4 = true;
  2917. var _didIteratorError4 = false;
  2918. var _iteratorError4 = undefined;
  2919. try {
  2920. for (var _iterator4 = columns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
  2921. var c = _step4.value;
  2922. var _iteratorNormalCompletion5 = true;
  2923. var _didIteratorError5 = false;
  2924. var _iteratorError5 = undefined;
  2925. try {
  2926. for (var _iterator5 = c[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
  2927. var r = _step5.value;
  2928. if (r.colspanGroup > 1) {
  2929. var colspan = 0;
  2930. var _loop = function _loop(i) {
  2931. var column = allColumns.find(function (col) {
  2932. return col.fieldIndex === i;
  2933. });
  2934. if (column.visible) {
  2935. colspan++;
  2936. }
  2937. };
  2938. for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
  2939. _loop(i);
  2940. }
  2941. r.colspan = colspan;
  2942. r.visible = colspan > 0;
  2943. }
  2944. }
  2945. } catch (err) {
  2946. _didIteratorError5 = true;
  2947. _iteratorError5 = err;
  2948. } finally {
  2949. try {
  2950. if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
  2951. _iterator5.return();
  2952. }
  2953. } finally {
  2954. if (_didIteratorError5) {
  2955. throw _iteratorError5;
  2956. }
  2957. }
  2958. }
  2959. }
  2960. } catch (err) {
  2961. _didIteratorError4 = true;
  2962. _iteratorError4 = err;
  2963. } finally {
  2964. try {
  2965. if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
  2966. _iterator4.return();
  2967. }
  2968. } finally {
  2969. if (_didIteratorError4) {
  2970. throw _iteratorError4;
  2971. }
  2972. }
  2973. }
  2974. },
  2975. getScrollBarWidth: function getScrollBarWidth() {
  2976. if (this.cachedWidth === undefined) {
  2977. var $inner = $('<div/>').addClass('fixed-table-scroll-inner');
  2978. var $outer = $('<div/>').addClass('fixed-table-scroll-outer');
  2979. $outer.append($inner);
  2980. $('body').append($outer);
  2981. var w1 = $inner[0].offsetWidth;
  2982. $outer.css('overflow', 'scroll');
  2983. var w2 = $inner[0].offsetWidth;
  2984. if (w1 === w2) {
  2985. w2 = $outer[0].clientWidth;
  2986. }
  2987. $outer.remove();
  2988. this.cachedWidth = w1 - w2;
  2989. }
  2990. return this.cachedWidth;
  2991. },
  2992. calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
  2993. var func = name;
  2994. if (typeof name === 'string') {
  2995. // support obj.func1.func2
  2996. var names = name.split('.');
  2997. if (names.length > 1) {
  2998. func = window;
  2999. var _iteratorNormalCompletion6 = true;
  3000. var _didIteratorError6 = false;
  3001. var _iteratorError6 = undefined;
  3002. try {
  3003. for (var _iterator6 = names[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
  3004. var f = _step6.value;
  3005. func = func[f];
  3006. }
  3007. } catch (err) {
  3008. _didIteratorError6 = true;
  3009. _iteratorError6 = err;
  3010. } finally {
  3011. try {
  3012. if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
  3013. _iterator6.return();
  3014. }
  3015. } finally {
  3016. if (_didIteratorError6) {
  3017. throw _iteratorError6;
  3018. }
  3019. }
  3020. }
  3021. } else {
  3022. func = window[name];
  3023. }
  3024. }
  3025. if (func !== null && _typeof(func) === 'object') {
  3026. return func;
  3027. }
  3028. if (typeof func === 'function') {
  3029. return func.apply(self, args || []);
  3030. }
  3031. if (!func && typeof name === 'string' && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
  3032. return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
  3033. }
  3034. return defaultValue;
  3035. },
  3036. compareObjects: function compareObjects(objectA, objectB, compareLength) {
  3037. var aKeys = Object.keys(objectA);
  3038. var bKeys = Object.keys(objectB);
  3039. if (compareLength && aKeys.length !== bKeys.length) {
  3040. return false;
  3041. }
  3042. for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
  3043. var key = _aKeys[_i2];
  3044. if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
  3045. return false;
  3046. }
  3047. }
  3048. return true;
  3049. },
  3050. escapeHTML: function escapeHTML(text) {
  3051. if (typeof text === 'string') {
  3052. return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/`/g, '&#x60;');
  3053. }
  3054. return text;
  3055. },
  3056. getRealDataAttr: function getRealDataAttr(dataAttr) {
  3057. for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
  3058. var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
  3059. attr = _Object$entries$_i[0],
  3060. value = _Object$entries$_i[1];
  3061. var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
  3062. if (auxAttr !== attr) {
  3063. dataAttr[auxAttr] = value;
  3064. delete dataAttr[attr];
  3065. }
  3066. }
  3067. return dataAttr;
  3068. },
  3069. getItemField: function getItemField(item, field, escape) {
  3070. var value = item;
  3071. if (typeof field !== 'string' || item.hasOwnProperty(field)) {
  3072. return escape ? this.escapeHTML(item[field]) : item[field];
  3073. }
  3074. var props = field.split('.');
  3075. var _iteratorNormalCompletion7 = true;
  3076. var _didIteratorError7 = false;
  3077. var _iteratorError7 = undefined;
  3078. try {
  3079. for (var _iterator7 = props[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
  3080. var p = _step7.value;
  3081. value = value && value[p];
  3082. }
  3083. } catch (err) {
  3084. _didIteratorError7 = true;
  3085. _iteratorError7 = err;
  3086. } finally {
  3087. try {
  3088. if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
  3089. _iterator7.return();
  3090. }
  3091. } finally {
  3092. if (_didIteratorError7) {
  3093. throw _iteratorError7;
  3094. }
  3095. }
  3096. }
  3097. return escape ? this.escapeHTML(value) : value;
  3098. },
  3099. isIEBrowser: function isIEBrowser() {
  3100. return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
  3101. },
  3102. findIndex: function findIndex(items, item) {
  3103. var _iteratorNormalCompletion8 = true;
  3104. var _didIteratorError8 = false;
  3105. var _iteratorError8 = undefined;
  3106. try {
  3107. for (var _iterator8 = items[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
  3108. var it = _step8.value;
  3109. if (JSON.stringify(it) === JSON.stringify(item)) {
  3110. return items.indexOf(it);
  3111. }
  3112. }
  3113. } catch (err) {
  3114. _didIteratorError8 = true;
  3115. _iteratorError8 = err;
  3116. } finally {
  3117. try {
  3118. if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
  3119. _iterator8.return();
  3120. }
  3121. } finally {
  3122. if (_didIteratorError8) {
  3123. throw _iteratorError8;
  3124. }
  3125. }
  3126. }
  3127. return -1;
  3128. },
  3129. trToData: function trToData(columns, $els) {
  3130. var _this = this;
  3131. var data = [];
  3132. var m = [];
  3133. $els.each(function (y, el) {
  3134. var row = {}; // save tr's id, class and data-* attributes
  3135. row._id = $(el).attr('id');
  3136. row._class = $(el).attr('class');
  3137. row._data = _this.getRealDataAttr($(el).data());
  3138. $(el).find('>td,>th').each(function (_x, el) {
  3139. var cspan = +$(el).attr('colspan') || 1;
  3140. var rspan = +$(el).attr('rowspan') || 1;
  3141. var x = _x; // skip already occupied cells in current row
  3142. for (; m[y] && m[y][x]; x++) {} // ignore
  3143. // mark matrix elements occupied by current cell with true
  3144. for (var tx = x; tx < x + cspan; tx++) {
  3145. for (var ty = y; ty < y + rspan; ty++) {
  3146. if (!m[ty]) {
  3147. // fill missing rows
  3148. m[ty] = [];
  3149. }
  3150. m[ty][tx] = true;
  3151. }
  3152. }
  3153. var field = columns[x].field;
  3154. row[field] = $(el).html().trim(); // save td's id, class and data-* attributes
  3155. row["_".concat(field, "_id")] = $(el).attr('id');
  3156. row["_".concat(field, "_class")] = $(el).attr('class');
  3157. row["_".concat(field, "_rowspan")] = $(el).attr('rowspan');
  3158. row["_".concat(field, "_colspan")] = $(el).attr('colspan');
  3159. row["_".concat(field, "_title")] = $(el).attr('title');
  3160. row["_".concat(field, "_data")] = _this.getRealDataAttr($(el).data());
  3161. });
  3162. data.push(row);
  3163. });
  3164. return data;
  3165. },
  3166. sort: function sort(a, b, order, sortStable) {
  3167. if (a === undefined || a === null) {
  3168. a = '';
  3169. }
  3170. if (b === undefined || b === null) {
  3171. b = '';
  3172. }
  3173. if (sortStable && a === b) {
  3174. a = a._position;
  3175. b = b._position;
  3176. } // If both values are numeric, do a numeric comparison
  3177. if (this.isNumeric(a) && this.isNumeric(b)) {
  3178. // Convert numerical values form string to float.
  3179. a = parseFloat(a);
  3180. b = parseFloat(b);
  3181. if (a < b) {
  3182. return order * -1;
  3183. }
  3184. if (a > b) {
  3185. return order;
  3186. }
  3187. return 0;
  3188. }
  3189. if (a === b) {
  3190. return 0;
  3191. } // If value is not a string, convert to string
  3192. if (typeof a !== 'string') {
  3193. a = a.toString();
  3194. }
  3195. if (a.localeCompare(b) === -1) {
  3196. return order * -1;
  3197. }
  3198. return order;
  3199. }
  3200. };
  3201. var BLOCK_ROWS = 50;
  3202. var CLUSTER_BLOCKS = 4;
  3203. var VirtualScroll =
  3204. /*#__PURE__*/
  3205. function () {
  3206. function VirtualScroll(options) {
  3207. var _this = this;
  3208. _classCallCheck(this, VirtualScroll);
  3209. this.rows = options.rows;
  3210. this.scrollEl = options.scrollEl;
  3211. this.contentEl = options.contentEl;
  3212. this.callback = options.callback;
  3213. this.itemHeight = options.itemHeight;
  3214. this.cache = {};
  3215. this.scrollTop = this.scrollEl.scrollTop;
  3216. this.initDOM(this.rows, options.fixedScroll);
  3217. this.scrollEl.scrollTop = this.scrollTop;
  3218. this.lastCluster = 0;
  3219. var onScroll = function onScroll() {
  3220. if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
  3221. _this.initDOM(_this.rows);
  3222. _this.callback();
  3223. }
  3224. };
  3225. this.scrollEl.addEventListener('scroll', onScroll, false);
  3226. this.destroy = function () {
  3227. _this.contentEl.innerHtml = '';
  3228. _this.scrollEl.removeEventListener('scroll', onScroll, false);
  3229. };
  3230. }
  3231. _createClass(VirtualScroll, [{
  3232. key: "initDOM",
  3233. value: function initDOM(rows, fixedScroll) {
  3234. if (typeof this.clusterHeight === 'undefined') {
  3235. this.cache.scrollTop = this.scrollEl.scrollTop;
  3236. this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
  3237. this.getRowsHeight(rows);
  3238. }
  3239. var data = this.initData(rows, this.getNum(fixedScroll));
  3240. var thisRows = data.rows.join('');
  3241. var dataChanged = this.checkChanges('data', thisRows);
  3242. var topOffsetChanged = this.checkChanges('top', data.topOffset);
  3243. var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
  3244. var html = [];
  3245. if (dataChanged && topOffsetChanged) {
  3246. if (data.topOffset) {
  3247. html.push(this.getExtra('top', data.topOffset));
  3248. }
  3249. html.push(thisRows);
  3250. if (data.bottomOffset) {
  3251. html.push(this.getExtra('bottom', data.bottomOffset));
  3252. }
  3253. this.contentEl.innerHTML = html.join('');
  3254. if (fixedScroll) {
  3255. this.contentEl.scrollTop = this.cache.scrollTop;
  3256. }
  3257. } else if (bottomOffsetChanged) {
  3258. this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
  3259. }
  3260. }
  3261. }, {
  3262. key: "getRowsHeight",
  3263. value: function getRowsHeight() {
  3264. if (typeof this.itemHeight === 'undefined') {
  3265. var nodes = this.contentEl.children;
  3266. var node = nodes[Math.floor(nodes.length / 2)];
  3267. this.itemHeight = node.offsetHeight;
  3268. }
  3269. this.blockHeight = this.itemHeight * BLOCK_ROWS;
  3270. this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
  3271. this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
  3272. }
  3273. }, {
  3274. key: "getNum",
  3275. value: function getNum(fixedScroll) {
  3276. this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
  3277. return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
  3278. }
  3279. }, {
  3280. key: "initData",
  3281. value: function initData(rows, num) {
  3282. if (rows.length < BLOCK_ROWS) {
  3283. return {
  3284. topOffset: 0,
  3285. bottomOffset: 0,
  3286. rowsAbove: 0,
  3287. rows: rows
  3288. };
  3289. }
  3290. var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
  3291. var end = start + this.clusterRows;
  3292. var topOffset = Math.max(start * this.itemHeight, 0);
  3293. var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
  3294. var thisRows = [];
  3295. var rowsAbove = start;
  3296. if (topOffset < 1) {
  3297. rowsAbove++;
  3298. }
  3299. for (var i = start; i < end; i++) {
  3300. rows[i] && thisRows.push(rows[i]);
  3301. }
  3302. return {
  3303. topOffset: topOffset,
  3304. bottomOffset: bottomOffset,
  3305. rowsAbove: rowsAbove,
  3306. rows: thisRows
  3307. };
  3308. }
  3309. }, {
  3310. key: "checkChanges",
  3311. value: function checkChanges(type, value) {
  3312. var changed = value !== this.cache[type];
  3313. this.cache[type] = value;
  3314. return changed;
  3315. }
  3316. }, {
  3317. key: "getExtra",
  3318. value: function getExtra(className, height) {
  3319. var tag = document.createElement('tr');
  3320. tag.className = "virtual-scroll-".concat(className);
  3321. if (height) {
  3322. tag.style.height = "".concat(height, "px");
  3323. }
  3324. return tag.outerHTML;
  3325. }
  3326. }]);
  3327. return VirtualScroll;
  3328. }();
  3329. var BootstrapTable =
  3330. /*#__PURE__*/
  3331. function () {
  3332. function BootstrapTable(el, options) {
  3333. _classCallCheck(this, BootstrapTable);
  3334. this.options = options;
  3335. this.$el = $(el);
  3336. this.$el_ = this.$el.clone();
  3337. this.timeoutId_ = 0;
  3338. this.timeoutFooter_ = 0;
  3339. this.init();
  3340. }
  3341. _createClass(BootstrapTable, [{
  3342. key: "init",
  3343. value: function init() {
  3344. this.initConstants();
  3345. this.initLocale();
  3346. this.initContainer();
  3347. this.initTable();
  3348. this.initHeader();
  3349. this.initData();
  3350. this.initHiddenRows();
  3351. this.initToolbar();
  3352. this.initPagination();
  3353. this.initBody();
  3354. this.initSearchText();
  3355. this.initServer();
  3356. }
  3357. }, {
  3358. key: "initConstants",
  3359. value: function initConstants() {
  3360. var o = this.options;
  3361. this.constants = Constants.CONSTANTS;
  3362. this.constants.theme = $.fn.bootstrapTable.theme;
  3363. var buttonsPrefix = o.buttonsPrefix ? "".concat(o.buttonsPrefix, "-") : '';
  3364. this.constants.buttonsClass = [o.buttonsPrefix, buttonsPrefix + o.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), o.iconSize)].join(' ').trim();
  3365. }
  3366. }, {
  3367. key: "initLocale",
  3368. value: function initLocale() {
  3369. if (this.options.locale) {
  3370. var locales = $.fn.bootstrapTable.locales;
  3371. var parts = this.options.locale.split(/-|_/);
  3372. parts[0] = parts[0].toLowerCase();
  3373. if (parts[1]) {
  3374. parts[1] = parts[1].toUpperCase();
  3375. }
  3376. if (locales[this.options.locale]) {
  3377. $.extend(this.options, locales[this.options.locale]);
  3378. } else if (locales[parts.join('-')]) {
  3379. $.extend(this.options, locales[parts.join('-')]);
  3380. } else if (locales[parts[0]]) {
  3381. $.extend(this.options, locales[parts[0]]);
  3382. }
  3383. }
  3384. }
  3385. }, {
  3386. key: "initContainer",
  3387. value: function initContainer() {
  3388. var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
  3389. var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
  3390. 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 "));
  3391. this.$container.insertAfter(this.$el);
  3392. this.$tableContainer = this.$container.find('.fixed-table-container');
  3393. this.$tableHeader = this.$container.find('.fixed-table-header');
  3394. this.$tableBody = this.$container.find('.fixed-table-body');
  3395. this.$tableLoading = this.$container.find('.fixed-table-loading');
  3396. this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
  3397. if (this.options.buttonsToolbar) {
  3398. this.$toolbar = $('body').find(this.options.buttonsToolbar);
  3399. } else {
  3400. this.$toolbar = this.$container.find('.fixed-table-toolbar');
  3401. }
  3402. this.$pagination = this.$container.find('.fixed-table-pagination');
  3403. this.$tableBody.append(this.$el);
  3404. this.$container.after('<div class="clearfix"></div>');
  3405. this.$el.addClass(this.options.classes);
  3406. this.$tableLoading.addClass(this.options.classes);
  3407. if (this.options.height) {
  3408. this.$tableContainer.addClass('fixed-height');
  3409. if (this.options.showFooter) {
  3410. this.$tableContainer.addClass('has-footer');
  3411. }
  3412. if (this.options.classes.split(' ').includes('table-bordered')) {
  3413. this.$tableBody.append('<div class="fixed-table-border"></div>');
  3414. this.$tableBorder = this.$tableBody.find('.fixed-table-border');
  3415. this.$tableLoading.addClass('fixed-table-border');
  3416. }
  3417. this.$tableFooter = this.$container.find('.fixed-table-footer');
  3418. } else {
  3419. if (!this.$tableFooter.length) {
  3420. this.$el.append('<tfoot><tr></tr></tfoot>');
  3421. this.$tableFooter = this.$el.find('tfoot');
  3422. }
  3423. }
  3424. }
  3425. }, {
  3426. key: "initTable",
  3427. value: function initTable() {
  3428. var _this = this;
  3429. var columns = [];
  3430. var data = [];
  3431. this.$header = this.$el.find('>thead');
  3432. if (!this.$header.length) {
  3433. this.$header = $("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
  3434. } else if (this.options.theadClasses) {
  3435. this.$header.addClass(this.options.theadClasses);
  3436. }
  3437. this.$header.find('tr').each(function (i, el) {
  3438. var column = [];
  3439. $(el).find('th').each(function (i, el) {
  3440. // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
  3441. if (typeof $(el).data('field') !== 'undefined') {
  3442. $(el).data('field', "".concat($(el).data('field')));
  3443. }
  3444. column.push($.extend({}, {
  3445. title: $(el).html(),
  3446. 'class': $(el).attr('class'),
  3447. titleTooltip: $(el).attr('title'),
  3448. rowspan: $(el).attr('rowspan') ? +$(el).attr('rowspan') : undefined,
  3449. colspan: $(el).attr('colspan') ? +$(el).attr('colspan') : undefined
  3450. }, $(el).data()));
  3451. });
  3452. columns.push(column);
  3453. });
  3454. if (!Array.isArray(this.options.columns[0])) {
  3455. this.options.columns = [this.options.columns];
  3456. }
  3457. this.options.columns = $.extend(true, [], columns, this.options.columns);
  3458. this.columns = [];
  3459. this.fieldsColumnsIndex = [];
  3460. Utils.setFieldIndex(this.options.columns);
  3461. this.options.columns.forEach(function (columns, i) {
  3462. columns.forEach(function (_column, j) {
  3463. var column = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
  3464. if (typeof column.fieldIndex !== 'undefined') {
  3465. _this.columns[column.fieldIndex] = column;
  3466. _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
  3467. }
  3468. _this.options.columns[i][j] = column;
  3469. });
  3470. }); // if options.data is setting, do not process tbody and tfoot data
  3471. if (!this.options.data.length) {
  3472. this.options.data = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
  3473. if (data.length) {
  3474. this.fromHtml = true;
  3475. }
  3476. }
  3477. this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
  3478. if (this.footerData) {
  3479. this.$el.find('tfoot').html('<tr></tr>');
  3480. }
  3481. if (!this.options.showFooter || this.options.cardView) {
  3482. this.$tableFooter.hide();
  3483. } else {
  3484. this.$tableFooter.show();
  3485. }
  3486. }
  3487. }, {
  3488. key: "initHeader",
  3489. value: function initHeader() {
  3490. var _this2 = this;
  3491. var visibleColumns = {};
  3492. var html = [];
  3493. this.header = {
  3494. fields: [],
  3495. styles: [],
  3496. classes: [],
  3497. formatters: [],
  3498. detailFormatters: [],
  3499. events: [],
  3500. sorters: [],
  3501. sortNames: [],
  3502. cellStyles: [],
  3503. searchables: []
  3504. };
  3505. Utils.updateFieldGroup(this.options.columns);
  3506. this.options.columns.forEach(function (columns, i) {
  3507. html.push('<tr>');
  3508. if (i === 0 && !_this2.options.cardView && _this2.options.detailView && _this2.options.detailViewIcon) {
  3509. html.push("<th class=\"detail\" rowspan=\"".concat(_this2.options.columns.length, "\">\n <div class=\"fht-cell\"></div>\n </th>\n "));
  3510. }
  3511. columns.forEach(function (column, j) {
  3512. var class_ = Utils.sprintf(' class="%s"', column['class']);
  3513. var unitWidth = column.widthUnit;
  3514. var width = parseFloat(column.width);
  3515. var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
  3516. var align = Utils.sprintf('text-align: %s; ', column.align);
  3517. var style = Utils.sprintf('vertical-align: %s; ', column.valign);
  3518. style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
  3519. if (typeof column.fieldIndex === 'undefined' && !column.visible) {
  3520. return;
  3521. }
  3522. if (typeof column.fieldIndex !== 'undefined') {
  3523. _this2.header.fields[column.fieldIndex] = column.field;
  3524. _this2.header.styles[column.fieldIndex] = align + style;
  3525. _this2.header.classes[column.fieldIndex] = class_;
  3526. _this2.header.formatters[column.fieldIndex] = column.formatter;
  3527. _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
  3528. _this2.header.events[column.fieldIndex] = column.events;
  3529. _this2.header.sorters[column.fieldIndex] = column.sorter;
  3530. _this2.header.sortNames[column.fieldIndex] = column.sortName;
  3531. _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
  3532. _this2.header.searchables[column.fieldIndex] = column.searchable;
  3533. if (!column.visible) {
  3534. return;
  3535. }
  3536. if (_this2.options.cardView && !column.cardVisible) {
  3537. return;
  3538. }
  3539. visibleColumns[column.field] = column;
  3540. }
  3541. 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.
  3542. j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
  3543. html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
  3544. var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
  3545. var title = text;
  3546. if (column.checkbox) {
  3547. text = '';
  3548. if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
  3549. text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
  3550. }
  3551. _this2.header.stateField = column.field;
  3552. }
  3553. if (column.radio) {
  3554. text = '';
  3555. _this2.header.stateField = column.field;
  3556. _this2.options.singleSelect = true;
  3557. }
  3558. if (!text && column.showSelectTitle) {
  3559. text += title;
  3560. }
  3561. html.push(text);
  3562. html.push('</div>');
  3563. html.push('<div class="fht-cell"></div>');
  3564. html.push('</div>');
  3565. html.push('</th>');
  3566. });
  3567. html.push('</tr>');
  3568. });
  3569. this.$header.html(html.join(''));
  3570. this.$header.find('th[data-field]').each(function (i, el) {
  3571. $(el).data(visibleColumns[$(el).data('field')]);
  3572. });
  3573. this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
  3574. var $this = $(e.currentTarget);
  3575. if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
  3576. if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
  3577. return false;
  3578. }
  3579. }
  3580. if (_this2.options.sortable && $this.parent().data().sortable) {
  3581. _this2.onSort(e);
  3582. }
  3583. });
  3584. this.$header.children().children().off('keypress').on('keypress', function (e) {
  3585. if (_this2.options.sortable && $(e.currentTarget).data().sortable) {
  3586. var code = e.keyCode || e.which;
  3587. if (code === 13) {
  3588. // Enter keycode
  3589. _this2.onSort(e);
  3590. }
  3591. }
  3592. });
  3593. var resizeEvent = "resize.bootstrap-table".concat(this.$el.attr('id') || '');
  3594. $(window).off(resizeEvent);
  3595. if (!this.options.showHeader || this.options.cardView) {
  3596. this.$header.hide();
  3597. this.$tableHeader.hide();
  3598. this.$tableLoading.css('top', 0);
  3599. } else {
  3600. this.$header.show();
  3601. this.$tableHeader.show();
  3602. this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
  3603. this.getCaret();
  3604. $(window).on(resizeEvent, function (e) {
  3605. return _this2.resetWidth(e);
  3606. });
  3607. }
  3608. this.$selectAll = this.$header.find('[name="btSelectAll"]');
  3609. this.$selectAll.off('click').on('click', function (_ref) {
  3610. var currentTarget = _ref.currentTarget;
  3611. var checked = $(currentTarget).prop('checked');
  3612. _this2[checked ? 'checkAll' : 'uncheckAll']();
  3613. _this2.updateSelected();
  3614. });
  3615. }
  3616. }, {
  3617. key: "initData",
  3618. value: function initData(data, type) {
  3619. if (type === 'append') {
  3620. this.options.data = this.options.data.concat(data);
  3621. } else if (type === 'prepend') {
  3622. this.options.data = [].concat(data).concat(this.options.data);
  3623. } else {
  3624. this.options.data = data || this.options.data;
  3625. }
  3626. this.data = this.options.data;
  3627. if (this.options.sidePagination === 'server') {
  3628. return;
  3629. }
  3630. this.initSort();
  3631. }
  3632. }, {
  3633. key: "initSort",
  3634. value: function initSort() {
  3635. var _this3 = this;
  3636. var name = this.options.sortName;
  3637. var order = this.options.sortOrder === 'desc' ? -1 : 1;
  3638. var index = this.header.fields.indexOf(this.options.sortName);
  3639. var timeoutId = 0;
  3640. if (index !== -1) {
  3641. if (this.options.sortStable) {
  3642. this.data.forEach(function (row, i) {
  3643. if (!row.hasOwnProperty('_position')) {
  3644. row._position = i;
  3645. }
  3646. });
  3647. }
  3648. if (this.options.customSort) {
  3649. Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
  3650. } else {
  3651. this.data.sort(function (a, b) {
  3652. if (_this3.header.sortNames[index]) {
  3653. name = _this3.header.sortNames[index];
  3654. }
  3655. var aa = Utils.getItemField(a, name, _this3.options.escape);
  3656. var bb = Utils.getItemField(b, name, _this3.options.escape);
  3657. var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
  3658. if (value !== undefined) {
  3659. if (_this3.options.sortStable && value === 0) {
  3660. return order * (a._position - b._position);
  3661. }
  3662. return order * value;
  3663. }
  3664. return Utils.sort(aa, bb, order, _this3.options.sortStable);
  3665. });
  3666. }
  3667. if (this.options.sortClass !== undefined) {
  3668. clearTimeout(timeoutId);
  3669. timeoutId = setTimeout(function () {
  3670. _this3.$el.removeClass(_this3.options.sortClass);
  3671. var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
  3672. _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
  3673. }, 250);
  3674. }
  3675. }
  3676. }
  3677. }, {
  3678. key: "onSort",
  3679. value: function onSort(_ref2) {
  3680. var type = _ref2.type,
  3681. currentTarget = _ref2.currentTarget;
  3682. var $this = type === 'keypress' ? $(currentTarget) : $(currentTarget).parent();
  3683. var $this_ = this.$header.find('th').eq($this.index());
  3684. this.$header.add(this.$header_).find('span.order').remove();
  3685. if (this.options.sortName === $this.data('field')) {
  3686. this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
  3687. } else {
  3688. this.options.sortName = $this.data('field');
  3689. if (this.options.rememberOrder) {
  3690. this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
  3691. } else {
  3692. this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
  3693. }
  3694. }
  3695. this.trigger('sort', this.options.sortName, this.options.sortOrder);
  3696. $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
  3697. this.getCaret();
  3698. if (this.options.sidePagination === 'server') {
  3699. this.options.pageNumber = 1;
  3700. this.initServer(this.options.silentSort);
  3701. return;
  3702. }
  3703. this.initSort();
  3704. this.initBody();
  3705. }
  3706. }, {
  3707. key: "initToolbar",
  3708. value: function initToolbar() {
  3709. var _this4 = this;
  3710. var o = this.options;
  3711. var html = [];
  3712. var timeoutId = 0;
  3713. var $keepOpen;
  3714. var switchableCount = 0;
  3715. if (this.$toolbar.find('.bs-bars').children().length) {
  3716. $('body').append($(o.toolbar));
  3717. }
  3718. this.$toolbar.html('');
  3719. if (typeof o.toolbar === 'string' || _typeof(o.toolbar) === 'object') {
  3720. $(Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, o.toolbarAlign)).appendTo(this.$toolbar).append($(o.toolbar));
  3721. } // showColumns, showToggle, showRefresh
  3722. html = ["<div class=\"".concat(['columns', "columns-".concat(o.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(o.buttonsAlign)].join(' '), "\">")];
  3723. if (typeof o.icons === 'string') {
  3724. o.icons = Utils.calculateObjectValue(null, o.icons);
  3725. }
  3726. if (o.showPaginationSwitch) {
  3727. 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>"));
  3728. }
  3729. if (o.showRefresh) {
  3730. 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>"));
  3731. }
  3732. if (o.showToggle) {
  3733. 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>"));
  3734. }
  3735. if (o.showFullscreen) {
  3736. 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>"));
  3737. }
  3738. if (o.showColumns) {
  3739. 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]));
  3740. if (o.showColumnsToggleAll) {
  3741. var allFieldsVisible = this.getVisibleColumns().length === this.columns.length;
  3742. 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())));
  3743. html.push(this.constants.html.toolbarDropdownSeparator);
  3744. }
  3745. this.columns.forEach(function (column, i) {
  3746. if (column.radio || column.checkbox) {
  3747. return;
  3748. }
  3749. if (o.cardView && !column.cardVisible) {
  3750. return;
  3751. }
  3752. var checked = column.visible ? ' checked="checked"' : '';
  3753. if (column.switchable) {
  3754. 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)));
  3755. switchableCount++;
  3756. }
  3757. });
  3758. html.push(this.constants.html.toolbarDropdown[1], '</div>');
  3759. }
  3760. html.push('</div>'); // Fix #188: this.showToolbar is for extensions
  3761. if (this.showToolbar || html.length > 2) {
  3762. this.$toolbar.append(html.join(''));
  3763. }
  3764. if (o.showPaginationSwitch) {
  3765. this.$toolbar.find('button[name="paginationSwitch"]').off('click').on('click', function () {
  3766. return _this4.togglePagination();
  3767. });
  3768. }
  3769. if (o.showFullscreen) {
  3770. this.$toolbar.find('button[name="fullscreen"]').off('click').on('click', function () {
  3771. return _this4.toggleFullscreen();
  3772. });
  3773. }
  3774. if (o.showRefresh) {
  3775. this.$toolbar.find('button[name="refresh"]').off('click').on('click', function () {
  3776. return _this4.refresh();
  3777. });
  3778. }
  3779. if (o.showToggle) {
  3780. this.$toolbar.find('button[name="toggle"]').off('click').on('click', function () {
  3781. _this4.toggleView();
  3782. });
  3783. }
  3784. if (o.showColumns) {
  3785. $keepOpen = this.$toolbar.find('.keep-open');
  3786. var $checkboxes = $keepOpen.find('input:not(".toggle-all")');
  3787. var $toggleAll = $keepOpen.find('input.toggle-all');
  3788. if (switchableCount <= o.minimumCountColumns) {
  3789. $keepOpen.find('input').prop('disabled', true);
  3790. }
  3791. $keepOpen.find('li, label').off('click').on('click', function (e) {
  3792. e.stopImmediatePropagation();
  3793. });
  3794. $checkboxes.off('click').on('click', function (_ref3) {
  3795. var currentTarget = _ref3.currentTarget;
  3796. var $this = $(currentTarget);
  3797. _this4._toggleColumn($this.val(), $this.prop('checked'), false);
  3798. _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
  3799. $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.length);
  3800. });
  3801. $toggleAll.off('click').on('click', function (_ref4) {
  3802. var currentTarget = _ref4.currentTarget;
  3803. _this4._toggleAllColumns($(currentTarget).prop('checked'));
  3804. });
  3805. } // Fix #4516: this.showSearchClearButton is for extensions
  3806. if (o.search || this.showSearchClearButton) {
  3807. html = [];
  3808. var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, o.formatSearch(), o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.search) : '', o.showButtonText ? o.formatSearch() : '');
  3809. var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, o.formatClearSearch(), o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.clearSearch) : '', o.showButtonText ? o.formatClearSearch() : '');
  3810. var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, o.iconSize), "\n search-input\" type=\"text\" placeholder=\"").concat(o.formatSearch(), "\">");
  3811. var searchInputFinalHtml = searchInputHtml;
  3812. if (o.showSearchButton || o.showSearchClearButton) {
  3813. var buttonsHtml = (o.showSearchButton ? showSearchButton : '') + (o.showSearchClearButton ? showSearchClearButton : '');
  3814. searchInputFinalHtml = o.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, buttonsHtml) : buttonsHtml;
  3815. }
  3816. 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));
  3817. this.$toolbar.append(html.join(''));
  3818. var $searchInput = this.$toolbar.find('.search input');
  3819. var handleInputEvent = function handleInputEvent() {
  3820. var eventTriggers = Utils.isIEBrowser() ? 'mouseup' : 'keyup drop blur';
  3821. $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
  3822. if (o.searchOnEnterKey && event.keyCode !== 13) {
  3823. return;
  3824. }
  3825. if ([37, 38, 39, 40].includes(event.keyCode)) {
  3826. return;
  3827. }
  3828. clearTimeout(timeoutId); // doesn't matter if it's 0
  3829. timeoutId = setTimeout(function () {
  3830. _this4.onSearch(event);
  3831. }, o.searchTimeOut);
  3832. });
  3833. };
  3834. if (o.showSearchButton) {
  3835. this.$toolbar.find('.search button[name=search]').off('click').on('click', function (event) {
  3836. clearTimeout(timeoutId); // doesn't matter if it's 0
  3837. timeoutId = setTimeout(function () {
  3838. _this4.onSearch({
  3839. currentTarget: $searchInput
  3840. });
  3841. }, o.searchTimeOut);
  3842. });
  3843. if (o.searchOnEnterKey) {
  3844. handleInputEvent();
  3845. }
  3846. } else {
  3847. handleInputEvent();
  3848. }
  3849. if (o.showSearchClearButton) {
  3850. this.$toolbar.find('.search button[name=clearSearch]').click(function () {
  3851. _this4.resetSearch();
  3852. });
  3853. }
  3854. }
  3855. }
  3856. }, {
  3857. key: "onSearch",
  3858. value: function onSearch() {
  3859. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  3860. currentTarget = _ref5.currentTarget,
  3861. firedByInitSearchText = _ref5.firedByInitSearchText;
  3862. var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  3863. if (currentTarget !== undefined && $(currentTarget).length && overwriteSearchText) {
  3864. var text = $(currentTarget).val().trim();
  3865. if (this.options.trimOnSearch && $(currentTarget).val() !== text) {
  3866. $(currentTarget).val(text);
  3867. }
  3868. if (this.searchText === text) {
  3869. return;
  3870. }
  3871. if ($(currentTarget).hasClass('search-input')) {
  3872. this.searchText = text;
  3873. this.options.searchText = text;
  3874. }
  3875. }
  3876. if (!firedByInitSearchText) {
  3877. this.options.pageNumber = 1;
  3878. }
  3879. this.initSearch();
  3880. if (firedByInitSearchText) {
  3881. if (this.options.sidePagination === 'client') {
  3882. this.updatePagination();
  3883. }
  3884. } else {
  3885. this.updatePagination();
  3886. }
  3887. this.trigger('search', this.searchText);
  3888. }
  3889. }, {
  3890. key: "initSearch",
  3891. value: function initSearch() {
  3892. var _this5 = this;
  3893. this.filterOptions = this.filterOptions || this.options.filterOptions;
  3894. if (this.options.sidePagination !== 'server') {
  3895. if (this.options.customSearch) {
  3896. this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
  3897. return;
  3898. }
  3899. var s = this.searchText && (this.options.escape ? Utils.escapeHTML(this.searchText) : this.searchText).toLowerCase();
  3900. var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns; // Check filter
  3901. if (typeof this.filterOptions.filterAlgorithm === 'function') {
  3902. this.data = this.options.data.filter(function (item, i) {
  3903. return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
  3904. });
  3905. } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
  3906. this.data = f ? this.options.data.filter(function (item, i) {
  3907. var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
  3908. if (filterAlgorithm === 'and') {
  3909. for (var key in f) {
  3910. if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
  3911. return false;
  3912. }
  3913. }
  3914. } else if (filterAlgorithm === 'or') {
  3915. var match = false;
  3916. for (var _key in f) {
  3917. if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
  3918. match = true;
  3919. }
  3920. }
  3921. return match;
  3922. }
  3923. return true;
  3924. }) : this.options.data;
  3925. }
  3926. var visibleFields = this.getVisibleFields();
  3927. this.data = s ? this.data.filter(function (item, i) {
  3928. for (var j = 0; j < _this5.header.fields.length; j++) {
  3929. if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
  3930. continue;
  3931. }
  3932. var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
  3933. var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
  3934. var value = void 0;
  3935. if (typeof key === 'string') {
  3936. value = item;
  3937. var props = key.split('.');
  3938. for (var _i = 0; _i < props.length; _i++) {
  3939. if (value[props[_i]] !== null) {
  3940. value = value[props[_i]];
  3941. }
  3942. }
  3943. } else {
  3944. value = item[key];
  3945. } // Fix #142: respect searchFormatter boolean
  3946. if (column && column.searchFormatter) {
  3947. value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
  3948. }
  3949. if (typeof value === 'string' || typeof value === 'number') {
  3950. if (_this5.options.strictSearch) {
  3951. if ("".concat(value).toLowerCase() === s) {
  3952. return true;
  3953. }
  3954. } else {
  3955. var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
  3956. var matches = largerSmallerEqualsRegex.exec(s);
  3957. var comparisonCheck = false;
  3958. if (matches) {
  3959. var operator = matches[1] || "".concat(matches[5], "l");
  3960. var comparisonValue = matches[2] || matches[3];
  3961. var int = parseInt(value, 10);
  3962. var comparisonInt = parseInt(comparisonValue, 10);
  3963. switch (operator) {
  3964. case '>':
  3965. case '<l':
  3966. comparisonCheck = int > comparisonInt;
  3967. break;
  3968. case '<':
  3969. case '>l':
  3970. comparisonCheck = int < comparisonInt;
  3971. break;
  3972. case '<=':
  3973. case '=<':
  3974. case '>=l':
  3975. case '=>l':
  3976. comparisonCheck = int <= comparisonInt;
  3977. break;
  3978. case '>=':
  3979. case '=>':
  3980. case '<=l':
  3981. case '=<l':
  3982. comparisonCheck = int >= comparisonInt;
  3983. break;
  3984. default:
  3985. break;
  3986. }
  3987. }
  3988. if (comparisonCheck || "".concat(value).toLowerCase().includes(s)) {
  3989. return true;
  3990. }
  3991. }
  3992. }
  3993. }
  3994. return false;
  3995. }) : this.data;
  3996. }
  3997. }
  3998. }, {
  3999. key: "initPagination",
  4000. value: function initPagination() {
  4001. var _this6 = this;
  4002. var o = this.options;
  4003. if (!o.pagination) {
  4004. this.$pagination.hide();
  4005. return;
  4006. }
  4007. this.$pagination.show();
  4008. var html = [];
  4009. var $allSelected = false;
  4010. var i;
  4011. var from;
  4012. var to;
  4013. var $pageList;
  4014. var $pre;
  4015. var $next;
  4016. var $number;
  4017. var data = this.getData({
  4018. includeHiddenRows: false
  4019. });
  4020. var pageList = o.pageList;
  4021. if (o.sidePagination !== 'server') {
  4022. o.totalRows = data.length;
  4023. }
  4024. this.totalPages = 0;
  4025. if (o.totalRows) {
  4026. if (o.pageSize === o.formatAllRows()) {
  4027. o.pageSize = o.totalRows;
  4028. $allSelected = true;
  4029. } else if (o.pageSize === o.totalRows) {
  4030. // Fix #667 Table with pagination,
  4031. // multiple pages and a search this matches to one page throws exception
  4032. var pageLst = typeof o.pageList === 'string' ? o.pageList.replace('[', '').replace(']', '').replace(/ /g, '').toLowerCase().split(',') : o.pageList;
  4033. if (pageLst.includes(o.formatAllRows().toLowerCase())) {
  4034. $allSelected = true;
  4035. }
  4036. }
  4037. this.totalPages = ~~((o.totalRows - 1) / o.pageSize) + 1;
  4038. o.totalPages = this.totalPages;
  4039. }
  4040. if (this.totalPages > 0 && o.pageNumber > this.totalPages) {
  4041. o.pageNumber = this.totalPages;
  4042. }
  4043. this.pageFrom = (o.pageNumber - 1) * o.pageSize + 1;
  4044. this.pageTo = o.pageNumber * o.pageSize;
  4045. if (this.pageTo > o.totalRows) {
  4046. this.pageTo = o.totalRows;
  4047. }
  4048. if (this.options.pagination && this.options.sidePagination !== 'server') {
  4049. this.options.totalNotFiltered = this.options.data.length;
  4050. }
  4051. if (!this.options.showExtendedPagination) {
  4052. this.options.totalNotFiltered = undefined;
  4053. }
  4054. var paginationInfo = o.onlyInfoPagination ? o.formatDetailPagination(o.totalRows) : o.formatShowingRows(this.pageFrom, this.pageTo, o.totalRows, o.totalNotFiltered);
  4055. html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(o.paginationDetailHAlign, " pagination-detail\">\n <span class=\"pagination-info\">\n ").concat(paginationInfo, "\n </span>"));
  4056. if (!o.onlyInfoPagination) {
  4057. html.push('<span class="page-list">');
  4058. 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])];
  4059. if (typeof o.pageList === 'string') {
  4060. var list = o.pageList.replace('[', '').replace(']', '').replace(/ /g, '').split(',');
  4061. pageList = [];
  4062. var _iteratorNormalCompletion = true;
  4063. var _didIteratorError = false;
  4064. var _iteratorError = undefined;
  4065. try {
  4066. for (var _iterator = list[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  4067. var value = _step.value;
  4068. pageList.push(value.toLowerCase() === o.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? o.formatAllRows() : +value);
  4069. }
  4070. } catch (err) {
  4071. _didIteratorError = true;
  4072. _iteratorError = err;
  4073. } finally {
  4074. try {
  4075. if (!_iteratorNormalCompletion && _iterator.return != null) {
  4076. _iterator.return();
  4077. }
  4078. } finally {
  4079. if (_didIteratorError) {
  4080. throw _iteratorError;
  4081. }
  4082. }
  4083. }
  4084. }
  4085. pageList.forEach(function (page, i) {
  4086. if (!o.smartDisplay || i === 0 || pageList[i - 1] < o.totalRows) {
  4087. var active;
  4088. if ($allSelected) {
  4089. active = page === o.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
  4090. } else {
  4091. active = page === o.pageSize ? _this6.constants.classes.dropdownActive : '';
  4092. }
  4093. pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
  4094. }
  4095. });
  4096. pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</span>"));
  4097. html.push(o.formatRecordsPerPage(pageNumber.join('')));
  4098. html.push('</span></div>');
  4099. 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));
  4100. if (this.totalPages < o.paginationSuccessivelySize) {
  4101. from = 1;
  4102. to = this.totalPages;
  4103. } else {
  4104. from = o.pageNumber - o.paginationPagesBySide;
  4105. to = from + o.paginationPagesBySide * 2;
  4106. }
  4107. if (o.pageNumber < o.paginationSuccessivelySize - 1) {
  4108. to = o.paginationSuccessivelySize;
  4109. }
  4110. if (o.paginationSuccessivelySize > this.totalPages - from) {
  4111. from = from - (o.paginationSuccessivelySize - (this.totalPages - from)) + 1;
  4112. }
  4113. if (from < 1) {
  4114. from = 1;
  4115. }
  4116. if (to > this.totalPages) {
  4117. to = this.totalPages;
  4118. }
  4119. var middleSize = Math.round(o.paginationPagesBySide / 2);
  4120. var pageItem = function pageItem(i) {
  4121. var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  4122. return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === o.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), o.formatSRPaginationPageText(i), i);
  4123. };
  4124. if (from > 1) {
  4125. var max = o.paginationPagesBySide;
  4126. if (max >= from) max = from - 1;
  4127. for (i = 1; i <= max; i++) {
  4128. html.push(pageItem(i));
  4129. }
  4130. if (from - 1 === max + 1) {
  4131. i = from - 1;
  4132. html.push(pageItem(i));
  4133. } else {
  4134. if (from - 1 > max) {
  4135. if (from - o.paginationPagesBySide * 2 > o.paginationPagesBySide && o.paginationUseIntermediate) {
  4136. i = Math.round((from - middleSize) / 2 + middleSize);
  4137. html.push(pageItem(i, ' page-intermediate'));
  4138. } else {
  4139. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
  4140. }
  4141. }
  4142. }
  4143. }
  4144. for (i = from; i <= to; i++) {
  4145. html.push(pageItem(i));
  4146. }
  4147. if (this.totalPages > to) {
  4148. var min = this.totalPages - (o.paginationPagesBySide - 1);
  4149. if (to >= min) min = to + 1;
  4150. if (to + 1 === min - 1) {
  4151. i = to + 1;
  4152. html.push(pageItem(i));
  4153. } else {
  4154. if (min > to + 1) {
  4155. if (this.totalPages - to > o.paginationPagesBySide * 2 && o.paginationUseIntermediate) {
  4156. i = Math.round((this.totalPages - middleSize - to) / 2 + to);
  4157. html.push(pageItem(i, ' page-intermediate'));
  4158. } else {
  4159. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
  4160. }
  4161. }
  4162. }
  4163. for (i = min; i <= this.totalPages; i++) {
  4164. html.push(pageItem(i));
  4165. }
  4166. }
  4167. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', o.formatSRPaginationNextText(), o.paginationNextText));
  4168. html.push(this.constants.html.pagination[1], '</div>');
  4169. }
  4170. this.$pagination.html(html.join(''));
  4171. var dropupClass = ['bottom', 'both'].includes(o.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
  4172. this.$pagination.last().find('.page-list > span').addClass(dropupClass);
  4173. if (!o.onlyInfoPagination) {
  4174. $pageList = this.$pagination.find('.page-list a');
  4175. $pre = this.$pagination.find('.page-pre');
  4176. $next = this.$pagination.find('.page-next');
  4177. $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
  4178. if (this.totalPages <= 1) {
  4179. this.$pagination.find('div.pagination').hide();
  4180. }
  4181. if (o.smartDisplay) {
  4182. if (pageList.length < 2 || o.totalRows <= pageList[0]) {
  4183. this.$pagination.find('span.page-list').hide();
  4184. }
  4185. } // when data is empty, hide the pagination
  4186. this.$pagination[this.getData().length ? 'show' : 'hide']();
  4187. if (!o.paginationLoop) {
  4188. if (o.pageNumber === 1) {
  4189. $pre.addClass('disabled');
  4190. }
  4191. if (o.pageNumber === this.totalPages) {
  4192. $next.addClass('disabled');
  4193. }
  4194. }
  4195. if ($allSelected) {
  4196. o.pageSize = o.formatAllRows();
  4197. } // removed the events for last and first, onPageNumber executeds the same logic
  4198. $pageList.off('click').on('click', function (e) {
  4199. return _this6.onPageListChange(e);
  4200. });
  4201. $pre.off('click').on('click', function (e) {
  4202. return _this6.onPagePre(e);
  4203. });
  4204. $next.off('click').on('click', function (e) {
  4205. return _this6.onPageNext(e);
  4206. });
  4207. $number.off('click').on('click', function (e) {
  4208. return _this6.onPageNumber(e);
  4209. });
  4210. }
  4211. }
  4212. }, {
  4213. key: "updatePagination",
  4214. value: function updatePagination(event) {
  4215. // Fix #171: IE disabled button can be clicked bug.
  4216. if (event && $(event.currentTarget).hasClass('disabled')) {
  4217. return;
  4218. }
  4219. if (!this.options.maintainMetaData) {
  4220. this.resetRows();
  4221. }
  4222. this.initPagination();
  4223. if (this.options.sidePagination === 'server') {
  4224. this.initServer();
  4225. } else {
  4226. this.initBody();
  4227. }
  4228. this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
  4229. }
  4230. }, {
  4231. key: "onPageListChange",
  4232. value: function onPageListChange(event) {
  4233. event.preventDefault();
  4234. var $this = $(event.currentTarget);
  4235. $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
  4236. this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
  4237. this.$toolbar.find('.page-size').text(this.options.pageSize);
  4238. this.updatePagination(event);
  4239. return false;
  4240. }
  4241. }, {
  4242. key: "onPagePre",
  4243. value: function onPagePre(event) {
  4244. event.preventDefault();
  4245. if (this.options.pageNumber - 1 === 0) {
  4246. this.options.pageNumber = this.options.totalPages;
  4247. } else {
  4248. this.options.pageNumber--;
  4249. }
  4250. this.updatePagination(event);
  4251. return false;
  4252. }
  4253. }, {
  4254. key: "onPageNext",
  4255. value: function onPageNext(event) {
  4256. event.preventDefault();
  4257. if (this.options.pageNumber + 1 > this.options.totalPages) {
  4258. this.options.pageNumber = 1;
  4259. } else {
  4260. this.options.pageNumber++;
  4261. }
  4262. this.updatePagination(event);
  4263. return false;
  4264. }
  4265. }, {
  4266. key: "onPageNumber",
  4267. value: function onPageNumber(event) {
  4268. event.preventDefault();
  4269. if (this.options.pageNumber === +$(event.currentTarget).text()) {
  4270. return;
  4271. }
  4272. this.options.pageNumber = +$(event.currentTarget).text();
  4273. this.updatePagination(event);
  4274. return false;
  4275. }
  4276. }, {
  4277. key: "initRow",
  4278. value: function initRow(item, i, data, trFragments) {
  4279. var _this7 = this;
  4280. var html = [];
  4281. var style = {};
  4282. var csses = [];
  4283. var data_ = '';
  4284. var attributes = {};
  4285. var htmlAttributes = [];
  4286. if (Utils.findIndex(this.hiddenRows, item) > -1) {
  4287. return;
  4288. }
  4289. style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
  4290. if (style && style.css) {
  4291. for (var _i2 = 0, _Object$entries = Object.entries(style.css); _i2 < _Object$entries.length; _i2++) {
  4292. var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
  4293. key = _Object$entries$_i[0],
  4294. value = _Object$entries$_i[1];
  4295. csses.push("".concat(key, ": ").concat(value));
  4296. }
  4297. }
  4298. attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
  4299. if (attributes) {
  4300. for (var _i3 = 0, _Object$entries2 = Object.entries(attributes); _i3 < _Object$entries2.length; _i3++) {
  4301. var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2),
  4302. key = _Object$entries2$_i[0],
  4303. value = _Object$entries2$_i[1];
  4304. htmlAttributes.push("".concat(key, "=\"").concat(Utils.escapeHTML(value), "\""));
  4305. }
  4306. }
  4307. if (item._data && !Utils.isEmptyObject(item._data)) {
  4308. for (var _i4 = 0, _Object$entries3 = Object.entries(item._data); _i4 < _Object$entries3.length; _i4++) {
  4309. var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2),
  4310. k = _Object$entries3$_i[0],
  4311. v = _Object$entries3$_i[1];
  4312. // ignore data-index
  4313. if (k === 'index') {
  4314. return;
  4315. }
  4316. data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
  4317. }
  4318. }
  4319. 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_), '>');
  4320. if (this.options.cardView) {
  4321. html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
  4322. }
  4323. if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
  4324. html.push('<td>');
  4325. if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
  4326. 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 "));
  4327. }
  4328. html.push('</td>');
  4329. }
  4330. this.header.fields.forEach(function (field, j) {
  4331. var text = '';
  4332. var value_ = Utils.getItemField(item, field, _this7.options.escape);
  4333. var value = '';
  4334. var type = '';
  4335. var cellStyle = {};
  4336. var id_ = '';
  4337. var class_ = _this7.header.classes[j];
  4338. var style_ = '';
  4339. var data_ = '';
  4340. var rowspan_ = '';
  4341. var colspan_ = '';
  4342. var title_ = '';
  4343. var column = _this7.columns[j];
  4344. if (_this7.fromHtml && typeof value_ === 'undefined') {
  4345. if (!column.checkbox && !column.radio) {
  4346. return;
  4347. }
  4348. }
  4349. if (!column.visible) {
  4350. return;
  4351. }
  4352. if (_this7.options.cardView && !column.cardVisible) {
  4353. return;
  4354. }
  4355. if (column.escape) {
  4356. value_ = Utils.escapeHTML(value_);
  4357. }
  4358. if (csses.concat([_this7.header.styles[j]]).length) {
  4359. style_ = " style=\"".concat(csses.concat([_this7.header.styles[j]]).join('; '), "\"");
  4360. } // handle td's id and class
  4361. if (item["_".concat(field, "_id")]) {
  4362. id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
  4363. }
  4364. if (item["_".concat(field, "_class")]) {
  4365. class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
  4366. }
  4367. if (item["_".concat(field, "_rowspan")]) {
  4368. rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
  4369. }
  4370. if (item["_".concat(field, "_colspan")]) {
  4371. colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
  4372. }
  4373. if (item["_".concat(field, "_title")]) {
  4374. title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
  4375. }
  4376. cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
  4377. if (cellStyle.classes) {
  4378. class_ = " class=\"".concat(cellStyle.classes, "\"");
  4379. }
  4380. if (cellStyle.css) {
  4381. var csses_ = [];
  4382. for (var _i5 = 0, _Object$entries4 = Object.entries(cellStyle.css); _i5 < _Object$entries4.length; _i5++) {
  4383. var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i5], 2),
  4384. key = _Object$entries4$_i[0],
  4385. _value = _Object$entries4$_i[1];
  4386. csses_.push("".concat(key, ": ").concat(_value));
  4387. }
  4388. style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
  4389. }
  4390. value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
  4391. if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
  4392. for (var _i6 = 0, _Object$entries5 = Object.entries(item["_".concat(field, "_data")]); _i6 < _Object$entries5.length; _i6++) {
  4393. var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i6], 2),
  4394. k = _Object$entries5$_i[0],
  4395. v = _Object$entries5$_i[1];
  4396. // ignore data-index
  4397. if (k === 'index') {
  4398. return;
  4399. }
  4400. data_ += " data-".concat(k, "=\"").concat(v, "\"");
  4401. }
  4402. }
  4403. if (column.checkbox || column.radio) {
  4404. type = column.checkbox ? 'checkbox' : type;
  4405. type = column.radio ? 'radio' : type;
  4406. var c = column['class'] || '';
  4407. var isChecked = (value === true || value_ || value && value.checked) && value !== false;
  4408. var isDisabled = !column.checkboxEnabled || value && value.disabled;
  4409. 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('');
  4410. item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
  4411. } else {
  4412. value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
  4413. if (_this7.options.cardView) {
  4414. var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title\"".concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
  4415. text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value\">").concat(value, "</span></div>");
  4416. if (_this7.options.smartDisplay && value === '') {
  4417. text = '<div class="card-view"></div>';
  4418. }
  4419. } else {
  4420. text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
  4421. }
  4422. }
  4423. html.push(text);
  4424. });
  4425. if (this.options.cardView) {
  4426. html.push('</div></td>');
  4427. }
  4428. html.push('</tr>');
  4429. return html.join('');
  4430. }
  4431. }, {
  4432. key: "initBody",
  4433. value: function initBody(fixedScroll) {
  4434. var _this8 = this;
  4435. var data = this.getData();
  4436. this.trigger('pre-body', data);
  4437. this.$body = this.$el.find('>tbody');
  4438. if (!this.$body.length) {
  4439. this.$body = $('<tbody></tbody>').appendTo(this.$el);
  4440. } // Fix #389 Bootstrap-table-flatJSON is not working
  4441. if (!this.options.pagination || this.options.sidePagination === 'server') {
  4442. this.pageFrom = 1;
  4443. this.pageTo = data.length;
  4444. }
  4445. var rows = [];
  4446. var trFragments = $(document.createDocumentFragment());
  4447. var hasTr = false;
  4448. for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
  4449. var item = data[i];
  4450. var tr = this.initRow(item, i, data, trFragments);
  4451. hasTr = hasTr || !!tr;
  4452. if (tr && typeof tr === 'string') {
  4453. if (!this.options.virtualScroll) {
  4454. trFragments.append(tr);
  4455. } else {
  4456. rows.push(tr);
  4457. }
  4458. }
  4459. } // show no records
  4460. if (!hasTr) {
  4461. 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>"));
  4462. } else {
  4463. if (!this.options.virtualScroll) {
  4464. this.$body.html(trFragments);
  4465. } else {
  4466. if (this.virtualScroll) {
  4467. this.virtualScroll.destroy();
  4468. }
  4469. this.virtualScroll = new VirtualScroll({
  4470. rows: rows,
  4471. fixedScroll: fixedScroll,
  4472. scrollEl: this.$tableBody[0],
  4473. contentEl: this.$body[0],
  4474. itemHeight: this.options.virtualScrollItemHeight,
  4475. callback: function callback() {
  4476. _this8.fitHeader();
  4477. _this8.initBodyEvent();
  4478. }
  4479. });
  4480. }
  4481. }
  4482. if (!fixedScroll) {
  4483. this.scrollTo(0);
  4484. }
  4485. this.initBodyEvent();
  4486. this.updateSelected();
  4487. this.initFooter();
  4488. this.resetView();
  4489. if (this.options.sidePagination !== 'server') {
  4490. this.options.totalRows = data.length;
  4491. }
  4492. this.trigger('post-body', data);
  4493. }
  4494. }, {
  4495. key: "initBodyEvent",
  4496. value: function initBodyEvent() {
  4497. var _this9 = this;
  4498. // click to select by column
  4499. this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  4500. var $td = $(e.currentTarget);
  4501. var $tr = $td.parent();
  4502. var $cardViewArr = $(e.target).parents('.card-views').children();
  4503. var $cardViewTarget = $(e.target).parents('.card-view');
  4504. var rowIndex = $tr.data('index');
  4505. var item = _this9.data[rowIndex];
  4506. var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
  4507. var fields = _this9.getVisibleFields();
  4508. var field = fields[_this9.options.detailView && _this9.options.detailViewIcon && !_this9.options.cardView ? index - 1 : index];
  4509. var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
  4510. var value = Utils.getItemField(item, field, _this9.options.escape);
  4511. if ($td.find('.detail-icon').length) {
  4512. return;
  4513. }
  4514. _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
  4515. _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
  4516. if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
  4517. var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
  4518. if ($selectItem.length) {
  4519. $selectItem[0].click();
  4520. }
  4521. }
  4522. if (e.type === 'click' && _this9.options.detailViewByClick) {
  4523. _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
  4524. }
  4525. }).off('mousedown').on('mousedown', function (e) {
  4526. // https://github.com/jquery/jquery/issues/1741
  4527. _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
  4528. _this9.multipleSelectRowShiftKey = e.shiftKey;
  4529. });
  4530. this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
  4531. e.preventDefault();
  4532. _this9.toggleDetailView($(e.currentTarget).parent().parent().data('index'));
  4533. return false;
  4534. });
  4535. this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
  4536. this.$selectItem.off('click').on('click', function (e) {
  4537. e.stopImmediatePropagation();
  4538. var $this = $(e.currentTarget);
  4539. _this9._toggleCheck($this.prop('checked'), $this.data('index'));
  4540. });
  4541. this.header.events.forEach(function (_events, i) {
  4542. var events = _events;
  4543. if (!events) {
  4544. return;
  4545. } // fix bug, if events is defined with namespace
  4546. if (typeof events === 'string') {
  4547. events = Utils.calculateObjectValue(null, events);
  4548. }
  4549. var field = _this9.header.fields[i];
  4550. var fieldIndex = _this9.getVisibleFields().indexOf(field);
  4551. if (fieldIndex === -1) {
  4552. return;
  4553. }
  4554. if (_this9.options.detailView && !_this9.options.cardView) {
  4555. fieldIndex += 1;
  4556. }
  4557. var _loop = function _loop(key) {
  4558. if (!events.hasOwnProperty(key)) {
  4559. return "continue";
  4560. }
  4561. var event = events[key];
  4562. _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
  4563. var $tr = $(tr);
  4564. var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
  4565. var index = key.indexOf(' ');
  4566. var name = key.substring(0, index);
  4567. var el = key.substring(index + 1);
  4568. $td.find(el).off(name).on(name, function (e) {
  4569. var index = $tr.data('index');
  4570. var row = _this9.data[index];
  4571. var value = row[field];
  4572. event.apply(_this9, [e, value, row, index]);
  4573. });
  4574. });
  4575. };
  4576. for (var key in events) {
  4577. var _ret = _loop(key);
  4578. if (_ret === "continue") continue;
  4579. }
  4580. });
  4581. }
  4582. }, {
  4583. key: "initServer",
  4584. value: function initServer(silent, query, url) {
  4585. var _this10 = this;
  4586. var data = {};
  4587. var index = this.header.fields.indexOf(this.options.sortName);
  4588. var params = {
  4589. searchText: this.searchText,
  4590. sortName: this.options.sortName,
  4591. sortOrder: this.options.sortOrder
  4592. };
  4593. if (this.header.sortNames[index]) {
  4594. params.sortName = this.header.sortNames[index];
  4595. }
  4596. if (this.options.pagination && this.options.sidePagination === 'server') {
  4597. params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
  4598. params.pageNumber = this.options.pageNumber;
  4599. }
  4600. if (!(url || this.options.url) && !this.options.ajax) {
  4601. return;
  4602. }
  4603. if (this.options.queryParamsType === 'limit') {
  4604. params = {
  4605. search: params.searchText,
  4606. sort: params.sortName,
  4607. order: params.sortOrder
  4608. };
  4609. if (this.options.pagination && this.options.sidePagination === 'server') {
  4610. params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
  4611. params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
  4612. if (params.limit === 0) {
  4613. delete params.limit;
  4614. }
  4615. }
  4616. }
  4617. if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
  4618. params.filter = JSON.stringify(this.filterColumnsPartial, null);
  4619. }
  4620. $.extend(params, query || {});
  4621. data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
  4622. if (data === false) {
  4623. return;
  4624. }
  4625. if (!silent) {
  4626. this.showLoading();
  4627. }
  4628. var request = $.extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
  4629. type: this.options.method,
  4630. url: url || this.options.url,
  4631. data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
  4632. cache: this.options.cache,
  4633. contentType: this.options.contentType,
  4634. dataType: this.options.dataType,
  4635. success: function success(_res, textStatus, jqXHR) {
  4636. var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
  4637. _this10.load(res);
  4638. _this10.trigger('load-success', res, jqXHR.status, jqXHR);
  4639. if (!silent) {
  4640. _this10.hideLoading();
  4641. }
  4642. },
  4643. error: function error(jqXHR) {
  4644. var data = [];
  4645. if (_this10.options.sidePagination === 'server') {
  4646. data = {};
  4647. data[_this10.options.totalField] = 0;
  4648. data[_this10.options.dataField] = [];
  4649. }
  4650. _this10.load(data);
  4651. _this10.trigger('load-error', jqXHR.status, jqXHR);
  4652. if (!silent) _this10.$tableLoading.hide();
  4653. }
  4654. });
  4655. if (this.options.ajax) {
  4656. Utils.calculateObjectValue(this, this.options.ajax, [request], null);
  4657. } else {
  4658. if (this._xhr && this._xhr.readyState !== 4) {
  4659. this._xhr.abort();
  4660. }
  4661. this._xhr = $.ajax(request);
  4662. }
  4663. return data;
  4664. }
  4665. }, {
  4666. key: "initSearchText",
  4667. value: function initSearchText() {
  4668. if (this.options.search) {
  4669. this.searchText = '';
  4670. if (this.options.searchText !== '') {
  4671. var $search = this.$toolbar.find('.search input');
  4672. $search.val(this.options.searchText);
  4673. this.onSearch({
  4674. currentTarget: $search,
  4675. firedByInitSearchText: true
  4676. });
  4677. }
  4678. }
  4679. }
  4680. }, {
  4681. key: "getCaret",
  4682. value: function getCaret() {
  4683. var _this11 = this;
  4684. this.$header.find('th').each(function (i, th) {
  4685. $(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
  4686. });
  4687. }
  4688. }, {
  4689. key: "updateSelected",
  4690. value: function updateSelected() {
  4691. var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
  4692. this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
  4693. this.$selectItem.each(function (i, el) {
  4694. $(el).closest('tr')[$(el).prop('checked') ? 'addClass' : 'removeClass']('selected');
  4695. });
  4696. }
  4697. }, {
  4698. key: "updateRows",
  4699. value: function updateRows() {
  4700. var _this12 = this;
  4701. this.$selectItem.each(function (i, el) {
  4702. _this12.data[$(el).data('index')][_this12.header.stateField] = $(el).prop('checked');
  4703. });
  4704. }
  4705. }, {
  4706. key: "resetRows",
  4707. value: function resetRows() {
  4708. var _iteratorNormalCompletion2 = true;
  4709. var _didIteratorError2 = false;
  4710. var _iteratorError2 = undefined;
  4711. try {
  4712. for (var _iterator2 = this.data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  4713. var row = _step2.value;
  4714. this.$selectAll.prop('checked', false);
  4715. this.$selectItem.prop('checked', false);
  4716. if (this.header.stateField) {
  4717. row[this.header.stateField] = false;
  4718. }
  4719. }
  4720. } catch (err) {
  4721. _didIteratorError2 = true;
  4722. _iteratorError2 = err;
  4723. } finally {
  4724. try {
  4725. if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
  4726. _iterator2.return();
  4727. }
  4728. } finally {
  4729. if (_didIteratorError2) {
  4730. throw _iteratorError2;
  4731. }
  4732. }
  4733. }
  4734. this.initHiddenRows();
  4735. }
  4736. }, {
  4737. key: "trigger",
  4738. value: function trigger(_name) {
  4739. var _this$options;
  4740. var name = "".concat(_name, ".bs.table");
  4741. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key2 = 1; _key2 < _len; _key2++) {
  4742. args[_key2 - 1] = arguments[_key2];
  4743. }
  4744. (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, args);
  4745. this.$el.trigger($.Event(name), args);
  4746. this.options.onAll(name, args);
  4747. this.$el.trigger($.Event('all.bs.table'), [name, args]);
  4748. }
  4749. }, {
  4750. key: "resetHeader",
  4751. value: function resetHeader() {
  4752. var _this13 = this;
  4753. // fix #61: the hidden table reset header bug.
  4754. // fix bug: get $el.css('width') error sometime (height = 500)
  4755. clearTimeout(this.timeoutId_);
  4756. this.timeoutId_ = setTimeout(function () {
  4757. return _this13.fitHeader();
  4758. }, this.$el.is(':hidden') ? 100 : 0);
  4759. }
  4760. }, {
  4761. key: "fitHeader",
  4762. value: function fitHeader() {
  4763. var _this14 = this;
  4764. if (this.$el.is(':hidden')) {
  4765. this.timeoutId_ = setTimeout(function () {
  4766. return _this14.fitHeader();
  4767. }, 100);
  4768. return;
  4769. }
  4770. var fixedBody = this.$tableBody.get(0);
  4771. var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  4772. this.$el.css('margin-top', -this.$header.outerHeight());
  4773. var focused = $(':focus');
  4774. if (focused.length > 0) {
  4775. var $th = focused.parents('th');
  4776. if ($th.length > 0) {
  4777. var dataField = $th.attr('data-field');
  4778. if (dataField !== undefined) {
  4779. var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
  4780. if ($headerTh.length > 0) {
  4781. $headerTh.find(':input').addClass('focus-temp');
  4782. }
  4783. }
  4784. }
  4785. }
  4786. this.$header_ = this.$header.clone(true, true);
  4787. this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
  4788. this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
  4789. this.$tableLoading.css('width', this.$el.outerWidth());
  4790. var focusedTemp = $('.focus-temp:visible:eq(0)');
  4791. if (focusedTemp.length > 0) {
  4792. focusedTemp.focus();
  4793. this.$header.find('.focus-temp').removeClass('focus-temp');
  4794. } // fix bug: $.data() is not working as expected after $.append()
  4795. this.$header.find('th[data-field]').each(function (i, el) {
  4796. _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $(el).data('field'))).data($(el).data());
  4797. });
  4798. var visibleFields = this.getVisibleFields();
  4799. var $ths = this.$header_.find('th');
  4800. var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
  4801. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  4802. $tr = $tr.next();
  4803. }
  4804. $tr.find('> *').each(function (i, el) {
  4805. var $this = $(el);
  4806. var index = i;
  4807. if (_this14.options.detailView && _this14.options.detailViewIcon && !_this14.options.cardView) {
  4808. if (i === 0) {
  4809. var $thDetail = $ths.filter('.detail');
  4810. var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  4811. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
  4812. }
  4813. index = i - 1;
  4814. }
  4815. if (index === -1) {
  4816. return;
  4817. }
  4818. var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
  4819. if ($th.length > 1) {
  4820. $th = $($ths[$this[0].cellIndex]);
  4821. }
  4822. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  4823. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  4824. });
  4825. this.horizontalScroll();
  4826. this.trigger('post-header');
  4827. }
  4828. }, {
  4829. key: "initFooter",
  4830. value: function initFooter() {
  4831. if (!this.options.showFooter || this.options.cardView) {
  4832. // do nothing
  4833. return;
  4834. }
  4835. var data = this.getData();
  4836. var html = [];
  4837. if (!this.options.cardView && this.options.detailView && this.options.detailViewIcon) {
  4838. html.push('<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>');
  4839. }
  4840. var _iteratorNormalCompletion3 = true;
  4841. var _didIteratorError3 = false;
  4842. var _iteratorError3 = undefined;
  4843. try {
  4844. for (var _iterator3 = this.columns[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
  4845. var column = _step3.value;
  4846. var falign = '';
  4847. var valign = '';
  4848. var csses = [];
  4849. var style = {};
  4850. var class_ = Utils.sprintf(' class="%s"', column['class']);
  4851. if (!column.visible) {
  4852. continue;
  4853. }
  4854. if (this.options.cardView && !column.cardVisible) {
  4855. return;
  4856. }
  4857. falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
  4858. valign = Utils.sprintf('vertical-align: %s; ', column.valign);
  4859. style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
  4860. if (style && style.css) {
  4861. for (var _i7 = 0, _Object$entries6 = Object.entries(style.css); _i7 < _Object$entries6.length; _i7++) {
  4862. var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i7], 2),
  4863. key = _Object$entries6$_i[0],
  4864. value = _Object$entries6$_i[1];
  4865. csses.push("".concat(key, ": ").concat(value));
  4866. }
  4867. }
  4868. if (style && style.classes) {
  4869. class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
  4870. }
  4871. html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')), '>');
  4872. html.push('<div class="th-inner">');
  4873. html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data], this.footerData[0] && this.footerData[0][column.field] || ''));
  4874. html.push('</div>');
  4875. html.push('<div class="fht-cell"></div>');
  4876. html.push('</div>');
  4877. html.push('</th>');
  4878. }
  4879. } catch (err) {
  4880. _didIteratorError3 = true;
  4881. _iteratorError3 = err;
  4882. } finally {
  4883. try {
  4884. if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
  4885. _iterator3.return();
  4886. }
  4887. } finally {
  4888. if (_didIteratorError3) {
  4889. throw _iteratorError3;
  4890. }
  4891. }
  4892. }
  4893. this.$tableFooter.find('tr').html(html.join(''));
  4894. this.trigger('post-footer', this.$tableFooter);
  4895. }
  4896. }, {
  4897. key: "fitFooter",
  4898. value: function fitFooter() {
  4899. var _this15 = this;
  4900. if (this.$el.is(':hidden')) {
  4901. setTimeout(function () {
  4902. return _this15.fitFooter();
  4903. }, 100);
  4904. return;
  4905. }
  4906. var fixedBody = this.$tableBody.get(0);
  4907. var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  4908. this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
  4909. var visibleFields = this.getVisibleFields();
  4910. var $ths = this.$tableFooter.find('th');
  4911. var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
  4912. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  4913. $tr = $tr.next();
  4914. }
  4915. $tr.find('> *').each(function (i, el) {
  4916. var $this = $(el);
  4917. var index = i;
  4918. if (_this15.options.detailView && !_this15.options.cardView) {
  4919. if (i === 0) {
  4920. var $thDetail = $ths.filter('.detail');
  4921. var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  4922. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
  4923. }
  4924. index = i - 1;
  4925. }
  4926. if (index === -1) {
  4927. return;
  4928. }
  4929. var $th = $ths.eq(i);
  4930. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  4931. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  4932. });
  4933. this.horizontalScroll();
  4934. }
  4935. }, {
  4936. key: "horizontalScroll",
  4937. value: function horizontalScroll() {
  4938. var _this16 = this;
  4939. // horizontal scroll event
  4940. // TODO: it's probably better improving the layout than binding to scroll event
  4941. this.$tableBody.off('scroll').on('scroll', function (_ref6) {
  4942. var currentTarget = _ref6.currentTarget;
  4943. if (_this16.options.showHeader && _this16.options.height) {
  4944. _this16.$tableHeader.scrollLeft($(currentTarget).scrollLeft());
  4945. }
  4946. if (_this16.options.showFooter && !_this16.options.cardView) {
  4947. _this16.$tableFooter.scrollLeft($(currentTarget).scrollLeft());
  4948. }
  4949. _this16.trigger('scroll-body', $(currentTarget));
  4950. });
  4951. }
  4952. }, {
  4953. key: "getVisibleFields",
  4954. value: function getVisibleFields() {
  4955. var visibleFields = [];
  4956. var _iteratorNormalCompletion4 = true;
  4957. var _didIteratorError4 = false;
  4958. var _iteratorError4 = undefined;
  4959. try {
  4960. for (var _iterator4 = this.header.fields[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
  4961. var field = _step4.value;
  4962. var column = this.columns[this.fieldsColumnsIndex[field]];
  4963. if (!column || !column.visible) {
  4964. continue;
  4965. }
  4966. visibleFields.push(field);
  4967. }
  4968. } catch (err) {
  4969. _didIteratorError4 = true;
  4970. _iteratorError4 = err;
  4971. } finally {
  4972. try {
  4973. if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
  4974. _iterator4.return();
  4975. }
  4976. } finally {
  4977. if (_didIteratorError4) {
  4978. throw _iteratorError4;
  4979. }
  4980. }
  4981. }
  4982. return visibleFields;
  4983. }
  4984. }, {
  4985. key: "initHiddenRows",
  4986. value: function initHiddenRows() {
  4987. this.hiddenRows = [];
  4988. } // PUBLIC FUNCTION DEFINITION
  4989. // =======================
  4990. }, {
  4991. key: "getOptions",
  4992. value: function getOptions() {
  4993. // deep copy and remove data
  4994. var options = $.extend({}, this.options);
  4995. delete options.data;
  4996. return $.extend(true, {}, options);
  4997. }
  4998. }, {
  4999. key: "refreshOptions",
  5000. value: function refreshOptions(options) {
  5001. // If the objects are equivalent then avoid the call of destroy / init methods
  5002. if (Utils.compareObjects(this.options, options, true)) {
  5003. return;
  5004. }
  5005. this.options = $.extend(this.options, options);
  5006. this.trigger('refresh-options', this.options);
  5007. this.destroy();
  5008. this.init();
  5009. }
  5010. }, {
  5011. key: "getData",
  5012. value: function getData(params) {
  5013. var data = this.options.data;
  5014. if (this.searchText || this.options.sortName || !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) {
  5015. data = this.data;
  5016. }
  5017. if (params && params.useCurrentPage) {
  5018. data = data.slice(this.pageFrom - 1, this.pageTo);
  5019. }
  5020. if (params && !params.includeHiddenRows) {
  5021. var hiddenRows = this.getHiddenRows();
  5022. data = data.filter(function (row) {
  5023. return Utils.findIndex(hiddenRows, row) === -1;
  5024. });
  5025. }
  5026. return data;
  5027. }
  5028. }, {
  5029. key: "getSelections",
  5030. value: function getSelections() {
  5031. var _this17 = this;
  5032. // fix #2424: from html with checkbox
  5033. return this.data.filter(function (row) {
  5034. return row[_this17.header.stateField] === true;
  5035. });
  5036. }
  5037. }, {
  5038. key: "getAllSelections",
  5039. value: function getAllSelections() {
  5040. var _this18 = this;
  5041. return this.options.data.filter(function (row) {
  5042. return row[_this18.header.stateField] === true;
  5043. });
  5044. }
  5045. }, {
  5046. key: "load",
  5047. value: function load(_data) {
  5048. var fixedScroll = false;
  5049. var data = _data; // #431: support pagination
  5050. if (this.options.pagination && this.options.sidePagination === 'server') {
  5051. this.options.totalRows = data[this.options.totalField];
  5052. }
  5053. if (this.options.pagination && this.options.sidePagination === 'server') {
  5054. this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
  5055. }
  5056. fixedScroll = data.fixedScroll;
  5057. data = Array.isArray(data) ? data : data[this.options.dataField];
  5058. this.initData(data);
  5059. this.initSearch();
  5060. this.initPagination();
  5061. this.initBody(fixedScroll);
  5062. }
  5063. }, {
  5064. key: "append",
  5065. value: function append(data) {
  5066. this.initData(data, 'append');
  5067. this.initSearch();
  5068. this.initPagination();
  5069. this.initSort();
  5070. this.initBody(true);
  5071. }
  5072. }, {
  5073. key: "prepend",
  5074. value: function prepend(data) {
  5075. this.initData(data, 'prepend');
  5076. this.initSearch();
  5077. this.initPagination();
  5078. this.initSort();
  5079. this.initBody(true);
  5080. }
  5081. }, {
  5082. key: "remove",
  5083. value: function remove(params) {
  5084. var len = this.options.data.length;
  5085. var i;
  5086. var row;
  5087. if (!params.hasOwnProperty('field') || !params.hasOwnProperty('values')) {
  5088. return;
  5089. }
  5090. for (i = len - 1; i >= 0; i--) {
  5091. row = this.options.data[i];
  5092. if (!row.hasOwnProperty(params.field)) {
  5093. continue;
  5094. }
  5095. if (params.values.includes(row[params.field])) {
  5096. this.options.data.splice(i, 1);
  5097. if (this.options.sidePagination === 'server') {
  5098. this.options.totalRows -= 1;
  5099. }
  5100. }
  5101. }
  5102. if (len === this.options.data.length) {
  5103. return;
  5104. }
  5105. this.initSearch();
  5106. this.initPagination();
  5107. this.initSort();
  5108. this.initBody(true);
  5109. }
  5110. }, {
  5111. key: "removeAll",
  5112. value: function removeAll() {
  5113. if (this.options.data.length > 0) {
  5114. this.options.data.splice(0, this.options.data.length);
  5115. this.initSearch();
  5116. this.initPagination();
  5117. this.initBody(true);
  5118. }
  5119. }
  5120. }, {
  5121. key: "insertRow",
  5122. value: function insertRow(params) {
  5123. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
  5124. return;
  5125. }
  5126. this.options.data.splice(params.index, 0, params.row);
  5127. this.initSearch();
  5128. this.initPagination();
  5129. this.initSort();
  5130. this.initBody(true);
  5131. }
  5132. }, {
  5133. key: "updateRow",
  5134. value: function updateRow(params) {
  5135. var allParams = Array.isArray(params) ? params : [params];
  5136. var _iteratorNormalCompletion5 = true;
  5137. var _didIteratorError5 = false;
  5138. var _iteratorError5 = undefined;
  5139. try {
  5140. for (var _iterator5 = allParams[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
  5141. var _params = _step5.value;
  5142. if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
  5143. continue;
  5144. }
  5145. $.extend(this.options.data[_params.index], _params.row);
  5146. if (_params.hasOwnProperty('replace') && _params.replace) {
  5147. this.options.data[_params.index] = _params.row;
  5148. } else {
  5149. $.extend(this.options.data[_params.index], _params.row);
  5150. }
  5151. }
  5152. } catch (err) {
  5153. _didIteratorError5 = true;
  5154. _iteratorError5 = err;
  5155. } finally {
  5156. try {
  5157. if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
  5158. _iterator5.return();
  5159. }
  5160. } finally {
  5161. if (_didIteratorError5) {
  5162. throw _iteratorError5;
  5163. }
  5164. }
  5165. }
  5166. this.initSearch();
  5167. this.initPagination();
  5168. this.initSort();
  5169. this.initBody(true);
  5170. }
  5171. }, {
  5172. key: "getRowByUniqueId",
  5173. value: function getRowByUniqueId(_id) {
  5174. var uniqueId = this.options.uniqueId;
  5175. var len = this.options.data.length;
  5176. var id = _id;
  5177. var dataRow = null;
  5178. var i;
  5179. var row;
  5180. var rowUniqueId;
  5181. for (i = len - 1; i >= 0; i--) {
  5182. row = this.options.data[i];
  5183. if (row.hasOwnProperty(uniqueId)) {
  5184. // uniqueId is a column
  5185. rowUniqueId = row[uniqueId];
  5186. } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
  5187. // uniqueId is a row data property
  5188. rowUniqueId = row._data[uniqueId];
  5189. } else {
  5190. continue;
  5191. }
  5192. if (typeof rowUniqueId === 'string') {
  5193. id = id.toString();
  5194. } else if (typeof rowUniqueId === 'number') {
  5195. if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
  5196. id = parseInt(id);
  5197. } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
  5198. id = parseFloat(id);
  5199. }
  5200. }
  5201. if (rowUniqueId === id) {
  5202. dataRow = row;
  5203. break;
  5204. }
  5205. }
  5206. return dataRow;
  5207. }
  5208. }, {
  5209. key: "updateByUniqueId",
  5210. value: function updateByUniqueId(params) {
  5211. var allParams = Array.isArray(params) ? params : [params];
  5212. var _iteratorNormalCompletion6 = true;
  5213. var _didIteratorError6 = false;
  5214. var _iteratorError6 = undefined;
  5215. try {
  5216. for (var _iterator6 = allParams[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
  5217. var _params2 = _step6.value;
  5218. if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
  5219. continue;
  5220. }
  5221. var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
  5222. if (rowId === -1) {
  5223. continue;
  5224. }
  5225. if (_params2.hasOwnProperty('replace') && _params2.replace) {
  5226. this.options.data[rowId] = _params2.row;
  5227. } else {
  5228. $.extend(this.options.data[rowId], _params2.row);
  5229. }
  5230. }
  5231. } catch (err) {
  5232. _didIteratorError6 = true;
  5233. _iteratorError6 = err;
  5234. } finally {
  5235. try {
  5236. if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
  5237. _iterator6.return();
  5238. }
  5239. } finally {
  5240. if (_didIteratorError6) {
  5241. throw _iteratorError6;
  5242. }
  5243. }
  5244. }
  5245. this.initSearch();
  5246. this.initPagination();
  5247. this.initSort();
  5248. this.initBody(true);
  5249. }
  5250. }, {
  5251. key: "removeByUniqueId",
  5252. value: function removeByUniqueId(id) {
  5253. var len = this.options.data.length;
  5254. var row = this.getRowByUniqueId(id);
  5255. if (row) {
  5256. this.options.data.splice(this.options.data.indexOf(row), 1);
  5257. }
  5258. if (len === this.options.data.length) {
  5259. return;
  5260. }
  5261. this.initSearch();
  5262. this.initPagination();
  5263. this.initBody(true);
  5264. }
  5265. }, {
  5266. key: "updateCell",
  5267. value: function updateCell(params) {
  5268. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
  5269. return;
  5270. }
  5271. this.data[params.index][params.field] = params.value;
  5272. if (params.reinit === false) {
  5273. return;
  5274. }
  5275. this.initSort();
  5276. this.initBody(true);
  5277. }
  5278. }, {
  5279. key: "updateCellByUniqueId",
  5280. value: function updateCellByUniqueId(params) {
  5281. var _this19 = this;
  5282. if (!params.hasOwnProperty('id') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
  5283. return;
  5284. }
  5285. var allParams = Array.isArray(params) ? params : [params];
  5286. allParams.forEach(function (_ref7) {
  5287. var id = _ref7.id,
  5288. field = _ref7.field,
  5289. value = _ref7.value;
  5290. var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
  5291. if (rowId === -1) {
  5292. return;
  5293. }
  5294. _this19.options.data[rowId][field] = value;
  5295. });
  5296. if (params.reinit === false) {
  5297. return;
  5298. }
  5299. this.initSort();
  5300. this.initBody(true);
  5301. }
  5302. }, {
  5303. key: "showRow",
  5304. value: function showRow(params) {
  5305. this._toggleRow(params, true);
  5306. }
  5307. }, {
  5308. key: "hideRow",
  5309. value: function hideRow(params) {
  5310. this._toggleRow(params, false);
  5311. }
  5312. }, {
  5313. key: "_toggleRow",
  5314. value: function _toggleRow(params, visible) {
  5315. var row;
  5316. if (params.hasOwnProperty('index')) {
  5317. row = this.getData()[params.index];
  5318. } else if (params.hasOwnProperty('uniqueId')) {
  5319. row = this.getRowByUniqueId(params.uniqueId);
  5320. }
  5321. if (!row) {
  5322. return;
  5323. }
  5324. var index = Utils.findIndex(this.hiddenRows, row);
  5325. if (!visible && index === -1) {
  5326. this.hiddenRows.push(row);
  5327. } else if (visible && index > -1) {
  5328. this.hiddenRows.splice(index, 1);
  5329. }
  5330. if (visible) {
  5331. this.updatePagination();
  5332. } else {
  5333. this.initBody(true);
  5334. this.initPagination();
  5335. }
  5336. }
  5337. }, {
  5338. key: "getHiddenRows",
  5339. value: function getHiddenRows(show) {
  5340. if (show) {
  5341. this.initHiddenRows();
  5342. this.initBody(true);
  5343. return;
  5344. }
  5345. var data = this.getData();
  5346. var rows = [];
  5347. var _iteratorNormalCompletion7 = true;
  5348. var _didIteratorError7 = false;
  5349. var _iteratorError7 = undefined;
  5350. try {
  5351. for (var _iterator7 = data[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
  5352. var row = _step7.value;
  5353. if (this.hiddenRows.includes(row)) {
  5354. rows.push(row);
  5355. }
  5356. }
  5357. } catch (err) {
  5358. _didIteratorError7 = true;
  5359. _iteratorError7 = err;
  5360. } finally {
  5361. try {
  5362. if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
  5363. _iterator7.return();
  5364. }
  5365. } finally {
  5366. if (_didIteratorError7) {
  5367. throw _iteratorError7;
  5368. }
  5369. }
  5370. }
  5371. this.hiddenRows = rows;
  5372. return rows;
  5373. }
  5374. }, {
  5375. key: "showColumn",
  5376. value: function showColumn(field) {
  5377. var _this20 = this;
  5378. var fields = Array.isArray(field) ? field : [field];
  5379. fields.forEach(function (field) {
  5380. _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
  5381. });
  5382. }
  5383. }, {
  5384. key: "hideColumn",
  5385. value: function hideColumn(field) {
  5386. var _this21 = this;
  5387. var fields = Array.isArray(field) ? field : [field];
  5388. fields.forEach(function (field) {
  5389. _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
  5390. });
  5391. }
  5392. }, {
  5393. key: "_toggleColumn",
  5394. value: function _toggleColumn(index, checked, needUpdate) {
  5395. if (index === -1 || this.columns[index].visible === checked) {
  5396. return;
  5397. }
  5398. this.columns[index].visible = checked;
  5399. this.initHeader();
  5400. this.initSearch();
  5401. this.initPagination();
  5402. this.initBody();
  5403. if (this.options.showColumns) {
  5404. var $items = this.$toolbar.find('.keep-open input').prop('disabled', false);
  5405. if (needUpdate) {
  5406. $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
  5407. }
  5408. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  5409. $items.filter(':checked').prop('disabled', true);
  5410. }
  5411. }
  5412. }
  5413. }, {
  5414. key: "getVisibleColumns",
  5415. value: function getVisibleColumns() {
  5416. return this.columns.filter(function (_ref8) {
  5417. var visible = _ref8.visible;
  5418. return visible;
  5419. });
  5420. }
  5421. }, {
  5422. key: "getHiddenColumns",
  5423. value: function getHiddenColumns() {
  5424. return this.columns.filter(function (_ref9) {
  5425. var visible = _ref9.visible;
  5426. return !visible;
  5427. });
  5428. }
  5429. }, {
  5430. key: "showAllColumns",
  5431. value: function showAllColumns() {
  5432. this._toggleAllColumns(true);
  5433. }
  5434. }, {
  5435. key: "hideAllColumns",
  5436. value: function hideAllColumns() {
  5437. this._toggleAllColumns(false);
  5438. }
  5439. }, {
  5440. key: "_toggleAllColumns",
  5441. value: function _toggleAllColumns(visible) {
  5442. var _this22 = this;
  5443. var _iteratorNormalCompletion8 = true;
  5444. var _didIteratorError8 = false;
  5445. var _iteratorError8 = undefined;
  5446. try {
  5447. for (var _iterator8 = this.columns.slice().reverse()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
  5448. var column = _step8.value;
  5449. if (column.switchable) {
  5450. if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) {
  5451. continue;
  5452. }
  5453. column.visible = visible;
  5454. }
  5455. }
  5456. } catch (err) {
  5457. _didIteratorError8 = true;
  5458. _iteratorError8 = err;
  5459. } finally {
  5460. try {
  5461. if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
  5462. _iterator8.return();
  5463. }
  5464. } finally {
  5465. if (_didIteratorError8) {
  5466. throw _iteratorError8;
  5467. }
  5468. }
  5469. }
  5470. this.initHeader();
  5471. this.initSearch();
  5472. this.initPagination();
  5473. this.initBody();
  5474. if (this.options.showColumns) {
  5475. var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
  5476. if (visible) {
  5477. $items.prop('checked', visible);
  5478. } else {
  5479. $items.get().reverse().forEach(function (item) {
  5480. if ($items.filter(':checked').length > _this22.options.minimumCountColumns) {
  5481. $(item).prop('checked', visible);
  5482. }
  5483. });
  5484. }
  5485. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  5486. $items.filter(':checked').prop('disabled', true);
  5487. }
  5488. }
  5489. }
  5490. }, {
  5491. key: "mergeCells",
  5492. value: function mergeCells(options) {
  5493. var row = options.index;
  5494. var col = this.getVisibleFields().indexOf(options.field);
  5495. var rowspan = options.rowspan || 1;
  5496. var colspan = options.colspan || 1;
  5497. var i;
  5498. var j;
  5499. var $tr = this.$body.find('>tr');
  5500. if (this.options.detailView && !this.options.cardView) {
  5501. col += 1;
  5502. }
  5503. var $td = $tr.eq(row).find('>td').eq(col);
  5504. if (row < 0 || col < 0 || row >= this.data.length) {
  5505. return;
  5506. }
  5507. for (i = row; i < row + rowspan; i++) {
  5508. for (j = col; j < col + colspan; j++) {
  5509. $tr.eq(i).find('>td').eq(j).hide();
  5510. }
  5511. }
  5512. $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
  5513. }
  5514. }, {
  5515. key: "checkAll",
  5516. value: function checkAll() {
  5517. this._toggleCheckAll(true);
  5518. }
  5519. }, {
  5520. key: "uncheckAll",
  5521. value: function uncheckAll() {
  5522. this._toggleCheckAll(false);
  5523. }
  5524. }, {
  5525. key: "_toggleCheckAll",
  5526. value: function _toggleCheckAll(checked) {
  5527. var rowsBefore = this.getSelections();
  5528. this.$selectAll.add(this.$selectAll_).prop('checked', checked);
  5529. this.$selectItem.filter(':enabled').prop('checked', checked);
  5530. this.updateRows();
  5531. var rowsAfter = this.getSelections();
  5532. if (checked) {
  5533. this.trigger('check-all', rowsAfter, rowsBefore);
  5534. return;
  5535. }
  5536. this.trigger('uncheck-all', rowsAfter, rowsBefore);
  5537. }
  5538. }, {
  5539. key: "checkInvert",
  5540. value: function checkInvert() {
  5541. var $items = this.$selectItem.filter(':enabled');
  5542. var checked = $items.filter(':checked');
  5543. $items.each(function (i, el) {
  5544. $(el).prop('checked', !$(el).prop('checked'));
  5545. });
  5546. this.updateRows();
  5547. this.updateSelected();
  5548. this.trigger('uncheck-some', checked);
  5549. checked = this.getSelections();
  5550. this.trigger('check-some', checked);
  5551. }
  5552. }, {
  5553. key: "check",
  5554. value: function check(index) {
  5555. this._toggleCheck(true, index);
  5556. }
  5557. }, {
  5558. key: "uncheck",
  5559. value: function uncheck(index) {
  5560. this._toggleCheck(false, index);
  5561. }
  5562. }, {
  5563. key: "_toggleCheck",
  5564. value: function _toggleCheck(checked, index) {
  5565. var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
  5566. var row = this.data[index];
  5567. if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
  5568. var _iteratorNormalCompletion9 = true;
  5569. var _didIteratorError9 = false;
  5570. var _iteratorError9 = undefined;
  5571. try {
  5572. for (var _iterator9 = this.options.data[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
  5573. var r = _step9.value;
  5574. r[this.header.stateField] = false;
  5575. }
  5576. } catch (err) {
  5577. _didIteratorError9 = true;
  5578. _iteratorError9 = err;
  5579. } finally {
  5580. try {
  5581. if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
  5582. _iterator9.return();
  5583. }
  5584. } finally {
  5585. if (_didIteratorError9) {
  5586. throw _iteratorError9;
  5587. }
  5588. }
  5589. }
  5590. this.$selectItem.filter(':checked').not($el).prop('checked', false);
  5591. }
  5592. row[this.header.stateField] = checked;
  5593. if (this.options.multipleSelectRow) {
  5594. if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
  5595. var indexes = [this.multipleSelectRowLastSelectedIndex, index].sort();
  5596. for (var i = indexes[0] + 1; i < indexes[1]; i++) {
  5597. this.data[i][this.header.stateField] = true;
  5598. this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
  5599. }
  5600. }
  5601. this.multipleSelectRowCtrlKey = false;
  5602. this.multipleSelectRowShiftKey = false;
  5603. this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
  5604. }
  5605. $el.prop('checked', checked);
  5606. this.updateSelected();
  5607. this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
  5608. }
  5609. }, {
  5610. key: "checkBy",
  5611. value: function checkBy(obj) {
  5612. this._toggleCheckBy(true, obj);
  5613. }
  5614. }, {
  5615. key: "uncheckBy",
  5616. value: function uncheckBy(obj) {
  5617. this._toggleCheckBy(false, obj);
  5618. }
  5619. }, {
  5620. key: "_toggleCheckBy",
  5621. value: function _toggleCheckBy(checked, obj) {
  5622. var _this23 = this;
  5623. if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
  5624. return;
  5625. }
  5626. var rows = [];
  5627. this.data.forEach(function (row, i) {
  5628. if (!row.hasOwnProperty(obj.field)) {
  5629. return false;
  5630. }
  5631. if (obj.values.includes(row[obj.field])) {
  5632. var $el = _this23.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
  5633. $el = checked ? $el.not(':checked') : $el.filter(':checked');
  5634. if (!$el.length) {
  5635. return;
  5636. }
  5637. $el.prop('checked', checked);
  5638. row[_this23.header.stateField] = checked;
  5639. rows.push(row);
  5640. _this23.trigger(checked ? 'check' : 'uncheck', row, $el);
  5641. }
  5642. });
  5643. this.updateSelected();
  5644. this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
  5645. }
  5646. }, {
  5647. key: "refresh",
  5648. value: function refresh(params) {
  5649. if (params && params.url) {
  5650. this.options.url = params.url;
  5651. }
  5652. if (params && params.pageNumber) {
  5653. this.options.pageNumber = params.pageNumber;
  5654. }
  5655. if (params && params.pageSize) {
  5656. this.options.pageSize = params.pageSize;
  5657. }
  5658. this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
  5659. }
  5660. }, {
  5661. key: "destroy",
  5662. value: function destroy() {
  5663. this.$el.insertBefore(this.$container);
  5664. $(this.options.toolbar).insertBefore(this.$el);
  5665. this.$container.next().remove();
  5666. this.$container.remove();
  5667. this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
  5668. }
  5669. }, {
  5670. key: "resetView",
  5671. value: function resetView(params) {
  5672. var padding = 0;
  5673. if (params && params.height) {
  5674. this.options.height = params.height;
  5675. }
  5676. this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length);
  5677. this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
  5678. if (!this.options.cardView && this.options.showHeader && this.options.height) {
  5679. this.$tableHeader.show();
  5680. this.resetHeader();
  5681. padding += this.$header.outerHeight(true) + 1;
  5682. } else {
  5683. this.$tableHeader.hide();
  5684. this.trigger('post-header');
  5685. }
  5686. if (!this.options.cardView && this.options.showFooter) {
  5687. this.$tableFooter.show();
  5688. this.fitFooter();
  5689. if (this.options.height) {
  5690. padding += this.$tableFooter.outerHeight(true);
  5691. }
  5692. }
  5693. if (this.options.height) {
  5694. var toolbarHeight = this.$toolbar.outerHeight(true);
  5695. var paginationHeight = this.$pagination.outerHeight(true);
  5696. var height = this.options.height - toolbarHeight - paginationHeight;
  5697. var tableHeight = this.$tableBody.find('table').outerHeight(true);
  5698. this.$tableContainer.css('height', "".concat(height, "px"));
  5699. this.$tableBorder && this.$tableBorder.css('height', "".concat(height - tableHeight - padding - 1, "px"));
  5700. }
  5701. if (this.options.cardView) {
  5702. // remove the element css
  5703. this.$el.css('margin-top', '0');
  5704. this.$tableContainer.css('padding-bottom', '0');
  5705. this.$tableFooter.hide();
  5706. } else {
  5707. // Assign the correct sortable arrow
  5708. this.getCaret();
  5709. this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
  5710. }
  5711. this.trigger('reset-view');
  5712. }
  5713. }, {
  5714. key: "resetWidth",
  5715. value: function resetWidth() {
  5716. if (this.options.showHeader && this.options.height) {
  5717. this.fitHeader();
  5718. }
  5719. if (this.options.showFooter && !this.options.cardView) {
  5720. this.fitFooter();
  5721. }
  5722. }
  5723. }, {
  5724. key: "showLoading",
  5725. value: function showLoading() {
  5726. this.$tableLoading.css('display', 'flex');
  5727. }
  5728. }, {
  5729. key: "hideLoading",
  5730. value: function hideLoading() {
  5731. this.$tableLoading.css('display', 'none');
  5732. }
  5733. }, {
  5734. key: "togglePagination",
  5735. value: function togglePagination() {
  5736. this.options.pagination = !this.options.pagination;
  5737. var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
  5738. var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
  5739. this.$toolbar.find('button[name="paginationSwitch"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
  5740. this.updatePagination();
  5741. }
  5742. }, {
  5743. key: "toggleFullscreen",
  5744. value: function toggleFullscreen() {
  5745. this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
  5746. this.resetView();
  5747. }
  5748. }, {
  5749. key: "toggleView",
  5750. value: function toggleView() {
  5751. this.options.cardView = !this.options.cardView;
  5752. this.initHeader();
  5753. var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
  5754. var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
  5755. this.$toolbar.find('button[name="toggle"]').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
  5756. this.initBody();
  5757. this.trigger('toggle', this.options.cardView);
  5758. }
  5759. }, {
  5760. key: "resetSearch",
  5761. value: function resetSearch(text) {
  5762. var $search = this.$toolbar.find('.search input');
  5763. $search.val(text || '');
  5764. this.onSearch({
  5765. currentTarget: $search
  5766. });
  5767. }
  5768. }, {
  5769. key: "filterBy",
  5770. value: function filterBy(columns, options) {
  5771. this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $.extend(this.options.filterOptions, options);
  5772. this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
  5773. this.options.pageNumber = 1;
  5774. this.initSearch();
  5775. this.updatePagination();
  5776. }
  5777. }, {
  5778. key: "scrollTo",
  5779. value: function scrollTo(params) {
  5780. if (typeof params === 'undefined') {
  5781. return this.$tableBody.scrollTop();
  5782. }
  5783. var options = {
  5784. unit: 'px',
  5785. value: 0
  5786. };
  5787. if (_typeof(params) === 'object') {
  5788. options = Object.assign(options, params);
  5789. } else if (typeof params === 'string' && params === 'bottom') {
  5790. options.value = this.$tableBody[0].scrollHeight;
  5791. } else if (typeof params === 'string') {
  5792. options.value = params;
  5793. }
  5794. var scrollTo = options.value;
  5795. if (options.unit === 'rows') {
  5796. scrollTo = 0;
  5797. this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
  5798. scrollTo += $(el).outerHeight(true);
  5799. });
  5800. }
  5801. this.$tableBody.scrollTop(scrollTo);
  5802. }
  5803. }, {
  5804. key: "getScrollPosition",
  5805. value: function getScrollPosition() {
  5806. return this.scrollTo();
  5807. }
  5808. }, {
  5809. key: "selectPage",
  5810. value: function selectPage(page) {
  5811. if (page > 0 && page <= this.options.totalPages) {
  5812. this.options.pageNumber = page;
  5813. this.updatePagination();
  5814. }
  5815. }
  5816. }, {
  5817. key: "prevPage",
  5818. value: function prevPage() {
  5819. if (this.options.pageNumber > 1) {
  5820. this.options.pageNumber--;
  5821. this.updatePagination();
  5822. }
  5823. }
  5824. }, {
  5825. key: "nextPage",
  5826. value: function nextPage() {
  5827. if (this.options.pageNumber < this.options.totalPages) {
  5828. this.options.pageNumber++;
  5829. this.updatePagination();
  5830. }
  5831. }
  5832. }, {
  5833. key: "toggleDetailView",
  5834. value: function toggleDetailView(index, _columnDetailFormatter) {
  5835. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
  5836. if ($tr.next().is('tr.detail-view')) {
  5837. this.collapseRow(index);
  5838. } else {
  5839. this.expandRow(index, _columnDetailFormatter);
  5840. }
  5841. this.resetView();
  5842. }
  5843. }, {
  5844. key: "expandRow",
  5845. value: function expandRow(index, _columnDetailFormatter) {
  5846. var row = this.data[index];
  5847. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  5848. if ($tr.next().is('tr.detail-view')) {
  5849. return;
  5850. }
  5851. if (this.options.detailViewIcon) {
  5852. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
  5853. }
  5854. $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
  5855. var $element = $tr.next().find('td');
  5856. var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
  5857. var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
  5858. if ($element.length === 1) {
  5859. $element.append(content);
  5860. }
  5861. this.trigger('expand-row', index, row, $element);
  5862. }
  5863. }, {
  5864. key: "collapseRow",
  5865. value: function collapseRow(index) {
  5866. var row = this.data[index];
  5867. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  5868. if (!$tr.next().is('tr.detail-view')) {
  5869. return;
  5870. }
  5871. if (this.options.detailViewIcon) {
  5872. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
  5873. }
  5874. this.trigger('collapse-row', index, row, $tr.next());
  5875. $tr.next().remove();
  5876. }
  5877. }, {
  5878. key: "expandAllRows",
  5879. value: function expandAllRows() {
  5880. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  5881. for (var i = 0; i < trs.length; i++) {
  5882. this.expandRow($(trs[i]).data('index'));
  5883. }
  5884. }
  5885. }, {
  5886. key: "collapseAllRows",
  5887. value: function collapseAllRows() {
  5888. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  5889. for (var i = 0; i < trs.length; i++) {
  5890. this.collapseRow($(trs[i]).data('index'));
  5891. }
  5892. }
  5893. }, {
  5894. key: "updateColumnTitle",
  5895. value: function updateColumnTitle(params) {
  5896. if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
  5897. return;
  5898. }
  5899. this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
  5900. if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
  5901. var header = this.options.height !== undefined ? this.$tableHeader : this.$header;
  5902. header.find('th[data-field]').each(function (i, el) {
  5903. if ($(el).data('field') === params.field) {
  5904. $($(el).find('.th-inner')[0]).text(params.title);
  5905. return false;
  5906. }
  5907. });
  5908. }
  5909. }
  5910. }, {
  5911. key: "updateFormatText",
  5912. value: function updateFormatText(formatName, text) {
  5913. if (!/^format/.test(formatName) || !this.options[formatName]) {
  5914. return;
  5915. }
  5916. if (typeof text === 'string') {
  5917. this.options[formatName] = function () {
  5918. return text;
  5919. };
  5920. } else if (typeof text === 'function') {
  5921. this.options[formatName] = text;
  5922. }
  5923. this.initToolbar();
  5924. this.initPagination();
  5925. this.initBody();
  5926. }
  5927. }]);
  5928. return BootstrapTable;
  5929. }();
  5930. BootstrapTable.VERSION = Constants.VERSION;
  5931. BootstrapTable.DEFAULTS = Constants.DEFAULTS;
  5932. BootstrapTable.LOCALES = Constants.LOCALES;
  5933. BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
  5934. BootstrapTable.METHODS = Constants.METHODS;
  5935. BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
  5936. // =======================
  5937. $.BootstrapTable = BootstrapTable;
  5938. $.fn.bootstrapTable = function (option) {
  5939. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
  5940. args[_key3 - 1] = arguments[_key3];
  5941. }
  5942. var value;
  5943. this.each(function (i, el) {
  5944. var data = $(el).data('bootstrap.table');
  5945. var options = $.extend({}, BootstrapTable.DEFAULTS, $(el).data(), _typeof(option) === 'object' && option);
  5946. if (typeof option === 'string') {
  5947. var _data2;
  5948. if (!Constants.METHODS.includes(option)) {
  5949. throw new Error("Unknown method: ".concat(option));
  5950. }
  5951. if (!data) {
  5952. return;
  5953. }
  5954. value = (_data2 = data)[option].apply(_data2, args);
  5955. if (option === 'destroy') {
  5956. $(el).removeData('bootstrap.table');
  5957. }
  5958. }
  5959. if (!data) {
  5960. $(el).data('bootstrap.table', data = new $.BootstrapTable(el, options));
  5961. }
  5962. });
  5963. return typeof value === 'undefined' ? this : value;
  5964. };
  5965. $.fn.bootstrapTable.Constructor = BootstrapTable;
  5966. $.fn.bootstrapTable.theme = Constants.THEME;
  5967. $.fn.bootstrapTable.VERSION = Constants.VERSION;
  5968. $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
  5969. $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
  5970. $.fn.bootstrapTable.events = BootstrapTable.EVENTS;
  5971. $.fn.bootstrapTable.locales = BootstrapTable.LOCALES;
  5972. $.fn.bootstrapTable.methods = BootstrapTable.METHODS;
  5973. $.fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
  5974. // =======================
  5975. $(function () {
  5976. $('[data-toggle="table"]').bootstrapTable();
  5977. });
  5978. return BootstrapTable;
  5979. }));