bootstrap-table.js 231 KB

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