bootstrap-table.js 259 KB

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