bootstrap-table.js 254 KB

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