bootstrap-table.js 264 KB

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