bootstrap-table.js 268 KB

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