bootstrap-table.js 255 KB

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